New SaveState folder for states. Removed some outdated code. Removed an unnecessary level of indirection for plugin calls. Assorted cleanup.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@389 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2008-08-30 19:19:40 +00:00
parent 6b6003c563
commit 85565688d7
34 changed files with 329 additions and 672 deletions

View File

@ -131,7 +131,8 @@ bool Init(const SCoreStartupParameter _CoreParameter)
} }
#ifdef _WIN32 #ifdef _WIN32
PluginDSP::DllDebugger((HWND)_CoreParameter.hMainWindow); if (PluginDSP::DllDebugger)
PluginDSP::DllDebugger((HWND)_CoreParameter.hMainWindow);
#endif #endif
emuThreadGoing.Init(); emuThreadGoing.Init();
@ -425,14 +426,14 @@ const SCoreStartupParameter& GetStartupParameter()
return g_CoreStartupParameter; return g_CoreStartupParameter;
} }
bool MakeScreenshot(const std::string& _rFilename) bool MakeScreenshot(const std::string &filename)
{ {
bool bResult = false; bool bResult = false;
if (PluginVideo::IsLoaded()) if (PluginVideo::IsLoaded())
{ {
TCHAR szTmpFilename[MAX_PATH]; TCHAR szTmpFilename[MAX_PATH];
strcpy(szTmpFilename, _rFilename.c_str()); strcpy(szTmpFilename, filename.c_str());
bResult = PluginVideo::Video_Screenshot(szTmpFilename); bResult = PluginVideo::Video_Screenshot(szTmpFilename) ? true : false;
} }
return bResult; return bResult;
} }

View File

@ -20,96 +20,86 @@
namespace PluginDSP namespace PluginDSP
{ {
//! Function Types
typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*);
typedef void (__cdecl* TDllAbout)(HWND);
typedef void (__cdecl* TDllConfig)(HWND);
typedef void (__cdecl* TDllDebugger)(HWND);
typedef void (__cdecl* TDSP_Initialize)(DSPInitialize);
typedef void (__cdecl* TDSP_Shutdown)();
typedef void (__cdecl* TDSP_WriteMailBox)(BOOL _CPUMailbox, unsigned short);
typedef unsigned short (__cdecl* TDSP_ReadMailBox)(BOOL _CPUMailbox);
typedef unsigned short (__cdecl* TDSP_ReadControlRegister)();
typedef unsigned short (__cdecl* TDSP_WriteControlRegister)(unsigned short);
typedef void (__cdecl* TDSP_Update)(int cycles);
typedef void (__cdecl* TDSP_SendAIBuffer)(unsigned int address, int sample_rate);
//! Function Pointer // Function Pointer
TGetDllInfo g_GetDllInfo = 0; TGetDllInfo GetDllInfo = 0;
TDllAbout g_DllAbout = 0; TDllAbout DllAbout = 0;
TDllConfig g_DllConfig = 0; TDllConfig DllConfig = 0;
TDllDebugger g_DllDebugger = 0; TDllDebugger DllDebugger = 0;
TDSP_Initialize g_DSP_Initialize = 0; TDSP_Initialize DSP_Initialize = 0;
TDSP_Shutdown g_DSP_Shutdown = 0; TDSP_Shutdown DSP_Shutdown = 0;
TDSP_ReadMailBox g_DSP_ReadMailboxHigh = 0; TDSP_ReadMailBox DSP_ReadMailboxHigh = 0;
TDSP_ReadMailBox g_DSP_ReadMailboxLow = 0; TDSP_ReadMailBox DSP_ReadMailboxLow = 0;
TDSP_WriteMailBox g_DSP_WriteMailboxHigh = 0; TDSP_WriteMailBox DSP_WriteMailboxHigh = 0;
TDSP_WriteMailBox g_DSP_WriteMailboxLow = 0; TDSP_WriteMailBox DSP_WriteMailboxLow = 0;
TDSP_ReadControlRegister g_DSP_ReadControlRegister = 0; TDSP_ReadControlRegister DSP_ReadControlRegister = 0;
TDSP_WriteControlRegister g_DSP_WriteControlRegister = 0; TDSP_WriteControlRegister DSP_WriteControlRegister = 0;
TDSP_Update g_DSP_Update = 0; TDSP_Update DSP_Update = 0;
TDSP_SendAIBuffer g_DSP_SendAIBuffer = 0; TDSP_SendAIBuffer DSP_SendAIBuffer = 0;
TDSP_DoState DSP_DoState = 0;
//! Library Instance //! Library Instance
DynamicLibrary plugin; DynamicLibrary plugin;
bool IsLoaded() bool IsLoaded()
{ {
return plugin.IsLoaded(); return plugin.IsLoaded();
} }
void UnloadPlugin() void UnloadPlugin()
{ {
plugin.Unload(); plugin.Unload();
// Set Functions to NULL // Set Functions to NULL
g_GetDllInfo = 0; GetDllInfo = 0;
g_DllAbout = 0; DllAbout = 0;
g_DllConfig = 0; DllConfig = 0;
g_DllDebugger = 0; DllDebugger = 0;
g_DSP_Initialize = 0; DSP_Initialize = 0;
g_DSP_Shutdown = 0; DSP_Shutdown = 0;
g_DSP_ReadMailboxHigh = 0; DSP_ReadMailboxHigh = 0;
g_DSP_ReadMailboxLow = 0; DSP_ReadMailboxLow = 0;
g_DSP_WriteMailboxHigh = 0; DSP_WriteMailboxHigh = 0;
g_DSP_WriteMailboxLow = 0; DSP_WriteMailboxLow = 0;
g_DSP_ReadControlRegister = 0; DSP_ReadControlRegister = 0;
g_DSP_WriteControlRegister = 0; DSP_WriteControlRegister = 0;
g_DSP_Update = 0; DSP_Update = 0;
g_DSP_SendAIBuffer = 0; DSP_SendAIBuffer = 0;
DSP_DoState = 0;
} }
bool LoadPlugin(const char *_Filename) bool LoadPlugin(const char *_Filename)
{ {
if (plugin.Load(_Filename)) if (plugin.Load(_Filename))
{ {
g_GetDllInfo = reinterpret_cast<TGetDllInfo> (plugin.Get("GetDllInfo")); GetDllInfo = reinterpret_cast<TGetDllInfo> (plugin.Get("GetDllInfo"));
g_DllAbout = reinterpret_cast<TDllAbout> (plugin.Get("DllAbout")); DllAbout = reinterpret_cast<TDllAbout> (plugin.Get("DllAbout"));
g_DllConfig = reinterpret_cast<TDllConfig> (plugin.Get("DllConfig")); DllConfig = reinterpret_cast<TDllConfig> (plugin.Get("DllConfig"));
g_DllDebugger = reinterpret_cast<TDllDebugger> (plugin.Get("DllDebugger")); DllDebugger = reinterpret_cast<TDllDebugger> (plugin.Get("DllDebugger"));
g_DSP_Initialize = reinterpret_cast<TDSP_Initialize> (plugin.Get("DSP_Initialize")); DSP_Initialize = reinterpret_cast<TDSP_Initialize> (plugin.Get("DSP_Initialize"));
g_DSP_Shutdown = reinterpret_cast<TDSP_Shutdown> (plugin.Get("DSP_Shutdown")); DSP_Shutdown = reinterpret_cast<TDSP_Shutdown> (plugin.Get("DSP_Shutdown"));
g_DSP_ReadMailboxHigh = reinterpret_cast<TDSP_ReadMailBox> (plugin.Get("DSP_ReadMailboxHigh")); DSP_ReadMailboxHigh = reinterpret_cast<TDSP_ReadMailBox> (plugin.Get("DSP_ReadMailboxHigh"));
g_DSP_ReadMailboxLow = reinterpret_cast<TDSP_ReadMailBox> (plugin.Get("DSP_ReadMailboxLow")); DSP_ReadMailboxLow = reinterpret_cast<TDSP_ReadMailBox> (plugin.Get("DSP_ReadMailboxLow"));
g_DSP_WriteMailboxHigh = reinterpret_cast<TDSP_WriteMailBox> (plugin.Get("DSP_WriteMailboxHigh")); DSP_WriteMailboxHigh = reinterpret_cast<TDSP_WriteMailBox> (plugin.Get("DSP_WriteMailboxHigh"));
g_DSP_WriteMailboxLow = reinterpret_cast<TDSP_WriteMailBox> (plugin.Get("DSP_WriteMailboxLow")); DSP_WriteMailboxLow = reinterpret_cast<TDSP_WriteMailBox> (plugin.Get("DSP_WriteMailboxLow"));
g_DSP_ReadControlRegister = reinterpret_cast<TDSP_ReadControlRegister> (plugin.Get("DSP_ReadControlRegister")); DSP_ReadControlRegister = reinterpret_cast<TDSP_ReadControlRegister> (plugin.Get("DSP_ReadControlRegister"));
g_DSP_WriteControlRegister = reinterpret_cast<TDSP_WriteControlRegister> (plugin.Get("DSP_WriteControlRegister")); DSP_WriteControlRegister = reinterpret_cast<TDSP_WriteControlRegister> (plugin.Get("DSP_WriteControlRegister"));
g_DSP_Update = reinterpret_cast<TDSP_Update> (plugin.Get("DSP_Update")); DSP_Update = reinterpret_cast<TDSP_Update> (plugin.Get("DSP_Update"));
g_DSP_SendAIBuffer = reinterpret_cast<TDSP_SendAIBuffer> (plugin.Get("DSP_SendAIBuffer")); DSP_SendAIBuffer = reinterpret_cast<TDSP_SendAIBuffer> (plugin.Get("DSP_SendAIBuffer"));
DSP_DoState = reinterpret_cast<TDSP_DoState> (plugin.Get("DSP_DoState"));
if ((g_GetDllInfo != 0) && if ((GetDllInfo != 0) &&
(g_DSP_Initialize != 0) && (DSP_Initialize != 0) &&
(g_DSP_Shutdown != 0) && (DSP_Shutdown != 0) &&
(g_DSP_ReadMailboxHigh != 0) && (DSP_ReadMailboxHigh != 0) &&
(g_DSP_ReadMailboxLow != 0) && (DSP_ReadMailboxLow != 0) &&
(g_DSP_WriteMailboxHigh != 0) && (DSP_WriteMailboxHigh != 0) &&
(g_DSP_WriteMailboxLow != 0) && (DSP_WriteMailboxLow != 0) &&
(g_DSP_ReadControlRegister != 0) && (DSP_ReadControlRegister != 0) &&
(g_DSP_WriteControlRegister != 0) && (DSP_WriteControlRegister != 0) &&
(g_DSP_Update != 0) && (DSP_Update != 0) &&
(g_DSP_SendAIBuffer != 0) (DSP_SendAIBuffer != 0) &&
) (DSP_DoState != 0))
{ {
return true; return true;
} }
@ -118,115 +108,9 @@ bool LoadPlugin(const char *_Filename)
UnloadPlugin(); UnloadPlugin();
return false; return false;
} }
} }
return false; return false;
} }
// } // namespace
// --- Plugin Functions ---
//
// __________________________________________________________________________________________________
//
void GetDllInfo(PLUGIN_INFO* _PluginInfo)
{
g_GetDllInfo(_PluginInfo);
}
// __________________________________________________________________________________________________
//
void DllAbout(HWND _hParent)
{
if (g_DllAbout)
g_DllAbout(_hParent);
}
// __________________________________________________________________________________________________
//
void DllConfig(HWND _hParent)
{
if (g_DllConfig)
g_DllConfig(_hParent);
}
// __________________________________________________________________________________________________
//
//
void DllDebugger(HWND _hParent)
{
if (g_DllDebugger)
g_DllDebugger(_hParent);
}
// __________________________________________________________________________________________________
//
void DSP_Initialize(DSPInitialize _dspInitialize)
{
g_DSP_Initialize(_dspInitialize);
}
// __________________________________________________________________________________________________
//
void DSP_Shutdown()
{
g_DSP_Shutdown();
}
// __________________________________________________________________________________________________
//
unsigned short DSP_ReadMailboxHigh(bool _CPUMailbox)
{
return g_DSP_ReadMailboxHigh(_CPUMailbox ? TRUE : FALSE);
}
// __________________________________________________________________________________________________
//
unsigned short DSP_ReadMailboxLow(bool _CPUMailbox)
{
return g_DSP_ReadMailboxLow(_CPUMailbox ? TRUE : FALSE);
}
// __________________________________________________________________________________________________
//
void DSP_WriteMailboxHigh(bool _CPUMailbox, unsigned short _uHighMail)
{
return g_DSP_WriteMailboxHigh(_CPUMailbox ? TRUE : FALSE, _uHighMail);
}
// __________________________________________________________________________________________________
//
void DSP_WriteMailboxLow(bool _CPUMailbox, unsigned short _uLowMail)
{
return g_DSP_WriteMailboxLow(_CPUMailbox ? TRUE : FALSE, _uLowMail);
}
// __________________________________________________________________________________________________
//
unsigned short DSP_WriteControlRegister(unsigned short _Value)
{
return g_DSP_WriteControlRegister(_Value);
}
// __________________________________________________________________________________________________
//
unsigned short DSP_ReadControlRegister()
{
return g_DSP_ReadControlRegister();
}
// __________________________________________________________________________________________________
//
void DSP_Update(int cycles)
{
g_DSP_Update(cycles);
}
// __________________________________________________________________________________________________
//
void DSP_SendAIBuffer(unsigned int address, int sample_rate)
{
g_DSP_SendAIBuffer(address, sample_rate);
}
}

