| version 1.6, 2003/10/07 12:21:33 |
version 1.7, 2003/10/23 18:14:30 |
|
|
| * |
* |
| */ |
*/ |
| |
|
| /* $Platon: games/_shared/dos2linux.c,v 1.5 2003/08/12 20:50:59 nepto Exp $ */ |
/* $Platon: games/_shared/dos2linux.c,v 1.6 2003/10/07 12:21:33 nepto Exp $ */ |
| |
|
| #include <string.h> |
#include <string.h> |
| #include <stdlib.h> |
#include <stdlib.h> |
|
|
| |
|
| #include "dos2linux.h" |
#include "dos2linux.h" |
| |
|
| |
static int getch_next_ret = 0; /* used by both, SVGAlib and X11 */ |
| |
|
| #if PLATON_SYSTEM_SVGALIB |
#if PLATON_SYSTEM_SVGALIB |
| |
|
| #include <vga.h> |
#include <vga.h> |
| |
|
| static int getch_next_ret = 0; |
|
| |
|
| int kbhit(void) /* {{{ */ |
int kbhit(void) /* {{{ */ |
| { |
{ |
| register int ret; |
register int ret; |
| Line 85 int getch(void) /* {{{ */ |
|
| Line 85 int getch(void) /* {{{ */ |
|
| int kbhit(void) /* {{{ */ |
int kbhit(void) /* {{{ */ |
| { |
{ |
| X11_BGI_update_IO(); |
X11_BGI_update_IO(); |
| return 0; |
return KEYINFO_buffer != 0; |
| } /* }}} */ |
} /* }}} */ |
| |
|
| int getch(void) /* {{{ */ |
int getch(void) /* {{{ */ |
| { |
{ |
| X11_BGI_update_IO(); |
register int ret; |
| return 0; |
if (getch_next_ret != 0) { |
| |
ret = getch_next_ret; |
| |
getch_next_ret = 0; |
| |
} else { |
| |
do { |
| |
X11_BGI_update_IO(); |
| |
} while (KEYINFO_buffer == 0); |
| |
ret = KEYINFO_buffer; |
| |
if (ret > 0xff00) |
| |
ret -= 0xff00; |
| |
switch (ret) { |
| |
case 81: getch_next_ret = SLEFT; break; |
| |
case 82: getch_next_ret = SUP; break; |
| |
case 83: getch_next_ret = SRIGHT; break; |
| |
case 84: getch_next_ret = SDOWN; break; |
| |
case 190: getch_next_ret = F1; break; |
| |
case 191: getch_next_ret = F2; break; |
| |
case 192: getch_next_ret = F3; break; |
| |
case 193: getch_next_ret = F4; break; |
| |
case 194: getch_next_ret = F5; break; |
| |
case 195: getch_next_ret = F6; break; |
| |
case 196: getch_next_ret = F7; break; |
| |
case 197: getch_next_ret = F8; break; |
| |
case 198: getch_next_ret = F9; break; |
| |
case 199: getch_next_ret = F10; break; |
| |
} |
| |
if (getch_next_ret != 0) |
| |
ret = NUL; |
| |
#if 1 |
| |
fprintf(stderr, "getch() input key transformation: %x (%d) => %x (%d)", |
| |
KEYINFO_buffer, KEYINFO_buffer, ret, ret); |
| |
if (getch_next_ret != 0) |
| |
fprintf(stderr, " + %x (%d)", getch_next_ret, getch_next_ret); |
| |
fputc('\n', stderr); |
| |
#endif |
| |
KEYINFO_buffer = 0; |
| |
} |
| |
return ret; |
| } /* }}} */ |
} /* }}} */ |
| |
|
| #endif |
#endif |