mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-25 15:41:11 +00:00
Merge some state loading stuff to VideoCommon and fixed a crash on Linux system when trying to save a state.
Credits go to miquelmartos from the forums for the patch ;) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6593 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
aa226aaf41
commit
4553699077
@ -5,10 +5,12 @@
|
|||||||
#include "RenderBase.h"
|
#include "RenderBase.h"
|
||||||
#include "FramebufferManagerBase.h"
|
#include "FramebufferManagerBase.h"
|
||||||
#include "TextureCacheBase.h"
|
#include "TextureCacheBase.h"
|
||||||
|
#include "VertexLoaderManager.h"
|
||||||
#include "CommandProcessor.h"
|
#include "CommandProcessor.h"
|
||||||
#include "PixelEngine.h"
|
#include "PixelEngine.h"
|
||||||
#include "Atomic.h"
|
#include "Atomic.h"
|
||||||
#include "Fifo.h"
|
#include "Fifo.h"
|
||||||
|
#include "BPStructs.h"
|
||||||
#include "OnScreenDisplay.h"
|
#include "OnScreenDisplay.h"
|
||||||
|
|
||||||
bool s_PluginInitialized = false;
|
bool s_PluginInitialized = false;
|
||||||
@ -162,10 +164,65 @@ u32 Video_AccessEFB(EFBAccessType type, u32 x, u32 y, u32 InputData)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static volatile struct
|
||||||
|
{
|
||||||
|
unsigned char **ptr;
|
||||||
|
int mode;
|
||||||
|
} s_doStateArgs;
|
||||||
|
|
||||||
|
// Run from the GPU thread on X11, CPU thread on the rest
|
||||||
|
static void check_DoState() {
|
||||||
|
#if defined(HAVE_X11) && HAVE_X11
|
||||||
|
if (Common::AtomicLoadAcquire(s_doStateRequested))
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
// Clear all caches that touch RAM
|
||||||
|
CommandProcessor::FifoCriticalEnter();
|
||||||
|
TextureCache::Invalidate(false);
|
||||||
|
VertexLoaderManager::MarkAllDirty();
|
||||||
|
CommandProcessor::FifoCriticalLeave();
|
||||||
|
|
||||||
|
PointerWrap p(s_doStateArgs.ptr, s_doStateArgs.mode);
|
||||||
|
VideoCommon_DoState(p);
|
||||||
|
|
||||||
|
// Refresh state.
|
||||||
|
if (s_doStateArgs.mode == PointerWrap::MODE_READ)
|
||||||
|
{
|
||||||
|
BPReload();
|
||||||
|
RecomputeCachedArraybases();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(HAVE_X11) && HAVE_X11
|
||||||
|
Common::AtomicStoreRelease(s_doStateRequested, FALSE);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run from the CPU thread
|
||||||
|
void DoState(unsigned char **ptr, int mode)
|
||||||
|
{
|
||||||
|
s_doStateArgs.ptr = ptr;
|
||||||
|
s_doStateArgs.mode = mode;
|
||||||
|
#if defined(HAVE_X11) && HAVE_X11
|
||||||
|
Common::AtomicStoreRelease(s_doStateRequested, TRUE);
|
||||||
|
if (g_VideoInitialize.bOnThread)
|
||||||
|
{
|
||||||
|
while (Common::AtomicLoadAcquire(s_doStateRequested) && !s_FifoShuttingDown)
|
||||||
|
//Common::SleepCurrentThread(1);
|
||||||
|
Common::YieldCPU();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
check_DoState();
|
||||||
|
}
|
||||||
|
|
||||||
void VideoFifo_CheckAsyncRequest()
|
void VideoFifo_CheckAsyncRequest()
|
||||||
{
|
{
|
||||||
VideoFifo_CheckSwapRequest();
|
VideoFifo_CheckSwapRequest();
|
||||||
VideoFifo_CheckEFBAccess();
|
VideoFifo_CheckEFBAccess();
|
||||||
|
#if defined(HAVE_X11) && HAVE_X11
|
||||||
|
check_DoState();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Video_CommandProcessorRead16(u16& _rReturnValue, const u32 _Address)
|
void Video_CommandProcessorRead16(u16& _rReturnValue, const u32 _Address)
|
||||||
|
@ -311,14 +311,3 @@ void Shutdown()
|
|||||||
|
|
||||||
s_PluginInitialized = false;
|
s_PluginInitialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoState(unsigned char **ptr, int mode)
|
|
||||||
{
|
|
||||||
// Clear texture cache because it might have written to RAM
|
|
||||||
CommandProcessor::FifoCriticalEnter();
|
|
||||||
TextureCache::Invalidate(false);
|
|
||||||
CommandProcessor::FifoCriticalLeave();
|
|
||||||
// No need to clear shader caches
|
|
||||||
PointerWrap p(ptr, mode);
|
|
||||||
VideoCommon_DoState(p);
|
|
||||||
}
|
|
||||||
|
@ -286,14 +286,3 @@ void Shutdown()
|
|||||||
D3D::Shutdown();
|
D3D::Shutdown();
|
||||||
EmuWindow::Close();
|
EmuWindow::Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoState(unsigned char **ptr, int mode)
|
|
||||||
{
|
|
||||||
// Clear texture cache because it might have written to RAM
|
|
||||||
CommandProcessor::FifoCriticalEnter();
|
|
||||||
TextureCache::Invalidate(false);
|
|
||||||
CommandProcessor::FifoCriticalLeave();
|
|
||||||
// No need to clear shader caches
|
|
||||||
PointerWrap p(ptr, mode);
|
|
||||||
VideoCommon_DoState(p);
|
|
||||||
}
|
|
||||||
|
@ -292,53 +292,3 @@ void Shutdown()
|
|||||||
delete g_renderer;
|
delete g_renderer;
|
||||||
OpenGL_Shutdown();
|
OpenGL_Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
static volatile struct
|
|
||||||
{
|
|
||||||
unsigned char **ptr;
|
|
||||||
int mode;
|
|
||||||
} s_doStateArgs;
|
|
||||||
|
|
||||||
// Run from the GPU thread on X11, CPU thread on the rest
|
|
||||||
static void check_DoState() {
|
|
||||||
#if defined(HAVE_X11) && HAVE_X11
|
|
||||||
if (Common::AtomicLoadAcquire(s_doStateRequested))
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
// Clear all caches that touch RAM
|
|
||||||
TextureCache::Invalidate(false);
|
|
||||||
VertexLoaderManager::MarkAllDirty();
|
|
||||||
|
|
||||||
PointerWrap p(s_doStateArgs.ptr, s_doStateArgs.mode);
|
|
||||||
VideoCommon_DoState(p);
|
|
||||||
|
|
||||||
// Refresh state.
|
|
||||||
if (s_doStateArgs.mode == PointerWrap::MODE_READ)
|
|
||||||
{
|
|
||||||
BPReload();
|
|
||||||
RecomputeCachedArraybases();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(HAVE_X11) && HAVE_X11
|
|
||||||
Common::AtomicStoreRelease(s_doStateRequested, FALSE);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// Run from the CPU thread
|
|
||||||
void DoState(unsigned char **ptr, int mode)
|
|
||||||
{
|
|
||||||
s_doStateArgs.ptr = ptr;
|
|
||||||
s_doStateArgs.mode = mode;
|
|
||||||
#if defined(HAVE_X11) && HAVE_X11
|
|
||||||
Common::AtomicStoreRelease(s_doStateRequested, TRUE);
|
|
||||||
if (g_VideoInitialize.bOnThread)
|
|
||||||
{
|
|
||||||
while (Common::AtomicLoadAcquire(s_doStateRequested) && !s_FifoShuttingDown)
|
|
||||||
//Common::SleepCurrentThread(1);
|
|
||||||
Common::YieldCPU();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
check_DoState();
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user