summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/audio_core/command_generator.cpp9
-rw-r--r--src/common/settings.cpp2
-rw-r--r--src/common/settings.h10
-rw-r--r--src/common/uuid.h5
-rw-r--r--src/core/CMakeLists.txt72
-rw-r--r--src/core/core.cpp17
-rw-r--r--src/core/core.h2
-rw-r--r--src/core/file_sys/card_image.cpp18
-rw-r--r--src/core/file_sys/card_image.h3
-rw-r--r--src/core/file_sys/content_archive.cpp1
-rw-r--r--src/core/file_sys/submission_package.cpp71
-rw-r--r--src/core/file_sys/submission_package.h11
-rw-r--r--src/core/frontend/applets/software_keyboard.h2
-rw-r--r--src/core/frontend/applets/web_browser.h2
-rw-r--r--src/core/hardware_interrupt_manager.cpp2
-rw-r--r--src/core/hle/service/acc/acc.cpp2
-rw-r--r--src/core/hle/service/acc/acc.h2
-rw-r--r--src/core/hle/service/am/am.cpp10
-rw-r--r--src/core/hle/service/am/applets/applet_controller.cpp (renamed from src/core/hle/service/am/applets/controller.cpp)2
-rw-r--r--src/core/hle/service/am/applets/applet_controller.h (renamed from src/core/hle/service/am/applets/controller.h)0
-rw-r--r--src/core/hle/service/am/applets/applet_error.cpp (renamed from src/core/hle/service/am/applets/error.cpp)2
-rw-r--r--src/core/hle/service/am/applets/applet_error.h (renamed from src/core/hle/service/am/applets/error.h)0
-rw-r--r--src/core/hle/service/am/applets/applet_general_backend.cpp (renamed from src/core/hle/service/am/applets/general_backend.cpp)2
-rw-r--r--src/core/hle/service/am/applets/applet_general_backend.h (renamed from src/core/hle/service/am/applets/general_backend.h)0
-rw-r--r--src/core/hle/service/am/applets/applet_profile_select.cpp (renamed from src/core/hle/service/am/applets/profile_select.cpp)2
-rw-r--r--src/core/hle/service/am/applets/applet_profile_select.h (renamed from src/core/hle/service/am/applets/profile_select.h)0
-rw-r--r--src/core/hle/service/am/applets/applet_software_keyboard.cpp (renamed from src/core/hle/service/am/applets/software_keyboard.cpp)2
-rw-r--r--src/core/hle/service/am/applets/applet_software_keyboard.h (renamed from src/core/hle/service/am/applets/software_keyboard.h)2
-rw-r--r--src/core/hle/service/am/applets/applet_software_keyboard_types.h (renamed from src/core/hle/service/am/applets/software_keyboard_types.h)0
-rw-r--r--src/core/hle/service/am/applets/applet_web_browser.cpp (renamed from src/core/hle/service/am/applets/web_browser.cpp)15
-rw-r--r--src/core/hle/service/am/applets/applet_web_browser.h (renamed from src/core/hle/service/am/applets/web_browser.h)2
-rw-r--r--src/core/hle/service/am/applets/applet_web_browser_types.h (renamed from src/core/hle/service/am/applets/web_types.h)0
-rw-r--r--src/core/hle/service/am/applets/applets.cpp12
-rw-r--r--src/core/hle/service/apm/apm.cpp2
-rw-r--r--src/core/hle/service/apm/apm_controller.cpp (renamed from src/core/hle/service/apm/controller.cpp)2
-rw-r--r--src/core/hle/service/apm/apm_controller.h (renamed from src/core/hle/service/apm/controller.h)0
-rw-r--r--src/core/hle/service/apm/apm_interface.cpp (renamed from src/core/hle/service/apm/interface.cpp)4
-rw-r--r--src/core/hle/service/apm/apm_interface.h (renamed from src/core/hle/service/apm/interface.h)0
-rw-r--r--src/core/hle/service/bcat/backend/boxcat.cpp3
-rw-r--r--src/core/hle/service/bcat/bcat.h2
-rw-r--r--src/core/hle/service/bcat/bcat_module.cpp (renamed from src/core/hle/service/bcat/module.cpp)2
-rw-r--r--src/core/hle/service/bcat/bcat_module.h (renamed from src/core/hle/service/bcat/module.h)0
-rw-r--r--src/core/hle/service/friend/friend.cpp2
-rw-r--r--src/core/hle/service/friend/friend_interface.cpp (renamed from src/core/hle/service/friend/interface.cpp)2
-rw-r--r--src/core/hle/service/friend/friend_interface.h (renamed from src/core/hle/service/friend/interface.h)0
-rw-r--r--src/core/hle/service/glue/arp.cpp2
-rw-r--r--src/core/hle/service/glue/glue_manager.cpp (renamed from src/core/hle/service/glue/manager.cpp)2
-rw-r--r--src/core/hle/service/glue/glue_manager.h (renamed from src/core/hle/service/glue/manager.h)0
-rw-r--r--src/core/hle/service/hid/controllers/npad.cpp5
-rw-r--r--src/core/hle/service/mii/mii.cpp2
-rw-r--r--src/core/hle/service/mii/mii_manager.cpp (renamed from src/core/hle/service/mii/manager.cpp)2
-rw-r--r--src/core/hle/service/mii/mii_manager.h (renamed from src/core/hle/service/mii/manager.h)0
-rw-r--r--src/core/hle/service/mii/raw_data.h2
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp85
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.cpp2
-rw-r--r--src/core/hle/service/nvdrv/nvdrv_interface.cpp (renamed from src/core/hle/service/nvdrv/interface.cpp)2
-rw-r--r--src/core/hle/service/nvdrv/nvdrv_interface.h (renamed from src/core/hle/service/nvdrv/interface.h)0
-rw-r--r--src/core/hle/service/pctl/pctl.h2
-rw-r--r--src/core/hle/service/pctl/pctl_module.cpp (renamed from src/core/hle/service/pctl/module.cpp)2
-rw-r--r--src/core/hle/service/pctl/pctl_module.h (renamed from src/core/hle/service/pctl/module.h)0
-rw-r--r--src/core/hle/service/service.cpp6
-rw-r--r--src/core/hle/service/sm/sm.cpp2
-rw-r--r--src/core/hle/service/sm/sm_controller.cpp (renamed from src/core/hle/service/sm/controller.cpp)2
-rw-r--r--src/core/hle/service/sm/sm_controller.h (renamed from src/core/hle/service/sm/controller.h)0
-rw-r--r--src/core/hle/service/spl/csrng.h2
-rw-r--r--src/core/hle/service/spl/spl.h2
-rw-r--r--src/core/hle/service/spl/spl_module.cpp (renamed from src/core/hle/service/spl/module.cpp)2
-rw-r--r--src/core/hle/service/spl/spl_module.h (renamed from src/core/hle/service/spl/module.h)0
-rw-r--r--src/core/hle/service/time/time.cpp2
-rw-r--r--src/core/hle/service/time/time_interface.cpp (renamed from src/core/hle/service/time/interface.cpp)2
-rw-r--r--src/core/hle/service/time/time_interface.h (renamed from src/core/hle/service/time/interface.h)0
-rw-r--r--src/core/loader/loader.cpp13
-rw-r--r--src/core/loader/loader.h13
-rw-r--r--src/core/loader/nsp.cpp34
-rw-r--r--src/core/loader/nsp.h4
-rw-r--r--src/core/loader/xci.cpp14
-rw-r--r--src/core/loader/xci.h3
-rw-r--r--src/input_common/main.cpp4
-rw-r--r--src/input_common/mouse/mouse_poller.cpp2
-rw-r--r--src/input_common/sdl/sdl_impl.cpp4
-rw-r--r--src/input_common/sdl/sdl_impl.h8
-rw-r--r--src/video_core/command_classes/vic.cpp21
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.h2
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp8
-rw-r--r--src/video_core/renderer_vulkan/vk_blit_screen.cpp5
-rw-r--r--src/video_core/renderer_vulkan/vk_buffer_cache.cpp31
-rw-r--r--src/video_core/renderer_vulkan/vk_buffer_cache.h6
-rw-r--r--src/video_core/renderer_vulkan/vk_compute_pass.cpp33
-rw-r--r--src/video_core/renderer_vulkan/vk_rasterizer.cpp6
-rw-r--r--src/video_core/renderer_vulkan/vk_texture_cache.cpp6
-rw-r--r--src/video_core/texture_cache/texture_cache.h6
-rw-r--r--src/video_core/texture_cache/util.cpp86
-rw-r--r--src/web_service/web_backend.cpp10
-rw-r--r--src/yuzu/CMakeLists.txt25
-rw-r--r--src/yuzu/applets/qt_controller.cpp (renamed from src/yuzu/applets/controller.cpp)4
-rw-r--r--src/yuzu/applets/qt_controller.h (renamed from src/yuzu/applets/controller.h)0
-rw-r--r--src/yuzu/applets/qt_controller.ui (renamed from src/yuzu/applets/controller.ui)0
-rw-r--r--src/yuzu/applets/qt_error.cpp (renamed from src/yuzu/applets/error.cpp)2
-rw-r--r--src/yuzu/applets/qt_error.h (renamed from src/yuzu/applets/error.h)0
-rw-r--r--src/yuzu/applets/qt_profile_select.cpp (renamed from src/yuzu/applets/profile_select.cpp)2
-rw-r--r--src/yuzu/applets/qt_profile_select.h (renamed from src/yuzu/applets/profile_select.h)0
-rw-r--r--src/yuzu/applets/qt_software_keyboard.cpp (renamed from src/yuzu/applets/software_keyboard.cpp)4
-rw-r--r--src/yuzu/applets/qt_software_keyboard.h (renamed from src/yuzu/applets/software_keyboard.h)0
-rw-r--r--src/yuzu/applets/qt_software_keyboard.ui (renamed from src/yuzu/applets/software_keyboard.ui)0
-rw-r--r--src/yuzu/applets/qt_web_browser.cpp (renamed from src/yuzu/applets/web_browser.cpp)4
-rw-r--r--src/yuzu/applets/qt_web_browser.h (renamed from src/yuzu/applets/web_browser.h)0
-rw-r--r--src/yuzu/applets/qt_web_browser_scripts.h (renamed from src/yuzu/applets/web_browser_scripts.h)0
-rw-r--r--src/yuzu/bootmanager.cpp15
-rw-r--r--src/yuzu/configuration/config.cpp25
-rw-r--r--src/yuzu/configuration/configure_audio.cpp13
-rw-r--r--src/yuzu/configuration/configure_graphics.cpp18
-rw-r--r--src/yuzu/configuration/configure_input_advanced.ui15
-rw-r--r--src/yuzu/game_list.cpp8
-rw-r--r--src/yuzu/game_list.h5
-rw-r--r--src/yuzu/game_list_worker.cpp44
-rw-r--r--src/yuzu/main.cpp33
-rw-r--r--src/yuzu/main.h6
-rw-r--r--src/yuzu_cmd/CMakeLists.txt5
-rw-r--r--src/yuzu_cmd/config.cpp30
-rw-r--r--src/yuzu_cmd/default_ini.h146
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2.cpp8
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp8
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp28
123 files changed, 661 insertions, 535 deletions
diff --git a/src/audio_core/command_generator.cpp b/src/audio_core/command_generator.cpp
index b99d0fc91..45b2eef52 100644
--- a/src/audio_core/command_generator.cpp
+++ b/src/audio_core/command_generator.cpp
@@ -42,6 +42,15 @@ void ApplyMix(std::span<s32> output, std::span<const s32> input, s32 gain, s32 s
s32 ApplyMixRamp(std::span<s32> output, std::span<const s32> input, float gain, float delta,
s32 sample_count) {
+ // XC2 passes in NaN mix volumes, causing further issues as we handle everything as s32 rather
+ // than float, so the NaN propogation is lost. As the samples get further modified for
+ // volume etc, they can get out of NaN range, so a later heuristic for catching this is
+ // more difficult. Handle it here by setting these samples to silence.
+ if (std::isnan(gain)) {
+ gain = 0.0f;
+ delta = 0.0f;
+ }
+
s32 x = 0;
for (s32 i = 0; i < sample_count; i++) {
x = static_cast<s32>(static_cast<float>(input[i]) * gain);
diff --git a/src/common/settings.cpp b/src/common/settings.cpp
index e1973af85..bf5514386 100644
--- a/src/common/settings.cpp
+++ b/src/common/settings.cpp
@@ -103,7 +103,7 @@ float Volume() {
if (values.audio_muted) {
return 0.0f;
}
- return values.volume.GetValue();
+ return values.volume.GetValue() / 100.0f;
}
void RestoreGlobalState(bool is_powered_on) {
diff --git a/src/common/settings.h b/src/common/settings.h
index 71d0f864f..ce1bc647d 100644
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -278,7 +278,7 @@ struct Values {
BasicSetting<std::string> sink_id{"auto", "output_engine"};
BasicSetting<bool> audio_muted{false, "audio_muted"};
Setting<bool> enable_audio_stretching{true, "enable_audio_stretching"};
- Setting<float> volume{1.0f, "volume"};
+ Setting<u8> volume{100, "volume"};
// Core
Setting<bool> use_multi_core{true, "use_multi_core"};
@@ -336,9 +336,9 @@ struct Values {
Setting<bool> use_fast_gpu_time{true, "use_fast_gpu_time"};
Setting<bool> use_caches_gc{false, "use_caches_gc"};
- Setting<float> bg_red{0.0f, "bg_red"};
- Setting<float> bg_green{0.0f, "bg_green"};
- Setting<float> bg_blue{0.0f, "bg_blue"};
+ Setting<u8> bg_red{0, "bg_red"};
+ Setting<u8> bg_green{0, "bg_green"};
+ Setting<u8> bg_blue{0, "bg_blue"};
// System
Setting<std::optional<u32>> rng_seed{std::optional<u32>(), "rng_seed"};
@@ -368,7 +368,7 @@ struct Values {
"udp_input_servers"};
BasicSetting<bool> mouse_panning{false, "mouse_panning"};
- BasicSetting<float> mouse_panning_sensitivity{1.0f, "mouse_panning_sensitivity"};
+ BasicSetting<u8> mouse_panning_sensitivity{10, "mouse_panning_sensitivity"};
BasicSetting<bool> mouse_enabled{false, "mouse_enabled"};
std::string mouse_device;
MouseButtonsRaw mouse_buttons;
diff --git a/src/common/uuid.h b/src/common/uuid.h
index 2e7a18405..0ffa37e7c 100644
--- a/src/common/uuid.h
+++ b/src/common/uuid.h
@@ -20,12 +20,11 @@ struct UUID {
constexpr explicit UUID(const u64 lo, const u64 hi) : uuid{{lo, hi}} {}
[[nodiscard]] constexpr explicit operator bool() const {
- return uuid[0] != INVALID_UUID[0] && uuid[1] != INVALID_UUID[1];
+ return uuid != INVALID_UUID;
}
[[nodiscard]] constexpr bool operator==(const UUID& rhs) const {
- // TODO(DarkLordZach): Replace with uuid == rhs.uuid with C++20
- return uuid[0] == rhs.uuid[0] && uuid[1] == rhs.uuid[1];
+ return uuid == rhs.uuid;
}
[[nodiscard]] constexpr bool operator!=(const UUID& rhs) const {
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index b2b0dbe05..c7b899131 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -272,22 +272,22 @@ add_library(core STATIC
hle/service/am/applet_ae.h
hle/service/am/applet_oe.cpp
hle/service/am/applet_oe.h
+ hle/service/am/applets/applet_controller.cpp
+ hle/service/am/applets/applet_controller.h
+ hle/service/am/applets/applet_error.cpp
+ hle/service/am/applets/applet_error.h
+ hle/service/am/applets/applet_general_backend.cpp
+ hle/service/am/applets/applet_general_backend.h
+ hle/service/am/applets/applet_profile_select.cpp
+ hle/service/am/applets/applet_profile_select.h
+ hle/service/am/applets/applet_software_keyboard.cpp
+ hle/service/am/applets/applet_software_keyboard.h
+ hle/service/am/applets/applet_software_keyboard_types.h
+ hle/service/am/applets/applet_web_browser.cpp
+ hle/service/am/applets/applet_web_browser.h
+ hle/service/am/applets/applet_web_browser_types.h
hle/service/am/applets/applets.cpp
hle/service/am/applets/applets.h
- hle/service/am/applets/controller.cpp
- hle/service/am/applets/controller.h
- hle/service/am/applets/error.cpp
- hle/service/am/applets/error.h
- hle/service/am/applets/general_backend.cpp
- hle/service/am/applets/general_backend.h
- hle/service/am/applets/profile_select.cpp
- hle/service/am/applets/profile_select.h
- hle/service/am/applets/software_keyboard.cpp
- hle/service/am/applets/software_keyboard.h
- hle/service/am/applets/software_keyboard_types.h
- hle/service/am/applets/web_browser.cpp
- hle/service/am/applets/web_browser.h
- hle/service/am/applets/web_types.h
hle/service/am/idle.cpp
hle/service/am/idle.h
hle/service/am/omm.cpp
@@ -300,10 +300,10 @@ add_library(core STATIC
hle/service/aoc/aoc_u.h
hle/service/apm/apm.cpp
hle/service/apm/apm.h
- hle/service/apm/controller.cpp
- hle/service/apm/controller.h
- hle/service/apm/interface.cpp
- hle/service/apm/interface.h
+ hle/service/apm/apm_controller.cpp
+ hle/service/apm/apm_controller.h
+ hle/service/apm/apm_interface.cpp
+ hle/service/apm/apm_interface.h
hle/service/audio/audctl.cpp
hle/service/audio/audctl.h
hle/service/audio/auddbg.cpp
@@ -335,8 +335,8 @@ add_library(core STATIC
hle/service/bcat/backend/backend.h
hle/service/bcat/bcat.cpp
hle/service/bcat/bcat.h
- hle/service/bcat/module.cpp
- hle/service/bcat/module.h
+ hle/service/bcat/bcat_module.cpp
+ hle/service/bcat/bcat_module.h
hle/service/bpc/bpc.cpp
hle/service/bpc/bpc.h
hle/service/btdrv/btdrv.cpp
@@ -382,8 +382,8 @@ add_library(core STATIC
hle/service/friend/errors.h
hle/service/friend/friend.cpp
hle/service/friend/friend.h
- hle/service/friend/interface.cpp
- hle/service/friend/interface.h
+ hle/service/friend/friend_interface.cpp
+ hle/service/friend/friend_interface.h
hle/service/glue/arp.cpp
hle/service/glue/arp.h
hle/service/glue/bgtc.cpp
@@ -393,8 +393,8 @@ add_library(core STATIC
hle/service/glue/errors.h
hle/service/glue/glue.cpp
hle/service/glue/glue.h
- hle/service/glue/manager.cpp
- hle/service/glue/manager.h
+ hle/service/glue/glue_manager.cpp
+ hle/service/glue/glue_manager.h
hle/service/grc/grc.cpp
hle/service/grc/grc.h
hle/service/hid/hid.cpp
@@ -435,10 +435,10 @@ add_library(core STATIC
hle/service/lm/lm.h
hle/service/mig/mig.cpp
hle/service/mig/mig.h
- hle/service/mii/manager.cpp
- hle/service/mii/manager.h
hle/service/mii/mii.cpp
hle/service/mii/mii.h
+ hle/service/mii/mii_manager.cpp
+ hle/service/mii/mii_manager.h
hle/service/mii/raw_data.cpp
hle/service/mii/raw_data.h
hle/service/mii/types.h
@@ -486,11 +486,11 @@ add_library(core STATIC
hle/service/nvdrv/devices/nvhost_vic.h
hle/service/nvdrv/devices/nvmap.cpp
hle/service/nvdrv/devices/nvmap.h
- hle/service/nvdrv/interface.cpp
- hle/service/nvdrv/interface.h
hle/service/nvdrv/nvdata.h
hle/service/nvdrv/nvdrv.cpp
hle/service/nvdrv/nvdrv.h
+ hle/service/nvdrv/nvdrv_interface.cpp
+ hle/service/nvdrv/nvdrv_interface.h
hle/service/nvdrv/nvmemp.cpp
hle/service/nvdrv/nvmemp.h
hle/service/nvdrv/syncpoint_manager.cpp
@@ -503,10 +503,10 @@ add_library(core STATIC
hle/service/olsc/olsc.h
hle/service/pcie/pcie.cpp
hle/service/pcie/pcie.h
- hle/service/pctl/module.cpp
- hle/service/pctl/module.h
hle/service/pctl/pctl.cpp
hle/service/pctl/pctl.h
+ hle/service/pctl/pctl_module.cpp
+ hle/service/pctl/pctl_module.h
hle/service/pcv/pcv.cpp
hle/service/pcv/pcv.h
hle/service/pm/pm.cpp
@@ -529,10 +529,10 @@ add_library(core STATIC
hle/service/set/set_sys.h
hle/service/set/settings.cpp
hle/service/set/settings.h
- hle/service/sm/controller.cpp
- hle/service/sm/controller.h
hle/service/sm/sm.cpp
hle/service/sm/sm.h
+ hle/service/sm/sm_controller.cpp
+ hle/service/sm/sm_controller.h
hle/service/sockets/bsd.cpp
hle/service/sockets/bsd.h
hle/service/sockets/ethc.cpp
@@ -547,10 +547,10 @@ add_library(core STATIC
hle/service/sockets/sockets_translate.h
hle/service/spl/csrng.cpp
hle/service/spl/csrng.h
- hle/service/spl/module.cpp
- hle/service/spl/module.h
hle/service/spl/spl.cpp
hle/service/spl/spl.h
+ hle/service/spl/spl_module.cpp
+ hle/service/spl/spl_module.h
hle/service/spl/spl_results.h
hle/service/spl/spl_types.h
hle/service/ssl/ssl.cpp
@@ -559,8 +559,6 @@ add_library(core STATIC
hle/service/time/ephemeral_network_system_clock_context_writer.h
hle/service/time/ephemeral_network_system_clock_core.h
hle/service/time/errors.h
- hle/service/time/interface.cpp
- hle/service/time/interface.h
hle/service/time/local_system_clock_context_writer.h
hle/service/time/network_system_clock_context_writer.h
hle/service/time/standard_local_system_clock_core.h
@@ -578,6 +576,8 @@ add_library(core STATIC
hle/service/time/tick_based_steady_clock_core.h
hle/service/time/time.cpp
hle/service/time/time.h
+ hle/service/time/time_interface.cpp
+ hle/service/time/time_interface.h
hle/service/time/time_manager.cpp
hle/service/time/time_manager.h
hle/service/time/time_sharedmemory.cpp
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 891f1cb49..15226cf41 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -35,9 +35,9 @@
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/physical_core.h"
#include "core/hle/service/am/applets/applets.h"
-#include "core/hle/service/apm/controller.h"
+#include "core/hle/service/apm/apm_controller.h"
#include "core/hle/service/filesystem/filesystem.h"
-#include "core/hle/service/glue/manager.h"
+#include "core/hle/service/glue/glue_manager.h"
#include "core/hle/service/hid/hid.h"
#include "core/hle/service/service.h"
#include "core/hle/service/sm/sm.h"
@@ -216,9 +216,9 @@ struct System::Impl {
}
ResultStatus Load(System& system, Frontend::EmuWindow& emu_window, const std::string& filepath,
- std::size_t program_index) {
+ u64 program_id, std::size_t program_index) {
app_loader = Loader::GetLoader(system, GetGameFileFromPath(virtual_filesystem, filepath),
- program_index);
+ program_id, program_index);
if (!app_loader) {
LOG_CRITICAL(Core, "Failed to obtain loader for {}!", filepath);
@@ -269,11 +269,10 @@ struct System::Impl {
}
}
- u64 title_id{0};
- if (app_loader->ReadProgramId(title_id) != Loader::ResultStatus::Success) {
+ if (app_loader->ReadProgramId(program_id) != Loader::ResultStatus::Success) {
LOG_ERROR(Core, "Failed to find title id for ROM (Error {})", load_result);
}
- perf_stats = std::make_unique<PerfStats>(title_id);
+ perf_stats = std::make_unique<PerfStats>(program_id);
// Reset counters and set time origin to current frame
GetAndResetPerfStats();
perf_stats->BeginSystemFrame();
@@ -459,8 +458,8 @@ void System::Shutdown() {
}
System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath,
- std::size_t program_index) {
- return impl->Load(*this, emu_window, filepath, program_index);
+ u64 program_id, std::size_t program_index) {
+ return impl->Load(*this, emu_window, filepath, program_id, program_index);
}
bool System::IsPoweredOn() const {
diff --git a/src/core/core.h b/src/core/core.h
index 8b93ba998..b93c32e60 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -175,7 +175,7 @@ public:
* @returns ResultStatus code, indicating if the operation succeeded.
*/
[[nodiscard]] ResultStatus Load(Frontend::EmuWindow& emu_window, const std::string& filepath,
- std::size_t program_index = 0);
+ u64 program_id = 0, std::size_t program_index = 0);
/**
* Indicates if the emulated system is powered on (all subsystems initialized and able to run an
diff --git a/src/core/file_sys/card_image.cpp b/src/core/file_sys/card_image.cpp
index db2f6a955..755d3303e 100644
--- a/src/core/file_sys/card_image.cpp
+++ b/src/core/file_sys/card_image.cpp
@@ -29,7 +29,7 @@ constexpr std::array partition_names{
"logo",
};
-XCI::XCI(VirtualFile file_, std::size_t program_index)
+XCI::XCI(VirtualFile file_, u64 program_id, size_t program_index)
: file(std::move(file_)), program_nca_status{Loader::ResultStatus::ErrorXCIMissingProgramNCA},
partitions(partition_names.size()),
partitions_raw(partition_names.size()), keys{Core::Crypto::KeyManager::Instance()} {
@@ -63,12 +63,12 @@ XCI::XCI(VirtualFile file_, std::size_t program_index)
secure_partition = std::make_shared<NSP>(
main_hfs.GetFile(partition_names[static_cast<std::size_t>(XCIPartition::Secure)]),
- program_index);
+ program_id, program_index);
ncas = secure_partition->GetNCAsCollapsed();
program =
secure_partition->GetNCA(secure_partition->GetProgramTitleID(), ContentRecordType::Program);
- program_nca_status = secure_partition->GetProgramStatus(secure_partition->GetProgramTitleID());
+ program_nca_status = secure_partition->GetProgramStatus();
if (program_nca_status == Loader::ResultStatus::ErrorNSPMissingProgramNCA) {
program_nca_status = Loader::ResultStatus::ErrorXCIMissingProgramNCA;
}
@@ -174,6 +174,10 @@ u64 XCI::GetProgramTitleID() const {
return secure_partition->GetProgramTitleID();
}
+std::vector<u64> XCI::GetProgramTitleIDs() const {
+ return secure_partition->GetProgramTitleIDs();
+}
+
u32 XCI::GetSystemUpdateVersion() {
const auto update = GetPartition(XCIPartition::Update);
if (update == nullptr) {
@@ -229,9 +233,11 @@ const std::vector<std::shared_ptr<NCA>>& XCI::GetNCAs() const {
}
std::shared_ptr<NCA> XCI::GetNCAByType(NCAContentType type) const {
- const auto iter =
- std::find_if(ncas.begin(), ncas.end(),
- [type](const std::shared_ptr<NCA>& nca) { return nca->GetType() == type; });
+ const auto program_id = secure_partition->GetProgramTitleID();
+ const auto iter = std::find_if(
+ ncas.begin(), ncas.end(), [this, type, program_id](const std::shared_ptr<NCA>& nca) {
+ return nca->GetType() == type && nca->GetTitleId() == program_id;
+ });
return iter == ncas.end() ? nullptr : *iter;
}
diff --git a/src/core/file_sys/card_image.h b/src/core/file_sys/card_image.h
index 4960e90fe..0fd9fa87c 100644
--- a/src/core/file_sys/card_image.h
+++ b/src/core/file_sys/card_image.h
@@ -78,7 +78,7 @@ enum class XCIPartition : u8 { Update, Normal, Secure, Logo };
class XCI : public ReadOnlyVfsDirectory {
public:
- explicit XCI(VirtualFile file, std::size_t program_index = 0);
+ explicit XCI(VirtualFile file, u64 program_id = 0, size_t program_index = 0);
~XCI() override;
Loader::ResultStatus GetStatus() const;
@@ -104,6 +104,7 @@ public:
VirtualFile GetLogoPartitionRaw() const;
u64 GetProgramTitleID() const;
+ std::vector<u64> GetProgramTitleIDs() const;
u32 GetSystemUpdateVersion();
u64 GetSystemUpdateTitleID() const;
diff --git a/src/core/file_sys/content_archive.cpp b/src/core/file_sys/content_archive.cpp
index 24eff210f..7019a7a68 100644
--- a/src/core/file_sys/content_archive.cpp
+++ b/src/core/file_sys/content_archive.cpp
@@ -5,7 +5,6 @@
#include <algorithm>
#include <cstring>
#include <optional>
-#include <ranges>
#include <utility>
#include "common/logging/log.h"
diff --git a/src/core/file_sys/submission_package.cpp b/src/core/file_sys/submission_package.cpp
index d51d469e3..f192dffa5 100644
--- a/src/core/file_sys/submission_package.cpp
+++ b/src/core/file_sys/submission_package.cpp
@@ -20,8 +20,9 @@
namespace FileSys {
-NSP::NSP(VirtualFile file_, std::size_t program_index_)
- : file(std::move(file_)), program_index(program_index_), status{Loader::ResultStatus::Success},
+NSP::NSP(VirtualFile file_, u64 title_id_, std::size_t program_index_)
+ : file(std::move(file_)), expected_program_id(title_id_),
+ program_index(program_index_), status{Loader::ResultStatus::Success},
pfs(std::make_shared<PartitionFilesystem>(file)), keys{Core::Crypto::KeyManager::Instance()} {
if (pfs->GetStatus() != Loader::ResultStatus::Success) {
status = pfs->GetStatus();
@@ -46,60 +47,59 @@ Loader::ResultStatus NSP::GetStatus() const {
return status;
}
-Loader::ResultStatus NSP::GetProgramStatus(u64 title_id) const {
+Loader::ResultStatus NSP::GetProgramStatus() const {
if (IsExtractedType() && GetExeFS() != nullptr && FileSys::IsDirectoryExeFS(GetExeFS())) {
return Loader::ResultStatus::Success;
}
- const auto iter = program_status.find(title_id);
+ const auto iter = program_status.find(GetProgramTitleID());
if (iter == program_status.end())
return Loader::ResultStatus::ErrorNSPMissingProgramNCA;
return iter->second;
}
-u64 NSP::GetFirstTitleID() const {
- if (IsExtractedType()) {
- return GetProgramTitleID();
- }
-
- if (program_status.empty())
- return 0;
- return program_status.begin()->first;
-}
-
u64 NSP::GetProgramTitleID() const {
if (IsExtractedType()) {
- if (GetExeFS() == nullptr || !IsDirectoryExeFS(GetExeFS())) {
- return 0;
- }
+ return GetExtractedTitleID() + program_index;
+ }
- ProgramMetadata meta;
- if (meta.Load(GetExeFS()->GetFile("main.npdm")) == Loader::ResultStatus::Success) {
- return meta.GetTitleID();
- } else {
- return 0;
+ auto program_id = expected_program_id;
+ if (program_id == 0) {
+ if (!program_status.empty()) {
+ program_id = program_status.begin()->first;
}
}
- const auto out = GetFirstTitleID();
- if ((out & 0x800) == 0)
- return out;
+ program_id = program_id + program_index;
+ if (program_status.find(program_id) != program_status.end()) {
+ return program_id;
+ }
- const auto ids = GetTitleIDs();
+ const auto ids = GetProgramTitleIDs();
const auto iter =
std::find_if(ids.begin(), ids.end(), [](u64 tid) { return (tid & 0x800) == 0; });
- return iter == ids.end() ? out : *iter;
+ return iter == ids.end() ? 0 : *iter;
+}
+
+u64 NSP::GetExtractedTitleID() const {
+ if (GetExeFS() == nullptr || !IsDirectoryExeFS(GetExeFS())) {
+ return 0;
+ }
+
+ ProgramMetadata meta;
+ if (meta.Load(GetExeFS()->GetFile("main.npdm")) == Loader::ResultStatus::Success) {
+ return meta.GetTitleID();
+ } else {
+ return 0;
+ }
}
-std::vector<u64> NSP::GetTitleIDs() const {
+std::vector<u64> NSP::GetProgramTitleIDs() const {
if (IsExtractedType()) {
- return {GetProgramTitleID()};
+ return {GetExtractedTitleID()};
}
- std::vector<u64> out;
- out.reserve(ncas.size());
- for (const auto& kv : ncas)
- out.push_back(kv.first);
+ std::vector<u64> out{program_ids.cbegin(), program_ids.cend()};
return out;
}
@@ -146,7 +146,7 @@ std::shared_ptr<NCA> NSP::GetNCA(u64 title_id, ContentRecordType type, TitleType
if (extracted)
LOG_WARNING(Service_FS, "called on an NSP that is of type extracted.");
- const auto title_id_iter = ncas.find(title_id + program_index);
+ const auto title_id_iter = ncas.find(title_id);
if (title_id_iter == ncas.end())
return nullptr;
@@ -160,7 +160,7 @@ std::shared_ptr<NCA> NSP::GetNCA(u64 title_id, ContentRecordType type, TitleType
VirtualFile NSP::GetNCAFile(u64 title_id, ContentRecordType type, TitleType title_type) const {
if (extracted)
LOG_WARNING(Service_FS, "called on an NSP that is of type extracted.");
- const auto nca = GetNCA(title_id, type);
+ const auto nca = GetNCA(title_id, type, title_type);
if (nca != nullptr)
return nca->GetBaseFile();
return nullptr;
@@ -286,6 +286,7 @@ void NSP::ReadNCAs(const std::vector<VirtualFile>& files) {
if (next_nca->GetType() == NCAContentType::Program) {
program_status[next_nca->GetTitleId()] = next_nca->GetStatus();
+ program_ids.insert(next_nca->GetTitleId() & 0xFFFFFFFFFFFFF000);
}
if (next_nca->GetStatus() != Loader::ResultStatus::Success &&
diff --git a/src/core/file_sys/submission_package.h b/src/core/file_sys/submission_package.h
index ecb3b6f15..030f36c09 100644
--- a/src/core/file_sys/submission_package.h
+++ b/src/core/file_sys/submission_package.h
@@ -6,6 +6,7 @@
#include <map>
#include <memory>
+#include <set>
#include <vector>
#include "common/common_types.h"
#include "core/file_sys/vfs.h"
@@ -27,15 +28,15 @@ enum class ContentRecordType : u8;
class NSP : public ReadOnlyVfsDirectory {
public:
- explicit NSP(VirtualFile file_, std::size_t program_index_ = 0);
+ explicit NSP(VirtualFile file_, u64 title_id = 0, std::size_t program_index_ = 0);
~NSP() override;
Loader::ResultStatus GetStatus() const;
- Loader::ResultStatus GetProgramStatus(u64 title_id) const;
+ Loader::ResultStatus GetProgramStatus() const;
// Should only be used when one title id can be assured.
- u64 GetFirstTitleID() const;
u64 GetProgramTitleID() const;
- std::vector<u64> GetTitleIDs() const;
+ u64 GetExtractedTitleID() const;
+ std::vector<u64> GetProgramTitleIDs() const;
bool IsExtractedType() const;
@@ -69,6 +70,7 @@ private:
VirtualFile file;
+ const u64 expected_program_id;
const std::size_t program_index;
bool extracted = false;
@@ -78,6 +80,7 @@ private:
std::shared_ptr<PartitionFilesystem> pfs;
// Map title id -> {map type -> NCA}
std::map<u64, std::map<std::pair<TitleType, ContentRecordType>, std::shared_ptr<NCA>>> ncas;
+ std::set<u64> program_ids;
std::vector<VirtualFile> ticket_files;
Core::Crypto::KeyManager& keys;
diff --git a/src/core/frontend/applets/software_keyboard.h b/src/core/frontend/applets/software_keyboard.h
index 506eb35bb..228a548d4 100644
--- a/src/core/frontend/applets/software_keyboard.h
+++ b/src/core/frontend/applets/software_keyboard.h
@@ -9,7 +9,7 @@
#include "common/common_types.h"
-#include "core/hle/service/am/applets/software_keyboard_types.h"
+#include "core/hle/service/am/applets/applet_software_keyboard_types.h"
namespace Core::Frontend {
diff --git a/src/core/frontend/applets/web_browser.h b/src/core/frontend/applets/web_browser.h
index d7bd44c27..915dde677 100644
--- a/src/core/frontend/applets/web_browser.h
+++ b/src/core/frontend/applets/web_browser.h
@@ -7,7 +7,7 @@
#include <functional>
#include <string_view>
-#include "core/hle/service/am/applets/web_types.h"
+#include "core/hle/service/am/applets/applet_web_browser_types.h"
namespace Core::Frontend {
diff --git a/src/core/hardware_interrupt_manager.cpp b/src/core/hardware_interrupt_manager.cpp
index 645f26e91..290db505e 100644
--- a/src/core/hardware_interrupt_manager.cpp
+++ b/src/core/hardware_interrupt_manager.cpp
@@ -5,7 +5,7 @@
#include "core/core.h"
#include "core/core_timing.h"
#include "core/hardware_interrupt_manager.h"
-#include "core/hle/service/nvdrv/interface.h"
+#include "core/hle/service/nvdrv/nvdrv_interface.h"
#include "core/hle/service/sm/sm.h"
namespace Core::Hardware {
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp
index d1c1fb71d..2e969f2a8 100644
--- a/src/core/hle/service/acc/acc.cpp
+++ b/src/core/hle/service/acc/acc.cpp
@@ -26,7 +26,7 @@
#include "core/hle/service/acc/errors.h"
#include "core/hle/service/acc/profile_manager.h"
#include "core/hle/service/glue/arp.h"
-#include "core/hle/service/glue/manager.h"
+#include "core/hle/service/glue/glue_manager.h"
#include "core/hle/service/sm/sm.h"
#include "core/loader/loader.h"
diff --git a/src/core/hle/service/acc/acc.h b/src/core/hle/service/acc/acc.h
index 0e3ad8ec6..a83a480cd 100644
--- a/src/core/hle/service/acc/acc.h
+++ b/src/core/hle/service/acc/acc.h
@@ -5,7 +5,7 @@
#pragma once
#include "common/uuid.h"
-#include "core/hle/service/glue/manager.h"
+#include "core/hle/service/glue/glue_manager.h"
#include "core/hle/service/service.h"
namespace Service::Account {
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index 23ebc1138..a538f82e3 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -24,16 +24,16 @@
#include "core/hle/service/am/am.h"
#include "core/hle/service/am/applet_ae.h"
#include "core/hle/service/am/applet_oe.h"
+#include "core/hle/service/am/applets/applet_profile_select.h"
+#include "core/hle/service/am/applets/applet_software_keyboard.h"
+#include "core/hle/service/am/applets/applet_web_browser.h"
#include "core/hle/service/am/applets/applets.h"
-#include "core/hle/service/am/applets/profile_select.h"
-#include "core/hle/service/am/applets/software_keyboard.h"
-#include "core/hle/service/am/applets/web_browser.h"
#include "core/hle/service/am/idle.h"
#include "core/hle/service/am/omm.h"
#include "core/hle/service/am/spsm.h"
#include "core/hle/service/am/tcap.h"
-#include "core/hle/service/apm/controller.h"
-#include "core/hle/service/apm/interface.h"
+#include "core/hle/service/apm/apm_controller.h"
+#include "core/hle/service/apm/apm_interface.h"
#include "core/hle/service/bcat/backend/backend.h"
#include "core/hle/service/filesystem/filesystem.h"
#include "core/hle/service/ns/ns.h"
diff --git a/src/core/hle/service/am/applets/controller.cpp b/src/core/hle/service/am/applets/applet_controller.cpp
index 218c8d1e4..12682effe 100644
--- a/src/core/hle/service/am/applets/controller.cpp
+++ b/src/core/hle/service/am/applets/applet_controller.cpp
@@ -12,7 +12,7 @@
#include "core/frontend/applets/controller.h"
#include "core/hle/result.h"
#include "core/hle/service/am/am.h"
-#include "core/hle/service/am/applets/controller.h"
+#include "core/hle/service/am/applets/applet_controller.h"
#include "core/hle/service/hid/controllers/npad.h"
namespace Service::AM::Applets {
diff --git a/src/core/hle/service/am/applets/controller.h b/src/core/hle/service/am/applets/applet_controller.h
index 20617e91f..20617e91f 100644
--- a/src/core/hle/service/am/applets/controller.h
+++ b/src/core/hle/service/am/applets/applet_controller.h
diff --git a/src/core/hle/service/am/applets/error.cpp b/src/core/hle/service/am/applets/applet_error.cpp
index c724e5d5b..ef6854d62 100644
--- a/src/core/hle/service/am/applets/error.cpp
+++ b/src/core/hle/service/am/applets/applet_error.cpp
@@ -11,7 +11,7 @@
#include "core/frontend/applets/error.h"
#include "core/hle/kernel/k_process.h"
#include "core/hle/service/am/am.h"
-#include "core/hle/service/am/applets/error.h"
+#include "core/hle/service/am/applets/applet_error.h"
#include "core/reporter.h"
namespace Service::AM::Applets {
diff --git a/src/core/hle/service/am/applets/error.h b/src/core/hle/service/am/applets/applet_error.h
index 8aa9046a5..8aa9046a5 100644
--- a/src/core/hle/service/am/applets/error.h
+++ b/src/core/hle/service/am/applets/applet_error.h
diff --git a/src/core/hle/service/am/applets/general_backend.cpp b/src/core/hle/service/am/applets/applet_general_backend.cpp
index 9fcb9f95b..0f413f9a0 100644
--- a/src/core/hle/service/am/applets/general_backend.cpp
+++ b/src/core/hle/service/am/applets/applet_general_backend.cpp
@@ -12,7 +12,7 @@
#include "core/hle/kernel/k_process.h"
#include "core/hle/result.h"
#include "core/hle/service/am/am.h"
-#include "core/hle/service/am/applets/general_backend.h"
+#include "core/hle/service/am/applets/applet_general_backend.h"
#include "core/reporter.h"
namespace Service::AM::Applets {
diff --git a/src/core/hle/service/am/applets/general_backend.h b/src/core/hle/service/am/applets/applet_general_backend.h
index 7496ded88..7496ded88 100644
--- a/src/core/hle/service/am/applets/general_backend.h
+++ b/src/core/hle/service/am/applets/applet_general_backend.h
diff --git a/src/core/hle/service/am/applets/profile_select.cpp b/src/core/hle/service/am/applets/applet_profile_select.cpp
index 37048be26..bdc21778e 100644
--- a/src/core/hle/service/am/applets/profile_select.cpp
+++ b/src/core/hle/service/am/applets/applet_profile_select.cpp
@@ -9,7 +9,7 @@
#include "core/core.h"
#include "core/frontend/applets/profile_select.h"
#include "core/hle/service/am/am.h"
-#include "core/hle/service/am/applets/profile_select.h"
+#include "core/hle/service/am/applets/applet_profile_select.h"
namespace Service::AM::Applets {
diff --git a/src/core/hle/service/am/applets/profile_select.h b/src/core/hle/service/am/applets/applet_profile_select.h
index 8fb76e6c4..8fb76e6c4 100644
--- a/src/core/hle/service/am/applets/profile_select.h
+++ b/src/core/hle/service/am/applets/applet_profile_select.h
diff --git a/src/core/hle/service/am/applets/software_keyboard.cpp b/src/core/hle/service/am/applets/applet_software_keyboard.cpp
index 00dfe1675..7cae90609 100644
--- a/src/core/hle/service/am/applets/software_keyboard.cpp
+++ b/src/core/hle/service/am/applets/applet_software_keyboard.cpp
@@ -6,7 +6,7 @@
#include "core/core.h"
#include "core/frontend/applets/software_keyboard.h"
#include "core/hle/service/am/am.h"
-#include "core/hle/service/am/applets/software_keyboard.h"
+#include "core/hle/service/am/applets/applet_software_keyboard.h"
namespace Service::AM::Applets {
diff --git a/src/core/hle/service/am/applets/software_keyboard.h b/src/core/hle/service/am/applets/applet_software_keyboard.h
index e3fc733d0..9aef1bf11 100644
--- a/src/core/hle/service/am/applets/software_keyboard.h
+++ b/src/core/hle/service/am/applets/applet_software_keyboard.h
@@ -7,8 +7,8 @@
#include "common/common_funcs.h"
#include "common/common_types.h"
#include "core/hle/result.h"
+#include "core/hle/service/am/applets/applet_software_keyboard_types.h"
#include "core/hle/service/am/applets/applets.h"
-#include "core/hle/service/am/applets/software_keyboard_types.h"
namespace Core {
class System;
diff --git a/src/core/hle/service/am/applets/software_keyboard_types.h b/src/core/hle/service/am/applets/applet_software_keyboard_types.h
index 21aa8e800..21aa8e800 100644
--- a/src/core/hle/service/am/applets/software_keyboard_types.h
+++ b/src/core/hle/service/am/applets/applet_software_keyboard_types.h
diff --git a/src/core/hle/service/am/applets/web_browser.cpp b/src/core/hle/service/am/applets/applet_web_browser.cpp
index 3b28e829b..35f194961 100644
--- a/src/core/hle/service/am/applets/web_browser.cpp
+++ b/src/core/hle/service/am/applets/applet_web_browser.cpp
@@ -21,7 +21,7 @@
#include "core/hle/kernel/k_process.h"
#include "core/hle/result.h"
#include "core/hle/service/am/am.h"
-#include "core/hle/service/am/applets/web_browser.h"
+#include "core/hle/service/am/applets/applet_web_browser.h"
#include "core/hle/service/filesystem/filesystem.h"
#include "core/hle/service/ns/pl_u.h"
@@ -58,6 +58,16 @@ std::string GetMainURL(const std::string& url) {
return url.substr(0, index);
}
+std::string ResolveURL(const std::string& url) {
+ const auto index = url.find_first_of('%');
+
+ if (index == std::string::npos) {
+ return url;
+ }
+
+ return url.substr(0, index) + "lp1" + url.substr(index + 1);
+}
+
WebArgInputTLVMap ReadWebArgs(const std::vector<u8>& web_arg, WebArgHeader& web_arg_header) {
std::memcpy(&web_arg_header, web_arg.data(), sizeof(WebArgHeader));
@@ -407,6 +417,9 @@ void WebBrowser::InitializeShare() {}
void WebBrowser::InitializeWeb() {
external_url = ParseStringValue(GetInputTLVData(WebArgInputTLVType::InitialURL).value());
+
+ // Resolve Nintendo CDN URLs.
+ external_url = ResolveURL(external_url);
}
void WebBrowser::InitializeWifi() {}
diff --git a/src/core/hle/service/am/applets/web_browser.h b/src/core/hle/service/am/applets/applet_web_browser.h
index 9f81214b6..4f9e81b79 100644
--- a/src/core/hle/service/am/applets/web_browser.h
+++ b/src/core/hle/service/am/applets/applet_web_browser.h
@@ -11,8 +11,8 @@
#include "common/common_types.h"
#include "core/file_sys/vfs_types.h"
#include "core/hle/result.h"
+#include "core/hle/service/am/applets/applet_web_browser_types.h"
#include "core/hle/service/am/applets/applets.h"
-#include "core/hle/service/am/applets/web_types.h"
namespace Core {
class System;
diff --git a/src/core/hle/service/am/applets/web_types.h b/src/core/hle/service/am/applets/applet_web_browser_types.h
index 419c2bf79..419c2bf79 100644
--- a/src/core/hle/service/am/applets/web_types.h
+++ b/src/core/hle/service/am/applets/applet_web_browser_types.h
diff --git a/src/core/hle/service/am/applets/applets.cpp b/src/core/hle/service/am/applets/applets.cpp
index ae995df6b..2b7685d42 100644
--- a/src/core/hle/service/am/applets/applets.cpp
+++ b/src/core/hle/service/am/applets/applets.cpp
@@ -17,13 +17,13 @@
#include "core/hle/service/am/am.h"
#include "core/hle/service/am/applet_ae.h"
#include "core/hle/service/am/applet_oe.h"
+#include "core/hle/service/am/applets/applet_controller.h"
+#include "core/hle/service/am/applets/applet_error.h"
+#include "core/hle/service/am/applets/applet_general_backend.h"
+#include "core/hle/service/am/applets/applet_profile_select.h"
+#include "core/hle/service/am/applets/applet_software_keyboard.h"
+#include "core/hle/service/am/applets/applet_web_browser.h"
#include "core/hle/service/am/applets/applets.h"
-#include "core/hle/service/am/applets/controller.h"
-#include "core/hle/service/am/applets/error.h"
-#include "core/hle/service/am/applets/general_backend.h"
-#include "core/hle/service/am/applets/profile_select.h"
-#include "core/hle/service/am/applets/software_keyboard.h"
-#include "core/hle/service/am/applets/web_browser.h"
#include "core/hle/service/sm/sm.h"
namespace Service::AM::Applets {
diff --git a/src/core/hle/service/apm/apm.cpp b/src/core/hle/service/apm/apm.cpp
index 97d6619dd..f5ebfe8d6 100644
--- a/src/core/hle/service/apm/apm.cpp
+++ b/src/core/hle/service/apm/apm.cpp
@@ -5,7 +5,7 @@
#include "core/core.h"
#include "core/hle/ipc_helpers.h"
#include "core/hle/service/apm/apm.h"
-#include "core/hle/service/apm/interface.h"
+#include "core/hle/service/apm/apm_interface.h"
namespace Service::APM {
diff --git a/src/core/hle/service/apm/controller.cpp b/src/core/hle/service/apm/apm_controller.cpp
index 8bfa7c0e4..98839fe97 100644
--- a/src/core/hle/service/apm/controller.cpp
+++ b/src/core/hle/service/apm/apm_controller.cpp
@@ -9,7 +9,7 @@
#include "common/logging/log.h"
#include "common/settings.h"
#include "core/core_timing.h"
-#include "core/hle/service/apm/controller.h"
+#include "core/hle/service/apm/apm_controller.h"
namespace Service::APM {
diff --git a/src/core/hle/service/apm/controller.h b/src/core/hle/service/apm/apm_controller.h
index 8d48e0104..8d48e0104 100644
--- a/src/core/hle/service/apm/controller.h
+++ b/src/core/hle/service/apm/apm_controller.h
diff --git a/src/core/hle/service/apm/interface.cpp b/src/core/hle/service/apm/apm_interface.cpp
index d69ddd135..e58bad083 100644
--- a/src/core/hle/service/apm/interface.cpp
+++ b/src/core/hle/service/apm/apm_interface.cpp
@@ -5,8 +5,8 @@
#include "common/logging/log.h"
#include "core/hle/ipc_helpers.h"
#include "core/hle/service/apm/apm.h"
-#include "core/hle/service/apm/controller.h"
-#include "core/hle/service/apm/interface.h"
+#include "core/hle/service/apm/apm_controller.h"
+#include "core/hle/service/apm/apm_interface.h"
namespace Service::APM {
diff --git a/src/core/hle/service/apm/interface.h b/src/core/hle/service/apm/apm_interface.h
index 063ad5308..063ad5308 100644
--- a/src/core/hle/service/apm/interface.h
+++ b/src/core/hle/service/apm/apm_interface.h
diff --git a/src/core/hle/service/bcat/backend/boxcat.cpp b/src/core/hle/service/bcat/backend/boxcat.cpp
index dc15cf58b..7ca7f2aac 100644
--- a/src/core/hle/service/bcat/backend/boxcat.cpp
+++ b/src/core/hle/service/bcat/backend/boxcat.cpp
@@ -7,6 +7,9 @@
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
+#ifndef __clang__
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#endif
#endif
#include <httplib.h>
#include <mbedtls/sha256.h>
diff --git a/src/core/hle/service/bcat/bcat.h b/src/core/hle/service/bcat/bcat.h
index d72798980..1eba477da 100644
--- a/src/core/hle/service/bcat/bcat.h
+++ b/src/core/hle/service/bcat/bcat.h
@@ -4,7 +4,7 @@
#pragma once
-#include "core/hle/service/bcat/module.h"
+#include "core/hle/service/bcat/bcat_module.h"
namespace Core {
class System;
diff --git a/src/core/hle/service/bcat/module.cpp b/src/core/hle/service/bcat/bcat_module.cpp
index f85444da8..72294eb2e 100644
--- a/src/core/hle/service/bcat/module.cpp
+++ b/src/core/hle/service/bcat/bcat_module.cpp
@@ -17,7 +17,7 @@
#include "core/hle/kernel/k_writable_event.h"
#include "core/hle/service/bcat/backend/backend.h"
#include "core/hle/service/bcat/bcat.h"
-#include "core/hle/service/bcat/module.h"
+#include "core/hle/service/bcat/bcat_module.h"
#include "core/hle/service/filesystem/filesystem.h"
namespace Service::BCAT {
diff --git a/src/core/hle/service/bcat/module.h b/src/core/hle/service/bcat/bcat_module.h
index 738731c06..738731c06 100644
--- a/src/core/hle/service/bcat/module.h
+++ b/src/core/hle/service/bcat/bcat_module.h
diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp
index c5f88bce7..a3c939c0c 100644
--- a/src/core/hle/service/friend/friend.cpp
+++ b/src/core/hle/service/friend/friend.cpp
@@ -12,7 +12,7 @@
#include "core/hle/kernel/k_writable_event.h"
#include "core/hle/service/friend/errors.h"
#include "core/hle/service/friend/friend.h"
-#include "core/hle/service/friend/interface.h"
+#include "core/hle/service/friend/friend_interface.h"
namespace Service::Friend {
diff --git a/src/core/hle/service/friend/interface.cpp b/src/core/hle/service/friend/friend_interface.cpp
index 7368ccec2..9b18b2a32 100644
--- a/src/core/hle/service/friend/interface.cpp
+++ b/src/core/hle/service/friend/friend_interface.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
-#include "core/hle/service/friend/interface.h"
+#include "core/hle/service/friend/friend_interface.h"
namespace Service::Friend {
diff --git a/src/core/hle/service/friend/interface.h b/src/core/hle/service/friend/friend_interface.h
index 43d914b32..43d914b32 100644
--- a/src/core/hle/service/friend/interface.h
+++ b/src/core/hle/service/friend/friend_interface.h
diff --git a/src/core/hle/service/glue/arp.cpp b/src/core/hle/service/glue/arp.cpp
index ca25df67e..5a3b54cc1 100644
--- a/src/core/hle/service/glue/arp.cpp
+++ b/src/core/hle/service/glue/arp.cpp
@@ -13,7 +13,7 @@
#include "core/hle/kernel/kernel.h"
#include "core/hle/service/glue/arp.h"
#include "core/hle/service/glue/errors.h"
-#include "core/hle/service/glue/manager.h"
+#include "core/hle/service/glue/glue_manager.h"
#include "core/hle/service/service.h"
namespace Service::Glue {
diff --git a/src/core/hle/service/glue/manager.cpp b/src/core/hle/service/glue/glue_manager.cpp
index 9b1754cf8..aa9d48c0c 100644
--- a/src/core/hle/service/glue/manager.cpp
+++ b/src/core/hle/service/glue/glue_manager.cpp
@@ -3,7 +3,7 @@
// Refer to the license.txt file included.
#include "core/hle/service/glue/errors.h"
-#include "core/hle/service/glue/manager.h"
+#include "core/hle/service/glue/glue_manager.h"
namespace Service::Glue {
diff --git a/src/core/hle/service/glue/manager.h b/src/core/hle/service/glue/glue_manager.h
index a7f5ce3ee..a7f5ce3ee 100644
--- a/src/core/hle/service/glue/manager.h
+++ b/src/core/hle/service/glue/glue_manager.h
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp
index 1eb02aee2..6ce1360e3 100644
--- a/src/core/hle/service/hid/controllers/npad.cpp
+++ b/src/core/hle/service/hid/controllers/npad.cpp
@@ -941,6 +941,11 @@ void Controller_NPad::InitializeVibrationDevice(const DeviceHandle& vibration_de
void Controller_NPad::InitializeVibrationDeviceAtIndex(std::size_t npad_index,
std::size_t device_index) {
+ if (!Settings::values.vibration_enabled.GetValue()) {
+ vibration_devices_mounted[npad_index][device_index] = false;
+ return;
+ }
+
if (vibrations[npad_index][device_index]) {
vibration_devices_mounted[npad_index][device_index] =
vibrations[npad_index][device_index]->GetStatus() == 1;
diff --git a/src/core/hle/service/mii/mii.cpp b/src/core/hle/service/mii/mii.cpp
index bbd81a88a..9d863486a 100644
--- a/src/core/hle/service/mii/mii.cpp
+++ b/src/core/hle/service/mii/mii.cpp
@@ -7,8 +7,8 @@
#include "common/logging/log.h"
#include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/hle_ipc.h"
-#include "core/hle/service/mii/manager.h"
#include "core/hle/service/mii/mii.h"
+#include "core/hle/service/mii/mii_manager.h"
#include "core/hle/service/service.h"
#include "core/hle/service/sm/sm.h"
diff --git a/src/core/hle/service/mii/manager.cpp b/src/core/hle/service/mii/mii_manager.cpp
index 869d2763f..4fef2aea4 100644
--- a/src/core/hle/service/mii/manager.cpp
+++ b/src/core/hle/service/mii/mii_manager.cpp
@@ -10,7 +10,7 @@
#include "common/string_util.h"
#include "core/hle/service/acc/profile_manager.h"
-#include "core/hle/service/mii/manager.h"
+#include "core/hle/service/mii/mii_manager.h"
#include "core/hle/service/mii/raw_data.h"
#include "core/hle/service/mii/types.h"
diff --git a/src/core/hle/service/mii/manager.h b/src/core/hle/service/mii/mii_manager.h
index 8e048fc56..8e048fc56 100644
--- a/src/core/hle/service/mii/manager.h
+++ b/src/core/hle/service/mii/mii_manager.h
diff --git a/src/core/hle/service/mii/raw_data.h b/src/core/hle/service/mii/raw_data.h
index 0e35d69d2..a0d2b9d3a 100644
--- a/src/core/hle/service/mii/raw_data.h
+++ b/src/core/hle/service/mii/raw_data.h
@@ -7,7 +7,7 @@
#include <array>
#include "common/common_types.h"
-#include "core/hle/service/mii/manager.h"
+#include "core/hle/service/mii/mii_manager.h"
namespace Service::Mii::RawData {
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp
index 98e6296f1..1403a39d0 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp
@@ -19,26 +19,29 @@
namespace Service::Nvidia::Devices {
namespace {
-// Splice vectors will copy count amount of type T from the input vector into the dst vector.
+// Copies count amount of type T from the input vector into the dst vector.
+// Returns the number of bytes written into dst.
template <typename T>
-std::size_t SpliceVectors(const std::vector<u8>& input, std::vector<T>& dst, std::size_t count,
- std::size_t offset) {
- if (!dst.empty()) {
- std::memcpy(dst.data(), input.data() + offset, count * sizeof(T));
+std::size_t SliceVectors(const std::vector<u8>& input, std::vector<T>& dst, std::size_t count,
+ std::size_t offset) {
+ if (dst.empty()) {
+ return 0;
}
- return 0;
+ const size_t bytes_copied = count * sizeof(T);
+ std::memcpy(dst.data(), input.data() + offset, bytes_copied);
+ return bytes_copied;
}
-// Write vectors will write data to the output buffer
+// Writes the data in src to an offset into the dst vector. The offset is specified in bytes
+// Returns the number of bytes written into dst.
template <typename T>
std::size_t WriteVectors(std::vector<u8>& dst, const std::vector<T>& src, std::size_t offset) {
if (src.empty()) {
return 0;
- } else {
- std::memcpy(dst.data() + offset, src.data(), src.size() * sizeof(T));
- offset += src.size() * sizeof(T);
- return offset;
}
+ const size_t bytes_copied = src.size() * sizeof(T);
+ std::memcpy(dst.data() + offset, src.data(), bytes_copied);
+ return bytes_copied;
}
} // Anonymous namespace
@@ -62,7 +65,6 @@ NvResult nvhost_nvdec_common::Submit(const std::vector<u8>& input, std::vector<u
LOG_DEBUG(Service_NVDRV, "called NVDEC Submit, cmd_buffer_count={}", params.cmd_buffer_count);
// Instantiate param buffers
- std::size_t offset = sizeof(IoctlSubmit);
std::vector<CommandBuffer> command_buffers(params.cmd_buffer_count);
std::vector<Reloc> relocs(params.relocation_count);
std::vector<u32> reloc_shifts(params.relocation_count);
@@ -70,13 +72,14 @@ NvResult nvhost_nvdec_common::Submit(const std::vector<u8>& input, std::vector<u
std::vector<SyncptIncr> wait_checks(params.syncpoint_count);
std::vector<Fence> fences(params.fence_count);
- // Splice input into their respective buffers
- offset = SpliceVectors(input, command_buffers, params.cmd_buffer_count, offset);
- offset = SpliceVectors(input, relocs, params.relocation_count, offset);
- offset = SpliceVectors(input, reloc_shifts, params.relocation_count, offset);
- offset = SpliceVectors(input, syncpt_increments, params.syncpoint_count, offset);
- offset = SpliceVectors(input, wait_checks, params.syncpoint_count, offset);
- offset = SpliceVectors(input, fences, params.fence_count, offset);
+ // Slice input into their respective buffers
+ std::size_t offset = sizeof(IoctlSubmit);
+ offset += SliceVectors(input, command_buffers, params.cmd_buffer_count, offset);
+ offset += SliceVectors(input, relocs, params.relocation_count, offset);
+ offset += SliceVectors(input, reloc_shifts, params.relocation_count, offset);
+ offset += SliceVectors(input, syncpt_increments, params.syncpoint_count, offset);
+ offset += SliceVectors(input, wait_checks, params.syncpoint_count, offset);
+ offset += SliceVectors(input, fences, params.fence_count, offset);
auto& gpu = system.GPU();
if (gpu.UseNvdec()) {
@@ -88,35 +91,27 @@ NvResult nvhost_nvdec_common::Submit(const std::vector<u8>& input, std::vector<u
}
}
for (const auto& cmd_buffer : command_buffers) {
- auto object = nvmap_dev->GetObject(cmd_buffer.memory_id);
+ const auto object = nvmap_dev->GetObject(cmd_buffer.memory_id);
ASSERT_OR_EXECUTE(object, return NvResult::InvalidState;);
- const auto map = FindBufferMap(object->dma_map_addr);
- if (!map) {
- LOG_ERROR(Service_NVDRV, "Tried to submit an invalid offset 0x{:X} dma 0x{:X}",
- object->addr, object->dma_map_addr);
- return NvResult::Success;
- }
Tegra::ChCommandHeaderList cmdlist(cmd_buffer.word_count);
- gpu.MemoryManager().ReadBlock(map->StartAddr() + cmd_buffer.offset, cmdlist.data(),
- cmdlist.size() * sizeof(u32));
+ system.Memory().ReadBlock(object->addr + cmd_buffer.offset, cmdlist.data(),
+ cmdlist.size() * sizeof(u32));
gpu.PushCommandBuffer(cmdlist);
}
if (gpu.UseNvdec()) {
-
fences[0].value = syncpoint_manager.IncreaseSyncpoint(fences[0].id, 1);
-
Tegra::ChCommandHeaderList cmdlist{{(4 << 28) | fences[0].id}};
gpu.PushCommandBuffer(cmdlist);
}
std::memcpy(output.data(), &params, sizeof(IoctlSubmit));
// Some games expect command_buffers to be written back
offset = sizeof(IoctlSubmit);
- offset = WriteVectors(output, command_buffers, offset);
- offset = WriteVectors(output, relocs, offset);
- offset = WriteVectors(output, reloc_shifts, offset);
- offset = WriteVectors(output, syncpt_increments, offset);
- offset = WriteVectors(output, wait_checks, offset);
- offset = WriteVectors(output, fences, offset);
+ offset += WriteVectors(output, command_buffers, offset);
+ offset += WriteVectors(output, relocs, offset);
+ offset += WriteVectors(output, reloc_shifts, offset);
+ offset += WriteVectors(output, syncpt_increments, offset);
+ offset += WriteVectors(output, wait_checks, offset);
+ offset += WriteVectors(output, fences, offset);
return NvResult::Success;
}
@@ -148,14 +143,14 @@ NvResult nvhost_nvdec_common::MapBuffer(const std::vector<u8>& input, std::vecto
std::memcpy(&params, input.data(), sizeof(IoctlMapBuffer));
std::vector<MapBufferEntry> cmd_buffer_handles(params.num_entries);
- SpliceVectors(input, cmd_buffer_handles, params.num_entries, sizeof(IoctlMapBuffer));
+ SliceVectors(input, cmd_buffer_handles, params.num_entries, sizeof(IoctlMapBuffer));
auto& gpu = system.GPU();
- for (auto& cmf_buff : cmd_buffer_handles) {
- auto object{nvmap_dev->GetObject(cmf_buff.map_handle)};
+ for (auto& cmd_buffer : cmd_buffer_handles) {
+ auto object{nvmap_dev->GetObject(cmd_buffer.map_handle)};
if (!object) {
- LOG_ERROR(Service_NVDRV, "invalid cmd_buffer nvmap_handle={:X}", cmf_buff.map_handle);
+ LOG_ERROR(Service_NVDRV, "invalid cmd_buffer nvmap_handle={:X}", cmd_buffer.map_handle);
std::memcpy(output.data(), &params, output.size());
return NvResult::InvalidState;
}
@@ -170,7 +165,7 @@ NvResult nvhost_nvdec_common::MapBuffer(const std::vector<u8>& input, std::vecto
if (!object->dma_map_addr) {
LOG_ERROR(Service_NVDRV, "failed to map size={}", object->size);
} else {
- cmf_buff.map_address = object->dma_map_addr;
+ cmd_buffer.map_address = object->dma_map_addr;
AddBufferMap(object->dma_map_addr, object->size, object->addr,
object->status == nvmap::Object::Status::Allocated);
}
@@ -186,14 +181,14 @@ NvResult nvhost_nvdec_common::UnmapBuffer(const std::vector<u8>& input, std::vec
IoctlMapBuffer params{};
std::memcpy(&params, input.data(), sizeof(IoctlMapBuffer));
std::vector<MapBufferEntry> cmd_buffer_handles(params.num_entries);
- SpliceVectors(input, cmd_buffer_handles, params.num_entries, sizeof(IoctlMapBuffer));
+ SliceVectors(input, cmd_buffer_handles, params.num_entries, sizeof(IoctlMapBuffer));
auto& gpu = system.GPU();
- for (auto& cmf_buff : cmd_buffer_handles) {
- const auto object{nvmap_dev->GetObject(cmf_buff.map_handle)};
+ for (auto& cmd_buffer : cmd_buffer_handles) {
+ const auto object{nvmap_dev->GetObject(cmd_buffer.map_handle)};
if (!object) {
- LOG_ERROR(Service_NVDRV, "invalid cmd_buffer nvmap_handle={:X}", cmf_buff.map_handle);
+ LOG_ERROR(Service_NVDRV, "invalid cmd_buffer nvmap_handle={:X}", cmd_buffer.map_handle);
std::memcpy(output.data(), &params, output.size());
return NvResult::InvalidState;
}
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp
index 74796dce1..03992af5e 100644
--- a/src/core/hle/service/nvdrv/nvdrv.cpp
+++ b/src/core/hle/service/nvdrv/nvdrv.cpp
@@ -20,8 +20,8 @@
#include "core/hle/service/nvdrv/devices/nvhost_nvjpg.h"
#include "core/hle/service/nvdrv/devices/nvhost_vic.h"
#include "core/hle/service/nvdrv/devices/nvmap.h"
-#include "core/hle/service/nvdrv/interface.h"
#include "core/hle/service/nvdrv/nvdrv.h"
+#include "core/hle/service/nvdrv/nvdrv_interface.h"
#include "core/hle/service/nvdrv/nvmemp.h"
#include "core/hle/service/nvdrv/syncpoint_manager.h"
#include "core/hle/service/nvflinger/nvflinger.h"
diff --git a/src/core/hle/service/nvdrv/interface.cpp b/src/core/hle/service/nvdrv/nvdrv_interface.cpp
index e4d495000..d61fb73dc 100644
--- a/src/core/hle/service/nvdrv/interface.cpp
+++ b/src/core/hle/service/nvdrv/nvdrv_interface.cpp
@@ -10,9 +10,9 @@
#include "core/hle/kernel/k_thread.h"
#include "core/hle/kernel/k_writable_event.h"
#include "core/hle/kernel/kernel.h"
-#include "core/hle/service/nvdrv/interface.h"
#include "core/hle/service/nvdrv/nvdata.h"
#include "core/hle/service/nvdrv/nvdrv.h"
+#include "core/hle/service/nvdrv/nvdrv_interface.h"
namespace Service::Nvidia {
diff --git a/src/core/hle/service/nvdrv/interface.h b/src/core/hle/service/nvdrv/nvdrv_interface.h
index 0e764c53f..0e764c53f 100644
--- a/src/core/hle/service/nvdrv/interface.h
+++ b/src/core/hle/service/nvdrv/nvdrv_interface.h
diff --git a/src/core/hle/service/pctl/pctl.h b/src/core/hle/service/pctl/pctl.h
index ea3b97823..1d28900b2 100644
--- a/src/core/hle/service/pctl/pctl.h
+++ b/src/core/hle/service/pctl/pctl.h
@@ -4,7 +4,7 @@
#pragma once
-#include "core/hle/service/pctl/module.h"
+#include "core/hle/service/pctl/pctl_module.h"
namespace Core {
class System;
diff --git a/src/core/hle/service/pctl/module.cpp b/src/core/hle/service/pctl/pctl_module.cpp
index 1e31d05a6..6949fcf3b 100644
--- a/src/core/hle/service/pctl/module.cpp
+++ b/src/core/hle/service/pctl/pctl_module.cpp
@@ -8,8 +8,8 @@
#include "core/file_sys/patch_manager.h"
#include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/k_process.h"
-#include "core/hle/service/pctl/module.h"
#include "core/hle/service/pctl/pctl.h"
+#include "core/hle/service/pctl/pctl_module.h"
namespace Service::PCTL {
diff --git a/src/core/hle/service/pctl/module.h b/src/core/hle/service/pctl/pctl_module.h
index f25c5c557..f25c5c557 100644
--- a/src/core/hle/service/pctl/module.h
+++ b/src/core/hle/service/pctl/pctl_module.h
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 663b83cd3..e6fba88b2 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -21,7 +21,7 @@
#include "core/hle/service/aoc/aoc_u.h"
#include "core/hle/service/apm/apm.h"
#include "core/hle/service/audio/audio.h"
-#include "core/hle/service/bcat/module.h"
+#include "core/hle/service/bcat/bcat_module.h"
#include "core/hle/service/bpc/bpc.h"
#include "core/hle/service/btdrv/btdrv.h"
#include "core/hle/service/btm/btm.h"
@@ -54,7 +54,7 @@
#include "core/hle/service/nvflinger/nvflinger.h"
#include "core/hle/service/olsc/olsc.h"
#include "core/hle/service/pcie/pcie.h"
-#include "core/hle/service/pctl/module.h"
+#include "core/hle/service/pctl/pctl_module.h"
#include "core/hle/service/pcv/pcv.h"
#include "core/hle/service/pm/pm.h"
#include "core/hle/service/prepo/prepo.h"
@@ -64,7 +64,7 @@
#include "core/hle/service/set/settings.h"
#include "core/hle/service/sm/sm.h"
#include "core/hle/service/sockets/sockets.h"
-#include "core/hle/service/spl/module.h"
+#include "core/hle/service/spl/spl_module.h"
#include "core/hle/service/ssl/ssl.h"
#include "core/hle/service/time/time.h"
#include "core/hle/service/usb/usb.h"
diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp
index c7828c3bd..15034abed 100644
--- a/src/core/hle/service/sm/sm.cpp
+++ b/src/core/hle/service/sm/sm.cpp
@@ -14,8 +14,8 @@
#include "core/hle/kernel/k_server_session.h"
#include "core/hle/kernel/k_session.h"
#include "core/hle/result.h"
-#include "core/hle/service/sm/controller.h"
#include "core/hle/service/sm/sm.h"
+#include "core/hle/service/sm/sm_controller.h"
namespace Service::SM {
diff --git a/src/core/hle/service/sm/controller.cpp b/src/core/hle/service/sm/sm_controller.cpp
index 8b9418e0f..b5fbc4569 100644
--- a/src/core/hle/service/sm/controller.cpp
+++ b/src/core/hle/service/sm/sm_controller.cpp
@@ -13,7 +13,7 @@
#include "core/hle/kernel/k_server_port.h"
#include "core/hle/kernel/k_server_session.h"
#include "core/hle/kernel/k_session.h"
-#include "core/hle/service/sm/controller.h"
+#include "core/hle/service/sm/sm_controller.h"
namespace Service::SM {
diff --git a/src/core/hle/service/sm/controller.h b/src/core/hle/service/sm/sm_controller.h
index 7494f898d..7494f898d 100644
--- a/src/core/hle/service/sm/controller.h
+++ b/src/core/hle/service/sm/sm_controller.h
diff --git a/src/core/hle/service/spl/csrng.h b/src/core/hle/service/spl/csrng.h
index 5c0bd2199..0d03cc6cb 100644
--- a/src/core/hle/service/spl/csrng.h
+++ b/src/core/hle/service/spl/csrng.h
@@ -4,7 +4,7 @@
#pragma once
-#include "core/hle/service/spl/module.h"
+#include "core/hle/service/spl/spl_module.h"
namespace Core {
class System;
diff --git a/src/core/hle/service/spl/spl.h b/src/core/hle/service/spl/spl.h
index 9b35012ed..5599c0c01 100644
--- a/src/core/hle/service/spl/spl.h
+++ b/src/core/hle/service/spl/spl.h
@@ -4,7 +4,7 @@
#pragma once
-#include "core/hle/service/spl/module.h"
+#include "core/hle/service/spl/spl_module.h"
namespace Core {
class System;
diff --git a/src/core/hle/service/spl/module.cpp b/src/core/hle/service/spl/spl_module.cpp
index ebb179aa8..918633af5 100644
--- a/src/core/hle/service/spl/module.cpp
+++ b/src/core/hle/service/spl/spl_module.cpp
@@ -13,8 +13,8 @@
#include "core/hle/api_version.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/hle/service/spl/spl_module.h"
namespace Service::SPL {
diff --git a/src/core/hle/service/spl/module.h b/src/core/hle/service/spl/spl_module.h
index 61630df80..61630df80 100644
--- a/src/core/hle/service/spl/module.h
+++ b/src/core/hle/service/spl/spl_module.h
diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp
index d6f710eba..8fdd5076f 100644
--- a/src/core/hle/service/time/time.cpp
+++ b/src/core/hle/service/time/time.cpp
@@ -11,8 +11,8 @@
#include "core/hle/kernel/k_client_port.h"
#include "core/hle/kernel/k_scheduler.h"
#include "core/hle/kernel/kernel.h"
-#include "core/hle/service/time/interface.h"
#include "core/hle/service/time/time.h"
+#include "core/hle/service/time/time_interface.h"
#include "core/hle/service/time/time_sharedmemory.h"
#include "core/hle/service/time/time_zone_service.h"
diff --git a/src/core/hle/service/time/interface.cpp b/src/core/hle/service/time/time_interface.cpp
index 53a204796..bb7b6b5c1 100644
--- a/src/core/hle/service/time/interface.cpp
+++ b/src/core/hle/service/time/time_interface.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
-#include "core/hle/service/time/interface.h"
+#include "core/hle/service/time/time_interface.h"
namespace Service::Time {
diff --git a/src/core/hle/service/time/interface.h b/src/core/hle/service/time/time_interface.h
index c41766f1a..c41766f1a 100644
--- a/src/core/hle/service/time/interface.h
+++ b/src/core/hle/service/time/time_interface.h
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp
index 228dc6389..199e69e89 100644
--- a/src/core/loader/loader.cpp
+++ b/src/core/loader/loader.cpp
@@ -206,7 +206,8 @@ AppLoader::~AppLoader() = default;
* @return std::unique_ptr<AppLoader> a pointer to a loader object; nullptr for unsupported type
*/
static std::unique_ptr<AppLoader> GetFileLoader(Core::System& system, FileSys::VirtualFile file,
- FileType type, std::size_t program_index) {
+ FileType type, u64 program_id,
+ std::size_t program_index) {
switch (type) {
// Standard ELF file format.
case FileType::ELF:
@@ -227,7 +228,8 @@ static std::unique_ptr<AppLoader> GetFileLoader(Core::System& system, FileSys::V
// NX XCI (nX Card Image) file format.
case FileType::XCI:
return std::make_unique<AppLoader_XCI>(std::move(file), system.GetFileSystemController(),
- system.GetContentProvider(), program_index);
+ system.GetContentProvider(), program_id,
+ program_index);
// NX NAX (NintendoAesXts) file format.
case FileType::NAX:
@@ -236,7 +238,8 @@ static std::unique_ptr<AppLoader> GetFileLoader(Core::System& system, FileSys::V
// NX NSP (Nintendo Submission Package) file format
case FileType::NSP:
return std::make_unique<AppLoader_NSP>(std::move(file), system.GetFileSystemController(),
- system.GetContentProvider(), program_index);
+ system.GetContentProvider(), program_id,
+ program_index);
// NX KIP (Kernel Internal Process) file format
case FileType::KIP:
@@ -252,7 +255,7 @@ static std::unique_ptr<AppLoader> GetFileLoader(Core::System& system, FileSys::V
}
std::unique_ptr<AppLoader> GetLoader(Core::System& system, FileSys::VirtualFile file,
- std::size_t program_index) {
+ u64 program_id, std::size_t program_index) {
FileType type = IdentifyFile(file);
const FileType filename_type = GuessFromFilename(file->GetName());
@@ -266,7 +269,7 @@ std::unique_ptr<AppLoader> GetLoader(Core::System& system, FileSys::VirtualFile
LOG_DEBUG(Loader, "Loading file {} as {}...", file->GetName(), GetFileTypeString(type));
- return GetFileLoader(system, std::move(file), type, program_index);
+ return GetFileLoader(system, std::move(file), type, program_id, program_index);
}
} // namespace Loader
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h
index edc8bb257..7b1bac3f7 100644
--- a/src/core/loader/loader.h
+++ b/src/core/loader/loader.h
@@ -227,6 +227,17 @@ public:
}
/**
+ * Get the program ids of the application
+ *
+ * @param[out] out_program_ids Reference to store program ids into
+ *
+ * @return ResultStatus result of function
+ */
+ virtual ResultStatus ReadProgramIds(std::vector<u64>& out_program_ids) {
+ return ResultStatus::ErrorNotImplemented;
+ }
+
+ /**
* Get the RomFS of the application
* Since the RomFS can be huge, we return a file reference instead of copying to a buffer
*
@@ -324,6 +335,6 @@ protected:
* @return the best loader for this file.
*/
std::unique_ptr<AppLoader> GetLoader(Core::System& system, FileSys::VirtualFile file,
- std::size_t program_index = 0);
+ u64 program_id = 0, std::size_t program_index = 0);
} // namespace Loader
diff --git a/src/core/loader/nsp.cpp b/src/core/loader/nsp.cpp
index d815a7cd3..8b167ad3c 100644
--- a/src/core/loader/nsp.cpp
+++ b/src/core/loader/nsp.cpp
@@ -23,10 +23,9 @@ namespace Loader {
AppLoader_NSP::AppLoader_NSP(FileSys::VirtualFile file_,
const Service::FileSystem::FileSystemController& fsc,
- const FileSys::ContentProvider& content_provider,
+ const FileSys::ContentProvider& content_provider, u64 program_id,
std::size_t program_index)
- : AppLoader(file_), nsp(std::make_unique<FileSys::NSP>(file_, program_index)),
- title_id(nsp->GetProgramTitleID()) {
+ : AppLoader(file_), nsp(std::make_unique<FileSys::NSP>(file_, program_id, program_index)) {
if (nsp->GetStatus() != ResultStatus::Success) {
return;
@@ -46,12 +45,8 @@ AppLoader_NSP::AppLoader_NSP(FileSys::VirtualFile file_,
return pm.ParseControlNCA(*control_nca);
}();
- if (title_id == 0) {
- return;
- }
-
secondary_loader = std::make_unique<AppLoader_NCA>(
- nsp->GetNCAFile(title_id, FileSys::ContentRecordType::Program));
+ nsp->GetNCAFile(nsp->GetProgramTitleID(), FileSys::ContentRecordType::Program));
}
}
@@ -68,10 +63,11 @@ FileType AppLoader_NSP::IdentifyType(const FileSys::VirtualFile& nsp_file) {
}
// Non-Extracted Type case
+ const auto program_id = nsp.GetProgramTitleID();
if (!nsp.IsExtractedType() &&
- nsp.GetNCA(nsp.GetFirstTitleID(), FileSys::ContentRecordType::Program) != nullptr &&
- AppLoader_NCA::IdentifyType(nsp.GetNCAFile(
- nsp.GetFirstTitleID(), FileSys::ContentRecordType::Program)) == FileType::NCA) {
+ nsp.GetNCA(program_id, FileSys::ContentRecordType::Program) != nullptr &&
+ AppLoader_NCA::IdentifyType(
+ nsp.GetNCAFile(program_id, FileSys::ContentRecordType::Program)) == FileType::NCA) {
return FileType::NSP;
}
}
@@ -84,6 +80,8 @@ AppLoader_NSP::LoadResult AppLoader_NSP::Load(Kernel::KProcess& process, Core::S
return {ResultStatus::ErrorAlreadyLoaded, {}};
}
+ const auto title_id = nsp->GetProgramTitleID();
+
if (!nsp->IsExtractedType() && title_id == 0) {
return {ResultStatus::ErrorNSPMissingProgramNCA, {}};
}
@@ -93,7 +91,7 @@ AppLoader_NSP::LoadResult AppLoader_NSP::Load(Kernel::KProcess& process, Core::S
return {nsp_status, {}};
}
- const auto nsp_program_status = nsp->GetProgramStatus(title_id);
+ const auto nsp_program_status = nsp->GetProgramStatus();
if (nsp_program_status != ResultStatus::Success) {
return {nsp_program_status, {}};
}
@@ -134,8 +132,8 @@ ResultStatus AppLoader_NSP::ReadUpdateRaw(FileSys::VirtualFile& out_file) {
return ResultStatus::ErrorNoPackedUpdate;
}
- const auto read =
- nsp->GetNCAFile(FileSys::GetUpdateTitleID(title_id), FileSys::ContentRecordType::Program);
+ const auto read = nsp->GetNCAFile(FileSys::GetUpdateTitleID(nsp->GetProgramTitleID()),
+ FileSys::ContentRecordType::Program);
if (read == nullptr) {
return ResultStatus::ErrorNoPackedUpdate;
@@ -151,11 +149,15 @@ ResultStatus AppLoader_NSP::ReadUpdateRaw(FileSys::VirtualFile& out_file) {
}
ResultStatus AppLoader_NSP::ReadProgramId(u64& out_program_id) {
- if (title_id == 0) {
+ out_program_id = nsp->GetProgramTitleID();
+ if (out_program_id == 0) {
return ResultStatus::ErrorNotInitialized;
}
+ return ResultStatus::Success;
+}
- out_program_id = title_id;
+ResultStatus AppLoader_NSP::ReadProgramIds(std::vector<u64>& out_program_ids) {
+ out_program_ids = nsp->GetProgramTitleIDs();
return ResultStatus::Success;
}
diff --git a/src/core/loader/nsp.h b/src/core/loader/nsp.h
index 644c0ff58..50406a92e 100644
--- a/src/core/loader/nsp.h
+++ b/src/core/loader/nsp.h
@@ -28,7 +28,7 @@ class AppLoader_NSP final : public AppLoader {
public:
explicit AppLoader_NSP(FileSys::VirtualFile file_,
const Service::FileSystem::FileSystemController& fsc,
- const FileSys::ContentProvider& content_provider,
+ const FileSys::ContentProvider& content_provider, u64 program_id,
std::size_t program_index);
~AppLoader_NSP() override;
@@ -51,6 +51,7 @@ public:
u64 ReadRomFSIVFCOffset() const override;
ResultStatus ReadUpdateRaw(FileSys::VirtualFile& out_file) override;
ResultStatus ReadProgramId(u64& out_program_id) override;
+ ResultStatus ReadProgramIds(std::vector<u64>& out_program_ids) override;
ResultStatus ReadIcon(std::vector<u8>& buffer) override;
ResultStatus ReadTitle(std::string& title) override;
ResultStatus ReadControlData(FileSys::NACP& nacp) override;
@@ -67,7 +68,6 @@ private:
FileSys::VirtualFile icon_file;
std::unique_ptr<FileSys::NACP> nacp_file;
- u64 title_id;
};
} // namespace Loader
diff --git a/src/core/loader/xci.cpp b/src/core/loader/xci.cpp
index 635d6ae15..269603eef 100644
--- a/src/core/loader/xci.cpp
+++ b/src/core/loader/xci.cpp
@@ -22,9 +22,9 @@ namespace Loader {
AppLoader_XCI::AppLoader_XCI(FileSys::VirtualFile file_,
const Service::FileSystem::FileSystemController& fsc,
- const FileSys::ContentProvider& content_provider,
+ const FileSys::ContentProvider& content_provider, u64 program_id,
std::size_t program_index)
- : AppLoader(file_), xci(std::make_unique<FileSys::XCI>(file_, program_index)),
+ : AppLoader(file_), xci(std::make_unique<FileSys::XCI>(file_, program_id, program_index)),
nca_loader(std::make_unique<AppLoader_NCA>(xci->GetProgramNCAFile())) {
if (xci->GetStatus() != ResultStatus::Success) {
return;
@@ -121,6 +121,11 @@ ResultStatus AppLoader_XCI::ReadProgramId(u64& out_program_id) {
return nca_loader->ReadProgramId(out_program_id);
}
+ResultStatus AppLoader_XCI::ReadProgramIds(std::vector<u64>& out_program_ids) {
+ out_program_ids = xci->GetProgramTitleIDs();
+ return ResultStatus::Success;
+}
+
ResultStatus AppLoader_XCI::ReadIcon(std::vector<u8>& buffer) {
if (icon_file == nullptr) {
return ResultStatus::ErrorNoControl;
@@ -149,8 +154,9 @@ ResultStatus AppLoader_XCI::ReadControlData(FileSys::NACP& control) {
}
ResultStatus AppLoader_XCI::ReadManualRomFS(FileSys::VirtualFile& out_file) {
- const auto nca = xci->GetSecurePartitionNSP()->GetNCA(xci->GetProgramTitleID(),
- FileSys::ContentRecordType::HtmlDocument);
+ const auto nca =
+ xci->GetSecurePartitionNSP()->GetNCA(xci->GetSecurePartitionNSP()->GetProgramTitleID(),
+ FileSys::ContentRecordType::HtmlDocument);
if (xci->GetStatus() != ResultStatus::Success || nca == nullptr) {
return ResultStatus::ErrorXCIMissingPartition;
}
diff --git a/src/core/loader/xci.h b/src/core/loader/xci.h
index 708155c30..30caaf90e 100644
--- a/src/core/loader/xci.h
+++ b/src/core/loader/xci.h
@@ -28,7 +28,7 @@ class AppLoader_XCI final : public AppLoader {
public:
explicit AppLoader_XCI(FileSys::VirtualFile file_,
const Service::FileSystem::FileSystemController& fsc,
- const FileSys::ContentProvider& content_provider,
+ const FileSys::ContentProvider& content_provider, u64 program_id,
std::size_t program_index);
~AppLoader_XCI() override;
@@ -51,6 +51,7 @@ public:
u64 ReadRomFSIVFCOffset() const override;
ResultStatus ReadUpdateRaw(FileSys::VirtualFile& out_file) override;
ResultStatus ReadProgramId(u64& out_program_id) override;
+ ResultStatus ReadProgramIds(std::vector<u64>& out_program_ids) override;
ResultStatus ReadIcon(std::vector<u8>& buffer) override;
ResultStatus ReadTitle(std::string& title) override;
ResultStatus ReadControlData(FileSys::NACP& control) override;
diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp
index 7399c3648..8de3d4520 100644
--- a/src/input_common/main.cpp
+++ b/src/input_common/main.cpp
@@ -294,8 +294,8 @@ void InputSubsystem::ReloadInputDevices() {
impl->udp->ReloadSockets();
}
-std::vector<std::unique_ptr<Polling::DevicePoller>> InputSubsystem::GetPollers(
- Polling::DeviceType type) const {
+std::vector<std::unique_ptr<Polling::DevicePoller>> InputSubsystem::GetPollers([
+ [maybe_unused]] Polling::DeviceType type) const {
#ifdef HAVE_SDL2
return impl->sdl->GetPollers(type);
#else
diff --git a/src/input_common/mouse/mouse_poller.cpp b/src/input_common/mouse/mouse_poller.cpp
index 45b3d7340..efcdd85d2 100644
--- a/src/input_common/mouse/mouse_poller.cpp
+++ b/src/input_common/mouse/mouse_poller.cpp
@@ -84,7 +84,7 @@ public:
std::lock_guard lock{mutex};
const auto axis_value =
static_cast<float>(mouse_input->GetMouseState(button).axis.at(axis));
- const float sensitivity = Settings::values.mouse_panning_sensitivity.GetValue();
+ const float sensitivity = Settings::values.mouse_panning_sensitivity.GetValue() * 0.10f;
return axis_value * sensitivity / (100.0f * range);
}
diff --git a/src/input_common/sdl/sdl_impl.cpp b/src/input_common/sdl/sdl_impl.cpp
index 68672a92b..1656b85fb 100644
--- a/src/input_common/sdl/sdl_impl.cpp
+++ b/src/input_common/sdl/sdl_impl.cpp
@@ -130,10 +130,10 @@ public:
if (sdl_controller) {
return SDL_GameControllerRumble(sdl_controller.get(), amp_low, amp_high,
- rumble_max_duration_ms) == 0;
+ rumble_max_duration_ms) != -1;
} else if (sdl_joystick) {
return SDL_JoystickRumble(sdl_joystick.get(), amp_low, amp_high,
- rumble_max_duration_ms) == 0;
+ rumble_max_duration_ms) != -1;
}
return false;
diff --git a/src/input_common/sdl/sdl_impl.h b/src/input_common/sdl/sdl_impl.h
index b77afcbd8..7a9ad6346 100644
--- a/src/input_common/sdl/sdl_impl.h
+++ b/src/input_common/sdl/sdl_impl.h
@@ -10,15 +10,7 @@
#include <thread>
#include <unordered_map>
-// Ignore -Wimplicit-fallthrough due to https://github.com/libsdl-org/SDL/issues/4307
-#ifdef __GNUC__
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
-#endif
#include <SDL.h>
-#ifdef __GNUC__
-#pragma GCC diagnostic pop
-#endif
#include "common/common_types.h"
#include "common/threadsafe_queue.h"
diff --git a/src/video_core/command_classes/vic.cpp b/src/video_core/command_classes/vic.cpp
index ff3db0aee..ffb7c82a1 100644
--- a/src/video_core/command_classes/vic.cpp
+++ b/src/video_core/command_classes/vic.cpp
@@ -129,28 +129,27 @@ void Vic::Execute() {
const std::size_t surface_width = config.surface_width_minus1 + 1;
const std::size_t surface_height = config.surface_height_minus1 + 1;
- const std::size_t half_width = surface_width / 2;
- const std::size_t half_height = config.surface_height_minus1 / 2;
+ const auto frame_width = std::min(surface_width, static_cast<size_t>(frame->width));
+ const auto frame_height = std::min(surface_height, static_cast<size_t>(frame->height));
+ const std::size_t half_width = frame_width / 2;
+ const std::size_t half_height = frame_height / 2;
const std::size_t aligned_width = (surface_width + 0xff) & ~0xff;
const auto* luma_ptr = frame->data[0];
const auto* chroma_b_ptr = frame->data[1];
const auto* chroma_r_ptr = frame->data[2];
- const auto stride = frame->linesize[0];
- const auto half_stride = frame->linesize[1];
+ const auto stride = static_cast<size_t>(frame->linesize[0]);
+ const auto half_stride = static_cast<size_t>(frame->linesize[1]);
luma_buffer.resize(aligned_width * surface_height);
- chroma_buffer.resize(aligned_width * half_height);
+ chroma_buffer.resize(aligned_width * surface_height / 2);
// Populate luma buffer
- for (std::size_t y = 0; y < surface_height - 1; ++y) {
+ for (std::size_t y = 0; y < frame_height; ++y) {
const std::size_t src = y * stride;
const std::size_t dst = y * aligned_width;
-
- const std::size_t size = surface_width;
-
- for (std::size_t offset = 0; offset < size; ++offset) {
- luma_buffer[dst + offset] = luma_ptr[src + offset];
+ for (std::size_t x = 0; x < frame_width; ++x) {
+ luma_buffer[dst + x] = luma_ptr[src + x];
}
}
gpu.MemoryManager().WriteBlock(output_surface_luma_address, luma_buffer.data(),
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.h b/src/video_core/renderer_opengl/gl_texture_cache.h
index 25fe61566..cf3b789e3 100644
--- a/src/video_core/renderer_opengl/gl_texture_cache.h
+++ b/src/video_core/renderer_opengl/gl_texture_cache.h
@@ -122,7 +122,7 @@ private:
bool has_broken_texture_view_formats = false;
StagingBuffers upload_buffers{GL_MAP_WRITE_BIT, GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT};
- StagingBuffers download_buffers{GL_MAP_READ_BIT, GL_MAP_READ_BIT};
+ StagingBuffers download_buffers{GL_MAP_READ_BIT | GL_CLIENT_STORAGE_BIT, GL_MAP_READ_BIT};
OGLTexture null_image_1d_array;
OGLTexture null_image_cube_array;
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index a718bff7a..c12929de6 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.cpp
+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp
@@ -229,9 +229,6 @@ void RendererOpenGL::LoadColorToActiveGLTexture(u8 color_r, u8 color_g, u8 color
}
void RendererOpenGL::InitOpenGLObjects() {
- glClearColor(Settings::values.bg_red.GetValue(), Settings::values.bg_green.GetValue(),
- Settings::values.bg_blue.GetValue(), 0.0f);
-
// Create shader programs
OGLShader vertex_shader;
vertex_shader.Create(HostShaders::OPENGL_PRESENT_VERT, GL_VERTEX_SHADER);
@@ -337,8 +334,9 @@ void RendererOpenGL::ConfigureFramebufferTexture(TextureInfo& texture,
void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) {
if (renderer_settings.set_background_color) {
// Update background color before drawing
- glClearColor(Settings::values.bg_red.GetValue(), Settings::values.bg_green.GetValue(),
- Settings::values.bg_blue.GetValue(), 0.0f);
+ glClearColor(Settings::values.bg_red.GetValue() / 255.0f,
+ Settings::values.bg_green.GetValue() / 255.0f,
+ Settings::values.bg_blue.GetValue() / 255.0f, 1.0f);
}
// Set projection matrix
diff --git a/src/video_core/renderer_vulkan/vk_blit_screen.cpp b/src/video_core/renderer_vulkan/vk_blit_screen.cpp
index a1a32aabe..363134129 100644
--- a/src/video_core/renderer_vulkan/vk_blit_screen.cpp
+++ b/src/video_core/renderer_vulkan/vk_blit_screen.cpp
@@ -225,8 +225,11 @@ VkSemaphore VKBlitScreen::Draw(const Tegra::FramebufferConfig& framebuffer, bool
descriptor_set = descriptor_sets[image_index], buffer = *buffer,
size = swapchain.GetSize(), pipeline = *pipeline,
layout = *pipeline_layout](vk::CommandBuffer cmdbuf) {
+ const f32 bg_red = Settings::values.bg_red.GetValue() / 255.0f;
+ const f32 bg_green = Settings::values.bg_green.GetValue() / 255.0f;
+ const f32 bg_blue = Settings::values.bg_blue.GetValue() / 255.0f;
const VkClearValue clear_color{
- .color = {.float32 = {0.0f, 0.0f, 0.0f, 0.0f}},
+ .color = {.float32 = {bg_red, bg_green, bg_blue, 1.0f}},
};
const VkRenderPassBeginInfo renderpass_bi{
.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO,
diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp
index 11e86174e..0def1e769 100644
--- a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp
@@ -176,8 +176,8 @@ void BufferCacheRuntime::BindIndexBuffer(PrimitiveTopology topology, IndexFormat
}
if (vk_buffer == VK_NULL_HANDLE) {
// Vulkan doesn't support null index buffers. Replace it with our own null buffer.
- ReserveNullIndexBuffer();
- vk_buffer = *null_index_buffer;
+ ReserveNullBuffer();
+ vk_buffer = *null_buffer;
}
scheduler.Record([vk_buffer, vk_offset, vk_index_type](vk::CommandBuffer cmdbuf) {
cmdbuf.BindIndexBuffer(vk_buffer, vk_offset, vk_index_type);
@@ -185,6 +185,13 @@ void BufferCacheRuntime::BindIndexBuffer(PrimitiveTopology topology, IndexFormat
}
void BufferCacheRuntime::BindQuadArrayIndexBuffer(u32 first, u32 count) {
+ if (count == 0) {
+ ReserveNullBuffer();
+ scheduler.Record([this](vk::CommandBuffer cmdbuf) {
+ cmdbuf.BindIndexBuffer(*null_buffer, 0, VK_INDEX_TYPE_UINT32);
+ });
+ return;
+ }
ReserveQuadArrayLUT(first + count, true);
// The LUT has the indices 0, 1, 2, and 3 copied as an array
@@ -219,6 +226,14 @@ void BufferCacheRuntime::BindTransformFeedbackBuffer(u32 index, VkBuffer buffer,
// Already logged in the rasterizer
return;
}
+ if (buffer == VK_NULL_HANDLE) {
+ // Vulkan doesn't support null transform feedback buffers.
+ // Replace it with our own null buffer.
+ ReserveNullBuffer();
+ buffer = *null_buffer;
+ offset = 0;
+ size = 0;
+ }
scheduler.Record([index, buffer, offset, size](vk::CommandBuffer cmdbuf) {
const VkDeviceSize vk_offset = offset;
const VkDeviceSize vk_size = size;
@@ -303,11 +318,11 @@ void BufferCacheRuntime::ReserveQuadArrayLUT(u32 num_indices, bool wait_for_idle
});
}
-void BufferCacheRuntime::ReserveNullIndexBuffer() {
- if (null_index_buffer) {
+void BufferCacheRuntime::ReserveNullBuffer() {
+ if (null_buffer) {
return;
}
- null_index_buffer = device.GetLogical().CreateBuffer(VkBufferCreateInfo{
+ null_buffer = device.GetLogical().CreateBuffer(VkBufferCreateInfo{
.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
.pNext = nullptr,
.flags = 0,
@@ -318,12 +333,12 @@ void BufferCacheRuntime::ReserveNullIndexBuffer() {
.pQueueFamilyIndices = nullptr,
});
if (device.HasDebuggingToolAttached()) {
- null_index_buffer.SetObjectNameEXT("Null index buffer");
+ null_buffer.SetObjectNameEXT("Null index buffer");
}
- null_index_buffer_commit = memory_allocator.Commit(null_index_buffer, MemoryUsage::DeviceLocal);
+ null_buffer_commit = memory_allocator.Commit(null_buffer, MemoryUsage::DeviceLocal);
scheduler.RequestOutsideRenderPassOperationContext();
- scheduler.Record([buffer = *null_index_buffer](vk::CommandBuffer cmdbuf) {
+ scheduler.Record([buffer = *null_buffer](vk::CommandBuffer cmdbuf) {
cmdbuf.FillBuffer(buffer, 0, VK_WHOLE_SIZE, 0);
});
}
diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.h b/src/video_core/renderer_vulkan/vk_buffer_cache.h
index 60d49386e..3bb81d5b3 100644
--- a/src/video_core/renderer_vulkan/vk_buffer_cache.h
+++ b/src/video_core/renderer_vulkan/vk_buffer_cache.h
@@ -94,7 +94,7 @@ private:
void ReserveQuadArrayLUT(u32 num_indices, bool wait_for_idle);
- void ReserveNullIndexBuffer();
+ void ReserveNullBuffer();
const Device& device;
MemoryAllocator& memory_allocator;
@@ -107,8 +107,8 @@ private:
VkIndexType quad_array_lut_index_type{};
u32 current_num_indices = 0;
- vk::Buffer null_index_buffer;
- MemoryCommit null_index_buffer_commit;
+ vk::Buffer null_buffer;
+ MemoryCommit null_buffer_commit;
Uint8Pass uint8_pass;
QuadIndexedPass quad_index_pass;
diff --git a/src/video_core/renderer_vulkan/vk_compute_pass.cpp b/src/video_core/renderer_vulkan/vk_compute_pass.cpp
index 205cd3b05..4181d83ee 100644
--- a/src/video_core/renderer_vulkan/vk_compute_pass.cpp
+++ b/src/video_core/renderer_vulkan/vk_compute_pass.cpp
@@ -374,20 +374,20 @@ void ASTCDecoderPass::MakeDataBuffer() {
scheduler.Record([src = staging_ref.buffer, offset = staging_ref.offset, dst = *data_buffer,
TOTAL_BUFFER_SIZE](vk::CommandBuffer cmdbuf) {
- cmdbuf.CopyBuffer(src, dst,
- VkBufferCopy{
- .srcOffset = offset,
- .dstOffset = 0,
- .size = TOTAL_BUFFER_SIZE,
- });
- cmdbuf.PipelineBarrier(
- VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0,
- VkMemoryBarrier{
- .sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER,
- .pNext = nullptr,
- .srcAccessMask = 0,
- .dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT | VK_ACCESS_TRANSFER_WRITE_BIT,
- });
+ static constexpr VkMemoryBarrier write_barrier{
+ .sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER,
+ .pNext = nullptr,
+ .srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT,
+ .dstAccessMask = VK_ACCESS_SHADER_READ_BIT,
+ };
+ const VkBufferCopy copy{
+ .srcOffset = offset,
+ .dstOffset = 0,
+ .size = TOTAL_BUFFER_SIZE,
+ };
+ cmdbuf.CopyBuffer(src, dst, copy);
+ cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
+ 0, write_barrier);
});
}
@@ -411,7 +411,7 @@ void ASTCDecoderPass::Assemble(Image& image, const StagingBufferRef& map,
const VkImageMemoryBarrier image_barrier{
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
.pNext = nullptr,
- .srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT,
+ .srcAccessMask = is_initialized ? VK_ACCESS_SHADER_WRITE_BIT : VkAccessFlags{},
.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT,
.oldLayout = is_initialized ? VK_IMAGE_LAYOUT_GENERAL : VK_IMAGE_LAYOUT_UNDEFINED,
.newLayout = VK_IMAGE_LAYOUT_GENERAL,
@@ -426,7 +426,8 @@ void ASTCDecoderPass::Assemble(Image& image, const StagingBufferRef& map,
.layerCount = VK_REMAINING_ARRAY_LAYERS,
},
};
- cmdbuf.PipelineBarrier(is_initialized ? VK_PIPELINE_STAGE_ALL_COMMANDS_BIT : 0,
+ cmdbuf.PipelineBarrier(is_initialized ? VK_PIPELINE_STAGE_ALL_COMMANDS_BIT
+ : VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, image_barrier);
cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_COMPUTE, vk_pipeline);
});
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
index fd9eed3e3..f57c15b37 100644
--- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp
+++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
@@ -357,11 +357,13 @@ void RasterizerVulkan::Clear() {
.height = std::min(clear_rect.rect.extent.height, render_area.height),
};
- if (use_color) {
+ const u32 color_attachment = regs.clear_buffers.RT;
+ const auto attachment_aspect_mask = framebuffer->ImageRanges()[color_attachment].aspectMask;
+ const bool is_color_rt = (attachment_aspect_mask & VK_IMAGE_ASPECT_COLOR_BIT) != 0;
+ if (use_color && is_color_rt) {
VkClearValue clear_value;
std::memcpy(clear_value.color.float32, regs.clear_color, sizeof(regs.clear_color));
- const u32 color_attachment = regs.clear_buffers.RT;
scheduler.Record([color_attachment, clear_value, clear_rect](vk::CommandBuffer cmdbuf) {
const VkClearAttachment attachment{
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp
index a2ab4d1ee..fd01c902c 100644
--- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp
@@ -608,7 +608,10 @@ void TextureCacheRuntime::BlitImage(Framebuffer* dst_framebuffer, ImageView& dst
const VkImageAspectFlags aspect_mask = ImageAspectMask(src.format);
const bool is_dst_msaa = dst.Samples() != VK_SAMPLE_COUNT_1_BIT;
const bool is_src_msaa = src.Samples() != VK_SAMPLE_COUNT_1_BIT;
- ASSERT(aspect_mask == ImageAspectMask(dst.format));
+ if (aspect_mask != ImageAspectMask(dst.format)) {
+ UNIMPLEMENTED_MSG("Incompatible blit from format {} to {}", src.format, dst.format);
+ return;
+ }
if (aspect_mask == VK_IMAGE_ASPECT_COLOR_BIT && !is_src_msaa && !is_dst_msaa) {
blit_image_helper.BlitColor(dst_framebuffer, src, dst_region, src_region, filter,
operation);
@@ -911,6 +914,7 @@ void Image::UploadMemory(const StagingBufferRef& map,
void Image::DownloadMemory(const StagingBufferRef& map, std::span<const BufferImageCopy> copies) {
std::vector vk_copies = TransformBufferImageCopies(copies, map.offset, aspect_mask);
+ scheduler->RequestOutsideRenderPassOperationContext();
scheduler->Record([buffer = map.buffer, image = *image, aspect_mask = aspect_mask,
vk_copies](vk::CommandBuffer cmdbuf) {
const VkImageMemoryBarrier read_barrier{
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h
index 01de2d498..85ce06d56 100644
--- a/src/video_core/texture_cache/texture_cache.h
+++ b/src/video_core/texture_cache/texture_cache.h
@@ -599,6 +599,12 @@ void TextureCache<P>::UpdateRenderTargets(bool is_clear) {
using namespace VideoCommon::Dirty;
auto& flags = maxwell3d.dirty.flags;
if (!flags[Dirty::RenderTargets]) {
+ for (size_t index = 0; index < NUM_RT; ++index) {
+ ImageViewId& color_buffer_id = render_targets.color_buffer_ids[index];
+ PrepareImageView(color_buffer_id, true, is_clear && IsFullClear(color_buffer_id));
+ }
+ const ImageViewId depth_buffer_id = render_targets.depth_buffer_id;
+ PrepareImageView(depth_buffer_id, true, is_clear && IsFullClear(depth_buffer_id));
return;
}
flags[Dirty::RenderTargets] = false;
diff --git a/src/video_core/texture_cache/util.cpp b/src/video_core/texture_cache/util.cpp
index c872517b8..59cf2f561 100644
--- a/src/video_core/texture_cache/util.cpp
+++ b/src/video_core/texture_cache/util.cpp
@@ -169,23 +169,6 @@ template <u32 GOB_EXTENT>
return Common::DivCeil(AdjustMipSize(size, level), block_size);
}
-[[nodiscard]] constexpr std::pair<int, int> Samples(int num_samples) {
- switch (num_samples) {
- case 1:
- return {1, 1};
- case 2:
- return {2, 1};
- case 4:
- return {2, 2};
- case 8:
- return {4, 2};
- case 16:
- return {4, 4};
- }
- UNREACHABLE_MSG("Invalid number of samples={}", num_samples);
- return {1, 1};
-}
-
[[nodiscard]] constexpr Extent2D DefaultBlockSize(PixelFormat format) {
return {DefaultBlockWidth(format), DefaultBlockHeight(format)};
}
@@ -283,14 +266,13 @@ template <u32 GOB_EXTENT>
}
[[nodiscard]] constexpr LevelInfo MakeLevelInfo(PixelFormat format, Extent3D size, Extent3D block,
- u32 num_samples, u32 tile_width_spacing) {
- const auto [samples_x, samples_y] = Samples(num_samples);
+ u32 tile_width_spacing) {
const u32 bytes_per_block = BytesPerBlock(format);
return {
.size =
{
- .width = size.width * samples_x,
- .height = size.height * samples_y,
+ .width = size.width,
+ .height = size.height,
.depth = size.depth,
},
.block = block,
@@ -301,14 +283,12 @@ template <u32 GOB_EXTENT>
}
[[nodiscard]] constexpr LevelInfo MakeLevelInfo(const ImageInfo& info) {
- return MakeLevelInfo(info.format, info.size, info.block, info.num_samples,
- info.tile_width_spacing);
+ return MakeLevelInfo(info.format, info.size, info.block, info.tile_width_spacing);
}
[[nodiscard]] constexpr u32 CalculateLevelOffset(PixelFormat format, Extent3D size, Extent3D block,
- u32 num_samples, u32 tile_width_spacing,
- u32 level) {
- const LevelInfo info = MakeLevelInfo(format, size, block, num_samples, tile_width_spacing);
+ u32 tile_width_spacing, u32 level) {
+ const LevelInfo info = MakeLevelInfo(format, size, block, tile_width_spacing);
u32 offset = 0;
for (u32 current_level = 0; current_level < level; ++current_level) {
offset += CalculateLevelSize(info, current_level);
@@ -645,8 +625,8 @@ u32 CalculateLayerStride(const ImageInfo& info) noexcept {
u32 CalculateLayerSize(const ImageInfo& info) noexcept {
ASSERT(info.type != ImageType::Linear);
- return CalculateLevelOffset(info.format, info.size, info.block, info.num_samples,
- info.tile_width_spacing, info.resources.levels);
+ return CalculateLevelOffset(info.format, info.size, info.block, info.tile_width_spacing,
+ info.resources.levels);
}
LevelArray CalculateMipLevelOffsets(const ImageInfo& info) noexcept {
@@ -1195,37 +1175,37 @@ static_assert(CalculateLevelSize(LevelInfo{{1920, 1080, 1}, {0, 2, 0}, {1, 1}, 2
0x7f8000);
static_assert(CalculateLevelSize(LevelInfo{{32, 32, 1}, {0, 0, 4}, {1, 1}, 4, 0}, 0) == 0x4000);
-static_assert(CalculateLevelOffset(PixelFormat::R8_SINT, {1920, 1080, 1}, {0, 2, 0}, 1, 0, 7) ==
+static_assert(CalculateLevelOffset(PixelFormat::R8_SINT, {1920, 1080, 1}, {0, 2, 0}, 0, 7) ==
0x2afc00);
-static_assert(CalculateLevelOffset(PixelFormat::ASTC_2D_12X12_UNORM, {8192, 4096, 1}, {0, 2, 0}, 1,
- 0, 12) == 0x50d200);
-
-static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 1, 0,
- 0) == 0);
-static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 1, 0,
- 1) == 0x400000);
-static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 1, 0,
- 2) == 0x500000);
-static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 1, 0,
- 3) == 0x540000);
-static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 1, 0,
- 4) == 0x550000);
-static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 1, 0,
- 5) == 0x554000);
-static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 1, 0,
- 6) == 0x555000);
-static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 1, 0,
- 7) == 0x555400);
-static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 1, 0,
- 8) == 0x555600);
-static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 1, 0,
- 9) == 0x555800);
+static_assert(CalculateLevelOffset(PixelFormat::ASTC_2D_12X12_UNORM, {8192, 4096, 1}, {0, 2, 0}, 0,
+ 12) == 0x50d200);
+
+static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 0, 0) ==
+ 0);
+static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 0, 1) ==
+ 0x400000);
+static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 0, 2) ==
+ 0x500000);
+static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 0, 3) ==
+ 0x540000);
+static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 0, 4) ==
+ 0x550000);
+static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 0, 5) ==
+ 0x554000);
+static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 0, 6) ==
+ 0x555000);
+static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 0, 7) ==
+ 0x555400);
+static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 0, 8) ==
+ 0x555600);
+static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 0, 9) ==
+ 0x555800);
constexpr u32 ValidateLayerSize(PixelFormat format, u32 width, u32 height, u32 block_height,
u32 tile_width_spacing, u32 level) {
const Extent3D size{width, height, 1};
const Extent3D block{0, block_height, 0};
- const u32 offset = CalculateLevelOffset(format, size, block, 1, tile_width_spacing, level);
+ const u32 offset = CalculateLevelOffset(format, size, block, tile_width_spacing, level);
return AlignLayerSize(offset, size, block, DefaultBlockHeight(format), tile_width_spacing);
}
diff --git a/src/web_service/web_backend.cpp b/src/web_service/web_backend.cpp
index e04f7dfc6..b1e02c57a 100644
--- a/src/web_service/web_backend.cpp
+++ b/src/web_service/web_backend.cpp
@@ -8,7 +8,17 @@
#include <string>
#include <fmt/format.h>
+
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#ifndef __clang__
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#endif
+#endif
#include <httplib.h>
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
#include "common/logging/log.h"
#include "web_service/web_backend.h"
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt
index f870b33b1..cb4bdcc7e 100644
--- a/src/yuzu/CMakeLists.txt
+++ b/src/yuzu/CMakeLists.txt
@@ -15,18 +15,19 @@ add_executable(yuzu
about_dialog.cpp
about_dialog.h
aboutdialog.ui
- applets/controller.cpp
- applets/controller.h
- applets/controller.ui
- applets/error.cpp
- applets/error.h
- applets/profile_select.cpp
- applets/profile_select.h
- applets/software_keyboard.cpp
- applets/software_keyboard.h
- applets/software_keyboard.ui
- applets/web_browser.cpp
- applets/web_browser.h
+ applets/qt_controller.cpp
+ applets/qt_controller.h
+ applets/qt_controller.ui
+ applets/qt_error.cpp
+ applets/qt_error.h
+ applets/qt_profile_select.cpp
+ applets/qt_profile_select.h
+ applets/qt_software_keyboard.cpp
+ applets/qt_software_keyboard.h
+ applets/qt_software_keyboard.ui
+ applets/qt_web_browser.cpp
+ applets/qt_web_browser.h
+ applets/qt_web_browser_scripts.h
bootmanager.cpp
bootmanager.h
compatdb.ui
diff --git a/src/yuzu/applets/controller.cpp b/src/yuzu/applets/qt_controller.cpp
index 836d90fda..97106d2cc 100644
--- a/src/yuzu/applets/controller.cpp
+++ b/src/yuzu/applets/qt_controller.cpp
@@ -12,8 +12,8 @@
#include "core/hle/service/hid/controllers/npad.h"
#include "core/hle/service/hid/hid.h"
#include "core/hle/service/sm/sm.h"
-#include "ui_controller.h"
-#include "yuzu/applets/controller.h"
+#include "ui_qt_controller.h"
+#include "yuzu/applets/qt_controller.h"
#include "yuzu/configuration/configure_input.h"
#include "yuzu/configuration/configure_input_profile_dialog.h"
#include "yuzu/configuration/configure_motion_touch.h"
diff --git a/src/yuzu/applets/controller.h b/src/yuzu/applets/qt_controller.h
index 9b57aea1a..9b57aea1a 100644
--- a/src/yuzu/applets/controller.h
+++ b/src/yuzu/applets/qt_controller.h
diff --git a/src/yuzu/applets/controller.ui b/src/yuzu/applets/qt_controller.ui
index c8cb6bcf3..c8cb6bcf3 100644
--- a/src/yuzu/applets/controller.ui
+++ b/src/yuzu/applets/qt_controller.ui
diff --git a/src/yuzu/applets/error.cpp b/src/yuzu/applets/qt_error.cpp
index 085688cd4..45cf64603 100644
--- a/src/yuzu/applets/error.cpp
+++ b/src/yuzu/applets/qt_error.cpp
@@ -4,7 +4,7 @@
#include <QDateTime>
#include "core/hle/lock.h"
-#include "yuzu/applets/error.h"
+#include "yuzu/applets/qt_error.h"
#include "yuzu/main.h"
QtErrorDisplay::QtErrorDisplay(GMainWindow& parent) {
diff --git a/src/yuzu/applets/error.h b/src/yuzu/applets/qt_error.h
index 8bd895a32..8bd895a32 100644
--- a/src/yuzu/applets/error.h
+++ b/src/yuzu/applets/qt_error.h
diff --git a/src/yuzu/applets/profile_select.cpp b/src/yuzu/applets/qt_profile_select.cpp
index 62fd1141c..a56638e21 100644
--- a/src/yuzu/applets/profile_select.cpp
+++ b/src/yuzu/applets/qt_profile_select.cpp
@@ -14,7 +14,7 @@
#include "common/string_util.h"
#include "core/constants.h"
#include "core/hle/lock.h"
-#include "yuzu/applets/profile_select.h"
+#include "yuzu/applets/qt_profile_select.h"
#include "yuzu/main.h"
namespace {
diff --git a/src/yuzu/applets/profile_select.h b/src/yuzu/applets/qt_profile_select.h
index 4e9037488..4e9037488 100644
--- a/src/yuzu/applets/profile_select.h
+++ b/src/yuzu/applets/qt_profile_select.h
diff --git a/src/yuzu/applets/software_keyboard.cpp b/src/yuzu/applets/qt_software_keyboard.cpp
index aa453a79f..848801cec 100644
--- a/src/yuzu/applets/software_keyboard.cpp
+++ b/src/yuzu/applets/qt_software_keyboard.cpp
@@ -11,8 +11,8 @@
#include "common/string_util.h"
#include "core/core.h"
#include "core/frontend/input_interpreter.h"
-#include "ui_software_keyboard.h"
-#include "yuzu/applets/software_keyboard.h"
+#include "ui_qt_software_keyboard.h"
+#include "yuzu/applets/qt_software_keyboard.h"
#include "yuzu/main.h"
#include "yuzu/util/overlay_dialog.h"
diff --git a/src/yuzu/applets/software_keyboard.h b/src/yuzu/applets/qt_software_keyboard.h
index 1a03c098c..1a03c098c 100644
--- a/src/yuzu/applets/software_keyboard.h
+++ b/src/yuzu/applets/qt_software_keyboard.h
diff --git a/src/yuzu/applets/software_keyboard.ui b/src/yuzu/applets/qt_software_keyboard.ui
index b0a1fcde9..b0a1fcde9 100644
--- a/src/yuzu/applets/software_keyboard.ui
+++ b/src/yuzu/applets/qt_software_keyboard.ui
diff --git a/src/yuzu/applets/web_browser.cpp b/src/yuzu/applets/qt_web_browser.cpp
index 34d3feb55..b112dd7b0 100644
--- a/src/yuzu/applets/web_browser.cpp
+++ b/src/yuzu/applets/qt_web_browser.cpp
@@ -17,8 +17,8 @@
#include "core/frontend/input_interpreter.h"
#include "input_common/keyboard.h"
#include "input_common/main.h"
-#include "yuzu/applets/web_browser.h"
-#include "yuzu/applets/web_browser_scripts.h"
+#include "yuzu/applets/qt_web_browser.h"
+#include "yuzu/applets/qt_web_browser_scripts.h"
#include "yuzu/main.h"
#include "yuzu/util/url_request_interceptor.h"
diff --git a/src/yuzu/applets/web_browser.h b/src/yuzu/applets/qt_web_browser.h
index 7ad07409f..7ad07409f 100644
--- a/src/yuzu/applets/web_browser.h
+++ b/src/yuzu/applets/qt_web_browser.h
diff --git a/src/yuzu/applets/web_browser_scripts.h b/src/yuzu/applets/qt_web_browser_scripts.h
index 992837a85..992837a85 100644
--- a/src/yuzu/applets/web_browser_scripts.h
+++ b/src/yuzu/applets/qt_web_browser_scripts.h
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index 7524e3c40..d72ca5acc 100644
--- a/src/yuzu/bootmanager.cpp
+++ b/src/yuzu/bootmanager.cpp
@@ -411,8 +411,9 @@ void GRenderWindow::mousePressEvent(QMouseEvent* event) {
if (event->source() == Qt::MouseEventSynthesizedBySystem) {
return;
}
-
- auto pos = event->pos();
+ // Qt sometimes returns the parent coordinates. To avoid this we read the global mouse
+ // coordinates and map them to the current render area
+ const auto pos = mapFromGlobal(QCursor::pos());
const auto [x, y] = ScaleTouch(pos);
const auto button = QtButtonToMouseButton(event->button());
input_subsystem->GetMouse()->PressButton(x, y, button);
@@ -429,7 +430,9 @@ void GRenderWindow::mouseMoveEvent(QMouseEvent* event) {
if (event->source() == Qt::MouseEventSynthesizedBySystem) {
return;
}
- auto pos = event->pos();
+ // Qt sometimes returns the parent coordinates. To avoid this we read the global mouse
+ // coordinates and map them to the current render area
+ const auto pos = mapFromGlobal(QCursor::pos());
const auto [x, y] = ScaleTouch(pos);
const int center_x = width() / 2;
const int center_y = height() / 2;
@@ -564,6 +567,12 @@ std::unique_ptr<Core::Frontend::GraphicsContext> GRenderWindow::CreateSharedCont
bool GRenderWindow::InitRenderTarget() {
ReleaseRenderTarget();
+ {
+ // Create a dummy render widget so that Qt
+ // places the render window at the correct position.
+ const RenderWidget dummy_widget{this};
+ }
+
first_frame = false;
switch (Settings::values.renderer_backend.GetValue()) {
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index 8c71ad5c1..a5e032959 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -311,16 +311,6 @@ void Config::WriteBasicSetting(const Settings::BasicSetting<std::string>& settin
qt_config->setValue(name, QString::fromStdString(value));
}
-// Explicit float definition: use a double as Qt doesn't write legible floats to config files
-template <>
-void Config::WriteBasicSetting(const Settings::BasicSetting<float>& setting) {
- const QString name = QString::fromStdString(setting.GetLabel());
- const double value = setting.GetValue();
- qt_config->setValue(name + QStringLiteral("/default"),
- setting.GetValue() == setting.GetDefault());
- qt_config->setValue(name, value);
-}
-
template <typename Type>
void Config::WriteBasicSetting(const Settings::BasicSetting<Type>& setting) {
const QString name = QString::fromStdString(setting.GetLabel());
@@ -329,21 +319,6 @@ void Config::WriteBasicSetting(const Settings::BasicSetting<Type>& setting) {
qt_config->setValue(name, value);
}
-// Explicit float definition: use a double as Qt doesn't write legible floats to config files
-template <>
-void Config::WriteGlobalSetting(const Settings::Setting<float>& setting) {
- const QString name = QString::fromStdString(setting.GetLabel());
- const double value = setting.GetValue(global);
- if (!global) {
- qt_config->setValue(name + QStringLiteral("/use_global"), setting.UsingGlobal());
- }
- if (global || !setting.UsingGlobal()) {
- qt_config->setValue(name + QStringLiteral("/default"),
- setting.GetValue(global) == setting.GetDefault());
- qt_config->setValue(name, value);
- }
-}
-
template <typename Type>
void Config::WriteGlobalSetting(const Settings::Setting<Type>& setting) {
const QString name = QString::fromStdString(setting.GetLabel());
diff --git a/src/yuzu/configuration/configure_audio.cpp b/src/yuzu/configuration/configure_audio.cpp
index 5aba1a3b2..1d84bf4ed 100644
--- a/src/yuzu/configuration/configure_audio.cpp
+++ b/src/yuzu/configuration/configure_audio.cpp
@@ -47,7 +47,8 @@ void ConfigureAudio::SetConfiguration() {
SetAudioDeviceFromDeviceID();
- ui->volume_slider->setValue(Settings::values.volume.GetValue() * ui->volume_slider->maximum());
+ const auto volume_value = static_cast<int>(Settings::values.volume.GetValue());
+ ui->volume_slider->setValue(volume_value);
ui->toggle_audio_stretching->setChecked(Settings::values.enable_audio_stretching.GetValue());
@@ -112,18 +113,16 @@ void ConfigureAudio::ApplyConfiguration() {
// Guard if during game and set to game-specific value
if (Settings::values.volume.UsingGlobal()) {
- Settings::values.volume.SetValue(
- static_cast<float>(ui->volume_slider->sliderPosition()) /
- ui->volume_slider->maximum());
+ const auto volume = static_cast<u8>(ui->volume_slider->value());
+ Settings::values.volume.SetValue(volume);
}
} else {
if (ui->volume_combo_box->currentIndex() == 0) {
Settings::values.volume.SetGlobal(true);
} else {
Settings::values.volume.SetGlobal(false);
- Settings::values.volume.SetValue(
- static_cast<float>(ui->volume_slider->sliderPosition()) /
- ui->volume_slider->maximum());
+ const auto volume = static_cast<u8>(ui->volume_slider->value());
+ Settings::values.volume.SetValue(volume);
}
}
}
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp
index 41a69d9b8..4d5b4c0e6 100644
--- a/src/yuzu/configuration/configure_graphics.cpp
+++ b/src/yuzu/configuration/configure_graphics.cpp
@@ -101,9 +101,9 @@ void ConfigureGraphics::SetConfiguration() {
ConfigurationShared::SetHighlight(ui->bg_layout, !Settings::values.bg_red.UsingGlobal());
}
- UpdateBackgroundColorButton(QColor::fromRgbF(Settings::values.bg_red.GetValue(),
- Settings::values.bg_green.GetValue(),
- Settings::values.bg_blue.GetValue()));
+ UpdateBackgroundColorButton(QColor::fromRgb(Settings::values.bg_red.GetValue(),
+ Settings::values.bg_green.GetValue(),
+ Settings::values.bg_blue.GetValue()));
UpdateDeviceComboBox();
}
@@ -132,9 +132,9 @@ void ConfigureGraphics::ApplyConfiguration() {
Settings::values.vulkan_device.SetValue(vulkan_device);
}
if (Settings::values.bg_red.UsingGlobal()) {
- Settings::values.bg_red.SetValue(static_cast<float>(bg_color.redF()));
- Settings::values.bg_green.SetValue(static_cast<float>(bg_color.greenF()));
- Settings::values.bg_blue.SetValue(static_cast<float>(bg_color.blueF()));
+ Settings::values.bg_red.SetValue(static_cast<u8>(bg_color.red()));
+ Settings::values.bg_green.SetValue(static_cast<u8>(bg_color.green()));
+ Settings::values.bg_blue.SetValue(static_cast<u8>(bg_color.blue()));
}
} else {
if (ui->api->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) {
@@ -159,9 +159,9 @@ void ConfigureGraphics::ApplyConfiguration() {
Settings::values.bg_red.SetGlobal(false);
Settings::values.bg_green.SetGlobal(false);
Settings::values.bg_blue.SetGlobal(false);
- Settings::values.bg_red.SetValue(static_cast<float>(bg_color.redF()));
- Settings::values.bg_green.SetValue(static_cast<float>(bg_color.greenF()));
- Settings::values.bg_blue.SetValue(static_cast<float>(bg_color.blueF()));
+ Settings::values.bg_red.SetValue(static_cast<u8>(bg_color.red()));
+ Settings::values.bg_green.SetValue(static_cast<u8>(bg_color.green()));
+ Settings::values.bg_blue.SetValue(static_cast<u8>(bg_color.blue()));
}
}
}
diff --git a/src/yuzu/configuration/configure_input_advanced.ui b/src/yuzu/configuration/configure_input_advanced.ui
index 173130d8d..d3ef5bd06 100644
--- a/src/yuzu/configuration/configure_input_advanced.ui
+++ b/src/yuzu/configuration/configure_input_advanced.ui
@@ -2573,27 +2573,24 @@
</widget>
</item>
<item row="2" column="2">
- <widget class="QDoubleSpinBox" name="mouse_panning_sensitivity">
+ <widget class="QSpinBox" name="mouse_panning_sensitivity">
<property name="toolTip">
<string>Mouse sensitivity</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
- <property name="decimals">
- <number>2</number>
+ <property name="suffix">
+ <string>%</string>
</property>
<property name="minimum">
- <double>0.100000000000000</double>
+ <number>1</number>
</property>
<property name="maximum">
- <double>16.000000000000000</double>
- </property>
- <property name="singleStep">
- <double>0.010000000000000</double>
+ <number>100</number>
</property>
<property name="value">
- <double>1.000000000000000</double>
+ <number>100</number>
</property>
</widget>
</item>
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index 218b4782b..76c063c97 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -404,9 +404,11 @@ void GameList::ValidateEntry(const QModelIndex& item) {
return;
}
+ const auto title_id = selected.data(GameListItemPath::ProgramIdRole).toULongLong();
+
// Users usually want to run a different game after closing one
search_field->clear();
- emit GameChosen(file_path);
+ emit GameChosen(file_path, title_id);
break;
}
case GameListItemType::AddDir:
@@ -548,10 +550,10 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, const std::stri
emit OpenFolderRequested(program_id, GameListOpenTarget::SaveData, path);
});
connect(start_game, &QAction::triggered, [this, path]() {
- emit BootGame(QString::fromStdString(path), 0, StartGameType::Normal);
+ emit BootGame(QString::fromStdString(path), 0, 0, StartGameType::Normal);
});
connect(start_game_global, &QAction::triggered, [this, path]() {
- emit BootGame(QString::fromStdString(path), 0, StartGameType::Global);
+ emit BootGame(QString::fromStdString(path), 0, 0, StartGameType::Global);
});
connect(open_mod_location, &QAction::triggered, [this, program_id, path]() {
emit OpenFolderRequested(program_id, GameListOpenTarget::ModData, path);
diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h
index 50402da51..c9a9f4654 100644
--- a/src/yuzu/game_list.h
+++ b/src/yuzu/game_list.h
@@ -88,8 +88,9 @@ public:
static const QStringList supported_file_extensions;
signals:
- void BootGame(const QString& game_path, std::size_t program_index, StartGameType type);
- void GameChosen(const QString& game_path);
+ void BootGame(const QString& game_path, u64 program_id, std::size_t program_index,
+ StartGameType type);
+ void GameChosen(const QString& game_path, const u64 title_id = 0);
void ShouldCancelWorker();
void OpenFolderRequested(u64 program_id, GameListOpenTarget target,
const std::string& game_path);
diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp
index 33cc90d5a..2d5492157 100644
--- a/src/yuzu/game_list_worker.cpp
+++ b/src/yuzu/game_list_worker.cpp
@@ -336,18 +336,44 @@ void GameListWorker::ScanFileSystem(ScanTarget target, const std::string& dir_pa
}
}
} else {
- std::vector<u8> icon;
- [[maybe_unused]] const auto res1 = loader->ReadIcon(icon);
+ std::vector<u64> program_ids;
+ loader->ReadProgramIds(program_ids);
+
+ if (res2 == Loader::ResultStatus::Success && program_ids.size() > 1 &&
+ (file_type == Loader::FileType::XCI || file_type == Loader::FileType::NSP)) {
+ for (const auto id : program_ids) {
+ loader = Loader::GetLoader(system, file, id);
+ if (!loader) {
+ continue;
+ }
+
+ std::vector<u8> icon;
+ [[maybe_unused]] const auto res1 = loader->ReadIcon(icon);
- std::string name = " ";
- [[maybe_unused]] const auto res3 = loader->ReadTitle(name);
+ std::string name = " ";
+ [[maybe_unused]] const auto res3 = loader->ReadTitle(name);
- const FileSys::PatchManager patch{program_id, system.GetFileSystemController(),
- system.GetContentProvider()};
+ const FileSys::PatchManager patch{id, system.GetFileSystemController(),
+ system.GetContentProvider()};
+
+ emit EntryReady(MakeGameListEntry(physical_name, name, icon, *loader, id,
+ compatibility_list, patch),
+ parent_dir);
+ }
+ } else {
+ std::vector<u8> icon;
+ [[maybe_unused]] const auto res1 = loader->ReadIcon(icon);
- emit EntryReady(MakeGameListEntry(physical_name, name, icon, *loader, program_id,
- compatibility_list, patch),
- parent_dir);
+ std::string name = " ";
+ [[maybe_unused]] const auto res3 = loader->ReadTitle(name);
+
+ const FileSys::PatchManager patch{program_id, system.GetFileSystemController(),
+ system.GetContentProvider()};
+
+ emit EntryReady(MakeGameListEntry(physical_name, name, icon, *loader,
+ program_id, compatibility_list, patch),
+ parent_dir);
+ }
}
} else if (is_dir) {
watch_list.append(QString::fromStdString(physical_name));
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index cb9c01154..03a909d17 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -11,11 +11,11 @@
#endif
// VFS includes must be before glad as they will conflict with Windows file api, which uses defines.
-#include "applets/controller.h"
-#include "applets/error.h"
-#include "applets/profile_select.h"
-#include "applets/software_keyboard.h"
-#include "applets/web_browser.h"
+#include "applets/qt_controller.h"
+#include "applets/qt_error.h"
+#include "applets/qt_profile_select.h"
+#include "applets/qt_software_keyboard.h"
+#include "applets/qt_web_browser.h"
#include "common/nvidia_flags.h"
#include "configuration/configure_input.h"
#include "configuration/configure_per_game.h"
@@ -1221,7 +1221,7 @@ void GMainWindow::AllowOSSleep() {
#endif
}
-bool GMainWindow::LoadROM(const QString& filename, std::size_t program_index) {
+bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t program_index) {
// Shutdown previous session if the emu thread is still active...
if (emu_thread != nullptr)
ShutdownGame();
@@ -1244,7 +1244,7 @@ bool GMainWindow::LoadROM(const QString& filename, std::size_t program_index) {
});
const Core::System::ResultStatus result{
- system.Load(*render_window, filename.toStdString(), program_index)};
+ system.Load(*render_window, filename.toStdString(), program_id, program_index)};
const auto drd_callout = (UISettings::values.callout_flags.GetValue() &
static_cast<u32>(CalloutFlag::DRDDeprecation)) == 0;
@@ -1331,7 +1331,8 @@ void GMainWindow::SelectAndSetCurrentUser() {
Settings::values.current_user = dialog.GetIndex();
}
-void GMainWindow::BootGame(const QString& filename, std::size_t program_index, StartGameType type) {
+void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t program_index,
+ StartGameType type) {
LOG_INFO(Frontend, "yuzu starting...");
StoreRecentFile(filename); // Put the filename on top of the list
@@ -1341,7 +1342,7 @@ void GMainWindow::BootGame(const QString& filename, std::size_t program_index, S
auto& system = Core::System::GetInstance();
const auto v_file = Core::GetGameFileFromPath(vfs, filename.toUtf8().constData());
- const auto loader = Loader::GetLoader(system, v_file, program_index);
+ const auto loader = Loader::GetLoader(system, v_file, program_id, program_index);
if (loader != nullptr && loader->ReadProgramId(title_id) == Loader::ResultStatus::Success &&
type == StartGameType::Normal) {
@@ -1369,7 +1370,7 @@ void GMainWindow::BootGame(const QString& filename, std::size_t program_index, S
SelectAndSetCurrentUser();
}
- if (!LoadROM(filename, program_index))
+ if (!LoadROM(filename, program_id, program_index))
return;
// Create and start the emulation thread
@@ -1431,8 +1432,10 @@ void GMainWindow::BootGame(const QString& filename, std::size_t program_index, S
std::filesystem::path{filename.toStdU16String()}.filename());
}
const bool is_64bit = system.Kernel().CurrentProcess()->Is64BitProcess();
- const auto instruction_set_suffix = is_64bit ? " (64-bit)" : " (32-bit)";
- title_name += instruction_set_suffix;
+ const auto instruction_set_suffix = is_64bit ? tr("(64-bit)") : tr("(32-bit)");
+ title_name = tr("%1 %2", "%1 is the title name. %2 indicates if the title is 64-bit or 32-bit")
+ .arg(QString::fromStdString(title_name), instruction_set_suffix)
+ .toStdString();
LOG_INFO(Frontend, "Booting game: {:016X} | {} | {}", title_id, title_name, title_version);
const auto gpu_vendor = system.GPU().Renderer().GetDeviceVendor();
UpdateWindowTitle(title_name, title_version, gpu_vendor);
@@ -1546,8 +1549,8 @@ void GMainWindow::UpdateRecentFiles() {
ui.menu_recent_files->setEnabled(num_recent_files != 0);
}
-void GMainWindow::OnGameListLoadFile(QString game_path) {
- BootGame(game_path);
+void GMainWindow::OnGameListLoadFile(QString game_path, u64 program_id) {
+ BootGame(game_path, program_id);
}
void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target,
@@ -2448,7 +2451,7 @@ void GMainWindow::OnLoadComplete() {
void GMainWindow::OnExecuteProgram(std::size_t program_index) {
ShutdownGame();
- BootGame(last_filename_booted, program_index);
+ BootGame(last_filename_booted, 0, program_index);
}
void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_text) {
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index 45c8310e1..a50e5b9fe 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -186,8 +186,8 @@ private:
void PreventOSSleep();
void AllowOSSleep();
- bool LoadROM(const QString& filename, std::size_t program_index);
- void BootGame(const QString& filename, std::size_t program_index = 0,
+ bool LoadROM(const QString& filename, u64 program_id, std::size_t program_index);
+ void BootGame(const QString& filename, u64 program_id = 0, std::size_t program_index = 0,
StartGameType with_config = StartGameType::Normal);
void ShutdownGame();
@@ -238,7 +238,7 @@ private slots:
void OnOpenQuickstartGuide();
void OnOpenFAQ();
/// Called whenever a user selects a game in the game list widget.
- void OnGameListLoadFile(QString game_path);
+ void OnGameListLoadFile(QString game_path, u64 program_id);
void OnGameListOpenFolder(u64 program_id, GameListOpenTarget target,
const std::string& game_path);
void OnTransferableShaderCacheOpenFile(u64 program_id);
diff --git a/src/yuzu_cmd/CMakeLists.txt b/src/yuzu_cmd/CMakeLists.txt
index 4bf25727b..e55a19649 100644
--- a/src/yuzu_cmd/CMakeLists.txt
+++ b/src/yuzu_cmd/CMakeLists.txt
@@ -38,6 +38,11 @@ target_include_directories(yuzu-cmd PRIVATE ${RESOURCES_DIR})
target_include_directories(yuzu-cmd PRIVATE ../../externals/Vulkan-Headers/include)
+if (YUZU_USE_EXTERNAL_SDL2)
+ target_compile_definitions(yuzu-cmd PRIVATE -DYUZU_USE_EXTERNAL_SDL2)
+ target_include_directories(yuzu-cmd PRIVATE ${PROJECT_BINARY_DIR}/externals/SDL/include)
+endif()
+
if(UNIX AND NOT APPLE)
install(TARGETS yuzu-cmd RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
endif()
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp
index 325584a1a..b18056baf 100644
--- a/src/yuzu_cmd/config.cpp
+++ b/src/yuzu_cmd/config.cpp
@@ -242,17 +242,15 @@ static const std::array<int, 8> keyboard_mods{
};
template <>
-void Config::ReadSetting(const std::string& group, Settings::BasicSetting<float>& setting) {
- setting = sdl2_config->GetReal(group, setting.GetLabel(), setting.GetDefault());
-}
-template <>
void Config::ReadSetting(const std::string& group, Settings::BasicSetting<std::string>& setting) {
setting = sdl2_config->Get(group, setting.GetLabel(), setting.GetDefault());
}
+
template <>
void Config::ReadSetting(const std::string& group, Settings::BasicSetting<bool>& setting) {
setting = sdl2_config->GetBoolean(group, setting.GetLabel(), setting.GetDefault());
}
+
template <typename Type>
void Config::ReadSetting(const std::string& group, Settings::BasicSetting<Type>& setting) {
setting = static_cast<Type>(sdl2_config->GetInteger(group, setting.GetLabel(),
@@ -294,6 +292,8 @@ void Config::ReadValues() {
ReadSetting("ControlsGeneral", Settings::values.motion_device);
+ ReadSetting("ControlsGeneral", Settings::values.touch_device);
+
ReadSetting("ControlsGeneral", Settings::values.keyboard_enabled);
ReadSetting("ControlsGeneral", Settings::values.debug_pad_enabled);
@@ -416,11 +416,31 @@ void Config::ReadValues() {
}
ReadSetting("System", Settings::values.language_index);
+ ReadSetting("System", Settings::values.region_index);
ReadSetting("System", Settings::values.time_zone_index);
+ ReadSetting("System", Settings::values.sound_index);
// Core
ReadSetting("Core", Settings::values.use_multi_core);
+ // Cpu
+ ReadSetting("Cpu", Settings::values.cpu_accuracy);
+ ReadSetting("Cpu", Settings::values.cpu_debug_mode);
+ ReadSetting("Cpu", Settings::values.cpuopt_page_tables);
+ ReadSetting("Cpu", Settings::values.cpuopt_block_linking);
+ ReadSetting("Cpu", Settings::values.cpuopt_return_stack_buffer);
+ ReadSetting("Cpu", Settings::values.cpuopt_fast_dispatcher);
+ ReadSetting("Cpu", Settings::values.cpuopt_context_elimination);
+ ReadSetting("Cpu", Settings::values.cpuopt_const_prop);
+ ReadSetting("Cpu", Settings::values.cpuopt_misc_ir);
+ ReadSetting("Cpu", Settings::values.cpuopt_reduce_misalign_checks);
+ ReadSetting("Cpu", Settings::values.cpuopt_fastmem);
+ ReadSetting("Cpu", Settings::values.cpuopt_unsafe_unfuse_fma);
+ ReadSetting("Cpu", Settings::values.cpuopt_unsafe_reduce_fp_error);
+ ReadSetting("Cpu", Settings::values.cpuopt_unsafe_ignore_standard_fpcr);
+ ReadSetting("Cpu", Settings::values.cpuopt_unsafe_inaccurate_nan);
+ ReadSetting("Cpu", Settings::values.cpuopt_unsafe_fastmem_check);
+
// Renderer
ReadSetting("Renderer", Settings::values.renderer_backend);
ReadSetting("Renderer", Settings::values.renderer_debug);
@@ -440,6 +460,7 @@ void Config::ReadValues() {
ReadSetting("Renderer", Settings::values.use_nvdec_emulation);
ReadSetting("Renderer", Settings::values.accelerate_astc);
ReadSetting("Renderer", Settings::values.use_fast_gpu_time);
+ ReadSetting("Renderer", Settings::values.use_caches_gc);
ReadSetting("Renderer", Settings::values.bg_red);
ReadSetting("Renderer", Settings::values.bg_green);
@@ -460,7 +481,6 @@ void Config::ReadValues() {
// Debugging
Settings::values.record_frame_times =
sdl2_config->GetBoolean("Debugging", "record_frame_times", false);
- ReadSetting("Debugging", Settings::values.program_args);
ReadSetting("Debugging", Settings::values.dump_exefs);
ReadSetting("Debugging", Settings::values.dump_nso);
ReadSetting("Debugging", Settings::values.enable_fs_access_log);
diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h
index cc9850aad..b362f10b4 100644
--- a/src/yuzu_cmd/default_ini.h
+++ b/src/yuzu_cmd/default_ini.h
@@ -65,6 +65,13 @@ button_screenshot=
lstick=
rstick=
+# To use the debug_pad, prepend `debug_pad_` before each button setting above.
+# i.e. debug_pad_button_a=
+
+# Enable debug pad inputs to the guest
+# 0 (default): Disabled, 1: Enabled
+debug_pad_enabled =
+
# Whether to enable or disable vibration
# 0: Disabled, 1 (default): Enabled
vibration_enabled=
@@ -73,6 +80,10 @@ vibration_enabled=
# 0 (default): Disabled, 1: Enabled
enable_accurate_vibrations=
+# Enables controller motion inputs
+# 0: Disabled, 1 (default): Enabled
+motion_enabled =
+
# for motion input, the following devices are available:
# - "motion_emu" (default) for emulating motion input from mouse input. Required parameters:
# - "update_period": update period in milliseconds (default to 100)
@@ -98,19 +109,30 @@ use_touch_from_button=
#touch_from_button_maps_0_bind_1=bar
# etc.
-# Most desktop operating systems do not expose a way to poll the motion state of the controllers
-# so as a way around it, cemuhook created a udp client/server protocol to broadcast the data directly
-# from a controller device to the client program. Citra has a client that can connect and read
-# from any cemuhook compatible motion program.
+# List of Cemuhook UDP servers, delimited by ','.
+# Default: 127.0.0.1:26760
+# Example: 127.0.0.1:26760,123.4.5.67:26761
+udp_input_servers =
-# IPv4 address of the udp input server (Default "127.0.0.1")
-udp_input_address=127.0.0.1
+# Enable controlling an axis via a mouse input.
+# 0 (default): Off, 1: On
+mouse_panning =
+
+# Set mouse sensitivity.
+# Default: 1.0
+mouse_panning_sensitivity =
+
+# Emulate an analog control stick from keyboard inputs.
+# 0 (default): Disabled, 1: Enabled
+emulate_analog_keyboard =
-# Port of the udp input server. (Default 26760)
-udp_input_port=
+# Enable mouse inputs to the guest
+# 0 (default): Disabled, 1: Enabled
+mouse_enabled =
-# The pad to request data on. Should be between 0 (Pad 1) and 3 (Pad 4). (Default 0)
-udp_pad_index=
+# Enable keyboard inputs to the guest
+# 0 (default): Disabled, 1: Enabled
+keyboard_enabled =
[Core]
# Whether to use multi-core for CPU emulation
@@ -118,6 +140,17 @@ udp_pad_index=
use_multi_core=
[Cpu]
+# Adjusts various optimizations.
+# Auto-select mode enables choice unsafe optimizations.
+# Accurate enables only safe optimizations.
+# Unsafe allows any unsafe optimizations.
+# 0 (default): Auto-select, 1: Accurate, 2: Enable unsafe optimizations
+cpu_accuracy =
+
+# Allow disabling safe optimizations.
+# 0 (default): Disabled, 1: Enabled
+cpu_debug_mode =
+
# Enable inline page tables optimization (faster guest memory access)
# 0: Disabled, 1 (default): Enabled
cpuopt_page_tables =
@@ -154,6 +187,31 @@ cpuopt_reduce_misalign_checks =
# 0: Disabled, 1 (default): Enabled
cpuopt_fastmem =
+# Enable unfuse FMA (improve performance on CPUs without FMA)
+# Only enabled if cpu_accuracy is set to Unsafe. Automatically chosen with cpu_accuracy = Auto-select.
+# 0: Disabled, 1 (default): Enabled
+cpuopt_unsafe_unfuse_fma =
+
+# Enable faster FRSQRTE and FRECPE
+# Only enabled if cpu_accuracy is set to Unsafe.
+# 0: Disabled, 1 (default): Enabled
+cpuopt_unsafe_reduce_fp_error =
+
+# Enable faster ASIMD instructions (32 bits only)
+# Only enabled if cpu_accuracy is set to Unsafe. Automatically chosen with cpu_accuracy = Auto-select.
+# 0: Disabled, 1 (default): Enabled
+cpuopt_unsafe_ignore_standard_fpcr =
+
+# Enable inaccurate NaN handling
+# Only enabled if cpu_accuracy is set to Unsafe. Automatically chosen with cpu_accuracy = Auto-select.
+# 0: Disabled, 1 (default): Enabled
+cpuopt_unsafe_inaccurate_nan =
+
+# Disable address space checks (64 bits only)
+# Only enabled if cpu_accuracy is set to Unsafe. Automatically chosen with cpu_accuracy = Auto-select.
+# 0: Disabled, 1 (default): Enabled
+cpuopt_unsafe_fastmem_check =
+
[Renderer]
# Which backend API to use.
# 0 (default): OpenGL, 1: Vulkan
@@ -166,14 +224,6 @@ debug =
# Which Vulkan physical device to use (defaults to 0)
vulkan_device =
-# Whether to use software or hardware rendering.
-# 0: Software, 1 (default): Hardware
-use_hw_renderer =
-
-# Whether to use the Just-In-Time (JIT) compiler for shader emulation
-# 0: Interpreter (slow), 1 (default): JIT (fast)
-use_shader_jit =
-
# Aspect ratio
# 0: Default (16:9), 1: Force 4:3, 2: Force 21:9, 3: Stretch to Window
aspect_ratio =
@@ -211,57 +261,31 @@ use_frame_limit =
frame_limit =
# Whether to use disk based shader cache
-# 0 (default): Off, 1 : On
+# 0: Off, 1 (default): On
use_disk_shader_cache =
# Which gpu accuracy level to use
-# 0 (Normal), 1 (High), 2 (Extreme)
+# 0: Normal, 1 (default): High, 2: Extreme (Very slow)
gpu_accuracy =
# Whether to use asynchronous GPU emulation
# 0 : Off (slow), 1 (default): On (fast)
use_asynchronous_gpu_emulation =
-# Forces VSync on the display thread. Usually doesn't impact performance, but on some drivers it can
-# so only turn this off if you notice a speed difference.
+# Inform the guest that GPU operations completed more quickly than they did.
# 0: Off, 1 (default): On
-use_vsync =
+use_fast_gpu_time =
# Whether to use garbage collection or not for GPU caches.
# 0 (default): Off, 1: On
use_caches_gc =
# The clear color for the renderer. What shows up on the sides of the bottom screen.
-# Must be in range of 0.0-1.0. Defaults to 1.0 for all.
+# Must be in range of 0-255. Defaults to 0 for all.
bg_red =
bg_blue =
bg_green =
-[Layout]
-# Layout for the screen inside the render window.
-# 0 (default): Default Top Bottom Screen, 1: Single Screen Only, 2: Large Screen Small Screen
-layout_option =
-
-# Toggle custom layout (using the settings below) on or off.
-# 0 (default): Off, 1: On
-custom_layout =
-
-# Screen placement when using Custom layout option
-# 0x, 0y is the top left corner of the render window.
-custom_top_left =
-custom_top_top =
-custom_top_right =
-custom_top_bottom =
-custom_bottom_left =
-custom_bottom_top =
-custom_bottom_right =
-custom_bottom_bottom =
-
-# Swaps the prominent screen with the other screen.
-# For example, if Single Screen is chosen, setting this to 1 will display the bottom screen instead of the top screen.
-# 0 (default): Top Screen is prominent, 1: Bottom Screen is prominent
-swap_screen =
-
[Audio]
# Which audio output engine to use.
# auto (default): Auto-select
@@ -281,7 +305,7 @@ enable_audio_stretching =
output_device =
# Output volume.
-# 1.0 (default): 100%, 0.0; mute
+# 100 (default): 100%, 0; mute
volume =
[Data Storage]
@@ -308,10 +332,6 @@ gamecard_path =
# 1 (default): Yes, 0: No
use_docked_mode =
-# Allow the use of NFC in games
-# 1 (default): Yes, 0 : No
-enable_nfc =
-
# Sets the seed for the RNG generator built into the switch
# rng_seed will be ignored and randomly generated if rng_seed_enabled is false
rng_seed_enabled =
@@ -323,10 +343,6 @@ rng_seed =
custom_rtc_enabled =
custom_rtc =
-# Sets the account username, max length is 32 characters
-# yuzu (default)
-username = yuzu
-
# Sets the systems language index
# 0: Japanese, 1: English (default), 2: French, 3: German, 4: Italian, 5: Spanish, 6: Chinese,
# 7: Korean, 8: Dutch, 9: Portuguese, 10: Russian, 11: Taiwanese, 12: British English, 13: Canadian French,
@@ -335,17 +351,25 @@ language_index =
# The system region that yuzu will use during emulation
# -1: Auto-select (default), 0: Japan, 1: USA, 2: Europe, 3: Australia, 4: China, 5: Korea, 6: Taiwan
-region_value =
+region_index =
# The system time zone that yuzu will use during emulation
# 0: Auto-select (default), 1: Default (system archive value), Others: Index for specified time zone
time_zone_index =
+# Sets the sound output mode.
+# 0: Mono, 1 (default): Stereo, 2: Surround
+sound_index =
+
[Miscellaneous]
# A filter which removes logs below a certain logging level.
# Examples: *:Debug Kernel.SVC:Trace Service.*:Critical
log_filter = *:Trace
+# Use developer keys
+# 0 (default): Disabled, 1: Enabled
+use_dev_keys =
+
[Debugging]
# Record frame time data, can be found in the log directory. Boolean value
record_frame_times =
@@ -355,6 +379,8 @@ dump_exefs=false
dump_nso=false
# Determines whether or not yuzu will save the filesystem access log.
enable_fs_access_log=false
+# Enables verbose reporting services
+reporting_services =
# Determines whether or not yuzu will report to the game that the emulated console is in Kiosk Mode
# false: Retail/Normal Mode (default), true: Kiosk Mode
quest_flag =
@@ -393,4 +419,4 @@ title_ids =
# For each title ID, have a key/value pair called `disabled_<title_id>` equal to the names of the add-ons to disable (sep. by '|')
# e.x. disabled_0100000000010000 = Update|DLC <- disables Updates and DLC on Super Mario Odyssey
)";
-}
+} // namespace DefaultINI
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
index 06b20c975..896181f0b 100644
--- a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
@@ -2,15 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
-// Ignore -Wimplicit-fallthrough due to https://github.com/libsdl-org/SDL/issues/4307
-#ifdef __clang__
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wimplicit-fallthrough"
-#endif
#include <SDL.h>
-#ifdef __clang__
-#pragma clang diagnostic pop
-#endif
#include "common/logging/log.h"
#include "common/scm_rev.h"
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp
index 837a44be7..eadb41790 100644
--- a/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp
@@ -7,15 +7,7 @@
#include <string>
#define SDL_MAIN_HANDLED
-// Ignore -Wimplicit-fallthrough due to https://github.com/libsdl-org/SDL/issues/4307
-#ifdef __clang__
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wimplicit-fallthrough"
-#endif
#include <SDL.h>
-#ifdef __clang__
-#pragma clang diagnostic pop
-#endif
#include <fmt/format.h>
#include <glad/glad.h>
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp
index 3401ad4b4..152e56db8 100644
--- a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp
@@ -15,16 +15,13 @@
#include "video_core/renderer_vulkan/renderer_vulkan.h"
#include "yuzu_cmd/emu_window/emu_window_sdl2_vk.h"
-// Include these late to avoid polluting everything with Xlib macros
-// Ignore -Wimplicit-fallthrough due to https://github.com/libsdl-org/SDL/issues/4307
-#ifdef __clang__
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wimplicit-fallthrough"
+#ifdef YUZU_USE_EXTERNAL_SDL2
+// Include this before SDL.h to prevent the external from including a dummy
+#define USING_GENERATED_CONFIG_H
+#include <SDL_config.h>
#endif
+
#include <SDL.h>
-#ifdef __clang__
-#pragma clang diagnostic pop
-#endif
#include <SDL_syswm.h>
EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsystem)
@@ -51,6 +48,11 @@ EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsyste
window_info.type = Core::Frontend::WindowSystemType::Windows;
window_info.render_surface = reinterpret_cast<void*>(wm.info.win.window);
break;
+#else
+ case SDL_SYSWM_TYPE::SDL_SYSWM_WINDOWS:
+ LOG_CRITICAL(Frontend, "Window manager subsystem Windows not compiled");
+ std::exit(EXIT_FAILURE);
+ break;
#endif
#ifdef SDL_VIDEO_DRIVER_X11
case SDL_SYSWM_TYPE::SDL_SYSWM_X11:
@@ -58,6 +60,11 @@ EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsyste
window_info.display_connection = wm.info.x11.display;
window_info.render_surface = reinterpret_cast<void*>(wm.info.x11.window);
break;
+#else
+ case SDL_SYSWM_TYPE::SDL_SYSWM_X11:
+ LOG_CRITICAL(Frontend, "Window manager subsystem X11 not compiled");
+ std::exit(EXIT_FAILURE);
+ break;
#endif
#ifdef SDL_VIDEO_DRIVER_WAYLAND
case SDL_SYSWM_TYPE::SDL_SYSWM_WAYLAND:
@@ -65,6 +72,11 @@ EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsyste
window_info.display_connection = wm.info.wl.display;
window_info.render_surface = wm.info.wl.surface;
break;
+#else
+ case SDL_SYSWM_TYPE::SDL_SYSWM_WAYLAND:
+ LOG_CRITICAL(Frontend, "Window manager subsystem Wayland not compiled");
+ std::exit(EXIT_FAILURE);
+ break;
#endif
default:
LOG_CRITICAL(Frontend, "Window manager subsystem not implemented");