Fixed compile errors generated on Release to Public builds in the last revision.

Fixed some instabilities in the Close GS on Escape feature when also using MTGS.

git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@562 a6443dda-0b58-4228-96e9-037be469359c
This commit is contained in:
Jake.Stine 2009-01-08 01:07:44 +00:00 committed by Gregory Hainaut
parent d6d781522f
commit 41524a03f6
8 changed files with 44 additions and 24 deletions

View File

@ -134,8 +134,7 @@ enum GS_RINGTYPE
, GS_RINGTYPE_MEMWRITE16
, GS_RINGTYPE_MEMWRITE32
, GS_RINGTYPE_MEMWRITE64
, GS_RINGTYPE_SAVE
, GS_RINGTYPE_LOAD
, GS_RINGTYPE_FREEZE
, GS_RINGTYPE_RECORD
, GS_RINGTYPE_RESET // issues a GSreset() command.
, GS_RINGTYPE_SOFTRESET // issues a soft reset for the GIF

View File

@ -526,11 +526,12 @@ int mtgsThreadObject::Callback()
*(u64*)(m_gsMem+*(u32*)(m_RingPos+4)) = *(u64*)(m_RingPos+8);
break;
case GS_RINGTYPE_SAVE:
case GS_RINGTYPE_LOAD:
case GS_RINGTYPE_FREEZE:
{
SaveState* f = (SaveState*)(*(uptr*)(m_RingPos+8));
f->FreezePlugin( "GS", GSfreeze );
//SaveState* f = (SaveState*)(*(uptr*)(m_RingPos+8));
freezeData* data = (freezeData*)(*(uptr*)(m_RingPos+8));
int mode = *(s32*)(m_RingPos+4);
GSfreeze( mode, data );
break;
}

View File

@ -434,7 +434,7 @@ void LoadGSState(const string& file)
f->Freeze(g_nLeftGSFrames);
f->gsFreeze();
f->FreezePlugin( "GS", GSfreeze );
f->FreezePlugin( "GS", gsSafeFreeze );
RunGSState( *f );

View File

