--- xmil/win9x/ini.cpp 2004/08/01 05:31:31 1.1 +++ xmil/win9x/ini.cpp 2004/08/07 12:10:27 1.5 @@ -3,6 +3,7 @@ #include #include "strres.h" #include "xmil.h" +#include "oemtext.h" #include "dosio.h" #include "ini.h" #include "pccore.h" @@ -13,20 +14,30 @@ void ini_read(const OEMCHAR *path, const const INITBL *p; const INITBL *pterm; +#if defined(OSLANG_UCS2) + OEMCHAR item[10]; +#else +const OEMCHAR *item; +#endif OEMCHAR work[512]; UINT32 val; p = tbl; pterm = tbl + count; while(p < pterm) { +#if defined(OSLANG_UCS2) + oemtext_sjis2oem(item, NELEMENTS(item), p->item, (UINT)-1); +#else + item = p->item; +#endif switch(p->itemtype & INITYPE_MASK) { case INITYPE_STR: - GetPrivateProfileString(title, p->item, (OEMCHAR *)p->value, + GetPrivateProfileString(title, item, (OEMCHAR *)p->value, (OEMCHAR *)p->value, p->arg, path); break; case INITYPE_BOOL: - GetPrivateProfileString(title, p->item, + GetPrivateProfileString(title, item, (*((UINT8 *)p->value))?str_true:str_false, work, NELEMENTS(work), path); *((UINT8 *)p->value) = (!milstr_cmp(work, str_true))?1:0; @@ -34,28 +45,28 @@ const INITBL *pterm; case INITYPE_SINT8: case INITYPE_UINT8: - val = (UINT8)GetPrivateProfileInt(title, p->item, + val = (UINT8)GetPrivateProfileInt(title, item, *(UINT8 *)p->value, path); *(UINT8 *)p->value = (UINT8)val; break; case INITYPE_SINT16: case INITYPE_UINT16: - val = (UINT16)GetPrivateProfileInt(title, p->item, + val = (UINT16)GetPrivateProfileInt(title, item, *(UINT16 *)p->value, path); *(UINT16 *)p->value = (UINT16)val; break; case INITYPE_SINT32: case INITYPE_UINT32: - val = (UINT32)GetPrivateProfileInt(title, p->item, + val = (UINT32)GetPrivateProfileInt(title, item, *(UINT32 *)p->value, path); *(UINT32 *)p->value = (UINT32)val; break; case INITYPE_HEX8: SPRINTF(work, str_x, *(UINT8 *)p->value), - GetPrivateProfileString(title, p->item, work, + GetPrivateProfileString(title, item, work, work, NELEMENTS(work), path); val = (UINT8)milstr_solveHEX(work); *(UINT8 *)p->value = (UINT8)val; @@ -63,7 +74,7 @@ const INITBL *pterm; case INITYPE_HEX16: SPRINTF(work, str_x, *(UINT16 *)p->value), - GetPrivateProfileString(title, p->item, work, + GetPrivateProfileString(title, item, work, work, NELEMENTS(work), path); val = (UINT16)milstr_solveHEX(work); *(UINT16 *)p->value = (UINT16)val; @@ -71,7 +82,7 @@ const INITBL *pterm; case INITYPE_HEX32: SPRINTF(work, str_x, *(UINT32 *)p->value), - GetPrivateProfileString(title, p->item, work, + GetPrivateProfileString(title, item, work, work, NELEMENTS(work), path); val = (UINT32)milstr_solveHEX(work); *(UINT32 *)p->value = (UINT32)val; @@ -145,7 +156,13 @@ const OEMCHAR *set; break; } if (set) { +#if defined(OSLANG_UCS2) + OEMCHAR item[10]; + oemtext_sjis2oem(item, NELEMENTS(item), p->item, (UINT)-1); + WritePrivateProfileString(title, item, set, path); +#else WritePrivateProfileString(title, p->item, set, path); +#endif } } p++; @@ -171,7 +188,7 @@ static const INITBL iniitem[] = { {"backgrnd", INIAND_UINT8, &xmiloscfg.background, 0x03}, {"DspClock", INIAND_UINT8, &xmiloscfg.DISPCLK, 0x03}, - {"StartDir", INITYPE_STR, fddfolder, MAX_PATH}, + {"FDfolder", INITYPE_STR, fddfolder, MAX_PATH}, {"bmap_Dir", INITYPE_STR, bmpfilefolder, MAX_PATH}, {"IPL_TYPE", INIMAX_UINT8, &xmilcfg.ROM_TYPE, 3}, @@ -179,8 +196,8 @@ static const INITBL iniitem[] = { {"Resolute", INITYPE_HEX8, &xmilcfg.DIP_SW, 0}, {"SkipLine", INITYPE_BOOL, &xmilcfg.SKIP_LINE, 0}, - {"s_NOWAIT", INITYPE_BOOL, &xmilcfg.NOWAIT, 0}, - {"SkpFrame", INITYPE_UINT8, &xmilcfg.DRAW_SKIP, 0}, + {"s_NOWAIT", INITYPE_BOOL, &xmiloscfg.NOWAIT, 0}, + {"SkpFrame", INITYPE_UINT8, &xmiloscfg.DRAW_SKIP, 0}, {"LinLIGHT", INITYPE_HEX8, &xmilcfg.LINEDEPTH, 0}, {"BlkLIGHT", INITYPE_HEX8, &xmilcfg.BLKLIGHT, 0}, {"TxtLIGHT", INITYPE_HEX8, &xmilcfg.LINETEXT, 0}, @@ -190,7 +207,6 @@ static const INITBL iniitem[] = { {"OPMsound", INITYPE_BOOL, &xmilcfg.SOUND_SW, 0}, {"SampleHz", INITYPE_UINT16, &xmilcfg.samplingrate, 0}, {"Latencys", INITYPE_UINT16, &xmilcfg.delayms, 0}, - {"SoundPly", INITYPE_BOOL, &xmilcfg.SOUNDPLY, 0}, {"Seek_Snd", INITYPE_BOOL, &xmilcfg.MOTOR, 0}, {"Seek_Vol", INIMAX_UINT8, &xmilcfg.MOTORVOL, 100}, @@ -211,7 +227,7 @@ static const INITBL iniitem[] = { static void initgetfile(OEMCHAR *path, UINT size) { - file_cpyname(path, __argv[0], size); + file_cpyname(path, modulefile, size); file_cutext(path); file_catname(path, OEMTEXT(".ini"), size); }