diff --git a/Source/Core/VideoCommon/Src/DataReader.h b/Source/Core/VideoCommon/Src/DataReader.h
new file mode 100644
index 0000000000..09623a5c69
--- /dev/null
+++ b/Source/Core/VideoCommon/Src/DataReader.h
@@ -0,0 +1,80 @@
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+#ifndef _DATAREADER_H
+#define _DATAREADER_H
+
+
+extern u8* g_pVideoData;
+
+
+
+inline u8 DataPeek8(u32 _uOffset)
+{
+ return g_pVideoData[_uOffset];
+}
+
+inline u16 DataPeek16(u32 _uOffset)
+{
+ return Common::swap16(*(u16*)&g_pVideoData[_uOffset]);
+}
+
+inline u32 DataPeek32(u32 _uOffset)
+{
+ return Common::swap32(*(u32*)&g_pVideoData[_uOffset]);
+}
+
+inline u8 DataReadU8()
+{
+ return *g_pVideoData++;
+}
+
+inline u16 DataReadU16()
+{
+ u16 tmp = Common::swap16(*(u16*)g_pVideoData);
+ g_pVideoData+=2;
+ return tmp;
+}
+
+inline u32 DataReadU32()
+{
+ u32 tmp = Common::swap32(*(u32*)g_pVideoData);
+ g_pVideoData+=4;
+ return tmp;
+}
+
+inline float DataReadF32()
+{
+ union {u32 i; float f;} temp;
+ temp.i = Common::swap32(*(u32*)g_pVideoData);
+ g_pVideoData+=4;
+ float tmp = temp.f;
+ return tmp;
+}
+
+inline u8* DataGetPosition()
+{
+ return g_pVideoData;
+}
+
+inline void DataSkip(u32 skip)
+{
+ g_pVideoData += skip;
+}
+
+#endif
+
diff --git a/Source/Core/VideoCommon/Src/Fifo.cpp b/Source/Core/VideoCommon/Src/Fifo.cpp
index 03587688d4..c0bdd6628a 100644
--- a/Source/Core/VideoCommon/Src/Fifo.cpp
+++ b/Source/Core/VideoCommon/Src/Fifo.cpp
@@ -23,31 +23,23 @@
#include "Fifo.h"
-#if defined(DATAREADER_INLINE)
extern u8* g_pVideoData;
-#else
-FifoReader fifo;
-#endif
bool fifoStateRun = true;
// STATE_TO_SAVE
static u8 *videoBuffer;
static int size = 0;
-static int readptr = 0;
-void Fifo_DoState(PointerWrap &p) {
+void Fifo_DoState(PointerWrap &p)
+{
p.DoArray(videoBuffer, FIFO_SIZE);
p.Do(size);
- p.Do(readptr);
}
void Fifo_Init()
{
videoBuffer = (u8*)AllocateMemoryPages(FIFO_SIZE);
-#ifndef DATAREADER_INLINE
- fifo.Init(videoBuffer, videoBuffer); //zero length. there is no data yet.
-#endif
fifoStateRun = true;
}
@@ -57,7 +49,8 @@ void Fifo_Shutdown()
fifoStateRun = false;
}
-void Fifo_Stop() {
+void Fifo_Stop()
+{
fifoStateRun = false;
}
@@ -66,68 +59,11 @@ u8* FAKE_GetFifoStartPtr()
return videoBuffer;
}
-int FAKE_GetFifoSize()
-{
- if (size < readptr)
- {
- PanicAlert("GFX Fifo underrun encountered (size = %i, readptr = %i)", size, readptr);
- }
- return (size - readptr);
-}
u8* FAKE_GetFifoEndPtr()
{
return &videoBuffer[size];
}
-u8 FAKE_PeekFifo8(u32 _uOffset)
-{
- return videoBuffer[readptr + _uOffset];
-}
-
-u16 FAKE_PeekFifo16(u32 _uOffset)
-{
- return Common::swap16(*(u16*)&videoBuffer[readptr + _uOffset]);
-}
-
-u32 FAKE_PeekFifo32(u32 _uOffset)
-{
- return Common::swap32(*(u32*)&videoBuffer[readptr + _uOffset]);
-}
-
-u8 FAKE_ReadFifo8()
-{
- return videoBuffer[readptr++];
-}
-
-int FAKE_GetPosition()
-{
- return readptr;
-}
-
-u8* FAKE_GetFifoCurrentPtr()
-{
- return &videoBuffer[readptr];
-}
-
-u16 FAKE_ReadFifo16()
-{
- u16 val = Common::swap16(*(u16*)(videoBuffer+readptr));
- readptr += 2;
- return val;
-}
-
-u32 FAKE_ReadFifo32()
-{
- u32 val = Common::swap32(*(u32*)(videoBuffer+readptr));
- readptr += 4;
- return val;
-}
-
-void FAKE_SkipFifo(u32 skip)
-{
- readptr += skip;
-}
-
void Video_SendFifoData(u8* _uData)
{
// TODO (mb2): unrolled loop faster than memcpy here?
@@ -135,24 +71,14 @@ void Video_SendFifoData(u8* _uData)
size += 32;
if (size + 32 >= FIFO_SIZE)
{
- // TODO (mb2): Better and DataReader inline for DX9
-#ifdef DATAREADER_INLINE
- if (g_pVideoData) // for DX9 plugin "compatibility"
- readptr = (int)(g_pVideoData-videoBuffer);
-#endif
- if (FAKE_GetFifoSize() > readptr)
- {
- PanicAlert("FIFO out of bounds (sz = %i, at %08x)", FAKE_GetFifoSize(), readptr);
- }
-// DebugLog("FAKE BUFFER LOOPS");
- memmove(&videoBuffer[0], &videoBuffer[readptr], FAKE_GetFifoSize());
- // memset(&videoBuffer[FAKE_GetFifoSize()], 0, FIFO_SIZE - FAKE_GetFifoSize());
- size = FAKE_GetFifoSize();
- readptr = 0;
-#ifdef DATAREADER_INLINE
- if (g_pVideoData) // for DX9 plugin "compatibility"
- g_pVideoData = FAKE_GetFifoStartPtr();
-#endif
+ int pos = (int)(g_pVideoData-videoBuffer);
+ //if (size-pos > pos)
+ //{
+ // PanicAlert("FIFO out of bounds (sz = %i, at %08x)", FAKE_GetFifoSize(), readptr);
+ //}
+ memmove(&videoBuffer[0], &videoBuffer[pos], size - pos );
+ size -= pos;
+ g_pVideoData = FAKE_GetFifoStartPtr();
}
OpcodeDecoder_Run();
}
diff --git a/Source/Core/VideoCommon/Src/Fifo.h b/Source/Core/VideoCommon/Src/Fifo.h
index f673efafcd..33c900b774 100644
--- a/Source/Core/VideoCommon/Src/Fifo.h
+++ b/Source/Core/VideoCommon/Src/Fifo.h
@@ -23,50 +23,8 @@
#include "Common.h"
#include "ChunkFile.h"
-// TODO (mb2) clean this if ok
-#define DATAREADER_INLINE // comment to use the previous IDataReader way
-//#define DATAREADER_DEBUG // simple compare with the previous IDataReader way
-
-#if defined(DATAREADER_DEBUG) && !defined(DATAREADER_INLINE)
-#define DATAREADER_INLINE
-#endif
-
-
#define FIFO_SIZE (1024*1024)
-#ifndef DATAREADER_INLINE
-// inline for speed!
-class FifoReader
-{
- u8 *ptr;
- u8 *end;
- u8 *tempPtr; //single element stack :P
- u8 *tempEnd;
- bool pushed;
-public:
- void Init(u8 *_ptr, u8 *_end)
- {
- ptr = _ptr; end = _end; pushed = false;
- }
- bool IsPushed() {return pushed;}
- void Push(u8 *_ptr, u8 *_end) {pushed = true; tempPtr = ptr; tempEnd = end; ptr = _ptr; end = _end;}
- void Pop() {pushed = false; ptr = tempPtr; end = tempEnd;}
- u8 Peek8 (int offset) const { return ptr[offset]; }
- u16 Peek16(int offset) const { return Common::swap16(*(u16*)(ptr+offset)); }
- u32 Peek32(int offset) const { return Common::swap32(*(u32*)(ptr+offset)); }
- u8 Read8 () {return *ptr++;}
- u16 Read16() {const u16 value = Common::swap16(*((u16*)ptr)); ptr+=2; return value;}
- u32 Read32() {const u32 value = Common::swap32(*((u32*)ptr)); ptr+=4; return value;}
- float Read32F() {const u32 value = Common::swap32(*((u32*)ptr)); ptr+=4; return *(float*)&value;}
- int GetRemainSize() const { return (int)(end - ptr); }
- u8 *GetPtr() const { return ptr; }
- void MoveEndForward() { end += 32; }
- u8 *GetEnd() const { return end; }
-};
-
-extern FifoReader fifo;
-
-#endif
void Fifo_Init();
void Fifo_Shutdown();
void Fifo_EnterLoop(const SVideoInitialize &video_initialize);
diff --git a/Source/Core/VideoCommon/VideoCommon.vcproj b/Source/Core/VideoCommon/VideoCommon.vcproj
index 2115db996b..3bad9a8c86 100644
--- a/Source/Core/VideoCommon/VideoCommon.vcproj
+++ b/Source/Core/VideoCommon/VideoCommon.vcproj
@@ -418,6 +418,10 @@
RelativePath=".\Src\CPMemory.h"
>
+
+
diff --git a/Source/Plugins/Plugin_VideoDX9/Plugin_VideoDX9.vcproj b/Source/Plugins/Plugin_VideoDX9/Plugin_VideoDX9.vcproj
index 20d933ad23..497727f6f2 100644
--- a/Source/Plugins/Plugin_VideoDX9/Plugin_VideoDX9.vcproj
+++ b/Source/Plugins/Plugin_VideoDX9/Plugin_VideoDX9.vcproj
@@ -1193,14 +1193,6 @@
RelativePath=".\Src\CPStructs.h"
>
-
-
-
-
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/DataReader.cpp b/Source/Plugins/Plugin_VideoDX9/Src/DataReader.cpp
deleted file mode 100644
index 18447e336c..0000000000
--- a/Source/Plugins/Plugin_VideoDX9/Src/DataReader.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#include
-
-#include "Utils.h"
-#include "Common.h"
-#include "main.h"
-#include "DataReader.h"
-
-// =================================================================================================
-// CDataReader_Fifo
-// =================================================================================================
-
-IDataReader* g_pDataReader = NULL;
-extern u8 FAKE_ReadFifo8();
-extern u16 FAKE_ReadFifo16();
-extern u32 FAKE_ReadFifo32();
-
-CDataReader_Fifo::CDataReader_Fifo(void)
-{
- m_szName = "CDataReader_Fifo";
-}
-
-u8 CDataReader_Fifo::Read8(void)
-{
- return FAKE_ReadFifo8();
-};
-
-u16 CDataReader_Fifo::Read16(void)
-{
- return FAKE_ReadFifo16();
-};
-
-u32 CDataReader_Fifo::Read32(void)
-{
- return FAKE_ReadFifo32();
-};
-
-// =================================================================================================
-// CDataReader_Memory
-// =================================================================================================
-
-CDataReader_Memory::CDataReader_Memory(u32 _uAddress) :
- m_uReadAddress(_uAddress)
-{
-// F|RES: this wont work anymore caused by Mem2
-
-// m_pMemory = g_VideoInitialize.pGetMemoryPointer(0x00);
- m_szName = "CDataReader_Memory";
-}
-
-u32 CDataReader_Memory::GetReadAddress(void)
-{
- return m_uReadAddress;
-}
-
-u8 CDataReader_Memory::Read8(void)
-{
- u8 tmp = Memory_Read_U8(m_uReadAddress); //m_pMemory[m_uReadAddress];
- m_uReadAddress++;
- return tmp;
-}
-
-u16 CDataReader_Memory::Read16(void)
-{
- u16 tmp = Memory_Read_U16(m_uReadAddress); //_byteswap_ushort(*(u16*)&m_pMemory[m_uReadAddress]);
- m_uReadAddress += 2;
- return tmp;
-}
-
-u32 CDataReader_Memory::Read32(void)
-{
- u32 tmp =Memory_Read_U32(m_uReadAddress); // _byteswap_ulong(*(u32*)&m_pMemory[m_uReadAddress]);
- m_uReadAddress += 4;
- return tmp;
-}
\ No newline at end of file
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/DataReader.h b/Source/Plugins/Plugin_VideoDX9/Src/DataReader.h
deleted file mode 100644
index c9add1422e..0000000000
--- a/Source/Plugins/Plugin_VideoDX9/Src/DataReader.h
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#ifndef _DATAREADER_H
-#define _DATAREADER_H
-
-// =================================================================================================
-// IDataReader
-// =================================================================================================
-
-class IDataReader
-{
-protected:
- const char *m_szName;
-
-public:
- virtual u8 Read8 (void) = NULL;
- virtual u16 Read16(void) = NULL;
- virtual u32 Read32(void) = NULL;
-};
-
-// =================================================================================================
-// CDataReader_Fifo
-// =================================================================================================
-
-class CDataReader_Fifo : public IDataReader
-{
-private:
-
-public:
- CDataReader_Fifo(void);
-
- virtual u8 Read8(void);
- virtual u16 Read16(void);
- virtual u32 Read32(void);
-};
-
-// =================================================================================================
-// CDataReader_Memory
-// =================================================================================================
-
-class CDataReader_Memory : public IDataReader
-{
-private:
-
-// u8* m_pMemory;
- u32 m_uReadAddress;
-
-public:
-
- CDataReader_Memory(u32 _uAddress);
-
- u32 GetReadAddress(void);
-
- virtual u8 Read8(void);
- virtual u16 Read16(void);
- virtual u32 Read32(void);
-};
-
-extern IDataReader* g_pDataReader;
-
-#endif
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/OpcodeDecoding.cpp b/Source/Plugins/Plugin_VideoDX9/Src/OpcodeDecoding.cpp
index 95849bf14c..28e8641518 100644
--- a/Source/Plugins/Plugin_VideoDX9/Src/OpcodeDecoding.cpp
+++ b/Source/Plugins/Plugin_VideoDX9/Src/OpcodeDecoding.cpp
@@ -46,20 +46,15 @@
#include "DLCompiler.h"
#define CMDBUFFER_SIZE 1024*1024
+
DecodedVArray tempvarray;
-// TODO (mb2): all! DataReader inline for DX9
-#ifdef DATAREADER_INLINE
u8 *g_pVideoData = 0;
-#endif
+
+extern u8* FAKE_GetFifoStartPtr();
+extern u8* FAKE_GetFifoEndPtr();
+
void Decode();
-extern u8 FAKE_PeekFifo8(u32 _uOffset);
-extern u16 FAKE_PeekFifo16(u32 _uOffset);
-extern u32 FAKE_PeekFifo32(u32 _uOffset);
-extern int FAKE_GetFifoSize();
-
-CDataReader_Fifo g_fifoReader;
-
template
void Xchg(T& a, T&b)
{
@@ -70,11 +65,10 @@ void Xchg(T& a, T&b)
void ExecuteDisplayList(u32 address, u32 size)
{
- IDataReader* pOldReader = g_pDataReader;
+ u8* old_pVideoData = g_pVideoData;
-// address &= 0x01FFFFFF; // phys address
- CDataReader_Memory memoryReader(address);
- g_pDataReader = &memoryReader;
+ u8* startAddress = Memory_GetPtr(address);
+ g_pVideoData = startAddress;
// temporarily swap dl and non-dl(small "hack" for the stats)
Xchg(stats.thisFrame.numDLPrims, stats.thisFrame.numPrims);
@@ -82,10 +76,10 @@ void ExecuteDisplayList(u32 address, u32 size)
Xchg(stats.thisFrame.numCPLoadsInDL, stats.thisFrame.numCPLoads);
Xchg(stats.thisFrame.numBPLoadsInDL, stats.thisFrame.numBPLoads);
- while((memoryReader.GetReadAddress() - address) < size)
- {
- Decode();
- }
+ while((u32)(g_pVideoData - startAddress) < size)
+ {
+ Decode();
+ }
INCSTAT(stats.numDListsCalled);
INCSTAT(stats.thisFrame.numDListsCalled);
@@ -95,33 +89,17 @@ void ExecuteDisplayList(u32 address, u32 size)
Xchg(stats.thisFrame.numCPLoadsInDL, stats.thisFrame.numCPLoads);
Xchg(stats.thisFrame.numBPLoadsInDL, stats.thisFrame.numBPLoads);
- // reset to the old reader
- g_pDataReader = pOldReader;
+ // reset to the old pointer
+ g_pVideoData = old_pVideoData;
}
-inline u8 PeekFifo8(u32 _uOffset)
-{
- return FAKE_PeekFifo8(_uOffset);
-}
-
-inline u16 PeekFifo16(u32 _uOffset)
-{
- return FAKE_PeekFifo16(_uOffset);
-}
-
-inline u32 PeekFifo32(u32 _uOffset)
-{
- return FAKE_PeekFifo32(_uOffset);
-}
-
-
bool FifoCommandRunnable(void)
{
- u32 iBufferSize = FAKE_GetFifoSize();
+ u32 iBufferSize = (u32)(FAKE_GetFifoEndPtr()-g_pVideoData);
if (iBufferSize == 0)
return false; // can't peek
- u8 Cmd = PeekFifo8(0);
+ u8 Cmd = DataPeek8(0);
u32 iCommandSize = 0;
switch(Cmd)
@@ -165,7 +143,7 @@ bool FifoCommandRunnable(void)
if (iBufferSize >= 5)
{
iCommandSize = 1 + 4;
- u32 Cmd2 = PeekFifo32(1);
+ u32 Cmd2 = DataPeek32(1);
int dwTransferSize = ((Cmd2 >> 16) & 15) + 1;
iCommandSize += dwTransferSize * 4;
}
@@ -183,7 +161,7 @@ bool FifoCommandRunnable(void)
if (iBufferSize >= 3)
{
iCommandSize = 1 + 2;
- u16 numVertices = PeekFifo16(1);
+ u16 numVertices = DataPeek16(1);
VertexLoader& vtxLoader = g_VertexLoaders[Cmd & GX_VAT_MASK];
vtxLoader.Setup();
int vsize = vtxLoader.GetVertexSize();
@@ -254,7 +232,7 @@ bool FifoCommandRunnable(void)
void Decode(void)
{
- int Cmd = g_pDataReader->Read8();
+ int Cmd = DataReadU8();
switch(Cmd)
{
case GX_NOP:
@@ -262,42 +240,42 @@ void Decode(void)
case GX_LOAD_CP_REG: //0x08
{
- u32 SubCmd = g_pDataReader->Read8();
- u32 Value = g_pDataReader->Read32();
+ u32 SubCmd = DataReadU8();
+ u32 Value = DataReadU32();
LoadCPReg(SubCmd,Value);
}
break;
case GX_LOAD_XF_REG:
{
- u32 Cmd2 = g_pDataReader->Read32();
+ u32 Cmd2 = DataReadU32();
int dwTransferSize = ((Cmd2>>16)&15) + 1;
u32 dwAddress = Cmd2 & 0xFFFF;
static u32 pData[16];
for (int i=0; iRead32();
+ pData[i] = DataReadU32();
LoadXFReg(dwTransferSize,dwAddress,pData);
}
break;
case GX_LOAD_INDX_A: //used for position matrices
- LoadIndexedXF(g_pDataReader->Read32(),0xC);
+ LoadIndexedXF(DataReadU32(),0xC);
break;
case GX_LOAD_INDX_B: //used for normal matrices
- LoadIndexedXF(g_pDataReader->Read32(),0xD);
+ LoadIndexedXF(DataReadU32(),0xD);
break;
case GX_LOAD_INDX_C: //used for postmatrices
- LoadIndexedXF(g_pDataReader->Read32(),0xE);
+ LoadIndexedXF(DataReadU32(),0xE);
break;
case GX_LOAD_INDX_D: //used for lights
- LoadIndexedXF(g_pDataReader->Read32(),0xF);
+ LoadIndexedXF(DataReadU32(),0xF);
break;
case GX_CMD_CALL_DL:
{
- u32 dwAddr = g_pDataReader->Read32();
- u32 dwCount = g_pDataReader->Read32();
+ u32 dwAddr = DataReadU32();
+ u32 dwCount = DataReadU32();
ExecuteDisplayList(dwAddr, dwCount);
}
break;
@@ -312,7 +290,7 @@ void Decode(void)
case GX_LOAD_BP_REG: //0x61
{
- u32 cmd = g_pDataReader->Read32();
+ u32 cmd = DataReadU32();
LoadBPReg(cmd);
}
break;
@@ -322,7 +300,7 @@ void Decode(void)
if (Cmd&0x80)
{
// load vertices
- u16 numVertices = g_pDataReader->Read16();
+ u16 numVertices = DataReadU16();
tempvarray.Reset();
VertexLoader::SetVArray(&tempvarray);
VertexLoader& vtxLoader = g_VertexLoaders[Cmd & GX_VAT_MASK];
@@ -371,7 +349,7 @@ void Decode(void)
void OpcodeDecoder_Init()
{
- g_pDataReader = &g_fifoReader;
+ g_pVideoData = FAKE_GetFifoStartPtr();
tempvarray.Create(65536*3, 1, 8, 3, 2, 8);
}
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader.cpp b/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader.cpp
index 0509f9f6a4..6ce94d46cc 100644
--- a/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader.cpp
+++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader.cpp
@@ -69,29 +69,6 @@ void VertexLoader::SetVArray(DecodedVArray *_varray)
varray = _varray;
}
-inline u8 ReadBuffer8()
-{
- return g_pDataReader->Read8();
-}
-
-inline u16 ReadBuffer16()
-{
- //PowerPC byte ordering :(
- return g_pDataReader->Read16();
-}
-
-inline u32 ReadBuffer32()
-{
- //PowerPC byte ordering :(
- return g_pDataReader->Read32();
-}
-
-inline float ReadBuffer32F()
-{
- u32 temp = g_pDataReader->Read32();
- return *(float*)(&temp);
-}
-
#include "VertexLoader_MtxIndex.h"
#include "VertexLoader_Position.h"
#include "VertexLoader_Normal.h"
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader.h b/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader.h
index 6dcde42304..a001ace901 100644
--- a/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader.h
+++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader.h
@@ -45,6 +45,7 @@ int ComputeVertexSize(u32 components);
#include "CPStructs.h"
#include "DecodedVArray.h"
+#include "DataReader.h"
#define LOADERDECL __cdecl
typedef void (LOADERDECL *TPipelineFunction)(void*);
@@ -215,10 +216,6 @@ public:
extern VertexLoader g_VertexLoaders[8];
extern DecodedVArray* varray;
-extern inline u8 ReadBuffer8();
-extern inline u16 ReadBuffer16();
-extern inline u32 ReadBuffer32();
-extern inline float ReadBuffer32F();
#endif
\ No newline at end of file
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_Color.h b/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_Color.h
index 76cee866b9..52df1ba8e0 100644
--- a/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_Color.h
+++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_Color.h
@@ -84,32 +84,32 @@ inline u32 _Read32(u32 iAddress)
void LOADERDECL Color_ReadDirect_24b_888(void* _p)
{
- u32 col = ReadBuffer8()<SetPosNrmIdx(index);
}
@@ -36,6 +36,6 @@ int s_texmtxread = 0, s_texmtxwrite = 0;
void LOADERDECL TexMtx_ReadDirect_UByte(void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
- int index = ReadBuffer8() & 0x3f;
+ int index = DataReadU8() & 0x3f;
varray->SetTcIdx(s_texmtxread++, index);
}
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_Normal.cpp b/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_Normal.cpp
index 865c0336c8..662fa602d1 100644
--- a/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_Normal.cpp
+++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_Normal.cpp
@@ -130,9 +130,9 @@ VertexLoader_Normal::GetFunction(unsigned int _type, unsigned int _format, unsig
void LOADERDECL
VertexLoader_Normal::Normal_DirectByte(void* _p)
{
- varray->SetNormalX(0, ((float)(signed char)ReadBuffer8()+0.5f) / 127.5f);
- varray->SetNormalY(0, ((float)(signed char)ReadBuffer8()+0.5f) / 127.5f);
- varray->SetNormalZ(0, ((float)(signed char)ReadBuffer8()+0.5f) / 127.5f);
+ varray->SetNormalX(0, ((float)(signed char)DataReadU8()+0.5f) / 127.5f);
+ varray->SetNormalY(0, ((float)(signed char)DataReadU8()+0.5f) / 127.5f);
+ varray->SetNormalZ(0, ((float)(signed char)DataReadU8()+0.5f) / 127.5f);
}
// __________________________________________________________________________________________________
@@ -141,9 +141,9 @@ VertexLoader_Normal::Normal_DirectByte(void* _p)
void LOADERDECL
VertexLoader_Normal::Normal_DirectShort(void* _p)
{
- varray->SetNormalX(0, ((float)(signed short)ReadBuffer16()+0.5f) / 32767.5f);
- varray->SetNormalY(0, ((float)(signed short)ReadBuffer16()+0.5f) / 32767.5f);
- varray->SetNormalZ(0, ((float)(signed short)ReadBuffer16()+0.5f) / 32767.5f);
+ varray->SetNormalX(0, ((float)(signed short)DataReadU16()+0.5f) / 32767.5f);
+ varray->SetNormalY(0, ((float)(signed short)DataReadU16()+0.5f) / 32767.5f);
+ varray->SetNormalZ(0, ((float)(signed short)DataReadU16()+0.5f) / 32767.5f);
}
// __________________________________________________________________________________________________
@@ -152,9 +152,9 @@ VertexLoader_Normal::Normal_DirectShort(void* _p)
void LOADERDECL
VertexLoader_Normal::Normal_DirectFloat(void* _p)
{
- varray->SetNormalX(0, ReadBuffer32F());
- varray->SetNormalY(0, ReadBuffer32F());
- varray->SetNormalZ(0, ReadBuffer32F());
+ varray->SetNormalX(0, DataReadF32());
+ varray->SetNormalY(0, DataReadF32());
+ varray->SetNormalZ(0, DataReadF32());
}
// __________________________________________________________________________________________________
@@ -165,9 +165,9 @@ VertexLoader_Normal::Normal_DirectByte3(void* _p)
{
for (int i=0; i<3; i++)
{
- varray->SetNormalX(i, ((float)(signed char)ReadBuffer8()+0.5f) / 127.5f);
- varray->SetNormalY(i, ((float)(signed char)ReadBuffer8()+0.5f) / 127.5f);
- varray->SetNormalZ(i, ((float)(signed char)ReadBuffer8()+0.5f) / 127.5f);
+ varray->SetNormalX(i, ((float)(signed char)DataReadU8()+0.5f) / 127.5f);
+ varray->SetNormalY(i, ((float)(signed char)DataReadU8()+0.5f) / 127.5f);
+ varray->SetNormalZ(i, ((float)(signed char)DataReadU8()+0.5f) / 127.5f);
}
}
@@ -179,9 +179,9 @@ VertexLoader_Normal::Normal_DirectShort3(void* _p)
{
for (int i=0; i<3; i++)
{
- varray->SetNormalX(i, ((float)(signed short)ReadBuffer16()+0.5f) / 32767.5f);
- varray->SetNormalY(i, ((float)(signed short)ReadBuffer16()+0.5f) / 32767.5f);
- varray->SetNormalZ(i, ((float)(signed short)ReadBuffer16()+0.5f) / 32767.5f);
+ varray->SetNormalX(i, ((float)(signed short)DataReadU16()+0.5f) / 32767.5f);
+ varray->SetNormalY(i, ((float)(signed short)DataReadU16()+0.5f) / 32767.5f);
+ varray->SetNormalZ(i, ((float)(signed short)DataReadU16()+0.5f) / 32767.5f);
}
}
@@ -193,9 +193,9 @@ VertexLoader_Normal::Normal_DirectFloat3(void* _p)
{
for (int i=0; i<3; i++)
{
- varray->SetNormalX(i, ReadBuffer32F());
- varray->SetNormalY(i, ReadBuffer32F());
- varray->SetNormalZ(i, ReadBuffer32F());
+ varray->SetNormalX(i, DataReadF32());
+ varray->SetNormalY(i, DataReadF32());
+ varray->SetNormalZ(i, DataReadF32());
}
}
@@ -211,7 +211,7 @@ VertexLoader_Normal::Normal_DirectFloat3(void* _p)
void LOADERDECL
VertexLoader_Normal::Normal_Index8_Byte(void* _p)
{
- u8 Index = ReadBuffer8();
+ u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
varray->SetNormalX(0, ((float)(signed char)Memory_Read_U8(iAddress )+0.5f) / 127.5f);
@@ -225,7 +225,7 @@ VertexLoader_Normal::Normal_Index8_Byte(void* _p)
void LOADERDECL
VertexLoader_Normal::Normal_Index8_Short(void* _p)
{
- u8 Index = ReadBuffer8();
+ u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
varray->SetNormalX(0, ((float)(signed short)Memory_Read_U16(iAddress )+0.5f) / 32767.5f);
@@ -239,7 +239,7 @@ VertexLoader_Normal::Normal_Index8_Short(void* _p)
void LOADERDECL
VertexLoader_Normal::Normal_Index8_Float(void* _p)
{
- u8 Index = ReadBuffer8();
+ u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
varray->SetNormalX(0, Memory_Read_Float(iAddress));
@@ -257,7 +257,7 @@ VertexLoader_Normal::Normal_Index8_Byte3(void* _p)
{
for (int i=0; i<3; i++)
{
- u8 Index = ReadBuffer8();
+ u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 1*3*i;
varray->SetNormalX(i, ((float)(signed char)Memory_Read_U8(iAddress )+0.5f) / 127.5f);
@@ -267,7 +267,7 @@ VertexLoader_Normal::Normal_Index8_Byte3(void* _p)
}
else
{
- u8 Index = ReadBuffer8();
+ u8 Index = DataReadU8();
for (int i=0; i<3; i++)
{
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 1*3*i;
@@ -289,7 +289,7 @@ VertexLoader_Normal::Normal_Index8_Short3(void* _p)
{
for (int i=0; i<3; i++)
{
- u8 Index = ReadBuffer8();
+ u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 2*3*i;
varray->SetNormalX(i, ((float)(signed short)Memory_Read_U16(iAddress )+0.5f) / 32767.5f);
@@ -299,7 +299,7 @@ VertexLoader_Normal::Normal_Index8_Short3(void* _p)
}
else
{
- u8 Index = ReadBuffer8();
+ u8 Index = DataReadU8();
for (int i=0; i<3; i++)
{
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 2*3*i;
@@ -321,7 +321,7 @@ VertexLoader_Normal::Normal_Index8_Float3(void* _p)
{
for (int i=0; i<3; i++)
{
- u8 Index = ReadBuffer8();
+ u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 4*3*i;
varray->SetNormalX(i, Memory_Read_Float(iAddress));
@@ -331,7 +331,7 @@ VertexLoader_Normal::Normal_Index8_Float3(void* _p)
}
else
{
- u8 Index = ReadBuffer8();
+ u8 Index = DataReadU8();
for (int i=0; i<3; i++)
{
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 4*3*i;
@@ -355,7 +355,7 @@ VertexLoader_Normal::Normal_Index8_Float3(void* _p)
void LOADERDECL
VertexLoader_Normal::Normal_Index16_Byte(void* _p)
{
- u16 Index = ReadBuffer16();
+ u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
varray->SetNormalX(0, ((float)(signed char)Memory_Read_U8(iAddress )+0.5f) / 127.5f);
@@ -369,7 +369,7 @@ VertexLoader_Normal::Normal_Index16_Byte(void* _p)
void LOADERDECL
VertexLoader_Normal::Normal_Index16_Short(void* _p)
{
- u16 Index = ReadBuffer16();
+ u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
varray->SetNormalX(0, ((float)(signed short)Memory_Read_U16(iAddress )+0.5f) / 32767.5f);
@@ -383,7 +383,7 @@ VertexLoader_Normal::Normal_Index16_Short(void* _p)
void LOADERDECL
VertexLoader_Normal::Normal_Index16_Float(void* _p)
{
- u16 Index = ReadBuffer16();
+ u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
varray->SetNormalX(0, Memory_Read_Float(iAddress));
@@ -401,7 +401,7 @@ VertexLoader_Normal::Normal_Index16_Byte3(void* _p)
{
for (int i=0; i<3; i++)
{
- u16 Index = ReadBuffer16();
+ u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 1*3*i;
varray->SetNormalX(i, ((float)(signed char)Memory_Read_U8(iAddress )+0.5f) / 127.5f);
@@ -411,7 +411,7 @@ VertexLoader_Normal::Normal_Index16_Byte3(void* _p)
}
else
{
- u16 Index = ReadBuffer16();
+ u16 Index = DataReadU16();
for (int i=0; i<3; i++)
{
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 1*3*i;
@@ -433,7 +433,7 @@ VertexLoader_Normal::Normal_Index16_Short3(void* _p)
{
for (int i=0; i<3; i++)
{
- u16 Index = ReadBuffer16();
+ u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 2*3*i;
varray->SetNormalX(i, ((float)(signed short)Memory_Read_U16(iAddress )+0.5f) / 32767.5f);
@@ -443,7 +443,7 @@ VertexLoader_Normal::Normal_Index16_Short3(void* _p)
}
else
{
- u16 Index = ReadBuffer16();
+ u16 Index = DataReadU16();
for (int i=0; i<3; i++)
{
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 2*3*i;
@@ -465,7 +465,7 @@ VertexLoader_Normal::Normal_Index16_Float3(void* _p)
{
for (int i=0; i<3; i++)
{
- u16 Index = ReadBuffer16();
+ u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 4*3*i;
varray->SetNormalX(i, Memory_Read_Float(iAddress ));
@@ -475,7 +475,7 @@ VertexLoader_Normal::Normal_Index16_Float3(void* _p)
}
else
{
- u16 Index = ReadBuffer16();
+ u16 Index = DataReadU16();
for (int i=0; i<3; i++)
{
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 4*3*i;
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_Position.h b/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_Position.h
index dd9936206e..508e5f4dac 100644
--- a/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_Position.h
+++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_Position.h
@@ -66,11 +66,11 @@ void LOADERDECL _ReadPosFloatMem(int iAddress, TVtxAttr* pVtxAttr)
void LOADERDECL Pos_ReadDirect_UByte(void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
- varray->SetPosX((float)ReadBuffer8() * posScale);
- varray->SetPosY((float)ReadBuffer8() * posScale);
+ varray->SetPosX((float)DataReadU8() * posScale);
+ varray->SetPosY((float)DataReadU8() * posScale);
if (pVtxAttr->PosElements)
- varray->SetPosZ((float)ReadBuffer8() * posScale);
+ varray->SetPosZ((float)DataReadU8() * posScale);
else
varray->SetPosZ(1.0);
}
@@ -78,11 +78,11 @@ void LOADERDECL Pos_ReadDirect_UByte(void* _p)
void LOADERDECL Pos_ReadDirect_Byte(void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
- varray->SetPosX((float)(s8)ReadBuffer8() * posScale);
- varray->SetPosY((float)(s8)ReadBuffer8() * posScale);
+ varray->SetPosX((float)(s8)DataReadU8() * posScale);
+ varray->SetPosY((float)(s8)DataReadU8() * posScale);
if (pVtxAttr->PosElements)
- varray->SetPosZ((float)(s8)ReadBuffer8() * posScale);
+ varray->SetPosZ((float)(s8)DataReadU8() * posScale);
else
varray->SetPosZ(1.0);
}
@@ -91,11 +91,11 @@ void LOADERDECL Pos_ReadDirect_UShort(void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
- varray->SetPosX((float)ReadBuffer16() * posScale);
- varray->SetPosY((float)ReadBuffer16() * posScale);
+ varray->SetPosX((float)DataReadU16() * posScale);
+ varray->SetPosY((float)DataReadU16() * posScale);
if (pVtxAttr->PosElements)
- varray->SetPosZ((float)ReadBuffer16() * posScale);
+ varray->SetPosZ((float)DataReadU16() * posScale);
else
varray->SetPosZ(1.0);
}
@@ -104,11 +104,11 @@ void LOADERDECL Pos_ReadDirect_Short(void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
- varray->SetPosX((float)(s16)ReadBuffer16() * posScale);
- varray->SetPosY((float)(s16)ReadBuffer16() * posScale);
+ varray->SetPosX((float)(s16)DataReadU16() * posScale);
+ varray->SetPosY((float)(s16)DataReadU16() * posScale);
if (pVtxAttr->PosElements)
- varray->SetPosZ((float)(s16)ReadBuffer16() * posScale);
+ varray->SetPosZ((float)(s16)DataReadU16() * posScale);
else
varray->SetPosZ(1.0);
}
@@ -117,11 +117,11 @@ void LOADERDECL Pos_ReadDirect_Float(void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
- varray->SetPosX(ReadBuffer32F());
- varray->SetPosY(ReadBuffer32F());
+ varray->SetPosX(DataReadF32());
+ varray->SetPosY(DataReadF32());
if (pVtxAttr->PosElements)
- varray->SetPosZ(ReadBuffer32F());
+ varray->SetPosZ(DataReadF32());
else
varray->SetPosZ(1.0);
}
@@ -133,14 +133,14 @@ void LOADERDECL Pos_ReadDirect_Float(void* _p)
void LOADERDECL Pos_ReadIndex8_UByte(void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
- u8 Index = ReadBuffer8();
+ u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPos8Mem(iAddress, pVtxAttr);
}
void LOADERDECL Pos_ReadIndex8_Byte(void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
- u8 Index = ReadBuffer8();
+ u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPos8Mem(iAddress, pVtxAttr);
}
@@ -148,7 +148,7 @@ void LOADERDECL Pos_ReadIndex8_Byte(void* _p)
void LOADERDECL Pos_ReadIndex8_UShort(void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
- u8 Index = ReadBuffer8();
+ u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPos16Mem(iAddress, pVtxAttr);
}
@@ -156,7 +156,7 @@ void LOADERDECL Pos_ReadIndex8_UShort(void* _p)
void LOADERDECL Pos_ReadIndex8_Short(void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
- u8 Index = ReadBuffer8();
+ u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPos16Mem(iAddress, pVtxAttr);
}
@@ -164,7 +164,7 @@ void LOADERDECL Pos_ReadIndex8_Short(void* _p)
void LOADERDECL Pos_ReadIndex8_Float(void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
- u8 Index = ReadBuffer8();
+ u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPosFloatMem(iAddress, pVtxAttr);
}
@@ -175,21 +175,21 @@ void LOADERDECL Pos_ReadIndex8_Float(void* _p)
void LOADERDECL Pos_ReadIndex16_UByte(void* _p){
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
- u16 Index = ReadBuffer16();
+ u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPos8Mem(iAddress, pVtxAttr);
}
void LOADERDECL Pos_ReadIndex16_Byte(void* _p){
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
- u16 Index = ReadBuffer16();
+ u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPos8Mem(iAddress, pVtxAttr);
}
void LOADERDECL Pos_ReadIndex16_UShort(void* _p){
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
- u16 Index = ReadBuffer16();
+ u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPos16Mem(iAddress, pVtxAttr);
}
@@ -197,7 +197,7 @@ void LOADERDECL Pos_ReadIndex16_UShort(void* _p){
void LOADERDECL Pos_ReadIndex16_Short(void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
- u16 Index = ReadBuffer16();
+ u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPos16Mem(iAddress, pVtxAttr);
}
@@ -205,7 +205,7 @@ void LOADERDECL Pos_ReadIndex16_Short(void* _p)
void LOADERDECL Pos_ReadIndex16_Float(void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
- u16 Index = ReadBuffer16();
+ u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPosFloatMem(iAddress, pVtxAttr);
}
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_TextCoord.h b/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_TextCoord.h
index f58a3103fd..36c8ed008f 100644
--- a/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_TextCoord.h
+++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_TextCoord.h
@@ -22,47 +22,47 @@ extern int tcIndex;
void LOADERDECL TexCoord_ReadDirect_UByte(void* _p)
{
- varray->SetU(tcIndex, ReadBuffer8() * tcScaleU[tcIndex]);
+ varray->SetU(tcIndex, DataReadU8() * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
- varray->SetV(tcIndex, ReadBuffer8() * tcScaleV[tcIndex]);
+ varray->SetV(tcIndex, DataReadU8() * tcScaleV[tcIndex]);
tcIndex++;
}
void LOADERDECL TexCoord_ReadDirect_Byte(void* _p)
{
- varray->SetU(tcIndex, (s8)ReadBuffer8() * tcScaleU[tcIndex]);
+ varray->SetU(tcIndex, (s8)DataReadU8() * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
- varray->SetV(tcIndex, (s8)ReadBuffer8() * tcScaleV[tcIndex]);
+ varray->SetV(tcIndex, (s8)DataReadU8() * tcScaleV[tcIndex]);
tcIndex++;
}
void LOADERDECL TexCoord_ReadDirect_UShort(void* _p)
{
- varray->SetU(tcIndex, ReadBuffer16() * tcScaleU[tcIndex]);
+ varray->SetU(tcIndex, DataReadU16() * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
- varray->SetV(tcIndex, ReadBuffer16() * tcScaleV[tcIndex]);
+ varray->SetV(tcIndex, DataReadU16() * tcScaleV[tcIndex]);
tcIndex++;
}
void LOADERDECL TexCoord_ReadDirect_Short(void* _p)
{
- varray->SetU(tcIndex, (s16)ReadBuffer16() * tcScaleU[tcIndex]);
+ varray->SetU(tcIndex, (s16)DataReadU16() * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
- varray->SetV(tcIndex, (s16)ReadBuffer16() * tcScaleV[tcIndex]);
+ varray->SetV(tcIndex, (s16)DataReadU16() * tcScaleV[tcIndex]);
tcIndex++;
}
void LOADERDECL TexCoord_ReadDirect_Float(void* _p)
{
- varray->SetU(tcIndex, ReadBuffer32F() * tcScaleU[tcIndex]);
+ varray->SetU(tcIndex, DataReadF32() * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
- varray->SetV(tcIndex, ReadBuffer32F() * tcScaleV[tcIndex]);
+ varray->SetV(tcIndex, DataReadF32() * tcScaleV[tcIndex]);
tcIndex++;
}
// ==================================================================================
void LOADERDECL TexCoord_ReadIndex8_UByte(void* _p)
{
- u8 Index = ReadBuffer8();
+ u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
varray->SetU(tcIndex, (float)(u8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex]);
@@ -72,7 +72,7 @@ void LOADERDECL TexCoord_ReadIndex8_UByte(void* _p)
}
void LOADERDECL TexCoord_ReadIndex8_Byte(void* _p)
{
- u8 Index = ReadBuffer8();
+ u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
varray->SetU(tcIndex, (float)(s8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex]);
@@ -83,7 +83,7 @@ void LOADERDECL TexCoord_ReadIndex8_Byte(void* _p)
}
void LOADERDECL TexCoord_ReadIndex8_UShort(void* _p)
{
- u8 Index = ReadBuffer8();
+ u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
varray->SetU(tcIndex, (float)(u16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex]);
@@ -93,7 +93,7 @@ void LOADERDECL TexCoord_ReadIndex8_UShort(void* _p)
}
void LOADERDECL TexCoord_ReadIndex8_Short(void* _p)
{
- u8 Index = ReadBuffer8();
+ u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
varray->SetU(tcIndex, (float)(s16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex]);
@@ -103,7 +103,7 @@ void LOADERDECL TexCoord_ReadIndex8_Short(void* _p)
}
void LOADERDECL TexCoord_ReadIndex8_Float(void* _p)
{
- u16 Index = ReadBuffer8();
+ u16 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
u32 uTemp;
uTemp = Memory_Read_U32(iAddress );
@@ -120,7 +120,7 @@ void LOADERDECL TexCoord_ReadIndex8_Float(void* _p)
// ==================================================================================
void LOADERDECL TexCoord_ReadIndex16_UByte(void* _p)
{
- u16 Index = ReadBuffer16();
+ u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
u32 uTemp;
@@ -136,7 +136,7 @@ void LOADERDECL TexCoord_ReadIndex16_UByte(void* _p)
}
void LOADERDECL TexCoord_ReadIndex16_Byte(void* _p)
{
- u16 Index = ReadBuffer16();
+ u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
u32 uTemp;
@@ -154,7 +154,7 @@ void LOADERDECL TexCoord_ReadIndex16_Byte(void* _p)
void LOADERDECL TexCoord_ReadIndex16_UShort(void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
- u16 Index = ReadBuffer16();
+ u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
float uTemp;
@@ -170,7 +170,7 @@ void LOADERDECL TexCoord_ReadIndex16_UShort(void* _p)
}
void LOADERDECL TexCoord_ReadIndex16_Short(void* _p)
{
- u16 Index = ReadBuffer16();
+ u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
float uTemp;
@@ -186,7 +186,7 @@ void LOADERDECL TexCoord_ReadIndex16_Short(void* _p)
}
void LOADERDECL TexCoord_ReadIndex16_Float(void* _p)
{
- u16 Index = ReadBuffer16();
+ u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
u32 uTemp;
uTemp = Memory_Read_U32(iAddress );
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp
index a40eb5a61c..9a96798dde 100644
--- a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp
+++ b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp
@@ -206,8 +206,8 @@ void Video_Prepare(void)
BPInit();
CVertexHandler::Init();
- OpcodeDecoder_Init();
Fifo_Init();
+ OpcodeDecoder_Init();
}
void Video_Shutdown(void)
diff --git a/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcproj b/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcproj
index f271c2b29b..a21a2f1c1a 100644
--- a/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcproj
+++ b/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcproj
@@ -728,14 +728,6 @@
RelativePath=".\Src\BPStructs.h"
>
-
-
-
-
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/DataReader.cpp b/Source/Plugins/Plugin_VideoOGL/Src/DataReader.cpp
deleted file mode 100644
index 0963b35484..0000000000
--- a/Source/Plugins/Plugin_VideoOGL/Src/DataReader.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#include "Globals.h"
-#include "DataReader.h"
-
-#if !defined(DATAREADER_INLINE) || defined(DATAREADER_DEBUG)
-// =================================================================================================
-// CDataReader_Fifo
-// =================================================================================================
-
-IDataReader* g_pDataReader = NULL;
-extern u8 FAKE_ReadFifo8();
-extern u16 FAKE_ReadFifo16();
-extern u32 FAKE_ReadFifo32();
-extern int FAKE_GetPosition();
-extern u8* FAKE_GetFifoCurrentPtr();
-extern void FAKE_SkipFifo(u32 skip);
-
-IDataReader::~IDataReader()
-{
-}
-
-CDataReader_Fifo::CDataReader_Fifo(void)
-{
-}
-
-u8 CDataReader_Fifo::Read8(void)
-{
- return FAKE_ReadFifo8();
-};
-
-u16 CDataReader_Fifo::Read16(void)
-{
- return FAKE_ReadFifo16();
-};
-
-u32 CDataReader_Fifo::Read32(void)
-{
- return FAKE_ReadFifo32();
-};
-
-void CDataReader_Fifo::Skip(u32 skip)
-{
- return FAKE_SkipFifo(skip);
-}
-
-int CDataReader_Fifo::GetPosition()
-{
- return FAKE_GetPosition();
-}
-u8* CDataReader_Fifo::GetRealCurrentPtr()
-{
- return FAKE_GetFifoCurrentPtr();
-}
-
-
-// =================================================================================================
-// CDataReader_Memory
-// =================================================================================================
-
-CDataReader_Memory::CDataReader_Memory(u32 _uAddress) :
- m_uReadAddress(_uAddress)
-{
- //m_pMemory = g_VideoInitialize.pGetMemoryPointer(0x00);
-}
-
-u32 CDataReader_Memory::GetReadAddress()
-{
- return m_uReadAddress;
-}
-
-int CDataReader_Memory::GetPosition()
-{
- return m_uReadAddress;
-}
-
-u8 CDataReader_Memory::Read8()
-{
- u8 tmp = Memory_Read_U8(m_uReadAddress);//m_pMemory[m_uReadAddress];
- m_uReadAddress++;
- return tmp;
-}
-
-u16 CDataReader_Memory::Read16()
-{
- u16 tmp = Memory_Read_U16(m_uReadAddress);//_byteswap_ushort(*(u16*)&m_pMemory[m_uReadAddress]);
- m_uReadAddress += 2;
- return tmp;
-}
-
-u32 CDataReader_Memory::Read32()
-{
- u32 tmp = Memory_Read_U32(m_uReadAddress);//_byteswap_ulong(*(u32*)&m_pMemory[m_uReadAddress]);
- m_uReadAddress += 4;
- return tmp;
-}
-
-void CDataReader_Memory::Skip(u32 skip)
-{
- m_uReadAddress += skip;
-}
-
-u8* CDataReader_Memory::GetRealCurrentPtr()
-{
- return Memory_GetPtr(m_uReadAddress);
-}
-#endif
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/DataReader.h b/Source/Plugins/Plugin_VideoOGL/Src/DataReader.h
deleted file mode 100644
index 901fb5e2f7..0000000000
--- a/Source/Plugins/Plugin_VideoOGL/Src/DataReader.h
+++ /dev/null
@@ -1,218 +0,0 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#ifndef _DATAREADER_H
-#define _DATAREADER_H
-
-#include "Fifo.h"
-
-
-#if !defined(DATAREADER_INLINE) || defined(DATAREADER_DEBUG)
-// =================================================================================================
-// IDataReader
-// =================================================================================================
-
-class IDataReader
-{
-protected:
- virtual ~IDataReader();
-
-public:
- virtual void Skip(u32) = 0;
- virtual u8 Read8 () = 0;
- virtual u16 Read16() = 0;
- virtual u32 Read32() = 0;
-
- virtual int GetPosition() = 0; // return values can be anything, as long as relative distances are correct
- virtual u8* GetRealCurrentPtr() = 0;
-};
-
-// =================================================================================================
-// CDataReader_Fifo
-// =================================================================================================
-
-class CDataReader_Fifo : public IDataReader
-{
-private:
-
-public:
- CDataReader_Fifo();
-
- virtual void Skip(u32);
- virtual u8 Read8();
- virtual u16 Read16();
- virtual u32 Read32();
- virtual int GetPosition();
- virtual u8* GetRealCurrentPtr();
-};
-
-// =================================================================================================
-// CDataReader_Memory
-// =================================================================================================
-
-class CDataReader_Memory : public IDataReader
-{
-private:
-
- //u8* m_pMemory;
- u32 m_uReadAddress;
-
-public:
-
- CDataReader_Memory(u32 _uAddress);
-
- u32 GetReadAddress();
-
- virtual void Skip(u32);
- virtual u8 Read8();
- virtual u16 Read16();
- virtual u32 Read32();
- virtual int GetPosition();
- virtual u8* GetRealCurrentPtr();
-};
-
-extern IDataReader* g_pDataReader;
-#endif
-
-
-
-
-
-#ifdef DATAREADER_INLINE
-extern u8* g_pVideoData;
-#endif
-
-#ifdef DATAREADER_DEBUG
-extern u8* g_pDataReaderRealPtr;
-#define DATAREADER_DEBUG_CHECK_PTR g_pDataReaderRealPtr = g_pDataReader->GetRealCurrentPtr(); \
- if (g_pDataReaderRealPtr!=g_pVideoData) _asm int 3
-#define DATAREADER_DEBUG_CHECK_PTR_VAL g_pDataReaderRealPtr = g_pDataReader->GetRealCurrentPtr(); \
- if ((g_pDataReaderRealPtr != g_pVideoData) || (tmp != tmpdb)) _asm int 3
-//#define DATAREADER_DEBUG_CHECK_PTR_VAL DATAREADER_DEBUG_CHECK_PTR
-#else
-#define DATAREADER_DEBUG_CHECK_PTR
-#define DATAREADER_DEBUG_CHECK_PTR_VAL
-#endif
-
-#ifdef DATAREADER_INLINE
-inline u8 DataPeek8(u32 _uOffset)
-{
- u8 tmp = *(u8*)(g_pVideoData + _uOffset);
- return tmp;
-}
-inline u16 DataPeek16(u32 _uOffset)
-{
- u16 tmp = Common::swap16(*(u16*)(g_pVideoData + _uOffset));
- return tmp;
-}
-inline u32 DataPeek32(u32 _uOffset) {
- u32 tmp = Common::swap32(*(u32*)(g_pVideoData + _uOffset));
- return tmp;
-}
-
-inline u8 DataReadU8()
-{
- u8 tmp = *g_pVideoData;
- g_pVideoData++;
-#ifdef DATAREADER_DEBUG
- u8 tmpdb = g_pDataReader->Read8();
- DATAREADER_DEBUG_CHECK_PTR_VAL;
-#endif
- return tmp;
-}
-
-inline u16 DataReadU16()
-{
- u16 tmp = Common::swap16(*(u16*)g_pVideoData);
- g_pVideoData+=2;
-#ifdef DATAREADER_DEBUG
- u16 tmpdb = g_pDataReader->Read16();
- DATAREADER_DEBUG_CHECK_PTR_VAL;
-#endif
- return tmp;
-}
-
-inline u32 DataReadU32()
-{
- u32 tmp = Common::swap32(*(u32*)g_pVideoData);
- g_pVideoData+=4;
-#ifdef DATAREADER_DEBUG
- u32 tmpdb = g_pDataReader->Read32();
- DATAREADER_DEBUG_CHECK_PTR_VAL;
-#endif
- return tmp;
-}
-
-inline float DataReadF32()
-{
- union {u32 i; float f;} temp;
- temp.i = Common::swap32(*(u32*)g_pVideoData);
- g_pVideoData+=4;
- float tmp = temp.f;
-#ifdef DATAREADER_DEBUG
- //TODO clean up
- u32 tmp3 = g_pDataReader->Read32();
- float tmpdb = *(float*)(&tmp3);
- DATAREADER_DEBUG_CHECK_PTR_VAL;
-#endif
- return tmp;
-}
-
-inline u8* DataGetPosition()
-{
-#ifdef DATAREADER_DEBUG
- DATAREADER_DEBUG_CHECK_PTR;
-#endif
- return g_pVideoData;
-}
-
-inline void DataSkip(u32 skip)
-{
- g_pVideoData += skip;
-#ifdef DATAREADER_DEBUG
- g_pDataReader->Skip(skip);
- DATAREADER_DEBUG_CHECK_PTR;
-#endif
-}
-#else
-inline u8 DataReadU8()
-{
- u8 tmp = g_pDataReader->Read8();
- return tmp;
-}
-inline u16 DataReadU16()
-{
- u16 tmp = g_pDataReader->Read16();
- return tmp;
-}
-inline u32 DataReadU32()
-{
- u32 tmp = g_pDataReader->Read32();
- return tmp;
-}
-inline float DataReadF32()
-{
- u32 tmp2 = g_pDataReader->Read32();
- float tmp = *(float*)(&tmp2);
- return tmp;
-}
-inline void DataSkip(u32 skip)
-{
- g_pDataReader->Skip(skip);
-}
-#endif
-#endif
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.cpp b/Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.cpp
index 06a2b58a00..bb5a759b8a 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.cpp
@@ -16,11 +16,11 @@
// http://code.google.com/p/dolphin-emu/
//DL facts:
-// Ikaruga uses NO display lists!
+// Ikaruga uses (nearly) NO display lists!
// Zelda WW uses TONS of display lists
// Zelda TP uses almost 100% display lists except menus (we like this!)
-// Note that it IS NOT POSSIBLE to precompile display lists! You can compile them as they are
+// Note that it IS NOT GENERALLY POSSIBLE to precompile display lists! You can compile them as they are
// and hope that the vertex format doesn't change, though, if you do it just when they are
// called. The reason is that the vertex format affects the sizes of the vertices.
@@ -37,31 +37,13 @@
#define CMDBUFFER_SIZE 1024*1024
-#if ! defined(DATAREADER_INLINE) || defined(DATAREADER_DEBUG)
-CDataReader_Fifo g_fifoReader;
-#endif
-#ifdef DATAREADER_DEBUG
-u8* g_pDataReaderRealPtr=0;
-#endif
+u8* g_pVideoData = 0;
-#ifdef DATAREADER_INLINE
-u8* g_pVideoData=0;
-extern bool g_IsFifoRewinded;
-#endif
+extern u8* FAKE_GetFifoStartPtr();
+extern u8* FAKE_GetFifoEndPtr();
void Decode();
-#if !defined(DATAREADER_INLINE) || defined(DATAREADER_DEBUG)
-extern u8 FAKE_PeekFifo8(u32 _uOffset);
-extern u16 FAKE_PeekFifo16(u32 _uOffset);
-extern u32 FAKE_PeekFifo32(u32 _uOffset);
-extern int FAKE_GetFifoSize();
-#endif
-extern u8* FAKE_GetFifoEndPtr();
-extern u8* FAKE_GetFifoStartPtr();
-extern u8* FAKE_GetFifoCurrentPtr();
-extern void FAKE_SkipFifo(u32 skip);
-
template
void Xchg(T& a, T&b)
{
@@ -72,30 +54,18 @@ void Xchg(T& a, T&b)
void ExecuteDisplayList(u32 address, u32 size)
{
-#if ! defined(DATAREADER_INLINE) || defined(DATAREADER_DEBUG)
- IDataReader* pOldReader = g_pDataReader;
-
- //address &= 0x01FFFFFF; // phys address
- CDataReader_Memory memoryReader(address);
- g_pDataReader = &memoryReader;
-#endif
-#ifdef DATAREADER_INLINE
u8* old_pVideoData = g_pVideoData;
u8* startAddress = Memory_GetPtr(address);
g_pVideoData = startAddress;
-#endif
+
// temporarily swap dl and non-dl(small "hack" for the stats)
Xchg(stats.thisFrame.numDLPrims, stats.thisFrame.numPrims);
Xchg(stats.thisFrame.numXFLoadsInDL, stats.thisFrame.numXFLoads);
Xchg(stats.thisFrame.numCPLoadsInDL, stats.thisFrame.numCPLoads);
Xchg(stats.thisFrame.numBPLoadsInDL, stats.thisFrame.numBPLoads);
-#ifdef DATAREADER_INLINE
- while((g_pVideoData - startAddress) < size)
-#else
- while((memoryReader.GetReadAddress() - address) < size)
-#endif
+ while((u32)(g_pVideoData - startAddress) < size)
{
Decode();
}
@@ -108,38 +78,17 @@ void ExecuteDisplayList(u32 address, u32 size)
Xchg(stats.thisFrame.numCPLoadsInDL, stats.thisFrame.numCPLoads);
Xchg(stats.thisFrame.numBPLoadsInDL, stats.thisFrame.numBPLoads);
- // reset to the old reader
-#ifdef DATAREADER_INLINE
+ // reset to the old pointer
g_pVideoData = old_pVideoData;
-#endif
-#if defined(DATAREADER_DEBUG) || !defined(DATAREADER_INLINE)
- g_pDataReader = pOldReader;
-#endif
-
}
bool FifoCommandRunnable(void)
{
-#ifndef DATAREADER_INLINE
- u32 iBufferSize = FAKE_GetFifoSize();
-#else
u32 iBufferSize = (u32)(FAKE_GetFifoEndPtr()-g_pVideoData);
-#ifdef DATAREADER_DEBUG
- u32 iBufferSizedb = FAKE_GetFifoSize();
- if( iBufferSize != iBufferSizedb) _asm int 3
-#endif
-#endif
if (iBufferSize == 0)
- return false;
+ return false; // can't peek
-#if !defined(DATAREADER_INLINE)
- u8 Cmd = FAKE_PeekFifo8(0);
-#else
u8 Cmd = DataPeek8(0);
-#ifdef DATAREADER_DEBUG
- if( Cmd != FAKE_PeekFifo8(0)) _asm int 3
-#endif
-#endif
u32 iCommandSize = 0;
switch(Cmd)
@@ -183,14 +132,7 @@ bool FifoCommandRunnable(void)
if (iBufferSize >= 5)
{
iCommandSize = 1 + 4;
-#if !defined(DATAREADER_INLINE) || defined(DATAREADER_DEBUG)
- u32 Cmd2 = FAKE_PeekFifo32(1);
-#ifdef DATAREADER_DEBUG
- if( Cmd2 != DataPeek32(1)) _asm int 3
-#endif
-#else
u32 Cmd2 = DataPeek32(1);
-#endif
int dwTransferSize = ((Cmd2 >> 16) & 15) + 1;
iCommandSize += dwTransferSize * 4;
}
@@ -208,22 +150,17 @@ bool FifoCommandRunnable(void)
if (iBufferSize >= 3)
{
iCommandSize = 1 + 2;
-#if !defined(DATAREADER_INLINE) || defined(DATAREADER_DEBUG)
- u16 numVertices = FAKE_PeekFifo16(1);
-#ifdef DATAREADER_DEBUG
- if( numVertices != DataPeek16(1)) _asm int 3
-#endif
-#else
u16 numVertices = DataPeek16(1);
-#endif
VertexLoader& vtxLoader = g_VertexLoaders[Cmd & GX_VAT_MASK];
iCommandSize += numVertices * vtxLoader.ComputeVertexSize();
}
- else {
+ else
+ {
return false;
}
}
- else {
+ else
+ {
char szTemp[1024];
sprintf(szTemp, "GFX: Unknown Opcode (0x%x).\n"
"This means one of the following:\n"
@@ -231,9 +168,38 @@ bool FifoCommandRunnable(void)
"* Command stream corrupted by some spurious memory bug\n"
"* This really is an unknown opcode (unlikely)\n"
"* Some other sort of bug\n\n"
- "Dolphin will now likely crash or hang. Enjoy.", Cmd);
+ "Dolphin will now likely crash or hang. Enjoy." , Cmd);
g_VideoInitialize.pSysMessage(szTemp);
g_VideoInitialize.pLog(szTemp, TRUE);
+ {
+ SCPFifoStruct &fifo = *g_VideoInitialize.pCPFifo;
+
+ char szTmp[256];
+ // sprintf(szTmp, "Illegal command %02x (at %08x)",Cmd,g_pDataReader->GetPtr());
+ sprintf(szTmp, "Illegal command %02x\n"
+ "CPBase: 0x%08x\n"
+ "CPEnd: 0x%08x\n"
+ "CPHiWatermark: 0x%08x\n"
+ "CPLoWatermark: 0x%08x\n"
+ "CPReadWriteDistance: 0x%08x\n"
+ "CPWritePointer: 0x%08x\n"
+ "CPReadPointer: 0x%08x\n"
+ "CPBreakpoint: 0x%08x\n"
+ "bFF_GPReadEnable: %s\n"
+ "bFF_BPEnable: %s\n"
+ "bFF_GPLinkEnable: %s\n"
+ "bFF_Breakpoint: %s\n"
+ "bPauseRead: %s\n"
+ ,Cmd, fifo.CPBase, fifo.CPEnd, fifo.CPHiWatermark, fifo.CPLoWatermark, fifo.CPReadWriteDistance
+ ,fifo.CPWritePointer, fifo.CPReadPointer, fifo.CPBreakpoint, fifo.bFF_GPReadEnable ? "true" : "false"
+ ,fifo.bFF_BPEnable ? "true" : "false" ,fifo.bFF_GPLinkEnable ? "true" : "false"
+ ,fifo.bFF_Breakpoint ? "true" : "false", fifo.bPauseRead ? "true" : "false");
+
+ g_VideoInitialize.pLog(szTmp, TRUE);
+ g_VideoInitialize.pLog(szTemp, TRUE);
+ // _assert_msg_(0,szTmp,"");
+
+ }
}
break;
}
@@ -339,16 +305,7 @@ void Decode(void)
void OpcodeDecoder_Init()
{
-#if !defined(DATAREADER_INLINE)
- g_pDataReader = &g_fifoReader;
-#else
g_pVideoData = FAKE_GetFifoStartPtr();
-#if defined(DATAREADER_DEBUG)
- g_pDataReader = &g_fifoReader;
- g_pDataReaderRealPtr = g_pDataReader->GetRealCurrentPtr();
- DATAREADER_DEBUG_CHECK_PTR;
-#endif
-#endif
}
@@ -361,7 +318,6 @@ void OpcodeDecoder_Run()
DVSTARTPROFILE();
while (FifoCommandRunnable())
{
- DATAREADER_DEBUG_CHECK_PTR;
Decode();
}
}