2015-11-27 01:33:07 -07:00
|
|
|
// Copyright 2015 Dolphin Emulator Project
|
2021-07-04 19:22:19 -06:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2015-11-27 01:33:07 -07:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
2018-11-05 11:20:45 -07:00
|
|
|
#include <QStringList>
|
2015-11-27 01:33:07 -07:00
|
|
|
|
2020-08-19 00:25:57 -06:00
|
|
|
#include <array>
|
2017-08-24 08:35:47 -06:00
|
|
|
#include <memory>
|
2017-12-25 10:07:29 -07:00
|
|
|
#include <optional>
|
2017-12-31 12:33:36 -07:00
|
|
|
#include <string>
|
2017-08-24 08:35:47 -06:00
|
|
|
|
2018-07-14 21:20:59 -06:00
|
|
|
class QStackedWidget;
|
|
|
|
class QString;
|
2018-03-23 19:13:56 -06:00
|
|
|
|
2017-10-03 10:43:44 -06:00
|
|
|
class BreakpointWidget;
|
2017-08-24 08:35:47 -06:00
|
|
|
struct BootParameters;
|
2018-03-25 20:17:47 -06:00
|
|
|
class CheatsManager;
|
2018-02-14 15:25:01 -07:00
|
|
|
class CodeWidget;
|
2018-03-23 19:13:56 -06:00
|
|
|
class ControllersWindow;
|
2018-07-03 15:50:08 -06:00
|
|
|
class DiscordHandler;
|
2018-03-23 19:13:56 -06:00
|
|
|
class DragEnterEvent;
|
2017-08-30 08:44:28 -06:00
|
|
|
class FIFOPlayerWindow;
|
2020-06-11 23:27:34 -06:00
|
|
|
class FreeLookWindow;
|
2018-07-14 21:20:59 -06:00
|
|
|
class GameList;
|
2018-03-23 19:13:56 -06:00
|
|
|
class GCTASInputWindow;
|
|
|
|
class GraphicsWindow;
|
2017-06-06 05:49:49 -06:00
|
|
|
class HotkeyScheduler;
|
2018-04-09 07:31:20 -06:00
|
|
|
class JITWidget;
|
2017-08-27 16:10:06 -06:00
|
|
|
class LogConfigWidget;
|
|
|
|
class LogWidget;
|
2018-10-14 06:15:26 -06:00
|
|
|
class MappingWindow;
|
2018-03-16 05:39:53 -06:00
|
|
|
class MemoryWidget;
|
2018-07-14 21:20:59 -06:00
|
|
|
class MenuBar;
|
2017-07-21 14:48:21 -06:00
|
|
|
class NetPlayDialog;
|
|
|
|
class NetPlaySetupDialog;
|
2020-04-19 13:30:50 -06:00
|
|
|
class NetworkWidget;
|
2018-03-23 19:13:56 -06:00
|
|
|
class RegisterWidget;
|
2018-07-14 21:20:59 -06:00
|
|
|
class RenderWidget;
|
2018-03-21 04:13:53 -06:00
|
|
|
class SearchBar;
|
2016-05-09 07:34:07 -06:00
|
|
|
class SettingsWindow;
|
2020-03-21 01:48:49 -06:00
|
|
|
class ThreadWidget;
|
2018-07-14 21:20:59 -06:00
|
|
|
class ToolBar;
|
2017-09-27 00:53:05 -06:00
|
|
|
class WatchWidget;
|
2018-01-31 04:35:09 -07:00
|
|
|
class WiiTASInputWindow;
|
2016-02-09 21:42:06 -07:00
|
|
|
|
2018-07-14 21:20:59 -06:00
|
|
|
namespace DiscIO
|
|
|
|
{
|
|
|
|
enum class Region;
|
|
|
|
}
|
|
|
|
|
2018-11-05 11:20:45 -07:00
|
|
|
namespace UICommon
|
|
|
|
{
|
|
|
|
class GameFile;
|
|
|
|
}
|
|
|
|
|
2018-04-05 07:03:12 -06:00
|
|
|
namespace X11Utils
|
|
|
|
{
|
|
|
|
class XRRConfiguration;
|
|
|
|
}
|
|
|
|
|
2015-11-27 01:33:07 -07:00
|
|
|
class MainWindow final : public QMainWindow
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
Q_OBJECT
|
2015-11-27 01:33:07 -07:00
|
|
|
|
|
|
|
public:
|
2019-03-27 07:26:17 -06:00
|
|
|
explicit MainWindow(std::unique_ptr<BootParameters> boot_parameters,
|
|
|
|
const std::string& movie_path);
|
2016-06-24 02:43:46 -06:00
|
|
|
~MainWindow();
|
2015-11-27 01:33:07 -07:00
|
|
|
|
2018-05-13 07:03:48 -06:00
|
|
|
void Show();
|
|
|
|
|
2017-06-24 09:00:37 -06:00
|
|
|
bool eventFilter(QObject* object, QEvent* event) override;
|
|
|
|
|
2015-11-27 01:33:07 -07:00
|
|
|
signals:
|
2017-08-27 05:55:05 -06:00
|
|
|
void ReadOnlyModeChanged(bool read_only);
|
|
|
|
void RecordingStatusChanged(bool recording);
|
2015-11-27 01:33:07 -07:00
|
|
|
|
2017-06-30 03:24:26 -06:00
|
|
|
private:
|
2016-06-24 02:43:46 -06:00
|
|
|
void Open();
|
2018-06-04 13:44:46 -06:00
|
|
|
void RefreshGameList();
|
2017-12-25 10:07:29 -07:00
|
|
|
void Play(const std::optional<std::string>& savestate_path = {});
|
2016-06-24 02:43:46 -06:00
|
|
|
void Pause();
|
2018-02-09 04:54:35 -07:00
|
|
|
void TogglePause();
|
2016-06-24 02:43:46 -06:00
|
|
|
|
|
|
|
// May ask for confirmation. Returns whether or not it actually stopped.
|
2017-07-03 08:04:24 -06:00
|
|
|
bool RequestStop();
|
2016-06-24 02:43:46 -06:00
|
|
|
void ForceStop();
|
|
|
|
void Reset();
|
|
|
|
void FrameAdvance();
|
|
|
|
void StateLoad();
|
|
|
|
void StateSave();
|
|
|
|
void StateLoadSlot();
|
|
|
|
void StateSaveSlot();
|
|
|
|
void StateLoadSlotAt(int slot);
|
|
|
|
void StateSaveSlotAt(int slot);
|
2018-05-17 12:27:14 -06:00
|
|
|
void StateLoadLastSavedAt(int slot);
|
2016-06-24 02:43:46 -06:00
|
|
|
void StateLoadUndo();
|
|
|
|
void StateSaveUndo();
|
|
|
|
void StateSaveOldest();
|
|
|
|
void SetStateSlot(int slot);
|
2017-07-06 03:01:32 -06:00
|
|
|
void BootWiiSystemMenu();
|
2016-06-24 02:43:46 -06:00
|
|
|
|
2017-06-14 03:58:11 -06:00
|
|
|
void PerformOnlineUpdate(const std::string& region);
|
|
|
|
|
2018-05-07 10:38:59 -06:00
|
|
|
void SetFullScreenResolution(bool fullscreen);
|
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
void FullScreen();
|
2021-05-09 04:28:04 -06:00
|
|
|
void UnlockCursor();
|
2016-06-24 02:43:46 -06:00
|
|
|
void ScreenShot();
|
2015-11-27 01:33:07 -07:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
void CreateComponents();
|
|
|
|
|
|
|
|
void ConnectGameList();
|
2018-03-23 19:13:56 -06:00
|
|
|
void ConnectHost();
|
2017-06-06 05:49:49 -06:00
|
|
|
void ConnectHotkeys();
|
2016-06-24 02:43:46 -06:00
|
|
|
void ConnectMenuBar();
|
|
|
|
void ConnectRenderWidget();
|
|
|
|
void ConnectStack();
|
|
|
|
void ConnectToolBar();
|
|
|
|
|
2017-05-23 14:12:01 -06:00
|
|
|
void InitControllers();
|
2017-05-31 22:11:54 -06:00
|
|
|
void ShutdownControllers();
|
2017-05-23 14:12:01 -06:00
|
|
|
|
2017-06-16 07:27:00 -06:00
|
|
|
void InitCoreCallbacks();
|
|
|
|
|
2018-11-05 11:20:45 -07:00
|
|
|
enum class ScanForSecondDisc
|
|
|
|
{
|
|
|
|
Yes,
|
|
|
|
No,
|
|
|
|
};
|
|
|
|
|
|
|
|
void ScanForSecondDiscAndStartGame(const UICommon::GameFile& game,
|
|
|
|
const std::optional<std::string>& savestate_path = {});
|
|
|
|
void StartGame(const QString& path, ScanForSecondDisc scan,
|
|
|
|
const std::optional<std::string>& savestate_path = {});
|
|
|
|
void StartGame(const std::string& path, ScanForSecondDisc scan,
|
|
|
|
const std::optional<std::string>& savestate_path = {});
|
|
|
|
void StartGame(const std::vector<std::string>& paths,
|
|
|
|
const std::optional<std::string>& savestate_path = {});
|
2017-08-24 08:35:47 -06:00
|
|
|
void StartGame(std::unique_ptr<BootParameters>&& parameters);
|
2016-06-24 02:43:46 -06:00
|
|
|
void ShowRenderWidget();
|
2021-05-20 16:33:38 -06:00
|
|
|
void HideRenderWidget(bool reinit = true, bool is_exit = false);
|
2016-06-24 02:43:46 -06:00
|
|
|
|
|
|
|
void ShowSettingsWindow();
|
2017-09-10 11:10:45 -06:00
|
|
|
void ShowGeneralWindow();
|
2017-07-16 15:11:11 -06:00
|
|
|
void ShowAudioWindow();
|
2017-05-09 10:49:10 -06:00
|
|
|
void ShowControllersWindow();
|
2017-06-15 17:42:12 -06:00
|
|
|
void ShowGraphicsWindow();
|
2020-06-11 23:27:34 -06:00
|
|
|
void ShowFreeLookWindow();
|
2016-06-24 02:43:46 -06:00
|
|
|
void ShowAboutDialog();
|
2017-06-06 05:49:49 -06:00
|
|
|
void ShowHotkeyDialog();
|
2017-07-21 14:48:21 -06:00
|
|
|
void ShowNetPlaySetupDialog();
|
2019-03-30 07:50:57 -06:00
|
|
|
void ShowNetPlayBrowser();
|
2017-08-30 08:44:28 -06:00
|
|
|
void ShowFIFOPlayer();
|
2018-01-25 11:54:50 -07:00
|
|
|
void ShowMemcardManager();
|
2018-11-17 08:36:28 -07:00
|
|
|
void ShowResourcePackManager();
|
2018-03-25 20:17:47 -06:00
|
|
|
void ShowCheatsManager();
|
2021-09-25 22:17:51 -06:00
|
|
|
void ShowRiivolutionBootWidget(const UICommon::GameFile& game);
|
2017-07-21 14:48:21 -06:00
|
|
|
|
|
|
|
void NetPlayInit();
|
|
|
|
bool NetPlayJoin();
|
2020-06-07 14:58:03 -06:00
|
|
|
bool NetPlayHost(const UICommon::GameFile& game);
|
2017-07-21 14:48:21 -06:00
|
|
|
void NetPlayQuit();
|
2016-06-24 02:43:46 -06:00
|
|
|
|
2017-08-24 08:35:47 -06:00
|
|
|
void OnBootGameCubeIPL(DiscIO::Region region);
|
2017-08-24 09:38:31 -06:00
|
|
|
void OnImportNANDBackup();
|
2018-01-24 07:25:35 -07:00
|
|
|
void OnConnectWiiRemote(int id);
|
2020-01-27 13:26:39 -07:00
|
|
|
|
|
|
|
#if defined(__unix__) || defined(__unix) || defined(__APPLE__)
|
2018-05-22 13:30:54 -06:00
|
|
|
void OnSignal();
|
2020-01-27 13:26:39 -07:00
|
|
|
#endif
|
2017-08-27 05:55:05 -06:00
|
|
|
|
|
|
|
void OnPlayRecording();
|
|
|
|
void OnStartRecording();
|
|
|
|
void OnStopRecording();
|
|
|
|
void OnExportRecording();
|
2019-03-24 08:57:36 -06:00
|
|
|
void OnActivateChat();
|
2019-04-02 06:08:27 -06:00
|
|
|
void OnRequestGolfControl();
|
2018-01-27 06:35:02 -07:00
|
|
|
void ShowTASInput();
|
2017-08-27 05:55:05 -06:00
|
|
|
|
2018-03-22 18:18:53 -06:00
|
|
|
void ChangeDisc();
|
|
|
|
void EjectDisc();
|
|
|
|
|
2018-11-05 11:20:45 -07:00
|
|
|
QStringList PromptFileNames();
|
2018-03-22 18:18:53 -06:00
|
|
|
|
2020-10-18 12:06:11 -06:00
|
|
|
void UpdateScreenSaverInhibition();
|
2018-01-01 14:15:26 -07:00
|
|
|
|
2017-07-03 08:04:24 -06:00
|
|
|
void OnStopComplete();
|
2017-06-26 15:22:40 -06:00
|
|
|
void dragEnterEvent(QDragEnterEvent* event) override;
|
|
|
|
void dropEvent(QDropEvent* event) override;
|
2017-05-26 19:24:07 -06:00
|
|
|
QSize sizeHint() const override;
|
2017-06-26 15:22:40 -06:00
|
|
|
|
2021-02-22 06:32:53 -07:00
|
|
|
#ifdef HAVE_XRANDR
|
2018-04-05 07:03:12 -06:00
|
|
|
std::unique_ptr<X11Utils::XRRConfiguration> m_xrr_config;
|
|
|
|
#endif
|
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
QStackedWidget* m_stack;
|
|
|
|
ToolBar* m_tool_bar;
|
|
|
|
MenuBar* m_menu_bar;
|
2018-03-21 04:13:53 -06:00
|
|
|
SearchBar* m_search_bar;
|
2016-06-24 02:43:46 -06:00
|
|
|
GameList* m_game_list;
|
2018-10-03 01:34:27 -06:00
|
|
|
RenderWidget* m_render_widget = nullptr;
|
2016-06-24 02:43:46 -06:00
|
|
|
bool m_rendering_to_main;
|
2019-11-10 15:58:39 -07:00
|
|
|
bool m_stop_confirm_showing = false;
|
2017-06-24 09:00:37 -06:00
|
|
|
bool m_stop_requested = false;
|
2017-07-03 08:04:24 -06:00
|
|
|
bool m_exit_requested = false;
|
2018-06-08 11:59:24 -06:00
|
|
|
bool m_fullscreen_requested = false;
|
2020-10-22 12:19:01 -06:00
|
|
|
bool m_is_screensaver_inhibited = false;
|
2016-06-24 02:43:46 -06:00
|
|
|
int m_state_slot = 1;
|
2017-08-24 08:35:47 -06:00
|
|
|
std::unique_ptr<BootParameters> m_pending_boot;
|
2016-06-24 02:43:46 -06:00
|
|
|
|
2018-10-14 05:46:54 -06:00
|
|
|
ControllersWindow* m_controllers_window = nullptr;
|
|
|
|
SettingsWindow* m_settings_window = nullptr;
|
|
|
|
GraphicsWindow* m_graphics_window = nullptr;
|
|
|
|
FIFOPlayerWindow* m_fifo_window = nullptr;
|
2018-10-14 06:15:26 -06:00
|
|
|
MappingWindow* m_hotkey_window = nullptr;
|
2020-06-11 23:27:34 -06:00
|
|
|
FreeLookWindow* m_freelook_window = nullptr;
|
2018-10-14 05:46:54 -06:00
|
|
|
|
2017-06-06 05:49:49 -06:00
|
|
|
HotkeyScheduler* m_hotkey_scheduler;
|
2017-07-21 14:48:21 -06:00
|
|
|
NetPlayDialog* m_netplay_dialog;
|
2018-07-03 15:50:08 -06:00
|
|
|
DiscordHandler* m_netplay_discord;
|
2017-07-21 14:48:21 -06:00
|
|
|
NetPlaySetupDialog* m_netplay_setup_dialog;
|
2018-01-31 04:35:09 -07:00
|
|
|
static constexpr int num_gc_controllers = 4;
|
|
|
|
std::array<GCTASInputWindow*, num_gc_controllers> m_gc_tas_input_windows{};
|
|
|
|
static constexpr int num_wii_controllers = 4;
|
|
|
|
std::array<WiiTASInputWindow*, num_wii_controllers> m_wii_tas_input_windows{};
|
2017-09-13 11:33:45 -06:00
|
|
|
|
2017-10-03 10:43:44 -06:00
|
|
|
BreakpointWidget* m_breakpoint_widget;
|
2018-02-14 15:25:01 -07:00
|
|
|
CodeWidget* m_code_widget;
|
2018-04-09 07:31:20 -06:00
|
|
|
JITWidget* m_jit_widget;
|
2017-08-27 16:10:06 -06:00
|
|
|
LogWidget* m_log_widget;
|
|
|
|
LogConfigWidget* m_log_config_widget;
|
2018-03-16 05:39:53 -06:00
|
|
|
MemoryWidget* m_memory_widget;
|
2020-04-19 13:30:50 -06:00
|
|
|
NetworkWidget* m_network_widget;
|
2017-09-13 11:33:45 -06:00
|
|
|
RegisterWidget* m_register_widget;
|
2020-03-21 01:48:49 -06:00
|
|
|
ThreadWidget* m_thread_widget;
|
2017-09-27 00:53:05 -06:00
|
|
|
WatchWidget* m_watch_widget;
|
2018-03-25 20:17:47 -06:00
|
|
|
CheatsManager* m_cheats_manager;
|
2018-05-12 16:59:09 -06:00
|
|
|
QByteArray m_render_widget_geometry;
|
2015-11-27 01:33:07 -07:00
|
|
|
};
|