Skip to content

Commit

Permalink
Merge branch 'FIFO-BP'
Browse files Browse the repository at this point in the history
# By skidau (30) and Pierre Bourdon (1)
* FIFO-BP: (31 commits)
  Set g_bSignalTokenInterrupt on the main thread.  Fixes the random hang in Harry Potter: Prisoner of Azkaban.
  Used a scheduled event to generate the ARAM DMA interrupt if the DMA is greater than a certain size.  Fixes NFS:HP2 GC.
  Bumped up the disc transfer speed enough to prevent audio stuttering in Gauntlet: Dark Legacy.
  Enabled Synchronise GPU on "SPEED CHALLENGE - Jacques Villeneuve's Racing Vision".  Required to go in-game.
  Added direct GameCube controller commands to the Serial Interface emulation.  Fixes the controls in MaxPlay Classic Games Volume 1 and the Action Replay disc.
  Increased the FIFO buffer size to 2MB from 1MB.  Fixes Killer 7's Angel boss.
  Used an immediate GenerateDSPInterrupt when transferring data from ARAM to MRAM and a scheduled DSP interrupt when transferring data from MRAM to ARAM.
  Fixes the audio cutting in and out in the Resident Evil GC games using DSP HLE. Triggered the ARAM interrupt by the scheduler instead of directly in function.
  Implemented proper timing for the sample counter in the AudioInterface, removing the previous hack. Cleaned up some of the audio streaming code.
  Skipped the EE check if there is a CP interrupt pending.
  Disabled "Speed up disc transfer" from the ZTP GC game ini.
  Removed the disc seek times for GC games and removed the disc speed option on Wii games. Checked for external exceptions only in mtmsr.
  Delayed the interrupts in the EXI Channel.
  Merge aram-dma-fixes (r76a13604ef49b522281af75675f044d59a74e871)
  Added a patch that bypasses the FIFO reset code in Wallace and Gromit: Project Zoo, allowing it to go in-game.
  Made vertex loading take constant time.
  Increased the cycle time of the vertex command.  Fixes "Speed Challenge: Jacques Villeneuve's Racing Vision".
  Moved the setting of the Finish interrupt signal back to the main thread as it was causing Wii games like Resident Evil 4 (Wii) to hang.
  Profile stores, fp stores and ps stores only to the fifo write addresses list.  This should make the JIT a little faster as it will not be checking for external exceptions unnecessarily.
  ...

Conflicts:
	Source/Core/VideoCommon/Src/PixelEngine.cpp
  • Loading branch information
