Added class to format wide strings
This commit is contained in:
parent
68ad452a07
commit
4b43afe275
|
@ -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<stdstr> strlist;
|
typedef std::list<stdstr> strlist;
|
||||||
typedef strlist::iterator strlist_iter;
|
typedef strlist::iterator strlist_iter;
|
||||||
|
|
|
@ -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_PI: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_PI); break;
|
||||||
case ID_DEBUGGER_INTERRUPT_DP: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_DP); break;
|
case ID_DEBUGGER_INTERRUPT_DP: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_DP); break;
|
||||||
case ID_CURRENT_SAVE_DEFAULT:
|
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));
|
g_Settings->SaveDword(Game_CurrentSaveState, (DWORD)(MenuID - ID_CURRENT_SAVE_DEFAULT));
|
||||||
break;
|
break;
|
||||||
case ID_CURRENT_SAVE_1:
|
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_8:
|
||||||
case ID_CURRENT_SAVE_9:
|
case ID_CURRENT_SAVE_9:
|
||||||
case ID_CURRENT_SAVE_10:
|
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));
|
g_Settings->SaveDword(Game_CurrentSaveState, (DWORD)((MenuID - ID_CURRENT_SAVE_1) + 1));
|
||||||
break;
|
break;
|
||||||
case ID_HELP_SUPPORTFORUM: ShellExecute(NULL, "open", "http://forum.pj64-emu.com/", NULL, NULL, SW_SHOWMAXIMIZED); break;
|
case ID_HELP_SUPPORTFORUM: ShellExecute(NULL, "open", "http://forum.pj64-emu.com/", NULL, NULL, SW_SHOWMAXIMIZED); break;
|
||||||
|
|
|
@ -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
|
void CNotification::DisplayMessage2(const wchar_t * Message) const
|
||||||
{
|
{
|
||||||
if (!m_hWnd) { return; }
|
if (!m_hWnd) { return; }
|
||||||
|
|
|
@ -35,7 +35,6 @@ public:
|
||||||
//User Feedback
|
//User Feedback
|
||||||
virtual void DisplayMessage(int DisplayTime, const wchar_t * Message) const;
|
virtual void DisplayMessage(int DisplayTime, const wchar_t * Message) const;
|
||||||
virtual void DisplayMessage(int DisplayTime, LanguageStringID StringID) 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 DisplayMessage2(const wchar_t * Message) const;
|
||||||
virtual void BreakPoint(const wchar_t * FileName, const int LineNumber);
|
virtual void BreakPoint(const wchar_t * FileName, const int LineNumber);
|
||||||
|
|
Loading…
Reference in New Issue