diff --git a/CMakeLists.txt b/CMakeLists.txt index 324ddf1d6..9c5e5c14e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,6 +121,8 @@ option(ENABLE_MICROPROFILE "Enables microprofile capabilities" OFF) option(ENABLE_SSE42 "Enable SSE4.2 optimizations on x86_64" ON) +option(ENABLE_DEVELOPER_OPTIONS "Enable functionality targeted at emulator developers" OFF) + # Compile options CMAKE_DEPENDENT_OPTION(COMPILE_WITH_DWARF "Add DWARF debugging information" ${IS_DEBUG_BUILD} "MINGW" OFF) option(ENABLE_LTO "Enable link time optimization" ${DEFAULT_ENABLE_LTO}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 43ab20d46..69d17bac2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -174,6 +174,9 @@ endif() if(ENABLE_VULKAN) add_compile_definitions(ENABLE_VULKAN) endif() +if(ENABLE_DEVELOPER_OPTIONS) + add_compile_definitions(ENABLE_DEVELOPER_OPTIONS) +endif() add_subdirectory(common) add_subdirectory(core) diff --git a/src/citra_qt/citra_qt.cpp b/src/citra_qt/citra_qt.cpp index 523c3a3be..ea28f0f2c 100644 --- a/src/citra_qt/citra_qt.cpp +++ b/src/citra_qt/citra_qt.cpp @@ -980,6 +980,10 @@ void GMainWindow::ConnectWidgetEvents() { connect(game_list, &GameList::ShowList, this, &GMainWindow::OnGameListShowList); connect(game_list, &GameList::PopulatingCompleted, this, [this] { multiplayer_state->UpdateGameList(game_list->GetModel()); }); +#ifdef ENABLE_DEVELOPER_OPTIONS + connect(game_list, &GameList::StartingLaunchStressTest, this, + &GMainWindow::StartLaunchStressTest); +#endif connect(game_list, &GameList::OpenPerGameGeneralRequested, this, &GMainWindow::OnGameListOpenPerGameProperties); @@ -1576,6 +1580,16 @@ void GMainWindow::ShutdownGame() { secondary_window->ReleaseRenderTarget(); } +void GMainWindow::StartLaunchStressTest(const QString& game_path) { + QThreadPool::globalInstance()->start([this, game_path] { + do { + ui->action_Stop->trigger(); + emit game_list->GameChosen(game_path); + QThread::sleep(2); + } while (emulation_running); + }); +} + void GMainWindow::StoreRecentFile(const QString& filename) { UISettings::values.recent_files.prepend(filename); UISettings::values.recent_files.removeDuplicates(); diff --git a/src/citra_qt/citra_qt.h b/src/citra_qt/citra_qt.h index 70e0493f3..746689cb5 100644 --- a/src/citra_qt/citra_qt.h +++ b/src/citra_qt/citra_qt.h @@ -306,6 +306,7 @@ private slots: #endif void OnSwitchDiskResources(VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total); + void StartLaunchStressTest(const QString& game_path); private: Q_INVOKABLE void OnMoviePlaybackCompleted(); diff --git a/src/citra_qt/game_list.cpp b/src/citra_qt/game_list.cpp index 049f7579c..601bb2349 100644 --- a/src/citra_qt/game_list.cpp +++ b/src/citra_qt/game_list.cpp @@ -644,6 +644,11 @@ void GameList::AddGamePopup(QMenu& context_menu, const QString& path, const QStr shortcut_menu->addAction(tr("Add to Applications Menu")); #endif +#ifdef ENABLE_DEVELOPER_OPTIONS + context_menu.addSeparator(); + QAction* stress_test_launch = context_menu.addAction(tr("Stress Test: App Launch")); +#endif + context_menu.addSeparator(); QAction* properties = context_menu.addAction(tr("Properties")); @@ -755,6 +760,10 @@ void GameList::AddGamePopup(QMenu& context_menu, const QString& path, const QStr [this, path, program_id] { emit DumpRomFSRequested(path, program_id); }); connect(remove_play_time_data, &QAction::triggered, [this, program_id]() { emit RemovePlayTimeRequested(program_id); }); +#ifdef ENABLE_DEVELOPER_OPTIONS + connect(stress_test_launch, &QAction::triggered, + [this, path]() { emit StartingLaunchStressTest(path); }); +#endif connect(properties, &QAction::triggered, this, [this, path]() { emit OpenPerGameGeneralRequested(path); }); connect(open_shader_cache_location, &QAction::triggered, this, [this, program_id] { diff --git a/src/citra_qt/game_list.h b/src/citra_qt/game_list.h index 92556bc04..d563f74b1 100644 --- a/src/citra_qt/game_list.h +++ b/src/citra_qt/game_list.h @@ -107,6 +107,7 @@ signals: void AddDirectory(); void ShowList(bool show); void PopulatingCompleted(); + void StartingLaunchStressTest(const QString& game_path); private slots: void OnItemExpanded(const QModelIndex& item);