1. Savestates should now be super-stable (but you have to save AND load)
2. AccessEFB will probably not hang (tell me if it does) 3. Stopping should be a little bit faster git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3658 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
7e8a2fc136
commit
3ddbb094ab
|
@ -39,6 +39,7 @@ namespace {
|
||||||
static volatile bool fifoStateRun = false;
|
static volatile bool fifoStateRun = false;
|
||||||
static u8 *videoBuffer;
|
static u8 *videoBuffer;
|
||||||
static Common::Event fifo_exit_event;
|
static Common::Event fifo_exit_event;
|
||||||
|
static Common::CriticalSection s_criticalFifo;
|
||||||
// STATE_TO_SAVE
|
// STATE_TO_SAVE
|
||||||
static int size = 0;
|
static int size = 0;
|
||||||
|
|
||||||
|
@ -46,11 +47,15 @@ static int size = 0;
|
||||||
|
|
||||||
void Fifo_DoState(PointerWrap &p)
|
void Fifo_DoState(PointerWrap &p)
|
||||||
{
|
{
|
||||||
|
s_criticalFifo.Enter();
|
||||||
|
|
||||||
p.DoArray(videoBuffer, FIFO_SIZE);
|
p.DoArray(videoBuffer, FIFO_SIZE);
|
||||||
p.Do(size);
|
p.Do(size);
|
||||||
int pos = (int)(g_pVideoData - videoBuffer); // get offset
|
int pos = (int)(g_pVideoData - videoBuffer); // get offset
|
||||||
p.Do(pos); // read or write offset (depends on the mode afaik)
|
p.Do(pos); // read or write offset (depends on the mode afaik)
|
||||||
g_pVideoData = &videoBuffer[pos]; // overwrite g_pVideoData -> expected no change when load ss and change when save ss
|
g_pVideoData = &videoBuffer[pos]; // overwrite g_pVideoData -> expected no change when load ss and change when save ss
|
||||||
|
|
||||||
|
s_criticalFifo.Leave();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fifo_Init()
|
void Fifo_Init()
|
||||||
|
@ -153,6 +158,7 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
|
||||||
Video_UpdateXFB(NULL, 0, 0, 0, FALSE);
|
Video_UpdateXFB(NULL, 0, 0, 0, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s_criticalFifo.Enter();
|
||||||
// check if we are able to run this buffer
|
// check if we are able to run this buffer
|
||||||
if ((_fifo.bFF_GPReadEnable) && _fifo.CPReadWriteDistance && !(_fifo.bFF_BPEnable && _fifo.bFF_Breakpoint))
|
if ((_fifo.bFF_GPReadEnable) && _fifo.CPReadWriteDistance && !(_fifo.bFF_BPEnable && _fifo.bFF_Breakpoint))
|
||||||
{
|
{
|
||||||
|
@ -161,6 +167,9 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
|
||||||
int peek_counter = 0;
|
int peek_counter = 0;
|
||||||
while (_fifo.bFF_GPReadEnable && _fifo.CPReadWriteDistance)
|
while (_fifo.bFF_GPReadEnable && _fifo.CPReadWriteDistance)
|
||||||
{
|
{
|
||||||
|
if(!fifoStateRun)
|
||||||
|
break;
|
||||||
|
|
||||||
peek_counter++;
|
peek_counter++;
|
||||||
if (peek_counter == 1000) {
|
if (peek_counter == 1000) {
|
||||||
video_initialize.pPeekMessages();
|
video_initialize.pPeekMessages();
|
||||||
|
@ -218,6 +227,7 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
|
||||||
//video_initialize.pLog("..........................IDLE",FALSE);
|
//video_initialize.pLog("..........................IDLE",FALSE);
|
||||||
Common::SyncInterlockedExchange((LONG*)&_fifo.CPReadIdle, 1);
|
Common::SyncInterlockedExchange((LONG*)&_fifo.CPReadIdle, 1);
|
||||||
}
|
}
|
||||||
|
s_criticalFifo.Leave();
|
||||||
}
|
}
|
||||||
fifo_exit_event.Set();
|
fifo_exit_event.Set();
|
||||||
#ifdef SETUP_TIMER_WAITING
|
#ifdef SETUP_TIMER_WAITING
|
||||||
|
|
|
@ -102,7 +102,7 @@ static bool s_PluginInitialized = false;
|
||||||
static volatile u32 s_AccessEFBResult = 0, s_EFBx, s_EFBy;
|
static volatile u32 s_AccessEFBResult = 0, s_EFBx, s_EFBy;
|
||||||
static volatile EFBAccessType s_AccessEFBType;
|
static volatile EFBAccessType s_AccessEFBType;
|
||||||
static Common::Event s_AccessEFBDone;
|
static Common::Event s_AccessEFBDone;
|
||||||
static Common::CriticalSection s_criticalEFB;
|
static Common::CriticalSection s_criticalEFB, s_criticalAccess;
|
||||||
|
|
||||||
|
|
||||||
void GetDllInfo (PLUGIN_INFO* _PluginInfo)
|
void GetDllInfo (PLUGIN_INFO* _PluginInfo)
|
||||||
|
@ -513,6 +513,7 @@ void Video_OnThreadAccessEFB()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case POKE_COLOR:
|
case POKE_COLOR:
|
||||||
|
//WARN_LOG(VIDEOINTERFACE, "This is probably some kind of software rendering");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -528,6 +529,8 @@ u32 Video_AccessEFB(EFBAccessType type, u32 x, u32 y)
|
||||||
{
|
{
|
||||||
u32 result;
|
u32 result;
|
||||||
|
|
||||||
|
s_criticalAccess.Enter();
|
||||||
|
|
||||||
s_criticalEFB.Enter();
|
s_criticalEFB.Enter();
|
||||||
|
|
||||||
s_AccessEFBType = type;
|
s_AccessEFBType = type;
|
||||||
|
@ -536,8 +539,8 @@ u32 Video_AccessEFB(EFBAccessType type, u32 x, u32 y)
|
||||||
|
|
||||||
if (g_VideoInitialize.bUseDualCore)
|
if (g_VideoInitialize.bUseDualCore)
|
||||||
{
|
{
|
||||||
g_EFBAccessRequested = true;
|
|
||||||
s_AccessEFBDone.Init();
|
s_AccessEFBDone.Init();
|
||||||
|
g_EFBAccessRequested = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
s_criticalEFB.Leave();
|
s_criticalEFB.Leave();
|
||||||
|
@ -548,12 +551,15 @@ u32 Video_AccessEFB(EFBAccessType type, u32 x, u32 y)
|
||||||
Video_OnThreadAccessEFB();
|
Video_OnThreadAccessEFB();
|
||||||
|
|
||||||
s_criticalEFB.Enter();
|
s_criticalEFB.Enter();
|
||||||
|
|
||||||
if (g_VideoInitialize.bUseDualCore)
|
if (g_VideoInitialize.bUseDualCore)
|
||||||
s_AccessEFBDone.Shutdown();
|
s_AccessEFBDone.Shutdown();
|
||||||
|
|
||||||
result = s_AccessEFBResult;
|
result = s_AccessEFBResult;
|
||||||
s_criticalEFB.Leave();
|
s_criticalEFB.Leave();
|
||||||
|
|
||||||
|
s_criticalAccess.Leave();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue