From e4825be7a8ebad00f95dbe654ab60c1b131da842 Mon Sep 17 00:00:00 2001 From: hrydgard Date: Sat, 30 Aug 2008 16:24:45 +0000 Subject: [PATCH] more statesave bugfixes... git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@387 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/HW/SerialInterface.cpp | 2 +- Source/Core/Core/Src/HW/SerialInterface_Devices.cpp | 2 +- Source/Core/Core/Src/State.cpp | 3 ++- Source/Core/VideoCommon/Src/Fifo.cpp | 2 +- Source/Core/VideoCommon/Src/VideoState.cpp | 1 + Source/Plugins/Plugin_VideoDX9/Src/main.cpp | 5 ++++- Source/Plugins/Plugin_VideoOGL/Src/main.cpp | 4 ++++ 7 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/Src/HW/SerialInterface.cpp b/Source/Core/Core/Src/HW/SerialInterface.cpp index 8b77e1fb85..24b0b9c7fc 100644 --- a/Source/Core/Core/Src/HW/SerialInterface.cpp +++ b/Source/Core/Core/Src/HW/SerialInterface.cpp @@ -220,7 +220,7 @@ static u8 g_SIBuffer[128]; void DoState(PointerWrap &p) { - p.Do(g_Channel); + // p.DoArray(g_Channel); p.Do(g_Poll); p.Do(g_ComCSR); p.Do(g_StatusReg); diff --git a/Source/Core/Core/Src/HW/SerialInterface_Devices.cpp b/Source/Core/Core/Src/HW/SerialInterface_Devices.cpp index cad7dc2977..8abead6fb8 100644 --- a/Source/Core/Core/Src/HW/SerialInterface_Devices.cpp +++ b/Source/Core/Core/Src/HW/SerialInterface_Devices.cpp @@ -93,7 +93,7 @@ int CSIDevice_GCController::RunBuffer(u8* _pBuffer, int _iLength) { // read the command EBufferCommands command = static_cast(_pBuffer[iPosition ^ 3]); - iPosition ++; + iPosition++; // handle it switch(command) diff --git a/Source/Core/Core/Src/State.cpp b/Source/Core/Core/Src/State.cpp index d43e5a88c1..2e26c4a5a9 100644 --- a/Source/Core/Core/Src/State.cpp +++ b/Source/Core/Core/Src/State.cpp @@ -38,10 +38,11 @@ static std::string cur_filename; void DoState(PointerWrap &p) { + // Begin with video plugin, so that it gets a chance to clear it's caches and writeback modified things to RAM + PluginVideo::Video_DoState(p.GetPPtr(), p.GetMode()); PowerPC::DoState(p); HW::DoState(p); CoreTiming::DoState(p); - // PluginVideo::Video_DoState(p.GetPPtr(), p.GetMode()); } void SaveStateCallback(u64 userdata, int cyclesLate) diff --git a/Source/Core/VideoCommon/Src/Fifo.cpp b/Source/Core/VideoCommon/Src/Fifo.cpp index 254c6960d1..a9ddd16c08 100644 --- a/Source/Core/VideoCommon/Src/Fifo.cpp +++ b/Source/Core/VideoCommon/Src/Fifo.cpp @@ -33,7 +33,7 @@ static int size = 0; static int readptr = 0; void Fifo_DoState(PointerWrap &p) { - p.DoArray(videoBuffer, size); + p.DoArray(videoBuffer, FIFO_SIZE); p.Do(size); p.Do(readptr); } diff --git a/Source/Core/VideoCommon/Src/VideoState.cpp b/Source/Core/VideoCommon/Src/VideoState.cpp index 8e187c585e..70a812e113 100644 --- a/Source/Core/VideoCommon/Src/VideoState.cpp +++ b/Source/Core/VideoCommon/Src/VideoState.cpp @@ -24,6 +24,7 @@ #include "Fifo.h" static void DoState(PointerWrap &p) { + // BP Memory p.Do(bpmem); // CP Memory diff --git a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp index 542bd55b5e..d84bc47399 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp @@ -152,7 +152,7 @@ void DllConfig(HWND _hParent) void Video_Initialize(SVideoInitialize* _pVideoInitialize) { - if( _pVideoInitialize == NULL ) + if (_pVideoInitialize == NULL) return; frameCount = 0; @@ -167,6 +167,9 @@ void Video_Initialize(SVideoInitialize* _pVideoInitialize) } void Video_DoState(unsigned char **ptr, int mode) { + // Clear all caches + TextureCache::Invalidate(); + PointerWrap p(ptr, mode); VideoCommon_DoState(p); //PanicAlert("Saving/Loading state from DirectX9"); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index fad99802cc..b5788088f0 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -180,6 +180,10 @@ void Video_Initialize(SVideoInitialize* _pVideoInitialize) } void Video_DoState(unsigned char **ptr, int mode) { + + // Clear all caches + TextureMngr::Invalidate(); + PointerWrap p(ptr, mode); VideoCommon_DoState(p); //PanicAlert("Saving/Loading state from OpenGL");