--- np2/macosx/ini.cpp 2003/11/03 10:19:43 1.4 +++ np2/macosx/ini.cpp 2004/05/23 04:07:56 1.21 @@ -106,7 +106,7 @@ const INITBL *p; break; case INITYPE_ARGS16: - milstr_ncpy(work, data, 512); + milstr_ncpy(work, data, sizeof(work)); inirdargs16(work, p); break; @@ -226,7 +226,7 @@ static void iniwrsetarg8(char *work, int } void ini_write(const char *path, const char *title, - const INITBL *tbl, UINT count) { + const INITBL *tbl, UINT count, BOOL create) { FILEH fh; const INITBL *p; @@ -234,13 +234,22 @@ const INITBL *pterm; BOOL set; char work[512]; - fh = file_create(path); + fh = FILEH_INVALID; + if (!create) { + fh = file_open(path); + if (fh != FILEH_INVALID) { + file_seek(fh, 0, FSEEK_END); + } + } + if (fh == FILEH_INVALID) { + fh = file_create(path); + } if (fh == FILEH_INVALID) { return; } milstr_ncpy(work, "[", sizeof(work)); milstr_ncat(work, title, sizeof(work)); - milstr_ncat(work, "]\r\n", sizeof(work)); + milstr_ncat(work, "]\r", sizeof(work)); file_write(fh, work, strlen(work)); p = tbl; @@ -306,7 +315,7 @@ const INITBL *pterm; file_write(fh, p->item, strlen(p->item)); file_write(fh, " = ", 3); file_write(fh, work, strlen(work)); - file_write(fh, "\r\n", 2); + file_write(fh, "\r", 1); } p++; } @@ -319,10 +328,22 @@ const INITBL *pterm; extern int winx; extern int winy; +#if !defined(SUPPORT_PC9821) static const char ini_title[] = "NekoProjectII"; static const char inifile[] = "np2.cfg"; +#else +static const char ini_title[] = "NekoProject21"; +static const char inifile[] = "np21.cfg"; +#endif static const INITBL iniitem[] = { + {"np2title", INITYPE_STR, np2oscfg.titles, + sizeof(np2oscfg.titles)}, + {"WindposX", INITYPE_SINT32, &np2oscfg.winx, 0}, + {"WindposY", INITYPE_SINT32, &np2oscfg.winy, 0}, + + {"pc_model", INITYPE_STR, &np2cfg.model, + sizeof(np2cfg.model)}, {"clk_base", INITYPE_SINT32, &np2cfg.baseclock, 0}, {"clk_mult", INITYPE_SINT32, &np2cfg.multiple, 0}, @@ -331,9 +352,18 @@ static const INITBL iniitem[] = { {"ExMemory", INITYPE_UINT8, &np2cfg.EXTMEM, 0}, {"ITF_WORK", INITYPE_BOOL, &np2cfg.ITF_WORK, 0}, - {"HDD1FILE", INITYPE_STR, np2cfg.hddfile[0], MAX_PATH}, - {"HDD2FILE", INITYPE_STR, np2cfg.hddfile[1], MAX_PATH}, + {"HDD1FILE", INITYPE_STR, np2cfg.sasihdd[0], MAX_PATH}, + {"HDD2FILE", INITYPE_STR, np2cfg.sasihdd[1], MAX_PATH}, +#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 {"fontfile", INITYPE_STR, np2cfg.fontfile, MAX_PATH}, + {"biospath", INITYPE_STR, np2cfg.biospath, MAX_PATH}, + {"hdrvroot", INITYPE_STR, np2cfg.hdrvroot, MAX_PATH}, + {"hdrv_acc", INITYPE_UINT8, &np2cfg.hdrvacc, 0}, {"SampleHz", INITYPE_UINT16, &np2cfg.samplingrate, 0}, {"Latencys", INITYPE_UINT16, &np2cfg.delayms, 0}, @@ -360,7 +390,8 @@ static const INITBL iniitem[] = { {"Seek_Snd", INITYPE_BOOL, &np2cfg.MOTOR, 0}, {"Seek_Vol", INITYPE_UINT8, &np2cfg.MOTORVOL, 0}, - {"F12_COPY", INITYPE_UINT8, &np2oscfg.F12COPY, 0}, + {"F11_bind", INITYPE_UINT8, &np2oscfg.F11KEY, 0}, + {"F12_bind", INITYPE_UINT8, &np2oscfg.F12KEY, 0}, {"btnRAPID", INITYPE_BOOL, &np2cfg.BTN_RAPID, 0}, {"btn_MODE", INITYPE_BOOL, &np2cfg.BTN_MODE, 0}, {"MS_RAPID", INITYPE_BOOL, &np2cfg.MOUSERAPID, 0}, @@ -387,7 +418,21 @@ static const INITBL iniitem[] = { {"USE144FD", INITYPE_BOOL, &np2cfg.usefd144, 0}, {"Mouse_sw", INITYPE_BOOL, &np2oscfg.MOUSE_SW, 0}, {"comfirm_", INITYPE_BOOL, &np2oscfg.comfirm, 0}, + + {"mpu98map", INITYPE_STR, np2oscfg.mpu.mout, MAX_PATH}, + {"mpu98min", INITYPE_STR, np2oscfg.mpu.min, MAX_PATH}, + {"mpu98mdl", INITYPE_STR, np2oscfg.mpu.mdl, 64}, + {"mpu98def", INITYPE_STR, np2oscfg.mpu.def, MAX_PATH}, + {"e_resume", INITYPE_BOOL, &np2oscfg.resume, 0}, // ver0.30 + {"toolwind", INITYPE_BOOL, &np2oscfg.toolwin, 0}, // ver0.38 +#ifdef SUPPORT_KEYDISP + {"keydispl", INITYPE_BOOL, &np2oscfg.keydisp, 0}, +#endif +#ifdef SUPPORT_SOFTKBD + {"softkybd", INITYPE_BOOL, &np2oscfg.softkey, 0}, +#endif + {"jast_snd", INITYPE_BOOL, &np2oscfg.jastsnd, 0}, // ver0.73 {"I286SAVE", INITYPE_BOOL, &np2oscfg.I286SAVE, 0}}; #define INIITEMS (sizeof(iniitem) / sizeof(INITBL)) @@ -397,7 +442,7 @@ void initload(void) { char path[MAX_PATH]; - milstr_ncpy(path, file_getcd(inifile), sizeof(path)); + file_cpyname(path, file_getcd(inifile), sizeof(path)); ini_read(path, ini_title, iniitem, INIITEMS); } @@ -405,7 +450,7 @@ void initsave(void) { char path[MAX_PATH]; - milstr_ncpy(path, file_getcd(inifile), sizeof(path)); - ini_write(path, ini_title, iniitem, INIITEMS); + file_cpyname(path, file_getcd(inifile), sizeof(path)); + ini_write(path, ini_title, iniitem, INIITEMS, TRUE); }