From 364a78edaf0a1f9a96fb4600d228d58c5dde3279 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 1 Dec 2012 23:20:08 +0100 Subject: [PATCH] Add option to show/hide touch controls --- Core/Config.cpp | 2 ++ Core/Config.h | 1 + android/jni/EmuScreen.cpp | 13 +++---------- android/jni/MenuScreens.cpp | 9 ++++++--- android/jni/NativeApp.cpp | 7 ++++++- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index aa8fb39afa..1f82e9c70a 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -63,6 +63,7 @@ void CConfig::Load(const char *iniFileName) IniFile::Section *control = iniFile.GetOrCreateSection("Control"); control->Get("ShowStick", &bShowAnalogStick, false); + control->Get("ShowTouchControls", &bShowTouchControls, true); } void CConfig::Save() @@ -94,6 +95,7 @@ void CConfig::Save() IniFile::Section *control = iniFile.GetOrCreateSection("Control"); control->Set("ShowStick", bShowAnalogStick); + control->Set("ShowTouchControls", bShowTouchControls); iniFile.Save(iniFilename_.c_str()); NOTICE_LOG(LOADER, "Config saved: %s", iniFilename_.c_str()); diff --git a/Core/Config.h b/Core/Config.h index f7add3be19..a86e7df575 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -44,6 +44,7 @@ public: bool bDisplayFramebuffer; bool bBufferedRendering; + bool bShowTouchControls; bool bShowAnalogStick; bool bShowFPSCounter; bool bShowDebugStats; diff --git a/android/jni/EmuScreen.cpp b/android/jni/EmuScreen.cpp index 23a1dd541a..7fb7bf35bc 100644 --- a/android/jni/EmuScreen.cpp +++ b/android/jni/EmuScreen.cpp @@ -153,14 +153,7 @@ void EmuScreen::render() // Reapply the graphics state of the PSP ReapplyGfxState(); - // First attempt at an Android-friendly execution loop. - // We simply run the CPU for 1/60th of a second each frame. If a swap doesn't happen, not sure what the best thing to do is :P - // Also if we happen to get half a frame or something, things will be screwed up so this doesn't actually really work. - // - // I think we need to allocate FBOs per framebuffer and just blit the displayed one here at the end of the frame. - // Also - we should add another option to the core that lets us run it until a vblank event happens or the N cycles have passed - // - then the synchronization would at least not be able to drift off. - + // We just run the CPU until we get to vblank. This will quickly sync up pretty nicely. // The actual number of cycles doesn't matter so much here as we will break due to CORE_NEXTFRAME, most of the time hopefully... int blockTicks = usToCycles(1000000 / 2); @@ -186,8 +179,8 @@ void EmuScreen::render() ui_draw2d.Begin(DBMODE_NORMAL); // Make this configurable. -// if (coreParam.useTouchControls) - DrawGamepad(ui_draw2d); + if (g_Config.bShowTouchControls) + DrawGamepad(ui_draw2d); DrawWatermark(); diff --git a/android/jni/MenuScreens.cpp b/android/jni/MenuScreens.cpp index 9fc656b229..0a4c44f9e5 100644 --- a/android/jni/MenuScreens.cpp +++ b/android/jni/MenuScreens.cpp @@ -240,19 +240,22 @@ void SettingsScreen::render() { int x = 30; int y = 50; UICheckBox(GEN_ID, x, y += 50, "Enable Sound Emulation", ALIGN_TOPLEFT, &g_Config.bEnableSound); - UICheckBox(GEN_ID, x, y += 50, "Show Analog Stick", ALIGN_TOPLEFT, &g_Config.bShowAnalogStick); UICheckBox(GEN_ID, x, y += 50, "Buffered Rendering (may fix flicker)", ALIGN_TOPLEFT, &g_Config.bBufferedRendering); + bool useFastInt = g_Config.iCpuCore == CPU_FASTINTERPRETER; UICheckBox(GEN_ID, x, y += 50, "Slightly faster interpreter (may crash)", ALIGN_TOPLEFT, &useFastInt); - ui_draw2d.DrawText(UBUNTU48, "much faster JIT coming later", x += 50, 0xcFFFFFFF, ALIGN_LEFT); + // ui_draw2d.DrawText(UBUNTU48, "much faster JIT coming later", x, y+=50, 0xcFFFFFFF, ALIGN_LEFT); + UICheckBox(GEN_ID, x, y += 50, "On-screen Touch Controls", ALIGN_TOPLEFT, &g_Config.bShowTouchControls); + if (g_Config.bShowTouchControls) + UICheckBox(GEN_ID, x + 50, y += 50, "Show Analog Stick", ALIGN_TOPLEFT, &g_Config.bShowAnalogStick); g_Config.iCpuCore = useFastInt ? CPU_FASTINTERPRETER : CPU_INTERPRETER; // UICheckBox(GEN_ID, x, y += 50, "Draw raw framebuffer (for some homebrew)", ALIGN_TOPLEFT, &g_Config.bDisplayFramebuffer); if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres-10), LARGE_BUTTON_WIDTH, "Back", ALIGN_RIGHT | ALIGN_BOTTOM)) { screenManager()->switchScreen(new MenuScreen()); } - + UIEnd(); glsl_bind(UIShader_Get()); diff --git a/android/jni/NativeApp.cpp b/android/jni/NativeApp.cpp index b3ce01036f..02c77f1cc4 100644 --- a/android/jni/NativeApp.cpp +++ b/android/jni/NativeApp.cpp @@ -168,6 +168,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_directory, co LogManager *logman = LogManager::GetInstance(); ILOG("Logman: %p", logman); + bool gfxLog = false; // Parse command line LogTypes::LOG_LEVELS logLevel = LogTypes::LINFO; for (int i = 1; i < argc; i++) { @@ -177,6 +178,9 @@ void NativeInit(int argc, const char *argv[], const char *savegame_directory, co // Enable debug logging logLevel = LogTypes::LDEBUG; break; + case 'g': + gfxLog = true; + break; } } else { boot_filename = argv[i]; @@ -210,7 +214,8 @@ void NativeInit(int argc, const char *argv[], const char *savegame_directory, co #endif } // Special hack for G3D as it's very spammy. Need to make a flag for this. - logman->SetLogLevel(LogTypes::G3D, LogTypes::LERROR); + if (!gfxLog) + logman->SetLogLevel(LogTypes::G3D, LogTypes::LERROR); INFO_LOG(BOOT, "Logger inited."); }