mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 21:39:52 +00:00
Win32: Enable user to change emulated PSP nickname from the menu screens by popping a dialog box.
Win32: Enable user to bypass the in-game OSK by using the same dialog box. It doesn't support non-Roman characters yet.
This commit is contained in:
parent
73d7f491ca
commit
80953ac56d
@ -161,6 +161,9 @@ void Config::Load(const char *iniFileName)
|
||||
pspConfig->Get("ButtonPreference", &iButtonPreference, PSP_SYSTEMPARAM_BUTTON_CROSS);
|
||||
pspConfig->Get("LockParentalLevel", &iLockParentalLevel, 0);
|
||||
pspConfig->Get("WlanAdhocChannel", &iWlanAdhocChannel, PSP_SYSTEMPARAM_ADHOC_CHANNEL_AUTOMATIC);
|
||||
#ifdef _WIN32
|
||||
pspConfig->Get("BypassOSKWithKeyboard", &bBypassOSKWithKeyboard, false);
|
||||
#endif
|
||||
pspConfig->Get("WlanPowerSave", &bWlanPowerSave, PSP_SYSTEMPARAM_WLAN_POWERSAVE_OFF);
|
||||
pspConfig->Get("EncryptSave", &bEncryptSave, true);
|
||||
|
||||
@ -281,6 +284,9 @@ void Config::Save()
|
||||
pspConfig->Set("WlanAdhocChannel", iWlanAdhocChannel);
|
||||
pspConfig->Set("WlanPowerSave", bWlanPowerSave);
|
||||
pspConfig->Set("EncryptSave", bEncryptSave);
|
||||
#ifdef _WIN32
|
||||
pspConfig->Set("BypassOSKWithKeyboard", bBypassOSKWithKeyboard);
|
||||
#endif
|
||||
|
||||
IniFile::Section *debugConfig = iniFile.GetOrCreateSection("Debugger");
|
||||
debugConfig->Set("DisasmWindowX", iDisasmWindowX);
|
||||
|
@ -139,6 +139,10 @@ public:
|
||||
bool bEncryptSave;
|
||||
int iWlanAdhocChannel;
|
||||
bool bWlanPowerSave;
|
||||
// TODO: Make this work with your platform, too!
|
||||
#ifdef _WIN32
|
||||
bool bBypassOSKWithKeyboard;
|
||||
#endif
|
||||
|
||||
// Debugger
|
||||
int iDisasmWindowX;
|
||||
|
@ -32,6 +32,14 @@
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "../Windows/InputBox.h"
|
||||
namespace MainWindow {
|
||||
extern HWND hwndMain;
|
||||
HINSTANCE GetHinstance();
|
||||
};
|
||||
#endif
|
||||
|
||||
const int numKeyCols[OSK_KEYBOARD_COUNT] = {12, 12, 13, 13, 12, 12, 12};
|
||||
const int numKeyRows[OSK_KEYBOARD_COUNT] = {4, 4, 5, 5, 5, 4, 4};
|
||||
|
||||
@ -732,12 +740,69 @@ void PSPOskDialog::RenderKeyboard()
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Why does this have a 2 button press lag/delay when
|
||||
// re-opening the dialog box? I don't get it.
|
||||
// TODO: Stop crashes when the user enters > 255 characters on _WIN32.
|
||||
// TODO: Use a wstring to allow Japanese/Russian/etc.. on _WIN32(others?)
|
||||
int PSPOskDialog::NativeKeyboard()
|
||||
{
|
||||
char *input = new char[FieldMaxLength()];
|
||||
memset(input, 0, sizeof(input));
|
||||
|
||||
if (status == SCE_UTILITY_STATUS_INITIALIZE)
|
||||
{
|
||||
status = SCE_UTILITY_STATUS_RUNNING;
|
||||
}
|
||||
|
||||
else if (status == SCE_UTILITY_STATUS_RUNNING)
|
||||
{
|
||||
|
||||
#ifdef _WIN32
|
||||
if(!InputBox_GetString(0, MainWindow::hwndMain, NULL, "VALUE", input))
|
||||
sprintf(input, "");
|
||||
#endif
|
||||
// TODO: Insert your platform's native keyboard stuff here...
|
||||
|
||||
status = SCE_UTILITY_STATUS_FINISHED;
|
||||
}
|
||||
else if (status == SCE_UTILITY_STATUS_FINISHED)
|
||||
{
|
||||
status = SCE_UTILITY_STATUS_SHUTDOWN;
|
||||
}
|
||||
|
||||
u16_le *outText = oskParams->fields[0].outtext;
|
||||
for (u32 i = 0, end = oskParams->fields[0].outtextlength; i < end; ++i)
|
||||
{
|
||||
u16 value = 0;
|
||||
if (i < ARRAY_SIZE(input))
|
||||
value = input[i];
|
||||
outText[i] = value;
|
||||
}
|
||||
|
||||
oskParams->base.result = 0;
|
||||
oskParams->fields[0].result = PSP_UTILITY_OSK_RESULT_CHANGED;
|
||||
|
||||
delete [] input;
|
||||
input = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int PSPOskDialog::Update()
|
||||
{
|
||||
buttons = __CtrlReadLatch();
|
||||
int selectedRow = selectedChar / numKeyCols[currentKeyboard];
|
||||
int selectedExtra = selectedChar % numKeyCols[currentKeyboard];
|
||||
|
||||
// TODO: Add your platforms here when you have a NativeKeyboard func.
|
||||
|
||||
#ifdef _WIN32
|
||||
// Fall back to the OSK/continue normally if we're in fullscreen. The dialog box
|
||||
// doesn't work right if in fullscreen.
|
||||
if(g_Config.bBypassOSKWithKeyboard && !g_Config.bFullScreen)
|
||||
return NativeKeyboard();
|
||||
#endif
|
||||
|
||||
u32 limit = FieldMaxLength();
|
||||
|
||||
if (status == SCE_UTILITY_STATUS_INITIALIZE)
|
||||
|
@ -178,6 +178,7 @@ private:
|
||||
void ConvertUCS2ToUTF8(std::string& _string, const PSPPointer<u16_le> em_address);
|
||||
void ConvertUCS2ToUTF8(std::string& _string, const wchar_t *input);
|
||||
void RenderKeyboard();
|
||||
int NativeKeyboard();
|
||||
|
||||
std::wstring CombinationString(bool isInput); // for Japanese, Korean
|
||||
std::wstring CombinationKorean(bool isInput); // for Korea
|
||||
|
@ -46,6 +46,10 @@
|
||||
#include "Core/System.h"
|
||||
#include "Core/CoreParameter.h"
|
||||
#include "Core/HW/atrac3plus.h"
|
||||
#include "Core/Dialog/PSPOskDialog.h"
|
||||
#ifdef _WIN32
|
||||
#include "Windows/InputBox.h"
|
||||
#endif
|
||||
#include "GPU/ge_constants.h"
|
||||
#include "GPU/GPUState.h"
|
||||
#include "GPU/GPUInterface.h"
|
||||
@ -79,6 +83,7 @@ namespace MainWindow {
|
||||
};
|
||||
extern HWND hwndMain;
|
||||
void BrowseAndBoot(std::string defaultPath, bool browseDirectory = false);
|
||||
HINSTANCE GetHInstance();
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1531,6 +1536,23 @@ void SystemScreen::render() {
|
||||
}
|
||||
y += 20;
|
||||
|
||||
// TODO: Come up with a way to display a keyboard for mobile users,
|
||||
// so until then, this is Windows/Desktop only.
|
||||
#ifdef _WIN32
|
||||
char nickname[512];
|
||||
sprintf(nickname, "%s %s", s->T("System Nickname: "), g_Config.sNickName);
|
||||
ui_draw2d.DrawTextShadow(UBUNTU24, nickname, x, y += stride, 0xFFFFFFFF, ALIGN_LEFT);
|
||||
|
||||
HLinear hlinearNick(x + 400, y, 10);
|
||||
if(UIButton(GEN_ID, hlinearNick, 110, 0, s->T("Change"), ALIGN_LEFT)) {
|
||||
char name[256];
|
||||
memset(&name, 0, sizeof(name));
|
||||
if(InputBox_GetString(MainWindow::GetHInstance(), MainWindow::hwndMain, NULL, "PPSSPP", name))
|
||||
g_Config.sNickName.assign(name);
|
||||
else
|
||||
g_Config.sNickName.assign("PPSSPP");
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
bool time = g_Config.iTimeFormat > 0 ;
|
||||
UICheckBox(GEN_ID, x, y += stride, s->T("Time Format"), ALIGN_TOPLEFT, &time);
|
||||
|
Loading…
Reference in New Issue
Block a user