skidau committed Mar 12, 2013
2 parents 8406d99 + d3e431a commit 83fc5f4
Show file tree
Hide file tree
Showing 46 changed files with 440 additions and 226 deletions.
1 change: 1 addition & 0 deletions Data/User/GameConfig/GKBEAF.ini
@@ -1,5 +1,6 @@
# GKBEAF - Baten Kaitos
[Core] Values set here will override the main dolphin settings.
SyncGPU = 1
[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set.
EmulationStateId = 4
EmulationIssues =
Expand Down
1 change: 1 addition & 0 deletions Data/User/GameConfig/GKBPAF.ini
@@ -1,5 +1,6 @@
# GKBPAF - Baten Kaitos
[Core] Values set here will override the main dolphin settings.
SyncGPU = 1
[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set.
EmulationStateId = 4
EmulationIssues =
Expand Down
3 changes: 2 additions & 1 deletion Data/User/GameConfig/GLSE64.ini
@@ -1,8 +1,9 @@
# GLSE64 - LucasArts Gladius
[Core] Values set here will override the main dolphin settings.
TLBHack = 1
SyncGPU = 1
[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set.
EmulationStateId = 1
EmulationStateId = 4
EmulationIssues =
[OnFrame] Add memory patches to be applied every frame here.
[ActionReplay] Add action replay cheats here.
Expand Down
4 changes: 2 additions & 2 deletions Data/User/GameConfig/GNHE5d.ini
Expand Up @@ -3,8 +3,8 @@
#Values set here will override the main dolphin settings.
[EmuState]
#The Emulation State. 1 is worst, 5 is best, 0 is not set.
EmulationStateId = 1
EmulationIssues =
EmulationStateId = 4
EmulationIssues = Enable the GameCube BIOS to allow the game to boot.
[OnFrame]
+$Nop Hack
0x80025BA0:dword:0x60000000
Expand Down
17 changes: 17 additions & 0 deletions Data/User/GameConfig/GSZP41.ini
@@ -0,0 +1,17 @@
# GSZP41 - SPEED CHALLENGE - Jacques Villeneuve's Racing Vision
[Core] Values set here will override the main dolphin settings.
SyncGPU = 1
[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set.
EmulationStateId = 4
EmulationIssues =
[OnFrame] Add memory patches to be applied every frame here.
[ActionReplay] Add action replay cheats here.
[Video]
ProjectionHack = 0
PH_SZNear = 0
PH_SZFar = 0
PH_ExtraParam = 0
PH_ZNear =
PH_ZFar =
UseBBox = 1
[Gecko]
10 changes: 10 additions & 0 deletions Data/User/GameConfig/GWLE6L.ini
@@ -0,0 +1,10 @@
# GWLE6L - Project Zoo
[Core] Values set here will override the main dolphin settings.
TLBHack = 1
[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set.
EmulationStateId = 3
EmulationIssues =
[OnFrame] Add memory patches to be applied every frame here.
+$Bypass FIFO reset
0x8028EF00:dword:0x48000638
[ActionReplay] Add action replay cheats here.
1 change: 0 additions & 1 deletion Data/User/GameConfig/GZ2E01.ini
@@ -1,6 +1,5 @@
# GZ2E01 - The Legend of Zelda: Twilight Princess
[Core]
FastDiscSpeed = 1
[EmuState]
#The Emulation State.
EmulationStateId = 4
Expand Down
1 change: 0 additions & 1 deletion Data/User/GameConfig/GZ2J01.ini
@@ -1,6 +1,5 @@
# GZ2J01 - The Legend of Zelda: Twilight Princess
[Core]
FastDiscSpeed = 1
[EmuState]
#The Emulation State.
EmulationStateId = 4
Expand Down
1 change: 0 additions & 1 deletion Data/User/GameConfig/GZ2P01.ini
@@ -1,7 +1,6 @@
# GZ2P01 - The Legend of Zelda Twilight Princess
[Core]
#Values set here will override the main dolphin settings.
FastDiscSpeed = 1
[Speedhacks]
0x803420bc=200
[EmuState]
Expand Down
5 changes: 4 additions & 1 deletion Source/Core/Core/Src/BootManager.cpp
Expand Up @@ -55,7 +55,7 @@ namespace BootManager
struct ConfigCache
{
bool valid, bCPUThread, bSkipIdle, bEnableFPRF, bMMU, bDCBZOFF,
bVBeam, bFastDiscSpeed, bMergeBlocks, bDSPHLE, bHLE_BS2;
bVBeam, bSyncGPU, bFastDiscSpeed, bMergeBlocks, bDSPHLE, bHLE_BS2;
int iTLBHack, iCPUCore;
std::string strBackend;
};
Expand Down Expand Up @@ -95,6 +95,7 @@ bool BootCore(const std::string& _rFilename)
config_cache.bDCBZOFF = StartUp.bDCBZOFF;
config_cache.iTLBHack = StartUp.iTLBHack;
config_cache.bVBeam = StartUp.bVBeam;
config_cache.bSyncGPU = StartUp.bSyncGPU;
config_cache.bFastDiscSpeed = StartUp.bFastDiscSpeed;
config_cache.bMergeBlocks = StartUp.bMergeBlocks;
config_cache.bDSPHLE = StartUp.bDSPHLE;
Expand All @@ -109,6 +110,7 @@ bool BootCore(const std::string& _rFilename)
game_ini.Get("Core", "TLBHack", &StartUp.iTLBHack, StartUp.iTLBHack);
game_ini.Get("Core", "DCBZ", &StartUp.bDCBZOFF, StartUp.bDCBZOFF);
game_ini.Get("Core", "VBeam", &StartUp.bVBeam, StartUp.bVBeam);
game_ini.Get("Core", "SyncGPU", &StartUp.bSyncGPU, StartUp.bSyncGPU);
game_ini.Get("Core", "FastDiscSpeed", &StartUp.bFastDiscSpeed, StartUp.bFastDiscSpeed);
game_ini.Get("Core", "BlockMerging", &StartUp.bMergeBlocks, StartUp.bMergeBlocks);
game_ini.Get("Core", "DSPHLE", &StartUp.bDSPHLE, StartUp.bDSPHLE);
Expand Down Expand Up @@ -168,6 +170,7 @@ void Stop()
StartUp.bDCBZOFF = config_cache.bDCBZOFF;
StartUp.iTLBHack = config_cache.iTLBHack;
StartUp.bVBeam = config_cache.bVBeam;
StartUp.bSyncGPU = config_cache.bSyncGPU;
StartUp.bFastDiscSpeed = config_cache.bFastDiscSpeed;
StartUp.bMergeBlocks = config_cache.bMergeBlocks;
StartUp.bDSPHLE = config_cache.bDSPHLE;
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/Src/ConfigManager.cpp
Expand Up @@ -404,6 +404,7 @@ void SConfig::LoadSettings()
ini.Get("Core", "MMU", &m_LocalCoreStartupParameter.bMMU, false);
ini.Get("Core", "TLBHack", &m_LocalCoreStartupParameter.iTLBHack, 0);
ini.Get("Core", "VBeam", &m_LocalCoreStartupParameter.bVBeam, false);
ini.Get("Core", "SyncGPU", &m_LocalCoreStartupParameter.bSyncGPU, false);
ini.Get("Core", "FastDiscSpeed", &m_LocalCoreStartupParameter.bFastDiscSpeed, false);
ini.Get("Core", "DCBZ", &m_LocalCoreStartupParameter.bDCBZOFF, false);
ini.Get("Core", "FrameLimit", &m_Framelimit, 1); // auto frame limit by default
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/Core/Src/CoreParameter.cpp
Expand Up @@ -50,7 +50,7 @@ SCoreStartupParameter::SCoreStartupParameter()
bDPL2Decoder(false), iLatency(14),
bRunCompareServer(false), bRunCompareClient(false),
bMMU(false), bDCBZOFF(false), iTLBHack(0), bVBeam(false),
bFastDiscSpeed(false),
bSyncGPU(false), bFastDiscSpeed(false),
SelectedLanguage(0), bWii(false),
bConfirmStop(false), bHideCursor(false),
bAutoHideCursor(false), bUsePanicHandlers(true), bOnScreenDisplayMessages(true),
Expand Down Expand Up @@ -78,6 +78,7 @@ void SCoreStartupParameter::LoadDefaults()
bDCBZOFF = false;
iTLBHack = 0;
bVBeam = false;
bSyncGPU = false;
bFastDiscSpeed = false;
bMergeBlocks = false;
SelectedLanguage = 0;
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/Src/CoreParameter.h
Expand Up @@ -116,6 +116,7 @@ struct SCoreStartupParameter
bool bDCBZOFF;
int iTLBHack;
bool bVBeam;
bool bSyncGPU;
bool bFastDiscSpeed;

int SelectedLanguage;
Expand Down
27 changes: 21 additions & 6 deletions Source/Core/Core/Src/HW/AudioInterface.cpp
Expand Up @@ -145,6 +145,8 @@ static void GenerateAudioInterrupt();
static void UpdateInterrupts();
static void IncreaseSampleCount(const u32 _uAmount);
void ReadStreamBlock(s16* _pPCM);
u64 GetAIPeriod();
int et_AI;

void Init()
{
Expand All @@ -159,6 +161,8 @@ void Init()

g_AISSampleRate = 48000;
g_AIDSampleRate = 32000;

et_AI = CoreTiming::RegisterEvent("AICallback", Update);
}

void Shutdown()
Expand All @@ -178,11 +182,8 @@ void Read32(u32& _rReturnValue, const u32 _Address)
break;

case AI_SAMPLE_COUNTER:
Update(0, 0);
_rReturnValue = m_SampleCounter;
// HACK - AI SRC init will do while (oldval == sample_counter) {}
// in order to pass this, we need to increment the counter whenever read
if (m_Control.PSTAT)
m_SampleCounter++;
break;

case AI_INTERRUPT_TIMING:
Expand Down Expand Up @@ -236,6 +237,9 @@ void Write32(const u32 _Value, const u32 _Address)

// Tell Drive Interface to start/stop streaming
DVDInterface::g_bStream = tmpAICtrl.PSTAT;

CoreTiming::RemoveEvent(et_AI);
CoreTiming::ScheduleEvent(((int)GetAIPeriod() / 2), et_AI);
}

// AI Interrupt
Expand Down Expand Up @@ -271,6 +275,8 @@ void Write32(const u32 _Value, const u32 _Address)

case AI_INTERRUPT_TIMING:
m_InterruptTiming = _Value;
CoreTiming::RemoveEvent(et_AI);
CoreTiming::ScheduleEvent(((int)GetAIPeriod() / 2), et_AI);
DEBUG_LOG(AUDIO_INTERFACE, "Set interrupt: %08x samples", m_InterruptTiming);
break;

Expand Down Expand Up @@ -448,7 +454,7 @@ unsigned int GetAIDSampleRate()
return g_AIDSampleRate;
}

void Update()
void Update(u64 userdata, int cyclesLate)
{
if (m_Control.PSTAT)
{
Expand All @@ -458,8 +464,17 @@ void Update()
const u32 Samples = static_cast<u32>(Diff / g_CPUCyclesPerSample);
g_LastCPUTime += Samples * g_CPUCyclesPerSample;
IncreaseSampleCount(Samples);
}
}
CoreTiming::ScheduleEvent(((int)GetAIPeriod() / 2) - cyclesLate, et_AI);
}
}

u64 GetAIPeriod()
{
u64 period = g_CPUCyclesPerSample * m_InterruptTiming;
if (period == 0)
period = 32000 * g_CPUCyclesPerSample;
return period;
}

} // end of namespace AudioInterface
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/HW/AudioInterface.h
Expand Up @@ -31,7 +31,7 @@ void Init();
void Shutdown();
void DoState(PointerWrap &p);

