mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Win32: Simplify Change Nickname code and slightly change InputBox_GetString to take a const default value. We don't modify it.
This commit is contained in:
parent
09dc4ac09b
commit
e97def9c66
6 changed files with 6 additions and 15 deletions
|
@ -67,7 +67,7 @@ public:
|
|||
|
||||
#ifdef _WIN32
|
||||
// Implement this on your platform to grab text input from the user for whatever purpose.
|
||||
virtual bool InputBoxGetString(char *title, char *defaultValue, char *outValue, size_t outlength) { return false; }
|
||||
virtual bool InputBoxGetString(char *title, const char *defaultValue, char *outValue, size_t outlength) { return false; }
|
||||
#endif
|
||||
|
||||
// Used for headless.
|
||||
|
|
|
@ -477,19 +477,10 @@ UI::EventReturn GameSettingsScreen::OnChangeNickname(UI::EventParams &e) {
|
|||
char name[name_len];
|
||||
memset(name, 0, sizeof(name));
|
||||
|
||||
size_t default_len = strlen(g_Config.sNickName.c_str());
|
||||
|
||||
char *defaultVal = new char[default_len];
|
||||
memset(defaultVal, 0, sizeof(default_len));
|
||||
strcat(defaultVal, g_Config.sNickName.c_str());
|
||||
|
||||
if (host->InputBoxGetString("Enter a new PSP nickname", defaultVal, name, name_len)) {
|
||||
if (host->InputBoxGetString("Enter a new PSP nickname", g_Config.sNickName.c_str(), name, name_len)) {
|
||||
g_Config.sNickName = name;
|
||||
}
|
||||
|
||||
delete [] defaultVal;
|
||||
defaultVal = NULL;
|
||||
|
||||
#endif
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ bool InputBox_GetString(HINSTANCE hInst, HWND hParent, TCHAR *title, TCHAR *defa
|
|||
return false;
|
||||
}
|
||||
|
||||
bool InputBox_GetString(HINSTANCE hInst, HWND hParent, TCHAR *title, TCHAR *defaultvalue, TCHAR *outvalue, size_t outlength)
|
||||
bool InputBox_GetString(HINSTANCE hInst, HWND hParent, TCHAR *title, const TCHAR *defaultvalue, TCHAR *outvalue, size_t outlength)
|
||||
{
|
||||
const char *defaultTitle = "Input value";
|
||||
defaultSelected = true;
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
|
||||
#include "Common/CommonWindows.h"
|
||||
bool InputBox_GetString(HINSTANCE hInst, HWND hParent, TCHAR *title, TCHAR *defaultvalue, TCHAR *outvalue, bool selected = true);
|
||||
bool InputBox_GetString(HINSTANCE hInst, HWND hParent, TCHAR *title, TCHAR *defaultvalue, TCHAR *outvalue, size_t outlength);
|
||||
bool InputBox_GetString(HINSTANCE hInst, HWND hParent, TCHAR *title, const TCHAR *defaultvalue, TCHAR *outvalue, size_t outlength);
|
||||
bool InputBox_GetHex(HINSTANCE hInst, HWND hParent, TCHAR *title, u32 defaultvalue, u32 &outvalue);
|
||||
|
|
|
@ -287,7 +287,7 @@ void WindowsHost::UpdateConsolePosition()
|
|||
}
|
||||
}
|
||||
|
||||
bool WindowsHost::InputBoxGetString(char *title, char *defaultValue, char *outValue, size_t outLength)
|
||||
bool WindowsHost::InputBoxGetString(char *title, const char *defaultValue, char *outValue, size_t outLength)
|
||||
{
|
||||
return InputBox_GetString(MainWindow::GetHInstance(), MainWindow::GetHWND(), title, defaultValue, outValue, outLength);
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
void SaveSymbolMap();
|
||||
void SetWindowTitle(const char *message);
|
||||
|
||||
bool InputBoxGetString(char *title, char *defaultValue, char *outValue, size_t outlength);
|
||||
bool InputBoxGetString(char *title, const char *defaultValue, char *outValue, size_t outlength);
|
||||
|
||||
std::shared_ptr<KeyboardDevice> keyboard;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue