diff options
author | bunnei <bunneidev@gmail.com> | 2021-04-15 02:47:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-15 02:47:18 +0200 |
commit | de5bf640b7309450357074083a9ac397f251adbc (patch) | |
tree | e7c9b9845f7751c2cc4a00dbf05798ff2a69490d /src/core | |
parent | Merge pull request #6197 from ameerj/kreslimit-cleanup (diff) | |
parent | common: Move settings to common from core. (diff) | |
download | yuzu-de5bf640b7309450357074083a9ac397f251adbc.tar yuzu-de5bf640b7309450357074083a9ac397f251adbc.tar.gz yuzu-de5bf640b7309450357074083a9ac397f251adbc.tar.bz2 yuzu-de5bf640b7309450357074083a9ac397f251adbc.tar.lz yuzu-de5bf640b7309450357074083a9ac397f251adbc.tar.xz yuzu-de5bf640b7309450357074083a9ac397f251adbc.tar.zst yuzu-de5bf640b7309450357074083a9ac397f251adbc.zip |
Diffstat (limited to 'src/core')
45 files changed, 53 insertions, 461 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 167ee13f3..286e912e3 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -621,8 +621,6 @@ add_library(core STATIC perf_stats.h reporter.cpp reporter.h - settings.cpp - settings.h telemetry_session.cpp telemetry_session.h tools/freezer.cpp diff --git a/src/core/arm/dynarmic/arm_dynarmic_32.cpp b/src/core/arm/dynarmic/arm_dynarmic_32.cpp index 08d889135..7aeb2a658 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_32.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_32.cpp @@ -10,6 +10,7 @@ #include "common/assert.h" #include "common/logging/log.h" #include "common/page_table.h" +#include "common/settings.h" #include "core/arm/cpu_interrupt_handler.h" #include "core/arm/dynarmic/arm_dynarmic_32.h" #include "core/arm/dynarmic/arm_dynarmic_cp15.h" @@ -18,7 +19,6 @@ #include "core/core_timing.h" #include "core/hle/kernel/svc.h" #include "core/memory.h" -#include "core/settings.h" namespace Core { diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.cpp b/src/core/arm/dynarmic/arm_dynarmic_64.cpp index e12e50658..040529f4d 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_64.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_64.cpp @@ -9,6 +9,7 @@ #include "common/assert.h" #include "common/logging/log.h" #include "common/page_table.h" +#include "common/settings.h" #include "core/arm/cpu_interrupt_handler.h" #include "core/arm/dynarmic/arm_dynarmic_64.h" #include "core/arm/dynarmic/arm_exclusive_monitor.h" @@ -19,7 +20,6 @@ #include "core/hle/kernel/process.h" #include "core/hle/kernel/svc.h" #include "core/memory.h" -#include "core/settings.h" namespace Core { diff --git a/src/core/core.cpp b/src/core/core.cpp index 56b47e671..d459d6c34 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -9,6 +9,7 @@ #include "common/file_util.h" #include "common/logging/log.h" #include "common/microprofile.h" +#include "common/settings.h" #include "common/string_util.h" #include "core/arm/exclusive_monitor.h" #include "core/core.h" @@ -36,6 +37,7 @@ #include "core/hle/service/apm/controller.h" #include "core/hle/service/filesystem/filesystem.h" #include "core/hle/service/glue/manager.h" +#include "core/hle/service/hid/hid.h" #include "core/hle/service/service.h" #include "core/hle/service/sm/sm.h" #include "core/hle/service/time/time_manager.h" @@ -45,7 +47,6 @@ #include "core/network/network.h" #include "core/perf_stats.h" #include "core/reporter.h" -#include "core/settings.h" #include "core/telemetry_session.h" #include "core/tools/freezer.h" #include "video_core/renderer_base.h" @@ -774,4 +775,12 @@ void System::ExecuteProgram(std::size_t program_index) { } } +void System::ApplySettings() { + if (IsPoweredOn()) { + Renderer().RefreshBaseSettings(); + } + + Service::HID::ReloadInputDevices(); +} + } // namespace Core diff --git a/src/core/core.h b/src/core/core.h index 3a8e040c1..f1068d23f 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -388,6 +388,9 @@ public: */ void ExecuteProgram(std::size_t program_index); + /// Applies any changes to settings to this core instance. + void ApplySettings(); + private: System(); diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp index ad116dcc0..070ed439e 100644 --- a/src/core/crypto/key_manager.cpp +++ b/src/core/crypto/key_manager.cpp @@ -22,6 +22,7 @@ #include "common/file_util.h" #include "common/hex_util.h" #include "common/logging/log.h" +#include "common/settings.h" #include "common/string_util.h" #include "core/crypto/aes_util.h" #include "core/crypto/key_manager.h" @@ -32,7 +33,6 @@ #include "core/file_sys/registered_cache.h" #include "core/hle/service/filesystem/filesystem.h" #include "core/loader/loader.h" -#include "core/settings.h" namespace Core::Crypto { namespace { diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp index 7c3284df8..cc9b4b637 100644 --- a/src/core/file_sys/patch_manager.cpp +++ b/src/core/file_sys/patch_manager.cpp @@ -10,6 +10,7 @@ #include "common/file_util.h" #include "common/hex_util.h" #include "common/logging/log.h" +#include "common/settings.h" #include "common/string_util.h" #include "core/core.h" #include "core/file_sys/common_funcs.h" @@ -25,7 +26,6 @@ #include "core/loader/loader.h" #include "core/loader/nso.h" #include "core/memory/cheat_engine.h" -#include "core/settings.h" namespace FileSys { namespace { diff --git a/src/core/frontend/applets/profile_select.cpp b/src/core/frontend/applets/profile_select.cpp index 4df3574d2..8d960d1ca 100644 --- a/src/core/frontend/applets/profile_select.cpp +++ b/src/core/frontend/applets/profile_select.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "common/settings.h" #include "core/frontend/applets/profile_select.h" #include "core/hle/service/acc/profile_manager.h" -#include "core/settings.h" namespace Core::Frontend { diff --git a/src/core/frontend/emu_window.cpp b/src/core/frontend/emu_window.cpp index ee7a58b1c..474de9206 100644 --- a/src/core/frontend/emu_window.cpp +++ b/src/core/frontend/emu_window.cpp @@ -4,9 +4,9 @@ #include <cmath> #include <mutex> +#include "common/settings.h" #include "core/frontend/emu_window.h" #include "core/frontend/input.h" -#include "core/settings.h" namespace Core::Frontend { diff --git a/src/core/frontend/framebuffer_layout.cpp b/src/core/frontend/framebuffer_layout.cpp index b9a270a55..0832463d6 100644 --- a/src/core/frontend/framebuffer_layout.cpp +++ b/src/core/frontend/framebuffer_layout.cpp @@ -5,8 +5,8 @@ #include <cmath> #include "common/assert.h" +#include "common/settings.h" #include "core/frontend/framebuffer_layout.h" -#include "core/settings.h" namespace Layout { diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp index dd01f3924..e35deb8e2 100644 --- a/src/core/hle/kernel/process.cpp +++ b/src/core/hle/kernel/process.cpp @@ -10,6 +10,7 @@ #include "common/alignment.h" #include "common/assert.h" #include "common/logging/log.h" +#include "common/settings.h" #include "core/core.h" #include "core/device_memory.h" #include "core/file_sys/program_metadata.h" @@ -26,7 +27,6 @@ #include "core/hle/kernel/svc_results.h" #include "core/hle/lock.h" #include "core/memory.h" -#include "core/settings.h" namespace Kernel { namespace { diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp index 50b2c58e2..de83d82a4 100644 --- a/src/core/hle/service/acc/profile_manager.cpp +++ b/src/core/hle/service/acc/profile_manager.cpp @@ -8,8 +8,8 @@ #include <fmt/format.h> #include "common/file_util.h" +#include "common/settings.h" #include "core/hle/service/acc/profile_manager.h" -#include "core/settings.h" namespace Service::Account { diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 4374487a3..416c5239a 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -7,6 +7,7 @@ #include <cinttypes> #include <cstring> #include "audio_core/audio_renderer.h" +#include "common/settings.h" #include "core/core.h" #include "core/file_sys/control_metadata.h" #include "core/file_sys/patch_manager.h" @@ -41,7 +42,6 @@ #include "core/hle/service/set/set.h" #include "core/hle/service/sm/sm.h" #include "core/hle/service/vi/vi.h" -#include "core/settings.h" namespace Service::AM { diff --git a/src/core/hle/service/aoc/aoc_u.cpp b/src/core/hle/service/aoc/aoc_u.cpp index 0f51e5871..75867e349 100644 --- a/src/core/hle/service/aoc/aoc_u.cpp +++ b/src/core/hle/service/aoc/aoc_u.cpp @@ -7,6 +7,7 @@ #include <vector> #include "common/logging/log.h" +#include "common/settings.h" #include "core/core.h" #include "core/file_sys/common_funcs.h" #include "core/file_sys/content_archive.h" @@ -21,7 +22,6 @@ #include "core/hle/kernel/process.h" #include "core/hle/service/aoc/aoc_u.h" #include "core/loader/loader.h" -#include "core/settings.h" namespace Service::AOC { diff --git a/src/core/hle/service/apm/controller.cpp b/src/core/hle/service/apm/controller.cpp index 03636642b..00c174bb0 100644 --- a/src/core/hle/service/apm/controller.cpp +++ b/src/core/hle/service/apm/controller.cpp @@ -7,9 +7,9 @@ #include <utility> #include "common/logging/log.h" +#include "common/settings.h" #include "core/core_timing.h" #include "core/hle/service/apm/controller.h" -#include "core/settings.h" namespace Service::APM { diff --git a/src/core/hle/service/bcat/backend/boxcat.cpp b/src/core/hle/service/bcat/backend/boxcat.cpp index e43f3f47f..78c047bd2 100644 --- a/src/core/hle/service/bcat/backend/boxcat.cpp +++ b/src/core/hle/service/bcat/backend/boxcat.cpp @@ -9,6 +9,7 @@ #include "common/hex_util.h" #include "common/logging/backend.h" #include "common/logging/log.h" +#include "common/settings.h" #include "core/core.h" #include "core/file_sys/vfs.h" #include "core/file_sys/vfs_libzip.h" @@ -16,7 +17,6 @@ #include "core/frontend/applets/error.h" #include "core/hle/service/am/applets/applets.h" #include "core/hle/service/bcat/backend/boxcat.h" -#include "core/settings.h" namespace Service::BCAT { namespace { diff --git a/src/core/hle/service/bcat/module.cpp b/src/core/hle/service/bcat/module.cpp index b68e2c345..c7dd04a6e 100644 --- a/src/core/hle/service/bcat/module.cpp +++ b/src/core/hle/service/bcat/module.cpp @@ -7,6 +7,7 @@ #include "backend/boxcat.h" #include "common/hex_util.h" #include "common/logging/log.h" +#include "common/settings.h" #include "common/string_util.h" #include "core/core.h" #include "core/file_sys/vfs.h" @@ -18,7 +19,6 @@ #include "core/hle/service/bcat/bcat.h" #include "core/hle/service/bcat/module.h" #include "core/hle/service/filesystem/filesystem.h" -#include "core/settings.h" namespace Service::BCAT { diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp index b15c737e1..72ad273b2 100644 --- a/src/core/hle/service/filesystem/filesystem.cpp +++ b/src/core/hle/service/filesystem/filesystem.cpp @@ -6,6 +6,7 @@ #include "common/assert.h" #include "common/file_util.h" +#include "common/settings.h" #include "core/core.h" #include "core/file_sys/bis_factory.h" #include "core/file_sys/card_image.h" @@ -26,7 +27,6 @@ #include "core/hle/service/filesystem/fsp_pr.h" #include "core/hle/service/filesystem/fsp_srv.h" #include "core/loader/loader.h" -#include "core/settings.h" namespace Service::FileSystem { diff --git a/src/core/hle/service/hid/controllers/debug_pad.cpp b/src/core/hle/service/hid/controllers/debug_pad.cpp index ad251ed4a..a460f2f79 100644 --- a/src/core/hle/service/hid/controllers/debug_pad.cpp +++ b/src/core/hle/service/hid/controllers/debug_pad.cpp @@ -4,9 +4,9 @@ #include <cstring> #include "common/common_types.h" +#include "common/settings.h" #include "core/core_timing.h" #include "core/hle/service/hid/controllers/debug_pad.h" -#include "core/settings.h" namespace Service::HID { diff --git a/src/core/hle/service/hid/controllers/debug_pad.h b/src/core/hle/service/hid/controllers/debug_pad.h index 555b29d76..0593d7d39 100644 --- a/src/core/hle/service/hid/controllers/debug_pad.h +++ b/src/core/hle/service/hid/controllers/debug_pad.h @@ -8,10 +8,10 @@ #include "common/bit_field.h" #include "common/common_funcs.h" #include "common/common_types.h" +#include "common/settings.h" #include "common/swap.h" #include "core/frontend/input.h" #include "core/hle/service/hid/controllers/controller_base.h" -#include "core/settings.h" namespace Service::HID { class Controller_DebugPad final : public ControllerBase { diff --git a/src/core/hle/service/hid/controllers/gesture.cpp b/src/core/hle/service/hid/controllers/gesture.cpp index 93c43a203..155808f6a 100644 --- a/src/core/hle/service/hid/controllers/gesture.cpp +++ b/src/core/hle/service/hid/controllers/gesture.cpp @@ -5,10 +5,10 @@ #include <cstring> #include "common/common_types.h" #include "common/logging/log.h" +#include "common/settings.h" #include "core/core_timing.h" #include "core/frontend/emu_window.h" #include "core/hle/service/hid/controllers/gesture.h" -#include "core/settings.h" namespace Service::HID { constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3BA00; diff --git a/src/core/hle/service/hid/controllers/keyboard.cpp b/src/core/hle/service/hid/controllers/keyboard.cpp index c4a59147d..18b76038f 100644 --- a/src/core/hle/service/hid/controllers/keyboard.cpp +++ b/src/core/hle/service/hid/controllers/keyboard.cpp @@ -4,9 +4,9 @@ #include <cstring> #include "common/common_types.h" +#include "common/settings.h" #include "core/core_timing.h" #include "core/hle/service/hid/controllers/keyboard.h" -#include "core/settings.h" namespace Service::HID { constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3800; diff --git a/src/core/hle/service/hid/controllers/keyboard.h b/src/core/hle/service/hid/controllers/keyboard.h index b5b281752..e72948591 100644 --- a/src/core/hle/service/hid/controllers/keyboard.h +++ b/src/core/hle/service/hid/controllers/keyboard.h @@ -8,10 +8,10 @@ #include "common/bit_field.h" #include "common/common_funcs.h" #include "common/common_types.h" +#include "common/settings.h" #include "common/swap.h" #include "core/frontend/input.h" #include "core/hle/service/hid/controllers/controller_base.h" -#include "core/settings.h" namespace Service::HID { class Controller_Keyboard final : public ControllerBase { diff --git a/src/core/hle/service/hid/controllers/mouse.h b/src/core/hle/service/hid/controllers/mouse.h index 3b432a36e..0ec0c2b94 100644 --- a/src/core/hle/service/hid/controllers/mouse.h +++ b/src/core/hle/service/hid/controllers/mouse.h @@ -7,10 +7,10 @@ #include <array> #include "common/bit_field.h" #include "common/common_types.h" +#include "common/settings.h" #include "common/swap.h" #include "core/frontend/input.h" #include "core/hle/service/hid/controllers/controller_base.h" -#include "core/settings.h" namespace Service::HID { class Controller_Mouse final : public ControllerBase { diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 673db68c7..783386fcf 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp @@ -9,6 +9,7 @@ #include "common/bit_field.h" #include "common/common_types.h" #include "common/logging/log.h" +#include "common/settings.h" #include "core/core.h" #include "core/core_timing.h" #include "core/frontend/input.h" @@ -17,7 +18,6 @@ #include "core/hle/kernel/k_writable_event.h" #include "core/hle/kernel/kernel.h" #include "core/hle/service/hid/controllers/npad.h" -#include "core/settings.h" namespace Service::HID { constexpr s32 HID_JOYSTICK_MAX = 0x7fff; diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index 873a0a1e2..14d0ac067 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h @@ -8,10 +8,10 @@ #include <atomic> #include "common/bit_field.h" #include "common/common_types.h" +#include "common/settings.h" #include "core/frontend/input.h" #include "core/hle/kernel/object.h" #include "core/hle/service/hid/controllers/controller_base.h" -#include "core/settings.h" namespace Kernel { class KEvent; diff --git a/src/core/hle/service/hid/controllers/touchscreen.cpp b/src/core/hle/service/hid/controllers/touchscreen.cpp index be60492a4..b5f8077be 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.cpp +++ b/src/core/hle/service/hid/controllers/touchscreen.cpp @@ -6,11 +6,11 @@ #include <cstring> #include "common/common_types.h" #include "common/logging/log.h" +#include "common/settings.h" #include "core/core_timing.h" #include "core/frontend/emu_window.h" #include "core/frontend/input.h" #include "core/hle/service/hid/controllers/touchscreen.h" -#include "core/settings.h" namespace Service::HID { constexpr std::size_t SHARED_MEMORY_OFFSET = 0x400; diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index a1a779cc0..4c1c0ac68 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -5,6 +5,7 @@ #include <array> #include "common/common_types.h" #include "common/logging/log.h" +#include "common/settings.h" #include "core/core.h" #include "core/core_timing.h" #include "core/core_timing_util.h" @@ -23,7 +24,6 @@ #include "core/hle/service/hid/irs.h" #include "core/hle/service/hid/xcd.h" #include "core/hle/service/service.h" -#include "core/settings.h" #include "core/hle/service/hid/controllers/controller_base.h" #include "core/hle/service/hid/controllers/debug_pad.h" diff --git a/src/core/hle/service/nfc/nfc.cpp b/src/core/hle/service/nfc/nfc.cpp index 6ab35de47..44a5d5789 100644 --- a/src/core/hle/service/nfc/nfc.cpp +++ b/src/core/hle/service/nfc/nfc.cpp @@ -5,12 +5,12 @@ #include <memory> #include "common/logging/log.h" +#include "common/settings.h" #include "core/hle/ipc_helpers.h" #include "core/hle/kernel/hle_ipc.h" #include "core/hle/service/nfc/nfc.h" #include "core/hle/service/service.h" #include "core/hle/service/sm/sm.h" -#include "core/settings.h" namespace Service::NFC { diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp index afb3342d6..9f110df8e 100644 --- a/src/core/hle/service/nifm/nifm.cpp +++ b/src/core/hle/service/nifm/nifm.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "common/settings.h" #include "core/core.h" #include "core/hle/ipc_helpers.h" #include "core/hle/kernel/k_event.h" @@ -10,7 +11,6 @@ #include "core/hle/service/nifm/nifm.h" #include "core/hle/service/service.h" #include "core/network/network.h" -#include "core/settings.h" namespace Service::NIFM { diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index 5fe7a9189..e373609a1 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include "common/logging/log.h" +#include "common/settings.h" #include "core/core.h" #include "core/file_sys/control_metadata.h" #include "core/file_sys/patch_manager.h" @@ -14,7 +15,6 @@ #include "core/hle/service/ns/ns.h" #include "core/hle/service/ns/pl_u.h" #include "core/hle/service/set/set.h" -#include "core/settings.h" namespace Service::NS { diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp index ac2906e5b..539b02bc4 100644 --- a/src/core/hle/service/nvflinger/nvflinger.cpp +++ b/src/core/hle/service/nvflinger/nvflinger.cpp @@ -9,6 +9,7 @@ #include "common/logging/log.h" #include "common/microprofile.h" #include "common/scope_exit.h" +#include "common/settings.h" #include "common/thread.h" #include "core/core.h" #include "core/core_timing.h" @@ -23,7 +24,6 @@ #include "core/hle/service/vi/display/vi_display.h" #include "core/hle/service/vi/layer/vi_layer.h" #include "core/perf_stats.h" -#include "core/settings.h" #include "video_core/renderer_base.h" namespace Service::NVFlinger { diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index aec399076..41a502d8d 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -6,6 +6,7 @@ #include <fmt/format.h> #include "common/assert.h" #include "common/logging/log.h" +#include "common/settings.h" #include "common/string_util.h" #include "core/core.h" #include "core/hle/ipc.h" @@ -70,7 +71,6 @@ #include "core/hle/service/vi/vi.h" #include "core/hle/service/wlan/wlan.h" #include "core/reporter.h" -#include "core/settings.h" namespace Service { diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/set.cpp index d953b4303..bc7dc776f 100644 --- a/src/core/hle/service/set/set.cpp +++ b/src/core/hle/service/set/set.cpp @@ -6,9 +6,9 @@ #include <array> #include <chrono> #include "common/logging/log.h" +#include "common/settings.h" #include "core/hle/ipc_helpers.h" #include "core/hle/service/set/set.h" -#include "core/settings.h" namespace Service::Set { namespace { diff --git a/src/core/hle/service/spl/module.cpp b/src/core/hle/service/spl/module.cpp index 6903dd534..b1552c3f0 100644 --- a/src/core/hle/service/spl/module.cpp +++ b/src/core/hle/service/spl/module.cpp @@ -9,11 +9,11 @@ #include <functional> #include <vector> #include "common/logging/log.h" +#include "common/settings.h" #include "core/hle/ipc_helpers.h" #include "core/hle/service/spl/csrng.h" #include "core/hle/service/spl/module.h" #include "core/hle/service/spl/spl.h" -#include "core/settings.h" namespace Service::SPL { diff --git a/src/core/hle/service/time/time_manager.cpp b/src/core/hle/service/time/time_manager.cpp index 51becd074..f89c5aaad 100644 --- a/src/core/hle/service/time/time_manager.cpp +++ b/src/core/hle/service/time/time_manager.cpp @@ -5,12 +5,12 @@ #include <chrono> #include <ctime> +#include "common/settings.h" #include "common/time_zone.h" #include "core/hle/service/time/ephemeral_network_system_clock_context_writer.h" #include "core/hle/service/time/local_system_clock_context_writer.h" #include "core/hle/service/time/network_system_clock_context_writer.h" #include "core/hle/service/time/time_manager.h" -#include "core/settings.h" namespace Service::Time { diff --git a/src/core/hle/service/time/time_zone_content_manager.cpp b/src/core/hle/service/time/time_zone_content_manager.cpp index 4177d0a41..3c8e71a3c 100644 --- a/src/core/hle/service/time/time_zone_content_manager.cpp +++ b/src/core/hle/service/time/time_zone_content_manager.cpp @@ -5,6 +5,7 @@ #include <sstream> #include "common/logging/log.h" +#include "common/settings.h" #include "common/time_zone.h" #include "core/core.h" #include "core/file_sys/content_archive.h" @@ -15,7 +16,6 @@ #include "core/hle/service/filesystem/filesystem.h" #include "core/hle/service/time/time_manager.h" #include "core/hle/service/time/time_zone_content_manager.h" -#include "core/settings.h" namespace Service::Time::TimeZone { diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index a1a7ac987..348360b51 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp @@ -15,6 +15,7 @@ #include "common/common_funcs.h" #include "common/logging/log.h" #include "common/math_util.h" +#include "common/settings.h" #include "common/swap.h" #include "core/core_timing.h" #include "core/hle/ipc_helpers.h" @@ -30,7 +31,6 @@ #include "core/hle/service/vi/vi_m.h" #include "core/hle/service/vi/vi_s.h" #include "core/hle/service/vi/vi_u.h" -#include "core/settings.h" namespace Service::VI { diff --git a/src/core/loader/nro.cpp b/src/core/loader/nro.cpp index 14618cb40..0115ed0c4 100644 --- a/src/core/loader/nro.cpp +++ b/src/core/loader/nro.cpp @@ -9,6 +9,7 @@ #include "common/common_types.h" #include "common/file_util.h" #include "common/logging/log.h" +#include "common/settings.h" #include "common/swap.h" #include "core/core.h" #include "core/file_sys/control_metadata.h" @@ -22,7 +23,6 @@ #include "core/loader/nro.h" #include "core/loader/nso.h" #include "core/memory.h" -#include "core/settings.h" namespace Loader { diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index cbd048695..0c83dd666 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp @@ -11,6 +11,7 @@ #include "common/hex_util.h" #include "common/logging/log.h" #include "common/lz4_compression.h" +#include "common/settings.h" #include "common/swap.h" #include "core/core.h" #include "core/file_sys/patch_manager.h" @@ -20,7 +21,6 @@ #include "core/hle/kernel/process.h" #include "core/loader/nso.h" #include "core/memory.h" -#include "core/settings.h" namespace Loader { namespace { diff --git a/src/core/perf_stats.cpp b/src/core/perf_stats.cpp index b93396a80..c92337079 100644 --- a/src/core/perf_stats.cpp +++ b/src/core/perf_stats.cpp @@ -13,8 +13,8 @@ #include <fmt/format.h> #include "common/file_util.h" #include "common/math_util.h" +#include "common/settings.h" #include "core/perf_stats.h" -#include "core/settings.h" using namespace std::chrono_literals; using DoubleSecs = std::chrono::duration<double, std::chrono::seconds::period>; diff --git a/src/core/reporter.cpp b/src/core/reporter.cpp index 74fb32814..311d4dda8 100644 --- a/src/core/reporter.cpp +++ b/src/core/reporter.cpp @@ -14,6 +14,7 @@ #include "common/file_util.h" #include "common/hex_util.h" #include "common/scm_rev.h" +#include "common/settings.h" #include "core/arm/arm_interface.h" #include "core/core.h" #include "core/hle/kernel/hle_ipc.h" @@ -22,7 +23,6 @@ #include "core/hle/result.h" #include "core/memory.h" #include "core/reporter.h" -#include "core/settings.h" namespace { diff --git a/src/core/settings.cpp b/src/core/settings.cpp deleted file mode 100644 index 2ae5196e0..000000000 --- a/src/core/settings.cpp +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright 2014 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#include <string_view> - -#include "common/assert.h" -#include "common/file_util.h" -#include "common/logging/log.h" -#include "core/core.h" -#include "core/hle/service/hid/hid.h" -#include "core/settings.h" -#include "video_core/renderer_base.h" - -namespace Settings { - -Values values = {}; -static bool configuring_global = true; - -std::string GetTimeZoneString() { - static constexpr std::array timezones{ - "auto", "default", "CET", "CST6CDT", "Cuba", "EET", "Egypt", "Eire", - "EST", "EST5EDT", "GB", "GB-Eire", "GMT", "GMT+0", "GMT-0", "GMT0", - "Greenwich", "Hongkong", "HST", "Iceland", "Iran", "Israel", "Jamaica", "Japan", - "Kwajalein", "Libya", "MET", "MST", "MST7MDT", "Navajo", "NZ", "NZ-CHAT", - "Poland", "Portugal", "PRC", "PST8PDT", "ROC", "ROK", "Singapore", "Turkey", - "UCT", "Universal", "UTC", "W-SU", "WET", "Zulu", - }; - - const auto time_zone_index = static_cast<std::size_t>(values.time_zone_index.GetValue()); - ASSERT(time_zone_index < timezones.size()); - return timezones[time_zone_index]; -} - -void Apply(Core::System& system) { - if (system.IsPoweredOn()) { - system.Renderer().RefreshBaseSettings(); - } - - Service::HID::ReloadInputDevices(); -} - -void LogSettings() { - const auto log_setting = [](std::string_view name, const auto& value) { - LOG_INFO(Config, "{}: {}", name, value); - }; - - LOG_INFO(Config, "yuzu Configuration:"); - log_setting("Controls_UseDockedMode", values.use_docked_mode.GetValue()); - log_setting("System_RngSeed", values.rng_seed.GetValue().value_or(0)); - log_setting("System_CurrentUser", values.current_user); - log_setting("System_LanguageIndex", values.language_index.GetValue()); - log_setting("System_RegionIndex", values.region_index.GetValue()); - log_setting("System_TimeZoneIndex", values.time_zone_index.GetValue()); - log_setting("Core_UseMultiCore", values.use_multi_core.GetValue()); - log_setting("CPU_Accuracy", values.cpu_accuracy); - log_setting("Renderer_UseResolutionFactor", values.resolution_factor.GetValue()); - log_setting("Renderer_UseFrameLimit", values.use_frame_limit.GetValue()); - log_setting("Renderer_FrameLimit", values.frame_limit.GetValue()); - log_setting("Renderer_UseDiskShaderCache", values.use_disk_shader_cache.GetValue()); - log_setting("Renderer_GPUAccuracyLevel", values.gpu_accuracy.GetValue()); - log_setting("Renderer_UseAsynchronousGpuEmulation", - values.use_asynchronous_gpu_emulation.GetValue()); - log_setting("Renderer_UseNvdecEmulation", values.use_nvdec_emulation.GetValue()); - log_setting("Renderer_UseVsync", values.use_vsync.GetValue()); - log_setting("Renderer_UseAssemblyShaders", values.use_assembly_shaders.GetValue()); - log_setting("Renderer_UseAsynchronousShaders", values.use_asynchronous_shaders.GetValue()); - log_setting("Renderer_AnisotropicFilteringLevel", values.max_anisotropy.GetValue()); - log_setting("Audio_OutputEngine", values.sink_id); - log_setting("Audio_EnableAudioStretching", values.enable_audio_stretching.GetValue()); - log_setting("Audio_OutputDevice", values.audio_device_id); - log_setting("DataStorage_UseVirtualSd", values.use_virtual_sd); - log_setting("DataStorage_CacheDir", Common::FS::GetUserPath(Common::FS::UserPath::CacheDir)); - log_setting("DataStorage_ConfigDir", Common::FS::GetUserPath(Common::FS::UserPath::ConfigDir)); - log_setting("DataStorage_LoadDir", Common::FS::GetUserPath(Common::FS::UserPath::LoadDir)); - log_setting("DataStorage_NandDir", Common::FS::GetUserPath(Common::FS::UserPath::NANDDir)); - log_setting("DataStorage_SdmcDir", Common::FS::GetUserPath(Common::FS::UserPath::SDMCDir)); - log_setting("Debugging_ProgramArgs", values.program_args); - log_setting("Services_BCATBackend", values.bcat_backend); - log_setting("Services_BCATBoxcatLocal", values.bcat_boxcat_local); -} - -bool IsConfiguringGlobal() { - return configuring_global; -} - -void SetConfiguringGlobal(bool is_global) { - configuring_global = is_global; -} - -bool IsGPULevelExtreme() { - return values.gpu_accuracy.GetValue() == GPUAccuracy::Extreme; -} - -bool IsGPULevelHigh() { - return values.gpu_accuracy.GetValue() == GPUAccuracy::Extreme || - values.gpu_accuracy.GetValue() == GPUAccuracy::High; -} - -float Volume() { - if (values.audio_muted) { - return 0.0f; - } - return values.volume.GetValue(); -} - -void RestoreGlobalState(bool is_powered_on) { - // If a game is running, DO NOT restore the global settings state - if (is_powered_on) { - return; - } - - // Audio - values.enable_audio_stretching.SetGlobal(true); - values.volume.SetGlobal(true); - - // Core - values.use_multi_core.SetGlobal(true); - - // Renderer - values.renderer_backend.SetGlobal(true); - values.vulkan_device.SetGlobal(true); - values.aspect_ratio.SetGlobal(true); - values.max_anisotropy.SetGlobal(true); - values.use_frame_limit.SetGlobal(true); - values.frame_limit.SetGlobal(true); - values.use_disk_shader_cache.SetGlobal(true); - values.gpu_accuracy.SetGlobal(true); - values.use_asynchronous_gpu_emulation.SetGlobal(true); - values.use_nvdec_emulation.SetGlobal(true); - values.use_vsync.SetGlobal(true); - values.use_assembly_shaders.SetGlobal(true); - values.use_asynchronous_shaders.SetGlobal(true); - values.use_fast_gpu_time.SetGlobal(true); - values.bg_red.SetGlobal(true); - values.bg_green.SetGlobal(true); - values.bg_blue.SetGlobal(true); - - // System - values.language_index.SetGlobal(true); - values.region_index.SetGlobal(true); - values.time_zone_index.SetGlobal(true); - values.rng_seed.SetGlobal(true); - values.custom_rtc.SetGlobal(true); - values.sound_index.SetGlobal(true); - - // Controls - values.players.SetGlobal(true); - values.use_docked_mode.SetGlobal(true); - values.vibration_enabled.SetGlobal(true); - values.motion_enabled.SetGlobal(true); -} - -} // namespace Settings diff --git a/src/core/settings.h b/src/core/settings.h deleted file mode 100644 index 6c03a6ea9..000000000 --- a/src/core/settings.h +++ /dev/null @@ -1,264 +0,0 @@ -// Copyright 2014 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#pragma once - -#include <array> -#include <atomic> -#include <chrono> -#include <map> -#include <optional> -#include <string> -#include <vector> -#include "common/common_types.h" -#include "input_common/settings.h" - -namespace Core { -class System; -} - -namespace Settings { - -enum class RendererBackend { - OpenGL = 0, - Vulkan = 1, -}; - -enum class GPUAccuracy : u32 { - Normal = 0, - High = 1, - Extreme = 2, -}; - -enum class CPUAccuracy { - Accurate = 0, - Unsafe = 1, - DebugMode = 2, -}; - -template <typename Type> -class Setting final { -public: - Setting() = default; - explicit Setting(Type val) : global{val} {} - ~Setting() = default; - void SetGlobal(bool to_global) { - use_global = to_global; - } - bool UsingGlobal() const { - return use_global; - } - Type GetValue(bool need_global = false) const { - if (use_global || need_global) { - return global; - } - return local; - } - void SetValue(const Type& value) { - if (use_global) { - global = value; - } else { - local = value; - } - } - -private: - bool use_global = true; - Type global{}; - Type local{}; -}; - -/** - * The InputSetting class allows for getting a reference to either the global or local members. - * This is required as we cannot easily modify the values of user-defined types within containers - * using the SetValue() member function found in the Setting class. The primary purpose of this - * class is to store an array of 10 PlayerInput structs for both the global and local (per-game) - * setting and allows for easily accessing and modifying both settings. - */ -template <typename Type> -class InputSetting final { -public: - InputSetting() = default; - explicit InputSetting(Type val) : global{val} {} - ~InputSetting() = default; - void SetGlobal(bool to_global) { - use_global = to_global; - } - bool UsingGlobal() const { - return use_global; - } - Type& GetValue(bool need_global = false) { - if (use_global || need_global) { - return global; - } - return local; - } - -private: - bool use_global = true; - Type global{}; - Type local{}; -}; - -struct TouchFromButtonMap { - std::string name; - std::vector<std::string> buttons; -}; - -struct Values { - // Audio - std::string audio_device_id; - std::string sink_id; - bool audio_muted; - Setting<bool> enable_audio_stretching; - Setting<float> volume; - - // Core - Setting<bool> use_multi_core; - - // Cpu - CPUAccuracy cpu_accuracy; - - bool cpuopt_page_tables; - bool cpuopt_block_linking; - bool cpuopt_return_stack_buffer; - bool cpuopt_fast_dispatcher; - bool cpuopt_context_elimination; - bool cpuopt_const_prop; - bool cpuopt_misc_ir; - bool cpuopt_reduce_misalign_checks; - - bool cpuopt_unsafe_unfuse_fma; - bool cpuopt_unsafe_reduce_fp_error; - bool cpuopt_unsafe_inaccurate_nan; - - // Renderer - Setting<RendererBackend> renderer_backend; - bool renderer_debug; - Setting<int> vulkan_device; - - Setting<u16> resolution_factor{1}; - Setting<int> fullscreen_mode; - Setting<int> aspect_ratio; - Setting<int> max_anisotropy; - Setting<bool> use_frame_limit; - Setting<u16> frame_limit; - Setting<bool> use_disk_shader_cache; - Setting<GPUAccuracy> gpu_accuracy; - Setting<bool> use_asynchronous_gpu_emulation; - Setting<bool> use_nvdec_emulation; - Setting<bool> use_vsync; - Setting<bool> use_assembly_shaders; - Setting<bool> use_asynchronous_shaders; - Setting<bool> use_fast_gpu_time; - - Setting<float> bg_red; - Setting<float> bg_green; - Setting<float> bg_blue; - - // System - Setting<std::optional<u32>> rng_seed; - // Measured in seconds since epoch - Setting<std::optional<std::chrono::seconds>> custom_rtc; - // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc` - std::chrono::seconds custom_rtc_differential; - - s32 current_user; - Setting<s32> language_index; - Setting<s32> region_index; - Setting<s32> time_zone_index; - Setting<s32> sound_index; - - // Controls - InputSetting<std::array<PlayerInput, 10>> players; - - Setting<bool> use_docked_mode; - - Setting<bool> vibration_enabled; - Setting<bool> enable_accurate_vibrations; - - Setting<bool> motion_enabled; - std::string motion_device; - std::string udp_input_servers; - - bool mouse_panning; - float mouse_panning_sensitivity; - bool mouse_enabled; - std::string mouse_device; - MouseButtonsRaw mouse_buttons; - - bool emulate_analog_keyboard; - bool keyboard_enabled; - KeyboardKeysRaw keyboard_keys; - KeyboardModsRaw keyboard_mods; - - bool debug_pad_enabled; - ButtonsRaw debug_pad_buttons; - AnalogsRaw debug_pad_analogs; - - TouchscreenInput touchscreen; - - bool use_touch_from_button; - std::string touch_device; - int touch_from_button_map_index; - std::vector<TouchFromButtonMap> touch_from_button_maps; - - std::atomic_bool is_device_reload_pending{true}; - - // Data Storage - bool use_virtual_sd; - bool gamecard_inserted; - bool gamecard_current_game; - std::string gamecard_path; - - // Debugging - bool record_frame_times; - bool use_gdbstub; - u16 gdbstub_port; - std::string program_args; - bool dump_exefs; - bool dump_nso; - bool reporting_services; - bool quest_flag; - bool disable_macro_jit; - bool extended_logging; - bool use_auto_stub; - - // Miscellaneous - std::string log_filter; - bool use_dev_keys; - - // Services - std::string bcat_backend; - bool bcat_boxcat_local; - - // WebService - bool enable_telemetry; - std::string web_api_url; - std::string yuzu_username; - std::string yuzu_token; - - // Add-Ons - std::map<u64, std::vector<std::string>> disabled_addons; -}; - -extern Values values; - -bool IsConfiguringGlobal(); -void SetConfiguringGlobal(bool is_global); - -bool IsGPULevelExtreme(); -bool IsGPULevelHigh(); - -float Volume(); - -std::string GetTimeZoneString(); - -void Apply(Core::System& system); -void LogSettings(); - -// Restore the global state of all applicable settings in the Values struct -void RestoreGlobalState(bool is_powered_on); - -} // namespace Settings diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp index d11b15f38..6dcff5400 100644 --- a/src/core/telemetry_session.cpp +++ b/src/core/telemetry_session.cpp @@ -12,10 +12,10 @@ #include "common/file_util.h" #include "common/logging/log.h" +#include "common/settings.h" #include "core/file_sys/control_metadata.h" #include "core/file_sys/patch_manager.h" #include "core/loader/loader.h" -#include "core/settings.h" #include "core/telemetry_session.h" #ifdef ENABLE_WEB_SERVICE |