2013-04-17 21:09:55 -06:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2010-06-08 19:37:08 -06:00
|
|
|
|
|
|
|
#include "Common.h"
|
|
|
|
#include "VideoCommon.h"
|
|
|
|
#include "VideoConfig.h"
|
|
|
|
#include "MathUtil.h"
|
|
|
|
#include "Thread.h"
|
|
|
|
#include "Atomic.h"
|
2010-12-11 05:42:55 -07:00
|
|
|
#include "OpcodeDecoding.h"
|
2010-06-08 19:37:08 -06:00
|
|
|
#include "Fifo.h"
|
|
|
|
#include "ChunkFile.h"
|
|
|
|
#include "CommandProcessor.h"
|
2010-07-27 20:57:17 -06:00
|
|
|
#include "PixelEngine.h"
|
2011-01-30 18:28:32 -07:00
|
|
|
#include "CoreTiming.h"
|
|
|
|
#include "ConfigManager.h"
|
|
|
|
#include "HW/ProcessorInterface.h"
|
|
|
|
#include "HW/GPFifo.h"
|
|
|
|
#include "HW/Memmap.h"
|
2011-02-08 05:00:41 -07:00
|
|
|
#include "DLCache.h"
|
2013-02-15 18:51:09 -07:00
|
|
|
#include "HW/SystemTimers.h"
|
|
|
|
#include "Core.h"
|
2010-06-08 19:37:08 -06:00
|
|
|
|
|
|
|
namespace CommandProcessor
|
|
|
|
{
|
|
|
|
|
|
|
|
int et_UpdateInterrupts;
|
|
|
|
|
|
|
|
// TODO(ector): Warn on bbox read/write
|
|
|
|
|
|
|
|
// STATE_TO_SAVE
|
|
|
|
SCPFifoStruct fifo;
|
|
|
|
UCPStatusReg m_CPStatusReg;
|
|
|
|
UCPCtrlReg m_CPCtrlReg;
|
|
|
|
UCPClearReg m_CPClearReg;
|
|
|
|
|
|
|
|
int m_bboxleft;
|
|
|
|
int m_bboxtop;
|
|
|
|
int m_bboxright;
|
|
|
|
int m_bboxbottom;
|
|
|
|
u16 m_tokenReg;
|
|
|
|
|
2011-02-08 03:37:47 -07:00
|
|
|
static bool bProcessFifoToLoWatermark = false;
|
2010-12-13 00:56:54 -07:00
|
|
|
static bool bProcessFifoAllDistance = false;
|
2010-06-08 19:37:08 -06:00
|
|
|
|
Big Fifo Commit Part2: Now the fifo is more stable than my first commit, so is time...
- ReImplementing Single Core Mode like Dual Core Mode Style.
- Stage 1: My goal is, we have the Fifo, CommandProccessor code the more clear, maintenible and documented possible. When I quit dolphin I want any developer can continue with the work only reading the code.
* Big Refactoring: A lot of functions was changed the names, and modularized.
Now the FifoLoop and CatchUpGPU does not exist, was replaced by RunGpu() and RunGpuLoop().
The general idea is modeling the code like the real HW. The fifo is only a buffer where the Write Gather Pipe write the commands and from the Graphic Processor read these.
* Big Clean UP a lot of obsolete code and comments was deleted, like DcFakeWachDog, "Fifo very soon hack", etc.
In the stage 2, I will refactoring more code doing emphasis in the division of CommandProcessor, Fifo, Gpu Emulation. Beside I will comment all functions and variables in the code (Don't worry I will ask for English help for this part ;) )
Please test a lot SC mode and DC mode :)
Thank you so much for testing always and the patience. I don't like broke your favorite game but... you must believe me this part is very sensible, I only try to contribute for have a better and stable dolphin emulator.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7185 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-02-16 21:25:21 -07:00
|
|
|
volatile bool isPossibleWaitingSetDrawDone = false;
|
2012-03-04 22:40:10 -07:00
|
|
|
volatile bool isHiWatermarkActive = false;
|
2013-01-25 02:04:31 -07:00
|
|
|
volatile bool isLoWatermarkActive = false;
|
2010-12-11 05:42:55 -07:00
|
|
|
volatile bool interruptSet= false;
|
|
|
|
volatile bool interruptWaiting= false;
|
2010-12-13 00:56:54 -07:00
|
|
|
volatile bool interruptTokenWaiting = false;
|
|
|
|
volatile bool interruptFinishWaiting = false;
|
2012-03-18 19:54:58 -06:00
|
|
|
volatile bool waitingForPEInterruptDisable = false;
|
2010-06-24 07:28:54 -06:00
|
|
|
|
2013-02-15 18:51:09 -07:00
|
|
|
volatile u32 VITicks = CommandProcessor::m_cpClockOrigin;
|
|
|
|
|
2011-02-08 03:37:47 -07:00
|
|
|
bool IsOnThread()
|
|
|
|
{
|
|
|
|
return SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread;
|
|
|
|
}
|
|
|
|
|
|
|
|
void UpdateInterrupts_Wrapper(u64 userdata, int cyclesLate)
|
|
|
|
{
|
|
|
|
UpdateInterrupts(userdata);
|
|
|
|
}
|
|
|
|
|
2010-06-08 19:37:08 -06:00
|
|
|
void DoState(PointerWrap &p)
|
|
|
|
{
|
2013-04-09 17:57:39 -06:00
|
|
|
p.DoPOD(m_CPStatusReg);
|
|
|
|
p.DoPOD(m_CPCtrlReg);
|
|
|
|
p.DoPOD(m_CPClearReg);
|
2010-06-08 19:37:08 -06:00
|
|
|
p.Do(m_bboxleft);
|
|
|
|
p.Do(m_bboxtop);
|
|
|
|
p.Do(m_bboxright);
|
|
|
|
p.Do(m_bboxbottom);
|
|
|
|
p.Do(m_tokenReg);
|
|
|
|
p.Do(fifo);
|
2011-02-08 03:37:47 -07:00
|
|
|
|
|
|
|
p.Do(bProcessFifoToLoWatermark);
|
|
|
|
p.Do(bProcessFifoAllDistance);
|
2012-03-04 22:40:10 -07:00
|
|
|
p.Do(isHiWatermarkActive);
|
2013-01-25 02:04:31 -07:00
|
|
|
p.Do(isLoWatermarkActive);
|
2011-02-09 21:47:02 -07:00
|
|
|
p.Do(isPossibleWaitingSetDrawDone);
|
2011-02-08 03:37:47 -07:00
|
|
|
p.Do(interruptSet);
|
|
|
|
p.Do(interruptWaiting);
|
|
|
|
p.Do(interruptTokenWaiting);
|
|
|
|
p.Do(interruptFinishWaiting);
|
2010-06-08 19:37:08 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void WriteLow (volatile u32& _reg, u16 lowbits) {Common::AtomicStore(_reg,(_reg & 0xFFFF0000) | lowbits);}
|
|
|
|
inline void WriteHigh(volatile u32& _reg, u16 highbits) {Common::AtomicStore(_reg,(_reg & 0x0000FFFF) | ((u32)highbits << 16));}
|
|
|
|
|
|
|
|
inline u16 ReadLow (u32 _reg) {return (u16)(_reg & 0xFFFF);}
|
|
|
|
inline u16 ReadHigh (u32 _reg) {return (u16)(_reg >> 16);}
|
|
|
|
|
|
|
|
void Init()
|
|
|
|
{
|
|
|
|
m_CPStatusReg.Hex = 0;
|
2010-06-14 15:55:40 -06:00
|
|
|
m_CPStatusReg.CommandIdle = 1;
|
2010-06-08 19:37:08 -06:00
|
|
|
m_CPStatusReg.ReadIdle = 1;
|
|
|
|
|
|
|
|
m_CPCtrlReg.Hex = 0;
|
|
|
|
|
2012-01-02 03:20:22 -07:00
|
|
|
m_CPClearReg.Hex = 0;
|
|
|
|
|
2010-06-08 19:37:08 -06:00
|
|
|
m_bboxleft = 0;
|
|
|
|
m_bboxtop = 0;
|
|
|
|
m_bboxright = 640;
|
|
|
|
m_bboxbottom = 480;
|
|
|
|
|
|
|
|
m_tokenReg = 0;
|
|
|
|
|
|
|
|
memset(&fifo,0,sizeof(fifo));
|
2013-01-25 02:04:31 -07:00
|
|
|
fifo.CPCmdIdle = 1;
|
2010-12-11 05:42:55 -07:00
|
|
|
fifo.CPReadIdle = 1;
|
2010-06-14 15:55:40 -06:00
|
|
|
fifo.bFF_Breakpoint = 0;
|
2013-04-24 07:21:54 -06:00
|
|
|
fifo.bFF_HiWatermark = 0;
|
2010-12-11 05:42:55 -07:00
|
|
|
fifo.bFF_HiWatermarkInt = 0;
|
2013-04-24 07:21:54 -06:00
|
|
|
fifo.bFF_LoWatermark = 0;
|
2010-12-11 05:42:55 -07:00
|
|
|
fifo.bFF_LoWatermarkInt = 0;
|
|
|
|
|
|
|
|
interruptSet = false;
|
2013-04-24 07:21:54 -06:00
|
|
|
interruptWaiting = false;
|
2010-12-13 00:56:54 -07:00
|
|
|
interruptFinishWaiting = false;
|
|
|
|
interruptTokenWaiting = false;
|
2010-06-08 19:37:08 -06:00
|
|
|
|
2012-01-02 03:20:22 -07:00
|
|
|
bProcessFifoToLoWatermark = false;
|
|
|
|
bProcessFifoAllDistance = false;
|
|
|
|
isPossibleWaitingSetDrawDone = false;
|
2012-03-04 22:40:10 -07:00
|
|
|
isHiWatermarkActive = false;
|
2013-01-25 02:04:31 -07:00
|
|
|
isLoWatermarkActive = false;
|
2012-01-02 03:20:22 -07:00
|
|
|
|
2013-04-24 07:21:54 -06:00
|
|
|
et_UpdateInterrupts = CoreTiming::RegisterEvent("CPInterrupt", UpdateInterrupts_Wrapper);
|
2010-06-08 19:37:08 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void Read16(u16& _rReturnValue, const u32 _Address)
|
|
|
|
{
|
|
|
|
INFO_LOG(COMMANDPROCESSOR, "(r): 0x%08x", _Address);
|
|
|
|
switch (_Address & 0xFFF)
|
|
|
|
{
|
2013-04-24 07:21:54 -06:00
|
|
|
case STATUS_REGISTER:
|
Big Fifo Commit Part2: Now the fifo is more stable than my first commit, so is time...
- ReImplementing Single Core Mode like Dual Core Mode Style.
- Stage 1: My goal is, we have the Fifo, CommandProccessor code the more clear, maintenible and documented possible. When I quit dolphin I want any developer can continue with the work only reading the code.
* Big Refactoring: A lot of functions was changed the names, and modularized.
Now the FifoLoop and CatchUpGPU does not exist, was replaced by RunGpu() and RunGpuLoop().
The general idea is modeling the code like the real HW. The fifo is only a buffer where the Write Gather Pipe write the commands and from the Graphic Processor read these.
* Big Clean UP a lot of obsolete code and comments was deleted, like DcFakeWachDog, "Fifo very soon hack", etc.
In the stage 2, I will refactoring more code doing emphasis in the division of CommandProcessor, Fifo, Gpu Emulation. Beside I will comment all functions and variables in the code (Don't worry I will ask for English help for this part ;) )
Please test a lot SC mode and DC mode :)
Thank you so much for testing always and the patience. I don't like broke your favorite game but... you must believe me this part is very sensible, I only try to contribute for have a better and stable dolphin emulator.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7185 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-02-16 21:25:21 -07:00
|
|
|
SetCpStatusRegister();
|
2010-06-08 19:37:08 -06:00
|
|
|
_rReturnValue = m_CPStatusReg.Hex;
|
|
|
|
return;
|
|
|
|
case CTRL_REGISTER: _rReturnValue = m_CPCtrlReg.Hex; return;
|
|
|
|
case CLEAR_REGISTER:
|
|
|
|
_rReturnValue = m_CPClearReg.Hex;
|
2010-06-14 15:55:40 -06:00
|
|
|
PanicAlert("CommandProcessor:: CPU reads from CLEAR_REGISTER!");
|
|
|
|
ERROR_LOG(COMMANDPROCESSOR, "(r) clear: 0x%04x", _rReturnValue);
|
2010-06-08 19:37:08 -06:00
|
|
|
return;
|
|
|
|
case FIFO_TOKEN_REGISTER: _rReturnValue = m_tokenReg; return;
|
|
|
|
case FIFO_BOUNDING_BOX_LEFT: _rReturnValue = m_bboxleft; return;
|
|
|
|
case FIFO_BOUNDING_BOX_RIGHT: _rReturnValue = m_bboxright; return;
|
|
|
|
case FIFO_BOUNDING_BOX_TOP: _rReturnValue = m_bboxtop; return;
|
|
|
|
case FIFO_BOUNDING_BOX_BOTTOM: _rReturnValue = m_bboxbottom; return;
|
|
|
|
|
|
|
|
case FIFO_BASE_LO: _rReturnValue = ReadLow (fifo.CPBase); return;
|
|
|
|
case FIFO_BASE_HI: _rReturnValue = ReadHigh(fifo.CPBase); return;
|
|
|
|
case FIFO_END_LO: _rReturnValue = ReadLow (fifo.CPEnd); return;
|
|
|
|
case FIFO_END_HI: _rReturnValue = ReadHigh(fifo.CPEnd); return;
|
|
|
|
case FIFO_HI_WATERMARK_LO: _rReturnValue = ReadLow (fifo.CPHiWatermark); return;
|
|
|
|
case FIFO_HI_WATERMARK_HI: _rReturnValue = ReadHigh(fifo.CPHiWatermark); return;
|
|
|
|
case FIFO_LO_WATERMARK_LO: _rReturnValue = ReadLow (fifo.CPLoWatermark); return;
|
|
|
|
case FIFO_LO_WATERMARK_HI: _rReturnValue = ReadHigh(fifo.CPLoWatermark); return;
|
|
|
|
|
|
|
|
case FIFO_RW_DISTANCE_LO:
|
2012-03-11 09:40:39 -06:00
|
|
|
if (IsOnThread())
|
2013-04-24 07:21:54 -06:00
|
|
|
{
|
2012-03-11 09:40:39 -06:00
|
|
|
if(fifo.CPWritePointer >= fifo.SafeCPReadPointer)
|
|
|
|
_rReturnValue = ReadLow (fifo.CPWritePointer - fifo.SafeCPReadPointer);
|
|
|
|
else
|
2012-03-18 19:54:58 -06:00
|
|
|
_rReturnValue = ReadLow (fifo.CPEnd - fifo.SafeCPReadPointer + fifo.CPWritePointer - fifo.CPBase + 32);
|
2013-04-24 07:21:54 -06:00
|
|
|
}
|
2012-03-11 09:40:39 -06:00
|
|
|
else
|
2013-04-24 07:21:54 -06:00
|
|
|
{
|
2012-03-13 05:35:11 -06:00
|
|
|
_rReturnValue = ReadLow (fifo.CPReadWriteDistance);
|
2013-04-24 07:21:54 -06:00
|
|
|
}
|
2013-03-31 17:10:21 -06:00
|
|
|
DEBUG_LOG(COMMANDPROCESSOR, "Read FIFO_RW_DISTANCE_LO : %04x", _rReturnValue);
|
2010-06-08 19:37:08 -06:00
|
|
|
return;
|
|
|
|
case FIFO_RW_DISTANCE_HI:
|
2012-03-11 09:40:39 -06:00
|
|
|
if (IsOnThread())
|
2013-04-24 07:21:54 -06:00
|
|
|
{
|
2012-03-11 09:40:39 -06:00
|
|
|
if(fifo.CPWritePointer >= fifo.SafeCPReadPointer)
|
|
|
|
_rReturnValue = ReadHigh (fifo.CPWritePointer - fifo.SafeCPReadPointer);
|
|
|
|
else
|
2012-03-18 19:54:58 -06:00
|
|
|
_rReturnValue = ReadHigh (fifo.CPEnd - fifo.SafeCPReadPointer + fifo.CPWritePointer - fifo.CPBase + 32);
|
2013-04-24 07:21:54 -06:00
|
|
|
}
|
2012-03-11 09:40:39 -06:00
|
|
|
else
|
2013-04-24 07:21:54 -06:00
|
|
|
{
|
2012-03-13 05:35:11 -06:00
|
|
|
_rReturnValue = ReadHigh(fifo.CPReadWriteDistance);
|
2013-04-24 07:21:54 -06:00
|
|
|
}
|
2013-03-31 17:10:21 -06:00
|
|
|
DEBUG_LOG(COMMANDPROCESSOR, "Read FIFO_RW_DISTANCE_HI : %04x", _rReturnValue);
|
2010-06-08 19:37:08 -06:00
|
|
|
return;
|
|
|
|
case FIFO_WRITE_POINTER_LO:
|
|
|
|
_rReturnValue = ReadLow (fifo.CPWritePointer);
|
2013-03-31 17:10:21 -06:00
|
|
|
DEBUG_LOG(COMMANDPROCESSOR, "Read FIFO_WRITE_POINTER_LO : %04x", _rReturnValue);
|
2010-06-08 19:37:08 -06:00
|
|
|
return;
|
|
|
|
case FIFO_WRITE_POINTER_HI:
|
|
|
|
_rReturnValue = ReadHigh(fifo.CPWritePointer);
|
2013-03-31 17:10:21 -06:00
|
|
|
DEBUG_LOG(COMMANDPROCESSOR, "Read FIFO_WRITE_POINTER_HI : %04x", _rReturnValue);
|
2010-06-08 19:37:08 -06:00
|
|
|
return;
|
|
|
|
case FIFO_READ_POINTER_LO:
|
2011-02-13 08:08:37 -07:00
|
|
|
if (IsOnThread())
|
|
|
|
_rReturnValue = ReadLow (fifo.SafeCPReadPointer);
|
|
|
|
else
|
|
|
|
_rReturnValue = ReadLow (fifo.CPReadPointer);
|
2013-03-31 17:10:21 -06:00
|
|
|
DEBUG_LOG(COMMANDPROCESSOR, "Read FIFO_READ_POINTER_LO : %04x", _rReturnValue);
|
2010-06-08 19:37:08 -06:00
|
|
|
return;
|
|
|
|
case FIFO_READ_POINTER_HI:
|
2011-02-13 08:08:37 -07:00
|
|
|
if (IsOnThread())
|
|
|
|
_rReturnValue = ReadHigh (fifo.SafeCPReadPointer);
|
|
|
|
else
|
|
|
|
_rReturnValue = ReadHigh (fifo.CPReadPointer);
|
2013-03-31 17:10:21 -06:00
|
|
|
DEBUG_LOG(COMMANDPROCESSOR, "Read FIFO_READ_POINTER_HI : %04x", _rReturnValue);
|
2010-06-08 19:37:08 -06:00
|
|
|
return;
|
|
|
|
|
|
|
|
case FIFO_BP_LO: _rReturnValue = ReadLow (fifo.CPBreakpoint); return;
|
|
|
|
case FIFO_BP_HI: _rReturnValue = ReadHigh(fifo.CPBreakpoint); return;
|
|
|
|
|
|
|
|
case XF_RASBUSY_L:
|
|
|
|
_rReturnValue = 0; // TODO: Figure out the true value
|
|
|
|
DEBUG_LOG(COMMANDPROCESSOR, "Read from XF_RASBUSY_L: %04x", _rReturnValue);
|
|
|
|
return;
|
|
|
|
case XF_RASBUSY_H:
|
|
|
|
_rReturnValue = 0; // TODO: Figure out the true value
|
|
|
|
DEBUG_LOG(COMMANDPROCESSOR, "Read from XF_RASBUSY_H: %04x", _rReturnValue);
|
|
|
|
return;
|
|
|
|
|
|
|
|
case XF_CLKS_L:
|
|
|
|
_rReturnValue = 0; // TODO: Figure out the true value
|
|
|
|
DEBUG_LOG(COMMANDPROCESSOR, "Read from XF_CLKS_L: %04x", _rReturnValue);
|
|
|
|
return;
|
|
|
|
case XF_CLKS_H:
|
|
|
|
_rReturnValue = 0; // TODO: Figure out the true value
|
|
|
|
DEBUG_LOG(COMMANDPROCESSOR, "Read from XF_CLKS_H: %04x", _rReturnValue);
|
|
|
|
return;
|
|
|
|
|
|
|
|
case XF_WAIT_IN_L:
|
|
|
|
_rReturnValue = 0; // TODO: Figure out the true value
|
|
|
|
DEBUG_LOG(COMMANDPROCESSOR, "Read from XF_WAIT_IN_L: %04x", _rReturnValue);
|
|
|
|
return;
|
|
|
|
case XF_WAIT_IN_H:
|
|
|
|
_rReturnValue = 0; // TODO: Figure out the true value
|
|
|
|
DEBUG_LOG(COMMANDPROCESSOR, "Read from XF_WAIT_IN_H: %04x", _rReturnValue);
|
|
|
|
return;
|
|
|
|
|
|
|
|
case XF_WAIT_OUT_L:
|
|
|
|
_rReturnValue = 0; // TODO: Figure out the true value
|
|
|
|
DEBUG_LOG(COMMANDPROCESSOR, "Read from XF_WAIT_OUT_L: %04x", _rReturnValue);
|
|
|
|
return;
|
|
|
|
case XF_WAIT_OUT_H:
|
|
|
|
_rReturnValue = 0; // TODO: Figure out the true value
|
|
|
|
DEBUG_LOG(COMMANDPROCESSOR, "Read from XF_WAIT_OUT_H: %04x", _rReturnValue);
|
|
|
|
return;
|
|
|
|
|
|
|
|
case VCACHE_METRIC_CHECK_L:
|
|
|
|
_rReturnValue = 0; // TODO: Figure out the true value
|
|
|
|
DEBUG_LOG(COMMANDPROCESSOR, "Read from VCACHE_METRIC_CHECK_L: %04x", _rReturnValue);
|
|
|
|
return;
|
|
|
|
case VCACHE_METRIC_CHECK_H:
|
|
|
|
_rReturnValue = 0; // TODO: Figure out the true value
|
|
|
|
DEBUG_LOG(COMMANDPROCESSOR, "Read from VCACHE_METRIC_CHECK_H: %04x", _rReturnValue);
|
|
|
|
return;
|
|
|
|
|
|
|
|
case VCACHE_METRIC_MISS_L:
|
|
|
|
_rReturnValue = 0; // TODO: Figure out the true value
|
|
|
|
DEBUG_LOG(COMMANDPROCESSOR, "Read from VCACHE_METRIC_MISS_L: %04x", _rReturnValue);
|
|
|
|
return;
|
|
|
|
case VCACHE_METRIC_MISS_H:
|
|
|
|
_rReturnValue = 0; // TODO: Figure out the true value
|
|
|
|
DEBUG_LOG(COMMANDPROCESSOR, "Read from VCACHE_METRIC_MISS_H: %04x", _rReturnValue);
|
|
|
|
return;
|
|
|
|
|
|
|
|
case VCACHE_METRIC_STALL_L:
|
|
|
|
_rReturnValue = 0; // TODO: Figure out the true value
|
|
|
|
DEBUG_LOG(COMMANDPROCESSOR, "Read from VCACHE_METRIC_STALL_L: %04x", _rReturnValue);
|
|
|
|
return;
|
|
|
|
case VCACHE_METRIC_STALL_H:
|
|
|
|
_rReturnValue = 0; // TODO: Figure out the true value
|
|
|
|
DEBUG_LOG(COMMANDPROCESSOR, "Read from VCACHE_METRIC_STALL_H: %04x", _rReturnValue);
|
|
|
|
return;
|
|
|
|
|
|
|
|
case CLKS_PER_VTX_OUT:
|
|
|
|
_rReturnValue = 4; //Number of clocks per vertex.. TODO: Calculate properly
|
|
|
|
DEBUG_LOG(COMMANDPROCESSOR, "Read from CLKS_PER_VTX_OUT: %04x", _rReturnValue);
|
|
|
|
return;
|
|
|
|
default:
|
|
|
|
_rReturnValue = 0;
|
|
|
|
WARN_LOG(COMMANDPROCESSOR, "(r16) unknown CP reg @ %08x", _Address);
|
|
|
|
return;
|
|
|
|
}
|
2010-06-15 08:24:01 -06:00
|
|
|
|
2010-06-08 19:37:08 -06:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Write16(const u16 _Value, const u32 _Address)
|
|
|
|
{
|
|
|
|
INFO_LOG(COMMANDPROCESSOR, "(write16): 0x%04x @ 0x%08x",_Value,_Address);
|
|
|
|
|
|
|
|
switch (_Address & 0xFFF)
|
|
|
|
{
|
|
|
|
case STATUS_REGISTER:
|
|
|
|
{
|
|
|
|
// This should be Read-Only
|
|
|
|
ERROR_LOG(COMMANDPROCESSOR,"\t write to STATUS_REGISTER : %04x", _Value);
|
|
|
|
PanicAlert("CommandProcessor:: CPU writes to STATUS_REGISTER!");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CTRL_REGISTER:
|
|
|
|
{
|
|
|
|
UCPCtrlReg tmpCtrl(_Value);
|
|
|
|
m_CPCtrlReg.Hex = tmpCtrl.Hex;
|
2010-06-15 04:58:14 -06:00
|
|
|
INFO_LOG(COMMANDPROCESSOR,"\t Write to CTRL_REGISTER : %04x", _Value);
|
Big Fifo Commit Part2: Now the fifo is more stable than my first commit, so is time...
- ReImplementing Single Core Mode like Dual Core Mode Style.
- Stage 1: My goal is, we have the Fifo, CommandProccessor code the more clear, maintenible and documented possible. When I quit dolphin I want any developer can continue with the work only reading the code.
* Big Refactoring: A lot of functions was changed the names, and modularized.
Now the FifoLoop and CatchUpGPU does not exist, was replaced by RunGpu() and RunGpuLoop().
The general idea is modeling the code like the real HW. The fifo is only a buffer where the Write Gather Pipe write the commands and from the Graphic Processor read these.
* Big Clean UP a lot of obsolete code and comments was deleted, like DcFakeWachDog, "Fifo very soon hack", etc.
In the stage 2, I will refactoring more code doing emphasis in the division of CommandProcessor, Fifo, Gpu Emulation. Beside I will comment all functions and variables in the code (Don't worry I will ask for English help for this part ;) )
Please test a lot SC mode and DC mode :)
Thank you so much for testing always and the patience. I don't like broke your favorite game but... you must believe me this part is very sensible, I only try to contribute for have a better and stable dolphin emulator.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7185 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-02-16 21:25:21 -07:00
|
|
|
SetCpControlRegister();
|
2010-06-08 19:37:08 -06:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CLEAR_REGISTER:
|
2010-06-14 15:55:40 -06:00
|
|
|
{
|
|
|
|
UCPClearReg tmpCtrl(_Value);
|
2013-03-19 19:51:12 -06:00
|
|
|
m_CPClearReg.Hex = tmpCtrl.Hex;
|
2013-03-31 17:10:21 -06:00
|
|
|
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to CLEAR_REGISTER : %04x", _Value);
|
2012-01-21 06:58:29 -07:00
|
|
|
SetCpClearRegister();
|
2010-06-14 15:55:40 -06:00
|
|
|
}
|
2010-06-08 19:37:08 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PERF_SELECT:
|
|
|
|
// Seems to select which set of perf registers should be exposed.
|
2013-03-31 17:10:21 -06:00
|
|
|
DEBUG_LOG(COMMANDPROCESSOR, "Write to PERF_SELECT: %04x", _Value);
|
2010-06-08 19:37:08 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
// Fifo Registers
|
|
|
|
case FIFO_TOKEN_REGISTER:
|
|
|
|
m_tokenReg = _Value;
|
2013-03-31 17:10:21 -06:00
|
|
|
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_TOKEN_REGISTER : %04x", _Value);
|
2010-06-08 19:37:08 -06:00
|
|
|
break;
|
|
|
|
case FIFO_BASE_LO:
|
|
|
|
WriteLow ((u32 &)fifo.CPBase, _Value & 0xFFE0);
|
2013-03-31 17:10:21 -06:00
|
|
|
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_BASE_LO : %04x", _Value);
|
2010-06-08 19:37:08 -06:00
|
|
|
break;
|
|
|
|
case FIFO_BASE_HI:
|
|
|
|
WriteHigh((u32 &)fifo.CPBase, _Value);
|
2013-03-31 17:10:21 -06:00
|
|
|
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_BASE_HI : %04x", _Value);
|
2010-06-08 19:37:08 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FIFO_END_LO:
|
|
|
|
WriteLow ((u32 &)fifo.CPEnd, _Value & 0xFFE0);
|
2013-03-31 17:10:21 -06:00
|
|
|
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_END_LO : %04x", _Value);
|
2010-06-08 19:37:08 -06:00
|
|
|
break;
|
|
|
|
case FIFO_END_HI:
|
|
|
|
WriteHigh((u32 &)fifo.CPEnd, _Value);
|
2013-03-31 17:10:21 -06:00
|
|
|
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_END_HI : %04x", _Value);
|
2010-06-08 19:37:08 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FIFO_WRITE_POINTER_LO:
|
|
|
|
WriteLow ((u32 &)fifo.CPWritePointer, _Value & 0xFFE0);
|
2013-03-31 17:10:21 -06:00
|
|
|
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_WRITE_POINTER_LO : %04x", _Value);
|
2010-06-08 19:37:08 -06:00
|
|
|
break;
|
|
|
|
case FIFO_WRITE_POINTER_HI:
|
|
|
|
WriteHigh((u32 &)fifo.CPWritePointer, _Value);
|
2013-03-31 17:10:21 -06:00
|
|
|
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_WRITE_POINTER_HI : %04x", _Value);
|
2010-06-08 19:37:08 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FIFO_READ_POINTER_LO:
|
|
|
|
WriteLow ((u32 &)fifo.CPReadPointer, _Value & 0xFFE0);
|
2013-03-31 17:10:21 -06:00
|
|
|
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_READ_POINTER_LO : %04x", _Value);
|
2010-06-08 19:37:08 -06:00
|
|
|
break;
|
|
|
|
case FIFO_READ_POINTER_HI:
|
|
|
|
WriteHigh((u32 &)fifo.CPReadPointer, _Value);
|
2012-03-11 09:40:39 -06:00
|
|
|
fifo.SafeCPReadPointer = fifo.CPReadPointer;
|
2013-03-31 17:10:21 -06:00
|
|
|
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_READ_POINTER_HI : %04x", _Value);
|
2010-06-08 19:37:08 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FIFO_HI_WATERMARK_LO:
|
2010-06-14 03:05:47 -06:00
|
|
|
WriteLow ((u32 &)fifo.CPHiWatermark, _Value);
|
2013-03-31 17:10:21 -06:00
|
|
|
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_HI_WATERMARK_LO : %04x", _Value);
|
2010-06-08 19:37:08 -06:00
|
|
|
break;
|
|
|
|
case FIFO_HI_WATERMARK_HI:
|
2010-06-14 03:05:47 -06:00
|
|
|
WriteHigh((u32 &)fifo.CPHiWatermark, _Value);
|
2013-03-31 17:10:21 -06:00
|
|
|
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_HI_WATERMARK_HI : %04x", _Value);
|
2010-06-08 19:37:08 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FIFO_LO_WATERMARK_LO:
|
2010-06-14 03:05:47 -06:00
|
|
|
WriteLow ((u32 &)fifo.CPLoWatermark, _Value);
|
2013-03-31 17:10:21 -06:00
|
|
|
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_LO_WATERMARK_LO : %04x", _Value);
|
2010-06-08 19:37:08 -06:00
|
|
|
break;
|
|
|
|
case FIFO_LO_WATERMARK_HI:
|
2010-06-14 03:05:47 -06:00
|
|
|
WriteHigh((u32 &)fifo.CPLoWatermark, _Value);
|
2013-03-31 17:10:21 -06:00
|
|
|
DEBUG_LOG(COMMANDPROCESSOR,"\t Write to FIFO_LO_WATERMARK_HI : %04x", _Value);
|
2010-06-08 19:37:08 -06:00
|
|
|
break;
|
|
|
|
|
2010-06-14 03:05:47 -06:00
|
|
|
case FIFO_BP_LO:
|
Big Fifo Commit Part2: Now the fifo is more stable than my first commit, so is time...
- ReImplementing Single Core Mode like Dual Core Mode Style.
- Stage 1: My goal is, we have the Fifo, CommandProccessor code the more clear, maintenible and documented possible. When I quit dolphin I want any developer can continue with the work only reading the code.
* Big Refactoring: A lot of functions was changed the names, and modularized.
Now the FifoLoop and CatchUpGPU does not exist, was replaced by RunGpu() and RunGpuLoop().
The general idea is modeling the code like the real HW. The fifo is only a buffer where the Write Gather Pipe write the commands and from the Graphic Processor read these.
* Big Clean UP a lot of obsolete code and comments was deleted, like DcFakeWachDog, "Fifo very soon hack", etc.
In the stage 2, I will refactoring more code doing emphasis in the division of CommandProcessor, Fifo, Gpu Emulation. Beside I will comment all functions and variables in the code (Don't worry I will ask for English help for this part ;) )
Please test a lot SC mode and DC mode :)
Thank you so much for testing always and the patience. I don't like broke your favorite game but... you must believe me this part is very sensible, I only try to contribute for have a better and stable dolphin emulator.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7185 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-02-16 21:25:21 -07:00
|
|
|
WriteLow ((u32 &)fifo.CPBreakpoint, _Value & 0xFFE0);
|
2013-03-31 17:10:21 -06:00
|
|
|
DEBUG_LOG(COMMANDPROCESSOR,"Write to FIFO_BP_LO : %04x", _Value);
|
2010-06-08 19:37:08 -06:00
|
|
|
break;
|
2010-06-14 03:05:47 -06:00
|
|
|
case FIFO_BP_HI:
|
Big Fifo Commit Part2: Now the fifo is more stable than my first commit, so is time...
- ReImplementing Single Core Mode like Dual Core Mode Style.
- Stage 1: My goal is, we have the Fifo, CommandProccessor code the more clear, maintenible and documented possible. When I quit dolphin I want any developer can continue with the work only reading the code.
* Big Refactoring: A lot of functions was changed the names, and modularized.
Now the FifoLoop and CatchUpGPU does not exist, was replaced by RunGpu() and RunGpuLoop().
The general idea is modeling the code like the real HW. The fifo is only a buffer where the Write Gather Pipe write the commands and from the Graphic Processor read these.
* Big Clean UP a lot of obsolete code and comments was deleted, like DcFakeWachDog, "Fifo very soon hack", etc.
In the stage 2, I will refactoring more code doing emphasis in the division of CommandProcessor, Fifo, Gpu Emulation. Beside I will comment all functions and variables in the code (Don't worry I will ask for English help for this part ;) )
Please test a lot SC mode and DC mode :)
Thank you so much for testing always and the patience. I don't like broke your favorite game but... you must believe me this part is very sensible, I only try to contribute for have a better and stable dolphin emulator.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7185 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-02-16 21:25:21 -07:00
|
|
|
WriteHigh((u32 &)fifo.CPBreakpoint, _Value);
|
2013-03-31 17:10:21 -06:00
|
|
|
DEBUG_LOG(COMMANDPROCESSOR,"Write to FIFO_BP_HI : %04x", _Value);
|
2010-06-08 19:37:08 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FIFO_RW_DISTANCE_HI:
|
2010-06-14 15:55:40 -06:00
|
|
|
WriteHigh((u32 &)fifo.CPReadWriteDistance, _Value);
|
2011-02-12 19:21:11 -07:00
|
|
|
if (fifo.CPReadWriteDistance == 0)
|
|
|
|
{
|
|
|
|
GPFifo::ResetGatherPipe();
|
|
|
|
ResetVideoBuffer();
|
2013-01-25 02:04:31 -07:00
|
|
|
}
|
|
|
|
else
|
2011-02-13 08:08:37 -07:00
|
|
|
{
|
2013-03-19 19:51:12 -06:00
|
|
|
ResetVideoBuffer();
|
2011-02-13 08:08:37 -07:00
|
|
|
}
|
|
|
|
IncrementCheckContextId();
|
2013-03-31 17:10:21 -06:00
|
|
|
DEBUG_LOG(COMMANDPROCESSOR,"Try to write to FIFO_RW_DISTANCE_HI : %04x", _Value);
|
2012-03-08 21:33:29 -07:00
|
|
|
break;
|
|
|
|
case FIFO_RW_DISTANCE_LO:
|
|
|
|
WriteLow((u32 &)fifo.CPReadWriteDistance, _Value & 0xFFE0);
|
2013-03-31 17:10:21 -06:00
|
|
|
DEBUG_LOG(COMMANDPROCESSOR,"Try to write to FIFO_RW_DISTANCE_LO : %04x", _Value);
|
2010-06-08 19:37:08 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
WARN_LOG(COMMANDPROCESSOR, "(w16) unknown CP reg write %04x @ %08x", _Value, _Address);
|
|
|
|
}
|
|
|
|
|
2011-01-30 18:28:32 -07:00
|
|
|
if (!IsOnThread())
|
Big Fifo Commit Part2: Now the fifo is more stable than my first commit, so is time...
- ReImplementing Single Core Mode like Dual Core Mode Style.
- Stage 1: My goal is, we have the Fifo, CommandProccessor code the more clear, maintenible and documented possible. When I quit dolphin I want any developer can continue with the work only reading the code.
* Big Refactoring: A lot of functions was changed the names, and modularized.
Now the FifoLoop and CatchUpGPU does not exist, was replaced by RunGpu() and RunGpuLoop().
The general idea is modeling the code like the real HW. The fifo is only a buffer where the Write Gather Pipe write the commands and from the Graphic Processor read these.
* Big Clean UP a lot of obsolete code and comments was deleted, like DcFakeWachDog, "Fifo very soon hack", etc.
In the stage 2, I will refactoring more code doing emphasis in the division of CommandProcessor, Fifo, Gpu Emulation. Beside I will comment all functions and variables in the code (Don't worry I will ask for English help for this part ;) )
Please test a lot SC mode and DC mode :)
Thank you so much for testing always and the patience. I don't like broke your favorite game but... you must believe me this part is very sensible, I only try to contribute for have a better and stable dolphin emulator.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7185 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-02-16 21:25:21 -07:00
|
|
|
RunGpu();
|
2010-06-08 19:37:08 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void Read32(u32& _rReturnValue, const u32 _Address)
|
|
|
|
{
|
|
|
|
_rReturnValue = 0;
|
|
|
|
_dbg_assert_msg_(COMMANDPROCESSOR, 0, "Read32 from CommandProccessor at 0x%08x", _Address);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Write32(const u32 _Data, const u32 _Address)
|
|
|
|
{
|
|
|
|
_dbg_assert_msg_(COMMANDPROCESSOR, 0, "Write32 at CommandProccessor at 0x%08x", _Address);
|
|
|
|
}
|
|
|
|
|
|
|
|
void STACKALIGN GatherPipeBursted()
|
|
|
|
{
|
2012-03-18 19:54:58 -06:00
|
|
|
ProcessFifoEvents();
|
2010-06-08 19:37:08 -06:00
|
|
|
// if we aren't linked, we don't care about gather pipe data
|
2010-06-14 15:55:40 -06:00
|
|
|
if (!m_CPCtrlReg.GPLinkEnable)
|
2010-06-15 08:24:01 -06:00
|
|
|
{
|
2011-01-30 18:28:32 -07:00
|
|
|
if (!IsOnThread())
|
2013-04-24 07:21:54 -06:00
|
|
|
{
|
Big Fifo Commit Part2: Now the fifo is more stable than my first commit, so is time...
- ReImplementing Single Core Mode like Dual Core Mode Style.
- Stage 1: My goal is, we have the Fifo, CommandProccessor code the more clear, maintenible and documented possible. When I quit dolphin I want any developer can continue with the work only reading the code.
* Big Refactoring: A lot of functions was changed the names, and modularized.
Now the FifoLoop and CatchUpGPU does not exist, was replaced by RunGpu() and RunGpuLoop().
The general idea is modeling the code like the real HW. The fifo is only a buffer where the Write Gather Pipe write the commands and from the Graphic Processor read these.
* Big Clean UP a lot of obsolete code and comments was deleted, like DcFakeWachDog, "Fifo very soon hack", etc.
In the stage 2, I will refactoring more code doing emphasis in the division of CommandProcessor, Fifo, Gpu Emulation. Beside I will comment all functions and variables in the code (Don't worry I will ask for English help for this part ;) )
Please test a lot SC mode and DC mode :)
Thank you so much for testing always and the patience. I don't like broke your favorite game but... you must believe me this part is very sensible, I only try to contribute for have a better and stable dolphin emulator.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7185 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-02-16 21:25:21 -07:00
|
|
|
RunGpu();
|
2013-04-24 07:21:54 -06:00
|
|
|
}
|
2012-03-18 19:54:58 -06:00
|
|
|
else
|
|
|
|
{
|
2013-03-31 17:10:21 -06:00
|
|
|
// In multibuffer mode is not allowed write in the same FIFO attached to the GPU.
|
2012-03-18 19:54:58 -06:00
|
|
|
// Fix Pokemon XD in DC mode.
|
|
|
|
if((ProcessorInterface::Fifo_CPUEnd == fifo.CPEnd) && (ProcessorInterface::Fifo_CPUBase == fifo.CPBase)
|
|
|
|
&& fifo.CPReadWriteDistance > 0)
|
|
|
|
{
|
|
|
|
waitingForPEInterruptDisable = true;
|
|
|
|
ProcessFifoAllDistance();
|
|
|
|
waitingForPEInterruptDisable = false;
|
|
|
|
}
|
|
|
|
}
|
2010-06-08 19:37:08 -06:00
|
|
|
return;
|
2010-06-15 08:24:01 -06:00
|
|
|
}
|
2010-06-08 19:37:08 -06:00
|
|
|
|
2011-01-30 18:28:32 -07:00
|
|
|
if (IsOnThread())
|
2013-03-14 00:08:26 -06:00
|
|
|
SetCpStatus(true);
|
2010-12-11 05:42:55 -07:00
|
|
|
|
2013-03-31 17:10:21 -06:00
|
|
|
// update the fifo pointer
|
2010-06-15 08:24:01 -06:00
|
|
|
if (fifo.CPWritePointer >= fifo.CPEnd)
|
|
|
|
fifo.CPWritePointer = fifo.CPBase;
|
2010-06-08 19:37:08 -06:00
|
|
|
else
|
2010-06-15 08:24:01 -06:00
|
|
|
fifo.CPWritePointer += GATHER_PIPE_SIZE;
|
2010-06-08 19:37:08 -06:00
|
|
|
|
2010-06-15 08:24:01 -06:00
|
|
|
Common::AtomicAdd(fifo.CPReadWriteDistance, GATHER_PIPE_SIZE);
|
2010-06-14 15:55:40 -06:00
|
|
|
|
2011-01-30 18:28:32 -07:00
|
|
|
if (!IsOnThread())
|
Big Fifo Commit Part2: Now the fifo is more stable than my first commit, so is time...
- ReImplementing Single Core Mode like Dual Core Mode Style.
- Stage 1: My goal is, we have the Fifo, CommandProccessor code the more clear, maintenible and documented possible. When I quit dolphin I want any developer can continue with the work only reading the code.
* Big Refactoring: A lot of functions was changed the names, and modularized.
Now the FifoLoop and CatchUpGPU does not exist, was replaced by RunGpu() and RunGpuLoop().
The general idea is modeling the code like the real HW. The fifo is only a buffer where the Write Gather Pipe write the commands and from the Graphic Processor read these.
* Big Clean UP a lot of obsolete code and comments was deleted, like DcFakeWachDog, "Fifo very soon hack", etc.
In the stage 2, I will refactoring more code doing emphasis in the division of CommandProcessor, Fifo, Gpu Emulation. Beside I will comment all functions and variables in the code (Don't worry I will ask for English help for this part ;) )
Please test a lot SC mode and DC mode :)
Thank you so much for testing always and the patience. I don't like broke your favorite game but... you must believe me this part is very sensible, I only try to contribute for have a better and stable dolphin emulator.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7185 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-02-16 21:25:21 -07:00
|
|
|
RunGpu();
|
2010-06-15 08:24:01 -06:00
|
|
|
|
2013-04-24 07:21:54 -06:00
|
|
|
_assert_msg_(COMMANDPROCESSOR, fifo.CPReadWriteDistance <= fifo.CPEnd - fifo.CPBase,
|
2013-03-31 17:10:21 -06:00
|
|
|
"FIFO is overflowed by GatherPipe !\nCPU thread is too fast!");
|
2010-06-16 01:22:47 -06:00
|
|
|
|
2010-06-15 08:24:01 -06:00
|
|
|
// check if we are in sync
|
2011-01-30 18:28:32 -07:00
|
|
|
_assert_msg_(COMMANDPROCESSOR, fifo.CPWritePointer == ProcessorInterface::Fifo_CPUWritePointer, "FIFOs linked but out of sync");
|
|
|
|
_assert_msg_(COMMANDPROCESSOR, fifo.CPBase == ProcessorInterface::Fifo_CPUBase, "FIFOs linked but out of sync");
|
|
|
|
_assert_msg_(COMMANDPROCESSOR, fifo.CPEnd == ProcessorInterface::Fifo_CPUEnd, "FIFOs linked but out of sync");
|
2010-06-08 19:37:08 -06:00
|
|
|
}
|
|
|
|
|
2010-12-11 05:42:55 -07:00
|
|
|
void UpdateInterrupts(u64 userdata)
|
|
|
|
{
|
2013-03-19 19:51:12 -06:00
|
|
|
if (userdata)
|
2010-12-11 05:42:55 -07:00
|
|
|
{
|
|
|
|
interruptSet = true;
|
2013-03-19 19:51:12 -06:00
|
|
|
INFO_LOG(COMMANDPROCESSOR,"Interrupt set");
|
2013-04-24 07:21:54 -06:00
|
|
|
ProcessorInterface::SetInterrupt(INT_CAUSE_CP, true);
|
2010-12-11 05:42:55 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-12-12 21:44:33 -07:00
|
|
|
interruptSet = false;
|
|
|
|
INFO_LOG(COMMANDPROCESSOR,"Interrupt cleared");
|
2013-04-24 07:21:54 -06:00
|
|
|
ProcessorInterface::SetInterrupt(INT_CAUSE_CP, false);
|
2010-12-11 05:42:55 -07:00
|
|
|
}
|
2013-03-19 19:51:12 -06:00
|
|
|
interruptWaiting = false;
|
2010-12-11 05:42:55 -07:00
|
|
|
}
|
|
|
|
|
2011-02-13 19:18:03 -07:00
|
|
|
void UpdateInterruptsFromVideoBackend(u64 userdata)
|
2010-06-08 19:37:08 -06:00
|
|
|
{
|
2011-01-30 18:28:32 -07:00
|
|
|
CoreTiming::ScheduleEvent_Threadsafe(0, et_UpdateInterrupts, userdata);
|
2010-06-08 19:37:08 -06:00
|
|
|
}
|
|
|
|
|
2010-11-23 23:02:03 -07:00
|
|
|
// This is called by the ProcessorInterface when PI_FIFO_RESET is written to.
|
2010-08-10 01:25:35 -06:00
|
|
|
void AbortFrame()
|
|
|
|
{
|
Big Fifo Commit Part2: Now the fifo is more stable than my first commit, so is time...
- ReImplementing Single Core Mode like Dual Core Mode Style.
- Stage 1: My goal is, we have the Fifo, CommandProccessor code the more clear, maintenible and documented possible. When I quit dolphin I want any developer can continue with the work only reading the code.
* Big Refactoring: A lot of functions was changed the names, and modularized.
Now the FifoLoop and CatchUpGPU does not exist, was replaced by RunGpu() and RunGpuLoop().
The general idea is modeling the code like the real HW. The fifo is only a buffer where the Write Gather Pipe write the commands and from the Graphic Processor read these.
* Big Clean UP a lot of obsolete code and comments was deleted, like DcFakeWachDog, "Fifo very soon hack", etc.
In the stage 2, I will refactoring more code doing emphasis in the division of CommandProcessor, Fifo, Gpu Emulation. Beside I will comment all functions and variables in the code (Don't worry I will ask for English help for this part ;) )
Please test a lot SC mode and DC mode :)
Thank you so much for testing always and the patience. I don't like broke your favorite game but... you must believe me this part is very sensible, I only try to contribute for have a better and stable dolphin emulator.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7185 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-02-16 21:25:21 -07:00
|
|
|
|
2010-08-10 01:25:35 -06:00
|
|
|
}
|
|
|
|
|
2013-03-14 00:08:26 -06:00
|
|
|
void SetCpStatus(bool isCPUThread)
|
2010-12-11 05:42:55 -07:00
|
|
|
{
|
2013-03-19 19:51:12 -06:00
|
|
|
// overflow & underflow check
|
2010-12-11 05:42:55 -07:00
|
|
|
fifo.bFF_HiWatermark = (fifo.CPReadWriteDistance > fifo.CPHiWatermark);
|
2013-03-19 19:51:12 -06:00
|
|
|
fifo.bFF_LoWatermark = (fifo.CPReadWriteDistance < fifo.CPLoWatermark);
|
2013-03-14 00:08:26 -06:00
|
|
|
|
2013-04-24 07:21:54 -06:00
|
|
|
// breakpoint
|
2013-03-14 00:08:26 -06:00
|
|
|
if (!isCPUThread)
|
2013-02-15 18:51:09 -07:00
|
|
|
{
|
|
|
|
if (fifo.bFF_BPEnable)
|
|
|
|
{
|
|
|
|
if (fifo.CPBreakpoint == fifo.CPReadPointer)
|
2011-02-08 05:00:41 -07:00
|
|
|
{
|
2013-02-15 18:51:09 -07:00
|
|
|
if (!fifo.bFF_Breakpoint)
|
|
|
|
{
|
|
|
|
INFO_LOG(COMMANDPROCESSOR, "Hit breakpoint at %i", fifo.CPReadPointer);
|
|
|
|
fifo.bFF_Breakpoint = true;
|
|
|
|
IncrementCheckContextId();
|
|
|
|
}
|
2011-02-08 05:00:41 -07:00
|
|
|
}
|
2013-02-15 18:51:09 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (fifo.bFF_Breakpoint)
|
|
|
|
INFO_LOG(COMMANDPROCESSOR, "Cleared breakpoint at %i", fifo.CPReadPointer);
|
|
|
|
fifo.bFF_Breakpoint = false;
|
|
|
|
}
|
|
|
|
}
|
2010-12-11 05:42:55 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (fifo.bFF_Breakpoint)
|
2010-12-12 08:25:03 -07:00
|
|
|
INFO_LOG(COMMANDPROCESSOR, "Cleared breakpoint at %i", fifo.CPReadPointer);
|
2013-02-15 18:51:09 -07:00
|
|
|
fifo.bFF_Breakpoint = false;
|
2010-12-11 05:42:55 -07:00
|
|
|
}
|
2013-02-15 18:51:09 -07:00
|
|
|
}
|
2010-12-11 05:42:55 -07:00
|
|
|
|
|
|
|
bool bpInt = fifo.bFF_Breakpoint && fifo.bFF_BPInt;
|
|
|
|
bool ovfInt = fifo.bFF_HiWatermark && fifo.bFF_HiWatermarkInt;
|
|
|
|
bool undfInt = fifo.bFF_LoWatermark && fifo.bFF_LoWatermarkInt;
|
2013-03-14 00:08:26 -06:00
|
|
|
|
2010-12-12 21:44:33 -07:00
|
|
|
bool interrupt = (bpInt || ovfInt || undfInt) && m_CPCtrlReg.GPReadEnable;
|
2010-12-11 05:42:55 -07:00
|
|
|
|
2013-01-25 02:04:31 -07:00
|
|
|
isHiWatermarkActive = ovfInt && m_CPCtrlReg.GPReadEnable;
|
|
|
|
isLoWatermarkActive = undfInt && m_CPCtrlReg.GPReadEnable;
|
2012-03-04 22:40:10 -07:00
|
|
|
|
2013-03-19 19:51:12 -06:00
|
|
|
if (interrupt != interruptSet && !interruptWaiting)
|
|
|
|
{
|
|
|
|
u64 userdata = interrupt?1:0;
|
|
|
|
if (IsOnThread())
|
|
|
|
{
|
|
|
|
if (!interrupt || bpInt || undfInt || ovfInt)
|
2012-03-04 22:40:10 -07:00
|
|
|
{
|
2013-03-14 00:08:26 -06:00
|
|
|
if (!isCPUThread)
|
2013-02-15 18:51:09 -07:00
|
|
|
{
|
2013-03-14 00:08:26 -06:00
|
|
|
// GPU thread:
|
2013-02-15 18:51:09 -07:00
|
|
|
interruptWaiting = true;
|
|
|
|
CommandProcessor::UpdateInterruptsFromVideoBackend(userdata);
|
|
|
|
}
|
2013-03-14 00:08:26 -06:00
|
|
|
else
|
2013-02-15 18:51:09 -07:00
|
|
|
{
|
2013-03-14 00:08:26 -06:00
|
|
|
// CPU thread:
|
2013-02-15 18:51:09 -07:00
|
|
|
interruptSet = interrupt;
|
2013-03-19 19:51:12 -06:00
|
|
|
INFO_LOG(COMMANDPROCESSOR,"Interrupt set");
|
|
|
|
ProcessorInterface::SetInterrupt(INT_CAUSE_CP, interrupt);
|
2013-02-15 18:51:09 -07:00
|
|
|
}
|
2012-03-04 22:40:10 -07:00
|
|
|
}
|
2013-03-19 19:51:12 -06:00
|
|
|
}
|
|
|
|
else
|
2013-04-24 07:21:54 -06:00
|
|
|
{
|
2013-03-19 19:51:12 -06:00
|
|
|
CommandProcessor::UpdateInterrupts(userdata);
|
2013-04-24 07:21:54 -06:00
|
|
|
}
|
2013-03-19 19:51:12 -06:00
|
|
|
}
|
2010-12-11 05:42:55 -07:00
|
|
|
}
|
|
|
|
|
2011-02-08 03:37:47 -07:00
|
|
|
void ProcessFifoToLoWatermark()
|
2010-12-11 05:42:55 -07:00
|
|
|
{
|
2011-01-30 18:28:32 -07:00
|
|
|
if (IsOnThread())
|
2010-12-11 05:42:55 -07:00
|
|
|
{
|
|
|
|
while (!CommandProcessor::interruptWaiting && fifo.bFF_GPReadEnable &&
|
|
|
|
fifo.CPReadWriteDistance > fifo.CPLoWatermark && !AtBreakpoint())
|
|
|
|
Common::YieldCPU();
|
|
|
|
}
|
2011-02-08 03:37:47 -07:00
|
|
|
bProcessFifoToLoWatermark = false;
|
2010-12-11 05:42:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void ProcessFifoAllDistance()
|
|
|
|
{
|
2011-01-30 18:28:32 -07:00
|
|
|
if (IsOnThread())
|
2010-12-11 05:42:55 -07:00
|
|
|
{
|
|
|
|
while (!CommandProcessor::interruptWaiting && fifo.bFF_GPReadEnable &&
|
2013-02-15 18:51:09 -07:00
|
|
|
fifo.CPReadWriteDistance && !AtBreakpoint())
|
2010-12-11 05:42:55 -07:00
|
|
|
Common::YieldCPU();
|
|
|
|
}
|
2010-12-13 00:56:54 -07:00
|
|
|
bProcessFifoAllDistance = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProcessFifoEvents()
|
|
|
|
{
|
2011-01-30 18:28:32 -07:00
|
|
|
if (IsOnThread() && (interruptWaiting || interruptFinishWaiting || interruptTokenWaiting))
|
|
|
|
CoreTiming::ProcessFifoWaitEvents();
|
2010-12-11 05:42:55 -07:00
|
|
|
}
|
|
|
|
|
Big Fifo Commit Part2: Now the fifo is more stable than my first commit, so is time...
- ReImplementing Single Core Mode like Dual Core Mode Style.
- Stage 1: My goal is, we have the Fifo, CommandProccessor code the more clear, maintenible and documented possible. When I quit dolphin I want any developer can continue with the work only reading the code.
* Big Refactoring: A lot of functions was changed the names, and modularized.
Now the FifoLoop and CatchUpGPU does not exist, was replaced by RunGpu() and RunGpuLoop().
The general idea is modeling the code like the real HW. The fifo is only a buffer where the Write Gather Pipe write the commands and from the Graphic Processor read these.
* Big Clean UP a lot of obsolete code and comments was deleted, like DcFakeWachDog, "Fifo very soon hack", etc.
In the stage 2, I will refactoring more code doing emphasis in the division of CommandProcessor, Fifo, Gpu Emulation. Beside I will comment all functions and variables in the code (Don't worry I will ask for English help for this part ;) )
Please test a lot SC mode and DC mode :)
Thank you so much for testing always and the patience. I don't like broke your favorite game but... you must believe me this part is very sensible, I only try to contribute for have a better and stable dolphin emulator.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7185 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-02-16 21:25:21 -07:00
|
|
|
void Shutdown()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetCpStatusRegister()
|
|
|
|
{
|
|
|
|
// Here always there is one fifo attached to the GPU
|
|
|
|
m_CPStatusReg.Breakpoint = fifo.bFF_Breakpoint;
|
2013-02-15 18:51:09 -07:00
|
|
|
m_CPStatusReg.ReadIdle = !fifo.CPReadWriteDistance || AtBreakpoint() || (fifo.CPReadPointer == fifo.CPWritePointer);
|
|
|
|
m_CPStatusReg.CommandIdle = !fifo.CPReadWriteDistance || AtBreakpoint() || !fifo.bFF_GPReadEnable;
|
Big Fifo Commit Part2: Now the fifo is more stable than my first commit, so is time...
- ReImplementing Single Core Mode like Dual Core Mode Style.
- Stage 1: My goal is, we have the Fifo, CommandProccessor code the more clear, maintenible and documented possible. When I quit dolphin I want any developer can continue with the work only reading the code.
* Big Refactoring: A lot of functions was changed the names, and modularized.
Now the FifoLoop and CatchUpGPU does not exist, was replaced by RunGpu() and RunGpuLoop().
The general idea is modeling the code like the real HW. The fifo is only a buffer where the Write Gather Pipe write the commands and from the Graphic Processor read these.
* Big Clean UP a lot of obsolete code and comments was deleted, like DcFakeWachDog, "Fifo very soon hack", etc.
In the stage 2, I will refactoring more code doing emphasis in the division of CommandProcessor, Fifo, Gpu Emulation. Beside I will comment all functions and variables in the code (Don't worry I will ask for English help for this part ;) )
Please test a lot SC mode and DC mode :)
Thank you so much for testing always and the patience. I don't like broke your favorite game but... you must believe me this part is very sensible, I only try to contribute for have a better and stable dolphin emulator.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7185 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-02-16 21:25:21 -07:00
|
|
|
m_CPStatusReg.UnderflowLoWatermark = fifo.bFF_LoWatermark;
|
|
|
|
m_CPStatusReg.OverflowHiWatermark = fifo.bFF_HiWatermark;
|
2012-03-13 05:35:11 -06:00
|
|
|
|
Big Fifo Commit Part2: Now the fifo is more stable than my first commit, so is time...
- ReImplementing Single Core Mode like Dual Core Mode Style.
- Stage 1: My goal is, we have the Fifo, CommandProccessor code the more clear, maintenible and documented possible. When I quit dolphin I want any developer can continue with the work only reading the code.
* Big Refactoring: A lot of functions was changed the names, and modularized.
Now the FifoLoop and CatchUpGPU does not exist, was replaced by RunGpu() and RunGpuLoop().
The general idea is modeling the code like the real HW. The fifo is only a buffer where the Write Gather Pipe write the commands and from the Graphic Processor read these.
* Big Clean UP a lot of obsolete code and comments was deleted, like DcFakeWachDog, "Fifo very soon hack", etc.
In the stage 2, I will refactoring more code doing emphasis in the division of CommandProcessor, Fifo, Gpu Emulation. Beside I will comment all functions and variables in the code (Don't worry I will ask for English help for this part ;) )
Please test a lot SC mode and DC mode :)
Thank you so much for testing always and the patience. I don't like broke your favorite game but... you must believe me this part is very sensible, I only try to contribute for have a better and stable dolphin emulator.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7185 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-02-16 21:25:21 -07:00
|
|
|
INFO_LOG(COMMANDPROCESSOR,"\t Read from STATUS_REGISTER : %04x", m_CPStatusReg.Hex);
|
|
|
|
DEBUG_LOG(COMMANDPROCESSOR, "(r) status: iBP %s | fReadIdle %s | fCmdIdle %s | iOvF %s | iUndF %s"
|
|
|
|
, m_CPStatusReg.Breakpoint ? "ON" : "OFF"
|
|
|
|
, m_CPStatusReg.ReadIdle ? "ON" : "OFF"
|
|
|
|
, m_CPStatusReg.CommandIdle ? "ON" : "OFF"
|
|
|
|
, m_CPStatusReg.OverflowHiWatermark ? "ON" : "OFF"
|
|
|
|
, m_CPStatusReg.UnderflowLoWatermark ? "ON" : "OFF"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetCpControlRegister()
|
|
|
|
{
|
2013-03-25 15:23:20 -06:00
|
|
|
// If the new fifo is being attached, force an exception check
|
|
|
|
// This fixes the hang while booting Eternal Darkness
|
Big Fifo Commit Part2: Now the fifo is more stable than my first commit, so is time...
- ReImplementing Single Core Mode like Dual Core Mode Style.
- Stage 1: My goal is, we have the Fifo, CommandProccessor code the more clear, maintenible and documented possible. When I quit dolphin I want any developer can continue with the work only reading the code.
* Big Refactoring: A lot of functions was changed the names, and modularized.
Now the FifoLoop and CatchUpGPU does not exist, was replaced by RunGpu() and RunGpuLoop().
The general idea is modeling the code like the real HW. The fifo is only a buffer where the Write Gather Pipe write the commands and from the Graphic Processor read these.
* Big Clean UP a lot of obsolete code and comments was deleted, like DcFakeWachDog, "Fifo very soon hack", etc.
In the stage 2, I will refactoring more code doing emphasis in the division of CommandProcessor, Fifo, Gpu Emulation. Beside I will comment all functions and variables in the code (Don't worry I will ask for English help for this part ;) )
Please test a lot SC mode and DC mode :)
Thank you so much for testing always and the patience. I don't like broke your favorite game but... you must believe me this part is very sensible, I only try to contribute for have a better and stable dolphin emulator.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7185 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-02-16 21:25:21 -07:00
|
|
|
if (!fifo.bFF_GPReadEnable && m_CPCtrlReg.GPReadEnable && !m_CPCtrlReg.BPEnable)
|
|
|
|
{
|
2013-03-25 15:23:20 -06:00
|
|
|
CoreTiming::ForceExceptionCheck(0);
|
Big Fifo Commit Part2: Now the fifo is more stable than my first commit, so is time...
- ReImplementing Single Core Mode like Dual Core Mode Style.
- Stage 1: My goal is, we have the Fifo, CommandProccessor code the more clear, maintenible and documented possible. When I quit dolphin I want any developer can continue with the work only reading the code.
* Big Refactoring: A lot of functions was changed the names, and modularized.
Now the FifoLoop and CatchUpGPU does not exist, was replaced by RunGpu() and RunGpuLoop().
The general idea is modeling the code like the real HW. The fifo is only a buffer where the Write Gather Pipe write the commands and from the Graphic Processor read these.
* Big Clean UP a lot of obsolete code and comments was deleted, like DcFakeWachDog, "Fifo very soon hack", etc.
In the stage 2, I will refactoring more code doing emphasis in the division of CommandProcessor, Fifo, Gpu Emulation. Beside I will comment all functions and variables in the code (Don't worry I will ask for English help for this part ;) )
Please test a lot SC mode and DC mode :)
Thank you so much for testing always and the patience. I don't like broke your favorite game but... you must believe me this part is very sensible, I only try to contribute for have a better and stable dolphin emulator.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7185 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-02-16 21:25:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
fifo.bFF_BPInt = m_CPCtrlReg.BPInt;
|
|
|
|
fifo.bFF_BPEnable = m_CPCtrlReg.BPEnable;
|
|
|
|
fifo.bFF_HiWatermarkInt = m_CPCtrlReg.FifoOverflowIntEnable;
|
|
|
|
fifo.bFF_LoWatermarkInt = m_CPCtrlReg.FifoUnderflowIntEnable;
|
|
|
|
fifo.bFF_GPLinkEnable = m_CPCtrlReg.GPLinkEnable;
|
|
|
|
|
|
|
|
if(m_CPCtrlReg.GPReadEnable && m_CPCtrlReg.GPLinkEnable)
|
|
|
|
{
|
|
|
|
ProcessorInterface::Fifo_CPUWritePointer = fifo.CPWritePointer;
|
|
|
|
ProcessorInterface::Fifo_CPUBase = fifo.CPBase;
|
|
|
|
ProcessorInterface::Fifo_CPUEnd = fifo.CPEnd;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(fifo.bFF_GPReadEnable && !m_CPCtrlReg.GPReadEnable)
|
|
|
|
{
|
|
|
|
fifo.bFF_GPReadEnable = m_CPCtrlReg.GPReadEnable;
|
|
|
|
while(fifo.isGpuReadingData) Common::YieldCPU();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
fifo.bFF_GPReadEnable = m_CPCtrlReg.GPReadEnable;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEBUG_LOG(COMMANDPROCESSOR, "\t GPREAD %s | BP %s | Int %s | OvF %s | UndF %s | LINK %s"
|
|
|
|
, fifo.bFF_GPReadEnable ? "ON" : "OFF"
|
|
|
|
, fifo.bFF_BPEnable ? "ON" : "OFF"
|
|
|
|
, fifo.bFF_BPInt ? "ON" : "OFF"
|
|
|
|
, m_CPCtrlReg.FifoOverflowIntEnable ? "ON" : "OFF"
|
|
|
|
, m_CPCtrlReg.FifoUnderflowIntEnable ? "ON" : "OFF"
|
|
|
|
, m_CPCtrlReg.GPLinkEnable ? "ON" : "OFF"
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-01-21 06:58:29 -07:00
|
|
|
// NOTE: The implementation of this function should be correct, but we intentionally aren't using it at the moment.
|
|
|
|
// We don't emulate proper GP timing anyway at the moment, so this code would just slow down emulation.
|
Big Fifo Commit Part2: Now the fifo is more stable than my first commit, so is time...
- ReImplementing Single Core Mode like Dual Core Mode Style.
- Stage 1: My goal is, we have the Fifo, CommandProccessor code the more clear, maintenible and documented possible. When I quit dolphin I want any developer can continue with the work only reading the code.
* Big Refactoring: A lot of functions was changed the names, and modularized.
Now the FifoLoop and CatchUpGPU does not exist, was replaced by RunGpu() and RunGpuLoop().
The general idea is modeling the code like the real HW. The fifo is only a buffer where the Write Gather Pipe write the commands and from the Graphic Processor read these.
* Big Clean UP a lot of obsolete code and comments was deleted, like DcFakeWachDog, "Fifo very soon hack", etc.
In the stage 2, I will refactoring more code doing emphasis in the division of CommandProcessor, Fifo, Gpu Emulation. Beside I will comment all functions and variables in the code (Don't worry I will ask for English help for this part ;) )
Please test a lot SC mode and DC mode :)
Thank you so much for testing always and the patience. I don't like broke your favorite game but... you must believe me this part is very sensible, I only try to contribute for have a better and stable dolphin emulator.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7185 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-02-16 21:25:21 -07:00
|
|
|
void SetCpClearRegister()
|
|
|
|
{
|
2012-01-21 06:58:29 -07:00
|
|
|
// if (IsOnThread())
|
|
|
|
// {
|
|
|
|
// if (!m_CPClearReg.ClearFifoUnderflow && m_CPClearReg.ClearFifoOverflow)
|
|
|
|
// bProcessFifoToLoWatermark = true;
|
|
|
|
// }
|
Big Fifo Commit Part2: Now the fifo is more stable than my first commit, so is time...
- ReImplementing Single Core Mode like Dual Core Mode Style.
- Stage 1: My goal is, we have the Fifo, CommandProccessor code the more clear, maintenible and documented possible. When I quit dolphin I want any developer can continue with the work only reading the code.
* Big Refactoring: A lot of functions was changed the names, and modularized.
Now the FifoLoop and CatchUpGPU does not exist, was replaced by RunGpu() and RunGpuLoop().
The general idea is modeling the code like the real HW. The fifo is only a buffer where the Write Gather Pipe write the commands and from the Graphic Processor read these.
* Big Clean UP a lot of obsolete code and comments was deleted, like DcFakeWachDog, "Fifo very soon hack", etc.
In the stage 2, I will refactoring more code doing emphasis in the division of CommandProcessor, Fifo, Gpu Emulation. Beside I will comment all functions and variables in the code (Don't worry I will ask for English help for this part ;) )
Please test a lot SC mode and DC mode :)
Thank you so much for testing always and the patience. I don't like broke your favorite game but... you must believe me this part is very sensible, I only try to contribute for have a better and stable dolphin emulator.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7185 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-02-16 21:25:21 -07:00
|
|
|
}
|
2010-12-11 05:42:55 -07:00
|
|
|
|
2013-02-15 18:51:09 -07:00
|
|
|
void Update()
|
|
|
|
{
|
|
|
|
while (VITicks > m_cpClockOrigin && fifo.isGpuReadingData && IsOnThread())
|
|
|
|
Common::YieldCPU();
|
|
|
|
|
|
|
|
if (fifo.isGpuReadingData)
|
|
|
|
Common::AtomicAdd(VITicks, SystemTimers::GetTicksPerSecond() / 10000);
|
|
|
|
}
|
2010-06-08 19:37:08 -06:00
|
|
|
} // end of namespace CommandProcessor
|