2015-05-24 04:55:12 +00:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-17 23:08:10 +00:00
|
|
|
// Licensed under GPLv2+
|
2013-04-18 03:43:35 +00:00
|
|
|
// Refer to the license.txt file included.
|
2009-02-23 06:15:48 +00:00
|
|
|
|
2016-08-14 19:54:01 +00:00
|
|
|
#include <array>
|
2017-06-13 23:22:03 +00:00
|
|
|
#include <chrono>
|
|
|
|
#include <cinttypes>
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <cstdarg>
|
|
|
|
#include <cstdio>
|
2017-06-13 23:22:03 +00:00
|
|
|
#include <future>
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <mutex>
|
2017-12-25 17:07:29 +00:00
|
|
|
#include <optional>
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <wx/app.h>
|
2016-06-24 08:43:46 +00:00
|
|
|
#include <wx/aui/framemanager.h>
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <wx/bitmap.h>
|
|
|
|
#include <wx/filedlg.h>
|
|
|
|
#include <wx/filefn.h>
|
|
|
|
#include <wx/menu.h>
|
|
|
|
#include <wx/msgdlg.h>
|
|
|
|
#include <wx/panel.h>
|
|
|
|
#include <wx/progdlg.h>
|
|
|
|
#include <wx/statusbr.h>
|
2014-08-08 22:02:35 +00:00
|
|
|
#include <wx/toolbar.h>
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <wx/toplevel.h>
|
2010-06-03 18:05:08 +00:00
|
|
|
|
2014-02-22 22:36:30 +00:00
|
|
|
#include "Common/CDUtils.h"
|
2017-05-21 21:21:34 +00:00
|
|
|
#include "Common/CommonPaths.h"
|
2014-09-08 01:06:58 +00:00
|
|
|
#include "Common/CommonTypes.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "Common/FileSearch.h"
|
|
|
|
#include "Common/FileUtil.h"
|
2014-02-21 00:47:53 +00:00
|
|
|
#include "Common/NandPaths.h"
|
2015-12-19 13:36:09 +00:00
|
|
|
#include "Common/StringUtil.h"
|
2017-09-09 19:52:35 +00:00
|
|
|
#include "Common/Version.h"
|
2010-06-03 18:05:08 +00:00
|
|
|
|
2017-05-27 13:43:40 +00:00
|
|
|
#include "Core/Boot/Boot.h"
|
2014-02-19 01:56:29 +00:00
|
|
|
#include "Core/BootManager.h"
|
2017-06-15 21:20:30 +00:00
|
|
|
#include "Core/CommonTitles.h"
|
2014-02-19 01:56:29 +00:00
|
|
|
#include "Core/ConfigManager.h"
|
|
|
|
#include "Core/Core.h"
|
|
|
|
#include "Core/HW/CPU.h"
|
2017-03-24 18:17:52 +00:00
|
|
|
#include "Core/HW/DVD/DVDInterface.h"
|
2015-03-05 08:49:10 +00:00
|
|
|
#include "Core/HW/GCKeyboard.h"
|
2014-02-19 01:56:29 +00:00
|
|
|
#include "Core/HW/GCPad.h"
|
|
|
|
#include "Core/HW/ProcessorInterface.h"
|
2017-01-20 23:45:11 +00:00
|
|
|
#include "Core/HW/SI/SI_Device.h"
|
2014-09-07 13:57:49 +00:00
|
|
|
#include "Core/HW/WiiSaveCrypted.h"
|
2016-06-24 08:43:46 +00:00
|
|
|
#include "Core/HW/Wiimote.h"
|
|
|
|
#include "Core/Host.h"
|
|
|
|
#include "Core/HotkeyManager.h"
|
2017-05-07 14:43:27 +00:00
|
|
|
#include "Core/IOS/ES/ES.h"
|
2017-04-29 14:11:22 +00:00
|
|
|
#include "Core/IOS/IOS.h"
|
2017-01-18 12:50:28 +00:00
|
|
|
#include "Core/IOS/STM/STM.h"
|
|
|
|
#include "Core/IOS/USB/Bluetooth/BTEmu.h"
|
|
|
|
#include "Core/IOS/USB/Bluetooth/WiimoteDevice.h"
|
2016-06-24 08:43:46 +00:00
|
|
|
#include "Core/Movie.h"
|
2014-10-26 10:19:22 +00:00
|
|
|
#include "Core/PowerPC/PPCSymbolDB.h"
|
2016-06-24 08:43:46 +00:00
|
|
|
#include "Core/PowerPC/PowerPC.h"
|
|
|
|
#include "Core/State.h"
|
2017-11-02 16:34:04 +00:00
|
|
|
#include "Core/TitleDatabase.h"
|
2017-06-12 11:24:03 +00:00
|
|
|
#include "Core/WiiUtils.h"
|
2014-02-19 01:56:29 +00:00
|
|
|
|
2017-05-27 13:43:40 +00:00
|
|
|
#include "DiscIO/Enums.h"
|
2017-03-19 07:00:49 +00:00
|
|
|
#include "DiscIO/NANDImporter.h"
|
2017-04-25 21:29:48 +00:00
|
|
|
#include "DiscIO/VolumeWad.h"
|
2017-11-02 16:34:04 +00:00
|
|
|
#include "DiscIO/WiiSaveBanner.h"
|
2011-01-31 07:38:36 +00:00
|
|
|
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "DolphinWX/AboutDolphin.h"
|
2016-06-24 08:43:46 +00:00
|
|
|
#include "DolphinWX/Cheats/CheatsWindow.h"
|
|
|
|
#include "DolphinWX/Config/ConfigMain.h"
|
2014-11-22 21:39:48 +00:00
|
|
|
#include "DolphinWX/ControllerConfigDiag.h"
|
2016-06-24 08:43:46 +00:00
|
|
|
#include "DolphinWX/Debugger/BreakpointWindow.h"
|
|
|
|
#include "DolphinWX/Debugger/CodeWindow.h"
|
|
|
|
#include "DolphinWX/Debugger/WatchWindow.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "DolphinWX/FifoPlayerDlg.h"
|
|
|
|
#include "DolphinWX/Frame.h"
|
|
|
|
#include "DolphinWX/GameListCtrl.h"
|
|
|
|
#include "DolphinWX/Globals.h"
|
2016-11-19 00:54:06 +00:00
|
|
|
#include "DolphinWX/Input/HotkeyInputConfigDiag.h"
|
2016-11-18 07:03:06 +00:00
|
|
|
#include "DolphinWX/Input/InputConfigDiag.h"
|
2014-02-19 01:56:29 +00:00
|
|
|
#include "DolphinWX/LogWindow.h"
|
2016-10-14 18:52:18 +00:00
|
|
|
#include "DolphinWX/MainMenuBar.h"
|
2016-10-22 01:41:17 +00:00
|
|
|
#include "DolphinWX/MainToolBar.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "DolphinWX/MemcardManager.h"
|
2016-06-24 08:43:46 +00:00
|
|
|
#include "DolphinWX/NetPlay/NetPlaySetupFrame.h"
|
|
|
|
#include "DolphinWX/NetPlay/NetWindow.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "DolphinWX/TASInputDlg.h"
|
2016-11-06 13:48:12 +00:00
|
|
|
#include "DolphinWX/WxEventUtils.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "DolphinWX/WxUtils.h"
|
2014-02-22 22:36:30 +00:00
|
|
|
|
|
|
|
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
2010-06-03 18:05:08 +00:00
|
|
|
|
2017-12-31 19:33:36 +00:00
|
|
|
#include "UICommon/GameFile.h"
|
2017-06-24 19:41:53 +00:00
|
|
|
#include "UICommon/UICommon.h"
|
2017-05-13 22:15:12 +00:00
|
|
|
|
2016-08-13 12:08:53 +00:00
|
|
|
#include "VideoCommon/RenderBase.h"
|
2014-02-19 01:56:29 +00:00
|
|
|
#include "VideoCommon/VideoBackendBase.h"
|
2014-07-21 15:55:21 +00:00
|
|
|
#include "VideoCommon/VideoConfig.h"
|
2009-02-23 06:15:48 +00:00
|
|
|
|
2014-08-31 04:04:15 +00:00
|
|
|
class InputConfig;
|
2014-02-22 22:36:30 +00:00
|
|
|
class wxFrame;
|
|
|
|
|
2014-09-06 05:15:10 +00:00
|
|
|
// This override allows returning a fake menubar object while removing the real one from the screen
|
|
|
|
wxMenuBar* CFrame::GetMenuBar() const
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
if (m_frameMenuBar)
|
|
|
|
{
|
|
|
|
return m_frameMenuBar;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return m_menubar_shadow;
|
|
|
|
}
|
2014-09-06 05:15:10 +00:00
|
|
|
}
|
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
// Create menu items
|
2009-09-08 16:07:13 +00:00
|
|
|
// ---------------------
|
2016-10-14 18:52:18 +00:00
|
|
|
wxMenuBar* CFrame::CreateMenuBar() const
|
|
|
|
{
|
|
|
|
const auto menu_type =
|
2017-05-01 00:11:01 +00:00
|
|
|
m_use_debugger ? MainMenuBar::MenuType::Debug : MainMenuBar::MenuType::Regular;
|
2016-10-14 18:52:18 +00:00
|
|
|
|
|
|
|
return new MainMenuBar{menu_type};
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::BindMenuBarEvents()
|
|
|
|
{
|
|
|
|
// File menu
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnOpen, this, wxID_OPEN);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnChangeDisc, this, IDM_CHANGE_DISC);
|
2017-09-17 09:35:26 +00:00
|
|
|
Bind(wxEVT_MENU, &CFrame::OnEjectDisc, this, IDM_EJECT_DISC);
|
2016-10-14 18:52:18 +00:00
|
|
|
Bind(wxEVT_MENU, &CFrame::OnBootDrive, this, IDM_DRIVE1, IDM_DRIVE24);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnRefresh, this, wxID_REFRESH);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnQuit, this, wxID_EXIT);
|
|
|
|
|
|
|
|
// Emulation menu
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnPlay, this, IDM_PLAY);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnStop, this, IDM_STOP);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnReset, this, IDM_RESET);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnToggleFullscreen, this, IDM_TOGGLE_FULLSCREEN);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnFrameStep, this, IDM_FRAMESTEP);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnScreenshot, this, IDM_SCREENSHOT);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnLoadStateFromFile, this, IDM_LOAD_STATE_FILE);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnLoadCurrentSlot, this, IDM_LOAD_SELECTED_SLOT);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnUndoLoadState, this, IDM_UNDO_LOAD_STATE);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnLoadState, this, IDM_LOAD_SLOT_1, IDM_LOAD_SLOT_10);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnLoadLastState, this, IDM_LOAD_LAST_1, IDM_LOAD_LAST_10);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnSaveStateToFile, this, IDM_SAVE_STATE_FILE);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnSaveCurrentSlot, this, IDM_SAVE_SELECTED_SLOT);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnSaveFirstState, this, IDM_SAVE_FIRST_STATE);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnUndoSaveState, this, IDM_UNDO_SAVE_STATE);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnSaveState, this, IDM_SAVE_SLOT_1, IDM_SAVE_SLOT_10);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnSelectSlot, this, IDM_SELECT_SLOT_1, IDM_SELECT_SLOT_10);
|
|
|
|
|
|
|
|
// Movie menu
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnRecord, this, IDM_RECORD);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnPlayRecording, this, IDM_PLAY_RECORD);
|
2017-02-11 19:39:07 +00:00
|
|
|
Bind(wxEVT_MENU, &CFrame::OnStopRecording, this, IDM_STOP_RECORD);
|
2016-10-14 18:52:18 +00:00
|
|
|
Bind(wxEVT_MENU, &CFrame::OnRecordExport, this, IDM_RECORD_EXPORT);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnRecordReadOnly, this, IDM_RECORD_READ_ONLY);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnTASInput, this, IDM_TAS_INPUT);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnTogglePauseMovie, this, IDM_TOGGLE_PAUSE_MOVIE);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnShowLag, this, IDM_SHOW_LAG);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnShowFrameCount, this, IDM_SHOW_FRAME_COUNT);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnShowInputDisplay, this, IDM_SHOW_INPUT_DISPLAY);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnShowRTCDisplay, this, IDM_SHOW_RTC_DISPLAY);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnToggleDumpFrames, this, IDM_TOGGLE_DUMP_FRAMES);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnToggleDumpAudio, this, IDM_TOGGLE_DUMP_AUDIO);
|
|
|
|
|
|
|
|
// Options menu
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnConfigMain, this, wxID_PREFERENCES);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnConfigGFX, this, IDM_CONFIG_GFX_BACKEND);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnConfigAudio, this, IDM_CONFIG_AUDIO);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnConfigControllers, this, IDM_CONFIG_CONTROLLERS);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnConfigHotkey, this, IDM_CONFIG_HOTKEYS);
|
|
|
|
|
|
|
|
// Tools menu
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnMemcard, this, IDM_MEMCARD);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnImportSave, this, IDM_IMPORT_SAVE);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnExportAllSaves, this, IDM_EXPORT_ALL_SAVE);
|
2017-06-04 08:20:16 +00:00
|
|
|
Bind(wxEVT_MENU, &CFrame::OnLoadGameCubeIPLJAP, this, IDM_LOAD_GC_IPL_JAP);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnLoadGameCubeIPLUSA, this, IDM_LOAD_GC_IPL_USA);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnLoadGameCubeIPLEUR, this, IDM_LOAD_GC_IPL_EUR);
|
2016-10-14 18:52:18 +00:00
|
|
|
Bind(wxEVT_MENU, &CFrame::OnShowCheatsWindow, this, IDM_CHEATS);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnNetPlay, this, IDM_NETPLAY);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnInstallWAD, this, IDM_MENU_INSTALL_WAD);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnLoadWiiMenu, this, IDM_LOAD_WII_MENU);
|
2017-03-19 07:00:49 +00:00
|
|
|
Bind(wxEVT_MENU, &CFrame::OnImportBootMiiBackup, this, IDM_IMPORT_NAND);
|
2017-10-03 14:45:59 +00:00
|
|
|
Bind(wxEVT_MENU, &CFrame::OnCheckNAND, this, IDM_CHECK_NAND);
|
2017-03-19 07:00:49 +00:00
|
|
|
Bind(wxEVT_MENU, &CFrame::OnExtractCertificates, this, IDM_EXTRACT_CERTIFICATES);
|
2017-06-13 23:22:03 +00:00
|
|
|
for (const int idm : {IDM_PERFORM_ONLINE_UPDATE_CURRENT, IDM_PERFORM_ONLINE_UPDATE_EUR,
|
|
|
|
IDM_PERFORM_ONLINE_UPDATE_JPN, IDM_PERFORM_ONLINE_UPDATE_KOR,
|
|
|
|
IDM_PERFORM_ONLINE_UPDATE_USA})
|
|
|
|
{
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnPerformOnlineWiiUpdate, this, idm);
|
|
|
|
}
|
2016-10-14 18:52:18 +00:00
|
|
|
Bind(wxEVT_MENU, &CFrame::OnFifoPlayer, this, IDM_FIFOPLAYER);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnConnectWiimote, this, IDM_CONNECT_WIIMOTE1, IDM_CONNECT_BALANCEBOARD);
|
|
|
|
|
|
|
|
// View menu
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnToggleToolbar, this, IDM_TOGGLE_TOOLBAR);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnToggleStatusbar, this, IDM_TOGGLE_STATUSBAR);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnToggleWindow, this, IDM_LOG_WINDOW, IDM_VIDEO_WINDOW);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::GameListChanged, this, IDM_LIST_WAD, IDM_LIST_DRIVES);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::GameListChanged, this, IDM_PURGE_GAME_LIST_CACHE);
|
2017-06-16 02:29:26 +00:00
|
|
|
Bind(wxEVT_MENU, &CFrame::OnChangeColumnsVisible, this, IDM_SHOW_SYSTEM, IDM_SHOW_SIZE);
|
2016-10-14 18:52:18 +00:00
|
|
|
|
2016-11-03 22:02:53 +00:00
|
|
|
// Help menu
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnHelp, this, IDM_HELP_WEBSITE);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnHelp, this, IDM_HELP_ONLINE_DOCS);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnHelp, this, IDM_HELP_GITHUB);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnHelp, this, wxID_ABOUT);
|
|
|
|
|
2017-05-01 00:11:01 +00:00
|
|
|
if (m_use_debugger)
|
2016-11-03 22:02:53 +00:00
|
|
|
BindDebuggerMenuBarEvents();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::BindDebuggerMenuBarEvents()
|
|
|
|
{
|
2016-10-14 18:52:18 +00:00
|
|
|
// Debug menu
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnPerspectiveMenu, this, IDM_SAVE_PERSPECTIVE);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnPerspectiveMenu, this, IDM_EDIT_PERSPECTIVES);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnPerspectiveMenu, this, IDM_PERSPECTIVES_ADD_PANE_TOP);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnPerspectiveMenu, this, IDM_PERSPECTIVES_ADD_PANE_BOTTOM);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnPerspectiveMenu, this, IDM_PERSPECTIVES_ADD_PANE_LEFT);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnPerspectiveMenu, this, IDM_PERSPECTIVES_ADD_PANE_RIGHT);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnPerspectiveMenu, this, IDM_PERSPECTIVES_ADD_PANE_CENTER);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnSelectPerspective, this, IDM_PERSPECTIVES_0, IDM_PERSPECTIVES_100);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnPerspectiveMenu, this, IDM_ADD_PERSPECTIVE);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnPerspectiveMenu, this, IDM_TAB_SPLIT);
|
|
|
|
Bind(wxEVT_MENU, &CFrame::OnPerspectiveMenu, this, IDM_NO_DOCKING);
|
|
|
|
|
2016-11-03 22:02:53 +00:00
|
|
|
BindDebuggerMenuBarUpdateEvents();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::BindDebuggerMenuBarUpdateEvents()
|
|
|
|
{
|
2016-11-06 13:48:12 +00:00
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCPUCanStep, IDM_STEP);
|
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCPUCanStep, IDM_STEPOUT);
|
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCPUCanStep, IDM_STEPOVER);
|
2016-11-03 22:02:53 +00:00
|
|
|
|
2016-11-04 03:43:35 +00:00
|
|
|
Bind(wxEVT_UPDATE_UI, &CFrame::OnUpdateInterpreterMenuItem, this, IDM_INTERPRETER);
|
|
|
|
|
2017-07-28 04:33:50 +00:00
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreRunning, IDM_JIT_OFF);
|
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreRunning, IDM_JIT_LS_OFF);
|
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreRunning, IDM_JIT_LSLXZ_OFF);
|
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreRunning, IDM_JIT_LSLWZ_OFF);
|
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreRunning, IDM_JIT_LSLBZX_OFF);
|
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreRunning, IDM_JIT_LSF_OFF);
|
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreRunning, IDM_JIT_LSP_OFF);
|
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreRunning, IDM_JIT_FP_OFF);
|
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreRunning, IDM_JIT_I_OFF);
|
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreRunning, IDM_JIT_P_OFF);
|
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreRunning, IDM_JIT_SR_OFF);
|
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreRunning, IDM_CLEAR_CODE_CACHE);
|
2016-11-06 13:48:12 +00:00
|
|
|
|
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreInitialized, IDM_SEARCH_INSTRUCTION);
|
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreInitialized, IDM_CLEAR_SYMBOLS);
|
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreInitialized, IDM_SCAN_FUNCTIONS);
|
2017-03-25 00:52:17 +00:00
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreInitialized, IDM_SCAN_SIGNATURES);
|
2017-03-28 00:58:22 +00:00
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreInitialized, IDM_SCAN_RSO);
|
2016-11-06 13:48:12 +00:00
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreInitialized, IDM_LOAD_MAP_FILE);
|
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreInitialized, IDM_SAVEMAPFILE);
|
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreInitialized, IDM_LOAD_MAP_FILE_AS);
|
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreInitialized, IDM_SAVE_MAP_FILE_AS);
|
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreInitialized, IDM_LOAD_BAD_MAP_FILE);
|
2017-05-19 14:04:11 +00:00
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCorePaused, IDM_SAVE_MAP_FILE_WITH_CODES);
|
2016-11-06 13:48:12 +00:00
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreInitialized, IDM_CREATE_SIGNATURE_FILE);
|
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreInitialized, IDM_APPEND_SIGNATURE_FILE);
|
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreInitialized, IDM_COMBINE_SIGNATURE_FILES);
|
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreInitialized, IDM_RENAME_SYMBOLS);
|
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreInitialized, IDM_USE_SIGNATURE_FILE);
|
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreInitialized, IDM_PATCH_HLE_FUNCTIONS);
|
|
|
|
|
|
|
|
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreUninitialized, IDM_JIT_NO_BLOCK_CACHE);
|
2010-04-12 01:33:10 +00:00
|
|
|
}
|
2009-09-02 21:00:45 +00:00
|
|
|
|
2016-10-22 01:41:17 +00:00
|
|
|
wxToolBar* CFrame::OnCreateToolBar(long style, wxWindowID id, const wxString& name)
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2016-10-22 01:41:17 +00:00
|
|
|
const auto type =
|
2017-05-01 00:11:01 +00:00
|
|
|
m_use_debugger ? MainToolBar::ToolBarType::Debug : MainToolBar::ToolBarType::Regular;
|
2009-02-23 06:15:48 +00:00
|
|
|
|
2016-10-22 01:41:17 +00:00
|
|
|
return new MainToolBar{type, this, id, wxDefaultPosition, wxDefaultSize, style};
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
2016-11-06 00:53:40 +00:00
|
|
|
void CFrame::OpenGeneralConfiguration(wxWindowID tab_id)
|
2016-07-23 01:05:22 +00:00
|
|
|
{
|
2017-04-16 11:00:11 +00:00
|
|
|
if (!m_main_config_dialog)
|
|
|
|
m_main_config_dialog = new CConfigMain(this);
|
2016-11-06 00:53:40 +00:00
|
|
|
if (tab_id > wxID_ANY)
|
|
|
|
m_main_config_dialog->SetSelectedTab(tab_id);
|
2016-07-23 01:05:22 +00:00
|
|
|
|
2016-11-06 00:53:40 +00:00
|
|
|
m_main_config_dialog->Show();
|
|
|
|
m_main_config_dialog->SetFocus();
|
2016-07-23 01:05:22 +00:00
|
|
|
}
|
|
|
|
|
2009-08-25 07:49:23 +00:00
|
|
|
// Menu items
|
|
|
|
|
2010-01-18 12:10:51 +00:00
|
|
|
// Start the game or change the disc.
|
|
|
|
// Boot priority:
|
2010-01-18 18:21:27 +00:00
|
|
|
// 1. Show the game list and boot the selected game.
|
|
|
|
// 2. Default ISO
|
2010-01-18 12:10:51 +00:00
|
|
|
// 3. Boot last selected game
|
2017-12-25 17:07:29 +00:00
|
|
|
void CFrame::BootGame(const std::string& filename, const std::optional<std::string>& savestate_path)
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
std::string bootfile = filename;
|
|
|
|
SConfig& StartUp = SConfig::GetInstance();
|
|
|
|
|
2017-02-05 12:39:58 +00:00
|
|
|
if (Core::GetState() != Core::State::Uninitialized)
|
2016-06-24 08:43:46 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
// Start filename if non empty.
|
|
|
|
// Start the selected ISO, or try one of the saved paths.
|
|
|
|
// If all that fails, ask to add a dir and don't boot
|
|
|
|
if (bootfile.empty())
|
|
|
|
{
|
2017-05-01 00:11:01 +00:00
|
|
|
if (m_game_list_ctrl->GetSelectedISO() != nullptr)
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
2017-05-01 00:11:01 +00:00
|
|
|
if (m_game_list_ctrl->GetSelectedISO()->IsValid())
|
2017-12-31 19:33:36 +00:00
|
|
|
bootfile = m_game_list_ctrl->GetSelectedISO()->GetFilePath();
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
else if (!StartUp.m_strDefaultISO.empty() && File::Exists(StartUp.m_strDefaultISO))
|
|
|
|
{
|
|
|
|
bootfile = StartUp.m_strDefaultISO;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-05-27 10:15:07 +00:00
|
|
|
m_game_list_ctrl->BrowseForDirectory();
|
|
|
|
return;
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!bootfile.empty())
|
|
|
|
{
|
2017-12-25 17:07:29 +00:00
|
|
|
StartGame(BootParameters::GenerateFromFile(bootfile, savestate_path));
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
2009-06-18 08:22:02 +00:00
|
|
|
// Open file to boot
|
2016-06-24 08:43:46 +00:00
|
|
|
void CFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2017-02-05 12:39:58 +00:00
|
|
|
if (Core::GetState() == Core::State::Uninitialized)
|
2016-06-24 08:43:46 +00:00
|
|
|
DoOpen(true);
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::DoOpen(bool Boot)
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
std::string currentDir = File::GetCurrentDir();
|
2009-02-24 07:18:08 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
wxString path = wxFileSelector(
|
|
|
|
_("Select the file to load"), wxEmptyString, wxEmptyString, wxEmptyString,
|
2017-05-28 17:08:24 +00:00
|
|
|
_("All GC/Wii files (elf, dol, gcm, iso, tgc, wbfs, ciso, gcz, wad, dff)") +
|
2017-05-28 17:07:12 +00:00
|
|
|
wxString::Format("|*.elf;*.dol;*.gcm;*.iso;*.tgc;*.wbfs;*.ciso;*.gcz;*.wad;*.dff|%s",
|
|
|
|
wxGetTranslation(wxALL_FILES)),
|
2016-06-24 08:43:46 +00:00
|
|
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST, this);
|
2009-06-18 08:22:02 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
if (path.IsEmpty())
|
|
|
|
return;
|
2012-08-05 14:53:36 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
std::string currentDir2 = File::GetCurrentDir();
|
2009-02-24 07:18:08 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
if (currentDir != currentDir2)
|
|
|
|
{
|
|
|
|
PanicAlertT("Current directory changed from %s to %s after wxFileSelector!", currentDir.c_str(),
|
|
|
|
currentDir2.c_str());
|
|
|
|
File::SetCurrentDir(currentDir);
|
|
|
|
}
|
2009-02-24 07:18:08 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
// Should we boot a new game or just change the disc?
|
|
|
|
if (Boot && !path.IsEmpty())
|
|
|
|
{
|
|
|
|
BootGame(WxStrToStr(path));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-09-17 09:12:02 +00:00
|
|
|
Core::RunAsCPUThread([&path] { DVDInterface::ChangeDisc(WxStrToStr(path)); });
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
2011-02-12 02:14:20 +00:00
|
|
|
void CFrame::OnRecordReadOnly(wxCommandEvent& event)
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
Movie::SetReadOnly(event.IsChecked());
|
2011-06-24 06:50:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnTASInput(wxCommandEvent& event)
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
for (int i = 0; i < 4; ++i)
|
|
|
|
{
|
2017-03-16 08:41:36 +00:00
|
|
|
if (SConfig::GetInstance().m_SIDevice[i] != SerialInterface::SIDEVICE_NONE &&
|
|
|
|
SConfig::GetInstance().m_SIDevice[i] != SerialInterface::SIDEVICE_GC_GBA)
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
2017-04-02 06:34:38 +00:00
|
|
|
m_tas_input_dialogs[i]->CreateGCLayout();
|
|
|
|
m_tas_input_dialogs[i]->Show();
|
|
|
|
m_tas_input_dialogs[i]->SetTitle(
|
|
|
|
wxString::Format(_("TAS Input - GameCube Controller %d"), i + 1));
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
2014-11-02 07:10:00 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
if (g_wiimote_sources[i] == WIIMOTE_SRC_EMU &&
|
|
|
|
!(Core::IsRunning() && !SConfig::GetInstance().bWii))
|
|
|
|
{
|
2017-04-02 06:34:38 +00:00
|
|
|
m_tas_input_dialogs[i + 4]->CreateWiiLayout(i);
|
|
|
|
m_tas_input_dialogs[i + 4]->Show();
|
|
|
|
m_tas_input_dialogs[i + 4]->SetTitle(wxString::Format(_("TAS Input - Wii Remote %d"), i + 1));
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
}
|
2011-02-12 02:14:20 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CFrame::OnTogglePauseMovie(wxCommandEvent& WXUNUSED(event))
|
2012-11-11 02:57:31 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
SConfig::GetInstance().m_PauseMovie = !SConfig::GetInstance().m_PauseMovie;
|
|
|
|
SConfig::GetInstance().SaveSettings();
|
2012-11-11 02:57:31 +00:00
|
|
|
}
|
2012-11-11 22:57:06 +00:00
|
|
|
|
2014-10-11 16:31:02 +00:00
|
|
|
void CFrame::OnToggleDumpFrames(wxCommandEvent& WXUNUSED(event))
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
SConfig::GetInstance().m_DumpFrames = !SConfig::GetInstance().m_DumpFrames;
|
|
|
|
SConfig::GetInstance().SaveSettings();
|
2014-10-11 16:31:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnToggleDumpAudio(wxCommandEvent& WXUNUSED(event))
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
SConfig::GetInstance().m_DumpAudio = !SConfig::GetInstance().m_DumpAudio;
|
2014-10-11 16:31:02 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CFrame::OnShowLag(wxCommandEvent& WXUNUSED(event))
|
2012-11-11 22:57:06 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
SConfig::GetInstance().m_ShowLag = !SConfig::GetInstance().m_ShowLag;
|
|
|
|
SConfig::GetInstance().SaveSettings();
|
2014-09-30 22:49:44 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CFrame::OnShowFrameCount(wxCommandEvent& WXUNUSED(event))
|
2014-09-30 22:49:44 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
SConfig::GetInstance().m_ShowFrameCount = !SConfig::GetInstance().m_ShowFrameCount;
|
|
|
|
SConfig::GetInstance().SaveSettings();
|
2014-10-18 01:08:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnShowInputDisplay(wxCommandEvent& WXUNUSED(event))
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
SConfig::GetInstance().m_ShowInputDisplay = !SConfig::GetInstance().m_ShowInputDisplay;
|
|
|
|
SConfig::GetInstance().SaveSettings();
|
2012-11-11 22:57:06 +00:00
|
|
|
}
|
|
|
|
|
2016-07-20 00:23:25 +00:00
|
|
|
void CFrame::OnShowRTCDisplay(wxCommandEvent& WXUNUSED(event))
|
|
|
|
{
|
|
|
|
SConfig::GetInstance().m_ShowRTC = !SConfig::GetInstance().m_ShowRTC;
|
|
|
|
SConfig::GetInstance().SaveSettings();
|
|
|
|
}
|
|
|
|
|
2009-08-22 02:05:02 +00:00
|
|
|
void CFrame::OnFrameStep(wxCommandEvent& event)
|
|
|
|
{
|
2017-02-05 12:39:58 +00:00
|
|
|
bool wasPaused = Core::GetState() == Core::State::Paused;
|
2011-12-12 05:08:26 +00:00
|
|
|
|
2017-07-01 20:17:18 +00:00
|
|
|
Core::DoFrameStep();
|
2011-12-12 05:08:26 +00:00
|
|
|
|
2017-02-05 12:39:58 +00:00
|
|
|
bool isPaused = Core::GetState() == Core::State::Paused;
|
2016-06-24 08:43:46 +00:00
|
|
|
if (isPaused && !wasPaused) // don't update on unpause, otherwise the status would be wrong when
|
|
|
|
// pausing next frame
|
|
|
|
UpdateGUI();
|
2009-08-22 02:05:02 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CFrame::OnChangeDisc(wxCommandEvent& WXUNUSED(event))
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
DoOpen(false);
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
2017-09-17 09:35:26 +00:00
|
|
|
void CFrame::OnEjectDisc(wxCommandEvent& WXUNUSED(event))
|
|
|
|
{
|
|
|
|
Core::RunAsCPUThread(DVDInterface::EjectDisc);
|
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CFrame::OnRecord(wxCommandEvent& WXUNUSED(event))
|
2009-08-21 09:26:34 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
if ((!Core::IsRunningAndStarted() && Core::IsRunning()) || Movie::IsRecordingInput() ||
|
|
|
|
Movie::IsPlayingInput())
|
|
|
|
return;
|
2014-07-08 21:18:37 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
int controllers = 0;
|
2013-10-29 05:23:17 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
if (Movie::IsReadOnly())
|
|
|
|
{
|
|
|
|
// The user just chose to record a movie, so that should take precedence
|
|
|
|
Movie::SetReadOnly(false);
|
|
|
|
GetMenuBar()->FindItem(IDM_RECORD_READ_ONLY)->Check(false);
|
|
|
|
}
|
2010-09-06 21:41:01 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
{
|
2017-03-16 08:41:36 +00:00
|
|
|
if (SerialInterface::SIDevice_IsGCController(SConfig::GetInstance().m_SIDevice[i]))
|
2016-06-24 08:43:46 +00:00
|
|
|
controllers |= (1 << i);
|
2011-02-11 19:09:46 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
if (g_wiimote_sources[i] != WIIMOTE_SRC_NONE)
|
|
|
|
controllers |= (1 << (i + 4));
|
|
|
|
}
|
2010-09-06 21:41:01 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
if (Movie::BeginRecordingInput(controllers))
|
|
|
|
BootGame("");
|
2009-08-21 19:55:03 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CFrame::OnPlayRecording(wxCommandEvent& WXUNUSED(event))
|
2009-08-21 19:55:03 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
wxString path =
|
2017-11-02 13:32:16 +00:00
|
|
|
wxFileSelector(_("Select the Recording File"), wxEmptyString, wxEmptyString, wxEmptyString,
|
2016-06-24 08:43:46 +00:00
|
|
|
_("Dolphin TAS Movies (*.dtm)") +
|
|
|
|
wxString::Format("|*.dtm|%s", wxGetTranslation(wxALL_FILES)),
|
|
|
|
wxFD_OPEN | wxFD_PREVIEW | wxFD_FILE_MUST_EXIST, this);
|
2009-08-21 19:55:03 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
if (path.IsEmpty())
|
|
|
|
return;
|
2009-08-21 19:55:03 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
if (!Movie::IsReadOnly())
|
|
|
|
{
|
|
|
|
// let's make the read-only flag consistent at the start of a movie.
|
|
|
|
Movie::SetReadOnly(true);
|
|
|
|
GetMenuBar()->FindItem(IDM_RECORD_READ_ONLY)->Check();
|
|
|
|
}
|
2011-12-18 10:23:59 +00:00
|
|
|
|
2017-12-25 17:07:29 +00:00
|
|
|
std::optional<std::string> savestate_path;
|
|
|
|
if (Movie::PlayInput(WxStrToStr(path), &savestate_path))
|
|
|
|
BootGame("", savestate_path);
|
2009-08-21 09:26:34 +00:00
|
|
|
}
|
|
|
|
|
2017-02-11 19:39:07 +00:00
|
|
|
void CFrame::OnStopRecording(wxCommandEvent& WXUNUSED(event))
|
|
|
|
{
|
|
|
|
if (Movie::IsRecordingInput())
|
|
|
|
{
|
|
|
|
const bool was_paused = Core::GetState() == Core::State::Paused;
|
|
|
|
DoRecordingSave();
|
|
|
|
const bool is_paused = Core::GetState() == Core::State::Paused;
|
|
|
|
if (is_paused && !was_paused)
|
|
|
|
CPU::EnableStepping(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
Movie::EndPlayInput(false);
|
|
|
|
|
|
|
|
GetMenuBar()->FindItem(IDM_STOP_RECORD)->Enable(Movie::IsMovieActive());
|
|
|
|
GetMenuBar()->FindItem(IDM_RECORD)->Enable(!Movie::IsMovieActive());
|
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CFrame::OnRecordExport(wxCommandEvent& WXUNUSED(event))
|
2010-08-30 07:05:47 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
DoRecordingSave();
|
2010-08-30 07:05:47 +00:00
|
|
|
}
|
|
|
|
|
2017-02-06 19:48:09 +00:00
|
|
|
void CFrame::OnPlay(wxCommandEvent& event)
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
if (Core::IsRunning())
|
|
|
|
{
|
|
|
|
// Core is initialized and emulator is running
|
2017-05-01 00:11:01 +00:00
|
|
|
if (m_use_debugger)
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
2016-10-22 21:20:06 +00:00
|
|
|
bool was_stopped = CPU::IsStepping();
|
|
|
|
CPU::EnableStepping(!was_stopped);
|
|
|
|
// When the CPU stops it generates a IDM_UPDATE_DISASM_DIALOG which automatically refreshes
|
|
|
|
// the UI, the UI only needs to be refreshed manually when unpausing.
|
|
|
|
if (was_stopped)
|
|
|
|
{
|
2017-05-01 00:11:01 +00:00
|
|
|
m_code_window->Repopulate();
|
2016-10-22 21:20:06 +00:00
|
|
|
UpdateGUI();
|
|
|
|
}
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DoPause();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Core is uninitialized, start the game
|
2017-02-06 19:48:09 +00:00
|
|
|
BootGame(WxStrToStr(event.GetString()));
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
2010-01-18 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2010-04-12 01:33:10 +00:00
|
|
|
void CFrame::OnRenderParentClose(wxCloseEvent& event)
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
// Before closing the window we need to shut down the emulation core.
|
|
|
|
// We'll try to close this window again once that is done.
|
2017-02-05 12:39:58 +00:00
|
|
|
if (Core::GetState() != Core::State::Uninitialized)
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
|
|
|
DoStop();
|
|
|
|
if (event.CanVeto())
|
|
|
|
{
|
|
|
|
event.Veto();
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2014-06-20 01:03:00 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
event.Skip();
|
2010-04-12 01:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnRenderParentMove(wxMoveEvent& event)
|
|
|
|
{
|
2017-02-05 12:39:58 +00:00
|
|
|
if (Core::GetState() != Core::State::Uninitialized && !RendererIsFullscreen() &&
|
2017-05-01 00:11:01 +00:00
|
|
|
!m_render_frame->IsMaximized() && !m_render_frame->IsIconized())
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
2017-05-01 00:11:01 +00:00
|
|
|
SConfig::GetInstance().iRenderWindowXPos = m_render_frame->GetPosition().x;
|
|
|
|
SConfig::GetInstance().iRenderWindowYPos = m_render_frame->GetPosition().y;
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
event.Skip();
|
2010-04-12 01:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnRenderParentResize(wxSizeEvent& event)
|
|
|
|
{
|
2017-02-05 12:39:58 +00:00
|
|
|
if (Core::GetState() != Core::State::Uninitialized)
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
|
|
|
int width, height;
|
2018-02-27 11:32:20 +00:00
|
|
|
m_render_parent->GetClientSize(&width, &height);
|
2016-06-24 08:43:46 +00:00
|
|
|
if (!SConfig::GetInstance().bRenderToMain && !RendererIsFullscreen() &&
|
2017-05-01 00:11:01 +00:00
|
|
|
!m_render_frame->IsMaximized() && !m_render_frame->IsIconized())
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
|
|
|
SConfig::GetInstance().iRenderWindowWidth = width;
|
|
|
|
SConfig::GetInstance().iRenderWindowHeight = height;
|
|
|
|
}
|
2017-05-01 00:11:01 +00:00
|
|
|
m_log_window->Refresh();
|
|
|
|
m_log_window->Update();
|
2016-08-13 12:08:53 +00:00
|
|
|
|
|
|
|
if (g_renderer)
|
2018-01-26 06:23:24 +00:00
|
|
|
g_renderer->ResizeSurface(width, height);
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
event.Skip();
|
2010-04-12 01:33:10 +00:00
|
|
|
}
|
|
|
|
|
2010-10-17 12:42:04 +00:00
|
|
|
void CFrame::ToggleDisplayMode(bool bFullscreen)
|
2010-04-22 04:28:34 +00:00
|
|
|
{
|
|
|
|
#ifdef _WIN32
|
2016-06-24 08:43:46 +00:00
|
|
|
if (bFullscreen && SConfig::GetInstance().strFullscreenResolution != "Auto")
|
|
|
|
{
|
|
|
|
DEVMODE dmScreenSettings;
|
|
|
|
memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));
|
|
|
|
dmScreenSettings.dmSize = sizeof(dmScreenSettings);
|
|
|
|
sscanf(SConfig::GetInstance().strFullscreenResolution.c_str(), "%dx%d",
|
|
|
|
&dmScreenSettings.dmPelsWidth, &dmScreenSettings.dmPelsHeight);
|
|
|
|
dmScreenSettings.dmBitsPerPel = 32;
|
|
|
|
dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
|
|
|
|
|
|
|
|
// Try To Set Selected Mode And Get Results. NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.
|
|
|
|
ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Change to default resolution
|
|
|
|
ChangeDisplaySettings(nullptr, CDS_FULLSCREEN);
|
|
|
|
}
|
2010-04-22 04:28:34 +00:00
|
|
|
#elif defined(HAVE_XRANDR) && HAVE_XRANDR
|
2016-06-24 08:43:46 +00:00
|
|
|
if (SConfig::GetInstance().strFullscreenResolution != "Auto")
|
2017-05-01 00:11:01 +00:00
|
|
|
m_xrr_config->ToggleDisplayMode(bFullscreen);
|
2010-04-22 04:28:34 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2010-01-18 12:10:51 +00:00
|
|
|
// Prepare the GUI to start the game.
|
2017-05-27 13:43:40 +00:00
|
|
|
void CFrame::StartGame(std::unique_ptr<BootParameters> boot)
|
2010-01-18 12:10:51 +00:00
|
|
|
{
|
2017-05-01 00:11:01 +00:00
|
|
|
if (m_is_game_loading)
|
2016-06-24 08:43:46 +00:00
|
|
|
return;
|
2017-05-01 00:11:01 +00:00
|
|
|
m_is_game_loading = true;
|
2017-10-01 16:31:19 +00:00
|
|
|
wxPostEvent(GetMenuBar(), wxCommandEvent{DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM});
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2016-10-22 01:41:17 +00:00
|
|
|
GetToolBar()->EnableTool(IDM_PLAY, false);
|
2016-06-24 08:43:46 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_PLAY)->Enable(false);
|
|
|
|
|
|
|
|
if (SConfig::GetInstance().bRenderToMain)
|
|
|
|
{
|
|
|
|
// Game has been started, hide the game list
|
2017-05-01 00:11:01 +00:00
|
|
|
m_game_list_ctrl->Disable();
|
|
|
|
m_game_list_ctrl->Hide();
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2017-07-29 14:47:20 +00:00
|
|
|
m_renderer_has_focus = true;
|
2017-05-01 00:11:01 +00:00
|
|
|
m_render_parent = m_panel;
|
|
|
|
m_render_frame = this;
|
2016-06-24 08:43:46 +00:00
|
|
|
if (SConfig::GetInstance().bKeepWindowOnTop)
|
2017-05-01 00:11:01 +00:00
|
|
|
m_render_frame->SetWindowStyle(m_render_frame->GetWindowStyle() | wxSTAY_ON_TOP);
|
2016-06-24 08:43:46 +00:00
|
|
|
else
|
2017-05-01 00:11:01 +00:00
|
|
|
m_render_frame->SetWindowStyle(m_render_frame->GetWindowStyle() & ~wxSTAY_ON_TOP);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
// No, I really don't want TAB_TRAVERSAL being set behind my back,
|
|
|
|
// thanks. (Note that calling DisableSelfFocus would prevent this flag
|
|
|
|
// from being set for new children, but wouldn't reset the existing
|
|
|
|
// flag.)
|
2017-05-01 00:11:01 +00:00
|
|
|
m_render_parent->SetWindowStyle(m_render_parent->GetWindowStyle() & ~wxTAB_TRAVERSAL);
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-08-14 19:54:01 +00:00
|
|
|
wxRect window_geometry(
|
|
|
|
SConfig::GetInstance().iRenderWindowXPos, SConfig::GetInstance().iRenderWindowYPos,
|
|
|
|
SConfig::GetInstance().iRenderWindowWidth, SConfig::GetInstance().iRenderWindowHeight);
|
|
|
|
// Set window size in framebuffer pixels since the 3D rendering will be operating at
|
|
|
|
// that level.
|
|
|
|
wxSize default_size{wxSize(640, 480) * (1.0 / GetContentScaleFactor())};
|
2017-05-01 00:11:01 +00:00
|
|
|
m_render_frame =
|
2017-04-19 22:13:23 +00:00
|
|
|
new CRenderFrame(nullptr, wxID_ANY, _("Dolphin"), wxDefaultPosition, default_size);
|
2016-08-14 19:54:01 +00:00
|
|
|
|
|
|
|
// Convert ClientSize coordinates to frame sizes.
|
2017-05-01 00:11:01 +00:00
|
|
|
wxSize decoration_fudge = m_render_frame->GetSize() - m_render_frame->GetClientSize();
|
2016-08-14 19:54:01 +00:00
|
|
|
default_size += decoration_fudge;
|
|
|
|
if (!window_geometry.IsEmpty())
|
|
|
|
window_geometry.SetSize(window_geometry.GetSize() + decoration_fudge);
|
|
|
|
|
2017-05-01 00:11:01 +00:00
|
|
|
WxUtils::SetWindowSizeAndFitToScreen(m_render_frame, window_geometry.GetPosition(),
|
2016-08-14 19:54:01 +00:00
|
|
|
window_geometry.GetSize(), default_size);
|
2011-01-11 04:09:11 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
if (SConfig::GetInstance().bKeepWindowOnTop)
|
2017-05-01 00:11:01 +00:00
|
|
|
m_render_frame->SetWindowStyle(m_render_frame->GetWindowStyle() | wxSTAY_ON_TOP);
|
2016-06-24 08:43:46 +00:00
|
|
|
else
|
2017-05-01 00:11:01 +00:00
|
|
|
m_render_frame->SetWindowStyle(m_render_frame->GetWindowStyle() & ~wxSTAY_ON_TOP);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2017-05-01 00:11:01 +00:00
|
|
|
m_render_frame->SetBackgroundColour(*wxBLACK);
|
|
|
|
m_render_frame->Bind(wxEVT_CLOSE_WINDOW, &CFrame::OnRenderParentClose, this);
|
|
|
|
m_render_frame->Bind(wxEVT_ACTIVATE, &CFrame::OnActive, this);
|
|
|
|
m_render_frame->Bind(wxEVT_MOVE, &CFrame::OnRenderParentMove, this);
|
2014-08-04 11:02:19 +00:00
|
|
|
#ifdef _WIN32
|
2016-06-24 08:43:46 +00:00
|
|
|
// The renderer should use a top-level window for exclusive fullscreen support.
|
2017-05-01 00:11:01 +00:00
|
|
|
m_render_parent = m_render_frame;
|
2014-08-04 11:02:19 +00:00
|
|
|
#else
|
2016-06-24 08:43:46 +00:00
|
|
|
// To capture key events on Linux and Mac OS X the frame needs at least one child.
|
2017-05-01 00:11:01 +00:00
|
|
|
m_render_parent = new wxPanel(m_render_frame, IDM_MPANEL, wxDefaultPosition, wxDefaultSize, 0);
|
2014-08-04 11:02:19 +00:00
|
|
|
#endif
|
2017-05-01 00:11:01 +00:00
|
|
|
m_render_frame->Show();
|
2018-01-26 05:15:35 +00:00
|
|
|
m_render_frame->Raise();
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
2010-04-12 01:33:10 +00:00
|
|
|
|
2013-03-31 16:08:29 +00:00
|
|
|
#if defined(__APPLE__)
|
2017-05-01 00:11:01 +00:00
|
|
|
m_render_frame->EnableFullScreenView(true);
|
2013-03-31 16:08:29 +00:00
|
|
|
#endif
|
|
|
|
|
2016-08-14 19:54:01 +00:00
|
|
|
wxBusyCursor hourglass;
|
2017-05-14 20:49:25 +00:00
|
|
|
SetDebuggerStartupParameters();
|
|
|
|
|
2017-05-27 13:43:40 +00:00
|
|
|
if (!BootManager::BootCore(std::move(boot)))
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
|
|
|
// Destroy the renderer frame when not rendering to main
|
|
|
|
if (!SConfig::GetInstance().bRenderToMain)
|
2017-05-01 00:11:01 +00:00
|
|
|
m_render_frame->Destroy();
|
|
|
|
|
|
|
|
m_render_frame = nullptr;
|
|
|
|
m_render_parent = nullptr;
|
|
|
|
m_is_game_loading = false;
|
2016-06-24 08:43:46 +00:00
|
|
|
UpdateGUI();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-01-01 21:03:50 +00:00
|
|
|
EnableScreenSaver(false);
|
2016-07-07 00:00:33 +00:00
|
|
|
|
2016-07-19 01:55:09 +00:00
|
|
|
// We need this specifically to support setting the focus properly when using
|
|
|
|
// the 'render to main window' feature on Windows
|
2017-05-01 00:11:01 +00:00
|
|
|
if (auto panel = wxDynamicCast(m_render_parent, wxPanel))
|
2016-07-19 01:55:09 +00:00
|
|
|
{
|
|
|
|
panel->SetFocusIgnoringChildren();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-05-01 00:11:01 +00:00
|
|
|
m_render_parent->SetFocus();
|
2016-07-19 01:55:09 +00:00
|
|
|
}
|
2013-10-29 05:23:17 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
wxTheApp->Bind(wxEVT_KEY_DOWN, &CFrame::OnKeyDown, this);
|
|
|
|
wxTheApp->Bind(wxEVT_RIGHT_DOWN, &CFrame::OnMouse, this);
|
|
|
|
wxTheApp->Bind(wxEVT_RIGHT_UP, &CFrame::OnMouse, this);
|
|
|
|
wxTheApp->Bind(wxEVT_MIDDLE_DOWN, &CFrame::OnMouse, this);
|
|
|
|
wxTheApp->Bind(wxEVT_MIDDLE_UP, &CFrame::OnMouse, this);
|
|
|
|
wxTheApp->Bind(wxEVT_MOTION, &CFrame::OnMouse, this);
|
2017-05-01 00:11:01 +00:00
|
|
|
m_render_parent->Bind(wxEVT_SIZE, &CFrame::OnRenderParentResize, this);
|
2017-10-03 17:35:36 +00:00
|
|
|
|
|
|
|
m_render_parent->SetCursor(wxCURSOR_BLANK);
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
2017-05-14 20:49:25 +00:00
|
|
|
void CFrame::SetDebuggerStartupParameters() const
|
|
|
|
{
|
|
|
|
SConfig& config = SConfig::GetInstance();
|
|
|
|
|
|
|
|
if (m_use_debugger)
|
|
|
|
{
|
|
|
|
const wxMenuBar* const menu_bar = GetMenuBar();
|
|
|
|
|
|
|
|
config.bBootToPause = menu_bar->IsChecked(IDM_BOOT_TO_PAUSE);
|
|
|
|
config.bAutomaticStart = menu_bar->IsChecked(IDM_AUTOMATIC_START);
|
|
|
|
config.bJITNoBlockCache = menu_bar->IsChecked(IDM_JIT_NO_BLOCK_CACHE);
|
|
|
|
config.bJITNoBlockLinking = menu_bar->IsChecked(IDM_JIT_NO_BLOCK_LINKING);
|
|
|
|
config.bEnableDebugging = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
config.bBootToPause = false;
|
|
|
|
config.bEnableDebugging = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
void CFrame::OnBootDrive(wxCommandEvent& event)
|
|
|
|
{
|
2016-12-19 09:41:40 +00:00
|
|
|
const auto* menu = static_cast<wxMenu*>(event.GetEventObject());
|
|
|
|
BootGame(WxStrToStr(menu->GetLabelText(event.GetId())));
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
2009-06-20 11:05:52 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CFrame::OnRefresh(wxCommandEvent& WXUNUSED(event))
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2017-06-20 23:36:59 +00:00
|
|
|
GameListRescan();
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CFrame::OnScreenshot(wxCommandEvent& WXUNUSED(event))
|
2009-02-27 03:56:34 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
Core::SaveScreenShot();
|
2009-02-27 03:56:34 +00:00
|
|
|
}
|
2009-02-23 06:15:48 +00:00
|
|
|
|
2010-02-09 00:34:27 +00:00
|
|
|
// Pause the emulation
|
|
|
|
void CFrame::DoPause()
|
|
|
|
{
|
2017-02-05 12:39:58 +00:00
|
|
|
if (Core::GetState() == Core::State::Running)
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
2017-02-05 12:39:58 +00:00
|
|
|
Core::SetState(Core::State::Paused);
|
2016-06-24 08:43:46 +00:00
|
|
|
if (SConfig::GetInstance().bHideCursor)
|
2017-05-01 00:11:01 +00:00
|
|
|
m_render_parent->SetCursor(wxNullCursor);
|
2016-06-24 08:43:46 +00:00
|
|
|
Core::UpdateTitle();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-02-05 12:39:58 +00:00
|
|
|
Core::SetState(Core::State::Running);
|
2016-06-24 08:43:46 +00:00
|
|
|
if (SConfig::GetInstance().bHideCursor && RendererHasFocus())
|
2017-05-01 00:11:01 +00:00
|
|
|
m_render_parent->SetCursor(wxCURSOR_BLANK);
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
UpdateGUI();
|
2010-02-09 00:34:27 +00:00
|
|
|
}
|
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
// Stop the emulation
|
|
|
|
void CFrame::DoStop()
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
if (!Core::IsRunningAndStarted())
|
|
|
|
return;
|
2017-05-01 00:11:01 +00:00
|
|
|
if (m_confirm_stop)
|
2016-06-24 08:43:46 +00:00
|
|
|
return;
|
2012-12-28 08:29:51 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
// don't let this function run again until it finishes, or is aborted.
|
2017-05-01 00:11:01 +00:00
|
|
|
m_confirm_stop = true;
|
2013-09-03 22:53:23 +00:00
|
|
|
|
2017-05-01 00:11:01 +00:00
|
|
|
if (Core::GetState() != Core::State::Uninitialized || m_render_parent != nullptr)
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
2011-03-06 04:31:43 +00:00
|
|
|
#if defined __WXGTK__
|
2016-06-24 08:43:46 +00:00
|
|
|
wxMutexGuiLeave();
|
2017-05-01 00:11:01 +00:00
|
|
|
std::lock_guard<std::recursive_mutex> lk(m_keystate_lock);
|
2016-06-24 08:43:46 +00:00
|
|
|
wxMutexGuiEnter();
|
2011-03-06 04:31:43 +00:00
|
|
|
#endif
|
2017-04-24 16:19:35 +00:00
|
|
|
|
|
|
|
// Pause the state during confirmation and restore it afterwards
|
|
|
|
Core::State state = Core::GetState();
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
// Ask for confirmation in case the user accidentally clicked Stop / Escape
|
|
|
|
if (SConfig::GetInstance().bConfirmStop)
|
|
|
|
{
|
|
|
|
// Exit fullscreen to ensure it does not cover the stop dialog.
|
|
|
|
DoFullscreen(false);
|
|
|
|
|
2016-07-24 22:43:09 +00:00
|
|
|
// Do not pause if netplay is running as CPU thread might be blocked
|
|
|
|
// waiting on inputs
|
|
|
|
bool should_pause = !NetPlayDialog::GetNetPlayClient();
|
|
|
|
|
|
|
|
if (should_pause)
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
2017-02-05 12:39:58 +00:00
|
|
|
Core::SetState(Core::State::Paused);
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
|
2016-09-18 22:49:15 +00:00
|
|
|
wxMessageDialog m_StopDlg(
|
|
|
|
this, !m_tried_graceful_shutdown ? _("Do you want to stop the current emulation?") :
|
|
|
|
_("A shutdown is already in progress. Unsaved data "
|
|
|
|
"may be lost if you stop the current emulation "
|
|
|
|
"before it completes. Force stop?"),
|
|
|
|
_("Please confirm..."), wxYES_NO | wxSTAY_ON_TOP | wxICON_EXCLAMATION, wxDefaultPosition);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
HotkeyManagerEmu::Enable(false);
|
|
|
|
int Ret = m_StopDlg.ShowModal();
|
|
|
|
HotkeyManagerEmu::Enable(true);
|
|
|
|
if (Ret != wxID_YES)
|
|
|
|
{
|
2016-07-24 22:43:09 +00:00
|
|
|
if (should_pause)
|
|
|
|
Core::SetState(state);
|
|
|
|
|
2017-05-01 00:11:01 +00:00
|
|
|
m_confirm_stop = false;
|
2016-06-24 08:43:46 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-01 00:11:01 +00:00
|
|
|
if (m_use_debugger && m_code_window)
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
2016-10-03 07:29:50 +00:00
|
|
|
PowerPC::watches.Clear();
|
|
|
|
PowerPC::breakpoints.Clear();
|
|
|
|
PowerPC::memchecks.Clear();
|
2017-05-01 00:11:01 +00:00
|
|
|
if (m_code_window->HasPanel<CBreakPointWindow>())
|
|
|
|
m_code_window->GetPanel<CBreakPointWindow>()->NotifyUpdate();
|
2016-06-24 08:43:46 +00:00
|
|
|
g_symbolDB.Clear();
|
|
|
|
Host_NotifyMapLoaded();
|
2017-04-24 16:19:35 +00:00
|
|
|
Core::SetState(state);
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
|
2017-02-27 14:34:19 +00:00
|
|
|
if (NetPlayDialog::GetNetPlayClient())
|
|
|
|
NetPlayDialog::GetNetPlayClient()->Stop();
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
// TODO: Show the author/description dialog here
|
|
|
|
if (Movie::IsRecordingInput())
|
|
|
|
DoRecordingSave();
|
|
|
|
if (Movie::IsMovieActive())
|
|
|
|
Movie::EndPlayInput(false);
|
|
|
|
|
2017-06-24 19:41:53 +00:00
|
|
|
if (!m_tried_graceful_shutdown && UICommon::TriggerSTMPowerEvent())
|
2016-12-23 21:26:24 +00:00
|
|
|
{
|
|
|
|
m_tried_graceful_shutdown = true;
|
2017-06-24 19:41:53 +00:00
|
|
|
m_confirm_stop = false;
|
|
|
|
|
|
|
|
// Unpause because gracefully shutting down needs the game to actually request a shutdown.
|
|
|
|
// Do not unpause in debug mode to allow debugging until the complete shutdown.
|
|
|
|
if (Core::GetState() == Core::State::Paused && !m_use_debugger)
|
|
|
|
Core::SetState(Core::State::Running);
|
|
|
|
|
2016-12-23 21:26:24 +00:00
|
|
|
return;
|
|
|
|
}
|
2017-06-24 19:41:53 +00:00
|
|
|
|
2017-10-03 17:35:36 +00:00
|
|
|
// Reshow the cursor on the parent frame after successful stop.
|
|
|
|
m_render_parent->SetCursor(wxNullCursor);
|
|
|
|
|
2016-10-07 19:57:07 +00:00
|
|
|
Core::Stop();
|
2016-06-24 08:43:46 +00:00
|
|
|
UpdateGUI();
|
|
|
|
}
|
2014-06-20 00:43:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnStopped()
|
|
|
|
{
|
2017-05-01 00:11:01 +00:00
|
|
|
m_confirm_stop = false;
|
2017-05-27 16:57:07 +00:00
|
|
|
m_is_game_loading = false;
|
2016-09-18 22:49:15 +00:00
|
|
|
m_tried_graceful_shutdown = false;
|
2017-10-01 16:31:19 +00:00
|
|
|
wxPostEvent(GetMenuBar(), wxCommandEvent{DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM});
|
2010-01-01 03:55:39 +00:00
|
|
|
|
2018-01-01 21:03:50 +00:00
|
|
|
EnableScreenSaver(true);
|
2016-07-07 00:00:33 +00:00
|
|
|
|
2017-09-09 19:52:35 +00:00
|
|
|
m_render_frame->SetTitle(StrToWxStr(Common::scm_rev_str));
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
// Destroy the renderer frame when not rendering to main
|
2017-05-01 00:11:01 +00:00
|
|
|
m_render_parent->Unbind(wxEVT_SIZE, &CFrame::OnRenderParentResize, this);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2017-04-03 02:17:35 +00:00
|
|
|
// Keyboard
|
|
|
|
wxTheApp->Unbind(wxEVT_KEY_DOWN, &CFrame::OnKeyDown, this);
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
// Mouse
|
|
|
|
wxTheApp->Unbind(wxEVT_RIGHT_DOWN, &CFrame::OnMouse, this);
|
|
|
|
wxTheApp->Unbind(wxEVT_RIGHT_UP, &CFrame::OnMouse, this);
|
|
|
|
wxTheApp->Unbind(wxEVT_MIDDLE_DOWN, &CFrame::OnMouse, this);
|
|
|
|
wxTheApp->Unbind(wxEVT_MIDDLE_UP, &CFrame::OnMouse, this);
|
|
|
|
wxTheApp->Unbind(wxEVT_MOTION, &CFrame::OnMouse, this);
|
|
|
|
if (SConfig::GetInstance().bHideCursor)
|
2017-05-01 00:11:01 +00:00
|
|
|
m_render_parent->SetCursor(wxNullCursor);
|
2016-06-24 08:43:46 +00:00
|
|
|
DoFullscreen(false);
|
|
|
|
if (!SConfig::GetInstance().bRenderToMain)
|
|
|
|
{
|
2017-05-01 00:11:01 +00:00
|
|
|
m_render_frame->Destroy();
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-03-31 16:08:29 +00:00
|
|
|
#if defined(__APPLE__)
|
2016-06-24 08:43:46 +00:00
|
|
|
// Disable the full screen button when not in a game.
|
2017-05-01 00:11:01 +00:00
|
|
|
m_render_frame->EnableFullScreenView(false);
|
2013-03-31 16:08:29 +00:00
|
|
|
#endif
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
// Make sure the window is not longer set to stay on top
|
2017-05-01 00:11:01 +00:00
|
|
|
m_render_frame->SetWindowStyle(m_render_frame->GetWindowStyle() & ~wxSTAY_ON_TOP);
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
2017-05-01 00:11:01 +00:00
|
|
|
m_render_parent = nullptr;
|
|
|
|
m_renderer_has_focus = false;
|
|
|
|
m_render_frame = nullptr;
|
2010-04-12 01:33:10 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
// Clean framerate indications from the status bar.
|
|
|
|
GetStatusBar()->SetStatusText(" ", 0);
|
2010-07-08 17:25:20 +00:00
|
|
|
|
2016-10-26 02:49:41 +00:00
|
|
|
// Clear Wii Remote connection status from the status bar.
|
2016-06-24 08:43:46 +00:00
|
|
|
GetStatusBar()->SetStatusText(" ", 1);
|
2011-01-20 21:37:00 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
// If batch mode was specified on the command-line or we were already closing, exit now.
|
2017-05-01 00:11:01 +00:00
|
|
|
if (m_batch_mode || m_is_closing)
|
2016-06-24 08:43:46 +00:00
|
|
|
Close(true);
|
2011-01-20 21:37:00 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
// If using auto size with render to main, reset the application size.
|
|
|
|
if (SConfig::GetInstance().bRenderToMain && SConfig::GetInstance().bRenderWindowAutoSize)
|
|
|
|
SetSize(SConfig::GetInstance().iWidth, SConfig::GetInstance().iHeight);
|
2011-01-25 03:30:12 +00:00
|
|
|
|
2017-05-01 00:11:01 +00:00
|
|
|
m_game_list_ctrl->Enable();
|
|
|
|
m_game_list_ctrl->Show();
|
|
|
|
m_game_list_ctrl->SetFocus();
|
2016-06-24 08:43:46 +00:00
|
|
|
UpdateGUI();
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
2010-08-30 07:05:47 +00:00
|
|
|
void CFrame::DoRecordingSave()
|
|
|
|
{
|
2017-02-05 12:39:58 +00:00
|
|
|
bool paused = Core::GetState() == Core::State::Paused;
|
2013-10-29 05:23:17 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
if (!paused)
|
|
|
|
DoPause();
|
2013-10-29 05:23:17 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
wxString path =
|
2017-11-02 13:32:16 +00:00
|
|
|
wxFileSelector(_("Select the Recording File"), wxEmptyString, wxEmptyString, wxEmptyString,
|
2016-06-24 08:43:46 +00:00
|
|
|
_("Dolphin TAS Movies (*.dtm)") +
|
|
|
|
wxString::Format("|*.dtm|%s", wxGetTranslation(wxALL_FILES)),
|
|
|
|
wxFD_SAVE | wxFD_PREVIEW | wxFD_OVERWRITE_PROMPT, this);
|
2010-08-30 07:05:47 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
if (path.IsEmpty())
|
|
|
|
return;
|
2013-10-29 05:23:17 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
Movie::SaveRecording(WxStrToStr(path));
|
2013-10-29 05:23:17 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
if (!paused)
|
|
|
|
DoPause();
|
2010-08-30 07:05:47 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CFrame::OnStop(wxCommandEvent& WXUNUSED(event))
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
DoStop();
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
2009-06-20 11:05:52 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CFrame::OnReset(wxCommandEvent& WXUNUSED(event))
|
2009-10-06 15:49:20 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
if (Movie::IsRecordingInput())
|
2016-08-04 16:54:45 +00:00
|
|
|
Movie::SetReset(true);
|
2016-06-24 08:43:46 +00:00
|
|
|
ProcessorInterface::ResetButton_Tap();
|
2009-10-06 15:49:20 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CFrame::OnConfigMain(wxCommandEvent& WXUNUSED(event))
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2016-07-23 01:05:22 +00:00
|
|
|
OpenGeneralConfiguration();
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CFrame::OnConfigGFX(wxCommandEvent& WXUNUSED(event))
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
HotkeyManagerEmu::Enable(false);
|
|
|
|
if (g_video_backend)
|
|
|
|
g_video_backend->ShowConfig(this);
|
|
|
|
HotkeyManagerEmu::Enable(true);
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CFrame::OnConfigAudio(wxCommandEvent& WXUNUSED(event))
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2016-07-23 01:05:22 +00:00
|
|
|
OpenGeneralConfiguration(CConfigMain::ID_AUDIOPAGE);
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CFrame::OnConfigControllers(wxCommandEvent& WXUNUSED(event))
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
ControllerConfigDiag config_dlg(this);
|
|
|
|
HotkeyManagerEmu::Enable(false);
|
|
|
|
config_dlg.ShowModal();
|
|
|
|
HotkeyManagerEmu::Enable(true);
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CFrame::OnConfigHotkey(wxCommandEvent& WXUNUSED(event))
|
2015-01-27 01:24:47 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
InputConfig* const hotkey_plugin = HotkeyManagerEmu::GetConfig();
|
2015-01-27 01:24:47 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
// check if game is running
|
|
|
|
bool game_running = false;
|
2017-02-05 12:39:58 +00:00
|
|
|
if (Core::GetState() == Core::State::Running)
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
2017-02-05 12:39:58 +00:00
|
|
|
Core::SetState(Core::State::Paused);
|
2016-06-24 08:43:46 +00:00
|
|
|
game_running = true;
|
|
|
|
}
|
2015-01-27 01:24:47 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
HotkeyManagerEmu::Enable(false);
|
2015-03-05 08:49:10 +00:00
|
|
|
|
2017-05-01 00:11:01 +00:00
|
|
|
HotkeyInputConfigDialog m_ConfigFrame(this, *hotkey_plugin, _("Dolphin Hotkeys"), m_use_debugger);
|
2016-06-24 08:43:46 +00:00
|
|
|
m_ConfigFrame.ShowModal();
|
2015-01-27 01:24:47 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
// Update references in case controllers were refreshed
|
|
|
|
Wiimote::LoadConfig();
|
|
|
|
Keyboard::LoadConfig();
|
|
|
|
Pad::LoadConfig();
|
|
|
|
HotkeyManagerEmu::LoadConfig();
|
2015-03-05 08:49:10 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
HotkeyManagerEmu::Enable(true);
|
2015-03-05 08:49:10 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
// if game isn't running
|
|
|
|
if (game_running)
|
|
|
|
{
|
2017-02-05 12:39:58 +00:00
|
|
|
Core::SetState(Core::State::Running);
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
2015-01-27 01:24:47 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
// Update the GUI in case menu accelerators were changed
|
|
|
|
UpdateGUI();
|
2011-02-12 06:46:33 +00:00
|
|
|
}
|
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
void CFrame::OnHelp(wxCommandEvent& event)
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
switch (event.GetId())
|
|
|
|
{
|
|
|
|
case wxID_ABOUT:
|
|
|
|
{
|
|
|
|
AboutDolphin frame(this);
|
|
|
|
HotkeyManagerEmu::Enable(false);
|
|
|
|
frame.ShowModal();
|
|
|
|
HotkeyManagerEmu::Enable(true);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case IDM_HELP_WEBSITE:
|
|
|
|
WxUtils::Launch("https://dolphin-emu.org/");
|
|
|
|
break;
|
|
|
|
case IDM_HELP_ONLINE_DOCS:
|
|
|
|
WxUtils::Launch("https://dolphin-emu.org/docs/guides/");
|
|
|
|
break;
|
|
|
|
case IDM_HELP_GITHUB:
|
|
|
|
WxUtils::Launch("https://github.com/dolphin-emu/dolphin");
|
|
|
|
break;
|
|
|
|
}
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
2009-08-27 07:33:07 +00:00
|
|
|
|
2016-10-22 01:41:17 +00:00
|
|
|
void CFrame::OnReloadThemeBitmaps(wxCommandEvent& WXUNUSED(event))
|
|
|
|
{
|
|
|
|
wxCommandEvent reload_event{DOLPHIN_EVT_RELOAD_TOOLBAR_BITMAPS};
|
|
|
|
reload_event.SetEventObject(this);
|
|
|
|
wxPostEvent(GetToolBar(), reload_event);
|
|
|
|
|
2017-06-20 23:36:59 +00:00
|
|
|
GameListRefresh();
|
2016-10-22 01:41:17 +00:00
|
|
|
}
|
|
|
|
|
2017-06-20 23:36:59 +00:00
|
|
|
void CFrame::OnRefreshGameList(wxCommandEvent& WXUNUSED(event))
|
2016-11-06 00:53:40 +00:00
|
|
|
{
|
2017-06-20 23:36:59 +00:00
|
|
|
GameListRefresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnRescanGameList(wxCommandEvent& WXUNUSED(event))
|
|
|
|
{
|
|
|
|
GameListRescan();
|
2016-11-06 00:53:40 +00:00
|
|
|
}
|
|
|
|
|
2016-11-04 03:43:35 +00:00
|
|
|
void CFrame::OnUpdateInterpreterMenuItem(wxUpdateUIEvent& event)
|
|
|
|
{
|
2017-07-28 04:33:50 +00:00
|
|
|
WxEventUtils::OnEnableIfCoreRunning(event);
|
2016-11-04 03:43:35 +00:00
|
|
|
|
|
|
|
if (GetMenuBar()->FindItem(IDM_INTERPRETER)->IsChecked())
|
|
|
|
return;
|
|
|
|
|
|
|
|
event.Check(SConfig::GetInstance().iCPUCore == PowerPC::CORE_INTERPRETER);
|
|
|
|
}
|
|
|
|
|
2009-09-01 19:47:04 +00:00
|
|
|
void CFrame::ClearStatusBar()
|
2009-08-27 07:33:07 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
if (this->GetStatusBar()->IsEnabled())
|
|
|
|
{
|
|
|
|
this->GetStatusBar()->SetStatusText("", 0);
|
|
|
|
}
|
2009-08-27 07:33:07 +00:00
|
|
|
}
|
2009-09-08 21:16:05 +00:00
|
|
|
|
2017-06-22 07:53:02 +00:00
|
|
|
void CFrame::StatusBarMessage(const char* format, ...)
|
2009-09-03 07:59:24 +00:00
|
|
|
{
|
2017-06-22 07:53:02 +00:00
|
|
|
va_list args;
|
|
|
|
va_start(args, format);
|
|
|
|
std::string msg = StringFromFormatV(format, args);
|
|
|
|
va_end(args);
|
2009-09-03 07:59:24 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
if (this->GetStatusBar()->IsEnabled())
|
|
|
|
{
|
2017-06-22 07:53:02 +00:00
|
|
|
this->GetStatusBar()->SetStatusText(StrToWxStr(msg), 0);
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
2009-09-03 07:59:24 +00:00
|
|
|
}
|
2009-02-23 06:15:48 +00:00
|
|
|
|
2009-08-29 06:08:14 +00:00
|
|
|
// Miscellaneous menus
|
2009-09-08 16:07:13 +00:00
|
|
|
// ---------------------
|
2009-05-13 21:50:24 +00:00
|
|
|
// NetPlay stuff
|
2016-06-24 08:43:46 +00:00
|
|
|
void CFrame::OnNetPlay(wxCommandEvent& WXUNUSED(event))
|
2009-05-13 21:50:24 +00:00
|
|
|
{
|
2017-05-01 00:11:01 +00:00
|
|
|
if (!m_netplay_setup_frame)
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
|
|
|
if (NetPlayDialog::GetInstance() != nullptr)
|
|
|
|
NetPlayDialog::GetInstance()->Raise();
|
|
|
|
else
|
2017-05-01 00:11:01 +00:00
|
|
|
m_netplay_setup_frame = new NetPlaySetupFrame(this, m_game_list_ctrl);
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-05-01 00:11:01 +00:00
|
|
|
m_netplay_setup_frame->Raise();
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
2009-05-13 21:50:24 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CFrame::OnMemcard(wxCommandEvent& WXUNUSED(event))
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
CMemcardManager MemcardManager(this);
|
|
|
|
HotkeyManagerEmu::Enable(false);
|
|
|
|
MemcardManager.ShowModal();
|
|
|
|
HotkeyManagerEmu::Enable(true);
|
2010-01-05 07:34:03 +00:00
|
|
|
}
|
|
|
|
|
2017-06-04 08:20:16 +00:00
|
|
|
void CFrame::OnLoadGameCubeIPLJAP(wxCommandEvent&)
|
2017-05-21 19:52:44 +00:00
|
|
|
{
|
2017-05-27 13:43:40 +00:00
|
|
|
StartGame(std::make_unique<BootParameters>(BootParameters::IPL{DiscIO::Region::NTSC_J}));
|
2017-05-21 19:52:44 +00:00
|
|
|
}
|
|
|
|
|
2017-06-04 08:20:16 +00:00
|
|
|
void CFrame::OnLoadGameCubeIPLUSA(wxCommandEvent&)
|
2017-05-21 19:52:44 +00:00
|
|
|
{
|
2017-05-27 13:43:40 +00:00
|
|
|
StartGame(std::make_unique<BootParameters>(BootParameters::IPL{DiscIO::Region::NTSC_U}));
|
2017-05-21 19:52:44 +00:00
|
|
|
}
|
|
|
|
|
2017-06-04 08:20:16 +00:00
|
|
|
void CFrame::OnLoadGameCubeIPLEUR(wxCommandEvent&)
|
2017-05-21 19:52:44 +00:00
|
|
|
{
|
2017-05-27 13:43:40 +00:00
|
|
|
StartGame(std::make_unique<BootParameters>(BootParameters::IPL{DiscIO::Region::PAL}));
|
2017-05-21 19:52:44 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CFrame::OnExportAllSaves(wxCommandEvent& WXUNUSED(event))
|
2013-08-18 21:59:05 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
CWiiSaveCrypted::ExportAllSaves();
|
2013-08-18 21:59:05 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CFrame::OnImportSave(wxCommandEvent& WXUNUSED(event))
|
2010-01-05 07:34:03 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
wxString path =
|
|
|
|
wxFileSelector(_("Select the save file"), wxEmptyString, wxEmptyString, wxEmptyString,
|
|
|
|
_("Wii save files (*.bin)") + "|*.bin|" + wxGetTranslation(wxALL_FILES),
|
|
|
|
wxFD_OPEN | wxFD_PREVIEW | wxFD_FILE_MUST_EXIST, this);
|
2010-01-05 07:34:03 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
if (!path.IsEmpty())
|
|
|
|
CWiiSaveCrypted::ImportWiiSave(WxStrToStr(path));
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CFrame::OnShowCheatsWindow(wxCommandEvent& WXUNUSED(event))
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2017-04-07 00:23:27 +00:00
|
|
|
if (!m_cheats_window)
|
|
|
|
m_cheats_window = new wxCheatsWindow(this);
|
|
|
|
|
|
|
|
m_cheats_window->Show();
|
|
|
|
m_cheats_window->Raise();
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
2009-03-20 19:12:04 +00:00
|
|
|
|
2011-05-08 02:56:09 +00:00
|
|
|
void CFrame::OnLoadWiiMenu(wxCommandEvent& WXUNUSED(event))
|
|
|
|
{
|
2017-10-01 13:41:54 +00:00
|
|
|
StartGame(std::make_unique<BootParameters>(BootParameters::NANDTitle{Titles::SYSTEM_MENU}));
|
2011-05-08 02:56:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnInstallWAD(wxCommandEvent& event)
|
2009-02-27 23:44:15 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
std::string fileName;
|
|
|
|
|
|
|
|
switch (event.GetId())
|
|
|
|
{
|
|
|
|
case IDM_LIST_INSTALL_WAD:
|
|
|
|
{
|
2017-12-31 19:33:36 +00:00
|
|
|
const UICommon::GameFile* iso = m_game_list_ctrl->GetSelectedISO();
|
2016-06-24 08:43:46 +00:00
|
|
|
if (!iso)
|
|
|
|
return;
|
2017-12-31 19:33:36 +00:00
|
|
|
fileName = iso->GetFilePath();
|
2016-06-24 08:43:46 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case IDM_MENU_INSTALL_WAD:
|
|
|
|
{
|
|
|
|
wxString path = wxFileSelector(
|
|
|
|
_("Select a Wii WAD file to install"), wxEmptyString, wxEmptyString, wxEmptyString,
|
|
|
|
_("Wii WAD files (*.wad)") + "|*.wad|" + wxGetTranslation(wxALL_FILES),
|
|
|
|
wxFD_OPEN | wxFD_PREVIEW | wxFD_FILE_MUST_EXIST, this);
|
|
|
|
fileName = WxStrToStr(path);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
wxProgressDialog dialog(_("Installing WAD..."), _("Working..."), 1000, this,
|
|
|
|
wxPD_APP_MODAL | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME |
|
|
|
|
wxPD_REMAINING_TIME | wxPD_SMOOTH);
|
|
|
|
|
2017-05-13 22:15:12 +00:00
|
|
|
if (WiiUtils::InstallWAD(fileName))
|
2017-10-01 16:31:19 +00:00
|
|
|
wxPostEvent(GetMenuBar(), wxCommandEvent{DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM});
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
|
2017-04-25 21:29:48 +00:00
|
|
|
void CFrame::OnUninstallWAD(wxCommandEvent&)
|
|
|
|
{
|
2017-12-31 19:33:36 +00:00
|
|
|
const UICommon::GameFile* file = m_game_list_ctrl->GetSelectedISO();
|
2017-04-25 21:29:48 +00:00
|
|
|
if (!file)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!AskYesNoT("Uninstalling the WAD will remove the currently installed version "
|
|
|
|
"of this title from the NAND without deleting its save data. Continue?"))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-12-31 19:33:36 +00:00
|
|
|
const u64 title_id = file->GetTitleID();
|
|
|
|
if (!WiiUtils::UninstallTitle(title_id))
|
2017-04-25 21:29:48 +00:00
|
|
|
{
|
|
|
|
PanicAlertT("Failed to remove this title from the NAND.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-06-15 21:20:30 +00:00
|
|
|
if (title_id == Titles::SYSTEM_MENU)
|
2017-10-01 16:31:19 +00:00
|
|
|
wxPostEvent(GetMenuBar(), wxCommandEvent{DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM});
|
2017-04-25 21:29:48 +00:00
|
|
|
}
|
|
|
|
|
2017-03-19 07:00:49 +00:00
|
|
|
void CFrame::OnImportBootMiiBackup(wxCommandEvent& WXUNUSED(event))
|
|
|
|
{
|
|
|
|
if (!AskYesNoT("Merging a new NAND over your currently selected NAND will overwrite any channels "
|
|
|
|
"and savegames that already exist. This process is not reversible, so it is "
|
|
|
|
"recommended that you keep backups of both NANDs. Are you sure you want to "
|
|
|
|
"continue?"))
|
|
|
|
return;
|
|
|
|
|
|
|
|
wxString path = wxFileSelector(
|
|
|
|
_("Select a BootMii NAND backup to import"), wxEmptyString, wxEmptyString, wxEmptyString,
|
|
|
|
_("BootMii NAND backup file (*.bin)") + "|*.bin|" + wxGetTranslation(wxALL_FILES),
|
|
|
|
wxFD_OPEN | wxFD_PREVIEW | wxFD_FILE_MUST_EXIST, this);
|
|
|
|
const std::string file_name = WxStrToStr(path);
|
|
|
|
if (file_name.empty())
|
|
|
|
return;
|
|
|
|
|
|
|
|
wxProgressDialog dialog(_("Importing NAND backup"), _("Working..."), 100, this,
|
|
|
|
wxPD_APP_MODAL | wxPD_ELAPSED_TIME | wxPD_SMOOTH);
|
2017-10-26 19:22:16 +00:00
|
|
|
DiscIO::NANDImporter().ImportNANDBin(
|
|
|
|
file_name, [&dialog] { dialog.Pulse(); },
|
|
|
|
[this] {
|
2017-12-02 17:20:42 +00:00
|
|
|
return WxStrToStr(wxFileSelector(_("Select the keys file (OTP/SEEPROM dump)"),
|
|
|
|
wxEmptyString, wxEmptyString, wxEmptyString,
|
|
|
|
_("BootMii keys file (*.bin)") + "|*.bin|" +
|
|
|
|
wxGetTranslation(wxALL_FILES),
|
|
|
|
wxFD_OPEN | wxFD_PREVIEW | wxFD_FILE_MUST_EXIST, this));
|
2017-10-26 19:22:16 +00:00
|
|
|
});
|
2017-10-01 16:31:19 +00:00
|
|
|
wxPostEvent(GetMenuBar(), wxCommandEvent{DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM});
|
2017-03-19 07:00:49 +00:00
|
|
|
}
|
|
|
|
|
2017-10-03 14:45:59 +00:00
|
|
|
void CFrame::OnCheckNAND(wxCommandEvent&)
|
|
|
|
{
|
|
|
|
IOS::HLE::Kernel ios;
|
2017-10-06 19:45:28 +00:00
|
|
|
WiiUtils::NANDCheckResult result = WiiUtils::CheckNAND(ios);
|
|
|
|
if (!result.bad)
|
2017-10-03 14:45:59 +00:00
|
|
|
{
|
|
|
|
wxMessageBox(_("No issues have been detected."), _("NAND Check"), wxOK | wxICON_INFORMATION);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-10-06 19:45:28 +00:00
|
|
|
wxString message = _("The emulated NAND is damaged. System titles such as the Wii Menu and "
|
|
|
|
"the Wii Shop Channel may not work correctly.\n\n"
|
|
|
|
"Do you want to try to repair the NAND?");
|
|
|
|
if (!result.titles_to_remove.empty())
|
2017-10-03 14:45:59 +00:00
|
|
|
{
|
2017-11-02 10:37:51 +00:00
|
|
|
std::string title_listings;
|
2017-10-06 19:45:28 +00:00
|
|
|
Core::TitleDatabase title_db;
|
|
|
|
for (const u64 title_id : result.titles_to_remove)
|
|
|
|
{
|
2017-11-02 16:34:04 +00:00
|
|
|
title_listings += StringFromFormat("%016" PRIx64, title_id);
|
|
|
|
|
|
|
|
const std::string database_name = title_db.GetChannelName(title_id);
|
|
|
|
if (!database_name.empty())
|
|
|
|
{
|
|
|
|
title_listings += " - " + database_name;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DiscIO::WiiSaveBanner banner(title_id);
|
|
|
|
if (banner.IsValid())
|
|
|
|
{
|
|
|
|
title_listings += " - " + banner.GetName();
|
|
|
|
const std::string description = banner.GetDescription();
|
|
|
|
if (!StripSpaces(description).empty())
|
|
|
|
title_listings += " - " + description;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-02 10:37:51 +00:00
|
|
|
title_listings += "\n";
|
2017-10-06 19:45:28 +00:00
|
|
|
}
|
2017-11-02 10:37:51 +00:00
|
|
|
|
|
|
|
message += wxString::Format(
|
|
|
|
_("\n\nWARNING: Fixing this NAND requires the deletion of titles that have "
|
|
|
|
"incomplete data on the NAND, including all associated save data. "
|
|
|
|
"By continuing, the following title(s) will be removed:\n\n"
|
|
|
|
"%s"
|
|
|
|
"\nLaunching these titles may also fix the issues."),
|
2017-11-02 16:34:04 +00:00
|
|
|
StrToWxStr(title_listings));
|
2017-10-03 14:45:59 +00:00
|
|
|
}
|
|
|
|
|
2017-10-06 19:45:28 +00:00
|
|
|
if (wxMessageBox(message, _("NAND Check"), wxYES_NO) != wxYES)
|
|
|
|
return;
|
|
|
|
|
2017-10-03 14:45:59 +00:00
|
|
|
if (WiiUtils::RepairNAND(ios))
|
|
|
|
{
|
|
|
|
wxMessageBox(_("The NAND has been repaired."), _("NAND Check"), wxOK | wxICON_INFORMATION);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
wxMessageBox(_("The NAND could not be repaired. It is recommended to back up "
|
|
|
|
"your current data and start over with a fresh NAND."),
|
|
|
|
_("NAND Check"), wxOK | wxICON_ERROR);
|
|
|
|
}
|
|
|
|
|
2017-03-19 07:00:49 +00:00
|
|
|
void CFrame::OnExtractCertificates(wxCommandEvent& WXUNUSED(event))
|
|
|
|
{
|
|
|
|
DiscIO::NANDImporter().ExtractCertificates(File::GetUserPath(D_WIIROOT_IDX));
|
|
|
|
}
|
|
|
|
|
2017-06-13 23:22:03 +00:00
|
|
|
static std::string GetUpdateRegionFromIdm(int idm)
|
|
|
|
{
|
|
|
|
switch (idm)
|
|
|
|
{
|
|
|
|
case IDM_PERFORM_ONLINE_UPDATE_EUR:
|
|
|
|
return "EUR";
|
|
|
|
case IDM_PERFORM_ONLINE_UPDATE_JPN:
|
|
|
|
return "JPN";
|
|
|
|
case IDM_PERFORM_ONLINE_UPDATE_KOR:
|
|
|
|
return "KOR";
|
|
|
|
case IDM_PERFORM_ONLINE_UPDATE_USA:
|
|
|
|
return "USA";
|
|
|
|
case IDM_PERFORM_ONLINE_UPDATE_CURRENT:
|
|
|
|
default:
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-04 15:38:25 +00:00
|
|
|
static void ShowUpdateResult(WiiUtils::UpdateResult result)
|
2017-06-13 23:22:03 +00:00
|
|
|
{
|
2017-07-04 15:38:25 +00:00
|
|
|
switch (result)
|
2017-06-13 23:22:03 +00:00
|
|
|
{
|
|
|
|
case WiiUtils::UpdateResult::Succeeded:
|
|
|
|
wxMessageBox(_("The emulated Wii console has been updated."), _("Update completed"),
|
|
|
|
wxOK | wxICON_INFORMATION);
|
|
|
|
DiscIO::NANDImporter().ExtractCertificates(File::GetUserPath(D_WIIROOT_IDX));
|
|
|
|
break;
|
|
|
|
case WiiUtils::UpdateResult::AlreadyUpToDate:
|
|
|
|
wxMessageBox(_("The emulated Wii console is already up-to-date."), _("Update completed"),
|
|
|
|
wxOK | wxICON_INFORMATION);
|
|
|
|
DiscIO::NANDImporter().ExtractCertificates(File::GetUserPath(D_WIIROOT_IDX));
|
|
|
|
break;
|
|
|
|
case WiiUtils::UpdateResult::ServerFailed:
|
|
|
|
wxMessageBox(_("Could not download update information from Nintendo. "
|
|
|
|
"Please check your Internet connection and try again."),
|
|
|
|
_("Update failed"), wxOK | wxICON_ERROR);
|
|
|
|
break;
|
|
|
|
case WiiUtils::UpdateResult::DownloadFailed:
|
|
|
|
wxMessageBox(_("Could not download update files from Nintendo. "
|
|
|
|
"Please check your Internet connection and try again."),
|
|
|
|
_("Update failed"), wxOK | wxICON_ERROR);
|
|
|
|
break;
|
|
|
|
case WiiUtils::UpdateResult::ImportFailed:
|
|
|
|
wxMessageBox(_("Could not install an update to the Wii system memory. "
|
|
|
|
"Please refer to logs for more information."),
|
|
|
|
_("Update failed"), wxOK | wxICON_ERROR);
|
|
|
|
break;
|
|
|
|
case WiiUtils::UpdateResult::Cancelled:
|
|
|
|
wxMessageBox(_("The update has been cancelled. It is strongly recommended to "
|
|
|
|
"finish it in order to avoid inconsistent system software versions."),
|
|
|
|
_("Update cancelled"), wxOK | wxICON_WARNING);
|
|
|
|
break;
|
2017-07-04 15:38:25 +00:00
|
|
|
case WiiUtils::UpdateResult::RegionMismatch:
|
|
|
|
wxMessageBox(_("The game's region does not match your console's. "
|
|
|
|
"To avoid issues with the system menu, it is not possible to update "
|
|
|
|
"the emulated console using this disc."),
|
|
|
|
_("Update failed"), wxOK | wxICON_ERROR);
|
|
|
|
break;
|
|
|
|
case WiiUtils::UpdateResult::MissingUpdatePartition:
|
|
|
|
case WiiUtils::UpdateResult::DiscReadFailed:
|
|
|
|
wxMessageBox(_("The game disc does not contain any usable update information."),
|
|
|
|
_("Update failed"), wxOK | wxICON_ERROR);
|
|
|
|
break;
|
2017-06-13 23:22:03 +00:00
|
|
|
}
|
2017-07-04 15:38:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <typename Callable, typename... Args>
|
|
|
|
static WiiUtils::UpdateResult ShowUpdateProgress(CFrame* frame, Callable function, Args&&... args)
|
|
|
|
{
|
|
|
|
wxProgressDialog dialog(_("Updating"), _("Preparing to update...\nThis can take a while."), 1,
|
|
|
|
frame, wxPD_APP_MODAL | wxPD_AUTO_HIDE | wxPD_SMOOTH | wxPD_CAN_ABORT);
|
|
|
|
|
|
|
|
std::future<WiiUtils::UpdateResult> result = std::async(std::launch::async, [&] {
|
|
|
|
const WiiUtils::UpdateResult res = function(
|
|
|
|
[&](size_t processed, size_t total, u64 title_id) {
|
|
|
|
Core::QueueHostJob(
|
|
|
|
[&dialog, processed, total, title_id] {
|
|
|
|
dialog.SetRange(total);
|
|
|
|
dialog.Update(processed, wxString::Format(_("Updating title %016" PRIx64 "...\n"
|
|
|
|
"This can take a while."),
|
|
|
|
title_id));
|
|
|
|
dialog.Fit();
|
|
|
|
},
|
|
|
|
true);
|
|
|
|
return !dialog.WasCancelled();
|
|
|
|
},
|
|
|
|
std::forward<Args>(args)...);
|
|
|
|
Core::QueueHostJob([&dialog] { dialog.EndModal(0); }, true);
|
|
|
|
return res;
|
|
|
|
});
|
|
|
|
|
|
|
|
dialog.ShowModal();
|
|
|
|
return result.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnPerformOnlineWiiUpdate(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
int confirm = wxMessageBox(_("Connect to the Internet and perform an online system update?"),
|
|
|
|
_("System Update"), wxYES_NO, this);
|
|
|
|
if (confirm != wxYES)
|
|
|
|
return;
|
|
|
|
|
|
|
|
const std::string region = GetUpdateRegionFromIdm(event.GetId());
|
2017-06-13 23:22:03 +00:00
|
|
|
|
2017-07-04 15:38:25 +00:00
|
|
|
const WiiUtils::UpdateResult result = ShowUpdateProgress(this, WiiUtils::DoOnlineUpdate, region);
|
|
|
|
ShowUpdateResult(result);
|
2017-10-01 16:31:19 +00:00
|
|
|
wxPostEvent(GetMenuBar(), wxCommandEvent{DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM});
|
2017-06-13 23:22:03 +00:00
|
|
|
}
|
|
|
|
|
2017-07-04 16:23:25 +00:00
|
|
|
void CFrame::OnPerformDiscWiiUpdate(wxCommandEvent&)
|
|
|
|
{
|
2017-12-31 19:33:36 +00:00
|
|
|
const UICommon::GameFile* iso = m_game_list_ctrl->GetSelectedISO();
|
2017-07-04 16:23:25 +00:00
|
|
|
if (!iso)
|
|
|
|
return;
|
|
|
|
|
2017-12-31 19:33:36 +00:00
|
|
|
const std::string file_name = iso->GetFilePath();
|
2017-07-04 16:23:25 +00:00
|
|
|
|
|
|
|
const WiiUtils::UpdateResult result = ShowUpdateProgress(this, WiiUtils::DoDiscUpdate, file_name);
|
|
|
|
ShowUpdateResult(result);
|
2017-10-01 16:31:19 +00:00
|
|
|
wxPostEvent(GetMenuBar(), wxCommandEvent{DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM});
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnFifoPlayer(wxCommandEvent& WXUNUSED(event))
|
|
|
|
{
|
2017-05-01 00:11:01 +00:00
|
|
|
if (m_fifo_player_dialog)
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
2017-05-01 00:11:01 +00:00
|
|
|
m_fifo_player_dialog->Show();
|
|
|
|
m_fifo_player_dialog->SetFocus();
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-05-01 00:11:01 +00:00
|
|
|
m_fifo_player_dialog = new FifoPlayerDlg(this);
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
2011-03-27 02:55:08 +00:00
|
|
|
}
|
|
|
|
|
2011-01-07 15:18:00 +00:00
|
|
|
void CFrame::OnConnectWiimote(wxCommandEvent& event)
|
|
|
|
{
|
2017-04-29 14:11:22 +00:00
|
|
|
const auto ios = IOS::HLE::GetIOS();
|
|
|
|
if (!ios || SConfig::GetInstance().m_bt_passthrough_enabled)
|
2016-08-23 14:19:30 +00:00
|
|
|
return;
|
2017-07-21 06:06:02 +00:00
|
|
|
Core::RunAsCPUThread([&] {
|
|
|
|
const auto bt = std::static_pointer_cast<IOS::HLE::Device::BluetoothEmu>(
|
|
|
|
ios->GetDeviceByName("/dev/usb/oh1/57e/305"));
|
2017-07-19 07:55:45 +00:00
|
|
|
const unsigned int wiimote_index = event.GetId() - IDM_CONNECT_WIIMOTE1;
|
|
|
|
const bool is_connected = bt && bt->AccessWiiMote(wiimote_index | 0x100)->IsConnected();
|
|
|
|
Wiimote::Connect(wiimote_index, !is_connected);
|
2017-07-21 06:06:02 +00:00
|
|
|
});
|
2011-01-07 15:18:00 +00:00
|
|
|
}
|
|
|
|
|
2017-05-01 00:11:01 +00:00
|
|
|
// Toggle fullscreen. In Windows the fullscreen mode is accomplished by expanding the m_panel to
|
|
|
|
// cover the entire screen (when we render to the main window).
|
2016-06-24 08:43:46 +00:00
|
|
|
void CFrame::OnToggleFullscreen(wxCommandEvent& WXUNUSED(event))
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
DoFullscreen(!RendererIsFullscreen());
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CFrame::OnLoadStateFromFile(wxCommandEvent& WXUNUSED(event))
|
2009-06-28 01:11:35 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
wxString path =
|
|
|
|
wxFileSelector(_("Select the state to load"), wxEmptyString, wxEmptyString, wxEmptyString,
|
|
|
|
_("All Save States (sav, s##)") +
|
|
|
|
wxString::Format("|*.sav;*.s??|%s", wxGetTranslation(wxALL_FILES)),
|
|
|
|
wxFD_OPEN | wxFD_PREVIEW | wxFD_FILE_MUST_EXIST, this);
|
2009-06-28 01:11:35 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
if (!path.IsEmpty())
|
|
|
|
State::LoadAs(WxStrToStr(path));
|
2009-06-28 01:11:35 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CFrame::OnSaveStateToFile(wxCommandEvent& WXUNUSED(event))
|
2009-06-28 01:11:35 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
wxString path =
|
|
|
|
wxFileSelector(_("Select the state to save"), wxEmptyString, wxEmptyString, wxEmptyString,
|
|
|
|
_("All Save States (sav, s##)") +
|
|
|
|
wxString::Format("|*.sav;*.s??|%s", wxGetTranslation(wxALL_FILES)),
|
|
|
|
wxFD_SAVE, this);
|
2009-06-28 01:11:35 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
if (!path.IsEmpty())
|
|
|
|
State::SaveAs(WxStrToStr(path));
|
2009-06-28 01:11:35 +00:00
|
|
|
}
|
|
|
|
|
2012-11-08 07:40:49 +00:00
|
|
|
void CFrame::OnLoadLastState(wxCommandEvent& event)
|
2009-06-28 01:11:35 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
if (Core::IsRunningAndStarted())
|
|
|
|
{
|
|
|
|
int id = event.GetId();
|
|
|
|
int slot = id - IDM_LOAD_LAST_1 + 1;
|
|
|
|
State::LoadLastSaved(slot);
|
|
|
|
}
|
2012-11-08 07:40:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnSaveFirstState(wxCommandEvent& WXUNUSED(event))
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
if (Core::IsRunningAndStarted())
|
|
|
|
State::SaveFirstSaved();
|
2009-06-28 01:11:35 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CFrame::OnUndoLoadState(wxCommandEvent& WXUNUSED(event))
|
2009-06-28 01:11:35 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
if (Core::IsRunningAndStarted())
|
|
|
|
State::UndoLoadState();
|
2009-06-28 01:11:35 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void CFrame::OnUndoSaveState(wxCommandEvent& WXUNUSED(event))
|
2009-06-28 21:11:51 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
if (Core::IsRunningAndStarted())
|
|
|
|
State::UndoSaveState();
|
2009-06-28 21:11:51 +00:00
|
|
|
}
|
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
void CFrame::OnLoadState(wxCommandEvent& event)
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
if (Core::IsRunningAndStarted())
|
|
|
|
{
|
|
|
|
int id = event.GetId();
|
|
|
|
int slot = id - IDM_LOAD_SLOT_1 + 1;
|
|
|
|
State::Load(slot);
|
|
|
|
}
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnSaveState(wxCommandEvent& event)
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
if (Core::IsRunningAndStarted())
|
|
|
|
{
|
|
|
|
int id = event.GetId();
|
|
|
|
int slot = id - IDM_SAVE_SLOT_1 + 1;
|
|
|
|
State::Save(slot);
|
|
|
|
}
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
2014-09-16 21:41:16 +00:00
|
|
|
void CFrame::OnSelectSlot(wxCommandEvent& event)
|
|
|
|
{
|
2017-05-01 00:11:01 +00:00
|
|
|
m_save_slot = event.GetId() - IDM_SELECT_SLOT_1 + 1;
|
|
|
|
Core::DisplayMessage(StringFromFormat("Selected slot %d - %s", m_save_slot,
|
|
|
|
State::GetInfoStringOfSlot(m_save_slot, false).c_str()),
|
2016-06-24 08:43:46 +00:00
|
|
|
2500);
|
2014-09-16 21:41:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnLoadCurrentSlot(wxCommandEvent& event)
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
if (Core::IsRunningAndStarted())
|
|
|
|
{
|
2017-05-01 00:11:01 +00:00
|
|
|
State::Load(m_save_slot);
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
2014-09-16 21:41:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnSaveCurrentSlot(wxCommandEvent& event)
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
if (Core::IsRunningAndStarted())
|
|
|
|
{
|
2017-05-01 00:11:01 +00:00
|
|
|
State::Save(m_save_slot);
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
2014-09-16 21:41:16 +00:00
|
|
|
}
|
2009-08-25 07:49:23 +00:00
|
|
|
|
2009-08-27 10:10:07 +00:00
|
|
|
// GUI
|
2009-09-08 16:07:13 +00:00
|
|
|
// ---------------------
|
2009-02-23 06:15:48 +00:00
|
|
|
|
|
|
|
// Update the enabled/disabled status
|
|
|
|
void CFrame::UpdateGUI()
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
// Save status
|
|
|
|
bool Initialized = Core::IsRunning();
|
2017-02-05 12:39:58 +00:00
|
|
|
bool Running = Core::GetState() == Core::State::Running;
|
|
|
|
bool Paused = Core::GetState() == Core::State::Paused;
|
|
|
|
bool Stopping = Core::GetState() == Core::State::Stopping;
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2016-10-22 01:41:17 +00:00
|
|
|
GetToolBar()->Refresh(false);
|
2016-10-14 18:52:18 +00:00
|
|
|
GetMenuBar()->Refresh(false);
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
// File
|
|
|
|
GetMenuBar()->FindItem(wxID_OPEN)->Enable(!Initialized);
|
|
|
|
GetMenuBar()->FindItem(IDM_DRIVES)->Enable(!Initialized);
|
|
|
|
GetMenuBar()->FindItem(wxID_REFRESH)->Enable(!Initialized);
|
|
|
|
|
|
|
|
// Emulation
|
|
|
|
GetMenuBar()->FindItem(IDM_STOP)->Enable(Running || Paused);
|
|
|
|
GetMenuBar()->FindItem(IDM_RESET)->Enable(Running || Paused);
|
|
|
|
GetMenuBar()->FindItem(IDM_RECORD)->Enable(!Movie::IsRecordingInput());
|
|
|
|
GetMenuBar()->FindItem(IDM_PLAY_RECORD)->Enable(!Initialized);
|
2017-02-11 19:39:07 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_STOP_RECORD)->Enable(Movie::IsMovieActive());
|
2016-06-24 08:43:46 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_RECORD_EXPORT)->Enable(Movie::IsMovieActive());
|
|
|
|
GetMenuBar()->FindItem(IDM_FRAMESTEP)->Enable(Running || Paused);
|
|
|
|
GetMenuBar()->FindItem(IDM_SCREENSHOT)->Enable(Running || Paused);
|
|
|
|
GetMenuBar()->FindItem(IDM_TOGGLE_FULLSCREEN)->Enable(Running || Paused);
|
|
|
|
GetMenuBar()->FindItem(IDM_LOAD_STATE)->Enable(Initialized);
|
|
|
|
GetMenuBar()->FindItem(IDM_SAVE_STATE)->Enable(Initialized);
|
|
|
|
// Misc
|
|
|
|
GetMenuBar()->FindItem(IDM_CHANGE_DISC)->Enable(Initialized);
|
2017-10-03 15:20:36 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_EJECT_DISC)->Enable(Initialized);
|
2017-05-21 21:21:34 +00:00
|
|
|
GetMenuBar()
|
2017-06-04 08:20:16 +00:00
|
|
|
->FindItem(IDM_LOAD_GC_IPL_JAP)
|
2017-05-21 21:21:34 +00:00
|
|
|
->Enable(!Initialized && File::Exists(SConfig::GetInstance().GetBootROMPath(JAP_DIR)));
|
|
|
|
GetMenuBar()
|
2017-06-04 08:20:16 +00:00
|
|
|
->FindItem(IDM_LOAD_GC_IPL_USA)
|
2017-05-21 21:21:34 +00:00
|
|
|
->Enable(!Initialized && File::Exists(SConfig::GetInstance().GetBootROMPath(USA_DIR)));
|
|
|
|
GetMenuBar()
|
2017-06-04 08:20:16 +00:00
|
|
|
->FindItem(IDM_LOAD_GC_IPL_EUR)
|
2017-05-21 21:21:34 +00:00
|
|
|
->Enable(!Initialized && File::Exists(SConfig::GetInstance().GetBootROMPath(EUR_DIR)));
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
// Tools
|
|
|
|
GetMenuBar()->FindItem(IDM_CHEATS)->Enable(SConfig::GetInstance().bEnableCheats);
|
|
|
|
|
2017-04-29 14:11:22 +00:00
|
|
|
const auto ios = IOS::HLE::GetIOS();
|
|
|
|
const auto bt = ios ? std::static_pointer_cast<IOS::HLE::Device::BluetoothEmu>(
|
|
|
|
ios->GetDeviceByName("/dev/usb/oh1/57e/305")) :
|
|
|
|
nullptr;
|
2017-01-28 21:57:43 +00:00
|
|
|
bool ShouldEnableWiimotes = Running && bt && !SConfig::GetInstance().m_bt_passthrough_enabled;
|
2016-08-23 14:19:30 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->Enable(ShouldEnableWiimotes);
|
|
|
|
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE2)->Enable(ShouldEnableWiimotes);
|
|
|
|
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE3)->Enable(ShouldEnableWiimotes);
|
|
|
|
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE4)->Enable(ShouldEnableWiimotes);
|
|
|
|
GetMenuBar()->FindItem(IDM_CONNECT_BALANCEBOARD)->Enable(ShouldEnableWiimotes);
|
|
|
|
if (ShouldEnableWiimotes)
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
2017-07-21 06:06:02 +00:00
|
|
|
Core::RunAsCPUThread([&] {
|
|
|
|
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->Check(bt->AccessWiiMote(0x0100)->IsConnected());
|
|
|
|
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE2)->Check(bt->AccessWiiMote(0x0101)->IsConnected());
|
|
|
|
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE3)->Check(bt->AccessWiiMote(0x0102)->IsConnected());
|
|
|
|
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE4)->Check(bt->AccessWiiMote(0x0103)->IsConnected());
|
|
|
|
GetMenuBar()
|
|
|
|
->FindItem(IDM_CONNECT_BALANCEBOARD)
|
|
|
|
->Check(bt->AccessWiiMote(0x0104)->IsConnected());
|
|
|
|
});
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GetMenuBar()->FindItem(IDM_RECORD_READ_ONLY)->Enable(Running || Paused);
|
|
|
|
|
2017-05-01 00:11:01 +00:00
|
|
|
if (!Initialized && !m_is_game_loading)
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
2017-05-01 00:11:01 +00:00
|
|
|
if (m_game_list_ctrl->IsEnabled())
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
|
|
|
// Prepare to load Default ISO, enable play button
|
|
|
|
if (!SConfig::GetInstance().m_strDefaultISO.empty())
|
|
|
|
{
|
2016-10-22 01:41:17 +00:00
|
|
|
GetToolBar()->EnableTool(IDM_PLAY, true);
|
2016-06-24 08:43:46 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_PLAY)->Enable();
|
|
|
|
GetMenuBar()->FindItem(IDM_RECORD)->Enable();
|
|
|
|
GetMenuBar()->FindItem(IDM_PLAY_RECORD)->Enable();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// No game has been selected yet, disable play button
|
2016-10-22 01:41:17 +00:00
|
|
|
GetToolBar()->EnableTool(IDM_PLAY, false);
|
2016-06-24 08:43:46 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_PLAY)->Enable(false);
|
|
|
|
GetMenuBar()->FindItem(IDM_RECORD)->Enable(false);
|
|
|
|
GetMenuBar()->FindItem(IDM_PLAY_RECORD)->Enable(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Game has not started, show game list
|
2017-05-01 00:11:01 +00:00
|
|
|
if (!m_game_list_ctrl->IsShown())
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
2017-05-01 00:11:01 +00:00
|
|
|
m_game_list_ctrl->Enable();
|
|
|
|
m_game_list_ctrl->Show();
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
// Game has been selected but not started, enable play button
|
2017-05-01 00:11:01 +00:00
|
|
|
if (m_game_list_ctrl->GetSelectedISO() != nullptr && m_game_list_ctrl->IsEnabled())
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
2016-10-22 01:41:17 +00:00
|
|
|
GetToolBar()->EnableTool(IDM_PLAY, true);
|
2016-06-24 08:43:46 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_PLAY)->Enable();
|
|
|
|
GetMenuBar()->FindItem(IDM_RECORD)->Enable();
|
|
|
|
GetMenuBar()->FindItem(IDM_PLAY_RECORD)->Enable();
|
|
|
|
}
|
2017-02-11 19:39:07 +00:00
|
|
|
|
|
|
|
// Reset the stop playing/recording input menu item
|
|
|
|
GetMenuBar()->FindItem(IDM_STOP_RECORD)->SetItemLabel(_("Stop Playing/Recording Input"));
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
else if (Initialized)
|
|
|
|
{
|
|
|
|
// Game has been loaded, enable the pause button
|
2016-10-22 01:41:17 +00:00
|
|
|
GetToolBar()->EnableTool(IDM_PLAY, !Stopping);
|
2016-06-24 08:43:46 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_PLAY)->Enable(!Stopping);
|
|
|
|
|
|
|
|
// Reset game loading flag
|
2017-05-01 00:11:01 +00:00
|
|
|
m_is_game_loading = false;
|
2017-02-11 19:39:07 +00:00
|
|
|
|
|
|
|
// Rename the stop playing/recording menu item depending on current movie state
|
|
|
|
if (Movie::IsRecordingInput())
|
|
|
|
GetMenuBar()->FindItem(IDM_STOP_RECORD)->SetItemLabel(_("Stop Recording Input"));
|
|
|
|
else if (Movie::IsPlayingInput())
|
|
|
|
GetMenuBar()->FindItem(IDM_STOP_RECORD)->SetItemLabel(_("Stop Playing Input"));
|
|
|
|
else
|
|
|
|
GetMenuBar()->FindItem(IDM_STOP_RECORD)->SetItemLabel(_("Stop Playing/Recording Input"));
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
|
2016-10-22 01:41:17 +00:00
|
|
|
GetToolBar()->Refresh(false);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
// Commit changes to manager
|
2017-05-01 00:11:01 +00:00
|
|
|
m_mgr->Update();
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
// Update non-modal windows
|
2017-04-07 00:23:27 +00:00
|
|
|
if (m_cheats_window)
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
|
|
|
if (SConfig::GetInstance().bEnableCheats)
|
2017-04-07 00:23:27 +00:00
|
|
|
m_cheats_window->UpdateGUI();
|
2016-06-24 08:43:46 +00:00
|
|
|
else
|
2017-04-07 00:23:27 +00:00
|
|
|
m_cheats_window->Hide();
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
2017-06-20 23:36:59 +00:00
|
|
|
void CFrame::GameListRefresh()
|
|
|
|
{
|
|
|
|
wxCommandEvent event{DOLPHIN_EVT_REFRESH_GAMELIST, GetId()};
|
|
|
|
event.SetEventObject(this);
|
|
|
|
wxPostEvent(m_game_list_ctrl, event);
|
|
|
|
}
|
|
|
|
|
2017-06-26 03:13:42 +00:00
|
|
|
void CFrame::GameListRescan(bool purge_cache)
|
2010-06-01 21:03:02 +00:00
|
|
|
{
|
2017-06-20 23:36:59 +00:00
|
|
|
wxCommandEvent event{DOLPHIN_EVT_RESCAN_GAMELIST, GetId()};
|
2016-11-06 00:53:40 +00:00
|
|
|
event.SetEventObject(this);
|
2017-06-26 03:13:42 +00:00
|
|
|
event.SetInt(purge_cache ? 1 : 0);
|
2017-05-01 00:11:01 +00:00
|
|
|
wxPostEvent(m_game_list_ctrl, event);
|
2010-06-01 21:03:02 +00:00
|
|
|
}
|
|
|
|
|
2009-04-28 02:30:50 +00:00
|
|
|
void CFrame::GameListChanged(wxCommandEvent& event)
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
switch (event.GetId())
|
|
|
|
{
|
|
|
|
case IDM_LIST_WII:
|
|
|
|
SConfig::GetInstance().m_ListWii = event.IsChecked();
|
|
|
|
break;
|
|
|
|
case IDM_LIST_GC:
|
|
|
|
SConfig::GetInstance().m_ListGC = event.IsChecked();
|
|
|
|
break;
|
|
|
|
case IDM_LIST_WAD:
|
|
|
|
SConfig::GetInstance().m_ListWad = event.IsChecked();
|
|
|
|
break;
|
|
|
|
case IDM_LIST_ELFDOL:
|
|
|
|
SConfig::GetInstance().m_ListElfDol = event.IsChecked();
|
|
|
|
break;
|
|
|
|
case IDM_LIST_JAP:
|
|
|
|
SConfig::GetInstance().m_ListJap = event.IsChecked();
|
|
|
|
break;
|
|
|
|
case IDM_LIST_PAL:
|
|
|
|
SConfig::GetInstance().m_ListPal = event.IsChecked();
|
|
|
|
break;
|
|
|
|
case IDM_LIST_USA:
|
|
|
|
SConfig::GetInstance().m_ListUsa = event.IsChecked();
|
|
|
|
break;
|
|
|
|
case IDM_LIST_AUSTRALIA:
|
|
|
|
SConfig::GetInstance().m_ListAustralia = event.IsChecked();
|
|
|
|
break;
|
|
|
|
case IDM_LIST_FRANCE:
|
|
|
|
SConfig::GetInstance().m_ListFrance = event.IsChecked();
|
|
|
|
break;
|
|
|
|
case IDM_LIST_GERMANY:
|
|
|
|
SConfig::GetInstance().m_ListGermany = event.IsChecked();
|
|
|
|
break;
|
|
|
|
case IDM_LIST_ITALY:
|
|
|
|
SConfig::GetInstance().m_ListItaly = event.IsChecked();
|
|
|
|
break;
|
|
|
|
case IDM_LIST_KOREA:
|
|
|
|
SConfig::GetInstance().m_ListKorea = event.IsChecked();
|
|
|
|
break;
|
|
|
|
case IDM_LIST_NETHERLANDS:
|
|
|
|
SConfig::GetInstance().m_ListNetherlands = event.IsChecked();
|
|
|
|
break;
|
|
|
|
case IDM_LIST_RUSSIA:
|
|
|
|
SConfig::GetInstance().m_ListRussia = event.IsChecked();
|
|
|
|
break;
|
|
|
|
case IDM_LIST_SPAIN:
|
|
|
|
SConfig::GetInstance().m_ListSpain = event.IsChecked();
|
|
|
|
break;
|
|
|
|
case IDM_LIST_TAIWAN:
|
|
|
|
SConfig::GetInstance().m_ListTaiwan = event.IsChecked();
|
|
|
|
break;
|
|
|
|
case IDM_LIST_WORLD:
|
|
|
|
SConfig::GetInstance().m_ListWorld = event.IsChecked();
|
|
|
|
break;
|
|
|
|
case IDM_LIST_UNKNOWN:
|
|
|
|
SConfig::GetInstance().m_ListUnknown = event.IsChecked();
|
|
|
|
break;
|
|
|
|
case IDM_LIST_DRIVES:
|
|
|
|
SConfig::GetInstance().m_ListDrives = event.IsChecked();
|
|
|
|
break;
|
|
|
|
case IDM_PURGE_GAME_LIST_CACHE:
|
2017-06-20 23:36:59 +00:00
|
|
|
std::vector<std::string> filenames =
|
2017-06-21 04:24:26 +00:00
|
|
|
Common::DoFileSearch({File::GetUserPath(D_CACHE_IDX)}, {".cache"});
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2017-06-20 23:36:59 +00:00
|
|
|
for (const std::string& filename : filenames)
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
2017-06-20 23:36:59 +00:00
|
|
|
File::Delete(filename);
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
2017-06-20 23:36:59 +00:00
|
|
|
// Do rescan after cache has been cleared
|
2017-06-26 03:13:42 +00:00
|
|
|
GameListRescan(true);
|
2017-06-20 23:36:59 +00:00
|
|
|
return;
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
|
2017-06-20 23:36:59 +00:00
|
|
|
GameListRefresh();
|
2009-04-28 02:30:50 +00:00
|
|
|
}
|
2009-09-01 19:47:04 +00:00
|
|
|
|
|
|
|
// Enable and disable the toolbar
|
|
|
|
void CFrame::OnToggleToolbar(wxCommandEvent& event)
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
SConfig::GetInstance().m_InterfaceToolbar = event.IsChecked();
|
|
|
|
DoToggleToolbar(event.IsChecked());
|
2009-09-01 19:47:04 +00:00
|
|
|
}
|
2009-09-02 07:59:06 +00:00
|
|
|
void CFrame::DoToggleToolbar(bool _show)
|
2009-09-01 19:47:04 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
GetToolBar()->Show(_show);
|
2017-05-01 00:11:01 +00:00
|
|
|
m_mgr->Update();
|
2009-09-01 19:47:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Enable and disable the status bar
|
|
|
|
void CFrame::OnToggleStatusbar(wxCommandEvent& event)
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
SConfig::GetInstance().m_InterfaceStatusbar = event.IsChecked();
|
2009-09-01 19:47:04 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
GetStatusBar()->Show(event.IsChecked());
|
2015-04-22 23:56:50 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
SendSizeEvent();
|
2009-09-01 19:47:04 +00:00
|
|
|
}
|
2014-06-04 13:54:48 +00:00
|
|
|
|
|
|
|
void CFrame::OnChangeColumnsVisible(wxCommandEvent& event)
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
switch (event.GetId())
|
|
|
|
{
|
|
|
|
case IDM_SHOW_SYSTEM:
|
|
|
|
SConfig::GetInstance().m_showSystemColumn = !SConfig::GetInstance().m_showSystemColumn;
|
|
|
|
break;
|
|
|
|
case IDM_SHOW_BANNER:
|
|
|
|
SConfig::GetInstance().m_showBannerColumn = !SConfig::GetInstance().m_showBannerColumn;
|
|
|
|
break;
|
2017-04-17 17:34:14 +00:00
|
|
|
case IDM_SHOW_TITLE:
|
|
|
|
SConfig::GetInstance().m_showTitleColumn = !SConfig::GetInstance().m_showTitleColumn;
|
|
|
|
break;
|
2016-06-24 08:43:46 +00:00
|
|
|
case IDM_SHOW_MAKER:
|
|
|
|
SConfig::GetInstance().m_showMakerColumn = !SConfig::GetInstance().m_showMakerColumn;
|
|
|
|
break;
|
|
|
|
case IDM_SHOW_FILENAME:
|
|
|
|
SConfig::GetInstance().m_showFileNameColumn = !SConfig::GetInstance().m_showFileNameColumn;
|
|
|
|
break;
|
|
|
|
case IDM_SHOW_ID:
|
|
|
|
SConfig::GetInstance().m_showIDColumn = !SConfig::GetInstance().m_showIDColumn;
|
|
|
|
break;
|
|
|
|
case IDM_SHOW_REGION:
|
|
|
|
SConfig::GetInstance().m_showRegionColumn = !SConfig::GetInstance().m_showRegionColumn;
|
|
|
|
break;
|
|
|
|
case IDM_SHOW_SIZE:
|
|
|
|
SConfig::GetInstance().m_showSizeColumn = !SConfig::GetInstance().m_showSizeColumn;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
2017-06-20 23:36:59 +00:00
|
|
|
GameListRefresh();
|
2016-06-24 08:43:46 +00:00
|
|
|
SConfig::GetInstance().SaveSettings();
|
2014-06-04 13:54:48 +00:00
|
|
|
}
|