From a367b4792b565003de3cfb015c119b36980d1238 Mon Sep 17 00:00:00 2001 From: zilmar Date: Wed, 4 Jan 2017 18:04:37 +1100 Subject: [PATCH] [Project64] Add Reduced Sync Mem option --- Android/res/values/strings.xml | 2 ++ Android/res/xml/settings_advanced.xml | 4 ++++ Android/src/emu/project64/GalleryActivity.java | 8 +++++++- Android/src/emu/project64/jni/SettingsID.java | 1 + .../emu/project64/settings/SettingsActivity.java | 2 ++ Source/Project64-core/MemoryExceptionFilter.cpp | 13 +++++++++++-- .../N64System/Mips/MemoryVirtualMem.cpp | 2 +- Source/Project64-core/Settings/Settings.h | 1 + Source/Project64-core/Settings/SettingsClass.cpp | 1 + 9 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Android/res/values/strings.xml b/Android/res/values/strings.xml index e12bfe565..024a939dd 100644 --- a/Android/res/values/strings.xml +++ b/Android/res/values/strings.xml @@ -114,6 +114,8 @@ Always reload GFX plugin Pre Alloc Sync Mem Allocate sync memory at startup + Reduced Sync Mem + Allocate a smaller amount of memory for sync cpu Debug Language Show the number id for the language string Button scale diff --git a/Android/res/xml/settings_advanced.xml b/Android/res/xml/settings_advanced.xml index b2beb94cb..c44608fb7 100644 --- a/Android/res/xml/settings_advanced.xml +++ b/Android/res/xml/settings_advanced.xml @@ -34,6 +34,10 @@ android:key="PreAllocSyncMem" android:summary="@string/PreAllocSyncMem_summary" android:title="@string/PreAllocSyncMem_title" /> + uint32.rt: %X",OpCode32->uint32.rt); WriteTrace(TraceExceptionHandler, TraceError, "OpCode32->uint32.opcode2: %X",OpCode32->uint32.opcode2); WriteTrace(TraceExceptionHandler, TraceError, "OpCode32->uint32.rm: %X",OpCode32->uint32.rm); + + for (int count = 0; count < 32; count++) + { + WriteTrace(TraceExceptionHandler, TraceError, "GPR[%s] 0x%08X%08X", CRegName::GPR[count], g_Reg->m_GPR[count].W[1], g_Reg->m_GPR[count].W[0]); + } + Flush_Recompiler_Log(); TraceFlushLog(); g_Notify->BreakPoint(__FILE__, __LINE__); @@ -816,8 +822,11 @@ void CMipsMemoryVM::segv_handler(int signal, siginfo_t *siginfo, void *sigcontex } WriteTrace(TraceExceptionHandler, TraceNotice, "REG_EIP = %X", ucontext->uc_mcontext.gregs[REG_EIP]); - uint8_t * TypePos = (uint8_t *)ucontext->uc_mcontext.gregs[REG_EIP]; - WriteTrace(TraceExceptionHandler, TraceNotice, "TypePos: %02X %02X %02X %02X %02X %02X %02X %02X %02X", TypePos[0], TypePos[1], TypePos[2], TypePos[3], TypePos[4], TypePos[5], TypePos[6], TypePos[7], TypePos[8]); + WriteTrace(TraceExceptionHandler, TraceNotice, "Data:"); + for (uint8_t * TypePos = (uint8_t *)ucontext->uc_mcontext.gregs[REG_EIP] - 0x200; TypePos < (uint8_t *)ucontext->uc_mcontext.gregs[REG_EIP] + 0x30; TypePos += 8) + { + WriteTrace(TraceExceptionHandler, TraceNotice, "%X: %02X %02X %02X %02X %02X %02X %02X %02X", (uint32_t)TypePos, TypePos[0], TypePos[1], TypePos[2], TypePos[3], TypePos[4], TypePos[5], TypePos[6], TypePos[7]); + } X86_CONTEXT context; context.Edi = (uint32_t*)&ucontext->uc_mcontext.gregs[REG_EDI]; diff --git a/Source/Project64-core/N64System/Mips/MemoryVirtualMem.cpp b/Source/Project64-core/N64System/Mips/MemoryVirtualMem.cpp index 32f8bef7e..edfcd2208 100644 --- a/Source/Project64-core/N64System/Mips/MemoryVirtualMem.cpp +++ b/Source/Project64-core/N64System/Mips/MemoryVirtualMem.cpp @@ -113,7 +113,7 @@ void CMipsMemoryVM::ReserveMemory() m_Reserve1 = (uint8_t *)AllocateAddressSpace(0x20000000); if (g_Settings->LoadBool(Debugger_Enabled) && g_Settings->LoadBool(Setting_PreAllocSyncMem)) { - m_Reserve2 = (uint8_t *)AllocateAddressSpace(0x20000000); + m_Reserve2 = (uint8_t *)AllocateAddressSpace(g_Settings->LoadBool(Setting_ReducedSyncMem) ? 0x04002000 : 0x20000000); } } diff --git a/Source/Project64-core/Settings/Settings.h b/Source/Project64-core/Settings/Settings.h index 56b9e5b52..4e954e243 100644 --- a/Source/Project64-core/Settings/Settings.h +++ b/Source/Project64-core/Settings/Settings.h @@ -57,6 +57,7 @@ enum SettingID Setting_CurrentLanguage, Setting_EnableDisk, Setting_PreAllocSyncMem, + Setting_ReducedSyncMem, //RDB Settings Rdb_GoodName, diff --git a/Source/Project64-core/Settings/SettingsClass.cpp b/Source/Project64-core/Settings/SettingsClass.cpp index fb015d235..33a5cb30d 100644 --- a/Source/Project64-core/Settings/SettingsClass.cpp +++ b/Source/Project64-core/Settings/SettingsClass.cpp @@ -122,6 +122,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory) AddHandler(Setting_CurrentLanguage, new CSettingTypeApplication("", "Current Language", "")); AddHandler(Setting_EnableDisk, new CSettingTypeTempBool(false)); AddHandler(Setting_PreAllocSyncMem, new CSettingTypeApplication("", "PreAllocSyncMem", true)); + AddHandler(Setting_ReducedSyncMem, new CSettingTypeApplication("", "ReducedSyncMem", false)); AddHandler(Setting_LanguageDirDefault, new CSettingTypeRelativePath("Lang", "")); AddHandler(Setting_LanguageDir, new CSettingTypeApplicationPath("Lang Directory", "Directory", Setting_LanguageDirDefault));