mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
1) XFB in DC proposal. This impact video plugin interface. WARNING: XFB_Draw is not CPU->VI dependent anymore. It's up to GP now. Except for some 2D homebrews which never use GPfifo&CP but direcly XFB. Well, in other words: emulated VSync is uncorrelated with CPU timings now. Tell me if it's too much hacky.
2) DC/GPfifo work: GP quicker to react. PeekMessages at a more steady rate. 3) Fix XFB address to avoid crash like with Animal Crossing gc. TODO: VI regs need proper typedef and logic. 4) Few misc. changes on the fly. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2001 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -25,7 +25,12 @@
|
||||
|
||||
extern u8* g_pVideoData;
|
||||
|
||||
bool fifoStateRun = true;
|
||||
// TODO (mb2): move/rm this global
|
||||
volatile BOOL g_XFBUpdateRequested = FALSE;
|
||||
|
||||
#ifndef _WIN32
|
||||
static bool fifoStateRun = true;
|
||||
#endif
|
||||
|
||||
// STATE_TO_SAVE
|
||||
static u8 *videoBuffer;
|
||||
@ -43,18 +48,25 @@ void Fifo_DoState(PointerWrap &p)
|
||||
void Fifo_Init()
|
||||
{
|
||||
videoBuffer = (u8*)AllocateMemoryPages(FIFO_SIZE);
|
||||
#ifndef _WIN32
|
||||
fifoStateRun = true;
|
||||
#endif
|
||||
g_XFBUpdateRequested = FALSE;
|
||||
}
|
||||
|
||||
void Fifo_Shutdown()
|
||||
{
|
||||
FreeMemoryPages(videoBuffer, FIFO_SIZE);
|
||||
#ifndef _WIN32
|
||||
fifoStateRun = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void Fifo_Stop()
|
||||
{
|
||||
#ifndef _WIN32
|
||||
fifoStateRun = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
u8* FAKE_GetFifoStartPtr()
|
||||
@ -97,20 +109,26 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
|
||||
while (fifoStateRun)
|
||||
#endif
|
||||
{
|
||||
if (_fifo.CPReadWriteDistance < _fifo.CPLoWatermark)
|
||||
if (_fifo.CPReadWriteDistance == 0)
|
||||
Common::SleepCurrentThread(1);
|
||||
//etc...
|
||||
|
||||
if (g_XFBUpdateRequested)
|
||||
{
|
||||
Video_UpdateXFB(NULL, 0, 0, 0, FALSE);
|
||||
g_XFBUpdateRequested = FALSE;
|
||||
video_initialize.pCopiedToXFB();
|
||||
}
|
||||
// check if we are able to run this buffer
|
||||
if ((_fifo.bFF_GPReadEnable) && _fifo.CPReadWriteDistance && !(_fifo.bFF_BPEnable && _fifo.bFF_Breakpoint))
|
||||
{
|
||||
Common::SyncInterlockedExchange((LONG*)&_fifo.CPReadIdle, 0);
|
||||
//video_initialize.pLog("RUN...........................",FALSE);
|
||||
int peek_counter = 0;
|
||||
while (_fifo.bFF_GPReadEnable && (_fifo.CPReadWriteDistance > 0))
|
||||
while (_fifo.bFF_GPReadEnable && _fifo.CPReadWriteDistance)
|
||||
{
|
||||
peek_counter++;
|
||||
if (peek_counter == 50) {
|
||||
if (peek_counter == 1000) {
|
||||
video_initialize.pPeekMessages();
|
||||
peek_counter = 0;
|
||||
}
|
||||
@ -146,6 +164,8 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
|
||||
#else
|
||||
// sending the whole CPReadWriteDistance
|
||||
distToSend = _fifo.CPReadWriteDistance;
|
||||
// send 1024B chunk max lenght to have better control over PeekMessages' period
|
||||
distToSend = distToSend > 1024 ? 1024 : distToSend;
|
||||
if ( (distToSend+readPtr) >= _fifo.CPEnd) // TODO: better?
|
||||
{
|
||||
distToSend =_fifo.CPEnd - readPtr;
|
||||
|
@ -69,19 +69,21 @@ void _SetCol565(u16 val)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
inline u32 _Read24(u32 iAddress)
|
||||
{
|
||||
u32 col = Memory_Read_U8(iAddress) << RSHIFT; //should just get a pointer to main memory instead of going thru slow memhandler
|
||||
col |= Memory_Read_U8(iAddress+1) << GSHIFT; //we can guarantee that it is reading from main memory
|
||||
col |= Memory_Read_U8(iAddress+2) << BSHIFT;
|
||||
return col | (0xFF<<ASHIFT);
|
||||
// u32 col = Memory_Read_U8(iAddress) << RSHIFT; //should just get a pointer to main memory instead of going thru slow memhandler
|
||||
// col |= Memory_Read_U8(iAddress+1) << GSHIFT; //we can guarantee that it is reading from main memory
|
||||
// col |= Memory_Read_U8(iAddress+2) << BSHIFT;
|
||||
// return col | (0xFF<<ASHIFT);
|
||||
return Memory_Read_U32_Unswapped(iAddress)|0xFF000000;
|
||||
}
|
||||
|
||||
inline u32 _Read32(u32 iAddress)
|
||||
{
|
||||
u32 col = Memory_Read_U8(iAddress) << RSHIFT; //should just get a pointer to main memory instead of going thru slow memhandler
|
||||
col |= Memory_Read_U8(iAddress+1) << GSHIFT; //we can guarantee that it is reading from main memory
|
||||
col |= Memory_Read_U8(iAddress+2) << BSHIFT;
|
||||
col |= Memory_Read_U8(iAddress+3) << ASHIFT;
|
||||
return col;
|
||||
// u32 col = Memory_Read_U8(iAddress) << RSHIFT; //should just get a pointer to main memory instead of going thru slow memhandler
|
||||
// col |= Memory_Read_U8(iAddress+1) << GSHIFT; //we can guarantee that it is reading from main memory
|
||||
// col |= Memory_Read_U8(iAddress+2) << BSHIFT;
|
||||
// col |= Memory_Read_U8(iAddress+3) << ASHIFT;
|
||||
// return col;
|
||||
return Memory_Read_U32_Unswapped(iAddress);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -43,6 +43,8 @@ enum {
|
||||
};
|
||||
|
||||
extern SVideoInitialize g_VideoInitialize;
|
||||
// (mb2) for XFB update hack. TODO: find a static better place
|
||||
extern volatile BOOL g_XFBUpdateRequested;
|
||||
|
||||
void DebugLog(const char* _fmt, ...);
|
||||
|
||||
@ -66,6 +68,11 @@ inline u32 Memory_Read_U32(u32 _uAddress)
|
||||
return Common::swap32(*(u32*)g_VideoInitialize.pGetMemoryPointer(_uAddress));
|
||||
}
|
||||
|
||||
inline u32 Memory_Read_U32_Unswapped(u32 _uAddress)
|
||||
{
|
||||
return *(u32*)g_VideoInitialize.pGetMemoryPointer(_uAddress);
|
||||
}
|
||||
|
||||
inline float Memory_Read_Float(u32 _uAddress)
|
||||
{
|
||||
union {u32 i; float f;} temp;
|
||||
|
Reference in New Issue
Block a user