configuration: user correct config during emulation
Creates a new pointer specifically for modifying the configuration while emulation is in progress. Both the regular configuration dialog and the game properties dialog now use the pointer Settings::config_values to focus edits to the correct struct.
This commit is contained in:
@@ -69,6 +69,21 @@ Values *values = &global_values;
|
||||
Values *config_values = &global_values;
|
||||
|
||||
void CopyValues(Values& dst, const Values& src) {
|
||||
// Controls
|
||||
dst.players = src.players;
|
||||
dst.mouse_enabled = src.mouse_enabled;
|
||||
dst.mouse_device = src.mouse_device;
|
||||
|
||||
dst.keyboard_enabled = src.keyboard_enabled;
|
||||
dst.keyboard_keys = src.keyboard_keys;
|
||||
dst.keyboard_mods = src.keyboard_mods;
|
||||
|
||||
dst.debug_pad_enabled = src.debug_pad_enabled;
|
||||
dst.debug_pad_buttons = src.debug_pad_buttons;
|
||||
dst.debug_pad_analogs = src.debug_pad_analogs;
|
||||
|
||||
dst.motion_device = src.motion_device;
|
||||
dst.touchscreen = src.touchscreen;
|
||||
dst.udp_input_address = src.udp_input_address;
|
||||
dst.udp_input_port = src.udp_input_port;
|
||||
dst.udp_pad_index = src.udp_pad_index;
|
||||
@@ -202,7 +217,8 @@ bool IsGPULevelExtreme() {
|
||||
}
|
||||
|
||||
bool IsGPULevelHigh() {
|
||||
return values->gpu_accuracy == GPUAccuracy::Extreme || values->gpu_accuracy == GPUAccuracy::High;
|
||||
return values->gpu_accuracy == GPUAccuracy::Extreme ||
|
||||
values->gpu_accuracy == GPUAccuracy::High;
|
||||
}
|
||||
|
||||
} // namespace Settings
|
||||
|
||||
@@ -50,6 +50,7 @@ void ConfigureDialog::ApplyConfiguration() {
|
||||
ui->serviceTab->ApplyConfiguration();
|
||||
Settings::Apply();
|
||||
Settings::LogSettings();
|
||||
Settings::CopyValues(Settings::game_values, Settings::global_values);
|
||||
}
|
||||
|
||||
void ConfigureDialog::changeEvent(QEvent* event) {
|
||||
|
||||
@@ -55,8 +55,9 @@ void ConfigureSystem::RetranslateUI() {
|
||||
void ConfigureSystem::SetConfiguration() {
|
||||
enabled = !Core::System::GetInstance().IsPoweredOn();
|
||||
|
||||
ui->label_console_id->setVisible(Settings::values == &Settings::global_values);
|
||||
ui->button_regenerate_console_id->setVisible(Settings::values == &Settings::global_values);
|
||||
ui->label_console_id->setVisible(Settings::config_values == &Settings::global_values);
|
||||
ui->button_regenerate_console_id->setVisible(Settings::config_values ==
|
||||
&Settings::global_values);
|
||||
|
||||
ui->combo_language->setCurrentIndex(Settings::config_values->language_index);
|
||||
ui->combo_region->setCurrentIndex(Settings::config_values->region_index);
|
||||
|
||||
@@ -1039,13 +1039,6 @@ void GMainWindow::BootGame(const QString& filename) {
|
||||
LOG_INFO(Frontend, "yuzu starting...");
|
||||
StoreRecentFile(filename); // Put the filename on top of the list
|
||||
|
||||
// Swap settings to use game configuration if need be
|
||||
Settings::SwapValues(Settings::ValuesSwapTarget::ToGame);
|
||||
Config per_game_config(filename.toUtf8().constData(), false);
|
||||
if (Settings::game_values.use_global_values) {
|
||||
Settings::SwapValues(Settings::ValuesSwapTarget::ToGlobal);
|
||||
}
|
||||
|
||||
if (UISettings::values.select_user_on_boot) {
|
||||
SelectAndSetCurrentUser();
|
||||
}
|
||||
@@ -1053,6 +1046,25 @@ void GMainWindow::BootGame(const QString& filename) {
|
||||
if (!LoadROM(filename))
|
||||
return;
|
||||
|
||||
const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID();
|
||||
|
||||
// Swap settings to use game configuration if need be
|
||||
Settings::SwapConfigValues(Settings::ValuesSwapTarget::ToGame);
|
||||
Config per_game_config(fmt::format("{:016X}", title_id) + ".ini", false);
|
||||
Settings::SwapConfigValues(Settings::ValuesSwapTarget::ToGlobal);
|
||||
|
||||
if (Settings::game_values.use_global_values) {
|
||||
LOG_INFO(Frontend, "Using global configuration");
|
||||
}
|
||||
else {
|
||||
Settings::SwapValues(Settings::ValuesSwapTarget::ToGame);
|
||||
LOG_INFO(Frontend, "Using game-specific configuration");
|
||||
}
|
||||
|
||||
UpdateStatusButtons();
|
||||
|
||||
Settings::LogSettings();
|
||||
|
||||
// Create and start the emulation thread
|
||||
emu_thread = std::make_unique<EmuThread>();
|
||||
emit EmulationStarting(emu_thread.get());
|
||||
@@ -1085,8 +1097,6 @@ void GMainWindow::BootGame(const QString& filename) {
|
||||
ui.centralwidget->setMouseTracking(true);
|
||||
}
|
||||
|
||||
const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID();
|
||||
|
||||
std::string title_name;
|
||||
std::string title_version;
|
||||
const auto res = Core::System::GetInstance().GetGameName(title_name);
|
||||
@@ -1175,6 +1185,8 @@ void GMainWindow::ShutdownGame() {
|
||||
|
||||
game_path.clear();
|
||||
|
||||
Settings::SwapValues(Settings::ValuesSwapTarget::ToGlobal);
|
||||
|
||||
// When closing the game, destroy the GLWindow to clear the context after the game is closed
|
||||
render_window->ReleaseRenderTarget();
|
||||
}
|
||||
@@ -1825,8 +1837,6 @@ void GMainWindow::OnStopGame() {
|
||||
return;
|
||||
}
|
||||
|
||||
Settings::SwapValues(Settings::ValuesSwapTarget::ToGlobal);
|
||||
|
||||
ShutdownGame();
|
||||
}
|
||||
|
||||
@@ -1983,16 +1993,7 @@ void GMainWindow::OnConfigure() {
|
||||
ui.centralwidget->setMouseTracking(false);
|
||||
}
|
||||
|
||||
dock_status_button->setChecked(Settings::values.use_docked_mode);
|
||||
multicore_status_button->setChecked(Settings::values.use_multi_core);
|
||||
Settings::values.use_asynchronous_gpu_emulation =
|
||||
Settings::values.use_asynchronous_gpu_emulation || Settings::values.use_multi_core;
|
||||
async_status_button->setChecked(Settings::values.use_asynchronous_gpu_emulation);
|
||||
|
||||
#ifdef HAS_VULKAN
|
||||
renderer_status_button->setChecked(Settings::values->renderer_backend ==
|
||||
Settings::RendererBackend::Vulkan);
|
||||
#endif
|
||||
UpdateStatusButtons();
|
||||
}
|
||||
|
||||
void GMainWindow::OnLoadAmiibo() {
|
||||
@@ -2121,6 +2122,19 @@ void GMainWindow::UpdateStatusBar() {
|
||||
emu_frametime_label->setVisible(true);
|
||||
}
|
||||
|
||||
void GMainWindow::UpdateStatusButtons() {
|
||||
dock_status_button->setChecked(Settings::values.use_docked_mode);
|
||||
multicore_status_button->setChecked(Settings::values.use_multi_core);
|
||||
Settings::values.use_asynchronous_gpu_emulation =
|
||||
Settings::values.use_asynchronous_gpu_emulation || Settings::values.use_multi_core;
|
||||
async_status_button->setChecked(Settings::values.use_asynchronous_gpu_emulation);
|
||||
|
||||
#ifdef HAS_VULKAN
|
||||
renderer_status_button->setChecked(Settings::values->renderer_backend ==
|
||||
Settings::RendererBackend::Vulkan);
|
||||
#endif
|
||||
}
|
||||
|
||||
void GMainWindow::HideMouseCursor() {
|
||||
if (emu_thread == nullptr || UISettings::values.hide_mouse == false) {
|
||||
mouse_hide_timer.stop();
|
||||
@@ -2548,8 +2562,6 @@ int main(int argc, char* argv[]) {
|
||||
QObject::connect(&app, &QGuiApplication::applicationStateChanged, &main_window,
|
||||
&GMainWindow::OnAppFocusStateChanged);
|
||||
|
||||
Settings::LogSettings();
|
||||
|
||||
int result = app.exec();
|
||||
detached_tasks.WaitForAllTasks();
|
||||
return result;
|
||||
|
||||
@@ -221,6 +221,7 @@ private:
|
||||
void UpdateWindowTitle(const std::string& title_name = {},
|
||||
const std::string& title_version = {});
|
||||
void UpdateStatusBar();
|
||||
void UpdateStatusButtons();
|
||||
void HideMouseCursor();
|
||||
void ShowMouseCursor();
|
||||
void OpenURL(const QUrl& url);
|
||||
|
||||
Reference in New Issue
Block a user