Respect the IgnoreBadMemAccess ini option (exit on bad access if set).

Fix ini save/load on SDL build.
This commit is contained in:
Henrik Rydgård 2012-11-04 11:54:45 +01:00
parent 63beeb5030
commit baebaaddf9
5 changed files with 32 additions and 15 deletions

View file

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

View file

@ -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;
}

View file

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

View file

@ -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
}

2
native

@ -1 +1 @@
Subproject commit d533766061b866d391ef80607a58d1e4b81643bf
Subproject commit b80e99726b5bda47f4a3165111295dc35337870d