| version 1.8, 2003/10/30 16:54:04 | version 1.23, 2004/02/11 17:39:59 | 
| 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 179  const INITBL *pterm; | Line 180  const INITBL *pterm; | 
 | case INITYPE_UINT8: | case INITYPE_UINT8: | 
 | val = (BYTE)GetPrivateProfileInt(title, p->item, | val = (BYTE)GetPrivateProfileInt(title, p->item, | 
 | *(BYTE *)p->value, path); | *(BYTE *)p->value, path); | 
| *(BYTE *)p->value = (BYTE)val; | *(UINT8 *)p->value = (UINT8)val; | 
 | break; | break; | 
 |  |  | 
 | case INITYPE_SINT16: | case INITYPE_SINT16: | 
| Line 201  const INITBL *pterm; | Line 202  const INITBL *pterm; | 
 | GetPrivateProfileString(title, p->item, work, | GetPrivateProfileString(title, p->item, work, | 
 | work, sizeof(work), path); | work, sizeof(work), path); | 
 | val = (BYTE)milstr_solveHEX(work); | val = (BYTE)milstr_solveHEX(work); | 
| *(BYTE *)p->value = (BYTE)val; | *(UINT8 *)p->value = (UINT8)val; | 
 | break; | break; | 
 |  |  | 
 | case INITYPE_HEX16: | case INITYPE_HEX16: | 
| Line 226  const INITBL *pterm; | Line 227  const INITBL *pterm; | 
 | inirdbyte3(work, p); | inirdbyte3(work, p); | 
 | break; | break; | 
 |  |  | 
 |  | case INITYPE_USERKEY: | 
 |  | GetPrivateProfileString(title, p->item, str_null, | 
 |  | work, sizeof(work), path); | 
 |  | ((UINT8 *)p->value)[0] = (UINT8)profile_setkeys(work, | 
 |  | ((UINT8 *)p->value) + 1, 15); | 
 |  | break; | 
 |  |  | 
 | case INITYPE_KB: | case INITYPE_KB: | 
 | GetPrivateProfileString(title, p->item, str_null, | GetPrivateProfileString(title, p->item, str_null, | 
 | work, sizeof(work), path); | work, sizeof(work), path); | 
| Line 264  const char  *set; | Line 272  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 284  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 296  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 299  const char  *set; | Line 307  const char  *set; | 
 | SPRINTF(work, str_x, *((UINT32 *)p->value)); | SPRINTF(work, str_x, *((UINT32 *)p->value)); | 
 | break; | break; | 
 |  |  | 
 |  | case INITYPE_USERKEY: | 
 |  | profile_getkeys(work, sizeof(work), | 
 |  | ((UINT8 *)p->value) + 1, ((UINT8 *)p->value)[0]); | 
 |  | break; | 
 |  |  | 
 | default: | default: | 
 | set = NULL; | set = NULL; | 
 | break; | break; | 
| Line 319  static const char ini_title[] = "NekoPro | Line 332  static const char ini_title[] = "NekoPro | 
 | 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_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 356  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", 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, | 
 |  | sizeof(np2cfg.model)}, | 
 | {"clk_base", INITYPE_UINT32,    &np2cfg.baseclock,              0}, | {"clk_base", INITYPE_UINT32,    &np2cfg.baseclock,              0}, | 
 | {"clk_mult", INITYPE_UINT32,    &np2cfg.multiple,               0}, | {"clk_mult", INITYPE_UINT32,    &np2cfg.multiple,               0}, | 
 |  |  | 
