void AppCoreThread::ResetQuick() { if( !GetSysExecutorThread().IsSelf() ) { GetSysExecutorThread().PostEvent( SysExecEvent_InvokeCoreThreadMethod(&AppCoreThread::ResetQuick) ); return; } _parent::ResetQuick(); }
void AppCoreThread::Resume() { if( !GetSysExecutorThread().IsSelf() ) { GetSysExecutorThread().PostEvent( SysExecEvent_InvokeCoreThreadMethod(&AppCoreThread::Resume) ); return; } GetCorePlugins().Init(); _parent::Resume(); }
void AppCoreThread::Suspend( bool isBlocking ) { if (IsClosed()) return; if (IsSelf()) { // this should never fail... bool result = GetSysExecutorThread().Rpc_TryInvokeAsync( _Suspend, L"AppCoreThread::Suspend" ); pxAssert(result); } else if (!GetSysExecutorThread().Rpc_TryInvoke( _Suspend, L"AppCoreThread::Suspend" )) _parent::Suspend(true); }
// Returns TRUE if the event is posted to the SysExecutor. // Returns FALSE if the thread *is* the SysExecutor (no message is posted, calling code should // handle the code directly). bool BaseScopedCoreThread::PostToSysExec( BaseSysExecEvent_ScopedCore* msg ) { std::unique_ptr<BaseSysExecEvent_ScopedCore> smsg( msg ); if( !smsg || GetSysExecutorThread().IsSelf()) return false; msg->SetSyncState(m_sync); msg->SetResumeStates(m_sync_resume, m_mtx_resume); GetSysExecutorThread().PostEvent( smsg.release() ); m_sync.WaitForResult(); m_sync.RethrowException(); return true; }
void States_FreezeCurrentSlot() { // FIXME : Use of the IsSavingOrLoading flag is mostly a hack until we implement a // complete thread to manage queuing savestate tasks, and zipping states to disk. --air if (!SysHasValidState()) { Console.WriteLn("Save state: Aborting (VM is not active)."); return; } if (wxGetApp().HasPendingSaves() || IsSavingOrLoading.exchange(true)) { Console.WriteLn("Load or save action is already pending."); return; } Sstates_updateLoadBackupMenuItem(true); GSchangeSaveState(StatesC, SaveStateBase::GetFilename(StatesC).ToUTF8()); StateCopy_SaveToSlot(StatesC); // Hack: Update the saveslot saying it's filled *right now* because it's still writing the file and we don't have a timestamp. saveslot_cache[StatesC].empty = false; saveslot_cache[StatesC].updated = wxDateTime::Now(); saveslot_cache[StatesC].crc = ElfCRC; GetSysExecutorThread().PostIdleEvent(SysExecEvent_ClearSavingLoadingFlag()); }
void AppCoreThread::ChangeCdvdSource() { if( !GetSysExecutorThread().IsSelf() ) { GetSysExecutorThread().PostEvent( new SysExecEvent_InvokeCoreThreadMethod(&AppCoreThread::ChangeCdvdSource) ); return; } CDVD_SourceType cdvdsrc( g_Conf->CdvdSource ); if( cdvdsrc == CDVDsys_GetSourceType() ) return; // Fast change of the CDVD source only -- a Pause will suffice. ScopedCoreThreadPause paused_core; GetCorePlugins().Close( PluginId_CDVD ); CDVDsys_ChangeSource( cdvdsrc ); paused_core.AllowResume(); // TODO: Add a listener for CDVDsource changes? Or should we bother? }
void BaseScopedCoreThread::DoResume() { if( m_alreadyStopped ) return; if( !GetSysExecutorThread().IsSelf() ) { //DbgCon.WriteLn("(ScopedCoreThreadPause) Threaded Scope Created!"); m_sync_resume.PostResult( m_allowResume ? ScopedCore_NonblockingResume : ScopedCore_SkipResume ); m_mtx_resume.Wait(); } else CoreThread.Resume(); }
void _States_DefrostCurrentSlot( bool isFromBackup ) { if( !SysHasValidState() ) { Console.WriteLn( "Load state: Aborting (VM is not active)." ); return; } if( IsSavingOrLoading.exchange(true) ) { Console.WriteLn( "Load or save action is already pending." ); return; } GSchangeSaveState( StatesC, SaveStateBase::GetFilename( StatesC ).ToUTF8() ); StateCopy_LoadFromSlot( StatesC, isFromBackup ); GetSysExecutorThread().PostIdleEvent( SysExecEvent_ClearSavingLoadingFlag() ); Sstates_updateLoadBackupMenuItem(); }
void States_FreezeCurrentSlot() { // FIXME : Use of the IsSavingOrLoading flag is mostly a hack until we implement a // complete thread to manage queuing savestate tasks, and zipping states to disk. --air if( !SysHasValidState() ) { Console.WriteLn( "Save state: Aborting (VM is not active)." ); return; } if( wxGetApp().HasPendingSaves() || IsSavingOrLoading.exchange(true) ) { Console.WriteLn( "Load or save action is already pending." ); return; } Sstates_updateLoadBackupMenuItem( true ); GSchangeSaveState( StatesC, SaveStateBase::GetFilename( StatesC ).ToUTF8() ); StateCopy_SaveToSlot( StatesC ); GetSysExecutorThread().PostIdleEvent( SysExecEvent_ClearSavingLoadingFlag() ); }
void AppCoreThread::Cancel( bool isBlocking ) { if (GetSysExecutorThread().IsRunning() && !GetSysExecutorThread().Rpc_TryInvoke( _Cancel, L"AppCoreThread::Cancel" )) _parent::Cancel( wxTimeSpan(0, 0, 4, 0) ); }