|
|
| version 1.39, 2005/03/21 02:24:23 | version 1.44, 2007/10/28 16:01:35 |
|---|---|
| Line 14 | Line 14 |
| #include "pccore.h" | #include "pccore.h" |
| // ---- user | |
| static void inirdargs16(const OEMCHAR *src, const PFTBL *ini) { | |
| SINT16 *dst; | |
| int dsize; | |
| int i; | |
| OEMCHAR 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 inirdbyte3(const OEMCHAR *src, const PFTBL *ini) { | |
| UINT i; | |
| for (i=0; i<3; i++) { | |
| if (src[i] == '\0') { | |
| break; | |
| } | |
| if ((((src[i] - '0') & 0xff) < 9) || | |
| (((src[i] - 'A') & 0xdf) < 26)) { | |
| ((UINT8 *)ini->value)[i] = (UINT8)src[i]; | |
| } | |
| } | |
| } | |
| static void inirdkb(const OEMCHAR *src, const PFTBL *ini) { | |
| if ((!milstr_extendcmp(src, OEMTEXT("PC98"))) || | |
| (!milstr_cmp(src, OEMTEXT("98")))) { | |
| *(UINT8 *)ini->value = KEY_PC98; | |
| } | |
| else if ((!milstr_extendcmp(src, OEMTEXT("DOS"))) || | |
| (!milstr_cmp(src, OEMTEXT("PCAT"))) || | |
| (!milstr_cmp(src, OEMTEXT("AT")))) { | |
| *(UINT8 *)ini->value = KEY_KEY106; | |
| } | |
| else if ((!milstr_extendcmp(src, OEMTEXT("KEY101"))) || | |
| (!milstr_cmp(src, OEMTEXT("101")))) { | |
| *(UINT8 *)ini->value = KEY_KEY101; | |
| } | |
| } | |
| // ---- Use WinAPI | |
| #if !defined(_UNICODE) | |
| static void bitmapset(UINT8 *ptr, UINT pos, BOOL set) { | static void bitmapset(UINT8 *ptr, UINT pos, BOOL set) { |
| UINT8 bit; | UINT8 bit; |
| Line 88 static void binget(OEMCHAR *work, int si | Line 155 static void binget(OEMCHAR *work, int si |
| } | } |
| } | } |
| // ---- user | |
| static void inirdargs16(const OEMCHAR *src, const PFTBL *ini) { | |
| SINT16 *dst; | |
| int dsize; | |
| int i; | |
| OEMCHAR 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 inirdbyte3(const OEMCHAR *src, const PFTBL *ini) { | |
| UINT i; | |
| for (i=0; i<3; i++) { | |
| if (src[i] == '\0') { | |
| break; | |
| } | |
| if ((((src[i] - '0') & 0xff) < 9) || | |
| (((src[i] - 'A') & 0xdf) < 26)) { | |
| ((UINT8 *)ini->value)[i] = (UINT8)src[i]; | |
| } | |
| } | |
| } | |
| static void inirdkb(const OEMCHAR *src, const PFTBL *ini) { | |
| if ((!milstr_extendcmp(src, OEMTEXT("PC98"))) || | |
| (!milstr_cmp(src, OEMTEXT("98")))) { | |
| *(UINT8 *)ini->value = KEY_PC98; | |
| } | |
| else if ((!milstr_extendcmp(src, OEMTEXT("DOS"))) || | |
| (!milstr_cmp(src, OEMTEXT("PCAT"))) || | |
| (!milstr_cmp(src, OEMTEXT("AT")))) { | |
| *(UINT8 *)ini->value = KEY_KEY106; | |
| } | |
| else if ((!milstr_extendcmp(src, OEMTEXT("KEY101"))) || | |
| (!milstr_cmp(src, OEMTEXT("101")))) { | |
| *(UINT8 *)ini->value = KEY_KEY101; | |
| } | |
| } | |
| // ---- | |
| void ini_read(const OEMCHAR *path, const OEMCHAR *title, | void ini_read(const OEMCHAR *path, const OEMCHAR *title, |
| const PFTBL *tbl, UINT count) { | const PFTBL *tbl, UINT count) { |
| Line 338 const OEMCHAR *set; | Line 340 const OEMCHAR *set; |
| } | } |
| } | } |
| #else // !defined(_UNICODE) | |
| // ---- Use profile.c | |
| static void pfread(const PFTBL *item, const OEMCHAR *string) { | |
| switch(item->itemtype & PFTYPE_MASK) { | |
| case PFTYPE_ARGS16: | |
| inirdargs16(string, item); | |
| break; | |
| case PFTYPE_BYTE3: | |
| inirdbyte3(string, item); | |
| break; | |
| case PFTYPE_KB: | |
| inirdkb(string, item); | |
| break; | |
| } | |
| } | |
| void ini_read(const OEMCHAR *path, const OEMCHAR *title, | |
| const PFTBL *tbl, UINT count) { | |
| profile_iniread(path, title, tbl, count, pfread); | |
| } | |
| void ini_write(const OEMCHAR *path, const OEMCHAR *title, | |
| const PFTBL *tbl, UINT count) { | |
| profile_iniwrite(path, title, tbl, count, NULL); | |
| } | |
| #endif // !defined(_UNICODE) | |
| // ---- | // ---- |
| Line 353 enum { | Line 390 enum { |
| PFRO_BITMAP = PFFLAG_RO + PFTYPE_BITMAP, | PFRO_BITMAP = PFFLAG_RO + PFTYPE_BITMAP, |
| PFRO_UINT8 = PFFLAG_RO + PFTYPE_UINT8, | PFRO_UINT8 = PFFLAG_RO + PFTYPE_UINT8, |
| PFRO_SINT32 = PFFLAG_RO + PFTYPE_SINT32, | PFRO_SINT32 = PFFLAG_RO + PFTYPE_SINT32, |
| PFRO_HEX8 = PFFLAG_RO + PFTYPE_HEX8, | |
| PFRO_HEX32 = PFFLAG_RO + PFTYPE_HEX32, | PFRO_HEX32 = PFFLAG_RO + PFTYPE_HEX32, |
| PFRO_BYTE3 = PFFLAG_RO + PFTYPE_BYTE3, | PFRO_BYTE3 = PFFLAG_RO + PFTYPE_BYTE3, |
| PFRO_KB = PFFLAG_RO + PFTYPE_KB | PFRO_KB = PFFLAG_RO + PFTYPE_KB |
| Line 378 static const PFTBL iniitem[] = { | Line 416 static const PFTBL iniitem[] = { |
| PFVAL("hdrv_acc", PFRO_UINT8, &np2cfg.hdrvacc), | PFVAL("hdrv_acc", PFRO_UINT8, &np2cfg.hdrvacc), |
| #endif | #endif |
| PFSTR("pc_model", PFTYPE_STR, &np2cfg.model), | PFSTR("pc_model", PFTYPE_STR, np2cfg.model), |
| PFVAL("clk_base", PFTYPE_UINT32, &np2cfg.baseclock), | PFVAL("clk_base", PFTYPE_UINT32, &np2cfg.baseclock), |
| PFVAL("clk_mult", PFTYPE_UINT32, &np2cfg.multiple), | PFVAL("clk_mult", PFTYPE_UINT32, &np2cfg.multiple), |
| Line 499 static const PFTBL iniitem[] = { | Line 537 static const PFTBL iniitem[] = { |
| PFVAL("force400", PFRO_BOOL, &np2oscfg.force400), | PFVAL("force400", PFRO_BOOL, &np2oscfg.force400), |
| PFVAL("e_resume", PFTYPE_BOOL, &np2oscfg.resume), | PFVAL("e_resume", PFTYPE_BOOL, &np2oscfg.resume), |
| PFVAL("STATSAVE", PFRO_BOOL, &np2oscfg.statsave), | PFVAL("STATSAVE", PFRO_BOOL, &np2oscfg.statsave), |
| #if !defined(_WIN64) | |
| PFVAL("nousemmx", PFTYPE_BOOL, &np2oscfg.disablemmx), | PFVAL("nousemmx", PFTYPE_BOOL, &np2oscfg.disablemmx), |
| #endif | |
| PFVAL("windtype", PFTYPE_UINT8, &np2oscfg.wintype), | PFVAL("windtype", PFTYPE_UINT8, &np2oscfg.wintype), |
| PFVAL("toolwind", PFTYPE_BOOL, &np2oscfg.toolwin), | PFVAL("toolwind", PFTYPE_BOOL, &np2oscfg.toolwin), |
| PFVAL("keydispl", PFTYPE_BOOL, &np2oscfg.keydisp), | PFVAL("keydispl", PFTYPE_BOOL, &np2oscfg.keydisp), |
| Line 507 static const PFTBL iniitem[] = { | Line 547 static const PFTBL iniitem[] = { |
| PFVAL("useromeo", PFTYPE_BOOL, &np2oscfg.useromeo), | PFVAL("useromeo", PFTYPE_BOOL, &np2oscfg.useromeo), |
| PFVAL("thickfrm", PFTYPE_BOOL, &np2oscfg.thickframe), | PFVAL("thickfrm", PFTYPE_BOOL, &np2oscfg.thickframe), |
| PFVAL("xrollkey", PFRO_BOOL, &np2oscfg.xrollkey), | PFVAL("xrollkey", PFRO_BOOL, &np2oscfg.xrollkey), |
| PFVAL("fscrn_cx", PFRO_SINT32, &np2oscfg.fscrn_cx), | |
| PFVAL("fscrn_cy", PFRO_SINT32, &np2oscfg.fscrn_cy), | |
| PFVAL("fscrnbpp", PFRO_UINT8, &np2oscfg.fscrnbpp), | PFVAL("fscrnbpp", PFRO_UINT8, &np2oscfg.fscrnbpp), |
| PFVAL("fscrnmod", PFTYPE_HEX8, &np2oscfg.fscrnmod), | |
| PFVAL("I286SAVE", PFRO_BOOL, &np2oscfg.I286SAVE)}; | PFVAL("I286SAVE", PFRO_BOOL, &np2oscfg.I286SAVE)}; |
| static const OEMCHAR ext_ini[] = OEMTEXT(".ini"); | |
| void initgetfile(OEMCHAR *path, UINT size) { | void initgetfile(OEMCHAR *path, UINT size) { |
| const OEMCHAR *ext; | const OEMCHAR *ext; |
| Line 526 const OEMCHAR *ext; | Line 571 const OEMCHAR *ext; |
| } | } |
| ext = file_getext(path); | ext = file_getext(path); |
| if (ext[0] != '\0') { | if (ext[0] != '\0') { |
| file_catname(path, OEMTEXT(".ini"), size); | file_catname(path, ext_ini, size); |
| } | } |
| } | } |
| else { | else { |
| file_cutext(path); | file_cutext(path); |
| file_catname(path, OEMTEXT(".ini"), size); | file_catname(path, ext_ini, size); |
| } | } |
| } | } |