--- xmil/win9x/ini.cpp 2004/08/01 05:31:31 1.1 +++ xmil/win9x/ini.cpp 2004/08/08 09:12:06 1.6 @@ -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++; @@ -170,36 +187,31 @@ static const INITBL iniitem[] = { {"Win_Snap", INITYPE_BOOL, &xmiloscfg.WINSNAP, 0}, {"backgrnd", INIAND_UINT8, &xmiloscfg.background, 0x03}, {"DspClock", INIAND_UINT8, &xmiloscfg.DISPCLK, 0x03}, - - {"StartDir", INITYPE_STR, fddfolder, MAX_PATH}, + {"s_NOWAIT", INITYPE_BOOL, &xmiloscfg.NOWAIT, 0}, + {"SkpFrame", INITYPE_UINT8, &xmiloscfg.DRAW_SKIP, 0}, + {"FDfolder", INITYPE_STR, fddfolder, MAX_PATH}, {"bmap_Dir", INITYPE_STR, bmpfilefolder, MAX_PATH}, {"IPL_TYPE", INIMAX_UINT8, &xmilcfg.ROM_TYPE, 3}, {"cpu_8MHz", INITYPE_BOOL, &xmilcfg.CPU8MHz, 0}, - {"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}, - {"LinLIGHT", INITYPE_HEX8, &xmilcfg.LINEDEPTH, 0}, - {"BlkLIGHT", INITYPE_HEX8, &xmilcfg.BLKLIGHT, 0}, - {"TxtLIGHT", INITYPE_HEX8, &xmilcfg.LINETEXT, 0}, - {"Text_Ext", INITYPE_BOOL, &xmilcfg.TEXTMODE, 0}, - {"Text_400", INITYPE_HEX8, &xmilcfg.TEXT400L, 0}, - {"OPMsound", INITYPE_BOOL, &xmilcfg.SOUND_SW, 0}, + {"DispSync", INITYPE_BOOL, &xmilcfg.DISPSYNC, 0}, + {"Real_Pal", INITYPE_BOOL, &xmilcfg.RASTER, 0}, + {"skipline", INITYPE_BOOL, &xmilcfg.skipline, 0}, + {"skplight", INITYPE_UINT16, &xmilcfg.skiplight, 0}, + {"SampleHz", INITYPE_UINT16, &xmilcfg.samplingrate, 0}, {"Latencys", INITYPE_UINT16, &xmilcfg.delayms, 0}, - {"SoundPly", INITYPE_BOOL, &xmilcfg.SOUNDPLY, 0}, + {"OPMsound", INITYPE_BOOL, &xmilcfg.SOUND_SW, 0}, {"Seek_Snd", INITYPE_BOOL, &xmilcfg.MOTOR, 0}, {"Seek_Vol", INIMAX_UINT8, &xmilcfg.MOTORVOL, 100}, + {"MouseInt", INITYPE_BOOL, &xmilcfg.MOUSE_SW, 0}, {"btnRAPID", INITYPE_BOOL, &xmilcfg.BTN_RAPID, 0}, {"btn_MODE", INITYPE_BOOL, &xmilcfg.BTN_MODE, 0}, - {"MouseInt", INITYPE_BOOL, &xmilcfg.MOUSE_SW, 0}, {"Joystick", INITYPE_BOOL, &xmiloscfg.JOYSTICK, 0}, - {"clocknow", INITYPE_UINT8, &xmiloscfg.clockx, 0}, {"clockfnt", INITYPE_UINT8, &xmiloscfg.clockfnt, 0}, {"clock_up", INIROAND_HEX32, &xmiloscfg.clockcolor1, 0xffffff}, @@ -211,7 +223,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); }