| 
									
										
										
										
											2015-12-19 21:24:48 -08:00
										 |  |  | // Copyright 2015 Dolphin Emulator Project
 | 
					
						
							|  |  |  | // Licensed under GPLv2+
 | 
					
						
							|  |  |  | // Refer to the license.txt file included.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-24 17:38:31 +02:00
										 |  |  | #include "DolphinQt2/MenuBar.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-02 11:37:51 +01:00
										 |  |  | #include <cinttypes>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-19 21:24:48 -08:00
										 |  |  | #include <QAction>
 | 
					
						
							| 
									
										
										
										
											2016-02-11 22:59:44 +11:00
										 |  |  | #include <QDesktopServices>
 | 
					
						
							| 
									
										
										
										
											2017-05-04 23:01:12 +02:00
										 |  |  | #include <QFileDialog>
 | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  | #include <QFontDialog>
 | 
					
						
							|  |  |  | #include <QInputDialog>
 | 
					
						
							| 
									
										
										
										
											2017-05-08 19:03:59 +02:00
										 |  |  | #include <QMap>
 | 
					
						
							| 
									
										
										
										
											2017-05-04 23:01:12 +02:00
										 |  |  | #include <QMessageBox>
 | 
					
						
							| 
									
										
										
										
											2016-02-11 22:59:44 +11:00
										 |  |  | #include <QUrl>
 | 
					
						
							| 
									
										
										
										
											2015-12-19 21:24:48 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-24 16:35:47 +02:00
										 |  |  | #include "Common/CommonPaths.h"
 | 
					
						
							|  |  |  | #include "Common/FileUtil.h"
 | 
					
						
							| 
									
										
										
										
											2017-11-02 11:37:51 +01:00
										 |  |  | #include "Common/StringUtil.h"
 | 
					
						
							| 
									
										
										
										
											2017-11-02 17:34:04 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-23 01:18:53 +01:00
										 |  |  | #include "Common/CDUtils.h"
 | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  | #include "Core/Boot/Boot.h"
 | 
					
						
							| 
									
										
										
										
											2017-06-14 11:58:11 +02:00
										 |  |  | #include "Core/CommonTitles.h"
 | 
					
						
							| 
									
										
										
										
											2017-06-22 15:11:53 -07:00
										 |  |  | #include "Core/ConfigManager.h"
 | 
					
						
							| 
									
										
										
										
											2017-08-27 13:55:05 +02:00
										 |  |  | #include "Core/Core.h"
 | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  | #include "Core/Debugger/RSO.h"
 | 
					
						
							|  |  |  | #include "Core/HLE/HLE.h"
 | 
					
						
							| 
									
										
										
										
											2018-05-12 22:39:14 +02:00
										 |  |  | #include "Core/HW/WiiSave.h"
 | 
					
						
							| 
									
										
										
										
											2017-08-27 13:55:05 +02:00
										 |  |  | #include "Core/HW/Wiimote.h"
 | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  | #include "Core/Host.h"
 | 
					
						
							| 
									
										
										
										
											2017-06-14 11:58:11 +02:00
										 |  |  | #include "Core/IOS/ES/ES.h"
 | 
					
						
							|  |  |  | #include "Core/IOS/IOS.h"
 | 
					
						
							| 
									
										
										
										
											2018-01-24 15:25:35 +01:00
										 |  |  | #include "Core/IOS/USB/Bluetooth/BTEmu.h"
 | 
					
						
							| 
									
										
										
										
											2017-08-27 13:55:05 +02:00
										 |  |  | #include "Core/Movie.h"
 | 
					
						
							| 
									
										
										
										
											2018-04-09 15:31:20 +02:00
										 |  |  | #include "Core/PowerPC/JitInterface.h"
 | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  | #include "Core/PowerPC/PPCAnalyst.h"
 | 
					
						
							|  |  |  | #include "Core/PowerPC/PPCSymbolDB.h"
 | 
					
						
							| 
									
										
										
										
											2018-04-09 15:31:20 +02:00
										 |  |  | #include "Core/PowerPC/PowerPC.h"
 | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  | #include "Core/PowerPC/SignatureDB/SignatureDB.h"
 | 
					
						
							| 
									
										
										
										
											2016-02-15 12:56:40 +11:00
										 |  |  | #include "Core/State.h"
 | 
					
						
							| 
									
										
										
										
											2017-10-06 21:45:28 +02:00
										 |  |  | #include "Core/TitleDatabase.h"
 | 
					
						
							| 
									
										
										
										
											2017-10-03 16:45:59 +02:00
										 |  |  | #include "Core/WiiUtils.h"
 | 
					
						
							| 
									
										
										
										
											2017-11-02 17:34:04 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-24 17:38:31 +02:00
										 |  |  | #include "DiscIO/NANDImporter.h"
 | 
					
						
							| 
									
										
										
										
											2017-11-02 17:34:04 +01:00
										 |  |  | #include "DiscIO/WiiSaveBanner.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-11 22:59:44 +11:00
										 |  |  | #include "DolphinQt2/AboutDialog.h"
 | 
					
						
							| 
									
										
										
										
											2018-05-05 18:17:06 -04:00
										 |  |  | #include "DolphinQt2/Host.h"
 | 
					
						
							| 
									
										
										
										
											2017-09-02 23:38:02 +02:00
										 |  |  | #include "DolphinQt2/QtUtils/ActionHelper.h"
 | 
					
						
							| 
									
										
										
										
											2016-01-01 02:29:39 -08:00
										 |  |  | #include "DolphinQt2/Settings.h"
 | 
					
						
							| 
									
										
										
										
											2015-12-19 21:24:48 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-31 20:33:36 +01:00
										 |  |  | #include "UICommon/GameFile.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  | MenuBar::MenuBar(QWidget* parent) : QMenuBar(parent) | 
					
						
							| 
									
										
										
										
											2015-12-19 21:24:48 -08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |   AddFileMenu(); | 
					
						
							|  |  |  |   AddEmulationMenu(); | 
					
						
							| 
									
										
										
										
											2017-08-27 13:55:05 +02:00
										 |  |  |   AddMovieMenu(); | 
					
						
							| 
									
										
										
										
											2017-06-06 13:49:49 +02:00
										 |  |  |   AddOptionsMenu(); | 
					
						
							| 
									
										
										
										
											2017-05-04 23:01:12 +02:00
										 |  |  |   AddToolsMenu(); | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |   AddViewMenu(); | 
					
						
							| 
									
										
										
										
											2018-04-09 15:31:20 +02:00
										 |  |  |   AddJITMenu(); | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  |   AddSymbolsMenu(); | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |   AddHelpMenu(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-04 11:12:13 -07:00
										 |  |  |   connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, | 
					
						
							|  |  |  |           [=](Core::State state) { OnEmulationStateChanged(state); }); | 
					
						
							| 
									
										
										
										
											2018-05-05 18:17:06 -04:00
										 |  |  |   connect(Host::GetInstance(), &Host::UpdateDisasmDialog, this, | 
					
						
							|  |  |  |           [this] { OnEmulationStateChanged(Core::GetState()); }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-04 11:12:13 -07:00
										 |  |  |   OnEmulationStateChanged(Core::GetState()); | 
					
						
							| 
									
										
										
										
											2017-09-13 19:33:45 +02:00
										 |  |  |   connect(&Settings::Instance(), &Settings::DebugModeToggled, this, &MenuBar::OnDebugModeToggled); | 
					
						
							| 
									
										
										
										
											2017-08-27 13:55:05 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   connect(this, &MenuBar::SelectionChanged, this, &MenuBar::OnSelectionChanged); | 
					
						
							|  |  |  |   connect(this, &MenuBar::RecordingStatusChanged, this, &MenuBar::OnRecordingStatusChanged); | 
					
						
							|  |  |  |   connect(this, &MenuBar::ReadOnlyModeChanged, this, &MenuBar::OnReadOnlyModeChanged); | 
					
						
							| 
									
										
										
										
											2016-02-15 12:56:40 +11:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-04 11:12:13 -07:00
										 |  |  | void MenuBar::OnEmulationStateChanged(Core::State state) | 
					
						
							| 
									
										
										
										
											2016-02-15 12:56:40 +11:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-09-04 11:12:13 -07:00
										 |  |  |   bool running = state != Core::State::Uninitialized; | 
					
						
							|  |  |  |   bool playing = running && state != Core::State::Paused; | 
					
						
							| 
									
										
										
										
											2017-08-27 13:55:05 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-23 01:18:53 +01:00
										 |  |  |   // File
 | 
					
						
							|  |  |  |   m_eject_disc->setEnabled(running); | 
					
						
							|  |  |  |   m_change_disc->setEnabled(running); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |   // Emulation
 | 
					
						
							| 
									
										
										
										
											2017-09-04 11:12:13 -07:00
										 |  |  |   m_play_action->setEnabled(!playing); | 
					
						
							|  |  |  |   m_play_action->setVisible(!playing); | 
					
						
							|  |  |  |   m_pause_action->setEnabled(playing); | 
					
						
							|  |  |  |   m_pause_action->setVisible(playing); | 
					
						
							|  |  |  |   m_stop_action->setEnabled(running); | 
					
						
							|  |  |  |   m_stop_action->setVisible(running); | 
					
						
							|  |  |  |   m_reset_action->setEnabled(running); | 
					
						
							|  |  |  |   m_fullscreen_action->setEnabled(running); | 
					
						
							|  |  |  |   m_frame_advance_action->setEnabled(running); | 
					
						
							|  |  |  |   m_screenshot_action->setEnabled(running); | 
					
						
							|  |  |  |   m_state_load_menu->setEnabled(running); | 
					
						
							|  |  |  |   m_state_save_menu->setEnabled(running); | 
					
						
							| 
									
										
										
										
											2017-08-27 13:55:05 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // Movie
 | 
					
						
							| 
									
										
										
										
											2017-09-04 11:12:13 -07:00
										 |  |  |   m_recording_read_only->setEnabled(running); | 
					
						
							|  |  |  |   if (!running) | 
					
						
							|  |  |  |     m_recording_stop->setEnabled(false); | 
					
						
							|  |  |  |   m_recording_play->setEnabled(!running); | 
					
						
							| 
									
										
										
										
											2017-08-27 13:55:05 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-26 04:17:47 +02:00
										 |  |  |   // Tools
 | 
					
						
							| 
									
										
										
										
											2018-04-30 14:19:56 +02:00
										 |  |  |   m_show_cheat_manager->setEnabled(Settings::Instance().GetCheatsEnabled() && running); | 
					
						
							| 
									
										
										
										
											2018-03-26 04:17:47 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-09 15:31:20 +02:00
										 |  |  |   // JIT
 | 
					
						
							|  |  |  |   m_jit_interpreter_core->setEnabled(running); | 
					
						
							|  |  |  |   m_jit_block_linking->setEnabled(!running); | 
					
						
							|  |  |  |   m_jit_disable_cache->setEnabled(!running); | 
					
						
							|  |  |  |   m_jit_clear_cache->setEnabled(running); | 
					
						
							|  |  |  |   m_jit_log_coverage->setEnabled(!running); | 
					
						
							|  |  |  |   m_jit_search_instruction->setEnabled(running); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   for (QAction* action : | 
					
						
							|  |  |  |        {m_jit_off, m_jit_loadstore_off, m_jit_loadstore_lbzx_off, m_jit_loadstore_lxz_off, | 
					
						
							|  |  |  |         m_jit_loadstore_lwz_off, m_jit_loadstore_floating_off, m_jit_loadstore_paired_off, | 
					
						
							|  |  |  |         m_jit_floatingpoint_off, m_jit_integer_off, m_jit_paired_off, m_jit_systemregisters_off}) | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     action->setEnabled(running); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  |   // Symbols
 | 
					
						
							|  |  |  |   m_symbols->setEnabled(running); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |   UpdateStateSlotMenu(); | 
					
						
							| 
									
										
										
										
											2017-09-04 11:12:13 -07:00
										 |  |  |   UpdateToolsMenu(running); | 
					
						
							| 
									
										
										
										
											2017-09-13 19:33:45 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   OnDebugModeToggled(Settings::Instance().IsDebugModeEnabled()); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MenuBar::OnDebugModeToggled(bool enabled) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  |   // Options
 | 
					
						
							|  |  |  |   m_boot_to_pause->setVisible(enabled); | 
					
						
							|  |  |  |   m_automatic_start->setVisible(enabled); | 
					
						
							|  |  |  |   m_change_font->setVisible(enabled); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // View
 | 
					
						
							|  |  |  |   m_show_code->setVisible(enabled); | 
					
						
							| 
									
										
										
										
											2017-09-13 19:33:45 +02:00
										 |  |  |   m_show_registers->setVisible(enabled); | 
					
						
							| 
									
										
										
										
											2017-09-27 08:53:05 +02:00
										 |  |  |   m_show_watch->setVisible(enabled); | 
					
						
							| 
									
										
										
										
											2017-10-03 18:43:44 +02:00
										 |  |  |   m_show_breakpoints->setVisible(enabled); | 
					
						
							| 
									
										
										
										
											2018-03-16 12:39:53 +01:00
										 |  |  |   m_show_memory->setVisible(enabled); | 
					
						
							| 
									
										
										
										
											2018-04-09 15:31:20 +02:00
										 |  |  |   m_show_jit->setVisible(enabled); | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   if (enabled) | 
					
						
							| 
									
										
										
										
											2018-04-09 15:31:20 +02:00
										 |  |  |   { | 
					
						
							|  |  |  |     addMenu(m_jit); | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  |     addMenu(m_symbols); | 
					
						
							| 
									
										
										
										
											2018-04-09 15:31:20 +02:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  |   else | 
					
						
							| 
									
										
										
										
											2018-04-09 15:31:20 +02:00
										 |  |  |   { | 
					
						
							|  |  |  |     removeAction(m_jit->menuAction()); | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  |     removeAction(m_symbols->menuAction()); | 
					
						
							| 
									
										
										
										
											2018-04-09 15:31:20 +02:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2015-12-19 21:24:48 -08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-23 01:18:53 +01:00
										 |  |  | void MenuBar::AddDVDBackupMenu(QMenu* file_menu) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-04-16 19:08:58 +02:00
										 |  |  |   m_backup_menu = file_menu->addMenu(tr("&Boot from DVD Backup")); | 
					
						
							| 
									
										
										
										
											2018-03-23 01:18:53 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   const std::vector<std::string> drives = cdio_get_devices(); | 
					
						
							|  |  |  |   // Windows Limitation of 24 character drives
 | 
					
						
							|  |  |  |   for (size_t i = 0; i < drives.size() && i < 24; i++) | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     auto drive = QString::fromStdString(drives[i]); | 
					
						
							|  |  |  |     AddAction(m_backup_menu, drive, this, [this, drive] { emit BootDVDBackup(drive); }); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-19 21:24:48 -08:00
										 |  |  | void MenuBar::AddFileMenu() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-07-23 12:58:32 +02:00
										 |  |  |   QMenu* file_menu = addMenu(tr("&File")); | 
					
						
							| 
									
										
										
										
											2017-09-02 23:38:02 +02:00
										 |  |  |   m_open_action = AddAction(file_menu, tr("&Open..."), this, &MenuBar::Open, | 
					
						
							|  |  |  |                             QKeySequence(QStringLiteral("Ctrl+O"))); | 
					
						
							| 
									
										
										
										
											2018-03-23 01:18:53 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   file_menu->addSeparator(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_change_disc = AddAction(file_menu, tr("Change &Disc..."), this, &MenuBar::ChangeDisc); | 
					
						
							|  |  |  |   m_eject_disc = AddAction(file_menu, tr("&Eject Disc"), this, &MenuBar::EjectDisc); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   AddDVDBackupMenu(file_menu); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   file_menu->addSeparator(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-02 23:38:02 +02:00
										 |  |  |   m_exit_action = AddAction(file_menu, tr("E&xit"), this, &MenuBar::Exit, | 
					
						
							|  |  |  |                             QKeySequence(QStringLiteral("Alt+F4"))); | 
					
						
							| 
									
										
										
										
											2016-02-15 12:56:40 +11:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-04 23:01:12 +02:00
										 |  |  | void MenuBar::AddToolsMenu() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-07-23 12:58:32 +02:00
										 |  |  |   QMenu* tools_menu = addMenu(tr("&Tools")); | 
					
						
							| 
									
										
										
										
											2017-08-24 15:11:04 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-25 19:54:50 +01:00
										 |  |  |   AddAction(tools_menu, tr("&Memory Card Manager (GC)"), this, | 
					
						
							|  |  |  |             [this] { emit ShowMemcardManager(); }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-26 04:17:47 +02:00
										 |  |  |   m_show_cheat_manager = | 
					
						
							|  |  |  |       AddAction(tools_menu, tr("&Cheats Manager"), this, [this] { emit ShowCheatsManager(); }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   connect(&Settings::Instance(), &Settings::EnableCheatsChanged, [this](bool enabled) { | 
					
						
							|  |  |  |     m_show_cheat_manager->setEnabled(Core::GetState() != Core::State::Uninitialized && enabled); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-25 19:54:50 +01:00
										 |  |  |   tools_menu->addSeparator(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-02 23:38:02 +02:00
										 |  |  |   AddAction(tools_menu, tr("Import Wii Save..."), this, &MenuBar::ImportWiiSave); | 
					
						
							|  |  |  |   AddAction(tools_menu, tr("Export All Wii Saves"), this, &MenuBar::ExportWiiSaves); | 
					
						
							| 
									
										
										
										
											2017-08-24 15:11:04 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   tools_menu->addSeparator(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-02 23:38:02 +02:00
										 |  |  |   m_wad_install_action = AddAction(tools_menu, tr("Install WAD..."), this, &MenuBar::InstallWAD); | 
					
						
							| 
									
										
										
										
											2017-06-14 11:58:11 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-24 16:35:47 +02:00
										 |  |  |   tools_menu->addSeparator(); | 
					
						
							|  |  |  |   QMenu* gc_ipl = tools_menu->addMenu(tr("Load GameCube Main Menu")); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-02 23:38:02 +02:00
										 |  |  |   m_ntscj_ipl = AddAction(gc_ipl, tr("NTSC-J"), this, | 
					
						
							|  |  |  |                           [this] { emit BootGameCubeIPL(DiscIO::Region::NTSC_J); }); | 
					
						
							|  |  |  |   m_ntscu_ipl = AddAction(gc_ipl, tr("NTSC-U"), this, | 
					
						
							|  |  |  |                           [this] { emit BootGameCubeIPL(DiscIO::Region::NTSC_U); }); | 
					
						
							| 
									
										
										
										
											2017-08-24 16:35:47 +02:00
										 |  |  |   m_pal_ipl = | 
					
						
							| 
									
										
										
										
											2017-09-02 23:38:02 +02:00
										 |  |  |       AddAction(gc_ipl, tr("PAL"), this, [this] { emit BootGameCubeIPL(DiscIO::Region::PAL); }); | 
					
						
							| 
									
										
										
										
											2017-08-24 16:35:47 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-02 23:38:02 +02:00
										 |  |  |   AddAction(tools_menu, tr("Start &NetPlay..."), this, &MenuBar::StartNetPlay); | 
					
						
							| 
									
										
										
										
											2017-08-30 16:44:28 +02:00
										 |  |  |   AddAction(tools_menu, tr("FIFO Player"), this, &MenuBar::ShowFIFOPlayer); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-20 17:52:45 +02:00
										 |  |  |   tools_menu->addSeparator(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-06 11:00:37 +02:00
										 |  |  |   // Label will be set by a NANDRefresh later
 | 
					
						
							| 
									
										
										
										
											2017-09-02 23:38:02 +02:00
										 |  |  |   m_boot_sysmenu = | 
					
						
							| 
									
										
										
										
											2017-09-10 06:43:29 +02:00
										 |  |  |       AddAction(tools_menu, QStringLiteral(""), this, [this] { emit BootWiiSystemMenu(); }); | 
					
						
							| 
									
										
										
										
											2017-11-26 18:33:07 +01:00
										 |  |  |   m_import_backup = AddAction(tools_menu, tr("Import BootMii NAND Backup..."), this, | 
					
						
							| 
									
										
										
										
											2017-09-02 23:38:02 +02:00
										 |  |  |                               [this] { emit ImportNANDBackup(); }); | 
					
						
							| 
									
										
										
										
											2017-10-03 16:45:59 +02:00
										 |  |  |   m_check_nand = AddAction(tools_menu, tr("Check NAND..."), this, &MenuBar::CheckNAND); | 
					
						
							| 
									
										
										
										
											2017-09-02 23:38:02 +02:00
										 |  |  |   m_extract_certificates = AddAction(tools_menu, tr("Extract Certificates from NAND"), this, | 
					
						
							|  |  |  |                                      &MenuBar::NANDExtractCertificates); | 
					
						
							| 
									
										
										
										
											2017-08-26 14:41:53 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-06 11:00:37 +02:00
										 |  |  |   m_boot_sysmenu->setEnabled(false); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   connect(&Settings::Instance(), &Settings::NANDRefresh, [this] { UpdateToolsMenu(false); }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-14 11:58:11 +02:00
										 |  |  |   m_perform_online_update_menu = tools_menu->addMenu(tr("Perform Online System Update")); | 
					
						
							| 
									
										
										
										
											2017-09-02 23:38:02 +02:00
										 |  |  |   m_perform_online_update_for_current_region = | 
					
						
							|  |  |  |       AddAction(m_perform_online_update_menu, tr("Current Region"), this, | 
					
						
							|  |  |  |                 [this] { emit PerformOnlineUpdate(""); }); | 
					
						
							| 
									
										
										
										
											2017-06-14 11:58:11 +02:00
										 |  |  |   m_perform_online_update_menu->addSeparator(); | 
					
						
							| 
									
										
										
										
											2017-09-02 23:38:02 +02:00
										 |  |  |   AddAction(m_perform_online_update_menu, tr("Europe"), this, | 
					
						
							|  |  |  |             [this] { emit PerformOnlineUpdate("EUR"); }); | 
					
						
							|  |  |  |   AddAction(m_perform_online_update_menu, tr("Japan"), this, | 
					
						
							|  |  |  |             [this] { emit PerformOnlineUpdate("JPN"); }); | 
					
						
							|  |  |  |   AddAction(m_perform_online_update_menu, tr("Korea"), this, | 
					
						
							|  |  |  |             [this] { emit PerformOnlineUpdate("KOR"); }); | 
					
						
							|  |  |  |   AddAction(m_perform_online_update_menu, tr("United States"), this, | 
					
						
							|  |  |  |             [this] { emit PerformOnlineUpdate("USA"); }); | 
					
						
							| 
									
										
										
										
											2018-01-24 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   QMenu* menu = new QMenu(tr("Connect Wii Remotes")); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   tools_menu->addSeparator(); | 
					
						
							|  |  |  |   tools_menu->addMenu(menu); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   for (int i = 0; i < 4; i++) | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     m_wii_remotes[i] = AddAction(menu, tr("Connect Wii Remote %1").arg(i + 1), this, | 
					
						
							|  |  |  |                                  [this, i] { emit ConnectWiiRemote(i); }); | 
					
						
							|  |  |  |     m_wii_remotes[i]->setCheckable(true); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   menu->addSeparator(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_wii_remotes[4] = | 
					
						
							|  |  |  |       AddAction(menu, tr("Connect Balance Board"), this, [this] { emit ConnectWiiRemote(4); }); | 
					
						
							|  |  |  |   m_wii_remotes[4]->setCheckable(true); | 
					
						
							| 
									
										
										
										
											2017-05-04 23:01:12 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-15 12:56:40 +11:00
										 |  |  | void MenuBar::AddEmulationMenu() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-07-23 12:58:32 +02:00
										 |  |  |   QMenu* emu_menu = addMenu(tr("&Emulation")); | 
					
						
							| 
									
										
										
										
											2017-09-02 23:38:02 +02:00
										 |  |  |   m_play_action = AddAction(emu_menu, tr("&Play"), this, &MenuBar::Play); | 
					
						
							|  |  |  |   m_pause_action = AddAction(emu_menu, tr("&Pause"), this, &MenuBar::Pause); | 
					
						
							|  |  |  |   m_stop_action = AddAction(emu_menu, tr("&Stop"), this, &MenuBar::Stop); | 
					
						
							|  |  |  |   m_reset_action = AddAction(emu_menu, tr("&Reset"), this, &MenuBar::Reset); | 
					
						
							|  |  |  |   m_fullscreen_action = AddAction(emu_menu, tr("Toggle &Fullscreen"), this, &MenuBar::Fullscreen); | 
					
						
							|  |  |  |   m_frame_advance_action = AddAction(emu_menu, tr("&Frame Advance"), this, &MenuBar::FrameAdvance); | 
					
						
							| 
									
										
										
										
											2017-07-16 02:36:37 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-02 23:38:02 +02:00
										 |  |  |   m_screenshot_action = AddAction(emu_menu, tr("Take Screenshot"), this, &MenuBar::Screenshot); | 
					
						
							| 
									
										
										
										
											2017-07-16 02:36:37 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   emu_menu->addSeparator(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |   AddStateLoadMenu(emu_menu); | 
					
						
							|  |  |  |   AddStateSaveMenu(emu_menu); | 
					
						
							|  |  |  |   AddStateSlotMenu(emu_menu); | 
					
						
							|  |  |  |   UpdateStateSlotMenu(); | 
					
						
							| 
									
										
										
										
											2016-02-15 12:56:40 +11:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MenuBar::AddStateLoadMenu(QMenu* emu_menu) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-07-23 12:58:32 +02:00
										 |  |  |   m_state_load_menu = emu_menu->addMenu(tr("&Load State")); | 
					
						
							| 
									
										
										
										
											2017-09-02 23:38:02 +02:00
										 |  |  |   AddAction(m_state_load_menu, tr("Load State from File"), this, &MenuBar::StateLoad); | 
					
						
							|  |  |  |   AddAction(m_state_load_menu, tr("Load State from Selected Slot"), this, &MenuBar::StateLoadSlot); | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |   m_state_load_slots_menu = m_state_load_menu->addMenu(tr("Load State from Slot")); | 
					
						
							| 
									
										
										
										
											2017-09-02 23:38:02 +02:00
										 |  |  |   AddAction(m_state_load_menu, tr("Undo Load State"), this, &MenuBar::StateLoadUndo); | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   for (int i = 1; i <= 10; i++) | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     QAction* action = m_state_load_slots_menu->addAction(QStringLiteral("")); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     connect(action, &QAction::triggered, this, [=]() { emit StateLoadSlotAt(i); }); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2016-02-15 12:56:40 +11:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MenuBar::AddStateSaveMenu(QMenu* emu_menu) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-07-23 12:58:32 +02:00
										 |  |  |   m_state_save_menu = emu_menu->addMenu(tr("Sa&ve State")); | 
					
						
							| 
									
										
										
										
											2017-09-02 23:38:02 +02:00
										 |  |  |   AddAction(m_state_save_menu, tr("Save State to File"), this, &MenuBar::StateSave); | 
					
						
							|  |  |  |   AddAction(m_state_save_menu, tr("Save State to Selected Slot"), this, &MenuBar::StateSaveSlot); | 
					
						
							|  |  |  |   AddAction(m_state_save_menu, tr("Save State to Oldest Slot"), this, &MenuBar::StateSaveOldest); | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |   m_state_save_slots_menu = m_state_save_menu->addMenu(tr("Save State to Slot")); | 
					
						
							| 
									
										
										
										
											2017-09-02 23:38:02 +02:00
										 |  |  |   AddAction(m_state_save_menu, tr("Undo Save State"), this, &MenuBar::StateSaveUndo); | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   for (int i = 1; i <= 10; i++) | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     QAction* action = m_state_save_slots_menu->addAction(QStringLiteral("")); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     connect(action, &QAction::triggered, this, [=]() { emit StateSaveSlotAt(i); }); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2016-02-15 12:56:40 +11:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MenuBar::AddStateSlotMenu(QMenu* emu_menu) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |   m_state_slot_menu = emu_menu->addMenu(tr("Select State Slot")); | 
					
						
							|  |  |  |   m_state_slots = new QActionGroup(this); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   for (int i = 1; i <= 10; i++) | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     QAction* action = m_state_slot_menu->addAction(QStringLiteral("")); | 
					
						
							|  |  |  |     action->setCheckable(true); | 
					
						
							|  |  |  |     action->setActionGroup(m_state_slots); | 
					
						
							| 
									
										
										
										
											2017-05-31 00:17:39 -07:00
										 |  |  |     if (Settings::Instance().GetStateSlot() == i) | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |       action->setChecked(true); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     connect(action, &QAction::triggered, this, [=]() { emit SetStateSlot(i); }); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2016-02-15 12:56:40 +11:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MenuBar::UpdateStateSlotMenu() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |   QList<QAction*> actions_slot = m_state_slots->actions(); | 
					
						
							|  |  |  |   QList<QAction*> actions_load = m_state_load_slots_menu->actions(); | 
					
						
							|  |  |  |   QList<QAction*> actions_save = m_state_save_slots_menu->actions(); | 
					
						
							|  |  |  |   for (int i = 0; i < actions_slot.length(); i++) | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     int slot = i + 1; | 
					
						
							|  |  |  |     QString info = QString::fromStdString(State::GetInfoStringOfSlot(slot)); | 
					
						
							| 
									
										
										
										
											2017-07-23 10:50:20 +02:00
										 |  |  |     actions_load.at(i)->setText(tr("Load from Slot %1 - %2").arg(slot).arg(info)); | 
					
						
							|  |  |  |     actions_save.at(i)->setText(tr("Save to Slot %1 - %2").arg(slot).arg(info)); | 
					
						
							|  |  |  |     actions_slot.at(i)->setText(tr("Select Slot %1 - %2").arg(slot).arg(info)); | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2015-12-19 21:24:48 -08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MenuBar::AddViewMenu() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-07-23 12:58:32 +02:00
										 |  |  |   QMenu* view_menu = addMenu(tr("&View")); | 
					
						
							| 
									
										
										
										
											2017-08-03 16:43:50 +02:00
										 |  |  |   QAction* show_log = view_menu->addAction(tr("Show &Log")); | 
					
						
							| 
									
										
										
										
											2017-06-29 12:46:20 +02:00
										 |  |  |   show_log->setCheckable(true); | 
					
						
							|  |  |  |   show_log->setChecked(Settings::Instance().IsLogVisible()); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   connect(show_log, &QAction::toggled, &Settings::Instance(), &Settings::SetLogVisible); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-03 16:43:50 +02:00
										 |  |  |   QAction* show_log_config = view_menu->addAction(tr("Show Log &Configuration")); | 
					
						
							| 
									
										
										
										
											2017-06-29 12:46:20 +02:00
										 |  |  |   show_log_config->setCheckable(true); | 
					
						
							|  |  |  |   show_log_config->setChecked(Settings::Instance().IsLogConfigVisible()); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   connect(show_log_config, &QAction::toggled, &Settings::Instance(), | 
					
						
							|  |  |  |           &Settings::SetLogConfigVisible); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-19 11:32:00 +02:00
										 |  |  |   QAction* show_toolbar = view_menu->addAction(tr("Show &Toolbar")); | 
					
						
							|  |  |  |   show_toolbar->setCheckable(true); | 
					
						
							|  |  |  |   show_toolbar->setChecked(Settings::Instance().IsToolBarVisible()); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   connect(show_toolbar, &QAction::toggled, &Settings::Instance(), &Settings::SetToolBarVisible); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-29 12:46:20 +02:00
										 |  |  |   connect(&Settings::Instance(), &Settings::LogVisibilityChanged, show_log, &QAction::setChecked); | 
					
						
							|  |  |  |   connect(&Settings::Instance(), &Settings::LogConfigVisibilityChanged, show_log_config, | 
					
						
							|  |  |  |           &QAction::setChecked); | 
					
						
							| 
									
										
										
										
											2018-04-19 11:32:00 +02:00
										 |  |  |   connect(&Settings::Instance(), &Settings::ToolBarVisibilityChanged, show_toolbar, | 
					
						
							|  |  |  |           &QAction::setChecked); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   QAction* lock_widgets = view_menu->addAction(tr("&Lock Widgets In Place")); | 
					
						
							|  |  |  |   lock_widgets->setCheckable(true); | 
					
						
							|  |  |  |   lock_widgets->setChecked(Settings::Instance().AreWidgetsLocked()); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   connect(lock_widgets, &QAction::toggled, &Settings::Instance(), &Settings::SetWidgetsLocked); | 
					
						
							| 
									
										
										
										
											2017-06-29 12:46:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   view_menu->addSeparator(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  |   m_show_code = view_menu->addAction(tr("&Code")); | 
					
						
							|  |  |  |   m_show_code->setCheckable(true); | 
					
						
							|  |  |  |   m_show_code->setChecked(Settings::Instance().IsCodeVisible()); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   connect(m_show_code, &QAction::toggled, &Settings::Instance(), &Settings::SetCodeVisible); | 
					
						
							|  |  |  |   connect(&Settings::Instance(), &Settings::CodeVisibilityChanged, m_show_code, | 
					
						
							|  |  |  |           &QAction::setChecked); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-13 19:33:45 +02:00
										 |  |  |   m_show_registers = view_menu->addAction(tr("&Registers")); | 
					
						
							|  |  |  |   m_show_registers->setCheckable(true); | 
					
						
							|  |  |  |   m_show_registers->setChecked(Settings::Instance().IsRegistersVisible()); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   connect(m_show_registers, &QAction::toggled, &Settings::Instance(), | 
					
						
							|  |  |  |           &Settings::SetRegistersVisible); | 
					
						
							|  |  |  |   connect(&Settings::Instance(), &Settings::RegistersVisibilityChanged, m_show_registers, | 
					
						
							|  |  |  |           &QAction::setChecked); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-27 08:53:05 +02:00
										 |  |  |   m_show_watch = view_menu->addAction(tr("&Watch")); | 
					
						
							|  |  |  |   m_show_watch->setCheckable(true); | 
					
						
							|  |  |  |   m_show_watch->setChecked(Settings::Instance().IsWatchVisible()); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   connect(m_show_watch, &QAction::toggled, &Settings::Instance(), &Settings::SetWatchVisible); | 
					
						
							|  |  |  |   connect(&Settings::Instance(), &Settings::WatchVisibilityChanged, m_show_watch, | 
					
						
							|  |  |  |           &QAction::setChecked); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-03 18:43:44 +02:00
										 |  |  |   m_show_breakpoints = view_menu->addAction(tr("&Breakpoints")); | 
					
						
							|  |  |  |   m_show_breakpoints->setCheckable(true); | 
					
						
							|  |  |  |   m_show_breakpoints->setChecked(Settings::Instance().IsBreakpointsVisible()); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   connect(m_show_breakpoints, &QAction::toggled, &Settings::Instance(), | 
					
						
							|  |  |  |           &Settings::SetBreakpointsVisible); | 
					
						
							|  |  |  |   connect(&Settings::Instance(), &Settings::BreakpointsVisibilityChanged, m_show_breakpoints, | 
					
						
							|  |  |  |           &QAction::setChecked); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-16 12:39:53 +01:00
										 |  |  |   m_show_memory = view_menu->addAction(tr("&Memory")); | 
					
						
							|  |  |  |   m_show_memory->setCheckable(true); | 
					
						
							|  |  |  |   m_show_memory->setChecked(Settings::Instance().IsMemoryVisible()); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   connect(m_show_memory, &QAction::toggled, &Settings::Instance(), &Settings::SetMemoryVisible); | 
					
						
							|  |  |  |   connect(&Settings::Instance(), &Settings::MemoryVisibilityChanged, m_show_memory, | 
					
						
							|  |  |  |           &QAction::setChecked); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-09 15:31:20 +02:00
										 |  |  |   m_show_jit = view_menu->addAction(tr("&JIT")); | 
					
						
							|  |  |  |   m_show_jit->setCheckable(true); | 
					
						
							|  |  |  |   m_show_jit->setChecked(Settings::Instance().IsJITVisible()); | 
					
						
							|  |  |  |   connect(m_show_jit, &QAction::toggled, &Settings::Instance(), &Settings::SetJITVisible); | 
					
						
							|  |  |  |   connect(&Settings::Instance(), &Settings::JITVisibilityChanged, m_show_jit, &QAction::setChecked); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-13 19:33:45 +02:00
										 |  |  |   view_menu->addSeparator(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |   AddGameListTypeSection(view_menu); | 
					
						
							|  |  |  |   view_menu->addSeparator(); | 
					
						
							| 
									
										
										
										
											2017-08-05 10:28:53 +02:00
										 |  |  |   AddListColumnsMenu(view_menu); | 
					
						
							| 
									
										
										
										
											2017-07-11 15:13:09 +01:00
										 |  |  |   view_menu->addSeparator(); | 
					
						
							|  |  |  |   AddShowPlatformsMenu(view_menu); | 
					
						
							|  |  |  |   AddShowRegionsMenu(view_menu); | 
					
						
							| 
									
										
										
										
											2018-03-21 11:13:53 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   view_menu->addSeparator(); | 
					
						
							|  |  |  |   AddAction(view_menu, tr("Search"), this, &MenuBar::ToggleSearch, | 
					
						
							|  |  |  |             QKeySequence(QStringLiteral("Ctrl+F"))); | 
					
						
							| 
									
										
										
										
											2015-12-19 21:24:48 -08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-06 13:49:49 +02:00
										 |  |  | void MenuBar::AddOptionsMenu() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-07-23 12:58:32 +02:00
										 |  |  |   QMenu* options_menu = addMenu(tr("&Options")); | 
					
						
							| 
									
										
										
										
											2017-09-02 23:38:02 +02:00
										 |  |  |   AddAction(options_menu, tr("Co&nfiguration"), this, &MenuBar::Configure); | 
					
						
							| 
									
										
										
										
											2017-07-16 14:11:11 -07:00
										 |  |  |   options_menu->addSeparator(); | 
					
						
							| 
									
										
										
										
											2017-09-02 23:38:02 +02:00
										 |  |  |   AddAction(options_menu, tr("&Graphics Settings"), this, &MenuBar::ConfigureGraphics); | 
					
						
							|  |  |  |   AddAction(options_menu, tr("&Audio Settings"), this, &MenuBar::ConfigureAudio); | 
					
						
							|  |  |  |   AddAction(options_menu, tr("&Controller Settings"), this, &MenuBar::ConfigureControllers); | 
					
						
							|  |  |  |   AddAction(options_menu, tr("&Hotkey Settings"), this, &MenuBar::ConfigureHotkeys); | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   options_menu->addSeparator(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // Debugging mode only
 | 
					
						
							| 
									
										
										
										
											2018-03-19 18:52:46 +01:00
										 |  |  |   m_boot_to_pause = options_menu->addAction(tr("Boot to Pause")); | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  |   m_boot_to_pause->setCheckable(true); | 
					
						
							|  |  |  |   m_boot_to_pause->setChecked(SConfig::GetInstance().bBootToPause); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   connect(m_boot_to_pause, &QAction::toggled, this, | 
					
						
							|  |  |  |           [this](bool enable) { SConfig::GetInstance().bBootToPause = enable; }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_automatic_start = options_menu->addAction(tr("&Automatic Start")); | 
					
						
							|  |  |  |   m_automatic_start->setCheckable(true); | 
					
						
							|  |  |  |   m_automatic_start->setChecked(SConfig::GetInstance().bAutomaticStart); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   connect(m_automatic_start, &QAction::toggled, this, | 
					
						
							|  |  |  |           [this](bool enable) { SConfig::GetInstance().bAutomaticStart = enable; }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-19 18:52:46 +01:00
										 |  |  |   m_change_font = AddAction(options_menu, tr("&Font..."), this, &MenuBar::ChangeDebugFont); | 
					
						
							| 
									
										
										
										
											2017-06-06 13:49:49 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-11 22:59:44 +11:00
										 |  |  | void MenuBar::AddHelpMenu() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-07-23 12:58:32 +02:00
										 |  |  |   QMenu* help_menu = addMenu(tr("&Help")); | 
					
						
							|  |  |  |   QAction* website = help_menu->addAction(tr("&Website")); | 
					
						
							| 
									
										
										
										
											2017-05-05 01:08:01 -07:00
										 |  |  |   connect(website, &QAction::triggered, this, | 
					
						
							|  |  |  |           []() { QDesktopServices::openUrl(QUrl(QStringLiteral("https://dolphin-emu.org/"))); }); | 
					
						
							| 
									
										
										
										
											2017-07-23 12:58:32 +02:00
										 |  |  |   QAction* documentation = help_menu->addAction(tr("Online &Documentation")); | 
					
						
							| 
									
										
										
										
											2017-05-05 01:08:01 -07:00
										 |  |  |   connect(documentation, &QAction::triggered, this, []() { | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |     QDesktopServices::openUrl(QUrl(QStringLiteral("https://dolphin-emu.org/docs/guides"))); | 
					
						
							|  |  |  |   }); | 
					
						
							| 
									
										
										
										
											2017-07-23 12:58:32 +02:00
										 |  |  |   QAction* github = help_menu->addAction(tr("&GitHub Repository")); | 
					
						
							| 
									
										
										
										
											2017-05-05 01:08:01 -07:00
										 |  |  |   connect(github, &QAction::triggered, this, []() { | 
					
						
							|  |  |  |     QDesktopServices::openUrl(QUrl(QStringLiteral("https://github.com/dolphin-emu/dolphin"))); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   help_menu->addSeparator(); | 
					
						
							| 
									
										
										
										
											2017-09-02 23:38:02 +02:00
										 |  |  |   AddAction(help_menu, tr("&About"), this, &MenuBar::ShowAboutDialog); | 
					
						
							| 
									
										
										
										
											2016-02-11 22:59:44 +11:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-19 21:24:48 -08:00
										 |  |  | void MenuBar::AddGameListTypeSection(QMenu* view_menu) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-08-05 10:28:53 +02:00
										 |  |  |   QAction* list_view = view_menu->addAction(tr("List View")); | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |   list_view->setCheckable(true); | 
					
						
							| 
									
										
										
										
											2015-12-19 21:24:48 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-05 10:28:53 +02:00
										 |  |  |   QAction* grid_view = view_menu->addAction(tr("Grid View")); | 
					
						
							|  |  |  |   grid_view->setCheckable(true); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |   QActionGroup* list_group = new QActionGroup(this); | 
					
						
							|  |  |  |   list_group->addAction(list_view); | 
					
						
							| 
									
										
										
										
											2017-08-05 10:28:53 +02:00
										 |  |  |   list_group->addAction(grid_view); | 
					
						
							| 
									
										
										
										
											2015-12-19 21:24:48 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-05 10:28:53 +02:00
										 |  |  |   bool prefer_list = Settings::Instance().GetPreferredView(); | 
					
						
							|  |  |  |   list_view->setChecked(prefer_list); | 
					
						
							|  |  |  |   grid_view->setChecked(!prefer_list); | 
					
						
							| 
									
										
										
										
											2015-12-19 21:24:48 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |   connect(list_view, &QAction::triggered, this, &MenuBar::ShowList); | 
					
						
							| 
									
										
										
										
											2017-08-05 10:28:53 +02:00
										 |  |  |   connect(grid_view, &QAction::triggered, this, &MenuBar::ShowGrid); | 
					
						
							| 
									
										
										
										
											2015-12-19 21:24:48 -08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-05 10:28:53 +02:00
										 |  |  | void MenuBar::AddListColumnsMenu(QMenu* view_menu) | 
					
						
							| 
									
										
										
										
											2015-12-19 21:24:48 -08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-06-22 15:11:53 -07:00
										 |  |  |   static const QMap<QString, bool*> columns{ | 
					
						
							|  |  |  |       {tr("Platform"), &SConfig::GetInstance().m_showSystemColumn}, | 
					
						
							|  |  |  |       {tr("Banner"), &SConfig::GetInstance().m_showBannerColumn}, | 
					
						
							|  |  |  |       {tr("Title"), &SConfig::GetInstance().m_showTitleColumn}, | 
					
						
							|  |  |  |       {tr("Description"), &SConfig::GetInstance().m_showDescriptionColumn}, | 
					
						
							|  |  |  |       {tr("Maker"), &SConfig::GetInstance().m_showMakerColumn}, | 
					
						
							| 
									
										
										
										
											2017-09-13 21:57:53 +02:00
										 |  |  |       {tr("File Name"), &SConfig::GetInstance().m_showFileNameColumn}, | 
					
						
							|  |  |  |       {tr("Game ID"), &SConfig::GetInstance().m_showIDColumn}, | 
					
						
							|  |  |  |       {tr("Region"), &SConfig::GetInstance().m_showRegionColumn}, | 
					
						
							| 
									
										
										
										
											2017-06-15 19:29:26 -07:00
										 |  |  |       {tr("File Size"), &SConfig::GetInstance().m_showSizeColumn}}; | 
					
						
							| 
									
										
										
										
											2017-05-08 19:03:59 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |   QActionGroup* column_group = new QActionGroup(this); | 
					
						
							| 
									
										
										
										
											2017-08-05 10:28:53 +02:00
										 |  |  |   QMenu* cols_menu = view_menu->addMenu(tr("List Columns")); | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |   column_group->setExclusive(false); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-08 19:03:59 +02:00
										 |  |  |   for (const auto& key : columns.keys()) | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |   { | 
					
						
							| 
									
										
										
										
											2017-05-08 19:03:59 +02:00
										 |  |  |     bool* config = columns[key]; | 
					
						
							|  |  |  |     QAction* action = column_group->addAction(cols_menu->addAction(key)); | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |     action->setCheckable(true); | 
					
						
							| 
									
										
										
										
											2017-05-08 19:03:59 +02:00
										 |  |  |     action->setChecked(*config); | 
					
						
							|  |  |  |     connect(action, &QAction::toggled, [this, config, key](bool value) { | 
					
						
							|  |  |  |       *config = value; | 
					
						
							|  |  |  |       emit ColumnVisibilityToggled(key, value); | 
					
						
							|  |  |  |     }); | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2015-12-19 21:24:48 -08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2017-05-04 23:01:12 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-11 15:13:09 +01:00
										 |  |  | void MenuBar::AddShowPlatformsMenu(QMenu* view_menu) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   static const QMap<QString, bool*> platform_map{ | 
					
						
							|  |  |  |       {tr("Show Wii"), &SConfig::GetInstance().m_ListWii}, | 
					
						
							|  |  |  |       {tr("Show GameCube"), &SConfig::GetInstance().m_ListGC}, | 
					
						
							|  |  |  |       {tr("Show WAD"), &SConfig::GetInstance().m_ListWad}, | 
					
						
							|  |  |  |       {tr("Show ELF/DOL"), &SConfig::GetInstance().m_ListElfDol}}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   QActionGroup* platform_group = new QActionGroup(this); | 
					
						
							|  |  |  |   QMenu* plat_menu = view_menu->addMenu(tr("Show Platforms")); | 
					
						
							|  |  |  |   platform_group->setExclusive(false); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   for (const auto& key : platform_map.keys()) | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     bool* config = platform_map[key]; | 
					
						
							|  |  |  |     QAction* action = platform_group->addAction(plat_menu->addAction(key)); | 
					
						
							|  |  |  |     action->setCheckable(true); | 
					
						
							|  |  |  |     action->setChecked(*config); | 
					
						
							|  |  |  |     connect(action, &QAction::toggled, [this, config, key](bool value) { | 
					
						
							|  |  |  |       *config = value; | 
					
						
							|  |  |  |       emit GameListPlatformVisibilityToggled(key, value); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MenuBar::AddShowRegionsMenu(QMenu* view_menu) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   static const QMap<QString, bool*> region_map{ | 
					
						
							|  |  |  |       {tr("Show JAP"), &SConfig::GetInstance().m_ListJap}, | 
					
						
							|  |  |  |       {tr("Show PAL"), &SConfig::GetInstance().m_ListPal}, | 
					
						
							|  |  |  |       {tr("Show USA"), &SConfig::GetInstance().m_ListUsa}, | 
					
						
							|  |  |  |       {tr("Show Australia"), &SConfig::GetInstance().m_ListAustralia}, | 
					
						
							|  |  |  |       {tr("Show France"), &SConfig::GetInstance().m_ListFrance}, | 
					
						
							|  |  |  |       {tr("Show Germany"), &SConfig::GetInstance().m_ListGermany}, | 
					
						
							|  |  |  |       {tr("Show Italy"), &SConfig::GetInstance().m_ListItaly}, | 
					
						
							|  |  |  |       {tr("Show Korea"), &SConfig::GetInstance().m_ListKorea}, | 
					
						
							|  |  |  |       {tr("Show Netherlands"), &SConfig::GetInstance().m_ListNetherlands}, | 
					
						
							|  |  |  |       {tr("Show Russia"), &SConfig::GetInstance().m_ListRussia}, | 
					
						
							|  |  |  |       {tr("Show Spain"), &SConfig::GetInstance().m_ListSpain}, | 
					
						
							|  |  |  |       {tr("Show Taiwan"), &SConfig::GetInstance().m_ListTaiwan}, | 
					
						
							|  |  |  |       {tr("Show World"), &SConfig::GetInstance().m_ListWorld}, | 
					
						
							|  |  |  |       {tr("Show Unknown"), &SConfig::GetInstance().m_ListUnknown}}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   QActionGroup* region_group = new QActionGroup(this); | 
					
						
							|  |  |  |   QMenu* region_menu = view_menu->addMenu(tr("Show Regions")); | 
					
						
							|  |  |  |   region_group->setExclusive(false); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   for (const auto& key : region_map.keys()) | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     bool* config = region_map[key]; | 
					
						
							|  |  |  |     QAction* action = region_group->addAction(region_menu->addAction(key)); | 
					
						
							|  |  |  |     action->setCheckable(true); | 
					
						
							|  |  |  |     action->setChecked(*config); | 
					
						
							|  |  |  |     connect(action, &QAction::toggled, [this, config, key](bool value) { | 
					
						
							|  |  |  |       *config = value; | 
					
						
							|  |  |  |       emit GameListRegionVisibilityToggled(key, value); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-27 13:55:05 +02:00
										 |  |  | void MenuBar::AddMovieMenu() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   auto* movie_menu = addMenu(tr("&Movie")); | 
					
						
							|  |  |  |   m_recording_start = | 
					
						
							| 
									
										
										
										
											2017-11-02 14:32:16 +01:00
										 |  |  |       AddAction(movie_menu, tr("Start Re&cording Input"), this, [this] { emit StartRecording(); }); | 
					
						
							| 
									
										
										
										
											2017-08-27 13:55:05 +02:00
										 |  |  |   m_recording_play = | 
					
						
							| 
									
										
										
										
											2017-11-02 14:32:16 +01:00
										 |  |  |       AddAction(movie_menu, tr("P&lay Input Recording..."), this, [this] { emit PlayRecording(); }); | 
					
						
							| 
									
										
										
										
											2017-09-02 23:38:02 +02:00
										 |  |  |   m_recording_stop = AddAction(movie_menu, tr("Stop Playing/Recording Input"), this, | 
					
						
							|  |  |  |                                [this] { emit StopRecording(); }); | 
					
						
							| 
									
										
										
										
											2017-08-27 13:55:05 +02:00
										 |  |  |   m_recording_export = | 
					
						
							| 
									
										
										
										
											2017-09-02 23:38:02 +02:00
										 |  |  |       AddAction(movie_menu, tr("Export Recording..."), this, [this] { emit ExportRecording(); }); | 
					
						
							| 
									
										
										
										
											2017-08-27 13:55:05 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   m_recording_start->setEnabled(false); | 
					
						
							|  |  |  |   m_recording_play->setEnabled(false); | 
					
						
							|  |  |  |   m_recording_stop->setEnabled(false); | 
					
						
							|  |  |  |   m_recording_export->setEnabled(false); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-02 14:32:16 +01:00
										 |  |  |   m_recording_read_only = movie_menu->addAction(tr("&Read-Only Mode")); | 
					
						
							| 
									
										
										
										
											2017-08-27 13:55:05 +02:00
										 |  |  |   m_recording_read_only->setCheckable(true); | 
					
						
							|  |  |  |   m_recording_read_only->setChecked(Movie::IsReadOnly()); | 
					
						
							|  |  |  |   connect(m_recording_read_only, &QAction::toggled, [](bool value) { Movie::SetReadOnly(value); }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-28 00:35:02 +11:00
										 |  |  |   AddAction(movie_menu, tr("TAS Input"), this, [this] { emit ShowTASInput(); }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-27 13:55:05 +02:00
										 |  |  |   movie_menu->addSeparator(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   auto* pause_at_end = movie_menu->addAction(tr("Pause at End of Movie")); | 
					
						
							|  |  |  |   pause_at_end->setCheckable(true); | 
					
						
							|  |  |  |   pause_at_end->setChecked(SConfig::GetInstance().m_PauseMovie); | 
					
						
							|  |  |  |   connect(pause_at_end, &QAction::toggled, | 
					
						
							|  |  |  |           [](bool value) { SConfig::GetInstance().m_PauseMovie = value; }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   auto* lag_counter = movie_menu->addAction(tr("Show Lag Counter")); | 
					
						
							|  |  |  |   lag_counter->setCheckable(true); | 
					
						
							|  |  |  |   lag_counter->setChecked(SConfig::GetInstance().m_ShowLag); | 
					
						
							|  |  |  |   connect(lag_counter, &QAction::toggled, | 
					
						
							|  |  |  |           [](bool value) { SConfig::GetInstance().m_ShowLag = value; }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   auto* frame_counter = movie_menu->addAction(tr("Show Frame Counter")); | 
					
						
							|  |  |  |   frame_counter->setCheckable(true); | 
					
						
							|  |  |  |   frame_counter->setChecked(SConfig::GetInstance().m_ShowFrameCount); | 
					
						
							|  |  |  |   connect(frame_counter, &QAction::toggled, | 
					
						
							|  |  |  |           [](bool value) { SConfig::GetInstance().m_ShowFrameCount = value; }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   auto* input_display = movie_menu->addAction(tr("Show Input Display")); | 
					
						
							|  |  |  |   input_display->setCheckable(true); | 
					
						
							|  |  |  |   input_display->setChecked(SConfig::GetInstance().m_ShowInputDisplay); | 
					
						
							|  |  |  |   connect(frame_counter, &QAction::toggled, | 
					
						
							|  |  |  |           [](bool value) { SConfig::GetInstance().m_ShowInputDisplay = value; }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   auto* system_clock = movie_menu->addAction(tr("Show System Clock")); | 
					
						
							|  |  |  |   system_clock->setCheckable(true); | 
					
						
							|  |  |  |   system_clock->setChecked(SConfig::GetInstance().m_ShowRTC); | 
					
						
							|  |  |  |   connect(system_clock, &QAction::toggled, | 
					
						
							|  |  |  |           [](bool value) { SConfig::GetInstance().m_ShowRTC = value; }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   movie_menu->addSeparator(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   auto* dump_frames = movie_menu->addAction(tr("Dump Frames")); | 
					
						
							|  |  |  |   dump_frames->setCheckable(true); | 
					
						
							|  |  |  |   dump_frames->setChecked(SConfig::GetInstance().m_DumpFrames); | 
					
						
							|  |  |  |   connect(dump_frames, &QAction::toggled, | 
					
						
							|  |  |  |           [](bool value) { SConfig::GetInstance().m_DumpFrames = value; }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   auto* dump_audio = movie_menu->addAction(tr("Dump Audio")); | 
					
						
							|  |  |  |   dump_audio->setCheckable(true); | 
					
						
							|  |  |  |   dump_audio->setChecked(SConfig::GetInstance().m_DumpAudio); | 
					
						
							|  |  |  |   connect(dump_audio, &QAction::toggled, | 
					
						
							|  |  |  |           [](bool value) { SConfig::GetInstance().m_DumpAudio = value; }); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-09 15:31:20 +02:00
										 |  |  | void MenuBar::AddJITMenu() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   m_jit = addMenu(tr("JIT")); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_jit_interpreter_core = m_jit->addAction(tr("Interpreter Core")); | 
					
						
							|  |  |  |   m_jit_interpreter_core->setCheckable(true); | 
					
						
							|  |  |  |   m_jit_interpreter_core->setChecked(SConfig::GetInstance().iCPUCore == PowerPC::CORE_INTERPRETER); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_jit->addSeparator(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_jit_block_linking = m_jit->addAction(tr("JIT Block Linking Off")); | 
					
						
							|  |  |  |   m_jit_block_linking->setCheckable(true); | 
					
						
							|  |  |  |   m_jit_block_linking->setChecked(SConfig::GetInstance().bJITNoBlockLinking); | 
					
						
							|  |  |  |   connect(m_jit_block_linking, &QAction::toggled, | 
					
						
							|  |  |  |           [](bool enabled) { SConfig::GetInstance().bJITNoBlockLinking = enabled; }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_jit_disable_cache = m_jit->addAction(tr("Disable JIT Cache")); | 
					
						
							|  |  |  |   m_jit_disable_cache->setCheckable(true); | 
					
						
							|  |  |  |   m_jit_disable_cache->setChecked(SConfig::GetInstance().bJITNoBlockCache); | 
					
						
							|  |  |  |   connect(m_jit_disable_cache, &QAction::toggled, | 
					
						
							|  |  |  |           [](bool enabled) { SConfig::GetInstance().bJITNoBlockCache = enabled; }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_jit_clear_cache = AddAction(m_jit, tr("Clear Cache"), this, &MenuBar::ClearCache); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_jit->addSeparator(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_jit_log_coverage = | 
					
						
							|  |  |  |       AddAction(m_jit, tr("Log JIT Instruction Coverage"), this, &MenuBar::LogInstructions); | 
					
						
							|  |  |  |   m_jit_search_instruction = | 
					
						
							|  |  |  |       AddAction(m_jit, tr("Search for an Instruction"), this, &MenuBar::SearchInstruction); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_jit->addSeparator(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_jit_off = m_jit->addAction(tr("JIT Off (JIT Core)")); | 
					
						
							|  |  |  |   m_jit_off->setCheckable(true); | 
					
						
							|  |  |  |   m_jit_off->setChecked(SConfig::GetInstance().bJITOff); | 
					
						
							|  |  |  |   connect(m_jit_off, &QAction::toggled, | 
					
						
							|  |  |  |           [](bool enabled) { SConfig::GetInstance().bJITOff = enabled; }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_jit_loadstore_off = m_jit->addAction(tr("JIT LoadStore Off")); | 
					
						
							|  |  |  |   m_jit_loadstore_off->setCheckable(true); | 
					
						
							|  |  |  |   m_jit_loadstore_off->setChecked(SConfig::GetInstance().bJITLoadStoreOff); | 
					
						
							|  |  |  |   connect(m_jit_loadstore_off, &QAction::toggled, | 
					
						
							|  |  |  |           [](bool enabled) { SConfig::GetInstance().bJITLoadStoreOff = enabled; }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_jit_loadstore_lbzx_off = m_jit->addAction(tr("JIT LoadStore lbzx Off")); | 
					
						
							|  |  |  |   m_jit_loadstore_lbzx_off->setCheckable(true); | 
					
						
							|  |  |  |   m_jit_loadstore_lbzx_off->setChecked(SConfig::GetInstance().bJITLoadStorelbzxOff); | 
					
						
							|  |  |  |   connect(m_jit_loadstore_lbzx_off, &QAction::toggled, | 
					
						
							|  |  |  |           [](bool enabled) { SConfig::GetInstance().bJITLoadStorelbzxOff = enabled; }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_jit_loadstore_lxz_off = m_jit->addAction(tr("JIT LoadStore lXz Off")); | 
					
						
							|  |  |  |   m_jit_loadstore_lxz_off->setCheckable(true); | 
					
						
							|  |  |  |   m_jit_loadstore_lxz_off->setChecked(SConfig::GetInstance().bJITLoadStorelXzOff); | 
					
						
							|  |  |  |   connect(m_jit_loadstore_lxz_off, &QAction::toggled, | 
					
						
							|  |  |  |           [](bool enabled) { SConfig::GetInstance().bJITLoadStorelXzOff = enabled; }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_jit_loadstore_lwz_off = m_jit->addAction(tr("JIT LoadStore lwz Off")); | 
					
						
							|  |  |  |   m_jit_loadstore_lwz_off->setCheckable(true); | 
					
						
							|  |  |  |   m_jit_loadstore_lwz_off->setChecked(SConfig::GetInstance().bJITLoadStorelwzOff); | 
					
						
							|  |  |  |   connect(m_jit_loadstore_lwz_off, &QAction::toggled, | 
					
						
							|  |  |  |           [](bool enabled) { SConfig::GetInstance().bJITLoadStorelwzOff = enabled; }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_jit_loadstore_floating_off = m_jit->addAction(tr("JIT LoadStore Floating Off")); | 
					
						
							|  |  |  |   m_jit_loadstore_floating_off->setCheckable(true); | 
					
						
							|  |  |  |   m_jit_loadstore_floating_off->setChecked(SConfig::GetInstance().bJITLoadStoreFloatingOff); | 
					
						
							|  |  |  |   connect(m_jit_loadstore_floating_off, &QAction::toggled, | 
					
						
							|  |  |  |           [](bool enabled) { SConfig::GetInstance().bJITLoadStoreFloatingOff = enabled; }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_jit_loadstore_paired_off = m_jit->addAction(tr("JIT LoadStore Paired Off")); | 
					
						
							|  |  |  |   m_jit_loadstore_paired_off->setCheckable(true); | 
					
						
							|  |  |  |   m_jit_loadstore_paired_off->setChecked(SConfig::GetInstance().bJITLoadStorePairedOff); | 
					
						
							|  |  |  |   connect(m_jit_loadstore_paired_off, &QAction::toggled, | 
					
						
							|  |  |  |           [](bool enabled) { SConfig::GetInstance().bJITLoadStorePairedOff = enabled; }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_jit_floatingpoint_off = m_jit->addAction(tr("JIT FloatingPoint Off")); | 
					
						
							|  |  |  |   m_jit_floatingpoint_off->setCheckable(true); | 
					
						
							|  |  |  |   m_jit_floatingpoint_off->setChecked(SConfig::GetInstance().bJITFloatingPointOff); | 
					
						
							|  |  |  |   connect(m_jit_floatingpoint_off, &QAction::toggled, | 
					
						
							|  |  |  |           [](bool enabled) { SConfig::GetInstance().bJITFloatingPointOff = enabled; }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_jit_integer_off = m_jit->addAction(tr("JIT Integer Off")); | 
					
						
							|  |  |  |   m_jit_integer_off->setCheckable(true); | 
					
						
							|  |  |  |   m_jit_integer_off->setChecked(SConfig::GetInstance().bJITIntegerOff); | 
					
						
							|  |  |  |   connect(m_jit_integer_off, &QAction::toggled, | 
					
						
							|  |  |  |           [](bool enabled) { SConfig::GetInstance().bJITIntegerOff = enabled; }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_jit_paired_off = m_jit->addAction(tr("JIT Paired Off")); | 
					
						
							|  |  |  |   m_jit_paired_off->setCheckable(true); | 
					
						
							|  |  |  |   m_jit_paired_off->setChecked(SConfig::GetInstance().bJITPairedOff); | 
					
						
							|  |  |  |   connect(m_jit_paired_off, &QAction::toggled, | 
					
						
							|  |  |  |           [](bool enabled) { SConfig::GetInstance().bJITPairedOff = enabled; }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   m_jit_systemregisters_off = m_jit->addAction(tr("JIT SystemRegisters Off")); | 
					
						
							|  |  |  |   m_jit_systemregisters_off->setCheckable(true); | 
					
						
							|  |  |  |   m_jit_systemregisters_off->setChecked(SConfig::GetInstance().bJITSystemRegistersOff); | 
					
						
							|  |  |  |   connect(m_jit_systemregisters_off, &QAction::toggled, | 
					
						
							|  |  |  |           [](bool enabled) { SConfig::GetInstance().bJITSystemRegistersOff = enabled; }); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  | void MenuBar::AddSymbolsMenu() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   m_symbols = addMenu(tr("Symbols")); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   AddAction(m_symbols, tr("&Clear Symbols"), this, &MenuBar::ClearSymbols); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-19 18:52:46 +01:00
										 |  |  |   auto* generate = m_symbols->addMenu(tr("&Generate Symbols From")); | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  |   AddAction(generate, tr("Address"), this, &MenuBar::GenerateSymbolsFromAddress); | 
					
						
							|  |  |  |   AddAction(generate, tr("Signature Database"), this, &MenuBar::GenerateSymbolsFromSignatureDB); | 
					
						
							|  |  |  |   AddAction(generate, tr("RSO Modules"), this, &MenuBar::GenerateSymbolsFromRSO); | 
					
						
							|  |  |  |   m_symbols->addSeparator(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   AddAction(m_symbols, tr("&Load Symbol Map"), this, &MenuBar::LoadSymbolMap); | 
					
						
							|  |  |  |   AddAction(m_symbols, tr("&Save Symbol Map"), this, &MenuBar::SaveSymbolMap); | 
					
						
							|  |  |  |   m_symbols->addSeparator(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-19 18:52:46 +01:00
										 |  |  |   AddAction(m_symbols, tr("Load &Other Map File..."), this, &MenuBar::LoadOtherSymbolMap); | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  |   AddAction(m_symbols, tr("Save Symbol Map &As..."), this, &MenuBar::SaveSymbolMapAs); | 
					
						
							|  |  |  |   m_symbols->addSeparator(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   AddAction(m_symbols, tr("Save Code"), this, &MenuBar::SaveCode); | 
					
						
							|  |  |  |   m_symbols->addSeparator(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   AddAction(m_symbols, tr("&Create Signature File..."), this, &MenuBar::CreateSignatureFile); | 
					
						
							|  |  |  |   m_symbols->addSeparator(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   AddAction(m_symbols, tr("&Patch HLE Functions"), this, &MenuBar::PatchHLEFunctions); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-14 11:58:11 +02:00
										 |  |  | void MenuBar::UpdateToolsMenu(bool emulation_started) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-07-06 11:00:37 +02:00
										 |  |  |   m_boot_sysmenu->setEnabled(!emulation_started); | 
					
						
							| 
									
										
										
										
											2017-07-06 11:01:32 +02:00
										 |  |  |   m_perform_online_update_menu->setEnabled(!emulation_started); | 
					
						
							| 
									
										
										
										
											2017-08-24 16:35:47 +02:00
										 |  |  |   m_ntscj_ipl->setEnabled(!emulation_started && | 
					
						
							|  |  |  |                           File::Exists(SConfig::GetInstance().GetBootROMPath(JAP_DIR))); | 
					
						
							|  |  |  |   m_ntscu_ipl->setEnabled(!emulation_started && | 
					
						
							|  |  |  |                           File::Exists(SConfig::GetInstance().GetBootROMPath(USA_DIR))); | 
					
						
							|  |  |  |   m_pal_ipl->setEnabled(!emulation_started && | 
					
						
							|  |  |  |                         File::Exists(SConfig::GetInstance().GetBootROMPath(EUR_DIR))); | 
					
						
							| 
									
										
										
										
											2017-08-24 17:38:31 +02:00
										 |  |  |   m_import_backup->setEnabled(!emulation_started); | 
					
						
							| 
									
										
										
										
											2017-10-03 16:45:59 +02:00
										 |  |  |   m_check_nand->setEnabled(!emulation_started); | 
					
						
							| 
									
										
										
										
											2017-07-06 11:00:37 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-06 11:01:32 +02:00
										 |  |  |   if (!emulation_started) | 
					
						
							| 
									
										
										
										
											2017-06-14 11:58:11 +02:00
										 |  |  |   { | 
					
						
							|  |  |  |     IOS::HLE::Kernel ios; | 
					
						
							|  |  |  |     const auto tmd = ios.GetES()->FindInstalledTMD(Titles::SYSTEM_MENU); | 
					
						
							| 
									
										
										
										
											2017-07-06 11:00:37 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     const QString sysmenu_version = | 
					
						
							|  |  |  |         tmd.IsValid() ? | 
					
						
							|  |  |  |             QString::fromStdString(DiscIO::GetSysMenuVersionString(tmd.GetTitleVersion())) : | 
					
						
							|  |  |  |             QStringLiteral(""); | 
					
						
							|  |  |  |     m_boot_sysmenu->setText(tr("Load Wii System Menu %1").arg(sysmenu_version)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-06 11:01:32 +02:00
										 |  |  |     m_boot_sysmenu->setEnabled(tmd.IsValid()); | 
					
						
							| 
									
										
										
										
											2017-07-06 11:00:37 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-14 11:58:11 +02:00
										 |  |  |     for (QAction* action : m_perform_online_update_menu->actions()) | 
					
						
							|  |  |  |       action->setEnabled(!tmd.IsValid()); | 
					
						
							|  |  |  |     m_perform_online_update_for_current_region->setEnabled(tmd.IsValid()); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2018-01-24 15:25:35 +01: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; | 
					
						
							|  |  |  |   bool enable_wiimotes = | 
					
						
							|  |  |  |       emulation_started && bt && !SConfig::GetInstance().m_bt_passthrough_enabled; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   for (int i = 0; i < 5; i++) | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     m_wii_remotes[i]->setEnabled(enable_wiimotes); | 
					
						
							|  |  |  |     if (enable_wiimotes) | 
					
						
							|  |  |  |       m_wii_remotes[i]->setChecked(bt->AccessWiiMote(0x0100 + i)->IsConnected()); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2017-06-14 11:58:11 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-04 23:01:12 +02:00
										 |  |  | void MenuBar::InstallWAD() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   QString wad_file = QFileDialog::getOpenFileName(this, tr("Select a title to install to NAND"), | 
					
						
							|  |  |  |                                                   QString(), tr("WAD files (*.wad)")); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (wad_file.isEmpty()) | 
					
						
							|  |  |  |     return; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   QMessageBox result_dialog(this); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-31 20:33:36 +01:00
										 |  |  |   if (WiiUtils::InstallWAD(wad_file.toStdString())) | 
					
						
							| 
									
										
										
										
											2017-05-04 23:01:12 +02:00
										 |  |  |   { | 
					
						
							| 
									
										
										
										
											2017-12-31 20:33:36 +01:00
										 |  |  |     Settings::Instance().NANDRefresh(); | 
					
						
							| 
									
										
										
										
											2017-05-04 23:01:12 +02:00
										 |  |  |     result_dialog.setIcon(QMessageBox::Information); | 
					
						
							| 
									
										
										
										
											2017-07-23 12:58:32 +02:00
										 |  |  |     result_dialog.setText(tr("Successfully installed this title to the NAND.")); | 
					
						
							| 
									
										
										
										
											2017-05-04 23:01:12 +02:00
										 |  |  |   } | 
					
						
							|  |  |  |   else | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     result_dialog.setIcon(QMessageBox::Critical); | 
					
						
							| 
									
										
										
										
											2017-07-23 12:58:32 +02:00
										 |  |  |     result_dialog.setText(tr("Failed to install this title to the NAND.")); | 
					
						
							| 
									
										
										
										
											2017-05-04 23:01:12 +02:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   result_dialog.exec(); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2017-08-24 15:11:04 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | void MenuBar::ImportWiiSave() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   QString file = QFileDialog::getOpenFileName(this, tr("Select the save file"), QDir::currentPath(), | 
					
						
							|  |  |  |                                               tr("Wii save files (*.bin);;" | 
					
						
							|  |  |  |                                                  "All Files (*)")); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-13 13:18:19 +02:00
										 |  |  |   if (file.isEmpty()) | 
					
						
							|  |  |  |     return; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (WiiSave::Import(file.toStdString())) | 
					
						
							|  |  |  |     QMessageBox::information(this, tr("Save Import"), tr("Successfully imported save files.")); | 
					
						
							|  |  |  |   else | 
					
						
							|  |  |  |     QMessageBox::critical(this, tr("Save Import"), tr("Failed to import save files.")); | 
					
						
							| 
									
										
										
										
											2017-08-24 15:11:04 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2017-08-24 15:21:21 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | void MenuBar::ExportWiiSaves() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-13 15:34:30 +02:00
										 |  |  |   const QString export_dir = QFileDialog::getExistingDirectory( | 
					
						
							|  |  |  |       this, tr("Select Export Directory"), QString::fromStdString(File::GetUserPath(D_USER_IDX)), | 
					
						
							|  |  |  |       QFileDialog::ShowDirsOnly); | 
					
						
							|  |  |  |   if (export_dir.isEmpty()) | 
					
						
							|  |  |  |     return; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   const size_t count = WiiSave::ExportAll(export_dir.toStdString()); | 
					
						
							| 
									
										
										
										
											2018-05-13 13:18:19 +02:00
										 |  |  |   QMessageBox::information(this, tr("Save Export"), | 
					
						
							| 
									
										
										
										
											2018-05-13 15:34:30 +02:00
										 |  |  |                            tr("Exported %n save(s)", "", static_cast<int>(count))); | 
					
						
							| 
									
										
										
										
											2017-08-24 15:21:21 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2017-08-24 17:38:31 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-03 16:45:59 +02:00
										 |  |  | void MenuBar::CheckNAND() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   IOS::HLE::Kernel ios; | 
					
						
							| 
									
										
										
										
											2017-10-06 21:45:28 +02:00
										 |  |  |   WiiUtils::NANDCheckResult result = WiiUtils::CheckNAND(ios); | 
					
						
							|  |  |  |   if (!result.bad) | 
					
						
							| 
									
										
										
										
											2017-10-03 16:45:59 +02:00
										 |  |  |   { | 
					
						
							|  |  |  |     QMessageBox::information(this, tr("NAND Check"), tr("No issues have been detected.")); | 
					
						
							|  |  |  |     return; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-06 21:45:28 +02:00
										 |  |  |   QString message = tr("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 16:45:59 +02:00
										 |  |  |   { | 
					
						
							| 
									
										
										
										
											2017-11-02 11:37:51 +01:00
										 |  |  |     std::string title_listings; | 
					
						
							| 
									
										
										
										
											2017-10-06 21:45:28 +02:00
										 |  |  |     Core::TitleDatabase title_db; | 
					
						
							|  |  |  |     for (const u64 title_id : result.titles_to_remove) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2017-11-02 17:34:04 +01: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 11:37:51 +01:00
										 |  |  |       title_listings += "\n"; | 
					
						
							| 
									
										
										
										
											2017-10-06 21:45:28 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2017-11-02 11:37:51 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     message += tr("\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" | 
					
						
							|  |  |  |                   "%1" | 
					
						
							|  |  |  |                   "\nLaunching these titles may also fix the issues.") | 
					
						
							|  |  |  |                    .arg(QString::fromStdString(title_listings)); | 
					
						
							| 
									
										
										
										
											2017-10-03 16:45:59 +02:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-06 21:45:28 +02:00
										 |  |  |   if (QMessageBox::question(this, tr("NAND Check"), message) != QMessageBox::Yes) | 
					
						
							|  |  |  |     return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-03 16:45:59 +02:00
										 |  |  |   if (WiiUtils::RepairNAND(ios)) | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     QMessageBox::information(this, tr("NAND Check"), tr("The NAND has been repaired.")); | 
					
						
							|  |  |  |     return; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   QMessageBox::critical(this, tr("NAND Check"), | 
					
						
							|  |  |  |                         tr("The NAND could not be repaired. It is recommended to back up " | 
					
						
							|  |  |  |                            "your current data and start over with a fresh NAND.")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-26 14:41:53 +02:00
										 |  |  | void MenuBar::NANDExtractCertificates() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   if (DiscIO::NANDImporter().ExtractCertificates(File::GetUserPath(D_WIIROOT_IDX))) | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     QMessageBox::information(this, tr("Success"), | 
					
						
							|  |  |  |                              tr("Successfully extracted certificates from NAND")); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     QMessageBox::critical(this, tr("Error"), tr("Failed to extract certificates from NAND")); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2017-08-27 13:55:05 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-31 20:33:36 +01:00
										 |  |  | void MenuBar::OnSelectionChanged(std::shared_ptr<const UICommon::GameFile> game_file) | 
					
						
							| 
									
										
										
										
											2017-08-27 13:55:05 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-12-31 20:33:36 +01:00
										 |  |  |   const bool game_selected = !!game_file; | 
					
						
							| 
									
										
										
										
											2017-08-27 13:55:05 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-31 20:33:36 +01:00
										 |  |  |   m_recording_play->setEnabled(game_selected && !Core::IsRunning()); | 
					
						
							|  |  |  |   m_recording_start->setEnabled(game_selected && !Movie::IsPlayingInput()); | 
					
						
							| 
									
										
										
										
											2017-08-27 13:55:05 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MenuBar::OnRecordingStatusChanged(bool recording) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   m_recording_start->setEnabled(!recording); | 
					
						
							|  |  |  |   m_recording_stop->setEnabled(recording); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MenuBar::OnReadOnlyModeChanged(bool read_only) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   m_recording_read_only->setChecked(read_only); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | void MenuBar::ChangeDebugFont() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   bool okay; | 
					
						
							|  |  |  |   QFont font = QFontDialog::getFont(&okay, Settings::Instance().GetDebugFont(), this, | 
					
						
							|  |  |  |                                     tr("Pick a debug font")); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (okay) | 
					
						
							|  |  |  |     Settings::Instance().SetDebugFont(font); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MenuBar::ClearSymbols() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   auto result = QMessageBox::warning(this, tr("Confirmation"), | 
					
						
							|  |  |  |                                      tr("Do you want to clear the list of symbol names?"), | 
					
						
							|  |  |  |                                      QMessageBox::Yes | QMessageBox::Cancel); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (result == QMessageBox::Cancel) | 
					
						
							|  |  |  |     return; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   g_symbolDB.Clear(); | 
					
						
							| 
									
										
										
										
											2018-05-11 16:38:32 -04:00
										 |  |  |   emit NotifySymbolsUpdated(); | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MenuBar::GenerateSymbolsFromAddress() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   PPCAnalyst::FindFunctions(0x80000000, 0x81800000, &g_symbolDB); | 
					
						
							| 
									
										
										
										
											2018-05-11 16:38:32 -04:00
										 |  |  |   emit NotifySymbolsUpdated(); | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MenuBar::GenerateSymbolsFromSignatureDB() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   PPCAnalyst::FindFunctions(0x80000000, 0x81800000, &g_symbolDB); | 
					
						
							|  |  |  |   SignatureDB db(SignatureDB::HandlerType::DSY); | 
					
						
							|  |  |  |   if (db.Load(File::GetSysDirectory() + TOTALDB)) | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     db.Apply(&g_symbolDB); | 
					
						
							|  |  |  |     QMessageBox::information( | 
					
						
							|  |  |  |         this, tr("Information"), | 
					
						
							|  |  |  |         tr("Generated symbol names from '%1'").arg(QString::fromStdString(TOTALDB))); | 
					
						
							|  |  |  |     db.List(); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     QMessageBox::critical( | 
					
						
							|  |  |  |         this, tr("Error"), | 
					
						
							|  |  |  |         tr("'%1' not found, no symbol names generated").arg(QString::fromStdString(TOTALDB))); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-11 16:38:32 -04:00
										 |  |  |   emit NotifySymbolsUpdated(); | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MenuBar::GenerateSymbolsFromRSO() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   QString text = QInputDialog::getText(this, tr("Input"), tr("Enter the RSO module address:")); | 
					
						
							|  |  |  |   bool good; | 
					
						
							|  |  |  |   uint address = text.toUInt(&good, 16); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (!good) | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     QMessageBox::warning(this, tr("Error"), tr("Invalid RSO module address: %1").arg(text)); | 
					
						
							|  |  |  |     return; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   RSOChainView rso_chain; | 
					
						
							|  |  |  |   if (rso_chain.Load(static_cast<u32>(address))) | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     rso_chain.Apply(&g_symbolDB); | 
					
						
							| 
									
										
										
										
											2018-05-11 16:38:32 -04:00
										 |  |  |     emit NotifySymbolsUpdated(); | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  |   } | 
					
						
							|  |  |  |   else | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     QMessageBox::warning(this, tr("Error"), tr("Failed to load RSO module at %1").arg(text)); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MenuBar::LoadSymbolMap() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   std::string existing_map_file, writable_map_file; | 
					
						
							|  |  |  |   bool map_exists = CBoot::FindMapFile(&existing_map_file, &writable_map_file); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (!map_exists) | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     g_symbolDB.Clear(); | 
					
						
							|  |  |  |     PPCAnalyst::FindFunctions(0x81300000, 0x81800000, &g_symbolDB); | 
					
						
							|  |  |  |     SignatureDB db(SignatureDB::HandlerType::DSY); | 
					
						
							|  |  |  |     if (db.Load(File::GetSysDirectory() + TOTALDB)) | 
					
						
							|  |  |  |       db.Apply(&g_symbolDB); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QMessageBox::warning(this, tr("Warning"), | 
					
						
							|  |  |  |                          tr("'%1' not found, scanning for common functions instead") | 
					
						
							|  |  |  |                              .arg(QString::fromStdString(writable_map_file))); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     g_symbolDB.LoadMap(existing_map_file); | 
					
						
							|  |  |  |     QMessageBox::information( | 
					
						
							|  |  |  |         this, tr("Information"), | 
					
						
							| 
									
										
										
										
											2018-03-27 22:27:48 -04:00
										 |  |  |         tr("Loaded symbols from '%1'").arg(QString::fromStdString(existing_map_file))); | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   HLE::PatchFunctions(); | 
					
						
							| 
									
										
										
										
											2018-05-11 16:38:32 -04:00
										 |  |  |   emit NotifySymbolsUpdated(); | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MenuBar::SaveSymbolMap() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   std::string existing_map_file, writable_map_file; | 
					
						
							|  |  |  |   CBoot::FindMapFile(&existing_map_file, &writable_map_file); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   g_symbolDB.SaveSymbolMap(writable_map_file); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MenuBar::LoadOtherSymbolMap() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   QString file = QFileDialog::getOpenFileName(this, tr("Load map file"), | 
					
						
							|  |  |  |                                               QString::fromStdString(File::GetUserPath(D_MAPS_IDX)), | 
					
						
							|  |  |  |                                               tr("Dolphin Map File (*.map)")); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (file.isEmpty()) | 
					
						
							|  |  |  |     return; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   g_symbolDB.LoadMap(file.toStdString()); | 
					
						
							|  |  |  |   HLE::PatchFunctions(); | 
					
						
							| 
									
										
										
										
											2018-05-11 16:38:32 -04:00
										 |  |  |   emit NotifySymbolsUpdated(); | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MenuBar::SaveSymbolMapAs() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   const std::string& title_id_str = SConfig::GetInstance().m_debugger_game_id; | 
					
						
							|  |  |  |   QString file = QFileDialog::getSaveFileName( | 
					
						
							|  |  |  |       this, tr("Save map file"), | 
					
						
							|  |  |  |       QString::fromStdString(File::GetUserPath(D_MAPS_IDX) + "/" + title_id_str + ".map"), | 
					
						
							|  |  |  |       tr("Dolphin Map File (*.map)")); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (file.isEmpty()) | 
					
						
							|  |  |  |     return; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   g_symbolDB.SaveSymbolMap(file.toStdString()); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MenuBar::SaveCode() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   std::string existing_map_file, writable_map_file; | 
					
						
							|  |  |  |   CBoot::FindMapFile(&existing_map_file, &writable_map_file); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   const std::string path = | 
					
						
							| 
									
										
										
										
											2018-03-27 22:27:48 -04:00
										 |  |  |       writable_map_file.substr(0, writable_map_file.find_last_of('.')) + "_code.map"; | 
					
						
							| 
									
										
										
										
											2018-02-14 23:25:01 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   g_symbolDB.SaveCodeMap(path); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MenuBar::CreateSignatureFile() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   QString text = QInputDialog::getText( | 
					
						
							|  |  |  |       this, tr("Input"), tr("Only export symbols with prefix:\n(Blank for all symbols)")); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (text.isEmpty()) | 
					
						
							|  |  |  |     return; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   std::string prefix = text.toStdString(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   QString file = QFileDialog::getSaveFileName(this, tr("Save signature file")); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (file.isEmpty()) | 
					
						
							|  |  |  |     return; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   std::string save_path = file.toStdString(); | 
					
						
							|  |  |  |   SignatureDB db(save_path); | 
					
						
							|  |  |  |   db.Populate(&g_symbolDB, prefix); | 
					
						
							|  |  |  |   db.Save(save_path); | 
					
						
							|  |  |  |   db.List(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MenuBar::PatchHLEFunctions() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   HLE::PatchFunctions(); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2018-04-09 15:31:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | void MenuBar::ClearCache() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   Core::RunAsCPUThread(JitInterface::ClearCache); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MenuBar::LogInstructions() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   PPCTables::LogCompiledInstructions(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void MenuBar::SearchInstruction() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   bool good; | 
					
						
							|  |  |  |   QString op = QInputDialog::getText(this, tr("Search instruction"), tr("Instruction:"), | 
					
						
							|  |  |  |                                      QLineEdit::Normal, QStringLiteral(""), &good); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (!good) | 
					
						
							|  |  |  |     return; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   bool found = false; | 
					
						
							|  |  |  |   for (u32 addr = 0x80000000; addr < 0x81800000; addr += 4) | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     auto ins_name = | 
					
						
							|  |  |  |         QString::fromStdString(PPCTables::GetInstructionName(PowerPC::HostRead_U32(addr))); | 
					
						
							|  |  |  |     if (op == ins_name) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       NOTICE_LOG(POWERPC, "Found %s at %08x", op.toStdString().c_str(), addr); | 
					
						
							|  |  |  |       found = true; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   if (!found) | 
					
						
							|  |  |  |     NOTICE_LOG(POWERPC, "Opcode %s not found", op.toStdString().c_str()); | 
					
						
							|  |  |  | } |