diff --git a/desmume/src/frontend/windows/hotkey.cpp b/desmume/src/frontend/windows/hotkey.cpp index 4bdab10ef..88e6be856 100644 --- a/desmume/src/frontend/windows/hotkey.cpp +++ b/desmume/src/frontend/windows/hotkey.cpp @@ -272,7 +272,7 @@ void HK_PrintScreen(int param, bool justPressed) dir = Path::GetFileDirectoryPath(outFilename); path.setpath(path.SCREENSHOTS, dir); - WritePrivateProfileString(SECTION, SCREENSHOTKEY, dir.c_str(), IniName); + WritePrivateProfileStringW(LSECTION, SCREENSHOTKEY, mbstowcs(dir).c_str(), IniNameW); } if(unpause) NDS_UnPause(false); diff --git a/desmume/src/frontend/windows/importSave.cpp b/desmume/src/frontend/windows/importSave.cpp index dca804bac..ac4dda5b4 100644 --- a/desmume/src/frontend/windows/importSave.cpp +++ b/desmume/src/frontend/windows/importSave.cpp @@ -23,6 +23,7 @@ #include "MMU.h" #include "NDSSystem.h" #include "utils/advanscene.h" +#include "utils/xstring.h" #include "resource.h" @@ -190,7 +191,7 @@ bool importSave(HWND hwnd, HINSTANCE hAppInst) { std::string dir = Path::GetFileDirectoryPath(SavFName); path.setpath(path.SRAM_IMPORT_EXPORT, dir); - WritePrivateProfileString(SECTION, SRAMIMPORTKEY, dir.c_str(), IniName); + WritePrivateProfileStringW(LSECTION, SRAMIMPORTKEY, mbstowcs(dir).c_str(), IniNameW); res = MMU_new.backupDevice.importData(SavFName, save_types[res+1].size); if (res) @@ -227,7 +228,7 @@ bool exportSave(HWND hwnd, HINSTANCE hAppInst) dir = Path::GetFileDirectoryPath(SavFName); path.setpath(path.SRAM_IMPORT_EXPORT, dir); - WritePrivateProfileString(SECTION, SRAMIMPORTKEY, dir.c_str(), IniName); + WritePrivateProfileStringW(LSECTION, SRAMIMPORTKEY, mbstowcs(dir).c_str(), IniNameW); if (ofn.nFilterIndex == 2) strcat(SavFName, "*"); diff --git a/desmume/src/frontend/windows/main.cpp b/desmume/src/frontend/windows/main.cpp index 4e9eb3b64..292266afa 100644 --- a/desmume/src/frontend/windows/main.cpp +++ b/desmume/src/frontend/windows/main.cpp @@ -2937,7 +2937,7 @@ void AviRecordTo() dir = Path::GetFileDirectoryPath(outFilename); path.setpath(path.AVI_FILES, dir); - WritePrivateProfileString(SECTION, AVIKEY, dir.c_str(), IniName); + WritePrivateProfileStringW(LSECTION, AVIKEY, mbstowcs(dir).c_str(), IniNameW); } NDS_UnPause(); @@ -3063,7 +3063,7 @@ void WavRecordTo(int wavmode) dir = Path::GetFileDirectoryPath(outFilename); path.setpath(path.AVI_FILES, dir); - WritePrivateProfileString(SECTION, AVIKEY, dir.c_str(), IniName); + WritePrivateProfileStringW(LSECTION, AVIKEY, mbstowcs(dir).c_str(), IniNameW); } NDS_UnPause(); @@ -3192,7 +3192,7 @@ LRESULT OpenFile() { std::string dir = Path::GetFileDirectoryPath(wcstombs(filename)); path.setpath(path.ROMS, dir); - WritePrivateProfileString(SECTION, ROMKEY, dir.c_str(), IniName); + WritePrivateProfileStringW(LSECTION, ROMKEY, mbstowcs(dir).c_str(), IniNameW); } } @@ -4780,7 +4780,7 @@ DOKEYDOWN: std::string utf8dir = Path::GetFileDirectoryPath(wcstombs(SavName)); path.setpath(path.STATES, utf8dir); - WritePrivateProfileString(SECTION, STATEKEY, utf8dir.c_str(), IniName); + WritePrivateProfileStringW(LSECTION, STATEKEY, mbstowcs(utf8dir).c_str(), IniNameW); savestate_load(wcstombs(SavName).c_str()); UpdateToolWindows(); @@ -4811,7 +4811,7 @@ DOKEYDOWN: std::string utf8dir = Path::GetFileDirectoryPath(wcstombs(SavName)); path.setpath(path.STATES, utf8dir); - WritePrivateProfileString(SECTION, STATEKEY, utf8dir.c_str(), IniName); + WritePrivateProfileStringW(LSECTION, STATEKEY, mbstowcs(utf8dir).c_str(), IniNameW); if(unpause) NDS_UnPause(); return 0; @@ -6174,7 +6174,7 @@ LRESULT CALLBACK EmulationSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, L { std::string dir = Path::GetFileDirectoryPath(fileName); path.setpath(path.FIRMWARE, dir); - WritePrivateProfileString(SECTION, FIRMWAREKEY, dir.c_str(), IniName); + WritePrivateProfileStringW(LSECTION, FIRMWAREKEY, mbstowcs(dir).c_str(), IniNameW); HWND cur; @@ -6294,7 +6294,7 @@ LRESULT CALLBACK MicrophoneSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, { std::string dir = Path::GetFileDirectoryPath(fileName); path.setpath(path.SOUNDS, dir); - WritePrivateProfileString(SECTION, SOUNDKEY, dir.c_str(), IniName); + WritePrivateProfileStringW(LSECTION, SOUNDKEY, mbstowcs(dir).c_str(), IniNameW); HWND cur; diff --git a/desmume/src/frontend/windows/pathsettings.cpp b/desmume/src/frontend/windows/pathsettings.cpp index dc6ef2b8f..bbb88599f 100644 --- a/desmume/src/frontend/windows/pathsettings.cpp +++ b/desmume/src/frontend/windows/pathsettings.cpp @@ -26,6 +26,7 @@ #include "main.h" #include "path.h" #include "pathsettings.h" +#include "utils/xstring.h" extern bool autoLoadLua; @@ -105,18 +106,18 @@ void DoAssociations() void WritePathSettings() { - WritePrivateProfileString(SECTION, ROMKEY, path.pathToRoms, IniName); - WritePrivateProfileString(SECTION, BATTERYKEY, path.pathToBattery, IniName); - WritePrivateProfileString(SECTION, SRAMIMPORTKEY, path.pathToSramImportExport, IniName); - WritePrivateProfileString(SECTION, STATEKEY, path.pathToStates, IniName); - WritePrivateProfileString(SECTION, STATESLOTKEY, path.pathToStateSlots, IniName); - WritePrivateProfileString(SECTION, SCREENSHOTKEY, path.pathToScreenshots, IniName); - WritePrivateProfileString(SECTION, AVIKEY, path.pathToAviFiles, IniName); - WritePrivateProfileString(SECTION, CHEATKEY, path.pathToCheats, IniName); + WritePrivateProfileStringW(LSECTION, ROMKEY, mbstowcs((std::string)path.pathToRoms).c_str(), IniNameW); + WritePrivateProfileStringW(LSECTION, BATTERYKEY, mbstowcs((std::string)path.pathToBattery).c_str(), IniNameW); + WritePrivateProfileStringW(LSECTION, SRAMIMPORTKEY, mbstowcs((std::string)path.pathToSramImportExport).c_str(), IniNameW); + WritePrivateProfileStringW(LSECTION, STATEKEY, mbstowcs((std::string)path.pathToStates).c_str(), IniNameW); + WritePrivateProfileStringW(LSECTION, STATESLOTKEY, mbstowcs((std::string)path.pathToStateSlots).c_str(), IniNameW); + WritePrivateProfileStringW(LSECTION, SCREENSHOTKEY, mbstowcs((std::string)path.pathToScreenshots).c_str(), IniNameW); + WritePrivateProfileStringW(LSECTION, AVIKEY, mbstowcs((std::string)path.pathToAviFiles).c_str(), IniNameW); + WritePrivateProfileStringW(LSECTION, CHEATKEY, mbstowcs((std::string)path.pathToCheats).c_str(), IniNameW); WritePrivateProfileInt(SECTION, R4FORMATKEY, path.r4Format, IniName); - WritePrivateProfileString(SECTION, SOUNDKEY, path.pathToSounds, IniName); - WritePrivateProfileString(SECTION, FIRMWAREKEY, path.pathToFirmware, IniName); - WritePrivateProfileString(SECTION, LUAKEY, path.pathToLua, IniName); + WritePrivateProfileStringW(LSECTION, SOUNDKEY, mbstowcs((std::string)path.pathToSounds).c_str(), IniNameW); + WritePrivateProfileStringW(LSECTION, FIRMWAREKEY, mbstowcs((std::string)path.pathToFirmware).c_str(), IniNameW); + WritePrivateProfileStringW(LSECTION, LUAKEY, mbstowcs((std::string)path.pathToLua).c_str(), IniNameW); WritePrivateProfileInt(SECTION, DEFAULTFORMATKEY, path.currentimageformat, IniName); WritePrivateProfileString(SECTION, FORMATKEY, path.screenshotFormat, IniName); @@ -171,15 +172,15 @@ BOOL PathSettings_OnInitDialog(HWND hDlg, HWND hwndFocus, LPARAM lParam) SetWindowPos(toolTip, HWND_TOPMOST, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - SetDlgItemText(hDlg, IDC_ROMPATHEDIT, path.pathToRoms); - SetDlgItemText(hDlg, IDC_SAVERAMPATHEDIT, path.pathToBattery); - SetDlgItemText(hDlg, IDC_SRAMIMPORTPATHEDIT, path.pathToSramImportExport); - SetDlgItemText(hDlg, IDC_STATEPATHEDIT, path.pathToStates); - SetDlgItemText(hDlg, IDC_STATESLOTPATHEDIT, path.pathToStateSlots); - SetDlgItemText(hDlg, IDC_SCREENSHOTPATHEDIT, path.pathToScreenshots); - SetDlgItemText(hDlg, IDC_AVIPATHEDIT, path.pathToAviFiles); - SetDlgItemText(hDlg, IDC_CHEATPATHEDIT, path.pathToCheats); - SetDlgItemText(hDlg, IDC_LUAPATHEDIT, path.pathToLua); + SetDlgItemTextW(hDlg, IDC_ROMPATHEDIT, mbstowcs(path.pathToRoms).c_str()); + SetDlgItemTextW(hDlg, IDC_SAVERAMPATHEDIT, mbstowcs(path.pathToBattery).c_str()); + SetDlgItemTextW(hDlg, IDC_SRAMIMPORTPATHEDIT, mbstowcs(path.pathToSramImportExport).c_str()); + SetDlgItemTextW(hDlg, IDC_STATEPATHEDIT, mbstowcs(path.pathToStates).c_str()); + SetDlgItemTextW(hDlg, IDC_STATESLOTPATHEDIT, mbstowcs(path.pathToStateSlots).c_str()); + SetDlgItemTextW(hDlg, IDC_SCREENSHOTPATHEDIT, mbstowcs(path.pathToScreenshots).c_str()); + SetDlgItemTextW(hDlg, IDC_AVIPATHEDIT, mbstowcs(path.pathToAviFiles).c_str()); + SetDlgItemTextW(hDlg, IDC_CHEATPATHEDIT, mbstowcs(path.pathToCheats).c_str()); + SetDlgItemTextW(hDlg, IDC_LUAPATHEDIT, mbstowcs(path.pathToLua).c_str()); TOOLINFO ti; ZeroMemory(&ti, sizeof(ti)); @@ -213,7 +214,7 @@ BOOL BrowseForPath(char *pathToBrowse) LPMALLOC shMalloc; BOOL changed = false; LPITEMIDLIST idList; - BROWSEINFO bi; + BROWSEINFOW bi; //stupid shell if(SHGetMalloc( &shMalloc) != S_OK) @@ -226,7 +227,7 @@ BOOL BrowseForPath(char *pathToBrowse) strncpy(tmp, pathToBrowse, MAX_PATH); bi.hwndOwner = MainWindow->getHWnd(); - bi.lpszTitle = "Choose a Folder"; + bi.lpszTitle = L"Choose a Folder"; bi.ulFlags = BIF_NONEWFOLDERBUTTON | BIF_USENEWUI; /*wanted to add a callback function for the folder initialization but it crashes everytime i do @@ -234,10 +235,12 @@ BOOL BrowseForPath(char *pathToBrowse) bi.lParam = (LPARAM)pathToBrowse; */ - if( (idList = SHBrowseForFolder(&bi)) ) + if( (idList = SHBrowseForFolderW(&bi)) ) { changed = true; - SHGetPathFromIDList(idList, pathToBrowse); + wchar_t wPathToBrowse[MAX_PATH]; + SHGetPathFromIDListW(idList, wPathToBrowse); + strcpy(pathToBrowse,wcstombs((std::wstring)wPathToBrowse).c_str()); // shMalloc->Free(&idList); } @@ -252,49 +255,49 @@ void PathSettings_OnCommand(HWND hDlg, int id, HWND hwndCtl, UINT codeNotify) case IDC_BROWSEROMS: { if(BrowseForPath(path.pathToRoms)) - SetDlgItemText(hDlg, IDC_ROMPATHEDIT, path.pathToRoms); + SetDlgItemTextW(hDlg, IDC_ROMPATHEDIT, mbstowcs((std::string)path.pathToRoms).c_str()); } break; case IDC_BROWSESRAM: { if(BrowseForPath(path.pathToBattery)) - SetDlgItemText(hDlg, IDC_SAVERAMPATHEDIT, path.pathToBattery); + SetDlgItemTextW(hDlg, IDC_SAVERAMPATHEDIT, mbstowcs((std::string)path.pathToBattery).c_str()); } break; case IDC_BROWSESRAMIMPORT: { if(BrowseForPath(path.pathToSramImportExport)) - SetDlgItemText(hDlg, IDC_SRAMIMPORTPATHEDIT, path.pathToSramImportExport); + SetDlgItemTextW(hDlg, IDC_SRAMIMPORTPATHEDIT, mbstowcs((std::string)path.pathToSramImportExport).c_str()); } break; case IDC_BROWSESTATES: { if(BrowseForPath(path.pathToStates)) - SetDlgItemText(hDlg, IDC_STATEPATHEDIT, path.pathToStates); + SetDlgItemTextW(hDlg, IDC_STATEPATHEDIT, mbstowcs((std::string)path.pathToStates).c_str()); } break; case IDC_BROWSESTATESLOTS: { if(BrowseForPath(path.pathToStateSlots)) - SetDlgItemText(hDlg, IDC_STATESLOTPATHEDIT, path.pathToStateSlots); + SetDlgItemTextW(hDlg, IDC_STATESLOTPATHEDIT, mbstowcs((std::string)path.pathToStateSlots).c_str()); } break; case IDC_BROWSESCREENSHOTS: { if(BrowseForPath(path.pathToScreenshots)) - SetDlgItemText(hDlg, IDC_SCREENSHOTPATHEDIT, path.pathToScreenshots); + SetDlgItemTextW(hDlg, IDC_SCREENSHOTPATHEDIT, mbstowcs((std::string)path.pathToScreenshots).c_str()); } break; case IDC_BROWSEAVI: { if(BrowseForPath(path.pathToAviFiles)) - SetDlgItemText(hDlg, IDC_AVIPATHEDIT, path.pathToAviFiles); + SetDlgItemTextW(hDlg, IDC_AVIPATHEDIT, mbstowcs((std::string)path.pathToAviFiles).c_str()); } break; case IDC_BROWSECHEATS: { if(BrowseForPath(path.pathToCheats)) - SetDlgItemText(hDlg, IDC_CHEATPATHEDIT, path.pathToCheats); + SetDlgItemTextW(hDlg, IDC_CHEATPATHEDIT, mbstowcs((std::string)path.pathToCheats).c_str()); } break; case IDC_R4TYPE1: @@ -356,15 +359,16 @@ void PathSettings_OnCommand(HWND hDlg, int id, HWND hwndCtl, UINT codeNotify) break; case IDOK: - GetDlgItemText(hDlg, IDC_ROMPATHEDIT, path.pathToRoms, MAX_PATH); - GetDlgItemText(hDlg, IDC_SAVERAMPATHEDIT, path.pathToBattery, MAX_PATH); - GetDlgItemText(hDlg, IDC_SRAMIMPORTPATHEDIT, path.pathToSramImportExport, MAX_PATH); - GetDlgItemText(hDlg, IDC_STATEPATHEDIT, path.pathToStates, MAX_PATH); - GetDlgItemText(hDlg, IDC_STATESLOTPATHEDIT, path.pathToStateSlots, MAX_PATH); - GetDlgItemText(hDlg, IDC_SCREENSHOTPATHEDIT, path.pathToScreenshots, MAX_PATH); - GetDlgItemText(hDlg, IDC_AVIPATHEDIT, path.pathToAviFiles, MAX_PATH); - GetDlgItemText(hDlg, IDC_CHEATPATHEDIT, path.pathToCheats, MAX_PATH); - GetDlgItemText(hDlg, IDC_LUAPATHEDIT, path.pathToLua, MAX_PATH); + wchar_t wtmp[MAX_PATH]; + GetDlgItemTextW(hDlg, IDC_ROMPATHEDIT, wtmp, MAX_PATH); strcpy(path.pathToRoms,wcstombs((std::wstring)wtmp).c_str()); + GetDlgItemTextW(hDlg, IDC_SAVERAMPATHEDIT, wtmp, MAX_PATH); strcpy(path.pathToBattery,wcstombs((std::wstring)wtmp).c_str()); + GetDlgItemTextW(hDlg, IDC_SRAMIMPORTPATHEDIT, wtmp, MAX_PATH); strcpy(path.pathToSramImportExport,wcstombs((std::wstring)wtmp).c_str()); + GetDlgItemTextW(hDlg, IDC_STATEPATHEDIT, wtmp, MAX_PATH); strcpy(path.pathToStates,wcstombs((std::wstring)wtmp).c_str()); + GetDlgItemTextW(hDlg, IDC_STATESLOTPATHEDIT, wtmp, MAX_PATH); strcpy(path.pathToStateSlots,wcstombs((std::wstring)wtmp).c_str()); + GetDlgItemTextW(hDlg, IDC_SCREENSHOTPATHEDIT, wtmp, MAX_PATH); strcpy(path.pathToScreenshots,wcstombs((std::wstring)wtmp).c_str()); + GetDlgItemTextW(hDlg, IDC_AVIPATHEDIT, wtmp, MAX_PATH); strcpy(path.pathToAviFiles,wcstombs((std::wstring)wtmp).c_str()); + GetDlgItemTextW(hDlg, IDC_CHEATPATHEDIT, wtmp, MAX_PATH); strcpy(path.pathToCheats,wcstombs((std::wstring)wtmp).c_str()); + GetDlgItemTextW(hDlg, IDC_LUAPATHEDIT, wtmp, MAX_PATH); strcpy(path.pathToLua,wcstombs((std::wstring)wtmp).c_str()); DoAssociations(); WritePathSettings(); EndDialog(hDlg, 0); diff --git a/desmume/src/frontend/windows/slot1_config.cpp b/desmume/src/frontend/windows/slot1_config.cpp index 0569c2b2f..9ed7b2c1a 100644 --- a/desmume/src/frontend/windows/slot1_config.cpp +++ b/desmume/src/frontend/windows/slot1_config.cpp @@ -25,6 +25,7 @@ #include "debug.h" #include "NDSSystem.h" #include "path.h" +#include "utils/xstring.h" #include "resource.h" #include "main.h" @@ -346,7 +347,7 @@ void slot1Dialog(HWND hwnd) if (strlen(tmp_fs_path)) { path.setpath(path.SLOT1D, tmp_fs_path); - WritePrivateProfileString(SECTION, SLOT1DKEY, path.pathToSlot1D, IniName); + WritePrivateProfileStringW(LSECTION, SLOT1DKEY, mbstowcs((std::string)path.pathToSlot1D).c_str(), IniNameW); } break; default: diff --git a/desmume/src/frontend/windows/winutil.cpp b/desmume/src/frontend/windows/winutil.cpp index 82088024d..1bab5f8d4 100644 --- a/desmume/src/frontend/windows/winutil.cpp +++ b/desmume/src/frontend/windows/winutil.cpp @@ -26,6 +26,7 @@ char IniName[MAX_PATH]; +wchar_t IniNameW[MAX_PATH]; std::string _hack_alternateModulePathUtf8; @@ -86,6 +87,21 @@ void GetINIPath() } FCEUD_MakePathDirs(IniName); + wcscpy(IniNameW,mbstowcs(IniName).c_str()); //careful to use locale C-style mbstowcs to get IniName (which is with locale encoding) to unicode + + //write BOM to get unicode + FILE* test = fopen(IniName,"rb"); + if(test) + fclose(test); + else + { + test = fopen(IniName,"wb"); + if(test) + { + fputs("\xFF\xFE",test); + fclose(test); + } + } } void PreventScreensaver() diff --git a/desmume/src/frontend/windows/winutil.h b/desmume/src/frontend/windows/winutil.h index 44d0961e9..a6cb72116 100644 --- a/desmume/src/frontend/windows/winutil.h +++ b/desmume/src/frontend/windows/winutil.h @@ -23,6 +23,7 @@ #include extern char IniName[MAX_PATH]; +extern wchar_t IniNameW[MAX_PATH]; void GetINIPath(); void PreventScreensaver(); diff --git a/desmume/src/path.cpp b/desmume/src/path.cpp index 8045f9ae7..71eaf782c 100644 --- a/desmume/src/path.cpp +++ b/desmume/src/path.cpp @@ -232,6 +232,25 @@ void PathInfo::GetDefaultPath(char *pathToDefault, const char *key, int maxCount #endif } +void PathInfo::ReadKeyW(char *pathToRead, const wchar_t *key) +{ + wchar_t wpath[MAX_PATH]; + #ifdef HOST_WINDOWS + GetPrivateProfileStringW(LSECTION, key, key, wpath, MAX_PATH, IniNameW); + if (wcscmp(wpath, key) == 0) { + //since the variables are all intialized in this file they all use MAX_PATH + char temppath[MAX_PATH]; + temppath[0] = 0; + GetDefaultPath(temppath, wcstombs((std::wstring)key).c_str(), MAX_PATH); + wcscpy(wpath,mbstowcs((std::string)temppath).c_str()); + } + strcpy(pathToRead,wcstombs((std::wstring)wpath).c_str()); + #else + //since the variables are all intialized in this file they all use MAX_PATH + GetDefaultPath(pathToRead, key, MAX_PATH); + #endif +} + void PathInfo::ReadKey(char *pathToRead, const char *key) { #ifdef HOST_WINDOWS @@ -251,18 +270,18 @@ void PathInfo::ReadPathSettings() if ((strcmp(pathToModule, "") == 0) || !pathToModule) LoadModulePath(); - ReadKey(pathToRoms, ROMKEY); - ReadKey(pathToBattery, BATTERYKEY); - ReadKey(pathToSramImportExport, SRAMIMPORTKEY); - ReadKey(pathToStates, STATEKEY); - ReadKey(pathToStateSlots, STATESLOTKEY); - ReadKey(pathToScreenshots, SCREENSHOTKEY); - ReadKey(pathToAviFiles, AVIKEY); - ReadKey(pathToCheats, CHEATKEY); - ReadKey(pathToSounds, SOUNDKEY); - ReadKey(pathToFirmware, FIRMWAREKEY); - ReadKey(pathToLua, LUAKEY); - ReadKey(pathToSlot1D, SLOT1DKEY); + ReadKeyW(pathToRoms, ROMKEY); + ReadKeyW(pathToBattery, BATTERYKEY); + ReadKeyW(pathToSramImportExport, SRAMIMPORTKEY); + ReadKeyW(pathToStates, STATEKEY); + ReadKeyW(pathToStateSlots, STATESLOTKEY); + ReadKeyW(pathToScreenshots, SCREENSHOTKEY); + ReadKeyW(pathToAviFiles, AVIKEY); + ReadKeyW(pathToCheats, CHEATKEY); + ReadKeyW(pathToSounds, SOUNDKEY); + ReadKeyW(pathToFirmware, FIRMWAREKEY); + ReadKeyW(pathToLua, LUAKEY); + ReadKeyW(pathToSlot1D, SLOT1DKEY); #ifdef HOST_WINDOWS GetPrivateProfileString(SECTION, FORMATKEY, "%f_%s_%r", screenshotFormat, MAX_FORMAT, IniName); savelastromvisit = GetPrivateProfileBool(SECTION, LASTVISITKEY, true, IniName); diff --git a/desmume/src/path.h b/desmume/src/path.h index c56baed4d..364650c4a 100644 --- a/desmume/src/path.h +++ b/desmume/src/path.h @@ -69,24 +69,25 @@ public: #define MAX_FORMAT 20 #define SECTION "PathSettings" + #define LSECTION L"PathSettings" - #define ROMKEY "Roms" - #define BATTERYKEY "Battery" - #define SRAMIMPORTKEY "SramImportExport" - #define STATEKEY "States" - #define STATESLOTKEY "StateSlots" - #define SCREENSHOTKEY "Screenshots" - #define AVIKEY "AviFiles" - #define CHEATKEY "Cheats" + #define ROMKEY L"Roms" + #define BATTERYKEY L"Battery" + #define SRAMIMPORTKEY L"SramImportExport" + #define STATEKEY L"States" + #define STATESLOTKEY L"StateSlots" + #define SCREENSHOTKEY L"Screenshots" + #define AVIKEY L"AviFiles" + #define CHEATKEY L"Cheats" #define R4FORMATKEY "R4format" - #define SOUNDKEY "SoundSamples" - #define FIRMWAREKEY "Firmware" + #define SOUNDKEY L"SoundSamples" + #define FIRMWAREKEY L"Firmware" #define FORMATKEY "format" #define DEFAULTFORMATKEY "defaultFormat" #define NEEDSSAVINGKEY "needsSaving" #define LASTVISITKEY "lastVisit" - #define LUAKEY "Lua" - #define SLOT1DKEY "Slot1D" + #define LUAKEY L"Lua" + #define SLOT1DKEY L"Slot1D" char screenshotFormat[MAX_FORMAT]; bool savelastromvisit; @@ -108,19 +109,21 @@ public: MAXKNOWNPATH = MODULE }; - char pathToRoms[MAX_PATH]; - char pathToBattery[MAX_PATH]; - char pathToSramImportExport[MAX_PATH]; - char pathToStates[MAX_PATH]; - char pathToStateSlots[MAX_PATH]; - char pathToScreenshots[MAX_PATH]; - char pathToAviFiles[MAX_PATH]; - char pathToCheats[MAX_PATH]; - char pathToSounds[MAX_PATH]; - char pathToFirmware[MAX_PATH]; - char pathToModule[MAX_PATH]; - char pathToLua[MAX_PATH]; - char pathToSlot1D[MAX_PATH]; + //ALL UTF8, NOT SYSTEM LOCALE!! BLEGH! + //should probably have set locale to utf-8 but it's too late for that + char pathToRoms[MAX_PATH*8]; + char pathToBattery[MAX_PATH*8]; + char pathToSramImportExport[MAX_PATH*8]; + char pathToStates[MAX_PATH*8]; + char pathToStateSlots[MAX_PATH*8]; + char pathToScreenshots[MAX_PATH*8]; + char pathToAviFiles[MAX_PATH*8]; + char pathToCheats[MAX_PATH*8]; + char pathToSounds[MAX_PATH*8]; + char pathToFirmware[MAX_PATH*8]; + char pathToModule[MAX_PATH*8]; + char pathToLua[MAX_PATH*8]; + char pathToSlot1D[MAX_PATH*8]; void init(const char *filename); @@ -135,6 +138,7 @@ public: void GetDefaultPath(char *pathToDefault, const char *key, int maxCount); void ReadKey(char *pathToRead, const char *key); + void ReadKeyW(char *pathToRead, const wchar_t *key); void ReadPathSettings();