A lot of save state groundwork. Please notify if compilation breaks because

I haven't compiled


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@368 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
XTra.KrazzY 2008-08-28 07:58:04 +00:00
parent 8a33d6787b
commit 051c2e0784
10 changed files with 60 additions and 61 deletions

View file

@ -55,6 +55,8 @@
#include "Host.h"
#include "LogManager.h"
#include "State.h"
#ifndef _WIN32
#define WINAPI
#endif
@ -411,11 +413,11 @@ EState GetState()
}
void SaveState() {
PluginVideo::Video_SaveState();
State_Save("state.dlp");
}
void LoadState() {
PluginVideo::Video_LoadState();
State_Load("state.dlp");
}
const SCoreStartupParameter& GetStartupParameter()

View file

@ -35,8 +35,7 @@ typedef void (__cdecl* TVideo_EnterLoop)();
typedef void (__cdecl* TVideo_AddMessage)(const char* pstr, unsigned int milliseconds);
typedef void (__cdecl* TVideo_SaveState)();
typedef void (__cdecl* TVideo_LoadState)();
typedef void (__cdecl* TVideo_DoState)(ChunkFile &f);
//! Function Pointer
TGetDllInfo g_GetDllInfo = 0;
@ -50,8 +49,7 @@ TVideo_UpdateXFB g_Video_UpdateXFB = 0;
TVideo_Screenshot g_Video_Screenshot = 0;
TVideo_EnterLoop g_Video_EnterLoop = 0;
TVideo_AddMessage g_Video_AddMessage = 0;
TVideo_SaveState g_Video_SaveState = 0;
TVideo_LoadState g_Video_LoadState = 0;
TVideo_DoState g_Video_DoState = 0;
//! Library Instance
DynamicLibrary plugin;
@ -72,11 +70,10 @@ void UnloadPlugin()
g_Video_Shutdown = 0;
g_Video_SendFifoData = 0;
g_Video_UpdateXFB = 0;
g_Video_AddMessage = 0;
g_Video_SaveState = 0;
g_Video_LoadState = 0;
g_Video_AddMessage = 0;
g_Video_DoState = 0;
plugin.Unload();
plugin.Unload();
}
bool LoadPlugin(const char *_Filename)
@ -94,8 +91,7 @@ bool LoadPlugin(const char *_Filename)
g_Video_Screenshot = reinterpret_cast<TVideo_Screenshot> (plugin.Get("Video_Screenshot"));
g_Video_EnterLoop = reinterpret_cast<TVideo_EnterLoop> (plugin.Get("Video_EnterLoop"));
g_Video_AddMessage = reinterpret_cast<TVideo_AddMessage> (plugin.Get("Video_AddMessage"));
g_Video_SaveState = reinterpret_cast<TVideo_SaveState> (plugin.Get("Video_SaveState"));
g_Video_LoadState = reinterpret_cast<TVideo_LoadState> (plugin.Get("Video_LoadState"));
g_Video_DoState = reinterpret_cast<TVideo_DoState> (plugin.Get("Video_DoState"));
if ((g_GetDllInfo != 0) &&
(g_DllAbout != 0) &&
@ -108,8 +104,7 @@ bool LoadPlugin(const char *_Filename)
(g_Video_EnterLoop != 0) &&
(g_Video_Screenshot != 0) &&
(g_Video_AddMessage != 0) &&
(g_Video_SaveState != 0) &&
(g_Video_LoadState != 0) )
(g_Video_DoState != 0) )
{
return true;
}
@ -181,12 +176,8 @@ void Video_AddMessage(const char* pstr, unsigned int milliseconds)
g_Video_AddMessage(pstr,milliseconds);
}
void Video_SaveState() {
g_Video_SaveState();
}
void Video_LoadState() {
g_Video_LoadState();
void Video_DoState(ChunkFile &f) {
g_Video_DoState(f);
}
} // end of namespace PluginVideo

View file

@ -20,6 +20,8 @@
#include "pluginspecs_video.h"
#include "ChunkFile.h"
namespace PluginVideo
{
bool IsLoaded();
@ -42,8 +44,7 @@ void Video_UpdateXFB(BYTE* _pXFB, DWORD _dwHeight, DWORD _dwWidth);
bool Video_Screenshot(TCHAR* _szFilename);
void Video_AddMessage(const char* pstr, unsigned int milliseconds);
void Video_SaveState();
void Video_LoadState();
void Video_DoState(ChunkFile &f);
} // end of namespace PluginVideo

