Merge branch 'osx-savegame-fix'

This commit is contained in:
degasus
2012-12-24 13:30:59 +01:00
6 changed files with 38 additions and 5 deletions

View File

@ -137,6 +137,8 @@ public:
// the implementation needs not do synchronization logic, because calls to it are surrounded by PauseAndLock now // the implementation needs not do synchronization logic, because calls to it are surrounded by PauseAndLock now
virtual void DoState(PointerWrap &p) = 0; virtual void DoState(PointerWrap &p) = 0;
virtual void CheckInvalidState() = 0;
}; };
extern std::vector<VideoBackend*> g_available_video_backends; extern std::vector<VideoBackend*> g_available_video_backends;
@ -177,8 +179,14 @@ class VideoBackendHardware : public VideoBackend
void PauseAndLock(bool doLock, bool unpauseOnUnlock=true); void PauseAndLock(bool doLock, bool unpauseOnUnlock=true);
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
bool m_invalid;
public:
void CheckInvalidState();
protected: protected:
void InitializeShared(); void InitializeShared();
void InvalidState();
}; };
#endif #endif

View File

@ -34,9 +34,9 @@
using namespace BPFunctions; using namespace BPFunctions;
u32 mapTexAddress; static u32 mapTexAddress;
bool mapTexFound; static bool mapTexFound;
int numWrites; static int numWrites;
extern volatile bool g_bSkipCurrentFrame; extern volatile bool g_bSkipCurrentFrame;
@ -82,6 +82,9 @@ void BPWritten(const BPCmd& bp)
---------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------
*/ */
// check for invalid state, else unneeded configuration are built
g_video_backend->CheckInvalidState();
// Debugging only, this lets you skip a bp update // Debugging only, this lets you skip a bp update
//static int times = 0; //static int times = 0;
//static bool enable = false; //static bool enable = false;

View File

@ -180,6 +180,7 @@ void VideoBackendHardware::InitializeShared()
memset((void*)&s_beginFieldArgs, 0, sizeof(s_beginFieldArgs)); memset((void*)&s_beginFieldArgs, 0, sizeof(s_beginFieldArgs));
memset(&s_accessEFBArgs, 0, sizeof(s_accessEFBArgs)); memset(&s_accessEFBArgs, 0, sizeof(s_accessEFBArgs));
s_AccessEFBResult = 0; s_AccessEFBResult = 0;
m_invalid = false;
} }
// Run from the CPU thread // Run from the CPU thread
@ -198,16 +199,25 @@ void VideoBackendHardware::DoState(PointerWrap& p)
// Refresh state. // Refresh state.
if (p.GetMode() == PointerWrap::MODE_READ) if (p.GetMode() == PointerWrap::MODE_READ)
{ {
BPReload(); m_invalid = true;
RecomputeCachedArraybases(); RecomputeCachedArraybases();
// Clear all caches that touch RAM // Clear all caches that touch RAM
// (? these don't appear to touch any emulation state that gets saved. moved to on load only.) // (? these don't appear to touch any emulation state that gets saved. moved to on load only.)
TextureCache::Invalidate();
VertexLoaderManager::MarkAllDirty(); VertexLoaderManager::MarkAllDirty();
} }
} }
void VideoBackendHardware::CheckInvalidState() {
if (m_invalid)
{
m_invalid = false;
BPReload();
TextureCache::Invalidate();
}
}
void VideoBackendHardware::PauseAndLock(bool doLock, bool unpauseOnUnlock) void VideoBackendHardware::PauseAndLock(bool doLock, bool unpauseOnUnlock)
{ {
Fifo_PauseAndLock(doLock, unpauseOnUnlock); Fifo_PauseAndLock(doLock, unpauseOnUnlock);

View File

@ -9,6 +9,7 @@
#include "NativeVertexFormat.h" #include "NativeVertexFormat.h"
#include "TextureCacheBase.h" #include "TextureCacheBase.h"
#include "RenderBase.h" #include "RenderBase.h"
#include "BPStructs.h"
#include "VertexManagerBase.h" #include "VertexManagerBase.h"
#include "VideoConfig.h" #include "VideoConfig.h"
@ -159,6 +160,9 @@ void VertexManager::AddVertices(int primitive, int numVertices)
void VertexManager::Flush() void VertexManager::Flush()
{ {
// loading a state will invalidate BP, so check for it
g_video_backend->CheckInvalidState();
g_vertex_manager->vFlush(); g_vertex_manager->vFlush();
} }

View File

@ -95,6 +95,11 @@ void VideoSoftware::DoState(PointerWrap&)
// NYI // NYI
} }
void VideoSoftware::CheckInvalidState()
{
// there is no state to invalidate
}
void VideoSoftware::PauseAndLock(bool doLock, bool unpauseOnUnlock) void VideoSoftware::PauseAndLock(bool doLock, bool unpauseOnUnlock)
{ {
if (doLock) if (doLock)

View File

@ -50,6 +50,9 @@ class VideoSoftware : public VideoBackend
void PauseAndLock(bool doLock, bool unpauseOnUnlock=true); void PauseAndLock(bool doLock, bool unpauseOnUnlock=true);
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
public:
void CheckInvalidState();
}; };
} }