View File

@ -26,24 +26,37 @@ bool IsLoaded();
bool LoadPlugin(const char *_Filename); bool LoadPlugin(const char *_Filename);
void UnloadPlugin(); void UnloadPlugin();
// // Function Types
// --- Plugin Functions --- typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*);
// typedef void (__cdecl* TDllAbout)(HWND);
typedef void (__cdecl* TDllConfig)(HWND);
typedef void (__cdecl* TDllDebugger)(HWND);
typedef void (__cdecl* TDSP_Initialize)(DSPInitialize);
typedef void (__cdecl* TDSP_Shutdown)();
typedef void (__cdecl* TDSP_WriteMailBox)(BOOL _CPUMailbox, unsigned short);
typedef unsigned short (__cdecl* TDSP_ReadMailBox)(BOOL _CPUMailbox);
typedef unsigned short (__cdecl* TDSP_ReadControlRegister)();
typedef unsigned short (__cdecl* TDSP_WriteControlRegister)(unsigned short);
typedef void (__cdecl* TDSP_Update)(int cycles);
typedef void (__cdecl* TDSP_SendAIBuffer)(unsigned int address, int sample_rate);
typedef void (__cdecl* TDSP_DoState)(unsigned char **ptr, int mode);
void GetDllInfo (PLUGIN_INFO* _PluginInfo) ; // Function Pointers
void DllAbout (HWND _hParent); extern TGetDllInfo GetDllInfo;
void DllConfig (HWND _hParent); extern TDllAbout DllAbout;
void DllDebugger(HWND _hParent); extern TDllConfig DllConfig;
void DSP_Initialize(DSPInitialize _dspInitialize); extern TDllDebugger DllDebugger;
void DSP_Shutdown(); extern TDSP_Initialize DSP_Initialize;
unsigned short DSP_ReadMailboxHigh(bool _CPUMailbox); extern TDSP_Shutdown DSP_Shutdown;
unsigned short DSP_ReadMailboxLow(bool _CPUMailbox); extern TDSP_ReadMailBox DSP_ReadMailboxHigh;
void DSP_WriteMailboxHigh(bool _CPUMailbox, unsigned short _Value); extern TDSP_ReadMailBox DSP_ReadMailboxLow;
void DSP_WriteMailboxLow(bool _CPUMailbox, unsigned short _Value); extern TDSP_WriteMailBox DSP_WriteMailboxHigh;
unsigned short DSP_WriteControlRegister(unsigned short _Flags); extern TDSP_WriteMailBox DSP_WriteMailboxLow;
unsigned short DSP_ReadControlRegister(); extern TDSP_ReadControlRegister DSP_ReadControlRegister;
void DSP_Update(int cycles); extern TDSP_WriteControlRegister DSP_WriteControlRegister;
void DSP_SendAIBuffer(unsigned int address, int sample_rate); extern TDSP_Update DSP_Update;
extern TDSP_SendAIBuffer DSP_SendAIBuffer;
extern TDSP_DoState DSP_DoState;
} // end of namespace PluginDSP } // end of namespace PluginDSP

