win32tty keystroke handling

- Move the code for keystroke handling into its own source file.
- Compile and link it as a dynamic link library.
- Dynamically load the keystroke handler at runtime
- Add support for specifying a different handler in defaults.nh
  so that internationalization issues can be dealt with without
  rebuilding nethack, just supply alternative handlers in HACKDIR.

The following exported functions need to be present in
the keystroke handler .dll:
ProcessKeystroke - returns an ascii value to NetHack
NHkbhit  - allows peeking to see if a key/mouse press is waiting
SourceWhere - returns location for souce code for a keystroke handler
SourceAuthor  - returns author information for a keystroke handler
KeyHandlerName  - returns the full or short name of the keystroke handling dll.
This commit is contained in:
nethack.allison
2003-03-09 15:44:50 +00:00
parent daed1ff394
commit 78ce3749dc
8 changed files with 470 additions and 224 deletions

View File

@@ -23,8 +23,6 @@
#
# If you have any questions read the sys/winnt/Install.nt file included
# with the distribution.
# --
# Michael Allison
#==============================================================================
# Do not delete the following 3 lines.
#
@@ -574,7 +572,7 @@ $(NHRES): $(NTSYS)\console.rc $(NTSYS)\NetHack.ico
# DO NOT INDENT THE << below!
#
$(GAMEFILE) : $(ALLOBJ) $(NHRES)
$(GAMEFILE) : $(ALLOBJ) $(NHRES) $(GAMEDIR)\nhdefkey.dll
@if not exist $(GAMEDIR)\*.* mkdir $(GAMEDIR)
@echo Linking....
$(link) $(LFLAGS) user32.lib winmm.lib -out:$@ @<<$(GAME).lnk
@@ -584,6 +582,21 @@ $(GAMEFILE) : $(ALLOBJ) $(NHRES)
@if exist $(O)install.tag del $(O)install.tag
@if exist $(GAMEDIR)\$(GAME).bak del $(GAMEDIR)\$(GAME).bak
$(O)nhdefkey.def:
@echo EXPORTS >$@
@echo ProcessKeystroke >>$@
@echo NHkbhit >>$@
@echo SourceWhere >>$@
@echo SourceAuthor >>$@
@echo KeyHandlerName >>$@
$(GAMEDIR)\nhdefkey.dll : $(O)$(@B).o $(O)$(@B).def
@if not exist $(GAMEDIR)\*.* mkdir $(GAMEDIR)
@echo Linking $@
$(link) -debug:full -debugtype:cv /RELEASE /NOLOGO /DLL user32.lib \
/PDB:"$(@B).PDB" /MAP:"$(@B).map" /DEF:$(O)$(@B).def \
-out:$@ $(O)$(@B).o
#
# Secondary Targets.
#
@@ -1094,20 +1107,22 @@ $(DAT)\dungeon: $(O)utility.tag $(DAT)\dungeon.def
#
$(O)nttty.o: $(HACK_H) $(TILE_H) $(INCL)\win32api.h $(NTSYS)\nttty.c
@@$(CC) $(CFLAGS) -I$(WSHR) -Fo$@ $(NTSYS)\nttty.c
@$(CC) $(CFLAGS) -I$(WSHR) -Fo$@ $(NTSYS)\nttty.c
$(O)nhkeys.o: $(HACK_H) $(TILE_H) $(INCL)\win32api.h $(NTSYS)\nhkeys.c
@$(CC) $(CFLAGS) -I$(WSHR) -Fo$@ $(NTSYS)\nhkeys.c
$(O)winnt.o: $(HACK_H) $(INCL)\win32api.h $(NTSYS)\winnt.c
@@$(CC) $(CFLAGS) -Fo$@ $(NTSYS)\winnt.c
@$(CC) $(CFLAGS) -Fo$@ $(NTSYS)\winnt.c
$(O)ntsound.o: $(HACK_H) $(NTSYS)\ntsound.c
@@$(CC) $(CFLAGS) -Fo$@ $(NTSYS)\ntsound.c
@$(CC) $(CFLAGS) -Fo$@ $(NTSYS)\ntsound.c
$(O)mapimail.o: $(HACK_H) $(INCL)\nhlan.h $(NTSYS)\mapimail.c
@@$(CC) $(CFLAGS) -DMAPI_VERBOSE -Fo$@ $(NTSYS)\mapimail.c
@$(CC) $(CFLAGS) -DMAPI_VERBOSE -Fo$@ $(NTSYS)\mapimail.c
#
# util dependencies
#
$(O)panic.o: $(U)panic.c $(CONFIG_H)
@@$(CC) $(CFLAGS) -Fo$@ $(U)panic.c
@$(CC) $(CFLAGS) -Fo$@ $(U)panic.c
#
# The rest are stolen from sys/unix/Makefile.src,