diff --git a/pcsx2/MemoryCard.cpp b/pcsx2/MemoryCard.cpp index c76b952cb3..f7fb062f5b 100644 --- a/pcsx2/MemoryCard.cpp +++ b/pcsx2/MemoryCard.cpp @@ -70,14 +70,18 @@ void MemoryCard::Load( uint mcd ) wxFileName fname( g_Conf->FullpathToMcd( mcd ) ); wxString str( fname.GetFullPath() ); - if( !fname.FileExists() ) + const wxULongLong fsz = fname.GetSize(); + if( (fsz == 0) || (fsz == wxInvalidSize) ) Create( str ); + // [TODO] : Add memcard size detection and report it to the console log. + // (8MB, 256Mb, whatever) + #ifdef _WIN32 NTFS_CompressFile( str, g_Conf->McdEnableNTFS ); #endif - cardfile[mcd].Open( str.c_str(), wxFile::write ); + cardfile[mcd].Open( str.c_str(), wxFile::read_write ); if( !cardfile[mcd].IsOpened() ) { diff --git a/pcsx2/gui/App.h b/pcsx2/gui/App.h index 7653f789e5..487afc3783 100644 --- a/pcsx2/gui/App.h +++ b/pcsx2/gui/App.h @@ -39,79 +39,81 @@ class IniInterface; enum MenuIdentifiers { // Main Menu Section - Menu_Run = 1, - Menu_Config, // General config, plus non audio/video plugins. - Menu_Video, // Video options filled in by GS plugin - Menu_Audio, // audio options filled in by SPU2 plugin - Menu_Misc, // Misc options and help! + MenuId_Boot = 1, + MenuId_Emulation, + MenuId_Config, // General config, plus non audio/video plugins. + MenuId_Video, // Video options filled in by GS plugin + MenuId_Audio, // audio options filled in by SPU2 plugin + MenuId_Misc, // Misc options and help! + + MenuId_Exit = wxID_EXIT, + MenuId_About = wxID_ABOUT, + + MenuId_EndTopLevel = 20, // Run SubSection - Menu_RunIso = 20, // Opens submenu with Iso browser, and recent isos. - Menu_IsoBrowse, // Open dialog, runs selected iso. - Menu_BootCDVD, // opens a submenu filled by CDVD plugin (usually list of drives) - Menu_RunWithoutDisc, // used to enter the bios (subs in cdvdnull) - Menu_RunELF, - Menu_SkipBiosToggle, // enables the Bios Skip speedhack - Menu_EnableSkipBios, // check marked menu that toggles Skip Bios boot feature. - Menu_PauseExec, // suspends/resumes active emulation - Menu_Reset, // Issues a complete reset. - Menu_States, // Opens states submenu - Menu_Run_Exit = wxID_EXIT, + MenuId_Cdvd_Source, + MenuId_Src_Iso, + MenuId_Src_Cdvd, + MenuId_Src_NoDisc, + MenuId_Boot_Iso, // Opens submenu with Iso browser, and recent isos. + MenuId_IsoBrowse, // Open dialog, runs selected iso. + MenuId_Boot_CDVD, // opens a submenu filled by CDVD plugin (usually list of drives) + MenuId_RunWithoutDisc, // used to enter the bios (subs in cdvdnull) + MenuId_Boot_ELF, + MenuId_SkipBiosToggle, // enables the Bios Skip speedhack - Menu_State_Load = 40, - Menu_State_LoadOther, - Menu_State_Load01, // first of many load slots - Menu_State_Save = 60, - Menu_State_SaveOther, - Menu_State_Save01, // first of many save slots + + MenuId_Emu_Pause, // suspends/resumes active emulation, retains plugin states + MenuId_Emu_Close, // Closes the emulator (states are preserved) + MenuId_Emu_Reset, // Issues a complete reset (wipes preserved states) + MenuId_Emu_LoadStates, // Opens load states submenu + MenuId_Emu_SaveStates, // Opens save states submenu + MenuId_EnablePatches, + + MenuId_State_Load, + MenuId_State_LoadOther, + MenuId_State_Load01, // first of many load slots + MenuId_State_Save = MenuId_State_Load01+20, + MenuId_State_SaveOther, + MenuId_State_Save01, // first of many save slots + + MenuId_State_EndSlotSection = MenuId_State_Save01+20, // Config Subsection - Menu_Config_Settings = 100, - Menu_Config_BIOS, - Menu_Config_CDVD, - Menu_Config_DEV9, - Menu_Config_USB, - Menu_Config_FireWire, - Menu_Config_Patches, + MenuId_Config_Settings, + MenuId_Config_BIOS, + MenuId_Config_CDVD, + MenuId_Config_DEV9, + MenuId_Config_USB, + MenuId_Config_FireWire, + MenuId_Config_Patches, // Video Subsection // Top items are Pcsx2-controlled. GS plugin items are inserted beneath. - Menu_Video_Basics = 200, // includes frame timings and skippings settings - Menu_Video_Advanced, // inserted at the bottom of the menu - Menu_GS_Custom1 = 210, // start index for GS custom entries (valid up to 299) - Menu_GS_CustomMax = 299, + MenuId_Video_Basics, // includes frame timings and skippings settings + MenuId_Video_Advanced, // inserted at the bottom of the menu // Audio subsection // Top items are Pcsx2-controlled. SPU2 plugin items are inserted beneath. // [no items at this time] - Menu_Audio_Advanced = 300, // inserted at the bottom of the menu - Menu_Audio_Custom1 = 310, - Menu_Audio_CustomMax = 399, + MenuId_Audio_Advanced, // inserted at the bottom of the menu // Controller subsection // Top items are Pcsx2-controlled. Pad plugin items are inserted beneath. // [no items at this time] - Menu_Pad_Advanced = 400, - Menu_Pad_Custom1 = 410, - Menu_Pad_CustomMax = 499, + MenuId_Pad_Advanced, // Miscellaneous Menu! (Misc) - Menu_About = wxID_ABOUT, - Menu_Website = 500, // Visit our awesome website! - Menu_Profiler, // Enable profiler - Menu_Console, // Enable console - Menu_Patches, + MenuId_Website, // Visit our awesome website! + MenuId_Profiler, // Enable profiler + MenuId_Console, // Enable console // Debug Subsection - Menu_Debug_Open = 600, // opens the debugger window / starts a debug session - Menu_Debug_MemoryDump, - Menu_Debug_Logging, // dialog for selection additional log options - Menu_Debug_Usermode, - Menu_Languages, - - // Language Menu - // (Updated entirely dynamically, all values from range 1000 onward are reserved for languages) - Menu_Language_Start = 1000 + MenuId_Debug_Open, // opens the debugger window / starts a debug session + MenuId_Debug_MemoryDump, + MenuId_Debug_Logging, // dialog for selection additional log options + MenuId_Debug_Usermode, }; diff --git a/pcsx2/gui/ConsoleLogger.h b/pcsx2/gui/ConsoleLogger.h index 6d69b1ffd4..6d57bae1e6 100644 --- a/pcsx2/gui/ConsoleLogger.h +++ b/pcsx2/gui/ConsoleLogger.h @@ -19,7 +19,9 @@ #pragma once -DECLARE_EVENT_TYPE(wxEVT_DockConsole, -1); +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EVENT_TYPE(wxEVT_DockConsole, -1) +END_DECLARE_EVENT_TYPES() static const bool EnableThreadedLoggingTest = false; //true; diff --git a/pcsx2/gui/Dialogs/FirstTimeWizard.cpp b/pcsx2/gui/Dialogs/FirstTimeWizard.cpp index 3a75d6565f..9b0d942675 100644 --- a/pcsx2/gui/Dialogs/FirstTimeWizard.cpp +++ b/pcsx2/gui/Dialogs/FirstTimeWizard.cpp @@ -148,7 +148,6 @@ void FirstTimeWizard::OnPageChanging( wxWizardEvent& evt ) int page = (int)evt.GetPage()->GetClientData(); - //evt.Skip(); if( evt.GetDirection() ) { // Moving forward: @@ -175,6 +174,8 @@ void FirstTimeWizard::OnPageChanging( wxWizardEvent& evt ) evt.Veto(); return; } + m_panel_PluginSel.ReloadSettings(); + m_panel_BiosSel.ReloadSettings(); } } } diff --git a/pcsx2/gui/MainFrame.cpp b/pcsx2/gui/MainFrame.cpp index 21e09d7004..61e17534bd 100644 --- a/pcsx2/gui/MainFrame.cpp +++ b/pcsx2/gui/MainFrame.cpp @@ -23,28 +23,26 @@ #include "Resources/AppIcon.h" // ------------------------------------------------------------------------ -wxMenu* MainEmuFrame::MakeStatesMenu() +/*wxMenu* MainEmuFrame::MakeStatesMenu() { wxMenu* mnuStates = new wxMenu(); - m_LoadStatesSubmenu.Append( Menu_State_LoadOther, _("Other..."), wxEmptyString, wxITEM_NORMAL ); - m_SaveStatesSubmenu.Append( Menu_State_SaveOther, _("Other..."), wxEmptyString, wxITEM_NORMAL ); - mnuStates->Append( Menu_State_Load, _("Load"), &m_LoadStatesSubmenu, wxEmptyString ); mnuStates->Append( Menu_State_Save, _("Save"), &m_SaveStatesSubmenu, wxEmptyString ); return mnuStates; -} +}*/ // ------------------------------------------------------------------------ wxMenu* MainEmuFrame::MakeStatesSubMenu( int baseid ) const { wxMenu* mnuSubstates = new wxMenu(); - mnuSubstates->Append( baseid, _("Slot 0"), wxEmptyString, wxITEM_NORMAL ); - mnuSubstates->Append( baseid+1, _("Slot 1"), wxEmptyString, wxITEM_NORMAL ); - mnuSubstates->Append( baseid+2, _("Slot 2"), wxEmptyString, wxITEM_NORMAL ); - mnuSubstates->Append( baseid+3, _("Slot 3"), wxEmptyString, wxITEM_NORMAL ); - mnuSubstates->Append( baseid+4, _("Slot 4"), wxEmptyString, wxITEM_NORMAL ); + mnuSubstates->Append( baseid+1, _("Slot 0"), wxEmptyString, wxITEM_NORMAL ); + mnuSubstates->Append( baseid+2, _("Slot 1"), wxEmptyString, wxITEM_NORMAL ); + mnuSubstates->Append( baseid+3, _("Slot 2"), wxEmptyString, wxITEM_NORMAL ); + mnuSubstates->Append( baseid+4, _("Slot 3"), wxEmptyString, wxITEM_NORMAL ); + mnuSubstates->Append( baseid+5, _("Slot 4"), wxEmptyString, wxITEM_NORMAL ); + mnuSubstates->Append( baseid, _("Other..."), wxEmptyString, wxITEM_NORMAL ); return mnuSubstates; } @@ -59,7 +57,7 @@ wxMenu* MainEmuFrame::MakeIsoMenu() { wxMenu* mnuIso = new wxMenu(); - mnuIso->Append( Menu_IsoBrowse, _("Browse..."), _("Select an Iso image from your hard drive.") ); + mnuIso->Append( MenuId_IsoBrowse, _("Browse..."), _("Select an Iso image from your hard drive.") ); if( g_RecentIsoList != NULL ) { @@ -73,37 +71,43 @@ wxMenu* MainEmuFrame::MakeIsoMenu() wxMenu* MainEmuFrame::MakeCdvdMenu() { wxMenu* mnuCdvd = new wxMenu(); + mnuCdvd->Append( MenuId_Src_Iso, _("Iso image"), wxEmptyString, wxITEM_RADIO ); + mnuCdvd->Append( MenuId_Src_Cdvd, _("Cdvd plugin"), wxEmptyString, wxITEM_RADIO ); + mnuCdvd->Append( MenuId_Src_NoDisc, _("No disc"), wxEmptyString, wxITEM_RADIO ); return mnuCdvd; } +// ------------------------------------------------------------------------ +// Video / Audio / Pad "Extensible" Menus // ------------------------------------------------------------------------ void MainEmuFrame::PopulateVideoMenu() { - m_menuVideo.Append( Menu_Video_Basics, _("Basic Settings..."), wxEmptyString, wxITEM_CHECK ); + m_menuVideo.Append( MenuId_Video_Basics, _("Basic Settings..."), wxEmptyString, wxITEM_CHECK ); m_menuVideo.AppendSeparator(); // Populate options from the plugin here. - m_menuVideo.Append( Menu_Video_Advanced, _("Advanced..."), wxEmptyString, wxITEM_NORMAL ); + m_menuVideo.Append( MenuId_Video_Advanced, _("Advanced..."), wxEmptyString, wxITEM_NORMAL ); } -// ------------------------------------------------------------------------ void MainEmuFrame::PopulateAudioMenu() { // Populate options from the plugin here. - m_menuAudio.Append( Menu_Audio_Advanced, _("Advanced..."), wxEmptyString, wxITEM_NORMAL ); + m_menuAudio.Append( MenuId_Audio_Advanced, _("Advanced..."), wxEmptyString, wxITEM_NORMAL ); } -// ------------------------------------------------------------------------ void MainEmuFrame::PopulatePadMenu() { // Populate options from the plugin here. - m_menuPad.Append( Menu_Pad_Advanced, _("Advanced..."), wxEmptyString, wxITEM_NORMAL ); + m_menuPad.Append( MenuId_Pad_Advanced, _("Advanced..."), wxEmptyString, wxITEM_NORMAL ); } // ------------------------------------------------------------------------ +// MainFrame OnEvent Handlers +// ------------------------------------------------------------------------ + // Close out the console log windows along with the main emu window. // Note: This event only happens after a close event has occurred and was *not* veto'd. Ie, // it means it's time to provide an unconditional closure of said window. @@ -158,29 +162,30 @@ void MainEmuFrame::ConnectMenus() #define ConnectMenu( id, handler ) \ Connect( id, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainEmuFrame::handler) ) - ConnectMenu( Menu_Config_Settings, Menu_ConfigSettings_Click ); - ConnectMenu( Menu_Config_BIOS, Menu_SelectBios_Click ); - ConnectMenu( Menu_IsoBrowse, Menu_RunIso_Click ); - ConnectMenu( Menu_RunWithoutDisc, Menu_RunWithoutDisc_Click ); + ConnectMenu( MenuId_Config_Settings, Menu_ConfigSettings_Click ); + ConnectMenu( MenuId_Config_BIOS, Menu_SelectBios_Click ); + ConnectMenu( MenuId_IsoBrowse, Menu_RunIso_Click ); + ConnectMenu( MenuId_RunWithoutDisc, Menu_RunWithoutDisc_Click ); Connect( wxID_FILE1, wxID_FILE1+20, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainEmuFrame::Menu_IsoRecent_Click) ); - ConnectMenu( Menu_RunELF, Menu_OpenELF_Click ); - ConnectMenu( Menu_Run_Exit, Menu_Exit_Click ); + ConnectMenu( MenuId_Boot_ELF, Menu_OpenELF_Click ); + ConnectMenu( MenuId_Exit, Menu_Exit_Click ); - ConnectMenu( Menu_PauseExec, Menu_Pause_Click ); - ConnectMenu( Menu_Reset, Menu_Reset_Click ); + ConnectMenu( MenuId_Emu_Pause, Menu_EmuPause_Click ); + ConnectMenu( MenuId_Emu_Close, Menu_EmuClose_Click ); + ConnectMenu( MenuId_Emu_Reset, Menu_EmuReset_Click ); - ConnectMenu( Menu_State_LoadOther, Menu_LoadStateOther_Click ); - ConnectMenu( Menu_State_SaveOther, Menu_SaveStateOther_Click ); + ConnectMenu( MenuId_State_LoadOther, Menu_LoadStateOther_Click ); + ConnectMenu( MenuId_State_SaveOther, Menu_SaveStateOther_Click ); - ConnectMenu( Menu_Debug_Open, Menu_Debug_Open_Click ); - ConnectMenu( Menu_Debug_MemoryDump, Menu_Debug_MemoryDump_Click ); - ConnectMenu( Menu_Debug_Logging, Menu_Debug_Logging_Click ); + ConnectMenu( MenuId_Debug_Open, Menu_Debug_Open_Click ); + ConnectMenu( MenuId_Debug_MemoryDump, Menu_Debug_MemoryDump_Click ); + ConnectMenu( MenuId_Debug_Logging, Menu_Debug_Logging_Click ); - ConnectMenu( Menu_Console, Menu_ShowConsole ); + ConnectMenu( MenuId_Console, Menu_ShowConsole ); - ConnectMenu( Menu_About, Menu_ShowAboutBox ); + ConnectMenu( MenuId_About, Menu_ShowAboutBox ); } void MainEmuFrame::InitLogBoxPosition( AppConfig::ConsoleLogOptions& conf ) @@ -212,7 +217,8 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title): m_menubar( *new wxMenuBar() ), - m_menuRun( *new wxMenu() ), + m_menuBoot( *new wxMenu() ), + m_menuEmu( *new wxMenu() ), m_menuConfig( *new wxMenu() ), m_menuMisc( *new wxMenu() ), @@ -221,31 +227,29 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title): m_menuPad( *new wxMenu() ), m_menuDebug( *new wxMenu() ), - m_LoadStatesSubmenu( *MakeStatesSubMenu( Menu_State_Load01 ) ), - m_SaveStatesSubmenu( *MakeStatesSubMenu( Menu_State_Save01 ) ), + m_LoadStatesSubmenu( *MakeStatesSubMenu( MenuId_State_Load01 ) ), + m_SaveStatesSubmenu( *MakeStatesSubMenu( MenuId_State_Save01 ) ), - m_MenuItem_Console( *new wxMenuItem( &m_menuMisc, Menu_Console, L"Show Console", wxEmptyString, wxITEM_CHECK ) ), - - m_IsPaused( false ) + m_MenuItem_Console( *new wxMenuItem( &m_menuMisc, MenuId_Console, L"Show Console", wxEmptyString, wxITEM_CHECK ) ) { // ------------------------------------------------------------------------ // Initial menubar setup. This needs to be done first so that the menu bar's visible size // can be factored into the window size (which ends up being background+status+menus) - m_menubar.Append( &m_menuRun, _("Run") ); + m_menubar.Append( &m_menuBoot, _("Boot") ); + m_menubar.Append( &m_menuEmu, _("Emulation") ); m_menubar.Append( &m_menuConfig, _("Config") ); m_menubar.Append( &m_menuVideo, _("Video") ); m_menubar.Append( &m_menuAudio, _("Audio") ); - m_menubar.Append( &m_menuPad, _("Pad") ); m_menubar.Append( &m_menuMisc, _("Misc") ); m_menubar.Append( &m_menuDebug, _("Debug") ); SetMenuBar( &m_menubar ); - + // ------------------------------------------------------------------------ wxSize backsize( m_background.GetSize() ); - SetTitle(_("Pcsx2")); + SetTitle(_("PCSX2")); wxIcon myIcon; myIcon.CopyFromBitmap( wxBitmap( EmbeddedImage().Rescale( 32, 32 ) ) ); @@ -275,36 +279,60 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title): // ------------------------------------------------------------------------ - m_menuRun.Append(Menu_RunIso, _("Run ISO"), MakeIsoMenu() ); - m_menuRun.Append(Menu_BootCDVD, _("Run CDVD"), MakeCdvdMenu() ); - m_menuRun.Append(Menu_SkipBiosToggle,_("ELF Injection Hack"), _("Skips PS2 splash screens when booting from Iso or CDVD media")); + m_menuBoot.Append(MenuId_Boot_Iso, _("Run ISO"), + MakeIsoMenu() ); - m_menuRun.AppendSeparator(); - m_menuRun.Append(Menu_RunWithoutDisc,_("Boot without Disc"), _("Use this to access the PS2 system configuration menu")); - m_menuRun.Append(Menu_RunELF, _("Run ELF File..."), _("For running raw binaries")); + m_menuBoot.AppendSeparator(); + m_menuBoot.Append(MenuId_RunWithoutDisc,_("Boot without Disc"), + _("Use this to access the PS2 system configuration menu")); - m_menuRun.AppendSeparator(); - m_menuRun.Append(Menu_PauseExec, _("Pause"), _("Stops emulation dead in its tracks")); - m_menuRun.Append(Menu_States, _("States"), MakeStatesMenu(), wxEmptyString); - m_menuRun.Append(Menu_Reset, _("Reset"), _("Resets emulation state and reloads plugins")); + m_menuBoot.Append(MenuId_Boot_ELF, _("Run ELF File..."), + _("For running raw binaries")); - m_menuRun.AppendSeparator(); - m_menuRun.Append(Menu_Run_Exit, _("Exit"), _("Closing PCSX2 may be hazardous to your health")); + m_menuBoot.AppendSeparator(); + m_menuBoot.Append(MenuId_Cdvd_Source, _("Select CDVD source"), MakeCdvdMenu() ); + m_menuBoot.Append(MenuId_SkipBiosToggle,_("BIOS Skip Hack"), + _("Skips PS2 splash screens when booting from Iso or CDVD media"), wxITEM_CHECK ); + + m_menuBoot.AppendSeparator(); + m_menuBoot.Append(MenuId_Exit, _("Exit"), + _("Closing PCSX2 may be hazardous to your health")); + + // ------------------------------------------------------------------------ + m_menuEmu.Append(MenuId_Emu_Pause, _("Pause"), + _("Stops emulation dead in its tracks"), wxITEM_CHECK ); + + m_menuEmu.AppendSeparator(); + m_menuEmu.Append(MenuId_Emu_Reset, _("Reset"), + _("Resets emulation state and re-runs current image")); + + m_menuEmu.Append(MenuId_Emu_Close, _("Close"), + _("Stops emulation and closes the GS window.")); + + m_menuEmu.AppendSeparator(); + m_menuEmu.Append(MenuId_Emu_LoadStates, _("Load state"), &m_LoadStatesSubmenu); + m_menuEmu.Append(MenuId_Emu_SaveStates, _("Save state"), &m_SaveStatesSubmenu); + + m_menuEmu.AppendSeparator(); + m_menuEmu.Append(MenuId_EnablePatches, _("Enable Patches"), + wxEmptyString, wxITEM_CHECK); // ------------------------------------------------------------------------ - m_menuConfig.Append(Menu_Config_Settings, _("General Settings") ); + m_menuConfig.Append(MenuId_Config_Settings, _("General Settings") ); m_menuConfig.AppendSeparator(); + m_menuConfig.Append(MenuId_Config_CDVD, _("PAD"), &m_menuPad ); + // Query installed "tertiary" plugins for name and menu options. - m_menuConfig.Append(Menu_Config_CDVD, _("CDVD"), wxEmptyString); - m_menuConfig.Append(Menu_Config_DEV9, _("Dev9"), wxEmptyString); - m_menuConfig.Append(Menu_Config_USB, _("USB"), wxEmptyString); - m_menuConfig.Append(Menu_Config_FireWire, _("Firewire"), wxEmptyString); + m_menuConfig.Append(MenuId_Config_CDVD, _("CDVD"), wxEmptyString); + m_menuConfig.Append(MenuId_Config_DEV9, _("Dev9"), wxEmptyString); + m_menuConfig.Append(MenuId_Config_USB, _("USB"), wxEmptyString); + m_menuConfig.Append(MenuId_Config_FireWire, _("Firewire"), wxEmptyString); m_menuConfig.AppendSeparator(); - m_menuConfig.Append(Menu_Config_Patches, _("Patches"), wxEmptyString); - m_menuConfig.Append(Menu_Config_BIOS, _("BIOS") ); + m_menuConfig.Append(MenuId_Config_Patches, _("Patches"), wxEmptyString); + m_menuConfig.Append(MenuId_Config_BIOS, _("BIOS") ); // ------------------------------------------------------------------------ @@ -315,8 +343,7 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title): // ------------------------------------------------------------------------ m_menuMisc.Append( &m_MenuItem_Console ); - m_menuMisc.Append(Menu_Patches, _("Enable Patches"), wxEmptyString, wxITEM_CHECK); - m_menuMisc.Append(Menu_Profiler, _("Enable Profiler"), wxEmptyString, wxITEM_CHECK); + m_menuMisc.Append(MenuId_Profiler, _("Show Profiler"), wxEmptyString, wxITEM_CHECK); m_menuMisc.AppendSeparator(); // No dialogs implemented for these yet... @@ -326,15 +353,16 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title): // Ref will want this re-added eventually. //m_menuMisc.Append(47, _T("Print CDVD Info..."), wxEmptyString, wxITEM_CHECK); - m_menuMisc.Append(Menu_About, _("About...") ); - m_menuMisc.Append(Menu_Website, _("Pcsx2 Website..."), _("Opens your web-browser to our favorite website.")); + m_menuMisc.Append(MenuId_Website, _("Visit Website..."), + _("Opens your web-browser to our favorite website.")); + m_menuMisc.Append(MenuId_About, _("About...") ); - m_menuDebug.Append(Menu_Debug_Open, _("Open Debug Window..."), wxEmptyString); - m_menuDebug.Append(Menu_Debug_MemoryDump, _("Memory Dump..."), wxEmptyString); - m_menuDebug.Append(Menu_Debug_Logging, _("Logging..."), wxEmptyString); + m_menuDebug.Append(MenuId_Debug_Open, _("Open Debug Window..."), wxEmptyString); + m_menuDebug.Append(MenuId_Debug_MemoryDump, _("Memory Dump..."), wxEmptyString); + m_menuDebug.Append(MenuId_Debug_Logging, _("Logging..."), wxEmptyString); - m_menuConfig.AppendSeparator(); - m_menuDebug.Append(Menu_Debug_Usermode, _("Change Usermode..."), _(" Advanced feature for managing multiple concurrent PCSX2 environments.")); + m_menuDebug.AppendSeparator(); + m_menuDebug.Append(MenuId_Debug_Usermode, _("Change Usermode..."), _(" Advanced feature for managing multiple concurrent PCSX2 environments.")); m_MenuItem_Console.Check( g_Conf->ProgLogBox.Visible ); diff --git a/pcsx2/gui/MainFrame.h b/pcsx2/gui/MainFrame.h index 5b40893885..0a7d369fe5 100644 --- a/pcsx2/gui/MainFrame.h +++ b/pcsx2/gui/MainFrame.h @@ -38,7 +38,8 @@ protected: wxMenuBar& m_menubar; - wxMenu& m_menuRun; + wxMenu& m_menuBoot; + wxMenu& m_menuEmu; wxMenu& m_menuConfig; wxMenu& m_menuMisc; wxMenu& m_menuDebug; @@ -52,8 +53,6 @@ protected: wxMenuItem& m_MenuItem_Console; - bool m_IsPaused; - // ------------------------------------------------------------------------ // MainEmuFrame Constructors and Member Methods // ------------------------------------------------------------------------ @@ -62,7 +61,7 @@ public: MainEmuFrame(wxWindow* parent, const wxString& title); void OnLogBoxHidden(); - bool IsPaused() const { return m_IsPaused; } + bool IsPaused() const { return GetMenuBar()->IsChecked( MenuId_Emu_Pause ); } protected: void InitLogBoxPosition( AppConfig::ConsoleLogOptions& conf ); @@ -83,8 +82,9 @@ protected: void Menu_SaveStateOther_Click(wxCommandEvent &event); void Menu_Exit_Click(wxCommandEvent &event); - void Menu_Pause_Click(wxCommandEvent &event); - void Menu_Reset_Click(wxCommandEvent &event); + void Menu_EmuPause_Click(wxCommandEvent &event); + void Menu_EmuClose_Click(wxCommandEvent &event); + void Menu_EmuReset_Click(wxCommandEvent &event); void Menu_Debug_Open_Click(wxCommandEvent &event); void Menu_Debug_MemoryDump_Click(wxCommandEvent &event); diff --git a/pcsx2/gui/MainMenuClicks.cpp b/pcsx2/gui/MainMenuClicks.cpp index 08092b781c..9c36a404a2 100644 --- a/pcsx2/gui/MainMenuClicks.cpp +++ b/pcsx2/gui/MainMenuClicks.cpp @@ -137,12 +137,30 @@ void MainEmuFrame::Menu_Exit_Click(wxCommandEvent &event) Close(); } -void MainEmuFrame::Menu_Pause_Click(wxCommandEvent &event) +void MainEmuFrame::Menu_EmuClose_Click(wxCommandEvent &event) { + SysReset(); + GetMenuBar()->Check( MenuId_Emu_Pause, false ); } -void MainEmuFrame::Menu_Reset_Click(wxCommandEvent &event) +void MainEmuFrame::Menu_EmuPause_Click(wxCommandEvent &event) { + if( event.IsChecked() ) + SysSuspend(); + else + SysResume(); +} + +void MainEmuFrame::Menu_EmuReset_Click(wxCommandEvent &event) +{ + bool wasRunning = EmulationInProgress(); + SysReset(); + + GetMenuBar()->Check( MenuId_Emu_Pause, false ); + + if( !wasRunning ) return; + InitPlugins(); + SysExecute( new AppEmuThread() ); } void MainEmuFrame::Menu_Debug_Open_Click(wxCommandEvent &event) diff --git a/pcsx2/gui/Panels/BiosSelectorPanel.cpp b/pcsx2/gui/Panels/BiosSelectorPanel.cpp index 32f5bccc58..321736d800 100644 --- a/pcsx2/gui/Panels/BiosSelectorPanel.cpp +++ b/pcsx2/gui/Panels/BiosSelectorPanel.cpp @@ -113,6 +113,11 @@ bool Panels::BiosSelectorPanel::ValidateEnumerationStatus() return validated; } +void Panels::BiosSelectorPanel::ReloadSettings() +{ + m_FolderPicker.Reset(); +} + void Panels::BiosSelectorPanel::Apply( AppConfig& conf ) { int sel = m_ComboBox.GetSelection(); diff --git a/pcsx2/gui/Panels/ConfigurationPanels.h b/pcsx2/gui/Panels/ConfigurationPanels.h index f97684fbd5..6ca9d12038 100644 --- a/pcsx2/gui/Panels/ConfigurationPanels.h +++ b/pcsx2/gui/Panels/ConfigurationPanels.h @@ -358,6 +358,7 @@ namespace Panels public: BiosSelectorPanel( wxWindow& parent, int idealWidth ); virtual ~BiosSelectorPanel(); + void ReloadSettings(); protected: virtual void Apply( AppConfig& conf ); @@ -417,10 +418,12 @@ namespace Panels protected: wxComboBox* m_combobox[NumPluginTypes]; DirPickerPanel& m_FolderPicker; + public: ComboBoxPanel( PluginSelectorPanel* parent ); wxComboBox& Get( int i ) { return *m_combobox[i]; } wxDirName GetPluginsPath() const { return m_FolderPicker.GetPath(); } + DirPickerPanel& GetDirPicker() { return m_FolderPicker; } void Reset(); }; @@ -455,6 +458,7 @@ namespace Panels void CancelRefresh(); // used from destructor, stays non-virtual void Apply( AppConfig& conf ); + void ReloadSettings(); protected: void OnConfigure_Clicked( wxCommandEvent& evt ); diff --git a/pcsx2/gui/Panels/DirPickerPanel.cpp b/pcsx2/gui/Panels/DirPickerPanel.cpp index 8045dab013..dbaebdede8 100644 --- a/pcsx2/gui/Panels/DirPickerPanel.cpp +++ b/pcsx2/gui/Panels/DirPickerPanel.cpp @@ -114,17 +114,9 @@ Panels::DirPickerPanel::DirPickerPanel( wxWindow* parent, FoldersEnum_t folderid SetSizer( &s_box ); - // Apply default values - const bool isDefault = g_Conf->Folders.IsDefault( m_FolderId ); - m_checkCtrl->SetValue( isDefault ); - m_pickerCtrl->Enable( !isDefault ); - Connect( m_checkCtrl->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DirPickerPanel::UseDefaultPath_Click ) ); - // Finally, assign the real value from the config. - // (done here because wxGTK fails to init the control when provisioning the initial path - // via the contructor) - m_pickerCtrl->SetPath( GetNormalizedConfigFolder( m_FolderId ) ); + Reset(); // forces default settings based on g_Conf } Panels::DirPickerPanel& Panels::DirPickerPanel::SetStaticDesc( const wxString& msg ) @@ -136,6 +128,9 @@ Panels::DirPickerPanel& Panels::DirPickerPanel::SetStaticDesc( const wxString& m void Panels::DirPickerPanel::Reset() { + const bool isDefault = g_Conf->Folders.IsDefault( m_FolderId ); + m_checkCtrl->SetValue( isDefault ); + m_pickerCtrl->Enable( !isDefault ); m_pickerCtrl->SetPath( GetNormalizedConfigFolder( m_FolderId ) ); } diff --git a/pcsx2/gui/Panels/PluginSelectorPanel.cpp b/pcsx2/gui/Panels/PluginSelectorPanel.cpp index 92c0d399a4..ec8434ab1d 100644 --- a/pcsx2/gui/Panels/PluginSelectorPanel.cpp +++ b/pcsx2/gui/Panels/PluginSelectorPanel.cpp @@ -247,6 +247,11 @@ Panels::PluginSelectorPanel::~PluginSelectorPanel() CancelRefresh(); // in case the enumeration thread is currently refreshing... } +void Panels::PluginSelectorPanel::ReloadSettings() +{ + m_ComponentBoxes.GetDirPicker().Reset(); +} + void Panels::PluginSelectorPanel::Apply( AppConfig& conf ) { // user never entered plugins panel? Skip application since combo boxes are invalid/uninitialized. @@ -370,6 +375,8 @@ void Panels::PluginSelectorPanel::OnEnumComplete( wxCommandEvent& evt ) void Panels::PluginSelectorPanel::OnProgress( wxCommandEvent& evt ) { + if( m_FileList == NULL ) return; + size_t evtidx = evt.GetExtraLong(); m_StatusPanel.AdvanceProgress( (evtidx < m_FileList->Count()-1) ? (*m_FileList)[evtidx + 1] : wxString(_("Completing tasks...")) diff --git a/pcsx2/gui/main.cpp b/pcsx2/gui/main.cpp index c8c51b31bf..790b67c444 100644 --- a/pcsx2/gui/main.cpp +++ b/pcsx2/gui/main.cpp @@ -31,12 +31,12 @@ IMPLEMENT_APP(Pcsx2App) -DEFINE_EVENT_TYPE( pxEVT_SemaphorePing ) - BEGIN_DECLARE_EVENT_TYPES() DECLARE_EVENT_TYPE( pxEVT_SemaphorePing, -1 ) END_DECLARE_EVENT_TYPES() +DEFINE_EVENT_TYPE( pxEVT_SemaphorePing ) + bool UseAdminMode = false; AppConfig* g_Conf = NULL; wxFileHistory* g_RecentIsoList = NULL; @@ -89,7 +89,7 @@ sptr AppEmuThread::ExecuteTask() if( result ) { - wxGetApp().PostMenuAction( Menu_Config_BIOS ); + wxGetApp().PostMenuAction( MenuId_Config_BIOS ); wxGetApp().Ping(); } } @@ -112,7 +112,7 @@ sptr AppEmuThread::ExecuteTask() if( result ) { g_Conf->SettingsTabName = L"Plugins"; - wxGetApp().PostMenuAction( Menu_Config_Settings ); + wxGetApp().PostMenuAction( MenuId_Config_Settings ); wxGetApp().Ping(); } } @@ -143,6 +143,8 @@ void Pcsx2App::OpenWizardConsole() m_ProgramLogBox = new ConsoleLogFrame( NULL, L"PCSX2 Program Log", g_Conf->ProgLogBox ); } +static bool m_ForceWizard = false; + // User mode settings can't be stores in the CWD for two reasons: // (a) the user may not have permission to do so (most obvious) // (b) it would result in sloppy usermode.ini found all over a hard drive if people runs the @@ -166,7 +168,7 @@ void Pcsx2App::ReadUserModeSettings() wxString groupname( wxsFormat( L"CWD.%08x", hashres ) ); - if( !conf_usermode->HasGroup( groupname ) ) + if( m_ForceWizard || !conf_usermode->HasGroup( groupname ) ) { // first time startup, so give the user the choice of user mode: OpenWizardConsole(); @@ -219,13 +221,15 @@ void Pcsx2App::OnInitCmdLine( wxCmdLineParser& parser ) parser.AddOption( L"bootmode", wxEmptyString, L"0 - quick (default), 1 - bios, 2 - load elf", wxCMD_LINE_VAL_NUMBER ); parser.AddOption( wxEmptyString,L"cfg", L"configuration file override", wxCMD_LINE_VAL_STRING ); + + parser.AddSwitch( L"forcewiz", wxEmptyString, L"Forces PCSX2 to start the First-time Wizard" ); - parser.AddOption( wxEmptyString, L"cdvd", L"uses filename as the CDVD plugin for this session only." ); - parser.AddOption( wxEmptyString, L"gs", L"uses filename as the GS plugin for this session only." ); - parser.AddOption( wxEmptyString, L"spu", L"uses filename as the SPU2 plugin for this session only." ); - parser.AddOption( wxEmptyString, L"pad", L"uses filename as the PAD plugin for this session only." ); - parser.AddOption( wxEmptyString, L"dev9", L"uses filename as the DEV9 plugin for this session only." ); - parser.AddOption( wxEmptyString, L"usb", L"uses filename as the USB plugin for this session only." ); + parser.AddOption( wxEmptyString, L"cdvd", L"specify the CDVD plugin for this session only." ); + parser.AddOption( wxEmptyString, L"gs", L"specify the GS plugin for this session only." ); + parser.AddOption( wxEmptyString, L"spu", L"specify the SPU2 plugin for this session only." ); + parser.AddOption( wxEmptyString, L"pad", L"specify the PAD plugin for this session only." ); + parser.AddOption( wxEmptyString, L"dev9", L"specify the DEV9 plugin for this session only." ); + parser.AddOption( wxEmptyString, L"usb", L"specify the USB plugin for this session only." ); parser.SetSwitchChars( L"-" ); } @@ -241,7 +245,8 @@ bool Pcsx2App::OnCmdLineParsed(wxCmdLineParser& parser) // Suppress wxWidgets automatic options parsing since none of them pertain to Pcsx2 needs. //wxApp::OnCmdLineParsed( parser ); - bool yay = parser.Found(L"nogui"); + //bool yay = parser.Found(L"nogui"); + m_ForceWizard = parser.Found( L"forcewiz" ); return true; } diff --git a/pcsx2/ps2/CoreEmuThread.cpp b/pcsx2/ps2/CoreEmuThread.cpp index e966a11b8a..a84570a47c 100644 --- a/pcsx2/ps2/CoreEmuThread.cpp +++ b/pcsx2/ps2/CoreEmuThread.cpp @@ -98,7 +98,7 @@ sptr CoreEmuThread::ExecuteTask() { tls_coreThread = this; - while( !m_Done && (m_ExecMode != ExecMode_Running) ) + while( m_ExecMode != ExecMode_Running ) { m_ResumeEvent.Wait(); } @@ -112,37 +112,35 @@ sptr CoreEmuThread::ExecuteTask() void CoreEmuThread::StateCheck() { + switch( m_ExecMode ) { - ScopedLock locker( m_lock_ExecMode ); + case ExecMode_Idle: + // threads should never have an idle execution state set while the + // thread is in any way active or alive. + DevAssert( false, "Invalid execution state detected." ); + break; - switch( m_ExecMode ) + // These are not the case statements you're looking for. Move along. + case ExecMode_Running: + pthread_testcancel(); + break; + + case ExecMode_Suspending: { - case ExecMode_Idle: - // threads should never have an idle execution state set while the - // thread is in any way active or alive. - DevAssert( false, "Invalid execution state detected." ); - break; - - // These are not the case statements you're looking for. Move along. - case ExecMode_Running: break; - case ExecMode_Suspended: break; - - case ExecMode_Suspending: - m_ExecMode = ExecMode_Suspended; - m_SuspendEvent.Post(); - break; + ScopedLock locker( m_lock_ExecMode ); + m_ExecMode = ExecMode_Suspended; + m_SuspendEvent.Post(); } - } - while( (m_ExecMode == ExecMode_Suspended) && !m_Done ) - { - m_ResumeEvent.Wait(); + case ExecMode_Suspended: + while( m_ExecMode == ExecMode_Suspended ) + m_ResumeEvent.Wait(); + break; } } CoreEmuThread::CoreEmuThread( const wxString& elf_file ) : m_ExecMode( ExecMode_Idle ) -, m_Done( false ) , m_ResumeEvent() , m_SuspendEvent() , m_resetRecompilers( false ) @@ -163,6 +161,7 @@ void CoreEmuThread::DoThreadCleanup() CoreEmuThread::~CoreEmuThread() { + PersistentThread::Cancel(); } // Resumes the core execution state, or does nothing is the core is already running. If @@ -194,11 +193,11 @@ void CoreEmuThread::Resume() return; } } - - DevAssert( (m_ExecMode == ExecMode_Suspended) || (m_ExecMode == ExecMode_Idle), - "EmuCoreThread is not in a suspended or idle state? wtf!" ); } + DevAssert( (m_ExecMode == ExecMode_Suspended) || (m_ExecMode == ExecMode_Idle), + "EmuCoreThread is not in a suspended or idle state? wtf!" ); + if( m_resetRecompilers || m_resetProfilers ) { SysClearExecutionCache(); diff --git a/pcsx2/ps2/CoreEmuThread.h b/pcsx2/ps2/CoreEmuThread.h index 766975af7a..9cc6726a70 100644 --- a/pcsx2/ps2/CoreEmuThread.h +++ b/pcsx2/ps2/CoreEmuThread.h @@ -38,7 +38,6 @@ public: protected: volatile ExecutionMode m_ExecMode; - volatile bool m_Done; Semaphore m_ResumeEvent; Semaphore m_SuspendEvent;