Configuration: Add per-game input profiles

This commit is contained in:
ameerj 2022-11-17 19:23:48 -05:00
parent f426fd95fe
commit 9efdad6a27
11 changed files with 465 additions and 14 deletions

View file

@ -124,6 +124,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
#include "yuzu/compatibility_list.h"
#include "yuzu/configuration/config.h"
#include "yuzu/configuration/configure_dialog.h"
#include "yuzu/configuration/configure_input_per_game.h"
#include "yuzu/debugger/console.h"
#include "yuzu/debugger/controller.h"
#include "yuzu/debugger/profiler.h"
@ -1647,6 +1648,11 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
LOG_INFO(Frontend, "yuzu starting...");
StoreRecentFile(filename); // Put the filename on top of the list
// Save configurations
UpdateUISettings();
game_list->SaveInterfaceLayout();
config->Save();
u64 title_id{0};
last_filename_booted = filename;
@ -1666,11 +1672,6 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
system->ApplySettings();
}
// Save configurations
UpdateUISettings();
game_list->SaveInterfaceLayout();
config->Save();
Settings::LogSettings();
if (UISettings::values.select_user_on_boot) {
@ -2790,6 +2791,7 @@ void GMainWindow::OnStopGame() {
ShutdownGame();
Settings::RestoreGlobalState(system->IsPoweredOn());
system->HIDCore().ReloadInputDevices();
UpdateStatusButtons();
}
@ -3250,6 +3252,7 @@ void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file
// Do not cause the global config to write local settings into the config file
const bool is_powered_on = system->IsPoweredOn();
Settings::RestoreGlobalState(is_powered_on);
system->HIDCore().ReloadInputDevices();
UISettings::values.configuration_applied = false;
@ -3709,6 +3712,7 @@ void GMainWindow::OnCoreError(Core::SystemResultStatus result, std::string detai
ShutdownGame();
Settings::RestoreGlobalState(system->IsPoweredOn());
system->HIDCore().ReloadInputDevices();
UpdateStatusButtons();
}
} else {
@ -3860,18 +3864,19 @@ void GMainWindow::closeEvent(QCloseEvent* event) {
// Unload controllers early
controller_dialog->UnloadController();
game_list->UnloadController();
system->HIDCore().UnloadInputDevices();
// Shutdown session if the emu thread is active...
if (emu_thread != nullptr) {
ShutdownGame();
Settings::RestoreGlobalState(system->IsPoweredOn());
system->HIDCore().ReloadInputDevices();
UpdateStatusButtons();
}
render_window->close();
multiplayer_state->Close();
system->HIDCore().UnloadInputDevices();
system->GetRoomNetwork().Shutdown();
QWidget::closeEvent(event);