PCSX2-WX: Add "Always ask when booting" option

When enabled, this option opens the file explorer to directly select the
ISO at each boot instances instead of relying on the Recent ISO list.
This commit is contained in:
Akash 2017-06-18 15:27:59 +05:30 committed by Jonathan Li
parent b75868cc7c
commit 58102a39a4
10 changed files with 36 additions and 8 deletions

View File

@ -86,6 +86,7 @@ enum MenuIdentifiers
MenuId_Boot_Iso, // Opens submenu with Iso browser, and recent isos.
MenuId_RecentIsos_reservedStart,
MenuId_IsoBrowse = MenuId_RecentIsos_reservedStart + 100, // Open dialog, runs selected iso.
MenuId_Ask_On_Booting,
MenuId_Boot_CDVD,
MenuId_Boot_CDVD2,
MenuId_Boot_ELF,

View File

@ -670,6 +670,7 @@ void AppConfig::LoadSaveRootItems( IniInterface& ini )
IniEntry( EnablePresets );
IniEntry( PresetIndex );
IniEntry( AskOnBoot );
#ifdef __WXMSW__
IniEntry( McdCompressNTFS );

View File

@ -315,6 +315,8 @@ public:
bool EnablePresets;
int PresetIndex;
bool AskOnBoot;
wxString CurrentIso;
wxString CurrentELF;
wxString CurrentIRX;

View File

@ -63,7 +63,10 @@ const wxImage& LoadImageAny(
RecentIsoList::RecentIsoList(int firstIdForMenuItems_or_wxID_ANY)
{
Menu = std::unique_ptr<wxMenu>(new wxMenu());
Menu->Append( MenuId_IsoBrowse, _("Browse..."), _("Browse for an ISO that is not in your recent history.") );
Menu->AppendCheckItem( MenuId_Ask_On_Booting, _("Always ask when booting"), _("Manually select an ISO upon boot ignoring the selection from recent ISO list.") );
Menu->AppendSeparator();
Menu->Append( MenuId_IsoBrowse, _("Browse..."), _("Browse for an ISO that is not in your recent history."))->Enable(!g_Conf->AskOnBoot);
Menu->Check( MenuId_Ask_On_Booting, g_Conf->AskOnBoot );
Manager = std::unique_ptr<RecentIsoManager>(new RecentIsoManager( Menu.get(), firstIdForMenuItems_or_wxID_ANY ));
}

View File

@ -209,6 +209,7 @@ void MainEmuFrame::ConnectMenus()
Bind(wxEVT_MENU, &MainEmuFrame::Menu_CdvdSource_Click, this, MenuId_Src_Iso);
Bind(wxEVT_MENU, &MainEmuFrame::Menu_CdvdSource_Click, this, MenuId_Src_Plugin);
Bind(wxEVT_MENU, &MainEmuFrame::Menu_CdvdSource_Click, this, MenuId_Src_NoDisc);
Bind(wxEVT_MENU, &MainEmuFrame::Menu_Ask_On_Boot_Click, this, MenuId_Ask_On_Booting);
Bind(wxEVT_MENU, &MainEmuFrame::Menu_Debug_CreateBlockdump_Click, this, MenuId_Debug_CreateBlockdump);
// Config

View File

@ -195,6 +195,7 @@ protected:
void Menu_Debug_MemoryDump_Click(wxCommandEvent &event);
void Menu_Debug_Logging_Click(wxCommandEvent &event);
void Menu_Debug_CreateBlockdump_Click(wxCommandEvent &event);
void Menu_Ask_On_Boot_Click(wxCommandEvent &event);
void Menu_ShowConsole(wxCommandEvent &event);
void Menu_ChangeLang(wxCommandEvent &event);

View File

@ -331,7 +331,7 @@ void MainEmuFrame::_DoBootCdvd()
selector = true;
}
if( selector )
if( selector || g_Conf->AskOnBoot)
{
wxString result;
if( !_DoSelectIsoBrowser( result ) )
@ -412,6 +412,17 @@ void MainEmuFrame::Menu_IsoBrowse_Click( wxCommandEvent &event )
AppSaveSettings(); // save the new iso selection; update menus!
}
void MainEmuFrame::Menu_Ask_On_Boot_Click(wxCommandEvent &event)
{
g_Conf->AskOnBoot = event.IsChecked();
if (SysHasValidState())
return;
wxGetApp().GetRecentIsoManager().EnableItems(!event.IsChecked());
FindItemInMenuBar(MenuId_IsoBrowse)->Enable(!event.IsChecked());
}
void MainEmuFrame::Menu_Debug_CreateBlockdump_Click(wxCommandEvent &event)
{
g_Conf->EmuOptions.CdvdDumpBlocks = event.IsChecked();

View File

@ -171,13 +171,16 @@ void RecentIsoManager::InsertIntoMenu( int id )
wxid = this->m_firstIdForMenuItems_or_wxID_ANY + id;
curitem.ItemPtr = m_Menu->AppendRadioItem( wxid, Path::GetFilename(curitem.Filename), curitem.Filename );
bool exists = wxFileExists( curitem.Filename );
curitem.ItemPtr->Enable(wxFileExists(curitem.Filename) && !g_Conf->AskOnBoot);
}
if( m_cursel == id && exists )
curitem.ItemPtr->Check();
if ( !exists )
curitem.ItemPtr->Enable( false );
void RecentIsoManager::EnableItems(bool display)
{
for (const auto& list : m_Items)
{
// Files which don't exist still need to be grayed out.
list.ItemPtr->Enable(display && wxFileExists(list.Filename));
}
}
void RecentIsoManager::LoadListFrom( IniInterface& ini )

View File

@ -53,6 +53,7 @@ public:
virtual ~RecentIsoManager();
void RemoveAllFromMenu();
void EnableItems(bool display);
void Repopulate();
void Clear();
void Add( const wxString& src );

View File

@ -55,6 +55,8 @@ void UI_DisableSysShutdown()
if( wxGetApp().Rpc_TryInvokeAsync( &UI_DisableSysShutdown ) ) return;
sMainFrame.EnableMenuItem( MenuId_Sys_Shutdown, false );
sMainFrame.EnableMenuItem(MenuId_IsoBrowse, !g_Conf->AskOnBoot);
wxGetApp().GetRecentIsoManager().EnableItems(!g_Conf->AskOnBoot);
}
void UI_EnableSysShutdown()
@ -79,6 +81,8 @@ void UI_EnableSysActions()
if( wxGetApp().Rpc_TryInvokeAsync( &UI_EnableSysActions ) ) return;
sMainFrame.EnableMenuItem( MenuId_Sys_Shutdown, true );
sMainFrame.EnableMenuItem(MenuId_IsoBrowse, true);
wxGetApp().GetRecentIsoManager().EnableItems(true);
_SaveLoadStuff( true );
}