// -------------------------------------------------------------------------------------- // BaseSysExecEvent_ScopedCore / SysExecEvent_CoreThreadClose / SysExecEvent_CoreThreadPause // -------------------------------------------------------------------------------------- void BaseSysExecEvent_ScopedCore::_post_and_wait( IScopedCoreThread& core ) { DoScopedTask(); ScopedLock lock( m_mtx_resume ); PostResult(); if( m_resume ) { // If the sender of the message requests a non-blocking resume, then we need // to deallocate the m_sync object, since the sender will likely leave scope and // invalidate it. switch( m_resume->WaitForResult() ) { case ScopedCore_BlockingResume: if( m_sync ) m_sync->ClearResult(); core.AllowResume(); break; case ScopedCore_NonblockingResume: m_sync = NULL; core.AllowResume(); break; case ScopedCore_SkipResume: m_sync = NULL; break; } } }
// Return values: // wxID_CANCEL - User canceled the action outright. // wxID_RESET - User wants to reset the emu in addition to swap discs // (anything else) - Standard swap, no reset. (hotswap!) wxWindowID SwapOrReset_Iso( wxWindow* owner, IScopedCoreThread& core_control, const wxString& isoFilename, const wxString& descpart1 ) { wxWindowID result = wxID_CANCEL; if( (g_Conf->CdvdSource == CDVDsrc_Iso) && (isoFilename == g_Conf->CurrentIso) ) { core_control.AllowResume(); return result; } if( SysHasValidState() ) { core_control.DisallowResume(); wxDialogWithHelpers dialog( owner, _("Confirm ISO image change") ); dialog += dialog.Heading(descpart1); dialog += dialog.GetCharHeight(); dialog += dialog.Text(isoFilename); dialog += dialog.GetCharHeight(); dialog += dialog.Heading(_("Do you want to swap discs or boot the new image (via system reset)?")); result = pxIssueConfirmation( dialog, MsgButtons().Reset().Cancel().Custom(_("Swap Disc"), "swap"), L"DragDrop.BootSwapIso" ); if( result == wxID_CANCEL ) { core_control.AllowResume(); return result; } } g_Conf->CdvdSource = CDVDsrc_Iso; SysUpdateIsoSrcFile( isoFilename ); if( result == wxID_RESET ) { core_control.DisallowResume(); sApp.SysExecute( CDVDsrc_Iso ); } else { Console.Indent().WriteLn( "HotSwapping to new ISO src image!" ); //g_Conf->CdvdSource = CDVDsrc_Iso; //CoreThread.ChangeCdvdSource(); core_control.AllowResume(); } GetMainFrame().EnableCdvdPluginSubmenu( g_Conf->CdvdSource == CDVDsrc_Plugin ); return result; }