From 52b8847c04865c8e0c2c433bd61dda5899d8d4a4 Mon Sep 17 00:00:00 2001 From: zeromus Date: Fri, 25 Dec 2009 17:18:20 +0000 Subject: [PATCH] more screwing around with languages --- desmume/src/windows/hotkey.cpp | 122 ++++++++++++++++--------------- desmume/src/windows/inputdx.cpp | 2 +- desmume/src/windows/inputdx.h | 1 + desmume/src/windows/main.cpp | 70 ++++++------------ desmume/src/windows/main.h | 6 ++ desmume/src/windows/resource.h | 53 ++++++++++++++ desmume/src/windows/resources.rc | Bin 891502 -> 910490 bytes desmume/src/windows/winutil.cpp | 21 +++++- desmume/src/windows/winutil.h | 5 ++ 9 files changed, 170 insertions(+), 110 deletions(-) diff --git a/desmume/src/windows/hotkey.cpp b/desmume/src/windows/hotkey.cpp index d604af2a3..92fe40798 100644 --- a/desmume/src/windows/hotkey.cpp +++ b/desmume/src/windows/hotkey.cpp @@ -38,6 +38,7 @@ #include "GPU_osd.h" #include "path.h" #include "video.h" +#include "winutil.h" extern LRESULT OpenFile(); //adelikat: Made this an extern here instead of main.h Seemed icky not to limit the scope of this function @@ -385,13 +386,6 @@ void HK_ToggleRasterizer(int, bool justPressed) { //=====================================DEFINITIONS====================================== //====================================================================================== -//returns the specified resource string ID as a std::wstring -std::wstring STRW(UINT id) -{ - wchar_t* wstr; - LoadStringW(NULL,id,(LPWSTR)&wstr,0); - return wstr; -} void InitCustomKeys (SCustomKeys *keys) { @@ -414,7 +408,7 @@ void InitCustomKeys (SCustomKeys *keys) //Main Page--------------------------------------- keys->OpenROM.handleKeyDown = HK_OpenROM; keys->OpenROM.code = "OpenROM"; - keys->OpenROM.name = L"Open ROM"; + keys->OpenROM.name = STRW(ID_LABEL_HK1); //keys->OpenROM.name = STRW(ID_LOCALIZED_STRING); keys->OpenROM.page = HOTKEY_PAGE_MAIN; keys->OpenROM.key = 'O'; @@ -422,150 +416,150 @@ void InitCustomKeys (SCustomKeys *keys) keys->Reset.handleKeyDown = HK_Reset; keys->Reset.code = "Reset"; - keys->Reset.name = L"Reset"; + keys->Reset.name = STRW(ID_LABEL_HK2); keys->Reset.page = HOTKEY_PAGE_MAIN; keys->Reset.key = 'R'; keys->Reset.modifiers = CUSTKEY_CTRL_MASK; keys->Pause.handleKeyDown = HK_Pause; keys->Pause.code = "Pause"; - keys->Pause.name = L"Pause"; + keys->Pause.name = STRW(ID_LABEL_HK3); keys->Pause.page = HOTKEY_PAGE_MAIN; keys->Pause.key = VK_PAUSE; keys->FrameAdvance.handleKeyDown = HK_FrameAdvanceKeyDown; keys->FrameAdvance.handleKeyUp = HK_FrameAdvanceKeyUp; keys->FrameAdvance.code = "FrameAdvance"; - keys->FrameAdvance.name = L"Frame Advance"; + keys->FrameAdvance.name = STRW(ID_LABEL_HK4); keys->FrameAdvance.page = HOTKEY_PAGE_MAIN; keys->FrameAdvance.key = 'N'; keys->FastForward.handleKeyDown = HK_FastForwardKeyDown; keys->FastForward.handleKeyUp = HK_FastForwardKeyUp; keys->FastForward.code = "FastForward"; - keys->FastForward.name = L"Fast Forward"; + keys->FastForward.name = STRW(ID_LABEL_HK5); keys->FastForward.page = HOTKEY_PAGE_MAIN; keys->FastForward.key = VK_TAB; keys->FastForwardToggle.handleKeyDown = HK_FastForwardToggle; keys->FastForwardToggle.code = "FastForwardToggle"; - keys->FastForwardToggle.name = L"Fast Forward Toggle"; + keys->FastForwardToggle.name = STRW(ID_LABEL_HK6); keys->FastForwardToggle.page = HOTKEY_PAGE_MAIN; keys->FastForwardToggle.key = NULL; keys->IncreaseSpeed.handleKeyDown = HK_IncreaseSpeed; keys->IncreaseSpeed.code = "IncreaseSpeed"; - keys->IncreaseSpeed.name = L"Increase Speed"; + keys->IncreaseSpeed.name = STRW(ID_LABEL_HK7); keys->IncreaseSpeed.page = HOTKEY_PAGE_MAIN; keys->IncreaseSpeed.key = VK_OEM_PLUS; keys->DecreaseSpeed.handleKeyDown = HK_DecreaseSpeed; keys->DecreaseSpeed.code = "DecreaseSpeed"; - keys->DecreaseSpeed.name = L"Decrease Speed"; + keys->DecreaseSpeed.name = STRW(ID_LABEL_HK8); keys->DecreaseSpeed.page = HOTKEY_PAGE_MAIN; keys->DecreaseSpeed.key = VK_OEM_MINUS; keys->Microphone.handleKeyDown = HK_MicrophoneKeyDown; keys->Microphone.handleKeyUp = HK_MicrophoneKeyUp; keys->Microphone.code = "Microphone"; - keys->Microphone.name = L"Microphone"; + keys->Microphone.name = STRW(ID_LABEL_HK9); keys->Microphone.page = HOTKEY_PAGE_MAIN; keys->Microphone.key = NULL; keys->AutoHold.handleKeyDown = HK_AutoHoldKeyDown; keys->AutoHold.handleKeyUp = HK_AutoHoldKeyUp; keys->AutoHold.code = "AutoHold"; - keys->AutoHold.name = L"Auto-Hold"; + keys->AutoHold.name = STRW(ID_LABEL_HK10); keys->AutoHold.page = HOTKEY_PAGE_MAIN; keys->AutoHold.key = NULL; keys->StylusAutoHold.handleKeyDown = HK_StylusAutoHoldKeyDown; keys->StylusAutoHold.code = "StylusAutoHold"; - keys->StylusAutoHold.name = L"Stylus Auto-Hold"; + keys->StylusAutoHold.name = STRW(ID_LABEL_HK29); keys->StylusAutoHold.page = HOTKEY_PAGE_MOVIE; // TODO: set more appropriate category? keys->StylusAutoHold.key = NULL; keys->AutoHoldClear.handleKeyDown = HK_AutoHoldClearKeyDown; keys->AutoHoldClear.code = "AutoHoldClear"; - keys->AutoHoldClear.name = L"Auto-Hold Clear"; + keys->AutoHoldClear.name = STRW(ID_LABEL_HK11); keys->AutoHoldClear.page = HOTKEY_PAGE_MAIN; keys->AutoHoldClear.key = NULL; keys->ToggleRasterizer.handleKeyDown = HK_ToggleRasterizer; keys->ToggleRasterizer.code = "ToggleRasterizer"; - keys->ToggleRasterizer.name = L"Toggle Rasterizer"; + keys->ToggleRasterizer.name = STRW(ID_LABEL_HK12); keys->ToggleRasterizer.page = HOTKEY_PAGE_MAIN; keys->ToggleRasterizer.key = VK_SUBTRACT; keys->PrintScreen.handleKeyDown = HK_PrintScreen; keys->PrintScreen.code = "SaveScreenshotas"; - keys->PrintScreen.name = L"Save Screenshot as"; + keys->PrintScreen.name = STRW(ID_LABEL_HK13); keys->PrintScreen.page = HOTKEY_PAGE_MAIN; keys->PrintScreen.key = VK_F12; keys->ToggleFrameCounter.handleKeyDown = HK_ToggleFrame; keys->ToggleFrameCounter.code = "ToggleFrameDisplay"; - keys->ToggleFrameCounter.name = L"Toggle Frame Display"; + keys->ToggleFrameCounter.name = STRW(ID_LABEL_HK16); keys->ToggleFrameCounter.page = HOTKEY_PAGE_MAIN; keys->ToggleFrameCounter.key = VK_OEM_PERIOD; keys->ToggleFPS.handleKeyDown = HK_ToggleFPS; keys->ToggleFPS.code = "ToggleFPSDisplay"; - keys->ToggleFPS.name = L"Toggle FPS Display"; + keys->ToggleFPS.name = STRW(ID_LABEL_HK17); keys->ToggleFPS.page = HOTKEY_PAGE_MAIN; keys->ToggleFPS.key = NULL; keys->ToggleInput.handleKeyDown = HK_ToggleInput; keys->ToggleInput.code = "ToggleInputDisplay"; - keys->ToggleInput.name = L"Toggle Input Display"; + keys->ToggleInput.name = STRW(ID_LABEL_HK18); keys->ToggleInput.page = HOTKEY_PAGE_MAIN; keys->ToggleInput.key = VK_OEM_COMMA; keys->ToggleLag.handleKeyDown = HK_ToggleLag; keys->ToggleLag.code = "ToggleLagDisplay"; - keys->ToggleLag.name = L"Toggle Lag Display"; + keys->ToggleLag.name = STRW(ID_LABEL_HK19); keys->ToggleLag.page = HOTKEY_PAGE_MAIN; keys->ToggleLag.key = NULL; keys->ResetLagCounter.handleKeyDown = HK_ResetLagCounter; keys->ResetLagCounter.code = "ResetLagCounter"; - keys->ResetLagCounter.name = L"Reset Lag Counter"; + keys->ResetLagCounter.name = STRW(ID_LABEL_HK20); keys->ResetLagCounter.page = HOTKEY_PAGE_MAIN; keys->ResetLagCounter.key = NULL; keys->ToggleReadOnly.handleKeyDown = HK_ToggleReadOnly; keys->ToggleReadOnly.code = "ToggleReadOnly"; - keys->ToggleReadOnly.name = L"Toggle Read Only"; + keys->ToggleReadOnly.name = STRW(ID_LABEL_HK24); keys->ToggleReadOnly.page = HOTKEY_PAGE_MOVIE; keys->ToggleReadOnly.key = NULL; keys->PlayMovie.handleKeyDown = HK_PlayMovie; keys->PlayMovie.code = "PlayMovie"; - keys->PlayMovie.name = L"Play Movie"; + keys->PlayMovie.name = STRW(ID_LABEL_HK21); keys->PlayMovie.page = HOTKEY_PAGE_MOVIE; keys->PlayMovie.key = NULL; keys->RecordMovie.handleKeyDown = HK_RecordMovie; keys->RecordMovie.code = "RecordMovie"; - keys->RecordMovie.name = L"Record Movie"; + keys->RecordMovie.name = STRW(ID_LABEL_HK22); keys->RecordMovie.page = HOTKEY_PAGE_MOVIE; keys->RecordMovie.key = NULL; keys->StopMovie.handleKeyDown = HK_StopMovie; keys->StopMovie.code = "StopMovie"; - keys->StopMovie.name = L"Stop Movie"; + keys->StopMovie.name = STRW(ID_LABEL_HK23); keys->StopMovie.page = HOTKEY_PAGE_MOVIE; keys->StopMovie.key = NULL; keys->RecordWAV.handleKeyDown = HK_RecordWAV; keys->RecordWAV.code = "RecordWAV"; - keys->RecordWAV.name = L"Record WAV"; + keys->RecordWAV.name = STRW(ID_LABEL_HK14); keys->RecordWAV.page = HOTKEY_PAGE_MAIN; keys->RecordWAV.key = NULL; keys->RecordAVI.handleKeyDown = HK_RecordAVI; keys->RecordAVI.code = "RecordAVI"; - keys->RecordAVI.name = L"Record AVI"; + keys->RecordAVI.name = STRW(ID_LABEL_HK15); keys->RecordAVI.page = HOTKEY_PAGE_MAIN; keys->RecordAVI.key = NULL; @@ -573,84 +567,84 @@ void InitCustomKeys (SCustomKeys *keys) keys->TurboRight.handleKeyDown = HK_TurboRightKeyDown; keys->TurboRight.handleKeyUp = HK_TurboRightKeyUp; keys->TurboRight.code = "TurboRight"; - keys->TurboRight.name = L"Turbo Right"; + keys->TurboRight.name = STRW(ID_LABEL_HK41); keys->TurboRight.page = HOTKEY_PAGE_TURBO; keys->TurboRight.key = NULL; keys->TurboLeft.handleKeyDown = HK_TurboLeftKeyDown; keys->TurboLeft.handleKeyUp = HK_TurboLeftKeyUp; keys->TurboLeft.code = "TurboLeft"; - keys->TurboLeft.name = L"Turbo Left"; + keys->TurboLeft.name = STRW(ID_LABEL_HK42); keys->TurboLeft.page = HOTKEY_PAGE_TURBO; keys->TurboLeft.key = NULL; keys->TurboR.handleKeyDown = HK_TurboRKeyDown; keys->TurboR.handleKeyUp = HK_TurboRKeyUp; keys->TurboR.code = "TurboR"; - keys->TurboR.name = L"Turbo R"; + keys->TurboR.name = STRW(ID_LABEL_HK51); keys->TurboR.page = HOTKEY_PAGE_TURBO; keys->TurboR.key = NULL; keys->TurboL.handleKeyDown = HK_TurboLKeyDown; keys->TurboL.handleKeyUp = HK_TurboLKeyUp; keys->TurboL.code = "TurboL"; - keys->TurboL.name = L"Turbo L"; + keys->TurboL.name = STRW(ID_LABEL_HK52); keys->TurboL.page = HOTKEY_PAGE_TURBO; keys->TurboL.key = NULL; keys->TurboDown.handleKeyDown = HK_TurboDownKeyDown; keys->TurboDown.handleKeyUp = HK_TurboDownKeyUp; keys->TurboDown.code = "TurboDown"; - keys->TurboDown.name = L"Turbo Down"; + keys->TurboDown.name = STRW(ID_LABEL_HK43); keys->TurboDown.page = HOTKEY_PAGE_TURBO; keys->TurboDown.key = NULL; keys->TurboUp.handleKeyDown = HK_TurboUpKeyDown; keys->TurboUp.handleKeyUp = HK_TurboUpKeyUp; keys->TurboUp.code = "TurboUp"; - keys->TurboUp.name = L"Turbo Up"; + keys->TurboUp.name = STRW(ID_LABEL_HK44); keys->TurboUp.page = HOTKEY_PAGE_TURBO; keys->TurboUp.key = NULL; keys->TurboB.handleKeyDown = HK_TurboBKeyDown; keys->TurboB.handleKeyUp = HK_TurboBKeyUp; keys->TurboB.code = "TurboB"; - keys->TurboB.name = L"Turbo B"; + keys->TurboB.name = STRW(ID_LABEL_HK47); keys->TurboB.page = HOTKEY_PAGE_TURBO; keys->TurboB.key = NULL; keys->TurboA.handleKeyDown = HK_TurboAKeyDown; keys->TurboA.handleKeyUp = HK_TurboAKeyUp; keys->TurboA.code = "TurboA"; - keys->TurboA.name = L"Turbo A"; + keys->TurboA.name = STRW(ID_LABEL_HK48); keys->TurboA.page = HOTKEY_PAGE_TURBO; keys->TurboA.key = NULL; keys->TurboX.handleKeyDown = HK_TurboXKeyDown; keys->TurboX.handleKeyUp = HK_TurboXKeyUp; keys->TurboX.code = "TurboX"; - keys->TurboX.name = L"Turbo X"; + keys->TurboX.name = STRW(ID_LABEL_HK50); keys->TurboX.page = HOTKEY_PAGE_TURBO; keys->TurboX.key = NULL; keys->TurboY.handleKeyDown = HK_TurboYKeyDown; keys->TurboY.handleKeyUp = HK_TurboYKeyUp; keys->TurboY.code = "TurboY"; - keys->TurboY.name = L"Turbo Y"; + keys->TurboY.name = STRW(ID_LABEL_HK49); keys->TurboY.page = HOTKEY_PAGE_TURBO; keys->TurboY.key = NULL; keys->TurboSelect.handleKeyDown = HK_TurboSelectKeyDown; keys->TurboSelect.handleKeyUp = HK_TurboSelectKeyUp; keys->TurboSelect.code = "TurboSelect"; - keys->TurboSelect.name = L"Turbo Select"; + keys->TurboSelect.name = STRW(ID_LABEL_HK45); keys->TurboSelect.page = HOTKEY_PAGE_TURBO; keys->TurboSelect.key = NULL; keys->TurboStart.handleKeyDown = HK_TurboStartKeyDown; keys->TurboStart.handleKeyUp = HK_TurboStartKeyUp; keys->TurboStart.code = "TurboStart"; - keys->TurboStart.name = L"Turbo Start"; + keys->TurboStart.name = STRW(ID_LABEL_HK46); keys->TurboStart.page = HOTKEY_PAGE_TURBO; keys->TurboStart.key = NULL; @@ -658,74 +652,74 @@ void InitCustomKeys (SCustomKeys *keys) keys->Rewind.handleKeyDown = HK_RewindKeyDown; keys->Rewind.handleKeyUp = HK_RewindKeyUp; keys->Rewind.code = "Rewind"; - keys->Rewind.name = L"Rewind"; + keys->Rewind.name = STRW(ID_LABEL_HK25); keys->Rewind.page = HOTKEY_PAGE_MOVIE; keys->Rewind.key = NULL; keys->NewLuaScript.handleKeyDown = HK_NewLuaScriptDown; keys->NewLuaScript.code = "NewLuaScript"; - keys->NewLuaScript.name = L"New Lua Window"; + keys->NewLuaScript.name = STRW(ID_LABEL_HK26); keys->NewLuaScript.page = HOTKEY_PAGE_MOVIE; keys->NewLuaScript.key = NULL; keys->CloseLuaScripts.handleKeyDown = HK_CloseLuaScriptsDown; keys->CloseLuaScripts.code = "CloseLuaScripts"; - keys->CloseLuaScripts.name = L"Close Lua Windows"; + keys->CloseLuaScripts.name = STRW(ID_LABEL_HK27); keys->CloseLuaScripts.page = HOTKEY_PAGE_MOVIE; keys->CloseLuaScripts.key = NULL; keys->MostRecentLuaScript.handleKeyDown = HK_MostRecentLuaScriptDown; keys->MostRecentLuaScript.code = "MostRecentLuaScript"; - keys->MostRecentLuaScript.name = L"Most Recent Lua Script"; + keys->MostRecentLuaScript.name = STRW(ID_LABEL_HK28); keys->MostRecentLuaScript.page = HOTKEY_PAGE_MOVIE; keys->MostRecentLuaScript.key = NULL; keys->LCDsMode.handleKeyUp = HK_LCDsMode; keys->LCDsMode.code = "LCDsLayoutMode"; - keys->LCDsMode.name = L"LCDs layout mode"; + keys->LCDsMode.name = STRW(ID_LABEL_HK30); keys->LCDsMode.page = HOTKEY_PAGE_MOVIE; keys->LCDsMode.key = VK_END; keys->LCDsSwap.handleKeyUp = HK_LCDsSwap; keys->LCDsSwap.code = "LCDsSwap"; - keys->LCDsSwap.name = L"LCDs swap"; + keys->LCDsSwap.name = STRW(ID_LABEL_HK31); keys->LCDsSwap.page = HOTKEY_PAGE_MOVIE; keys->LCDsSwap.key = VK_NEXT; keys->IncreaseVolume.handleKeyDown = HK_IncreaseVolume; keys->IncreaseVolume.code = "IncreaseVolume"; - keys->IncreaseVolume.name = L"Increase Volume"; + keys->IncreaseVolume.name = STRW(ID_LABEL_HK32); keys->IncreaseVolume.page = HOTKEY_PAGE_MOVIE; keys->IncreaseVolume.key = NULL; keys->DecreaseVolume.handleKeyDown = HK_DecreaseVolume; keys->DecreaseVolume.code = "DecreaseVolume"; - keys->DecreaseVolume.name = L"Decrease Volume"; + keys->DecreaseVolume.name = STRW(ID_LABEL_HK33); keys->DecreaseVolume.page = HOTKEY_PAGE_MOVIE; keys->DecreaseVolume.key = NULL; //StateSlots Page -------------------------------------------------- keys->NextSaveSlot.handleKeyDown = HK_NextSaveSlot; keys->NextSaveSlot.code = "NextSaveSlot"; - keys->NextSaveSlot.name = L"Next Save Slot"; + keys->NextSaveSlot.name = STRW(ID_LABEL_HK39); keys->NextSaveSlot.page = HOTKEY_PAGE_STATE_SLOTS; keys->NextSaveSlot.key = NULL; keys->PreviousSaveSlot.handleKeyDown = HK_PreviousSaveSlot; keys->PreviousSaveSlot.code = "PreviousSaveSlot"; - keys->PreviousSaveSlot.name = L"Previous Save Slot"; + keys->PreviousSaveSlot.name = STRW(ID_LABEL_HK40); keys->PreviousSaveSlot.page = HOTKEY_PAGE_STATE_SLOTS; keys->PreviousSaveSlot.key = NULL; keys->QuickSave.handleKeyDown = HK_StateQuickSaveSlot; keys->QuickSave.code = "QuickSave"; - keys->QuickSave.name = L"Quick Save"; + keys->QuickSave.name = STRW(ID_LABEL_HK37); keys->QuickSave.page = HOTKEY_PAGE_STATE_SLOTS; keys->QuickSave.key = 'I'; keys->QuickLoad.handleKeyDown = HK_StateQuickLoadSlot; keys->QuickLoad.code = "QuickLoad"; - keys->QuickLoad.name = L"Quick Load"; + keys->QuickLoad.name = STRW(ID_LABEL_HK38); keys->QuickLoad.page = HOTKEY_PAGE_STATE_SLOTS; keys->QuickLoad.key = 'P'; @@ -743,7 +737,11 @@ void InitCustomKeys (SCustomKeys *keys) save.page = HOTKEY_PAGE_STATE; wchar_t tmp[16]; _itow(i,tmp,10); - save.name = (std::wstring)L"Save To Slot " + (std::wstring)tmp; + // Support Unicode display + wchar_t menuItemString[256]; + LoadStringW(hAppInst, ID_LABEL_HK34, menuItemString, 256); + wcscat(menuItemString,(LPWSTR)tmp); + save.name = menuItemString; save.code = saveNames[i]; save.key = key; save.modifiers = CUSTKEY_SHIFT_MASK; @@ -753,7 +751,10 @@ void InitCustomKeys (SCustomKeys *keys) load.param = i; load.page = HOTKEY_PAGE_STATE; _itow(i,tmp,10); - load.name = (std::wstring)L"Load from Slot " + (std::wstring)tmp; + // Support Unicode display + LoadStringW(hAppInst, ID_LABEL_HK35, menuItemString, 256); + wcscat(menuItemString,(LPWSTR)tmp); + load.name = menuItemString; load.code = loadNames[i]; load.key = key; @@ -764,7 +765,10 @@ void InitCustomKeys (SCustomKeys *keys) slot.param = i; slot.page = HOTKEY_PAGE_STATE_SLOTS; _itow(i,tmp,10); - slot.name = (std::wstring)L"Select Save Slot " + (std::wstring)tmp; + // Support Unicode display + LoadStringW(hAppInst, ID_LABEL_HK36, menuItemString, 256); + wcscat(menuItemString,(LPWSTR)tmp); + slot.name = menuItemString; slot.code = slotNames[i]; slot.key = key; } diff --git a/desmume/src/windows/inputdx.cpp b/desmume/src/windows/inputdx.cpp index 8c54b422e..2fc2f1010 100644 --- a/desmume/src/windows/inputdx.cpp +++ b/desmume/src/windows/inputdx.cpp @@ -365,7 +365,7 @@ static void ReadGuitarControl(const char* name, WORD& output) } } -static void LoadHotkeyConfig() +void LoadHotkeyConfig() { SCustomKey *key = &CustomKeys.key(0); diff --git a/desmume/src/windows/inputdx.h b/desmume/src/windows/inputdx.h index fb1e33f54..004eae59d 100644 --- a/desmume/src/windows/inputdx.h +++ b/desmume/src/windows/inputdx.h @@ -118,6 +118,7 @@ void RunInputConfig(); void RunHotkeyConfig(); void input_acquire(); void input_process(); +void LoadHotkeyConfig(); struct SGuitar { BOOL Enabled; diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index e96adc3cb..be9e6b514 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -260,17 +260,6 @@ struct DDRAW #define TABLET_DISABLE_FLICKFALLBACKKEYS 0x00100000 #endif -void DesEnableMenuItem(HMENU hMenu, UINT uIDEnableItem, bool enable); -inline bool IsDlgCheckboxChecked(HWND hDlg, int id) -{ - return IsDlgButtonChecked(hDlg,id) == BST_CHECKED; -} - -void CheckDlgItem(HWND hDlg, int id, bool checked) -{ - CheckDlgButton(hDlg, id, checked ? BST_CHECKED : BST_UNCHECKED); -} - LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); char SavName[MAX_PATH] = ""; @@ -290,6 +279,7 @@ RECT FullScreenRect, MainScreenRect, SubScreenRect, GapRect; RECT MainScreenSrcRect, SubScreenSrcRect; int WndX = 0; int WndY = 0; +int currLanguage = LANGUAGE_ENGLISH; extern HWND RamSearchHWnd; static bool lostFocusPause = true; @@ -2030,31 +2020,27 @@ void SetLanguage(int langid) HMODULE kernel32 = LoadLibrary("kernel32.dll"); FARPROC _setThreadUILanguage = (FARPROC)GetProcAddress(kernel32,"SetThreadUILanguage"); setLanguageFunc setLanguage = _setThreadUILanguage?(setLanguageFunc)_setThreadUILanguage:(setLanguageFunc)SetThreadLocale; + currLanguage = langid; switch(langid) { - case 0: - // English + case LANGUAGE_ENGLISH: setLanguage(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)); SetThreadLocale(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)); break; - case 1: - // French + case LANGUAGE_FRENCH: setLanguage(MAKELCID(MAKELANGID(LANG_FRENCH, SUBLANG_FRENCH), SORT_DEFAULT)); SetThreadLocale(MAKELCID(MAKELANGID(LANG_FRENCH, SUBLANG_FRENCH), SORT_DEFAULT)); break; - case 3: - // Chinese + case LANGUAGE_CHINESE: setLanguage(MAKELCID(MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED), SORT_DEFAULT)); SetThreadLocale(MAKELCID(MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED), SORT_DEFAULT)); break; - case 4: - // Italian + case LANGUAGE_ITALIAN: setLanguage(MAKELCID(MAKELANGID(LANG_ITALIAN, SUBLANG_ITALIAN), SORT_DEFAULT)); SetThreadLocale(MAKELCID(MAKELANGID(LANG_ITALIAN, SUBLANG_ITALIAN), SORT_DEFAULT)); break; - case 5: - // Japanese + case LANGUAGE_JAPANESE: setLanguage(MAKELCID(MAKELANGID(LANG_JAPANESE, SUBLANG_DEFAULT), SORT_DEFAULT)); SetThreadLocale(MAKELCID(MAKELANGID(LANG_JAPANESE, SUBLANG_DEFAULT), SORT_DEFAULT)); break; @@ -2064,23 +2050,19 @@ void SetLanguage(int langid) } FreeLibrary(kernel32); + + WritePrivateProfileInt("General", "Language", langid, IniName); + InitCustomKeys(&CustomKeys); + LoadHotkeyConfig(); } -void SaveLanguage(int langid) +static void CheckLanguage(UINT id) { - char text[80]; + //int i; + //for (i = IDC_LANGENGLISH; i < IDC_LANGJAPANESE+1; i++) + // MainWindow->checkMenu(i, false); - sprintf(text, "%d", langid); - WritePrivateProfileString("General", "Language", text, IniName); -} - -void CheckLanguage(UINT id) -{ - int i; - for (i = IDC_LANGENGLISH; i < IDC_LANGJAPANESE+1; i++) - MainWindow->checkMenu(i, false); - - MainWindow->checkMenu(id, true); + //MainWindow->checkMenu(id, true); } void ChangeLanguage(int id) @@ -5060,29 +5042,19 @@ DOKEYDOWN: SendMessage(LuaScriptHWnds[i], WM_CLOSE, 0,0); break; case IDC_LANGENGLISH: - SaveLanguage(0); - ChangeLanguage(0); - CheckLanguage(LOWORD(wParam)); + ChangeLanguage(LANGUAGE_ENGLISH); return 0; case IDC_LANGFRENCH: - SaveLanguage(1); - ChangeLanguage(1); - CheckLanguage(LOWORD(wParam)); + ChangeLanguage(LANGUAGE_FRENCH); return 0; case IDC_LANG_CHINESE_SIMPLIFIED: - SaveLanguage(3); - ChangeLanguage(3); - CheckLanguage(LOWORD(wParam)); + ChangeLanguage(LANGUAGE_CHINESE); return 0; case IDC_LANGITALIAN: - SaveLanguage(4); - ChangeLanguage(4); - CheckLanguage(LOWORD(wParam)); + ChangeLanguage(LANGUAGE_ITALIAN); return 0; case IDC_LANGJAPANESE: - SaveLanguage(5); - ChangeLanguage(5); - CheckLanguage(LOWORD(wParam)); + ChangeLanguage(LANGUAGE_JAPANESE); return 0; case IDC_FRAMELIMIT: diff --git a/desmume/src/windows/main.h b/desmume/src/windows/main.h index 304afcd99..69b69e20f 100644 --- a/desmume/src/windows/main.h +++ b/desmume/src/windows/main.h @@ -30,6 +30,12 @@ extern bool ShowLagFrameCounter; #define GPU3D_OPENGL 1 #define GPU3D_SWRAST 2 +static const int LANGUAGE_ENGLISH = 0; +static const int LANGUAGE_FRENCH = 1; +static const int LANGUAGE_CHINESE = 3; +static const int LANGUAGE_ITALIAN = 4; +static const int LANGUAGE_JAPANESE = 5; + extern void Change3DCoreWithFallbackAndSave(int newCore, int fallbackCore=GPU3D_SWRAST); extern int backupmemorytype; diff --git a/desmume/src/windows/resource.h b/desmume/src/windows/resource.h index 262430add..d9801b68d 100644 --- a/desmume/src/windows/resource.h +++ b/desmume/src/windows/resource.h @@ -807,6 +807,59 @@ #define IDM_RENDER_HQ2XS 60081 #define IDM_RENDER_LQ2X 60082 #define IDM_RENDER_LQ2XS 60083 +#define ID_LABEL_HK1 70001 +#define ID_LABEL_HK2 70002 +#define ID_LABEL_HK3 70003 +#define ID_LABEL_HK4 70004 +#define ID_LABEL_HK5 70005 +#define ID_LABEL_HK6 70006 +#define ID_LABEL_HK7 70007 +#define ID_LABEL_HK8 70008 +#define ID_LABEL_HK9 70009 +#define ID_LABEL_HK10 70010 +#define ID_LABEL_HK11 70011 +#define ID_LABEL_HK12 70012 +#define ID_LABEL_HK13 70013 +#define ID_LABEL_HK14 70014 +#define ID_LABEL_HK15 70015 +#define ID_LABEL_HK16 70016 +#define ID_LABEL_HK17 70017 +#define ID_LABEL_HK18 70018 +#define ID_LABEL_HK19 70019 +#define ID_LABEL_HK20 70020 +#define ID_LABEL_HK21 70021 +#define ID_LABEL_HK22 70022 +#define ID_LABEL_HK23 70023 +#define ID_LABEL_HK24 70024 +#define ID_LABEL_HK25 70025 +#define ID_LABEL_HK26 70026 +#define ID_LABEL_HK27 70027 +#define ID_LABEL_HK28 70028 +#define ID_LABEL_HK29 70029 +#define ID_LABEL_HK30 70030 +#define ID_LABEL_HK31 70031 +#define ID_LABEL_HK32 70032 +#define ID_LABEL_HK33 70033 +#define ID_LABEL_HK34 70034 +#define ID_LABEL_HK35 70035 +#define ID_LABEL_HK36 70036 +#define ID_LABEL_HK37 70037 +#define ID_LABEL_HK38 70038 +#define ID_LABEL_HK39 70039 +#define ID_LABEL_HK40 70040 +#define ID_LABEL_HK41 70041 +#define ID_LABEL_HK42 70042 +#define ID_LABEL_HK43 70043 +#define ID_LABEL_HK44 70044 +#define ID_LABEL_HK45 70045 +#define ID_LABEL_HK46 70046 +#define ID_LABEL_HK47 70047 +#define ID_LABEL_HK48 70048 +#define ID_LABEL_HK49 70049 +#define ID_LABEL_HK50 70050 +#define ID_LABEL_HK51 70051 +#define ID_LABEL_HK52 70052 + // Next default values for new objects // diff --git a/desmume/src/windows/resources.rc b/desmume/src/windows/resources.rc index aa16ce9b45d5b4d97b0d5b50a32cd4416e8d4357..04ce66c5b3f55ab6af666216bed9f68901841d7a 100644 GIT binary patch delta 13831 zcmeHOTWnNS6g@o3bUM^hhH=z}%+#h3P%L=+kP^^hX&}x_r!xgxsGYRa>3~3=6s#}A zS7Z2SNrj6fA|y%(iG~l7>X(l{C4eTxkQnrjM2P;HMsCBgr)gnfK+YfC)(IooBL3|nzNqm;1YU(UfJ0w2)3D93Yy>D8oh*(UPD|NG)}CT=&A=vM-yGyT z>rFYm?W)V~&PRdbwQ8;T815Q_3kDHqiu*pR5qkN_g?`P9nH?My&l)o(&oRFpKU?be zn{wPY!Rf$*J`cl^N$z~i^*=vyRh5xz7(^fbV4>fY)u(&B#mkEf_UT_YxXr&GUYh$m zseGD;&0+w;ZPKL~%pOGm_8}bOd`!}@fd@|35k=sFVm5jIMh6!la|SRbd43iRdikp^ z|9U4CAsC#VUA)ol_nPAQgwwyg;;Pt2lyFY?LFCXLgPkid22GvFF^c!LCBR5*_qrUX z^wPH$=fXoN?|(A)1l}bZl2C;-)5~K;-fS2N=gm_9xVXW|AsN%alinH+(%b{~2C?o8 zz*I{t4HK()?i2iwv8Y+{Ju{a)bM&T9Twee4S==BbI4Q~M^_(G;3WM3C4k5Zdu!aj; zIZfhKJj26=Fi|4oCR#}GNv~Y7sDe4Ffn~ShsBsKSYb33Gvm`SJ?e%CPpZxkSV<^O;Wyh-`Isj1F~zh)Nc3i7kWpiy9OAAZ)eV~9k+v^$J1`CzO3O5JBgr1t1dqOb zsk6&EQ8x~+AH)c>u=n6a?+TDsBru~Uu~}@v@5J=vy&_E$oLxCRL4%33NKJ4SUU*IL={>COD7V5T!kk z-fP&N@uxIvNO0V6oJ%yrwnNBwX^d617E*GF?btvh zG-@JFMULi_kfbnoP9CciCDDj|CM#<#gyAxqWvhVYRN>gB0$5HGj_tHz>r7hU8OL@M z!1Be6V`DP5qRu(46T=tg@eOhKt zo2FE-F0JMczS-KbtF>!;_nky~xG}=C8Rh9bxBf#*QEsEA!jze@Jy9Q{?Rf_(KPHH! z$5+MuONLOKHuX1-OSo$8W5N-p1?5;=(#Xdp-1KCsP10vnmdw1Ix}OIgXlKJxHRMm4 zZlcF$j}E1F?~?cG}l zRK;`ScHEu*i%*ZTs!`Y~WQq zV?>&3e&opGX<2s_Po7)vEqf)$eFmhx4xHvmM2ue0{Y+Qoi)Gx~gv2*-9+QtFy-7k# z`hem=`968$)Ls4BF$uNHTH=LIL|RRh6Nz&B{67?PWGl*59#G2FwMaR~l4rkW*(=Y) zUYoR|=WdrNTd+_g3sEw0qPVAi?IkNsNn2?N&vL%pNd%@yLh>w7oG65%*+?k(hx5Y| zSsgha<)cgZPF8ebfeFV7p`HB0_gCBZMT1$^dh2fdixh1dk`0yC3hUMjPAH!5o`@5Q z^P{9N3X1~Y4k<>TyQ5&ek73g+I3C4LN1U}b>X-$`Gd$*m zd&pW7h4MH(x}^AtiN38xcrBXg+v@uKvg#$GVphFGd;^tQE2@{6t+eUOirFlt_Ot3G z!ZkQf$n@XxOOom(qLE;hh^m*EJ2J8N19PWQs+X8Kv$L1ZW}#WIM5T_X>LpT(H&cb) zcWtYBiENuQ`>u4Pqk4&^KSDZsi8T}T%Zl-G&(tp~Dfvo2v!&>U{(5<_I*T{BVksc$ zd!ssw&*zr?tWTZAKZGre%Y>W zwA|G-*6cqssB5fL-_Uhmb&WOS0hTJ%fl}94y}05>J11BYRSb^rhX delta 90 zcmbPr()`^PvxXMNElh2zra#c;kZOOilL?5Kx4+oQvS9A?XUmvW+8-pd0x{e62g&R^ rPPad>;{amL?GNm@R1Qo(mdq;EZpY6J#5~*W_<3I)+FtOGSBn_{t`#UZ diff --git a/desmume/src/windows/winutil.cpp b/desmume/src/windows/winutil.cpp index b27980968..ec96e01ae 100644 --- a/desmume/src/windows/winutil.cpp +++ b/desmume/src/windows/winutil.cpp @@ -95,4 +95,23 @@ std::string GetPrivateProfileStdString(LPCSTR lpAppName,LPCSTR lpKeyName,LPCSTR static char buf[65536]; GetPrivateProfileString(lpAppName, lpKeyName, lpDefault, buf, 65536, IniName); return buf; -} \ No newline at end of file +} + +std::wstring STRW(UINT id) +{ + wchar_t* wstr; + LoadStringW(NULL,id,(LPWSTR)&wstr,0); + if(wstr==0) return L""; + else return wstr; +} + +bool IsDlgCheckboxChecked(HWND hDlg, int id) +{ + return IsDlgButtonChecked(hDlg,id) == BST_CHECKED; +} + +void CheckDlgItem(HWND hDlg, int id, bool checked) +{ + CheckDlgButton(hDlg, id, checked ? BST_CHECKED : BST_UNCHECKED); +} + diff --git a/desmume/src/windows/winutil.h b/desmume/src/windows/winutil.h index 6a3f3c5e9..73c43c694 100644 --- a/desmume/src/windows/winutil.h +++ b/desmume/src/windows/winutil.h @@ -33,6 +33,11 @@ void GetINIPath(); void PreventScreensaver(); void DesEnableMenuItem(HMENU hMenu, UINT uIDEnableItem, bool enable); std::string GetPrivateProfileStdString(LPCSTR lpAppName,LPCSTR lpKeyName,LPCSTR lpDefault); +void CheckDlgItem(HWND hDlg, int id, bool checked); +bool IsDlgCheckboxChecked(HWND hDlg, int id); + +//returns the specified resource string ID as a std::wstring +std::wstring STRW(UINT id); inline bool operator==(const RECT& lhs, const RECT& rhs) {