Skip to content

Commit

Permalink
Merge pull request #1292 from FioraAeterna/enablebats
Browse files Browse the repository at this point in the history
Make EnableBATs an option instead of disabling it entirely
  • Loading branch information
comex committed Oct 21, 2014
2 parents 78deebd + c74b4df commit c048691
Show file tree
Hide file tree
Showing 27 changed files with 48 additions and 30 deletions.
2 changes: 1 addition & 1 deletion Data/Sys/GameSettings/GBSE8P.ini
Expand Up @@ -2,7 +2,7 @@

[Core]
# Values set here will override the main dolphin settings.
EnableFPRF = True
FPRF = True

[EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set.
Expand Down
2 changes: 1 addition & 1 deletion Data/Sys/GameSettings/GBSP8P.ini
Expand Up @@ -2,7 +2,7 @@

[Core]
# Values set here will override the main dolphin settings.
EnableFPRF = True
FPRF = True

[EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set.
Expand Down
2 changes: 1 addition & 1 deletion Data/Sys/GameSettings/GF7E01.ini
Expand Up @@ -2,7 +2,7 @@

[Core]
# Values set here will override the main dolphin settings.
EnableFPRF = True
FPRF = True

[EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set.
Expand Down
2 changes: 1 addition & 1 deletion Data/Sys/GameSettings/GF7P01.ini
Expand Up @@ -2,7 +2,7 @@

[Core]
# Values set here will override the main dolphin settings.
EnableFPRF = True
FPRF = True

[EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set.
Expand Down
2 changes: 1 addition & 1 deletion Data/Sys/GameSettings/GFZE01.ini
Expand Up @@ -2,7 +2,7 @@

[Core]
# Values set here will override the main dolphin settings.
EnableFPRF = True
FPRF = True

[EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set.
Expand Down
2 changes: 1 addition & 1 deletion Data/Sys/GameSettings/GFZJ01.ini
Expand Up @@ -2,7 +2,7 @@

[Core]
# Values set here will override the main dolphin settings.
EnableFPRF = True
FPRF = True

[EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set.
Expand Down
2 changes: 1 addition & 1 deletion Data/Sys/GameSettings/GFZP01.ini
Expand Up @@ -2,7 +2,7 @@

[Core]
# Values set here will override the main dolphin settings.
EnableFPRF = True
FPRF = True

[EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set.
Expand Down
2 changes: 1 addition & 1 deletion Data/Sys/GameSettings/GM2E8P.ini
Expand Up @@ -2,7 +2,7 @@

[Core]
# Values set here will override the main dolphin settings.
EnableFPRF=True
FPRF = True

[EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set.
Expand Down
2 changes: 1 addition & 1 deletion Data/Sys/GameSettings/GM2J8P.ini
Expand Up @@ -2,7 +2,7 @@

[Core]
# Values set here will override the main dolphin settings.
EnableFPRF=True
FPRF = True

[EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set.
Expand Down
2 changes: 1 addition & 1 deletion Data/Sys/GameSettings/GM2P8P.ini
Expand Up @@ -2,7 +2,7 @@

[Core]
# Values set here will override the main dolphin settings.
EnableFPRF=True
FPRF = True

[EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set.
Expand Down
2 changes: 1 addition & 1 deletion Data/Sys/GameSettings/GMBE8P.ini
Expand Up @@ -2,7 +2,7 @@

[Core]
# Values set here will override the main dolphin settings.
EnableFPRF=True
FPRF = True
# Values set here will override the main dolphin settings.

[EmuState]
Expand Down
2 changes: 1 addition & 1 deletion Data/Sys/GameSettings/GMBJ8P.ini
Expand Up @@ -2,7 +2,7 @@

[Core]
# Values set here will override the main dolphin settings.
EnableFPRF=True
FPRF = True
# Values set here will override the main dolphin settings.

[EmuState]
Expand Down
2 changes: 1 addition & 1 deletion Data/Sys/GameSettings/GMBP8P.ini
Expand Up @@ -2,7 +2,7 @@

[Core]
# Values set here will override the main dolphin settings.
EnableFPRF=True
FPRF = True
# Values set here will override the main dolphin settings.

[EmuState]
Expand Down
2 changes: 1 addition & 1 deletion Data/Sys/GameSettings/GVSE8P.ini
Expand Up @@ -2,7 +2,7 @@

[Core]
# Values set here will override the main dolphin settings.
EnableFPRF=True
FPRF = True

[EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set.
Expand Down
2 changes: 1 addition & 1 deletion Data/Sys/GameSettings/GVSP8P.ini
Expand Up @@ -2,7 +2,7 @@

[Core]
# Values set here will override the main dolphin settings.
EnableFPRF=True
FPRF = True

[EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set.
Expand Down
2 changes: 1 addition & 1 deletion Data/Sys/GameSettings/JACP01.ini
Expand Up @@ -2,7 +2,7 @@

[Core]
# Values set here will override the main dolphin settings.
EnableFPRF=True
FPRF = True

[EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set.
Expand Down
2 changes: 1 addition & 1 deletion Data/Sys/GameSettings/RSME8P.ini
Expand Up @@ -2,7 +2,7 @@

[Core]
# Values set here will override the main dolphin settings.
EnableFPRF = True
FPRF = True

[EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set.
Expand Down
2 changes: 1 addition & 1 deletion Data/Sys/GameSettings/RSMJ8P.ini
Expand Up @@ -2,7 +2,7 @@

[Core]
# Values set here will override the main dolphin settings.
EnableFPRF = True
FPRF = True

[EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set.
Expand Down
2 changes: 1 addition & 1 deletion Data/Sys/GameSettings/RSMP8P.ini
Expand Up @@ -2,7 +2,7 @@

[Core]
# Values set here will override the main dolphin settings.
EnableFPRF = True
FPRF = True

[EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set.
Expand Down
2 changes: 1 addition & 1 deletion Data/Sys/GameSettings/SMBE8P.ini
Expand Up @@ -2,7 +2,7 @@

[Core]
# Values set here will override the main dolphin settings.
EnableFPRF=True
FPRF = True

[EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set.
Expand Down
2 changes: 1 addition & 1 deletion Data/Sys/GameSettings/SMBP8P.ini
Expand Up @@ -2,7 +2,7 @@

[Core]
# Values set here will override the main dolphin settings.
EnableFPRF=True
FPRF = True

[EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set.
Expand Down
5 changes: 4 additions & 1 deletion Source/Core/Core/BootManager.cpp
Expand Up @@ -47,7 +47,7 @@ namespace BootManager
// Apply fire liberally
struct ConfigCache
{
bool valid, bCPUThread, bSkipIdle, bEnableFPRF, bMMU, bDCBZOFF, m_EnableJIT, bDSPThread,
bool valid, bCPUThread, bSkipIdle, bEnableFPRF, bBAT, bMMU, bDCBZOFF, m_EnableJIT, bDSPThread,
bVBeamSpeedHack, bSyncGPU, bFastDiscSpeed, bMergeBlocks, bDSPHLE, bHLE_BS2, bProgressive;
int iCPUCore, Volume;
int iWiimoteSource[MAX_BBMOTES];
Expand Down Expand Up @@ -114,6 +114,7 @@ bool BootCore(const std::string& _rFilename)
config_cache.bSkipIdle = StartUp.bSkipIdle;
config_cache.iCPUCore = StartUp.iCPUCore;
config_cache.bEnableFPRF = StartUp.bEnableFPRF;
config_cache.bBAT = StartUp.bBAT;
config_cache.bMMU = StartUp.bMMU;
config_cache.bDCBZOFF = StartUp.bDCBZOFF;
config_cache.bVBeamSpeedHack = StartUp.bVBeamSpeedHack;
Expand Down Expand Up @@ -156,6 +157,7 @@ bool BootCore(const std::string& _rFilename)
core_section->Get("CPUThread", &StartUp.bCPUThread, StartUp.bCPUThread);
core_section->Get("SkipIdle", &StartUp.bSkipIdle, StartUp.bSkipIdle);
core_section->Get("EnableFPRF", &StartUp.bEnableFPRF, StartUp.bEnableFPRF);
core_section->Get("BAT", &StartUp.bEnableFPRF, StartUp.bBAT);
core_section->Get("MMU", &StartUp.bMMU, StartUp.bMMU);
core_section->Get("DCBZ", &StartUp.bDCBZOFF, StartUp.bDCBZOFF);
core_section->Get("VBeam", &StartUp.bVBeamSpeedHack, StartUp.bVBeamSpeedHack);
Expand Down Expand Up @@ -282,6 +284,7 @@ void Stop()
StartUp.bSkipIdle = config_cache.bSkipIdle;
StartUp.iCPUCore = config_cache.iCPUCore;
StartUp.bEnableFPRF = config_cache.bEnableFPRF;
StartUp.bBAT = config_cache.bBAT;
StartUp.bMMU = config_cache.bMMU;
StartUp.bDCBZOFF = config_cache.bDCBZOFF;
StartUp.bVBeamSpeedHack = config_cache.bVBeamSpeedHack;
Expand Down
4 changes: 3 additions & 1 deletion Source/Core/Core/CoreParameter.cpp
Expand Up @@ -39,7 +39,8 @@ SCoreStartupParameter::SCoreStartupParameter()
bMergeBlocks(false), bEnableMemcardSaving(true),
bDPL2Decoder(false), iLatency(14),
bRunCompareServer(false), bRunCompareClient(false),
bMMU(false), bDCBZOFF(false), iBBDumpPort(0), bVBeamSpeedHack(false),
bMMU(false), bBAT(false), bDCBZOFF(false),
iBBDumpPort(0), bVBeamSpeedHack(false),
bSyncGPU(false), bFastDiscSpeed(false),
SelectedLanguage(0), bWii(false),
bConfirmStop(false), bHideCursor(false),
Expand Down Expand Up @@ -73,6 +74,7 @@ void SCoreStartupParameter::LoadDefaults()
bDSPThread = true;
bFastmem = true;
bEnableFPRF = false;
bBAT = false;
bMMU = false;
bDCBZOFF = false;
iBBDumpPort = -1;
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/CoreParameter.h
Expand Up @@ -160,6 +160,7 @@ struct SCoreStartupParameter
bool bRunCompareServer;
bool bRunCompareClient;

bool bBAT;
bool bMMU;
bool bDCBZOFF;
int iBBDumpPort;
Expand Down
14 changes: 8 additions & 6 deletions Source/Core/Core/HW/MemmapFunctions.cpp
Expand Up @@ -944,12 +944,14 @@ u32 TranslateAddress(const u32 _Address, const XCheckTLBFlag _Flag)
// Check MSR[DR] bit before translating data addresses
//if (((_Flag == FLAG_READ) || (_Flag == FLAG_WRITE)) && !(MSR & (1 << (31 - 27)))) return _Address;

// Technically we should do this, but no known games, even heavy MMU ones, use any custom BATs whatsoever,
// so it's a waste of time and should never succeed (given the default BATs are already handled in
// ReadFromHardware/WriteToHardware).
//u32 tlb_addr = TranslateBlockAddress(_Address, _Flag);
//if (!tlb_addr)
// return tlb_addr;
// Technically we should do this, but almost no games, even heavy MMU ones, use any custom BATs whatsoever,
// so only do it where it's really needed.
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bBAT)
{
u32 tlb_addr = TranslateBlockAddress(_Address, _Flag);
if (tlb_addr)
return tlb_addr;
}
return TranslatePageAddress(_Address, _Flag);
}
} // namespace
10 changes: 10 additions & 0 deletions Source/Core/DolphinWX/ISOProperties.cpp
Expand Up @@ -389,8 +389,12 @@ void CISOProperties::CreateGUIControls(bool IsWad)
SkipIdle = new wxCheckBox(m_GameConfig, ID_IDLESKIP, _("Enable Idle Skipping"), wxDefaultPosition, wxDefaultSize, GetElementStyle("Core", "SkipIdle"));
MMU = new wxCheckBox(m_GameConfig, ID_MMU, _("Enable MMU"), wxDefaultPosition, wxDefaultSize, GetElementStyle("Core", "MMU"));
MMU->SetToolTip(_("Enables the Memory Management Unit, needed for some games. (ON = Compatible, OFF = Fast)"));
BAT = new wxCheckBox(m_GameConfig, ID_MMU, _("Enable BAT"), wxDefaultPosition, wxDefaultSize, GetElementStyle("Core", "BAT"));
BAT->SetToolTip(_("Enables Block Address Translation, needed for a few games. Requires MMU. (ON = Compatible, OFF = Fast)"));
DCBZOFF = new wxCheckBox(m_GameConfig, ID_DCBZOFF, _("Skip DCBZ clearing"), wxDefaultPosition, wxDefaultSize, GetElementStyle("Core", "DCBZ"));
DCBZOFF->SetToolTip(_("Bypass the clearing of the data cache by the DCBZ instruction. Usually leave this option disabled."));
FPRF = new wxCheckBox(m_GameConfig, ID_MMU, _("Enable FPRF"), wxDefaultPosition, wxDefaultSize, GetElementStyle("Core", "FPRF"));
FPRF->SetToolTip(_("Enables Floating Point Result Flag calculation, needed for a few games. (ON = Compatible, OFF = Fast)"));
VBeam = new wxCheckBox(m_GameConfig, ID_VBEAM, _("VBeam Speed Hack"), wxDefaultPosition, wxDefaultSize, GetElementStyle("Core", "VBeam"));
VBeam->SetToolTip(_("Doubles the emulated GPU clock rate. May speed up some games (ON = Fast, OFF = Compatible)"));
SyncGPU = new wxCheckBox(m_GameConfig, ID_SYNCGPU, _("Synchronize GPU thread"), wxDefaultPosition, wxDefaultSize, GetElementStyle("Core", "SyncGPU"));
Expand Down Expand Up @@ -419,8 +423,10 @@ void CISOProperties::CreateGUIControls(bool IsWad)
new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Core"));
sbCoreOverrides->Add(CPUThread, 0, wxLEFT, 5);
sbCoreOverrides->Add(SkipIdle, 0, wxLEFT, 5);
sbCoreOverrides->Add(BAT, 0, wxLEFT, 5);
sbCoreOverrides->Add(MMU, 0, wxLEFT, 5);
sbCoreOverrides->Add(DCBZOFF, 0, wxLEFT, 5);
sbCoreOverrides->Add(FPRF, 0, wxLEFT, 5);
sbCoreOverrides->Add(VBeam, 0, wxLEFT, 5);
sbCoreOverrides->Add(SyncGPU, 0, wxLEFT, 5);
sbCoreOverrides->Add(FastDiscSpeed, 0, wxLEFT, 5);
Expand Down Expand Up @@ -1002,7 +1008,9 @@ void CISOProperties::LoadGameConfig()
SetCheckboxValueFromGameini("Core", "CPUThread", CPUThread);
SetCheckboxValueFromGameini("Core", "SkipIdle", SkipIdle);
SetCheckboxValueFromGameini("Core", "MMU", MMU);
SetCheckboxValueFromGameini("Core", "BAT", BAT);
SetCheckboxValueFromGameini("Core", "DCBZ", DCBZOFF);
SetCheckboxValueFromGameini("Core", "FPRF", FPRF);
SetCheckboxValueFromGameini("Core", "VBeam", VBeam);
SetCheckboxValueFromGameini("Core", "SyncGPU", SyncGPU);
SetCheckboxValueFromGameini("Core", "FastDiscSpeed", FastDiscSpeed);
Expand Down Expand Up @@ -1075,7 +1083,9 @@ bool CISOProperties::SaveGameConfig()
SaveGameIniValueFrom3StateCheckbox("Core", "CPUThread", CPUThread);
SaveGameIniValueFrom3StateCheckbox("Core", "SkipIdle", SkipIdle);
SaveGameIniValueFrom3StateCheckbox("Core", "MMU", MMU);
SaveGameIniValueFrom3StateCheckbox("Core", "BAT", BAT);
SaveGameIniValueFrom3StateCheckbox("Core", "DCBZ", DCBZOFF);
SaveGameIniValueFrom3StateCheckbox("Core", "FPRF", FPRF);
SaveGameIniValueFrom3StateCheckbox("Core", "VBeam", VBeam);
SaveGameIniValueFrom3StateCheckbox("Core", "SyncGPU", SyncGPU);
SaveGameIniValueFrom3StateCheckbox("Core", "FastDiscSpeed", FastDiscSpeed);
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/DolphinWX/ISOProperties.h
Expand Up @@ -67,7 +67,7 @@ class CISOProperties : public wxDialog
DECLARE_EVENT_TABLE();

// Core
wxCheckBox *CPUThread, *SkipIdle, *MMU, *DCBZOFF;
wxCheckBox *CPUThread, *SkipIdle, *MMU, *BAT, *DCBZOFF, *FPRF;
wxCheckBox *VBeam, *SyncGPU, *FastDiscSpeed, *BlockMerging, *DSPHLE;
// Wii
wxCheckBox *EnableWideScreen;
Expand Down

0 comments on commit c048691

Please sign in to comment.