示例#1
0
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());
}
示例#2
0
// Updates the enable/disable status of all System related controls: menus, toolbars,
// etc.  Typically called by SysEvtHandler whenever the message pump becomes idle.
void UI_UpdateSysControls()
{
	if( wxGetApp().Rpc_TryInvokeAsync( &UI_UpdateSysControls ) ) return;

	sApp.PostAction( CoreThreadStatusEvent( CoreThread_Indeterminate ) );

	//_SaveLoadStuff( true );
	_SaveLoadStuff( SysHasValidState() );
}
示例#3
0
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();
}
示例#4
0
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() );
}
示例#5
0
void MainEmuFrame::ApplyCoreStatus()
{
	wxMenuBar& menubar( *GetMenuBar() );

	wxMenuItem* susres	= menubar.FindItem( MenuId_Sys_SuspendResume );
	wxMenuItem* cdvd	= menubar.FindItem( MenuId_Boot_CDVD );
	wxMenuItem* cdvd2	= menubar.FindItem( MenuId_Boot_CDVD2 );
	wxMenuItem* restart	= menubar.FindItem( MenuId_Sys_Restart );

	// [TODO] : Ideally each of these items would bind a listener instance to the AppCoreThread
	// dispatcher, and modify their states accordingly.  This is just a hack (for now) -- air

	bool vm = SysHasValidState();

	if( susres )
	{
		if( !CoreThread.IsClosing() )
		{
			susres->Enable();
			susres->SetText(_("Pause"));
			susres->SetHelp(_("Safely pauses emulation and preserves the PS2 state."));
		}
		else
		{
			susres->Enable(vm);
			if( vm )
			{
				susres->SetText(_("Resume"));
				susres->SetHelp(_("Resumes the suspended emulation state."));
			}
			else
			{
				susres->SetText(_("Pause/Resume"));
				susres->SetHelp(_("No emulation state is active; cannot suspend or resume."));
			}
		}
	}

	if( restart )
	{
		if( vm )	
		{
			restart->SetText(_("Restart"));
			restart->SetHelp(_("Simulates hardware reset of the PS2 virtual machine."));
		}
		else
		{
			restart->Enable( false );
			restart->SetHelp(_("No emulation state is active; boot something first."));
		}
	}

	if( cdvd )
	{
		if( vm )
		{
			cdvd->SetText(_("Reboot CDVD (full)"));
			cdvd->SetHelp(_("Hard reset of the active VM."));
		}
		else
		{
			cdvd->SetText(_("Boot CDVD (full)"));
			cdvd->SetHelp(_("Boot the VM using the current DVD or Iso source media"));
		}	
	}

	if( cdvd2 )
	{
		if( vm )
		{
			cdvd2->SetText(_("Reboot CDVD (fast)"));
			cdvd2->SetHelp(_("Reboot using fast BOOT (skips splash screens)"));
		}
		else
		{
			cdvd2->SetText(_("Boot CDVD (fast)"));
			cdvd2->SetHelp(_("Use fast boot to skip PS2 startup and splash screens"));
		}
	}

	menubar.Enable( MenuId_Sys_Shutdown, SysHasValidState() || CorePlugins.AreAnyInitialized() );
}
示例#6
0
void MainEmuFrame::ApplyCoreStatus()
{
	wxMenuBar& menubar( *GetMenuBar() );

	// [TODO] : Ideally each of these items would bind a listener instance to the AppCoreThread
	// dispatcher, and modify their states accordingly.  This is just a hack (for now) -- air

	if (wxMenuItem* susres = menubar.FindItem(MenuId_Sys_SuspendResume))
	{
		if( !CoreThread.IsClosing() )
		{
			susres->Enable();
			susres->SetItemLabel(_("Paus&e"));
			susres->SetHelp(_("Safely pauses emulation and preserves the PS2 state."));
		}
		else
		{
			bool ActiveVM = SysHasValidState();
			susres->Enable(ActiveVM);
			if( ActiveVM )
			{
				susres->SetItemLabel(_("R&esume"));
				susres->SetHelp(_("Resumes the suspended emulation state."));
			}
			else
			{
				susres->SetItemLabel(_("Pause/Resume"));
				susres->SetHelp(_("No emulation state is active; cannot suspend or resume."));
			}
		}
	}

	const CDVD_SourceType Source = g_Conf->CdvdSource;
	const MenuIdentifiers fullboot_id = MenuId_Boot_CDVD;
	const MenuIdentifiers fastboot_id = MenuId_Boot_CDVD2;

	wxMenuItem *cdvd_fast = menubar.FindItem(fastboot_id);
	if (Source == CDVD_SourceType::NoDisc)
	{
		if(cdvd_fast)
			m_menuSys.Destroy(cdvd_fast);
	}
	else
	{
		wxString label;
		wxString help_text = _("Use fast boot to skip PS2 startup and splash screens");

		switch (Source)
		{
		case CDVD_SourceType::Iso:
			label = _("Boot ISO (&fast)");
			break;
		case CDVD_SourceType::Plugin:
			label = _("Boot CDVD (&fast)");
			break;
		//case CDVD_SourceType::NoDisc: (Fast boot menu item is destroyed when no disc is selected)
		default:
			pxAssert(false);
		}

		if (cdvd_fast)
		{
			cdvd_fast->SetItemLabel(label);
			cdvd_fast->SetHelp(help_text);
		}
		else
		{
			m_menuSys.Insert(1, fastboot_id, label, help_text);
		}
	}

	if (wxMenuItem *cdvd_full = menubar.FindItem(fullboot_id))
	{
		switch (Source)
		{
		case CDVD_SourceType::Iso:
			cdvd_full->SetItemLabel(_("Boo&t ISO (full)"));
			cdvd_full->SetHelp(_("Boot the VM using the current ISO source media"));
			break;
		case CDVD_SourceType::Plugin:
			cdvd_full->SetItemLabel(_("Boo&t CDVD (full)"));
			cdvd_full->SetHelp(_("Boot the VM using the current CD/DVD source media"));
			break;
		case CDVD_SourceType::NoDisc:
			cdvd_full->SetItemLabel(_("Boo&t BIOS"));
			cdvd_full->SetHelp(_("Boot the VM without any source media"));
			break;
		default:
			pxAssert(false);
		}
	}
}