mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Rejigger some FIFO buffer variables to be more rational.
videoBuffer -> s_video_buffer size -> s_video_buffer_write_ptr g_pVideoData -> g_video_buffer_read_ptr (impl moved to Fifo.cpp) This eradicates the wonderful use of 'size' as a global name, and makes it clear that s_video_buffer_write_ptr and g_video_buffer_read_ptr are the two ends of the FIFO buffer s_video_buffer. Oh, and remove a useless namespace {}.
This commit is contained in:
@ -57,7 +57,7 @@ static void DecodePrimitiveStream(u32 iBufferSize)
|
|||||||
{
|
{
|
||||||
while (streamSize > 0 && iBufferSize >= vertexSize)
|
while (streamSize > 0 && iBufferSize >= vertexSize)
|
||||||
{
|
{
|
||||||
g_pVideoData += vertexSize;
|
g_video_buffer_read_ptr += vertexSize;
|
||||||
iBufferSize -= vertexSize;
|
iBufferSize -= vertexSize;
|
||||||
streamSize--;
|
streamSize--;
|
||||||
}
|
}
|
||||||
@ -94,26 +94,26 @@ static void ReadXFData(u32 iBufferSize)
|
|||||||
|
|
||||||
static void ExecuteDisplayList(u32 addr, u32 count)
|
static void ExecuteDisplayList(u32 addr, u32 count)
|
||||||
{
|
{
|
||||||
u8 *videoDataSave = g_pVideoData;
|
u8 *videoDataSave = g_video_buffer_read_ptr;
|
||||||
|
|
||||||
u8 *dlStart = Memory::GetPointer(addr);
|
u8 *dlStart = Memory::GetPointer(addr);
|
||||||
|
|
||||||
g_pVideoData = dlStart;
|
g_video_buffer_read_ptr = dlStart;
|
||||||
|
|
||||||
while (OpcodeDecoder::CommandRunnable(count))
|
while (OpcodeDecoder::CommandRunnable(count))
|
||||||
{
|
{
|
||||||
OpcodeDecoder::Run(count);
|
OpcodeDecoder::Run(count);
|
||||||
|
|
||||||
// if data was read by the opcode decoder then the video data pointer changed
|
// if data was read by the opcode decoder then the video data pointer changed
|
||||||
u32 readCount = (u32)(g_pVideoData - dlStart);
|
u32 readCount = (u32)(g_video_buffer_read_ptr - dlStart);
|
||||||
dlStart = g_pVideoData;
|
dlStart = g_video_buffer_read_ptr;
|
||||||
|
|
||||||
_assert_msg_(VIDEO, count >= readCount, "Display list underrun");
|
_assert_msg_(VIDEO, count >= readCount, "Display list underrun");
|
||||||
|
|
||||||
count -= readCount;
|
count -= readCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pVideoData = videoDataSave;
|
g_video_buffer_read_ptr = videoDataSave;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DecodeStandard(u32 bufferSize)
|
static void DecodeStandard(u32 bufferSize)
|
||||||
|
@ -57,7 +57,7 @@ void DoState(PointerWrap &p)
|
|||||||
p.Do(interruptWaiting);
|
p.Do(interruptWaiting);
|
||||||
|
|
||||||
// Is this right?
|
// Is this right?
|
||||||
p.DoArray(g_pVideoData,writePos);
|
p.DoArray(g_video_buffer_read_ptr,writePos);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UpdateInterrupts_Wrapper(u64 userdata, int cyclesLate)
|
static void UpdateInterrupts_Wrapper(u64 userdata, int cyclesLate)
|
||||||
@ -95,7 +95,7 @@ void Init()
|
|||||||
interruptSet = false;
|
interruptSet = false;
|
||||||
interruptWaiting = false;
|
interruptWaiting = false;
|
||||||
|
|
||||||
g_pVideoData = nullptr;
|
g_video_buffer_read_ptr = nullptr;
|
||||||
g_bSkipCurrentFrame = false;
|
g_bSkipCurrentFrame = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,7 +311,7 @@ bool RunBuffer()
|
|||||||
|
|
||||||
_dbg_assert_(COMMANDPROCESSOR, writePos >= readPos);
|
_dbg_assert_(COMMANDPROCESSOR, writePos >= readPos);
|
||||||
|
|
||||||
g_pVideoData = &commandBuffer[readPos];
|
g_video_buffer_read_ptr = &commandBuffer[readPos];
|
||||||
|
|
||||||
u32 availableBytes = writePos - readPos;
|
u32 availableBytes = writePos - readPos;
|
||||||
|
|
||||||
@ -322,7 +322,7 @@ bool RunBuffer()
|
|||||||
OpcodeDecoder::Run(availableBytes);
|
OpcodeDecoder::Run(availableBytes);
|
||||||
|
|
||||||
// if data was read by the opcode decoder then the video data pointer changed
|
// if data was read by the opcode decoder then the video data pointer changed
|
||||||
readPos = (u32)(g_pVideoData - &commandBuffer[0]);
|
readPos = (u32)(g_video_buffer_read_ptr - &commandBuffer[0]);
|
||||||
_dbg_assert_(VIDEO, writePos >= readPos);
|
_dbg_assert_(VIDEO, writePos >= readPos);
|
||||||
availableBytes = writePos - readPos;
|
availableBytes = writePos - readPos;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include "VideoCommon/VertexManagerBase.h"
|
#include "VideoCommon/VertexManagerBase.h"
|
||||||
|
|
||||||
extern u8* g_pVideoData;
|
extern u8* g_video_buffer_read_ptr;
|
||||||
|
|
||||||
#if _M_SSE >= 0x301 && !(defined __GNUC__ && !defined __SSSE3__)
|
#if _M_SSE >= 0x301 && !(defined __GNUC__ && !defined __SSSE3__)
|
||||||
#include <tmmintrin.h>
|
#include <tmmintrin.h>
|
||||||
@ -14,20 +14,20 @@ extern u8* g_pVideoData;
|
|||||||
|
|
||||||
__forceinline void DataSkip(u32 skip)
|
__forceinline void DataSkip(u32 skip)
|
||||||
{
|
{
|
||||||
g_pVideoData += skip;
|
g_video_buffer_read_ptr += skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
// probably unnecessary
|
// probably unnecessary
|
||||||
template <int count>
|
template <int count>
|
||||||
__forceinline void DataSkip()
|
__forceinline void DataSkip()
|
||||||
{
|
{
|
||||||
g_pVideoData += count;
|
g_video_buffer_read_ptr += count;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
__forceinline T DataPeek(int _uOffset)
|
__forceinline T DataPeek(int _uOffset)
|
||||||
{
|
{
|
||||||
auto const result = Common::FromBigEndian(*reinterpret_cast<T*>(g_pVideoData + _uOffset));
|
auto const result = Common::FromBigEndian(*reinterpret_cast<T*>(g_video_buffer_read_ptr + _uOffset));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,8 +58,8 @@ __forceinline T DataRead()
|
|||||||
class DataReader
|
class DataReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline DataReader() : buffer(g_pVideoData), offset(0) {}
|
inline DataReader() : buffer(g_video_buffer_read_ptr), offset(0) {}
|
||||||
inline ~DataReader() { g_pVideoData += offset; }
|
inline ~DataReader() { g_video_buffer_read_ptr += offset; }
|
||||||
template <typename T> inline T Read()
|
template <typename T> inline T Read()
|
||||||
{
|
{
|
||||||
const T result = Common::FromBigEndian(*(T*)(buffer + offset));
|
const T result = Common::FromBigEndian(*(T*)(buffer + offset));
|
||||||
@ -94,14 +94,14 @@ __forceinline u32 DataReadU32()
|
|||||||
|
|
||||||
__forceinline u32 DataReadU32Unswapped()
|
__forceinline u32 DataReadU32Unswapped()
|
||||||
{
|
{
|
||||||
u32 tmp = *(u32*)g_pVideoData;
|
u32 tmp = *(u32*)g_video_buffer_read_ptr;
|
||||||
g_pVideoData += 4;
|
g_video_buffer_read_ptr += 4;
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
__forceinline u8* DataGetPosition()
|
__forceinline u8* DataGetPosition()
|
||||||
{
|
{
|
||||||
return g_pVideoData;
|
return g_video_buffer_read_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -22,21 +22,22 @@
|
|||||||
|
|
||||||
bool g_bSkipCurrentFrame = false;
|
bool g_bSkipCurrentFrame = false;
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
static volatile bool GpuRunningState = false;
|
static volatile bool GpuRunningState = false;
|
||||||
static volatile bool EmuRunningState = false;
|
static volatile bool EmuRunningState = false;
|
||||||
static std::mutex m_csHWVidOccupied;
|
static std::mutex m_csHWVidOccupied;
|
||||||
// STATE_TO_SAVE
|
// STATE_TO_SAVE
|
||||||
static u8 *videoBuffer;
|
static u8* s_video_buffer;
|
||||||
static int size = 0;
|
static u8* s_video_buffer_write_ptr;
|
||||||
} // namespace
|
|
||||||
|
// Note: during display list execution, temporarily points to the list instead
|
||||||
|
// of inside s_video_buffer.
|
||||||
|
u8* g_video_buffer_read_ptr;
|
||||||
|
|
||||||
void Fifo_DoState(PointerWrap &p)
|
void Fifo_DoState(PointerWrap &p)
|
||||||
{
|
{
|
||||||
p.DoArray(videoBuffer, FIFO_SIZE);
|
p.DoArray(s_video_buffer, FIFO_SIZE);
|
||||||
p.Do(size);
|
p.DoPointer(s_video_buffer_write_ptr, s_video_buffer);
|
||||||
p.DoPointer(g_pVideoData, videoBuffer);
|
p.DoPointer(g_video_buffer_read_ptr, s_video_buffer);
|
||||||
p.Do(g_bSkipCurrentFrame);
|
p.Do(g_bSkipCurrentFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,8 +62,8 @@ void Fifo_PauseAndLock(bool doLock, bool unpauseOnUnlock)
|
|||||||
|
|
||||||
void Fifo_Init()
|
void Fifo_Init()
|
||||||
{
|
{
|
||||||
videoBuffer = (u8*)AllocateMemoryPages(FIFO_SIZE);
|
s_video_buffer = (u8*)AllocateMemoryPages(FIFO_SIZE);
|
||||||
size = 0;
|
s_video_buffer_write_ptr = s_video_buffer;
|
||||||
GpuRunningState = false;
|
GpuRunningState = false;
|
||||||
Common::AtomicStore(CommandProcessor::VITicks, CommandProcessor::m_cpClockOrigin);
|
Common::AtomicStore(CommandProcessor::VITicks, CommandProcessor::m_cpClockOrigin);
|
||||||
}
|
}
|
||||||
@ -70,18 +71,18 @@ void Fifo_Init()
|
|||||||
void Fifo_Shutdown()
|
void Fifo_Shutdown()
|
||||||
{
|
{
|
||||||
if (GpuRunningState) PanicAlert("Fifo shutting down while active");
|
if (GpuRunningState) PanicAlert("Fifo shutting down while active");
|
||||||
FreeMemoryPages(videoBuffer, FIFO_SIZE);
|
FreeMemoryPages(s_video_buffer, FIFO_SIZE);
|
||||||
videoBuffer = nullptr;
|
s_video_buffer = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8* GetVideoBufferStartPtr()
|
u8* GetVideoBufferStartPtr()
|
||||||
{
|
{
|
||||||
return videoBuffer;
|
return s_video_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8* GetVideoBufferEndPtr()
|
u8* GetVideoBufferEndPtr()
|
||||||
{
|
{
|
||||||
return &videoBuffer[size];
|
return s_video_buffer_write_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fifo_SetRendering(bool enabled)
|
void Fifo_SetRendering(bool enabled)
|
||||||
@ -111,26 +112,27 @@ void EmulatorState(bool running)
|
|||||||
// Description: RunGpuLoop() sends data through this function.
|
// Description: RunGpuLoop() sends data through this function.
|
||||||
void ReadDataFromFifo(u8* _uData, u32 len)
|
void ReadDataFromFifo(u8* _uData, u32 len)
|
||||||
{
|
{
|
||||||
if (size + len >= FIFO_SIZE)
|
if (len > (s_video_buffer + FIFO_SIZE - s_video_buffer_write_ptr))
|
||||||
{
|
{
|
||||||
int pos = (int)(g_pVideoData - videoBuffer);
|
size_t size = s_video_buffer_write_ptr - g_video_buffer_read_ptr;
|
||||||
size -= pos;
|
if (len > FIFO_SIZE - size)
|
||||||
if (size + len > FIFO_SIZE)
|
|
||||||
{
|
{
|
||||||
PanicAlert("FIFO out of bounds (size = %i, len = %i at %08x)", size, len, pos);
|
PanicAlert("FIFO out of bounds (existing %lu + new %lu > %lu)", (unsigned long) size, (unsigned long) len, (unsigned long) FIFO_SIZE);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
memmove(&videoBuffer[0], &videoBuffer[pos], size);
|
memmove(s_video_buffer, g_video_buffer_read_ptr, size);
|
||||||
g_pVideoData = videoBuffer;
|
s_video_buffer_write_ptr = s_video_buffer + size;
|
||||||
|
g_video_buffer_read_ptr = s_video_buffer;
|
||||||
}
|
}
|
||||||
// Copy new video instructions to videoBuffer for future use in rendering the new picture
|
// Copy new video instructions to s_video_buffer for future use in rendering the new picture
|
||||||
memcpy(videoBuffer + size, _uData, len);
|
memcpy(s_video_buffer_write_ptr, _uData, len);
|
||||||
size += len;
|
s_video_buffer_write_ptr += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResetVideoBuffer()
|
void ResetVideoBuffer()
|
||||||
{
|
{
|
||||||
g_pVideoData = videoBuffer;
|
g_video_buffer_read_ptr = s_video_buffer;
|
||||||
size = 0;
|
s_video_buffer_write_ptr = s_video_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -181,7 +183,7 @@ void RunGpuLoop()
|
|||||||
|
|
||||||
Common::AtomicStore(fifo.CPReadPointer, readPtr);
|
Common::AtomicStore(fifo.CPReadPointer, readPtr);
|
||||||
Common::AtomicAdd(fifo.CPReadWriteDistance, -32);
|
Common::AtomicAdd(fifo.CPReadWriteDistance, -32);
|
||||||
if ((GetVideoBufferEndPtr() - g_pVideoData) == 0)
|
if ((GetVideoBufferEndPtr() - g_video_buffer_read_ptr) == 0)
|
||||||
Common::AtomicStore(fifo.SafeCPReadPointer, fifo.CPReadPointer);
|
Common::AtomicStore(fifo.SafeCPReadPointer, fifo.CPReadPointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,12 +31,11 @@
|
|||||||
#include "VideoCommon/XFMemory.h"
|
#include "VideoCommon/XFMemory.h"
|
||||||
|
|
||||||
|
|
||||||
u8* g_pVideoData = nullptr;
|
|
||||||
bool g_bRecordFifoData = false;
|
bool g_bRecordFifoData = false;
|
||||||
|
|
||||||
static u32 InterpretDisplayList(u32 address, u32 size)
|
static u32 InterpretDisplayList(u32 address, u32 size)
|
||||||
{
|
{
|
||||||
u8* old_pVideoData = g_pVideoData;
|
u8* old_pVideoData = g_video_buffer_read_ptr;
|
||||||
u8* startAddress = Memory::GetPointer(address);
|
u8* startAddress = Memory::GetPointer(address);
|
||||||
|
|
||||||
u32 cycles = 0;
|
u32 cycles = 0;
|
||||||
@ -44,12 +43,12 @@ static u32 InterpretDisplayList(u32 address, u32 size)
|
|||||||
// Avoid the crash if Memory::GetPointer failed ..
|
// Avoid the crash if Memory::GetPointer failed ..
|
||||||
if (startAddress != nullptr)
|
if (startAddress != nullptr)
|
||||||
{
|
{
|
||||||
g_pVideoData = startAddress;
|
g_video_buffer_read_ptr = startAddress;
|
||||||
|
|
||||||
// temporarily swap dl and non-dl (small "hack" for the stats)
|
// temporarily swap dl and non-dl (small "hack" for the stats)
|
||||||
Statistics::SwapDL();
|
Statistics::SwapDL();
|
||||||
|
|
||||||
u8 *end = g_pVideoData + size;
|
u8 *end = g_video_buffer_read_ptr + size;
|
||||||
cycles = OpcodeDecoder_Run(end);
|
cycles = OpcodeDecoder_Run(end);
|
||||||
INCSTAT(stats.thisFrame.numDListsCalled);
|
INCSTAT(stats.thisFrame.numDListsCalled);
|
||||||
|
|
||||||
@ -58,7 +57,7 @@ static u32 InterpretDisplayList(u32 address, u32 size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// reset to the old pointer
|
// reset to the old pointer
|
||||||
g_pVideoData = old_pVideoData;
|
g_video_buffer_read_ptr = old_pVideoData;
|
||||||
|
|
||||||
return cycles;
|
return cycles;
|
||||||
}
|
}
|
||||||
@ -107,8 +106,8 @@ static void UnknownOpcode(u8 cmd_byte, void *buffer, bool preprocess)
|
|||||||
|
|
||||||
static u32 Decode(u8* end)
|
static u32 Decode(u8* end)
|
||||||
{
|
{
|
||||||
u8 *opcodeStart = g_pVideoData;
|
u8 *opcodeStart = g_video_buffer_read_ptr;
|
||||||
if (g_pVideoData == end)
|
if (g_video_buffer_read_ptr == end)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
u8 cmd_byte = DataReadU8();
|
u8 cmd_byte = DataReadU8();
|
||||||
@ -121,7 +120,7 @@ static u32 Decode(u8* end)
|
|||||||
|
|
||||||
case GX_LOAD_CP_REG: //0x08
|
case GX_LOAD_CP_REG: //0x08
|
||||||
{
|
{
|
||||||
if (end - g_pVideoData < 1 + 4)
|
if (end - g_video_buffer_read_ptr < 1 + 4)
|
||||||
return 0;
|
return 0;
|
||||||
cycles = 12;
|
cycles = 12;
|
||||||
u8 sub_cmd = DataReadU8();
|
u8 sub_cmd = DataReadU8();
|
||||||
@ -133,11 +132,11 @@ static u32 Decode(u8* end)
|
|||||||
|
|
||||||
case GX_LOAD_XF_REG:
|
case GX_LOAD_XF_REG:
|
||||||
{
|
{
|
||||||
if (end - g_pVideoData < 4)
|
if (end - g_video_buffer_read_ptr < 4)
|
||||||
return 0;
|
return 0;
|
||||||
u32 Cmd2 = DataReadU32();
|
u32 Cmd2 = DataReadU32();
|
||||||
int transfer_size = ((Cmd2 >> 16) & 15) + 1;
|
int transfer_size = ((Cmd2 >> 16) & 15) + 1;
|
||||||
if ((size_t) (end - g_pVideoData) < transfer_size * sizeof(u32))
|
if ((size_t) (end - g_video_buffer_read_ptr) < transfer_size * sizeof(u32))
|
||||||
return 0;
|
return 0;
|
||||||
cycles = 18 + 6 * transfer_size;
|
cycles = 18 + 6 * transfer_size;
|
||||||
u32 xf_address = Cmd2 & 0xFFFF;
|
u32 xf_address = Cmd2 & 0xFFFF;
|
||||||
@ -148,25 +147,25 @@ static u32 Decode(u8* end)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case GX_LOAD_INDX_A: //used for position matrices
|
case GX_LOAD_INDX_A: //used for position matrices
|
||||||
if (end - g_pVideoData < 4)
|
if (end - g_video_buffer_read_ptr < 4)
|
||||||
return 0;
|
return 0;
|
||||||
cycles = 6;
|
cycles = 6;
|
||||||
LoadIndexedXF(DataReadU32(), 0xC);
|
LoadIndexedXF(DataReadU32(), 0xC);
|
||||||
break;
|
break;
|
||||||
case GX_LOAD_INDX_B: //used for normal matrices
|
case GX_LOAD_INDX_B: //used for normal matrices
|
||||||
if (end - g_pVideoData < 4)
|
if (end - g_video_buffer_read_ptr < 4)
|
||||||
return 0;
|
return 0;
|
||||||
cycles = 6;
|
cycles = 6;
|
||||||
LoadIndexedXF(DataReadU32(), 0xD);
|
LoadIndexedXF(DataReadU32(), 0xD);
|
||||||
break;
|
break;
|
||||||
case GX_LOAD_INDX_C: //used for postmatrices
|
case GX_LOAD_INDX_C: //used for postmatrices
|
||||||
if (end - g_pVideoData < 4)
|
if (end - g_video_buffer_read_ptr < 4)
|
||||||
return 0;
|
return 0;
|
||||||
cycles = 6;
|
cycles = 6;
|
||||||
LoadIndexedXF(DataReadU32(), 0xE);
|
LoadIndexedXF(DataReadU32(), 0xE);
|
||||||
break;
|
break;
|
||||||
case GX_LOAD_INDX_D: //used for lights
|
case GX_LOAD_INDX_D: //used for lights
|
||||||
if (end - g_pVideoData < 4)
|
if (end - g_video_buffer_read_ptr < 4)
|
||||||
return 0;
|
return 0;
|
||||||
cycles = 6;
|
cycles = 6;
|
||||||
LoadIndexedXF(DataReadU32(), 0xF);
|
LoadIndexedXF(DataReadU32(), 0xF);
|
||||||
@ -174,7 +173,7 @@ static u32 Decode(u8* end)
|
|||||||
|
|
||||||
case GX_CMD_CALL_DL:
|
case GX_CMD_CALL_DL:
|
||||||
{
|
{
|
||||||
if (end - g_pVideoData < 8)
|
if (end - g_video_buffer_read_ptr < 8)
|
||||||
return 0;
|
return 0;
|
||||||
u32 address = DataReadU32();
|
u32 address = DataReadU32();
|
||||||
u32 count = DataReadU32();
|
u32 count = DataReadU32();
|
||||||
@ -196,7 +195,7 @@ static u32 Decode(u8* end)
|
|||||||
// In skipped_frame case: We have to let BP writes through because they set
|
// In skipped_frame case: We have to let BP writes through because they set
|
||||||
// tokens and stuff. TODO: Call a much simplified LoadBPReg instead.
|
// tokens and stuff. TODO: Call a much simplified LoadBPReg instead.
|
||||||
{
|
{
|
||||||
if (end - g_pVideoData < 4)
|
if (end - g_video_buffer_read_ptr < 4)
|
||||||
return 0;
|
return 0;
|
||||||
cycles = 12;
|
cycles = 12;
|
||||||
u32 bp_cmd = DataReadU32();
|
u32 bp_cmd = DataReadU32();
|
||||||
@ -211,7 +210,7 @@ static u32 Decode(u8* end)
|
|||||||
{
|
{
|
||||||
cycles = 1600;
|
cycles = 1600;
|
||||||
// load vertices
|
// load vertices
|
||||||
if (end - g_pVideoData < 2)
|
if (end - g_video_buffer_read_ptr < 2)
|
||||||
return 0;
|
return 0;
|
||||||
u16 numVertices = DataReadU16();
|
u16 numVertices = DataReadU16();
|
||||||
|
|
||||||
@ -219,7 +218,7 @@ static u32 Decode(u8* end)
|
|||||||
cmd_byte & GX_VAT_MASK, // Vertex loader index (0 - 7)
|
cmd_byte & GX_VAT_MASK, // Vertex loader index (0 - 7)
|
||||||
(cmd_byte & GX_PRIMITIVE_MASK) >> GX_PRIMITIVE_SHIFT,
|
(cmd_byte & GX_PRIMITIVE_MASK) >> GX_PRIMITIVE_SHIFT,
|
||||||
numVertices,
|
numVertices,
|
||||||
end - g_pVideoData,
|
end - g_video_buffer_read_ptr,
|
||||||
g_bSkipCurrentFrame))
|
g_bSkipCurrentFrame))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
@ -235,14 +234,14 @@ static u32 Decode(u8* end)
|
|||||||
|
|
||||||
// Display lists get added directly into the FIFO stream
|
// Display lists get added directly into the FIFO stream
|
||||||
if (g_bRecordFifoData && cmd_byte != GX_CMD_CALL_DL)
|
if (g_bRecordFifoData && cmd_byte != GX_CMD_CALL_DL)
|
||||||
FifoRecorder::GetInstance().WriteGPCommand(opcodeStart, u32(g_pVideoData - opcodeStart));
|
FifoRecorder::GetInstance().WriteGPCommand(opcodeStart, u32(g_video_buffer_read_ptr - opcodeStart));
|
||||||
|
|
||||||
return cycles;
|
return cycles;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpcodeDecoder_Init()
|
void OpcodeDecoder_Init()
|
||||||
{
|
{
|
||||||
g_pVideoData = GetVideoBufferStartPtr();
|
g_video_buffer_read_ptr = GetVideoBufferStartPtr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -255,11 +254,11 @@ u32 OpcodeDecoder_Run(u8* end)
|
|||||||
u32 totalCycles = 0;
|
u32 totalCycles = 0;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
u8* old = g_pVideoData;
|
u8* old = g_video_buffer_read_ptr;
|
||||||
u32 cycles = Decode(end);
|
u32 cycles = Decode(end);
|
||||||
if (cycles == 0)
|
if (cycles == 0)
|
||||||
{
|
{
|
||||||
g_pVideoData = old;
|
g_video_buffer_read_ptr = old;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
totalCycles += cycles;
|
totalCycles += cycles;
|
||||||
|
@ -74,7 +74,7 @@ protected:
|
|||||||
|
|
||||||
void ResetPointers()
|
void ResetPointers()
|
||||||
{
|
{
|
||||||
g_pVideoData = &input_memory[0];
|
g_video_buffer_read_ptr = &input_memory[0];
|
||||||
VertexManager::s_pCurBufferPointer = &output_memory[0];
|
VertexManager::s_pCurBufferPointer = &output_memory[0];
|
||||||
m_input_pos = m_output_pos = 0;
|
m_input_pos = m_output_pos = 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user