mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Fixes to default key mappings, add default button, fix saving of mapped controls on Android, fixes #3213
This commit is contained in:
parent
96572a3226
commit
47f2efb0e5
@ -18,6 +18,7 @@
|
||||
#include "file/ini_file.h"
|
||||
#include "input/input_state.h"
|
||||
#include "../Core/Config.h"
|
||||
#include "base/NativeApp.h"
|
||||
#include "KeyMap.h"
|
||||
|
||||
namespace KeyMap {
|
||||
@ -177,7 +178,7 @@ static const DefMappingStruct defaultXperiaPlay[] = {
|
||||
{CTRL_DOWN , NKCODE_DPAD_DOWN},
|
||||
{CTRL_LEFT , NKCODE_DPAD_LEFT},
|
||||
{CTRL_START , NKCODE_BUTTON_START},
|
||||
{CTRL_SELECT , NKCODE_BACK},
|
||||
{CTRL_SELECT , NKCODE_BUTTON_SELECT},
|
||||
{CTRL_LTRIGGER , NKCODE_BUTTON_L1},
|
||||
{CTRL_RTRIGGER , NKCODE_BUTTON_R1},
|
||||
{VIRTKEY_AXIS_X_MIN, JOYSTICK_AXIS_X, -1},
|
||||
@ -204,16 +205,16 @@ void SetDefaultKeyMap(DefaultMaps dmap, bool replace) {
|
||||
SetDefaultKeyMap(DEVICE_ID_X360_0, default360KeyMap, ARRAY_SIZE(default360KeyMap), replace);
|
||||
break;
|
||||
case DEFAULT_MAPPING_SHIELD:
|
||||
SetDefaultKeyMap(DEVICE_ID_X360_0, defaultShieldKeyMap, ARRAY_SIZE(defaultShieldKeyMap), replace);
|
||||
SetDefaultKeyMap(DEVICE_ID_PAD_0, defaultShieldKeyMap, ARRAY_SIZE(defaultShieldKeyMap), replace);
|
||||
break;
|
||||
case DEFAULT_MAPPING_PAD:
|
||||
SetDefaultKeyMap(DEVICE_ID_X360_0, defaultPadMap, ARRAY_SIZE(defaultPadMap), replace);
|
||||
SetDefaultKeyMap(DEVICE_ID_PAD_0, defaultPadMap, ARRAY_SIZE(defaultPadMap), replace);
|
||||
break;
|
||||
case DEFAULT_MAPPING_OUYA:
|
||||
SetDefaultKeyMap(DEVICE_ID_X360_0, defaultOuyaMap, ARRAY_SIZE(defaultOuyaMap), replace);
|
||||
SetDefaultKeyMap(DEVICE_ID_PAD_0, defaultOuyaMap, ARRAY_SIZE(defaultOuyaMap), replace);
|
||||
break;
|
||||
case DEFAULT_MAPPING_XPERIA_PLAY:
|
||||
SetDefaultKeyMap(DEVICE_ID_X360_0, defaultXperiaPlay, ARRAY_SIZE(defaultXperiaPlay), replace);
|
||||
SetDefaultKeyMap(DEVICE_ID_DEFAULT, defaultXperiaPlay, ARRAY_SIZE(defaultXperiaPlay), replace);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -607,7 +608,15 @@ void RestoreDefault() {
|
||||
SetDefaultKeyMap(DEFAULT_MAPPING_KEYBOARD, true);
|
||||
SetDefaultKeyMap(DEFAULT_MAPPING_X360, false);
|
||||
#elif defined(ANDROID)
|
||||
SetDefaultKeyMap(DEFAULT_MAPPING_PAD, true);
|
||||
// Autodetect a few common devices
|
||||
std::string name = System_GetName();
|
||||
if (name == "NVIDIA:SHIELD") {
|
||||
SetDefaultKeyMap(DEFAULT_MAPPING_SHIELD, true);
|
||||
} else if (name == "OUYA:OUYA") { // TODO: check!
|
||||
SetDefaultKeyMap(DEFAULT_MAPPING_OUYA, true);
|
||||
} else if (name == "Sony Ericsson:R800i" || name == "Sony Ericsson:zeus") {
|
||||
SetDefaultKeyMap(DEFAULT_MAPPING_XPERIA_PLAY, true);
|
||||
}
|
||||
#else
|
||||
SetDefaultKeyMap(DEFAULT_MAPPING_KEYBOARD, true);
|
||||
SetDefaultKeyMap(DEFAULT_MAPPING_PAD, false);
|
||||
|
@ -169,6 +169,7 @@ void ControlMappingScreen::CreateViews() {
|
||||
|
||||
LinearLayout *leftColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(200, FILL_PARENT));
|
||||
leftColumn->Add(new Choice(k->T("Clear All")))->OnClick.Handle(this, &ControlMappingScreen::OnClearMapping);
|
||||
leftColumn->Add(new Choice(k->T("Default All")))->OnClick.Handle(this, &ControlMappingScreen::OnDefaultMapping);
|
||||
leftColumn->Add(new Spacer(new LinearLayoutParams(1.0f)));
|
||||
leftColumn->Add(new Choice(g->T("Back")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
|
||||
|
||||
@ -192,11 +193,17 @@ void ControlMappingScreen::CreateViews() {
|
||||
|
||||
UI::EventReturn ControlMappingScreen::OnClearMapping(UI::EventParams ¶ms) {
|
||||
KeyMap::g_controllerMap.clear();
|
||||
|
||||
RecreateViews();
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn ControlMappingScreen::OnDefaultMapping(UI::EventParams ¶ms) {
|
||||
KeyMap::RestoreDefault();
|
||||
RecreateViews();
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
|
||||
void KeyMappingNewKeyDialog::CreatePopupContents(UI::ViewGroup *parent) {
|
||||
using namespace UI;
|
||||
|
||||
|
@ -28,6 +28,7 @@ protected:
|
||||
virtual void CreateViews();
|
||||
|
||||
private:
|
||||
UI::EventReturn OnDefaultMapping(UI::EventParams ¶ms);
|
||||
UI::EventReturn OnClearMapping(UI::EventParams ¶ms);
|
||||
};
|
||||
|
||||
|
@ -433,6 +433,7 @@ void DeveloperToolsScreen::CreateViews() {
|
||||
|
||||
LinearLayout *list = root_->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)));
|
||||
list->Add(new ItemHeader(g->T("General")));
|
||||
list->Add(new Choice(g->T("System Information")))->OnClick.Handle(this, &DeveloperToolsScreen::OnSysInfo);
|
||||
list->Add(new Choice(d->T("Run CPU Tests")))->OnClick.Handle(this, &DeveloperToolsScreen::OnRunCPUTests);
|
||||
list->Add(new CheckBox(&g_Config.bSoftwareRendering, gs->T("Software Rendering", "Software Rendering (experimental)")));
|
||||
list->Add(new CheckBox(&enableLogging_, d->T("Enable Debug Logging")));
|
||||
@ -451,6 +452,11 @@ UI::EventReturn DeveloperToolsScreen::OnBack(UI::EventParams &e) {
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn DeveloperToolsScreen::OnSysInfo(UI::EventParams &e) {
|
||||
screenManager()->push(new SystemInfoScreen());
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn DeveloperToolsScreen::OnRunCPUTests(UI::EventParams &e) {
|
||||
RunTests();
|
||||
return UI::EVENT_DONE;
|
||||
|
@ -77,6 +77,7 @@ protected:
|
||||
private:
|
||||
UI::EventReturn OnBack(UI::EventParams &e);
|
||||
UI::EventReturn OnRunCPUTests(UI::EventParams &e);
|
||||
UI::EventReturn OnSysInfo(UI::EventParams &e);
|
||||
|
||||
// Temporary variable.
|
||||
bool enableLogging_;
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "base/colorutil.h"
|
||||
#include "base/timeutil.h"
|
||||
#include "gfx_es2/draw_buffer.h"
|
||||
#include "gfx_es2/gl_state.h"
|
||||
#include "file/vfs.h"
|
||||
#include "math/curves.h"
|
||||
#include "i18n/i18n.h"
|
||||
@ -243,6 +244,35 @@ void LogoScreen::render() {
|
||||
dc.Flush();
|
||||
}
|
||||
|
||||
void SystemInfoScreen::CreateViews() {
|
||||
// NOTE: Do not translate this section. It will change a lot and will be impossible to keep up.
|
||||
|
||||
using namespace UI;
|
||||
root_ = new ScrollView(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, FILL_PARENT));
|
||||
|
||||
LinearLayout *scroll = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, WRAP_CONTENT));
|
||||
root_->Add(scroll);
|
||||
|
||||
scroll->Add(new PopupHeader("System Information"));
|
||||
|
||||
scroll->Add(new InfoItem("System Name", System_GetName()));
|
||||
|
||||
scroll->Add(new ItemHeader("OpenGL ES 2.0 Extensions"));
|
||||
std::vector<std::string> exts;
|
||||
SplitString(g_all_gl_extensions, ' ', exts);
|
||||
for (size_t i = 0; i < exts.size(); i++) {
|
||||
scroll->Add(new TextView(exts[i]));
|
||||
}
|
||||
|
||||
scroll->Add(new ItemHeader("EGL Extensions"));
|
||||
exts.clear();
|
||||
SplitString(g_all_egl_extensions, ' ', exts);
|
||||
for (size_t i = 0; i < exts.size(); i++) {
|
||||
scroll->Add(new TextView(exts[i]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CreditsScreen::CreateViews() {
|
||||
using namespace UI;
|
||||
root_ = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT));
|
||||
|
@ -91,7 +91,6 @@ private:
|
||||
int frames_;
|
||||
};
|
||||
|
||||
|
||||
class CreditsScreen : public UIDialogScreenWithBackground {
|
||||
public:
|
||||
CreditsScreen() : frames_(0) {}
|
||||
@ -105,6 +104,11 @@ private:
|
||||
int frames_;
|
||||
};
|
||||
|
||||
class SystemInfoScreen : public UIDialogScreenWithBackground {
|
||||
public:
|
||||
SystemInfoScreen() {}
|
||||
virtual void CreateViews();
|
||||
};
|
||||
|
||||
// Utility functions that create various popup screens
|
||||
ListPopupScreen *CreateLanguageScreen();
|
@ -252,7 +252,8 @@ void NativeInit(int argc, const char *argv[],
|
||||
ILOG("Logman: %p", logman);
|
||||
|
||||
config_filename = user_data_path + "/ppsspp.ini";
|
||||
g_Config.Load(config_filename.c_str());
|
||||
std::string controls_filename = user_data_path + "/controls.ini";
|
||||
g_Config.Load(config_filename.c_str(), controls_filename.c_str());
|
||||
g_Config.externalDirectory = external_directory;
|
||||
#endif
|
||||
|
||||
@ -396,7 +397,6 @@ void NativeInitGraphics() {
|
||||
gl_lost_manager_init();
|
||||
ui_draw2d.SetAtlas(&ui_atlas);
|
||||
|
||||
|
||||
UIShader_Init();
|
||||
|
||||
// Old style theme, to be removed later
|
||||
|
@ -17,11 +17,6 @@
|
||||
|
||||
#include "Common/CommonWindows.h"
|
||||
|
||||
void LaunchBrowser(const char *url)
|
||||
{
|
||||
ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL);
|
||||
}
|
||||
|
||||
#include "file/vfs.h"
|
||||
#include "file/zip_read.h"
|
||||
|
||||
@ -54,6 +49,15 @@ void LaunchBrowser(const char *url)
|
||||
CDisasm *disasmWindow[MAX_CPUCOUNT] = {0};
|
||||
CMemoryDlg *memoryWindow[MAX_CPUCOUNT] = {0};
|
||||
|
||||
void LaunchBrowser(const char *url)
|
||||
{
|
||||
ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL);
|
||||
}
|
||||
|
||||
std::string System_GetName() {
|
||||
return "PC:Windows";
|
||||
}
|
||||
|
||||
int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int iCmdShow)
|
||||
{
|
||||
Common::EnableCrashingOnCrashes();
|
||||
|
2
native
2
native
@ -1 +1 @@
|
||||
Subproject commit 217549921782067d433fc8e449a9aa3e186798a6
|
||||
Subproject commit 89361d002f7755b4effedf67cf2fc1bf0d38e4bc
|
Loading…
Reference in New Issue
Block a user