| version 1.1, 2003/11/16 16:43:45 | version 1.7, 2004/01/13 16:28:18 | 
| Line 315  iwss_extend: | Line 315  iwss_extend: | 
 | static BOOL read_iniread_flag(const INITBL *p); | static BOOL read_iniread_flag(const INITBL *p); | 
 |  |  | 
 | void | void | 
| ini_write(const char *path, const char *title, const INITBL *tbl, UINT count) | ini_write(const char *path, const char *title, const INITBL *tbl, UINT count, BOOL create) | 
 | { | { | 
 | char            work[512]; | char            work[512]; | 
 | const INITBL    *p; | const INITBL    *p; | 
| Line 323  ini_write(const char *path, const char * | Line 323  ini_write(const char *path, const char * | 
 | FILEH           fh; | FILEH           fh; | 
 | BOOL            set; | BOOL            set; | 
 |  |  | 
| fh = file_create(path); | fh = FILEH_INVALID; | 
| if (fh == FILEH_INVALID) | if (!create) { | 
| return; | fh = file_open(path); | 
|  | if (fh != FILEH_INVALID) | 
|  | file_seek(fh, 0L, FSEEK_END); | 
|  | } | 
|  | if (fh == FILEH_INVALID) { | 
|  | fh = file_create(path); | 
|  | if (fh == FILEH_INVALID) | 
|  | return; | 
|  | } | 
 |  |  | 
 | milstr_ncpy(work, "[", sizeof(work)); | milstr_ncpy(work, "[", sizeof(work)); | 
 | milstr_ncat(work, title, sizeof(work)); | milstr_ncat(work, title, sizeof(work)); | 
| Line 439  static const INITBL iniitem[] = { | Line 447  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}, | 
 |  |  | 
 | {"pc_model", INITYPE_STR,       &np2cfg.model,          sizeof(np2cfg.model)}, | {"pc_model", INITYPE_STR,       &np2cfg.model,          sizeof(np2cfg.model)}, | 
 |  |  | 
| Line 507  static const INITBL iniitem[] = { | Line 516  static const INITBL iniitem[] = { | 
 | {"USE144FD", INITYPE_BOOL,      &np2cfg.usefd144,       0}, | {"USE144FD", INITYPE_BOOL,      &np2cfg.usefd144,       0}, | 
 |  |  | 
 | {"keyboard", INIRO_KB,          &np2oscfg.KEYBOARD,     0}, | {"keyboard", INIRO_KB,          &np2oscfg.KEYBOARD,     0}, | 
| {"F12_COPY", INITYPE_UINT8,     &np2oscfg.F12COPY,      0}, | {"F12_COPY", INITYPE_UINT8,     &np2oscfg.F12KEY,       0}, | 
 | {"Joystick", INITYPE_BOOL,      &np2oscfg.JOYPAD1,      0}, | {"Joystick", INITYPE_BOOL,      &np2oscfg.JOYPAD1,      0}, | 
 | {"Joy1_btn", INITYPE_ARGH8,     np2oscfg.JOY1BTN,       4}, | {"Joy1_btn", INITYPE_ARGH8,     np2oscfg.JOY1BTN,       4}, | 
 |  |  | 
| {"comfirm_", INITYPE_BOOL,      &np2oscfg.comfirm,      0}, | {"confirm_", INITYPE_BOOL,      &np2oscfg.confirm,      0}, | 
 |  |  | 
 | {"mpu98map", INITYPE_STR,       np2oscfg.mpu.mout,      MAX_PATH}, | {"mpu98map", INITYPE_STR,       np2oscfg.mpu.mout,      MAX_PATH}, | 
 | {"mpu98min", INITYPE_STR,       np2oscfg.mpu.min,       MAX_PATH}, | {"mpu98min", INITYPE_STR,       np2oscfg.mpu.min,       MAX_PATH}, | 
| Line 525  static const INITBL iniitem[] = { | Line 534  static const INITBL iniitem[] = { | 
 | #endif | #endif | 
 | {"toolwind", INITYPE_BOOL,      &np2oscfg.toolwin,      0}, | {"toolwind", INITYPE_BOOL,      &np2oscfg.toolwin,      0}, | 
 | {"keydispl", INITYPE_BOOL,      &np2oscfg.keydisp,      0}, | {"keydispl", INITYPE_BOOL,      &np2oscfg.keydisp,      0}, | 
 |  | {"jast_snd", INITYPE_BOOL,      &np2oscfg.jastsnd,      0}, | 
 |  |  | 
 | {"sounddrv", INITYPE_SNDDRV,    &np2oscfg.snddrv,       0}, | {"sounddrv", INITYPE_SNDDRV,    &np2oscfg.snddrv,       0}, | 
 | {"audiodev", INITYPE_STR,       &np2oscfg.audiodev,     MAX_PATH}, | {"audiodev", INITYPE_STR,       &np2oscfg.audiodev,     MAX_PATH}, | 
| Line 532  static const INITBL iniitem[] = { | Line 542  static const INITBL iniitem[] = { | 
 | {"MIDIIN_d", INITYPE_STR,       &np2oscfg.MIDIDEV[1],   MAX_PATH}, | {"MIDIIN_d", INITYPE_STR,       &np2oscfg.MIDIDEV[1],   MAX_PATH}, | 
 | {"MIDIWAIT", INITYPE_UINT32,    &np2oscfg.MIDIWAIT,     0}, | {"MIDIWAIT", INITYPE_UINT32,    &np2oscfg.MIDIWAIT,     0}, | 
 |  |  | 
 |  | {"sharepix", INIRO_BOOL,        &np2oscfg.shared_pixmap,0}, | 
 |  |  | 
 | {"toolkit_", INIRO_STR,         &np2oscfg.toolkit,      sizeof(np2oscfg.toolkit)}, | {"toolkit_", INIRO_STR,         &np2oscfg.toolkit,      sizeof(np2oscfg.toolkit)}, | 
 |  |  | 
 | {"I286SAVE", INIRO_BOOL,        &np2oscfg.I286SAVE,     0} | {"I286SAVE", INIRO_BOOL,        &np2oscfg.I286SAVE,     0} | 
| Line 597  initsave(void) | Line 609  initsave(void) | 
 | char path[MAX_PATH]; | char path[MAX_PATH]; | 
 |  |  | 
 | milstr_ncpy(path, modulefile, sizeof(path)); | milstr_ncpy(path, modulefile, sizeof(path)); | 
| ini_write(path, ini_title, iniitem, INIITEMS); | ini_write(path, ini_title, iniitem, INIITEMS, TRUE); | 
 | } | } |