yuzu-emu
/
yuzu
Archived
1
0
Fork 0

Merge pull request #12555 from flodavid/fix-gamemode-setting

Save gamemode configuration and add per-game config
This commit is contained in:
liamwhite 2024-01-28 15:02:34 -05:00 committed by GitHub
commit 6a2532fe17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 229 additions and 0 deletions

View File

@ -298,6 +298,16 @@ void Config::ReadDebuggingValues() {
EndGroup(); EndGroup();
} }
#ifdef __unix__
void Config::ReadLinuxValues() {
BeginGroup(Settings::TranslateCategory(Settings::Category::Linux));
ReadCategory(Settings::Category::Linux);
EndGroup();
}
#endif
void Config::ReadServiceValues() { void Config::ReadServiceValues() {
BeginGroup(Settings::TranslateCategory(Settings::Category::Services)); BeginGroup(Settings::TranslateCategory(Settings::Category::Services));
@ -404,6 +414,9 @@ void Config::ReadValues() {
ReadControlValues(); ReadControlValues();
ReadCoreValues(); ReadCoreValues();
ReadCpuValues(); ReadCpuValues();
#ifdef __unix__
ReadLinuxValues();
#endif
ReadRendererValues(); ReadRendererValues();
ReadAudioValues(); ReadAudioValues();
ReadSystemValues(); ReadSystemValues();
@ -504,6 +517,9 @@ void Config::SaveValues() {
SaveControlValues(); SaveControlValues();
SaveCoreValues(); SaveCoreValues();
SaveCpuValues(); SaveCpuValues();
#ifdef __unix__
SaveLinuxValues();
#endif
SaveRendererValues(); SaveRendererValues();
SaveAudioValues(); SaveAudioValues();
SaveSystemValues(); SaveSystemValues();
@ -578,6 +594,16 @@ void Config::SaveDebuggingValues() {
EndGroup(); EndGroup();
} }
#ifdef __unix__
void Config::SaveLinuxValues() {
BeginGroup(Settings::TranslateCategory(Settings::Category::Linux));
WriteCategory(Settings::Category::Linux);
EndGroup();
}
#endif
void Config::SaveNetworkValues() { void Config::SaveNetworkValues() {
BeginGroup(Settings::TranslateCategory(Settings::Category::Services)); BeginGroup(Settings::TranslateCategory(Settings::Category::Services));

View File

@ -76,6 +76,9 @@ protected:
void ReadCoreValues(); void ReadCoreValues();
void ReadDataStorageValues(); void ReadDataStorageValues();
void ReadDebuggingValues(); void ReadDebuggingValues();
#ifdef __unix__
void ReadLinuxValues();
#endif
void ReadServiceValues(); void ReadServiceValues();
void ReadDisabledAddOnValues(); void ReadDisabledAddOnValues();
void ReadMiscellaneousValues(); void ReadMiscellaneousValues();
@ -107,6 +110,9 @@ protected:
void SaveCoreValues(); void SaveCoreValues();
void SaveDataStorageValues(); void SaveDataStorageValues();
void SaveDebuggingValues(); void SaveDebuggingValues();
#ifdef __unix__
void SaveLinuxValues();
#endif
void SaveNetworkValues(); void SaveNetworkValues();
void SaveDisabledAddOnValues(); void SaveDisabledAddOnValues();
void SaveMiscellaneousValues(); void SaveMiscellaneousValues();

View File

@ -96,6 +96,9 @@ add_executable(yuzu
configuration/configure_input_profile_dialog.cpp configuration/configure_input_profile_dialog.cpp
configuration/configure_input_profile_dialog.h configuration/configure_input_profile_dialog.h
configuration/configure_input_profile_dialog.ui configuration/configure_input_profile_dialog.ui
configuration/configure_linux_tab.cpp
configuration/configure_linux_tab.h
configuration/configure_linux_tab.ui
configuration/configure_mouse_panning.cpp configuration/configure_mouse_panning.cpp
configuration/configure_mouse_panning.h configuration/configure_mouse_panning.h
configuration/configure_mouse_panning.ui configuration/configure_mouse_panning.ui

View File

@ -24,6 +24,8 @@ class Builder;
} }
class ConfigureAudio : public ConfigurationShared::Tab { class ConfigureAudio : public ConfigurationShared::Tab {
Q_OBJECT
public: public:
explicit ConfigureAudio(const Core::System& system_, explicit ConfigureAudio(const Core::System& system_,
std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group, std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group,

View File

@ -24,6 +24,8 @@ class Builder;
} }
class ConfigureCpu : public ConfigurationShared::Tab { class ConfigureCpu : public ConfigurationShared::Tab {
Q_OBJECT
public: public:
explicit ConfigureCpu(const Core::System& system_, explicit ConfigureCpu(const Core::System& system_,
std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group, std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group,

View File

@ -25,6 +25,8 @@ class Builder;
} }
class ConfigureGeneral : public ConfigurationShared::Tab { class ConfigureGeneral : public ConfigurationShared::Tab {
Q_OBJECT
public: public:
explicit ConfigureGeneral(const Core::System& system_, explicit ConfigureGeneral(const Core::System& system_,
std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group, std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group,

View File

@ -43,6 +43,8 @@ class Builder;
} }
class ConfigureGraphics : public ConfigurationShared::Tab { class ConfigureGraphics : public ConfigurationShared::Tab {
Q_OBJECT
public: public:
explicit ConfigureGraphics( explicit ConfigureGraphics(
const Core::System& system_, std::vector<VkDeviceInfo::Record>& records, const Core::System& system_, std::vector<VkDeviceInfo::Record>& records,

View File

@ -21,6 +21,8 @@ class Builder;
} }
class ConfigureGraphicsAdvanced : public ConfigurationShared::Tab { class ConfigureGraphicsAdvanced : public ConfigurationShared::Tab {
Q_OBJECT
public: public:
explicit ConfigureGraphicsAdvanced( explicit ConfigureGraphicsAdvanced(
const Core::System& system_, std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group, const Core::System& system_, std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group,

View File

@ -0,0 +1,75 @@
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "common/settings.h"
#include "core/core.h"
#include "ui_configure_linux_tab.h"
#include "yuzu/configuration/configuration_shared.h"
#include "yuzu/configuration/configure_linux_tab.h"
#include "yuzu/configuration/shared_widget.h"
ConfigureLinuxTab::ConfigureLinuxTab(const Core::System& system_,
std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group_,
const ConfigurationShared::Builder& builder, QWidget* parent)
: Tab(group_, parent), ui(std::make_unique<Ui::ConfigureLinuxTab>()), system{system_} {
ui->setupUi(this);
Setup(builder);
SetConfiguration();
}
ConfigureLinuxTab::~ConfigureLinuxTab() = default;
void ConfigureLinuxTab::SetConfiguration() {}
void ConfigureLinuxTab::Setup(const ConfigurationShared::Builder& builder) {
QLayout& linux_layout = *ui->linux_widget->layout();
std::map<u32, QWidget*> linux_hold{};
std::vector<Settings::BasicSetting*> settings;
const auto push = [&](Settings::Category category) {
for (const auto setting : Settings::values.linkage.by_category[category]) {
settings.push_back(setting);
}
};
push(Settings::Category::Linux);
for (auto* setting : settings) {
auto* widget = builder.BuildWidget(setting, apply_funcs);
if (widget == nullptr) {
continue;
}
if (!widget->Valid()) {
widget->deleteLater();
continue;
}
linux_hold.insert({setting->Id(), widget});
}
for (const auto& [id, widget] : linux_hold) {
linux_layout.addWidget(widget);
}
}
void ConfigureLinuxTab::ApplyConfiguration() {
const bool is_powered_on = system.IsPoweredOn();
for (const auto& apply_func : apply_funcs) {
apply_func(is_powered_on);
}
}
void ConfigureLinuxTab::changeEvent(QEvent* event) {
if (event->type() == QEvent::LanguageChange) {
RetranslateUI();
}
QWidget::changeEvent(event);
}
void ConfigureLinuxTab::RetranslateUI() {
ui->retranslateUi(this);
}

View File

@ -0,0 +1,44 @@
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <QWidget>
namespace Core {
class System;
}
namespace Ui {
class ConfigureLinuxTab;
}
namespace ConfigurationShared {
class Builder;
}
class ConfigureLinuxTab : public ConfigurationShared::Tab {
Q_OBJECT
public:
explicit ConfigureLinuxTab(const Core::System& system_,
std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group,
const ConfigurationShared::Builder& builder,
QWidget* parent = nullptr);
~ConfigureLinuxTab() override;
void ApplyConfiguration() override;
void SetConfiguration() override;
private:
void changeEvent(QEvent* event) override;
void RetranslateUI();
void Setup(const ConfigurationShared::Builder& builder);
std::unique_ptr<Ui::ConfigureLinuxTab> ui;
const Core::System& system;
std::vector<std::function<void(bool)>> apply_funcs{};
};

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ConfigureLinuxTab</class>
<widget class="QWidget" name="ConfigureLinuxTab">
<property name="accessibleName">
<string>Linux</string>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QGroupBox" name="LinuxGroupBox">
<property name="title">
<string>Linux</string>
</property>
<layout class="QVBoxLayout" name="LinuxVerticalLayout_1">
<item>
<widget class="QWidget" name="linux_widget" native="true">
<layout class="QVBoxLayout" name="LinuxVerticalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -26,6 +26,7 @@ class ConfigureMotionTouch;
/// A dialog for touchpad calibration configuration. /// A dialog for touchpad calibration configuration.
class CalibrationConfigurationDialog : public QDialog { class CalibrationConfigurationDialog : public QDialog {
Q_OBJECT Q_OBJECT
public: public:
explicit CalibrationConfigurationDialog(QWidget* parent, const std::string& host, u16 port); explicit CalibrationConfigurationDialog(QWidget* parent, const std::string& host, u16 port);
~CalibrationConfigurationDialog() override; ~CalibrationConfigurationDialog() override;

View File

@ -16,6 +16,7 @@ class ConfigureMousePanning;
class ConfigureMousePanning : public QDialog { class ConfigureMousePanning : public QDialog {
Q_OBJECT Q_OBJECT
public: public:
explicit ConfigureMousePanning(QWidget* parent, InputCommon::InputSubsystem* input_subsystem_, explicit ConfigureMousePanning(QWidget* parent, InputCommon::InputSubsystem* input_subsystem_,
float right_stick_deadzone, float right_stick_range); float right_stick_deadzone, float right_stick_range);

View File

@ -33,6 +33,7 @@
#include "yuzu/configuration/configure_graphics.h" #include "yuzu/configuration/configure_graphics.h"
#include "yuzu/configuration/configure_graphics_advanced.h" #include "yuzu/configuration/configure_graphics_advanced.h"
#include "yuzu/configuration/configure_input_per_game.h" #include "yuzu/configuration/configure_input_per_game.h"
#include "yuzu/configuration/configure_linux_tab.h"
#include "yuzu/configuration/configure_per_game.h" #include "yuzu/configuration/configure_per_game.h"
#include "yuzu/configuration/configure_per_game_addons.h" #include "yuzu/configuration/configure_per_game_addons.h"
#include "yuzu/configuration/configure_system.h" #include "yuzu/configuration/configure_system.h"
@ -60,6 +61,7 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const std::st
system_, vk_device_records, [&]() { graphics_advanced_tab->ExposeComputeOption(); }, system_, vk_device_records, [&]() { graphics_advanced_tab->ExposeComputeOption(); },
[](Settings::AspectRatio, Settings::ResolutionSetup) {}, tab_group, *builder, this); [](Settings::AspectRatio, Settings::ResolutionSetup) {}, tab_group, *builder, this);
input_tab = std::make_unique<ConfigureInputPerGame>(system_, game_config.get(), this); input_tab = std::make_unique<ConfigureInputPerGame>(system_, game_config.get(), this);
linux_tab = std::make_unique<ConfigureLinuxTab>(system_, tab_group, *builder, this);
system_tab = std::make_unique<ConfigureSystem>(system_, tab_group, *builder, this); system_tab = std::make_unique<ConfigureSystem>(system_, tab_group, *builder, this);
ui->setupUi(this); ui->setupUi(this);
@ -71,6 +73,10 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const std::st
ui->tabWidget->addTab(graphics_advanced_tab.get(), tr("Adv. Graphics")); ui->tabWidget->addTab(graphics_advanced_tab.get(), tr("Adv. Graphics"));
ui->tabWidget->addTab(audio_tab.get(), tr("Audio")); ui->tabWidget->addTab(audio_tab.get(), tr("Audio"));
ui->tabWidget->addTab(input_tab.get(), tr("Input Profiles")); ui->tabWidget->addTab(input_tab.get(), tr("Input Profiles"));
// Only show Linux tab on Unix
#ifdef __unix__
ui->tabWidget->addTab(linux_tab.get(), tr("Linux"));
#endif
setFocusPolicy(Qt::ClickFocus); setFocusPolicy(Qt::ClickFocus);
setWindowTitle(tr("Properties")); setWindowTitle(tr("Properties"));

View File

@ -32,6 +32,7 @@ class ConfigureCpu;
class ConfigureGraphics; class ConfigureGraphics;
class ConfigureGraphicsAdvanced; class ConfigureGraphicsAdvanced;
class ConfigureInputPerGame; class ConfigureInputPerGame;
class ConfigureLinuxTab;
class ConfigureSystem; class ConfigureSystem;
class QGraphicsScene; class QGraphicsScene;
@ -85,5 +86,6 @@ private:
std::unique_ptr<ConfigureGraphicsAdvanced> graphics_advanced_tab; std::unique_ptr<ConfigureGraphicsAdvanced> graphics_advanced_tab;
std::unique_ptr<ConfigureGraphics> graphics_tab; std::unique_ptr<ConfigureGraphics> graphics_tab;
std::unique_ptr<ConfigureInputPerGame> input_tab; std::unique_ptr<ConfigureInputPerGame> input_tab;
std::unique_ptr<ConfigureLinuxTab> linux_tab;
std::unique_ptr<ConfigureSystem> system_tab; std::unique_ptr<ConfigureSystem> system_tab;
}; };

View File

@ -27,6 +27,8 @@ class Builder;
} }
class ConfigureSystem : public ConfigurationShared::Tab { class ConfigureSystem : public ConfigurationShared::Tab {
Q_OBJECT
public: public:
explicit ConfigureSystem(Core::System& system_, explicit ConfigureSystem(Core::System& system_,
std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group, std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group,