View File

@ -21,28 +21,17 @@
namespace PluginPAD namespace PluginPAD
{ {
//! Function Types // Function Pointers
typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*); TGetDllInfo GetDllInfo = 0;
typedef void (__cdecl* TDllAbout)(HWND); TPAD_Shutdown PAD_Shutdown = 0;
typedef void (__cdecl* TDllConfig)(HWND); TDllAbout DllAbout = 0;
typedef void (__cdecl* TPAD_Initialize)(SPADInitialize); TDllConfig DllConfig = 0;
typedef void (__cdecl* TPAD_Shutdown)(); TPAD_Initialize PAD_Initialize = 0;
typedef void (__cdecl* TPAD_GetStatus)(BYTE, SPADStatus*); TPAD_GetStatus PAD_GetStatus = 0;
typedef void (__cdecl* TPAD_Rumble)(BYTE, unsigned int, unsigned int); TPAD_Rumble PAD_Rumble = 0;
typedef unsigned int (__cdecl* TPAD_GetAttachedPads)(); TPAD_GetAttachedPads PAD_GetAttachedPads = 0;
// Library Instance
//! Function Pointer
TGetDllInfo g_GetDllInfo = 0;
TPAD_Shutdown g_PAD_Shutdown = 0;
TDllAbout g_DllAbout = 0;
TDllConfig g_DllConfig = 0;
TPAD_Initialize g_PAD_Initialize = 0;
TPAD_GetStatus g_PAD_GetStatus = 0;
TPAD_Rumble g_PAD_Rumble = 0;
TPAD_GetAttachedPads g_PAD_GetAttachedPads = 0;
//! Library Instance
DynamicLibrary plugin; DynamicLibrary plugin;
bool IsLoaded() bool IsLoaded()
@ -54,35 +43,35 @@ void UnloadPlugin()
{ {
plugin.Unload(); plugin.Unload();
// Set Functions to 0 // Set Functions to 0
g_GetDllInfo = 0; GetDllInfo = 0;
g_PAD_Shutdown = 0; PAD_Shutdown = 0;
g_DllAbout = 0; DllAbout = 0;
g_DllConfig = 0; DllConfig = 0;
g_PAD_Initialize = 0; PAD_Initialize = 0;
g_PAD_GetStatus = 0; PAD_GetStatus = 0;
g_PAD_Rumble = 0; PAD_Rumble = 0;
} }
bool LoadPlugin(const char *_Filename) bool LoadPlugin(const char *_Filename)
{ {
if (plugin.Load(_Filename)) if (plugin.Load(_Filename))
{ {
g_GetDllInfo = reinterpret_cast<TGetDllInfo> (plugin.Get("GetDllInfo")); GetDllInfo = reinterpret_cast<TGetDllInfo> (plugin.Get("GetDllInfo"));
g_DllAbout = reinterpret_cast<TDllAbout> (plugin.Get("DllAbout")); DllAbout = reinterpret_cast<TDllAbout> (plugin.Get("DllAbout"));
g_DllConfig = reinterpret_cast<TDllConfig> (plugin.Get("DllConfig")); DllConfig = reinterpret_cast<TDllConfig> (plugin.Get("DllConfig"));
g_PAD_Initialize= reinterpret_cast<TPAD_Initialize> (plugin.Get("PAD_Initialize")); PAD_Initialize = reinterpret_cast<TPAD_Initialize> (plugin.Get("PAD_Initialize"));
g_PAD_Shutdown = reinterpret_cast<TPAD_Shutdown> (plugin.Get("PAD_Shutdown")); PAD_Shutdown = reinterpret_cast<TPAD_Shutdown> (plugin.Get("PAD_Shutdown"));
g_PAD_GetStatus = reinterpret_cast<TPAD_GetStatus> (plugin.Get("PAD_GetStatus")); PAD_GetStatus = reinterpret_cast<TPAD_GetStatus> (plugin.Get("PAD_GetStatus"));
g_PAD_Rumble = reinterpret_cast<TPAD_Rumble> (plugin.Get("PAD_Rumble")); PAD_Rumble = reinterpret_cast<TPAD_Rumble> (plugin.Get("PAD_Rumble"));
g_PAD_GetAttachedPads = reinterpret_cast<TPAD_GetAttachedPads>(plugin.Get("PAD_GetAttachedPads")); PAD_GetAttachedPads = reinterpret_cast<TPAD_GetAttachedPads>(plugin.Get("PAD_GetAttachedPads"));
if ((g_GetDllInfo != 0) && if ((GetDllInfo != 0) &&
(g_DllAbout != 0) && (DllAbout != 0) &&
(g_DllConfig != 0) && (DllConfig != 0) &&
(g_PAD_Initialize != 0) && (PAD_Initialize != 0) &&
(g_PAD_Shutdown != 0) && (PAD_Shutdown != 0) &&
(g_PAD_GetStatus != 0)) (PAD_GetStatus != 0))
//(g_PAD_Rumble != 0)) //(PAD_Rumble != 0))
{ {
return true; return true;
} }
@ -96,52 +85,4 @@ bool LoadPlugin(const char *_Filename)
return false; return false;
} }
// } // end of namespace PluginPAD
// --- Plugin Functions ---
//
void GetDllInfo(PLUGIN_INFO* _PluginInfo)
{
g_GetDllInfo(_PluginInfo);
}
void PAD_Shutdown()
{
g_PAD_Shutdown();
}
void DllAbout(HWND _hParent)
{
g_DllAbout(_hParent);
}
void DllConfig(HWND _hParent)
{
g_DllConfig(_hParent);
}
void PAD_Initialize(SPADInitialize _PADInitialize)
{
g_PAD_Initialize(_PADInitialize);
}
void PAD_GetStatus(BYTE _numPAD, SPADStatus* _pPADStatus)
{
g_PAD_GetStatus(_numPAD, _pPADStatus);
}
void PAD_Rumble(BYTE _numPAD, unsigned int _iType, unsigned int _iStrength)
{
if (g_PAD_Rumble)
g_PAD_Rumble(_numPAD, _iType, _iStrength);
}
unsigned int PAD_GetAttachedPads()
{
if (g_PAD_GetAttachedPads)
return g_PAD_GetAttachedPads();
return 1;
}
} // end of namespace PluginPAD

View File

@ -27,19 +27,25 @@ bool IsLoaded();
bool LoadPlugin(const char * _Filename); bool LoadPlugin(const char * _Filename);
void UnloadPlugin(); void UnloadPlugin();
// // Function Types
// --- Plugin Functions --- typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*);
// typedef void (__cdecl* TDllAbout)(HWND);
typedef void (__cdecl* TDllConfig)(HWND);
typedef void (__cdecl* TPAD_Initialize)(SPADInitialize);
typedef void (__cdecl* TPAD_Shutdown)();
typedef void (__cdecl* TPAD_GetStatus)(BYTE, SPADStatus*);
typedef void (__cdecl* TPAD_Rumble)(BYTE, unsigned int, unsigned int);
typedef unsigned int (__cdecl* TPAD_GetAttachedPads)();
void GetDllInfo(PLUGIN_INFO* _pPluginInfo) ; // Function Pointers
void DllAbout(HWND _hParent); extern TGetDllInfo GetDllInfo;
void DllConfig(HWND _hParent); extern TPAD_Shutdown PAD_Shutdown;
void PAD_Initialize(SPADInitialize _PADInitialize); extern TDllAbout DllAbout;
void PAD_Shutdown(); extern TDllConfig DllConfig;
void PAD_GetStatus(BYTE _numPAD, SPADStatus* _pPADStatus); extern TPAD_Initialize PAD_Initialize;
void PAD_Rumble(BYTE _numPAD, unsigned int _uType, unsigned int _uStrength); extern TPAD_GetStatus PAD_GetStatus;
unsigned int PAD_GetAttachedPads(); extern TPAD_Rumble PAD_Rumble;
unsigned int SaveLoadState(char* _ptr, BOOL save); extern TPAD_GetAttachedPads PAD_GetAttachedPads;
} // end of namespace PluginPAD } // end of namespace PluginPAD

View File

@ -21,35 +21,21 @@
namespace PluginVideo namespace PluginVideo
{ {
//! Function Types // Function Pointer
typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*); TGetDllInfo GetDllInfo = 0;
typedef void (__cdecl* TDllAbout)(HWND); TDllAbout DllAbout = 0;
typedef void (__cdecl* TDllConfig)(HWND); TDllConfig DllConfig = 0;
typedef void (__cdecl* TVideo_Initialize)(SVideoInitialize*); TVideo_Initialize Video_Initialize = 0;
typedef void (__cdecl* TVideo_Prepare)(); TVideo_Prepare Video_Prepare = 0;
typedef void (__cdecl* TVideo_Shutdown)(); TVideo_Shutdown Video_Shutdown = 0;
typedef void (__cdecl* TVideo_SendFifoData)(BYTE*); TVideo_SendFifoData Video_SendFifoData = 0;
typedef void (__cdecl* TVideo_UpdateXFB)(BYTE*, DWORD, DWORD); TVideo_UpdateXFB Video_UpdateXFB = 0;
typedef BOOL (__cdecl* TVideo_Screenshot)(TCHAR*); TVideo_Screenshot Video_Screenshot = 0;
typedef void (__cdecl* TVideo_EnterLoop)(); TVideo_EnterLoop Video_EnterLoop = 0;
typedef void (__cdecl* TVideo_AddMessage)(const char* pstr, unsigned int milliseconds); TVideo_AddMessage Video_AddMessage = 0;
typedef void (__cdecl* TVideo_DoState)(unsigned char **ptr, int mode); TVideo_DoState Video_DoState = 0;
//! Function Pointer // Library Instance
TGetDllInfo g_GetDllInfo = 0;
TDllAbout g_DllAbout = 0;
TDllConfig g_DllConfig = 0;
TVideo_Initialize g_Video_Initialize = 0;
TVideo_Prepare g_Video_Prepare = 0;
TVideo_Shutdown g_Video_Shutdown = 0;
TVideo_SendFifoData g_Video_SendFifoData = 0;
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_DoState g_Video_DoState = 0;
//! Library Instance
DynamicLibrary plugin; DynamicLibrary plugin;
bool IsLoaded() bool IsLoaded()
@ -60,16 +46,16 @@ bool IsLoaded()
void UnloadPlugin() void UnloadPlugin()
{ {
// set Functions to 0 // set Functions to 0
g_GetDllInfo = 0; GetDllInfo = 0;
g_DllAbout = 0; DllAbout = 0;
g_DllConfig = 0; DllConfig = 0;
g_Video_Initialize = 0; Video_Initialize = 0;
g_Video_Prepare = 0; Video_Prepare = 0;
g_Video_Shutdown = 0; Video_Shutdown = 0;
g_Video_SendFifoData = 0; Video_SendFifoData = 0;
g_Video_UpdateXFB = 0; Video_UpdateXFB = 0;
g_Video_AddMessage = 0; Video_AddMessage = 0;
g_Video_DoState = 0; Video_DoState = 0;
plugin.Unload(); plugin.Unload();
} }
@ -78,31 +64,30 @@ bool LoadPlugin(const char *_Filename)
{ {
if (plugin.Load(_Filename)) if (plugin.Load(_Filename))
{ {
g_GetDllInfo = reinterpret_cast<TGetDllInfo> (plugin.Get("GetDllInfo")); GetDllInfo = reinterpret_cast<TGetDllInfo> (plugin.Get("GetDllInfo"));
g_DllAbout = reinterpret_cast<TDllAbout> (plugin.Get("DllAbout")); DllAbout = reinterpret_cast<TDllAbout> (plugin.Get("DllAbout"));
g_DllConfig = reinterpret_cast<TDllConfig> (plugin.Get("DllConfig")); DllConfig = reinterpret_cast<TDllConfig> (plugin.Get("DllConfig"));
g_Video_Initialize = reinterpret_cast<TVideo_Initialize> (plugin.Get("Video_Initialize")); Video_Initialize = reinterpret_cast<TVideo_Initialize> (plugin.Get("Video_Initialize"));
g_Video_Prepare = reinterpret_cast<TVideo_Prepare> (plugin.Get("Video_Prepare")); Video_Prepare = reinterpret_cast<TVideo_Prepare> (plugin.Get("Video_Prepare"));
g_Video_Shutdown = reinterpret_cast<TVideo_Shutdown> (plugin.Get("Video_Shutdown")); Video_Shutdown = reinterpret_cast<TVideo_Shutdown> (plugin.Get("Video_Shutdown"));
g_Video_SendFifoData = reinterpret_cast<TVideo_SendFifoData> (plugin.Get("Video_SendFifoData")); Video_SendFifoData = reinterpret_cast<TVideo_SendFifoData> (plugin.Get("Video_SendFifoData"));
g_Video_UpdateXFB = reinterpret_cast<TVideo_UpdateXFB> (plugin.Get("Video_UpdateXFB")); Video_UpdateXFB = reinterpret_cast<TVideo_UpdateXFB> (plugin.Get("Video_UpdateXFB"));
g_Video_Screenshot = reinterpret_cast<TVideo_Screenshot> (plugin.Get("Video_Screenshot")); Video_Screenshot = reinterpret_cast<TVideo_Screenshot> (plugin.Get("Video_Screenshot"));
g_Video_EnterLoop = reinterpret_cast<TVideo_EnterLoop> (plugin.Get("Video_EnterLoop")); Video_EnterLoop = reinterpret_cast<TVideo_EnterLoop> (plugin.Get("Video_EnterLoop"));
g_Video_AddMessage = reinterpret_cast<TVideo_AddMessage> (plugin.Get("Video_AddMessage")); Video_AddMessage = reinterpret_cast<TVideo_AddMessage> (plugin.Get("Video_AddMessage"));
g_Video_DoState = reinterpret_cast<TVideo_DoState> (plugin.Get("Video_DoState")); Video_DoState = reinterpret_cast<TVideo_DoState> (plugin.Get("Video_DoState"));
if ((GetDllInfo != 0) &&
if ((g_GetDllInfo != 0) && (DllAbout != 0) &&
(g_DllAbout != 0) && (DllConfig != 0) &&
(g_DllConfig != 0) && (Video_Initialize != 0) &&
(g_Video_Initialize != 0) && (Video_Prepare != 0) &&
(g_Video_Prepare != 0) && (Video_Shutdown != 0) &&
(g_Video_Shutdown != 0) && (Video_SendFifoData != 0) &&
(g_Video_SendFifoData != 0) && (Video_UpdateXFB != 0) &&
(g_Video_UpdateXFB != 0) && (Video_EnterLoop != 0) &&
(g_Video_EnterLoop != 0) && (Video_Screenshot != 0) &&
(g_Video_Screenshot != 0) && (Video_AddMessage != 0) &&
(g_Video_AddMessage != 0) && (Video_DoState != 0) )
(g_Video_DoState != 0) )
{ {
return true; return true;
} }
@ -115,67 +100,5 @@ bool LoadPlugin(const char *_Filename)
return false; return false;
} }
//
// --- Plugin Functions ---
//
void GetDllInfo (PLUGIN_INFO* _PluginInfo) } // namespace
{
g_GetDllInfo(_PluginInfo);
}
void DllAbout (HWND _hParent)
{
g_DllAbout(_hParent);
}
void DllConfig (HWND _hParent)
{
g_DllConfig(_hParent);
}
void Video_Initialize(SVideoInitialize* _pVideoInitialize)
{
g_Video_Initialize(_pVideoInitialize);
}
void Video_Prepare()
{
g_Video_Prepare();
}
void Video_Shutdown()
{
g_Video_Shutdown();
}
void Video_SendFifoData(BYTE *_uData)
{
g_Video_SendFifoData(_uData);
}
void Video_UpdateXFB(BYTE* _pXFB, DWORD _dwHeight, DWORD _dwWidth)
{
g_Video_UpdateXFB(_pXFB, _dwHeight, _dwWidth);
}
bool Video_Screenshot(TCHAR* _szFilename)
{
return ((g_Video_Screenshot(_szFilename) == TRUE) ? true : false);
}
void Video_EnterLoop()
{
g_Video_EnterLoop();
}
void Video_AddMessage(const char* pstr, unsigned int milliseconds)
{
g_Video_AddMessage(pstr,milliseconds);
}
void Video_DoState(unsigned char **ptr, int mode) {
g_Video_DoState(ptr, mode);
}
} // end of namespace PluginVideo

View File

@ -28,23 +28,33 @@ bool IsLoaded();
bool LoadPlugin(const char *_Filename); bool LoadPlugin(const char *_Filename);
void UnloadPlugin(); void UnloadPlugin();
// // Function Types
// --- Plugin Functions --- typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*);
// typedef void (__cdecl* TDllAbout)(HWND);
typedef void (__cdecl* TDllConfig)(HWND);
typedef void (__cdecl* TVideo_Initialize)(SVideoInitialize*);
typedef void (__cdecl* TVideo_Prepare)();
typedef void (__cdecl* TVideo_Shutdown)();
typedef void (__cdecl* TVideo_SendFifoData)(BYTE*);
typedef void (__cdecl* TVideo_UpdateXFB)(BYTE*, DWORD, DWORD);
typedef BOOL (__cdecl* TVideo_Screenshot)(TCHAR*);
typedef void (__cdecl* TVideo_EnterLoop)();
typedef void (__cdecl* TVideo_AddMessage)(const char* pstr, unsigned int milliseconds);
typedef void (__cdecl* TVideo_DoState)(unsigned char **ptr, int mode);
void GetDllInfo(PLUGIN_INFO* _pluginInfo); // Function Pointers
void DllAbout(HWND _hParent); extern TGetDllInfo GetDllInfo;
void DllConfig(HWND _hParent); extern TDllAbout DllAbout;
void Video_Initialize(SVideoInitialize* _pvideoInitialize); extern TDllConfig DllConfig;
void Video_Prepare(); extern TVideo_Initialize Video_Initialize;
void Video_Shutdown(); extern TVideo_Prepare Video_Prepare;
void Video_EnterLoop(); extern TVideo_Shutdown Video_Shutdown;
void Video_SendFifoData(BYTE *_uData); extern TVideo_SendFifoData Video_SendFifoData;
void Video_UpdateXFB(BYTE* _pXFB, DWORD _dwHeight, DWORD _dwWidth); extern TVideo_UpdateXFB Video_UpdateXFB;
bool Video_Screenshot(TCHAR* _szFilename); extern TVideo_Screenshot Video_Screenshot;
void Video_AddMessage(const char* pstr, unsigned int milliseconds); extern TVideo_EnterLoop Video_EnterLoop;
extern TVideo_AddMessage Video_AddMessage;
void Video_DoState(unsigned char **ptr, int mode); extern TVideo_DoState Video_DoState;
} // end of namespace PluginVideo } // end of namespace PluginVideo

View File

@ -19,6 +19,7 @@
#include "State.h" #include "State.h"
#include "Core.h" #include "Core.h"
#include "StringUtil.h"
#include "CoreTiming.h" #include "CoreTiming.h"
#include "HW/HW.h" #include "HW/HW.h"
#include "PowerPC/PowerPC.h" #include "PowerPC/PowerPC.h"
@ -40,6 +41,7 @@ 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 // 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()); PluginVideo::Video_DoState(p.GetPPtr(), p.GetMode());
PluginDSP::DSP_DoState(p.GetPPtr(), p.GetMode());
PowerPC::DoState(p); PowerPC::DoState(p);
HW::DoState(p); HW::DoState(p);
CoreTiming::DoState(p); CoreTiming::DoState(p);
@ -99,14 +101,18 @@ void State_Shutdown()
// nothing to do, here for consistency. // nothing to do, here for consistency.
} }
std::string GetStateFilename(int state_number) {
return StringFromFormat("StateSaves/%s.s%02i", Core::GetStartupParameter().GetUniqueID().c_str(), state_number);
}
void State_Save(const char *filename) void State_Save(const char *filename)
{ {
cur_filename = filename; cur_filename = GetStateFilename(0);
CoreTiming::ScheduleEvent_Threadsafe(0, ev_Save); CoreTiming::ScheduleEvent_Threadsafe(0, ev_Save);
} }
void State_Load(const char *filename) void State_Load(const char *filename)
{ {
cur_filename = filename; cur_filename = GetStateFilename(0);
CoreTiming::ScheduleEvent_Threadsafe(0, ev_Load); CoreTiming::ScheduleEvent_Threadsafe(0, ev_Load);
} }

