Difference between revisions of "W343-4"

From NetHackWiki
Jump to navigation Jump to search
m (Link to bug anchor)
(This bug is confirmed *not* fixed in 3.6.0)
Line 5: Line 5:
 
  |bilious=313
 
  |bilious=313
 
}}
 
}}
'''W343-4''' designates a [[Bugs in NetHack 3.4.3#W343-4|bug]] that affects the [[Microsoft Windows]] version of [[NetHack 3.4.3]].  It occurs when the keyboard handler [[nhraykey.dll]] is loaded and causes minor problems with the keyboard when performing certain acts, such as locking a [[door]].
+
'''W343-4''' designates a [[Bugs in NetHack 3.4.3#W343-4|bug]] that affects the [[Microsoft Windows]] version of [[NetHack 3.4.2]], [[NetHack 3.4.3|3.4.3]] and [[NetHack 3.6.0|3.6.0]].  It occurs when the keyboard handler [[nhraykey.dll]] is loaded and causes minor problems with the keyboard when performing certain acts, such as locking a [[door]].
  
A [[patch]] is available to fix this bug at the [[Bilious Patch Database]], [http://bilious.alt.org/?313 here]; it also fixes [[W343-3]].  The [[DevTeam]] lists this bug as fixed in the next release.
+
A [[patch]] is available to fix this bug at the [[Bilious Patch Database]], [http://bilious.alt.org/?313 here]; it also fixes [[W343-3]].  Although the [[DevTeam]] lists this bug as fixed in the next release, it is ''not'' fixed in [[NetHack 3.6.0]].
  
 
== Nature of the bug ==
 
== Nature of the bug ==
Line 27: Line 27:
 
== Versions affected ==
 
== Versions affected ==
  
The only versions affected are [[NetHack 3.4.2]] and [[NetHack 3.4.3]].
+
The versions affected are [[NetHack 3.4.2]], [[NetHack 3.4.3]] and [[NetHack 3.6.0]].
  
 
== Patch ==
 
== Patch ==
  
A [[patch]] is available to fix this bug, as [http://groups.google.com/group/rec.games.roguelike.nethack/browse_frm/thread/e92013db64618fe3 this post] to [[rec.games.roguelike.nethack]].  No binaries or variants other than [[Spanish NetHack]] are known to incorporate it.
+
A [[patch]] is available to fix this bug, as [http://groups.google.com/group/rec.games.roguelike.nethack/browse_frm/thread/e92013db64618fe3 this post] to [[rec.games.roguelike.nethack]].  The patch is against [[NetHack 3.4.3]] and may or may not apply cleanly to [[NetHack 3.6.0]].  No binaries or variants other than [[Spanish NetHack]] are known to incorporate the pach.
  
 
The fix is to add a check for the bogus key in NHkbhit().  If found, the bogus key is discarded and the queue is queried again.
 
The fix is to add a check for the bogus key in NHkbhit().  If found, the bogus key is discarded and the queue is queried again.
  
{{nethack-343}}
+
{{nethack-360}}
 
[[Category:Bugs]]
 
[[Category:Bugs]]

Revision as of 06:34, 1 January 2016

Win32 locales fix
Author Ray Chason
Download link
NetHack PatchDB 313

W343-4 designates a bug that affects the Microsoft Windows version of NetHack 3.4.2, 3.4.3 and 3.6.0. It occurs when the keyboard handler nhraykey.dll is loaded and causes minor problems with the keyboard when performing certain acts, such as locking a door.

A patch is available to fix this bug at the Bilious Patch Database, here; it also fixes W343-3. Although the DevTeam lists this bug as fixed in the next release, it is not fixed in NetHack 3.6.0.

Nature of the bug

Bug W343-4 affects all users of NetHack on Windows who use the text mode user interface and the keyboard handler nhraykey.dll.

After performing any act that takes multiple turns and can be interrupted, such as locking a door, the game seems to stop responding. It is necessary to press a key to get it to continue.

This bug is an annoyance rather than a showstopper, but has perhaps slowed the acceptance of nhraykey.dll, despite its improved handling of non-USA (and especially non-English) keyboards.

Cause of the bug

Nhraykey.dll seeks to read both keyboard and mouse input, while translating the keystrokes according to the user's configured localization settings. The Win32 API does not make this task easy: ReadConsole translates the keystrokes, but ignores the mouse, while ReadConsoleInput reads the mouse, but does not translate the keystrokes. Nhraykey.dll solves this problem by calling PeekConsoleInput first, and then calling ReadConsole to retrieve any keystrokes and ReadConsoleInput to clear out anything else.

The complication is that there can be a keystroke, but the call to ReadConsole may still block, keeping the mouse from responding, because the key was a dead key. Nhraykey.dll prevents the blocking by pushing a bogus key event on the queue before calling ReadConsole; if nothing else, the ReadConsole call will return the bogus key.

The bogus key is supposed to be ignored when it is read. The bug is that one particular function, NHkbhit(), doesn't do this. It returns a true status, indicating that a real key is available, and allmain.c then calls Getchar() to retrieve this nonexistent key. The user must eventually provide a real key for Getchar() to return.

Versions affected

The versions affected are NetHack 3.4.2, NetHack 3.4.3 and NetHack 3.6.0.

Patch

A patch is available to fix this bug, as this post to rec.games.roguelike.nethack. The patch is against NetHack 3.4.3 and may or may not apply cleanly to NetHack 3.6.0. No binaries or variants other than Spanish NetHack are known to incorporate the pach.

The fix is to add a check for the bogus key in NHkbhit(). If found, the bogus key is discarded and the queue is queried again.


This page may need to be updated for the current version of NetHack.

It may contain text specific to NetHack 3.6.0. Information on this page may be out of date.

Editors: After reviewing this page and making necessary edits, please change the {{nethack-360}} tag to the current version's tag or {{noversion}} as appropriate.