|
|
| version 1.4, 2003/10/28 13:03:48 | version 1.20, 2004/01/09 07:27:15 |
|---|---|
| Line 10 | Line 10 |
| #include "pccore.h" | #include "pccore.h" |
| static void inirdarg8(const char *src, const INITBL *ini) { | static void inirdargs16(const char *src, const INITBL *ini) { |
| SINT16 *dst; | |
| int dsize; | |
| int i; | |
| char c; | |
| dst = (SINT16 *)ini->value; | |
| dsize = ini->arg; | |
| for (i=0; i<dsize; i++) { | |
| while(*src == ' ') { | |
| src++; | |
| } | |
| if (*src == '\0') { | |
| break; | |
| } | |
| dst[i] = (SINT16)milstr_solveINT(src); | |
| while(*src != '\0') { | |
| c = *src++; | |
| if (c == ',') { | |
| break; | |
| } | |
| } | |
| } | |
| } | |
| static void inirdargh8(const char *src, const INITBL *ini) { | |
| BYTE *dst; | BYTE *dst; |
| int dsize; | int dsize; |
| Line 55 static void inirdarg8(const char *src, c | Line 82 static void inirdarg8(const char *src, c |
| } | } |
| } | } |
| static void iniwrsetarg8(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 BYTE *ptr; |
| Line 136 const INITBL *pterm; | Line 163 const INITBL *pterm; |
| *((BYTE *)p->value) = (!milstr_cmp(work, str_true))?1:0; | *((BYTE *)p->value) = (!milstr_cmp(work, str_true))?1:0; |
| break; | break; |
| case INITYPE_BYTEARG: | case INITYPE_ARGS16: |
| GetPrivateProfileString(title, p->item, str_null, | |
| work, sizeof(work), path); | |
| inirdargs16(work, p); | |
| break; | |
| case INITYPE_ARGH8: | |
| GetPrivateProfileString(title, p->item, str_null, | GetPrivateProfileString(title, p->item, str_null, |
| work, sizeof(work), path); | work, sizeof(work), path); |
| inirdarg8(work, p); | inirdargh8(work, p); |
| break; | break; |
| case INITYPE_SINT8: | case INITYPE_SINT8: |
| Line 226 const char *set; | Line 259 const char *set; |
| set = (*((BYTE *)p->value))?str_true:str_false; | set = (*((BYTE *)p->value))?str_true:str_false; |
| break; | break; |
| case INITYPE_BYTEARG: | case INITYPE_ARGH8: |
| iniwrsetarg8(work, sizeof(work), p); | iniwrsetargh8(work, sizeof(work), p); |
| break; | break; |
| case INITYPE_SINT8: | case INITYPE_SINT8: |
| Line 286 static const char ini_title[] = "NekoPro | Line 319 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, |
| INIMAX_UINT8 = INITYPE_UINT8 + INIFLAG_RO, | INIRO_UINT8 = INITYPE_UINT8 + INIFLAG_RO, |
| 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, |
| INIROAND_HEX32 = INITYPE_HEX32 + INIFLAG_RO + INIFLAG_AND, | INIROAND_HEX32 = INITYPE_HEX32 + INIFLAG_RO + INIFLAG_AND, |
| Line 309 static const INITBL iniitem[] = { | Line 343 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}, |
| {"DIPswtch", INITYPE_BYTEARG, np2cfg.dipsw, 3}, | {"DIPswtch", INITYPE_ARGH8, np2cfg.dipsw, 3}, |
| {"MEMswtch", INITYPE_BYTEARG, np2cfg.memsw, 8}, | {"MEMswtch", INITYPE_ARGH8, np2cfg.memsw, 8}, |
| {"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}, |
| Line 322 static const INITBL iniitem[] = { | Line 361 static const INITBL iniitem[] = { |
| {"HDD2FILE", INITYPE_STR, np2cfg.hddfile[1], MAX_PATH}, | {"HDD2FILE", INITYPE_STR, np2cfg.hddfile[1], MAX_PATH}, |
| // {"Removabl", INI_EX|1, 0, &np2cfg.REMOVEHD, 0}, | // {"Removabl", INI_EX|1, 0, &np2cfg.REMOVEHD, 0}, |
| {"SampleHz", INITYPE_UINT16 &np2cfg.samplingrate, 0}, | {"SampleHz", INITYPE_UINT16, &np2cfg.samplingrate, 0}, |
| {"Latencys", INITYPE_UINT16 &np2cfg.delayms, 0}, | {"Latencys", INITYPE_UINT16, &np2cfg.delayms, 0}, |
| {"SNDboard", INITYPE_HEX8 &np2cfg.SOUND_SW, 0}, | {"SNDboard", INITYPE_HEX8, &np2cfg.SOUND_SW, 0}, |
| {"BEEP_vol", INIAND_UINT8, &np2cfg.BEEP_VOL, 3}, | {"BEEP_vol", INIAND_UINT8, &np2cfg.BEEP_VOL, 3}, |
| {"xspeaker", INIRO_BOOL, &np2cfg.snd_x, 0}, | {"xspeaker", INIRO_BOOL, &np2cfg.snd_x, 0}, |
| {"SND14vol", INITYPE_BYTEARG, np2cfg.vol14, 6}, | {"SND14vol", INITYPE_ARGH8, np2cfg.vol14, 6}, |
| // {"opt14BRD", INITYPE_BYTEARG, np2cfg.snd14opt, 3}, | // {"opt14BRD", INITYPE_ARGH8, np2cfg.snd14opt, 3}, |
| {"opt26BRD", INITYPE_HEX8, &np2cfg.snd26opt, 0}, | {"opt26BRD", INITYPE_HEX8, &np2cfg.snd26opt, 0}, |
| {"opt86BRD", INITYPE_HEX8, &np2cfg.snd86opt, 0}, | {"opt86BRD", INITYPE_HEX8, &np2cfg.snd86opt, 0}, |
| {"optSPBRD", INITYPE_HEX8, &np2cfg.spbopt, 0}, | {"optSPBRD", INITYPE_HEX8, &np2cfg.spbopt, 0}, |
| Line 353 static const INITBL iniitem[] = { | Line 392 static const INITBL iniitem[] = { |
| {"MS_RAPID", INITYPE_BOOL, &np2cfg.MOUSERAPID, 0}, | {"MS_RAPID", INITYPE_BOOL, &np2cfg.MOUSERAPID, 0}, |
| {"backgrnd", INIAND_UINT8, &np2oscfg.background, 3}, | {"backgrnd", INIAND_UINT8, &np2oscfg.background, 3}, |
| {"VRAMwait", INITYPE_BYTEARG, np2cfg.wait, 6}, | {"VRAMwait", INITYPE_ARGH8, np2cfg.wait, 6}, |
| {"DspClock", INIAND_UINT8, &np2oscfg.DISPCLK, 3}, | {"DspClock", INIAND_UINT8, &np2oscfg.DISPCLK, 3}, |
| {"DispSync", INITYPE_BOOL, &np2cfg.DISPSYNC, 0}, | {"DispSync", INITYPE_BOOL, &np2cfg.DISPSYNC, 0}, |
| {"Real_Pal", INITYPE_BOOL, &np2cfg.RASTER, 0}, | {"Real_Pal", INITYPE_BOOL, &np2cfg.RASTER, 0}, |
| Line 364 static const INITBL iniitem[] = { | Line 403 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}, |
| {"pc9861_e", INITYPE_BOOL, &np2cfg.pc9861enable, 0}, | {"pc9861_e", INITYPE_BOOL, &np2cfg.pc9861enable, 0}, |
| {"pc9861_s", INITYPE_BYTEARG, np2cfg.pc9861sw, 3}, | {"pc9861_s", INITYPE_ARGH8, np2cfg.pc9861sw, 3}, |
| {"pc9861_j", INITYPE_BYTEARG, np2cfg.pc9861jmp, 6}, | {"pc9861_j", INITYPE_ARGH8, np2cfg.pc9861jmp, 6}, |
| {"calendar", INITYPE_BOOL, &np2cfg.calendar, 0}, | {"calendar", INITYPE_BOOL, &np2cfg.calendar, 0}, |
| {"USE144FD", INITYPE_BOOL, &np2cfg.usefd144, 0}, | {"USE144FD", INITYPE_BOOL, &np2cfg.usefd144, 0}, |
| Line 380 static const INITBL iniitem[] = { | Line 419 static const INITBL iniitem[] = { |
| {"keyboard", INIRO_KB, &np2oscfg.KEYBOARD, 0}, | {"keyboard", INIRO_KB, &np2oscfg.KEYBOARD, 0}, |
| {"F12_COPY", INITYPE_UINT8, &np2oscfg.F12COPY, 0}, | {"F12_COPY", INITYPE_UINT8, &np2oscfg.F12COPY, 0}, |
| {"Joystick", INITYPE_BOOL, &np2oscfg.JOYPAD1, 0}, | {"Joystick", INITYPE_BOOL, &np2oscfg.JOYPAD1, 0}, |
| {"Joy1_btn", INITYPE_BYTEARG, np2oscfg.JOY1BTN, 4}, | {"Joy1_btn", INITYPE_ARGH8, np2oscfg.JOY1BTN, 4}, |
| {"clocknow", INITYPE_UINT8, &np2oscfg.clk_x, 0}, | {"clocknow", INITYPE_UINT8, &np2oscfg.clk_x, 0}, |
| {"clockfnt", INITYPE_UINT8, &np2oscfg.clk_fnt, 0}, | {"clockfnt", INITYPE_UINT8, &np2oscfg.clk_fnt, 0}, |
| Line 418 static const INITBL iniitem[] = { | Line 457 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 | |
| {"keydispl", INITYPE_BOOL, &np2oscfg.keydisp, 0}, | |
| {"jast_snd", INITYPE_BOOL, &np2oscfg.jastsnd, 0}, // ver0.73 | |
| {"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 453 void initload(void) { | Line 496 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 461 void initsave(void) { | Line 504 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)); |
| } | } |