@ -86,6 +86,25 @@ SaveState::SaveState( const char* msg, const string& destination ) : m_version(
Console::WriteLn( "%s %S", params msg, &destination );
}
s32 CALLBACK gsSafeFreeze( int mode, freezeData *data )
{
if( mtgsThread != NULL )
{
if( mode == 2 )
return GSfreeze( 2, data );
// have to call in thread, otherwise weird stuff will start happening
mtgsThread->SendPointerPacket( GS_RINGTYPE_FREEZE, mode, data );
mtgsWaitGS();
return 0;
}
else
{
// Single threaded...
return GSfreeze( mode, data );
}
}
void SaveState::FreezeAll()
{
if( IsLoading() )
@ -136,14 +155,7 @@ void SaveState::FreezeAll()
psxRcntFreeze();
sio2Freeze();
if( mtgsThread != NULL ) {
// have to call in thread, otherwise weird stuff will start happening
mtgsThread->SendPointerPacket( GS_RINGTYPE_SAVE, 0, this );
mtgsWaitGS();
}
else {
FreezePlugin( "GS", GSfreeze );
}
FreezePlugin( "GS", gsSafeFreeze );
FreezePlugin( "SPU2", SPU2freeze );
FreezePlugin( "DEV9", DEV9freeze );
FreezePlugin( "USB", USBfreeze );
@ -298,6 +310,8 @@ memBaseStateInfo::memBaseStateInfo( MemoryAlloc<u8>& memblock, const char* msg )
, m_memory( memblock )
, m_idx( 0 )
{
// Always clear the MTGS thread state.
mtgsWaitGS();
}
memSavingState::memSavingState( MemoryAlloc<u8>& save_to ) : memBaseStateInfo( save_to, _("Saving state to: ") )

View File

@ -35,6 +35,10 @@ static const u32 g_SaveVersion = 0x7a300011;
static const u32 g_SaveVersion = 0x8b400001;
#endif
// this function is meant to be sued in the place of GSfreeze, and provides a safe layer
// between the GS saving function and the MTGS's needs. :)
extern s32 CALLBACK gsSafeFreeze( int mode, freezeData *data );
// This class provides the base API for both loading and saving savestates.
// Normally you'll want to use one of the four "functional" derrived classes rather
// than this class directly: gzLoadingState, gzSavingState (gzipped disk-saved

View File

@ -50,6 +50,9 @@
#include "implement.h" // pthreads-win32 defines for startup/shutdown
// Disabled warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
#pragma warning(disable:4530)
bool AccBreak = false;
unsigned int langsMax;

View File

@ -298,7 +298,7 @@ void RunGuiAndReturn() {
if( g_gsRecoveryState != NULL )
{
memLoadingState eddie( *g_gsRecoveryState );
eddie.FreezePlugin( "GS", GSfreeze );
eddie.FreezePlugin( "GS", gsSafeFreeze );
eddie.gsFreeze();
safe_delete( g_gsRecoveryState );
@ -338,7 +338,7 @@ public:
void FreezePlugin( const char* name, s32 (CALLBACK* freezer)(int mode, freezeData *data) )
{
if( (freezer == GSfreeze) && (g_gsRecoveryState != NULL) )
if( (freezer == gsSafeFreeze) && (g_gsRecoveryState != NULL) )
{
// Gs data is already in memory, so just copy from src to dest:
// length of the GS data is stored as the first u32, so use that to run the copy:
@ -379,7 +379,7 @@ public:
void FreezePlugin( const char* name, s32 (CALLBACK* freezer)(int mode, freezeData *data) )
{
if( (freezer == GSfreeze) && (g_gsRecoveryState != NULL) )
if( (freezer == gsSafeFreeze) && (g_gsRecoveryState != NULL) )
{
// Gs data is already in memory, so just copy from there into the gzip file.
// length of the GS data is stored as the first u32, so use that to run the copy:
@ -672,7 +672,7 @@ void CALLBACK KeyEvent(keyEvent* ev)
safe_delete( g_RecoveryState );
g_gsRecoveryState = new MemoryAlloc<u8>();
JustGsSavingState eddie;
eddie.FreezePlugin( "GS", GSfreeze ) ;
eddie.FreezePlugin( "GS", gsSafeFreeze ) ;
eddie.gsFreeze();
PluginsResetGS();
}
@ -702,7 +702,6 @@ void SysRestorableReset()
try
{
SetCursor( LoadCursor( gApp.hInstance, IDC_APPSTARTING ) );
g_RecoveryState = new MemoryAlloc<u8>( "Memory Savestate Recovery" );
RecoveryMemSavingState().FreezeAll();
safe_delete( g_gsRecoveryState );

View File

@ -287,7 +287,7 @@ int hwConstRead32(u32 x86reg, u32 mem)
return 1;
case 0x10000010:
_eeReadConstMem32(x86reg, (uptr)&counters[0].mode);
EECNT_LOG("Counter 0 mode read = %x\n", counters[0].mode);
EECNT_LOG("Counter 0 mode read = %x\n", counters[0].modeval);
return 0;
case 0x10000020:
_eeReadConstMem32(x86reg, (uptr)&counters[0].target);
@ -306,7 +306,7 @@ int hwConstRead32(u32 x86reg, u32 mem)
return 1;
case 0x10000810:
_eeReadConstMem32(x86reg, (uptr)&counters[1].mode);
EECNT_LOG("Counter 1 mode read = %x\n", counters[1].mode);
EECNT_LOG("Counter 1 mode read = %x\n", counters[1].modeval);
return 0;
case 0x10000820:
_eeReadConstMem32(x86reg, (uptr)&counters[1].target);
@ -325,7 +325,7 @@ int hwConstRead32(u32 x86reg, u32 mem)
return 1;
case 0x10001010:
_eeReadConstMem32(x86reg, (uptr)&counters[2].mode);
EECNT_LOG("Counter 2 mode read = %x\n", counters[2].mode);
EECNT_LOG("Counter 2 mode read = %x\n", counters[2].modeval);
return 0;
case 0x10001020:
_eeReadConstMem32(x86reg, (uptr)&counters[2].target);
@ -346,7 +346,7 @@ int hwConstRead32(u32 x86reg, u32 mem)
return 1;
case 0x10001810:
_eeReadConstMem32(x86reg, (uptr)&counters[3].mode);
EECNT_LOG("Counter 3 mode read = %x\n", counters[3].mode);
EECNT_LOG("Counter 3 mode read = %x\n", counters[3].modeval);
return 0;
case 0x10001820:
_eeReadConstMem32(x86reg, (uptr)&counters[3].target);