mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-26 12:47:52 -05:00
yuzu qt: Handle per-game configs for title id 0
Currently with programs that have a 0 title id, yuzu loads the custom configuration 0000000000000000.ini for per-game configs. This is not ideal since many homebrews share this id. Instead for these programs, we load a config that is simply the file name and `.ini` appended to it.
This commit is contained in:
@ -16,7 +16,7 @@
|
||||
|
||||
namespace FS = Common::FS;
|
||||
|
||||
Config::Config(const std::string& config_name, ConfigType config_type) : type(config_type) {
|
||||
Config::Config(std::string_view config_name, ConfigType config_type) : type(config_type) {
|
||||
global = config_type == ConfigType::GlobalConfig;
|
||||
|
||||
Initialize(config_name);
|
||||
@ -242,7 +242,7 @@ const std::array<UISettings::Shortcut, 17> Config::default_hotkeys{{
|
||||
}};
|
||||
// clang-format on
|
||||
|
||||
void Config::Initialize(const std::string& config_name) {
|
||||
void Config::Initialize(std::string_view config_name) {
|
||||
const auto fs_config_loc = FS::GetYuzuPath(FS::YuzuPath::ConfigDir);
|
||||
const auto config_file = fmt::format("{}.ini", config_name);
|
||||
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
InputProfile,
|
||||
};
|
||||
|
||||
explicit Config(const std::string& config_name = "qt-config",
|
||||
explicit Config(std::string_view config_name = "qt-config",
|
||||
ConfigType config_type = ConfigType::GlobalConfig);
|
||||
~Config();
|
||||
|
||||
@ -45,7 +45,7 @@ public:
|
||||
static const std::array<UISettings::Shortcut, 17> default_hotkeys;
|
||||
|
||||
private:
|
||||
void Initialize(const std::string& config_name);
|
||||
void Initialize(std::string_view config_name);
|
||||
|
||||
void ReadValues();
|
||||
void ReadPlayerValue(std::size_t player_index);
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include <QCheckBox>
|
||||
@ -14,6 +15,7 @@
|
||||
#include <QTimer>
|
||||
#include <QTreeView>
|
||||
|
||||
#include "common/fs/path_util.h"
|
||||
#include "core/core.h"
|
||||
#include "core/file_sys/control_metadata.h"
|
||||
#include "core/file_sys/patch_manager.h"
|
||||
@ -26,10 +28,15 @@
|
||||
#include "yuzu/uisettings.h"
|
||||
#include "yuzu/util/util.h"
|
||||
|
||||
ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id)
|
||||
ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id, std::string_view file_name)
|
||||
: QDialog(parent), ui(std::make_unique<Ui::ConfigurePerGame>()), title_id(title_id) {
|
||||
game_config = std::make_unique<Config>(fmt::format("{:016X}", title_id),
|
||||
Config::ConfigType::PerGameConfig);
|
||||
if (title_id == 0) {
|
||||
game_config = std::make_unique<Config>(Common::FS::GetFilename(file_name),
|
||||
Config::ConfigType::PerGameConfig);
|
||||
} else {
|
||||
game_config = std::make_unique<Config>(fmt::format("{:016X}", title_id),
|
||||
Config::ConfigType::PerGameConfig);
|
||||
}
|
||||
|
||||
Settings::SetConfiguringGlobal(false);
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <QDialog>
|
||||
@ -27,7 +28,7 @@ class ConfigurePerGame : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ConfigurePerGame(QWidget* parent, u64 title_id);
|
||||
explicit ConfigurePerGame(QWidget* parent, u64 title_id, std::string_view file_name);
|
||||
~ConfigurePerGame() override;
|
||||
|
||||
/// Save all button configurations to settings file
|
||||
|
Reference in New Issue
Block a user