--- np2/win9x/ini.cpp 2005/03/20 06:09:16 1.37 +++ np2/win9x/ini.cpp 2005/03/21 02:24:23 1.39 @@ -14,13 +14,7 @@ #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) { +static void bitmapset(UINT8 *ptr, UINT pos, BOOL set) { UINT8 bit; @@ -34,46 +28,19 @@ static void inisetbmp(UINT8 *ptr, UINT p } } -static void inirdargs16(const OEMCHAR *src, const PFTBL *ini) { - - SINT16 *dst; - int dsize; - int i; - OEMCHAR c; - - dst = (SINT16 *)ini->value; - dsize = ini->arg; +static BOOL bitmapget(const UINT8 *ptr, UINT pos) { - for (i=0; i> 3] >> (pos & 7)) & 1); } -static void inirdargh8(const OEMCHAR *src, const PFTBL *ini) { +static void binset(UINT8 *bin, UINT binlen, const OEMCHAR *src) { - UINT8 *dst; - int dsize; - int i; + UINT i; UINT8 val; BOOL set; OEMCHAR c; - dst = (UINT8 *)ini->value; - dsize = ini->arg; - - for (i=0; ivalue; - arg = ini->arg; - if (arg > 0) { - OEMSPRINTF(tmp, OEMTEXT("%.2x"), ptr[0]); + if (binlen) { + OEMSPRINTF(tmp, OEMTEXT("%.2x"), bin[0]); milstr_ncpy(work, tmp, size); } - for (i=1; ivalue; + dsize = ini->arg; + + for (i=0; iitem, - (inigetbmp((UINT8 *)p->value, p->arg))?str_true:str_false, + (bitmapget((UINT8 *)p->value, p->arg))?str_true:str_false, work, NELEMENTS(work), path); - inisetbmp((UINT8 *)p->value, p->arg, + bitmapset((UINT8 *)p->value, p->arg, (milstr_cmp(work, str_true) == 0)); break; - case PFTYPE_ARGS16: - GetPrivateProfileString(title, p->item, str_null, - work, NELEMENTS(work), path); - inirdargs16(work, p); - break; - - case PFTYPE_ARGH8: + case PFTYPE_BIN: GetPrivateProfileString(title, p->item, str_null, work, NELEMENTS(work), path); - inirdargh8(work, p); + binset((UINT8 *)p->value, p->arg, work); break; case PFTYPE_SINT8: @@ -252,6 +236,12 @@ const PFTBL *pterm; *(UINT32 *)p->value = (UINT32)val; break; + case PFTYPE_ARGS16: + GetPrivateProfileString(title, p->item, str_null, + work, NELEMENTS(work), path); + inirdargs16(work, p); + break; + case PFTYPE_BYTE3: GetPrivateProfileString(title, p->item, str_null, work, NELEMENTS(work), path); @@ -291,8 +281,13 @@ const OEMCHAR *set; set = (*((UINT8 *)p->value))?str_true:str_false; break; - case PFTYPE_ARGH8: - iniwrsetargh8(work, NELEMENTS(work), p); + case PFTYPE_BITMAP: + set = (bitmapget((UINT8 *)p->value, p->arg))? + str_true:str_false; + break; + + case PFTYPE_BIN: + binget(work, NELEMENTS(work), (UINT8 *)p->value, p->arg); break; case PFTYPE_SINT8: @@ -377,15 +372,18 @@ static const PFTBL iniitem[] = { PFSTR("bmap_Dir", PFTYPE_STR, bmpfilefolder), PFSTR("fontfile", PFTYPE_STR, np2cfg.fontfile), PFSTR("biospath", PFRO_STR, np2cfg.biospath), + +#if defined(SUPPORT_HOSTDRV) PFSTR("hdrvroot", PFRO_STR, np2cfg.hdrvroot), PFVAL("hdrv_acc", PFRO_UINT8, &np2cfg.hdrvacc), +#endif PFSTR("pc_model", PFTYPE_STR, &np2cfg.model), PFVAL("clk_base", PFTYPE_UINT32, &np2cfg.baseclock), PFVAL("clk_mult", PFTYPE_UINT32, &np2cfg.multiple), - PFEXT("DIPswtch", PFTYPE_ARGH8, np2cfg.dipsw, 3), - PFEXT("MEMswtch", PFTYPE_ARGH8, np2cfg.memsw, 8), + PFEXT("DIPswtch", PFTYPE_BIN, np2cfg.dipsw, 3), + PFEXT("MEMswtch", PFTYPE_BIN, np2cfg.memsw, 8), PFMAX("ExMemory", PFTYPE_UINT8, &np2cfg.EXTMEM, 63), PFVAL("ITF_WORK", PFRO_BOOL, &np2cfg.ITF_WORK), @@ -404,8 +402,8 @@ static const PFTBL iniitem[] = { PFAND("BEEP_vol", PFTYPE_UINT8, &np2cfg.BEEP_VOL, 3), PFVAL("xspeaker", PFRO_BOOL, &np2cfg.snd_x), - PFEXT("SND14vol", PFTYPE_ARGH8, np2cfg.vol14, 6), -// PFEXT("opt14BRD", PFTYPE_ARGH8, np2cfg.snd14opt, 3), + PFEXT("SND14vol", PFTYPE_BIN, np2cfg.vol14, 6), +// PFEXT("opt14BRD", PFTYPE_BIN, np2cfg.snd14opt, 3), PFVAL("opt26BRD", PFTYPE_HEX8, &np2cfg.snd26opt), PFVAL("opt86BRD", PFTYPE_HEX8, &np2cfg.snd86opt), PFVAL("optSPBRD", PFTYPE_HEX8, &np2cfg.spbopt), @@ -429,7 +427,7 @@ static const PFTBL iniitem[] = { PFVAL("MS_RAPID", PFTYPE_BOOL, &np2cfg.MOUSERAPID), PFAND("backgrnd", PFTYPE_UINT8, &np2oscfg.background, 3), - PFEXT("VRAMwait", PFTYPE_ARGH8, np2cfg.wait, 6), + PFEXT("VRAMwait", PFTYPE_BIN, np2cfg.wait, 6), PFAND("DspClock", PFTYPE_UINT8, &np2oscfg.DISPCLK, 3), PFVAL("DispSync", PFTYPE_BOOL, &np2cfg.DISPSYNC), PFVAL("Real_Pal", PFTYPE_BOOL, &np2cfg.RASTER), @@ -446,8 +444,8 @@ static const PFTBL iniitem[] = { PFAND("FG_COLOR", PFRO_HEX32, &np2cfg.FG_COLOR, 0xffffff), PFVAL("pc9861_e", PFTYPE_BOOL, &np2cfg.pc9861enable), - PFEXT("pc9861_s", PFTYPE_ARGH8, np2cfg.pc9861sw, 3), - PFEXT("pc9861_j", PFTYPE_ARGH8, np2cfg.pc9861jmp, 6), + PFEXT("pc9861_s", PFTYPE_BIN, np2cfg.pc9861sw, 3), + PFEXT("pc9861_j", PFTYPE_BIN, np2cfg.pc9861jmp, 6), PFVAL("calendar", PFTYPE_BOOL, &np2cfg.calendar), PFVAL("USE144FD", PFTYPE_BOOL, &np2cfg.usefd144), @@ -460,7 +458,7 @@ static const PFTBL iniitem[] = { PFVAL("keyboard", PFRO_KB, &np2oscfg.KEYBOARD), PFVAL("F12_COPY", PFTYPE_UINT8, &np2oscfg.F12COPY), PFVAL("Joystick", PFTYPE_BOOL, &np2oscfg.JOYPAD1), - PFEXT("Joy1_btn", PFTYPE_ARGH8, np2oscfg.JOY1BTN, 4), + PFEXT("Joy1_btn", PFTYPE_BIN, np2oscfg.JOY1BTN, 4), PFVAL("clocknow", PFTYPE_UINT8, &np2oscfg.clk_x), PFVAL("clockfnt", PFTYPE_UINT8, &np2oscfg.clk_fnt),