--- np2/win9x/ini.cpp 2004/02/21 04:48:35 1.25 +++ np2/win9x/ini.cpp 2005/02/07 14:46:14 1.31 @@ -11,6 +11,26 @@ #include "pccore.h" + +static BOOL inigetbmp(const UINT8 *ptr, UINT pos) { + + return((ptr[pos >> 3] >> (pos & 7)) & 1); +} + +static void inisetbmp(UINT8 *ptr, UINT pos, BOOL set) { + + UINT8 bit; + + ptr += (pos >> 3); + bit = 1 << (pos & 7); + if (set) { + *ptr |= bit; + } + else { + *ptr &= ~bit; + } +} + static void inirdargs16(const char *src, const INITBL *ini) { SINT16 *dst; @@ -40,14 +60,14 @@ static void inirdargs16(const char *src, static void inirdargh8(const char *src, const INITBL *ini) { - BYTE *dst; + UINT8 *dst; int dsize; int i; - BYTE val; + UINT8 val; BOOL set; char c; - dst = (BYTE *)ini->value; + dst = (UINT8 *)ini->value; dsize = ini->arg; for (i=0; ivalue; + ptr = (UINT8 *)ini->value; arg = ini->arg; if (arg > 0) { SPRINTF(tmp, "%.2x", ptr[0]); @@ -115,7 +135,7 @@ static void inirdbyte3(const char *src, } if ((((src[i] - '0') & 0xff) < 9) || (((src[i] - 'A') & 0xdf) < 26)) { - ((BYTE *)ini->value)[i] = src[i]; + ((UINT8 *)ini->value)[i] = src[i]; } } } @@ -124,16 +144,16 @@ static void inirdkb(const char *src, con if ((!milstr_extendcmp(src, "PC98")) || (!milstr_cmp(src, "98"))) { - *(BYTE *)ini->value = KEY_PC98; + *(UINT8 *)ini->value = KEY_PC98; } else if ((!milstr_extendcmp(src, "DOS")) || (!milstr_cmp(src, "PCAT")) || (!milstr_cmp(src, "AT"))) { - *(BYTE *)ini->value = KEY_KEY106; + *(UINT8 *)ini->value = KEY_KEY106; } else if ((!milstr_extendcmp(src, "KEY101")) || (!milstr_cmp(src, "101"))) { - *(BYTE *)ini->value = KEY_KEY101; + *(UINT8 *)ini->value = KEY_KEY101; } } @@ -159,9 +179,17 @@ const INITBL *pterm; case INITYPE_BOOL: GetPrivateProfileString(title, p->item, - (*((BYTE *)p->value))?str_true:str_false, + (*((UINT8 *)p->value))?str_true:str_false, + work, sizeof(work), path); + *((UINT8 *)p->value) = (!milstr_cmp(work, str_true))?1:0; + break; + + case INITYPE_BITMAP: + GetPrivateProfileString(title, p->item, + (inigetbmp((UINT8 *)p->value, p->arg))?str_true:str_false, work, sizeof(work), path); - *((BYTE *)p->value) = (!milstr_cmp(work, str_true))?1:0; + inisetbmp((UINT8 *)p->value, p->arg, + (milstr_cmp(work, str_true) == 0)); break; case INITYPE_ARGS16: @@ -178,8 +206,8 @@ const INITBL *pterm; case INITYPE_SINT8: case INITYPE_UINT8: - val = (BYTE)GetPrivateProfileInt(title, p->item, - *(BYTE *)p->value, path); + val = (UINT8)GetPrivateProfileInt(title, p->item, + *(UINT8 *)p->value, path); *(UINT8 *)p->value = (UINT8)val; break; @@ -198,10 +226,10 @@ const INITBL *pterm; break; case INITYPE_HEX8: - SPRINTF(work, str_x, *(BYTE *)p->value), + SPRINTF(work, str_x, *(UINT8 *)p->value), GetPrivateProfileString(title, p->item, work, work, sizeof(work), path); - val = (BYTE)milstr_solveHEX(work); + val = (UINT8)milstr_solveHEX(work); *(UINT8 *)p->value = (UINT8)val; break; @@ -218,7 +246,7 @@ const INITBL *pterm; GetPrivateProfileString(title, p->item, work, work, sizeof(work), path); val = (UINT32)milstr_solveHEX(work); - *(UINT16 *)p->value = (UINT32)val; + *(UINT32 *)p->value = (UINT32)val; break; case INITYPE_BYTE3: @@ -257,7 +285,7 @@ const char *set; break; case INITYPE_BOOL: - set = (*((BYTE *)p->value))?str_true:str_false; + set = (*((UINT8 *)p->value))?str_true:str_false; break; case INITYPE_ARGH8: @@ -315,11 +343,16 @@ const char *set; // ---- +#if !defined(SUPPORT_PC9821) static const char ini_title[] = "NekoProjectII"; +#else +static const char ini_title[] = "NekoProject21"; +#endif enum { INIRO_STR = INITYPE_STR + INIFLAG_RO, INIRO_BOOL = INITYPE_BOOL + INIFLAG_RO, + INIRO_BITMAP = INITYPE_BITMAP + INIFLAG_RO, INIRO_UINT8 = INITYPE_UINT8 + INIFLAG_RO, INIMAX_UINT8 = INITYPE_UINT8 + INIFLAG_MAX, INIAND_UINT8 = INITYPE_UINT8 + INIFLAG_AND, @@ -381,7 +414,7 @@ static const INITBL iniitem[] = { {"optSPBVR", INITYPE_HEX8, &np2cfg.spb_vrc, 0}, {"optSPBVL", INIMAX_UINT8, &np2cfg.spb_vrl, 24}, {"optSPB_X", INITYPE_BOOL, &np2cfg.spb_x, 0}, - {"optMPU98", INITYPE_HEX8 &np2cfg.mpuopt, 0}, + {"optMPU98", INITYPE_HEX8, &np2cfg.mpuopt, 0}, {"volume_F", INIMAX_UINT8, &np2cfg.vol_fm, 128}, {"volume_S", INIMAX_UINT8, &np2cfg.vol_ssg, 128}, @@ -420,6 +453,10 @@ static const INITBL iniitem[] = { {"calendar", INITYPE_BOOL, &np2cfg.calendar, 0}, {"USE144FD", INITYPE_BOOL, &np2cfg.usefd144, 0}, + {"FDDRIVE1", INIRO_BITMAP, &np2cfg.fddequip, 0}, + {"FDDRIVE2", INIRO_BITMAP, &np2cfg.fddequip, 1}, + {"FDDRIVE3", INIRO_BITMAP, &np2cfg.fddequip, 2}, + {"FDDRIVE4", INIRO_BITMAP, &np2cfg.fddequip, 3}, // OS°Í¸¡© @@ -473,6 +510,8 @@ static const INITBL iniitem[] = { {"keydispl", INITYPE_BOOL, &np2oscfg.keydisp, 0}, {"jast_snd", INITYPE_BOOL, &np2oscfg.jastsnd, 0}, // ver0.73 {"useromeo", INITYPE_BOOL, &np2oscfg.useromeo, 0}, // ver0.74 + {"thickfrm", INITYPE_BOOL, &np2oscfg.thickframe, 0}, // ver0.77 + {"xrollkey", INIRO_BOOL, &np2oscfg.xrollkey, 0}, // ver0.78 {"I286SAVE", INIRO_BOOL, &np2oscfg.I286SAVE, 0}}; @@ -505,7 +544,7 @@ void initload(void) { char path[MAX_PATH]; initgetfile(path, sizeof(path)); - ini_read(path, ini_title, iniitem, sizeof(iniitem)/sizeof(INITBL)); + ini_read(path, ini_title, iniitem, NELEMENTS(iniitem)); } void initsave(void) { @@ -513,6 +552,6 @@ void initsave(void) { char path[MAX_PATH]; initgetfile(path, sizeof(path)); - ini_write(path, ini_title, iniitem, sizeof(iniitem)/sizeof(INITBL)); + ini_write(path, ini_title, iniitem, NELEMENTS(iniitem)); }