View file

@ -17,6 +17,7 @@ void DoState(ChunkFile &f)
f.Descend("DOLP");
PowerPC::DoState(f);
HW::DoState(f);
PluginVideo::Video_DoState(f);
f.Ascend();
}
@ -43,13 +44,13 @@ void State_Shutdown()
// nothing to do, here for consistency.
}
void SaveState(const char *filename)
void State_Save(const char *filename)
{
cur_filename = filename;
CoreTiming::ScheduleEvent_Threadsafe(0, ev_Save);
}
void LoadState(const char *filename)
void State_Load(const char *filename)
{
cur_filename = filename;
CoreTiming::ScheduleEvent_Threadsafe(0, ev_Load);

View file

@ -6,7 +6,7 @@
void State_Init();
void State_Shutdown();
void State_Save();
void State_Load();
void State_Save(const char *filename);
void State_Load(const char *filename);
#endif

View file

@ -18,12 +18,34 @@
#include "VideoState.h"
#include "TextureDecoder.h"
void VideoCommon_SaveState() {
//PanicAlert("Saving state from Video Common Library");
//TODO: Save the video state
void DoState(ChunkFile &f) {
// BP Memory
f.Do(bpmem);
// CP Memory
f.Do(arraybases);
f.Do(arraystrides);
f.Do(MatrixIndexA);
f.Do(MatrixIndexB);
// XF Memory
f.Do(xfregs);
f.Do(xfmem);
// Texture decoder
f.Do(texMem);
// FIFO
f.Do(size);
f.DoArray(videoBuffer, sizeof(u8), size);
f.Do(readptr);
//TODO: Check for more pointers in the data structures and make them
// serializable
}
void VideoCommon_LoadState() {
//PanicAlert("Loading state from Video Common Library");
//TODO: Load the video state
void VideoCommon_DoState(ChunkFile &f) {
//PanicAlert("Saving state from Video Common Library");
//TODO: Save the video state
f.Descend("VID ");
f.DoState(f);
f.Ascend();
}

View file

@ -19,8 +19,8 @@
#define __VIDEOSTATE_H
#include "Common.h"
#include "ChunkFile.h"
void VideoCommon_SaveState();
void VideoCommon_LoadState();
void VideoCommon_DoState(ChunkFile &f);
#endif

View file

@ -168,20 +168,12 @@ EXPORT void CALL Video_EnterLoop(void);
EXPORT void CALL Video_AddMessage(const char* pstr, unsigned int milliseconds);
// __________________________________________________________________________________________________
// Function: Video_SaveState
// Purpose: Saves the current video data state
// Function: Video_DoState
// Purpose: Saves/Loads the current video data state(depends on parameter)
// input: The chunkfile to write to? FIXME
// output: none
//
EXPORT void CALL Video_SaveState(void);
// __________________________________________________________________________________________________
// Function: Video_LoadState
// Purpose: Loads the current video data state
// input: The chunkfile to read from? FIXME
// output: none
//
EXPORT void CALL Video_LoadState(void);
EXPORT void CALL Video_DoState(ChunkFile &f);
#include "ExportEpilog.h"
#endif

View file

@ -166,14 +166,9 @@ void Video_Initialize(SVideoInitialize* _pVideoInitialize)
}
void Video_SaveState(void) {
VideoCommon_SaveState();
//PanicAlert("Saving state from DirectX9");
}
void Video_LoadState(void) {
VideoCommon_LoadState();
//PanicAlert("Loading state from DirectX9");
void Video_DoState(ChunkFile &f) {
VideoCommon_DoState(f);
//PanicAlert("Saving/Loading state from DirectX9");
}
void Video_EnterLoop()

View file

@ -179,14 +179,9 @@ void Video_Initialize(SVideoInitialize* _pVideoInitialize)
}
void Video_SaveState(void) {
VideoCommon_SaveState();
//PanicAlert("Saving state from OpenGL");
}
void Video_LoadState(void) {
VideoCommon_LoadState();
//PanicAlert("Loading state from OpenGL");
void Video_DoState(ChunkFile &f) {
VideoCommon_DoState(f);
//PanicAlert("Saving/Loading state from OpenGL");
}
void Video_Prepare(void)