qt: Open current per game config when game is running
Instead of opening global config. Also prevents strange glitches from switching current game config mid-game.
This commit is contained in:
@@ -252,6 +252,10 @@ public:
|
|||||||
return ResultStatus::ErrorNotImplemented;
|
return ResultStatus::ErrorNotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FileSys::VirtualFile GetFile() {
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FileSys::VirtualFile file;
|
FileSys::VirtualFile file;
|
||||||
bool is_loaded = false;
|
bool is_loaded = false;
|
||||||
|
|||||||
@@ -512,7 +512,7 @@ void Config::SaveValues() {
|
|||||||
if (update_values.find(read_title_id) == update_values.end()) {
|
if (update_values.find(read_title_id) == update_values.end()) {
|
||||||
ReadPerGameSettings(values);
|
ReadPerGameSettings(values);
|
||||||
|
|
||||||
PerGameValuesChange change;
|
PerGameValuesChange change{};
|
||||||
ReadPerGameSettingsDelta(change);
|
ReadPerGameSettingsDelta(change);
|
||||||
|
|
||||||
update_values.emplace(read_title_id, values);
|
update_values.emplace(read_title_id, values);
|
||||||
|
|||||||
@@ -966,7 +966,6 @@ void GMainWindow::OnGameListNavigateToGamedbEntry(u64 program_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnGameListOpenProperties(FileSys::VirtualFile file) {
|
void GMainWindow::OnGameListOpenProperties(FileSys::VirtualFile file) {
|
||||||
|
|
||||||
u64 title_id{};
|
u64 title_id{};
|
||||||
if (Loader::GetLoader(file)->ReadProgramId(title_id) != Loader::ResultStatus::Success) {
|
if (Loader::GetLoader(file)->ReadProgramId(title_id) != Loader::ResultStatus::Success) {
|
||||||
QMessageBox::information(
|
QMessageBox::information(
|
||||||
@@ -1346,13 +1345,30 @@ void GMainWindow::ToggleWindowMode() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnConfigure() {
|
void GMainWindow::OnConfigure() {
|
||||||
Settings::values.SetCurrentTitleID(Settings::DEFAULT_PER_GAME);
|
const auto old_title_id = Settings::values.CurrentTitleID();
|
||||||
ConfigureDialog configureDialog(this, hotkey_registry);
|
|
||||||
auto old_theme = UISettings::values.theme;
|
auto old_theme = UISettings::values.theme;
|
||||||
const bool old_discord_presence = UISettings::values.enable_discord_presence;
|
const bool old_discord_presence = UISettings::values.enable_discord_presence;
|
||||||
auto result = configureDialog.exec();
|
|
||||||
|
int result = QDialog::Rejected;
|
||||||
|
|
||||||
|
if (emu_thread == nullptr) {
|
||||||
|
Settings::values.SetCurrentTitleID(Settings::DEFAULT_PER_GAME);
|
||||||
|
ConfigureDialog configureDialog(this, hotkey_registry);
|
||||||
|
|
||||||
|
result = configureDialog.exec();
|
||||||
|
if (result == QDialog::Accepted)
|
||||||
|
configureDialog.applyConfiguration();
|
||||||
|
} else {
|
||||||
|
ConfigurePerGameDialog configureDialog(this,
|
||||||
|
Core::System::GetInstance().GetAppLoader().GetFile(),
|
||||||
|
config->GetPerGameSettingsDelta(old_title_id));
|
||||||
|
|
||||||
|
result = configureDialog.exec();
|
||||||
|
if (result == QDialog::Accepted)
|
||||||
|
config->SetPerGameSettingsDelta(old_title_id, configureDialog.applyConfiguration());
|
||||||
|
}
|
||||||
|
|
||||||
if (result == QDialog::Accepted) {
|
if (result == QDialog::Accepted) {
|
||||||
configureDialog.applyConfiguration();
|
|
||||||
if (UISettings::values.theme != old_theme)
|
if (UISettings::values.theme != old_theme)
|
||||||
UpdateUITheme();
|
UpdateUITheme();
|
||||||
if (UISettings::values.enable_discord_presence != old_discord_presence)
|
if (UISettings::values.enable_discord_presence != old_discord_presence)
|
||||||
@@ -1364,6 +1380,9 @@ void GMainWindow::OnConfigure() {
|
|||||||
}
|
}
|
||||||
config->Save();
|
config->Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (emu_thread == nullptr)
|
||||||
|
Settings::values.SetCurrentTitleID(old_title_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnLoadAmiibo() {
|
void GMainWindow::OnLoadAmiibo() {
|
||||||
|
|||||||
Reference in New Issue
Block a user