diff --git a/Source/Common/std string.h b/Source/Common/std string.h index 8b61aa99b..c7ebd007e 100644 --- a/Source/Common/std string.h +++ b/Source/Common/std string.h @@ -51,5 +51,22 @@ public: } }; +class stdwstr_f : public std::wstring +{ +public: + stdwstr_f(const wchar_t * strFormat, ...) + { + va_list args; + va_start(args, strFormat); + + wchar_t Msg[1000]; + _vsnwprintf(Msg, sizeof(Msg) - 1, strFormat, args); + + va_end(args); + + this->assign(Msg); + } +}; + typedef std::list strlist; typedef strlist::iterator strlist_iter; diff --git a/Source/Project64/User Interface/Main Menu Class.cpp b/Source/Project64/User Interface/Main Menu Class.cpp index 4cde81bac..a2eef6a62 100644 --- a/Source/Project64/User Interface/Main Menu Class.cpp +++ b/Source/Project64/User Interface/Main Menu Class.cpp @@ -519,7 +519,7 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI case ID_DEBUGGER_INTERRUPT_PI: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_PI); break; case ID_DEBUGGER_INTERRUPT_DP: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_DP); break; case ID_CURRENT_SAVE_DEFAULT: - g_Notify->DisplayMessageWide(3, GS(MENU_SLOT_SAVE), GetSaveSlotString(MenuID - ID_CURRENT_SAVE_DEFAULT).c_str()); + g_Notify->DisplayMessage(3, stdwstr_f(GS(MENU_SLOT_SAVE), GetSaveSlotString(MenuID - ID_CURRENT_SAVE_DEFAULT).c_str()).c_str()); g_Settings->SaveDword(Game_CurrentSaveState, (DWORD)(MenuID - ID_CURRENT_SAVE_DEFAULT)); break; case ID_CURRENT_SAVE_1: @@ -532,7 +532,7 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI case ID_CURRENT_SAVE_8: case ID_CURRENT_SAVE_9: case ID_CURRENT_SAVE_10: - g_Notify->DisplayMessageWide(3, GS(MENU_SLOT_SAVE), GetSaveSlotString((MenuID - ID_CURRENT_SAVE_1) + 1).c_str()); + g_Notify->DisplayMessage(3, stdwstr_f(GS(MENU_SLOT_SAVE), GetSaveSlotString((MenuID - ID_CURRENT_SAVE_1) + 1).c_str()).c_str()); g_Settings->SaveDword(Game_CurrentSaveState, (DWORD)((MenuID - ID_CURRENT_SAVE_1) + 1)); break; case ID_HELP_SUPPORTFORUM: ShellExecute(NULL, "open", "http://forum.pj64-emu.com/", NULL, NULL, SW_SHOWMAXIMIZED); break; diff --git a/Source/Project64/User Interface/Notification Class.cpp b/Source/Project64/User Interface/Notification Class.cpp index bfc28b558..097adf98f 100644 --- a/Source/Project64/User Interface/Notification Class.cpp +++ b/Source/Project64/User Interface/Notification Class.cpp @@ -113,18 +113,6 @@ void CNotification::DisplayMessage(int DisplayTime, const wchar_t * Message) con } } -void CNotification::DisplayMessageWide(int DisplayTime, const wchar_t * Message, ...) const -{ - wchar_t Msg[1000]; - - va_list ap; - va_start(ap, Message); - _vsnwprintf(Msg, sizeof(Msg) - 1, Message, ap); - va_end(ap); - - DisplayMessage(DisplayTime, Msg); -} - void CNotification::DisplayMessage2(const wchar_t * Message) const { if (!m_hWnd) { return; } diff --git a/Source/Project64/User Interface/Notification Class.h b/Source/Project64/User Interface/Notification Class.h index c853371bc..c8b76833b 100644 --- a/Source/Project64/User Interface/Notification Class.h +++ b/Source/Project64/User Interface/Notification Class.h @@ -35,7 +35,6 @@ public: //User Feedback virtual void DisplayMessage(int DisplayTime, const wchar_t * Message) const; virtual void DisplayMessage(int DisplayTime, LanguageStringID StringID) const; - virtual void DisplayMessageWide(int DisplayTime, const wchar_t * Message, ...) const; virtual void DisplayMessage2(const wchar_t * Message) const; virtual void BreakPoint(const wchar_t * FileName, const int LineNumber);