| Line 351  static const INITBL iniitem[] = { | Line 370  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 397  static const INITBL iniitem[] = { | Line 421  static const INITBL iniitem[] = { | 
 | {"GRCG_EGC", INIAND_UINT8,              &np2cfg.grcg,                   3}, | {"GRCG_EGC", INIAND_UINT8,              &np2cfg.grcg,                   3}, | 
 | {"color16b", INITYPE_BOOL,              &np2cfg.color16,                0}, | {"color16b", INITYPE_BOOL,              &np2cfg.color16,                0}, | 
 | {"skipline", INITYPE_BOOL,              &np2cfg.skipline,               0}, | {"skipline", INITYPE_BOOL,              &np2cfg.skipline,               0}, | 
| {"skplight", INITYPE_UINT16             &np2cfg.skiplight,              0}, | {"skplight", INITYPE_UINT16,    &np2cfg.skiplight,              0}, | 
 | {"LCD_MODE", INIAND_UINT8,              &np2cfg.LCD_MODE,               0x03}, | {"LCD_MODE", INIAND_UINT8,              &np2cfg.LCD_MODE,               0x03}, | 
 | {"BG_COLOR", INIROAND_HEX32,    &np2cfg.BG_COLOR,               0xffffff}, | {"BG_COLOR", INIROAND_HEX32,    &np2cfg.BG_COLOR,               0xffffff}, | 
 | {"FG_COLOR", INIROAND_HEX32,    &np2cfg.FG_COLOR,               0xffffff}, | {"FG_COLOR", INIROAND_HEX32,    &np2cfg.FG_COLOR,               0xffffff}, | 
| Line 408  static const INITBL iniitem[] = { | Line 432  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}, | 
 |  | {"userkey1", INITYPE_USERKEY,   np2cfg.userkey[0],              16}, | 
 |  | {"userkey2", INITYPE_USERKEY,   np2cfg.userkey[1],              16}, | 
 |  |  | 
 |  |  | 
 | // OS°Í¸¡© | // OS°Í¸¡© | 
 | {"keyboard", INIRO_KB,                  &np2oscfg.KEYBOARD,             0}, | {"keyboard", INIRO_KB,                  &np2oscfg.KEYBOARD,             0}, | 
| Line 451  static const INITBL iniitem[] = { | Line 478  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}, | 
 | {"toolwind", INITYPE_BOOL,              &np2oscfg.toolwin,              0},             // ver0.38 | {"toolwind", INITYPE_BOOL,              &np2oscfg.toolwin,              0},             // ver0.38 | 
 |  | {"keydispl", INITYPE_BOOL,              &np2oscfg.keydisp,              0}, | 
 |  | {"jast_snd", INITYPE_BOOL,              &np2oscfg.jastsnd,              0},             // ver0.73 | 
 |  | {"useromeo", INITYPE_BOOL,              &np2oscfg.useromeo,             0},             // ver0.74 | 
 | {"I286SAVE", INIRO_BOOL,                &np2oscfg.I286SAVE,             0}}; | {"I286SAVE", INIRO_BOOL,                &np2oscfg.I286SAVE,             0}}; | 
 |  |  | 
 |  |  | 
| static void getinifile(char *initfile, int max) { | void initgetfile(char *path, UINT size) { | 
 |  |  | 
 | char    *p; | char    *p; | 
 |  |  | 
| milstr_ncpy(initfile, modulefile, max); | file_cpyname(path, modulefile, size); | 
 | if (np2arg.ini) { | if (np2arg.ini) { | 
 | if ((np2arg.ini[0] == '/') || (np2arg.ini[0] == '-')) { | if ((np2arg.ini[0] == '/') || (np2arg.ini[0] == '-')) { | 
| file_cutname(initfile); | file_cutname(path); | 
| milstr_ncat(initfile, file_getname(np2arg.ini + 2), max); | file_catname(path, file_getname(np2arg.ini + 2), size); | 
 | } | } | 
 | else { | else { | 
| milstr_ncpy(initfile, np2arg.ini, max); | file_cpyname(path, np2arg.ini, size); | 
 | } | } | 
| p = file_getext(initfile); | p = file_getext(path); | 
 | if (!(*p)) { | if (!(*p)) { | 
| milstr_ncat(initfile, ".ini", max); | file_catname(path, ".ini", size); | 
 | } | } | 
 | } | } | 
 | else { | else { | 
| file_cutext(initfile); | file_cutext(path); | 
| milstr_ncat(initfile, ".ini", max); | file_catname(path, ".ini", size); | 
 | } | } | 
 | } | } | 
 |  |  | 
| Line 487  void initload(void) { | Line 518  void initload(void) { | 
 |  |  | 
 | char    path[MAX_PATH]; | char    path[MAX_PATH]; | 
 |  |  | 
| getinifile(path, sizeof(path)); | initgetfile(path, sizeof(path)); | 
 | ini_read(path, ini_title, iniitem, sizeof(iniitem)/sizeof(INITBL)); | ini_read(path, ini_title, iniitem, sizeof(iniitem)/sizeof(INITBL)); | 
 | } | } | 
 |  |  | 
| Line 495  void initsave(void) { | Line 526  void initsave(void) { | 
 |  |  | 
 | char    path[MAX_PATH]; | char    path[MAX_PATH]; | 
 |  |  | 
| getinifile(path, sizeof(path)); | initgetfile(path, sizeof(path)); | 
 | ini_write(path, ini_title, iniitem, sizeof(iniitem)/sizeof(INITBL)); | ini_write(path, ini_title, iniitem, sizeof(iniitem)/sizeof(INITBL)); | 
 | } | } | 
 |  |  |