View File

@ -67,13 +67,9 @@ class PlainFileReader
CloseHandle(hFile); CloseHandle(hFile);
} }
u64 GetDataSize() const {return(size);} u64 GetDataSize() const {return(size);}
u64 GetRawSize() const {return(size);} u64 GetRawSize() const {return(size);}
bool Read(u64 offset, u64 size, u8* out_ptr) bool Read(u64 offset, u64 size, u8* out_ptr)
{ {
LONG offset_high = (LONG)(offset >> 32); LONG offset_high = (LONG)(offset >> 32);
@ -99,8 +95,7 @@ class PlainFileReader
#else // linux, 64-bit. We do not yet care about linux32 #else // linux, 64-bit. We do not yet care about linux32
// Not optimal - will keep recreating mappings. // Not optimal - will keep recreating mappings.
class PlainFileReader class PlainFileReader : public IBlobReader
: public IBlobReader
{ {
FILE* file_; FILE* file_;
s64 size; s64 size;
@ -157,8 +152,6 @@ class PlainFileReader
}; };
#endif #endif
class CompressedBlobReader class CompressedBlobReader
: public IBlobReader : public IBlobReader
{ {

View File

@ -135,7 +135,7 @@ struct DXTBlock
inline int expand8888(const int j) inline int expand8888(const int j)
{ {
int i = j | (j<<8); int i = j | (j<<8);
return i|(i<<16); return i | (i<<16);
} }
inline void decodebytesI4(u32 *dst, const u8 *src, int numbytes) inline void decodebytesI4(u32 *dst, const u8 *src, int numbytes)
@ -150,7 +150,8 @@ inline void decodebytesI4(u32 *dst, const u8 *src, int numbytes)
inline void decodebytesI8(u32 *dst, const u8 *src, int numbytes) inline void decodebytesI8(u32 *dst, const u8 *src, int numbytes)
{ {
for (int x = 0; x < numbytes; x++) // TODO: SSSE3 variant (pshufb), possibly SSE2 variant (packuswb). THP videos use this format.
for (int x = 0; x < numbytes; x++)
*dst++ = expand8888(src[x]); *dst++ = expand8888(src[x]);
} }

View File

@ -160,7 +160,7 @@ EXPORT void CALL DSP_SendAIBuffer(unsigned int address, int sample_rate);
// input/output: ptr // input/output: ptr
// input: mode // input: mode
// //
EXPORT void CALL PAD_DoState(void *ptr, int mode); EXPORT void CALL DSP_DoState(unsigned char **ptr, int mode);
#include "ExportEpilog.h" #include "ExportEpilog.h"
#endif #endif

View File

@ -17,6 +17,7 @@
#include "Common.h" #include "Common.h"
#include "Globals.h" #include "Globals.h"
#include "ChunkFile.h"
#include "resource.h" #include "resource.h"
#ifdef _WIN32 #ifdef _WIN32
@ -35,6 +36,29 @@
DSPInitialize g_dspInitialize; DSPInitialize g_dspInitialize;
u8* g_pMemory; u8* g_pMemory;
struct DSPState
{
u32 CPUMailbox;
bool CPUMailbox_Written[2];
u32 DSPMailbox;
bool DSPMailbox_Read[2];
DSPState()
{
CPUMailbox = 0x00000000;
CPUMailbox_Written[0] = false;
CPUMailbox_Written[1] = false;
DSPMailbox = 0x00000000;
DSPMailbox_Read[0] = true;
DSPMailbox_Read[1] = true;
}
};
DSPState g_dspState;
#ifdef _WIN32 #ifdef _WIN32
HINSTANCE g_hInstance = NULL; HINSTANCE g_hInstance = NULL;
@ -116,26 +140,9 @@ void DSP_Shutdown()
CDSPHandler::Destroy(); CDSPHandler::Destroy();
} }
struct DSPState void DSP_DoState(unsigned char **ptr, int mode) {
{ PointerWrap p(ptr, mode);
u32 CPUMailbox; }
bool CPUMailbox_Written[2];
u32 DSPMailbox;
bool DSPMailbox_Read[2];
DSPState()
{
CPUMailbox = 0x00000000;
CPUMailbox_Written[0] = false;
CPUMailbox_Written[1] = false;
DSPMailbox = 0x00000000;
DSPMailbox_Read[0] = true;
DSPMailbox_Read[1] = true;
}
};
DSPState g_dspState;
unsigned short DSP_ReadMailboxHigh(bool _CPUMailbox) unsigned short DSP_ReadMailboxHigh(bool _CPUMailbox)
{ {

View File

@ -20,6 +20,7 @@
#include "pluginspecs_dsp.h" #include "pluginspecs_dsp.h"
#include <stdio.h> #include <stdio.h>
#define WITH_DSP_ON_THREAD 1 #define WITH_DSP_ON_THREAD 1
#define DUMP_DSP_IMEM 0 #define DUMP_DSP_IMEM 0

View File

@ -41,6 +41,8 @@ CDisAsmDlg g_Dialog;
pthread_t g_hDSPThread = NULL; pthread_t g_hDSPThread = NULL;
#endif #endif
#include "ChunkFile.h"
DSPInitialize g_dspInitialize; DSPInitialize g_dspInitialize;
#define GDSP_MBOX_CPU 0 #define GDSP_MBOX_CPU 0

View File

@ -190,11 +190,3 @@ void PAD_GetStatus(BYTE _numPAD, SPADStatus* _pPADStatus)
void PAD_Rumble(BYTE _numPAD, unsigned int _uType, unsigned int _uStrength) void PAD_Rumble(BYTE _numPAD, unsigned int _uType, unsigned int _uStrength)
{ {
} }
// __________________________________________________________________________________________________
// SaveLoadState
//
unsigned __int32 SaveLoadState(char* _ptr, BOOL _bSave)
{
return 0;
}

View File

@ -598,13 +598,6 @@ void PAD_Rumble(BYTE _numPAD, unsigned int _uType, unsigned int _uStrength)
#endif #endif
} }
unsigned int SaveLoadState(char* _ptr, BOOL _bSave)
{
return(0);
}
void LoadConfig() void LoadConfig()
{ {
#ifdef _WIN32 #ifdef _WIN32

View File

@ -526,13 +526,13 @@ void BPWritten(int addr, int changes, int newval)
CVertexHandler::Flush(); CVertexHandler::Flush();
((u32*)&bpmem)[addr] = newval; ((u32*)&bpmem)[addr] = newval;
static int lastRGBA[2][4] = { static int lastRGBA[2][4] = {
{0xEEEEEEEE,0xEEEEEEEE,0xEEEEEEEE,0xEEEEEEEE}, {0xEEEEEEEE, 0xEEEEEEEE, 0xEEEEEEEE, 0xEEEEEEEE},
{0xEEEEEEEE,0xEEEEEEEE,0xEEEEEEEE,0xEEEEEEEE} {0xEEEEEEEE, 0xEEEEEEEE, 0xEEEEEEEE, 0xEEEEEEEE}
}; };
//Terrible hack //Terrible hack
//The reason is that there are two sets of registers //The reason is that there are two sets of registers
//overloaded here... //overloaded here...
int num=(addr>>1)&0x3; int num = (addr >> 1) & 0x3;
int type = bpmem.tevregs[num].high.type; int type = bpmem.tevregs[num].high.type;
int colorbase = type ? PS_CONST_KCOLORS : PS_CONST_COLORS; int colorbase = type ? PS_CONST_KCOLORS : PS_CONST_COLORS;
int r=bpmem.tevregs[num].low.a, a=bpmem.tevregs[num].low.b; int r=bpmem.tevregs[num].low.a, a=bpmem.tevregs[num].low.b;
@ -543,9 +543,9 @@ void BPWritten(int addr, int changes, int newval)
CVertexHandler::Flush(); CVertexHandler::Flush();
lastRGBA[type][num] = rgba; lastRGBA[type][num] = rgba;
float temp[4] = { float temp[4] = {
r/255.0f,g/255.0f,b/255.0f,a/255.0f r/255.0f, g/255.0f, b/255.0f, a/255.0f
}; };
D3D::dev->SetPixelShaderConstantF(colorbase+num,temp,1); D3D::dev->SetPixelShaderConstantF(colorbase + num, temp, 1);
} }
} }
} }
@ -726,21 +726,6 @@ void BPReload()
BPWritten(i, 0xFFFFFF, ((u32*)&bpmem)[i]); BPWritten(i, 0xFFFFFF, ((u32*)&bpmem)[i]);
} }
size_t BPSaveLoadState(char *ptr, BOOL save)
{
/*
BEGINSAVELOAD;
SAVELOAD(&bpmem,sizeof(BPMemory));
if (!save)
BPReload();
char temp[256];
sprintf(temp,"MOJS %08x",(bpmem.clearcolorAR<<16)|(bpmem.clearcolorGB));
g_VideoInitialize.pLog(temp, FALSE);
ENDSAVELOAD;*/
return 0;
}
void ActivateTextures() void ActivateTextures()
{ {
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)

View File

@ -6,7 +6,6 @@
#include "BPMemory.h" #include "BPMemory.h"
void BPInit(); void BPInit();
size_t BPSaveLoadState(char *ptr, BOOL save);
//bool BPWritten(int addr, int changes); //bool BPWritten(int addr, int changes);
void LoadBPReg(u32 value0); void LoadBPReg(u32 value0);
void ActivateTextures(); void ActivateTextures();

View File

@ -53,23 +53,3 @@ void LoadCPReg(u32 SubCmd, u32 Value)
case 0xB0: arraystrides[SubCmd & 0xF] = Value & 0xFF; break; case 0xB0: arraystrides[SubCmd & 0xF] = Value & 0xFF; break;
} }
} }
#define BEGINSAVELOAD char *optr=ptr;
#define SAVELOAD(what,size) memcpy((void*)((save)?(void*)(ptr):(void*)(what)),(void*)((save)?(void*)(what):(void*)(ptr)),(size)); ptr+=(size);
#define ENDSAVELOAD return ptr-optr;
size_t CPSaveLoadState(char *ptr, BOOL save)
{
BEGINSAVELOAD;
SAVELOAD(arraybases, 16 * sizeof(u32));
SAVELOAD(arraystrides, 16 * sizeof(u32));
SAVELOAD(&MatrixIndexA, sizeof(TMatrixIndexA));
SAVELOAD(&MatrixIndexB, sizeof(TMatrixIndexB));
if (!save)
{
CPUpdateMatricesA();
CPUpdateMatricesB();
}
ENDSAVELOAD;
}

View File

@ -7,7 +7,6 @@
void CPUpdateMatricesA(); void CPUpdateMatricesA();
void CPUpdateMatricesB(); void CPUpdateMatricesB();
size_t CPSaveLoadState(char *ptr, BOOL save);
void LoadCPReg(u32 SubCmd, u32 Value); void LoadCPReg(u32 SubCmd, u32 Value);
#endif #endif

View File

@ -51,42 +51,44 @@ extern Config g_Config;
struct Statistics struct Statistics
{ {
int numPrimitives; int numPrimitives;
int numPixelShadersCreated; int numPixelShadersCreated;
int numPixelShadersAlive; int numPixelShadersAlive;
int numVertexShadersCreated; int numVertexShadersCreated;
int numVertexShadersAlive; int numVertexShadersAlive;
int numTexturesCreated; int numTexturesCreated;
int numTexturesAlive; int numTexturesAlive;
int numRenderTargetsCreated; int numRenderTargetsCreated;
int numRenderTargetsAlive; int numRenderTargetsAlive;
int numDListsCalled; int numDListsCalled;
int numDListsCreated; int numDListsCreated;
int numDListsAlive; int numDListsAlive;
int numJoins; int numJoins;
struct ThisFrame struct ThisFrame
{ {
int numBPLoads; int numBPLoads;
int numCPLoads; int numCPLoads;
int numXFLoads; int numXFLoads;
int numBPLoadsInDL; int numBPLoadsInDL;
int numCPLoadsInDL; int numCPLoadsInDL;
int numXFLoadsInDL; int numXFLoadsInDL;
int numDLs; int numDLs;
int numDLPrims; int numDLPrims;
int numPrims; int numPrims;
int numShaderChanges; int numShaderChanges;
int numBadCommands; //hope this always is zero ;) int numBadCommands; //hope this always is zero ;)
};
ThisFrame thisFrame; int numDListsCalled;
};
ThisFrame thisFrame;
void ResetFrame() {memset(&thisFrame,0,sizeof(ThisFrame));} void ResetFrame() {memset(&thisFrame,0,sizeof(ThisFrame));}
}; };

