Core: have an option for rdram to be different between known and unknown roms

This commit is contained in:
zilmar 2023-01-16 20:53:48 +10:30
parent dbd360f676
commit 210ebd42de
15 changed files with 1270 additions and 919 deletions

File diff suppressed because it is too large Load Diff

View File

@ -72,7 +72,8 @@ CJniBridegSettings::CJniBridegSettings()
ADD_SETTING(Setting_DiskSaveType);
// Default settings
ADD_SETTING(Default_RDRamSize);
ADD_SETTING(Default_RDRamSizeUnknown);
ADD_SETTING(Default_RDRamSizeKnown);
ADD_SETTING(Default_UseHleGfx);
ADD_SETTING(Default_ViRefreshRate);
ADD_SETTING(Default_AiCountPerBytes);

View File

@ -328,6 +328,8 @@ enum LanguageStringID
ROM_DISK_SEEK_TIMING = 5440,
ROM_DISK_SEEK_TIMING_TURBO = 5441,
ROM_DISK_SEEK_TIMING_SLOW = 5442,
ROM_MEM_SIZE_KNOWN = 5443,
ROM_MEM_SIZE_UNKNOWN = 5444,
// Core styles
CORE_INTERPTER = 540,

View File

@ -276,6 +276,8 @@ void CLanguage::LoadDefaultStrings(void)
DEF_STR(ROM_DISK_SEEK_TIMING, "Disk seek timing:");
DEF_STR(ROM_DISK_SEEK_TIMING_TURBO, "Turbo");
DEF_STR(ROM_DISK_SEEK_TIMING_SLOW, "Slow");
DEF_STR(ROM_MEM_SIZE_KNOWN, "Memory size (Known):");
DEF_STR(ROM_MEM_SIZE_UNKNOWN, "Memory size (Unknown):");
// Core styles
DEF_STR(CORE_INTERPTER, "Interpreter");

View File

@ -161,7 +161,10 @@ bool CMipsMemoryVM::Initialize(bool SyncSystem)
return false;
}
m_AllocatedRdramSize = g_Settings->LoadDword(Game_RDRamSize);
if (!g_Settings->LoadDword(Game_RDRamSize, m_AllocatedRdramSize))
{
m_AllocatedRdramSize = g_Settings->LoadDword(g_Settings->LoadBool(Game_Known) ? Default_RDRamSizeKnown : Default_RDRamSizeUnknown);
}
if (CommitMemory(m_RDRAM, m_AllocatedRdramSize, MEM_READWRITE) == nullptr)
{
WriteTrace(TraceN64System, TraceError, "Failed to allocate RDRAM (Size: 0x%X)", m_AllocatedRdramSize);

View File

@ -1889,7 +1889,7 @@ bool CN64System::SaveState()
}
}
uint32_t RdramSize = g_Settings->LoadDword(Game_RDRamSize);
uint32_t RdramSize = m_MMU_VM.RdramSize();
uint32_t MiInterReg = g_Reg->MI_INTR_REG;
uint32_t NextViTimer = m_SystemTimer.GetTimer(CSystemTimer::ViTimer);
if (g_Settings->LoadDword(Setting_AutoZipInstantSave))
@ -2170,7 +2170,7 @@ bool CN64System::LoadState(const char * FileName)
}
Reset(false, true);
m_MMU_VM.UnProtectMemory(0x80000000, 0x80000000 + g_Settings->LoadDword(Game_RDRamSize) - 4);
m_MMU_VM.UnProtectMemory(0x80000000, 0x80000000 + m_MMU_VM.RdramSize() - 4);
m_MMU_VM.UnProtectMemory(0xA4000000, 0xA4000FFC);
m_MMU_VM.UnProtectMemory(0xA4001000, 0xA4001FFC);
g_Settings->SaveDword(Game_RDRamSize, SaveRDRAMSize);
@ -2265,7 +2265,7 @@ bool CN64System::LoadState(const char * FileName)
}
}
Reset(false, true);
m_MMU_VM.UnProtectMemory(0x80000000, 0x80000000 + g_Settings->LoadDword(Game_RDRamSize) - 4);
m_MMU_VM.UnProtectMemory(0x80000000, 0x80000000 + m_MMU_VM.RdramSize() - 4);
m_MMU_VM.UnProtectMemory(0xA4000000, 0xA4001FFC);
g_Settings->SaveDword(Game_RDRamSize, SaveRDRAMSize);

View File

@ -129,7 +129,8 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(Setting_DiskSaveType, new CSettingTypeApplication("Settings", "Disk Save Type", (uint32_t)1));
AddHandler(Setting_UpdateControllerOnRefresh, new CSettingTypeTempBool(false));
AddHandler(Default_RDRamSize, new CSettingTypeApplication("Defaults", "RDRAM Size", 0x800000u));
AddHandler(Default_RDRamSizeUnknown, new CSettingTypeApplication("Defaults", "Unknown RDRAM Size", 0x800000u));
AddHandler(Default_RDRamSizeKnown, new CSettingTypeApplication("Defaults", "Known RDRAM Size", 0x400000u));
AddHandler(Default_UseHleGfx, new CSettingTypeApplication("Defaults", "HLE GFX Default", true));
AddHandler(Default_ViRefreshRate, new CSettingTypeApplication("Defaults", "ViRefresh", 1500u));
AddHandler(Default_AiCountPerBytes, new CSettingTypeApplication("Defaults", "AiCountPerBytes", 0u));
@ -144,7 +145,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(Rdb_RPCKey, new CSettingTypeRomDatabase("RPC Key", Game_RPCKey));
AddHandler(Rdb_SaveChip, new CSettingTypeRDBSaveChip("Save Type", (uint32_t)SaveChip_Auto));
AddHandler(Rdb_CpuType, new CSettingTypeRDBCpuType("CPU Type", CPU_Recompiler));
AddHandler(Rdb_RDRamSize, new CSettingTypeRDBRDRamSize("RDRAM Size", Default_RDRamSize));
AddHandler(Rdb_RDRamSize, new CSettingTypeRDBRDRamSize("RDRAM Size", Default_RDRamSizeKnown));
AddHandler(Rdb_CounterFactor, new CSettingTypeRomDatabase("Counter Factor", Default_CounterFactor));
AddHandler(Rdb_DelayDP, new CSettingTypeRDBYesNo("Delay DP", true));
AddHandler(Rdb_DelaySi, new CSettingTypeRDBYesNo("Delay SI", false));
@ -187,6 +188,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(Game_GameName, new CSettingTypeTempString(""));
AddHandler(Cfg_GoodName, new CSettingTypeGame("Good Name", ""));
AddHandler(Game_TempLoaded, new CSettingTypeTempBool(false));
AddHandler(Game_Known, new CSettingTypeTempBool(false));
AddHandler(Game_SystemType, new CSettingTypeTempNumber(SYSTEM_NTSC));
AddHandler(Game_EditPlugin_Gfx, new CSettingTypeGame("Plugin-Gfx", Default_None));
AddHandler(Game_EditPlugin_Audio, new CSettingTypeGame("Plugin-Audio", Default_None));

View File

@ -118,11 +118,15 @@ void CSettingTypeRomDatabase::BaseDirChanged(void * /*Data */)
m_AudioIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_AudioRDB).c_str());
}
void CSettingTypeRomDatabase::GameChanged(void * /*Data */)
void CSettingTypeRomDatabase::GameChanged(void * Data)
{
if (m_SectionIdent)
{
*m_SectionIdent = g_Settings->LoadStringVal(Game_IniKey);
CIniFileBase::strlist KeyList;
m_SettingsIniFile->GetKeyList(m_SectionIdent->c_str(), KeyList);
g_Settings->SaveBool(Game_Known, KeyList.size() > 0);
}
}

View File

@ -64,7 +64,8 @@ enum SettingID
Setting_UpdateControllerOnRefresh,
// Default settings
Default_RDRamSize,
Default_RDRamSizeUnknown,
Default_RDRamSizeKnown,
Default_UseHleGfx,
Default_ViRefreshRate,
Default_AiCountPerBytes,
@ -120,6 +121,7 @@ enum SettingID
Game_GameName,
Cfg_GoodName,
Game_TempLoaded,
Game_Known,
Game_SystemType,
Game_EditPlugin_Gfx,
Game_EditPlugin_Audio,

View File

@ -263,7 +263,7 @@ LRESULT CEnhancementUI::OnEnhancementListClicked(NMHDR * lpnmh)
return 0;
}
LRESULT CEnhancementUI::OnPopupDelete(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & bHandled)
LRESULT CEnhancementUI::OnPopupDelete(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/)
{
int Response = MessageBox(wGS(MSG_DEL_SURE).c_str(), wGS(MSG_DEL_TITLE).c_str(), MB_YESNO | MB_ICONQUESTION);
if (Response != IDYES)

View File

@ -970,7 +970,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
case JSAPI_ACT_RESET:
if (g_BaseSystem)
{
g_BaseSystem->ExternalEvent((bool)lParam ? SysEvent_ResetCPU_Soft : SysEvent_ResetCPU_Hard);
g_BaseSystem->ExternalEvent(lParam != 0 ? SysEvent_ResetCPU_Soft : SysEvent_ResetCPU_Hard);
}
break;
case JSAPI_ACT_PAUSE:

View File

@ -10,7 +10,8 @@ CDefaultsOptionsPage::CDefaultsOptionsPage(HWND hParent, const RECT & rcDispay)
}
UpdatePageSettings();
SetDlgItemText(IDC_MEMORY_SIZE_TEXT, wGS(ROM_MEM_SIZE).c_str());
SetDlgItemText(IDC_MEMORY_SIZE_KNOWN_TEXT, wGS(ROM_MEM_SIZE_KNOWN).c_str());
SetDlgItemText(IDC_MEMORY_SIZE_UNKOWN_TEXT, wGS(ROM_MEM_SIZE_UNKNOWN).c_str());
SetDlgItemText(IDC_HLE_GFX, wGS(PLUG_HLE_GFX).c_str());
SetDlgItemText(IDC_VIREFESH_TEXT, wGS(ROM_VIREFRESH).c_str());
SetDlgItemText(IDC_COUNTPERBYTE_TEXT, wGS(ROM_COUNTPERBYTE).c_str());
@ -22,7 +23,15 @@ CDefaultsOptionsPage::CDefaultsOptionsPage(HWND hParent, const RECT & rcDispay)
SetDlgItemText(IDC_DISKSEEKTIMING_TEXT1, wGS(ROM_DISK_SEEK_TIMING).c_str());
CModifiedComboBox * ComboBox;
ComboBox = AddModComboBox(GetDlgItem(IDC_RDRAM_SIZE), Default_RDRamSize);
ComboBox = AddModComboBox(GetDlgItem(IDC_RDRAM_SIZE_KNOWN), Default_RDRamSizeUnknown);
if (ComboBox)
{
ComboBox->SetTextField(GetDlgItem(IDC_MEMORY_SIZE_TEXT));
ComboBox->AddItem(wGS(RDRAM_4MB).c_str(), 0x400000);
ComboBox->AddItem(wGS(RDRAM_8MB).c_str(), 0x800000);
}
ComboBox = AddModComboBox(GetDlgItem(IDC_RDRAM_SIZE_UNKNOWN), Default_RDRamSizeKnown);
if (ComboBox)
{
ComboBox->SetTextField(GetDlgItem(IDC_MEMORY_SIZE_TEXT));

View File

@ -11,7 +11,8 @@ class CDefaultsOptionsPage :
COMMAND_ID_HANDLER_EX(IDC_ROM_FIXEDAUDIO, CheckBoxChanged);
COMMAND_ID_HANDLER_EX(IDC_RANDOMIZE_SIPI_INTERRUPTS, CheckBoxChanged);
COMMAND_ID_HANDLER_EX(IDC_PROTECT_MEMORY, CheckBoxChanged);
COMMAND_HANDLER_EX(IDC_RDRAM_SIZE, LBN_SELCHANGE, ComboBoxChanged);
COMMAND_HANDLER_EX(IDC_RDRAM_SIZE_KNOWN, LBN_SELCHANGE, ComboBoxChanged);
COMMAND_HANDLER_EX(IDC_RDRAM_SIZE_UNKNOWN, LBN_SELCHANGE, ComboBoxChanged);
COMMAND_HANDLER_EX(IDC_COUNTFACT, LBN_SELCHANGE, ComboBoxChanged);
COMMAND_HANDLER_EX(IDC_DISKSEEKTIMING, LBN_SELCHANGE, ComboBoxChanged);
COMMAND_HANDLER_EX(IDC_VIREFRESH, EN_UPDATE, EditBoxChanged);

View File

@ -1232,22 +1232,24 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
LTEXT "Memory Size:",IDC_MEMORY_SIZE_TEXT,6,8,91,10
COMBOBOX IDC_RDRAM_SIZE,102,6,109,49,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Counter Factor:",IDC_COUNTFACT_TEXT,6,22,91,10
COMBOBOX IDC_COUNTFACT,102,21,109,49,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Vi Refresh Rate:",IDC_VIREFESH_TEXT,6,38,91,10
EDITTEXT IDC_VIREFRESH,102,36,109,12,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "AI Count Per Byte:",IDC_COUNTPERBYTE_TEXT,6,52,91,10
EDITTEXT IDC_COUNTPERBYTE,102,51,109,12,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "Disk Seek Timing:",IDC_DISKSEEKTIMING_TEXT1,6,67,91,10
COMBOBOX IDC_DISKSEEKTIMING,102,65,109,49,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Fixed Audio Timing",IDC_ROM_FIXEDAUDIO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,80,91,10
CONTROL "Sync using Audio",IDC_SYNC_AUDIO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,80,91,10
CONTROL "Use High Level GFX",IDC_HLE_GFX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,92,91,10
LTEXT "Memory Size (Known):",IDC_MEMORY_SIZE_KNOWN_TEXT,6,8,91,10
COMBOBOX IDC_RDRAM_SIZE_KNOWN,102,6,109,49,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Memory Size (Unknown):",IDC_MEMORY_SIZE_UNKOWN_TEXT,6,23,91,10
COMBOBOX IDC_RDRAM_SIZE_UNKNOWN,102,21,109,49,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Counter Factor:",IDC_COUNTFACT_TEXT,6,37,91,10
COMBOBOX IDC_COUNTFACT,102,36,109,49,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Vi Refresh Rate:",IDC_VIREFESH_TEXT,6,53,91,10
EDITTEXT IDC_VIREFRESH,102,51,109,12,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "AI Count Per Byte:",IDC_COUNTPERBYTE_TEXT,6,67,91,10
EDITTEXT IDC_COUNTPERBYTE,102,66,109,12,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "Disk Seek Timing:",IDC_DISKSEEKTIMING_TEXT1,6,82,91,10
COMBOBOX IDC_DISKSEEKTIMING,102,80,109,49,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Fixed Audio Timing",IDC_ROM_FIXEDAUDIO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,95,91,10
CONTROL "Sync using Audio",IDC_SYNC_AUDIO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,95,91,10
CONTROL "Use High Level GFX",IDC_HLE_GFX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,107,91,10
CONTROL "Randomize SI/PI interrupts",IDC_RANDOMIZE_SIPI_INTERRUPTS,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,92,107,10
CONTROL "Protect Memory",IDC_PROTECT_MEMORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,104,91,10
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,107,107,10
CONTROL "Protect Memory",IDC_PROTECT_MEMORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,119,91,10
END
IDD_Enhancement_Config DIALOGEX 0, 0, 206, 214

View File

@ -227,6 +227,7 @@
#define IDC_VERSION 1087
#define IDC_CPU_TYPE 1088
#define IDC_SELECT_LANG 1088
#define IDC_RDRAM_SIZE_UNKNOWN 1088
#define IDC_SAVE_TYPE 1089
#define IDC_MENU_ITEMS 1089
#define IDC_PAGELIST 1090
@ -857,6 +858,9 @@
#define IDC_REMOVE_BTN 1734
#define IDC_ADD_BTN 1735
#define IDC_AUTORUN_LIST 1737
#define IDC_RDRAM_SIZE_KNOWN 1738
#define IDC_MEMORY_SIZE_UNKOWN_TEXT 1739
#define IDC_MEMORY_SIZE_KNOWN_TEXT 1740
#define ID_POPUPMENU_PLAYGAMEWITHDISK 40008
#define ID_POPUPMENU_ADDSYMBOL 40013
#define ID_POPUPMENU_VIEWDISASM 40017
@ -931,7 +935,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 228
#define _APS_NEXT_COMMAND_VALUE 40122
#define _APS_NEXT_CONTROL_VALUE 1738
#define _APS_NEXT_CONTROL_VALUE 1741
#define _APS_NEXT_SYMED_VALUE 102
#endif
#endif