void Update();
void Update(u64 userdata, int cyclesLate);

// Called by DSP emulator
void Callback_GetSampleRate(unsigned int &_AISampleRate, unsigned int &_DACSampleRate);
Expand Down
11 changes: 5 additions & 6 deletions Source/Core/Core/Src/HW/DSP.cpp
Expand Up @@ -436,10 +436,6 @@ void Write16(const u16 _Value, const u32 _Address)
if (tmpControl.ARAM) g_dspState.DSPControl.ARAM = 0;
if (tmpControl.DSP) g_dspState.DSPControl.DSP = 0;

// Tracking DMAState fixes Knockout Kings 2003 in DSP HLE mode
if (GetDSPEmulator()->IsLLE())
g_dspState.DSPControl.DMAState = 0; // keep g_ARAM DMA State zero

// unknown
g_dspState.DSPControl.unk3 = tmpControl.unk3;
g_dspState.DSPControl.pad = tmpControl.pad;
Expand Down Expand Up @@ -691,7 +687,7 @@ void UpdateAudioDMA()
{
// Send silence. Yeah, it's a bit of a waste to sample rate convert
// silence. or hm. Maybe we shouldn't do this :)
//dsp_emulator->DSP_SendAIBuffer(0, AudioInterface::GetAIDSampleRate());
dsp_emulator->DSP_SendAIBuffer(0, AudioInterface::GetAIDSampleRate());
}
}

