mirror of https://github.com/PCSX2/pcsx2.git
Save States: Added PADfreeze calls to PCSX2, though they're currently only implemented by LilyPad. Also fixed a bug where a save state would failed to load when the last plugin's freeze function actually saved something. Minor changes to new plugin API as well.
Because of a convenient bug in load state function, older save states with no saved pad info should still work. Don't blame me if they don't, though. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@791 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
493ecaa206
commit
0efde91a92
|
@ -5,12 +5,12 @@
|
|||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
Notes:
|
||||
Notes:
|
||||
* Since this is still beta things may change.
|
||||
|
||||
* OSflags:
|
||||
|
@ -41,7 +41,7 @@
|
|||
* reserved keys:
|
||||
F1 to F10 are reserved for the emulator
|
||||
|
||||
* plugins should NOT change the current
|
||||
* plugins should NOT change the current
|
||||
working directory.
|
||||
(on win32, add flag OFN_NOCHANGEDIR for
|
||||
GetOpenFileName)
|
||||
|
@ -548,6 +548,7 @@ typedef void (CALLBACK* _PADgsDriverInfo)(GSdriverInfo *info);
|
|||
typedef void (CALLBACK* _PADconfigure)();
|
||||
typedef s32 (CALLBACK* _PADtest)();
|
||||
typedef void (CALLBACK* _PADabout)();
|
||||
typedef int (CALLBACK* _PADfreeze)(int mode, freezeData *data);
|
||||
|
||||
// SIO
|
||||
typedef s32 (CALLBACK* _SIOinit)(u32 port, u32 slot, SIOchangeSlotCB f);
|
||||
|
@ -732,6 +733,7 @@ extern _PADgsDriverInfo PAD1gsDriverInfo;
|
|||
extern _PADconfigure PAD1configure;
|
||||
extern _PADtest PAD1test;
|
||||
extern _PADabout PAD1about;
|
||||
extern _PADfreeze PAD1freeze;
|
||||
|
||||
// PAD2
|
||||
extern _PADinit PAD2init;
|
||||
|
@ -748,6 +750,7 @@ extern _PADgsDriverInfo PAD2gsDriverInfo;
|
|||
extern _PADconfigure PAD2configure;
|
||||
extern _PADtest PAD2test;
|
||||
extern _PADabout PAD2about;
|
||||
extern _PADfreeze PAD2freeze;
|
||||
|
||||
// SIO[2]
|
||||
extern _SIOinit SIOinit[2][9];
|
||||
|
|
|
@ -15,18 +15,18 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef __PLUGINCALLBACKS_H__
|
||||
#define __PLUGINCALLBACKS_H__
|
||||
|
||||
extern "C"
|
||||
{
|
||||
extern "C"
|
||||
{
|
||||
// General
|
||||
typedef u32 (CALLBACK* _PS2EgetLibType)(void);
|
||||
typedef u32 (CALLBACK* _PS2EgetLibVersion2)(u32 type);
|
||||
typedef char*(CALLBACK* _PS2EgetLibName)(void);
|
||||
typedef void (CALLBACK* _PS2EpassConfig)(PcsxConfig Config);
|
||||
typedef void (CALLBACK* _PS2EpassConfig)(PcsxConfig *Config);
|
||||
|
||||
// GS
|
||||
// NOTE: GSreadFIFOX/GSwriteCSR functions CANNOT use XMM/MMX regs
|
||||
|
@ -224,7 +224,7 @@ typedef void (CALLBACK* _FWconfigure)();
|
|||
typedef s32 (CALLBACK* _FWtest)();
|
||||
typedef void (CALLBACK* _FWabout)();
|
||||
|
||||
// General
|
||||
// General
|
||||
extern _PS2EgetLibType PS2EgetLibType;
|
||||
extern _PS2EgetLibVersion2 PS2EgetLibVersion2;
|
||||
extern _PS2EgetLibName PS2EgetLibName;
|
||||
|
@ -276,7 +276,7 @@ extern _PADpoll PAD1poll;
|
|||
extern _PADquery PAD1query;
|
||||
extern _PADupdate PAD1update;
|
||||
|
||||
extern _PADfreeze PAD1freeze;
|
||||
extern _PADfreeze PAD1freeze;
|
||||
extern _PADgsDriverInfo PAD1gsDriverInfo;
|
||||
extern _PADconfigure PAD1configure;
|
||||
extern _PADtest PAD1test;
|
||||
|
@ -293,7 +293,7 @@ extern _PADpoll PAD2poll;
|
|||
extern _PADquery PAD2query;
|
||||
extern _PADupdate PAD2update;
|
||||
|
||||
extern _PADfreeze PAD2freeze;
|
||||
extern _PADfreeze PAD2freeze;
|
||||
extern _PADgsDriverInfo PAD2gsDriverInfo;
|
||||
extern _PADconfigure PAD2configure;
|
||||
extern _PADtest PAD2test;
|
||||
|
@ -307,9 +307,9 @@ extern _SIOshutdown SIOshutdown[2][9];
|
|||
extern _SIOstartPoll SIOstartPoll[2][9];
|
||||
extern _SIOpoll SIOpoll[2][9];
|
||||
extern _SIOquery SIOquery[2][9];
|
||||
extern _SIOkeyEvent SIOkeyEvent;
|
||||
extern _SIOkeyEvent SIOkeyEvent;
|
||||
|
||||
extern _SIOfreeze SIOfreeze[2][9];
|
||||
extern _SIOfreeze SIOfreeze[2][9];
|
||||
extern _SIOconfigure SIOconfigure[2][9];
|
||||
extern _SIOtest SIOtest[2][9];
|
||||
extern _SIOabout SIOabout[2][9];
|
||||
|
|
|
@ -35,8 +35,10 @@
|
|||
|
||||
// Called by SIO_TYPE_MTAP plugins to change the slot.
|
||||
// Slot is then passed to memcard and pad plugins on SIOstartPoll.
|
||||
// MTAP SIO plugins should ignore slot vvalues on startPoll, as should RMs (probably).
|
||||
typedef int (CALLBACK * SIOchangeSlotCB)(int slot);
|
||||
// MTAP SIO plugins should ignore slot values on startPoll, as should RMs (probably).
|
||||
|
||||
// Port isn't strictly necessary, but doesn't hurt.
|
||||
typedef int (CALLBACK * SIOchangeSlotCB)(int port, int slot);
|
||||
|
||||
// Basic functions.
|
||||
|
||||
|
@ -67,7 +69,10 @@ EXPORT_C_(u32) SIOquery();
|
|||
|
||||
EXPORT_C_(void) SIOconfigure();
|
||||
EXPORT_C_(keyEvent*) CALLBACK SIOkeyEvent();
|
||||
EXPORT_C_(s32) SIOfreeze(u8 mode, freezeData *data);
|
||||
|
||||
// Save one type at a time. If a plugin supports all 4 types,
|
||||
// should expect 4 calls. Increases savestate compatibility.
|
||||
EXPORT_C_(s32) SIOfreeze(u8 mode, freezeData *data, int type);
|
||||
EXPORT_C_(void) SIOabout();
|
||||
EXPORT_C_(s32) SIOtest();
|
||||
|
||||
|
@ -78,6 +83,4 @@ SIO_TYPE_RM = 0x00000040,
|
|||
SIO_TYPE_MC = 0x00000100
|
||||
} SioTypes;
|
||||
|
||||
#endif
|
||||
|
||||
#endif // __SIOAPI_H__
|
|
@ -71,6 +71,7 @@ _PADgsDriverInfo PAD1gsDriverInfo;
|
|||
_PADconfigure PAD1configure;
|
||||
_PADtest PAD1test;
|
||||
_PADabout PAD1about;
|
||||
_PADfreeze PAD1freeze;
|
||||
|
||||
// PAD2
|
||||
_PADinit PAD2init;
|
||||
|
@ -87,6 +88,7 @@ _PADgsDriverInfo PAD2gsDriverInfo;
|
|||
_PADconfigure PAD2configure;
|
||||
_PADtest PAD2test;
|
||||
_PADabout PAD2about;
|
||||
_PADfreeze PAD2freeze;
|
||||
|
||||
// SIO[2]
|
||||
_SIOinit SIOinit[2][9];
|
||||
|
@ -330,6 +332,7 @@ void *PAD1plugin;
|
|||
void CALLBACK PAD1_configure() {}
|
||||
void CALLBACK PAD1_about() {}
|
||||
s32 CALLBACK PAD1_test() { return 0; }
|
||||
s32 CALLBACK PAD1_freeze(int mode, freezeData *data) { data->size = 0; return 0; }
|
||||
|
||||
int LoadPAD1plugin(const string& filename) {
|
||||
void *drv;
|
||||
|
@ -352,6 +355,7 @@ int LoadPAD1plugin(const string& filename) {
|
|||
MapSymbolPAD_Fallback(PAD1,PAD,configure);
|
||||
MapSymbolPAD_Fallback(PAD1,PAD,about);
|
||||
MapSymbolPAD_Fallback(PAD1,PAD,test);
|
||||
MapSymbolPAD_Fallback(PAD1,PAD,freeze);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -361,6 +365,7 @@ void *PAD2plugin;
|
|||
void CALLBACK PAD2_configure() {}
|
||||
void CALLBACK PAD2_about() {}
|
||||
s32 CALLBACK PAD2_test() { return 0; }
|
||||
s32 CALLBACK PAD2_freeze(int mode, freezeData *data) { data->size = 0; return 0; }
|
||||
|
||||
int LoadPAD2plugin(const string& filename) {
|
||||
void *drv;
|
||||
|
@ -383,6 +388,7 @@ int LoadPAD2plugin(const string& filename) {
|
|||
MapSymbolPAD_Fallback(PAD2,PAD,configure);
|
||||
MapSymbolPAD_Fallback(PAD2,PAD,about);
|
||||
MapSymbolPAD_Fallback(PAD2,PAD,test);
|
||||
MapSymbolPAD_Fallback(PAD2,PAD,freeze);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -139,6 +139,8 @@ void SaveState::FreezeAll()
|
|||
FreezePlugin( "SPU2", SPU2freeze );
|
||||
FreezePlugin( "DEV9", DEV9freeze );
|
||||
FreezePlugin( "USB", USBfreeze );
|
||||
FreezePlugin( "PAD1", PAD1freeze );
|
||||
FreezePlugin( "PAD2", PAD2freeze );
|
||||
|
||||
if( IsLoading() )
|
||||
PostLoadPrep();
|
||||
|
@ -267,9 +269,9 @@ void gzLoadingState::FreezePlugin( const char* name, s32 (CALLBACK *freezer)(int
|
|||
fP.data = (s8*)malloc(fP.size);
|
||||
if (fP.data == NULL)
|
||||
throw Exception::OutOfMemory();
|
||||
gzread(m_file, fP.data, fP.size);
|
||||
int read = gzread(m_file, fP.data, fP.size);
|
||||
|
||||
if( gzeof( m_file ) )
|
||||
if( read != fP.size )
|
||||
throw Exception::BadSavedState( m_filename );
|
||||
|
||||
if(freezer(FREEZE_LOAD, &fP) == -1)
|
||||
|
|
Loading…
Reference in New Issue