Diff for /np2/keystat.c between versions 1.12 and 1.18

version 1.12, 2004/03/31 19:23:37 version 1.18, 2005/03/18 09:23:10
Line 5 Line 5
 #include        "iocore.h"  #include        "iocore.h"
 #include        "keystat.h"  #include        "keystat.h"
 #include        "keystat.tbl"  #include        "keystat.tbl"
   #include        "softkbd.h"
   
   
 typedef struct {  typedef struct {
Line 25  static KEYSTAT  keystat; Line 26  static KEYSTAT  keystat;
   
 void keystat_initialize(void) {  void keystat_initialize(void) {
   
         char    path[MAX_PATH];          OEMCHAR path[MAX_PATH];
   
         ZeroMemory(&keyctrl, sizeof(keyctrl));          ZeroMemory(&keyctrl, sizeof(keyctrl));
         keyctrl.keyrep = 0x21;          keyctrl.keyrep = 0x21;
Line 35  void keystat_initialize(void) { Line 36  void keystat_initialize(void) {
         ZeroMemory(&keystat, sizeof(keystat));          ZeroMemory(&keystat, sizeof(keystat));
         FillMemory(keystat.ref, sizeof(keystat.ref), NKEYREF_NC);          FillMemory(keystat.ref, sizeof(keystat.ref), NKEYREF_NC);
         keystat_tblreset();          keystat_tblreset();
         getbiospath(path, "key.txt", sizeof(path));          getbiospath(path, OEMTEXT("key.txt"), NELEMENTS(path));
         keystat_tblload(path);          keystat_tblload(path);
 }  }
   
Line 78  void keystat_tblset(REG8 ref, const UINT Line 79  void keystat_tblset(REG8 ref, const UINT
   
 // ---- config...  // ---- config...
   
 static const char str_userkey1[] = "userkey1";  static const OEMCHAR str_userkey1[] = OEMTEXT("userkey1");
 static const char str_userkey2[] = "userkey2";  static const OEMCHAR str_userkey2[] = OEMTEXT("userkey2");
   
 static REG8 searchkeynum(const char *str, BOOL user) {  static REG8 searchkeynum(const OEMCHAR *str, BOOL user) {
   
 const KEYNAME   *n;  const KEYNAME   *n;
 const KEYNAME   *nterm;  const KEYNAME   *nterm;
   
         n = keyname;          n = keyname;
         nterm = keyname + (sizeof(keyname) / sizeof(KEYNAME));          nterm = keyname + NELEMENTS(keyname);
         while(n < nterm) {          while(n < nterm) {
                 if (!milstr_cmp(n->str, str)) {                  if (!milstr_cmp(n->str, str)) {
                         return(n->num);                          return(n->num);
Line 105  const KEYNAME *nterm; Line 106  const KEYNAME *nterm;
         return(0xff);          return(0xff);
 }  }
   
 void keystat_tblload(const char *filename) {  void keystat_tblload(const OEMCHAR *filename) {
   
         TEXTFILEH       tfh;          TEXTFILEH       tfh;
         char            work[256];          OEMCHAR         work[256];
         char            *p;          OEMCHAR         *p;
         char            *q;          OEMCHAR         *q;
         char            *r;          OEMCHAR         *r;
         UINT8           ref;          UINT8           ref;
         UINT8           key[15];          UINT8           key[15];
         UINT            cnt;          UINT            cnt;
Line 120  void keystat_tblload(const char *filenam Line 121  void keystat_tblload(const char *filenam
         if (tfh == NULL) {          if (tfh == NULL) {
                 goto kstbl_err;                  goto kstbl_err;
         }          }
         while(textfile_read(tfh, work, sizeof(work)) == SUCCESS) {          while(textfile_read(tfh, work, NELEMENTS(work)) == SUCCESS) {
                 p = milstr_nextword(work);                  p = milstr_nextword(work);
                 q = milstr_chr(p, '\t');                  q = milstr_chr(p, '\t');
                 if (q == NULL) {                  if (q == NULL) {
Line 179  static void reloadled(void) { Line 180  static void reloadled(void) {
   
         keyctrl.kanaref = keystat.ref[0x72];          keyctrl.kanaref = keystat.ref[0x72];
         keyctrl.capsref = keystat.ref[0x71];          keyctrl.capsref = keystat.ref[0x71];
   #if defined(SUPPORT_SOFTKBD)
           softkbd_led(getledstat());
   #endif
 }  }
   
 void keystat_ctrlreset(void) {  void keystat_ctrlreset(void) {
Line 186  void keystat_ctrlreset(void) { Line 190  void keystat_ctrlreset(void) {
         keyctrl.reqparam = 0;          keyctrl.reqparam = 0;
         keystat.ref[0x72] = keyctrl.kanaref;          keystat.ref[0x72] = keyctrl.kanaref;
         keystat.ref[0x71] = keyctrl.capsref;          keystat.ref[0x71] = keyctrl.capsref;
   #if defined(SUPPORT_SOFTKBD)
           softkbd_led(getledstat());
   #endif
 }  }
   
 void keystat_ctrlsend(REG8 dat) {  void keystat_ctrlsend(REG8 dat) {
Line 263  void keystat_down(const UINT8 *key, REG8 Line 270  void keystat_down(const UINT8 *key, REG8
                 keydata = *key++;                  keydata = *key++;
                 keycode = (keydata & 0x7f);                  keycode = (keydata & 0x7f);
                 if (keycode < 0x70) {                  if (keycode < 0x70) {
   #if 1                                                                                           // 05/02/04
                           if (keystat.ref[keycode] != NKEYREF_NC) {
                                   if (!(kbexflag[keycode] & KBEX_NONREP)) {
                                           keyboard_send((REG8)(keycode + 0x80));
                                           keystat.ref[keycode] = NKEYREF_NC;
                                   }
                           }
                           if (keystat.ref[keycode] == NKEYREF_NC) {
                                   keyboard_send(keycode);
                           }
   #else
                         if ((keystat.ref[keycode] == NKEYREF_NC) ||                          if ((keystat.ref[keycode] == NKEYREF_NC) ||
                                 (!(kbexflag[keycode] & KBEX_NONREP))) {                                  (!(kbexflag[keycode] & KBEX_NONREP))) {
                                 keyboard_send(keycode);                                  keyboard_send(keycode);
                         }                          }
   #endif
                         keystat.ref[keycode] = ref;                          keystat.ref[keycode] = ref;
                 }                  }
                 else {                  else {

Removed from v.1.12  
changed lines
  Added in v.1.18


RetroPC.NET-CVS <cvs@retropc.net>