|
|
| version 1.10, 2004/06/19 17:28:29 | version 1.15, 2005/02/11 21:17:23 |
|---|---|
| Line 183 static void iniwrsetarg8(char *work, int | Line 183 static void iniwrsetarg8(char *work, int |
| char tmp[8]; | char tmp[8]; |
| if (arg > 0) { | if (arg > 0) { |
| SPRINTF(tmp, "%.2x", ptr[0]); | OEMSPRINTF(tmp, "%.2x", ptr[0]); |
| milstr_ncpy(work, tmp, size); | milstr_ncpy(work, tmp, size); |
| } | } |
| for (i=1; i<arg; i++) { | for (i=1; i<arg; i++) { |
| SPRINTF(tmp, " %.2x", ptr[i]); | OEMSPRINTF(tmp, " %.2x", ptr[i]); |
| milstr_ncat(work, tmp, size); | milstr_ncat(work, tmp, size); |
| } | } |
| } | } |
| static const UINT8 utf8hdr[3] = {0xef, 0xbb, 0xbf}; | |
| void ini_write(const char *path, const char *title, | void ini_write(const char *path, const char *title, |
| const INITBL *tbl, UINT count) { | const INITBL *tbl, UINT count) { |
| Line 205 const INITBL *pterm; | Line 208 const INITBL *pterm; |
| if (fh == FILEH_INVALID) { | if (fh == FILEH_INVALID) { |
| return; | return; |
| } | } |
| #if defined(OSLANG_UTF8) | |
| file_write(fh, utf8hdr, sizeof(utf8hdr)); | |
| #endif | |
| milstr_ncpy(work, "[", sizeof(work)); | milstr_ncpy(work, "[", sizeof(work)); |
| milstr_ncat(work, title, sizeof(work)); | milstr_ncat(work, title, sizeof(work)); |
| milstr_ncat(work, "]\r\n", sizeof(work)); | milstr_ncat(work, "]\r\n", sizeof(work)); |
| Line 283 const INITBL *pterm; | Line 289 const INITBL *pterm; |
| // ---- | // ---- |
| #if defined(CHARSET_OEM) | #if defined(OSLANG_UTF8) |
| static const char ini_title[] = "NekoProjectII"; | |
| #else | |
| static const char ini_title[] = "NekoProjectIICE"; | static const char ini_title[] = "NekoProjectIICE"; |
| #endif | static const char inifile[] = "np2ce.cfg"; |
| #else | |
| static const char ini_title[] = "NekoProjectII"; | |
| static const char inifile[] = "np2.cfg"; | static const char inifile[] = "np2.cfg"; |
| #endif | |
| static const INITBL iniitem[] = { | static const INITBL iniitem[] = { |
| {"pc_model", INITYPE_STR, &np2cfg.model, | {"pc_model", INITYPE_STR, &np2cfg.model, |
| Line 377 static const INITBL iniitem[] = { | Line 384 static const INITBL iniitem[] = { |
| }; | }; |
| #define INIITEMS (sizeof(iniitem) / sizeof(INITBL)) | |
| void initload(void) { | void initload(void) { |
| char path[MAX_PATH]; | OEMCHAR path[MAX_PATH]; |
| milstr_ncpy(path, file_getcd(inifile), sizeof(path)); | milstr_ncpy(path, file_getcd(inifile), NELEMENTS(path)); |
| ini_read(path, ini_title, iniitem, INIITEMS); | ini_read(path, ini_title, iniitem, NELEMENTS(iniitem)); |
| } | } |
| void initsave(void) { | void initsave(void) { |
| char path[MAX_PATH]; | OEMCHAR path[MAX_PATH]; |
| milstr_ncpy(path, file_getcd(inifile), sizeof(path)); | milstr_ncpy(path, file_getcd(inifile), NELEMENTS(path)); |
| ini_write(path, ini_title, iniitem, INIITEMS); | ini_write(path, ini_title, iniitem, NELEMENTS(iniitem)); |
| } | } |