Null pointer protection and warning in LilyPad and SPU2-X savestates and a small init fix in SPU2-X.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5112 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
ramapcsx2 2012-02-29 14:51:55 +00:00
parent be4b7b1768
commit 52a54fda62
3 changed files with 21 additions and 4 deletions

View File

@ -1428,7 +1428,13 @@ struct PadPluginFreezeData {
};
s32 CALLBACK PADfreeze(int mode, freezeData *data) {
if (mode == FREEZE_SIZE) {
if (!data)
{
printf("LilyPad savestate null pointer!\n");
return -1;
}
if (mode == FREEZE_SIZE) {
data->size = sizeof(PadPluginFreezeData);
}
else if (mode == FREEZE_LOAD) {

View File

@ -656,6 +656,13 @@ EXPORT_C_(int) SPU2setupRecording(int start, void* pData)
EXPORT_C_(s32) SPU2freeze(int mode, freezeData *data)
{
jASSUME( data != NULL );
if ( !data )
{
printf("SPU2-X savestate null pointer!\n");
return -1;
}
if( mode == FREEZE_SIZE )
{
data->size = Savestate::SizeIt();
@ -663,9 +670,13 @@ EXPORT_C_(s32) SPU2freeze(int mode, freezeData *data)
}
jASSUME( mode == FREEZE_LOAD || mode == FREEZE_SAVE );
jASSUME( data != NULL );
if( data->data == NULL ) return -1;
if( data->data == NULL )
{
printf("SPU2-X savestate null pointer!\n");
return -1;
}
Savestate::DataBlock& spud = (Savestate::DataBlock&)*(data->data);
switch( mode )

View File

@ -134,7 +134,7 @@ void V_Core::Init( int index )
if (!c)
{
WetGate.ExtL = 0;
WetGate.ExtL = 0;
WetGate.ExtR = 0;
}
Regs.MMIX = c ? 0xFFC : 0xFF0; // PS2 confirmed (f3c and f30 after BIOS ran, ffc and ff0 after sdinit)