--- np2/win9x/ini.cpp 2005/03/20 08:58:19 1.38 +++ 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_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_BITMAP: + set = (bitmapget((UINT8 *)p->value, p->arg))? + str_true:str_false; + break; + case PFTYPE_BIN: - iniwrsetargh8(work, NELEMENTS(work), p); + binget(work, NELEMENTS(work), (UINT8 *)p->value, p->arg); break; case PFTYPE_SINT8: