Add Unaligned DMA options to Defaults and Game Settings

This allows some romhacks to run
This commit is contained in:
oddMLan 2018-12-28 05:09:38 -07:00
parent 2d5a907637
commit dfc6d46e4a
11 changed files with 20 additions and 3 deletions

View File

@ -326,6 +326,7 @@ enum LanguageStringID
ROM_32BIT = 538,
ROM_DELAY_DP = 539,
ROM_OVER_CLOCK_MODIFIER = 5400,
ROM_UNALIGNED_DMA = 5410,
//Core Styles
CORE_INTERPTER = 540,

View File

@ -293,6 +293,7 @@ void CLanguage::LoadDefaultStrings(void)
DEF_STR(ROM_32BIT, "32-bit engine:");
DEF_STR(ROM_DELAY_DP, "Delay DP interrupt:");
DEF_STR(ROM_OVER_CLOCK_MODIFIER, "Over Clock Modifier:");
DEF_STR(ROM_UNALIGNED_DMA, "Unaligned DMA");
//Core Styles
DEF_STR(CORE_INTERPTER, "Interpreter");

View File

@ -201,7 +201,7 @@ void CDMA::PI_DMA_WRITE()
{
/* rounding PI_WR_LEN_REG up to the nearest even number fixes AI Shougi 3, Doraemon 3, etc. */
uint32_t PI_WR_LEN_REG = ((g_Reg->PI_WR_LEN_REG) & 0x00FFFFFEul) + 2;
uint32_t PI_CART_ADDR_REG = g_Reg->PI_CART_ADDR_REG & ~1;
uint32_t PI_CART_ADDR_REG = !g_Settings->LoadBool(Game_UnalignedDMA) ? g_Reg->PI_CART_ADDR_REG & ~1 : g_Reg->PI_CART_ADDR_REG;
g_Reg->PI_STATUS_REG |= PI_STATUS_DMA_BUSY;
if (g_Reg->PI_DRAM_ADDR_REG + PI_WR_LEN_REG > g_MMU->RdramSize())

View File

@ -138,6 +138,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(Default_32Bit, new CSettingTypeApplication("Defaults", "32bit", true));
AddHandler(Default_SyncViaAudio, new CSettingTypeApplication("Defaults", "Audio-Sync Audio", true));
AddHandler(Default_FixedAudio, new CSettingTypeApplication("Defaults", "Audio-Fixed Audio", true));
AddHandler(Default_UnalignedDMA, new CSettingTypeApplication("Defaults", "Unaligned DMA", false));
AddHandler(Rdb_GoodName, new CSettingTypeRomDatabase("Good Name", Game_GameName));
AddHandler(Rdb_SaveChip, new CSettingTypeRDBSaveChip("Save Type", (uint32_t)SaveChip_Auto));
@ -180,6 +181,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(Rdb_AllowROMWrites, new CSettingTypeRDBYesNo("AllowROMWrites", false));
AddHandler(Rdb_CRC_Recalc, new CSettingTypeRDBYesNo("CRC-Recalc", false));
AddHandler(Rdb_OverClockModifier, new CSettingTypeRomDatabase("OverClockModifier", (uint32_t)1));
AddHandler(Rdb_UnalignedDMA, new CSettingTypeRomDatabase("Unaligned DMA", Default_UnalignedDMA));
AddHandler(Game_IniKey, new CSettingTypeTempString(""));
AddHandler(Game_File, new CSettingTypeTempString(""));
@ -238,6 +240,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(Game_LoadSaveAtStart, new CSettingTypeTempBool(false));
AddHandler(Game_OverClockModifier, new CSettingTypeGame("OverClockModifier", Rdb_OverClockModifier));
AddHandler(Game_FullSpeed, new CSettingTypeTempBool(true, "Full Speed"));
AddHandler(Game_UnalignedDMA, new CSettingTypeGame("Unaligned DMA", Rdb_UnalignedDMA));
//User Interface
AddHandler(UserInterface_ShowCPUPer, new CSettingTypeApplication("Settings", "Display CPU Usage", (uint32_t)false));

View File

@ -72,6 +72,7 @@ enum SettingID
Default_32Bit,
Default_SyncViaAudio,
Default_FixedAudio,
Default_UnalignedDMA,
//RDB Settings
Rdb_GoodName,
@ -111,6 +112,7 @@ enum SettingID
Rdb_AllowROMWrites,
Rdb_CRC_Recalc,
Rdb_OverClockModifier,
Rdb_UnalignedDMA,
//Individual Game Settings
Game_IniKey,
@ -166,6 +168,7 @@ enum SettingID
Game_LoadSaveAtStart,
Game_OverClockModifier,
Game_FullSpeed,
Game_UnalignedDMA,
// General Game running info
GameRunning_LoadingInProgress,

View File

@ -28,6 +28,7 @@ CDefaultsOptionsPage::CDefaultsOptionsPage(HWND hParent, const RECT & rcDispay)
SetDlgItemTextW(m_hWnd, IDC_ROM_32BIT, wGS(ROM_32BIT).c_str());
SetDlgItemTextW(m_hWnd, IDC_ROM_FIXEDAUDIO, wGS(ROM_FIXED_AUDIO).c_str());
SetDlgItemTextW(m_hWnd, IDC_SYNC_AUDIO, wGS(ROM_SYNC_AUDIO).c_str());
SetDlgItemTextW(m_hWnd, IDC_UNALIGNED_DMA, wGS(ROM_UNALIGNED_DMA).c_str());
CModifiedComboBox * ComboBox;
ComboBox = AddModComboBox(GetDlgItem(IDC_RDRAM_SIZE), Default_RDRamSize);
@ -60,6 +61,7 @@ CDefaultsOptionsPage::CDefaultsOptionsPage(HWND hParent, const RECT & rcDispay)
AddModCheckBox(GetDlgItem(IDC_ROM_32BIT), Default_32Bit);
AddModCheckBox(GetDlgItem(IDC_SYNC_AUDIO), Default_SyncViaAudio);
AddModCheckBox(GetDlgItem(IDC_ROM_FIXEDAUDIO), Default_FixedAudio);
AddModCheckBox(GetDlgItem(IDC_UNALIGNED_DMA), Default_UnalignedDMA);
if (!g_Settings->LoadBool(Setting_SyncViaAudioEnabled))
{

View File

@ -20,6 +20,7 @@ class CDefaultsOptionsPage :
COMMAND_ID_HANDLER_EX(IDC_ROM_32BIT, CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_SYNC_AUDIO, CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_ROM_FIXEDAUDIO, CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_UNALIGNED_DMA, CheckBoxChanged)
COMMAND_HANDLER_EX(IDC_RDRAM_SIZE, LBN_SELCHANGE, ComboBoxChanged)
COMMAND_HANDLER_EX(IDC_COUNTFACT, LBN_SELCHANGE, ComboBoxChanged)
COMMAND_HANDLER_EX(IDC_VIREFRESH, EN_UPDATE, EditBoxChanged)

View File

@ -37,6 +37,7 @@ CGameGeneralPage::CGameGeneralPage(HWND hParent, const RECT & rcDispay)
SetDlgItemTextW(m_hWnd, IDC_USE_TLB, wGS(ROM_USE_TLB).c_str());
SetDlgItemTextW(m_hWnd, IDC_DELAY_SI, wGS(ROM_DELAY_SI).c_str());
SetDlgItemTextW(m_hWnd, IDC_AUDIO_SIGNAL, wGS(ROM_AUDIO_SIGNAL).c_str());
SetDlgItemTextW(m_hWnd, IDC_UNALIGNED_DMA, wGS(ROM_UNALIGNED_DMA).c_str());
AddModCheckBox(GetDlgItem(IDC_ROM_32BIT), Game_32Bit);
AddModCheckBox(GetDlgItem(IDC_SYNC_AUDIO), Game_SyncViaAudio);
@ -45,6 +46,7 @@ CGameGeneralPage::CGameGeneralPage(HWND hParent, const RECT & rcDispay)
AddModCheckBox(GetDlgItem(IDC_DELAY_DP), Game_DelayDP);
AddModCheckBox(GetDlgItem(IDC_DELAY_SI), Game_DelaySI);
AddModCheckBox(GetDlgItem(IDC_AUDIO_SIGNAL), Game_RspAudioSignal);
AddModCheckBox(GetDlgItem(IDC_UNALIGNED_DMA), Game_UnalignedDMA);
CModifiedComboBox * ComboBox;
ComboBox = AddModComboBox(GetDlgItem(IDC_RDRAM_SIZE), Game_RDRamSize);

View File

@ -28,6 +28,7 @@ class CGameGeneralPage :
COMMAND_ID_HANDLER_EX(IDC_DELAY_DP, CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_DELAY_SI, CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_AUDIO_SIGNAL, CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_UNALIGNED_DMA, CheckBoxChanged)
COMMAND_HANDLER_EX(IDC_VIREFRESH, EN_UPDATE, EditBoxChanged)
COMMAND_HANDLER_EX(IDC_COUNTPERBYTE, EN_UPDATE, EditBoxChanged)
COMMAND_HANDLER_EX(IDC_OVER_CLOCK_MODIFIER, EN_UPDATE, EditBoxChanged)

View File

@ -227,6 +227,7 @@ BEGIN
CONTROL "Delay DP Interrupt",IDC_DELAY_DP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,143,91,10
CONTROL "Delay SI Interrupt",IDC_DELAY_SI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,143,91,10
CONTROL "RSP Audio Signal",IDC_AUDIO_SIGNAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,154,91,10
CONTROL "Unaligned DMA",IDC_UNALIGNED_DMA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,154,91,10
END
IDD_Settings_Accelerator DIALOGEX 0, 0, 218, 183
@ -1275,6 +1276,7 @@ BEGIN
CONTROL "32 Bit Engine",IDC_ROM_32BIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,58,91,10
CONTROL "Fixed Audio Timing",IDC_ROM_FIXEDAUDIO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,69,91,10
CONTROL "Sync using Audio",IDC_SYNC_AUDIO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,69,91,10
CONTROL "Unaligned DMA",IDC_UNALIGNED_DMA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,81,91,10
END

View File

@ -351,6 +351,7 @@
#define IDC_USE_TLB 1157
#define IDC_LAN_DATE 1157
#define IDC_RDB 1158
#define IDC_UNALIGNED_DMA 1158
#define IDC_RDB_AUTHOR 1159
#define IDC_RDB_VERSION 1160
#define IDC_RDB_DATE 1161
@ -640,9 +641,9 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 198
#define _APS_NEXT_RESOURCE_VALUE 199
#define _APS_NEXT_COMMAND_VALUE 40043
#define _APS_NEXT_CONTROL_VALUE 1448
#define _APS_NEXT_CONTROL_VALUE 1449
#define _APS_NEXT_SYMED_VALUE 102
#endif
#endif