From baebaaddf964ae0f463f9ae87725167d4c4cc8ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 4 Nov 2012 11:54:45 +0100 Subject: [PATCH] Respect the IgnoreBadMemAccess ini option (exit on bad access if set). Fix ini save/load on SDL build. --- Core/Config.cpp | 2 ++ Core/HLE/sceGe.cpp | 5 +++-- Core/MemMapFunctions.cpp | 11 ++++++++++- android/jni/NativeApp.cpp | 27 ++++++++++++++++----------- native | 2 +- 5 files changed, 32 insertions(+), 15 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index f54f70464e..6209dbc765 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -85,5 +85,7 @@ void CConfig::Save() iniFile.Save(iniFilename_.c_str()); NOTICE_LOG(LOADER, "Config saved: %s", iniFilename_.c_str()); + } else { + NOTICE_LOG(LOADER, "Error saving config: %s", iniFilename_.c_str()); } } diff --git a/Core/HLE/sceGe.cpp b/Core/HLE/sceGe.cpp index f2648163c5..43cd01c125 100644 --- a/Core/HLE/sceGe.cpp +++ b/Core/HLE/sceGe.cpp @@ -139,7 +139,7 @@ void sceGeContinue() u32 sceGeSetCallback(u32 structAddr) { - ERROR_LOG(HLE,"sceGeSetCallback(struct=%08x)", structAddr); + ERROR_LOG(HLE,"HALFIMPL sceGeSetCallback(struct=%08x)", structAddr); PspGeCallbackData ge_callback_data; Memory::ReadStruct(structAddr, &ge_callback_data); @@ -148,7 +148,8 @@ u32 sceGeSetCallback(u32 structAddr) sceKernelRegisterSubIntrHandler(PSP_GE_INTR, PSP_GE_SUBINTR_FINISH, ge_callback_data.finish_func, ge_callback_data.finish_arg); if (ge_callback_data.signal_func) sceKernelRegisterSubIntrHandler(PSP_GE_INTR, PSP_GE_SUBINTR_SIGNAL, ge_callback_data.signal_func, ge_callback_data.signal_arg); - + + // TODO: This should return a callback ID return 0; } diff --git a/Core/MemMapFunctions.cpp b/Core/MemMapFunctions.cpp index c8e106f864..6aa36380df 100644 --- a/Core/MemMapFunctions.cpp +++ b/Core/MemMapFunctions.cpp @@ -19,7 +19,8 @@ #include "Atomic.h" #include "MemMap.h" -// #include "../Core.h" +#include "Config.h" + #include "MIPS/MIPS.h" // TODO: Fix this @@ -82,6 +83,10 @@ inline void ReadFromHardware(T &var, const u32 address) else { WARN_LOG(MEMMAP, "ReadFromHardware: Invalid address %08x PC %08x LR %08x", address, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]); + if (!g_Config.bIgnoreBadMemAccess) { + // TODO: Not sure what the best way to crash is... + exit(0); + } var = 0; } } @@ -106,6 +111,10 @@ inline void WriteToHardware(u32 address, const T data) else { WARN_LOG(MEMMAP, "WriteToHardware: Invalid address %08x PC %08x LR %08x", address, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]); + if (!g_Config.bIgnoreBadMemAccess) { + // TODO: Not sure what the best way to crash is... + exit(0); + } } } diff --git a/android/jni/NativeApp.cpp b/android/jni/NativeApp.cpp index aa3c8e9652..e88744575f 100644 --- a/android/jni/NativeApp.cpp +++ b/android/jni/NativeApp.cpp @@ -49,7 +49,7 @@ Texture *uiTexture; -ScreenManager screenManager; +ScreenManager *screenManager; std::string config_filename; class AndroidLogger : public LogListener @@ -183,7 +183,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_directory, co } } - config_filename = user_data_path + "/config.ini"; + config_filename = user_data_path + "ppsspp.ini"; g_Config.Load(config_filename.c_str()); @@ -215,13 +215,14 @@ void NativeInitGraphics() gl_lost_manager_init(); ui_draw2d.SetAtlas(&ui_atlas); + screenManager = new ScreenManager(); if (boot_filename.empty()) { - screenManager.switchScreen(new LogoScreen(boot_filename)); + screenManager->switchScreen(new LogoScreen(boot_filename)); } else { // Go directly into the game. - screenManager.switchScreen(new EmuScreen(boot_filename)); + screenManager->switchScreen(new EmuScreen(boot_filename)); } - // screenManager.switchScreen(new FileSelectScreen()); + // screenManager->switchScreen(new FileSelectScreen()); UIShader_Init(); @@ -256,19 +257,19 @@ void NativeRender() ortho.setOrtho(0.0f, dp_xres, dp_yres, 0.0f, -1.0f, 1.0f); glsl_bind(UIShader_Get()); glUniformMatrix4fv(UIShader_Get()->u_worldviewproj, 1, GL_FALSE, ortho.getReadPtr()); - - screenManager.render(); + + screenManager->render(); } void NativeUpdate(InputState &input) { UIUpdateMouse(0, input.pointer_x[0], input.pointer_y[0], input.pointer_down[0]); - screenManager.update(input); + screenManager->update(input); } void NativeDeviceLost() { - screenManager.deviceLost(); + screenManager->deviceLost(); gl_lost(); // Should dirty EVERYTHING } @@ -296,7 +297,9 @@ void NativeShutdownGraphics() delete uiTexture; uiTexture = NULL; - screenManager.shutdown(); + screenManager->shutdown(); + delete screenManager; + screenManager = 0; UIShader_Shutdown(); @@ -307,10 +310,12 @@ void NativeShutdown() { delete host; host = 0; - LogManager::Shutdown(); g_Config.Save(); + LogManager::Shutdown(); // This means that the activity has been completely destroyed. PPSSPP does not // boot up correctly with "dirty" global variables currently, so we hack around that // by simply exiting. +#ifdef ANDROID exit(0); +#endif } diff --git a/native b/native index d533766061..b80e99726b 160000 --- a/native +++ b/native @@ -1 +1 @@ -Subproject commit d533766061b866d391ef80607a58d1e4b81643bf +Subproject commit b80e99726b5bda47f4a3165111295dc35337870d