Expand All @@ -701,7 +697,10 @@ void Do_ARAM_DMA()
if (!GetDSPEmulator()->IsLLE())
g_dspState.DSPControl.DMAState = 1;

GenerateDSPInterrupt(INT_ARAM, true);
if (g_arDMA.Cnt.dir || g_arDMA.Cnt.count > 10240)
CoreTiming::ScheduleEvent_Threadsafe(0, et_GenerateDSPInterrupt, INT_ARAM | (1<<16));
else
GenerateDSPInterrupt(INT_ARAM);

// Real hardware DMAs in 32byte chunks, but we can get by with 8byte chunks
if (g_arDMA.Cnt.dir)
Expand Down
9 changes: 2 additions & 7 deletions Source/Core/Core/Src/HW/DVDInterface.cpp
Expand Up @@ -32,11 +32,7 @@
#include "../Movie.h"

// Disc transfer rate measured in bytes per second
static const u32 DISC_TRANSFER_RATE_GC = 3125 * 1024;
static const u32 DISC_TRANSFER_RATE_WII = 7926 * 1024;

// Disc access time measured in milliseconds
static const u32 DISC_ACCESS_TIME_MS = 128;
static const u32 DISC_TRANSFER_RATE_GC = 4 * 1024 * 1024;

namespace DVDInterface
{
Expand Down Expand Up @@ -501,8 +497,7 @@ void Write32(const u32 _iValue, const u32 _iAddress)
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bFastDiscSpeed)
{
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_MS / 1000);
(SystemTimers::GetTicksPerSecond() / (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii ? 1 : DISC_TRANSFER_RATE_GC));
CoreTiming::ScheduleEvent((int)ticksUntilTC, tc);
}
else
Expand Down
14 changes: 9 additions & 5 deletions Source/Core/Core/Src/HW/EXI_Channel.cpp
Expand Up @@ -25,9 +25,9 @@
#define EXI_WRITE 1
#define EXI_READWRITE 2


