git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@746 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
memberTwo.mb2 2008-10-02 18:43:56 +00:00
parent 29fdb6837a
commit d15d6d2b5e
5 changed files with 32 additions and 32 deletions

View File

@ -24,7 +24,7 @@
#include "Fifo.h"
#if defined(DATAREADER_INLINE)
extern u32 g_pVideoData;
extern u8* g_pVideoData;
#else
FifoReader fifo;
#endif
@ -61,9 +61,9 @@ void Fifo_Stop() {
fifoStateRun = false;
}
u32 FAKE_GetFifoStartPtr()
u8* FAKE_GetFifoStartPtr()
{
return (int)videoBuffer;
return videoBuffer;
}
int FAKE_GetFifoSize()
@ -74,9 +74,9 @@ int FAKE_GetFifoSize()
}
return (size - readptr);
}
int FAKE_GetFifoEndAddr()
u8* FAKE_GetFifoEndPtr()
{
return (int)(videoBuffer+size);
return &videoBuffer[size];
}
u8 FAKE_PeekFifo8(u32 _uOffset)
@ -104,9 +104,9 @@ int FAKE_GetPosition()
return readptr;
}
int FAKE_GetRealPtr()
u8* FAKE_GetFifoCurrentPtr()
{
return (int)(videoBuffer+readptr);
return &videoBuffer[readptr];
}
u16 FAKE_ReadFifo16()
@ -138,7 +138,7 @@ void Video_SendFifoData(u8* _uData)
// TODO (mb2): Better and DataReader inline for DX9
#ifdef DATAREADER_INLINE
if (g_pVideoData) // for DX9 plugin "compatibility"
readptr = g_pVideoData-(u32)videoBuffer;
readptr = (int)(g_pVideoData-videoBuffer);
#endif
if (FAKE_GetFifoSize() > readptr)
{

View File

@ -24,7 +24,7 @@
#include "ChunkFile.h"
// TODO (mb2) clean this if ok
#define DATAREADER_INLINE // uncomment to use the previous IDataReader way
#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)

View File

@ -28,7 +28,7 @@ extern u8 FAKE_ReadFifo8();
extern u16 FAKE_ReadFifo16();
extern u32 FAKE_ReadFifo32();
extern int FAKE_GetPosition();
extern int FAKE_GetRealPtr();
extern u8* FAKE_GetFifoCurrentPtr();
extern void FAKE_SkipFifo(u32 skip);
IDataReader::~IDataReader()
@ -63,9 +63,9 @@ int CDataReader_Fifo::GetPosition()
{
return FAKE_GetPosition();
}
int CDataReader_Fifo::GetRealPtr()
u8* CDataReader_Fifo::GetRealCurrentPtr()
{
return FAKE_GetRealPtr();
return FAKE_GetFifoCurrentPtr();
}
@ -115,8 +115,8 @@ void CDataReader_Memory::Skip(u32 skip)
m_uReadAddress += skip;
}
int CDataReader_Memory::GetRealPtr()
u8* CDataReader_Memory::GetRealCurrentPtr()
{
return (int)Memory_GetPtr(m_uReadAddress);
return Memory_GetPtr(m_uReadAddress);
}
#endif

View File

@ -38,7 +38,7 @@ public:
virtual u32 Read32() = 0;
virtual int GetPosition() = 0; // return values can be anything, as long as relative distances are correct
virtual int GetRealPtr() = 0;
virtual u8* GetRealCurrentPtr() = 0;
};
// =================================================================================================
@ -57,7 +57,7 @@ public:
virtual u16 Read16();
virtual u32 Read32();
virtual int GetPosition();
virtual int GetRealPtr();
virtual u8* GetRealCurrentPtr();
};
// =================================================================================================
@ -82,7 +82,7 @@ public:
virtual u16 Read16();
virtual u32 Read32();
virtual int GetPosition();
virtual int GetRealPtr();
virtual u8* GetRealCurrentPtr();
};
extern IDataReader* g_pDataReader;
@ -93,14 +93,14 @@ extern IDataReader* g_pDataReader;
#ifdef DATAREADER_INLINE
extern u32 g_pVideoData;
extern u8* g_pVideoData;
#endif
#ifdef DATAREADER_DEBUG
extern u32 g_pDataReaderRealPtr;
#define DATAREADER_DEBUG_CHECK_PTR g_pDataReaderRealPtr = g_pDataReader->GetRealPtr(); \
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->GetRealPtr(); \
#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
@ -126,7 +126,7 @@ inline u32 DataPeek32(u32 _uOffset) {
inline u8 DataReadU8()
{
u8 tmp = *(u8*)g_pVideoData;
u8 tmp = *g_pVideoData;
g_pVideoData++;
#ifdef DATAREADER_DEBUG
u8 tmpdb = g_pDataReader->Read8();
@ -172,7 +172,7 @@ inline float DataReadF32()
return tmp;
}
inline u32 DataGetPosition()
inline u8* DataGetPosition()
{
#ifdef DATAREADER_DEBUG
DATAREADER_DEBUG_CHECK_PTR;

View File

@ -41,11 +41,11 @@
CDataReader_Fifo g_fifoReader;
#endif
#ifdef DATAREADER_DEBUG
u32 g_pDataReaderRealPtr=0;
u8* g_pDataReaderRealPtr=0;
#endif
#ifdef DATAREADER_INLINE
u32 g_pVideoData=0;
u8* g_pVideoData=0;
extern bool g_IsFifoRewinded;
#endif
@ -57,9 +57,9 @@ extern u16 FAKE_PeekFifo16(u32 _uOffset);
extern u32 FAKE_PeekFifo32(u32 _uOffset);
extern int FAKE_GetFifoSize();
#endif
extern int FAKE_GetFifoEndAddr();
extern u32 FAKE_GetFifoStartPtr();
extern int FAKE_GetRealPtr();
extern u8* FAKE_GetFifoEndPtr();
extern u8* FAKE_GetFifoStartPtr();
extern u8* FAKE_GetFifoCurrentPtr();
extern void FAKE_SkipFifo(u32 skip);
template <class T>
@ -80,9 +80,9 @@ void ExecuteDisplayList(u32 address, u32 size)
g_pDataReader = &memoryReader;
#endif
#ifdef DATAREADER_INLINE
u32 old_pVideoData = g_pVideoData;
u8* old_pVideoData = g_pVideoData;
const u32 startAddress = (u32)Memory_GetPtr(address);
u8* startAddress = Memory_GetPtr(address);
g_pVideoData = startAddress;
#endif
// temporarily swap dl and non-dl(small "hack" for the stats)
@ -123,7 +123,7 @@ bool FifoCommandRunnable(void)
#ifndef DATAREADER_INLINE
u32 iBufferSize = FAKE_GetFifoSize();
#else
u32 iBufferSize = FAKE_GetFifoEndAddr()-g_pVideoData;
u32 iBufferSize = (u32)(FAKE_GetFifoEndPtr()-g_pVideoData);
#ifdef DATAREADER_DEBUG
u32 iBufferSizedb = FAKE_GetFifoSize();
if( iBufferSize != iBufferSizedb) _asm int 3
@ -345,7 +345,7 @@ void OpcodeDecoder_Init()
g_pVideoData = FAKE_GetFifoStartPtr();
#if defined(DATAREADER_DEBUG)
g_pDataReader = &g_fifoReader;
g_pDataReaderRealPtr = g_pDataReader->GetRealPtr();
g_pDataReaderRealPtr = g_pDataReader->GetRealCurrentPtr();
DATAREADER_DEBUG_CHECK_PTR;
#endif
#endif