From d2232f9150f447024cad65624a152874c7d7ed6c Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 21 Nov 2016 18:09:07 +1100 Subject: [PATCH] [Project64] Add Setting for Setting_PreAllocSyncMem --- Android/src/emu/project64/jni/SettingsID.java | 29 +++++++++++-------- .../N64System/Mips/MemoryVirtualMem.cpp | 2 +- Source/Project64-core/Settings/Settings.h | 1 + .../Project64-core/Settings/SettingsClass.cpp | 1 + 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/Android/src/emu/project64/jni/SettingsID.java b/Android/src/emu/project64/jni/SettingsID.java index 80d27bd5a..f6bb32197 100644 --- a/Android/src/emu/project64/jni/SettingsID.java +++ b/Android/src/emu/project64/jni/SettingsID.java @@ -11,7 +11,7 @@ package emu.project64.jni; public enum SettingsID -{ +{ //Default values Default_None, Default_Constant, @@ -51,6 +51,7 @@ public enum SettingsID Setting_LanguageDirDefault, Setting_CurrentLanguage, Setting_EnableDisk, + Setting_PreAllocSyncMem, //RDB Settings Rdb_GoodName, @@ -290,16 +291,15 @@ public enum SettingsID Cheat_Range, Cheat_RangeNotes, - /*, FirstUISettings, LastUISettings = FirstUISettings + MaxPluginSetting, - FirstRSPDefaultSet, LastRSPDefaultSet = FirstRSPDefaultSet + MaxPluginSetting, - FirstRSPSettings, LastRSPSettings = FirstRSPSettings + MaxPluginSetting, - FirstGfxDefaultSet, LastGfxDefaultSet = FirstGfxDefaultSet + MaxPluginSetting, - FirstGfxSettings, LastGfxSettings = FirstGfxSettings + MaxPluginSetting, - FirstAudioDefaultSet, LastAudioDefaultSet = FirstAudioDefaultSet + MaxPluginSetting, - FirstAudioSettings, LastAudioSettings = FirstAudioSettings + MaxPluginSetting, - FirstCtrlDefaultSet, LastCtrlDefaultSet = FirstCtrlDefaultSet + MaxPluginSetting, - FirstCtrlSettings, LastCtrlSettings = FirstCtrlSettings + MaxPluginSetting, - ;*/ + FirstUISettings, LastUISettings(FirstUISettings.getValue() + 65535), + FirstRSPDefaultSet, LastRSPDefaultSet(FirstRSPDefaultSet.getValue() + 65535), + FirstRSPSettings, LastRSPSettings(FirstRSPSettings.getValue() + 65535), + FirstGfxDefaultSet, LastGfxDefaultSet(FirstGfxDefaultSet.getValue() + 65535), + FirstGfxSettings, LastGfxSettings(FirstGfxSettings.getValue() + 65535), + FirstAudioDefaultSet, LastAudioDefaultSet(FirstAudioDefaultSet.getValue() + 65535), + FirstAudioSettings, LastAudioSettings(FirstAudioSettings.getValue() + 65535), + FirstCtrlDefaultSet, LastCtrlDefaultSet(FirstCtrlDefaultSet.getValue() + 65535), + FirstCtrlSettings, LastCtrlSettings(FirstCtrlSettings.getValue() + 65535), ; private int value; @@ -316,5 +316,10 @@ public enum SettingsID { this.value = StaticFields.Counter; StaticFields.Counter += 1; - } + } + private SettingsID(int value) + { + this.value = value; + StaticFields.Counter = this.value + 1; + } } \ No newline at end of file diff --git a/Source/Project64-core/N64System/Mips/MemoryVirtualMem.cpp b/Source/Project64-core/N64System/Mips/MemoryVirtualMem.cpp index 689a06582..8bcc18f13 100644 --- a/Source/Project64-core/N64System/Mips/MemoryVirtualMem.cpp +++ b/Source/Project64-core/N64System/Mips/MemoryVirtualMem.cpp @@ -108,7 +108,7 @@ void CMipsMemoryVM::Reset(bool /*EraseMemory*/) void CMipsMemoryVM::ReserveMemory() { m_Reserve1 = (uint8_t *)AllocateAddressSpace(0x20000000); - if (g_Settings->LoadBool(Debugger_Enabled)) + if (g_Settings->LoadBool(Debugger_Enabled) && g_Settings->LoadBool(Setting_PreAllocSyncMem)) { m_Reserve2 = (uint8_t *)AllocateAddressSpace(0x20000000); } diff --git a/Source/Project64-core/Settings/Settings.h b/Source/Project64-core/Settings/Settings.h index e2f69498b..b7342df8e 100644 --- a/Source/Project64-core/Settings/Settings.h +++ b/Source/Project64-core/Settings/Settings.h @@ -56,6 +56,7 @@ enum SettingID Setting_LanguageDirDefault, Setting_CurrentLanguage, Setting_EnableDisk, + Setting_PreAllocSyncMem, //RDB Settings Rdb_GoodName, diff --git a/Source/Project64-core/Settings/SettingsClass.cpp b/Source/Project64-core/Settings/SettingsClass.cpp index 03976940c..1ba92faa3 100644 --- a/Source/Project64-core/Settings/SettingsClass.cpp +++ b/Source/Project64-core/Settings/SettingsClass.cpp @@ -121,6 +121,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory) #endif AddHandler(Setting_CurrentLanguage, new CSettingTypeApplication("", "Current Language", "")); AddHandler(Setting_EnableDisk, new CSettingTypeTempBool(false)); + AddHandler(Setting_PreAllocSyncMem, new CSettingTypeApplication("", "PreAllocSyncMem", true)); AddHandler(Setting_LanguageDirDefault, new CSettingTypeRelativePath("Lang", "")); AddHandler(Setting_LanguageDir, new CSettingTypeApplicationPath("Lang Directory", "Directory", Setting_LanguageDirDefault));