#include "ProcessorInterface.h"
#include "../PowerPC/PowerPC.h"
#include "CoreTiming.h"

CEXIChannel::CEXIChannel(u32 ChannelId) :
m_DMAMemoryAddress(0),
Expand All @@ -45,6 +45,8 @@ CEXIChannel::CEXIChannel(u32 ChannelId) :

for (int i = 0; i < NUM_DEVICES; i++)
m_pDevices[i] = EXIDevice_Create(EXIDEVICE_NONE, m_ChannelId);

updateInterrupts = CoreTiming::RegisterEvent("EXIInterrupt", UpdateInterrupts);
}

CEXIChannel::~CEXIChannel()
Expand Down Expand Up @@ -88,12 +90,12 @@ void CEXIChannel::AddDevice(IEXIDevice* pDevice, const int device_num, bool noti
if (m_ChannelId != 2)
{
m_Status.EXTINT = 1;
UpdateInterrupts();
CoreTiming::ScheduleEvent_Threadsafe_Immediate(updateInterrupts, 0);
}
}
}

void CEXIChannel::UpdateInterrupts()
void CEXIChannel::UpdateInterrupts(u64 userdata, int cyclesLate)
{
ExpansionInterface::UpdateInterrupts();
}
Expand Down Expand Up @@ -149,7 +151,9 @@ void CEXIChannel::Read32(u32& _uReturnValue, const u32 _iRegister)
if (m_ChannelId == 2)
m_Status.EXT = 0;
else
{
m_Status.EXT = GetDevice(1)->IsPresent() ? 1 : 0;
}

_uReturnValue = m_Status.Hex;
break;
Expand Down Expand Up @@ -213,7 +217,7 @@ void CEXIChannel::Write32(const u32 _iValue, const u32 _iRegister)
if (pDevice != NULL)
pDevice->SetCS(m_Status.CHIP_SELECT);

UpdateInterrupts();
CoreTiming::ScheduleEvent_Threadsafe_Immediate(updateInterrupts, 0);
}
break;

Expand Down Expand Up @@ -264,7 +268,7 @@ void CEXIChannel::Write32(const u32 _iValue, const u32 _iRegister)
if(!m_Control.TSTART) // completed !
{
m_Status.TCINT = 1;
UpdateInterrupts();
CoreTiming::ScheduleEvent_Threadsafe_Immediate(updateInterrupts, 0);
}
}
break;
Expand Down
4 changes: 3 additions & 1 deletion Source/Core/Core/Src/HW/EXI_Channel.h
Expand Up @@ -110,6 +110,9 @@ class CEXIChannel
// Since channels operate a bit differently from each other
u32 m_ChannelId;

int updateInterrupts;

static void UpdateInterrupts(u64 userdata, int cyclesLate);
public:
// get device
IEXIDevice* GetDevice(const u8 _CHIP_SELECT);
Expand All @@ -129,7 +132,6 @@ class CEXIChannel

void Update();
bool IsCausingInterrupt();
void UpdateInterrupts();
void DoState(PointerWrap &p);
void PauseAndLock(bool doLock, bool unpauseOnUnlock);

Expand Down

0 comments on commit 83fc5f4

Please sign in to comment.