diff options
-rw-r--r-- | src/yuzu/game_list.cpp | 10 | ||||
-rw-r--r-- | src/yuzu/game_list.h | 2 | ||||
-rw-r--r-- | src/yuzu/main.cpp | 6 | ||||
-rw-r--r-- | src/yuzu/main.h | 8 | ||||
-rw-r--r-- | src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp | 15 | ||||
-rw-r--r-- | src/yuzu_cmd/emu_window/emu_window_sdl2_gl.h | 3 |
6 files changed, 29 insertions, 15 deletions
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index 9308cfef8..da956c99b 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp @@ -505,6 +505,10 @@ void GameList::PopupContextMenu(const QPoint& menu_location) { void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, const std::string& path) { QAction* favorite = context_menu.addAction(tr("Favorite")); context_menu.addSeparator(); + QAction* start_game = context_menu.addAction(tr("Start Game")); + QAction* start_game_global = + context_menu.addAction(tr("Start Game without Custom Configuration")); + context_menu.addSeparator(); QAction* open_save_location = context_menu.addAction(tr("Open Save Data Location")); QAction* open_mod_location = context_menu.addAction(tr("Open Mod Data Location")); QAction* open_transferable_shader_cache = @@ -540,6 +544,12 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, const std::stri connect(open_save_location, &QAction::triggered, [this, program_id, path]() { emit OpenFolderRequested(program_id, GameListOpenTarget::SaveData, path); }); + connect(start_game, &QAction::triggered, [this, path]() { + emit BootGame(QString::fromStdString(path), 0, StartGameType::Normal); + }); + connect(start_game_global, &QAction::triggered, [this, path]() { + emit BootGame(QString::fromStdString(path), 0, StartGameType::Global); + }); connect(open_mod_location, &QAction::triggered, [this, program_id, path]() { emit OpenFolderRequested(program_id, GameListOpenTarget::ModData, path); }); diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h index ab6866735..b630e34ff 100644 --- a/src/yuzu/game_list.h +++ b/src/yuzu/game_list.h @@ -28,6 +28,7 @@ class GameListWorker; class GameListSearchField; class GameListDir; class GMainWindow; +enum class StartGameType; namespace FileSys { class ManualContentProvider; @@ -82,6 +83,7 @@ public: static const QStringList supported_file_extensions; signals: + void BootGame(const QString& game_path, std::size_t program_index, StartGameType type); void GameChosen(const QString& game_path); void ShouldCancelWorker(); void OpenFolderRequested(u64 program_id, GameListOpenTarget target, diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index e683fb920..19339ff2d 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1094,6 +1094,7 @@ void GMainWindow::OnAppFocusStateChanged(Qt::ApplicationState state) { } void GMainWindow::ConnectWidgetEvents() { + connect(game_list, &GameList::BootGame, this, &GMainWindow::BootGame); connect(game_list, &GameList::GameChosen, this, &GMainWindow::OnGameListLoadFile); connect(game_list, &GameList::OpenDirectory, this, &GMainWindow::OnGameListOpenDirectory); connect(game_list, &GameList::OpenFolderRequested, this, &GMainWindow::OnGameListOpenFolder); @@ -1320,7 +1321,7 @@ void GMainWindow::SelectAndSetCurrentUser() { Settings::values.current_user = dialog.GetIndex(); } -void GMainWindow::BootGame(const QString& filename, std::size_t program_index) { +void GMainWindow::BootGame(const QString& filename, std::size_t program_index, StartGameType type) { LOG_INFO(Frontend, "yuzu starting..."); StoreRecentFile(filename); // Put the filename on top of the list @@ -1332,7 +1333,8 @@ void GMainWindow::BootGame(const QString& filename, std::size_t program_index) { const auto v_file = Core::GetGameFileFromPath(vfs, filename.toUtf8().constData()); const auto loader = Loader::GetLoader(system, v_file, program_index); - if (!(loader == nullptr || loader->ReadProgramId(title_id) != Loader::ResultStatus::Success)) { + if (loader != nullptr && loader->ReadProgramId(title_id) == Loader::ResultStatus::Success && + type == StartGameType::Normal) { // Load per game settings const auto file_path = std::filesystem::path{filename.toStdU16String()}; const auto config_file_name = title_id == 0 diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 490b6889f..11f152cbe 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -39,6 +39,11 @@ class GameListPlaceholder; class QtSoftwareKeyboardDialog; +enum class StartGameType { + Normal, // Can use custom configuration + Global, // Only uses global configuration +}; + namespace Core::Frontend { struct ControllerParameters; struct InlineAppearParameters; @@ -181,7 +186,8 @@ private: void AllowOSSleep(); bool LoadROM(const QString& filename, std::size_t program_index); - void BootGame(const QString& filename, std::size_t program_index = 0); + void BootGame(const QString& filename, std::size_t program_index = 0, + StartGameType with_config = StartGameType::Normal); void ShutdownGame(); void ShowTelemetryCallout(); diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp index 3c49a300b..837a44be7 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp @@ -32,17 +32,17 @@ class SDLGLContext : public Core::Frontend::GraphicsContext { public: - explicit SDLGLContext() { - // create a hidden window to make the shared context against - window = SDL_CreateWindow(NULL, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 0, 0, - SDL_WINDOW_HIDDEN | SDL_WINDOW_OPENGL); + explicit SDLGLContext(SDL_Window* window_) : window{window_} { context = SDL_GL_CreateContext(window); } ~SDLGLContext() { DoneCurrent(); SDL_GL_DeleteContext(context); - SDL_DestroyWindow(window); + } + + void SwapBuffers() override { + SDL_GL_SwapWindow(window); } void MakeCurrent() override { @@ -114,9 +114,6 @@ EmuWindow_SDL2_GL::EmuWindow_SDL2_GL(InputCommon::InputSubsystem* input_subsyste exit(1); } - dummy_window = SDL_CreateWindow(NULL, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 0, 0, - SDL_WINDOW_HIDDEN | SDL_WINDOW_OPENGL); - SetWindowIcon(); if (fullscreen) { @@ -159,5 +156,5 @@ EmuWindow_SDL2_GL::~EmuWindow_SDL2_GL() { } std::unique_ptr<Core::Frontend::GraphicsContext> EmuWindow_SDL2_GL::CreateSharedContext() const { - return std::make_unique<SDLGLContext>(); + return std::make_unique<SDLGLContext>(render_window); } diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.h b/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.h index dba5c293c..9e694d985 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.h +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.h @@ -20,9 +20,6 @@ public: std::unique_ptr<Core::Frontend::GraphicsContext> CreateSharedContext() const override; private: - /// Fake hidden window for the core context - SDL_Window* dummy_window{}; - /// Whether the GPU and driver supports the OpenGL extension required bool SupportsRequiredGLExtensions(); |