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
This commit is contained in:
skidau 2010-10-15 21:46:51 +00:00
parent 8e6a866a5b
commit c4c56d3146
9 changed files with 33 additions and 29 deletions

View File

@ -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

View File

@ -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;

View File

@ -83,7 +83,7 @@ struct SCoreStartupParameter
bool bMMUBAT;
int iTLBHack;
bool bAlternateRFI;
bool bEmulateDiscSpeed;
bool bFastDiscSpeed;
int SelectedLanguage;

View File

@ -24,7 +24,7 @@
#include "StringUtil.h"
#include "PluginManager.h"
#define MAX_SLICE_LENGTH 32000
#define MAX_SLICE_LENGTH 20000
namespace CoreTiming
{

View File

@ -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;
}

View File

@ -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)
{

View File

@ -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)

View File

@ -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");

View File

@ -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