Some altkeyhandler tweaking
This commit is contained in:
@@ -2663,6 +2663,9 @@ char *buf;
|
|||||||
defopt);
|
defopt);
|
||||||
else if (!strcmp(optname,"align"))
|
else if (!strcmp(optname,"align"))
|
||||||
Sprintf(buf, "%s", rolestring(flags.initalign, aligns, adj));
|
Sprintf(buf, "%s", rolestring(flags.initalign, aligns, adj));
|
||||||
|
else if (!strcmp(optname,"altkeyhandler"))
|
||||||
|
Sprintf(buf, "%s", iflags.altkeyhandler[0] ?
|
||||||
|
iflags.altkeyhandler : "default");
|
||||||
else if (!strcmp(optname, "boulder"))
|
else if (!strcmp(optname, "boulder"))
|
||||||
Sprintf(buf, "%c", iflags.bouldersym ?
|
Sprintf(buf, "%c", iflags.bouldersym ?
|
||||||
iflags.bouldersym : oc_syms[(int)objects[BOULDER].oc_class]);
|
iflags.bouldersym : oc_syms[(int)objects[BOULDER].oc_class]);
|
||||||
|
|||||||
@@ -13,6 +13,15 @@
|
|||||||
# for tty window-port.
|
# for tty window-port.
|
||||||
OPTIONS=IBMGraphics
|
OPTIONS=IBMGraphics
|
||||||
|
|
||||||
|
# Keyboard handling
|
||||||
|
# Different keyboard handlers can be loaded.
|
||||||
|
# Default is nhdefkey.dll but you can override that.
|
||||||
|
# Ray Chason's keyboard handler
|
||||||
|
# OPTIONS=altkeyhandler:nhraykey.dll
|
||||||
|
#
|
||||||
|
# NetHack 3.4.0 keyboard handling
|
||||||
|
# OPTIONS=altkeyhandler:nh340key.dll
|
||||||
|
|
||||||
# *** Personal Preferences ***
|
# *** Personal Preferences ***
|
||||||
# Some options to set personal preferences. Uncomment and change these to
|
# Some options to set personal preferences. Uncomment and change these to
|
||||||
# suit your personal preference. If several people are to use the same
|
# suit your personal preference. If several people are to use the same
|
||||||
|
|||||||
@@ -825,18 +825,28 @@ register char *op;
|
|||||||
void
|
void
|
||||||
load_keyboard_handler()
|
load_keyboard_handler()
|
||||||
{
|
{
|
||||||
char suffx[] = ".dll";
|
char suffx[] = ".dll";
|
||||||
|
char *truncspot;
|
||||||
#define MAX_DLLNAME 25
|
#define MAX_DLLNAME 25
|
||||||
char kh[MAX_ALTKEYHANDLER];
|
char kh[MAX_ALTKEYHANDLER];
|
||||||
if (iflags.altkeyhandler[0]) {
|
if (iflags.altkeyhandler[0]) {
|
||||||
if (hLibrary) { /* already one loaded apparently */
|
if (hLibrary) { /* already one loaded apparently */
|
||||||
FreeLibrary(hLibrary);
|
FreeLibrary(hLibrary);
|
||||||
hLibrary = (HANDLE)0;
|
hLibrary = (HANDLE)0;
|
||||||
|
pNHkbhit = (NHKBHIT)0;
|
||||||
|
pCheckInput = (CHECKINPUT)0;
|
||||||
|
pSourceWhere = (SOURCEWHERE)0;
|
||||||
|
pSourceAuthor = (SOURCEAUTHOR)0;
|
||||||
|
pKeyHandlerName = (KEYHANDLERNAME)0;
|
||||||
|
pProcessKeystroke = (PROCESS_KEYSTROKE)0;
|
||||||
}
|
}
|
||||||
|
if ((truncspot = strstri(iflags.altkeyhandler, suffx)) != 0)
|
||||||
|
*truncspot = '\0';
|
||||||
(void) strncpy(kh, iflags.altkeyhandler,
|
(void) strncpy(kh, iflags.altkeyhandler,
|
||||||
(MAX_ALTKEYHANDLER - sizeof suffx) - 1);
|
(MAX_ALTKEYHANDLER - sizeof suffx) - 1);
|
||||||
kh[(MAX_ALTKEYHANDLER - sizeof suffx) - 1] = '\0';
|
kh[(MAX_ALTKEYHANDLER - sizeof suffx) - 1] = '\0';
|
||||||
Strcat(kh, suffx);
|
Strcat(kh, suffx);
|
||||||
|
Strcpy(iflags.altkeyhandler, kh);
|
||||||
hLibrary = LoadLibrary(kh);
|
hLibrary = LoadLibrary(kh);
|
||||||
if (hLibrary) {
|
if (hLibrary) {
|
||||||
pProcessKeystroke =
|
pProcessKeystroke =
|
||||||
@@ -853,12 +863,21 @@ load_keyboard_handler()
|
|||||||
(KEYHANDLERNAME) GetProcAddress (hLibrary, TEXT ("KeyHandlerName"));
|
(KEYHANDLERNAME) GetProcAddress (hLibrary, TEXT ("KeyHandlerName"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!pProcessKeystroke || !pNHkbhit) {
|
if (!pProcessKeystroke || !pNHkbhit || !pCheckInput) {
|
||||||
if (hLibrary) {
|
if (hLibrary) {
|
||||||
FreeLibrary(hLibrary);
|
FreeLibrary(hLibrary);
|
||||||
hLibrary = (HANDLE)0;
|
hLibrary = (HANDLE)0;
|
||||||
|
pNHkbhit = (NHKBHIT)0;
|
||||||
|
pCheckInput = (CHECKINPUT)0;
|
||||||
|
pSourceWhere = (SOURCEWHERE)0;
|
||||||
|
pSourceAuthor = (SOURCEAUTHOR)0;
|
||||||
|
pKeyHandlerName = (KEYHANDLERNAME)0;
|
||||||
|
pProcessKeystroke = (PROCESS_KEYSTROKE)0;
|
||||||
}
|
}
|
||||||
hLibrary = LoadLibrary("nhdefkey.dll");
|
(void)strncpy(kh, "nhdefkey.dll", (MAX_ALTKEYHANDLER - sizeof suffx) - 1);
|
||||||
|
kh[(MAX_ALTKEYHANDLER - sizeof suffx) - 1] = '\0';
|
||||||
|
Strcpy(iflags.altkeyhandler, kh);
|
||||||
|
hLibrary = LoadLibrary(kh);
|
||||||
if (hLibrary) {
|
if (hLibrary) {
|
||||||
pProcessKeystroke =
|
pProcessKeystroke =
|
||||||
(PROCESS_KEYSTROKE) GetProcAddress (hLibrary, TEXT ("ProcessKeystroke"));
|
(PROCESS_KEYSTROKE) GetProcAddress (hLibrary, TEXT ("ProcessKeystroke"));
|
||||||
@@ -874,7 +893,7 @@ load_keyboard_handler()
|
|||||||
(KEYHANDLERNAME) GetProcAddress (hLibrary, TEXT ("KeyHandlerName"));
|
(KEYHANDLERNAME) GetProcAddress (hLibrary, TEXT ("KeyHandlerName"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!pProcessKeystroke || !pNHkbhit) {
|
if (!pProcessKeystroke || !pNHkbhit || !pCheckInput) {
|
||||||
if (!hLibrary)
|
if (!hLibrary)
|
||||||
raw_printf("\nNetHack was unable to load keystroke handler.\n");
|
raw_printf("\nNetHack was unable to load keystroke handler.\n");
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user