View File

@ -55,23 +55,24 @@ void ExecuteDisplayList(u32 address, u32 size)
g_pDataReader = &memoryReader; g_pDataReader = &memoryReader;
// temporarily swap dl and non-dl(small "hack" for the stats) // temporarily swap dl and non-dl(small "hack" for the stats)
Xchg(stats.thisFrame.numDLPrims,stats.thisFrame.numPrims); Xchg(stats.thisFrame.numDLPrims, stats.thisFrame.numPrims);
Xchg(stats.thisFrame.numXFLoadsInDL,stats.thisFrame.numXFLoads); Xchg(stats.thisFrame.numXFLoadsInDL, stats.thisFrame.numXFLoads);
Xchg(stats.thisFrame.numCPLoadsInDL,stats.thisFrame.numCPLoads); Xchg(stats.thisFrame.numCPLoadsInDL, stats.thisFrame.numCPLoads);
Xchg(stats.thisFrame.numBPLoadsInDL,stats.thisFrame.numBPLoads); Xchg(stats.thisFrame.numBPLoadsInDL, stats.thisFrame.numBPLoads);
while((memoryReader.GetReadAddress() - address) < size) while((memoryReader.GetReadAddress() - address) < size)
{ {
Decode(); Decode();
} }
INCSTAT(stats.numDListsCalled);
INCSTAT(stats.thisFrame.numDListsCalled);
// un-swap // un-swap
Xchg(stats.thisFrame.numDLPrims,stats.thisFrame.numPrims); Xchg(stats.thisFrame.numDLPrims, stats.thisFrame.numPrims);
Xchg(stats.thisFrame.numXFLoadsInDL,stats.thisFrame.numXFLoads); Xchg(stats.thisFrame.numXFLoadsInDL, stats.thisFrame.numXFLoads);
Xchg(stats.thisFrame.numCPLoadsInDL,stats.thisFrame.numCPLoads); Xchg(stats.thisFrame.numCPLoadsInDL, stats.thisFrame.numCPLoads);
Xchg(stats.thisFrame.numBPLoadsInDL,stats.thisFrame.numBPLoads); Xchg(stats.thisFrame.numBPLoadsInDL, stats.thisFrame.numBPLoads);
INCSTAT(stats.numDListsCalled);
// reset to the old reader // reset to the old reader
g_pDataReader = pOldReader; g_pDataReader = pOldReader;
} }

