Add option to show/hide touch controls

This commit is contained in:
Henrik Rydgård 2012-12-01 23:20:08 +01:00
parent ae0b5c8b05
commit 364a78edaf
5 changed files with 18 additions and 14 deletions

View File

@ -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());

View File

@ -44,6 +44,7 @@ public:
bool bDisplayFramebuffer;
bool bBufferedRendering;
bool bShowTouchControls;
bool bShowAnalogStick;
bool bShowFPSCounter;
bool bShowDebugStats;

View File

@ -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();

View File

@ -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());

View File

@ -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.");
}