From c4c56d3146d9fe101358204306401ebd951a8699 Mon Sep 17 00:00:00 2001 From: skidau Date: Fri, 15 Oct 2010 21:46:51 +0000 Subject: [PATCH] Added Wii disc speed emulation Added disc access time emulation Enabled the disc transfer speed by default Changed the system timing back to the pre-r6090 default (thanks to tsilibourditsas for testing) Changed the game property to "Speed up disc transfer rate". Leave this disabled for the most compatible setting. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6284 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/ConfigManager.cpp | 2 +- Source/Core/Core/Src/CoreParameter.cpp | 4 +-- Source/Core/Core/Src/CoreParameter.h | 2 +- Source/Core/Core/Src/CoreTiming.cpp | 2 +- Source/Core/Core/Src/HW/DVDInterface.cpp | 28 ++++++++++++--------- Source/Core/Core/Src/LuaInterface.cpp | 2 +- Source/Core/DolphinWX/Src/BootManager.cpp | 2 +- Source/Core/DolphinWX/Src/ISOProperties.cpp | 18 ++++++------- Source/Core/DolphinWX/Src/ISOProperties.h | 2 +- 9 files changed, 33 insertions(+), 29 deletions(-) diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp index 8a1c111d48..a97c325251 100644 --- a/Source/Core/Core/Src/ConfigManager.cpp +++ b/Source/Core/Core/Src/ConfigManager.cpp @@ -292,7 +292,7 @@ void SConfig::LoadSettings() ini.Get("Core", "MMU", &m_LocalCoreStartupParameter.bMMU, false); ini.Get("Core", "TLBHack", &m_LocalCoreStartupParameter.iTLBHack, 0); ini.Get("Core", "AlternateRFI", &m_LocalCoreStartupParameter.bAlternateRFI, false); - ini.Get("Core", "EmulateDiscSpeed", &m_LocalCoreStartupParameter.bEmulateDiscSpeed, false); + ini.Get("Core", "FastDiscSpeed", &m_LocalCoreStartupParameter.bFastDiscSpeed, false); ini.Get("Core", "BAT", &m_LocalCoreStartupParameter.bMMUBAT, false); ini.Get("Core", "FrameLimit", &m_Framelimit, 1); // auto frame limit by default ini.Get("Core", "UseFPS", &b_UseFPS, false); // use vps as default diff --git a/Source/Core/Core/Src/CoreParameter.cpp b/Source/Core/Core/Src/CoreParameter.cpp index 6ee991eb71..8a712f798e 100644 --- a/Source/Core/Core/Src/CoreParameter.cpp +++ b/Source/Core/Core/Src/CoreParameter.cpp @@ -49,7 +49,7 @@ SCoreStartupParameter::SCoreStartupParameter() bMergeBlocks(false), bRunCompareServer(false), bRunCompareClient(false), bMMU(false), bMMUBAT(false), iTLBHack(0), bAlternateRFI(false), - bEmulateDiscSpeed(false), + bFastDiscSpeed(false), SelectedLanguage(0), bWii(false), bConfirmStop(false), bHideCursor(false), bAutoHideCursor(false), bUsePanicHandlers(true), @@ -76,7 +76,7 @@ void SCoreStartupParameter::LoadDefaults() bMMUBAT = false; iTLBHack = 0; bAlternateRFI = false; - bEmulateDiscSpeed = false; + bFastDiscSpeed = false; bMergeBlocks = false; SelectedLanguage = 0; bWii = false; diff --git a/Source/Core/Core/Src/CoreParameter.h b/Source/Core/Core/Src/CoreParameter.h index 3fe1d15d27..03c8f4e6f6 100644 --- a/Source/Core/Core/Src/CoreParameter.h +++ b/Source/Core/Core/Src/CoreParameter.h @@ -83,7 +83,7 @@ struct SCoreStartupParameter bool bMMUBAT; int iTLBHack; bool bAlternateRFI; - bool bEmulateDiscSpeed; + bool bFastDiscSpeed; int SelectedLanguage; diff --git a/Source/Core/Core/Src/CoreTiming.cpp b/Source/Core/Core/Src/CoreTiming.cpp index 459df3935b..0a8e79a338 100644 --- a/Source/Core/Core/Src/CoreTiming.cpp +++ b/Source/Core/Core/Src/CoreTiming.cpp @@ -24,7 +24,7 @@ #include "StringUtil.h" #include "PluginManager.h" -#define MAX_SLICE_LENGTH 32000 +#define MAX_SLICE_LENGTH 20000 namespace CoreTiming { diff --git a/Source/Core/Core/Src/HW/DVDInterface.cpp b/Source/Core/Core/Src/HW/DVDInterface.cpp index d9d5d36945..dc712c8f37 100644 --- a/Source/Core/Core/Src/HW/DVDInterface.cpp +++ b/Source/Core/Core/Src/HW/DVDInterface.cpp @@ -30,7 +30,11 @@ #include "../VolumeHandler.h" // Disc transfer rate measured in bytes per second -#define DISC_TRANSFER_RATE (3125 * 1024) +#define DISC_TRANSFER_RATE_GC (3125 * 1024) +#define DISC_TRANSFER_RATE_WII (7926 * 1024) + +// Disc access time measured in seconds +#define DISC_ACCESS_TIME (128 / 1000) namespace DVDInterface { @@ -223,7 +227,6 @@ void UpdateInterrupts(); void GenerateDIInterrupt(DI_InterruptType _DVDInterrupt); void ExecuteCommand(UDICR& _DICR); - void DoState(PointerWrap &p) { p.Do(m_DISR); @@ -460,10 +463,12 @@ void Write32(const u32 _iValue, const u32 _iAddress) m_DICR.Hex = _iValue & 7; if (m_DICR.TSTART) { - if (SConfig::GetInstance().m_LocalCoreStartupParameter.bEmulateDiscSpeed) + if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bFastDiscSpeed) { - u64 ticksUntilTC = m_DILENGTH.Length * (SystemTimers::GetTicksPerSecond() / DISC_TRANSFER_RATE); - CoreTiming::ScheduleEvent(ticksUntilTC, tc); + u64 ticksUntilTC = m_DILENGTH.Length * + (SystemTimers::GetTicksPerSecond() / (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii?DISC_TRANSFER_RATE_WII:DISC_TRANSFER_RATE_GC)) + + (SystemTimers::GetTicksPerSecond() * DISC_ACCESS_TIME); + CoreTiming::ScheduleEvent((int)ticksUntilTC, tc); } else { @@ -589,29 +594,29 @@ void ExecuteCommand(UDICR& _DICR) { case 0x80000000: ERROR_LOG(DVDINTERFACE, "GC-AM: READ MEDIA BOARD STATUS (80000000)"); - for (int i = 0; i < m_DILENGTH.Length / 4; i++) + for (u32 i = 0; i < m_DILENGTH.Length / 4; i++) Memory::Write_U32(0, m_DIMAR.Address + i * 4); break; case 0x80000040: ERROR_LOG(DVDINTERFACE, "GC-AM: READ MEDIA BOARD STATUS (2) (80000040)"); - for (int i = 0; i < m_DILENGTH.Length / 4; i++) + for (u32 i = 0; i < m_DILENGTH.Length / 4; i++) Memory::Write_U32(~0, m_DIMAR.Address + i * 4); Memory::Write_U32(0x00000020, m_DIMAR.Address); // DIMM SIZE, LE Memory::Write_U32(0x4743414D, m_DIMAR.Address + 4); // GCAM signature break; case 0x80000120: ERROR_LOG(DVDINTERFACE, "GC-AM: READ FIRMWARE STATUS (80000120)"); - for (int i = 0; i < m_DILENGTH.Length / 4; i++) + for (u32 i = 0; i < m_DILENGTH.Length / 4; i++) Memory::Write_U32(0x01010101, m_DIMAR.Address + i * 4); break; case 0x80000140: ERROR_LOG(DVDINTERFACE, "GC-AM: READ FIRMWARE STATUS (80000140)"); - for (int i = 0; i < m_DILENGTH.Length / 4; i++) + for (u32 i = 0; i < m_DILENGTH.Length / 4; i++) Memory::Write_U32(0x01010101, m_DIMAR.Address + i * 4); break; case 0x84000020: ERROR_LOG(DVDINTERFACE, "GC-AM: READ MEDIA BOARD STATUS (1) (84000020)"); - for (int i = 0; i < m_DILENGTH.Length / 4; i++) + for (u32 i = 0; i < m_DILENGTH.Length / 4; i++) Memory::Write_U32(0x00000000, m_DIMAR.Address + i * 4); break; default: @@ -624,8 +629,7 @@ void ExecuteCommand(UDICR& _DICR) { ERROR_LOG(DVDINTERFACE, "GC-AM: READ MEDIA BOARD COMM AREA (1f900020)"); memcpy(Memory::GetPointer(m_DIMAR.Address), media_buffer + iDVDOffset - 0x1f900000, m_DILENGTH.Length); - unsigned int i; - for (i = 0; i < m_DILENGTH.Length; i += 4) + for (u32 i = 0; i < m_DILENGTH.Length; i += 4) ERROR_LOG(DVDINTERFACE, "GC-AM: %08x", Memory::Read_U32(m_DIMAR.Address + i)); break; } diff --git a/Source/Core/Core/Src/LuaInterface.cpp b/Source/Core/Core/Src/LuaInterface.cpp index 74d91d59d8..6ace074c45 100644 --- a/Source/Core/Core/Src/LuaInterface.cpp +++ b/Source/Core/Core/Src/LuaInterface.cpp @@ -2801,7 +2801,7 @@ DEFINE_LUA_FUNCTION(emulua_loadrom, "filename") game_ini.Get("Core", "BAT", &StartUp.bMMUBAT, StartUp.bMMUBAT); game_ini.Get("Core", "TLBHack", &StartUp.iTLBHack, StartUp.iTLBHack); game_ini.Get("Core", "AlternateRFI", &StartUp.bAlternateRFI, StartUp.bAlternateRFI); - game_ini.Get("Core", "EmulateDiscSpeed", &StartUp.bEmulateDiscSpeed, StartUp.bEmulateDiscSpeed); + game_ini.Get("Core", "FastDiscSpeed", &StartUp.bFastDiscSpeed, StartUp.bFastDiscSpeed); // Wii settings if (StartUp.bWii) { diff --git a/Source/Core/DolphinWX/Src/BootManager.cpp b/Source/Core/DolphinWX/Src/BootManager.cpp index d339b23de0..e8aa5cf713 100644 --- a/Source/Core/DolphinWX/Src/BootManager.cpp +++ b/Source/Core/DolphinWX/Src/BootManager.cpp @@ -110,7 +110,7 @@ bool BootCore(const std::string& _rFilename) game_ini.Get("Core", "BAT", &StartUp.bMMUBAT, StartUp.bMMUBAT); game_ini.Get("Core", "TLBHack", &StartUp.iTLBHack, StartUp.iTLBHack); game_ini.Get("Core", "AlternateRFI", &StartUp.bAlternateRFI, StartUp.bAlternateRFI); - game_ini.Get("Core", "EmulateDiscSpeed", &StartUp.bEmulateDiscSpeed, StartUp.bEmulateDiscSpeed); + game_ini.Get("Core", "FastDiscSpeed", &StartUp.bFastDiscSpeed, StartUp.bFastDiscSpeed); game_ini.Get("Core", "BlockMerging", &StartUp.bMergeBlocks, StartUp.bMergeBlocks); // Wii settings if (StartUp.bWii) diff --git a/Source/Core/DolphinWX/Src/ISOProperties.cpp b/Source/Core/DolphinWX/Src/ISOProperties.cpp index 51dd3599e9..ef5da260d8 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.cpp +++ b/Source/Core/DolphinWX/Src/ISOProperties.cpp @@ -301,8 +301,8 @@ void CISOProperties::CreateGUIControls(bool IsWad) TLBHack->SetToolTip(wxT("Fast version of the MMU. Does not work for every game.")); AlternateRFI = new wxCheckBox(m_GameConfig, ID_RFI, _("Alternate RFI"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); AlternateRFI->SetToolTip(wxT("If a game hangs, works only in the Interpreter or Dolphin crashes, this option may fix the game.")); - EmulateDiscSpeed = new wxCheckBox(m_GameConfig, ID_DISCSPEED, _("Emulate Disc Transfer Rate"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); - EmulateDiscSpeed->SetToolTip(wxT("Emulate the speed of the disc drive. Needed for some games. (ON = Compatible, OFF = Fast)")); + FastDiscSpeed = new wxCheckBox(m_GameConfig, ID_DISCSPEED, _("Speed up Disc Transfer Rate"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); + FastDiscSpeed->SetToolTip(wxT("Enable fast disc access. Needed for a few games. (ON = Fast, OFF = Compatible)")); BlockMerging = new wxCheckBox(m_GameConfig, ID_MERGEBLOCKS, _("Enable Block Merging"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); // Wii Console @@ -367,7 +367,7 @@ void CISOProperties::CreateGUIControls(bool IsWad) sbCoreOverrides->Add(MMUBAT, 0, wxEXPAND|wxLEFT, 5); sbCoreOverrides->Add(TLBHack, 0, wxEXPAND|wxLEFT, 5); sbCoreOverrides->Add(AlternateRFI, 0, wxEXPAND|wxLEFT, 5); - sbCoreOverrides->Add(EmulateDiscSpeed, 0, wxEXPAND|wxLEFT, 5); + sbCoreOverrides->Add(FastDiscSpeed, 0, wxEXPAND|wxLEFT, 5); sbCoreOverrides->Add(BlockMerging, 0, wxEXPAND|wxLEFT, 5); sbWiiOverrides->Add(EnableProgressiveScan, 0, wxEXPAND|wxLEFT, 5); sbWiiOverrides->Add(EnableWideScreen, 0, wxEXPAND|wxLEFT, 5); @@ -853,10 +853,10 @@ void CISOProperties::LoadGameConfig() else AlternateRFI->Set3StateValue(wxCHK_UNDETERMINED); - if (GameIni.Get("Core", "EmulateDiscSpeed", &bTemp)) - EmulateDiscSpeed->Set3StateValue((wxCheckBoxState)bTemp); + if (GameIni.Get("Core", "FastDiscSpeed", &bTemp)) + FastDiscSpeed->Set3StateValue((wxCheckBoxState)bTemp); else - EmulateDiscSpeed->Set3StateValue(wxCHK_UNDETERMINED); + FastDiscSpeed->Set3StateValue(wxCHK_UNDETERMINED); if (GameIni.Get("Core", "BlockMerging", &bTemp)) BlockMerging->Set3StateValue((wxCheckBoxState)bTemp); @@ -969,10 +969,10 @@ bool CISOProperties::SaveGameConfig() else GameIni.Set("Core", "AlternateRFI", AlternateRFI->Get3StateValue()); - if (EmulateDiscSpeed->Get3StateValue() == wxCHK_UNDETERMINED) - GameIni.DeleteKey("Core", "EmulateDiscSpeed"); + if (FastDiscSpeed->Get3StateValue() == wxCHK_UNDETERMINED) + GameIni.DeleteKey("Core", "FastDiscSpeed"); else - GameIni.Set("Core", "EmulateDiscSpeed", EmulateDiscSpeed->Get3StateValue()); + GameIni.Set("Core", "FastDiscSpeed", FastDiscSpeed->Get3StateValue()); if (BlockMerging->Get3StateValue() == wxCHK_UNDETERMINED) GameIni.DeleteKey("Core", "BlockMerging"); diff --git a/Source/Core/DolphinWX/Src/ISOProperties.h b/Source/Core/DolphinWX/Src/ISOProperties.h index e6d9bddd38..6a3a0a826c 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.h +++ b/Source/Core/DolphinWX/Src/ISOProperties.h @@ -85,7 +85,7 @@ class CISOProperties : public wxDialog wxStaticText *OverrideText; // Core wxCheckBox *CPUThread, *SkipIdle, *MMU, *MMUBAT, *TLBHack; - wxCheckBox *AlternateRFI, *EmulateDiscSpeed, *BlockMerging; + wxCheckBox *AlternateRFI, *FastDiscSpeed, *BlockMerging; // Wii wxCheckBox *EnableProgressiveScan, *EnableWideScreen; // Video