View File

@ -16,15 +16,6 @@ float *CTransformEngine::m_pNormalMatrix;
float *CTransformEngine::m_pTexMatrix[8]; float *CTransformEngine::m_pTexMatrix[8];
float *CTransformEngine::m_pTexPostMatrix[8]; float *CTransformEngine::m_pTexPostMatrix[8];
size_t CTransformEngine::SaveLoadState(char *ptr, bool save)
{
// BEGINSAVELOAD;
// SAVELOAD(m_VtxAttribTable,sizeof(m_VtxAttribTable));
// SAVELOAD(&m_VtxDesc,sizeof(TVtxDesc));
// ENDSAVELOAD;
return 0;
}
const Light *GetLight(int i) const Light *GetLight(int i)
{ {
return (const Light *)(xfmem + XFMEM_LIGHTS) + i; return (const Light *)(xfmem + XFMEM_LIGHTS) + i;
@ -345,4 +336,4 @@ void CTransformEngine::TransformVertices(int _numVertices, const DecodedVArray *
vbuffer[i].uv[j].w = TempUVs[j].z; vbuffer[i].uv[j].w = TempUVs[j].z;
} }
} }
} }

View File

@ -16,7 +16,6 @@ class CTransformEngine
static float* m_pTexPostMatrix[8]; static float* m_pTexPostMatrix[8];
public: public:
static size_t SaveLoadState(char *ptr, bool save);
static void TransformVertices(int _numVertices, static void TransformVertices(int _numVertices,
const DecodedVArray *varray, const DecodedVArray *varray,
D3DVertex *vbuffer); D3DVertex *vbuffer);

View File

