Add a setting in System to set the screen rotation. Default is locked to landscape.

This commit is contained in:
Henrik Rydgård 2014-02-04 12:58:37 +01:00
parent 536fcbd719
commit 8bc6e3f861
6 changed files with 41 additions and 2 deletions

View File

@ -145,6 +145,10 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
general->Get("ReportingHost", &sReportHost, "default");
general->Get("Recent", recentIsos);
general->Get("AutoSaveSymbolMap", &bAutoSaveSymbolMap, false);
#ifdef ANDROID
general->Get("ScreenRotation", &iScreenRotation, 1);
#endif
#if defined(_WIN32) && !defined(USING_QT_UI)
general->Get("TopMost", &bTopMost);
general->Get("WindowX", &iWindowX, -1); // -1 tells us to center the window.
@ -490,6 +494,10 @@ void Config::Save() {
general->Set("ShowDebuggerOnLoad", bShowDebuggerOnLoad);
general->Set("ReportingHost", sReportHost);
general->Set("AutoSaveSymbolMap", bAutoSaveSymbolMap);
#ifdef ANDROID
general->Set("ScreenRotation", iScreenRotation);
#endif
#if defined(_WIN32) && !defined(USING_QT_UI)
general->Set("TopMost", bTopMost);
general->Set("WindowX", iWindowX);

View File

@ -32,6 +32,14 @@ const int PSP_MODEL_FAT = 0;
const int PSP_MODEL_SLIM = 1;
const int PSP_DEFAULT_FIRMWARE = 150;
enum {
ROTATION_AUTO = 0,
ROTATION_LOCKED_HORIZONTAL = 1,
ROTATION_LOCKED_VERTICAL = 2,
ROTATION_LOCKED_HORIZONTAL180 = 3,
ROTATION_LOCKED_VERTICAL180 = 4,
};
namespace http {
class Download;
class Downloader;
@ -74,6 +82,8 @@ public:
bool bAtomicAudioLocks;
int iLockedCPUSpeed;
bool bAutoSaveSymbolMap;
int iScreenRotation;
std::string sReportHost;
std::vector<std::string> recentIsos;
std::vector<std::string> vPinnedPaths;

View File

@ -308,6 +308,13 @@ void GameSettingsScreen::CreateViews() {
systemSettings->Add(new Choice(s->T("Developer Tools")))->OnClick.Handle(this, &GameSettingsScreen::OnDeveloperTools);
systemSettings->Add(new ItemHeader(s->T("General")));
#ifdef ANDROID
static const char *screenRotation[] = {"Auto", "Landscape", "Portrait", "Landscape Reversed", "Portrait Reversed"};
PopupMultiChoice *rot = systemSettings->Add(new PopupMultiChoice(&g_Config.iScreenRotation, c->T("Screen Rotation"), screenRotation, 0, ARRAY_SIZE(screenRotation), c, screenManager()));
rot->OnChoice.Handle(this, &GameSettingsScreen::OnScreenRotation);
#endif
systemSettings->Add(new CheckBox(&g_Config.bCheckForNewVersion, s->T("VersionCheck", "Check for new versions of PPSSPP")));
systemSettings->Add(new Choice(s->T("Clear Recent Games List")))->OnClick.Handle(this, &GameSettingsScreen::OnClearRecents);
systemSettings->Add(new Choice(s->T("Restore Default Settings")))->OnClick.Handle(this, &GameSettingsScreen::OnRestoreDefaultSettings);
@ -349,6 +356,11 @@ void GameSettingsScreen::CreateViews() {
systemSettings->Add(new PopupMultiChoice(&g_Config.iButtonPreference, s->T("Confirmation Button"), buttonPref, 0, 2, s, screenManager()));
}
UI::EventReturn GameSettingsScreen::OnScreenRotation(UI::EventParams &e) {
System_SendMessage("rotate", "");
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnRenderingMode(UI::EventParams &e) {
// We do not want to report when rendering mode is Framebuffer to memory - so many issues
// are caused by that (framebuffer copies overwriting display lists, etc).

View File

@ -71,6 +71,8 @@ private:
UI::EventReturn OnRestoreDefaultSettings(UI::EventParams &e);
UI::EventReturn OnRenderingMode(UI::EventParams &e);
UI::EventReturn OnScreenRotation(UI::EventParams &e);
// Temporaries to convert bools to int settings
bool cap60FPS_;
int iAlternateSpeedPercent_;

View File

@ -199,7 +199,14 @@ void NativeHost::ShutdownSound() {
}
std::string NativeQueryConfig(std::string query) {
return "";
if (query == "screenRotation") {
char temp[128];
sprintf(temp, "%i", g_Config.iScreenRotation);
ILOG("Rotation queried: %s", temp);
return temp;
} else {
return "";
}
}
int NativeMix(short *audio, int num_samples) {

2
native

@ -1 +1 @@
Subproject commit c960fdb0b2907fdf0f27f6dc02526486b1776dbe
Subproject commit 5fa72b4d2227f1d31c0f729284be482011d9e923