Add per game configuration options (#6187)

* common: Move settings to common from core.

- Removes a dependency on core and input_common from common.

* code: Wrap settings values

* Port from yuzu to allow per game settings

* citra_qt: Initial per-game settings dialog

* citra_qt: Use new API for read/save of config values

* citra_qt: Per game audio settings

* citra_qt: Per game graphics settings

* citra_qt: Per game system settings

* citra_qt: Per game general settings

* citra_qt: Document and run clang format

* citra_qt: Make icon smaller and centered

* citra_qt: Remove version number

* Not sure how to extract that, can always add it back later

* citra_qt: Wrap UISettings

* citra_qt: Fix unthottled fps setting

* citra_qt: Remove margin in emulation tab

* citra_qt: Implement some suggestions

* Bring back speed switch hotkey

* Allow configuration when game is running

* Rename/adjust UI stuff

* citra_qt: Fix build with separate windows

* citra_qt: Address feedback

* citra_qt: Log per-game settings before launching games

* citra_qt: Add shader cache options

* Also fix android build

* citra_qt: Add DLC menu option

* citra_qt: Run clang-format

* citra_qt: Adjust for time offset

* citra_qt: Implement suggestions

* Run clang-format

Co-authored-by: bunnei <bunneidev@gmail.com>
This commit is contained in:
GPUCode 2022-12-08 13:27:25 +02:00 committed by GitHub
parent f261daf2fa
commit 48ee112ceb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
92 changed files with 3171 additions and 1546 deletions

View file

@ -11,6 +11,7 @@
#include "common/assert.h"
#include "common/common_types.h"
#include "common/logging/log.h"
#include "common/settings.h"
#include "core/core.h"
#include "core/hle/kernel/config_mem.h"
#include "core/hle/kernel/memory.h"
@ -19,7 +20,6 @@
#include "core/hle/kernel/vm_manager.h"
#include "core/hle/result.h"
#include "core/memory.h"
#include "core/settings.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
@ -52,7 +52,7 @@ enum N3DSMode : u8 {
void KernelSystem::MemoryInit(u32 mem_type, u8 n3ds_mode) {
ASSERT(mem_type != 1);
const bool is_new_3ds = Settings::values.is_new_3ds;
const bool is_new_3ds = Settings::values.is_new_3ds.GetValue();
u32 reported_mem_type = mem_type;
if (is_new_3ds) {
if (n3ds_mode == MemoryMode::Mode6 || n3ds_mode == MemoryMode::Mode6_2) {

View file

@ -6,12 +6,12 @@
#include <cstring>
#include "common/archives.h"
#include "common/assert.h"
#include "common/settings.h"
#include "core/core.h"
#include "core/core_timing.h"
#include "core/hle/kernel/shared_page.h"
#include "core/hle/service/ptm/ptm.h"
#include "core/movie.h"
#include "core/settings.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
@ -37,7 +37,7 @@ static std::chrono::seconds GetInitTime() {
return std::chrono::seconds(override_init_time);
}
switch (Settings::values.init_clock) {
switch (Settings::values.init_clock.GetValue()) {
case Settings::InitClock::SystemTime: {
auto now = std::chrono::system_clock::now();
// If the system time is in daylight saving, we give an additional hour to console time
@ -47,7 +47,7 @@ static std::chrono::seconds GetInitTime() {
now = now + std::chrono::hours(1);
// add the offset
s64 init_time_offset = Settings::values.init_time_offset;
s64 init_time_offset = Settings::values.init_time_offset.GetValue();
long long days_offset = init_time_offset / 86400;
long long days_offset_in_seconds = days_offset * 86400; // h/m/s truncated
unsigned long long seconds_offset =
@ -58,9 +58,9 @@ static std::chrono::seconds GetInitTime() {
return std::chrono::duration_cast<std::chrono::seconds>(now.time_since_epoch());
}
case Settings::InitClock::FixedTime:
return std::chrono::seconds(Settings::values.init_time);
return std::chrono::seconds(Settings::values.init_time.GetValue());
default:
UNREACHABLE_MSG("Invalid InitClock value ({})", Settings::values.init_clock);
UNREACHABLE_MSG("Invalid InitClock value ({})", Settings::values.init_clock.GetValue());
}
}
@ -85,7 +85,7 @@ Handler::Handler(Core::Timing& timing) : timing(timing) {
std::bind(&Handler::UpdateTimeCallback, this, _1, _2));
timing.ScheduleEvent(0, update_time_event, 0, 0);
float slidestate = Settings::values.factor_3d / 100.0f;
float slidestate = Settings::values.factor_3d.GetValue() / 100.0f;
shared_page.sliderstate_3d = static_cast<float_le>(slidestate);
}

View file

@ -8,6 +8,7 @@
#include "common/common_paths.h"
#include "common/file_util.h"
#include "common/logging/log.h"
#include "common/settings.h"
#include "core/core.h"
#include "core/file_sys/archive_ncch.h"
#include "core/file_sys/file_backend.h"
@ -28,7 +29,6 @@
#include "core/hle/service/service.h"
#include "core/hw/aes/ccm.h"
#include "core/hw/aes/key.h"
#include "core/settings.h"
SERVICE_CONSTRUCT_IMPL(Service::APT::Module)

View file

@ -6,6 +6,7 @@
#include "common/archives.h"
#include "common/bit_set.h"
#include "common/logging/log.h"
#include "common/settings.h"
#include "core/core.h"
#include "core/core_timing.h"
#include "core/frontend/camera/factory.h"
@ -19,7 +20,6 @@
#include "core/hle/service/cam/cam_s.h"
#include "core/hle/service/cam/cam_u.h"
#include "core/memory.h"
#include "core/settings.h"
SERVICE_CONSTRUCT_IMPL(Service::CAM::Module)

View file

@ -12,6 +12,7 @@
#include "common/archives.h"
#include "common/file_util.h"
#include "common/logging/log.h"
#include "common/settings.h"
#include "common/string_util.h"
#include "common/swap.h"
#include "core/core.h"
@ -25,7 +26,6 @@
#include "core/hle/service/cfg/cfg_nor.h"
#include "core/hle/service/cfg/cfg_s.h"
#include "core/hle/service/cfg/cfg_u.h"
#include "core/settings.h"
SERIALIZE_EXPORT_IMPL(Service::CFG::Module)
@ -189,10 +189,10 @@ void Module::Interface::GetCountryCodeID(Kernel::HLERequestContext& ctx) {
}
u32 Module::GetRegionValue() {
if (Settings::values.region_value == Settings::REGION_VALUE_AUTO_SELECT)
if (Settings::values.region_value.GetValue() == Settings::REGION_VALUE_AUTO_SELECT)
return preferred_region_code;
return Settings::values.region_value;
return Settings::values.region_value.GetValue();
}
void Module::Interface::SecureInfoGetRegion(Kernel::HLERequestContext& ctx, u16 id) {
@ -654,7 +654,7 @@ void Module::SetPreferredRegionCodes(const std::vector<u32>& region_codes) {
preferred_region_code = region;
LOG_INFO(Service_CFG, "Preferred region code set to {}", preferred_region_code);
if (Settings::values.region_value == Settings::REGION_VALUE_AUTO_SELECT) {
if (Settings::values.region_value.GetValue() == Settings::REGION_VALUE_AUTO_SELECT) {
if (current_language != adjusted_language) {
LOG_WARNING(Service_CFG, "System language {} does not fit the region. Adjusted to {}",
current_language, adjusted_language);

View file

@ -9,6 +9,7 @@
#include "common/file_util.h"
#include "common/logging/log.h"
#include "common/scope_exit.h"
#include "common/settings.h"
#include "common/string_util.h"
#include "core/core.h"
#include "core/file_sys/errors.h"
@ -25,7 +26,6 @@
#include "core/hle/service/am/am.h"
#include "core/hle/service/fs/archive.h"
#include "core/hle/service/fs/fs_user.h"
#include "core/settings.h"
SERVICE_CONSTRUCT_IMPL(Service::FS::FS_USER)
SERIALIZE_EXPORT_IMPL(Service::FS::FS_USER)
@ -350,7 +350,7 @@ void FS_USER::IsSdmcDetected(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x817, 0, 0);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS);
rb.Push(Settings::values.use_virtual_sd);
rb.Push(Settings::values.use_virtual_sd.GetValue());
}
void FS_USER::IsSdmcWriteable(Kernel::HLERequestContext& ctx) {
@ -358,7 +358,7 @@ void FS_USER::IsSdmcWriteable(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS);
// If the SD isn't enabled, it can't be writeable...else, stubbed true
rb.Push(Settings::values.use_virtual_sd);
rb.Push(Settings::values.use_virtual_sd.GetValue());
LOG_DEBUG(Service_FS, " (STUBBED)");
}

View file

@ -218,8 +218,9 @@ void Module::UpdatePadCallback(std::uintptr_t user_data, s64 cycles_late) {
// TODO(xperia64): How the 3D Slider is updated by the HID module needs to be RE'd
// and possibly moved to its own Core::Timing event.
mem->pad.sliderstate_3d = (Settings::values.factor_3d / 100.0f);
system.Kernel().GetSharedPageHandler().Set3DSlider(Settings::values.factor_3d / 100.0f);
mem->pad.sliderstate_3d = (Settings::values.factor_3d.GetValue() / 100.0f);
system.Kernel().GetSharedPageHandler().Set3DSlider(Settings::values.factor_3d.GetValue() /
100.0f);
// Reschedule recurrent event
system.CoreTiming().ScheduleEvent(pad_update_ticks - cycles_late, pad_update_event);
@ -406,7 +407,7 @@ void Module::Interface::GetGyroscopeLowCalibrateParam(Kernel::HLERequestContext&
void Module::Interface::GetSoundVolume(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx, 0x17, 0, 0};
const u8 volume = static_cast<u8>(0x3F * Settings::values.volume);
const u8 volume = static_cast<u8>(0x3F * Settings::values.volume.GetValue());
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS);

View file

@ -13,10 +13,10 @@
#include "common/bit_field.h"
#include "common/common_funcs.h"
#include "common/common_types.h"
#include "common/settings.h"
#include "core/core_timing.h"
#include "core/frontend/input.h"
#include "core/hle/service/service.h"
#include "core/settings.h"
namespace Core {
class System;

View file

@ -3,12 +3,12 @@
// Refer to the license.txt file included.
#include "common/alignment.h"
#include "common/settings.h"
#include "common/string_util.h"
#include "core/core.h"
#include "core/core_timing.h"
#include "core/hle/service/ir/extra_hid.h"
#include "core/movie.h"
#include "core/settings.h"
namespace Service::IR {

View file

@ -5,6 +5,7 @@
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include "common/archives.h"
#include "common/settings.h"
#include "core/core.h"
#include "core/core_timing.h"
#include "core/hle/ipc_helpers.h"
@ -13,7 +14,6 @@
#include "core/hle/service/hid/hid.h"
#include "core/hle/service/ir/ir_rst.h"
#include "core/movie.h"
#include "core/settings.h"
SERIALIZE_EXPORT_IMPL(Service::IR::IR_RST)
SERVICE_CONSTRUCT_IMPL(Service::IR::IR_RST)

View file

@ -5,6 +5,7 @@
#include <boost/serialization/weak_ptr.hpp>
#include "common/archives.h"
#include "common/logging/log.h"
#include "common/settings.h"
#include "core/core.h"
#include "core/frontend/mic.h"
#include "core/hle/ipc.h"
@ -14,7 +15,6 @@
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/shared_memory.h"
#include "core/hle/service/mic_u.h"
#include "core/settings.h"
SERVICE_CONSTRUCT_IMPL(Service::MIC::MIC_U)
SERIALIZE_EXPORT_IMPL(Service::MIC::MIC_U)
@ -350,12 +350,12 @@ struct MIC_U::Impl {
void CreateMic() {
std::unique_ptr<Frontend::Mic::Interface> new_mic;
switch (Settings::values.mic_input_type) {
switch (Settings::values.mic_input_type.GetValue()) {
case Settings::MicInputType::None:
new_mic = std::make_unique<Frontend::Mic::NullMic>();
break;
case Settings::MicInputType::Real:
new_mic = Frontend::Mic::CreateRealMic(Settings::values.mic_input_device);
new_mic = Frontend::Mic::CreateRealMic(Settings::values.mic_input_device.GetValue());
break;
case Settings::MicInputType::Static:
new_mic = std::make_unique<Frontend::Mic::StaticMic>();

View file

@ -7,6 +7,7 @@
#include "common/common_paths.h"
#include "common/file_util.h"
#include "common/logging/log.h"
#include "common/settings.h"
#include "core/core.h"
#include "core/file_sys/archive_extsavedata.h"
#include "core/file_sys/errors.h"
@ -17,7 +18,6 @@
#include "core/hle/service/ptm/ptm_sets.h"
#include "core/hle/service/ptm/ptm_sysm.h"
#include "core/hle/service/ptm/ptm_u.h"
#include "core/settings.h"
SERIALIZE_EXPORT_IMPL(Service::PTM::Module)
@ -118,7 +118,7 @@ void Module::Interface::GetSoftwareClosedFlag(Kernel::HLERequestContext& ctx) {
}
void CheckNew3DS(IPC::RequestBuilder& rb) {
const bool is_new_3ds = Settings::values.is_new_3ds;
const bool is_new_3ds = Settings::values.is_new_3ds.GetValue();
rb.Push(RESULT_SUCCESS);
rb.Push(is_new_3ds);