@ -8,13 +8,7 @@
float rawViewPort[6]; float rawViewPort[6];
float rawProjection[7]; float rawProjection[7];
#define BEGINSAVELOAD char *optr=ptr;
#define SAVELOAD(what,size) memcpy((void*)((save)?(void*)(ptr):(void*)(what)),(void*)((save)?(void*)(what):(void*)(ptr)),(size)); ptr+=(size);
#define ENDSAVELOAD return ptr-optr;
// __________________________________________________________________________________________________
// LoadXFReg 0x10 // LoadXFReg 0x10
//
void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData) void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData)
{ {
DVSTARTPROFILE(); DVSTARTPROFILE();
@ -30,7 +24,7 @@ void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData)
memcpy(p1, &pData[i], transferSize*4); memcpy(p1, &pData[i], transferSize*4);
i += transferSize; i += transferSize;
} }
else if (address<0x2000) else if (address < 0x2000)
{ {
u32 data = pData[i]; u32 data = pData[i];
switch (address) switch (address)
@ -120,25 +114,8 @@ void XFUpdateVP()
{ {
Renderer::SetViewport(rawViewPort); Renderer::SetViewport(rawViewPort);
} }
void XFUpdatePJ() void XFUpdatePJ()
{ {
Renderer::SetProjection(rawProjection,0); Renderer::SetProjection(rawProjection, 0);
} }
size_t XFSaveLoadState(char *ptr, BOOL save)
{
BEGINSAVELOAD;
SAVELOAD(xfregs.colChans,2*sizeof(ColorChannel));
SAVELOAD(xfregs.texcoords,16*sizeof(TexCoordInfo));
SAVELOAD(rawViewPort,sizeof(rawViewPort));
SAVELOAD(rawProjection,sizeof(rawProjection));
SAVELOAD(xfmem,XFMEM_SIZE*sizeof(u32));
if (!save)
{
XFUpdateVP();
XFUpdatePJ();
}
ENDSAVELOAD;
}

View File

@ -8,7 +8,6 @@
extern float rawViewPort[6]; extern float rawViewPort[6];
extern float rawProjection[7]; extern float rawProjection[7];
size_t XFSaveLoadState(char *ptr, BOOL save);
void XFUpdateVP(); void XFUpdateVP();
void XFUpdatePJ(); void XFUpdatePJ();
void LoadXFReg(u32 transferSize, u32 address, u32 *pData); void LoadXFReg(u32 transferSize, u32 address, u32 *pData);

View File

@ -719,16 +719,3 @@ void BPReload()
for (int i=0; i<254; i++) for (int i=0; i<254; i++)
BPWritten(i, 0xFFFFFF, ((u32*)&bpmem)[i]); BPWritten(i, 0xFFFFFF, ((u32*)&bpmem)[i]);
} }
size_t BPSaveLoadState(char *ptr, BOOL save)
{
BEGINSAVELOAD;
SAVELOAD(&bpmem,sizeof(BPMemory));
if (!save)
BPReload();
//char temp[256];
//sprintf(temp,"MOJS %08x",(bpmem.clearcolorAR<<16)|(bpmem.clearcolorGB));
//g_VideoInitialize.pLog(temp, FALSE);
ENDSAVELOAD;
}

View File

@ -21,7 +21,6 @@
#include "BPMemory.h" #include "BPMemory.h"
void BPInit(); void BPInit();
size_t BPSaveLoadState(char *ptr, BOOL save);
//bool BPWritten(int addr, int changes); //bool BPWritten(int addr, int changes);
void LoadBPReg(u32 value0); void LoadBPReg(u32 value0);

View File

@ -111,10 +111,6 @@ extern float MValueX, MValueY;
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#endif #endif
#define BEGINSAVELOAD char *optr=ptr;
#define SAVELOAD(what,size) memcpy((void*)((save)?(void*)(ptr):(void*)(what)),(void*)((save)?(void*)(what):(void*)(ptr)),(size)); ptr+=(size);
#define ENDSAVELOAD return ptr-optr;
extern int frameCount; extern int frameCount;
#define CONF_LOG 1 #define CONF_LOG 1

View File

@ -60,10 +60,10 @@ void ExecuteDisplayList(u32 address, u32 size)
g_pDataReader = &memoryReader; g_pDataReader = &memoryReader;
// temporarily swap dl and non-dl(small "hack" for the stats) // temporarily swap dl and non-dl(small "hack" for the stats)
Xchg(stats.thisFrame.numDLPrims,stats.thisFrame.numPrims); Xchg(stats.thisFrame.numDLPrims, stats.thisFrame.numPrims);
Xchg(stats.thisFrame.numXFLoadsInDL,stats.thisFrame.numXFLoads); Xchg(stats.thisFrame.numXFLoadsInDL, stats.thisFrame.numXFLoads);
Xchg(stats.thisFrame.numCPLoadsInDL,stats.thisFrame.numCPLoads); Xchg(stats.thisFrame.numCPLoadsInDL, stats.thisFrame.numCPLoads);
Xchg(stats.thisFrame.numBPLoadsInDL,stats.thisFrame.numBPLoads); Xchg(stats.thisFrame.numBPLoadsInDL, stats.thisFrame.numBPLoads);
while((memoryReader.GetReadAddress() - address) < size) while((memoryReader.GetReadAddress() - address) < size)
{ {
@ -73,10 +73,10 @@ void ExecuteDisplayList(u32 address, u32 size)
INCSTAT(stats.thisFrame.numDListsCalled); INCSTAT(stats.thisFrame.numDListsCalled);
// un-swap // un-swap
Xchg(stats.thisFrame.numDLPrims,stats.thisFrame.numPrims); Xchg(stats.thisFrame.numDLPrims, stats.thisFrame.numPrims);
Xchg(stats.thisFrame.numXFLoadsInDL,stats.thisFrame.numXFLoads); Xchg(stats.thisFrame.numXFLoadsInDL, stats.thisFrame.numXFLoads);
Xchg(stats.thisFrame.numCPLoadsInDL,stats.thisFrame.numCPLoads); Xchg(stats.thisFrame.numCPLoadsInDL, stats.thisFrame.numCPLoads);
Xchg(stats.thisFrame.numBPLoadsInDL,stats.thisFrame.numBPLoads); Xchg(stats.thisFrame.numBPLoadsInDL, stats.thisFrame.numBPLoads);
// reset to the old reader // reset to the old reader
g_pDataReader = pOldReader; g_pDataReader = pOldReader;

View File

@ -1151,12 +1151,3 @@ void VertexManager::LoadCPReg(u32 SubCmd, u32 Value)
case 0xB0: arraystrides[SubCmd & 0xF] = Value & 0xFF; break; case 0xB0: arraystrides[SubCmd & 0xF] = Value & 0xFF; break;
} }
} }
size_t VertexManager::SaveLoadState(char *ptr, BOOL save)
{
BEGINSAVELOAD;
SAVELOAD(arraybases,16*sizeof(u32));
SAVELOAD(arraystrides,16*sizeof(u32));
ENDSAVELOAD;
}

View File

@ -213,7 +213,6 @@ public:
static TVtxDesc &GetVtxDesc() {return s_GlobalVtxDesc; } static TVtxDesc &GetVtxDesc() {return s_GlobalVtxDesc; }
static void LoadCPReg(u32 SubCmd, u32 Value); static void LoadCPReg(u32 SubCmd, u32 Value);
static size_t SaveLoadState(char *ptr, BOOL save);
static u8* s_pCurBufferPointer; static u8* s_pCurBufferPointer;
static float shiftLookup[32]; static float shiftLookup[32];

View File

@ -496,25 +496,6 @@ void VertexShaderMngr::SetProjection(float* _pProjection, int constantIndex)
bProjectionChanged = true; bProjectionChanged = true;
} }
size_t VertexShaderMngr::SaveLoadState(char *ptr, BOOL save)
{
BEGINSAVELOAD;
SAVELOAD(&xfregs,sizeof(xfregs));
SAVELOAD(xfmem,XFMEM_SIZE*sizeof(u32));
SAVELOAD(rawViewport,sizeof(rawViewport));
SAVELOAD(rawProjection,sizeof(rawProjection));
SAVELOAD(&MatrixIndexA,sizeof(TMatrixIndexA));
SAVELOAD(&MatrixIndexB,sizeof(TMatrixIndexB));
if (!save) {
// invalidate all
InvalidateXFRange(0,0x1000);
}
ENDSAVELOAD;
}
// LoadXFReg 0x10 // LoadXFReg 0x10
void VertexShaderMngr::LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData) void VertexShaderMngr::LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData)
{ {

View File

@ -119,7 +119,6 @@ public:
static void SetTexMatrixChangedA(u32 Value); static void SetTexMatrixChangedA(u32 Value);
static void SetTexMatrixChangedB(u32 Value); static void SetTexMatrixChangedB(u32 Value);
static size_t SaveLoadState(char *ptr, BOOL save);
static void LoadXFReg(u32 transferSize, u32 address, u32 *pData); static void LoadXFReg(u32 transferSize, u32 address, u32 *pData);
static void LoadIndexedXF(u32 val, int array); static void LoadIndexedXF(u32 val, int array);