Added a game option to emulate the disc transfer rate. This is needed for some games like Mario Golf and Fire Emblem: Path of Radiance.

Fixes issue 1992.
Fixes issue 2519.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6268 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
skidau
2010-10-11 12:38:17 +00:00
parent 7797b9d753
commit 7733b84bc1
8 changed files with 49 additions and 4 deletions

View File

@ -294,6 +294,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", "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,6 +49,7 @@ SCoreStartupParameter::SCoreStartupParameter()
bMergeBlocks(false),
bRunCompareServer(false), bRunCompareClient(false),
bMMU(false), bMMUBAT(false), iTLBHack(0), bAlternateRFI(false),
bEmulateDiscSpeed(false),
SelectedLanguage(0), bWii(false),
bConfirmStop(false), bHideCursor(false),
bAutoHideCursor(false), bUsePanicHandlers(true),
@ -75,6 +76,7 @@ void SCoreStartupParameter::LoadDefaults()
bMMUBAT = false;
iTLBHack = 0;
bAlternateRFI = false;
bEmulateDiscSpeed = false;
bMergeBlocks = false;
SelectedLanguage = 0;
bWii = false;

View File

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

View File

@ -19,6 +19,7 @@
#include "ChunkFile.h"
#include "../ConfigManager.h"
#include "../CoreTiming.h"
#include "../HW/SystemTimers.h"
#include "StreamADPCM.h" // Core
#include "DVDInterface.h"
@ -28,6 +29,9 @@
#include "Memmap.h"
#include "../VolumeHandler.h"
// Disc transfer rate measured in bytes per second
#define DISC_TRANSFER_RATE (3125 * 1024)
namespace DVDInterface
{
@ -151,7 +155,7 @@ union UDICR
{
u32 TSTART : 1; // w:1 start r:0 ready
u32 DMA : 1; // 1: DMA Mode 0: Immediate Mode (can only do Access Register Command)
u32 RW : 1; // 0: Read Command (DVD to Memory) 1: Write COmmand (Memory to DVD)
u32 RW : 1; // 0: Read Command (DVD to Memory) 1: Write Command (Memory to DVD)
u32 : 29;
};
};
@ -200,6 +204,7 @@ static u32 AudioLength;
u32 g_ErrorCode = 0;
bool g_bDiscInside = false;
bool g_bStream = false;
int tc = 0;
// GC-AM only
static unsigned char media_buffer[0x40];
@ -209,8 +214,10 @@ static unsigned char media_buffer[0x40];
Common::CriticalSection dvdread_section;
static int ejectDisc;
void EjectDiscCallback(u64 userdata, int cyclesLate);
static int insertDisc;
static int executeDVD;
void EjectDiscCallback(u64 userdata, int cyclesLate);
void InsertDiscCallback(u64 userdata, int cyclesLate);
void UpdateInterrupts();
@ -237,6 +244,12 @@ void DoState(PointerWrap &p)
p.Do(g_bDiscInside);
}
void TransferComplete(u64 userdata, int cyclesLate)
{
if (m_DICR.TSTART)
ExecuteCommand(m_DICR);
}
void Init()
{
m_DISR.Hex = 0;
@ -257,6 +270,8 @@ void Init()
ejectDisc = CoreTiming::RegisterEvent("EjectDisc", EjectDiscCallback);
insertDisc = CoreTiming::RegisterEvent("InsertDisc", InsertDiscCallback);
tc = CoreTiming::RegisterEvent("TransferComplete", TransferComplete);
}
void Shutdown()
@ -445,7 +460,17 @@ void Write32(const u32 _iValue, const u32 _iAddress)
{
m_DICR.Hex = _iValue & 7;
if (m_DICR.TSTART)
ExecuteCommand(m_DICR);
{
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bEmulateDiscSpeed)
{
u64 ticksUntilTC = m_DILENGTH.Length * (SystemTimers::GetTicksPerSecond() / DISC_TRANSFER_RATE);
CoreTiming::ScheduleEvent(ticksUntilTC, tc);
}
else
{
ExecuteCommand(m_DICR);
}
}
}
break;

View File

@ -2801,6 +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);
// Wii settings
if (StartUp.bWii)
{