| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <QMainWindow> |
| 7 |
#include <QStringList> |
| 8 |
|
| 9 |
#include <array> |
| 10 |
#include <memory> |
| 11 |
#include <optional> |
| 12 |
#include <string> |
| 13 |
|
| 14 |
#ifdef USE_RETRO_ACHIEVEMENTS |
| 15 |
#include "Common/Config/Config.h" |
| 16 |
#endif |
| 17 |
|
| 18 |
#include "Core/Boot/Boot.h" |
| 19 |
#include "DolphinQt/FIFO/FIFOPlayerWindow.h" |
| 20 |
|
| 21 |
class QMenu; |
| 22 |
class QStackedWidget; |
| 23 |
class QString; |
| 24 |
|
| 25 |
class AchievementsWindow; |
| 26 |
class AssemblerWidget; |
| 27 |
class BreakpointWidget; |
| 28 |
struct BootParameters; |
| 29 |
class CheatsManager; |
| 30 |
class CodeWidget; |
| 31 |
class DiscordHandler; |
| 32 |
class DragEnterEvent; |
| 33 |
class FreeLookWindow; |
| 34 |
class GameCount; |
| 35 |
class GameList; |
| 36 |
class GBATASInputWindow; |
| 37 |
class GCTASInputWindow; |
| 38 |
class HotkeyScheduler; |
| 39 |
class InfinityBaseWindow; |
| 40 |
class JITWidget; |
| 41 |
class LogConfigWidget; |
| 42 |
class LogWidget; |
| 43 |
class MappingWindow; |
| 44 |
class MemoryWidget; |
| 45 |
class MenuBar; |
| 46 |
class NetPlayDialog; |
| 47 |
class NetPlaySetupDialog; |
| 48 |
class NetworkWidget; |
| 49 |
class RegisterWidget; |
| 50 |
class RenderWidget; |
| 51 |
class SearchBar; |
| 52 |
class SettingsWindow; |
| 53 |
class SkylanderPortalWindow; |
| 54 |
class ThreadWidget; |
| 55 |
class ToolBar; |
| 56 |
class WatchWidget; |
| 57 |
class WiiTASInputWindow; |
| 58 |
class WiiSpeakWindow; |
| 59 |
class LogitechMicWindow; |
| 60 |
struct WindowSystemInfo; |
| 61 |
|
| 62 |
namespace Core |
| 63 |
{ |
| 64 |
class System; |
| 65 |
} |
| 66 |
|
| 67 |
namespace DiscIO |
| 68 |
{ |
| 69 |
enum class Region; |
| 70 |
} |
| 71 |
|
| 72 |
namespace UICommon |
| 73 |
{ |
| 74 |
class GameFile; |
| 75 |
} |
| 76 |
|
| 77 |
namespace X11Utils |
| 78 |
{ |
| 79 |
class XRRConfiguration; |
| 80 |
} |
| 81 |
|
| 82 |
class MainWindow final : public QMainWindow |
| 83 |
{ |
| 84 |
Q_OBJECT |
| 85 |
|
| 86 |
public: |
| 87 |
explicit MainWindow(Core::System& system, std::unique_ptr<BootParameters> boot_parameters, |
| 88 |
const std::string& movie_path); |
| 89 |
~MainWindow() override; |
| 90 |
|
| 91 |
WindowSystemInfo GetWindowSystemInfo() const; |
| 92 |
|
| 93 |
bool eventFilter(QObject* object, QEvent* event) override; |
| 94 |
QMenu* createPopupMenu() override; |
| 95 |
|
| 96 |
void ShowTriforceWindow(); |
| 97 |
|
| 98 |
signals: |
| 99 |
void ReadOnlyModeChanged(bool read_only); |
| 100 |
void RecordingStatusChanged(bool recording); |
| 101 |
|
| 102 |
private: |
| 103 |
void Open(); |
| 104 |
void RefreshGameList(); |
| 105 |
void Play(const std::optional<std::string>& savestate_path = {}); |
| 106 |
void Pause(); |
| 107 |
void TogglePause(); |
| 108 |
|
| 109 |
|
| 110 |
bool RequestStop(); |
| 111 |
void ForceStop(); |
| 112 |
void Reset(); |
| 113 |
void FrameAdvance(); |
| 114 |
void StateLoad(); |
| 115 |
void StateSave(); |
| 116 |
void StateLoadSlot(); |
| 117 |
void StateSaveSlot(); |
| 118 |
void StateLoadSlotAt(int slot); |
| 119 |
void StateSaveSlotAt(int slot); |
| 120 |
void StateLoadLastSavedAt(int slot); |
| 121 |
void StateLoadUndo(); |
| 122 |
void StateSaveUndo(); |
| 123 |
void StateSaveOldest(); |
| 124 |
void SetStateSlot(int slot); |
| 125 |
void IncrementSelectedStateSlot(); |
| 126 |
void DecrementSelectedStateSlot(); |
| 127 |
void BootWiiSystemMenu(); |
| 128 |
|
| 129 |
void PerformOnlineUpdate(const std::string& region); |
| 130 |
|
| 131 |
void SetFullScreenResolution(bool fullscreen); |
| 132 |
|
| 133 |
void FullScreen(); |
| 134 |
void UnlockCursor(); |
| 135 |
void ScreenShot(); |
| 136 |
|
| 137 |
void CreateComponents(); |
| 138 |
|
| 139 |
void ConnectGameList(); |
| 140 |
void ConnectHost(); |
| 141 |
void ConnectHotkeys(); |
| 142 |
void ConnectMenuBar(); |
| 143 |
void ConnectRenderWidget(); |
| 144 |
void ConnectStack(); |
| 145 |
void ConnectToolBar(); |
| 146 |
|
| 147 |
void InitControllers(); |
| 148 |
void ShutdownControllers(); |
| 149 |
|
| 150 |
void InitCoreCallbacks(); |
| 151 |
|
| 152 |
enum class ScanForSecondDisc |
| 153 |
{ |
| 154 |
Yes, |
| 155 |
No, |
| 156 |
}; |
| 157 |
|
| 158 |
void ScanForSecondDiscAndStartGame(const UICommon::GameFile& game, |
| 159 |
std::unique_ptr<BootSessionData> boot_session_data = nullptr); |
| 160 |
void StartGame(const QString& path, ScanForSecondDisc scan, |
| 161 |
std::unique_ptr<BootSessionData> boot_session_data = nullptr); |
| 162 |
void StartGame(const std::string& path, ScanForSecondDisc scan, |
| 163 |
std::unique_ptr<BootSessionData> boot_session_data = nullptr); |
| 164 |
void StartGame(const std::vector<std::string>& paths, |
| 165 |
std::unique_ptr<BootSessionData> boot_session_data = nullptr); |
| 166 |
void StartGame(std::unique_ptr<BootParameters>&& parameters); |
| 167 |
void ShowRenderWidget(); |
| 168 |
void HideRenderWidget(bool reinit = true, bool is_exit = false); |
| 169 |
|
| 170 |
void ShowSettingsWindow(); |
| 171 |
void ShowGeneralWindow(); |
| 172 |
void ShowAudioWindow(); |
| 173 |
void ShowControllersWindow(); |
| 174 |
void ShowGraphicsWindow(); |
| 175 |
void ShowFreeLookWindow(); |
| 176 |
void ShowAboutDialog(); |
| 177 |
void ShowHotkeyDialog(); |
| 178 |
void ShowNetPlaySetupDialog(); |
| 179 |
void ShowNetPlayBrowser(); |
| 180 |
void ShowFIFOPlayer(); |
| 181 |
void ShowSkylanderPortal(); |
| 182 |
void ShowInfinityBase(); |
| 183 |
void ShowWiiSpeakWindow(); |
| 184 |
void ShowLogitechMicWindow(); |
| 185 |
void ShowMemcardManager(); |
| 186 |
void ShowResourcePackManager(); |
| 187 |
void ShowCheatsManager(); |
| 188 |
void ShowRiivolutionBootWidget(const UICommon::GameFile& game); |
| 189 |
|
| 190 |
#ifdef USE_RETRO_ACHIEVEMENTS |
| 191 |
void ShowAchievementsWindow(); |
| 192 |
void ShowAchievementSettings(); |
| 193 |
void OnHardcoreChanged(); |
| 194 |
#endif |
| 195 |
|
| 196 |
void NetPlayInit(); |
| 197 |
bool NetPlayJoin(); |
| 198 |
bool NetPlayHost(const UICommon::GameFile& game); |
| 199 |
void NetPlayQuit(); |
| 200 |
|
| 201 |
void OnBootGameCubeIPL(DiscIO::Region region); |
| 202 |
void OnImportNANDBackup(); |
| 203 |
void OnConnectWiiRemote(int id); |
| 204 |
|
| 205 |
#if defined(__unix__) || defined(__unix) || defined(__APPLE__) |
| 206 |
void OnSignal(); |
| 207 |
#endif |
| 208 |
|
| 209 |
void OnPlayRecording(); |
| 210 |
void OnStartRecording(); |
| 211 |
void OnStopRecording(); |
| 212 |
void OnExportRecording(); |
| 213 |
void OnActivateChat(); |
| 214 |
void OnRequestGolfControl(); |
| 215 |
void ShowTASInput(); |
| 216 |
void ShowOSDWindow(); |
| 217 |
|
| 218 |
void ChangeDisc(); |
| 219 |
void EjectDisc(); |
| 220 |
|
| 221 |
void OpenUserFolder(); |
| 222 |
void OpenConfigFolder(); |
| 223 |
void OpenCacheFolder(); |
| 224 |
|
| 225 |
QStringList PromptFileNames(); |
| 226 |
|
| 227 |
void UpdateScreenSaverInhibition(); |
| 228 |
|
| 229 |
void OnStopComplete(); |
| 230 |
void dragEnterEvent(QDragEnterEvent* event) override; |
| 231 |
void dropEvent(QDropEvent* event) override; |
| 232 |
QSize sizeHint() const override; |
| 233 |
|
| 234 |
Core::System& m_system; |
| 235 |
|
| 236 |
#ifdef HAVE_XRANDR |
| 237 |
std::unique_ptr<X11Utils::XRRConfiguration> m_xrr_config; |
| 238 |
#endif |
| 239 |
|
| 240 |
QStackedWidget* m_stack; |
| 241 |
ToolBar* m_tool_bar; |
| 242 |
MenuBar* m_menu_bar; |
| 243 |
SearchBar* m_search_bar; |
| 244 |
GameList* m_game_list; |
| 245 |
GameCount* m_game_count; |
| 246 |
RenderWidget* m_render_widget = nullptr; |
| 247 |
bool m_rendering_to_main; |
| 248 |
bool m_stop_confirm_showing = false; |
| 249 |
bool m_stop_requested = false; |
| 250 |
bool m_exit_requested = false; |
| 251 |
bool m_fullscreen_requested = false; |
| 252 |
bool m_is_screensaver_inhibited = false; |
| 253 |
u32 m_state_slot = 1; |
| 254 |
std::unique_ptr<BootParameters> m_pending_boot; |
| 255 |
|
| 256 |
SettingsWindow* m_settings_window = nullptr; |
| 257 |
|
| 258 |
|
| 259 |
std::unique_ptr<FIFOPlayerWindow> m_fifo_window = nullptr; |
| 260 |
SkylanderPortalWindow* m_skylander_window = nullptr; |
| 261 |
InfinityBaseWindow* m_infinity_window = nullptr; |
| 262 |
WiiSpeakWindow* m_wii_speak_window = nullptr; |
| 263 |
LogitechMicWindow* m_logitech_mic_window = nullptr; |
| 264 |
MappingWindow* m_hotkey_window = nullptr; |
| 265 |
FreeLookWindow* m_freelook_window = nullptr; |
| 266 |
|
| 267 |
HotkeyScheduler* m_hotkey_scheduler; |
| 268 |
NetPlayDialog* m_netplay_dialog; |
| 269 |
DiscordHandler* m_netplay_discord; |
| 270 |
NetPlaySetupDialog* m_netplay_setup_dialog; |
| 271 |
static constexpr int num_gc_controllers = 4; |
| 272 |
std::array<GCTASInputWindow*, num_gc_controllers> m_gc_tas_input_windows{}; |
| 273 |
std::array<GBATASInputWindow*, num_gc_controllers> m_gba_tas_input_windows{}; |
| 274 |
static constexpr int num_wii_controllers = 4; |
| 275 |
std::array<WiiTASInputWindow*, num_wii_controllers> m_wii_tas_input_windows{}; |
| 276 |
|
| 277 |
#ifdef USE_RETRO_ACHIEVEMENTS |
| 278 |
AchievementsWindow* m_achievements_window = nullptr; |
| 279 |
Config::ConfigChangedCallbackID m_config_changed_callback_id; |
| 280 |
bool m_former_hardcore_setting = false; |
| 281 |
#endif |
| 282 |
|
| 283 |
AssemblerWidget* m_assembler_widget; |
| 284 |
BreakpointWidget* m_breakpoint_widget; |
| 285 |
CodeWidget* m_code_widget; |
| 286 |
JITWidget* m_jit_widget; |
| 287 |
LogWidget* m_log_widget; |
| 288 |
LogConfigWidget* m_log_config_widget; |
| 289 |
MemoryWidget* m_memory_widget; |
| 290 |
NetworkWidget* m_network_widget; |
| 291 |
RegisterWidget* m_register_widget; |
| 292 |
ThreadWidget* m_thread_widget; |
| 293 |
WatchWidget* m_watch_widget; |
| 294 |
CheatsManager* m_cheats_manager{}; |
| 295 |
QByteArray m_render_widget_geometry; |
| 296 |
}; |