Diff for /np2/win9x/ini.cpp between versions 1.15 and 1.31

version 1.15, 2003/12/04 06:41:23 version 1.31, 2005/02/07 14:46:14
Line 2 Line 2
 #include        <windowsx.h>  #include        <windowsx.h>
 #include        <io.h>  #include        <io.h>
 #include        "strres.h"  #include        "strres.h"
   #include        "profile.h"
 #include        "np2.h"  #include        "np2.h"
 #include        "np2arg.h"  #include        "np2arg.h"
 #include        "dosio.h"  #include        "dosio.h"
Line 10 Line 11
 #include        "pccore.h"  #include        "pccore.h"
   
   
   
   static BOOL inigetbmp(const UINT8 *ptr, UINT pos) {
   
           return((ptr[pos >> 3] >> (pos & 7)) & 1);
   }
   
   static void inisetbmp(UINT8 *ptr, UINT pos, BOOL set) {
   
           UINT8   bit;
   
           ptr += (pos >> 3);
           bit = 1 << (pos & 7);
           if (set) {
                   *ptr |= bit;
           }
           else {
                   *ptr &= ~bit;
           }
   }
   
 static void inirdargs16(const char *src, const INITBL *ini) {  static void inirdargs16(const char *src, const INITBL *ini) {
   
         SINT16  *dst;          SINT16  *dst;
Line 39  static void inirdargs16(const char *src, Line 60  static void inirdargs16(const char *src,
   
 static void inirdargh8(const char *src, const INITBL *ini) {  static void inirdargh8(const char *src, const INITBL *ini) {
   
         BYTE    *dst;          UINT8   *dst;
         int             dsize;          int             dsize;
         int             i;          int             i;
         BYTE    val;          UINT8   val;
         BOOL    set;          BOOL    set;
         char    c;          char    c;
   
         dst = (BYTE *)ini->value;          dst = (UINT8 *)ini->value;
         dsize = ini->arg;          dsize = ini->arg;
   
         for (i=0; i<dsize; i++) {          for (i=0; i<dsize; i++) {
Line 85  static void inirdargh8(const char *src,  Line 106  static void inirdargh8(const char *src, 
 static void iniwrsetargh8(char *work, int size, const INITBL *ini) {  static void iniwrsetargh8(char *work, int size, const INITBL *ini) {
   
         UINT    i;          UINT    i;
 const BYTE      *ptr;  const UINT8     *ptr;
         UINT    arg;          UINT    arg;
         char    tmp[8];          char    tmp[8];
   
         ptr = (BYTE *)ini->value;          ptr = (UINT8 *)ini->value;
         arg = ini->arg;          arg = ini->arg;
         if (arg > 0) {          if (arg > 0) {
                 SPRINTF(tmp, "%.2x", ptr[0]);                  SPRINTF(tmp, "%.2x", ptr[0]);
Line 114  static void inirdbyte3(const char *src,  Line 135  static void inirdbyte3(const char *src, 
                 }                  }
                 if ((((src[i] - '0') & 0xff) < 9) ||                  if ((((src[i] - '0') & 0xff) < 9) ||
                         (((src[i] - 'A') & 0xdf) < 26)) {                          (((src[i] - 'A') & 0xdf) < 26)) {
                         ((BYTE *)ini->value)[i] = src[i];                          ((UINT8 *)ini->value)[i] = src[i];
                 }                  }
         }          }
 }  }
Line 123  static void inirdkb(const char *src, con Line 144  static void inirdkb(const char *src, con
   
         if ((!milstr_extendcmp(src, "PC98")) ||          if ((!milstr_extendcmp(src, "PC98")) ||
                 (!milstr_cmp(src, "98"))) {                  (!milstr_cmp(src, "98"))) {
                 *(BYTE *)ini->value = KEY_PC98;                  *(UINT8 *)ini->value = KEY_PC98;
         }          }
         else if ((!milstr_extendcmp(src, "DOS")) ||          else if ((!milstr_extendcmp(src, "DOS")) ||
                         (!milstr_cmp(src, "PCAT")) ||                          (!milstr_cmp(src, "PCAT")) ||
                         (!milstr_cmp(src, "AT"))) {                          (!milstr_cmp(src, "AT"))) {
                 *(BYTE *)ini->value = KEY_KEY106;                  *(UINT8 *)ini->value = KEY_KEY106;
         }          }
         else if ((!milstr_extendcmp(src, "KEY101")) ||          else if ((!milstr_extendcmp(src, "KEY101")) ||
                         (!milstr_cmp(src, "101"))) {                          (!milstr_cmp(src, "101"))) {
                 *(BYTE *)ini->value = KEY_KEY101;                  *(UINT8 *)ini->value = KEY_KEY101;
         }          }
 }  }
   
Line 158  const INITBL *pterm; Line 179  const INITBL *pterm;
   
                         case INITYPE_BOOL:                          case INITYPE_BOOL:
                                 GetPrivateProfileString(title, p->item,                                  GetPrivateProfileString(title, p->item,
                                                                         (*((BYTE *)p->value))?str_true:str_false,                                                                          (*((UINT8 *)p->value))?str_true:str_false,
                                                                                                   work, sizeof(work), path);
                                   *((UINT8 *)p->value) = (!milstr_cmp(work, str_true))?1:0;
                                   break;
   
                           case INITYPE_BITMAP:
                                   GetPrivateProfileString(title, p->item,
                                           (inigetbmp((UINT8 *)p->value, p->arg))?str_true:str_false,
                                                                                                 work, sizeof(work), path);                                                                                                  work, sizeof(work), path);
                                 *((BYTE *)p->value) = (!milstr_cmp(work, str_true))?1:0;                                  inisetbmp((UINT8 *)p->value, p->arg,
                                                                                   (milstr_cmp(work, str_true) == 0));
                                 break;                                  break;
   
                         case INITYPE_ARGS16:                          case INITYPE_ARGS16:
Line 177  const INITBL *pterm; Line 206  const INITBL *pterm;
   
                         case INITYPE_SINT8:                          case INITYPE_SINT8:
                         case INITYPE_UINT8:                          case INITYPE_UINT8:
                                 val = (BYTE)GetPrivateProfileInt(title, p->item,                                  val = (UINT8)GetPrivateProfileInt(title, p->item,
                                                                                                 *(BYTE *)p->value, path);                                                                                                  *(UINT8 *)p->value, path);
                                 *(BYTE *)p->value = (BYTE)val;                                  *(UINT8 *)p->value = (UINT8)val;
                                 break;                                  break;
   
                         case INITYPE_SINT16:                          case INITYPE_SINT16:
Line 197  const INITBL *pterm; Line 226  const INITBL *pterm;
                                 break;                                  break;
   
                         case INITYPE_HEX8:                          case INITYPE_HEX8:
                                 SPRINTF(work, str_x, *(BYTE *)p->value),                                  SPRINTF(work, str_x, *(UINT8 *)p->value),
                                 GetPrivateProfileString(title, p->item, work,                                  GetPrivateProfileString(title, p->item, work,
                                                                                                 work, sizeof(work), path);                                                                                                  work, sizeof(work), path);
                                 val = (BYTE)milstr_solveHEX(work);                                  val = (UINT8)milstr_solveHEX(work);
                                 *(BYTE *)p->value = (BYTE)val;                                  *(UINT8 *)p->value = (UINT8)val;
                                 break;                                  break;
   
                         case INITYPE_HEX16:                          case INITYPE_HEX16:
Line 217  const INITBL *pterm; Line 246  const INITBL *pterm;
                                 GetPrivateProfileString(title, p->item, work,                                  GetPrivateProfileString(title, p->item, work,
                                                                                                 work, sizeof(work), path);                                                                                                  work, sizeof(work), path);
                                 val = (UINT32)milstr_solveHEX(work);                                  val = (UINT32)milstr_solveHEX(work);
                                 *(UINT16 *)p->value = (UINT32)val;                                  *(UINT32 *)p->value = (UINT32)val;
                                 break;                                  break;
   
                         case INITYPE_BYTE3:                          case INITYPE_BYTE3:
Line 256  const char  *set; Line 285  const char  *set;
                                         break;                                          break;
   
                                 case INITYPE_BOOL:                                  case INITYPE_BOOL:
                                         set = (*((BYTE *)p->value))?str_true:str_false;                                          set = (*((UINT8 *)p->value))?str_true:str_false;
                                         break;                                          break;
   
                                 case INITYPE_ARGH8:                                  case INITYPE_ARGH8:
Line 264  const char  *set; Line 293  const char  *set;
                                         break;                                          break;
   
                                 case INITYPE_SINT8:                                  case INITYPE_SINT8:
                                         SPRINTF(work, str_d, *((char *)p->value));                                          SPRINTF(work, str_d, *((SINT8 *)p->value));
                                         break;                                          break;
   
                                 case INITYPE_SINT16:                                  case INITYPE_SINT16:
Line 276  const char  *set; Line 305  const char  *set;
                                         break;                                          break;
   
                                 case INITYPE_UINT8:                                  case INITYPE_UINT8:
                                         SPRINTF(work, str_u, *((BYTE *)p->value));                                          SPRINTF(work, str_u, *((UINT8 *)p->value));
                                         break;                                          break;
   
                                 case INITYPE_UINT16:                                  case INITYPE_UINT16:
Line 288  const char  *set; Line 317  const char  *set;
                                         break;                                          break;
   
                                 case INITYPE_HEX8:                                  case INITYPE_HEX8:
                                         SPRINTF(work, str_x, *((BYTE *)p->value));                                          SPRINTF(work, str_x, *((UINT8 *)p->value));
                                         break;                                          break;
   
                                 case INITYPE_HEX16:                                  case INITYPE_HEX16:
Line 314  const char  *set; Line 343  const char  *set;
   
 // ----  // ----
   
   #if !defined(SUPPORT_PC9821)
 static const char ini_title[] = "NekoProjectII";  static const char ini_title[] = "NekoProjectII";
   #else
   static const char ini_title[] = "NekoProject21";
   #endif
   
 enum {  enum {
         INIRO_STR                       = INITYPE_STR + INIFLAG_RO,          INIRO_STR                       = INITYPE_STR + INIFLAG_RO,
         INIRO_BOOL                      = INITYPE_BOOL + INIFLAG_RO,          INIRO_BOOL                      = INITYPE_BOOL + INIFLAG_RO,
           INIRO_BITMAP            = INITYPE_BITMAP + INIFLAG_RO,
           INIRO_UINT8                     = INITYPE_UINT8 + INIFLAG_RO,
         INIMAX_UINT8            = INITYPE_UINT8 + INIFLAG_MAX,          INIMAX_UINT8            = INITYPE_UINT8 + INIFLAG_MAX,
         INIAND_UINT8            = INITYPE_UINT8 + INIFLAG_AND,          INIAND_UINT8            = INITYPE_UINT8 + INIFLAG_AND,
         INIROMAX_SINT32         = INITYPE_SINT32 + INIFLAG_RO + INIFLAG_MAX,          INIROMAX_SINT32         = INITYPE_SINT32 + INIFLAG_RO + INIFLAG_MAX,
Line 342  static const INITBL iniitem[] = { Line 377  static const INITBL iniitem[] = {
         {"HDfolder", INITYPE_STR,               hddfolder,                              MAX_PATH},          {"HDfolder", INITYPE_STR,               hddfolder,                              MAX_PATH},
         {"bmap_Dir", INITYPE_STR,               bmpfilefolder,                  MAX_PATH},          {"bmap_Dir", INITYPE_STR,               bmpfilefolder,                  MAX_PATH},
         {"fontfile", INITYPE_STR,               np2cfg.fontfile,                MAX_PATH},          {"fontfile", INITYPE_STR,               np2cfg.fontfile,                MAX_PATH},
         {"biospath", INITYPE_STR,               np2cfg.biospath,                MAX_PATH},          {"biospath", INIRO_STR,                 np2cfg.biospath,                MAX_PATH},
           {"hdrvroot", INIRO_STR,                 np2cfg.hdrvroot,                MAX_PATH},
           {"hdrv_acc", INIRO_UINT8,               &np2cfg.hdrvacc,                0},
   
         {"pc_model", INITYPE_STR,               &np2cfg.model,          {"pc_model", INITYPE_STR,               &np2cfg.model,
                                                                                                         sizeof(np2cfg.model)},                                                                                                          sizeof(np2cfg.model)},
Line 354  static const INITBL iniitem[] = { Line 391  static const INITBL iniitem[] = {
         {"ExMemory", INIMAX_UINT8,              &np2cfg.EXTMEM,                 13},          {"ExMemory", INIMAX_UINT8,              &np2cfg.EXTMEM,                 13},
         {"ITF_WORK", INIRO_BOOL,                &np2cfg.ITF_WORK,               0},          {"ITF_WORK", INIRO_BOOL,                &np2cfg.ITF_WORK,               0},
   
         {"HDD1FILE", INITYPE_STR,               np2cfg.hddfile[0],              MAX_PATH},          {"HDD1FILE", INITYPE_STR,               np2cfg.sasihdd[0],              MAX_PATH},
         {"HDD2FILE", INITYPE_STR,               np2cfg.hddfile[1],              MAX_PATH},          {"HDD2FILE", INITYPE_STR,               np2cfg.sasihdd[1],              MAX_PATH},
 //      {"Removabl", INI_EX|1,  0,              &np2cfg.REMOVEHD,               0},  #if defined(SUPPORT_SCSI)
           {"SCSIHDD0", INITYPE_STR,               np2cfg.scsihdd[0],              MAX_PATH},
           {"SCSIHDD1", INITYPE_STR,               np2cfg.scsihdd[1],              MAX_PATH},
           {"SCSIHDD2", INITYPE_STR,               np2cfg.scsihdd[2],              MAX_PATH},
           {"SCSIHDD3", INITYPE_STR,               np2cfg.scsihdd[3],              MAX_PATH},
   #endif
   
         {"SampleHz", INITYPE_UINT16,    &np2cfg.samplingrate,   0},          {"SampleHz", INITYPE_UINT16,    &np2cfg.samplingrate,   0},
         {"Latencys", INITYPE_UINT16,    &np2cfg.delayms,                0},          {"Latencys", INITYPE_UINT16,    &np2cfg.delayms,                0},
Line 372  static const INITBL iniitem[] = { Line 414  static const INITBL iniitem[] = {
         {"optSPBVR", INITYPE_HEX8,              &np2cfg.spb_vrc,                0},          {"optSPBVR", INITYPE_HEX8,              &np2cfg.spb_vrc,                0},
         {"optSPBVL", INIMAX_UINT8,              &np2cfg.spb_vrl,                24},          {"optSPBVL", INIMAX_UINT8,              &np2cfg.spb_vrl,                24},
         {"optSPB_X", INITYPE_BOOL,              &np2cfg.spb_x,                  0},          {"optSPB_X", INITYPE_BOOL,              &np2cfg.spb_x,                  0},
         {"optMPU98", INITYPE_HEX8               &np2cfg.mpuopt,                 0},          {"optMPU98", INITYPE_HEX8,              &np2cfg.mpuopt,                 0},
   
         {"volume_F", INIMAX_UINT8,              &np2cfg.vol_fm,                 128},          {"volume_F", INIMAX_UINT8,              &np2cfg.vol_fm,                 128},
         {"volume_S", INIMAX_UINT8,              &np2cfg.vol_ssg,                128},          {"volume_S", INIMAX_UINT8,              &np2cfg.vol_ssg,                128},
Line 411  static const INITBL iniitem[] = { Line 453  static const INITBL iniitem[] = {
   
         {"calendar", INITYPE_BOOL,              &np2cfg.calendar,               0},          {"calendar", INITYPE_BOOL,              &np2cfg.calendar,               0},
         {"USE144FD", INITYPE_BOOL,              &np2cfg.usefd144,               0},          {"USE144FD", INITYPE_BOOL,              &np2cfg.usefd144,               0},
           {"FDDRIVE1", INIRO_BITMAP,              &np2cfg.fddequip,               0},
           {"FDDRIVE2", INIRO_BITMAP,              &np2cfg.fddequip,               1},
           {"FDDRIVE3", INIRO_BITMAP,              &np2cfg.fddequip,               2},
           {"FDDRIVE4", INIRO_BITMAP,              &np2cfg.fddequip,               3},
   
   
         // OS°Í¸¡©          // OS°Í¸¡©
         {"keyboard", INIRO_KB,                  &np2oscfg.KEYBOARD,             0},          {"keyboard", INIRO_KB,                  &np2oscfg.KEYBOARD,             0},
Line 454  static const INITBL iniitem[] = { Line 501  static const INITBL iniitem[] = {
         {"com3mmdl", INITYPE_STR,               np2oscfg.com3.mdl,              64},          {"com3mmdl", INITYPE_STR,               np2oscfg.com3.mdl,              64},
         {"com3mdef", INITYPE_STR,               np2oscfg.com3.def,              MAX_PATH},          {"com3mdef", INITYPE_STR,               np2oscfg.com3.def,              MAX_PATH},
   
         {"force400", INITYPE_BOOL,              &np2oscfg.force400,             0},          {"force400", INIRO_BOOL,                &np2oscfg.force400,             0},
         {"e_resume", INITYPE_BOOL,              &np2oscfg.resume,               0},          {"e_resume", INITYPE_BOOL,              &np2oscfg.resume,               0},
         {"STATSAVE", INIRO_BOOL,                &np2oscfg.statsave,             0},          {"STATSAVE", INIRO_BOOL,                &np2oscfg.statsave,             0},
         {"nousemmx", INITYPE_BOOL,              &np2oscfg.disablemmx,   0},             // ver0.36          {"nousemmx", INITYPE_BOOL,              &np2oscfg.disablemmx,   0},             // ver0.36
         {"windtype", INITYPE_UINT8,             &np2oscfg.wintype,              0},          {"windtype", INITYPE_UINT8,             &np2oscfg.wintype,              0},
         {"toolwind", INITYPE_BOOL,              &np2oscfg.toolwin,              0},             // ver0.38          {"toolwind", INITYPE_BOOL,              &np2oscfg.toolwin,              0},             // ver0.38
         {"keydispl", INITYPE_BOOL,              &np2oscfg.keydisp,              0},          {"keydispl", INITYPE_BOOL,              &np2oscfg.keydisp,              0},
           {"jast_snd", INITYPE_BOOL,              &np2oscfg.jastsnd,              0},             // ver0.73
           {"useromeo", INITYPE_BOOL,              &np2oscfg.useromeo,             0},             // ver0.74
           {"thickfrm", INITYPE_BOOL,              &np2oscfg.thickframe,   0},             // ver0.77
           {"xrollkey", INIRO_BOOL,                &np2oscfg.xrollkey,             0},             // ver0.78
         {"I286SAVE", INIRO_BOOL,                &np2oscfg.I286SAVE,             0}};          {"I286SAVE", INIRO_BOOL,                &np2oscfg.I286SAVE,             0}};
   
   
Line 493  void initload(void) { Line 544  void initload(void) {
         char    path[MAX_PATH];          char    path[MAX_PATH];
   
         initgetfile(path, sizeof(path));          initgetfile(path, sizeof(path));
         ini_read(path, ini_title, iniitem, sizeof(iniitem)/sizeof(INITBL));          ini_read(path, ini_title, iniitem, NELEMENTS(iniitem));
 }  }
   
 void initsave(void) {  void initsave(void) {
Line 501  void initsave(void) { Line 552  void initsave(void) {
         char    path[MAX_PATH];          char    path[MAX_PATH];
   
         initgetfile(path, sizeof(path));          initgetfile(path, sizeof(path));
         ini_write(path, ini_title, iniitem, sizeof(iniitem)/sizeof(INITBL));          ini_write(path, ini_title, iniitem, NELEMENTS(iniitem));
 }  }
   

Removed from v.1.15  
changed lines
  Added in v.1.31


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