Add an option to patch the DelayLoop SWI when loading BIOS images (speed hack).

Will work ONLY with Nintendo BIOS dumps! (the addresses that are overwritten are hardcoded).
This commit is contained in:
luigi__ 2010-01-14 18:55:45 +00:00
parent e03efa73ef
commit d0cfc8d6be
5 changed files with 32 additions and 4 deletions

View File

@ -1852,6 +1852,7 @@ void NDS_exec(s32 nb)
}
//DEBUG_statistics.printSequencerExecutionCounters();
//DEBUG_statistics.print();
//end of frame emulation housekeeping
if(LagFrameFlag)
@ -1941,13 +1942,21 @@ void NDS_Reset()
else
inf = NULL;
if(inf) {
if(inf)
{
fread(MMU.ARM7_BIOS,1,16384,inf);
fclose(inf);
if(CommonSettings.SWIFromBIOS == true) NDS_ARM7.swi_tab = 0;
else NDS_ARM7.swi_tab = ARM7_swi_tab;
if (CommonSettings.PatchSWI3)
_MMU_write16<ARMCPU_ARM7>(0x00002F08, 0x4770);
INFO("ARM7 BIOS is loaded.\n");
} else {
}
else
{
NDS_ARM7.swi_tab = ARM7_swi_tab;
for (int t = 0; t < 16384; t++)
@ -1971,13 +1980,21 @@ void NDS_Reset()
inf = NULL;
//memcpy(MMU.ARM9_BIOS + 0x20, gba_header_data_0x04, 156);
if(inf) {
if(inf)
{
fread(MMU.ARM9_BIOS,1,4096,inf);
fclose(inf);
if(CommonSettings.SWIFromBIOS == true) NDS_ARM9.swi_tab = 0;
else NDS_ARM9.swi_tab = ARM9_swi_tab;
if (CommonSettings.PatchSWI3)
_MMU_write16<ARMCPU_ARM9>(0xFFFF07CC, 0x4770);
INFO("ARM9 BIOS is loaded.\n");
} else {
}
else
{
NDS_ARM9.swi_tab = ARM9_swi_tab;
for (int t = 0; t < 4096; t++)

View File

@ -456,6 +456,7 @@ extern struct TCommonSettings {
, GFX3D_Fog(true)
, UseExtBIOS(false)
, SWIFromBIOS(false)
, PatchSWI3(false)
, UseExtFirmware(false)
, BootFromFirmware(false)
, DebugConsole(false)
@ -484,6 +485,7 @@ extern struct TCommonSettings {
char ARM9BIOS[256];
char ARM7BIOS[256];
bool SWIFromBIOS;
bool PatchSWI3;
bool UseExtFirmware;
char Firmware[256];

View File

@ -2630,6 +2630,7 @@ int _main()
GetPrivateProfileString("BIOS", "ARM9BIOSFile", "bios9.bin", CommonSettings.ARM9BIOS, 256, IniName);
GetPrivateProfileString("BIOS", "ARM7BIOSFile", "bios7.bin", CommonSettings.ARM7BIOS, 256, IniName);
CommonSettings.SWIFromBIOS = GetPrivateProfileBool("BIOS", "SWIFromBIOS", FALSE, IniName);
CommonSettings.PatchSWI3 = GetPrivateProfileBool("BIOS", "PatchSWI3", FALSE, IniName);
CommonSettings.UseExtFirmware = GetPrivateProfileBool("Firmware", "UseExtFirmware", FALSE, IniName);
GetPrivateProfileString("Firmware", "FirmwareFile", "firmware.bin", CommonSettings.Firmware, 256, IniName);
@ -5374,6 +5375,7 @@ LRESULT CALLBACK EmulationSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, L
CheckDlgItem(hDlg,IDC_CHECKBOX_ENSATAEMULATION,CommonSettings.EnsataEmulation);
CheckDlgItem(hDlg,IDC_USEEXTBIOS,CommonSettings.UseExtBIOS);
CheckDlgItem(hDlg, IDC_BIOSSWIS, CommonSettings.SWIFromBIOS);
CheckDlgItem(hDlg, IDC_PATCHSWI3, CommonSettings.PatchSWI3);
SetDlgItemText(hDlg, IDC_ARM9BIOS, CommonSettings.ARM9BIOS);
SetDlgItemText(hDlg, IDC_ARM7BIOS, CommonSettings.ARM7BIOS);
@ -5389,6 +5391,8 @@ LRESULT CALLBACK EmulationSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, L
EnableWindow(cur, FALSE);
cur = GetDlgItem(hDlg, IDC_BIOSSWIS);
EnableWindow(cur, FALSE);
cur = GetDlgItem(hDlg, IDC_PATCHSWI3);
EnableWindow(cur, FALSE);
}
CheckDlgButton(hDlg, IDC_USEEXTFIRMWARE, ((CommonSettings.UseExtFirmware == true) ? BST_CHECKED : BST_UNCHECKED));
@ -5430,6 +5434,7 @@ LRESULT CALLBACK EmulationSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, L
cur = GetDlgItem(hDlg, IDC_ARM7BIOS);
GetWindowText(cur, CommonSettings.ARM7BIOS, 256);
CommonSettings.SWIFromBIOS = IsDlgCheckboxChecked(hDlg, IDC_BIOSSWIS);
CommonSettings.PatchSWI3 = IsDlgCheckboxChecked(hDlg, IDC_PATCHSWI3);
CommonSettings.UseExtFirmware = IsDlgCheckboxChecked(hDlg, IDC_USEEXTFIRMWARE);
cur = GetDlgItem(hDlg, IDC_FIRMWARE);
@ -5445,6 +5450,7 @@ LRESULT CALLBACK EmulationSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, L
WritePrivateProfileString("BIOS", "ARM9BIOSFile", CommonSettings.ARM9BIOS, IniName);
WritePrivateProfileString("BIOS", "ARM7BIOSFile", CommonSettings.ARM7BIOS, IniName);
WritePrivateProfileInt("BIOS", "SWIFromBIOS", ((CommonSettings.SWIFromBIOS == true) ? 1 : 0), IniName);
WritePrivateProfileInt("BIOS", "PatchSWI3", ((CommonSettings.PatchSWI3 == true) ? 1 : 0), IniName);
WritePrivateProfileInt("Firmware", "UseExtFirmware", ((CommonSettings.UseExtFirmware == true) ? 1 : 0), IniName);
WritePrivateProfileString("Firmware", "FirmwareFile", CommonSettings.Firmware, IniName);
@ -5476,6 +5482,8 @@ LRESULT CALLBACK EmulationSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, L
EnableWindow(cur, enable);
cur = GetDlgItem(hDlg, IDC_BIOSSWIS);
EnableWindow(cur, enable);
cur = GetDlgItem(hDlg, IDC_PATCHSWI3);
EnableWindow(cur, enable);
cur = GetDlgItem(hDlg, IDC_FIRMWAREBOOT);
EnableWindow(cur, (enable && IsDlgButtonChecked(hDlg, IDC_USEEXTFIRMWARE)));
}

View File

@ -350,6 +350,7 @@
#define IDC_VISIBLE 1019
#define IDC_USEPHYSICAL 1019
#define IDC_SPLIT1 1021
#define IDC_PATCHSWI3 1022
#define IDC_DEFAULT 1027
#define IDC_3DCORE 1028
#define IDC_TXT_COMPILED 1029

Binary file not shown.