From 382157249d8755571272ef32e01af36790080b02 Mon Sep 17 00:00:00 2001 From: lizzie Date: Thu, 8 Oct 2026 12:22:08 +0000 Subject: [PATCH 01/32] [dynarmic] Add A64:SM4/SM3 tests Signed-off-by: lizzie --- src/dynarmic/tests/A64/a64.cpp | 63 ++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/src/dynarmic/tests/A64/a64.cpp b/src/dynarmic/tests/A64/a64.cpp index 24ddfd4084..b5060e3ea5 100644 --- a/src/dynarmic/tests/A64/a64.cpp +++ b/src/dynarmic/tests/A64/a64.cpp @@ -2632,3 +2632,66 @@ TEST_CASE("A64: Rounding", "[a64]") { CHECK(jit.GetVector(5) == Vector{0x4000000040000000, 0x4000000040000000}); CHECK(jit.GetVector(6) == Vector{0x4000000040000000, 0x4000000040000000}); } + +TEST_CASE("A64: SM4", "[a64]") { + A64TestEnv env; + A64::UserConfig jit_user_config{}; + jit_user_config.callbacks = &env; + A64::Jit jit{jit_user_config}; + + oaknut::VectorCodeGenerator code{env.code_mem, nullptr}; + + code.SM4EKEY(V4.S4(), V0.S4(), V1.S4()); + code.SM4E(V5.S4(), V0.S4(), V1.S4()); + + jit.SetPC(0); + jit.SetVector(0, {0xefcdab8967452301, 0x1032547698badcfe}); + jit.SetVector(1, {0xefcdab8967452301, 0x1032547698badcfe}); + env.ticks_left = env.code_mem.size(); + CheckedRun([&]() { jit.Run(); }); + + CHECK(jit.GetVector(4) == Vector{0x486a0c2e00224466, 0x5c7e183a62402604}); + CHECK(jit.GetVector(5) == Vector{0xc2e086a43c1e785a, 0xd7f593b104264062}); +} + +TEST_CASE("A64: SM3", "[a64]") { + A64TestEnv env; + A64::UserConfig jit_user_config{}; + jit_user_config.callbacks = &env; + SECTION("SM3SS1") { + A64::Jit jit{jit_user_config}; + oaknut::VectorCodeGenerator code{env.code_mem, nullptr}; + code.SM3SS1(V0.S4(), V0.S4(), V1.S4(), V2.S4()); + jit.SetPC(0); + jit.SetVector(0, {0xec4aff517369c667, 0x46e3fbf2abbacd29}); + jit.SetVector(1, {0x8de7e81bf854c27c, 0x9ac99f33632e5a76}); + jit.SetVector(2, {0x5aa35831b70d3266, 0xd45ee95817055d25}); + env.ticks_left = env.code_mem.size(); + CheckedRun([&]() { jit.Run(); }); + CHECK(jit.GetVector(0) == Vector{0x0000000000000000, 0x73d67cd700000000}); + } + SECTION("SM3PARTW1") { + A64::Jit jit{jit_user_config}; + oaknut::VectorCodeGenerator code{env.code_mem, nullptr}; + code.SM3PARTW1(V0.S4(), V0.S4(), V1.S4(), V2.S4()); + jit.SetPC(0); + jit.SetVector(0, {0xec4aff517369c667, 0x46e3fbf2abbacd29}); + jit.SetVector(1, {0x8de7e81bf854c27c, 0x9ac99f33632e5a76}); + jit.SetVector(2, {0x5aa35831b70d3266, 0xd45ee95817055d25}); + env.ticks_left = env.code_mem.size(); + CheckedRun([&]() { jit.Run(); }); + CHECK(jit.GetVector(0) == Vector{0x653c64995693280c, 0xabcc7db97adebf12}); + } + SECTION("SM3PARTW2") { + A64::Jit jit{jit_user_config}; + oaknut::VectorCodeGenerator code{env.code_mem, nullptr}; + code.SM3PARTW2(V0.S4(), V0.S4(), V1.S4(), V2.S4()); + jit.SetPC(0); + jit.SetVector(0, {0xec4aff517369c667, 0x46e3fbf2abbacd29}); + jit.SetVector(1, {0x8de7e81bf854c27c, 0x9ac99f33632e5a76}); + jit.SetVector(2, {0x5aa35831b70d3266, 0xd45ee95817055d25}); + env.ticks_left = env.code_mem.size(); + CheckedRun([&]() { jit.Run(); }); + CHECK(jit.GetVector(0) == Vector{0x30010fe70da43740, 0x6702425b4a3a05d4}); + } +} From 3cdd2ce141224079ce1dc8bfb4be7edc113aca02 Mon Sep 17 00:00:00 2001 From: PavelBARABANOV Date: Thu, 8 Oct 2026 19:02:48 +0200 Subject: [PATCH 02/32] =?UTF-8?q?[android,=20renderer=5Fvulkan]=20=D0=A1ha?= =?UTF-8?q?nge=20default=20settings=20(#4509)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Airplane mode: On - needed to launch many games. Nvdec: CPU - fixes most issues in cutscenes. AudioEngine: Sdl3 (only Android) - "Auto" includes Cubeb on Android, but SDL3 works better. Async GPU: On - In most games, this provides a 30% boost in performance. Async presentation: On (Remove async presentation toggle from Android, It is no longer needed). Co-authored-by: CamilleLaVey Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4509 Reviewed-by: Maufeat Reviewed-by: lizzie --- .../features/settings/model/BooleanSetting.kt | 1 - .../settings/model/view/SettingsItem.kt | 7 ----- .../settings/ui/SettingsFragmentPresenter.kt | 1 - .../app/src/main/res/values-ar/strings.xml | 2 -- .../app/src/main/res/values-es/strings.xml | 2 -- .../app/src/main/res/values-ru/strings.xml | 2 -- .../app/src/main/res/values-uk/strings.xml | 2 -- .../src/main/res/values-zh-rCN/strings.xml | 2 -- .../src/main/res/values-zh-rTW/strings.xml | 10 +++---- .../app/src/main/res/values/strings.xml | 2 -- src/common/settings.h | 24 ++++++++--------- .../renderer_vulkan/renderer_vulkan.cpp | 6 +++-- .../renderer_vulkan/vk_present_manager.cpp | 26 ++++++++++++++++++- .../renderer_vulkan/vk_present_manager.h | 10 ++++++- 14 files changed, 54 insertions(+), 43 deletions(-) diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt index 239d56837c..2f2d3823f8 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt @@ -27,7 +27,6 @@ enum class BooleanSetting(override val key: String) : AbstractBooleanSetting { RENDERER_USE_DISK_SHADER_CACHE("use_disk_shader_cache"), RENDERER_FORCE_MAX_CLOCK("force_max_clock"), RENDERER_ASYNCHRONOUS_GPU_EMULATION("use_asynchronous_gpu_emulation"), - RENDERER_ASYNC_PRESENTATION("async_presentation"), RENDERER_ASYNCHRONOUS_SHADERS("use_asynchronous_shaders"), RENDERER_REACTIVE_FLUSHING("use_reactive_flushing"), ENABLE_BUFFER_HISTORY("enable_buffer_history"), diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt index ef52b23053..8346339ee4 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt @@ -753,13 +753,6 @@ abstract class SettingsItem( descriptionId = R.string.renderer_asynchronous_gpu_emulation_description ) ) - put( - SwitchSetting( - BooleanSetting.RENDERER_ASYNC_PRESENTATION, - titleId = R.string.renderer_async_presentation, - descriptionId = R.string.renderer_async_presentation_description - ) - ) put( SingleChoiceSetting( IntSetting.DMA_ACCURACY, diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt index dccc8b859a..74e1e90836 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt @@ -561,7 +561,6 @@ class SettingsFragmentPresenter( add(BooleanSetting.RENDERER_ASYNCHRONOUS_SHADERS.key) add(IntSetting.ANDROID_PIPELINE_WORKERS.key) add(BooleanSetting.RENDERER_ASYNCHRONOUS_GPU_EMULATION.key) - add(BooleanSetting.RENDERER_ASYNC_PRESENTATION.key) add(SettingsItem.GPU_UNSWIZZLE_COMBINED) add(HeaderSetting(R.string.extensions)) diff --git a/src/android/app/src/main/res/values-ar/strings.xml b/src/android/app/src/main/res/values-ar/strings.xml index 1082a117ab..5669aab8ba 100644 --- a/src/android/app/src/main/res/values-ar/strings.xml +++ b/src/android/app/src/main/res/values-ar/strings.xml @@ -574,8 +574,6 @@ يجبر وحدة معالجة الرسومات على العمل بأقصى سرعة ممكنة (سيظل يتم تطبيق القيود الحرارية). محاكاة غير متزامنة لوحدة معالجة الرسومات يمكن لهذه الحيلة أن تزيد الأداء عن طريق تشغيل محاكاة وحدة معالجة الرسومات بشكل غير متزامن على حساب مشاكل الرسومات وزيادة معدلات الأعطال بسبب العمليات المتعلقة بالتوقيت. - عرض غير متزامن - يمكن لهذه الحيلة أن تزيد من الأداء عن طريق نقل عملية العرض إلى خيط معالجة منفصل على حساب مشاكل الرسوميات. استخدم التنظيف التفاعلي يحسن دقة العرض في بعض الألعاب على حساب الأداء. تفعيل سجل التخزين المؤقت diff --git a/src/android/app/src/main/res/values-es/strings.xml b/src/android/app/src/main/res/values-es/strings.xml index 72f8d74203..05135b515e 100644 --- a/src/android/app/src/main/res/values-es/strings.xml +++ b/src/android/app/src/main/res/values-es/strings.xml @@ -518,8 +518,6 @@ Fuerza a la GPU a ejecutarse a la velocidad máxima de reloj posible (se seguirán aplicando restricciones térmicas). Emulación de GPU asíncrona Este hack puede aumentar el rendimiento ejecutando la emulación de la GPU de forma asíncrona, a costa de problemas gráficos y un aumento en la tasa de fallos debido a operaciones relacionadas con la sincronización. - Presentación asíncrona - Este hack puede aumentar el rendimiento al mover la presentación a un hilo independiente de la CPU a costa de problemas gráficos. Usar limpieza reactiva Mejora la precisión de renderizado en algunos juegos, pero reduce el rendimiento. Activar el historial del búfer diff --git a/src/android/app/src/main/res/values-ru/strings.xml b/src/android/app/src/main/res/values-ru/strings.xml index 912ce84caf..c291a9276b 100644 --- a/src/android/app/src/main/res/values-ru/strings.xml +++ b/src/android/app/src/main/res/values-ru/strings.xml @@ -563,8 +563,6 @@ Заставляет ГПУ работать на максимально возможных тактовых частотах (тепловые ограничения все равно будут применяться). Асинхронная эмуляция ГПУ Может повысить производительность за счёт асинхронного запуска эмуляции ГПУ, но ценой появления графических ошибок и увеличения частоты вылетов из-за операций, зависящих от синхронизации. - Асинхронная презентация - Может повысить производительность за счёт перемещения вывода кадров в отдельный поток ЦП, но ценой возникновения графических проблем. Реактивная очистка Повышение точности рендеринга в некоторых играх за счет снижения производительности. Включить историю буфера diff --git a/src/android/app/src/main/res/values-uk/strings.xml b/src/android/app/src/main/res/values-uk/strings.xml index 9923fc72c4..b49e320806 100644 --- a/src/android/app/src/main/res/values-uk/strings.xml +++ b/src/android/app/src/main/res/values-uk/strings.xml @@ -481,8 +481,6 @@ Змушує GPU працювати на максимальній тактовій частоті. Асинхронна емуляція ГП Це обхідне рішення може покращити продуктивність завдяки асинхронному виконанню емуляції ГП, але спричинить проблеми з графікою та збільшить частоту збоїв чутливих до таймінгів операцій. - Асинхронне подання - Це обхідне рішення може покращити продуктивність завдяки переміщенню подання на окремий потік ЦП, але спричинить проблеми з графікою. Реактивне очищення Покращує точність рендерингу в деяких іграх. Увімкнути історію буфера diff --git a/src/android/app/src/main/res/values-zh-rCN/strings.xml b/src/android/app/src/main/res/values-zh-rCN/strings.xml index 19f5f0aae7..6ae0f102b2 100644 --- a/src/android/app/src/main/res/values-zh-rCN/strings.xml +++ b/src/android/app/src/main/res/values-zh-rCN/strings.xml @@ -564,8 +564,6 @@ 强制 GPU 以最大时钟运行 (温控依然生效)。 GPU 异步模拟 此技巧可通过异步运行 GPU 模拟来提升性能,但在执行与时序相关的操作时,可能带来图形显示问题以及增加崩溃概率。 - 异步呈现 - 此技巧通过将图形呈现移至独立的 CPU 线程来提升性能,但可能会带来图形显示问题。 启用反应性刷新 通过牺牲性能来提升某些游戏的渲染精度。 启用缓冲区历史 diff --git a/src/android/app/src/main/res/values-zh-rTW/strings.xml b/src/android/app/src/main/res/values-zh-rTW/strings.xml index 55b126fd91..9a30acd3ac 100644 --- a/src/android/app/src/main/res/values-zh-rTW/strings.xml +++ b/src/android/app/src/main/res/values-zh-rTW/strings.xml @@ -560,12 +560,10 @@ 確保計算和記憶體操作之間的資料一致性,此選項應能修復某些遊戲中的問題,但在某些情況下可能會降低效能。使用Unreal Engine 4的遊戲似乎受影響最大 磁碟著色器快取 將產生的著色器快取儲存至硬碟以減少中斷 - 強制使用最大時脈(僅限Adreno) - 強制GPU以可能的最大時脈運作(熱溫限制仍會被套用) - GPU非同步模擬 - 此修改可透過使用GPU非同步模擬來提升性能,不過可能會導致圖形問題且會提高在進行時序相關操作時當機的機率 - 非同步呈現 - 此修改可以透過將渲染移至單獨的CPU執行緒來提升性能,但可能會導致圖形問題 + 強制使用最大時脈 (僅限Adreno) + 強制 GPU 以可能的最大時脈執行 (熱溫限制仍會被套用) + GPU 非同步模擬 + 此修改可透過使用 GPU 非同步模擬來提升性能,不過可能會導致圖形問題且會提高在進行時序相關操作時當機的機率 使用重新啟用排清 犧牲效能以改善部分遊戲的轉譯準確度 啟用緩衝區歷史 diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml index e48319f483..703a91fd02 100644 --- a/src/android/app/src/main/res/values/strings.xml +++ b/src/android/app/src/main/res/values/strings.xml @@ -580,8 +580,6 @@ Forces the GPU to run at the maximum possible clocks (thermal constraints will still be applied). GPU async emulation This hack can increase performance by running GPU emulation asynchronously at the cost of graphical issues and increased crash rates by timing-related operations. - Asynchronous presentation - This hack can increase performance by moving presentation to a separate CPU thread at the cost of graphical issues. Use reactive flushing Improves rendering accuracy in some games at the cost of performance. Enable buffer history diff --git a/src/common/settings.h b/src/common/settings.h index d4c445c27c..0eee48b55d 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -171,8 +171,13 @@ struct Values { SwitchableSetting enable_overlay{linkage, false, "enable_overlay", Category::LibraryApplet}; // Audio - SwitchableSetting sink_id{linkage, AudioEngine::Auto, "output_engine", - Category::Audio, Specialization::RuntimeList}; + SwitchableSetting sink_id{linkage, +#ifdef __ANDROID__ + AudioEngine::Sdl3, +#else + AudioEngine::Auto, +#endif + "output_engine", Category::Audio, Specialization::RuntimeList}; SwitchableSetting audio_output_device_id{ linkage, "auto", "output_device", Category::Audio, Specialization::RuntimeList}; SwitchableSetting audio_input_device_id{ @@ -472,13 +477,8 @@ struct Values { SwitchableSetting frame_gen_dump_flow{linkage, false, "frame_gen_dump_flow", Category::Renderer}; - SwitchableSetting use_asynchronous_gpu_emulation{linkage, -#ifdef __ANDROID__ - false, -#else - true, -#endif - "use_asynchronous_gpu_emulation", Category::Renderer}; + SwitchableSetting use_asynchronous_gpu_emulation{linkage, true, "use_asynchronous_gpu_emulation", + Category::Renderer}; // *nix platforms may have issues with the borderless windowed fullscreen mode. // Default to exclusive fullscreen on these platforms for now. SwitchableSetting fullscreen_mode{linkage, @@ -537,7 +537,7 @@ struct Values { "vram_usage_mode", Category::RendererAdvanced}; - SwitchableSetting nvdec_emulation{linkage, NvdecEmulation::Gpu, + SwitchableSetting nvdec_emulation{linkage, NvdecEmulation::Cpu, "nvdec_emulation", Category::RendererAdvanced}; SwitchableSetting max_anisotropy{linkage, @@ -645,7 +645,7 @@ struct Values { linkage, false, "nce_runtime_nro_patch", Category::RendererHacks}; SwitchableSetting async_presentation{linkage, #ifdef __ANDROID__ - false, + true, #else false, #endif @@ -936,7 +936,7 @@ struct Values { // Network Setting network_interface{linkage, std::string(), "network_interface", Category::Network}; - SwitchableSetting airplane_mode{linkage, false, "airplane_mode", Category::Network}; + SwitchableSetting airplane_mode{linkage, true, "airplane_mode", Category::Network}; // WebService Setting web_api_url{linkage, "api.ynet-fun.xyz", "web_api_url", diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.cpp b/src/video_core/renderer_vulkan/renderer_vulkan.cpp index 4fd4c0233b..27ca531186 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.cpp +++ b/src/video_core/renderer_vulkan/renderer_vulkan.cpp @@ -217,13 +217,15 @@ void RendererVulkan::Composite(std::span framebu scheduler.RequestOutsideRenderPassOperationContext(); blit_swapchain.DrawToFrame(device, rasterizer, frame, framebuffers, - render_window.GetFramebufferLayout(), swapchain.GetImageCount(), + render_window.GetFramebufferLayout(), + present_manager.SwapchainImageCount(), swapchain.GetImageViewFormat()); #ifdef HAS_LSFG void(frame_gen.WantedGenerations(present_manager.MaxExtraFrames())); - frame_gen.Process(device, frame, swapchain.GetImageFormat(), GuestExtent(framebuffers)); + frame_gen.Process(device, frame, present_manager.SwapchainImageFormat(), + GuestExtent(framebuffers)); const size_t generated_frames = frame_gen.GeneratedFrameCount(); for (size_t generation = 0; generation < generated_frames; ++generation) { diff --git a/src/video_core/renderer_vulkan/vk_present_manager.cpp b/src/video_core/renderer_vulkan/vk_present_manager.cpp index d173a3ba5f..9298764546 100644 --- a/src/video_core/renderer_vulkan/vk_present_manager.cpp +++ b/src/video_core/renderer_vulkan/vk_present_manager.cpp @@ -23,6 +23,7 @@ namespace Vulkan { namespace { constexpr size_t MAX_FRAMES_IN_FLIGHT = 7; +constexpr u32 MAX_PRESENT_ATTEMPTS = 3; #ifdef HAS_LSFG static_assert(MAX_FRAMES_IN_FLIGHT <= LSFG_MAX_TARGETS); #endif @@ -372,12 +373,33 @@ void PresentManager::SetImageCount() { #else image_count = std::min(swapchain.GetImageCount(), MAX_FRAMES_IN_FLIGHT); #endif + swapchain_image_count = swapchain.GetImageCount(); + swapchain_image_format = swapchain.GetImageFormat(); +} + +void PresentManager::DiscardFrame(Frame* frame) { + static constexpr VkPipelineStageFlags wait_stage = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; + const VkSemaphore render_ready = *frame->render_ready; + const VkSubmitInfo submit_info{ + .sType = VK_STRUCTURE_TYPE_SUBMIT_INFO, + .pNext = nullptr, + .waitSemaphoreCount = 1U, + .pWaitSemaphores = &render_ready, + .pWaitDstStageMask = &wait_stage, + .commandBufferCount = 0U, + .pCommandBuffers = nullptr, + .signalSemaphoreCount = 0U, + .pSignalSemaphores = nullptr, + }; + + std::scoped_lock submit_lock{scheduler.submit_mutex}; + void(device.GetGraphicsQueue().Submit(submit_info, *frame->present_done)); } void PresentManager::CopyToSwapchain(Frame* frame) { bool requires_recreation = false; - while (true) { + for (u32 attempt = 0; attempt < MAX_PRESENT_ATTEMPTS; ++attempt) { try { // Recreate surface and swapchain if needed. if (requires_recreation) { @@ -397,6 +419,8 @@ void PresentManager::CopyToSwapchain(Frame* frame) { requires_recreation = true; } } + + DiscardFrame(frame); } void PresentManager::CopyToSwapchainImpl(Frame* frame) { diff --git a/src/video_core/renderer_vulkan/vk_present_manager.h b/src/video_core/renderer_vulkan/vk_present_manager.h index 4741c55e61..ab2b76f10f 100644 --- a/src/video_core/renderer_vulkan/vk_present_manager.h +++ b/src/video_core/renderer_vulkan/vk_present_manager.h @@ -6,6 +6,7 @@ #pragma once +#include #include #include #include @@ -68,6 +69,9 @@ public: /// How many additional frames can be queued without stalling the render thread [[nodiscard]] size_t MaxExtraFrames() const; + [[nodiscard]] std::size_t SwapchainImageCount() const { return swapchain_image_count; } + [[nodiscard]] VkFormat SwapchainImageFormat() const { return swapchain_image_format; } + private: void PresentThread(std::stop_token token); @@ -77,6 +81,8 @@ private: void RecreateSwapchain(Frame* frame); + void DiscardFrame(Frame* frame); + void SetImageCount(); private: @@ -100,7 +106,9 @@ private: bool blit_supported; bool storage_supported; bool use_present_thread; - std::size_t image_count{}; + std::atomic image_count{}; + std::atomic swapchain_image_count{}; + std::atomic swapchain_image_format{}; }; } // namespace Vulkan From 67bada77f8a43a90da2e94e89b8e7da73c256989 Mon Sep 17 00:00:00 2001 From: MaranBr Date: Thu, 8 Oct 2026 23:11:34 +0200 Subject: [PATCH 03/32] [video_core] Skip fragment shaders with known issues on non-NVIDIA drivers (#4503) - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Skip fragment shaders using a pattern that is not supported by non-NVIDIA drivers. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4503 Reviewed-by: CamilleLaVey --- src/common/settings.h | 3 -- src/qt_common/config/shared_translation.cpp | 6 --- .../frontend/maxwell/translate_program.cpp | 2 +- src/shader_recompiler/ir_opt/passes.h | 4 ++ .../ir_opt/rescaling_pass.cpp | 17 +++----- .../ir_opt/vendor_workaround_pass.cpp | 43 +++++++++++++++++++ .../renderer_vulkan/vk_pipeline_cache.cpp | 6 +++ 7 files changed, 59 insertions(+), 22 deletions(-) diff --git a/src/common/settings.h b/src/common/settings.h index 0eee48b55d..2a4bf3e9e4 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -657,9 +657,6 @@ struct Values { SwitchableSetting emulate_bgr565{linkage, false, "emulate_bgr565", Category::RendererHacks}; - SwitchableSetting rescale_hack{linkage, false, "rescale_hack", - Category::RendererHacks}; - SwitchableSetting use_asynchronous_shaders{linkage, false, "use_asynchronous_shaders", Category::RendererHacks}; diff --git a/src/qt_common/config/shared_translation.cpp b/src/qt_common/config/shared_translation.cpp index 0fe2366dfc..964a4cdad4 100644 --- a/src/qt_common/config/shared_translation.cpp +++ b/src/qt_common/config/shared_translation.cpp @@ -279,12 +279,6 @@ std::unique_ptr InitializeTranslations(QObject* parent) { "quality and performance consistency in some games.")); INSERT(Settings, fix_bloom_effects, tr("Fix bloom effects"), tr("Removes bloom in Burnout.")); - INSERT(Settings, rescale_hack, tr("Enable Legacy Rescale Pass"), - tr("May fix rescale issues in some games by relying on behavior from the previous " - "implementation.\n" - "Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and " - "grey texture flicker on Nvidia GPUs in Luigis Mansion 3.")); - // Renderer (Extensions) INSERT(Settings, dyna_state, tr("Extended Dynamic State"), tr("Controls the number of features that can be used in Extended Dynamic State.\n" diff --git a/src/shader_recompiler/frontend/maxwell/translate_program.cpp b/src/shader_recompiler/frontend/maxwell/translate_program.cpp index ebc5a825dd..1b2ec5502d 100644 --- a/src/shader_recompiler/frontend/maxwell/translate_program.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate_program.cpp @@ -301,7 +301,7 @@ IR::Program TranslateProgram(ObjectPool& inst_pool, ObjectPoolInstructions()) { + switch (inst.GetOpcode()) { + case IR::Opcode::ShuffleIndex: + case IR::Opcode::ShuffleUp: + case IR::Opcode::ShuffleDown: + case IR::Opcode::ShuffleButterfly: + break; + default: + continue; + } + const IR::Value shuffle_arg{inst.Arg(0)}; + if (shuffle_arg.IsImmediate()) { + continue; + } + const IR::Inst* bitcast{shuffle_arg.InstRecursive()}; + if (!bitcast || bitcast->GetOpcode() != IR::Opcode::BitCastU32F32) { + continue; + } + const IR::Value bitcast_arg{bitcast->Arg(0)}; + if (bitcast_arg.IsImmediate()) { + continue; + } + const IR::Inst* attribute{bitcast_arg.InstRecursive()}; + if (!attribute || attribute->GetOpcode() != IR::Opcode::GetAttribute) { + continue; + } + const IR::Attribute attr{attribute->Arg(0).Attribute()}; + if (attr == IR::Attribute::PositionX || attr == IR::Attribute::PositionY) { + return true; + } + } + } + return false; +} + } // namespace Shader::Optimization diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index 642b9fa223..5e057dd4cf 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp @@ -23,6 +23,7 @@ #include "shader_recompiler/environment.h" #include "shader_recompiler/frontend/maxwell/control_flow.h" #include "shader_recompiler/frontend/maxwell/translate_program.h" +#include "shader_recompiler/ir_opt/passes.h" #include "shader_recompiler/program_header.h" #include "video_core/engines/kepler_compute.h" #include "video_core/engines/maxwell_3d.h" @@ -826,6 +827,11 @@ std::unique_ptr PipelineCache::CreateGraphicsPipeline( programs[index] = MergeDualVertexPrograms(program_va, program_vb, env); } + if (device.GetDriverID() != VK_DRIVER_ID_NVIDIA_PROPRIETARY && Shader::Optimization::HasBrokenPattern(programs[index])) { + LOG_WARNING(Render_Vulkan, "0x{:016x}: Skipping shader with known issues", key.unique_hashes[index]); + return nullptr; + } + if (Settings::values.dump_guest_shaders) { env.Dump(hash, key.unique_hashes[index]); } From c746982201a60958193f0678fff1f39417aaaf1e Mon Sep 17 00:00:00 2001 From: crueter Date: Sun, 11 Oct 2026 05:11:01 +0200 Subject: [PATCH 04/32] [*] fix clangarm64 compilation (#4521) seems like a lot less headers are pulling in vector Signed-off-by: crueter - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4521 Reviewed-by: lizzie --- src/core/hle/service/bcat/backend/backend.h | 3 +-- src/hid_core/resources/npad/npad_types.h | 4 +++- src/input_common/helpers/joycon_protocol/joycon_types.h | 2 ++ src/input_common/helpers/joycon_protocol/poller.cpp | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/core/hle/service/bcat/backend/backend.h b/src/core/hle/service/bcat/backend/backend.h index 8419399a62..645af9a386 100644 --- a/src/core/hle/service/bcat/backend/backend.h +++ b/src/core/hle/service/bcat/backend/backend.h @@ -6,12 +6,11 @@ #pragma once -#include #include #include +#include #include "common/common_types.h" -#include "core/file_sys/vfs/vfs_types.h" #include "core/hle/result.h" #include "core/hle/service/bcat/bcat_types.h" #include "core/hle/service/kernel_helpers.h" diff --git a/src/hid_core/resources/npad/npad_types.h b/src/hid_core/resources/npad/npad_types.h index 68b803c3d3..2f7ac2d4f7 100644 --- a/src/hid_core/resources/npad/npad_types.h +++ b/src/hid_core/resources/npad/npad_types.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project @@ -6,6 +6,8 @@ #pragma once +#include + #include "common/bit_field.h" #include "common/common_funcs.h" #include "common/common_types.h" diff --git a/src/input_common/helpers/joycon_protocol/joycon_types.h b/src/input_common/helpers/joycon_protocol/joycon_types.h index dd3bd4398c..8597d02701 100644 --- a/src/input_common/helpers/joycon_protocol/joycon_types.h +++ b/src/input_common/helpers/joycon_protocol/joycon_types.h @@ -13,6 +13,8 @@ #include #include +#include + #include #include "common/bit_field.h" diff --git a/src/input_common/helpers/joycon_protocol/poller.cpp b/src/input_common/helpers/joycon_protocol/poller.cpp index 2384981f50..07e599f89e 100644 --- a/src/input_common/helpers/joycon_protocol/poller.cpp +++ b/src/input_common/helpers/joycon_protocol/poller.cpp @@ -4,7 +4,7 @@ // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "common/logging.h" +#include #include "input_common/helpers/joycon_protocol/poller.h" namespace InputCommon::Joycon { From fecc1b4ee32bc06f736f2d138680ec948cf13ab1 Mon Sep 17 00:00:00 2001 From: PavelBARABANOV Date: Sun, 11 Oct 2026 12:08:33 +0200 Subject: [PATCH 05/32] revert [vulkan] Masquerade VkInfo as PUBGMobile + UE #4320 (#4520) - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- https://github.com/Balemuni/Balemunis-Aurora stopped fixing the black squares in TotK. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4520 Reviewed-by: lizzie Reviewed-by: Maufeat --- src/video_core/vulkan_common/vulkan_wrapper.cpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/video_core/vulkan_common/vulkan_wrapper.cpp b/src/video_core/vulkan_common/vulkan_wrapper.cpp index 5044881598..bb43fe399f 100644 --- a/src/video_core/vulkan_common/vulkan_wrapper.cpp +++ b/src/video_core/vulkan_common/vulkan_wrapper.cpp @@ -460,20 +460,8 @@ Instance Instance::Create(u32 version, Span layers, Span gloom + yellow line glitch appears -#ifdef __ANDROID__ - const VkApplicationInfo application_info{ - .sType = VK_STRUCTURE_TYPE_APPLICATION_INFO, - .pNext = nullptr, - .pApplicationName = "PUBGMobile", - .applicationVersion = VK_MAKE_VERSION(1, 7, 0), - .pEngineName = "UnrealEngine", - .engineVersion = VK_MAKE_VERSION(4, 23, 0), - .apiVersion = VK_API_VERSION_1_3, - }; -#else + // DO NOT TOUCH, breaks RNDA3!! + // Don't know why, but gloom + yellow line glitch appears const VkApplicationInfo application_info{ .sType = VK_STRUCTURE_TYPE_APPLICATION_INFO, .pNext = nullptr, @@ -483,7 +471,6 @@ Instance Instance::Create(u32 version, Span layers, Span Date: Mon, 12 Oct 2026 01:09:10 +0200 Subject: [PATCH 06/32] [vk] Return the corrections made for buffer update logic #3690 (#4499) Credit: Pavel Fixes shadows in Metroid Prime Remastered Broken ![image](/attachments/7c49b843-0184-4835-b14e-d93a0948dd56) Fixed ![image](/attachments/2ba2eb43-fead-4fd4-9791-671aa518f282) Needs to be tested - Demon Slayer Vertex Explosions - Ender Magnolia Freezing - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Co-authored-by: PavelBARABANOV Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4499 Reviewed-by: Maufeat Reviewed-by: lizzie Reviewed-by: CamilleLaVey --- src/video_core/renderer_vulkan/vk_query_cache.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/video_core/renderer_vulkan/vk_query_cache.cpp b/src/video_core/renderer_vulkan/vk_query_cache.cpp index 2b5aa24053..f63c924e39 100644 --- a/src/video_core/renderer_vulkan/vk_query_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_query_cache.cpp @@ -814,7 +814,7 @@ public: new_query->flags |= VideoCommon::QueryFlagBits::IsFinalValueSynced; return index; } - + scheduler.RequestOutsideRenderPassOperationContext(); CloseCounter(); auto [bank_slot, data_slot] = ProduceCounterBuffer(slot); @@ -952,8 +952,6 @@ private: } has_flushed_end_pending = false; - // Refresh buffer state before ending transform feedback to ensure counters_count is up-to-date. - UpdateBuffers(); if (buffers_count == 0) { LOG_DEBUG(Render_Vulkan, "EndTransformFeedbackEXT called with no counters (buffers_count=0)"); scheduler.Record([](vk::CommandBuffer cmdbuf) { From 9580e54f2f4787986abde4c7601177d0c5cd2792 Mon Sep 17 00:00:00 2001 From: Eden CI Date: Mon, 12 Oct 2026 19:23:00 +0200 Subject: [PATCH 07/32] [dist, android] Update translations from Transifex for Oct 12 (#4527) Automatic translation update for Oct 12 Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4527 --- dist/languages/ar.ts | 612 +++++++-------- dist/languages/ca.ts | 587 +++++++------- dist/languages/cs.ts | 587 +++++++------- dist/languages/da.ts | 587 +++++++------- dist/languages/de.ts | 588 +++++++------- dist/languages/el.ts | 587 +++++++------- dist/languages/es.ts | 588 +++++++------- dist/languages/fi.ts | 599 ++++++++------- dist/languages/fr.ts | 587 +++++++------- dist/languages/hu.ts | 587 +++++++------- dist/languages/id.ts | 587 +++++++------- dist/languages/it.ts | 587 +++++++------- dist/languages/ja_JP.ts | 587 +++++++------- dist/languages/ko_KR.ts | 588 +++++++------- dist/languages/nb.ts | 587 +++++++------- dist/languages/nl.ts | 587 +++++++------- dist/languages/pl.ts | 587 +++++++------- dist/languages/pt_BR.ts | 588 +++++++------- dist/languages/pt_PT.ts | 587 +++++++------- dist/languages/ru_RU.ts | 588 +++++++------- dist/languages/sv.ts | 726 +++++++++--------- dist/languages/tr_TR.ts | 587 +++++++------- dist/languages/uk.ts | 588 +++++++------- dist/languages/vi.ts | 587 +++++++------- dist/languages/vi_VN.ts | 587 +++++++------- dist/languages/zh_CN.ts | 588 +++++++------- dist/languages/zh_TW.ts | 587 +++++++------- .../app/src/main/res/values-ar/strings.xml | 6 +- .../src/main/res/values-zh-rTW/strings.xml | 428 ++++++----- 29 files changed, 8363 insertions(+), 8103 deletions(-) diff --git a/dist/languages/ar.ts b/dist/languages/ar.ts index 472f7ac609..73ab8a2039 100644 --- a/dist/languages/ar.ts +++ b/dist/languages/ar.ts @@ -727,12 +727,32 @@ Aggressive mode may impact performance of other applications such as recording s يتخطى بعض عمليات إبطال ذاكرة التخزين المؤقتة أثناء تحديثات الذاكرة، مما يقلل من استخدام وحدة المعالجة المركزية ويحسّن زمن الوصول. قد يؤدي هذا إلى أعطال مؤقتة. - + + GPU Readback Before NCE Invalidation + NCE إعادة قراءة وحدة معالجة الرسومات قبل إبطال صلاحية + + + + Flushes GPU buffer data back to guest memory before NCE invalidates the whole guest page, preserving it while the CPU store proceeds. + يفرغ بيانات ذاكرة المعالج الرسومي المؤقتة ويعيدها إلى ذاكرة المحاكي قبل أن تلغي تقنية التشغيل المباشر عمل الصفحة بالكامل، مما يحافظ على البيانات أثناء استمرار المعالج المركزي في تخزينها + + + + Patch Runtime NROs for NCE + تعديل ملفات تشغيل اللعبة فوراً لتتوافق مع تقنية التشغيل المباشر + + + + Applies NCE code patches to runtime-loaded NRO modules.This is required for some games to run correctly. + يعدل كود تشغيل اللعبة تلقائياً عند فتحها. هذا الإجراء ضروري لتشغيل بعض الألعاب بدون مشاكل. + + + VSync Mode: VSync وضع: - + FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. FIFO Relaxed allows tearing as it recovers from a slow down. Mailbox can have lower latency than FIFO and does not tear but may drop frames. @@ -743,12 +763,12 @@ Immediate (no synchronization) presents whatever is available and can exhibit te يُظهر الوضع الفوري (بدون مزامنة) كل ما هو متاح، وقد يُظهر تمزقًا. - + Sync Memory Operations مزامنة عمليات الذاكرة - + Ensures data consistency between compute and memory operations. This option fixes issues in games, but may degrade performance. Unreal Engine 4 games often see the most significant changes thereof. @@ -757,44 +777,44 @@ Unreal Engine 4 games often see the most significant changes thereof. التغييرات الأكثر أهمية Unreal Engine 4 غالبًا ما تشهد ألعاب. - + Enable asynchronous presentation (Vulkan only) (Vulkan فقط) تفعيل العرض التقديمي غير المتزامن - + Slightly improves performance by moving presentation to a separate CPU thread. تحسين الأداء بشكل طفيف عن طريق نقل العرض التقديمي إلى مؤشر ترابط منفصل في وحدة المعالجة المركزية. - + Force maximum clocks (Vulkan only) (Vulkan فقط) فرض الحد الأقصى للساعات - + Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed. يعمل في الخلفية أثناء انتظار أوامر الرسومات لمنع وحدة معالجة الرسومات من خفض سرعة الساعة. - + Anisotropic Filtering: :الترشيح متباين الخواص - + Controls the quality of texture rendering at oblique angles. Safe to set at 16x on most GPUs. يتحكم بجودة عرض الملمس بزوايا مائلة. من الآمن ضبطه على 16x على معظم وحدات معالجة الرسومات. - + GPU Mode: :وضع وحدة معالجة الرسومات - + Controls the GPU emulation mode. Most games render fine with Fast, but Accurate is still required for some. Particles tend to only render correctly with Accurate mode. @@ -803,12 +823,12 @@ Particles tend to only render correctly with Accurate mode. لا تُعرض الجسيمات بشكل صحيح إلا في وضع «دقيق». - + DMA Accuracy: DMA دقة: - + Controls the DMA read mode. Unsafe is faster, while Safe is more stable and can fix issues in some games. Default follows the GPU Accuracy setting. @@ -817,12 +837,12 @@ Default follows the GPU Accuracy setting. يُتبع الإعداد الافتراضي إعداد «دقة وحدة معالجة الرسومات» - + GPU Fence Behavior: :سلوك حاجز وحدة معالجة الرسومات - + Controls the GPU fence synchronization behavior. Immediate is the fastest option, but can introduce some issues. Balanced offers better compatibility and may fix issues in some games. @@ -835,44 +855,44 @@ Default follows the GPU Mode setting. يتبع الخيار افتراضي إعداد وضع وحدة معالجة الرسومات. - + Enable asynchronous shader compilation تفعيل تجميع التظليل غير المتزامن - + May reduce shader stutter. قد يقلل من تقطع التظليل. - + GPU Clocks سرعات وحدة معالجة الرسومات - + Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch's clocks. يجعل اللعبة تعتقد أن عمل وحدة معالجة الرسومات ينتهي بشكل أسرع مما هو عليه في الواقع، لذلك تتوقف عن خفض الدقة ومسافة العرض لتتناسب مع سرعات جهاز Switch. - + GPU Unswizzle إلغاء ترتيب بيانات وحدة معالجة الرسومات - + Accelerates BCn 3D texture decoding using GPU compute. Disable if experiencing crashes or graphical glitches. باستخدام حوسبة وحدة معالجة الرسومات BCn 3D يسرع فك تشفير نسيج. قم بتعطيله في حالة حدوث أعطال أو مشاكل في الرسومات. - + GPU Unswizzle Max Texture Size الحد الأقصى لحجم النسيج في وحدة معالجة الرسومات بعد إعادة ترتيب البيانات - + Sets the maximum size (MiB) for GPU-based texture unswizzling. While the GPU is faster for medium and large textures, the CPU may be more efficient for very small ones. Adjust this to find the balance between GPU acceleration and CPU overhead. @@ -881,48 +901,48 @@ Adjust this to find the balance between GPU acceleration and CPU overhead. - + GPU Unswizzle Stream Size حجم تدفق إلغاء ترتيب بيانات وحدة معالجة الرسومات - + Sets the maximum amount of texture data (in MiB) processed per frame. Higher values can reduce stutter during texture loading but may impact frame consistency. يحدد الحد الأقصى لكمية بيانات النسيج (بالميغابايت) التي تتم معالجتها لكل إطار. يمكن أن تقلل القيم الأعلى من التقطع أثناء تحميل النسيج، ولكنها قد تؤثر على اتساق الإطارات. - + GPU Unswizzle Chunk Size حجم كتلة إلغاء ترتيب بيانات وحدة معالجة الرسومات - + Determines the number of depth slices processed in a single dispatch. Increasing this can improve throughput on high-end GPUs but may cause TDR or driver timeouts on weaker hardware. يُحدد هذا الخيار عدد شرائح العمق التي تتم معالجتها في عملية إرسال واحدة. زيادة هذا الخيار قد تُحسّن الإنتاجية على وحدات معالجة الرسومات المتطورة، ولكنها قد تُسبب أخطاء في إعادة تعيين وقت الاستجابة أو انقطاع الاتصال ببرنامج التشغيل على الأجهزة ذات المواصفات الأقل. - + Use Vulkan pipeline cache Vulkan استخدام ذاكرة التخزين المؤقتة لخط أنابيب - + Enables GPU vendor-specific pipeline cache. This option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally. يُفعّل ذاكرة التخزين المؤقت لخطوط الأنابيب الخاصة ببائع وحدة معالجة الرسومات. بتخزين ملفات ذاكرة التخزين المؤقتة للخطوط الداخلية Vulkan يمكن أن يؤدي هذا الخيار إلى تحسين وقت تحميل التظليل بشكل كبير في الحالات التي لا يقوم فيها برنامج تشغيل. - + Enable Compute Pipelines (Intel Vulkan Only) (Intel Vulkan فقط) تفعيل خطوط أنابيب الحوسبة - + Required by some games. This setting only exists for Intel proprietary drivers and may crash if enabled. Compute pipelines are always enabled on all other drivers. @@ -931,192 +951,180 @@ Compute pipelines are always enabled on all other drivers. خطوط أنابيب الحوسبة مفعلة دائمًا على جميع برامج التشغيل الأخرى. - + Enable Reactive Flushing تفعيل التنظيف التفاعلي - + Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing. يستخدم التنظيف التفاعلي بدلاً من التنظيف التنبئي، مما يسمح بمزامنة الذاكرة بشكل أكثر دقة. - + Sync to framerate of video playback المزامنة مع معدل الإطارات لتشغيل الفيديو - + Run the game at normal speed during video playback, even when the framerate is unlocked. قم بتشغيل اللعبة بالسرعة العادية أثناء تشغيل الفيديو، حتى عندما يكون معدل الإطارات مفتوحًا. - + Barrier feedback loops حلقات التغذية الراجعة للحواجز - + Improves rendering of transparency effects in specific games. يحسن عرض تأثيرات الشفافية في بعض الألعاب المحددة. - + Enable buffer history تفعيل سجل التخزين المؤقت - + Enables access to previous buffer states. This option may improve rendering quality and performance consistency in some games. يُتيح هذا الخيار الوصول إلى حالات التخزين المؤقت السابقة. وقد يُحسّن جودة العرض وثبات الأداء في بعض الألعاب. - + Fix bloom effects إصلاح تأثيرات التوهج - + Removes bloom in Burnout. يزيل التوهج في وضع الاحتراق. - - Enable Legacy Rescale Pass - تفعيل ميزة إعادة التحجيم القديمة - - - - May fix rescale issues in some games by relying on behavior from the previous implementation. -Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and grey texture flicker on Nvidia GPUs in Luigis Mansion 3. - قد يصلح مشاكل إعادة القياس في بعض الألعاب بالاعتماد على سلوك من التنفيذ السابق. -حل لسلوك قديم يصلح تشوهات الخطوط على بطاقات AMD وIntel الرسومية، ووميض النسيج الرمادي على بطاقات Nvidia الرسومية في لعبة Luigi's Mansion 3. - - - + Extended Dynamic State الحالة الديناميكية الموسعة - + Controls the number of features that can be used in Extended Dynamic State. Higher states allow for more features and can increase performance, but may cause additional graphical issues. يتحكم في عدد الميزات التي يمكن استخدامها في الحالة الديناميكية الموسعة.تسمح الحالات الأعلى بمزيد من الميزات ويمكن أن تزيد من الأداء، ولكنها قد تسبب مشكلات رسومية إضافية. - + Vertex Input Dynamic State حالة ديناميكية لإدخال الرأس - + Enables vertex input dynamic state feature for better quality and performance. يتيح ميزة الحالة الديناميكية لإدخال الرأس لتحسين الجودة والأداء. - + Sample Shading تظليل العينة - + Allows the fragment shader to execute per sample in a multi-sampled fragment instead of once per fragment. Improves graphics quality at the cost of performance. Higher values improve quality but degrade performance. يسمح لمظلل الأجزاء بالتنفيذ لكل عينة في جزء متعدد العينات بدلاً من مرة واحدة لكل جزء. يحسن جودة الرسومات على حساب الأداء. القيم الأعلى تحسن الجودة ولكنها تقلل من الأداء. - + RNG Seed مولد الأرقام العشوائية - + Controls the seed of the random number generator. Mainly used for speedrunning. يتحكم في بذرة مولد الأرقام العشوائية. يُستخدم بشكل رئيسي في سباقات السرعة. - + Device Name اسم الجهاز - + The name of the console. اسم وحدة التحكم. - + Homebrew Args Homebrew وسائط - + Command-line arguments passed to homebrew at launch (e.g. -noglsl). (noglsl -مثل) عند التشغيل Homebrew سطر الأوامر الوسائط المُمررة إلى - + Custom RTC Date: :تاريخ التوقيت الحقيقي المخصص - + This option allows to change the clock of the console. Can be used to manipulate time in games. يتيح لك هذا الخيار تغيير ساعة وحدة التحكم. يمكن استخدامه للتحكم بالوقت في الألعاب. - + The number of seconds from the current unix time عدد الثواني من وقت يونكس الحالي - + Language: :اللغة - + This option can be overridden when region setting is auto-select يمكن تجاوز هذا الخيار عند تحديد إعداد المنطقة تلقائيًا - + Region: :المنطقة - + The region of the console. منطقة وحدة التحكم. - + Time Zone: :المنطقة الزمنية - + The time zone of the console. المنطقة الزمنية لوحدة التحكم. - + Sound Output Mode: :وضع إخراج الصوت - + Console Mode: :وضع وحدة التحكم - + Selects if the console is in Docked or Handheld mode. Games will change their resolution, details and supported controllers and depending on this setting. Setting to Handheld can help improve performance for low end systems. @@ -1125,1026 +1133,1026 @@ Setting to Handheld can help improve performance for low end systems. يُمكن أن يُساعد الضبط على الوضع المحمول على تحسين أداء الأجهزة منخفضة المواصفات. - + Prompt for user profile on boot المطالبة بملف تعريف المستخدم عند التشغيل - + Useful if multiple people use the same PC. مفيد إذا كان هناك عدة أشخاص يستخدمون نفس الكمبيوتر. - + Pause when not in focus توقف عند عدم التركيز - + Pauses emulation when focusing on other windows. يوقف المحاكاة عند التركيز على نوافذ أخرى. - + Confirm before stopping emulation تأكيد قبل إيقاف المحاكاة - + Overrides prompts asking to confirm stopping the emulation. Enabling it bypasses such prompts and directly exits the emulation. يتجاوز المطالبات التي تطلب تأكيد إيقاف المحاكاة. يؤدي تفعيله إلى تجاوز هذه المطالبات والخروج مباشرة من المحاكاة. - + Hide mouse on inactivity إخفاء الماوس عند عدم النشاط - + Hides the mouse after 2.5s of inactivity. يخفي الماوس بعد 2.5 ثانية من عدم النشاط. - + Check for updates التحقق من توفر التحديثات - + Whether or not to check for updates upon startup. ما إذا كان يجب التحقق من التحديثات عند بدء التشغيل أم لا. - + Enable Gamemode تفعيل وضع اللعبة - + Force X11 as Graphics Backend كخلفية رسومات X11 فرض - + Custom frontend الواجهة الأمامية المخصصة - + Real applet تطبيق صغير حقيقي - - + + Disabled معطل - + Never أبداً - + On Load عند التحميل - + Always دائماً - + CPU وحدة المعالجة المركزية - + GPU وحدة معالجة الرسومات - + CPU Asynchronous وحدة المعالجة المركزية غير المتزامنة - + Uncompressed (Best quality) Uncompressed (أفضل جودة) - + BC1 (Low quality) BC1 (جودة منخفضة) - + BC3 (Medium quality) BC3 (جودة متوسطة) - - + + Auto تلقائي - + 30 FPS 30 إطارًا في الثانية - + 60 FPS 60 إطارًا في الثانية - + 90 FPS 90 إطارًا في الثانية - + 120 FPS 120 إطارًا في الثانية - + Conservative محافظ - + Aggressive عدواني - + Vulkan Vulkan - + OpenGL GLSL OpenGL GLSL - + OpenGL GLASM (Assembly Shaders, NVIDIA Only) OpenGL GLASM (Assembly Shaders, NVIDIA Only) - + OpenGL SPIR-V (Experimental, AMD/Mesa Only) OpenGL SPIR-V (Experimental, AMD/Mesa Only) - + Null لا شيء - + Fast سريع - - - + + + Accurate دقه - - - + + + Default افتراضي - + Unsafe (fast) غير آمن (سريع) - + Safe (stable) آمن (مستقر) - + Immediate فوري - + Balanced متوازن - + Unsafe غير آمن - + Paranoid (disables most optimizations) شديد الحذر (يعطل معظم التحسينات) - + Debugging تصحيح الأخطاء - + Dynarmic Dynarmic - + NCE NCE - + Borderless Windowed نافذة بلا حدود - + Exclusive Fullscreen شاشة كاملة حصرية - + No Video Output لا يوجد إخراج فيديو - + CPU Video Decoding فك تشفير فيديو وحدة المعالجة المركزية - + GPU Video Decoding (Default) فك تشفير فيديو وحدة معالجة الرسومات (افتراضي) - + 0.25X (180p/270p) [EXPERIMENTAL] 0.25X (180p/270p) [تجريبي] - + 0.5X (360p/540p) [EXPERIMENTAL] 0.5X (360p/540p) [تجريبي] - + 0.75X (540p/810p) [EXPERIMENTAL] 0.75X (540p/810p) [تجريبي] - + 1X (720p/1080p) 1X (720p/1080p) - + 1.25X (900p/1350p) [EXPERIMENTAL] 1.25X (900p/1350p) [تجريبي] - + 1.5X (1080p/1620p) [EXPERIMENTAL] 1.5X (1080p/1620p) [تجريبي] - + 2X (1440p/2160p) 2X (1440p/2160p) - + 3X (2160p/3240p) 3X (2160p/3240p) - + 4X (2880p/4320p) 4X (2880p/4320p) - + 5X (3600p/5400p) 5X (3600p/5400p) - + 6X (4320p/6480p) 6X (4320p/6480p) - + 7X (5040p/7560p) 7X (5040p/7560p) - + 8X (5760p/8640p) 8X (5760p/8640p) - + Nearest Neighbor Nearest Neighbor - + Bilinear Bilinear - + Bicubic Bicubic - + Gaussian Gaussian - + Lanczos Lanczos - + ScaleForce ScaleForce - + AMD FidelityFX Super Resolution AMD FidelityFX Super Resolution - + Area Area - + MMPX MMPX - + Zero-Tangent Zero-Tangent - + B-Spline B-Spline - + Mitchell Mitchell - + Spline-1 Spline-1 - + Snapdragon Game Super Resolution دقة فائقة للألعاب من سنابدراغون - + Snapdragon Game Super Resolution EdgeDir دقة فائقة للألعاب من سنابدراغون EdgeDir - + None لا شيء - + FXAA FXAA - + SMAA SMAA - + Default (16:9) (16:9) افتراضي - + Force 4:3 4:3 فرض - + Force 21:9 21:9 فرض - + Force 16:10 16:10 فرض - + Stretch to Window تمديد إلى النافذة - + Automatic تلقائي - + 2x 2x - + 4x 4x - + 8x 8x - + 16x 16x - + Japanese (日本語) اليابانية (日本語) - + American English الإنجليزية الأمريكية - + French (français) الفرنسية (français) - + German (Deutsch) الألمانية (Deutsch) - + Italian (italiano) الإيطالية (Italiano) - + Spanish (español) الإسبانية (español) - + Chinese الصينية - + Korean (한국어) الكورية (한국어) - + Dutch (Nederlands) الهولندية (Nederlands) - + Portuguese (português) البرتغالية (Português) - + Russian (Русский) الروسية (Русский) - + Taiwanese تايواني - + British English الإنجليزية البريطانية - + Canadian French الكندية الفرنسية - + Latin American Spanish أمريكا اللاتينية الإسبانية - + Simplified Chinese الصينية المبسطة - + Traditional Chinese (正體中文) الصينية التقليدية (正體中文) - + Brazilian Portuguese (português do Brasil) البرتغالية البرازيلية (português do Brasil) - + Polish (polska) البولندية (polska) - + Thai (แบบไทย) التايلاندية (แบบไทย) - - + + Japan اليابان - + USA الولايات المتحدة الأمريكية - + Europe أوروبا - + Australia أستراليا - + China الصين - + Korea كوريا - + Taiwan تايوان - + Auto (%1) Auto select time zone تلقائي (%1) - + Default (%1) Default time zone افتراضي (%1) - + CET CET - + CST6CDT CST6CDT - + Cuba Cuba - + EET EET - + Egypt Egypt - + Eire Eire - + EST EST - + EST5EDT EST5EDT - + GB GB - + GB-Eire GB-Eire - + GMT GMT - + GMT+0 GMT+0 - + GMT-0 GMT-0 - + GMT0 GMT0 - + Greenwich Greenwich - + Hongkong Hongkong - + HST HST - + Iceland Iceland - + Iran Iran - + Israel Israel - + Jamaica Jamaica - + Kwajalein Kwajalein - + Libya Libya - + MET MET - + MST MST - + MST7MDT MST7MDT - + Navajo Navajo - + NZ NZ - + NZ-CHAT NZ-CHAT - + Poland Poland - + Portugal Portugal - + PRC PRC - + PST8PDT PST8PDT - + ROC ROC - + ROK ROK - + Singapore Singapore - + Turkey Turkey - + UCT UCT - + Universal Universal - + UTC UTC - + W-SU W-SU - + WET WET - + Zulu Zulu - + Mono أحادي - + Stereo مجسم - + Surround محيطي - + 4GB DRAM (Default) 4GB DRAM (افتراضي) - + 6GB DRAM (Unsafe) 6GB DRAM (غير آمنة) - + 8GB DRAM 8GB DRAM - + 10GB DRAM (Unsafe) 10GB DRAM (غير آمنة) - + 12GB DRAM (Unsafe) 12GB DRAM (غير آمنة) - + Docked الإرساء - + Handheld محمول - - + + Normal قياسي - - + + Boost تعزيز - - + + Overclock كسر السرعة - + Always ask (Default) اسأل دائمًا (افتراضي) - + Only if game specifies not to stop فقط إذا حددت اللعبة عدم التوقف - + Never ask لا تسأل أبدا - + Very Small (16 MB) صغير جدًا (16 ميغابايت) - + Small (32 MB) صغير (32 ميغابايت) - + Normal (128 MB) قياسي (128 ميغابايت) - + Large (256 MB) كبير (256 ميغابايت) - + Very Large (512 MB) كبير جدًا (512 ميغابايت) - + Very Low (4 MB) منخفض جدًا (4 ميغابايت) - + Low (8 MB) منخفض (8 ميغابايت) - + Normal (16 MB) قياسي (16 ميغابايت) - + Medium (32 MB) متوسط (32 ميغابايت) - + High (64 MB) عالي (64 ميغابايت) - + Very Low (32) منخفض جدًا (32) - + Low (64) منخفض (64) - + Normal (128) قياسي (128) - + Medium (256) متوسط (256) - + High (512) عالي (512) - + ExtendedDynamicState 1 الحالة الديناميكية الممتدة 1 - + ExtendedDynamicState 2 الحالة الديناميكية الممتدة 2 - + ExtendedDynamicState 3 الحالة الديناميكية الممتدة 3 - + Tree View عرض قائمة - + Grid View عرض شبكة @@ -3732,7 +3740,7 @@ Would you like to delete the old save data? Ring Controller - وحدة تحكم الحلقة + ذراع تحكم الحلقة @@ -5096,7 +5104,7 @@ Once deleted, these can NOT be recovered. Are you 100% sure you want to delete t Unable to create directory %1 for storing user images. - غير قادر على إنشاء الدليل %1 لتخزين صور المستخدم. + تعذر إنشاء المجلد %1 لتخزين صور المستخدم. @@ -5149,7 +5157,7 @@ UUID: %2 Configure Ring Controller - إعدادات حلقة وحدة التحكم + إعدادات حلقة ذراع التحكم @@ -5249,12 +5257,12 @@ UUID: %2 The current mapped device doesn't support the ring controller - الجهاز المُعيَّن حاليًا لا يدعم وحدة التحكم بالحلقة + الجهاز المعين حاليا لا يدعم ذراع التحكم بالحلقة The current mapped device doesn't have a ring attached - الجهاز المُعَيَّن حاليًا ليس به حلقة مُرفقة + الجهاز المعين حاليا ليس به حلقة مرفقة @@ -5790,7 +5798,7 @@ Drag points to change position, or double-click table cells to edit values. Discord Presence - الحضور على ديسكورد + التواجد على ديسكورد @@ -5888,7 +5896,7 @@ Drag points to change position, or double-click table cells to edit values. Delete all data in this directory. THIS IS 100% IRREVERSABLE! - حذف جميع البيانات الموجودة في هذا الدليل. هذا الإجراء لا رجعة فيه بنسبة 100%! + حذف جميع البيانات الموجودة في هذا المجلد. هذه العملية لا رجعة فيها بنسبة 100%! @@ -7312,22 +7320,22 @@ Debug Message: Small (32x32) - صغير (32x32) + (32x32) صغير Standard (64x64) - قياسي (64x64) + (64x64) قياسي Large (128x128) - كبير (128x128) + (128x128) كبير Full Size (256x256) - حجم كامل (256x256) + (256x256) حجم كامل @@ -8313,7 +8321,7 @@ If you wish to clean up the files which were left in the old data location, you %1 -إذا كنت ترغب في تنظيف الملفات التي تركت في موقع البيانات القديم، يمكنك القيام بذلك عن طريق حذف الدليل التالي: +إذا كنت ترغب في إزالة الملفات التي بقيت في موقع البيانات القديم، فيمكنك القيام بذلك عن طريق حذف المجلد التالي: %1 diff --git a/dist/languages/ca.ts b/dist/languages/ca.ts index 82c2259280..534d4e4af1 100644 --- a/dist/languages/ca.ts +++ b/dist/languages/ca.ts @@ -694,12 +694,32 @@ Aggressive mode may impact performance of other applications such as recording s - + + GPU Readback Before NCE Invalidation + + + + + Flushes GPU buffer data back to guest memory before NCE invalidates the whole guest page, preserving it while the CPU store proceeds. + + + + + Patch Runtime NROs for NCE + + + + + Applies NCE code patches to runtime-loaded NRO modules.This is required for some games to run correctly. + + + + VSync Mode: Mode de sincronització vertical: - + FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. FIFO Relaxed allows tearing as it recovers from a slow down. Mailbox can have lower latency than FIFO and does not tear but may drop frames. @@ -707,79 +727,79 @@ Immediate (no synchronization) presents whatever is available and can exhibit te - + Sync Memory Operations - + Ensures data consistency between compute and memory operations. This option fixes issues in games, but may degrade performance. Unreal Engine 4 games often see the most significant changes thereof. - + Enable asynchronous presentation (Vulkan only) - + Slightly improves performance by moving presentation to a separate CPU thread. - + Force maximum clocks (Vulkan only) - + Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed. - + Anisotropic Filtering: Filtrat anisotròpic: - + Controls the quality of texture rendering at oblique angles. Safe to set at 16x on most GPUs. - + GPU Mode: Mode de la GPU: - + Controls the GPU emulation mode. Most games render fine with Fast, but Accurate is still required for some. Particles tend to only render correctly with Accurate mode. - + DMA Accuracy: Precisió DMA: - + Controls the DMA read mode. Unsafe is faster, while Safe is more stable and can fix issues in some games. Default follows the GPU Accuracy setting. - + GPU Fence Behavior: - + Controls the GPU fence synchronization behavior. Immediate is the fastest option, but can introduce some issues. Balanced offers better compatibility and may fix issues in some games. @@ -788,1301 +808,1290 @@ Default follows the GPU Mode setting. - + Enable asynchronous shader compilation - + May reduce shader stutter. - + GPU Clocks - + Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch's clocks. - + GPU Unswizzle - + Accelerates BCn 3D texture decoding using GPU compute. Disable if experiencing crashes or graphical glitches. - + GPU Unswizzle Max Texture Size - + Sets the maximum size (MiB) for GPU-based texture unswizzling. While the GPU is faster for medium and large textures, the CPU may be more efficient for very small ones. Adjust this to find the balance between GPU acceleration and CPU overhead. - + GPU Unswizzle Stream Size - + Sets the maximum amount of texture data (in MiB) processed per frame. Higher values can reduce stutter during texture loading but may impact frame consistency. - + GPU Unswizzle Chunk Size - + Determines the number of depth slices processed in a single dispatch. Increasing this can improve throughput on high-end GPUs but may cause TDR or driver timeouts on weaker hardware. - + Use Vulkan pipeline cache - + Enables GPU vendor-specific pipeline cache. This option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally. - + Enable Compute Pipelines (Intel Vulkan Only) - + Required by some games. This setting only exists for Intel proprietary drivers and may crash if enabled. Compute pipelines are always enabled on all other drivers. - + Enable Reactive Flushing - + Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing. - + Sync to framerate of video playback - + Run the game at normal speed during video playback, even when the framerate is unlocked. - + Barrier feedback loops - + Improves rendering of transparency effects in specific games. - + Enable buffer history - + Enables access to previous buffer states. This option may improve rendering quality and performance consistency in some games. - + Fix bloom effects - + Removes bloom in Burnout. - - Enable Legacy Rescale Pass - - - - - May fix rescale issues in some games by relying on behavior from the previous implementation. -Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and grey texture flicker on Nvidia GPUs in Luigis Mansion 3. - - - - + Extended Dynamic State - + Controls the number of features that can be used in Extended Dynamic State. Higher states allow for more features and can increase performance, but may cause additional graphical issues. - + Vertex Input Dynamic State - + Enables vertex input dynamic state feature for better quality and performance. - + Sample Shading - + Allows the fragment shader to execute per sample in a multi-sampled fragment instead of once per fragment. Improves graphics quality at the cost of performance. Higher values improve quality but degrade performance. - + RNG Seed Llavor de GNA - + Controls the seed of the random number generator. Mainly used for speedrunning. - + Device Name Nom del dispositiu - + The name of the console. - + Homebrew Args - + Command-line arguments passed to homebrew at launch (e.g. -noglsl). - + Custom RTC Date: - + This option allows to change the clock of the console. Can be used to manipulate time in games. - + The number of seconds from the current unix time - + Language: Idioma: - + This option can be overridden when region setting is auto-select - + Region: Regió: - + The region of the console. - + Time Zone: Zona horària: - + The time zone of the console. - + Sound Output Mode: - + Console Mode: Mode de la consola - + Selects if the console is in Docked or Handheld mode. Games will change their resolution, details and supported controllers and depending on this setting. Setting to Handheld can help improve performance for low end systems. - + Prompt for user profile on boot - + Useful if multiple people use the same PC. - + Pause when not in focus - + Pauses emulation when focusing on other windows. - + Confirm before stopping emulation - + Overrides prompts asking to confirm stopping the emulation. Enabling it bypasses such prompts and directly exits the emulation. - + Hide mouse on inactivity Ocultar el cursor del ratolí en cas d'inactivitat - + Hides the mouse after 2.5s of inactivity. - + Check for updates - + Whether or not to check for updates upon startup. - + Enable Gamemode Activa el mode joc - + Force X11 as Graphics Backend - + Custom frontend - + Real applet - - + + Disabled - + Never Mai - + On Load - + Always Sempre - + CPU CPU - + GPU GPU - + CPU Asynchronous - + Uncompressed (Best quality) - + BC1 (Low quality) - + BC3 (Medium quality) - - + + Auto Auto - + 30 FPS 30 FPS - + 60 FPS 60 FPS - + 90 FPS 90 FPS - + 120 FPS 120 FPS - + Conservative Conservador - + Aggressive Agressiu - + Vulkan Vulkan - + OpenGL GLSL OpenGL GLSL - + OpenGL GLASM (Assembly Shaders, NVIDIA Only) OpenGL GLASM (Ensamblat d'ombrejadors, només NVIDIA) - + OpenGL SPIR-V (Experimental, AMD/Mesa Only) OpenGL SPIR-V (Experimental, només AMD/Mesa) - + Null Nul - + Fast Ràpid - - - + + + Accurate Precís - - - + + + Default Valor predeterminat - + Unsafe (fast) Insegur (ràpid) - + Safe (stable) Segur (estable) - + Immediate - + Balanced Equilibrat - + Unsafe Insegur - + Paranoid (disables most optimizations) Paranoic (desactiva la majoria d'optimitzacions) - + Debugging Depuració - + Dynarmic Dynarmic - + NCE NCE - + Borderless Windowed Finestra sense vores - + Exclusive Fullscreen Pantalla completa exclusiva - + No Video Output Sense sortida de vídeo - + CPU Video Decoding Descodificació de vídeo a la CPU - + GPU Video Decoding (Default) Descodificació de vídeo a la GPU (Valor predeterminat) - + 0.25X (180p/270p) [EXPERIMENTAL] 0.25X (180p/270p) [EXPERIMENTAL] - + 0.5X (360p/540p) [EXPERIMENTAL] 0.5X (360p/540p) [EXPERIMENTAL] - + 0.75X (540p/810p) [EXPERIMENTAL] 0.75X (540p/810p) [EXPERIMENTAL] - + 1X (720p/1080p) 1X (720p/1080p) - + 1.25X (900p/1350p) [EXPERIMENTAL] 1.25X (900p/1350p) [EXPERIMENTAL] - + 1.5X (1080p/1620p) [EXPERIMENTAL] 1.5X (1080p/1620p) [EXPERIMENTAL] - + 2X (1440p/2160p) 2X (1440p/2160p) - + 3X (2160p/3240p) 3X (2160p/3240p) - + 4X (2880p/4320p) 4X (2880p/4320p) - + 5X (3600p/5400p) 5X (3600p/5400p) - + 6X (4320p/6480p) 6X (4320p/6480p) - + 7X (5040p/7560p) 7X (5040p/7560p) - + 8X (5760p/8640p) 8X (5760p/8640p) - + Nearest Neighbor Veí més proper - + Bilinear Bilineal - + Bicubic Bicúbic - + Gaussian Gaussià - + Lanczos Lanczos - + ScaleForce ScaleForce - + AMD FidelityFX Super Resolution Super resolució AMD FidelityFX - + Area Àrea - + MMPX MMPX - + Zero-Tangent Tangència zero - + B-Spline B-Spline - + Mitchell Mitchell - + Spline-1 Spline-1 - + Snapdragon Game Super Resolution - + Snapdragon Game Super Resolution EdgeDir - + None Cap - + FXAA FXAA - + SMAA SMAA - + Default (16:9) Valor predeterminat (16:9) - + Force 4:3 Forçar 4:3 - + Force 21:9 Forçar 21:9 - + Force 16:10 - + Stretch to Window Estirar a la finestra - + Automatic Automàtic - + 2x 2x - + 4x 4x - + 8x 8x - + 16x 16x - + Japanese (日本語) Japonès (日本語) - + American English Anglès americà - + French (français) Francès (français) - + German (Deutsch) Alemany (Deutsch) - + Italian (italiano) Italià (italiano) - + Spanish (español) Castellà (español) - + Chinese Xinès - + Korean (한국어) Coreà (한국어) - + Dutch (Nederlands) Holandès (Nederlands) - + Portuguese (português) Portuguès (português) - + Russian (Русский) Rus (Русский) - + Taiwanese Taiwanès - + British English Anglès britànic - + Canadian French Francès canadenc - + Latin American Spanish Espanyol llatinoamericà - + Simplified Chinese Xinès simplificat - + Traditional Chinese (正體中文) Xinès tradicional (正體中文) - + Brazilian Portuguese (português do Brasil) Portuguès brasiler (português do Brasil) - + Polish (polska) Polonès (polska) - + Thai (แบบไทย) Tailandès (แบบไทย) - - + + Japan Japó - + USA EUA - + Europe Europa - + Australia Austràlia - + China Xina - + Korea Corea - + Taiwan Taiwan - + Auto (%1) Auto select time zone Auto (%1) - + Default (%1) Default time zone Per defecte (%1) - + CET CET - + CST6CDT CST6CDT - + Cuba Cuba - + EET EET - + Egypt Egipte - + Eire Eire - + EST EST - + EST5EDT EST5EDT - + GB GB - + GB-Eire GB-Eire - + GMT GMT - + GMT+0 GMT+0 - + GMT-0 GMT-0 - + GMT0 GMT0 - + Greenwich Greenwich - + Hongkong Hong Kong - + HST HST - + Iceland Islàndia - + Iran Iran - + Israel Isreal - + Jamaica Jamaica - + Kwajalein Kwajalein - + Libya Líbia - + MET MET - + MST MST - + MST7MDT MST7MDT - + Navajo Navajo - + NZ NZ - + NZ-CHAT NZ-CHAT - + Poland Polònia - + Portugal Portugal - + PRC PRC - + PST8PDT PST8PDT - + ROC ROC - + ROK ROK - + Singapore Singapur - + Turkey Turquia - + UCT UCT - + Universal Universal - + UTC UTC - + W-SU W-SU - + WET WET - + Zulu Zulu - + Mono Mono - + Stereo Estèreo - + Surround Envoltant - + 4GB DRAM (Default) 4GB DRAM (Insegur) - + 6GB DRAM (Unsafe) 6GB DRAM (Insegur) - + 8GB DRAM 8GB DRAM - + 10GB DRAM (Unsafe) 10GB DRAM (Insegur) - + 12GB DRAM (Unsafe) 12GB DRAM (Insegur) - + Docked Sobretaula - + Handheld Portàtil - - + + Normal - - + + Boost - - + + Overclock - + Always ask (Default) - + Only if game specifies not to stop Tan sols si el joc especifica no parar - + Never ask No preguntar mai - + Very Small (16 MB) - + Small (32 MB) - + Normal (128 MB) - + Large (256 MB) - + Very Large (512 MB) - + Very Low (4 MB) - + Low (8 MB) - + Normal (16 MB) - + Medium (32 MB) - + High (64 MB) - + Very Low (32) - + Low (64) - + Normal (128) - + Medium (256) - + High (512) - + ExtendedDynamicState 1 - + ExtendedDynamicState 2 - + ExtendedDynamicState 3 - + Tree View - + Grid View diff --git a/dist/languages/cs.ts b/dist/languages/cs.ts index c6644fa046..abbc0b4db0 100644 --- a/dist/languages/cs.ts +++ b/dist/languages/cs.ts @@ -694,12 +694,32 @@ Aggressive mode may impact performance of other applications such as recording s - + + GPU Readback Before NCE Invalidation + + + + + Flushes GPU buffer data back to guest memory before NCE invalidates the whole guest page, preserving it while the CPU store proceeds. + + + + + Patch Runtime NROs for NCE + + + + + Applies NCE code patches to runtime-loaded NRO modules.This is required for some games to run correctly. + + + + VSync Mode: - + FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. FIFO Relaxed allows tearing as it recovers from a slow down. Mailbox can have lower latency than FIFO and does not tear but may drop frames. @@ -707,79 +727,79 @@ Immediate (no synchronization) presents whatever is available and can exhibit te - + Sync Memory Operations - + Ensures data consistency between compute and memory operations. This option fixes issues in games, but may degrade performance. Unreal Engine 4 games often see the most significant changes thereof. - + Enable asynchronous presentation (Vulkan only) - + Slightly improves performance by moving presentation to a separate CPU thread. - + Force maximum clocks (Vulkan only) - + Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed. - + Anisotropic Filtering: Anizotropní filtrování: - + Controls the quality of texture rendering at oblique angles. Safe to set at 16x on most GPUs. - + GPU Mode: - + Controls the GPU emulation mode. Most games render fine with Fast, but Accurate is still required for some. Particles tend to only render correctly with Accurate mode. - + DMA Accuracy: - + Controls the DMA read mode. Unsafe is faster, while Safe is more stable and can fix issues in some games. Default follows the GPU Accuracy setting. - + GPU Fence Behavior: - + Controls the GPU fence synchronization behavior. Immediate is the fastest option, but can introduce some issues. Balanced offers better compatibility and may fix issues in some games. @@ -788,1301 +808,1290 @@ Default follows the GPU Mode setting. - + Enable asynchronous shader compilation - + May reduce shader stutter. - + GPU Clocks - + Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch's clocks. - + GPU Unswizzle - + Accelerates BCn 3D texture decoding using GPU compute. Disable if experiencing crashes or graphical glitches. - + GPU Unswizzle Max Texture Size - + Sets the maximum size (MiB) for GPU-based texture unswizzling. While the GPU is faster for medium and large textures, the CPU may be more efficient for very small ones. Adjust this to find the balance between GPU acceleration and CPU overhead. - + GPU Unswizzle Stream Size - + Sets the maximum amount of texture data (in MiB) processed per frame. Higher values can reduce stutter during texture loading but may impact frame consistency. - + GPU Unswizzle Chunk Size - + Determines the number of depth slices processed in a single dispatch. Increasing this can improve throughput on high-end GPUs but may cause TDR or driver timeouts on weaker hardware. - + Use Vulkan pipeline cache - + Enables GPU vendor-specific pipeline cache. This option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally. - + Enable Compute Pipelines (Intel Vulkan Only) - + Required by some games. This setting only exists for Intel proprietary drivers and may crash if enabled. Compute pipelines are always enabled on all other drivers. - + Enable Reactive Flushing - + Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing. - + Sync to framerate of video playback - + Run the game at normal speed during video playback, even when the framerate is unlocked. - + Barrier feedback loops - + Improves rendering of transparency effects in specific games. - + Enable buffer history - + Enables access to previous buffer states. This option may improve rendering quality and performance consistency in some games. - + Fix bloom effects - + Removes bloom in Burnout. - - Enable Legacy Rescale Pass - - - - - May fix rescale issues in some games by relying on behavior from the previous implementation. -Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and grey texture flicker on Nvidia GPUs in Luigis Mansion 3. - - - - + Extended Dynamic State - + Controls the number of features that can be used in Extended Dynamic State. Higher states allow for more features and can increase performance, but may cause additional graphical issues. - + Vertex Input Dynamic State - + Enables vertex input dynamic state feature for better quality and performance. - + Sample Shading - + Allows the fragment shader to execute per sample in a multi-sampled fragment instead of once per fragment. Improves graphics quality at the cost of performance. Higher values improve quality but degrade performance. - + RNG Seed RNG Seed - + Controls the seed of the random number generator. Mainly used for speedrunning. - + Device Name Název Zařízení - + The name of the console. - + Homebrew Args - + Command-line arguments passed to homebrew at launch (e.g. -noglsl). - + Custom RTC Date: - + This option allows to change the clock of the console. Can be used to manipulate time in games. - + The number of seconds from the current unix time - + Language: Jazyk: - + This option can be overridden when region setting is auto-select - + Region: Region: - + The region of the console. - + Time Zone: Časové Pásmo: - + The time zone of the console. - + Sound Output Mode: - + Console Mode: - + Selects if the console is in Docked or Handheld mode. Games will change their resolution, details and supported controllers and depending on this setting. Setting to Handheld can help improve performance for low end systems. - + Prompt for user profile on boot - + Useful if multiple people use the same PC. - + Pause when not in focus - + Pauses emulation when focusing on other windows. - + Confirm before stopping emulation Potvrzení před zastavením emulace - + Overrides prompts asking to confirm stopping the emulation. Enabling it bypasses such prompts and directly exits the emulation. - + Hide mouse on inactivity Skrýt myš při neaktivitě - + Hides the mouse after 2.5s of inactivity. - + Check for updates - + Whether or not to check for updates upon startup. - + Enable Gamemode - + Force X11 as Graphics Backend - + Custom frontend - + Real applet - - + + Disabled - + Never - + On Load - + Always - + CPU CPU - + GPU - + CPU Asynchronous - + Uncompressed (Best quality) - + BC1 (Low quality) - + BC3 (Medium quality) - - + + Auto Automatické - + 30 FPS - + 60 FPS - + 90 FPS - + 120 FPS - + Conservative - + Aggressive - + Vulkan Vulkan - + OpenGL GLSL - + OpenGL GLASM (Assembly Shaders, NVIDIA Only) - + OpenGL SPIR-V (Experimental, AMD/Mesa Only) - + Null - + Fast - - - + + + Accurate Přesné - - - + + + Default Výchozí - + Unsafe (fast) - + Safe (stable) - + Immediate - + Balanced - + Unsafe Nebezpečné - + Paranoid (disables most optimizations) Paranoidní (zakáže většinu optimizací) - + Debugging - + Dynarmic - + NCE - + Borderless Windowed Okno bez okrajů - + Exclusive Fullscreen Exkluzivní - + No Video Output - + CPU Video Decoding - + GPU Video Decoding (Default) - + 0.25X (180p/270p) [EXPERIMENTAL] - + 0.5X (360p/540p) [EXPERIMENTAL] - + 0.75X (540p/810p) [EXPERIMENTAL] - + 1X (720p/1080p) 1X (720p/1080p) - + 1.25X (900p/1350p) [EXPERIMENTAL] - + 1.5X (1080p/1620p) [EXPERIMENTAL] - + 2X (1440p/2160p) - + 3X (2160p/3240p) - + 4X (2880p/4320p) - + 5X (3600p/5400p) - + 6X (4320p/6480p) - + 7X (5040p/7560p) - + 8X (5760p/8640p) - + Nearest Neighbor - + Bilinear Bilineární - + Bicubic - + Gaussian - + Lanczos - + ScaleForce - + AMD FidelityFX Super Resolution - + Area - + MMPX - + Zero-Tangent - + B-Spline - + Mitchell - + Spline-1 - + Snapdragon Game Super Resolution - + Snapdragon Game Super Resolution EdgeDir - + None Žádné - + FXAA FXAA - + SMAA SMAA - + Default (16:9) Výchozí (16:9) - + Force 4:3 Vynutit 4:3 - + Force 21:9 Vynutit 21:9 - + Force 16:10 - + Stretch to Window Roztáhnout podle okna - + Automatic - + 2x 2x - + 4x 4x - + 8x 8x - + 16x 16x - + Japanese (日本語) Japonština (日本語) - + American English - + French (français) Francouzština (français) - + German (Deutsch) Nemčina (Deutsch) - + Italian (italiano) Italština (Italiano) - + Spanish (español) Španělština (español) - + Chinese Čínština - + Korean (한국어) Korejština (한국어) - + Dutch (Nederlands) Holandština (Nederlands) - + Portuguese (português) Portugalština (português) - + Russian (Русский) Ruština (Русский) - + Taiwanese Tajwanština - + British English Britská Angličtina - + Canadian French Kanadská Francouzština - + Latin American Spanish Latinsko Americká Španělština - + Simplified Chinese Zjednodušená Čínština - + Traditional Chinese (正體中文) Tradiční Čínština (正體中文) - + Brazilian Portuguese (português do Brasil) Brazilská Portugalština (português do Brasil) - + Polish (polska) - + Thai (แบบไทย) - - + + Japan Japonsko - + USA USA - + Europe Evropa - + Australia Austrálie - + China Čína - + Korea Korea - + Taiwan Taiwan - + Auto (%1) Auto select time zone - + Default (%1) Default time zone - + CET CET - + CST6CDT CST6CDT - + Cuba Cuba - + EET EET - + Egypt Egypt - + Eire Eire - + EST EST - + EST5EDT EST5EDT - + GB GB - + GB-Eire GB-Eire - + GMT GMT - + GMT+0 GMT+0 - + GMT-0 GMT-0 - + GMT0 GMT0 - + Greenwich Greenwich - + Hongkong Hongkong - + HST HST - + Iceland Island - + Iran Iran - + Israel Israel - + Jamaica Jamajka - + Kwajalein Kwajalein - + Libya Lybie - + MET MET - + MST MST - + MST7MDT MST7MDT - + Navajo Navajo - + NZ NZ - + NZ-CHAT NZ-CHAT - + Poland Polsko - + Portugal Portugalsko - + PRC PRC - + PST8PDT PST8PDT - + ROC ROC - + ROK ROK - + Singapore Singapur - + Turkey Turecko - + UCT UCT - + Universal Univerzální - + UTC UTC - + W-SU W-SU - + WET WET - + Zulu Zulu - + Mono Mono - + Stereo Stereo - + Surround Surround - + 4GB DRAM (Default) - + 6GB DRAM (Unsafe) - + 8GB DRAM - + 10GB DRAM (Unsafe) - + 12GB DRAM (Unsafe) - + Docked Zadokovaná - + Handheld Příruční - - + + Normal - - + + Boost - - + + Overclock - + Always ask (Default) Vždy se zeptat (Výchozí) - + Only if game specifies not to stop - + Never ask - + Very Small (16 MB) - + Small (32 MB) - + Normal (128 MB) - + Large (256 MB) - + Very Large (512 MB) - + Very Low (4 MB) - + Low (8 MB) - + Normal (16 MB) - + Medium (32 MB) - + High (64 MB) - + Very Low (32) - + Low (64) - + Normal (128) - + Medium (256) - + High (512) - + ExtendedDynamicState 1 - + ExtendedDynamicState 2 - + ExtendedDynamicState 3 - + Tree View - + Grid View diff --git a/dist/languages/da.ts b/dist/languages/da.ts index ed0bbc27d1..4e34f94af9 100644 --- a/dist/languages/da.ts +++ b/dist/languages/da.ts @@ -696,12 +696,32 @@ Aggressive mode may impact performance of other applications such as recording s - + + GPU Readback Before NCE Invalidation + + + + + Flushes GPU buffer data back to guest memory before NCE invalidates the whole guest page, preserving it while the CPU store proceeds. + + + + + Patch Runtime NROs for NCE + + + + + Applies NCE code patches to runtime-loaded NRO modules.This is required for some games to run correctly. + + + + VSync Mode: - + FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. FIFO Relaxed allows tearing as it recovers from a slow down. Mailbox can have lower latency than FIFO and does not tear but may drop frames. @@ -709,79 +729,79 @@ Immediate (no synchronization) presents whatever is available and can exhibit te - + Sync Memory Operations - + Ensures data consistency between compute and memory operations. This option fixes issues in games, but may degrade performance. Unreal Engine 4 games often see the most significant changes thereof. - + Enable asynchronous presentation (Vulkan only) - + Slightly improves performance by moving presentation to a separate CPU thread. - + Force maximum clocks (Vulkan only) - + Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed. - + Anisotropic Filtering: Anisotropisk Filtrering: - + Controls the quality of texture rendering at oblique angles. Safe to set at 16x on most GPUs. - + GPU Mode: - + Controls the GPU emulation mode. Most games render fine with Fast, but Accurate is still required for some. Particles tend to only render correctly with Accurate mode. - + DMA Accuracy: - + Controls the DMA read mode. Unsafe is faster, while Safe is more stable and can fix issues in some games. Default follows the GPU Accuracy setting. - + GPU Fence Behavior: - + Controls the GPU fence synchronization behavior. Immediate is the fastest option, but can introduce some issues. Balanced offers better compatibility and may fix issues in some games. @@ -790,1301 +810,1290 @@ Default follows the GPU Mode setting. - + Enable asynchronous shader compilation - + May reduce shader stutter. - + GPU Clocks - + Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch's clocks. - + GPU Unswizzle - + Accelerates BCn 3D texture decoding using GPU compute. Disable if experiencing crashes or graphical glitches. - + GPU Unswizzle Max Texture Size - + Sets the maximum size (MiB) for GPU-based texture unswizzling. While the GPU is faster for medium and large textures, the CPU may be more efficient for very small ones. Adjust this to find the balance between GPU acceleration and CPU overhead. - + GPU Unswizzle Stream Size - + Sets the maximum amount of texture data (in MiB) processed per frame. Higher values can reduce stutter during texture loading but may impact frame consistency. - + GPU Unswizzle Chunk Size - + Determines the number of depth slices processed in a single dispatch. Increasing this can improve throughput on high-end GPUs but may cause TDR or driver timeouts on weaker hardware. - + Use Vulkan pipeline cache - + Enables GPU vendor-specific pipeline cache. This option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally. - + Enable Compute Pipelines (Intel Vulkan Only) - + Required by some games. This setting only exists for Intel proprietary drivers and may crash if enabled. Compute pipelines are always enabled on all other drivers. - + Enable Reactive Flushing - + Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing. - + Sync to framerate of video playback - + Run the game at normal speed during video playback, even when the framerate is unlocked. - + Barrier feedback loops - + Improves rendering of transparency effects in specific games. - + Enable buffer history - + Enables access to previous buffer states. This option may improve rendering quality and performance consistency in some games. - + Fix bloom effects - + Removes bloom in Burnout. - - Enable Legacy Rescale Pass - - - - - May fix rescale issues in some games by relying on behavior from the previous implementation. -Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and grey texture flicker on Nvidia GPUs in Luigis Mansion 3. - - - - + Extended Dynamic State - + Controls the number of features that can be used in Extended Dynamic State. Higher states allow for more features and can increase performance, but may cause additional graphical issues. - + Vertex Input Dynamic State - + Enables vertex input dynamic state feature for better quality and performance. - + Sample Shading - + Allows the fragment shader to execute per sample in a multi-sampled fragment instead of once per fragment. Improves graphics quality at the cost of performance. Higher values improve quality but degrade performance. - + RNG Seed RNG-Seed - + Controls the seed of the random number generator. Mainly used for speedrunning. - + Device Name - + The name of the console. - + Homebrew Args - + Command-line arguments passed to homebrew at launch (e.g. -noglsl). - + Custom RTC Date: - + This option allows to change the clock of the console. Can be used to manipulate time in games. - + The number of seconds from the current unix time - + Language: - + This option can be overridden when region setting is auto-select - + Region: Region - + The region of the console. - + Time Zone: Tidszone - + The time zone of the console. - + Sound Output Mode: - + Console Mode: - + Selects if the console is in Docked or Handheld mode. Games will change their resolution, details and supported controllers and depending on this setting. Setting to Handheld can help improve performance for low end systems. - + Prompt for user profile on boot - + Useful if multiple people use the same PC. - + Pause when not in focus - + Pauses emulation when focusing on other windows. - + Confirm before stopping emulation - + Overrides prompts asking to confirm stopping the emulation. Enabling it bypasses such prompts and directly exits the emulation. - + Hide mouse on inactivity Skjul mus ved inaktivitet - + Hides the mouse after 2.5s of inactivity. - + Check for updates - + Whether or not to check for updates upon startup. - + Enable Gamemode - + Force X11 as Graphics Backend - + Custom frontend - + Real applet - - + + Disabled - + Never - + On Load - + Always - + CPU CPU - + GPU - + CPU Asynchronous - + Uncompressed (Best quality) - + BC1 (Low quality) - + BC3 (Medium quality) - - + + Auto Automatisk - + 30 FPS - + 60 FPS - + 90 FPS - + 120 FPS - + Conservative - + Aggressive - + Vulkan - + OpenGL GLSL - + OpenGL GLASM (Assembly Shaders, NVIDIA Only) - + OpenGL SPIR-V (Experimental, AMD/Mesa Only) - + Null - + Fast - - - + + + Accurate Nøjagtig - - - + + + Default Standard - + Unsafe (fast) - + Safe (stable) - + Immediate - + Balanced - + Unsafe Usikker - + Paranoid (disables most optimizations) Paranoid (deaktiverer de fleste optimeringer) - + Debugging - + Dynarmic - + NCE - + Borderless Windowed Uindrammet Vindue - + Exclusive Fullscreen Eksklusiv Fuld Skærm - + No Video Output Ingen Video-Output - + CPU Video Decoding CPU-Video Afkodning - + GPU Video Decoding (Default) GPU-Video Afkodning (Standard) - + 0.25X (180p/270p) [EXPERIMENTAL] - + 0.5X (360p/540p) [EXPERIMENTAL] - + 0.75X (540p/810p) [EXPERIMENTAL] 0,75X (540p/810p) [EKSPERIMENTEL] - + 1X (720p/1080p) 1X (720p/1080p) - + 1.25X (900p/1350p) [EXPERIMENTAL] - + 1.5X (1080p/1620p) [EXPERIMENTAL] - + 2X (1440p/2160p) 2X (1440p/2160p) - + 3X (2160p/3240p) 3X (2160p/3240p) - + 4X (2880p/4320p) 4X (2880p/4320p) - + 5X (3600p/5400p) 5X (3600p/5400p) - + 6X (4320p/6480p) 6X (4320p/6480p) - + 7X (5040p/7560p) - + 8X (5760p/8640p) - + Nearest Neighbor Nærmeste Nabo - + Bilinear Bilineær - + Bicubic Bikubisk - + Gaussian Gausisk - + Lanczos - + ScaleForce ScaleForce - + AMD FidelityFX Super Resolution - + Area - + MMPX - + Zero-Tangent - + B-Spline - + Mitchell - + Spline-1 - + Snapdragon Game Super Resolution - + Snapdragon Game Super Resolution EdgeDir - + None Ingen - + FXAA FXAA - + SMAA - + Default (16:9) Standard (16:9) - + Force 4:3 Tving 4:3 - + Force 21:9 Tving 21:9 - + Force 16:10 - + Stretch to Window Stræk til Vindue - + Automatic - + 2x - + 4x - + 8x - + 16x - + Japanese (日本語) Japansk (日本語) - + American English - + French (français) Fransk (français) - + German (Deutsch) Tysk (Deutsch) - + Italian (italiano) Italiensk (italiano) - + Spanish (español) Spansk (español) - + Chinese Kinesisk - + Korean (한국어) Koreansk (한국어) - + Dutch (Nederlands) Hollandsk (Nederlands) - + Portuguese (português) Portugisisk (português) - + Russian (Русский) Russisk (Русский) - + Taiwanese Taiwanesisk - + British English Britisk Engelsk - + Canadian French Candadisk Fransk - + Latin American Spanish Latinamerikansk Spansk - + Simplified Chinese Forenklet Kinesisk - + Traditional Chinese (正體中文) Traditionelt Kinesisk (正體中文) - + Brazilian Portuguese (português do Brasil) Braziliansk Portugisisk (português do Brasil) - + Polish (polska) - + Thai (แบบไทย) - - + + Japan Japan - + USA USA - + Europe Europa - + Australia Australien - + China Kina - + Korea Korea - + Taiwan Taiwan - + Auto (%1) Auto select time zone - + Default (%1) Default time zone - + CET CET - + CST6CDT CST6CDT - + Cuba Cuba - + EET EET - + Egypt Ægypten - + Eire Eire - + EST EST - + EST5EDT EST5EDT - + GB GB - + GB-Eire GB-Eire - + GMT GMT - + GMT+0 GMT+0 - + GMT-0 GMT-0 - + GMT0 GMT0 - + Greenwich Greenwich - + Hongkong Hongkong - + HST HST - + Iceland Island - + Iran Iran - + Israel Israel - + Jamaica Jamaica - + Kwajalein Kwajalein - + Libya Libyen - + MET MET - + MST MST - + MST7MDT MST7MDT - + Navajo Navajo - + NZ NZ - + NZ-CHAT NZ-CHAT - + Poland Polen - + Portugal Portugal - + PRC PRC - + PST8PDT PST8PDT - + ROC ROC - + ROK ROK - + Singapore Singapore - + Turkey Tyrkiet - + UCT UCT - + Universal Universel - + UTC UTC - + W-SU W-SU - + WET WET - + Zulu Zulu - + Mono Mono - + Stereo Stereo - + Surround Surround - + 4GB DRAM (Default) - + 6GB DRAM (Unsafe) - + 8GB DRAM - + 10GB DRAM (Unsafe) - + 12GB DRAM (Unsafe) - + Docked Dokket - + Handheld Håndholdt - - + + Normal - - + + Boost - - + + Overclock - + Always ask (Default) - + Only if game specifies not to stop - + Never ask - + Very Small (16 MB) - + Small (32 MB) - + Normal (128 MB) - + Large (256 MB) - + Very Large (512 MB) - + Very Low (4 MB) - + Low (8 MB) - + Normal (16 MB) - + Medium (32 MB) - + High (64 MB) - + Very Low (32) - + Low (64) - + Normal (128) - + Medium (256) - + High (512) - + ExtendedDynamicState 1 - + ExtendedDynamicState 2 - + ExtendedDynamicState 3 - + Tree View - + Grid View diff --git a/dist/languages/de.ts b/dist/languages/de.ts index d845754236..a911437c44 100644 --- a/dist/languages/de.ts +++ b/dist/languages/de.ts @@ -731,12 +731,32 @@ Der aggressive Modus kann die Leistung anderer Anwendungen, wie z. B. Aufnahmeso Überspringt bestimmte Cache-Invalidierungen auf CPU-Seite während Speicherupdates, reduziert die CPU-Auslastung und verbessert die Leistung. Dies verursacht vielleicht Abstürze. - + + GPU Readback Before NCE Invalidation + + + + + Flushes GPU buffer data back to guest memory before NCE invalidates the whole guest page, preserving it while the CPU store proceeds. + + + + + Patch Runtime NROs for NCE + + + + + Applies NCE code patches to runtime-loaded NRO modules.This is required for some games to run correctly. + + + + VSync Mode: VSync-Modus: - + FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. FIFO Relaxed allows tearing as it recovers from a slow down. Mailbox can have lower latency than FIFO and does not tear but may drop frames. @@ -747,12 +767,12 @@ Postkasten kann eine geringere Latenz als FIFO aufweisen und verursacht kein Tea Sofort (ohne Synchronisation) zeigt alles an, was verfügbar ist, und kann Tearing verursachen. - + Sync Memory Operations Speicheroperationen synchronisieren - + Ensures data consistency between compute and memory operations. This option fixes issues in games, but may degrade performance. Unreal Engine 4 games often see the most significant changes thereof. @@ -761,44 +781,44 @@ Diese Option behebt Probleme in Spielen, kann jedoch zu Leistungseinbußen führ Bei Spielen mit Unreal Engine 4 sind die Auswirkungen oft am deutlichsten spürbar. - + Enable asynchronous presentation (Vulkan only) Aktiviere asynchrone Präsentation (Nur Vulkan) - + Slightly improves performance by moving presentation to a separate CPU thread. Verbessert die Leistung geringfügig, indem die Darstellung auf einen separaten CPU-Thread verlagert wird. - + Force maximum clocks (Vulkan only) Erzwinge Maximale Taktrate (Vulkan only) - + Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed. Lässt im Hintergrund die GPU Aufgaben erledigen während diese auf Grafikbefehle wartet, damit diese nicht herunter taktet. - + Anisotropic Filtering: Anisotrope Filterung: - + Controls the quality of texture rendering at oblique angles. Safe to set at 16x on most GPUs. Steuert die Qualität der Texturwiedergabe bei schrägen Blickwinkeln. Bei den meisten Grafikkarten kann dieser Wert bedenkenlos auf 16x eingestellt werden. - + GPU Mode: GPU-Modus: - + Controls the GPU emulation mode. Most games render fine with Fast, but Accurate is still required for some. Particles tend to only render correctly with Accurate mode. @@ -807,12 +827,12 @@ Die meisten Spiele werden im Modus Schnell in Ordnung gerendert, für einige ist Partikel werden in der Regel nur im Modus Akkurat korrekt gerendert. - + DMA Accuracy: DMA-Genauigkeit: - + Controls the DMA read mode. Unsafe is faster, while Safe is more stable and can fix issues in some games. Default follows the GPU Accuracy setting. @@ -821,12 +841,12 @@ Unsicher ist schneller, während Sicher stabiler ist und in manchen Spielen Prob Standard folgt der GPU-Genauigkeit Einstellung. - + GPU Fence Behavior: GPU-Zaunobjekt-Verhalten: - + Controls the GPU fence synchronization behavior. Immediate is the fastest option, but can introduce some issues. Balanced offers better compatibility and may fix issues in some games. @@ -835,44 +855,44 @@ Default follows the GPU Mode setting. - + Enable asynchronous shader compilation Aktiviere asynchrones Shader-Kompilieren - + May reduce shader stutter. Kann Shader-Ruckler reduzieren. - + GPU Clocks GPU-Takte - + Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch's clocks. Führt dazu, dass das Spiel glaubt, die Arbeit der GPU würde früher fertig sein, als sie eigentlich ist. Dadurch hört das Spiel auf die Auflösung und Render-Distanz zu verringern um sich den Takten der Switch anzupassen. - + GPU Unswizzle GPU-Unswizzle - + Accelerates BCn 3D texture decoding using GPU compute. Disable if experiencing crashes or graphical glitches. Beschleunigt die Dekodierung von BCn-3D-Texturen mithilfe von GPU-Rechenleistung. Deaktiviere diese Option, falls Abstürze oder Grafikfehler auftreten. - + GPU Unswizzle Max Texture Size GPU-Unswizzle max. Texturgröße - + Sets the maximum size (MiB) for GPU-based texture unswizzling. While the GPU is faster for medium and large textures, the CPU may be more efficient for very small ones. Adjust this to find the balance between GPU acceleration and CPU overhead. @@ -881,48 +901,48 @@ Während die GPU für mittelgroße und große Texturen schneller ist, kann die C Passen Sie diesen Wert an, um das Gleichgewicht zwischen GPU-Beschleunigung und CPU-Overhead zu finden. - + GPU Unswizzle Stream Size GPU-Unswizzle-Streamgröße - + Sets the maximum amount of texture data (in MiB) processed per frame. Higher values can reduce stutter during texture loading but may impact frame consistency. Legt die maximale Menge an Texturdaten (in MiB) fest, die pro Bild verarbeitet wird. Höhere Werte können Ruckeln beim Laden von Texturen verringern, können sich jedoch auf die Bildrate auswirken. - + GPU Unswizzle Chunk Size GPU-Unswizzle Chunk-Größe - + Determines the number of depth slices processed in a single dispatch. Increasing this can improve throughput on high-end GPUs but may cause TDR or driver timeouts on weaker hardware. Legt die Anzahl der Tiefenschnitte fest, die in einem einzelnen Durchlauf verarbeitet werden. Eine Erhöhung dieses Werts kann den Durchsatz auf High-End-GPUs verbessern, bei schwächerer Hardware jedoch zu TDR- oder Treiber-Auszeiten führen. - + Use Vulkan pipeline cache Vulkan-Pipeline-Cache verwenden - + Enables GPU vendor-specific pipeline cache. This option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally. Aktiviert den herstellerspezifischen Pipeline-Cache der GPU. Diese Option kann die Ladezeit von Shadern erheblich verkürzen, wenn der Vulkan-Treiber die Pipeline-Cache-Dateien nicht intern speichert. - + Enable Compute Pipelines (Intel Vulkan Only) Aktiviere Compute-Pipelines (Nur Intel Vulkan) - + Required by some games. This setting only exists for Intel proprietary drivers and may crash if enabled. Compute pipelines are always enabled on all other drivers. @@ -931,194 +951,182 @@ Diese Einstellung ist nur bei proprietären Intel-Treibern vorhanden und kann be Bei allen anderen Treibern sind die Rechen-Rohrleitungen immer aktiviert. - + Enable Reactive Flushing Aktiviere Reactives Flushing - + Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing. Benutzt Reactive-Flushing anstatt Predictive-Flushing, welches akkurateres Speicher-Synchronisieren erlaubt. - + Sync to framerate of video playback Synchronisiere mit Bildrate von Video-Wiedergaben - + Run the game at normal speed during video playback, even when the framerate is unlocked. Lasse das Spiel in der normalen Geschwindigkeit abspielen, trotz freigeschalteter Bildrate - + Barrier feedback loops Barrier-Feedback-Schleifen - + Improves rendering of transparency effects in specific games. Verbessert das Rendering von Transparenzeffekten in bestimmten Spielen. - + Enable buffer history Puffer-Verlauf aktivieren - + Enables access to previous buffer states. This option may improve rendering quality and performance consistency in some games. Ermöglicht den Zugriff auf frühere Pufferzustände. Diese Option kann in manchen Spielen die Darstellungsqualität und die Leistungsstabilität verbessern. - + Fix bloom effects Bloom-Effekte beheben - + Removes bloom in Burnout. Entfernt Bloom in Burnout. - - Enable Legacy Rescale Pass - „Legacy Rescale Pass“ aktivieren - - - - May fix rescale issues in some games by relying on behavior from the previous implementation. -Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and grey texture flicker on Nvidia GPUs in Luigis Mansion 3. - Behebt möglicherweise Probleme mit der Skalierung in einigen Spielen, indem auf das Verhalten der vorherigen Implementierung zurückgegriffen wird. -Eine Umgehungslösung für das alte Verhalten, die Linienartefakte auf AMD- und Intel-GPUs sowie graues Texturflackern auf Nvidia-GPUs in „Luigi’s Mansion 3“ behebt. - - - + Extended Dynamic State Erweiterter dynamischer Zustand - + Controls the number of features that can be used in Extended Dynamic State. Higher states allow for more features and can increase performance, but may cause additional graphical issues. Legt die Anzahl der Funktionen fest, die im erweiterten dynamischen Modus verwendet werden können. Höhere Stufen ermöglichen mehr Funktionen und können die Leistung steigern, können jedoch zusätzliche grafische Probleme verursachen. - + Vertex Input Dynamic State Dynamischer Zustand der Scheitelpunkteingabe - + Enables vertex input dynamic state feature for better quality and performance. Aktiviert die Funktion für den dynamischen Status der Scheitelpunkteingabe, um eine bessere Qualität und Leistung zu erzielen. - + Sample Shading Probe-Schattierung - + Allows the fragment shader to execute per sample in a multi-sampled fragment instead of once per fragment. Improves graphics quality at the cost of performance. Higher values improve quality but degrade performance. Ermöglicht es dem Fragment-Shader, pro Abtastwert in einem mehrfach abgetasteten Fragment ausgeführt zu werden, anstatt nur einmal pro Fragment. Verbessert die Grafikqualität auf Kosten der Leistung. Höhere Werte verbessern die Qualität, beeinträchtigen jedoch die Leistung. - + RNG Seed Startwert für den Zufallszahlengenerator - + Controls the seed of the random number generator. Mainly used for speedrunning. Steuert den Startwert des Zufallszahlengenerators. Wird hauptsächlich für Schnelldurchläufe verwendet. - + Device Name Gerätename - + The name of the console. Der Name der Konsole. - + Homebrew Args Homebrew-Argumente - + Command-line arguments passed to homebrew at launch (e.g. -noglsl). Befehlszeilenargumente, die beim Start an Homebrew übergeben werden (z. B. -noglsl). - + Custom RTC Date: Benutzerdefinierte Echtzeituhrdatum: - + This option allows to change the clock of the console. Can be used to manipulate time in games. Diese Option erlaubt die Änderung der Uhr der Konsole. Kann benutzt werden um Zeit in Spielen zu manipulieren. - + The number of seconds from the current unix time Die Anzahl der Sekunden seit dem aktuellen Unix-Zeitstempel - + Language: Sprache: - + This option can be overridden when region setting is auto-select Diese Option kann überschrieben werden, wenn die Regionseinstellung auf „Automatische Auswahl“ steht - + Region: Region: - + The region of the console. Die Region der Konsole. - + Time Zone: Zeitzone: - + The time zone of the console. Die Zeitzone der Konsole. - + Sound Output Mode: Tonausgangsmodus: - + Console Mode: Konsolenmodus: - + Selects if the console is in Docked or Handheld mode. Games will change their resolution, details and supported controllers and depending on this setting. Setting to Handheld can help improve performance for low end systems. @@ -1127,1026 +1135,1026 @@ Je nach dieser Einstellung ändern sich bei Spielen die Auflösung, die Detailst Die Einstellung auf „Handgerät“ kann dazu beitragen, die Leistung auf Systemen mit geringerer Leistung zu verbessern. - + Prompt for user profile on boot Beim Systemstart nach dem Benutzerprofil fragen - + Useful if multiple people use the same PC. Nützlich, wenn mehrere Personen denselben PC nutzen. - + Pause when not in focus Pausieren, wenn nicht im Fokus - + Pauses emulation when focusing on other windows. Pausiert die Emulation, wenn der Fokus auf andere Fenster wechselt. - + Confirm before stopping emulation Vor dem Stoppen der Emulation bestätigen - + Overrides prompts asking to confirm stopping the emulation. Enabling it bypasses such prompts and directly exits the emulation. Überschreibt die Abfragen zur Bestätigung des Beendens der Emulation. Wenn diese Option aktiviert ist, werden solche Abfragen umgangen und die Emulation wird direkt beendet. - + Hide mouse on inactivity Mauszeiger verbergen - + Hides the mouse after 2.5s of inactivity. Verbirgt den Mauszeiger nach 2,5 Sekunden Inaktivität. - + Check for updates Auf Aktualisierungen überprüfen - + Whether or not to check for updates upon startup. Ob nach Aktualisierungen während des Startens gesucht werden soll. - + Enable Gamemode Spielmodus aktivieren - + Force X11 as Graphics Backend X11 als Grafik-Backend erzwingen - + Custom frontend Benutzerdefiniertes Frontend - + Real applet Echtes Applet - - + + Disabled Deaktiviert - + Never Niemals - + On Load Beim Laden - + Always Immer - + CPU CPU - + GPU GPU - + CPU Asynchronous CPU Asynchron - + Uncompressed (Best quality) Unkomprimiert (Beste Qualität) - + BC1 (Low quality) BC1 (Niedrige Qualität) - + BC3 (Medium quality) BC3 (Mittlere Qualität) - - + + Auto Auto - + 30 FPS 30 BpS - + 60 FPS 60 BpS - + 90 FPS 90 BpS - + 120 FPS 120 BpS - + Conservative Konservativ - + Aggressive Aggressiv - + Vulkan Vulkan - + OpenGL GLSL OpenGL GLSL - + OpenGL GLASM (Assembly Shaders, NVIDIA Only) OpenGL GLASM (Assembler-Shader, nur NVIDIA) - + OpenGL SPIR-V (Experimental, AMD/Mesa Only) OpenGL SPIR-V (experimentell, nur AMD/Mesa) - + Null Null - + Fast Schnell - - - + + + Accurate Akkurat - - - + + + Default Vorgabe - + Unsafe (fast) Unsicher (schnell) - + Safe (stable) Sicher (stabil) - + Immediate Direkt - + Balanced Ausgeglichen - + Unsafe Unsicher - + Paranoid (disables most optimizations) Paranoid (deaktiviert die meisten Optimierungen) - + Debugging Fehlerbehebung - + Dynarmic Dynarmic - + NCE NCE - + Borderless Windowed Rahmenloses Fenster - + Exclusive Fullscreen Exklusiver Vollbildmodus - + No Video Output Keine Videoausgabe - + CPU Video Decoding CPU Video Dekodierung - + GPU Video Decoding (Default) GPU Video Dekodierung (Standard) - + 0.25X (180p/270p) [EXPERIMENTAL] 0.25X (180p/270p) [EXPERIMENTELL] - + 0.5X (360p/540p) [EXPERIMENTAL] 0,5X (360p/540p) [EXPERIMENTELL] - + 0.75X (540p/810p) [EXPERIMENTAL] 0,75X (540p/810p) [EXPERIMENTELL] - + 1X (720p/1080p) 1X (720p/1080p) - + 1.25X (900p/1350p) [EXPERIMENTAL] 1.25X (900p/1350p) [EXPERIMENTELL] - + 1.5X (1080p/1620p) [EXPERIMENTAL] 1,5X (1080p/1620p) [EXPERIMENTELL] - + 2X (1440p/2160p) 2X (1440p/2160p) - + 3X (2160p/3240p) 3X (2160p/3240p) - + 4X (2880p/4320p) 4X (2880p/4320p) - + 5X (3600p/5400p) 5X (3600p/5400p) - + 6X (4320p/6480p) 6X (4320p/6480p) - + 7X (5040p/7560p) 7X (5040p/7560p) - + 8X (5760p/8640p) 8X (5760p/8640p) - + Nearest Neighbor Nearest-Neighbor - + Bilinear Bilinear - + Bicubic Bikubisch - + Gaussian Gaussian - + Lanczos Lanczos - + ScaleForce ScaleForce - + AMD FidelityFX Super Resolution AMD FidelityFX Super-Auflösung - + Area Bereich - + MMPX MMPX - + Zero-Tangent Nulltangente - + B-Spline B-Spline - + Mitchell Mitchell - + Spline-1 Spline-1 - + Snapdragon Game Super Resolution Snapdragon Spiel-Superauflösung - + Snapdragon Game Super Resolution EdgeDir Snapdragon Spiel-Superauflösung EdgeDir - + None Keiner - + FXAA FXAA - + SMAA SMAA - + Default (16:9) Vorgabe (16:9) - + Force 4:3 4:3 erzwingen - + Force 21:9 21:9 erzwingen - + Force 16:10 16:10 erzwingen - + Stretch to Window Auf Fenster anpassen - + Automatic Automatisch - + 2x 2x - + 4x 4x - + 8x 8x - + 16x 16x - + Japanese (日本語) Japanisch (日本語) - + American English Amerikanisches Englisch - + French (français) Französisch (français) - + German (Deutsch) Deutsch (German) - + Italian (italiano) Italienisch (italiano) - + Spanish (español) Spanisch (español) - + Chinese Chinesisch - + Korean (한국어) Koreanisch (한국어) - + Dutch (Nederlands) Niederländisch (Nederlands) - + Portuguese (português) Portugiesisch (português) - + Russian (Русский) Russisch (Русский) - + Taiwanese Taiwanesisch - + British English Britisches Englisch - + Canadian French Kanadisches Französisch - + Latin American Spanish Lateinamerikanisches Spanisch - + Simplified Chinese Vereinfachtes Chinesisch - + Traditional Chinese (正體中文) Traditionelles Chinesisch (正體中文) - + Brazilian Portuguese (português do Brasil) Brasilianisches Portugiesisch (português do Brasil) - + Polish (polska) Polnisch (Polen) - + Thai (แบบไทย) Thailändisch (Thailändische Version) - - + + Japan Japan - + USA USA - + Europe Europa - + Australia Australien - + China China - + Korea Korea - + Taiwan Taiwan - + Auto (%1) Auto select time zone Automatisch (%1) - + Default (%1) Default time zone Standard (%1) - + CET CET - + CST6CDT CST6CDT - + Cuba Kuba - + EET EET - + Egypt Ägypten - + Eire Eire - + EST EST - + EST5EDT EST5EDT - + GB GB - + GB-Eire GB-Eire - + GMT GMT - + GMT+0 GMT+0 - + GMT-0 GMT-0 - + GMT0 GMT0 - + Greenwich Greenwich - + Hongkong Hongkong - + HST HST - + Iceland Island - + Iran Iran - + Israel Israel - + Jamaica Jamaika - + Kwajalein Kwajalein - + Libya Libyen - + MET MET - + MST MST - + MST7MDT MST7MDT - + Navajo Navajo - + NZ NZ - + NZ-CHAT NZ-CHAT - + Poland Polen - + Portugal Portugal - + PRC PRC - + PST8PDT PST8PDT - + ROC ROC - + ROK ROK - + Singapore Singapur - + Turkey Türkei - + UCT UCT - + Universal Universal - + UTC UTC - + W-SU W-SU - + WET WET - + Zulu Zulu - + Mono Mono - + Stereo Stereo - + Surround Surround - + 4GB DRAM (Default) 4GB DRAM (Vorgabe) - + 6GB DRAM (Unsafe) 6GB DRAM (Unsicher) - + 8GB DRAM 8GB DRAM - + 10GB DRAM (Unsafe) 10GB DRAM (Unsicher) - + 12GB DRAM (Unsafe) 12GB DRAM (Unsicher) - + Docked Angedockt - + Handheld Handgerät - - + + Normal Normal - - + + Boost Beschleunigung - - + + Overclock Übertaktung - + Always ask (Default) Immer fragen (Vorgabe) - + Only if game specifies not to stop Nur wenn ein Spiel vorgibt, nicht zu stoppen - + Never ask Niemals fragen - + Very Small (16 MB) Sehr klein (16 MB) - + Small (32 MB) Klein (32 MB) - + Normal (128 MB) Normal (128 MB) - + Large (256 MB) Groß (256 MB) - + Very Large (512 MB) Sehr groß (512 MB) - + Very Low (4 MB) Sehr niedrig (4 MB) - + Low (8 MB) Niedrig (8 MB) - + Normal (16 MB) Normal (16 MB) - + Medium (32 MB) Mittel (32 MB) - + High (64 MB) Hoch (64 MB) - + Very Low (32) Sehr niedrig (32) - + Low (64) Niedrig (64) - + Normal (128) Normal (128) - + Medium (256) Mittel (256) - + High (512) Hoch (512) - + ExtendedDynamicState 1 ErweiterterDynamischerZustand 1 - + ExtendedDynamicState 2 ErweiterterDynamischerZustand 2 - + ExtendedDynamicState 3 ErweiterterDynamischerZustand 3 - + Tree View Baumansicht - + Grid View Rasteransicht diff --git a/dist/languages/el.ts b/dist/languages/el.ts index b269f194ea..b3ec9c6f5e 100644 --- a/dist/languages/el.ts +++ b/dist/languages/el.ts @@ -696,12 +696,32 @@ Aggressive mode may impact performance of other applications such as recording s - + + GPU Readback Before NCE Invalidation + + + + + Flushes GPU buffer data back to guest memory before NCE invalidates the whole guest page, preserving it while the CPU store proceeds. + + + + + Patch Runtime NROs for NCE + + + + + Applies NCE code patches to runtime-loaded NRO modules.This is required for some games to run correctly. + + + + VSync Mode: - + FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. FIFO Relaxed allows tearing as it recovers from a slow down. Mailbox can have lower latency than FIFO and does not tear but may drop frames. @@ -709,79 +729,79 @@ Immediate (no synchronization) presents whatever is available and can exhibit te - + Sync Memory Operations - + Ensures data consistency between compute and memory operations. This option fixes issues in games, but may degrade performance. Unreal Engine 4 games often see the most significant changes thereof. - + Enable asynchronous presentation (Vulkan only) - + Slightly improves performance by moving presentation to a separate CPU thread. - + Force maximum clocks (Vulkan only) - + Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed. - + Anisotropic Filtering: Ανισοτροπικό Φιλτράρισμα: - + Controls the quality of texture rendering at oblique angles. Safe to set at 16x on most GPUs. - + GPU Mode: - + Controls the GPU emulation mode. Most games render fine with Fast, but Accurate is still required for some. Particles tend to only render correctly with Accurate mode. - + DMA Accuracy: - + Controls the DMA read mode. Unsafe is faster, while Safe is more stable and can fix issues in some games. Default follows the GPU Accuracy setting. - + GPU Fence Behavior: - + Controls the GPU fence synchronization behavior. Immediate is the fastest option, but can introduce some issues. Balanced offers better compatibility and may fix issues in some games. @@ -790,1301 +810,1290 @@ Default follows the GPU Mode setting. - + Enable asynchronous shader compilation - + May reduce shader stutter. - + GPU Clocks - + Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch's clocks. - + GPU Unswizzle - + Accelerates BCn 3D texture decoding using GPU compute. Disable if experiencing crashes or graphical glitches. - + GPU Unswizzle Max Texture Size - + Sets the maximum size (MiB) for GPU-based texture unswizzling. While the GPU is faster for medium and large textures, the CPU may be more efficient for very small ones. Adjust this to find the balance between GPU acceleration and CPU overhead. - + GPU Unswizzle Stream Size - + Sets the maximum amount of texture data (in MiB) processed per frame. Higher values can reduce stutter during texture loading but may impact frame consistency. - + GPU Unswizzle Chunk Size - + Determines the number of depth slices processed in a single dispatch. Increasing this can improve throughput on high-end GPUs but may cause TDR or driver timeouts on weaker hardware. - + Use Vulkan pipeline cache - + Enables GPU vendor-specific pipeline cache. This option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally. - + Enable Compute Pipelines (Intel Vulkan Only) - + Required by some games. This setting only exists for Intel proprietary drivers and may crash if enabled. Compute pipelines are always enabled on all other drivers. - + Enable Reactive Flushing - + Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing. - + Sync to framerate of video playback - + Run the game at normal speed during video playback, even when the framerate is unlocked. - + Barrier feedback loops - + Improves rendering of transparency effects in specific games. - + Enable buffer history - + Enables access to previous buffer states. This option may improve rendering quality and performance consistency in some games. - + Fix bloom effects - + Removes bloom in Burnout. - - Enable Legacy Rescale Pass - - - - - May fix rescale issues in some games by relying on behavior from the previous implementation. -Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and grey texture flicker on Nvidia GPUs in Luigis Mansion 3. - - - - + Extended Dynamic State - + Controls the number of features that can be used in Extended Dynamic State. Higher states allow for more features and can increase performance, but may cause additional graphical issues. - + Vertex Input Dynamic State - + Enables vertex input dynamic state feature for better quality and performance. - + Sample Shading - + Allows the fragment shader to execute per sample in a multi-sampled fragment instead of once per fragment. Improves graphics quality at the cost of performance. Higher values improve quality but degrade performance. - + RNG Seed RNG Seed - + Controls the seed of the random number generator. Mainly used for speedrunning. - + Device Name - + The name of the console. - + Homebrew Args - + Command-line arguments passed to homebrew at launch (e.g. -noglsl). - + Custom RTC Date: - + This option allows to change the clock of the console. Can be used to manipulate time in games. - + The number of seconds from the current unix time - + Language: - + This option can be overridden when region setting is auto-select - + Region: Περιφέρεια: - + The region of the console. - + Time Zone: Ζώνη Ώρας: - + The time zone of the console. - + Sound Output Mode: - + Console Mode: - + Selects if the console is in Docked or Handheld mode. Games will change their resolution, details and supported controllers and depending on this setting. Setting to Handheld can help improve performance for low end systems. - + Prompt for user profile on boot - + Useful if multiple people use the same PC. - + Pause when not in focus - + Pauses emulation when focusing on other windows. - + Confirm before stopping emulation - + Overrides prompts asking to confirm stopping the emulation. Enabling it bypasses such prompts and directly exits the emulation. - + Hide mouse on inactivity Απόκρυψη δρομέα ποντικιού στην αδράνεια - + Hides the mouse after 2.5s of inactivity. - + Check for updates - + Whether or not to check for updates upon startup. - + Enable Gamemode - + Force X11 as Graphics Backend - + Custom frontend - + Real applet - - + + Disabled - + Never - + On Load - + Always - + CPU CPU - + GPU - + CPU Asynchronous - + Uncompressed (Best quality) - + BC1 (Low quality) - + BC3 (Medium quality) - - + + Auto Αυτόματη - + 30 FPS - + 60 FPS - + 90 FPS - + 120 FPS - + Conservative - + Aggressive - + Vulkan Vulkan - + OpenGL GLSL - + OpenGL GLASM (Assembly Shaders, NVIDIA Only) - + OpenGL SPIR-V (Experimental, AMD/Mesa Only) - + Null - + Fast - - - + + + Accurate Ακριβής - - - + + + Default Προεπιλεγμένο - + Unsafe (fast) - + Safe (stable) - + Immediate - + Balanced - + Unsafe Επισφαλής - + Paranoid (disables most optimizations) - + Debugging - + Dynarmic - + NCE - + Borderless Windowed Παραθυροποιημένο Χωρίς Όρια - + Exclusive Fullscreen Αποκλειστική Πλήρης Οθόνη - + No Video Output Χωρίς Έξοδο Βίντεο - + CPU Video Decoding Αποκωδικοποίηση Βίντεο CPU - + GPU Video Decoding (Default) Αποκωδικοποίηση Βίντεο GPU (Προεπιλογή) - + 0.25X (180p/270p) [EXPERIMENTAL] - + 0.5X (360p/540p) [EXPERIMENTAL] - + 0.75X (540p/810p) [EXPERIMENTAL] 0.75X (540p/810p) [ΠΕΙΡΑΜΑΤΙΚΟ] - + 1X (720p/1080p) 1X (720p/1080p) - + 1.25X (900p/1350p) [EXPERIMENTAL] - + 1.5X (1080p/1620p) [EXPERIMENTAL] - + 2X (1440p/2160p) 2X (1440p/2160p) - + 3X (2160p/3240p) 3X (2160p/3240p) - + 4X (2880p/4320p) 4X (2880p/4320p) - + 5X (3600p/5400p) 5X (3600p/5400p) - + 6X (4320p/6480p) 6X (4320p/6480p) - + 7X (5040p/7560p) - + 8X (5760p/8640p) - + Nearest Neighbor Πλησιέστερος Γείτονας - + Bilinear Διγραμμικό - + Bicubic Δικυβικό - + Gaussian Gaussian - + Lanczos - + ScaleForce ScaleForce - + AMD FidelityFX Super Resolution - + Area - + MMPX - + Zero-Tangent - + B-Spline - + Mitchell - + Spline-1 - + Snapdragon Game Super Resolution - + Snapdragon Game Super Resolution EdgeDir - + None Κανένα - + FXAA FXAA - + SMAA SMAA - + Default (16:9) Προεπιλογή (16:9) - + Force 4:3 Επιβολή 4:3 - + Force 21:9 Επιβολή 21:9 - + Force 16:10 Επιβολή 16:10 - + Stretch to Window Επέκταση στο Παράθυρο - + Automatic Αυτόματα - + 2x 2x - + 4x 4x - + 8x 8x - + 16x 16x - + Japanese (日本語) Ιαπωνικά (日本語) - + American English - + French (français) Γαλλικά (Français) - + German (Deutsch) Γερμανικά (Deutsch) - + Italian (italiano) Ιταλικά (Italiano) - + Spanish (español) Ισπανικά (Español) - + Chinese Κινέζικα - + Korean (한국어) Κορεάτικα (한국어) - + Dutch (Nederlands) Ολλανδικά (Nederlands) - + Portuguese (português) Πορτογαλικά (Português) - + Russian (Русский) Ρώσικα (Русский) - + Taiwanese Ταϊβανέζικα - + British English Βρετανικά Αγγλικά - + Canadian French Καναδικά Γαλλικά - + Latin American Spanish Λατινοαμερικάνικα Ισπανικά - + Simplified Chinese Απλοποιημένα Κινέζικα - + Traditional Chinese (正體中文) Παραδοσιακά Κινέζικα (正體中文) - + Brazilian Portuguese (português do Brasil) Πορτογαλικά Βραζιλίας (Português do Brasil) - + Polish (polska) - + Thai (แบบไทย) - - + + Japan Ιαπωνία - + USA ΗΠΑ - + Europe Ευρώπη - + Australia Αυστραλία - + China Κίνα - + Korea Κορέα - + Taiwan Ταϊβάν - + Auto (%1) Auto select time zone - + Default (%1) Default time zone - + CET CET - + CST6CDT CST6CDT - + Cuba Κούβα - + EET EET - + Egypt Αίγυπτος - + Eire - + EST EST - + EST5EDT EST5EDT - + GB - + GB-Eire - + GMT GMT - + GMT+0 GMT+0 - + GMT-0 GMT-0 - + GMT0 GMT0 - + Greenwich Γκρήνουιτς - + Hongkong Χονγκ Κονγκ - + HST HST - + Iceland Ισλανδία - + Iran Ιράν - + Israel Ισραήλ - + Jamaica Ιαμαϊκή - + Kwajalein - + Libya Λιβύη - + MET MET - + MST MST - + MST7MDT MST7MDT - + Navajo Ναβάχο - + NZ - + NZ-CHAT - + Poland Πολωνία - + Portugal Πορτογαλία - + PRC - + PST8PDT PST8PDT - + ROC ROC - + ROK ROK - + Singapore Σιγκαπούρη - + Turkey Τουρκία - + UCT UCT - + Universal Παγκόσμια - + UTC UTC - + W-SU W-SU - + WET WET - + Zulu - + Mono Μονοφωνικό - + Stereo Στέρεοφωνικό - + Surround - + 4GB DRAM (Default) - + 6GB DRAM (Unsafe) - + 8GB DRAM - + 10GB DRAM (Unsafe) - + 12GB DRAM (Unsafe) - + Docked Docked - + Handheld Handheld - - + + Normal - - + + Boost - - + + Overclock - + Always ask (Default) - + Only if game specifies not to stop - + Never ask - + Very Small (16 MB) - + Small (32 MB) - + Normal (128 MB) - + Large (256 MB) - + Very Large (512 MB) - + Very Low (4 MB) - + Low (8 MB) - + Normal (16 MB) - + Medium (32 MB) - + High (64 MB) - + Very Low (32) - + Low (64) - + Normal (128) - + Medium (256) - + High (512) - + ExtendedDynamicState 1 - + ExtendedDynamicState 2 - + ExtendedDynamicState 3 - + Tree View - + Grid View diff --git a/dist/languages/es.ts b/dist/languages/es.ts index c565dc17f2..8cda19bc6b 100644 --- a/dist/languages/es.ts +++ b/dist/languages/es.ts @@ -730,12 +730,32 @@ El modo agresivo puede afectar al rendimiento de otras aplicaciones, como a los Omite ciertas invalidaciones de caché durante las actualizaciones de memoria, reduciendo el uso de la CPU y mejorando la latencia. Esto puede causar bloqueos leves. - + + GPU Readback Before NCE Invalidation + + + + + Flushes GPU buffer data back to guest memory before NCE invalidates the whole guest page, preserving it while the CPU store proceeds. + + + + + Patch Runtime NROs for NCE + + + + + Applies NCE code patches to runtime-loaded NRO modules.This is required for some games to run correctly. + + + + VSync Mode: Modo VSync: - + FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. FIFO Relaxed allows tearing as it recovers from a slow down. Mailbox can have lower latency than FIFO and does not tear but may drop frames. @@ -746,12 +766,12 @@ Mailbox ofrece menor latencia que FIFO y evita el tearing, aunque puede perder a Immediate (sin sincronización) muestra los fotogramas tan pronto están disponibles, pero puede generar desgarros de imagen. - + Sync Memory Operations Sincronizar operaciones de memoria - + Ensures data consistency between compute and memory operations. This option fixes issues in games, but may degrade performance. Unreal Engine 4 games often see the most significant changes thereof. @@ -760,56 +780,56 @@ Esta opción arregla errores en los juegos, pero puede afectar negativamente al Los juegos con Unreal Engine 4 son con frecuencia los que muestran cambios significantes en esto. - + Enable asynchronous presentation (Vulkan only) Activar presentación asíncrona (solo Vulkan) - + Slightly improves performance by moving presentation to a separate CPU thread. Mejora el rendimiento ligeramente al usar un hilo de CPU adicional para la presentación. - + Force maximum clocks (Vulkan only) Forzar relojes al máximo (solo Vulkan) - + Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed. Ejecuta los procesos en segundo plano mientras se espera a las instrucciones gráficas para evitar que la GPU reduzca su velocidad de reloj. - + Anisotropic Filtering: Filtrado anisotrópico: - + Controls the quality of texture rendering at oblique angles. Safe to set at 16x on most GPUs. Controla la calidad del renderizado de texturas en ángulos oblicuos. Es seguro configurarlo en 16x en la mayoría de las GPU. - + GPU Mode: Modo de la GPU: - + Controls the GPU emulation mode. Most games render fine with Fast, but Accurate is still required for some. Particles tend to only render correctly with Accurate mode. - + DMA Accuracy: Precisión de DMA: - + Controls the DMA read mode. Unsafe is faster, while Safe is more stable and can fix issues in some games. Default follows the GPU Accuracy setting. @@ -818,12 +838,12 @@ Inseguro es más rápido, mientras que seguro es más estable y puede solucionar Predeterminado sigue el ajuste de la precisión de GPU. - + GPU Fence Behavior: Comportamiento de vallado de la GPU: - + Controls the GPU fence synchronization behavior. Immediate is the fastest option, but can introduce some issues. Balanced offers better compatibility and may fix issues in some games. @@ -832,44 +852,44 @@ Default follows the GPU Mode setting. - + Enable asynchronous shader compilation Activa la compilación de shaders asincrónicos - + May reduce shader stutter. Puede reducir los tirones causados por la carga de sombreadores. - + GPU Clocks Relojes de GPU - + Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch's clocks. - + GPU Unswizzle Desentrelazado de la GPU - + Accelerates BCn 3D texture decoding using GPU compute. Disable if experiencing crashes or graphical glitches. Acelera la decodificación de texturas 3D BCn mediante computación de la GPU. Desactívela si experimenta problemas o fallos gráficos. - + GPU Unswizzle Max Texture Size Tamaño máximo de textura de desentrelazado de la GPU - + Sets the maximum size (MiB) for GPU-based texture unswizzling. While the GPU is faster for medium and large textures, the CPU may be more efficient for very small ones. Adjust this to find the balance between GPU acceleration and CPU overhead. @@ -878,46 +898,46 @@ Aunque la GPU es más rápida para texturas medianas y grandes, la CPU puede ser Ajuste este valor para encontrar el equilibrio entre la aceleración de la GPU y la sobrecarga de la CPU. - + GPU Unswizzle Stream Size Tamaño del flujo de desentrelazado de la GPU - + Sets the maximum amount of texture data (in MiB) processed per frame. Higher values can reduce stutter during texture loading but may impact frame consistency. Establece la cantidad máxima de datos de textura (en MiB) procesados ​​por cada fotograma. Valores más altos pueden reducir la distorsión durante la carga de texturas, pero pueden afectar a la consistencia de los fotogramas. - + GPU Unswizzle Chunk Size Tamaño del trozo de desentrelazado de la GPU - + Determines the number of depth slices processed in a single dispatch. Increasing this can improve throughput on high-end GPUs but may cause TDR or driver timeouts on weaker hardware. Determina la cantidad de cortes de profundidad procesados ​​en un solo envío. Aumentar este valor puede mejorar el rendimiento en una GPU de gama alta, pero puede causar tirones y problemas en los tiempos de respuesta en hardware más modesto. - + Use Vulkan pipeline cache Usar caché de canalización de Vulkan - + Enables GPU vendor-specific pipeline cache. This option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally. Activa la caché de canalización específica del fabricante. Esta opción puede mejorar los tiempos de cargas de sombreadores en el caso de que el controlador de Vulkan no lo almacene internamente. - + Enable Compute Pipelines (Intel Vulkan Only) Activar la canalizaciones de cómputo (solo Intel Vulkan) - + Required by some games. This setting only exists for Intel proprietary drivers and may crash if enabled. Compute pipelines are always enabled on all other drivers. @@ -926,194 +946,182 @@ Este ajuste solo existe para los controladores propietarios de Intel y puede cau En los demás controladores, la canalización de cómputo siempre está activada. - + Enable Reactive Flushing Activar limpieza reactiva - + Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing. Usa limpieza de memoria reactiva en vez de predictiva, permitiendo una sincronización de memoria más precisa. - + Sync to framerate of video playback Sincronizar a fotogramas de reproducción de vídeo - + Run the game at normal speed during video playback, even when the framerate is unlocked. Ejecuta el juego a velocidad normal durante la reproducción de vídeos, incluso cuando no hay límite de fotogramas. - + Barrier feedback loops Bucles de feedback de barrera - + Improves rendering of transparency effects in specific games. Mejora la renderización de los efectos de transparencia en ciertos juegos. - + Enable buffer history Activar el historial del búfer - + Enables access to previous buffer states. This option may improve rendering quality and performance consistency in some games. Habilita el acceso a estados de búfer anteriores. Esta opción puede mejorar la calidad de renderizado y la consistencia en el rendimiento de algunos juegos. - + Fix bloom effects Arreglar efectos de resplandor - + Removes bloom in Burnout. Elimina el resplandor en Burnout. - - Enable Legacy Rescale Pass - Activar el pase de reescalado heredado - - - - May fix rescale issues in some games by relying on behavior from the previous implementation. -Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and grey texture flicker on Nvidia GPUs in Luigis Mansion 3. - Puede arreglar los problemas de reescalado en algunos juegos confiando en el comportamiento de la implementación anterior. -Solución alternativa de comportamiento heredado que corrige los artefactos de línea de la GPU AMD y el parpadeo de texturas gris de la GPU Nvidia en Luigis Mansion 3. - - - + Extended Dynamic State Estado dinámico extendido - + Controls the number of features that can be used in Extended Dynamic State. Higher states allow for more features and can increase performance, but may cause additional graphical issues. Controla el número de funciones que pueden ser usadas en el Estado Dinámico Extendido. Números más altos permiten úsar más funciones y pueden aumentar el rendimiento, pero tambén pueden causar errores gráficos. - + Vertex Input Dynamic State Estado dinámico de entrada de vértices - + Enables vertex input dynamic state feature for better quality and performance. Activa la función de estado dinámico de entrada de vértices para una mejor calidad y rendimiento. - + Sample Shading Sombreado de muestra - + Allows the fragment shader to execute per sample in a multi-sampled fragment instead of once per fragment. Improves graphics quality at the cost of performance. Higher values improve quality but degrade performance. Permite que el sombreador de fragmentos se ejecute por muestra en un fragmento multimuestreado, en lugar de una sola vez por fragmento. Mejora la calidad de los gráficos a costa de rendimiento. Los valores más altos mejoran la calidad, pero reducen el rendimiento. - + RNG Seed Semilla de GNA - + Controls the seed of the random number generator. Mainly used for speedrunning. Controla la semilla del generador de números aleatorios. Usado principalmente para speedrunning. - + Device Name Nombre del dispositivo - + The name of the console. El nombre de la consola - + Homebrew Args Argumentos Homebrew - + Command-line arguments passed to homebrew at launch (e.g. -noglsl). Argumentos en la línea de comandos pasados al homebrew al ser lanzado (p.e. -noglsl). - + Custom RTC Date: Fecha Personalizada RTC: - + This option allows to change the clock of the console. Can be used to manipulate time in games. Esta opción permite cambiar el reloj de la consola. Puede ser usado para manipular el tiempo en juegos. - + The number of seconds from the current unix time Número de segundos de la hora actual de Unix - + Language: Idioma: - + This option can be overridden when region setting is auto-select Esta opción puede ser reemplazada cuando la configuración de región está en selección automática. - + Region: Región: - + The region of the console. La Región de la Consola. - + Time Zone: Zona horaria: - + The time zone of the console. La zona horaria de la consola. - + Sound Output Mode: Método de salida de sonido: - + Console Mode: Modo consola: - + Selects if the console is in Docked or Handheld mode. Games will change their resolution, details and supported controllers and depending on this setting. Setting to Handheld can help improve performance for low end systems. @@ -1122,1025 +1130,1025 @@ Los juegos cambiarán su resolución, detalles y compatibilidad con los mandos s Configurar el modo portátil puede mejorar el rendimiento en sistemas de gama baja. - + Prompt for user profile on boot Solicitud para perfil de usuario al arrancar - + Useful if multiple people use the same PC. Útil si múltiples personas usan la misma PC - + Pause when not in focus Pausar cuando la ventana no esté activa - + Pauses emulation when focusing on other windows. Pausa la emulación cuando otra ventana diferente está activa. - + Confirm before stopping emulation Confirmar detención - + Overrides prompts asking to confirm stopping the emulation. Enabling it bypasses such prompts and directly exits the emulation. Anula las solicitudes de confirmación para detener la emulación. Al habilitar esta opción, se omiten dichas solicitudes y se sale directamente de la emulación. - + Hide mouse on inactivity Ocultar el cursor por inactividad. - + Hides the mouse after 2.5s of inactivity. Oculta el mouse después de 2.5s de inactividad. - + Check for updates Buscar actualizaciones - + Whether or not to check for updates upon startup. Si se deben buscar actualizaciones al iniciar o no. - + Enable Gamemode Activar Modo Juego - + Force X11 as Graphics Backend Forzar X11 como motor gráfico - + Custom frontend Interfaz personalizada - + Real applet Applet real - - + + Disabled Desactivado - + Never Nunca - + On Load Al cargar - + Always Siempre - + CPU CPU - + GPU GPU - + CPU Asynchronous CPU asíncrona - + Uncompressed (Best quality) Sin compresión (Mejor calidad) - + BC1 (Low quality) BC1 (Calidad baja) - + BC3 (Medium quality) BC3 (Calidad media) - - + + Auto Auto - + 30 FPS 30 FPS - + 60 FPS 60 FPS - + 90 FPS 90 FPS - + 120 FPS 120 FPS - + Conservative Conservativo - + Aggressive Agresivo - + Vulkan Vulkan - + OpenGL GLSL OpenGL GLSL - + OpenGL GLASM (Assembly Shaders, NVIDIA Only) OpenGL GLASM (Ensamblado de sombreadores, solo NVIDIA) - + OpenGL SPIR-V (Experimental, AMD/Mesa Only) OpenGL SPIR-V (Experimental, solo AMD/Mesa) - + Null Ninguno - + Fast Rápido - - - + + + Accurate Preciso - - - + + + Default Predeterminado - + Unsafe (fast) Inseguro (rápido) - + Safe (stable) Seguro (estable) - + Immediate Inmediato - + Balanced Balanceado - + Unsafe Impreciso - + Paranoid (disables most optimizations) Paranoico (Deshabilita la mayoría de optimizaciones) - + Debugging Depuración - + Dynarmic DynARMic - + NCE NCE - + Borderless Windowed Ventana sin bordes - + Exclusive Fullscreen Pantalla completa - + No Video Output Sin salida de vídeo - + CPU Video Decoding Decodificación de vídeo en la CPU - + GPU Video Decoding (Default) Decodificación de vídeo en GPU (Por defecto) - + 0.25X (180p/270p) [EXPERIMENTAL] 0.25X (180p/270p) [EXPERIMENTAL] - + 0.5X (360p/540p) [EXPERIMENTAL] x0,5 (360p/540p) [EXPERIMENTAL] - + 0.75X (540p/810p) [EXPERIMENTAL] x0,75 (540p/810p) [EXPERIMENTAL] - + 1X (720p/1080p) x1 (720p/1080p) - + 1.25X (900p/1350p) [EXPERIMENTAL] 1.25X (900p/1350p) [EXPERIMENTAL] - + 1.5X (1080p/1620p) [EXPERIMENTAL] x1,5 (1080p/1620p) [EXPERIMENTAL] - + 2X (1440p/2160p) x2 (1440p/2160p) - + 3X (2160p/3240p) x3 (2160p/3240p) - + 4X (2880p/4320p) x4 (2880p/4320p) - + 5X (3600p/5400p) x5 (3600p/5400p) - + 6X (4320p/6480p) x6 (4320p/6480p) - + 7X (5040p/7560p) x7 (5040p/7560p) - + 8X (5760p/8640p) x8 (5760p/8640p) - + Nearest Neighbor Vecino más próximo - + Bilinear Bilineal - + Bicubic Bicúbico - + Gaussian Gaussiano - + Lanczos Lanczos - + ScaleForce ScaleForce - + AMD FidelityFX Super Resolution Super Resolución AMD FidelityFX - + Area Área - + MMPX MMPX - + Zero-Tangent Tangente cero - + B-Spline Ranura B - + Mitchell Mitchell - + Spline-1 Spline-1 - + Snapdragon Game Super Resolution Super resolución de juego Snapdragon - + Snapdragon Game Super Resolution EdgeDir Filo direcorio de super resolución de juego Snapdragon - + None Ninguno - + FXAA FXAA - + SMAA SMAA - + Default (16:9) Predeterminado (16:9) - + Force 4:3 Forzar 4:3 - + Force 21:9 Forzar 21:9 - + Force 16:10 Forzar 16:10 - + Stretch to Window Estirar a la ventana - + Automatic Automático - + 2x x2 - + 4x x4 - + 8x x8 - + 16x x16 - + Japanese (日本語) Japonés (日本語) - + American English Inglés estadounidense - + French (français) Francés (français) - + German (Deutsch) Alemán (deutsch) - + Italian (italiano) Italiano (italiano) - + Spanish (español) Español - + Chinese Chino - + Korean (한국어) Coreano (한국어) - + Dutch (Nederlands) Holandés (nederlands) - + Portuguese (português) Portugués (português) - + Russian (Русский) Ruso (Русский) - + Taiwanese Taiwanés - + British English Inglés británico - + Canadian French Francés canadiense - + Latin American Spanish Español latinoamericano - + Simplified Chinese Chino simplificado - + Traditional Chinese (正體中文) Chino tradicional (正體中文) - + Brazilian Portuguese (português do Brasil) Portugués brasileño (português do Brasil) - + Polish (polska) Polaco (polska) - + Thai (แบบไทย) Tailandés (แบบไทย) - - + + Japan Japón - + USA EEUU - + Europe Europa - + Australia Australia - + China China - + Korea Corea - + Taiwan Taiwán - + Auto (%1) Auto select time zone Auto (%1) - + Default (%1) Default time zone Predeterminada (%1) - + CET CET - + CST6CDT CST6CDT - + Cuba Cuba - + EET EET - + Egypt Egipto - + Eire Eire - + EST EST - + EST5EDT EST5EDT - + GB GB - + GB-Eire GB-Eire - + GMT GMT - + GMT+0 GMT+0 - + GMT-0 GMT-0 - + GMT0 GMT0 - + Greenwich Greenwich - + Hongkong Hongkong - + HST HST - + Iceland Islandia - + Iran Irán - + Israel Israel - + Jamaica Jamaica - + Kwajalein Kwajalein - + Libya Libia - + MET MET - + MST MST - + MST7MDT MST7MDT - + Navajo Navajo - + NZ NZ - + NZ-CHAT NZ-CHAT - + Poland Polonia - + Portugal Portugal - + PRC PRC - + PST8PDT PST8PDT - + ROC ROC - + ROK ROK - + Singapore Singapur - + Turkey Turquía - + UCT UCT - + Universal Universal - + UTC UTC - + W-SU W-SU - + WET WET - + Zulu Zulú - + Mono Mono - + Stereo Estéreo - + Surround Envolvente - + 4GB DRAM (Default) 4GB DRAM (Por defecto) - + 6GB DRAM (Unsafe) 6GB DRAM (Inseguro) - + 8GB DRAM 8GB DRAM - + 10GB DRAM (Unsafe) 10GB DRAM (Inseguro) - + 12GB DRAM (Unsafe) 12GB DRAM (Inseguro) - + Docked Sobremesa - + Handheld Portátil - - + + Normal Normal - - + + Boost Impulso - - + + Overclock Overclock - + Always ask (Default) Preguntar siempre (Por defecto) - + Only if game specifies not to stop Solo si el juego pide no ser cerrado - + Never ask Nunca preguntar - + Very Small (16 MB) Muy pequeño (16 MB) - + Small (32 MB) Pequeño (32 MB) - + Normal (128 MB) Normal (128 MB) - + Large (256 MB) Grande (256 MB) - + Very Large (512 MB) Muy grande (512 MB) - + Very Low (4 MB) Muy bajo (4 MB) - + Low (8 MB) Bajo (8 MB) - + Normal (16 MB) Normal (16 MB) - + Medium (32 MB) Medio (32 MB) - + High (64 MB) Alto (64 MB) - + Very Low (32) Muy bajo (32) - + Low (64) Bajo (64) - + Normal (128) Normal (128) - + Medium (256) Medio (256) - + High (512) Alto (512) - + ExtendedDynamicState 1 ModoDynamicoExtendido 1 - + ExtendedDynamicState 2 ModoDynamicoExtendido 2 - + ExtendedDynamicState 3 ModoDynamicoExtendido 3 - + Tree View Vista en árbol - + Grid View Vista en cuadrícula diff --git a/dist/languages/fi.ts b/dist/languages/fi.ts index 2873cb1c05..5b075f0b0e 100644 --- a/dist/languages/fi.ts +++ b/dist/languages/fi.ts @@ -696,12 +696,32 @@ Aggressive mode may impact performance of other applications such as recording s - + + GPU Readback Before NCE Invalidation + + + + + Flushes GPU buffer data back to guest memory before NCE invalidates the whole guest page, preserving it while the CPU store proceeds. + + + + + Patch Runtime NROs for NCE + + + + + Applies NCE code patches to runtime-loaded NRO modules.This is required for some games to run correctly. + + + + VSync Mode: - + FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. FIFO Relaxed allows tearing as it recovers from a slow down. Mailbox can have lower latency than FIFO and does not tear but may drop frames. @@ -709,79 +729,79 @@ Immediate (no synchronization) presents whatever is available and can exhibit te - + Sync Memory Operations - + Ensures data consistency between compute and memory operations. This option fixes issues in games, but may degrade performance. Unreal Engine 4 games often see the most significant changes thereof. - + Enable asynchronous presentation (Vulkan only) - + Slightly improves performance by moving presentation to a separate CPU thread. - + Force maximum clocks (Vulkan only) - + Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed. - + Anisotropic Filtering: - + Controls the quality of texture rendering at oblique angles. Safe to set at 16x on most GPUs. - + GPU Mode: - + Controls the GPU emulation mode. Most games render fine with Fast, but Accurate is still required for some. Particles tend to only render correctly with Accurate mode. - + DMA Accuracy: - + Controls the DMA read mode. Unsafe is faster, while Safe is more stable and can fix issues in some games. Default follows the GPU Accuracy setting. - + GPU Fence Behavior: - + Controls the GPU fence synchronization behavior. Immediate is the fastest option, but can introduce some issues. Balanced offers better compatibility and may fix issues in some games. @@ -790,1301 +810,1290 @@ Default follows the GPU Mode setting. - + Enable asynchronous shader compilation - + May reduce shader stutter. - + GPU Clocks - + Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch's clocks. - + GPU Unswizzle - + Accelerates BCn 3D texture decoding using GPU compute. Disable if experiencing crashes or graphical glitches. - + GPU Unswizzle Max Texture Size - + Sets the maximum size (MiB) for GPU-based texture unswizzling. While the GPU is faster for medium and large textures, the CPU may be more efficient for very small ones. Adjust this to find the balance between GPU acceleration and CPU overhead. - + GPU Unswizzle Stream Size - + Sets the maximum amount of texture data (in MiB) processed per frame. Higher values can reduce stutter during texture loading but may impact frame consistency. - + GPU Unswizzle Chunk Size - + Determines the number of depth slices processed in a single dispatch. Increasing this can improve throughput on high-end GPUs but may cause TDR or driver timeouts on weaker hardware. - + Use Vulkan pipeline cache - + Enables GPU vendor-specific pipeline cache. This option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally. - + Enable Compute Pipelines (Intel Vulkan Only) - + Required by some games. This setting only exists for Intel proprietary drivers and may crash if enabled. Compute pipelines are always enabled on all other drivers. - + Enable Reactive Flushing - + Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing. - + Sync to framerate of video playback - + Run the game at normal speed during video playback, even when the framerate is unlocked. - + Barrier feedback loops - + Improves rendering of transparency effects in specific games. - + Enable buffer history - + Enables access to previous buffer states. This option may improve rendering quality and performance consistency in some games. - + Fix bloom effects - + Removes bloom in Burnout. - - Enable Legacy Rescale Pass - - - - - May fix rescale issues in some games by relying on behavior from the previous implementation. -Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and grey texture flicker on Nvidia GPUs in Luigis Mansion 3. - - - - + Extended Dynamic State - + Controls the number of features that can be used in Extended Dynamic State. Higher states allow for more features and can increase performance, but may cause additional graphical issues. - + Vertex Input Dynamic State - + Enables vertex input dynamic state feature for better quality and performance. - + Sample Shading - + Allows the fragment shader to execute per sample in a multi-sampled fragment instead of once per fragment. Improves graphics quality at the cost of performance. Higher values improve quality but degrade performance. - + RNG Seed - + Controls the seed of the random number generator. Mainly used for speedrunning. - + Device Name - + The name of the console. - + Homebrew Args - + Command-line arguments passed to homebrew at launch (e.g. -noglsl). - + Custom RTC Date: - + This option allows to change the clock of the console. Can be used to manipulate time in games. - + The number of seconds from the current unix time - + Language: - + This option can be overridden when region setting is auto-select - + Region: - + The region of the console. - + Time Zone: - + The time zone of the console. - + Sound Output Mode: - + Console Mode: - + Selects if the console is in Docked or Handheld mode. Games will change their resolution, details and supported controllers and depending on this setting. Setting to Handheld can help improve performance for low end systems. - + Prompt for user profile on boot - + Useful if multiple people use the same PC. - + Pause when not in focus - + Pauses emulation when focusing on other windows. - + Confirm before stopping emulation - + Overrides prompts asking to confirm stopping the emulation. Enabling it bypasses such prompts and directly exits the emulation. - + Hide mouse on inactivity - + Hides the mouse after 2.5s of inactivity. - + Check for updates - + Whether or not to check for updates upon startup. - + Enable Gamemode - + Force X11 as Graphics Backend - + Custom frontend - + Real applet - - + + Disabled - + Never - + On Load - + Always - + CPU - + GPU - + CPU Asynchronous - + Uncompressed (Best quality) - + BC1 (Low quality) - + BC3 (Medium quality) - - + + Auto - + 30 FPS - + 60 FPS - + 90 FPS - + 120 FPS - + Conservative - + Aggressive - + Vulkan - + OpenGL GLSL - + OpenGL GLASM (Assembly Shaders, NVIDIA Only) - + OpenGL SPIR-V (Experimental, AMD/Mesa Only) - + Null - + Fast - - - + + + Accurate - - - + + + Default - + Unsafe (fast) - + Safe (stable) - + Immediate - + Balanced - + Unsafe - + Paranoid (disables most optimizations) - + Debugging - + Dynarmic - + NCE - + Borderless Windowed - + Exclusive Fullscreen - + No Video Output - + CPU Video Decoding - + GPU Video Decoding (Default) - + 0.25X (180p/270p) [EXPERIMENTAL] - + 0.5X (360p/540p) [EXPERIMENTAL] - + 0.75X (540p/810p) [EXPERIMENTAL] - + 1X (720p/1080p) - + 1.25X (900p/1350p) [EXPERIMENTAL] - + 1.5X (1080p/1620p) [EXPERIMENTAL] - + 2X (1440p/2160p) - + 3X (2160p/3240p) - + 4X (2880p/4320p) - + 5X (3600p/5400p) - + 6X (4320p/6480p) - + 7X (5040p/7560p) - + 8X (5760p/8640p) - + Nearest Neighbor - + Bilinear - + Bicubic - + Gaussian - + Lanczos - + ScaleForce - + AMD FidelityFX Super Resolution - + Area - + MMPX - + Zero-Tangent - + B-Spline - + Mitchell - + Spline-1 - + Snapdragon Game Super Resolution - + Snapdragon Game Super Resolution EdgeDir - + None - + FXAA - + SMAA - + Default (16:9) - + Force 4:3 - + Force 21:9 - + Force 16:10 - + Stretch to Window - + Automatic - + 2x - + 4x - + 8x - + 16x - + Japanese (日本語) - + American English - + French (français) - + German (Deutsch) - + Italian (italiano) - + Spanish (español) - + Chinese - + Korean (한국어) - + Dutch (Nederlands) - + Portuguese (português) - + Russian (Русский) - + Taiwanese - + British English - + Canadian French - + Latin American Spanish - + Simplified Chinese - + Traditional Chinese (正體中文) - + Brazilian Portuguese (português do Brasil) - + Polish (polska) - + Thai (แบบไทย) - - + + Japan - + USA - + Europe - + Australia - + China - + Korea - + Taiwan - + Auto (%1) Auto select time zone - + Default (%1) Default time zone - + CET - + CST6CDT - + Cuba - + EET - + Egypt - + Eire - + EST - + EST5EDT - + GB - + GB-Eire - + GMT - + GMT+0 - + GMT-0 - + GMT0 - + Greenwich - + Hongkong - + HST - + Iceland - + Iran - + Israel - + Jamaica - + Kwajalein - + Libya - + MET - + MST - + MST7MDT - + Navajo - + NZ - + NZ-CHAT - + Poland - + Portugal - + PRC - + PST8PDT - + ROC - + ROK - + Singapore - + Turkey - + UCT - + Universal - + UTC - + W-SU - + WET - + Zulu - + Mono - + Stereo - + Surround - + 4GB DRAM (Default) - + 6GB DRAM (Unsafe) - + 8GB DRAM - + 10GB DRAM (Unsafe) - + 12GB DRAM (Unsafe) - + Docked - + Handheld - - - - Normal - - - - - - Boost - - + Normal + + + + + + Boost + + + + + Overclock - + Always ask (Default) - + Only if game specifies not to stop - + Never ask - + Very Small (16 MB) - + Small (32 MB) - + Normal (128 MB) - + Large (256 MB) - + Very Large (512 MB) - + Very Low (4 MB) - + Low (8 MB) - + Normal (16 MB) - + Medium (32 MB) - + High (64 MB) - + Very Low (32) - + Low (64) - + Normal (128) - + Medium (256) - + High (512) - + ExtendedDynamicState 1 - + ExtendedDynamicState 2 - + ExtendedDynamicState 3 - + Tree View - + Grid View diff --git a/dist/languages/fr.ts b/dist/languages/fr.ts index 99f926752e..2f2ddd1481 100644 --- a/dist/languages/fr.ts +++ b/dist/languages/fr.ts @@ -729,12 +729,32 @@ Le mode agressif peut affecter les performances d’autres applications, comme l Ignore certaines invalidations de cache lors des mises à jour de la mémoire, réduisant l’utilisation du CPU et améliorant la latence. Cela peut provoquer des plantages légers. - + + GPU Readback Before NCE Invalidation + + + + + Flushes GPU buffer data back to guest memory before NCE invalidates the whole guest page, preserving it while the CPU store proceeds. + + + + + Patch Runtime NROs for NCE + + + + + Applies NCE code patches to runtime-loaded NRO modules.This is required for some games to run correctly. + + + + VSync Mode: Mode VSync : - + FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. FIFO Relaxed allows tearing as it recovers from a slow down. Mailbox can have lower latency than FIFO and does not tear but may drop frames. @@ -745,12 +765,12 @@ Mailbox peut offrir une latence inférieure à FIFO et n’entraîne pas de déc Immediate (pas de synchronisation) affiche ce qui est disponible et peut provoquer du déchirement. - + Sync Memory Operations Synchroniser les opérations mémoire - + Ensures data consistency between compute and memory operations. This option fixes issues in games, but may degrade performance. Unreal Engine 4 games often see the most significant changes thereof. @@ -759,68 +779,68 @@ Cette option corrige des problèmes dans les jeux, mais peut dégrader les perfo Les jeux Unreal Engine 4 sont souvent ceux qui bénéficient le plus de ce réglage. - + Enable asynchronous presentation (Vulkan only) Activer la présentation asynchrone (Vulkan uniquement) - + Slightly improves performance by moving presentation to a separate CPU thread. Améliore légèrement les performances en déplaçant la présentation vers un thread CPU séparé. - + Force maximum clocks (Vulkan only) Forcer la fréquence d'horloge maximale (Vulkan uniquement) - + Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed. Les exécutions fonctionnent en arrière-plan en attendant les commandes graphiques pour empêcher le GPU de réduire sa vitesse de fréquence d'horloge. - + Anisotropic Filtering: Filtrage anisotropique : - + Controls the quality of texture rendering at oblique angles. Safe to set at 16x on most GPUs. Contrôle la qualité du rendu des textures sous des angles obliques. Il est sûr de le régler à 16x sur la plupart des GPU. - + GPU Mode: Mode GPU : - + Controls the GPU emulation mode. Most games render fine with Fast, but Accurate is still required for some. Particles tend to only render correctly with Accurate mode. - + DMA Accuracy: Précision du DMA : - + Controls the DMA read mode. Unsafe is faster, while Safe is more stable and can fix issues in some games. Default follows the GPU Accuracy setting. - + GPU Fence Behavior: - + Controls the GPU fence synchronization behavior. Immediate is the fastest option, but can introduce some issues. Balanced offers better compatibility and may fix issues in some games. @@ -829,89 +849,89 @@ Default follows the GPU Mode setting. - + Enable asynchronous shader compilation Activer la compilation asynchrone des shaders - + May reduce shader stutter. Peut réduire les saccades dues aux shaders. - + GPU Clocks - + Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch's clocks. - + GPU Unswizzle - + Accelerates BCn 3D texture decoding using GPU compute. Disable if experiencing crashes or graphical glitches. - + GPU Unswizzle Max Texture Size - + Sets the maximum size (MiB) for GPU-based texture unswizzling. While the GPU is faster for medium and large textures, the CPU may be more efficient for very small ones. Adjust this to find the balance between GPU acceleration and CPU overhead. - + GPU Unswizzle Stream Size - + Sets the maximum amount of texture data (in MiB) processed per frame. Higher values can reduce stutter during texture loading but may impact frame consistency. - + GPU Unswizzle Chunk Size - + Determines the number of depth slices processed in a single dispatch. Increasing this can improve throughput on high-end GPUs but may cause TDR or driver timeouts on weaker hardware. - + Use Vulkan pipeline cache Utiliser le cache de pipeline Vulkan - + Enables GPU vendor-specific pipeline cache. This option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally. Active le cache de pipeline spécifique au fournisseur de GPU. Cette option peut améliorer considérablement le temps de chargement des shaders dans les cas où le pilote Vulkan ne stocke pas les fichiers de cache de pipeline en interne. - + Enable Compute Pipelines (Intel Vulkan Only) Activer les pipelines de calcul (Vulkan sur Intel uniquement) - + Required by some games. This setting only exists for Intel proprietary drivers and may crash if enabled. Compute pipelines are always enabled on all other drivers. @@ -920,95 +940,84 @@ Ce réglage n’existe que pour les pilotes propriétaires Intel et peut provoqu Les pipelines de calcul sont toujours activés sur tous les autres pilotes. - + Enable Reactive Flushing Activer le Vidage Réactif - + Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing. Utilise une purge réactive au lieu d'une purge prédictive, permettant une synchronisation de la mémoire plus précise. - + Sync to framerate of video playback Synchro la fréquence d'image de la relecture du vidéo - + Run the game at normal speed during video playback, even when the framerate is unlocked. Éxécuter le jeu à une vitesse normale pendant la relecture du vidéo, même-ci la fréquence d'image est dévérouillée. - + Barrier feedback loops Boucles de rétroaction de barrière - + Improves rendering of transparency effects in specific games. Améliore le rendu des effets de transparence dans des jeux spécifiques. - + Enable buffer history - + Enables access to previous buffer states. This option may improve rendering quality and performance consistency in some games. - + Fix bloom effects - + Removes bloom in Burnout. - - Enable Legacy Rescale Pass - - - - - May fix rescale issues in some games by relying on behavior from the previous implementation. -Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and grey texture flicker on Nvidia GPUs in Luigis Mansion 3. - - - - + Extended Dynamic State État dynamique étendu - + Controls the number of features that can be used in Extended Dynamic State. Higher states allow for more features and can increase performance, but may cause additional graphical issues. - + Vertex Input Dynamic State - + Enables vertex input dynamic state feature for better quality and performance. - + Sample Shading Échantillonnage de shading - + Allows the fragment shader to execute per sample in a multi-sampled fragment instead of once per fragment. Improves graphics quality at the cost of performance. Higher values improve quality but degrade performance. Permet au shader de fragments de s’exécuter pour chaque échantillon dans un fragment multi-échantillonné, au lieu d’une seule fois par fragment. @@ -1016,96 +1025,96 @@ Améliore la qualité graphique au prix de performances réduites. Des valeurs plus élevées améliorent la qualité mais dégradent les performances. - + RNG Seed Seed RNG - + Controls the seed of the random number generator. Mainly used for speedrunning. Contrôle la graine du générateur de nombres aléatoires. Principalement utilisé pour le speedrun. - + Device Name Nom de l'appareil - + The name of the console. Nom de la console. - + Homebrew Args - + Command-line arguments passed to homebrew at launch (e.g. -noglsl). - + Custom RTC Date: Date RTC personnalisée : - + This option allows to change the clock of the console. Can be used to manipulate time in games. Cette option permet de modifier l’horloge de la console. Peut être utilisée pour manipuler le temps dans les jeux. - + The number of seconds from the current unix time Nombre de secondes écoulées depuis le 1er janvier 1970. - + Language: Langue : - + This option can be overridden when region setting is auto-select Cette option peut être remplacée lorsque la région est sur auto. - + Region: Région : - + The region of the console. Région de la console. - + Time Zone: Fuseau horaire : - + The time zone of the console. Fuseau horaire de la console. - + Sound Output Mode: Mode de sortie sonore : - + Console Mode: Mode console : - + Selects if the console is in Docked or Handheld mode. Games will change their resolution, details and supported controllers and depending on this setting. Setting to Handheld can help improve performance for low end systems. @@ -1114,1026 +1123,1026 @@ Les jeux adaptent leur résolution, leurs paramètres graphiques et les manettes Passer en mode Portable peut améliorer les performances sur les systèmes peu puissants. - + Prompt for user profile on boot Choisir l’utilisateur au démarrage. - + Useful if multiple people use the same PC. Utile si plusieurs personnes utilisent le même PC. - + Pause when not in focus Pause lorsque la fenêtre n’est pas active. - + Pauses emulation when focusing on other windows. Met l’émulation en pause dès que l’utilisateur change de fenêtre. - + Confirm before stopping emulation Confirmer avant d'arrêter l'émulation - + Overrides prompts asking to confirm stopping the emulation. Enabling it bypasses such prompts and directly exits the emulation. Ignore les demandes de confirmation pour arrêter l’émulation. L’activer permet de contourner ces confirmations et de quitter directement l’émulation. - + Hide mouse on inactivity Cacher la souris en cas d'inactivité - + Hides the mouse after 2.5s of inactivity. Cache le curseur après 2,5 secondes d’inactivité. - + Check for updates Rechercher des mises à jours - + Whether or not to check for updates upon startup. Vérifier ou non les mises à jour au démarrage. - + Enable Gamemode Activer le mode jeu - + Force X11 as Graphics Backend Forcer X11 comme moteur graphique - + Custom frontend Interface personnalisée - + Real applet Applet réel - - + + Disabled Désactivé - + Never Jamais - + On Load Au chargement - + Always Toujours - + CPU CPU - + GPU GPU - + CPU Asynchronous CPU Asynchrone - + Uncompressed (Best quality) Non compressé (Meilleure qualité) - + BC1 (Low quality) BC1 (Basse qualité) - + BC3 (Medium quality) BC3 (Qualité moyenne) - - + + Auto Auto - + 30 FPS - + 60 FPS - + 90 FPS - + 120 FPS - + Conservative Conservateur - + Aggressive Agressif - + Vulkan Vulkan - + OpenGL GLSL OpenGL GLSL - + OpenGL GLASM (Assembly Shaders, NVIDIA Only) - + OpenGL SPIR-V (Experimental, AMD/Mesa Only) - + Null Nul - + Fast Rapide - - - + + + Accurate Précis - - - + + + Default Par défaut - + Unsafe (fast) Insecure (rapide) - + Safe (stable) Sûr (stable) - + Immediate - + Balanced Moyen - + Unsafe Risqué - + Paranoid (disables most optimizations) Paranoïaque (désactive la plupart des optimisations) - + Debugging Débogage - + Dynarmic Dynamique - + NCE NCE - + Borderless Windowed Fenêtré sans bordure - + Exclusive Fullscreen Plein écran exclusif - + No Video Output Pas de sortie vidéo - + CPU Video Decoding Décodage Vidéo sur le CPU - + GPU Video Decoding (Default) Décodage Vidéo sur le GPU (par défaut) - + 0.25X (180p/270p) [EXPERIMENTAL] 0.25X (180p/270p) [EXPÉRIMENTAL] - + 0.5X (360p/540p) [EXPERIMENTAL] 0.5X (360p/540p) [EXPERIMENTAL] - + 0.75X (540p/810p) [EXPERIMENTAL] 0.75X (540p/810p) [EXPÉRIMENTAL] - + 1X (720p/1080p) 1X (720p/1080p) - + 1.25X (900p/1350p) [EXPERIMENTAL] 1,25X (900p/1350p) [EXPÉRIMENTAL] - + 1.5X (1080p/1620p) [EXPERIMENTAL] 1.5X (1080p/1620p) [EXPÉRIMENTAL] - + 2X (1440p/2160p) 2X (1440p/2160p) - + 3X (2160p/3240p) 3X (2160p/3240p) - + 4X (2880p/4320p) 4X (2880p/4320p) - + 5X (3600p/5400p) 5X (3600p/5400p) - + 6X (4320p/6480p) 6X (4320p/6480p) - + 7X (5040p/7560p) 7X (5040p/7560p) - + 8X (5760p/8640p) 8X (5760p/8640p) - + Nearest Neighbor Plus proche voisin - + Bilinear Bilinéaire - + Bicubic Bicubique - + Gaussian Gaussien - + Lanczos Lanczos - + ScaleForce ScaleForce - + AMD FidelityFX Super Resolution AMD FidelityFX Super Resolution - + Area Area (Par zone) - + MMPX MMPX - + Zero-Tangent Zero-Tangent - + B-Spline B-Spline - + Mitchell Mitchell - + Spline-1 Spline-1 - + Snapdragon Game Super Resolution - + Snapdragon Game Super Resolution EdgeDir - + None Aucun - + FXAA FXAA - + SMAA SMAA - + Default (16:9) Par défaut (16:9) - + Force 4:3 Forcer le 4:3 - + Force 21:9 Forcer le 21:9 - + Force 16:10 Forcer le 16:10 - + Stretch to Window Étirer à la fenêtre - + Automatic Automatique - + 2x 2x - + 4x 4x - + 8x 8x - + 16x 16x - + Japanese (日本語) Japonais (日本語) - + American English Anglais Américain - + French (français) Français (français) - + German (Deutsch) Allemand (Deutsch) - + Italian (italiano) Italien (italiano) - + Spanish (español) Espagnol (español) - + Chinese Chinois - + Korean (한국어) Coréen (한국어) - + Dutch (Nederlands) Néerlandais (Nederlands) - + Portuguese (português) Portugais (português) - + Russian (Русский) Russe (Русский) - + Taiwanese Taïwanais - + British English Anglais Britannique - + Canadian French Français Canadien - + Latin American Spanish Espagnol d'Amérique Latine - + Simplified Chinese Chinois Simplifié - + Traditional Chinese (正體中文) Chinois Traditionnel (正體中文) - + Brazilian Portuguese (português do Brasil) Portugais Brésilien (português do Brasil) - + Polish (polska) - + Thai (แบบไทย) - - + + Japan Japon - + USA É.-U.A. - + Europe Europe - + Australia Australie - + China Chine - + Korea Corée - + Taiwan Taïwan - + Auto (%1) Auto select time zone Auto (%1) - + Default (%1) Default time zone Par défaut (%1) - + CET CET - + CST6CDT CST6CDT - + Cuba Cuba - + EET EET - + Egypt Égypte - + Eire Eire - + EST EST - + EST5EDT EST5EDT - + GB GB - + GB-Eire GB-Eire - + GMT GMT - + GMT+0 GMT+0 - + GMT-0 GMT-0 - + GMT0 GMT0 - + Greenwich Greenwich - + Hongkong Hong Kong - + HST HST - + Iceland Islande - + Iran Iran - + Israel Israël - + Jamaica Jamaïque - + Kwajalein Kwajalein - + Libya Libye - + MET MET - + MST MST - + MST7MDT MST7MDT - + Navajo Navajo - + NZ NZ - + NZ-CHAT NZ-CHAT - + Poland Pologne - + Portugal Portugal - + PRC PRC - + PST8PDT PST8PDT - + ROC ROC - + ROK ROK - + Singapore Singapour - + Turkey Turquie - + UCT UCT - + Universal Universel - + UTC UTC - + W-SU W-SU - + WET WET - + Zulu Zulu - + Mono Mono - + Stereo Stéréo - + Surround Surround - + 4GB DRAM (Default) 4 GB DRAM (Par défaut) - + 6GB DRAM (Unsafe) 6 GB DRAM (Risqué) - + 8GB DRAM 8GO DRAM - + 10GB DRAM (Unsafe) 10GO DRAM (Insecure) - + 12GB DRAM (Unsafe) 12GO DRAM (Insecure) - + Docked Mode TV - + Handheld Mode Portable - - + + Normal - - + + Boost - - + + Overclock - + Always ask (Default) Toujours demander (par défaut) - + Only if game specifies not to stop Uniquement si le jeu précise de ne pas s'arrêter - + Never ask Jamais demander - + Very Small (16 MB) Très petit (16Mo) - + Small (32 MB) Petit (32Mo) - + Normal (128 MB) Normal (128Mo) - + Large (256 MB) Large (256Mo) - + Very Large (512 MB) Très large (512Mo) - + Very Low (4 MB) Très faible (4 Mo) - + Low (8 MB) Faible (8 Mo) - + Normal (16 MB) Normal (16 Mo) - + Medium (32 MB) Moyen (32 Mo) - + High (64 MB) Élevé (64 Mo) - + Very Low (32) Très faible (32) - + Low (64) Faible (64) - + Normal (128) Normal (128) - + Medium (256) Moyen (256) - + High (512) Élevé (512) - + ExtendedDynamicState 1 État dynamique étendu 1 - + ExtendedDynamicState 2 État dynamique étendu 2 - + ExtendedDynamicState 3 État dynamique étendu 3 - + Tree View Vue en liste - + Grid View Vue en grille diff --git a/dist/languages/hu.ts b/dist/languages/hu.ts index a519b354b3..29ba70527e 100644 --- a/dist/languages/hu.ts +++ b/dist/languages/hu.ts @@ -702,12 +702,32 @@ Aggressive mode may impact performance of other applications such as recording s - + + GPU Readback Before NCE Invalidation + + + + + Flushes GPU buffer data back to guest memory before NCE invalidates the whole guest page, preserving it while the CPU store proceeds. + + + + + Patch Runtime NROs for NCE + + + + + Applies NCE code patches to runtime-loaded NRO modules.This is required for some games to run correctly. + + + + VSync Mode: VSync mód: - + FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. FIFO Relaxed allows tearing as it recovers from a slow down. Mailbox can have lower latency than FIFO and does not tear but may drop frames. @@ -715,79 +735,79 @@ Immediate (no synchronization) presents whatever is available and can exhibit te - + Sync Memory Operations - + Ensures data consistency between compute and memory operations. This option fixes issues in games, but may degrade performance. Unreal Engine 4 games often see the most significant changes thereof. - + Enable asynchronous presentation (Vulkan only) Aszinkron prezentálás engedélyezése (csak Vulkan) - + Slightly improves performance by moving presentation to a separate CPU thread. Kicsit javítja a teljesítményt azáltal, hogy a megjelenítést külön CPU szálra helyezi át. - + Force maximum clocks (Vulkan only) Maximális órajelek kényszerítése (csak Vulkan) - + Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed. A háttérben fut, miközben várja a grafikai parancsokat, hogy a GPU ne csökkentse az órajelét. - + Anisotropic Filtering: Anizotropikus szűrés: - + Controls the quality of texture rendering at oblique angles. Safe to set at 16x on most GPUs. - + GPU Mode: - + Controls the GPU emulation mode. Most games render fine with Fast, but Accurate is still required for some. Particles tend to only render correctly with Accurate mode. - + DMA Accuracy: - + Controls the DMA read mode. Unsafe is faster, while Safe is more stable and can fix issues in some games. Default follows the GPU Accuracy setting. - + GPU Fence Behavior: - + Controls the GPU fence synchronization behavior. Immediate is the fastest option, but can introduce some issues. Balanced offers better compatibility and may fix issues in some games. @@ -796,1301 +816,1290 @@ Default follows the GPU Mode setting. - + Enable asynchronous shader compilation - + May reduce shader stutter. - + GPU Clocks - + Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch's clocks. - + GPU Unswizzle - + Accelerates BCn 3D texture decoding using GPU compute. Disable if experiencing crashes or graphical glitches. - + GPU Unswizzle Max Texture Size - + Sets the maximum size (MiB) for GPU-based texture unswizzling. While the GPU is faster for medium and large textures, the CPU may be more efficient for very small ones. Adjust this to find the balance between GPU acceleration and CPU overhead. - + GPU Unswizzle Stream Size - + Sets the maximum amount of texture data (in MiB) processed per frame. Higher values can reduce stutter during texture loading but may impact frame consistency. - + GPU Unswizzle Chunk Size - + Determines the number of depth slices processed in a single dispatch. Increasing this can improve throughput on high-end GPUs but may cause TDR or driver timeouts on weaker hardware. - + Use Vulkan pipeline cache Vulkan pipeline gyorsítótár használata. - + Enables GPU vendor-specific pipeline cache. This option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally. - + Enable Compute Pipelines (Intel Vulkan Only) - + Required by some games. This setting only exists for Intel proprietary drivers and may crash if enabled. Compute pipelines are always enabled on all other drivers. - + Enable Reactive Flushing Reaktív ürítés használata - + Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing. Reaktív ürítést használ a prediktív ürítés helyett, ami pontosabb memóriaszinkronizálást tesz lehetővé. - + Sync to framerate of video playback Szinkronizálás a videolejátszás képkockasebességéhez - + Run the game at normal speed during video playback, even when the framerate is unlocked. A játék futtatása normál sebességgel videolejátszás közben, még akkor is, ha a képkockasebesség fel van oldva. - + Barrier feedback loops - + Improves rendering of transparency effects in specific games. Javítja az átlátszósági effektek megjelenítését bizonyos játékokban. - + Enable buffer history - + Enables access to previous buffer states. This option may improve rendering quality and performance consistency in some games. - + Fix bloom effects - + Removes bloom in Burnout. - - Enable Legacy Rescale Pass - - - - - May fix rescale issues in some games by relying on behavior from the previous implementation. -Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and grey texture flicker on Nvidia GPUs in Luigis Mansion 3. - - - - + Extended Dynamic State - + Controls the number of features that can be used in Extended Dynamic State. Higher states allow for more features and can increase performance, but may cause additional graphical issues. - + Vertex Input Dynamic State - + Enables vertex input dynamic state feature for better quality and performance. - + Sample Shading - + Allows the fragment shader to execute per sample in a multi-sampled fragment instead of once per fragment. Improves graphics quality at the cost of performance. Higher values improve quality but degrade performance. - + RNG Seed - + Controls the seed of the random number generator. Mainly used for speedrunning. - + Device Name Eszköznév - + The name of the console. - + Homebrew Args - + Command-line arguments passed to homebrew at launch (e.g. -noglsl). - + Custom RTC Date: Egyéni RTC dátum: - + This option allows to change the clock of the console. Can be used to manipulate time in games. - + The number of seconds from the current unix time - + Language: Nyelv: - + This option can be overridden when region setting is auto-select - + Region: Régió: - + The region of the console. - + Time Zone: Időzóna: - + The time zone of the console. - + Sound Output Mode: Hangkimeneti mód: - + Console Mode: Konzol mód: - + Selects if the console is in Docked or Handheld mode. Games will change their resolution, details and supported controllers and depending on this setting. Setting to Handheld can help improve performance for low end systems. - + Prompt for user profile on boot - + Useful if multiple people use the same PC. - + Pause when not in focus - + Pauses emulation when focusing on other windows. - + Confirm before stopping emulation Emuláció leállításának megerősítése - + Overrides prompts asking to confirm stopping the emulation. Enabling it bypasses such prompts and directly exits the emulation. - + Hide mouse on inactivity Egér elrejtése inaktivitáskor - + Hides the mouse after 2.5s of inactivity. - + Check for updates - + Whether or not to check for updates upon startup. - + Enable Gamemode Játékmód engedélyezése - + Force X11 as Graphics Backend - + Custom frontend Egyéni frontend - + Real applet Valódi applet - - + + Disabled - + Never - + On Load - + Always - + CPU CPU - + GPU GPU - + CPU Asynchronous CPU aszinkron - + Uncompressed (Best quality) Tömörítetlen (legjobb minőség) - + BC1 (Low quality) BC1 (alacsony minőség) - + BC3 (Medium quality) BC3 (közepes minőség) - - + + Auto Automatikus - + 30 FPS - + 60 FPS - + 90 FPS - + 120 FPS - + Conservative Takarékos - + Aggressive Aggresszív - + Vulkan Vulkan - + OpenGL GLSL - + OpenGL GLASM (Assembly Shaders, NVIDIA Only) - + OpenGL SPIR-V (Experimental, AMD/Mesa Only) - + Null Null - + Fast - - - + + + Accurate Pontos - - - + + + Default Alapértelmezett - + Unsafe (fast) - + Safe (stable) - + Immediate - + Balanced - + Unsafe Nem biztonságos - + Paranoid (disables most optimizations) Paranoid (a legtöbb optimalizálást letiltja) - + Debugging - + Dynarmic Dinamikus - + NCE NCE - + Borderless Windowed Szegély nélküli ablak - + Exclusive Fullscreen Exkluzív teljes képernyő - + No Video Output Nincs videokimenet - + CPU Video Decoding CPU videódekódolás - + GPU Video Decoding (Default) GPU videódekódolás (alapértelmezett) - + 0.25X (180p/270p) [EXPERIMENTAL] - + 0.5X (360p/540p) [EXPERIMENTAL] 0.5X (360p/540p) [KÍSÉRLETI] - + 0.75X (540p/810p) [EXPERIMENTAL] 0.75X (540p/810p) [KÍSÉRLETI] - + 1X (720p/1080p) 1X (720p/1080p) - + 1.25X (900p/1350p) [EXPERIMENTAL] - + 1.5X (1080p/1620p) [EXPERIMENTAL] 1.5X (1080p/1620p) [KÍSÉRLETI] - + 2X (1440p/2160p) 2X (1440p/2160p) - + 3X (2160p/3240p) 3X (2160p/3240p) - + 4X (2880p/4320p) 4X (2880p/4320p) - + 5X (3600p/5400p) 5X (3600p/5400p) - + 6X (4320p/6480p) 6X (4320p/6480p) - + 7X (5040p/7560p) 7X (5040p/7560p) - + 8X (5760p/8640p) 8X (5760p/8640p) - + Nearest Neighbor Legközelebbi szomszéd - + Bilinear Bilineáris - + Bicubic Bikubikus - + Gaussian Gauss-féle - + Lanczos - + ScaleForce ScaleForce - + AMD FidelityFX Super Resolution - + Area - + MMPX - + Zero-Tangent - + B-Spline - + Mitchell - + Spline-1 - + Snapdragon Game Super Resolution - + Snapdragon Game Super Resolution EdgeDir - + None Nincs - + FXAA FXAA - + SMAA SMAA - + Default (16:9) Alapértelmezett (16:9) - + Force 4:3 4:3 kényszerítése - + Force 21:9 21:9 kényszerítése - + Force 16:10 16:10 kényszerítése - + Stretch to Window Ablakhoz nyújtás - + Automatic Automatikus - + 2x 2x - + 4x 4x - + 8x 8x - + 16x 16x - + Japanese (日本語) Japán (日本語) - + American English Amerikai angol - + French (français) Francia (français) - + German (Deutsch) Német (Deutsch) - + Italian (italiano) Olasz (italiano) - + Spanish (español) Spanyol (español) - + Chinese Kínai - + Korean (한국어) Koreai (한국어) - + Dutch (Nederlands) Holland (Nederlands) - + Portuguese (português) Portugál (português) - + Russian (Русский) Orosz (Русский) - + Taiwanese Tajvani - + British English Brit Angol - + Canadian French Kanadai francia - + Latin American Spanish Latin-amerikai spanyol - + Simplified Chinese Egyszerűsített kínai - + Traditional Chinese (正體中文) Hagyományos kínai (正體中文) - + Brazilian Portuguese (português do Brasil) Brazíliai portugál (português do Brasil) - + Polish (polska) - + Thai (แบบไทย) - - + + Japan Japán - + USA USA - + Europe Európa - + Australia Ausztrália - + China Kína - + Korea Korea - + Taiwan Tajvan - + Auto (%1) Auto select time zone Automatikus (%1) - + Default (%1) Default time zone Alapértelmezett (%1) - + CET CET - + CST6CDT CST6CDT - + Cuba Kuba - + EET EET - + Egypt Egyiptom - + Eire Eire - + EST EST - + EST5EDT EST5EDT - + GB GB - + GB-Eire GB-Eire - + GMT GMT - + GMT+0 GMT+0 - + GMT-0 GMT-0 - + GMT0 GMT0 - + Greenwich Greenwich - + Hongkong Hongkong - + HST HST - + Iceland Izland - + Iran Irán - + Israel Izrael - + Jamaica Jamaika - + Kwajalein Kwajalein - + Libya Líbia - + MET MET - + MST MST - + MST7MDT MST7MDT - + Navajo Navahó - + NZ NZ - + NZ-CHAT NZ-CHAT - + Poland Lengyelország - + Portugal Portugália - + PRC PRC - + PST8PDT PST8PDT - + ROC ROC - + ROK ROK - + Singapore Szingapúr - + Turkey Törökország - + UCT UCT - + Universal Univerzális - + UTC UTC - + W-SU W-SU - + WET WET - + Zulu Zulu - + Mono Mono - + Stereo Sztereó - + Surround Térhangzás - + 4GB DRAM (Default) 4GB DRAM (Alapértelmezett) - + 6GB DRAM (Unsafe) 6GB DRAM (Nem biztonságos) - + 8GB DRAM - + 10GB DRAM (Unsafe) - + 12GB DRAM (Unsafe) - + Docked Dokkolt - + Handheld Kézi - - + + Normal - - + + Boost - - + + Overclock - + Always ask (Default) Mindig kérdezz rá (alapértelmezett) - + Only if game specifies not to stop Csak akkor, ha a játék kifejezetten kéri a folytatást. - + Never ask Soha ne kérdezz rá - + Very Small (16 MB) - + Small (32 MB) - + Normal (128 MB) - + Large (256 MB) - + Very Large (512 MB) - + Very Low (4 MB) - + Low (8 MB) - + Normal (16 MB) - + Medium (32 MB) - + High (64 MB) - + Very Low (32) - + Low (64) - + Normal (128) - + Medium (256) - + High (512) - + ExtendedDynamicState 1 - + ExtendedDynamicState 2 - + ExtendedDynamicState 3 - + Tree View - + Grid View diff --git a/dist/languages/id.ts b/dist/languages/id.ts index ab0fe1d8b8..7792d12f35 100644 --- a/dist/languages/id.ts +++ b/dist/languages/id.ts @@ -713,12 +713,32 @@ Aggressive mode may impact performance of other applications such as recording s - + + GPU Readback Before NCE Invalidation + + + + + Flushes GPU buffer data back to guest memory before NCE invalidates the whole guest page, preserving it while the CPU store proceeds. + + + + + Patch Runtime NROs for NCE + + + + + Applies NCE code patches to runtime-loaded NRO modules.This is required for some games to run correctly. + + + + VSync Mode: Mode Sinkronisasi Vertikal - + FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. FIFO Relaxed allows tearing as it recovers from a slow down. Mailbox can have lower latency than FIFO and does not tear but may drop frames. @@ -726,79 +746,79 @@ Immediate (no synchronization) presents whatever is available and can exhibit te - + Sync Memory Operations Sinkronisasi Operasi Memori - + Ensures data consistency between compute and memory operations. This option fixes issues in games, but may degrade performance. Unreal Engine 4 games often see the most significant changes thereof. - + Enable asynchronous presentation (Vulkan only) Aktifkan presentasi asinkron (hanya Vulkan) - + Slightly improves performance by moving presentation to a separate CPU thread. Meningkatkan kinerja sedikit dengan memindahkan presentasi ke thread CPU terpisah. - + Force maximum clocks (Vulkan only) Paksa jam maximum (Vulkan only) - + Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed. Berjalan bekerja di latar belakang sambil menunggu perintah grafis untuk mencegah GPU agar tidak menurunkan kecepatan jamnya. - + Anisotropic Filtering: Anisotropic Filtering: - + Controls the quality of texture rendering at oblique angles. Safe to set at 16x on most GPUs. - + GPU Mode: Mode GPU: - + Controls the GPU emulation mode. Most games render fine with Fast, but Accurate is still required for some. Particles tend to only render correctly with Accurate mode. - + DMA Accuracy: Akurasi DMA - + Controls the DMA read mode. Unsafe is faster, while Safe is more stable and can fix issues in some games. Default follows the GPU Accuracy setting. - + GPU Fence Behavior: - + Controls the GPU fence synchronization behavior. Immediate is the fastest option, but can introduce some issues. Balanced offers better compatibility and may fix issues in some games. @@ -807,1302 +827,1291 @@ Default follows the GPU Mode setting. - + Enable asynchronous shader compilation Gunakan kompilasi shader asinkron - + May reduce shader stutter. - + GPU Clocks - + Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch's clocks. - + GPU Unswizzle - + Accelerates BCn 3D texture decoding using GPU compute. Disable if experiencing crashes or graphical glitches. - + GPU Unswizzle Max Texture Size - + Sets the maximum size (MiB) for GPU-based texture unswizzling. While the GPU is faster for medium and large textures, the CPU may be more efficient for very small ones. Adjust this to find the balance between GPU acceleration and CPU overhead. - + GPU Unswizzle Stream Size - + Sets the maximum amount of texture data (in MiB) processed per frame. Higher values can reduce stutter during texture loading but may impact frame consistency. - + GPU Unswizzle Chunk Size - + Determines the number of depth slices processed in a single dispatch. Increasing this can improve throughput on high-end GPUs but may cause TDR or driver timeouts on weaker hardware. - + Use Vulkan pipeline cache Gunakan pipeline cache Vulkan - + Enables GPU vendor-specific pipeline cache. This option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally. Memungkinkan cache pipeline spesifik vendor GPU. Opsi ini dapat meningkatkan waktu pemuatan shader secara signifikan dalam kasus di mana driver Vulkan tidak menyimpan file cache pipeline secara internal. - + Enable Compute Pipelines (Intel Vulkan Only) Aktifkan Pipa Komputasi (Hanya Intel Vulkan) - + Required by some games. This setting only exists for Intel proprietary drivers and may crash if enabled. Compute pipelines are always enabled on all other drivers. - + Enable Reactive Flushing Aktifkan Reactive Flushing - + Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing. Menggunakan pemadatan reaktif alih-alih pemadatan prediktif, memungkinkan sinkronisasi memori yang lebih akurat. - + Sync to framerate of video playback Sinkronkan dengan kecepatan pemutaran video - + Run the game at normal speed during video playback, even when the framerate is unlocked. Jalankan permainan dengan kecepatan normal selama pemutaran video, bahkan ketika framerate tidak terkunci. - + Barrier feedback loops Loop umpan balik penghalang - + Improves rendering of transparency effects in specific games. Meningkatkan rendering efek transparansi dalam game tertentu. - + Enable buffer history - + Enables access to previous buffer states. This option may improve rendering quality and performance consistency in some games. - + Fix bloom effects Perbaiki efek bloom - + Removes bloom in Burnout. - - Enable Legacy Rescale Pass - - - - - May fix rescale issues in some games by relying on behavior from the previous implementation. -Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and grey texture flicker on Nvidia GPUs in Luigis Mansion 3. - - - - + Extended Dynamic State - + Controls the number of features that can be used in Extended Dynamic State. Higher states allow for more features and can increase performance, but may cause additional graphical issues. - + Vertex Input Dynamic State - + Enables vertex input dynamic state feature for better quality and performance. - + Sample Shading Pencahayaan Sampel - + Allows the fragment shader to execute per sample in a multi-sampled fragment instead of once per fragment. Improves graphics quality at the cost of performance. Higher values improve quality but degrade performance. - + RNG Seed Benih RNG - + Controls the seed of the random number generator. Mainly used for speedrunning. - + Device Name Nama Perangkat - + The name of the console. - + Homebrew Args - + Command-line arguments passed to homebrew at launch (e.g. -noglsl). - + Custom RTC Date: Tanggal RTC Kustom: - + This option allows to change the clock of the console. Can be used to manipulate time in games. - + The number of seconds from the current unix time - + Language: Bahasa - + This option can be overridden when region setting is auto-select - + Region: Wilayah: - + The region of the console. - + Time Zone: Zona Waktu: - + The time zone of the console. - + Sound Output Mode: Mode keluaran suara. - + Console Mode: Mode Konsol - + Selects if the console is in Docked or Handheld mode. Games will change their resolution, details and supported controllers and depending on this setting. Setting to Handheld can help improve performance for low end systems. - + Prompt for user profile on boot - + Useful if multiple people use the same PC. - + Pause when not in focus - + Pauses emulation when focusing on other windows. - + Confirm before stopping emulation Konfirmasi sebelum menghentikan emulasi - + Overrides prompts asking to confirm stopping the emulation. Enabling it bypasses such prompts and directly exits the emulation. - + Hide mouse on inactivity Sembunyikan mouse saat tidak aktif - + Hides the mouse after 2.5s of inactivity. - + Check for updates Cek Pembaruan - + Whether or not to check for updates upon startup. - + Enable Gamemode Aktifkan Mode Permainan - + Force X11 as Graphics Backend - + Custom frontend Tampilan depan kustom - + Real applet Aplikasi nyata - - + + Disabled - + Never Tidak Pernah - + On Load - + Always Selalu - + CPU CPU - + GPU GPU - + CPU Asynchronous CPU sinkron - + Uncompressed (Best quality) Tidak terkompresi (Kualitas Terbaik) - + BC1 (Low quality) BC1 (Kualitas rendah) - + BC3 (Medium quality) BC3 (Kualitas sedang) - - + + Auto Otomatis - + 30 FPS - + 60 FPS - + 90 FPS - + 120 FPS - + Conservative Konservatif - + Aggressive Agresif - + Vulkan Vulkan - + OpenGL GLSL - + OpenGL GLASM (Assembly Shaders, NVIDIA Only) - + OpenGL SPIR-V (Experimental, AMD/Mesa Only) - + Null Null - + Fast Cepat - - - + + + Accurate Akurat - - - + + + Default Bawaan - + Unsafe (fast) - + Safe (stable) - + Immediate - + Balanced Seimbang - + Unsafe Berbahaya - + Paranoid (disables most optimizations) Paranoid (menonaktifkan sebagian besar optimasi) - + Debugging - + Dynarmic Dynarmic - + NCE NCE - + Borderless Windowed Layar Tanpa Batas - + Exclusive Fullscreen Layar Penuh Eksklusif - + No Video Output Tidak ada Keluaran Suara - + CPU Video Decoding Penguraian Video menggunakan CPU - + GPU Video Decoding (Default) Penguraian Video menggunakan GPU (Bawaan) - + 0.25X (180p/270p) [EXPERIMENTAL] - + 0.5X (360p/540p) [EXPERIMENTAL] 0.5X (360p/540p) [EKSPERIMENTAL] - + 0.75X (540p/810p) [EXPERIMENTAL] 0.75X (540p/810p) [EKSPERIMENTAL] - + 1X (720p/1080p) 1X (720p/1080p) - + 1.25X (900p/1350p) [EXPERIMENTAL] - + 1.5X (1080p/1620p) [EXPERIMENTAL] 1.5X (1080p/1620p) [EKSPERIMENTAL] - + 2X (1440p/2160p) 2X (1440p/2160p) - + 3X (2160p/3240p) 3X (2160p/3240p) - + 4X (2880p/4320p) 4X (2880p/4320p) - + 5X (3600p/5400p) 5X (3600p/5400p) - + 6X (4320p/6480p) 6X (4320p/6480p) - + 7X (5040p/7560p) 7X (5040p/7560p) - + 8X (5760p/8640p) 8X (5760p/8640p) - + Nearest Neighbor Nearest Neighbor - + Bilinear Biliner - + Bicubic Bikubik - + Gaussian Gaussian - + Lanczos - + ScaleForce ScaleForce - + AMD FidelityFX Super Resolution - + Area - + MMPX - + Zero-Tangent - + B-Spline - + Mitchell - + Spline-1 - + Snapdragon Game Super Resolution - + Snapdragon Game Super Resolution EdgeDir - + None Tak ada - + FXAA FXAA - + SMAA SMAA - + Default (16:9) Bawaan (16:9) - + Force 4:3 Paksa 4:3 - + Force 21:9 Paksa 21:9 - + Force 16:10 Paksa 16:10 - + Stretch to Window Regangkan ke Layar - + Automatic Otomatis - + 2x 2x - + 4x 4x - + 8x 8x - + 16x 16x - + Japanese (日本語) Jepang (日本語) - + American English Bahasa Inggris Amerika - + French (français) Prancis (français) - + German (Deutsch) Jerman (Deutsch) - + Italian (italiano) Italia (italiano) - + Spanish (español) Spanyol (español) - + Chinese Cina - + Korean (한국어) Korea (한국어) - + Dutch (Nederlands) Belanda (Nederlands) - + Portuguese (português) Portugis (português) - + Russian (Русский) Rusia (Русский) - + Taiwanese Taiwan - + British English Inggris Britania - + Canadian French Prancis Kanada - + Latin American Spanish Spanyol Amerika Latin - + Simplified Chinese Cina Sederhana - + Traditional Chinese (正體中文) Cina Tradisional (正體中文) - + Brazilian Portuguese (português do Brasil) Portugis Brazil (português do Brasil) - + Polish (polska) - + Thai (แบบไทย) - - + + Japan Jepang - + USA USA - + Europe Eropa - + Australia Australia - + China Tiongkok - + Korea Korea - + Taiwan Taiwan - + Auto (%1) Auto select time zone Auto (%1) - + Default (%1) Default time zone Bawaan (%1) - + CET CET - + CST6CDT CST6CDT - + Cuba Kuba - + EET EET - + Egypt Mesir - + Eire Éire - + EST EST - + EST5EDT EST5EDT - + GB GB - + GB-Eire GB-Éire - + GMT GMT - + GMT+0 GMT+0 - + GMT-0 GMT-0 - + GMT0 GMT0 - + Greenwich Greenwich - + Hongkong Hongkong - + HST HST - + Iceland Islandia - + Iran Iran - + Israel Israel - + Jamaica Jamaika - + Kwajalein Kwajalein - + Libya Libya - + MET MET - + MST MST - + MST7MDT MST7MDT - + Navajo Navajo - + NZ NZ - + NZ-CHAT NZ-CHAT - + Poland Polandia - + Portugal Portugal - + PRC PRC - + PST8PDT PST8PDT - + ROC ROC - + ROK ROK - + Singapore Singapura - + Turkey Turki - + UCT UCT - + Universal Universal - + UTC UTC - + W-SU W-SU - + WET WET - + Zulu Zulu - + Mono Mono - + Stereo Stereo - + Surround Surround - + 4GB DRAM (Default) 4GB DRAM (Bawaan) - + 6GB DRAM (Unsafe) 6GB DRAM (Tidak Aman) - + 8GB DRAM - + 10GB DRAM (Unsafe) 10GB DRAM (Tidak Aman) - + 12GB DRAM (Unsafe) 12GB DRAM (Tidak Aman) - + Docked Terpasang - + Handheld Jinjing - - + + Normal - - + + Boost - - + + Overclock - + Always ask (Default) Selalu tanyakan (Bawaan) - + Only if game specifies not to stop Hanya jika permainan menentukan untuk tidak berhenti - + Never ask Jangan pernah bertanya - + Very Small (16 MB) Sangat Kecil (16 MB) - + Small (32 MB) Kecil (32 MB) - + Normal (128 MB) - + Large (256 MB) - + Very Large (512 MB) - + Very Low (4 MB) - + Low (8 MB) - + Normal (16 MB) - + Medium (32 MB) - + High (64 MB) - + Very Low (32) - + Low (64) - + Normal (128) - + Medium (256) Sedang (256) - + High (512) Tinggi (512) - + ExtendedDynamicState 1 - + ExtendedDynamicState 2 - + ExtendedDynamicState 3 - + Tree View - + Grid View diff --git a/dist/languages/it.ts b/dist/languages/it.ts index 6315c384db..2cf9191129 100644 --- a/dist/languages/it.ts +++ b/dist/languages/it.ts @@ -730,12 +730,32 @@ La modalità aggressiva potrebbe impattare sulle prestazioni di altre applicazio Salta alcuni invalidamenti della cache durante gli aggiornamenti della memoria, riducendo l'uso della CPU e migliorando la latenza. Questo potrebbe causare soft-crash. - + + GPU Readback Before NCE Invalidation + + + + + Flushes GPU buffer data back to guest memory before NCE invalidates the whole guest page, preserving it while the CPU store proceeds. + + + + + Patch Runtime NROs for NCE + + + + + Applies NCE code patches to runtime-loaded NRO modules.This is required for some games to run correctly. + + + + VSync Mode: Modalità VSync: - + FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. FIFO Relaxed allows tearing as it recovers from a slow down. Mailbox can have lower latency than FIFO and does not tear but may drop frames. @@ -746,12 +766,12 @@ Mailbox può avere una latenza minore di FIFO e non ha tearing ma potrebbe perde Immediate (no sincronizzazione) mostra tutto il disponibile, quindi anche tearing. - + Sync Memory Operations Sincronizza operazioni di memoria - + Ensures data consistency between compute and memory operations. This option fixes issues in games, but may degrade performance. Unreal Engine 4 games often see the most significant changes thereof. @@ -760,68 +780,68 @@ Questa opzione dovrebbe risolvere problemi in alcuni giochi, ma potrebbe ridurre I giochi con Unreal Engine 4 sembrano essere i più colpiti. - + Enable asynchronous presentation (Vulkan only) Abilita la presentazione asincrona (solo Vulkan) - + Slightly improves performance by moving presentation to a separate CPU thread. Migliora di poco le prestazioni spostando la presentazione su un thread della CPU separato. - + Force maximum clocks (Vulkan only) Forza clock massimi (solo Vulkan) - + Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed. Esegue del lavoro in background durante l'attesa dei comandi grafici per evitare che la GPU diminuisca la sua velocità di clock. - + Anisotropic Filtering: Filtro anisotropico: - + Controls the quality of texture rendering at oblique angles. Safe to set at 16x on most GPUs. Controlla la qualità del rendering delle texture negli angoli obliqui. Si può utilizzare in modo sicuro al 16x su quasi tutte le GPU. - + GPU Mode: Modalità GPU: - + Controls the GPU emulation mode. Most games render fine with Fast, but Accurate is still required for some. Particles tend to only render correctly with Accurate mode. - + DMA Accuracy: Precisione DMA: - + Controls the DMA read mode. Unsafe is faster, while Safe is more stable and can fix issues in some games. Default follows the GPU Accuracy setting. - + GPU Fence Behavior: - + Controls the GPU fence synchronization behavior. Immediate is the fastest option, but can introduce some issues. Balanced offers better compatibility and may fix issues in some games. @@ -830,89 +850,89 @@ Default follows the GPU Mode setting. - + Enable asynchronous shader compilation Abilita la compilazione asincrona degli shader - + May reduce shader stutter. Può ridurre i fenomeni di stuttering (scatti) causati dagli shader. - + GPU Clocks - + Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch's clocks. - + GPU Unswizzle - + Accelerates BCn 3D texture decoding using GPU compute. Disable if experiencing crashes or graphical glitches. - + GPU Unswizzle Max Texture Size - + Sets the maximum size (MiB) for GPU-based texture unswizzling. While the GPU is faster for medium and large textures, the CPU may be more efficient for very small ones. Adjust this to find the balance between GPU acceleration and CPU overhead. - + GPU Unswizzle Stream Size - + Sets the maximum amount of texture data (in MiB) processed per frame. Higher values can reduce stutter during texture loading but may impact frame consistency. - + GPU Unswizzle Chunk Size - + Determines the number of depth slices processed in a single dispatch. Increasing this can improve throughput on high-end GPUs but may cause TDR or driver timeouts on weaker hardware. - + Use Vulkan pipeline cache Usa la cache delle pipeline di Vulkan - + Enables GPU vendor-specific pipeline cache. This option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally. Abilita la cache delle pipeline specifica del produttore della GPU. Quest'opzione può ridurre di molto i tempi di caricamento degli shader nei casi in cui il driver Vulkan non memorizza la cache delle pipeline internamente. - + Enable Compute Pipelines (Intel Vulkan Only) Abilita le compute pipeline (solo per Vulkan su Intel) - + Required by some games. This setting only exists for Intel proprietary drivers and may crash if enabled. Compute pipelines are always enabled on all other drivers. @@ -921,192 +941,181 @@ Quest'impostazione esiste solo per i driver proprietari Intel e potrebbe fa Le compute pipelines sono sempre attivate su tutti gli altri drivers. - + Enable Reactive Flushing Abilita il flushing reattivo - + Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing. Utilizza il flushing reattivo invece di quello predittivo, al fine di ottenere una sincronizzazione della memoria più accurata. - + Sync to framerate of video playback Sincronizza il framerate a quello del video - + Run the game at normal speed during video playback, even when the framerate is unlocked. Esegue il gioco a velocità normale durante le cutscene, anche quando il framerate è sbloccato. - + Barrier feedback loops Barrier feedback loops - + Improves rendering of transparency effects in specific games. Migliora il rendering degli effetti di trasparenza in alcuni giochi. - + Enable buffer history - + Enables access to previous buffer states. This option may improve rendering quality and performance consistency in some games. - + Fix bloom effects - + Removes bloom in Burnout. - - Enable Legacy Rescale Pass - - - - - May fix rescale issues in some games by relying on behavior from the previous implementation. -Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and grey texture flicker on Nvidia GPUs in Luigis Mansion 3. - - - - + Extended Dynamic State Stato dinamico esteso - + Controls the number of features that can be used in Extended Dynamic State. Higher states allow for more features and can increase performance, but may cause additional graphical issues. Controlla il numero di funzionalità che possono essere usate con lo stato dinamico esteso. Gli stati più alti consentono più funzionalità e possono migliorare le prestazioni, ma possono causare ulteriori problemi grafici. - + Vertex Input Dynamic State - + Enables vertex input dynamic state feature for better quality and performance. - + Sample Shading Sample shading - + Allows the fragment shader to execute per sample in a multi-sampled fragment instead of once per fragment. Improves graphics quality at the cost of performance. Higher values improve quality but degrade performance. Permette al fragment shader di eseguire per campione in un frammento multi-campione invece che una volta per frammento. Migliora la qualità grafica a scapito delle prestazioni. Alti valori migliorano la qualità ma peggiorano le prestazioni. - + RNG Seed Seed RNG - + Controls the seed of the random number generator. Mainly used for speedrunning. Controlla il seme del generatore di numeri casuali. Principalmente utilizzato per le speedrun. - + Device Name Nome del dispositivo - + The name of the console. Il nome della console. - + Homebrew Args - + Command-line arguments passed to homebrew at launch (e.g. -noglsl). - + Custom RTC Date: Data RTC personalizzata: - + This option allows to change the clock of the console. Can be used to manipulate time in games. Quest'opzione permette di modificare l'orologio della console. Può essere usato per manipolare il tempo nei giochi. - + The number of seconds from the current unix time Il numero di secondi dal tempo Unix attuale - + Language: Lingua: - + This option can be overridden when region setting is auto-select Può essere rimpiazzato se il fuso orario della Regione è impostato su Auto - + Region: Regione: - + The region of the console. La regione della console. - + Time Zone: Fuso orario: - + The time zone of the console. Il fuso orario della console. - + Sound Output Mode: Modalità di output del suono: - + Console Mode: Modalità console: - + Selects if the console is in Docked or Handheld mode. Games will change their resolution, details and supported controllers and depending on this setting. Setting to Handheld can help improve performance for low end systems. @@ -1115,1026 +1124,1026 @@ I giochi ne terranno conto e modificheranno la risoluzione, i dettagli e i contr Impostare l'opzione su "Portatile" può aiutare a migliorare le prestazioni sui sistemi meno potenti. - + Prompt for user profile on boot Scegli il profilo utente all'avvio - + Useful if multiple people use the same PC. Utile se più persone utilizzano lo stesso PC. - + Pause when not in focus Metti in pausa quando la finestra non è in primo piano - + Pauses emulation when focusing on other windows. Mette in pausa l'emulazione quando altre finestre sono in primo piano. - + Confirm before stopping emulation Chiedi conferma prima di arrestare l'emulazione - + Overrides prompts asking to confirm stopping the emulation. Enabling it bypasses such prompts and directly exits the emulation. Sovrascrive le richieste di conferma per fermare l'emulazione. Abilitarla bypassa queste richieste e l'emulazione cesserà immediatamente. - + Hide mouse on inactivity Nascondi il puntatore del mouse se inattivo - + Hides the mouse after 2.5s of inactivity. Nasconde il mouse dopo 2,5 secondi di inattività. - + Check for updates Controlla la presenza di aggiornamenti - + Whether or not to check for updates upon startup. Determina se controllare o meno la presenza di aggiornamenti all'avvio. - + Enable Gamemode Abilita Gamemode - + Force X11 as Graphics Backend Forza l'uso del back-end grafico X11 - + Custom frontend Frontend personalizzato - + Real applet Applet reale - - + + Disabled Disabilitato - + Never Mai - + On Load Al caricamento - + Always Sempre - + CPU CPU - + GPU GPU - + CPU Asynchronous CPU (Asincrono) - + Uncompressed (Best quality) Nessuna compressione (qualità migliore) - + BC1 (Low quality) BC1 (qualità bassa) - + BC3 (Medium quality) BC3 (qualità media) - - + + Auto Automatico - + 30 FPS 30 FPS - + 60 FPS 60 FPS - + 90 FPS 90 FPS - + 120 FPS 120 FPS - + Conservative Conservativa - + Aggressive Aggressiva - + Vulkan Vulkan - + OpenGL GLSL OpenGL GLSL - + OpenGL GLASM (Assembly Shaders, NVIDIA Only) OpenGL GLASM (shader assembly, solo NVIDIA) - + OpenGL SPIR-V (Experimental, AMD/Mesa Only) OpenGL SPIR-V (sperimentale, solo AMD/MESA) - + Null Nullo - + Fast Veloce - - - + + + Accurate Accurata - - - + + + Default Predefinito - + Unsafe (fast) Non sicuro (veloce) - + Safe (stable) Sicuro (stabile) - + Immediate - + Balanced Bilanciata - + Unsafe Non sicura - + Paranoid (disables most optimizations) Paranoica (disabilita la maggior parte delle ottimizzazioni) - + Debugging Debug - + Dynarmic Dynarmic - + NCE NCE - + Borderless Windowed Finestra senza bordi - + Exclusive Fullscreen Schermo intero esclusivo - + No Video Output Nessun output video - + CPU Video Decoding Decodifica video CPU - + GPU Video Decoding (Default) Decodifica video GPU (predefinita) - + 0.25X (180p/270p) [EXPERIMENTAL] 0.25X (180p/270p) [SPERIMENTALE] - + 0.5X (360p/540p) [EXPERIMENTAL] 0.5X (360p/540p) [SPERIMENTALE] - + 0.75X (540p/810p) [EXPERIMENTAL] 0.75X (540p/810p) [SPERIMENTALE] - + 1X (720p/1080p) 1X (720p/1080p) - + 1.25X (900p/1350p) [EXPERIMENTAL] 1.25X (900p/1350p) [SPERIMENTALE] - + 1.5X (1080p/1620p) [EXPERIMENTAL] 1.5X (1080p/1620p) [SPERIMENTALE] - + 2X (1440p/2160p) 2X (1440p/2160p) - + 3X (2160p/3240p) 3X (2160p/3240p) - + 4X (2880p/4320p) 4X (2880p/4320p) - + 5X (3600p/5400p) 5X (3600p/5400p) - + 6X (4320p/6480p) 6X (4320p/6480p) - + 7X (5040p/7560p) 7X (5040p/7560p) - + 8X (5760p/8640p) 8X (5760p/8640p) - + Nearest Neighbor Nearest neighbor - + Bilinear Bilineare - + Bicubic Bicubico - + Gaussian Gaussiano - + Lanczos Lanczos - + ScaleForce ScaleForce - + AMD FidelityFX Super Resolution AMD FidelityFX Super Resolution - + Area Area - + MMPX MMPX - + Zero-Tangent Zero-Tangent - + B-Spline B-Spline - + Mitchell Mitchell - + Spline-1 Spline-1 - + Snapdragon Game Super Resolution - + Snapdragon Game Super Resolution EdgeDir - + None Nessuna - + FXAA FXAA - + SMAA SMAA - + Default (16:9) Predefinito (16:9) - + Force 4:3 Forza 4:3 - + Force 21:9 Forza 21:9 - + Force 16:10 Forza 16:10 - + Stretch to Window Allunga a finestra - + Automatic Automatico - + 2x 2x - + 4x 4x - + 8x 8x - + 16x 16x - + Japanese (日本語) Giapponese (日本語) - + American English Inglese americano - + French (français) Francese (français) - + German (Deutsch) Tedesco (Deutsch) - + Italian (italiano) Italiano - + Spanish (español) Spagnolo (español) - + Chinese Cinese - + Korean (한국어) Coreano (한국어) - + Dutch (Nederlands) Olandese (Nederlands) - + Portuguese (português) Portoghese (português) - + Russian (Русский) Russo (Русский) - + Taiwanese Taiwanese - + British English Inglese britannico - + Canadian French Francese canadese - + Latin American Spanish Spagnolo latino-americano - + Simplified Chinese Cinese semplificato - + Traditional Chinese (正體中文) Cinese tradizionale (正體中文) - + Brazilian Portuguese (português do Brasil) Portoghese brasiliano (português do Brasil) - + Polish (polska) Polacco (polska) - + Thai (แบบไทย) Thailandese (แบบไทย) - - + + Japan Giappone - + USA USA - + Europe Europa - + Australia Australia - + China Cina - + Korea Corea - + Taiwan Taiwan - + Auto (%1) Auto select time zone Automatico (%1) - + Default (%1) Default time zone Predefinito (%1) - + CET CET - + CST6CDT CST6CDT - + Cuba Cuba - + EET EET - + Egypt Egitto - + Eire Eire - + EST EST - + EST5EDT EST5EDT - + GB GB - + GB-Eire GB-Eire - + GMT GMT - + GMT+0 GMT+0 - + GMT-0 GMT-0 - + GMT0 GMT0 - + Greenwich Greenwich - + Hongkong Hongkong - + HST HST - + Iceland Islanda - + Iran Iran - + Israel Israele - + Jamaica Giamaica - + Kwajalein Kwajalein - + Libya Libia - + MET MET - + MST MST - + MST7MDT MST7MDT - + Navajo Navajo - + NZ NZ - + NZ-CHAT NZ-CHAT - + Poland Polonia - + Portugal Portogallo - + PRC PRC - + PST8PDT PST8PDT - + ROC ROC - + ROK ROK - + Singapore Singapore - + Turkey Turchia - + UCT UCT - + Universal Universale - + UTC UTC - + W-SU W-SU - + WET WET - + Zulu Zulu - + Mono Mono - + Stereo Stereo - + Surround Surround - + 4GB DRAM (Default) 4GB DRAM (Predefinito) - + 6GB DRAM (Unsafe) 6GB DRAM (Non sicuro) - + 8GB DRAM 8GB DRAM - + 10GB DRAM (Unsafe) 10GB DRAM (Non sicuro) - + 12GB DRAM (Unsafe) 12GB DRAM (Non sicuro) - + Docked Dock - + Handheld Portatile - - + + Normal - - + + Boost - - + + Overclock - + Always ask (Default) Chiedi sempre (Predefinito) - + Only if game specifies not to stop Solo se il gioco richiede di non essere arrestato - + Never ask Non chiedere mai - + Very Small (16 MB) Molto piccola (16 MB) - + Small (32 MB) Piccola (32 MB) - + Normal (128 MB) Normale (128 MB) - + Large (256 MB) Grande (256 MB) - + Very Large (512 MB) Molto grande (512 MB) - + Very Low (4 MB) Molto bassa (4 MB) - + Low (8 MB) Bassa (8 MB) - + Normal (16 MB) Normale (16 MB) - + Medium (32 MB) Media (32 MB) - + High (64 MB) Alta (64 MB) - + Very Low (32) Molto basso (32) - + Low (64) Basso (64) - + Normal (128) Normale (128) - + Medium (256) Medio (256) - + High (512) Alto (512) - + ExtendedDynamicState 1 Stato dinamico esteso 1 - + ExtendedDynamicState 2 Stato dinamico esteso 2 - + ExtendedDynamicState 3 Stato dinamico esteso 3 - + Tree View Vista ad albero - + Grid View Vista a griglia diff --git a/dist/languages/ja_JP.ts b/dist/languages/ja_JP.ts index c7eb268ca0..2341618395 100644 --- a/dist/languages/ja_JP.ts +++ b/dist/languages/ja_JP.ts @@ -696,12 +696,32 @@ Aggressive mode may impact performance of other applications such as recording s - + + GPU Readback Before NCE Invalidation + + + + + Flushes GPU buffer data back to guest memory before NCE invalidates the whole guest page, preserving it while the CPU store proceeds. + + + + + Patch Runtime NROs for NCE + + + + + Applies NCE code patches to runtime-loaded NRO modules.This is required for some games to run correctly. + + + + VSync Mode: 垂直同期: - + FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. FIFO Relaxed allows tearing as it recovers from a slow down. Mailbox can have lower latency than FIFO and does not tear but may drop frames. @@ -712,79 +732,79 @@ Mailbox は FIFO よりも遅延が小さくティアリングがありません Immediate (no synchronization) は表示可能なものをすべて表示し, ティアリング発生の可能性があります. - + Sync Memory Operations メモリ操作の同期 - + Ensures data consistency between compute and memory operations. This option fixes issues in games, but may degrade performance. Unreal Engine 4 games often see the most significant changes thereof. - + Enable asynchronous presentation (Vulkan only) 非同期プレゼンテーション (Vulkan のみ) - + Slightly improves performance by moving presentation to a separate CPU thread. - + Force maximum clocks (Vulkan only) 最大クロック強制 (Vulkan のみ) - + Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed. GPUのクロックスピードを下げないように、グラフィックコマンドを待っている間、バックグラウンドで作業を実行させます。 - + Anisotropic Filtering: 異方性フィルタリング: - + Controls the quality of texture rendering at oblique angles. Safe to set at 16x on most GPUs. - + GPU Mode: GPUモード: - + Controls the GPU emulation mode. Most games render fine with Fast, but Accurate is still required for some. Particles tend to only render correctly with Accurate mode. - + DMA Accuracy: DMA精度: - + Controls the DMA read mode. Unsafe is faster, while Safe is more stable and can fix issues in some games. Default follows the GPU Accuracy setting. - + GPU Fence Behavior: - + Controls the GPU fence synchronization behavior. Immediate is the fastest option, but can introduce some issues. Balanced offers better compatibility and may fix issues in some games. @@ -793,1301 +813,1290 @@ Default follows the GPU Mode setting. - + Enable asynchronous shader compilation - + May reduce shader stutter. - + GPU Clocks - + Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch's clocks. - + GPU Unswizzle - + Accelerates BCn 3D texture decoding using GPU compute. Disable if experiencing crashes or graphical glitches. - + GPU Unswizzle Max Texture Size - + Sets the maximum size (MiB) for GPU-based texture unswizzling. While the GPU is faster for medium and large textures, the CPU may be more efficient for very small ones. Adjust this to find the balance between GPU acceleration and CPU overhead. - + GPU Unswizzle Stream Size - + Sets the maximum amount of texture data (in MiB) processed per frame. Higher values can reduce stutter during texture loading but may impact frame consistency. - + GPU Unswizzle Chunk Size - + Determines the number of depth slices processed in a single dispatch. Increasing this can improve throughput on high-end GPUs but may cause TDR or driver timeouts on weaker hardware. - + Use Vulkan pipeline cache Vulkan パイプラインキャッシュを使用 - + Enables GPU vendor-specific pipeline cache. This option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally. - + Enable Compute Pipelines (Intel Vulkan Only) コンピュート・パイプラインの有効化(インテル Vulkan のみ) - + Required by some games. This setting only exists for Intel proprietary drivers and may crash if enabled. Compute pipelines are always enabled on all other drivers. - + Enable Reactive Flushing - + Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing. - + Sync to framerate of video playback ビデオ再生のフレームレートに同期する - + Run the game at normal speed during video playback, even when the framerate is unlocked. - + Barrier feedback loops - + Improves rendering of transparency effects in specific games. 特定のゲームにおける透明エフェクトのレンダリングを改善します。 - + Enable buffer history - + Enables access to previous buffer states. This option may improve rendering quality and performance consistency in some games. - + Fix bloom effects - + Removes bloom in Burnout. - - Enable Legacy Rescale Pass - - - - - May fix rescale issues in some games by relying on behavior from the previous implementation. -Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and grey texture flicker on Nvidia GPUs in Luigis Mansion 3. - - - - + Extended Dynamic State - + Controls the number of features that can be used in Extended Dynamic State. Higher states allow for more features and can increase performance, but may cause additional graphical issues. - + Vertex Input Dynamic State - + Enables vertex input dynamic state feature for better quality and performance. - + Sample Shading - + Allows the fragment shader to execute per sample in a multi-sampled fragment instead of once per fragment. Improves graphics quality at the cost of performance. Higher values improve quality but degrade performance. - + RNG Seed 乱数シード値の変更 - + Controls the seed of the random number generator. Mainly used for speedrunning. - + Device Name デバイス名 - + The name of the console. - + Homebrew Args - + Command-line arguments passed to homebrew at launch (e.g. -noglsl). - + Custom RTC Date: - + This option allows to change the clock of the console. Can be used to manipulate time in games. - + The number of seconds from the current unix time - + Language: 言語: - + This option can be overridden when region setting is auto-select - + Region: 地域: - + The region of the console. - + Time Zone: タイムゾーン: - + The time zone of the console. - + Sound Output Mode: 音声出力モード: - + Console Mode: コンソールモード: - + Selects if the console is in Docked or Handheld mode. Games will change their resolution, details and supported controllers and depending on this setting. Setting to Handheld can help improve performance for low end systems. - + Prompt for user profile on boot - + Useful if multiple people use the same PC. - + Pause when not in focus - + Pauses emulation when focusing on other windows. - + Confirm before stopping emulation エミュレーションを停止する前に確認する - + Overrides prompts asking to confirm stopping the emulation. Enabling it bypasses such prompts and directly exits the emulation. - + Hide mouse on inactivity 非アクティブ時にマウスカーソルを隠す - + Hides the mouse after 2.5s of inactivity. - + Check for updates - + Whether or not to check for updates upon startup. - + Enable Gamemode - + Force X11 as Graphics Backend - + Custom frontend - + Real applet - - + + Disabled 無効 - + Never - + On Load - + Always - + CPU CPU - + GPU GPU - + CPU Asynchronous CPU 非同期 - + Uncompressed (Best quality) 圧縮しない (最高品質) - + BC1 (Low quality) BC1 (低品質) - + BC3 (Medium quality) BC3 (中品質) - - + + Auto 自動 - + 30 FPS - + 60 FPS - + 90 FPS - + 120 FPS - + Conservative - + Aggressive - + Vulkan Vulkan - + OpenGL GLSL OpenGL GLSL - + OpenGL GLASM (Assembly Shaders, NVIDIA Only) OpenGL GLASM (アセンブリシェーダー、NVIDIA のみ) - + OpenGL SPIR-V (Experimental, AMD/Mesa Only) OpenGL SPIR-V(実験的、AMD/Mesaのみ) - + Null - + Fast - - - + + + Accurate 正確 - - - + + + Default デフォルト - + Unsafe (fast) - + Safe (stable) - + Immediate - + Balanced - + Unsafe 不安定 - + Paranoid (disables most optimizations) パラノイド (ほとんどの最適化を無効化) - + Debugging - + Dynarmic Dynarmic - + NCE NCE - + Borderless Windowed ボーダーレスウィンドウ - + Exclusive Fullscreen 排他的フルスクリーン - + No Video Output ビデオ出力しない - + CPU Video Decoding ビデオをCPUでデコード - + GPU Video Decoding (Default) ビデオをGPUでデコード (デフォルト) - + 0.25X (180p/270p) [EXPERIMENTAL] 0.25X (180p/270p) [EXPERIMENTAL] - + 0.5X (360p/540p) [EXPERIMENTAL] 0.5X (360p/540p) [実験的] - + 0.75X (540p/810p) [EXPERIMENTAL] 0.75X (540p/810p) [実験的] - + 1X (720p/1080p) 1X (720p/1080p) - + 1.25X (900p/1350p) [EXPERIMENTAL] 1.25X (900p/1350p) [EXPERIMENTAL] - + 1.5X (1080p/1620p) [EXPERIMENTAL] 1.5X (1080p/1620p) [実験的] - + 2X (1440p/2160p) 2X (1440p/2160p) - + 3X (2160p/3240p) 3X (2160p/3240p) - + 4X (2880p/4320p) 4X (2880p/4320p) - + 5X (3600p/5400p) 5X (3600p/5400p) - + 6X (4320p/6480p) 6X (4320p/6480p) - + 7X (5040p/7560p) 7X (5040p/7560p) - + 8X (5760p/8640p) 8X (5760p/8640p) - + Nearest Neighbor Nearest Neighbor - + Bilinear Bilinear - + Bicubic Bicubic - + Gaussian Gaussian - + Lanczos Lanczos - + ScaleForce ScaleForce - + AMD FidelityFX Super Resolution AMD FidelityFX Super Resolution - + Area - + MMPX MMPX - + Zero-Tangent - + B-Spline - + Mitchell - + Spline-1 - + Snapdragon Game Super Resolution - + Snapdragon Game Super Resolution EdgeDir - + None なし - + FXAA FXAA - + SMAA SMAA - + Default (16:9) デフォルト (16:9) - + Force 4:3 強制 4:3 - + Force 21:9 強制 21:9 - + Force 16:10 強制 16:10 - + Stretch to Window ウィンドウに合わせる - + Automatic 自動 - + 2x 2x - + 4x 4x - + 8x 8x - + 16x 16x - + Japanese (日本語) 日本語 - + American English アメリカ英語 - + French (français) フランス語 (français) - + German (Deutsch) ドイツ語 (Deutsch) - + Italian (italiano) イタリア語 (italiano) - + Spanish (español) スペイン語 (español) - + Chinese 中国語 - + Korean (한국어) 韓国語 (한국어) - + Dutch (Nederlands) オランダ語 (Nederlands) - + Portuguese (português) ポルトガル語 (português) - + Russian (Русский) ロシア語 (Русский) - + Taiwanese 台湾語 - + British English イギリス英語 - + Canadian French カナダフランス語 - + Latin American Spanish ラテンアメリカスペイン語 - + Simplified Chinese 簡体字中国語 - + Traditional Chinese (正體中文) 繁体字中国語 (正體中文) - + Brazilian Portuguese (português do Brasil) ブラジルポルトガル語 (português do Brasil) - + Polish (polska) - + Thai (แบบไทย) - - + + Japan 日本 - + USA アメリカ - + Europe ヨーロッパ - + Australia オーストラリア - + China 中国 - + Korea 韓国 - + Taiwan 台湾 - + Auto (%1) Auto select time zone 自動 (%1) - + Default (%1) Default time zone 既定 (%1) - + CET 中央ヨーロッパ時間 - + CST6CDT CST6CDT - + Cuba キューバ - + EET 東ヨーロッパ標準時 - + Egypt エジプト - + Eire アイルランド - + EST アメリカ東部標準時 - + EST5EDT EST5EDT - + GB GB - + GB-Eire イギリス-アイルランド - + GMT GMT - + GMT+0 GMT+0 - + GMT-0 GMT-0 - + GMT0 GMT0 - + Greenwich グリニッジ - + Hongkong 香港 - + HST ハワイ標準時 - + Iceland アイスランド - + Iran イラン - + Israel イスラエル - + Jamaica ジャマイカ - + Kwajalein クェゼリン - + Libya リビア - + MET 中東時間 - + MST MST - + MST7MDT MST7MDT - + Navajo ナバホ - + NZ NZ - + NZ-CHAT NZ-CHAT - + Poland ポーランド - + Portugal ポルトガル - + PRC PRC - + PST8PDT PST8PDT - + ROC ROC - + ROK ROK - + Singapore シンガポール - + Turkey トルコ - + UCT UCT - + Universal ユニバーサル - + UTC UTC - + W-SU W-SU - + WET WET - + Zulu ズールー - + Mono モノラル - + Stereo ステレオ - + Surround サラウンド - + 4GB DRAM (Default) 4GB DRAM (デフォルト) - + 6GB DRAM (Unsafe) 6GB DRAM (不安定) - + 8GB DRAM 8GB DRAM - + 10GB DRAM (Unsafe) - + 12GB DRAM (Unsafe) - + Docked Docked - + Handheld 携帯モード - - + + Normal - - + + Boost - - + + Overclock - + Always ask (Default) 常に確認する (デフォルト) - + Only if game specifies not to stop ゲームが停止しないように指定しているときのみ - + Never ask 確認しない - + Very Small (16 MB) - + Small (32 MB) - + Normal (128 MB) - + Large (256 MB) - + Very Large (512 MB) - + Very Low (4 MB) - + Low (8 MB) - + Normal (16 MB) - + Medium (32 MB) - + High (64 MB) - + Very Low (32) - + Low (64) - + Normal (128) - + Medium (256) - + High (512) - + ExtendedDynamicState 1 - + ExtendedDynamicState 2 - + ExtendedDynamicState 3 - + Tree View - + Grid View diff --git a/dist/languages/ko_KR.ts b/dist/languages/ko_KR.ts index a6d39cf213..c78a853a20 100644 --- a/dist/languages/ko_KR.ts +++ b/dist/languages/ko_KR.ts @@ -733,12 +733,32 @@ Aggressive mode may impact performance of other applications such as recording s 메모리 업데이트 중 특정 캐시 무효화를 건너뛰어 CPU 사용량을 줄이고 지연 시간을 개선합니다. 하지만 이로 인해 소프트 크래시가 발생할 수 있습니다. - + + GPU Readback Before NCE Invalidation + + + + + Flushes GPU buffer data back to guest memory before NCE invalidates the whole guest page, preserving it while the CPU store proceeds. + + + + + Patch Runtime NROs for NCE + + + + + Applies NCE code patches to runtime-loaded NRO modules.This is required for some games to run correctly. + + + + VSync Mode: 수직 동기화 모드: - + FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. FIFO Relaxed allows tearing as it recovers from a slow down. Mailbox can have lower latency than FIFO and does not tear but may drop frames. @@ -749,12 +769,12 @@ Mailbox는 FIFO보다 지연 시간이 짧고 화면 찢김 현상이 없지만 즉각적(동기화 없음)는 사용 가능한 모든 화면을 표시하며 화면 찢김 현상이 발생할 수 있습니다. - + Sync Memory Operations 메모리 작업 동기화 - + Ensures data consistency between compute and memory operations. This option fixes issues in games, but may degrade performance. Unreal Engine 4 games often see the most significant changes thereof. @@ -763,44 +783,44 @@ Unreal Engine 4 games often see the most significant changes thereof. 대개 언리얼 엔진 4 게임에서 이러한 변경 사항이 가장 두드러지게 나타납니다. - + Enable asynchronous presentation (Vulkan only) 비동기 프레젠테이션 활성화(Vulkan 전용) - + Slightly improves performance by moving presentation to a separate CPU thread. 프레젠테이션을 별도의 CPU 스레드로 이동시켜 성능을 약간 향상시킵니다. - + Force maximum clocks (Vulkan only) 최대 클럭 강제 적용(Vulkan 전용) - + Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed. 그래픽 명령을 기다리는 동안 백그라운드에서 작업을 실행하여 GPU 클럭 속도가 저하되는 것을 방지합니다. - + Anisotropic Filtering: 비등방성 필터링: - + Controls the quality of texture rendering at oblique angles. Safe to set at 16x on most GPUs. 비스듬한 각도에서의 텍스처 렌더링 품질을 제어합니다. 대부분의 GPU에서 16x로 설정해도 안전합니다. - + GPU Mode: GPU 모드: - + Controls the GPU emulation mode. Most games render fine with Fast, but Accurate is still required for some. Particles tend to only render correctly with Accurate mode. @@ -809,12 +829,12 @@ Particles tend to only render correctly with Accurate mode. 특히 조각들은 정확 모드에서만 제대로 렌더링되는 경향이 있습니다. - + DMA Accuracy: DMA 정확도: - + Controls the DMA read mode. Unsafe is faster, while Safe is more stable and can fix issues in some games. Default follows the GPU Accuracy setting. @@ -823,12 +843,12 @@ Default follows the GPU Accuracy setting. 기본값은 GPU 정확도 설정을 따릅니다. - + GPU Fence Behavior: GPU 펜스 동작: - + Controls the GPU fence synchronization behavior. Immediate is the fastest option, but can introduce some issues. Balanced offers better compatibility and may fix issues in some games. @@ -837,44 +857,44 @@ Default follows the GPU Mode setting. - + Enable asynchronous shader compilation 비동기 셰이더 컴파일 활성화 - + May reduce shader stutter. 셰이더 끊김 현상을 줄일 수 있습니다. - + GPU Clocks GPU 클럭 - + Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch's clocks. 게임이 GPU 작업이 실제보다 더 빨리 완료된다고 착각하게 만들어, 스위치의 클럭 속도에 맞추기 위해 해상도와 렌더 거리를 낮추는 작업을 중단하게 합니다. - + GPU Unswizzle GPU 언스위즐 - + Accelerates BCn 3D texture decoding using GPU compute. Disable if experiencing crashes or graphical glitches. GPU 컴퓨팅을 사용하여 BCn 3D 텍스처 디코딩을 가속화합니다. 충돌이나 그래픽 결함이 발생하는 경우 이 기능을 비활성화하세요. - + GPU Unswizzle Max Texture Size GPU 언스위즐 최대 텍스처 크기 - + Sets the maximum size (MiB) for GPU-based texture unswizzling. While the GPU is faster for medium and large textures, the CPU may be more efficient for very small ones. Adjust this to find the balance between GPU acceleration and CPU overhead. @@ -883,48 +903,48 @@ GPU는 중간 및 큰 크기의 텍스처에서 더 빠르지만, 매우 작은 이 값을 조정하여 GPU 가속과 CPU 오버헤드 간의 균형을 찾으세요. - + GPU Unswizzle Stream Size GPU 언스위즐 스트림 크기 - + Sets the maximum amount of texture data (in MiB) processed per frame. Higher values can reduce stutter during texture loading but may impact frame consistency. 프레임당 처리할 최대 텍스처 데이터 양(MiB 단위)을 설정합니다. 값이 높을수록 텍스처 로딩 중 끊김 현상을 줄일 수 있지만 프레임 일관성에 영향을 미칠 수 있습니다. - + GPU Unswizzle Chunk Size GPU 언스위즐 청크 크기 - + Determines the number of depth slices processed in a single dispatch. Increasing this can improve throughput on high-end GPUs but may cause TDR or driver timeouts on weaker hardware. 단일 디스패치에서 처리할 깊이 슬라이스 수를 결정합니다. 이 값을 높이면 고성능 GPU에서 처리량이 향상될 수 있지만, 성능이 낮은 하드웨어에서는 TDR 오류나 드라이버 시간 초과가 발생할 수 있습니다. - + Use Vulkan pipeline cache Vulkan 파이프라인 캐시 사용 - + Enables GPU vendor-specific pipeline cache. This option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally. GPU 제조사별 파이프라인 캐시를 활성화합니다. 이 옵션은 Vulkan 드라이버가 파이프라인 캐시 파일을 내부에 저장하지 않는 경우 셰이더 로딩 시간을 크게 향상시킬 수 있습니다. - + Enable Compute Pipelines (Intel Vulkan Only) 컴퓨트 파이프라인 활성화(인텔 Vulkan 전용) - + Required by some games. This setting only exists for Intel proprietary drivers and may crash if enabled. Compute pipelines are always enabled on all other drivers. @@ -933,194 +953,182 @@ Compute pipelines are always enabled on all other drivers. 다른 모든 드라이버에서는 컴퓨트 파이프라인이 항상 활성화됩니다. - + Enable Reactive Flushing 반응형 플러싱 활성화 - + Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing. 예측형 플러싱 대신 반응형 플러싱을 사용하여 보다 정확한 메모리 동기화를 가능하게 합니다. - + Sync to framerate of video playback 비디오 재생 프레임 속도에 동기화 - + Run the game at normal speed during video playback, even when the framerate is unlocked. 프레임률 제한이 해제된 경우에도 비디오 재생 중에는 게임을 정상 속도로 실행합니다. - + Barrier feedback loops 피드백 루프 차단 - + Improves rendering of transparency effects in specific games. 특정 게임에서 투명 효과 렌더링을 개선합니다. - + Enable buffer history 버퍼 기록 활성화 - + Enables access to previous buffer states. This option may improve rendering quality and performance consistency in some games. 이전 버퍼 상태에 접근할 수 있도록 합니다. 이 옵션은 일부 게임에서 렌더링 품질과 성능 일관성을 향상시킬 수 있습니다. - + Fix bloom effects 블룸 효과 수정 - + Removes bloom in Burnout. Burnout에서의 블룸 현상을 제거합니다. - - Enable Legacy Rescale Pass - 기존 크기 조정 무시 활성화 - - - - May fix rescale issues in some games by relying on behavior from the previous implementation. -Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and grey texture flicker on Nvidia GPUs in Luigis Mansion 3. - 이전 구현의 동작을 활용하여 일부 게임에서 발생하는 크기 조정 문제를 해결할 수 있습니다. -루이지 맨션 3에서 발생했던 AMD 및 인텔 GPU의 선 아티팩트 현상과 Nvidia GPU의 회색 텍스처 깜빡임 현상을 해결하는 기존 반응에 대한 예비 해결책입니다. - - - + Extended Dynamic State 확장된 동적 상태 - + Controls the number of features that can be used in Extended Dynamic State. Higher states allow for more features and can increase performance, but may cause additional graphical issues. 확장된 동적 상태에서 사용할 수 있는 기능의 수를 제어합니다. 상태 수가 많을수록 더 많은 기능을 사용할 수 있고 성능이 향상될 수 있지만, 추가적인 그래픽 문제가 발생할 수 있습니다. - + Vertex Input Dynamic State 정점 입력 동적 상태 - + Enables vertex input dynamic state feature for better quality and performance. 정점 입력의 동적 상태 기능을 활성화하여 품질과 성능을 향상시킵니다. - + Sample Shading 샘플 셰이딩 - + Allows the fragment shader to execute per sample in a multi-sampled fragment instead of once per fragment. Improves graphics quality at the cost of performance. Higher values improve quality but degrade performance. 조각 셰이더가 다중샘플 조각에서 한 번당 한 조각이 아닌 샘플별로 실행될 수 있도록 합니다. 성능 저하를 감수하고 그래픽 품질을 향상시킵니다. 값이 높을수록 품질은 향상되지만 성능은 저하됩니다. - + RNG Seed RNG 시드 - + Controls the seed of the random number generator. Mainly used for speedrunning. 난수 생성기의 시드 값을 제어합니다. 주로 스피드런에 사용됩니다. - + Device Name 장치 이름 - + The name of the console. 콘솔의 이름 - + Homebrew Args 홈브루 인수 - + Command-line arguments passed to homebrew at launch (e.g. -noglsl). 홈브루 실행 시 전달되는 명령줄 인수(예: -noglsl). - + Custom RTC Date: 사용자 지정 RTC 날짜: - + This option allows to change the clock of the console. Can be used to manipulate time in games. 이 옵션을 사용하면 콘솔의 시간을 변경할 수 있습니다. 게임 내 시간을 조작하는 데 사용할 수 있습니다. - + The number of seconds from the current unix time 현재 unix 시간으로부터 경과한 초 수 - + Language: 언어: - + This option can be overridden when region setting is auto-select 이 옵션은 지역 설정이 자동 선택으로 되어 있을 경우 번복될 수 있습니다. - + Region: 지역: - + The region of the console. 콘솔의 지역 - + Time Zone: 시간대: - + The time zone of the console. 콘솔의 시간대 - + Sound Output Mode: 소리 출력 모드: - + Console Mode: 콘솔 모드: - + Selects if the console is in Docked or Handheld mode. Games will change their resolution, details and supported controllers and depending on this setting. Setting to Handheld can help improve performance for low end systems. @@ -1129,1026 +1137,1026 @@ Setting to Handheld can help improve performance for low end systems. 휴대 모드로 설정하면 저사양 시스템의 성능을 향상시키는 데 도움이 될 수 있습니다. - + Prompt for user profile on boot 부팅 시 유저 프로필 입력 요청 - + Useful if multiple people use the same PC. 여러 사람이 같은 PC를 사용할 때 유용합니다. - + Pause when not in focus 초점이 맞지 않을 때 일시 중지 - + Pauses emulation when focusing on other windows. 다른 창에 초점을 맞출 때 에뮬레이션을 일시 중지합니다. - + Confirm before stopping emulation 에뮬레이션을 중지하기 전에 확인 - + Overrides prompts asking to confirm stopping the emulation. Enabling it bypasses such prompts and directly exits the emulation. 에뮬레이션 중지를 확인하는 메시지를 무시합니다. 이 옵션을 활성화하면 이러한 메시지를 건너뛰고 에뮬레이션을 바로 종료합니다. - + Hide mouse on inactivity 마우스 커서가 비활동 상태일 때 숨기기 - + Hides the mouse after 2.5s of inactivity. 마우스 커서가 2.5초 동안 활동이 없으면 숨깁니다. - + Check for updates 업데이트 확인 - + Whether or not to check for updates upon startup. 시작 시 업데이트를 확인할지 여부. - + Enable Gamemode 게임 모드 활성화 - + Force X11 as Graphics Backend X11을 그래픽 백엔드로 강제 설정 - + Custom frontend 사용자 정의 프론트엔드 - + Real applet 실제 애플릿 - - + + Disabled 비활성화됨 - + Never 안 함 - + On Load 로드 시 - + Always 항상 - + CPU CPU - + GPU GPU - + CPU Asynchronous 비동기 CPU - + Uncompressed (Best quality) 비압축(최고 품질) - + BC1 (Low quality) BC1(저품질) - + BC3 (Medium quality) BC3(중간 품질) - - + + Auto 자동 - + 30 FPS 30 FPS - + 60 FPS 60 FPS - + 90 FPS 90 FPS - + 120 FPS 120 FPS - + Conservative 소극적 - + Aggressive 적극적 - + Vulkan Vulkan - + OpenGL GLSL OpenGL GLSL - + OpenGL GLASM (Assembly Shaders, NVIDIA Only) OpenGL GLASM(어셈블리 셰이더, NVIDIA 전용) - + OpenGL SPIR-V (Experimental, AMD/Mesa Only) OpenGL SPIR-V(실험적, AMD/Mesa 전용) - + Null Null - + Fast 고속 - - - + + + Accurate 정확 - - - + + + Default 기본값 - + Unsafe (fast) 불안전(빠름) - + Safe (stable) 안전(안정적) - + Immediate 즉시 - + Balanced 균형 - + Unsafe 불안전 - + Paranoid (disables most optimizations) 편집증적(대부분의 최적화를 비활성화함) - + Debugging 디버깅 - + Dynarmic 동적 - + NCE NCE - + Borderless Windowed 테두리 없는 창 - + Exclusive Fullscreen 독점 전체 화면 - + No Video Output 비디오 출력 없음 - + CPU Video Decoding CPU 비디오 디코딩 - + GPU Video Decoding (Default) GPU 비디오 디코딩(기본값) - + 0.25X (180p/270p) [EXPERIMENTAL] 0.25X (180p/270p) [실험적] - + 0.5X (360p/540p) [EXPERIMENTAL] 0.5X (360p/540p) [실험적] - + 0.75X (540p/810p) [EXPERIMENTAL] 0.75X (540p/810p) [실험적] - + 1X (720p/1080p) 1X (720p/1080p) - + 1.25X (900p/1350p) [EXPERIMENTAL] 1.25X (900p/1350p) [실험적] - + 1.5X (1080p/1620p) [EXPERIMENTAL] 1.5X (1080p/1620p) [실험적] - + 2X (1440p/2160p) 2X (1440p/2160p) - + 3X (2160p/3240p) 3X (2160p/3240p) - + 4X (2880p/4320p) 4X (2880p/4320p) - + 5X (3600p/5400p) 5X (3600p/5400p) - + 6X (4320p/6480p) 6X (4320p/6480p) - + 7X (5040p/7560p) 7X (5040p/7560p) - + 8X (5760p/8640p) 8X (5760p/8640p) - + Nearest Neighbor 최단입점 - + Bilinear 쌍선형 - + Bicubic 쌍입방 - + Gaussian 가우시안 - + Lanczos 란초스 - + ScaleForce ScaleForce - + AMD FidelityFX Super Resolution AMD FidelityFX Super Resolution - + Area 영역 - + MMPX MMPX - + Zero-Tangent 제로탄젠트 - + B-Spline B-스플라인 - + Mitchell 미첼 - + Spline-1 스플라인-1 - + Snapdragon Game Super Resolution Snapdragon Game Super Resolution - + Snapdragon Game Super Resolution EdgeDir Snapdragon Game Super Resolution EdgeDir - + None 없음 - + FXAA FXAA - + SMAA SMAA - + Default (16:9) 기본(16:9) - + Force 4:3 강제 4:3 - + Force 21:9 강제 21:9 - + Force 16:10 강제 16:10 - + Stretch to Window 화면 늘리기 - + Automatic 자동 - + 2x 2x - + 4x 4x - + 8x 8x - + 16x 16x - + Japanese (日本語) 일본어(日本語) - + American English 미국식 영어 - + French (français) 프랑스어(français) - + German (Deutsch) 독일어(Deutsch) - + Italian (italiano) 이탈리아어(italiano) - + Spanish (español) 스페인어(español) - + Chinese 중국어 - + Korean (한국어) 한국어(Korean) - + Dutch (Nederlands) 네덜란드어(Nederlands) - + Portuguese (português) 포르투갈어(português) - + Russian (Русский) 러시아어(Русский) - + Taiwanese 대만어 - + British English 영국식 영어 - + Canadian French 캐나다 프랑스어 - + Latin American Spanish 라틴아메리카 스페인어 - + Simplified Chinese 중국어 간체 - + Traditional Chinese (正體中文) 중국어 번체(正體中文) - + Brazilian Portuguese (português do Brasil) 브라질 포르투갈어(português do Brasil) - + Polish (polska) 폴란드어(polska) - + Thai (แบบไทย) 태국어(แบบไทย) - - + + Japan 일본 - + USA 미국 - + Europe 유럽 - + Australia 호주 - + China 중국 - + Korea 대한민국 - + Taiwan 대만 - + Auto (%1) Auto select time zone 자동(%1) - + Default (%1) Default time zone 기본(%1) - + CET CET - + CST6CDT CST6CDT - + Cuba 쿠바 - + EET EET - + Egypt 이집트 - + Eire 아일랜드 - + EST EST - + EST5EDT EST5EDT - + GB 영국 - + GB-Eire 영국-아일랜드 - + GMT GMT - + GMT+0 GMT+0 - + GMT-0 GMT-0 - + GMT0 GMT0 - + Greenwich 그리니치 - + Hongkong 홍콩 - + HST HST - + Iceland 아이슬란드 - + Iran 이란 - + Israel 이스라엘 - + Jamaica 자메이카 - + Kwajalein 콰잘레인 - + Libya 리비아 - + MET MET - + MST MST - + MST7MDT MST7MDT - + Navajo 나바호 - + NZ 뉴질랜드 - + NZ-CHAT 뉴질랜드-채텀 - + Poland 폴란드 - + Portugal 포르투갈 - + PRC 중국 - + PST8PDT PST8PDT - + ROC 대만 - + ROK 대한민국 - + Singapore 싱가포르 - + Turkey 터키 - + UCT UCT - + Universal 세계 - + UTC UTC - + W-SU 모스크바 - + WET WET - + Zulu Zulu - + Mono 모노 - + Stereo 스테레오 - + Surround 서라운드 - + 4GB DRAM (Default) 4GB DRAM(기본값) - + 6GB DRAM (Unsafe) 6GB DRAM(불안전) - + 8GB DRAM 8GB DRAM - + 10GB DRAM (Unsafe) 10GB DRAM(불안전) - + 12GB DRAM (Unsafe) 12GB DRAM(불안전) - + Docked 독 모드 - + Handheld 휴대 모드 - - + + Normal 보통 - - + + Boost 부스트 - - + + Overclock 오버클럭 - + Always ask (Default) 항상 묻기(기본값) - + Only if game specifies not to stop 게임에서 멈추지 말라고 명시한 경우에만 - + Never ask 절대 묻지 않음 - + Very Small (16 MB) 아주 작은 크기(16 MB) - + Small (32 MB) 작은 크기(32 MB) - + Normal (128 MB) 보통 크기(128 MB) - + Large (256 MB) 큰 크기(256 MB) - + Very Large (512 MB) 아주 큰 크기(512 MB) - + Very Low (4 MB) 매우 낮은 크기(4 MB) - + Low (8 MB) 낮은 크기(8 MB) - + Normal (16 MB) 보통 크기(16 MB) - + Medium (32 MB) 중간 크기(32 MB) - + High (64 MB) 높은 크기(64 MB) - + Very Low (32) 매우 낮은 크기(32) - + Low (64) 낮은 크기(64) - + Normal (128) 보통 크기(128) - + Medium (256) 보통(256) - + High (512) 빠름(512) - + ExtendedDynamicState 1 확장된 동적 상태 1 - + ExtendedDynamicState 2 확장된 동적 상태 2 - + ExtendedDynamicState 3 확장된 동적 상태 3 - + Tree View 트리 보기 - + Grid View 격자 보기 diff --git a/dist/languages/nb.ts b/dist/languages/nb.ts index 5e5edb0006..191099c395 100644 --- a/dist/languages/nb.ts +++ b/dist/languages/nb.ts @@ -696,12 +696,32 @@ Aggressive mode may impact performance of other applications such as recording s - + + GPU Readback Before NCE Invalidation + + + + + Flushes GPU buffer data back to guest memory before NCE invalidates the whole guest page, preserving it while the CPU store proceeds. + + + + + Patch Runtime NROs for NCE + + + + + Applies NCE code patches to runtime-loaded NRO modules.This is required for some games to run correctly. + + + + VSync Mode: VSync-modus: - + FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. FIFO Relaxed allows tearing as it recovers from a slow down. Mailbox can have lower latency than FIFO and does not tear but may drop frames. @@ -709,79 +729,79 @@ Immediate (no synchronization) presents whatever is available and can exhibit te - + Sync Memory Operations - + Ensures data consistency between compute and memory operations. This option fixes issues in games, but may degrade performance. Unreal Engine 4 games often see the most significant changes thereof. - + Enable asynchronous presentation (Vulkan only) Aktiver asynkron presentasjon (kun Vulkan) - + Slightly improves performance by moving presentation to a separate CPU thread. - + Force maximum clocks (Vulkan only) Tving maksikal klokkehastighet (kun Vulkan) - + Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed. Kjører arbeid i bakgrunnen mens den venter på grafikkommandoer for å forhindre at GPU-en senker klokkehastigheten. - + Anisotropic Filtering: Anisotropisk filtrering: - + Controls the quality of texture rendering at oblique angles. Safe to set at 16x on most GPUs. - + GPU Mode: GPU-modus: - + Controls the GPU emulation mode. Most games render fine with Fast, but Accurate is still required for some. Particles tend to only render correctly with Accurate mode. - + DMA Accuracy: DMA-nøyaktighet: - + Controls the DMA read mode. Unsafe is faster, while Safe is more stable and can fix issues in some games. Default follows the GPU Accuracy setting. - + GPU Fence Behavior: - + Controls the GPU fence synchronization behavior. Immediate is the fastest option, but can introduce some issues. Balanced offers better compatibility and may fix issues in some games. @@ -790,1301 +810,1290 @@ Default follows the GPU Mode setting. - + Enable asynchronous shader compilation - + May reduce shader stutter. - + GPU Clocks - + Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch's clocks. - + GPU Unswizzle - + Accelerates BCn 3D texture decoding using GPU compute. Disable if experiencing crashes or graphical glitches. - + GPU Unswizzle Max Texture Size - + Sets the maximum size (MiB) for GPU-based texture unswizzling. While the GPU is faster for medium and large textures, the CPU may be more efficient for very small ones. Adjust this to find the balance between GPU acceleration and CPU overhead. - + GPU Unswizzle Stream Size - + Sets the maximum amount of texture data (in MiB) processed per frame. Higher values can reduce stutter during texture loading but may impact frame consistency. - + GPU Unswizzle Chunk Size - + Determines the number of depth slices processed in a single dispatch. Increasing this can improve throughput on high-end GPUs but may cause TDR or driver timeouts on weaker hardware. - + Use Vulkan pipeline cache Bruk Vulkan-rørledningsbuffer - + Enables GPU vendor-specific pipeline cache. This option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally. - + Enable Compute Pipelines (Intel Vulkan Only) - + Required by some games. This setting only exists for Intel proprietary drivers and may crash if enabled. Compute pipelines are always enabled on all other drivers. - + Enable Reactive Flushing Aktiver Reaktiv Tømming - + Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing. - + Sync to framerate of video playback Synkroniser med bildefrekvensen for videoavspilling - + Run the game at normal speed during video playback, even when the framerate is unlocked. Kjør spillet i normal hastighet under videoavspilling, selv når bildefrekvensen er låst opp. - + Barrier feedback loops Tilbakekoblingssløyfer for barrierer - + Improves rendering of transparency effects in specific games. Forbedrer gjengivelsen av transparenseffekter i spesifikke spill. - + Enable buffer history - + Enables access to previous buffer states. This option may improve rendering quality and performance consistency in some games. - + Fix bloom effects - + Removes bloom in Burnout. - - Enable Legacy Rescale Pass - - - - - May fix rescale issues in some games by relying on behavior from the previous implementation. -Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and grey texture flicker on Nvidia GPUs in Luigis Mansion 3. - - - - + Extended Dynamic State - + Controls the number of features that can be used in Extended Dynamic State. Higher states allow for more features and can increase performance, but may cause additional graphical issues. - + Vertex Input Dynamic State - + Enables vertex input dynamic state feature for better quality and performance. - + Sample Shading - + Allows the fragment shader to execute per sample in a multi-sampled fragment instead of once per fragment. Improves graphics quality at the cost of performance. Higher values improve quality but degrade performance. - + RNG Seed RNG-frø - + Controls the seed of the random number generator. Mainly used for speedrunning. - + Device Name Enhetsnavn - + The name of the console. Konsollens navn. - + Homebrew Args - + Command-line arguments passed to homebrew at launch (e.g. -noglsl). - + Custom RTC Date: Selvvalgt RTC-dato: - + This option allows to change the clock of the console. Can be used to manipulate time in games. - + The number of seconds from the current unix time - + Language: Språk: - + This option can be overridden when region setting is auto-select - + Region: Region: - + The region of the console. Konsollens region. - + Time Zone: Tidssone: - + The time zone of the console. Konsollens tidssone. - + Sound Output Mode: Lydutdatamodus: - + Console Mode: Konsollmodus: - + Selects if the console is in Docked or Handheld mode. Games will change their resolution, details and supported controllers and depending on this setting. Setting to Handheld can help improve performance for low end systems. - + Prompt for user profile on boot - + Useful if multiple people use the same PC. - + Pause when not in focus - + Pauses emulation when focusing on other windows. - + Confirm before stopping emulation Bekreft før stopping av emulering - + Overrides prompts asking to confirm stopping the emulation. Enabling it bypasses such prompts and directly exits the emulation. - + Hide mouse on inactivity Gjem mus under inaktivitet - + Hides the mouse after 2.5s of inactivity. - + Check for updates Se etter oppdateringer - + Whether or not to check for updates upon startup. - + Enable Gamemode - + Force X11 as Graphics Backend - + Custom frontend - + Real applet - - + + Disabled Skrudd av - + Never Aldri - + On Load - + Always Alltid - + CPU CPU - + GPU Skjermkort - + CPU Asynchronous - + Uncompressed (Best quality) Ukomprimert (Best kvalitet) - + BC1 (Low quality) BC1 (Lav kvalitet) - + BC3 (Medium quality) BC3 (Middels kvalitet) - - + + Auto Auto - + 30 FPS 30 FPS - + 60 FPS 60 FPS - + 90 FPS 90 FPS - + 120 FPS 120 FPS - + Conservative - + Aggressive Aggressiv - + Vulkan Vulkan - + OpenGL GLSL OpenGL GLSL - + OpenGL GLASM (Assembly Shaders, NVIDIA Only) - + OpenGL SPIR-V (Experimental, AMD/Mesa Only) OpenGL SPIR-V (eksperimentelt, kun AMD/Mesa) - + Null Null - + Fast Rask - - - + + + Accurate Nøyaktig - - - + + + Default Standard - + Unsafe (fast) Utrygg (raskt) - + Safe (stable) Trygg (stabil) - + Immediate - + Balanced Balansert - + Unsafe Utrygt - + Paranoid (disables most optimizations) Paranoid (deaktiverer de fleste optimaliseringer) - + Debugging - + Dynarmic - + NCE NCE - + Borderless Windowed Rammeløst vindu - + Exclusive Fullscreen Eksklusiv fullskjerm - + No Video Output Ingen videoutdata - + CPU Video Decoding CPU-videodekoding - + GPU Video Decoding (Default) GPU-videodekoding (Standard) - + 0.25X (180p/270p) [EXPERIMENTAL] 0,25× (180p/270p) [EKSPERIMENTELL] - + 0.5X (360p/540p) [EXPERIMENTAL] 0,5× (360p/540p) [EKSPERIMENTELL] - + 0.75X (540p/810p) [EXPERIMENTAL] 0,75× (540p/810p) [EKSPERIMENTELL] - + 1X (720p/1080p) 1× (720p/1080p) - + 1.25X (900p/1350p) [EXPERIMENTAL] 1,25× (900p/1350p) [EKSPERIMENTELL] - + 1.5X (1080p/1620p) [EXPERIMENTAL] 1,5× (1080p/1620p) [EKSPERIMENTELL] - + 2X (1440p/2160p) 2× (1440p/2160p) - + 3X (2160p/3240p) 3× (2160p/3240p) - + 4X (2880p/4320p) 4× (2880p/4320p) - + 5X (3600p/5400p) 5× (3600p/5400p) - + 6X (4320p/6480p) 6× (4320p/6480p) - + 7X (5040p/7560p) 7× (5040p/7560p) - + 8X (5760p/8640p) 8× (5760p/8640p) - + Nearest Neighbor Nærmeste nabo - + Bilinear Bilineær - + Bicubic Bikubisk - + Gaussian Gaussisk - + Lanczos Lanczos - + ScaleForce ScaleForce - + AMD FidelityFX Super Resolution AMD FidelityFX Super Resolution - + Area Område - + MMPX MMPX - + Zero-Tangent - + B-Spline B-Spline - + Mitchell Mitchell - + Spline-1 Spline-1 - + Snapdragon Game Super Resolution - + Snapdragon Game Super Resolution EdgeDir - + None Ingen - + FXAA FXAA - + SMAA SMAA - + Default (16:9) Standard (16:9) - + Force 4:3 Tving 4:3 - + Force 21:9 Tving 21:9 - + Force 16:10 Tving 16:10 - + Stretch to Window Strekk til vinduet - + Automatic Automatisk - + 2x 2x - + 4x 4x - + 8x 8x - + 16x 16x - + Japanese (日本語) Japansk (日本語) - + American English Amerikansk engelsk - + French (français) Fransk (français) - + German (Deutsch) Tysk (Deutsch) - + Italian (italiano) Italiensk (italiano) - + Spanish (español) Spansk (español) - + Chinese Kinesisk - + Korean (한국어) Koreansk (한국어) - + Dutch (Nederlands) Nederlandsk (Nederlands) - + Portuguese (português) Portugisisk (português) - + Russian (Русский) Russisk (Русский) - + Taiwanese Taiwansk - + British English Britisk engelsk - + Canadian French Kanadisk fransk - + Latin American Spanish Latinamerikansk spansk - + Simplified Chinese Forenklet kinesisk - + Traditional Chinese (正體中文) Tradisjonell kinesisk (正體中文) - + Brazilian Portuguese (português do Brasil) Brasiliansk portugisisk (português do Brasil) - + Polish (polska) Polsk (polska) - + Thai (แบบไทย) Thai (แบบไทย) - - + + Japan Japan - + USA USA - + Europe Europa - + Australia Australia - + China Folkerepublikken Kina - + Korea Korea - + Taiwan Taiwan (Republikken Kina) - + Auto (%1) Auto select time zone Auto (%1) - + Default (%1) Default time zone Standard (%1) - + CET Sentraleuropeisk tid - + CST6CDT CST6CDT - + Cuba Cuba - + EET Østeuropeisk tid - + Egypt Egypt - + Eire Republikken Irland - + EST EST - + EST5EDT EST5EDT - + GB Storbritannia - + GB-Eire GB-Eire - + GMT GMT - + GMT+0 GMT+0 - + GMT-0 GMT-0 - + GMT0 GMT0 - + Greenwich Greenwich - + Hongkong Hongkong - + HST HST - + Iceland Island - + Iran Iran - + Israel Israel - + Jamaica Jamaica - + Kwajalein Kwajalein - + Libya Libya - + MET MET - + MST MST - + MST7MDT MST7MDT - + Navajo Navajo - + NZ NZ - + NZ-CHAT NZ-CHAT - + Poland Polen - + Portugal Portugal - + PRC Folkerepublikken Kina - + PST8PDT PST8PDT - + ROC Taiwan (Republikken Kina) - + ROK Sør-Korea - + Singapore Singapore - + Turkey Tyrkia - + UCT UCT - + Universal Universalt - + UTC UTC - + W-SU W-SU - + WET WET - + Zulu Zulu - + Mono Mono - + Stereo Stereo - + Surround Surround - + 4GB DRAM (Default) 4 GB DRAM (Standard) - + 6GB DRAM (Unsafe) 6 GB DRAM (Utrygt) - + 8GB DRAM 8 GB DRAM - + 10GB DRAM (Unsafe) 10 GB DRAM (Utrygt) - + 12GB DRAM (Unsafe) 12 GB DRAM (Utrygt) - + Docked I dokking - + Handheld Håndholdt - - + + Normal - - + + Boost - - + + Overclock - + Always ask (Default) Spør alltid (Standard) - + Only if game specifies not to stop - + Never ask Aldri spør - + Very Small (16 MB) Veldig liten (16 MB) - + Small (32 MB) Liten (32 MB) - + Normal (128 MB) Normal (128 MB) - + Large (256 MB) Stor (256 MB) - + Very Large (512 MB) Veldig stor (512 MB) - + Very Low (4 MB) Veldig lav (4 MB) - + Low (8 MB) Lav (8 MB) - + Normal (16 MB) Normal (16 MB) - + Medium (32 MB) Middels (32 MB) - + High (64 MB) Høy (64 MB) - + Very Low (32) Svært lav (32) - + Low (64) Lav (64) - + Normal (128) Normal (128) - + Medium (256) Middels (256) - + High (512) Høy (512) - + ExtendedDynamicState 1 - + ExtendedDynamicState 2 - + ExtendedDynamicState 3 - + Tree View - + Grid View diff --git a/dist/languages/nl.ts b/dist/languages/nl.ts index 296dd3ebca..8e99ce56d4 100644 --- a/dist/languages/nl.ts +++ b/dist/languages/nl.ts @@ -703,12 +703,32 @@ Aggressive mode may impact performance of other applications such as recording s - + + GPU Readback Before NCE Invalidation + + + + + Flushes GPU buffer data back to guest memory before NCE invalidates the whole guest page, preserving it while the CPU store proceeds. + + + + + Patch Runtime NROs for NCE + + + + + Applies NCE code patches to runtime-loaded NRO modules.This is required for some games to run correctly. + + + + VSync Mode: VSync-modus: - + FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. FIFO Relaxed allows tearing as it recovers from a slow down. Mailbox can have lower latency than FIFO and does not tear but may drop frames. @@ -716,79 +736,79 @@ Immediate (no synchronization) presents whatever is available and can exhibit te - + Sync Memory Operations - + Ensures data consistency between compute and memory operations. This option fixes issues in games, but may degrade performance. Unreal Engine 4 games often see the most significant changes thereof. - + Enable asynchronous presentation (Vulkan only) Schakel asynchrone presentatie in (alleen Vulkan) - + Slightly improves performance by moving presentation to a separate CPU thread. - + Force maximum clocks (Vulkan only) Forceer maximale klokken (alleen Vulkan) - + Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed. Werkt op de achtergrond terwijl er wordt gewacht op grafische opdrachten om te voorkomen dat de GPU zijn kloksnelheid verlaagt. - + Anisotropic Filtering: Anisotrope Filtering: - + Controls the quality of texture rendering at oblique angles. Safe to set at 16x on most GPUs. - + GPU Mode: - + Controls the GPU emulation mode. Most games render fine with Fast, but Accurate is still required for some. Particles tend to only render correctly with Accurate mode. - + DMA Accuracy: - + Controls the DMA read mode. Unsafe is faster, while Safe is more stable and can fix issues in some games. Default follows the GPU Accuracy setting. - + GPU Fence Behavior: - + Controls the GPU fence synchronization behavior. Immediate is the fastest option, but can introduce some issues. Balanced offers better compatibility and may fix issues in some games. @@ -797,1301 +817,1290 @@ Default follows the GPU Mode setting. - + Enable asynchronous shader compilation - + May reduce shader stutter. - + GPU Clocks - + Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch's clocks. - + GPU Unswizzle - + Accelerates BCn 3D texture decoding using GPU compute. Disable if experiencing crashes or graphical glitches. - + GPU Unswizzle Max Texture Size - + Sets the maximum size (MiB) for GPU-based texture unswizzling. While the GPU is faster for medium and large textures, the CPU may be more efficient for very small ones. Adjust this to find the balance between GPU acceleration and CPU overhead. - + GPU Unswizzle Stream Size - + Sets the maximum amount of texture data (in MiB) processed per frame. Higher values can reduce stutter during texture loading but may impact frame consistency. - + GPU Unswizzle Chunk Size - + Determines the number of depth slices processed in a single dispatch. Increasing this can improve throughput on high-end GPUs but may cause TDR or driver timeouts on weaker hardware. - + Use Vulkan pipeline cache Gebruik Vulkan-pijplijn-cache - + Enables GPU vendor-specific pipeline cache. This option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally. - + Enable Compute Pipelines (Intel Vulkan Only) - + Required by some games. This setting only exists for Intel proprietary drivers and may crash if enabled. Compute pipelines are always enabled on all other drivers. - + Enable Reactive Flushing Schakel Reactive Flushing In - + Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing. - + Sync to framerate of video playback - + Run the game at normal speed during video playback, even when the framerate is unlocked. - + Barrier feedback loops - + Improves rendering of transparency effects in specific games. - + Enable buffer history - + Enables access to previous buffer states. This option may improve rendering quality and performance consistency in some games. - + Fix bloom effects - + Removes bloom in Burnout. - - Enable Legacy Rescale Pass - - - - - May fix rescale issues in some games by relying on behavior from the previous implementation. -Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and grey texture flicker on Nvidia GPUs in Luigis Mansion 3. - - - - + Extended Dynamic State - + Controls the number of features that can be used in Extended Dynamic State. Higher states allow for more features and can increase performance, but may cause additional graphical issues. - + Vertex Input Dynamic State - + Enables vertex input dynamic state feature for better quality and performance. - + Sample Shading - + Allows the fragment shader to execute per sample in a multi-sampled fragment instead of once per fragment. Improves graphics quality at the cost of performance. Higher values improve quality but degrade performance. - + RNG Seed RNG Seed - + Controls the seed of the random number generator. Mainly used for speedrunning. - + Device Name Apparaatnaam - + The name of the console. - + Homebrew Args - + Command-line arguments passed to homebrew at launch (e.g. -noglsl). - + Custom RTC Date: Aangepaste RTC Datum: - + This option allows to change the clock of the console. Can be used to manipulate time in games. - + The number of seconds from the current unix time - + Language: Taal: - + This option can be overridden when region setting is auto-select - + Region: Regio: - + The region of the console. - + Time Zone: Tijdzone: - + The time zone of the console. - + Sound Output Mode: Geluidsuitvoermodus: - + Console Mode: Console Modus: - + Selects if the console is in Docked or Handheld mode. Games will change their resolution, details and supported controllers and depending on this setting. Setting to Handheld can help improve performance for low end systems. - + Prompt for user profile on boot - + Useful if multiple people use the same PC. - + Pause when not in focus - + Pauses emulation when focusing on other windows. - + Confirm before stopping emulation Bevestig voordat u de emulatie stopt - + Overrides prompts asking to confirm stopping the emulation. Enabling it bypasses such prompts and directly exits the emulation. - + Hide mouse on inactivity Verberg muis wanneer inactief - + Hides the mouse after 2.5s of inactivity. - + Check for updates - + Whether or not to check for updates upon startup. - + Enable Gamemode - + Force X11 as Graphics Backend - + Custom frontend - + Real applet - - + + Disabled - + Never - + On Load - + Always - + CPU CPU - + GPU - + CPU Asynchronous - + Uncompressed (Best quality) - + BC1 (Low quality) BC1 (Lage Kwaliteit) - + BC3 (Medium quality) BC3 (Gemiddelde kwaliteit) - - + + Auto Auto - + 30 FPS - + 60 FPS - + 90 FPS - + 120 FPS - + Conservative - + Aggressive - + Vulkan Vulkan - + OpenGL GLSL - + OpenGL GLASM (Assembly Shaders, NVIDIA Only) - + OpenGL SPIR-V (Experimental, AMD/Mesa Only) - + Null Null - + Fast - - - + + + Accurate Accuraat - - - + + + Default Standaard - + Unsafe (fast) - + Safe (stable) - + Immediate - + Balanced - + Unsafe Onveilig - + Paranoid (disables most optimizations) Paranoid (schakelt de meeste optimalisaties uit) - + Debugging - + Dynarmic - + NCE - + Borderless Windowed Randloos Venster - + Exclusive Fullscreen Exclusief Volledig Scherm - + No Video Output Geen Video-uitvoer - + CPU Video Decoding CPU Videodecodering - + GPU Video Decoding (Default) GPU Videodecodering (Standaard) - + 0.25X (180p/270p) [EXPERIMENTAL] - + 0.5X (360p/540p) [EXPERIMENTAL] - + 0.75X (540p/810p) [EXPERIMENTAL] 0.75X (540p/810p) [EXPERIMENTEEL] - + 1X (720p/1080p) 1X (720p/1080p) - + 1.25X (900p/1350p) [EXPERIMENTAL] - + 1.5X (1080p/1620p) [EXPERIMENTAL] 1.5X (1080p/1620p) [EXPERIMENTEEL] - + 2X (1440p/2160p) 2X (1440p/2160p) - + 3X (2160p/3240p) 3X (2160p/3240p) - + 4X (2880p/4320p) 4X (2880p/4320p) - + 5X (3600p/5400p) 5X (3600p/5400p) - + 6X (4320p/6480p) 6X (4320p/6480p) - + 7X (5040p/7560p) 7X (5040p/7560p) - + 8X (5760p/8640p) 8X (5760p/8640p) - + Nearest Neighbor Nearest Neighbor - + Bilinear Bilinear - + Bicubic Bicubic - + Gaussian Gaussian - + Lanczos - + ScaleForce ScaleForce - + AMD FidelityFX Super Resolution - + Area - + MMPX - + Zero-Tangent - + B-Spline - + Mitchell - + Spline-1 - + Snapdragon Game Super Resolution - + Snapdragon Game Super Resolution EdgeDir - + None Geen - + FXAA FXAA - + SMAA SMAA - + Default (16:9) Standaart (16:9) - + Force 4:3 Forceer 4:3 - + Force 21:9 Forceer 21:9 - + Force 16:10 Forceer 16:10 - + Stretch to Window Uitrekken naar Venster - + Automatic Automatisch - + 2x 2x - + 4x 4x - + 8x 8x - + 16x 16x - + Japanese (日本語) Japans (日本語) - + American English Amerikaans-Engels - + French (français) Frans (Français) - + German (Deutsch) Duits (Deutsch) - + Italian (italiano) Italiaans (italiano) - + Spanish (español) Spaans (Español) - + Chinese Chinees - + Korean (한국어) Koreaans (한국어) - + Dutch (Nederlands) Nederlands (Nederlands) - + Portuguese (português) Portugees (português) - + Russian (Русский) Russisch (Русский) - + Taiwanese Taiwanese - + British English Brits-Engels - + Canadian French Canadees-Frans - + Latin American Spanish Latijns-Amerikaans Spaans - + Simplified Chinese Vereenvoudigd Chinees - + Traditional Chinese (正體中文) Traditioneel Chinees (正體中文) - + Brazilian Portuguese (português do Brasil) Braziliaans-Portugees (português do Brasil) - + Polish (polska) - + Thai (แบบไทย) - - + + Japan Japan - + USA USA - + Europe Europa - + Australia Australië - + China China - + Korea Korea - + Taiwan Taiwan - + Auto (%1) Auto select time zone Auto (%1) - + Default (%1) Default time zone Standaard (%1) - + CET CET - + CST6CDT CST6CDT - + Cuba Cuba - + EET EET - + Egypt Egypte - + Eire Eire - + EST EST - + EST5EDT EST5EDT - + GB GB - + GB-Eire GB-Eire - + GMT GMT - + GMT+0 GMT+0 - + GMT-0 GMT-0 - + GMT0 GMT0 - + Greenwich Greenwich - + Hongkong Hongkong - + HST HST - + Iceland Ijsland - + Iran Iran - + Israel Israel - + Jamaica Jamaica - + Kwajalein Kwajalein - + Libya Libië - + MET MET - + MST MST - + MST7MDT MST7MDT - + Navajo Navajo - + NZ NZ - + NZ-CHAT NZ-CHAT - + Poland Polen - + Portugal Portugal - + PRC PRC - + PST8PDT PST8PDT - + ROC ROC - + ROK ROK - + Singapore Singapore - + Turkey Turkije - + UCT UCT - + Universal Universeel - + UTC UTC - + W-SU W-SU - + WET WET - + Zulu Zulu - + Mono Mono - + Stereo Stereo - + Surround Surround - + 4GB DRAM (Default) - + 6GB DRAM (Unsafe) - + 8GB DRAM - + 10GB DRAM (Unsafe) - + 12GB DRAM (Unsafe) - + Docked Docked - + Handheld Handheld - - + + Normal - - + + Boost - - + + Overclock - + Always ask (Default) - + Only if game specifies not to stop - + Never ask - + Very Small (16 MB) - + Small (32 MB) - + Normal (128 MB) - + Large (256 MB) - + Very Large (512 MB) - + Very Low (4 MB) - + Low (8 MB) - + Normal (16 MB) - + Medium (32 MB) - + High (64 MB) - + Very Low (32) - + Low (64) - + Normal (128) - + Medium (256) - + High (512) - + ExtendedDynamicState 1 - + ExtendedDynamicState 2 - + ExtendedDynamicState 3 - + Tree View - + Grid View diff --git a/dist/languages/pl.ts b/dist/languages/pl.ts index 4b94ca5e55..28a51ae4f8 100644 --- a/dist/languages/pl.ts +++ b/dist/languages/pl.ts @@ -729,12 +729,32 @@ Tryb agresywny może pogorszyć działanie innych aplikacji, np. oprogramowania Pomija niektóre unieważnienia pamięci podręcznej po stronie CPU podczas aktualizacji pamięci, zmniejszając użycie CPU i poprawiając jego wydajność. Może powodować błędy lub awarie w niektórych grach. - + + GPU Readback Before NCE Invalidation + + + + + Flushes GPU buffer data back to guest memory before NCE invalidates the whole guest page, preserving it while the CPU store proceeds. + + + + + Patch Runtime NROs for NCE + + + + + Applies NCE code patches to runtime-loaded NRO modules.This is required for some games to run correctly. + + + + VSync Mode: Tryb synchronizacji pionowej: - + FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. FIFO Relaxed allows tearing as it recovers from a slow down. Mailbox can have lower latency than FIFO and does not tear but may drop frames. @@ -745,12 +765,12 @@ Mailbox może mieć niższe opóźnienia niż FIFO i nie powoduje tearingu, ale Immediate (bez synchronizacji) wyświetla wszystko, co jest dostępne, i może powodować tearing. - + Sync Memory Operations Synchronizuj operacje pamięci - + Ensures data consistency between compute and memory operations. This option fixes issues in games, but may degrade performance. Unreal Engine 4 games often see the most significant changes thereof. @@ -758,68 +778,68 @@ Unreal Engine 4 games often see the most significant changes thereof. Gry z Unreal Engine 4 mogą być najbardziej dotknięte. - + Enable asynchronous presentation (Vulkan only) Włącz asynchroniczną prezentację (tylko Vulkan) - + Slightly improves performance by moving presentation to a separate CPU thread. Nieznacznie poprawia wydajność, przenosząc prezentację na oddzielny wątek CPU. - + Force maximum clocks (Vulkan only) Wymuś maksymalne zegary (Tylko Vulkan) - + Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed. Uruchamia pracę w tle podczas oczekiwania na komendy graficzne aby GPU nie obniżało taktowania. - + Anisotropic Filtering: Filtrowanie anizotropowe: - + Controls the quality of texture rendering at oblique angles. Safe to set at 16x on most GPUs. Steruje jakością renderowania tekstur pod ostrymi kątami. Na większości GPU bezpieczną wartością jest 16x. - + GPU Mode: Tryb GPU: - + Controls the GPU emulation mode. Most games render fine with Fast, but Accurate is still required for some. Particles tend to only render correctly with Accurate mode. - + DMA Accuracy: Dokładność DMA: - + Controls the DMA read mode. Unsafe is faster, while Safe is more stable and can fix issues in some games. Default follows the GPU Accuracy setting. - + GPU Fence Behavior: - + Controls the GPU fence synchronization behavior. Immediate is the fastest option, but can introduce some issues. Balanced offers better compatibility and may fix issues in some games. @@ -828,89 +848,89 @@ Default follows the GPU Mode setting. - + Enable asynchronous shader compilation Włącz asynchroniczną kompilację shaderów - + May reduce shader stutter. Może zmniejszyć zacięcia spowodowane kompilacją shaderów. - + GPU Clocks - + Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch's clocks. - + GPU Unswizzle - + Accelerates BCn 3D texture decoding using GPU compute. Disable if experiencing crashes or graphical glitches. - + GPU Unswizzle Max Texture Size - + Sets the maximum size (MiB) for GPU-based texture unswizzling. While the GPU is faster for medium and large textures, the CPU may be more efficient for very small ones. Adjust this to find the balance between GPU acceleration and CPU overhead. - + GPU Unswizzle Stream Size - + Sets the maximum amount of texture data (in MiB) processed per frame. Higher values can reduce stutter during texture loading but may impact frame consistency. - + GPU Unswizzle Chunk Size - + Determines the number of depth slices processed in a single dispatch. Increasing this can improve throughput on high-end GPUs but may cause TDR or driver timeouts on weaker hardware. - + Use Vulkan pipeline cache Użyj pamięci podręcznej strumienia dla Vulkana - + Enables GPU vendor-specific pipeline cache. This option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally. Włącza specyficzną dla producenta GPU pamięć podręczną potoków. Ta opcja może znacząco skrócić czas ładowania shaderów w przypadkach, gdy sterownik Vulkan nie przechowuje wewnętrznie plików pamięci podręcznej potoków. - + Enable Compute Pipelines (Intel Vulkan Only) Włącz potoki obliczeniowe (tylko Intel Vulkan) - + Required by some games. This setting only exists for Intel proprietary drivers and may crash if enabled. Compute pipelines are always enabled on all other drivers. @@ -919,192 +939,181 @@ To ustawienie istnieje wyłącznie dla sterowników Intela i może spowodować b Na wszystkich pozostałych sterownikach potoki obliczeniowe są zawsze włączone. - + Enable Reactive Flushing Włącz reaktywne opróżnianie buforów - + Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing. Używa opróżniania reaktywnego zamiast predykcyjnego, co umożliwia dokładniejsze synchronizowanie pamięci. - + Sync to framerate of video playback Synchronizuj do liczby klatek odtwarzanego wideo - + Run the game at normal speed during video playback, even when the framerate is unlocked. Uruchamiaj grę z normalną prędkością podczas odtwarzania wideo, nawet przy odblokowanej liczbie klatek na sekundę. - + Barrier feedback loops Pętle sprzężenia zwrotnego barier - + Improves rendering of transparency effects in specific games. Poprawia renderowanie efektów przezroczystości w niektórych grach. - + Enable buffer history - + Enables access to previous buffer states. This option may improve rendering quality and performance consistency in some games. - + Fix bloom effects - + Removes bloom in Burnout. - - Enable Legacy Rescale Pass - - - - - May fix rescale issues in some games by relying on behavior from the previous implementation. -Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and grey texture flicker on Nvidia GPUs in Luigis Mansion 3. - - - - + Extended Dynamic State Rozszerzony stan dynamiczny - + Controls the number of features that can be used in Extended Dynamic State. Higher states allow for more features and can increase performance, but may cause additional graphical issues. Kontroluje liczbę funkcji, które mogą być używane w Extended Dynamic State. Wyższe poziomy pozwalają na użycie większej liczby funkcji i mogą zwiększyć wydajność, ale mogą powodować dodatkowe problemy z grafiką. - + Vertex Input Dynamic State Dynamiczny stan wejścia wierzchołków - + Enables vertex input dynamic state feature for better quality and performance. Włącza funkcję dynamicznego stanu wejścia wierzchołków, poprawiając jakość i wydajność. - + Sample Shading Cieniowanie próbkowe - + Allows the fragment shader to execute per sample in a multi-sampled fragment instead of once per fragment. Improves graphics quality at the cost of performance. Higher values improve quality but degrade performance. Pozwala wykonywać shader fragmentów dla każdej próbki we fragmencie wielokrotnie próbkowanym zamiast raz dla każdego fragmentu. Poprawia jakość grafiki kosztem wydajności. Wyższe wartości poprawiają jakość, ale obniżają wydajność. - + RNG Seed Ziarno RNG - + Controls the seed of the random number generator. Mainly used for speedrunning. Ustala ziarno generatora liczb losowych. Głównie używane do speedrunów. - + Device Name Nazwa urządzenia - + The name of the console. The name of the console. - + Homebrew Args - + Command-line arguments passed to homebrew at launch (e.g. -noglsl). - + Custom RTC Date: Własna data RTC - + This option allows to change the clock of the console. Can be used to manipulate time in games. Ta opcja pozwala zmienić zegar konsoli. Może służyć do manipulowania czasem w grach. - + The number of seconds from the current unix time Liczba sekund od bieżącego czasu Unix - + Language: Język: - + This option can be overridden when region setting is auto-select Ta opcja może zostać nadpisana, gdy ustawienie regionu to automatyczny wybór. - + Region: Region: - + The region of the console. Region konsoli. - + Time Zone: Strefa czasowa: - + The time zone of the console. Strefa czasowa konsoli. - + Sound Output Mode: Tryb wyjścia dźwięku: - + Console Mode: Tryb konsoli - + Selects if the console is in Docked or Handheld mode. Games will change their resolution, details and supported controllers and depending on this setting. Setting to Handheld can help improve performance for low end systems. @@ -1113,1026 +1122,1026 @@ W zależności od tego ustawienia gry zmienią swoją rozdzielczość, szczegó Ustawienie na Handheld może poprawić wydajność na słabszych komputerach. - + Prompt for user profile on boot Pytaj o profil użytkownika przy uruchomieniu. - + Useful if multiple people use the same PC. Przydatne, gdy z tego samego PC korzysta wiele osób. - + Pause when not in focus Wstrzymuj, gdy okno nie jest aktywne - + Pauses emulation when focusing on other windows. Wstrzymuje emulację po przełączeniu na inne okna. - + Confirm before stopping emulation Potwierdzaj przed zatrzymaniem emulacji - + Overrides prompts asking to confirm stopping the emulation. Enabling it bypasses such prompts and directly exits the emulation. Nadpisuje monity z prośbą o potwierdzenie zatrzymania emulacji. Włączenie powoduje pominięcie takich monitów i bezpośrednie wyjście z emulacji. - + Hide mouse on inactivity Ukryj mysz przy braku aktywności - + Hides the mouse after 2.5s of inactivity. Ukrywa kursor po 2,5 s bezczynności. - + Check for updates Sprawdź aktualizacje - + Whether or not to check for updates upon startup. Czy sprawdzać aktualizacje przy uruchomieniu. - + Enable Gamemode Włącz Tryb gry - + Force X11 as Graphics Backend Wymuś X11 jako backend grafiki - + Custom frontend Niestandardowy frontend - + Real applet Prawdziwy aplet - - + + Disabled Wyłączone - + Never Nigdy - + On Load Przy wczytywaniu - + Always Zawsze - + CPU CPU - + GPU GPU - + CPU Asynchronous Asynchroniczne CPU - + Uncompressed (Best quality) Brak (najlepsza jakość) - + BC1 (Low quality) BC1 (niska jakość) - + BC3 (Medium quality) BC3 (średnia jakość) - - + + Auto Automatyczny - + 30 FPS - + 60 FPS - + 90 FPS - + 120 FPS - + Conservative Konserwatywny - + Aggressive Agresywny - + Vulkan Vulkan - + OpenGL GLSL - + OpenGL GLASM (Assembly Shaders, NVIDIA Only) - + OpenGL SPIR-V (Experimental, AMD/Mesa Only) - + Null Null - + Fast Szybkie - - - + + + Accurate Dokładny - - - + + + Default Domyślny - + Unsafe (fast) Niezalecane (szybkie) - + Safe (stable) Bezpieczne (stabilne) - + Immediate - + Balanced Zrównoważony - + Unsafe Niebezpieczny - + Paranoid (disables most optimizations) Paranoiczne (wyłącza większość optymalizacji) - + Debugging Debugowanie - + Dynarmic Dynamiczny - + NCE NCE - + Borderless Windowed W oknie (Bezramkowy) - + Exclusive Fullscreen Exclusive Fullscreen - + No Video Output Brak wyjścia wideo - + CPU Video Decoding Dekodowanie Wideo przez CPU - + GPU Video Decoding (Default) Dekodowanie Wideo przez GPU (Domyślne) - + 0.25X (180p/270p) [EXPERIMENTAL] 0,25x (180p/270p) [EKSPERYMENTALNE] - + 0.5X (360p/540p) [EXPERIMENTAL] 0,5x (360p/540p) [EKSPERYMENTALNE] - + 0.75X (540p/810p) [EXPERIMENTAL] 0.75X (540p/810p) [EKSPERYMENTALNE] - + 1X (720p/1080p) 1X (720p/1080p) - + 1.25X (900p/1350p) [EXPERIMENTAL] 1.25X (900p/1350p) [EKSPERYMENTALNE] - + 1.5X (1080p/1620p) [EXPERIMENTAL] 1.5X (1080p/1620p) [Ekperymentalnie] - + 2X (1440p/2160p) 2X (1440p/2160p) - + 3X (2160p/3240p) 3X (2160p/3240p) - + 4X (2880p/4320p) 4X (2880p/4320p) - + 5X (3600p/5400p) 5X (3600p/5400p) - + 6X (4320p/6480p) 6X (4320p/6480p) - + 7X (5040p/7560p) 7X (5040p/7560p) - + 8X (5760p/8640p) 8X (5760p/8640p) - + Nearest Neighbor Najbliższy sąsiadujący - + Bilinear Bilinearny - + Bicubic Bikubiczny - + Gaussian Kulisty - + Lanczos Lanczos - + ScaleForce ScaleForce - + AMD FidelityFX Super Resolution AMD FidelityFX Super Resolution - + Area Obszar - + MMPX MMPX - + Zero-Tangent Zero-Tangent - + B-Spline B-Spline - + Mitchell Mitchell - + Spline-1 Spline-1 - + Snapdragon Game Super Resolution - + Snapdragon Game Super Resolution EdgeDir - + None Żadna (wyłączony) - + FXAA FXAA - + SMAA SMAA - + Default (16:9) Domyślne (16:9) - + Force 4:3 Wymuś 4:3 - + Force 21:9 Wymuś 21:9 - + Force 16:10 Wymuś 16:10 - + Stretch to Window Rozciągnij do Okna - + Automatic Automatyczne - + 2x 2x - + 4x 4x - + 8x 8x - + 16x 16x - + Japanese (日本語) Japoński (日本語) - + American English Angielski Amerykański - + French (français) Francuski (français) - + German (Deutsch) Niemiecki (Niemcy) - + Italian (italiano) Włoski (italiano) - + Spanish (español) Hiszpański (español) - + Chinese Chiński - + Korean (한국어) Koreański (한국어) - + Dutch (Nederlands) Duński (Holandia) - + Portuguese (português) Portugalski (português) - + Russian (Русский) Rosyjski (Русский) - + Taiwanese Tajwański - + British English Angielski Brytyjski - + Canadian French Fancuski (Kanada) - + Latin American Spanish Hiszpański (Latin American) - + Simplified Chinese Chiński (Uproszczony) - + Traditional Chinese (正體中文) Chiński tradycyjny (正體中文) - + Brazilian Portuguese (português do Brasil) Portugalski (português do Brasil) - + Polish (polska) - + Thai (แบบไทย) - - + + Japan Japonia - + USA USA - + Europe Europa - + Australia Australia - + China Chiny - + Korea Korea - + Taiwan Tajwan - + Auto (%1) Auto select time zone Auto (%1) - + Default (%1) Default time zone Domyślne (%1) - + CET CET - + CST6CDT CST6CDT - + Cuba Cuba - + EET EET - + Egypt Egipt - + Eire Irlandia - + EST EST - + EST5EDT EST5EDT - + GB GB - + GB-Eire GB-Eire - + GMT GMT - + GMT+0 GMT+0 - + GMT-0 GMT-0 - + GMT0 GMT0 - + Greenwich Greenwich - + Hongkong Hongkong - + HST HST - + Iceland Islandia - + Iran Iran - + Israel Izrael - + Jamaica Jamajka - + Kwajalein Kwajalein - + Libya Libia - + MET MET - + MST MST - + MST7MDT MST7MDT - + Navajo Navajo - + NZ NZ - + NZ-CHAT NZ-CHAT - + Poland Polska - + Portugal Portugalia - + PRC PRC - + PST8PDT PST8PDT - + ROC ROC - + ROK ROK - + Singapore Singapur - + Turkey Turcja - + UCT UCT - + Universal Uniwersalny - + UTC UTC - + W-SU W-SU - + WET WET - + Zulu Zulu - + Mono Mono - + Stereo Stereo - + Surround Surround - + 4GB DRAM (Default) 4GB DRAM (Domyślne) - + 6GB DRAM (Unsafe) 6GB DRAM (NIebezpieczne) - + 8GB DRAM 8GB DRAM - + 10GB DRAM (Unsafe) 10GB DRAM (NIebezpieczne) - + 12GB DRAM (Unsafe) 12GB DRAM (NIebezpieczne) - + Docked Zadokowany - + Handheld Przenośnie - - + + Normal - - + + Boost - - + + Overclock - + Always ask (Default) Zawsze pytaj (Domyślne) - + Only if game specifies not to stop Tylko jeśli gra określa, aby nie zatrzymywać - + Never ask Nie pytaj więcej - + Very Small (16 MB) - + Small (32 MB) - + Normal (128 MB) - + Large (256 MB) - + Very Large (512 MB) - + Very Low (4 MB) - + Low (8 MB) - + Normal (16 MB) - + Medium (32 MB) - + High (64 MB) - + Very Low (32) - + Low (64) - + Normal (128) - + Medium (256) Średnie (256) - + High (512) Wysokie (512) - + ExtendedDynamicState 1 ExtendedDynamicState 1 - + ExtendedDynamicState 2 ExtendedDynamicState 2 - + ExtendedDynamicState 3 ExtendedDynamicState 3 - + Tree View - + Grid View diff --git a/dist/languages/pt_BR.ts b/dist/languages/pt_BR.ts index cdc3af2593..063a1bff4f 100644 --- a/dist/languages/pt_BR.ts +++ b/dist/languages/pt_BR.ts @@ -728,12 +728,32 @@ O modo agressivo pode impactar a performance de outros aplicativos, como softwar Ignora certas invalidações de cache durante atualizações de memória, reduzindo o uso da CPU e melhorando a latência. Isso pode causar travamentos leves. - + + GPU Readback Before NCE Invalidation + + + + + Flushes GPU buffer data back to guest memory before NCE invalidates the whole guest page, preserving it while the CPU store proceeds. + + + + + Patch Runtime NROs for NCE + + + + + Applies NCE code patches to runtime-loaded NRO modules.This is required for some games to run correctly. + + + + VSync Mode: Modo de Sincronização vertical: - + FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. FIFO Relaxed allows tearing as it recovers from a slow down. Mailbox can have lower latency than FIFO and does not tear but may drop frames. @@ -744,12 +764,12 @@ Mailbox pode ter menor latência que FIFO e não apresenta cortes, mas pode perd Immediate (sem sincronização) exibe o que estiver disponível e pode apresentar cortes. - + Sync Memory Operations Sincronizar operações de memória - + Ensures data consistency between compute and memory operations. This option fixes issues in games, but may degrade performance. Unreal Engine 4 games often see the most significant changes thereof. @@ -758,68 +778,68 @@ Esta opção corrige problemas em diversos jogos, mas pode reduzir o desempenho. Jogos baseados na Unreal Engine 4 costumam apresentar as mudanças mais significativas. - + Enable asynchronous presentation (Vulkan only) Ativar apresentação assíncrona (Somente Vulkan) - + Slightly improves performance by moving presentation to a separate CPU thread. Melhora ligeiramente o desempenho ao mover a apresentação para uma thread de CPU separada. - + Force maximum clocks (Vulkan only) Forçar clock máximo (somente Vulkan) - + Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed. Executa trabalho em segundo plano aguardando pelos comandos gráficos para evitar a GPU de reduzir seu clock. - + Anisotropic Filtering: Filtro Anisotrópico: - + Controls the quality of texture rendering at oblique angles. Safe to set at 16x on most GPUs. Controla a qualidade da renderização de texturas em ângulos oblíquos. Seguro definir em 16x na maioria das GPUs. - + GPU Mode: Modo da GPU: - + Controls the GPU emulation mode. Most games render fine with Fast, but Accurate is still required for some. Particles tend to only render correctly with Accurate mode. - + DMA Accuracy: Precisão do DMA: - + Controls the DMA read mode. Unsafe is faster, while Safe is more stable and can fix issues in some games. Default follows the GPU Accuracy setting. - + GPU Fence Behavior: - + Controls the GPU fence synchronization behavior. Immediate is the fastest option, but can introduce some issues. Balanced offers better compatibility and may fix issues in some games. @@ -828,44 +848,44 @@ Default follows the GPU Mode setting. - + Enable asynchronous shader compilation Ativar compilação assíncrona de shaders - + May reduce shader stutter. Pode reduzir travamentos de shaders. - + GPU Clocks - + Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch's clocks. - + GPU Unswizzle GPU Unswizzle - + Accelerates BCn 3D texture decoding using GPU compute. Disable if experiencing crashes or graphical glitches. Acelera a decodificação de texturas 3D BCn usando processamento da GPU. Desative se ocorrerem travamentos ou falhas gráficas. - + GPU Unswizzle Max Texture Size Tamanho Máximo de Textura para GPU Unswizzle - + Sets the maximum size (MiB) for GPU-based texture unswizzling. While the GPU is faster for medium and large textures, the CPU may be more efficient for very small ones. Adjust this to find the balance between GPU acceleration and CPU overhead. @@ -874,48 +894,48 @@ A GPU é mais rápida para texturas médias e grandes, mas a CPU pode ser mais e Ajuste para encontrar o equilíbrio entre aceleração da GPU e sobrecarga da CPU. - + GPU Unswizzle Stream Size Tamanho do Fluxo de GPU Unswizzle - + Sets the maximum amount of texture data (in MiB) processed per frame. Higher values can reduce stutter during texture loading but may impact frame consistency. Define a quantidade máxima de dados de textura (em MiB) processados por quadro. Valores mais altos podem reduzir travamentos durante o carregamento de texturas, mas podem afetar a consistência dos quadros. - + GPU Unswizzle Chunk Size Tamanho do Bloco de GPU Unswizzle - + Determines the number of depth slices processed in a single dispatch. Increasing this can improve throughput on high-end GPUs but may cause TDR or driver timeouts on weaker hardware. Determina o número de fatias de profundidade processadas em uma única execução. Aumentar esse valor pode melhorar o desempenho em GPUs avançadas, mas pode causar TDR ou tempo limite do driver em hardwares mais fracos. - + Use Vulkan pipeline cache Utilizar cache de pipeline do Vulkan - + Enables GPU vendor-specific pipeline cache. This option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally. Habilita o cache de pipeline da fabricante da GPU. Esta opção pode melhorar o tempo de carregamento de shaders significantemente em casos onde o driver Vulkan não armazena o cache de pipeline internamente. - + Enable Compute Pipelines (Intel Vulkan Only) Habilitar Pipeline de Computação (Somente Intel Vulkan) - + Required by some games. This setting only exists for Intel proprietary drivers and may crash if enabled. Compute pipelines are always enabled on all other drivers. @@ -924,194 +944,182 @@ Esta configuração existe apenas para drivers proprietários da Intel e pode ca Pipelines de computação estão sempre habilitados em outros drivers. - + Enable Reactive Flushing Habilitar Flushing Reativo - + Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing. Usa flushing reativo ao invés de flushing preditivo, permitindo mais precisão na sincronização da memória. - + Sync to framerate of video playback Sincronizar com o framerate da reprodução de vídeo - + Run the game at normal speed during video playback, even when the framerate is unlocked. Executa o jogo na velocidade normal durante a reprodução de vídeo, mesmo se o framerate estiver desbloqueado. - + Barrier feedback loops Ciclos de feedback de barreira - + Improves rendering of transparency effects in specific games. Melhora a renderização de efeitos de transparência em jogos específicos. - + Enable buffer history Ativar histórico de buffer - + Enables access to previous buffer states. This option may improve rendering quality and performance consistency in some games. Permite acesso a estados anteriores do buffer. Esta opção pode melhorar a qualidade de renderização e a consistência de desempenho em alguns jogos. - + Fix bloom effects Corrigir efeitos de bloom - + Removes bloom in Burnout. Remove o bloom no Burnout. - - Enable Legacy Rescale Pass - Ativar Passagem de Redimensionamento Legada - - - - May fix rescale issues in some games by relying on behavior from the previous implementation. -Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and grey texture flicker on Nvidia GPUs in Luigis Mansion 3. - Pode corrigir problemas de redimensionamento em alguns jogos, baseando-se no comportamento da implementação anterior. -Solução legada que corrige artefatos de linha em GPUs AMD e Intel, e cintilação de texturas cinzas em GPUs Nvidia no Luigi's Mansion 3. - - - + Extended Dynamic State Estado Dinâmico Estendido - + Controls the number of features that can be used in Extended Dynamic State. Higher states allow for more features and can increase performance, but may cause additional graphical issues. Controla o número de recursos que podem ser usados no Estado Dinâmico Estendido. Estados mais altos permitem mais recursos e podem aumentar o desempenho, mas também podem causar problemas gráficos adicionais. - + Vertex Input Dynamic State Estado Dinâmico de Entrada de Vértices - + Enables vertex input dynamic state feature for better quality and performance. Ativa o recurso de estado dinâmico de entrada de vértices para melhor qualidade e desempenho. - + Sample Shading Sombreamento por Amostragem - + Allows the fragment shader to execute per sample in a multi-sampled fragment instead of once per fragment. Improves graphics quality at the cost of performance. Higher values improve quality but degrade performance. Permite que o shader de fragmento seja processado por cada amostra em fragmentos multiamostrados, em vez de uma única vez por fragmento. Melhora a qualidade gráfica ao custo de desempenho. Valores mais altos aumentam a qualidade, mas reduzem a performance. - + RNG Seed Semente de RNG - + Controls the seed of the random number generator. Mainly used for speedrunning. Controla a semente do gerador de números aleatórios. Usado principalmente em speedruns. - + Device Name Nome do Dispositivo - + The name of the console. O nome do console. - + Homebrew Args - + Command-line arguments passed to homebrew at launch (e.g. -noglsl). - + Custom RTC Date: Data personalizada do RTC: - + This option allows to change the clock of the console. Can be used to manipulate time in games. Esta opção permite alterar o relógio do console. Pode ser usada para manipular o tempo nos jogos. - + The number of seconds from the current unix time Número de segundos a partir do tempo Unix atual - + Language: Idioma: - + This option can be overridden when region setting is auto-select Esta opção pode ser substituída quando a configuração de região estiver em seleção automática - + Region: Região: - + The region of the console. A região do console. - + Time Zone: Fuso Horário: - + The time zone of the console. O fuso horário do console. - + Sound Output Mode: Modo de saída de som - + Console Mode: Modo Console: - + Selects if the console is in Docked or Handheld mode. Games will change their resolution, details and supported controllers and depending on this setting. Setting to Handheld can help improve performance for low end systems. @@ -1120,1026 +1128,1026 @@ Os jogos ajustarão resolução, detalhes e controladores suportados conforme es Definir como Portátil pode ajudar a melhorar o desempenho em sistemas mais fracos. - + Prompt for user profile on boot Solicitar perfil de usuário na inicialização - + Useful if multiple people use the same PC. Útil se várias pessoas usam o mesmo PC. - + Pause when not in focus Pausar quando não estiver em foco - + Pauses emulation when focusing on other windows. Pausa a emulação ao focar em outras janelas. - + Confirm before stopping emulation Confirmar antes de parar a emulação - + Overrides prompts asking to confirm stopping the emulation. Enabling it bypasses such prompts and directly exits the emulation. Substitui as confirmações ao parar a emulação. Ao ativar, ignora esses avisos e encerra diretamente a emulação. - + Hide mouse on inactivity Esconder rato quando inactivo. - + Hides the mouse after 2.5s of inactivity. Oculta o mouse após 2,5s de inatividade. - + Check for updates Verificar atualizações - + Whether or not to check for updates upon startup. Define se deve verificar atualizações na inicialização. - + Enable Gamemode Habilitar Gamemode - + Force X11 as Graphics Backend Forçar X11 como backend gráfico - + Custom frontend Frontend customizado - + Real applet Applet real - - + + Disabled Desativado - + Never Nunca - + On Load Ao carregar - + Always Sempre - + CPU CPU - + GPU GPU - + CPU Asynchronous CPU Assíncrona - + Uncompressed (Best quality) Descompactado (Melhor Qualidade) - + BC1 (Low quality) BC1 (Baixa qualidade) - + BC3 (Medium quality) BC3 (Média qualidade) - - + + Auto Automático - + 30 FPS 30 FPS - + 60 FPS 60 FPS - + 90 FPS 90 FPS - + 120 FPS 120 FPS - + Conservative Conservador - + Aggressive Agressivo - + Vulkan Vulcano - + OpenGL GLSL OpenGL GLSL - + OpenGL GLASM (Assembly Shaders, NVIDIA Only) OpenGL GLASM (Shaders em Assembly, apenas NVIDIA) - + OpenGL SPIR-V (Experimental, AMD/Mesa Only) OpenGL SPIR-V (Experimental, apenas AMD/Mesa) - + Null Nenhum - + Fast Rápido - - - + + + Accurate Preciso - - - + + + Default Padrão - + Unsafe (fast) Inseguro (rápido) - + Safe (stable) Seguro (estável) - + Immediate - + Balanced Balanceado - + Unsafe Inseguro - + Paranoid (disables most optimizations) Paranoia (desativa a maioria das otimizações) - + Debugging Depuração - + Dynarmic Dynarmic - + NCE NCE - + Borderless Windowed Janela sem bordas - + Exclusive Fullscreen Tela cheia exclusiva - + No Video Output Sem saída de vídeo - + CPU Video Decoding Decodificação de vídeo pela CPU - + GPU Video Decoding (Default) Decodificação de vídeo pela GPU (Padrão) - + 0.25X (180p/270p) [EXPERIMENTAL] 0.25X (180p/270p) [EXPERIMENTAL] - + 0.5X (360p/540p) [EXPERIMENTAL] 0.5X (360p/540p) [EXPERIMENTAL] - + 0.75X (540p/810p) [EXPERIMENTAL] 0.75X (540p/810p) [EXPERIMENTAL] - + 1X (720p/1080p) 1X (720p/1080p) - + 1.25X (900p/1350p) [EXPERIMENTAL] 1.25X (900p/1350p) [EXPERIMENTAL] - + 1.5X (1080p/1620p) [EXPERIMENTAL] 1.5X (1080p/1620p) [EXPERIMENTAL] - + 2X (1440p/2160p) 2X (1440p/2160p) - + 3X (2160p/3240p) 3X (2160p/3240p) - + 4X (2880p/4320p) 4X (2880p/4320p) - + 5X (3600p/5400p) 5X (3600p/5400p) - + 6X (4320p/6480p) 6X (4320p/6480p) - + 7X (5040p/7560p) 7X (5040p/7560p) - + 8X (5760p/8640p) 8X (5760p/8640p) - + Nearest Neighbor Vizinho mais próximo - + Bilinear Bilinear - + Bicubic Bicúbico - + Gaussian Gaussiano - + Lanczos Lanczos - + ScaleForce ScaleForce - + AMD FidelityFX Super Resolution AMD FidelityFX Super Resolution - + Area Área - + MMPX MMPX - + Zero-Tangent Zero-Tangent - + B-Spline B-Spline - + Mitchell Mitchell - + Spline-1 Spline-1 - + Snapdragon Game Super Resolution - + Snapdragon Game Super Resolution EdgeDir - + None Nenhum - + FXAA FXAA - + SMAA SMAA - + Default (16:9) Padrão (16:9) - + Force 4:3 Forçar 4:3 - + Force 21:9 Forçar 21:9 - + Force 16:10 Forçar 16:10 - + Stretch to Window Esticar à Janela - + Automatic Automático - + 2x 2x - + 4x 4x - + 8x 8x - + 16x 16x - + Japanese (日本語) Japonês (日本語) - + American English Inglês Americano - + French (français) Francês (français) - + German (Deutsch) Alemão (Deutsch) - + Italian (italiano) Italiano (italiano) - + Spanish (español) Espanhol (español) - + Chinese Chinês - + Korean (한국어) Coreano (한국어) - + Dutch (Nederlands) Holandês (Nederlands) - + Portuguese (português) Português (português) - + Russian (Русский) Russo (Русский) - + Taiwanese Taiwanês - + British English Inglês Britânico - + Canadian French Francês Canadense - + Latin American Spanish Espanhol Latino-Americano - + Simplified Chinese Chinês Simplificado - + Traditional Chinese (正體中文) Chinês Tradicional (正 體 中文) - + Brazilian Portuguese (português do Brasil) Português do Brasil (Brazilian Portuguese) - + Polish (polska) Polonês (polska) - + Thai (แบบไทย) Tailandês (แบบไทย) - - + + Japan Japão - + USA EUA - + Europe Europa - + Australia Austrália - + China China - + Korea Coreia - + Taiwan Taiwan - + Auto (%1) Auto select time zone Auto (%1) - + Default (%1) Default time zone Padrão (%1) - + CET CET - + CST6CDT CST6CDT - + Cuba Cuba - + EET EET - + Egypt Egito - + Eire Irlanda - + EST EST - + EST5EDT EST5EDT - + GB GB - + GB-Eire GB-Irlanda - + GMT GMT - + GMT+0 GMT+0 - + GMT-0 GMT-0 - + GMT0 GMT0 - + Greenwich Greenwich - + Hongkong Hongkong - + HST HST - + Iceland Islândia - + Iran Irã - + Israel Israel - + Jamaica Jamaica - + Kwajalein Kwajalein - + Libya Líbia - + MET MET - + MST MST - + MST7MDT MST7MDT - + Navajo Navajo - + NZ NZ - + NZ-CHAT NZ-CHAT - + Poland Polônia - + Portugal Portugal - + PRC PRC - + PST8PDT PST8PDT - + ROC ROC - + ROK ROK - + Singapore Singapura - + Turkey Turquia - + UCT UCT - + Universal Universal - + UTC UTC - + W-SU W-SU - + WET WET - + Zulu Zulu - + Mono Mono - + Stereo Estéreo - + Surround Surround - + 4GB DRAM (Default) 4GB DRAM (Padrão) - + 6GB DRAM (Unsafe) 6GB DRAM (Não seguro) - + 8GB DRAM 8GB DRAM - + 10GB DRAM (Unsafe) 10GB DRAM (Inseguro) - + 12GB DRAM (Unsafe) 12GB DRAM (Inseguro) - + Docked Ancorado - + Handheld Portátil - - + + Normal - - + + Boost - - + + Overclock - + Always ask (Default) Sempre perguntar (Padrão) - + Only if game specifies not to stop Somente se o jogo especificar para não parar - + Never ask Nunca perguntar - + Very Small (16 MB) Muito Pequeno (16 MB) - + Small (32 MB) Pequeno (32 MB) - + Normal (128 MB) Normal (128 MB) - + Large (256 MB) Grande (256 MB) - + Very Large (512 MB) Muito Grande (512 MB) - + Very Low (4 MB) Muito Baixo (4 MB) - + Low (8 MB) Baixo (8 MB) - + Normal (16 MB) Normal (16 MB) - + Medium (32 MB) Médio (32 MB) - + High (64 MB) Alto (64 MB) - + Very Low (32) Muito Baixo (32) - + Low (64) Baixo (64) - + Normal (128) Normal (128) - + Medium (256) Médio (256) - + High (512) Alto (512) - + ExtendedDynamicState 1 Estado Dinâmico Estendido 1 - + ExtendedDynamicState 2 Estado Dinâmico Estendido 2 - + ExtendedDynamicState 3 Estado Dinâmico Estendido 3 - + Tree View Visualização em Árvore - + Grid View Visualização em Grade diff --git a/dist/languages/pt_PT.ts b/dist/languages/pt_PT.ts index 7084f01e62..eb9b0c12a4 100644 --- a/dist/languages/pt_PT.ts +++ b/dist/languages/pt_PT.ts @@ -703,12 +703,32 @@ Aggressive mode may impact performance of other applications such as recording s - + + GPU Readback Before NCE Invalidation + + + + + Flushes GPU buffer data back to guest memory before NCE invalidates the whole guest page, preserving it while the CPU store proceeds. + + + + + Patch Runtime NROs for NCE + + + + + Applies NCE code patches to runtime-loaded NRO modules.This is required for some games to run correctly. + + + + VSync Mode: Modo de Sincronização vertical: - + FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. FIFO Relaxed allows tearing as it recovers from a slow down. Mailbox can have lower latency than FIFO and does not tear but may drop frames. @@ -716,79 +736,79 @@ Immediate (no synchronization) presents whatever is available and can exhibit te - + Sync Memory Operations - + Ensures data consistency between compute and memory operations. This option fixes issues in games, but may degrade performance. Unreal Engine 4 games often see the most significant changes thereof. - + Enable asynchronous presentation (Vulkan only) Ativar apresentação assíncrona (Somente Vulkan) - + Slightly improves performance by moving presentation to a separate CPU thread. Melhora ligeiramente o desempenho ao mover a apresentação para uma thread de CPU separada. - + Force maximum clocks (Vulkan only) Forçar clock máximo (somente Vulkan) - + Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed. Executa trabalho em segundo plano aguardando pelos comandos gráficos para evitar a GPU de reduzir seu clock. - + Anisotropic Filtering: Filtro Anisotrópico: - + Controls the quality of texture rendering at oblique angles. Safe to set at 16x on most GPUs. - + GPU Mode: - + Controls the GPU emulation mode. Most games render fine with Fast, but Accurate is still required for some. Particles tend to only render correctly with Accurate mode. - + DMA Accuracy: - + Controls the DMA read mode. Unsafe is faster, while Safe is more stable and can fix issues in some games. Default follows the GPU Accuracy setting. - + GPU Fence Behavior: - + Controls the GPU fence synchronization behavior. Immediate is the fastest option, but can introduce some issues. Balanced offers better compatibility and may fix issues in some games. @@ -797,1302 +817,1291 @@ Default follows the GPU Mode setting. - + Enable asynchronous shader compilation - + May reduce shader stutter. - + GPU Clocks - + Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch's clocks. - + GPU Unswizzle - + Accelerates BCn 3D texture decoding using GPU compute. Disable if experiencing crashes or graphical glitches. - + GPU Unswizzle Max Texture Size - + Sets the maximum size (MiB) for GPU-based texture unswizzling. While the GPU is faster for medium and large textures, the CPU may be more efficient for very small ones. Adjust this to find the balance between GPU acceleration and CPU overhead. - + GPU Unswizzle Stream Size - + Sets the maximum amount of texture data (in MiB) processed per frame. Higher values can reduce stutter during texture loading but may impact frame consistency. - + GPU Unswizzle Chunk Size - + Determines the number of depth slices processed in a single dispatch. Increasing this can improve throughput on high-end GPUs but may cause TDR or driver timeouts on weaker hardware. - + Use Vulkan pipeline cache Utilizar cache de pipeline do Vulkan - + Enables GPU vendor-specific pipeline cache. This option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally. Habilita o cache de pipeline da fabricante da GPU. Esta opção pode melhorar o tempo de carregamento de shaders significantemente em casos onde o driver Vulkan não armazena o cache de pipeline internamente. - + Enable Compute Pipelines (Intel Vulkan Only) Habilitar Pipeline de Computação (Somente Intel Vulkan) - + Required by some games. This setting only exists for Intel proprietary drivers and may crash if enabled. Compute pipelines are always enabled on all other drivers. - + Enable Reactive Flushing Habilitar Flushing Reativo - + Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing. Usa flushing reativo ao invés de flushing preditivo, permitindo mais precisão na sincronização da memória. - + Sync to framerate of video playback Sincronizar com o framerate da reprodução de vídeo - + Run the game at normal speed during video playback, even when the framerate is unlocked. Executa o jogo na velocidade normal durante a reprodução de vídeo, mesmo se o framerate estiver desbloqueado. - + Barrier feedback loops Ciclos de feedback de barreira - + Improves rendering of transparency effects in specific games. Melhora a renderização de efeitos de transparência em jogos específicos. - + Enable buffer history - + Enables access to previous buffer states. This option may improve rendering quality and performance consistency in some games. - + Fix bloom effects - + Removes bloom in Burnout. - - Enable Legacy Rescale Pass - - - - - May fix rescale issues in some games by relying on behavior from the previous implementation. -Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and grey texture flicker on Nvidia GPUs in Luigis Mansion 3. - - - - + Extended Dynamic State - + Controls the number of features that can be used in Extended Dynamic State. Higher states allow for more features and can increase performance, but may cause additional graphical issues. - + Vertex Input Dynamic State - + Enables vertex input dynamic state feature for better quality and performance. - + Sample Shading - + Allows the fragment shader to execute per sample in a multi-sampled fragment instead of once per fragment. Improves graphics quality at the cost of performance. Higher values improve quality but degrade performance. - + RNG Seed Semente de RNG - + Controls the seed of the random number generator. Mainly used for speedrunning. - + Device Name Nome do Dispositivo - + The name of the console. - + Homebrew Args - + Command-line arguments passed to homebrew at launch (e.g. -noglsl). - + Custom RTC Date: Data personalizada do RTC: - + This option allows to change the clock of the console. Can be used to manipulate time in games. - + The number of seconds from the current unix time - + Language: Idioma: - + This option can be overridden when region setting is auto-select - + Region: Região: - + The region of the console. - + Time Zone: Fuso Horário: - + The time zone of the console. - + Sound Output Mode: Modo de saída de som - + Console Mode: Modo Console: - + Selects if the console is in Docked or Handheld mode. Games will change their resolution, details and supported controllers and depending on this setting. Setting to Handheld can help improve performance for low end systems. - + Prompt for user profile on boot - + Useful if multiple people use the same PC. - + Pause when not in focus - + Pauses emulation when focusing on other windows. - + Confirm before stopping emulation Confirmar antes de parar a emulação - + Overrides prompts asking to confirm stopping the emulation. Enabling it bypasses such prompts and directly exits the emulation. - + Hide mouse on inactivity Esconder rato quando inactivo. - + Hides the mouse after 2.5s of inactivity. - + Check for updates - + Whether or not to check for updates upon startup. - + Enable Gamemode Habilitar Gamemode - + Force X11 as Graphics Backend - + Custom frontend Frontend customizado - + Real applet Miniaplicativo real - - + + Disabled - + Never - + On Load - + Always - + CPU CPU - + GPU GPU - + CPU Asynchronous CPU Assíncrona - + Uncompressed (Best quality) Descompactado (Melhor Q - + BC1 (Low quality) BC1 (Baixa qualidade) - + BC3 (Medium quality) BC3 (Média qualidade) - - + + Auto Automático - + 30 FPS - + 60 FPS - + 90 FPS - + 120 FPS - + Conservative Conservador - + Aggressive Agressivo - + Vulkan Vulcano - + OpenGL GLSL - + OpenGL GLASM (Assembly Shaders, NVIDIA Only) - + OpenGL SPIR-V (Experimental, AMD/Mesa Only) - + Null Nenhum (desativado) - + Fast - - - + + + Accurate Preciso - - - + + + Default Padrão - + Unsafe (fast) - + Safe (stable) - + Immediate - + Balanced - + Unsafe Inseguro - + Paranoid (disables most optimizations) Paranoia (desativa a maioria das otimizações) - + Debugging - + Dynarmic Dynarmic - + NCE NCE - + Borderless Windowed Janela sem bordas - + Exclusive Fullscreen Tela cheia exclusiva - + No Video Output Sem saída de vídeo - + CPU Video Decoding Decodificação de vídeo pela CPU - + GPU Video Decoding (Default) Decodificação de vídeo pela GPU (Padrão) - + 0.25X (180p/270p) [EXPERIMENTAL] - + 0.5X (360p/540p) [EXPERIMENTAL] 0.5X (360p/540p) [EXPERIMENTAL] - + 0.75X (540p/810p) [EXPERIMENTAL] 0.75X (540p/810p) [EXPERIMENTAL] - + 1X (720p/1080p) 1X (720p/1080p) - + 1.25X (900p/1350p) [EXPERIMENTAL] - + 1.5X (1080p/1620p) [EXPERIMENTAL] 1.5X (1080p/1620p) [EXPERIMENTAL] - + 2X (1440p/2160p) 2X (1440p/2160p) - + 3X (2160p/3240p) 3X (2160p/3240p) - + 4X (2880p/4320p) 4X (2880p/4320p) - + 5X (3600p/5400p) 5X (3600p/5400p) - + 6X (4320p/6480p) 6X (4320p/6480p) - + 7X (5040p/7560p) 7X (5040p/7560p) - + 8X (5760p/8640p) 8X (5760p/8640p) - + Nearest Neighbor Vizinho mais próximo - + Bilinear Bilinear - + Bicubic Bicúbico - + Gaussian Gaussiano - + Lanczos - + ScaleForce ScaleForce - + AMD FidelityFX Super Resolution - + Area - + MMPX - + Zero-Tangent - + B-Spline - + Mitchell - + Spline-1 - + Snapdragon Game Super Resolution - + Snapdragon Game Super Resolution EdgeDir - + None Nenhum - + FXAA FXAA - + SMAA SMAA - + Default (16:9) Padrão (16:9) - + Force 4:3 Forçar 4:3 - + Force 21:9 Forçar 21:9 - + Force 16:10 Forçar 16:10 - + Stretch to Window Esticar à Janela - + Automatic Automático - + 2x 2x - + 4x 4x - + 8x 8x - + 16x 16x - + Japanese (日本語) Japonês (日本語) - + American English Inglês Americano - + French (français) Francês (français) - + German (Deutsch) Alemão (Deutsch) - + Italian (italiano) Italiano (italiano) - + Spanish (español) Espanhol (español) - + Chinese Chinês - + Korean (한국어) Coreano (한국어) - + Dutch (Nederlands) Holandês (Nederlands) - + Portuguese (português) Português (português) - + Russian (Русский) Russo (Русский) - + Taiwanese Taiwanês - + British English Inglês Britânico - + Canadian French Francês Canadense - + Latin American Spanish Espanhol Latino-Americano - + Simplified Chinese Chinês Simplificado - + Traditional Chinese (正體中文) Chinês Tradicional (正 體 中文) - + Brazilian Portuguese (português do Brasil) Português do Brasil (Brazilian Portuguese) - + Polish (polska) - + Thai (แบบไทย) - - + + Japan Japão - + USA EUA - + Europe Europa - + Australia Austrália - + China China - + Korea Coreia - + Taiwan Taiwan - + Auto (%1) Auto select time zone Auto (%1) - + Default (%1) Default time zone Padrão (%1) - + CET CET - + CST6CDT CST6CDT - + Cuba Cuba - + EET EET - + Egypt Egipto - + Eire Irlanda - + EST EST - + EST5EDT EST5EDT - + GB GB - + GB-Eire GB-Irlanda - + GMT GMT - + GMT+0 GMT+0 - + GMT-0 GMT-0 - + GMT0 GMT0 - + Greenwich Greenwich - + Hongkong Hongkong - + HST HST - + Iceland Islândia - + Iran Irão - + Israel Israel - + Jamaica Jamaica - + Kwajalein Kwajalein - + Libya Líbia - + MET MET - + MST MST - + MST7MDT MST7MDT - + Navajo Navajo - + NZ NZ - + NZ-CHAT NZ-CHAT - + Poland Polónia - + Portugal Portugal - + PRC PRC - + PST8PDT PST8PDT - + ROC ROC - + ROK ROK - + Singapore Singapura - + Turkey Turquia - + UCT UCT - + Universal Universal - + UTC UTC - + W-SU W-SU - + WET WET - + Zulu Zulu - + Mono Mono - + Stereo Estéreo - + Surround Surround - + 4GB DRAM (Default) 4GB DRAM (Padrão) - + 6GB DRAM (Unsafe) 6GB DRAM (Não seguro) - + 8GB DRAM - + 10GB DRAM (Unsafe) - + 12GB DRAM (Unsafe) - + Docked Ancorado - + Handheld Portátil - - + + Normal - - + + Boost - - + + Overclock - + Always ask (Default) Sempre perguntar (Padrão) - + Only if game specifies not to stop Somente se o jogo especificar para não parar - + Never ask Nunca perguntar - + Very Small (16 MB) - + Small (32 MB) - + Normal (128 MB) - + Large (256 MB) - + Very Large (512 MB) - + Very Low (4 MB) - + Low (8 MB) - + Normal (16 MB) - + Medium (32 MB) - + High (64 MB) - + Very Low (32) - + Low (64) - + Normal (128) - + Medium (256) - + High (512) - + ExtendedDynamicState 1 - + ExtendedDynamicState 2 - + ExtendedDynamicState 3 - + Tree View - + Grid View diff --git a/dist/languages/ru_RU.ts b/dist/languages/ru_RU.ts index 248209833e..bb44335970 100644 --- a/dist/languages/ru_RU.ts +++ b/dist/languages/ru_RU.ts @@ -729,12 +729,32 @@ Aggressive mode may impact performance of other applications such as recording s Пропускает некоторые операции сброса кэша при обновлении памяти, снижая нагрузку на ЦП и уменьшая задержку. Может вызывать сбои в работе игр. - + + GPU Readback Before NCE Invalidation + + + + + Flushes GPU buffer data back to guest memory before NCE invalidates the whole guest page, preserving it while the CPU store proceeds. + + + + + Patch Runtime NROs for NCE + + + + + Applies NCE code patches to runtime-loaded NRO modules.This is required for some games to run correctly. + + + + VSync Mode: Режим VSync: - + FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. FIFO Relaxed allows tearing as it recovers from a slow down. Mailbox can have lower latency than FIFO and does not tear but may drop frames. @@ -745,12 +765,12 @@ Mailbox может обеспечивать меньшую задержку, ч Immediate (без синхронизации) выводит все доступные кадры и может иметь разрывы. - + Sync Memory Operations Синхронизация операций памяти - + Ensures data consistency between compute and memory operations. This option fixes issues in games, but may degrade performance. Unreal Engine 4 games often see the most significant changes thereof. @@ -759,56 +779,56 @@ Unreal Engine 4 games often see the most significant changes thereof. Игры на Unreal Engine 4 чаще всего демонстрируют заметные изменения. - + Enable asynchronous presentation (Vulkan only) Включить асинхронный вывод (только Vulkan) - + Slightly improves performance by moving presentation to a separate CPU thread. Немного повышает производительность, перенося вывод кадра в отдельный поток CPU. - + Force maximum clocks (Vulkan only) Принудительно зафиксировать максимальную тактовую частоту (только для Vulkan) - + Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed. Выполняет фоновые операции во время ожидания графических команд, предотвращая снижение тактовой частоты GPU. - + Anisotropic Filtering: Анизотропная фильтрация: - + Controls the quality of texture rendering at oblique angles. Safe to set at 16x on most GPUs. Управляет качеством отображения текстур под наклонными углами. На большинстве GPU безопасно использовать значение 16x. - + GPU Mode: Режим GPU: - + Controls the GPU emulation mode. Most games render fine with Fast, but Accurate is still required for some. Particles tend to only render correctly with Accurate mode. Управляет режимом эмуляции ГПУ. Большинство игр нормально отображаются в режиме Быстрый, но для некоторых требуется режим Точный. Частицы обычно корректно отображаются только в режиме Точный. - + DMA Accuracy: Точность DMA: - + Controls the DMA read mode. Unsafe is faster, while Safe is more stable and can fix issues in some games. Default follows the GPU Accuracy setting. @@ -817,12 +837,12 @@ Default follows the GPU Accuracy setting. По умолчанию соответствует настройке точности ГПУ. - + GPU Fence Behavior: Поведение барьеров ГПУ: - + Controls the GPU fence synchronization behavior. Immediate is the fastest option, but can introduce some issues. Balanced offers better compatibility and may fix issues in some games. @@ -831,44 +851,44 @@ Default follows the GPU Mode setting. - + Enable asynchronous shader compilation Включить асинхронную компиляцию шейдеров - + May reduce shader stutter. Может уменьшить фризы, вызванные компиляцией шейдеров. - + GPU Clocks Частоты GPU - + Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch's clocks. Заставляет игру думать, что GPU завершает свою работу быстрее, чем на самом деле, чтобы она перестала подстраиваться под частоты Switch, понижать разрешение и дальность прорисовки. - + GPU Unswizzle GPU-десвиззлинг (GPU Unswizzle) - + Accelerates BCn 3D texture decoding using GPU compute. Disable if experiencing crashes or graphical glitches. Ускоряет декодирование 3D-текстур BCn с использованием вычислений GPU. Отключите при возникновении сбоев или графических артефактов. - + GPU Unswizzle Max Texture Size Максимальный размер текстур для GPU-десвиззлинга - + Sets the maximum size (MiB) for GPU-based texture unswizzling. While the GPU is faster for medium and large textures, the CPU may be more efficient for very small ones. Adjust this to find the balance between GPU acceleration and CPU overhead. @@ -877,48 +897,48 @@ Adjust this to find the balance between GPU acceleration and CPU overhead. - + GPU Unswizzle Stream Size Размер потока GPU-десвиззлинга - + Sets the maximum amount of texture data (in MiB) processed per frame. Higher values can reduce stutter during texture loading but may impact frame consistency. Задает максимальный объем данных текстур (в МиБ), обрабатываемый за кадр. Более высокие значения могут уменьшить подергивания при загрузке текстур, но это может повлиять на стабильность кадров. - + GPU Unswizzle Chunk Size Размер блока GPU-десвиззлинга - + Determines the number of depth slices processed in a single dispatch. Increasing this can improve throughput on high-end GPUs but may cause TDR or driver timeouts on weaker hardware. Определяет количество слоев глубины, обрабатываемых за один вызов. Увеличение этого значения может повысить пропускную способность на производительных GPU, но на слабом оборудовании способно вызвать TDR или тайм-ауты драйвера. - + Use Vulkan pipeline cache Использовать кэш конвейеров Vulkan - + Enables GPU vendor-specific pipeline cache. This option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally. Включает кэш конвейеров, зависящий от производителя GPU. Эта опция может значительно ускорить загрузку шейдеров в тех случаях, когда драйвер Vulkan не сохраняет такие файлы кэша внутри себя. - + Enable Compute Pipelines (Intel Vulkan Only) Включить вычислительные конвейеры (только для Intel Vulkan) - + Required by some games. This setting only exists for Intel proprietary drivers and may crash if enabled. Compute pipelines are always enabled on all other drivers. @@ -927,194 +947,182 @@ Compute pipelines are always enabled on all other drivers. На остальных драйверах вычислительные конвейеры всегда включены. - + Enable Reactive Flushing Включить реактивный сброс - + Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing. Использует реактивный сброс (Reactive Flushing) вместо прогнозирующего, обеспечивая более точную синхронизацию памяти. - + Sync to framerate of video playback Синхронизировать с частотой кадров видео - + Run the game at normal speed during video playback, even when the framerate is unlocked. Поддерживать нормальную скорость игры во время воспроизведения видео, даже если частота кадров разблокирована. - + Barrier feedback loops Циклы обратной связи барьеров - + Improves rendering of transparency effects in specific games. Улучшает отрисовку эффектов прозрачности в некоторых играх. - + Enable buffer history Включить историю буфера - + Enables access to previous buffer states. This option may improve rendering quality and performance consistency in some games. Предоставляет доступ к предыдущим состояниям буфера. В некоторых играх может повысить качество рендеринга и стабильность производительности. - + Fix bloom effects Исправить эффекты bloom - + Removes bloom in Burnout. Удаляет эффект bloom в игре Burnout. - - Enable Legacy Rescale Pass - Включить устаревший режим масштабирования - - - - May fix rescale issues in some games by relying on behavior from the previous implementation. -Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and grey texture flicker on Nvidia GPUs in Luigis Mansion 3. - Может исправить проблемы масштабирования в некоторых играх, используя поведение предыдущей реализации. -Это обходное решение устраняет артефакты линий на GPU AMD и Intel, а также мерцание серых текстур на GPU Nvidia в Luigis Mansion 3. - - - + Extended Dynamic State Расширенное динамическое состояние (Extended Dynamic State) - + Controls the number of features that can be used in Extended Dynamic State. Higher states allow for more features and can increase performance, but may cause additional graphical issues. Определяет количество функций, доступных в Extended Dynamic State. Более высокие значения позволяют использовать больше функций и иногда повышают производительность, но могут вызвать дополнительные графические проблемы. - + Vertex Input Dynamic State Динамическое состояние ввода вершин (Vertex Input Dynamic State) - + Enables vertex input dynamic state feature for better quality and performance. Включает функцию динамического состояния ввода вершин для улучшения качества и производительности. - + Sample Shading Множественное затенение (Sample Shading) - + Allows the fragment shader to execute per sample in a multi-sampled fragment instead of once per fragment. Improves graphics quality at the cost of performance. Higher values improve quality but degrade performance. Позволяет фрагментному шейдеру выполняться для каждого сэмпла в мультисемплированном фрагменте вместо одного раза. Повышает качество графики за счет снижения производительности. Более высокие значения повышают качество, но сильнее снижают производительность. - + RNG Seed Сид RNG - + Controls the seed of the random number generator. Mainly used for speedrunning. Задает начальное значение генератора случайных чисел. В основном используется для спидранов. - + Device Name Название устройства - + The name of the console. Имя консоли. - + Homebrew Args Аргументы Homebrew - + Command-line arguments passed to homebrew at launch (e.g. -noglsl). Аргументы командной строки при запуске homebrew (например, -noglsl). - + Custom RTC Date: Пользовательская RTC-дата: - + This option allows to change the clock of the console. Can be used to manipulate time in games. Позволяет изменить системные часы консоли. Может использоваться для изменения времени в играх. - + The number of seconds from the current unix time Количество секунд от текущего UNIX-времени. - + Language: Язык: - + This option can be overridden when region setting is auto-select Эта настройка может быть переопределена при автоматическом выборе региона. - + Region: Регион: - + The region of the console. Регион консоли. - + Time Zone: Часовой пояс: - + The time zone of the console. Часовой пояс консоли. - + Sound Output Mode: Режим вывода звука: - + Console Mode: Консольный режим: - + Selects if the console is in Docked or Handheld mode. Games will change their resolution, details and supported controllers and depending on this setting. Setting to Handheld can help improve performance for low end systems. @@ -1123,1026 +1131,1026 @@ Setting to Handheld can help improve performance for low end systems. Установка в портативный режим может повысить производительность на слабых системах. - + Prompt for user profile on boot Запрашивать профиль пользователя при запуске игры - + Useful if multiple people use the same PC. Полезно, если одним ПК пользуются несколько человек. - + Pause when not in focus Приостанавливать, если окно не активно - + Pauses emulation when focusing on other windows. Приостанавливает эмуляцию при переключении на другие окна. - + Confirm before stopping emulation Запрашивать подтверждение перед остановкой эмуляции - + Overrides prompts asking to confirm stopping the emulation. Enabling it bypasses such prompts and directly exits the emulation. Убирает запросы на подтверждение остановки эмуляции. При включении этой настройки эмуляция завершается сразу, без подтверждения. - + Hide mouse on inactivity Скрывать курсор при бездействии - + Hides the mouse after 2.5s of inactivity. Скрывает курсор мыши после 2,5 секунд бездействия. - + Check for updates Проверять обновления - + Whether or not to check for updates upon startup. Проверять обновления при запуске. - + Enable Gamemode Включить режим игры - + Force X11 as Graphics Backend Принудительно использовать X11 как графический бэкенд - + Custom frontend Собственный интерфейс эмулятора - + Real applet Приложение из прошивки - - + + Disabled Отключено - + Never Никогда - + On Load При загрузке - + Always Всегда - + CPU CPU - + GPU GPU - + CPU Asynchronous Асинхронный CPU - + Uncompressed (Best quality) Без сжатия (наилучшее качество) - + BC1 (Low quality) BC1 (низкое качество) - + BC3 (Medium quality) BC3 (среднее качество) - - + + Auto Авто - + 30 FPS 30 FPS - + 60 FPS 60 FPS - + 90 FPS 90 FPS - + 120 FPS 120 FPS - + Conservative Консервативный - + Aggressive Агрессивный - + Vulkan Vulkan - + OpenGL GLSL OpenGL GLSL - + OpenGL GLASM (Assembly Shaders, NVIDIA Only) OpenGL GLASM (ассемблерные шейдеры, только для NVIDIA) - + OpenGL SPIR-V (Experimental, AMD/Mesa Only) OpenGL SPIR-V (экспериментальный, только для AMD/Mesa) - + Null Null - + Fast Производительность - - - + + + Accurate Точность - - - + + + Default По умолчанию - + Unsafe (fast) Небезопасно (быстро) - + Safe (stable) Безопасно (стабильно) - + Immediate Мгновенный - + Balanced Баланс - + Unsafe Небезопасно - + Paranoid (disables most optimizations) Параноик (отключает большинство оптимизаций) - + Debugging Отладка - + Dynarmic Dynarmic - + NCE NCE - + Borderless Windowed Безрамочный режим - + Exclusive Fullscreen Эксклюзивный полноэкранный - + No Video Output Отсутствие видеовыхода - + CPU Video Decoding Декодирование видео на CPU - + GPU Video Decoding (Default) Декодирование видео на GPU (По умолчанию) - + 0.25X (180p/270p) [EXPERIMENTAL] 0.25X (180p/270p) [Экспериментально] - + 0.5X (360p/540p) [EXPERIMENTAL] 0.5X (360p/540p) [Экспериментально] - + 0.75X (540p/810p) [EXPERIMENTAL] 0.75X (540p/810p) [Экспериментально] - + 1X (720p/1080p) 1X (720p/1080p) - + 1.25X (900p/1350p) [EXPERIMENTAL] 1.25X (900p/1350p) [ЭКПЕРИМЕНТАЛЬНО] - + 1.5X (1080p/1620p) [EXPERIMENTAL] 1.5X (1080p/1620p) [Экспериментально] - + 2X (1440p/2160p) 2X (1440p/2160p) - + 3X (2160p/3240p) 3X (2160p/3240p) - + 4X (2880p/4320p) 4X (2880p/4320p) - + 5X (3600p/5400p) 5X (3600p/5400p) - + 6X (4320p/6480p) 6X (4320p/6480p) - + 7X (5040p/7560p) 7X (5040p/7560p) - + 8X (5760p/8640p) 8X (5760p/8640p) - + Nearest Neighbor Ближайший сосед (Nearest Neighbor) - + Bilinear Билинейный - + Bicubic Бикубический - + Gaussian По Гауссу - + Lanczos Lanczos - + ScaleForce ScaleForce - + AMD FidelityFX Super Resolution AMD FidelityFX™️ Super Resolution - + Area Область (Area) - + MMPX MMPX - + Zero-Tangent Zero-Tangent - + B-Spline B-Spline - + Mitchell Mitchell - + Spline-1 Spline-1 - + Snapdragon Game Super Resolution Snapdragon Game Super Resolution - + Snapdragon Game Super Resolution EdgeDir Snapdragon Game Super Resolution EdgeDir - + None Никакой - + FXAA FXAA - + SMAA SMAA - + Default (16:9) Стандартное (16:9) - + Force 4:3 Принудительно 4:3 - + Force 21:9 Принудительно 21:9 - + Force 16:10 Принудительно 16:10 - + Stretch to Window Растянуть до окна - + Automatic Автоматически - + 2x 2x - + 4x 4x - + 8x 8x - + 16x 16x - + Japanese (日本語) Японский (日本語) - + American English Американский английский - + French (français) Французский (français) - + German (Deutsch) Немецкий (Deutsch) - + Italian (italiano) Итальянский (italiano) - + Spanish (español) Испанский (español) - + Chinese Китайский - + Korean (한국어) Корейский (한국어) - + Dutch (Nederlands) Голландский (Nederlands) - + Portuguese (português) Португальский (português) - + Russian (Русский) Русский - + Taiwanese Тайваньский - + British English Британский английский - + Canadian French Канадский французский - + Latin American Spanish Латиноамериканский испанский - + Simplified Chinese Упрощённый китайский - + Traditional Chinese (正體中文) Традиционный китайский (正體中文) - + Brazilian Portuguese (português do Brasil) Бразильский португальский (português do Brasil) - + Polish (polska) Польский (polska) - + Thai (แบบไทย) Тайский (แบบไทย) - - + + Japan Япония - + USA США - + Europe Европа - + Australia Австралия - + China Китай - + Korea Корея - + Taiwan Тайвань - + Auto (%1) Auto select time zone Авто (%1) - + Default (%1) Default time zone По умолчанию (%1) - + CET CET - + CST6CDT CST6CDT - + Cuba Куба - + EET EET - + Egypt Египет - + Eire Эйре - + EST EST - + EST5EDT EST5EDT - + GB GB - + GB-Eire GB-Эйре - + GMT GMT - + GMT+0 GMT+0 - + GMT-0 GMT-0 - + GMT0 GMT0 - + Greenwich Гринвич - + Hongkong Гонконг - + HST HST - + Iceland Исландия - + Iran Иран - + Israel Израиль - + Jamaica Ямайка - + Kwajalein Кваджалейн - + Libya Ливия - + MET MET - + MST MST - + MST7MDT MST7MDT - + Navajo Навахо - + NZ NZ - + NZ-CHAT NZ-CHAT - + Poland Польша - + Portugal Португалия - + PRC PRC - + PST8PDT PST8PDT - + ROC ROC - + ROK ROK - + Singapore Сингапур - + Turkey Турция - + UCT UCT - + Universal Универсальный - + UTC UTC - + W-SU W-SU - + WET WET - + Zulu Зулу - + Mono Моно - + Stereo Стерео - + Surround Объемный звук - + 4GB DRAM (Default) 4 ГБ ОЗУ (По умолчанию) - + 6GB DRAM (Unsafe) 6 ГБ ОЗУ (Небезопасно) - + 8GB DRAM 8 ГБ ОЗУ - + 10GB DRAM (Unsafe) 10 ГБ ОЗУ (Небезопасно) - + 12GB DRAM (Unsafe) 12 ГБ ОЗУ (Небезопасно) - + Docked В док-станции - + Handheld Портативный - - + + Normal Нормальная - - + + Boost Ускоренная - - + + Overclock Разгон - + Always ask (Default) Всегда спрашивать (По умолчанию) - + Only if game specifies not to stop Только если игра указывает не останавливать - + Never ask Никогда не спрашивать - + Very Small (16 MB) Очень маленький (16 МБ) - + Small (32 MB) Маленький (32 МБ) - + Normal (128 MB) Нормальный (128 МБ) - + Large (256 MB) Большой (256 МБ) - + Very Large (512 MB) Очень большой (512 МБ) - + Very Low (4 MB) Очень низкий (4 МБ) - + Low (8 MB) Низкий (8 МБ) - + Normal (16 MB) Нормальный (16 МБ) - + Medium (32 MB) Средний (32 МБ) - + High (64 MB) Высокий (64 МБ) - + Very Low (32) Очень низкий (32) - + Low (64) Низкий (64) - + Normal (128) Нормальный (128) - + Medium (256) Средний (256) - + High (512) Высокий (512) - + ExtendedDynamicState 1 ExtendedDynamicState 1 - + ExtendedDynamicState 2 ExtendedDynamicState 2 - + ExtendedDynamicState 3 ExtendedDynamicState 3 - + Tree View Древовидный - + Grid View Сетчатый diff --git a/dist/languages/sv.ts b/dist/languages/sv.ts index 8662c56414..818a84cbe1 100644 --- a/dist/languages/sv.ts +++ b/dist/languages/sv.ts @@ -51,7 +51,7 @@ li.checked::marker { content: "\2612"; } Communicating with the server... - Kommunicerar med servern... + Kommunicerar med servern… @@ -192,7 +192,7 @@ Detta skulle stänga av både deras forumanvändarnamn och deras IP-adress. Moderation... - Moderering... + Moderering… @@ -375,7 +375,7 @@ Påverkar inte prestanda/stabilitet men kan göra det möjligt att läsa in HD-t 200% for a 30 FPS game is 60 FPS, and for a 60 FPS game it will be 120 FPS. Disabling it means unlocking the framerate to the maximum your PC can reach. Kontrollerar spelets maximala renderingshastighet, men det är upp till varje spel om det körs snabbare eller inte. -200% för ett spel med 30 bilder/s är 60 bilder/s, och för ett spel med 60 bilder/s blir det 120 bilder/s. +200 % för ett spel med 30 bilder/s är 60 bilder/s och för ett spel med 60 bilder/s blir det 120 bilder/s. Att inaktivera det innebär att du låser upp bildfrekvensen till det maximala som din dator kan nå. @@ -436,7 +436,7 @@ Kan bidra till att minska hackande vid lägre bildfrekvenser. Raises the clock the emulated CPU reports, which removes some FPS limiters. Weaker CPUs may see reduced performance, and certain games may behave improperly. Höjer den klockfrekvens som den emulerade processorn rapporterar, vilket tar bort vissa FPS-begränsare. -Svagare processorer kan få sämre prestanda, och vissa spel kan fungera felaktigt. +Svagare processorer kan få sämre prestanda och vissa spel kan fungera felaktigt. @@ -446,7 +446,7 @@ Svagare processorer kan få sämre prestanda, och vissa spel kan fungera felakti Set a custom value of CPU ticks. Higher values can increase performance, but may cause deadlocks. A range of 77-21000 is recommended. - Ange ett anpassat värde för CPU-ticks. Högre värden kan öka prestandan, men kan orsaka deadlocks. Ett intervall på 77-21000 rekommenderas. + Ange ett anpassat värde för CPU-ticks. Högre värden kan öka prestandan, men kan orsaka deadlocks. Ett intervall på 77 till 21000 rekommenderas. @@ -734,12 +734,32 @@ Aggressivt läge kan påverka prestandan hos andra program, till exempel inspeln Hoppar över vissa cache-ogiltigförklaringar under minnesuppdateringar, vilket minskar CPU-användningen och förbättrar latensen. Detta kan orsaka mjuka krascher. - + + GPU Readback Before NCE Invalidation + GPU-återläsning före NCE-ogiltigförklaring + + + + Flushes GPU buffer data back to guest memory before NCE invalidates the whole guest page, preserving it while the CPU store proceeds. + Skriver tillbaka GPU-buffertdata till gästens minne innan NCE ogiltigförklarar hela gästsidan, så att data bevaras medan CPU-lagringen fortsätter. + + + + Patch Runtime NROs for NCE + Korrigera NRO:er under körning för NCE + + + + Applies NCE code patches to runtime-loaded NRO modules.This is required for some games to run correctly. + Tillämpar NCE-korrigeringar på NRO-moduler som läses in under körning. Det krävs för att vissa spel ska fungera korrekt. + + + VSync Mode: VSync-läge: - + FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. FIFO Relaxed allows tearing as it recovers from a slow down. Mailbox can have lower latency than FIFO and does not tear but may drop frames. @@ -750,12 +770,12 @@ Mailbox kan ha lägre latens än FIFO och uppvisar inte tearing, men kan tappa b Immediate (ingen synkronisering) visar allt som är tillgängligt och kan uppvisa tearing. - + Sync Memory Operations Synkronisera minnesoperationer - + Ensures data consistency between compute and memory operations. This option fixes issues in games, but may degrade performance. Unreal Engine 4 games often see the most significant changes thereof. @@ -764,44 +784,44 @@ Det här alternativet åtgärdar problem i spel, men kan försämra prestandan. Unreal Engine 4-spel upplever ofta de mest betydande förändringarna av detta. - + Enable asynchronous presentation (Vulkan only) Aktivera asynkron presentation (endast Vulkan) - + Slightly improves performance by moving presentation to a separate CPU thread. Förbättrar prestandan något genom att flytta presentationen till en separat CPU-tråd. - + Force maximum clocks (Vulkan only) Tvinga fram maximal klockfrekvens (endast Vulkan) - + Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed. Körs i bakgrunden i väntan på grafikkommandon för att förhindra att GPU:n sänker sin klockhastighet. - + Anisotropic Filtering: Anisotropisk filtrering: - + Controls the quality of texture rendering at oblique angles. Safe to set at 16x on most GPUs. Kontrollerar kvaliteten på texturrendering vid sneda vinklar. -Säker att ställa in på 16x på de flesta GPU:er. +Det går att ställa in 16× på de flesta GPU:er. - + GPU Mode: GPU-läge: - + Controls the GPU emulation mode. Most games render fine with Fast, but Accurate is still required for some. Particles tend to only render correctly with Accurate mode. @@ -810,12 +830,12 @@ De flesta spel återges bra med Snabb, men Exakt krävs fortfarande för vissa. Partiklar återges ofta korrekt endast i läget Exakt. - + DMA Accuracy: DMA-noggrannhet: - + Controls the DMA read mode. Unsafe is faster, while Safe is more stable and can fix issues in some games. Default follows the GPU Accuracy setting. @@ -824,12 +844,12 @@ Osäker är snabbare, medan Säker är stabilare och kan lösa problem i vissa s Standard följer inställningen för GPU-noggrannhet. - + GPU Fence Behavior: Beteende för GPU-staket: - + Controls the GPU fence synchronization behavior. Immediate is the fastest option, but can introduce some issues. Balanced offers better compatibility and may fix issues in some games. @@ -842,44 +862,44 @@ Exakt förbättrar kompatibiliteten ytterligare, men på bekostnad av viss prest Standard följer inställningen för GPU-läge. - + Enable asynchronous shader compilation Aktivera asynkron shaderkompilering - + May reduce shader stutter. Kan minska shader-hackighet. - + GPU Clocks GPU-klockfrekvenser - + Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch's clocks. Får spelet att tro att GPU-arbetet avslutas snabbare än det gör, så att det slutar sänka upplösning och ritaravstånd för att passa Switch-klockfrekvenserna. - + GPU Unswizzle GPU Unswizzle - + Accelerates BCn 3D texture decoding using GPU compute. Disable if experiencing crashes or graphical glitches. Accelererar avkodning av BCn 3D-texturer med hjälp av GPU-beräkningar. Inaktivera om du upplever krascher eller grafiska fel. - + GPU Unswizzle Max Texture Size Maximal texturstorlek för GPU Unswizzle - + Sets the maximum size (MiB) for GPU-based texture unswizzling. While the GPU is faster for medium and large textures, the CPU may be more efficient for very small ones. Adjust this to find the balance between GPU acceleration and CPU overhead. @@ -888,48 +908,48 @@ GPU är snabbare för medelstora och stora texturer, men CPU kan vara effektivar Justera detta för att hitta balansen mellan GPU-acceleration och CPU-överbelastning. - + GPU Unswizzle Stream Size Strömstorlek för GPU Unswizzle - + Sets the maximum amount of texture data (in MiB) processed per frame. Higher values can reduce stutter during texture loading but may impact frame consistency. Ställer in den maximala mängden texturdata (i MiB) som bearbetas per bildruta. Högre värden kan minska hackighet under texturinläsning men kan påverka bildrutans konsistens. - + GPU Unswizzle Chunk Size Chunk-storlek för GPU Unswizzle - + Determines the number of depth slices processed in a single dispatch. Increasing this can improve throughput on high-end GPUs but may cause TDR or driver timeouts on weaker hardware. Bestämmer antalet djupskivor som bearbetas i en enda sändning. Att öka detta kan förbättra genomströmningen på avancerade GPU:er, men kan orsaka TDR eller drivrutinstidsgränser på svagare hårdvara. - + Use Vulkan pipeline cache Använda Vulkan pipeline-cache - + Enables GPU vendor-specific pipeline cache. This option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally. Aktiverar GPU-leverantörsspecifik pipeline-cache. Det här alternativet kan förbättra laddningstiden för shaders avsevärt i fall där Vulkan-drivrutinen inte lagrar pipeline-cache-filer internt. - + Enable Compute Pipelines (Intel Vulkan Only) Aktivera compute pipelines (endast Intel Vulkan) - + Required by some games. This setting only exists for Intel proprietary drivers and may crash if enabled. Compute pipelines are always enabled on all other drivers. @@ -938,194 +958,182 @@ Denna inställning finns endast för Intels egna drivrutiner och kan orsaka kras Beräkningspipelines är alltid aktiverade på alla andra drivrutiner. - + Enable Reactive Flushing Aktivera Reactive Flushing - + Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing. Använder reaktiv rensning i stället för prediktiv rensning, vilket ger mer exakt minnessynkning. - + Sync to framerate of video playback Synkronisera med bildfrekvensen för videouppspelning - + Run the game at normal speed during video playback, even when the framerate is unlocked. Kör spelet i normal hastighet under videouppspelning, även när bildfrekvensen är upplåst. - + Barrier feedback loops Återkopplingsloopar för barriärer - + Improves rendering of transparency effects in specific games. Förbättrar renderingen av transparenseffekter i vissa spel. - + Enable buffer history Aktivera bufferthistorik - + Enables access to previous buffer states. This option may improve rendering quality and performance consistency in some games. Aktiverar åtkomst till tidigare bufferttillstånd. Det här alternativet kan förbättra renderingskvaliteten och prestandakonsistensen i vissa spel. - + Fix bloom effects Korrigera bloom-effekter - + Removes bloom in Burnout. Tar bort bloom i Burnout. - - Enable Legacy Rescale Pass - Aktivera äldre omskalningspass - - - - May fix rescale issues in some games by relying on behavior from the previous implementation. -Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and grey texture flicker on Nvidia GPUs in Luigis Mansion 3. - Kan åtgärda skalningsproblem i vissa spel genom att förlita sig på beteendet från den tidigare implementeringen. -Äldre beteende som åtgärdar linjeartefakter på AMD- och Intel-GPU:er och grå texturflimmer på Nvidia-GPU:er i Luigis Mansion 3. - - - + Extended Dynamic State Utökad dynamisk status - + Controls the number of features that can be used in Extended Dynamic State. Higher states allow for more features and can increase performance, but may cause additional graphical issues. Kontrollerar antalet funktioner som kan användas i utökat dynamiskt tillstånd. Högre tillstånd möjliggör fler funktioner och kan öka prestandan, men kan orsaka ytterligare grafiska problem. - + Vertex Input Dynamic State Dynamiskt tillstånd för vertexinmatning - + Enables vertex input dynamic state feature for better quality and performance. Aktiverar funktionen för dynamiskt tillstånd för vertexinmatning för bättre kvalitet och prestanda. - + Sample Shading Provskuggning - + Allows the fragment shader to execute per sample in a multi-sampled fragment instead of once per fragment. Improves graphics quality at the cost of performance. Higher values improve quality but degrade performance. Tillåter fragment-shadern att exekveras per prov i ett multisamplade fragment istället för en gång per fragment. Förbättrar grafikens kvalitet på bekostnad av prestanda. Högre värden förbättrar kvaliteten men försämrar prestandan. - + RNG Seed RNG-frö - + Controls the seed of the random number generator. Mainly used for speedrunning. Att kontrollera fröet till slumptalsgeneratorn. Används främst för speedrunning. - + Device Name Enhetsnamn - + The name of the console. Konsolens namn. - + Homebrew Args Homebrew-argument - + Command-line arguments passed to homebrew at launch (e.g. -noglsl). Kommandoradsargument som skickas till homebrew vid start (t.ex. -noglsl). - + Custom RTC Date: Anpassat RTC-datum: - + This option allows to change the clock of the console. Can be used to manipulate time in games. Med det här alternativet kan du ändra klockan på konsolen. Kan användas för att manipulera tiden i spel. - + The number of seconds from the current unix time Antalet sekunder från aktuell Unix-tid - + Language: Språk: - + This option can be overridden when region setting is auto-select - Det här alternativet kan åsidosättas när regioninställningen är automatiskt vald. + Det här alternativet kan åsidosättas när regioninställningen är automatiskt vald - + Region: Region: - + The region of the console. Konsolens region. - + Time Zone: Tidszon: - + The time zone of the console. Konsolens tidszon. - + Sound Output Mode: Ljudutmatningsläge: - + Console Mode: Konsolläge: - + Selects if the console is in Docked or Handheld mode. Games will change their resolution, details and supported controllers and depending on this setting. Setting to Handheld can help improve performance for low end systems. @@ -1134,1026 +1142,1026 @@ Spel ändrar upplösning, detaljer och stödda kontroller beroende på denna ins Inställningen Handhållen kan förbättra prestandan för enklare system. - + Prompt for user profile on boot Fråga efter användarprofil vid uppstart - + Useful if multiple people use the same PC. Användbart om flera personer använder samma dator. - + Pause when not in focus Pausa när inte i fokus - + Pauses emulation when focusing on other windows. Pausar emulering när fokus är på andra fönster. - + Confirm before stopping emulation Bekräfta innan emuleringen stoppas - + Overrides prompts asking to confirm stopping the emulation. Enabling it bypasses such prompts and directly exits the emulation. Åsidosätter frågor om att bekräfta att emuleringen ska avslutas. Om du aktiverar den hoppar du över sådana uppmaningar och avslutar emuleringen direkt. - + Hide mouse on inactivity Dölj musen vid inaktivitet - + Hides the mouse after 2.5s of inactivity. Döljer musen efter 2,5 sekunders inaktivitet. - + Check for updates Leta efter uppdateringar - + Whether or not to check for updates upon startup. Om uppdateringar ska sökas vid start eller inte. - + Enable Gamemode Aktivera Gamemode - + Force X11 as Graphics Backend Tvinga X11 som grafikbackend - + Custom frontend Anpassad frontend - + Real applet Verklig applet - - + + Disabled Inaktiverad - + Never Aldrig - + On Load Vid inläsning - + Always Alltid - + CPU CPU - + GPU GPU - + CPU Asynchronous CPU asynkron - + Uncompressed (Best quality) Okomprimerad (bästa kvalitet) - + BC1 (Low quality) BC1 (låg kvalitet) - + BC3 (Medium quality) BC3 (medelhög kvalitet) - - + + Auto Auto - + 30 FPS 30 bilder/s - + 60 FPS 60 bilder/s - + 90 FPS 90 bilder/s - + 120 FPS 120 bilder/s - + Conservative Konservativ - + Aggressive Aggressiv - + Vulkan Vulkan - + OpenGL GLSL OpenGL GLSL - + OpenGL GLASM (Assembly Shaders, NVIDIA Only) OpenGL GLASM (Assembly Shaders, endast NVIDIA) - + OpenGL SPIR-V (Experimental, AMD/Mesa Only) OpenGL SPIR-V (Experimentell, endast AMD/Mesa) - + Null Null - + Fast Snabb - - - + + + Accurate Exakt - - - + + + Default Standard - + Unsafe (fast) Osäker (snabb) - + Safe (stable) Säker (stabil) - + Immediate Omedelbar - + Balanced Balanserad - + Unsafe Inte säker - + Paranoid (disables most optimizations) Paranoid (inaktiverar de flesta optimeringar) - + Debugging Felsökning - + Dynarmic Dynarmisk - + NCE NCE - + Borderless Windowed Ramlöst fönsterläge - + Exclusive Fullscreen Exklusiv helskärm - + No Video Output Ingen videoutgång - + CPU Video Decoding CPU-videoavkodning - + GPU Video Decoding (Default) GPU videoavkodning (standard) - + 0.25X (180p/270p) [EXPERIMENTAL] 0.25X (180p/270p) [EXPERIMENTELL] - + 0.5X (360p/540p) [EXPERIMENTAL] 0.5X (360p/540p) [EXPERIMENTELL] - + 0.75X (540p/810p) [EXPERIMENTAL] 0.75X (540p/810p) [EXPERIMENTELL] - + 1X (720p/1080p) 1X (720p/1080p) - + 1.25X (900p/1350p) [EXPERIMENTAL] 1.25X (900p/1350p) [EXPERIMENTELL] - + 1.5X (1080p/1620p) [EXPERIMENTAL] 1.5X (1080p/1620p) [EXPERIMENTELL] - + 2X (1440p/2160p) 2X (1440p/2160p) - + 3X (2160p/3240p) 3X (2160p/3240p) - + 4X (2880p/4320p) 4X (2880p/4320p) - + 5X (3600p/5400p) 5X (3600p/5400p) - + 6X (4320p/6480p) 6X (4320p/6480p) - + 7X (5040p/7560p) 7X (5040p/7560p) - + 8X (5760p/8640p) 8X (5760p/8640p) - + Nearest Neighbor Närmsta granne - + Bilinear Bilinjär - + Bicubic Bikubisk - + Gaussian Gaussisk - + Lanczos Lanczos - + ScaleForce ScaleForce - + AMD FidelityFX Super Resolution AMD FidelityFX Super Resolution - + Area Område - + MMPX MMPX - + Zero-Tangent Zero-Tangent - + B-Spline B-Spline - + Mitchell Mitchell - + Spline-1 Spline-1 - + Snapdragon Game Super Resolution Snapdragon Game Super Resolution - + Snapdragon Game Super Resolution EdgeDir Snapdragon Game Super Resolution EdgeDir - + None Ingen - + FXAA FXAA - + SMAA SMAA - + Default (16:9) Standard (16:9) - + Force 4:3 Tvinga 4:3 - + Force 21:9 Tvinga 21:9 - + Force 16:10 Tvinga 16:10 - + Stretch to Window Sträck ut till fönster - + Automatic Automatiskt - + 2x 2x - + 4x 4x - + 8x 8x - + 16x 16x - + Japanese (日本語) Japanska (日本語) - + American English Amerikansk engelska - + French (français) Franska (français) - + German (Deutsch) Tyska (Deutsch) - + Italian (italiano) Italienska (italiano) - + Spanish (español) Spanska (español) - + Chinese Kinesiska - + Korean (한국어) Koreanska (한국어) - + Dutch (Nederlands) Nederländska (Nederlands) - + Portuguese (português) Portugisiska (português) - + Russian (Русский) Ryska (Русский) - + Taiwanese Taiwanesiska - + British English Brittisk engelska - + Canadian French Kanadensisk franska - + Latin American Spanish Latinamerikansk spanska - + Simplified Chinese Förenklad kinesiska - + Traditional Chinese (正體中文) Traditionell kinesiska (正體中文) - + Brazilian Portuguese (português do Brasil) Brasiliansk portugisiska (português do Brasil) - + Polish (polska) Polska (polska) - + Thai (แบบไทย) Thai (แบบไทย) - - + + Japan Japan - + USA USA - + Europe Europa - + Australia Australien - + China Kina - + Korea Korea - + Taiwan Taiwan - + Auto (%1) Auto select time zone Auto (%1) - + Default (%1) Default time zone Standard (%1) - + CET CET - + CST6CDT CST6CDT - + Cuba Kuba - + EET EET - + Egypt Egypten - + Eire Irland - + EST EST - + EST5EDT EST5EDT - + GB GB - + GB-Eire GB-Irland - + GMT GMT - + GMT+0 GMT+0 - + GMT-0 GMT-0 - + GMT0 GMT0 - + Greenwich Greenwich - + Hongkong Hongkong - + HST HST - + Iceland Island - + Iran Iran - + Israel Israel - + Jamaica Jamaica - + Kwajalein Kwajalein - + Libya Libyen - + MET MET - + MST MST - + MST7MDT MST7MDT - + Navajo Navajo - + NZ NZ - + NZ-CHAT NZ-CHAT - + Poland Polen - + Portugal Portugal - + PRC PRC - + PST8PDT PST8PDT - + ROC ROC - + ROK ROK - + Singapore Singapore - + Turkey Turkiet - + UCT UCT - + Universal Universal - + UTC UTC - + W-SU W-SU - + WET VÅT - + Zulu Zulu - + Mono Mono - + Stereo Stereo - + Surround Surround - + 4GB DRAM (Default) 4 GB DRAM (standard) - + 6GB DRAM (Unsafe) 6 GB DRAM (osäker) - + 8GB DRAM 8 GB DRAM - + 10GB DRAM (Unsafe) 10 GB DRAM (osäker) - + 12GB DRAM (Unsafe) 12 GB DRAM (osäker) - + Docked Dockad - + Handheld Handhållen - - + + Normal Normal - - + + Boost Förstärk - - + + Overclock Överklocka - + Always ask (Default) Fråga alltid (standard) - + Only if game specifies not to stop Endast om spelet anger att det inte ska stoppas - + Never ask Fråga aldrig - + Very Small (16 MB) Mycket liten (16 MB) - + Small (32 MB) Liten (32 MB) - + Normal (128 MB) Normal (128 MB) - + Large (256 MB) Stor (256 MB) - + Very Large (512 MB) Mycket stor (512 MB) - + Very Low (4 MB) Mycket låg (4 MB) - + Low (8 MB) Låg (8 MB) - + Normal (16 MB) Normal (16 MB) - + Medium (32 MB) Medium (32 MB) - + High (64 MB) Hög (64 MB) - + Very Low (32) Mycket låg (32) - + Low (64) Låg (64) - + Normal (128) Normal (128) - + Medium (256) Medium (256) - + High (512) Hög (512) - + ExtendedDynamicState 1 ExtendedDynamicState 1 - + ExtendedDynamicState 2 ExtendedDynamicState 2 - + ExtendedDynamicState 3 ExtendedDynamicState 3 - + Tree View Trädvy - + Grid View Rutnätsvy @@ -2974,7 +2982,7 @@ Om du aktiverar den hoppar du över sådana uppmaningar och avslutar emuleringen ... - ... + … @@ -3049,33 +3057,33 @@ Om du aktiverar den hoppar du över sådana uppmaningar och avslutar emuleringen Select Emulated NAND Directory... - Välj katalog för emulerad NAND... + Välj katalog för emulerad NAND… Select Emulated SD Directory... - Välj katalog för emulerad SD... + Välj katalog för emulerad SD… Select Save Data Directory... - Välj katalog för sparat data... + Välj katalog för sparat data… Select Gamecard Path... - Välj sökväg för Gamecard... + Välj sökväg för Gamecard… Select Dump Directory... - Välj dumpkatalog... + Välj dumpkatalog… Select Mod Load Directory... - Välj katalog för modinläsningar... + Välj katalog för modinläsningar… @@ -3133,7 +3141,7 @@ Till: %2 Migrating save data... - Migrerar sparat data... + Migrerar sparat data… @@ -3224,7 +3232,7 @@ Vill du ta bort gammalt sparat data? Select External Content Directory... - Välj katalog för externt innehåll... + Välj katalog för externt innehåll… @@ -3273,7 +3281,7 @@ Vill du ta bort gammalt sparat data? Configure Effects... - Konfigurera effekter... + Konfigurera effekter… @@ -3820,7 +3828,7 @@ Vill du ta bort gammalt sparat data? Aimed to disable SDL GUIDE button hack: synthetic GUIDE(HOME) event when SELECT(MINUS) + START(PLUS) pressed. May impact Win related trigger/rumble/etc stuff - Avsedd att stänga av SDL:s GUIDE-knappshack: syntetisk GUIDE(HOME)-händelse när SELECT(MINUS) + START(PLUS) trycks ned. Kan påverka Windows-relaterade avtryckare, vibrationer med mera. + Avsedd att stänga av SDL:s GUIDE-knappshack: syntetisk GUIDE(HOME)-händelse när SELECT(MINUS) + START(PLUS) trycks ned. Kan påverka Windows-relaterade avtryckare, vibrationer med mera @@ -4019,7 +4027,7 @@ Vill du ta bort gammalt sparat data? Modifier Range: 0% - Modifieringsintervall: 0% + Modifieringsintervall: 0 % @@ -4203,7 +4211,7 @@ Vill du ta bort gammalt sparat data? Choose a value between 0% and 100% - Välj ett värde mellan 0% och 100% + Välj ett värde mellan 0 % och 100 % @@ -4241,13 +4249,13 @@ Om du vill invertera axlarna för du joysticken först vertikalt och sedan horis Deadzone: %1% - Dödzon: %1% + Dödzon: %1 % Modifier Range: %1% - Modifieringsintervall: %1% + Modifieringsintervall: %1 % @@ -4636,8 +4644,8 @@ Om du vill invertera axlarna för du joysticken först vertikalt och sedan horis Mouse panning works better with a deadzone of 0% and a range of 100%. Current values are %1% and %2% respectively. - Muspanorering fungerar bättre med en dödzon på 0% a och ett intervall på 100%. -Nuvarande värden är %1% respektive %2%. + Muspanorering fungerar bättre med en dödzon på 0 % och ett intervall på 100 %. +Nuvarande värden är %1 % respektive %2 %. @@ -4886,7 +4894,7 @@ För att ta bort NAND-installerade uppdateringar, högerklicka på spelet i spel Once deleted, these can NOT be recovered. Are you 100% sure you want to delete them? -När de har tagits bort kan de INTE återställas. Är du 100% säker på att du vill ta bort dem? +När de har tagits bort kan de INTE återställas. Är du 100 % säker på att du vill ta bort dem? @@ -5250,7 +5258,7 @@ UUID: %2 Deadzone: %1% - Dödzon: %1% + Dödzon: %1 % @@ -5377,7 +5385,7 @@ UUID: %2 ... - ... + … @@ -5390,7 +5398,7 @@ UUID: %2 Select TAS Load Directory... - Välj katalog för TAS-inläsningar... + Välj katalog för TAS-inläsningar… @@ -5657,7 +5665,7 @@ Dra punkterna för att ändra position, eller dubbelklicka på tabellcellerna f ... - ... + … @@ -5672,7 +5680,7 @@ Dra punkterna för att ändra position, eller dubbelklicka på tabellcellerna f Select Screenshots Path... - Välj sökväg för skärmdumpar... + Välj sökväg för skärmdumpar… @@ -5924,7 +5932,7 @@ Dra punkterna för att ändra position, eller dubbelklicka på tabellcellerna f Calculating... - Beräknar... + Beräknar… @@ -6806,7 +6814,7 @@ Felsökningsmeddelande: Loading... - Läser in... + Läser in… @@ -6816,7 +6824,7 @@ Felsökningsmeddelande: Launching... - Startar... + Startar… @@ -7033,17 +7041,17 @@ Felsökningsmeddelande: &Install Files to NAND... - &Installera filer till NAND... + &Installera filer till NAND… L&oad File... - Läs &in fil... + Läs &in fil… Load &Folder... - Läs in &mapp... + Läs in &mapp… @@ -7079,7 +7087,7 @@ Felsökningsmeddelande: Con&figure... - Kon&figurera... + Kon&figurera… @@ -7144,7 +7152,7 @@ Felsökningsmeddelande: Load/Remove &Amiibo... - Läs in/ta bort &Amiibo... + Läs in/ta bort &Amiibo… @@ -7194,12 +7202,12 @@ Felsökningsmeddelande: &Configure TAS... - &Konfigurera TAS... + &Konfigurera TAS… Configure C&urrent Game... - Konfigurera a&ktuellt spel... + Konfigurera a&ktuellt spel… @@ -7369,7 +7377,7 @@ Felsökningsmeddelande: Loading Web Applet... - Läser in webbapplet... + Läser in webbapplet… @@ -7397,7 +7405,7 @@ Felsökningsmeddelande: Current emulation speed. Values higher or lower than 100% indicate emulation is running faster or slower than a Switch. - Aktuell emuleringshastighet. Värden högre eller lägre än 100% indikerar att emuleringen körs snabbare eller långsammare än en Switch. + Aktuell emuleringshastighet. Värden högre eller lägre än 100 % indikerar att emuleringen körs snabbare eller långsammare än en Switch. @@ -7427,7 +7435,7 @@ Felsökningsmeddelande: Configure Effects... - Konfigurera effekter... + Konfigurera effekter… @@ -7509,7 +7517,7 @@ Felsökningsmeddelande: Closing software... - Stänger programvara... + Stänger programvara… @@ -7626,12 +7634,12 @@ Felsökningsmeddelande: There is not enough free space at %1 to extract the RomFS. Please free up space or select a different dump directory at Emulation > Configure > System > Filesystem > Dump Root - Det finns inte tillräckligt med ledigt utrymme på %1 för att extrahera RomFS. Frigör utrymme eller välj en annan dumpkatalog under Emulering > Konfigurera > System > Filsystem > Dumprot. + Det finns inte tillräckligt med ledigt utrymme på %1 för att extrahera RomFS. Frigör utrymme eller välj en annan dumpkatalog under Emulering > Konfigurera > System > Filsystem > Dumprot Extracting RomFS... - Extraherar RomFS... + Extraherar RomFS… @@ -7713,7 +7721,7 @@ Felsökningsmeddelande: Installing file "%1"... - Installerar filen "%1"... + Installerar filen "%1"… @@ -7800,7 +7808,7 @@ Använd endast denna funktion för att installera uppdateringar och DLC. Select NCA Install Type... - Välj NCA-installationstyp... + Välj NCA-installationstyp… @@ -7884,7 +7892,7 @@ Använd endast denna funktion för att installera uppdateringar och DLC. The current amiibo has been removed - Den aktuella amiibo har tagits bort. + Den aktuella amiibo har tagits bort @@ -7915,7 +7923,7 @@ Använd endast denna funktion för att installera uppdateringar och DLC. The selected file is not a valid amiibo - Den valda filen är inte en giltig amiibo. + Den valda filen är inte en giltig amiibo @@ -8011,12 +8019,12 @@ Använd endast denna funktion för att installera uppdateringar och DLC. Speed: %1% / %2% - Hastighet: %1% / %2% + Hastighet: %1 % / %2 % Speed: %1% - Hastighet: %1% + Hastighet: %1 % @@ -8052,7 +8060,7 @@ Använd endast denna funktion för att installera uppdateringar och DLC. VOLUME: %1% Volume percentage (e.g. 50%) - VOLYM: %1% + VOLYM: %1 % @@ -8503,7 +8511,7 @@ Fortsätt ändå? UUID must be 32 hex characters (0-9, A-F) - UUID måste vara 32 hexadecimala tecken (0-9, A-F) + UUID måste vara 32 hexadecimala tecken (0 till 9, A-F) @@ -8587,7 +8595,7 @@ Fortsätt ändå? Must be 32 hex characters (0-9, a-f) Tooltip - Måste vara 32 hexadecimala tecken (0-9, a-f) + Måste vara 32 hexadecimala tecken (0 till 9, a-f) @@ -8793,7 +8801,7 @@ p, li { white-space: pre-wrap; } Migrating, this may take a while... - Migrerar, det kan ta ett tag... + Migrerar, det kan ta ett tag… @@ -9308,7 +9316,7 @@ p, li { white-space: pre-wrap; } ... - ... + … @@ -9356,7 +9364,7 @@ p, li { white-space: pre-wrap; } Installing Firmware... - Installerar firmware... + Installerar firmware… @@ -9396,7 +9404,7 @@ p, li { white-space: pre-wrap; } Verifying integrity... - Verifierar integritet... + Verifierar integritet… @@ -9454,7 +9462,7 @@ p, li { white-space: pre-wrap; } UNEXPECTED BAD THINGS MAY HAPPEN IF YOU DON'T READ THIS!<br>Eden has detected the following save directories with no attached profile:<br>%1<br><br>The following profiles are valid:<br>%2<br><br>Click "OK" to open your save folder and fix up your profiles.<br>Hint: copy the contents of the largest or last-modified folder elsewhere, delete all orphaned profiles, and move your copied contents to the good profile.<br><br>Still confused? See the <a href='https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/user/Orphaned.md'>help page</a>.<br> - OVÄNTADE PROBLEM KAN UPPSTÅ OM DU INTE LÄSER DETTA!<br>Eden har upptäckt följande sparningskataloger utan bifogade profiler:<br>%1<br><br>Följande profiler är giltiga:<br>%2<br><br>Klicka på ”OK” för att öppna din sparningsmapp och fixa dina profiler.<br>Tips: kopiera innehållet i den största eller senast ändrade mappen till en annan plats, ta bort alla övergivna profiler och flytta det kopierade innehållet till den giltiga profilen.<br><br>Fortfarande förvirrad? Se <a href='https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/user/Orphaned.md'>hjälpsidan</a>.<br> + OVÄNTADE PROBLEM KAN UPPSTÅ OM DU INTE LÄSER DETTA!<br>Eden har upptäckt följande sparningskataloger utan bifogade profiler:<br>%1<br><br>Följande profiler är giltiga:<br>%2<br><br>Klicka på ”OK” för att öppna din sparningsmapp och rätta till dina profiler.<br>Tips: kopiera innehållet i den största eller senast ändrade mappen till en annan plats, ta bort alla övergivna profiler och flytta det kopierade innehållet till den giltiga profilen.<br><br>Fortfarande förvirrad? Se <a href='https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/user/Orphaned.md'>hjälpsidan</a>.<br> @@ -9476,12 +9484,12 @@ p, li { white-space: pre-wrap; } Once deleted, your data will NOT come back! Only do this if you're 100% sure you want to delete this data. När dina data har raderats kan de INTE återställas! -Gör detta endast om du är 100% säker på att du vill radera dessa data. +Gör detta endast om du är 100 % säker på att du vill radera dessa data. Clearing... - Tömmer... + Tömmer… @@ -9503,7 +9511,7 @@ Gör detta endast om du är 100% säker på att du vill radera dessa data. Exporting data. This may take a while... - Exporterar data. Detta kan ta en stund... + Exporterar data. Detta kan ta en stund… @@ -9558,7 +9566,7 @@ Gör detta endast om du är 100% säker på att du vill radera dessa data. Importing data. This may take a while... - Importerar data. Detta kan ta en stund... + Importerar data. Detta kan ta en stund… @@ -10073,12 +10081,12 @@ De flesta mods är RomFS-mods, men patchar (.pchtxt) är vanligtvis ExeFS-mods.< Successfully installed firmware version %1 - Firmware-version %1 har installerats. + Firmware-version %1 har installerats Unable to locate potential firmware NCA files - Det går inte att hitta potentiella NCA-filer för firmware. + Det går inte att hitta potentiella NCA-filer för firmware @@ -10198,7 +10206,7 @@ Detta rekommenderas om du vill dela data mellan emulatorer. 1 - 8 - 1 - 8 + 1 till 8 @@ -10608,7 +10616,7 @@ p, li { white-space: pre-wrap; } By selecting "From Eden", previous save data stored in Ryujinx will be deleted, and vice versa for "From Ryujinx". Genom att länka sparade data till Ryujinx kan både Ryujinx och Eden referera till samma sparade filer för dina spel. -Om du väljer ”Från Eden” tas tidigare sparade data bort som lagrats i Ryujinx, och vice versa för ”Från Ryujinx”. +Om du väljer ”Från Eden” tas tidigare sparade data bort som lagrats i Ryujinx och vice versa för ”Från Ryujinx”. @@ -10726,7 +10734,7 @@ Om du väljer ”Från Eden” tas tidigare sparade data bort som lagrats i Ryuj Downloading... - Hämtar ner... + Hämtar ner… diff --git a/dist/languages/tr_TR.ts b/dist/languages/tr_TR.ts index 95f0e25c31..b63445c3fb 100644 --- a/dist/languages/tr_TR.ts +++ b/dist/languages/tr_TR.ts @@ -712,12 +712,32 @@ Aggressive mode may impact performance of other applications such as recording s Bellek güncellemeleri sırasında belirli önbellek geçersiz kılma işlemlerini atlayarak işlemci kullanımını azaltır ve gecikmeyi iyileştirir. Bu, hafif çökmelere neden olabilir. - + + GPU Readback Before NCE Invalidation + + + + + Flushes GPU buffer data back to guest memory before NCE invalidates the whole guest page, preserving it while the CPU store proceeds. + + + + + Patch Runtime NROs for NCE + + + + + Applies NCE code patches to runtime-loaded NRO modules.This is required for some games to run correctly. + + + + VSync Mode: VSync Modu: - + FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. FIFO Relaxed allows tearing as it recovers from a slow down. Mailbox can have lower latency than FIFO and does not tear but may drop frames. @@ -725,79 +745,79 @@ Immediate (no synchronization) presents whatever is available and can exhibit te FIFO (VSync) kare düşürmez veya yırtılma göstermez ancak ekran yenileme hızıyla sınırlıdır. FIFO Relaxed, yavaşlamadan toparlanırken yırtılmaya izin verir. Mailbox, FIFO'dan daha düşük gecikmeye sahip olabilir ve yırtılma yapmaz ancak kare düşürebilir. Immediate (senkronizasyon yok), mevcut olanı anında sunar ve yırtılmalara neden olabilir. - + Sync Memory Operations Bellek İşlemlerini Senkronize Et - + Ensures data consistency between compute and memory operations. This option fixes issues in games, but may degrade performance. Unreal Engine 4 games often see the most significant changes thereof. Hesaplama ve bellek işlemleri arasında veri tutarlılığı sağlar. Bu seçenek oyunlardaki sorunları giderir ancak performansı düşürebilir. Unreal Engine 4 oyunları genellikle bundan en önemli ölçüde etkilenenlerdir. - + Enable asynchronous presentation (Vulkan only) Asenkron sunumu etkinleştir (Yalnızca Vulkan) - + Slightly improves performance by moving presentation to a separate CPU thread. Sunum işlemini ayrı bir işlemci iş parçacığına taşıyarak performansı biraz artırır. - + Force maximum clocks (Vulkan only) En yüksek hızı zorla (Yalnızca Vulkan için) - + Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed. Grafik komutlarını beklerken GPU'nun hızının düşmesini engellemek için arka planda görev yürütür - + Anisotropic Filtering: Anisotropic Filtering: - + Controls the quality of texture rendering at oblique angles. Safe to set at 16x on most GPUs. Eğik açılardaki doku oluşturma kalitesini kontrol eder. Çoğu grafik kartında 16x olarak ayarlanması güvenlidir. - + GPU Mode: Grafik Kartı Modu - + Controls the GPU emulation mode. Most games render fine with Fast, but Accurate is still required for some. Particles tend to only render correctly with Accurate mode. - + DMA Accuracy: DMA Doğruluğu: - + Controls the DMA read mode. Unsafe is faster, while Safe is more stable and can fix issues in some games. Default follows the GPU Accuracy setting. - + GPU Fence Behavior: - + Controls the GPU fence synchronization behavior. Immediate is the fastest option, but can introduce some issues. Balanced offers better compatibility and may fix issues in some games. @@ -806,1302 +826,1291 @@ Default follows the GPU Mode setting. - + Enable asynchronous shader compilation Asenkron gölgelendirici derlemeyi etkinleştir - + May reduce shader stutter. Gölgelendirici/shader takılmalarını azaltabilir. - + GPU Clocks - + Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch's clocks. - + GPU Unswizzle - + Accelerates BCn 3D texture decoding using GPU compute. Disable if experiencing crashes or graphical glitches. - + GPU Unswizzle Max Texture Size - + Sets the maximum size (MiB) for GPU-based texture unswizzling. While the GPU is faster for medium and large textures, the CPU may be more efficient for very small ones. Adjust this to find the balance between GPU acceleration and CPU overhead. - + GPU Unswizzle Stream Size - + Sets the maximum amount of texture data (in MiB) processed per frame. Higher values can reduce stutter during texture loading but may impact frame consistency. - + GPU Unswizzle Chunk Size - + Determines the number of depth slices processed in a single dispatch. Increasing this can improve throughput on high-end GPUs but may cause TDR or driver timeouts on weaker hardware. - + Use Vulkan pipeline cache Vulkan pipeline önbelleği kullan - + Enables GPU vendor-specific pipeline cache. This option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally. Grafik kartı üreticisine özel işlem hattı önbelleğini etkinleştirir. Bu seçenek, Vulkan sürücüsünün işlem hattı önbellek dosyalarını dahili olarak saklamadığı durumlarda gölgelendirici yükleme süresini önemli ölçüde iyileştirebilir. - + Enable Compute Pipelines (Intel Vulkan Only) Hesaplama İşlem Hatlarını Etkinleştir (Yalnızca Intel Vulkan) - + Required by some games. This setting only exists for Intel proprietary drivers and may crash if enabled. Compute pipelines are always enabled on all other drivers. Bazı oyunlar için gereklidir. Bu ayar yalnızca Intel'in tescilli sürücüleri için mevcuttur ve etkinleştirilirse çökmeye neden olabilir. Hesaplama işlem hatları diğer tüm sürücülerde her zaman etkindir. - + Enable Reactive Flushing Reaktif Temizlemeyi Etkinleştir - + Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing. Tahminli temizleme yerine reaktif temizleme kullanarak daha doğru bellek senkronizasyonu sağlar. - + Sync to framerate of video playback Video oynatma kare hızına senkronize et - + Run the game at normal speed during video playback, even when the framerate is unlocked. Kare hızı kilidi açık olsa bile video oynatımı sırasında oyunu normal hızda çalıştırır. - + Barrier feedback loops Bariyer geri besleme döngüleri - + Improves rendering of transparency effects in specific games. Belirli oyunlarda şeffaflık efektlerinin oluşturulmasını iyileştirir. - + Enable buffer history - + Enables access to previous buffer states. This option may improve rendering quality and performance consistency in some games. - + Fix bloom effects - + Removes bloom in Burnout. - - Enable Legacy Rescale Pass - - - - - May fix rescale issues in some games by relying on behavior from the previous implementation. -Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and grey texture flicker on Nvidia GPUs in Luigis Mansion 3. - - - - + Extended Dynamic State Genişletilmiş Dinamik Durum - + Controls the number of features that can be used in Extended Dynamic State. Higher states allow for more features and can increase performance, but may cause additional graphical issues. Genişletilmiş Dinamik Durumda kullanılabilecek özelliklerin sayısını kontrol eder. Daha yüksek durumlar daha fazla özelliğe izin verir ve performansı artırabilir, ancak ek grafik sorunlarına neden olabilir. - + Vertex Input Dynamic State Vertex Dinamik Durumu - + Enables vertex input dynamic state feature for better quality and performance. Daha iyi kalite ve performans için Vertex dinamik durum özelliğini etkinleştirir. - + Sample Shading Örnek Gölgelendirme - + Allows the fragment shader to execute per sample in a multi-sampled fragment instead of once per fragment. Improves graphics quality at the cost of performance. Higher values improve quality but degrade performance. Parça gölgelendiricinin, her parça için bir kez yerine çoklu örneklenmiş bir parçadaki her örnek için yürütülmesine olanak tanır. Performans pahasına grafik kalitesini artırır. Daha yüksek değerler kaliteyi artırır ancak performansı düşürür. - + RNG Seed RNG çekirdeği - + Controls the seed of the random number generator. Mainly used for speedrunning. Rastgele sayı üretecinin tohumunu kontrol eder. Esas olarak hızlı bitirme denemeleri için kullanılır. - + Device Name Cihaz İsmi - + The name of the console. Konsolun adı - + Homebrew Args - + Command-line arguments passed to homebrew at launch (e.g. -noglsl). - + Custom RTC Date: Özel RTC Tarihi - + This option allows to change the clock of the console. Can be used to manipulate time in games. Bu seçenek konsolun saatini değiştirmeye olanak tanır. Oyunlarda zamanı manipüle etmek için kullanılabilir. - + The number of seconds from the current unix time Mevcut unix zamanından itibaren saniye sayısı - + Language: Dil: - + This option can be overridden when region setting is auto-select Bölge ayarı otomatik seçim olduğunda bu seçenek geçersiz kılınabilir. - + Region: Bölge: - + The region of the console. Konsolun bölgesi - + Time Zone: Saat Dilimi: - + The time zone of the console. Konsolun saat dilimi - + Sound Output Mode: Ses Çıkış Modu: - + Console Mode: Konsol Modu: - + Selects if the console is in Docked or Handheld mode. Games will change their resolution, details and supported controllers and depending on this setting. Setting to Handheld can help improve performance for low end systems. Konsolun Yerleşik veya El Modunda olup olmadığını seçer. Oyunlar bu ayara bağlı olarak çözünürlüklerini, detaylarını ve desteklenen kontrolcülerini değiştirecektir. El Moduna ayarlamak, düşük seviyeli sistemler için performansı artırmaya yardımcı olabilir. - + Prompt for user profile on boot Açılışta kullanıcı profili için sor - + Useful if multiple people use the same PC. Aynı bilgisayarı birden fazla kişi kullanıyorsa yararlıdır. - + Pause when not in focus Odaklı değilken duraklat - + Pauses emulation when focusing on other windows. Diğer pencerelere odaklanıldığında emülasyonu duraklatır. - + Confirm before stopping emulation Emülasyonu durdurmadan önce onayla - + Overrides prompts asking to confirm stopping the emulation. Enabling it bypasses such prompts and directly exits the emulation. Emülasyonu durdurma onayı isteklerini/istemlerini geçersiz kılar. Etkinleştirildiğinde, bu tür istekleri/istemleri atlar ve emülasyonu doğrudan/dirket olarak kapatır. - + Hide mouse on inactivity Hareketsizlik durumunda imleci gizle - + Hides the mouse after 2.5s of inactivity. 2,5 saniye hareketsizlikten sonra fareyi gizler. - + Check for updates Güncellemeleri Kontrol Et - + Whether or not to check for updates upon startup. Başlangıçta güncellemelerin kontrol edilip edilmeyeceği. - + Enable Gamemode Oyun Modunu/Gamemode Etkinleştir - + Force X11 as Graphics Backend Grafik arka ucu olarak X11'i zorla - + Custom frontend Özel ön yüz - + Real applet Gerçek aplikasyon - - + + Disabled Devre Dışı - + Never Asla - + On Load Yüklemede - + Always Her zaman - + CPU CPU - + GPU GPU - + CPU Asynchronous Asenkron CPU - + Uncompressed (Best quality) Sıkıştırılmamış (En iyi kalite) - + BC1 (Low quality) BC1 (Düşük kalite) - + BC3 (Medium quality) BC3 (Orta kalite) - - + + Auto Otomatik - + 30 FPS - + 60 FPS - + 90 FPS - + 120 FPS - + Conservative Muhafazakar - + Aggressive Agresif - + Vulkan Vulkan - + OpenGL GLSL - + OpenGL GLASM (Assembly Shaders, NVIDIA Only) - + OpenGL SPIR-V (Experimental, AMD/Mesa Only) - + Null Boş - + Fast Hızlı - - - + + + Accurate Doğru - - - + + + Default Varsayılan - + Unsafe (fast) Güvenli Değil (hızlı) - + Safe (stable) Güvenli (Stabil) - + Immediate - + Balanced Dengeli - + Unsafe Güvensiz - + Paranoid (disables most optimizations) Paranoya (çoğu optimizasyonu kapatır) - + Debugging Hata ayıklama - + Dynarmic Dinamik - + NCE NCE - + Borderless Windowed Kenarlıksız Tam Ekran - + Exclusive Fullscreen Ayrılmış Tam Ekran - + No Video Output Video Çıkışı Yok - + CPU Video Decoding CPU Video Decoding - + GPU Video Decoding (Default) GPU Video Decoding (Varsayılan) - + 0.25X (180p/270p) [EXPERIMENTAL] 0.25X (180p/270p) [DENEYSEL] - + 0.5X (360p/540p) [EXPERIMENTAL] 0.5X (360p/540p) [DENEYSEL] - + 0.75X (540p/810p) [EXPERIMENTAL] 0.75X (540p/810p) [DENEYSEL] - + 1X (720p/1080p) 1X (720p/1080p) - + 1.25X (900p/1350p) [EXPERIMENTAL] 1.25X (900p/1350p) [DENEYSEL] - + 1.5X (1080p/1620p) [EXPERIMENTAL] 1.5X (1080p/1620p) [DENEYSEL] - + 2X (1440p/2160p) 2X (1440p/2160p) - + 3X (2160p/3240p) 3X (2160p/3240p) - + 4X (2880p/4320p) 4X (2880p/4320p) - + 5X (3600p/5400p) 5X (3600p/5400p) - + 6X (4320p/6480p) 6X (4320p/6480p) - + 7X (5040p/7560p) 7X (5040p/7560p) - + 8X (5760p/8640p) 8X (5760p/8640p) - + Nearest Neighbor En Yakın Komşu Algoritması - + Bilinear Bilinear - + Bicubic Bicubic - + Gaussian Gausyen - + Lanczos Lanczos - + ScaleForce ScaleForce - + AMD FidelityFX Super Resolution AMD FidelityFX Süper Çözünürlük - + Area Area - + MMPX MMPX - + Zero-Tangent Zero-Tangent - + B-Spline B-Spline - + Mitchell Mitchell - + Spline-1 Spline-1 - + Snapdragon Game Super Resolution - + Snapdragon Game Super Resolution EdgeDir - + None Yok - + FXAA FXAA - + SMAA SMAA - + Default (16:9) Varsayılan (16:9) - + Force 4:3 4:3'e Zorla - + Force 21:9 21:9'a Zorla - + Force 16:10 16:10'a Zorla - + Stretch to Window Ekrana Sığdır - + Automatic Otomatik - + 2x 2x - + 4x 4x - + 8x 8x - + 16x 16x - + Japanese (日本語) Japonca (日本語) - + American English Amerikan İngilizcesi - + French (français) Fransızca (français) - + German (Deutsch) Almanca (Deutsch) - + Italian (italiano) İtalyanca (italiano) - + Spanish (español) İspanyolca (español) - + Chinese Çince - + Korean (한국어) Korece (한국어) - + Dutch (Nederlands) Flemenkçe (Nederlands) - + Portuguese (português) Portekizce (português) - + Russian (Русский) Rusça (Русский) - + Taiwanese Tayvanca - + British English İngiliz İngilizcesi - + Canadian French Kanada Fransızcası - + Latin American Spanish Latin Amerika İspanyolcası - + Simplified Chinese Basitleştirilmiş Çince - + Traditional Chinese (正體中文) Geleneksel Çince (正體中文) - + Brazilian Portuguese (português do Brasil) Brezilya Portekizcesi (português do Brasil) - + Polish (polska) - + Thai (แบบไทย) - - + + Japan Japonya - + USA ABD - + Europe Avrupa - + Australia Avustralya - + China Çin - + Korea Kore - + Taiwan Tayvan - + Auto (%1) Auto select time zone Otomatik (%1) - + Default (%1) Default time zone Varsayılan (%1) - + CET CET - + CST6CDT CST6CDT - + Cuba Küba - + EET EET - + Egypt Mısır - + Eire İrlanda - + EST EST - + EST5EDT EST5EDT - + GB GB - + GB-Eire GB-İrlanda - + GMT GMT - + GMT+0 GMT+0 - + GMT-0 MT-0 - + GMT0 GMT0 - + Greenwich Greenwich - + Hongkong Hong Kong - + HST HST - + Iceland İzlanda - + Iran İran - + Israel İsrail - + Jamaica Jamaika - + Kwajalein Kwajalein - + Libya Libya - + MET MET - + MST MST - + MST7MDT MST7MDT - + Navajo Navaho - + NZ Yeni Zelanda - + NZ-CHAT Chatham Adaları - + Poland Polonya - + Portugal Portekiz - + PRC PRC - + PST8PDT PST8PDT - + ROC ROC - + ROK ROK - + Singapore Singapur - + Turkey Türkiye - + UCT UCT - + Universal Evrensel - + UTC UTC - + W-SU W-SU - + WET WET - + Zulu Zulu - + Mono Mono - + Stereo Stereo - + Surround Surround - + 4GB DRAM (Default) 4GB DRAM (Varsayılan) - + 6GB DRAM (Unsafe) 6GB DRAM (Güvenli Değil) - + 8GB DRAM 8GB DRAM - + 10GB DRAM (Unsafe) 10GB DRAM (Güvenli Değil) - + 12GB DRAM (Unsafe) 12GB DRAM (Güvenli Değil) - + Docked Dock Modu Aktif - + Handheld Taşınabilir - - + + Normal - - + + Boost - - + + Overclock - + Always ask (Default) Her zaman sor (Varsayılan) - + Only if game specifies not to stop Sadece oyun durdurulmamasını belirtirse - + Never ask Asla sorma - + Very Small (16 MB) - + Small (32 MB) - + Normal (128 MB) - + Large (256 MB) - + Very Large (512 MB) - + Very Low (4 MB) - + Low (8 MB) - + Normal (16 MB) - + Medium (32 MB) - + High (64 MB) - + Very Low (32) - + Low (64) - + Normal (128) - + Medium (256) Orta (256) - + High (512) Yüksek (512) - + ExtendedDynamicState 1 Genişletilmiş Dinamik Durum 1 - + ExtendedDynamicState 2 Genişletilmiş Dinamik Durum 2 - + ExtendedDynamicState 3 Genişletilmiş Dinamik Durum 3 - + Tree View - + Grid View diff --git a/dist/languages/uk.ts b/dist/languages/uk.ts index 2fdce360cc..fd166bc4f9 100644 --- a/dist/languages/uk.ts +++ b/dist/languages/uk.ts @@ -732,12 +732,32 @@ Aggressive mode may impact performance of other applications such as recording s Пропускає деякі анулювання кешу під час оновлень пам’яті, зменшуючи використання ЦП й виправляючи затримки. Це може спричинити збої. - + + GPU Readback Before NCE Invalidation + + + + + Flushes GPU buffer data back to guest memory before NCE invalidates the whole guest page, preserving it while the CPU store proceeds. + + + + + Patch Runtime NROs for NCE + + + + + Applies NCE code patches to runtime-loaded NRO modules.This is required for some games to run correctly. + + + + VSync Mode: Режим вертикальної синхронізації: - + FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. FIFO Relaxed allows tearing as it recovers from a slow down. Mailbox can have lower latency than FIFO and does not tear but may drop frames. @@ -748,12 +768,12 @@ Mailbox може мати меншу затримку, ніж FIFO, і не ма Immediate (без синхронізації) показує всі кадри й може створювати розриви. - + Sync Memory Operations Синхронізувати операції з пам’яттю - + Ensures data consistency between compute and memory operations. This option fixes issues in games, but may degrade performance. Unreal Engine 4 games often see the most significant changes thereof. @@ -762,44 +782,44 @@ Unreal Engine 4 games often see the most significant changes thereof. Ігри на Unreal Engine 4 часто зазнають найзначніших змін. - + Enable asynchronous presentation (Vulkan only) Увімкнути асинхронне подання (лише Vulkan) - + Slightly improves performance by moving presentation to a separate CPU thread. Трохи покращує продуктивність завдяки переміщенню подання на окремий потік ЦП. - + Force maximum clocks (Vulkan only) Примусово максимальна тактова частота (лише Vulkan) - + Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed. Виконує роботу у фоновому режимі в очікуванні графічних команд, не даючи змоги ГП знижувати тактову частоту. - + Anisotropic Filtering: Анізотропна фільтрація: - + Controls the quality of texture rendering at oblique angles. Safe to set at 16x on most GPUs. Керує якістю візуалізації текстур під непрямими кутами. Для більшості ГП можна вільно вибирати 16x. - + GPU Mode: Режим ГП: - + Controls the GPU emulation mode. Most games render fine with Fast, but Accurate is still required for some. Particles tend to only render correctly with Accurate mode. @@ -808,24 +828,24 @@ Particles tend to only render correctly with Accurate mode. Частинки зазвичай правильно візуалізуються лише з режимом «Точно». - + DMA Accuracy: Точність DMA: - + Controls the DMA read mode. Unsafe is faster, while Safe is more stable and can fix issues in some games. Default follows the GPU Accuracy setting. - + GPU Fence Behavior: - + Controls the GPU fence synchronization behavior. Immediate is the fastest option, but can introduce some issues. Balanced offers better compatibility and may fix issues in some games. @@ -834,44 +854,44 @@ Default follows the GPU Mode setting. - + Enable asynchronous shader compilation Увімкнути асинхронну компіляцію шейдерів - + May reduce shader stutter. Може зменшити шейдерні затримки. - + GPU Clocks - + Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch's clocks. - + GPU Unswizzle Розпакування за допомогою ГП - + Accelerates BCn 3D texture decoding using GPU compute. Disable if experiencing crashes or graphical glitches. Прискорює декодування 3D-текстур BCn застосовуючи обчислення за допомогою ГП. Вимкніть у разі збоїв або проблем із графікою. - + GPU Unswizzle Max Texture Size Максимальний розмір текстур для розпакування за допомогою ГП - + Sets the maximum size (MiB) for GPU-based texture unswizzling. While the GPU is faster for medium and large textures, the CPU may be more efficient for very small ones. Adjust this to find the balance between GPU acceleration and CPU overhead. @@ -880,48 +900,48 @@ Adjust this to find the balance between GPU acceleration and CPU overhead. - + GPU Unswizzle Stream Size Розмір потоку розпакування за допомогою ГП - + Sets the maximum amount of texture data (in MiB) processed per frame. Higher values can reduce stutter during texture loading but may impact frame consistency. Встановлює максимальний обсяг даних текстур (у МіБ) для обробки на кадр. Вищі значення здатні зменшити затримки під час завантаження текстур, але можуть вплинути на стабільність кадрів. - + GPU Unswizzle Chunk Size Розмір блоків розпакування за допомогою ГП - + Determines the number of depth slices processed in a single dispatch. Increasing this can improve throughput on high-end GPUs but may cause TDR or driver timeouts on weaker hardware. Визначає кількість зрізів глибини, оброблених за одне відправлення. Збільшення здатне покращити пропускну здатність на потужних ГП, але може призвести до TDR або затримок драйвера зі слабшим устаткуванням. - + Use Vulkan pipeline cache Використовувати кеш конвеєра Vulkan - + Enables GPU vendor-specific pipeline cache. This option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally. Вмикає особливий для різних виробників ГП кеш конвеєра. Це налаштування може значно зменшити час завантаження шейдерів у випадках, коли драйвер Vulkan не зберігає власний кеш конвеєра. - + Enable Compute Pipelines (Intel Vulkan Only) Увімкнути обчислювальні конвеєри (лише Intel Vulkan) - + Required by some games. This setting only exists for Intel proprietary drivers and may crash if enabled. Compute pipelines are always enabled on all other drivers. @@ -930,194 +950,182 @@ Compute pipelines are always enabled on all other drivers. Обчислювальні конвеєри завжди увімкнені у всіх інших драйверах. - + Enable Reactive Flushing Увімкнути реактивне очищення - + Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing. Використовує реактивне очищення замість прогнозованого, забезпечуючи точнішу синхронізацію пам’яті. - + Sync to framerate of video playback Синхронізувати частоту кадрів з відтворенням відео - + Run the game at normal speed during video playback, even when the framerate is unlocked. Відтворювати гру з нормальною швидкістю під час відтворення відео навіть при розблокованій частоті кадрів. - + Barrier feedback loops Бар’єрні цикли відгуку - + Improves rendering of transparency effects in specific games. Покращує візуалізацію ефектів прозорості в деяких іграх. - + Enable buffer history Увімкнути історію буфера - + Enables access to previous buffer states. This option may improve rendering quality and performance consistency in some games. Вмикає доступ до попередніх станів буфера. Цей параметр може покращити якість візуалізації та стабільну продуктивність у деяких іграх. - + Fix bloom effects Виправити ефекти світіння - + Removes bloom in Burnout. Прибирає світіння в Burnout. - - Enable Legacy Rescale Pass - Увімкнути застаріле масштабування - - - - May fix rescale issues in some games by relying on behavior from the previous implementation. -Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and grey texture flicker on Nvidia GPUs in Luigis Mansion 3. - Може виправити проблеми з масштабуванням в іграх, покладаючись на поведінку з попередньої імплементації. -Застаріле масштабування виправляє артефакти з лініями на ГП від AMD та Intel, а також сіре блимання текстур на ГП від Nvidia в Luigis Mansion 3. - - - + Extended Dynamic State Розширений динамічний стан - + Controls the number of features that can be used in Extended Dynamic State. Higher states allow for more features and can increase performance, but may cause additional graphical issues. Керує кількістю функцій, які можна використовувати в «Розширеному динамічному стані». Вищі значення допускають більше функцій і можуть збільшити продуктивність, але можуть спричинити додаткові проблеми з графікою. - + Vertex Input Dynamic State Динамічний стан введення вершин - + Enables vertex input dynamic state feature for better quality and performance. Вмикає можливість динамічного стану введення вершин для кращих якості й продуктивності. - + Sample Shading Шейдинг зразків - + Allows the fragment shader to execute per sample in a multi-sampled fragment instead of once per fragment. Improves graphics quality at the cost of performance. Higher values improve quality but degrade performance. Дозволяє виконувати фрагмент шейдера для кожного зразка в багатозразковому фрагменті замість одного разу для кожного фрагмента. Покращує якість графікі ціною втрати продуктивності. Вищі значення покращують якість, але погіршують продуктивність. - + RNG Seed Початкове значення RNG - + Controls the seed of the random number generator. Mainly used for speedrunning. Керує початковим значення генератора випадкових чисел. Зазвичай використовується в спідранах. - + Device Name Назва пристрою - + The name of the console. Назва консолі. - + Homebrew Args Параметри запуску Homebrew - + Command-line arguments passed to homebrew at launch (e.g. -noglsl). Параметри командного рядка, що передаються Homebrew при запуску (як-от noglsl). - + Custom RTC Date: Користувацька дата RTC: - + This option allows to change the clock of the console. Can be used to manipulate time in games. Це налаштування дозволяє змінити час годинника консолі. Можна використовувати для маніпуляцій із часом в іграх. - + The number of seconds from the current unix time Кількість секунд від поточного unix-часу. - + Language: Мова: - + This option can be overridden when region setting is auto-select Це налаштування може перевизначитися, якщо налаштування регіону вибирається автоматично - + Region: Регіон: - + The region of the console. Регіон консолі. - + Time Zone: Часовий пояс: - + The time zone of the console. Часовий пояс консолі. - + Sound Output Mode: Режим виведення звуку: - + Console Mode: Режим консолі: - + Selects if the console is in Docked or Handheld mode. Games will change their resolution, details and supported controllers and depending on this setting. Setting to Handheld can help improve performance for low end systems. @@ -1126,1026 +1134,1026 @@ Setting to Handheld can help improve performance for low end systems. Налаштування «Портативний» може покращити продуктивність на слабких системах. - + Prompt for user profile on boot Запитувати профіль користувача під час запуску - + Useful if multiple people use the same PC. Корисно, якщо одним комп’ютером користуються кілька користувачів. - + Pause when not in focus Призупиняти, якщо не у фокусі - + Pauses emulation when focusing on other windows. Призупиняє емуляцію при фокусування на інших вікнах. - + Confirm before stopping emulation Підтверджувати зупинку емуляції - + Overrides prompts asking to confirm stopping the emulation. Enabling it bypasses such prompts and directly exits the emulation. Перевизначає запити на підтвердження зупинки емуляції. Увімкнення обходить такі запити й одразу зупиняє емуляцію. - + Hide mouse on inactivity Приховувати курсор миші при бездіяльності - + Hides the mouse after 2.5s of inactivity. Приховує курсор миші після 2,5 с її бездіяльності. - + Check for updates Перевіряти оновлення - + Whether or not to check for updates upon startup. Чи перевіряти оновлення при запуску. - + Enable Gamemode Увімкнути ігровий режим - + Force X11 as Graphics Backend Примусово використовувати X11 як графічний бекенд - + Custom frontend Користувацький фронтенд - + Real applet Справжній аплет - - + + Disabled Вимкнено - + Never Ніколи - + On Load При завантаженні - + Always Завжди - + CPU ЦП - + GPU ГП - + CPU Asynchronous Асинхронно ЦП - + Uncompressed (Best quality) Без стиснення (Найкраща якість) - + BC1 (Low quality) ВС1 (Низька якість) - + BC3 (Medium quality) ВС3 (Середня якість) - - + + Auto Автоматично - + 30 FPS 30 к/с - + 60 FPS 60 к/с - + 90 FPS 90 к/с - + 120 FPS 120 к/с - + Conservative Заощадження - + Aggressive Агресивно - + Vulkan Vulkan - + OpenGL GLSL OpenGL GLSL - + OpenGL GLASM (Assembly Shaders, NVIDIA Only) OpenGL GLASM (асемблерні шейдери, лише NVIDIA) - + OpenGL SPIR-V (Experimental, AMD/Mesa Only) OpenGL SPIR-V (експериментально, лише AMD/Mesa) - + Null Нічого - + Fast Швидко - - - + + + Accurate Точно - - - + + + Default Стандартно - + Unsafe (fast) Небезпечно (швидко) - + Safe (stable) Безпечно (стабільно) - + Immediate - + Balanced Збалансовано - + Unsafe Небезпечно - + Paranoid (disables most optimizations) Параноїк (вимикає більшість оптимізацій) - + Debugging Зневадження - + Dynarmic Динамічно - + NCE NCE - + Borderless Windowed Безрамкове вікно - + Exclusive Fullscreen Ексклюзивний повноекранний - + No Video Output Виведення відео відсутнє - + CPU Video Decoding Декодування відео на ЦП - + GPU Video Decoding (Default) Декодування відео на ГП (стандатно) - + 0.25X (180p/270p) [EXPERIMENTAL] 0.25X (180p/270p) [ЕКСПЕРИМЕНТАЛЬНО] - + 0.5X (360p/540p) [EXPERIMENTAL] 0.5X (360p/540p) [ЕКСПЕРИМЕНТАЛЬНО] - + 0.75X (540p/810p) [EXPERIMENTAL] 0.75X (540p/810p) [ЕКСПЕРИМЕНТАЛЬНО] - + 1X (720p/1080p) 1X (720p/1080p) - + 1.25X (900p/1350p) [EXPERIMENTAL] 1.25X (900p/1350p) [ЕКСПЕРИМЕНТАЛЬНО] - + 1.5X (1080p/1620p) [EXPERIMENTAL] 1.5X (1080p/1620p) [ЕКСПЕРИМЕНТАЛЬНО] - + 2X (1440p/2160p) 2X (1440p/2160p) - + 3X (2160p/3240p) 3X (2160p/3240p) - + 4X (2880p/4320p) 4X (2880p/4320p) - + 5X (3600p/5400p) 5X (3600p/5400p) - + 6X (4320p/6480p) 6X (4320p/6480p) - + 7X (5040p/7560p) 7X (5040p/7560p) - + 8X (5760p/8640p) 8X (5760p/8640p) - + Nearest Neighbor Найближчий сусід - + Bilinear Білінійний - + Bicubic Бікубічний - + Gaussian Ґаусса - + Lanczos Ланцоша - + ScaleForce ScaleForce - + AMD FidelityFX Super Resolution AMD FidelityFX Super Resolution - + Area Області - + MMPX MMPX - + Zero-Tangent Нульовий тангенс - + B-Spline B-Spline - + Mitchell Мітчелла - + Spline-1 Spline-1 - + Snapdragon Game Super Resolution Snapdragon Game Super Resolution - + Snapdragon Game Super Resolution EdgeDir Snapdragon Game Super Resolution EdgeDir - + None Немає - + FXAA FXAA - + SMAA SMAA - + Default (16:9) Стандартно (16:9) - + Force 4:3 Примусово 4:3 - + Force 21:9 Примусово 21:9 - + Force 16:10 Примусово 16:10 - + Stretch to Window Розтягнути до вікна - + Automatic Автоматично - + 2x 2x - + 4x 4x - + 8x 8x - + 16x 16x - + Japanese (日本語) Японська (日本語) - + American English Американська англійська - + French (français) Французька (français) - + German (Deutsch) Німецька (Deutsch) - + Italian (italiano) Італійська (italiano) - + Spanish (español) Іспанська (español) - + Chinese Китайська - + Korean (한국어) Корейська (한국어) - + Dutch (Nederlands) Нідерландська (Nederlands) - + Portuguese (português) Португальська (português) - + Russian (Русский) Російська (Русский) - + Taiwanese Тайванська - + British English Британська англійська - + Canadian French Канадська французька - + Latin American Spanish Латиноамериканська іспанська - + Simplified Chinese Спрощена китайська - + Traditional Chinese (正體中文) Традиційна китайська (正體中文) - + Brazilian Portuguese (português do Brasil) Бразильська португальська (português do Brasil) - + Polish (polska) Польська (polska) - + Thai (แบบไทย) Тайська (แบบไทย) - - + + Japan Японія - + USA США - + Europe Європа - + Australia Австралія - + China Китай - + Korea Корея - + Taiwan Тайвань - + Auto (%1) Auto select time zone Автоматично (%1) - + Default (%1) Default time zone Стандартно (%1) - + CET CET - + CST6CDT CST6CDT - + Cuba Куба - + EET EET - + Egypt Єгипет - + Eire Ейре - + EST EST - + EST5EDT EST5EDT - + GB GB - + GB-Eire GB-Eire - + GMT GMT - + GMT+0 GMT+0 - + GMT-0 GMT-0 - + GMT0 GMT0 - + Greenwich Гринвіч - + Hongkong Гонконг - + HST HST - + Iceland Ісландія - + Iran Іран - + Israel Ізраїль - + Jamaica Ямайка - + Kwajalein Кваджалейн - + Libya Лівія - + MET MET - + MST MST - + MST7MDT MST7MDT - + Navajo Навахо - + NZ NZ - + NZ-CHAT NZ-CHAT - + Poland Польща - + Portugal Португалія - + PRC PRC - + PST8PDT PST8PDT - + ROC ROC - + ROK ROK - + Singapore Сінгапур - + Turkey Туреччина - + UCT UCT - + Universal Універсальний - + UTC UTC - + W-SU W-SU - + WET WET - + Zulu Зулу - + Mono Моно - + Stereo Стерео - + Surround Об’ємний - + 4GB DRAM (Default) 4GB DRAM (стандартно) - + 6GB DRAM (Unsafe) 6GB DRAM (небезпечно) - + 8GB DRAM 8GB DRAM - + 10GB DRAM (Unsafe) 10GB DRAM (небезпечно) - + 12GB DRAM (Unsafe) 12GB DRAM (небезпечно) - + Docked У докстанції - + Handheld Портативний - - + + Normal - - + + Boost - - + + Overclock - + Always ask (Default) Завжди запитувати (стандартно) - + Only if game specifies not to stop Лише якщо гра вказує не зупиняти - + Never ask Ніколи не запитувати - + Very Small (16 MB) Дуже малий (16 МБ) - + Small (32 MB) Малий (32 МБ) - + Normal (128 MB) Нормальний (128 МБ) - + Large (256 MB) Великий (256 МБ) - + Very Large (512 MB) Дуже великий (512 МБ) - + Very Low (4 MB) Дуже низький (4 МБ) - + Low (8 MB) Низький (8 МБ) - + Normal (16 MB) Нормальний (16 МБ) - + Medium (32 MB) Середній (32 МБ) - + High (64 MB) Високий (64 МБ) - + Very Low (32) Дуже низький (32) - + Low (64) Низький (64) - + Normal (128) Нормальний (128) - + Medium (256) Середньо (256) - + High (512) Високо (512) - + ExtendedDynamicState 1 Розширений динамічний стан 1 - + ExtendedDynamicState 2 Розширений динамічний стан 2 - + ExtendedDynamicState 3 Розширений динамічний стан 3 - + Tree View Дерево вибору - + Grid View Таблиця diff --git a/dist/languages/vi.ts b/dist/languages/vi.ts index f1257a08f5..f0a7e591bd 100644 --- a/dist/languages/vi.ts +++ b/dist/languages/vi.ts @@ -696,12 +696,32 @@ Aggressive mode may impact performance of other applications such as recording s - + + GPU Readback Before NCE Invalidation + + + + + Flushes GPU buffer data back to guest memory before NCE invalidates the whole guest page, preserving it while the CPU store proceeds. + + + + + Patch Runtime NROs for NCE + + + + + Applies NCE code patches to runtime-loaded NRO modules.This is required for some games to run correctly. + + + + VSync Mode: Chế độ Vsync: - + FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. FIFO Relaxed allows tearing as it recovers from a slow down. Mailbox can have lower latency than FIFO and does not tear but may drop frames. @@ -709,79 +729,79 @@ Immediate (no synchronization) presents whatever is available and can exhibit te - + Sync Memory Operations - + Ensures data consistency between compute and memory operations. This option fixes issues in games, but may degrade performance. Unreal Engine 4 games often see the most significant changes thereof. - + Enable asynchronous presentation (Vulkan only) Bật hiển thị bất đồng bộ (chỉ cho Vulkan) - + Slightly improves performance by moving presentation to a separate CPU thread. - + Force maximum clocks (Vulkan only) Buộc chạy ở xung nhịp tối đa (chỉ cho Vulkan) - + Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed. Chạy các công việc trong nền trong khi đang chờ lệnh đồ họa để giữ cho GPU không giảm xung nhịp. - + Anisotropic Filtering: Lọc bất đẳng hướng: - + Controls the quality of texture rendering at oblique angles. Safe to set at 16x on most GPUs. - + GPU Mode: - + Controls the GPU emulation mode. Most games render fine with Fast, but Accurate is still required for some. Particles tend to only render correctly with Accurate mode. - + DMA Accuracy: - + Controls the DMA read mode. Unsafe is faster, while Safe is more stable and can fix issues in some games. Default follows the GPU Accuracy setting. - + GPU Fence Behavior: - + Controls the GPU fence synchronization behavior. Immediate is the fastest option, but can introduce some issues. Balanced offers better compatibility and may fix issues in some games. @@ -790,1301 +810,1290 @@ Default follows the GPU Mode setting. - + Enable asynchronous shader compilation - + May reduce shader stutter. - + GPU Clocks - + Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch's clocks. - + GPU Unswizzle - + Accelerates BCn 3D texture decoding using GPU compute. Disable if experiencing crashes or graphical glitches. - + GPU Unswizzle Max Texture Size - + Sets the maximum size (MiB) for GPU-based texture unswizzling. While the GPU is faster for medium and large textures, the CPU may be more efficient for very small ones. Adjust this to find the balance between GPU acceleration and CPU overhead. - + GPU Unswizzle Stream Size - + Sets the maximum amount of texture data (in MiB) processed per frame. Higher values can reduce stutter during texture loading but may impact frame consistency. - + GPU Unswizzle Chunk Size - + Determines the number of depth slices processed in a single dispatch. Increasing this can improve throughput on high-end GPUs but may cause TDR or driver timeouts on weaker hardware. - + Use Vulkan pipeline cache Dùng bộ nhớ đệm pipeline Vulkan - + Enables GPU vendor-specific pipeline cache. This option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally. - + Enable Compute Pipelines (Intel Vulkan Only) - + Required by some games. This setting only exists for Intel proprietary drivers and may crash if enabled. Compute pipelines are always enabled on all other drivers. - + Enable Reactive Flushing Bật xả tương ứng - + Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing. - + Sync to framerate of video playback Đồng bộ hóa với tốc độ khung hình khi phát video - + Run the game at normal speed during video playback, even when the framerate is unlocked. Chạy game với tốc độ bình thường trong quá trình phát video, ngay cả khi tốc độ khung hình được mở khóa. - + Barrier feedback loops Vòng lặp phản hồi rào cản - + Improves rendering of transparency effects in specific games. Cải thiện hiệu quả kết xuất của hiệu ứng trong suốt trong một số game. - + Enable buffer history - + Enables access to previous buffer states. This option may improve rendering quality and performance consistency in some games. - + Fix bloom effects - + Removes bloom in Burnout. - - Enable Legacy Rescale Pass - - - - - May fix rescale issues in some games by relying on behavior from the previous implementation. -Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and grey texture flicker on Nvidia GPUs in Luigis Mansion 3. - - - - + Extended Dynamic State - + Controls the number of features that can be used in Extended Dynamic State. Higher states allow for more features and can increase performance, but may cause additional graphical issues. - + Vertex Input Dynamic State - + Enables vertex input dynamic state feature for better quality and performance. - + Sample Shading - + Allows the fragment shader to execute per sample in a multi-sampled fragment instead of once per fragment. Improves graphics quality at the cost of performance. Higher values improve quality but degrade performance. - + RNG Seed Hạt giống RNG - + Controls the seed of the random number generator. Mainly used for speedrunning. - + Device Name Tên thiết bị - + The name of the console. - + Homebrew Args - + Command-line arguments passed to homebrew at launch (e.g. -noglsl). - + Custom RTC Date: - + This option allows to change the clock of the console. Can be used to manipulate time in games. - + The number of seconds from the current unix time - + Language: - + This option can be overridden when region setting is auto-select - + Region: Vùng: - + The region of the console. - + Time Zone: Múi giờ: - + The time zone of the console. - + Sound Output Mode: Chế độ đầu ra âm thanh: - + Console Mode: - + Selects if the console is in Docked or Handheld mode. Games will change their resolution, details and supported controllers and depending on this setting. Setting to Handheld can help improve performance for low end systems. - + Prompt for user profile on boot - + Useful if multiple people use the same PC. - + Pause when not in focus - + Pauses emulation when focusing on other windows. - + Confirm before stopping emulation - + Overrides prompts asking to confirm stopping the emulation. Enabling it bypasses such prompts and directly exits the emulation. - + Hide mouse on inactivity Ẩn con trỏ chuột khi không dùng - + Hides the mouse after 2.5s of inactivity. - + Check for updates - + Whether or not to check for updates upon startup. - + Enable Gamemode - + Force X11 as Graphics Backend - + Custom frontend - + Real applet - - + + Disabled - + Never - + On Load - + Always - + CPU CPU - + GPU - + CPU Asynchronous - + Uncompressed (Best quality) Không nén (Chất lượng tốt nhất) - + BC1 (Low quality) BC1 (Chất lượng thấp) - + BC3 (Medium quality) BC3 (Chất lượng trung bình) - - + + Auto Tự động - + 30 FPS - + 60 FPS - + 90 FPS - + 120 FPS - + Conservative - + Aggressive - + Vulkan Vulkan - + OpenGL GLSL - + OpenGL GLASM (Assembly Shaders, NVIDIA Only) - + OpenGL SPIR-V (Experimental, AMD/Mesa Only) - + Null Null - + Fast - - - + + + Accurate Chính xác - - - + + + Default Mặc định - + Unsafe (fast) - + Safe (stable) - + Immediate - + Balanced - + Unsafe Không an toàn - + Paranoid (disables most optimizations) Paranoid (vô hiệu hoá hầu hết sự tối ưu) - + Debugging - + Dynarmic - + NCE - + Borderless Windowed Cửa sổ không viền - + Exclusive Fullscreen Toàn màn hình - + No Video Output Không có đầu ra video - + CPU Video Decoding Giải mã video bằng CPU - + GPU Video Decoding (Default) Giải mã video bằng GPU (Mặc định) - + 0.25X (180p/270p) [EXPERIMENTAL] - + 0.5X (360p/540p) [EXPERIMENTAL] - + 0.75X (540p/810p) [EXPERIMENTAL] 0.75X (540p/810p) [THỬ NGHIỆM] - + 1X (720p/1080p) 1X (720p/1080p) - + 1.25X (900p/1350p) [EXPERIMENTAL] - + 1.5X (1080p/1620p) [EXPERIMENTAL] 1.5X (1080p/1620p) [THỬ NGHIỆM] - + 2X (1440p/2160p) 2X (1440p/2160p) - + 3X (2160p/3240p) 3X (2160p/3240p) - + 4X (2880p/4320p) 4X (2880p/4320p) - + 5X (3600p/5400p) 5X (3600p/5400p) - + 6X (4320p/6480p) 6X (4320p/6480p) - + 7X (5040p/7560p) 7X (5040p/7560p) - + 8X (5760p/8640p) 8X (5760p/8640p) - + Nearest Neighbor Nearest Neighbor - + Bilinear Bilinear - + Bicubic Bicubic - + Gaussian Gaussian - + Lanczos - + ScaleForce ScaleForce - + AMD FidelityFX Super Resolution - + Area - + MMPX - + Zero-Tangent - + B-Spline - + Mitchell - + Spline-1 - + Snapdragon Game Super Resolution - + Snapdragon Game Super Resolution EdgeDir - + None Không có - + FXAA FXAA - + SMAA SMAA - + Default (16:9) Mặc định (16:9) - + Force 4:3 Dùng 4:3 - + Force 21:9 Dùng 21:9 - + Force 16:10 Dùng 16:10 - + Stretch to Window Mở rộng đến cửa sổ - + Automatic Tự động - + 2x 2x - + 4x 4x - + 8x 8x - + 16x 16x - + Japanese (日本語) Tiếng Nhật (日本語) - + American English Tiếng Anh Mỹ - + French (français) Tiếng Pháp (French) - + German (Deutsch) Tiếng Đức (Deutsch) - + Italian (italiano) Tiếng Ý (italiano) - + Spanish (español) Tiếng Tây Ban Nha (Español) - + Chinese Tiếng Trung - + Korean (한국어) Tiếng Hàn (한국어) - + Dutch (Nederlands) Tiếng Hà Lan (Nederlands) - + Portuguese (português) Tiếng Bồ Đào Nha (Portuguese) - + Russian (Русский) Tiếng Nga (Русский) - + Taiwanese Tiếng Đài Loan - + British English Tiếng Anh Anh - + Canadian French Tiếng Pháp Canada - + Latin American Spanish Tiếng Tây Ban Nha Mỹ Latinh - + Simplified Chinese Tiếng Trung giản thể - + Traditional Chinese (正體中文) Tiếng Trung phồn thể (正體中文) - + Brazilian Portuguese (português do Brasil) Tiếng Bồ Đào Nha Brasil (Português do Brasil) - + Polish (polska) - + Thai (แบบไทย) - - + + Japan Nhật Bản - + USA Hoa Kỳ - + Europe Châu Âu - + Australia Úc - + China Trung Quốc - + Korea Hàn Quốc - + Taiwan Đài Loan - + Auto (%1) Auto select time zone Tự động (%1) - + Default (%1) Default time zone Mặc định (%1) - + CET CET - + CST6CDT CST6CDT - + Cuba Cuba - + EET EET - + Egypt Ai Cập - + Eire Eire - + EST EST - + EST5EDT EST5EDT - + GB GB - + GB-Eire GB-Eire - + GMT GMT - + GMT+0 GMT+0 - + GMT-0 GMT-0 - + GMT0 GMT0 - + Greenwich Greenwich - + Hongkong Hồng Kông - + HST HST - + Iceland Iceland - + Iran Iran - + Israel Israel - + Jamaica Jamaica - + Kwajalein Kwajalein - + Libya Libya - + MET MET - + MST MST - + MST7MDT MST7MDT - + Navajo Navajo - + NZ NZ - + NZ-CHAT NZ-CHAT - + Poland Ba Lan - + Portugal Bồ Đào Nha - + PRC PRC - + PST8PDT PST8PDT - + ROC ROC - + ROK ROK - + Singapore Singapore - + Turkey Thổ Nhĩ Kỳ - + UCT UCT - + Universal Quốc tế - + UTC UTC - + W-SU W-SU - + WET WET - + Zulu Zulu - + Mono Mono - + Stereo Stereo - + Surround Surround - + 4GB DRAM (Default) - + 6GB DRAM (Unsafe) - + 8GB DRAM - + 10GB DRAM (Unsafe) - + 12GB DRAM (Unsafe) - + Docked Docked - + Handheld Handheld - - + + Normal - - + + Boost - - + + Overclock - + Always ask (Default) - + Only if game specifies not to stop - + Never ask - + Very Small (16 MB) - + Small (32 MB) - + Normal (128 MB) - + Large (256 MB) - + Very Large (512 MB) - + Very Low (4 MB) - + Low (8 MB) - + Normal (16 MB) - + Medium (32 MB) - + High (64 MB) - + Very Low (32) - + Low (64) - + Normal (128) - + Medium (256) - + High (512) - + ExtendedDynamicState 1 - + ExtendedDynamicState 2 - + ExtendedDynamicState 3 - + Tree View - + Grid View diff --git a/dist/languages/vi_VN.ts b/dist/languages/vi_VN.ts index 64edf2850d..51156ca9c8 100644 --- a/dist/languages/vi_VN.ts +++ b/dist/languages/vi_VN.ts @@ -696,12 +696,32 @@ Aggressive mode may impact performance of other applications such as recording s - + + GPU Readback Before NCE Invalidation + + + + + Flushes GPU buffer data back to guest memory before NCE invalidates the whole guest page, preserving it while the CPU store proceeds. + + + + + Patch Runtime NROs for NCE + + + + + Applies NCE code patches to runtime-loaded NRO modules.This is required for some games to run correctly. + + + + VSync Mode: Chế độ Vsync: - + FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. FIFO Relaxed allows tearing as it recovers from a slow down. Mailbox can have lower latency than FIFO and does not tear but may drop frames. @@ -709,79 +729,79 @@ Immediate (no synchronization) presents whatever is available and can exhibit te - + Sync Memory Operations - + Ensures data consistency between compute and memory operations. This option fixes issues in games, but may degrade performance. Unreal Engine 4 games often see the most significant changes thereof. - + Enable asynchronous presentation (Vulkan only) Bật hiển thị bất đồng bộ (chỉ dành cho Vulkan) - + Slightly improves performance by moving presentation to a separate CPU thread. - + Force maximum clocks (Vulkan only) Buộc chạy ở xung nhịp tối đa (chỉ Vulkan) - + Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed. Chạy các công việc trong nền trong khi đang chờ lệnh đồ họa để giữ cho GPU không giảm xung nhịp. - + Anisotropic Filtering: Bộ lọc góc nghiêng: - + Controls the quality of texture rendering at oblique angles. Safe to set at 16x on most GPUs. - + GPU Mode: - + Controls the GPU emulation mode. Most games render fine with Fast, but Accurate is still required for some. Particles tend to only render correctly with Accurate mode. - + DMA Accuracy: - + Controls the DMA read mode. Unsafe is faster, while Safe is more stable and can fix issues in some games. Default follows the GPU Accuracy setting. - + GPU Fence Behavior: - + Controls the GPU fence synchronization behavior. Immediate is the fastest option, but can introduce some issues. Balanced offers better compatibility and may fix issues in some games. @@ -790,1301 +810,1290 @@ Default follows the GPU Mode setting. - + Enable asynchronous shader compilation - + May reduce shader stutter. - + GPU Clocks - + Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch's clocks. - + GPU Unswizzle - + Accelerates BCn 3D texture decoding using GPU compute. Disable if experiencing crashes or graphical glitches. - + GPU Unswizzle Max Texture Size - + Sets the maximum size (MiB) for GPU-based texture unswizzling. While the GPU is faster for medium and large textures, the CPU may be more efficient for very small ones. Adjust this to find the balance between GPU acceleration and CPU overhead. - + GPU Unswizzle Stream Size - + Sets the maximum amount of texture data (in MiB) processed per frame. Higher values can reduce stutter during texture loading but may impact frame consistency. - + GPU Unswizzle Chunk Size - + Determines the number of depth slices processed in a single dispatch. Increasing this can improve throughput on high-end GPUs but may cause TDR or driver timeouts on weaker hardware. - + Use Vulkan pipeline cache Dùng Vulkan pipeline cache - + Enables GPU vendor-specific pipeline cache. This option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally. - + Enable Compute Pipelines (Intel Vulkan Only) - + Required by some games. This setting only exists for Intel proprietary drivers and may crash if enabled. Compute pipelines are always enabled on all other drivers. - + Enable Reactive Flushing Bật xả tương ứng - + Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing. - + Sync to framerate of video playback Đồng bộ hóa với tốc độ khung hình khi phát video - + Run the game at normal speed during video playback, even when the framerate is unlocked. Chạy game với tốc độ bình thường trong quá trình phát video, ngay cả khi tốc độ khung hình được mở khóa. - + Barrier feedback loops Vòng lặp phản hồi rào cản - + Improves rendering of transparency effects in specific games. Cải thiện hiệu quả hiển thị của hiệu ứng trong suốt trong một số trò chơi. - + Enable buffer history - + Enables access to previous buffer states. This option may improve rendering quality and performance consistency in some games. - + Fix bloom effects - + Removes bloom in Burnout. - - Enable Legacy Rescale Pass - - - - - May fix rescale issues in some games by relying on behavior from the previous implementation. -Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and grey texture flicker on Nvidia GPUs in Luigis Mansion 3. - - - - + Extended Dynamic State - + Controls the number of features that can be used in Extended Dynamic State. Higher states allow for more features and can increase performance, but may cause additional graphical issues. - + Vertex Input Dynamic State - + Enables vertex input dynamic state feature for better quality and performance. - + Sample Shading - + Allows the fragment shader to execute per sample in a multi-sampled fragment instead of once per fragment. Improves graphics quality at the cost of performance. Higher values improve quality but degrade performance. - + RNG Seed Hạt giống RNG - + Controls the seed of the random number generator. Mainly used for speedrunning. - + Device Name Tên thiết bị - + The name of the console. - + Homebrew Args - + Command-line arguments passed to homebrew at launch (e.g. -noglsl). - + Custom RTC Date: - + This option allows to change the clock of the console. Can be used to manipulate time in games. - + The number of seconds from the current unix time - + Language: - + This option can be overridden when region setting is auto-select - + Region: Vùng: - + The region of the console. - + Time Zone: Múi giờ: - + The time zone of the console. - + Sound Output Mode: Chế độ đầu ra âm thanh - + Console Mode: - + Selects if the console is in Docked or Handheld mode. Games will change their resolution, details and supported controllers and depending on this setting. Setting to Handheld can help improve performance for low end systems. - + Prompt for user profile on boot - + Useful if multiple people use the same PC. - + Pause when not in focus - + Pauses emulation when focusing on other windows. - + Confirm before stopping emulation - + Overrides prompts asking to confirm stopping the emulation. Enabling it bypasses such prompts and directly exits the emulation. - + Hide mouse on inactivity Ẩn con trỏ chuột khi không dùng - + Hides the mouse after 2.5s of inactivity. - + Check for updates - + Whether or not to check for updates upon startup. - + Enable Gamemode - + Force X11 as Graphics Backend - + Custom frontend - + Real applet - - + + Disabled - + Never - + On Load - + Always - + CPU CPU - + GPU - + CPU Asynchronous - + Uncompressed (Best quality) Không nén (Chất lượng tốt nhất) - + BC1 (Low quality) BC1 (Chất lượng thấp) - + BC3 (Medium quality) BC3 (Chất lượng trung bình) - - + + Auto Tự động - + 30 FPS - + 60 FPS - + 90 FPS - + 120 FPS - + Conservative - + Aggressive - + Vulkan Vulkan - + OpenGL GLSL - + OpenGL GLASM (Assembly Shaders, NVIDIA Only) - + OpenGL SPIR-V (Experimental, AMD/Mesa Only) - + Null Null - + Fast - - - + + + Accurate Tuyệt đối - - - + + + Default Mặc định - + Unsafe (fast) - + Safe (stable) - + Immediate - + Balanced - + Unsafe Tương đối - + Paranoid (disables most optimizations) Paranoid (vô hiệu hoá hầu hết sự tối ưu) - + Debugging - + Dynarmic - + NCE - + Borderless Windowed Cửa sổ không viền - + Exclusive Fullscreen Toàn màn hình - + No Video Output Không Video Đầu Ra - + CPU Video Decoding Giải mã video bằng CPU - + GPU Video Decoding (Default) Giải mã video bằng GPU (Mặc định) - + 0.25X (180p/270p) [EXPERIMENTAL] - + 0.5X (360p/540p) [EXPERIMENTAL] - + 0.75X (540p/810p) [EXPERIMENTAL] 0.75X (540p/810p) [THỬ NGHIỆM] - + 1X (720p/1080p) 1X (720p/1080p) - + 1.25X (900p/1350p) [EXPERIMENTAL] - + 1.5X (1080p/1620p) [EXPERIMENTAL] 1.5X (1080p/1620p) [THỬ NGHIỆM] - + 2X (1440p/2160p) 2X (1440p/2160p) - + 3X (2160p/3240p) 3X (2160p/3240p) - + 4X (2880p/4320p) 4X (2880p/4320p) - + 5X (3600p/5400p) 5X (3600p/5400p) - + 6X (4320p/6480p) 6X (4320p/6480p) - + 7X (5040p/7560p) 7X (5040p/7560p) - + 8X (5760p/8640p) 8X (5760p/8640p) - + Nearest Neighbor Nearest Neighbor - + Bilinear Bilinear - + Bicubic Bicubic - + Gaussian ScaleForce - + Lanczos - + ScaleForce ScaleForce - + AMD FidelityFX Super Resolution - + Area - + MMPX - + Zero-Tangent - + B-Spline - + Mitchell - + Spline-1 - + Snapdragon Game Super Resolution - + Snapdragon Game Super Resolution EdgeDir - + None Trống - + FXAA FXAA - + SMAA SMAA - + Default (16:9) Mặc định (16:9) - + Force 4:3 Dùng 4:3 - + Force 21:9 Dùng 21:9 - + Force 16:10 Dung 16:10 - + Stretch to Window Kéo dãn đến cửa sổ phần mềm - + Automatic Tự động - + 2x 2x - + 4x 4x - + 8x 8x - + 16x 16x - + Japanese (日本語) Tiếng Nhật (日本語) - + American English Tiếng Anh Mỹ - + French (français) Tiếng Pháp (French) - + German (Deutsch) Tiếng Đức (Deutsch) - + Italian (italiano) Tiếng Ý (italiano) - + Spanish (español) Tiếng Tây Ban Nha (Spanish) - + Chinese Tiếng Trung - + Korean (한국어) Tiếng Hàn (한국어) - + Dutch (Nederlands) Tiếng Hà Lan (Dutch) - + Portuguese (português) Tiếng Bồ Đào Nha (Portuguese) - + Russian (Русский) Tiếng Nga (Русский) - + Taiwanese Tiếng Đài Loan - + British English Tiếng Anh UK (British English) - + Canadian French Tiếng Pháp Canada - + Latin American Spanish Tiếng Mỹ La-tinh - + Simplified Chinese Tiếng Trung giản thể - + Traditional Chinese (正體中文) Tiếng Trung phồn thể (正體中文) - + Brazilian Portuguese (português do Brasil) Tiếng Bồ Đào Nha của người Brazil (Português do Brasil) - + Polish (polska) - + Thai (แบบไทย) - - + + Japan Nhật Bản - + USA Hoa Kỳ - + Europe Châu Âu - + Australia Châu Úc - + China Trung Quốc - + Korea Hàn Quốc - + Taiwan Đài Loan - + Auto (%1) Auto select time zone Tự động (%1) - + Default (%1) Default time zone Mặc định (%1) - + CET CET - + CST6CDT CST6CDT - + Cuba Cuba - + EET EET - + Egypt Ai Cập - + Eire Eire - + EST EST - + EST5EDT EST5EDT - + GB GB - + GB-Eire GB-Eire - + GMT GMT - + GMT+0 GMT+0 - + GMT-0 GMT-0 - + GMT0 GMT0 - + Greenwich Greenwich - + Hongkong Hồng Kông - + HST HST - + Iceland Iceland - + Iran Iran - + Israel Israel - + Jamaica Jamaica - + Kwajalein Kwajalein - + Libya Libya - + MET MET - + MST MST - + MST7MDT MST7MDT - + Navajo Navajo - + NZ NZ - + NZ-CHAT NZ-CHAT - + Poland Ba Lan - + Portugal Bồ Đào Nha - + PRC PRC - + PST8PDT PST8PDT - + ROC ROC - + ROK ROK - + Singapore Singapore - + Turkey Thổ Nhĩ Kỳ - + UCT UCT - + Universal Quốc tế - + UTC UTC - + W-SU W-SU - + WET WET - + Zulu Zulu - + Mono Mono - + Stereo Stereo - + Surround Surround - + 4GB DRAM (Default) - + 6GB DRAM (Unsafe) - + 8GB DRAM - + 10GB DRAM (Unsafe) - + 12GB DRAM (Unsafe) - + Docked Chế độ cắm TV - + Handheld Cầm tay - - + + Normal - - + + Boost - - + + Overclock - + Always ask (Default) - + Only if game specifies not to stop - + Never ask - + Very Small (16 MB) - + Small (32 MB) - + Normal (128 MB) - + Large (256 MB) - + Very Large (512 MB) - + Very Low (4 MB) - + Low (8 MB) - + Normal (16 MB) - + Medium (32 MB) - + High (64 MB) - + Very Low (32) - + Low (64) - + Normal (128) - + Medium (256) - + High (512) - + ExtendedDynamicState 1 - + ExtendedDynamicState 2 - + ExtendedDynamicState 3 - + Tree View - + Grid View diff --git a/dist/languages/zh_CN.ts b/dist/languages/zh_CN.ts index e6d5890370..2b86a73843 100644 --- a/dist/languages/zh_CN.ts +++ b/dist/languages/zh_CN.ts @@ -734,12 +734,32 @@ Aggressive mode may impact performance of other applications such as recording s 在内存更新期间跳过某些缓存失效,从而降低 CPU 使用率并改善延迟。这可能导致软件崩溃。 - + + GPU Readback Before NCE Invalidation + + + + + Flushes GPU buffer data back to guest memory before NCE invalidates the whole guest page, preserving it while the CPU store proceeds. + + + + + Patch Runtime NROs for NCE + + + + + Applies NCE code patches to runtime-loaded NRO modules.This is required for some games to run correctly. + + + + VSync Mode: 垂直同步模式: - + FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. FIFO Relaxed allows tearing as it recovers from a slow down. Mailbox can have lower latency than FIFO and does not tear but may drop frames. @@ -750,12 +770,12 @@ Mailbox 的延迟可能比 FIFO 低且不会导致撕裂,但可能会丢帧。 Immediate (不同步) 会呈现全部可用内容,并可能出现撕裂。 - + Sync Memory Operations 同步内存操作 - + Ensures data consistency between compute and memory operations. This option fixes issues in games, but may degrade performance. Unreal Engine 4 games often see the most significant changes thereof. @@ -764,44 +784,44 @@ Unreal Engine 4 games often see the most significant changes thereof. 虚幻 4 引擎的游戏通常会看到最显著的变化。 - + Enable asynchronous presentation (Vulkan only) 启用异步帧提交 (仅限 Vulkan) - + Slightly improves performance by moving presentation to a separate CPU thread. 将帧提交移动到单独的 CPU 线程,略微提高性能。 - + Force maximum clocks (Vulkan only) 强制最大时钟 (仅限 Vulkan) - + Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed. 在后台运行的同时等待图形命令,以防止 GPU 降低时钟速度。 - + Anisotropic Filtering: 各向异性过滤: - + Controls the quality of texture rendering at oblique angles. Safe to set at 16x on most GPUs. 控制在斜角下纹理渲染的质量。 大多数 GPU 上设置为 16 倍是安全的。 - + GPU Mode: GPU 模式: - + Controls the GPU emulation mode. Most games render fine with Fast, but Accurate is still required for some. Particles tend to only render correctly with Accurate mode. @@ -809,12 +829,12 @@ Particles tend to only render correctly with Accurate mode. 大多数游戏在“快速”模式下渲染效果良好,但有些游戏仍需使用“精确”模式。而粒子效果通常只有在“精确”模式下才能正确渲染。 - + DMA Accuracy: DMA 精度: - + Controls the DMA read mode. Unsafe is faster, while Safe is more stable and can fix issues in some games. Default follows the GPU Accuracy setting. @@ -823,12 +843,12 @@ Default follows the GPU Accuracy setting. 默认使用 GPU 精度设置。 - + GPU Fence Behavior: GPU 围栏行为: - + Controls the GPU fence synchronization behavior. Immediate is the fastest option, but can introduce some issues. Balanced offers better compatibility and may fix issues in some games. @@ -837,43 +857,43 @@ Default follows the GPU Mode setting. - + Enable asynchronous shader compilation 开启异步着色器编译 - + May reduce shader stutter. 可能减少着色器卡顿。 - + GPU Clocks GPU 时钟频率 - + Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch's clocks. 通过让游戏误以为 GPU 的处理速度比实际更快,以避免游戏为了适应 Switch 的时钟频率而降低分辨率和渲染距离。 - + GPU Unswizzle GPU 还原 - + Accelerates BCn 3D texture decoding using GPU compute. Disable if experiencing crashes or graphical glitches. 利用 GPU 计算来加速 BCn 格式 3D 纹理的解码。如果遇到崩溃或画面花屏,请禁用此项。 - + GPU Unswizzle Max Texture Size GPU 还原最大纹理尺寸 - + Sets the maximum size (MiB) for GPU-based texture unswizzling. While the GPU is faster for medium and large textures, the CPU may be more efficient for very small ones. Adjust this to find the balance between GPU acceleration and CPU overhead. @@ -882,48 +902,48 @@ Adjust this to find the balance between GPU acceleration and CPU overhead. - + GPU Unswizzle Stream Size GPU 还原流大小 - + Sets the maximum amount of texture data (in MiB) processed per frame. Higher values can reduce stutter during texture loading but may impact frame consistency. 设置每帧处理的纹理数据最大量(单位:MiB)。 较高的数值可以减少纹理加载时的卡顿,但可能会影响帧率的稳定性(即造成帧时间波动)。 - + GPU Unswizzle Chunk Size GPU 还原块大小 - + Determines the number of depth slices processed in a single dispatch. Increasing this can improve throughput on high-end GPUs but may cause TDR or driver timeouts on weaker hardware. 确定在单次调度(Dispatch)中处理的深度切片(Depth Slices)数量。 增加此数值可以提高高端 GPU 的吞吐量(处理效率),但在性能较弱的硬件上可能会引发 TDR(驱动程序重置)或驱动超时。 - + Use Vulkan pipeline cache 启用 Vulkan 管线缓存 - + Enables GPU vendor-specific pipeline cache. This option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally. 启用 GPU 供应商专用的管线缓存。 在 Vulkan 驱动程序内部不存储管线缓存的情况下,此选项可显著提高着色器加载速度。 - + Enable Compute Pipelines (Intel Vulkan Only) 启用计算管线 (仅限 Intel 显卡 Vulkan 模式) - + Required by some games. This setting only exists for Intel proprietary drivers and may crash if enabled. Compute pipelines are always enabled on all other drivers. @@ -932,193 +952,181 @@ Compute pipelines are always enabled on all other drivers. 在所有其他驱动程序上始终启用计算管线。 - + Enable Reactive Flushing 启用反应性刷新 - + Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing. 使用反应性刷新取代预测性刷新,从而更精确地同步内存。 - + Sync to framerate of video playback 播放视频时帧率同步 - + Run the game at normal speed during video playback, even when the framerate is unlocked. 在视频播放期间以正常速度运行游戏,即使帧率未锁定。 - + Barrier feedback loops 屏障反馈环路 - + Improves rendering of transparency effects in specific games. 改进某些游戏中透明效果的渲染。 - + Enable buffer history 启用缓冲区历史 - + Enables access to previous buffer states. This option may improve rendering quality and performance consistency in some games. 允许访问之前的缓冲状态。 这个选项可能会提升某些游戏的渲染质量和性能一致性。 - + Fix bloom effects 修复泛光效果 - + Removes bloom in Burnout. 去除《火爆狂飙》中的泛光特效。 - - Enable Legacy Rescale Pass - 启用旧版缩放 - - - - May fix rescale issues in some games by relying on behavior from the previous implementation. -Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and grey texture flicker on Nvidia GPUs in Luigis Mansion 3. - 通过依赖之前实现的行为,可能会修复部分游戏的缩放重叠问题。 -修复 AMD 和 Intel 显卡上的线条伪影,以及《路易斯洋楼3》中 Nvidia 显卡的灰色纹理闪烁的遗留行为变通方法。 - - - + Extended Dynamic State 扩展动态状态 - + Controls the number of features that can be used in Extended Dynamic State. Higher states allow for more features and can increase performance, but may cause additional graphical issues. 控制在扩展动态状态中可使用的函数数量。更高的数值允许启用更多功能,并可能提升性能,但同时也可能导致额外的图形问题。 - + Vertex Input Dynamic State 顶点输入动态状态 - + Enables vertex input dynamic state feature for better quality and performance. 开启顶点输入动态状态功能来获得更好的质量和性能。 - + Sample Shading 采样着色 - + Allows the fragment shader to execute per sample in a multi-sampled fragment instead of once per fragment. Improves graphics quality at the cost of performance. Higher values improve quality but degrade performance. 允许片段着色器在多重采样的片段中每个样本执行一次而不是每个片段执行一次。可以提高图形质量,但会降低性能。 更高的值可以提高质量但会降低性能。 - + RNG Seed 随机数生成器种子 - + Controls the seed of the random number generator. Mainly used for speedrunning. 控制随机数生成器的种子。 主要用于竞速游戏。 - + Device Name 设备名称 - + The name of the console. 主机的数量。 - + Homebrew Args 自制软件参数 - + Command-line arguments passed to homebrew at launch (e.g. -noglsl). 启动 homebrew 时需要传递的命令行参数 (例如 -noglsl)。 - + Custom RTC Date: 自定义系统时间: - + This option allows to change the clock of the console. Can be used to manipulate time in games. 此选项允许更改控制台的时钟。 可用于操纵游戏中的时间。 - + The number of seconds from the current unix time 来自当前 unix 时间的秒数。 - + Language: 语言: - + This option can be overridden when region setting is auto-select 当区域设置为自动选择时可以使用此选项替代。 - + Region: 地区: - + The region of the console. 主机的区域。 - + Time Zone: 时区: - + The time zone of the console. 主机的时区。 - + Sound Output Mode: 声音输出模式: - + Console Mode: 控制台模式: - + Selects if the console is in Docked or Handheld mode. Games will change their resolution, details and supported controllers and depending on this setting. Setting to Handheld can help improve performance for low end systems. @@ -1127,1026 +1135,1026 @@ Setting to Handheld can help improve performance for low end systems. 将设置为掌机模式可以帮助低端系统提高性能。 - + Prompt for user profile on boot 启动时提示选择用户账户 - + Useful if multiple people use the same PC. 在多人使用相同的 PC 时有效。 - + Pause when not in focus 在丢失焦点时暂停 - + Pauses emulation when focusing on other windows. 当焦点位于其它窗口时暂停模拟器。 - + Confirm before stopping emulation 停止模拟时需要确认 - + Overrides prompts asking to confirm stopping the emulation. Enabling it bypasses such prompts and directly exits the emulation. 替代提示以确认停止模拟。 启用它将绕过此类提示并直接退出模拟。 - + Hide mouse on inactivity 自动隐藏鼠标光标 - + Hides the mouse after 2.5s of inactivity. 在 2.5 秒无活动后隐藏鼠标。 - + Check for updates 检查更新 - + Whether or not to check for updates upon startup. 在启动时是否检查更新。 - + Enable Gamemode 启用游戏模式 - + Force X11 as Graphics Backend 强制使用 X11 作为图形后端 - + Custom frontend 自定义前端 - + Real applet 真实的小程序 - - + + Disabled 禁用 - + Never 永不 - + On Load 加载时 - + Always 总是 - + CPU CPU - + GPU GPU - + CPU Asynchronous CPU 异步模拟 - + Uncompressed (Best quality) 不压缩 (最高质量) - + BC1 (Low quality) BC1 (低质量) - + BC3 (Medium quality) BC3 (中等质量) - - + + Auto 自动 - + 30 FPS 30 FPS - + 60 FPS 60 FPS - + 90 FPS 90 FPS - + 120 FPS 120 FPS - + Conservative 保守模式 - + Aggressive 激进模式 - + Vulkan Vulkan - + OpenGL GLSL OpenGL GLSL - + OpenGL GLASM (Assembly Shaders, NVIDIA Only) OpenGL GLASM (汇编着色器,仅限 NVIDIA 显卡) - + OpenGL SPIR-V (Experimental, AMD/Mesa Only) OpenGL SPIR-V (实验性,仅限 AMD/Mesa) - + Null 无 - + Fast 高速 - - - + + + Accurate 高精度 - - - + + + Default 系统默认 - + Unsafe (fast) 不安全(快速) - + Safe (stable) 安全(稳定) - + Immediate 即时 - + Balanced 平衡 - + Unsafe 低精度 - + Paranoid (disables most optimizations) 偏执模式 (禁用绝大多数优化项) - + Debugging 调试 - + Dynarmic 动态编译 - + NCE 本机代码执行 - + Borderless Windowed 无边框窗口 - + Exclusive Fullscreen 独占全屏 - + No Video Output 无视频输出 - + CPU Video Decoding CPU 视频解码 - + GPU Video Decoding (Default) GPU 视频解码 (默认) - + 0.25X (180p/270p) [EXPERIMENTAL] 0.25X (180p/270p) [实验性] - + 0.5X (360p/540p) [EXPERIMENTAL] 0.5X (360p/540p) [实验性] - + 0.75X (540p/810p) [EXPERIMENTAL] 0.75X (540p/810p) [实验性] - + 1X (720p/1080p) 1X (720p/1080p) - + 1.25X (900p/1350p) [EXPERIMENTAL] 1.25X (900p/1350p) [实验性] - + 1.5X (1080p/1620p) [EXPERIMENTAL] 1.5X (1080p/1620p) [实验性] - + 2X (1440p/2160p) 2X (1440p/2160p) - + 3X (2160p/3240p) 3X (2160p/3240p) - + 4X (2880p/4320p) 4X (2880p/4320p) - + 5X (3600p/5400p) 5X (3600p/5400p) - + 6X (4320p/6480p) 6X (4320p/6480p) - + 7X (5040p/7560p) 7X (5040p/7560p) - + 8X (5760p/8640p) 8X (5760p/8640p) - + Nearest Neighbor 近邻取样 - + Bilinear 双线性过滤 - + Bicubic 双三线过滤 - + Gaussian 高斯模糊 - + Lanczos Lanczos - + ScaleForce 强制缩放 - + AMD FidelityFX Super Resolution AMD FidelityFX 超级分辨率 - + Area 区域 - + MMPX MMPX - + Zero-Tangent 零切线 - + B-Spline B-Spline - + Mitchell Mitchell - + Spline-1 Spline-1 - + Snapdragon Game Super Resolution 骁龙游戏超级分辨率 - + Snapdragon Game Super Resolution EdgeDir 骁龙游戏超级分辨率 EdgeDir - + None 无 - + FXAA 快速近似抗锯齿 - + SMAA 子像素形态学抗锯齿 - + Default (16:9) 默认 (16:9) - + Force 4:3 强制 4:3 - + Force 21:9 强制 21:9 - + Force 16:10 强制 16:10 - + Stretch to Window 拉伸窗口 - + Automatic 自动 - + 2x 2x - + 4x 4x - + 8x 8x - + 16x 16x - + Japanese (日本語) 日语 (日本語) - + American English 美式英语 - + French (français) 法语 (français) - + German (Deutsch) 德语 (Deutsch) - + Italian (italiano) 意大利语 (italiano) - + Spanish (español) 西班牙语 (español) - + Chinese 中文 - + Korean (한국어) 韩语 (한국어) - + Dutch (Nederlands) 荷兰语 (Nederlands) - + Portuguese (português) 葡萄牙语 (português) - + Russian (Русский) 俄语 (Русский) - + Taiwanese 台湾中文 - + British English 英式英语 - + Canadian French 加拿大法语 - + Latin American Spanish 拉美西班牙语 - + Simplified Chinese 简体中文 - + Traditional Chinese (正體中文) 繁体中文 (正體中文) - + Brazilian Portuguese (português do Brasil) 巴西-葡萄牙语 (português do Brasil) - + Polish (polska) 波兰语(波兰语) - + Thai (แบบไทย) 泰语 - - + + Japan 日本 - + USA 美国 - + Europe 欧洲 - + Australia 澳大利亚 - + China 中国 - + Korea 韩国 - + Taiwan 台湾地区 - + Auto (%1) Auto select time zone 自动 (%1) - + Default (%1) Default time zone 默认 (%1) - + CET 欧洲中部时间 - + CST6CDT 古巴标准时间&古巴夏令时 - + Cuba 古巴 - + EET 东欧时间 - + Egypt 埃及 - + Eire 爱尔兰 - + EST 东部标准时间 - + EST5EDT 东部标准时间&东部夏令时 - + GB 英国 - + GB-Eire 英国-爱尔兰时间 - + GMT GMT - + GMT+0 GMT+0 - + GMT-0 GMT-0 - + GMT0 GMT0 - + Greenwich 格林威治 - + Hongkong 香港 - + HST 美国夏威夷时间 - + Iceland 冰岛 - + Iran 伊朗 - + Israel 以色列 - + Jamaica 牙买加 - + Kwajalein 夸贾林环礁 - + Libya 利比亚 - + MET 中欧时间 - + MST 山区标准时间 (北美) - + MST7MDT 山区标准时间&山区夏令时 (北美) - + Navajo 纳瓦霍 - + NZ 新西兰时间 - + NZ-CHAT NZ-CHAT - + Poland 波兰 - + Portugal 葡萄牙 - + PRC 中国标准时间 - + PST8PDT 太平洋标准时间&太平洋夏令时 - + ROC 台湾时间 - + ROK 韩国时间 - + Singapore 新加坡 - + Turkey 土耳其 - + UCT UCT - + Universal 世界时间 - + UTC 协调世界时 - + W-SU 欧洲-莫斯科时间 - + WET 西欧时间 - + Zulu 祖鲁 - + Mono 单声道 - + Stereo 立体声 - + Surround 环绕声 - + 4GB DRAM (Default) 4GB DRAM (默认) - + 6GB DRAM (Unsafe) 6GB DRAM (不安全) - + 8GB DRAM 8GB DRAM - + 10GB DRAM (Unsafe) 10GB DRAM (不安全) - + 12GB DRAM (Unsafe) 12GB DRAM (不安全) - + Docked 主机模式 - + Handheld 掌机模式 - - + + Normal 正常 - - + + Boost 升频 - - + + Overclock 超频 - + Always ask (Default) 总是询问 (默认) - + Only if game specifies not to stop 仅当游戏不希望停止时 - + Never ask 从不询问 - + Very Small (16 MB) 很小 (16 MB) - + Small (32 MB) 较小 (32 MB) - + Normal (128 MB) 正常 (128 MB) - + Large (256 MB) 较大 (256 MB) - + Very Large (512 MB) 很大 (512 MB) - + Very Low (4 MB) 很低 (4 MB) - + Low (8 MB) 低 (8 MB) - + Normal (16 MB) 正常 (16 MB) - + Medium (32 MB) 中 (32 MB) - + High (64 MB) 高 (64 MB) - + Very Low (32) 很低 (32) - + Low (64) 低 (64) - + Normal (128) 正常 (128) - + Medium (256) 中(256) - + High (512) 高(512) - + ExtendedDynamicState 1 扩展动态状态 1 - + ExtendedDynamicState 2 扩展动态状态 2 - + ExtendedDynamicState 3 扩展动态状态 3 - + Tree View 树景视图 - + Grid View 网格视图 diff --git a/dist/languages/zh_TW.ts b/dist/languages/zh_TW.ts index 499262847d..463d7fa2ed 100644 --- a/dist/languages/zh_TW.ts +++ b/dist/languages/zh_TW.ts @@ -722,12 +722,32 @@ Aggressive mode may impact performance of other applications such as recording s - + + GPU Readback Before NCE Invalidation + + + + + Flushes GPU buffer data back to guest memory before NCE invalidates the whole guest page, preserving it while the CPU store proceeds. + + + + + Patch Runtime NROs for NCE + + + + + Applies NCE code patches to runtime-loaded NRO modules.This is required for some games to run correctly. + + + + VSync Mode: 垂直同步: - + FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh rate. FIFO Relaxed allows tearing as it recovers from a slow down. Mailbox can have lower latency than FIFO and does not tear but may drop frames. @@ -735,79 +755,79 @@ Immediate (no synchronization) presents whatever is available and can exhibit te - + Sync Memory Operations 同步記憶體操作 - + Ensures data consistency between compute and memory operations. This option fixes issues in games, but may degrade performance. Unreal Engine 4 games often see the most significant changes thereof. - + Enable asynchronous presentation (Vulkan only) 啟用非同步顯示(僅限Vulkan) - + Slightly improves performance by moving presentation to a separate CPU thread. 透過將畫面顯示移至獨立的CPU執行緒來略微提升性能。 - + Force maximum clocks (Vulkan only) 強制使用最大時脈(僅限Vulkan) - + Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed. 在等待圖形命令時於背景執行任務以防GPU降低時脈 - + Anisotropic Filtering: 各向異性過濾: - + Controls the quality of texture rendering at oblique angles. Safe to set at 16x on most GPUs. - + GPU Mode: - + Controls the GPU emulation mode. Most games render fine with Fast, but Accurate is still required for some. Particles tend to only render correctly with Accurate mode. - + DMA Accuracy: - + Controls the DMA read mode. Unsafe is faster, while Safe is more stable and can fix issues in some games. Default follows the GPU Accuracy setting. - + GPU Fence Behavior: - + Controls the GPU fence synchronization behavior. Immediate is the fastest option, but can introduce some issues. Balanced offers better compatibility and may fix issues in some games. @@ -816,1302 +836,1291 @@ Default follows the GPU Mode setting. - + Enable asynchronous shader compilation - + May reduce shader stutter. - + GPU Clocks - + Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch's clocks. - + GPU Unswizzle - + Accelerates BCn 3D texture decoding using GPU compute. Disable if experiencing crashes or graphical glitches. - + GPU Unswizzle Max Texture Size - + Sets the maximum size (MiB) for GPU-based texture unswizzling. While the GPU is faster for medium and large textures, the CPU may be more efficient for very small ones. Adjust this to find the balance between GPU acceleration and CPU overhead. - + GPU Unswizzle Stream Size - + Sets the maximum amount of texture data (in MiB) processed per frame. Higher values can reduce stutter during texture loading but may impact frame consistency. - + GPU Unswizzle Chunk Size - + Determines the number of depth slices processed in a single dispatch. Increasing this can improve throughput on high-end GPUs but may cause TDR or driver timeouts on weaker hardware. - + Use Vulkan pipeline cache 启用 Vulkan 管线缓存 - + Enables GPU vendor-specific pipeline cache. This option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally. 启用 GPU 供应商专用的管线缓存。 在 Vulkan 驱动程序内部不存储管线缓存的情况下,此选项可显著提高着色器加载速度。 - + Enable Compute Pipelines (Intel Vulkan Only) 启用计算管线 (仅限 Intel 显卡 Vulkan 模式) - + Required by some games. This setting only exists for Intel proprietary drivers and may crash if enabled. Compute pipelines are always enabled on all other drivers. - + Enable Reactive Flushing 启用反应性刷新 - + Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing. 使用反应性刷新取代预测性刷新,从而更精确地同步内存。 - + Sync to framerate of video playback 播放视频时帧率同步 - + Run the game at normal speed during video playback, even when the framerate is unlocked. 在视频播放期间以正常速度运行游戏,即使帧率未锁定。 - + Barrier feedback loops 屏障反馈循环 - + Improves rendering of transparency effects in specific games. 改进某些游戏中透明效果的渲染。 - + Enable buffer history - + Enables access to previous buffer states. This option may improve rendering quality and performance consistency in some games. - + Fix bloom effects - + Removes bloom in Burnout. - - Enable Legacy Rescale Pass - - - - - May fix rescale issues in some games by relying on behavior from the previous implementation. -Legacy behavior workaround that fixes line artifacts on AMD and Intel GPUs, and grey texture flicker on Nvidia GPUs in Luigis Mansion 3. - - - - + Extended Dynamic State - + Controls the number of features that can be used in Extended Dynamic State. Higher states allow for more features and can increase performance, but may cause additional graphical issues. - + Vertex Input Dynamic State - + Enables vertex input dynamic state feature for better quality and performance. - + Sample Shading - + Allows the fragment shader to execute per sample in a multi-sampled fragment instead of once per fragment. Improves graphics quality at the cost of performance. Higher values improve quality but degrade performance. - + RNG Seed 隨機種子 - + Controls the seed of the random number generator. Mainly used for speedrunning. - + Device Name 裝置名稱 - + The name of the console. - + Homebrew Args - + Command-line arguments passed to homebrew at launch (e.g. -noglsl). - + Custom RTC Date: 自定义系统时间: - + This option allows to change the clock of the console. Can be used to manipulate time in games. - + The number of seconds from the current unix time - + Language: 语言: - + This option can be overridden when region setting is auto-select - + Region: 區域: - + The region of the console. - + Time Zone: 時區: - + The time zone of the console. - + Sound Output Mode: 音訊輸出模式: - + Console Mode: 控制台模式: - + Selects if the console is in Docked or Handheld mode. Games will change their resolution, details and supported controllers and depending on this setting. Setting to Handheld can help improve performance for low end systems. - + Prompt for user profile on boot - + Useful if multiple people use the same PC. - + Pause when not in focus - + Pauses emulation when focusing on other windows. - + Confirm before stopping emulation 停止模拟时需要确认 - + Overrides prompts asking to confirm stopping the emulation. Enabling it bypasses such prompts and directly exits the emulation. - + Hide mouse on inactivity 滑鼠閒置時自動隱藏 - + Hides the mouse after 2.5s of inactivity. - + Check for updates - + Whether or not to check for updates upon startup. - + Enable Gamemode 启用游戏模式 - + Force X11 as Graphics Backend - + Custom frontend 自定义前端 - + Real applet 真实的小程序 - - + + Disabled - + Never - + On Load - + Always - + CPU CPU - + GPU GPU - + CPU Asynchronous CPU 异步模拟 - + Uncompressed (Best quality) 不壓縮 (最高品質) - + BC1 (Low quality) BC1 (低品質) - + BC3 (Medium quality) BC3 (中品質) - - + + Auto 自動 - + 30 FPS - + 60 FPS - + 90 FPS - + 120 FPS - + Conservative 保守模式(节省 VRAM) - + Aggressive 激进模式 - + Vulkan Vulkan - + OpenGL GLSL - + OpenGL GLASM (Assembly Shaders, NVIDIA Only) - + OpenGL SPIR-V (Experimental, AMD/Mesa Only) - + Null 無 - + Fast - - - + + + Accurate 高精度 - - - + + + Default 預設 - + Unsafe (fast) - + Safe (stable) - + Immediate - + Balanced - + Unsafe 低精度 - + Paranoid (disables most optimizations) 偏执模式 (禁用绝大多数优化项) - + Debugging - + Dynarmic Dynarmic - + NCE NCE - + Borderless Windowed 無邊框視窗 - + Exclusive Fullscreen 全螢幕獨占 - + No Video Output 無視訊輸出 - + CPU Video Decoding CPU 視訊解碼 - + GPU Video Decoding (Default) GPU 視訊解碼(預設) - + 0.25X (180p/270p) [EXPERIMENTAL] - + 0.5X (360p/540p) [EXPERIMENTAL] 0.5X (360p/540p) [实验性] - + 0.75X (540p/810p) [EXPERIMENTAL] 0.75X (540p/810p) [實驗性] - + 1X (720p/1080p) 1X (720p/1080p) - + 1.25X (900p/1350p) [EXPERIMENTAL] - + 1.5X (1080p/1620p) [EXPERIMENTAL] 1.5X (1080p/1620p) [實驗性] - + 2X (1440p/2160p) 2X (1440p/2160p) - + 3X (2160p/3240p) 3X (2160p/3240p) - + 4X (2880p/4320p) 4X (2880p/4320p) - + 5X (3600p/5400p) 5X (3600p/5400p) - + 6X (4320p/6480p) 6X (4320p/6480p) - + 7X (5040p/7560p) 7X (5040p/7560p) - + 8X (5760p/8640p) 8X (5760p/8640p) - + Nearest Neighbor 最近鄰 - + Bilinear 雙線性 - + Bicubic 雙立方 - + Gaussian 高斯 - + Lanczos - + ScaleForce 強制縮放 - + AMD FidelityFX Super Resolution - + Area - + MMPX - + Zero-Tangent - + B-Spline - + Mitchell - + Spline-1 - + Snapdragon Game Super Resolution - + Snapdragon Game Super Resolution EdgeDir - + None 無 - + FXAA FXAA - + SMAA SMAA - + Default (16:9) 預設 (16:9) - + Force 4:3 強制 4:3 - + Force 21:9 強制 21:9 - + Force 16:10 強制 16:10 - + Stretch to Window 延伸視窗 - + Automatic 自動 - + 2x 2x - + 4x 4x - + 8x 8x - + 16x 16x - + Japanese (日本語) 日文 (日本語) - + American English 美式英语 - + French (français) 法文 (français) - + German (Deutsch) 德文 (Deutsch) - + Italian (italiano) 義大利文 (italiano) - + Spanish (español) 西班牙文 (español) - + Chinese 中文 - + Korean (한국어) 韓文 (한국어) - + Dutch (Nederlands) 荷蘭文 (Nederlands) - + Portuguese (português) 葡萄牙文 (português) - + Russian (Русский) 俄文 (Русский) - + Taiwanese 台灣中文 - + British English 英式英文 - + Canadian French 加拿大法文 - + Latin American Spanish 拉丁美洲西班牙文 - + Simplified Chinese 簡體中文 - + Traditional Chinese (正體中文) 正體中文 (正體中文) - + Brazilian Portuguese (português do Brasil) 巴西-葡萄牙語 (português do Brasil) - + Polish (polska) - + Thai (แบบไทย) - - + + Japan 日本 - + USA 美國 - + Europe 歐洲 - + Australia 澳洲 - + China 中國 - + Korea 南韓 - + Taiwan 台灣 - + Auto (%1) Auto select time zone 自動 (%1) - + Default (%1) Default time zone 預設 (%1) - + CET 中歐 - + CST6CDT CST6CDT - + Cuba 古巴 - + EET EET - + Egypt 埃及 - + Eire 愛爾蘭 - + EST 北美東部 - + EST5EDT EST5EDT - + GB GB - + GB-Eire 英國-愛爾蘭 - + GMT GMT - + GMT+0 GMT+0 - + GMT-0 GMT-0 - + GMT0 GMT0 - + Greenwich 格林威治 - + Hongkong 香港 - + HST 夏威夷 - + Iceland 冰島 - + Iran 伊朗 - + Israel 以色列 - + Jamaica 牙買加 - + Kwajalein 瓜加林環礁 - + Libya 利比亞 - + MET 中歐 - + MST 北美山區 - + MST7MDT MST7MDT - + Navajo 納瓦霍 - + NZ 紐西蘭 - + NZ-CHAT 紐西蘭-查塔姆群島 - + Poland 波蘭 - + Portugal 葡萄牙 - + PRC 中國 - + PST8PDT 太平洋 - + ROC 臺灣 - + ROK 韓國 - + Singapore 新加坡 - + Turkey 土耳其 - + UCT UCT - + Universal 世界 - + UTC UTC - + W-SU 莫斯科 - + WET 西歐 - + Zulu 協調世界時 - + Mono 單聲道 - + Stereo 立體聲 - + Surround 環繞音效 - + 4GB DRAM (Default) 4GB DRAM (默认) - + 6GB DRAM (Unsafe) 6GB DRAM (不安全) - + 8GB DRAM - + 10GB DRAM (Unsafe) - + 12GB DRAM (Unsafe) - + Docked TV - + Handheld 掌機模式 - - + + Normal - - + + Boost - - + + Overclock - + Always ask (Default) 总是询问 (默认) - + Only if game specifies not to stop 仅当游戏不希望停止时 - + Never ask 从不询问 - + Very Small (16 MB) - + Small (32 MB) - + Normal (128 MB) - + Large (256 MB) - + Very Large (512 MB) - + Very Low (4 MB) - + Low (8 MB) - + Normal (16 MB) - + Medium (32 MB) - + High (64 MB) - + Very Low (32) - + Low (64) - + Normal (128) - + Medium (256) - + High (512) - + ExtendedDynamicState 1 - + ExtendedDynamicState 2 - + ExtendedDynamicState 3 - + Tree View - + Grid View diff --git a/src/android/app/src/main/res/values-ar/strings.xml b/src/android/app/src/main/res/values-ar/strings.xml index 5669aab8ba..09722b486e 100644 --- a/src/android/app/src/main/res/values-ar/strings.xml +++ b/src/android/app/src/main/res/values-ar/strings.xml @@ -254,7 +254,7 @@ إعداد بيانات المحاكي يلزم وجود مفاتيح حتى يعمل المحاكي، ويوصى باستخدام الفيرموير ويكون ضروريًا لاستخدام تطبيق القائمة الرئيسية. منح الأذونات - منح أذونات اختيارية لاستخدام ميزات معينة للمحاكي + منح أذونات اختيارية لاستخدام ميزات محددة في المحاكي العديد من الألعاب تتطلب الوصول إلى الفيرموير لتشغيل بشكل صحيح. https://yuzu-mirror.github.io/help/quickstart/#guide-introduction الإشعارات @@ -587,6 +587,10 @@ يجعل اللعبة تعتقد أن عمل وحدة معالجة الرسومات ينتهي بشكل أسرع مما هو عليه في الواقع، لذلك تتوقف عن خفض الدقة ومسافة العرض لتتناسب مع سرعات جهاز Switch. تخطي إبطال صلاحية وحدة المعالجة المركزية الداخلية يتخطى بعض عمليات إبطال ذاكرة التخزين المؤقتة من جانب وحدة المعالجة المركزية أثناء تحديثات الذاكرة، مما يقلل من استخدام وحدة المعالجة المركزية ويحسن أداءها. قد يتسبب ذلك في حدوث أعطال أو تعطل في بعض الألعاب. + إعادة قراءة وحدة معالجة الرسومات قبل إبطال صلاحية NCE + إصلاح مؤقت. يعالج مشكلة تعطل لعبة Ender Magnolia (وغيرها من ألعاب UE). قد يؤدي إلى انخفاض في الأداء. يجري العمل على تحسينه. + تصحيح حالات NRO في وقت التشغيل لـ NCE + حل مؤقت. إصلاح مشكلة تشغيل لعبة Biomutant. قد يؤثر ذلك على الأداء. يجري العمل على تحسينه. إصلاح تأثيرات التوهج يقلل من ضبابية التوهج في LA/EOW (Adreno A6XX - A7XX/ Turnip)، ويزيل التوهج في Burnout. تحذير: قد يسبب تشوهات رسومية في ألعاب أخرى. محاكاة BGR565 diff --git a/src/android/app/src/main/res/values-zh-rTW/strings.xml b/src/android/app/src/main/res/values-zh-rTW/strings.xml index 9a30acd3ac..3f3272daf4 100644 --- a/src/android/app/src/main/res/values-zh-rTW/strings.xml +++ b/src/android/app/src/main/res/values-zh-rTW/strings.xml @@ -1,12 +1,12 @@ - 本軟體可執行Nintendo Switch主機的遊戲,軟體不提供遊戲和金鑰檔案。

在開始之前,請先安裝您的 prod.keys ]]> 檔案,了解更多]]>
+ 本軟體可執行 Nintendo Switch 主機的遊戲,軟體不提供遊戲和金鑰檔案。

在開始之前,請先安裝您的 prod.keys ]]> 檔案,了解更多]]>
通知和錯誤 發生錯誤時顯示通知 未授予通知權限! - Eden模擬器通知 - Eden正在執行 + Eden 模擬器通知 + Eden 正在執行 秒 @@ -32,7 +32,7 @@ 使用控制器時自動隱藏虛擬按鍵 在使用控制器時自動隱藏畫面上的虛擬按鍵,會在控制器斷開連接後重新出現 反轉手把的 確認/返回 按鈕 - 使用Eden時將手把的確認及返回鍵反轉以符合Switch與Xbox的操作方式 + 使用 Eden 時將手把的確認及返回鍵反轉以符合 Switch 與 Xbox 的操作方式 虛擬按鍵設定 調整虛擬按鍵的位置與顯示設定 @@ -54,7 +54,7 @@ 啟用效能統計疊加層 設定疊加層中顯示的資訊 顯示影格率 - 顯示當前影格率 + 顯示目前的影格率 顯示影格時間 顯示應用程式的記憶體用量 顯示模擬器的記憶體用量 @@ -67,7 +67,7 @@ 當著色器在編譯時顯示 顯示正在編譯的著色器數量 管線工作執行緒 - 設定用於建置Vulkan管線的CPU核心數量,設定的數值越大效能越好,但溫度也會上升更快 + 設定用於建置 Vulkan 管線的 CPU 核心數量,設定的數值越大效能越好,但溫度也會上升更快 疊加層位置 選擇疊加層在畫面上的顯示位置 左上 @@ -85,11 +85,11 @@ 裝置疊加層 設定裝置疊加層中顯示的資訊 - 顯示Eden的組建版本 + 顯示 Eden 的組建版本 顯示圖形驅動程式的版本 顯示裝置型號 - 顯示GPU型號 - 顯示CPU型號 + 顯示 GPU 型號 + 顯示 CPU 型號 顯示韌體版本 @@ -98,15 +98,15 @@ 同步核心速度 將核心速度與最大速度百分比同步,在不改變遊戲實際速度的情況下提高效能 - 啟用主機MMU模擬 - 此最佳化可加速客體程式的記憶體存取。啟用後,客體記憶體讀取/寫入將直接在記憶體中執行並利用主機的MMU。停用此功能將強制所有記憶體存取使用軟體MMU模擬 + 啟用主機 MMU 模擬 + 此最佳化可加速客體程式的記憶體存取。啟用後,客體記憶體讀取/寫入將直接在記憶體中執行並利用主機的 MMU。停用此功能將強制所有記憶體存取使用軟體 MMU 模擬 偵錯開關 僅限開發用途 - 0到65535 + 0 到 65535 - NVDEC模擬 - 若在過場動畫中當機請切換成CPU + NVDEC 模擬 + 若在過場動畫中當機請切換成 CPU 無 @@ -121,7 +121,7 @@ 加入 瀏覽公開房間 使用者名稱 - IP位址 + IP 位址 埠 房間建立成功 成功加入房間 @@ -129,8 +129,8 @@ 網路錯誤 連線中斷 使用者名稱已被其他人使用 - MAC位址衝突 - 主機ID衝突 + MAC 位址衝突 + 主機 ID 衝突 版本不符 密碼錯誤 無法連接 @@ -143,7 +143,7 @@ 您已被房主踢出 未知錯誤 房間未初始化 - 房間閒置 + 房間閒置中 正在加入房間 已加入房間 房間管理員 @@ -151,7 +151,7 @@ %1$s 離開 %1$s 被踢出 %1$s 被封鎖 - IP位址已解封 + IP 位址已解封 踢出成員 密碼 正在加入… @@ -184,14 +184,14 @@ 搜尋房間… 遊戲 大廳類型 - 長度需為3-20個字元 - 必填 - 需要Web令牌,請前往進階設定 -> 系統 -> 網路 - IP格式無效 - 必須介於4-20個字元之間,並且僅能使用英文字母、數字、句點、破折號、底線和空格(標點符號須為英文格式) + 長度需為 3-20 個字元 + 請填寫這個欄位 + 需要 Web 令牌,請前往進階設定 -> 系統 -> 網路 + IP 格式無效 + 必須介於 4-20 個字元之間,並且僅能使用英文字母、數字、句點、破折號、底線和空格(標點符號須為英文格式) 使用者名稱無效,請在系統 -> 網路中檢查設定 - 必須為48個字元,且僅包含小寫字母a-z - 埠號需為1-65535 + 必須為 48 個字元,且僅包含小寫字母 a-z + 埠號需為 1-65535 取消 確定 重新整理 @@ -228,7 +228,7 @@ 不再顯示 遊戲目錄新增成功 檢查更新 - 在Eden啟動時檢查有無新版本並選擇是否要下載與安裝更新 + 在 Eden 啟動時檢查有無新版本並選擇是否要下載與安裝更新 發現新版本 有更新可供安裝:%1$s\n\n您要進行更新嗎? 下載更新中 @@ -252,7 +252,7 @@ https://yuzu-mirror.github.io/help/quickstart/#guide-introduction 跳過安裝韌體? 設定模擬器資料 - 模擬器需要金鑰才能正常執行,同時建議安裝韌體以啟動QLaunch小程式 + 模擬器需要金鑰才能正常執行,同時建議安裝韌體以啟動 QLaunch 小程式 授予權限 授予權限以使用模擬器的特定功能 許多遊戲需要韌體才能正常運作 @@ -273,10 +273,10 @@ 版本號碼 基本資訊 硬體 - 支援的ABI - CPU資訊 - GPU資訊 - Vulkan驅動程式版本 + 支援的 ABI + CPU 資訊 + GPU 資訊 + Vulkan 驅動程式版本 取得裝置資訊失敗 記憶體資訊 記憶體大小 @@ -287,9 +287,9 @@ 跳過 取消 安裝 Amiibo 金鑰 - 需要先安裝才能在遊戲中使用Amiibo - GPU驅動程式下載器 - GPU驅動程式管理員 + 需要先安裝才能在遊戲中使用 Amiibo + GPU 驅動程式下載器 + GPU 驅動程式管理員 安裝替代驅動程式以取得潛在的更佳效能或準確度 後製處理效果 在渲染完成後套用 ReShade FX 效果 @@ -330,84 +330,84 @@ 自動 開啟或關閉影格生成後選擇影格倍率 選擇要生成的目標影格率,倍率器會自動調整 - 用來預測影格之間動態的解析度,較低的數值可以減少GPU運算時間 + 用來預測影格之間動態的解析度,較低的數值可以減少 GPU 運算時間 影格佇列目標 最多允許多少個已完成的影格在顯示器前等待,較大的佇列可以吸收 GPU 突發負載,但會增加輸入延遲 最低延遲(無緩衝) - 平衡(1影格) - 最流暢(2影格) + 平衡(1 影格) + 最流暢(2 影格) 配合遊戲調整運動預測 以遊戲實際渲染的解析度而非升頻後的輸出進行運動預測,由於升頻後不會增加任何動態細節,因此不會影響準確度 運動預測解析度 光流處理的解析度,以輸出解析度的比例表示,降低此設定值是減少效能負載最有效的方法 無法使用影格生成 - 此GPU驅動程式缺少Lossless Scaling著色器所需的Vulkan記憶體模型或半精度浮點數(float16)支援 + 此 GPU 驅動程式缺少 Lossless Scaling 著色器所需的 Vulkan 記憶體模型或半精度浮點數(float16)支援 可選擇安裝自己擁有的 Lossless.dll 以在之後啟用影格生成功能 安裝 Lossless.dll 您需要擁有從合法管道獲得的 Lossless Scaling 並從該軟體的資料夾中取得 Lossless.dll 檔案才能使用影格生成功能 安裝不同的 Lossless.dll 檔案 影格生成 支援 - 不支援(無Vulkan記憶體模型或float16) + 不支援(無 Vulkan 記憶體模型或 float16) Lossless Scaling - 安裝您擁有的Lossless.dll檔案以使用影格生成 + 安裝您擁有的 Lossless.dll 檔案以使用影格生成 已安裝 未安裝 更換 刪除 - 刪除已安裝的Lossless.dll及預先編譯的著色器 - 影格生成功能會停止運作直到您重新安裝Lossless.dll,您的Lossless.dll原始檔不會被 Eden 修改 + 刪除已安裝的 Lossless.dll 及預先編譯的著色器 + 影格生成功能會停止運作直到您重新安裝Lossless.dll,您的 Lossless.dll原始檔不會被 Eden 修改 Lossless.dll 未安裝 前往 設定 -> Lossless Scaling 安裝以使用影格生成功能 請先關閉遊戲 - Lossless.dll無法在遊戲執行時進行更換 + Lossless.dll 無法在遊戲執行時進行更換 沒有東西可以刪除 - 尚未安裝Lossless.dll + 尚未安裝 Lossless.dll 準備影格生成著色器中... - 成功安裝Lossless.dll - 無法安裝Lossless.dll + 成功安裝 Lossless.dll + 無法安裝 Lossless.dll 無法複製選取的檔案 無法讀取選取的檔案 - 選取的檔案並不是Windows程式庫。請在Lossless Scaling的安裝位置(資料夾)中選擇Lossless.dll - 這個Lossless.dll的副本並未包含影格生成著色器。請更新Lossless Scaling後重試 - 無法轉譯影格生成著色器,尚不支援此Lossless Scaling版本 + 選取的檔案並不是 Windows 程式庫。請在 Lossless Scaling 的安裝位置(資料夾)中選擇 Lossless.dll + 這個 Lossless.dll 的副本並未包含影格生成著色器。請更新 Lossless Scaling 後重試 + 無法轉譯影格生成著色器,尚不支援此 Lossless Scaling 版本 轉譯的著色器無法寫入到儲存空間,請確認手機容量是否充足 進階設定 調整模擬器設定 最近遊玩 最近新增 - 開啟Eden資料夾 - 管理Eden的內部檔案 - 自訂Eden的主題與介面 + 開啟 Eden 資料夾 + 管理 Eden 的內部檔案 + 自訂 Eden 的主題與介面 找不到檔案管理員 - 無法開啟Eden目錄 + 無法開啟 Eden 目錄 請使用檔案管理員的側邊面板手動定位到使用者資料夾 管理儲存資料 - 導入/導出遊戲的儲存資料\n壓縮檔必須為.zip格式\n壓縮檔中首個子資料夾名稱必須為遊戲ID - 導入儲存資料 - 這將會以提供的檔案覆寫現有的該遊戲儲存資料,您確定要繼續嗎? - 正在導入儲存資料… - 正在導出儲存資料… - 已成功導入 + 匯入/匯出遊戲的儲存資料\n壓縮檔必須為.zip格式\n壓縮檔中首個子資料夾名稱必須為遊戲ID + 匯入儲存資料 + 這將會以提供的檔案覆蓋現有的該遊戲儲存資料,您確定要繼續嗎? + 正在匯入儲存資料… + 正在匯出儲存資料… + 已成功匯入 無效的儲存目錄結構 - 首個子資料夾名稱必須為遊戲ID + 首個子資料夾名稱必須為遊戲 ID 安裝韌體 - 韌體必須為ZIP壓縮檔,將會用於部分遊戲的啟動 + 韌體必須為 ZIP 壓縮檔,將會用於部分遊戲的啟動 正在安裝韌體 韌體安裝失敗 - 請確保韌體nca檔案位於zip壓縮檔的根目錄後再試一次 + 請確保韌體 nca 檔案位於 zip 壓縮檔的根目錄後再試一次 韌體解除安裝失敗 分享偵錯記錄 - 分享Eden的記錄檔以便對相關問題進行偵錯 + 分享 Eden 的記錄檔以便對相關問題進行偵錯 找不到日誌檔案 - 分享GPU日誌 - 分享Eden的GPU日誌以對圖形問題進行偵錯 - 找不到GPU日誌檔案 + 分享 GPU 日誌 + 分享 Eden 的 GPU 日誌以對圖形問題進行偵錯 + 找不到 GPU 日誌檔案 安裝遊戲內容 - 安裝遊戲更新或DLC + 安裝遊戲更新或 DLC 正在安裝內容… - 安裝檔案至NAND時發生錯誤 - 請確保內容有效並且prod.keys檔案已安裝 + 安裝檔案至 NAND 時發生錯誤 + 請確保內容有效並且 prod.keys 檔案已安裝 為避免產生衝突,無法直接安裝遊戲本體 %1$d 安裝錯誤 遊戲內容已成功安裝 @@ -416,7 +416,7 @@ https://yuzu-mirror.github.io/help/quickstart/#dumping-installed-updates 您的裝置不支援自訂驅動程式 此裝置不支援注入自訂驅動程式\n請以後再來查看是否已新增支援! - 管理Eden資料 + 管理 Eden 資料 安裝韌體、金鑰,導入/導出使用者資料及安裝其它項目! 遊戲資料夾 深度掃描 @@ -433,7 +433,7 @@ 驗證已安裝內容的完整性 檢查所有已安裝的內容是否有損壞 - 缺少prod.keys + 缺少 prod.keys 無法解密韌體和零售遊戲 https://yuzu-mirror.github.io/help/quickstart/#dumping-decryption-keys @@ -446,12 +446,12 @@ 金鑰安裝失敗 金鑰安裝成功 一個或多個金鑰安裝失敗 - 請確保金鑰檔案具有.keys副檔名後重試 + 請確保金鑰檔案具有 .keys 副檔名後重試 金鑰初始化失敗,請檢查您的轉儲工具是否為最新版本並重新轉儲金鑰 Qlaunch - 從Switch系統主畫面啟動應用程式(目前僅支援英文) + 從 Switch 系統主畫面啟動應用程式(目前僅支援英文) 小程式啟動器 使用已安裝的韌體啟動系統小程式 未安裝韌體 @@ -459,48 +459,48 @@ prod.keys檔案和韌體已安裝並重試]]> 相簿 使用系統相片檢視器查看儲存在使用者螢幕截圖資料夾中的影像 - Mii編輯 - 使用系統編輯器來檢視並編輯Mii + Mii 編輯 + 使用系統編輯器來檢視並編輯 Mii Cabinet - 編輯、刪除儲存在amiibo上的資料 - Cabinet啟動器 + 編輯、刪除儲存在 amiibo 上的資料 + Cabinet 啟動器 暱稱和擁有者設定 刪除遊戲資料 還原程式 格式化程式 - Gaia不存在 + Gaia 不存在 已複製到剪貼簿 - 一個開放原始碼的Switch模擬器 + 一個開放原始碼的 Switch 模擬器 參與者 - 這些人讓Eden Android版成為可能 - 這些專案使Eden Android版成為可能 + 這些人讓 Eden Android 版成為可能 + 這些專案使 Eden Android 版成為可能 組建版本 使用者資料 - 導入/導出所有應用程式資料\n\n導入使用者資料時,現有的使用者資料將被取代!\n\n直接從 Citron 導入使用者資料可能會出現問題,建議手動導入所有所需資料 - 正在導出使用者資料… - 正在導入使用者資料… - 無效的Eden備份 - 使用者資料導出成功 - 使用者資料導入成功 - 導出已取消 - 請確保使用者資料夾位於zip壓縮檔的根目錄,並在 config/config.ini 路徑中包含組態檔案後重試 + 匯入/匯出所有應用程式資料\n\n匯入使用者資料時,現有的使用者資料將被取代!\n\n直接從 Citron 匯入使用者資料可能會出現問題,建議手動匯入所有所需資料 + 正在匯出使用者資料… + 正在匯入使用者資料… + 無效的 Eden 備份 + 使用者資料匯出成功 + 使用者資料匯入成功 + 匯出已取消 + 請確保使用者資料夾位於 zip 壓縮檔的根目錄,並在 config/config.ini 路徑中包含組態檔案後重試 限制模擬速度 將模擬速度限制在標準速度的指定百分比 限制速度百分比 - 指定模擬速度的百分比,100%為標準速度,更高或更低的值將會減少或增加速度限制 + 指定模擬速度的百分比,100% 為標準速度,更高或更低的值將會減少或增加速度限制 加速模式 當開啟加速模式時,模擬器將以此速度執行 慢速模式 當慢速模式開啟時,模擬器將會以此速度執行 - CPU後端 - CPU準確度 + CPU 後端 + CPU 準確度 %1$s%2$s - Homebrew參數 - 在啟動時傳遞給Homebrew的命令列參數(例如:-noglsl) + Homebrew 參數 + 在啟動時傳遞給 Homebrew 的命令列參數(例如:-noglsl) 裝置名稱 @@ -508,60 +508,60 @@ 提高解析度,降低效能。停用後將會使用手提模式,會降低解析度並提高效能 模擬區域 模擬語言 - 選擇RTC日期 - 選擇RTC時間 - 自訂RTC + 選擇 RTC 日期 + 選擇 RTC 時間 + 自訂 RTC 允許您設定與您的目前系統時間相互獨立的自訂時間 - 設定自訂RTC + 設定自訂 RTC - CPU時脈 - 提高模擬CPU回報的時脈,可以減少某些FPS限制。較弱的CPU可能會出現效能下降的情況,部分遊戲可能會出現異常 - 自訂CPU時脈 - 自訂CPU時脈,更高的值可能提高效能,但也可能導致遊戲卡死。建議範圍為77-21000 + CPU 時脈 + 提高模擬 CPU 回報的時脈,可以減少某些 FPS 限制。較弱的 CPU 可能會出現效能下降的情況,部分遊戲可能會出現異常 + 自訂 CPU 時脈 + 自訂 CPU 時脈,更高的值可能提高效能,但也可能導致遊戲卡死。建議範圍為 77-21000 時脈 記憶體布局 - (實驗性)更改模擬記憶體布局,此設定不會提高效能,但可能有助於使用模組來提高解析度的遊戲的載入。不要在RAM為8GB或更少的手機上使用。若遊戲崩潰請將進階設定裡偵錯選項中的CPU後端改為Dynarmic (JIT) + (實驗性)更改模擬記憶體布局,此設定不會提高效能,但可能有助於使用模組來提高解析度的遊戲的載入。不要在 RAM 為 8GB 或更少的手機上使用。若遊戲崩潰請將進階設定裡偵錯選項中的 CPU 後端改為 Dynarmic(JIT) 生成 網路令牌 - 用於建立公開大廳的網路令牌,由48個小寫字母a-z組成 + 用於建立公開大廳的網路令牌,由 48 個小寫字母 a-z 組成 網路使用者名稱 - 多人遊戲房間中顯示的使用者名稱。必須為4-20個字元,僅能使用英文字母、數字、句點、破折號、底線和空格(標點符號須為英文格式) + 多人遊戲房間中顯示的使用者名稱。必須為 4-20 個字元,僅能使用英文字母、數字、句點、破折號、底線和空格(標點符號須為英文格式) 網路 解析度 (手提/底座) 垂直同步 視窗自適應濾波器 - FSR/SGSR銳化度 - 使用FSR/SGSR時圖片的銳化程度 + FSR/SGSR 銳化度 + 使用 FSR/SGSR 時圖片的銳化程度 抗鋸齒 進階 - GPU模式 - 設定GPU模擬的準確度,大多數遊戲在設定為快速時即可正常渲染,但有些需要渲染粒子的遊戲仍需設為準確來避免圖形錯誤 - DMA準確度 - 控制DMA準確度,將準確度設為穩定可以修復某些遊戲中的問題,但在某些情況下也可能影響效能。如果不確定,請保留為預設 + GPU 模式 + 設定 GPU 模擬的準確度,大多數遊戲在設定為快速時即可正常渲染,但有些需要渲染粒子的遊戲仍需設為準確來避免圖形錯誤 + DMA 準確度 + 控制 DMA 準確度,將準確度設為穩定可以修復某些遊戲中的問題,但在某些情況下也可能影響效能。如果不確定,請保留為預設 GPU 同步柵欄模式 控制 GPU 同步柵欄模式,即時是速度最快的選項,但可能會導致一些問題;使用平衡可以提供更好的相容性並修復某些遊戲中的錯誤;準確則是在犧牲部分效能的情況下進一步提升相容性;嚴格是最慢的選項,但可以修復那些對同步要求更嚴格的遊戲中的問題;預設則會依照 GPU 準確度設定 各向異性過濾 改善斜角檢視時的紋理品質 - VRAM使用模式 - 控制GPU記憶體的分配與釋放策略 - ASTC解碼方式 - 選擇ASTC壓縮紋理的解碼方式:CPU(慢速、穩定)、GPU(快速、推薦)或CPU非同步(無卡頓,可能導致問題) + VRAM 使用模式 + 控制 GPU 記憶體的分配與釋放策略 + ASTC 解碼方式 + 選擇 ASTC 壓縮紋理的解碼方式:CPU(慢速、穩定)、GPU(快速、推薦)或 CPU 非同步(無卡頓,可能導致問題) 同步記憶體操作 - 確保計算和記憶體操作之間的資料一致性,此選項應能修復某些遊戲中的問題,但在某些情況下可能會降低效能。使用Unreal Engine 4的遊戲似乎受影響最大 + 確保計算和記憶體操作之間的資料一致性,此選項應能修復某些遊戲中的問題,但在某些情況下可能會降低效能。使用 Unreal Engine 4 的遊戲似乎受影響最大 磁碟著色器快取 將產生的著色器快取儲存至硬碟以減少中斷 - 強制使用最大時脈 (僅限Adreno) - 強制 GPU 以可能的最大時脈執行 (熱溫限制仍會被套用) + 強制使用最大時脈(僅限 Adreno) + 強制GPU以可能的最大時脈運作(熱溫限制仍會被套用) GPU 非同步模擬 此修改可透過使用 GPU 非同步模擬來提升性能,不過可能會導致圖形問題且會提高在進行時序相關操作時當機的機率 使用重新啟用排清 @@ -569,32 +569,36 @@ 啟用緩衝區歷史 允許存取先前的緩衝區狀態,此選項可能會改善部分遊戲的渲染品質與效能穩定性 最佳化頂點緩衝區 - 啟用最佳化的頂點緩衝區綁定,需要安裝 Mesa 26.0+ Turnip drivers/Qualcomm drivers。使用舊版 Turnip drivers 會導致當機(25.3版和更低的版本) + 啟用最佳化的頂點緩衝區綁定,需要安裝 Mesa 26.0+ Turnip drivers/Qualcomm drivers。使用舊版 Turnip drivers 會導致當機(25.3 版或更低的版本) 修改 - GPU時脈 - 讓遊戲誤以為GPU工作能更快完成,避免遊戲為了配合Switch的時脈而降低解析度與渲染距離 - 跳過CPU內部失效處理 - 在記憶體更新期間跳過某些CPU端快取的失效處理,減少CPU使用率並提高其性能。可能會導致某些遊戲出現故障或當機 + GPU 時脈 + 讓遊戲誤以為 GPU 工作能更快完成,避免遊戲為了配合 Switch 的時脈而降低解析度與渲染距離 + 跳過 CPU 內部失效處理 + 在記憶體更新期間跳過某些 CPU 端快取的失效處理,減少 CPU 使用率並提高其性能。可能會導致某些遊戲出現故障或當機 + 在 NCE 無效化前進行 GPU 回讀 + (暫時性功能)修復 \"終結者瑪格諾莉亞:霧中綻放\" 及其它使用虛幻引擎之遊戲中的當機問題,可能會降低效能。此功能正在改善中 + 對 NCE Runtime 的 NRO 檔案進行修補 + (暫時性功能)修復 \"Biomutant\" 的啟動問題,可能會對效能造成影響。此功能正在改善中 修正光暈特效 - 在 \"薩爾達傳說:織夢島\" 和 \"薩爾達傳說:智慧的再現\" 中減少光暈模糊的問題並移除 \"橫衝直撞:狂飆樂園重製版\" 中的光暈效果(適用於Adreno A6XX - A7XX/ Turnip)。警告:可能會在其它遊戲中導致圖形異常 - 模擬BGR565 + 在 \"薩爾達傳說:織夢島\" 和 \"薩爾達傳說:智慧的再現\" 中減少光暈模糊的問題並移除 \"橫衝直撞:狂飆樂園重製版\" 中的光暈效果(適用於 Adreno A6XX - A7XX/ Turnip)。警告:可能會在其它遊戲中導致圖形異常 + 模擬 BGR565 修正遊戲中出現的色彩反轉、圖形異常或陰影異常 啟用舊版重新縮放處理 透過快速重新縮放處理來啟用遊戲重新縮放設定階段的舊版處理方式 使用非同步著色器 使用非同步編譯著色器,這可能會減少卡頓,但也可能導致圖形錯誤 - GPU Unswizzle設定 - 設定基於GPU的Unswizzling參數或完全停用此功能,調整此設定以在性能與紋理載入品質中取得平衡 - 啟用GPU Unswizzle + GPU Unswizzle 設定 + 設定基於 GPU 的 Unswizzling 參數或完全停用此功能,調整此設定以在性能與紋理載入品質中取得平衡 + 啟用 GPU Unswizzle 停用 - GPU Unswizzle最大紋理尺寸 - 設定 GPU 紋理 Unswizzling 的最大值(MB),雖然 GPU 處理中型和大型紋理的速度較快,但 CPU 處理非常小的紋理可能更有效率。調整此設定以在GPU加速與CPU負載之間取得平衡 - GPU Unswizzle Stream大小 - 設定每個影格處理大型紋理Unswizzling的資料上限,數值越高載入紋理的速度越快,但會增加畫面延遲;數值較低則能降低 GPU 負載,不過有可能導致至紋理載入不完全甚至突然出現 - GPU Unswizzle Chunk大小 - 設定 3D 紋理每批次處理的深度切片數量,增加此數值可提升規格較佳GPU的處理效率,但在較低規格的硬體上可能導致卡頓或驅動程式逾時 + GPU Unswizzle 最大紋理尺寸 + 設定 GPU 紋理 Unswizzling 的最大值(MB),雖然 GPU 處理中型和大型紋理的速度較快,但 CPU 處理非常小的紋理可能更有效率。調整此設定以在 GPU 加速與 CPU 負載之間取得平衡 + GPU Unswizzle Stream 大小 + 設定每個影格處理大型紋理 Unswizzling 的資料上限,數值越高載入紋理的速度越快,但會增加畫面延遲;數值較低則能降低 GPU 負載,不過有可能導致至紋理載入不完全甚至突然出現 + GPU Unswizzle Chunk 大小 + 設定 3D 紋理每批次處理的深度切片數量,增加此數值可提升規格較佳 GPU 的處理效率,但在較低規格的硬體上可能導致卡頓或驅動程式逾時 預設 @@ -617,7 +621,7 @@ 子母畫面 位於背景時最小化視窗 - 解析度縮放到2倍或更高可能會導致問題,並可能顯著降低設備速度 + 解析度縮放到 2 倍或更高可能會導致問題,並可能顯著降低設備速度 CPU @@ -628,38 +632,38 @@ GPU API 圖形偵錯 - 將圖形API設為慢速偵錯模式 - BCn區塊壓縮紋理修補 - 覆寫Adreno GPU的BCn紋理格式自動偵測。通常會根據Android版本自動偵測(會在API 28以上的裝置自動啟用) + 將圖形 API 設為慢速偵錯模式 + BCn 區塊壓縮紋理修補 + 覆寫 Adreno GPU 的 BCn 紋理格式自動偵測。通常會根據 Android 版本自動偵測(會在 API 28 以上的裝置自動啟用) Fastmem 日誌 按行寫入偵錯日誌 - 在寫入一行日誌就立刻更新偵錯記錄,讓程式在當機或閃退時更容易偵錯 + 寫入一行日誌就立刻更新偵錯記錄,讓程式在當機或畫面凍結時更容易偵錯 啟用更詳細的日誌記錄 - 將日誌檔的最大檔案限制從100MB提高到1GB + 將日誌檔的最大檔案限制從 100MB 提高到 1GB 日誌過濾器 控制 Eden 日誌的紀錄類別。例如: *:Info Service.LM:Debug - GPU日誌 + GPU 日誌 記錄層級 - GPU日誌的詳細層級(越高日誌越詳細,不過會更容易過熱) - 記錄Vulkan API呼叫 - 在環形緩衝區中記錄所有Vulkan API呼叫 - 傾印SPIR-V著色器 - 將重新編譯後的SPIR-V二進位檔案(.spv)儲存至Eden資料夾裡的dump資料夾中。可使用 spirv-dis/spirv-cross/spirv-val 進行檢查 + GPU 日誌的詳細層級(越高日誌越詳細,不過會更容易過熱) + 記錄 Vulkan API 呼叫 + 在環形緩衝區中記錄所有 Vulkan API 呼叫 + 傾印 SPIR-V 著色器 + 將重新編譯後的 SPIR-V 二進位檔案(.spv)儲存至 Eden 資料夾裡的 dump 資料夾中。可使用 spirv-dis/spirv-cross/spirv-val 進行檢查 傾印客體(Maxwell)著色器 - 將Maxwell客體著色器位元組碼檔案(.ash)儲存至Eden資料夾裡的dump資料夾中。可使用 nvdisasm 進行檢查 - 傾印Maxwell巨集 - 將Maxwell巨集程式檔案(.macro)儲存至Eden資料夾裡的dump資料夾中。可使用 envydis 進行檢查 - 追蹤GPU記憶體 - 監控GPU記憶體的分配和釋放 + 將 Maxwell 客體著色器位元組碼檔案(.ash)儲存至 Eden 資料夾裡的 dump 資料夾中。可使用 nvdisasm 進行檢查 + 傾印 Maxwell 巨集 + 將 Maxwell 巨集程式檔案(.macro)儲存至 Eden 資料夾裡的 dump 資料夾中。可使用 envydis 進行檢查 + 追蹤 GPU 記憶體 + 監控 GPU 記憶體的分配和釋放 驅動程式偵錯資料 擷取驅動程式的特定偵錯資料(例如 Turnip breadcrumbs) 環形緩衝區大小 - 追蹤的近期Vulkan呼叫數量(預設為512) - 64至4096個項目 + 追蹤的近期 Vulkan 呼叫數量(預設為 512) + 64 至 4096 個項目 一般 @@ -683,17 +687,17 @@ 左搖桿 控制搖桿 右搖桿 - C搖桿 + C 搖桿 按壓 靈敏度 無感帶 用按鈕、按鍵來模擬搖桿 - 修改按鈕模擬左/右搖桿的值,視遊戲不同而有所差異\n(模擬左搖桿時,若將此數值設為50,則按下按鈕時遊戲裡的人物可能只會走動而不是奔跑;模擬右搖桿時所使用的值則是會影響到轉視角的速度,數值越高代表使用的模擬值越大) + 修改按鈕模擬左/右搖桿的值,視遊戲不同而有所差異\n(模擬左搖桿時,若將此數值設為 50,則按下按鈕時遊戲裡的人物可能只會走動而不是奔跑;模擬右搖桿時所使用的值則是會影響到轉視角的速度,數值越高代表使用的模擬值越大) 肩部按鍵 - 左SL - 左SR - 右SL - 右SR + 左 SL + 左 SR + 右 SL + 右 SR 無效 無 未知 @@ -708,12 +712,12 @@ 選擇一個控制器以嘗試自動配對按鈕、搖桿 嘗試為 %1$s 自動配對 控制器類型 - Pro手把 + Pro 手把 掌機模式 - 雙Joycon手把 - 左Joycon手把 - 右Joycon手把 - GameCube手把 + 雙 Joycon 手把 + 左 Joycon 手把 + 右 Joycon 手把 + GameCube 手把 方向反轉 反轉按鈕 切換按鍵 @@ -738,7 +742,7 @@ 按下一個按鈕或肩部按鍵/移動搖桿 將方向鍵配對到 %1$s 配對到 %1$s - 導入設定檔失敗 + 匯入設定檔失敗 儲存設定檔失敗 重設控制器配對 您確定要將此控制器的所有配對重設為預設值?此動作無法復原 @@ -759,21 +763,21 @@ 自動 提交 無 - 導入 - 導出 - 導出失敗 - 導入失敗 + 匯入 + 匯出 + 匯出失敗 + 匯入失敗 正在取消 安裝 下載 刪除 編輯 - 已成功導入 - 已成功導出 + 已成功匯入 + 已成功匯出 開始 全域設定 個別遊戲設定 - 導入完成 + 匯入完成 使用全域設定 操作已成功完成 確認 @@ -804,9 +808,9 @@ 安裝中… 最新 推薦驅動程式: - GPU型號 - 不支援的GPU - 您的GPU不支援驅動程式注入,不建議嘗試設定自訂驅動程式 + GPU 型號 + 不支援的 GPU + 您的 GPU 不支援驅動程式注入,不建議嘗試設定自訂驅動程式 設定 @@ -836,13 +840,13 @@ 成功遷移儲存資料 儲存資料遷移失敗 存檔目錄設定完成 - 所選取的位置已有儲存資料。是否要取代該檔案? + 所選取的位置已有儲存資料,是否要取代該檔案? 若要自訂路徑必須授予所有檔案的存取權 授予權限 NAND 路徑 設定 NAND 資料的自訂路徑 - 虛擬 SD卡 路徑 - 設定虛擬 SD卡 儲存空間的自訂路徑 + 虛擬SD卡路徑 + 設定虛擬SD卡儲存空間的自訂路徑 路徑設定成功 跳過 @@ -861,7 +865,7 @@ 切換模組、更新及 DLC 遊玩時間: 重設遊玩時間 - 將此遊戲的遊玩時間重設為0 + 將此遊戲的遊玩時間重設為 0 您確定要重設此遊戲的遊玩時間嗎? 遊玩時間已重設 修改遊玩時間 @@ -870,16 +874,16 @@ 小時 分鐘 秒 - 必須介於0到9999小時之間 - 必須介於0到59分鐘之間 - 必須介於0到59秒之間 - 成功更新遊玩時間 + 必須介於 0 到 9999 小時之間 + 必須介於 0 到 59 分鐘之間 + 必須介於 0 到 59 秒之間 + 成功修改遊玩時間 清除著色器快取 清除此遊戲所有已編譯的著色器快取 重新編譯著色器快取的過程中可能會導致遊戲有些微卡頓 著色器快取已成功清除 已刪除著色器快取 - 為了維持Vulkan管線驗證,Eden已自動清除所有著色器快取。為了預防閃退和圖形錯誤,這是必須的動作。因為著色器需要重新編譯,您在遊戲過程中可能會遇到些微卡頓的情況 + 為了維持Vulkan管線驗證,Eden 已自動清除所有著色器快取,若要預防閃退和圖形錯誤,這是必須的動作。因為著色器需要重新編譯,您在遊戲過程中可能會遇到些微卡頓的情況 附加元件:%1$s 儲存資料 管理此遊戲的儲存資料 @@ -911,8 +915,8 @@ 未完成文件完整性檢查 以下文件的完整性驗證失敗:\n %1$s 分享設定 - 導入設定 - 導出設定 + 匯入設定 + 匯出設定 分享設定失敗 @@ -928,12 +932,12 @@ 正在搜尋遊戲... - 找不到標題ID的遊戲: %1$s + 找不到標題 ID 的遊戲: %1$s 自訂設定失敗 無法套用自訂設定 %1$s: %2$s 使用預設設定啟動 啟動已取消 - 無法套用請求的設定。這可能是由於缺少GPU驅動程式或設定問題。 + 無法套用請求的設定,這可能是由於缺少 GPU 驅動程式或設定問題 已套用自訂設定 正在啟動 %1$s... 無法初始化遊戲 @@ -954,10 +958,10 @@ 未安裝所需的驅動程式: %s 無效的驅動程式檔案: %s - 無可用網路連線。請檢查您的網路連線並重試 - 需要GPU驅動程式 + 無可用網路連線,請檢查您的網路連線並重試 + 需要 GPU 驅動程式 這個遊戲的設定需要 \"%s\"驅動程式,而它並沒有安裝在您的裝置上\n\n要下載並安裝此驅動程式嗎? - 驅動程式下載已取消。沒有所需的驅動程式無法啟動遊戲。 + 驅動程式下載已取消,沒有所需的驅動程式無法啟動遊戲 下載 @@ -979,7 +983,7 @@ 暫停模擬 繼續模擬 疊加層/虛擬按鍵設定 - 導入Amiibo + 導入 Amiibo 觸控螢幕 鎖定側邊選單 解鎖側邊選單 @@ -987,12 +991,12 @@ Amiibo - 該amiibo已被移除 - 此遊戲目前沒有在尋找amiibo - 您所選擇的並不是正確的amiibo金鑰檔 + 該 amiibo 已被移除 + 此遊戲目前沒有在尋找 amiibo + 您所選擇的並不是正確的 amiibo 金鑰檔 選擇的檔案已在使用中 發生未知的錯誤 - 已導入Amiibo + Amiibo 已匯入 @@ -1021,9 +1025,9 @@ 臺灣 - 4GB (推薦) - 6GB (不穩定) - 8GB (不穩定) + 4GB(推薦) + 6GB(不穩定) + 8GB(不穩定) 正常 @@ -1073,20 +1077,26 @@ 效能 - 準確 + 品質 預設 不穩定 穩定 + + 預設 + 即時 + 平衡 + 準確 + 保守 積極 - 即時 (關閉) + 即時(關閉) Mailbox - FIFO (開啟) + FIFO(開啟) FIFO 寬鬆 @@ -1108,6 +1118,18 @@ 不合理 偵錯 + + Freedreno 設定 + GPU 驅動程式設定 + 預先提供的設定檔 + 目前使用的設定 + 進階設定 + 變數名稱 (例如: TU_DEBUG) + 變數值 + 新增變數 + 全部清除 + Freedreno 設定已儲存 + 已清除所有 Freedreno 變數 方向鍵 左搖桿 From 4dc69c06f764a235bccd01afbfc765d9ddbebc9f Mon Sep 17 00:00:00 2001 From: lizzie Date: Mon, 12 Oct 2026 22:21:17 +0200 Subject: [PATCH 08/32] [*] Remove Fix{Static,Small}VectorADL workaround for GCC 12 (#4386) 1. We demand at least, minimum, gcc 14 2. Debian stable boost uses a newer version https://packages.debian.org/trixie/libboost-all-dev, so fix isn't longer required - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4386 Reviewed-by: MaranBr Reviewed-by: crueter --- src/audio_core/in/audio_in_system.cpp | 19 ++------------ src/video_core/buffer_cache/buffer_cache.h | 2 +- src/video_core/memory_manager.cpp | 2 +- .../renderer_vulkan/vk_buffer_cache.cpp | 4 +-- .../renderer_vulkan/vk_texture_cache.cpp | 6 ++--- src/video_core/texture_cache/texture_cache.h | 26 +++++++++---------- src/video_core/texture_cache/util.h | 23 +--------------- 7 files changed, 23 insertions(+), 59 deletions(-) diff --git a/src/audio_core/in/audio_in_system.cpp b/src/audio_core/in/audio_in_system.cpp index f71a2df6be..f8946cc0f6 100644 --- a/src/audio_core/in/audio_in_system.cpp +++ b/src/audio_core/in/audio_in_system.cpp @@ -14,21 +14,6 @@ #include "core/core_timing.h" #include "core/hle/kernel/k_event.h" -// See texture_cache/util.h -template -#if BOOST_VERSION >= 108100 || __GNUC__ > 12 -[[nodiscard]] boost::container::static_vector FixStaticVectorADL(const boost::container::static_vector& v) { - return v; -} -#else -[[nodiscard]] std::vector FixStaticVectorADL(const boost::container::static_vector& v) { - std::vector u; - for (auto const& e : v) - u.push_back(e); - return u; -} -#endif - namespace AudioCore::AudioIn { System::System(Core::System& system_, Kernel::KEvent* event_, const size_t session_id_) @@ -110,7 +95,7 @@ Result System::Start() { boost::container::static_vector buffers_to_flush{}; buffers.RegisterBuffers(buffers_to_flush); - session->AppendBuffers(FixStaticVectorADL(buffers_to_flush)); + session->AppendBuffers(buffers_to_flush); session->SetRingSize(static_cast(buffers_to_flush.size())); return ResultSuccess; @@ -155,7 +140,7 @@ void System::RegisterBuffers() { if (state == State::Started) { boost::container::static_vector registered_buffers{}; buffers.RegisterBuffers(registered_buffers); - session->AppendBuffers(FixStaticVectorADL(registered_buffers)); + session->AppendBuffers(registered_buffers); } } diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index 9a5d6f322a..53addb5dec 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h @@ -1664,7 +1664,7 @@ void BufferCache

::JoinOverlap(BufferId new_buffer_id, BufferId overlap_id, .size = overlap.SizeBytes(), }); new_buffer.MarkUsage(copies[0].dst_offset, copies[0].size); - runtime.CopyBuffer(new_buffer, overlap, FixSmallVectorADL(copies), true); + runtime.CopyBuffer(new_buffer, overlap, copies, true); #ifdef YUZU_LEGACY if (immediately_free) runtime.Finish(); diff --git a/src/video_core/memory_manager.cpp b/src/video_core/memory_manager.cpp index d5838a387d..8ffdcb6276 100644 --- a/src/video_core/memory_manager.cpp +++ b/src/video_core/memory_manager.cpp @@ -713,7 +713,7 @@ void MemoryManager::FlushCaching() { if (accumulator.InvalidateAll([this](GPUVAddr addr, size_t size) { GetSubmappedRangeImpl(addr, size, page_stash2); })) { - rasterizer->InnerInvalidation(VideoCommon::FixSmallVectorADL(page_stash2)); + rasterizer->InnerInvalidation(page_stash2); page_stash2.clear(); } } diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp index 1a33189bf8..493de2cc20 100644 --- a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp @@ -471,7 +471,7 @@ void BufferCacheRuntime::CopyBuffer(VkBuffer dst_buffer, VkBuffer src_buffer, if (src_buffer == staging_pool.StreamBuf() && can_reorder_upload) { scheduler.RecordWithUploadBuffer([src_buffer, dst_buffer, vk_copies]( vk::CommandBuffer, vk::CommandBuffer upload_cmdbuf) { - upload_cmdbuf.CopyBuffer(src_buffer, dst_buffer, VideoCommon::FixSmallVectorADL(vk_copies)); + upload_cmdbuf.CopyBuffer(src_buffer, dst_buffer, vk_copies); }); return; } @@ -482,7 +482,7 @@ void BufferCacheRuntime::CopyBuffer(VkBuffer dst_buffer, VkBuffer src_buffer, cmdbuf.PipelineBarrier(vk::PIPELINE_STAGE_GRAPHICS_COMPUTE_TRANSFER, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, READ_BARRIER); } - cmdbuf.CopyBuffer(src_buffer, dst_buffer, VideoCommon::FixSmallVectorADL(vk_copies)); + cmdbuf.CopyBuffer(src_buffer, dst_buffer, vk_copies); if (barrier) { cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_TRANSFER_BIT, vk::PIPELINE_STAGE_GRAPHICS_COMPUTE, 0, WRITE_BARRIER); diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index bc2e82acae..583cb6edaf 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp @@ -1642,7 +1642,7 @@ void TextureCacheRuntime::CopyImage(Image& dst, Image& src, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, nullptr, nullptr, pre_barriers); cmdbuf.CopyImage(src_image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, dst_image, - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VideoCommon::FixSmallVectorADL(vk_copies)); + VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, vk_copies); cmdbuf.PipelineBarrier( VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT | @@ -2006,7 +2006,7 @@ void Image::UploadMemory(VkBuffer buffer, VkDeviceSize offset, scheduler->Record([src_buffer, temp_vk_image, vk_aspect_mask, vk_copies](vk::CommandBuffer cmdbuf) { - CopyBufferToImage(cmdbuf, src_buffer, temp_vk_image, vk_aspect_mask, false, VideoCommon::FixSmallVectorADL(vk_copies)); + CopyBufferToImage(cmdbuf, src_buffer, temp_vk_image, vk_aspect_mask, false, vk_copies); }); const auto [samples_x, samples_y] = VideoCommon::SamplesLog2(info.num_samples); @@ -2060,7 +2060,7 @@ void Image::UploadMemory(VkBuffer buffer, VkDeviceSize offset, scheduler->Record([src_buffer, vk_image, vk_aspect_mask, was_initialized, vk_copies](vk::CommandBuffer cmdbuf) { - CopyBufferToImage(cmdbuf, src_buffer, vk_image, vk_aspect_mask, was_initialized, VideoCommon::FixSmallVectorADL(vk_copies)); + CopyBufferToImage(cmdbuf, src_buffer, vk_image, vk_aspect_mask, was_initialized, vk_copies); }); if (is_rescaled) { diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 640bd38407..e92e54f8ce 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -140,7 +140,7 @@ void TextureCache

::RunGarbageCollector() { } if (must_download) { auto map = runtime.DownloadStagingBuffer(image.unswizzled_size_bytes); - const auto copies = FixSmallVectorADL(FullDownloadCopies(image.info)); + const auto copies = FullDownloadCopies(image.info); image.DownloadMemory(map, copies); runtime.Finish(); SwizzleImage(*gpu_memory, image.gpu_addr, image.info, copies, map.mapped_span, swizzle_data_buffer); @@ -629,7 +629,7 @@ void TextureCache

::DownloadMemory(DAddr cpu_addr, size_t size) { for (const ImageId image_id : images) { Image& image = slot_images[image_id]; auto map = runtime.DownloadStagingBuffer(image.unswizzled_size_bytes); - const auto copies = FixSmallVectorADL(FullDownloadCopies(image.info)); + const auto copies = FullDownloadCopies(image.info); image.DownloadMemory(map, copies); runtime.Finish(); SwizzleImage(*gpu_memory, image.gpu_addr, image.info, copies, map.mapped_span, @@ -893,7 +893,7 @@ void TextureCache

::CommitAsyncFlushes() { for (const PendingDownload& download_info : download_ids) { if (download_info.is_swizzle) { Image& image = slot_images[download_info.object_id]; - const auto copies = FixSmallVectorADL(FullDownloadCopies(image.info)); + const auto copies = FullDownloadCopies(image.info); image.DownloadMemory(download_map, copies); download_map.offset += Common::AlignUp(image.unswizzled_size_bytes, 64); } @@ -926,7 +926,7 @@ void TextureCache

::PopAsyncFlushes() { auto& download_buffer = download_map[download_info.async_buffer_id]; if (download_info.is_swizzle) { const ImageBase& image = slot_images[download_info.object_id]; - const auto copies = FixSmallVectorADL(FullDownloadCopies(image.info)); + const auto copies = FullDownloadCopies(image.info); download_buffer.offset -= Common::AlignUp(image.unswizzled_size_bytes, 64); std::span download_span = download_buffer.mapped_span.subspan(download_buffer.offset); @@ -964,7 +964,7 @@ void TextureCache

::PopAsyncFlushes() { continue; } Image& image = slot_images[download_info.object_id]; - const auto copies = FixSmallVectorADL(FullDownloadCopies(image.info)); + const auto copies = FullDownloadCopies(image.info); image.DownloadMemory(download_map, copies); download_map.offset += image.unswizzled_size_bytes; } @@ -977,7 +977,7 @@ void TextureCache

::PopAsyncFlushes() { continue; } const ImageBase& image = slot_images[download_info.object_id]; - const auto copies = FixSmallVectorADL(FullDownloadCopies(image.info)); + const auto copies = FullDownloadCopies(image.info); SwizzleImage(*gpu_memory, image.gpu_addr, image.info, copies, download_span, swizzle_data_buffer); download_map.offset += image.unswizzled_size_bytes; download_span = download_span.subspan(image.unswizzled_size_bytes); @@ -1160,7 +1160,7 @@ void TextureCache

::UploadImageContents(Image& image, StagingBuffer& staging) gpu_memory->ReadBlock(gpu_addr, mapped_span.data(), mapped_span.size_bytes(), VideoCommon::CacheType::NoTextureCache); const auto uploads = FullUploadSwizzles(image.info); - runtime.AccelerateImageUpload(image, staging, FixSmallVectorADL(uploads), 0, 0); + runtime.AccelerateImageUpload(image, staging, uploads, 0, 0); return; } @@ -1168,11 +1168,11 @@ void TextureCache

::UploadImageContents(Image& image, StagingBuffer& staging) *gpu_memory, gpu_addr, image.guest_size_bytes, &swizzle_data_buffer); if (True(image.flags & ImageFlagBits::Converted)) { unswizzle_data_buffer.resize_destructive(image.unswizzled_size_bytes); - auto copies = FixSmallVectorADL(UnswizzleImage(*gpu_memory, gpu_addr, image.info, swizzle_data, unswizzle_data_buffer)); + auto copies = UnswizzleImage(*gpu_memory, gpu_addr, image.info, swizzle_data, unswizzle_data_buffer); ConvertImage(unswizzle_data_buffer, image.info, mapped_span, copies); image.UploadMemory(staging, copies); } else { - const auto copies = FixSmallVectorADL(UnswizzleImage(*gpu_memory, gpu_addr, image.info, swizzle_data, mapped_span)); + const auto copies = UnswizzleImage(*gpu_memory, gpu_addr, image.info, swizzle_data, mapped_span); image.UploadMemory(staging, copies); } } @@ -1401,7 +1401,7 @@ void TextureCache

::TickAsyncDecode() { auto staging = runtime.UploadStagingBuffer(MapSizeBytes(image)); std::memcpy(staging.mapped_span.data(), async_decode->decoded_data.data(), async_decode->decoded_data.size()); - image.UploadMemory(staging, FixSmallVectorADL(async_decode->copies)); + image.UploadMemory(staging, async_decode->copies); image.flags &= ~ImageFlagBits::IsDecoding; has_uploads = true; i = async_decodes.erase(i); @@ -1469,7 +1469,7 @@ void TextureCache

::TickAsyncUnswizzle() { if (z_count > 0) { const auto uploads = FullUploadSwizzles(task.info); - runtime.AccelerateImageUpload(image, task.staging_buffer, FixSmallVectorADL(uploads), z_start, z_count); + runtime.AccelerateImageUpload(image, task.staging_buffer, uploads, z_start, z_count); task.last_submitted_offset += (static_cast(z_count) * task.bytes_per_slice); } } @@ -1730,9 +1730,9 @@ ImageId TextureCache

::JoinImages(const ImageInfo& info, GPUVAddr gpu_addr, DA const u32 down_shift = can_rescale ? resolution.down_shift : 0; auto copies = MakeShrinkImageCopies(new_info, overlap.info, base, up_scale, down_shift); if (overlap.info.num_samples != new_image.info.num_samples) { - runtime.CopyImageMSAA(new_image, overlap, FixSmallVectorADL(copies)); + runtime.CopyImageMSAA(new_image, overlap, copies); } else { - runtime.CopyImage(new_image, overlap, FixSmallVectorADL(copies)); + runtime.CopyImage(new_image, overlap, copies); } new_image.modification_tick = overlap.modification_tick; } diff --git a/src/video_core/texture_cache/util.h b/src/video_core/texture_cache/util.h index 3e8bb00032..590d85b042 100644 --- a/src/video_core/texture_cache/util.h +++ b/src/video_core/texture_cache/util.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project @@ -122,25 +122,4 @@ void DeduceBlitImages(ImageInfo& dst_info, ImageInfo& src_info, const ImageBase* [[nodiscard]] u32 MapSizeBytes(const ImageBase& image); -// TODO: Remove once Debian STABLE no longer has such outdated boost -// This is a gcc bug where ADL lookup fails for range niebloids of std::span -// for any given type of the static_vector/small_vector, etc which makes a whole mess -// for anything using std::span so we just do this terrible hack on older versions of -// GCC12 because people actually still use stable debian so... yeah -// One may say: "This is bad for performance" - to which I say, using GCC 12 you already know -// what kind of bs you will be dealing with anyways. -template -#if BOOST_VERSION >= 108100 || __GNUC__ > 12 -[[nodiscard]] boost::container::small_vector FixSmallVectorADL(const boost::container::small_vector& v) { - return v; -} -#else -[[nodiscard]] std::vector FixSmallVectorADL(const boost::container::small_vector& v) { - std::vector u; - for (auto const& e : v) - u.push_back(e); - return u; -} -#endif - } // namespace VideoCommon From 218c6705d950635bc18f8458d738a1996fb592b6 Mon Sep 17 00:00:00 2001 From: lizzie Date: Tue, 13 Oct 2026 04:38:36 +0200 Subject: [PATCH 09/32] [hle] constexpr handler dispatch maps, introduce version gating (#4480) This PR primarily focuses on upbringing constexpr maps for handlers. Each time an HLE object of a service is construed, it registers it's own handlers, over and over. Regardless of whetever it needs them at the moment or not. Additionally we don't require to keep track of different function pointers amongst each object. This can be done by overriding the given function instead, as opposed to having a separate hash map for every given object. In other words: Remove handlers (and handlers_tipc) map for every instance then read from a static defined per-class. - [x] Migrate all HLE functions to new `frozen::map` constexpr time finder - [ ] Measure if this approach actually makes better codegen Optional: - [x] Properly gate all functions (that have versions commented next to them) - [x] Maybe store `HandlerFnP<>` and `const char*` separately, version gating can go in a different map as well Information such as name can be used on debug builds, but doesn't particularly help on release as one can consult an external reference (or have an annotated IPC map) Signed-off-by: lizzie - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Co-authored-by: Maufeat Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4480 Reviewed-by: Maufeat Reviewed-by: MaranBr --- docs/DesignOverview.md | 2 +- docs/README.md | 2 +- docs/{HosKernel.md => SubsystemHLE.md} | 53 +- src/core/CMakeLists.txt | 70 +- src/core/hle/service/acc/acc.cpp | 1933 +++++++++-------- src/core/hle/service/acc/acc.h | 64 - src/core/hle/service/acc/async_context.cpp | 11 - src/core/hle/service/acc/async_context.h | 13 + src/core/hle/service/am/am.cpp | 1341 +++++++++++- .../all_system_applet_proxies_service.cpp | 135 -- .../all_system_applet_proxies_service.h | 56 - .../am/service/applet_common_functions.cpp | 98 - .../am/service/applet_common_functions.h | 33 - .../am/service/application_accessor.cpp | 64 +- .../service/am/service/application_accessor.h | 4 + .../am/service/application_creator.cpp | 20 +- .../service/am/service/application_creator.h | 3 +- .../am/service/application_functions.cpp | 153 +- .../am/service/application_functions.h | 1 + .../service/am/service/application_proxy.cpp | 106 - .../service/am/service/application_proxy.h | 49 - .../am/service/application_proxy_service.cpp | 44 - .../am/service/application_proxy_service.h | 33 - .../service/am/service/audio_controller.cpp | 26 +- .../hle/service/am/service/audio_controller.h | 4 + .../am/service/common_state_getter.cpp | 209 +- .../service/am/service/common_state_getter.h | 1 + .../am/service/cradle_firmware_updater.cpp | 28 +- .../am/service/cradle_firmware_updater.h | 4 + .../service/am/service/debug_functions.cpp | 43 - .../hle/service/am/service/debug_functions.h | 16 - .../service/am/service/display_controller.cpp | 68 +- .../service/am/service/display_controller.h | 3 +- .../am/service/global_state_controller.cpp | 41 +- .../am/service/global_state_controller.h | 7 +- .../am/service/home_menu_functions.cpp | 42 +- .../service/am/service/home_menu_functions.h | 1 + .../am/service/library_applet_accessor.cpp | 64 +- .../am/service/library_applet_accessor.h | 22 +- .../am/service/library_applet_creator.cpp | 287 --- .../am/service/library_applet_creator.h | 44 - .../am/service/library_applet_proxy.cpp | 134 -- .../service/am/service/library_applet_proxy.h | 56 - .../service/library_applet_self_accessor.cpp | 332 --- .../am/service/library_applet_self_accessor.h | 87 - .../hle/service/am/service/lock_accessor.cpp | 78 - .../hle/service/am/service/lock_accessor.h | 32 - .../am/service/overlay_applet_proxy.cpp | 120 - .../service/am/service/overlay_applet_proxy.h | 55 - .../service/am/service/overlay_functions.cpp | 52 +- .../service/am/service/overlay_functions.h | 35 +- .../am/service/process_winding_controller.cpp | 28 +- .../am/service/process_winding_controller.h | 1 + .../service/am/service/self_controller.cpp | 113 +- .../hle/service/am/service/self_controller.h | 1 + src/core/hle/service/am/service/storage.cpp | 78 +- src/core/hle/service/am/service/storage.h | 4 + .../service/am/service/storage_accessor.cpp | 68 - .../hle/service/am/service/storage_accessor.h | 38 - .../am/service/system_applet_proxy.cpp | 133 -- .../service/am/service/system_applet_proxy.h | 58 - .../service/am/service/window_controller.cpp | 31 +- .../service/am/service/window_controller.h | 4 + .../hle/service/aoc/addon_content_manager.cpp | 57 +- .../hle/service/aoc/addon_content_manager.h | 5 +- .../service/aoc/purchase_event_manager.cpp | 30 +- .../hle/service/aoc/purchase_event_manager.h | 5 + src/core/hle/service/apm/apm_interface.cpp | 38 +- src/core/hle/service/apm/apm_interface.h | 24 + src/core/hle/service/audio/audio.cpp | 208 +- .../hle/service/audio/audio_controller.cpp | 140 +- src/core/hle/service/audio/audio_controller.h | 4 +- src/core/hle/service/audio/audio_device.cpp | 52 +- src/core/hle/service/audio/audio_device.h | 1 + src/core/hle/service/audio/audio_in.cpp | 50 +- src/core/hle/service/audio/audio_in.h | 4 + .../hle/service/audio/audio_in_manager.cpp | 33 +- src/core/hle/service/audio/audio_in_manager.h | 4 + src/core/hle/service/audio/audio_out.cpp | 40 +- src/core/hle/service/audio/audio_out.h | 5 + .../hle/service/audio/audio_out_manager.cpp | 20 +- .../hle/service/audio/audio_out_manager.h | 1 + src/core/hle/service/audio/audio_renderer.cpp | 51 +- src/core/hle/service/audio/audio_renderer.h | 4 + .../service/audio/audio_renderer_manager.cpp | 22 +- .../service/audio/audio_renderer_manager.h | 1 + .../audio/final_output_recorder_manager.cpp | 42 +- .../audio/final_output_recorder_manager.h | 10 + ...nal_output_recorder_manager_for_applet.cpp | 11 +- ...final_output_recorder_manager_for_applet.h | 11 + .../service/audio/hardware_opus_decoder.cpp | 35 +- .../hle/service/audio/hardware_opus_decoder.h | 4 + .../audio/hardware_opus_decoder_manager.cpp | 34 +- .../audio/hardware_opus_decoder_manager.h | 4 + src/core/hle/service/bcat/bcat_service.cpp | 75 +- src/core/hle/service/bcat/bcat_service.h | 1 + .../bcat/delivery_cache_directory_service.cpp | 18 +- .../bcat/delivery_cache_directory_service.h | 4 + .../bcat/delivery_cache_file_service.cpp | 23 +- .../bcat/delivery_cache_file_service.h | 4 + .../bcat/delivery_cache_progress_service.cpp | 19 +- .../bcat/delivery_cache_progress_service.h | 4 + .../bcat/delivery_cache_storage_service.cpp | 20 +- .../bcat/delivery_cache_storage_service.h | 4 + .../bcat/news/newly_arrived_event_holder.cpp | 22 +- .../bcat/news/newly_arrived_event_holder.h | 4 + .../service/bcat/news/news_data_service.cpp | 19 +- .../hle/service/bcat/news/news_data_service.h | 3 +- .../bcat/news/news_database_service.cpp | 25 +- .../service/bcat/news/news_database_service.h | 4 +- .../hle/service/bcat/news/news_service.cpp | 52 +- src/core/hle/service/bcat/news/news_service.h | 11 +- .../bcat/news/overwrite_event_holder.cpp | 21 +- .../bcat/news/overwrite_event_holder.h | 4 + .../hle/service/bcat/news/service_creator.cpp | 25 +- .../hle/service/bcat/news/service_creator.h | 4 + src/core/hle/service/bcat/service_creator.cpp | 26 +- src/core/hle/service/bcat/service_creator.h | 4 + src/core/hle/service/bpc/bpc.cpp | 138 +- src/core/hle/service/btdrv/btdrv.cpp | 310 +-- src/core/hle/service/btm/btm.cpp | 497 ++++- src/core/hle/service/btm/btm_debug.cpp | 40 - src/core/hle/service/btm/btm_debug.h | 21 - src/core/hle/service/btm/btm_system.cpp | 34 - src/core/hle/service/btm/btm_system.h | 25 - src/core/hle/service/btm/btm_system_core.cpp | 135 -- src/core/hle/service/btm/btm_system_core.h | 62 - src/core/hle/service/btm/btm_user.cpp | 33 - src/core/hle/service/btm/btm_user.h | 25 - src/core/hle/service/btm/btm_user_core.cpp | 106 - src/core/hle/service/btm/btm_user_core.h | 47 - src/core/hle/service/caps/caps.cpp | 218 +- src/core/hle/service/caps/caps_a.cpp | 211 -- src/core/hle/service/caps/caps_a.h | 63 - src/core/hle/service/caps/caps_c.cpp | 50 +- src/core/hle/service/caps/caps_c.h | 12 +- src/core/hle/service/caps/caps_sc.cpp | 29 +- src/core/hle/service/caps/caps_sc.h | 29 + src/core/hle/service/caps/caps_ss.cpp | 26 +- src/core/hle/service/caps/caps_ss.h | 4 + src/core/hle/service/caps/caps_su.cpp | 22 +- src/core/hle/service/caps/caps_su.h | 5 +- src/core/hle/service/caps/caps_u.cpp | 40 +- src/core/hle/service/caps/caps_u.h | 4 + src/core/hle/service/erpt/erpt.cpp | 64 +- src/core/hle/service/es/es.cpp | 342 +-- src/core/hle/service/eupld/eupld.cpp | 47 +- src/core/hle/service/fatal/fatal.cpp | 31 +- src/core/hle/service/fatal/fatal_p.cpp | 19 - src/core/hle/service/fatal/fatal_p.h | 16 - src/core/hle/service/fatal/fatal_u.cpp | 20 - src/core/hle/service/fatal/fatal_u.h | 16 - src/core/hle/service/fgm/fgm.cpp | 52 +- .../service/filesystem/fsp/fs_i_directory.cpp | 16 +- .../service/filesystem/fsp/fs_i_directory.h | 5 + .../hle/service/filesystem/fsp/fs_i_file.cpp | 12 - .../hle/service/filesystem/fsp/fs_i_file.h | 16 + .../filesystem/fsp/fs_i_filesystem.cpp | 43 +- .../service/filesystem/fsp/fs_i_filesystem.h | 1 + .../fsp/fs_i_multi_commit_manager.cpp | 8 +- .../fsp/fs_i_multi_commit_manager.h | 10 + .../fsp/fs_i_save_data_info_reader.cpp | 7 +- .../fsp/fs_i_save_data_info_reader.h | 9 + .../service/filesystem/fsp/fs_i_storage.cpp | 9 - .../hle/service/filesystem/fsp/fs_i_storage.h | 18 +- .../hle/service/filesystem/fsp/fsp_ldr.cpp | 12 +- src/core/hle/service/filesystem/fsp/fsp_ldr.h | 12 + .../hle/service/filesystem/fsp/fsp_pr.cpp | 13 +- src/core/hle/service/filesystem/fsp/fsp_pr.h | 13 + .../hle/service/filesystem/fsp/fsp_srv.cpp | 271 ++- src/core/hle/service/filesystem/fsp/fsp_srv.h | 1 + src/core/hle/service/friend/friend.cpp | 378 ++-- .../hle/service/friend/friend_interface.cpp | 20 - .../hle/service/friend/friend_interface.h | 16 - src/core/hle/service/glue/arp.cpp | 42 +- src/core/hle/service/glue/arp.h | 26 + src/core/hle/service/glue/bgtc.cpp | 43 +- src/core/hle/service/glue/bgtc.h | 42 + src/core/hle/service/glue/ectx.cpp | 38 +- src/core/hle/service/glue/ectx.h | 26 + src/core/hle/service/glue/notif.cpp | 96 +- src/core/hle/service/glue/notif.h | 5 + src/core/hle/service/glue/time/static.cpp | 59 +- src/core/hle/service/glue/time/static.h | 6 +- src/core/hle/service/glue/time/time_zone.cpp | 40 +- src/core/hle/service/glue/time/time_zone.h | 1 + src/core/hle/service/gpio/gpio.cpp | 16 +- src/core/hle/service/grc/grc.cpp | 39 +- .../hid/active_vibration_device_list.cpp | 14 +- .../hid/active_vibration_device_list.h | 5 +- src/core/hle/service/hid/applet_resource.cpp | 11 +- src/core/hle/service/hid/applet_resource.h | 4 + src/core/hle/service/hid/hid.cpp | 365 +++- src/core/hle/service/hid/hid_debug_server.cpp | 296 +-- src/core/hle/service/hid/hid_debug_server.h | 29 +- src/core/hle/service/hid/hid_server.cpp | 396 ++-- src/core/hle/service/hid/hid_server.h | 2 + .../hle/service/hid/hid_system_server.cpp | 246 --- src/core/hle/service/hid/hid_system_server.h | 249 +++ src/core/hle/service/hid/hidbus.cpp | 42 +- src/core/hle/service/hid/hidbus.h | 5 + src/core/hle/service/hid/irs.cpp | 58 +- src/core/hle/service/hid/irs.h | 15 + src/core/hle/service/hid/xcd.cpp | 30 +- src/core/hle/service/hid/xcd.h | 30 + src/core/hle/service/i2c/i2c.cpp | 54 +- src/core/hle/service/jit/jit.cpp | 37 +- src/core/hle/service/lbl/lbl.cpp | 71 +- src/core/hle/service/ldn/ldn.cpp | 138 +- src/core/hle/service/ldn/monitor_service.cpp | 31 +- src/core/hle/service/ldn/monitor_service.h | 4 + .../hle/service/ldn/sf_monitor_service.cpp | 21 +- src/core/hle/service/ldn/sf_monitor_service.h | 4 + src/core/hle/service/ldn/sf_service.cpp | 37 - src/core/hle/service/ldn/sf_service.h | 21 - .../hle/service/ldn/sf_service_monitor.cpp | 41 +- src/core/hle/service/ldn/sf_service_monitor.h | 7 +- .../system_local_communication_service.cpp | 75 +- .../ldn/system_local_communication_service.h | 4 + .../ldn/user_local_communication_service.cpp | 72 +- .../ldn/user_local_communication_service.h | 3 +- src/core/hle/service/ldr/ldr.cpp | 53 +- src/core/hle/service/lm/lm.cpp | 55 +- src/core/hle/service/mig/mig.cpp | 86 +- src/core/hle/service/mii/mii.cpp | 134 +- src/core/hle/service/mii/mii.h | 4 + src/core/hle/service/mm/mm_u.cpp | 27 +- src/core/hle/service/mnpp/mnpp.cpp | 62 +- src/core/hle/service/ncm/ncm.cpp | 220 +- src/core/hle/service/nfc/nfc.cpp | 230 +- src/core/hle/service/nfp/nfp.cpp | 266 ++- src/core/hle/service/ngc/ngc.cpp | 160 +- src/core/hle/service/nifm/nifm.cpp | 227 +- src/core/hle/service/nifm/nifm.h | 3 +- src/core/hle/service/nim/nim.cpp | 681 +++--- src/core/hle/service/npns/npns.cpp | 196 +- .../service/ns/account_proxy_interface.cpp | 10 +- .../hle/service/ns/account_proxy_interface.h | 10 + .../ns/application_manager_interface.cpp | 904 ++++---- .../ns/application_manager_interface.h | 1 + .../ns/application_version_interface.cpp | 22 +- .../ns/application_version_interface.h | 22 + src/core/hle/service/ns/async_result.cpp | 18 +- src/core/hle/service/ns/async_result.h | 1 + .../ns/content_management_interface.cpp | 16 - .../service/ns/content_management_interface.h | 16 + src/core/hle/service/ns/develop_interface.cpp | 28 +- src/core/hle/service/ns/develop_interface.h | 28 + .../hle/service/ns/document_interface.cpp | 12 +- src/core/hle/service/ns/document_interface.h | 12 + .../service/ns/download_task_interface.cpp | 18 +- .../hle/service/ns/download_task_interface.h | 18 + .../service/ns/dynamic_rights_interface.cpp | 70 +- .../hle/service/ns/dynamic_rights_interface.h | 2 + .../hle/service/ns/ecommerce_interface.cpp | 16 +- src/core/hle/service/ns/ecommerce_interface.h | 16 + .../service/ns/factory_reset_interface.cpp | 29 +- .../hle/service/ns/factory_reset_interface.h | 4 + src/core/hle/service/ns/ns.cpp | 63 +- .../service/ns/platform_service_manager.cpp | 44 +- .../hle/service/ns/platform_service_manager.h | 12 +- src/core/hle/service/ns/query_service.cpp | 64 +- src/core/hle/service/ns/query_service.h | 1 + ...nly_application_control_data_interface.cpp | 48 +- ..._only_application_control_data_interface.h | 2 + ...read_only_application_record_interface.cpp | 19 +- .../read_only_application_record_interface.h | 4 +- .../service/ns/service_getter_interface.cpp | 37 +- .../hle/service/ns/service_getter_interface.h | 5 + .../hle/service/ns/system_update_control.cpp | 32 +- .../hle/service/ns/system_update_control.h | 32 + .../service/ns/system_update_interface.cpp | 49 +- .../hle/service/ns/system_update_interface.h | 5 +- src/core/hle/service/nvdrv/nvdrv.cpp | 74 +- .../hle/service/nvdrv/nvdrv_interface.cpp | 18 - src/core/hle/service/nvdrv/nvdrv_interface.h | 24 +- src/core/hle/service/nvdrv/nvmemp.cpp | 5 - src/core/hle/service/nvdrv/nvmemp.h | 11 + .../service/nvnflinger/hos_binder_driver.cpp | 20 +- .../service/nvnflinger/hos_binder_driver.h | 1 + .../hle/service/olsc/daemon_controller.cpp | 36 +- src/core/hle/service/olsc/daemon_controller.h | 2 + .../hle/service/olsc/native_handle_holder.cpp | 14 +- .../hle/service/olsc/native_handle_holder.h | 1 + src/core/hle/service/olsc/olsc.cpp | 173 +- .../olsc/olsc_service_for_application.cpp | 59 +- .../olsc/olsc_service_for_application.h | 2 + .../olsc/olsc_service_for_system_service.cpp | 144 -- .../olsc/olsc_service_for_system_service.h | 53 - .../olsc/remote_storage_controller.cpp | 72 +- .../service/olsc/remote_storage_controller.h | 2 + .../olsc/transfer_task_list_controller.cpp | 74 +- .../olsc/transfer_task_list_controller.h | 2 + .../service/omm/operation_mode_manager.cpp | 38 +- .../hle/service/omm/operation_mode_manager.h | 38 + .../hle/service/omm/policy_manager_system.cpp | 15 +- .../hle/service/omm/policy_manager_system.h | 15 + .../hle/service/omm/power_state_interface.cpp | 21 +- .../hle/service/omm/power_state_interface.h | 21 + src/core/hle/service/pcie/pcie.cpp | 90 +- .../service/pctl/parental_control_service.cpp | 498 ----- .../service/pctl/parental_control_service.h | 99 - .../pctl/parental_control_service_factory.cpp | 44 - .../pctl/parental_control_service_factory.h | 31 - src/core/hle/service/pctl/pctl.cpp | 636 +++++- src/core/hle/service/pctl/pctl_results.h | 15 - src/core/hle/service/pctl/pctl_types.h | 73 - src/core/hle/service/pcv/pcv.cpp | 172 +- src/core/hle/service/pm/pm.cpp | 100 +- src/core/hle/service/prepo/prepo.cpp | 91 +- src/core/hle/service/psc/ovln/receiver.cpp | 118 - src/core/hle/service/psc/ovln/receiver.h | 46 - .../hle/service/psc/ovln/receiver_service.cpp | 123 +- .../hle/service/psc/ovln/receiver_service.h | 5 + src/core/hle/service/psc/ovln/sender.cpp | 32 - src/core/hle/service/psc/ovln/sender.h | 21 - .../hle/service/psc/ovln/sender_service.cpp | 43 +- .../hle/service/psc/ovln/sender_service.h | 8 +- src/core/hle/service/psc/pm_control.cpp | 28 - src/core/hle/service/psc/pm_control.h | 16 - src/core/hle/service/psc/pm_module.cpp | 24 - src/core/hle/service/psc/pm_module.h | 16 - src/core/hle/service/psc/pm_service.cpp | 28 - src/core/hle/service/psc/pm_service.h | 22 - src/core/hle/service/psc/psc.cpp | 181 +- src/core/hle/service/psc/time/alarms.cpp | 24 +- src/core/hle/service/psc/time/alarms.h | 21 +- src/core/hle/service/psc/time/manager.h | 31 +- .../service/psc/time/power_state_service.cpp | 19 +- .../service/psc/time/power_state_service.h | 1 + .../hle/service/psc/time/service_manager.cpp | 48 +- .../hle/service/psc/time/service_manager.h | 2 + src/core/hle/service/psc/time/static.cpp | 50 +- src/core/hle/service/psc/time/static.h | 2 + .../hle/service/psc/time/steady_clock.cpp | 28 +- src/core/hle/service/psc/time/steady_clock.h | 2 + .../hle/service/psc/time/system_clock.cpp | 24 +- src/core/hle/service/psc/time/system_clock.h | 1 + .../service/psc/time/time_zone_service.cpp | 42 +- .../hle/service/psc/time/time_zone_service.h | 1 + src/core/hle/service/ptm/psm.cpp | 53 +- src/core/hle/service/ptm/psm.h | 25 + src/core/hle/service/ptm/ptm.cpp | 32 +- src/core/hle/service/ptm/ts.cpp | 29 +- src/core/hle/service/ptm/ts.h | 14 + src/core/hle/service/ro/ro.cpp | 371 +++- src/core/hle/service/ro/ro_nro_utils.cpp | 185 -- src/core/hle/service/ro/ro_nro_utils.h | 26 - src/core/hle/service/ro/ro_results.h | 29 - src/core/hle/service/ro/ro_types.h | 142 -- src/core/hle/service/service.cpp | 69 +- src/core/hle/service/service.h | 145 +- .../service/set/factory_settings_server.cpp | 52 +- .../hle/service/set/factory_settings_server.h | 52 + .../set/firmware_debug_settings_server.cpp | 19 +- .../set/firmware_debug_settings_server.h | 20 + src/core/hle/service/set/settings_server.cpp | 38 +- src/core/hle/service/set/settings_server.h | 25 +- .../service/set/system_settings_server.cpp | 465 ++-- .../hle/service/set/system_settings_server.h | 2 +- src/core/hle/service/sm/sm.cpp | 205 +- src/core/hle/service/sm/sm.h | 24 +- src/core/hle/service/sm/sm_controller.cpp | 128 -- src/core/hle/service/sm/sm_controller.h | 27 - src/core/hle/service/sockets/bsd.cpp | 81 - src/core/hle/service/sockets/bsd.h | 81 + src/core/hle/service/sockets/nsd.cpp | 32 - src/core/hle/service/sockets/nsd.h | 32 + src/core/hle/service/sockets/sfdnsres.cpp | 27 - src/core/hle/service/sockets/sfdnsres.h | 31 + src/core/hle/service/sockets/sockets.cpp | 62 +- src/core/hle/service/spl/spl.cpp | 171 +- src/core/hle/service/spl/spl.h | 141 ++ src/core/hle/service/spl/spl_module.cpp | 15 +- src/core/hle/service/ssl/ssl.cpp | 395 ++-- src/core/hle/service/tma/tma.cpp | 12 +- src/core/hle/service/usb/usb.cpp | 290 ++- .../vi/application_display_service.cpp | 56 +- .../service/vi/application_display_service.h | 2 +- .../service/vi/application_root_service.cpp | 16 +- .../hle/service/vi/application_root_service.h | 4 + .../service/vi/manager_display_service.cpp | 176 +- .../hle/service/vi/manager_display_service.h | 3 +- .../hle/service/vi/manager_root_service.cpp | 24 +- .../hle/service/vi/manager_root_service.h | 4 + .../hle/service/vi/shared_buffer_manager.h | 4 + .../hle/service/vi/system_display_service.cpp | 112 +- .../hle/service/vi/system_display_service.h | 1 + .../hle/service/vi/system_root_service.cpp | 20 +- src/core/hle/service/vi/system_root_service.h | 4 + src/core/hle/service/wlan/wlan.cpp | 368 ++-- tools/README.md | 2 +- 392 files changed, 12860 insertions(+), 14029 deletions(-) rename docs/{HosKernel.md => SubsystemHLE.md} (55%) delete mode 100644 src/core/hle/service/am/service/all_system_applet_proxies_service.cpp delete mode 100644 src/core/hle/service/am/service/all_system_applet_proxies_service.h delete mode 100644 src/core/hle/service/am/service/applet_common_functions.cpp delete mode 100644 src/core/hle/service/am/service/applet_common_functions.h delete mode 100644 src/core/hle/service/am/service/application_proxy.cpp delete mode 100644 src/core/hle/service/am/service/application_proxy.h delete mode 100644 src/core/hle/service/am/service/application_proxy_service.cpp delete mode 100644 src/core/hle/service/am/service/application_proxy_service.h delete mode 100644 src/core/hle/service/am/service/debug_functions.cpp delete mode 100644 src/core/hle/service/am/service/debug_functions.h delete mode 100644 src/core/hle/service/am/service/library_applet_creator.cpp delete mode 100644 src/core/hle/service/am/service/library_applet_creator.h delete mode 100644 src/core/hle/service/am/service/library_applet_proxy.cpp delete mode 100644 src/core/hle/service/am/service/library_applet_proxy.h delete mode 100644 src/core/hle/service/am/service/library_applet_self_accessor.cpp delete mode 100644 src/core/hle/service/am/service/library_applet_self_accessor.h delete mode 100644 src/core/hle/service/am/service/lock_accessor.cpp delete mode 100644 src/core/hle/service/am/service/lock_accessor.h delete mode 100644 src/core/hle/service/am/service/overlay_applet_proxy.cpp delete mode 100644 src/core/hle/service/am/service/overlay_applet_proxy.h delete mode 100644 src/core/hle/service/am/service/storage_accessor.cpp delete mode 100644 src/core/hle/service/am/service/storage_accessor.h delete mode 100644 src/core/hle/service/am/service/system_applet_proxy.cpp delete mode 100644 src/core/hle/service/am/service/system_applet_proxy.h delete mode 100644 src/core/hle/service/btm/btm_debug.cpp delete mode 100644 src/core/hle/service/btm/btm_debug.h delete mode 100644 src/core/hle/service/btm/btm_system.cpp delete mode 100644 src/core/hle/service/btm/btm_system.h delete mode 100644 src/core/hle/service/btm/btm_system_core.cpp delete mode 100644 src/core/hle/service/btm/btm_system_core.h delete mode 100644 src/core/hle/service/btm/btm_user.cpp delete mode 100644 src/core/hle/service/btm/btm_user.h delete mode 100644 src/core/hle/service/btm/btm_user_core.cpp delete mode 100644 src/core/hle/service/btm/btm_user_core.h delete mode 100644 src/core/hle/service/caps/caps_a.cpp delete mode 100644 src/core/hle/service/caps/caps_a.h delete mode 100644 src/core/hle/service/fatal/fatal_p.cpp delete mode 100644 src/core/hle/service/fatal/fatal_p.h delete mode 100644 src/core/hle/service/fatal/fatal_u.cpp delete mode 100644 src/core/hle/service/fatal/fatal_u.h delete mode 100644 src/core/hle/service/friend/friend_interface.cpp delete mode 100644 src/core/hle/service/friend/friend_interface.h delete mode 100644 src/core/hle/service/ldn/sf_service.cpp delete mode 100644 src/core/hle/service/ldn/sf_service.h delete mode 100644 src/core/hle/service/olsc/olsc_service_for_system_service.cpp delete mode 100644 src/core/hle/service/olsc/olsc_service_for_system_service.h delete mode 100644 src/core/hle/service/pctl/parental_control_service.cpp delete mode 100644 src/core/hle/service/pctl/parental_control_service.h delete mode 100644 src/core/hle/service/pctl/parental_control_service_factory.cpp delete mode 100644 src/core/hle/service/pctl/parental_control_service_factory.h delete mode 100644 src/core/hle/service/pctl/pctl_results.h delete mode 100644 src/core/hle/service/pctl/pctl_types.h delete mode 100644 src/core/hle/service/psc/ovln/receiver.cpp delete mode 100644 src/core/hle/service/psc/ovln/receiver.h delete mode 100644 src/core/hle/service/psc/ovln/sender.cpp delete mode 100644 src/core/hle/service/psc/ovln/sender.h delete mode 100644 src/core/hle/service/psc/pm_control.cpp delete mode 100644 src/core/hle/service/psc/pm_control.h delete mode 100644 src/core/hle/service/psc/pm_module.cpp delete mode 100644 src/core/hle/service/psc/pm_module.h delete mode 100644 src/core/hle/service/psc/pm_service.cpp delete mode 100644 src/core/hle/service/psc/pm_service.h delete mode 100644 src/core/hle/service/ro/ro_nro_utils.cpp delete mode 100644 src/core/hle/service/ro/ro_nro_utils.h delete mode 100644 src/core/hle/service/ro/ro_results.h delete mode 100644 src/core/hle/service/ro/ro_types.h delete mode 100644 src/core/hle/service/sm/sm_controller.cpp delete mode 100644 src/core/hle/service/sm/sm_controller.h diff --git a/docs/DesignOverview.md b/docs/DesignOverview.md index c6a328cb9c..959fbfdbb2 100644 --- a/docs/DesignOverview.md +++ b/docs/DesignOverview.md @@ -1,6 +1,6 @@ # Design Overview -Modern game consoles require heavy power to be emulated appropriately. This is why the emulator uses an approach known as HLE (High-Level-Emulation), in a nutshell: Instead of accurately emulating every subsystem that forms part of a component, emulate the resulting visible I/O interface instead. +Modern game consoles require heavy power to emulate. This is why the emulator uses an approach known as HLE (High-Level-Emulation), in a nutshell: Instead of accurately emulating every subsystem that forms part of a component, emulate the resulting visible output of said interface instead. For example, take a disk write, instead of emulating a proper SD card we instead use the C++ standard library for I/O. Additionally we use the abstractions provided by the `fs` service to "lie" to programs about certain SD card properties. Notably this includes making up sizes for the fake SD card, giving "realistic" values or expected outputs for a given card, and so on. And instead of writing to an actual SD card, the emulator simply writes to a file. diff --git a/docs/README.md b/docs/README.md index 5bcaf30239..f7568e16f3 100644 --- a/docs/README.md +++ b/docs/README.md @@ -21,7 +21,7 @@ This contains documentation created by developers, build instructions, guideline - Subsystems: - **[Design Overview](./DesignOverview.md)** - **[Dynarmic](./dynarmic/README.md)** - - **[HOS Kernel](./HosKernel.md)** + - **[Subsystem: HLE](./SubsystemHLE.md)** - **[Settings](./Settings.md)** ## Policies diff --git a/docs/HosKernel.md b/docs/SubsystemHLE.md similarity index 55% rename from docs/HosKernel.md rename to docs/SubsystemHLE.md index 87df2072a5..7a59fef9fa 100644 --- a/docs/HosKernel.md +++ b/docs/SubsystemHLE.md @@ -1,4 +1,6 @@ -# HOS Kernel +# Subsystem: HLE + +## HOS Kernel In brief, the HOS kernel is a microkernel, all services and programs run in userspace, the primary way to do communication between these is via `HIPC` (not covered here); otherwise most of the primitives reside in the forms of syscalls invoked via `svc #imm`. The kernel supports both 32-bit and 64-bit programs, and has the capacity to use 32, 36 and 39 bits of address space for spawned processes. Most of the networking stack is based off FreeBSD's network stack. @@ -29,3 +31,52 @@ Every process keeps it's own tracking of the following structures: The emulator willingly restricts itself to only use 4 threads (to emulate 4 cores), this is because most existing applications do not benefit greatly from the added core count, and in fact can be detrimental due to extra contention. This translates equitatively to about 4 `ArmInterface` slots for each process, these are then redirected to whatever is the last `pc` of the last thread running on the core is meant to be; proceed to run it, then when returning (due to halt or interruption), proceed to reschedule the thread. The scheduler as-is isn't 100% faithful to the original (for example the original is cooperative and not preemptive), and has great timing variance (especially due to the fact the emulator can run in systems with wildly different timings). + +## Services + +Consult [SwitchBrew](https://switchbrew.org/) for per-service methods, and implementation details. + +All services are instatiated implicitly using `ServiceFramework`. To register a new interface or service, you can inherit from said class, providing additionally a template parameter that references `Self`, for example: + +```c++ +// Follows as: +// class MyInterface [final] : public ServiceFramework { ... }; +// [final] is optional, but should be used whenever there is no intention of this class itself being inherited. +class IFloatingRegistrationRequest final : public ServiceFramework { +public: + // ctor, you can pass extra parameters here (if so required) + explicit IFloatingRegistrationRequest(Core::System& system_) + : ServiceFramework{system_, "IFloatingRegistrationRequest"} + {} + + // Must be placed after all methods are defined (or declared). + // Define here your functions and methods, please order them. + // Use FindRequestTipc for TIPC handlers. + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetSessionId"}, + FunctionInfo{12, nullptr, "GetAccountId"}, + FunctionInfo{13, nullptr, "GetLinkedNintendoAccountId"}, + FunctionInfo{14, nullptr, "GetNickname"}, + FunctionInfo{15, nullptr, "GetProfileImage"}, + FunctionInfo{16, nullptr, "GetProfileLargeImage", MakeVersionGate({18,0,0})}, + FunctionInfo{21, nullptr, "LoadIdTokenCache"}, + FunctionInfo{100, nullptr, "RegisterUser"}, + FunctionInfo{101, nullptr, "RegisterUserWithUid"}, + FunctionInfo{102, nullptr, "RegisterNetworkServiceAccountAsync", MakeVersionGate({4,0,0})}, + FunctionInfo{103, nullptr, "RegisterNetworkServiceAccountWithUidAsync", MakeVersionGate({4,0,0})}, + FunctionInfo{110, nullptr, "SetSystemProgramIdentification"}, + FunctionInfo{111, nullptr, "EnsureIdTokenCacheAsync"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } +}; +``` + +Try to keep service structures local, that is, don't place them on header files if they're only going to be used by a specific service. + +In each `.cpp` file that uses `D<...>/C<...>` CMIF wrapper helpers, remember to include the corresponding instancer, so you don't face linker errors: +```c++ +#include "core/hle/service/cmif_serialization.h" +``` +This will properly instatiate the corresponding wrappers and decompose the provided arguments in the wiring order. diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 31f9931d3a..f1d4bdae42 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -444,28 +444,18 @@ add_library(core STATIC hle/service/am/process_creation.h hle/service/am/process_holder.cpp hle/service/am/process_holder.h - hle/service/am/service/all_system_applet_proxies_service.cpp - hle/service/am/service/all_system_applet_proxies_service.h - hle/service/am/service/applet_common_functions.cpp - hle/service/am/service/applet_common_functions.h hle/service/am/service/application_accessor.cpp hle/service/am/service/application_accessor.h hle/service/am/service/application_creator.cpp hle/service/am/service/application_creator.h hle/service/am/service/application_functions.cpp hle/service/am/service/application_functions.h - hle/service/am/service/application_proxy.cpp - hle/service/am/service/application_proxy.h - hle/service/am/service/application_proxy_service.cpp - hle/service/am/service/application_proxy_service.h hle/service/am/service/audio_controller.cpp hle/service/am/service/audio_controller.h hle/service/am/service/common_state_getter.cpp hle/service/am/service/common_state_getter.h hle/service/am/service/cradle_firmware_updater.cpp hle/service/am/service/cradle_firmware_updater.h - hle/service/am/service/debug_functions.cpp - hle/service/am/service/debug_functions.h hle/service/am/service/display_controller.cpp hle/service/am/service/display_controller.h hle/service/am/service/global_state_controller.cpp @@ -474,28 +464,14 @@ add_library(core STATIC hle/service/am/service/home_menu_functions.h hle/service/am/service/library_applet_accessor.cpp hle/service/am/service/library_applet_accessor.h - hle/service/am/service/library_applet_creator.cpp - hle/service/am/service/library_applet_creator.h - hle/service/am/service/library_applet_proxy.cpp - hle/service/am/service/library_applet_proxy.h - hle/service/am/service/library_applet_self_accessor.cpp - hle/service/am/service/library_applet_self_accessor.h - hle/service/am/service/lock_accessor.cpp - hle/service/am/service/lock_accessor.h hle/service/am/service/overlay_functions.cpp hle/service/am/service/overlay_functions.h - hle/service/am/service/overlay_applet_proxy.cpp - hle/service/am/service/overlay_applet_proxy.h hle/service/am/service/process_winding_controller.cpp hle/service/am/service/process_winding_controller.h hle/service/am/service/self_controller.cpp hle/service/am/service/self_controller.h hle/service/am/service/storage.cpp hle/service/am/service/storage.h - hle/service/am/service/storage_accessor.cpp - hle/service/am/service/storage_accessor.h - hle/service/am/service/system_applet_proxy.cpp - hle/service/am/service/system_applet_proxy.h hle/service/am/service/window_controller.cpp hle/service/am/service/window_controller.h hle/service/am/window_system.cpp @@ -580,20 +556,8 @@ add_library(core STATIC hle/service/btdrv/btdrv.h hle/service/btm/btm.cpp hle/service/btm/btm.h - hle/service/btm/btm_debug.cpp - hle/service/btm/btm_debug.h - hle/service/btm/btm_system.cpp - hle/service/btm/btm_system.h - hle/service/btm/btm_system_core.cpp - hle/service/btm/btm_system_core.h - hle/service/btm/btm_user.cpp - hle/service/btm/btm_user.h - hle/service/btm/btm_user_core.cpp - hle/service/btm/btm_user_core.h hle/service/caps/caps.cpp hle/service/caps/caps.h - hle/service/caps/caps_a.cpp - hle/service/caps/caps_a.h hle/service/caps/caps_c.cpp hle/service/caps/caps_c.h hle/service/caps/caps_manager.cpp @@ -618,10 +582,6 @@ add_library(core STATIC hle/service/eupld/eupld.h hle/service/fatal/fatal.cpp hle/service/fatal/fatal.h - hle/service/fatal/fatal_p.cpp - hle/service/fatal/fatal_p.h - hle/service/fatal/fatal_u.cpp - hle/service/fatal/fatal_u.h hle/service/fgm/fgm.cpp hle/service/fgm/fgm.h hle/service/filesystem/filesystem.cpp @@ -653,8 +613,6 @@ add_library(core STATIC hle/service/filesystem/save_data_controller.h hle/service/friend/friend.cpp hle/service/friend/friend.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 @@ -723,8 +681,6 @@ add_library(core STATIC hle/service/ldn/monitor_service.h hle/service/ldn/sf_monitor_service.cpp hle/service/ldn/sf_monitor_service.h - hle/service/ldn/sf_service.cpp - hle/service/ldn/sf_service.h hle/service/ldn/sf_service_monitor.cpp hle/service/ldn/sf_service_monitor.h hle/service/ldn/system_local_communication_service.cpp @@ -913,8 +869,6 @@ add_library(core STATIC hle/service/olsc/native_handle_holder.h hle/service/olsc/olsc_service_for_application.cpp hle/service/olsc/olsc_service_for_application.h - hle/service/olsc/olsc_service_for_system_service.cpp - hle/service/olsc/olsc_service_for_system_service.h hle/service/olsc/olsc.cpp hle/service/olsc/olsc.h hle/service/olsc/remote_storage_controller.cpp @@ -944,14 +898,8 @@ add_library(core STATIC hle/service/os/process.h hle/service/pcie/pcie.cpp hle/service/pcie/pcie.h - hle/service/pctl/parental_control_service_factory.cpp - hle/service/pctl/parental_control_service_factory.h - hle/service/pctl/parental_control_service.cpp - hle/service/pctl/parental_control_service.h hle/service/pctl/pctl.cpp hle/service/pctl/pctl.h - hle/service/pctl/pctl_results.h - hle/service/pctl/pctl_types.h hle/service/pcv/pcv.cpp hle/service/pcv/pcv.h hle/service/pm/pm.cpp @@ -961,18 +909,8 @@ add_library(core STATIC hle/service/psc/ovln/ovln_types.h hle/service/psc/ovln/receiver_service.cpp hle/service/psc/ovln/receiver_service.h - hle/service/psc/ovln/receiver.cpp - hle/service/psc/ovln/receiver.h hle/service/psc/ovln/sender_service.cpp hle/service/psc/ovln/sender_service.h - hle/service/psc/ovln/sender.cpp - hle/service/psc/ovln/sender.h - hle/service/psc/pm_control.cpp - hle/service/psc/pm_control.h - hle/service/psc/pm_module.cpp - hle/service/psc/pm_module.h - hle/service/psc/pm_service.cpp - hle/service/psc/pm_service.h hle/service/psc/psc.cpp hle/service/psc/psc.h hle/service/psc/time/alarms.cpp @@ -1023,10 +961,6 @@ add_library(core STATIC hle/service/ptm/ts.h hle/service/ro/ro.cpp hle/service/ro/ro.h - hle/service/ro/ro_nro_utils.cpp - hle/service/ro/ro_nro_utils.h - hle/service/ro/ro_results.h - hle/service/ro/ro_types.h hle/service/server_manager.cpp hle/service/server_manager.h hle/service/service.cpp @@ -1055,8 +989,6 @@ add_library(core STATIC hle/service/set/system_settings_server.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/nsd.cpp @@ -1222,7 +1154,7 @@ target_link_libraries(core PRIVATE RenderDoc::API ZLIB::ZLIB) -target_link_libraries(core PUBLIC httplib::httplib zstd::zstd) +target_link_libraries(core PUBLIC httplib::httplib zstd::zstd frozen::frozen-headers) if (ENABLE_WEB_SERVICE) target_compile_definitions(core PUBLIC ENABLE_WEB_SERVICE) diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index d68b6bde0d..9b29a7773c 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -75,41 +75,6 @@ class IManagerForSystemService final : public ServiceFramework, "CheckAvailability"}, - {1, D<&IManagerForSystemService::GetAccountId>, "GetAccountId"}, - {2, nullptr, "EnsureIdTokenCacheAsync"}, - {3, D<&IManagerForSystemService::LoadIdTokenCacheDeprecated>, "LoadIdTokenCacheDeprecated"}, // 19.0.0+ - {4, D<&IManagerForSystemService::LoadIdTokenCache>, "LoadIdTokenCache"}, // 19.0.0+ - {100, nullptr, "SetSystemProgramIdentification"}, - {101, nullptr, "RefreshNotificationTokenAsync"}, // 7.0.0+ - {110, nullptr, "GetServiceEntryRequirementCache"}, // 4.0.0+ - {111, nullptr, "InvalidateServiceEntryRequirementCache"}, // 4.0.0+ - {112, nullptr, "InvalidateTokenCache"}, // 4.0.0 - 6.2.0 - {113, nullptr, "GetServiceEntryRequirementCacheForOnlinePlay"}, // 6.1.0+ - {120, nullptr, "GetNintendoAccountId"}, - {121, nullptr, "CalculateNintendoAccountAuthenticationFingerprint"}, // 9.0.0+ - {130, nullptr, "GetNintendoAccountUserResourceCache"}, - {131, nullptr, "RefreshNintendoAccountUserResourceCacheAsync"}, - {132, nullptr, "RefreshNintendoAccountUserResourceCacheAsyncIfSecondsElapsed"}, - {133, nullptr, "GetNintendoAccountVerificationUrlCache"}, // 9.0.0+ - {134, nullptr, "RefreshNintendoAccountVerificationUrlCache"}, // 9.0.0+ - {135, nullptr, "RefreshNintendoAccountVerificationUrlCacheAsyncIfSecondsElapsed"}, // 9.0.0+ - {136, nullptr, "GetNintendoAccountUserResourceCache"}, // 19.0.0+ - {140, nullptr, "GetNetworkServiceLicenseCache"}, // 5.0.0+ - {141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+ - {142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+ - {143, D<&IManagerForSystemService::GetNetworkServiceLicenseCacheEx>, "GetNetworkServiceLicenseCacheEx"}, // 15.0.0+ - {150, nullptr, "CreateAuthorizationRequest"}, - {160, nullptr, "RequiresUpdateNetworkServiceAccountIdTokenCache"}, - {161, nullptr, "RequireReauthenticationOfNetworkServiceAccount"}, - {170, nullptr, "CreateDeviceHistoryRequest"}, // 17.0.0+ - {180, nullptr, "GetRequestForNintendoAccountReauthentication"} // 18.0.0+ - }; - // clang-format on - - RegisterHandlers(functions); } private: @@ -143,6 +108,40 @@ private: R_SUCCEED(); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IManagerForSystemService::CheckAvailability>, "CheckAvailability"}, + FunctionInfo{1, D<&IManagerForSystemService::GetAccountId>, "GetAccountId"}, + FunctionInfo{2, nullptr, "EnsureIdTokenCacheAsync"}, + FunctionInfo{3, D<&IManagerForSystemService::LoadIdTokenCacheDeprecated>, "LoadIdTokenCacheDeprecated", MakeVersionGate({19,0,0})}, + FunctionInfo{4, D<&IManagerForSystemService::LoadIdTokenCache>, "LoadIdTokenCache", MakeVersionGate({19,0,0})}, + FunctionInfo{100, nullptr, "SetSystemProgramIdentification"}, + FunctionInfo{101, nullptr, "RefreshNotificationTokenAsync", MakeVersionGate({7,0,0})}, + FunctionInfo{110, nullptr, "GetServiceEntryRequirementCache", MakeVersionGate({4,0,0})}, + FunctionInfo{111, nullptr, "InvalidateServiceEntryRequirementCache", MakeVersionGate({4,0,0})}, + FunctionInfo{112, nullptr, "InvalidateTokenCache", MakeVersionGate({4,0,0}, {6,2,0})}, + FunctionInfo{113, nullptr, "GetServiceEntryRequirementCacheForOnlinePlay", MakeVersionGate({6,1,0})}, + FunctionInfo{120, nullptr, "GetNintendoAccountId"}, + FunctionInfo{121, nullptr, "CalculateNintendoAccountAuthenticationFingerprint", MakeVersionGate({9,0,0})}, + FunctionInfo{130, nullptr, "GetNintendoAccountUserResourceCache"}, + FunctionInfo{131, nullptr, "RefreshNintendoAccountUserResourceCacheAsync"}, + FunctionInfo{132, nullptr, "RefreshNintendoAccountUserResourceCacheAsyncIfSecondsElapsed"}, + FunctionInfo{133, nullptr, "GetNintendoAccountVerificationUrlCache", MakeVersionGate({9,0,0})}, + FunctionInfo{134, nullptr, "RefreshNintendoAccountVerificationUrlCache", MakeVersionGate({9,0,0})}, + FunctionInfo{135, nullptr, "RefreshNintendoAccountVerificationUrlCacheAsyncIfSecondsElapsed", MakeVersionGate({9,0,0})}, + FunctionInfo{136, nullptr, "GetNintendoAccountUserResourceCache", MakeVersionGate({19,0,0})}, + FunctionInfo{140, nullptr, "GetNetworkServiceLicenseCache", MakeVersionGate({5,0,0})}, + FunctionInfo{141, nullptr, "RefreshNetworkServiceLicenseCacheAsync", MakeVersionGate({5,0,0})}, + FunctionInfo{142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed", MakeVersionGate({5,0,0})}, + FunctionInfo{143, D<&IManagerForSystemService::GetNetworkServiceLicenseCacheEx>, "GetNetworkServiceLicenseCacheEx", MakeVersionGate({15,0,0})}, + FunctionInfo{150, nullptr, "CreateAuthorizationRequest"}, + FunctionInfo{160, nullptr, "RequiresUpdateNetworkServiceAccountIdTokenCache"}, + FunctionInfo{161, nullptr, "RequireReauthenticationOfNetworkServiceAccount"}, + FunctionInfo{170, nullptr, "CreateDeviceHistoryRequest", MakeVersionGate({17,0,0})}, + FunctionInfo{180, nullptr, "GetRequestForNintendoAccountReauthentication", MakeVersionGate({18,0,0})} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } Common::UUID account_id; }; @@ -151,25 +150,25 @@ class IFloatingRegistrationRequest final : public ServiceFramework FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; @@ -177,62 +176,6 @@ class IAdministrator final : public ServiceFramework { public: explicit IAdministrator(Core::System& system_, Common::UUID) : ServiceFramework{system_, "IAdministrator"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "CheckAvailability"}, - {1, nullptr, "GetAccountId"}, - {2, nullptr, "EnsureIdTokenCacheAsync"}, - {3, nullptr, "LoadIdTokenCache"}, - {100, nullptr, "SetSystemProgramIdentification"}, - {101, nullptr, "RefreshNotificationTokenAsync"}, // 7.0.0+ - {110, nullptr, "GetServiceEntryRequirementCache"}, // 4.0.0+ - {111, nullptr, "InvalidateServiceEntryRequirementCache"}, // 4.0.0+ - {112, nullptr, "InvalidateTokenCache"}, // 4.0.0 - 6.2.0 - {113, nullptr, "GetServiceEntryRequirementCacheForOnlinePlay"}, // 6.1.0+ - {120, nullptr, "GetNintendoAccountId"}, - {121, nullptr, "CalculateNintendoAccountAuthenticationFingerprint"}, // 9.0.0+ - {130, nullptr, "GetNintendoAccountUserResourceCache"}, - {131, nullptr, "RefreshNintendoAccountUserResourceCacheAsync"}, - {132, nullptr, "RefreshNintendoAccountUserResourceCacheAsyncIfSecondsElapsed"}, - {133, nullptr, "GetNintendoAccountVerificationUrlCache"}, // 9.0.0+ - {134, nullptr, "RefreshNintendoAccountVerificationUrlCacheAsync"}, // 9.0.0+ - {135, nullptr, "RefreshNintendoAccountVerificationUrlCacheAsyncIfSecondsElapsed"}, // 9.0.0+ - {140, nullptr, "GetNetworkServiceLicenseCache"}, // 5.0.0+ - {141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+ - {142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+ - {143, nullptr, "GetNetworkServiceLicenseCacheEx"}, - {150, nullptr, "CreateAuthorizationRequest"}, - {160, nullptr, "RequiresUpdateNetworkServiceAccountIdTokenCache"}, - {161, nullptr, "RequireReauthenticationOfNetworkServiceAccount"}, - {170, nullptr, "CreateDeviceHistoryRequest"}, // 17.0.0+ - {180, nullptr, "GetRequestForNintendoAccountReauthentication"}, // 18.0.0+ - {200, nullptr, "IsRegistered"}, - {201, nullptr, "RegisterAsync"}, - {202, nullptr, "UnregisterAsync"}, - {203, nullptr, "DeleteRegistrationInfoLocally"}, - {220, nullptr, "SynchronizeProfileAsync"}, - {221, nullptr, "UploadProfileAsync"}, - {222, nullptr, "SynchronizaProfileAsyncIfSecondsElapsed"}, - {250, &IAdministrator::IsLinkedWithNintendoAccount, "IsLinkedWithNintendoAccount"}, - {251, nullptr, "CreateProcedureToLinkWithNintendoAccount"}, - {252, nullptr, "ResumeProcedureToLinkWithNintendoAccount"}, - {255, nullptr, "CreateProcedureToUpdateLinkageStateOfNintendoAccount"}, - {256, nullptr, "ResumeProcedureToUpdateLinkageStateOfNintendoAccount"}, - {260, nullptr, "CreateProcedureToLinkNnidWithNintendoAccount"}, // 3.0.0+ - {261, nullptr, "ResumeProcedureToLinkNnidWithNintendoAccount"}, // 3.0.0+ - {280, nullptr, "ProxyProcedureToAcquireApplicationAuthorizationForNintendoAccount"}, - {290, nullptr, "GetRequestForNintendoAccountUserResourceView"}, // 8.0.0+ - {300, nullptr, "TryRecoverNintendoAccountUserStateAsync"}, // 6.0.0+ - {400, nullptr, "IsServiceEntryRequirementCacheRefreshRequiredForOnlinePlay"}, // 6.1.0+ - {401, nullptr, "RefreshServiceEntryRequirementCacheForOnlinePlayAsync"}, // 6.1.0+ - {900, nullptr, "GetAuthenticationInfoForWin"}, // 9.0.0+ - {901, nullptr, "ImportAsyncForWin"}, // 9.0.0+ - {997, nullptr, "DebugUnlinkNintendoAccountAsync"}, - {998, nullptr, "DebugSetAvailabilityErrorDetail"}, - }; - // clang-format on - - RegisterHandlers(functions); } private: @@ -241,42 +184,97 @@ private: rb.Push(ResultSuccess); rb.Push(false); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "CheckAvailability"}, + FunctionInfo{1, nullptr, "GetAccountId"}, + FunctionInfo{2, nullptr, "EnsureIdTokenCacheAsync"}, + FunctionInfo{3, nullptr, "LoadIdTokenCache"}, + FunctionInfo{100, nullptr, "SetSystemProgramIdentification"}, + FunctionInfo{101, nullptr, "RefreshNotificationTokenAsync", MakeVersionGate({7,0,0})}, + FunctionInfo{110, nullptr, "GetServiceEntryRequirementCache", MakeVersionGate({4,0,0})}, + FunctionInfo{111, nullptr, "InvalidateServiceEntryRequirementCache", MakeVersionGate({4,0,0})}, + FunctionInfo{112, nullptr, "InvalidateTokenCache", MakeVersionGate({4,0,0}, {6,2,0})}, + FunctionInfo{113, nullptr, "GetServiceEntryRequirementCacheForOnlinePlay", MakeVersionGate({6,1,0})}, + FunctionInfo{120, nullptr, "GetNintendoAccountId"}, + FunctionInfo{121, nullptr, "CalculateNintendoAccountAuthenticationFingerprint", MakeVersionGate({9,0,0})}, + FunctionInfo{130, nullptr, "GetNintendoAccountUserResourceCache"}, + FunctionInfo{131, nullptr, "RefreshNintendoAccountUserResourceCacheAsync"}, + FunctionInfo{132, nullptr, "RefreshNintendoAccountUserResourceCacheAsyncIfSecondsElapsed"}, + FunctionInfo{133, nullptr, "GetNintendoAccountVerificationUrlCache", MakeVersionGate({9,0,0})}, + FunctionInfo{134, nullptr, "RefreshNintendoAccountVerificationUrlCacheAsync", MakeVersionGate({9,0,0})}, + FunctionInfo{135, nullptr, "RefreshNintendoAccountVerificationUrlCacheAsyncIfSecondsElapsed", MakeVersionGate({9,0,0})}, + FunctionInfo{140, nullptr, "GetNetworkServiceLicenseCache", MakeVersionGate({5,0,0})}, + FunctionInfo{141, nullptr, "RefreshNetworkServiceLicenseCacheAsync", MakeVersionGate({5,0,0})}, + FunctionInfo{142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed", MakeVersionGate({5,0,0})}, + FunctionInfo{143, nullptr, "GetNetworkServiceLicenseCacheEx"}, + FunctionInfo{150, nullptr, "CreateAuthorizationRequest"}, + FunctionInfo{160, nullptr, "RequiresUpdateNetworkServiceAccountIdTokenCache"}, + FunctionInfo{161, nullptr, "RequireReauthenticationOfNetworkServiceAccount"}, + FunctionInfo{170, nullptr, "CreateDeviceHistoryRequest", MakeVersionGate({17,0,0})}, + FunctionInfo{180, nullptr, "GetRequestForNintendoAccountReauthentication", MakeVersionGate({18,0,0})}, + FunctionInfo{200, nullptr, "IsRegistered"}, + FunctionInfo{201, nullptr, "RegisterAsync"}, + FunctionInfo{202, nullptr, "UnregisterAsync"}, + FunctionInfo{203, nullptr, "DeleteRegistrationInfoLocally"}, + FunctionInfo{220, nullptr, "SynchronizeProfileAsync"}, + FunctionInfo{221, nullptr, "UploadProfileAsync"}, + FunctionInfo{222, nullptr, "SynchronizaProfileAsyncIfSecondsElapsed"}, + FunctionInfo{250, &IAdministrator::IsLinkedWithNintendoAccount, "IsLinkedWithNintendoAccount"}, + FunctionInfo{251, nullptr, "CreateProcedureToLinkWithNintendoAccount"}, + FunctionInfo{252, nullptr, "ResumeProcedureToLinkWithNintendoAccount"}, + FunctionInfo{255, nullptr, "CreateProcedureToUpdateLinkageStateOfNintendoAccount"}, + FunctionInfo{256, nullptr, "ResumeProcedureToUpdateLinkageStateOfNintendoAccount"}, + FunctionInfo{260, nullptr, "CreateProcedureToLinkNnidWithNintendoAccount", MakeVersionGate({3,0,0})}, + FunctionInfo{261, nullptr, "ResumeProcedureToLinkNnidWithNintendoAccount", MakeVersionGate({3,0,0})}, + FunctionInfo{280, nullptr, "ProxyProcedureToAcquireApplicationAuthorizationForNintendoAccount"}, + FunctionInfo{290, nullptr, "GetRequestForNintendoAccountUserResourceView", MakeVersionGate({8,0,0})}, + FunctionInfo{300, nullptr, "TryRecoverNintendoAccountUserStateAsync", MakeVersionGate({6,0,0})}, + FunctionInfo{400, nullptr, "IsServiceEntryRequirementCacheRefreshRequiredForOnlinePlay", MakeVersionGate({6,1,0})}, + FunctionInfo{401, nullptr, "RefreshServiceEntryRequirementCacheForOnlinePlayAsync", MakeVersionGate({6,1,0})}, + FunctionInfo{900, nullptr, "GetAuthenticationInfoForWin", MakeVersionGate({9,0,0})}, + FunctionInfo{901, nullptr, "ImportAsyncForWin", MakeVersionGate({9,0,0})}, + FunctionInfo{997, nullptr, "DebugUnlinkNintendoAccountAsync"}, + FunctionInfo{998, nullptr, "DebugSetAvailabilityErrorDetail"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } }; class IAuthorizationRequest final : public ServiceFramework { public: explicit IAuthorizationRequest(Core::System& system_, Common::UUID) : ServiceFramework{system_, "IAuthorizationRequest"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetSessionId"}, - {10, nullptr, "InvokeWithoutInteractionAsync"}, - {19, nullptr, "IsAuthorized"}, - {20, nullptr, "GetAuthorizationCode"}, - {21, nullptr, "GetIdToken"}, - {22, nullptr, "GetState"}, - }; - // clang-format on + } - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetSessionId"}, + FunctionInfo{10, nullptr, "InvokeWithoutInteractionAsync"}, + FunctionInfo{19, nullptr, "IsAuthorized"}, + FunctionInfo{20, nullptr, "GetAuthorizationCode"}, + FunctionInfo{21, nullptr, "GetIdToken"}, + FunctionInfo{22, nullptr, "GetState"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class IOAuthProcedure final : public ServiceFramework { public: explicit IOAuthProcedure(Core::System& system_, Common::UUID) - : ServiceFramework{system_, "IOAuthProcedure"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "PrepareAsync"}, - {1, nullptr, "GetRequest"}, - {2, nullptr, "ApplyResponse"}, - {3, nullptr, "ApplyResponseAsync"}, - {10, nullptr, "Suspend"}, - }; - // clang-format on + : ServiceFramework{system_, "IOAuthProcedure"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "PrepareAsync"}, + FunctionInfo{1, nullptr, "GetRequest"}, + FunctionInfo{2, nullptr, "ApplyResponse"}, + FunctionInfo{3, nullptr, "ApplyResponseAsync"}, + FunctionInfo{10, nullptr, "Suspend"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; @@ -284,96 +282,69 @@ public: class IOAuthProcedureForExternalNsa final : public ServiceFramework { public: explicit IOAuthProcedureForExternalNsa(Core::System& system_, Common::UUID) - : ServiceFramework{system_, "IOAuthProcedureForExternalNsa"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "PrepareAsync"}, - {1, nullptr, "GetRequest"}, - {2, nullptr, "ApplyResponse"}, - {3, nullptr, "ApplyResponseAsync"}, - {10, nullptr, "Suspend"}, - {100, nullptr, "GetAccountId"}, - {101, nullptr, "GetLinkedNintendoAccountId"}, - {102, nullptr, "GetNickname"}, - {103, nullptr, "GetProfileImage"}, - {104, nullptr, "GetProfileLargeImage"} // 18.0.0+ - }; - // clang-format on + : ServiceFramework{system_, "IOAuthProcedureForExternalNsa"} + {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "PrepareAsync"}, + FunctionInfo{1, nullptr, "GetRequest"}, + FunctionInfo{2, nullptr, "ApplyResponse"}, + FunctionInfo{3, nullptr, "ApplyResponseAsync"}, + FunctionInfo{10, nullptr, "Suspend"}, + FunctionInfo{100, nullptr, "GetAccountId"}, + FunctionInfo{101, nullptr, "GetLinkedNintendoAccountId"}, + FunctionInfo{102, nullptr, "GetNickname"}, + FunctionInfo{103, nullptr, "GetProfileImage"}, + FunctionInfo{104, nullptr, "GetProfileLargeImage", MakeVersionGate({18,0,0})} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; -class IOAuthProcedureForNintendoAccountLinkage final - : public ServiceFramework { +class IOAuthProcedureForNintendoAccountLinkage final : public ServiceFramework { public: explicit IOAuthProcedureForNintendoAccountLinkage(Core::System& system_, Common::UUID) - : ServiceFramework{system_, "IOAuthProcedureForNintendoAccountLinkage"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "PrepareAsync"}, - {1, nullptr, "GetRequest"}, - {2, nullptr, "ApplyResponse"}, - {3, nullptr, "ApplyResponseAsync"}, - {10, nullptr, "Suspend"}, - {100, nullptr, "GetRequestWithTheme"}, - {101, nullptr, "IsNetworkServiceAccountReplaced"}, - {199, nullptr, "GetUrlForIntroductionOfExtraMembership"}, // 2.0.0 - 5.1.0 - {200, nullptr, "ApplyAsyncWithAuthorizedToken"}, - {210, nullptr, "IsProfileAvailable"}, // 17.0.0+ - {220, nullptr, "RegisterUserAsyncWithoutProfile"}, // 17.0.0+ - {221, nullptr, "RegisterUserWithProfileAsync"}, // 17.0.0+ - {230, nullptr, "RegisterUserWithLargeImageProfileAsync"}, // 18.0.0+ - }; - // clang-format on + : ServiceFramework{system_, "IOAuthProcedureForNintendoAccountLinkage"} + {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "PrepareAsync"}, + FunctionInfo{1, nullptr, "GetRequest"}, + FunctionInfo{2, nullptr, "ApplyResponse"}, + FunctionInfo{3, nullptr, "ApplyResponseAsync"}, + FunctionInfo{10, nullptr, "Suspend"}, + FunctionInfo{100, nullptr, "GetRequestWithTheme"}, + FunctionInfo{101, nullptr, "IsNetworkServiceAccountReplaced"}, + FunctionInfo{199, nullptr, "GetUrlForIntroductionOfExtraMembership", MakeVersionGate({2,0,0}, {5,1,0})}, + FunctionInfo{200, nullptr, "ApplyAsyncWithAuthorizedToken"}, + FunctionInfo{210, nullptr, "IsProfileAvailable", MakeVersionGate({17,0,0})}, + FunctionInfo{220, nullptr, "RegisterUserAsyncWithoutProfile", MakeVersionGate({17,0,0})}, + FunctionInfo{221, nullptr, "RegisterUserWithProfileAsync", MakeVersionGate({17,0,0})}, + FunctionInfo{230, nullptr, "RegisterUserWithLargeImageProfileAsync", MakeVersionGate({18,0,0})} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class INotifier final : public ServiceFramework { public: explicit INotifier(Core::System& system_, Common::UUID) - : ServiceFramework{system_, "INotifier"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetSystemEvent"}, - }; - // clang-format on + : ServiceFramework{system_, "INotifier"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetSystemEvent"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class IProfileCommon : public ServiceFramework { public: - explicit IProfileCommon(Core::System& system_, const char* name, bool editor_commands, - Common::UUID user_id_, ProfileManager& profile_manager_) + explicit IProfileCommon(Core::System& system_, const char* name, bool editor_commands, Common::UUID user_id_, ProfileManager& profile_manager_) : ServiceFramework{system_, name}, profile_manager{profile_manager_}, user_id{user_id_} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &IProfileCommon::Get, "Get"}, - {1, &IProfileCommon::GetBase, "GetBase"}, - {10, &IProfileCommon::GetImageSize, "GetImageSize"}, - {11, &IProfileCommon::LoadImage, "LoadImage"}, - {20, &IProfileCommon::Unknown20, "Unknown20"}, - {21, &IProfileCommon::Unknown21, "Unknown21"}, - {30, &IProfileCommon::Unknown30, "Unknown30"} - }; - // clang-format on - RegisterHandlers(functions); - - if (editor_commands) { - // clang-format off - static const FunctionInfo editor_functions[] = { - {100, &IProfileCommon::Store, "Store"}, - {101, &IProfileCommon::StoreWithImage, "StoreWithImage"}, - {110, &IProfileCommon::Unknown110, "Unknown110"} - }; - // clang-format on - - RegisterHandlers(editor_functions); - } } protected: @@ -600,6 +571,22 @@ protected: rb.Push(ResultSuccess); } + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &IProfileCommon::Get, "Get"}, + FunctionInfo{1, &IProfileCommon::GetBase, "GetBase"}, + FunctionInfo{10, &IProfileCommon::GetImageSize, "GetImageSize"}, + FunctionInfo{11, &IProfileCommon::LoadImage, "LoadImage"}, + FunctionInfo{20, &IProfileCommon::Unknown20, "Unknown20"}, + FunctionInfo{21, &IProfileCommon::Unknown21, "Unknown21"}, + FunctionInfo{30, &IProfileCommon::Unknown30, "Unknown30"}, + // Editor commands + FunctionInfo{100, &IProfileCommon::Store, "Store"}, + FunctionInfo{101, &IProfileCommon::StoreWithImage, "StoreWithImage"}, + FunctionInfo{110, &IProfileCommon::Unknown110, "Unknown110"} + ); ProfileManager& profile_manager; Common::UUID user_id{}; ///< The user id this profile refers to. }; @@ -621,35 +608,33 @@ public: class ISessionObject final : public ServiceFramework { public: explicit ISessionObject(Core::System& system_, Common::UUID) - : ServiceFramework{system_, "ISessionObject"} { - // clang-format off - static const FunctionInfo functions[] = { - {999, nullptr, "Dummy"}, - }; - // clang-format on + : ServiceFramework{system_, "ISessionObject"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{999, nullptr, "Dummy"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class IGuestLoginRequest final : public ServiceFramework { public: explicit IGuestLoginRequest(Core::System& system_, Common::UUID) - : ServiceFramework{system_, "IGuestLoginRequest"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetSessionId"}, - {11, nullptr, "Unknown"}, // 1.0.0 - 2.3.0 (the name is blank on Switchbrew) - {12, nullptr, "GetAccountId"}, - {13, nullptr, "GetLinkedNintendoAccountId"}, - {14, nullptr, "GetNickname"}, - {15, nullptr, "GetProfileImage"}, - {16, nullptr, "GetProfileLargeImage"}, // 18.0.0+ - {21, nullptr, "LoadIdTokenCache"}, // 3.0.0+ - }; - // clang-format on + : ServiceFramework{system_, "IGuestLoginRequest"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetSessionId"}, + FunctionInfo{11, nullptr, "Unknown", MakeVersionGate({1,0,0}, {2,3,0})}, // the name is blank on Switchbrew + FunctionInfo{12, nullptr, "GetAccountId"}, + FunctionInfo{13, nullptr, "GetLinkedNintendoAccountId"}, + FunctionInfo{14, nullptr, "GetNickname"}, + FunctionInfo{15, nullptr, "GetProfileImage"}, + FunctionInfo{16, nullptr, "GetProfileLargeImage", MakeVersionGate({18,0,0})}, + FunctionInfo{21, nullptr, "LoadIdTokenCache", MakeVersionGate({3,0,0})} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; @@ -686,23 +671,10 @@ public: const std::shared_ptr& profile_manager_) : ServiceFramework{system_, "IManagerForApplication"}, ensure_token_id{std::make_shared(system)}, - profile_manager{profile_manager_} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &IManagerForApplication::CheckAvailability, "CheckAvailability"}, - {1, &IManagerForApplication::GetAccountId, "GetAccountId"}, - {2, &IManagerForApplication::EnsureIdTokenCacheAsync, "EnsureIdTokenCacheAsync"}, - {3, &IManagerForApplication::LoadIdTokenCacheDeprecated, "LoadIdTokenCacheDeprecated"}, - {4, &IManagerForApplication::LoadIdTokenCache, "LoadIdTokenCache"}, - {130, &IManagerForApplication::GetNintendoAccountUserResourceCacheForApplication, "GetNintendoAccountUserResourceCacheForApplication"}, - {136, &IManagerForApplication::GetNintendoAccountUserResourceCacheForApplication, "GetNintendoAccountUserResourceCache"}, // 19.0.0+ - {150, nullptr, "CreateAuthorizationRequest"}, - {160, &IManagerForApplication::StoreOpenContext, "StoreOpenContext"}, - {170, nullptr, "LoadNetworkServiceLicenseKindAsync"}, - }; - // clang-format on + profile_manager{profile_manager_} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -772,6 +744,18 @@ private: rb.Push(ResultSuccess); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &IManagerForApplication::CheckAvailability, "CheckAvailability"}, + FunctionInfo{1, &IManagerForApplication::GetAccountId, "GetAccountId"}, + FunctionInfo{2, &IManagerForApplication::EnsureIdTokenCacheAsync, "EnsureIdTokenCacheAsync"}, + FunctionInfo{3, &IManagerForApplication::LoadIdTokenCacheDeprecated, "LoadIdTokenCacheDeprecated"}, + FunctionInfo{4, &IManagerForApplication::LoadIdTokenCache, "LoadIdTokenCache"}, + FunctionInfo{130, &IManagerForApplication::GetNintendoAccountUserResourceCacheForApplication, "GetNintendoAccountUserResourceCacheForApplication"}, + FunctionInfo{136, &IManagerForApplication::GetNintendoAccountUserResourceCacheForApplication, "GetNintendoAccountUserResourceCache", MakeVersionGate({19,0,0})}, + FunctionInfo{150, nullptr, "CreateAuthorizationRequest"}, + FunctionInfo{160, &IManagerForApplication::StoreOpenContext, "StoreOpenContext"}, + FunctionInfo{170, nullptr, "LoadNetworkServiceLicenseKindAsync"} + ); std::shared_ptr ensure_token_id{}; std::shared_ptr profile_manager; }; @@ -781,18 +765,17 @@ class IAsyncNetworkServiceLicenseKindContext final : public ServiceFramework { public: explicit IAsyncNetworkServiceLicenseKindContext(Core::System& system_, Common::UUID) - : ServiceFramework{system_, "IAsyncNetworkServiceLicenseKindContext"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetSystemEvent"}, - {1, nullptr, "Cancel"}, - {2, nullptr, "HasDone"}, - {3, nullptr, "GetResult"}, - {4, nullptr, "GetNetworkServiceLicenseKind"}, - }; - // clang-format on + : ServiceFramework{system_, "IAsyncNetworkServiceLicenseKindContext"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetSystemEvent"}, + FunctionInfo{1, nullptr, "Cancel"}, + FunctionInfo{2, nullptr, "HasDone"}, + FunctionInfo{3, nullptr, "GetResult"}, + FunctionInfo{4, nullptr, "GetNetworkServiceLicenseKind"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; @@ -801,56 +784,54 @@ class IOAuthProcedureForUserRegistration final : public ServiceFramework { public: explicit IOAuthProcedureForUserRegistration(Core::System& system_, Common::UUID) - : ServiceFramework{system_, "IOAuthProcedureForUserRegistration"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "PrepareAsync"}, - {1, nullptr, "GetRequest"}, - {2, nullptr, "ApplyResponse"}, - {3, nullptr, "ApplyResponseAsync"}, - {10, nullptr, "Suspend"}, - {100, nullptr, "GetAccountId"}, - {101, nullptr, "GetLinkedNintendoAccountId"}, - {102, nullptr, "GetNickname"}, - {103, nullptr, "GetProfileImage"}, - {104, nullptr, "GetProfileLargeImage"}, // 18.0.0+ - {110, nullptr, "RegisterUserAsync"}, - {111, nullptr, "GetUid"}, - {200, nullptr, "ApplyResponseForUserCreationAsync"}, // 17.0.0+ - {205, nullptr, "SuspendAfterApplyResponse"}, // 17.0.0+ - {210, nullptr, "IsProfileAvailable"}, // 17.0.0+ - {220, nullptr, "RegisterUserAsyncWithoutProfile"}, // 17.0.0+ - {221, nullptr, "RegisterUserWithProfileAsync"}, // 17.0.0+ - {230, nullptr, "RegisterUserWithLargeImageProfileAsync"} // 18.0.0+ - }; - // clang-format on + : ServiceFramework{system_, "IOAuthProcedureForUserRegistration"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "PrepareAsync"}, + FunctionInfo{1, nullptr, "GetRequest"}, + FunctionInfo{2, nullptr, "ApplyResponse"}, + FunctionInfo{3, nullptr, "ApplyResponseAsync"}, + FunctionInfo{10, nullptr, "Suspend"}, + FunctionInfo{100, nullptr, "GetAccountId"}, + FunctionInfo{101, nullptr, "GetLinkedNintendoAccountId"}, + FunctionInfo{102, nullptr, "GetNickname"}, + FunctionInfo{103, nullptr, "GetProfileImage"}, + FunctionInfo{104, nullptr, "GetProfileLargeImage", MakeVersionGate({18,0,0})}, + FunctionInfo{110, nullptr, "RegisterUserAsync"}, + FunctionInfo{111, nullptr, "GetUid"}, + FunctionInfo{200, nullptr, "ApplyResponseForUserCreationAsync", MakeVersionGate({17,0,0})}, + FunctionInfo{205, nullptr, "SuspendAfterApplyResponse", MakeVersionGate({17,0,0})}, + FunctionInfo{210, nullptr, "IsProfileAvailable", MakeVersionGate({17,0,0})}, + FunctionInfo{220, nullptr, "RegisterUserAsyncWithoutProfile", MakeVersionGate({17,0,0})}, + FunctionInfo{221, nullptr, "RegisterUserWithProfileAsync", MakeVersionGate({17,0,0})}, + FunctionInfo{230, nullptr, "RegisterUserWithLargeImageProfileAsync", MakeVersionGate({18,0,0})} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class DAUTH_O final : public ServiceFramework { public: - explicit DAUTH_O(Core::System& system_, Common::UUID) : ServiceFramework{system_, "dauth:o"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "EnsureAuthenticationTokenCacheAsync"}, - {1, nullptr, "LoadAuthenticationTokenCache"}, - {2, nullptr, "InvalidateAuthenticationTokenCache"}, - {3, nullptr, "IsDeviceAuthenticationTokenCacheAvailable"}, - {10, nullptr, "EnsureEdgeTokenCacheAsync"}, - {11, nullptr, "LoadEdgeTokenCache"}, - {12, nullptr, "InvalidateEdgeTokenCache"}, - {13, nullptr, "IsEdgeTokenCacheAvailable"}, - {20, nullptr, "EnsureApplicationAuthenticationCacheAsync"}, - {21, nullptr, "LoadApplicationAuthenticationTokenCache"}, - {22, nullptr, "LoadApplicationNetworkServiceClientConfigCache"}, - {23, nullptr, "IsApplicationAuthenticationCacheAvailable"}, - {24, nullptr, "InvalidateApplicationAuthenticationCache"}, - }; - // clang-format on + explicit DAUTH_O(Core::System& system_, Common::UUID) : ServiceFramework{system_, "dauth:o"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "EnsureAuthenticationTokenCacheAsync"}, + FunctionInfo{1, nullptr, "LoadAuthenticationTokenCache"}, + FunctionInfo{2, nullptr, "InvalidateAuthenticationTokenCache"}, + FunctionInfo{3, nullptr, "IsDeviceAuthenticationTokenCacheAvailable"}, + FunctionInfo{10, nullptr, "EnsureEdgeTokenCacheAsync"}, + FunctionInfo{11, nullptr, "LoadEdgeTokenCache"}, + FunctionInfo{12, nullptr, "InvalidateEdgeTokenCache"}, + FunctionInfo{13, nullptr, "IsEdgeTokenCacheAvailable"}, + FunctionInfo{20, nullptr, "EnsureApplicationAuthenticationCacheAsync"}, + FunctionInfo{21, nullptr, "LoadApplicationAuthenticationTokenCache"}, + FunctionInfo{22, nullptr, "LoadApplicationNetworkServiceClientConfigCache"}, + FunctionInfo{23, nullptr, "IsApplicationAuthenticationCacheAvailable"}, + FunctionInfo{24, nullptr, "InvalidateApplicationAuthenticationCache"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; @@ -858,781 +839,809 @@ public: class IAsyncResult final : public ServiceFramework { public: explicit IAsyncResult(Core::System& system_, Common::UUID) - : ServiceFramework{system_, "IAsyncResult"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetResult"}, - {1, nullptr, "Cancel"}, - {2, nullptr, "IsAvailable"}, - {3, nullptr, "GetSystemEvent"}, - }; - // clang-format on + : ServiceFramework{system_, "IAsyncResult"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetResult"}, + FunctionInfo{1, nullptr, "Cancel"}, + FunctionInfo{2, nullptr, "IsAvailable"}, + FunctionInfo{3, nullptr, "GetSystemEvent"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; -void Module::Interface::GetUserCount(HLERequestContext& ctx) { - LOG_DEBUG(Service_ACC, "called"); - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(ResultSuccess); - rb.Push(static_cast(profile_manager->GetUserCount())); -} +class Module final { +public: + class Interface : public ServiceFramework { + public: + explicit Interface(std::shared_ptr module_, std::shared_ptr profile_manager_, Core::System& system_, const char* name) + : ServiceFramework{system_, name} + , module{std::move(module_)} + , profile_manager{std::move(profile_manager_)} + {} + ~Interface() override = default; -void Module::Interface::GetUserExistence(HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - Common::UUID user_id = rp.PopRaw(); - LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString()); - - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(ResultSuccess); - rb.Push(profile_manager->UserExists(user_id)); -} - -void Module::Interface::ListAllUsers(HLERequestContext& ctx) { - LOG_DEBUG(Service_ACC, "called"); - ctx.WriteBuffer(profile_manager->GetAllUsers()); - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); -} - -void Module::Interface::ListOpenUsers(HLERequestContext& ctx) { - LOG_DEBUG(Service_ACC, "called"); - ctx.WriteBuffer(profile_manager->GetOpenUsers()); - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); -} - -void Module::Interface::GetLastOpenedUser(HLERequestContext& ctx) { - LOG_DEBUG(Service_ACC, "called"); - IPC::ResponseBuilder rb{ctx, 6}; - rb.Push(ResultSuccess); - rb.PushRaw(profile_manager->GetLastOpenedUser()); -} - -void Module::Interface::GetProfile(HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - Common::UUID user_id = rp.PopRaw(); - LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString()); - - IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(ResultSuccess); - rb.PushIpcInterface(ctx, system, user_id, *profile_manager); -} - -void Module::Interface::IsUserRegistrationRequestPermitted(HLERequestContext& ctx) { - LOG_WARNING(Service_ACC, "(STUBBED) called"); - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(ResultSuccess); - rb.Push(profile_manager->CanSystemRegisterUser()); -} - -void Module::Interface::InitializeApplicationInfo(HLERequestContext& ctx) { - LOG_DEBUG(Service_ACC, "called"); - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(InitializeApplicationInfoBase()); -} - -void Module::Interface::InitializeApplicationInfoRestricted(HLERequestContext& ctx) { - LOG_WARNING(Service_ACC, "(Partial implementation) called"); - - // TODO(ogniK): We require checking if the user actually owns the title and what not. As of - // currently, we assume the user owns the title. InitializeApplicationInfoBase SHOULD be called - // first then we do extra checks if the game is a digital copy. - - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(InitializeApplicationInfoBase()); -} - -Result Module::Interface::InitializeApplicationInfoBase() { - if (application_info) { - LOG_ERROR(Service_ACC, "Application already initialized"); - return Account::ResultApplicationInfoAlreadyInitialized; - } - - // TODO(ogniK): This should be changed to reflect the target process for when we have multiple - // processes emulated. As we don't actually have pid support we should assume we're just using - // our own process - Glue::ApplicationLaunchProperty launch_property{}; - const auto result = system.GetARPManager().GetLaunchProperty( - &launch_property, system.GetApplicationProcessProgramID()); - - if (result != ResultSuccess) { - LOG_ERROR(Service_ACC, "Failed to get launch property"); - return Account::ResultInvalidApplication; - } - - switch (launch_property.base_game_storage_id) { - case FileSys::StorageId::GameCard: - application_info.application_type = ApplicationType::GameCard; - break; - case FileSys::StorageId::Host: - case FileSys::StorageId::NandSystem: - case FileSys::StorageId::NandUser: - case FileSys::StorageId::SdCard: - case FileSys::StorageId::None: // Yuzu specific, differs from hardware - application_info.application_type = ApplicationType::Digital; - break; - default: - LOG_ERROR(Service_ACC, "Invalid game storage ID! storage_id={}", - launch_property.base_game_storage_id); - return Account::ResultInvalidApplication; - } - - LOG_WARNING(Service_ACC, "ApplicationInfo init required"); - // TODO(ogniK): Actual initialization here - - return ResultSuccess; -} - -void Module::Interface::GetBaasAccountManagerForApplication(HLERequestContext& ctx) { - LOG_DEBUG(Service_ACC, "called"); - IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(ResultSuccess); - rb.PushIpcInterface(ctx, system, profile_manager); -} - -void Module::Interface::IsUserAccountSwitchLocked(HLERequestContext& ctx) { - LOG_DEBUG(Service_ACC, "called"); - FileSys::NACP nacp; - const auto res = system.GetAppLoader().ReadControlData(nacp); - - bool is_locked = false; - - if (res != Loader::ResultStatus::Success) { - const FileSys::PatchManager pm{system.GetApplicationProcessProgramID(), - system.GetFileSystemController(), - system.GetContentProvider()}; - const auto nacp_unique = pm.GetControlMetadata().first; - - if (nacp_unique != nullptr) { - is_locked = nacp_unique->GetUserAccountSwitchLock(); - } else { - LOG_ERROR(Service_ACC, "nacp_unique is null!"); + void GetUserCount(HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(static_cast(profile_manager->GetUserCount())); } - } else { - is_locked = nacp.GetUserAccountSwitchLock(); - } - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(ResultSuccess); - rb.Push(is_locked); -} + void GetUserExistence(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + Common::UUID user_id = rp.PopRaw(); + LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString()); -void Module::Interface::InitializeApplicationInfoV2(HLERequestContext& ctx) { - LOG_WARNING(Service_ACC, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(profile_manager->UserExists(user_id)); + } - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); -} + void ListAllUsers(HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); + ctx.WriteBuffer(profile_manager->GetAllUsers()); + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + } -void Module::Interface::BeginUserRegistration(HLERequestContext& ctx) { - const auto user_id = Common::UUID::MakeRandom(); - profile_manager->CreateNewUser(user_id, "Eden"); + void ListOpenUsers(HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); + ctx.WriteBuffer(profile_manager->GetOpenUsers()); + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + } - LOG_INFO(Service_ACC, "called, uuid={}", user_id.FormattedString()); + void GetLastOpenedUser(HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); + IPC::ResponseBuilder rb{ctx, 6}; + rb.Push(ResultSuccess); + rb.PushRaw(profile_manager->GetLastOpenedUser()); + } - IPC::ResponseBuilder rb{ctx, 6}; - rb.Push(ResultSuccess); - rb.PushRaw(user_id); -} + void GetProfile(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + Common::UUID user_id = rp.PopRaw(); + LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString()); -void Module::Interface::CompleteUserRegistration(HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - Common::UUID user_id = rp.PopRaw(); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(ctx, system, user_id, *profile_manager); + } - LOG_INFO(Service_ACC, "called, uuid={}", user_id.FormattedString()); + void IsUserRegistrationRequestPermitted(HLERequestContext& ctx) { + LOG_WARNING(Service_ACC, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(profile_manager->CanSystemRegisterUser()); + } - profile_manager->WriteUserSaveFile(); + void InitializeApplicationInfo(HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(InitializeApplicationInfoBase()); + } - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); -} + void InitializeApplicationInfoRestricted(HLERequestContext& ctx) { + LOG_WARNING(Service_ACC, "(Partial implementation) called"); -void Module::Interface::DeleteUser(HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - Common::UUID user_id = rp.PopRaw(); - LOG_INFO(Service_ACC, "called, uuid={}", user_id.FormattedString()); - if (!profile_manager->RemoveUser(user_id)) { - LOG_ERROR(Service_ACC, "Failed to delete user with uuid={}", user_id.RawString()); - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(1U); - return; - } - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); -} + // TODO(ogniK): We require checking if the user actually owns the title and what not. As of + // currently, we assume the user owns the title. InitializeApplicationInfoBase SHOULD be called + // first then we do extra checks if the game is a digital copy. -void Module::Interface::SetUserPosition(HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(InitializeApplicationInfoBase()); + } - u64 position = rp.Pop(); - Common::UUID user_id = rp.PopRaw(); + void GetBaasAccountManagerForApplication(HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(ctx, system, profile_manager); + } - LOG_DEBUG(Service_ACC, "called, position={} user_id={}", position, user_id.FormattedString()); + void IsUserAccountSwitchLocked(HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); + FileSys::NACP nacp; + const auto res = system.GetAppLoader().ReadControlData(nacp); - profile_manager->SetUserPosition(position, user_id); + bool is_locked = false; - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); -} + if (res != Loader::ResultStatus::Success) { + const FileSys::PatchManager pm{system.GetApplicationProcessProgramID(), + system.GetFileSystemController(), + system.GetContentProvider()}; + const auto nacp_unique = pm.GetControlMetadata().first; -void Module::Interface::GetProfileEditor(HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - Common::UUID user_id = rp.PopRaw(); + if (nacp_unique != nullptr) { + is_locked = nacp_unique->GetUserAccountSwitchLock(); + } else { + LOG_ERROR(Service_ACC, "nacp_unique is null!"); + } + } else { + is_locked = nacp.GetUserAccountSwitchLock(); + } - LOG_DEBUG(Service_ACC, "called, user_id=0x{}", user_id.RawString()); + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(is_locked); + } - IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(ResultSuccess); - rb.PushIpcInterface(ctx, system, user_id, *profile_manager); -} + void InitializeApplicationInfoV2(HLERequestContext& ctx) { + LOG_WARNING(Service_ACC, "(STUBBED) called"); -void Module::Interface::GetBaasAccountAdministrator(HLERequestContext &ctx) { - IPC::RequestParser rp{ctx}; - const auto uuid = rp.PopRaw(); + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + } - LOG_INFO(Service_ACC, "called, uuid=0x{}", uuid.RawString()); + void BeginUserRegistration(HLERequestContext& ctx) { + const auto user_id = Common::UUID::MakeRandom(); + profile_manager->CreateNewUser(user_id, "Eden"); - IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(ResultSuccess); - rb.PushIpcInterface(ctx, system, uuid); -} + LOG_INFO(Service_ACC, "called, uuid={}", user_id.FormattedString()); -void Module::Interface::ListQualifiedUsers(HLERequestContext& ctx) { - LOG_DEBUG(Service_ACC, "called"); + IPC::ResponseBuilder rb{ctx, 6}; + rb.Push(ResultSuccess); + rb.PushRaw(user_id); + } - // All users should be qualified. We don't actually have parental control or anything to do with - // nintendo online currently. We're just going to assume the user running the game has access to - // the game regardless of parental control settings. - ctx.WriteBuffer(profile_manager->GetAllUsers()); - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); -} + void CompleteUserRegistration(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + Common::UUID user_id = rp.PopRaw(); -void Module::Interface::ListOpenContextStoredUsers(HLERequestContext& ctx) { - LOG_DEBUG(Service_ACC, "called"); + LOG_INFO(Service_ACC, "called, uuid={}", user_id.FormattedString()); - ctx.WriteBuffer(profile_manager->GetStoredOpenedUsers()); - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); -} + profile_manager->WriteUserSaveFile(); -void Module::Interface::StoreSaveDataThumbnailApplication(HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - const auto uuid = rp.PopRaw(); + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + } - LOG_WARNING(Service_ACC, "(STUBBED) called, uuid=0x{}", uuid.RawString()); + void DeleteUser(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + Common::UUID user_id = rp.PopRaw(); + LOG_INFO(Service_ACC, "called, uuid={}", user_id.FormattedString()); + if (!profile_manager->RemoveUser(user_id)) { + LOG_ERROR(Service_ACC, "Failed to delete user with uuid={}", user_id.RawString()); + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(1U); + return; + } + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + } - // TODO(ogniK): Check if application ID is zero on acc initialize. As we don't have a reliable - // way of confirming things like the TID, we're going to assume a non zero value for the time - // being. - constexpr u64 tid{1}; - StoreSaveDataThumbnail(ctx, uuid, tid); -} + void SetUserPosition(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; -void Module::Interface::GetBaasAccountManagerForSystemService(HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - const auto uuid = rp.PopRaw(); + u64 position = rp.Pop(); + Common::UUID user_id = rp.PopRaw(); - LOG_INFO(Service_ACC, "called, uuid=0x{}", uuid.RawString()); + LOG_DEBUG(Service_ACC, "called, position={} user_id={}", position, user_id.FormattedString()); - IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(ResultSuccess); - rb.PushIpcInterface(ctx, system, uuid); -} + profile_manager->SetUserPosition(position, user_id); -void Module::Interface::StoreSaveDataThumbnailSystem(HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - const auto uuid = rp.PopRaw(); - const auto tid = rp.Pop(); + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + } - LOG_WARNING(Service_ACC, "(STUBBED) called, uuid=0x{}, tid={:016X}", uuid.RawString(), tid); - StoreSaveDataThumbnail(ctx, uuid, tid); -} + void GetProfileEditor(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + Common::UUID user_id = rp.PopRaw(); -void Module::Interface::GetPinCodeLength(HLERequestContext& ctx) { - LOG_WARNING(Service_ACC, "(STUBBED) called"); + LOG_DEBUG(Service_ACC, "called, user_id=0x{}", user_id.RawString()); - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(ResultSuccess); - rb.Push(0); -} + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(ctx, system, user_id, *profile_manager); + } -void Module::Interface::StoreSaveDataThumbnail(HLERequestContext& ctx, const Common::UUID& uuid, - const u64 tid) { - IPC::ResponseBuilder rb{ctx, 2}; + void GetBaasAccountAdministrator(HLERequestContext &ctx) { + IPC::RequestParser rp{ctx}; + const auto uuid = rp.PopRaw(); - if (tid == 0) { - LOG_ERROR(Service_ACC, "TitleID is not valid!"); - rb.Push(Account::ResultInvalidApplication); - return; - } + LOG_INFO(Service_ACC, "called, uuid=0x{}", uuid.RawString()); - if (uuid.IsInvalid()) { - LOG_ERROR(Service_ACC, "User ID is not valid!"); - rb.Push(Account::ResultInvalidUserId); - return; - } - const auto thumbnail_size = ctx.GetReadBufferSize(); - if (thumbnail_size != THUMBNAIL_SIZE) { - LOG_ERROR(Service_ACC, "Buffer size is empty! size={:X} expecting {:X}", thumbnail_size, - THUMBNAIL_SIZE); - rb.Push(Account::ResultInvalidArrayLength); - return; - } + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(ctx, system, uuid); + } - // TODO(ogniK): Construct save data thumbnail - rb.Push(ResultSuccess); -} + void ListQualifiedUsers(HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); -void Module::Interface::TrySelectUserWithoutInteractionDeprecated(HLERequestContext& ctx) { - LOG_DEBUG(Service_ACC, "called"); - // A u8 is passed into this function which we can safely ignore. It's to determine if we have - // access to use the network or not by the looks of it - IPC::ResponseBuilder rb{ctx, 6}; - if (profile_manager->GetUserCount() != 1) { - rb.Push(ResultSuccess); - rb.PushRaw(Common::InvalidUUID); - return; - } + // All users should be qualified. We don't actually have parental control or anything to do with + // nintendo online currently. We're just going to assume the user running the game has access to + // the game regardless of parental control settings. + ctx.WriteBuffer(profile_manager->GetAllUsers()); + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + } - const auto user_list = profile_manager->GetAllUsers(); - if (std::ranges::all_of(user_list, [](const auto& user) { return user.IsInvalid(); })) { - rb.Push(ResultUnknown); // TODO(ogniK): Find the correct error code - rb.PushRaw(Common::InvalidUUID); - return; - } + void ListOpenContextStoredUsers(HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); - // Select the first user we have - rb.Push(ResultSuccess); - rb.PushRaw(profile_manager->GetUser(0)->uuid); -} + ctx.WriteBuffer(profile_manager->GetStoredOpenedUsers()); + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + } -void Module::Interface::TrySelectUserWithoutInteraction(HLERequestContext& ctx) { - LOG_DEBUG(Service_ACC, "called"); - // A u8 is passed into this function which we can safely ignore. It's to determine if we have - // access to use the network or not by the looks of it - IPC::ResponseBuilder rb{ctx, 6}; - if (profile_manager->GetUserCount() != 1) { - rb.Push(ResultSuccess); - rb.PushRaw(Common::InvalidUUID); - return; - } + void StoreSaveDataThumbnailApplication(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + const auto uuid = rp.PopRaw(); - const auto user_list = profile_manager->GetAllUsers(); - if (std::ranges::all_of(user_list, [](const auto& user) { return user.IsInvalid(); })) { - rb.Push(ResultUnknown); // TODO(ogniK): Find the correct error code - rb.PushRaw(Common::InvalidUUID); - return; - } + LOG_WARNING(Service_ACC, "(STUBBED) called, uuid=0x{}", uuid.RawString()); - // Select the first user we have - rb.Push(ResultSuccess); - rb.PushRaw(profile_manager->GetUser(0)->uuid); -} + // TODO(ogniK): Check if application ID is zero on acc initialize. As we don't have a reliable + // way of confirming things like the TID, we're going to assume a non zero value for the time + // being. + constexpr u64 tid{1}; + StoreSaveDataThumbnail(ctx, uuid, tid); + } -Module::Interface::Interface(std::shared_ptr module_, - std::shared_ptr profile_manager_, - Core::System& system_, const char* name) - : ServiceFramework{system_, name}, module{std::move(module_)}, - profile_manager{std::move(profile_manager_)} {} + void GetBaasAccountManagerForSystemService(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + const auto uuid = rp.PopRaw(); -Module::Interface::~Interface() = default; + LOG_INFO(Service_ACC, "called, uuid=0x{}", uuid.RawString()); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(ctx, system, uuid); + } + + void StoreSaveDataThumbnailSystem(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + const auto uuid = rp.PopRaw(); + const auto tid = rp.Pop(); + + LOG_WARNING(Service_ACC, "(STUBBED) called, uuid=0x{}, tid={:016X}", uuid.RawString(), tid); + StoreSaveDataThumbnail(ctx, uuid, tid); + } + + void GetPinCodeLength(HLERequestContext& ctx) { + LOG_WARNING(Service_ACC, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(0); + } + + void TrySelectUserWithoutInteractionDeprecated(HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); + // A u8 is passed into this function which we can safely ignore. It's to determine if we have + // access to use the network or not by the looks of it + IPC::ResponseBuilder rb{ctx, 6}; + if (profile_manager->GetUserCount() != 1) { + rb.Push(ResultSuccess); + rb.PushRaw(Common::InvalidUUID); + return; + } + + const auto user_list = profile_manager->GetAllUsers(); + if (std::ranges::all_of(user_list, [](const auto& user) { return user.IsInvalid(); })) { + rb.Push(ResultUnknown); // TODO(ogniK): Find the correct error code + rb.PushRaw(Common::InvalidUUID); + return; + } + + // Select the first user we have + rb.Push(ResultSuccess); + rb.PushRaw(profile_manager->GetUser(0)->uuid); + } + + void TrySelectUserWithoutInteraction(HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); + // A u8 is passed into this function which we can safely ignore. It's to determine if we have + // access to use the network or not by the looks of it + IPC::ResponseBuilder rb{ctx, 6}; + if (profile_manager->GetUserCount() != 1) { + rb.Push(ResultSuccess); + rb.PushRaw(Common::InvalidUUID); + return; + } + + const auto user_list = profile_manager->GetAllUsers(); + if (std::ranges::all_of(user_list, [](const auto& user) { return user.IsInvalid(); })) { + rb.Push(ResultUnknown); // TODO(ogniK): Find the correct error code + rb.PushRaw(Common::InvalidUUID); + return; + } + + // Select the first user we have + rb.Push(ResultSuccess); + rb.PushRaw(profile_manager->GetUser(0)->uuid); + } + + private: + Result InitializeApplicationInfoBase() { + if (application_info) { + LOG_ERROR(Service_ACC, "Application already initialized"); + return Account::ResultApplicationInfoAlreadyInitialized; + } + + // TODO(ogniK): This should be changed to reflect the target process for when we have multiple + // processes emulated. As we don't actually have pid support we should assume we're just using + // our own process + Glue::ApplicationLaunchProperty launch_property{}; + const auto result = system.GetARPManager().GetLaunchProperty( + &launch_property, system.GetApplicationProcessProgramID()); + + if (result != ResultSuccess) { + LOG_ERROR(Service_ACC, "Failed to get launch property"); + return Account::ResultInvalidApplication; + } + + switch (launch_property.base_game_storage_id) { + case FileSys::StorageId::GameCard: + application_info.application_type = ApplicationType::GameCard; + break; + case FileSys::StorageId::Host: + case FileSys::StorageId::NandSystem: + case FileSys::StorageId::NandUser: + case FileSys::StorageId::SdCard: + case FileSys::StorageId::None: // Yuzu specific, differs from hardware + application_info.application_type = ApplicationType::Digital; + break; + default: + LOG_ERROR(Service_ACC, "Invalid game storage ID! storage_id={}", + launch_property.base_game_storage_id); + return Account::ResultInvalidApplication; + } + + LOG_WARNING(Service_ACC, "ApplicationInfo init required"); + // TODO(ogniK): Actual initialization here + + return ResultSuccess; + } + + void StoreSaveDataThumbnail(HLERequestContext& ctx, const Common::UUID& uuid, + const u64 tid) { + IPC::ResponseBuilder rb{ctx, 2}; + + if (tid == 0) { + LOG_ERROR(Service_ACC, "TitleID is not valid!"); + rb.Push(Account::ResultInvalidApplication); + return; + } + + if (uuid.IsInvalid()) { + LOG_ERROR(Service_ACC, "User ID is not valid!"); + rb.Push(Account::ResultInvalidUserId); + return; + } + const auto thumbnail_size = ctx.GetReadBufferSize(); + if (thumbnail_size != THUMBNAIL_SIZE) { + LOG_ERROR(Service_ACC, "Buffer size is empty! size={:X} expecting {:X}", thumbnail_size, + THUMBNAIL_SIZE); + rb.Push(Account::ResultInvalidArrayLength); + return; + } + + // TODO(ogniK): Construct save data thumbnail + rb.Push(ResultSuccess); + } + + enum class ApplicationType : u32_le { + GameCard = 0, + Digital = 1, + Unknown = 3, + }; + + struct ApplicationInfo { + Service::Glue::ApplicationLaunchProperty launch_property; + ApplicationType application_type; + + constexpr explicit operator bool() const { + return launch_property.title_id != 0x0; + } + }; + + ApplicationInfo application_info{}; + protected: + std::shared_ptr module; + std::shared_ptr profile_manager; + }; +}; class ACC_AA final : public Module::Interface { public: explicit ACC_AA(std::shared_ptr module_, std::shared_ptr profile_manager_, Core::System& system_) - : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:aa") { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "EnsureCacheAsync"}, - {1, nullptr, "LoadCache"}, - {2, nullptr, "GetDeviceAccountId"}, - {50, nullptr, "RegisterNotificationTokenAsync"}, // 1.0.0 - 6.2.0 - {51, nullptr, "UnregisterNotificationTokenAsync"}, // 1.0.0 - 6.2.0 - }; - // clang-format on - RegisterHandlers(functions); + : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:aa") {} + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } ~ACC_AA() override = default; + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "EnsureCacheAsync"}, + FunctionInfo{1, nullptr, "LoadCache"}, + FunctionInfo{2, nullptr, "GetDeviceAccountId"}, + FunctionInfo{50, nullptr, "RegisterNotificationTokenAsync", MakeVersionGate({1,0,0}, {6,2,0})}, + FunctionInfo{51, nullptr, "UnregisterNotificationTokenAsync", MakeVersionGate({1,0,0}, {6,2,0})} + ); }; class ACC_SU final : public Module::Interface { public: explicit ACC_SU(std::shared_ptr module_, std::shared_ptr profile_manager_, Core::System& system_) - : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:su") { - // clang-format off - static const FunctionInfo functions[] = { - {0, &ACC_SU::GetUserCount, "GetUserCount"}, - {1, &ACC_SU::GetUserExistence, "GetUserExistence"}, - {2, &ACC_SU::ListAllUsers, "ListAllUsers"}, - {3, &ACC_SU::ListOpenUsers, "ListOpenUsers"}, - {4, &ACC_SU::GetLastOpenedUser, "GetLastOpenedUser"}, - {5, &ACC_SU::GetProfile, "GetProfile"}, - {6, nullptr, "GetProfileDigest"}, - {50, &ACC_SU::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, - {51, &ACC_SU::TrySelectUserWithoutInteractionDeprecated, "TrySelectUserWithoutInteractionDeprecated"}, - {52, &ACC_SU::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, // 19.0.0+ - {60, &ACC_SU::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, - {99, nullptr, "DebugActivateOpenContextRetention"}, - {100, nullptr, "GetUserRegistrationNotifier"}, - {101, nullptr, "GetUserStateChangeNotifier"}, - {102, &ACC_SU::GetBaasAccountManagerForSystemService, "GetBaasAccountManagerForSystemService"}, - {103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, - {104, nullptr, "GetProfileUpdateNotifier"}, - {105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, - {106, nullptr, "GetProfileSyncNotifier"}, - {110, &ACC_SU::StoreSaveDataThumbnailSystem, "StoreSaveDataThumbnail"}, - {111, nullptr, "ClearSaveDataThumbnail"}, - {112, nullptr, "LoadSaveDataThumbnail"}, - {113, nullptr, "GetSaveDataThumbnailExistence"}, - {120, nullptr, "ListOpenUsersInApplication"}, - {130, nullptr, "ActivateOpenContextRetention"}, - {140, &ACC_SU::ListQualifiedUsers, "ListQualifiedUsers"}, - {150, nullptr, "AuthenticateApplicationAsync"}, - {151, nullptr, "EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync"}, - {152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"}, - {190, nullptr, "GetUserLastOpenedApplication"}, - {191, nullptr, "ActivateOpenContextHolder"}, - {200, &ACC_SU::BeginUserRegistration, "BeginUserRegistration"}, - {201, &ACC_SU::CompleteUserRegistration, "CompleteUserRegistration"}, - {202, nullptr, "CancelUserRegistration"}, - {203, &ACC_SU::DeleteUser, "DeleteUser"}, - {204, &ACC_SU::SetUserPosition, "SetUserPosition"}, - {205, &ACC_SU::GetProfileEditor, "GetProfileEditor"}, - {206, nullptr, "CompleteUserRegistrationForcibly"}, - {210, nullptr, "CreateFloatingRegistrationRequest"}, - {211, nullptr, "CreateProcedureToRegisterUserWithNintendoAccount"}, - {212, nullptr, "ResumeProcedureToRegisterUserWithNintendoAccount"}, - {230, nullptr, "AuthenticateServiceAsync"}, - {250, &ACC_SU::GetBaasAccountAdministrator, "GetBaasAccountAdministrator"}, - {290, nullptr, "ProxyProcedureForGuestLoginWithNintendoAccount"}, - {291, nullptr, "ProxyProcedureForFloatingRegistrationWithNintendoAccount"}, - {299, nullptr, "SuspendBackgroundDaemon"}, - {400, nullptr, "SetPinCode"}, // 18.0.0+ - {401, &ACC_SU::GetPinCodeLength, "GetPinCodeLength"}, // 18.0.0+ - {402, nullptr, "GetPinCode"}, // 18.0.0+ - {403, nullptr, "GetPinCodeParity"}, - {404, nullptr, "VerifyPinCode"}, - {405, nullptr, "IsPinCodeVerificationForbidden"}, - {410, nullptr, "GetPinCodeErrorCount"}, // 18.0.0+ - {411, nullptr, "ResetPinCodeErrorCount"}, // 18.0.0+ - {412, nullptr, "IncrementPinCodeErrorCount"}, // 18.0.0+ - {900, nullptr, "SetUserUnqualifiedForDebug"}, - {901, nullptr, "UnsetUserUnqualifiedForDebug"}, - {902, nullptr, "ListUsersUnqualifiedForDebug"}, - {910, nullptr, "RefreshFirmwareSettingsForDebug"}, - {997, nullptr, "DebugInvalidateTokenCacheForUser"}, - {998, nullptr, "DebugSetUserStateClose"}, - {999, nullptr, "DebugSetUserStateOpen"}, - }; - // clang-format on + : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:su") {} - RegisterHandlers(functions); - } ~ACC_SU() override = default; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &ACC_SU::GetUserCount, "GetUserCount"}, + FunctionInfo{1, &ACC_SU::GetUserExistence, "GetUserExistence"}, + FunctionInfo{2, &ACC_SU::ListAllUsers, "ListAllUsers"}, + FunctionInfo{3, &ACC_SU::ListOpenUsers, "ListOpenUsers"}, + FunctionInfo{4, &ACC_SU::GetLastOpenedUser, "GetLastOpenedUser"}, + FunctionInfo{5, &ACC_SU::GetProfile, "GetProfile"}, + FunctionInfo{6, nullptr, "GetProfileDigest"}, + FunctionInfo{50, &ACC_SU::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, + FunctionInfo{51, &ACC_SU::TrySelectUserWithoutInteractionDeprecated, "TrySelectUserWithoutInteractionDeprecated"}, + FunctionInfo{52, &ACC_SU::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction", MakeVersionGate({19,0,0})}, + FunctionInfo{60, &ACC_SU::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, + FunctionInfo{99, nullptr, "DebugActivateOpenContextRetention"}, + FunctionInfo{100, nullptr, "GetUserRegistrationNotifier"}, + FunctionInfo{101, nullptr, "GetUserStateChangeNotifier"}, + FunctionInfo{102, &ACC_SU::GetBaasAccountManagerForSystemService, "GetBaasAccountManagerForSystemService"}, + FunctionInfo{103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, + FunctionInfo{104, nullptr, "GetProfileUpdateNotifier"}, + FunctionInfo{105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, + FunctionInfo{106, nullptr, "GetProfileSyncNotifier"}, + FunctionInfo{110, &ACC_SU::StoreSaveDataThumbnailSystem, "StoreSaveDataThumbnail"}, + FunctionInfo{111, nullptr, "ClearSaveDataThumbnail"}, + FunctionInfo{112, nullptr, "LoadSaveDataThumbnail"}, + FunctionInfo{113, nullptr, "GetSaveDataThumbnailExistence"}, + FunctionInfo{120, nullptr, "ListOpenUsersInApplication"}, + FunctionInfo{130, nullptr, "ActivateOpenContextRetention"}, + FunctionInfo{140, &ACC_SU::ListQualifiedUsers, "ListQualifiedUsers"}, + FunctionInfo{150, nullptr, "AuthenticateApplicationAsync"}, + FunctionInfo{151, nullptr, "EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync"}, + FunctionInfo{152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"}, + FunctionInfo{190, nullptr, "GetUserLastOpenedApplication"}, + FunctionInfo{191, nullptr, "ActivateOpenContextHolder"}, + FunctionInfo{200, &ACC_SU::BeginUserRegistration, "BeginUserRegistration"}, + FunctionInfo{201, &ACC_SU::CompleteUserRegistration, "CompleteUserRegistration"}, + FunctionInfo{202, nullptr, "CancelUserRegistration"}, + FunctionInfo{203, &ACC_SU::DeleteUser, "DeleteUser"}, + FunctionInfo{204, &ACC_SU::SetUserPosition, "SetUserPosition"}, + FunctionInfo{205, &ACC_SU::GetProfileEditor, "GetProfileEditor"}, + FunctionInfo{206, nullptr, "CompleteUserRegistrationForcibly"}, + FunctionInfo{210, nullptr, "CreateFloatingRegistrationRequest"}, + FunctionInfo{211, nullptr, "CreateProcedureToRegisterUserWithNintendoAccount"}, + FunctionInfo{212, nullptr, "ResumeProcedureToRegisterUserWithNintendoAccount"}, + FunctionInfo{230, nullptr, "AuthenticateServiceAsync"}, + FunctionInfo{250, &ACC_SU::GetBaasAccountAdministrator, "GetBaasAccountAdministrator"}, + FunctionInfo{290, nullptr, "ProxyProcedureForGuestLoginWithNintendoAccount"}, + FunctionInfo{291, nullptr, "ProxyProcedureForFloatingRegistrationWithNintendoAccount"}, + FunctionInfo{299, nullptr, "SuspendBackgroundDaemon"}, + FunctionInfo{400, nullptr, "SetPinCode", MakeVersionGate({18,0,0})}, + FunctionInfo{401, &ACC_SU::GetPinCodeLength, "GetPinCodeLength", MakeVersionGate({18,0,0})}, + FunctionInfo{402, nullptr, "GetPinCode", MakeVersionGate({18,0,0})}, + FunctionInfo{403, nullptr, "GetPinCodeParity"}, + FunctionInfo{404, nullptr, "VerifyPinCode"}, + FunctionInfo{405, nullptr, "IsPinCodeVerificationForbidden"}, + FunctionInfo{410, nullptr, "GetPinCodeErrorCount", MakeVersionGate({18,0,0})}, + FunctionInfo{411, nullptr, "ResetPinCodeErrorCount", MakeVersionGate({18,0,0})}, + FunctionInfo{412, nullptr, "IncrementPinCodeErrorCount", MakeVersionGate({18,0,0})}, + FunctionInfo{900, nullptr, "SetUserUnqualifiedForDebug"}, + FunctionInfo{901, nullptr, "UnsetUserUnqualifiedForDebug"}, + FunctionInfo{902, nullptr, "ListUsersUnqualifiedForDebug"}, + FunctionInfo{910, nullptr, "RefreshFirmwareSettingsForDebug"}, + FunctionInfo{997, nullptr, "DebugInvalidateTokenCacheForUser"}, + FunctionInfo{998, nullptr, "DebugSetUserStateClose"}, + FunctionInfo{999, nullptr, "DebugSetUserStateOpen"} + ); }; class ACC_U0 final : public Module::Interface { public: ACC_U0(std::shared_ptr module_, std::shared_ptr profile_manager_, Core::System& system_) - : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:u0") { - // clang-format off - static const FunctionInfo functions[] = { - {0, &ACC_U0::GetUserCount, "GetUserCount"}, - {1, &ACC_U0::GetUserExistence, "GetUserExistence"}, - {2, &ACC_U0::ListAllUsers, "ListAllUsers"}, - {3, &ACC_U0::ListOpenUsers, "ListOpenUsers"}, - {4, &ACC_U0::GetLastOpenedUser, "GetLastOpenedUser"}, - {5, &ACC_U0::GetProfile, "GetProfile"}, - {6, nullptr, "GetProfileDigest"}, // 3.0.0+ - {50, &ACC_U0::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, - {51, &ACC_U0::TrySelectUserWithoutInteractionDeprecated, "TrySelectUserWithoutInteractionDeprecated"}, - {52, &ACC_U0::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, - {60, &ACC_U0::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, // 5.0.0 - 5.1.0 - {99, nullptr, "DebugActivateOpenContextRetention"}, // 6.0.0+ - {100, &ACC_U0::InitializeApplicationInfo, "InitializeApplicationInfo"}, - {101, &ACC_U0::GetBaasAccountManagerForApplication, "GetBaasAccountManagerForApplication"}, - {102, nullptr, "AuthenticateApplicationAsync"}, - {103, nullptr, "CheckNetworkServiceAvailabilityAsync"}, // 4.0.0+ - {110, &ACC_U0::StoreSaveDataThumbnailApplication, "StoreSaveDataThumbnail"}, - {111, nullptr, "ClearSaveDataThumbnail"}, - {120, nullptr, "CreateGuestLoginRequest"}, - {130, nullptr, "LoadOpenContext"}, // 5.0.0+ - {131, &ACC_U0::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, // 6.0.0+ - {140, &ACC_U0::InitializeApplicationInfoRestricted, "InitializeApplicationInfoRestricted"}, // 6.0.0+ - {141, &ACC_U0::ListQualifiedUsers, "ListQualifiedUsers"}, // 6.0.0+ - {150, &ACC_U0::IsUserAccountSwitchLocked, "IsUserAccountSwitchLocked"}, // 6.0.0+ - {160, &ACC_U0::InitializeApplicationInfoV2, "InitializeApplicationInfoV2"}, - }; - // clang-format on + : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:u0") {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } ~ACC_U0() override = default; + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &ACC_U0::GetUserCount, "GetUserCount"}, + FunctionInfo{1, &ACC_U0::GetUserExistence, "GetUserExistence"}, + FunctionInfo{2, &ACC_U0::ListAllUsers, "ListAllUsers"}, + FunctionInfo{3, &ACC_U0::ListOpenUsers, "ListOpenUsers"}, + FunctionInfo{4, &ACC_U0::GetLastOpenedUser, "GetLastOpenedUser"}, + FunctionInfo{5, &ACC_U0::GetProfile, "GetProfile"}, + FunctionInfo{6, nullptr, "GetProfileDigest", MakeVersionGate({3,0,0})}, + FunctionInfo{50, &ACC_U0::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, + FunctionInfo{51, &ACC_U0::TrySelectUserWithoutInteractionDeprecated, "TrySelectUserWithoutInteractionDeprecated"}, + FunctionInfo{52, &ACC_U0::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, + FunctionInfo{60, &ACC_U0::ListOpenContextStoredUsers, "ListOpenContextStoredUsers", MakeVersionGate({5,0,0}, {5,1,0})}, + FunctionInfo{99, nullptr, "DebugActivateOpenContextRetention", MakeVersionGate({6,0,0})}, + FunctionInfo{100, &ACC_U0::InitializeApplicationInfo, "InitializeApplicationInfo"}, + FunctionInfo{101, &ACC_U0::GetBaasAccountManagerForApplication, "GetBaasAccountManagerForApplication"}, + FunctionInfo{102, nullptr, "AuthenticateApplicationAsync"}, + FunctionInfo{103, nullptr, "CheckNetworkServiceAvailabilityAsync", MakeVersionGate({4,0,0})}, + FunctionInfo{110, &ACC_U0::StoreSaveDataThumbnailApplication, "StoreSaveDataThumbnail"}, + FunctionInfo{111, nullptr, "ClearSaveDataThumbnail"}, + FunctionInfo{120, nullptr, "CreateGuestLoginRequest"}, + FunctionInfo{130, nullptr, "LoadOpenContext", MakeVersionGate({5,0,0})}, + FunctionInfo{131, &ACC_U0::ListOpenContextStoredUsers, "ListOpenContextStoredUsers", MakeVersionGate({6,0,0})}, + FunctionInfo{140, &ACC_U0::InitializeApplicationInfoRestricted, "InitializeApplicationInfoRestricted", MakeVersionGate({6,0,0})}, + FunctionInfo{141, &ACC_U0::ListQualifiedUsers, "ListQualifiedUsers", MakeVersionGate({6,0,0})}, + FunctionInfo{150, &ACC_U0::IsUserAccountSwitchLocked, "IsUserAccountSwitchLocked", MakeVersionGate({6,0,0})}, + FunctionInfo{160, &ACC_U0::InitializeApplicationInfoV2, "InitializeApplicationInfoV2"} + ); }; class ACC_U1 final : public Module::Interface { public: ACC_U1(std::shared_ptr module_, std::shared_ptr profile_manager_, Core::System& system_) - : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:u1") { - // clang-format off - static const FunctionInfo functions[] = { - {0, &ACC_U1::GetUserCount, "GetUserCount"}, - {1, &ACC_U1::GetUserExistence, "GetUserExistence"}, - {2, &ACC_U1::ListAllUsers, "ListAllUsers"}, - {3, &ACC_U1::ListOpenUsers, "ListOpenUsers"}, - {4, &ACC_U1::GetLastOpenedUser, "GetLastOpenedUser"}, - {5, &ACC_U1::GetProfile, "GetProfile"}, - {6, nullptr, "GetProfileDigest"}, - {50, &ACC_U1::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, - {51, &ACC_U1::TrySelectUserWithoutInteractionDeprecated, "TrySelectUserWithoutInteractionDeprecated"}, - {52, &ACC_U1::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, - {60, &ACC_U1::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, - {99, nullptr, "DebugActivateOpenContextRetention"}, - {100, nullptr, "GetUserRegistrationNotifier"}, - {101, nullptr, "GetUserStateChangeNotifier"}, - {102, &ACC_U1::GetBaasAccountManagerForSystemService, "GetBaasAccountManagerForSystemService"}, - {103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, - {104, nullptr, "GetProfileUpdateNotifier"}, - {105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, - {106, nullptr, "GetProfileSyncNotifier"}, - {110, &ACC_U1::StoreSaveDataThumbnailApplication, "StoreSaveDataThumbnail"}, - {111, nullptr, "ClearSaveDataThumbnail"}, - {112, nullptr, "LoadSaveDataThumbnail"}, - {113, nullptr, "GetSaveDataThumbnailExistence"}, - {120, nullptr, "ListOpenUsersInApplication"}, - {130, nullptr, "ActivateOpenContextRetention"}, - {140, &ACC_U1::ListQualifiedUsers, "ListQualifiedUsers"}, - {150, nullptr, "AuthenticateApplicationAsync"}, - {151, nullptr, "EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync"}, - {152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"}, - {190, nullptr, "GetUserLastOpenedApplication"}, - {191, nullptr, "ActivateOpenContextHolder"}, - {401, &ACC_U1::GetPinCodeLength, "GetPinCodeLength"}, // 18.0.0+ - {402, nullptr, "GetPinCode"}, // 18.0.0+ - {997, nullptr, "DebugInvalidateTokenCacheForUser"}, - {998, nullptr, "DebugSetUserStateClose"}, - {999, nullptr, "DebugSetUserStateOpen"}, - }; - // clang-format on + : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:u1") {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } ~ACC_U1() override = default; + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &ACC_U1::GetUserCount, "GetUserCount"}, + FunctionInfo{1, &ACC_U1::GetUserExistence, "GetUserExistence"}, + FunctionInfo{2, &ACC_U1::ListAllUsers, "ListAllUsers"}, + FunctionInfo{3, &ACC_U1::ListOpenUsers, "ListOpenUsers"}, + FunctionInfo{4, &ACC_U1::GetLastOpenedUser, "GetLastOpenedUser"}, + FunctionInfo{5, &ACC_U1::GetProfile, "GetProfile"}, + FunctionInfo{6, nullptr, "GetProfileDigest"}, + FunctionInfo{50, &ACC_U1::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, + FunctionInfo{51, &ACC_U1::TrySelectUserWithoutInteractionDeprecated, "TrySelectUserWithoutInteractionDeprecated"}, + FunctionInfo{52, &ACC_U1::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, + FunctionInfo{60, &ACC_U1::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, + FunctionInfo{99, nullptr, "DebugActivateOpenContextRetention"}, + FunctionInfo{100, nullptr, "GetUserRegistrationNotifier"}, + FunctionInfo{101, nullptr, "GetUserStateChangeNotifier"}, + FunctionInfo{102, &ACC_U1::GetBaasAccountManagerForSystemService, "GetBaasAccountManagerForSystemService"}, + FunctionInfo{103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, + FunctionInfo{104, nullptr, "GetProfileUpdateNotifier"}, + FunctionInfo{105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, + FunctionInfo{106, nullptr, "GetProfileSyncNotifier"}, + FunctionInfo{110, &ACC_U1::StoreSaveDataThumbnailApplication, "StoreSaveDataThumbnail"}, + FunctionInfo{111, nullptr, "ClearSaveDataThumbnail"}, + FunctionInfo{112, nullptr, "LoadSaveDataThumbnail"}, + FunctionInfo{113, nullptr, "GetSaveDataThumbnailExistence"}, + FunctionInfo{120, nullptr, "ListOpenUsersInApplication"}, + FunctionInfo{130, nullptr, "ActivateOpenContextRetention"}, + FunctionInfo{140, &ACC_U1::ListQualifiedUsers, "ListQualifiedUsers"}, + FunctionInfo{150, nullptr, "AuthenticateApplicationAsync"}, + FunctionInfo{151, nullptr, "EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync"}, + FunctionInfo{152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"}, + FunctionInfo{190, nullptr, "GetUserLastOpenedApplication"}, + FunctionInfo{191, nullptr, "ActivateOpenContextHolder"}, + FunctionInfo{401, &ACC_U1::GetPinCodeLength, "GetPinCodeLength", MakeVersionGate({18,0,0})}, + FunctionInfo{402, nullptr, "GetPinCode", MakeVersionGate({18,0,0})}, + FunctionInfo{997, nullptr, "DebugInvalidateTokenCacheForUser"}, + FunctionInfo{998, nullptr, "DebugSetUserStateClose"}, + FunctionInfo{999, nullptr, "DebugSetUserStateOpen"} + ); }; class DAUTH_0 final : public ServiceFramework { public: - explicit DAUTH_0(Core::System& system_) : ServiceFramework{system_, "dauth:0"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "EnsureAuthenticationTokenCacheAsync"}, - {1, nullptr, "LoadAuthenticationTokenCache"}, - {2, nullptr, "InvalidateAuthenticationTokenCache"}, - {3, nullptr, "IsDeviceAuthenticationTokenCacheAvailable"}, - {10, nullptr, "EnsureEdgeTokenCacheAsync"}, - {11, nullptr, "LoadEdgeTokenCache"}, - {12, nullptr, "InvalidateEdgeTokenCache"}, - {13, nullptr, "IsEdgeTokenCacheAvailable"}, - {20, nullptr, "EnsureApplicationAuthenticationCacheAsync"}, - {21, nullptr, "LoadApplicationAuthenticationTokenCache"}, - {22, nullptr, "LoadApplicationNetworkServiceClientConfigCache"}, - {23, nullptr, "IsApplicationAuthenticationCacheAvailable"}, - {24, nullptr, "InvalidateApplicationAuthenticationCache"}, - {30, nullptr, "EnsureGameCardAuthenticationCacheAsync"}, - {31, nullptr, "LoadGameCardAuthenticationTokenCache"}, - {32, nullptr, "IsGameCardAuthenticationCacheAvailable"}, - {33, nullptr, "InvalidateGameCardAuthenticationCache"}, - {1000, nullptr, "GetInactiveElicenseUsedEvent"}, - {9000, nullptr, "ImportVirtualClientCertificate"}, - {9010, nullptr, "DeleteVirtualClientCertificate"}, - }; - // clang-format on - RegisterHandlers(functions); + explicit DAUTH_0(Core::System& system_) : ServiceFramework{system_, "dauth:0"} {} + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "EnsureAuthenticationTokenCacheAsync"}, + FunctionInfo{1, nullptr, "LoadAuthenticationTokenCache"}, + FunctionInfo{2, nullptr, "InvalidateAuthenticationTokenCache"}, + FunctionInfo{3, nullptr, "IsDeviceAuthenticationTokenCacheAvailable"}, + FunctionInfo{10, nullptr, "EnsureEdgeTokenCacheAsync"}, + FunctionInfo{11, nullptr, "LoadEdgeTokenCache"}, + FunctionInfo{12, nullptr, "InvalidateEdgeTokenCache"}, + FunctionInfo{13, nullptr, "IsEdgeTokenCacheAvailable"}, + FunctionInfo{20, nullptr, "EnsureApplicationAuthenticationCacheAsync"}, + FunctionInfo{21, nullptr, "LoadApplicationAuthenticationTokenCache"}, + FunctionInfo{22, nullptr, "LoadApplicationNetworkServiceClientConfigCache"}, + FunctionInfo{23, nullptr, "IsApplicationAuthenticationCacheAvailable"}, + FunctionInfo{24, nullptr, "InvalidateApplicationAuthenticationCache"}, + FunctionInfo{30, nullptr, "EnsureGameCardAuthenticationCacheAsync"}, + FunctionInfo{31, nullptr, "LoadGameCardAuthenticationTokenCache"}, + FunctionInfo{32, nullptr, "IsGameCardAuthenticationCacheAvailable"}, + FunctionInfo{33, nullptr, "InvalidateGameCardAuthenticationCache"}, + FunctionInfo{1000, nullptr, "GetInactiveElicenseUsedEvent"}, + FunctionInfo{9000, nullptr, "ImportVirtualClientCertificate"}, + FunctionInfo{9010, nullptr, "DeleteVirtualClientCertificate"} + ); }; class ACC_E final : public Module::Interface { public: explicit ACC_E(std::shared_ptr module_, std::shared_ptr profile_manager_, Core::System& system_) - : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:e") { - // clang-format off - static const FunctionInfo functions[] = { - { 0, nullptr, "GetUserCount"}, - { 1, nullptr, "GetUserExistence"}, - { 2, nullptr, "ListAllUsers"}, - { 3, nullptr, "ListOpenUsers"}, - { 4, nullptr, "GetLastOpenedUser"}, - { 5, nullptr, "GetProfile"}, - { 6, nullptr, "GetProfileDigest"}, - { 50, nullptr, "IsUserRegistrationRequestPermitted"}, - { 51, nullptr, "TrySelectUserWithoutInteractionDeprecated"}, - { 52, nullptr, "TrySelectUserWithoutInteraction"}, - { 99, nullptr, "DebugActivateOpenContextRetention"}, - { 100, nullptr, "GetUserRegistrationNotifier"}, - { 101, nullptr, "GetUserStateChangeNotifier"}, - { 102, nullptr, "GetBaasAccountManagerForSystemService"}, - { 103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, - { 104, nullptr, "GetProfileUpdateNotifier"}, - { 105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, - { 106, nullptr, "GetProfileSyncNotifier"}, - { 110, nullptr, "StoreSaveDataThumbnail"}, - { 111, nullptr, "ClearSaveDataThumbnail"}, - { 112, nullptr, "LoadSaveDataThumbnail"}, - { 113, nullptr, "GetSaveDataThumbnailExistence"}, - { 120, nullptr, "ListOpenUsersInApplication"}, - { 130, nullptr, "ActivateOpenContextRetention"}, - { 140, nullptr, "ListQualifiedUsers"}, - { 151, nullptr, "EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync"}, - { 152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"}, - { 170, nullptr, "GetNasOp2MembershipStateChangeNotifier"}, - { 191, nullptr, "UpdateNotificationReceiverInfo"}, - { 200, nullptr, "BeginUserRegistration"}, - { 201, nullptr, "CompleteUserRegistration"}, - { 202, nullptr, "CancelUserRegistration"}, - { 203, nullptr, "DeleteUser"}, - { 204, nullptr, "SetUserPosition"}, - { 205, nullptr, "GetProfileEditor"}, - { 206, nullptr, "CompleteUserRegistrationForcibly"}, - { 210, nullptr, "CreateFloatingRegistrationRequest"}, - { 211, nullptr, "CreateProcedureToRegisterUserWithNintendoAccount"}, - { 212, nullptr, "ResumeProcedureToRegisterUserWithNintendoAccount"}, - { 213, nullptr, "CreateProcedureToCreateUserWithNintendoAccount"}, - { 214, nullptr, "ResumeProcedureToCreateUserWithNintendoAccount"}, - { 215, nullptr, "ResumeProcedureToCreateUserWithNintendoAccountAfterApplyResponse"}, - { 230, nullptr, "AuthenticateServiceAsync"}, - { 250, nullptr, "GetBaasAccountAdministrator"}, - { 251, nullptr, "SynchronizeNetworkServiceAccountsSnapshotAsync"}, - { 290, nullptr, "ProxyProcedureForGuestLoginWithNintendoAccount"}, - { 291, nullptr, "ProxyProcedureForFloatingRegistrationWithNintendoAccount"}, - { 292, nullptr, "ProxyProcedureForDeviceMigrationAuthenticatingOperatingUser"}, - { 293, nullptr, "ProxyProcedureForDeviceMigrationDownload"}, - { 299, nullptr, "SuspendBackgroundDaemon"}, - { 350, nullptr, "CreateDeviceMigrationUserExportRequest"}, - { 351, nullptr, "UploadNasCredential"}, - { 352, nullptr, "CreateDeviceMigrationUserImportRequest"}, - { 353, nullptr, "DeleteUserMigrationSaveData"}, - { 400, nullptr, "SetPinCode"}, - { 401, nullptr, "GetPinCodeLength"}, - { 402, nullptr, "GetPinCode"}, - { 403, nullptr, "GetPinCodeParity"}, - { 404, nullptr, "VerifyPinCode"}, - { 405, nullptr, "IsPinCodeVerificationForbidden"}, - { 410, nullptr, "GetPinCodeErrorCount"}, - { 411, nullptr, "ResetPinCodeErrorCount"}, - { 412, nullptr, "IncrementPinCodeErrorCount"}, - { 413, nullptr, "SetPinCodeErrorCount"}, - { 420, nullptr, "SetStartPenaltyTime"}, - { 421, nullptr, "GetStartPenaltyTime"}, - { 900, nullptr, "SetUserUnqualifiedForDebug"}, - { 901, nullptr, "UnsetUserUnqualifiedForDebug"}, - { 902, nullptr, "ListUsersUnqualifiedForDebug"}, - { 910, nullptr, "RefreshFirmwareSettingsForDebug"}, - { 997, nullptr, "DebugInvalidateTokenCacheForUser"}, - { 998, nullptr, "DebugSetUserStateClose"}, - { 999, nullptr, "DebugSetUserStateOpen"}, - { 1000, nullptr, "CreateIAccountEntityServiceForApplication"}, - { 1100, nullptr, "CreateIUserStateManager"}, - { 10050, nullptr, "IsUserRegistrationRequestPermittedForAccountPolicy"}, - { 10105, nullptr, "CheckNetworkServiceAvailabilityAsyncForAccountPolicy"}, - }; - // clang-format on - RegisterHandlers(functions); + : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:e") {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetUserCount"}, + FunctionInfo{1, nullptr, "GetUserExistence"}, + FunctionInfo{2, nullptr, "ListAllUsers"}, + FunctionInfo{3, nullptr, "ListOpenUsers"}, + FunctionInfo{4, nullptr, "GetLastOpenedUser"}, + FunctionInfo{5, nullptr, "GetProfile"}, + FunctionInfo{6, nullptr, "GetProfileDigest"}, + FunctionInfo{50, nullptr, "IsUserRegistrationRequestPermitted"}, + FunctionInfo{51, nullptr, "TrySelectUserWithoutInteractionDeprecated"}, + FunctionInfo{52, nullptr, "TrySelectUserWithoutInteraction"}, + FunctionInfo{99, nullptr, "DebugActivateOpenContextRetention"}, + FunctionInfo{100, nullptr, "GetUserRegistrationNotifier"}, + FunctionInfo{101, nullptr, "GetUserStateChangeNotifier"}, + FunctionInfo{102, nullptr, "GetBaasAccountManagerForSystemService"}, + FunctionInfo{103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, + FunctionInfo{104, nullptr, "GetProfileUpdateNotifier"}, + FunctionInfo{105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, + FunctionInfo{106, nullptr, "GetProfileSyncNotifier"}, + FunctionInfo{110, nullptr, "StoreSaveDataThumbnail"}, + FunctionInfo{111, nullptr, "ClearSaveDataThumbnail"}, + FunctionInfo{112, nullptr, "LoadSaveDataThumbnail"}, + FunctionInfo{113, nullptr, "GetSaveDataThumbnailExistence"}, + FunctionInfo{120, nullptr, "ListOpenUsersInApplication"}, + FunctionInfo{130, nullptr, "ActivateOpenContextRetention"}, + FunctionInfo{140, nullptr, "ListQualifiedUsers"}, + FunctionInfo{151, nullptr, "EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync"}, + FunctionInfo{152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"}, + FunctionInfo{170, nullptr, "GetNasOp2MembershipStateChangeNotifier"}, + FunctionInfo{191, nullptr, "UpdateNotificationReceiverInfo"}, + FunctionInfo{200, nullptr, "BeginUserRegistration"}, + FunctionInfo{201, nullptr, "CompleteUserRegistration"}, + FunctionInfo{202, nullptr, "CancelUserRegistration"}, + FunctionInfo{203, nullptr, "DeleteUser"}, + FunctionInfo{204, nullptr, "SetUserPosition"}, + FunctionInfo{205, nullptr, "GetProfileEditor"}, + FunctionInfo{206, nullptr, "CompleteUserRegistrationForcibly"}, + FunctionInfo{210, nullptr, "CreateFloatingRegistrationRequest"}, + FunctionInfo{211, nullptr, "CreateProcedureToRegisterUserWithNintendoAccount"}, + FunctionInfo{212, nullptr, "ResumeProcedureToRegisterUserWithNintendoAccount"}, + FunctionInfo{213, nullptr, "CreateProcedureToCreateUserWithNintendoAccount"}, + FunctionInfo{214, nullptr, "ResumeProcedureToCreateUserWithNintendoAccount"}, + FunctionInfo{215, nullptr, "ResumeProcedureToCreateUserWithNintendoAccountAfterApplyResponse"}, + FunctionInfo{230, nullptr, "AuthenticateServiceAsync"}, + FunctionInfo{250, nullptr, "GetBaasAccountAdministrator"}, + FunctionInfo{251, nullptr, "SynchronizeNetworkServiceAccountsSnapshotAsync"}, + FunctionInfo{290, nullptr, "ProxyProcedureForGuestLoginWithNintendoAccount"}, + FunctionInfo{291, nullptr, "ProxyProcedureForFloatingRegistrationWithNintendoAccount"}, + FunctionInfo{292, nullptr, "ProxyProcedureForDeviceMigrationAuthenticatingOperatingUser"}, + FunctionInfo{293, nullptr, "ProxyProcedureForDeviceMigrationDownload"}, + FunctionInfo{299, nullptr, "SuspendBackgroundDaemon"}, + FunctionInfo{350, nullptr, "CreateDeviceMigrationUserExportRequest"}, + FunctionInfo{351, nullptr, "UploadNasCredential"}, + FunctionInfo{352, nullptr, "CreateDeviceMigrationUserImportRequest"}, + FunctionInfo{353, nullptr, "DeleteUserMigrationSaveData"}, + FunctionInfo{400, nullptr, "SetPinCode"}, + FunctionInfo{401, nullptr, "GetPinCodeLength"}, + FunctionInfo{402, nullptr, "GetPinCode"}, + FunctionInfo{403, nullptr, "GetPinCodeParity"}, + FunctionInfo{404, nullptr, "VerifyPinCode"}, + FunctionInfo{405, nullptr, "IsPinCodeVerificationForbidden"}, + FunctionInfo{410, nullptr, "GetPinCodeErrorCount"}, + FunctionInfo{411, nullptr, "ResetPinCodeErrorCount"}, + FunctionInfo{412, nullptr, "IncrementPinCodeErrorCount"}, + FunctionInfo{413, nullptr, "SetPinCodeErrorCount"}, + FunctionInfo{420, nullptr, "SetStartPenaltyTime"}, + FunctionInfo{421, nullptr, "GetStartPenaltyTime"}, + FunctionInfo{900, nullptr, "SetUserUnqualifiedForDebug"}, + FunctionInfo{901, nullptr, "UnsetUserUnqualifiedForDebug"}, + FunctionInfo{902, nullptr, "ListUsersUnqualifiedForDebug"}, + FunctionInfo{910, nullptr, "RefreshFirmwareSettingsForDebug"}, + FunctionInfo{997, nullptr, "DebugInvalidateTokenCacheForUser"}, + FunctionInfo{998, nullptr, "DebugSetUserStateClose"}, + FunctionInfo{999, nullptr, "DebugSetUserStateOpen"}, + FunctionInfo{1000, nullptr, "CreateIAccountEntityServiceForApplication"}, + FunctionInfo{1100, nullptr, "CreateIUserStateManager"}, + FunctionInfo{10050, nullptr, "IsUserRegistrationRequestPermittedForAccountPolicy"}, + FunctionInfo{10105, nullptr, "CheckNetworkServiceAvailabilityAsyncForAccountPolicy"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class ACC_E_U1 final : public Module::Interface { public: explicit ACC_E_U1(std::shared_ptr module_, std::shared_ptr profile_manager_, Core::System& system_) - : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:e:u1") { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetUserCount"}, - {1, nullptr, "GetUserExistence"}, - {2, nullptr, "ListAllUsers"}, - {3, nullptr, "ListOpenUsers"}, - {4, nullptr, "GetLastOpenedUser"}, - {5, nullptr, "GetProfile"}, - {6, nullptr, "GetProfileDigest"}, - {50, nullptr, "IsUserRegistrationRequestPermitted"}, - {51, nullptr, "TrySelectUserWithoutInteractionDeprecated"}, - {99, nullptr, "DebugActivateOpenContextRetention"}, - {100, nullptr, "GetUserRegistrationNotifier"}, - {101, nullptr, "GetUserStateChangeNotifier"}, - {102, nullptr, "GetBaasAccountManagerForSystemService"}, - {103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, - {104, nullptr, "GetProfileUpdateNotifier"}, - {105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, - {106, nullptr, "GetProfileSyncNotifier"}, - {110, nullptr, "StoreSaveDataThumbnail"}, - {111, nullptr, "ClearSaveDataThumbnail"}, - {112, nullptr, "LoadSaveDataThumbnail"}, - {113, nullptr, "GetSaveDataThumbnailExistence"}, - {120, nullptr, "ListOpenUsersInApplication"}, - {130, nullptr, "ActivateOpenContextRetention"}, - {140, nullptr, "ListQualifiedUsers"}, - {151, nullptr, "EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync"}, - {152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"}, - {170, nullptr, "GetNasOp2MembershipStateChangeNotifier"}, - {191, nullptr, "UpdateNotificationReceiverInfo"}, - {997, nullptr, "DebugInvalidateTokenCacheForUser"}, - {998, nullptr, "DebugSetUserStateClose"}, - {999, nullptr, "DebugSetUserStateOpen"}, - }; - // clang-format on - RegisterHandlers(functions); + : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:e:u1") {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetUserCount"}, + FunctionInfo{1, nullptr, "GetUserExistence"}, + FunctionInfo{2, nullptr, "ListAllUsers"}, + FunctionInfo{3, nullptr, "ListOpenUsers"}, + FunctionInfo{4, nullptr, "GetLastOpenedUser"}, + FunctionInfo{5, nullptr, "GetProfile"}, + FunctionInfo{6, nullptr, "GetProfileDigest"}, + FunctionInfo{50, nullptr, "IsUserRegistrationRequestPermitted"}, + FunctionInfo{51, nullptr, "TrySelectUserWithoutInteractionDeprecated"}, + FunctionInfo{99, nullptr, "DebugActivateOpenContextRetention"}, + FunctionInfo{100, nullptr, "GetUserRegistrationNotifier"}, + FunctionInfo{101, nullptr, "GetUserStateChangeNotifier"}, + FunctionInfo{102, nullptr, "GetBaasAccountManagerForSystemService"}, + FunctionInfo{103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, + FunctionInfo{104, nullptr, "GetProfileUpdateNotifier"}, + FunctionInfo{105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, + FunctionInfo{106, nullptr, "GetProfileSyncNotifier"}, + FunctionInfo{110, nullptr, "StoreSaveDataThumbnail"}, + FunctionInfo{111, nullptr, "ClearSaveDataThumbnail"}, + FunctionInfo{112, nullptr, "LoadSaveDataThumbnail"}, + FunctionInfo{113, nullptr, "GetSaveDataThumbnailExistence"}, + FunctionInfo{120, nullptr, "ListOpenUsersInApplication"}, + FunctionInfo{130, nullptr, "ActivateOpenContextRetention"}, + FunctionInfo{140, nullptr, "ListQualifiedUsers"}, + FunctionInfo{151, nullptr, "EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync"}, + FunctionInfo{152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"}, + FunctionInfo{170, nullptr, "GetNasOp2MembershipStateChangeNotifier"}, + FunctionInfo{191, nullptr, "UpdateNotificationReceiverInfo"}, + FunctionInfo{997, nullptr, "DebugInvalidateTokenCacheForUser"}, + FunctionInfo{998, nullptr, "DebugSetUserStateClose"}, + FunctionInfo{999, nullptr, "DebugSetUserStateOpen"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class ACC_E_U2 final : public Module::Interface { public: explicit ACC_E_U2(std::shared_ptr module_, std::shared_ptr profile_manager_, Core::System& system_) - : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:e:u2") { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetUserCount"}, - {1, nullptr, "GetUserExistence"}, - {2, nullptr, "ListAllUsers"}, - {3, nullptr, "ListOpenUsers"}, - {4, nullptr, "GetLastOpenedUser"}, - {5, nullptr, "GetProfile"}, - {6, nullptr, "GetProfileDigest"}, - {50, nullptr, "#IsUserRegistrationRequestPermitted"}, - {51, nullptr, "TrySelectUserWithoutInteractionDeprecated"}, - {52, nullptr, "TrySelectUserWithoutInteraction"}, - {99, nullptr, "DebugActivateOpenContextRetention"}, - {100, nullptr, "GetUserRegistrationNotifier"}, - {101, nullptr, "GetUserStateChangeNotifier"}, - {102, nullptr, "GetBaasAccountManagerForSystemService"}, - {103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, - {104, nullptr, "GetProfileUpdateNotifier"}, - {105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, - {106, nullptr, "GetProfileSyncNotifier"}, - {110, nullptr, "StoreSaveDataThumbnail"}, - {111, nullptr, "ClearSaveDataThumbnail"}, - {112, nullptr, "LoadSaveDataThumbnail"}, - {113, nullptr, "GetSaveDataThumbnailExistence"}, - {120, nullptr, "ListOpenUsersInApplication"}, - {130, nullptr, "ActivateOpenContextRetention"}, - {140, nullptr, "ListQualifiedUsers"}, - {151, nullptr, "EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync"}, - {152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"}, - {170, nullptr, "GetNasOp2MembershipStateChangeNotifier"}, - {191, nullptr, "UpdateNotificationReceiverInfo"}, - {205, nullptr, "GetProfileEditor"}, - {401, nullptr, "GetPinCodeLength"}, - {402, nullptr, "GetPinCode"}, - {403, nullptr, "GetPinCodeParity"}, - {404, nullptr, "VerifyPinCode"}, - {405, nullptr, "IsPinCodeVerificationForbidden"}, - {997, nullptr, "DebugInvalidateTokenCacheForUser"}, - {998, nullptr, "DebugSetUserStateClose"}, - {999, nullptr, "DebugSetUserStateOpen"}, - }; - // clang-format on - RegisterHandlers(functions); + : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:e:u2") {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetUserCount"}, + FunctionInfo{1, nullptr, "GetUserExistence"}, + FunctionInfo{2, nullptr, "ListAllUsers"}, + FunctionInfo{3, nullptr, "ListOpenUsers"}, + FunctionInfo{4, nullptr, "GetLastOpenedUser"}, + FunctionInfo{5, nullptr, "GetProfile"}, + FunctionInfo{6, nullptr, "GetProfileDigest"}, + FunctionInfo{50, nullptr, "IsUserRegistrationRequestPermitted"}, + FunctionInfo{51, nullptr, "TrySelectUserWithoutInteractionDeprecated"}, + FunctionInfo{52, nullptr, "TrySelectUserWithoutInteraction"}, + FunctionInfo{99, nullptr, "DebugActivateOpenContextRetention"}, + FunctionInfo{100, nullptr, "GetUserRegistrationNotifier"}, + FunctionInfo{101, nullptr, "GetUserStateChangeNotifier"}, + FunctionInfo{102, nullptr, "GetBaasAccountManagerForSystemService"}, + FunctionInfo{103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, + FunctionInfo{104, nullptr, "GetProfileUpdateNotifier"}, + FunctionInfo{105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, + FunctionInfo{106, nullptr, "GetProfileSyncNotifier"}, + FunctionInfo{110, nullptr, "StoreSaveDataThumbnail"}, + FunctionInfo{111, nullptr, "ClearSaveDataThumbnail"}, + FunctionInfo{112, nullptr, "LoadSaveDataThumbnail"}, + FunctionInfo{113, nullptr, "GetSaveDataThumbnailExistence"}, + FunctionInfo{120, nullptr, "ListOpenUsersInApplication"}, + FunctionInfo{130, nullptr, "ActivateOpenContextRetention"}, + FunctionInfo{140, nullptr, "ListQualifiedUsers"}, + FunctionInfo{151, nullptr, "EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync"}, + FunctionInfo{152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"}, + FunctionInfo{170, nullptr, "GetNasOp2MembershipStateChangeNotifier"}, + FunctionInfo{191, nullptr, "UpdateNotificationReceiverInfo"}, + FunctionInfo{205, nullptr, "GetProfileEditor"}, + FunctionInfo{401, nullptr, "GetPinCodeLength"}, + FunctionInfo{402, nullptr, "GetPinCode"}, + FunctionInfo{403, nullptr, "GetPinCodeParity"}, + FunctionInfo{404, nullptr, "VerifyPinCode"}, + FunctionInfo{405, nullptr, "IsPinCodeVerificationForbidden"}, + FunctionInfo{997, nullptr, "DebugInvalidateTokenCacheForUser"}, + FunctionInfo{998, nullptr, "DebugSetUserStateClose"}, + FunctionInfo{999, nullptr, "DebugSetUserStateOpen"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; diff --git a/src/core/hle/service/acc/acc.h b/src/core/hle/service/acc/acc.h index 19af7c74c9..9c2c96acdb 100644 --- a/src/core/hle/service/acc/acc.h +++ b/src/core/hle/service/acc/acc.h @@ -14,70 +14,6 @@ namespace Service::Account { class ProfileManager; -class Module final { -public: - class Interface : public ServiceFramework { - public: - explicit Interface(std::shared_ptr module_, - std::shared_ptr profile_manager_, Core::System& system_, - const char* name); - ~Interface() override; - - void GetUserCount(HLERequestContext& ctx); - void GetUserExistence(HLERequestContext& ctx); - void ListAllUsers(HLERequestContext& ctx); - void ListOpenUsers(HLERequestContext& ctx); - void GetLastOpenedUser(HLERequestContext& ctx); - void GetProfile(HLERequestContext& ctx); - void InitializeApplicationInfo(HLERequestContext& ctx); - void InitializeApplicationInfoRestricted(HLERequestContext& ctx); - void GetBaasAccountManagerForApplication(HLERequestContext& ctx); - void IsUserRegistrationRequestPermitted(HLERequestContext& ctx); - void TrySelectUserWithoutInteractionDeprecated(HLERequestContext& ctx); - void TrySelectUserWithoutInteraction(HLERequestContext& ctx); - void IsUserAccountSwitchLocked(HLERequestContext& ctx); - void InitializeApplicationInfoV2(HLERequestContext& ctx); - void BeginUserRegistration(HLERequestContext& ctx); - void CompleteUserRegistration(HLERequestContext& ctx); - void DeleteUser(HLERequestContext& ctx); - void SetUserPosition(HLERequestContext& ctx); - void GetProfileEditor(HLERequestContext& ctx); - void GetBaasAccountAdministrator(HLERequestContext &ctx); - void ListQualifiedUsers(HLERequestContext& ctx); - void ListOpenContextStoredUsers(HLERequestContext& ctx); - void StoreSaveDataThumbnailApplication(HLERequestContext& ctx); - void GetBaasAccountManagerForSystemService(HLERequestContext& ctx); - void StoreSaveDataThumbnailSystem(HLERequestContext& ctx); - void GetPinCodeLength(HLERequestContext& ctx); - - private: - Result InitializeApplicationInfoBase(); - void StoreSaveDataThumbnail(HLERequestContext& ctx, const Common::UUID& uuid, - const u64 tid); - - enum class ApplicationType : u32_le { - GameCard = 0, - Digital = 1, - Unknown = 3, - }; - - struct ApplicationInfo { - Service::Glue::ApplicationLaunchProperty launch_property; - ApplicationType application_type; - - constexpr explicit operator bool() const { - return launch_property.title_id != 0x0; - } - }; - - ApplicationInfo application_info{}; - - protected: - std::shared_ptr module; - std::shared_ptr profile_manager; - }; -}; - void LoopProcess(Core::System& system); } // namespace Service::Account diff --git a/src/core/hle/service/acc/async_context.cpp b/src/core/hle/service/acc/async_context.cpp index 8dec886ad7..a7f751d756 100644 --- a/src/core/hle/service/acc/async_context.cpp +++ b/src/core/hle/service/acc/async_context.cpp @@ -12,17 +12,6 @@ namespace Service::Account { IAsyncContext::IAsyncContext(Core::System& system_) : ServiceFramework{system_, "IAsyncContext"}, service_context{system_, "IAsyncContext"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &IAsyncContext::GetSystemEvent, "GetSystemEvent"}, - {1, &IAsyncContext::Cancel, "Cancel"}, - {2, &IAsyncContext::HasDone, "HasDone"}, - {3, &IAsyncContext::GetResult, "GetResult"}, - }; - // clang-format on - - RegisterHandlers(functions); - completion_event = service_context.CreateEvent("IAsyncContext:CompletionEvent"); } diff --git a/src/core/hle/service/acc/async_context.h b/src/core/hle/service/acc/async_context.h index d7bffc055e..0137567d11 100644 --- a/src/core/hle/service/acc/async_context.h +++ b/src/core/hle/service/acc/async_context.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -30,6 +33,16 @@ protected: void MarkComplete(); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &IAsyncContext::GetSystemEvent, "GetSystemEvent"}, + FunctionInfo{1, &IAsyncContext::Cancel, "Cancel"}, + FunctionInfo{2, &IAsyncContext::HasDone, "HasDone"}, + FunctionInfo{3, &IAsyncContext::GetResult, "GetResult"} + ); + KernelHelpers::ServiceContext service_context; std::atomic is_complete{false}; diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 2ef393439b..472be8f0f0 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -1,16 +1,1343 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include "common/settings.h" +#include "core/core.h" +#include "core/file_sys/common_funcs.h" +#include "core/file_sys/patch_manager.h" +#include "core/file_sys/romfs_factory.h" +#include "core/file_sys/control_metadata.h" +#include "core/hle/api_version.h" +#include "core/hle/kernel/k_transfer_memory.h" +#include "core/hle/service/server_manager.h" +#include "core/hle/service/am/applet_manager.h" +#include "core/hle/service/am/window_system.h" #include "core/hle/service/am/am.h" #include "core/hle/service/am/button_poller.h" #include "core/hle/service/am/event_observer.h" -#include "core/hle/service/am/service/all_system_applet_proxies_service.h" -#include "core/hle/service/am/service/application_proxy_service.h" -#include "core/hle/service/am/window_system.h" -#include "core/hle/service/server_manager.h" +#include "core/hle/service/am/service/application_creator.h" +#include "core/hle/service/am/service/audio_controller.h" +#include "core/hle/service/am/service/common_state_getter.h" +#include "core/hle/service/am/service/display_controller.h" +#include "core/hle/service/am/service/global_state_controller.h" +#include "core/hle/service/am/service/home_menu_functions.h" +#include "core/hle/service/am/service/process_winding_controller.h" +#include "core/hle/service/am/service/self_controller.h" +#include "core/hle/service/am/service/window_controller.h" +#include "core/hle/service/am/service/application_functions.h" +#include "core/hle/service/am/applet_data_broker.h" +#include "core/hle/service/am/frontend/applets.h" +#include "core/hle/service/am/library_applet_storage.h" +#include "core/hle/service/am/process_creation.h" +#include "core/hle/service/am/service/library_applet_accessor.h" +#include "core/hle/service/am/service/overlay_functions.h" +#include "core/hle/service/am/service/storage.h" +#include "core/hle/service/ns/language.h" +#include "core/hle/service/ns/application_manager_interface.h" +#include "core/hle/service/ns/service_getter_interface.h" +#include "core/hle/service/glue/glue_manager.h" +#include "core/hle/service/sm/sm.h" +#include "core/hle/service/acc/profile_manager.h" +#include "core/hle/service/am/frontend/applet_profile_select.h" +#include "core/hle/service/cmif_serialization.h" namespace Service::AM { +struct Applet; +class IAppletCommonFunctions; +class IApplicationCreator; +class IAudioController; +class ICommonStateGetter; +class IDebugFunctions; +class IDisplayController; +class IHomeMenuFunctions; +class IGlobalStateController; +class ILibraryAppletCreator; +class IProcessWindingController; +class ISelfController; +class IWindowController; +class WindowSystem; + +class IDebugFunctions final : public ServiceFramework { +public: + explicit IDebugFunctions(Core::System& system_) : ServiceFramework{system_, "IDebugFunctions"} {} + ~IDebugFunctions() override = default; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "NotifyMessageToHomeMenuForDebug"}, + FunctionInfo{1, nullptr, "OpenMainApplication"}, + FunctionInfo{10, nullptr, "PerformSystemButtonPressing"}, + FunctionInfo{20, nullptr, "InvalidateTransitionLayer"}, + FunctionInfo{30, nullptr, "RequestLaunchApplicationWithUserAndArgumentForDebug"}, + FunctionInfo{31, nullptr, "RequestLaunchApplicationByApplicationLaunchInfoForDebug"}, + FunctionInfo{40, nullptr, "GetAppletResourceUsageInfo"}, + FunctionInfo{50, nullptr, "AddSystemProgramIdAndAppletIdForDebug"}, + FunctionInfo{51, nullptr, "AddOperationConfirmedLibraryAppletIdForDebug"}, + FunctionInfo{100, nullptr, "SetCpuBoostModeForApplet"}, + FunctionInfo{101, nullptr, "CancelCpuBoostModeForApplet"}, + FunctionInfo{110, nullptr, "PushToAppletBoundChannelForDebug"}, + FunctionInfo{111, nullptr, "TryPopFromAppletBoundChannelForDebug"}, + FunctionInfo{120, nullptr, "AlarmSettingNotificationEnableAppEventReserve"}, + FunctionInfo{121, nullptr, "AlarmSettingNotificationDisableAppEventReserve"}, + FunctionInfo{122, nullptr, "AlarmSettingNotificationPushAppEventNotify"}, + FunctionInfo{130, nullptr, "FriendInvitationSetApplicationParameter"}, + FunctionInfo{131, nullptr, "FriendInvitationClearApplicationParameter"}, + FunctionInfo{132, nullptr, "FriendInvitationPushApplicationParameter"}, + FunctionInfo{140, nullptr, "RestrictPowerOperationForSecureLaunchModeForDebug"}, + FunctionInfo{200, nullptr, "CreateFloatingLibraryAppletAccepterForDebug"}, + FunctionInfo{300, nullptr, "TerminateAllRunningApplicationsForDebug"}, + FunctionInfo{900, nullptr, "GetGrcProcessLaunchedSystemEvent"} + ); +}; + +class IApplicationProxy final : public ServiceFramework { +public: + explicit IApplicationProxy(Core::System& system_, std::shared_ptr applet, + Kernel::KProcess* process, WindowSystem& window_system) + : ServiceFramework{system_, "IApplicationProxy"}, + m_window_system{window_system}, m_process{process}, m_applet{std::move(applet)} { + } + + ~IApplicationProxy() override = default; + + Result GetAudioController( + Out> out_audio_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_audio_controller = std::make_shared(system); + R_SUCCEED(); + } + + Result GetDisplayController( + Out> out_display_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_display_controller = std::make_shared(system, m_applet); + R_SUCCEED(); + } + + Result GetProcessWindingController( + Out> out_process_winding_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_process_winding_controller = std::make_shared(system, m_applet); + R_SUCCEED(); + } + + Result GetDebugFunctions( + Out> out_debug_functions) { + LOG_DEBUG(Service_AM, "called"); + *out_debug_functions = std::make_shared(system); + R_SUCCEED(); + } + + Result GetWindowController( + Out> out_window_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_window_controller = std::make_shared(system, m_applet, m_window_system); + R_SUCCEED(); + } + + Result GetSelfController( + Out> out_self_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_self_controller = std::make_shared(system, m_applet, m_process); + R_SUCCEED(); + } + + Result GetCommonStateGetter( + Out> out_common_state_getter) { + LOG_DEBUG(Service_AM, "called"); + *out_common_state_getter = std::make_shared(system, m_applet); + R_SUCCEED(); + } + + Result GetLibraryAppletCreator( + Out> out_library_applet_creator) { + LOG_DEBUG(Service_AM, "called"); + *out_library_applet_creator = + std::make_shared(system, m_applet, m_window_system); + R_SUCCEED(); + } + + Result GetApplicationFunctions( + Out> out_application_functions) { + LOG_DEBUG(Service_AM, "called"); + *out_application_functions = std::make_shared(system, m_applet); + R_SUCCEED(); + } + +private: + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IApplicationProxy::GetCommonStateGetter>, "GetCommonStateGetter"}, + FunctionInfo{1, D<&IApplicationProxy::GetSelfController>, "GetSelfController"}, + FunctionInfo{2, D<&IApplicationProxy::GetWindowController>, "GetWindowController"}, + FunctionInfo{3, D<&IApplicationProxy::GetAudioController>, "GetAudioController"}, + FunctionInfo{4, D<&IApplicationProxy::GetDisplayController>, "GetDisplayController"}, + FunctionInfo{10, D<&IApplicationProxy::GetProcessWindingController>, "GetProcessWindingController"}, + FunctionInfo{11, D<&IApplicationProxy::GetLibraryAppletCreator>, "GetLibraryAppletCreator"}, + FunctionInfo{20, D<&IApplicationProxy::GetApplicationFunctions>, "GetApplicationFunctions"}, + FunctionInfo{1000, D<&IApplicationProxy::GetDebugFunctions>, "GetDebugFunctions"} + ); + WindowSystem& m_window_system; + Kernel::KProcess* const m_process; + const std::shared_ptr m_applet; +}; + +class IApplicationProxyService final : public ServiceFramework { +public: + explicit IApplicationProxyService(Core::System& system_, + WindowSystem& window_system) + : ServiceFramework{system_, "appletOE"}, m_window_system{window_system} { + } + + ~IApplicationProxyService() override = default; + + Result OpenApplicationProxy( + Out> out_application_proxy, ClientProcessId pid, + InCopyHandle process_handle) { + LOG_DEBUG(Service_AM, "called"); + + if (const auto applet = this->GetAppletFromProcessId(pid)) { + *out_application_proxy = std::make_shared( + system, applet, process_handle.Get(), m_window_system); + R_SUCCEED(); + } else { + UNIMPLEMENTED(); + R_THROW(ResultUnknown); + } + } + + std::shared_ptr GetAppletFromProcessId(ProcessId process_id) { + return m_window_system.GetByAppletResourceUserId(process_id.pid); + } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IApplicationProxyService::OpenApplicationProxy>, "OpenApplicationProxy"} + ); + WindowSystem& m_window_system; +}; + +class IAppletCommonFunctions final : public ServiceFramework { +public: + explicit IAppletCommonFunctions(Core::System& system_, std::shared_ptr applet_) : ServiceFramework{system_, "IAppletCommonFunctions"}, applet{std::move(applet_)} {} + ~IAppletCommonFunctions() override = default; + + Result SetHomeButtonDoubleClickEnabled( + bool home_button_double_click_enabled) { + LOG_WARNING(Service_AM, "(STUBBED) called, home_button_double_click_enabled={}", home_button_double_click_enabled); + R_SUCCEED(); + } + + Result GetHomeButtonDoubleClickEnabled( + Out out_home_button_double_click_enabled) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + *out_home_button_double_click_enabled = false; + R_SUCCEED(); + } + + Result SetDisplayMagnification(f32 x, f32 y, f32 width, f32 height) { + LOG_DEBUG(Service_AM, "(STUBBED) called, x={}, y={}, width={}, height={}", x, y, width, height); + std::scoped_lock lk{applet->lock}; + applet->display_magnification = Common::Rectangle{x, y, x + width, y + height}; + R_SUCCEED(); + } + + Result SetCpuBoostRequestPriority(s32 priority) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + std::scoped_lock lk{applet->lock}; + applet->cpu_boost_request_priority = priority; + R_SUCCEED(); + } + + Result GetCurrentApplicationId(Out out_application_id) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + *out_application_id = FileSys::GetBaseTitleID(system.GetApplicationProcessProgramID()); + R_SUCCEED(); + } + + Result SetGpuTimeSliceBoost(s64 time_span) { + LOG_WARNING(Service_AM, "(STUBBED) called, time_span={}", time_span); + R_SUCCEED(); + } + + Result Unknown350(Out out_unknown) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + *out_unknown = 0; + R_SUCCEED(); + } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "SetTerminateResult"}, + FunctionInfo{10, nullptr, "ReadThemeStorage"}, + FunctionInfo{11, nullptr, "WriteThemeStorage"}, + FunctionInfo{20, nullptr, "PushToAppletBoundChannel"}, + FunctionInfo{21, nullptr, "TryPopFromAppletBoundChannel"}, + FunctionInfo{40, nullptr, "GetDisplayLogicalResolution"}, + FunctionInfo{42, D<&IAppletCommonFunctions::SetDisplayMagnification>, "SetDisplayMagnification"}, + FunctionInfo{50, D<&IAppletCommonFunctions::SetHomeButtonDoubleClickEnabled>, "SetHomeButtonDoubleClickEnabled"}, + FunctionInfo{51, D<&IAppletCommonFunctions::GetHomeButtonDoubleClickEnabled>, "GetHomeButtonDoubleClickEnabled"}, + FunctionInfo{52, nullptr, "IsHomeButtonShortPressedBlocked"}, + FunctionInfo{60, nullptr, "IsVrModeCurtainRequired"}, + FunctionInfo{61, nullptr, "IsSleepRequiredByHighTemperature"}, + FunctionInfo{62, nullptr, "IsSleepRequiredByLowBattery"}, + FunctionInfo{70, D<&IAppletCommonFunctions::SetCpuBoostRequestPriority>, "SetCpuBoostRequestPriority"}, + FunctionInfo{80, nullptr, "SetHandlingCaptureButtonShortPressedMessageEnabledForApplet"}, + FunctionInfo{81, nullptr, "SetHandlingCaptureButtonLongPressedMessageEnabledForApplet"}, + FunctionInfo{90, nullptr, "OpenNamedChannelAsParent"}, + FunctionInfo{91, nullptr, "OpenNamedChannelAsChild"}, + FunctionInfo{100, nullptr, "SetApplicationCoreUsageMode"}, + FunctionInfo{300, D<&IAppletCommonFunctions::GetCurrentApplicationId>, "GetCurrentApplicationId"}, + FunctionInfo{310, nullptr, "IsSystemAppletHomeMenu", MakeVersionGate({19,0,0})}, + FunctionInfo{320, D<&IAppletCommonFunctions::SetGpuTimeSliceBoost>, "SetGpuTimeSliceBoost", MakeVersionGate({19,0,0})}, + FunctionInfo{321, nullptr, "SetGpuTimeSliceBoostDueToApplication", MakeVersionGate({19,0,0})}, + FunctionInfo{350, D<&IAppletCommonFunctions::Unknown350>, "Unknown350", MakeVersionGate({20,0,0})} + ); + const std::shared_ptr applet; +}; + +class ISystemAppletProxy final : public ServiceFramework { +public: + explicit ISystemAppletProxy(Core::System& system_, std::shared_ptr applet, Kernel::KProcess* process, WindowSystem& window_system) + : ServiceFramework{system_, "ISystemAppletProxy"}, + m_window_system{window_system}, m_process{process}, m_applet{std::move(applet)} { + } + + ~ISystemAppletProxy() override = default; + + Result GetAudioController( + Out> out_audio_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_audio_controller = std::make_shared(system); + R_SUCCEED(); + } + + Result GetDisplayController( + Out> out_display_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_display_controller = std::make_shared(system, m_applet); + R_SUCCEED(); + } + + Result GetProcessWindingController( + Out> out_process_winding_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_process_winding_controller = std::make_shared(system, m_applet); + R_SUCCEED(); + } + + Result GetDebugFunctions( + Out> out_debug_functions) { + LOG_DEBUG(Service_AM, "called"); + *out_debug_functions = std::make_shared(system); + R_SUCCEED(); + } + + Result GetWindowController( + Out> out_window_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_window_controller = std::make_shared(system, m_applet, m_window_system); + R_SUCCEED(); + } + + Result GetSelfController( + Out> out_self_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_self_controller = std::make_shared(system, m_applet, m_process); + R_SUCCEED(); + } + + Result GetCommonStateGetter( + Out> out_common_state_getter) { + LOG_DEBUG(Service_AM, "called"); + *out_common_state_getter = std::make_shared(system, m_applet); + R_SUCCEED(); + } + + Result GetLibraryAppletCreator( + Out> out_library_applet_creator) { + LOG_DEBUG(Service_AM, "called"); + *out_library_applet_creator = + std::make_shared(system, m_applet, m_window_system); + R_SUCCEED(); + } + + Result GetApplicationCreator( + Out> out_application_creator) { + LOG_DEBUG(Service_AM, "called"); + *out_application_creator = std::make_shared(system, m_window_system); + R_SUCCEED(); + } + + Result GetAppletCommonFunctions( + Out> out_applet_common_functions) { + LOG_DEBUG(Service_AM, "called"); + *out_applet_common_functions = std::make_shared(system, m_applet); + R_SUCCEED(); + } + + Result GetHomeMenuFunctions( + Out> out_home_menu_functions) { + LOG_DEBUG(Service_AM, "called"); + *out_home_menu_functions = + std::make_shared(system, m_applet, m_window_system); + R_SUCCEED(); + } + + Result GetGlobalStateController( + Out> out_global_state_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_global_state_controller = std::make_shared(system); + R_SUCCEED(); + } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&ISystemAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"}, + FunctionInfo{1, D<&ISystemAppletProxy::GetSelfController>, "GetSelfController"}, + FunctionInfo{2, D<&ISystemAppletProxy::GetWindowController>, "GetWindowController"}, + FunctionInfo{3, D<&ISystemAppletProxy::GetAudioController>, "GetAudioController"}, + FunctionInfo{4, D<&ISystemAppletProxy::GetDisplayController>, "GetDisplayController"}, + FunctionInfo{10, D<&ISystemAppletProxy::GetProcessWindingController>, "GetProcessWindingController"}, + FunctionInfo{11, D<&ISystemAppletProxy::GetLibraryAppletCreator>, "GetLibraryAppletCreator"}, + FunctionInfo{20, D<&ISystemAppletProxy::GetHomeMenuFunctions>, "GetHomeMenuFunctions"}, + FunctionInfo{21, D<&ISystemAppletProxy::GetGlobalStateController>, "GetGlobalStateController"}, + FunctionInfo{22, D<&ISystemAppletProxy::GetApplicationCreator>, "GetApplicationCreator"}, + FunctionInfo{23, D<&ISystemAppletProxy::GetAppletCommonFunctions>, "GetAppletCommonFunctions"}, + FunctionInfo{1000, D<&ISystemAppletProxy::GetDebugFunctions>, "GetDebugFunctions"} + ); + WindowSystem& m_window_system; + Kernel::KProcess* const m_process; + const std::shared_ptr m_applet; +}; + +static AppletIdentityInfo GetCallerIdentity(Applet& applet) { + if (const auto caller_applet = applet.caller_applet.lock(); caller_applet) { + // TODO: is this actually the application ID? + return { + .applet_id = caller_applet->applet_id, + .application_id = caller_applet->program_id, + }; + } else { + return { + .applet_id = AppletId::QLaunch, + .application_id = 0x0100000000001000ull, + }; + } +} + +class ILibraryAppletSelfAccessor final : public ServiceFramework { +public: + ILibraryAppletSelfAccessor(Core::System& system_, + std::shared_ptr applet) + : ServiceFramework{system_, "ILibraryAppletSelfAccessor"}, m_applet{std::move(applet)}, + m_broker{m_applet->caller_applet_broker} { + } + + ~ILibraryAppletSelfAccessor() = default; + + Result PopInData(Out> out_storage) { + LOG_INFO(Service_AM, "called"); + R_RETURN(m_broker->GetInData().Pop(system.Kernel(), out_storage)); + } + + Result PushOutData(SharedPointer storage) { + LOG_INFO(Service_AM, "called"); + m_broker->GetOutData().Push(system.Kernel(), storage); + R_SUCCEED(); + } + + Result PopInteractiveInData(Out> out_storage) { + LOG_INFO(Service_AM, "called"); + R_RETURN(m_broker->GetInteractiveInData().Pop(system.Kernel(), out_storage)); + } + + Result PushInteractiveOutData(SharedPointer storage) { + LOG_INFO(Service_AM, "called"); + m_broker->GetInteractiveOutData().Push(system.Kernel(), storage); + R_SUCCEED(); + } + + Result GetPopInDataEvent( + OutCopyHandle out_event) { + LOG_INFO(Service_AM, "called"); + *out_event = m_broker->GetInData().GetEvent(); + R_SUCCEED(); + } + + Result GetPopInteractiveInDataEvent( + OutCopyHandle out_event) { + LOG_INFO(Service_AM, "called"); + *out_event = m_broker->GetInteractiveInData().GetEvent(); + R_SUCCEED(); + } + + Result GetLibraryAppletInfo( + Out out_library_applet_info) { + LOG_INFO(Service_AM, "called"); + *out_library_applet_info = { + .applet_id = m_applet->applet_id, + .library_applet_mode = m_applet->library_applet_mode, + }; + R_SUCCEED(); + } + + Result GetMainAppletIdentityInfo( + Out out_identity_info) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + *out_identity_info = { + .applet_id = AppletId::QLaunch, + .application_id = 0x0100000000001000ull, + }; + R_SUCCEED(); + } + + Result CanUseApplicationCore(Out out_can_use_application_core) { + // TODO: This appears to read the NPDM from state and check the core mask of the applet. + LOG_WARNING(Service_AM, "(STUBBED) called"); + *out_can_use_application_core = false; + R_SUCCEED(); + } + + Result GetMainAppletApplicationControlProperty( + OutLargeData, BufferAttr_HipcMapAlias> out_nacp) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + + // TODO: this should be the main applet, not the caller applet + const auto application = GetCallerIdentity(*m_applet); + std::vector nacp; + const auto result = + system.GetARPManager().GetControlProperty(&nacp, application.application_id); + + if (R_SUCCEEDED(result)) { + std::memcpy(out_nacp->data(), nacp.data(), (std::min)(nacp.size(), out_nacp->size())); + } + + R_RETURN(result); + } + + Result GetMainAppletStorageId(Out out_storage_id) { + LOG_INFO(Service_AM, "(STUBBED) called"); + *out_storage_id = FileSys::StorageId::NandUser; + R_SUCCEED(); + } + + Result ExitProcessAndReturn() { + LOG_INFO(Service_AM, "called"); + + if (const auto caller_applet = m_applet->caller_applet.lock(); caller_applet) { + m_applet->process->Terminate(); + } else { + system.GetUserChannel() = m_applet->user_channel_launch_parameter; + system.ExecuteProgram(0); + } + + R_SUCCEED(); + } + + Result GetCallerAppletIdentityInfo( + Out out_identity_info) { + LOG_INFO(Service_AM, "called"); + *out_identity_info = GetCallerIdentity(*m_applet); + R_SUCCEED(); + } + + Result GetCallerAppletIdentityInfoStack( + Out out_count, OutArray out_identity_info) { + LOG_INFO(Service_AM, "called"); + + std::shared_ptr applet = m_applet; + *out_count = 0; + + do { + if (*out_count >= static_cast(out_identity_info.size())) { + break; + } + out_identity_info[(*out_count)++] = GetCallerIdentity(*applet); + } while ((applet = applet->caller_applet.lock())); + + R_SUCCEED(); + } + + Result GetDesirableKeyboardLayout(Out out_desirable_layout) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + *out_desirable_layout = 0; + R_SUCCEED(); + } + + Result ReportVisibleError(ErrorCode error_code) { + LOG_WARNING(Service_AM, "(STUBBED) called, error {}-{}", error_code.category, + error_code.number); + R_SUCCEED(); + } + + Result ReportVisibleErrorWithErrorContext( + ErrorCode error_code, InLargeData error_context) { + LOG_WARNING(Service_AM, "(STUBBED) called, error {}-{}", error_code.category, + error_code.number); + R_SUCCEED(); + } + + Result UnpopInData(SharedPointer storage) { + LOG_INFO(Service_AM, "called"); + m_broker->GetInData().Unpop(system.Kernel(), storage); + R_SUCCEED(); + } + + Result GetMainAppletApplicationDesiredLanguage( + Out out_desired_language) { + // FIXME: this is copied from IApplicationFunctions::GetDesiredLanguage + // FIXME: all of this stuff belongs to ns + auto identity = GetCallerIdentity(*m_applet); + + // TODO(bunnei): This should be configurable + LOG_DEBUG(Service_AM, "called"); + + // Get supported languages from NACP, if possible + // Default to 0 (all languages supported) + u32 supported_languages = 0; + + const auto res = FileSys::PatchManager::GetMetadataFromBaseOrUpdate(system, identity.application_id); + + if (res.first != nullptr) { + supported_languages = res.first->GetSupportedLanguages(); + } + + // Call IApplicationManagerInterface implementation. + auto& service_manager = system.ServiceManager(); + auto ns_am2 = service_manager.GetService("ns:am2"); + + std::shared_ptr app_man; + R_TRY(ns_am2->GetApplicationManagerInterface(&app_man)); + + // Get desired application language + NS::ApplicationLanguage desired_language{}; + R_TRY(app_man->GetApplicationDesiredLanguage(&desired_language, supported_languages)); + + // Convert to settings language code. + u64 language_code{}; + R_TRY(app_man->ConvertApplicationLanguageToLanguageCode(&language_code, desired_language)); + + LOG_DEBUG(Service_AM, "got desired_language={:016X}", language_code); + + *out_desired_language = language_code; + R_SUCCEED(); + } + + Result GetCurrentApplicationId(Out out_application_id) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + + // TODO: this should be the main applet, not the caller applet + const auto main_applet = GetCallerIdentity(*m_applet); + *out_application_id = main_applet.application_id; + + R_SUCCEED(); + } + + Result GetMainAppletAvailableUsers( + Out out_can_select_any_user, Out out_users_count, + OutArray out_users) { + const Service::Account::ProfileManager manager{}; + + *out_can_select_any_user = false; + *out_users_count = -1; + + LOG_INFO(Service_AM, "called"); + + if (manager.GetUserCount() > 0) { + *out_can_select_any_user = true; + *out_users_count = static_cast(manager.GetUserCount()); + + const auto users = manager.GetAllUsers(); + for (size_t i = 0; i < users.size() && i < out_users.size(); i++) { + out_users[i] = users[i]; + } + } + + R_SUCCEED(); + } + + Result ShouldSetGpuTimeSliceManually( + Out out_should_set_gpu_time_slice_manually) { + LOG_INFO(Service_AM, "(STUBBED) called"); + *out_should_set_gpu_time_slice_manually = false; + R_SUCCEED(); + } + + Result GetLibraryAppletInfoEx( + Out out_library_applet_info) { + LOG_INFO(Service_AM, "called"); + *out_library_applet_info = { + .applet_id = m_applet->applet_id, + .library_applet_mode = m_applet->library_applet_mode, + }; + R_SUCCEED(); + } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&ILibraryAppletSelfAccessor::PopInData>, "PopInData"}, + FunctionInfo{1, D<&ILibraryAppletSelfAccessor::PushOutData>, "PushOutData"}, + FunctionInfo{2, D<&ILibraryAppletSelfAccessor::PopInteractiveInData>, "PopInteractiveInData"}, + FunctionInfo{3, D<&ILibraryAppletSelfAccessor::PushInteractiveOutData>, "PushInteractiveOutData"}, + FunctionInfo{5, D<&ILibraryAppletSelfAccessor::GetPopInDataEvent>, "GetPopInDataEvent"}, + FunctionInfo{6, D<&ILibraryAppletSelfAccessor::GetPopInteractiveInDataEvent>, "GetPopInteractiveInDataEvent"}, + FunctionInfo{10, D<&ILibraryAppletSelfAccessor::ExitProcessAndReturn>, "ExitProcessAndReturn"}, + FunctionInfo{11, D<&ILibraryAppletSelfAccessor::GetLibraryAppletInfo>, "GetLibraryAppletInfo"}, + FunctionInfo{12, D<&ILibraryAppletSelfAccessor::GetMainAppletIdentityInfo>, "GetMainAppletIdentityInfo"}, + FunctionInfo{13, D<&ILibraryAppletSelfAccessor::CanUseApplicationCore>, "CanUseApplicationCore"}, + FunctionInfo{14, D<&ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfo>, "GetCallerAppletIdentityInfo"}, + FunctionInfo{15, D<&ILibraryAppletSelfAccessor::GetMainAppletApplicationControlProperty>, "GetMainAppletApplicationControlProperty"}, + FunctionInfo{16, D<&ILibraryAppletSelfAccessor::GetMainAppletStorageId>, "GetMainAppletStorageId"}, + FunctionInfo{17, D<&ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfoStack>, "GetCallerAppletIdentityInfoStack"}, + FunctionInfo{18, nullptr, "GetNextReturnDestinationAppletIdentityInfo"}, + FunctionInfo{19, D<&ILibraryAppletSelfAccessor::GetDesirableKeyboardLayout>, "GetDesirableKeyboardLayout"}, + FunctionInfo{20, nullptr, "PopExtraStorage"}, + FunctionInfo{25, nullptr, "GetPopExtraStorageEvent"}, + FunctionInfo{30, D<&ILibraryAppletSelfAccessor::UnpopInData>, "UnpopInData"}, + FunctionInfo{31, nullptr, "UnpopExtraStorage"}, + FunctionInfo{40, nullptr, "GetIndirectLayerProducerHandle"}, + FunctionInfo{50, D<&ILibraryAppletSelfAccessor::ReportVisibleError>, "ReportVisibleError"}, + FunctionInfo{51, D<&ILibraryAppletSelfAccessor::ReportVisibleErrorWithErrorContext>, "ReportVisibleErrorWithErrorContext"}, + FunctionInfo{60, D<&ILibraryAppletSelfAccessor::GetMainAppletApplicationDesiredLanguage>, "GetMainAppletApplicationDesiredLanguage"}, + FunctionInfo{70, D<&ILibraryAppletSelfAccessor::GetCurrentApplicationId>, "GetCurrentApplicationId"}, + FunctionInfo{80, nullptr, "RequestExitToSelf"}, + FunctionInfo{90, nullptr, "CreateApplicationAndPushAndRequestToLaunch"}, + FunctionInfo{100, nullptr, "CreateGameMovieTrimmer"}, + FunctionInfo{101, nullptr, "ReserveResourceForMovieOperation"}, + FunctionInfo{102, nullptr, "UnreserveResourceForMovieOperation"}, + FunctionInfo{110, D<&ILibraryAppletSelfAccessor::GetMainAppletAvailableUsers>, "GetMainAppletAvailableUsers"}, + FunctionInfo{120, nullptr, "GetLaunchStorageInfoForDebug"}, + FunctionInfo{130, nullptr, "GetGpuErrorDetectedSystemEvent"}, + FunctionInfo{140, nullptr, "SetApplicationMemoryReservation"}, + FunctionInfo{150, D<&ILibraryAppletSelfAccessor::ShouldSetGpuTimeSliceManually>, "ShouldSetGpuTimeSliceManually"}, + FunctionInfo{160, D<&ILibraryAppletSelfAccessor::GetLibraryAppletInfoEx>, "GetLibraryAppletInfoEx"} + ); + const std::shared_ptr m_applet; + const std::shared_ptr m_broker; +}; + +class ILibraryAppletProxy final : public ServiceFramework { +public: + explicit ILibraryAppletProxy(Core::System& system_, std::shared_ptr applet, + Kernel::KProcess* process, WindowSystem& window_system) + : ServiceFramework{system_, "ILibraryAppletProxy"}, + m_window_system{window_system}, m_process{process}, m_applet{std::move(applet)} { + } + ~ILibraryAppletProxy() override = default; + + Result GetAudioController( + Out> out_audio_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_audio_controller = std::make_shared(system); + R_SUCCEED(); + } + + Result GetDisplayController( + Out> out_display_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_display_controller = std::make_shared(system, m_applet); + R_SUCCEED(); + } + + Result GetProcessWindingController( + Out> out_process_winding_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_process_winding_controller = std::make_shared(system, m_applet); + R_SUCCEED(); + } + + Result GetDebugFunctions( + Out> out_debug_functions) { + LOG_DEBUG(Service_AM, "called"); + *out_debug_functions = std::make_shared(system); + R_SUCCEED(); + } + + Result GetWindowController( + Out> out_window_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_window_controller = std::make_shared(system, m_applet, m_window_system); + R_SUCCEED(); + } + + Result GetSelfController( + Out> out_self_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_self_controller = std::make_shared(system, m_applet, m_process); + R_SUCCEED(); + } + + Result GetCommonStateGetter( + Out> out_common_state_getter) { + LOG_DEBUG(Service_AM, "called"); + *out_common_state_getter = std::make_shared(system, m_applet); + R_SUCCEED(); + } + + Result GetLibraryAppletCreator( + Out> out_library_applet_creator) { + LOG_DEBUG(Service_AM, "called"); + *out_library_applet_creator = + std::make_shared(system, m_applet, m_window_system); + R_SUCCEED(); + } + + Result OpenLibraryAppletSelfAccessor( + Out> out_library_applet_self_accessor) { + LOG_DEBUG(Service_AM, "called"); + *out_library_applet_self_accessor = + std::make_shared(system, m_applet); + R_SUCCEED(); + } + + Result GetAppletCommonFunctions( + Out> out_applet_common_functions) { + LOG_DEBUG(Service_AM, "called"); + *out_applet_common_functions = std::make_shared(system, m_applet); + R_SUCCEED(); + } + + Result GetHomeMenuFunctions( + Out> out_home_menu_functions) { + LOG_DEBUG(Service_AM, "called"); + *out_home_menu_functions = + std::make_shared(system, m_applet, m_window_system); + R_SUCCEED(); + } + + Result GetGlobalStateController( + Out> out_global_state_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_global_state_controller = std::make_shared(system); + R_SUCCEED(); + } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&ILibraryAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"}, + FunctionInfo{1, D<&ILibraryAppletProxy::GetSelfController>, "GetSelfController"}, + FunctionInfo{2, D<&ILibraryAppletProxy::GetWindowController>, "GetWindowController"}, + FunctionInfo{3, D<&ILibraryAppletProxy::GetAudioController>, "GetAudioController"}, + FunctionInfo{4, D<&ILibraryAppletProxy::GetDisplayController>, "GetDisplayController"}, + FunctionInfo{10, D<&ILibraryAppletProxy::GetProcessWindingController>, "GetProcessWindingController"}, + FunctionInfo{11, D<&ILibraryAppletProxy::GetLibraryAppletCreator>, "GetLibraryAppletCreator"}, + FunctionInfo{20, D<&ILibraryAppletProxy::OpenLibraryAppletSelfAccessor>, "OpenLibraryAppletSelfAccessor"}, + FunctionInfo{21, D<&ILibraryAppletProxy::GetAppletCommonFunctions>, "GetAppletCommonFunctions"}, + FunctionInfo{22, D<&ILibraryAppletProxy::GetHomeMenuFunctions>, "GetHomeMenuFunctions"}, + FunctionInfo{23, D<&ILibraryAppletProxy::GetGlobalStateController>, "GetGlobalStateController"}, + FunctionInfo{1000, D<&ILibraryAppletProxy::GetDebugFunctions>, "GetDebugFunctions"} + ); + WindowSystem& m_window_system; + Kernel::KProcess* const m_process; + const std::shared_ptr m_applet; +}; + +class IOverlayAppletProxy final : public ServiceFramework { +public: + explicit IOverlayAppletProxy(Core::System &system_, std::shared_ptr applet, + Kernel::KProcess *process, WindowSystem &window_system) + : ServiceFramework{system_, "IOverlayAppletProxy"}, + m_window_system{window_system}, m_process{process}, m_applet{std::move(applet)} { + } + + ~IOverlayAppletProxy() override = default; + + Result GetCommonStateGetter( + Out > out_common_state_getter) { + LOG_DEBUG(Service_AM, "called"); + *out_common_state_getter = std::make_shared(system, m_applet); + R_SUCCEED(); + } + + Result GetSelfController( + Out > out_self_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_self_controller = std::make_shared(system, m_applet, m_process); + R_SUCCEED(); + } + + Result GetWindowController( + Out > out_window_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_window_controller = std::make_shared(system, m_applet, m_window_system); + R_SUCCEED(); + } + + Result GetAudioController( + Out > out_audio_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_audio_controller = std::make_shared(system); + R_SUCCEED(); + } + + Result GetDisplayController( + Out > out_display_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_display_controller = std::make_shared(system, m_applet); + R_SUCCEED(); + } + + Result GetProcessWindingController( + Out > out_process_winding_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_process_winding_controller = std::make_shared(system, m_applet); + R_SUCCEED(); + } + + Result GetLibraryAppletCreator( + Out > out_library_applet_creator) { + LOG_DEBUG(Service_AM, "called"); + *out_library_applet_creator = + std::make_shared(system, m_applet, m_window_system); + R_SUCCEED(); + } + + Result GetOverlayFunctions( + Out > out_overlay_functions) { + LOG_DEBUG(Service_AM, "called"); + *out_overlay_functions = std::make_shared(system, m_applet); + R_SUCCEED(); + } + + Result GetAppletCommonFunctions( + Out > out_applet_common_functions) { + LOG_DEBUG(Service_AM, "called"); + *out_applet_common_functions = std::make_shared(system, m_applet); + R_SUCCEED(); + } + + Result GetGlobalStateController( + Out > out_global_state_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_global_state_controller = std::make_shared(system); + R_SUCCEED(); + } + + Result GetDebugFunctions( + Out > out_debug_functions) { + LOG_DEBUG(Service_AM, "called"); + *out_debug_functions = std::make_shared(system); + R_SUCCEED(); + } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IOverlayAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"}, + FunctionInfo{1, D<&IOverlayAppletProxy::GetSelfController>, "GetSelfController"}, + FunctionInfo{2, D<&IOverlayAppletProxy::GetWindowController>, "GetWindowController"}, + FunctionInfo{3, D<&IOverlayAppletProxy::GetAudioController>, "GetAudioController"}, + FunctionInfo{4, D<&IOverlayAppletProxy::GetDisplayController>, "GetDisplayController"}, + FunctionInfo{10, D<&IOverlayAppletProxy::GetProcessWindingController>, "GetProcessWindingController"}, + FunctionInfo{11, D<&IOverlayAppletProxy::GetLibraryAppletCreator>, "GetLibraryAppletCreator"}, + FunctionInfo{20, D<&IOverlayAppletProxy::GetOverlayFunctions>, "GetOverlayFunctions"}, + FunctionInfo{21, D<&IOverlayAppletProxy::GetAppletCommonFunctions>, "GetAppletCommonFunctions"}, + FunctionInfo{23, D<&IOverlayAppletProxy::GetGlobalStateController>, "GetGlobalStateController"}, + FunctionInfo{1000, D<&IOverlayAppletProxy::GetDebugFunctions>, "GetDebugFunctions"} + ); + WindowSystem& m_window_system; + Kernel::KProcess* const m_process; + const std::shared_ptr m_applet; +}; + +static bool ShouldCreateGuestApplet(AppletId applet_id) { +#define X(Name, name) \ + if (applet_id == AppletId::Name && \ + Settings::values.name##_applet_mode.GetValue() != Settings::AppletMode::LLE) { \ + return false; \ + } + + X(Cabinet, cabinet) + X(Controller, controller) + X(DataErase, data_erase) + X(Error, error) + X(NetConnect, net_connect) + X(ProfileSelect, player_select) + X(SoftwareKeyboard, swkbd) + X(MiiEdit, mii_edit) + X(Web, web) + X(Shop, shop) + X(PhotoViewer, photo_viewer) + X(OfflineWeb, offline_web) + X(LoginShare, login_share) + X(WebAuth, wifi_web_auth) + X(MyPage, my_page) + +#undef X + + return true; +} + +static AppletProgramId AppletIdToProgramId(AppletId applet_id) { + switch (applet_id) { + case AppletId::OverlayDisplay: + return AppletProgramId::OverlayDisplay; + case AppletId::QLaunch: + return AppletProgramId::QLaunch; + case AppletId::Starter: + return AppletProgramId::Starter; + case AppletId::Auth: + return AppletProgramId::Auth; + case AppletId::Cabinet: + return AppletProgramId::Cabinet; + case AppletId::Controller: + return AppletProgramId::Controller; + case AppletId::DataErase: + return AppletProgramId::DataErase; + case AppletId::Error: + return AppletProgramId::Error; + case AppletId::NetConnect: + return AppletProgramId::NetConnect; + case AppletId::ProfileSelect: + return AppletProgramId::ProfileSelect; + case AppletId::SoftwareKeyboard: + return AppletProgramId::SoftwareKeyboard; + case AppletId::MiiEdit: + return AppletProgramId::MiiEdit; + case AppletId::Web: + return AppletProgramId::Web; + case AppletId::Shop: + return AppletProgramId::Shop; + case AppletId::PhotoViewer: + return AppletProgramId::PhotoViewer; + case AppletId::Settings: + return AppletProgramId::Settings; + case AppletId::OfflineWeb: + return AppletProgramId::OfflineWeb; + case AppletId::LoginShare: + return AppletProgramId::LoginShare; + case AppletId::WebAuth: + return AppletProgramId::WebAuth; + case AppletId::MyPage: + return AppletProgramId::MyPage; + default: + return static_cast(0); + } +} + +static std::shared_ptr CreateGuestApplet(Core::System& system, + WindowSystem& window_system, + std::shared_ptr caller_applet, + AppletId applet_id, + LibraryAppletMode mode) { + const auto program_id = static_cast(AppletIdToProgramId(applet_id)); + if (program_id == 0) { + // Unknown applet + return {}; + } + + auto process = CreateProcess(system, program_id, 1, HLE::ApiVersion::HOS_VERSION_MAJOR); + if (process) { + const auto applet = std::make_shared(system, std::move(process), false); + applet->program_id = program_id; + applet->applet_id = applet_id; + applet->type = AppletType::LibraryApplet; + applet->library_applet_mode = mode; + applet->window_visible = mode != LibraryAppletMode::AllForegroundInitiallyHidden; + + auto broker = std::make_shared(system); + applet->caller_applet = caller_applet; + applet->caller_applet_broker = broker; + { + std::scoped_lock lk{caller_applet->lock}; + caller_applet->child_applets.push_back(applet); + } + window_system.TrackApplet(applet, false); + return std::make_shared(system, broker, applet); + } + // Couldn't initialize the guest process + return {}; +} + +static std::shared_ptr CreateFrontendApplet(Core::System& system, + WindowSystem& window_system, + std::shared_ptr caller_applet, + AppletId applet_id, + LibraryAppletMode mode) { + const auto program_id = static_cast(AppletIdToProgramId(applet_id)); + + auto process = std::make_unique(system); + auto applet = std::make_shared(system, std::move(process), false); + applet->program_id = program_id; + applet->applet_id = applet_id; + applet->type = AppletType::LibraryApplet; + applet->library_applet_mode = mode; + + auto storage = std::make_shared(system); + applet->caller_applet = caller_applet; + applet->caller_applet_broker = storage; + applet->frontend = system.GetFrontendAppletHolder().GetApplet(applet, applet_id, mode); + { + std::scoped_lock lk{caller_applet->lock}; + caller_applet->child_applets.push_back(applet); + } + return std::make_shared(system, storage, applet); +} + +class ILibraryAppletCreator final : public ServiceFramework { +public: + explicit ILibraryAppletCreator(Core::System& system_, std::shared_ptr applet, WindowSystem& window_system) + : ServiceFramework{system_, "ILibraryAppletCreator"} + , m_window_system{window_system}, m_applet{std::move(applet)} { + } + ~ILibraryAppletCreator() override = default; + + Result CreateLibraryApplet( + Out> out_library_applet_accessor, AppletId applet_id, + LibraryAppletMode library_applet_mode) { + LOG_DEBUG(Service_AM, "called with applet_id={} applet_mode={}", applet_id, + library_applet_mode); + + std::shared_ptr library_applet; + if (ShouldCreateGuestApplet(applet_id)) { + library_applet = + CreateGuestApplet(system, m_window_system, m_applet, applet_id, library_applet_mode); + } + if (!library_applet) { + library_applet = + CreateFrontendApplet(system, m_window_system, m_applet, applet_id, library_applet_mode); + } + if (!library_applet) { + LOG_ERROR(Service_AM, "Applet doesn't exist! applet_id={}", applet_id); + R_THROW(ResultUnknown); + } + + // Applet is created, can now be launched. + m_applet->library_applet_launchable_event.Signal(system.Kernel()); + *out_library_applet_accessor = library_applet; + R_SUCCEED(); + } + + Result CreateLibraryAppletEx( + Out> out_library_applet_accessor, AppletId applet_id, + LibraryAppletMode library_applet_mode, u64 thread_id) { + LOG_DEBUG(Service_AM, "called with applet_id={} applet_mode={} thread_id={}", applet_id, + library_applet_mode, thread_id); + + std::shared_ptr library_applet; + if (ShouldCreateGuestApplet(applet_id)) { + library_applet = + CreateGuestApplet(system, m_window_system, m_applet, applet_id, library_applet_mode); + } + if (!library_applet) { + library_applet = + CreateFrontendApplet(system, m_window_system, m_applet, applet_id, library_applet_mode); + } + if (!library_applet) { + LOG_ERROR(Service_AM, "Applet doesn't exist! applet_id={}", applet_id); + R_THROW(ResultUnknown); + } + + // Applet is created, can now be launched. + m_applet->library_applet_launchable_event.Signal(system.Kernel()); + *out_library_applet_accessor = library_applet; + R_SUCCEED(); + } + + Result CreateStorage(Out> out_storage, s64 size) { + LOG_DEBUG(Service_AM, "called, size={}", size); + + if (size <= 0) { + LOG_ERROR(Service_AM, "size is less than or equal to 0"); + R_THROW(ResultUnknown); + } + + *out_storage = std::make_shared(system, AM::CreateStorage(std::vector(size))); + R_SUCCEED(); + } + + Result CreateTransferMemoryStorage( + Out> out_storage, bool is_writable, s64 size, + InCopyHandle transfer_memory_handle) { + LOG_DEBUG(Service_AM, "called, is_writable={} size={}", is_writable, size); + + if (size <= 0) { + LOG_ERROR(Service_AM, "size is less than or equal to 0"); + R_THROW(ResultUnknown); + } + + if (!transfer_memory_handle) { + LOG_ERROR(Service_AM, "transfer_memory_handle is null"); + R_THROW(ResultUnknown); + } + + *out_storage = std::make_shared( + system, AM::CreateTransferMemoryStorage(system.Kernel(), transfer_memory_handle->GetOwner()->GetMemory(), + transfer_memory_handle.Get(), is_writable, size)); + R_SUCCEED(); + } + + Result CreateHandleStorage( + Out> out_storage, s64 size, + InCopyHandle transfer_memory_handle) { + LOG_DEBUG(Service_AM, "called, size={}", size); + + if (size <= 0) { + LOG_ERROR(Service_AM, "size is less than or equal to 0"); + R_THROW(ResultUnknown); + } + + if (!transfer_memory_handle) { + LOG_ERROR(Service_AM, "transfer_memory_handle is null"); + R_THROW(ResultUnknown); + } + + *out_storage = std::make_shared( + system, AM::CreateHandleStorage(system.Kernel(), transfer_memory_handle->GetOwner()->GetMemory(), + transfer_memory_handle.Get(), size)); + R_SUCCEED(); + } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&ILibraryAppletCreator::CreateLibraryApplet>, "CreateLibraryApplet"}, + FunctionInfo{1, nullptr, "TerminateAllLibraryApplets"}, + FunctionInfo{2, nullptr, "AreAnyLibraryAppletsLeft"}, + FunctionInfo{3, D<&ILibraryAppletCreator::CreateLibraryAppletEx>, "CreateLibraryAppletEx"}, + FunctionInfo{10, D<&ILibraryAppletCreator::CreateStorage>, "CreateStorage"}, + FunctionInfo{11, D<&ILibraryAppletCreator::CreateTransferMemoryStorage>, "CreateTransferMemoryStorage"}, + FunctionInfo{12, D<&ILibraryAppletCreator::CreateHandleStorage>, "CreateHandleStorage"} + ); + WindowSystem& m_window_system; + const std::shared_ptr m_applet; +}; + +class IAllSystemAppletProxiesService final + : public ServiceFramework { +public: + explicit IAllSystemAppletProxiesService(Core::System& system_, WindowSystem& window_system) + : ServiceFramework{system_, "appletAE"}, m_window_system{window_system} { + } + + ~IAllSystemAppletProxiesService() override = default; + + Result OpenSystemAppletProxy( + Out> out_system_applet_proxy, ClientProcessId pid, + InCopyHandle process_handle) { + LOG_DEBUG(Service_AM, "called"); + + if (const auto applet = this->GetAppletFromProcessId(pid); applet) { + *out_system_applet_proxy = std::make_shared( + system, applet, process_handle.Get(), m_window_system); + R_SUCCEED(); + } else { + UNIMPLEMENTED(); + R_THROW(ResultUnknown); + } + } + + Result OpenLibraryAppletProxy( + Out> out_library_applet_proxy, ClientProcessId pid, + InCopyHandle process_handle, + InLargeData attribute) { + LOG_DEBUG(Service_AM, "called"); + + if (const auto applet = this->GetAppletFromProcessId(pid); applet) { + *out_library_applet_proxy = std::make_shared( + system, applet, process_handle.Get(), m_window_system); + R_SUCCEED(); + } else { + UNIMPLEMENTED(); + R_THROW(ResultUnknown); + } + } + + Result OpenOverlayAppletProxy( + Out> out_overlay_applet_proxy, ClientProcessId pid, + InCopyHandle process_handle) { + LOG_WARNING(Service_AM, "called"); + + if (const auto applet = this->GetAppletFromProcessId(pid); applet) { + *out_overlay_applet_proxy = std::make_shared( + system, applet, process_handle.Get(), m_window_system); + R_SUCCEED(); + } else { + UNIMPLEMENTED(); + R_THROW(ResultUnknown); + } + } + + Result OpenSystemApplicationProxy( + Out> out_system_application_proxy, ClientProcessId pid, + InCopyHandle process_handle) { + LOG_DEBUG(Service_AM, "called"); + + if (const auto applet = this->GetAppletFromProcessId(pid); applet) { + *out_system_application_proxy = std::make_shared( + system, applet, process_handle.Get(), m_window_system); + R_SUCCEED(); + } else { + UNIMPLEMENTED(); + R_THROW(ResultUnknown); + } + } + + Result OpenLibraryAppletProxyOld( + Out> out_library_applet_proxy, ClientProcessId pid, + InCopyHandle process_handle) { + LOG_DEBUG(Service_AM, "called"); + + AppletAttribute attribute{}; + R_RETURN(this->OpenLibraryAppletProxy(out_library_applet_proxy, pid, process_handle, attribute)); + } + + Result GetSystemProcessCommonFunctions() { + LOG_DEBUG(Service_AM, "(STUBBED) called."); + // TODO (jarrodnorwell) + R_SUCCEED(); + } + + Result GetAppletAlternativeFunctions() { + LOG_DEBUG(Service_AM, "(STUBBED) called."); + // TODO (maufeat) + R_SUCCEED(); + } + + std::shared_ptr GetAppletFromProcessId(ProcessId process_id) { + return m_window_system.GetByAppletResourceUserId(process_id.pid); + } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{100, D<&IAllSystemAppletProxiesService::OpenSystemAppletProxy>, "OpenSystemAppletProxy"}, + FunctionInfo{110, D<&IAllSystemAppletProxiesService::OpenSystemAppletProxy>, "OpenSystemAppletProxyEx"}, + FunctionInfo{200, D<&IAllSystemAppletProxiesService::OpenLibraryAppletProxyOld>, "OpenLibraryAppletProxyOld"}, + FunctionInfo{201, D<&IAllSystemAppletProxiesService::OpenLibraryAppletProxy>, "OpenLibraryAppletProxy"}, + FunctionInfo{300, D<&IAllSystemAppletProxiesService::OpenOverlayAppletProxy>, "OpenOverlayAppletProxy"}, + FunctionInfo{350, D<&IAllSystemAppletProxiesService::OpenSystemApplicationProxy>, "OpenSystemApplicationProxy"}, + FunctionInfo{400, nullptr, "CreateSelfLibraryAppletCreatorForDevelop"}, + FunctionInfo{410, nullptr, "GetSystemAppletControllerForDebug"}, + FunctionInfo{450, D<&IAllSystemAppletProxiesService::GetSystemProcessCommonFunctions>, "GetSystemProcessCommonFunctions", MakeVersionGate({19,0,0})}, + FunctionInfo{460, D<&IAllSystemAppletProxiesService::GetAppletAlternativeFunctions>, "GetAppletAlternativeFunctions", MakeVersionGate({20,0,0})}, + FunctionInfo{1000, nullptr, "GetDebugFunctions"} + ); + WindowSystem& m_window_system; +}; + void LoopProcess(Core::System& system) { WindowSystem window_system(system); ButtonPoller button_poller(system, window_system); @@ -18,10 +1345,8 @@ void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); - server_manager->RegisterNamedService( - "appletAE", std::make_shared(system, window_system)); - server_manager->RegisterNamedService( - "appletOE", std::make_shared(system, window_system)); + server_manager->RegisterNamedService("appletAE", std::make_shared(system, window_system)); + server_manager->RegisterNamedService("appletOE", std::make_shared(system, window_system)); ServerManager::RunServer(std::move(server_manager)); } diff --git a/src/core/hle/service/am/service/all_system_applet_proxies_service.cpp b/src/core/hle/service/am/service/all_system_applet_proxies_service.cpp deleted file mode 100644 index 437032c2f4..0000000000 --- a/src/core/hle/service/am/service/all_system_applet_proxies_service.cpp +++ /dev/null @@ -1,135 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/core.h" -#include "core/hle/service/am/applet_manager.h" -#include "core/hle/service/am/service/all_system_applet_proxies_service.h" -#include "core/hle/service/am/service/application_proxy.h" -#include "core/hle/service/am/service/library_applet_proxy.h" -#include "core/hle/service/am/service/system_applet_proxy.h" -#include "core/hle/service/am/service/overlay_applet_proxy.h" -#include "core/hle/service/am/window_system.h" -#include "core/hle/service/cmif_serialization.h" - -namespace Service::AM { - -IAllSystemAppletProxiesService::IAllSystemAppletProxiesService(Core::System& system_, - WindowSystem& window_system) - : ServiceFramework{system_, "appletAE"}, m_window_system{window_system} { - // clang-format off - static const FunctionInfo functions[] = { - {100, D<&IAllSystemAppletProxiesService::OpenSystemAppletProxy>, "OpenSystemAppletProxy"}, - {110, D<&IAllSystemAppletProxiesService::OpenSystemAppletProxy>, "OpenSystemAppletProxyEx"}, - {200, D<&IAllSystemAppletProxiesService::OpenLibraryAppletProxyOld>, "OpenLibraryAppletProxyOld"}, - {201, D<&IAllSystemAppletProxiesService::OpenLibraryAppletProxy>, "OpenLibraryAppletProxy"}, - {300, D<&IAllSystemAppletProxiesService::OpenOverlayAppletProxy>, "OpenOverlayAppletProxy"}, - {350, D<&IAllSystemAppletProxiesService::OpenSystemApplicationProxy>, "OpenSystemApplicationProxy"}, - {400, nullptr, "CreateSelfLibraryAppletCreatorForDevelop"}, - {410, nullptr, "GetSystemAppletControllerForDebug"}, - {450, D<&IAllSystemAppletProxiesService::GetSystemProcessCommonFunctions>, "GetSystemProcessCommonFunctions"}, // 19.0.0+ - {460, D<&IAllSystemAppletProxiesService::GetAppletAlternativeFunctions>, "GetAppletAlternativeFunctions"}, // 20.0.0+ - {1000, nullptr, "GetDebugFunctions"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - -IAllSystemAppletProxiesService::~IAllSystemAppletProxiesService() = default; - -Result IAllSystemAppletProxiesService::OpenSystemAppletProxy( - Out> out_system_applet_proxy, ClientProcessId pid, - InCopyHandle process_handle) { - LOG_DEBUG(Service_AM, "called"); - - if (const auto applet = this->GetAppletFromProcessId(pid); applet) { - *out_system_applet_proxy = std::make_shared( - system, applet, process_handle.Get(), m_window_system); - R_SUCCEED(); - } else { - UNIMPLEMENTED(); - R_THROW(ResultUnknown); - } -} - -Result IAllSystemAppletProxiesService::OpenLibraryAppletProxy( - Out> out_library_applet_proxy, ClientProcessId pid, - InCopyHandle process_handle, - InLargeData attribute) { - LOG_DEBUG(Service_AM, "called"); - - if (const auto applet = this->GetAppletFromProcessId(pid); applet) { - *out_library_applet_proxy = std::make_shared( - system, applet, process_handle.Get(), m_window_system); - R_SUCCEED(); - } else { - UNIMPLEMENTED(); - R_THROW(ResultUnknown); - } -} - -Result IAllSystemAppletProxiesService::OpenOverlayAppletProxy( - Out> out_overlay_applet_proxy, ClientProcessId pid, - InCopyHandle process_handle) { - LOG_WARNING(Service_AM, "called"); - - if (const auto applet = this->GetAppletFromProcessId(pid); applet) { - *out_overlay_applet_proxy = std::make_shared( - system, applet, process_handle.Get(), m_window_system); - R_SUCCEED(); - } else { - UNIMPLEMENTED(); - R_THROW(ResultUnknown); - } -} - -Result IAllSystemAppletProxiesService::OpenSystemApplicationProxy( - Out> out_system_application_proxy, ClientProcessId pid, - InCopyHandle process_handle) { - LOG_DEBUG(Service_AM, "called"); - - if (const auto applet = this->GetAppletFromProcessId(pid); applet) { - *out_system_application_proxy = std::make_shared( - system, applet, process_handle.Get(), m_window_system); - R_SUCCEED(); - } else { - UNIMPLEMENTED(); - R_THROW(ResultUnknown); - } -} - -Result IAllSystemAppletProxiesService::OpenLibraryAppletProxyOld( - Out> out_library_applet_proxy, ClientProcessId pid, - InCopyHandle process_handle) { - LOG_DEBUG(Service_AM, "called"); - - AppletAttribute attribute{}; - R_RETURN( - this->OpenLibraryAppletProxy(out_library_applet_proxy, pid, process_handle, attribute)); -} - -Result IAllSystemAppletProxiesService::GetSystemProcessCommonFunctions() { - LOG_DEBUG(Service_AM, "(STUBBED) called."); - - // TODO (jarrodnorwell) - - R_SUCCEED(); -} - -Result IAllSystemAppletProxiesService::GetAppletAlternativeFunctions() { - LOG_DEBUG(Service_AM, "(STUBBED) called."); - - // TODO (maufeat) - - R_SUCCEED(); -} - -std::shared_ptr IAllSystemAppletProxiesService::GetAppletFromProcessId( - ProcessId process_id) { - return m_window_system.GetByAppletResourceUserId(process_id.pid); -} - -} // namespace Service::AM diff --git a/src/core/hle/service/am/service/all_system_applet_proxies_service.h b/src/core/hle/service/am/service/all_system_applet_proxies_service.h deleted file mode 100644 index 73cb8a09ac..0000000000 --- a/src/core/hle/service/am/service/all_system_applet_proxies_service.h +++ /dev/null @@ -1,56 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/cmif_types.h" -#include "core/hle/service/service.h" -#include "core/hle/service/am/service/overlay_applet_proxy.h" - -namespace Service { - -namespace AM { - -struct Applet; -struct AppletAttribute; -class IApplicationProxy; -class ILibraryAppletProxy; -class ISystemAppletProxy; -class WindowSystem; - -class IAllSystemAppletProxiesService final - : public ServiceFramework { -public: - explicit IAllSystemAppletProxiesService(Core::System& system_, WindowSystem& window_system); - ~IAllSystemAppletProxiesService() override; - -private: - Result OpenSystemAppletProxy(Out> out_system_applet_proxy, - ClientProcessId pid, - InCopyHandle process_handle); - Result OpenLibraryAppletProxy(Out> out_library_applet_proxy, - ClientProcessId pid, - InCopyHandle process_handle, - InLargeData attribute); - Result OpenOverlayAppletProxy(Out> out_overlay_applet_proxy, - ClientProcessId pid, InCopyHandle process_handle); - Result OpenLibraryAppletProxyOld( - Out> out_library_applet_proxy, ClientProcessId pid, - InCopyHandle process_handle); - Result OpenSystemApplicationProxy( - Out> out_system_application_proxy, ClientProcessId pid, - InCopyHandle process_handle); - Result GetSystemProcessCommonFunctions(); - Result GetAppletAlternativeFunctions(); - -private: - std::shared_ptr GetAppletFromProcessId(ProcessId pid); - - WindowSystem& m_window_system; -}; - -} // namespace AM -} // namespace Service diff --git a/src/core/hle/service/am/service/applet_common_functions.cpp b/src/core/hle/service/am/service/applet_common_functions.cpp deleted file mode 100644 index 5ffec23b3e..0000000000 --- a/src/core/hle/service/am/service/applet_common_functions.cpp +++ /dev/null @@ -1,98 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/core.h" -#include "core/file_sys/common_funcs.h" -#include "core/hle/service/am/applet.h" -#include "core/hle/service/am/service/applet_common_functions.h" -#include "core/hle/service/cmif_serialization.h" - -namespace Service::AM { - -IAppletCommonFunctions::IAppletCommonFunctions(Core::System& system_, - std::shared_ptr applet_) - : ServiceFramework{system_, "IAppletCommonFunctions"}, applet{std::move(applet_)} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "SetTerminateResult"}, - {10, nullptr, "ReadThemeStorage"}, - {11, nullptr, "WriteThemeStorage"}, - {20, nullptr, "PushToAppletBoundChannel"}, - {21, nullptr, "TryPopFromAppletBoundChannel"}, - {40, nullptr, "GetDisplayLogicalResolution"}, - {42, D<&IAppletCommonFunctions::SetDisplayMagnification>, "SetDisplayMagnification"}, - {50, D<&IAppletCommonFunctions::SetHomeButtonDoubleClickEnabled>, "SetHomeButtonDoubleClickEnabled"}, - {51, D<&IAppletCommonFunctions::GetHomeButtonDoubleClickEnabled>, "GetHomeButtonDoubleClickEnabled"}, - {52, nullptr, "IsHomeButtonShortPressedBlocked"}, - {60, nullptr, "IsVrModeCurtainRequired"}, - {61, nullptr, "IsSleepRequiredByHighTemperature"}, - {62, nullptr, "IsSleepRequiredByLowBattery"}, - {70, D<&IAppletCommonFunctions::SetCpuBoostRequestPriority>, "SetCpuBoostRequestPriority"}, - {80, nullptr, "SetHandlingCaptureButtonShortPressedMessageEnabledForApplet"}, - {81, nullptr, "SetHandlingCaptureButtonLongPressedMessageEnabledForApplet"}, - {90, nullptr, "OpenNamedChannelAsParent"}, - {91, nullptr, "OpenNamedChannelAsChild"}, - {100, nullptr, "SetApplicationCoreUsageMode"}, - {300, D<&IAppletCommonFunctions::GetCurrentApplicationId>, "GetCurrentApplicationId"}, - {310, nullptr, "IsSystemAppletHomeMenu"}, //19.0.0+ - {320, D<&IAppletCommonFunctions::SetGpuTimeSliceBoost>, "SetGpuTimeSliceBoost"}, //19.0.0+ - {321, nullptr, "SetGpuTimeSliceBoostDueToApplication"}, //19.0.0+ - {350, D<&IAppletCommonFunctions::Unknown350>, "Unknown350"} //20.0.0+ - }; - // clang-format on - - RegisterHandlers(functions); -} - -IAppletCommonFunctions::~IAppletCommonFunctions() = default; - -Result IAppletCommonFunctions::SetHomeButtonDoubleClickEnabled( - bool home_button_double_click_enabled) { - LOG_WARNING(Service_AM, "(STUBBED) called, home_button_double_click_enabled={}", - home_button_double_click_enabled); - R_SUCCEED(); -} - -Result IAppletCommonFunctions::GetHomeButtonDoubleClickEnabled( - Out out_home_button_double_click_enabled) { - LOG_WARNING(Service_AM, "(STUBBED) called"); - *out_home_button_double_click_enabled = false; - R_SUCCEED(); -} - -Result IAppletCommonFunctions::SetDisplayMagnification(f32 x, f32 y, f32 width, f32 height) { - LOG_DEBUG(Service_AM, "(STUBBED) called, x={}, y={}, width={}, height={}", x, y, width, - height); - std::scoped_lock lk{applet->lock}; - applet->display_magnification = Common::Rectangle{x, y, x + width, y + height}; - R_SUCCEED(); -} - -Result IAppletCommonFunctions::SetCpuBoostRequestPriority(s32 priority) { - LOG_WARNING(Service_AM, "(STUBBED) called"); - std::scoped_lock lk{applet->lock}; - applet->cpu_boost_request_priority = priority; - R_SUCCEED(); -} - -Result IAppletCommonFunctions::GetCurrentApplicationId(Out out_application_id) { - LOG_WARNING(Service_AM, "(STUBBED) called"); - *out_application_id = FileSys::GetBaseTitleID(system.GetApplicationProcessProgramID()); - R_SUCCEED(); -} - -Result IAppletCommonFunctions::SetGpuTimeSliceBoost(s64 time_span) { - LOG_WARNING(Service_AM, "(STUBBED) called, time_span={}", time_span); - R_SUCCEED(); -} - -Result IAppletCommonFunctions::Unknown350(Out out_unknown) { - LOG_WARNING(Service_AM, "(STUBBED) called"); - *out_unknown = 0; - R_SUCCEED(); -} - -} // namespace Service::AM diff --git a/src/core/hle/service/am/service/applet_common_functions.h b/src/core/hle/service/am/service/applet_common_functions.h deleted file mode 100644 index 696fcd5bd1..0000000000 --- a/src/core/hle/service/am/service/applet_common_functions.h +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/cmif_types.h" -#include "core/hle/service/service.h" - -namespace Service::AM { - -struct Applet; - -class IAppletCommonFunctions final : public ServiceFramework { -public: - explicit IAppletCommonFunctions(Core::System& system_, std::shared_ptr applet_); - ~IAppletCommonFunctions() override; - -private: - Result SetHomeButtonDoubleClickEnabled(bool home_button_double_click_enabled); - Result GetHomeButtonDoubleClickEnabled(Out out_home_button_double_click_enabled); - Result SetDisplayMagnification(f32 x, f32 y, f32 width, f32 height); - Result SetCpuBoostRequestPriority(s32 priority); - Result GetCurrentApplicationId(Out out_application_id); - Result SetGpuTimeSliceBoost(s64 time_span); - Result Unknown350(Out out_unknown); - - const std::shared_ptr applet; -}; - -} // namespace Service::AM diff --git a/src/core/hle/service/am/service/application_accessor.cpp b/src/core/hle/service/am/service/application_accessor.cpp index f357871706..d24c2616dc 100644 --- a/src/core/hle/service/am/service/application_accessor.cpp +++ b/src/core/hle/service/am/service/application_accessor.cpp @@ -18,42 +18,42 @@ namespace Service::AM { +std::optional IApplicationAccessor::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IApplicationAccessor::GetAppletStateChangedEvent>, "GetAppletStateChangedEvent"}, + FunctionInfo{1, nullptr, "IsCompleted"}, + FunctionInfo{10, D<&IApplicationAccessor::Start>, "Start"}, + FunctionInfo{20, D<&IApplicationAccessor::RequestExit>, "RequestExit"}, + FunctionInfo{25, D<&IApplicationAccessor::Terminate>, "Terminate"}, + FunctionInfo{30, D<&IApplicationAccessor::GetResult>, "GetResult"}, + FunctionInfo{101, D<&IApplicationAccessor::RequestForApplicationToGetForeground>, "RequestForApplicationToGetForeground"}, + FunctionInfo{110, nullptr, "TerminateAllLibraryApplets"}, + FunctionInfo{111, nullptr, "AreAnyLibraryAppletsLeft"}, + FunctionInfo{112, D<&IApplicationAccessor::GetCurrentLibraryApplet>, "GetCurrentLibraryApplet"}, + FunctionInfo{120, nullptr, "GetApplicationId"}, + FunctionInfo{121, D<&IApplicationAccessor::PushLaunchParameter>, "PushLaunchParameter"}, + FunctionInfo{122, D<&IApplicationAccessor::GetApplicationControlProperty>, "GetApplicationControlProperty"}, + FunctionInfo{123, nullptr, "GetApplicationLaunchProperty"}, + FunctionInfo{124, nullptr, "GetApplicationLaunchRequestInfo"}, + FunctionInfo{130, D<&IApplicationAccessor::SetUsers>, "SetUsers"}, + FunctionInfo{131, D<&IApplicationAccessor::CheckRightsEnvironmentAvailable>, "CheckRightsEnvironmentAvailable"}, + FunctionInfo{132, D<&IApplicationAccessor::GetNsRightsEnvironmentHandle>, "GetNsRightsEnvironmentHandle"}, + FunctionInfo{140, nullptr, "GetDesirableUids"}, + FunctionInfo{150, D<&IApplicationAccessor::ReportApplicationExitTimeout>, "ReportApplicationExitTimeout"}, + FunctionInfo{160, nullptr, "SetApplicationAttribute"}, + FunctionInfo{170, nullptr, "HasSaveDataAccessPermission"}, + FunctionInfo{180, nullptr, "PushToFriendInvitationStorageChannel"}, + FunctionInfo{190, nullptr, "PushToNotificationStorageChannel"}, + FunctionInfo{200, nullptr, "RequestApplicationSoftReset"}, + FunctionInfo{201, nullptr, "RestartApplicationTimer"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IApplicationAccessor::IApplicationAccessor(Core::System& system_, std::shared_ptr applet, WindowSystem& window_system) : ServiceFramework{system_, "IApplicationAccessor"}, m_window_system(window_system), m_applet(std::move(applet)) { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IApplicationAccessor::GetAppletStateChangedEvent>, "GetAppletStateChangedEvent"}, - {1, nullptr, "IsCompleted"}, - {10, D<&IApplicationAccessor::Start>, "Start"}, - {20, D<&IApplicationAccessor::RequestExit>, "RequestExit"}, - {25, D<&IApplicationAccessor::Terminate>, "Terminate"}, - {30, D<&IApplicationAccessor::GetResult>, "GetResult"}, - {101, D<&IApplicationAccessor::RequestForApplicationToGetForeground>, "RequestForApplicationToGetForeground"}, - {110, nullptr, "TerminateAllLibraryApplets"}, - {111, nullptr, "AreAnyLibraryAppletsLeft"}, - {112, D<&IApplicationAccessor::GetCurrentLibraryApplet>, "GetCurrentLibraryApplet"}, - {120, nullptr, "GetApplicationId"}, - {121, D<&IApplicationAccessor::PushLaunchParameter>, "PushLaunchParameter"}, - {122, D<&IApplicationAccessor::GetApplicationControlProperty>, "GetApplicationControlProperty"}, - {123, nullptr, "GetApplicationLaunchProperty"}, - {124, nullptr, "GetApplicationLaunchRequestInfo"}, - {130, D<&IApplicationAccessor::SetUsers>, "SetUsers"}, - {131, D<&IApplicationAccessor::CheckRightsEnvironmentAvailable>, "CheckRightsEnvironmentAvailable"}, - {132, D<&IApplicationAccessor::GetNsRightsEnvironmentHandle>, "GetNsRightsEnvironmentHandle"}, - {140, nullptr, "GetDesirableUids"}, - {150, D<&IApplicationAccessor::ReportApplicationExitTimeout>, "ReportApplicationExitTimeout"}, - {160, nullptr, "SetApplicationAttribute"}, - {170, nullptr, "HasSaveDataAccessPermission"}, - {180, nullptr, "PushToFriendInvitationStorageChannel"}, - {190, nullptr, "PushToNotificationStorageChannel"}, - {200, nullptr, "RequestApplicationSoftReset"}, - {201, nullptr, "RestartApplicationTimer"}, - }; - // clang-format on - - RegisterHandlers(functions); } IApplicationAccessor::~IApplicationAccessor() = default; diff --git a/src/core/hle/service/am/service/application_accessor.h b/src/core/hle/service/am/service/application_accessor.h index b9797bcc0a..57b222fc19 100644 --- a/src/core/hle/service/am/service/application_accessor.h +++ b/src/core/hle/service/am/service/application_accessor.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -36,6 +39,7 @@ private: Result GetNsRightsEnvironmentHandle(Out out_handle); Result ReportApplicationExitTimeout(); + std::optional FindRequest(u32 key) override; WindowSystem& m_window_system; const std::shared_ptr m_applet; }; diff --git a/src/core/hle/service/am/service/application_creator.cpp b/src/core/hle/service/am/service/application_creator.cpp index 4eb2f29e22..8d57f917fb 100644 --- a/src/core/hle/service/am/service/application_creator.cpp +++ b/src/core/hle/service/am/service/application_creator.cpp @@ -20,6 +20,16 @@ namespace Service::AM { +std::optional IApplicationCreator::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IApplicationCreator::CreateApplication>, "CreateApplication"}, + FunctionInfo{1, nullptr, "PopLaunchRequestedApplication"}, + FunctionInfo{10, D<&IApplicationCreator::CreateSystemApplication>, "CreateSystemApplication"}, + FunctionInfo{100, nullptr, "PopFloatingApplicationForDevelopment"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + namespace { Result CreateGuestApplication(SharedPointer* out_application_accessor, Core::System& system, WindowSystem& window_system, u64 program_id) { @@ -54,16 +64,6 @@ Result CreateGuestApplication(SharedPointer* out_applicati IApplicationCreator::IApplicationCreator(Core::System& system_, WindowSystem& window_system) : ServiceFramework{system_, "IApplicationCreator"}, m_window_system{window_system} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IApplicationCreator::CreateApplication>, "CreateApplication"}, - {1, nullptr, "PopLaunchRequestedApplication"}, - {10, D<&IApplicationCreator::CreateSystemApplication>, "CreateSystemApplication"}, - {100, nullptr, "PopFloatingApplicationForDevelopment"}, - }; - // clang-format on - - RegisterHandlers(functions); } IApplicationCreator::~IApplicationCreator() = default; diff --git a/src/core/hle/service/am/service/application_creator.h b/src/core/hle/service/am/service/application_creator.h index 75975b9596..64434af542 100644 --- a/src/core/hle/service/am/service/application_creator.h +++ b/src/core/hle/service/am/service/application_creator.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project @@ -24,6 +24,7 @@ private: Result CreateApplication(Out>, u64 application_id); Result CreateSystemApplication(Out>, u64 application_id); + std::optional FindRequest(u32 key) override; WindowSystem& m_window_system; }; diff --git a/src/core/hle/service/am/service/application_functions.cpp b/src/core/hle/service/am/service/application_functions.cpp index 90d292c4a2..4fda5eedd6 100644 --- a/src/core/hle/service/am/service/application_functions.cpp +++ b/src/core/hle/service/am/service/application_functions.cpp @@ -51,84 +51,85 @@ FileSys::PatchManager::Metadata GetApplicationMetadata(Core::System& system, u64 } // Anonymous namespace -IApplicationFunctions::IApplicationFunctions(Core::System& system_, std::shared_ptr applet) - : ServiceFramework{system_, "IApplicationFunctions"}, m_applet{std::move(applet)} { - // clang-format off - static const FunctionInfo functions[] = { - {1, D<&IApplicationFunctions::PopLaunchParameter>, "PopLaunchParameter"}, - {10, nullptr, "CreateApplicationAndPushAndRequestToStart"}, - {11, nullptr, "CreateApplicationAndPushAndRequestToStartForQuest"}, - {12, D<&IApplicationFunctions::CreateApplicationAndRequestToStart>, "CreateApplicationAndRequestToStart"}, - {13, nullptr, "CreateApplicationAndRequestToStartForQuest"}, - {14, nullptr, "CreateApplicationWithAttributeAndPushAndRequestToStartForQuest"}, - {15, nullptr, "CreateApplicationWithAttributeAndRequestToStartForQuest"}, - {20, D<&IApplicationFunctions::EnsureSaveData>, "EnsureSaveData"}, - {21, D<&IApplicationFunctions::GetDesiredLanguage>, "GetDesiredLanguage"}, - {22, D<&IApplicationFunctions::SetTerminateResult>, "SetTerminateResult"}, - {23, D<&IApplicationFunctions::GetDisplayVersion>, "GetDisplayVersion"}, - {24, nullptr, "GetLaunchStorageInfoForDebug"}, - {25, D<&IApplicationFunctions::ExtendSaveData>, "ExtendSaveData"}, - {26, D<&IApplicationFunctions::GetSaveDataSize>, "GetSaveDataSize"}, - {27, D<&IApplicationFunctions::CreateCacheStorage>, "CreateCacheStorage"}, - {28, D<&IApplicationFunctions::GetSaveDataSizeMax>, "GetSaveDataSizeMax"}, - {29, D<&IApplicationFunctions::GetCacheStorageMax>, "GetCacheStorageMax"}, - {30, D<&IApplicationFunctions::BeginBlockingHomeButtonShortAndLongPressed>, "BeginBlockingHomeButtonShortAndLongPressed"}, - {31, D<&IApplicationFunctions::EndBlockingHomeButtonShortAndLongPressed>, "EndBlockingHomeButtonShortAndLongPressed"}, - {32, D<&IApplicationFunctions::BeginBlockingHomeButton>, "BeginBlockingHomeButton"}, - {33, D<&IApplicationFunctions::EndBlockingHomeButton>, "EndBlockingHomeButton"}, - {34, nullptr, "SelectApplicationLicense"}, - {35, nullptr, "GetDeviceSaveDataSizeMax"}, - {36, nullptr, "GetLimitedApplicationLicense"}, - {37, nullptr, "GetLimitedApplicationLicenseUpgradableEvent"}, - {40, D<&IApplicationFunctions::NotifyRunning>, "NotifyRunning"}, - {50, D<&IApplicationFunctions::GetPseudoDeviceId>, "GetPseudoDeviceId"}, - {60, D<&IApplicationFunctions::SetMediaPlaybackStateForApplication>, "SetMediaPlaybackStateForApplication"}, - {65, D<&IApplicationFunctions::IsGamePlayRecordingSupported>, "IsGamePlayRecordingSupported"}, - {66, D<&IApplicationFunctions::InitializeGamePlayRecording>, "InitializeGamePlayRecording"}, - {67, D<&IApplicationFunctions::SetGamePlayRecordingState>, "SetGamePlayRecordingState"}, - {68, nullptr, "RequestFlushGamePlayingMovieForDebug"}, - {70, nullptr, "RequestToShutdown"}, - {71, nullptr, "RequestToReboot"}, - {72, nullptr, "RequestToSleep"}, - {80, nullptr, "ExitAndRequestToShowThanksMessage"}, - {90, D<&IApplicationFunctions::EnableApplicationCrashReport>, "EnableApplicationCrashReport"}, - {100, D<&IApplicationFunctions::InitializeApplicationCopyrightFrameBuffer>, "InitializeApplicationCopyrightFrameBuffer"}, - {101, D<&IApplicationFunctions::SetApplicationCopyrightImage>, "SetApplicationCopyrightImage"}, - {102, D<&IApplicationFunctions::SetApplicationCopyrightVisibility>, "SetApplicationCopyrightVisibility"}, - {110, D<&IApplicationFunctions::QueryApplicationPlayStatistics>, "QueryApplicationPlayStatistics"}, - {111, D<&IApplicationFunctions::QueryApplicationPlayStatisticsByUid>, "QueryApplicationPlayStatisticsByUid"}, - {120, D<&IApplicationFunctions::ExecuteProgram>, "ExecuteProgram"}, - {121, D<&IApplicationFunctions::ClearUserChannel>, "ClearUserChannel"}, - {122, D<&IApplicationFunctions::UnpopToUserChannel>, "UnpopToUserChannel"}, - {123, D<&IApplicationFunctions::GetPreviousProgramIndex>, "GetPreviousProgramIndex"}, - {124, nullptr, "EnableApplicationAllThreadDumpOnCrash"}, - {130, D<&IApplicationFunctions::GetGpuErrorDetectedSystemEvent>, "GetGpuErrorDetectedSystemEvent"}, - {131, nullptr, "SetDelayTimeToAbortOnGpuError"}, - {140, D<&IApplicationFunctions::GetFriendInvitationStorageChannelEvent>, "GetFriendInvitationStorageChannelEvent"}, - {141, D<&IApplicationFunctions::TryPopFromFriendInvitationStorageChannel>, "TryPopFromFriendInvitationStorageChannel"}, - {150, D<&IApplicationFunctions::GetNotificationStorageChannelEvent>, "GetNotificationStorageChannelEvent"}, - {151, nullptr, "TryPopFromNotificationStorageChannel"}, - {160, D<&IApplicationFunctions::GetHealthWarningDisappearedSystemEvent>, "GetHealthWarningDisappearedSystemEvent"}, - {170, nullptr, "SetHdcpAuthenticationActivated"}, - {180, nullptr, "GetLaunchRequiredVersion"}, - {181, nullptr, "UpgradeLaunchRequiredVersion"}, - {190, nullptr, "SendServerMaintenanceOverlayNotification"}, - {200, nullptr, "GetLastApplicationExitReason"}, - {210, D<&IApplicationFunctions::GetUnknownEvent210>, "Unknown210"}, - {220, nullptr, "Unknown220"}, // [20.0.0+] - {300, nullptr, "CreateMovieWriter"}, // [19.0.0+] - {310, nullptr, "Unknown310"}, // [20.0.0+] - {320, nullptr, "Unknown320"}, // [20.0.0+] - {330, D<&IApplicationFunctions::Unknown330>, "Unknown330"}, // [20.0.0+] - {500, nullptr, "StartContinuousRecordingFlushForDebug"}, - {1000, nullptr, "CreateMovieMaker"}, - {1001, D<&IApplicationFunctions::PrepareForJit>, "PrepareForJit"}, - }; - // clang-format on - - RegisterHandlers(functions); +std::optional IApplicationFunctions::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{1, D<&IApplicationFunctions::PopLaunchParameter>, "PopLaunchParameter"}, + FunctionInfo{10, nullptr, "CreateApplicationAndPushAndRequestToStart"}, + FunctionInfo{11, nullptr, "CreateApplicationAndPushAndRequestToStartForQuest"}, + FunctionInfo{12, D<&IApplicationFunctions::CreateApplicationAndRequestToStart>, "CreateApplicationAndRequestToStart"}, + FunctionInfo{13, nullptr, "CreateApplicationAndRequestToStartForQuest"}, + FunctionInfo{14, nullptr, "CreateApplicationWithAttributeAndPushAndRequestToStartForQuest"}, + FunctionInfo{15, nullptr, "CreateApplicationWithAttributeAndRequestToStartForQuest"}, + FunctionInfo{20, D<&IApplicationFunctions::EnsureSaveData>, "EnsureSaveData"}, + FunctionInfo{21, D<&IApplicationFunctions::GetDesiredLanguage>, "GetDesiredLanguage"}, + FunctionInfo{22, D<&IApplicationFunctions::SetTerminateResult>, "SetTerminateResult"}, + FunctionInfo{23, D<&IApplicationFunctions::GetDisplayVersion>, "GetDisplayVersion"}, + FunctionInfo{24, nullptr, "GetLaunchStorageInfoForDebug"}, + FunctionInfo{25, D<&IApplicationFunctions::ExtendSaveData>, "ExtendSaveData"}, + FunctionInfo{26, D<&IApplicationFunctions::GetSaveDataSize>, "GetSaveDataSize"}, + FunctionInfo{27, D<&IApplicationFunctions::CreateCacheStorage>, "CreateCacheStorage"}, + FunctionInfo{28, D<&IApplicationFunctions::GetSaveDataSizeMax>, "GetSaveDataSizeMax"}, + FunctionInfo{29, D<&IApplicationFunctions::GetCacheStorageMax>, "GetCacheStorageMax"}, + FunctionInfo{30, D<&IApplicationFunctions::BeginBlockingHomeButtonShortAndLongPressed>, "BeginBlockingHomeButtonShortAndLongPressed"}, + FunctionInfo{31, D<&IApplicationFunctions::EndBlockingHomeButtonShortAndLongPressed>, "EndBlockingHomeButtonShortAndLongPressed"}, + FunctionInfo{32, D<&IApplicationFunctions::BeginBlockingHomeButton>, "BeginBlockingHomeButton"}, + FunctionInfo{33, D<&IApplicationFunctions::EndBlockingHomeButton>, "EndBlockingHomeButton"}, + FunctionInfo{34, nullptr, "SelectApplicationLicense"}, + FunctionInfo{35, nullptr, "GetDeviceSaveDataSizeMax"}, + FunctionInfo{36, nullptr, "GetLimitedApplicationLicense"}, + FunctionInfo{37, nullptr, "GetLimitedApplicationLicenseUpgradableEvent"}, + FunctionInfo{40, D<&IApplicationFunctions::NotifyRunning>, "NotifyRunning"}, + FunctionInfo{50, D<&IApplicationFunctions::GetPseudoDeviceId>, "GetPseudoDeviceId"}, + FunctionInfo{60, D<&IApplicationFunctions::SetMediaPlaybackStateForApplication>, "SetMediaPlaybackStateForApplication"}, + FunctionInfo{65, D<&IApplicationFunctions::IsGamePlayRecordingSupported>, "IsGamePlayRecordingSupported"}, + FunctionInfo{66, D<&IApplicationFunctions::InitializeGamePlayRecording>, "InitializeGamePlayRecording"}, + FunctionInfo{67, D<&IApplicationFunctions::SetGamePlayRecordingState>, "SetGamePlayRecordingState"}, + FunctionInfo{68, nullptr, "RequestFlushGamePlayingMovieForDebug"}, + FunctionInfo{70, nullptr, "RequestToShutdown"}, + FunctionInfo{71, nullptr, "RequestToReboot"}, + FunctionInfo{72, nullptr, "RequestToSleep"}, + FunctionInfo{80, nullptr, "ExitAndRequestToShowThanksMessage"}, + FunctionInfo{90, D<&IApplicationFunctions::EnableApplicationCrashReport>, "EnableApplicationCrashReport"}, + FunctionInfo{100, D<&IApplicationFunctions::InitializeApplicationCopyrightFrameBuffer>, "InitializeApplicationCopyrightFrameBuffer"}, + FunctionInfo{101, D<&IApplicationFunctions::SetApplicationCopyrightImage>, "SetApplicationCopyrightImage"}, + FunctionInfo{102, D<&IApplicationFunctions::SetApplicationCopyrightVisibility>, "SetApplicationCopyrightVisibility"}, + FunctionInfo{110, D<&IApplicationFunctions::QueryApplicationPlayStatistics>, "QueryApplicationPlayStatistics"}, + FunctionInfo{111, D<&IApplicationFunctions::QueryApplicationPlayStatisticsByUid>, "QueryApplicationPlayStatisticsByUid"}, + FunctionInfo{120, D<&IApplicationFunctions::ExecuteProgram>, "ExecuteProgram"}, + FunctionInfo{121, D<&IApplicationFunctions::ClearUserChannel>, "ClearUserChannel"}, + FunctionInfo{122, D<&IApplicationFunctions::UnpopToUserChannel>, "UnpopToUserChannel"}, + FunctionInfo{123, D<&IApplicationFunctions::GetPreviousProgramIndex>, "GetPreviousProgramIndex"}, + FunctionInfo{124, nullptr, "EnableApplicationAllThreadDumpOnCrash"}, + FunctionInfo{130, D<&IApplicationFunctions::GetGpuErrorDetectedSystemEvent>, "GetGpuErrorDetectedSystemEvent"}, + FunctionInfo{131, nullptr, "SetDelayTimeToAbortOnGpuError"}, + FunctionInfo{140, D<&IApplicationFunctions::GetFriendInvitationStorageChannelEvent>, "GetFriendInvitationStorageChannelEvent"}, + FunctionInfo{141, D<&IApplicationFunctions::TryPopFromFriendInvitationStorageChannel>, "TryPopFromFriendInvitationStorageChannel"}, + FunctionInfo{150, D<&IApplicationFunctions::GetNotificationStorageChannelEvent>, "GetNotificationStorageChannelEvent"}, + FunctionInfo{151, nullptr, "TryPopFromNotificationStorageChannel"}, + FunctionInfo{160, D<&IApplicationFunctions::GetHealthWarningDisappearedSystemEvent>, "GetHealthWarningDisappearedSystemEvent"}, + FunctionInfo{170, nullptr, "SetHdcpAuthenticationActivated"}, + FunctionInfo{180, nullptr, "GetLaunchRequiredVersion"}, + FunctionInfo{181, nullptr, "UpgradeLaunchRequiredVersion"}, + FunctionInfo{190, nullptr, "SendServerMaintenanceOverlayNotification"}, + FunctionInfo{200, nullptr, "GetLastApplicationExitReason"}, + FunctionInfo{210, D<&IApplicationFunctions::GetUnknownEvent210>, "Unknown210"}, + FunctionInfo{220, nullptr, "Unknown220"}, // [20.0.0+] + FunctionInfo{300, nullptr, "CreateMovieWriter"}, // [19.0.0+] + FunctionInfo{310, nullptr, "Unknown310"}, // [20.0.0+] + FunctionInfo{320, nullptr, "Unknown320"}, // [20.0.0+] + FunctionInfo{330, D<&IApplicationFunctions::Unknown330>, "Unknown330"}, // [20.0.0+] + FunctionInfo{500, nullptr, "StartContinuousRecordingFlushForDebug"}, + FunctionInfo{1000, nullptr, "CreateMovieMaker"}, + FunctionInfo{1001, D<&IApplicationFunctions::PrepareForJit>, "PrepareForJit"} + ); + return HandlerTableGenerateWithFind(key, functions); } +IApplicationFunctions::IApplicationFunctions(Core::System& system_, std::shared_ptr applet) + : ServiceFramework{system_, "IApplicationFunctions"} + , m_applet{std::move(applet)} +{} + IApplicationFunctions::~IApplicationFunctions() = default; Result IApplicationFunctions::PopLaunchParameter(Out> out_storage, diff --git a/src/core/hle/service/am/service/application_functions.h b/src/core/hle/service/am/service/application_functions.h index b97ed7e25e..7093d13f82 100644 --- a/src/core/hle/service/am/service/application_functions.h +++ b/src/core/hle/service/am/service/application_functions.h @@ -84,6 +84,7 @@ private: Result GetUnknownEvent210(OutCopyHandle out_event); Result Unknown330(Out out); Result PrepareForJit(); + std::optional FindRequest(u32 key) override; const std::shared_ptr m_applet; }; diff --git a/src/core/hle/service/am/service/application_proxy.cpp b/src/core/hle/service/am/service/application_proxy.cpp deleted file mode 100644 index 6e1328fee7..0000000000 --- a/src/core/hle/service/am/service/application_proxy.cpp +++ /dev/null @@ -1,106 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/hle/service/am/service/applet_common_functions.h" -#include "core/hle/service/am/service/application_functions.h" -#include "core/hle/service/am/service/application_proxy.h" -#include "core/hle/service/am/service/audio_controller.h" -#include "core/hle/service/am/service/common_state_getter.h" -#include "core/hle/service/am/service/debug_functions.h" -#include "core/hle/service/am/service/display_controller.h" -#include "core/hle/service/am/service/library_applet_creator.h" -#include "core/hle/service/am/service/process_winding_controller.h" -#include "core/hle/service/am/service/self_controller.h" -#include "core/hle/service/am/service/window_controller.h" -#include "core/hle/service/cmif_serialization.h" - -namespace Service::AM { - -IApplicationProxy::IApplicationProxy(Core::System& system_, std::shared_ptr applet, - Kernel::KProcess* process, WindowSystem& window_system) - : ServiceFramework{system_, "IApplicationProxy"}, - m_window_system{window_system}, m_process{process}, m_applet{std::move(applet)} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IApplicationProxy::GetCommonStateGetter>, "GetCommonStateGetter"}, - {1, D<&IApplicationProxy::GetSelfController>, "GetSelfController"}, - {2, D<&IApplicationProxy::GetWindowController>, "GetWindowController"}, - {3, D<&IApplicationProxy::GetAudioController>, "GetAudioController"}, - {4, D<&IApplicationProxy::GetDisplayController>, "GetDisplayController"}, - {10, D<&IApplicationProxy::GetProcessWindingController>, "GetProcessWindingController"}, - {11, D<&IApplicationProxy::GetLibraryAppletCreator>, "GetLibraryAppletCreator"}, - {20, D<&IApplicationProxy::GetApplicationFunctions>, "GetApplicationFunctions"}, - {1000, D<&IApplicationProxy::GetDebugFunctions>, "GetDebugFunctions"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - -IApplicationProxy::~IApplicationProxy() = default; - -Result IApplicationProxy::GetAudioController( - Out> out_audio_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_audio_controller = std::make_shared(system); - R_SUCCEED(); -} - -Result IApplicationProxy::GetDisplayController( - Out> out_display_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_display_controller = std::make_shared(system, m_applet); - R_SUCCEED(); -} - -Result IApplicationProxy::GetProcessWindingController( - Out> out_process_winding_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_process_winding_controller = std::make_shared(system, m_applet); - R_SUCCEED(); -} - -Result IApplicationProxy::GetDebugFunctions( - Out> out_debug_functions) { - LOG_DEBUG(Service_AM, "called"); - *out_debug_functions = std::make_shared(system); - R_SUCCEED(); -} - -Result IApplicationProxy::GetWindowController( - Out> out_window_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_window_controller = std::make_shared(system, m_applet, m_window_system); - R_SUCCEED(); -} - -Result IApplicationProxy::GetSelfController( - Out> out_self_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_self_controller = std::make_shared(system, m_applet, m_process); - R_SUCCEED(); -} - -Result IApplicationProxy::GetCommonStateGetter( - Out> out_common_state_getter) { - LOG_DEBUG(Service_AM, "called"); - *out_common_state_getter = std::make_shared(system, m_applet); - R_SUCCEED(); -} - -Result IApplicationProxy::GetLibraryAppletCreator( - Out> out_library_applet_creator) { - LOG_DEBUG(Service_AM, "called"); - *out_library_applet_creator = - std::make_shared(system, m_applet, m_window_system); - R_SUCCEED(); -} - -Result IApplicationProxy::GetApplicationFunctions( - Out> out_application_functions) { - LOG_DEBUG(Service_AM, "called"); - *out_application_functions = std::make_shared(system, m_applet); - R_SUCCEED(); -} - -} // namespace Service::AM diff --git a/src/core/hle/service/am/service/application_proxy.h b/src/core/hle/service/am/service/application_proxy.h deleted file mode 100644 index 8c62459c45..0000000000 --- a/src/core/hle/service/am/service/application_proxy.h +++ /dev/null @@ -1,49 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/cmif_types.h" -#include "core/hle/service/service.h" - -namespace Service::AM { - -struct Applet; -class IAudioController; -class IApplicationFunctions; -class ICommonStateGetter; -class IDebugFunctions; -class IDisplayController; -class ILibraryAppletCreator; -class IProcessWindingController; -class ISelfController; -class IWindowController; -class WindowSystem; - -class IApplicationProxy final : public ServiceFramework { -public: - explicit IApplicationProxy(Core::System& system_, std::shared_ptr applet, - Kernel::KProcess* process, WindowSystem& window_system); - ~IApplicationProxy(); - -private: - Result GetAudioController(Out> out_audio_controller); - Result GetDisplayController(Out> out_display_controller); - Result GetProcessWindingController( - Out> out_process_winding_controller); - Result GetDebugFunctions(Out> out_debug_functions); - Result GetWindowController(Out> out_window_controller); - Result GetSelfController(Out> out_self_controller); - Result GetCommonStateGetter(Out> out_common_state_getter); - Result GetLibraryAppletCreator( - Out> out_library_applet_creator); - Result GetApplicationFunctions( - Out> out_application_functions); - -private: - WindowSystem& m_window_system; - Kernel::KProcess* const m_process; - const std::shared_ptr m_applet; -}; - -} // namespace Service::AM diff --git a/src/core/hle/service/am/service/application_proxy_service.cpp b/src/core/hle/service/am/service/application_proxy_service.cpp deleted file mode 100644 index b7d7b3c2d9..0000000000 --- a/src/core/hle/service/am/service/application_proxy_service.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/core.h" -#include "core/hle/service/am/am.h" -#include "core/hle/service/am/applet_manager.h" -#include "core/hle/service/am/service/application_proxy.h" -#include "core/hle/service/am/service/application_proxy_service.h" -#include "core/hle/service/am/window_system.h" -#include "core/hle/service/cmif_serialization.h" - -namespace Service::AM { - -IApplicationProxyService::IApplicationProxyService(Core::System& system_, - WindowSystem& window_system) - : ServiceFramework{system_, "appletOE"}, m_window_system{window_system} { - static const FunctionInfo functions[] = { - {0, D<&IApplicationProxyService::OpenApplicationProxy>, "OpenApplicationProxy"}, - }; - RegisterHandlers(functions); -} - -IApplicationProxyService::~IApplicationProxyService() = default; - -Result IApplicationProxyService::OpenApplicationProxy( - Out> out_application_proxy, ClientProcessId pid, - InCopyHandle process_handle) { - LOG_DEBUG(Service_AM, "called"); - - if (const auto applet = this->GetAppletFromProcessId(pid)) { - *out_application_proxy = std::make_shared( - system, applet, process_handle.Get(), m_window_system); - R_SUCCEED(); - } else { - UNIMPLEMENTED(); - R_THROW(ResultUnknown); - } -} - -std::shared_ptr IApplicationProxyService::GetAppletFromProcessId(ProcessId process_id) { - return m_window_system.GetByAppletResourceUserId(process_id.pid); -} - -} // namespace Service::AM diff --git a/src/core/hle/service/am/service/application_proxy_service.h b/src/core/hle/service/am/service/application_proxy_service.h deleted file mode 100644 index e5f4ea345b..0000000000 --- a/src/core/hle/service/am/service/application_proxy_service.h +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/cmif_types.h" -#include "core/hle/service/service.h" - -namespace Service { - -namespace AM { - -struct Applet; -class IApplicationProxy; -class WindowSystem; - -class IApplicationProxyService final : public ServiceFramework { -public: - explicit IApplicationProxyService(Core::System& system_, WindowSystem& window_system); - ~IApplicationProxyService() override; - -private: - Result OpenApplicationProxy(Out> out_application_proxy, - ClientProcessId pid, InCopyHandle process_handle); - -private: - std::shared_ptr GetAppletFromProcessId(ProcessId pid); - - WindowSystem& m_window_system; -}; - -} // namespace AM -} // namespace Service diff --git a/src/core/hle/service/am/service/audio_controller.cpp b/src/core/hle/service/am/service/audio_controller.cpp index f627b1df0e..2c8494e056 100644 --- a/src/core/hle/service/am/service/audio_controller.cpp +++ b/src/core/hle/service/am/service/audio_controller.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project @@ -9,20 +9,20 @@ namespace Service::AM { +std::optional IAudioController::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IAudioController::SetExpectedMasterVolume>, "SetExpectedMasterVolume"}, + FunctionInfo{1, D<&IAudioController::GetMainAppletExpectedMasterVolume>, "GetMainAppletExpectedMasterVolume"}, + FunctionInfo{2, D<&IAudioController::GetLibraryAppletExpectedMasterVolume>, "GetLibraryAppletExpectedMasterVolume"}, + FunctionInfo{3, D<&IAudioController::ChangeMainAppletMasterVolume>, "ChangeMainAppletMasterVolume"}, + FunctionInfo{4, D<&IAudioController::SetTransparentVolumeRate>, "SetTransparentVolumeRate"}, + FunctionInfo{5, nullptr, "Unknown5", MakeVersionGate({20,0,0})} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IAudioController::IAudioController(Core::System& system_) : ServiceFramework{system_, "IAudioController"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IAudioController::SetExpectedMasterVolume>, "SetExpectedMasterVolume"}, - {1, D<&IAudioController::GetMainAppletExpectedMasterVolume>, "GetMainAppletExpectedMasterVolume"}, - {2, D<&IAudioController::GetLibraryAppletExpectedMasterVolume>, "GetLibraryAppletExpectedMasterVolume"}, - {3, D<&IAudioController::ChangeMainAppletMasterVolume>, "ChangeMainAppletMasterVolume"}, - {4, D<&IAudioController::SetTransparentVolumeRate>, "SetTransparentVolumeRate"}, - {5, nullptr, "Unknown5"}, //20.0.0+ - }; - // clang-format on - - RegisterHandlers(functions); } IAudioController::~IAudioController() = default; diff --git a/src/core/hle/service/am/service/audio_controller.h b/src/core/hle/service/am/service/audio_controller.h index 4b0f3f9aed..9cdb33820d 100644 --- a/src/core/hle/service/am/service/audio_controller.h +++ b/src/core/hle/service/am/service/audio_controller.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -20,6 +23,7 @@ private: Result ChangeMainAppletMasterVolume(f32 volume, s64 fade_time_ns); Result SetTransparentVolumeRate(f32 transparent_volume_rate); + std::optional FindRequest(u32 key) override; static constexpr float MinAllowedVolume = 0.0f; static constexpr float MaxAllowedVolume = 1.0f; diff --git a/src/core/hle/service/am/service/common_state_getter.cpp b/src/core/hle/service/am/service/common_state_getter.cpp index 044929e434..6a6a51f42e 100644 --- a/src/core/hle/service/am/service/common_state_getter.cpp +++ b/src/core/hle/service/am/service/common_state_getter.cpp @@ -8,7 +8,6 @@ #include "core/hle/service/am/am_results.h" #include "core/hle/service/am/applet.h" #include "core/hle/service/am/service/common_state_getter.h" -#include "core/hle/service/am/service/lock_accessor.h" #include "core/hle/service/am/service/storage.h" #include "core/hle/service/apm/apm_interface.h" #include "core/hle/service/cmif_serialization.h" @@ -18,77 +17,147 @@ namespace Service::AM { +std::optional ICommonStateGetter::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&ICommonStateGetter::GetEventHandle>, "GetEventHandle"}, + FunctionInfo{1, D<&ICommonStateGetter::ReceiveMessage>, "ReceiveMessage"}, + FunctionInfo{2, nullptr, "GetThisAppletKind"}, + FunctionInfo{3, nullptr, "AllowToEnterSleep"}, + FunctionInfo{4, nullptr, "DisallowToEnterSleep"}, + FunctionInfo{5, D<&ICommonStateGetter::GetOperationMode>, "GetOperationMode"}, + FunctionInfo{6, D<&ICommonStateGetter::GetPerformanceMode>, "GetPerformanceMode"}, + FunctionInfo{7, nullptr, "GetCradleStatus"}, + FunctionInfo{8, D<&ICommonStateGetter::GetBootMode>, "GetBootMode"}, + FunctionInfo{9, D<&ICommonStateGetter::GetCurrentFocusState>, "GetCurrentFocusState"}, + FunctionInfo{10, D<&ICommonStateGetter::RequestToAcquireSleepLock>, "RequestToAcquireSleepLock"}, + FunctionInfo{11, D<&ICommonStateGetter::ReleaseSleepLock>, "ReleaseSleepLock"}, + FunctionInfo{12, D<&ICommonStateGetter::ReleaseSleepLockTransiently>, "ReleaseSleepLockTransiently"}, + FunctionInfo{13, D<&ICommonStateGetter::GetAcquiredSleepLockEvent>, "GetAcquiredSleepLockEvent"}, + FunctionInfo{14, nullptr, "GetWakeupCount", MakeVersionGate({11,0,0})}, + FunctionInfo{15, nullptr, "Unknown15", MakeVersionGate({19,0,0})}, + FunctionInfo{20, D<&ICommonStateGetter::PushToGeneralChannel>, "PushToGeneralChannel"}, + FunctionInfo{30, D<&ICommonStateGetter::GetHomeButtonReaderLockAccessor>, "GetHomeButtonReaderLockAccessor"}, + FunctionInfo{31, D<&ICommonStateGetter::GetReaderLockAccessorEx>, "GetReaderLockAccessorEx", MakeVersionGate({2,0,0})}, + FunctionInfo{32, D<&ICommonStateGetter::GetWriterLockAccessorEx>, "GetWriterLockAccessorEx", MakeVersionGate({7,0,0})}, + FunctionInfo{40, nullptr, "GetCradleFwVersion", MakeVersionGate({2,0,0})}, + FunctionInfo{50, D<&ICommonStateGetter::IsVrModeEnabled>, "IsVrModeEnabled", MakeVersionGate({3,0,0})}, + FunctionInfo{51, D<&ICommonStateGetter::SetVrModeEnabled>, "SetVrModeEnabled", MakeVersionGate({3,0,0})}, + FunctionInfo{52, D<&ICommonStateGetter::SetLcdBacklighOffEnabled>, "SetLcdBacklighOffEnabled", MakeVersionGate({4,0,0})}, + FunctionInfo{53, D<&ICommonStateGetter::BeginVrModeEx>, "BeginVrModeEx", MakeVersionGate({7,0,0})}, + FunctionInfo{54, D<&ICommonStateGetter::EndVrModeEx>, "EndVrModeEx", MakeVersionGate({7,0,0})}, + FunctionInfo{55, D<&ICommonStateGetter::IsInControllerFirmwareUpdateSection>, "IsInControllerFirmwareUpdateSection", MakeVersionGate({3,0,0})}, + FunctionInfo{59, nullptr, "SetVrPositionForDebug", MakeVersionGate({1,0,0})}, + FunctionInfo{60, D<&ICommonStateGetter::GetDefaultDisplayResolution>, "GetDefaultDisplayResolution"}, + FunctionInfo{61, D<&ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent>, "GetDefaultDisplayResolutionChangeEvent"}, + FunctionInfo{62, D<&ICommonStateGetter::GetHdcpAuthenticationState>, "GetHdcpAuthenticationState"}, + FunctionInfo{63, D<&ICommonStateGetter::GetHdcpAuthenticationStateChangeEvent>, "GetHdcpAuthenticationStateChangeEvent"}, + FunctionInfo{64, nullptr, "SetTvPowerStateMatchingMode"}, + FunctionInfo{65, nullptr, "GetApplicationIdByContentActionName"}, + FunctionInfo{66, &ICommonStateGetter::SetCpuBoostMode, "SetCpuBoostMode"}, + FunctionInfo{67, nullptr, "CancelCpuBoostMode"}, + FunctionInfo{68, D<&ICommonStateGetter::GetBuiltInDisplayType>, "GetBuiltInDisplayType"}, + FunctionInfo{80, D<&ICommonStateGetter::PerformSystemButtonPressingIfInFocus>, "PerformSystemButtonPressingIfInFocus"}, + FunctionInfo{90, nullptr, "SetPerformanceConfigurationChangedNotification"}, + FunctionInfo{91, nullptr, "GetCurrentPerformanceConfiguration"}, + FunctionInfo{100, D<&ICommonStateGetter::SetHandlingHomeButtonShortPressedEnabled>, "SetHandlingHomeButtonShortPressedEnabled"}, + FunctionInfo{110, nullptr, "OpenMyGpuErrorHandler"}, + FunctionInfo{120, D<&ICommonStateGetter::GetAppletLaunchedHistory>, "GetAppletLaunchedHistory", MakeVersionGate({13,0,0})}, + FunctionInfo{130, D<&ICommonStateGetter::EnableStartupLogoDisappearedMessage>, "EnableStartupLogoDisappearedMessage", MakeVersionGate({21,0,0})}, + FunctionInfo{200, D<&ICommonStateGetter::GetOperationModeSystemInfo>, "GetOperationModeSystemInfo"}, + FunctionInfo{300, D<&ICommonStateGetter::GetSettingsPlatformRegion>, "GetSettingsPlatformRegion"}, + FunctionInfo{400, nullptr, "ActivateMigrationService"}, + FunctionInfo{401, nullptr, "DeactivateMigrationService"}, + FunctionInfo{500, nullptr, "DisableSleepTillShutdown"}, + FunctionInfo{501, nullptr, "SuppressDisablingSleepTemporarily"}, + FunctionInfo{502, nullptr, "IsSleepEnabled"}, + FunctionInfo{503, nullptr, "IsDisablingSleepSuppressed"}, + FunctionInfo{600, nullptr, "SetHidInputMagnificationForApplication", MakeVersionGate({20,0,0})}, + FunctionInfo{610, D<&ICommonStateGetter::Unknown610>, "Unknown610", MakeVersionGate({21,0,0})}, + FunctionInfo{611, D<&ICommonStateGetter::Unknown611>, "Unknown611", MakeVersionGate({22,0,0})}, + FunctionInfo{900, D<&ICommonStateGetter::SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled>, "SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled", MakeVersionGate({11,0,0})}, + FunctionInfo{910, nullptr, "GetLaunchRequiredTick", MakeVersionGate({17,0,0})}, + FunctionInfo{1000, D<&ICommonStateGetter::BeginVrMode3d>, "BeginVrMode3d", MakeVersionGate({19,0,0})}, + FunctionInfo{1001, D<&ICommonStateGetter::EndVrMode3d>, "EndVrMode3d", MakeVersionGate({19,0,0})}, + FunctionInfo{1002, D<&ICommonStateGetter::IsVrModeEnabled3d>, "IsVrModeEnabled3d", MakeVersionGate({19,0,0})}, + FunctionInfo{1003, D<&ICommonStateGetter::GetVrLaboGoggleViewport>, "GetVrLaboGoggleViewport", MakeVersionGate({21,0,0})}, + FunctionInfo{1004, D<&ICommonStateGetter::GetPanelPhysicalSizeForSpecificTitle>, "GetPanelPhysicalSizeForSpecificTitle", MakeVersionGate({21,0,0})}, + FunctionInfo{1005, D<&ICommonStateGetter::GetPanelResolutionForSpecificTitle>, "GetPanelResolutionForSpecificTitle", MakeVersionGate({21,0,0})} + ); + return HandlerTableGenerateWithFind(key, functions); +} + +class ILockAccessor final : public ServiceFramework { +public: + explicit ILockAccessor(Core::System& system_) + : ServiceFramework{system_, "ILockAccessor"}, m_context{system_, "ILockAccessor"}, + m_event{m_context} { + m_event.Signal(system.Kernel()); + } + ~ILockAccessor() override = default; + + Result TryLock(Out out_is_locked, OutCopyHandle out_handle, bool return_handle) { + LOG_INFO(Service_AM, "called, return_handle={}", return_handle); + + { + std::scoped_lock lk{m_mutex}; + if (m_is_locked) { + *out_is_locked = false; + } else { + m_is_locked = true; + *out_is_locked = true; + } + } + + if (return_handle) { + *out_handle = m_event.GetHandle(); + } + + R_SUCCEED(); + } + + Result Unlock() { + LOG_INFO(Service_AM, "called"); + + { + std::scoped_lock lk{m_mutex}; + m_is_locked = false; + } + + m_event.Signal(system.Kernel()); + R_SUCCEED(); + } + + Result GetEvent(OutCopyHandle out_handle) { + LOG_INFO(Service_AM, "called"); + *out_handle = m_event.GetHandle(); + R_SUCCEED(); + } + + Result IsLocked(Out out_is_locked) { + LOG_INFO(Service_AM, "called"); + std::scoped_lock lk{m_mutex}; + *out_is_locked = m_is_locked; + R_SUCCEED(); + } + +private: + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{1, D<&ILockAccessor::TryLock>, "TryLock"}, + FunctionInfo{2, D<&ILockAccessor::Unlock>, "Unlock"}, + FunctionInfo{3, D<&ILockAccessor::GetEvent>, "GetEvent"}, + FunctionInfo{4, D<&ILockAccessor::IsLocked>, "IsLocked"} + ); + KernelHelpers::ServiceContext m_context; + Event m_event; + std::mutex m_mutex{}; + bool m_is_locked{}; +}; + ICommonStateGetter::ICommonStateGetter(Core::System& system_, std::shared_ptr applet) : ServiceFramework{system_, "ICommonStateGetter"}, m_applet{std::move(applet)} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&ICommonStateGetter::GetEventHandle>, "GetEventHandle"}, - {1, D<&ICommonStateGetter::ReceiveMessage>, "ReceiveMessage"}, - {2, nullptr, "GetThisAppletKind"}, - {3, nullptr, "AllowToEnterSleep"}, - {4, nullptr, "DisallowToEnterSleep"}, - {5, D<&ICommonStateGetter::GetOperationMode>, "GetOperationMode"}, - {6, D<&ICommonStateGetter::GetPerformanceMode>, "GetPerformanceMode"}, - {7, nullptr, "GetCradleStatus"}, - {8, D<&ICommonStateGetter::GetBootMode>, "GetBootMode"}, - {9, D<&ICommonStateGetter::GetCurrentFocusState>, "GetCurrentFocusState"}, - {10, D<&ICommonStateGetter::RequestToAcquireSleepLock>, "RequestToAcquireSleepLock"}, - {11, D<&ICommonStateGetter::ReleaseSleepLock>, "ReleaseSleepLock"}, - {12, D<&ICommonStateGetter::ReleaseSleepLockTransiently>, "ReleaseSleepLockTransiently"}, - {13, D<&ICommonStateGetter::GetAcquiredSleepLockEvent>, "GetAcquiredSleepLockEvent"}, - {14, nullptr, "GetWakeupCount"}, //11.0.0+ - {15, nullptr, "Unknown15"}, //19.0.0+ - {20, D<&ICommonStateGetter::PushToGeneralChannel>, "PushToGeneralChannel"}, - {30, D<&ICommonStateGetter::GetHomeButtonReaderLockAccessor>, "GetHomeButtonReaderLockAccessor"}, - {31, D<&ICommonStateGetter::GetReaderLockAccessorEx>, "GetReaderLockAccessorEx"}, //2.0.0+ - {32, D<&ICommonStateGetter::GetWriterLockAccessorEx>, "GetWriterLockAccessorEx"}, //7.0.0+ - {40, nullptr, "GetCradleFwVersion"}, //2.0.0+ - {50, D<&ICommonStateGetter::IsVrModeEnabled>, "IsVrModeEnabled"}, //3.0.0+ - {51, D<&ICommonStateGetter::SetVrModeEnabled>, "SetVrModeEnabled"}, //3.0.0+ - {52, D<&ICommonStateGetter::SetLcdBacklighOffEnabled>, "SetLcdBacklighOffEnabled"}, //4.0.0+ - {53, D<&ICommonStateGetter::BeginVrModeEx>, "BeginVrModeEx"}, //7.0.0+ - {54, D<&ICommonStateGetter::EndVrModeEx>, "EndVrModeEx"}, //7.0.0+ - {55, D<&ICommonStateGetter::IsInControllerFirmwareUpdateSection>, "IsInControllerFirmwareUpdateSection"}, //3.0.0+ - {59, nullptr, "SetVrPositionForDebug"}, //1.0.0+ - {60, D<&ICommonStateGetter::GetDefaultDisplayResolution>, "GetDefaultDisplayResolution"}, - {61, D<&ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent>, "GetDefaultDisplayResolutionChangeEvent"}, - {62, D<&ICommonStateGetter::GetHdcpAuthenticationState>, "GetHdcpAuthenticationState"}, - {63, D<&ICommonStateGetter::GetHdcpAuthenticationStateChangeEvent>, "GetHdcpAuthenticationStateChangeEvent"}, - {64, nullptr, "SetTvPowerStateMatchingMode"}, - {65, nullptr, "GetApplicationIdByContentActionName"}, - {66, &ICommonStateGetter::SetCpuBoostMode, "SetCpuBoostMode"}, - {67, nullptr, "CancelCpuBoostMode"}, - {68, D<&ICommonStateGetter::GetBuiltInDisplayType>, "GetBuiltInDisplayType"}, - {80, D<&ICommonStateGetter::PerformSystemButtonPressingIfInFocus>, "PerformSystemButtonPressingIfInFocus"}, - {90, nullptr, "SetPerformanceConfigurationChangedNotification"}, - {91, nullptr, "GetCurrentPerformanceConfiguration"}, - {100, D<&ICommonStateGetter::SetHandlingHomeButtonShortPressedEnabled>, "SetHandlingHomeButtonShortPressedEnabled"}, - {110, nullptr, "OpenMyGpuErrorHandler"}, - {120, D<&ICommonStateGetter::GetAppletLaunchedHistory>, "GetAppletLaunchedHistory"}, //13.0.0+ - {130, D<&ICommonStateGetter::EnableStartupLogoDisappearedMessage>, "EnableStartupLogoDisappearedMessage"}, //21.0.0+ - {200, D<&ICommonStateGetter::GetOperationModeSystemInfo>, "GetOperationModeSystemInfo"}, - {300, D<&ICommonStateGetter::GetSettingsPlatformRegion>, "GetSettingsPlatformRegion"}, - {400, nullptr, "ActivateMigrationService"}, - {401, nullptr, "DeactivateMigrationService"}, - {500, nullptr, "DisableSleepTillShutdown"}, - {501, nullptr, "SuppressDisablingSleepTemporarily"}, - {502, nullptr, "IsSleepEnabled"}, - {503, nullptr, "IsDisablingSleepSuppressed"}, - {600, nullptr, "SetHidInputMagnificationForApplication"}, //20.0.0+ - {610, D<&ICommonStateGetter::Unknown610>, "Unknown610"}, //21.0.0+ - {611, D<&ICommonStateGetter::Unknown611>, "Unknown611"}, //22.0.0+ - {900, D<&ICommonStateGetter::SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled>, "SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled"}, //11.0.0+ - {910, nullptr, "GetLaunchRequiredTick"}, //17.0.0+ - {1000, D<&ICommonStateGetter::BeginVrMode3d>, "BeginVrMode3d"}, //19.0.0+ - {1001, D<&ICommonStateGetter::EndVrMode3d>, "EndVrMode3d"}, //19.0.0+ - {1002, D<&ICommonStateGetter::IsVrModeEnabled3d>, "IsVrModeEnabled3d"}, //19.0.0+ - {1003, D<&ICommonStateGetter::GetVrLaboGoggleViewport>, "GetVrLaboGoggleViewport"}, //21.0.0+ - {1004, D<&ICommonStateGetter::GetPanelPhysicalSizeForSpecificTitle>, "GetPanelPhysicalSizeForSpecificTitle"}, //21.0.0+ - {1005, D<&ICommonStateGetter::GetPanelResolutionForSpecificTitle>, "GetPanelResolutionForSpecificTitle"}, //21.0.0+ - }; - // clang-format on - - RegisterHandlers(functions); } ICommonStateGetter::~ICommonStateGetter() = default; diff --git a/src/core/hle/service/am/service/common_state_getter.h b/src/core/hle/service/am/service/common_state_getter.h index da86b5d079..ad782ca48e 100644 --- a/src/core/hle/service/am/service/common_state_getter.h +++ b/src/core/hle/service/am/service/common_state_getter.h @@ -76,6 +76,7 @@ private: void SetCpuBoostMode(HLERequestContext& ctx); + std::optional FindRequest(u32 key) override; const std::shared_ptr m_applet; }; diff --git a/src/core/hle/service/am/service/cradle_firmware_updater.cpp b/src/core/hle/service/am/service/cradle_firmware_updater.cpp index 0a8af0858d..a8097ea209 100644 --- a/src/core/hle/service/am/service/cradle_firmware_updater.cpp +++ b/src/core/hle/service/am/service/cradle_firmware_updater.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -6,22 +9,21 @@ namespace Service::AM { + std::optional ICradleFirmwareUpdater::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&ICradleFirmwareUpdater::StartUpdate>, "StartUpdate"}, + FunctionInfo{1, D<&ICradleFirmwareUpdater::FinishUpdate>, "FinishUpdate"}, + FunctionInfo{2, D<&ICradleFirmwareUpdater::GetCradleDeviceInfo>, "GetCradleDeviceInfo"}, + FunctionInfo{3, D<&ICradleFirmwareUpdater::GetCradleDeviceInfoChangeEvent>, "GetCradleDeviceInfoChangeEvent"}, + FunctionInfo{4, nullptr, "GetUpdateProgressInfo"}, + FunctionInfo{5, nullptr, "GetLastInternalResult"} + ); + return HandlerTableGenerateWithFind(key, functions); + } + ICradleFirmwareUpdater::ICradleFirmwareUpdater(Core::System& system_) : ServiceFramework{system_, "ICradleFirmwareUpdater"}, m_context{system, "ICradleFirmwareUpdater"}, m_cradle_device_info_event{m_context} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&ICradleFirmwareUpdater::StartUpdate>, "StartUpdate"}, - {1, D<&ICradleFirmwareUpdater::FinishUpdate>, "FinishUpdate"}, - {2, D<&ICradleFirmwareUpdater::GetCradleDeviceInfo>, "GetCradleDeviceInfo"}, - {3, D<&ICradleFirmwareUpdater::GetCradleDeviceInfoChangeEvent>, "GetCradleDeviceInfoChangeEvent"}, - {4, nullptr, "GetUpdateProgressInfo"}, - {5, nullptr, "GetLastInternalResult"}, - - }; - // clang-format on - - RegisterHandlers(functions); } ICradleFirmwareUpdater::~ICradleFirmwareUpdater() = default; diff --git a/src/core/hle/service/am/service/cradle_firmware_updater.h b/src/core/hle/service/am/service/cradle_firmware_updater.h index 3e803f0ae9..f8e4b93b27 100644 --- a/src/core/hle/service/am/service/cradle_firmware_updater.h +++ b/src/core/hle/service/am/service/cradle_firmware_updater.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -30,6 +33,7 @@ private: Result GetCradleDeviceInfoChangeEvent(OutCopyHandle out_event); private: + std::optional FindRequest(u32 key) override; KernelHelpers::ServiceContext m_context; Event m_cradle_device_info_event; }; diff --git a/src/core/hle/service/am/service/debug_functions.cpp b/src/core/hle/service/am/service/debug_functions.cpp deleted file mode 100644 index fcac4776db..0000000000 --- a/src/core/hle/service/am/service/debug_functions.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/hle/service/am/service/debug_functions.h" - -namespace Service::AM { - -IDebugFunctions::IDebugFunctions(Core::System& system_) - : ServiceFramework{system_, "IDebugFunctions"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "NotifyMessageToHomeMenuForDebug"}, - {1, nullptr, "OpenMainApplication"}, - {10, nullptr, "PerformSystemButtonPressing"}, - {20, nullptr, "InvalidateTransitionLayer"}, - {30, nullptr, "RequestLaunchApplicationWithUserAndArgumentForDebug"}, - {31, nullptr, "RequestLaunchApplicationByApplicationLaunchInfoForDebug"}, - {40, nullptr, "GetAppletResourceUsageInfo"}, - {50, nullptr, "AddSystemProgramIdAndAppletIdForDebug"}, - {51, nullptr, "AddOperationConfirmedLibraryAppletIdForDebug"}, - {100, nullptr, "SetCpuBoostModeForApplet"}, - {101, nullptr, "CancelCpuBoostModeForApplet"}, - {110, nullptr, "PushToAppletBoundChannelForDebug"}, - {111, nullptr, "TryPopFromAppletBoundChannelForDebug"}, - {120, nullptr, "AlarmSettingNotificationEnableAppEventReserve"}, - {121, nullptr, "AlarmSettingNotificationDisableAppEventReserve"}, - {122, nullptr, "AlarmSettingNotificationPushAppEventNotify"}, - {130, nullptr, "FriendInvitationSetApplicationParameter"}, - {131, nullptr, "FriendInvitationClearApplicationParameter"}, - {132, nullptr, "FriendInvitationPushApplicationParameter"}, - {140, nullptr, "RestrictPowerOperationForSecureLaunchModeForDebug"}, - {200, nullptr, "CreateFloatingLibraryAppletAccepterForDebug"}, - {300, nullptr, "TerminateAllRunningApplicationsForDebug"}, - {900, nullptr, "GetGrcProcessLaunchedSystemEvent"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - -IDebugFunctions::~IDebugFunctions() = default; - -} // namespace Service::AM diff --git a/src/core/hle/service/am/service/debug_functions.h b/src/core/hle/service/am/service/debug_functions.h deleted file mode 100644 index d559687439..0000000000 --- a/src/core/hle/service/am/service/debug_functions.h +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/service.h" - -namespace Service::AM { - -class IDebugFunctions final : public ServiceFramework { -public: - explicit IDebugFunctions(Core::System& system_); - ~IDebugFunctions() override; -}; - -} // namespace Service::AM diff --git a/src/core/hle/service/am/service/display_controller.cpp b/src/core/hle/service/am/service/display_controller.cpp index 8f87327b17..eb95dd1b86 100644 --- a/src/core/hle/service/am/service/display_controller.cpp +++ b/src/core/hle/service/am/service/display_controller.cpp @@ -12,42 +12,42 @@ namespace Service::AM { +std::optional IDisplayController::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetLastForegroundCaptureImage"}, + FunctionInfo{1, nullptr, "UpdateLastForegroundCaptureImage"}, + FunctionInfo{2, nullptr, "GetLastApplicationCaptureImage"}, + FunctionInfo{3, nullptr, "GetCallerAppletCaptureImage"}, + FunctionInfo{4, nullptr, "UpdateCallerAppletCaptureImage"}, + FunctionInfo{5, D<&IDisplayController::GetLastForegroundCaptureImageEx>, "GetLastForegroundCaptureImageEx"}, + FunctionInfo{6, nullptr, "GetLastApplicationCaptureImageEx"}, + FunctionInfo{7, D<&IDisplayController::GetCallerAppletCaptureImageEx>, "GetCallerAppletCaptureImageEx"}, + FunctionInfo{8, D<&IDisplayController::TakeScreenShotOfOwnLayer>, "TakeScreenShotOfOwnLayer"}, + FunctionInfo{9, nullptr, "CopyBetweenCaptureBuffers"}, + FunctionInfo{10, nullptr, "AcquireLastApplicationCaptureBuffer"}, + FunctionInfo{11, nullptr, "ReleaseLastApplicationCaptureBuffer"}, + FunctionInfo{12, nullptr, "AcquireLastForegroundCaptureBuffer"}, + FunctionInfo{13, nullptr, "ReleaseLastForegroundCaptureBuffer"}, + FunctionInfo{14, nullptr, "AcquireCallerAppletCaptureBuffer"}, + FunctionInfo{15, nullptr, "ReleaseCallerAppletCaptureBuffer"}, + FunctionInfo{16, nullptr, "AcquireLastApplicationCaptureBufferEx"}, + FunctionInfo{17, nullptr, "AcquireLastForegroundCaptureBufferEx"}, + FunctionInfo{18, nullptr, "AcquireCallerAppletCaptureBufferEx"}, + FunctionInfo{20, D<&IDisplayController::ClearCaptureBuffer>, "ClearCaptureBuffer"}, + FunctionInfo{21, nullptr, "ClearAppletTransitionBuffer"}, + FunctionInfo{22, D<&IDisplayController::AcquireLastApplicationCaptureSharedBuffer>, "AcquireLastApplicationCaptureSharedBuffer"}, + FunctionInfo{23, D<&IDisplayController::ReleaseLastApplicationCaptureSharedBuffer>, "ReleaseLastApplicationCaptureSharedBuffer"}, + FunctionInfo{24, D<&IDisplayController::AcquireLastForegroundCaptureSharedBuffer>, "AcquireLastForegroundCaptureSharedBuffer"}, + FunctionInfo{25, D<&IDisplayController::ReleaseLastForegroundCaptureSharedBuffer>, "ReleaseLastForegroundCaptureSharedBuffer"}, + FunctionInfo{26, D<&IDisplayController::AcquireCallerAppletCaptureSharedBuffer>, "AcquireCallerAppletCaptureSharedBuffer"}, + FunctionInfo{27, D<&IDisplayController::ReleaseCallerAppletCaptureSharedBuffer>, "ReleaseCallerAppletCaptureSharedBuffer"}, + FunctionInfo{28, nullptr, "TakeScreenShotOfOwnLayerEx"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IDisplayController::IDisplayController(Core::System& system_, std::shared_ptr applet_) : ServiceFramework{system_, "IDisplayController"}, applet(std::move(applet_)) { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetLastForegroundCaptureImage"}, - {1, nullptr, "UpdateLastForegroundCaptureImage"}, - {2, nullptr, "GetLastApplicationCaptureImage"}, - {3, nullptr, "GetCallerAppletCaptureImage"}, - {4, nullptr, "UpdateCallerAppletCaptureImage"}, - {5, D<&IDisplayController::GetLastForegroundCaptureImageEx>, "GetLastForegroundCaptureImageEx"}, - {6, nullptr, "GetLastApplicationCaptureImageEx"}, - {7, D<&IDisplayController::GetCallerAppletCaptureImageEx>, "GetCallerAppletCaptureImageEx"}, - {8, D<&IDisplayController::TakeScreenShotOfOwnLayer>, "TakeScreenShotOfOwnLayer"}, - {9, nullptr, "CopyBetweenCaptureBuffers"}, - {10, nullptr, "AcquireLastApplicationCaptureBuffer"}, - {11, nullptr, "ReleaseLastApplicationCaptureBuffer"}, - {12, nullptr, "AcquireLastForegroundCaptureBuffer"}, - {13, nullptr, "ReleaseLastForegroundCaptureBuffer"}, - {14, nullptr, "AcquireCallerAppletCaptureBuffer"}, - {15, nullptr, "ReleaseCallerAppletCaptureBuffer"}, - {16, nullptr, "AcquireLastApplicationCaptureBufferEx"}, - {17, nullptr, "AcquireLastForegroundCaptureBufferEx"}, - {18, nullptr, "AcquireCallerAppletCaptureBufferEx"}, - {20, D<&IDisplayController::ClearCaptureBuffer>, "ClearCaptureBuffer"}, - {21, nullptr, "ClearAppletTransitionBuffer"}, - {22, D<&IDisplayController::AcquireLastApplicationCaptureSharedBuffer>, "AcquireLastApplicationCaptureSharedBuffer"}, - {23, D<&IDisplayController::ReleaseLastApplicationCaptureSharedBuffer>, "ReleaseLastApplicationCaptureSharedBuffer"}, - {24, D<&IDisplayController::AcquireLastForegroundCaptureSharedBuffer>, "AcquireLastForegroundCaptureSharedBuffer"}, - {25, D<&IDisplayController::ReleaseLastForegroundCaptureSharedBuffer>, "ReleaseLastForegroundCaptureSharedBuffer"}, - {26, D<&IDisplayController::AcquireCallerAppletCaptureSharedBuffer>, "AcquireCallerAppletCaptureSharedBuffer"}, - {27, D<&IDisplayController::ReleaseCallerAppletCaptureSharedBuffer>, "ReleaseCallerAppletCaptureSharedBuffer"}, - {28, nullptr, "TakeScreenShotOfOwnLayerEx"}, - }; - // clang-format on - - RegisterHandlers(functions); } IDisplayController::~IDisplayController() = default; diff --git a/src/core/hle/service/am/service/display_controller.h b/src/core/hle/service/am/service/display_controller.h index 171feace6e..03d29f93c5 100644 --- a/src/core/hle/service/am/service/display_controller.h +++ b/src/core/hle/service/am/service/display_controller.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project @@ -35,6 +35,7 @@ private: Out out_fbshare_layer_index); Result ReleaseLastApplicationCaptureSharedBuffer(); + std::optional FindRequest(u32 key) override; const std::shared_ptr applet; }; diff --git a/src/core/hle/service/am/service/global_state_controller.cpp b/src/core/hle/service/am/service/global_state_controller.cpp index 3e3b61b0a0..be080ffcb3 100644 --- a/src/core/hle/service/am/service/global_state_controller.cpp +++ b/src/core/hle/service/am/service/global_state_controller.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -7,28 +10,28 @@ namespace Service::AM { + std::optional IGlobalStateController::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "RequestToEnterSleep"}, + FunctionInfo{1, nullptr, "EnterSleep"}, + FunctionInfo{2, nullptr, "StartSleepSequence"}, + FunctionInfo{3, D<&IGlobalStateController::StartShutdownSequence>, "StartShutdownSequence"}, + FunctionInfo{4, D<&IGlobalStateController::StartRebootSequence>, "StartRebootSequence"}, + FunctionInfo{9, nullptr, "IsAutoPowerDownRequested"}, + FunctionInfo{10, D<&IGlobalStateController::LoadAndApplyIdlePolicySettings>, "LoadAndApplyIdlePolicySettings"}, + FunctionInfo{11, nullptr, "NotifyCecSettingsChanged"}, + FunctionInfo{12, nullptr, "SetDefaultHomeButtonLongPressTime"}, + FunctionInfo{13, nullptr, "UpdateDefaultDisplayResolution"}, + FunctionInfo{14, D<&IGlobalStateController::ShouldSleepOnBoot>, "ShouldSleepOnBoot"}, + FunctionInfo{15, D<&IGlobalStateController::GetHdcpAuthenticationFailedEvent>, "GetHdcpAuthenticationFailedEvent"}, + FunctionInfo{30, D<&IGlobalStateController::OpenCradleFirmwareUpdater>, "OpenCradleFirmwareUpdater"} + ); + return HandlerTableGenerateWithFind(key, functions); + } + IGlobalStateController::IGlobalStateController(Core::System& system_) : ServiceFramework{system_, "IGlobalStateController"}, m_context{system_, "IGlobalStateController"}, m_hdcp_authentication_failed_event{m_context} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "RequestToEnterSleep"}, - {1, nullptr, "EnterSleep"}, - {2, nullptr, "StartSleepSequence"}, - {3, D<&IGlobalStateController::StartShutdownSequence>, "StartShutdownSequence"}, - {4, D<&IGlobalStateController::StartRebootSequence>, "StartRebootSequence"}, - {9, nullptr, "IsAutoPowerDownRequested"}, - {10, D<&IGlobalStateController::LoadAndApplyIdlePolicySettings>, "LoadAndApplyIdlePolicySettings"}, - {11, nullptr, "NotifyCecSettingsChanged"}, - {12, nullptr, "SetDefaultHomeButtonLongPressTime"}, - {13, nullptr, "UpdateDefaultDisplayResolution"}, - {14, D<&IGlobalStateController::ShouldSleepOnBoot>, "ShouldSleepOnBoot"}, - {15, D<&IGlobalStateController::GetHdcpAuthenticationFailedEvent>, "GetHdcpAuthenticationFailedEvent"}, - {30, D<&IGlobalStateController::OpenCradleFirmwareUpdater>, "OpenCradleFirmwareUpdater"}, - }; - // clang-format on - - RegisterHandlers(functions); } Result IGlobalStateController::StartShutdownSequence() { diff --git a/src/core/hle/service/am/service/global_state_controller.h b/src/core/hle/service/am/service/global_state_controller.h index 83efb57dfc..0de1415295 100644 --- a/src/core/hle/service/am/service/global_state_controller.h +++ b/src/core/hle/service/am/service/global_state_controller.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -23,9 +26,9 @@ private: Result LoadAndApplyIdlePolicySettings(); Result ShouldSleepOnBoot(Out out_should_sleep_on_boot); Result GetHdcpAuthenticationFailedEvent(OutCopyHandle out_event); - Result OpenCradleFirmwareUpdater( - Out> out_cradle_firmware_updater); + Result OpenCradleFirmwareUpdater(Out> out_cradle_firmware_updater); + std::optional FindRequest(u32 key) override; KernelHelpers::ServiceContext m_context; Event m_hdcp_authentication_failed_event; }; diff --git a/src/core/hle/service/am/service/home_menu_functions.cpp b/src/core/hle/service/am/service/home_menu_functions.cpp index f9d402ca99..5f61c842a2 100644 --- a/src/core/hle/service/am/service/home_menu_functions.cpp +++ b/src/core/hle/service/am/service/home_menu_functions.cpp @@ -14,31 +14,31 @@ namespace Service::AM { +std::optional IHomeMenuFunctions::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{10, D<&IHomeMenuFunctions::RequestToGetForeground>, "RequestToGetForeground"}, + FunctionInfo{11, D<&IHomeMenuFunctions::LockForeground>, "LockForeground"}, + FunctionInfo{12, D<&IHomeMenuFunctions::UnlockForeground>, "UnlockForeground"}, + FunctionInfo{20, D<&IHomeMenuFunctions::PopFromGeneralChannel>, "PopFromGeneralChannel"}, + FunctionInfo{21, D<&IHomeMenuFunctions::GetPopFromGeneralChannelEvent>, "GetPopFromGeneralChannelEvent"}, + FunctionInfo{30, nullptr, "GetHomeButtonWriterLockAccessor"}, + FunctionInfo{31, nullptr, "GetWriterLockAccessorEx"}, + FunctionInfo{40, D<&IHomeMenuFunctions::IsSleepEnabled>, "IsSleepEnabled"}, + FunctionInfo{41, D<&IHomeMenuFunctions::IsRebootEnabled>, "IsRebootEnabled"}, + FunctionInfo{50, nullptr, "LaunchSystemApplet"}, + FunctionInfo{51, nullptr, "LaunchStarter"}, + FunctionInfo{100, nullptr, "PopRequestLaunchApplicationForDebug"}, + FunctionInfo{110, D<&IHomeMenuFunctions::IsForceTerminateApplicationDisabledForDebug>, "IsForceTerminateApplicationDisabledForDebug"}, + FunctionInfo{200, nullptr, "LaunchDevMenu"}, + FunctionInfo{1000, nullptr, "SetLastApplicationExitReason"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_, std::shared_ptr applet, WindowSystem& window_system) : ServiceFramework{system_, "IHomeMenuFunctions"}, m_window_system{window_system}, m_applet{std::move(applet)}, m_context{system, "IHomeMenuFunctions"} { - // clang-format off - static const FunctionInfo functions[] = { - {10, D<&IHomeMenuFunctions::RequestToGetForeground>, "RequestToGetForeground"}, - {11, D<&IHomeMenuFunctions::LockForeground>, "LockForeground"}, - {12, D<&IHomeMenuFunctions::UnlockForeground>, "UnlockForeground"}, - {20, D<&IHomeMenuFunctions::PopFromGeneralChannel>, "PopFromGeneralChannel"}, - {21, D<&IHomeMenuFunctions::GetPopFromGeneralChannelEvent>, "GetPopFromGeneralChannelEvent"}, - {30, nullptr, "GetHomeButtonWriterLockAccessor"}, - {31, nullptr, "GetWriterLockAccessorEx"}, - {40, D<&IHomeMenuFunctions::IsSleepEnabled>, "IsSleepEnabled"}, - {41, D<&IHomeMenuFunctions::IsRebootEnabled>, "IsRebootEnabled"}, - {50, nullptr, "LaunchSystemApplet"}, - {51, nullptr, "LaunchStarter"}, - {100, nullptr, "PopRequestLaunchApplicationForDebug"}, - {110, D<&IHomeMenuFunctions::IsForceTerminateApplicationDisabledForDebug>, "IsForceTerminateApplicationDisabledForDebug"}, - {200, nullptr, "LaunchDevMenu"}, - {1000, nullptr, "SetLastApplicationExitReason"}, - }; - // clang-format on - - RegisterHandlers(functions); } IHomeMenuFunctions::~IHomeMenuFunctions() = default; diff --git a/src/core/hle/service/am/service/home_menu_functions.h b/src/core/hle/service/am/service/home_menu_functions.h index 2c3ef54375..25eb9db45e 100644 --- a/src/core/hle/service/am/service/home_menu_functions.h +++ b/src/core/hle/service/am/service/home_menu_functions.h @@ -34,6 +34,7 @@ private: Result IsForceTerminateApplicationDisabledForDebug( Out out_is_force_terminate_application_disabled_for_debug); + std::optional FindRequest(u32 key) override; WindowSystem& m_window_system; const std::shared_ptr m_applet; KernelHelpers::ServiceContext m_context; diff --git a/src/core/hle/service/am/service/library_applet_accessor.cpp b/src/core/hle/service/am/service/library_applet_accessor.cpp index 849e5794cf..c5386fb1a1 100644 --- a/src/core/hle/service/am/service/library_applet_accessor.cpp +++ b/src/core/hle/service/am/service/library_applet_accessor.cpp @@ -17,9 +17,7 @@ namespace Service::AM { -namespace { - -void EnableSingleUserPlay(const std::shared_ptr& impl) { +static void EnableSingleUserPlay(const std::shared_ptr& impl) { constexpr s64 DisplayOptionsOffset = 0x90; constexpr s64 IsSkipEnabledOffset = 1; constexpr s64 ShowSkipButtonOffset = 4; @@ -29,7 +27,7 @@ void EnableSingleUserPlay(const std::shared_ptr& impl) { impl->Write(DisplayOptionsOffset + ShowSkipButtonOffset, &enabled, sizeof(enabled)); } -void ReplaceEmptyUuidWithCurrentUser(const std::shared_ptr& impl) { +static void ReplaceEmptyUuidWithCurrentUser(const std::shared_ptr& impl) { Frontend::UiReturnArg return_arg{}; impl->Read(0, &return_arg, sizeof(return_arg)); @@ -47,42 +45,40 @@ void ReplaceEmptyUuidWithCurrentUser(const std::shared_ptr } } -} // namespace + std::optional ILibraryAppletAccessor::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&ILibraryAppletAccessor::GetAppletStateChangedEvent>, "GetAppletStateChangedEvent"}, + FunctionInfo{1, D<&ILibraryAppletAccessor::IsCompleted>, "IsCompleted"}, + FunctionInfo{10, D<&ILibraryAppletAccessor::Start>, "Start"}, + FunctionInfo{20, D<&ILibraryAppletAccessor::RequestExit>, "RequestExit"}, + FunctionInfo{25, D<&ILibraryAppletAccessor::Terminate>, "Terminate"}, + FunctionInfo{30, D<&ILibraryAppletAccessor::GetResult>, "GetResult"}, + FunctionInfo{50, nullptr, "SetOutOfFocusApplicationSuspendingEnabled"}, + FunctionInfo{60, D<&ILibraryAppletAccessor::PresetLibraryAppletGpuTimeSliceZero>, "PresetLibraryAppletGpuTimeSliceZero", MakeVersionGate({10,0,0})}, + FunctionInfo{80, nullptr, "RequestForLibraryAppletToGetForeground", MakeVersionGate({19,0,0})}, + FunctionInfo{81, nullptr, "GetCurrentChildLibraryApplet", MakeVersionGate({19,0,0})}, + FunctionInfo{90, D<&ILibraryAppletAccessor::Unknown90>, "Unknown90", MakeVersionGate({20,0,0})}, + FunctionInfo{100, D<&ILibraryAppletAccessor::PushInData>, "PushInData"}, + FunctionInfo{101, D<&ILibraryAppletAccessor::PopOutData>, "PopOutData"}, + FunctionInfo{102, nullptr, "PushExtraStorage"}, + FunctionInfo{103, D<&ILibraryAppletAccessor::PushInteractiveInData>, "PushInteractiveInData"}, + FunctionInfo{104, D<&ILibraryAppletAccessor::PopInteractiveOutData>, "PopInteractiveOutData"}, + FunctionInfo{105, D<&ILibraryAppletAccessor::GetPopOutDataEvent>, "GetPopOutDataEvent"}, + FunctionInfo{106, D<&ILibraryAppletAccessor::GetPopInteractiveOutDataEvent>, "GetPopInteractiveOutDataEvent"}, + FunctionInfo{110, nullptr, "NeedsToExitProcess"}, + FunctionInfo{120, D<&ILibraryAppletAccessor::GetLibraryAppletInfo>, "GetLibraryAppletInfo"}, + FunctionInfo{150, nullptr, "RequestForAppletToGetForeground"}, + FunctionInfo{160, D<&ILibraryAppletAccessor::GetIndirectLayerConsumerHandle>, "GetIndirectLayerConsumerHandle", MakeVersionGate({2,0,0})}, + FunctionInfo{170, D<&ILibraryAppletAccessor::Unknown170>, "Unknown170", MakeVersionGate({22,0,0})} + ); + return HandlerTableGenerateWithFind(key, functions); + } ILibraryAppletAccessor::ILibraryAppletAccessor(Core::System& system_, std::shared_ptr broker, std::shared_ptr applet) : ServiceFramework{system_, "ILibraryAppletAccessor"}, m_broker{std::move(broker)}, m_applet{std::move(applet)} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&ILibraryAppletAccessor::GetAppletStateChangedEvent>, "GetAppletStateChangedEvent"}, - {1, D<&ILibraryAppletAccessor::IsCompleted>, "IsCompleted"}, - {10, D<&ILibraryAppletAccessor::Start>, "Start"}, - {20, D<&ILibraryAppletAccessor::RequestExit>, "RequestExit"}, - {25, D<&ILibraryAppletAccessor::Terminate>, "Terminate"}, - {30, D<&ILibraryAppletAccessor::GetResult>, "GetResult"}, - {50, nullptr, "SetOutOfFocusApplicationSuspendingEnabled"}, - {60, D<&ILibraryAppletAccessor::PresetLibraryAppletGpuTimeSliceZero>, "PresetLibraryAppletGpuTimeSliceZero"}, //10.0.0+ - {80, nullptr, "RequestForLibraryAppletToGetForeground"}, //19.0.0+ - {81, nullptr, "GetCurrentChildLibraryApplet"}, //19.0.0+ - {90, D<&ILibraryAppletAccessor::Unknown90>, "Unknown90"}, //20.0.0+ - {100, D<&ILibraryAppletAccessor::PushInData>, "PushInData"}, - {101, D<&ILibraryAppletAccessor::PopOutData>, "PopOutData"}, - {102, nullptr, "PushExtraStorage"}, - {103, D<&ILibraryAppletAccessor::PushInteractiveInData>, "PushInteractiveInData"}, - {104, D<&ILibraryAppletAccessor::PopInteractiveOutData>, "PopInteractiveOutData"}, - {105, D<&ILibraryAppletAccessor::GetPopOutDataEvent>, "GetPopOutDataEvent"}, - {106, D<&ILibraryAppletAccessor::GetPopInteractiveOutDataEvent>, "GetPopInteractiveOutDataEvent"}, - {110, nullptr, "NeedsToExitProcess"}, - {120, D<&ILibraryAppletAccessor::GetLibraryAppletInfo>, "GetLibraryAppletInfo"}, - {150, nullptr, "RequestForAppletToGetForeground"}, - {160, D<&ILibraryAppletAccessor::GetIndirectLayerConsumerHandle>, "GetIndirectLayerConsumerHandle"}, //2.0.0+ - {170, D<&ILibraryAppletAccessor::Unknown170>, "Unknown170"}, //22.0.0+ - }; - // clang-format on - - RegisterHandlers(functions); } ILibraryAppletAccessor::~ILibraryAppletAccessor() = default; diff --git a/src/core/hle/service/am/service/library_applet_accessor.h b/src/core/hle/service/am/service/library_applet_accessor.h index ad40bc76c7..e14ddb3bde 100644 --- a/src/core/hle/service/am/service/library_applet_accessor.h +++ b/src/core/hle/service/am/service/library_applet_accessor.h @@ -6,7 +6,6 @@ #pragma once -#include "core/hle/service/am/service/library_applet_self_accessor.h" #include "core/hle/service/cmif_types.h" #include "core/hle/service/service.h" @@ -16,6 +15,26 @@ class AppletDataBroker; struct Applet; class IStorage; +struct LibraryAppletInfo { + AppletId applet_id; + LibraryAppletMode library_applet_mode; +}; +static_assert(sizeof(LibraryAppletInfo) == 0x8, "LibraryAppletInfo has incorrect size."); + +struct ErrorCode { + u32 category; + u32 number; +}; +static_assert(sizeof(ErrorCode) == 0x8, "ErrorCode has incorrect size."); + +struct ErrorContext { + u8 type; + INSERT_PADDING_BYTES_NOINIT(0x7); + std::array data; + Result result; +}; +static_assert(sizeof(ErrorContext) == 0x200, "ErrorContext has incorrect size."); + class ILibraryAppletAccessor final : public ServiceFramework { public: explicit ILibraryAppletAccessor(Core::System& system_, std::shared_ptr broker, @@ -49,6 +68,7 @@ private: void FrontendExecuteInteractive(); void FrontendRequestExit(); + std::optional FindRequest(u32 key) override; const std::shared_ptr m_broker; const std::shared_ptr m_applet; }; diff --git a/src/core/hle/service/am/service/library_applet_creator.cpp b/src/core/hle/service/am/service/library_applet_creator.cpp deleted file mode 100644 index 4ee92908b5..0000000000 --- a/src/core/hle/service/am/service/library_applet_creator.cpp +++ /dev/null @@ -1,287 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "common/settings.h" -#include "core/hle/kernel/k_transfer_memory.h" -#include "core/hle/service/am/applet_data_broker.h" -#include "core/hle/service/am/applet_manager.h" -#include "core/hle/service/am/frontend/applets.h" -#include "core/hle/service/am/library_applet_storage.h" -#include "core/hle/service/am/process_creation.h" -#include "core/hle/service/am/service/library_applet_accessor.h" -#include "core/hle/service/am/service/library_applet_creator.h" - -#include "core/hle/api_version.h" -#include "core/hle/service/am/service/storage.h" -#include "core/hle/service/am/window_system.h" -#include "core/hle/service/cmif_serialization.h" -#include "core/hle/service/sm/sm.h" - -namespace Service::AM { - -namespace { - -bool ShouldCreateGuestApplet(AppletId applet_id) { -#define X(Name, name) \ - if (applet_id == AppletId::Name && \ - Settings::values.name##_applet_mode.GetValue() != Settings::AppletMode::LLE) { \ - return false; \ - } - - X(Cabinet, cabinet) - X(Controller, controller) - X(DataErase, data_erase) - X(Error, error) - X(NetConnect, net_connect) - X(ProfileSelect, player_select) - X(SoftwareKeyboard, swkbd) - X(MiiEdit, mii_edit) - X(Web, web) - X(Shop, shop) - X(PhotoViewer, photo_viewer) - X(OfflineWeb, offline_web) - X(LoginShare, login_share) - X(WebAuth, wifi_web_auth) - X(MyPage, my_page) - -#undef X - - return true; -} - -AppletProgramId AppletIdToProgramId(AppletId applet_id) { - switch (applet_id) { - case AppletId::OverlayDisplay: - return AppletProgramId::OverlayDisplay; - case AppletId::QLaunch: - return AppletProgramId::QLaunch; - case AppletId::Starter: - return AppletProgramId::Starter; - case AppletId::Auth: - return AppletProgramId::Auth; - case AppletId::Cabinet: - return AppletProgramId::Cabinet; - case AppletId::Controller: - return AppletProgramId::Controller; - case AppletId::DataErase: - return AppletProgramId::DataErase; - case AppletId::Error: - return AppletProgramId::Error; - case AppletId::NetConnect: - return AppletProgramId::NetConnect; - case AppletId::ProfileSelect: - return AppletProgramId::ProfileSelect; - case AppletId::SoftwareKeyboard: - return AppletProgramId::SoftwareKeyboard; - case AppletId::MiiEdit: - return AppletProgramId::MiiEdit; - case AppletId::Web: - return AppletProgramId::Web; - case AppletId::Shop: - return AppletProgramId::Shop; - case AppletId::PhotoViewer: - return AppletProgramId::PhotoViewer; - case AppletId::Settings: - return AppletProgramId::Settings; - case AppletId::OfflineWeb: - return AppletProgramId::OfflineWeb; - case AppletId::LoginShare: - return AppletProgramId::LoginShare; - case AppletId::WebAuth: - return AppletProgramId::WebAuth; - case AppletId::MyPage: - return AppletProgramId::MyPage; - default: - return static_cast(0); - } -} - -std::shared_ptr CreateGuestApplet(Core::System& system, - WindowSystem& window_system, - std::shared_ptr caller_applet, - AppletId applet_id, - LibraryAppletMode mode) { - const auto program_id = static_cast(AppletIdToProgramId(applet_id)); - if (program_id == 0) { - // Unknown applet - return {}; - } - - auto process = CreateProcess(system, program_id, 1, HLE::ApiVersion::HOS_VERSION_MAJOR); - if (process) { - const auto applet = std::make_shared(system, std::move(process), false); - applet->program_id = program_id; - applet->applet_id = applet_id; - applet->type = AppletType::LibraryApplet; - applet->library_applet_mode = mode; - applet->window_visible = mode != LibraryAppletMode::AllForegroundInitiallyHidden; - - auto broker = std::make_shared(system); - applet->caller_applet = caller_applet; - applet->caller_applet_broker = broker; - { - std::scoped_lock lk{caller_applet->lock}; - caller_applet->child_applets.push_back(applet); - } - window_system.TrackApplet(applet, false); - return std::make_shared(system, broker, applet); - } - // Couldn't initialize the guest process - return {}; -} - -std::shared_ptr CreateFrontendApplet(Core::System& system, - WindowSystem& window_system, - std::shared_ptr caller_applet, - AppletId applet_id, - LibraryAppletMode mode) { - const auto program_id = static_cast(AppletIdToProgramId(applet_id)); - - auto process = std::make_unique(system); - auto applet = std::make_shared(system, std::move(process), false); - applet->program_id = program_id; - applet->applet_id = applet_id; - applet->type = AppletType::LibraryApplet; - applet->library_applet_mode = mode; - - auto storage = std::make_shared(system); - applet->caller_applet = caller_applet; - applet->caller_applet_broker = storage; - applet->frontend = system.GetFrontendAppletHolder().GetApplet(applet, applet_id, mode); - { - std::scoped_lock lk{caller_applet->lock}; - caller_applet->child_applets.push_back(applet); - } - return std::make_shared(system, storage, applet); -} - -} // namespace - -ILibraryAppletCreator::ILibraryAppletCreator(Core::System& system_, std::shared_ptr applet, - WindowSystem& window_system) - : ServiceFramework{system_, "ILibraryAppletCreator"}, - m_window_system{window_system}, m_applet{std::move(applet)} { - static const FunctionInfo functions[] = { - {0, D<&ILibraryAppletCreator::CreateLibraryApplet>, "CreateLibraryApplet"}, - {1, nullptr, "TerminateAllLibraryApplets"}, - {2, nullptr, "AreAnyLibraryAppletsLeft"}, - {3, D<&ILibraryAppletCreator::CreateLibraryAppletEx>, "CreateLibraryAppletEx"}, - {10, D<&ILibraryAppletCreator::CreateStorage>, "CreateStorage"}, - {11, D<&ILibraryAppletCreator::CreateTransferMemoryStorage>, "CreateTransferMemoryStorage"}, - {12, D<&ILibraryAppletCreator::CreateHandleStorage>, "CreateHandleStorage"}, - }; - RegisterHandlers(functions); -} - -ILibraryAppletCreator::~ILibraryAppletCreator() = default; - -Result ILibraryAppletCreator::CreateLibraryApplet( - Out> out_library_applet_accessor, AppletId applet_id, - LibraryAppletMode library_applet_mode) { - LOG_DEBUG(Service_AM, "called with applet_id={} applet_mode={}", applet_id, - library_applet_mode); - - std::shared_ptr library_applet; - if (ShouldCreateGuestApplet(applet_id)) { - library_applet = - CreateGuestApplet(system, m_window_system, m_applet, applet_id, library_applet_mode); - } - if (!library_applet) { - library_applet = - CreateFrontendApplet(system, m_window_system, m_applet, applet_id, library_applet_mode); - } - if (!library_applet) { - LOG_ERROR(Service_AM, "Applet doesn't exist! applet_id={}", applet_id); - R_THROW(ResultUnknown); - } - - // Applet is created, can now be launched. - m_applet->library_applet_launchable_event.Signal(system.Kernel()); - *out_library_applet_accessor = library_applet; - R_SUCCEED(); -} - -Result ILibraryAppletCreator::CreateLibraryAppletEx( - Out> out_library_applet_accessor, AppletId applet_id, - LibraryAppletMode library_applet_mode, u64 thread_id) { - LOG_DEBUG(Service_AM, "called with applet_id={} applet_mode={} thread_id={}", applet_id, - library_applet_mode, thread_id); - - std::shared_ptr library_applet; - if (ShouldCreateGuestApplet(applet_id)) { - library_applet = - CreateGuestApplet(system, m_window_system, m_applet, applet_id, library_applet_mode); - } - if (!library_applet) { - library_applet = - CreateFrontendApplet(system, m_window_system, m_applet, applet_id, library_applet_mode); - } - if (!library_applet) { - LOG_ERROR(Service_AM, "Applet doesn't exist! applet_id={}", applet_id); - R_THROW(ResultUnknown); - } - - // Applet is created, can now be launched. - m_applet->library_applet_launchable_event.Signal(system.Kernel()); - *out_library_applet_accessor = library_applet; - R_SUCCEED(); -} - -Result ILibraryAppletCreator::CreateStorage(Out> out_storage, s64 size) { - LOG_DEBUG(Service_AM, "called, size={}", size); - - if (size <= 0) { - LOG_ERROR(Service_AM, "size is less than or equal to 0"); - R_THROW(ResultUnknown); - } - - *out_storage = std::make_shared(system, AM::CreateStorage(std::vector(size))); - R_SUCCEED(); -} - -Result ILibraryAppletCreator::CreateTransferMemoryStorage( - Out> out_storage, bool is_writable, s64 size, - InCopyHandle transfer_memory_handle) { - LOG_DEBUG(Service_AM, "called, is_writable={} size={}", is_writable, size); - - if (size <= 0) { - LOG_ERROR(Service_AM, "size is less than or equal to 0"); - R_THROW(ResultUnknown); - } - - if (!transfer_memory_handle) { - LOG_ERROR(Service_AM, "transfer_memory_handle is null"); - R_THROW(ResultUnknown); - } - - *out_storage = std::make_shared( - system, AM::CreateTransferMemoryStorage(system.Kernel(), transfer_memory_handle->GetOwner()->GetMemory(), - transfer_memory_handle.Get(), is_writable, size)); - R_SUCCEED(); -} - -Result ILibraryAppletCreator::CreateHandleStorage( - Out> out_storage, s64 size, - InCopyHandle transfer_memory_handle) { - LOG_DEBUG(Service_AM, "called, size={}", size); - - if (size <= 0) { - LOG_ERROR(Service_AM, "size is less than or equal to 0"); - R_THROW(ResultUnknown); - } - - if (!transfer_memory_handle) { - LOG_ERROR(Service_AM, "transfer_memory_handle is null"); - R_THROW(ResultUnknown); - } - - *out_storage = std::make_shared( - system, AM::CreateHandleStorage(system.Kernel(), transfer_memory_handle->GetOwner()->GetMemory(), - transfer_memory_handle.Get(), size)); - R_SUCCEED(); -} - -} // namespace Service::AM diff --git a/src/core/hle/service/am/service/library_applet_creator.h b/src/core/hle/service/am/service/library_applet_creator.h deleted file mode 100644 index 34e7586e8f..0000000000 --- a/src/core/hle/service/am/service/library_applet_creator.h +++ /dev/null @@ -1,44 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/am/am_types.h" -#include "core/hle/service/cmif_types.h" -#include "core/hle/service/service.h" - -namespace Service::AM { - -struct Applet; -class ILibraryAppletAccessor; -class IStorage; -class WindowSystem; - -class ILibraryAppletCreator final : public ServiceFramework { -public: - explicit ILibraryAppletCreator(Core::System& system_, std::shared_ptr applet, - WindowSystem& window_system); - ~ILibraryAppletCreator() override; - -private: - Result CreateLibraryApplet( - Out> out_library_applet_accessor, AppletId applet_id, - LibraryAppletMode library_applet_mode); - Result CreateLibraryAppletEx( - Out> out_library_applet_accessor, AppletId applet_id, - LibraryAppletMode library_applet_mode, u64 thread_id); - Result CreateStorage(Out> out_storage, s64 size); - Result CreateTransferMemoryStorage( - Out> out_storage, bool is_writable, s64 size, - InCopyHandle transfer_memory_handle); - Result CreateHandleStorage(Out> out_storage, s64 size, - InCopyHandle transfer_memory_handle); - - WindowSystem& m_window_system; - const std::shared_ptr m_applet; -}; - -} // namespace Service::AM diff --git a/src/core/hle/service/am/service/library_applet_proxy.cpp b/src/core/hle/service/am/service/library_applet_proxy.cpp deleted file mode 100644 index f9cfb82a90..0000000000 --- a/src/core/hle/service/am/service/library_applet_proxy.cpp +++ /dev/null @@ -1,134 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/hle/service/am/service/applet_common_functions.h" -#include "core/hle/service/am/service/audio_controller.h" -#include "core/hle/service/am/service/common_state_getter.h" -#include "core/hle/service/am/service/debug_functions.h" -#include "core/hle/service/am/service/display_controller.h" -#include "core/hle/service/am/service/global_state_controller.h" -#include "core/hle/service/am/service/home_menu_functions.h" -#include "core/hle/service/am/service/library_applet_creator.h" -#include "core/hle/service/am/service/library_applet_proxy.h" -#include "core/hle/service/am/service/library_applet_self_accessor.h" -#include "core/hle/service/am/service/process_winding_controller.h" -#include "core/hle/service/am/service/self_controller.h" -#include "core/hle/service/am/service/window_controller.h" -#include "core/hle/service/cmif_serialization.h" - -namespace Service::AM { - -ILibraryAppletProxy::ILibraryAppletProxy(Core::System& system_, std::shared_ptr applet, - Kernel::KProcess* process, WindowSystem& window_system) - : ServiceFramework{system_, "ILibraryAppletProxy"}, - m_window_system{window_system}, m_process{process}, m_applet{std::move(applet)} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&ILibraryAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"}, - {1, D<&ILibraryAppletProxy::GetSelfController>, "GetSelfController"}, - {2, D<&ILibraryAppletProxy::GetWindowController>, "GetWindowController"}, - {3, D<&ILibraryAppletProxy::GetAudioController>, "GetAudioController"}, - {4, D<&ILibraryAppletProxy::GetDisplayController>, "GetDisplayController"}, - {10, D<&ILibraryAppletProxy::GetProcessWindingController>, "GetProcessWindingController"}, - {11, D<&ILibraryAppletProxy::GetLibraryAppletCreator>, "GetLibraryAppletCreator"}, - {20, D<&ILibraryAppletProxy::OpenLibraryAppletSelfAccessor>, "OpenLibraryAppletSelfAccessor"}, - {21, D<&ILibraryAppletProxy::GetAppletCommonFunctions>, "GetAppletCommonFunctions"}, - {22, D<&ILibraryAppletProxy::GetHomeMenuFunctions>, "GetHomeMenuFunctions"}, - {23, D<&ILibraryAppletProxy::GetGlobalStateController>, "GetGlobalStateController"}, - {1000, D<&ILibraryAppletProxy::GetDebugFunctions>, "GetDebugFunctions"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - -ILibraryAppletProxy::~ILibraryAppletProxy() = default; - -Result ILibraryAppletProxy::GetAudioController( - Out> out_audio_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_audio_controller = std::make_shared(system); - R_SUCCEED(); -} - -Result ILibraryAppletProxy::GetDisplayController( - Out> out_display_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_display_controller = std::make_shared(system, m_applet); - R_SUCCEED(); -} - -Result ILibraryAppletProxy::GetProcessWindingController( - Out> out_process_winding_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_process_winding_controller = std::make_shared(system, m_applet); - R_SUCCEED(); -} - -Result ILibraryAppletProxy::GetDebugFunctions( - Out> out_debug_functions) { - LOG_DEBUG(Service_AM, "called"); - *out_debug_functions = std::make_shared(system); - R_SUCCEED(); -} - -Result ILibraryAppletProxy::GetWindowController( - Out> out_window_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_window_controller = std::make_shared(system, m_applet, m_window_system); - R_SUCCEED(); -} - -Result ILibraryAppletProxy::GetSelfController( - Out> out_self_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_self_controller = std::make_shared(system, m_applet, m_process); - R_SUCCEED(); -} - -Result ILibraryAppletProxy::GetCommonStateGetter( - Out> out_common_state_getter) { - LOG_DEBUG(Service_AM, "called"); - *out_common_state_getter = std::make_shared(system, m_applet); - R_SUCCEED(); -} - -Result ILibraryAppletProxy::GetLibraryAppletCreator( - Out> out_library_applet_creator) { - LOG_DEBUG(Service_AM, "called"); - *out_library_applet_creator = - std::make_shared(system, m_applet, m_window_system); - R_SUCCEED(); -} - -Result ILibraryAppletProxy::OpenLibraryAppletSelfAccessor( - Out> out_library_applet_self_accessor) { - LOG_DEBUG(Service_AM, "called"); - *out_library_applet_self_accessor = - std::make_shared(system, m_applet); - R_SUCCEED(); -} - -Result ILibraryAppletProxy::GetAppletCommonFunctions( - Out> out_applet_common_functions) { - LOG_DEBUG(Service_AM, "called"); - *out_applet_common_functions = std::make_shared(system, m_applet); - R_SUCCEED(); -} - -Result ILibraryAppletProxy::GetHomeMenuFunctions( - Out> out_home_menu_functions) { - LOG_DEBUG(Service_AM, "called"); - *out_home_menu_functions = - std::make_shared(system, m_applet, m_window_system); - R_SUCCEED(); -} - -Result ILibraryAppletProxy::GetGlobalStateController( - Out> out_global_state_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_global_state_controller = std::make_shared(system); - R_SUCCEED(); -} - -} // namespace Service::AM diff --git a/src/core/hle/service/am/service/library_applet_proxy.h b/src/core/hle/service/am/service/library_applet_proxy.h deleted file mode 100644 index 792d585827..0000000000 --- a/src/core/hle/service/am/service/library_applet_proxy.h +++ /dev/null @@ -1,56 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/cmif_types.h" -#include "core/hle/service/service.h" - -namespace Service::AM { - -struct Applet; -class IAppletCommonFunctions; -class IAudioController; -class ICommonStateGetter; -class IDebugFunctions; -class IDisplayController; -class IHomeMenuFunctions; -class IGlobalStateController; -class ILibraryAppletCreator; -class ILibraryAppletSelfAccessor; -class IProcessWindingController; -class ISelfController; -class IWindowController; -class WindowSystem; - -class ILibraryAppletProxy final : public ServiceFramework { -public: - explicit ILibraryAppletProxy(Core::System& system_, std::shared_ptr applet, - Kernel::KProcess* process, WindowSystem& window_system); - ~ILibraryAppletProxy(); - -private: - Result GetAudioController(Out> out_audio_controller); - Result GetDisplayController(Out> out_display_controller); - Result GetProcessWindingController( - Out> out_process_winding_controller); - Result GetDebugFunctions(Out> out_debug_functions); - Result GetWindowController(Out> out_window_controller); - Result GetSelfController(Out> out_self_controller); - Result GetCommonStateGetter(Out> out_common_state_getter); - Result GetLibraryAppletCreator( - Out> out_library_applet_creator); - Result OpenLibraryAppletSelfAccessor( - Out> out_library_applet_self_accessor); - Result GetAppletCommonFunctions( - Out> out_applet_common_functions); - Result GetHomeMenuFunctions(Out> out_home_menu_functions); - Result GetGlobalStateController( - Out> out_global_state_controller); - - WindowSystem& m_window_system; - Kernel::KProcess* const m_process; - const std::shared_ptr m_applet; -}; - -} // namespace Service::AM diff --git a/src/core/hle/service/am/service/library_applet_self_accessor.cpp b/src/core/hle/service/am/service/library_applet_self_accessor.cpp deleted file mode 100644 index 907be49204..0000000000 --- a/src/core/hle/service/am/service/library_applet_self_accessor.cpp +++ /dev/null @@ -1,332 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/core_timing.h" -#include "core/file_sys/control_metadata.h" -#include "core/file_sys/patch_manager.h" -#include "core/file_sys/registered_cache.h" -#include "core/hle/service/acc/profile_manager.h" -#include "core/hle/service/am/applet_data_broker.h" -#include "core/hle/service/am/applet_manager.h" -#include "core/hle/service/am/frontend/applets.h" -#include "core/hle/service/am/service/library_applet_self_accessor.h" -#include "core/hle/service/am/service/storage.h" -#include "core/hle/service/cmif_serialization.h" -#include "core/hle/service/filesystem/filesystem.h" -#include "core/hle/service/glue/glue_manager.h" -#include "core/hle/service/ns/application_manager_interface.h" -#include "core/hle/service/ns/service_getter_interface.h" -#include "core/hle/service/sm/sm.h" - -namespace Service::AM { - -namespace { - -AppletIdentityInfo GetCallerIdentity(Applet& applet) { - if (const auto caller_applet = applet.caller_applet.lock(); caller_applet) { - // TODO: is this actually the application ID? - return { - .applet_id = caller_applet->applet_id, - .application_id = caller_applet->program_id, - }; - } else { - return { - .applet_id = AppletId::QLaunch, - .application_id = 0x0100000000001000ull, - }; - } -} - -} // namespace - -ILibraryAppletSelfAccessor::ILibraryAppletSelfAccessor(Core::System& system_, - std::shared_ptr applet) - : ServiceFramework{system_, "ILibraryAppletSelfAccessor"}, m_applet{std::move(applet)}, - m_broker{m_applet->caller_applet_broker} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&ILibraryAppletSelfAccessor::PopInData>, "PopInData"}, - {1, D<&ILibraryAppletSelfAccessor::PushOutData>, "PushOutData"}, - {2, D<&ILibraryAppletSelfAccessor::PopInteractiveInData>, "PopInteractiveInData"}, - {3, D<&ILibraryAppletSelfAccessor::PushInteractiveOutData>, "PushInteractiveOutData"}, - {5, D<&ILibraryAppletSelfAccessor::GetPopInDataEvent>, "GetPopInDataEvent"}, - {6, D<&ILibraryAppletSelfAccessor::GetPopInteractiveInDataEvent>, "GetPopInteractiveInDataEvent"}, - {10, D<&ILibraryAppletSelfAccessor::ExitProcessAndReturn>, "ExitProcessAndReturn"}, - {11, D<&ILibraryAppletSelfAccessor::GetLibraryAppletInfo>, "GetLibraryAppletInfo"}, - {12, D<&ILibraryAppletSelfAccessor::GetMainAppletIdentityInfo>, "GetMainAppletIdentityInfo"}, - {13, D<&ILibraryAppletSelfAccessor::CanUseApplicationCore>, "CanUseApplicationCore"}, - {14, D<&ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfo>, "GetCallerAppletIdentityInfo"}, - {15, D<&ILibraryAppletSelfAccessor::GetMainAppletApplicationControlProperty>, "GetMainAppletApplicationControlProperty"}, - {16, D<&ILibraryAppletSelfAccessor::GetMainAppletStorageId>, "GetMainAppletStorageId"}, - {17, D<&ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfoStack>, "GetCallerAppletIdentityInfoStack"}, - {18, nullptr, "GetNextReturnDestinationAppletIdentityInfo"}, - {19, D<&ILibraryAppletSelfAccessor::GetDesirableKeyboardLayout>, "GetDesirableKeyboardLayout"}, - {20, nullptr, "PopExtraStorage"}, - {25, nullptr, "GetPopExtraStorageEvent"}, - {30, D<&ILibraryAppletSelfAccessor::UnpopInData>, "UnpopInData"}, - {31, nullptr, "UnpopExtraStorage"}, - {40, nullptr, "GetIndirectLayerProducerHandle"}, - {50, D<&ILibraryAppletSelfAccessor::ReportVisibleError>, "ReportVisibleError"}, - {51, D<&ILibraryAppletSelfAccessor::ReportVisibleErrorWithErrorContext>, "ReportVisibleErrorWithErrorContext"}, - {60, D<&ILibraryAppletSelfAccessor::GetMainAppletApplicationDesiredLanguage>, "GetMainAppletApplicationDesiredLanguage"}, - {70, D<&ILibraryAppletSelfAccessor::GetCurrentApplicationId>, "GetCurrentApplicationId"}, - {80, nullptr, "RequestExitToSelf"}, - {90, nullptr, "CreateApplicationAndPushAndRequestToLaunch"}, - {100, nullptr, "CreateGameMovieTrimmer"}, - {101, nullptr, "ReserveResourceForMovieOperation"}, - {102, nullptr, "UnreserveResourceForMovieOperation"}, - {110, D<&ILibraryAppletSelfAccessor::GetMainAppletAvailableUsers>, "GetMainAppletAvailableUsers"}, - {120, nullptr, "GetLaunchStorageInfoForDebug"}, - {130, nullptr, "GetGpuErrorDetectedSystemEvent"}, - {140, nullptr, "SetApplicationMemoryReservation"}, - {150, D<&ILibraryAppletSelfAccessor::ShouldSetGpuTimeSliceManually>, "ShouldSetGpuTimeSliceManually"}, - {160, D<&ILibraryAppletSelfAccessor::GetLibraryAppletInfoEx>, "GetLibraryAppletInfoEx"}, - }; - // clang-format on - RegisterHandlers(functions); -} - -ILibraryAppletSelfAccessor::~ILibraryAppletSelfAccessor() = default; - -Result ILibraryAppletSelfAccessor::PopInData(Out> out_storage) { - LOG_INFO(Service_AM, "called"); - R_RETURN(m_broker->GetInData().Pop(system.Kernel(), out_storage)); -} - -Result ILibraryAppletSelfAccessor::PushOutData(SharedPointer storage) { - LOG_INFO(Service_AM, "called"); - m_broker->GetOutData().Push(system.Kernel(), storage); - R_SUCCEED(); -} - -Result ILibraryAppletSelfAccessor::PopInteractiveInData(Out> out_storage) { - LOG_INFO(Service_AM, "called"); - R_RETURN(m_broker->GetInteractiveInData().Pop(system.Kernel(), out_storage)); -} - -Result ILibraryAppletSelfAccessor::PushInteractiveOutData(SharedPointer storage) { - LOG_INFO(Service_AM, "called"); - m_broker->GetInteractiveOutData().Push(system.Kernel(), storage); - R_SUCCEED(); -} - -Result ILibraryAppletSelfAccessor::GetPopInDataEvent( - OutCopyHandle out_event) { - LOG_INFO(Service_AM, "called"); - *out_event = m_broker->GetInData().GetEvent(); - R_SUCCEED(); -} - -Result ILibraryAppletSelfAccessor::GetPopInteractiveInDataEvent( - OutCopyHandle out_event) { - LOG_INFO(Service_AM, "called"); - *out_event = m_broker->GetInteractiveInData().GetEvent(); - R_SUCCEED(); -} - -Result ILibraryAppletSelfAccessor::GetLibraryAppletInfo( - Out out_library_applet_info) { - LOG_INFO(Service_AM, "called"); - *out_library_applet_info = { - .applet_id = m_applet->applet_id, - .library_applet_mode = m_applet->library_applet_mode, - }; - R_SUCCEED(); -} - -Result ILibraryAppletSelfAccessor::GetMainAppletIdentityInfo( - Out out_identity_info) { - LOG_WARNING(Service_AM, "(STUBBED) called"); - *out_identity_info = { - .applet_id = AppletId::QLaunch, - .application_id = 0x0100000000001000ull, - }; - R_SUCCEED(); -} - -Result ILibraryAppletSelfAccessor::CanUseApplicationCore(Out out_can_use_application_core) { - // TODO: This appears to read the NPDM from state and check the core mask of the applet. - LOG_WARNING(Service_AM, "(STUBBED) called"); - *out_can_use_application_core = false; - R_SUCCEED(); -} - -Result ILibraryAppletSelfAccessor::GetMainAppletApplicationControlProperty( - OutLargeData, BufferAttr_HipcMapAlias> out_nacp) { - LOG_WARNING(Service_AM, "(STUBBED) called"); - - // TODO: this should be the main applet, not the caller applet - const auto application = GetCallerIdentity(*m_applet); - std::vector nacp; - const auto result = - system.GetARPManager().GetControlProperty(&nacp, application.application_id); - - if (R_SUCCEEDED(result)) { - std::memcpy(out_nacp->data(), nacp.data(), (std::min)(nacp.size(), out_nacp->size())); - } - - R_RETURN(result); -} - -Result ILibraryAppletSelfAccessor::GetMainAppletStorageId(Out out_storage_id) { - LOG_INFO(Service_AM, "(STUBBED) called"); - *out_storage_id = FileSys::StorageId::NandUser; - R_SUCCEED(); -} - -Result ILibraryAppletSelfAccessor::ExitProcessAndReturn() { - LOG_INFO(Service_AM, "called"); - - if (const auto caller_applet = m_applet->caller_applet.lock(); caller_applet) { - m_applet->process->Terminate(); - } else { - system.GetUserChannel() = m_applet->user_channel_launch_parameter; - system.ExecuteProgram(0); - } - - R_SUCCEED(); -} - -Result ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfo( - Out out_identity_info) { - LOG_INFO(Service_AM, "called"); - *out_identity_info = GetCallerIdentity(*m_applet); - R_SUCCEED(); -} - -Result ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfoStack( - Out out_count, OutArray out_identity_info) { - LOG_INFO(Service_AM, "called"); - - std::shared_ptr applet = m_applet; - *out_count = 0; - - do { - if (*out_count >= static_cast(out_identity_info.size())) { - break; - } - out_identity_info[(*out_count)++] = GetCallerIdentity(*applet); - } while ((applet = applet->caller_applet.lock())); - - R_SUCCEED(); -} - -Result ILibraryAppletSelfAccessor::GetDesirableKeyboardLayout(Out out_desirable_layout) { - LOG_WARNING(Service_AM, "(STUBBED) called"); - *out_desirable_layout = 0; - R_SUCCEED(); -} - -Result ILibraryAppletSelfAccessor::ReportVisibleError(ErrorCode error_code) { - LOG_WARNING(Service_AM, "(STUBBED) called, error {}-{}", error_code.category, - error_code.number); - R_SUCCEED(); -} - -Result ILibraryAppletSelfAccessor::ReportVisibleErrorWithErrorContext( - ErrorCode error_code, InLargeData error_context) { - LOG_WARNING(Service_AM, "(STUBBED) called, error {}-{}", error_code.category, - error_code.number); - R_SUCCEED(); -} - -Result ILibraryAppletSelfAccessor::UnpopInData(SharedPointer storage) { - LOG_INFO(Service_AM, "called"); - m_broker->GetInData().Unpop(system.Kernel(), storage); - R_SUCCEED(); -} - -Result ILibraryAppletSelfAccessor::GetMainAppletApplicationDesiredLanguage( - Out out_desired_language) { - // FIXME: this is copied from IApplicationFunctions::GetDesiredLanguage - // FIXME: all of this stuff belongs to ns - auto identity = GetCallerIdentity(*m_applet); - - // TODO(bunnei): This should be configurable - LOG_DEBUG(Service_AM, "called"); - - // Get supported languages from NACP, if possible - // Default to 0 (all languages supported) - u32 supported_languages = 0; - - const auto res = FileSys::PatchManager::GetMetadataFromBaseOrUpdate(system, identity.application_id); - - if (res.first != nullptr) { - supported_languages = res.first->GetSupportedLanguages(); - } - - // Call IApplicationManagerInterface implementation. - auto& service_manager = system.ServiceManager(); - auto ns_am2 = service_manager.GetService("ns:am2"); - - std::shared_ptr app_man; - R_TRY(ns_am2->GetApplicationManagerInterface(&app_man)); - - // Get desired application language - NS::ApplicationLanguage desired_language{}; - R_TRY(app_man->GetApplicationDesiredLanguage(&desired_language, supported_languages)); - - // Convert to settings language code. - u64 language_code{}; - R_TRY(app_man->ConvertApplicationLanguageToLanguageCode(&language_code, desired_language)); - - LOG_DEBUG(Service_AM, "got desired_language={:016X}", language_code); - - *out_desired_language = language_code; - R_SUCCEED(); -} - -Result ILibraryAppletSelfAccessor::GetCurrentApplicationId(Out out_application_id) { - LOG_WARNING(Service_AM, "(STUBBED) called"); - - // TODO: this should be the main applet, not the caller applet - const auto main_applet = GetCallerIdentity(*m_applet); - *out_application_id = main_applet.application_id; - - R_SUCCEED(); -} - -Result ILibraryAppletSelfAccessor::GetMainAppletAvailableUsers( - Out out_can_select_any_user, Out out_users_count, - OutArray out_users) { - const Service::Account::ProfileManager manager{}; - - *out_can_select_any_user = false; - *out_users_count = -1; - - LOG_INFO(Service_AM, "called"); - - if (manager.GetUserCount() > 0) { - *out_can_select_any_user = true; - *out_users_count = static_cast(manager.GetUserCount()); - - const auto users = manager.GetAllUsers(); - for (size_t i = 0; i < users.size() && i < out_users.size(); i++) { - out_users[i] = users[i]; - } - } - - R_SUCCEED(); -} - -Result ILibraryAppletSelfAccessor::ShouldSetGpuTimeSliceManually( - Out out_should_set_gpu_time_slice_manually) { - LOG_INFO(Service_AM, "(STUBBED) called"); - *out_should_set_gpu_time_slice_manually = false; - R_SUCCEED(); -} - -Result ILibraryAppletSelfAccessor::GetLibraryAppletInfoEx( - Out out_library_applet_info) { - LOG_INFO(Service_AM, "called"); - *out_library_applet_info = { - .applet_id = m_applet->applet_id, - .library_applet_mode = m_applet->library_applet_mode, - }; - R_SUCCEED(); -} - -} // namespace Service::AM diff --git a/src/core/hle/service/am/service/library_applet_self_accessor.h b/src/core/hle/service/am/service/library_applet_self_accessor.h deleted file mode 100644 index d287f6b403..0000000000 --- a/src/core/hle/service/am/service/library_applet_self_accessor.h +++ /dev/null @@ -1,87 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "common/uuid.h" -#include "core/hle/service/am/am_types.h" -#include "core/hle/service/cmif_types.h" -#include "core/hle/service/service.h" - -namespace FileSys { -enum class StorageId : u8; -} - -namespace Kernel { -class KReadableEvent; -} - -namespace Service::AM { - -class AppletDataBroker; -struct Applet; -class IStorage; - -struct LibraryAppletInfo { - AppletId applet_id; - LibraryAppletMode library_applet_mode; -}; -static_assert(sizeof(LibraryAppletInfo) == 0x8, "LibraryAppletInfo has incorrect size."); - -struct ErrorCode { - u32 category; - u32 number; -}; -static_assert(sizeof(ErrorCode) == 0x8, "ErrorCode has incorrect size."); - -struct ErrorContext { - u8 type; - INSERT_PADDING_BYTES_NOINIT(0x7); - std::array data; - Result result; -}; -static_assert(sizeof(ErrorContext) == 0x200, "ErrorContext has incorrect size."); - -class ILibraryAppletSelfAccessor final : public ServiceFramework { -public: - explicit ILibraryAppletSelfAccessor(Core::System& system_, std::shared_ptr applet); - ~ILibraryAppletSelfAccessor() override; - -private: - Result PopInData(Out> out_storage); - Result PushOutData(SharedPointer storage); - Result PopInteractiveInData(Out> out_storage); - Result PushInteractiveOutData(SharedPointer storage); - Result GetPopInDataEvent(OutCopyHandle out_event); - Result GetPopInteractiveInDataEvent(OutCopyHandle out_event); - Result GetLibraryAppletInfo(Out out_library_applet_info); - Result GetMainAppletIdentityInfo(Out out_identity_info); - Result CanUseApplicationCore(Out out_can_use_application_core); - Result GetMainAppletApplicationControlProperty( - OutLargeData, BufferAttr_HipcMapAlias> out_nacp); - Result GetMainAppletStorageId(Out out_storage_id); - Result ExitProcessAndReturn(); - Result GetCallerAppletIdentityInfo(Out out_identity_info); - Result GetCallerAppletIdentityInfoStack( - Out out_count, - OutArray out_identity_info); - Result GetDesirableKeyboardLayout(Out out_desirable_layout); - Result ReportVisibleError(ErrorCode error_code); - Result ReportVisibleErrorWithErrorContext( - ErrorCode error_code, InLargeData error_context); - Result UnpopInData(SharedPointer storage); - Result GetMainAppletApplicationDesiredLanguage(Out out_desired_language); - Result GetCurrentApplicationId(Out out_application_id); - Result GetMainAppletAvailableUsers(Out out_can_select_any_user, Out out_users_count, - OutArray out_users); - Result ShouldSetGpuTimeSliceManually(Out out_should_set_gpu_time_slice_manually); - Result GetLibraryAppletInfoEx(Out out_library_applet_info); - - const std::shared_ptr m_applet; - const std::shared_ptr m_broker; -}; - -} // namespace Service::AM diff --git a/src/core/hle/service/am/service/lock_accessor.cpp b/src/core/hle/service/am/service/lock_accessor.cpp deleted file mode 100644 index 0341254449..0000000000 --- a/src/core/hle/service/am/service/lock_accessor.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/hle/service/am/service/lock_accessor.h" -#include "core/hle/service/cmif_serialization.h" - -namespace Service::AM { - -ILockAccessor::ILockAccessor(Core::System& system_) - : ServiceFramework{system_, "ILockAccessor"}, m_context{system_, "ILockAccessor"}, - m_event{m_context} { - // clang-format off - static const FunctionInfo functions[] = { - {1, D<&ILockAccessor::TryLock>, "TryLock"}, - {2, D<&ILockAccessor::Unlock>, "Unlock"}, - {3, D<&ILockAccessor::GetEvent>, "GetEvent"}, - {4, D<&ILockAccessor::IsLocked>, "IsLocked"}, - }; - // clang-format on - - RegisterHandlers(functions); - - m_event.Signal(system.Kernel()); -} - -ILockAccessor::~ILockAccessor() = default; - -Result ILockAccessor::TryLock(Out out_is_locked, - OutCopyHandle out_handle, - bool return_handle) { - LOG_INFO(Service_AM, "called, return_handle={}", return_handle); - - { - std::scoped_lock lk{m_mutex}; - if (m_is_locked) { - *out_is_locked = false; - } else { - m_is_locked = true; - *out_is_locked = true; - } - } - - if (return_handle) { - *out_handle = m_event.GetHandle(); - } - - R_SUCCEED(); -} - -Result ILockAccessor::Unlock() { - LOG_INFO(Service_AM, "called"); - - { - std::scoped_lock lk{m_mutex}; - m_is_locked = false; - } - - m_event.Signal(system.Kernel()); - R_SUCCEED(); -} - -Result ILockAccessor::GetEvent(OutCopyHandle out_handle) { - LOG_INFO(Service_AM, "called"); - *out_handle = m_event.GetHandle(); - R_SUCCEED(); -} - -Result ILockAccessor::IsLocked(Out out_is_locked) { - LOG_INFO(Service_AM, "called"); - std::scoped_lock lk{m_mutex}; - *out_is_locked = m_is_locked; - R_SUCCEED(); -} - -} // namespace Service::AM diff --git a/src/core/hle/service/am/service/lock_accessor.h b/src/core/hle/service/am/service/lock_accessor.h deleted file mode 100644 index 9bfb5c0502..0000000000 --- a/src/core/hle/service/am/service/lock_accessor.h +++ /dev/null @@ -1,32 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/cmif_types.h" -#include "core/hle/service/kernel_helpers.h" -#include "core/hle/service/os/event.h" -#include "core/hle/service/service.h" - -namespace Service::AM { - -class ILockAccessor final : public ServiceFramework { -public: - explicit ILockAccessor(Core::System& system_); - ~ILockAccessor() override; - -private: - Result TryLock(Out out_is_locked, OutCopyHandle out_handle, - bool return_handle); - Result Unlock(); - Result GetEvent(OutCopyHandle out_handle); - Result IsLocked(Out out_is_locked); - -private: - KernelHelpers::ServiceContext m_context; - Event m_event; - std::mutex m_mutex{}; - bool m_is_locked{}; -}; - -} // namespace Service::AM diff --git a/src/core/hle/service/am/service/overlay_applet_proxy.cpp b/src/core/hle/service/am/service/overlay_applet_proxy.cpp deleted file mode 100644 index 5e140fe031..0000000000 --- a/src/core/hle/service/am/service/overlay_applet_proxy.cpp +++ /dev/null @@ -1,120 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "core/hle/service/am/service/common_state_getter.h" -#include "core/hle/service/am/service/display_controller.h" -#include "core/hle/service/am/service/global_state_controller.h" -#include "core/hle/service/am/service/audio_controller.h" -#include "core/hle/service/am/service/applet_common_functions.h" -#include "core/hle/service/am/service/overlay_applet_proxy.h" -#include "core/hle/service/am/service/library_applet_creator.h" -#include "core/hle/service/am/service/process_winding_controller.h" -#include "core/hle/service/am/service/self_controller.h" -#include "core/hle/service/am/service/window_controller.h" -#include "core/hle/service/am/service/debug_functions.h" -#include "core/hle/service/cmif_serialization.h" - -namespace Service::AM { - IOverlayAppletProxy::IOverlayAppletProxy(Core::System &system_, std::shared_ptr applet, - Kernel::KProcess *process, WindowSystem &window_system) - : ServiceFramework{system_, "IOverlayAppletProxy"}, - m_window_system{window_system}, m_process{process}, m_applet{std::move(applet)} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IOverlayAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"}, - {1, D<&IOverlayAppletProxy::GetSelfController>, "GetSelfController"}, - {2, D<&IOverlayAppletProxy::GetWindowController>, "GetWindowController"}, - {3, D<&IOverlayAppletProxy::GetAudioController>, "GetAudioController"}, - {4, D<&IOverlayAppletProxy::GetDisplayController>, "GetDisplayController"}, - {10, D<&IOverlayAppletProxy::GetProcessWindingController>, "GetProcessWindingController"}, - {11, D<&IOverlayAppletProxy::GetLibraryAppletCreator>, "GetLibraryAppletCreator"}, - {20, D<&IOverlayAppletProxy::GetOverlayFunctions>, "GetOverlayFunctions"}, - {21, D<&IOverlayAppletProxy::GetAppletCommonFunctions>, "GetAppletCommonFunctions"}, - {23, D<&IOverlayAppletProxy::GetGlobalStateController>, "GetGlobalStateController"}, - {1000, D<&IOverlayAppletProxy::GetDebugFunctions>, "GetDebugFunctions"}, - }; - // clang-format on - - RegisterHandlers(functions); - } - - IOverlayAppletProxy::~IOverlayAppletProxy() = default; - - Result IOverlayAppletProxy::GetCommonStateGetter( - Out > out_common_state_getter) { - LOG_DEBUG(Service_AM, "called"); - *out_common_state_getter = std::make_shared(system, m_applet); - R_SUCCEED(); - } - - Result IOverlayAppletProxy::GetSelfController( - Out > out_self_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_self_controller = std::make_shared(system, m_applet, m_process); - R_SUCCEED(); - } - - Result IOverlayAppletProxy::GetWindowController( - Out > out_window_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_window_controller = std::make_shared(system, m_applet, m_window_system); - R_SUCCEED(); - } - - Result IOverlayAppletProxy::GetAudioController( - Out > out_audio_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_audio_controller = std::make_shared(system); - R_SUCCEED(); - } - - Result IOverlayAppletProxy::GetDisplayController( - Out > out_display_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_display_controller = std::make_shared(system, m_applet); - R_SUCCEED(); - } - - Result IOverlayAppletProxy::GetProcessWindingController( - Out > out_process_winding_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_process_winding_controller = std::make_shared(system, m_applet); - R_SUCCEED(); - } - - Result IOverlayAppletProxy::GetLibraryAppletCreator( - Out > out_library_applet_creator) { - LOG_DEBUG(Service_AM, "called"); - *out_library_applet_creator = - std::make_shared(system, m_applet, m_window_system); - R_SUCCEED(); - } - - Result IOverlayAppletProxy::GetOverlayFunctions( - Out > out_overlay_functions) { - LOG_DEBUG(Service_AM, "called"); - *out_overlay_functions = std::make_shared(system, m_applet); - R_SUCCEED(); - } - - Result IOverlayAppletProxy::GetAppletCommonFunctions( - Out > out_applet_common_functions) { - LOG_DEBUG(Service_AM, "called"); - *out_applet_common_functions = std::make_shared(system, m_applet); - R_SUCCEED(); - } - - Result IOverlayAppletProxy::GetGlobalStateController( - Out > out_global_state_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_global_state_controller = std::make_shared(system); - R_SUCCEED(); - } - - Result IOverlayAppletProxy::GetDebugFunctions( - Out > out_debug_functions) { - LOG_DEBUG(Service_AM, "called"); - *out_debug_functions = std::make_shared(system); - R_SUCCEED(); - } -} // namespace Service::AM diff --git a/src/core/hle/service/am/service/overlay_applet_proxy.h b/src/core/hle/service/am/service/overlay_applet_proxy.h deleted file mode 100644 index 2c7fa57dfd..0000000000 --- a/src/core/hle/service/am/service/overlay_applet_proxy.h +++ /dev/null @@ -1,55 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include "core/hle/service/cmif_types.h" -#include "core/hle/service/service.h" -#include "core/hle/service/am/service/overlay_functions.h" - -namespace Service::AM { - -struct Applet; -class IAppletCommonFunctions; -class IAudioController; -class ICommonStateGetter; -class IDebugFunctions; -class IDisplayController; -class IHomeMenuFunctions; -class IGlobalStateController; -class ILibraryAppletCreator; -class ILibraryAppletSelfAccessor; -class IProcessWindingController; -class ISelfController; -class IWindowController; -class WindowSystem; - -class IOverlayAppletProxy final : public ServiceFramework { -public: - explicit IOverlayAppletProxy(Core::System& system_, std::shared_ptr applet, - Kernel::KProcess* process, WindowSystem& window_system); - ~IOverlayAppletProxy(); - -private: - Result GetCommonStateGetter(Out> out_common_state_getter); - Result GetSelfController(Out> out_self_controller); - Result GetWindowController(Out> out_window_controller); - Result GetAudioController(Out> out_audio_controller); - Result GetDisplayController(Out> out_display_controller); - Result GetProcessWindingController( - Out> out_process_winding_controller); - Result GetLibraryAppletCreator( - Out> out_library_applet_creator); - Result GetOverlayFunctions(Out> out_overlay_functions); - Result GetAppletCommonFunctions( - Out> out_applet_common_functions); - Result GetGlobalStateController( - Out> out_global_state_controller); - Result GetDebugFunctions(Out> out_debug_functions); - - WindowSystem& m_window_system; - Kernel::KProcess* const m_process; - const std::shared_ptr m_applet; -}; - -} // namespace Service::AM diff --git a/src/core/hle/service/am/service/overlay_functions.cpp b/src/core/hle/service/am/service/overlay_functions.cpp index 8150b5dd07..006610bd47 100644 --- a/src/core/hle/service/am/service/overlay_functions.cpp +++ b/src/core/hle/service/am/service/overlay_functions.cpp @@ -8,34 +8,34 @@ #include "core/hle/service/am/window_system.h" namespace Service::AM { + std::optional IOverlayFunctions::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IOverlayFunctions::BeginToWatchShortHomeButtonMessage>, "BeginToWatchShortHomeButtonMessage"}, + FunctionInfo{1, D<&IOverlayFunctions::EndToWatchShortHomeButtonMessage>, "EndToWatchShortHomeButtonMessage"}, + FunctionInfo{2, D<&IOverlayFunctions::GetApplicationIdForLogo>, "GetApplicationIdForLogo"}, + FunctionInfo{3, nullptr, "SetGpuTimeSliceBoost"}, + FunctionInfo{4, D<&IOverlayFunctions::SetAutoSleepTimeAndDimmingTimeEnabled>, "SetAutoSleepTimeAndDimmingTimeEnabled"}, + FunctionInfo{5, nullptr, "TerminateApplicationAndSetReason"}, + FunctionInfo{6, nullptr, "SetScreenShotPermissionGlobally"}, + FunctionInfo{10, nullptr, "StartShutdownSequenceForOverlay"}, + FunctionInfo{11, nullptr, "StartRebootSequenceForOverlay"}, + FunctionInfo{20, D<&IOverlayFunctions::SetHandlingHomeButtonShortPressedEnabled>, "SetHandlingHomeButtonShortPressedEnabled"}, + FunctionInfo{21, D<&IOverlayFunctions::SetHandlingTouchScreenInputEnabled>, "SetHandlingTouchScreenInputEnabled"}, + FunctionInfo{30, nullptr, "SetHealthWarningShowingState"}, + FunctionInfo{31, D<&IOverlayFunctions::IsHealthWarningRequired>, "IsHealthWarningRequired"}, + FunctionInfo{40, nullptr, "GetApplicationNintendoLogo"}, + FunctionInfo{41, nullptr, "GetApplicationStartupMovie"}, + FunctionInfo{50, nullptr, "SetGpuTimeSliceBoostForApplication"}, + FunctionInfo{60, nullptr, "Unknown60"}, + FunctionInfo{70, D<&IOverlayFunctions::Unknown70>, "Unknown70"}, + FunctionInfo{90, nullptr, "SetRequiresGpuResourceUse"}, + FunctionInfo{101, nullptr, "BeginToObserveHidInputForDevelop"} + ); + return HandlerTableGenerateWithFind(key, functions); + } + IOverlayFunctions::IOverlayFunctions(Core::System &system_, std::shared_ptr applet) : ServiceFramework{system_, "IOverlayFunctions"}, m_applet{std::move(applet)} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IOverlayFunctions::BeginToWatchShortHomeButtonMessage>, "BeginToWatchShortHomeButtonMessage"}, - {1, D<&IOverlayFunctions::EndToWatchShortHomeButtonMessage>, "EndToWatchShortHomeButtonMessage"}, - {2, D<&IOverlayFunctions::GetApplicationIdForLogo>, "GetApplicationIdForLogo"}, - {3, nullptr, "SetGpuTimeSliceBoost"}, - {4, D<&IOverlayFunctions::SetAutoSleepTimeAndDimmingTimeEnabled>, "SetAutoSleepTimeAndDimmingTimeEnabled"}, - {5, nullptr, "TerminateApplicationAndSetReason"}, - {6, nullptr, "SetScreenShotPermissionGlobally"}, - {10, nullptr, "StartShutdownSequenceForOverlay"}, - {11, nullptr, "StartRebootSequenceForOverlay"}, - {20, D<&IOverlayFunctions::SetHandlingHomeButtonShortPressedEnabled>, "SetHandlingHomeButtonShortPressedEnabled"}, - {21, D<&IOverlayFunctions::SetHandlingTouchScreenInputEnabled>, "SetHandlingTouchScreenInputEnabled"}, - {30, nullptr, "SetHealthWarningShowingState"}, - {31, D<&IOverlayFunctions::IsHealthWarningRequired>, "IsHealthWarningRequired"}, - {40, nullptr, "GetApplicationNintendoLogo"}, - {41, nullptr, "GetApplicationStartupMovie"}, - {50, nullptr, "SetGpuTimeSliceBoostForApplication"}, - {60, nullptr, "Unknown60"}, - {70, D<&IOverlayFunctions::Unknown70>, "Unknown70"}, - {90, nullptr, "SetRequiresGpuResourceUse"}, - {101, nullptr, "BeginToObserveHidInputForDevelop"}, - }; - // clang-format on - - RegisterHandlers(functions); } IOverlayFunctions::~IOverlayFunctions() = default; diff --git a/src/core/hle/service/am/service/overlay_functions.h b/src/core/hle/service/am/service/overlay_functions.h index eefd8d862b..b94f0cc0d5 100644 --- a/src/core/hle/service/am/service/overlay_functions.h +++ b/src/core/hle/service/am/service/overlay_functions.h @@ -6,24 +6,25 @@ #include "core/hle/service/service.h" namespace Service::AM { - struct Applet; +struct Applet; - class IOverlayFunctions final : public ServiceFramework { - public: - explicit IOverlayFunctions(Core::System &system_, std::shared_ptr applet); - ~IOverlayFunctions() override; +class IOverlayFunctions final : public ServiceFramework { +public: + explicit IOverlayFunctions(Core::System &system_, std::shared_ptr applet); + ~IOverlayFunctions() override; - private: - Result BeginToWatchShortHomeButtonMessage(); - Result EndToWatchShortHomeButtonMessage(); - Result GetApplicationIdForLogo(Out out_application_id); - Result SetAutoSleepTimeAndDimmingTimeEnabled(bool enabled); - Result IsHealthWarningRequired(Out is_required); - Result SetHandlingHomeButtonShortPressedEnabled(bool enabled); - Result SetHandlingTouchScreenInputEnabled(bool enabled); - Result Unknown70(); +private: + Result BeginToWatchShortHomeButtonMessage(); + Result EndToWatchShortHomeButtonMessage(); + Result GetApplicationIdForLogo(Out out_application_id); + Result SetAutoSleepTimeAndDimmingTimeEnabled(bool enabled); + Result IsHealthWarningRequired(Out is_required); + Result SetHandlingHomeButtonShortPressedEnabled(bool enabled); + Result SetHandlingTouchScreenInputEnabled(bool enabled); + Result Unknown70(); - private: - const std::shared_ptr m_applet; - }; +private: + std::optional FindRequest(u32 key) override; + const std::shared_ptr m_applet; +}; } // namespace Service::AM diff --git a/src/core/hle/service/am/service/process_winding_controller.cpp b/src/core/hle/service/am/service/process_winding_controller.cpp index e284aa2d89..159f4dfd5c 100644 --- a/src/core/hle/service/am/service/process_winding_controller.cpp +++ b/src/core/hle/service/am/service/process_winding_controller.cpp @@ -13,23 +13,23 @@ namespace Service::AM { + std::optional IProcessWindingController::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IProcessWindingController::GetLaunchReason>, "GetLaunchReason"}, + FunctionInfo{11, D<&IProcessWindingController::OpenCallingLibraryApplet>, "OpenCallingLibraryApplet"}, + FunctionInfo{21, D<&IProcessWindingController::PushContext>, "PushContext"}, + FunctionInfo{22, D<&IProcessWindingController::PopContext>, "PopContext"}, + FunctionInfo{23, D<&IProcessWindingController::CancelWindingReservation>, "CancelWindingReservation"}, + FunctionInfo{30, D<&IProcessWindingController::WindAndDoReserved>, "WindAndDoReserved"}, + FunctionInfo{40, D<&IProcessWindingController::ReserveToStartAndWaitAndUnwindThis>, "ReserveToStartAndWaitAndUnwindThis"}, + FunctionInfo{41, D<&IProcessWindingController::ReserveToStartAndWait>, "ReserveToStartAndWait"} + ); + return HandlerTableGenerateWithFind(key, functions); + } + IProcessWindingController::IProcessWindingController(Core::System& system_, std::shared_ptr applet) : ServiceFramework{system_, "IProcessWindingController"}, m_applet{std::move(applet)} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IProcessWindingController::GetLaunchReason>, "GetLaunchReason"}, - {11, D<&IProcessWindingController::OpenCallingLibraryApplet>, "OpenCallingLibraryApplet"}, - {21, D<&IProcessWindingController::PushContext>, "PushContext"}, - {22, D<&IProcessWindingController::PopContext>, "PopContext"}, - {23, D<&IProcessWindingController::CancelWindingReservation>, "CancelWindingReservation"}, - {30, D<&IProcessWindingController::WindAndDoReserved>, "WindAndDoReserved"}, - {40, D<&IProcessWindingController::ReserveToStartAndWaitAndUnwindThis>, "ReserveToStartAndWaitAndUnwindThis"}, - {41, D<&IProcessWindingController::ReserveToStartAndWait>, "ReserveToStartAndWait"}, - }; - // clang-format on - - RegisterHandlers(functions); } IProcessWindingController::~IProcessWindingController() = default; diff --git a/src/core/hle/service/am/service/process_winding_controller.h b/src/core/hle/service/am/service/process_winding_controller.h index f3417bcd97..91b29ac04b 100644 --- a/src/core/hle/service/am/service/process_winding_controller.h +++ b/src/core/hle/service/am/service/process_winding_controller.h @@ -33,6 +33,7 @@ private: SharedPointer reserved_applet_accessor); Result ReserveToStartAndWait(SharedPointer reserved_applet_accessor); + std::optional FindRequest(u32 key) override; const std::shared_ptr m_applet; }; diff --git a/src/core/hle/service/am/service/self_controller.cpp b/src/core/hle/service/am/service/self_controller.cpp index 3a654b9daa..ce8a308d6a 100644 --- a/src/core/hle/service/am/service/self_controller.cpp +++ b/src/core/hle/service/am/service/self_controller.cpp @@ -17,67 +17,66 @@ namespace Service::AM { + std::optional ISelfController::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&ISelfController::Exit>, "Exit"}, + FunctionInfo{1, D<&ISelfController::LockExit>, "LockExit"}, + FunctionInfo{2, D<&ISelfController::UnlockExit>, "UnlockExit"}, + FunctionInfo{3, D<&ISelfController::EnterFatalSection>, "EnterFatalSection"}, + FunctionInfo{4, D<&ISelfController::LeaveFatalSection>, "LeaveFatalSection"}, + FunctionInfo{9, D<&ISelfController::GetLibraryAppletLaunchableEvent>, "GetLibraryAppletLaunchableEvent"}, + FunctionInfo{10, D<&ISelfController::SetScreenShotPermission>, "SetScreenShotPermission"}, + FunctionInfo{11, D<&ISelfController::SetOperationModeChangedNotification>, "SetOperationModeChangedNotification"}, + FunctionInfo{12, D<&ISelfController::SetPerformanceModeChangedNotification>, "SetPerformanceModeChangedNotification"}, + FunctionInfo{13, D<&ISelfController::SetFocusHandlingMode>, "SetFocusHandlingMode"}, + FunctionInfo{14, D<&ISelfController::SetRestartMessageEnabled>, "SetRestartMessageEnabled"}, + FunctionInfo{15, D<&ISelfController::SetScreenShotAppletIdentityInfo>, "SetScreenShotAppletIdentityInfo"}, + FunctionInfo{16, D<&ISelfController::SetOutOfFocusSuspendingEnabled>, "SetOutOfFocusSuspendingEnabled"}, + FunctionInfo{17, nullptr, "SetControllerFirmwareUpdateSection"}, + FunctionInfo{18, nullptr, "SetRequiresCaptureButtonShortPressedMessage"}, + FunctionInfo{19, D<&ISelfController::SetAlbumImageOrientation>, "SetAlbumImageOrientation"}, + FunctionInfo{20, nullptr, "SetDesirableKeyboardLayout"}, + FunctionInfo{21, nullptr, "GetScreenShotProgramId"}, + FunctionInfo{40, D<&ISelfController::CreateManagedDisplayLayer>, "CreateManagedDisplayLayer"}, + FunctionInfo{41, D<&ISelfController::IsSystemBufferSharingEnabled>, "IsSystemBufferSharingEnabled"}, + FunctionInfo{42, D<&ISelfController::GetSystemSharedLayerHandle>, "GetSystemSharedLayerHandle"}, + FunctionInfo{43, D<&ISelfController::GetSystemSharedBufferHandle>, "GetSystemSharedBufferHandle"}, + FunctionInfo{44, D<&ISelfController::CreateManagedDisplaySeparableLayer>, "CreateManagedDisplaySeparableLayer"}, + FunctionInfo{45, nullptr, "SetManagedDisplayLayerSeparationMode"}, + FunctionInfo{46, nullptr, "SetRecordingLayerCompositionEnabled"}, + FunctionInfo{50, D<&ISelfController::SetHandlesRequestToDisplay>, "SetHandlesRequestToDisplay"}, + FunctionInfo{51, D<&ISelfController::ApproveToDisplay>, "ApproveToDisplay"}, + FunctionInfo{60, D<&ISelfController::OverrideAutoSleepTimeAndDimmingTime>, "OverrideAutoSleepTimeAndDimmingTime"}, + FunctionInfo{61, D<&ISelfController::SetMediaPlaybackState>, "SetMediaPlaybackState"}, + FunctionInfo{62, D<&ISelfController::SetIdleTimeDetectionExtension>, "SetIdleTimeDetectionExtension"}, + FunctionInfo{63, D<&ISelfController::GetIdleTimeDetectionExtension>, "GetIdleTimeDetectionExtension"}, + FunctionInfo{64, nullptr, "SetInputDetectionSourceSet"}, + FunctionInfo{65, D<&ISelfController::ReportUserIsActive>, "ReportUserIsActive"}, + FunctionInfo{66, nullptr, "GetCurrentIlluminance"}, + FunctionInfo{67, D<&ISelfController::IsIlluminanceAvailable>, "IsIlluminanceAvailable"}, + FunctionInfo{68, D<&ISelfController::SetAutoSleepDisabled>, "SetAutoSleepDisabled"}, + FunctionInfo{69, D<&ISelfController::IsAutoSleepDisabled>, "IsAutoSleepDisabled"}, + FunctionInfo{70, nullptr, "ReportMultimediaError"}, + FunctionInfo{71, nullptr, "GetCurrentIlluminanceEx"}, + FunctionInfo{72, D<&ISelfController::SetInputDetectionPolicy>, "SetInputDetectionPolicy"}, + FunctionInfo{80, nullptr, "SetWirelessPriorityMode"}, + FunctionInfo{90, D<&ISelfController::GetAccumulatedSuspendedTickValue>, "GetAccumulatedSuspendedTickValue"}, + FunctionInfo{91, D<&ISelfController::GetAccumulatedSuspendedTickChangedEvent>, "GetAccumulatedSuspendedTickChangedEvent"}, + FunctionInfo{100, D<&ISelfController::SetAlbumImageTakenNotificationEnabled>, "SetAlbumImageTakenNotificationEnabled"}, + FunctionInfo{110, nullptr, "SetApplicationAlbumUserData"}, + FunctionInfo{120, D<&ISelfController::SaveCurrentScreenshot>, "SaveCurrentScreenshot"}, + FunctionInfo{130, D<&ISelfController::SetRecordVolumeMuted>, "SetRecordVolumeMuted"}, + FunctionInfo{230, D<&ISelfController::Unknown230>, "Unknown230"}, + FunctionInfo{240, D<&ISelfController::Unknown240>, "Unknown240"}, + FunctionInfo{1000, nullptr, "GetDebugStorageChannel"} + ); + return HandlerTableGenerateWithFind(key, functions); + } + ISelfController::ISelfController(Core::System& system_, std::shared_ptr applet, Kernel::KProcess* process) : ServiceFramework{system_, "ISelfController"}, m_process{process}, m_applet{ std::move(applet)} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&ISelfController::Exit>, "Exit"}, - {1, D<&ISelfController::LockExit>, "LockExit"}, - {2, D<&ISelfController::UnlockExit>, "UnlockExit"}, - {3, D<&ISelfController::EnterFatalSection>, "EnterFatalSection"}, - {4, D<&ISelfController::LeaveFatalSection>, "LeaveFatalSection"}, - {9, D<&ISelfController::GetLibraryAppletLaunchableEvent>, "GetLibraryAppletLaunchableEvent"}, - {10, D<&ISelfController::SetScreenShotPermission>, "SetScreenShotPermission"}, - {11, D<&ISelfController::SetOperationModeChangedNotification>, "SetOperationModeChangedNotification"}, - {12, D<&ISelfController::SetPerformanceModeChangedNotification>, "SetPerformanceModeChangedNotification"}, - {13, D<&ISelfController::SetFocusHandlingMode>, "SetFocusHandlingMode"}, - {14, D<&ISelfController::SetRestartMessageEnabled>, "SetRestartMessageEnabled"}, - {15, D<&ISelfController::SetScreenShotAppletIdentityInfo>, "SetScreenShotAppletIdentityInfo"}, - {16, D<&ISelfController::SetOutOfFocusSuspendingEnabled>, "SetOutOfFocusSuspendingEnabled"}, - {17, nullptr, "SetControllerFirmwareUpdateSection"}, - {18, nullptr, "SetRequiresCaptureButtonShortPressedMessage"}, - {19, D<&ISelfController::SetAlbumImageOrientation>, "SetAlbumImageOrientation"}, - {20, nullptr, "SetDesirableKeyboardLayout"}, - {21, nullptr, "GetScreenShotProgramId"}, - {40, D<&ISelfController::CreateManagedDisplayLayer>, "CreateManagedDisplayLayer"}, - {41, D<&ISelfController::IsSystemBufferSharingEnabled>, "IsSystemBufferSharingEnabled"}, - {42, D<&ISelfController::GetSystemSharedLayerHandle>, "GetSystemSharedLayerHandle"}, - {43, D<&ISelfController::GetSystemSharedBufferHandle>, "GetSystemSharedBufferHandle"}, - {44, D<&ISelfController::CreateManagedDisplaySeparableLayer>, "CreateManagedDisplaySeparableLayer"}, - {45, nullptr, "SetManagedDisplayLayerSeparationMode"}, - {46, nullptr, "SetRecordingLayerCompositionEnabled"}, - {50, D<&ISelfController::SetHandlesRequestToDisplay>, "SetHandlesRequestToDisplay"}, - {51, D<&ISelfController::ApproveToDisplay>, "ApproveToDisplay"}, - {60, D<&ISelfController::OverrideAutoSleepTimeAndDimmingTime>, "OverrideAutoSleepTimeAndDimmingTime"}, - {61, D<&ISelfController::SetMediaPlaybackState>, "SetMediaPlaybackState"}, - {62, D<&ISelfController::SetIdleTimeDetectionExtension>, "SetIdleTimeDetectionExtension"}, - {63, D<&ISelfController::GetIdleTimeDetectionExtension>, "GetIdleTimeDetectionExtension"}, - {64, nullptr, "SetInputDetectionSourceSet"}, - {65, D<&ISelfController::ReportUserIsActive>, "ReportUserIsActive"}, - {66, nullptr, "GetCurrentIlluminance"}, - {67, D<&ISelfController::IsIlluminanceAvailable>, "IsIlluminanceAvailable"}, - {68, D<&ISelfController::SetAutoSleepDisabled>, "SetAutoSleepDisabled"}, - {69, D<&ISelfController::IsAutoSleepDisabled>, "IsAutoSleepDisabled"}, - {70, nullptr, "ReportMultimediaError"}, - {71, nullptr, "GetCurrentIlluminanceEx"}, - {72, D<&ISelfController::SetInputDetectionPolicy>, "SetInputDetectionPolicy"}, - {80, nullptr, "SetWirelessPriorityMode"}, - {90, D<&ISelfController::GetAccumulatedSuspendedTickValue>, "GetAccumulatedSuspendedTickValue"}, - {91, D<&ISelfController::GetAccumulatedSuspendedTickChangedEvent>, "GetAccumulatedSuspendedTickChangedEvent"}, - {100, D<&ISelfController::SetAlbumImageTakenNotificationEnabled>, "SetAlbumImageTakenNotificationEnabled"}, - {110, nullptr, "SetApplicationAlbumUserData"}, - {120, D<&ISelfController::SaveCurrentScreenshot>, "SaveCurrentScreenshot"}, - {130, D<&ISelfController::SetRecordVolumeMuted>, "SetRecordVolumeMuted"}, - {230, D<&ISelfController::Unknown230>, "Unknown230"}, - {240, D<&ISelfController::Unknown240>, "Unknown240"}, - {1000, nullptr, "GetDebugStorageChannel"}, - }; - // clang-format on - - RegisterHandlers(functions); - std::scoped_lock lk{m_applet->lock}; m_applet->display_layer_manager.Initialize(system, m_process, m_applet->applet_id, m_applet->library_applet_mode); diff --git a/src/core/hle/service/am/service/self_controller.h b/src/core/hle/service/am/service/self_controller.h index c9f480f575..ce77769da2 100644 --- a/src/core/hle/service/am/service/self_controller.h +++ b/src/core/hle/service/am/service/self_controller.h @@ -70,6 +70,7 @@ private: Result Unknown230(u32 in_val, Out out_val); Result Unknown240(u32 in_val); + std::optional FindRequest(u32 key) override; Kernel::KProcess* const m_process; const std::shared_ptr m_applet; }; diff --git a/src/core/hle/service/am/service/storage.cpp b/src/core/hle/service/am/service/storage.cpp index 5fe191bf2f..110a9f5a42 100644 --- a/src/core/hle/service/am/service/storage.cpp +++ b/src/core/hle/service/am/service/storage.cpp @@ -4,22 +4,86 @@ // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include "core/hle/kernel/k_transfer_memory.h" #include "core/hle/service/am/am_results.h" #include "core/hle/service/am/library_applet_storage.h" #include "core/hle/service/am/service/storage.h" -#include "core/hle/service/am/service/storage_accessor.h" #include "core/hle/service/cmif_serialization.h" namespace Service::AM { +class IStorageAccessor final : public ServiceFramework { +public: + explicit IStorageAccessor(Core::System& system_, std::shared_ptr impl) : ServiceFramework{system_, "IStorageAccessor"}, m_impl{std::move(impl)} {} + ~IStorageAccessor() override = default; + + Result GetSize(Out out_size) { + LOG_DEBUG(Service_AM, "called"); + *out_size = m_impl->GetSize(); + R_SUCCEED(); + } + + Result Write(InBuffer buffer, s64 offset) { + LOG_DEBUG(Service_AM, "called, offset={} size={}", offset, buffer.size()); + R_RETURN(m_impl->Write(offset, buffer.data(), buffer.size())); + } + + Result Read(OutBuffer out_buffer, s64 offset) { + LOG_DEBUG(Service_AM, "called, offset={} size={}", offset, out_buffer.size()); + R_RETURN(m_impl->Read(offset, out_buffer.data(), out_buffer.size())); + } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IStorageAccessor::GetSize>, "GetSize"}, + FunctionInfo{10, D<&IStorageAccessor::Write>, "Write"}, + FunctionInfo{11, D<&IStorageAccessor::Read>, "Read"} + ); + + const std::shared_ptr m_impl; +}; + +class ITransferStorageAccessor final : public ServiceFramework { +public: + explicit ITransferStorageAccessor(Core::System& system_, std::shared_ptr impl) : ServiceFramework{system_, "ITransferStorageAccessor"}, m_impl{std::move(impl)} {} + ~ITransferStorageAccessor() override = default; + + Result GetSize(Out out_size) { + LOG_DEBUG(Service_AM, "called"); + *out_size = m_impl->GetSize(); + R_SUCCEED(); + } + + Result GetHandle(Out out_size, OutCopyHandle out_handle) { + LOG_INFO(Service_AM, "called"); + *out_size = m_impl->GetSize(); + *out_handle = m_impl->GetHandle(); + R_SUCCEED(); + } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&ITransferStorageAccessor::GetSize>, "GetSize"}, + FunctionInfo{1, D<&ITransferStorageAccessor::GetHandle>, "GetHandle"} + ); + + const std::shared_ptr m_impl; +}; + +std::optional IStorage::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IStorage::Open>, "Open"}, + FunctionInfo{1, D<&IStorage::OpenTransferStorage>, "OpenTransferStorage"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IStorage::IStorage(Core::System& system_, std::shared_ptr impl) : ServiceFramework{system_, "IStorage"}, m_impl{std::move(impl)} { - static const FunctionInfo functions[] = { - {0, D<&IStorage::Open>, "Open"}, - {1, D<&IStorage::OpenTransferStorage>, "OpenTransferStorage"}, - }; - - RegisterHandlers(functions); } IStorage::IStorage(Core::System& system_, std::vector&& data) diff --git a/src/core/hle/service/am/service/storage.h b/src/core/hle/service/am/service/storage.h index cde2ed0ead..63b7a0ad4c 100644 --- a/src/core/hle/service/am/service/storage.h +++ b/src/core/hle/service/am/service/storage.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -29,6 +32,7 @@ private: Result OpenTransferStorage( Out> out_transfer_storage_accessor); + std::optional FindRequest(u32 key) override; const std::shared_ptr m_impl; }; diff --git a/src/core/hle/service/am/service/storage_accessor.cpp b/src/core/hle/service/am/service/storage_accessor.cpp deleted file mode 100644 index 84577fee45..0000000000 --- a/src/core/hle/service/am/service/storage_accessor.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/hle/kernel/k_transfer_memory.h" -#include "core/hle/service/am/library_applet_storage.h" -#include "core/hle/service/am/service/storage_accessor.h" -#include "core/hle/service/cmif_serialization.h" - -namespace Service::AM { - -IStorageAccessor::IStorageAccessor(Core::System& system_, - std::shared_ptr impl) - : ServiceFramework{system_, "IStorageAccessor"}, m_impl{std::move(impl)} { - static const FunctionInfo functions[] = { - {0, D<&IStorageAccessor::GetSize>, "GetSize"}, - {10, D<&IStorageAccessor::Write>, "Write"}, - {11, D<&IStorageAccessor::Read>, "Read"}, - }; - - RegisterHandlers(functions); -} - -IStorageAccessor::~IStorageAccessor() = default; - -Result IStorageAccessor::GetSize(Out out_size) { - LOG_DEBUG(Service_AM, "called"); - *out_size = m_impl->GetSize(); - R_SUCCEED(); -} - -Result IStorageAccessor::Write(InBuffer buffer, s64 offset) { - LOG_DEBUG(Service_AM, "called, offset={} size={}", offset, buffer.size()); - R_RETURN(m_impl->Write(offset, buffer.data(), buffer.size())); -} - -Result IStorageAccessor::Read(OutBuffer out_buffer, s64 offset) { - LOG_DEBUG(Service_AM, "called, offset={} size={}", offset, out_buffer.size()); - R_RETURN(m_impl->Read(offset, out_buffer.data(), out_buffer.size())); -} - -ITransferStorageAccessor::ITransferStorageAccessor(Core::System& system_, - std::shared_ptr impl) - : ServiceFramework{system_, "ITransferStorageAccessor"}, m_impl{std::move(impl)} { - static const FunctionInfo functions[] = { - {0, D<&ITransferStorageAccessor::GetSize>, "GetSize"}, - {1, D<&ITransferStorageAccessor::GetHandle>, "GetHandle"}, - }; - - RegisterHandlers(functions); -} - -ITransferStorageAccessor::~ITransferStorageAccessor() = default; - -Result ITransferStorageAccessor::GetSize(Out out_size) { - LOG_DEBUG(Service_AM, "called"); - *out_size = m_impl->GetSize(); - R_SUCCEED(); -} - -Result ITransferStorageAccessor::GetHandle(Out out_size, - OutCopyHandle out_handle) { - LOG_INFO(Service_AM, "called"); - *out_size = m_impl->GetSize(); - *out_handle = m_impl->GetHandle(); - R_SUCCEED(); -} - -} // namespace Service::AM diff --git a/src/core/hle/service/am/service/storage_accessor.h b/src/core/hle/service/am/service/storage_accessor.h deleted file mode 100644 index 1a01730e00..0000000000 --- a/src/core/hle/service/am/service/storage_accessor.h +++ /dev/null @@ -1,38 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/am/library_applet_storage.h" -#include "core/hle/service/cmif_types.h" -#include "core/hle/service/service.h" - -namespace Service::AM { - -class IStorageAccessor final : public ServiceFramework { -public: - explicit IStorageAccessor(Core::System& system_, std::shared_ptr impl); - ~IStorageAccessor() override; - -private: - Result GetSize(Out out_size); - Result Write(InBuffer buffer, s64 offset); - Result Read(OutBuffer out_buffer, s64 offset); - - const std::shared_ptr m_impl; -}; - -class ITransferStorageAccessor final : public ServiceFramework { -public: - explicit ITransferStorageAccessor(Core::System& system_, - std::shared_ptr impl); - ~ITransferStorageAccessor() override; - -private: - Result GetSize(Out out_size); - Result GetHandle(Out out_size, OutCopyHandle out_handle); - - const std::shared_ptr m_impl; -}; - -} // namespace Service::AM diff --git a/src/core/hle/service/am/service/system_applet_proxy.cpp b/src/core/hle/service/am/service/system_applet_proxy.cpp deleted file mode 100644 index c435288a26..0000000000 --- a/src/core/hle/service/am/service/system_applet_proxy.cpp +++ /dev/null @@ -1,133 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/hle/service/am/service/applet_common_functions.h" -#include "core/hle/service/am/service/application_creator.h" -#include "core/hle/service/am/service/audio_controller.h" -#include "core/hle/service/am/service/common_state_getter.h" -#include "core/hle/service/am/service/debug_functions.h" -#include "core/hle/service/am/service/display_controller.h" -#include "core/hle/service/am/service/global_state_controller.h" -#include "core/hle/service/am/service/home_menu_functions.h" -#include "core/hle/service/am/service/library_applet_creator.h" -#include "core/hle/service/am/service/process_winding_controller.h" -#include "core/hle/service/am/service/self_controller.h" -#include "core/hle/service/am/service/system_applet_proxy.h" -#include "core/hle/service/am/service/window_controller.h" -#include "core/hle/service/cmif_serialization.h" - -namespace Service::AM { - -ISystemAppletProxy::ISystemAppletProxy(Core::System& system_, std::shared_ptr applet, - Kernel::KProcess* process, WindowSystem& window_system) - : ServiceFramework{system_, "ISystemAppletProxy"}, - m_window_system{window_system}, m_process{process}, m_applet{std::move(applet)} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&ISystemAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"}, - {1, D<&ISystemAppletProxy::GetSelfController>, "GetSelfController"}, - {2, D<&ISystemAppletProxy::GetWindowController>, "GetWindowController"}, - {3, D<&ISystemAppletProxy::GetAudioController>, "GetAudioController"}, - {4, D<&ISystemAppletProxy::GetDisplayController>, "GetDisplayController"}, - {10, D<&ISystemAppletProxy::GetProcessWindingController>, "GetProcessWindingController"}, - {11, D<&ISystemAppletProxy::GetLibraryAppletCreator>, "GetLibraryAppletCreator"}, - {20, D<&ISystemAppletProxy::GetHomeMenuFunctions>, "GetHomeMenuFunctions"}, - {21, D<&ISystemAppletProxy::GetGlobalStateController>, "GetGlobalStateController"}, - {22, D<&ISystemAppletProxy::GetApplicationCreator>, "GetApplicationCreator"}, - {23, D<&ISystemAppletProxy::GetAppletCommonFunctions>, "GetAppletCommonFunctions"}, - {1000, D<&ISystemAppletProxy::GetDebugFunctions>, "GetDebugFunctions"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - -ISystemAppletProxy::~ISystemAppletProxy() = default; - -Result ISystemAppletProxy::GetAudioController( - Out> out_audio_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_audio_controller = std::make_shared(system); - R_SUCCEED(); -} - -Result ISystemAppletProxy::GetDisplayController( - Out> out_display_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_display_controller = std::make_shared(system, m_applet); - R_SUCCEED(); -} - -Result ISystemAppletProxy::GetProcessWindingController( - Out> out_process_winding_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_process_winding_controller = std::make_shared(system, m_applet); - R_SUCCEED(); -} - -Result ISystemAppletProxy::GetDebugFunctions( - Out> out_debug_functions) { - LOG_DEBUG(Service_AM, "called"); - *out_debug_functions = std::make_shared(system); - R_SUCCEED(); -} - -Result ISystemAppletProxy::GetWindowController( - Out> out_window_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_window_controller = std::make_shared(system, m_applet, m_window_system); - R_SUCCEED(); -} - -Result ISystemAppletProxy::GetSelfController( - Out> out_self_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_self_controller = std::make_shared(system, m_applet, m_process); - R_SUCCEED(); -} - -Result ISystemAppletProxy::GetCommonStateGetter( - Out> out_common_state_getter) { - LOG_DEBUG(Service_AM, "called"); - *out_common_state_getter = std::make_shared(system, m_applet); - R_SUCCEED(); -} - -Result ISystemAppletProxy::GetLibraryAppletCreator( - Out> out_library_applet_creator) { - LOG_DEBUG(Service_AM, "called"); - *out_library_applet_creator = - std::make_shared(system, m_applet, m_window_system); - R_SUCCEED(); -} - -Result ISystemAppletProxy::GetApplicationCreator( - Out> out_application_creator) { - LOG_DEBUG(Service_AM, "called"); - *out_application_creator = std::make_shared(system, m_window_system); - R_SUCCEED(); -} - -Result ISystemAppletProxy::GetAppletCommonFunctions( - Out> out_applet_common_functions) { - LOG_DEBUG(Service_AM, "called"); - *out_applet_common_functions = std::make_shared(system, m_applet); - R_SUCCEED(); -} - -Result ISystemAppletProxy::GetHomeMenuFunctions( - Out> out_home_menu_functions) { - LOG_DEBUG(Service_AM, "called"); - *out_home_menu_functions = - std::make_shared(system, m_applet, m_window_system); - R_SUCCEED(); -} - -Result ISystemAppletProxy::GetGlobalStateController( - Out> out_global_state_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_global_state_controller = std::make_shared(system); - R_SUCCEED(); -} - -} // namespace Service::AM diff --git a/src/core/hle/service/am/service/system_applet_proxy.h b/src/core/hle/service/am/service/system_applet_proxy.h deleted file mode 100644 index ab9769b3d9..0000000000 --- a/src/core/hle/service/am/service/system_applet_proxy.h +++ /dev/null @@ -1,58 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/cmif_types.h" -#include "core/hle/service/service.h" - -namespace Service::AM { - -struct Applet; -class IAppletCommonFunctions; -class IApplicationCreator; -class IAudioController; -class ICommonStateGetter; -class IDebugFunctions; -class IDisplayController; -class IHomeMenuFunctions; -class IGlobalStateController; -class ILibraryAppletCreator; -class IProcessWindingController; -class ISelfController; -class IWindowController; -class WindowSystem; - -class ISystemAppletProxy final : public ServiceFramework { -public: - explicit ISystemAppletProxy(Core::System& system, std::shared_ptr applet, - Kernel::KProcess* process, WindowSystem& window_system); - ~ISystemAppletProxy(); - -private: - Result GetCommonStateGetter(Out> out_common_state_getter); - Result GetSelfController(Out> out_self_controller); - Result GetWindowController(Out> out_window_controller); - Result GetAudioController(Out> out_audio_controller); - Result GetDisplayController(Out> out_display_controller); - Result GetProcessWindingController( - Out> out_process_winding_controller); - Result GetDebugFunctions(Out> out_debug_functions); - Result GetLibraryAppletCreator( - Out> out_library_applet_creator); - Result GetApplicationCreator(Out> out_application_creator); - Result GetAppletCommonFunctions( - Out> out_applet_common_functions); - Result GetHomeMenuFunctions(Out> out_home_menu_functions); - Result GetGlobalStateController( - Out> out_global_state_controller); - - WindowSystem& m_window_system; - Kernel::KProcess* const m_process; - const std::shared_ptr m_applet; -}; - -} // namespace Service::AM diff --git a/src/core/hle/service/am/service/window_controller.cpp b/src/core/hle/service/am/service/window_controller.cpp index 54396affbe..d07aba0c79 100644 --- a/src/core/hle/service/am/service/window_controller.cpp +++ b/src/core/hle/service/am/service/window_controller.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -9,24 +12,24 @@ namespace Service::AM { +std::optional IWindowController::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "CreateWindow"}, + FunctionInfo{1, D<&IWindowController::GetAppletResourceUserId>, "GetAppletResourceUserId"}, + FunctionInfo{2, D<&IWindowController::GetAppletResourceUserIdOfCallerApplet>, "GetAppletResourceUserIdOfCallerApplet"}, + FunctionInfo{10, D<&IWindowController::AcquireForegroundRights>, "AcquireForegroundRights"}, + FunctionInfo{11, D<&IWindowController::ReleaseForegroundRights>, "ReleaseForegroundRights"}, + FunctionInfo{12, D<&IWindowController::RejectToChangeIntoBackground>, "RejectToChangeIntoBackground"}, + FunctionInfo{20, D<&IWindowController::SetAppletWindowVisibility>, "SetAppletWindowVisibility"}, + FunctionInfo{21, D<&IWindowController::SetAppletGpuTimeSlice>, "SetAppletGpuTimeSlice"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IWindowController::IWindowController(Core::System& system_, std::shared_ptr applet, WindowSystem& window_system) : ServiceFramework{system_, "IWindowController"}, m_window_system{window_system}, m_applet{std::move(applet)} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "CreateWindow"}, - {1, D<&IWindowController::GetAppletResourceUserId>, "GetAppletResourceUserId"}, - {2, D<&IWindowController::GetAppletResourceUserIdOfCallerApplet>, "GetAppletResourceUserIdOfCallerApplet"}, - {10, D<&IWindowController::AcquireForegroundRights>, "AcquireForegroundRights"}, - {11, D<&IWindowController::ReleaseForegroundRights>, "ReleaseForegroundRights"}, - {12, D<&IWindowController::RejectToChangeIntoBackground>, "RejectToChangeIntoBackground"}, - {20, D<&IWindowController::SetAppletWindowVisibility>, "SetAppletWindowVisibility"}, - {21, D<&IWindowController::SetAppletGpuTimeSlice>, "SetAppletGpuTimeSlice"}, - }; - // clang-format on - - RegisterHandlers(functions); } IWindowController::~IWindowController() = default; diff --git a/src/core/hle/service/am/service/window_controller.h b/src/core/hle/service/am/service/window_controller.h index a784dd4a49..29fd723421 100644 --- a/src/core/hle/service/am/service/window_controller.h +++ b/src/core/hle/service/am/service/window_controller.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -26,6 +29,7 @@ private: Result SetAppletWindowVisibility(bool visible); Result SetAppletGpuTimeSlice(s64 time_slice); + std::optional FindRequest(u32 key) override; WindowSystem& m_window_system; const std::shared_ptr m_applet; }; diff --git a/src/core/hle/service/aoc/addon_content_manager.cpp b/src/core/hle/service/aoc/addon_content_manager.cpp index be2aa34baa..0222d9c52b 100644 --- a/src/core/hle/service/aoc/addon_content_manager.cpp +++ b/src/core/hle/service/aoc/addon_content_manager.cpp @@ -28,6 +28,34 @@ namespace Service::AOC { +std::optional IAddOnContentManager::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "CountAddOnContentByApplicationId"}, + FunctionInfo{1, nullptr, "ListAddOnContentByApplicationId"}, + FunctionInfo{2, D<&IAddOnContentManager::CountAddOnContent>, "CountAddOnContent"}, + FunctionInfo{3, D<&IAddOnContentManager::ListAddOnContent>, "ListAddOnContent"}, + FunctionInfo{4, nullptr, "GetAddOnContentBaseIdByApplicationId"}, + FunctionInfo{5, D<&IAddOnContentManager::GetAddOnContentBaseId>, "GetAddOnContentBaseId"}, + FunctionInfo{6, nullptr, "PrepareAddOnContentByApplicationId"}, + FunctionInfo{7, D<&IAddOnContentManager::PrepareAddOnContent>, "PrepareAddOnContent"}, + FunctionInfo{8, D<&IAddOnContentManager::GetAddOnContentListChangedEvent>, "GetAddOnContentListChangedEvent"}, + FunctionInfo{9, nullptr, "GetAddOnContentLostErrorCode"}, + FunctionInfo{10, D<&IAddOnContentManager::GetAddOnContentListChangedEventWithProcessId>, "GetAddOnContentListChangedEventWithProcessId"}, + FunctionInfo{11, D<&IAddOnContentManager::NotifyMountAddOnContent>, "NotifyMountAddOnContent"}, + FunctionInfo{12, D<&IAddOnContentManager::NotifyUnmountAddOnContent>, "NotifyUnmountAddOnContent"}, + FunctionInfo{13, nullptr, "IsAddOnContentMountedForDebug"}, + FunctionInfo{50, D<&IAddOnContentManager::CheckAddOnContentMountStatus>, "CheckAddOnContentMountStatus"}, + FunctionInfo{100, D<&IAddOnContentManager::CreateEcPurchasedEventManager>, "CreateEcPurchasedEventManager"}, + FunctionInfo{101, D<&IAddOnContentManager::CreatePermanentEcPurchasedEventManager>, "CreatePermanentEcPurchasedEventManager"}, + FunctionInfo{110, nullptr, "CreateContentsServiceManager"}, + FunctionInfo{200, nullptr, "SetRequiredAddOnContentsOnContentsAvailabilityTransition"}, + FunctionInfo{300, nullptr, "SetupHostAddOnContent"}, + FunctionInfo{301, nullptr, "GetRegisteredAddOnContentPath"}, + FunctionInfo{302, nullptr, "UpdateCachedList"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + static bool CheckAOCTitleIDMatchesBase(u64 title_id, u64 base) { return FileSys::GetBaseTitleID(title_id) == base; } @@ -57,35 +85,6 @@ static std::vector AccumulateAOCTitleIDs(Core::System& system) { IAddOnContentManager::IAddOnContentManager(Core::System& system_) : ServiceFramework{system_, "aoc:u"}, add_on_content{AccumulateAOCTitleIDs(system)}, service_context{system_, "aoc:u"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "CountAddOnContentByApplicationId"}, - {1, nullptr, "ListAddOnContentByApplicationId"}, - {2, D<&IAddOnContentManager::CountAddOnContent>, "CountAddOnContent"}, - {3, D<&IAddOnContentManager::ListAddOnContent>, "ListAddOnContent"}, - {4, nullptr, "GetAddOnContentBaseIdByApplicationId"}, - {5, D<&IAddOnContentManager::GetAddOnContentBaseId>, "GetAddOnContentBaseId"}, - {6, nullptr, "PrepareAddOnContentByApplicationId"}, - {7, D<&IAddOnContentManager::PrepareAddOnContent>, "PrepareAddOnContent"}, - {8, D<&IAddOnContentManager::GetAddOnContentListChangedEvent>, "GetAddOnContentListChangedEvent"}, - {9, nullptr, "GetAddOnContentLostErrorCode"}, - {10, D<&IAddOnContentManager::GetAddOnContentListChangedEventWithProcessId>, "GetAddOnContentListChangedEventWithProcessId"}, - {11, D<&IAddOnContentManager::NotifyMountAddOnContent>, "NotifyMountAddOnContent"}, - {12, D<&IAddOnContentManager::NotifyUnmountAddOnContent>, "NotifyUnmountAddOnContent"}, - {13, nullptr, "IsAddOnContentMountedForDebug"}, - {50, D<&IAddOnContentManager::CheckAddOnContentMountStatus>, "CheckAddOnContentMountStatus"}, - {100, D<&IAddOnContentManager::CreateEcPurchasedEventManager>, "CreateEcPurchasedEventManager"}, - {101, D<&IAddOnContentManager::CreatePermanentEcPurchasedEventManager>, "CreatePermanentEcPurchasedEventManager"}, - {110, nullptr, "CreateContentsServiceManager"}, - {200, nullptr, "SetRequiredAddOnContentsOnContentsAvailabilityTransition"}, - {300, nullptr, "SetupHostAddOnContent"}, - {301, nullptr, "GetRegisteredAddOnContentPath"}, - {302, nullptr, "UpdateCachedList"}, - }; - // clang-format on - - RegisterHandlers(functions); - aoc_change_event = service_context.CreateEvent("GetAddOnContentListChanged:Event"); } diff --git a/src/core/hle/service/aoc/addon_content_manager.h b/src/core/hle/service/aoc/addon_content_manager.h index 91857df4c7..8ddb86cf19 100644 --- a/src/core/hle/service/aoc/addon_content_manager.h +++ b/src/core/hle/service/aoc/addon_content_manager.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -40,9 +43,9 @@ public: OutInterface out_interface); private: + std::optional FindRequest(u32 key) override; std::vector add_on_content; KernelHelpers::ServiceContext service_context; - Kernel::KEvent* aoc_change_event; }; diff --git a/src/core/hle/service/aoc/purchase_event_manager.cpp b/src/core/hle/service/aoc/purchase_event_manager.cpp index 9e718510b4..eded803b25 100644 --- a/src/core/hle/service/aoc/purchase_event_manager.cpp +++ b/src/core/hle/service/aoc/purchase_event_manager.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -8,21 +11,20 @@ namespace Service::AOC { constexpr Result ResultNoPurchasedProductInfoAvailable{ErrorModule::NIMShop, 400}; +std::optional IPurchaseEventManager::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IPurchaseEventManager::SetDefaultDeliveryTarget>, "SetDefaultDeliveryTarget"}, + FunctionInfo{1, D<&IPurchaseEventManager::SetDeliveryTarget>, "SetDeliveryTarget"}, + FunctionInfo{2, D<&IPurchaseEventManager::GetPurchasedEvent>, "GetPurchasedEvent"}, + FunctionInfo{3, D<&IPurchaseEventManager::PopPurchasedProductInfo>, "PopPurchasedProductInfo"}, + FunctionInfo{4, D<&IPurchaseEventManager::PopPurchasedProductInfoWithUid>, "PopPurchasedProductInfoWithUid"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IPurchaseEventManager::IPurchaseEventManager(Core::System& system_) - : ServiceFramework{system_, "IPurchaseEventManager"}, service_context{system, - "IPurchaseEventManager"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IPurchaseEventManager::SetDefaultDeliveryTarget>, "SetDefaultDeliveryTarget"}, - {1, D<&IPurchaseEventManager::SetDeliveryTarget>, "SetDeliveryTarget"}, - {2, D<&IPurchaseEventManager::GetPurchasedEvent>, "GetPurchasedEvent"}, - {3, D<&IPurchaseEventManager::PopPurchasedProductInfo>, "PopPurchasedProductInfo"}, - {4, D<&IPurchaseEventManager::PopPurchasedProductInfoWithUid>, "PopPurchasedProductInfoWithUid"}, - }; - // clang-format on - - RegisterHandlers(functions); - + : ServiceFramework{system_, "IPurchaseEventManager"} + , service_context{system, "IPurchaseEventManager"} { purchased_event = service_context.CreateEvent("IPurchaseEventManager:PurchasedEvent"); } diff --git a/src/core/hle/service/aoc/purchase_event_manager.h b/src/core/hle/service/aoc/purchase_event_manager.h index ea3836bc93..d11089e567 100644 --- a/src/core/hle/service/aoc/purchase_event_manager.h +++ b/src/core/hle/service/aoc/purchase_event_manager.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -22,6 +25,8 @@ public: Result PopPurchasedProductInfo(); Result PopPurchasedProductInfoWithUid(); + std::optional FindRequest(u32 key) override; + private: KernelHelpers::ServiceContext service_context; Kernel::KEvent* purchased_event; diff --git a/src/core/hle/service/apm/apm_interface.cpp b/src/core/hle/service/apm/apm_interface.cpp index 51c01e2f25..2b4768478e 100644 --- a/src/core/hle/service/apm/apm_interface.cpp +++ b/src/core/hle/service/apm/apm_interface.cpp @@ -14,15 +14,7 @@ namespace Service::APM { class ISession final : public ServiceFramework { public: - explicit ISession(Core::System& system_, Controller& controller_) - : ServiceFramework{system_, "ISession"}, controller{controller_} { - static const FunctionInfo functions[] = { - {0, &ISession::SetPerformanceConfiguration, "SetPerformanceConfiguration"}, - {1, &ISession::GetPerformanceConfiguration, "GetPerformanceConfiguration"}, - {2, &ISession::SetCpuOverclockEnabled, "SetCpuOverclockEnabled"}, - }; - RegisterHandlers(functions); - } + explicit ISession(Core::System& system_, Controller& controller_) : ServiceFramework{system_, "ISession"}, controller{controller_} {} private: void SetPerformanceConfiguration(HLERequestContext& ctx) { @@ -61,18 +53,20 @@ private: rb.Push(ResultSuccess); } + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &ISession::SetPerformanceConfiguration, "SetPerformanceConfiguration"}, + FunctionInfo{1, &ISession::GetPerformanceConfiguration, "GetPerformanceConfiguration"}, + FunctionInfo{2, &ISession::SetCpuOverclockEnabled, "SetCpuOverclockEnabled"} + ); Controller& controller; }; APM::APM(Core::System& system_, std::shared_ptr apm_, Controller& controller_, const char* name) : ServiceFramework{system_, name}, apm(std::move(apm_)), controller{controller_} { - static const FunctionInfo functions[] = { - {0, &APM::OpenSession, "OpenSession"}, - {1, &APM::GetPerformanceMode, "GetPerformanceMode"}, - {6, &APM::IsCpuOverclockEnabled, "IsCpuOverclockEnabled"}, - }; - RegisterHandlers(functions); } APM::~APM() = default; @@ -102,20 +96,6 @@ void APM::IsCpuOverclockEnabled(HLERequestContext& ctx) { APM_Sys::APM_Sys(Core::System& system_, Controller& controller_) : ServiceFramework{system_, "apm:sys"}, controller{controller_} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "RequestPerformanceMode"}, - {1, &APM_Sys::GetPerformanceEvent, "GetPerformanceEvent"}, - {2, nullptr, "GetThrottlingState"}, - {3, nullptr, "GetLastThrottlingState"}, - {4, nullptr, "ClearLastThrottlingState"}, - {5, nullptr, "LoadAndApplySettings"}, - {6, &APM_Sys::SetCpuBoostMode, "SetCpuBoostMode"}, - {7, &APM_Sys::GetCurrentPerformanceConfiguration, "GetCurrentPerformanceConfiguration"}, - }; - // clang-format on - - RegisterHandlers(functions); } APM_Sys::~APM_Sys() = default; diff --git a/src/core/hle/service/apm/apm_interface.h b/src/core/hle/service/apm/apm_interface.h index 58718453b6..0bbcd185a3 100644 --- a/src/core/hle/service/apm/apm_interface.h +++ b/src/core/hle/service/apm/apm_interface.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -21,6 +24,14 @@ private: void GetPerformanceMode(HLERequestContext& ctx); void IsCpuOverclockEnabled(HLERequestContext& ctx); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &APM::OpenSession, "OpenSession"}, + FunctionInfo{1, &APM::GetPerformanceMode, "GetPerformanceMode"}, + FunctionInfo{6, &APM::IsCpuOverclockEnabled, "IsCpuOverclockEnabled"} + ); std::shared_ptr apm; Controller& controller; }; @@ -36,6 +47,19 @@ private: void GetPerformanceEvent(HLERequestContext& ctx); void GetCurrentPerformanceConfiguration(HLERequestContext& ctx); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "RequestPerformanceMode"}, + FunctionInfo{1, &APM_Sys::GetPerformanceEvent, "GetPerformanceEvent"}, + FunctionInfo{2, nullptr, "GetThrottlingState"}, + FunctionInfo{3, nullptr, "GetLastThrottlingState"}, + FunctionInfo{4, nullptr, "ClearLastThrottlingState"}, + FunctionInfo{5, nullptr, "LoadAndApplySettings"}, + FunctionInfo{6, &APM_Sys::SetCpuBoostMode, "SetCpuBoostMode"}, + FunctionInfo{7, &APM_Sys::GetCurrentPerformanceConfiguration, "GetCurrentPerformanceConfiguration"} + ); Controller& controller; }; diff --git a/src/core/hle/service/audio/audio.cpp b/src/core/hle/service/audio/audio.cpp index fde766a275..6177efd46c 100644 --- a/src/core/hle/service/audio/audio.cpp +++ b/src/core/hle/service/audio/audio.cpp @@ -21,164 +21,164 @@ namespace Service::Audio { class IAudioOutManagerForApplet final : public ServiceFramework { public: explicit IAudioOutManagerForApplet(Core::System& system_) - : ServiceFramework{system_, "audout:a"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "RequestSuspend"}, - {1, nullptr, "RequestResume"}, - {2, nullptr, "GetProcessMasterVolume"}, - {3, nullptr, "SetProcessMasterVolume"}, - {4, nullptr, "GetProcessRecordVolume"}, - {5, nullptr, "SetProcessRecordVolume"}, - }; - // clang-format on - RegisterHandlers(functions); + : ServiceFramework{system_, "audout:a"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "RequestSuspend"}, + FunctionInfo{1, nullptr, "RequestResume"}, + FunctionInfo{2, nullptr, "GetProcessMasterVolume"}, + FunctionInfo{3, nullptr, "SetProcessMasterVolume"}, + FunctionInfo{4, nullptr, "GetProcessRecordVolume"}, + FunctionInfo{5, nullptr, "SetProcessRecordVolume"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class IAudioSnoopManager final : public ServiceFramework { public: explicit IAudioSnoopManager(Core::System& system_) - : ServiceFramework{system_, "auddev"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetDspStatistics"}, - {1, nullptr, "GetAppletStateSummaries"}, - {2, nullptr, "SetDspStatisticsParameter"}, - {3, nullptr, "GetDspStatisticsParameter"}, - {6, nullptr, "GetDspUsage"}, - }; - // clang-format on - RegisterHandlers(functions); + : ServiceFramework{system_, "auddev"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetDspStatistics"}, + FunctionInfo{1, nullptr, "GetAppletStateSummaries"}, + FunctionInfo{2, nullptr, "SetDspStatisticsParameter"}, + FunctionInfo{3, nullptr, "GetDspStatisticsParameter"}, + FunctionInfo{6, nullptr, "GetDspUsage"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class IAudioInManagerForApplet final : public ServiceFramework { public: explicit IAudioInManagerForApplet(Core::System& system_) - : ServiceFramework{system_, "audin:a"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "RequestSuspend"}, - {1, nullptr, "RequestResume"}, - {2, nullptr, "GetProcessMasterVolume"}, - {3, nullptr, "SetProcessMasterVolume"}, - }; - // clang-format on - RegisterHandlers(functions); + : ServiceFramework{system_, "audin:a"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "RequestSuspend"}, + FunctionInfo{1, nullptr, "RequestResume"}, + FunctionInfo{2, nullptr, "GetProcessMasterVolume"}, + FunctionInfo{3, nullptr, "SetProcessMasterVolume"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class IAudioRendererManagerForApplet final : public ServiceFramework { public: explicit IAudioRendererManagerForApplet(Core::System& system_) - : ServiceFramework{system_, "audren:a"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "RequestSuspend"}, - {1, nullptr, "RequestResume"}, - {2, nullptr, "GetProcessMasterVolume"}, - {3, nullptr, "SetProcessMasterVolume"}, - {4, nullptr, "RegisterAppletResourceUserId"}, - {5, nullptr, "UnregisterAppletResourceUserId"}, - {6, nullptr, "GetProcessRecordVolume"}, - {7, nullptr, "SetProcessRecordVolume"}, - }; - // clang-format on - RegisterHandlers(functions); + : ServiceFramework{system_, "audren:a"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "RequestSuspend"}, + FunctionInfo{1, nullptr, "RequestResume"}, + FunctionInfo{2, nullptr, "GetProcessMasterVolume"}, + FunctionInfo{3, nullptr, "SetProcessMasterVolume"}, + FunctionInfo{4, nullptr, "RegisterAppletResourceUserId"}, + FunctionInfo{5, nullptr, "UnregisterAppletResourceUserId"}, + FunctionInfo{6, nullptr, "GetProcessRecordVolume"}, + FunctionInfo{7, nullptr, "SetProcessRecordVolume"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class IAudioOutManagerForDebugger final : public ServiceFramework { public: explicit IAudioOutManagerForDebugger(Core::System& system_) - : ServiceFramework{system_, "audout:d"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "RequestSuspend"}, - {1, nullptr, "RequestResume"}, - }; - // clang-format on - RegisterHandlers(functions); + : ServiceFramework{system_, "audout:d"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "RequestSuspend"}, + FunctionInfo{1, nullptr, "RequestResume"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class IAudioInManagerForDebugger final : public ServiceFramework { public: explicit IAudioInManagerForDebugger(Core::System& system_) - : ServiceFramework{system_, "audin:d"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "RequestSuspend"}, - {1, nullptr, "RequestResume"}, - }; - // clang-format on - RegisterHandlers(functions); + : ServiceFramework{system_, "audin:d"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "RequestSuspend"}, + FunctionInfo{1, nullptr, "RequestResume"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class IFinalOutputRecorderManagerForDebugger final : public ServiceFramework { public: explicit IFinalOutputRecorderManagerForDebugger(Core::System& system_) - : ServiceFramework{system_, "audrec:d"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "RequestSuspend"}, - {1, nullptr, "RequestResume"}, - }; - // clang-format on - RegisterHandlers(functions); + : ServiceFramework{system_, "audrec:d"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "RequestSuspend"}, + FunctionInfo{1, nullptr, "RequestResume"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class IAudioRendererManagerForDebugger final : public ServiceFramework { public: explicit IAudioRendererManagerForDebugger(Core::System& system_) - : ServiceFramework{system_, "audren:d"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "RequestSuspend"}, - {1, nullptr, "RequestResume"}, - }; - // clang-format on - RegisterHandlers(functions); + : ServiceFramework{system_, "audren:d"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "RequestSuspend"}, + FunctionInfo{1, nullptr, "RequestResume"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class IAudioSystemManagerForApplet final : public ServiceFramework { public: explicit IAudioSystemManagerForApplet(Core::System& system_) - : ServiceFramework{system_, "aud:a"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "RegisterAppletResourceUserId"}, - {1, nullptr, "UnregisterAppletResourceUserId"}, - {2, nullptr, "RequestSuspendAudio"}, - {3, nullptr, "RequestResumeAudio"}, - {4, nullptr, "GetAudioOutputProcessMasterVolume"}, - {5, nullptr, "SetAudioOutputProcessMasterVolume"}, - {6, nullptr, "GetAudioInputProcessMasterVolume"}, - {7, nullptr, "SetAudioInputProcessMasterVolume"}, - {8, nullptr, "GetAudioOutputProcessRecordVolume"}, - {9, nullptr, "SetAudioOutputProcessRecordVolume"}, - {10, nullptr, "GetAppletStateSummaries"}, - }; - // clang-format on - RegisterHandlers(functions); + : ServiceFramework{system_, "aud:a"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "RegisterAppletResourceUserId"}, + FunctionInfo{1, nullptr, "UnregisterAppletResourceUserId"}, + FunctionInfo{2, nullptr, "RequestSuspendAudio"}, + FunctionInfo{3, nullptr, "RequestResumeAudio"}, + FunctionInfo{4, nullptr, "GetAudioOutputProcessMasterVolume"}, + FunctionInfo{5, nullptr, "SetAudioOutputProcessMasterVolume"}, + FunctionInfo{6, nullptr, "GetAudioInputProcessMasterVolume"}, + FunctionInfo{7, nullptr, "SetAudioInputProcessMasterVolume"}, + FunctionInfo{8, nullptr, "GetAudioOutputProcessRecordVolume"}, + FunctionInfo{9, nullptr, "SetAudioOutputProcessRecordVolume"}, + FunctionInfo{10, nullptr, "GetAppletStateSummaries"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class IAudioSystemManagerForDebugger final : public ServiceFramework { public: explicit IAudioSystemManagerForDebugger(Core::System& system_) - : ServiceFramework{system_, "aud:d"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "RequestSuspendAudioForDebug"}, - {1, nullptr, "RequestResumeAudioForDebug"}, - }; - // clang-format on - RegisterHandlers(functions); + : ServiceFramework{system_, "aud:d"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "RequestSuspendAudioForDebug"}, + FunctionInfo{1, nullptr, "RequestResumeAudioForDebug"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; diff --git a/src/core/hle/service/audio/audio_controller.cpp b/src/core/hle/service/audio/audio_controller.cpp index 611e48e8ba..d912a5e86a 100644 --- a/src/core/hle/service/audio/audio_controller.cpp +++ b/src/core/hle/service/audio/audio_controller.cpp @@ -1,7 +1,7 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project @@ -20,77 +20,75 @@ namespace Service::Audio { +std::optional IAudioController::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IAudioController::GetTargetVolume>, "GetTargetVolume"}, + FunctionInfo{1, D<&IAudioController::SetTargetVolume>, "SetTargetVolume"}, + FunctionInfo{2, D<&IAudioController::GetTargetVolumeMin>, "GetTargetVolumeMin"}, + FunctionInfo{3, D<&IAudioController::GetTargetVolumeMax>, "GetTargetVolumeMax"}, + FunctionInfo{4, D<&IAudioController::IsTargetMute>, "IsTargetMute"}, + FunctionInfo{5, D<&IAudioController::SetTargetMute>, "SetTargetMute"}, + FunctionInfo{6, nullptr, "IsTargetConnected", MakeVersionGate({20,0,0})}, + FunctionInfo{7, nullptr, "SetDefaultTarget"}, + FunctionInfo{8, nullptr, "GetDefaultTarget"}, + FunctionInfo{9, D<&IAudioController::GetAudioOutputMode>, "GetAudioOutputMode"}, + FunctionInfo{10, D<&IAudioController::SetAudioOutputMode>, "SetAudioOutputMode"}, + FunctionInfo{11, nullptr, "SetForceMutePolicy"}, + FunctionInfo{12, D<&IAudioController::GetForceMutePolicy>, "GetForceMutePolicy"}, + FunctionInfo{13, D<&IAudioController::GetOutputModeSetting>, "GetOutputModeSetting"}, + FunctionInfo{14, D<&IAudioController::SetOutputModeSetting>, "SetOutputModeSetting"}, + FunctionInfo{15, nullptr, "SetOutputTarget"}, + FunctionInfo{16, nullptr, "SetInputTargetForceEnabled"}, + FunctionInfo{17, D<&IAudioController::SetHeadphoneOutputLevelMode>, "SetHeadphoneOutputLevelMode"}, + FunctionInfo{18, D<&IAudioController::GetHeadphoneOutputLevelMode>, "GetHeadphoneOutputLevelMode"}, + FunctionInfo{19, nullptr, "AcquireAudioVolumeUpdateEventForPlayReport"}, + FunctionInfo{20, nullptr, "AcquireAudioOutputDeviceUpdateEventForPlayReport"}, + FunctionInfo{21, nullptr, "GetAudioOutputTargetForPlayReport"}, + FunctionInfo{22, D<&IAudioController::NotifyHeadphoneVolumeWarningDisplayedEvent>, "NotifyHeadphoneVolumeWarningDisplayedEvent"}, + FunctionInfo{23, nullptr, "SetSystemOutputMasterVolume"}, + FunctionInfo{24, nullptr, "GetSystemOutputMasterVolume"}, + FunctionInfo{25, nullptr, "GetAudioVolumeDataForPlayReport"}, + FunctionInfo{26, nullptr, "UpdateHeadphoneSettings"}, + FunctionInfo{27, nullptr, "SetVolumeMappingTableForDev"}, + FunctionInfo{28, nullptr, "GetAudioOutputChannelCountForPlayReport"}, + FunctionInfo{29, nullptr, "BindAudioOutputChannelCountUpdateEventForPlayReport"}, + FunctionInfo{30, D<&IAudioController::SetSpeakerAutoMuteEnabled>, "SetSpeakerAutoMuteEnabled"}, + FunctionInfo{31, D<&IAudioController::IsSpeakerAutoMuteEnabled>, "IsSpeakerAutoMuteEnabled"}, + FunctionInfo{32, D<&IAudioController::GetActiveOutputTarget>, "GetActiveOutputTarget"}, + FunctionInfo{33, nullptr, "GetTargetDeviceInfo"}, + FunctionInfo{34, D<&IAudioController::AcquireTargetNotification>, "AcquireTargetNotification"}, + FunctionInfo{35, nullptr, "SetHearingProtectionSafeguardTimerRemainingTimeForDebug"}, + FunctionInfo{36, nullptr, "GetHearingProtectionSafeguardTimerRemainingTimeForDebug"}, + FunctionInfo{37, nullptr, "SetHearingProtectionSafeguardEnabled"}, + FunctionInfo{38, nullptr, "IsHearingProtectionSafeguardEnabled"}, + FunctionInfo{39, nullptr, "IsHearingProtectionSafeguardMonitoringOutputForDebug"}, + FunctionInfo{40, nullptr, "GetSystemInformationForDebug"}, + FunctionInfo{41, nullptr, "SetVolumeButtonLongPressTime"}, + FunctionInfo{42, nullptr, "SetNativeVolumeForDebug"}, + FunctionInfo{43, nullptr, "Unknown43", MakeVersionGate({21,0,0})}, + FunctionInfo{5000, D<&IAudioController::Unknown5000>, "Unknown5000", MakeVersionGate({19,0,0})}, + FunctionInfo{10000, nullptr, "NotifyAudioOutputTargetForPlayReport"}, + FunctionInfo{10001, nullptr, "NotifyAudioOutputChannelCountForPlayReport"}, + FunctionInfo{10002, nullptr, "NotifyUnsupportedUsbOutputDeviceAttachedForPlayReport"}, + FunctionInfo{10100, nullptr, "GetAudioVolumeDataForPlayReport"}, + FunctionInfo{10101, nullptr, "BindAudioVolumeUpdateEventForPlayReport"}, + FunctionInfo{10102, nullptr, "BindAudioOutputTargetUpdateEventForPlayReport"}, + FunctionInfo{10103, nullptr, "GetAudioOutputTargetForPlayReport"}, + FunctionInfo{10104, nullptr, "GetAudioOutputChannelCountForPlayReport"}, + FunctionInfo{10105, nullptr, "BindAudioOutputChannelCountUpdateEventForPlayReport", MakeVersionGate({14,0,0}, {19,0,1})}, + FunctionInfo{10106, nullptr, "GetDefaultAudioOutputTargetForPlayReport", MakeVersionGate({14,0,0}, {19,0,1})}, + FunctionInfo{10200, nullptr, "Unknown10200", MakeVersionGate({20,0,0})}, + FunctionInfo{50000, nullptr, "SetAnalogInputBoostGainForPrototyping", MakeVersionGate({15,0,0}, {18,1,0})}, + FunctionInfo{50001, nullptr, "OverrideDefaultTargetForDebug", MakeVersionGate({19,0,0}, {19,0,1})}, + FunctionInfo{50003, nullptr, "SetForceOverrideExternalDeviceNameForDebug", MakeVersionGate({19,0,0})}, + FunctionInfo{50004, nullptr, "ClearForceOverrideExternalDeviceNameForDebug", MakeVersionGate({19,0,0})} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IAudioController::IAudioController(Core::System& system_) : ServiceFramework{system_, "audctl"}, service_context{system, "audctl"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IAudioController::GetTargetVolume>, "GetTargetVolume"}, - {1, D<&IAudioController::SetTargetVolume>, "SetTargetVolume"}, - {2, D<&IAudioController::GetTargetVolumeMin>, "GetTargetVolumeMin"}, - {3, D<&IAudioController::GetTargetVolumeMax>, "GetTargetVolumeMax"}, - {4, D<&IAudioController::IsTargetMute>, "IsTargetMute"}, - {5, D<&IAudioController::SetTargetMute>, "SetTargetMute"}, - {6, nullptr, "IsTargetConnected"}, //20.0.0+ - {7, nullptr, "SetDefaultTarget"}, - {8, nullptr, "GetDefaultTarget"}, - {9, D<&IAudioController::GetAudioOutputMode>, "GetAudioOutputMode"}, - {10, D<&IAudioController::SetAudioOutputMode>, "SetAudioOutputMode"}, - {11, nullptr, "SetForceMutePolicy"}, - {12, D<&IAudioController::GetForceMutePolicy>, "GetForceMutePolicy"}, - {13, D<&IAudioController::GetOutputModeSetting>, "GetOutputModeSetting"}, - {14, D<&IAudioController::SetOutputModeSetting>, "SetOutputModeSetting"}, - {15, nullptr, "SetOutputTarget"}, - {16, nullptr, "SetInputTargetForceEnabled"}, - {17, D<&IAudioController::SetHeadphoneOutputLevelMode>, "SetHeadphoneOutputLevelMode"}, - {18, D<&IAudioController::GetHeadphoneOutputLevelMode>, "GetHeadphoneOutputLevelMode"}, - {19, nullptr, "AcquireAudioVolumeUpdateEventForPlayReport"}, - {20, nullptr, "AcquireAudioOutputDeviceUpdateEventForPlayReport"}, - {21, nullptr, "GetAudioOutputTargetForPlayReport"}, - {22, D<&IAudioController::NotifyHeadphoneVolumeWarningDisplayedEvent>, "NotifyHeadphoneVolumeWarningDisplayedEvent"}, - {23, nullptr, "SetSystemOutputMasterVolume"}, - {24, nullptr, "GetSystemOutputMasterVolume"}, - {25, nullptr, "GetAudioVolumeDataForPlayReport"}, - {26, nullptr, "UpdateHeadphoneSettings"}, - {27, nullptr, "SetVolumeMappingTableForDev"}, - {28, nullptr, "GetAudioOutputChannelCountForPlayReport"}, - {29, nullptr, "BindAudioOutputChannelCountUpdateEventForPlayReport"}, - {30, D<&IAudioController::SetSpeakerAutoMuteEnabled>, "SetSpeakerAutoMuteEnabled"}, - {31, D<&IAudioController::IsSpeakerAutoMuteEnabled>, "IsSpeakerAutoMuteEnabled"}, - {32, D<&IAudioController::GetActiveOutputTarget>, "GetActiveOutputTarget"}, - {33, nullptr, "GetTargetDeviceInfo"}, - {34, D<&IAudioController::AcquireTargetNotification>, "AcquireTargetNotification"}, - {35, nullptr, "SetHearingProtectionSafeguardTimerRemainingTimeForDebug"}, - {36, nullptr, "GetHearingProtectionSafeguardTimerRemainingTimeForDebug"}, - {37, nullptr, "SetHearingProtectionSafeguardEnabled"}, - {38, nullptr, "IsHearingProtectionSafeguardEnabled"}, - {39, nullptr, "IsHearingProtectionSafeguardMonitoringOutputForDebug"}, - {40, nullptr, "GetSystemInformationForDebug"}, - {41, nullptr, "SetVolumeButtonLongPressTime"}, - {42, nullptr, "SetNativeVolumeForDebug"}, - {43, nullptr, "Unknown43"}, //21.0.0+ - {5000, D<&IAudioController::Unknown5000>, "Unknown5000"}, //19.0.0+ - {10000, nullptr, "NotifyAudioOutputTargetForPlayReport"}, - {10001, nullptr, "NotifyAudioOutputChannelCountForPlayReport"}, - {10002, nullptr, "NotifyUnsupportedUsbOutputDeviceAttachedForPlayReport"}, - {10100, nullptr, "GetAudioVolumeDataForPlayReport"}, - {10101, nullptr, "BindAudioVolumeUpdateEventForPlayReport"}, - {10102, nullptr, "BindAudioOutputTargetUpdateEventForPlayReport"}, - {10103, nullptr, "GetAudioOutputTargetForPlayReport"}, - {10104, nullptr, "GetAudioOutputChannelCountForPlayReport"}, - {10105, nullptr, "BindAudioOutputChannelCountUpdateEventForPlayReport"}, //14.0.0-19.0.1 - {10106, nullptr, "GetDefaultAudioOutputTargetForPlayReport"}, //14.0.0-19.0.1 - {10200, nullptr, "Unknown10200"}, //20.0.0+ - {50000, nullptr, "SetAnalogInputBoostGainForPrototyping"}, //15.0.0-18.1.0 - {50001, nullptr, "OverrideDefaultTargetForDebug"}, //19.0.0-19.0.1 - {50003, nullptr, "SetForceOverrideExternalDeviceNameForDebug"}, //19.0.0+ - {50004, nullptr, "ClearForceOverrideExternalDeviceNameForDebug"} //19.0.0+ - }; - // clang-format on - - RegisterHandlers(functions); - - m_set_sys = - system.ServiceManager().GetService("set:sys", true); + m_set_sys = system.ServiceManager().GetService("set:sys", true); notification_event = service_context.CreateEvent("IAudioController:NotificationEvent"); // Probably shouldn't do this in constructor? diff --git a/src/core/hle/service/audio/audio_controller.h b/src/core/hle/service/audio/audio_controller.h index ff51f4c244..e5c615fa21 100644 --- a/src/core/hle/service/audio/audio_controller.h +++ b/src/core/hle/service/audio/audio_controller.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project @@ -59,8 +59,8 @@ private: Result AcquireTargetNotification(OutCopyHandle out_notification_event); Result Unknown5000(Out> out_audio_controller); + std::optional FindRequest(u32 key) override; KernelHelpers::ServiceContext service_context; - Kernel::KEvent* notification_event; std::shared_ptr m_set_sys; std::array m_target_volumes{{15, 15, 15, 15, 15, 15}}; diff --git a/src/core/hle/service/audio/audio_device.cpp b/src/core/hle/service/audio/audio_device.cpp index e9f7e074a1..fc24bf3ccd 100644 --- a/src/core/hle/service/audio/audio_device.cpp +++ b/src/core/hle/service/audio/audio_device.cpp @@ -12,36 +12,38 @@ namespace Service::Audio { using namespace AudioCore::Renderer; +std::optional IAudioDevice::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IAudioDevice::ListAudioDeviceName>, "ListAudioDeviceName"}, + FunctionInfo{1, D<&IAudioDevice::SetAudioDeviceOutputVolume>, "SetAudioDeviceOutputVolume"}, + FunctionInfo{2, D<&IAudioDevice::GetAudioDeviceOutputVolume>, "GetAudioDeviceOutputVolume"}, + FunctionInfo{3, D<&IAudioDevice::GetActiveAudioDeviceName>, "GetActiveAudioDeviceName"}, + FunctionInfo{4, D<&IAudioDevice::QueryAudioDeviceSystemEvent>, "QueryAudioDeviceSystemEvent"}, + FunctionInfo{5, D<&IAudioDevice::GetActiveChannelCount>, "GetActiveChannelCount"}, + FunctionInfo{6, D<&IAudioDevice::ListAudioDeviceNameAuto>, "ListAudioDeviceNameAuto"}, + FunctionInfo{7, D<&IAudioDevice::SetAudioDeviceOutputVolumeAuto>, "SetAudioDeviceOutputVolumeAuto"}, + FunctionInfo{8, D<&IAudioDevice::GetAudioDeviceOutputVolumeAuto>, "GetAudioDeviceOutputVolumeAuto"}, + FunctionInfo{10, D<&IAudioDevice::GetActiveAudioDeviceNameAuto>, "GetActiveAudioDeviceNameAuto"}, + FunctionInfo{11, D<&IAudioDevice::QueryAudioDeviceInputEvent>, "QueryAudioDeviceInputEvent"}, + FunctionInfo{12, D<&IAudioDevice::QueryAudioDeviceOutputEvent>, "QueryAudioDeviceOutputEvent"}, + FunctionInfo{13, D<&IAudioDevice::GetActiveAudioDeviceName>, "GetActiveAudioOutputDeviceName"}, + FunctionInfo{14, D<&IAudioDevice::ListAudioOutputDeviceName>, "ListAudioOutputDeviceName"}, + FunctionInfo{15, nullptr, "AcquireAudioInputDeviceNotification", MakeVersionGate({17,0,0})}, + FunctionInfo{16, nullptr, "ReleaseAudioInputDeviceNotification", MakeVersionGate({17,0,0})}, + FunctionInfo{17, nullptr, "AcquireAudioOutputDeviceNotification", MakeVersionGate({17,0,0})}, + FunctionInfo{18, nullptr, "ReleaseAudioOutputDeviceNotification", MakeVersionGate({17,0,0})}, + FunctionInfo{19, D<&IAudioDevice::SetAudioDeviceOutputVolumeAutoTuneEnabled>, "SetAudioDeviceOutputVolumeAutoTuneEnabled", MakeVersionGate({18,0,0})}, + FunctionInfo{20, D<&IAudioDevice::IsAudioDeviceOutputVolumeAutoTuneEnabled>, "IsAudioDeviceOutputVolumeAutoTuneEnabled", MakeVersionGate({18,0,0})}, + FunctionInfo{21, nullptr, "IsActiveOutputDeviceEstimatedLowLatency", MakeVersionGate({21,0,0})} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IAudioDevice::IAudioDevice(Core::System& system_, u64 applet_resource_user_id, u32 revision, u32 device_num) : ServiceFramework{system_, "IAudioDevice"}, service_context{system_, "IAudioDevice"}, impl{std::make_unique(system_, applet_resource_user_id, revision)}, event{service_context.CreateEvent(fmt::format("IAudioDeviceEvent-{}", device_num))} { - static const FunctionInfo functions[] = { - {0, D<&IAudioDevice::ListAudioDeviceName>, "ListAudioDeviceName"}, - {1, D<&IAudioDevice::SetAudioDeviceOutputVolume>, "SetAudioDeviceOutputVolume"}, - {2, D<&IAudioDevice::GetAudioDeviceOutputVolume>, "GetAudioDeviceOutputVolume"}, - {3, D<&IAudioDevice::GetActiveAudioDeviceName>, "GetActiveAudioDeviceName"}, - {4, D<&IAudioDevice::QueryAudioDeviceSystemEvent>, "QueryAudioDeviceSystemEvent"}, - {5, D<&IAudioDevice::GetActiveChannelCount>, "GetActiveChannelCount"}, - {6, D<&IAudioDevice::ListAudioDeviceNameAuto>, "ListAudioDeviceNameAuto"}, - {7, D<&IAudioDevice::SetAudioDeviceOutputVolumeAuto>, "SetAudioDeviceOutputVolumeAuto"}, - {8, D<&IAudioDevice::GetAudioDeviceOutputVolumeAuto>, "GetAudioDeviceOutputVolumeAuto"}, - {10, D<&IAudioDevice::GetActiveAudioDeviceNameAuto>, "GetActiveAudioDeviceNameAuto"}, - {11, D<&IAudioDevice::QueryAudioDeviceInputEvent>, "QueryAudioDeviceInputEvent"}, - {12, D<&IAudioDevice::QueryAudioDeviceOutputEvent>, "QueryAudioDeviceOutputEvent"}, - {13, D<&IAudioDevice::GetActiveAudioDeviceName>, "GetActiveAudioOutputDeviceName"}, - {14, D<&IAudioDevice::ListAudioOutputDeviceName>, "ListAudioOutputDeviceName"}, - {15, nullptr, "AcquireAudioInputDeviceNotification"}, //17.0.0+ - {16, nullptr, "ReleaseAudioInputDeviceNotification"}, //17.0.0+ - {17, nullptr, "AcquireAudioOutputDeviceNotification"}, //17.0.0+ - {18, nullptr, "ReleaseAudioOutputDeviceNotification"}, //17.0.0+ - {19, D<&IAudioDevice::SetAudioDeviceOutputVolumeAutoTuneEnabled>, "SetAudioDeviceOutputVolumeAutoTuneEnabled"}, //18.0.0+ - {20, D<&IAudioDevice::IsAudioDeviceOutputVolumeAutoTuneEnabled>, "IsAudioDeviceOutputVolumeAutoTuneEnabled"}, //18.0.0+ - {21, nullptr, "IsActiveOutputDeviceEstimatedLowLatency"} //21.0.0+ - }; - RegisterHandlers(functions); - event->Signal(system.Kernel()); } diff --git a/src/core/hle/service/audio/audio_device.h b/src/core/hle/service/audio/audio_device.h index f6c12fbfeb..bd0aaa5f7c 100644 --- a/src/core/hle/service/audio/audio_device.h +++ b/src/core/hle/service/audio/audio_device.h @@ -55,6 +55,7 @@ private: Result SetAudioDeviceOutputVolumeAutoTuneEnabled(bool enabled); Result IsAudioDeviceOutputVolumeAutoTuneEnabled(Out out_enabled); + std::optional FindRequest(u32 key) override; KernelHelpers::ServiceContext service_context; std::unique_ptr impl; Kernel::KEvent* event; diff --git a/src/core/hle/service/audio/audio_in.cpp b/src/core/hle/service/audio/audio_in.cpp index 6208c2d104..068574dbd2 100644 --- a/src/core/hle/service/audio/audio_in.cpp +++ b/src/core/hle/service/audio/audio_in.cpp @@ -11,35 +11,33 @@ namespace Service::Audio { using namespace AudioCore::AudioIn; +std::optional IAudioIn::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IAudioIn::GetAudioInState>, "GetAudioInState"}, + FunctionInfo{1, D<&IAudioIn::Start>, "Start"}, + FunctionInfo{2, D<&IAudioIn::Stop>, "Stop"}, + FunctionInfo{3, D<&IAudioIn::AppendAudioInBuffer>, "AppendAudioInBuffer"}, + FunctionInfo{4, D<&IAudioIn::RegisterBufferEvent>, "RegisterBufferEvent"}, + FunctionInfo{5, D<&IAudioIn::GetReleasedAudioInBuffers>, "GetReleasedAudioInBuffers"}, + FunctionInfo{6, D<&IAudioIn::ContainsAudioInBuffer>, "ContainsAudioInBuffer"}, + FunctionInfo{7, D<&IAudioIn::AppendAudioInBuffer>, "AppendUacInBuffer"}, + FunctionInfo{8, D<&IAudioIn::AppendAudioInBufferAuto>, "AppendAudioInBufferAuto"}, + FunctionInfo{9, D<&IAudioIn::GetReleasedAudioInBuffersAuto>, "GetReleasedAudioInBuffersAuto"}, + FunctionInfo{10, D<&IAudioIn::AppendAudioInBufferAuto>, "AppendUacInBufferAuto"}, + FunctionInfo{11, D<&IAudioIn::GetAudioInBufferCount>, "GetAudioInBufferCount"}, + FunctionInfo{12, D<&IAudioIn::SetDeviceGain>, "SetDeviceGain"}, + FunctionInfo{13, D<&IAudioIn::GetDeviceGain>, "GetDeviceGain"}, + FunctionInfo{14, D<&IAudioIn::FlushAudioInBuffers>, "FlushAudioInBuffers"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IAudioIn::IAudioIn(Core::System& system_, Manager& manager, size_t session_id, const std::string& device_name, const AudioInParameter& in_params, Kernel::KProcess* handle, u64 applet_resource_user_id) - : ServiceFramework{system_, "IAudioIn"}, process{handle}, service_context{system_, "IAudioIn"}, - event{service_context.CreateEvent("AudioInEvent")}, impl{std::make_shared(system_, - manager, event, - session_id)} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IAudioIn::GetAudioInState>, "GetAudioInState"}, - {1, D<&IAudioIn::Start>, "Start"}, - {2, D<&IAudioIn::Stop>, "Stop"}, - {3, D<&IAudioIn::AppendAudioInBuffer>, "AppendAudioInBuffer"}, - {4, D<&IAudioIn::RegisterBufferEvent>, "RegisterBufferEvent"}, - {5, D<&IAudioIn::GetReleasedAudioInBuffers>, "GetReleasedAudioInBuffers"}, - {6, D<&IAudioIn::ContainsAudioInBuffer>, "ContainsAudioInBuffer"}, - {7, D<&IAudioIn::AppendAudioInBuffer>, "AppendUacInBuffer"}, - {8, D<&IAudioIn::AppendAudioInBufferAuto>, "AppendAudioInBufferAuto"}, - {9, D<&IAudioIn::GetReleasedAudioInBuffersAuto>, "GetReleasedAudioInBuffersAuto"}, - {10, D<&IAudioIn::AppendAudioInBufferAuto>, "AppendUacInBufferAuto"}, - {11, D<&IAudioIn::GetAudioInBufferCount>, "GetAudioInBufferCount"}, - {12, D<&IAudioIn::SetDeviceGain>, "SetDeviceGain"}, - {13, D<&IAudioIn::GetDeviceGain>, "GetDeviceGain"}, - {14, D<&IAudioIn::FlushAudioInBuffers>, "FlushAudioInBuffers"}, - }; - // clang-format on - - RegisterHandlers(functions); - + : ServiceFramework{system_, "IAudioIn"}, process{handle}, service_context{system_, "IAudioIn"} + , event{service_context.CreateEvent("AudioInEvent")}, impl{std::make_shared(system_, manager, event, session_id)} +{ process->Open(system.Kernel()); if (impl->GetSystem() diff --git a/src/core/hle/service/audio/audio_in.h b/src/core/hle/service/audio/audio_in.h index 3fe1e1e870..dd7a41f300 100644 --- a/src/core/hle/service/audio/audio_in.h +++ b/src/core/hle/service/audio/audio_in.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -43,6 +46,7 @@ public: Result FlushAudioInBuffers(Out out_flushed); private: + std::optional FindRequest(u32 key) override; Kernel::KProcess* process; KernelHelpers::ServiceContext service_context; Kernel::KEvent* event; diff --git a/src/core/hle/service/audio/audio_in_manager.cpp b/src/core/hle/service/audio/audio_in_manager.cpp index 2675a57735..422e72148b 100644 --- a/src/core/hle/service/audio/audio_in_manager.cpp +++ b/src/core/hle/service/audio/audio_in_manager.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -9,23 +12,23 @@ namespace Service::Audio { using namespace AudioCore::AudioIn; -IAudioInManager::IAudioInManager(Core::System& system_) - : ServiceFramework{system_, "audin:u"}, impl{std::make_unique( - system_)} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IAudioInManager::ListAudioIns>, "ListAudioIns"}, - {1, D<&IAudioInManager::OpenAudioIn>, "OpenAudioIn"}, - {2, D<&IAudioInManager::ListAudioIns>, "ListAudioInsAuto"}, - {3, D<&IAudioInManager::OpenAudioIn>, "OpenAudioInAuto"}, - {4, D<&IAudioInManager::ListAudioInsAutoFiltered>, "ListAudioInsAutoFiltered"}, - {5, D<&IAudioInManager::OpenAudioInProtocolSpecified>, "OpenAudioInProtocolSpecified"}, - }; - // clang-format on - - RegisterHandlers(functions); +std::optional IAudioInManager::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IAudioInManager::ListAudioIns>, "ListAudioIns"}, + FunctionInfo{1, D<&IAudioInManager::OpenAudioIn>, "OpenAudioIn"}, + FunctionInfo{2, D<&IAudioInManager::ListAudioIns>, "ListAudioInsAuto"}, + FunctionInfo{3, D<&IAudioInManager::OpenAudioIn>, "OpenAudioInAuto"}, + FunctionInfo{4, D<&IAudioInManager::ListAudioInsAutoFiltered>, "ListAudioInsAutoFiltered"}, + FunctionInfo{5, D<&IAudioInManager::OpenAudioInProtocolSpecified>, "OpenAudioInProtocolSpecified"} + ); + return HandlerTableGenerateWithFind(key, functions); } +IAudioInManager::IAudioInManager(Core::System& system_) + : ServiceFramework{system_, "audin:u"} + , impl{std::make_unique(system_)} +{} + IAudioInManager::~IAudioInManager() = default; Result IAudioInManager::ListAudioIns( diff --git a/src/core/hle/service/audio/audio_in_manager.h b/src/core/hle/service/audio/audio_in_manager.h index 2a983bc607..0ee0badba7 100644 --- a/src/core/hle/service/audio/audio_in_manager.h +++ b/src/core/hle/service/audio/audio_in_manager.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -51,6 +54,7 @@ private: AudioCore::AudioIn::AudioInParameter parameter, InCopyHandle process_handle, ClientAppletResourceUserId aruid); + std::optional FindRequest(u32 key) override; std::unique_ptr impl; }; diff --git a/src/core/hle/service/audio/audio_out.cpp b/src/core/hle/service/audio/audio_out.cpp index 996eeede58..a5f06faab8 100644 --- a/src/core/hle/service/audio/audio_out.cpp +++ b/src/core/hle/service/audio/audio_out.cpp @@ -15,6 +15,26 @@ namespace Service::Audio { using namespace AudioCore::AudioOut; +std::optional IAudioOut::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IAudioOut::GetAudioOutState>, "GetAudioOutState"}, + FunctionInfo{1, D<&IAudioOut::Start>, "Start"}, + FunctionInfo{2, D<&IAudioOut::Stop>, "Stop"}, + FunctionInfo{3, D<&IAudioOut::AppendAudioOutBuffer>, "AppendAudioOutBuffer"}, + FunctionInfo{4, D<&IAudioOut::RegisterBufferEvent>, "RegisterBufferEvent"}, + FunctionInfo{5, D<&IAudioOut::GetReleasedAudioOutBuffers>, "GetReleasedAudioOutBuffers"}, + FunctionInfo{6, D<&IAudioOut::ContainsAudioOutBuffer>, "ContainsAudioOutBuffer"}, + FunctionInfo{7, D<&IAudioOut::AppendAudioOutBufferAuto>, "AppendAudioOutBufferAuto"}, + FunctionInfo{8, D<&IAudioOut::GetReleasedAudioOutBuffersAuto>, "GetReleasedAudioOutBuffersAuto"}, + FunctionInfo{9, D<&IAudioOut::GetAudioOutBufferCount>, "GetAudioOutBufferCount"}, + FunctionInfo{10, D<&IAudioOut::GetAudioOutPlayedSampleCount>, "GetAudioOutPlayedSampleCount"}, + FunctionInfo{11, D<&IAudioOut::FlushAudioOutBuffers>, "FlushAudioOutBuffers"}, + FunctionInfo{12, D<&IAudioOut::SetAudioOutVolume>, "SetAudioOutVolume"}, + FunctionInfo{13, D<&IAudioOut::GetAudioOutVolume>, "GetAudioOutVolume"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IAudioOut::IAudioOut(Core::System& system_, Manager& manager, size_t session_id, const std::string& device_name, const AudioOutParameter& in_params, Kernel::KProcess* handle, u64 applet_resource_user_id) @@ -22,26 +42,6 @@ IAudioOut::IAudioOut(Core::System& system_, Manager& manager, size_t session_id, event{service_context.CreateEvent("AudioOutEvent")}, process{handle}, impl{std::make_shared(system_, manager, event, session_id)} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IAudioOut::GetAudioOutState>, "GetAudioOutState"}, - {1, D<&IAudioOut::Start>, "Start"}, - {2, D<&IAudioOut::Stop>, "Stop"}, - {3, D<&IAudioOut::AppendAudioOutBuffer>, "AppendAudioOutBuffer"}, - {4, D<&IAudioOut::RegisterBufferEvent>, "RegisterBufferEvent"}, - {5, D<&IAudioOut::GetReleasedAudioOutBuffers>, "GetReleasedAudioOutBuffers"}, - {6, D<&IAudioOut::ContainsAudioOutBuffer>, "ContainsAudioOutBuffer"}, - {7, D<&IAudioOut::AppendAudioOutBufferAuto>, "AppendAudioOutBufferAuto"}, - {8, D<&IAudioOut::GetReleasedAudioOutBuffersAuto>, "GetReleasedAudioOutBuffersAuto"}, - {9, D<&IAudioOut::GetAudioOutBufferCount>, "GetAudioOutBufferCount"}, - {10, D<&IAudioOut::GetAudioOutPlayedSampleCount>, "GetAudioOutPlayedSampleCount"}, - {11, D<&IAudioOut::FlushAudioOutBuffers>, "FlushAudioOutBuffers"}, - {12, D<&IAudioOut::SetAudioOutVolume>, "SetAudioOutVolume"}, - {13, D<&IAudioOut::GetAudioOutVolume>, "GetAudioOutVolume"}, - }; - // clang-format on - RegisterHandlers(functions); - process->Open(system.Kernel()); } diff --git a/src/core/hle/service/audio/audio_out.h b/src/core/hle/service/audio/audio_out.h index 779b213e78..311eb84afe 100644 --- a/src/core/hle/service/audio/audio_out.h +++ b/src/core/hle/service/audio/audio_out.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -49,6 +52,8 @@ public: Result GetAudioOutVolume(Out out_volume); private: + std::optional FindRequest(u32 key) override; + KernelHelpers::ServiceContext service_context; Kernel::KEvent* event; Kernel::KProcess* process; diff --git a/src/core/hle/service/audio/audio_out_manager.cpp b/src/core/hle/service/audio/audio_out_manager.cpp index 3b2087932c..9f24bc3513 100644 --- a/src/core/hle/service/audio/audio_out_manager.cpp +++ b/src/core/hle/service/audio/audio_out_manager.cpp @@ -13,20 +13,20 @@ namespace Service::Audio { using namespace AudioCore::AudioOut; +std::optional IAudioOutManager::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IAudioOutManager::ListAudioOuts>, "ListAudioOuts"}, + FunctionInfo{1, D<&IAudioOutManager::OpenAudioOut>, "OpenAudioOut"}, + FunctionInfo{2, D<&IAudioOutManager::ListAudioOutsAuto>, "ListAudioOutsAuto"}, + FunctionInfo{3, D<&IAudioOutManager::OpenAudioOutAuto>, "OpenAudioOutAuto"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IAudioOutManager::IAudioOutManager(Core::System& system_) : ServiceFramework{system_, "audout:u"} , impl(system_) { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IAudioOutManager::ListAudioOuts>, "ListAudioOuts"}, - {1, D<&IAudioOutManager::OpenAudioOut>, "OpenAudioOut"}, - {2, D<&IAudioOutManager::ListAudioOutsAuto>, "ListAudioOutsAuto"}, - {3, D<&IAudioOutManager::OpenAudioOutAuto>, "OpenAudioOutAuto"}, - }; - // clang-format on - - RegisterHandlers(functions); } IAudioOutManager::~IAudioOutManager() = default; diff --git a/src/core/hle/service/audio/audio_out_manager.h b/src/core/hle/service/audio/audio_out_manager.h index ec974aaba4..4c71c12cdf 100644 --- a/src/core/hle/service/audio/audio_out_manager.h +++ b/src/core/hle/service/audio/audio_out_manager.h @@ -43,6 +43,7 @@ private: AudioCore::AudioOut::AudioOutParameter parameter, InCopyHandle process_handle, ClientAppletResourceUserId aruid); + std::optional FindRequest(u32 key) override; std::optional impl; }; diff --git a/src/core/hle/service/audio/audio_renderer.cpp b/src/core/hle/service/audio/audio_renderer.cpp index dd76544094..bcb2adaf61 100644 --- a/src/core/hle/service/audio/audio_renderer.cpp +++ b/src/core/hle/service/audio/audio_renderer.cpp @@ -10,38 +10,37 @@ namespace Service::Audio { using namespace AudioCore::Renderer; +std::optional IAudioRenderer::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IAudioRenderer::GetSampleRate>, "GetSampleRate"}, + FunctionInfo{1, D<&IAudioRenderer::GetSampleCount>, "GetSampleCount"}, + FunctionInfo{2, D<&IAudioRenderer::GetMixBufferCount>, "GetMixBufferCount"}, + FunctionInfo{3, D<&IAudioRenderer::GetState>, "GetState"}, + FunctionInfo{4, D<&IAudioRenderer::RequestUpdate>, "RequestUpdate"}, + FunctionInfo{5, D<&IAudioRenderer::Start>, "Start"}, + FunctionInfo{6, D<&IAudioRenderer::Stop>, "Stop"}, + FunctionInfo{7, D<&IAudioRenderer::QuerySystemEvent>, "QuerySystemEvent"}, + FunctionInfo{8, D<&IAudioRenderer::SetRenderingTimeLimit>, "SetRenderingTimeLimit"}, + FunctionInfo{9, D<&IAudioRenderer::GetRenderingTimeLimit>, "GetRenderingTimeLimit"}, + FunctionInfo{10, D<&IAudioRenderer::RequestUpdateAuto>, "RequestUpdateAuto", MakeVersionGate({3,0,0})}, + FunctionInfo{11, nullptr, "ExecuteAudioRendererRendering", MakeVersionGate({3,0,0})}, + FunctionInfo{12, D<&IAudioRenderer::SetVoiceDropParameter>, "SetVoiceDropParameter", MakeVersionGate({15,0,0})}, + FunctionInfo{13, D<&IAudioRenderer::GetVoiceDropParameter>, "GetVoiceDropParameter", MakeVersionGate({15,0,0})} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IAudioRenderer::IAudioRenderer(Core::System& system_, Manager& manager_, AudioCore::AudioRendererParameterInternal& params, Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size, Kernel::KProcess* process_handle_, u64 applet_resource_user_id, s32 session_id) - : ServiceFramework{system_, "IAudioRenderer"}, service_context{system_, "IAudioRenderer"}, - rendered_event{service_context.CreateEvent("IAudioRendererEvent")}, manager{manager_}, - impl{std::make_unique(system_, manager, rendered_event)}, process_handle{ - process_handle_} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IAudioRenderer::GetSampleRate>, "GetSampleRate"}, - {1, D<&IAudioRenderer::GetSampleCount>, "GetSampleCount"}, - {2, D<&IAudioRenderer::GetMixBufferCount>, "GetMixBufferCount"}, - {3, D<&IAudioRenderer::GetState>, "GetState"}, - {4, D<&IAudioRenderer::RequestUpdate>, "RequestUpdate"}, - {5, D<&IAudioRenderer::Start>, "Start"}, - {6, D<&IAudioRenderer::Stop>, "Stop"}, - {7, D<&IAudioRenderer::QuerySystemEvent>, "QuerySystemEvent"}, - {8, D<&IAudioRenderer::SetRenderingTimeLimit>, "SetRenderingTimeLimit"}, - {9, D<&IAudioRenderer::GetRenderingTimeLimit>, "GetRenderingTimeLimit"}, - {10, D<&IAudioRenderer::RequestUpdateAuto>, "RequestUpdateAuto"}, //3.0.0+ - {11, nullptr, "ExecuteAudioRendererRendering"}, //3.0.0+ - {12, D<&IAudioRenderer::SetVoiceDropParameter>, "SetVoiceDropParameter"}, //15.0.0+ - {13, D<&IAudioRenderer::GetVoiceDropParameter>, "GetVoiceDropParameter"}, //15.0.0+ - }; - // clang-format on - RegisterHandlers(functions); - + : ServiceFramework{system_, "IAudioRenderer"}, service_context{system_, "IAudioRenderer"} + , rendered_event{service_context.CreateEvent("IAudioRendererEvent")}, manager{manager_} + , impl{std::make_unique(system_, manager, rendered_event)} + , process_handle{process_handle_} { process_handle->Open(system_.Kernel()); - impl->Initialize(params, transfer_memory, transfer_memory_size, process_handle, - applet_resource_user_id, session_id); + impl->Initialize(params, transfer_memory, transfer_memory_size, process_handle, applet_resource_user_id, session_id); } IAudioRenderer::~IAudioRenderer() { diff --git a/src/core/hle/service/audio/audio_renderer.h b/src/core/hle/service/audio/audio_renderer.h index f25c50ce8d..e03fc6551d 100644 --- a/src/core/hle/service/audio/audio_renderer.h +++ b/src/core/hle/service/audio/audio_renderer.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -42,6 +45,7 @@ private: Result SetVoiceDropParameter(f32 voice_drop_parameter); Result GetVoiceDropParameter(Out out_voice_drop_parameter); + std::optional FindRequest(u32 key) override; KernelHelpers::ServiceContext service_context; Kernel::KEvent* rendered_event; AudioCore::Renderer::Manager& manager; diff --git a/src/core/hle/service/audio/audio_renderer_manager.cpp b/src/core/hle/service/audio/audio_renderer_manager.cpp index 4756802eeb..98701c79c1 100644 --- a/src/core/hle/service/audio/audio_renderer_manager.cpp +++ b/src/core/hle/service/audio/audio_renderer_manager.cpp @@ -18,21 +18,21 @@ namespace Service::Audio { using namespace AudioCore::Renderer; +std::optional IAudioRendererManager::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IAudioRendererManager::OpenAudioRenderer>, "OpenAudioRenderer"}, + FunctionInfo{1, D<&IAudioRendererManager::GetWorkBufferSize>, "GetWorkBufferSize"}, + FunctionInfo{2, D<&IAudioRendererManager::GetAudioDeviceService>, "GetAudioDeviceService"}, + FunctionInfo{3, nullptr, "OpenAudioRendererForManualExecution"}, + FunctionInfo{4, D<&IAudioRendererManager::GetAudioDeviceServiceWithRevisionInfo>, "GetAudioDeviceServiceWithRevisionInfo"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IAudioRendererManager::IAudioRendererManager(Core::System& system_) : ServiceFramework{system_, "audren:u"} , impl(system_) { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IAudioRendererManager::OpenAudioRenderer>, "OpenAudioRenderer"}, - {1, D<&IAudioRendererManager::GetWorkBufferSize>, "GetWorkBufferSize"}, - {2, D<&IAudioRendererManager::GetAudioDeviceService>, "GetAudioDeviceService"}, - {3, nullptr, "OpenAudioRendererForManualExecution"}, - {4, D<&IAudioRendererManager::GetAudioDeviceServiceWithRevisionInfo>, "GetAudioDeviceServiceWithRevisionInfo"}, - }; - // clang-format on - - RegisterHandlers(functions); } IAudioRendererManager::~IAudioRendererManager() = default; diff --git a/src/core/hle/service/audio/audio_renderer_manager.h b/src/core/hle/service/audio/audio_renderer_manager.h index fdce8b6ffa..bd3ea06326 100644 --- a/src/core/hle/service/audio/audio_renderer_manager.h +++ b/src/core/hle/service/audio/audio_renderer_manager.h @@ -33,6 +33,7 @@ private: Result GetAudioDeviceServiceWithRevisionInfo(Out> out_audio_device, u32 revision, ClientAppletResourceUserId aruid); + std::optional FindRequest(u32 key) override; std::optional impl; u32 num_audio_devices{0}; }; diff --git a/src/core/hle/service/audio/final_output_recorder_manager.cpp b/src/core/hle/service/audio/final_output_recorder_manager.cpp index f70a0e62d7..9c51613de6 100644 --- a/src/core/hle/service/audio/final_output_recorder_manager.cpp +++ b/src/core/hle/service/audio/final_output_recorder_manager.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -8,34 +11,29 @@ namespace Service::Audio { class IFinalOutputRecorder final : public ServiceFramework { public: explicit IFinalOutputRecorder(Core::System& system_) - : ServiceFramework{system_, "IFinalOutputRecorder"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetFinalOutputRecorderState"}, - {1, nullptr, "Start"}, - {2, nullptr, "Stop"}, - {3, nullptr, "AppendFinalOutputRecorderBuffer"}, - {4, nullptr, "RegisterBufferEvent"}, - {5, nullptr, "GetReleasedFinalOutputRecorderBuffers"}, - {6, nullptr, "ContainsFinalOutputRecorderBuffer"}, - {7, nullptr, "GetFinalOutputRecorderBufferEndTime"}, - {8, nullptr, "AppendFinalOutputRecorderBufferAuto"}, - {9, nullptr, "GetReleasedFinalOutputRecorderBufferAuto"}, - {10, nullptr, "FlushFinalOutputRecorderBuffers"}, - {11, nullptr, "AttachWorkBuffer"}, - }; - // clang-format on + : ServiceFramework{system_, "IFinalOutputRecorder"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetFinalOutputRecorderState"}, + FunctionInfo{1, nullptr, "Start"}, + FunctionInfo{2, nullptr, "Stop"}, + FunctionInfo{3, nullptr, "AppendFinalOutputRecorderBuffer"}, + FunctionInfo{4, nullptr, "RegisterBufferEvent"}, + FunctionInfo{5, nullptr, "GetReleasedFinalOutputRecorderBuffers"}, + FunctionInfo{6, nullptr, "ContainsFinalOutputRecorderBuffer"}, + FunctionInfo{7, nullptr, "GetFinalOutputRecorderBufferEndTime"}, + FunctionInfo{8, nullptr, "AppendFinalOutputRecorderBufferAuto"}, + FunctionInfo{9, nullptr, "GetReleasedFinalOutputRecorderBufferAuto"}, + FunctionInfo{10, nullptr, "FlushFinalOutputRecorderBuffers"}, + FunctionInfo{11, nullptr, "AttachWorkBuffer"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; IFinalOutputRecorderManager::IFinalOutputRecorderManager(Core::System& system_) : ServiceFramework{system_, "audrec:u"} { - static const FunctionInfo functions[] = { - {0, nullptr, "OpenFinalOutputRecorder"}, - }; - RegisterHandlers(functions); } IFinalOutputRecorderManager::~IFinalOutputRecorderManager() = default; diff --git a/src/core/hle/service/audio/final_output_recorder_manager.h b/src/core/hle/service/audio/final_output_recorder_manager.h index 0663b894e7..ee392b2ada 100644 --- a/src/core/hle/service/audio/final_output_recorder_manager.h +++ b/src/core/hle/service/audio/final_output_recorder_manager.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -15,6 +18,13 @@ class IFinalOutputRecorderManager final : public ServiceFramework FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "OpenFinalOutputRecorder"} + ); }; } // namespace Service::Audio diff --git a/src/core/hle/service/audio/final_output_recorder_manager_for_applet.cpp b/src/core/hle/service/audio/final_output_recorder_manager_for_applet.cpp index 7e2e42bbe7..42c08d90ec 100644 --- a/src/core/hle/service/audio/final_output_recorder_manager_for_applet.cpp +++ b/src/core/hle/service/audio/final_output_recorder_manager_for_applet.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -7,14 +10,6 @@ namespace Service::Audio { IFinalOutputRecorderManagerForApplet::IFinalOutputRecorderManagerForApplet(Core::System& system_) : ServiceFramework{system_, "audrec:a"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "RequestSuspend"}, - {1, nullptr, "RequestResume"}, - }; - // clang-format on - - RegisterHandlers(functions); } IFinalOutputRecorderManagerForApplet::~IFinalOutputRecorderManagerForApplet() = default; diff --git a/src/core/hle/service/audio/final_output_recorder_manager_for_applet.h b/src/core/hle/service/audio/final_output_recorder_manager_for_applet.h index 27940f7e0d..7beaa888ff 100644 --- a/src/core/hle/service/audio/final_output_recorder_manager_for_applet.h +++ b/src/core/hle/service/audio/final_output_recorder_manager_for_applet.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -16,6 +19,14 @@ class IFinalOutputRecorderManagerForApplet final public: explicit IFinalOutputRecorderManagerForApplet(Core::System& system_); ~IFinalOutputRecorderManagerForApplet() override; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "RequestSuspend"}, + FunctionInfo{1, nullptr, "RequestResume"} + ); }; } // namespace Service::Audio diff --git a/src/core/hle/service/audio/hardware_opus_decoder.cpp b/src/core/hle/service/audio/hardware_opus_decoder.cpp index 03d3374c14..f0dde63e14 100644 --- a/src/core/hle/service/audio/hardware_opus_decoder.cpp +++ b/src/core/hle/service/audio/hardware_opus_decoder.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -8,25 +11,25 @@ namespace Service::Audio { using namespace AudioCore::OpusDecoder; + std::optional IHardwareOpusDecoder::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IHardwareOpusDecoder::DecodeInterleavedOld>, "DecodeInterleavedOld"}, + FunctionInfo{1, D<&IHardwareOpusDecoder::SetContext>, "SetContext"}, + FunctionInfo{2, D<&IHardwareOpusDecoder::DecodeInterleavedForMultiStreamOld>, "DecodeInterleavedForMultiStreamOld"}, + FunctionInfo{3, D<&IHardwareOpusDecoder::SetContextForMultiStream>, "SetContextForMultiStream"}, + FunctionInfo{4, D<&IHardwareOpusDecoder::DecodeInterleavedWithPerfOld>, "DecodeInterleavedWithPerfOld"}, + FunctionInfo{5, D<&IHardwareOpusDecoder::DecodeInterleavedForMultiStreamWithPerfOld>, "DecodeInterleavedForMultiStreamWithPerfOld"}, + FunctionInfo{6, D<&IHardwareOpusDecoder::DecodeInterleavedWithPerfAndResetOld>, "DecodeInterleavedWithPerfAndResetOld"}, + FunctionInfo{7, D<&IHardwareOpusDecoder::DecodeInterleavedForMultiStreamWithPerfAndResetOld>, "DecodeInterleavedForMultiStreamWithPerfAndResetOld"}, + FunctionInfo{8, D<&IHardwareOpusDecoder::DecodeInterleaved>, "DecodeInterleaved"}, + FunctionInfo{9, D<&IHardwareOpusDecoder::DecodeInterleavedForMultiStream>, "DecodeInterleavedForMultiStream"} + ); + return HandlerTableGenerateWithFind(key, functions); + } + IHardwareOpusDecoder::IHardwareOpusDecoder(Core::System& system_, HardwareOpus& hardware_opus) : ServiceFramework{system_, "IHardwareOpusDecoder"}, impl{std::make_unique(system_, hardware_opus)} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IHardwareOpusDecoder::DecodeInterleavedOld>, "DecodeInterleavedOld"}, - {1, D<&IHardwareOpusDecoder::SetContext>, "SetContext"}, - {2, D<&IHardwareOpusDecoder::DecodeInterleavedForMultiStreamOld>, "DecodeInterleavedForMultiStreamOld"}, - {3, D<&IHardwareOpusDecoder::SetContextForMultiStream>, "SetContextForMultiStream"}, - {4, D<&IHardwareOpusDecoder::DecodeInterleavedWithPerfOld>, "DecodeInterleavedWithPerfOld"}, - {5, D<&IHardwareOpusDecoder::DecodeInterleavedForMultiStreamWithPerfOld>, "DecodeInterleavedForMultiStreamWithPerfOld"}, - {6, D<&IHardwareOpusDecoder::DecodeInterleavedWithPerfAndResetOld>, "DecodeInterleavedWithPerfAndResetOld"}, - {7, D<&IHardwareOpusDecoder::DecodeInterleavedForMultiStreamWithPerfAndResetOld>, "DecodeInterleavedForMultiStreamWithPerfAndResetOld"}, - {8, D<&IHardwareOpusDecoder::DecodeInterleaved>, "DecodeInterleaved"}, - {9, D<&IHardwareOpusDecoder::DecodeInterleavedForMultiStream>, "DecodeInterleavedForMultiStream"}, - }; - // clang-format on - - RegisterHandlers(functions); } IHardwareOpusDecoder::~IHardwareOpusDecoder() = default; diff --git a/src/core/hle/service/audio/hardware_opus_decoder.h b/src/core/hle/service/audio/hardware_opus_decoder.h index 511bf46bdb..9f9b17bc81 100644 --- a/src/core/hle/service/audio/hardware_opus_decoder.h +++ b/src/core/hle/service/audio/hardware_opus_decoder.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -55,6 +58,7 @@ private: Out out_data_size, Out out_sample_count, Out out_time_taken, InBuffer opus_data, bool reset); + std::optional FindRequest(u32 key) override; std::unique_ptr impl; Common::ScratchBuffer output_data; diff --git a/src/core/hle/service/audio/hardware_opus_decoder_manager.cpp b/src/core/hle/service/audio/hardware_opus_decoder_manager.cpp index 9de72e30fe..3000ba8c60 100644 --- a/src/core/hle/service/audio/hardware_opus_decoder_manager.cpp +++ b/src/core/hle/service/audio/hardware_opus_decoder_manager.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -9,23 +12,24 @@ namespace Service::Audio { using namespace AudioCore::OpusDecoder; +std::optional IHardwareOpusDecoderManager::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IHardwareOpusDecoderManager::OpenHardwareOpusDecoder>, "OpenHardwareOpusDecoder"}, + FunctionInfo{1, D<&IHardwareOpusDecoderManager::GetWorkBufferSize>, "GetWorkBufferSize"}, + FunctionInfo{2, D<&IHardwareOpusDecoderManager::OpenHardwareOpusDecoderForMultiStream>, "OpenOpusDecoderForMultiStream"}, + FunctionInfo{3, D<&IHardwareOpusDecoderManager::GetWorkBufferSizeForMultiStream>, "GetWorkBufferSizeForMultiStream"}, + FunctionInfo{4, D<&IHardwareOpusDecoderManager::OpenHardwareOpusDecoderEx>, "OpenHardwareOpusDecoderEx"}, + FunctionInfo{5, D<&IHardwareOpusDecoderManager::GetWorkBufferSizeEx>, "GetWorkBufferSizeEx"}, + FunctionInfo{6, D<&IHardwareOpusDecoderManager::OpenHardwareOpusDecoderForMultiStreamEx>, "OpenHardwareOpusDecoderForMultiStreamEx"}, + FunctionInfo{7, D<&IHardwareOpusDecoderManager::GetWorkBufferSizeForMultiStreamEx>, "GetWorkBufferSizeForMultiStreamEx"}, + FunctionInfo{8, D<&IHardwareOpusDecoderManager::GetWorkBufferSizeExEx>, "GetWorkBufferSizeExEx"}, + FunctionInfo{9, D<&IHardwareOpusDecoderManager::GetWorkBufferSizeForMultiStreamExEx>, "GetWorkBufferSizeForMultiStreamExEx"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IHardwareOpusDecoderManager::IHardwareOpusDecoderManager(Core::System& system_) : ServiceFramework{system_, "hwopus"}, system{system_}, impl{system} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IHardwareOpusDecoderManager::OpenHardwareOpusDecoder>, "OpenHardwareOpusDecoder"}, - {1, D<&IHardwareOpusDecoderManager::GetWorkBufferSize>, "GetWorkBufferSize"}, - {2, D<&IHardwareOpusDecoderManager::OpenHardwareOpusDecoderForMultiStream>, "OpenOpusDecoderForMultiStream"}, - {3, D<&IHardwareOpusDecoderManager::GetWorkBufferSizeForMultiStream>, "GetWorkBufferSizeForMultiStream"}, - {4, D<&IHardwareOpusDecoderManager::OpenHardwareOpusDecoderEx>, "OpenHardwareOpusDecoderEx"}, - {5, D<&IHardwareOpusDecoderManager::GetWorkBufferSizeEx>, "GetWorkBufferSizeEx"}, - {6, D<&IHardwareOpusDecoderManager::OpenHardwareOpusDecoderForMultiStreamEx>, "OpenHardwareOpusDecoderForMultiStreamEx"}, - {7, D<&IHardwareOpusDecoderManager::GetWorkBufferSizeForMultiStreamEx>, "GetWorkBufferSizeForMultiStreamEx"}, - {8, D<&IHardwareOpusDecoderManager::GetWorkBufferSizeExEx>, "GetWorkBufferSizeExEx"}, - {9, D<&IHardwareOpusDecoderManager::GetWorkBufferSizeForMultiStreamExEx>, "GetWorkBufferSizeForMultiStreamExEx"}, - }; - // clang-format on - RegisterHandlers(functions); } IHardwareOpusDecoderManager::~IHardwareOpusDecoderManager() = default; diff --git a/src/core/hle/service/audio/hardware_opus_decoder_manager.h b/src/core/hle/service/audio/hardware_opus_decoder_manager.h index 4f869c5174..1dbac9addb 100644 --- a/src/core/hle/service/audio/hardware_opus_decoder_manager.h +++ b/src/core/hle/service/audio/hardware_opus_decoder_manager.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -46,6 +49,7 @@ private: Result GetWorkBufferSizeForMultiStreamExEx( Out out_size, InLargeData params); + std::optional FindRequest(u32 key) override; Core::System& system; AudioCore::OpusDecoder::OpusDecoderManager impl; }; diff --git a/src/core/hle/service/bcat/bcat_service.cpp b/src/core/hle/service/bcat/bcat_service.cpp index bc2a3e3457..85f262f6eb 100644 --- a/src/core/hle/service/bcat/bcat_service.cpp +++ b/src/core/hle/service/bcat/bcat_service.cpp @@ -24,45 +24,46 @@ static u64 GetCurrentBuildID(const Core::System::CurrentBuildProcessID& id) { return out; } -IBcatService::IBcatService(Core::System& system_, BcatBackend& backend_, u64 program_id_) - : ServiceFramework{system_, "IBcatService"}, backend{backend_}, program_id{program_id_}, - progress{{ - ProgressServiceBackend{system_, "Normal"}, - ProgressServiceBackend{system_, "Directory"}, - }} { - // clang-format off - static const FunctionInfo functions[] = { - {10100, D<&IBcatService::RequestSyncDeliveryCache>, "RequestSyncDeliveryCache"}, - {10101, D<&IBcatService::RequestSyncDeliveryCacheWithDirectoryName>, "RequestSyncDeliveryCacheWithDirectoryName"}, - {10200, nullptr, "CancelSyncDeliveryCacheRequest"}, - {20100, nullptr, "RequestSyncDeliveryCacheWithApplicationId"}, - {20101, nullptr, "RequestSyncDeliveryCacheWithApplicationIdAndDirectoryName"}, - {20300, nullptr, "GetDeliveryCacheStorageUpdateNotifier"}, - {20301, nullptr, "RequestSuspendDeliveryTask"}, - {20400, nullptr, "RegisterSystemApplicationDeliveryTask"}, - {20401, nullptr, "UnregisterSystemApplicationDeliveryTask"}, - {20410, nullptr, "SetSystemApplicationDeliveryTaskTimer"}, - {30100, D<&IBcatService::SetPassphrase>, "SetPassphrase"}, - {30101, nullptr, "Unknown30101"}, //2.0.0-2.3.0 - {30102, nullptr, "Unknown30102"}, //2.0.0-2.3.0 - {30200, nullptr, "RegisterBackgroundDeliveryTask"}, - {30201, nullptr, "UnregisterBackgroundDeliveryTask"}, - {30202, nullptr, "BlockDeliveryTask"}, - {30203, nullptr, "UnblockDeliveryTask"}, - {30210, nullptr, "SetDeliveryTaskTimer"}, - {30300, D<&IBcatService::RegisterSystemApplicationDeliveryTasks>, "RegisterSystemApplicationDeliveryTasks"}, - {90100, nullptr, "GetDeliveryTaskList"}, - {90101, nullptr, "GetDeliveryTaskListForSystem"}, //11.0.0+ - {90200, nullptr, "GetDeliveryList"}, - {90201, D<&IBcatService::ClearDeliveryCacheStorage>, "ClearDeliveryCacheStorage"}, - {90202, nullptr, "ClearDeliveryTaskSubscriptionStatus"}, - {90300, nullptr, "GetPushNotificationLog"}, - {90301, nullptr, "GetDeliveryCacheStorageUsage"}, //11.0.0+ - }; - // clang-format on - RegisterHandlers(functions); +std::optional IBcatService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{10100, D<&IBcatService::RequestSyncDeliveryCache>, "RequestSyncDeliveryCache"}, + FunctionInfo{10101, D<&IBcatService::RequestSyncDeliveryCacheWithDirectoryName>, "RequestSyncDeliveryCacheWithDirectoryName"}, + FunctionInfo{10200, nullptr, "CancelSyncDeliveryCacheRequest"}, + FunctionInfo{20100, nullptr, "RequestSyncDeliveryCacheWithApplicationId"}, + FunctionInfo{20101, nullptr, "RequestSyncDeliveryCacheWithApplicationIdAndDirectoryName"}, + FunctionInfo{20300, nullptr, "GetDeliveryCacheStorageUpdateNotifier"}, + FunctionInfo{20301, nullptr, "RequestSuspendDeliveryTask"}, + FunctionInfo{20400, nullptr, "RegisterSystemApplicationDeliveryTask"}, + FunctionInfo{20401, nullptr, "UnregisterSystemApplicationDeliveryTask"}, + FunctionInfo{20410, nullptr, "SetSystemApplicationDeliveryTaskTimer"}, + FunctionInfo{30100, D<&IBcatService::SetPassphrase>, "SetPassphrase"}, + FunctionInfo{30101, nullptr, "Unknown30101", MakeVersionGate({2,0,0}, {2,3,0})}, + FunctionInfo{30102, nullptr, "Unknown30102", MakeVersionGate({2,0,0}, {2,3,0})}, + FunctionInfo{30200, nullptr, "RegisterBackgroundDeliveryTask"}, + FunctionInfo{30201, nullptr, "UnregisterBackgroundDeliveryTask"}, + FunctionInfo{30202, nullptr, "BlockDeliveryTask"}, + FunctionInfo{30203, nullptr, "UnblockDeliveryTask"}, + FunctionInfo{30210, nullptr, "SetDeliveryTaskTimer"}, + FunctionInfo{30300, D<&IBcatService::RegisterSystemApplicationDeliveryTasks>, "RegisterSystemApplicationDeliveryTasks"}, + FunctionInfo{90100, nullptr, "GetDeliveryTaskList"}, + FunctionInfo{90101, nullptr, "GetDeliveryTaskListForSystem", MakeVersionGate({11,0,0})}, + FunctionInfo{90200, nullptr, "GetDeliveryList"}, + FunctionInfo{90201, D<&IBcatService::ClearDeliveryCacheStorage>, "ClearDeliveryCacheStorage"}, + FunctionInfo{90202, nullptr, "ClearDeliveryTaskSubscriptionStatus"}, + FunctionInfo{90300, nullptr, "GetPushNotificationLog"}, + FunctionInfo{90301, nullptr, "GetDeliveryCacheStorageUsage", MakeVersionGate({11,0,0})} + ); + return HandlerTableGenerateWithFind(key, functions); } +IBcatService::IBcatService(Core::System& system_, BcatBackend& backend_, u64 program_id_) + : ServiceFramework{system_, "IBcatService"}, backend{backend_}, program_id{program_id_} + , progress{{ + ProgressServiceBackend{system_, "Normal"}, + ProgressServiceBackend{system_, "Directory"}, + }} +{} + IBcatService::~IBcatService() = default; Result IBcatService::RequestSyncDeliveryCache( diff --git a/src/core/hle/service/bcat/bcat_service.h b/src/core/hle/service/bcat/bcat_service.h index 5e11059a78..ed95f021d0 100644 --- a/src/core/hle/service/bcat/bcat_service.h +++ b/src/core/hle/service/bcat/bcat_service.h @@ -41,6 +41,7 @@ private: ProgressServiceBackend& GetProgressBackend(SyncType type); const ProgressServiceBackend& GetProgressBackend(SyncType type) const; + std::optional FindRequest(u32 key) override; BcatBackend& backend; u64 program_id; std::array(SyncType::Count)> progress; diff --git a/src/core/hle/service/bcat/delivery_cache_directory_service.cpp b/src/core/hle/service/bcat/delivery_cache_directory_service.cpp index 8ead0bae99..0d464a2fdc 100644 --- a/src/core/hle/service/bcat/delivery_cache_directory_service.cpp +++ b/src/core/hle/service/bcat/delivery_cache_directory_service.cpp @@ -27,18 +27,18 @@ static BcatDigest DigestFile(const FileSys::VirtualFile& file) { return out; } +std::optional IDeliveryCacheDirectoryService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IDeliveryCacheDirectoryService::Open>, "Open"}, + FunctionInfo{1, D<&IDeliveryCacheDirectoryService::Read>, "Read"}, + FunctionInfo{2, D<&IDeliveryCacheDirectoryService::GetCount>, "GetCount"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IDeliveryCacheDirectoryService::IDeliveryCacheDirectoryService(Core::System& system_, FileSys::VirtualDir root_) : ServiceFramework{system_, "IDeliveryCacheDirectoryService"}, root(std::move(root_)) { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IDeliveryCacheDirectoryService::Open>, "Open"}, - {1, D<&IDeliveryCacheDirectoryService::Read>, "Read"}, - {2, D<&IDeliveryCacheDirectoryService::GetCount>, "GetCount"}, - }; - // clang-format on - - RegisterHandlers(functions); } IDeliveryCacheDirectoryService::~IDeliveryCacheDirectoryService() = default; diff --git a/src/core/hle/service/bcat/delivery_cache_directory_service.h b/src/core/hle/service/bcat/delivery_cache_directory_service.h index b902c64959..af90680390 100644 --- a/src/core/hle/service/bcat/delivery_cache_directory_service.h +++ b/src/core/hle/service/bcat/delivery_cache_directory_service.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -26,6 +29,7 @@ private: OutArray out_buffer); Result GetCount(Out out_count); + std::optional FindRequest(u32 key) override; FileSys::VirtualDir root; FileSys::VirtualDir current_dir; }; diff --git a/src/core/hle/service/bcat/delivery_cache_file_service.cpp b/src/core/hle/service/bcat/delivery_cache_file_service.cpp index b75fac4bfe..d9b6ff77ee 100644 --- a/src/core/hle/service/bcat/delivery_cache_file_service.cpp +++ b/src/core/hle/service/bcat/delivery_cache_file_service.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -9,19 +12,19 @@ namespace Service::BCAT { +std::optional IDeliveryCacheFileService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IDeliveryCacheFileService::Open>, "Open"}, + FunctionInfo{1, D<&IDeliveryCacheFileService::Read>, "Read"}, + FunctionInfo{2, D<&IDeliveryCacheFileService::GetSize>, "GetSize"}, + FunctionInfo{3, D<&IDeliveryCacheFileService::GetDigest>, "GetDigest"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IDeliveryCacheFileService::IDeliveryCacheFileService(Core::System& system_, FileSys::VirtualDir root_) : ServiceFramework{system_, "IDeliveryCacheFileService"}, root(std::move(root_)) { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IDeliveryCacheFileService::Open>, "Open"}, - {1, D<&IDeliveryCacheFileService::Read>, "Read"}, - {2, D<&IDeliveryCacheFileService::GetSize>, "GetSize"}, - {3, D<&IDeliveryCacheFileService::GetDigest>, "GetDigest"}, - }; - // clang-format on - - RegisterHandlers(functions); } IDeliveryCacheFileService::~IDeliveryCacheFileService() = default; diff --git a/src/core/hle/service/bcat/delivery_cache_file_service.h b/src/core/hle/service/bcat/delivery_cache_file_service.h index e1012e6873..176c8eb3e5 100644 --- a/src/core/hle/service/bcat/delivery_cache_file_service.h +++ b/src/core/hle/service/bcat/delivery_cache_file_service.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -26,6 +29,7 @@ private: Result GetSize(Out out_size); Result GetDigest(Out out_digest); + std::optional FindRequest(u32 key) override; FileSys::VirtualDir root; FileSys::VirtualFile current_file; }; diff --git a/src/core/hle/service/bcat/delivery_cache_progress_service.cpp b/src/core/hle/service/bcat/delivery_cache_progress_service.cpp index 79e7e0d957..4de42dd580 100644 --- a/src/core/hle/service/bcat/delivery_cache_progress_service.cpp +++ b/src/core/hle/service/bcat/delivery_cache_progress_service.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -7,18 +10,18 @@ namespace Service::BCAT { +std::optional IDeliveryCacheProgressService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IDeliveryCacheProgressService::GetEvent>, "GetEvent"}, + FunctionInfo{1, D<&IDeliveryCacheProgressService::GetImpl>, "GetImpl"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IDeliveryCacheProgressService::IDeliveryCacheProgressService(Core::System& system_, Kernel::KReadableEvent& event_, const DeliveryCacheProgressImpl& impl_) : ServiceFramework{system_, "IDeliveryCacheProgressService"}, event{event_}, impl{impl_} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IDeliveryCacheProgressService::GetEvent>, "Get"}, - {1, D<&IDeliveryCacheProgressService::GetImpl>, "Get"}, - }; - // clang-format on - - RegisterHandlers(functions); } IDeliveryCacheProgressService::~IDeliveryCacheProgressService() = default; diff --git a/src/core/hle/service/bcat/delivery_cache_progress_service.h b/src/core/hle/service/bcat/delivery_cache_progress_service.h index f81a139806..88f49cea85 100644 --- a/src/core/hle/service/bcat/delivery_cache_progress_service.h +++ b/src/core/hle/service/bcat/delivery_cache_progress_service.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -28,6 +31,7 @@ private: Result GetEvent(OutCopyHandle out_event); Result GetImpl(OutLargeData out_impl); + std::optional FindRequest(u32 key) override; Kernel::KReadableEvent& event; const DeliveryCacheProgressImpl& impl; }; diff --git a/src/core/hle/service/bcat/delivery_cache_storage_service.cpp b/src/core/hle/service/bcat/delivery_cache_storage_service.cpp index 46ed4dae67..67dc857642 100644 --- a/src/core/hle/service/bcat/delivery_cache_storage_service.cpp +++ b/src/core/hle/service/bcat/delivery_cache_storage_service.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project @@ -12,18 +12,18 @@ namespace Service::BCAT { +std::optional IDeliveryCacheStorageService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IDeliveryCacheStorageService::CreateFileService>, "CreateFileService"}, + FunctionInfo{1, D<&IDeliveryCacheStorageService::CreateDirectoryService>, "CreateDirectoryService"}, + FunctionInfo{10, D<&IDeliveryCacheStorageService::EnumerateDeliveryCacheDirectory>, "EnumerateDeliveryCacheDirectory"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IDeliveryCacheStorageService::IDeliveryCacheStorageService(Core::System& system_, FileSys::VirtualDir root_) : ServiceFramework{system_, "IDeliveryCacheStorageService"}, root(std::move(root_)) { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IDeliveryCacheStorageService::CreateFileService>, "CreateFileService"}, - {1, D<&IDeliveryCacheStorageService::CreateDirectoryService>, "CreateDirectoryService"}, - {10, D<&IDeliveryCacheStorageService::EnumerateDeliveryCacheDirectory>, "EnumerateDeliveryCacheDirectory"}, - }; - // clang-format on - - RegisterHandlers(functions); } IDeliveryCacheStorageService::~IDeliveryCacheStorageService() = default; diff --git a/src/core/hle/service/bcat/delivery_cache_storage_service.h b/src/core/hle/service/bcat/delivery_cache_storage_service.h index 3b8dfb1a39..b30f24fb47 100644 --- a/src/core/hle/service/bcat/delivery_cache_storage_service.h +++ b/src/core/hle/service/bcat/delivery_cache_storage_service.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -28,6 +31,7 @@ private: Out out_directory_count, OutArray out_directories); + std::optional FindRequest(u32 key) override; FileSys::VirtualDir root; std::vector entries; std::size_t next_read_index = 0; diff --git a/src/core/hle/service/bcat/news/newly_arrived_event_holder.cpp b/src/core/hle/service/bcat/news/newly_arrived_event_holder.cpp index ed393f7a26..57d71c49d8 100644 --- a/src/core/hle/service/bcat/news/newly_arrived_event_holder.cpp +++ b/src/core/hle/service/bcat/news/newly_arrived_event_holder.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -6,17 +9,16 @@ namespace Service::News { -INewlyArrivedEventHolder::INewlyArrivedEventHolder(Core::System& system_) - : ServiceFramework{system_, "INewlyArrivedEventHolder"}, service_context{ - system_, - "INewlyArrivedEventHolder"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&INewlyArrivedEventHolder::Get>, "Get"}, - }; - // clang-format on +std::optional INewlyArrivedEventHolder::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&INewlyArrivedEventHolder::Get>, "Get"} + ); + return HandlerTableGenerateWithFind(key, functions); +} - RegisterHandlers(functions); +INewlyArrivedEventHolder::INewlyArrivedEventHolder(Core::System& system_) + : ServiceFramework{system_, "INewlyArrivedEventHolder"} + , service_context{system_, "INewlyArrivedEventHolder"} { arrived_event = service_context.CreateEvent("INewlyArrivedEventHolder::ArrivedEvent"); } diff --git a/src/core/hle/service/bcat/news/newly_arrived_event_holder.h b/src/core/hle/service/bcat/news/newly_arrived_event_holder.h index 6cc9ae0997..fccc8d6e55 100644 --- a/src/core/hle/service/bcat/news/newly_arrived_event_holder.h +++ b/src/core/hle/service/bcat/news/newly_arrived_event_holder.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -26,6 +29,7 @@ public: private: Result Get(OutCopyHandle out_event); + std::optional FindRequest(u32 key) override; Kernel::KEvent* arrived_event; KernelHelpers::ServiceContext service_context; }; diff --git a/src/core/hle/service/bcat/news/news_data_service.cpp b/src/core/hle/service/bcat/news/news_data_service.cpp index 200d00e785..f5de93db49 100644 --- a/src/core/hle/service/bcat/news/news_data_service.cpp +++ b/src/core/hle/service/bcat/news/news_data_service.cpp @@ -24,16 +24,19 @@ std::string_view ToStringView(std::span buf) { } // namespace +std::optional INewsDataService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&INewsDataService::Open>, "Open"}, + FunctionInfo{1, D<&INewsDataService::OpenWithNewsRecordV1>, "OpenWithNewsRecordV1"}, + FunctionInfo{2, D<&INewsDataService::Read>, "Read"}, + FunctionInfo{3, D<&INewsDataService::GetSize>, "GetSize"}, + FunctionInfo{1001, D<&INewsDataService::OpenWithNewsRecord>, "OpenWithNewsRecord"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + INewsDataService::INewsDataService(Core::System& system_) : ServiceFramework{system_, "INewsDataService"} { - static const FunctionInfo functions[] = { - {0, D<&INewsDataService::Open>, "Open"}, - {1, D<&INewsDataService::OpenWithNewsRecordV1>, "OpenWithNewsRecordV1"}, - {2, D<&INewsDataService::Read>, "Read"}, - {3, D<&INewsDataService::GetSize>, "GetSize"}, - {1001, D<&INewsDataService::OpenWithNewsRecord>, "OpenWithNewsRecord"}, - }; - RegisterHandlers(functions); } INewsDataService::~INewsDataService() = default; diff --git a/src/core/hle/service/bcat/news/news_data_service.h b/src/core/hle/service/bcat/news/news_data_service.h index 8f5e031701..8ce10c045d 100644 --- a/src/core/hle/service/bcat/news/news_data_service.h +++ b/src/core/hle/service/bcat/news/news_data_service.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project @@ -31,6 +31,7 @@ private: Result Read(Out out_size, s64 offset, OutBuffer out_buffer); Result GetSize(Out out_size); + std::optional FindRequest(u32 key) override; std::vector opened_payload; }; diff --git a/src/core/hle/service/bcat/news/news_database_service.cpp b/src/core/hle/service/bcat/news/news_database_service.cpp index 3580ceb0f7..08fdfcb58b 100644 --- a/src/core/hle/service/bcat/news/news_database_service.cpp +++ b/src/core/hle/service/bcat/news/news_database_service.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project @@ -45,18 +45,21 @@ bool UpdateField(NewsRecord& rec, std::string_view column, s32 value, bool addit } // namespace +std::optional INewsDatabaseService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&INewsDatabaseService::GetListV1>, "GetListV1"}, + FunctionInfo{1, D<&INewsDatabaseService::Count>, "Count"}, + FunctionInfo{2, D<&INewsDatabaseService::CountWithKey>, "CountWithKey"}, + FunctionInfo{3, D<&INewsDatabaseService::UpdateIntegerValue>, "UpdateIntegerValue"}, + FunctionInfo{4, D<&INewsDatabaseService::UpdateIntegerValueWithAddition>, "UpdateIntegerValueWithAddition"}, + FunctionInfo{5, D<&INewsDatabaseService::UpdateStringValue>, "UpdateStringValue"}, + FunctionInfo{1000, D<&INewsDatabaseService::GetList>, "GetList"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + INewsDatabaseService::INewsDatabaseService(Core::System& system_) : ServiceFramework{system_, "INewsDatabaseService"} { - static const FunctionInfo functions[] = { - {0, D<&INewsDatabaseService::GetListV1>, "GetListV1"}, - {1, D<&INewsDatabaseService::Count>, "Count"}, - {2, D<&INewsDatabaseService::CountWithKey>, "CountWithKey"}, - {3, D<&INewsDatabaseService::UpdateIntegerValue>, "UpdateIntegerValue"}, - {4, D<&INewsDatabaseService::UpdateIntegerValueWithAddition>, "UpdateIntegerValueWithAddition"}, - {5, D<&INewsDatabaseService::UpdateStringValue>, "UpdateStringValue"}, - {1000, D<&INewsDatabaseService::GetList>, "GetList"}, - }; - RegisterHandlers(functions); } INewsDatabaseService::~INewsDatabaseService() = default; diff --git a/src/core/hle/service/bcat/news/news_database_service.h b/src/core/hle/service/bcat/news/news_database_service.h index 143864e80e..0a097b97bc 100644 --- a/src/core/hle/service/bcat/news/news_database_service.h +++ b/src/core/hle/service/bcat/news/news_database_service.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project @@ -49,6 +49,8 @@ private: InBuffer where_phrase, InBuffer order_by_phrase, s32 offset); + + std::optional FindRequest(u32 key) override; }; } // namespace Service::News diff --git a/src/core/hle/service/bcat/news/news_service.cpp b/src/core/hle/service/bcat/news/news_service.cpp index aed1536bfe..7cb931896c 100644 --- a/src/core/hle/service/bcat/news/news_service.cpp +++ b/src/core/hle/service/bcat/news/news_service.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project @@ -12,32 +12,32 @@ namespace Service::News { -INewsService::INewsService(Core::System& system_) : ServiceFramework{system_, "INewsService"} { - // clang-format off - static const FunctionInfo functions[] = { - {10100, D<&INewsService::PostLocalNews>, "PostLocalNews"}, - {20100, D<&INewsService::SetPassphrase>, "SetPassphrase"}, - {30100, D<&INewsService::GetSubscriptionStatus>, "GetSubscriptionStatus"}, - {30101, D<&INewsService::GetTopicList>, "GetTopicList"}, //3.0.0+ - {30110, D<&INewsService::GetTopicList>, "Unknown30110"}, //6.0.0+ (stub) - {30200, D<&INewsService::IsSystemUpdateRequired>, "IsSystemUpdateRequired"}, - {30201, D<&INewsService::IsSystemUpdateRequired>, "Unknown30201"}, //8.0.0+ (stub) - {30210, D<&INewsService::IsSystemUpdateRequired>, "Unknown30210"}, //10.0.0+ (stub) - {30300, nullptr, "RequestImmediateReception"}, - {30400, nullptr, "DecodeArchiveFile"}, //3.0.0-18.1.0 (stub) - {30500, nullptr, "Unknown30500"}, //8.0.0+ (stub) - {30900, nullptr, "Unknown30900"}, //1.0.0 (stub) - {30901, nullptr, "Unknown30901"}, //1.0.0 (stub) - {30902, nullptr, "Unknown30902"}, //1.0.0 (stub) - {40100, nullptr, "SetSubscriptionStatus"}, - {40101, D<&INewsService::RequestAutoSubscription>, "RequestAutoSubscription"}, //3.0.0+ - {40200, D<&INewsService::ClearStorage>, "ClearStorage"}, - {40201, D<&INewsService::ClearSubscriptionStatusAll>, "ClearSubscriptionStatusAll"}, - {90100, D<&INewsService::GetNewsDatabaseDump>, "GetNewsDatabaseDump"}, - }; - // clang-format on +std::optional INewsService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{10100, D<&INewsService::PostLocalNews>, "PostLocalNews"}, + FunctionInfo{20100, D<&INewsService::SetPassphrase>, "SetPassphrase"}, + FunctionInfo{30100, D<&INewsService::GetSubscriptionStatus>, "GetSubscriptionStatus"}, + FunctionInfo{30101, D<&INewsService::GetTopicList>, "GetTopicList", MakeVersionGate({3,0,0})}, + FunctionInfo{30110, D<&INewsService::GetTopicList>, "Unknown30110", MakeVersionGate({6,0,0})}, // stub + FunctionInfo{30200, D<&INewsService::IsSystemUpdateRequired>, "IsSystemUpdateRequired"}, + FunctionInfo{30201, D<&INewsService::IsSystemUpdateRequired>, "Unknown30201", MakeVersionGate({8,0,0})}, // stub + FunctionInfo{30210, D<&INewsService::IsSystemUpdateRequired>, "Unknown30210", MakeVersionGate({10,0,0})}, // stub + FunctionInfo{30300, nullptr, "RequestImmediateReception"}, + FunctionInfo{30400, nullptr, "DecodeArchiveFile", MakeVersionGate({3,0,0}, {18,1,0})}, // stub + FunctionInfo{30500, nullptr, "Unknown30500", MakeVersionGate({8,0,0})}, // stub + FunctionInfo{30900, nullptr, "Unknown30900", MakeVersionGate({1,0,0})}, // stub + FunctionInfo{30901, nullptr, "Unknown30901", MakeVersionGate({1,0,0})}, // stub + FunctionInfo{30902, nullptr, "Unknown30902", MakeVersionGate({1,0,0})}, // stub + FunctionInfo{40100, nullptr, "SetSubscriptionStatus"}, + FunctionInfo{40101, D<&INewsService::RequestAutoSubscription>, "RequestAutoSubscription", MakeVersionGate({3,0,0})}, + FunctionInfo{40200, D<&INewsService::ClearStorage>, "ClearStorage"}, + FunctionInfo{40201, D<&INewsService::ClearSubscriptionStatusAll>, "ClearSubscriptionStatusAll"}, + FunctionInfo{90100, D<&INewsService::GetNewsDatabaseDump>, "GetNewsDatabaseDump"} + ); + return HandlerTableGenerateWithFind(key, functions); +} - RegisterHandlers(functions); +INewsService::INewsService(Core::System& system_) : ServiceFramework{system_, "INewsService"} { } INewsService::~INewsService() = default; diff --git a/src/core/hle/service/bcat/news/news_service.h b/src/core/hle/service/bcat/news/news_service.h index 1a320df02f..577147e604 100644 --- a/src/core/hle/service/bcat/news/news_service.h +++ b/src/core/hle/service/bcat/news/news_service.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project @@ -22,22 +22,15 @@ public: private: Result PostLocalNews(InBuffer buffer_data); - Result SetPassphrase(InBuffer buffer_data); - Result GetSubscriptionStatus(Out out_status, InBuffer buffer_data); - Result GetTopicList(Out out_count, OutBuffer out_topics, s32 filter); - Result IsSystemUpdateRequired(Out out_is_system_update_required); - Result RequestAutoSubscription(u64 value); - Result ClearStorage(); - Result ClearSubscriptionStatusAll(); - Result GetNewsDatabaseDump(); + std::optional FindRequest(u32 key) override; }; } // namespace Service::News diff --git a/src/core/hle/service/bcat/news/overwrite_event_holder.cpp b/src/core/hle/service/bcat/news/overwrite_event_holder.cpp index 1712971e4d..a6b3029e83 100644 --- a/src/core/hle/service/bcat/news/overwrite_event_holder.cpp +++ b/src/core/hle/service/bcat/news/overwrite_event_holder.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -6,16 +9,16 @@ namespace Service::News { -IOverwriteEventHolder::IOverwriteEventHolder(Core::System& system_) - : ServiceFramework{system_, "IOverwriteEventHolder"}, service_context{system_, - "IOverwriteEventHolder"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IOverwriteEventHolder::Get>, "Get"}, - }; - // clang-format on +std::optional IOverwriteEventHolder::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IOverwriteEventHolder::Get>, "Get"} + ); + return HandlerTableGenerateWithFind(key, functions); +} - RegisterHandlers(functions); +IOverwriteEventHolder::IOverwriteEventHolder(Core::System& system_) + : ServiceFramework{system_, "IOverwriteEventHolder"} + , service_context{system_, "IOverwriteEventHolder"} { overwrite_event = service_context.CreateEvent("IOverwriteEventHolder::OverwriteEvent"); } diff --git a/src/core/hle/service/bcat/news/overwrite_event_holder.h b/src/core/hle/service/bcat/news/overwrite_event_holder.h index cdc87d782c..ba52a36527 100644 --- a/src/core/hle/service/bcat/news/overwrite_event_holder.h +++ b/src/core/hle/service/bcat/news/overwrite_event_holder.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -26,6 +29,7 @@ public: private: Result Get(OutCopyHandle out_event); + std::optional FindRequest(u32 key) override; Kernel::KEvent* overwrite_event; KernelHelpers::ServiceContext service_context; }; diff --git a/src/core/hle/service/bcat/news/service_creator.cpp b/src/core/hle/service/bcat/news/service_creator.cpp index a1b22c0044..66e3b1277e 100644 --- a/src/core/hle/service/bcat/news/service_creator.cpp +++ b/src/core/hle/service/bcat/news/service_creator.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -11,19 +14,19 @@ namespace Service::News { +std::optional IServiceCreator::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IServiceCreator::CreateNewsService>, "CreateNewsService"}, + FunctionInfo{1, D<&IServiceCreator::CreateNewlyArrivedEventHolder>, "CreateNewlyArrivedEventHolder"}, + FunctionInfo{2, D<&IServiceCreator::CreateNewsDataService>, "CreateNewsDataService"}, + FunctionInfo{3, D<&IServiceCreator::CreateNewsDatabaseService>, "CreateNewsDatabaseService"}, + FunctionInfo{4, D<&IServiceCreator::CreateOverwriteEventHolder>, "CreateOverwriteEventHolder"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IServiceCreator::IServiceCreator(Core::System& system_, u32 permissions_, const char* name_) : ServiceFramework{system_, name_}, permissions{permissions_} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IServiceCreator::CreateNewsService>, "CreateNewsService"}, - {1, D<&IServiceCreator::CreateNewlyArrivedEventHolder>, "CreateNewlyArrivedEventHolder"}, - {2, D<&IServiceCreator::CreateNewsDataService>, "CreateNewsDataService"}, - {3, D<&IServiceCreator::CreateNewsDatabaseService>, "CreateNewsDatabaseService"}, - {4, D<&IServiceCreator::CreateOverwriteEventHolder>, "CreateOverwriteEventHolder"}, - }; - // clang-format on - - RegisterHandlers(functions); } IServiceCreator::~IServiceCreator() = default; diff --git a/src/core/hle/service/bcat/news/service_creator.h b/src/core/hle/service/bcat/news/service_creator.h index 5a62e7c1a9..a87f30b67e 100644 --- a/src/core/hle/service/bcat/news/service_creator.h +++ b/src/core/hle/service/bcat/news/service_creator.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -29,6 +32,7 @@ private: Result CreateNewsDatabaseService(OutInterface out_interface); Result CreateOverwriteEventHolder(OutInterface out_interface); + std::optional FindRequest(u32 key) override; u32 permissions; }; diff --git a/src/core/hle/service/bcat/service_creator.cpp b/src/core/hle/service/bcat/service_creator.cpp index 15f59d3056..83f97bb17a 100644 --- a/src/core/hle/service/bcat/service_creator.cpp +++ b/src/core/hle/service/bcat/service_creator.cpp @@ -13,6 +13,17 @@ namespace Service::BCAT { +std::optional IServiceCreator::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IServiceCreator::CreateBcatService>, "CreateBcatService"}, + FunctionInfo{1, D<&IServiceCreator::CreateDeliveryCacheStorageService>, "CreateDeliveryCacheStorageService"}, + FunctionInfo{2, D<&IServiceCreator::CreateDeliveryCacheStorageServiceWithApplicationId>, "CreateDeliveryCacheStorageServiceWithApplicationId"}, + FunctionInfo{3, nullptr, "CreateDeliveryCacheProgressService"}, + FunctionInfo{4, nullptr, "CreateDeliveryCacheProgressServiceWithApplicationId"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + std::unique_ptr CreateBackendFromSettings([[maybe_unused]] Core::System& system, DirectoryGetter getter) { return std::make_unique(std::move(getter)); @@ -20,20 +31,7 @@ std::unique_ptr CreateBackendFromSettings([[maybe_unused]] Core::Sy IServiceCreator::IServiceCreator(Core::System& system_, const char* name_) : ServiceFramework{system_, name_}, fsc{system.GetFileSystemController()} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IServiceCreator::CreateBcatService>, "CreateBcatService"}, - {1, D<&IServiceCreator::CreateDeliveryCacheStorageService>, "CreateDeliveryCacheStorageService"}, - {2, D<&IServiceCreator::CreateDeliveryCacheStorageServiceWithApplicationId>, "CreateDeliveryCacheStorageServiceWithApplicationId"}, - {3, nullptr, "CreateDeliveryCacheProgressService"}, - {4, nullptr, "CreateDeliveryCacheProgressServiceWithApplicationId"}, - }; - // clang-format on - - RegisterHandlers(functions); - - backend = - CreateBackendFromSettings(system_, [this](u64 tid) { return fsc.GetBCATDirectory(tid); }); + backend = CreateBackendFromSettings(system_, [this](u64 tid) { return fsc.GetBCATDirectory(tid); }); } IServiceCreator::~IServiceCreator() = default; diff --git a/src/core/hle/service/bcat/service_creator.h b/src/core/hle/service/bcat/service_creator.h index 50e6633248..02527574dc 100644 --- a/src/core/hle/service/bcat/service_creator.h +++ b/src/core/hle/service/bcat/service_creator.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -33,6 +36,7 @@ private: Result CreateDeliveryCacheStorageServiceWithApplicationId( u64 application_id, OutInterface out_interface); + std::optional FindRequest(u32 key) override; std::unique_ptr backend; Service::FileSystem::FileSystemController& fsc; }; diff --git a/src/core/hle/service/bpc/bpc.cpp b/src/core/hle/service/bpc/bpc.cpp index 6f2e00b22b..7c31cd190d 100644 --- a/src/core/hle/service/bpc/bpc.cpp +++ b/src/core/hle/service/bpc/bpc.cpp @@ -14,103 +14,101 @@ namespace Service::BPC { class BPC final : public ServiceFramework { public: - explicit BPC(Core::System& system_) : ServiceFramework{system_, "bpc"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "ShutdownSystem"}, - {1, nullptr, "RebootSystem"}, - {2, nullptr, "GetWakeupReason"}, - {3, nullptr, "GetShutdownReason"}, - {4, nullptr, "GetAcOk"}, - {5, nullptr, "GetBoardPowerControlEvent"}, - {6, nullptr, "GetSleepButtonState"}, - {7, nullptr, "GetPowerEvent"}, - {8, nullptr, "CreateWakeupTimer"}, - {9, nullptr, "CancelWakeupTimer"}, - {10, nullptr, "EnableWakeupTimerOnDevice"}, - {11, nullptr, "CreateWakeupTimerEx"}, - {12, nullptr, "GetLastEnabledWakeupTimerType"}, - {13, nullptr, "CleanAllWakeupTimers"}, - {14, nullptr, "GetPowerButton"}, - {15, nullptr, "SetEnableWakeupTimer"}, - }; - // clang-format on + explicit BPC(Core::System& system_) : ServiceFramework{system_, "bpc"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "ShutdownSystem"}, + FunctionInfo{1, nullptr, "RebootSystem"}, + FunctionInfo{2, nullptr, "GetWakeupReason"}, + FunctionInfo{3, nullptr, "GetShutdownReason"}, + FunctionInfo{4, nullptr, "GetAcOk"}, + FunctionInfo{5, nullptr, "GetBoardPowerControlEvent"}, + FunctionInfo{6, nullptr, "GetSleepButtonState"}, + FunctionInfo{7, nullptr, "GetPowerEvent"}, + FunctionInfo{8, nullptr, "CreateWakeupTimer"}, + FunctionInfo{9, nullptr, "CancelWakeupTimer"}, + FunctionInfo{10, nullptr, "EnableWakeupTimerOnDevice"}, + FunctionInfo{11, nullptr, "CreateWakeupTimerEx"}, + FunctionInfo{12, nullptr, "GetLastEnabledWakeupTimerType"}, + FunctionInfo{13, nullptr, "CleanAllWakeupTimers"}, + FunctionInfo{14, nullptr, "GetPowerButton"}, + FunctionInfo{15, nullptr, "SetEnableWakeupTimer"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class BPC_R final : public ServiceFramework { public: - explicit BPC_R(Core::System& system_) : ServiceFramework{system_, "bpc:r"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetRtcTime"}, - {1, nullptr, "SetRtcTime"}, - {2, nullptr, "GetRtcResetDetected"}, - {3, nullptr, "ClearRtcResetDetected"}, - {4, nullptr, "SetUpRtcResetOnShutdown"}, - }; - // clang-format on + explicit BPC_R(Core::System& system_) : ServiceFramework{system_, "bpc:r"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetRtcTime"}, + FunctionInfo{1, nullptr, "SetRtcTime"}, + FunctionInfo{2, nullptr, "GetRtcResetDetected"}, + FunctionInfo{3, nullptr, "ClearRtcResetDetected"}, + FunctionInfo{4, nullptr, "SetUpRtcResetOnShutdown"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class BPC_C final : public ServiceFramework { public: - explicit BPC_C(Core::System& system_) : ServiceFramework{system_, "bpc:c"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "ShutdownSystem"}, - {1, nullptr, "RebootSystem"}, - {2, nullptr, "GetWakeupReason"}, - {3, nullptr, "GetShutdownReason"}, - {4, nullptr, "GetAcOk"}, - {5, nullptr, "GetPowerEvent"}, - }; - // clang-format on - RegisterHandlers(functions); + explicit BPC_C(Core::System& system_) : ServiceFramework{system_, "bpc:c"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "ShutdownSystem"}, + FunctionInfo{1, nullptr, "RebootSystem"}, + FunctionInfo{2, nullptr, "GetWakeupReason"}, + FunctionInfo{3, nullptr, "GetShutdownReason"}, + FunctionInfo{4, nullptr, "GetAcOk"}, + FunctionInfo{5, nullptr, "GetPowerEvent"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class BPC_B final : public ServiceFramework { public: - explicit BPC_B(Core::System& system_) : ServiceFramework{system_, "bpc:b"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetSleepButtonState"}, - {1, nullptr, "GetPowerButtonEvent"}, - }; - // clang-format on - RegisterHandlers(functions); + explicit BPC_B(Core::System& system_) : ServiceFramework{system_, "bpc:b"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetSleepButtonState"}, + FunctionInfo{1, nullptr, "GetPowerButtonEvent"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class BPC_W final : public ServiceFramework { public: - explicit BPC_W(Core::System& system_) : ServiceFramework{system_, "bpc:w"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "CreateWakeupTimer"}, - {1, nullptr, "CancelWakeupTimer"}, - {2, nullptr, "EnableWakeupTimerOnDevice"}, - }; - // clang-format on - RegisterHandlers(functions); + explicit BPC_W(Core::System& system_) : ServiceFramework{system_, "bpc:w"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "CreateWakeupTimer"}, + FunctionInfo{1, nullptr, "CancelWakeupTimer"}, + FunctionInfo{2, nullptr, "EnableWakeupTimerOnDevice"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class BPC_AMS final : public ServiceFramework { public: - explicit BPC_AMS(Core::System& system_) : ServiceFramework{system_, "bpc:ams"} { - // clang-format off - static const FunctionInfo functions[] = { - {65000, nullptr, "RebootToFatalError"}, - {65001, nullptr, "SetRebootPayload"}, - }; - // clang-format on - RegisterHandlers(functions); + explicit BPC_AMS(Core::System& system_) : ServiceFramework{system_, "bpc:ams"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{65000, nullptr, "RebootToFatalError"}, + FunctionInfo{65001, nullptr, "SetRebootPayload"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; diff --git a/src/core/hle/service/btdrv/btdrv.cpp b/src/core/hle/service/btdrv/btdrv.cpp index 256a722a84..913c9475e9 100644 --- a/src/core/hle/service/btdrv/btdrv.cpp +++ b/src/core/hle/service/btdrv/btdrv.cpp @@ -20,26 +20,15 @@ namespace Service::BtDrv { class IBluetoothUser final : public ServiceFramework { public: explicit IBluetoothUser(Core::System& system_) - : ServiceFramework{system_, "bt"}, service_context{system_, "bt"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "LeClientReadCharacteristic"}, - {1, nullptr, "LeClientReadDescriptor"}, - {2, nullptr, "LeClientWriteCharacteristic"}, - {3, nullptr, "LeClientWriteDescriptor"}, - {4, nullptr, "LeClientRegisterNotification"}, - {5, nullptr, "LeClientDeregisterNotification"}, - {6, nullptr, "SetLeResponse"}, - {7, nullptr, "LeSendIndication"}, - {8, nullptr, "GetLeEventInfo"}, - {9, C<&IBluetoothUser::RegisterBleEvent>, "RegisterBleEvent"}, - }; - // clang-format on - RegisterHandlers(functions); - + : ServiceFramework{system_, "bt"} + , service_context{system_, "bt"} { register_event = service_context.CreateEvent("BT:RegisterEvent"); } + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + ~IBluetoothUser() override { service_context.CloseEvent(register_event); } @@ -52,151 +41,28 @@ private: R_SUCCEED(); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "LeClientReadCharacteristic"}, + FunctionInfo{1, nullptr, "LeClientReadDescriptor"}, + FunctionInfo{2, nullptr, "LeClientWriteCharacteristic"}, + FunctionInfo{3, nullptr, "LeClientWriteDescriptor"}, + FunctionInfo{4, nullptr, "LeClientRegisterNotification"}, + FunctionInfo{5, nullptr, "LeClientDeregisterNotification"}, + FunctionInfo{6, nullptr, "SetLeResponse"}, + FunctionInfo{7, nullptr, "LeSendIndication"}, + FunctionInfo{8, nullptr, "GetLeEventInfo"}, + FunctionInfo{9, C<&IBluetoothUser::RegisterBleEvent>, "RegisterBleEvent"} + ); KernelHelpers::ServiceContext service_context; - Kernel::KEvent* register_event; }; class IBluetoothDriver final : public ServiceFramework { public: - explicit IBluetoothDriver(Core::System& system_) : ServiceFramework{system_, "btdrv"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "InitializeBluetoothDriver"}, - {1, nullptr, "InitializeBluetooth"}, - {2, nullptr, "EnableBluetooth"}, - {3, nullptr, "DisableBluetooth"}, - {4, nullptr, "FinalizeBluetooth"}, - {5, nullptr, "GetAdapterProperties"}, - {6, nullptr, "GetAdapterProperty"}, - {7, nullptr, "SetAdapterProperty"}, - {8, nullptr, "StartInquiry"}, - {9, nullptr, "StopInquiry"}, - {10, nullptr, "CreateBond"}, - {11, nullptr, "RemoveBond"}, - {12, nullptr, "CancelBond"}, - {13, nullptr, "RespondToPinRequest"}, - {14, nullptr, "RespondToSspRequest"}, - {15, nullptr, "GetEventInfo"}, - {16, nullptr, "InitializeHid"}, - {17, nullptr, "OpenHidConnection"}, - {18, nullptr, "CloseHidConnection"}, - {19, nullptr, "WriteHidData"}, - {20, nullptr, "WriteHidData2"}, - {21, nullptr, "SetHidReport"}, - {22, nullptr, "GetHidReport"}, - {23, nullptr, "TriggerConnection"}, - {24, nullptr, "AddPairedDeviceInfo"}, - {25, nullptr, "GetPairedDeviceInfo"}, - {26, nullptr, "FinalizeHid"}, - {27, nullptr, "GetHidEventInfo"}, - {28, nullptr, "SetTsi"}, - {29, nullptr, "EnableBurstMode"}, - {30, nullptr, "SetZeroRetransmission"}, - {31, nullptr, "EnableMcMode"}, - {32, nullptr, "EnableLlrScan"}, - {33, nullptr, "DisableLlrScan"}, - {34, C<&IBluetoothDriver::EnableRadio>, "EnableRadio"}, - {35, nullptr, "SetVisibility"}, - {36, nullptr, "EnableTbfcScan"}, - {37, nullptr, "RegisterHidReportEvent"}, - {38, nullptr, "GetHidReportEventInfo"}, - {39, nullptr, "GetLatestPlr"}, - {40, nullptr, "GetPendingConnections"}, - {41, nullptr, "GetChannelMap"}, - {42, nullptr, "EnableTxPowerBoostSetting"}, - {43, nullptr, "IsTxPowerBoostSettingEnabled"}, - {44, nullptr, "EnableAfhSetting"}, - {45, nullptr, "IsAfhSettingEnabled"}, - {46, nullptr, "InitializeBle"}, - {47, nullptr, "EnableBle"}, - {48, nullptr, "DisableBle"}, - {49, nullptr, "FinalizeBle"}, - {50, nullptr, "SetBleVisibility"}, - {51, nullptr, "SetBleConnectionParameter"}, - {52, nullptr, "SetBleDefaultConnectionParameter"}, - {53, nullptr, "SetBleAdvertiseData"}, - {54, nullptr, "SetBleAdvertiseParameter"}, - {55, nullptr, "StartBleScan"}, - {56, nullptr, "StopBleScan"}, - {57, nullptr, "AddBleScanFilterCondition"}, - {58, nullptr, "DeleteBleScanFilterCondition"}, - {59, nullptr, "DeleteBleScanFilter"}, - {60, nullptr, "ClearBleScanFilters"}, - {61, nullptr, "EnableBleScanFilter"}, - {62, nullptr, "RegisterGattClient"}, - {63, nullptr, "UnregisterGattClient"}, - {64, nullptr, "UnregisterAllGattClients"}, - {65, nullptr, "ConnectGattServer"}, - {66, nullptr, "CancelConnectGattServer"}, - {67, nullptr, "DisconnectGattServer"}, - {68, nullptr, "GetGattAttribute"}, - {69, nullptr, "GetGattService"}, - {70, nullptr, "ConfigureAttMtu"}, - {71, nullptr, "RegisterGattServer"}, - {72, nullptr, "UnregisterGattServer"}, - {73, nullptr, "ConnectGattClient"}, - {74, nullptr, "DisconnectGattClient"}, - {75, nullptr, "AddGattService"}, - {76, nullptr, "EnableGattService"}, - {77, nullptr, "AddGattCharacteristic"}, - {78, nullptr, "AddGattDescriptor"}, - {79, nullptr, "GetBleManagedEventInfo"}, - {80, nullptr, "GetGattFirstCharacteristic"}, - {81, nullptr, "GetGattNextCharacteristic"}, - {82, nullptr, "GetGattFirstDescriptor"}, - {83, nullptr, "GetGattNextDescriptor"}, - {84, nullptr, "RegisterGattManagedDataPath"}, - {85, nullptr, "UnregisterGattManagedDataPath"}, - {86, nullptr, "RegisterGattHidDataPath"}, - {87, nullptr, "UnregisterGattHidDataPath"}, - {88, nullptr, "RegisterGattDataPath"}, - {89, nullptr, "UnregisterGattDataPath"}, - {90, nullptr, "ReadGattCharacteristic"}, - {91, nullptr, "ReadGattDescriptor"}, - {92, nullptr, "WriteGattCharacteristic"}, - {93, nullptr, "WriteGattDescriptor"}, - {94, nullptr, "RegisterGattNotification"}, - {95, nullptr, "UnregisterGattNotification"}, - {96, nullptr, "GetLeHidEventInfo"}, - {97, nullptr, "RegisterBleHidEvent"}, - {98, nullptr, "SetBleScanParameter"}, - {99, nullptr, "MoveToSecondaryPiconet"}, - {100, nullptr, "IsBluetoothEnabled"}, - {128, nullptr, "AcquireAudioEvent"}, - {129, nullptr, "GetAudioEventInfo"}, - {130, nullptr, "OpenAudioConnection"}, - {131, nullptr, "CloseAudioConnection"}, - {132, nullptr, "OpenAudioOut"}, - {133, nullptr, "CloseAudioOut"}, - {134, nullptr, "AcquireAudioOutStateChangedEvent"}, - {135, nullptr, "StartAudioOut"}, - {136, nullptr, "StopAudioOut"}, - {137, nullptr, "GetAudioOutState"}, - {138, nullptr, "GetAudioOutFeedingCodec"}, - {139, nullptr, "GetAudioOutFeedingParameter"}, - {140, nullptr, "AcquireAudioOutBufferAvailableEvent"}, - {141, nullptr, "SendAudioData"}, - {142, nullptr, "AcquireAudioControlInputStateChangedEvent"}, - {143, nullptr, "GetAudioControlInputState"}, - {144, nullptr, "AcquireAudioConnectionStateChangedEvent"}, - {145, nullptr, "GetConnectedAudioDevice"}, - {146, nullptr, "CloseAudioControlInput"}, - {147, nullptr, "RegisterAudioControlNotification"}, - {148, nullptr, "SendAudioControlPassthroughCommand"}, - {149, nullptr, "SendAudioControlSetAbsoluteVolumeCommand"}, - {150, nullptr, "AcquireAudioSinkVolumeLocallyChangedEvent"}, - {151, nullptr, "AcquireAudioSinkVolumeUpdateRequestCompletedEvent"}, - {152, nullptr, "GetAudioSinkVolume"}, - {153, nullptr, "RequestUpdateAudioSinkVolume"}, - {154, nullptr, "IsAudioSinkVolumeSupported"}, - {256, nullptr, "IsManufacturingMode"}, - {257, nullptr, "EmulateBluetoothCrash"}, - {258, nullptr, "GetBleChannelMap"}, - }; - // clang-format on + explicit IBluetoothDriver(Core::System& system_) : ServiceFramework{system_, "btdrv"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -204,6 +70,140 @@ private: LOG_WARNING(Service_BTDRV, "(STUBBED) called"); R_SUCCEED(); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "InitializeBluetoothDriver"}, + FunctionInfo{1, nullptr, "InitializeBluetooth"}, + FunctionInfo{2, nullptr, "EnableBluetooth"}, + FunctionInfo{3, nullptr, "DisableBluetooth"}, + FunctionInfo{4, nullptr, "FinalizeBluetooth"}, + FunctionInfo{5, nullptr, "GetAdapterProperties"}, + FunctionInfo{6, nullptr, "GetAdapterProperty"}, + FunctionInfo{7, nullptr, "SetAdapterProperty"}, + FunctionInfo{8, nullptr, "StartInquiry"}, + FunctionInfo{9, nullptr, "StopInquiry"}, + FunctionInfo{10, nullptr, "CreateBond"}, + FunctionInfo{11, nullptr, "RemoveBond"}, + FunctionInfo{12, nullptr, "CancelBond"}, + FunctionInfo{13, nullptr, "RespondToPinRequest"}, + FunctionInfo{14, nullptr, "RespondToSspRequest"}, + FunctionInfo{15, nullptr, "GetEventInfo"}, + FunctionInfo{16, nullptr, "InitializeHid"}, + FunctionInfo{17, nullptr, "OpenHidConnection"}, + FunctionInfo{18, nullptr, "CloseHidConnection"}, + FunctionInfo{19, nullptr, "WriteHidData"}, + FunctionInfo{20, nullptr, "WriteHidData2"}, + FunctionInfo{21, nullptr, "SetHidReport"}, + FunctionInfo{22, nullptr, "GetHidReport"}, + FunctionInfo{23, nullptr, "TriggerConnection"}, + FunctionInfo{24, nullptr, "AddPairedDeviceInfo"}, + FunctionInfo{25, nullptr, "GetPairedDeviceInfo"}, + FunctionInfo{26, nullptr, "FinalizeHid"}, + FunctionInfo{27, nullptr, "GetHidEventInfo"}, + FunctionInfo{28, nullptr, "SetTsi"}, + FunctionInfo{29, nullptr, "EnableBurstMode"}, + FunctionInfo{30, nullptr, "SetZeroRetransmission"}, + FunctionInfo{31, nullptr, "EnableMcMode"}, + FunctionInfo{32, nullptr, "EnableLlrScan"}, + FunctionInfo{33, nullptr, "DisableLlrScan"}, + FunctionInfo{34, C<&IBluetoothDriver::EnableRadio>, "EnableRadio"}, + FunctionInfo{35, nullptr, "SetVisibility"}, + FunctionInfo{36, nullptr, "EnableTbfcScan"}, + FunctionInfo{37, nullptr, "RegisterHidReportEvent"}, + FunctionInfo{38, nullptr, "GetHidReportEventInfo"}, + FunctionInfo{39, nullptr, "GetLatestPlr"}, + FunctionInfo{40, nullptr, "GetPendingConnections"}, + FunctionInfo{41, nullptr, "GetChannelMap"}, + FunctionInfo{42, nullptr, "EnableTxPowerBoostSetting"}, + FunctionInfo{43, nullptr, "IsTxPowerBoostSettingEnabled"}, + FunctionInfo{44, nullptr, "EnableAfhSetting"}, + FunctionInfo{45, nullptr, "IsAfhSettingEnabled"}, + FunctionInfo{46, nullptr, "InitializeBle"}, + FunctionInfo{47, nullptr, "EnableBle"}, + FunctionInfo{48, nullptr, "DisableBle"}, + FunctionInfo{49, nullptr, "FinalizeBle"}, + FunctionInfo{50, nullptr, "SetBleVisibility"}, + FunctionInfo{51, nullptr, "SetBleConnectionParameter"}, + FunctionInfo{52, nullptr, "SetBleDefaultConnectionParameter"}, + FunctionInfo{53, nullptr, "SetBleAdvertiseData"}, + FunctionInfo{54, nullptr, "SetBleAdvertiseParameter"}, + FunctionInfo{55, nullptr, "StartBleScan"}, + FunctionInfo{56, nullptr, "StopBleScan"}, + FunctionInfo{57, nullptr, "AddBleScanFilterCondition"}, + FunctionInfo{58, nullptr, "DeleteBleScanFilterCondition"}, + FunctionInfo{59, nullptr, "DeleteBleScanFilter"}, + FunctionInfo{60, nullptr, "ClearBleScanFilters"}, + FunctionInfo{61, nullptr, "EnableBleScanFilter"}, + FunctionInfo{62, nullptr, "RegisterGattClient"}, + FunctionInfo{63, nullptr, "UnregisterGattClient"}, + FunctionInfo{64, nullptr, "UnregisterAllGattClients"}, + FunctionInfo{65, nullptr, "ConnectGattServer"}, + FunctionInfo{66, nullptr, "CancelConnectGattServer"}, + FunctionInfo{67, nullptr, "DisconnectGattServer"}, + FunctionInfo{68, nullptr, "GetGattAttribute"}, + FunctionInfo{69, nullptr, "GetGattService"}, + FunctionInfo{70, nullptr, "ConfigureAttMtu"}, + FunctionInfo{71, nullptr, "RegisterGattServer"}, + FunctionInfo{72, nullptr, "UnregisterGattServer"}, + FunctionInfo{73, nullptr, "ConnectGattClient"}, + FunctionInfo{74, nullptr, "DisconnectGattClient"}, + FunctionInfo{75, nullptr, "AddGattService"}, + FunctionInfo{76, nullptr, "EnableGattService"}, + FunctionInfo{77, nullptr, "AddGattCharacteristic"}, + FunctionInfo{78, nullptr, "AddGattDescriptor"}, + FunctionInfo{79, nullptr, "GetBleManagedEventInfo"}, + FunctionInfo{80, nullptr, "GetGattFirstCharacteristic"}, + FunctionInfo{81, nullptr, "GetGattNextCharacteristic"}, + FunctionInfo{82, nullptr, "GetGattFirstDescriptor"}, + FunctionInfo{83, nullptr, "GetGattNextDescriptor"}, + FunctionInfo{84, nullptr, "RegisterGattManagedDataPath"}, + FunctionInfo{85, nullptr, "UnregisterGattManagedDataPath"}, + FunctionInfo{86, nullptr, "RegisterGattHidDataPath"}, + FunctionInfo{87, nullptr, "UnregisterGattHidDataPath"}, + FunctionInfo{88, nullptr, "RegisterGattDataPath"}, + FunctionInfo{89, nullptr, "UnregisterGattDataPath"}, + FunctionInfo{90, nullptr, "ReadGattCharacteristic"}, + FunctionInfo{91, nullptr, "ReadGattDescriptor"}, + FunctionInfo{92, nullptr, "WriteGattCharacteristic"}, + FunctionInfo{93, nullptr, "WriteGattDescriptor"}, + FunctionInfo{94, nullptr, "RegisterGattNotification"}, + FunctionInfo{95, nullptr, "UnregisterGattNotification"}, + FunctionInfo{96, nullptr, "GetLeHidEventInfo"}, + FunctionInfo{97, nullptr, "RegisterBleHidEvent"}, + FunctionInfo{98, nullptr, "SetBleScanParameter"}, + FunctionInfo{99, nullptr, "MoveToSecondaryPiconet"}, + FunctionInfo{100, nullptr, "IsBluetoothEnabled"}, + FunctionInfo{128, nullptr, "AcquireAudioEvent"}, + FunctionInfo{129, nullptr, "GetAudioEventInfo"}, + FunctionInfo{130, nullptr, "OpenAudioConnection"}, + FunctionInfo{131, nullptr, "CloseAudioConnection"}, + FunctionInfo{132, nullptr, "OpenAudioOut"}, + FunctionInfo{133, nullptr, "CloseAudioOut"}, + FunctionInfo{134, nullptr, "AcquireAudioOutStateChangedEvent"}, + FunctionInfo{135, nullptr, "StartAudioOut"}, + FunctionInfo{136, nullptr, "StopAudioOut"}, + FunctionInfo{137, nullptr, "GetAudioOutState"}, + FunctionInfo{138, nullptr, "GetAudioOutFeedingCodec"}, + FunctionInfo{139, nullptr, "GetAudioOutFeedingParameter"}, + FunctionInfo{140, nullptr, "AcquireAudioOutBufferAvailableEvent"}, + FunctionInfo{141, nullptr, "SendAudioData"}, + FunctionInfo{142, nullptr, "AcquireAudioControlInputStateChangedEvent"}, + FunctionInfo{143, nullptr, "GetAudioControlInputState"}, + FunctionInfo{144, nullptr, "AcquireAudioConnectionStateChangedEvent"}, + FunctionInfo{145, nullptr, "GetConnectedAudioDevice"}, + FunctionInfo{146, nullptr, "CloseAudioControlInput"}, + FunctionInfo{147, nullptr, "RegisterAudioControlNotification"}, + FunctionInfo{148, nullptr, "SendAudioControlPassthroughCommand"}, + FunctionInfo{149, nullptr, "SendAudioControlSetAbsoluteVolumeCommand"}, + FunctionInfo{150, nullptr, "AcquireAudioSinkVolumeLocallyChangedEvent"}, + FunctionInfo{151, nullptr, "AcquireAudioSinkVolumeUpdateRequestCompletedEvent"}, + FunctionInfo{152, nullptr, "GetAudioSinkVolume"}, + FunctionInfo{153, nullptr, "RequestUpdateAudioSinkVolume"}, + FunctionInfo{154, nullptr, "IsAudioSinkVolumeSupported"}, + FunctionInfo{256, nullptr, "IsManufacturingMode"}, + FunctionInfo{257, nullptr, "EmulateBluetoothCrash"}, + FunctionInfo{258, nullptr, "GetBleChannelMap"} + ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/btm/btm.cpp b/src/core/hle/service/btm/btm.cpp index 327c2d2ddb..e8fa29af7c 100644 --- a/src/core/hle/service/btm/btm.cpp +++ b/src/core/hle/service/btm/btm.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project @@ -6,111 +6,414 @@ #include +#include "common/logging.h" +#include "core/hle/service/cmif_serialization.h" +#include "core/hle/service/set/system_settings_server.h" +#include "core/hle/service/sm/sm.h" #include "core/hle/service/btm/btm.h" -#include "core/hle/service/btm/btm_debug.h" -#include "core/hle/service/btm/btm_system.h" -#include "core/hle/service/btm/btm_user.h" #include "core/hle/service/server_manager.h" #include "core/hle/service/service.h" +namespace Kernel { +class KEvent; +class KReadableEvent; +} // namespace Kernel + +namespace Core { +class System; +} + +namespace Service::Set { +class ISystemSettingsServer; +} + namespace Service::BTM { +class IBtmSystemCore final : public ServiceFramework { +public: + explicit IBtmSystemCore(Core::System& system_) + : ServiceFramework{system_, "IBtmSystemCore"}, service_context{system_, "IBtmSystemCore"} { + radio_event = service_context.CreateEvent("IBtmSystemCore:RadioEvent"); + audio_device_connection_event = service_context.CreateEvent("IBtmSystemCore:AudioDeviceConnectionEvent"); + m_set_sys = system.ServiceManager().GetService("set:sys", true); + } + + ~IBtmSystemCore() override { + service_context.CloseEvent(radio_event); + service_context.CloseEvent(audio_device_connection_event); + } + + Result StartGamepadPairing() { + LOG_WARNING(Service_BTM, "(STUBBED) called"); + R_SUCCEED(); + } + + Result CancelGamepadPairing() { + LOG_WARNING(Service_BTM, "(STUBBED) called"); + R_SUCCEED(); + } + + Result EnableRadio() { + LOG_DEBUG(Service_BTM, "called"); + + R_RETURN(m_set_sys->SetBluetoothEnableFlag(true)); + } + Result DisableRadio() { + LOG_DEBUG(Service_BTM, "called"); + + R_RETURN(m_set_sys->SetBluetoothEnableFlag(false)); + } + + Result IsRadioEnabled(Out out_is_enabled) { + LOG_DEBUG(Service_BTM, "called"); + + R_RETURN(m_set_sys->GetBluetoothEnableFlag(out_is_enabled)); + } + + Result AcquireRadioEvent(Out out_is_valid, + OutCopyHandle out_event) { + LOG_WARNING(Service_BTM, "(STUBBED) called"); + + *out_is_valid = true; + *out_event = &radio_event->GetReadableEvent(); + R_SUCCEED(); + } + + Result GetDiscoveredAudioDevice(OutArray, BufferAttr_HipcPointer> out_audio_devices, s32 count, Out out_total) { + LOG_WARNING(Service_BTM, "(STUBBED) called"); + R_SUCCEED(); + } + + Result AcquireAudioDeviceConnectionEvent( + OutCopyHandle out_event) { + LOG_WARNING(Service_BTM, "(STUBBED) called"); + + *out_event = &audio_device_connection_event->GetReadableEvent(); + R_SUCCEED(); + } + + Result GetConnectedAudioDevices( + Out out_count, OutArray, BufferAttr_HipcPointer> out_audio_devices) { + LOG_WARNING(Service_BTM, "(STUBBED) called"); + + *out_count = 0; + R_SUCCEED(); + } + + Result GetPairedAudioDevices( + Out out_count, OutArray, BufferAttr_HipcPointer> out_audio_devices) { + LOG_WARNING(Service_BTM, "(STUBBED) called"); + + *out_count = 0; + R_SUCCEED(); + } + + Result RequestAudioDeviceConnectionRejection(ClientAppletResourceUserId aruid) { + LOG_WARNING(Service_BTM, "(STUBBED) called, applet_resource_user_id={}", aruid.pid); + R_SUCCEED(); + } + + Result CancelAudioDeviceConnectionRejection(ClientAppletResourceUserId aruid) { + LOG_WARNING(Service_BTM, "(STUBBED) called, applet_resource_user_id={}", aruid.pid); + R_SUCCEED(); + } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, C<&IBtmSystemCore::StartGamepadPairing>, "StartGamepadPairing"}, + FunctionInfo{1, C<&IBtmSystemCore::CancelGamepadPairing>, "CancelGamepadPairing"}, + FunctionInfo{2, nullptr, "ClearGamepadPairingDatabase"}, + FunctionInfo{3, nullptr, "GetPairedGamepadCount"}, + FunctionInfo{4, C<&IBtmSystemCore::EnableRadio>, "EnableRadio"}, + FunctionInfo{5, C<&IBtmSystemCore::DisableRadio>, "DisableRadio"}, + FunctionInfo{6, C<&IBtmSystemCore::IsRadioEnabled>, "IsRadioEnabled"}, + FunctionInfo{7, C<&IBtmSystemCore::AcquireRadioEvent>, "AcquireRadioEvent"}, + FunctionInfo{8, nullptr, "AcquireGamepadPairingEvent"}, + FunctionInfo{9, nullptr, "IsGamepadPairingStarted"}, + FunctionInfo{10, nullptr, "StartAudioDeviceDiscovery"}, + FunctionInfo{11, nullptr, "StopAudioDeviceDiscovery"}, + FunctionInfo{12, nullptr, "IsDiscoveryingAudioDevice"}, + FunctionInfo{13, C<&IBtmSystemCore::GetDiscoveredAudioDevice>, "GetDiscoveredAudioDevice"}, + FunctionInfo{14, C<&IBtmSystemCore::AcquireAudioDeviceConnectionEvent>, "AcquireAudioDeviceConnectionEvent"}, + FunctionInfo{15, nullptr, "ConnectAudioDevice"}, + FunctionInfo{16, nullptr, "IsConnectingAudioDevice"}, + FunctionInfo{17, C<&IBtmSystemCore::GetConnectedAudioDevices>, "GetConnectedAudioDevices"}, + FunctionInfo{18, nullptr, "DisconnectAudioDevice"}, + FunctionInfo{19, nullptr, "AcquirePairedAudioDeviceInfoChangedEvent"}, + FunctionInfo{20, C<&IBtmSystemCore::GetPairedAudioDevices>, "GetPairedAudioDevices"}, + FunctionInfo{21, nullptr, "RemoveAudioDevicePairing"}, + FunctionInfo{22, C<&IBtmSystemCore::RequestAudioDeviceConnectionRejection>, "RequestAudioDeviceConnectionRejection"}, + FunctionInfo{23, C<&IBtmSystemCore::CancelAudioDeviceConnectionRejection>, "CancelAudioDeviceConnectionRejection"} + ); + KernelHelpers::ServiceContext service_context; + Kernel::KEvent* radio_event; + Kernel::KEvent* audio_device_connection_event; + std::shared_ptr m_set_sys; +}; + +class IBtmSystem final : public ServiceFramework { +public: + explicit IBtmSystem(Core::System& system_) : ServiceFramework{system_, "btm:sys"} {} + ~IBtmSystem() override = default; + + Result GetCore(OutInterface out_interface) { + LOG_WARNING(Service_BTM, "called"); + + *out_interface = std::make_shared(system); + R_SUCCEED(); + } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, C<&IBtmSystem::GetCore>, "GetCore"} + ); +}; + +class IBtmUserCore final : public ServiceFramework { +public: + explicit IBtmUserCore(Core::System& system_) + : ServiceFramework{system_, "IBtmUserCore"}, service_context{system_, "IBtmUserCore"} { + scan_event = service_context.CreateEvent("IBtmUserCore:ScanEvent"); + connection_event = service_context.CreateEvent("IBtmUserCore:ConnectionEvent"); + service_discovery_event = service_context.CreateEvent("IBtmUserCore:DiscoveryEvent"); + config_event = service_context.CreateEvent("IBtmUserCore:ConfigEvent"); + } + + ~IBtmUserCore() override { + service_context.CloseEvent(scan_event); + service_context.CloseEvent(connection_event); + service_context.CloseEvent(service_discovery_event); + service_context.CloseEvent(config_event); + } + + Result AcquireBleScanEvent(Out out_is_valid, + OutCopyHandle out_event) { + LOG_WARNING(Service_BTM, "(STUBBED) called"); + + *out_is_valid = true; + *out_event = &scan_event->GetReadableEvent(); + R_SUCCEED(); + } + + Result AcquireBleConnectionEvent(Out out_is_valid, + OutCopyHandle out_event) { + LOG_WARNING(Service_BTM, "(STUBBED) called"); + + *out_is_valid = true; + *out_event = &connection_event->GetReadableEvent(); + R_SUCCEED(); + } + + Result AcquireBleServiceDiscoveryEvent( + Out out_is_valid, OutCopyHandle out_event) { + LOG_WARNING(Service_BTM, "(STUBBED) called"); + + *out_is_valid = true; + *out_event = &service_discovery_event->GetReadableEvent(); + R_SUCCEED(); + } + + Result AcquireBleMtuConfigEvent(Out out_is_valid, + OutCopyHandle out_event) { + LOG_WARNING(Service_BTM, "(STUBBED) called"); + + *out_is_valid = true; + *out_event = &config_event->GetReadableEvent(); + R_SUCCEED(); + } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, C<&IBtmUserCore::AcquireBleScanEvent>, "AcquireBleScanEvent"}, + FunctionInfo{1, nullptr, "GetBleScanFilterParameter"}, + FunctionInfo{2, nullptr, "GetBleScanFilterParameter2"}, + FunctionInfo{3, nullptr, "StartBleScanForGeneral"}, + FunctionInfo{4, nullptr, "StopBleScanForGeneral"}, + FunctionInfo{5, nullptr, "GetBleScanResultsForGeneral"}, + FunctionInfo{6, nullptr, "StartBleScanForPaired"}, + FunctionInfo{7, nullptr, "StopBleScanForPaired"}, + FunctionInfo{8, nullptr, "StartBleScanForSmartDevice"}, + FunctionInfo{9, nullptr, "StopBleScanForSmartDevice"}, + FunctionInfo{10, nullptr, "GetBleScanResultsForSmartDevice"}, + FunctionInfo{17, C<&IBtmUserCore::AcquireBleConnectionEvent>, "AcquireBleConnectionEvent"}, + FunctionInfo{18, nullptr, "BleConnect"}, + FunctionInfo{19, nullptr, "BleDisconnect"}, + FunctionInfo{20, nullptr, "BleGetConnectionState"}, + FunctionInfo{21, nullptr, "AcquireBlePairingEvent"}, + FunctionInfo{22, nullptr, "BlePairDevice"}, + FunctionInfo{23, nullptr, "BleUnPairDevice"}, + FunctionInfo{24, nullptr, "BleUnPairDevice2"}, + FunctionInfo{25, nullptr, "BleGetPairedDevices"}, + FunctionInfo{26, C<&IBtmUserCore::AcquireBleServiceDiscoveryEvent>, "AcquireBleServiceDiscoveryEvent"}, + FunctionInfo{27, nullptr, "GetGattServices"}, + FunctionInfo{28, nullptr, "GetGattService"}, + FunctionInfo{29, nullptr, "GetGattIncludedServices"}, + FunctionInfo{30, nullptr, "GetBelongingGattService"}, + FunctionInfo{31, nullptr, "GetGattCharacteristics"}, + FunctionInfo{32, nullptr, "GetGattDescriptors"}, + FunctionInfo{33, C<&IBtmUserCore::AcquireBleMtuConfigEvent>, "AcquireBleMtuConfigEvent"}, + FunctionInfo{34, nullptr, "ConfigureBleMtu"}, + FunctionInfo{35, nullptr, "GetBleMtu"}, + FunctionInfo{36, nullptr, "RegisterBleGattDataPath"}, + FunctionInfo{37, nullptr, "UnregisterBleGattDataPath"} + ); + KernelHelpers::ServiceContext service_context; + Kernel::KEvent* scan_event; + Kernel::KEvent* connection_event; + Kernel::KEvent* service_discovery_event; + Kernel::KEvent* config_event; +}; + +class IBtmUser final : public ServiceFramework { +public: + explicit IBtmUser(Core::System& system_) : ServiceFramework{system_, "btm:u"} {} + ~IBtmUser() override = default; + + Result GetCore(OutInterface out_interface) { + LOG_WARNING(Service_BTM, "called"); + + *out_interface = std::make_shared(system); + R_SUCCEED(); + } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, C<&IBtmUser::GetCore>, "GetCore"} + ); +}; + +class IBtmDebug final : public ServiceFramework { +public: + explicit IBtmDebug(Core::System& system_) : ServiceFramework{system_, "btm:dbg"} {} + ~IBtmDebug() override = default; + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "AcquireDiscoveryEvent"}, + FunctionInfo{1, nullptr, "StartDiscovery"}, + FunctionInfo{2, nullptr, "CancelDiscovery"}, + FunctionInfo{3, nullptr, "GetDeviceProperty"}, + FunctionInfo{4, nullptr, "CreateBond"}, + FunctionInfo{5, nullptr, "CancelBond"}, + FunctionInfo{6, nullptr, "SetTsiMode"}, + FunctionInfo{7, nullptr, "GeneralTest"}, + FunctionInfo{8, nullptr, "HidConnect"}, + FunctionInfo{9, nullptr, "GeneralGet", MakeVersionGate({5,0,0})}, + FunctionInfo{10, nullptr, "GetGattClientDisconnectionReason", MakeVersionGate({5,0,0})}, + FunctionInfo{11, nullptr, "GetBleConnectionParameter", MakeVersionGate({5,1,0})}, + FunctionInfo{12, nullptr, "GetBleConnectionParameterRequest", MakeVersionGate({5,1,0})}, + FunctionInfo{13, nullptr, "GetDiscoveredDevice", MakeVersionGate({12,0,0})}, + FunctionInfo{14, nullptr, "SleepAwakeLoopTest", MakeVersionGate({15,0,0})}, + FunctionInfo{15, nullptr, "SleepTest", MakeVersionGate({15,0,0})}, + FunctionInfo{16, nullptr, "MinimumAwakeTest", MakeVersionGate({15,0,0})}, + FunctionInfo{17, nullptr, "ForceEnableBtm", MakeVersionGate({15,0,0})} + ); +}; + class IBtm final : public ServiceFramework { public: - explicit IBtm(Core::System& system_) : ServiceFramework{system_, "btm"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetState"}, - {1, nullptr, "GetHostDeviceProperty"}, - {2, nullptr, "AcquireDeviceConditionEvent"}, - {3, nullptr, "GetDeviceCondition"}, - {4, nullptr, "SetBurstMode"}, - {5, nullptr, "SetSlotMode"}, - {6, nullptr, "SetBluetoothMode"}, - {7, nullptr, "SetWlanMode"}, - {8, nullptr, "AcquireDeviceInfoEvent"}, - {9, nullptr, "GetDeviceInfo"}, - {10, nullptr, "AddDeviceInfo"}, - {11, nullptr, "RemoveDeviceInfo"}, - {12, nullptr, "IncreaseDeviceInfoOrder"}, - {13, nullptr, "LlrNotify"}, - {14, nullptr, "EnableRadio"}, - {15, nullptr, "DisableRadio"}, - {16, nullptr, "HidDisconnect"}, - {17, nullptr, "HidSetRetransmissionMode"}, - {18, nullptr, "AcquireAwakeReqEvent"}, - {19, nullptr, "AcquireLlrStateEvent"}, - {20, nullptr, "IsLlrStarted"}, - {21, nullptr, "EnableSlotSaving"}, - {22, nullptr, "ProtectDeviceInfo"}, - {23, nullptr, "AcquireBleScanEvent"}, - {24, nullptr, "GetBleScanParameterGeneral"}, - {25, nullptr, "GetBleScanParameterSmartDevice"}, - {26, nullptr, "StartBleScanForGeneral"}, - {27, nullptr, "StopBleScanForGeneral"}, - {28, nullptr, "GetBleScanResultsForGeneral"}, - {29, nullptr, "StartBleScanForPairedDevice"}, - {30, nullptr, "StopBleScanForPairedDevice"}, - {31, nullptr, "StartBleScanForSmartDevice"}, - {32, nullptr, "StopBleScanForSmartDevice"}, - {33, nullptr, "GetBleScanResultsForSmartDevice"}, - {34, nullptr, "AcquireBleConnectionEvent"}, - {35, nullptr, "BleConnect"}, - {36, nullptr, "BleOverrideConnection"}, - {37, nullptr, "BleDisconnect"}, - {38, nullptr, "BleGetConnectionState"}, - {39, nullptr, "BleGetGattClientConditionList"}, - {40, nullptr, "AcquireBlePairingEvent"}, - {41, nullptr, "BlePairDevice"}, - {42, nullptr, "BleUnpairDeviceOnBoth"}, - {43, nullptr, "BleUnpairDevice"}, - {44, nullptr, "BleGetPairedAddresses"}, - {45, nullptr, "AcquireBleServiceDiscoveryEvent"}, - {46, nullptr, "GetGattServices"}, - {47, nullptr, "GetGattService"}, - {48, nullptr, "GetGattIncludedServices"}, - {49, nullptr, "GetBelongingService"}, - {50, nullptr, "GetGattCharacteristics"}, - {51, nullptr, "GetGattDescriptors"}, - {52, nullptr, "AcquireBleMtuConfigEvent"}, - {53, nullptr, "ConfigureBleMtu"}, - {54, nullptr, "GetBleMtu"}, - {55, nullptr, "RegisterBleGattDataPath"}, - {56, nullptr, "UnregisterBleGattDataPath"}, - {57, nullptr, "RegisterAppletResourceUserId"}, - {58, nullptr, "UnregisterAppletResourceUserId"}, - {59, nullptr, "SetAppletResourceUserId"}, - {60, nullptr, "AcquireBleConnectionParameterUpdateEvent"}, //8.0.0+ - {61, nullptr, "SetCeLength"}, //8.0.0+ - {62, nullptr, "EnsureSlotExpansion"}, //9.0.0+ - {63, nullptr, "IsSlotExpansionEnsured"}, //9.0.0+ - {64, nullptr, "CancelConnectionTrigger"}, //10.0.0+ - {65, nullptr, "GetConnectionCapacity"}, //13.0.0+ - {66, nullptr, "GetWlanMode"}, //13.0.0+ - {67, nullptr, "IsSlotSavingEnabled"}, //13.0.0+ - {68, nullptr, "IsSlotSavingForPairingEnabled"}, //13.0.0+ - {69, nullptr, "AcquireAudioDeviceConnectionEvent"}, //13.0.0+ - {70, nullptr, "GetConnectedAudioDevices"}, //13.0.0+ - {71, nullptr, "SetAudioSourceVolume"}, //13.0.0+ - {72, nullptr, "GetAudioSourceVolume"}, //13.0.0+ - {73, nullptr, "RequestAudioDeviceConnectionRejection"}, //13.0.0+ - {74, nullptr, "CancelAudioDeviceConnectionRejection"}, //13.0.0+ - {75, nullptr, "GetPairedAudioDevices"}, //13.0.0+ - {76, nullptr, "SetWlanModeWithOption"}, //13.1.0+ - {100, nullptr, "AcquireConnectionDisallowedEvent"}, //13.0.0+ - {101, nullptr, "GetUsecaseViolationFactor"}, //13.0.0+ - {110, nullptr, "GetShortenedDeviceInfo"}, //13.0.0+ - {111, nullptr, "AcquirePairingCountUpdateEvent"},//13.0.0+ - {112, nullptr, "Unknown112"}, //14.0.0-14.1.2 - {113, nullptr, "Unknown113"}, //14.0.0-14.1.2 - {114, nullptr, "IsFirstAudioControlConnection"}, //14.0.0+ - {115, nullptr, "GetShortenedDeviceCondition"}, //14.0.0+ - {116, nullptr, "SetAudioSinkVolume"}, //15.0.0+ - {117, nullptr, "GetAudioSinkVolume"}, //15.0.0+ - }; - // clang-format on + explicit IBtm(Core::System& system_) : ServiceFramework{system_, "btm"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetState"}, + FunctionInfo{1, nullptr, "GetHostDeviceProperty"}, + FunctionInfo{2, nullptr, "AcquireDeviceConditionEvent"}, + FunctionInfo{3, nullptr, "GetDeviceCondition"}, + FunctionInfo{4, nullptr, "SetBurstMode"}, + FunctionInfo{5, nullptr, "SetSlotMode"}, + FunctionInfo{6, nullptr, "SetBluetoothMode"}, + FunctionInfo{7, nullptr, "SetWlanMode"}, + FunctionInfo{8, nullptr, "AcquireDeviceInfoEvent"}, + FunctionInfo{9, nullptr, "GetDeviceInfo"}, + FunctionInfo{10, nullptr, "AddDeviceInfo"}, + FunctionInfo{11, nullptr, "RemoveDeviceInfo"}, + FunctionInfo{12, nullptr, "IncreaseDeviceInfoOrder"}, + FunctionInfo{13, nullptr, "LlrNotify"}, + FunctionInfo{14, nullptr, "EnableRadio"}, + FunctionInfo{15, nullptr, "DisableRadio"}, + FunctionInfo{16, nullptr, "HidDisconnect"}, + FunctionInfo{17, nullptr, "HidSetRetransmissionMode"}, + FunctionInfo{18, nullptr, "AcquireAwakeReqEvent"}, + FunctionInfo{19, nullptr, "AcquireLlrStateEvent"}, + FunctionInfo{20, nullptr, "IsLlrStarted"}, + FunctionInfo{21, nullptr, "EnableSlotSaving"}, + FunctionInfo{22, nullptr, "ProtectDeviceInfo"}, + FunctionInfo{23, nullptr, "AcquireBleScanEvent"}, + FunctionInfo{24, nullptr, "GetBleScanParameterGeneral"}, + FunctionInfo{25, nullptr, "GetBleScanParameterSmartDevice"}, + FunctionInfo{26, nullptr, "StartBleScanForGeneral"}, + FunctionInfo{27, nullptr, "StopBleScanForGeneral"}, + FunctionInfo{28, nullptr, "GetBleScanResultsForGeneral"}, + FunctionInfo{29, nullptr, "StartBleScanForPairedDevice"}, + FunctionInfo{30, nullptr, "StopBleScanForPairedDevice"}, + FunctionInfo{31, nullptr, "StartBleScanForSmartDevice"}, + FunctionInfo{32, nullptr, "StopBleScanForSmartDevice"}, + FunctionInfo{33, nullptr, "GetBleScanResultsForSmartDevice"}, + FunctionInfo{34, nullptr, "AcquireBleConnectionEvent"}, + FunctionInfo{35, nullptr, "BleConnect"}, + FunctionInfo{36, nullptr, "BleOverrideConnection"}, + FunctionInfo{37, nullptr, "BleDisconnect"}, + FunctionInfo{38, nullptr, "BleGetConnectionState"}, + FunctionInfo{39, nullptr, "BleGetGattClientConditionList"}, + FunctionInfo{40, nullptr, "AcquireBlePairingEvent"}, + FunctionInfo{41, nullptr, "BlePairDevice"}, + FunctionInfo{42, nullptr, "BleUnpairDeviceOnBoth"}, + FunctionInfo{43, nullptr, "BleUnpairDevice"}, + FunctionInfo{44, nullptr, "BleGetPairedAddresses"}, + FunctionInfo{45, nullptr, "AcquireBleServiceDiscoveryEvent"}, + FunctionInfo{46, nullptr, "GetGattServices"}, + FunctionInfo{47, nullptr, "GetGattService"}, + FunctionInfo{48, nullptr, "GetGattIncludedServices"}, + FunctionInfo{49, nullptr, "GetBelongingService"}, + FunctionInfo{50, nullptr, "GetGattCharacteristics"}, + FunctionInfo{51, nullptr, "GetGattDescriptors"}, + FunctionInfo{52, nullptr, "AcquireBleMtuConfigEvent"}, + FunctionInfo{53, nullptr, "ConfigureBleMtu"}, + FunctionInfo{54, nullptr, "GetBleMtu"}, + FunctionInfo{55, nullptr, "RegisterBleGattDataPath"}, + FunctionInfo{56, nullptr, "UnregisterBleGattDataPath"}, + FunctionInfo{57, nullptr, "RegisterAppletResourceUserId"}, + FunctionInfo{58, nullptr, "UnregisterAppletResourceUserId"}, + FunctionInfo{59, nullptr, "SetAppletResourceUserId"}, + FunctionInfo{60, nullptr, "AcquireBleConnectionParameterUpdateEvent", MakeVersionGate({8,0,0})}, + FunctionInfo{61, nullptr, "SetCeLength", MakeVersionGate({8,0,0})}, + FunctionInfo{62, nullptr, "EnsureSlotExpansion", MakeVersionGate({9,0,0})}, + FunctionInfo{63, nullptr, "IsSlotExpansionEnsured", MakeVersionGate({9,0,0})}, + FunctionInfo{64, nullptr, "CancelConnectionTrigger", MakeVersionGate({10,0,0})}, + FunctionInfo{65, nullptr, "GetConnectionCapacity", MakeVersionGate({13,0,0})}, + FunctionInfo{66, nullptr, "GetWlanMode", MakeVersionGate({13,0,0})}, + FunctionInfo{67, nullptr, "IsSlotSavingEnabled", MakeVersionGate({13,0,0})}, + FunctionInfo{68, nullptr, "IsSlotSavingForPairingEnabled", MakeVersionGate({13,0,0})}, + FunctionInfo{69, nullptr, "AcquireAudioDeviceConnectionEvent", MakeVersionGate({13,0,0})}, + FunctionInfo{70, nullptr, "GetConnectedAudioDevices", MakeVersionGate({13,0,0})}, + FunctionInfo{71, nullptr, "SetAudioSourceVolume", MakeVersionGate({13,0,0})}, + FunctionInfo{72, nullptr, "GetAudioSourceVolume", MakeVersionGate({13,0,0})}, + FunctionInfo{73, nullptr, "RequestAudioDeviceConnectionRejection", MakeVersionGate({13,0,0})}, + FunctionInfo{74, nullptr, "CancelAudioDeviceConnectionRejection", MakeVersionGate({13,0,0})}, + FunctionInfo{75, nullptr, "GetPairedAudioDevices", MakeVersionGate({13,0,0})}, + FunctionInfo{76, nullptr, "SetWlanModeWithOption", MakeVersionGate({13,1,0})}, + FunctionInfo{100, nullptr, "AcquireConnectionDisallowedEvent", MakeVersionGate({13,0,0})}, + FunctionInfo{101, nullptr, "GetUsecaseViolationFactor", MakeVersionGate({13,0,0})}, + FunctionInfo{110, nullptr, "GetShortenedDeviceInfo", MakeVersionGate({13,0,0})}, + FunctionInfo{111, nullptr, "AcquirePairingCountUpdateEvent"},//13.0.0+ + FunctionInfo{112, nullptr, "Unknown112", MakeVersionGate({14,0,0}, {14,1,2})}, + FunctionInfo{113, nullptr, "Unknown113", MakeVersionGate({14,0,0}, {14,1,2})}, + FunctionInfo{114, nullptr, "IsFirstAudioControlConnection", MakeVersionGate({14,0,0})}, + FunctionInfo{115, nullptr, "GetShortenedDeviceCondition", MakeVersionGate({14,0,0})}, + FunctionInfo{116, nullptr, "SetAudioSinkVolume", MakeVersionGate({15,0,0})}, + FunctionInfo{117, nullptr, "GetAudioSinkVolume", MakeVersionGate({15,0,0})} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; diff --git a/src/core/hle/service/btm/btm_debug.cpp b/src/core/hle/service/btm/btm_debug.cpp deleted file mode 100644 index 0c9a3a6557..0000000000 --- a/src/core/hle/service/btm/btm_debug.cpp +++ /dev/null @@ -1,40 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "core/hle/service/btm/btm_debug.h" - -namespace Service::BTM { - -IBtmDebug::IBtmDebug(Core::System& system_) : ServiceFramework{system_, "btm:dbg"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "AcquireDiscoveryEvent"}, - {1, nullptr, "StartDiscovery"}, - {2, nullptr, "CancelDiscovery"}, - {3, nullptr, "GetDeviceProperty"}, - {4, nullptr, "CreateBond"}, - {5, nullptr, "CancelBond"}, - {6, nullptr, "SetTsiMode"}, - {7, nullptr, "GeneralTest"}, - {8, nullptr, "HidConnect"}, - {9, nullptr, "GeneralGet"}, //5.0.0+ - {10, nullptr, "GetGattClientDisconnectionReason"}, //5.0.0+ - {11, nullptr, "GetBleConnectionParameter"}, //5.1.0+ - {12, nullptr, "GetBleConnectionParameterRequest"}, //5.1.0+ - {13, nullptr, "GetDiscoveredDevice"}, //12.0.0+ - {14, nullptr, "SleepAwakeLoopTest"}, //15.0.0+ - {15, nullptr, "SleepTest"}, //15.0.0+ - {16, nullptr, "MinimumAwakeTest"}, //15.0.0+ - {17, nullptr, "ForceEnableBtm"}, //15.0.0+ - }; - // clang-format on - - RegisterHandlers(functions); -} - -IBtmDebug::~IBtmDebug() = default; - -} // namespace Service::BTM diff --git a/src/core/hle/service/btm/btm_debug.h b/src/core/hle/service/btm/btm_debug.h deleted file mode 100644 index bf4f7e14fd..0000000000 --- a/src/core/hle/service/btm/btm_debug.h +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include "core/hle/service/cmif_types.h" -#include "core/hle/service/service.h" - -namespace Core { -class System; -} - -namespace Service::BTM { - -class IBtmDebug final : public ServiceFramework { -public: - explicit IBtmDebug(Core::System& system_); - ~IBtmDebug() override; -}; - -} // namespace Service::BTM diff --git a/src/core/hle/service/btm/btm_system.cpp b/src/core/hle/service/btm/btm_system.cpp deleted file mode 100644 index 1684b0193e..0000000000 --- a/src/core/hle/service/btm/btm_system.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "common/logging.h" -#include "core/hle/service/btm/btm_system.h" -#include "core/hle/service/btm/btm_system_core.h" -#include "core/hle/service/cmif_serialization.h" -#include "core/hle/service/service.h" - -namespace Service::BTM { - -IBtmSystem::IBtmSystem(Core::System& system_) : ServiceFramework{system_, "btm:sys"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, C<&IBtmSystem::GetCore>, "GetCore"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - -IBtmSystem::~IBtmSystem() = default; - -Result IBtmSystem::GetCore(OutInterface out_interface) { - LOG_WARNING(Service_BTM, "called"); - - *out_interface = std::make_shared(system); - R_SUCCEED(); -} - -} // namespace Service::BTM diff --git a/src/core/hle/service/btm/btm_system.h b/src/core/hle/service/btm/btm_system.h deleted file mode 100644 index fe1c6dbd78..0000000000 --- a/src/core/hle/service/btm/btm_system.h +++ /dev/null @@ -1,25 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include "core/hle/service/cmif_types.h" -#include "core/hle/service/service.h" - -namespace Core { -class System; -} - -namespace Service::BTM { -class IBtmSystemCore; - -class IBtmSystem final : public ServiceFramework { -public: - explicit IBtmSystem(Core::System& system_); - ~IBtmSystem() override; - -private: - Result GetCore(OutInterface out_interface); -}; - -} // namespace Service::BTM diff --git a/src/core/hle/service/btm/btm_system_core.cpp b/src/core/hle/service/btm/btm_system_core.cpp deleted file mode 100644 index 318657fc32..0000000000 --- a/src/core/hle/service/btm/btm_system_core.cpp +++ /dev/null @@ -1,135 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "common/logging.h" -#include "core/hle/service/btm/btm_system_core.h" -#include "core/hle/service/cmif_serialization.h" -#include "core/hle/service/set/system_settings_server.h" -#include "core/hle/service/sm/sm.h" - -namespace Service::BTM { - -IBtmSystemCore::IBtmSystemCore(Core::System& system_) - : ServiceFramework{system_, "IBtmSystemCore"}, service_context{system_, "IBtmSystemCore"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, C<&IBtmSystemCore::StartGamepadPairing>, "StartGamepadPairing"}, - {1, C<&IBtmSystemCore::CancelGamepadPairing>, "CancelGamepadPairing"}, - {2, nullptr, "ClearGamepadPairingDatabase"}, - {3, nullptr, "GetPairedGamepadCount"}, - {4, C<&IBtmSystemCore::EnableRadio>, "EnableRadio"}, - {5, C<&IBtmSystemCore::DisableRadio>, "DisableRadio"}, - {6, C<&IBtmSystemCore::IsRadioEnabled>, "IsRadioEnabled"}, - {7, C<&IBtmSystemCore::AcquireRadioEvent>, "AcquireRadioEvent"}, - {8, nullptr, "AcquireGamepadPairingEvent"}, - {9, nullptr, "IsGamepadPairingStarted"}, - {10, nullptr, "StartAudioDeviceDiscovery"}, - {11, nullptr, "StopAudioDeviceDiscovery"}, - {12, nullptr, "IsDiscoveryingAudioDevice"}, - {13, C<&IBtmSystemCore::GetDiscoveredAudioDevice>, "GetDiscoveredAudioDevice"}, - {14, C<&IBtmSystemCore::AcquireAudioDeviceConnectionEvent>, "AcquireAudioDeviceConnectionEvent"}, - {15, nullptr, "ConnectAudioDevice"}, - {16, nullptr, "IsConnectingAudioDevice"}, - {17, C<&IBtmSystemCore::GetConnectedAudioDevices>, "GetConnectedAudioDevices"}, - {18, nullptr, "DisconnectAudioDevice"}, - {19, nullptr, "AcquirePairedAudioDeviceInfoChangedEvent"}, - {20, C<&IBtmSystemCore::GetPairedAudioDevices>, "GetPairedAudioDevices"}, - {21, nullptr, "RemoveAudioDevicePairing"}, - {22, C<&IBtmSystemCore::RequestAudioDeviceConnectionRejection>, "RequestAudioDeviceConnectionRejection"}, - {23, C<&IBtmSystemCore::CancelAudioDeviceConnectionRejection>, "CancelAudioDeviceConnectionRejection"} - }; - // clang-format on - - RegisterHandlers(functions); - radio_event = service_context.CreateEvent("IBtmSystemCore::RadioEvent"); - audio_device_connection_event = - service_context.CreateEvent("IBtmSystemCore::AudioDeviceConnectionEvent"); - - m_set_sys = - system.ServiceManager().GetService("set:sys", true); -} - -IBtmSystemCore::~IBtmSystemCore() { - service_context.CloseEvent(radio_event); - service_context.CloseEvent(audio_device_connection_event); -} - -Result IBtmSystemCore::StartGamepadPairing() { - LOG_WARNING(Service_BTM, "(STUBBED) called"); - R_SUCCEED(); -} - -Result IBtmSystemCore::CancelGamepadPairing() { - LOG_WARNING(Service_BTM, "(STUBBED) called"); - R_SUCCEED(); -} - -Result IBtmSystemCore::EnableRadio() { - LOG_DEBUG(Service_BTM, "called"); - - R_RETURN(m_set_sys->SetBluetoothEnableFlag(true)); -} -Result IBtmSystemCore::DisableRadio() { - LOG_DEBUG(Service_BTM, "called"); - - R_RETURN(m_set_sys->SetBluetoothEnableFlag(false)); -} - -Result IBtmSystemCore::IsRadioEnabled(Out out_is_enabled) { - LOG_DEBUG(Service_BTM, "called"); - - R_RETURN(m_set_sys->GetBluetoothEnableFlag(out_is_enabled)); -} - -Result IBtmSystemCore::AcquireRadioEvent(Out out_is_valid, - OutCopyHandle out_event) { - LOG_WARNING(Service_BTM, "(STUBBED) called"); - - *out_is_valid = true; - *out_event = &radio_event->GetReadableEvent(); - R_SUCCEED(); -} - -Result IBtmSystemCore::GetDiscoveredAudioDevice(OutArray, BufferAttr_HipcPointer> out_audio_devices, s32 count, Out out_total) { - LOG_WARNING(Service_BTM, "(STUBBED) called"); - R_SUCCEED(); -} - -Result IBtmSystemCore::AcquireAudioDeviceConnectionEvent( - OutCopyHandle out_event) { - LOG_WARNING(Service_BTM, "(STUBBED) called"); - - *out_event = &audio_device_connection_event->GetReadableEvent(); - R_SUCCEED(); -} - -Result IBtmSystemCore::GetConnectedAudioDevices( - Out out_count, OutArray, BufferAttr_HipcPointer> out_audio_devices) { - LOG_WARNING(Service_BTM, "(STUBBED) called"); - - *out_count = 0; - R_SUCCEED(); -} - -Result IBtmSystemCore::GetPairedAudioDevices( - Out out_count, OutArray, BufferAttr_HipcPointer> out_audio_devices) { - LOG_WARNING(Service_BTM, "(STUBBED) called"); - - *out_count = 0; - R_SUCCEED(); -} - -Result IBtmSystemCore::RequestAudioDeviceConnectionRejection(ClientAppletResourceUserId aruid) { - LOG_WARNING(Service_BTM, "(STUBBED) called, applet_resource_user_id={}", aruid.pid); - R_SUCCEED(); -} - -Result IBtmSystemCore::CancelAudioDeviceConnectionRejection(ClientAppletResourceUserId aruid) { - LOG_WARNING(Service_BTM, "(STUBBED) called, applet_resource_user_id={}", aruid.pid); - R_SUCCEED(); -} - -} // namespace Service::BTM diff --git a/src/core/hle/service/btm/btm_system_core.h b/src/core/hle/service/btm/btm_system_core.h deleted file mode 100644 index 3fc4c0d56c..0000000000 --- a/src/core/hle/service/btm/btm_system_core.h +++ /dev/null @@ -1,62 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include "core/hle/service/cmif_types.h" -#include "core/hle/service/kernel_helpers.h" -#include "core/hle/service/service.h" - -namespace Kernel { -class KEvent; -class KReadableEvent; -} // namespace Kernel - -namespace Core { -class System; -} - -namespace Service::Set { -class ISystemSettingsServer; -} - -namespace Service::BTM { - -class IBtmSystemCore final : public ServiceFramework { -public: - explicit IBtmSystemCore(Core::System& system_); - ~IBtmSystemCore() override; - -private: - Result StartGamepadPairing(); - Result CancelGamepadPairing(); - Result EnableRadio(); - Result DisableRadio(); - Result IsRadioEnabled(Out out_is_enabled); - - Result AcquireRadioEvent(Out out_is_valid, OutCopyHandle out_event); - Result GetDiscoveredAudioDevice(OutArray, BufferAttr_HipcPointer> out_audio_devices, s32 count, Out out_total); - Result AcquireAudioDeviceConnectionEvent(OutCopyHandle out_event); - - Result GetConnectedAudioDevices( - Out out_count, - OutArray, BufferAttr_HipcPointer> out_audio_devices); - - Result GetPairedAudioDevices( - Out out_count, - OutArray, BufferAttr_HipcPointer> out_audio_devices); - - Result RequestAudioDeviceConnectionRejection(ClientAppletResourceUserId aruid); - Result CancelAudioDeviceConnectionRejection(ClientAppletResourceUserId aruid); - - KernelHelpers::ServiceContext service_context; - - Kernel::KEvent* radio_event; - Kernel::KEvent* audio_device_connection_event; - std::shared_ptr m_set_sys; -}; - -} // namespace Service::BTM diff --git a/src/core/hle/service/btm/btm_user.cpp b/src/core/hle/service/btm/btm_user.cpp deleted file mode 100644 index c380c573fa..0000000000 --- a/src/core/hle/service/btm/btm_user.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "common/logging.h" -#include "core/hle/service/btm/btm_user.h" -#include "core/hle/service/btm/btm_user_core.h" -#include "core/hle/service/cmif_serialization.h" - -namespace Service::BTM { - -IBtmUser::IBtmUser(Core::System& system_) : ServiceFramework{system_, "btm:u"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, C<&IBtmUser::GetCore>, "GetCore"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - -IBtmUser::~IBtmUser() = default; - -Result IBtmUser::GetCore(OutInterface out_interface) { - LOG_WARNING(Service_BTM, "called"); - - *out_interface = std::make_shared(system); - R_SUCCEED(); -} - -} // namespace Service::BTM diff --git a/src/core/hle/service/btm/btm_user.h b/src/core/hle/service/btm/btm_user.h deleted file mode 100644 index d9ee5db455..0000000000 --- a/src/core/hle/service/btm/btm_user.h +++ /dev/null @@ -1,25 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include "core/hle/service/cmif_types.h" -#include "core/hle/service/service.h" - -namespace Core { -class System; -} - -namespace Service::BTM { -class IBtmUserCore; - -class IBtmUser final : public ServiceFramework { -public: - explicit IBtmUser(Core::System& system_); - ~IBtmUser() override; - -private: - Result GetCore(OutInterface out_interface); -}; - -} // namespace Service::BTM diff --git a/src/core/hle/service/btm/btm_user_core.cpp b/src/core/hle/service/btm/btm_user_core.cpp deleted file mode 100644 index b120df14c0..0000000000 --- a/src/core/hle/service/btm/btm_user_core.cpp +++ /dev/null @@ -1,106 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -#include - -#include "common/logging.h" -#include "core/core.h" -#include "core/hle/kernel/k_event.h" -#include "core/hle/service/btm/btm_user_core.h" -#include "core/hle/service/cmif_serialization.h" - -namespace Service::BTM { - -IBtmUserCore::IBtmUserCore(Core::System& system_) - : ServiceFramework{system_, "IBtmUserCore"}, service_context{system_, "IBtmUserCore"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, C<&IBtmUserCore::AcquireBleScanEvent>, "AcquireBleScanEvent"}, - {1, nullptr, "GetBleScanFilterParameter"}, - {2, nullptr, "GetBleScanFilterParameter2"}, - {3, nullptr, "StartBleScanForGeneral"}, - {4, nullptr, "StopBleScanForGeneral"}, - {5, nullptr, "GetBleScanResultsForGeneral"}, - {6, nullptr, "StartBleScanForPaired"}, - {7, nullptr, "StopBleScanForPaired"}, - {8, nullptr, "StartBleScanForSmartDevice"}, - {9, nullptr, "StopBleScanForSmartDevice"}, - {10, nullptr, "GetBleScanResultsForSmartDevice"}, - {17, C<&IBtmUserCore::AcquireBleConnectionEvent>, "AcquireBleConnectionEvent"}, - {18, nullptr, "BleConnect"}, - {19, nullptr, "BleDisconnect"}, - {20, nullptr, "BleGetConnectionState"}, - {21, nullptr, "AcquireBlePairingEvent"}, - {22, nullptr, "BlePairDevice"}, - {23, nullptr, "BleUnPairDevice"}, - {24, nullptr, "BleUnPairDevice2"}, - {25, nullptr, "BleGetPairedDevices"}, - {26, C<&IBtmUserCore::AcquireBleServiceDiscoveryEvent>, "AcquireBleServiceDiscoveryEvent"}, - {27, nullptr, "GetGattServices"}, - {28, nullptr, "GetGattService"}, - {29, nullptr, "GetGattIncludedServices"}, - {30, nullptr, "GetBelongingGattService"}, - {31, nullptr, "GetGattCharacteristics"}, - {32, nullptr, "GetGattDescriptors"}, - {33, C<&IBtmUserCore::AcquireBleMtuConfigEvent>, "AcquireBleMtuConfigEvent"}, - {34, nullptr, "ConfigureBleMtu"}, - {35, nullptr, "GetBleMtu"}, - {36, nullptr, "RegisterBleGattDataPath"}, - {37, nullptr, "UnregisterBleGattDataPath"}, - }; - // clang-format on - RegisterHandlers(functions); - - scan_event = service_context.CreateEvent("IBtmUserCore:ScanEvent"); - connection_event = service_context.CreateEvent("IBtmUserCore:ConnectionEvent"); - service_discovery_event = service_context.CreateEvent("IBtmUserCore:DiscoveryEvent"); - config_event = service_context.CreateEvent("IBtmUserCore:ConfigEvent"); -} - -IBtmUserCore::~IBtmUserCore() { - service_context.CloseEvent(scan_event); - service_context.CloseEvent(connection_event); - service_context.CloseEvent(service_discovery_event); - service_context.CloseEvent(config_event); -} - -Result IBtmUserCore::AcquireBleScanEvent(Out out_is_valid, - OutCopyHandle out_event) { - LOG_WARNING(Service_BTM, "(STUBBED) called"); - - *out_is_valid = true; - *out_event = &scan_event->GetReadableEvent(); - R_SUCCEED(); -} - -Result IBtmUserCore::AcquireBleConnectionEvent(Out out_is_valid, - OutCopyHandle out_event) { - LOG_WARNING(Service_BTM, "(STUBBED) called"); - - *out_is_valid = true; - *out_event = &connection_event->GetReadableEvent(); - R_SUCCEED(); -} - -Result IBtmUserCore::AcquireBleServiceDiscoveryEvent( - Out out_is_valid, OutCopyHandle out_event) { - LOG_WARNING(Service_BTM, "(STUBBED) called"); - - *out_is_valid = true; - *out_event = &service_discovery_event->GetReadableEvent(); - R_SUCCEED(); -} - -Result IBtmUserCore::AcquireBleMtuConfigEvent(Out out_is_valid, - OutCopyHandle out_event) { - LOG_WARNING(Service_BTM, "(STUBBED) called"); - - *out_is_valid = true; - *out_event = &config_event->GetReadableEvent(); - R_SUCCEED(); -} - -} // namespace Service::BTM diff --git a/src/core/hle/service/btm/btm_user_core.h b/src/core/hle/service/btm/btm_user_core.h deleted file mode 100644 index dc0a22e810..0000000000 --- a/src/core/hle/service/btm/btm_user_core.h +++ /dev/null @@ -1,47 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include "core/hle/service/cmif_types.h" -#include "core/hle/service/kernel_helpers.h" -#include "core/hle/service/service.h" - -namespace Kernel { -class KEvent; -class KReadableEvent; -} // namespace Kernel - -namespace Core { -class System; -} - -namespace Service::BTM { - -class IBtmUserCore final : public ServiceFramework { -public: - explicit IBtmUserCore(Core::System& system_); - ~IBtmUserCore() override; - -private: - Result AcquireBleScanEvent(Out out_is_valid, - OutCopyHandle out_event); - - Result AcquireBleConnectionEvent(Out out_is_valid, - OutCopyHandle out_event); - - Result AcquireBleServiceDiscoveryEvent(Out out_is_valid, - OutCopyHandle out_event); - - Result AcquireBleMtuConfigEvent(Out out_is_valid, - OutCopyHandle out_event); - - KernelHelpers::ServiceContext service_context; - - Kernel::KEvent* scan_event; - Kernel::KEvent* connection_event; - Kernel::KEvent* service_discovery_event; - Kernel::KEvent* config_event; -}; - -} // namespace Service::BTM diff --git a/src/core/hle/service/caps/caps.cpp b/src/core/hle/service/caps/caps.cpp index f07fbd2185..6cc37999f3 100644 --- a/src/core/hle/service/caps/caps.cpp +++ b/src/core/hle/service/caps/caps.cpp @@ -5,7 +5,6 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "core/hle/service/caps/caps.h" -#include "core/hle/service/caps/caps_a.h" #include "core/hle/service/caps/caps_c.h" #include "core/hle/service/caps/caps_manager.h" #include "core/hle/service/caps/caps_sc.h" @@ -14,24 +13,223 @@ #include "core/hle/service/caps/caps_u.h" #include "core/hle/service/server_manager.h" #include "core/hle/service/service.h" +#include "common/logging.h" #include "frontend_common/firmware_manager.h" +#include "core/hle/service/caps/caps_result.h" +#include "core/hle/service/cmif_serialization.h" +#include "core/hle/service/ipc_helpers.h" namespace Service::Capture { class IDecoderControlService final : public ServiceFramework { public: - explicit IDecoderControlService(Core::System& system_) : ServiceFramework{system_, "grc:d"} { - // clang-format off - static const FunctionInfo functions[] = { - {3001, nullptr, "DecodeJpeg"}, - {4001, nullptr, "ShrinkJpeg"}, - {4002, nullptr, "ShrinkJpegEx"}, - }; - // clang-format on - RegisterHandlers(functions); + explicit IDecoderControlService(Core::System& system_) : ServiceFramework{system_, "grc:d"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{3001, nullptr, "DecodeJpeg"}, + FunctionInfo{4001, nullptr, "ShrinkJpeg"}, + FunctionInfo{4002, nullptr, "ShrinkJpegEx"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; +class IAlbumAccessorService final : public ServiceFramework { +public: + explicit IAlbumAccessorService(Core::System& system_, std::shared_ptr album_manager) : ServiceFramework{system_, "caps:a"}, manager{album_manager} {} + ~IAlbumAccessorService() override = default; + + Result GetAlbumFileList( + Out out_count, AlbumStorage storage, + OutArray out_entries) { + LOG_INFO(Service_Capture, "called, storage={}", storage); + + const Result result = manager->GetAlbumFileList(out_entries, *out_count, storage, 0); + R_RETURN(TranslateResult(result)); + } + + Result DeleteAlbumFile(AlbumFileId file_id) { + LOG_INFO(Service_Capture, "called, application_id={:#0x}, storage={}, type={}", + file_id.application_id, file_id.storage, file_id.type); + + const Result result = manager->DeleteAlbumFile(file_id); + R_RETURN(TranslateResult(result)); + } + + Result IsAlbumMounted(Out out_is_mounted, AlbumStorage storage) { + LOG_INFO(Service_Capture, "called, storage={}", storage); + + const Result result = manager->IsAlbumMounted(storage); + *out_is_mounted = result.IsSuccess(); + R_RETURN(TranslateResult(result)); + } + + Result Unknown18( + Out out_buffer_size, + OutArray out_buffer) { + LOG_WARNING(Service_Capture, "(STUBBED) called"); + *out_buffer_size = 0; + R_SUCCEED(); + } + + Result GetAlbumFileListEx0( + Out out_entries_size, AlbumStorage storage, u8 flags, + OutArray out_entries) { + LOG_INFO(Service_Capture, "called, storage={}, flags={}", storage, flags); + + const Result result = manager->GetAlbumFileList(out_entries, *out_entries_size, storage, flags); + R_RETURN(TranslateResult(result)); + } + + Result GetAutoSavingStorage(Out out_is_autosaving) { + LOG_WARNING(Service_Capture, "(STUBBED) called"); + + const Result result = manager->GetAutoSavingStorage(*out_is_autosaving); + R_RETURN(TranslateResult(result)); + } + + Result LoadAlbumScreenShotImageEx1( + const AlbumFileId& file_id, const ScreenShotDecodeOption& decoder_options, + OutLargeData out_image_output, + OutArray out_image, + OutArray out_buffer) { + LOG_INFO(Service_Capture, "called, application_id={:#0x}, storage={}, type={}, flags={}", + file_id.application_id, file_id.storage, file_id.type, decoder_options.flags); + + const Result result = + manager->LoadAlbumScreenShotImage(*out_image_output, out_image, file_id, decoder_options); + R_RETURN(TranslateResult(result)); + } + + Result LoadAlbumScreenShotThumbnailImageEx1( + const AlbumFileId& file_id, const ScreenShotDecodeOption& decoder_options, + OutLargeData out_image_output, + OutArray out_image, + OutArray out_buffer) { + LOG_INFO(Service_Capture, "called, application_id={:#0x}, storage={}, type={}, flags={}", + file_id.application_id, file_id.storage, file_id.type, decoder_options.flags); + + const Result result = manager->LoadAlbumScreenShotThumbnail(*out_image_output, out_image, + file_id, decoder_options); + R_RETURN(TranslateResult(result)); + } + + Result TranslateResult(Result in_result) { + if (in_result.IsSuccess()) { + return in_result; + } + + if ((in_result.raw & 0x3801ff) == ResultUnknown1024.raw) { + if (in_result.GetDescription() - 0x514 < 100) { + return ResultInvalidFileData; + } + if (in_result.GetDescription() - 0x5dc < 100) { + return ResultInvalidFileData; + } + + if (in_result.GetDescription() - 0x578 < 100) { + if (in_result == ResultFileCountLimit) { + return ResultUnknown22; + } + return ResultUnknown25; + } + + if (in_result.raw < ResultUnknown1801.raw) { + if (in_result == ResultUnknown1202) { + return ResultUnknown810; + } + if (in_result == ResultUnknown1203) { + return ResultUnknown810; + } + if (in_result == ResultUnknown1701) { + return ResultUnknown5; + } + } else if (in_result.raw < ResultUnknown1803.raw) { + if (in_result == ResultUnknown1801) { + return ResultUnknown5; + } + if (in_result == ResultUnknown1802) { + return ResultUnknown6; + } + } else { + if (in_result == ResultUnknown1803) { + return ResultUnknown7; + } + if (in_result == ResultUnknown1804) { + return ResultOutOfRange; + } + } + return ResultUnknown1024; + } + + if (in_result.GetModule() == ErrorModule::FS) { + if ((in_result.GetDescription() >> 0xc < 0x7d) || + (in_result.GetDescription() - 1000 < 2000) || + (((in_result.GetDescription() - 3000) >> 3) < 0x271)) { + // TODO: Translate FS error + return in_result; + } + } + + return in_result; + } + + Result GetAlbumAccessResultForDebug(Out out_result) { + LOG_WARNING(Service_Capture, "(STUBBED) called"); + *out_result = ResultSuccess; + R_SUCCEED(); + } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetAlbumFileCount"}, + FunctionInfo{1, C<&IAlbumAccessorService::GetAlbumFileList>, "GetAlbumFileList"}, + FunctionInfo{2, nullptr, "LoadAlbumFile"}, + FunctionInfo{3, C<&IAlbumAccessorService::DeleteAlbumFile>, "DeleteAlbumFile"}, + FunctionInfo{4, nullptr, "StorageCopyAlbumFile"}, + FunctionInfo{5, C<&IAlbumAccessorService::IsAlbumMounted>, "IsAlbumMounted"}, + FunctionInfo{6, nullptr, "GetAlbumUsage"}, + FunctionInfo{7, nullptr, "GetAlbumFileSize"}, + FunctionInfo{8, nullptr, "LoadAlbumFileThumbnail"}, + FunctionInfo{9, nullptr, "LoadAlbumScreenShotImage"}, + FunctionInfo{10, nullptr, "LoadAlbumScreenShotThumbnailImage"}, + FunctionInfo{11, nullptr, "GetAlbumEntryFromApplicationAlbumEntry"}, + FunctionInfo{12, nullptr, "LoadAlbumScreenShotImageEx"}, + FunctionInfo{13, nullptr, "LoadAlbumScreenShotThumbnailImageEx"}, + FunctionInfo{14, nullptr, "LoadAlbumScreenShotImageEx0"}, + FunctionInfo{15, nullptr, "GetAlbumUsage3"}, + FunctionInfo{16, nullptr, "GetAlbumMountResult"}, + FunctionInfo{17, nullptr, "GetAlbumUsage16"}, + FunctionInfo{18, C<&IAlbumAccessorService::Unknown18>, "Unknown18"}, + FunctionInfo{19, nullptr, "Unknown19"}, + FunctionInfo{100, nullptr, "GetAlbumFileCountEx0"}, + FunctionInfo{101, C<&IAlbumAccessorService::GetAlbumFileListEx0>, "GetAlbumFileListEx0"}, + FunctionInfo{202, nullptr, "SaveEditedScreenShot"}, + FunctionInfo{301, nullptr, "GetLastThumbnail"}, + FunctionInfo{302, nullptr, "GetLastOverlayMovieThumbnail"}, + FunctionInfo{401, C<&IAlbumAccessorService::GetAutoSavingStorage>, "GetAutoSavingStorage"}, + FunctionInfo{501, nullptr, "GetRequiredStorageSpaceSizeToCopyAll"}, + FunctionInfo{1001, nullptr, "LoadAlbumScreenShotThumbnailImageEx0"}, + FunctionInfo{1002, C<&IAlbumAccessorService::LoadAlbumScreenShotImageEx1>, "LoadAlbumScreenShotImageEx1"}, + FunctionInfo{1003, C<&IAlbumAccessorService::LoadAlbumScreenShotThumbnailImageEx1>, "LoadAlbumScreenShotThumbnailImageEx1"}, + FunctionInfo{8001, nullptr, "ForceAlbumUnmounted"}, + FunctionInfo{8002, nullptr, "ResetAlbumMountStatus"}, + FunctionInfo{8011, nullptr, "RefreshAlbumCache"}, + FunctionInfo{8012, nullptr, "GetAlbumCache"}, + FunctionInfo{8013, nullptr, "GetAlbumCacheEx"}, + FunctionInfo{8021, nullptr, "GetAlbumEntryFromApplicationAlbumEntryAruid"}, + FunctionInfo{10011, nullptr, "SetInternalErrorConversionEnabled"}, + FunctionInfo{50000, nullptr, "LoadMakerNoteInfoForDebug"}, + FunctionInfo{50011, C<&IAlbumAccessorService::GetAlbumAccessResultForDebug>, "GetAlbumAccessResultForDebug"}, + FunctionInfo{60002, nullptr, "OpenAccessorSession"} + ); + + std::shared_ptr manager = nullptr; +}; + void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); auto album_manager = std::make_shared(system); diff --git a/src/core/hle/service/caps/caps_a.cpp b/src/core/hle/service/caps/caps_a.cpp deleted file mode 100644 index 8f561bfcdc..0000000000 --- a/src/core/hle/service/caps/caps_a.cpp +++ /dev/null @@ -1,211 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "common/logging.h" -#include "core/hle/service/caps/caps_a.h" -#include "core/hle/service/caps/caps_manager.h" -#include "core/hle/service/caps/caps_result.h" -#include "core/hle/service/cmif_serialization.h" -#include "core/hle/service/ipc_helpers.h" - -namespace Service::Capture { - -IAlbumAccessorService::IAlbumAccessorService(Core::System& system_, - std::shared_ptr album_manager) - : ServiceFramework{system_, "caps:a"}, manager{album_manager} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetAlbumFileCount"}, - {1, C<&IAlbumAccessorService::GetAlbumFileList>, "GetAlbumFileList"}, - {2, nullptr, "LoadAlbumFile"}, - {3, C<&IAlbumAccessorService::DeleteAlbumFile>, "DeleteAlbumFile"}, - {4, nullptr, "StorageCopyAlbumFile"}, - {5, C<&IAlbumAccessorService::IsAlbumMounted>, "IsAlbumMounted"}, - {6, nullptr, "GetAlbumUsage"}, - {7, nullptr, "GetAlbumFileSize"}, - {8, nullptr, "LoadAlbumFileThumbnail"}, - {9, nullptr, "LoadAlbumScreenShotImage"}, - {10, nullptr, "LoadAlbumScreenShotThumbnailImage"}, - {11, nullptr, "GetAlbumEntryFromApplicationAlbumEntry"}, - {12, nullptr, "LoadAlbumScreenShotImageEx"}, - {13, nullptr, "LoadAlbumScreenShotThumbnailImageEx"}, - {14, nullptr, "LoadAlbumScreenShotImageEx0"}, - {15, nullptr, "GetAlbumUsage3"}, - {16, nullptr, "GetAlbumMountResult"}, - {17, nullptr, "GetAlbumUsage16"}, - {18, C<&IAlbumAccessorService::Unknown18>, "Unknown18"}, - {19, nullptr, "Unknown19"}, - {100, nullptr, "GetAlbumFileCountEx0"}, - {101, C<&IAlbumAccessorService::GetAlbumFileListEx0>, "GetAlbumFileListEx0"}, - {202, nullptr, "SaveEditedScreenShot"}, - {301, nullptr, "GetLastThumbnail"}, - {302, nullptr, "GetLastOverlayMovieThumbnail"}, - {401, C<&IAlbumAccessorService::GetAutoSavingStorage>, "GetAutoSavingStorage"}, - {501, nullptr, "GetRequiredStorageSpaceSizeToCopyAll"}, - {1001, nullptr, "LoadAlbumScreenShotThumbnailImageEx0"}, - {1002, C<&IAlbumAccessorService::LoadAlbumScreenShotImageEx1>, "LoadAlbumScreenShotImageEx1"}, - {1003, C<&IAlbumAccessorService::LoadAlbumScreenShotThumbnailImageEx1>, "LoadAlbumScreenShotThumbnailImageEx1"}, - {8001, nullptr, "ForceAlbumUnmounted"}, - {8002, nullptr, "ResetAlbumMountStatus"}, - {8011, nullptr, "RefreshAlbumCache"}, - {8012, nullptr, "GetAlbumCache"}, - {8013, nullptr, "GetAlbumCacheEx"}, - {8021, nullptr, "GetAlbumEntryFromApplicationAlbumEntryAruid"}, - {10011, nullptr, "SetInternalErrorConversionEnabled"}, - {50000, nullptr, "LoadMakerNoteInfoForDebug"}, - {50011, C<&IAlbumAccessorService::GetAlbumAccessResultForDebug>, "GetAlbumAccessResultForDebug"}, - {60002, nullptr, "OpenAccessorSession"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - -IAlbumAccessorService::~IAlbumAccessorService() = default; - -Result IAlbumAccessorService::GetAlbumFileList( - Out out_count, AlbumStorage storage, - OutArray out_entries) { - LOG_INFO(Service_Capture, "called, storage={}", storage); - - const Result result = manager->GetAlbumFileList(out_entries, *out_count, storage, 0); - R_RETURN(TranslateResult(result)); -} - -Result IAlbumAccessorService::DeleteAlbumFile(AlbumFileId file_id) { - LOG_INFO(Service_Capture, "called, application_id={:#0x}, storage={}, type={}", - file_id.application_id, file_id.storage, file_id.type); - - const Result result = manager->DeleteAlbumFile(file_id); - R_RETURN(TranslateResult(result)); -} - -Result IAlbumAccessorService::IsAlbumMounted(Out out_is_mounted, AlbumStorage storage) { - LOG_INFO(Service_Capture, "called, storage={}", storage); - - const Result result = manager->IsAlbumMounted(storage); - *out_is_mounted = result.IsSuccess(); - R_RETURN(TranslateResult(result)); -} - -Result IAlbumAccessorService::Unknown18( - Out out_buffer_size, - OutArray out_buffer) { - LOG_WARNING(Service_Capture, "(STUBBED) called"); - *out_buffer_size = 0; - R_SUCCEED(); -} - -Result IAlbumAccessorService::GetAlbumFileListEx0( - Out out_entries_size, AlbumStorage storage, u8 flags, - OutArray out_entries) { - LOG_INFO(Service_Capture, "called, storage={}, flags={}", storage, flags); - - const Result result = manager->GetAlbumFileList(out_entries, *out_entries_size, storage, flags); - R_RETURN(TranslateResult(result)); -} - -Result IAlbumAccessorService::GetAutoSavingStorage(Out out_is_autosaving) { - LOG_WARNING(Service_Capture, "(STUBBED) called"); - - const Result result = manager->GetAutoSavingStorage(*out_is_autosaving); - R_RETURN(TranslateResult(result)); -} - -Result IAlbumAccessorService::LoadAlbumScreenShotImageEx1( - const AlbumFileId& file_id, const ScreenShotDecodeOption& decoder_options, - OutLargeData out_image_output, - OutArray out_image, - OutArray out_buffer) { - LOG_INFO(Service_Capture, "called, application_id={:#0x}, storage={}, type={}, flags={}", - file_id.application_id, file_id.storage, file_id.type, decoder_options.flags); - - const Result result = - manager->LoadAlbumScreenShotImage(*out_image_output, out_image, file_id, decoder_options); - R_RETURN(TranslateResult(result)); -} - -Result IAlbumAccessorService::LoadAlbumScreenShotThumbnailImageEx1( - const AlbumFileId& file_id, const ScreenShotDecodeOption& decoder_options, - OutLargeData out_image_output, - OutArray out_image, - OutArray out_buffer) { - LOG_INFO(Service_Capture, "called, application_id={:#0x}, storage={}, type={}, flags={}", - file_id.application_id, file_id.storage, file_id.type, decoder_options.flags); - - const Result result = manager->LoadAlbumScreenShotThumbnail(*out_image_output, out_image, - file_id, decoder_options); - R_RETURN(TranslateResult(result)); -} - -Result IAlbumAccessorService::TranslateResult(Result in_result) { - if (in_result.IsSuccess()) { - return in_result; - } - - if ((in_result.raw & 0x3801ff) == ResultUnknown1024.raw) { - if (in_result.GetDescription() - 0x514 < 100) { - return ResultInvalidFileData; - } - if (in_result.GetDescription() - 0x5dc < 100) { - return ResultInvalidFileData; - } - - if (in_result.GetDescription() - 0x578 < 100) { - if (in_result == ResultFileCountLimit) { - return ResultUnknown22; - } - return ResultUnknown25; - } - - if (in_result.raw < ResultUnknown1801.raw) { - if (in_result == ResultUnknown1202) { - return ResultUnknown810; - } - if (in_result == ResultUnknown1203) { - return ResultUnknown810; - } - if (in_result == ResultUnknown1701) { - return ResultUnknown5; - } - } else if (in_result.raw < ResultUnknown1803.raw) { - if (in_result == ResultUnknown1801) { - return ResultUnknown5; - } - if (in_result == ResultUnknown1802) { - return ResultUnknown6; - } - } else { - if (in_result == ResultUnknown1803) { - return ResultUnknown7; - } - if (in_result == ResultUnknown1804) { - return ResultOutOfRange; - } - } - return ResultUnknown1024; - } - - if (in_result.GetModule() == ErrorModule::FS) { - if ((in_result.GetDescription() >> 0xc < 0x7d) || - (in_result.GetDescription() - 1000 < 2000) || - (((in_result.GetDescription() - 3000) >> 3) < 0x271)) { - // TODO: Translate FS error - return in_result; - } - } - - return in_result; -} - - -Result IAlbumAccessorService::GetAlbumAccessResultForDebug(Out out_result) { - LOG_WARNING(Service_Capture, "(STUBBED) called"); - *out_result = ResultSuccess; - R_SUCCEED(); -} - -} // namespace Service::Capture diff --git a/src/core/hle/service/caps/caps_a.h b/src/core/hle/service/caps/caps_a.h deleted file mode 100644 index 1885ba6be0..0000000000 --- a/src/core/hle/service/caps/caps_a.h +++ /dev/null @@ -1,63 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/caps/caps_types.h" -#include "core/hle/service/cmif_types.h" -#include "core/hle/service/service.h" - -namespace Core { -class System; -} - -namespace Service::Capture { -class AlbumManager; - -class IAlbumAccessorService final : public ServiceFramework { -public: - explicit IAlbumAccessorService(Core::System& system_, - std::shared_ptr album_manager); - ~IAlbumAccessorService() override; - -private: - Result GetAlbumFileList(Out out_count, AlbumStorage storage, - OutArray out_entries); - - Result DeleteAlbumFile(AlbumFileId file_id); - - Result IsAlbumMounted(Out out_is_mounted, AlbumStorage storage); - - Result Unknown18( - Out out_buffer_size, - OutArray - out_buffer); - - Result GetAlbumFileListEx0(Out out_entries_size, AlbumStorage storage, u8 flags, - OutArray out_entries); - - Result GetAutoSavingStorage(Out out_is_autosaving); - - Result LoadAlbumScreenShotImageEx1( - const AlbumFileId& file_id, const ScreenShotDecodeOption& decoder_options, - OutLargeData out_image_output, - OutArray out_image, - OutArray out_buffer); - - Result LoadAlbumScreenShotThumbnailImageEx1( - const AlbumFileId& file_id, const ScreenShotDecodeOption& decoder_options, - OutLargeData out_image_output, - OutArray out_image, - OutArray out_buffer); - - Result TranslateResult(Result in_result); - - Result GetAlbumAccessResultForDebug(Out out_result); - - std::shared_ptr manager = nullptr; -}; - -} // namespace Service::Capture diff --git a/src/core/hle/service/caps/caps_c.cpp b/src/core/hle/service/caps/caps_c.cpp index 6c9f8e964d..c62c3cd5d3 100644 --- a/src/core/hle/service/caps/caps_c.cpp +++ b/src/core/hle/service/caps/caps_c.cpp @@ -14,34 +14,34 @@ namespace Service::Capture { +std::optional IAlbumControlService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{1, nullptr, "CaptureRawImage"}, + FunctionInfo{2, nullptr, "CaptureRawImageWithTimeout"}, + FunctionInfo{33, C<&IAlbumControlService::SetShimLibraryVersion>, "SetShimLibraryVersion"}, + FunctionInfo{1001, nullptr, "RequestTakingScreenShot"}, + FunctionInfo{1002, nullptr, "RequestTakingScreenShotWithTimeout"}, + FunctionInfo{1011, nullptr, "NotifyTakingScreenShotRefused"}, + FunctionInfo{2001, nullptr, "NotifyAlbumStorageIsAvailable"}, + FunctionInfo{2002, nullptr, "NotifyAlbumStorageIsUnavailable"}, + FunctionInfo{2011, nullptr, "RegisterAppletResourceUserId"}, + FunctionInfo{2012, nullptr, "UnregisterAppletResourceUserId"}, + FunctionInfo{2013, nullptr, "GetApplicationIdFromAruid"}, + FunctionInfo{2014, nullptr, "CheckApplicationIdRegistered"}, + FunctionInfo{2101, nullptr, "GenerateCurrentAlbumFileId"}, + FunctionInfo{2102, nullptr, "GenerateApplicationAlbumEntry"}, + FunctionInfo{2201, nullptr, "SaveAlbumScreenShotFile"}, + FunctionInfo{2202, nullptr, "SaveAlbumScreenShotFileEx"}, + FunctionInfo{2301, nullptr, "SetOverlayScreenShotThumbnailData"}, + FunctionInfo{2302, nullptr, "SetOverlayMovieThumbnailData"}, + FunctionInfo{60001, nullptr, "OpenControlSession"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IAlbumControlService::IAlbumControlService(Core::System& system_, std::shared_ptr album_manager) : ServiceFramework{system_, "caps:c"}, manager{album_manager} { - // clang-format off - static const FunctionInfo functions[] = { - {1, nullptr, "CaptureRawImage"}, - {2, nullptr, "CaptureRawImageWithTimeout"}, - {33, C<&IAlbumControlService::SetShimLibraryVersion>, "SetShimLibraryVersion"}, - {1001, nullptr, "RequestTakingScreenShot"}, - {1002, nullptr, "RequestTakingScreenShotWithTimeout"}, - {1011, nullptr, "NotifyTakingScreenShotRefused"}, - {2001, nullptr, "NotifyAlbumStorageIsAvailable"}, - {2002, nullptr, "NotifyAlbumStorageIsUnavailable"}, - {2011, nullptr, "RegisterAppletResourceUserId"}, - {2012, nullptr, "UnregisterAppletResourceUserId"}, - {2013, nullptr, "GetApplicationIdFromAruid"}, - {2014, nullptr, "CheckApplicationIdRegistered"}, - {2101, nullptr, "GenerateCurrentAlbumFileId"}, - {2102, nullptr, "GenerateApplicationAlbumEntry"}, - {2201, nullptr, "SaveAlbumScreenShotFile"}, - {2202, nullptr, "SaveAlbumScreenShotFileEx"}, - {2301, nullptr, "SetOverlayScreenShotThumbnailData"}, - {2302, nullptr, "SetOverlayMovieThumbnailData"}, - {60001, nullptr, "OpenControlSession"}, - }; - // clang-format on - - RegisterHandlers(functions); } IAlbumControlService::~IAlbumControlService() = default; diff --git a/src/core/hle/service/caps/caps_c.h b/src/core/hle/service/caps/caps_c.h index 0ecdfa1147..a1f19bbfc3 100644 --- a/src/core/hle/service/caps/caps_c.h +++ b/src/core/hle/service/caps/caps_c.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -16,14 +19,11 @@ enum class ShimLibraryVersion : u64; class IAlbumControlService final : public ServiceFramework { public: - explicit IAlbumControlService(Core::System& system_, - std::shared_ptr album_manager); + explicit IAlbumControlService(Core::System& system_, std::shared_ptr album_manager); ~IAlbumControlService() override; - private: - Result SetShimLibraryVersion(ShimLibraryVersion library_version, - ClientAppletResourceUserId aruid); - + Result SetShimLibraryVersion(ShimLibraryVersion library_version, ClientAppletResourceUserId aruid); + std::optional FindRequest(u32 key) override; std::shared_ptr manager = nullptr; }; diff --git a/src/core/hle/service/caps/caps_sc.cpp b/src/core/hle/service/caps/caps_sc.cpp index 6117cb7c6c..59119d8ed7 100644 --- a/src/core/hle/service/caps/caps_sc.cpp +++ b/src/core/hle/service/caps/caps_sc.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -7,32 +10,6 @@ namespace Service::Capture { IScreenShotControlService::IScreenShotControlService(Core::System& system_) : ServiceFramework{system_, "caps:sc"} { - // clang-format off - static const FunctionInfo functions[] = { - {1, nullptr, "CaptureRawImage"}, - {2, nullptr, "CaptureRawImageWithTimeout"}, - {3, nullptr, "AttachSharedBuffer"}, - {5, nullptr, "CaptureRawImageToAttachedSharedBuffer"}, - {210, nullptr, "Unknown210"}, - {1001, nullptr, "RequestTakingScreenShot"}, - {1002, nullptr, "RequestTakingScreenShotWithTimeout"}, - {1003, nullptr, "RequestTakingScreenShotEx"}, - {1004, nullptr, "RequestTakingScreenShotEx1"}, - {1009, nullptr, "CancelTakingScreenShot"}, - {1010, nullptr, "SetTakingScreenShotCancelState"}, - {1011, nullptr, "NotifyTakingScreenShotRefused"}, - {1012, nullptr, "NotifyTakingScreenShotFailed"}, - {1101, nullptr, "SetupOverlayMovieThumbnail"}, - {1106, nullptr, "Unknown1106"}, - {1107, nullptr, "Unknown1107"}, - {1201, nullptr, "OpenRawScreenShotReadStream"}, - {1202, nullptr, "CloseRawScreenShotReadStream"}, - {1203, nullptr, "ReadRawScreenShotReadStream"}, - {1204, nullptr, "Unknown1204"}, - }; - // clang-format on - - RegisterHandlers(functions); } IScreenShotControlService::~IScreenShotControlService() = default; diff --git a/src/core/hle/service/caps/caps_sc.h b/src/core/hle/service/caps/caps_sc.h index d555f49792..422f062e59 100644 --- a/src/core/hle/service/caps/caps_sc.h +++ b/src/core/hle/service/caps/caps_sc.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -15,6 +18,32 @@ class IScreenShotControlService final : public ServiceFramework FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{1, nullptr, "CaptureRawImage"}, + FunctionInfo{2, nullptr, "CaptureRawImageWithTimeout"}, + FunctionInfo{3, nullptr, "AttachSharedBuffer"}, + FunctionInfo{5, nullptr, "CaptureRawImageToAttachedSharedBuffer"}, + FunctionInfo{210, nullptr, "Unknown210"}, + FunctionInfo{1001, nullptr, "RequestTakingScreenShot"}, + FunctionInfo{1002, nullptr, "RequestTakingScreenShotWithTimeout"}, + FunctionInfo{1003, nullptr, "RequestTakingScreenShotEx"}, + FunctionInfo{1004, nullptr, "RequestTakingScreenShotEx1"}, + FunctionInfo{1009, nullptr, "CancelTakingScreenShot"}, + FunctionInfo{1010, nullptr, "SetTakingScreenShotCancelState"}, + FunctionInfo{1011, nullptr, "NotifyTakingScreenShotRefused"}, + FunctionInfo{1012, nullptr, "NotifyTakingScreenShotFailed"}, + FunctionInfo{1101, nullptr, "SetupOverlayMovieThumbnail"}, + FunctionInfo{1106, nullptr, "Unknown1106"}, + FunctionInfo{1107, nullptr, "Unknown1107"}, + FunctionInfo{1201, nullptr, "OpenRawScreenShotReadStream"}, + FunctionInfo{1202, nullptr, "CloseRawScreenShotReadStream"}, + FunctionInfo{1203, nullptr, "ReadRawScreenShotReadStream"}, + FunctionInfo{1204, nullptr, "Unknown1204"} + ); }; } // namespace Service::Capture diff --git a/src/core/hle/service/caps/caps_ss.cpp b/src/core/hle/service/caps/caps_ss.cpp index 0cd641f551..0c444116b7 100644 --- a/src/core/hle/service/caps/caps_ss.cpp +++ b/src/core/hle/service/caps/caps_ss.cpp @@ -12,22 +12,22 @@ namespace Service::Capture { +std::optional IScreenShotService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{201, nullptr, "SaveScreenShot"}, + FunctionInfo{202, nullptr, "SaveEditedScreenShot"}, + FunctionInfo{203, C<&IScreenShotService::SaveScreenShotEx0>, "SaveScreenShotEx0"}, + FunctionInfo{204, nullptr, "SaveEditedScreenShotEx0"}, + FunctionInfo{206, C<&IScreenShotService::SaveEditedScreenShotEx1>, "SaveEditedScreenShotEx1"}, + FunctionInfo{208, nullptr, "SaveScreenShotOfMovieEx1"}, + FunctionInfo{1000, nullptr, "Unknown1000"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IScreenShotService::IScreenShotService(Core::System& system_, std::shared_ptr album_manager) : ServiceFramework{system_, "caps:ss"}, manager{album_manager} { - // clang-format off - static const FunctionInfo functions[] = { - {201, nullptr, "SaveScreenShot"}, - {202, nullptr, "SaveEditedScreenShot"}, - {203, C<&IScreenShotService::SaveScreenShotEx0>, "SaveScreenShotEx0"}, - {204, nullptr, "SaveEditedScreenShotEx0"}, - {206, C<&IScreenShotService::SaveEditedScreenShotEx1>, "SaveEditedScreenShotEx1"}, - {208, nullptr, "SaveScreenShotOfMovieEx1"}, - {1000, nullptr, "Unknown1000"}, - }; - // clang-format on - - RegisterHandlers(functions); } IScreenShotService::~IScreenShotService() = default; diff --git a/src/core/hle/service/caps/caps_ss.h b/src/core/hle/service/caps/caps_ss.h index da4b4cc5fc..8817637fb8 100644 --- a/src/core/hle/service/caps/caps_ss.h +++ b/src/core/hle/service/caps/caps_ss.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -34,6 +37,7 @@ private: const InBuffer thumbnail_image_data_buffer); + std::optional FindRequest(u32 key) override; std::shared_ptr manager; }; diff --git a/src/core/hle/service/caps/caps_su.cpp b/src/core/hle/service/caps/caps_su.cpp index 4ecfc840e4..e708ddbb68 100644 --- a/src/core/hle/service/caps/caps_su.cpp +++ b/src/core/hle/service/caps/caps_su.cpp @@ -15,20 +15,20 @@ namespace Service::Capture { +std::optional IScreenShotApplicationService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{32, C<&IScreenShotApplicationService::SetShimLibraryVersion>, "SetShimLibraryVersion"}, + FunctionInfo{201, nullptr, "SaveScreenShot"}, + FunctionInfo{203, C<&IScreenShotApplicationService::SaveScreenShotEx0>, "SaveScreenShotEx0"}, + FunctionInfo{205, C<&IScreenShotApplicationService::SaveScreenShotEx1>, "SaveScreenShotEx1"}, + FunctionInfo{210, nullptr, "SaveScreenShotEx2"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IScreenShotApplicationService::IScreenShotApplicationService( Core::System& system_, std::shared_ptr album_manager) : ServiceFramework{system_, "caps:su"}, manager{album_manager} { - // clang-format off - static const FunctionInfo functions[] = { - {32, C<&IScreenShotApplicationService::SetShimLibraryVersion>, "SetShimLibraryVersion"}, - {201, nullptr, "SaveScreenShot"}, - {203, C<&IScreenShotApplicationService::SaveScreenShotEx0>, "SaveScreenShotEx0"}, - {205, C<&IScreenShotApplicationService::SaveScreenShotEx1>, "SaveScreenShotEx1"}, - {210, nullptr, "SaveScreenShotEx2"}, - }; - // clang-format on - - RegisterHandlers(functions); } IScreenShotApplicationService::~IScreenShotApplicationService() = default; diff --git a/src/core/hle/service/caps/caps_su.h b/src/core/hle/service/caps/caps_su.h index 4b4cbd09e6..0fdc994a25 100644 --- a/src/core/hle/service/caps/caps_su.h +++ b/src/core/hle/service/caps/caps_su.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -42,8 +45,8 @@ private: const InBuffer image_data_buffer); + std::optional FindRequest(u32 key) override; std::array image_data; - std::shared_ptr manager; }; diff --git a/src/core/hle/service/caps/caps_u.cpp b/src/core/hle/service/caps/caps_u.cpp index 6472b2bac6..c1fa418e03 100644 --- a/src/core/hle/service/caps/caps_u.cpp +++ b/src/core/hle/service/caps/caps_u.cpp @@ -13,29 +13,29 @@ namespace Service::Capture { +std::optional IAlbumApplicationService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{32, C<&IAlbumApplicationService::SetShimLibraryVersion>, "SetShimLibraryVersion"}, + FunctionInfo{102, C<&IAlbumApplicationService::GetAlbumFileList0AafeAruidDeprecated>, "GetAlbumFileList0AafeAruidDeprecated"}, + FunctionInfo{103, nullptr, "DeleteAlbumFileByAruid"}, + FunctionInfo{104, nullptr, "GetAlbumFileSizeByAruid"}, + FunctionInfo{105, nullptr, "DeleteAlbumFileByAruidForDebug"}, + FunctionInfo{110, nullptr, "LoadAlbumScreenShotImageByAruid"}, + FunctionInfo{120, nullptr, "LoadAlbumScreenShotThumbnailImageByAruid"}, + FunctionInfo{130, nullptr, "PrecheckToCreateContentsByAruid"}, + FunctionInfo{140, nullptr, "GetAlbumFileList1AafeAruidDeprecated"}, + FunctionInfo{141, nullptr, "GetAlbumFileList2AafeUidAruidDeprecated"}, + FunctionInfo{142, C<&IAlbumApplicationService::GetAlbumFileList3AaeAruid>, "GetAlbumFileList3AaeAruid"}, + FunctionInfo{143, nullptr, "GetAlbumFileList4AaeUidAruid"}, + FunctionInfo{144, nullptr, "GetAllAlbumFileList3AaeAruid"}, + FunctionInfo{60002, nullptr, "OpenAccessorSessionForApplication"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IAlbumApplicationService::IAlbumApplicationService(Core::System& system_, std::shared_ptr album_manager) : ServiceFramework{system_, "caps:u"}, manager{album_manager} { - // clang-format off - static const FunctionInfo functions[] = { - {32, C<&IAlbumApplicationService::SetShimLibraryVersion>, "SetShimLibraryVersion"}, - {102, C<&IAlbumApplicationService::GetAlbumFileList0AafeAruidDeprecated>, "GetAlbumFileList0AafeAruidDeprecated"}, - {103, nullptr, "DeleteAlbumFileByAruid"}, - {104, nullptr, "GetAlbumFileSizeByAruid"}, - {105, nullptr, "DeleteAlbumFileByAruidForDebug"}, - {110, nullptr, "LoadAlbumScreenShotImageByAruid"}, - {120, nullptr, "LoadAlbumScreenShotThumbnailImageByAruid"}, - {130, nullptr, "PrecheckToCreateContentsByAruid"}, - {140, nullptr, "GetAlbumFileList1AafeAruidDeprecated"}, - {141, nullptr, "GetAlbumFileList2AafeUidAruidDeprecated"}, - {142, C<&IAlbumApplicationService::GetAlbumFileList3AaeAruid>, "GetAlbumFileList3AaeAruid"}, - {143, nullptr, "GetAlbumFileList4AaeUidAruid"}, - {144, nullptr, "GetAllAlbumFileList3AaeAruid"}, - {60002, nullptr, "OpenAccessorSessionForApplication"}, - }; - // clang-format on - - RegisterHandlers(functions); } IAlbumApplicationService::~IAlbumApplicationService() = default; diff --git a/src/core/hle/service/caps/caps_u.h b/src/core/hle/service/caps/caps_u.h index 023ee1fe79..52e151bbe2 100644 --- a/src/core/hle/service/caps/caps_u.h +++ b/src/core/hle/service/caps/caps_u.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -33,6 +36,7 @@ private: AlbumFileDateTime end_date_time, ClientAppletResourceUserId aruid, OutArray out_entries); + std::optional FindRequest(u32 key) override; std::shared_ptr manager = nullptr; }; diff --git a/src/core/hle/service/erpt/erpt.cpp b/src/core/hle/service/erpt/erpt.cpp index 014f1da62f..7bed893bd7 100644 --- a/src/core/hle/service/erpt/erpt.cpp +++ b/src/core/hle/service/erpt/erpt.cpp @@ -17,30 +17,10 @@ namespace Service::ERPT { class ErrorReportContext final : public ServiceFramework { public: - explicit ErrorReportContext(Core::System& system_) : ServiceFramework{system_, "erpt:c"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, C<&ErrorReportContext::SubmitContext>, "SubmitContext"}, - {1, C<&ErrorReportContext::CreateReportV0>, "CreateReportV0"}, - {2, nullptr, "SetInitialLaunchSettingsCompletionTime"}, - {3, nullptr, "ClearInitialLaunchSettingsCompletionTime"}, - {4, nullptr, "UpdatePowerOnTime"}, - {5, D<&ErrorReportContext::UpdateAwakeTime>, "UpdateAwakeTime"}, - {6, nullptr, "SubmitMultipleCategoryContext"}, - {7, nullptr, "UpdateApplicationLaunchTime"}, - {8, nullptr, "ClearApplicationLaunchTime"}, - {9, nullptr, "SubmitAttachment"}, - {10, nullptr, "CreateReportWithAttachments"}, - {11, C<&ErrorReportContext::CreateReportV1>, "CreateReportV1"}, - {12, C<&ErrorReportContext::CreateReport>, "CreateReport"}, - {20, nullptr, "RegisterRunningApplet"}, - {21, nullptr, "UnregisterRunningApplet"}, - {22, nullptr, "UpdateAppletSuspendedDuration"}, - {30, nullptr, "InvalidateForcedShutdownDetection"}, - }; - // clang-format on + explicit ErrorReportContext(Core::System& system_) : ServiceFramework{system_, "erpt:c"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -85,21 +65,41 @@ private: data_a.size(), data_b.size(), flag_a, flag_b); R_SUCCEED(); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, C<&ErrorReportContext::SubmitContext>, "SubmitContext"}, + FunctionInfo{1, C<&ErrorReportContext::CreateReportV0>, "CreateReportV0"}, + FunctionInfo{2, nullptr, "SetInitialLaunchSettingsCompletionTime"}, + FunctionInfo{3, nullptr, "ClearInitialLaunchSettingsCompletionTime"}, + FunctionInfo{4, nullptr, "UpdatePowerOnTime"}, + FunctionInfo{5, D<&ErrorReportContext::UpdateAwakeTime>, "UpdateAwakeTime"}, + FunctionInfo{6, nullptr, "SubmitMultipleCategoryContext"}, + FunctionInfo{7, nullptr, "UpdateApplicationLaunchTime"}, + FunctionInfo{8, nullptr, "ClearApplicationLaunchTime"}, + FunctionInfo{9, nullptr, "SubmitAttachment"}, + FunctionInfo{10, nullptr, "CreateReportWithAttachments"}, + FunctionInfo{11, C<&ErrorReportContext::CreateReportV1>, "CreateReportV1"}, + FunctionInfo{12, C<&ErrorReportContext::CreateReport>, "CreateReport"}, + FunctionInfo{20, nullptr, "RegisterRunningApplet"}, + FunctionInfo{21, nullptr, "UnregisterRunningApplet"}, + FunctionInfo{22, nullptr, "UpdateAppletSuspendedDuration"}, + FunctionInfo{30, nullptr, "InvalidateForcedShutdownDetection"} + ); }; class ErrorReportSession final : public ServiceFramework { public: - explicit ErrorReportSession(Core::System& system_) : ServiceFramework{system_, "erpt:r"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "OpenReport"}, - {1, nullptr, "OpenManager"}, - {2, nullptr, "OpenAttachment"}, - }; - // clang-format on + explicit ErrorReportSession(Core::System& system_) : ServiceFramework{system_, "erpt:r"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "OpenReport"}, + FunctionInfo{1, nullptr, "OpenManager"}, + FunctionInfo{2, nullptr, "OpenAttachment"} + ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/es/es.cpp b/src/core/hle/service/es/es.cpp index 432783f96e..01d11183c9 100644 --- a/src/core/hle/service/es/es.cpp +++ b/src/core/hle/service/es/es.cpp @@ -19,110 +19,14 @@ constexpr Result ERROR_INVALID_RIGHTS_ID{ErrorModule::ETicket, 3}; class ETicket final : public ServiceFramework { public: explicit ETicket(Core::System& system_) : ServiceFramework{system_, "es"} { - // clang-format off - static const FunctionInfo functions[] = { - {1, &ETicket::ImportTicket, "ImportTicket"}, - {2, nullptr, "ImportTicketCertificateSet"}, - {3, nullptr, "DeleteTicket"}, - {4, nullptr, "DeletePersonalizedTicket"}, - {5, nullptr, "DeleteAllCommonTicket"}, - {6, nullptr, "DeleteAllPersonalizedTicket"}, - {7, nullptr, "DeleteAllPersonalizedTicketEx"}, - {8, &ETicket::GetTitleKey, "GetTitleKey"}, - {9, &ETicket::CountCommonTicket, "CountCommonTicket"}, - {10, &ETicket::CountPersonalizedTicket, "CountPersonalizedTicket"}, - {11, &ETicket::ListCommonTicketRightsIds, "ListCommonTicketRightsIds"}, - {12, &ETicket::ListPersonalizedTicketRightsIds, "ListPersonalizedTicketRightsIds"}, - {13, nullptr, "ListMissingPersonalizedTicket"}, - {14, &ETicket::GetCommonTicketSize, "GetCommonTicketSize"}, - {15, &ETicket::GetPersonalizedTicketSize, "GetPersonalizedTicketSize"}, - {16, &ETicket::GetCommonTicketData, "GetCommonTicketData"}, - {17, &ETicket::GetPersonalizedTicketData, "GetPersonalizedTicketData"}, - {18, nullptr, "OwnTicket"}, - {19, nullptr, "GetTicketInfo"}, - {20, nullptr, "ListLightTicketInfo"}, - {21, nullptr, "SignData"}, - {22, nullptr, "GetCommonTicketAndCertificateSize"}, - {23, nullptr, "GetCommonTicketAndCertificateData"}, - {24, nullptr, "ImportPrepurchaseRecord"}, - {25, nullptr, "DeletePrepurchaseRecord"}, - {26, nullptr, "DeleteAllPrepurchaseRecord"}, - {27, nullptr, "CountPrepurchaseRecord"}, - {28, nullptr, "ListPrepurchaseRecordRightsIds"}, - {29, nullptr, "ListPrepurchaseRecordInfo"}, - {30, nullptr, "CountTicket"}, - {31, nullptr, "ListTicketRightsIds"}, - {32, nullptr, "CountPrepurchaseRecordEx"}, - {33, nullptr, "ListPrepurchaseRecordRightsIdsEx"}, - {34, nullptr, "GetEncryptedTicketSize"}, - {35, nullptr, "GetEncryptedTicketData"}, - {36, nullptr, "DeleteAllInactiveELicenseRequiredPersonalizedTicket"}, - {37, nullptr, "OwnTicket2"}, - {38, nullptr, "OwnTicket3"}, - {39, nullptr, "DeleteAllInactivePersonalizedTicket"}, - {40, nullptr, "DeletePrepurchaseRecordByNintendoAccountId"}, - {101, nullptr, "Unknown101"}, //18.0.0+ - {102, nullptr, "Unknown102"}, //18.0.0+ - {103, nullptr, "Unknown103"}, //18.0.0+ - {104, nullptr, "Unknown104"}, //18.0.0+ - {105, nullptr, "Unknown105"}, //20.0.0+ - {201, nullptr, "Unknown201"}, //18.0.0+ - {202, nullptr, "Unknown202"}, //18.0.0+ - {203, nullptr, "Unknown203"}, //18.0.0+ - {204, nullptr, "Unknown204"}, //18.0.0+ - {205, nullptr, "Unknown205"}, //18.0.0+ - {501, nullptr, "Unknown501"}, - {502, nullptr, "Unknown502"}, - {503, nullptr, "GetTitleKey"}, - {504, nullptr, "Unknown504"}, - {508, nullptr, "Unknown508"}, - {509, nullptr, "Unknown509"}, - {510, nullptr, "Unknown510"}, - {511, nullptr, "Unknown511"}, - {1001, nullptr, "Unknown1001"}, - {1002, nullptr, "Unknown1001"}, - {1003, nullptr, "Unknown1003"}, - {1004, nullptr, "Unknown1004"}, - {1005, nullptr, "Unknown1005"}, - {1006, nullptr, "Unknown1006"}, - {1007, nullptr, "Unknown1007"}, - {1009, nullptr, "Unknown1009"}, - {1010, nullptr, "Unknown1010"}, - {1011, nullptr, "Unknown1011"}, - {1012, nullptr, "Unknown1012"}, - {1013, nullptr, "Unknown1013"}, - {1014, nullptr, "Unknown1014"}, - {1015, nullptr, "Unknown1015"}, - {1016, nullptr, "Unknown1016"}, - {1017, nullptr, "Unknown1017"}, - {1018, nullptr, "Unknown1018"}, - {1019, nullptr, "Unknown1019"}, - {1020, nullptr, "Unknown1020"}, - {1021, nullptr, "Unknown1021"}, - {1501, nullptr, "Unknown1501"}, - {1502, nullptr, "Unknown1502"}, - {1503, nullptr, "Unknown1503"}, - {1504, nullptr, "Unknown1504"}, - {1505, nullptr, "Unknown1505"}, - {1506, nullptr, "Unknown1506"}, - {2000, nullptr, "Unknown2000"}, - {2001, nullptr, "Unknown2001"}, - {2002, nullptr, "Unknown2002"}, - {2003, nullptr, "Unknown2003"}, - {2100, nullptr, "Unknown2100"}, - {2501, nullptr, "Unknown2501"}, - {2502, nullptr, "Unknown2502"}, - {2601, nullptr, "Unknown2601"}, - {3001, nullptr, "Unknown3001"}, - {3002, nullptr, "Unknown3002"}, - }; - // clang-format on - RegisterHandlers(functions); - keys.PopulateTickets(); keys.SynthesizeTickets(); } + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + private: bool CheckRightsId(HLERequestContext& ctx, const u128& rights_id) { if (rights_id == u128{}) { @@ -317,89 +221,185 @@ private: rb.Push(write_size); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{1, &ETicket::ImportTicket, "ImportTicket"}, + FunctionInfo{2, nullptr, "ImportTicketCertificateSet"}, + FunctionInfo{3, nullptr, "DeleteTicket"}, + FunctionInfo{4, nullptr, "DeletePersonalizedTicket"}, + FunctionInfo{5, nullptr, "DeleteAllCommonTicket"}, + FunctionInfo{6, nullptr, "DeleteAllPersonalizedTicket"}, + FunctionInfo{7, nullptr, "DeleteAllPersonalizedTicketEx"}, + FunctionInfo{8, &ETicket::GetTitleKey, "GetTitleKey"}, + FunctionInfo{9, &ETicket::CountCommonTicket, "CountCommonTicket"}, + FunctionInfo{10, &ETicket::CountPersonalizedTicket, "CountPersonalizedTicket"}, + FunctionInfo{11, &ETicket::ListCommonTicketRightsIds, "ListCommonTicketRightsIds"}, + FunctionInfo{12, &ETicket::ListPersonalizedTicketRightsIds, "ListPersonalizedTicketRightsIds"}, + FunctionInfo{13, nullptr, "ListMissingPersonalizedTicket"}, + FunctionInfo{14, &ETicket::GetCommonTicketSize, "GetCommonTicketSize"}, + FunctionInfo{15, &ETicket::GetPersonalizedTicketSize, "GetPersonalizedTicketSize"}, + FunctionInfo{16, &ETicket::GetCommonTicketData, "GetCommonTicketData"}, + FunctionInfo{17, &ETicket::GetPersonalizedTicketData, "GetPersonalizedTicketData"}, + FunctionInfo{18, nullptr, "OwnTicket"}, + FunctionInfo{19, nullptr, "GetTicketInfo"}, + FunctionInfo{20, nullptr, "ListLightTicketInfo"}, + FunctionInfo{21, nullptr, "SignData"}, + FunctionInfo{22, nullptr, "GetCommonTicketAndCertificateSize"}, + FunctionInfo{23, nullptr, "GetCommonTicketAndCertificateData"}, + FunctionInfo{24, nullptr, "ImportPrepurchaseRecord"}, + FunctionInfo{25, nullptr, "DeletePrepurchaseRecord"}, + FunctionInfo{26, nullptr, "DeleteAllPrepurchaseRecord"}, + FunctionInfo{27, nullptr, "CountPrepurchaseRecord"}, + FunctionInfo{28, nullptr, "ListPrepurchaseRecordRightsIds"}, + FunctionInfo{29, nullptr, "ListPrepurchaseRecordInfo"}, + FunctionInfo{30, nullptr, "CountTicket"}, + FunctionInfo{31, nullptr, "ListTicketRightsIds"}, + FunctionInfo{32, nullptr, "CountPrepurchaseRecordEx"}, + FunctionInfo{33, nullptr, "ListPrepurchaseRecordRightsIdsEx"}, + FunctionInfo{34, nullptr, "GetEncryptedTicketSize"}, + FunctionInfo{35, nullptr, "GetEncryptedTicketData"}, + FunctionInfo{36, nullptr, "DeleteAllInactiveELicenseRequiredPersonalizedTicket"}, + FunctionInfo{37, nullptr, "OwnTicket2"}, + FunctionInfo{38, nullptr, "OwnTicket3"}, + FunctionInfo{39, nullptr, "DeleteAllInactivePersonalizedTicket"}, + FunctionInfo{40, nullptr, "DeletePrepurchaseRecordByNintendoAccountId"}, + FunctionInfo{101, nullptr, "Unknown101", MakeVersionGate({18,0,0})}, + FunctionInfo{102, nullptr, "Unknown102", MakeVersionGate({18,0,0})}, + FunctionInfo{103, nullptr, "Unknown103", MakeVersionGate({18,0,0})}, + FunctionInfo{104, nullptr, "Unknown104", MakeVersionGate({18,0,0})}, + FunctionInfo{105, nullptr, "Unknown105", MakeVersionGate({20,0,0})}, + FunctionInfo{201, nullptr, "Unknown201", MakeVersionGate({18,0,0})}, + FunctionInfo{202, nullptr, "Unknown202", MakeVersionGate({18,0,0})}, + FunctionInfo{203, nullptr, "Unknown203", MakeVersionGate({18,0,0})}, + FunctionInfo{204, nullptr, "Unknown204", MakeVersionGate({18,0,0})}, + FunctionInfo{205, nullptr, "Unknown205", MakeVersionGate({18,0,0})}, + FunctionInfo{501, nullptr, "Unknown501"}, + FunctionInfo{502, nullptr, "Unknown502"}, + FunctionInfo{503, nullptr, "GetTitleKey"}, + FunctionInfo{504, nullptr, "Unknown504"}, + FunctionInfo{508, nullptr, "Unknown508"}, + FunctionInfo{509, nullptr, "Unknown509"}, + FunctionInfo{510, nullptr, "Unknown510"}, + FunctionInfo{511, nullptr, "Unknown511"}, + FunctionInfo{1001, nullptr, "Unknown1001"}, + FunctionInfo{1002, nullptr, "Unknown1001"}, + FunctionInfo{1003, nullptr, "Unknown1003"}, + FunctionInfo{1004, nullptr, "Unknown1004"}, + FunctionInfo{1005, nullptr, "Unknown1005"}, + FunctionInfo{1006, nullptr, "Unknown1006"}, + FunctionInfo{1007, nullptr, "Unknown1007"}, + FunctionInfo{1009, nullptr, "Unknown1009"}, + FunctionInfo{1010, nullptr, "Unknown1010"}, + FunctionInfo{1011, nullptr, "Unknown1011"}, + FunctionInfo{1012, nullptr, "Unknown1012"}, + FunctionInfo{1013, nullptr, "Unknown1013"}, + FunctionInfo{1014, nullptr, "Unknown1014"}, + FunctionInfo{1015, nullptr, "Unknown1015"}, + FunctionInfo{1016, nullptr, "Unknown1016"}, + FunctionInfo{1017, nullptr, "Unknown1017"}, + FunctionInfo{1018, nullptr, "Unknown1018"}, + FunctionInfo{1019, nullptr, "Unknown1019"}, + FunctionInfo{1020, nullptr, "Unknown1020"}, + FunctionInfo{1021, nullptr, "Unknown1021"}, + FunctionInfo{1501, nullptr, "Unknown1501"}, + FunctionInfo{1502, nullptr, "Unknown1502"}, + FunctionInfo{1503, nullptr, "Unknown1503"}, + FunctionInfo{1504, nullptr, "Unknown1504"}, + FunctionInfo{1505, nullptr, "Unknown1505"}, + FunctionInfo{1506, nullptr, "Unknown1506"}, + FunctionInfo{2000, nullptr, "Unknown2000"}, + FunctionInfo{2001, nullptr, "Unknown2001"}, + FunctionInfo{2002, nullptr, "Unknown2002"}, + FunctionInfo{2003, nullptr, "Unknown2003"}, + FunctionInfo{2100, nullptr, "Unknown2100"}, + FunctionInfo{2501, nullptr, "Unknown2501"}, + FunctionInfo{2502, nullptr, "Unknown2502"}, + FunctionInfo{2601, nullptr, "Unknown2601"}, + FunctionInfo{3001, nullptr, "Unknown3001"}, + FunctionInfo{3002, nullptr, "Unknown3002"} + ); Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance(); }; class NDRM_LU final : public ServiceFramework { public: explicit NDRM_LU(Core::System& system_) - : ServiceFramework{system_, "ndrm:lu"} { - // clang-format off - static const FunctionInfo functions[] = { - {1, nullptr, "Cmd1"}, - {2, nullptr, "Cmd2"}, - {3, nullptr, "Cmd3"}, - {1000, nullptr, "Cmd1000"}, - {8000, nullptr, "Cmd8000"}, - }; - // clang-format on - RegisterHandlers(functions); + : ServiceFramework{system_, "ndrm:lu"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{1, nullptr, "Cmd1"}, + FunctionInfo{2, nullptr, "Cmd2"}, + FunctionInfo{3, nullptr, "Cmd3"}, + FunctionInfo{1000, nullptr, "Cmd1000"}, + FunctionInfo{8000, nullptr, "Cmd8000"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class NDRM_LA final : public ServiceFramework { public: explicit NDRM_LA(Core::System& system_) - : ServiceFramework{system_, "ndrm:la"} { - // clang-format off - static const FunctionInfo functions[] = { - {1, nullptr, "Cmd1"}, - {2, nullptr, "Cmd2"}, - {3, nullptr, "Cmd3"}, - {4, nullptr, "Cmd4"}, - {5, nullptr, "Cmd5"}, - {6, nullptr, "Cmd6"}, - {7, nullptr, "Cmd7"}, - {8, nullptr, "Cmd8"}, - {9, nullptr, "Cmd9"}, - {10, nullptr, "Cmd10"}, - {11, nullptr, "Cmd11"}, - {12, nullptr, "Cmd12"}, - {13, nullptr, "Cmd13"}, - {14, nullptr, "Cmd14"}, - {15, nullptr, "Cmd15"}, - {16, nullptr, "Cmd16"}, - {17, nullptr, "Cmd17"}, - {18, nullptr, "Cmd18"}, - {19, nullptr, "Cmd19"}, - {20, nullptr, "Cmd20"}, - {21, nullptr, "Cmd21"}, - {22, nullptr, "Cmd22"}, - {23, nullptr, "Cmd23"}, - {24, nullptr, "Cmd24"}, - {25, nullptr, "Cmd25"}, - {26, nullptr, "Cmd26"}, - {27, nullptr, "Cmd27"}, - {28, nullptr, "Cmd28"}, - {29, nullptr, "Cmd29"}, - {30, nullptr, "Cmd30"}, - {31, nullptr, "Cmd31"}, - {32, nullptr, "Cmd32"}, - {33, nullptr, "Cmd33"}, - {34, nullptr, "Cmd34"}, - {35, nullptr, "Cmd35"}, - {36, nullptr, "Cmd36"}, - {37, nullptr, "Cmd37"}, - {38, nullptr, "Cmd38"}, - {39, nullptr, "Cmd39"}, - {40, nullptr, "Cmd40"}, - {42, nullptr, "Cmd42"}, - {43, nullptr, "Cmd43"}, - {44, nullptr, "Cmd44"}, - {45, nullptr, "Cmd45"}, - {46, nullptr, "Cmd46"}, - {47, nullptr, "Cmd47"}, - {48, nullptr, "Cmd48"}, - {49, nullptr, "Cmd49"}, - {50, nullptr, "Cmd50"}, - {51, nullptr, "Cmd51"}, - {8000, nullptr, "Cmd8000"}, - {8001, nullptr, "Cmd8001"}, - {8002, nullptr, "Cmd8002"}, - {8003, nullptr, "Cmd8003"}, - }; - // clang-format on - RegisterHandlers(functions); + : ServiceFramework{system_, "ndrm:la"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{1, nullptr, "Cmd1"}, + FunctionInfo{2, nullptr, "Cmd2"}, + FunctionInfo{3, nullptr, "Cmd3"}, + FunctionInfo{4, nullptr, "Cmd4"}, + FunctionInfo{5, nullptr, "Cmd5"}, + FunctionInfo{6, nullptr, "Cmd6"}, + FunctionInfo{7, nullptr, "Cmd7"}, + FunctionInfo{8, nullptr, "Cmd8"}, + FunctionInfo{9, nullptr, "Cmd9"}, + FunctionInfo{10, nullptr, "Cmd10"}, + FunctionInfo{11, nullptr, "Cmd11"}, + FunctionInfo{12, nullptr, "Cmd12"}, + FunctionInfo{13, nullptr, "Cmd13"}, + FunctionInfo{14, nullptr, "Cmd14"}, + FunctionInfo{15, nullptr, "Cmd15"}, + FunctionInfo{16, nullptr, "Cmd16"}, + FunctionInfo{17, nullptr, "Cmd17"}, + FunctionInfo{18, nullptr, "Cmd18"}, + FunctionInfo{19, nullptr, "Cmd19"}, + FunctionInfo{20, nullptr, "Cmd20"}, + FunctionInfo{21, nullptr, "Cmd21"}, + FunctionInfo{22, nullptr, "Cmd22"}, + FunctionInfo{23, nullptr, "Cmd23"}, + FunctionInfo{24, nullptr, "Cmd24"}, + FunctionInfo{25, nullptr, "Cmd25"}, + FunctionInfo{26, nullptr, "Cmd26"}, + FunctionInfo{27, nullptr, "Cmd27"}, + FunctionInfo{28, nullptr, "Cmd28"}, + FunctionInfo{29, nullptr, "Cmd29"}, + FunctionInfo{30, nullptr, "Cmd30"}, + FunctionInfo{31, nullptr, "Cmd31"}, + FunctionInfo{32, nullptr, "Cmd32"}, + FunctionInfo{33, nullptr, "Cmd33"}, + FunctionInfo{34, nullptr, "Cmd34"}, + FunctionInfo{35, nullptr, "Cmd35"}, + FunctionInfo{36, nullptr, "Cmd36"}, + FunctionInfo{37, nullptr, "Cmd37"}, + FunctionInfo{38, nullptr, "Cmd38"}, + FunctionInfo{39, nullptr, "Cmd39"}, + FunctionInfo{40, nullptr, "Cmd40"}, + FunctionInfo{42, nullptr, "Cmd42"}, + FunctionInfo{43, nullptr, "Cmd43"}, + FunctionInfo{44, nullptr, "Cmd44"}, + FunctionInfo{45, nullptr, "Cmd45"}, + FunctionInfo{46, nullptr, "Cmd46"}, + FunctionInfo{47, nullptr, "Cmd47"}, + FunctionInfo{48, nullptr, "Cmd48"}, + FunctionInfo{49, nullptr, "Cmd49"}, + FunctionInfo{50, nullptr, "Cmd50"}, + FunctionInfo{51, nullptr, "Cmd51"}, + FunctionInfo{8000, nullptr, "Cmd8000"}, + FunctionInfo{8001, nullptr, "Cmd8001"}, + FunctionInfo{8002, nullptr, "Cmd8002"}, + FunctionInfo{8003, nullptr, "Cmd8003"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; diff --git a/src/core/hle/service/eupld/eupld.cpp b/src/core/hle/service/eupld/eupld.cpp index 3cf27513ae..ed1e1c19c5 100644 --- a/src/core/hle/service/eupld/eupld.cpp +++ b/src/core/hle/service/eupld/eupld.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -11,36 +14,34 @@ namespace Service::EUPLD { class ErrorUploadContext final : public ServiceFramework { public: - explicit ErrorUploadContext(Core::System& system_) : ServiceFramework{system_, "eupld:c"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "SetUrl"}, - {1, nullptr, "ImportCrt"}, - {2, nullptr, "ImportPki"}, - {3, nullptr, "SetAutoUpload"}, - {4, nullptr, "GetAutoUpload"}, - }; - // clang-format on + explicit ErrorUploadContext(Core::System& system_) : ServiceFramework{system_, "eupld:c"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "SetUrl"}, + FunctionInfo{1, nullptr, "ImportCrt"}, + FunctionInfo{2, nullptr, "ImportPki"}, + FunctionInfo{3, nullptr, "SetAutoUpload"}, + FunctionInfo{4, nullptr, "GetAutoUpload"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class ErrorUploadRequest final : public ServiceFramework { public: - explicit ErrorUploadRequest(Core::System& system_) : ServiceFramework{system_, "eupld:r"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "Initialize"}, - {1, nullptr, "UploadAll"}, - {2, nullptr, "UploadSelected"}, - {3, nullptr, "GetUploadStatus"}, - {4, nullptr, "CancelUpload"}, - {5, nullptr, "GetResult"}, - }; - // clang-format on + explicit ErrorUploadRequest(Core::System& system_) : ServiceFramework{system_, "eupld:r"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "Initialize"}, + FunctionInfo{1, nullptr, "UploadAll"}, + FunctionInfo{2, nullptr, "UploadSelected"}, + FunctionInfo{3, nullptr, "GetUploadStatus"}, + FunctionInfo{4, nullptr, "CancelUpload"}, + FunctionInfo{5, nullptr, "GetResult"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; diff --git a/src/core/hle/service/fatal/fatal.cpp b/src/core/hle/service/fatal/fatal.cpp index db48526614..4c9eca5d5b 100644 --- a/src/core/hle/service/fatal/fatal.cpp +++ b/src/core/hle/service/fatal/fatal.cpp @@ -13,8 +13,6 @@ #include "common/swap.h" #include "core/core.h" #include "core/hle/service/fatal/fatal.h" -#include "core/hle/service/fatal/fatal_p.h" -#include "core/hle/service/fatal/fatal_u.h" #include "core/hle/service/ipc_helpers.h" #include "core/hle/service/server_manager.h" #include "core/reporter.h" @@ -167,6 +165,35 @@ void Module::Interface::ThrowFatalWithCpuContext(HLERequestContext& ctx) { rb.Push(ResultSuccess); } +class Fatal_P final : public Module::Interface { +public: + explicit Fatal_P(std::shared_ptr module_, Core::System& system_) : Interface(std::move(module_), system_, "fatal:p") {} + ~Fatal_P() override = default; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetFatalEvent"}, + FunctionInfo{10, nullptr, "GetFatalContext"} + ); +}; + +class Fatal_U final : public Module::Interface { +public: + explicit Fatal_U(std::shared_ptr module_, Core::System& system_) : Interface(std::move(module_), system_, "fatal:u") {} + ~Fatal_U() override = default; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &Fatal_U::ThrowFatal, "ThrowFatal"}, + FunctionInfo{1, &Fatal_U::ThrowFatalWithPolicy, "ThrowFatalWithPolicy"}, + FunctionInfo{2, &Fatal_U::ThrowFatalWithCpuContext, "ThrowFatalWithCpuContext"} + ); +}; + void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); auto module = std::make_shared(); diff --git a/src/core/hle/service/fatal/fatal_p.cpp b/src/core/hle/service/fatal/fatal_p.cpp deleted file mode 100644 index 4a81bb5e2f..0000000000 --- a/src/core/hle/service/fatal/fatal_p.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/hle/service/fatal/fatal_p.h" - -namespace Service::Fatal { - -Fatal_P::Fatal_P(std::shared_ptr module_, Core::System& system_) - : Interface(std::move(module_), system_, "fatal:p") { - static const FunctionInfo functions[] = { - {0, nullptr, "GetFatalEvent"}, - {10, nullptr, "GetFatalContext"}, - }; - RegisterHandlers(functions); -} - -Fatal_P::~Fatal_P() = default; - -} // namespace Service::Fatal diff --git a/src/core/hle/service/fatal/fatal_p.h b/src/core/hle/service/fatal/fatal_p.h deleted file mode 100644 index f743368350..0000000000 --- a/src/core/hle/service/fatal/fatal_p.h +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/fatal/fatal.h" - -namespace Service::Fatal { - -class Fatal_P final : public Module::Interface { -public: - explicit Fatal_P(std::shared_ptr module_, Core::System& system_); - ~Fatal_P() override; -}; - -} // namespace Service::Fatal diff --git a/src/core/hle/service/fatal/fatal_u.cpp b/src/core/hle/service/fatal/fatal_u.cpp deleted file mode 100644 index 3739711fce..0000000000 --- a/src/core/hle/service/fatal/fatal_u.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/hle/service/fatal/fatal_u.h" - -namespace Service::Fatal { - -Fatal_U::Fatal_U(std::shared_ptr module_, Core::System& system_) - : Interface(std::move(module_), system_, "fatal:u") { - static const FunctionInfo functions[] = { - {0, &Fatal_U::ThrowFatal, "ThrowFatal"}, - {1, &Fatal_U::ThrowFatalWithPolicy, "ThrowFatalWithPolicy"}, - {2, &Fatal_U::ThrowFatalWithCpuContext, "ThrowFatalWithCpuContext"}, - }; - RegisterHandlers(functions); -} - -Fatal_U::~Fatal_U() = default; - -} // namespace Service::Fatal diff --git a/src/core/hle/service/fatal/fatal_u.h b/src/core/hle/service/fatal/fatal_u.h deleted file mode 100644 index 65fbe26961..0000000000 --- a/src/core/hle/service/fatal/fatal_u.h +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/fatal/fatal.h" - -namespace Service::Fatal { - -class Fatal_U final : public Module::Interface { -public: - explicit Fatal_U(std::shared_ptr module_, Core::System& system_); - ~Fatal_U() override; -}; - -} // namespace Service::Fatal diff --git a/src/core/hle/service/fgm/fgm.cpp b/src/core/hle/service/fgm/fgm.cpp index cac03ae24c..96ea3478ea 100644 --- a/src/core/hle/service/fgm/fgm.cpp +++ b/src/core/hle/service/fgm/fgm.cpp @@ -16,30 +16,26 @@ namespace Service::FGM { class IRequest final : public ServiceFramework { public: - explicit IRequest(Core::System& system_) : ServiceFramework{system_, "IRequest"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "Initialize"}, - {1, nullptr, "Set"}, - {2, nullptr, "Get"}, - {3, nullptr, "Cancel"}, - }; - // clang-format on + explicit IRequest(Core::System& system_) : ServiceFramework{system_, "IRequest"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "Initialize"}, + FunctionInfo{1, nullptr, "Set"}, + FunctionInfo{2, nullptr, "Get"}, + FunctionInfo{3, nullptr, "Cancel"} + ); }; class FGM final : public ServiceFramework { public: - explicit FGM(Core::System& system_, const char* name) : ServiceFramework{system_, name} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &FGM::Initialize, "Initialize"}, - }; - // clang-format on + explicit FGM(Core::System& system_, const char* name) : ServiceFramework{system_, name} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -50,21 +46,25 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &FGM::Initialize, "Initialize"} + ); }; class FGM_DBG final : public ServiceFramework { public: - explicit FGM_DBG(Core::System& system_) : ServiceFramework{system_, "fgm:dbg"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "Initialize"}, - {1, nullptr, "Read"}, - {2, nullptr, "Cancel"}, - }; - // clang-format on + explicit FGM_DBG(Core::System& system_) : ServiceFramework{system_, "fgm:dbg"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "Initialize"}, + FunctionInfo{1, nullptr, "Read"}, + FunctionInfo{2, nullptr, "Cancel"} + ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/filesystem/fsp/fs_i_directory.cpp b/src/core/hle/service/filesystem/fsp/fs_i_directory.cpp index 8483394d0c..793b86cc51 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_directory.cpp +++ b/src/core/hle/service/filesystem/fsp/fs_i_directory.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -8,15 +11,18 @@ namespace Service::FileSystem { +std::optional IDirectory::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IDirectory::Read>, "Read"}, + FunctionInfo{1, D<&IDirectory::GetEntryCount>, "GetEntryCount"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IDirectory::IDirectory(Core::System& system_, FileSys::VirtualDir directory_, FileSys::OpenDirectoryMode mode) : ServiceFramework{system_, "IDirectory"}, backend(std::make_unique(directory_, mode)) { - static const FunctionInfo functions[] = { - {0, D<&IDirectory::Read>, "Read"}, - {1, D<&IDirectory::GetEntryCount>, "GetEntryCount"}, - }; - RegisterHandlers(functions); } Result IDirectory::Read( diff --git a/src/core/hle/service/filesystem/fsp/fs_i_directory.h b/src/core/hle/service/filesystem/fsp/fs_i_directory.h index b6251f7fdb..f2a57260e1 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_directory.h +++ b/src/core/hle/service/filesystem/fsp/fs_i_directory.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -26,6 +29,8 @@ private: Result Read(Out out_count, const OutArray out_entries); Result GetEntryCount(Out out_count); + + std::optional FindRequest(u32 key) override; }; } // namespace Service::FileSystem diff --git a/src/core/hle/service/filesystem/fsp/fs_i_file.cpp b/src/core/hle/service/filesystem/fsp/fs_i_file.cpp index 22cbe2be2c..78ca90a4af 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_file.cpp +++ b/src/core/hle/service/filesystem/fsp/fs_i_file.cpp @@ -12,18 +12,6 @@ namespace Service::FileSystem { IFile::IFile(Core::System& system_, FileSys::VirtualFile file_) : ServiceFramework{system_, "IFile"}, backend{std::make_unique(file_)} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IFile::Read>, "Read"}, - {1, D<&IFile::Write>, "Write"}, - {2, D<&IFile::Flush>, "Flush"}, - {3, D<&IFile::SetSize>, "SetSize"}, - {4, D<&IFile::GetSize>, "GetSize"}, - {5, nullptr, "OperateRange"}, - {6, nullptr, "OperateRangeWithBuffer"}, - }; - // clang-format on - RegisterHandlers(functions); } Result IFile::Read( diff --git a/src/core/hle/service/filesystem/fsp/fs_i_file.h b/src/core/hle/service/filesystem/fsp/fs_i_file.h index e8599ee2f8..992330e149 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_file.h +++ b/src/core/hle/service/filesystem/fsp/fs_i_file.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -27,6 +30,19 @@ private: Result Flush(); Result SetSize(s64 size); Result GetSize(Out out_size); + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IFile::Read>, "Read"}, + FunctionInfo{1, D<&IFile::Write>, "Write"}, + FunctionInfo{2, D<&IFile::Flush>, "Flush"}, + FunctionInfo{3, D<&IFile::SetSize>, "SetSize"}, + FunctionInfo{4, D<&IFile::GetSize>, "GetSize"}, + FunctionInfo{5, nullptr, "OperateRange"}, + FunctionInfo{6, nullptr, "OperateRangeWithBuffer"} + ); }; } // namespace Service::FileSystem diff --git a/src/core/hle/service/filesystem/fsp/fs_i_filesystem.cpp b/src/core/hle/service/filesystem/fsp/fs_i_filesystem.cpp index edd381f57c..6ab4916a36 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_filesystem.cpp +++ b/src/core/hle/service/filesystem/fsp/fs_i_filesystem.cpp @@ -13,30 +13,33 @@ namespace Service::FileSystem { +std::optional IFileSystem::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IFileSystem::CreateFile>, "CreateFile"}, + FunctionInfo{1, D<&IFileSystem::DeleteFile>, "DeleteFile"}, + FunctionInfo{2, D<&IFileSystem::CreateDirectory>, "CreateDirectory"}, + FunctionInfo{3, D<&IFileSystem::DeleteDirectory>, "DeleteDirectory"}, + FunctionInfo{4, D<&IFileSystem::DeleteDirectoryRecursively>, "DeleteDirectoryRecursively"}, + FunctionInfo{5, D<&IFileSystem::RenameFile>, "RenameFile"}, + FunctionInfo{6, D<&IFileSystem::RenameDirectory>, "RenameDirectory"}, + FunctionInfo{7, D<&IFileSystem::GetEntryType>, "GetEntryType"}, + FunctionInfo{8, D<&IFileSystem::OpenFile>, "OpenFile"}, + FunctionInfo{9, D<&IFileSystem::OpenDirectory>, "OpenDirectory"}, + FunctionInfo{10, D<&IFileSystem::Commit>, "Commit"}, + FunctionInfo{11, D<&IFileSystem::GetFreeSpaceSize>, "GetFreeSpaceSize"}, + FunctionInfo{12, D<&IFileSystem::GetTotalSpaceSize>, "GetTotalSpaceSize"}, + FunctionInfo{13, D<&IFileSystem::CleanDirectoryRecursively>, "CleanDirectoryRecursively"}, + FunctionInfo{14, D<&IFileSystem::GetFileTimeStampRaw>, "GetFileTimeStampRaw"}, + FunctionInfo{15, nullptr, "QueryEntry"}, + FunctionInfo{16, D<&IFileSystem::GetFileSystemAttribute>, "GetFileSystemAttribute"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IFileSystem::IFileSystem(Core::System& system_, FileSys::VirtualDir dir_, SizeGetter size_getter_) : ServiceFramework{system_, "IFileSystem"}, backend{std::make_unique( dir_)}, size_getter{std::move(size_getter_)} { - static const FunctionInfo functions[] = { - {0, D<&IFileSystem::CreateFile>, "CreateFile"}, - {1, D<&IFileSystem::DeleteFile>, "DeleteFile"}, - {2, D<&IFileSystem::CreateDirectory>, "CreateDirectory"}, - {3, D<&IFileSystem::DeleteDirectory>, "DeleteDirectory"}, - {4, D<&IFileSystem::DeleteDirectoryRecursively>, "DeleteDirectoryRecursively"}, - {5, D<&IFileSystem::RenameFile>, "RenameFile"}, - {6, D<&IFileSystem::RenameDirectory>, "RenameDirectory"}, - {7, D<&IFileSystem::GetEntryType>, "GetEntryType"}, - {8, D<&IFileSystem::OpenFile>, "OpenFile"}, - {9, D<&IFileSystem::OpenDirectory>, "OpenDirectory"}, - {10, D<&IFileSystem::Commit>, "Commit"}, - {11, D<&IFileSystem::GetFreeSpaceSize>, "GetFreeSpaceSize"}, - {12, D<&IFileSystem::GetTotalSpaceSize>, "GetTotalSpaceSize"}, - {13, D<&IFileSystem::CleanDirectoryRecursively>, "CleanDirectoryRecursively"}, - {14, D<&IFileSystem::GetFileTimeStampRaw>, "GetFileTimeStampRaw"}, - {15, nullptr, "QueryEntry"}, - {16, D<&IFileSystem::GetFileSystemAttribute>, "GetFileSystemAttribute"}, - }; - RegisterHandlers(functions); } Result IFileSystem::CreateFile(const InLargeData path, diff --git a/src/core/hle/service/filesystem/fsp/fs_i_filesystem.h b/src/core/hle/service/filesystem/fsp/fs_i_filesystem.h index ed03c3ef83..11d3c7fb31 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_filesystem.h +++ b/src/core/hle/service/filesystem/fsp/fs_i_filesystem.h @@ -58,6 +58,7 @@ public: Result GetFileSystemAttribute(Out out_attribute); private: + std::optional FindRequest(u32 key) override; std::unique_ptr backend; SizeGetter size_getter; }; diff --git a/src/core/hle/service/filesystem/fsp/fs_i_multi_commit_manager.cpp b/src/core/hle/service/filesystem/fsp/fs_i_multi_commit_manager.cpp index 6263282344..f6eac6ca10 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_multi_commit_manager.cpp +++ b/src/core/hle/service/filesystem/fsp/fs_i_multi_commit_manager.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -9,11 +12,6 @@ namespace Service::FileSystem { IMultiCommitManager::IMultiCommitManager(Core::System& system_) : ServiceFramework{system_, "IMultiCommitManager"} { - static const FunctionInfo functions[] = { - {1, D<&IMultiCommitManager::Add>, "Add"}, - {2, D<&IMultiCommitManager::Commit>, "Commit"}, - }; - RegisterHandlers(functions); } IMultiCommitManager::~IMultiCommitManager() = default; diff --git a/src/core/hle/service/filesystem/fsp/fs_i_multi_commit_manager.h b/src/core/hle/service/filesystem/fsp/fs_i_multi_commit_manager.h index 8ebf7c7d96..31182e9159 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_multi_commit_manager.h +++ b/src/core/hle/service/filesystem/fsp/fs_i_multi_commit_manager.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -17,6 +20,13 @@ private: Result Add(std::shared_ptr filesystem); Result Commit(); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{1, D<&IMultiCommitManager::Add>, "Add"}, + FunctionInfo{2, D<&IMultiCommitManager::Commit>, "Commit"} + ); FileSys::VirtualFile backend; }; diff --git a/src/core/hle/service/filesystem/fsp/fs_i_save_data_info_reader.cpp b/src/core/hle/service/filesystem/fsp/fs_i_save_data_info_reader.cpp index 495b131df4..8353b72c24 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_save_data_info_reader.cpp +++ b/src/core/hle/service/filesystem/fsp/fs_i_save_data_info_reader.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project @@ -17,11 +17,6 @@ ISaveDataInfoReader::ISaveDataInfoReader(Core::System& system_, FileSys::SaveDataSpaceId space) : ServiceFramework{system_, "ISaveDataInfoReader"}, save_data_controller{ save_data_controller_} { - static const FunctionInfo functions[] = { - {0, D<&ISaveDataInfoReader::ReadSaveDataInfo>, "ReadSaveDataInfo"}, - }; - RegisterHandlers(functions); - FindAllSaves(space); } diff --git a/src/core/hle/service/filesystem/fsp/fs_i_save_data_info_reader.h b/src/core/hle/service/filesystem/fsp/fs_i_save_data_info_reader.h index e45ad852ba..7faa4291c0 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_save_data_info_reader.h +++ b/src/core/hle/service/filesystem/fsp/fs_i_save_data_info_reader.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -42,6 +45,12 @@ private: void FindNormalSaves(FileSys::SaveDataSpaceId space, const FileSys::VirtualDir& type); void FindTemporaryStorageSaves(FileSys::SaveDataSpaceId space, const FileSys::VirtualDir& type); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&ISaveDataInfoReader::ReadSaveDataInfo>, "ReadSaveDataInfo"} + ); std::shared_ptr save_data_controller; std::vector info; u64 next_entry_index = 0; diff --git a/src/core/hle/service/filesystem/fsp/fs_i_storage.cpp b/src/core/hle/service/filesystem/fsp/fs_i_storage.cpp index 50b7d1e765..ac884b3b28 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_storage.cpp +++ b/src/core/hle/service/filesystem/fsp/fs_i_storage.cpp @@ -12,15 +12,6 @@ namespace Service::FileSystem { IStorage::IStorage(Core::System& system_, FileSys::VirtualFile backend_) : ServiceFramework{system_, "IStorage"}, backend(std::move(backend_)) { - static const FunctionInfo functions[] = { - {0, D<&IStorage::Read>, "Read"}, - {1, nullptr, "Write"}, - {2, nullptr, "Flush"}, - {3, nullptr, "SetSize"}, - {4, D<&IStorage::GetSize>, "GetSize"}, - {5, nullptr, "OperateRange"}, - }; - RegisterHandlers(functions); } Result IStorage::Read( diff --git a/src/core/hle/service/filesystem/fsp/fs_i_storage.h b/src/core/hle/service/filesystem/fsp/fs_i_storage.h index 74d879386f..44d5a6c8bb 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_storage.h +++ b/src/core/hle/service/filesystem/fsp/fs_i_storage.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -15,12 +18,23 @@ public: explicit IStorage(Core::System& system_, FileSys::VirtualFile backend_); private: - FileSys::VirtualFile backend; - Result Read( OutBuffer out_bytes, s64 offset, s64 length); Result GetSize(Out out_size); + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IStorage::Read>, "Read"}, + FunctionInfo{1, nullptr, "Write"}, + FunctionInfo{2, nullptr, "Flush"}, + FunctionInfo{3, nullptr, "SetSize"}, + FunctionInfo{4, D<&IStorage::GetSize>, "GetSize"}, + FunctionInfo{5, nullptr, "OperateRange"} + ); + FileSys::VirtualFile backend; }; } // namespace Service::FileSystem diff --git a/src/core/hle/service/filesystem/fsp/fsp_ldr.cpp b/src/core/hle/service/filesystem/fsp/fsp_ldr.cpp index 8ee733f474..1f83d6509b 100644 --- a/src/core/hle/service/filesystem/fsp/fsp_ldr.cpp +++ b/src/core/hle/service/filesystem/fsp/fsp_ldr.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -6,15 +9,6 @@ namespace Service::FileSystem { FSP_LDR::FSP_LDR(Core::System& system_) : ServiceFramework{system_, "fsp:ldr"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "OpenCodeFileSystem"}, - {1, nullptr, "IsArchivedProgram"}, - {2, nullptr, "SetCurrentProcess"}, - }; - // clang-format on - - RegisterHandlers(functions); } FSP_LDR::~FSP_LDR() = default; diff --git a/src/core/hle/service/filesystem/fsp/fsp_ldr.h b/src/core/hle/service/filesystem/fsp/fsp_ldr.h index 358739a872..fe3abeff1d 100644 --- a/src/core/hle/service/filesystem/fsp/fsp_ldr.h +++ b/src/core/hle/service/filesystem/fsp/fsp_ldr.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -15,6 +18,15 @@ class FSP_LDR final : public ServiceFramework { public: explicit FSP_LDR(Core::System& system_); ~FSP_LDR() override; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "OpenCodeFileSystem"}, + FunctionInfo{1, nullptr, "IsArchivedProgram"}, + FunctionInfo{2, nullptr, "SetCurrentProcess"} + ); }; } // namespace Service::FileSystem diff --git a/src/core/hle/service/filesystem/fsp/fsp_pr.cpp b/src/core/hle/service/filesystem/fsp/fsp_pr.cpp index 7c03ebaeae..9378e6e0c6 100644 --- a/src/core/hle/service/filesystem/fsp/fsp_pr.cpp +++ b/src/core/hle/service/filesystem/fsp/fsp_pr.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -6,16 +9,6 @@ namespace Service::FileSystem { FSP_PR::FSP_PR(Core::System& system_) : ServiceFramework{system_, "fsp:pr"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "RegisterProgram"}, - {1, nullptr, "UnregisterProgram"}, - {2, nullptr, "SetCurrentProcess"}, - {256, nullptr, "SetEnabledProgramVerification"}, - }; - // clang-format on - - RegisterHandlers(functions); } FSP_PR::~FSP_PR() = default; diff --git a/src/core/hle/service/filesystem/fsp/fsp_pr.h b/src/core/hle/service/filesystem/fsp/fsp_pr.h index bd4e0a730c..bc692151a5 100644 --- a/src/core/hle/service/filesystem/fsp/fsp_pr.h +++ b/src/core/hle/service/filesystem/fsp/fsp_pr.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -15,6 +18,16 @@ class FSP_PR final : public ServiceFramework { public: explicit FSP_PR(Core::System& system_); ~FSP_PR() override; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "RegisterProgram"}, + FunctionInfo{1, nullptr, "UnregisterProgram"}, + FunctionInfo{2, nullptr, "SetCurrentProcess"}, + FunctionInfo{256, nullptr, "SetEnabledProgramVerification"} + ); }; } // namespace Service::FileSystem diff --git a/src/core/hle/service/filesystem/fsp/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp/fsp_srv.cpp index 58303a0bd6..cb349636d5 100644 --- a/src/core/hle/service/filesystem/fsp/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp/fsp_srv.cpp @@ -47,143 +47,142 @@ namespace Service::FileSystem { -FSP_SRV::FSP_SRV(Core::System& system_) - : ServiceFramework{system_, "fsp-srv"}, fsc{system.GetFileSystemController()}, - content_provider{system.GetContentProvider()}, reporter{system.GetReporter()} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "OpenFileSystem"}, - {1, D<&FSP_SRV::SetCurrentProcess>, "SetCurrentProcess"}, - {2, D<&FSP_SRV::OpenDataFileSystemByCurrentProcess>, "OpenDataFileSystemByCurrentProcess"}, - {7, D<&FSP_SRV::OpenFileSystemWithPatch>, "OpenFileSystemWithPatch"}, - {8, nullptr, "OpenFileSystemWithId"}, - {9, nullptr, "OpenDataFileSystemByApplicationId"}, - {11, nullptr, "OpenBisFileSystem"}, - {12, nullptr, "OpenBisStorage"}, - {13, nullptr, "InvalidateBisCache"}, - {17, nullptr, "OpenHostFileSystem"}, - {18, D<&FSP_SRV::OpenSdCardFileSystem>, "OpenSdCardFileSystem"}, - {19, nullptr, "FormatSdCardFileSystem"}, - {21, nullptr, "DeleteSaveDataFileSystem"}, - {22, D<&FSP_SRV::CreateSaveDataFileSystem>, "CreateSaveDataFileSystem"}, - {23, D<&FSP_SRV::CreateSaveDataFileSystemBySystemSaveDataId>, "CreateSaveDataFileSystemBySystemSaveDataId"}, - {24, nullptr, "RegisterSaveDataFileSystemAtomicDeletion"}, - {25, nullptr, "DeleteSaveDataFileSystemBySaveDataSpaceId"}, - {26, nullptr, "FormatSdCardDryRun"}, - {27, D<&FSP_SRV::IsExFatSupported>, "IsExFatSupported"}, - {28, nullptr, "DeleteSaveDataFileSystemBySaveDataAttribute"}, - {30, nullptr, "OpenGameCardStorage"}, - {31, nullptr, "OpenGameCardFileSystem"}, - {32, D<&FSP_SRV::ExtendSaveDataFileSystem>, "ExtendSaveDataFileSystem"}, - {33, nullptr, "DeleteCacheStorage"}, - {34, D<&FSP_SRV::GetCacheStorageSize>, "GetCacheStorageSize"}, - {35, nullptr, "CreateSaveDataFileSystemByHashSalt"}, - {36, nullptr, "OpenHostFileSystemWithOption"}, - {37, D<&FSP_SRV::CreateSaveDataFileSystemWithCreationInfo2>, "CreateSaveDataFileSystemWithCreationInfo2"}, - {51, D<&FSP_SRV::OpenSaveDataFileSystem>, "OpenSaveDataFileSystem"}, - {52, D<&FSP_SRV::OpenSaveDataFileSystemBySystemSaveDataId>, "OpenSaveDataFileSystemBySystemSaveDataId"}, - {53, D<&FSP_SRV::OpenReadOnlySaveDataFileSystem>, "OpenReadOnlySaveDataFileSystem"}, - {57, D<&FSP_SRV::ReadSaveDataFileSystemExtraDataBySaveDataSpaceId>, "ReadSaveDataFileSystemExtraDataBySaveDataSpaceId"}, - {58, D<&FSP_SRV::ReadSaveDataFileSystemExtraData>, "ReadSaveDataFileSystemExtraData"}, - {59, D<&FSP_SRV::WriteSaveDataFileSystemExtraData>, "WriteSaveDataFileSystemExtraData"}, - {60, nullptr, "OpenSaveDataInfoReader"}, - {61, D<&FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId>, "OpenSaveDataInfoReaderBySaveDataSpaceId"}, - {62, D<&FSP_SRV::OpenSaveDataInfoReaderOnlyCacheStorage>, "OpenSaveDataInfoReaderOnlyCacheStorage"}, - {64, nullptr, "OpenSaveDataInternalStorageFileSystem"}, - {65, nullptr, "UpdateSaveDataMacForDebug"}, - {66, nullptr, "WriteSaveDataFileSystemExtraData2"}, - {67, D<&FSP_SRV::FindSaveDataWithFilter>, "FindSaveDataWithFilter"}, - {68, nullptr, "OpenSaveDataInfoReaderBySaveDataFilter"}, - {69, D<&FSP_SRV::ReadSaveDataFileSystemExtraDataBySaveDataAttribute>, "ReadSaveDataFileSystemExtraDataBySaveDataAttribute"}, - {70, D<&FSP_SRV::WriteSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute>, "WriteSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute"}, - {71, D<&FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute>, "ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute"}, - {80, nullptr, "OpenSaveDataMetaFile"}, - {81, nullptr, "OpenSaveDataTransferManager"}, - {82, nullptr, "OpenSaveDataTransferManagerVersion2"}, - {83, D<&FSP_SRV::OpenSaveDataTransferProhibiter>, "OpenSaveDataTransferProhibiter"}, - {84, nullptr, "ListApplicationAccessibleSaveDataOwnerId"}, - {85, nullptr, "OpenSaveDataTransferManagerForSaveDataRepair"}, - {86, nullptr, "OpenSaveDataMover"}, - {87, nullptr, "OpenSaveDataTransferManagerForRepair"}, - {100, nullptr, "OpenImageDirectoryFileSystem"}, - {101, nullptr, "OpenBaseFileSystem"}, - {102, nullptr, "FormatBaseFileSystem"}, - {110, nullptr, "OpenContentStorageFileSystem"}, - {120, nullptr, "OpenCloudBackupWorkStorageFileSystem"}, - {130, nullptr, "OpenCustomStorageFileSystem"}, - {200, D<&FSP_SRV::OpenDataStorageByCurrentProcess>, "OpenDataStorageByCurrentProcess"}, - {201, nullptr, "OpenDataStorageByProgramId"}, - {202, D<&FSP_SRV::OpenDataStorageByDataId>, "OpenDataStorageByDataId"}, - {203, D<&FSP_SRV::OpenPatchDataStorageByCurrentProcess>, "OpenPatchDataStorageByCurrentProcess"}, - {204, nullptr, "OpenDataFileSystemByProgramIndex"}, - {205, D<&FSP_SRV::OpenDataStorageWithProgramIndex>, "OpenDataStorageWithProgramIndex"}, - {206, nullptr, "OpenDataStorageByPath"}, - {210, D<&FSP_SRV::SetCurrentProcess>, "SetCurrentProcess"}, - {400, nullptr, "OpenDeviceOperator"}, - {500, nullptr, "OpenSdCardDetectionEventNotifier"}, - {501, nullptr, "OpenGameCardDetectionEventNotifier"}, - {510, nullptr, "OpenSystemDataUpdateEventNotifier"}, - {511, nullptr, "NotifySystemDataUpdateEvent"}, - {520, nullptr, "SimulateGameCardDetectionEvent"}, - {600, nullptr, "SetCurrentPosixTime"}, - {601, nullptr, "QuerySaveDataTotalSize"}, - {602, nullptr, "VerifySaveDataFileSystem"}, - {603, nullptr, "CorruptSaveDataFileSystem"}, - {604, nullptr, "CreatePaddingFile"}, - {605, nullptr, "DeleteAllPaddingFiles"}, - {606, nullptr, "GetRightsId"}, - {607, nullptr, "RegisterExternalKey"}, - {608, nullptr, "UnregisterAllExternalKey"}, - {609, nullptr, "GetRightsIdByPath"}, - {610, nullptr, "GetRightsIdAndKeyGenerationByPath"}, - {611, nullptr, "SetCurrentPosixTimeWithTimeDifference"}, - {612, nullptr, "GetFreeSpaceSizeForSaveData"}, - {613, nullptr, "VerifySaveDataFileSystemBySaveDataSpaceId"}, - {614, nullptr, "CorruptSaveDataFileSystemBySaveDataSpaceId"}, - {615, nullptr, "QuerySaveDataInternalStorageTotalSize"}, - {616, nullptr, "GetSaveDataCommitId"}, - {617, nullptr, "UnregisterExternalKey"}, - {620, nullptr, "SetSdCardEncryptionSeed"}, - {630, nullptr, "SetSdCardAccessibility"}, - {631, D<&FSP_SRV::IsSdCardAccessible>, "IsSdCardAccessible"}, - {640, nullptr, "IsSignedSystemPartitionOnSdCardValid"}, - {700, nullptr, "OpenAccessFailureResolver"}, - {701, nullptr, "GetAccessFailureDetectionEvent"}, - {702, nullptr, "IsAccessFailureDetected"}, - {710, nullptr, "ResolveAccessFailure"}, - {720, nullptr, "AbandonAccessFailure"}, - {800, nullptr, "GetAndClearFileSystemProxyErrorInfo"}, - {810, nullptr, "RegisterProgramIndexMapInfo"}, - {820, nullptr, "GetContentStorageInfoIndex"}, - {830, nullptr, "EncryptStreamPlaySaveData"}, - {831, nullptr, "DecryptStreamPlaySaveData"}, - {1000, nullptr, "SetBisRootForHost"}, - {1001, nullptr, "SetSaveDataSize"}, - {1002, nullptr, "SetSaveDataRootPath"}, - {1003, D<&FSP_SRV::DisableAutoSaveDataCreation>, "DisableAutoSaveDataCreation"}, - {1004, D<&FSP_SRV::SetGlobalAccessLogMode>, "SetGlobalAccessLogMode"}, - {1005, D<&FSP_SRV::GetGlobalAccessLogMode>, "GetGlobalAccessLogMode"}, - {1006, D<&FSP_SRV::OutputAccessLogToSdCard>, "OutputAccessLogToSdCard"}, - {1007, nullptr, "RegisterUpdatePartition"}, - {1008, nullptr, "OpenRegisteredUpdatePartition"}, - {1009, nullptr, "GetAndClearMemoryReportInfo"}, - {1010, nullptr, "SetDataStorageRedirectTarget"}, - {1011, D<&FSP_SRV::GetProgramIndexForAccessLog>, "GetProgramIndexForAccessLog"}, - {1012, nullptr, "GetFsStackUsage"}, - {1013, nullptr, "UnsetSaveDataRootPath"}, - {1014, nullptr, "OutputMultiProgramTagAccessLog"}, - {1016, D<&FSP_SRV::FlushAccessLogOnSdCard>, "FlushAccessLogOnSdCard"}, - {1017, nullptr, "OutputApplicationInfoAccessLog"}, - {1018, nullptr, "SetDebugOption"}, - {1019, nullptr, "UnsetDebugOption"}, - {1100, nullptr, "OverrideSaveDataTransferTokenSignVerificationKey"}, - {1110, nullptr, "CorruptSaveDataFileSystemBySaveDataSpaceId2"}, - {1200, D<&FSP_SRV::OpenMultiCommitManager>, "OpenMultiCommitManager"}, - {1300, nullptr, "OpenBisWiper"}, - }; - // clang-format on - RegisterHandlers(functions); +std::optional FSP_SRV::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "OpenFileSystem"}, + FunctionInfo{1, D<&FSP_SRV::SetCurrentProcess>, "SetCurrentProcess"}, + FunctionInfo{2, D<&FSP_SRV::OpenDataFileSystemByCurrentProcess>, "OpenDataFileSystemByCurrentProcess"}, + FunctionInfo{7, D<&FSP_SRV::OpenFileSystemWithPatch>, "OpenFileSystemWithPatch"}, + FunctionInfo{8, nullptr, "OpenFileSystemWithId"}, + FunctionInfo{9, nullptr, "OpenDataFileSystemByApplicationId"}, + FunctionInfo{11, nullptr, "OpenBisFileSystem"}, + FunctionInfo{12, nullptr, "OpenBisStorage"}, + FunctionInfo{13, nullptr, "InvalidateBisCache"}, + FunctionInfo{17, nullptr, "OpenHostFileSystem"}, + FunctionInfo{18, D<&FSP_SRV::OpenSdCardFileSystem>, "OpenSdCardFileSystem"}, + FunctionInfo{19, nullptr, "FormatSdCardFileSystem"}, + FunctionInfo{21, nullptr, "DeleteSaveDataFileSystem"}, + FunctionInfo{22, D<&FSP_SRV::CreateSaveDataFileSystem>, "CreateSaveDataFileSystem"}, + FunctionInfo{23, D<&FSP_SRV::CreateSaveDataFileSystemBySystemSaveDataId>, "CreateSaveDataFileSystemBySystemSaveDataId"}, + FunctionInfo{24, nullptr, "RegisterSaveDataFileSystemAtomicDeletion"}, + FunctionInfo{25, nullptr, "DeleteSaveDataFileSystemBySaveDataSpaceId"}, + FunctionInfo{26, nullptr, "FormatSdCardDryRun"}, + FunctionInfo{27, D<&FSP_SRV::IsExFatSupported>, "IsExFatSupported"}, + FunctionInfo{28, nullptr, "DeleteSaveDataFileSystemBySaveDataAttribute"}, + FunctionInfo{30, nullptr, "OpenGameCardStorage"}, + FunctionInfo{31, nullptr, "OpenGameCardFileSystem"}, + FunctionInfo{32, D<&FSP_SRV::ExtendSaveDataFileSystem>, "ExtendSaveDataFileSystem"}, + FunctionInfo{33, nullptr, "DeleteCacheStorage"}, + FunctionInfo{34, D<&FSP_SRV::GetCacheStorageSize>, "GetCacheStorageSize"}, + FunctionInfo{35, nullptr, "CreateSaveDataFileSystemByHashSalt"}, + FunctionInfo{36, nullptr, "OpenHostFileSystemWithOption"}, + FunctionInfo{37, D<&FSP_SRV::CreateSaveDataFileSystemWithCreationInfo2>, "CreateSaveDataFileSystemWithCreationInfo2"}, + FunctionInfo{51, D<&FSP_SRV::OpenSaveDataFileSystem>, "OpenSaveDataFileSystem"}, + FunctionInfo{52, D<&FSP_SRV::OpenSaveDataFileSystemBySystemSaveDataId>, "OpenSaveDataFileSystemBySystemSaveDataId"}, + FunctionInfo{53, D<&FSP_SRV::OpenReadOnlySaveDataFileSystem>, "OpenReadOnlySaveDataFileSystem"}, + FunctionInfo{57, D<&FSP_SRV::ReadSaveDataFileSystemExtraDataBySaveDataSpaceId>, "ReadSaveDataFileSystemExtraDataBySaveDataSpaceId"}, + FunctionInfo{58, D<&FSP_SRV::ReadSaveDataFileSystemExtraData>, "ReadSaveDataFileSystemExtraData"}, + FunctionInfo{59, D<&FSP_SRV::WriteSaveDataFileSystemExtraData>, "WriteSaveDataFileSystemExtraData"}, + FunctionInfo{60, nullptr, "OpenSaveDataInfoReader"}, + FunctionInfo{61, D<&FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId>, "OpenSaveDataInfoReaderBySaveDataSpaceId"}, + FunctionInfo{62, D<&FSP_SRV::OpenSaveDataInfoReaderOnlyCacheStorage>, "OpenSaveDataInfoReaderOnlyCacheStorage"}, + FunctionInfo{64, nullptr, "OpenSaveDataInternalStorageFileSystem"}, + FunctionInfo{65, nullptr, "UpdateSaveDataMacForDebug"}, + FunctionInfo{66, nullptr, "WriteSaveDataFileSystemExtraData2"}, + FunctionInfo{67, D<&FSP_SRV::FindSaveDataWithFilter>, "FindSaveDataWithFilter"}, + FunctionInfo{68, nullptr, "OpenSaveDataInfoReaderBySaveDataFilter"}, + FunctionInfo{69, D<&FSP_SRV::ReadSaveDataFileSystemExtraDataBySaveDataAttribute>, "ReadSaveDataFileSystemExtraDataBySaveDataAttribute"}, + FunctionInfo{70, D<&FSP_SRV::WriteSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute>, "WriteSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute"}, + FunctionInfo{71, D<&FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute>, "ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute"}, + FunctionInfo{80, nullptr, "OpenSaveDataMetaFile"}, + FunctionInfo{81, nullptr, "OpenSaveDataTransferManager"}, + FunctionInfo{82, nullptr, "OpenSaveDataTransferManagerVersion2"}, + FunctionInfo{83, D<&FSP_SRV::OpenSaveDataTransferProhibiter>, "OpenSaveDataTransferProhibiter"}, + FunctionInfo{84, nullptr, "ListApplicationAccessibleSaveDataOwnerId"}, + FunctionInfo{85, nullptr, "OpenSaveDataTransferManagerForSaveDataRepair"}, + FunctionInfo{86, nullptr, "OpenSaveDataMover"}, + FunctionInfo{87, nullptr, "OpenSaveDataTransferManagerForRepair"}, + FunctionInfo{100, nullptr, "OpenImageDirectoryFileSystem"}, + FunctionInfo{101, nullptr, "OpenBaseFileSystem"}, + FunctionInfo{102, nullptr, "FormatBaseFileSystem"}, + FunctionInfo{110, nullptr, "OpenContentStorageFileSystem"}, + FunctionInfo{120, nullptr, "OpenCloudBackupWorkStorageFileSystem"}, + FunctionInfo{130, nullptr, "OpenCustomStorageFileSystem"}, + FunctionInfo{200, D<&FSP_SRV::OpenDataStorageByCurrentProcess>, "OpenDataStorageByCurrentProcess"}, + FunctionInfo{201, nullptr, "OpenDataStorageByProgramId"}, + FunctionInfo{202, D<&FSP_SRV::OpenDataStorageByDataId>, "OpenDataStorageByDataId"}, + FunctionInfo{203, D<&FSP_SRV::OpenPatchDataStorageByCurrentProcess>, "OpenPatchDataStorageByCurrentProcess"}, + FunctionInfo{204, nullptr, "OpenDataFileSystemByProgramIndex"}, + FunctionInfo{205, D<&FSP_SRV::OpenDataStorageWithProgramIndex>, "OpenDataStorageWithProgramIndex"}, + FunctionInfo{206, nullptr, "OpenDataStorageByPath"}, + FunctionInfo{210, D<&FSP_SRV::SetCurrentProcess>, "SetCurrentProcess"}, + FunctionInfo{400, nullptr, "OpenDeviceOperator"}, + FunctionInfo{500, nullptr, "OpenSdCardDetectionEventNotifier"}, + FunctionInfo{501, nullptr, "OpenGameCardDetectionEventNotifier"}, + FunctionInfo{510, nullptr, "OpenSystemDataUpdateEventNotifier"}, + FunctionInfo{511, nullptr, "NotifySystemDataUpdateEvent"}, + FunctionInfo{520, nullptr, "SimulateGameCardDetectionEvent"}, + FunctionInfo{600, nullptr, "SetCurrentPosixTime"}, + FunctionInfo{601, nullptr, "QuerySaveDataTotalSize"}, + FunctionInfo{602, nullptr, "VerifySaveDataFileSystem"}, + FunctionInfo{603, nullptr, "CorruptSaveDataFileSystem"}, + FunctionInfo{604, nullptr, "CreatePaddingFile"}, + FunctionInfo{605, nullptr, "DeleteAllPaddingFiles"}, + FunctionInfo{606, nullptr, "GetRightsId"}, + FunctionInfo{607, nullptr, "RegisterExternalKey"}, + FunctionInfo{608, nullptr, "UnregisterAllExternalKey"}, + FunctionInfo{609, nullptr, "GetRightsIdByPath"}, + FunctionInfo{610, nullptr, "GetRightsIdAndKeyGenerationByPath"}, + FunctionInfo{611, nullptr, "SetCurrentPosixTimeWithTimeDifference"}, + FunctionInfo{612, nullptr, "GetFreeSpaceSizeForSaveData"}, + FunctionInfo{613, nullptr, "VerifySaveDataFileSystemBySaveDataSpaceId"}, + FunctionInfo{614, nullptr, "CorruptSaveDataFileSystemBySaveDataSpaceId"}, + FunctionInfo{615, nullptr, "QuerySaveDataInternalStorageTotalSize"}, + FunctionInfo{616, nullptr, "GetSaveDataCommitId"}, + FunctionInfo{617, nullptr, "UnregisterExternalKey"}, + FunctionInfo{620, nullptr, "SetSdCardEncryptionSeed"}, + FunctionInfo{630, nullptr, "SetSdCardAccessibility"}, + FunctionInfo{631, D<&FSP_SRV::IsSdCardAccessible>, "IsSdCardAccessible"}, + FunctionInfo{640, nullptr, "IsSignedSystemPartitionOnSdCardValid"}, + FunctionInfo{700, nullptr, "OpenAccessFailureResolver"}, + FunctionInfo{701, nullptr, "GetAccessFailureDetectionEvent"}, + FunctionInfo{702, nullptr, "IsAccessFailureDetected"}, + FunctionInfo{710, nullptr, "ResolveAccessFailure"}, + FunctionInfo{720, nullptr, "AbandonAccessFailure"}, + FunctionInfo{800, nullptr, "GetAndClearFileSystemProxyErrorInfo"}, + FunctionInfo{810, nullptr, "RegisterProgramIndexMapInfo"}, + FunctionInfo{820, nullptr, "GetContentStorageInfoIndex"}, + FunctionInfo{830, nullptr, "EncryptStreamPlaySaveData"}, + FunctionInfo{831, nullptr, "DecryptStreamPlaySaveData"}, + FunctionInfo{1000, nullptr, "SetBisRootForHost"}, + FunctionInfo{1001, nullptr, "SetSaveDataSize"}, + FunctionInfo{1002, nullptr, "SetSaveDataRootPath"}, + FunctionInfo{1003, D<&FSP_SRV::DisableAutoSaveDataCreation>, "DisableAutoSaveDataCreation"}, + FunctionInfo{1004, D<&FSP_SRV::SetGlobalAccessLogMode>, "SetGlobalAccessLogMode"}, + FunctionInfo{1005, D<&FSP_SRV::GetGlobalAccessLogMode>, "GetGlobalAccessLogMode"}, + FunctionInfo{1006, D<&FSP_SRV::OutputAccessLogToSdCard>, "OutputAccessLogToSdCard"}, + FunctionInfo{1007, nullptr, "RegisterUpdatePartition"}, + FunctionInfo{1008, nullptr, "OpenRegisteredUpdatePartition"}, + FunctionInfo{1009, nullptr, "GetAndClearMemoryReportInfo"}, + FunctionInfo{1010, nullptr, "SetDataStorageRedirectTarget"}, + FunctionInfo{1011, D<&FSP_SRV::GetProgramIndexForAccessLog>, "GetProgramIndexForAccessLog"}, + FunctionInfo{1012, nullptr, "GetFsStackUsage"}, + FunctionInfo{1013, nullptr, "UnsetSaveDataRootPath"}, + FunctionInfo{1014, nullptr, "OutputMultiProgramTagAccessLog"}, + FunctionInfo{1016, D<&FSP_SRV::FlushAccessLogOnSdCard>, "FlushAccessLogOnSdCard"}, + FunctionInfo{1017, nullptr, "OutputApplicationInfoAccessLog"}, + FunctionInfo{1018, nullptr, "SetDebugOption"}, + FunctionInfo{1019, nullptr, "UnsetDebugOption"}, + FunctionInfo{1100, nullptr, "OverrideSaveDataTransferTokenSignVerificationKey"}, + FunctionInfo{1110, nullptr, "CorruptSaveDataFileSystemBySaveDataSpaceId2"}, + FunctionInfo{1200, D<&FSP_SRV::OpenMultiCommitManager>, "OpenMultiCommitManager"}, + FunctionInfo{1300, nullptr, "OpenBisWiper"} + ); + return HandlerTableGenerateWithFind(key, functions); +} +FSP_SRV::FSP_SRV(Core::System& system_) + : ServiceFramework{system_, "fsp-srv"}, fsc{system.GetFileSystemController()}, content_provider{system.GetContentProvider()}, reporter{system.GetReporter()} { if (Settings::values.enable_fs_access_log) { access_log_mode = AccessLogMode::SdCard; } diff --git a/src/core/hle/service/filesystem/fsp/fsp_srv.h b/src/core/hle/service/filesystem/fsp/fsp_srv.h index 156cf4e571..ebda008bcc 100644 --- a/src/core/hle/service/filesystem/fsp/fsp_srv.h +++ b/src/core/hle/service/filesystem/fsp/fsp_srv.h @@ -115,6 +115,7 @@ private: s64 available_size, s64 journal_size); Result GetCacheStorageSize(s32 index, Out out_data_size, Out out_journal_size); + std::optional FindRequest(u32 key) override; FileSystemController& fsc; const FileSys::ContentProvider& content_provider; const Core::Reporter& reporter; diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp index f8690dbb8b..5480d22b83 100644 --- a/src/core/hle/service/friend/friend.cpp +++ b/src/core/hle/service/friend/friend.cpp @@ -11,139 +11,38 @@ #include "core/hle/kernel/k_event.h" #include "core/hle/service/acc/errors.h" #include "core/hle/service/friend/friend.h" -#include "core/hle/service/friend/friend_interface.h" #include "core/hle/service/ipc_helpers.h" #include "core/hle/service/kernel_helpers.h" #include "core/hle/service/server_manager.h" namespace Service::Friend { +class Friend final : public Module::Interface { +public: + explicit Friend(std::shared_ptr module_, Core::System& system_, const char* name) : Interface(std::move(module_), system_, name) {} + ~Friend() override = default; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &Friend::CreateFriendService, "CreateFriendService"}, + FunctionInfo{1, &Friend::CreateNotificationService, "CreateNotificationService"}, + FunctionInfo{2, nullptr, "CreateDaemonSuspendSessionService"} + ); +}; + class IFriendService final : public ServiceFramework { public: explicit IFriendService(Core::System& system_) : ServiceFramework{system_, "IFriendService"}, service_context{system, "IFriendService"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &IFriendService::GetCompletionEvent, "GetCompletionEvent"}, - {1, &IFriendService::Cancel, "Cancel"}, - {10100, nullptr, "GetFriendListIds"}, - {10101, &IFriendService::GetFriendList, "GetFriendList"}, - {10102, nullptr, "UpdateFriendInfo"}, - {10110, nullptr, "GetFriendProfileImage"}, - {10111, nullptr, "GetFriendProfileImageWithImageSize"}, // 18.0.0+ - {10120, &IFriendService::CheckFriendListAvailability, "CheckFriendListAvailability"}, - {10121, nullptr, "EnsureFriendListAvailable"}, - {10200, nullptr, "SendFriendRequestForApplication"}, - {10211, nullptr, "AddFacedFriendRequestForApplication"}, - {10400, &IFriendService::GetBlockedUserListIds, "GetBlockedUserListIds"}, - {10420, &IFriendService::CheckBlockedUserListAvailability, "CheckBlockedUserListAvailability"}, - {10421, nullptr, "EnsureBlockedUserListAvailable"}, - {10500, nullptr, "GetProfileList"}, - {10501, nullptr, "GetProfileListV2"}, // 18.0.0+ - {10600, nullptr, "DeclareOpenOnlinePlaySession"}, - {10601, &IFriendService::DeclareCloseOnlinePlaySession, "DeclareCloseOnlinePlaySession"}, - {10610, &IFriendService::UpdateUserPresence, "UpdateUserPresence"}, - {10700, &IFriendService::GetPlayHistoryRegistrationKey, "GetPlayHistoryRegistrationKey"}, - {10701, nullptr, "GetPlayHistoryRegistrationKeyWithNetworkServiceAccountId"}, - {10702, nullptr, "AddPlayHistory"}, - {11000, nullptr, "GetProfileImageUrl"}, - {11001, nullptr, "GetProfileImageUrlV2"}, // 18.0.0+ - {20100, &IFriendService::GetFriendCount, "GetFriendCount"}, - {20101, &IFriendService::GetNewlyFriendCount, "GetNewlyFriendCount"}, - {20102, nullptr, "GetFriendDetailedInfo"}, - {20103, nullptr, "SyncFriendList"}, - {20104, &IFriendService::RequestSyncFriendList, "RequestSyncFriendList"}, - {20105, &IFriendService::GetFriendListForViewer, "GetFriendListForViewerV1"}, - {20106, nullptr, "UpdateFriendInfoForViewerV1"}, - {20107, nullptr, "GetFriendDetailedInfoV2"}, // 20.0.0+ - {20108, &IFriendService::GetFriendListForViewer, "GetFriendListForViewerV2"}, // 22.0.0+ - {20109, nullptr, "UpdateFriendInfoForViewerV2"}, // 22.0.0+ - {20110, nullptr, "LoadFriendSettingV1"}, - {20111, nullptr, "LoadFriendSettingV2"}, // 22.0.0+ - {20200, &IFriendService::GetReceivedFriendRequestCount, "GetReceivedFriendRequestCount"}, - {20201, nullptr, "GetFriendRequestListV1"}, - {20202, nullptr, "GetFriendRequestListV2"}, // 20.0.0+ - {20203, nullptr, "GetFriendRequestReceivedNotificationCount"}, // 22.0.0+ - {20300, nullptr, "GetFriendCandidateList"}, - {20301, nullptr, "GetNintendoNetworkIdInfo"}, - {20302, nullptr, "GetSnsAccountLinkage"}, // 5.0.0-19.0.1 - {20303, nullptr, "GetSnsAccountProfile"}, // 5.0.0-19.0.1 - {20304, nullptr, "GetSnsAccountFriendList"}, // 5.0.0-19.0.1 - {20400, nullptr, "GetBlockedUserListV1"}, - {20401, nullptr, "SyncBlockedUserList"}, - {20402, nullptr, "GetBlockedUserListV2"}, // 20.0.0+ - {20500, nullptr, "GetProfileExtraListV1"}, - {20501, nullptr, "GetRelationship"}, - {20502, nullptr, "GetProfileExtraListV2"}, // 19.0.0+ - {20600, &IFriendService::GetUserPresenceView, "GetUserPresenceViewV1"}, - {20601, &IFriendService::GetUserPresenceView, "GetUserPresenceViewV2"}, // 19.0.0+ - {20700, nullptr, "GetPlayHistoryListV1"}, - {20701, &IFriendService::GetPlayHistoryStatistics, "GetPlayHistoryStatistics"}, - {20702, nullptr, "GetPlayHistoryListV2"}, // 19.0.0+ - {20800, &IFriendService::LoadUserSetting, "LoadUserSettingV1"}, - {20801, nullptr, "SyncUserSetting"}, - {20802, &IFriendService::LoadUserSetting, "LoadUserSettingV2"}, // 19.0.0+ - {20900, &IFriendService::RequestListSummaryOverlayNotification, "RequestListSummaryOverlayNotification"}, - {21000, nullptr, "GetExternalApplicationCatalog"}, - {22000, nullptr, "GetReceivedFriendInvitationListV1"}, - {22001, nullptr, "GetReceivedFriendInvitationDetailedInfoV1"}, - {22002, nullptr, "GetReceivedFriendInvitationListV2"}, // 19.0.0+ - {22003, nullptr, "GetReceivedFriendInvitationDetailedInfoV2"}, // 19.0.0+ - {22010, &IFriendService::GetReceivedFriendInvitationCountCache, "GetReceivedFriendInvitationCountCache"}, - {30100, nullptr, "DropFriendNewlyFlags"}, - {30101, nullptr, "DeleteFriend"}, - {30110, nullptr, "DropFriendNewlyFlag"}, - {30120, nullptr, "ChangeFriendFavoriteFlag"}, - {30121, nullptr, "ChangeFriendOnlineNotificationFlag"}, - {30130, nullptr, "SetFriendNote"}, // 22.0.0+ - {30131, nullptr, "RequestUploadPendingNote"}, // 22.0.0+ - {30190, nullptr, "RequestSyncLocalUpdates"}, // 22.0.0+ - {30200, nullptr, "SendFriendRequest"}, - {30201, nullptr, "SendFriendRequestWithApplicationInfoV1"}, - {30202, nullptr, "CancelFriendRequest"}, - {30203, nullptr, "AcceptFriendRequest"}, - {30204, nullptr, "RejectFriendRequest"}, - {30205, nullptr, "ReadFriendRequest"}, - {30210, nullptr, "GetFacedFriendRequestRegistrationKey"}, - {30211, nullptr, "AddFacedFriendRequest"}, - {30212, nullptr, "CancelFacedFriendRequest"}, - {30213, nullptr, "GetFacedFriendRequestProfileImage"}, - {30214, nullptr, "GetFacedFriendRequestProfileImageFromPath"}, - {30215, nullptr, "SendFriendRequestWithExternalApplicationCatalogId"}, - {30216, nullptr, "ResendFacedFriendRequest"}, - {30217, nullptr, "SendFriendRequestWithNintendoNetworkIdInfo"}, - {30218, nullptr, "SendFriendRequestWithApplicationInfoV2"}, // 20.0.0+ - {30300, nullptr, "GetSnsAccountLinkPageUrl"}, // 5.0.0-19.0.1 - {30301, nullptr, "UnlinkSnsAccount"}, // 5.0.0-19.0.1 - {30400, nullptr, "BlockUser"}, - {30401, nullptr, "BlockUserWithApplicationInfoV1"}, - {30402, nullptr, "UnblockUser"}, - {30403, nullptr, "BlockUserWithApplicationInfoV2"}, // 20.0.0+ - {30500, nullptr, "GetProfileExtraFromFriendCodeV1"}, - {30501, nullptr, "GetProfileExtraFromFriendCodeV2"}, // 19.0.0+ - {30700, nullptr, "DeletePlayHistory"}, - {30701, nullptr, "AddPlayHistoryWithApplication"}, // 19.0.0+ - {30810, nullptr, "ChangePresencePermission"}, - {30811, nullptr, "ChangeFriendRequestReception"}, - {30812, nullptr, "ChangePlayLogPermission"}, - {30820, nullptr, "IssueFriendCode"}, - {30830, nullptr, "ClearPlayLog"}, - {30900, nullptr, "SendFriendInvitationV1"}, - {30901, nullptr, "SendFriendInvitationV2"}, // 19.0.0+ - {30910, nullptr, "ReadFriendInvitation"}, - {30911, nullptr, "ReadAllFriendInvitations"}, - {31000, nullptr, "OpenUser"}, // 19.0.0+ - {40100, nullptr, "DeleteFriendListCache"}, - {40400, nullptr, "DeleteBlockedUserListCache"}, - {49900, nullptr, "DeleteNetworkServiceAccountCache"}, - }; - // clang-format on - - RegisterHandlers(functions); - completion_event = service_context.CreateEvent("IFriendService:CompletionEvent"); } + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + ~IFriendService() override { service_context.CloseEvent(completion_event); } @@ -367,29 +266,136 @@ private: rb.Push(0); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &IFriendService::GetCompletionEvent, "GetCompletionEvent"}, + FunctionInfo{1, &IFriendService::Cancel, "Cancel"}, + FunctionInfo{10100, nullptr, "GetFriendListIds"}, + FunctionInfo{10101, &IFriendService::GetFriendList, "GetFriendList"}, + FunctionInfo{10102, nullptr, "UpdateFriendInfo"}, + FunctionInfo{10110, nullptr, "GetFriendProfileImage"}, + FunctionInfo{10111, nullptr, "GetFriendProfileImageWithImageSize", MakeVersionGate({18,0,0})}, + FunctionInfo{10120, &IFriendService::CheckFriendListAvailability, "CheckFriendListAvailability"}, + FunctionInfo{10121, nullptr, "EnsureFriendListAvailable"}, + FunctionInfo{10200, nullptr, "SendFriendRequestForApplication"}, + FunctionInfo{10211, nullptr, "AddFacedFriendRequestForApplication"}, + FunctionInfo{10400, &IFriendService::GetBlockedUserListIds, "GetBlockedUserListIds"}, + FunctionInfo{10420, &IFriendService::CheckBlockedUserListAvailability, "CheckBlockedUserListAvailability"}, + FunctionInfo{10421, nullptr, "EnsureBlockedUserListAvailable"}, + FunctionInfo{10500, nullptr, "GetProfileList"}, + FunctionInfo{10501, nullptr, "GetProfileListV2", MakeVersionGate({18,0,0})}, + FunctionInfo{10600, nullptr, "DeclareOpenOnlinePlaySession"}, + FunctionInfo{10601, &IFriendService::DeclareCloseOnlinePlaySession, "DeclareCloseOnlinePlaySession"}, + FunctionInfo{10610, &IFriendService::UpdateUserPresence, "UpdateUserPresence"}, + FunctionInfo{10700, &IFriendService::GetPlayHistoryRegistrationKey, "GetPlayHistoryRegistrationKey"}, + FunctionInfo{10701, nullptr, "GetPlayHistoryRegistrationKeyWithNetworkServiceAccountId"}, + FunctionInfo{10702, nullptr, "AddPlayHistory"}, + FunctionInfo{11000, nullptr, "GetProfileImageUrl"}, + FunctionInfo{11001, nullptr, "GetProfileImageUrlV2", MakeVersionGate({18,0,0})}, + FunctionInfo{20100, &IFriendService::GetFriendCount, "GetFriendCount"}, + FunctionInfo{20101, &IFriendService::GetNewlyFriendCount, "GetNewlyFriendCount"}, + FunctionInfo{20102, nullptr, "GetFriendDetailedInfo"}, + FunctionInfo{20103, nullptr, "SyncFriendList"}, + FunctionInfo{20104, &IFriendService::RequestSyncFriendList, "RequestSyncFriendList"}, + FunctionInfo{20105, &IFriendService::GetFriendListForViewer, "GetFriendListForViewerV1"}, + FunctionInfo{20106, nullptr, "UpdateFriendInfoForViewerV1"}, + FunctionInfo{20107, nullptr, "GetFriendDetailedInfoV2", MakeVersionGate({20,0,0})}, + FunctionInfo{20108, &IFriendService::GetFriendListForViewer, "GetFriendListForViewerV2", MakeVersionGate({22,0,0})}, + FunctionInfo{20109, nullptr, "UpdateFriendInfoForViewerV2", MakeVersionGate({22,0,0})}, + FunctionInfo{20110, nullptr, "LoadFriendSettingV1"}, + FunctionInfo{20111, nullptr, "LoadFriendSettingV2", MakeVersionGate({22,0,0})}, + FunctionInfo{20200, &IFriendService::GetReceivedFriendRequestCount, "GetReceivedFriendRequestCount"}, + FunctionInfo{20201, nullptr, "GetFriendRequestListV1"}, + FunctionInfo{20202, nullptr, "GetFriendRequestListV2", MakeVersionGate({20,0,0})}, + FunctionInfo{20203, nullptr, "GetFriendRequestReceivedNotificationCount", MakeVersionGate({22,0,0})}, + FunctionInfo{20300, nullptr, "GetFriendCandidateList"}, + FunctionInfo{20301, nullptr, "GetNintendoNetworkIdInfo"}, + FunctionInfo{20302, nullptr, "GetSnsAccountLinkage", MakeVersionGate({5,0,0}, {19,0,1})}, + FunctionInfo{20303, nullptr, "GetSnsAccountProfile", MakeVersionGate({5,0,0}, {19,0,1})}, + FunctionInfo{20304, nullptr, "GetSnsAccountFriendList", MakeVersionGate({5,0,0}, {19,0,1})}, + FunctionInfo{20400, nullptr, "GetBlockedUserListV1"}, + FunctionInfo{20401, nullptr, "SyncBlockedUserList"}, + FunctionInfo{20402, nullptr, "GetBlockedUserListV2", MakeVersionGate({20,0,0})}, + FunctionInfo{20500, nullptr, "GetProfileExtraListV1"}, + FunctionInfo{20501, nullptr, "GetRelationship"}, + FunctionInfo{20502, nullptr, "GetProfileExtraListV2", MakeVersionGate({19,0,0})}, + FunctionInfo{20600, &IFriendService::GetUserPresenceView, "GetUserPresenceViewV1"}, + FunctionInfo{20601, &IFriendService::GetUserPresenceView, "GetUserPresenceViewV2", MakeVersionGate({19,0,0})}, + FunctionInfo{20700, nullptr, "GetPlayHistoryListV1"}, + FunctionInfo{20701, &IFriendService::GetPlayHistoryStatistics, "GetPlayHistoryStatistics"}, + FunctionInfo{20702, nullptr, "GetPlayHistoryListV2", MakeVersionGate({19,0,0})}, + FunctionInfo{20800, &IFriendService::LoadUserSetting, "LoadUserSettingV1"}, + FunctionInfo{20801, nullptr, "SyncUserSetting"}, + FunctionInfo{20802, &IFriendService::LoadUserSetting, "LoadUserSettingV2", MakeVersionGate({19,0,0})}, + FunctionInfo{20900, &IFriendService::RequestListSummaryOverlayNotification, "RequestListSummaryOverlayNotification"}, + FunctionInfo{21000, nullptr, "GetExternalApplicationCatalog"}, + FunctionInfo{22000, nullptr, "GetReceivedFriendInvitationListV1"}, + FunctionInfo{22001, nullptr, "GetReceivedFriendInvitationDetailedInfoV1"}, + FunctionInfo{22002, nullptr, "GetReceivedFriendInvitationListV2", MakeVersionGate({19,0,0})}, + FunctionInfo{22003, nullptr, "GetReceivedFriendInvitationDetailedInfoV2", MakeVersionGate({19,0,0})}, + FunctionInfo{22010, &IFriendService::GetReceivedFriendInvitationCountCache, "GetReceivedFriendInvitationCountCache"}, + FunctionInfo{30100, nullptr, "DropFriendNewlyFlags"}, + FunctionInfo{30101, nullptr, "DeleteFriend"}, + FunctionInfo{30110, nullptr, "DropFriendNewlyFlag"}, + FunctionInfo{30120, nullptr, "ChangeFriendFavoriteFlag"}, + FunctionInfo{30121, nullptr, "ChangeFriendOnlineNotificationFlag"}, + FunctionInfo{30130, nullptr, "SetFriendNote", MakeVersionGate({22,0,0})}, + FunctionInfo{30131, nullptr, "RequestUploadPendingNote", MakeVersionGate({22,0,0})}, + FunctionInfo{30190, nullptr, "RequestSyncLocalUpdates", MakeVersionGate({22,0,0})}, + FunctionInfo{30200, nullptr, "SendFriendRequest"}, + FunctionInfo{30201, nullptr, "SendFriendRequestWithApplicationInfoV1"}, + FunctionInfo{30202, nullptr, "CancelFriendRequest"}, + FunctionInfo{30203, nullptr, "AcceptFriendRequest"}, + FunctionInfo{30204, nullptr, "RejectFriendRequest"}, + FunctionInfo{30205, nullptr, "ReadFriendRequest"}, + FunctionInfo{30210, nullptr, "GetFacedFriendRequestRegistrationKey"}, + FunctionInfo{30211, nullptr, "AddFacedFriendRequest"}, + FunctionInfo{30212, nullptr, "CancelFacedFriendRequest"}, + FunctionInfo{30213, nullptr, "GetFacedFriendRequestProfileImage"}, + FunctionInfo{30214, nullptr, "GetFacedFriendRequestProfileImageFromPath"}, + FunctionInfo{30215, nullptr, "SendFriendRequestWithExternalApplicationCatalogId"}, + FunctionInfo{30216, nullptr, "ResendFacedFriendRequest"}, + FunctionInfo{30217, nullptr, "SendFriendRequestWithNintendoNetworkIdInfo"}, + FunctionInfo{30218, nullptr, "SendFriendRequestWithApplicationInfoV2", MakeVersionGate({20,0,0})}, + FunctionInfo{30300, nullptr, "GetSnsAccountLinkPageUrl", MakeVersionGate({5,0,0}, {19,0,1})}, + FunctionInfo{30301, nullptr, "UnlinkSnsAccount", MakeVersionGate({5,0,0}, {19,0,1})}, + FunctionInfo{30400, nullptr, "BlockUser"}, + FunctionInfo{30401, nullptr, "BlockUserWithApplicationInfoV1"}, + FunctionInfo{30402, nullptr, "UnblockUser"}, + FunctionInfo{30403, nullptr, "BlockUserWithApplicationInfoV2", MakeVersionGate({20,0,0})}, + FunctionInfo{30500, nullptr, "GetProfileExtraFromFriendCodeV1"}, + FunctionInfo{30501, nullptr, "GetProfileExtraFromFriendCodeV2", MakeVersionGate({19,0,0})}, + FunctionInfo{30700, nullptr, "DeletePlayHistory"}, + FunctionInfo{30701, nullptr, "AddPlayHistoryWithApplication", MakeVersionGate({19,0,0})}, + FunctionInfo{30810, nullptr, "ChangePresencePermission"}, + FunctionInfo{30811, nullptr, "ChangeFriendRequestReception"}, + FunctionInfo{30812, nullptr, "ChangePlayLogPermission"}, + FunctionInfo{30820, nullptr, "IssueFriendCode"}, + FunctionInfo{30830, nullptr, "ClearPlayLog"}, + FunctionInfo{30900, nullptr, "SendFriendInvitationV1"}, + FunctionInfo{30901, nullptr, "SendFriendInvitationV2", MakeVersionGate({19,0,0})}, + FunctionInfo{30910, nullptr, "ReadFriendInvitation"}, + FunctionInfo{30911, nullptr, "ReadAllFriendInvitations"}, + FunctionInfo{31000, nullptr, "OpenUser", MakeVersionGate({19,0,0})}, + FunctionInfo{40100, nullptr, "DeleteFriendListCache"}, + FunctionInfo{40400, nullptr, "DeleteBlockedUserListCache"}, + FunctionInfo{49900, nullptr, "DeleteNetworkServiceAccountCache"} + ); KernelHelpers::ServiceContext service_context; - Kernel::KEvent* completion_event; }; class INotificationService final : public ServiceFramework { public: explicit INotificationService(Core::System& system_, Common::UUID uuid_) - : ServiceFramework{system_, "INotificationService"}, uuid{uuid_}, - service_context{system_, "INotificationService"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &INotificationService::GetEvent, "GetEvent"}, - {1, &INotificationService::Clear, "Clear"}, - {2, &INotificationService::Pop, "Pop"} - }; - // clang-format on - - RegisterHandlers(functions); - + : ServiceFramework{system_, "INotificationService"}, uuid{uuid_} + , service_context{system_, "INotificationService"} { notification_event = service_context.CreateEvent("INotificationService:NotifyEvent"); } + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + ~INotificationService() override { service_context.CloseEvent(notification_event); } @@ -465,9 +471,13 @@ private: bool has_received_friend_request; }; + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &INotificationService::GetEvent, "GetEvent"}, + FunctionInfo{1, &INotificationService::Clear, "Clear"}, + FunctionInfo{2, &INotificationService::Pop, "Pop"} + ); Common::UUID uuid; KernelHelpers::ServiceContext service_context; - Kernel::KEvent* notification_event; std::queue notifications; States states{}; @@ -501,61 +511,67 @@ class IServiceForApplication final : public ServiceFramework FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetReceivableNeighborInfoCountMax"}, + FunctionInfo{10, nullptr, "IsNeighborDetectionEnabled"} + ); }; class IServiceForSystem final : public ServiceFramework { public: explicit IServiceForSystem(Core::System& system_) : ServiceFramework{system_, "nd:sys"} - { - static const FunctionInfo functions[] = { - {0, nullptr, "GetReceivableNeighborInfoCountMax"}, - {10, nullptr, "IsNeighborDetectionEnabled"}, - {200, nullptr, "SetSystemData"}, - {201, nullptr, "ClearSystemData"}, - {203, nullptr, "GetReceivableNeighborInfoCountForSystem"}, - {204, nullptr, "ReceiveNeighborInfoForSystem"}, - {205, nullptr, "SetSender"}, - {206, nullptr, "GetSender"}, - {207, nullptr, "CreateScannerForSystem"}, - {208, nullptr, "CreateReceiveEventHolderForSystem"}, - {223, nullptr, "EnableNeighborDetection"}, - {224, nullptr, "DisableNeighborDetection"}, - {226, nullptr, "EnablePowerSave"}, - {227, nullptr, "DisablePowerSave"}, - {228, nullptr, "IsPowerSaveEnabled"}, - {232, nullptr, "ClearBlockedUsers"}, - {233, nullptr, "GetBlockedUserCount"}, - {234, nullptr, "BlockUserByLocalUserId"}, - {235, nullptr, "BlockUserByNetworkUserId"}, - {236, nullptr, "UnblockUserByLocalUserId"}, - {237, nullptr, "UnblockUserByNetworkUserId"}, - {240, nullptr, "DeleteApplication"}, - {250, nullptr, "InitializeApplicationInfo"}, - {260, nullptr, "CreateAccountSystemSaveDataAccessSuppressor"}, - {300, nullptr, "AddReceivedNeighborInfoForSystemForDebug"}, - {301, nullptr, "GetSendDataForDebug"}, - {302, nullptr, "ClearReceiveCounterForDebug"}, - {303, nullptr, "GetNextReceiveCounterForDebug"}, - {304, nullptr, "ListBlockedUsersForDebug"}, - {305, nullptr, "RefreshSendDataIdForDebug"}, - {306, nullptr, "ReloadFwdbgSettingsForDebug"}, - {307, nullptr, "EnableApplicationForDebug"}, - {308, nullptr, "GetNextReceiveCountersForDebug"}, - {309, nullptr, "ListApplicationInfoForDebug"}, - {310, nullptr, "SetApplicationDataForDebug"}, - {400, nullptr, "GetNetworkUserId"}, - {401, nullptr, "DeleteNetworkUserId"}, - }; - RegisterHandlers(functions); + {} + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetReceivableNeighborInfoCountMax"}, + FunctionInfo{10, nullptr, "IsNeighborDetectionEnabled"}, + FunctionInfo{200, nullptr, "SetSystemData"}, + FunctionInfo{201, nullptr, "ClearSystemData"}, + FunctionInfo{203, nullptr, "GetReceivableNeighborInfoCountForSystem"}, + FunctionInfo{204, nullptr, "ReceiveNeighborInfoForSystem"}, + FunctionInfo{205, nullptr, "SetSender"}, + FunctionInfo{206, nullptr, "GetSender"}, + FunctionInfo{207, nullptr, "CreateScannerForSystem"}, + FunctionInfo{208, nullptr, "CreateReceiveEventHolderForSystem"}, + FunctionInfo{223, nullptr, "EnableNeighborDetection"}, + FunctionInfo{224, nullptr, "DisableNeighborDetection"}, + FunctionInfo{226, nullptr, "EnablePowerSave"}, + FunctionInfo{227, nullptr, "DisablePowerSave"}, + FunctionInfo{228, nullptr, "IsPowerSaveEnabled"}, + FunctionInfo{232, nullptr, "ClearBlockedUsers"}, + FunctionInfo{233, nullptr, "GetBlockedUserCount"}, + FunctionInfo{234, nullptr, "BlockUserByLocalUserId"}, + FunctionInfo{235, nullptr, "BlockUserByNetworkUserId"}, + FunctionInfo{236, nullptr, "UnblockUserByLocalUserId"}, + FunctionInfo{237, nullptr, "UnblockUserByNetworkUserId"}, + FunctionInfo{240, nullptr, "DeleteApplication"}, + FunctionInfo{250, nullptr, "InitializeApplicationInfo"}, + FunctionInfo{260, nullptr, "CreateAccountSystemSaveDataAccessSuppressor"}, + FunctionInfo{300, nullptr, "AddReceivedNeighborInfoForSystemForDebug"}, + FunctionInfo{301, nullptr, "GetSendDataForDebug"}, + FunctionInfo{302, nullptr, "ClearReceiveCounterForDebug"}, + FunctionInfo{303, nullptr, "GetNextReceiveCounterForDebug"}, + FunctionInfo{304, nullptr, "ListBlockedUsersForDebug"}, + FunctionInfo{305, nullptr, "RefreshSendDataIdForDebug"}, + FunctionInfo{306, nullptr, "ReloadFwdbgSettingsForDebug"}, + FunctionInfo{307, nullptr, "EnableApplicationForDebug"}, + FunctionInfo{308, nullptr, "GetNextReceiveCountersForDebug"}, + FunctionInfo{309, nullptr, "ListApplicationInfoForDebug"}, + FunctionInfo{310, nullptr, "SetApplicationDataForDebug"}, + FunctionInfo{400, nullptr, "GetNetworkUserId"}, + FunctionInfo{401, nullptr, "DeleteNetworkUserId"} + ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/friend/friend_interface.cpp b/src/core/hle/service/friend/friend_interface.cpp deleted file mode 100644 index c8b98b1f0c..0000000000 --- a/src/core/hle/service/friend/friend_interface.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/hle/service/friend/friend_interface.h" - -namespace Service::Friend { - -Friend::Friend(std::shared_ptr module_, Core::System& system_, const char* name) - : Interface(std::move(module_), system_, name) { - static const FunctionInfo functions[] = { - {0, &Friend::CreateFriendService, "CreateFriendService"}, - {1, &Friend::CreateNotificationService, "CreateNotificationService"}, - {2, nullptr, "CreateDaemonSuspendSessionService"}, - }; - RegisterHandlers(functions); -} - -Friend::~Friend() = default; - -} // namespace Service::Friend diff --git a/src/core/hle/service/friend/friend_interface.h b/src/core/hle/service/friend/friend_interface.h deleted file mode 100644 index 3a2184c347..0000000000 --- a/src/core/hle/service/friend/friend_interface.h +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/friend/friend.h" - -namespace Service::Friend { - -class Friend final : public Module::Interface { -public: - explicit Friend(std::shared_ptr module_, Core::System& system_, const char* name); - ~Friend() override; -}; - -} // namespace Service::Friend diff --git a/src/core/hle/service/glue/arp.cpp b/src/core/hle/service/glue/arp.cpp index 7eda57ddc3..203adb7ca7 100644 --- a/src/core/hle/service/glue/arp.cpp +++ b/src/core/hle/service/glue/arp.cpp @@ -35,22 +35,6 @@ std::optional GetTitleIDForProcessID(Core::System& system, u64 process_id) ARP_R::ARP_R(Core::System& system_, const ARPManager& manager_) : ServiceFramework{system_, "arp:r"}, manager{manager_} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &ARP_R::GetApplicationLaunchProperty, "GetApplicationLaunchProperty"}, - {1, &ARP_R::GetApplicationLaunchPropertyWithApplicationId, "GetApplicationLaunchPropertyWithApplicationId"}, - {2, &ARP_R::GetApplicationControlProperty, "GetApplicationControlProperty"}, - {3, &ARP_R::GetApplicationControlPropertyWithApplicationId, "GetApplicationControlPropertyWithApplicationId"}, - {4, nullptr, "GetApplicationInstanceUnregistrationNotifier"}, - {5, nullptr, "ListApplicationInstanceId"}, - {6, nullptr, "GetMicroApplicationInstanceId"}, - {7, nullptr, "GetApplicationCertificate"}, - {9998, nullptr, "GetPreomiaApplicationLaunchProperty"}, - {9999, nullptr, "GetPreomiaApplicationControlProperty"}, - }; - // clang-format on - - RegisterHandlers(functions); } ARP_R::~ARP_R() = default; @@ -164,16 +148,10 @@ public: using IssuerFn = std::function)>; explicit IRegistrar(Core::System& system_, IssuerFn&& issuer) - : ServiceFramework{system_, "IRegistrar"}, issue_process_id{std::move(issuer)} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &IRegistrar::Issue, "Issue"}, - {1, &IRegistrar::SetApplicationLaunchProperty, "SetApplicationLaunchProperty"}, - {2, &IRegistrar::SetApplicationControlProperty, "SetApplicationControlProperty"}, - }; - // clang-format on + : ServiceFramework{system_, "IRegistrar"}, issue_process_id{std::move(issuer)} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -238,6 +216,11 @@ private: rb.Push(ResultSuccess); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &IRegistrar::Issue, "Issue"}, + FunctionInfo{1, &IRegistrar::SetApplicationLaunchProperty, "SetApplicationLaunchProperty"}, + FunctionInfo{2, &IRegistrar::SetApplicationControlProperty, "SetApplicationControlProperty"} + ); IssuerFn issue_process_id; bool issued = false; ApplicationLaunchProperty launch{}; @@ -246,15 +229,6 @@ private: ARP_W::ARP_W(Core::System& system_, ARPManager& manager_) : ServiceFramework{system_, "arp:w"}, manager{manager_} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &ARP_W::AcquireRegistrar, "AcquireRegistrar"}, - {1, &ARP_W::UnregisterApplicationInstance , "UnregisterApplicationInstance "}, - {2, nullptr, "AcquireUpdater"}, - }; - // clang-format on - - RegisterHandlers(functions); } ARP_W::~ARP_W() = default; diff --git a/src/core/hle/service/glue/arp.h b/src/core/hle/service/glue/arp.h index 5bce801755..de966475f9 100644 --- a/src/core/hle/service/glue/arp.h +++ b/src/core/hle/service/glue/arp.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -21,6 +24,21 @@ private: void GetApplicationControlProperty(HLERequestContext& ctx); void GetApplicationControlPropertyWithApplicationId(HLERequestContext& ctx); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &ARP_R::GetApplicationLaunchProperty, "GetApplicationLaunchProperty"}, + FunctionInfo{1, &ARP_R::GetApplicationLaunchPropertyWithApplicationId, "GetApplicationLaunchPropertyWithApplicationId"}, + FunctionInfo{2, &ARP_R::GetApplicationControlProperty, "GetApplicationControlProperty"}, + FunctionInfo{3, &ARP_R::GetApplicationControlPropertyWithApplicationId, "GetApplicationControlPropertyWithApplicationId"}, + FunctionInfo{4, nullptr, "GetApplicationInstanceUnregistrationNotifier"}, + FunctionInfo{5, nullptr, "ListApplicationInstanceId"}, + FunctionInfo{6, nullptr, "GetMicroApplicationInstanceId"}, + FunctionInfo{7, nullptr, "GetApplicationCertificate"}, + FunctionInfo{9998, nullptr, "GetPreomiaApplicationLaunchProperty"}, + FunctionInfo{9999, nullptr, "GetPreomiaApplicationControlProperty"} + ); const ARPManager& manager; }; @@ -33,6 +51,14 @@ private: void AcquireRegistrar(HLERequestContext& ctx); void UnregisterApplicationInstance(HLERequestContext& ctx); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &ARP_W::AcquireRegistrar, "AcquireRegistrar"}, + FunctionInfo{1, &ARP_W::UnregisterApplicationInstance , "UnregisterApplicationInstance "}, + FunctionInfo{2, nullptr, "AcquireUpdater"} + ); ARPManager& manager; std::shared_ptr registrar; }; diff --git a/src/core/hle/service/glue/bgtc.cpp b/src/core/hle/service/glue/bgtc.cpp index 360f16f0dd..7c7b5ea13c 100644 --- a/src/core/hle/service/glue/bgtc.cpp +++ b/src/core/hle/service/glue/bgtc.cpp @@ -11,15 +11,7 @@ namespace Service::Glue { -BGTC_T::BGTC_T(Core::System& system_) : ServiceFramework{system_, "bgtc:t"} { - // clang-format off - static const FunctionInfo functions[] = { - {100, &BGTC_T::OpenTaskService, "OpenTaskService"}, - }; - // clang-format on - - RegisterHandlers(functions); -} +BGTC_T::BGTC_T(Core::System& system_) : ServiceFramework{system_, "bgtc:t"} {} BGTC_T::~BGTC_T() = default; @@ -32,44 +24,11 @@ void BGTC_T::OpenTaskService(HLERequestContext& ctx) { } ITaskService::ITaskService(Core::System& system_) : ServiceFramework{system_, "ITaskService"} { - // clang-format off - static const FunctionInfo functions[] = { - {1, nullptr, "NotifyTaskStarting"}, - {2, nullptr, "NotifyTaskFinished"}, - {3, nullptr, "GetTriggerEvent"}, - {4, nullptr, "IsInHalfAwake"}, - {5, nullptr, "NotifyClientName"}, - {6, nullptr, "IsInFullAwake"}, - {11, nullptr, "ScheduleTask"}, - {12, nullptr, "GetScheduledTaskInterval"}, - {13, nullptr, "UnscheduleTask"}, - {14, nullptr, "GetScheduleEvent"}, - {15, nullptr, "SchedulePeriodicTask"}, - {16, nullptr, "Unknown16"}, - {101, nullptr, "GetOperationMode"}, - {102, nullptr, "WillDisconnectNetworkWhenEnteringSleep"}, - {103, nullptr, "WillStayHalfAwakeInsteadSleep"}, - {200, nullptr, "Unknown200"}, - }; - // clang-format on - - RegisterHandlers(functions); } ITaskService::~ITaskService() = default; BGTC_SC::BGTC_SC(Core::System& system_) : ServiceFramework{system_, "bgtc:sc"} { - // clang-format off - static const FunctionInfo functions[] = { - {1, nullptr, "GetState"}, - {2, nullptr, "GetStateChangedEvent"}, - {3, nullptr, "NotifyEnteringHalfAwake"}, - {4, nullptr, "NotifyLeavingHalfAwake"}, - {5, nullptr, "SetIsUsingSleepUnsupportedDevices"}, - }; - // clang-format on - - RegisterHandlers(functions); } BGTC_SC::~BGTC_SC() = default; diff --git a/src/core/hle/service/glue/bgtc.h b/src/core/hle/service/glue/bgtc.h index 5a5d9c9a7a..0ef0ab902f 100644 --- a/src/core/hle/service/glue/bgtc.h +++ b/src/core/hle/service/glue/bgtc.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -17,18 +20,57 @@ public: ~BGTC_T() override; void OpenTaskService(HLERequestContext& ctx); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{100, &BGTC_T::OpenTaskService, "OpenTaskService"} + ); }; class ITaskService final : public ServiceFramework { public: explicit ITaskService(Core::System& system_); ~ITaskService() override; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{1, nullptr, "NotifyTaskStarting"}, + FunctionInfo{2, nullptr, "NotifyTaskFinished"}, + FunctionInfo{3, nullptr, "GetTriggerEvent"}, + FunctionInfo{4, nullptr, "IsInHalfAwake"}, + FunctionInfo{5, nullptr, "NotifyClientName"}, + FunctionInfo{6, nullptr, "IsInFullAwake"}, + FunctionInfo{11, nullptr, "ScheduleTask"}, + FunctionInfo{12, nullptr, "GetScheduledTaskInterval"}, + FunctionInfo{13, nullptr, "UnscheduleTask"}, + FunctionInfo{14, nullptr, "GetScheduleEvent"}, + FunctionInfo{15, nullptr, "SchedulePeriodicTask"}, + FunctionInfo{16, nullptr, "Unknown16"}, + FunctionInfo{101, nullptr, "GetOperationMode"}, + FunctionInfo{102, nullptr, "WillDisconnectNetworkWhenEnteringSleep"}, + FunctionInfo{103, nullptr, "WillStayHalfAwakeInsteadSleep"}, + FunctionInfo{200, nullptr, "Unknown200"} + ); }; class BGTC_SC final : public ServiceFramework { public: explicit BGTC_SC(Core::System& system_); ~BGTC_SC() override; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{1, nullptr, "GetState"}, + FunctionInfo{2, nullptr, "GetStateChangedEvent"}, + FunctionInfo{3, nullptr, "NotifyEnteringHalfAwake"}, + FunctionInfo{4, nullptr, "NotifyLeavingHalfAwake"}, + FunctionInfo{5, nullptr, "SetIsUsingSleepUnsupportedDevices"} + ); }; } // namespace Service::Glue diff --git a/src/core/hle/service/glue/ectx.cpp b/src/core/hle/service/glue/ectx.cpp index 322ae45254..80d22a0ca7 100644 --- a/src/core/hle/service/glue/ectx.cpp +++ b/src/core/hle/service/glue/ectx.cpp @@ -12,14 +12,10 @@ namespace Service::Glue { // This is nn::err::context::IContextRegistrar class IContextRegistrar : public ServiceFramework { public: - IContextRegistrar(Core::System& system_) : ServiceFramework{system_, "IContextRegistrar"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &IContextRegistrar::Complete, "Complete"}, - }; - // clang-format on + IContextRegistrar(Core::System& system_) : ServiceFramework{system_, "IContextRegistrar"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } ~IContextRegistrar() override = default; @@ -41,41 +37,21 @@ private: rb.Push(ResultSuccess); rb.Push(0); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &IContextRegistrar::Complete, "Complete"} + ); }; ECTX_W::ECTX_W(Core::System& system_) : ServiceFramework{system_, "ectx:w"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "CreateContextRegistrar"}, - {1, nullptr, "CommitContext"}, - {2, nullptr, "RemoveContext"}, - }; - // clang-format on - RegisterHandlers(functions); } ECTX_W::~ECTX_W() = default; ECTX_R::ECTX_R(Core::System& system_) : ServiceFramework{system_, "ectx:r"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetContextInfo"}, - {1, nullptr, "PullContext"}, - {2, nullptr, "ListContextDescriptorWithResultForDebug"}, - }; - // clang-format on - RegisterHandlers(functions); } ECTX_R::~ECTX_R() = default; ECTX_AW::ECTX_AW(Core::System& system_) : ServiceFramework{system_, "ectx:aw"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &ECTX_AW::CreateContextRegistrar, "CreateContextRegistrar"}, - {1, nullptr, "CommitContext"}, - }; - // clang-format on - - RegisterHandlers(functions); } ECTX_AW::~ECTX_AW() = default; diff --git a/src/core/hle/service/glue/ectx.h b/src/core/hle/service/glue/ectx.h index ff48075eda..01f109c609 100644 --- a/src/core/hle/service/glue/ectx.h +++ b/src/core/hle/service/glue/ectx.h @@ -18,12 +18,30 @@ class ECTX_W final : public ServiceFramework { public: explicit ECTX_W(Core::System& system_); ~ECTX_W() override; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "CreateContextRegistrar"}, + FunctionInfo{1, nullptr, "CommitContext"}, + FunctionInfo{2, nullptr, "RemoveContext"} + ); }; class ECTX_R final : public ServiceFramework { public: explicit ECTX_R(Core::System& system_); ~ECTX_R() override; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetContextInfo"}, + FunctionInfo{1, nullptr, "PullContext"}, + FunctionInfo{2, nullptr, "ListContextDescriptorWithResultForDebug"} + ); }; class ECTX_AW final : public ServiceFramework { @@ -33,6 +51,14 @@ public: private: void CreateContextRegistrar(HLERequestContext& ctx); + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &ECTX_AW::CreateContextRegistrar, "CreateContextRegistrar"}, + FunctionInfo{1, nullptr, "CommitContext"} + ); }; } // namespace Service::Glue diff --git a/src/core/hle/service/glue/notif.cpp b/src/core/hle/service/glue/notif.cpp index 716e4da32d..a369b78ddd 100644 --- a/src/core/hle/service/glue/notif.cpp +++ b/src/core/hle/service/glue/notif.cpp @@ -17,9 +17,45 @@ namespace Service::Glue { namespace { - constexpr inline std::size_t MaxAlarms = 8; +} +std::optional INotificationServicesForApplication::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{500, D<&INotificationServicesForApplication::RegisterAlarmSetting>, "RegisterAlarmSetting"}, + FunctionInfo{510, D<&INotificationServicesForApplication::UpdateAlarmSetting>, "UpdateAlarmSetting"}, + FunctionInfo{520, D<&INotificationServicesForApplication::ListAlarmSettings>, "ListAlarmSettings"}, + FunctionInfo{530, D<&INotificationServicesForApplication::LoadApplicationParameter>, "LoadApplicationParameter"}, + FunctionInfo{540, D<&INotificationServicesForApplication::DeleteAlarmSetting>, "DeleteAlarmSetting"}, + FunctionInfo{1000, D<&INotificationServicesForApplication::Initialize>, "Initialize"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + +std::optional INotificationServices::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{500, D<&INotificationServices::RegisterAlarmSetting>, "RegisterAlarmSetting"}, + FunctionInfo{510, D<&INotificationServices::UpdateAlarmSetting>, "UpdateAlarmSetting"}, + FunctionInfo{520, D<&INotificationServices::ListAlarmSettings>, "ListAlarmSettings"}, + FunctionInfo{530, D<&INotificationServices::LoadApplicationParameter>, "LoadApplicationParameter"}, + FunctionInfo{540, D<&INotificationServices::DeleteAlarmSetting>, "DeleteAlarmSetting"}, + FunctionInfo{1000, D<&INotificationServices::Initialize>, "Initialize"}, + FunctionInfo{1010, nullptr, "ListNotifications"}, + FunctionInfo{1020, nullptr, "DeleteNotification"}, + FunctionInfo{1030, nullptr, "ClearNotifications"}, + FunctionInfo{1040, D<&INotificationServices::OpenNotificationSystemEventAccessor>, "OpenNotificationSystemEventAccessor"}, + FunctionInfo{1500, nullptr, "SetNotificationPresentationSetting"}, + FunctionInfo{1510, D<&INotificationServices::GetNotificationPresentationSetting>, "GetNotificationPresentationSetting"}, + FunctionInfo{2000, nullptr, "GetAlarmSetting"}, + FunctionInfo{2001, nullptr, "GetAlarmSettingWithApplicationParameter"}, + FunctionInfo{2010, nullptr, "MuteAlarmSetting"}, + FunctionInfo{2020, nullptr, "IsAlarmSettingReady"}, + FunctionInfo{8000, nullptr, "RegisterAppletResourceUserId"}, + FunctionInfo{8010, nullptr, "UnregisterAppletResourceUserId"}, + FunctionInfo{8999, nullptr, "GetCurrentTime"}, + FunctionInfo{9000, nullptr, "GetAlarmSettingNextNotificationTime"} + ); + return HandlerTableGenerateWithFind(key, functions); } Result NotificationServiceImpl::RegisterAlarmSetting(AlarmSettingId* out_alarm_setting_id, @@ -124,18 +160,6 @@ std::vector::iterator NotificationServiceImpl::GetAlarmFromId(Alar INotificationServicesForApplication::INotificationServicesForApplication(Core::System& system_) : ServiceFramework{system_, "notif:a"} { - // clang-format off - static const FunctionInfo functions[] = { - {500, D<&INotificationServicesForApplication::RegisterAlarmSetting>, "RegisterAlarmSetting"}, - {510, D<&INotificationServicesForApplication::UpdateAlarmSetting>, "UpdateAlarmSetting"}, - {520, D<&INotificationServicesForApplication::ListAlarmSettings>, "ListAlarmSettings"}, - {530, D<&INotificationServicesForApplication::LoadApplicationParameter>, "LoadApplicationParameter"}, - {540, D<&INotificationServicesForApplication::DeleteAlarmSetting>, "DeleteAlarmSetting"}, - {1000, D<&INotificationServicesForApplication::Initialize>, "Initialize"}, - }; - // clang-format on - - RegisterHandlers(functions); } INotificationServicesForApplication::~INotificationServicesForApplication() = default; @@ -178,18 +202,13 @@ class INotificationSystemEventAccessor final : public ServiceFramework { public: explicit INotificationSystemEventAccessor(Core::System& system_) - : ServiceFramework{system_, "INotificationSystemEventAccessor"}, - service_context{system_, "INotificationSystemEventAccessor"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&INotificationSystemEventAccessor::GetSystemEvent>, "GetSystemEvent"}, - }; - // clang-format on + : ServiceFramework{system_, "INotificationSystemEventAccessor"} + , service_context{system_, "INotificationSystemEventAccessor"} { + notification_event = service_context.CreateEvent("INotificationSystemEventAccessor:NotificationEvent"); + } - RegisterHandlers(functions); - - notification_event = - service_context.CreateEvent("INotificationSystemEventAccessor:NotificationEvent"); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } ~INotificationSystemEventAccessor() { @@ -204,38 +223,15 @@ private: R_SUCCEED(); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&INotificationSystemEventAccessor::GetSystemEvent>, "GetSystemEvent"} + ); KernelHelpers::ServiceContext service_context; Kernel::KEvent* notification_event; }; INotificationServices::INotificationServices(Core::System& system_) : ServiceFramework{system_, "notif:s"} { - // clang-format off - static const FunctionInfo functions[] = { - {500, D<&INotificationServices::RegisterAlarmSetting>, "RegisterAlarmSetting"}, - {510, D<&INotificationServices::UpdateAlarmSetting>, "UpdateAlarmSetting"}, - {520, D<&INotificationServices::ListAlarmSettings>, "ListAlarmSettings"}, - {530, D<&INotificationServices::LoadApplicationParameter>, "LoadApplicationParameter"}, - {540, D<&INotificationServices::DeleteAlarmSetting>, "DeleteAlarmSetting"}, - {1000, D<&INotificationServices::Initialize>, "Initialize"}, - {1010, nullptr, "ListNotifications"}, - {1020, nullptr, "DeleteNotification"}, - {1030, nullptr, "ClearNotifications"}, - {1040, D<&INotificationServices::OpenNotificationSystemEventAccessor>, "OpenNotificationSystemEventAccessor"}, - {1500, nullptr, "SetNotificationPresentationSetting"}, - {1510, D<&INotificationServices::GetNotificationPresentationSetting>, "GetNotificationPresentationSetting"}, - {2000, nullptr, "GetAlarmSetting"}, - {2001, nullptr, "GetAlarmSettingWithApplicationParameter"}, - {2010, nullptr, "MuteAlarmSetting"}, - {2020, nullptr, "IsAlarmSettingReady"}, - {8000, nullptr, "RegisterAppletResourceUserId"}, - {8010, nullptr, "UnregisterAppletResourceUserId"}, - {8999, nullptr, "GetCurrentTime"}, - {9000, nullptr, "GetAlarmSettingNextNotificationTime"}, - }; - // clang-format on - - RegisterHandlers(functions); } INotificationServices::~INotificationServices() = default; diff --git a/src/core/hle/service/glue/notif.h b/src/core/hle/service/glue/notif.h index ef2522fdfb..c5367e5da4 100644 --- a/src/core/hle/service/glue/notif.h +++ b/src/core/hle/service/glue/notif.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -98,6 +101,7 @@ private: Result DeleteAlarmSetting(AlarmSettingId alarm_setting_id); Result Initialize(ClientAppletResourceUserId aruid); + std::optional FindRequest(u32 key) override; NotificationServiceImpl impl; }; @@ -127,6 +131,7 @@ private: Out out_notification_presentation_setting, NotificationChannel notification_channel); + std::optional FindRequest(u32 key) override; NotificationServiceImpl impl; }; } // namespace Service::Glue diff --git a/src/core/hle/service/glue/time/static.cpp b/src/core/hle/service/glue/time/static.cpp index d8672b7248..dc7651fd1f 100644 --- a/src/core/hle/service/glue/time/static.cpp +++ b/src/core/hle/service/glue/time/static.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -21,42 +24,42 @@ namespace Service::Glue::Time { +std::optional StaticService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&StaticService::GetStandardUserSystemClock>, "GetStandardUserSystemClock"}, + FunctionInfo{1, D<&StaticService::GetStandardNetworkSystemClock>, "GetStandardNetworkSystemClock"}, + FunctionInfo{2, D<&StaticService::GetStandardSteadyClock>, "GetStandardSteadyClock"}, + FunctionInfo{3, D<&StaticService::GetTimeZoneService>, "GetTimeZoneService"}, + FunctionInfo{4, D<&StaticService::GetStandardLocalSystemClock>, "GetStandardLocalSystemClock"}, + FunctionInfo{5, D<&StaticService::GetEphemeralNetworkSystemClock>, "GetEphemeralNetworkSystemClock"}, + FunctionInfo{20, D<&StaticService::GetSharedMemoryNativeHandle>, "GetSharedMemoryNativeHandle"}, + FunctionInfo{50, D<&StaticService::SetStandardSteadyClockInternalOffset>, "SetStandardSteadyClockInternalOffset"}, + FunctionInfo{51, D<&StaticService::GetStandardSteadyClockRtcValue>, "GetStandardSteadyClockRtcValue"}, + FunctionInfo{100, D<&StaticService::IsStandardUserSystemClockAutomaticCorrectionEnabled>, "IsStandardUserSystemClockAutomaticCorrectionEnabled"}, + FunctionInfo{101, D<&StaticService::SetStandardUserSystemClockAutomaticCorrectionEnabled>, "SetStandardUserSystemClockAutomaticCorrectionEnabled"}, + FunctionInfo{102, D<&StaticService::GetStandardUserSystemClockInitialYear>, "GetStandardUserSystemClockInitialYear"}, + FunctionInfo{200, D<&StaticService::IsStandardNetworkSystemClockAccuracySufficient>, "IsStandardNetworkSystemClockAccuracySufficient"}, + FunctionInfo{201, D<&StaticService::GetStandardUserSystemClockAutomaticCorrectionUpdatedTime>, "GetStandardUserSystemClockAutomaticCorrectionUpdatedTime"}, + FunctionInfo{300, D<&StaticService::CalculateMonotonicSystemClockBaseTimePoint>, "CalculateMonotonicSystemClockBaseTimePoint"}, + FunctionInfo{400, D<&StaticService::GetClockSnapshot>, "GetClockSnapshot"}, + FunctionInfo{401, D<&StaticService::GetClockSnapshotFromSystemClockContext>, "GetClockSnapshotFromSystemClockContext"}, + FunctionInfo{500, D<&StaticService::CalculateStandardUserSystemClockDifferenceByUser>, "CalculateStandardUserSystemClockDifferenceByUser"}, + FunctionInfo{501, D<&StaticService::CalculateSpanBetween>, "CalculateSpanBetween"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + StaticService::StaticService(Core::System& system_, Service::PSC::Time::StaticServiceSetupInfo setup_info, std::shared_ptr time, const char* name) - : ServiceFramework{system_, name}, m_system{system_}, m_time_m{time->m_time_m}, + : ServiceFramework{system_, name}, m_time_m{time->m_time_m}, m_setup_info{setup_info}, m_time_sm{time->m_time_sm}, m_file_timestamp_worker{time->m_file_timestamp_worker}, m_standard_steady_clock_resource{time->m_steady_clock_resource}, m_time_zone_binary{time->m_time_zone_binary} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&StaticService::GetStandardUserSystemClock>, "GetStandardUserSystemClock"}, - {1, D<&StaticService::GetStandardNetworkSystemClock>, "GetStandardNetworkSystemClock"}, - {2, D<&StaticService::GetStandardSteadyClock>, "GetStandardSteadyClock"}, - {3, D<&StaticService::GetTimeZoneService>, "GetTimeZoneService"}, - {4, D<&StaticService::GetStandardLocalSystemClock>, "GetStandardLocalSystemClock"}, - {5, D<&StaticService::GetEphemeralNetworkSystemClock>, "GetEphemeralNetworkSystemClock"}, - {20, D<&StaticService::GetSharedMemoryNativeHandle>, "GetSharedMemoryNativeHandle"}, - {50, D<&StaticService::SetStandardSteadyClockInternalOffset>, "SetStandardSteadyClockInternalOffset"}, - {51, D<&StaticService::GetStandardSteadyClockRtcValue>, "GetStandardSteadyClockRtcValue"}, - {100, D<&StaticService::IsStandardUserSystemClockAutomaticCorrectionEnabled>, "IsStandardUserSystemClockAutomaticCorrectionEnabled"}, - {101, D<&StaticService::SetStandardUserSystemClockAutomaticCorrectionEnabled>, "SetStandardUserSystemClockAutomaticCorrectionEnabled"}, - {102, D<&StaticService::GetStandardUserSystemClockInitialYear>, "GetStandardUserSystemClockInitialYear"}, - {200, D<&StaticService::IsStandardNetworkSystemClockAccuracySufficient>, "IsStandardNetworkSystemClockAccuracySufficient"}, - {201, D<&StaticService::GetStandardUserSystemClockAutomaticCorrectionUpdatedTime>, "GetStandardUserSystemClockAutomaticCorrectionUpdatedTime"}, - {300, D<&StaticService::CalculateMonotonicSystemClockBaseTimePoint>, "CalculateMonotonicSystemClockBaseTimePoint"}, - {400, D<&StaticService::GetClockSnapshot>, "GetClockSnapshot"}, - {401, D<&StaticService::GetClockSnapshotFromSystemClockContext>, "GetClockSnapshotFromSystemClockContext"}, - {500, D<&StaticService::CalculateStandardUserSystemClockDifferenceByUser>, "CalculateStandardUserSystemClockDifferenceByUser"}, - {501, D<&StaticService::CalculateSpanBetween>, "CalculateSpanBetween"}, - }; - // clang-format on - - RegisterHandlers(functions); m_set_sys = - m_system.ServiceManager().GetService("set:sys", true); + system.ServiceManager().GetService("set:sys", true); if (m_setup_info.can_write_local_clock && m_setup_info.can_write_user_clock && !m_setup_info.can_write_network_clock && m_setup_info.can_write_timezone_device_location && @@ -106,7 +109,7 @@ Result StaticService::GetTimeZoneService(OutInterface out_servi LOG_DEBUG(Service_Time, "called."); *out_service = std::make_shared( - m_system, m_file_timestamp_worker, m_setup_info.can_write_timezone_device_location, + system, m_file_timestamp_worker, m_setup_info.can_write_timezone_device_location, m_time_zone_binary, m_time_zone); R_SUCCEED(); } diff --git a/src/core/hle/service/glue/time/static.h b/src/core/hle/service/glue/time/static.h index 7bb0e0b36e..5856553461 100644 --- a/src/core/hle/service/glue/time/static.h +++ b/src/core/hle/service/glue/time/static.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -69,12 +72,11 @@ public: Result CalculateSpanBetween(Out out_time, InClockSnapshot a, InClockSnapshot b); private: - Core::System& m_system; + std::optional FindRequest(u32 key) override; std::shared_ptr m_set_sys; std::shared_ptr m_time_m; std::shared_ptr m_wrapped_service; - Service::PSC::Time::StaticServiceSetupInfo m_setup_info; std::shared_ptr m_time_sm; std::shared_ptr m_time_zone; diff --git a/src/core/hle/service/glue/time/time_zone.cpp b/src/core/hle/service/glue/time/time_zone.cpp index 52bd651f2b..6e861b4060 100644 --- a/src/core/hle/service/glue/time/time_zone.cpp +++ b/src/core/hle/service/glue/time/time_zone.cpp @@ -19,6 +19,26 @@ namespace Service::Glue::Time { +std::optional TimeZoneService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&TimeZoneService::GetDeviceLocationName>, "GetDeviceLocationName"}, + FunctionInfo{1, D<&TimeZoneService::SetDeviceLocationName>, "SetDeviceLocationName"}, + FunctionInfo{2, D<&TimeZoneService::GetTotalLocationNameCount>, "GetTotalLocationNameCount"}, + FunctionInfo{3, D<&TimeZoneService::LoadLocationNameList>, "LoadLocationNameList"}, + FunctionInfo{4, D<&TimeZoneService::LoadTimeZoneRule>, "LoadTimeZoneRule"}, + FunctionInfo{5, D<&TimeZoneService::GetTimeZoneRuleVersion>, "GetTimeZoneRuleVersion"}, + FunctionInfo{6, D<&TimeZoneService::GetDeviceLocationNameAndUpdatedTime>, "GetDeviceLocationNameAndUpdatedTime"}, + FunctionInfo{7, D<&TimeZoneService::SetDeviceLocationNameWithTimeZoneRule>, "SetDeviceLocationNameWithTimeZoneRule"}, + FunctionInfo{8, D<&TimeZoneService::ParseTimeZoneBinary>, "ParseTimeZoneBinary"}, + FunctionInfo{20, D<&TimeZoneService::GetDeviceLocationNameOperationEventReadableHandle>, "GetDeviceLocationNameOperationEventReadableHandle"}, + FunctionInfo{100, D<&TimeZoneService::ToCalendarTime>, "ToCalendarTime"}, + FunctionInfo{101, D<&TimeZoneService::ToCalendarTimeWithMyRule>, "ToCalendarTimeWithMyRule"}, + FunctionInfo{201, D<&TimeZoneService::ToPosixTime>, "ToPosixTime"}, + FunctionInfo{202, D<&TimeZoneService::ToPosixTimeWithMyRule>, "ToPosixTimeWithMyRule"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + TimeZoneService::TimeZoneService( Core::System& system_, FileTimestampWorker& file_timestamp_worker, bool can_write_timezone_device_location, TimeZoneBinary& time_zone_binary, @@ -30,26 +50,6 @@ TimeZoneService::TimeZoneService( , m_operation_event{system} , m_time_zone_binary{time_zone_binary} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&TimeZoneService::GetDeviceLocationName>, "GetDeviceLocationName"}, - {1, D<&TimeZoneService::SetDeviceLocationName>, "SetDeviceLocationName"}, - {2, D<&TimeZoneService::GetTotalLocationNameCount>, "GetTotalLocationNameCount"}, - {3, D<&TimeZoneService::LoadLocationNameList>, "LoadLocationNameList"}, - {4, D<&TimeZoneService::LoadTimeZoneRule>, "LoadTimeZoneRule"}, - {5, D<&TimeZoneService::GetTimeZoneRuleVersion>, "GetTimeZoneRuleVersion"}, - {6, D<&TimeZoneService::GetDeviceLocationNameAndUpdatedTime>, "GetDeviceLocationNameAndUpdatedTime"}, - {7, D<&TimeZoneService::SetDeviceLocationNameWithTimeZoneRule>, "SetDeviceLocationNameWithTimeZoneRule"}, - {8, D<&TimeZoneService::ParseTimeZoneBinary>, "ParseTimeZoneBinary"}, - {20, D<&TimeZoneService::GetDeviceLocationNameOperationEventReadableHandle>, "GetDeviceLocationNameOperationEventReadableHandle"}, - {100, D<&TimeZoneService::ToCalendarTime>, "ToCalendarTime"}, - {101, D<&TimeZoneService::ToCalendarTimeWithMyRule>, "ToCalendarTimeWithMyRule"}, - {201, D<&TimeZoneService::ToPosixTime>, "ToPosixTime"}, - {202, D<&TimeZoneService::ToPosixTimeWithMyRule>, "ToPosixTimeWithMyRule"}, - }; - // clang-format on - RegisterHandlers(functions); - m_set_sys = system.ServiceManager().GetService("set:sys", true); } diff --git a/src/core/hle/service/glue/time/time_zone.h b/src/core/hle/service/glue/time/time_zone.h index 635070263b..839d823e67 100644 --- a/src/core/hle/service/glue/time/time_zone.h +++ b/src/core/hle/service/glue/time/time_zone.h @@ -80,6 +80,7 @@ public: const Service::PSC::Time::CalendarTime& calendar_time); private: + std::optional FindRequest(u32 key) override; std::shared_ptr m_set_sys; bool m_can_write_timezone_device_location; FileTimestampWorker& m_file_timestamp_worker; diff --git a/src/core/hle/service/gpio/gpio.cpp b/src/core/hle/service/gpio/gpio.cpp index 8b4aa0f5ab..5441149c65 100644 --- a/src/core/hle/service/gpio/gpio.cpp +++ b/src/core/hle/service/gpio/gpio.cpp @@ -13,15 +13,15 @@ namespace Service::GPIO { class GPIO final : public ServiceFramework { public: - explicit GPIO(Core::System& system_) - : ServiceFramework{system_, "gpio"} - { - static const FunctionInfo functions[] = { - {0, nullptr, "Cmd0"}, - }; - RegisterHandlers(functions); - } + explicit GPIO(Core::System& system_) : ServiceFramework{system_, "gpio"} {} ~GPIO() override = default; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "Cmd0"} + ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/grc/grc.cpp b/src/core/hle/service/grc/grc.cpp index e8e901662d..5f6c84e914 100644 --- a/src/core/hle/service/grc/grc.cpp +++ b/src/core/hle/service/grc/grc.cpp @@ -14,32 +14,31 @@ namespace Service::GRC { class GRC final : public ServiceFramework { public: - explicit GRC(Core::System& system_) : ServiceFramework{system_, "grc:c"} { - // clang-format off - static const FunctionInfo functions[] = { - {1, nullptr, "OpenContinuousRecorder"}, - {2, nullptr, "OpenGameMovieTrimmer"}, - {3, nullptr, "OpenOffscreenRecorder"}, - {101, nullptr, "CreateMovieMaker"}, - {9903, nullptr, "SetOffscreenRecordingMarker"} - }; - // clang-format on + explicit GRC(Core::System& system_) : ServiceFramework{system_, "grc:c"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{1, nullptr, "OpenContinuousRecorder"}, + FunctionInfo{2, nullptr, "OpenGameMovieTrimmer"}, + FunctionInfo{3, nullptr, "OpenOffscreenRecorder"}, + FunctionInfo{101, nullptr, "CreateMovieMaker"}, + FunctionInfo{9903, nullptr, "SetOffscreenRecordingMarker"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class GRC_D final : public ServiceFramework { public: - explicit GRC_D(Core::System& system_) : ServiceFramework{system_, "grc:d"} { - // clang-format off - static const FunctionInfo functions[] = { - {1, nullptr, "Initialize"}, - {2, nullptr, "Transfer"}, - {3, nullptr, "Cmd3"}, - }; - // clang-format on - RegisterHandlers(functions); + explicit GRC_D(Core::System& system_) : ServiceFramework{system_, "grc:d"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{1, nullptr, "Initialize"}, + FunctionInfo{2, nullptr, "Transfer"}, + FunctionInfo{3, nullptr, "Cmd3"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; diff --git a/src/core/hle/service/hid/active_vibration_device_list.cpp b/src/core/hle/service/hid/active_vibration_device_list.cpp index e0d6d3f2d9..7a4f4cce2c 100644 --- a/src/core/hle/service/hid/active_vibration_device_list.cpp +++ b/src/core/hle/service/hid/active_vibration_device_list.cpp @@ -14,16 +14,16 @@ namespace Service::HID { +std::optional IActiveVibrationDeviceList::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, C<&IActiveVibrationDeviceList::ActivateVibrationDevice>, "ActivateVibrationDevice"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IActiveVibrationDeviceList::IActiveVibrationDeviceList(Core::System& system_, std::shared_ptr resource) : ServiceFramework{system_, "IActiveVibrationDeviceList"}, resource_manager(resource) { - // clang-format off - static const FunctionInfo functions[] = { - {0, C<&IActiveVibrationDeviceList::ActivateVibrationDevice>, "ActivateVibrationDevice"}, - }; - // clang-format on - - RegisterHandlers(functions); } IActiveVibrationDeviceList::~IActiveVibrationDeviceList() = default; diff --git a/src/core/hle/service/hid/active_vibration_device_list.h b/src/core/hle/service/hid/active_vibration_device_list.h index beaa44d97a..57c31a8df1 100644 --- a/src/core/hle/service/hid/active_vibration_device_list.h +++ b/src/core/hle/service/hid/active_vibration_device_list.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -26,8 +29,8 @@ public: private: static constexpr std::size_t MaxVibrationDevicesHandles{0x100}; - Result ActivateVibrationDevice(Core::HID::VibrationDeviceHandle vibration_device_handle); + std::optional FindRequest(u32 key) override; mutable std::mutex mutex; std::size_t list_size{}; diff --git a/src/core/hle/service/hid/applet_resource.cpp b/src/core/hle/service/hid/applet_resource.cpp index 44ae767841..6f658fa875 100644 --- a/src/core/hle/service/hid/applet_resource.cpp +++ b/src/core/hle/service/hid/applet_resource.cpp @@ -12,14 +12,17 @@ namespace Service::HID { +std::optional IAppletResource::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, C<&IAppletResource::GetSharedMemoryHandle>, "GetSharedMemoryHandle"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IAppletResource::IAppletResource(Core::System& system_, std::shared_ptr resource, u64 applet_resource_user_id) : ServiceFramework{system_, "IAppletResource"}, aruid{applet_resource_user_id}, resource_manager{resource} { - static const FunctionInfo functions[] = { - {0, C<&IAppletResource::GetSharedMemoryHandle>, "GetSharedMemoryHandle"}, - }; - RegisterHandlers(functions); } IAppletResource::~IAppletResource() { diff --git a/src/core/hle/service/hid/applet_resource.h b/src/core/hle/service/hid/applet_resource.h index d1e7db9b1e..7b5d915218 100644 --- a/src/core/hle/service/hid/applet_resource.h +++ b/src/core/hle/service/hid/applet_resource.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -29,6 +32,7 @@ public: private: Result GetSharedMemoryHandle(OutCopyHandle out_shared_memory_handle); + std::optional FindRequest(u32 key) override; u64 aruid{}; std::shared_ptr resource_manager; }; diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 25096ff36f..0ea587312b 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -16,19 +16,24 @@ #include "core/hle/service/server_manager.h" #include "hid_core/resource_manager.h" #include "hid_core/resources/hid_firmware_settings.h" +#include "core/hle/service/ipc_helpers.h" +#include "hid_core/hid_types.h" +#include "hid_core/resources/touch_screen/gesture.h" +#include "hid_core/resources/touch_screen/touch_screen.h" +#include "core/hle/service/cmif_serialization.h" namespace Service::HID { class IHidTemporaryServer final : public ServiceFramework { public: explicit IHidTemporaryServer(Core::System& system_) - : ServiceFramework{system_, "hid:tmp"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetConsoleSixAxisSensorCalibrationValues"}, - }; - // clang-format on - RegisterHandlers(functions); + : ServiceFramework{system_, "hid:tmp"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetConsoleSixAxisSensorCalibrationValues"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } ~IHidTemporaryServer() override = default; }; @@ -36,17 +41,17 @@ public: class AHID_CD final : public ServiceFramework { public: explicit AHID_CD(Core::System& system_) - : ServiceFramework{system_, "ahid:cd"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "AcquireDevice"}, - {1, nullptr, "ReleaseDevice"}, - {2, nullptr, "GetCtrlSession"}, - {3, nullptr, "GetReadSession"}, - {4, nullptr, "GetWriteSession"}, - }; - // clang-format on - RegisterHandlers(functions); + : ServiceFramework{system_, "ahid:cd"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "AcquireDevice"}, + FunctionInfo{1, nullptr, "ReleaseDevice"}, + FunctionInfo{2, nullptr, "GetCtrlSession"}, + FunctionInfo{3, nullptr, "GetReadSession"}, + FunctionInfo{4, nullptr, "GetWriteSession"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } ~AHID_CD() override = default; }; @@ -54,22 +59,322 @@ public: class AHID_HDR final : public ServiceFramework { public: explicit AHID_HDR(Core::System& system_) - : ServiceFramework{system_, "ahid:hdr"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetDeviceEntries"}, - {1, nullptr, "GetDeviceList"}, - {2, nullptr, "GetDeviceParameters"}, - {3, nullptr, "AttachDevice"}, - {4, nullptr, "DetachDevice"}, - {5, nullptr, "SetDeviceFilter"}, - }; - // clang-format on - RegisterHandlers(functions); + : ServiceFramework{system_, "ahid:hdr"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetDeviceEntries"}, + FunctionInfo{1, nullptr, "GetDeviceList"}, + FunctionInfo{2, nullptr, "GetDeviceParameters"}, + FunctionInfo{3, nullptr, "AttachDevice"}, + FunctionInfo{4, nullptr, "DetachDevice"}, + FunctionInfo{5, nullptr, "SetDeviceFilter"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } ~AHID_HDR() override = default; }; +class IHidDebugServer final : public ServiceFramework { +public: + explicit IHidDebugServer(Core::System& system_, std::shared_ptr resource, + std::shared_ptr settings) + : ServiceFramework{system_, "hid:dbg"} + , resource_manager{resource} + , firmware_settings{settings} + {} + + ~IHidDebugServer() override = default; + + Result DeactivateTouchScreen() { + LOG_INFO(Service_HID, "called"); + + if (!firmware_settings->IsDeviceManaged()) { + R_RETURN(GetResourceManager()->GetTouchScreen()->Deactivate()); + } + + R_SUCCEED(); + } + + Result SetTouchScreenAutoPilotState( + InArray auto_pilot_buffer) { + AutoPilotState auto_pilot{}; + + auto_pilot.count = + static_cast((std::min)(auto_pilot_buffer.size(), auto_pilot.state.size())); + memcpy(auto_pilot.state.data(), auto_pilot_buffer.data(), + auto_pilot.count * sizeof(TouchState)); + + LOG_INFO(Service_HID, "called, auto_pilot_count={}", auto_pilot.count); + + R_RETURN(GetResourceManager()->GetTouchScreen()->SetTouchScreenAutoPilotState(auto_pilot)); + } + + Result UnsetTouchScreenAutoPilotState() { + LOG_INFO(Service_HID, "called"); + R_RETURN(GetResourceManager()->GetTouchScreen()->UnsetTouchScreenAutoPilotState()); + } + + Result GetTouchScreenConfiguration( + Out out_touchscreen_config, + ClientAppletResourceUserId aruid) { + LOG_INFO(Service_HID, "called, applet_resource_user_id={}", aruid.pid); + + R_TRY(GetResourceManager()->GetTouchScreen()->GetTouchScreenConfiguration( + *out_touchscreen_config, aruid.pid)); + + if (out_touchscreen_config->mode != Core::HID::TouchScreenModeForNx::Heat2 && + out_touchscreen_config->mode != Core::HID::TouchScreenModeForNx::Finger) { + out_touchscreen_config->mode = Core::HID::TouchScreenModeForNx::UseSystemSetting; + } + + R_SUCCEED(); + } + + Result ProcessTouchScreenAutoTune() { + LOG_INFO(Service_HID, "called"); + R_RETURN(GetResourceManager()->GetTouchScreen()->ProcessTouchScreenAutoTune()); + } + + Result ForceStopTouchScreenManagement() { + LOG_INFO(Service_HID, "called"); + + if (!firmware_settings->IsDeviceManaged()) { + R_SUCCEED(); + } + + auto touch_screen = GetResourceManager()->GetTouchScreen(); + auto gesture = GetResourceManager()->GetGesture(); + + if (firmware_settings->IsTouchI2cManaged()) { + bool is_touch_active{}; + bool is_gesture_active{}; + R_TRY(touch_screen->IsActive(is_touch_active)); + R_TRY(gesture->IsActive(is_gesture_active)); + + if (is_touch_active) { + R_TRY(touch_screen->Deactivate()); + } + if (is_gesture_active) { + R_TRY(gesture->Deactivate()); + } + } + + R_SUCCEED(); + } + + Result ForceRestartTouchScreenManagement(u32 basic_gesture_id, + ClientAppletResourceUserId aruid) { + LOG_INFO(Service_HID, "called, basic_gesture_id={}, applet_resource_user_id={}", + basic_gesture_id, aruid.pid); + + auto touch_screen = GetResourceManager()->GetTouchScreen(); + auto gesture = GetResourceManager()->GetGesture(); + + if (firmware_settings->IsDeviceManaged() && firmware_settings->IsTouchI2cManaged()) { + R_TRY(gesture->Activate()); + R_TRY(gesture->Activate(aruid.pid, basic_gesture_id)); + R_TRY(touch_screen->Activate()); + R_TRY(touch_screen->Activate(aruid.pid)); + } + + R_SUCCEED(); + } + + Result IsTouchScreenManaged(Out out_is_managed) { + LOG_INFO(Service_HID, "called"); + + bool is_touch_active{}; + bool is_gesture_active{}; + R_TRY(GetResourceManager()->GetTouchScreen()->IsActive(is_touch_active)); + R_TRY(GetResourceManager()->GetGesture()->IsActive(is_gesture_active)); + + *out_is_managed = is_touch_active || is_gesture_active; + R_SUCCEED(); + } + + Result DeactivateGesture() { + LOG_INFO(Service_HID, "called"); + + if (!firmware_settings->IsDeviceManaged()) { + R_RETURN(GetResourceManager()->GetGesture()->Deactivate()); + } + + R_SUCCEED(); + } + + std::shared_ptr GetResourceManager() { + resource_manager->Initialize(); + return resource_manager; + } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "DeactivateDebugPad"}, + FunctionInfo{1, nullptr, "SetDebugPadAutoPilotState"}, + FunctionInfo{2, nullptr, "UnsetDebugPadAutoPilotState"}, + FunctionInfo{10, C<&IHidDebugServer::DeactivateTouchScreen>, "DeactivateTouchScreen"}, + FunctionInfo{11, C<&IHidDebugServer::SetTouchScreenAutoPilotState>, "SetTouchScreenAutoPilotState"}, + FunctionInfo{12, C<&IHidDebugServer::UnsetTouchScreenAutoPilotState>, "UnsetTouchScreenAutoPilotState"}, + FunctionInfo{13, C<&IHidDebugServer::GetTouchScreenConfiguration>, "GetTouchScreenConfiguration"}, + FunctionInfo{14, C<&IHidDebugServer::ProcessTouchScreenAutoTune>, "ProcessTouchScreenAutoTune"}, + FunctionInfo{15, C<&IHidDebugServer::ForceStopTouchScreenManagement>, "ForceStopTouchScreenManagement"}, + FunctionInfo{16, C<&IHidDebugServer::ForceRestartTouchScreenManagement>, "ForceRestartTouchScreenManagement"}, + FunctionInfo{17, C<&IHidDebugServer::IsTouchScreenManaged>, "IsTouchScreenManaged"}, + FunctionInfo{20, nullptr, "DeactivateMouse"}, + FunctionInfo{21, nullptr, "SetMouseAutoPilotState"}, + FunctionInfo{22, nullptr, "UnsetMouseAutoPilotState"}, + FunctionInfo{23, nullptr, "AddMouseSideWheelDelta"}, + FunctionInfo{25, nullptr, "SetDebugMouseAutoPilotState"}, + FunctionInfo{26, nullptr, "UnsetDebugMouseAutoPilotState"}, + FunctionInfo{30, nullptr, "DeactivateKeyboard"}, + FunctionInfo{31, nullptr, "SetKeyboardAutoPilotState"}, + FunctionInfo{32, nullptr, "UnsetKeyboardAutoPilotState"}, + FunctionInfo{50, nullptr, "DeactivateXpad"}, + FunctionInfo{51, nullptr, "SetXpadAutoPilotState"}, + FunctionInfo{52, nullptr, "UnsetXpadAutoPilotState"}, + FunctionInfo{53, nullptr, "DeactivateJoyXpad"}, + FunctionInfo{60, nullptr, "ClearNpadSystemCommonPolicy"}, + FunctionInfo{61, nullptr, "DeactivateNpad"}, + FunctionInfo{62, nullptr, "ForceDisconnectNpad"}, + FunctionInfo{91, C<&IHidDebugServer::DeactivateGesture>, "DeactivateGesture"}, + FunctionInfo{110, nullptr, "DeactivateHomeButton"}, + FunctionInfo{111, nullptr, "SetHomeButtonAutoPilotState"}, + FunctionInfo{112, nullptr, "UnsetHomeButtonAutoPilotState"}, + FunctionInfo{120, nullptr, "DeactivateSleepButton"}, + FunctionInfo{121, nullptr, "SetSleepButtonAutoPilotState"}, + FunctionInfo{122, nullptr, "UnsetSleepButtonAutoPilotState"}, + FunctionInfo{123, nullptr, "DeactivateInputDetector"}, + FunctionInfo{130, nullptr, "DeactivateCaptureButton"}, + FunctionInfo{131, nullptr, "SetCaptureButtonAutoPilotState"}, + FunctionInfo{132, nullptr, "UnsetCaptureButtonAutoPilotState"}, + FunctionInfo{133, nullptr, "SetShiftAccelerometerCalibrationValue"}, + FunctionInfo{134, nullptr, "GetShiftAccelerometerCalibrationValue"}, + FunctionInfo{135, nullptr, "SetShiftGyroscopeCalibrationValue"}, + FunctionInfo{136, nullptr, "GetShiftGyroscopeCalibrationValue"}, + FunctionInfo{140, nullptr, "DeactivateConsoleSixAxisSensor"}, + FunctionInfo{141, nullptr, "GetConsoleSixAxisSensorSamplingFrequency"}, + FunctionInfo{142, nullptr, "DeactivateSevenSixAxisSensor"}, + FunctionInfo{143, nullptr, "GetConsoleSixAxisSensorCountStates"}, + FunctionInfo{144, nullptr, "GetAccelerometerFsr"}, + FunctionInfo{145, nullptr, "SetAccelerometerFsr"}, + FunctionInfo{146, nullptr, "GetAccelerometerOdr"}, + FunctionInfo{147, nullptr, "SetAccelerometerOdr"}, + FunctionInfo{148, nullptr, "GetGyroscopeFsr"}, + FunctionInfo{149, nullptr, "SetGyroscopeFsr"}, + FunctionInfo{150, nullptr, "GetGyroscopeOdr"}, + FunctionInfo{151, nullptr, "SetGyroscopeOdr"}, + FunctionInfo{152, nullptr, "GetWhoAmI"}, + FunctionInfo{201, nullptr, "ActivateFirmwareUpdate"}, + FunctionInfo{202, nullptr, "DeactivateFirmwareUpdate"}, + FunctionInfo{203, nullptr, "StartFirmwareUpdate"}, + FunctionInfo{204, nullptr, "GetFirmwareUpdateStage"}, + FunctionInfo{205, nullptr, "GetFirmwareVersion"}, + FunctionInfo{206, nullptr, "GetDestinationFirmwareVersion"}, + FunctionInfo{207, nullptr, "DiscardFirmwareInfoCacheForRevert"}, + FunctionInfo{208, nullptr, "StartFirmwareUpdateForRevert"}, + FunctionInfo{209, nullptr, "GetAvailableFirmwareVersionForRevert"}, + FunctionInfo{210, nullptr, "IsFirmwareUpdatingDevice"}, + FunctionInfo{211, nullptr, "StartFirmwareUpdateIndividual"}, + FunctionInfo{212, nullptr, "GetDetailFirmwareVersion", MakeVersionGate({19,0,0})}, + FunctionInfo{215, nullptr, "SetUsbFirmwareForceUpdateEnabled"}, + FunctionInfo{216, nullptr, "SetAllKuinaDevicesToFirmwareUpdateMode"}, + FunctionInfo{221, nullptr, "UpdateControllerColor"}, + FunctionInfo{222, nullptr, "ConnectUsbPadsAsync"}, + FunctionInfo{223, nullptr, "DisconnectUsbPadsAsync"}, + FunctionInfo{224, nullptr, "UpdateDesignInfo"}, + FunctionInfo{225, nullptr, "GetUniquePadDriverState"}, + FunctionInfo{226, nullptr, "GetSixAxisSensorDriverStates"}, + FunctionInfo{227, nullptr, "GetRxPacketHistory"}, + FunctionInfo{228, nullptr, "AcquireOperationEventHandle"}, + FunctionInfo{229, nullptr, "ReadSerialFlash"}, + FunctionInfo{230, nullptr, "WriteSerialFlash"}, + FunctionInfo{231, nullptr, "GetOperationResult"}, + FunctionInfo{232, nullptr, "EnableShipmentMode"}, + FunctionInfo{233, nullptr, "ClearPairingInfo"}, + FunctionInfo{234, nullptr, "GetUniquePadDeviceTypeSetInternal"}, + FunctionInfo{235, nullptr, "EnableAnalogStickPower"}, + FunctionInfo{236, nullptr, "RequestKuinaUartClockCal"}, + FunctionInfo{237, nullptr, "GetKuinaUartClockCal"}, + FunctionInfo{238, nullptr, "SetKuinaUartClockTrim"}, + FunctionInfo{239, nullptr, "KuinaLoopbackTest"}, + FunctionInfo{240, nullptr, "RequestBatteryVoltage"}, + FunctionInfo{241, nullptr, "GetBatteryVoltage"}, + FunctionInfo{242, nullptr, "GetUniquePadPowerInfo"}, + FunctionInfo{243, nullptr, "RebootUniquePad"}, + FunctionInfo{244, nullptr, "RequestKuinaFirmwareVersion"}, + FunctionInfo{245, nullptr, "GetKuinaFirmwareVersion"}, + FunctionInfo{246, nullptr, "GetVidPid"}, + FunctionInfo{247, nullptr, "GetAnalogStickCalibrationValue"}, + FunctionInfo{248, nullptr, "GetUniquePadIdsFull"}, + FunctionInfo{249, nullptr, "ConnectUniquePad"}, + FunctionInfo{250, nullptr, "IsVirtual"}, + FunctionInfo{251, nullptr, "GetAnalogStickModuleParam"}, + FunctionInfo{253, nullptr, "ClearStorageForShipment", MakeVersionGate({19,0,0})}, + FunctionInfo{261, nullptr, "UpdateDesignInfo12", MakeVersionGate({21,0,0})}, + FunctionInfo{262, nullptr, "GetUniquePadButtonCount", MakeVersionGate({21,0,0})}, + FunctionInfo{267, nullptr, "SetAnalogStickCalibration", MakeVersionGate({21,0,0})}, + FunctionInfo{268, nullptr, "ResetAnalogStickCalibration", MakeVersionGate({21,0,0})}, + FunctionInfo{301, nullptr, "GetAbstractedPadHandles"}, + FunctionInfo{302, nullptr, "GetAbstractedPadState"}, + FunctionInfo{303, nullptr, "GetAbstractedPadsState"}, + FunctionInfo{321, nullptr, "SetAutoPilotVirtualPadState"}, + FunctionInfo{322, nullptr, "UnsetAutoPilotVirtualPadState"}, + FunctionInfo{323, nullptr, "UnsetAllAutoPilotVirtualPadState"}, + FunctionInfo{324, nullptr, "AttachHdlsWorkBuffer"}, + FunctionInfo{325, nullptr, "ReleaseHdlsWorkBuffer"}, + FunctionInfo{326, nullptr, "DumpHdlsNpadAssignmentState"}, + FunctionInfo{327, nullptr, "DumpHdlsStates"}, + FunctionInfo{328, nullptr, "ApplyHdlsNpadAssignmentState"}, + FunctionInfo{329, nullptr, "ApplyHdlsStateList"}, + FunctionInfo{330, nullptr, "AttachHdlsVirtualDevice"}, + FunctionInfo{331, nullptr, "DetachHdlsVirtualDevice"}, + FunctionInfo{332, nullptr, "SetHdlsState"}, + FunctionInfo{350, nullptr, "AddRegisteredDevice"}, + FunctionInfo{351, nullptr, "GetRegisteredDevicesCountDebug", MakeVersionGate({17,0,0}, {18,1,0})}, + FunctionInfo{352, nullptr, "DeleteRegisteredDevicesDebug", MakeVersionGate({17,0,0}, {18,1,0})}, + FunctionInfo{400, nullptr, "DisableExternalMcuOnNxDevice"}, + FunctionInfo{401, nullptr, "DisableRailDeviceFiltering"}, + FunctionInfo{402, nullptr, "EnableWiredPairing"}, + FunctionInfo{403, nullptr, "EnableShipmentModeAutoClear"}, + FunctionInfo{404, nullptr, "SetRailEnabled"}, + FunctionInfo{500, nullptr, "SetFactoryInt"}, + FunctionInfo{501, nullptr, "IsFactoryBootEnabled"}, + FunctionInfo{550, nullptr, "SetAnalogStickModelDataTemporarily"}, + FunctionInfo{551, nullptr, "GetAnalogStickModelData"}, + FunctionInfo{552, nullptr, "ResetAnalogStickModelData"}, + FunctionInfo{600, nullptr, "ConvertPadState"}, + FunctionInfo{601, nullptr, "IsButtonConfigSupported", MakeVersionGate({18,0,0})}, + FunctionInfo{602, nullptr, "IsButtonConfigEmbeddedSupported", MakeVersionGate({18,0,0})}, + FunctionInfo{603, nullptr, "DeleteButtonConfig", MakeVersionGate({18,0,0})}, + FunctionInfo{604, nullptr, "DeleteButtonConfigEmbedded", MakeVersionGate({18,0,0})}, + FunctionInfo{605, nullptr, "SetButtonConfigEnabled", MakeVersionGate({18,0,0})}, + FunctionInfo{606, nullptr, "SetButtonConfigEmbeddedEnabled", MakeVersionGate({18,0,0})}, + FunctionInfo{607, nullptr, "IsButtonConfigEnabled", MakeVersionGate({18,0,0})}, + FunctionInfo{608, nullptr, "IsButtonConfigEmbeddedEnabled", MakeVersionGate({18,0,0})}, + FunctionInfo{609, nullptr, "SetButtonConfigEmbedded", MakeVersionGate({18,0,0})}, + FunctionInfo{610, nullptr, "SetButtonConfigFull", MakeVersionGate({18,0,0})}, + FunctionInfo{611, nullptr, "SetButtonConfigLeft", MakeVersionGate({18,0,0})}, + FunctionInfo{612, nullptr, "SetButtonConfigRight", MakeVersionGate({18,0,0})}, + FunctionInfo{613, nullptr, "GetButtonConfigEmbedded", MakeVersionGate({18,0,0})}, + FunctionInfo{614, nullptr, "GetButtonConfigFull", MakeVersionGate({18,0,0})}, + FunctionInfo{615, nullptr, "GetButtonConfigLeft", MakeVersionGate({18,0,0})}, + FunctionInfo{616, nullptr, "GetButtonConfigRight", MakeVersionGate({18,0,0})}, + FunctionInfo{650, nullptr, "AddButtonPlayData"}, + FunctionInfo{651, nullptr, "StartButtonPlayData"}, + FunctionInfo{652, nullptr, "StopButtonPlayData"}, + FunctionInfo{700, nullptr, "GetRailAttachEventCount", MakeVersionGate({21,0,0})}, + FunctionInfo{2000, nullptr, "DeactivateDigitizer"}, + FunctionInfo{2001, nullptr, "SetDigitizerAutoPilotState"}, + FunctionInfo{2002, nullptr, "UnsetDigitizerAutoPilotState"}, + FunctionInfo{3000, nullptr, "ReloadFirmwareDebugSettings"} + ); + std::shared_ptr resource_manager; + std::shared_ptr firmware_settings; +}; + void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); auto firmware_settings = std::make_shared(system); diff --git a/src/core/hle/service/hid/hid_debug_server.cpp b/src/core/hle/service/hid/hid_debug_server.cpp index 43fe0f3a19..091d09dae5 100644 --- a/src/core/hle/service/hid/hid_debug_server.cpp +++ b/src/core/hle/service/hid/hid_debug_server.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project @@ -18,298 +18,4 @@ namespace Service::HID { -IHidDebugServer::IHidDebugServer(Core::System& system_, std::shared_ptr resource, - std::shared_ptr settings) - : ServiceFramework{system_, "hid:dbg"}, resource_manager{resource}, firmware_settings{ - settings} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "DeactivateDebugPad"}, - {1, nullptr, "SetDebugPadAutoPilotState"}, - {2, nullptr, "UnsetDebugPadAutoPilotState"}, - {10, C<&IHidDebugServer::DeactivateTouchScreen>, "DeactivateTouchScreen"}, - {11, C<&IHidDebugServer::SetTouchScreenAutoPilotState>, "SetTouchScreenAutoPilotState"}, - {12, C<&IHidDebugServer::UnsetTouchScreenAutoPilotState>, "UnsetTouchScreenAutoPilotState"}, - {13, C<&IHidDebugServer::GetTouchScreenConfiguration>, "GetTouchScreenConfiguration"}, - {14, C<&IHidDebugServer::ProcessTouchScreenAutoTune>, "ProcessTouchScreenAutoTune"}, - {15, C<&IHidDebugServer::ForceStopTouchScreenManagement>, "ForceStopTouchScreenManagement"}, - {16, C<&IHidDebugServer::ForceRestartTouchScreenManagement>, "ForceRestartTouchScreenManagement"}, - {17, C<&IHidDebugServer::IsTouchScreenManaged>, "IsTouchScreenManaged"}, - {20, nullptr, "DeactivateMouse"}, - {21, nullptr, "SetMouseAutoPilotState"}, - {22, nullptr, "UnsetMouseAutoPilotState"}, - {23, nullptr, "AddMouseSideWheelDelta"}, - {25, nullptr, "SetDebugMouseAutoPilotState"}, - {26, nullptr, "UnsetDebugMouseAutoPilotState"}, - {30, nullptr, "DeactivateKeyboard"}, - {31, nullptr, "SetKeyboardAutoPilotState"}, - {32, nullptr, "UnsetKeyboardAutoPilotState"}, - {50, nullptr, "DeactivateXpad"}, - {51, nullptr, "SetXpadAutoPilotState"}, - {52, nullptr, "UnsetXpadAutoPilotState"}, - {53, nullptr, "DeactivateJoyXpad"}, - {60, nullptr, "ClearNpadSystemCommonPolicy"}, - {61, nullptr, "DeactivateNpad"}, - {62, nullptr, "ForceDisconnectNpad"}, - {91, C<&IHidDebugServer::DeactivateGesture>, "DeactivateGesture"}, - {110, nullptr, "DeactivateHomeButton"}, - {111, nullptr, "SetHomeButtonAutoPilotState"}, - {112, nullptr, "UnsetHomeButtonAutoPilotState"}, - {120, nullptr, "DeactivateSleepButton"}, - {121, nullptr, "SetSleepButtonAutoPilotState"}, - {122, nullptr, "UnsetSleepButtonAutoPilotState"}, - {123, nullptr, "DeactivateInputDetector"}, - {130, nullptr, "DeactivateCaptureButton"}, - {131, nullptr, "SetCaptureButtonAutoPilotState"}, - {132, nullptr, "UnsetCaptureButtonAutoPilotState"}, - {133, nullptr, "SetShiftAccelerometerCalibrationValue"}, - {134, nullptr, "GetShiftAccelerometerCalibrationValue"}, - {135, nullptr, "SetShiftGyroscopeCalibrationValue"}, - {136, nullptr, "GetShiftGyroscopeCalibrationValue"}, - {140, nullptr, "DeactivateConsoleSixAxisSensor"}, - {141, nullptr, "GetConsoleSixAxisSensorSamplingFrequency"}, - {142, nullptr, "DeactivateSevenSixAxisSensor"}, - {143, nullptr, "GetConsoleSixAxisSensorCountStates"}, - {144, nullptr, "GetAccelerometerFsr"}, - {145, nullptr, "SetAccelerometerFsr"}, - {146, nullptr, "GetAccelerometerOdr"}, - {147, nullptr, "SetAccelerometerOdr"}, - {148, nullptr, "GetGyroscopeFsr"}, - {149, nullptr, "SetGyroscopeFsr"}, - {150, nullptr, "GetGyroscopeOdr"}, - {151, nullptr, "SetGyroscopeOdr"}, - {152, nullptr, "GetWhoAmI"}, - {201, nullptr, "ActivateFirmwareUpdate"}, - {202, nullptr, "DeactivateFirmwareUpdate"}, - {203, nullptr, "StartFirmwareUpdate"}, - {204, nullptr, "GetFirmwareUpdateStage"}, - {205, nullptr, "GetFirmwareVersion"}, - {206, nullptr, "GetDestinationFirmwareVersion"}, - {207, nullptr, "DiscardFirmwareInfoCacheForRevert"}, - {208, nullptr, "StartFirmwareUpdateForRevert"}, - {209, nullptr, "GetAvailableFirmwareVersionForRevert"}, - {210, nullptr, "IsFirmwareUpdatingDevice"}, - {211, nullptr, "StartFirmwareUpdateIndividual"}, - {212, nullptr, "GetDetailFirmwareVersion"}, // 19.0.0+ - {215, nullptr, "SetUsbFirmwareForceUpdateEnabled"}, - {216, nullptr, "SetAllKuinaDevicesToFirmwareUpdateMode"}, - {221, nullptr, "UpdateControllerColor"}, - {222, nullptr, "ConnectUsbPadsAsync"}, - {223, nullptr, "DisconnectUsbPadsAsync"}, - {224, nullptr, "UpdateDesignInfo"}, - {225, nullptr, "GetUniquePadDriverState"}, - {226, nullptr, "GetSixAxisSensorDriverStates"}, - {227, nullptr, "GetRxPacketHistory"}, - {228, nullptr, "AcquireOperationEventHandle"}, - {229, nullptr, "ReadSerialFlash"}, - {230, nullptr, "WriteSerialFlash"}, - {231, nullptr, "GetOperationResult"}, - {232, nullptr, "EnableShipmentMode"}, - {233, nullptr, "ClearPairingInfo"}, - {234, nullptr, "GetUniquePadDeviceTypeSetInternal"}, - {235, nullptr, "EnableAnalogStickPower"}, - {236, nullptr, "RequestKuinaUartClockCal"}, - {237, nullptr, "GetKuinaUartClockCal"}, - {238, nullptr, "SetKuinaUartClockTrim"}, - {239, nullptr, "KuinaLoopbackTest"}, - {240, nullptr, "RequestBatteryVoltage"}, - {241, nullptr, "GetBatteryVoltage"}, - {242, nullptr, "GetUniquePadPowerInfo"}, - {243, nullptr, "RebootUniquePad"}, - {244, nullptr, "RequestKuinaFirmwareVersion"}, - {245, nullptr, "GetKuinaFirmwareVersion"}, - {246, nullptr, "GetVidPid"}, - {247, nullptr, "GetAnalogStickCalibrationValue"}, - {248, nullptr, "GetUniquePadIdsFull"}, - {249, nullptr, "ConnectUniquePad"}, - {250, nullptr, "IsVirtual"}, - {251, nullptr, "GetAnalogStickModuleParam"}, - {253, nullptr, "ClearStorageForShipment"}, //19.0.0+ - {261, nullptr, "UpdateDesignInfo12"}, //21.0.0+ - {262, nullptr, "GetUniquePadButtonCount"}, //21.0.0+ - {267, nullptr, "SetAnalogStickCalibration"}, //21.0.0+ - {268, nullptr, "ResetAnalogStickCalibration"}, //21.0.0+ - {301, nullptr, "GetAbstractedPadHandles"}, - {302, nullptr, "GetAbstractedPadState"}, - {303, nullptr, "GetAbstractedPadsState"}, - {321, nullptr, "SetAutoPilotVirtualPadState"}, - {322, nullptr, "UnsetAutoPilotVirtualPadState"}, - {323, nullptr, "UnsetAllAutoPilotVirtualPadState"}, - {324, nullptr, "AttachHdlsWorkBuffer"}, - {325, nullptr, "ReleaseHdlsWorkBuffer"}, - {326, nullptr, "DumpHdlsNpadAssignmentState"}, - {327, nullptr, "DumpHdlsStates"}, - {328, nullptr, "ApplyHdlsNpadAssignmentState"}, - {329, nullptr, "ApplyHdlsStateList"}, - {330, nullptr, "AttachHdlsVirtualDevice"}, - {331, nullptr, "DetachHdlsVirtualDevice"}, - {332, nullptr, "SetHdlsState"}, - {350, nullptr, "AddRegisteredDevice"}, - {351, nullptr, "GetRegisteredDevicesCountDebug"}, //17.0.0-18.1.0 - {352, nullptr, "DeleteRegisteredDevicesDebug"}, //17.0.0-18.1.0 - {400, nullptr, "DisableExternalMcuOnNxDevice"}, - {401, nullptr, "DisableRailDeviceFiltering"}, - {402, nullptr, "EnableWiredPairing"}, - {403, nullptr, "EnableShipmentModeAutoClear"}, - {404, nullptr, "SetRailEnabled"}, - {500, nullptr, "SetFactoryInt"}, - {501, nullptr, "IsFactoryBootEnabled"}, - {550, nullptr, "SetAnalogStickModelDataTemporarily"}, - {551, nullptr, "GetAnalogStickModelData"}, - {552, nullptr, "ResetAnalogStickModelData"}, - {600, nullptr, "ConvertPadState"}, - {601, nullptr, "IsButtonConfigSupported"}, //18.0.0+ - {602, nullptr, "IsButtonConfigEmbeddedSupported"}, //18.0.0+ - {603, nullptr, "DeleteButtonConfig"}, //18.0.0+ - {604, nullptr, "DeleteButtonConfigEmbedded"}, //18.0.0+ - {605, nullptr, "SetButtonConfigEnabled"}, //18.0.0+ - {606, nullptr, "SetButtonConfigEmbeddedEnabled"}, //18.0.0+ - {607, nullptr, "IsButtonConfigEnabled"}, //18.0.0+ - {608, nullptr, "IsButtonConfigEmbeddedEnabled"}, //18.0.0+ - {609, nullptr, "SetButtonConfigEmbedded"}, //18.0.0+ - {610, nullptr, "SetButtonConfigFull"}, //18.0.0+ - {611, nullptr, "SetButtonConfigLeft"}, //18.0.0+ - {612, nullptr, "SetButtonConfigRight"}, //18.0.0+ - {613, nullptr, "GetButtonConfigEmbedded"}, //18.0.0+ - {614, nullptr, "GetButtonConfigFull"}, //18.0.0+ - {615, nullptr, "GetButtonConfigLeft"}, //18.0.0+ - {616, nullptr, "GetButtonConfigRight"}, //18.0.0+ - {650, nullptr, "AddButtonPlayData"}, - {651, nullptr, "StartButtonPlayData"}, - {652, nullptr, "StopButtonPlayData"}, - {700, nullptr, "GetRailAttachEventCount"}, //21.0.0+ - {2000, nullptr, "DeactivateDigitizer"}, - {2001, nullptr, "SetDigitizerAutoPilotState"}, - {2002, nullptr, "UnsetDigitizerAutoPilotState"}, - {3000, nullptr, "ReloadFirmwareDebugSettings"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - -IHidDebugServer::~IHidDebugServer() = default; - -Result IHidDebugServer::DeactivateTouchScreen() { - LOG_INFO(Service_HID, "called"); - - if (!firmware_settings->IsDeviceManaged()) { - R_RETURN(GetResourceManager()->GetTouchScreen()->Deactivate()); - } - - R_SUCCEED(); -} - -Result IHidDebugServer::SetTouchScreenAutoPilotState( - InArray auto_pilot_buffer) { - AutoPilotState auto_pilot{}; - - auto_pilot.count = - static_cast((std::min)(auto_pilot_buffer.size(), auto_pilot.state.size())); - memcpy(auto_pilot.state.data(), auto_pilot_buffer.data(), - auto_pilot.count * sizeof(TouchState)); - - LOG_INFO(Service_HID, "called, auto_pilot_count={}", auto_pilot.count); - - R_RETURN(GetResourceManager()->GetTouchScreen()->SetTouchScreenAutoPilotState(auto_pilot)); -} - -Result IHidDebugServer::UnsetTouchScreenAutoPilotState() { - LOG_INFO(Service_HID, "called"); - R_RETURN(GetResourceManager()->GetTouchScreen()->UnsetTouchScreenAutoPilotState()); -} - -Result IHidDebugServer::GetTouchScreenConfiguration( - Out out_touchscreen_config, - ClientAppletResourceUserId aruid) { - LOG_INFO(Service_HID, "called, applet_resource_user_id={}", aruid.pid); - - R_TRY(GetResourceManager()->GetTouchScreen()->GetTouchScreenConfiguration( - *out_touchscreen_config, aruid.pid)); - - if (out_touchscreen_config->mode != Core::HID::TouchScreenModeForNx::Heat2 && - out_touchscreen_config->mode != Core::HID::TouchScreenModeForNx::Finger) { - out_touchscreen_config->mode = Core::HID::TouchScreenModeForNx::UseSystemSetting; - } - - R_SUCCEED(); -} - -Result IHidDebugServer::ProcessTouchScreenAutoTune() { - LOG_INFO(Service_HID, "called"); - R_RETURN(GetResourceManager()->GetTouchScreen()->ProcessTouchScreenAutoTune()); -} - -Result IHidDebugServer::ForceStopTouchScreenManagement() { - LOG_INFO(Service_HID, "called"); - - if (!firmware_settings->IsDeviceManaged()) { - R_SUCCEED(); - } - - auto touch_screen = GetResourceManager()->GetTouchScreen(); - auto gesture = GetResourceManager()->GetGesture(); - - if (firmware_settings->IsTouchI2cManaged()) { - bool is_touch_active{}; - bool is_gesture_active{}; - R_TRY(touch_screen->IsActive(is_touch_active)); - R_TRY(gesture->IsActive(is_gesture_active)); - - if (is_touch_active) { - R_TRY(touch_screen->Deactivate()); - } - if (is_gesture_active) { - R_TRY(gesture->Deactivate()); - } - } - - R_SUCCEED(); -} - -Result IHidDebugServer::ForceRestartTouchScreenManagement(u32 basic_gesture_id, - ClientAppletResourceUserId aruid) { - LOG_INFO(Service_HID, "called, basic_gesture_id={}, applet_resource_user_id={}", - basic_gesture_id, aruid.pid); - - auto touch_screen = GetResourceManager()->GetTouchScreen(); - auto gesture = GetResourceManager()->GetGesture(); - - if (firmware_settings->IsDeviceManaged() && firmware_settings->IsTouchI2cManaged()) { - R_TRY(gesture->Activate()); - R_TRY(gesture->Activate(aruid.pid, basic_gesture_id)); - R_TRY(touch_screen->Activate()); - R_TRY(touch_screen->Activate(aruid.pid)); - } - - R_SUCCEED(); -} - -Result IHidDebugServer::IsTouchScreenManaged(Out out_is_managed) { - LOG_INFO(Service_HID, "called"); - - bool is_touch_active{}; - bool is_gesture_active{}; - R_TRY(GetResourceManager()->GetTouchScreen()->IsActive(is_touch_active)); - R_TRY(GetResourceManager()->GetGesture()->IsActive(is_gesture_active)); - - *out_is_managed = is_touch_active || is_gesture_active; - R_SUCCEED(); -} - -Result IHidDebugServer::DeactivateGesture() { - LOG_INFO(Service_HID, "called"); - - if (!firmware_settings->IsDeviceManaged()) { - R_RETURN(GetResourceManager()->GetGesture()->Deactivate()); - } - - R_SUCCEED(); -} - -std::shared_ptr IHidDebugServer::GetResourceManager() { - resource_manager->Initialize(); - return resource_manager; -} - } // namespace Service::HID diff --git a/src/core/hle/service/hid/hid_debug_server.h b/src/core/hle/service/hid/hid_debug_server.h index 3a483f07e5..20cc1ed541 100644 --- a/src/core/hle/service/hid/hid_debug_server.h +++ b/src/core/hle/service/hid/hid_debug_server.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -15,31 +18,5 @@ namespace Service::HID { class ResourceManager; class HidFirmwareSettings; -class IHidDebugServer final : public ServiceFramework { -public: - explicit IHidDebugServer(Core::System& system_, std::shared_ptr resource, - std::shared_ptr settings); - ~IHidDebugServer() override; - -private: - Result DeactivateTouchScreen(); - Result SetTouchScreenAutoPilotState( - InArray auto_pilot_buffer); - Result UnsetTouchScreenAutoPilotState(); - Result GetTouchScreenConfiguration( - Out out_touchscreen_config, - ClientAppletResourceUserId aruid); - Result ProcessTouchScreenAutoTune(); - Result ForceStopTouchScreenManagement(); - Result ForceRestartTouchScreenManagement(u32 basic_gesture_id, - ClientAppletResourceUserId aruid); - Result IsTouchScreenManaged(Out out_is_managed); - Result DeactivateGesture(); - - std::shared_ptr GetResourceManager(); - - std::shared_ptr resource_manager; - std::shared_ptr firmware_settings; -}; } // namespace Service::HID diff --git a/src/core/hle/service/hid/hid_server.cpp b/src/core/hle/service/hid/hid_server.cpp index 9689bce8dd..18e57628d0 100644 --- a/src/core/hle/service/hid/hid_server.cpp +++ b/src/core/hle/service/hid/hid_server.cpp @@ -42,207 +42,207 @@ namespace Service::HID { +std::optional IHidServer::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, C<&IHidServer::CreateAppletResource>, "CreateAppletResource"}, + FunctionInfo{1, C<&IHidServer::ActivateDebugPad>, "ActivateDebugPad"}, + FunctionInfo{11, C<&IHidServer::ActivateTouchScreen>, "ActivateTouchScreen"}, + FunctionInfo{21, C<&IHidServer::ActivateMouse>, "ActivateMouse"}, + FunctionInfo{26, C<&IHidServer::ActivateDebugMouse>, "ActivateDebugMouse"}, + FunctionInfo{31, C<&IHidServer::ActivateKeyboard>, "ActivateKeyboard"}, + FunctionInfo{32, C<&IHidServer::SendKeyboardLockKeyEvent>, "SendKeyboardLockKeyEvent"}, + FunctionInfo{40, C<&IHidServer::AcquireXpadIdEventHandle>, "AcquireXpadIdEventHandle"}, + FunctionInfo{41, C<&IHidServer::ReleaseXpadIdEventHandle>, "ReleaseXpadIdEventHandle"}, + FunctionInfo{51, C<&IHidServer::ActivateXpad>, "ActivateXpad"}, + FunctionInfo{55, C<&IHidServer::GetXpadIds>, "GetXpadIds"}, + FunctionInfo{56, C<&IHidServer::ActivateJoyXpad>, "ActivateJoyXpad"}, + FunctionInfo{58, C<&IHidServer::GetJoyXpadLifoHandle>, "GetJoyXpadLifoHandle"}, + FunctionInfo{59, C<&IHidServer::GetJoyXpadIds>, "GetJoyXpadIds"}, + FunctionInfo{60, C<&IHidServer::ActivateSixAxisSensor>, "ActivateSixAxisSensor"}, + FunctionInfo{61, C<&IHidServer::DeactivateSixAxisSensor>, "DeactivateSixAxisSensor"}, + FunctionInfo{62, C<&IHidServer::GetSixAxisSensorLifoHandle>, "GetSixAxisSensorLifoHandle"}, + FunctionInfo{63, C<&IHidServer::ActivateJoySixAxisSensor>, "ActivateJoySixAxisSensor"}, + FunctionInfo{64, C<&IHidServer::DeactivateJoySixAxisSensor>, "DeactivateJoySixAxisSensor"}, + FunctionInfo{65, C<&IHidServer::GetJoySixAxisSensorLifoHandle>, "GetJoySixAxisSensorLifoHandle"}, + FunctionInfo{66, C<&IHidServer::StartSixAxisSensor>, "StartSixAxisSensor"}, + FunctionInfo{67, C<&IHidServer::StopSixAxisSensor>, "StopSixAxisSensor"}, + FunctionInfo{68, C<&IHidServer::IsSixAxisSensorFusionEnabled>, "IsSixAxisSensorFusionEnabled"}, + FunctionInfo{69, C<&IHidServer::EnableSixAxisSensorFusion>, "EnableSixAxisSensorFusion"}, + FunctionInfo{70, C<&IHidServer::SetSixAxisSensorFusionParameters>, "SetSixAxisSensorFusionParameters"}, + FunctionInfo{71, C<&IHidServer::GetSixAxisSensorFusionParameters>, "GetSixAxisSensorFusionParameters"}, + FunctionInfo{72, C<&IHidServer::ResetSixAxisSensorFusionParameters>, "ResetSixAxisSensorFusionParameters"}, + FunctionInfo{73, nullptr, "SetAccelerometerParameters"}, + FunctionInfo{74, nullptr, "GetAccelerometerParameters"}, + FunctionInfo{75, nullptr, "ResetAccelerometerParameters"}, + FunctionInfo{76, nullptr, "SetAccelerometerPlayMode"}, + FunctionInfo{77, nullptr, "GetAccelerometerPlayMode"}, + FunctionInfo{78, nullptr, "ResetAccelerometerPlayMode"}, + FunctionInfo{79, C<&IHidServer::SetGyroscopeZeroDriftMode>, "SetGyroscopeZeroDriftMode"}, + FunctionInfo{80, C<&IHidServer::GetGyroscopeZeroDriftMode>, "GetGyroscopeZeroDriftMode"}, + FunctionInfo{81, C<&IHidServer::ResetGyroscopeZeroDriftMode>, "ResetGyroscopeZeroDriftMode"}, + FunctionInfo{82, C<&IHidServer::IsSixAxisSensorAtRest>, "IsSixAxisSensorAtRest"}, + FunctionInfo{83, C<&IHidServer::IsFirmwareUpdateAvailableForSixAxisSensor>, "IsFirmwareUpdateAvailableForSixAxisSensor"}, + FunctionInfo{84, C<&IHidServer::EnableSixAxisSensorUnalteredPassthrough>, "EnableSixAxisSensorUnalteredPassthrough"}, + FunctionInfo{85, C<&IHidServer::IsSixAxisSensorUnalteredPassthroughEnabled>, "IsSixAxisSensorUnalteredPassthroughEnabled"}, + FunctionInfo{86, nullptr, "StoreSixAxisSensorCalibrationParameter"}, + FunctionInfo{87, C<&IHidServer::LoadSixAxisSensorCalibrationParameter>, "LoadSixAxisSensorCalibrationParameter"}, + FunctionInfo{88, C<&IHidServer::GetSixAxisSensorIcInformation>, "GetSixAxisSensorIcInformation"}, + FunctionInfo{89, C<&IHidServer::ResetIsSixAxisSensorDeviceNewlyAssigned>, "ResetIsSixAxisSensorDeviceNewlyAssigned"}, + FunctionInfo{91, C<&IHidServer::ActivateGesture>, "ActivateGesture"}, + FunctionInfo{92, C<&IHidServer::SetGestureOutputRanges>, "SetGestureOutputRanges"}, + FunctionInfo{100, C<&IHidServer::SetSupportedNpadStyleSet>, "SetSupportedNpadStyleSet"}, + FunctionInfo{101, C<&IHidServer::GetSupportedNpadStyleSet>, "GetSupportedNpadStyleSet"}, + FunctionInfo{102, C<&IHidServer::SetSupportedNpadIdType>, "SetSupportedNpadIdType"}, + FunctionInfo{103, C<&IHidServer::ActivateNpad>, "ActivateNpad"}, + FunctionInfo{104, C<&IHidServer::DeactivateNpad>, "DeactivateNpad"}, + FunctionInfo{106, C<&IHidServer::AcquireNpadStyleSetUpdateEventHandle>, "AcquireNpadStyleSetUpdateEventHandle"}, + FunctionInfo{107, C<&IHidServer::DisconnectNpad>, "DisconnectNpad"}, + FunctionInfo{108, C<&IHidServer::GetPlayerLedPattern>, "GetPlayerLedPattern"}, + FunctionInfo{109, C<&IHidServer::ActivateNpadWithRevision>, "ActivateNpadWithRevision"}, + FunctionInfo{120, C<&IHidServer::SetNpadJoyHoldType>, "SetNpadJoyHoldType"}, + FunctionInfo{121, C<&IHidServer::GetNpadJoyHoldType>, "GetNpadJoyHoldType"}, + FunctionInfo{122, C<&IHidServer::SetNpadJoyAssignmentModeSingleByDefault>, "SetNpadJoyAssignmentModeSingleByDefault"}, + FunctionInfo{123, C<&IHidServer::SetNpadJoyAssignmentModeSingle>, "SetNpadJoyAssignmentModeSingle"}, + FunctionInfo{124, C<&IHidServer::SetNpadJoyAssignmentModeDual>, "SetNpadJoyAssignmentModeDual"}, + FunctionInfo{125, C<&IHidServer::MergeSingleJoyAsDualJoy>, "MergeSingleJoyAsDualJoy"}, + FunctionInfo{126, C<&IHidServer::StartLrAssignmentMode>, "StartLrAssignmentMode"}, + FunctionInfo{127, C<&IHidServer::StopLrAssignmentMode>, "StopLrAssignmentMode"}, + FunctionInfo{128, C<&IHidServer::SetNpadHandheldActivationMode>, "SetNpadHandheldActivationMode"}, + FunctionInfo{129, C<&IHidServer::GetNpadHandheldActivationMode>, "GetNpadHandheldActivationMode"}, + FunctionInfo{130, C<&IHidServer::SwapNpadAssignment>, "SwapNpadAssignment"}, + FunctionInfo{131, C<&IHidServer::IsUnintendedHomeButtonInputProtectionEnabled>, "IsUnintendedHomeButtonInputProtectionEnabled"}, + FunctionInfo{132, C<&IHidServer::EnableUnintendedHomeButtonInputProtection>, "EnableUnintendedHomeButtonInputProtection"}, + FunctionInfo{133, C<&IHidServer::SetNpadJoyAssignmentModeSingleWithDestination>, "SetNpadJoyAssignmentModeSingleWithDestination"}, + FunctionInfo{134, C<&IHidServer::SetNpadAnalogStickUseCenterClamp>, "SetNpadAnalogStickUseCenterClamp"}, + FunctionInfo{135, C<&IHidServer::SetNpadCaptureButtonAssignment>, "SetNpadCaptureButtonAssignment"}, + FunctionInfo{136, C<&IHidServer::ClearNpadCaptureButtonAssignment>, "ClearNpadCaptureButtonAssignment"}, + FunctionInfo{200, C<&IHidServer::GetVibrationDeviceInfo>, "GetVibrationDeviceInfo"}, + FunctionInfo{201, C<&IHidServer::SendVibrationValue>, "SendVibrationValue"}, + FunctionInfo{202, C<&IHidServer::GetActualVibrationValue>, "GetActualVibrationValue"}, + FunctionInfo{203, C<&IHidServer::CreateActiveVibrationDeviceList>, "CreateActiveVibrationDeviceList"}, + FunctionInfo{204, C<&IHidServer::PermitVibration>, "PermitVibration"}, + FunctionInfo{205, C<&IHidServer::IsVibrationPermitted>, "IsVibrationPermitted"}, + FunctionInfo{206, C<&IHidServer::SendVibrationValues>, "SendVibrationValues"}, + FunctionInfo{207, C<&IHidServer::SendVibrationGcErmCommand>, "SendVibrationGcErmCommand"}, + FunctionInfo{208, C<&IHidServer::GetActualVibrationGcErmCommand>, "GetActualVibrationGcErmCommand"}, + FunctionInfo{209, C<&IHidServer::BeginPermitVibrationSession>, "BeginPermitVibrationSession"}, + FunctionInfo{210, C<&IHidServer::EndPermitVibrationSession>, "EndPermitVibrationSession"}, + FunctionInfo{211, C<&IHidServer::IsVibrationDeviceMounted>, "IsVibrationDeviceMounted"}, + FunctionInfo{212, C<&IHidServer::SendVibrationValueInBool>, "SendVibrationValueInBool"}, + FunctionInfo{300, C<&IHidServer::ActivateConsoleSixAxisSensor>, "ActivateConsoleSixAxisSensor"}, + FunctionInfo{301, C<&IHidServer::StartConsoleSixAxisSensor>, "StartConsoleSixAxisSensor"}, + FunctionInfo{302, C<&IHidServer::StopConsoleSixAxisSensor>, "StopConsoleSixAxisSensor"}, + FunctionInfo{303, C<&IHidServer::ActivateSevenSixAxisSensor>, "ActivateSevenSixAxisSensor"}, + FunctionInfo{304, C<&IHidServer::StartSevenSixAxisSensor>, "StartSevenSixAxisSensor"}, + FunctionInfo{305, C<&IHidServer::StopSevenSixAxisSensor>, "StopSevenSixAxisSensor"}, + FunctionInfo{306, C<&IHidServer::InitializeSevenSixAxisSensor>, "InitializeSevenSixAxisSensor"}, + FunctionInfo{307, C<&IHidServer::FinalizeSevenSixAxisSensor>, "FinalizeSevenSixAxisSensor"}, + FunctionInfo{308, nullptr, "SetSevenSixAxisSensorFusionStrength"}, + FunctionInfo{309, nullptr, "GetSevenSixAxisSensorFusionStrength"}, + FunctionInfo{310, C<&IHidServer::ResetSevenSixAxisSensorTimestamp>, "ResetSevenSixAxisSensorTimestamp"}, + FunctionInfo{320, nullptr, "EnableNpadImu", MakeVersionGate({21,0,0})}, + FunctionInfo{321, nullptr, "DisableNpadImu", MakeVersionGate({21,0,0})}, + FunctionInfo{400, C<&IHidServer::IsUsbFullKeyControllerEnabled>, "IsUsbFullKeyControllerEnabled"}, + FunctionInfo{401, nullptr, "EnableUsbFullKeyController"}, + FunctionInfo{402, nullptr, "IsUsbFullKeyControllerConnected"}, + FunctionInfo{403, nullptr, "HasBattery"}, + FunctionInfo{404, nullptr, "HasLeftRightBattery"}, + FunctionInfo{405, nullptr, "GetNpadInterfaceType"}, + FunctionInfo{406, nullptr, "GetNpadLeftRightInterfaceType"}, + FunctionInfo{407, nullptr, "GetNpadOfHighestBatteryLevel"}, + FunctionInfo{408, nullptr, "GetNpadOfHighestBatteryLevelForJoyRight"}, + FunctionInfo{500, C<&IHidServer::GetPalmaConnectionHandle>, "GetPalmaConnectionHandle"}, + FunctionInfo{501, C<&IHidServer::InitializePalma>, "InitializePalma"}, + FunctionInfo{502, C<&IHidServer::AcquirePalmaOperationCompleteEvent>, "AcquirePalmaOperationCompleteEvent"}, + FunctionInfo{503, C<&IHidServer::GetPalmaOperationInfo>, "GetPalmaOperationInfo"}, + FunctionInfo{504, C<&IHidServer::PlayPalmaActivity>, "PlayPalmaActivity"}, + FunctionInfo{505, C<&IHidServer::SetPalmaFrModeType>, "SetPalmaFrModeType"}, + FunctionInfo{506, C<&IHidServer::ReadPalmaStep>, "ReadPalmaStep"}, + FunctionInfo{507, C<&IHidServer::EnablePalmaStep>, "EnablePalmaStep"}, + FunctionInfo{508, C<&IHidServer::ResetPalmaStep>, "ResetPalmaStep"}, + FunctionInfo{509, C<&IHidServer::ReadPalmaApplicationSection>, "ReadPalmaApplicationSection"}, + FunctionInfo{510, C<&IHidServer::WritePalmaApplicationSection>, "WritePalmaApplicationSection"}, + FunctionInfo{511, C<&IHidServer::ReadPalmaUniqueCode>, "ReadPalmaUniqueCode"}, + FunctionInfo{512, C<&IHidServer::SetPalmaUniqueCodeInvalid>, "SetPalmaUniqueCodeInvalid"}, + FunctionInfo{513, C<&IHidServer::WritePalmaActivityEntry>, "WritePalmaActivityEntry"}, + FunctionInfo{514, C<&IHidServer::WritePalmaRgbLedPatternEntry>, "WritePalmaRgbLedPatternEntry"}, + FunctionInfo{515, C<&IHidServer::WritePalmaWaveEntry>, "WritePalmaWaveEntry"}, + FunctionInfo{516, C<&IHidServer::SetPalmaDataBaseIdentificationVersion>, "SetPalmaDataBaseIdentificationVersion"}, + FunctionInfo{517, C<&IHidServer::GetPalmaDataBaseIdentificationVersion>, "GetPalmaDataBaseIdentificationVersion"}, + FunctionInfo{518, C<&IHidServer::SuspendPalmaFeature>, "SuspendPalmaFeature"}, + FunctionInfo{519, C<&IHidServer::GetPalmaOperationResult>, "GetPalmaOperationResult"}, + FunctionInfo{520, C<&IHidServer::ReadPalmaPlayLog>, "ReadPalmaPlayLog"}, + FunctionInfo{521, C<&IHidServer::ResetPalmaPlayLog>, "ResetPalmaPlayLog"}, + FunctionInfo{522, C<&IHidServer::SetIsPalmaAllConnectable>, "SetIsPalmaAllConnectable"}, + FunctionInfo{523, C<&IHidServer::SetIsPalmaPairedConnectable>, "SetIsPalmaPairedConnectable"}, + FunctionInfo{524, C<&IHidServer::PairPalma>, "PairPalma"}, + FunctionInfo{525, C<&IHidServer::SetPalmaBoostMode>, "SetPalmaBoostMode"}, + FunctionInfo{526, C<&IHidServer::CancelWritePalmaWaveEntry>, "CancelWritePalmaWaveEntry"}, + FunctionInfo{527, C<&IHidServer::EnablePalmaBoostMode>, "EnablePalmaBoostMode"}, + FunctionInfo{528, C<&IHidServer::GetPalmaBluetoothAddress>, "GetPalmaBluetoothAddress"}, + FunctionInfo{529, C<&IHidServer::SetDisallowedPalmaConnection>, "SetDisallowedPalmaConnection"}, + FunctionInfo{1000, C<&IHidServer::SetNpadCommunicationMode>, "SetNpadCommunicationMode"}, + FunctionInfo{1001, C<&IHidServer::GetNpadCommunicationMode>, "GetNpadCommunicationMode"}, + FunctionInfo{1002, C<&IHidServer::SetTouchScreenConfiguration>, "SetTouchScreenConfiguration"}, + FunctionInfo{1003, C<&IHidServer::IsFirmwareUpdateNeededForNotification>, "IsFirmwareUpdateNeededForNotification"}, + FunctionInfo{1004, C<&IHidServer::SetTouchScreenResolution>, "SetTouchScreenResolution"}, + FunctionInfo{1270, nullptr, "DeleteButtonConfigStorageRight"}, + FunctionInfo{1271, nullptr, "IsUsingCustomButtonConfig"}, + FunctionInfo{1272, nullptr, "IsAnyCustomButtonConfigEnabled"}, + FunctionInfo{1273, nullptr, "SetAllCustomButtonConfigEnabled"}, + FunctionInfo{1274, nullptr, "SetDefaultButtonConfig"}, + FunctionInfo{1275, nullptr, "SetAllDefaultButtonConfig"}, + FunctionInfo{1276, nullptr, "SetHidButtonConfigEmbedded"}, + FunctionInfo{1277, nullptr, "SetHidButtonConfigFull"}, + FunctionInfo{1278, nullptr, "SetHidButtonConfigLeft"}, + FunctionInfo{1279, nullptr, "SetHidButtonConfigRight"}, + FunctionInfo{1280, nullptr, "GetHidButtonConfigEmbedded"}, + FunctionInfo{1281, nullptr, "GetHidButtonConfigFull"}, + FunctionInfo{1282, nullptr, "GetHidButtonConfigLeft"}, + FunctionInfo{1283, nullptr, "GetHidButtonConfigRight"}, + FunctionInfo{1284, nullptr, "GetButtonConfigStorageEmbedded"}, + FunctionInfo{1285, nullptr, "GetButtonConfigStorageFull"}, + FunctionInfo{1286, nullptr, "GetButtonConfigStorageLeft"}, + FunctionInfo{1287, nullptr, "GetButtonConfigStorageRight"}, + FunctionInfo{1288, nullptr, "SetButtonConfigStorageEmbedded"}, + FunctionInfo{1289, nullptr, "SetButtonConfigStorageFull"}, + FunctionInfo{1290, nullptr, "SetButtonConfigStorageLeft"}, + FunctionInfo{1291, nullptr, "SetButtonConfigStorageRight"}, + FunctionInfo{1308, nullptr, "SetButtonConfigVisible"}, + FunctionInfo{1309, nullptr, "IsButtonConfigVisible"}, + FunctionInfo{1320, nullptr, "WakeTouchScreenUp"}, + FunctionInfo{1321, nullptr, "PutTouchScreenToSleep"}, + FunctionInfo{1322, nullptr, "AcquireTouchScreenAsyncWakeCompletedEvent"}, + FunctionInfo{1323, nullptr, "StartTouchScreenAutoTuneForSystemSettings"}, + FunctionInfo{1324, nullptr, "AcquireTouchScreenAutoTuneCompletedEvent"}, + FunctionInfo{1325, nullptr, "IsTouchScreenAutoTuneRequiredForRepairProviderReplacement"}, + FunctionInfo{1420, nullptr, "GetAppletResourceProperty"}, + FunctionInfo{2000, nullptr, "ActivateDigitizer"}, + FunctionInfo{3000, nullptr, "GetDebugPadGenericPadMap"}, + FunctionInfo{3001, nullptr, "SetDebugPadGenericPadMap"}, + FunctionInfo{3002, nullptr, "ResetDebugPadGenericPadMap"}, + FunctionInfo{3003, nullptr, "GetDebugPadKeyboardMap"}, + FunctionInfo{3004, nullptr, "SetDebugPadKeyboardMap"}, + FunctionInfo{3005, nullptr, "ResetDebugPadKeyboardMap"}, + FunctionInfo{3006, nullptr, "GetFullKeyGenericPadMap"}, + FunctionInfo{3007, nullptr, "SetFullKeyGenericPadMap"}, + FunctionInfo{3008, nullptr, "ResetFullKeyGenericPadMap"}, + FunctionInfo{3009, nullptr, "GetFullKeyKeyboardMap"}, + FunctionInfo{3010, nullptr, "SetFullKeyKeyboardMap"}, + FunctionInfo{3011, nullptr, "ResetFullKeyKeyboardMap"}, + FunctionInfo{3012, nullptr, "GetDebugPadGenericPadMap", MakeVersionGate({21,0,0})}, + FunctionInfo{3013, nullptr, "SetDebugPadGenericPadMap", MakeVersionGate({21,0,0})}, + FunctionInfo{3014, nullptr, "GetDebugPadKeyboardMap", MakeVersionGate({21,0,0})}, + FunctionInfo{3015, nullptr, "SetDebugPadKeyboardMap", MakeVersionGate({21,0,0})}, + FunctionInfo{3150, C<&IHidServer::SetMouseLibraryVersion>, "SetMouseLibraryVersion", MakeVersionGate({21,0,0})} + // What? -- {12010, nullptr, "SetButtonConfigLeft"}, + ); + return HandlerTableGenerateWithFind(key, functions); +} + IHidServer::IHidServer(Core::System& system_, std::shared_ptr resource, std::shared_ptr settings) : ServiceFramework{system_, "hid"}, resource_manager{resource}, firmware_settings{settings} { - // clang-format off - static const FunctionInfo functions[] = { - {0, C<&IHidServer::CreateAppletResource>, "CreateAppletResource"}, - {1, C<&IHidServer::ActivateDebugPad>, "ActivateDebugPad"}, - {11, C<&IHidServer::ActivateTouchScreen>, "ActivateTouchScreen"}, - {21, C<&IHidServer::ActivateMouse>, "ActivateMouse"}, - {26, C<&IHidServer::ActivateDebugMouse>, "ActivateDebugMouse"}, - {31, C<&IHidServer::ActivateKeyboard>, "ActivateKeyboard"}, - {32, C<&IHidServer::SendKeyboardLockKeyEvent>, "SendKeyboardLockKeyEvent"}, - {40, C<&IHidServer::AcquireXpadIdEventHandle>, "AcquireXpadIdEventHandle"}, - {41, C<&IHidServer::ReleaseXpadIdEventHandle>, "ReleaseXpadIdEventHandle"}, - {51, C<&IHidServer::ActivateXpad>, "ActivateXpad"}, - {55, C<&IHidServer::GetXpadIds>, "GetXpadIds"}, - {56, C<&IHidServer::ActivateJoyXpad>, "ActivateJoyXpad"}, - {58, C<&IHidServer::GetJoyXpadLifoHandle>, "GetJoyXpadLifoHandle"}, - {59, C<&IHidServer::GetJoyXpadIds>, "GetJoyXpadIds"}, - {60, C<&IHidServer::ActivateSixAxisSensor>, "ActivateSixAxisSensor"}, - {61, C<&IHidServer::DeactivateSixAxisSensor>, "DeactivateSixAxisSensor"}, - {62, C<&IHidServer::GetSixAxisSensorLifoHandle>, "GetSixAxisSensorLifoHandle"}, - {63, C<&IHidServer::ActivateJoySixAxisSensor>, "ActivateJoySixAxisSensor"}, - {64, C<&IHidServer::DeactivateJoySixAxisSensor>, "DeactivateJoySixAxisSensor"}, - {65, C<&IHidServer::GetJoySixAxisSensorLifoHandle>, "GetJoySixAxisSensorLifoHandle"}, - {66, C<&IHidServer::StartSixAxisSensor>, "StartSixAxisSensor"}, - {67, C<&IHidServer::StopSixAxisSensor>, "StopSixAxisSensor"}, - {68, C<&IHidServer::IsSixAxisSensorFusionEnabled>, "IsSixAxisSensorFusionEnabled"}, - {69, C<&IHidServer::EnableSixAxisSensorFusion>, "EnableSixAxisSensorFusion"}, - {70, C<&IHidServer::SetSixAxisSensorFusionParameters>, "SetSixAxisSensorFusionParameters"}, - {71, C<&IHidServer::GetSixAxisSensorFusionParameters>, "GetSixAxisSensorFusionParameters"}, - {72, C<&IHidServer::ResetSixAxisSensorFusionParameters>, "ResetSixAxisSensorFusionParameters"}, - {73, nullptr, "SetAccelerometerParameters"}, - {74, nullptr, "GetAccelerometerParameters"}, - {75, nullptr, "ResetAccelerometerParameters"}, - {76, nullptr, "SetAccelerometerPlayMode"}, - {77, nullptr, "GetAccelerometerPlayMode"}, - {78, nullptr, "ResetAccelerometerPlayMode"}, - {79, C<&IHidServer::SetGyroscopeZeroDriftMode>, "SetGyroscopeZeroDriftMode"}, - {80, C<&IHidServer::GetGyroscopeZeroDriftMode>, "GetGyroscopeZeroDriftMode"}, - {81, C<&IHidServer::ResetGyroscopeZeroDriftMode>, "ResetGyroscopeZeroDriftMode"}, - {82, C<&IHidServer::IsSixAxisSensorAtRest>, "IsSixAxisSensorAtRest"}, - {83, C<&IHidServer::IsFirmwareUpdateAvailableForSixAxisSensor>, "IsFirmwareUpdateAvailableForSixAxisSensor"}, - {84, C<&IHidServer::EnableSixAxisSensorUnalteredPassthrough>, "EnableSixAxisSensorUnalteredPassthrough"}, - {85, C<&IHidServer::IsSixAxisSensorUnalteredPassthroughEnabled>, "IsSixAxisSensorUnalteredPassthroughEnabled"}, - {86, nullptr, "StoreSixAxisSensorCalibrationParameter"}, - {87, C<&IHidServer::LoadSixAxisSensorCalibrationParameter>, "LoadSixAxisSensorCalibrationParameter"}, - {88, C<&IHidServer::GetSixAxisSensorIcInformation>, "GetSixAxisSensorIcInformation"}, - {89, C<&IHidServer::ResetIsSixAxisSensorDeviceNewlyAssigned>, "ResetIsSixAxisSensorDeviceNewlyAssigned"}, - {91, C<&IHidServer::ActivateGesture>, "ActivateGesture"}, - {92, C<&IHidServer::SetGestureOutputRanges>, "SetGestureOutputRanges"}, - {100, C<&IHidServer::SetSupportedNpadStyleSet>, "SetSupportedNpadStyleSet"}, - {101, C<&IHidServer::GetSupportedNpadStyleSet>, "GetSupportedNpadStyleSet"}, - {102, C<&IHidServer::SetSupportedNpadIdType>, "SetSupportedNpadIdType"}, - {103, C<&IHidServer::ActivateNpad>, "ActivateNpad"}, - {104, C<&IHidServer::DeactivateNpad>, "DeactivateNpad"}, - {106, C<&IHidServer::AcquireNpadStyleSetUpdateEventHandle>, "AcquireNpadStyleSetUpdateEventHandle"}, - {107, C<&IHidServer::DisconnectNpad>, "DisconnectNpad"}, - {108, C<&IHidServer::GetPlayerLedPattern>, "GetPlayerLedPattern"}, - {109, C<&IHidServer::ActivateNpadWithRevision>, "ActivateNpadWithRevision"}, - {120, C<&IHidServer::SetNpadJoyHoldType>, "SetNpadJoyHoldType"}, - {121, C<&IHidServer::GetNpadJoyHoldType>, "GetNpadJoyHoldType"}, - {122, C<&IHidServer::SetNpadJoyAssignmentModeSingleByDefault>, "SetNpadJoyAssignmentModeSingleByDefault"}, - {123, C<&IHidServer::SetNpadJoyAssignmentModeSingle>, "SetNpadJoyAssignmentModeSingle"}, - {124, C<&IHidServer::SetNpadJoyAssignmentModeDual>, "SetNpadJoyAssignmentModeDual"}, - {125, C<&IHidServer::MergeSingleJoyAsDualJoy>, "MergeSingleJoyAsDualJoy"}, - {126, C<&IHidServer::StartLrAssignmentMode>, "StartLrAssignmentMode"}, - {127, C<&IHidServer::StopLrAssignmentMode>, "StopLrAssignmentMode"}, - {128, C<&IHidServer::SetNpadHandheldActivationMode>, "SetNpadHandheldActivationMode"}, - {129, C<&IHidServer::GetNpadHandheldActivationMode>, "GetNpadHandheldActivationMode"}, - {130, C<&IHidServer::SwapNpadAssignment>, "SwapNpadAssignment"}, - {131, C<&IHidServer::IsUnintendedHomeButtonInputProtectionEnabled>, "IsUnintendedHomeButtonInputProtectionEnabled"}, - {132, C<&IHidServer::EnableUnintendedHomeButtonInputProtection>, "EnableUnintendedHomeButtonInputProtection"}, - {133, C<&IHidServer::SetNpadJoyAssignmentModeSingleWithDestination>, "SetNpadJoyAssignmentModeSingleWithDestination"}, - {134, C<&IHidServer::SetNpadAnalogStickUseCenterClamp>, "SetNpadAnalogStickUseCenterClamp"}, - {135, C<&IHidServer::SetNpadCaptureButtonAssignment>, "SetNpadCaptureButtonAssignment"}, - {136, C<&IHidServer::ClearNpadCaptureButtonAssignment>, "ClearNpadCaptureButtonAssignment"}, - {200, C<&IHidServer::GetVibrationDeviceInfo>, "GetVibrationDeviceInfo"}, - {201, C<&IHidServer::SendVibrationValue>, "SendVibrationValue"}, - {202, C<&IHidServer::GetActualVibrationValue>, "GetActualVibrationValue"}, - {203, C<&IHidServer::CreateActiveVibrationDeviceList>, "CreateActiveVibrationDeviceList"}, - {204, C<&IHidServer::PermitVibration>, "PermitVibration"}, - {205, C<&IHidServer::IsVibrationPermitted>, "IsVibrationPermitted"}, - {206, C<&IHidServer::SendVibrationValues>, "SendVibrationValues"}, - {207, C<&IHidServer::SendVibrationGcErmCommand>, "SendVibrationGcErmCommand"}, - {208, C<&IHidServer::GetActualVibrationGcErmCommand>, "GetActualVibrationGcErmCommand"}, - {209, C<&IHidServer::BeginPermitVibrationSession>, "BeginPermitVibrationSession"}, - {210, C<&IHidServer::EndPermitVibrationSession>, "EndPermitVibrationSession"}, - {211, C<&IHidServer::IsVibrationDeviceMounted>, "IsVibrationDeviceMounted"}, - {212, C<&IHidServer::SendVibrationValueInBool>, "SendVibrationValueInBool"}, - {300, C<&IHidServer::ActivateConsoleSixAxisSensor>, "ActivateConsoleSixAxisSensor"}, - {301, C<&IHidServer::StartConsoleSixAxisSensor>, "StartConsoleSixAxisSensor"}, - {302, C<&IHidServer::StopConsoleSixAxisSensor>, "StopConsoleSixAxisSensor"}, - {303, C<&IHidServer::ActivateSevenSixAxisSensor>, "ActivateSevenSixAxisSensor"}, - {304, C<&IHidServer::StartSevenSixAxisSensor>, "StartSevenSixAxisSensor"}, - {305, C<&IHidServer::StopSevenSixAxisSensor>, "StopSevenSixAxisSensor"}, - {306, C<&IHidServer::InitializeSevenSixAxisSensor>, "InitializeSevenSixAxisSensor"}, - {307, C<&IHidServer::FinalizeSevenSixAxisSensor>, "FinalizeSevenSixAxisSensor"}, - {308, nullptr, "SetSevenSixAxisSensorFusionStrength"}, - {309, nullptr, "GetSevenSixAxisSensorFusionStrength"}, - {310, C<&IHidServer::ResetSevenSixAxisSensorTimestamp>, "ResetSevenSixAxisSensorTimestamp"}, - {320, nullptr, "EnableNpadImu"}, //21.0.0+ - {321, nullptr, "DisableNpadImu"}, //21.0.0+ - {400, C<&IHidServer::IsUsbFullKeyControllerEnabled>, "IsUsbFullKeyControllerEnabled"}, - {401, nullptr, "EnableUsbFullKeyController"}, - {402, nullptr, "IsUsbFullKeyControllerConnected"}, - {403, nullptr, "HasBattery"}, - {404, nullptr, "HasLeftRightBattery"}, - {405, nullptr, "GetNpadInterfaceType"}, - {406, nullptr, "GetNpadLeftRightInterfaceType"}, - {407, nullptr, "GetNpadOfHighestBatteryLevel"}, - {408, nullptr, "GetNpadOfHighestBatteryLevelForJoyRight"}, - {500, C<&IHidServer::GetPalmaConnectionHandle>, "GetPalmaConnectionHandle"}, - {501, C<&IHidServer::InitializePalma>, "InitializePalma"}, - {502, C<&IHidServer::AcquirePalmaOperationCompleteEvent>, "AcquirePalmaOperationCompleteEvent"}, - {503, C<&IHidServer::GetPalmaOperationInfo>, "GetPalmaOperationInfo"}, - {504, C<&IHidServer::PlayPalmaActivity>, "PlayPalmaActivity"}, - {505, C<&IHidServer::SetPalmaFrModeType>, "SetPalmaFrModeType"}, - {506, C<&IHidServer::ReadPalmaStep>, "ReadPalmaStep"}, - {507, C<&IHidServer::EnablePalmaStep>, "EnablePalmaStep"}, - {508, C<&IHidServer::ResetPalmaStep>, "ResetPalmaStep"}, - {509, C<&IHidServer::ReadPalmaApplicationSection>, "ReadPalmaApplicationSection"}, - {510, C<&IHidServer::WritePalmaApplicationSection>, "WritePalmaApplicationSection"}, - {511, C<&IHidServer::ReadPalmaUniqueCode>, "ReadPalmaUniqueCode"}, - {512, C<&IHidServer::SetPalmaUniqueCodeInvalid>, "SetPalmaUniqueCodeInvalid"}, - {513, C<&IHidServer::WritePalmaActivityEntry>, "WritePalmaActivityEntry"}, - {514, C<&IHidServer::WritePalmaRgbLedPatternEntry>, "WritePalmaRgbLedPatternEntry"}, - {515, C<&IHidServer::WritePalmaWaveEntry>, "WritePalmaWaveEntry"}, - {516, C<&IHidServer::SetPalmaDataBaseIdentificationVersion>, "SetPalmaDataBaseIdentificationVersion"}, - {517, C<&IHidServer::GetPalmaDataBaseIdentificationVersion>, "GetPalmaDataBaseIdentificationVersion"}, - {518, C<&IHidServer::SuspendPalmaFeature>, "SuspendPalmaFeature"}, - {519, C<&IHidServer::GetPalmaOperationResult>, "GetPalmaOperationResult"}, - {520, C<&IHidServer::ReadPalmaPlayLog>, "ReadPalmaPlayLog"}, - {521, C<&IHidServer::ResetPalmaPlayLog>, "ResetPalmaPlayLog"}, - {522, C<&IHidServer::SetIsPalmaAllConnectable>, "SetIsPalmaAllConnectable"}, - {523, C<&IHidServer::SetIsPalmaPairedConnectable>, "SetIsPalmaPairedConnectable"}, - {524, C<&IHidServer::PairPalma>, "PairPalma"}, - {525, C<&IHidServer::SetPalmaBoostMode>, "SetPalmaBoostMode"}, - {526, C<&IHidServer::CancelWritePalmaWaveEntry>, "CancelWritePalmaWaveEntry"}, - {527, C<&IHidServer::EnablePalmaBoostMode>, "EnablePalmaBoostMode"}, - {528, C<&IHidServer::GetPalmaBluetoothAddress>, "GetPalmaBluetoothAddress"}, - {529, C<&IHidServer::SetDisallowedPalmaConnection>, "SetDisallowedPalmaConnection"}, - {1000, C<&IHidServer::SetNpadCommunicationMode>, "SetNpadCommunicationMode"}, - {1001, C<&IHidServer::GetNpadCommunicationMode>, "GetNpadCommunicationMode"}, - {1002, C<&IHidServer::SetTouchScreenConfiguration>, "SetTouchScreenConfiguration"}, - {1003, C<&IHidServer::IsFirmwareUpdateNeededForNotification>, "IsFirmwareUpdateNeededForNotification"}, - {1004, C<&IHidServer::SetTouchScreenResolution>, "SetTouchScreenResolution"}, - {1270, nullptr, "DeleteButtonConfigStorageRight"}, - {1271, nullptr, "IsUsingCustomButtonConfig"}, - {1272, nullptr, "IsAnyCustomButtonConfigEnabled"}, - {1273, nullptr, "SetAllCustomButtonConfigEnabled"}, - {1274, nullptr, "SetDefaultButtonConfig"}, - {1275, nullptr, "SetAllDefaultButtonConfig"}, - {1276, nullptr, "SetHidButtonConfigEmbedded"}, - {1277, nullptr, "SetHidButtonConfigFull"}, - {1278, nullptr, "SetHidButtonConfigLeft"}, - {1279, nullptr, "SetHidButtonConfigRight"}, - {1280, nullptr, "GetHidButtonConfigEmbedded"}, - {1281, nullptr, "GetHidButtonConfigFull"}, - {1282, nullptr, "GetHidButtonConfigLeft"}, - {1283, nullptr, "GetHidButtonConfigRight"}, - {1284, nullptr, "GetButtonConfigStorageEmbedded"}, - {1285, nullptr, "GetButtonConfigStorageFull"}, - {1286, nullptr, "GetButtonConfigStorageLeft"}, - {1287, nullptr, "GetButtonConfigStorageRight"}, - {1288, nullptr, "SetButtonConfigStorageEmbedded"}, - {1289, nullptr, "SetButtonConfigStorageFull"}, - {1290, nullptr, "SetButtonConfigStorageLeft"}, - {1291, nullptr, "SetButtonConfigStorageRight"}, - {1308, nullptr, "SetButtonConfigVisible"}, - {1309, nullptr, "IsButtonConfigVisible"}, - {1320, nullptr, "WakeTouchScreenUp"}, - {1321, nullptr, "PutTouchScreenToSleep"}, - {1322, nullptr, "AcquireTouchScreenAsyncWakeCompletedEvent"}, - {1323, nullptr, "StartTouchScreenAutoTuneForSystemSettings"}, - {1324, nullptr, "AcquireTouchScreenAutoTuneCompletedEvent"}, - {1325, nullptr, "IsTouchScreenAutoTuneRequiredForRepairProviderReplacement"}, - {1420, nullptr, "GetAppletResourceProperty"}, - {2000, nullptr, "ActivateDigitizer"}, - {3000, nullptr, "GetDebugPadGenericPadMap"}, - {3001, nullptr, "SetDebugPadGenericPadMap"}, - {3002, nullptr, "ResetDebugPadGenericPadMap"}, - {3003, nullptr, "GetDebugPadKeyboardMap"}, - {3004, nullptr, "SetDebugPadKeyboardMap"}, - {3005, nullptr, "ResetDebugPadKeyboardMap"}, - {3006, nullptr, "GetFullKeyGenericPadMap"}, - {3007, nullptr, "SetFullKeyGenericPadMap"}, - {3008, nullptr, "ResetFullKeyGenericPadMap"}, - {3009, nullptr, "GetFullKeyKeyboardMap"}, - {3010, nullptr, "SetFullKeyKeyboardMap"}, - {3011, nullptr, "ResetFullKeyKeyboardMap"}, - {3012, nullptr, "GetDebugPadGenericPadMap"}, //21.0.0+ - {3013, nullptr, "SetDebugPadGenericPadMap"}, //21.0.0+ - {3014, nullptr, "GetDebugPadKeyboardMap"}, //21.0.0+ - {3015, nullptr, "SetDebugPadKeyboardMap"}, //21.0.0+ - {3150, C<&IHidServer::SetMouseLibraryVersion>, "SetMouseLibraryVersion"}, //21.0.0+ - // What? -- {12010, nullptr, "SetButtonConfigLeft"}, - }; - // clang-format on - - RegisterHandlers(functions); } IHidServer::~IHidServer() = default; diff --git a/src/core/hle/service/hid/hid_server.h b/src/core/hle/service/hid/hid_server.h index 57a1a04b9c..f2c08e9df8 100644 --- a/src/core/hle/service/hid/hid_server.h +++ b/src/core/hle/service/hid/hid_server.h @@ -265,6 +265,8 @@ private: Result SetTouchScreenResolution(u32 width, u32 height, ClientAppletResourceUserId aruid); Result SetMouseLibraryVersion(ClientAppletResourceUserId aruid); + std::optional FindRequest(u32 key) override; + std::shared_ptr resource_manager; std::shared_ptr firmware_settings; }; diff --git a/src/core/hle/service/hid/hid_system_server.cpp b/src/core/hle/service/hid/hid_system_server.cpp index e544adf03c..4df021f443 100644 --- a/src/core/hle/service/hid/hid_system_server.cpp +++ b/src/core/hle/service/hid/hid_system_server.cpp @@ -22,252 +22,6 @@ IHidSystemServer::IHidSystemServer(Core::System& system_, std::shared_ptr settings) : ServiceFramework{system_, "hid:sys"}, service_context{system_, service_name}, resource_manager{resource}, firmware_settings{settings} { - // clang-format off - static const FunctionInfo functions[] = { - {31, nullptr, "SendKeyboardLockKeyEvent"}, - {101, nullptr, "AcquireHomeButtonEventHandle"}, - {111, nullptr, "ActivateHomeButton"}, - {121, nullptr, "AcquireSleepButtonEventHandle"}, - {131, nullptr, "ActivateSleepButton"}, - {141, nullptr, "AcquireCaptureButtonEventHandle"}, - {151, nullptr, "ActivateCaptureButton"}, - {161, &IHidSystemServer::GetPlatformConfig, "GetPlatformConfig"}, - {210, nullptr, "AcquireNfcDeviceUpdateEventHandle"}, - {211, nullptr, "GetNpadsWithNfc"}, - {212, nullptr, "AcquireNfcActivateEventHandle"}, - {213, nullptr, "ActivateNfc"}, - {214, nullptr, "GetXcdHandleForNpadWithNfc"}, - {215, nullptr, "IsNfcActivated"}, - {216, nullptr, "GetAbstractedPadIdForNpadWithNfc"}, - {217, nullptr, "SetNfcEvent"}, - {218, nullptr, "GetNfcInfo"}, - {219, nullptr, "StartNfcDiscovery"}, - {220, nullptr, "StopNfcDiscovery"}, - {221, nullptr, "StartNtagRead"}, - {222, nullptr, "StartNtagWrite"}, - {223, nullptr, "SendNfcRawData"}, - {224, nullptr, "RegisterMifareKey"}, - {225, nullptr, "ClearMifareKey"}, - {226, nullptr, "StartMifareRead"}, - {227, nullptr, "StartMifareWrite"}, - {230, nullptr, "AcquireIrSensorEventHndle" }, - {231, nullptr, "ActivateIrSensor"}, - {232, nullptr, "GetIrSensorState"}, - {233, nullptr, "GetXcdHandleForNpadWihIrSensor" }, - {234, nullptr, "GetNpadJoyHoldType"}, - {241, nullptr, "GetDataFormat"}, - {242, nullptr, "SetDataFormat"}, - {243, nullptr, "GetMcuState"}, - {244, nullptr, "SetMcuState"}, - {245, nullptr, "GetMcuVersionForNfc"}, - {246, nullptr, "CheckNfcDevicePower"}, - {247, nullptr, "SetMcuStateImmediate"}, - {301, nullptr, "ActivateNpadSystem"}, - {303, &IHidSystemServer::ApplyNpadSystemCommonPolicy, "ApplyNpadSystemCommonPolicy"}, - {304, &IHidSystemServer::EnableAssigningSingleOnSlSrPress, "EnableAssigningSingleOnSlSrPress"}, - {305, &IHidSystemServer::DisableAssigningSingleOnSlSrPress, "DisableAssigningSingleOnSlSrPress"}, - {306, &IHidSystemServer::GetLastActiveNpad, "GetLastActiveNpad"}, - {307, nullptr, "GetNpadSystemExtStyle"}, - {308, &IHidSystemServer::ApplyNpadSystemCommonPolicyFull, "ApplyNpadSystemCommonPolicyFull"}, - {309, &IHidSystemServer::GetNpadFullKeyGripColor, "GetNpadFullKeyGripColor"}, - {310, &IHidSystemServer::GetMaskedSupportedNpadStyleSet, "GetMaskedSupportedNpadStyleSet"}, - {311, nullptr, "SetNpadPlayerLedBlinkingDevice"}, - {312, &IHidSystemServer::SetSupportedNpadStyleSetAll, "SetSupportedNpadStyleSetAll"}, - {313, &IHidSystemServer::GetNpadCaptureButtonAssignment, "GetNpadCaptureButtonAssignment"}, - {314, nullptr, "GetAppletFooterUiType"}, - {315, &IHidSystemServer::GetAppletDetailedUiType, "GetAppletDetailedUiType"}, - {316, &IHidSystemServer::GetNpadInterfaceType, "GetNpadInterfaceType"}, - {317, &IHidSystemServer::GetNpadLeftRightInterfaceType, "GetNpadLeftRightInterfaceType"}, - {318, &IHidSystemServer::HasBattery, "HasBattery"}, - {319, &IHidSystemServer::HasLeftRightBattery, "HasLeftRightBattery"}, - {321, &IHidSystemServer::GetUniquePadsFromNpad, "GetUniquePadsFromNpad"}, - {322, &IHidSystemServer::SetNpadSystemExtStateEnabled, "SetNpadSystemExtStateEnabled"}, - {323, nullptr, "GetLastActiveUniquePad"}, - {324, nullptr, "GetUniquePadButtonSet"}, - {325, nullptr, "GetUniquePadColor"}, - {326, nullptr, "GetUniquePadAppletDetailedUiType"}, - {327, nullptr, "GetAbstractedPadIdDataFromNpad"}, - {328, nullptr, "AttachAbstractedPadToNpad"}, - {329, nullptr, "DetachAbstractedPadAll"}, - {330, nullptr, "CheckAbstractedPadConnection"}, - {332, nullptr, "ConvertAppletDetailedUiTypeFromPlayReportType"}, //19.0.0+ - {333, nullptr, "SetNpadUserSpgApplet"}, //20.0.0+ - {334, nullptr, "AcquireUniquePadButtonStateChangedEventHandle"}, //20.0.0+ - {501, &IHidSystemServer::RegisterAppletResourceUserId, "RegisterAppletResourceUserId"}, - {502, &IHidSystemServer::UnregisterAppletResourceUserId, "UnregisterAppletResourceUserId"}, - {503, &IHidSystemServer::EnableAppletToGetInput, "EnableAppletToGetInput"}, - {504, &IHidSystemServer::SetAruidValidForVibration, "SetAruidValidForVibration"}, - {505, &IHidSystemServer::EnableAppletToGetSixAxisSensor, "EnableAppletToGetSixAxisSensor"}, - {506, &IHidSystemServer::EnableAppletToGetPadInput, "EnableAppletToGetPadInput"}, - {507, &IHidSystemServer::EnableAppletToGetTouchScreen, "EnableAppletToGetTouchScreen"}, - {510, &IHidSystemServer::SetVibrationMasterVolume, "SetVibrationMasterVolume"}, - {511, &IHidSystemServer::GetVibrationMasterVolume, "GetVibrationMasterVolume"}, - {512, &IHidSystemServer::BeginPermitVibrationSession, "BeginPermitVibrationSession"}, - {513, &IHidSystemServer::EndPermitVibrationSession, "EndPermitVibrationSession"}, - {514, nullptr, "Unknown514"}, - {520, nullptr, "EnableHandheldHids"}, - {521, nullptr, "DisableHandheldHids"}, - {522, nullptr, "SetJoyConRailEnabled"}, - {523, &IHidSystemServer::IsJoyConRailEnabled, "IsJoyConRailEnabled"}, - {524, nullptr, "IsHandheldHidsEnabled"}, - {525, &IHidSystemServer::IsJoyConAttachedOnAllRail, "IsJoyConAttachedOnAllRail"}, - {540, nullptr, "AcquirePlayReportControllerUsageUpdateEvent"}, - {541, nullptr, "GetPlayReportControllerUsages"}, - {542, nullptr, "AcquirePlayReportRegisteredDeviceUpdateEvent"}, - {543, nullptr, "GetRegisteredDevicesOld"}, - {544, &IHidSystemServer::AcquireConnectionTriggerTimeoutEvent, "AcquireConnectionTriggerTimeoutEvent"}, - {545, nullptr, "SendConnectionTrigger"}, - {546, &IHidSystemServer::AcquireDeviceRegisteredEventForControllerSupport, "AcquireDeviceRegisteredEventForControllerSupport"}, - {547, nullptr, "GetAllowedBluetoothLinksCount"}, - {548, &IHidSystemServer::GetRegisteredDevices, "GetRegisteredDevices"}, - {549, nullptr, "GetConnectableRegisteredDevices"}, - {551, &IHidSystemServer::GetRegisteredDevices, "GetRegisteredDevicesForControllerSupport"}, //20.0.0+ //mocked via 548 for Diablo 3 (at least) - {700, nullptr, "ActivateUniquePad"}, - {702, &IHidSystemServer::AcquireUniquePadConnectionEventHandle, "AcquireUniquePadConnectionEventHandle"}, - {703, &IHidSystemServer::GetUniquePadIds, "GetUniquePadIds"}, - {711, nullptr, "AcquireUniquePadConnectionOnHandheldForNsEventHandle"}, //20.0.0+ - {712, nullptr, "GetUniquePadColor12"}, //20.0.0+ - {751, &IHidSystemServer::AcquireJoyDetachOnBluetoothOffEventHandle, "AcquireJoyDetachOnBluetoothOffEventHandle"}, - {800, nullptr, "ListSixAxisSensorHandles"}, - {801, nullptr, "IsSixAxisSensorUserCalibrationSupported"}, - {802, nullptr, "ResetSixAxisSensorCalibrationValues"}, - {803, nullptr, "StartSixAxisSensorUserCalibration"}, - {804, nullptr, "CancelSixAxisSensorUserCalibration"}, - {805, nullptr, "GetUniquePadBluetoothAddress"}, - {806, nullptr, "DisconnectUniquePad"}, - {807, nullptr, "GetUniquePadType"}, - {808, nullptr, "GetUniquePadInterface"}, - {809, nullptr, "GetUniquePadSerialNumber"}, - {810, nullptr, "GetUniquePadControllerNumber"}, - {811, nullptr, "GetSixAxisSensorUserCalibrationStage"}, - {812, nullptr, "GetConsoleUniqueSixAxisSensorHandle"}, - {813, nullptr, "GetDeviceType"}, - {821, nullptr, "StartAnalogStickManualCalibration"}, - {822, nullptr, "RetryCurrentAnalogStickManualCalibrationStage"}, - {823, nullptr, "CancelAnalogStickManualCalibration"}, - {824, nullptr, "ResetAnalogStickManualCalibration"}, - {825, nullptr, "GetAnalogStickState"}, - {826, nullptr, "GetAnalogStickManualCalibrationStage"}, - {827, nullptr, "IsAnalogStickButtonPressed"}, - {828, nullptr, "IsAnalogStickInReleasePosition"}, - {829, nullptr, "IsAnalogStickInCircumference"}, - {830, nullptr, "SetNotificationLedPattern"}, - {831, nullptr, "SetNotificationLedPatternWithTimeout"}, - {832, nullptr, "PrepareHidsForNotificationWake"}, - {850, &IHidSystemServer::IsUsbFullKeyControllerEnabled, "IsUsbFullKeyControllerEnabled"}, - {851, &IHidSystemServer::EnableUsbFullKeyController, "EnableUsbFullKeyController"}, - {852, nullptr, "IsUsbConnected"}, - {870, &IHidSystemServer::IsHandheldButtonPressedOnConsoleMode, "IsHandheldButtonPressedOnConsoleMode"}, - {900, nullptr, "ActivateInputDetector"}, - {901, nullptr, "NotifyInputDetector"}, - {1000, &IHidSystemServer::InitializeFirmwareUpdate, "InitializeFirmwareUpdate"}, - {1001, nullptr, "GetFirmwareVersion"}, - {1002, nullptr, "GetAvailableFirmwareVersion"}, - {1003, nullptr, "IsFirmwareUpdateAvailable"}, - {1004, &IHidSystemServer::CheckFirmwareUpdateRequired, "CheckFirmwareUpdateRequired"}, - {1005, nullptr, "StartFirmwareUpdate"}, - {1006, nullptr, "AbortFirmwareUpdate"}, - {1007, nullptr, "GetFirmwareUpdateState"}, - {1008, nullptr, "ActivateAudioControl"}, - {1009, nullptr, "AcquireAudioControlEventHandle"}, - {1010, nullptr, "GetAudioControlStates"}, - {1011, nullptr, "DeactivateAudioControl"}, - {1012, nullptr, "GetFirmwareVersionStringForUserSupportPage"}, - {1050, nullptr, "IsSixAxisSensorAccurateUserCalibrationSupported"}, - {1051, nullptr, "StartSixAxisSensorAccurateUserCalibration"}, - {1052, nullptr, "CancelSixAxisSensorAccurateUserCalibration"}, - {1053, nullptr, "GetSixAxisSensorAccurateUserCalibrationState"}, - {1100, nullptr, "GetHidbusSystemServiceObject"}, - {1120, &IHidSystemServer::SetFirmwareHotfixUpdateSkipEnabled, "SetFirmwareHotfixUpdateSkipEnabled"}, - {1130, &IHidSystemServer::InitializeUsbFirmwareUpdate, "InitializeUsbFirmwareUpdate"}, - {1131, &IHidSystemServer::FinalizeUsbFirmwareUpdate, "FinalizeUsbFirmwareUpdate"}, - {1132, &IHidSystemServer::CheckUsbFirmwareUpdateRequired, "CheckUsbFirmwareUpdateRequired"}, - {1133, nullptr, "StartUsbFirmwareUpdate"}, - {1134, nullptr, "GetUsbFirmwareUpdateState"}, - {1135, &IHidSystemServer::InitializeUsbFirmwareUpdateWithoutMemory, "InitializeUsbFirmwareUpdateWithoutMemory"}, - {1150, &IHidSystemServer::SetTouchScreenMagnification, "SetTouchScreenMagnification"}, - {1151, &IHidSystemServer::GetTouchScreenFirmwareVersion, "GetTouchScreenFirmwareVersion"}, - {1152, &IHidSystemServer::SetTouchScreenDefaultConfiguration, "SetTouchScreenDefaultConfiguration"}, - {1153, &IHidSystemServer::GetTouchScreenDefaultConfiguration, "GetTouchScreenDefaultConfiguration"}, - {1154, nullptr, "IsFirmwareAvailableForNotification"}, - {1155, &IHidSystemServer::SetForceHandheldStyleVibration, "SetForceHandheldStyleVibration"}, - {1156, nullptr, "SendConnectionTriggerWithoutTimeoutEvent"}, - {1157, nullptr, "CancelConnectionTrigger"}, - {1158, nullptr, "SetConnectionLimitForSplay"}, //20.1.0+ - {1159, nullptr, "ClearConnectionLimitForSplay"}, //20.1.0+ - {1200, nullptr, "IsButtonConfigSupported"}, - {1201, nullptr, "IsButtonConfigEmbeddedSupported"}, - {1202, nullptr, "DeleteButtonConfig"}, - {1203, nullptr, "DeleteButtonConfigEmbedded"}, - {1204, nullptr, "SetButtonConfigEnabled"}, - {1205, nullptr, "SetButtonConfigEmbeddedEnabled"}, - {1206, nullptr, "IsButtonConfigEnabled"}, - {1207, nullptr, "IsButtonConfigEmbeddedEnabled"}, - {1208, nullptr, "SetButtonConfigEmbedded"}, - {1209, nullptr, "SetButtonConfigFull"}, - {1210, nullptr, "SetButtonConfigLeft"}, - {1211, nullptr, "SetButtonConfigRight"}, - {1212, nullptr, "GetButtonConfigEmbedded"}, - {1213, nullptr, "GetButtonConfigFull"}, - {1214, nullptr, "GetButtonConfigLeft"}, - {1215, nullptr, "GetButtonConfigRight"}, - {1250, nullptr, "IsCustomButtonConfigSupported"}, - {1251, nullptr, "IsDefaultButtonConfigEmbedded"}, - {1252, nullptr, "IsDefaultButtonConfigFull"}, - {1253, nullptr, "IsDefaultButtonConfigLeft"}, - {1254, nullptr, "IsDefaultButtonConfigRight"}, - {1255, nullptr, "IsButtonConfigStorageEmbeddedEmpty"}, - {1256, nullptr, "IsButtonConfigStorageFullEmpty"}, - {1257, nullptr, "IsButtonConfigStorageLeftEmpty"}, - {1258, nullptr, "IsButtonConfigStorageRightEmpty"}, - {1259, nullptr, "GetButtonConfigStorageEmbeddedDeprecated"}, - {1260, nullptr, "GetButtonConfigStorageFullDeprecated"}, - {1261, nullptr, "GetButtonConfigStorageLeftDeprecated"}, - {1262, nullptr, "GetButtonConfigStorageRightDeprecated"}, - {1263, nullptr, "SetButtonConfigStorageEmbeddedDeprecated"}, - {1264, nullptr, "SetButtonConfigStorageFullDeprecated"}, - {1265, nullptr, "SetButtonConfigStorageLeftDeprecated"}, - {1266, nullptr, "SetButtonConfigStorageRightDeprecated"}, - {1267, nullptr, "DeleteButtonConfigStorageEmbedded"}, - {1268, nullptr, "DeleteButtonConfigStorageFull"}, - {1269, nullptr, "DeleteButtonConfigStorageLeft"}, - {1270, nullptr, "DeleteButtonConfigStorageRight"}, - {1271, &IHidSystemServer::IsUsingCustomButtonConfig, "IsUsingCustomButtonConfig"}, - {1272, &IHidSystemServer::IsAnyCustomButtonConfigEnabled, "IsAnyCustomButtonConfigEnabled"}, - {1273, nullptr, "SetAllCustomButtonConfigEnabled"}, - {1274, nullptr, "SetDefaultButtonConfig"}, - {1275, nullptr, "SetAllDefaultButtonConfig"}, - {1276, nullptr, "SetHidButtonConfigEmbedded"}, - {1277, nullptr, "SetHidButtonConfigFull"}, - {1278, nullptr, "SetHidButtonConfigLeft"}, - {1279, nullptr, "SetHidButtonConfigRight"}, - {1280, nullptr, "GetHidButtonConfigEmbedded"}, - {1281, nullptr, "GetHidButtonConfigFull"}, - {1282, nullptr, "GetHidButtonConfigLeft"}, - {1283, nullptr, "GetHidButtonConfigRight"}, - {1284, nullptr, "GetButtonConfigStorageEmbedded"}, - {1285, nullptr, "GetButtonConfigStorageFull"}, - {1286, nullptr, "GetButtonConfigStorageLeft"}, - {1287, nullptr, "GetButtonConfigStorageRight"}, - {1288, nullptr, "SetButtonConfigStorageEmbedded"}, - {1289, nullptr, "SetButtonConfigStorageFull"}, - {1290, nullptr, "DeleteButtonConfigStorageRight"}, - {1291, nullptr, "DeleteButtonConfigStorageRight"}, - {1308, nullptr, "SetButtonConfigVisible"}, //18.0.0+ - {1309, nullptr, "IsButtonConfigVisible"}, //18.0.0+ - {1320, nullptr, "WakeTouchScreenUp"}, //17.0.0+ - {1321, nullptr, "PutTouchScreenToSleep"}, //17.0.0+ - {1322, nullptr, "AcquireTouchScreenAsyncWakeCompletedEvent"}, //20.0.0+ - {1323, nullptr, "StartTouchScreenAutoTuneForSystemSettings"}, //21.0.0+ - {1324, nullptr, "AcquireTouchScreenAutoTuneCompletedEvent"}, //21.0.0+ - {1325, nullptr, "IsTouchScreenAutoTuneRequiredForRepairProviderReplacement"}, //21.0.0+ - {1326, nullptr, "SetTouchScreenOffset"}, //21.0.0+ - {1420, nullptr, "GetAppletResourceProperty"}, //19.0.0+ - {12010, nullptr, "SetButtonConfigLeft"} //11.0.0-17.0.1 - }; - // clang-format on - - RegisterHandlers(functions); joy_detach_event = service_context.CreateEvent("IHidSystemServer::JoyDetachEvent"); acquire_device_registered_event = diff --git a/src/core/hle/service/hid/hid_system_server.h b/src/core/hle/service/hid/hid_system_server.h index 1a4f244d72..e5da7bbdac 100644 --- a/src/core/hle/service/hid/hid_system_server.h +++ b/src/core/hle/service/hid/hid_system_server.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -81,6 +84,252 @@ private: std::shared_ptr GetResourceManager(); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{31, nullptr, "SendKeyboardLockKeyEvent"}, + FunctionInfo{101, nullptr, "AcquireHomeButtonEventHandle"}, + FunctionInfo{111, nullptr, "ActivateHomeButton"}, + FunctionInfo{121, nullptr, "AcquireSleepButtonEventHandle"}, + FunctionInfo{131, nullptr, "ActivateSleepButton"}, + FunctionInfo{141, nullptr, "AcquireCaptureButtonEventHandle"}, + FunctionInfo{151, nullptr, "ActivateCaptureButton"}, + FunctionInfo{161, &IHidSystemServer::GetPlatformConfig, "GetPlatformConfig"}, + FunctionInfo{210, nullptr, "AcquireNfcDeviceUpdateEventHandle"}, + FunctionInfo{211, nullptr, "GetNpadsWithNfc"}, + FunctionInfo{212, nullptr, "AcquireNfcActivateEventHandle"}, + FunctionInfo{213, nullptr, "ActivateNfc"}, + FunctionInfo{214, nullptr, "GetXcdHandleForNpadWithNfc"}, + FunctionInfo{215, nullptr, "IsNfcActivated"}, + FunctionInfo{216, nullptr, "GetAbstractedPadIdForNpadWithNfc"}, + FunctionInfo{217, nullptr, "SetNfcEvent"}, + FunctionInfo{218, nullptr, "GetNfcInfo"}, + FunctionInfo{219, nullptr, "StartNfcDiscovery"}, + FunctionInfo{220, nullptr, "StopNfcDiscovery"}, + FunctionInfo{221, nullptr, "StartNtagRead"}, + FunctionInfo{222, nullptr, "StartNtagWrite"}, + FunctionInfo{223, nullptr, "SendNfcRawData"}, + FunctionInfo{224, nullptr, "RegisterMifareKey"}, + FunctionInfo{225, nullptr, "ClearMifareKey"}, + FunctionInfo{226, nullptr, "StartMifareRead"}, + FunctionInfo{227, nullptr, "StartMifareWrite"}, + FunctionInfo{230, nullptr, "AcquireIrSensorEventHndle" }, + FunctionInfo{231, nullptr, "ActivateIrSensor"}, + FunctionInfo{232, nullptr, "GetIrSensorState"}, + FunctionInfo{233, nullptr, "GetXcdHandleForNpadWihIrSensor" }, + FunctionInfo{234, nullptr, "GetNpadJoyHoldType"}, + FunctionInfo{241, nullptr, "GetDataFormat"}, + FunctionInfo{242, nullptr, "SetDataFormat"}, + FunctionInfo{243, nullptr, "GetMcuState"}, + FunctionInfo{244, nullptr, "SetMcuState"}, + FunctionInfo{245, nullptr, "GetMcuVersionForNfc"}, + FunctionInfo{246, nullptr, "CheckNfcDevicePower"}, + FunctionInfo{247, nullptr, "SetMcuStateImmediate"}, + FunctionInfo{301, nullptr, "ActivateNpadSystem"}, + FunctionInfo{303, &IHidSystemServer::ApplyNpadSystemCommonPolicy, "ApplyNpadSystemCommonPolicy"}, + FunctionInfo{304, &IHidSystemServer::EnableAssigningSingleOnSlSrPress, "EnableAssigningSingleOnSlSrPress"}, + FunctionInfo{305, &IHidSystemServer::DisableAssigningSingleOnSlSrPress, "DisableAssigningSingleOnSlSrPress"}, + FunctionInfo{306, &IHidSystemServer::GetLastActiveNpad, "GetLastActiveNpad"}, + FunctionInfo{307, nullptr, "GetNpadSystemExtStyle"}, + FunctionInfo{308, &IHidSystemServer::ApplyNpadSystemCommonPolicyFull, "ApplyNpadSystemCommonPolicyFull"}, + FunctionInfo{309, &IHidSystemServer::GetNpadFullKeyGripColor, "GetNpadFullKeyGripColor"}, + FunctionInfo{310, &IHidSystemServer::GetMaskedSupportedNpadStyleSet, "GetMaskedSupportedNpadStyleSet"}, + FunctionInfo{311, nullptr, "SetNpadPlayerLedBlinkingDevice"}, + FunctionInfo{312, &IHidSystemServer::SetSupportedNpadStyleSetAll, "SetSupportedNpadStyleSetAll"}, + FunctionInfo{313, &IHidSystemServer::GetNpadCaptureButtonAssignment, "GetNpadCaptureButtonAssignment"}, + FunctionInfo{314, nullptr, "GetAppletFooterUiType"}, + FunctionInfo{315, &IHidSystemServer::GetAppletDetailedUiType, "GetAppletDetailedUiType"}, + FunctionInfo{316, &IHidSystemServer::GetNpadInterfaceType, "GetNpadInterfaceType"}, + FunctionInfo{317, &IHidSystemServer::GetNpadLeftRightInterfaceType, "GetNpadLeftRightInterfaceType"}, + FunctionInfo{318, &IHidSystemServer::HasBattery, "HasBattery"}, + FunctionInfo{319, &IHidSystemServer::HasLeftRightBattery, "HasLeftRightBattery"}, + FunctionInfo{321, &IHidSystemServer::GetUniquePadsFromNpad, "GetUniquePadsFromNpad"}, + FunctionInfo{322, &IHidSystemServer::SetNpadSystemExtStateEnabled, "SetNpadSystemExtStateEnabled"}, + FunctionInfo{323, nullptr, "GetLastActiveUniquePad"}, + FunctionInfo{324, nullptr, "GetUniquePadButtonSet"}, + FunctionInfo{325, nullptr, "GetUniquePadColor"}, + FunctionInfo{326, nullptr, "GetUniquePadAppletDetailedUiType"}, + FunctionInfo{327, nullptr, "GetAbstractedPadIdDataFromNpad"}, + FunctionInfo{328, nullptr, "AttachAbstractedPadToNpad"}, + FunctionInfo{329, nullptr, "DetachAbstractedPadAll"}, + FunctionInfo{330, nullptr, "CheckAbstractedPadConnection"}, + FunctionInfo{332, nullptr, "ConvertAppletDetailedUiTypeFromPlayReportType", MakeVersionGate({19,0,0})}, + FunctionInfo{333, nullptr, "SetNpadUserSpgApplet", MakeVersionGate({20,0,0})}, + FunctionInfo{334, nullptr, "AcquireUniquePadButtonStateChangedEventHandle", MakeVersionGate({20,0,0})}, + FunctionInfo{501, &IHidSystemServer::RegisterAppletResourceUserId, "RegisterAppletResourceUserId"}, + FunctionInfo{502, &IHidSystemServer::UnregisterAppletResourceUserId, "UnregisterAppletResourceUserId"}, + FunctionInfo{503, &IHidSystemServer::EnableAppletToGetInput, "EnableAppletToGetInput"}, + FunctionInfo{504, &IHidSystemServer::SetAruidValidForVibration, "SetAruidValidForVibration"}, + FunctionInfo{505, &IHidSystemServer::EnableAppletToGetSixAxisSensor, "EnableAppletToGetSixAxisSensor"}, + FunctionInfo{506, &IHidSystemServer::EnableAppletToGetPadInput, "EnableAppletToGetPadInput"}, + FunctionInfo{507, &IHidSystemServer::EnableAppletToGetTouchScreen, "EnableAppletToGetTouchScreen"}, + FunctionInfo{510, &IHidSystemServer::SetVibrationMasterVolume, "SetVibrationMasterVolume"}, + FunctionInfo{511, &IHidSystemServer::GetVibrationMasterVolume, "GetVibrationMasterVolume"}, + FunctionInfo{512, &IHidSystemServer::BeginPermitVibrationSession, "BeginPermitVibrationSession"}, + FunctionInfo{513, &IHidSystemServer::EndPermitVibrationSession, "EndPermitVibrationSession"}, + FunctionInfo{514, nullptr, "Unknown514"}, + FunctionInfo{520, nullptr, "EnableHandheldHids"}, + FunctionInfo{521, nullptr, "DisableHandheldHids"}, + FunctionInfo{522, nullptr, "SetJoyConRailEnabled"}, + FunctionInfo{523, &IHidSystemServer::IsJoyConRailEnabled, "IsJoyConRailEnabled"}, + FunctionInfo{524, nullptr, "IsHandheldHidsEnabled"}, + FunctionInfo{525, &IHidSystemServer::IsJoyConAttachedOnAllRail, "IsJoyConAttachedOnAllRail"}, + FunctionInfo{540, nullptr, "AcquirePlayReportControllerUsageUpdateEvent"}, + FunctionInfo{541, nullptr, "GetPlayReportControllerUsages"}, + FunctionInfo{542, nullptr, "AcquirePlayReportRegisteredDeviceUpdateEvent"}, + FunctionInfo{543, nullptr, "GetRegisteredDevicesOld"}, + FunctionInfo{544, &IHidSystemServer::AcquireConnectionTriggerTimeoutEvent, "AcquireConnectionTriggerTimeoutEvent"}, + FunctionInfo{545, nullptr, "SendConnectionTrigger"}, + FunctionInfo{546, &IHidSystemServer::AcquireDeviceRegisteredEventForControllerSupport, "AcquireDeviceRegisteredEventForControllerSupport"}, + FunctionInfo{547, nullptr, "GetAllowedBluetoothLinksCount"}, + FunctionInfo{548, &IHidSystemServer::GetRegisteredDevices, "GetRegisteredDevices"}, + FunctionInfo{549, nullptr, "GetConnectableRegisteredDevices"}, + FunctionInfo{551, &IHidSystemServer::GetRegisteredDevices, "GetRegisteredDevicesForControllerSupport", MakeVersionGate({20,0,0})}, //mocked via 548 for Diablo 3 (at least) + FunctionInfo{700, nullptr, "ActivateUniquePad"}, + FunctionInfo{702, &IHidSystemServer::AcquireUniquePadConnectionEventHandle, "AcquireUniquePadConnectionEventHandle"}, + FunctionInfo{703, &IHidSystemServer::GetUniquePadIds, "GetUniquePadIds"}, + FunctionInfo{711, nullptr, "AcquireUniquePadConnectionOnHandheldForNsEventHandle", MakeVersionGate({20,0,0})}, + FunctionInfo{712, nullptr, "GetUniquePadColor12", MakeVersionGate({20,0,0})}, + FunctionInfo{751, &IHidSystemServer::AcquireJoyDetachOnBluetoothOffEventHandle, "AcquireJoyDetachOnBluetoothOffEventHandle"}, + FunctionInfo{800, nullptr, "ListSixAxisSensorHandles"}, + FunctionInfo{801, nullptr, "IsSixAxisSensorUserCalibrationSupported"}, + FunctionInfo{802, nullptr, "ResetSixAxisSensorCalibrationValues"}, + FunctionInfo{803, nullptr, "StartSixAxisSensorUserCalibration"}, + FunctionInfo{804, nullptr, "CancelSixAxisSensorUserCalibration"}, + FunctionInfo{805, nullptr, "GetUniquePadBluetoothAddress"}, + FunctionInfo{806, nullptr, "DisconnectUniquePad"}, + FunctionInfo{807, nullptr, "GetUniquePadType"}, + FunctionInfo{808, nullptr, "GetUniquePadInterface"}, + FunctionInfo{809, nullptr, "GetUniquePadSerialNumber"}, + FunctionInfo{810, nullptr, "GetUniquePadControllerNumber"}, + FunctionInfo{811, nullptr, "GetSixAxisSensorUserCalibrationStage"}, + FunctionInfo{812, nullptr, "GetConsoleUniqueSixAxisSensorHandle"}, + FunctionInfo{813, nullptr, "GetDeviceType"}, + FunctionInfo{821, nullptr, "StartAnalogStickManualCalibration"}, + FunctionInfo{822, nullptr, "RetryCurrentAnalogStickManualCalibrationStage"}, + FunctionInfo{823, nullptr, "CancelAnalogStickManualCalibration"}, + FunctionInfo{824, nullptr, "ResetAnalogStickManualCalibration"}, + FunctionInfo{825, nullptr, "GetAnalogStickState"}, + FunctionInfo{826, nullptr, "GetAnalogStickManualCalibrationStage"}, + FunctionInfo{827, nullptr, "IsAnalogStickButtonPressed"}, + FunctionInfo{828, nullptr, "IsAnalogStickInReleasePosition"}, + FunctionInfo{829, nullptr, "IsAnalogStickInCircumference"}, + FunctionInfo{830, nullptr, "SetNotificationLedPattern"}, + FunctionInfo{831, nullptr, "SetNotificationLedPatternWithTimeout"}, + FunctionInfo{832, nullptr, "PrepareHidsForNotificationWake"}, + FunctionInfo{850, &IHidSystemServer::IsUsbFullKeyControllerEnabled, "IsUsbFullKeyControllerEnabled"}, + FunctionInfo{851, &IHidSystemServer::EnableUsbFullKeyController, "EnableUsbFullKeyController"}, + FunctionInfo{852, nullptr, "IsUsbConnected"}, + FunctionInfo{870, &IHidSystemServer::IsHandheldButtonPressedOnConsoleMode, "IsHandheldButtonPressedOnConsoleMode"}, + FunctionInfo{900, nullptr, "ActivateInputDetector"}, + FunctionInfo{901, nullptr, "NotifyInputDetector"}, + FunctionInfo{1000, &IHidSystemServer::InitializeFirmwareUpdate, "InitializeFirmwareUpdate"}, + FunctionInfo{1001, nullptr, "GetFirmwareVersion"}, + FunctionInfo{1002, nullptr, "GetAvailableFirmwareVersion"}, + FunctionInfo{1003, nullptr, "IsFirmwareUpdateAvailable"}, + FunctionInfo{1004, &IHidSystemServer::CheckFirmwareUpdateRequired, "CheckFirmwareUpdateRequired"}, + FunctionInfo{1005, nullptr, "StartFirmwareUpdate"}, + FunctionInfo{1006, nullptr, "AbortFirmwareUpdate"}, + FunctionInfo{1007, nullptr, "GetFirmwareUpdateState"}, + FunctionInfo{1008, nullptr, "ActivateAudioControl"}, + FunctionInfo{1009, nullptr, "AcquireAudioControlEventHandle"}, + FunctionInfo{1010, nullptr, "GetAudioControlStates"}, + FunctionInfo{1011, nullptr, "DeactivateAudioControl"}, + FunctionInfo{1012, nullptr, "GetFirmwareVersionStringForUserSupportPage"}, + FunctionInfo{1050, nullptr, "IsSixAxisSensorAccurateUserCalibrationSupported"}, + FunctionInfo{1051, nullptr, "StartSixAxisSensorAccurateUserCalibration"}, + FunctionInfo{1052, nullptr, "CancelSixAxisSensorAccurateUserCalibration"}, + FunctionInfo{1053, nullptr, "GetSixAxisSensorAccurateUserCalibrationState"}, + FunctionInfo{1100, nullptr, "GetHidbusSystemServiceObject"}, + FunctionInfo{1120, &IHidSystemServer::SetFirmwareHotfixUpdateSkipEnabled, "SetFirmwareHotfixUpdateSkipEnabled"}, + FunctionInfo{1130, &IHidSystemServer::InitializeUsbFirmwareUpdate, "InitializeUsbFirmwareUpdate"}, + FunctionInfo{1131, &IHidSystemServer::FinalizeUsbFirmwareUpdate, "FinalizeUsbFirmwareUpdate"}, + FunctionInfo{1132, &IHidSystemServer::CheckUsbFirmwareUpdateRequired, "CheckUsbFirmwareUpdateRequired"}, + FunctionInfo{1133, nullptr, "StartUsbFirmwareUpdate"}, + FunctionInfo{1134, nullptr, "GetUsbFirmwareUpdateState"}, + FunctionInfo{1135, &IHidSystemServer::InitializeUsbFirmwareUpdateWithoutMemory, "InitializeUsbFirmwareUpdateWithoutMemory"}, + FunctionInfo{1150, &IHidSystemServer::SetTouchScreenMagnification, "SetTouchScreenMagnification"}, + FunctionInfo{1151, &IHidSystemServer::GetTouchScreenFirmwareVersion, "GetTouchScreenFirmwareVersion"}, + FunctionInfo{1152, &IHidSystemServer::SetTouchScreenDefaultConfiguration, "SetTouchScreenDefaultConfiguration"}, + FunctionInfo{1153, &IHidSystemServer::GetTouchScreenDefaultConfiguration, "GetTouchScreenDefaultConfiguration"}, + FunctionInfo{1154, nullptr, "IsFirmwareAvailableForNotification"}, + FunctionInfo{1155, &IHidSystemServer::SetForceHandheldStyleVibration, "SetForceHandheldStyleVibration"}, + FunctionInfo{1156, nullptr, "SendConnectionTriggerWithoutTimeoutEvent"}, + FunctionInfo{1157, nullptr, "CancelConnectionTrigger"}, + FunctionInfo{1158, nullptr, "SetConnectionLimitForSplay", MakeVersionGate({20,1,0})}, + FunctionInfo{1159, nullptr, "ClearConnectionLimitForSplay", MakeVersionGate({20,1,0})}, + FunctionInfo{1200, nullptr, "IsButtonConfigSupported"}, + FunctionInfo{1201, nullptr, "IsButtonConfigEmbeddedSupported"}, + FunctionInfo{1202, nullptr, "DeleteButtonConfig"}, + FunctionInfo{1203, nullptr, "DeleteButtonConfigEmbedded"}, + FunctionInfo{1204, nullptr, "SetButtonConfigEnabled"}, + FunctionInfo{1205, nullptr, "SetButtonConfigEmbeddedEnabled"}, + FunctionInfo{1206, nullptr, "IsButtonConfigEnabled"}, + FunctionInfo{1207, nullptr, "IsButtonConfigEmbeddedEnabled"}, + FunctionInfo{1208, nullptr, "SetButtonConfigEmbedded"}, + FunctionInfo{1209, nullptr, "SetButtonConfigFull"}, + FunctionInfo{1210, nullptr, "SetButtonConfigLeft"}, + FunctionInfo{1211, nullptr, "SetButtonConfigRight"}, + FunctionInfo{1212, nullptr, "GetButtonConfigEmbedded"}, + FunctionInfo{1213, nullptr, "GetButtonConfigFull"}, + FunctionInfo{1214, nullptr, "GetButtonConfigLeft"}, + FunctionInfo{1215, nullptr, "GetButtonConfigRight"}, + FunctionInfo{1250, nullptr, "IsCustomButtonConfigSupported"}, + FunctionInfo{1251, nullptr, "IsDefaultButtonConfigEmbedded"}, + FunctionInfo{1252, nullptr, "IsDefaultButtonConfigFull"}, + FunctionInfo{1253, nullptr, "IsDefaultButtonConfigLeft"}, + FunctionInfo{1254, nullptr, "IsDefaultButtonConfigRight"}, + FunctionInfo{1255, nullptr, "IsButtonConfigStorageEmbeddedEmpty"}, + FunctionInfo{1256, nullptr, "IsButtonConfigStorageFullEmpty"}, + FunctionInfo{1257, nullptr, "IsButtonConfigStorageLeftEmpty"}, + FunctionInfo{1258, nullptr, "IsButtonConfigStorageRightEmpty"}, + FunctionInfo{1259, nullptr, "GetButtonConfigStorageEmbeddedDeprecated"}, + FunctionInfo{1260, nullptr, "GetButtonConfigStorageFullDeprecated"}, + FunctionInfo{1261, nullptr, "GetButtonConfigStorageLeftDeprecated"}, + FunctionInfo{1262, nullptr, "GetButtonConfigStorageRightDeprecated"}, + FunctionInfo{1263, nullptr, "SetButtonConfigStorageEmbeddedDeprecated"}, + FunctionInfo{1264, nullptr, "SetButtonConfigStorageFullDeprecated"}, + FunctionInfo{1265, nullptr, "SetButtonConfigStorageLeftDeprecated"}, + FunctionInfo{1266, nullptr, "SetButtonConfigStorageRightDeprecated"}, + FunctionInfo{1267, nullptr, "DeleteButtonConfigStorageEmbedded"}, + FunctionInfo{1268, nullptr, "DeleteButtonConfigStorageFull"}, + FunctionInfo{1269, nullptr, "DeleteButtonConfigStorageLeft"}, + FunctionInfo{1270, nullptr, "DeleteButtonConfigStorageRight"}, + FunctionInfo{1271, &IHidSystemServer::IsUsingCustomButtonConfig, "IsUsingCustomButtonConfig"}, + FunctionInfo{1272, &IHidSystemServer::IsAnyCustomButtonConfigEnabled, "IsAnyCustomButtonConfigEnabled"}, + FunctionInfo{1273, nullptr, "SetAllCustomButtonConfigEnabled"}, + FunctionInfo{1274, nullptr, "SetDefaultButtonConfig"}, + FunctionInfo{1275, nullptr, "SetAllDefaultButtonConfig"}, + FunctionInfo{1276, nullptr, "SetHidButtonConfigEmbedded"}, + FunctionInfo{1277, nullptr, "SetHidButtonConfigFull"}, + FunctionInfo{1278, nullptr, "SetHidButtonConfigLeft"}, + FunctionInfo{1279, nullptr, "SetHidButtonConfigRight"}, + FunctionInfo{1280, nullptr, "GetHidButtonConfigEmbedded"}, + FunctionInfo{1281, nullptr, "GetHidButtonConfigFull"}, + FunctionInfo{1282, nullptr, "GetHidButtonConfigLeft"}, + FunctionInfo{1283, nullptr, "GetHidButtonConfigRight"}, + FunctionInfo{1284, nullptr, "GetButtonConfigStorageEmbedded"}, + FunctionInfo{1285, nullptr, "GetButtonConfigStorageFull"}, + FunctionInfo{1286, nullptr, "GetButtonConfigStorageLeft"}, + FunctionInfo{1287, nullptr, "GetButtonConfigStorageRight"}, + FunctionInfo{1288, nullptr, "SetButtonConfigStorageEmbedded"}, + FunctionInfo{1289, nullptr, "SetButtonConfigStorageFull"}, + FunctionInfo{1290, nullptr, "DeleteButtonConfigStorageRight"}, + FunctionInfo{1291, nullptr, "DeleteButtonConfigStorageRight"}, + FunctionInfo{1308, nullptr, "SetButtonConfigVisible", MakeVersionGate({18,0,0})}, + FunctionInfo{1309, nullptr, "IsButtonConfigVisible", MakeVersionGate({18,0,0})}, + FunctionInfo{1320, nullptr, "WakeTouchScreenUp", MakeVersionGate({17,0,0})}, + FunctionInfo{1321, nullptr, "PutTouchScreenToSleep", MakeVersionGate({17,0,0})}, + FunctionInfo{1322, nullptr, "AcquireTouchScreenAsyncWakeCompletedEvent", MakeVersionGate({20,0,0})}, + FunctionInfo{1323, nullptr, "StartTouchScreenAutoTuneForSystemSettings", MakeVersionGate({21,0,0})}, + FunctionInfo{1324, nullptr, "AcquireTouchScreenAutoTuneCompletedEvent", MakeVersionGate({21,0,0})}, + FunctionInfo{1325, nullptr, "IsTouchScreenAutoTuneRequiredForRepairProviderReplacement", MakeVersionGate({21,0,0})}, + FunctionInfo{1326, nullptr, "SetTouchScreenOffset", MakeVersionGate({21,0,0})}, + FunctionInfo{1420, nullptr, "GetAppletResourceProperty", MakeVersionGate({19,0,0})}, + FunctionInfo{12010, nullptr, "SetButtonConfigLeft", MakeVersionGate({11,0,0}, {17,0,1})} + ); + Kernel::KEvent* acquire_connection_trigger_timeout_event; Kernel::KEvent* acquire_device_registered_event; Kernel::KEvent* joy_detach_event; diff --git a/src/core/hle/service/hid/hidbus.cpp b/src/core/hle/service/hid/hidbus.cpp index 70bb5437e3..326cfbf74b 100644 --- a/src/core/hle/service/hid/hidbus.cpp +++ b/src/core/hle/service/hid/hidbus.cpp @@ -26,30 +26,28 @@ namespace Service::HID { // (15ms, 66Hz) constexpr auto hidbus_update_ns = std::chrono::nanoseconds{15 * 1000 * 1000}; +std::optional Hidbus::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{1, C<&Hidbus::GetBusHandle>, "GetBusHandle"}, + FunctionInfo{2, C<&Hidbus::IsExternalDeviceConnected>, "IsExternalDeviceConnected"}, + FunctionInfo{3, C<&Hidbus::Initialize>, "Initialize"}, + FunctionInfo{4, C<&Hidbus::Finalize>, "Finalize"}, + FunctionInfo{5, C<&Hidbus::EnableExternalDevice>, "EnableExternalDevice"}, + FunctionInfo{6, C<&Hidbus::GetExternalDeviceId>, "GetExternalDeviceId"}, + FunctionInfo{7, C<&Hidbus::SendCommandAsync>, "SendCommandAsync"}, + FunctionInfo{8, C<&Hidbus::GetSendCommandAsynceResult>, "GetSendCommandAsynceResult"}, + FunctionInfo{9, C<&Hidbus::SetEventForSendCommandAsycResult>, "SetEventForSendCommandAsycResult"}, + FunctionInfo{10, C<&Hidbus::GetSharedMemoryHandle>, "GetSharedMemoryHandle"}, + FunctionInfo{11, C<&Hidbus::EnableJoyPollingReceiveMode>, "EnableJoyPollingReceiveMode"}, + FunctionInfo{12, C<&Hidbus::DisableJoyPollingReceiveMode>, "DisableJoyPollingReceiveMode"}, + FunctionInfo{13, nullptr, "GetPollingData"}, + FunctionInfo{14, C<&Hidbus::SetStatusManagerType>, "SetStatusManagerType"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + Hidbus::Hidbus(Core::System& system_) : ServiceFramework{system_, "hidbus"}, service_context{system_, service_name} { - - // clang-format off - static const FunctionInfo functions[] = { - {1, C<&Hidbus::GetBusHandle>, "GetBusHandle"}, - {2, C<&Hidbus::IsExternalDeviceConnected>, "IsExternalDeviceConnected"}, - {3, C<&Hidbus::Initialize>, "Initialize"}, - {4, C<&Hidbus::Finalize>, "Finalize"}, - {5, C<&Hidbus::EnableExternalDevice>, "EnableExternalDevice"}, - {6, C<&Hidbus::GetExternalDeviceId>, "GetExternalDeviceId"}, - {7, C<&Hidbus::SendCommandAsync>, "SendCommandAsync"}, - {8, C<&Hidbus::GetSendCommandAsynceResult>, "GetSendCommandAsynceResult"}, - {9, C<&Hidbus::SetEventForSendCommandAsycResult>, "SetEventForSendCommandAsycResult"}, - {10, C<&Hidbus::GetSharedMemoryHandle>, "GetSharedMemoryHandle"}, - {11, C<&Hidbus::EnableJoyPollingReceiveMode>, "EnableJoyPollingReceiveMode"}, - {12, C<&Hidbus::DisableJoyPollingReceiveMode>, "DisableJoyPollingReceiveMode"}, - {13, nullptr, "GetPollingData"}, - {14, C<&Hidbus::SetStatusManagerType>, "SetStatusManagerType"}, - }; - // clang-format on - - RegisterHandlers(functions); - // Register update callbacks hidbus_update_event = Core::Timing::CreateEvent( "Hidbus::UpdateCallback", diff --git a/src/core/hle/service/hid/hidbus.h b/src/core/hle/service/hid/hidbus.h index af4d956673..9ad097150e 100644 --- a/src/core/hle/service/hid/hidbus.h +++ b/src/core/hle/service/hid/hidbus.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -144,6 +147,8 @@ private: } } + std::optional FindRequest(u32 key) override; + bool is_hidbus_enabled{false}; HidbusStatusManager hidbus_status{}; std::array devices{}; diff --git a/src/core/hle/service/hid/irs.cpp b/src/core/hle/service/hid/irs.cpp index 3d87e6788d..a17395b596 100644 --- a/src/core/hle/service/hid/irs.cpp +++ b/src/core/hle/service/hid/irs.cpp @@ -29,32 +29,32 @@ namespace Service::IRS { -IRS::IRS(Core::System& system_) : ServiceFramework{system_, "irs"} { - // clang-format off - static const FunctionInfo functions[] = { - {302, C<&IRS::ActivateIrsensor>, "ActivateIrsensor"}, - {303, C<&IRS::DeactivateIrsensor>, "DeactivateIrsensor"}, - {304, C<&IRS::GetIrsensorSharedMemoryHandle>, "GetIrsensorSharedMemoryHandle"}, - {305, C<&IRS::StopImageProcessor>, "StopImageProcessor"}, - {306, C<&IRS::RunMomentProcessor>, "RunMomentProcessor"}, - {307, C<&IRS::RunClusteringProcessor>, "RunClusteringProcessor"}, - {308, C<&IRS::RunImageTransferProcessor>, "RunImageTransferProcessor"}, - {309, C<&IRS::GetImageTransferProcessorState>, "GetImageTransferProcessorState"}, - {310, C<&IRS::RunTeraPluginProcessor>, "RunTeraPluginProcessor"}, - {311, C<&IRS::GetNpadIrCameraHandle>, "GetNpadIrCameraHandle"}, - {312, C<&IRS::RunPointingProcessor>, "RunPointingProcessor"}, - {313, C<&IRS::SuspendImageProcessor>, "SuspendImageProcessor"}, - {314, C<&IRS::CheckFirmwareVersion>, "CheckFirmwareVersion"}, - {315, C<&IRS::SetFunctionLevel>, "SetFunctionLevel"}, - {316, C<&IRS::RunImageTransferExProcessor>, "RunImageTransferExProcessor"}, - {317, C<&IRS::RunIrLedProcessor>, "RunIrLedProcessor"}, - {318, C<&IRS::StopImageProcessorAsync>, "StopImageProcessorAsync"}, - {319, C<&IRS::ActivateIrsensorWithFunctionLevel>, "ActivateIrsensorWithFunctionLevel"}, - }; - // clang-format on +std::optional IRS::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{302, C<&IRS::ActivateIrsensor>, "ActivateIrsensor"}, + FunctionInfo{303, C<&IRS::DeactivateIrsensor>, "DeactivateIrsensor"}, + FunctionInfo{304, C<&IRS::GetIrsensorSharedMemoryHandle>, "GetIrsensorSharedMemoryHandle"}, + FunctionInfo{305, C<&IRS::StopImageProcessor>, "StopImageProcessor"}, + FunctionInfo{306, C<&IRS::RunMomentProcessor>, "RunMomentProcessor"}, + FunctionInfo{307, C<&IRS::RunClusteringProcessor>, "RunClusteringProcessor"}, + FunctionInfo{308, C<&IRS::RunImageTransferProcessor>, "RunImageTransferProcessor"}, + FunctionInfo{309, C<&IRS::GetImageTransferProcessorState>, "GetImageTransferProcessorState"}, + FunctionInfo{310, C<&IRS::RunTeraPluginProcessor>, "RunTeraPluginProcessor"}, + FunctionInfo{311, C<&IRS::GetNpadIrCameraHandle>, "GetNpadIrCameraHandle"}, + FunctionInfo{312, C<&IRS::RunPointingProcessor>, "RunPointingProcessor"}, + FunctionInfo{313, C<&IRS::SuspendImageProcessor>, "SuspendImageProcessor"}, + FunctionInfo{314, C<&IRS::CheckFirmwareVersion>, "CheckFirmwareVersion"}, + FunctionInfo{315, C<&IRS::SetFunctionLevel>, "SetFunctionLevel"}, + FunctionInfo{316, C<&IRS::RunImageTransferExProcessor>, "RunImageTransferExProcessor"}, + FunctionInfo{317, C<&IRS::RunIrLedProcessor>, "RunIrLedProcessor"}, + FunctionInfo{318, C<&IRS::StopImageProcessorAsync>, "StopImageProcessorAsync"}, + FunctionInfo{319, C<&IRS::ActivateIrsensorWithFunctionLevel>, "ActivateIrsensorWithFunctionLevel"} + ); + return HandlerTableGenerateWithFind(key, functions); +} +IRS::IRS(Core::System& system_) : ServiceFramework{system_, "irs"} { u8* raw_shared_memory = system.Kernel().GetIrsSharedMem().GetPointer(); - RegisterHandlers(functions); shared_memory = std::construct_at(reinterpret_cast(raw_shared_memory)); npad_device = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1); @@ -369,16 +369,6 @@ Core::IrSensor::DeviceFormat& IRS::GetIrCameraSharedMemoryDeviceEntry( } IRS_SYS::IRS_SYS(Core::System& system_) : ServiceFramework{system_, "irs:sys"} { - // clang-format off - static const FunctionInfo functions[] = { - {500, nullptr, "SetAppletResourceUserId"}, - {501, nullptr, "RegisterAppletResourceUserId"}, - {502, nullptr, "UnregisterAppletResourceUserId"}, - {503, nullptr, "EnableAppletToGetInput"}, - }; - // clang-format on - - RegisterHandlers(functions); } IRS_SYS::~IRS_SYS() = default; diff --git a/src/core/hle/service/hid/irs.h b/src/core/hle/service/hid/irs.h index 58dfee6c36..be81ea75a9 100644 --- a/src/core/hle/service/hid/irs.h +++ b/src/core/hle/service/hid/irs.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -154,6 +157,8 @@ private: return static_cast(*processors[index]); } + std::optional FindRequest(u32 key) override; + Core::HID::EmulatedController* npad_device = nullptr; StatusManager* shared_memory = nullptr; std::array, 9> processors{}; @@ -163,6 +168,16 @@ class IRS_SYS final : public ServiceFramework { public: explicit IRS_SYS(Core::System& system); ~IRS_SYS() override; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{500, nullptr, "SetAppletResourceUserId"}, + FunctionInfo{501, nullptr, "RegisterAppletResourceUserId"}, + FunctionInfo{502, nullptr, "UnregisterAppletResourceUserId"}, + FunctionInfo{503, nullptr, "EnableAppletToGetInput"} + ); }; } // namespace Service::IRS diff --git a/src/core/hle/service/hid/xcd.cpp b/src/core/hle/service/hid/xcd.cpp index 75cc266ea9..6b8ae7048c 100644 --- a/src/core/hle/service/hid/xcd.cpp +++ b/src/core/hle/service/hid/xcd.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -6,33 +9,6 @@ namespace Service::HID { XCD_SYS::XCD_SYS(Core::System& system_) : ServiceFramework{system_, "xcd:sys"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetDataFormat"}, - {1, nullptr, "SetDataFormat"}, - {2, nullptr, "GetMcuState"}, - {3, nullptr, "SetMcuState"}, - {4, nullptr, "GetMcuVersionForNfc"}, - {5, nullptr, "CheckNfcDevicePower"}, - {10, nullptr, "SetNfcEvent"}, - {11, nullptr, "GetNfcInfo"}, - {12, nullptr, "StartNfcDiscovery"}, - {13, nullptr, "StopNfcDiscovery"}, - {14, nullptr, "StartNtagRead"}, - {15, nullptr, "StartNtagWrite"}, - {16, nullptr, "SendNfcRawData"}, - {17, nullptr, "RegisterMifareKey"}, - {18, nullptr, "ClearMifareKey"}, - {19, nullptr, "StartMifareRead"}, - {20, nullptr, "StartMifareWrite"}, - {101, nullptr, "GetAwakeTriggerReasonForLeftRail"}, - {102, nullptr, "GetAwakeTriggerReasonForRightRail"}, - {103, nullptr, "GetAwakeTriggerBatteryLevelTransitionForLeftRail"}, - {104, nullptr, "GetAwakeTriggerBatteryLevelTransitionForRightRail"}, - }; - // clang-format on - - RegisterHandlers(functions); } XCD_SYS::~XCD_SYS() = default; diff --git a/src/core/hle/service/hid/xcd.h b/src/core/hle/service/hid/xcd.h index fe0b91b919..af1dd88ef7 100644 --- a/src/core/hle/service/hid/xcd.h +++ b/src/core/hle/service/hid/xcd.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -15,6 +18,33 @@ class XCD_SYS final : public ServiceFramework { public: explicit XCD_SYS(Core::System& system_); ~XCD_SYS() override; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetDataFormat"}, + FunctionInfo{1, nullptr, "SetDataFormat"}, + FunctionInfo{2, nullptr, "GetMcuState"}, + FunctionInfo{3, nullptr, "SetMcuState"}, + FunctionInfo{4, nullptr, "GetMcuVersionForNfc"}, + FunctionInfo{5, nullptr, "CheckNfcDevicePower"}, + FunctionInfo{10, nullptr, "SetNfcEvent"}, + FunctionInfo{11, nullptr, "GetNfcInfo"}, + FunctionInfo{12, nullptr, "StartNfcDiscovery"}, + FunctionInfo{13, nullptr, "StopNfcDiscovery"}, + FunctionInfo{14, nullptr, "StartNtagRead"}, + FunctionInfo{15, nullptr, "StartNtagWrite"}, + FunctionInfo{16, nullptr, "SendNfcRawData"}, + FunctionInfo{17, nullptr, "RegisterMifareKey"}, + FunctionInfo{18, nullptr, "ClearMifareKey"}, + FunctionInfo{19, nullptr, "StartMifareRead"}, + FunctionInfo{20, nullptr, "StartMifareWrite"}, + FunctionInfo{101, nullptr, "GetAwakeTriggerReasonForLeftRail"}, + FunctionInfo{102, nullptr, "GetAwakeTriggerReasonForRightRail"}, + FunctionInfo{103, nullptr, "GetAwakeTriggerBatteryLevelTransitionForLeftRail"}, + FunctionInfo{104, nullptr, "GetAwakeTriggerBatteryLevelTransitionForRightRail"} + ); }; } // namespace Service::HID diff --git a/src/core/hle/service/i2c/i2c.cpp b/src/core/hle/service/i2c/i2c.cpp index 0b242768c2..d0a5e29f8c 100644 --- a/src/core/hle/service/i2c/i2c.cpp +++ b/src/core/hle/service/i2c/i2c.cpp @@ -17,25 +17,26 @@ namespace Service::I2C { class I2CSession final : public ServiceFramework { public: - explicit I2CSession(Core::System& system_) - : ServiceFramework{system_, "I2CSession"} - { - static const FunctionInfo functions[] = { - {0, nullptr, "SendOld"}, - {1, nullptr, "ReceiveOld"}, - {2, nullptr, "ExecuteCommandListOld"}, - {10, C<&I2CSession::Send>, "Send"}, - {11, nullptr, "Receive"}, - {12, nullptr, "ExecuteCommandList"}, - {13, nullptr, "SetRetryPolicy"}, - }; - RegisterHandlers(functions); - } + explicit I2CSession(Core::System& system_) : ServiceFramework{system_, "I2CSession"} {} ~I2CSession() override = default; + Result Send(InBuffer in_data, u32 transaction_option) { LOG_WARNING(Service, "(stubbed) topt={}", transaction_option); R_THROW(ResultUnknown); } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "SendOld"}, + FunctionInfo{1, nullptr, "ReceiveOld"}, + FunctionInfo{2, nullptr, "ExecuteCommandListOld"}, + FunctionInfo{10, C<&I2CSession::Send>, "Send"}, + FunctionInfo{11, nullptr, "Receive"}, + FunctionInfo{12, nullptr, "ExecuteCommandList"}, + FunctionInfo{13, nullptr, "SetRetryPolicy"} + ); }; enum class I2CDevice : u32 { @@ -45,19 +46,9 @@ enum class I2CDevice : u32 { class I2C final : public ServiceFramework { public: - explicit I2C(Core::System& system_) - : ServiceFramework{system_, "i2c"} - { - static const FunctionInfo functions[] = { - {0, C<&I2C::OpenSessionForDev>, "OpenSessionForDev"}, - {1, C<&I2C::OpenSession>, "OpenSession"}, - {2, C<&I2C::HasDevice>, "HasDevice"}, - {3, C<&I2C::HasDeviceForDev>, "HasDeviceForDev"}, - {4, C<&I2C::OpenSession2>, "OpenSession2"}, - }; - RegisterHandlers(functions); - } + explicit I2C(Core::System& system_) : ServiceFramework{system_, "i2c"} {} ~I2C() override = default; + Result OpenSessionForDev(OutInterface out_session, s32 bus_idx, u32 slave_address, u32 addressing_mode, u32 speed_mode) { LOG_DEBUG(Service, "(stubbed)"); *out_session = std::make_shared(system); @@ -83,6 +74,17 @@ public: *out_session = std::make_shared(system); R_SUCCEED(); } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, C<&I2C::OpenSessionForDev>, "OpenSessionForDev"}, + FunctionInfo{1, C<&I2C::OpenSession>, "OpenSession"}, + FunctionInfo{2, C<&I2C::HasDevice>, "HasDevice"}, + FunctionInfo{3, C<&I2C::HasDeviceForDev>, "HasDeviceForDev"}, + FunctionInfo{4, C<&I2C::OpenSession2>, "OpenSession2"} + ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/jit/jit.cpp b/src/core/hle/service/jit/jit.cpp index ec3a3a8dcb..9059aaf518 100644 --- a/src/core/hle/service/jit/jit.cpp +++ b/src/core/hle/service/jit/jit.cpp @@ -37,18 +37,6 @@ public: , user_ro{std::move(user_ro_)} , context{process_->GetMemory()} { - - // clang-format off - static const FunctionInfo functions[] = { - {0, C<&IJitEnvironment::GenerateCode>, "GenerateCode"}, - {1, C<&IJitEnvironment::Control>, "Control"}, - {1000, C<&IJitEnvironment::LoadPlugin>, "LoadPlugin"}, - {1001, C<&IJitEnvironment::GetCodeAddress>, "GetCodeAddress"}, - }; - // clang-format on - - RegisterHandlers(functions); - // Identity map user code range into sysmodule context configuration.user_rx_memory.size = user_rx.GetSize(); configuration.user_rx_memory.offset = user_rx.GetAddress(); @@ -59,6 +47,10 @@ public: configuration.sys_ro_memory = configuration.user_ro_memory; } + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + ~IJitEnvironment() { user_rx.Finalize(system.Kernel()); user_ro.Finalize(system.Kernel()); @@ -248,6 +240,13 @@ private: return in; } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, C<&IJitEnvironment::GenerateCode>, "GenerateCode"}, + FunctionInfo{1, C<&IJitEnvironment::Control>, "Control"}, + FunctionInfo{1000, C<&IJitEnvironment::LoadPlugin>, "LoadPlugin"}, + FunctionInfo{1001, C<&IJitEnvironment::GetCodeAddress>, "GetCodeAddress"} + ); + Kernel::KScopedAutoObject process; CodeMemory user_rx; CodeMemory user_ro; @@ -258,14 +257,10 @@ private: class JITU final : public ServiceFramework { public: - explicit JITU(Core::System& system_) : ServiceFramework{system_, "jit:u"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, C<&JITU::CreateJitEnvironment>, "CreateJitEnvironment"}, - }; - // clang-format on + explicit JITU(Core::System& system_) : ServiceFramework{system_, "jit:u"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -294,6 +289,10 @@ private: } private: + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, C<&JITU::CreateJitEnvironment>, "CreateJitEnvironment"} + ); + std::mt19937_64 generate_random{}; }; diff --git a/src/core/hle/service/lbl/lbl.cpp b/src/core/hle/service/lbl/lbl.cpp index 68a9bff2df..9b245201ff 100644 --- a/src/core/hle/service/lbl/lbl.cpp +++ b/src/core/hle/service/lbl/lbl.cpp @@ -18,43 +18,10 @@ namespace Service::LBL { class LBL final : public ServiceFramework { public: - explicit LBL(Core::System& system_) : ServiceFramework{system_, "lbl"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &LBL::SaveCurrentSetting, "SaveCurrentSetting"}, - {1, &LBL::LoadCurrentSetting, "LoadCurrentSetting"}, - {2, &LBL::SetCurrentBrightnessSetting, "SetCurrentBrightnessSetting"}, - {3, &LBL::GetCurrentBrightnessSetting, "GetCurrentBrightnessSetting"}, - {4, nullptr, "ApplyCurrentBrightnessSettingToBacklight"}, - {5, nullptr, "GetBrightnessSettingAppliedToBacklight"}, - {6, &LBL::SwitchBacklightOn, "SwitchBacklightOn"}, - {7, &LBL::SwitchBacklightOff, "SwitchBacklightOff"}, - {8, &LBL::GetBacklightSwitchStatus, "GetBacklightSwitchStatus"}, - {9, &LBL::EnableDimming, "EnableDimming"}, - {10, &LBL::DisableDimming, "DisableDimming"}, - {11, &LBL::IsDimmingEnabled, "IsDimmingEnabled"}, - {12, &LBL::EnableAutoBrightnessControl, "EnableAutoBrightnessControl"}, - {13, &LBL::DisableAutoBrightnessControl, "DisableAutoBrightnessControl"}, - {14, &LBL::IsAutoBrightnessControlEnabled, "IsAutoBrightnessControlEnabled"}, - {15, &LBL::SetAmbientLightSensorValue, "SetAmbientLightSensorValue"}, - {16, &LBL::GetAmbientLightSensorValue, "GetAmbientLightSensorValue"}, - {17, &LBL::SetBrightnessReflectionDelayLevel, "SetBrightnessReflectionDelayLevel"}, - {18, &LBL::GetBrightnessReflectionDelayLevel, "GetBrightnessReflectionDelayLevel"}, - {19, &LBL::SetCurrentBrightnessMapping, "SetCurrentBrightnessMapping"}, - {20, &LBL::GetCurrentBrightnessMapping, "GetCurrentBrightnessMapping"}, - {21, &LBL::SetCurrentAmbientLightSensorMapping, "SetCurrentAmbientLightSensorMapping"}, - {22, &LBL::GetCurrentAmbientLightSensorMapping, "GetCurrentAmbientLightSensorMapping"}, - {23, &LBL::IsAmbientLightSensorAvailable, "IsAmbientLightSensorAvailable"}, - {24, &LBL::SetCurrentBrightnessSettingForVrMode, "SetCurrentBrightnessSettingForVrMode"}, - {25, &LBL::GetCurrentBrightnessSettingForVrMode, "GetCurrentBrightnessSettingForVrMode"}, - {26, &LBL::EnableVrMode, "EnableVrMode"}, - {27, &LBL::DisableVrMode, "DisableVrMode"}, - {28, &LBL::IsVrModeEnabled, "IsVrModeEnabled"}, - {29, &LBL::IsAutoBrightnessControlSupported, "IsAutoBrightnessControlSupported"}, - }; - // clang-format on + explicit LBL(Core::System& system_) : ServiceFramework{system_, "lbl"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -335,6 +302,38 @@ private: rb.Push(auto_brightness_supported); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &LBL::SaveCurrentSetting, "SaveCurrentSetting"}, + FunctionInfo{1, &LBL::LoadCurrentSetting, "LoadCurrentSetting"}, + FunctionInfo{2, &LBL::SetCurrentBrightnessSetting, "SetCurrentBrightnessSetting"}, + FunctionInfo{3, &LBL::GetCurrentBrightnessSetting, "GetCurrentBrightnessSetting"}, + FunctionInfo{4, nullptr, "ApplyCurrentBrightnessSettingToBacklight"}, + FunctionInfo{5, nullptr, "GetBrightnessSettingAppliedToBacklight"}, + FunctionInfo{6, &LBL::SwitchBacklightOn, "SwitchBacklightOn"}, + FunctionInfo{7, &LBL::SwitchBacklightOff, "SwitchBacklightOff"}, + FunctionInfo{8, &LBL::GetBacklightSwitchStatus, "GetBacklightSwitchStatus"}, + FunctionInfo{9, &LBL::EnableDimming, "EnableDimming"}, + FunctionInfo{10, &LBL::DisableDimming, "DisableDimming"}, + FunctionInfo{11, &LBL::IsDimmingEnabled, "IsDimmingEnabled"}, + FunctionInfo{12, &LBL::EnableAutoBrightnessControl, "EnableAutoBrightnessControl"}, + FunctionInfo{13, &LBL::DisableAutoBrightnessControl, "DisableAutoBrightnessControl"}, + FunctionInfo{14, &LBL::IsAutoBrightnessControlEnabled, "IsAutoBrightnessControlEnabled"}, + FunctionInfo{15, &LBL::SetAmbientLightSensorValue, "SetAmbientLightSensorValue"}, + FunctionInfo{16, &LBL::GetAmbientLightSensorValue, "GetAmbientLightSensorValue"}, + FunctionInfo{17, &LBL::SetBrightnessReflectionDelayLevel, "SetBrightnessReflectionDelayLevel"}, + FunctionInfo{18, &LBL::GetBrightnessReflectionDelayLevel, "GetBrightnessReflectionDelayLevel"}, + FunctionInfo{19, &LBL::SetCurrentBrightnessMapping, "SetCurrentBrightnessMapping"}, + FunctionInfo{20, &LBL::GetCurrentBrightnessMapping, "GetCurrentBrightnessMapping"}, + FunctionInfo{21, &LBL::SetCurrentAmbientLightSensorMapping, "SetCurrentAmbientLightSensorMapping"}, + FunctionInfo{22, &LBL::GetCurrentAmbientLightSensorMapping, "GetCurrentAmbientLightSensorMapping"}, + FunctionInfo{23, &LBL::IsAmbientLightSensorAvailable, "IsAmbientLightSensorAvailable"}, + FunctionInfo{24, &LBL::SetCurrentBrightnessSettingForVrMode, "SetCurrentBrightnessSettingForVrMode"}, + FunctionInfo{25, &LBL::GetCurrentBrightnessSettingForVrMode, "GetCurrentBrightnessSettingForVrMode"}, + FunctionInfo{26, &LBL::EnableVrMode, "EnableVrMode"}, + FunctionInfo{27, &LBL::DisableVrMode, "DisableVrMode"}, + FunctionInfo{28, &LBL::IsVrModeEnabled, "IsVrModeEnabled"}, + FunctionInfo{29, &LBL::IsAutoBrightnessControlSupported, "IsAutoBrightnessControlSupported"} + ); bool vr_mode_enabled = false; float current_brightness = 1.0f; float ambient_light_value = 0.0f; diff --git a/src/core/hle/service/ldn/ldn.cpp b/src/core/hle/service/ldn/ldn.cpp index 1a0165fd2e..838fe85f79 100644 --- a/src/core/hle/service/ldn/ldn.cpp +++ b/src/core/hle/service/ldn/ldn.cpp @@ -9,7 +9,6 @@ #include "core/hle/service/ldn/ldn.h" #include "core/hle/service/ldn/monitor_service.h" #include "core/hle/service/ldn/sf_monitor_service.h" -#include "core/hle/service/ldn/sf_service.h" #include "core/hle/service/ldn/sf_service_monitor.h" #include "core/hle/service/ldn/system_local_communication_service.h" #include "core/hle/service/ldn/user_local_communication_service.h" @@ -19,14 +18,10 @@ namespace Service::LDN { class IClientProcessMonitor final : public ServiceFramework { public: - explicit IClientProcessMonitor(Core::System& system_) - : ServiceFramework{system_, "IClientProcessMonitor"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IClientProcessMonitor::RegisterClient>, "RegisterClient"}, - }; - // clang-format on - RegisterHandlers(functions); + explicit IClientProcessMonitor(Core::System& system_) : ServiceFramework{system_, "IClientProcessMonitor"} {} + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } ~IClientProcessMonitor() override = default; private: @@ -34,19 +29,19 @@ private: LOG_WARNING(Service_LDN, "(STUBBED) called"); R_SUCCEED(); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IClientProcessMonitor::RegisterClient>, "RegisterClient"} + ); }; class IMonitorServiceCreator final : public ServiceFramework { public: - explicit IMonitorServiceCreator(Core::System& system_) : ServiceFramework{system_, "ldn:m"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, C<&IMonitorServiceCreator::CreateMonitorService>, "CreateMonitorService"} - }; - // clang-format on - RegisterHandlers(functions); - } + explicit IMonitorServiceCreator(Core::System& system_) : ServiceFramework{system_, "ldn:m"} {} + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } private: Result CreateMonitorService(OutInterface out_interface) { LOG_DEBUG(Service_LDN, "called"); @@ -54,21 +49,19 @@ private: *out_interface = std::make_shared(system); R_SUCCEED(); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, C<&IMonitorServiceCreator::CreateMonitorService>, "CreateMonitorService"} + ); }; class ISystemServiceCreator final : public ServiceFramework { public: - explicit ISystemServiceCreator(Core::System& system_) : ServiceFramework{system_, "ldn:s"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, C<&ISystemServiceCreator::CreateSystemLocalCommunicationService>, "CreateSystemLocalCommunicationService"}, - {1, C<&ISystemServiceCreator::CreateClientProcessMonitor>, "CreateClientProcessMonitor"} // 18.0.0+ - }; - // clang-format on + explicit ISystemServiceCreator(Core::System& system_) : ServiceFramework{system_, "ldn:s"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } - private: Result CreateSystemLocalCommunicationService( OutInterface out_interface) { @@ -85,21 +78,20 @@ private: *out_interface = std::make_shared(system); R_SUCCEED(); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, C<&ISystemServiceCreator::CreateSystemLocalCommunicationService>, "CreateSystemLocalCommunicationService"}, + FunctionInfo{1, C<&ISystemServiceCreator::CreateClientProcessMonitor>, "CreateClientProcessMonitor", MakeVersionGate({18,0,0})} + ); }; class IUserServiceCreator final : public ServiceFramework { public: - explicit IUserServiceCreator(Core::System& system_) : ServiceFramework{system_, "ldn:u"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IUserServiceCreator::CreateUserLocalCommunicationService>, "CreateUserLocalCommunicationService"}, - {1, D<&IUserServiceCreator::CreateClientProcessMonitor>, "CreateClientProcessMonitor"} // 18.0.0+ - }; - // clang-format on + explicit IUserServiceCreator(Core::System& system_) : ServiceFramework{system_, "ldn:u"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } - private: Result CreateUserLocalCommunicationService( OutInterface out_interface) { @@ -116,22 +108,50 @@ private: *out_interface = std::make_shared(system); R_SUCCEED(); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IUserServiceCreator::CreateUserLocalCommunicationService>, "CreateUserLocalCommunicationService"}, + FunctionInfo{1, D<&IUserServiceCreator::CreateClientProcessMonitor>, "CreateClientProcessMonitor", MakeVersionGate({18,0,0})} + ); +}; + +class ISfService final : public ServiceFramework { +public: + explicit ISfService(Core::System& system_) : ServiceFramework{system_, "ISfService"} {} + ~ISfService() override = default; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "Initialize"}, + FunctionInfo{256, nullptr, "AttachNetworkInterfaceStateChangeEvent"}, + FunctionInfo{264, nullptr, "GetNetworkInterfaceLastError"}, + FunctionInfo{272, nullptr, "GetRole"}, + FunctionInfo{280, nullptr, "GetAdvertiseData"}, + FunctionInfo{288, nullptr, "GetGroupInfo"}, + FunctionInfo{296, nullptr, "GetGroupInfo2"}, + FunctionInfo{304, nullptr, "GetGroupOwner"}, + FunctionInfo{312, nullptr, "GetIpConfig"}, + FunctionInfo{320, nullptr, "GetLinkLevel"}, + FunctionInfo{512, nullptr, "Scan"}, + FunctionInfo{768, nullptr, "CreateGroup"}, + FunctionInfo{776, nullptr, "DestroyGroup"}, + FunctionInfo{784, nullptr, "SetAdvertiseData"}, + FunctionInfo{1536, nullptr, "SendToOtherGroup"}, + FunctionInfo{1544, nullptr, "RecvFromOtherGroup"}, + FunctionInfo{1552, nullptr, "AddAcceptableGroupId"}, + FunctionInfo{1560, nullptr, "ClearAcceptableGroupId"} + ); }; class ISfServiceCreator final : public ServiceFramework { public: - explicit ISfServiceCreator(Core::System& system_, bool is_system_, const char* name_) - : ServiceFramework{system_, name_}, is_system{is_system_} { - // clang-format off - static const FunctionInfo functions[] = { - {0, C<&ISfServiceCreator::CreateNetworkService>, "CreateNetworkService"}, - {8, C<&ISfServiceCreator::CreateNetworkServiceMonitor>, "CreateNetworkServiceMonitor"}, - }; - // clang-format on + explicit ISfServiceCreator(Core::System& system_, bool is_system_, const char* name_) : ServiceFramework{system_, name_}, is_system{is_system_} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } - private: Result CreateNetworkService(OutInterface out_interface, u32 input, u64 reserved_input) { @@ -150,21 +170,20 @@ private: R_SUCCEED(); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, C<&ISfServiceCreator::CreateNetworkService>, "CreateNetworkService"}, + FunctionInfo{8, C<&ISfServiceCreator::CreateNetworkServiceMonitor>, "CreateNetworkServiceMonitor"} + ); bool is_system{}; }; class ISfMonitorServiceCreator final : public ServiceFramework { public: - explicit ISfMonitorServiceCreator(Core::System& system_) : ServiceFramework{system_, "lp2p:m"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, C<&ISfMonitorServiceCreator::CreateMonitorService>, "CreateMonitorService"}, - }; - // clang-format on + explicit ISfMonitorServiceCreator(Core::System& system_) : ServiceFramework{system_, "lp2p:m"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } - private: Result CreateMonitorService(OutInterface out_interface, u64 reserved_input) { LOG_INFO(Service_LDN, "called, reserved_input={}", reserved_input); @@ -172,6 +191,10 @@ private: *out_interface = std::make_shared(system); R_SUCCEED(); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, C<&ISfMonitorServiceCreator::CreateMonitorService>, "CreateMonitorService"} + ); }; void LoopProcess(Core::System& system) { @@ -181,12 +204,9 @@ void LoopProcess(Core::System& system) { server_manager->RegisterNamedService("ldn:s", std::make_shared(system)); server_manager->RegisterNamedService("ldn:u", std::make_shared(system)); - server_manager->RegisterNamedService( - "lp2p:app", std::make_shared(system, false, "lp2p:app")); - server_manager->RegisterNamedService( - "lp2p:sys", std::make_shared(system, true, "lp2p:sys")); - server_manager->RegisterNamedService("lp2p:m", - std::make_shared(system)); + server_manager->RegisterNamedService("lp2p:app", std::make_shared(system, false, "lp2p:app")); + server_manager->RegisterNamedService("lp2p:sys", std::make_shared(system, true, "lp2p:sys")); + server_manager->RegisterNamedService("lp2p:m", std::make_shared(system)); ServerManager::RunServer(std::move(server_manager)); } diff --git a/src/core/hle/service/ldn/monitor_service.cpp b/src/core/hle/service/ldn/monitor_service.cpp index ea6ac4d5dd..6a60b0b3d8 100644 --- a/src/core/hle/service/ldn/monitor_service.cpp +++ b/src/core/hle/service/ldn/monitor_service.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -7,22 +10,22 @@ namespace Service::LDN { +std::optional IMonitorService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, C<&IMonitorService::GetStateForMonitor>, "GetStateForMonitor"}, + FunctionInfo{1, nullptr, "GetNetworkInfoForMonitor"}, + FunctionInfo{2, nullptr, "GetIpv4AddressForMonitor"}, + FunctionInfo{3, nullptr, "GetDisconnectReasonForMonitor"}, + FunctionInfo{4, nullptr, "GetSecurityParameterForMonitor"}, + FunctionInfo{5, nullptr, "GetNetworkConfigForMonitor"}, + FunctionInfo{100, C<&IMonitorService::InitializeMonitor>, "InitializeMonitor"}, + FunctionInfo{101, C<&IMonitorService::FinalizeMonitor>, "FinalizeMonitor"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IMonitorService::IMonitorService(Core::System& system_) : ServiceFramework{system_, "IMonitorService"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, C<&IMonitorService::GetStateForMonitor>, "GetStateForMonitor"}, - {1, nullptr, "GetNetworkInfoForMonitor"}, - {2, nullptr, "GetIpv4AddressForMonitor"}, - {3, nullptr, "GetDisconnectReasonForMonitor"}, - {4, nullptr, "GetSecurityParameterForMonitor"}, - {5, nullptr, "GetNetworkConfigForMonitor"}, - {100, C<&IMonitorService::InitializeMonitor>, "InitializeMonitor"}, - {101, C<&IMonitorService::FinalizeMonitor>, "FinalizeMonitor"}, - }; - // clang-format on - - RegisterHandlers(functions); } IMonitorService::~IMonitorService() = default; diff --git a/src/core/hle/service/ldn/monitor_service.h b/src/core/hle/service/ldn/monitor_service.h index e663145b4f..9c1acd0a1e 100644 --- a/src/core/hle/service/ldn/monitor_service.h +++ b/src/core/hle/service/ldn/monitor_service.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -23,6 +26,7 @@ private: Result InitializeMonitor(); Result FinalizeMonitor(); + std::optional FindRequest(u32 key) override; State state{State::None}; }; diff --git a/src/core/hle/service/ldn/sf_monitor_service.cpp b/src/core/hle/service/ldn/sf_monitor_service.cpp index 9e6736ff2c..ebe06b2059 100644 --- a/src/core/hle/service/ldn/sf_monitor_service.cpp +++ b/src/core/hle/service/ldn/sf_monitor_service.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -7,17 +10,17 @@ namespace Service::LDN { +std::optional ISfMonitorService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, C<&ISfMonitorService::Initialize>, "Initialize"}, + FunctionInfo{288, C<&ISfMonitorService::GetGroupInfo>, "GetGroupInfo"}, + FunctionInfo{320, nullptr, "GetLinkLevel"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + ISfMonitorService::ISfMonitorService(Core::System& system_) : ServiceFramework{system_, "ISfMonitorService"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, C<&ISfMonitorService::Initialize>, "Initialize"}, - {288, C<&ISfMonitorService::GetGroupInfo>, "GetGroupInfo"}, - {320, nullptr, "GetLinkLevel"}, - }; - // clang-format on - - RegisterHandlers(functions); } ISfMonitorService::~ISfMonitorService() = default; diff --git a/src/core/hle/service/ldn/sf_monitor_service.h b/src/core/hle/service/ldn/sf_monitor_service.h index d021152010..09ca16727d 100644 --- a/src/core/hle/service/ldn/sf_monitor_service.h +++ b/src/core/hle/service/ldn/sf_monitor_service.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -21,6 +24,7 @@ public: private: Result Initialize(Out out_value); Result GetGroupInfo(OutLargeData out_group_info); + std::optional FindRequest(u32 key) override; }; } // namespace Service::LDN diff --git a/src/core/hle/service/ldn/sf_service.cpp b/src/core/hle/service/ldn/sf_service.cpp deleted file mode 100644 index 61cabe219a..0000000000 --- a/src/core/hle/service/ldn/sf_service.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "core/hle/service/ldn/sf_service.h" - -namespace Service::LDN { - -ISfService::ISfService(Core::System& system_) : ServiceFramework{system_, "ISfService"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "Initialize"}, - {256, nullptr, "AttachNetworkInterfaceStateChangeEvent"}, - {264, nullptr, "GetNetworkInterfaceLastError"}, - {272, nullptr, "GetRole"}, - {280, nullptr, "GetAdvertiseData"}, - {288, nullptr, "GetGroupInfo"}, - {296, nullptr, "GetGroupInfo2"}, - {304, nullptr, "GetGroupOwner"}, - {312, nullptr, "GetIpConfig"}, - {320, nullptr, "GetLinkLevel"}, - {512, nullptr, "Scan"}, - {768, nullptr, "CreateGroup"}, - {776, nullptr, "DestroyGroup"}, - {784, nullptr, "SetAdvertiseData"}, - {1536, nullptr, "SendToOtherGroup"}, - {1544, nullptr, "RecvFromOtherGroup"}, - {1552, nullptr, "AddAcceptableGroupId"}, - {1560, nullptr, "ClearAcceptableGroupId"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - -ISfService::~ISfService() = default; - -} // namespace Service::LDN diff --git a/src/core/hle/service/ldn/sf_service.h b/src/core/hle/service/ldn/sf_service.h deleted file mode 100644 index 05534b5677..0000000000 --- a/src/core/hle/service/ldn/sf_service.h +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include "core/hle/service/cmif_types.h" -#include "core/hle/service/service.h" - -namespace Core { -class System; -} - -namespace Service::LDN { - -class ISfService final : public ServiceFramework { -public: - explicit ISfService(Core::System& system_); - ~ISfService() override; -}; - -} // namespace Service::LDN diff --git a/src/core/hle/service/ldn/sf_service_monitor.cpp b/src/core/hle/service/ldn/sf_service_monitor.cpp index 9a1cde6881..574ba82a0b 100644 --- a/src/core/hle/service/ldn/sf_service_monitor.cpp +++ b/src/core/hle/service/ldn/sf_service_monitor.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -7,27 +10,27 @@ namespace Service::LDN { +std::optional ISfServiceMonitor::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, C<&ISfServiceMonitor::Initialize>, "Initialize"}, + FunctionInfo{256, nullptr, "AttachNetworkInterfaceStateChangeEvent"}, + FunctionInfo{264, nullptr, "GetNetworkInterfaceLastError"}, + FunctionInfo{272, nullptr, "GetRole"}, + FunctionInfo{280, nullptr, "GetAdvertiseData"}, + FunctionInfo{281, nullptr, "GetAdvertiseData2"}, + FunctionInfo{288, C<&ISfServiceMonitor::GetGroupInfo>, "GetGroupInfo"}, + FunctionInfo{296, nullptr, "GetGroupInfo2"}, + FunctionInfo{304, nullptr, "GetGroupOwner"}, + FunctionInfo{312, nullptr, "GetIpConfig"}, + FunctionInfo{320, nullptr, "GetLinkLevel"}, + FunctionInfo{328, nullptr, "AttachJoinEvent"}, + FunctionInfo{336, nullptr, "GetMembers"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + ISfServiceMonitor::ISfServiceMonitor(Core::System& system_) : ServiceFramework{system_, "ISfServiceMonitor"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, C<&ISfServiceMonitor::Initialize>, "Initialize"}, - {256, nullptr, "AttachNetworkInterfaceStateChangeEvent"}, - {264, nullptr, "GetNetworkInterfaceLastError"}, - {272, nullptr, "GetRole"}, - {280, nullptr, "GetAdvertiseData"}, - {281, nullptr, "GetAdvertiseData2"}, - {288, C<&ISfServiceMonitor::GetGroupInfo>, "GetGroupInfo"}, - {296, nullptr, "GetGroupInfo2"}, - {304, nullptr, "GetGroupOwner"}, - {312, nullptr, "GetIpConfig"}, - {320, nullptr, "GetLinkLevel"}, - {328, nullptr, "AttachJoinEvent"}, - {336, nullptr, "GetMembers"}, - }; - // clang-format on - - RegisterHandlers(functions); } ISfServiceMonitor::~ISfServiceMonitor() = default; diff --git a/src/core/hle/service/ldn/sf_service_monitor.h b/src/core/hle/service/ldn/sf_service_monitor.h index 924cc17594..5e5e64ae6c 100644 --- a/src/core/hle/service/ldn/sf_service_monitor.h +++ b/src/core/hle/service/ldn/sf_service_monitor.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -20,8 +23,8 @@ public: private: Result Initialize(Out out_value); - Result GetGroupInfo(OutLargeData out_group_info, - GroupInfo in_group_info); + Result GetGroupInfo(OutLargeData out_group_info, GroupInfo in_group_info); + std::optional FindRequest(u32 key) override; }; } // namespace Service::LDN diff --git a/src/core/hle/service/ldn/system_local_communication_service.cpp b/src/core/hle/service/ldn/system_local_communication_service.cpp index 7b52223cdc..9d3d49aac4 100644 --- a/src/core/hle/service/ldn/system_local_communication_service.cpp +++ b/src/core/hle/service/ldn/system_local_communication_service.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -6,44 +9,44 @@ namespace Service::LDN { +std::optional ISystemLocalCommunicationService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetState"}, + FunctionInfo{1, nullptr, "GetNetworkInfo"}, + FunctionInfo{2, nullptr, "GetIpv4Address"}, + FunctionInfo{3, nullptr, "GetDisconnectReason"}, + FunctionInfo{4, nullptr, "GetSecurityParameter"}, + FunctionInfo{5, nullptr, "GetNetworkConfig"}, + FunctionInfo{100, nullptr, "AttachStateChangeEvent"}, + FunctionInfo{101, nullptr, "GetNetworkInfoLatestUpdate"}, + FunctionInfo{102, nullptr, "Scan"}, + FunctionInfo{103, nullptr, "ScanPrivate"}, + FunctionInfo{104, nullptr, "SetWirelessControllerRestriction"}, + FunctionInfo{200, nullptr, "OpenAccessPoint"}, + FunctionInfo{201, nullptr, "CloseAccessPoint"}, + FunctionInfo{202, nullptr, "CreateNetwork"}, + FunctionInfo{203, nullptr, "CreateNetworkPrivate"}, + FunctionInfo{204, nullptr, "DestroyNetwork"}, + FunctionInfo{205, nullptr, "Reject"}, + FunctionInfo{206, nullptr, "SetAdvertiseData"}, + FunctionInfo{207, nullptr, "SetStationAcceptPolicy"}, + FunctionInfo{208, nullptr, "AddAcceptFilterEntry"}, + FunctionInfo{209, nullptr, "ClearAcceptFilter"}, + FunctionInfo{300, nullptr, "OpenStation"}, + FunctionInfo{301, nullptr, "CloseStation"}, + FunctionInfo{302, nullptr, "Connect"}, + FunctionInfo{303, nullptr, "ConnectPrivate"}, + FunctionInfo{304, nullptr, "Disconnect"}, + FunctionInfo{400, nullptr, "InitializeSystem"}, + FunctionInfo{401, nullptr, "FinalizeSystem"}, + FunctionInfo{402, nullptr, "SetOperationMode"}, + FunctionInfo{403, C<&ISystemLocalCommunicationService::InitializeSystem2>, "InitializeSystem2"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + ISystemLocalCommunicationService::ISystemLocalCommunicationService(Core::System& system_) : ServiceFramework{system_, "ISystemLocalCommunicationService"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetState"}, - {1, nullptr, "GetNetworkInfo"}, - {2, nullptr, "GetIpv4Address"}, - {3, nullptr, "GetDisconnectReason"}, - {4, nullptr, "GetSecurityParameter"}, - {5, nullptr, "GetNetworkConfig"}, - {100, nullptr, "AttachStateChangeEvent"}, - {101, nullptr, "GetNetworkInfoLatestUpdate"}, - {102, nullptr, "Scan"}, - {103, nullptr, "ScanPrivate"}, - {104, nullptr, "SetWirelessControllerRestriction"}, - {200, nullptr, "OpenAccessPoint"}, - {201, nullptr, "CloseAccessPoint"}, - {202, nullptr, "CreateNetwork"}, - {203, nullptr, "CreateNetworkPrivate"}, - {204, nullptr, "DestroyNetwork"}, - {205, nullptr, "Reject"}, - {206, nullptr, "SetAdvertiseData"}, - {207, nullptr, "SetStationAcceptPolicy"}, - {208, nullptr, "AddAcceptFilterEntry"}, - {209, nullptr, "ClearAcceptFilter"}, - {300, nullptr, "OpenStation"}, - {301, nullptr, "CloseStation"}, - {302, nullptr, "Connect"}, - {303, nullptr, "ConnectPrivate"}, - {304, nullptr, "Disconnect"}, - {400, nullptr, "InitializeSystem"}, - {401, nullptr, "FinalizeSystem"}, - {402, nullptr, "SetOperationMode"}, - {403, C<&ISystemLocalCommunicationService::InitializeSystem2>, "InitializeSystem2"}, - }; - // clang-format on - - RegisterHandlers(functions); } ISystemLocalCommunicationService::~ISystemLocalCommunicationService() = default; diff --git a/src/core/hle/service/ldn/system_local_communication_service.h b/src/core/hle/service/ldn/system_local_communication_service.h index a02b097ea7..c7e937e3a2 100644 --- a/src/core/hle/service/ldn/system_local_communication_service.h +++ b/src/core/hle/service/ldn/system_local_communication_service.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -20,6 +23,7 @@ public: private: Result InitializeSystem2(); + std::optional FindRequest(u32 key) override; }; } // namespace Service::LDN diff --git a/src/core/hle/service/ldn/user_local_communication_service.cpp b/src/core/hle/service/ldn/user_local_communication_service.cpp index 572aea6314..26a742bf0b 100644 --- a/src/core/hle/service/ldn/user_local_communication_service.cpp +++ b/src/core/hle/service/ldn/user_local_communication_service.cpp @@ -21,46 +21,46 @@ namespace Service::LDN { +std::optional IUserLocalCommunicationService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IUserLocalCommunicationService::GetState>, "GetState"}, + FunctionInfo{1, D<&IUserLocalCommunicationService::GetNetworkInfo>, "GetNetworkInfo"}, + FunctionInfo{2, D<&IUserLocalCommunicationService::GetIpv4Address>, "GetIpv4Address"}, + FunctionInfo{3, D<&IUserLocalCommunicationService::GetDisconnectReason>, "GetDisconnectReason"}, + FunctionInfo{4, D<&IUserLocalCommunicationService::GetSecurityParameter>, "GetSecurityParameter"}, + FunctionInfo{5, D<&IUserLocalCommunicationService::GetNetworkConfig>, "GetNetworkConfig"}, + FunctionInfo{100, D<&IUserLocalCommunicationService::AttachStateChangeEvent>, "AttachStateChangeEvent"}, + FunctionInfo{101, D<&IUserLocalCommunicationService::GetNetworkInfoLatestUpdate>, "GetNetworkInfoLatestUpdate"}, + FunctionInfo{102, D<&IUserLocalCommunicationService::Scan>, "Scan"}, + FunctionInfo{103, D<&IUserLocalCommunicationService::ScanPrivate>, "ScanPrivate"}, + FunctionInfo{104, D<&IUserLocalCommunicationService::SetWirelessControllerRestriction>, "SetWirelessControllerRestriction"}, + FunctionInfo{106, D<&IUserLocalCommunicationService::SetProtocol>, "SetProtocol" }, + FunctionInfo{200, D<&IUserLocalCommunicationService::OpenAccessPoint>, "OpenAccessPoint"}, + FunctionInfo{201, D<&IUserLocalCommunicationService::CloseAccessPoint>, "CloseAccessPoint"}, + FunctionInfo{202, D<&IUserLocalCommunicationService::CreateNetwork>, "CreateNetwork"}, + FunctionInfo{203, D<&IUserLocalCommunicationService::CreateNetworkPrivate>, "CreateNetworkPrivate"}, + FunctionInfo{204, D<&IUserLocalCommunicationService::DestroyNetwork>, "DestroyNetwork"}, + FunctionInfo{205, nullptr, "Reject"}, + FunctionInfo{206, D<&IUserLocalCommunicationService::SetAdvertiseData>, "SetAdvertiseData"}, + FunctionInfo{207, D<&IUserLocalCommunicationService::SetStationAcceptPolicy>, "SetStationAcceptPolicy"}, + FunctionInfo{208, D<&IUserLocalCommunicationService::AddAcceptFilterEntry>, "AddAcceptFilterEntry"}, + FunctionInfo{209, nullptr, "ClearAcceptFilter"}, + FunctionInfo{300, D<&IUserLocalCommunicationService::OpenStation>, "OpenStation"}, + FunctionInfo{301, D<&IUserLocalCommunicationService::CloseStation>, "CloseStation"}, + FunctionInfo{302, D<&IUserLocalCommunicationService::Connect>, "Connect"}, + FunctionInfo{303, nullptr, "ConnectPrivate"}, + FunctionInfo{304, D<&IUserLocalCommunicationService::Disconnect>, "Disconnect"}, + FunctionInfo{400, D<&IUserLocalCommunicationService::Initialize>, "Initialize"}, + FunctionInfo{401, D<&IUserLocalCommunicationService::Finalize>, "Finalize"}, + FunctionInfo{402, D<&IUserLocalCommunicationService::Initialize2>, "Initialize2"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IUserLocalCommunicationService::IUserLocalCommunicationService(Core::System& system_) : ServiceFramework{system_, "IUserLocalCommunicationService"}, service_context{system, "IUserLocalCommunicationService"}, lan_discovery{} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IUserLocalCommunicationService::GetState>, "GetState"}, - {1, D<&IUserLocalCommunicationService::GetNetworkInfo>, "GetNetworkInfo"}, - {2, D<&IUserLocalCommunicationService::GetIpv4Address>, "GetIpv4Address"}, - {3, D<&IUserLocalCommunicationService::GetDisconnectReason>, "GetDisconnectReason"}, - {4, D<&IUserLocalCommunicationService::GetSecurityParameter>, "GetSecurityParameter"}, - {5, D<&IUserLocalCommunicationService::GetNetworkConfig>, "GetNetworkConfig"}, - {100, D<&IUserLocalCommunicationService::AttachStateChangeEvent>, "AttachStateChangeEvent"}, - {101, D<&IUserLocalCommunicationService::GetNetworkInfoLatestUpdate>, "GetNetworkInfoLatestUpdate"}, - {102, D<&IUserLocalCommunicationService::Scan>, "Scan"}, - {103, D<&IUserLocalCommunicationService::ScanPrivate>, "ScanPrivate"}, - {104, D<&IUserLocalCommunicationService::SetWirelessControllerRestriction>, "SetWirelessControllerRestriction"}, - { 106, D<&IUserLocalCommunicationService::SetProtocol>, "SetProtocol" }, - {200, D<&IUserLocalCommunicationService::OpenAccessPoint>, "OpenAccessPoint"}, - {201, D<&IUserLocalCommunicationService::CloseAccessPoint>, "CloseAccessPoint"}, - {202, D<&IUserLocalCommunicationService::CreateNetwork>, "CreateNetwork"}, - {203, D<&IUserLocalCommunicationService::CreateNetworkPrivate>, "CreateNetworkPrivate"}, - {204, D<&IUserLocalCommunicationService::DestroyNetwork>, "DestroyNetwork"}, - {205, nullptr, "Reject"}, - {206, D<&IUserLocalCommunicationService::SetAdvertiseData>, "SetAdvertiseData"}, - {207, D<&IUserLocalCommunicationService::SetStationAcceptPolicy>, "SetStationAcceptPolicy"}, - {208, D<&IUserLocalCommunicationService::AddAcceptFilterEntry>, "AddAcceptFilterEntry"}, - {209, nullptr, "ClearAcceptFilter"}, - {300, D<&IUserLocalCommunicationService::OpenStation>, "OpenStation"}, - {301, D<&IUserLocalCommunicationService::CloseStation>, "CloseStation"}, - {302, D<&IUserLocalCommunicationService::Connect>, "Connect"}, - {303, nullptr, "ConnectPrivate"}, - {304, D<&IUserLocalCommunicationService::Disconnect>, "Disconnect"}, - {400, D<&IUserLocalCommunicationService::Initialize>, "Initialize"}, - {401, D<&IUserLocalCommunicationService::Finalize>, "Finalize"}, - {402, D<&IUserLocalCommunicationService::Initialize2>, "Initialize2"}, - }; - // clang-format on - - RegisterHandlers(functions); state_change_event = service_context.CreateEvent("IUserLocalCommunicationService:StateChangeEvent"); diff --git a/src/core/hle/service/ldn/user_local_communication_service.h b/src/core/hle/service/ldn/user_local_communication_service.h index 1e725ed531..6f832b7a23 100644 --- a/src/core/hle/service/ldn/user_local_communication_service.h +++ b/src/core/hle/service/ldn/user_local_communication_service.h @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later #pragma once @@ -89,6 +89,7 @@ private: /// Callback to parse and handle a received LDN packet. void OnLDNPacketReceived(const Network::LDNPacket& packet); void OnEventFired(); + std::optional FindRequest(u32 key) override; KernelHelpers::ServiceContext service_context; Kernel::KEvent* state_change_event; diff --git a/src/core/hle/service/ldr/ldr.cpp b/src/core/hle/service/ldr/ldr.cpp index db4d51b49d..25ecc58fa4 100644 --- a/src/core/hle/service/ldr/ldr.cpp +++ b/src/core/hle/service/ldr/ldr.cpp @@ -12,47 +12,44 @@ namespace Service::LDR { class DebugMonitor final : public ServiceFramework { public: - explicit DebugMonitor(Core::System& system_) : ServiceFramework{system_, "ldr:dmnt"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "SetProgramArgument"}, - {1, nullptr, "FlushArguments"}, - {2, nullptr, "GetProcessModuleInfo"}, - }; - // clang-format on + explicit DebugMonitor(Core::System& system_) : ServiceFramework{system_, "ldr:dmnt"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "SetProgramArgument"}, + FunctionInfo{1, nullptr, "FlushArguments"}, + FunctionInfo{2, nullptr, "GetProcessModuleInfo"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class ProcessManager final : public ServiceFramework { public: - explicit ProcessManager(Core::System& system_) : ServiceFramework{system_, "ldr:pm"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "CreateProcess"}, - {1, nullptr, "GetProgramInfo"}, - {2, nullptr, "PinProgram"}, - {3, nullptr, "UnpinProgram"}, - {4, nullptr, "SetEnabledProgramVerification"}, - }; - // clang-format on + explicit ProcessManager(Core::System& system_) : ServiceFramework{system_, "ldr:pm"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "CreateProcess"}, + FunctionInfo{1, nullptr, "GetProgramInfo"}, + FunctionInfo{2, nullptr, "PinProgram"}, + FunctionInfo{3, nullptr, "UnpinProgram"}, + FunctionInfo{4, nullptr, "SetEnabledProgramVerification"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class Shell final : public ServiceFramework { public: - explicit Shell(Core::System& system_) : ServiceFramework{system_, "ldr:shel"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "SetProgramArgument"}, - {1, nullptr, "FlushArguments"}, - }; - // clang-format on + explicit Shell(Core::System& system_) : ServiceFramework{system_, "ldr:shel"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "SetProgramArgument"}, + FunctionInfo{1, nullptr, "FlushArguments"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; diff --git a/src/core/hle/service/lm/lm.cpp b/src/core/hle/service/lm/lm.cpp index d631a6dd80..be8cdf9aa9 100644 --- a/src/core/hle/service/lm/lm.cpp +++ b/src/core/hle/service/lm/lm.cpp @@ -87,16 +87,7 @@ DECLARE_ENUM_FLAG_OPERATORS(LogPacketFlags); class ILogger final : public ServiceFramework { public: - explicit ILogger(Core::System& system_) : ServiceFramework{system_, "ILogger"} { - static const FunctionInfo functions[] = { - {0, &ILogger::Log, "Log"}, - {1, &ILogger::SetDestination, "SetDestination"}, - {2, nullptr, "TransmitHashedLog"}, //20.0.0+ - {3, nullptr, "DevNotify"}, //20.0.0+ - }; - RegisterHandlers(functions); - } - + explicit ILogger(Core::System& system_) : ServiceFramework{system_, "ILogger"} {} private: void Log(HLERequestContext& ctx) { std::size_t offset{}; @@ -331,20 +322,25 @@ private: }; static_assert(sizeof(LogPacketHeader) == 0x18, "LogPacketHeader is an invalid size"); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &ILogger::Log, "Log"}, + FunctionInfo{1, &ILogger::SetDestination, "SetDestination"}, + FunctionInfo{2, nullptr, "TransmitHashedLog", MakeVersionGate({20,0,0})}, + FunctionInfo{3, nullptr, "DevNotify", MakeVersionGate({20,0,0})} + ); ::Common::unordered_map> entries{}; LogDestination destination{LogDestination::All}; }; class LM final : public ServiceFramework { public: - explicit LM(Core::System& system_) : ServiceFramework{system_, "lm"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &LM::OpenLogger, "OpenLogger"}, - }; - // clang-format on + explicit LM(Core::System& system_) : ServiceFramework{system_, "lm"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -355,21 +351,26 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &LM::OpenLogger, "OpenLogger"} + ); }; class LM_GET final : public ServiceFramework { public: - explicit LM_GET(Core::System& system_) - : ServiceFramework{system_, "lm:get"} - { - static const FunctionInfo functions[] = { - {0, nullptr, "StartLogging"}, - {1, nullptr, "StopLogging"}, - {2, nullptr, "GetLog"}, - {100, nullptr, "CreateDevNotificationReceiver"}, - }; - RegisterHandlers(functions); + explicit LM_GET(Core::System& system_) : ServiceFramework{system_, "lm:get"} {} + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "StartLogging"}, + FunctionInfo{1, nullptr, "StopLogging"}, + FunctionInfo{2, nullptr, "GetLog"}, + FunctionInfo{100, nullptr, "CreateDevNotificationReceiver"} + ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/mig/mig.cpp b/src/core/hle/service/mig/mig.cpp index edc96506c0..2560050622 100644 --- a/src/core/hle/service/mig/mig.cpp +++ b/src/core/hle/service/mig/mig.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project @@ -14,50 +14,50 @@ namespace Service::Migration { class MIG_USR final : public ServiceFramework { public: - explicit MIG_USR(Core::System& system_) : ServiceFramework{system_, "mig:usr"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "Unknown0"}, //19.0.0+ - {1, nullptr, "Unknown1"}, //20.0.0+ - {2, nullptr, "Unknown2"}, //20.0.0+ - {10, nullptr, "TryGetLastMigrationInfo"}, - {11, nullptr, "Unknown11"}, //20.0.0+ - {100, nullptr, "CreateUserMigrationServer"}, //7.0.0+ - {101, nullptr, "ResumeUserMigrationServer"}, //7.0.0+ - {200, nullptr, "CreateUserMigrationClient"}, //7.0.0+ - {201, nullptr, "ResumeUserMigrationClient"}, //7.0.0+ - {1001, nullptr, "GetSaveDataMigrationPolicyInfoAsync"}, //8.0.0-20.5.0 - {1010, nullptr, "TryGetLastSaveDataMigrationInfo"}, //7.0.0+ - {1100, nullptr, "CreateSaveDataMigrationServer"}, //7.0.0-19.0.1 - {1101, nullptr, "ResumeSaveDataMigrationServer"}, //7.0.0+ - {1110, nullptr, "Unknown1101"}, //17.0.0+ - {1200, nullptr, "CreateSaveDataMigrationClient"}, //7.0.0+ - {1201, nullptr, "ResumeSaveDataMigrationClient"}, //7.0.0+ - {2001, nullptr, "Unknown2001"}, //20.0.0+ - {2010, nullptr, "Unknown2010"}, //20.0.0+ - {2100, nullptr, "Unknown2100"}, //20.0.0+ - {2110, nullptr, "Unknown2110"}, //20.0.0+ - {2200, nullptr, "Unknown2200"}, //20.0.0+ - {2210, nullptr, "Unknown2210"}, //20.0.0+ - {2220, nullptr, "Unknown2220"}, //20.0.0+ - {2230, nullptr, "Unknown2230"}, //20.0.0+ - {2231, nullptr, "Unknown2231"}, //20.0.0+ - {2232, nullptr, "Unknown2232"}, //20.0.0+ - {2233, nullptr, "Unknown2233"}, //20.0.0+ - {2234, nullptr, "Unknown2234"}, //20.0.0+ - {2250, nullptr, "Unknown2250"}, //20.0.0+ - {2260, nullptr, "Unknown2260"}, //20.0.0+ - {2270, nullptr, "Unknown2270"}, //20.0.0+ - {2280, nullptr, "Unknown2280"}, //20.0.0+ - {2300, nullptr, "Unknown2300"}, //20.0.0+ - {2310, nullptr, "Unknown2310"}, //20.0.0+ - {2400, nullptr, "Unknown2400"}, //20.0.0+ - {2420, nullptr, "Unknown2420"}, //20.0.0+ - }; - // clang-format on + explicit MIG_USR(Core::System& system_) : ServiceFramework{system_, "mig:usr"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "Unknown0", MakeVersionGate({19,0,0})}, + FunctionInfo{1, nullptr, "Unknown1", MakeVersionGate({20,0,0})}, + FunctionInfo{2, nullptr, "Unknown2", MakeVersionGate({20,0,0})}, + FunctionInfo{10, nullptr, "TryGetLastMigrationInfo"}, + FunctionInfo{11, nullptr, "Unknown11", MakeVersionGate({20,0,0})}, + FunctionInfo{100, nullptr, "CreateUserMigrationServer", MakeVersionGate({7,0,0})}, + FunctionInfo{101, nullptr, "ResumeUserMigrationServer", MakeVersionGate({7,0,0})}, + FunctionInfo{200, nullptr, "CreateUserMigrationClient", MakeVersionGate({7,0,0})}, + FunctionInfo{201, nullptr, "ResumeUserMigrationClient", MakeVersionGate({7,0,0})}, + FunctionInfo{1001, nullptr, "GetSaveDataMigrationPolicyInfoAsync", MakeVersionGate({8,0,0}, {20,5,0})}, + FunctionInfo{1010, nullptr, "TryGetLastSaveDataMigrationInfo", MakeVersionGate({7,0,0})}, + FunctionInfo{1100, nullptr, "CreateSaveDataMigrationServer", MakeVersionGate({7,0,0}, {19,0,1})}, + FunctionInfo{1101, nullptr, "ResumeSaveDataMigrationServer", MakeVersionGate({7,0,0})}, + FunctionInfo{1110, nullptr, "Unknown1101", MakeVersionGate({17,0,0})}, + FunctionInfo{1200, nullptr, "CreateSaveDataMigrationClient", MakeVersionGate({7,0,0})}, + FunctionInfo{1201, nullptr, "ResumeSaveDataMigrationClient", MakeVersionGate({7,0,0})}, + FunctionInfo{2001, nullptr, "Unknown2001", MakeVersionGate({20,0,0})}, + FunctionInfo{2010, nullptr, "Unknown2010", MakeVersionGate({20,0,0})}, + FunctionInfo{2100, nullptr, "Unknown2100", MakeVersionGate({20,0,0})}, + FunctionInfo{2110, nullptr, "Unknown2110", MakeVersionGate({20,0,0})}, + FunctionInfo{2200, nullptr, "Unknown2200", MakeVersionGate({20,0,0})}, + FunctionInfo{2210, nullptr, "Unknown2210", MakeVersionGate({20,0,0})}, + FunctionInfo{2220, nullptr, "Unknown2220", MakeVersionGate({20,0,0})}, + FunctionInfo{2230, nullptr, "Unknown2230", MakeVersionGate({20,0,0})}, + FunctionInfo{2231, nullptr, "Unknown2231", MakeVersionGate({20,0,0})}, + FunctionInfo{2232, nullptr, "Unknown2232", MakeVersionGate({20,0,0})}, + FunctionInfo{2233, nullptr, "Unknown2233", MakeVersionGate({20,0,0})}, + FunctionInfo{2234, nullptr, "Unknown2234", MakeVersionGate({20,0,0})}, + FunctionInfo{2250, nullptr, "Unknown2250", MakeVersionGate({20,0,0})}, + FunctionInfo{2260, nullptr, "Unknown2260", MakeVersionGate({20,0,0})}, + FunctionInfo{2270, nullptr, "Unknown2270", MakeVersionGate({20,0,0})}, + FunctionInfo{2280, nullptr, "Unknown2280", MakeVersionGate({20,0,0})}, + FunctionInfo{2300, nullptr, "Unknown2300", MakeVersionGate({20,0,0})}, + FunctionInfo{2310, nullptr, "Unknown2310", MakeVersionGate({20,0,0})}, + FunctionInfo{2400, nullptr, "Unknown2400", MakeVersionGate({20,0,0})}, + FunctionInfo{2420, nullptr, "Unknown2420", MakeVersionGate({20,0,0})} + ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/mii/mii.cpp b/src/core/hle/service/mii/mii.cpp index 513bb671f8..642a9e4907 100644 --- a/src/core/hle/service/mii/mii.cpp +++ b/src/core/hle/service/mii/mii.cpp @@ -22,51 +22,27 @@ namespace Service::Mii { +std::optional IStaticService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IStaticService::GetDatabaseService>, "GetDatabaseService"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + class IDatabaseService final : public ServiceFramework { public: - explicit IDatabaseService(Core::System& system_, std::shared_ptr mii_manager, - bool is_system_) - : ServiceFramework{system_, "IDatabaseService"}, manager{mii_manager}, is_system{ - is_system_} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IDatabaseService::IsUpdated>, "IsUpdated"}, - {1, D<&IDatabaseService::IsFullDatabase>, "IsFullDatabase"}, - {2, D<&IDatabaseService::GetCount>, "GetCount"}, - {3, D<&IDatabaseService::Get>, "Get"}, - {4, D<&IDatabaseService::Get1>, "Get1"}, - {5, D<&IDatabaseService::UpdateLatest>, "UpdateLatest"}, - {6, D<&IDatabaseService::BuildRandom>, "BuildRandom"}, - {7, D<&IDatabaseService::BuildDefault>, "BuildDefault"}, - {8, D<&IDatabaseService::Get2>, "Get2"}, - {9, D<&IDatabaseService::Get3>, "Get3"}, - {10, D<&IDatabaseService::UpdateLatest1>, "UpdateLatest1"}, - {11, D<&IDatabaseService::FindIndex>, "FindIndex"}, - {12, D<&IDatabaseService::Move>, "Move"}, - {13, D<&IDatabaseService::AddOrReplace>, "AddOrReplace"}, - {14, D<&IDatabaseService::Delete>, "Delete"}, - {15, D<&IDatabaseService::DestroyFile>, "DestroyFile"}, - {16, D<&IDatabaseService::DeleteFile>, "DeleteFile"}, - {17, D<&IDatabaseService::Format>, "Format"}, - {18, nullptr, "Import"}, - {19, nullptr, "Export"}, - {20, D<&IDatabaseService::IsBrokenDatabaseWithClearFlag>, "IsBrokenDatabaseWithClearFlag"}, - {21, D<&IDatabaseService::GetIndex>, "GetIndex"}, - {22, D<&IDatabaseService::SetInterfaceVersion>, "SetInterfaceVersion"}, - {23, D<&IDatabaseService::Convert>, "Convert"}, - {24, D<&IDatabaseService::ConvertCoreDataToCharInfo>, "ConvertCoreDataToCharInfo"}, - {25, D<&IDatabaseService::ConvertCharInfoToCoreData>, "ConvertCharInfoToCoreData"}, - {26, D<&IDatabaseService::Append>, "Append"}, - }; - // clang-format on - - RegisterHandlers(functions); - - m_set_sys = system.ServiceManager().GetService( - "set:sys", true); + explicit IDatabaseService(Core::System& system_, std::shared_ptr mii_manager, bool is_system_) + : ServiceFramework{system_, "IDatabaseService"} + , manager{mii_manager} + , is_system{is_system_} { + m_set_sys = system.ServiceManager().GetService("set:sys", true); manager->Initialize(metadata); } + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + private: Result IsUpdated(Out out_is_updated, SourceFlag source_flag) { LOG_DEBUG(Service_Mii, "called with source_flag={}", source_flag); @@ -288,23 +264,45 @@ private: R_RETURN(manager->Append(metadata, char_info)); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IDatabaseService::IsUpdated>, "IsUpdated"}, + FunctionInfo{1, D<&IDatabaseService::IsFullDatabase>, "IsFullDatabase"}, + FunctionInfo{2, D<&IDatabaseService::GetCount>, "GetCount"}, + FunctionInfo{3, D<&IDatabaseService::Get>, "Get"}, + FunctionInfo{4, D<&IDatabaseService::Get1>, "Get1"}, + FunctionInfo{5, D<&IDatabaseService::UpdateLatest>, "UpdateLatest"}, + FunctionInfo{6, D<&IDatabaseService::BuildRandom>, "BuildRandom"}, + FunctionInfo{7, D<&IDatabaseService::BuildDefault>, "BuildDefault"}, + FunctionInfo{8, D<&IDatabaseService::Get2>, "Get2"}, + FunctionInfo{9, D<&IDatabaseService::Get3>, "Get3"}, + FunctionInfo{10, D<&IDatabaseService::UpdateLatest1>, "UpdateLatest1"}, + FunctionInfo{11, D<&IDatabaseService::FindIndex>, "FindIndex"}, + FunctionInfo{12, D<&IDatabaseService::Move>, "Move"}, + FunctionInfo{13, D<&IDatabaseService::AddOrReplace>, "AddOrReplace"}, + FunctionInfo{14, D<&IDatabaseService::Delete>, "Delete"}, + FunctionInfo{15, D<&IDatabaseService::DestroyFile>, "DestroyFile"}, + FunctionInfo{16, D<&IDatabaseService::DeleteFile>, "DeleteFile"}, + FunctionInfo{17, D<&IDatabaseService::Format>, "Format"}, + FunctionInfo{18, nullptr, "Import"}, + FunctionInfo{19, nullptr, "Export"}, + FunctionInfo{20, D<&IDatabaseService::IsBrokenDatabaseWithClearFlag>, "IsBrokenDatabaseWithClearFlag"}, + FunctionInfo{21, D<&IDatabaseService::GetIndex>, "GetIndex"}, + FunctionInfo{22, D<&IDatabaseService::SetInterfaceVersion>, "SetInterfaceVersion"}, + FunctionInfo{23, D<&IDatabaseService::Convert>, "Convert"}, + FunctionInfo{24, D<&IDatabaseService::ConvertCoreDataToCharInfo>, "ConvertCoreDataToCharInfo"}, + FunctionInfo{25, D<&IDatabaseService::ConvertCharInfoToCoreData>, "ConvertCharInfoToCoreData"}, + FunctionInfo{26, D<&IDatabaseService::Append>, "Append"} + ); + std::shared_ptr manager = nullptr; DatabaseSessionMetadata metadata{}; bool is_system{}; - std::shared_ptr m_set_sys; }; IStaticService::IStaticService(Core::System& system_, const char* name_, std::shared_ptr mii_manager, bool is_system_) : ServiceFramework{system_, name_}, manager{mii_manager}, is_system{is_system_} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IStaticService::GetDatabaseService>, "GetDatabaseService"}, - }; - // clang-format on - - RegisterHandlers(functions); } IStaticService::~IStaticService() = default; @@ -324,27 +322,10 @@ std::shared_ptr IStaticService::GetMiiManager() { class IImageDatabaseService final : public ServiceFramework { public: - explicit IImageDatabaseService(Core::System& system_) : ServiceFramework{system_, "miiimg"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IImageDatabaseService::Initialize>, "Initialize"}, - {10, nullptr, "Reload"}, - {11, D<&IImageDatabaseService::GetCount>, "GetCount"}, - {12, nullptr, "IsEmpty"}, - {13, nullptr, "IsFull"}, - {14, nullptr, "GetAttribute"}, - {15, nullptr, "LoadImage"}, - {16, nullptr, "AddOrUpdateImage"}, - {17, nullptr, "DeleteImages"}, - {100, nullptr, "DeleteFile"}, - {101, nullptr, "DestroyFile"}, - {102, nullptr, "ImportFile"}, - {103, nullptr, "ExportFile"}, - {104, nullptr, "ForceInitialize"}, - }; - // clang-format on + explicit IImageDatabaseService(Core::System& system_) : ServiceFramework{system_, "miiimg"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -361,6 +342,23 @@ private: R_SUCCEED(); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IImageDatabaseService::Initialize>, "Initialize"}, + FunctionInfo{10, nullptr, "Reload"}, + FunctionInfo{11, D<&IImageDatabaseService::GetCount>, "GetCount"}, + FunctionInfo{12, nullptr, "IsEmpty"}, + FunctionInfo{13, nullptr, "IsFull"}, + FunctionInfo{14, nullptr, "GetAttribute"}, + FunctionInfo{15, nullptr, "LoadImage"}, + FunctionInfo{16, nullptr, "AddOrUpdateImage"}, + FunctionInfo{17, nullptr, "DeleteImages"}, + FunctionInfo{100, nullptr, "DeleteFile"}, + FunctionInfo{101, nullptr, "DestroyFile"}, + FunctionInfo{102, nullptr, "ImportFile"}, + FunctionInfo{103, nullptr, "ExportFile"}, + FunctionInfo{104, nullptr, "ForceInitialize"} + ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/mii/mii.h b/src/core/hle/service/mii/mii.h index 8683ac1a52..ba20db40d7 100644 --- a/src/core/hle/service/mii/mii.h +++ b/src/core/hle/service/mii/mii.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -24,6 +27,7 @@ public: private: Result GetDatabaseService(Out> out_database_service); + std::optional FindRequest(u32 key) override; std::shared_ptr manager{nullptr}; bool is_system{}; }; diff --git a/src/core/hle/service/mm/mm_u.cpp b/src/core/hle/service/mm/mm_u.cpp index e5353ee42c..0b361ecdd2 100644 --- a/src/core/hle/service/mm/mm_u.cpp +++ b/src/core/hle/service/mm/mm_u.cpp @@ -49,21 +49,10 @@ public: class MM_U final : public ServiceFramework { public: - explicit MM_U(Core::System& system_) : ServiceFramework{system_, "mm:u"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &MM_U::InitializeOld, "InitializeOld"}, - {1, &MM_U::FinalizeOld, "FinalizeOld"}, - {2, &MM_U::SetAndWaitOld, "SetAndWaitOld"}, - {3, &MM_U::GetOld, "GetOld"}, - {4, &MM_U::Initialize, "Initialize"}, - {5, &MM_U::Finalize, "Finalize"}, - {6, &MM_U::SetAndWait, "SetAndWait"}, - {7, &MM_U::Get, "Get"}, - }; - // clang-format on + explicit MM_U(Core::System& system_) : ServiceFramework{system_, "mm:u"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -212,6 +201,16 @@ private: rb.Push(0); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &MM_U::InitializeOld, "InitializeOld"}, + FunctionInfo{1, &MM_U::FinalizeOld, "FinalizeOld"}, + FunctionInfo{2, &MM_U::SetAndWaitOld, "SetAndWaitOld"}, + FunctionInfo{3, &MM_U::GetOld, "GetOld"}, + FunctionInfo{4, &MM_U::Initialize, "Initialize"}, + FunctionInfo{5, &MM_U::Finalize, "Finalize"}, + FunctionInfo{6, &MM_U::SetAndWait, "SetAndWait"}, + FunctionInfo{7, &MM_U::Get, "Get"} + ); std::vector sessions; u32 request_id{1}; }; diff --git a/src/core/hle/service/mnpp/mnpp.cpp b/src/core/hle/service/mnpp/mnpp.cpp index 11b6f3a386..c5bc306302 100644 --- a/src/core/hle/service/mnpp/mnpp.cpp +++ b/src/core/hle/service/mnpp/mnpp.cpp @@ -14,15 +14,10 @@ namespace Service::MNPP { class MNPP_APP final : public ServiceFramework { public: - explicit MNPP_APP(Core::System& system_) : ServiceFramework{system_, "mnpp:app"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &MNPP_APP::Cmd0, "Cmd0"}, - {1, &MNPP_APP::Cmd1, "Cmd1"}, - }; - // clang-format on + explicit MNPP_APP(Core::System& system_) : ServiceFramework{system_, "mnpp:app"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -39,38 +34,43 @@ private: IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &MNPP_APP::Cmd0, "Cmd0"}, + FunctionInfo{1, &MNPP_APP::Cmd1, "Cmd1"} + ); }; class MNPP_SYS final : public ServiceFramework { public: - explicit MNPP_SYS(Core::System& system_) : ServiceFramework{system_, "mnpp:sys"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "Cmd0"}, - {10, nullptr, "Cmd10"}, - {100, nullptr, "Cmd100"}, - {200, nullptr, "Cmd200"}, - {300, nullptr, "Cmd300"}, - {400, nullptr, "Cmd400"}, - }; - // clang-format on - RegisterHandlers(functions); + explicit MNPP_SYS(Core::System& system_) : ServiceFramework{system_, "mnpp:sys"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "Cmd0"}, + FunctionInfo{10, nullptr, "Cmd10"}, + FunctionInfo{100, nullptr, "Cmd100"}, + FunctionInfo{200, nullptr, "Cmd200"}, + FunctionInfo{300, nullptr, "Cmd300"}, + FunctionInfo{400, nullptr, "Cmd400"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class MNPP_WEB final : public ServiceFramework { public: - explicit MNPP_WEB(Core::System& system_) : ServiceFramework{system_, "mnpp:web"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "Cmd0"}, - {1, nullptr, "Cmd1"}, - {10, nullptr, "Cmd10"}, - {20, nullptr, "Cmd20"}, - {100, nullptr, "Cmd100"}, - }; - // clang-format on - RegisterHandlers(functions); + explicit MNPP_WEB(Core::System& system_) : ServiceFramework{system_, "mnpp:web"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "Cmd0"}, + FunctionInfo{1, nullptr, "Cmd1"}, + FunctionInfo{10, nullptr, "Cmd10"}, + FunctionInfo{20, nullptr, "Cmd20"}, + FunctionInfo{100, nullptr, "Cmd100"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; diff --git a/src/core/hle/service/ncm/ncm.cpp b/src/core/hle/service/ncm/ncm.cpp index 6c754d5567..4091eadcf9 100644 --- a/src/core/hle/service/ncm/ncm.cpp +++ b/src/core/hle/service/ncm/ncm.cpp @@ -24,33 +24,32 @@ namespace Service::NCM { class ILocationResolver final : public ServiceFramework { public: explicit ILocationResolver(Core::System& system_, FileSys::StorageId id) - : ServiceFramework{system_, "ILocationResolver"}, storage{id} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "ResolveProgramPath"}, - {1, nullptr, "RedirectProgramPath"}, - {2, nullptr, "ResolveApplicationControlPath"}, - {3, nullptr, "ResolveApplicationHtmlDocumentPath"}, - {4, nullptr, "ResolveDataPath"}, - {5, nullptr, "RedirectApplicationControlPath"}, - {6, nullptr, "RedirectApplicationHtmlDocumentPath"}, - {7, nullptr, "ResolveApplicationLegalInformationPath"}, - {8, nullptr, "RedirectApplicationLegalInformationPath"}, - {9, nullptr, "Refresh"}, - {10, nullptr, "RedirectApplicationProgramPath"}, - {11, nullptr, "ClearApplicationRedirection"}, - {12, nullptr, "EraseProgramRedirection"}, - {13, nullptr, "EraseApplicationControlRedirection"}, - {14, nullptr, "EraseApplicationHtmlDocumentRedirection"}, - {15, nullptr, "EraseApplicationLegalInformationRedirection"}, - {16, nullptr, "ResolveProgramPathForDebug"}, - {17, nullptr, "RedirectProgramPathForDebug"}, - {18, nullptr, "RedirectApplicationProgramPathForDebug"}, - {19, nullptr, "EraseProgramRedirectionForDebug"}, - }; - // clang-format on + : ServiceFramework{system_, "ILocationResolver"}, storage{id} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "ResolveProgramPath"}, + FunctionInfo{1, nullptr, "RedirectProgramPath"}, + FunctionInfo{2, nullptr, "ResolveApplicationControlPath"}, + FunctionInfo{3, nullptr, "ResolveApplicationHtmlDocumentPath"}, + FunctionInfo{4, nullptr, "ResolveDataPath"}, + FunctionInfo{5, nullptr, "RedirectApplicationControlPath"}, + FunctionInfo{6, nullptr, "RedirectApplicationHtmlDocumentPath"}, + FunctionInfo{7, nullptr, "ResolveApplicationLegalInformationPath"}, + FunctionInfo{8, nullptr, "RedirectApplicationLegalInformationPath"}, + FunctionInfo{9, nullptr, "Refresh"}, + FunctionInfo{10, nullptr, "RedirectApplicationProgramPath"}, + FunctionInfo{11, nullptr, "ClearApplicationRedirection"}, + FunctionInfo{12, nullptr, "EraseProgramRedirection"}, + FunctionInfo{13, nullptr, "EraseApplicationControlRedirection"}, + FunctionInfo{14, nullptr, "EraseApplicationHtmlDocumentRedirection"}, + FunctionInfo{15, nullptr, "EraseApplicationLegalInformationRedirection"}, + FunctionInfo{16, nullptr, "ResolveProgramPathForDebug"}, + FunctionInfo{17, nullptr, "RedirectProgramPathForDebug"}, + FunctionInfo{18, nullptr, "RedirectApplicationProgramPathForDebug"}, + FunctionInfo{19, nullptr, "EraseProgramRedirectionForDebug"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -60,60 +59,49 @@ private: class IRegisteredLocationResolver final : public ServiceFramework { public: explicit IRegisteredLocationResolver(Core::System& system_) - : ServiceFramework{system_, "IRegisteredLocationResolver"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "ResolveProgramPath"}, - {1, nullptr, "RegisterProgramPath"}, - {2, nullptr, "UnregisterProgramPath"}, - {3, nullptr, "RedirectProgramPath"}, - {4, nullptr, "ResolveHtmlDocumentPath"}, - {5, nullptr, "RegisterHtmlDocumentPath"}, - {6, nullptr, "UnregisterHtmlDocumentPath"}, - {7, nullptr, "RedirectHtmlDocumentPath"}, - {8, nullptr, "Refresh"}, - {9, nullptr, "RefreshExcluding"}, - }; - // clang-format on + : ServiceFramework{system_, "IRegisteredLocationResolver"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "ResolveProgramPath"}, + FunctionInfo{1, nullptr, "RegisterProgramPath"}, + FunctionInfo{2, nullptr, "UnregisterProgramPath"}, + FunctionInfo{3, nullptr, "RedirectProgramPath"}, + FunctionInfo{4, nullptr, "ResolveHtmlDocumentPath"}, + FunctionInfo{5, nullptr, "RegisterHtmlDocumentPath"}, + FunctionInfo{6, nullptr, "UnregisterHtmlDocumentPath"}, + FunctionInfo{7, nullptr, "RedirectHtmlDocumentPath"}, + FunctionInfo{8, nullptr, "Refresh"}, + FunctionInfo{9, nullptr, "RefreshExcluding"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class IAddOnContentLocationResolver final : public ServiceFramework { public: explicit IAddOnContentLocationResolver(Core::System& system_) - : ServiceFramework{system_, "IAddOnContentLocationResolver"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "ResolveAddOnContentPath"}, - {1, nullptr, "RegisterAddOnContentStorage"}, - {2, nullptr, "UnregisterAllAddOnContentPath"}, - {3, nullptr, "RefreshApplicationAddOnContent"}, - {4, nullptr, "UnregisterApplicationAddOnContent"}, - }; - // clang-format on + : ServiceFramework{system_, "IAddOnContentLocationResolver"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "ResolveAddOnContentPath"}, + FunctionInfo{1, nullptr, "RegisterAddOnContentStorage"}, + FunctionInfo{2, nullptr, "UnregisterAllAddOnContentPath"}, + FunctionInfo{3, nullptr, "RefreshApplicationAddOnContent"}, + FunctionInfo{4, nullptr, "UnregisterApplicationAddOnContent"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class IContentStorage final : public ServiceFramework { public: explicit IContentStorage(Core::System& system_, FileSys::StorageId id) - : ServiceFramework{system_, "IContentStorage"}, storage{id} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &IContentStorage::GeneratePlaceHolderId, "GeneratePlaceHolderId"}, - {1, &IContentStorage::CreatePlaceHolder, "CreatePlaceHolder"}, - {2, &IContentStorage::DeletePlaceHolder, "DeletePlaceHolder"}, - {4, &IContentStorage::WritePlaceHolder, "WritePlaceHolder"}, - {5, &IContentStorage::Register, "Register"}, - {6, &IContentStorage::Delete, "Delete"}, - }; - // clang-format on + : ServiceFramework{system_, "IContentStorage"}, storage{id} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -252,23 +240,24 @@ private: rb.Push(succeeded ? ResultSuccess : ResultUnknown); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &IContentStorage::GeneratePlaceHolderId, "GeneratePlaceHolderId"}, + FunctionInfo{1, &IContentStorage::CreatePlaceHolder, "CreatePlaceHolder"}, + FunctionInfo{2, &IContentStorage::DeletePlaceHolder, "DeletePlaceHolder"}, + FunctionInfo{4, &IContentStorage::WritePlaceHolder, "WritePlaceHolder"}, + FunctionInfo{5, &IContentStorage::Register, "Register"}, + FunctionInfo{6, &IContentStorage::Delete, "Delete"} + ); FileSys::StorageId storage; }; class IContentMetaDatabase final : public ServiceFramework { public: explicit IContentMetaDatabase(Core::System& system_, FileSys::StorageId id) - : ServiceFramework{system_, "IContentMetaDatabase"}, storage{id} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &IContentMetaDatabase::Set, "Set"}, - {2, &IContentMetaDatabase::Remove, "Remove"}, - {8, &IContentMetaDatabase::Has, "Has"}, - {15, &IContentMetaDatabase::Commit, "Commit"}, - }; - // clang-format on + : ServiceFramework{system_, "IContentMetaDatabase"}, storage{id} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -356,51 +345,37 @@ private: rb.Push(ResultSuccess); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &IContentMetaDatabase::Set, "Set"}, + FunctionInfo{2, &IContentMetaDatabase::Remove, "Remove"}, + FunctionInfo{8, &IContentMetaDatabase::Has, "Has"}, + FunctionInfo{15, &IContentMetaDatabase::Commit, "Commit"} + ); FileSys::StorageId storage; std::vector entries; }; class LR final : public ServiceFramework { public: - explicit LR(Core::System& system_) : ServiceFramework{system_, "lr"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "OpenLocationResolver"}, - {1, nullptr, "OpenRegisteredLocationResolver"}, - {2, nullptr, "RefreshLocationResolver"}, - {3, nullptr, "OpenAddOnContentLocationResolver"}, - }; - // clang-format on + explicit LR(Core::System& system_) : ServiceFramework{system_, "lr"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "OpenLocationResolver"}, + FunctionInfo{1, nullptr, "OpenRegisteredLocationResolver"}, + FunctionInfo{2, nullptr, "RefreshLocationResolver"}, + FunctionInfo{3, nullptr, "OpenAddOnContentLocationResolver"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class NCM final : public ServiceFramework { public: - explicit NCM(Core::System& system_) : ServiceFramework{system_, "ncm"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "CreateContentStorage"}, - {1, nullptr, "CreateContentMetaDatabase"}, - {2, nullptr, "VerifyContentStorage"}, - {3, nullptr, "VerifyContentMetaDatabase"}, - {4, &NCM::OpenContentStorage, "OpenContentStorage"}, - {5, &NCM::OpenContentMetaDatabase, "OpenContentMetaDatabase"}, - {6, nullptr, "CloseContentStorageForcibly"}, - {7, nullptr, "CloseContentMetaDatabaseForcibly"}, - {8, nullptr, "CleanupContentMetaDatabase"}, - {9, nullptr, "ActivateContentStorage"}, - {10, nullptr, "InactivateContentStorage"}, - {11, nullptr, "ActivateContentMetaDatabase"}, - {12, nullptr, "InactivateContentMetaDatabase"}, - {13, nullptr, "InvalidateRightsIdCache"}, - {14, nullptr, "GetMemoryReport"}, - {15, nullptr, "ActivateFsContentStorage"}, - }; - // clang-format on + explicit NCM(Core::System& system_) : ServiceFramework{system_, "ncm"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -425,18 +400,39 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system, storage_id); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "CreateContentStorage"}, + FunctionInfo{1, nullptr, "CreateContentMetaDatabase"}, + FunctionInfo{2, nullptr, "VerifyContentStorage"}, + FunctionInfo{3, nullptr, "VerifyContentMetaDatabase"}, + FunctionInfo{4, &NCM::OpenContentStorage, "OpenContentStorage"}, + FunctionInfo{5, &NCM::OpenContentMetaDatabase, "OpenContentMetaDatabase"}, + FunctionInfo{6, nullptr, "CloseContentStorageForcibly"}, + FunctionInfo{7, nullptr, "CloseContentMetaDatabaseForcibly"}, + FunctionInfo{8, nullptr, "CleanupContentMetaDatabase"}, + FunctionInfo{9, nullptr, "ActivateContentStorage"}, + FunctionInfo{10, nullptr, "InactivateContentStorage"}, + FunctionInfo{11, nullptr, "ActivateContentMetaDatabase"}, + FunctionInfo{12, nullptr, "InactivateContentMetaDatabase"}, + FunctionInfo{13, nullptr, "InvalidateRightsIdCache"}, + FunctionInfo{14, nullptr, "GetMemoryReport"}, + FunctionInfo{15, nullptr, "ActivateFsContentStorage"} + ); }; class NCM_V final : public ServiceFramework { public: explicit NCM_V(Core::System& system_) : ServiceFramework{system_, "ncm:v"} - { - static const FunctionInfo functions[] = { - {0, nullptr, "GetSystemVersion"}, - }; - RegisterHandlers(functions); + {} + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetSystemVersion"} + ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/nfc/nfc.cpp b/src/core/hle/service/nfc/nfc.cpp index f64445835e..d3a986faea 100644 --- a/src/core/hle/service/nfc/nfc.cpp +++ b/src/core/hle/service/nfc/nfc.cpp @@ -18,74 +18,71 @@ namespace Service::NFC { class IUser final : public NfcInterface { public: - explicit IUser(Core::System& system_) : NfcInterface(system_, "NFC::IUser", BackendType::Nfc) { - // clang-format off - static const FunctionInfo functions[] = { - {0, &NfcInterface::Initialize, "InitializeOld"}, - {1, &NfcInterface::Finalize, "FinalizeOld"}, - {2, &NfcInterface::GetState, "GetStateOld"}, - {3, &NfcInterface::IsNfcEnabled, "IsNfcEnabledOld"}, - {400, &NfcInterface::Initialize, "Initialize"}, - {401, &NfcInterface::Finalize, "Finalize"}, - {402, &NfcInterface::GetState, "GetState"}, - {403, &NfcInterface::IsNfcEnabled, "IsNfcEnabled"}, - {404, &NfcInterface::ListDevices, "ListDevices"}, - {405, &NfcInterface::GetDeviceState, "GetDeviceState"}, - {406, &NfcInterface::GetNpadId, "GetNpadId"}, - {407, &NfcInterface::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, - {408, &NfcInterface::StartDetection, "StartDetection"}, - {409, &NfcInterface::StopDetection, "StopDetection"}, - {410, &NfcInterface::GetTagInfo, "GetTagInfo"}, - {411, &NfcInterface::AttachActivateEvent, "AttachActivateEvent"}, - {412, &NfcInterface::AttachDeactivateEvent, "AttachDeactivateEvent"}, - {1000, &NfcInterface::ReadMifare, "ReadMifare"}, - {1001, &NfcInterface::WriteMifare ,"WriteMifare"}, - {1300, &NfcInterface::SendCommandByPassThrough, "SendCommandByPassThrough"}, - {1301, nullptr, "KeepPassThroughSession"}, - {1302, nullptr, "ReleasePassThroughSession"}, - }; - // clang-format on + explicit IUser(Core::System& system_) : NfcInterface(system_, "NFC::IUser", BackendType::Nfc) {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + static constexpr auto functions = CreateStaticMapWithClass( + FunctionInfoTyped{0, &NfcInterface::Initialize, "InitializeOld"}, + FunctionInfoTyped{1, &NfcInterface::Finalize, "FinalizeOld"}, + FunctionInfoTyped{2, &NfcInterface::GetState, "GetStateOld"}, + FunctionInfoTyped{3, &NfcInterface::IsNfcEnabled, "IsNfcEnabledOld"}, + FunctionInfoTyped{400, &NfcInterface::Initialize, "Initialize"}, + FunctionInfoTyped{401, &NfcInterface::Finalize, "Finalize"}, + FunctionInfoTyped{402, &NfcInterface::GetState, "GetState"}, + FunctionInfoTyped{403, &NfcInterface::IsNfcEnabled, "IsNfcEnabled"}, + FunctionInfoTyped{404, &NfcInterface::ListDevices, "ListDevices"}, + FunctionInfoTyped{405, &NfcInterface::GetDeviceState, "GetDeviceState"}, + FunctionInfoTyped{406, &NfcInterface::GetNpadId, "GetNpadId"}, + FunctionInfoTyped{407, &NfcInterface::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, + FunctionInfoTyped{408, &NfcInterface::StartDetection, "StartDetection"}, + FunctionInfoTyped{409, &NfcInterface::StopDetection, "StopDetection"}, + FunctionInfoTyped{410, &NfcInterface::GetTagInfo, "GetTagInfo"}, + FunctionInfoTyped{411, &NfcInterface::AttachActivateEvent, "AttachActivateEvent"}, + FunctionInfoTyped{412, &NfcInterface::AttachDeactivateEvent, "AttachDeactivateEvent"}, + FunctionInfoTyped{1000, &NfcInterface::ReadMifare, "ReadMifare"}, + FunctionInfoTyped{1001, &NfcInterface::WriteMifare ,"WriteMifare"}, + FunctionInfoTyped{1300, &NfcInterface::SendCommandByPassThrough, "SendCommandByPassThrough"}, + FunctionInfoTyped{1301, nullptr, "KeepPassThroughSession"}, + FunctionInfoTyped{1302, nullptr, "ReleasePassThroughSession"} + ); }; class ISystem final : public NfcInterface { public: - explicit ISystem(Core::System& system_) - : NfcInterface{system_, "NFC::ISystem", BackendType::Nfc} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &NfcInterface::Initialize, "InitializeOld"}, - {1, &NfcInterface::Finalize, "FinalizeOld"}, - {2, &NfcInterface::GetState, "GetStateOld"}, - {3, &NfcInterface::IsNfcEnabled, "IsNfcEnabledOld"}, - {100, &NfcInterface::SetNfcEnabled, "SetNfcEnabledOld"}, - {400, &NfcInterface::Initialize, "Initialize"}, - {401, &NfcInterface::Finalize, "Finalize"}, - {402, &NfcInterface::GetState, "GetState"}, - {403, &NfcInterface::IsNfcEnabled, "IsNfcEnabled"}, - {404, &NfcInterface::ListDevices, "ListDevices"}, - {405, &NfcInterface::GetDeviceState, "GetDeviceState"}, - {406, &NfcInterface::GetNpadId, "GetNpadId"}, - {407, &NfcInterface::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, - {408, &NfcInterface::StartDetection, "StartDetection"}, - {409, &NfcInterface::StopDetection, "StopDetection"}, - {410, &NfcInterface::GetTagInfo, "GetTagInfo"}, - {411, &NfcInterface::AttachActivateEvent, "AttachActivateEvent"}, - {412, &NfcInterface::AttachDeactivateEvent, "AttachDeactivateEvent"}, - {500, &NfcInterface::SetNfcEnabled, "SetNfcEnabled"}, - {510, nullptr, "OutputTestWave"}, - {1000, &NfcInterface::ReadMifare, "ReadMifare"}, - {1001, &NfcInterface::WriteMifare, "WriteMifare"}, - {1300, &NfcInterface::SendCommandByPassThrough, "SendCommandByPassThrough"}, - {1301, nullptr, "KeepPassThroughSession"}, - {1302, nullptr, "ReleasePassThroughSession"}, - }; - // clang-format on + explicit ISystem(Core::System& system_) : NfcInterface{system_, "NFC::ISystem", BackendType::Nfc} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + static constexpr auto functions = CreateStaticMapWithClass( + FunctionInfoTyped{0, &NfcInterface::Initialize, "InitializeOld"}, + FunctionInfoTyped{1, &NfcInterface::Finalize, "FinalizeOld"}, + FunctionInfoTyped{2, &NfcInterface::GetState, "GetStateOld"}, + FunctionInfoTyped{3, &NfcInterface::IsNfcEnabled, "IsNfcEnabledOld"}, + FunctionInfoTyped{100, &NfcInterface::SetNfcEnabled, "SetNfcEnabledOld"}, + FunctionInfoTyped{400, &NfcInterface::Initialize, "Initialize"}, + FunctionInfoTyped{401, &NfcInterface::Finalize, "Finalize"}, + FunctionInfoTyped{402, &NfcInterface::GetState, "GetState"}, + FunctionInfoTyped{403, &NfcInterface::IsNfcEnabled, "IsNfcEnabled"}, + FunctionInfoTyped{404, &NfcInterface::ListDevices, "ListDevices"}, + FunctionInfoTyped{405, &NfcInterface::GetDeviceState, "GetDeviceState"}, + FunctionInfoTyped{406, &NfcInterface::GetNpadId, "GetNpadId"}, + FunctionInfoTyped{407, &NfcInterface::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, + FunctionInfoTyped{408, &NfcInterface::StartDetection, "StartDetection"}, + FunctionInfoTyped{409, &NfcInterface::StopDetection, "StopDetection"}, + FunctionInfoTyped{410, &NfcInterface::GetTagInfo, "GetTagInfo"}, + FunctionInfoTyped{411, &NfcInterface::AttachActivateEvent, "AttachActivateEvent"}, + FunctionInfoTyped{412, &NfcInterface::AttachDeactivateEvent, "AttachDeactivateEvent"}, + FunctionInfoTyped{500, &NfcInterface::SetNfcEnabled, "SetNfcEnabled"}, + FunctionInfoTyped{510, nullptr, "OutputTestWave"}, + FunctionInfoTyped{1000, &NfcInterface::ReadMifare, "ReadMifare"}, + FunctionInfoTyped{1001, &NfcInterface::WriteMifare, "WriteMifare"}, + FunctionInfoTyped{1300, &NfcInterface::SendCommandByPassThrough, "SendCommandByPassThrough"}, + FunctionInfoTyped{1301, nullptr, "KeepPassThroughSession"}, + FunctionInfoTyped{1302, nullptr, "ReleasePassThroughSession"} + ); }; // MFInterface has an unique interface but it's identical to NfcInterface so we can keep the code @@ -93,56 +90,49 @@ public: using MFInterface = NfcInterface; class MFIUser final : public MFInterface { public: - explicit MFIUser(Core::System& system_) - : MFInterface{system_, "NFC::MFInterface", BackendType::Mifare} { - // clang-format off - static const FunctionInfoTyped functions[] = { - {0, &MFIUser::Initialize, "Initialize"}, - {1, &MFIUser::Finalize, "Finalize"}, - {2, &MFIUser::ListDevices, "ListDevices"}, - {3, &MFIUser::StartDetection, "StartDetection"}, - {4, &MFIUser::StopDetection, "StopDetection"}, - {5, &MFIUser::ReadMifare, "Read"}, - {6, &MFIUser::WriteMifare, "Write"}, - {7, &MFIUser::GetTagInfo, "GetTagInfo"}, - {8, &MFIUser::AttachActivateEvent, "GetActivateEventHandle"}, - {9, &MFIUser::AttachDeactivateEvent, "GetDeactivateEventHandle"}, - {10, &MFIUser::GetState, "GetState"}, - {11, &MFIUser::GetDeviceState, "GetDeviceState"}, - {12, &MFIUser::GetNpadId, "GetNpadId"}, - {13, &MFIUser::AttachAvailabilityChangeEvent, "GetAvailabilityChangeEventHandle"}, - }; - // clang-format on + explicit MFIUser(Core::System& system_) : MFInterface{system_, "NFC::MFInterface", BackendType::Mifare} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + static constexpr auto functions = CreateStaticMapWithClass( + FunctionInfoTyped{0, &MFIUser::Initialize, "Initialize"}, + FunctionInfoTyped{1, &MFIUser::Finalize, "Finalize"}, + FunctionInfoTyped{2, &MFIUser::ListDevices, "ListDevices"}, + FunctionInfoTyped{3, &MFIUser::StartDetection, "StartDetection"}, + FunctionInfoTyped{4, &MFIUser::StopDetection, "StopDetection"}, + FunctionInfoTyped{5, &MFIUser::ReadMifare, "Read"}, + FunctionInfoTyped{6, &MFIUser::WriteMifare, "Write"}, + FunctionInfoTyped{7, &MFIUser::GetTagInfo, "GetTagInfo"}, + FunctionInfoTyped{8, &MFIUser::AttachActivateEvent, "GetActivateEventHandle"}, + FunctionInfoTyped{9, &MFIUser::AttachDeactivateEvent, "GetDeactivateEventHandle"}, + FunctionInfoTyped{10, &MFIUser::GetState, "GetState"}, + FunctionInfoTyped{11, &MFIUser::GetDeviceState, "GetDeviceState"}, + FunctionInfoTyped{12, &MFIUser::GetNpadId, "GetNpadId"}, + FunctionInfoTyped{13, &MFIUser::AttachAvailabilityChangeEvent, "GetAvailabilityChangeEventHandle"} + ); }; class IAm final : public ServiceFramework { public: - explicit IAm(Core::System& system_) : ServiceFramework{system_, "NFC::IAm"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "Initialize"}, - {1, nullptr, "Finalize"}, - {2, nullptr, "NotifyForegroundApplet"}, - }; - // clang-format on + explicit IAm(Core::System& system_) : ServiceFramework{system_, "NFC::IAm"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "Initialize"}, + FunctionInfo{1, nullptr, "Finalize"}, + FunctionInfo{2, nullptr, "NotifyForegroundApplet"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class NFC_AM final : public ServiceFramework { public: - explicit NFC_AM(Core::System& system_) : ServiceFramework{system_, "nfc:am"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &NFC_AM::CreateAmNfcInterface, "CreateAmNfcInterface"}, - }; - // clang-format on + explicit NFC_AM(Core::System& system_) : ServiceFramework{system_, "nfc:am"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -153,18 +143,18 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &NFC_AM::CreateAmNfcInterface, "CreateAmNfcInterface"} + ); }; class NFC_MF_U final : public ServiceFramework { public: - explicit NFC_MF_U(Core::System& system_) : ServiceFramework{system_, "nfc:mf:u"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &NFC_MF_U::CreateUserNfcInterface, "CreateUserNfcInterface"}, - }; - // clang-format on + explicit NFC_MF_U(Core::System& system_) : ServiceFramework{system_, "nfc:mf:u"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -175,18 +165,18 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &NFC_MF_U::CreateUserNfcInterface, "CreateUserNfcInterface"} + ); }; class NFC_U final : public ServiceFramework { public: - explicit NFC_U(Core::System& system_) : ServiceFramework{system_, "nfc:user"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &NFC_U::CreateUserNfcInterface, "CreateUserNfcInterface"}, - }; - // clang-format on + explicit NFC_U(Core::System& system_) : ServiceFramework{system_, "nfc:user"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -197,18 +187,18 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &NFC_U::CreateUserNfcInterface, "CreateUserNfcInterface"} + ); }; class NFC_SYS final : public ServiceFramework { public: - explicit NFC_SYS(Core::System& system_) : ServiceFramework{system_, "nfc:sys"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &NFC_SYS::CreateSystemNfcInterface, "CreateSystemNfcInterface"}, - }; - // clang-format on + explicit NFC_SYS(Core::System& system_) : ServiceFramework{system_, "nfc:sys"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -219,6 +209,10 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &NFC_SYS::CreateSystemNfcInterface, "CreateSystemNfcInterface"} + ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/nfp/nfp.cpp b/src/core/hle/service/nfp/nfp.cpp index e0c24679ab..bfeb7d5553 100644 --- a/src/core/hle/service/nfp/nfp.cpp +++ b/src/core/hle/service/nfp/nfp.cpp @@ -14,145 +14,134 @@ namespace Service::NFP { class IUser final : public Interface { public: - explicit IUser(Core::System& system_) : Interface(system_, "NFP:IUser") { - // clang-format off - static const FunctionInfoTyped functions[] = { - {0, &IUser::Initialize, "Initialize"}, - {1, &IUser::Finalize, "Finalize"}, - {2, &IUser::ListDevices, "ListDevices"}, - {3, &IUser::StartDetection, "StartDetection"}, - {4, &IUser::StopDetection, "StopDetection"}, - {5, &IUser::Mount, "Mount"}, - {6, &IUser::Unmount, "Unmount"}, - {7, &IUser::OpenApplicationArea, "OpenApplicationArea"}, - {8, &IUser::GetApplicationArea, "GetApplicationArea"}, - {9, &IUser::SetApplicationArea, "SetApplicationArea"}, - {10, &IUser::Flush, "Flush"}, - {11, &IUser::Restore, "Restore"}, - {12, &IUser::CreateApplicationArea, "CreateApplicationArea"}, - {13, &IUser::GetTagInfo, "GetTagInfo"}, - {14, &IUser::GetRegisterInfo, "GetRegisterInfo"}, - {15, &IUser::GetCommonInfo, "GetCommonInfo"}, - {16, &IUser::GetModelInfo, "GetModelInfo"}, - {17, &IUser::AttachActivateEvent, "AttachActivateEvent"}, - {18, &IUser::AttachDeactivateEvent, "AttachDeactivateEvent"}, - {19, &IUser::GetState, "GetState"}, - {20, &IUser::GetDeviceState, "GetDeviceState"}, - {21, &IUser::GetNpadId, "GetNpadId"}, - {22, &IUser::GetApplicationAreaSize, "GetApplicationAreaSize"}, - {23, &IUser::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, - {24, &IUser::RecreateApplicationArea, "RecreateApplicationArea"}, - {25, &IUser::StartDetection, "StartDetectionWithFilter"}, - }; - // clang-format on + explicit IUser(Core::System& system_) : Interface(system_, "NFP:IUser") {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + static constexpr auto functions = CreateStaticMapWithClass( + FunctionInfoTyped{0, &IUser::Initialize, "Initialize"}, + FunctionInfoTyped{1, &IUser::Finalize, "Finalize"}, + FunctionInfoTyped{2, &IUser::ListDevices, "ListDevices"}, + FunctionInfoTyped{3, &IUser::StartDetection, "StartDetection"}, + FunctionInfoTyped{4, &IUser::StopDetection, "StopDetection"}, + FunctionInfoTyped{5, &IUser::Mount, "Mount"}, + FunctionInfoTyped{6, &IUser::Unmount, "Unmount"}, + FunctionInfoTyped{7, &IUser::OpenApplicationArea, "OpenApplicationArea"}, + FunctionInfoTyped{8, &IUser::GetApplicationArea, "GetApplicationArea"}, + FunctionInfoTyped{9, &IUser::SetApplicationArea, "SetApplicationArea"}, + FunctionInfoTyped{10, &IUser::Flush, "Flush"}, + FunctionInfoTyped{11, &IUser::Restore, "Restore"}, + FunctionInfoTyped{12, &IUser::CreateApplicationArea, "CreateApplicationArea"}, + FunctionInfoTyped{13, &IUser::GetTagInfo, "GetTagInfo"}, + FunctionInfoTyped{14, &IUser::GetRegisterInfo, "GetRegisterInfo"}, + FunctionInfoTyped{15, &IUser::GetCommonInfo, "GetCommonInfo"}, + FunctionInfoTyped{16, &IUser::GetModelInfo, "GetModelInfo"}, + FunctionInfoTyped{17, &IUser::AttachActivateEvent, "AttachActivateEvent"}, + FunctionInfoTyped{18, &IUser::AttachDeactivateEvent, "AttachDeactivateEvent"}, + FunctionInfoTyped{19, &IUser::GetState, "GetState"}, + FunctionInfoTyped{20, &IUser::GetDeviceState, "GetDeviceState"}, + FunctionInfoTyped{21, &IUser::GetNpadId, "GetNpadId"}, + FunctionInfoTyped{22, &IUser::GetApplicationAreaSize, "GetApplicationAreaSize"}, + FunctionInfoTyped{23, &IUser::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, + FunctionInfoTyped{24, &IUser::RecreateApplicationArea, "RecreateApplicationArea"}, + FunctionInfoTyped{25, &IUser::StartDetection, "StartDetectionWithFilter"} + ); }; class ISystem final : public Interface { public: - explicit ISystem(Core::System& system_) : Interface(system_, "NFP:ISystem") { - // clang-format off - static const FunctionInfoTyped functions[] = { - {0, &ISystem::InitializeSystem, "InitializeSystem"}, - {1, &ISystem::FinalizeSystem, "FinalizeSystem"}, - {2, &ISystem::ListDevices, "ListDevices"}, - {3, &ISystem::StartDetection, "StartDetection"}, - {4, &ISystem::StopDetection, "StopDetection"}, - {5, &ISystem::Mount, "Mount"}, - {6, &ISystem::Unmount, "Unmount"}, - {10, &ISystem::Flush, "Flush"}, - {11, &ISystem::Restore, "Restore"}, - {12, &ISystem::CreateApplicationArea, "CreateApplicationArea"}, - {13, &ISystem::GetTagInfo, "GetTagInfo"}, - {14, &ISystem::GetRegisterInfo, "GetRegisterInfo"}, - {15, &ISystem::GetCommonInfo, "GetCommonInfo"}, - {16, &ISystem::GetModelInfo, "GetModelInfo"}, - {17, &ISystem::AttachActivateEvent, "AttachActivateEvent"}, - {18, &ISystem::AttachDeactivateEvent, "AttachDeactivateEvent"}, - {19, &ISystem::GetState, "GetState"}, - {20, &ISystem::GetDeviceState, "GetDeviceState"}, - {21, &ISystem::GetNpadId, "GetNpadId"}, - {23, &ISystem::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, - {25, &ISystem::StartDetection, "StartDetectionWithFilter"}, - {100, &ISystem::Format, "Format"}, - {101, &ISystem::GetAdminInfo, "GetAdminInfo"}, - {102, &ISystem::GetRegisterInfoPrivate, "GetRegisterInfoPrivate"}, - {103, &ISystem::SetRegisterInfoPrivate, "SetRegisterInfoPrivate"}, - {104, &ISystem::DeleteRegisterInfo, "DeleteRegisterInfo"}, - {105, &ISystem::DeleteApplicationArea, "DeleteApplicationArea"}, - {106, &ISystem::ExistsApplicationArea, "ExistsApplicationArea"}, - }; - // clang-format on + explicit ISystem(Core::System& system_) : Interface(system_, "NFP:ISystem") {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + static constexpr auto functions = CreateStaticMapWithClass( + FunctionInfoTyped{0, &ISystem::InitializeSystem, "InitializeSystem"}, + FunctionInfoTyped{1, &ISystem::FinalizeSystem, "FinalizeSystem"}, + FunctionInfoTyped{2, &ISystem::ListDevices, "ListDevices"}, + FunctionInfoTyped{3, &ISystem::StartDetection, "StartDetection"}, + FunctionInfoTyped{4, &ISystem::StopDetection, "StopDetection"}, + FunctionInfoTyped{5, &ISystem::Mount, "Mount"}, + FunctionInfoTyped{6, &ISystem::Unmount, "Unmount"}, + FunctionInfoTyped{10, &ISystem::Flush, "Flush"}, + FunctionInfoTyped{11, &ISystem::Restore, "Restore"}, + FunctionInfoTyped{12, &ISystem::CreateApplicationArea, "CreateApplicationArea"}, + FunctionInfoTyped{13, &ISystem::GetTagInfo, "GetTagInfo"}, + FunctionInfoTyped{14, &ISystem::GetRegisterInfo, "GetRegisterInfo"}, + FunctionInfoTyped{15, &ISystem::GetCommonInfo, "GetCommonInfo"}, + FunctionInfoTyped{16, &ISystem::GetModelInfo, "GetModelInfo"}, + FunctionInfoTyped{17, &ISystem::AttachActivateEvent, "AttachActivateEvent"}, + FunctionInfoTyped{18, &ISystem::AttachDeactivateEvent, "AttachDeactivateEvent"}, + FunctionInfoTyped{19, &ISystem::GetState, "GetState"}, + FunctionInfoTyped{20, &ISystem::GetDeviceState, "GetDeviceState"}, + FunctionInfoTyped{21, &ISystem::GetNpadId, "GetNpadId"}, + FunctionInfoTyped{23, &ISystem::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, + FunctionInfoTyped{25, &ISystem::StartDetection, "StartDetectionWithFilter"}, + FunctionInfoTyped{100, &ISystem::Format, "Format"}, + FunctionInfoTyped{101, &ISystem::GetAdminInfo, "GetAdminInfo"}, + FunctionInfoTyped{102, &ISystem::GetRegisterInfoPrivate, "GetRegisterInfoPrivate"}, + FunctionInfoTyped{103, &ISystem::SetRegisterInfoPrivate, "SetRegisterInfoPrivate"}, + FunctionInfoTyped{104, &ISystem::DeleteRegisterInfo, "DeleteRegisterInfo"}, + FunctionInfoTyped{105, &ISystem::DeleteApplicationArea, "DeleteApplicationArea"}, + FunctionInfoTyped{106, &ISystem::ExistsApplicationArea, "ExistsApplicationArea"} + ); }; class IDebug final : public Interface { public: - explicit IDebug(Core::System& system_) : Interface(system_, "NFP:IDebug") { - // clang-format off - static const FunctionInfoTyped functions[] = { - {0, &IDebug::InitializeDebug, "InitializeDebug"}, - {1, &IDebug::FinalizeDebug, "FinalizeDebug"}, - {2, &IDebug::ListDevices, "ListDevices"}, - {3, &IDebug::StartDetection, "StartDetection"}, - {4, &IDebug::StopDetection, "StopDetection"}, - {5, &IDebug::Mount, "Mount"}, - {6, &IDebug::Unmount, "Unmount"}, - {7, &IDebug::OpenApplicationArea, "OpenApplicationArea"}, - {8, &IDebug::GetApplicationArea, "GetApplicationArea"}, - {9, &IDebug::SetApplicationArea, "SetApplicationArea"}, - {10, &IDebug::Flush, "Flush"}, - {11, &IDebug::Restore, "Restore"}, - {12, &IDebug::CreateApplicationArea, "CreateApplicationArea"}, - {13, &IDebug::GetTagInfo, "GetTagInfo"}, - {14, &IDebug::GetRegisterInfo, "GetRegisterInfo"}, - {15, &IDebug::GetCommonInfo, "GetCommonInfo"}, - {16, &IDebug::GetModelInfo, "GetModelInfo"}, - {17, &IDebug::AttachActivateEvent, "AttachActivateEvent"}, - {18, &IDebug::AttachDeactivateEvent, "AttachDeactivateEvent"}, - {19, &IDebug::GetState, "GetState"}, - {20, &IDebug::GetDeviceState, "GetDeviceState"}, - {21, &IDebug::GetNpadId, "GetNpadId"}, - {22, &IDebug::GetApplicationAreaSize, "GetApplicationAreaSize"}, - {23, &IDebug::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, - {24, &IDebug::RecreateApplicationArea, "RecreateApplicationArea"}, - {25, &IDebug::StartDetection, "StartDetectionWithFilter"}, - {100, &IDebug::Format, "Format"}, - {101, &IDebug::GetAdminInfo, "GetAdminInfo"}, - {102, &IDebug::GetRegisterInfoPrivate, "GetRegisterInfoPrivate"}, - {103, &IDebug::SetRegisterInfoPrivate, "SetRegisterInfoPrivate"}, - {104, &IDebug::DeleteRegisterInfo, "DeleteRegisterInfo"}, - {105, &IDebug::DeleteApplicationArea, "DeleteApplicationArea"}, - {106, &IDebug::ExistsApplicationArea, "ExistsApplicationArea"}, - {200, &IDebug::GetAll, "GetAll"}, - {201, &IDebug::SetAll, "SetAll"}, - {202, &IDebug::FlushDebug, "FlushDebug"}, - {203, &IDebug::BreakTag, "BreakTag"}, - {204, &IDebug::ReadBackupData, "ReadBackupData"}, - {205, &IDebug::WriteBackupData, "WriteBackupData"}, - {206, &IDebug::WriteNtf, "WriteNtf"}, - }; - // clang-format on + explicit IDebug(Core::System& system_) : Interface(system_, "NFP:IDebug") {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + static constexpr auto functions = CreateStaticMapWithClass( + FunctionInfoTyped{0, &IDebug::InitializeDebug, "InitializeDebug"}, + FunctionInfoTyped{1, &IDebug::FinalizeDebug, "FinalizeDebug"}, + FunctionInfoTyped{2, &IDebug::ListDevices, "ListDevices"}, + FunctionInfoTyped{3, &IDebug::StartDetection, "StartDetection"}, + FunctionInfoTyped{4, &IDebug::StopDetection, "StopDetection"}, + FunctionInfoTyped{5, &IDebug::Mount, "Mount"}, + FunctionInfoTyped{6, &IDebug::Unmount, "Unmount"}, + FunctionInfoTyped{7, &IDebug::OpenApplicationArea, "OpenApplicationArea"}, + FunctionInfoTyped{8, &IDebug::GetApplicationArea, "GetApplicationArea"}, + FunctionInfoTyped{9, &IDebug::SetApplicationArea, "SetApplicationArea"}, + FunctionInfoTyped{10, &IDebug::Flush, "Flush"}, + FunctionInfoTyped{11, &IDebug::Restore, "Restore"}, + FunctionInfoTyped{12, &IDebug::CreateApplicationArea, "CreateApplicationArea"}, + FunctionInfoTyped{13, &IDebug::GetTagInfo, "GetTagInfo"}, + FunctionInfoTyped{14, &IDebug::GetRegisterInfo, "GetRegisterInfo"}, + FunctionInfoTyped{15, &IDebug::GetCommonInfo, "GetCommonInfo"}, + FunctionInfoTyped{16, &IDebug::GetModelInfo, "GetModelInfo"}, + FunctionInfoTyped{17, &IDebug::AttachActivateEvent, "AttachActivateEvent"}, + FunctionInfoTyped{18, &IDebug::AttachDeactivateEvent, "AttachDeactivateEvent"}, + FunctionInfoTyped{19, &IDebug::GetState, "GetState"}, + FunctionInfoTyped{20, &IDebug::GetDeviceState, "GetDeviceState"}, + FunctionInfoTyped{21, &IDebug::GetNpadId, "GetNpadId"}, + FunctionInfoTyped{22, &IDebug::GetApplicationAreaSize, "GetApplicationAreaSize"}, + FunctionInfoTyped{23, &IDebug::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, + FunctionInfoTyped{24, &IDebug::RecreateApplicationArea, "RecreateApplicationArea"}, + FunctionInfoTyped{25, &IDebug::StartDetection, "StartDetectionWithFilter"}, + FunctionInfoTyped{100, &IDebug::Format, "Format"}, + FunctionInfoTyped{101, &IDebug::GetAdminInfo, "GetAdminInfo"}, + FunctionInfoTyped{102, &IDebug::GetRegisterInfoPrivate, "GetRegisterInfoPrivate"}, + FunctionInfoTyped{103, &IDebug::SetRegisterInfoPrivate, "SetRegisterInfoPrivate"}, + FunctionInfoTyped{104, &IDebug::DeleteRegisterInfo, "DeleteRegisterInfo"}, + FunctionInfoTyped{105, &IDebug::DeleteApplicationArea, "DeleteApplicationArea"}, + FunctionInfoTyped{106, &IDebug::ExistsApplicationArea, "ExistsApplicationArea"}, + FunctionInfoTyped{200, &IDebug::GetAll, "GetAll"}, + FunctionInfoTyped{201, &IDebug::SetAll, "SetAll"}, + FunctionInfoTyped{202, &IDebug::FlushDebug, "FlushDebug"}, + FunctionInfoTyped{203, &IDebug::BreakTag, "BreakTag"}, + FunctionInfoTyped{204, &IDebug::ReadBackupData, "ReadBackupData"}, + FunctionInfoTyped{205, &IDebug::WriteBackupData, "WriteBackupData"}, + FunctionInfoTyped{206, &IDebug::WriteNtf, "WriteNtf"} + ); }; class IUserManager final : public ServiceFramework { public: - explicit IUserManager(Core::System& system_) : ServiceFramework{system_, "nfp:user"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &IUserManager::CreateUserInterface, "CreateUserInterface"}, - }; - // clang-format on - - RegisterHandlers(functions); - } + explicit IUserManager(Core::System& system_) : ServiceFramework{system_, "nfp:user"} {} private: void CreateUserInterface(HLERequestContext& ctx) { @@ -162,18 +151,21 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &IUserManager::CreateUserInterface, "CreateUserInterface"} + ); }; class ISystemManager final : public ServiceFramework { public: - explicit ISystemManager(Core::System& system_) : ServiceFramework{system_, "nfp:sys"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &ISystemManager::CreateSystemInterface, "CreateSystemInterface"}, - }; - // clang-format on + explicit ISystemManager(Core::System& system_) : ServiceFramework{system_, "nfp:sys"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -184,18 +176,18 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &ISystemManager::CreateSystemInterface, "CreateSystemInterface"} + ); }; class IDebugManager final : public ServiceFramework { public: - explicit IDebugManager(Core::System& system_) : ServiceFramework{system_, "nfp:dbg"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &IDebugManager::CreateDebugInterface, "CreateDebugInterface"}, - }; - // clang-format on + explicit IDebugManager(Core::System& system_) : ServiceFramework{system_, "nfp:dbg"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -206,6 +198,10 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &IDebugManager::CreateDebugInterface, "CreateDebugInterface"} + ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/ngc/ngc.cpp b/src/core/hle/service/ngc/ngc.cpp index e79108a1eb..fb3ef39093 100644 --- a/src/core/hle/service/ngc/ngc.cpp +++ b/src/core/hle/service/ngc/ngc.cpp @@ -21,15 +21,10 @@ namespace Service::NGC { class IService final : public ServiceFramework { public: - explicit IService(Core::System& system_) : ServiceFramework{system_, "ngct:u"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &IService::Match, "Match"}, - {1, &IService::Filter, "Filter"}, - }; - // clang-format on + explicit IService(Core::System& system_) : ServiceFramework{system_, "ngct:u"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -61,23 +56,19 @@ private: IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &IService::Match, "Match"}, + FunctionInfo{1, &IService::Filter, "Filter"} + ); }; class NgcServiceImpl final : public ServiceFramework { public: - explicit NgcServiceImpl(Core::System& system_) : ServiceFramework(system_, "ngc:u") { - // clang-format off - static const FunctionInfo functions[] = { - {0, &NgcServiceImpl::GetContentVersion, "GetContentVersion"}, - {1, &NgcServiceImpl::Check, "Check"}, - {2, &NgcServiceImpl::Mask, "Mask"}, - {3, &NgcServiceImpl::Reload, "Reload"}, - {4, &NgcServiceImpl::Check, "Check2"}, - {5, &NgcServiceImpl::Mask, "Mask2"}, - }; - // clang-format on + explicit NgcServiceImpl(Core::System& system_) : ServiceFramework(system_, "ngc:u") {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -150,25 +141,34 @@ private: IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &NgcServiceImpl::GetContentVersion, "GetContentVersion"}, + FunctionInfo{1, &NgcServiceImpl::Check, "Check"}, + FunctionInfo{2, &NgcServiceImpl::Mask, "Mask"}, + FunctionInfo{3, &NgcServiceImpl::Reload, "Reload"}, + FunctionInfo{4, &NgcServiceImpl::Check, "Check2"}, + FunctionInfo{5, &NgcServiceImpl::Mask, "Mask2"} + ); }; class IServiceWithManagementApi final : public ServiceFramework { public: - explicit IServiceWithManagementApi(Core::System& system_) : ServiceFramework(system_, "ngct:s") { - // clang-format off - static const FunctionInfo functions[] = { - {0 , nullptr, "Match"}, - {1 , nullptr, "Filter"}, - {100, nullptr, "ConfigureAutoUpdateSetting"}, - {101, nullptr, "RequestResourceUpdateCheck"}, - {110, nullptr, "Reload"}, - {111, nullptr, "IsReloadRequired"}, - {112, nullptr, "TryAcquireReloadRequestNotifier"}, - {120, nullptr, "CalculateContentFingerprint"}, - {130, nullptr, "TryEnableTemporalPassThrough"}, - }; - // clang-format on - RegisterHandlers(functions); + explicit IServiceWithManagementApi(Core::System& system_) : ServiceFramework(system_, "ngct:s") {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "Match"}, + FunctionInfo{1, nullptr, "Filter"}, + FunctionInfo{100, nullptr, "ConfigureAutoUpdateSetting"}, + FunctionInfo{101, nullptr, "RequestResourceUpdateCheck"}, + FunctionInfo{110, nullptr, "Reload"}, + FunctionInfo{111, nullptr, "IsReloadRequired"}, + FunctionInfo{112, nullptr, "TryAcquireReloadRequestNotifier"}, + FunctionInfo{120, nullptr, "CalculateContentFingerprint"}, + FunctionInfo{130, nullptr, "TryEnableTemporalPassThrough"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; @@ -179,20 +179,10 @@ static_assert(sizeof(SaveDataHandle) == 0x08); class IUserShimScopedObject final : public ServiceFramework { public: - explicit IUserShimScopedObject(Core::System& system_) : ServiceFramework(system_, "IUserShimScopedObject") { - // clang-format off - static const FunctionInfo functions[] = { - {450, nullptr, "InitializeForSaveData"}, - {451, nullptr, "FinalizeForSaveData"}, - {452, D<&IUserShimScopedObject::OpenSaveData>, "OpenSaveData"}, - {453, nullptr, "CloseSaveData"}, - {454, D<&IUserShimScopedObject::ReadSaveSlot>, "ReadSaveSlot"}, - {455, D<&IUserShimScopedObject::WriteSaveSlot>, "WriteSaveSlot"}, - {456, nullptr, "FlushSaveSlot"}, - {457, nullptr, "CommitSaveData"}, - }; - // clang-format on - RegisterHandlers(functions); + explicit IUserShimScopedObject(Core::System& system_) : ServiceFramework(system_, "IUserShimScopedObject") {} + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } Result OpenSaveData(Account::Uid unk0, Out unk1) { @@ -210,42 +200,43 @@ public: // to implement R_SUCCEED(); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{450, nullptr, "InitializeForSaveData"}, + FunctionInfo{451, nullptr, "FinalizeForSaveData"}, + FunctionInfo{452, D<&IUserShimScopedObject::OpenSaveData>, "OpenSaveData"}, + FunctionInfo{453, nullptr, "CloseSaveData"}, + FunctionInfo{454, D<&IUserShimScopedObject::ReadSaveSlot>, "ReadSaveSlot"}, + FunctionInfo{455, D<&IUserShimScopedObject::WriteSaveSlot>, "WriteSaveSlot"}, + FunctionInfo{456, nullptr, "FlushSaveSlot"}, + FunctionInfo{457, nullptr, "CommitSaveData"} + ); }; class IUserService final : public ServiceFramework { public: - explicit IUserService(Core::System& system_) : ServiceFramework(system_, "stpl:u") { - // clang-format off - static const FunctionInfo functions[] = { - {0 , D<&IUserService::Cmd0>, "Cmd0"}, - }; - // clang-format on - RegisterHandlers(functions); + explicit IUserService(Core::System& system_) : ServiceFramework(system_, "stpl:u") {} + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } Result Cmd0(u32 unk0, OutInterface out_interface) { LOG_WARNING(Service_NGC, "stubbed"); *out_interface = std::make_shared(system); R_SUCCEED(); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IUserService::Cmd0>, "Cmd0"} + ); }; class ISystemShimScopedObject final : public ServiceFramework { public: - explicit ISystemShimScopedObject(Core::System& system_) : ServiceFramework(system_, "ISystemShimScopedObject") { - // clang-format off - static const FunctionInfo functions[] = { - {106, nullptr, "Cmd106"}, - {107, nullptr, "Cmd107"}, - {108, D<&ISystemShimScopedObject::Cmd108>, "Cmd108"}, - {207, nullptr, "Cmd207"}, - {208, D<&ISystemShimScopedObject::Cmd208>, "Cmd208"}, - {209, nullptr, "Cmd209"}, - {210, nullptr, "Cmd210"}, - {211, nullptr, "Cmd211"}, - {212, nullptr, "Cmd212"}, - }; - // clang-format on - RegisterHandlers(functions); + explicit ISystemShimScopedObject(Core::System& system_) : ServiceFramework(system_, "ISystemShimScopedObject") {} + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } Result Cmd108() { @@ -257,23 +248,36 @@ public: LOG_WARNING(Service_NGC, "stubbed"); R_THROW(IPC::ResultNotSupported); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{106, nullptr, "Cmd106"}, + FunctionInfo{107, nullptr, "Cmd107"}, + FunctionInfo{108, D<&ISystemShimScopedObject::Cmd108>, "Cmd108"}, + FunctionInfo{207, nullptr, "Cmd207"}, + FunctionInfo{208, D<&ISystemShimScopedObject::Cmd208>, "Cmd208"}, + FunctionInfo{209, nullptr, "Cmd209"}, + FunctionInfo{210, nullptr, "Cmd210"}, + FunctionInfo{211, nullptr, "Cmd211"}, + FunctionInfo{212, nullptr, "Cmd212"} + ); }; class ISystemService final : public ServiceFramework { public: - explicit ISystemService(Core::System& system_) : ServiceFramework(system_, "stpl:sys") { - // clang-format off - static const FunctionInfo functions[] = { - {0 , D<&ISystemService::Cmd0>, "Cmd0"}, - }; - // clang-format on - RegisterHandlers(functions); + explicit ISystemService(Core::System& system_) : ServiceFramework(system_, "stpl:sys") {} + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } Result Cmd0(OutInterface out_interface) { LOG_WARNING(Service_NGC, "stubbed"); *out_interface = std::make_shared(system); R_SUCCEED(); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&ISystemService::Cmd0>, "Cmd0"} + ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp index efada9b807..5befe8e943 100644 --- a/src/core/hle/service/nifm/nifm.cpp +++ b/src/core/hle/service/nifm/nifm.cpp @@ -235,15 +235,6 @@ public: explicit IScanRequest(Core::System& system_) : ServiceFramework{system_, "IScanRequest"}, svc_ctx{system_, "IScanRequest"} { - static const FunctionInfo functions[] = { - {0, &IScanRequest::Submit, "Submit"}, - {1, &IScanRequest::IsProcessing, "IsProcessing"}, - {2, &IScanRequest::GetResult, "GetResult"}, - {3, &IScanRequest::GetSystemEventReadableHandle, "GetSystemEventReadableHandle"}, - {4, &IScanRequest::SetChannels, "SetChannels"}, - }; - RegisterHandlers(functions); - evt_scan_complete = CreateKEvent(svc_ctx, "IScanRequest:Complete"); evt_processing = CreateKEvent(svc_ctx, "IScanRequest:Processing"); } @@ -257,8 +248,6 @@ public: } private: - std::vector scan_results; - void Submit(HLERequestContext& ctx) { if (state.load() == State::Finished) { @@ -329,6 +318,17 @@ private: evt_scan_complete->Signal(system.Kernel()); } + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &IScanRequest::Submit, "Submit"}, + FunctionInfo{1, &IScanRequest::IsProcessing, "IsProcessing"}, + FunctionInfo{2, &IScanRequest::GetResult, "GetResult"}, + FunctionInfo{3, &IScanRequest::GetSystemEventReadableHandle, "GetSystemEventReadableHandle"}, + FunctionInfo{4, &IScanRequest::SetChannels, "SetChannels"} + ); + std::vector scan_results; KernelHelpers::ServiceContext svc_ctx; Kernel::KEvent* evt_scan_complete{}; @@ -342,36 +342,6 @@ class IRequest final : public ServiceFramework { public: explicit IRequest(Core::System& system_) : ServiceFramework{system_, "IRequest"}, service_context{system_, "IRequest"} { - static const FunctionInfo functions[] = { - {0, &IRequest::GetRequestState, "GetRequestState"}, - {1, &IRequest::GetResult, "GetResult"}, - {2, &IRequest::GetSystemEventReadableHandles, "GetSystemEventReadableHandles"}, - {3, &IRequest::Cancel, "Cancel"}, - {4, &IRequest::Submit, "Submit"}, - {5, nullptr, "SetRequirement"}, - {6, &IRequest::SetRequirementPreset, "SetRequirementPreset"}, - {8, nullptr, "SetPriority"}, - {9, &IRequest::SetNetworkProfileId, "SetNetworkProfileId"}, - {10, nullptr, "SetRejectable"}, - {11, &IRequest::SetConnectionConfirmationOption, "SetConnectionConfirmationOption"}, - {12, nullptr, "SetPersistent"}, - {13, nullptr, "SetInstant"}, - {14, nullptr, "SetSustainable"}, - {15, nullptr, "SetRawPriority"}, - {16, nullptr, "SetGreedy"}, - {17, nullptr, "SetSharable"}, - {18, nullptr, "SetRequirementByRevision"}, - {19, nullptr, "GetRequirement"}, - {20, nullptr, "GetRevision"}, - {21, &IRequest::GetAppletInfo, "GetAppletInfo"}, - {22, nullptr, "GetAdditionalInfo"}, - {23, nullptr, "SetKeptInSleep"}, - {24, nullptr, "RegisterSocketDescriptor"}, - {25, nullptr, "UnregisterSocketDescriptor"}, - {26, nullptr, "GetNetworkAccessStatus"}, //21.0.0+ - }; - RegisterHandlers(functions); - event1 = CreateKEvent(service_context, "IRequest:Event1"); event2 = CreateKEvent(service_context, "IRequest:Event2"); state = RequestState::NotSubmitted; @@ -494,6 +464,37 @@ private: event1->Signal(system.Kernel()); } + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &IRequest::GetRequestState, "GetRequestState"}, + FunctionInfo{1, &IRequest::GetResult, "GetResult"}, + FunctionInfo{2, &IRequest::GetSystemEventReadableHandles, "GetSystemEventReadableHandles"}, + FunctionInfo{3, &IRequest::Cancel, "Cancel"}, + FunctionInfo{4, &IRequest::Submit, "Submit"}, + FunctionInfo{5, nullptr, "SetRequirement"}, + FunctionInfo{6, &IRequest::SetRequirementPreset, "SetRequirementPreset"}, + FunctionInfo{8, nullptr, "SetPriority"}, + FunctionInfo{9, &IRequest::SetNetworkProfileId, "SetNetworkProfileId"}, + FunctionInfo{10, nullptr, "SetRejectable"}, + FunctionInfo{11, &IRequest::SetConnectionConfirmationOption, "SetConnectionConfirmationOption"}, + FunctionInfo{12, nullptr, "SetPersistent"}, + FunctionInfo{13, nullptr, "SetInstant"}, + FunctionInfo{14, nullptr, "SetSustainable"}, + FunctionInfo{15, nullptr, "SetRawPriority"}, + FunctionInfo{16, nullptr, "SetGreedy"}, + FunctionInfo{17, nullptr, "SetSharable"}, + FunctionInfo{18, nullptr, "SetRequirementByRevision"}, + FunctionInfo{19, nullptr, "GetRequirement"}, + FunctionInfo{20, nullptr, "GetRevision"}, + FunctionInfo{21, &IRequest::GetAppletInfo, "GetAppletInfo"}, + FunctionInfo{22, nullptr, "GetAdditionalInfo"}, + FunctionInfo{23, nullptr, "SetKeptInSleep"}, + FunctionInfo{24, nullptr, "RegisterSocketDescriptor"}, + FunctionInfo{25, nullptr, "UnregisterSocketDescriptor"}, + FunctionInfo{26, nullptr, "GetNetworkAccessStatus", MakeVersionGate({21,0,0})} + ); KernelHelpers::ServiceContext service_context; RequestState state; @@ -508,14 +509,16 @@ private: class INetworkProfile final : public ServiceFramework { public: - explicit INetworkProfile(Core::System& system_) : ServiceFramework{system_, "INetworkProfile"} { - static const FunctionInfo functions[] = { - {0, nullptr, "Update"}, - {1, nullptr, "PersistOld"}, - {2, nullptr, "Persist"}, - }; - RegisterHandlers(functions); + explicit INetworkProfile(Core::System& system_) : ServiceFramework{system_, "INetworkProfile"} {} + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "Update"}, + FunctionInfo{1, nullptr, "PersistOld"}, + FunctionInfo{2, nullptr, "Persist"} + ); }; void IGeneralService::GetClientId(HLERequestContext& ctx) { @@ -1050,78 +1053,70 @@ void IGeneralService::GetCurrentAccessPoint(HLERequestContext& ctx) { rb.Push(ResultSuccess); } +std::optional IGeneralService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{1, &IGeneralService::GetClientId, "GetClientId"}, + FunctionInfo{2, &IGeneralService::CreateScanRequest, "CreateScanRequest"}, + FunctionInfo{4, &IGeneralService::CreateRequest, "CreateRequest"}, + FunctionInfo{5, &IGeneralService::GetCurrentNetworkProfile, "GetCurrentNetworkProfile"}, + FunctionInfo{6, &IGeneralService::EnumerateNetworkInterfaces, "EnumerateNetworkInterfaces"}, + FunctionInfo{7, &IGeneralService::EnumerateNetworkProfiles, "EnumerateNetworkProfiles"}, + FunctionInfo{8, &IGeneralService::GetNetworkProfile, "GetNetworkProfile"}, + FunctionInfo{9, &IGeneralService::SetNetworkProfile, "SetNetworkProfile"}, + FunctionInfo{10, &IGeneralService::RemoveNetworkProfile, "RemoveNetworkProfile"}, + FunctionInfo{11, &IGeneralService::GetScanData, "GetScanDataOld"}, + FunctionInfo{12, &IGeneralService::GetCurrentIpAddress, "GetCurrentIpAddress"}, + FunctionInfo{13, nullptr, "GetCurrentAccessPointOld"}, + FunctionInfo{14, &IGeneralService::CreateTemporaryNetworkProfile, "CreateTemporaryNetworkProfile"}, + FunctionInfo{15, &IGeneralService::GetCurrentIpConfigInfo, "GetCurrentIpConfigInfo"}, + FunctionInfo{16, &IGeneralService::SetWirelessCommunicationEnabled, "SetWirelessCommunicationEnabled"}, + FunctionInfo{17, &IGeneralService::IsWirelessCommunicationEnabled, "IsWirelessCommunicationEnabled"}, + FunctionInfo{18, &IGeneralService::GetInternetConnectionStatus, "GetInternetConnectionStatus"}, + FunctionInfo{19, &IGeneralService::SetEthernetCommunicationEnabled, "SetEthernetCommunicationEnabled"}, + FunctionInfo{20, &IGeneralService::IsEthernetCommunicationEnabled, "IsEthernetCommunicationEnabled"}, + FunctionInfo{21, &IGeneralService::IsAnyInternetRequestAccepted, "IsAnyInternetRequestAccepted"}, + FunctionInfo{22, &IGeneralService::IsAnyForegroundRequestAccepted, "IsAnyForegroundRequestAccepted"}, + FunctionInfo{23, nullptr, "PutToSleep"}, + FunctionInfo{24, nullptr, "WakeUp"}, + FunctionInfo{25, &IGeneralService::GetSsidListVersion, "GetSsidListVersion"}, + FunctionInfo{26, nullptr, "SetExclusiveClient"}, + FunctionInfo{27, nullptr, "GetDefaultIpSetting"}, + FunctionInfo{28, nullptr, "SetDefaultIpSetting"}, + FunctionInfo{29, nullptr, "SetWirelessCommunicationEnabledForTest"}, + FunctionInfo{30, nullptr, "SetEthernetCommunicationEnabledForTest"}, + FunctionInfo{31, nullptr, "GetTelemetorySystemEventReadableHandle"}, + FunctionInfo{32, nullptr, "GetTelemetryInfo"}, + FunctionInfo{33, &IGeneralService::ConfirmSystemAvailability, "ConfirmSystemAvailability", MakeVersionGate({2,0,0})}, + FunctionInfo{34, &IGeneralService::SetBackgroundRequestEnabled, "SetBackgroundRequestEnabled", MakeVersionGate({4,0,0})}, + FunctionInfo{35, &IGeneralService::GetScanDataV2, "GetScanData"}, + FunctionInfo{36, &IGeneralService::GetCurrentAccessPoint, "GetCurrentAccessPoint"}, + FunctionInfo{37, nullptr, "Shutdown"}, + FunctionInfo{38, nullptr, "GetAllowedChannels"}, + FunctionInfo{39, nullptr, "NotifyApplicationSuspended"}, + FunctionInfo{40, nullptr, "SetAcceptableNetworkTypeFlag"}, + FunctionInfo{41, nullptr, "GetAcceptableNetworkTypeFlag"}, + FunctionInfo{42, nullptr, "NotifyConnectionStateChanged"}, + FunctionInfo{43, nullptr, "SetWowlDelayedWakeTime"}, + FunctionInfo{44, nullptr, "IsWiredConnectionAvailable", MakeVersionGate({18,0,0})}, + FunctionInfo{45, nullptr, "IsNetworkEmulationFeatureEnabled", MakeVersionGate({18,0,0})}, + FunctionInfo{46, nullptr, "SelectActiveNetworkEmulationProfileIdForDebug", MakeVersionGate({18,0,0})}, + FunctionInfo{47, &IGeneralService::GetScanDataV3, "GetScanData", MakeVersionGate({19,0,0})}, + FunctionInfo{50, nullptr, "IsRewriteFeatureEnabled", MakeVersionGate({18,0,0})}, + FunctionInfo{51, nullptr, "CreateRewriteRule", MakeVersionGate({18,0,0})}, + FunctionInfo{52, nullptr, "DestroyRewriteRule", MakeVersionGate({18,0,0})} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IGeneralService::IGeneralService(Core::System& system_) : ServiceFramework{system_, "IGeneralService"} { - // clang-format off - - static const FunctionInfo functions[] = { - {1, &IGeneralService::GetClientId, "GetClientId"}, - {2, &IGeneralService::CreateScanRequest, "CreateScanRequest"}, - {4, &IGeneralService::CreateRequest, "CreateRequest"}, - {5, &IGeneralService::GetCurrentNetworkProfile, "GetCurrentNetworkProfile"}, - {6, &IGeneralService::EnumerateNetworkInterfaces, "EnumerateNetworkInterfaces"}, - {7, &IGeneralService::EnumerateNetworkProfiles, "EnumerateNetworkProfiles"}, - {8, &IGeneralService::GetNetworkProfile, "GetNetworkProfile"}, - {9, &IGeneralService::SetNetworkProfile, "SetNetworkProfile"}, - {10, &IGeneralService::RemoveNetworkProfile, "RemoveNetworkProfile"}, - {11, &IGeneralService::GetScanData, "GetScanDataOld"}, - {12, &IGeneralService::GetCurrentIpAddress, "GetCurrentIpAddress"}, - {13, nullptr, "GetCurrentAccessPointOld"}, - {14, &IGeneralService::CreateTemporaryNetworkProfile, "CreateTemporaryNetworkProfile"}, - {15, &IGeneralService::GetCurrentIpConfigInfo, "GetCurrentIpConfigInfo"}, - {16, &IGeneralService::SetWirelessCommunicationEnabled, "SetWirelessCommunicationEnabled"}, - {17, &IGeneralService::IsWirelessCommunicationEnabled, "IsWirelessCommunicationEnabled"}, - {18, &IGeneralService::GetInternetConnectionStatus, "GetInternetConnectionStatus"}, - {19, &IGeneralService::SetEthernetCommunicationEnabled, "SetEthernetCommunicationEnabled"}, - {20, &IGeneralService::IsEthernetCommunicationEnabled, "IsEthernetCommunicationEnabled"}, - {21, &IGeneralService::IsAnyInternetRequestAccepted, "IsAnyInternetRequestAccepted"}, - {22, &IGeneralService::IsAnyForegroundRequestAccepted, "IsAnyForegroundRequestAccepted"}, - {23, nullptr, "PutToSleep"}, - {24, nullptr, "WakeUp"}, - {25, &IGeneralService::GetSsidListVersion, "GetSsidListVersion"}, - {26, nullptr, "SetExclusiveClient"}, - {27, nullptr, "GetDefaultIpSetting"}, - {28, nullptr, "SetDefaultIpSetting"}, - {29, nullptr, "SetWirelessCommunicationEnabledForTest"}, - {30, nullptr, "SetEthernetCommunicationEnabledForTest"}, - {31, nullptr, "GetTelemetorySystemEventReadableHandle"}, - {32, nullptr, "GetTelemetryInfo"}, - {33, &IGeneralService::ConfirmSystemAvailability, "ConfirmSystemAvailability"}, // 2.0.0+ - {34, &IGeneralService::SetBackgroundRequestEnabled, "SetBackgroundRequestEnabled"}, // 4.0.0+ - {35, &IGeneralService::GetScanDataV2, "GetScanData"}, - {36, &IGeneralService::GetCurrentAccessPoint, "GetCurrentAccessPoint"}, - {37, nullptr, "Shutdown"}, - {38, nullptr, "GetAllowedChannels"}, - {39, nullptr, "NotifyApplicationSuspended"}, - {40, nullptr, "SetAcceptableNetworkTypeFlag"}, - {41, nullptr, "GetAcceptableNetworkTypeFlag"}, - {42, nullptr, "NotifyConnectionStateChanged"}, - {43, nullptr, "SetWowlDelayedWakeTime"}, - {44, nullptr, "IsWiredConnectionAvailable"}, // 18.0.0+ - {45, nullptr, "IsNetworkEmulationFeatureEnabled"}, // 18.0.0+ - {46, nullptr, "SelectActiveNetworkEmulationProfileIdForDebug"}, // 18.0.0+ - {47, &IGeneralService::GetScanDataV3, "GetScanData"}, // 19.0.0+ - {50, nullptr, "IsRewriteFeatureEnabled"}, // 18.0.0+ - {51, nullptr, "CreateRewriteRule"}, // 18.0.0+ - {52, nullptr, "DestroyRewriteRule"} // 18.0.0+ - }; - // clang-format on - - RegisterHandlers(functions); } IGeneralService::~IGeneralService() = default; class NetworkInterface final : public ServiceFramework { public: - explicit NetworkInterface(const char* name, Core::System& system_) - : ServiceFramework{system_, name} { - static const FunctionInfo functions[] = { - {4, &NetworkInterface::CreateGeneralServiceOld, "CreateGeneralServiceOld"}, - {5, &NetworkInterface::CreateGeneralService, "CreateGeneralService"}, - }; - RegisterHandlers(functions); - } + explicit NetworkInterface(const char* name, Core::System& system_) : ServiceFramework{system_, name} {} private: void CreateGeneralServiceOld(HLERequestContext& ctx) { @@ -1139,6 +1134,14 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{4, &NetworkInterface::CreateGeneralServiceOld, "CreateGeneralServiceOld"}, + FunctionInfo{5, &NetworkInterface::CreateGeneralService, "CreateGeneralService"} + ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/nifm/nifm.h b/src/core/hle/service/nifm/nifm.h index 3b5a438c75..3f3535fa93 100644 --- a/src/core/hle/service/nifm/nifm.h +++ b/src/core/hle/service/nifm/nifm.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator @@ -51,6 +51,7 @@ private: void SetBackgroundRequestEnabled(HLERequestContext& ctx); void GetCurrentAccessPoint(HLERequestContext& ctx); void GetScanDataV3(HLERequestContext& ctx); + std::optional FindRequest(u32 key) override; }; } // namespace Service::NIFM diff --git a/src/core/hle/service/nim/nim.cpp b/src/core/hle/service/nim/nim.cpp index e5f2d85dde..c48bf54646 100644 --- a/src/core/hle/service/nim/nim.cpp +++ b/src/core/hle/service/nim/nim.cpp @@ -24,24 +24,15 @@ namespace Service::NIM { class IShopServiceAsync final : public ServiceFramework { public: explicit IShopServiceAsync(Core::System& system_) - : ServiceFramework{system_, "IShopServiceAsync"}, - service_context{system_, "IShopServiceAsync"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IShopServiceAsync::Cancel>, "Cancel"}, - {1, D<&IShopServiceAsync::GetSize>, "GetSize"}, - {2, D<&IShopServiceAsync::Read>, "Read"}, - {3, D<&IShopServiceAsync::GetErrorCode>, "GetErrorCode"}, - {4, D<&IShopServiceAsync::Request>, "Request"}, - {5, D<&IShopServiceAsync::Prepare>, "Prepare"}, - }; - // clang-format on - - RegisterHandlers(functions); - + : ServiceFramework{system_, "IShopServiceAsync"} + , service_context{system_, "IShopServiceAsync"} { completion_event = service_context.CreateEvent("IShopServiceAsync:Completion"); } + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + ~IShopServiceAsync() override { CancelImpl(); service_context.CloseEvent(completion_event); @@ -52,15 +43,6 @@ public: } private: - KernelHelpers::ServiceContext service_context; - Kernel::KEvent* completion_event; - - std::jthread worker; - std::atomic error_code{0}; - - std::mutex data_mutex; - std::vector download_data; - void CancelImpl() { worker.request_stop(); if (worker.joinable()) { @@ -136,19 +118,30 @@ private: } R_SUCCEED(); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IShopServiceAsync::Cancel>, "Cancel"}, + FunctionInfo{1, D<&IShopServiceAsync::GetSize>, "GetSize"}, + FunctionInfo{2, D<&IShopServiceAsync::Read>, "Read"}, + FunctionInfo{3, D<&IShopServiceAsync::GetErrorCode>, "GetErrorCode"}, + FunctionInfo{4, D<&IShopServiceAsync::Request>, "Request"}, + FunctionInfo{5, D<&IShopServiceAsync::Prepare>, "Prepare"} + ); + KernelHelpers::ServiceContext service_context; + Kernel::KEvent* completion_event; + std::jthread worker; + std::atomic error_code{0}; + std::mutex data_mutex; + std::vector download_data; }; class IShopServiceAccessor final : public ServiceFramework { public: explicit IShopServiceAccessor(Core::System& system_) - : ServiceFramework{system_, "IShopServiceAccessor"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &IShopServiceAccessor::CreateAsyncInterface, "CreateAsyncInterface"}, - }; - // clang-format on + : ServiceFramework{system_, "IShopServiceAccessor"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -160,19 +153,19 @@ private: rb.PushCopyObjects(ctx, async_interface->GetEvent()); rb.PushIpcInterface(ctx, std::move(async_interface)); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &IShopServiceAccessor::CreateAsyncInterface, "CreateAsyncInterface"} + ); }; class IShopServiceAccessServer final : public ServiceFramework { public: explicit IShopServiceAccessServer(Core::System& system_) - : ServiceFramework{system_, "IShopServiceAccessServer"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &IShopServiceAccessServer::CreateAccessorInterface, "CreateAccessorInterface"}, - }; - // clang-format on + : ServiceFramework{system_, "IShopServiceAccessServer"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -182,258 +175,252 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &IShopServiceAccessServer::CreateAccessorInterface, "CreateAccessorInterface"} + ); }; class NIM final : public ServiceFramework { public: - explicit NIM(Core::System& system_) : ServiceFramework{system_, "nim"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "CreateSystemUpdateTask"}, - {1, nullptr, "DestroySystemUpdateTask"}, - {2, nullptr, "ListSystemUpdateTask"}, - {3, nullptr, "RequestSystemUpdateTaskRun"}, - {4, nullptr, "GetSystemUpdateTaskInfo"}, - {5, nullptr, "CommitSystemUpdateTask"}, - {6, nullptr, "CreateNetworkInstallTask"}, - {7, nullptr, "DestroyNetworkInstallTask"}, - {8, nullptr, "ListNetworkInstallTask"}, - {9, nullptr, "RequestNetworkInstallTaskRun"}, - {10, nullptr, "GetNetworkInstallTaskInfo"}, - {11, nullptr, "CommitNetworkInstallTask"}, - {12, nullptr, "RequestLatestSystemUpdateMeta"}, - {14, nullptr, "ListApplicationNetworkInstallTask"}, - {15, nullptr, "ListNetworkInstallTaskContentMeta"}, - {16, nullptr, "RequestLatestVersion"}, - {17, nullptr, "SetNetworkInstallTaskAttribute"}, - {18, nullptr, "AddNetworkInstallTaskContentMeta"}, - {19, nullptr, "GetDownloadedSystemDataPath"}, - {20, nullptr, "CalculateNetworkInstallTaskRequiredSize"}, - {21, nullptr, "IsExFatDriverIncluded"}, - {22, nullptr, "GetBackgroundDownloadStressTaskInfo"}, - {23, nullptr, "RequestDeviceAuthenticationToken"}, - {24, nullptr, "RequestGameCardRegistrationStatus"}, - {25, nullptr, "RequestRegisterGameCard"}, - {26, nullptr, "RequestRegisterNotificationToken"}, - {27, nullptr, "RequestDownloadTaskList"}, - {28, nullptr, "RequestApplicationControl"}, - {29, nullptr, "RequestLatestApplicationControl"}, - {30, nullptr, "RequestVersionList"}, - {31, nullptr, "CreateApplyDeltaTask"}, - {32, nullptr, "DestroyApplyDeltaTask"}, - {33, nullptr, "ListApplicationApplyDeltaTask"}, - {34, nullptr, "RequestApplyDeltaTaskRun"}, - {35, nullptr, "GetApplyDeltaTaskInfo"}, - {36, nullptr, "ListApplyDeltaTask"}, - {37, nullptr, "CommitApplyDeltaTask"}, - {38, nullptr, "CalculateApplyDeltaTaskRequiredSize"}, - {39, nullptr, "PrepareShutdown"}, - {40, nullptr, "ListApplyDeltaTask"}, - {41, nullptr, "ClearNotEnoughSpaceStateOfApplyDeltaTask"}, - {42, nullptr, "CreateApplyDeltaTaskFromDownloadTask"}, - {43, nullptr, "GetBackgroundApplyDeltaStressTaskInfo"}, - {44, nullptr, "GetApplyDeltaTaskRequiredStorage"}, - {45, nullptr, "CalculateNetworkInstallTaskContentsSize"}, - {46, nullptr, "PrepareShutdownForSystemUpdate"}, - {47, nullptr, "FindMaxRequiredApplicationVersionOfTask"}, - {48, nullptr, "CommitNetworkInstallTaskPartially"}, - {49, nullptr, "ListNetworkInstallTaskCommittedContentMeta"}, - {50, nullptr, "ListNetworkInstallTaskNotCommittedContentMeta"}, - {51, nullptr, "FindMaxRequiredSystemVersionOfTask"}, - {52, nullptr, "GetNetworkInstallTaskErrorContext"}, - {53, nullptr, "CreateLocalCommunicationReceiveApplicationTask"}, - {54, nullptr, "DestroyLocalCommunicationReceiveApplicationTask"}, - {55, nullptr, "ListLocalCommunicationReceiveApplicationTask"}, - {56, nullptr, "RequestLocalCommunicationReceiveApplicationTaskRun"}, - {57, nullptr, "GetLocalCommunicationReceiveApplicationTaskInfo"}, - {58, nullptr, "CommitLocalCommunicationReceiveApplicationTask"}, - {59, nullptr, "ListLocalCommunicationReceiveApplicationTaskContentMeta"}, - {60, nullptr, "CreateLocalCommunicationSendApplicationTask"}, - {61, nullptr, "RequestLocalCommunicationSendApplicationTaskRun"}, - {62, nullptr, "GetLocalCommunicationReceiveApplicationTaskErrorContext"}, - {63, nullptr, "GetLocalCommunicationSendApplicationTaskInfo"}, - {64, nullptr, "DestroyLocalCommunicationSendApplicationTask"}, - {65, nullptr, "GetLocalCommunicationSendApplicationTaskErrorContext"}, - {66, nullptr, "CalculateLocalCommunicationReceiveApplicationTaskRequiredSize"}, - {67, nullptr, "ListApplicationLocalCommunicationReceiveApplicationTask"}, - {68, nullptr, "ListApplicationLocalCommunicationSendApplicationTask"}, - {69, nullptr, "CreateLocalCommunicationReceiveSystemUpdateTask"}, - {70, nullptr, "DestroyLocalCommunicationReceiveSystemUpdateTask"}, - {71, nullptr, "ListLocalCommunicationReceiveSystemUpdateTask"}, - {72, nullptr, "RequestLocalCommunicationReceiveSystemUpdateTaskRun"}, - {73, nullptr, "GetLocalCommunicationReceiveSystemUpdateTaskInfo"}, - {74, nullptr, "CommitLocalCommunicationReceiveSystemUpdateTask"}, - {75, nullptr, "GetLocalCommunicationReceiveSystemUpdateTaskErrorContext"}, - {76, nullptr, "CreateLocalCommunicationSendSystemUpdateTask"}, - {77, nullptr, "RequestLocalCommunicationSendSystemUpdateTaskRun"}, - {78, nullptr, "GetLocalCommunicationSendSystemUpdateTaskInfo"}, - {79, nullptr, "DestroyLocalCommunicationSendSystemUpdateTask"}, - {80, nullptr, "GetLocalCommunicationSendSystemUpdateTaskErrorContext"}, - {81, nullptr, "ListLocalCommunicationSendSystemUpdateTask"}, - {82, nullptr, "GetReceivedSystemDataPath"}, - {83, nullptr, "CalculateApplyDeltaTaskOccupiedSize"}, - {84, nullptr, "ReloadErrorSimulation"}, - {85, nullptr, "ListNetworkInstallTaskContentMetaFromInstallMeta"}, - {86, nullptr, "ListNetworkInstallTaskOccupiedSize"}, - {87, nullptr, "RequestQueryAvailableELicenses"}, - {88, nullptr, "RequestAssignELicenses"}, - {89, nullptr, "RequestExtendELicenses"}, - {90, nullptr, "RequestSyncELicenses"}, - {91, nullptr, "Unknown91"}, //6.0.0-14.1.2 - {92, nullptr, "Unknown92"}, //21.0.0+ - {93, nullptr, "RequestReportActiveELicenses"}, - {94, nullptr, "RequestReportActiveELicensesPassively"}, - {95, nullptr, "RequestRegisterDynamicRightsNotificationToken"}, - {96, nullptr, "RequestAssignAllDeviceLinkedELicenses"}, - {97, nullptr, "RequestRevokeAllELicenses"}, - {98, nullptr, "RequestPrefetchForDynamicRights"}, - {99, nullptr, "CreateNetworkInstallTask"}, - {100, nullptr, "ListNetworkInstallTaskRightsIds"}, - {101, nullptr, "RequestDownloadETickets"}, - {102, nullptr, "RequestQueryDownloadableContents"}, - {103, nullptr, "DeleteNetworkInstallTaskContentMeta"}, - {104, nullptr, "RequestIssueEdgeTokenForDebug"}, - {105, nullptr, "RequestQueryAvailableELicenses2"}, - {106, nullptr, "RequestAssignELicenses2"}, - {107, nullptr, "GetNetworkInstallTaskStateCounter"}, - {108, nullptr, "InvalidateDynamicRightsNaIdTokenCacheForDebug"}, - {109, nullptr, "ListNetworkInstallTaskPartialInstallContentMeta"}, - {110, nullptr, "ListNetworkInstallTaskRightsIdsFromIndex"}, - {111, nullptr, "AddNetworkInstallTaskContentMetaForUser"}, - {112, nullptr, "RequestAssignELicensesAndDownloadETickets"}, - {113, nullptr, "RequestQueryAvailableCommonELicenses"}, - {114, nullptr, "SetNetworkInstallTaskExtendedAttribute"}, - {115, nullptr, "GetNetworkInstallTaskExtendedAttribute"}, - {116, nullptr, "GetAllocatorInfo"}, - {117, nullptr, "RequestQueryDownloadableContentsByApplicationId"}, - {118, nullptr, "MarkNoDownloadRightsErrorResolved"}, - {119, nullptr, "GetApplyDeltaTaskAllAppliedContentMeta"}, - {120, nullptr, "PrioritizeNetworkInstallTask"}, - {121, nullptr, "RequestQueryAvailableCommonELicenses2"}, - {122, nullptr, "RequestAssignCommonELicenses"}, - {123, nullptr, "RequestAssignCommonELicenses2"}, - {124, nullptr, "IsNetworkInstallTaskFrontOfQueue"}, - {125, nullptr, "PrioritizeApplyDeltaTask"}, - {126, nullptr, "RerouteDownloadingPatch"}, - {127, nullptr, "UnmarkNoDownloadRightsErrorResolved"}, - {128, nullptr, "RequestContentsSize"}, - {129, nullptr, "RequestContentsAuthorizationToken"}, - {130, nullptr, "RequestCdnVendorDiscovery"}, - {131, nullptr, "RefreshDebugAvailability"}, - {132, nullptr, "ClearResponseSimulationEntry"}, - {133, nullptr, "RegisterResponseSimulationEntry"}, - {134, nullptr, "GetProcessedCdnVendors"}, - {135, nullptr, "RefreshRuntimeBehaviorsForDebug"}, - {136, nullptr, "RequestOnlineSubscriptionFreeTrialAvailability"}, - {137, nullptr, "GetNetworkInstallTaskContentMetaCount"}, - {138, nullptr, "RequestRevokeELicenses"}, - {139, nullptr, "EnableNetworkConnectionToUseApplicationCore"}, - {140, nullptr, "DisableNetworkConnectionToUseApplicationCore"}, - {141, nullptr, "IsNetworkConnectionEnabledToUseApplicationCore"}, - {142, nullptr, "RequestCheckSafeSystemVersion"}, - {143, nullptr, "RequestApplicationIcon"}, - {144, nullptr, "RequestDownloadIdbeIconFile"}, - {147, nullptr, "Unknown147"}, //18.0.0+ - {148, nullptr, "Unknown148"}, //18.0.0+ - {150, nullptr, "Unknown150"}, //19.0.0+ - {151, nullptr, "Unknown151"}, //20.0.0+ - {152, nullptr, "Unknown152"}, //20.0.0+ - {153, nullptr, "Unknown153"}, //20.0.0+ - {154, nullptr, "Unknown154"}, //20.0.0+ - {155, nullptr, "Unknown155"}, //20.0.0+ - {156, nullptr, "Unknown156"}, //20.0.0+ - {157, nullptr, "Unknown157"}, //20.0.0+ - {158, nullptr, "Unknown158"}, //20.0.0+ - {159, nullptr, "Unknown159"}, //20.0.0+ - {160, nullptr, "Unknown160"}, //20.0.0+ - {161, nullptr, "Unknown161"}, //20.0.0+ - {162, nullptr, "Unknown162"}, //20.0.0+ - {163, nullptr, "Unknown163"}, //20.0.0+ - {164, nullptr, "Unknown164"}, //20.0.0+ - {165, nullptr, "Unknown165"}, //20.0.0+ - {166, nullptr, "Unknown166"}, //20.0.0+ - {167, nullptr, "Unknown167"}, //20.0.0+ - {168, nullptr, "Unknown168"}, //20.0.0+ - {169, nullptr, "Unknown169"}, //20.0.0+ - {170, nullptr, "Unknown170"}, //20.0.0+ - {171, nullptr, "Unknown171"}, //20.0.0+ - {172, nullptr, "Unknown172"}, //20.0.0+ - {173, nullptr, "Unknown173"}, //20.0.0+ - {174, nullptr, "Unknown174"}, //20.0.0+ - {175, nullptr, "Unknown175"}, //20.0.0+ - {176, nullptr, "Unknown176"}, //20.0.0+ - {177, nullptr, "Unknown177"}, //20.0.0+ - {2000, nullptr, "Unknown2000"}, //20.0.0+ - {2001, nullptr, "Unknown2001"}, //20.0.0+ - {2002, nullptr, "Unknown2002"}, //20.0.0+ - {2003, nullptr, "Unknown2003"}, //20.0.0+ - {2004, nullptr, "Unknown2004"}, //20.0.0+ - {2007, nullptr, "Unknown2007"}, //20.0.0+ - {2011, nullptr, "Unknown2011"}, //20.0.0+ - {2012, nullptr, "Unknown2012"}, //20.0.0+ - {2013, nullptr, "Unknown2013"}, //20.0.0+ - {2014, nullptr, "Unknown2014"}, //20.0.0+ - {2015, nullptr, "Unknown2015"}, //20.0.0+ - {2016, nullptr, "Unknown2016"}, //20.0.0+ - {2017, nullptr, "Unknown2017"}, //20.0.0+ - {2018, nullptr, "Unknown2018"}, //20.0.0+ - {2019, nullptr, "Unknown2019"}, //20.0.0+ - {2020, nullptr, "Unknown2020"}, //20.0.0+ - {2021, nullptr, "Unknown2021"}, //20.0.0+ - {2022, nullptr, "Unknown2022"}, //20.0.0+ - {2023, nullptr, "Unknown2023"}, //20.0.0+ - {2024, nullptr, "Unknown2024"}, //20.0.0+ - {2025, nullptr, "Unknown2025"}, //20.0.0+ - {2026, nullptr, "Unknown2026"}, //20.0.0+ - {2027, nullptr, "Unknown2027"}, //20.0.0+ - {2028, nullptr, "Unknown2028"}, //20.0.0+ - {2029, nullptr, "Unknown2029"}, //20.0.0+ - {2030, nullptr, "Unknown2030"}, //20.0.0+ - {2031, nullptr, "Unknown2031"}, //20.0.0+ - {2032, nullptr, "Unknown2032"}, //20.0.0+ - {2033, nullptr, "Unknown2033"}, //20.0.0+ - {2034, nullptr, "Unknown2034"}, //20.0.0+ - {2035, nullptr, "Unknown2035"}, //20.0.0+ - {2036, nullptr, "Unknown2036"}, //20.0.0+ - {2037, nullptr, "Unknown2037"}, //20.0.0+ - {2038, nullptr, "Unknown2038"}, //20.0.0+ - {2039, nullptr, "Unknown2039"}, //20.0.0+ - {2040, nullptr, "Unknown2040"}, //20.0.0+ - {2041, nullptr, "Unknown2041"}, //20.0.0+ - {2042, nullptr, "Unknown2042"}, //20.0.0+ - {2043, nullptr, "Unknown2043"}, //20.0.0+ - {2044, nullptr, "Unknown2044"}, //20.0.0+ - {2045, nullptr, "Unknown2045"}, //20.0.0+ - {2046, nullptr, "Unknown2046"}, //20.0.0+ - {2047, nullptr, "Unknown2047"}, //20.0.0+ - {2048, nullptr, "Unknown2048"}, //20.0.0+ - {2049, nullptr, "Unknown2049"}, //20.0.0+ - {2050, nullptr, "Unknown2050"}, //20.0.0+ - {2051, nullptr, "Unknown2051"}, //20.0.0+ - {3000, nullptr, "RequestLatestApplicationIcon"}, //17.0.0+ - {3001, nullptr, "RequestDownloadIdbeLatestIconFile"}, //17.0.0+ - }; - // clang-format on + explicit NIM(Core::System& system_) : ServiceFramework{system_, "nim"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "CreateSystemUpdateTask"}, + FunctionInfo{1, nullptr, "DestroySystemUpdateTask"}, + FunctionInfo{2, nullptr, "ListSystemUpdateTask"}, + FunctionInfo{3, nullptr, "RequestSystemUpdateTaskRun"}, + FunctionInfo{4, nullptr, "GetSystemUpdateTaskInfo"}, + FunctionInfo{5, nullptr, "CommitSystemUpdateTask"}, + FunctionInfo{6, nullptr, "CreateNetworkInstallTask"}, + FunctionInfo{7, nullptr, "DestroyNetworkInstallTask"}, + FunctionInfo{8, nullptr, "ListNetworkInstallTask"}, + FunctionInfo{9, nullptr, "RequestNetworkInstallTaskRun"}, + FunctionInfo{10, nullptr, "GetNetworkInstallTaskInfo"}, + FunctionInfo{11, nullptr, "CommitNetworkInstallTask"}, + FunctionInfo{12, nullptr, "RequestLatestSystemUpdateMeta"}, + FunctionInfo{14, nullptr, "ListApplicationNetworkInstallTask"}, + FunctionInfo{15, nullptr, "ListNetworkInstallTaskContentMeta"}, + FunctionInfo{16, nullptr, "RequestLatestVersion"}, + FunctionInfo{17, nullptr, "SetNetworkInstallTaskAttribute"}, + FunctionInfo{18, nullptr, "AddNetworkInstallTaskContentMeta"}, + FunctionInfo{19, nullptr, "GetDownloadedSystemDataPath"}, + FunctionInfo{20, nullptr, "CalculateNetworkInstallTaskRequiredSize"}, + FunctionInfo{21, nullptr, "IsExFatDriverIncluded"}, + FunctionInfo{22, nullptr, "GetBackgroundDownloadStressTaskInfo"}, + FunctionInfo{23, nullptr, "RequestDeviceAuthenticationToken"}, + FunctionInfo{24, nullptr, "RequestGameCardRegistrationStatus"}, + FunctionInfo{25, nullptr, "RequestRegisterGameCard"}, + FunctionInfo{26, nullptr, "RequestRegisterNotificationToken"}, + FunctionInfo{27, nullptr, "RequestDownloadTaskList"}, + FunctionInfo{28, nullptr, "RequestApplicationControl"}, + FunctionInfo{29, nullptr, "RequestLatestApplicationControl"}, + FunctionInfo{30, nullptr, "RequestVersionList"}, + FunctionInfo{31, nullptr, "CreateApplyDeltaTask"}, + FunctionInfo{32, nullptr, "DestroyApplyDeltaTask"}, + FunctionInfo{33, nullptr, "ListApplicationApplyDeltaTask"}, + FunctionInfo{34, nullptr, "RequestApplyDeltaTaskRun"}, + FunctionInfo{35, nullptr, "GetApplyDeltaTaskInfo"}, + FunctionInfo{36, nullptr, "ListApplyDeltaTask"}, + FunctionInfo{37, nullptr, "CommitApplyDeltaTask"}, + FunctionInfo{38, nullptr, "CalculateApplyDeltaTaskRequiredSize"}, + FunctionInfo{39, nullptr, "PrepareShutdown"}, + FunctionInfo{40, nullptr, "ListApplyDeltaTask"}, + FunctionInfo{41, nullptr, "ClearNotEnoughSpaceStateOfApplyDeltaTask"}, + FunctionInfo{42, nullptr, "CreateApplyDeltaTaskFromDownloadTask"}, + FunctionInfo{43, nullptr, "GetBackgroundApplyDeltaStressTaskInfo"}, + FunctionInfo{44, nullptr, "GetApplyDeltaTaskRequiredStorage"}, + FunctionInfo{45, nullptr, "CalculateNetworkInstallTaskContentsSize"}, + FunctionInfo{46, nullptr, "PrepareShutdownForSystemUpdate"}, + FunctionInfo{47, nullptr, "FindMaxRequiredApplicationVersionOfTask"}, + FunctionInfo{48, nullptr, "CommitNetworkInstallTaskPartially"}, + FunctionInfo{49, nullptr, "ListNetworkInstallTaskCommittedContentMeta"}, + FunctionInfo{50, nullptr, "ListNetworkInstallTaskNotCommittedContentMeta"}, + FunctionInfo{51, nullptr, "FindMaxRequiredSystemVersionOfTask"}, + FunctionInfo{52, nullptr, "GetNetworkInstallTaskErrorContext"}, + FunctionInfo{53, nullptr, "CreateLocalCommunicationReceiveApplicationTask"}, + FunctionInfo{54, nullptr, "DestroyLocalCommunicationReceiveApplicationTask"}, + FunctionInfo{55, nullptr, "ListLocalCommunicationReceiveApplicationTask"}, + FunctionInfo{56, nullptr, "RequestLocalCommunicationReceiveApplicationTaskRun"}, + FunctionInfo{57, nullptr, "GetLocalCommunicationReceiveApplicationTaskInfo"}, + FunctionInfo{58, nullptr, "CommitLocalCommunicationReceiveApplicationTask"}, + FunctionInfo{59, nullptr, "ListLocalCommunicationReceiveApplicationTaskContentMeta"}, + FunctionInfo{60, nullptr, "CreateLocalCommunicationSendApplicationTask"}, + FunctionInfo{61, nullptr, "RequestLocalCommunicationSendApplicationTaskRun"}, + FunctionInfo{62, nullptr, "GetLocalCommunicationReceiveApplicationTaskErrorContext"}, + FunctionInfo{63, nullptr, "GetLocalCommunicationSendApplicationTaskInfo"}, + FunctionInfo{64, nullptr, "DestroyLocalCommunicationSendApplicationTask"}, + FunctionInfo{65, nullptr, "GetLocalCommunicationSendApplicationTaskErrorContext"}, + FunctionInfo{66, nullptr, "CalculateLocalCommunicationReceiveApplicationTaskRequiredSize"}, + FunctionInfo{67, nullptr, "ListApplicationLocalCommunicationReceiveApplicationTask"}, + FunctionInfo{68, nullptr, "ListApplicationLocalCommunicationSendApplicationTask"}, + FunctionInfo{69, nullptr, "CreateLocalCommunicationReceiveSystemUpdateTask"}, + FunctionInfo{70, nullptr, "DestroyLocalCommunicationReceiveSystemUpdateTask"}, + FunctionInfo{71, nullptr, "ListLocalCommunicationReceiveSystemUpdateTask"}, + FunctionInfo{72, nullptr, "RequestLocalCommunicationReceiveSystemUpdateTaskRun"}, + FunctionInfo{73, nullptr, "GetLocalCommunicationReceiveSystemUpdateTaskInfo"}, + FunctionInfo{74, nullptr, "CommitLocalCommunicationReceiveSystemUpdateTask"}, + FunctionInfo{75, nullptr, "GetLocalCommunicationReceiveSystemUpdateTaskErrorContext"}, + FunctionInfo{76, nullptr, "CreateLocalCommunicationSendSystemUpdateTask"}, + FunctionInfo{77, nullptr, "RequestLocalCommunicationSendSystemUpdateTaskRun"}, + FunctionInfo{78, nullptr, "GetLocalCommunicationSendSystemUpdateTaskInfo"}, + FunctionInfo{79, nullptr, "DestroyLocalCommunicationSendSystemUpdateTask"}, + FunctionInfo{80, nullptr, "GetLocalCommunicationSendSystemUpdateTaskErrorContext"}, + FunctionInfo{81, nullptr, "ListLocalCommunicationSendSystemUpdateTask"}, + FunctionInfo{82, nullptr, "GetReceivedSystemDataPath"}, + FunctionInfo{83, nullptr, "CalculateApplyDeltaTaskOccupiedSize"}, + FunctionInfo{84, nullptr, "ReloadErrorSimulation"}, + FunctionInfo{85, nullptr, "ListNetworkInstallTaskContentMetaFromInstallMeta"}, + FunctionInfo{86, nullptr, "ListNetworkInstallTaskOccupiedSize"}, + FunctionInfo{87, nullptr, "RequestQueryAvailableELicenses"}, + FunctionInfo{88, nullptr, "RequestAssignELicenses"}, + FunctionInfo{89, nullptr, "RequestExtendELicenses"}, + FunctionInfo{90, nullptr, "RequestSyncELicenses"}, + FunctionInfo{91, nullptr, "Unknown91", MakeVersionGate({6,0,0}, {14,1,2})}, + FunctionInfo{92, nullptr, "Unknown92", MakeVersionGate({21,0,0})}, + FunctionInfo{93, nullptr, "RequestReportActiveELicenses"}, + FunctionInfo{94, nullptr, "RequestReportActiveELicensesPassively"}, + FunctionInfo{95, nullptr, "RequestRegisterDynamicRightsNotificationToken"}, + FunctionInfo{96, nullptr, "RequestAssignAllDeviceLinkedELicenses"}, + FunctionInfo{97, nullptr, "RequestRevokeAllELicenses"}, + FunctionInfo{98, nullptr, "RequestPrefetchForDynamicRights"}, + FunctionInfo{99, nullptr, "CreateNetworkInstallTask"}, + FunctionInfo{100, nullptr, "ListNetworkInstallTaskRightsIds"}, + FunctionInfo{101, nullptr, "RequestDownloadETickets"}, + FunctionInfo{102, nullptr, "RequestQueryDownloadableContents"}, + FunctionInfo{103, nullptr, "DeleteNetworkInstallTaskContentMeta"}, + FunctionInfo{104, nullptr, "RequestIssueEdgeTokenForDebug"}, + FunctionInfo{105, nullptr, "RequestQueryAvailableELicenses2"}, + FunctionInfo{106, nullptr, "RequestAssignELicenses2"}, + FunctionInfo{107, nullptr, "GetNetworkInstallTaskStateCounter"}, + FunctionInfo{108, nullptr, "InvalidateDynamicRightsNaIdTokenCacheForDebug"}, + FunctionInfo{109, nullptr, "ListNetworkInstallTaskPartialInstallContentMeta"}, + FunctionInfo{110, nullptr, "ListNetworkInstallTaskRightsIdsFromIndex"}, + FunctionInfo{111, nullptr, "AddNetworkInstallTaskContentMetaForUser"}, + FunctionInfo{112, nullptr, "RequestAssignELicensesAndDownloadETickets"}, + FunctionInfo{113, nullptr, "RequestQueryAvailableCommonELicenses"}, + FunctionInfo{114, nullptr, "SetNetworkInstallTaskExtendedAttribute"}, + FunctionInfo{115, nullptr, "GetNetworkInstallTaskExtendedAttribute"}, + FunctionInfo{116, nullptr, "GetAllocatorInfo"}, + FunctionInfo{117, nullptr, "RequestQueryDownloadableContentsByApplicationId"}, + FunctionInfo{118, nullptr, "MarkNoDownloadRightsErrorResolved"}, + FunctionInfo{119, nullptr, "GetApplyDeltaTaskAllAppliedContentMeta"}, + FunctionInfo{120, nullptr, "PrioritizeNetworkInstallTask"}, + FunctionInfo{121, nullptr, "RequestQueryAvailableCommonELicenses2"}, + FunctionInfo{122, nullptr, "RequestAssignCommonELicenses"}, + FunctionInfo{123, nullptr, "RequestAssignCommonELicenses2"}, + FunctionInfo{124, nullptr, "IsNetworkInstallTaskFrontOfQueue"}, + FunctionInfo{125, nullptr, "PrioritizeApplyDeltaTask"}, + FunctionInfo{126, nullptr, "RerouteDownloadingPatch"}, + FunctionInfo{127, nullptr, "UnmarkNoDownloadRightsErrorResolved"}, + FunctionInfo{128, nullptr, "RequestContentsSize"}, + FunctionInfo{129, nullptr, "RequestContentsAuthorizationToken"}, + FunctionInfo{130, nullptr, "RequestCdnVendorDiscovery"}, + FunctionInfo{131, nullptr, "RefreshDebugAvailability"}, + FunctionInfo{132, nullptr, "ClearResponseSimulationEntry"}, + FunctionInfo{133, nullptr, "RegisterResponseSimulationEntry"}, + FunctionInfo{134, nullptr, "GetProcessedCdnVendors"}, + FunctionInfo{135, nullptr, "RefreshRuntimeBehaviorsForDebug"}, + FunctionInfo{136, nullptr, "RequestOnlineSubscriptionFreeTrialAvailability"}, + FunctionInfo{137, nullptr, "GetNetworkInstallTaskContentMetaCount"}, + FunctionInfo{138, nullptr, "RequestRevokeELicenses"}, + FunctionInfo{139, nullptr, "EnableNetworkConnectionToUseApplicationCore"}, + FunctionInfo{140, nullptr, "DisableNetworkConnectionToUseApplicationCore"}, + FunctionInfo{141, nullptr, "IsNetworkConnectionEnabledToUseApplicationCore"}, + FunctionInfo{142, nullptr, "RequestCheckSafeSystemVersion"}, + FunctionInfo{143, nullptr, "RequestApplicationIcon"}, + FunctionInfo{144, nullptr, "RequestDownloadIdbeIconFile"}, + FunctionInfo{147, nullptr, "Unknown147", MakeVersionGate({18,0,0})}, + FunctionInfo{148, nullptr, "Unknown148", MakeVersionGate({18,0,0})}, + FunctionInfo{150, nullptr, "Unknown150", MakeVersionGate({19,0,0})}, + FunctionInfo{151, nullptr, "Unknown151", MakeVersionGate({20,0,0})}, + FunctionInfo{152, nullptr, "Unknown152", MakeVersionGate({20,0,0})}, + FunctionInfo{153, nullptr, "Unknown153", MakeVersionGate({20,0,0})}, + FunctionInfo{154, nullptr, "Unknown154", MakeVersionGate({20,0,0})}, + FunctionInfo{155, nullptr, "Unknown155", MakeVersionGate({20,0,0})}, + FunctionInfo{156, nullptr, "Unknown156", MakeVersionGate({20,0,0})}, + FunctionInfo{157, nullptr, "Unknown157", MakeVersionGate({20,0,0})}, + FunctionInfo{158, nullptr, "Unknown158", MakeVersionGate({20,0,0})}, + FunctionInfo{159, nullptr, "Unknown159", MakeVersionGate({20,0,0})}, + FunctionInfo{160, nullptr, "Unknown160", MakeVersionGate({20,0,0})}, + FunctionInfo{161, nullptr, "Unknown161", MakeVersionGate({20,0,0})}, + FunctionInfo{162, nullptr, "Unknown162", MakeVersionGate({20,0,0})}, + FunctionInfo{163, nullptr, "Unknown163", MakeVersionGate({20,0,0})}, + FunctionInfo{164, nullptr, "Unknown164", MakeVersionGate({20,0,0})}, + FunctionInfo{165, nullptr, "Unknown165", MakeVersionGate({20,0,0})}, + FunctionInfo{166, nullptr, "Unknown166", MakeVersionGate({20,0,0})}, + FunctionInfo{167, nullptr, "Unknown167", MakeVersionGate({20,0,0})}, + FunctionInfo{168, nullptr, "Unknown168", MakeVersionGate({20,0,0})}, + FunctionInfo{169, nullptr, "Unknown169", MakeVersionGate({20,0,0})}, + FunctionInfo{170, nullptr, "Unknown170", MakeVersionGate({20,0,0})}, + FunctionInfo{171, nullptr, "Unknown171", MakeVersionGate({20,0,0})}, + FunctionInfo{172, nullptr, "Unknown172", MakeVersionGate({20,0,0})}, + FunctionInfo{173, nullptr, "Unknown173", MakeVersionGate({20,0,0})}, + FunctionInfo{174, nullptr, "Unknown174", MakeVersionGate({20,0,0})}, + FunctionInfo{175, nullptr, "Unknown175", MakeVersionGate({20,0,0})}, + FunctionInfo{176, nullptr, "Unknown176", MakeVersionGate({20,0,0})}, + FunctionInfo{177, nullptr, "Unknown177", MakeVersionGate({20,0,0})}, + FunctionInfo{2000, nullptr, "Unknown2000", MakeVersionGate({20,0,0})}, + FunctionInfo{2001, nullptr, "Unknown2001", MakeVersionGate({20,0,0})}, + FunctionInfo{2002, nullptr, "Unknown2002", MakeVersionGate({20,0,0})}, + FunctionInfo{2003, nullptr, "Unknown2003", MakeVersionGate({20,0,0})}, + FunctionInfo{2004, nullptr, "Unknown2004", MakeVersionGate({20,0,0})}, + FunctionInfo{2007, nullptr, "Unknown2007", MakeVersionGate({20,0,0})}, + FunctionInfo{2011, nullptr, "Unknown2011", MakeVersionGate({20,0,0})}, + FunctionInfo{2012, nullptr, "Unknown2012", MakeVersionGate({20,0,0})}, + FunctionInfo{2013, nullptr, "Unknown2013", MakeVersionGate({20,0,0})}, + FunctionInfo{2014, nullptr, "Unknown2014", MakeVersionGate({20,0,0})}, + FunctionInfo{2015, nullptr, "Unknown2015", MakeVersionGate({20,0,0})}, + FunctionInfo{2016, nullptr, "Unknown2016", MakeVersionGate({20,0,0})}, + FunctionInfo{2017, nullptr, "Unknown2017", MakeVersionGate({20,0,0})}, + FunctionInfo{2018, nullptr, "Unknown2018", MakeVersionGate({20,0,0})}, + FunctionInfo{2019, nullptr, "Unknown2019", MakeVersionGate({20,0,0})}, + FunctionInfo{2020, nullptr, "Unknown2020", MakeVersionGate({20,0,0})}, + FunctionInfo{2021, nullptr, "Unknown2021", MakeVersionGate({20,0,0})}, + FunctionInfo{2022, nullptr, "Unknown2022", MakeVersionGate({20,0,0})}, + FunctionInfo{2023, nullptr, "Unknown2023", MakeVersionGate({20,0,0})}, + FunctionInfo{2024, nullptr, "Unknown2024", MakeVersionGate({20,0,0})}, + FunctionInfo{2025, nullptr, "Unknown2025", MakeVersionGate({20,0,0})}, + FunctionInfo{2026, nullptr, "Unknown2026", MakeVersionGate({20,0,0})}, + FunctionInfo{2027, nullptr, "Unknown2027", MakeVersionGate({20,0,0})}, + FunctionInfo{2028, nullptr, "Unknown2028", MakeVersionGate({20,0,0})}, + FunctionInfo{2029, nullptr, "Unknown2029", MakeVersionGate({20,0,0})}, + FunctionInfo{2030, nullptr, "Unknown2030", MakeVersionGate({20,0,0})}, + FunctionInfo{2031, nullptr, "Unknown2031", MakeVersionGate({20,0,0})}, + FunctionInfo{2032, nullptr, "Unknown2032", MakeVersionGate({20,0,0})}, + FunctionInfo{2033, nullptr, "Unknown2033", MakeVersionGate({20,0,0})}, + FunctionInfo{2034, nullptr, "Unknown2034", MakeVersionGate({20,0,0})}, + FunctionInfo{2035, nullptr, "Unknown2035", MakeVersionGate({20,0,0})}, + FunctionInfo{2036, nullptr, "Unknown2036", MakeVersionGate({20,0,0})}, + FunctionInfo{2037, nullptr, "Unknown2037", MakeVersionGate({20,0,0})}, + FunctionInfo{2038, nullptr, "Unknown2038", MakeVersionGate({20,0,0})}, + FunctionInfo{2039, nullptr, "Unknown2039", MakeVersionGate({20,0,0})}, + FunctionInfo{2040, nullptr, "Unknown2040", MakeVersionGate({20,0,0})}, + FunctionInfo{2041, nullptr, "Unknown2041", MakeVersionGate({20,0,0})}, + FunctionInfo{2042, nullptr, "Unknown2042", MakeVersionGate({20,0,0})}, + FunctionInfo{2043, nullptr, "Unknown2043", MakeVersionGate({20,0,0})}, + FunctionInfo{2044, nullptr, "Unknown2044", MakeVersionGate({20,0,0})}, + FunctionInfo{2045, nullptr, "Unknown2045", MakeVersionGate({20,0,0})}, + FunctionInfo{2046, nullptr, "Unknown2046", MakeVersionGate({20,0,0})}, + FunctionInfo{2047, nullptr, "Unknown2047", MakeVersionGate({20,0,0})}, + FunctionInfo{2048, nullptr, "Unknown2048", MakeVersionGate({20,0,0})}, + FunctionInfo{2049, nullptr, "Unknown2049", MakeVersionGate({20,0,0})}, + FunctionInfo{2050, nullptr, "Unknown2050", MakeVersionGate({20,0,0})}, + FunctionInfo{2051, nullptr, "Unknown2051", MakeVersionGate({20,0,0})}, + FunctionInfo{3000, nullptr, "RequestLatestApplicationIcon", MakeVersionGate({17,0,0})}, + FunctionInfo{3001, nullptr, "RequestDownloadIdbeLatestIconFile", MakeVersionGate({17,0,0})} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class NIM_ECA final : public ServiceFramework { public: - explicit NIM_ECA(Core::System& system_) : ServiceFramework{system_, "nim:eca"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &NIM_ECA::CreateServerInterface, "CreateServerInterface"}, - {1, nullptr, "RefreshDebugAvailability"}, - {2, nullptr, "ClearDebugResponse"}, - {3, nullptr, "RegisterDebugResponse"}, - {4, &NIM_ECA::IsLargeResourceAvailable, "IsLargeResourceAvailable"}, - {5, &NIM_ECA::CreateServerInterface2, "CreateServerInterface2"} // 17.0.0+ - }; - // clang-format on + explicit NIM_ECA(Core::System& system_) : ServiceFramework{system_, "nim:eca"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -463,45 +450,53 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &NIM_ECA::CreateServerInterface, "CreateServerInterface"}, + FunctionInfo{1, nullptr, "RefreshDebugAvailability"}, + FunctionInfo{2, nullptr, "ClearDebugResponse"}, + FunctionInfo{3, nullptr, "RegisterDebugResponse"}, + FunctionInfo{4, &NIM_ECA::IsLargeResourceAvailable, "IsLargeResourceAvailable"}, + FunctionInfo{5, &NIM_ECA::CreateServerInterface2, "CreateServerInterface2", MakeVersionGate({17,0,0})} + ); }; class NIM_SHP final : public ServiceFramework { public: - explicit NIM_SHP(Core::System& system_) : ServiceFramework{system_, "nim:shp"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "RequestDeviceAuthenticationToken"}, - {1, nullptr, "RequestCachedDeviceAuthenticationToken"}, - {2, nullptr, "RequestEdgeToken"}, - {3, nullptr, "RequestCachedEdgeToken"}, - {100, nullptr, "RequestRegisterDeviceAccount"}, - {101, nullptr, "RequestUnregisterDeviceAccount"}, - {102, nullptr, "RequestDeviceAccountStatus"}, - {103, nullptr, "GetDeviceAccountInfo"}, - {104, nullptr, "RequestDeviceRegistrationInfo"}, - {105, nullptr, "RequestTransferDeviceAccount"}, - {106, nullptr, "RequestSyncRegistration"}, - {107, nullptr, "IsOwnDeviceId"}, - {200, nullptr, "RequestRegisterNotificationToken"}, - {300, nullptr, "RequestUnlinkDevice"}, - {301, nullptr, "RequestUnlinkDeviceIntegrated"}, - {302, nullptr, "RequestLinkDevice"}, - {303, nullptr, "HasDeviceLink"}, - {304, nullptr, "RequestUnlinkDeviceAll"}, - {305, nullptr, "RequestCreateVirtualAccount"}, - {306, nullptr, "RequestDeviceLinkStatus"}, - {400, nullptr, "GetAccountByVirtualAccount"}, - {401, nullptr, "GetVirtualAccount"}, - {500, nullptr, "RequestSyncTicketLegacy"}, - {501, nullptr, "RequestDownloadTicket"}, - {502, nullptr, "RequestDownloadTicketForPrepurchasedContents"}, - {503, nullptr, "RequestSyncTicket"}, - {504, nullptr, "RequestDownloadTicketForPrepurchasedContents2"}, - {505, nullptr, "RequestDownloadTicketForPrepurchasedContentsForAccount"}, - }; - // clang-format on + explicit NIM_SHP(Core::System& system_) : ServiceFramework{system_, "nim:shp"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "RequestDeviceAuthenticationToken"}, + FunctionInfo{1, nullptr, "RequestCachedDeviceAuthenticationToken"}, + FunctionInfo{2, nullptr, "RequestEdgeToken"}, + FunctionInfo{3, nullptr, "RequestCachedEdgeToken"}, + FunctionInfo{100, nullptr, "RequestRegisterDeviceAccount"}, + FunctionInfo{101, nullptr, "RequestUnregisterDeviceAccount"}, + FunctionInfo{102, nullptr, "RequestDeviceAccountStatus"}, + FunctionInfo{103, nullptr, "GetDeviceAccountInfo"}, + FunctionInfo{104, nullptr, "RequestDeviceRegistrationInfo"}, + FunctionInfo{105, nullptr, "RequestTransferDeviceAccount"}, + FunctionInfo{106, nullptr, "RequestSyncRegistration"}, + FunctionInfo{107, nullptr, "IsOwnDeviceId"}, + FunctionInfo{200, nullptr, "RequestRegisterNotificationToken"}, + FunctionInfo{300, nullptr, "RequestUnlinkDevice"}, + FunctionInfo{301, nullptr, "RequestUnlinkDeviceIntegrated"}, + FunctionInfo{302, nullptr, "RequestLinkDevice"}, + FunctionInfo{303, nullptr, "HasDeviceLink"}, + FunctionInfo{304, nullptr, "RequestUnlinkDeviceAll"}, + FunctionInfo{305, nullptr, "RequestCreateVirtualAccount"}, + FunctionInfo{306, nullptr, "RequestDeviceLinkStatus"}, + FunctionInfo{400, nullptr, "GetAccountByVirtualAccount"}, + FunctionInfo{401, nullptr, "GetVirtualAccount"}, + FunctionInfo{500, nullptr, "RequestSyncTicketLegacy"}, + FunctionInfo{501, nullptr, "RequestDownloadTicket"}, + FunctionInfo{502, nullptr, "RequestDownloadTicketForPrepurchasedContents"}, + FunctionInfo{503, nullptr, "RequestSyncTicket"}, + FunctionInfo{504, nullptr, "RequestDownloadTicketForPrepurchasedContents2"}, + FunctionInfo{505, nullptr, "RequestDownloadTicketForPrepurchasedContentsForAccount"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; @@ -511,19 +506,7 @@ public: explicit IEnsureNetworkClockAvailabilityService(Core::System& system_) : ServiceFramework{system_, "IEnsureNetworkClockAvailabilityService"}, service_context{system_, "IEnsureNetworkClockAvailabilityService"} { - static const FunctionInfo functions[] = { - {0, &IEnsureNetworkClockAvailabilityService::StartTask, "StartTask"}, - {1, &IEnsureNetworkClockAvailabilityService::GetFinishNotificationEvent, - "GetFinishNotificationEvent"}, - {2, &IEnsureNetworkClockAvailabilityService::GetResult, "GetResult"}, - {3, &IEnsureNetworkClockAvailabilityService::Cancel, "Cancel"}, - {4, &IEnsureNetworkClockAvailabilityService::IsProcessing, "IsProcessing"}, - {5, &IEnsureNetworkClockAvailabilityService::GetServerTime, "GetServerTime"}, - }; - RegisterHandlers(functions); - - finished_event = - service_context.CreateEvent("IEnsureNetworkClockAvailabilityService:FinishEvent"); + finished_event = service_context.CreateEvent("IEnsureNetworkClockAvailabilityService:FinishEvent"); } ~IEnsureNetworkClockAvailabilityService() override { @@ -580,23 +563,27 @@ private: rb.PushRaw(server_time); } + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &IEnsureNetworkClockAvailabilityService::StartTask, "StartTask"}, + FunctionInfo{1, &IEnsureNetworkClockAvailabilityService::GetFinishNotificationEvent, "GetFinishNotificationEvent"}, + FunctionInfo{2, &IEnsureNetworkClockAvailabilityService::GetResult, "GetResult"}, + FunctionInfo{3, &IEnsureNetworkClockAvailabilityService::Cancel, "Cancel"}, + FunctionInfo{4, &IEnsureNetworkClockAvailabilityService::IsProcessing, "IsProcessing"}, + FunctionInfo{5, &IEnsureNetworkClockAvailabilityService::GetServerTime, "GetServerTime"} + ); KernelHelpers::ServiceContext service_context; - Kernel::KEvent* finished_event; }; class NTC final : public ServiceFramework { public: - explicit NTC(Core::System& system_) : ServiceFramework{system_, "ntc"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &NTC::OpenEnsureNetworkClockAvailabilityService, "OpenEnsureNetworkClockAvailabilityService"}, - {100, &NTC::SuspendAutonomicTimeCorrection, "SuspendAutonomicTimeCorrection"}, - {101, &NTC::ResumeAutonomicTimeCorrection, "ResumeAutonomicTimeCorrection"}, - }; - // clang-format on + explicit NTC(Core::System& system_) : ServiceFramework{system_, "ntc"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -622,18 +609,24 @@ private: IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &NTC::OpenEnsureNetworkClockAvailabilityService, "OpenEnsureNetworkClockAvailabilityService"}, + FunctionInfo{100, &NTC::SuspendAutonomicTimeCorrection, "SuspendAutonomicTimeCorrection"}, + FunctionInfo{101, &NTC::ResumeAutonomicTimeCorrection, "ResumeAutonomicTimeCorrection"} + ); }; class NIM_ECAS final : public ServiceFramework { public: - explicit NIM_ECAS(Core::System& system_) : ServiceFramework{system_, "nim:ecas"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "RegisterSpecialClient"}, - {1, nullptr, "UnregisterSpecialClient"}, - }; - // clang-format on - RegisterHandlers(functions); + explicit NIM_ECAS(Core::System& system_) : ServiceFramework{system_, "nim:ecas"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "RegisterSpecialClient"}, + FunctionInfo{1, nullptr, "UnregisterSpecialClient"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; diff --git a/src/core/hle/service/npns/npns.cpp b/src/core/hle/service/npns/npns.cpp index b0f74bef06..90bf633e8b 100644 --- a/src/core/hle/service/npns/npns.cpp +++ b/src/core/hle/service/npns/npns.cpp @@ -19,79 +19,10 @@ class INpnsSystem final : public ServiceFramework { public: explicit INpnsSystem(Core::System& system_) : ServiceFramework{system_, "npns:s"}, service_context{system, "npns:s"}, - get_receive_event{service_context}, get_request_change_state_cancel_event{service_context} { - // clang-format off - static const FunctionInfo functions[] = { - {1, nullptr, "ListenAll"}, - {2, C<&INpnsSystem::ListenTo>, "ListenTo"}, - {3, nullptr, "Receive"}, - {4, nullptr, "ReceiveRaw"}, - {5, C<&INpnsSystem::GetReceiveEvent>, "GetReceiveEvent"}, - {6, nullptr, "ListenUndelivered"}, - {7, nullptr, "GetStateChangeEvent"}, - {8, C<&INpnsSystem::ListenToByName>, "ListenToByName"}, - {11, nullptr, "SubscribeTopic"}, - {12, nullptr, "UnsubscribeTopic"}, - {13, nullptr, "QueryIsTopicExist"}, - {14, nullptr, "SubscribeTopicByAccount"}, // 18.0.0+ - {15, nullptr, "UnsubscribeTopicByAccount"}, // 18.0.0+ - {16, nullptr, "DownloadSubscriptionList"}, // 18.0.0+ - {21, nullptr, "CreateToken"}, - {22, nullptr, "CreateTokenWithApplicationId"}, - {23, nullptr, "DestroyToken"}, - {24, nullptr, "DestroyTokenWithApplicationId"}, - {25, nullptr, "QueryIsTokenValid"}, - {26, nullptr, "ListenToMyApplicationId"}, - {27, nullptr, "DestroyTokenAll"}, - {28, nullptr, "CreateTokenWithName"}, // 18.0.0+ - {29, nullptr, "DestroyTokenWithName"}, // 18.0.0+ - {31, nullptr, "UploadTokenToBaaS"}, - {32, nullptr, "DestroyTokenForBaaS"}, - {33, nullptr, "CreateTokenForBaaS"}, - {34, nullptr, "SetBaaSDeviceAccountIdList"}, - {35, nullptr, "LinkNsaId"}, // 17.0.0+ - {36, nullptr, "UnlinkNsaId"}, // 17.0.0+ - {37, nullptr, "RelinkNsaId"}, // 18.0.0+ - {40, nullptr, "GetNetworkServiceAccountIdTokenRequestEvent"}, // 17.0.0+ - {41, nullptr, "TryPopNetworkServiceAccountIdTokenRequestUid"}, // 17.0.0+ - {42, nullptr, "SetNetworkServiceAccountIdTokenSuccess"}, // 17.0.0+ - {43, nullptr, "SetNetworkServiceAccountIdTokenFailure"}, // 17.0.0+ - {44, nullptr, "SetUidList"}, // 17.0.0+ - {45, nullptr, "PutDigitalTwinKeyValue"}, // 17.0.0+ - {51, nullptr, "DeleteDigitalTwinKeyValue"}, // 18.0.0+ - {101, nullptr, "Suspend"}, - {102, nullptr, "Resume"}, - {103, C<&INpnsSystem::GetState>, "GetState"}, - {104, nullptr, "GetStatistics"}, - {105, nullptr, "GetPlayReportRequestEvent"}, - {106, C<&INpnsSystem::GetLastNotifiedTime>, "GetLastNotifiedTime"}, // 18.0.0+ - {107, nullptr, "SetLastNotifiedTime"}, // 18.0.0+ - {111, nullptr, "GetJid"}, - {112, nullptr, "CreateJid"}, - {113, nullptr, "DestroyJid"}, - {114, nullptr, "AttachJid"}, - {115, nullptr, "DetachJid"}, - {120, nullptr, "CreateNotificationReceiver"}, - {151, nullptr, "GetStateWithHandover"}, - {152, nullptr, "GetStateChangeEventWithHandover"}, - {153, nullptr, "GetDropEventWithHandover"}, - {154, nullptr, "CreateTokenAsync"}, - {155, nullptr, "CreateTokenAsyncWithApplicationId"}, - {156, nullptr, "CreateTokenWithNameAsync"}, // 18.0.0+ - {161, C<&INpnsSystem::GetRequestChangeStateCancelEvent>, "GetRequestChangeStateCancelEvent"}, // 10.0.0+ - {162, nullptr, "RequestChangeStateForceTimedWithCancelEvent"}, - {201, nullptr, "RequestChangeStateForceTimed"}, - {202, nullptr, "RequestChangeStateForceAsync"}, - {301, nullptr, "GetPassword"}, // 18.0.0+ - {302, nullptr, "GetAllImmigration"}, // 18.0.0+ - {303, nullptr, "GetNotificationHistories"}, // 18.0.0+ - {304, nullptr, "GetPersistentConnectionSummary"}, // 18.0.0+ - {305, nullptr, "GetDigitalTwinSummary"}, // 18.0.0+ - {306, nullptr, "GetDigitalTwinValue"}, // 18.0.0+ - }; - // clang-format on + get_receive_event{service_context}, get_request_change_state_cancel_event{service_context} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } ~INpnsSystem() override = default; @@ -140,6 +71,74 @@ private: R_SUCCEED(); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{1, nullptr, "ListenAll"}, + FunctionInfo{2, C<&INpnsSystem::ListenTo>, "ListenTo"}, + FunctionInfo{3, nullptr, "Receive"}, + FunctionInfo{4, nullptr, "ReceiveRaw"}, + FunctionInfo{5, C<&INpnsSystem::GetReceiveEvent>, "GetReceiveEvent"}, + FunctionInfo{6, nullptr, "ListenUndelivered"}, + FunctionInfo{7, nullptr, "GetStateChangeEvent"}, + FunctionInfo{8, C<&INpnsSystem::ListenToByName>, "ListenToByName"}, + FunctionInfo{11, nullptr, "SubscribeTopic"}, + FunctionInfo{12, nullptr, "UnsubscribeTopic"}, + FunctionInfo{13, nullptr, "QueryIsTopicExist"}, + FunctionInfo{14, nullptr, "SubscribeTopicByAccount", MakeVersionGate({18,0,0})}, + FunctionInfo{15, nullptr, "UnsubscribeTopicByAccount", MakeVersionGate({18,0,0})}, + FunctionInfo{16, nullptr, "DownloadSubscriptionList", MakeVersionGate({18,0,0})}, + FunctionInfo{21, nullptr, "CreateToken"}, + FunctionInfo{22, nullptr, "CreateTokenWithApplicationId"}, + FunctionInfo{23, nullptr, "DestroyToken"}, + FunctionInfo{24, nullptr, "DestroyTokenWithApplicationId"}, + FunctionInfo{25, nullptr, "QueryIsTokenValid"}, + FunctionInfo{26, nullptr, "ListenToMyApplicationId"}, + FunctionInfo{27, nullptr, "DestroyTokenAll"}, + FunctionInfo{28, nullptr, "CreateTokenWithName", MakeVersionGate({18,0,0})}, + FunctionInfo{29, nullptr, "DestroyTokenWithName", MakeVersionGate({18,0,0})}, + FunctionInfo{31, nullptr, "UploadTokenToBaaS"}, + FunctionInfo{32, nullptr, "DestroyTokenForBaaS"}, + FunctionInfo{33, nullptr, "CreateTokenForBaaS"}, + FunctionInfo{34, nullptr, "SetBaaSDeviceAccountIdList"}, + FunctionInfo{35, nullptr, "LinkNsaId", MakeVersionGate({17,0,0})}, + FunctionInfo{36, nullptr, "UnlinkNsaId", MakeVersionGate({17,0,0})}, + FunctionInfo{37, nullptr, "RelinkNsaId", MakeVersionGate({18,0,0})}, + FunctionInfo{40, nullptr, "GetNetworkServiceAccountIdTokenRequestEvent", MakeVersionGate({17,0,0})}, + FunctionInfo{41, nullptr, "TryPopNetworkServiceAccountIdTokenRequestUid", MakeVersionGate({17,0,0})}, + FunctionInfo{42, nullptr, "SetNetworkServiceAccountIdTokenSuccess", MakeVersionGate({17,0,0})}, + FunctionInfo{43, nullptr, "SetNetworkServiceAccountIdTokenFailure", MakeVersionGate({17,0,0})}, + FunctionInfo{44, nullptr, "SetUidList", MakeVersionGate({17,0,0})}, + FunctionInfo{45, nullptr, "PutDigitalTwinKeyValue", MakeVersionGate({17,0,0})}, + FunctionInfo{51, nullptr, "DeleteDigitalTwinKeyValue", MakeVersionGate({18,0,0})}, + FunctionInfo{101, nullptr, "Suspend"}, + FunctionInfo{102, nullptr, "Resume"}, + FunctionInfo{103, C<&INpnsSystem::GetState>, "GetState"}, + FunctionInfo{104, nullptr, "GetStatistics"}, + FunctionInfo{105, nullptr, "GetPlayReportRequestEvent"}, + FunctionInfo{106, C<&INpnsSystem::GetLastNotifiedTime>, "GetLastNotifiedTime", MakeVersionGate({18,0,0})}, + FunctionInfo{107, nullptr, "SetLastNotifiedTime", MakeVersionGate({18,0,0})}, + FunctionInfo{111, nullptr, "GetJid"}, + FunctionInfo{112, nullptr, "CreateJid"}, + FunctionInfo{113, nullptr, "DestroyJid"}, + FunctionInfo{114, nullptr, "AttachJid"}, + FunctionInfo{115, nullptr, "DetachJid"}, + FunctionInfo{120, nullptr, "CreateNotificationReceiver"}, + FunctionInfo{151, nullptr, "GetStateWithHandover"}, + FunctionInfo{152, nullptr, "GetStateChangeEventWithHandover"}, + FunctionInfo{153, nullptr, "GetDropEventWithHandover"}, + FunctionInfo{154, nullptr, "CreateTokenAsync"}, + FunctionInfo{155, nullptr, "CreateTokenAsyncWithApplicationId"}, + FunctionInfo{156, nullptr, "CreateTokenWithNameAsync", MakeVersionGate({18,0,0})}, + FunctionInfo{161, C<&INpnsSystem::GetRequestChangeStateCancelEvent>, "GetRequestChangeStateCancelEvent", MakeVersionGate({10,0,0})}, + FunctionInfo{162, nullptr, "RequestChangeStateForceTimedWithCancelEvent"}, + FunctionInfo{201, nullptr, "RequestChangeStateForceTimed"}, + FunctionInfo{202, nullptr, "RequestChangeStateForceAsync"}, + FunctionInfo{301, nullptr, "GetPassword", MakeVersionGate({18,0,0})}, + FunctionInfo{302, nullptr, "GetAllImmigration", MakeVersionGate({18,0,0})}, + FunctionInfo{303, nullptr, "GetNotificationHistories", MakeVersionGate({18,0,0})}, + FunctionInfo{304, nullptr, "GetPersistentConnectionSummary", MakeVersionGate({18,0,0})}, + FunctionInfo{305, nullptr, "GetDigitalTwinSummary", MakeVersionGate({18,0,0})}, + FunctionInfo{306, nullptr, "GetDigitalTwinValue", MakeVersionGate({18,0,0})} + ); KernelHelpers::ServiceContext service_context; Event get_receive_event; Event get_request_change_state_cancel_event; @@ -148,34 +147,10 @@ private: class INpnsUser final : public ServiceFramework { public: explicit INpnsUser(Core::System& system_) - : ServiceFramework{system_, "npns:u"}, service_context{system, "npns:u"}, get_receive_event{service_context} { - // clang-format off - static const FunctionInfo functions[] = { - {1, nullptr, "ListenAll"}, - {2, nullptr, "ListenTo"}, - {3, nullptr, "Receive"}, - {4, nullptr, "ReceiveRaw"}, - {5, C<&INpnsUser::GetReceiveEvent>, "GetReceiveEvent"}, - {7, nullptr, "GetStateChangeEvent"}, - {8, C<&INpnsUser::ListenToByName>, "ListenToByName"}, // 18.0.0+ - {21, nullptr, "CreateToken"}, - {23, nullptr, "DestroyToken"}, - {25, nullptr, "QueryIsTokenValid"}, - {26, nullptr, "ListenToMyApplicationId"}, - {101, nullptr, "Suspend"}, - {102, nullptr, "Resume"}, - {103, nullptr, "GetState"}, - {104, nullptr, "GetStatistics"}, - {111, nullptr, "GetJid"}, - {120, nullptr, "CreateNotificationReceiver"}, - {151, nullptr, "GetStateWithHandover"}, - {152, nullptr, "GetStateChangeEventWithHandover"}, - {153, nullptr, "GetDropEventWithHandover"}, - {154, nullptr, "CreateTokenAsync"}, - }; - // clang-format on + : ServiceFramework{system_, "npns:u"}, service_context{system, "npns:u"}, get_receive_event{service_context} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -195,6 +170,29 @@ private: R_SUCCEED(); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{1, nullptr, "ListenAll"}, + FunctionInfo{2, nullptr, "ListenTo"}, + FunctionInfo{3, nullptr, "Receive"}, + FunctionInfo{4, nullptr, "ReceiveRaw"}, + FunctionInfo{5, C<&INpnsUser::GetReceiveEvent>, "GetReceiveEvent"}, + FunctionInfo{7, nullptr, "GetStateChangeEvent"}, + FunctionInfo{8, C<&INpnsUser::ListenToByName>, "ListenToByName", MakeVersionGate({18,0,0})}, + FunctionInfo{21, nullptr, "CreateToken"}, + FunctionInfo{23, nullptr, "DestroyToken"}, + FunctionInfo{25, nullptr, "QueryIsTokenValid"}, + FunctionInfo{26, nullptr, "ListenToMyApplicationId"}, + FunctionInfo{101, nullptr, "Suspend"}, + FunctionInfo{102, nullptr, "Resume"}, + FunctionInfo{103, nullptr, "GetState"}, + FunctionInfo{104, nullptr, "GetStatistics"}, + FunctionInfo{111, nullptr, "GetJid"}, + FunctionInfo{120, nullptr, "CreateNotificationReceiver"}, + FunctionInfo{151, nullptr, "GetStateWithHandover"}, + FunctionInfo{152, nullptr, "GetStateChangeEventWithHandover"}, + FunctionInfo{153, nullptr, "GetDropEventWithHandover"}, + FunctionInfo{154, nullptr, "CreateTokenAsync"} + ); KernelHelpers::ServiceContext service_context; Event get_receive_event; }; diff --git a/src/core/hle/service/ns/account_proxy_interface.cpp b/src/core/hle/service/ns/account_proxy_interface.cpp index e5041af66b..0107e16b72 100644 --- a/src/core/hle/service/ns/account_proxy_interface.cpp +++ b/src/core/hle/service/ns/account_proxy_interface.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -7,13 +10,6 @@ namespace Service::NS { IAccountProxyInterface::IAccountProxyInterface(Core::System& system_) : ServiceFramework{system_, "IAccountProxyInterface"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "CreateUserAccount"}, - }; - // clang-format on - - RegisterHandlers(functions); } IAccountProxyInterface::~IAccountProxyInterface() = default; diff --git a/src/core/hle/service/ns/account_proxy_interface.h b/src/core/hle/service/ns/account_proxy_interface.h index e944d2a75f..37248726a9 100644 --- a/src/core/hle/service/ns/account_proxy_interface.h +++ b/src/core/hle/service/ns/account_proxy_interface.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -11,6 +14,13 @@ class IAccountProxyInterface final : public ServiceFramework FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "CreateUserAccount"} + ); }; } // namespace Service::NS diff --git a/src/core/hle/service/ns/application_manager_interface.cpp b/src/core/hle/service/ns/application_manager_interface.cpp index 348649917e..7220c52dcb 100644 --- a/src/core/hle/service/ns/application_manager_interface.cpp +++ b/src/core/hle/service/ns/application_manager_interface.cpp @@ -25,6 +25,458 @@ namespace Service::NS { +std::optional IApplicationManagerInterface::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IApplicationManagerInterface::ListApplicationRecord>, "ListApplicationRecord"}, + FunctionInfo{1, nullptr, "GenerateApplicationRecordCount"}, + FunctionInfo{2, D<&IApplicationManagerInterface::GetApplicationRecordUpdateSystemEvent>, "GetApplicationRecordUpdateSystemEvent"}, + FunctionInfo{3, nullptr, "GetApplicationViewDeprecated"}, + FunctionInfo{4, D<&IApplicationManagerInterface::DeleteApplicationEntity>, "DeleteApplicationEntity"}, + FunctionInfo{5, D<&IApplicationManagerInterface::DeleteApplicationCompletely>, "DeleteApplicationCompletely"}, + FunctionInfo{6, nullptr, "IsAnyApplicationEntityRedundant"}, + FunctionInfo{7, nullptr, "DeleteRedundantApplicationEntity"}, + FunctionInfo{8, nullptr, "IsApplicationEntityMovable"}, + FunctionInfo{9, nullptr, "MoveApplicationEntity"}, + FunctionInfo{11, nullptr, "CalculateApplicationOccupiedSize"}, + FunctionInfo{16, &IApplicationManagerInterface::PushApplicationRecord, "PushApplicationRecord"}, + FunctionInfo{17, nullptr, "ListApplicationRecordContentMeta"}, + FunctionInfo{19, nullptr, "LaunchApplicationOld"}, + FunctionInfo{21, nullptr, "GetApplicationContentPath"}, + FunctionInfo{22, nullptr, "TerminateApplication"}, + FunctionInfo{23, nullptr, "ResolveApplicationContentPath"}, + FunctionInfo{26, nullptr, "BeginInstallApplication"}, + FunctionInfo{27, nullptr, "DeleteApplicationRecord"}, + FunctionInfo{30, nullptr, "RequestApplicationUpdateInfo"}, + FunctionInfo{31, nullptr, "RequestUpdateApplication"}, + FunctionInfo{32, nullptr, "CancelApplicationDownload"}, + FunctionInfo{33, nullptr, "ResumeApplicationDownload"}, + FunctionInfo{35, nullptr, "UpdateVersionList"}, + FunctionInfo{36, nullptr, "PushLaunchVersion"}, + FunctionInfo{37, nullptr, "ListRequiredVersion"}, + FunctionInfo{38, D<&IApplicationManagerInterface::CheckApplicationLaunchVersion>, "CheckApplicationLaunchVersion"}, + FunctionInfo{39, nullptr, "CheckApplicationLaunchRights"}, + FunctionInfo{40, D<&IApplicationManagerInterface::GetApplicationLogoData>, "GetApplicationLogoData"}, + FunctionInfo{41, nullptr, "CalculateApplicationDownloadRequiredSize"}, + FunctionInfo{42, nullptr, "CleanupSdCard"}, + FunctionInfo{43, D<&IApplicationManagerInterface::CheckSdCardMountStatus>, "CheckSdCardMountStatus"}, + FunctionInfo{44, D<&IApplicationManagerInterface::GetSdCardMountStatusChangedEvent>, "GetSdCardMountStatusChangedEvent"}, + FunctionInfo{45, nullptr, "GetGameCardAttachmentEvent"}, + FunctionInfo{46, nullptr, "GetGameCardAttachmentInfo"}, + FunctionInfo{47, D<&IApplicationManagerInterface::GetTotalSpaceSize>, "GetTotalSpaceSize"}, + FunctionInfo{48, D<&IApplicationManagerInterface::GetFreeSpaceSize>, "GetFreeSpaceSize"}, + FunctionInfo{49, nullptr, "GetSdCardRemovedEvent"}, + FunctionInfo{52, D<&IApplicationManagerInterface::GetGameCardUpdateDetectionEvent>, "GetGameCardUpdateDetectionEvent"}, + FunctionInfo{53, nullptr, "DisableApplicationAutoDelete"}, + FunctionInfo{54, nullptr, "EnableApplicationAutoDelete"}, + FunctionInfo{55, D<&IApplicationManagerInterface::GetApplicationDesiredLanguage>, "GetApplicationDesiredLanguage"}, + FunctionInfo{56, nullptr, "SetApplicationTerminateResult"}, + FunctionInfo{57, nullptr, "ClearApplicationTerminateResult"}, + FunctionInfo{58, nullptr, "GetLastSdCardMountUnexpectedResult"}, + FunctionInfo{59, D<&IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode>, "ConvertApplicationLanguageToLanguageCode"}, + FunctionInfo{60, nullptr, "ConvertLanguageCodeToApplicationLanguage"}, + FunctionInfo{61, nullptr, "GetBackgroundDownloadStressTaskInfo"}, + FunctionInfo{62, nullptr, "GetGameCardStopper"}, + FunctionInfo{63, nullptr, "IsSystemProgramInstalled"}, + FunctionInfo{64, nullptr, "StartApplyDeltaTask"}, + FunctionInfo{65, nullptr, "GetRequestServerStopper"}, + FunctionInfo{66, nullptr, "GetBackgroundApplyDeltaStressTaskInfo"}, + FunctionInfo{67, nullptr, "CancelApplicationApplyDelta"}, + FunctionInfo{68, nullptr, "ResumeApplicationApplyDelta"}, + FunctionInfo{69, nullptr, "CalculateApplicationApplyDeltaRequiredSize"}, + FunctionInfo{70, D<&IApplicationManagerInterface::ResumeAll>, "ResumeAll"}, + FunctionInfo{71, D<&IApplicationManagerInterface::GetStorageSize>, "GetStorageSize"}, + FunctionInfo{80, nullptr, "RequestDownloadApplication"}, + FunctionInfo{81, nullptr, "RequestDownloadAddOnContent"}, + FunctionInfo{82, nullptr, "DownloadApplication"}, + FunctionInfo{83, nullptr, "CheckApplicationResumeRights"}, + FunctionInfo{84, nullptr, "GetDynamicCommitEvent"}, + FunctionInfo{85, nullptr, "RequestUpdateApplication2"}, + FunctionInfo{86, nullptr, "EnableApplicationCrashReport"}, + FunctionInfo{87, nullptr, "IsApplicationCrashReportEnabled"}, + FunctionInfo{90, nullptr, "BoostSystemMemoryResourceLimit"}, + FunctionInfo{91, nullptr, "DeprecatedLaunchApplication"}, + FunctionInfo{92, nullptr, "GetRunningApplicationProgramId"}, + FunctionInfo{93, nullptr, "GetMainApplicationProgramIndex"}, + FunctionInfo{94, nullptr, "LaunchApplication"}, + FunctionInfo{95, nullptr, "GetApplicationLaunchInfo"}, + FunctionInfo{96, nullptr, "AcquireApplicationLaunchInfo"}, + FunctionInfo{97, nullptr, "GetMainApplicationProgramIndexByApplicationLaunchInfo"}, + FunctionInfo{98, nullptr, "EnableApplicationAllThreadDumpOnCrash"}, + FunctionInfo{99, nullptr, "LaunchDevMenu"}, + FunctionInfo{100, nullptr, "ResetToFactorySettings"}, + FunctionInfo{101, nullptr, "ResetToFactorySettingsWithoutUserSaveData"}, + FunctionInfo{102, nullptr, "ResetToFactorySettingsForRefurbishment"}, + FunctionInfo{103, nullptr, "ResetToFactorySettingsWithPlatformRegion"}, + FunctionInfo{104, nullptr, "ResetToFactorySettingsWithPlatformRegionAuthentication"}, + FunctionInfo{105, nullptr, "RequestResetToFactorySettingsSecurely"}, + FunctionInfo{106, nullptr, "RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely"}, + FunctionInfo{200, nullptr, "CalculateUserSaveDataStatistics"}, + FunctionInfo{201, nullptr, "DeleteUserSaveDataAll"}, + FunctionInfo{210, nullptr, "DeleteUserSystemSaveData"}, + FunctionInfo{211, nullptr, "DeleteSaveData"}, + FunctionInfo{220, nullptr, "UnregisterNetworkServiceAccount"}, + FunctionInfo{221, D<&IApplicationManagerInterface::UnregisterNetworkServiceAccountWithUserSaveDataDeletion>, "UnregisterNetworkServiceAccountWithUserSaveDataDeletion"}, + FunctionInfo{300, nullptr, "GetApplicationShellEvent"}, + FunctionInfo{301, nullptr, "PopApplicationShellEventInfo"}, + FunctionInfo{302, nullptr, "LaunchLibraryApplet"}, + FunctionInfo{303, nullptr, "TerminateLibraryApplet"}, + FunctionInfo{304, nullptr, "LaunchSystemApplet"}, + FunctionInfo{305, nullptr, "TerminateSystemApplet"}, + FunctionInfo{306, nullptr, "LaunchOverlayApplet"}, + FunctionInfo{307, nullptr, "TerminateOverlayApplet"}, + FunctionInfo{400, D<&IApplicationManagerInterface::GetApplicationControlData>, "GetApplicationControlData"}, + FunctionInfo{401, nullptr, "InvalidateAllApplicationControlCache"}, + FunctionInfo{402, nullptr, "RequestDownloadApplicationControlData"}, + FunctionInfo{403, nullptr, "GetMaxApplicationControlCacheCount"}, + FunctionInfo{404, nullptr, "InvalidateApplicationControlCache"}, + FunctionInfo{405, nullptr, "ListApplicationControlCacheEntryInfo"}, + FunctionInfo{406, nullptr, "GetApplicationControlProperty"}, + FunctionInfo{407, &IApplicationManagerInterface::ListApplicationTitle, "ListApplicationTitle"}, + FunctionInfo{408, &IApplicationManagerInterface::ListApplicationIcon, "ListApplicationIcon"}, + FunctionInfo{411, nullptr, "Unknown411", MakeVersionGate({19,0,0})}, + FunctionInfo{412, nullptr, "Unknown412", MakeVersionGate({19,0,0})}, + FunctionInfo{413, nullptr, "Unknown413", MakeVersionGate({19,0,0})}, + FunctionInfo{414, nullptr, "Unknown414", MakeVersionGate({19,0,0})}, + FunctionInfo{415, nullptr, "Unknown415", MakeVersionGate({19,0,0})}, + FunctionInfo{416, nullptr, "Unknown416", MakeVersionGate({19,0,0})}, + FunctionInfo{417, nullptr, "InvalidateAllApplicationControlCacheOfTheStage", MakeVersionGate({19,0,0})}, + FunctionInfo{418, nullptr, "InvalidateApplicationControlCacheOfTheStage", MakeVersionGate({19,0,0})}, + FunctionInfo{419, D<&IApplicationManagerInterface::RequestDownloadApplicationControlDataInBackground>, "RequestDownloadApplicationControlDataInBackground"}, + FunctionInfo{420, nullptr, "CloneApplicationControlDataCacheForDebug"}, + FunctionInfo{421, nullptr, "Unknown421", MakeVersionGate({20,0,0})}, + FunctionInfo{422, nullptr, "Unknown422", MakeVersionGate({20,0,0})}, + FunctionInfo{423, nullptr, "Unknown423", MakeVersionGate({20,0,0})}, + FunctionInfo{424, nullptr, "Unknown424", MakeVersionGate({20,0,0})}, + FunctionInfo{425, nullptr, "Unknown425", MakeVersionGate({20,0,0})}, + FunctionInfo{426, nullptr, "Unknown426", MakeVersionGate({20,0,0})}, + FunctionInfo{427, nullptr, "Unknown427", MakeVersionGate({20,0,0})}, + FunctionInfo{428, nullptr, "Unknown428", MakeVersionGate({21,0,0})}, + FunctionInfo{429, nullptr, "Unknown429", MakeVersionGate({21,0,0})}, + FunctionInfo{430, nullptr, "Unknown430", MakeVersionGate({21,0,0})}, + FunctionInfo{502, nullptr, "RequestCheckGameCardRegistration"}, + FunctionInfo{503, nullptr, "RequestGameCardRegistrationGoldPoint"}, + FunctionInfo{504, nullptr, "RequestRegisterGameCard"}, + FunctionInfo{505, D<&IApplicationManagerInterface::GetGameCardMountFailureEvent>, "GetGameCardMountFailureEvent"}, + FunctionInfo{506, nullptr, "IsGameCardInserted"}, + FunctionInfo{507, nullptr, "EnsureGameCardAccess"}, + FunctionInfo{508, nullptr, "GetLastGameCardMountFailureResult"}, + FunctionInfo{509, nullptr, "ListApplicationIdOnGameCard"}, + FunctionInfo{510, nullptr, "GetGameCardPlatformRegion"}, + FunctionInfo{511, D<&IApplicationManagerInterface::GetGameCardWakenReadyEvent>, "GetGameCardWakenReadyEvent"}, + FunctionInfo{512, D<&IApplicationManagerInterface::IsGameCardApplicationRunning>, "IsGameCardApplicationRunning"}, + FunctionInfo{513, nullptr, "Unknown513", MakeVersionGate({20,0,0})}, + FunctionInfo{514, nullptr, "Unknown514", MakeVersionGate({20,0,0})}, + FunctionInfo{515, nullptr, "Unknown515", MakeVersionGate({20,0,0})}, + FunctionInfo{516, nullptr, "Unknown516", MakeVersionGate({21,0,0})}, + FunctionInfo{517, nullptr, "Unknown517", MakeVersionGate({21,0,0})}, + FunctionInfo{518, nullptr, "Unknown518", MakeVersionGate({21,0,0})}, + FunctionInfo{519, nullptr, "Unknown519", MakeVersionGate({21,0,0})}, + FunctionInfo{600, nullptr, "CountApplicationContentMeta"}, + FunctionInfo{601, nullptr, "ListApplicationContentMetaStatus"}, + FunctionInfo{602, nullptr, "ListAvailableAddOnContent"}, + FunctionInfo{603, nullptr, "GetOwnedApplicationContentMetaStatus"}, + FunctionInfo{604, nullptr, "RegisterContentsExternalKey"}, + FunctionInfo{605, nullptr, "ListApplicationContentMetaStatusWithRightsCheck"}, + FunctionInfo{606, nullptr, "GetContentMetaStorage"}, + FunctionInfo{607, nullptr, "ListAvailableAddOnContent"}, + FunctionInfo{609, nullptr, "ListAvailabilityAssuredAddOnContent"}, + FunctionInfo{610, nullptr, "GetInstalledContentMetaStorage"}, + FunctionInfo{611, nullptr, "PrepareAddOnContent"}, + FunctionInfo{700, nullptr, "PushDownloadTaskList"}, + FunctionInfo{701, nullptr, "ClearTaskStatusList"}, + FunctionInfo{702, nullptr, "RequestDownloadTaskList"}, + FunctionInfo{703, nullptr, "RequestEnsureDownloadTask"}, + FunctionInfo{704, nullptr, "ListDownloadTaskStatus"}, + FunctionInfo{705, nullptr, "RequestDownloadTaskListData"}, + FunctionInfo{800, nullptr, "RequestVersionList"}, + FunctionInfo{801, nullptr, "ListVersionList"}, + FunctionInfo{802, nullptr, "RequestVersionListData"}, + FunctionInfo{900, nullptr, "GetApplicationRecord"}, + FunctionInfo{901, nullptr, "GetApplicationRecordProperty"}, + FunctionInfo{902, nullptr, "EnableApplicationAutoUpdate"}, + FunctionInfo{903, nullptr, "DisableApplicationAutoUpdate"}, + FunctionInfo{904, D<&IApplicationManagerInterface::TouchApplication>, "TouchApplication"}, + FunctionInfo{905, nullptr, "RequestApplicationUpdate"}, + FunctionInfo{906, D<&IApplicationManagerInterface::IsApplicationUpdateRequested>, "IsApplicationUpdateRequested"}, + FunctionInfo{907, nullptr, "WithdrawApplicationUpdateRequest"}, + FunctionInfo{908, nullptr, "ListApplicationRecordInstalledContentMeta"}, + FunctionInfo{909, nullptr, "WithdrawCleanupAddOnContentsWithNoRightsRecommendation"}, + FunctionInfo{910, nullptr, "HasApplicationRecord"}, + FunctionInfo{911, nullptr, "SetPreInstalledApplication"}, + FunctionInfo{912, nullptr, "ClearPreInstalledApplicationFlag"}, + FunctionInfo{913, nullptr, "ListAllApplicationRecord"}, + FunctionInfo{914, nullptr, "HideApplicationRecord"}, + FunctionInfo{915, nullptr, "ShowApplicationRecord"}, + FunctionInfo{916, nullptr, "IsApplicationAutoDeleteDisabled"}, + FunctionInfo{916, nullptr, "Unknown916", MakeVersionGate({20,0,0})}, + FunctionInfo{917, nullptr, "Unknown917", MakeVersionGate({20,0,0})}, + FunctionInfo{918, nullptr, "Unknown918", MakeVersionGate({20,0,0})}, + FunctionInfo{919, nullptr, "Unknown919", MakeVersionGate({20,0,0})}, + FunctionInfo{920, nullptr, "Unknown920", MakeVersionGate({20,0,0})}, + FunctionInfo{921, nullptr, "Unknown921", MakeVersionGate({20,0,0})}, + FunctionInfo{922, nullptr, "Unknown922", MakeVersionGate({20,0,0})}, + FunctionInfo{923, nullptr, "Unknown923", MakeVersionGate({20,0,0})}, + FunctionInfo{928, nullptr, "Unknown928", MakeVersionGate({20,0,0})}, + FunctionInfo{929, nullptr, "Unknown929", MakeVersionGate({20,0,0})}, + FunctionInfo{930, nullptr, "Unknown930", MakeVersionGate({20,0,0})}, + FunctionInfo{931, nullptr, "Unknown931", MakeVersionGate({20,0,0})}, + FunctionInfo{933, nullptr, "Unknown933", MakeVersionGate({20,0,0})}, + FunctionInfo{934, nullptr, "Unknown934", MakeVersionGate({21,0,0})}, + FunctionInfo{935, nullptr, "Unknown935", MakeVersionGate({21,0,0})}, + FunctionInfo{936, D<&IApplicationManagerInterface::Unknown936>, "Unknown936", MakeVersionGate({21,0,0})}, + FunctionInfo{1000, nullptr, "RequestVerifyApplicationDeprecated"}, + FunctionInfo{1001, nullptr, "CorruptApplicationForDebug"}, + FunctionInfo{1002, nullptr, "RequestVerifyAddOnContentsRights"}, + FunctionInfo{1003, nullptr, "RequestVerifyApplication"}, + FunctionInfo{1004, nullptr, "CorruptContentForDebug"}, + FunctionInfo{1200, nullptr, "NeedsUpdateVulnerability"}, + FunctionInfo{1300, D<&IApplicationManagerInterface::IsAnyApplicationEntityInstalled>, "IsAnyApplicationEntityInstalled"}, + FunctionInfo{1301, nullptr, "DeleteApplicationContentEntities"}, + FunctionInfo{1302, nullptr, "CleanupUnrecordedApplicationEntity"}, + FunctionInfo{1303, nullptr, "CleanupAddOnContentsWithNoRights"}, + FunctionInfo{1304, nullptr, "DeleteApplicationContentEntity"}, + FunctionInfo{1305, nullptr, "TryDeleteRunningApplicationEntity"}, + FunctionInfo{1306, nullptr, "TryDeleteRunningApplicationCompletely"}, + FunctionInfo{1307, nullptr, "TryDeleteRunningApplicationContentEntities"}, + FunctionInfo{1308, nullptr, "DeleteApplicationCompletelyForDebug"}, + FunctionInfo{1309, nullptr, "CleanupUnavailableAddOnContents"}, + FunctionInfo{1310, nullptr, "RequestMoveApplicationEntity"}, + FunctionInfo{1311, nullptr, "EstimateSizeToMove"}, + FunctionInfo{1312, nullptr, "HasMovableEntity"}, + FunctionInfo{1313, nullptr, "CleanupOrphanContents"}, + FunctionInfo{1314, nullptr, "CheckPreconditionSatisfiedToMove"}, + FunctionInfo{1400, nullptr, "PrepareShutdown"}, + FunctionInfo{1500, nullptr, "FormatSdCard"}, + FunctionInfo{1501, nullptr, "NeedsSystemUpdateToFormatSdCard"}, + FunctionInfo{1502, nullptr, "GetLastSdCardFormatUnexpectedResult"}, + FunctionInfo{1504, nullptr, "InsertSdCard"}, + FunctionInfo{1505, nullptr, "RemoveSdCard"}, + FunctionInfo{1506, nullptr, "GetSdCardStartupStatus"}, + FunctionInfo{1508, nullptr, "Unknown1508", MakeVersionGate({20,0,0})}, + FunctionInfo{1509, nullptr, "Unknown1509", MakeVersionGate({20,0,0})}, + FunctionInfo{1510, nullptr, "Unknown1510", MakeVersionGate({20,0,0})}, + FunctionInfo{1511, nullptr, "Unknown1511", MakeVersionGate({20,0,0})}, + FunctionInfo{1512, nullptr, "Unknown1512", MakeVersionGate({20,0,0})}, + FunctionInfo{1600, nullptr, "GetSystemSeedForPseudoDeviceId"}, + FunctionInfo{1601, nullptr, "ResetSystemSeedForPseudoDeviceId"}, + FunctionInfo{1700, nullptr, "ListApplicationDownloadingContentMeta"}, + FunctionInfo{1701, D<&IApplicationManagerInterface::GetApplicationViewDeprecated>, "GetApplicationViewDeprecated"}, + FunctionInfo{1702, nullptr, "GetApplicationDownloadTaskStatus"}, + FunctionInfo{1703, nullptr, "GetApplicationViewDownloadErrorContext"}, + FunctionInfo{1704, D<&IApplicationManagerInterface::GetApplicationViewWithPromotionInfo>, "GetApplicationViewWithPromotionInfo"}, + FunctionInfo{1705, nullptr, "IsPatchAutoDeletableApplication"}, + FunctionInfo{1706, D<&IApplicationManagerInterface::GetApplicationView>, "GetApplicationView"}, + FunctionInfo{1800, nullptr, "IsNotificationSetupCompleted"}, + FunctionInfo{1801, nullptr, "GetLastNotificationInfoCount"}, + FunctionInfo{1802, nullptr, "ListLastNotificationInfo"}, + FunctionInfo{1803, nullptr, "ListNotificationTask"}, + FunctionInfo{1900, nullptr, "IsActiveAccount"}, + FunctionInfo{1901, nullptr, "RequestDownloadApplicationPrepurchasedRights"}, + FunctionInfo{1902, nullptr, "GetApplicationTicketInfo"}, + FunctionInfo{1903, nullptr, "RequestDownloadApplicationPrepurchasedRightsForAccount"}, + FunctionInfo{2000, nullptr, "GetSystemDeliveryInfo"}, + FunctionInfo{2001, nullptr, "SelectLatestSystemDeliveryInfo"}, + FunctionInfo{2002, nullptr, "VerifyDeliveryProtocolVersion"}, + FunctionInfo{2003, nullptr, "GetApplicationDeliveryInfo"}, + FunctionInfo{2004, nullptr, "HasAllContentsToDeliver"}, + FunctionInfo{2005, nullptr, "CompareApplicationDeliveryInfo"}, + FunctionInfo{2006, nullptr, "CanDeliverApplication"}, + FunctionInfo{2007, nullptr, "ListContentMetaKeyToDeliverApplication"}, + FunctionInfo{2008, nullptr, "NeedsSystemUpdateToDeliverApplication"}, + FunctionInfo{2009, nullptr, "EstimateRequiredSize"}, + FunctionInfo{2010, nullptr, "RequestReceiveApplication"}, + FunctionInfo{2011, nullptr, "CommitReceiveApplication"}, + FunctionInfo{2012, nullptr, "GetReceiveApplicationProgress"}, + FunctionInfo{2013, nullptr, "RequestSendApplication"}, + FunctionInfo{2014, nullptr, "GetSendApplicationProgress"}, + FunctionInfo{2015, nullptr, "CompareSystemDeliveryInfo"}, + FunctionInfo{2016, nullptr, "ListNotCommittedContentMeta"}, + FunctionInfo{2017, nullptr, "CreateDownloadTask"}, + FunctionInfo{2018, nullptr, "GetApplicationDeliveryInfoHash"}, + FunctionInfo{2019, nullptr, "Unknown2019", MakeVersionGate({20,0,0})}, + FunctionInfo{2050, D<&IApplicationManagerInterface::GetApplicationRightsOnClient>, "GetApplicationRightsOnClient"}, + FunctionInfo{2051, nullptr, "InvalidateRightsIdCache"}, + FunctionInfo{2052, nullptr, "Unknown2052", MakeVersionGate({20,0,0})}, + FunctionInfo{2053, nullptr, "Unknown2053", MakeVersionGate({20,0,0})}, + FunctionInfo{2100, D<&IApplicationManagerInterface::GetApplicationTerminateResult>, "GetApplicationTerminateResult"}, + FunctionInfo{2101, nullptr, "GetRawApplicationTerminateResult"}, + FunctionInfo{2150, nullptr, "CreateRightsEnvironment"}, + FunctionInfo{2151, nullptr, "DestroyRightsEnvironment"}, + FunctionInfo{2152, nullptr, "ActivateRightsEnvironment"}, + FunctionInfo{2153, nullptr, "DeactivateRightsEnvironment"}, + FunctionInfo{2154, nullptr, "ForceActivateRightsContextForExit"}, + FunctionInfo{2155, nullptr, "UpdateRightsEnvironmentStatus"}, + FunctionInfo{2156, nullptr, "CreateRightsEnvironmentForMicroApplication"}, + FunctionInfo{2160, nullptr, "AddTargetApplicationToRightsEnvironment"}, + FunctionInfo{2161, nullptr, "SetUsersToRightsEnvironment"}, + FunctionInfo{2170, nullptr, "GetRightsEnvironmentStatus"}, + FunctionInfo{2171, nullptr, "GetRightsEnvironmentStatusChangedEvent"}, + FunctionInfo{2180, nullptr, "RequestExtendRightsInRightsEnvironment"}, + FunctionInfo{2181, nullptr, "GetResultOfExtendRightsInRightsEnvironment"}, + FunctionInfo{2182, nullptr, "SetActiveRightsContextUsingStateToRightsEnvironment"}, + FunctionInfo{2183, nullptr, "Unknown2183", MakeVersionGate({20,1,0})}, + FunctionInfo{2190, nullptr, "GetRightsEnvironmentHandleForApplication"}, + FunctionInfo{2199, nullptr, "GetRightsEnvironmentCountForDebug"}, + FunctionInfo{2200, nullptr, "GetGameCardApplicationCopyIdentifier"}, + FunctionInfo{2201, nullptr, "GetInstalledApplicationCopyIdentifier"}, + FunctionInfo{2250, nullptr, "RequestReportActiveELicence"}, + FunctionInfo{2300, nullptr, "ListEventLog"}, + FunctionInfo{2350, nullptr, "PerformAutoUpdateByApplicationId"}, + FunctionInfo{2351, nullptr, "RequestNoDownloadRightsErrorResolution"}, + FunctionInfo{2352, nullptr, "RequestResolveNoDownloadRightsError"}, + FunctionInfo{2353, nullptr, "GetApplicationDownloadTaskInfo"}, + FunctionInfo{2354, nullptr, "PrioritizeApplicationBackgroundTask"}, + FunctionInfo{2355, nullptr, "PreferStorageEfficientUpdate"}, + FunctionInfo{2356, nullptr, "RequestStorageEfficientUpdatePreferable"}, + FunctionInfo{2357, nullptr, "EnableMultiCoreDownload"}, + FunctionInfo{2358, nullptr, "DisableMultiCoreDownload"}, + FunctionInfo{2359, nullptr, "IsMultiCoreDownloadEnabled"}, + FunctionInfo{2360, nullptr, "GetApplicationDownloadTaskCount", MakeVersionGate({19,0,0})}, + FunctionInfo{2361, nullptr, "GetMaxApplicationDownloadTaskCount", MakeVersionGate({19,0,0})}, + FunctionInfo{2362, nullptr, "Unknown2362", MakeVersionGate({20,0,0})}, + FunctionInfo{2363, nullptr, "Unknown2363", MakeVersionGate({20,0,0})}, + FunctionInfo{2364, nullptr, "Unknown2364", MakeVersionGate({20,0,0})}, + FunctionInfo{2365, nullptr, "Unknown2365", MakeVersionGate({20,0,0})}, + FunctionInfo{2366, nullptr, "Unknown2366", MakeVersionGate({20,0,0})}, + FunctionInfo{2367, nullptr, "Unknown2367", MakeVersionGate({20,0,0})}, + FunctionInfo{2368, nullptr, "Unknown2368", MakeVersionGate({20,0,0})}, + FunctionInfo{2369, nullptr, "Unknown2369", MakeVersionGate({21,0,0})}, + FunctionInfo{2400, nullptr, "GetPromotionInfo"}, + FunctionInfo{2401, nullptr, "CountPromotionInfo"}, + FunctionInfo{2402, nullptr, "ListPromotionInfo"}, + FunctionInfo{2403, nullptr, "ImportPromotionJsonForDebug"}, + FunctionInfo{2404, nullptr, "ClearPromotionInfoForDebug"}, + FunctionInfo{2500, nullptr, "ConfirmAvailableTime"}, + FunctionInfo{2510, nullptr, "CreateApplicationResource"}, + FunctionInfo{2511, nullptr, "GetApplicationResource"}, + FunctionInfo{2513, nullptr, "LaunchMicroApplication"}, + FunctionInfo{2514, nullptr, "ClearTaskOfAsyncTaskManager"}, + FunctionInfo{2515, nullptr, "CleanupAllPlaceHolderAndFragmentsIfNoTask"}, + FunctionInfo{2516, nullptr, "EnsureApplicationCertificate"}, + FunctionInfo{2517, nullptr, "CreateApplicationInstance"}, + FunctionInfo{2518, nullptr, "UpdateQualificationForDebug"}, + FunctionInfo{2519, nullptr, "IsQualificationTransitionSupported"}, + FunctionInfo{2520, D<&IApplicationManagerInterface::IsQualificationTransitionSupportedByProcessId>, "IsQualificationTransitionSupportedByProcessId"}, + FunctionInfo{2521, nullptr, "GetRightsUserChangedEvent"}, + FunctionInfo{2522, nullptr, "IsRomRedirectionAvailable"}, + FunctionInfo{2523, nullptr, "GetProgramId", MakeVersionGate({17,0,0})}, + FunctionInfo{2524, nullptr, "Unknown2524", MakeVersionGate({19,0,0})}, + FunctionInfo{2525, nullptr, "Unknown2525", MakeVersionGate({20,0,0})}, + FunctionInfo{2800, nullptr, "GetApplicationIdOfPreomia"}, + FunctionInfo{3000, nullptr, "RegisterDeviceLockKey"}, + FunctionInfo{3001, nullptr, "UnregisterDeviceLockKey"}, + FunctionInfo{3002, nullptr, "VerifyDeviceLockKey"}, + FunctionInfo{3003, nullptr, "HideApplicationIcon"}, + FunctionInfo{3004, nullptr, "ShowApplicationIcon"}, + FunctionInfo{3005, nullptr, "HideApplicationTitle"}, + FunctionInfo{3006, nullptr, "ShowApplicationTitle"}, + FunctionInfo{3007, nullptr, "EnableGameCard"}, + FunctionInfo{3008, nullptr, "DisableGameCard"}, + FunctionInfo{3009, nullptr, "EnableLocalContentShare"}, + FunctionInfo{3010, nullptr, "DisableLocalContentShare"}, + FunctionInfo{3011, nullptr, "IsApplicationIconHidden"}, + FunctionInfo{3012, nullptr, "IsApplicationTitleHidden"}, + FunctionInfo{3013, nullptr, "IsGameCardEnabled"}, + FunctionInfo{3014, nullptr, "IsLocalContentShareEnabled"}, + FunctionInfo{3050, nullptr, "ListAssignELicenseTaskResult"}, + FunctionInfo{3104, nullptr, "GetApplicationNintendoLogo", MakeVersionGate({18,0,0})}, + FunctionInfo{3105, nullptr, "GetApplicationStartupMovie", MakeVersionGate({18,0,0})}, + FunctionInfo{4000, nullptr, "Unknown4000", MakeVersionGate({20,0,0})}, + FunctionInfo{4004, nullptr, "Unknown4004", MakeVersionGate({20,0,0})}, + FunctionInfo{4006, nullptr, "Unknown4006", MakeVersionGate({20,0,0})}, + FunctionInfo{4007, nullptr, "Unknown4007", MakeVersionGate({20,0,0})}, + FunctionInfo{4008, nullptr, "Unknown4008", MakeVersionGate({20,0,0})}, + FunctionInfo{4009, nullptr, "Unknown4009", MakeVersionGate({20,0,0})}, + FunctionInfo{4010, nullptr, "Unknown4010", MakeVersionGate({20,0,0})}, + FunctionInfo{4011, nullptr, "Unknown4011", MakeVersionGate({20,0,0})}, + FunctionInfo{4012, nullptr, "Unknown4012", MakeVersionGate({20,0,0})}, + FunctionInfo{4013, nullptr, "Unknown4013", MakeVersionGate({20,0,0})}, + FunctionInfo{4015, nullptr, "Unknown4015", MakeVersionGate({20,0,0})}, + FunctionInfo{4017, nullptr, "Unknown4017", MakeVersionGate({20,0,0})}, + FunctionInfo{4019, nullptr, "Unknown4019", MakeVersionGate({20,0,0})}, + FunctionInfo{4020, nullptr, "Unknown4020", MakeVersionGate({20,0,0})}, + FunctionInfo{4021, nullptr, "Unknown4021", MakeVersionGate({20,0,0})}, + FunctionInfo{4022, D<&IApplicationManagerInterface::Unknown4022>, "Unknown4022", MakeVersionGate({20,0,0})}, + FunctionInfo{4023, D<&IApplicationManagerInterface::Unknown4023>, "Unknown4023", MakeVersionGate({20,0,0})}, + FunctionInfo{4024, nullptr, "Unknown4024", MakeVersionGate({20,0,0})}, + FunctionInfo{4025, nullptr, "Unknown4025", MakeVersionGate({20,0,0})}, + FunctionInfo{4026, nullptr, "Unknown4026", MakeVersionGate({20,0,0})}, + FunctionInfo{4027, nullptr, "Unknown4027", MakeVersionGate({20,0,0})}, + FunctionInfo{4028, nullptr, "Unknown4028", MakeVersionGate({20,0,0})}, + FunctionInfo{4029, nullptr, "Unknown4029", MakeVersionGate({20,0,0})}, + FunctionInfo{4030, nullptr, "Unknown4030", MakeVersionGate({20,0,0})}, + FunctionInfo{4031, nullptr, "Unknown4031", MakeVersionGate({20,0,0})}, + FunctionInfo{4032, nullptr, "Unknown4032", MakeVersionGate({20,0,0})}, + FunctionInfo{4033, nullptr, "Unknown4033", MakeVersionGate({20,0,0})}, + FunctionInfo{4034, nullptr, "Unknown4034", MakeVersionGate({20,0,0})}, + FunctionInfo{4035, nullptr, "Unknown4035", MakeVersionGate({20,0,0})}, + FunctionInfo{4037, nullptr, "Unknown4037", MakeVersionGate({20,0,0})}, + FunctionInfo{4038, nullptr, "Unknown4038", MakeVersionGate({20,0,0})}, + FunctionInfo{4039, nullptr, "Unknown4039", MakeVersionGate({20,0,0})}, + FunctionInfo{4040, nullptr, "Unknown4040", MakeVersionGate({20,0,0})}, + FunctionInfo{4041, nullptr, "Unknown4041", MakeVersionGate({20,0,0})}, + FunctionInfo{4042, D<&IApplicationManagerInterface::Unknown4042>, "Unknown4042", MakeVersionGate({20,0,0})}, + FunctionInfo{4043, nullptr, "Unknown4043", MakeVersionGate({20,0,0})}, + FunctionInfo{4044, nullptr, "Unknown4044", MakeVersionGate({20,0,0})}, + FunctionInfo{4045, nullptr, "Unknown4045", MakeVersionGate({20,0,0})}, + FunctionInfo{4046, nullptr, "Unknown4046", MakeVersionGate({20,0,0})}, + FunctionInfo{4049, nullptr, "Unknown4049", MakeVersionGate({20,0,0})}, + FunctionInfo{4050, nullptr, "Unknown4050", MakeVersionGate({20,0,0})}, + FunctionInfo{4051, nullptr, "Unknown4051", MakeVersionGate({20,0,0})}, + FunctionInfo{4052, nullptr, "Unknown4052", MakeVersionGate({20,0,0})}, + FunctionInfo{4053, D<&IApplicationManagerInterface::Unknown4053>, "Unknown4053", MakeVersionGate({20,0,0})}, + FunctionInfo{4054, nullptr, "Unknown4054", MakeVersionGate({20,0,0})}, + FunctionInfo{4055, nullptr, "Unknown4055", MakeVersionGate({20,0,0})}, + FunctionInfo{4056, nullptr, "Unknown4056", MakeVersionGate({20,0,0})}, + FunctionInfo{4057, nullptr, "Unknown4057", MakeVersionGate({20,0,0})}, + FunctionInfo{4058, nullptr, "Unknown4058", MakeVersionGate({20,0,0})}, + FunctionInfo{4059, nullptr, "Unknown4059", MakeVersionGate({20,0,0})}, + FunctionInfo{4060, nullptr, "Unknown4060", MakeVersionGate({20,0,0})}, + FunctionInfo{4061, nullptr, "Unknown4061", MakeVersionGate({20,0,0})}, + FunctionInfo{4062, nullptr, "Unknown4062", MakeVersionGate({20,0,0})}, + FunctionInfo{4063, nullptr, "Unknown4063", MakeVersionGate({20,0,0})}, + FunctionInfo{4064, nullptr, "Unknown4064", MakeVersionGate({20,0,0})}, + FunctionInfo{4065, nullptr, "Unknown4065", MakeVersionGate({20,0,0})}, + FunctionInfo{4066, nullptr, "Unknown4066", MakeVersionGate({20,0,0})}, + FunctionInfo{4067, nullptr, "Unknown4067", MakeVersionGate({20,0,0})}, + FunctionInfo{4068, nullptr, "Unknown4068", MakeVersionGate({20,0,0})}, + FunctionInfo{4069, nullptr, "Unknown4069", MakeVersionGate({20,0,0})}, + FunctionInfo{4070, nullptr, "Unknown4070", MakeVersionGate({20,0,0})}, + FunctionInfo{4071, nullptr, "Unknown4071", MakeVersionGate({20,0,0})}, + FunctionInfo{4072, nullptr, "Unknown4072", MakeVersionGate({20,0,0})}, + FunctionInfo{4073, nullptr, "Unknown4073", MakeVersionGate({20,0,0})}, + FunctionInfo{4074, nullptr, "Unknown4074", MakeVersionGate({20,0,0})}, + FunctionInfo{4075, nullptr, "Unknown4075", MakeVersionGate({20,0,0})}, + FunctionInfo{4076, nullptr, "Unknown4076", MakeVersionGate({20,0,0})}, + FunctionInfo{4077, nullptr, "Unknown4077", MakeVersionGate({20,0,0})}, + FunctionInfo{4078, nullptr, "Unknown4078", MakeVersionGate({20,0,0})}, + FunctionInfo{4079, nullptr, "Unknown4079", MakeVersionGate({20,0,0})}, + FunctionInfo{4080, nullptr, "Unknown4080", MakeVersionGate({20,0,0})}, + FunctionInfo{4081, nullptr, "Unknown4081", MakeVersionGate({20,0,0})}, + FunctionInfo{4083, nullptr, "Unknown4083", MakeVersionGate({20,0,0})}, + FunctionInfo{4084, nullptr, "Unknown4084", MakeVersionGate({20,0,0})}, + FunctionInfo{4085, nullptr, "Unknown4085", MakeVersionGate({20,0,0})}, + FunctionInfo{4086, nullptr, "Unknown4086", MakeVersionGate({20,0,0})}, + FunctionInfo{4087, nullptr, "Unknown4087", MakeVersionGate({20,0,0})}, + FunctionInfo{4088, D<&IApplicationManagerInterface::Unknown4022>, "Unknown4088", MakeVersionGate({20,0,0})}, + FunctionInfo{4089, nullptr, "Unknown4089", MakeVersionGate({20,0,0})}, + FunctionInfo{4090, nullptr, "Unknown4090", MakeVersionGate({20,0,0})}, + FunctionInfo{4091, nullptr, "Unknown4091", MakeVersionGate({20,0,0})}, + FunctionInfo{4092, nullptr, "Unknown4092", MakeVersionGate({20,0,0})}, + FunctionInfo{4093, nullptr, "Unknown4093", MakeVersionGate({20,0,0})}, + FunctionInfo{4094, nullptr, "Unknown4094", MakeVersionGate({20,0,0})}, + FunctionInfo{4095, nullptr, "Unknown4095", MakeVersionGate({20,0,0})}, + FunctionInfo{4096, nullptr, "Unknown4096", MakeVersionGate({20,0,0})}, + FunctionInfo{4097, nullptr, "Unknown4097", MakeVersionGate({20,0,0})}, + FunctionInfo{4099, nullptr, "Unknown4099", MakeVersionGate({21,0,0})}, + FunctionInfo{4105, D<&IApplicationManagerInterface::Unknown4105>, "Unknown4105", MakeVersionGate({23,0,0})}, + FunctionInfo{5000, nullptr, "Unknown5000", MakeVersionGate({18,0,0})}, + FunctionInfo{5001, nullptr, "Unknown5001", MakeVersionGate({18,0,0})}, + FunctionInfo{9999, nullptr, "GetApplicationCertificate", MakeVersionGate({10,0,0}, {10,2,0})} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_) : ServiceFramework{system_, "IApplicationManagerInterface"}, service_context{system, "IApplicationManagerInterface"}, @@ -32,458 +484,6 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ gamecard_update_detection_event{service_context}, gamecard_mount_status_event{service_context}, gamecard_mount_failure_event{service_context}, gamecard_waken_ready_event{service_context}, unknown_event{service_context} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IApplicationManagerInterface::ListApplicationRecord>, "ListApplicationRecord"}, - {1, nullptr, "GenerateApplicationRecordCount"}, - {2, D<&IApplicationManagerInterface::GetApplicationRecordUpdateSystemEvent>, "GetApplicationRecordUpdateSystemEvent"}, - {3, nullptr, "GetApplicationViewDeprecated"}, - {4, D<&IApplicationManagerInterface::DeleteApplicationEntity>, "DeleteApplicationEntity"}, - {5, D<&IApplicationManagerInterface::DeleteApplicationCompletely>, "DeleteApplicationCompletely"}, - {6, nullptr, "IsAnyApplicationEntityRedundant"}, - {7, nullptr, "DeleteRedundantApplicationEntity"}, - {8, nullptr, "IsApplicationEntityMovable"}, - {9, nullptr, "MoveApplicationEntity"}, - {11, nullptr, "CalculateApplicationOccupiedSize"}, - {16, &IApplicationManagerInterface::PushApplicationRecord, "PushApplicationRecord"}, - {17, nullptr, "ListApplicationRecordContentMeta"}, - {19, nullptr, "LaunchApplicationOld"}, - {21, nullptr, "GetApplicationContentPath"}, - {22, nullptr, "TerminateApplication"}, - {23, nullptr, "ResolveApplicationContentPath"}, - {26, nullptr, "BeginInstallApplication"}, - {27, nullptr, "DeleteApplicationRecord"}, - {30, nullptr, "RequestApplicationUpdateInfo"}, - {31, nullptr, "RequestUpdateApplication"}, - {32, nullptr, "CancelApplicationDownload"}, - {33, nullptr, "ResumeApplicationDownload"}, - {35, nullptr, "UpdateVersionList"}, - {36, nullptr, "PushLaunchVersion"}, - {37, nullptr, "ListRequiredVersion"}, - {38, D<&IApplicationManagerInterface::CheckApplicationLaunchVersion>, "CheckApplicationLaunchVersion"}, - {39, nullptr, "CheckApplicationLaunchRights"}, - {40, D<&IApplicationManagerInterface::GetApplicationLogoData>, "GetApplicationLogoData"}, - {41, nullptr, "CalculateApplicationDownloadRequiredSize"}, - {42, nullptr, "CleanupSdCard"}, - {43, D<&IApplicationManagerInterface::CheckSdCardMountStatus>, "CheckSdCardMountStatus"}, - {44, D<&IApplicationManagerInterface::GetSdCardMountStatusChangedEvent>, "GetSdCardMountStatusChangedEvent"}, - {45, nullptr, "GetGameCardAttachmentEvent"}, - {46, nullptr, "GetGameCardAttachmentInfo"}, - {47, D<&IApplicationManagerInterface::GetTotalSpaceSize>, "GetTotalSpaceSize"}, - {48, D<&IApplicationManagerInterface::GetFreeSpaceSize>, "GetFreeSpaceSize"}, - {49, nullptr, "GetSdCardRemovedEvent"}, - {52, D<&IApplicationManagerInterface::GetGameCardUpdateDetectionEvent>, "GetGameCardUpdateDetectionEvent"}, - {53, nullptr, "DisableApplicationAutoDelete"}, - {54, nullptr, "EnableApplicationAutoDelete"}, - {55, D<&IApplicationManagerInterface::GetApplicationDesiredLanguage>, "GetApplicationDesiredLanguage"}, - {56, nullptr, "SetApplicationTerminateResult"}, - {57, nullptr, "ClearApplicationTerminateResult"}, - {58, nullptr, "GetLastSdCardMountUnexpectedResult"}, - {59, D<&IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode>, "ConvertApplicationLanguageToLanguageCode"}, - {60, nullptr, "ConvertLanguageCodeToApplicationLanguage"}, - {61, nullptr, "GetBackgroundDownloadStressTaskInfo"}, - {62, nullptr, "GetGameCardStopper"}, - {63, nullptr, "IsSystemProgramInstalled"}, - {64, nullptr, "StartApplyDeltaTask"}, - {65, nullptr, "GetRequestServerStopper"}, - {66, nullptr, "GetBackgroundApplyDeltaStressTaskInfo"}, - {67, nullptr, "CancelApplicationApplyDelta"}, - {68, nullptr, "ResumeApplicationApplyDelta"}, - {69, nullptr, "CalculateApplicationApplyDeltaRequiredSize"}, - {70, D<&IApplicationManagerInterface::ResumeAll>, "ResumeAll"}, - {71, D<&IApplicationManagerInterface::GetStorageSize>, "GetStorageSize"}, - {80, nullptr, "RequestDownloadApplication"}, - {81, nullptr, "RequestDownloadAddOnContent"}, - {82, nullptr, "DownloadApplication"}, - {83, nullptr, "CheckApplicationResumeRights"}, - {84, nullptr, "GetDynamicCommitEvent"}, - {85, nullptr, "RequestUpdateApplication2"}, - {86, nullptr, "EnableApplicationCrashReport"}, - {87, nullptr, "IsApplicationCrashReportEnabled"}, - {90, nullptr, "BoostSystemMemoryResourceLimit"}, - {91, nullptr, "DeprecatedLaunchApplication"}, - {92, nullptr, "GetRunningApplicationProgramId"}, - {93, nullptr, "GetMainApplicationProgramIndex"}, - {94, nullptr, "LaunchApplication"}, - {95, nullptr, "GetApplicationLaunchInfo"}, - {96, nullptr, "AcquireApplicationLaunchInfo"}, - {97, nullptr, "GetMainApplicationProgramIndexByApplicationLaunchInfo"}, - {98, nullptr, "EnableApplicationAllThreadDumpOnCrash"}, - {99, nullptr, "LaunchDevMenu"}, - {100, nullptr, "ResetToFactorySettings"}, - {101, nullptr, "ResetToFactorySettingsWithoutUserSaveData"}, - {102, nullptr, "ResetToFactorySettingsForRefurbishment"}, - {103, nullptr, "ResetToFactorySettingsWithPlatformRegion"}, - {104, nullptr, "ResetToFactorySettingsWithPlatformRegionAuthentication"}, - {105, nullptr, "RequestResetToFactorySettingsSecurely"}, - {106, nullptr, "RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely"}, - {200, nullptr, "CalculateUserSaveDataStatistics"}, - {201, nullptr, "DeleteUserSaveDataAll"}, - {210, nullptr, "DeleteUserSystemSaveData"}, - {211, nullptr, "DeleteSaveData"}, - {220, nullptr, "UnregisterNetworkServiceAccount"}, - {221, D<&IApplicationManagerInterface::UnregisterNetworkServiceAccountWithUserSaveDataDeletion>, "UnregisterNetworkServiceAccountWithUserSaveDataDeletion"}, - {300, nullptr, "GetApplicationShellEvent"}, - {301, nullptr, "PopApplicationShellEventInfo"}, - {302, nullptr, "LaunchLibraryApplet"}, - {303, nullptr, "TerminateLibraryApplet"}, - {304, nullptr, "LaunchSystemApplet"}, - {305, nullptr, "TerminateSystemApplet"}, - {306, nullptr, "LaunchOverlayApplet"}, - {307, nullptr, "TerminateOverlayApplet"}, - {400, D<&IApplicationManagerInterface::GetApplicationControlData>, "GetApplicationControlData"}, - {401, nullptr, "InvalidateAllApplicationControlCache"}, - {402, nullptr, "RequestDownloadApplicationControlData"}, - {403, nullptr, "GetMaxApplicationControlCacheCount"}, - {404, nullptr, "InvalidateApplicationControlCache"}, - {405, nullptr, "ListApplicationControlCacheEntryInfo"}, - {406, nullptr, "GetApplicationControlProperty"}, - {407, &IApplicationManagerInterface::ListApplicationTitle, "ListApplicationTitle"}, - {408, &IApplicationManagerInterface::ListApplicationIcon, "ListApplicationIcon"}, - {411, nullptr, "Unknown411"}, //19.0.0+ - {412, nullptr, "Unknown412"}, //19.0.0+ - {413, nullptr, "Unknown413"}, //19.0.0+ - {414, nullptr, "Unknown414"}, //19.0.0+ - {415, nullptr, "Unknown415"}, //19.0.0+ - {416, nullptr, "Unknown416"}, //19.0.0+ - {417, nullptr, "InvalidateAllApplicationControlCacheOfTheStage"}, //19.0.0+ - {418, nullptr, "InvalidateApplicationControlCacheOfTheStage"}, //19.0.0+ - {419, D<&IApplicationManagerInterface::RequestDownloadApplicationControlDataInBackground>, "RequestDownloadApplicationControlDataInBackground"}, - {420, nullptr, "CloneApplicationControlDataCacheForDebug"}, - {421, nullptr, "Unknown421"}, //20.0.0+ - {422, nullptr, "Unknown422"}, //20.0.0+ - {423, nullptr, "Unknown423"}, //20.0.0+ - {424, nullptr, "Unknown424"}, //20.0.0+ - {425, nullptr, "Unknown425"}, //20.0.0+ - {426, nullptr, "Unknown426"}, //20.0.0+ - {427, nullptr, "Unknown427"}, //20.0.0+ - {428, nullptr, "Unknown428"}, //21.0.0+ - {429, nullptr, "Unknown429"}, //21.0.0+ - {430, nullptr, "Unknown430"}, //21.0.0+ - {502, nullptr, "RequestCheckGameCardRegistration"}, - {503, nullptr, "RequestGameCardRegistrationGoldPoint"}, - {504, nullptr, "RequestRegisterGameCard"}, - {505, D<&IApplicationManagerInterface::GetGameCardMountFailureEvent>, "GetGameCardMountFailureEvent"}, - {506, nullptr, "IsGameCardInserted"}, - {507, nullptr, "EnsureGameCardAccess"}, - {508, nullptr, "GetLastGameCardMountFailureResult"}, - {509, nullptr, "ListApplicationIdOnGameCard"}, - {510, nullptr, "GetGameCardPlatformRegion"}, - {511, D<&IApplicationManagerInterface::GetGameCardWakenReadyEvent>, "GetGameCardWakenReadyEvent"}, - {512, D<&IApplicationManagerInterface::IsGameCardApplicationRunning>, "IsGameCardApplicationRunning"}, - {513, nullptr, "Unknown513"}, //20.0.0+ - {514, nullptr, "Unknown514"}, //20.0.0+ - {515, nullptr, "Unknown515"}, //20.0.0+ - {516, nullptr, "Unknown516"}, //21.0.0+ - {517, nullptr, "Unknown517"}, //21.0.0+ - {518, nullptr, "Unknown518"}, //21.0.0+ - {519, nullptr, "Unknown519"}, //21.0.0+ - {600, nullptr, "CountApplicationContentMeta"}, - {601, nullptr, "ListApplicationContentMetaStatus"}, - {602, nullptr, "ListAvailableAddOnContent"}, - {603, nullptr, "GetOwnedApplicationContentMetaStatus"}, - {604, nullptr, "RegisterContentsExternalKey"}, - {605, nullptr, "ListApplicationContentMetaStatusWithRightsCheck"}, - {606, nullptr, "GetContentMetaStorage"}, - {607, nullptr, "ListAvailableAddOnContent"}, - {609, nullptr, "ListAvailabilityAssuredAddOnContent"}, - {610, nullptr, "GetInstalledContentMetaStorage"}, - {611, nullptr, "PrepareAddOnContent"}, - {700, nullptr, "PushDownloadTaskList"}, - {701, nullptr, "ClearTaskStatusList"}, - {702, nullptr, "RequestDownloadTaskList"}, - {703, nullptr, "RequestEnsureDownloadTask"}, - {704, nullptr, "ListDownloadTaskStatus"}, - {705, nullptr, "RequestDownloadTaskListData"}, - {800, nullptr, "RequestVersionList"}, - {801, nullptr, "ListVersionList"}, - {802, nullptr, "RequestVersionListData"}, - {900, nullptr, "GetApplicationRecord"}, - {901, nullptr, "GetApplicationRecordProperty"}, - {902, nullptr, "EnableApplicationAutoUpdate"}, - {903, nullptr, "DisableApplicationAutoUpdate"}, - {904, D<&IApplicationManagerInterface::TouchApplication>, "TouchApplication"}, - {905, nullptr, "RequestApplicationUpdate"}, - {906, D<&IApplicationManagerInterface::IsApplicationUpdateRequested>, "IsApplicationUpdateRequested"}, - {907, nullptr, "WithdrawApplicationUpdateRequest"}, - {908, nullptr, "ListApplicationRecordInstalledContentMeta"}, - {909, nullptr, "WithdrawCleanupAddOnContentsWithNoRightsRecommendation"}, - {910, nullptr, "HasApplicationRecord"}, - {911, nullptr, "SetPreInstalledApplication"}, - {912, nullptr, "ClearPreInstalledApplicationFlag"}, - {913, nullptr, "ListAllApplicationRecord"}, - {914, nullptr, "HideApplicationRecord"}, - {915, nullptr, "ShowApplicationRecord"}, - {916, nullptr, "IsApplicationAutoDeleteDisabled"}, - {916, nullptr, "Unknown916"}, //20.0.0+ - {917, nullptr, "Unknown917"}, //20.0.0+ - {918, nullptr, "Unknown918"}, //20.0.0+ - {919, nullptr, "Unknown919"}, //20.0.0+ - {920, nullptr, "Unknown920"}, //20.0.0+ - {921, nullptr, "Unknown921"}, //20.0.0+ - {922, nullptr, "Unknown922"}, //20.0.0+ - {923, nullptr, "Unknown923"}, //20.0.0+ - {928, nullptr, "Unknown928"}, //20.0.0+ - {929, nullptr, "Unknown929"}, //20.0.0+ - {930, nullptr, "Unknown930"}, //20.0.0+ - {931, nullptr, "Unknown931"}, //20.0.0+ - {933, nullptr, "Unknown933"}, //20.0.0+ - {934, nullptr, "Unknown934"}, //21.0.0+ - {935, nullptr, "Unknown935"}, //21.0.0+ - {936, D<&IApplicationManagerInterface::Unknown936>, "Unknown936"}, //21.0.0+ - {1000, nullptr, "RequestVerifyApplicationDeprecated"}, - {1001, nullptr, "CorruptApplicationForDebug"}, - {1002, nullptr, "RequestVerifyAddOnContentsRights"}, - {1003, nullptr, "RequestVerifyApplication"}, - {1004, nullptr, "CorruptContentForDebug"}, - {1200, nullptr, "NeedsUpdateVulnerability"}, - {1300, D<&IApplicationManagerInterface::IsAnyApplicationEntityInstalled>, "IsAnyApplicationEntityInstalled"}, - {1301, nullptr, "DeleteApplicationContentEntities"}, - {1302, nullptr, "CleanupUnrecordedApplicationEntity"}, - {1303, nullptr, "CleanupAddOnContentsWithNoRights"}, - {1304, nullptr, "DeleteApplicationContentEntity"}, - {1305, nullptr, "TryDeleteRunningApplicationEntity"}, - {1306, nullptr, "TryDeleteRunningApplicationCompletely"}, - {1307, nullptr, "TryDeleteRunningApplicationContentEntities"}, - {1308, nullptr, "DeleteApplicationCompletelyForDebug"}, - {1309, nullptr, "CleanupUnavailableAddOnContents"}, - {1310, nullptr, "RequestMoveApplicationEntity"}, - {1311, nullptr, "EstimateSizeToMove"}, - {1312, nullptr, "HasMovableEntity"}, - {1313, nullptr, "CleanupOrphanContents"}, - {1314, nullptr, "CheckPreconditionSatisfiedToMove"}, - {1400, nullptr, "PrepareShutdown"}, - {1500, nullptr, "FormatSdCard"}, - {1501, nullptr, "NeedsSystemUpdateToFormatSdCard"}, - {1502, nullptr, "GetLastSdCardFormatUnexpectedResult"}, - {1504, nullptr, "InsertSdCard"}, - {1505, nullptr, "RemoveSdCard"}, - {1506, nullptr, "GetSdCardStartupStatus"}, - {1508, nullptr, "Unknown1508"}, //20.0.0+ - {1509, nullptr, "Unknown1509"}, //20.0.0+ - {1510, nullptr, "Unknown1510"}, //20.0.0+ - {1511, nullptr, "Unknown1511"}, //20.0.0+ - {1512, nullptr, "Unknown1512"}, //20.0.0+ - {1600, nullptr, "GetSystemSeedForPseudoDeviceId"}, - {1601, nullptr, "ResetSystemSeedForPseudoDeviceId"}, - {1700, nullptr, "ListApplicationDownloadingContentMeta"}, - {1701, D<&IApplicationManagerInterface::GetApplicationViewDeprecated>, "GetApplicationViewDeprecated"}, - {1702, nullptr, "GetApplicationDownloadTaskStatus"}, - {1703, nullptr, "GetApplicationViewDownloadErrorContext"}, - {1704, D<&IApplicationManagerInterface::GetApplicationViewWithPromotionInfo>, "GetApplicationViewWithPromotionInfo"}, - {1705, nullptr, "IsPatchAutoDeletableApplication"}, - {1706, D<&IApplicationManagerInterface::GetApplicationView>, "GetApplicationView"}, - {1800, nullptr, "IsNotificationSetupCompleted"}, - {1801, nullptr, "GetLastNotificationInfoCount"}, - {1802, nullptr, "ListLastNotificationInfo"}, - {1803, nullptr, "ListNotificationTask"}, - {1900, nullptr, "IsActiveAccount"}, - {1901, nullptr, "RequestDownloadApplicationPrepurchasedRights"}, - {1902, nullptr, "GetApplicationTicketInfo"}, - {1903, nullptr, "RequestDownloadApplicationPrepurchasedRightsForAccount"}, - {2000, nullptr, "GetSystemDeliveryInfo"}, - {2001, nullptr, "SelectLatestSystemDeliveryInfo"}, - {2002, nullptr, "VerifyDeliveryProtocolVersion"}, - {2003, nullptr, "GetApplicationDeliveryInfo"}, - {2004, nullptr, "HasAllContentsToDeliver"}, - {2005, nullptr, "CompareApplicationDeliveryInfo"}, - {2006, nullptr, "CanDeliverApplication"}, - {2007, nullptr, "ListContentMetaKeyToDeliverApplication"}, - {2008, nullptr, "NeedsSystemUpdateToDeliverApplication"}, - {2009, nullptr, "EstimateRequiredSize"}, - {2010, nullptr, "RequestReceiveApplication"}, - {2011, nullptr, "CommitReceiveApplication"}, - {2012, nullptr, "GetReceiveApplicationProgress"}, - {2013, nullptr, "RequestSendApplication"}, - {2014, nullptr, "GetSendApplicationProgress"}, - {2015, nullptr, "CompareSystemDeliveryInfo"}, - {2016, nullptr, "ListNotCommittedContentMeta"}, - {2017, nullptr, "CreateDownloadTask"}, - {2018, nullptr, "GetApplicationDeliveryInfoHash"}, - {2019, nullptr, "Unknown2019"}, //20.0.0+ - {2050, D<&IApplicationManagerInterface::GetApplicationRightsOnClient>, "GetApplicationRightsOnClient"}, - {2051, nullptr, "InvalidateRightsIdCache"}, - {2052, nullptr, "Unknown2052"}, //20.0.0+ - {2053, nullptr, "Unknown2053"}, //20.0.0+ - {2100, D<&IApplicationManagerInterface::GetApplicationTerminateResult>, "GetApplicationTerminateResult"}, - {2101, nullptr, "GetRawApplicationTerminateResult"}, - {2150, nullptr, "CreateRightsEnvironment"}, - {2151, nullptr, "DestroyRightsEnvironment"}, - {2152, nullptr, "ActivateRightsEnvironment"}, - {2153, nullptr, "DeactivateRightsEnvironment"}, - {2154, nullptr, "ForceActivateRightsContextForExit"}, - {2155, nullptr, "UpdateRightsEnvironmentStatus"}, - {2156, nullptr, "CreateRightsEnvironmentForMicroApplication"}, - {2160, nullptr, "AddTargetApplicationToRightsEnvironment"}, - {2161, nullptr, "SetUsersToRightsEnvironment"}, - {2170, nullptr, "GetRightsEnvironmentStatus"}, - {2171, nullptr, "GetRightsEnvironmentStatusChangedEvent"}, - {2180, nullptr, "RequestExtendRightsInRightsEnvironment"}, - {2181, nullptr, "GetResultOfExtendRightsInRightsEnvironment"}, - {2182, nullptr, "SetActiveRightsContextUsingStateToRightsEnvironment"}, - {2183, nullptr, "Unknown2183"}, //20.1.0+ - {2190, nullptr, "GetRightsEnvironmentHandleForApplication"}, - {2199, nullptr, "GetRightsEnvironmentCountForDebug"}, - {2200, nullptr, "GetGameCardApplicationCopyIdentifier"}, - {2201, nullptr, "GetInstalledApplicationCopyIdentifier"}, - {2250, nullptr, "RequestReportActiveELicence"}, - {2300, nullptr, "ListEventLog"}, - {2350, nullptr, "PerformAutoUpdateByApplicationId"}, - {2351, nullptr, "RequestNoDownloadRightsErrorResolution"}, - {2352, nullptr, "RequestResolveNoDownloadRightsError"}, - {2353, nullptr, "GetApplicationDownloadTaskInfo"}, - {2354, nullptr, "PrioritizeApplicationBackgroundTask"}, - {2355, nullptr, "PreferStorageEfficientUpdate"}, - {2356, nullptr, "RequestStorageEfficientUpdatePreferable"}, - {2357, nullptr, "EnableMultiCoreDownload"}, - {2358, nullptr, "DisableMultiCoreDownload"}, - {2359, nullptr, "IsMultiCoreDownloadEnabled"}, - {2360, nullptr, "GetApplicationDownloadTaskCount"}, //19.0.0+ - {2361, nullptr, "GetMaxApplicationDownloadTaskCount"}, //19.0.0+ - {2362, nullptr, "Unknown2362"}, //20.0.0+ - {2363, nullptr, "Unknown2363"}, //20.0.0+ - {2364, nullptr, "Unknown2364"}, //20.0.0+ - {2365, nullptr, "Unknown2365"}, //20.0.0+ - {2366, nullptr, "Unknown2366"}, //20.0.0+ - {2367, nullptr, "Unknown2367"}, //20.0.0+ - {2368, nullptr, "Unknown2368"}, //20.0.0+ - {2369, nullptr, "Unknown2369"}, //21.0.0+ - {2400, nullptr, "GetPromotionInfo"}, - {2401, nullptr, "CountPromotionInfo"}, - {2402, nullptr, "ListPromotionInfo"}, - {2403, nullptr, "ImportPromotionJsonForDebug"}, - {2404, nullptr, "ClearPromotionInfoForDebug"}, - {2500, nullptr, "ConfirmAvailableTime"}, - {2510, nullptr, "CreateApplicationResource"}, - {2511, nullptr, "GetApplicationResource"}, - {2513, nullptr, "LaunchMicroApplication"}, - {2514, nullptr, "ClearTaskOfAsyncTaskManager"}, - {2515, nullptr, "CleanupAllPlaceHolderAndFragmentsIfNoTask"}, - {2516, nullptr, "EnsureApplicationCertificate"}, - {2517, nullptr, "CreateApplicationInstance"}, - {2518, nullptr, "UpdateQualificationForDebug"}, - {2519, nullptr, "IsQualificationTransitionSupported"}, - {2520, D<&IApplicationManagerInterface::IsQualificationTransitionSupportedByProcessId>, "IsQualificationTransitionSupportedByProcessId"}, - {2521, nullptr, "GetRightsUserChangedEvent"}, - {2522, nullptr, "IsRomRedirectionAvailable"}, - {2523, nullptr, "GetProgramId"}, //17.0.0+ - {2524, nullptr, "Unknown2524"}, //19.0.0+ - {2525, nullptr, "Unknown2525"}, //20.0.0+ - {2800, nullptr, "GetApplicationIdOfPreomia"}, - {3000, nullptr, "RegisterDeviceLockKey"}, - {3001, nullptr, "UnregisterDeviceLockKey"}, - {3002, nullptr, "VerifyDeviceLockKey"}, - {3003, nullptr, "HideApplicationIcon"}, - {3004, nullptr, "ShowApplicationIcon"}, - {3005, nullptr, "HideApplicationTitle"}, - {3006, nullptr, "ShowApplicationTitle"}, - {3007, nullptr, "EnableGameCard"}, - {3008, nullptr, "DisableGameCard"}, - {3009, nullptr, "EnableLocalContentShare"}, - {3010, nullptr, "DisableLocalContentShare"}, - {3011, nullptr, "IsApplicationIconHidden"}, - {3012, nullptr, "IsApplicationTitleHidden"}, - {3013, nullptr, "IsGameCardEnabled"}, - {3014, nullptr, "IsLocalContentShareEnabled"}, - {3050, nullptr, "ListAssignELicenseTaskResult"}, - {3104, nullptr, "GetApplicationNintendoLogo"}, //18.0.0+ - {3105, nullptr, "GetApplicationStartupMovie"}, //18.0.0+ - {4000, nullptr, "Unknown4000"}, //20.0.0+ - {4004, nullptr, "Unknown4004"}, //20.0.0+ - {4006, nullptr, "Unknown4006"}, //20.0.0+ - {4007, nullptr, "Unknown4007"}, //20.0.0+ - {4008, nullptr, "Unknown4008"}, //20.0.0+ - {4009, nullptr, "Unknown4009"}, //20.0.0+ - {4010, nullptr, "Unknown4010"}, //20.0.0+ - {4011, nullptr, "Unknown4011"}, //20.0.0+ - {4012, nullptr, "Unknown4012"}, //20.0.0+ - {4013, nullptr, "Unknown4013"}, //20.0.0+ - {4015, nullptr, "Unknown4015"}, //20.0.0+ - {4017, nullptr, "Unknown4017"}, //20.0.0+ - {4019, nullptr, "Unknown4019"}, //20.0.0+ - {4020, nullptr, "Unknown4020"}, //20.0.0+ - {4021, nullptr, "Unknown4021"}, //20.0.0+ - {4022, D<&IApplicationManagerInterface::Unknown4022>, "Unknown4022"}, //20.0.0+ - {4023, D<&IApplicationManagerInterface::Unknown4023>, "Unknown4023"}, //20.0.0+ - {4024, nullptr, "Unknown4024"}, //20.0.0+ - {4025, nullptr, "Unknown4025"}, //20.0.0+ - {4026, nullptr, "Unknown4026"}, //20.0.0+ - {4027, nullptr, "Unknown4027"}, //20.0.0+ - {4028, nullptr, "Unknown4028"}, //20.0.0+ - {4029, nullptr, "Unknown4029"}, //20.0.0+ - {4030, nullptr, "Unknown4030"}, //20.0.0+ - {4031, nullptr, "Unknown4031"}, //20.0.0+ - {4032, nullptr, "Unknown4032"}, //20.0.0+ - {4033, nullptr, "Unknown4033"}, //20.0.0+ - {4034, nullptr, "Unknown4034"}, //20.0.0+ - {4035, nullptr, "Unknown4035"}, //20.0.0+ - {4037, nullptr, "Unknown4037"}, //20.0.0+ - {4038, nullptr, "Unknown4038"}, //20.0.0+ - {4039, nullptr, "Unknown4039"}, //20.0.0+ - {4040, nullptr, "Unknown4040"}, //20.0.0+ - {4041, nullptr, "Unknown4041"}, //20.0.0+ - {4042, D<&IApplicationManagerInterface::Unknown4042>, "Unknown4042"}, //20.0.0+ - {4043, nullptr, "Unknown4043"}, //20.0.0+ - {4044, nullptr, "Unknown4044"}, //20.0.0+ - {4045, nullptr, "Unknown4045"}, //20.0.0+ - {4046, nullptr, "Unknown4046"}, //20.0.0+ - {4049, nullptr, "Unknown4049"}, //20.0.0+ - {4050, nullptr, "Unknown4050"}, //20.0.0+ - {4051, nullptr, "Unknown4051"}, //20.0.0+ - {4052, nullptr, "Unknown4052"}, //20.0.0+ - {4053, D<&IApplicationManagerInterface::Unknown4053>, "Unknown4053"}, //20.0.0+ - {4054, nullptr, "Unknown4054"}, //20.0.0+ - {4055, nullptr, "Unknown4055"}, //20.0.0+ - {4056, nullptr, "Unknown4056"}, //20.0.0+ - {4057, nullptr, "Unknown4057"}, //20.0.0+ - {4058, nullptr, "Unknown4058"}, //20.0.0+ - {4059, nullptr, "Unknown4059"}, //20.0.0+ - {4060, nullptr, "Unknown4060"}, //20.0.0+ - {4061, nullptr, "Unknown4061"}, //20.0.0+ - {4062, nullptr, "Unknown4062"}, //20.0.0+ - {4063, nullptr, "Unknown4063"}, //20.0.0+ - {4064, nullptr, "Unknown4064"}, //20.0.0+ - {4065, nullptr, "Unknown4065"}, //20.0.0+ - {4066, nullptr, "Unknown4066"}, //20.0.0+ - {4067, nullptr, "Unknown4067"}, //20.0.0+ - {4068, nullptr, "Unknown4068"}, //20.0.0+ - {4069, nullptr, "Unknown4069"}, //20.0.0+ - {4070, nullptr, "Unknown4070"}, //20.0.0+ - {4071, nullptr, "Unknown4071"}, //20.0.0+ - {4072, nullptr, "Unknown4072"}, //20.0.0+ - {4073, nullptr, "Unknown4073"}, //20.0.0+ - {4074, nullptr, "Unknown4074"}, //20.0.0+ - {4075, nullptr, "Unknown4075"}, //20.0.0+ - {4076, nullptr, "Unknown4076"}, //20.0.0+ - {4077, nullptr, "Unknown4077"}, //20.0.0+ - {4078, nullptr, "Unknown4078"}, //20.0.0+ - {4079, nullptr, "Unknown4079"}, //20.0.0+ - {4080, nullptr, "Unknown4080"}, //20.0.0+ - {4081, nullptr, "Unknown4081"}, //20.0.0+ - {4083, nullptr, "Unknown4083"}, //20.0.0+ - {4084, nullptr, "Unknown4084"}, //20.0.0+ - {4085, nullptr, "Unknown4085"}, //20.0.0+ - {4086, nullptr, "Unknown4086"}, //20.0.0+ - {4087, nullptr, "Unknown4087"}, //20.0.0+ - {4088, D<&IApplicationManagerInterface::Unknown4022>, "Unknown4088"}, //20.0.0+ - {4089, nullptr, "Unknown4089"}, //20.0.0+ - {4090, nullptr, "Unknown4090"}, //20.0.0+ - {4091, nullptr, "Unknown4091"}, //20.0.0+ - {4092, nullptr, "Unknown4092"}, //20.0.0+ - {4093, nullptr, "Unknown4093"}, //20.0.0+ - {4094, nullptr, "Unknown4094"}, //20.0.0+ - {4095, nullptr, "Unknown4095"}, //20.0.0+ - {4096, nullptr, "Unknown4096"}, //20.0.0+ - {4097, nullptr, "Unknown4097"}, //20.0.0+ - {4099, nullptr, "Unknown4099"}, //21.0.0+ - {4105, D<&IApplicationManagerInterface::Unknown4105>, "Unknown4105"}, //23.0.0+ - {5000, nullptr, "Unknown5000"}, //18.0.0+ - {5001, nullptr, "Unknown5001"}, //18.0.0+ - {9999, nullptr, "GetApplicationCertificate"}, //10.0.0-10.2.0 - }; - // clang-format on - - RegisterHandlers(functions); } IApplicationManagerInterface::~IApplicationManagerInterface() = default; diff --git a/src/core/hle/service/ns/application_manager_interface.h b/src/core/hle/service/ns/application_manager_interface.h index c4ca66f319..592068823c 100644 --- a/src/core/hle/service/ns/application_manager_interface.h +++ b/src/core/hle/service/ns/application_manager_interface.h @@ -85,6 +85,7 @@ public: void PushApplicationRecord(HLERequestContext& ctx); void ListApplicationTitle(HLERequestContext& ctx); void ListApplicationIcon(HLERequestContext& ctx); + std::optional FindRequest(u32 key) override; private: KernelHelpers::ServiceContext service_context; diff --git a/src/core/hle/service/ns/application_version_interface.cpp b/src/core/hle/service/ns/application_version_interface.cpp index b89e127dbe..e1e747f6d2 100644 --- a/src/core/hle/service/ns/application_version_interface.cpp +++ b/src/core/hle/service/ns/application_version_interface.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -7,25 +10,6 @@ namespace Service::NS { IApplicationVersionInterface::IApplicationVersionInterface(Core::System& system_) : ServiceFramework{system_, "IApplicationVersionInterface"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetLaunchRequiredVersion"}, - {1, nullptr, "UpgradeLaunchRequiredVersion"}, - {35, nullptr, "UpdateVersionList"}, - {36, nullptr, "PushLaunchVersion"}, - {37, nullptr, "ListRequiredVersion"}, - {800, nullptr, "RequestVersionList"}, - {801, nullptr, "ListVersionList"}, - {802, nullptr, "RequestVersionListData"}, - {900, nullptr, "ImportAutoUpdatePolicyJsonForDebug"}, - {901, nullptr, "ListDefaultAutoUpdatePolicy"}, - {902, nullptr, "ListAutoUpdatePolicyForSpecificApplication"}, - {1000, nullptr, "PerformAutoUpdate"}, - {1001, nullptr, "ListAutoUpdateSchedule"}, - }; - // clang-format on - - RegisterHandlers(functions); } IApplicationVersionInterface::~IApplicationVersionInterface() = default; diff --git a/src/core/hle/service/ns/application_version_interface.h b/src/core/hle/service/ns/application_version_interface.h index b288cff1be..c1f7710a00 100644 --- a/src/core/hle/service/ns/application_version_interface.h +++ b/src/core/hle/service/ns/application_version_interface.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -11,6 +14,25 @@ class IApplicationVersionInterface final : public ServiceFramework FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetLaunchRequiredVersion"}, + FunctionInfo{1, nullptr, "UpgradeLaunchRequiredVersion"}, + FunctionInfo{35, nullptr, "UpdateVersionList"}, + FunctionInfo{36, nullptr, "PushLaunchVersion"}, + FunctionInfo{37, nullptr, "ListRequiredVersion"}, + FunctionInfo{800, nullptr, "RequestVersionList"}, + FunctionInfo{801, nullptr, "ListVersionList"}, + FunctionInfo{802, nullptr, "RequestVersionListData"}, + FunctionInfo{900, nullptr, "ImportAutoUpdatePolicyJsonForDebug"}, + FunctionInfo{901, nullptr, "ListDefaultAutoUpdatePolicy"}, + FunctionInfo{902, nullptr, "ListAutoUpdatePolicyForSpecificApplication"}, + FunctionInfo{1000, nullptr, "PerformAutoUpdate"}, + FunctionInfo{1001, nullptr, "ListAutoUpdateSchedule"} + ); }; } // namespace Service::NS diff --git a/src/core/hle/service/ns/async_result.cpp b/src/core/hle/service/ns/async_result.cpp index 8617280bef..d93c510141 100644 --- a/src/core/hle/service/ns/async_result.cpp +++ b/src/core/hle/service/ns/async_result.cpp @@ -8,17 +8,17 @@ namespace Service::NS { +std::optional IAsyncResult::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "Get"}, + FunctionInfo{1, D<&IAsyncResult::Cancel>, "Cancel"}, + FunctionInfo{2, nullptr, "GetErrorContext", MakeVersionGate({4,0,0})} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IAsyncResult::IAsyncResult(Core::System& system_, Service::Event* event_) : ServiceFramework{system_, "nn::ns::detail::IAsyncResult"}, event{event_} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "Get"}, - {1, D<&IAsyncResult::Cancel>, "Cancel"}, - {2, nullptr, "GetErrorContext"}, // 4.0.0+ - }; - // clang-format on - - RegisterHandlers(functions); } IAsyncResult::~IAsyncResult() = default; diff --git a/src/core/hle/service/ns/async_result.h b/src/core/hle/service/ns/async_result.h index 914ea5a42c..1cad75bf47 100644 --- a/src/core/hle/service/ns/async_result.h +++ b/src/core/hle/service/ns/async_result.h @@ -13,6 +13,7 @@ public: private: Result Cancel(); + std::optional FindRequest(u32 key) override; Service::Event* event{}; }; diff --git a/src/core/hle/service/ns/content_management_interface.cpp b/src/core/hle/service/ns/content_management_interface.cpp index 39b9cb6f70..45922ffab3 100644 --- a/src/core/hle/service/ns/content_management_interface.cpp +++ b/src/core/hle/service/ns/content_management_interface.cpp @@ -15,22 +15,6 @@ namespace Service::NS { IContentManagementInterface::IContentManagementInterface(Core::System& system_) : ServiceFramework{system_, "IContentManagementInterface"} { - // clang-format off - static const FunctionInfo functions[] = { - {11, D<&IContentManagementInterface::CalculateApplicationOccupiedSize>, "CalculateApplicationOccupiedSize"}, - {43, D<&IContentManagementInterface::CheckSdCardMountStatus>, "CheckSdCardMountStatus"}, - {47, D<&IContentManagementInterface::GetTotalSpaceSize>, "GetTotalSpaceSize"}, - {48, D<&IContentManagementInterface::GetFreeSpaceSize>, "GetFreeSpaceSize"}, - {71, D<&IContentManagementInterface::GetUnknown71>, "Unknown71"}, - {600, nullptr, "CountApplicationContentMeta"}, - {601, nullptr, "ListApplicationContentMetaStatus"}, - {605, nullptr, "ListApplicationContentMetaStatusWithRightsCheck"}, - {607, nullptr, "IsAnyApplicationRunning"}, - {608, nullptr, "Unknown608"}, //21.0.0+ - }; - // clang-format on - - RegisterHandlers(functions); } IContentManagementInterface::~IContentManagementInterface() = default; diff --git a/src/core/hle/service/ns/content_management_interface.h b/src/core/hle/service/ns/content_management_interface.h index df0c51a184..bddd044b45 100644 --- a/src/core/hle/service/ns/content_management_interface.h +++ b/src/core/hle/service/ns/content_management_interface.h @@ -24,6 +24,22 @@ public: Result GetTotalSpaceSize(Out out_total_space_size, FileSys::StorageId storage_id); Result GetFreeSpaceSize(Out out_free_space_size, FileSys::StorageId storage_id); Result GetUnknown71(Out out_value_a, Out out_value_b, u8 flag); + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{11, D<&IContentManagementInterface::CalculateApplicationOccupiedSize>, "CalculateApplicationOccupiedSize"}, + FunctionInfo{43, D<&IContentManagementInterface::CheckSdCardMountStatus>, "CheckSdCardMountStatus"}, + FunctionInfo{47, D<&IContentManagementInterface::GetTotalSpaceSize>, "GetTotalSpaceSize"}, + FunctionInfo{48, D<&IContentManagementInterface::GetFreeSpaceSize>, "GetFreeSpaceSize"}, + FunctionInfo{71, D<&IContentManagementInterface::GetUnknown71>, "Unknown71"}, + FunctionInfo{600, nullptr, "CountApplicationContentMeta"}, + FunctionInfo{601, nullptr, "ListApplicationContentMetaStatus"}, + FunctionInfo{605, nullptr, "ListApplicationContentMetaStatusWithRightsCheck"}, + FunctionInfo{607, nullptr, "IsAnyApplicationRunning"}, + FunctionInfo{608, nullptr, "Unknown608", MakeVersionGate({21,0,0})} + ); }; } // namespace Service::NS diff --git a/src/core/hle/service/ns/develop_interface.cpp b/src/core/hle/service/ns/develop_interface.cpp index 880bdbebbf..2fc41cd7dd 100644 --- a/src/core/hle/service/ns/develop_interface.cpp +++ b/src/core/hle/service/ns/develop_interface.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -6,31 +9,6 @@ namespace Service::NS { IDevelopInterface::IDevelopInterface(Core::System& system_) : ServiceFramework{system_, "ns:dev"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "LaunchProgram"}, - {1, nullptr, "TerminateProcess"}, - {2, nullptr, "TerminateProgram"}, - {4, nullptr, "GetShellEvent"}, - {5, nullptr, "GetShellEventInfo"}, - {6, nullptr, "TerminateApplication"}, - {7, nullptr, "PrepareLaunchProgramFromHost"}, - {8, nullptr, "LaunchApplicationFromHost"}, - {9, nullptr, "LaunchApplicationWithStorageIdForDevelop"}, - {10, nullptr, "IsSystemMemoryResourceLimitBoosted"}, - {11, nullptr, "GetRunningApplicationProcessIdForDevelop"}, - {12, nullptr, "SetCurrentApplicationRightsEnvironmentCanBeActiveForDevelop"}, - {13, nullptr, "CreateApplicationResourceForDevelop"}, - {14, nullptr, "IsPreomiaForDevelop"}, - {15, nullptr, "GetApplicationProgramIdFromHost"}, - {16, nullptr, "RefreshCachedDebugValues"}, - {17, nullptr, "PrepareLaunchApplicationFromHost"}, - {18, nullptr, "GetLaunchEvent"}, - {19, nullptr, "GetLaunchResult"}, - }; - // clang-format on - - RegisterHandlers(functions); } IDevelopInterface::~IDevelopInterface() = default; diff --git a/src/core/hle/service/ns/develop_interface.h b/src/core/hle/service/ns/develop_interface.h index a9f81ccd60..55e54fa38d 100644 --- a/src/core/hle/service/ns/develop_interface.h +++ b/src/core/hle/service/ns/develop_interface.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -11,6 +14,31 @@ class IDevelopInterface final : public ServiceFramework { public: explicit IDevelopInterface(Core::System& system_); ~IDevelopInterface() override; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "LaunchProgram"}, + FunctionInfo{1, nullptr, "TerminateProcess"}, + FunctionInfo{2, nullptr, "TerminateProgram"}, + FunctionInfo{4, nullptr, "GetShellEvent"}, + FunctionInfo{5, nullptr, "GetShellEventInfo"}, + FunctionInfo{6, nullptr, "TerminateApplication"}, + FunctionInfo{7, nullptr, "PrepareLaunchProgramFromHost"}, + FunctionInfo{8, nullptr, "LaunchApplicationFromHost"}, + FunctionInfo{9, nullptr, "LaunchApplicationWithStorageIdForDevelop"}, + FunctionInfo{10, nullptr, "IsSystemMemoryResourceLimitBoosted"}, + FunctionInfo{11, nullptr, "GetRunningApplicationProcessIdForDevelop"}, + FunctionInfo{12, nullptr, "SetCurrentApplicationRightsEnvironmentCanBeActiveForDevelop"}, + FunctionInfo{13, nullptr, "CreateApplicationResourceForDevelop"}, + FunctionInfo{14, nullptr, "IsPreomiaForDevelop"}, + FunctionInfo{15, nullptr, "GetApplicationProgramIdFromHost"}, + FunctionInfo{16, nullptr, "RefreshCachedDebugValues"}, + FunctionInfo{17, nullptr, "PrepareLaunchApplicationFromHost"}, + FunctionInfo{18, nullptr, "GetLaunchEvent"}, + FunctionInfo{19, nullptr, "GetLaunchResult"} + ); }; } // namespace Service::NS diff --git a/src/core/hle/service/ns/document_interface.cpp b/src/core/hle/service/ns/document_interface.cpp index 51a1e46c0d..f9a1e2267a 100644 --- a/src/core/hle/service/ns/document_interface.cpp +++ b/src/core/hle/service/ns/document_interface.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -9,15 +12,6 @@ namespace Service::NS { IDocumentInterface::IDocumentInterface(Core::System& system_) : ServiceFramework{system_, "IDocumentInterface"} { - // clang-format off - static const FunctionInfo functions[] = { - {21, nullptr, "GetApplicationContentPath"}, - {23, D<&IDocumentInterface::ResolveApplicationContentPath>, "ResolveApplicationContentPath"}, - {92, D<&IDocumentInterface::GetRunningApplicationProgramId>, "GetRunningApplicationProgramId"}, - }; - // clang-format on - - RegisterHandlers(functions); } IDocumentInterface::~IDocumentInterface() = default; diff --git a/src/core/hle/service/ns/document_interface.h b/src/core/hle/service/ns/document_interface.h index cd461652cf..43a194c3e6 100644 --- a/src/core/hle/service/ns/document_interface.h +++ b/src/core/hle/service/ns/document_interface.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -17,6 +20,15 @@ public: private: Result ResolveApplicationContentPath(ContentPath content_path); Result GetRunningApplicationProgramId(Out out_program_id, u64 caller_program_id); + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{21, nullptr, "GetApplicationContentPath"}, + FunctionInfo{23, D<&IDocumentInterface::ResolveApplicationContentPath>, "ResolveApplicationContentPath"}, + FunctionInfo{92, D<&IDocumentInterface::GetRunningApplicationProgramId>, "GetRunningApplicationProgramId"} + ); }; } // namespace Service::NS diff --git a/src/core/hle/service/ns/download_task_interface.cpp b/src/core/hle/service/ns/download_task_interface.cpp index 62dc7f1874..9fe6ca512f 100644 --- a/src/core/hle/service/ns/download_task_interface.cpp +++ b/src/core/hle/service/ns/download_task_interface.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -8,21 +11,6 @@ namespace Service::NS { IDownloadTaskInterface::IDownloadTaskInterface(Core::System& system_) : ServiceFramework{system_, "IDownloadTaskInterface"} { - // clang-format off - static const FunctionInfo functions[] = { - {701, nullptr, "ClearTaskStatusList"}, - {702, nullptr, "RequestDownloadTaskList"}, - {703, nullptr, "RequestEnsureDownloadTask"}, - {704, nullptr, "ListDownloadTaskStatus"}, - {705, nullptr, "RequestDownloadTaskListData"}, - {706, nullptr, "TryCommitCurrentApplicationDownloadTask"}, - {707, D<&IDownloadTaskInterface::EnableAutoCommit>, "EnableAutoCommit"}, - {708, D<&IDownloadTaskInterface::DisableAutoCommit>, "DisableAutoCommit"}, - {709, nullptr, "TriggerDynamicCommitEvent"}, - }; - // clang-format on - - RegisterHandlers(functions); } IDownloadTaskInterface::~IDownloadTaskInterface() = default; diff --git a/src/core/hle/service/ns/download_task_interface.h b/src/core/hle/service/ns/download_task_interface.h index b1cb69cb86..0fd2bacd42 100644 --- a/src/core/hle/service/ns/download_task_interface.h +++ b/src/core/hle/service/ns/download_task_interface.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -15,6 +18,21 @@ public: private: Result EnableAutoCommit(); Result DisableAutoCommit(); + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{701, nullptr, "ClearTaskStatusList"}, + FunctionInfo{702, nullptr, "RequestDownloadTaskList"}, + FunctionInfo{703, nullptr, "RequestEnsureDownloadTask"}, + FunctionInfo{704, nullptr, "ListDownloadTaskStatus"}, + FunctionInfo{705, nullptr, "RequestDownloadTaskListData"}, + FunctionInfo{706, nullptr, "TryCommitCurrentApplicationDownloadTask"}, + FunctionInfo{707, D<&IDownloadTaskInterface::EnableAutoCommit>, "EnableAutoCommit"}, + FunctionInfo{708, D<&IDownloadTaskInterface::DisableAutoCommit>, "DisableAutoCommit"}, + FunctionInfo{709, nullptr, "TriggerDynamicCommitEvent"} + ); }; } // namespace Service::NS diff --git a/src/core/hle/service/ns/dynamic_rights_interface.cpp b/src/core/hle/service/ns/dynamic_rights_interface.cpp index 0301085670..951ef4c4b2 100644 --- a/src/core/hle/service/ns/dynamic_rights_interface.cpp +++ b/src/core/hle/service/ns/dynamic_rights_interface.cpp @@ -9,43 +9,43 @@ namespace Service::NS { +std::optional IDynamicRightsInterface::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "RequestApplicationRightsOnServer"}, + FunctionInfo{1, nullptr, "RequestAssignRights"}, + FunctionInfo{4, nullptr, "DeprecatedRequestAssignRightsToResume"}, + FunctionInfo{5, D<&IDynamicRightsInterface::VerifyActivatedRightsOwners>, "VerifyActivatedRightsOwners"}, + FunctionInfo{6, nullptr, "DeprecatedGetApplicationRightsStatus"}, + FunctionInfo{7, nullptr, "RequestPrefetchForDynamicRights"}, + FunctionInfo{8, nullptr, "GetDynamicRightsState"}, + FunctionInfo{9, nullptr, "RequestApplicationRightsOnServerToResume"}, + FunctionInfo{10, nullptr, "RequestAssignRightsToResume"}, + FunctionInfo{11, nullptr, "GetActivatedRightsUsers"}, + FunctionInfo{12, nullptr, "GetApplicationRightsStatus"}, + FunctionInfo{13, D<&IDynamicRightsInterface::GetRunningApplicationStatus>, "GetRunningApplicationStatus"}, + FunctionInfo{14, nullptr, "SelectApplicationLicense"}, + FunctionInfo{15, nullptr, "RequestContentsAuthorizationToken"}, + FunctionInfo{16, nullptr, "QualifyUser"}, + FunctionInfo{17, nullptr, "QualifyUserWithProcessId"}, + FunctionInfo{18, D<&IDynamicRightsInterface::NotifyApplicationRightsCheckStart>, "NotifyApplicationRightsCheckStart"}, + FunctionInfo{19, nullptr, "UpdateUserList"}, + FunctionInfo{20, nullptr, "IsRightsLostUser"}, + FunctionInfo{21, nullptr, "SetRequiredAddOnContentsOnContentsAvailabilityTransition"}, + FunctionInfo{22, nullptr, "GetLimitedApplicationLicense"}, + FunctionInfo{23, nullptr, "GetLimitedApplicationLicenseUpgradableEvent"}, + FunctionInfo{24, nullptr, "NotifyLimitedApplicationLicenseUpgradableEventForDebug"}, + FunctionInfo{25, nullptr, "RequestProceedDynamicRightsState"}, + FunctionInfo{26, D<&IDynamicRightsInterface::HasAccountRestrictedRightsInRunningApplications>, "HasAccountRestrictedRightsInRunningApplications"}, + FunctionInfo{27, nullptr, "Unknown27", MakeVersionGate({20,0,0})}, + FunctionInfo{28, nullptr, "Unknown28", MakeVersionGate({20,0,0})}, + FunctionInfo{29, nullptr, "Unknown29", MakeVersionGate({21,0,0})}, + FunctionInfo{30, nullptr, "Unknown30", MakeVersionGate({21,0,0})} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IDynamicRightsInterface::IDynamicRightsInterface(Core::System& system_) : ServiceFramework{system_, "DynamicRightsInterface"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "RequestApplicationRightsOnServer"}, - {1, nullptr, "RequestAssignRights"}, - {4, nullptr, "DeprecatedRequestAssignRightsToResume"}, - {5, D<&IDynamicRightsInterface::VerifyActivatedRightsOwners>, "VerifyActivatedRightsOwners"}, - {6, nullptr, "DeprecatedGetApplicationRightsStatus"}, - {7, nullptr, "RequestPrefetchForDynamicRights"}, - {8, nullptr, "GetDynamicRightsState"}, - {9, nullptr, "RequestApplicationRightsOnServerToResume"}, - {10, nullptr, "RequestAssignRightsToResume"}, - {11, nullptr, "GetActivatedRightsUsers"}, - {12, nullptr, "GetApplicationRightsStatus"}, - {13, D<&IDynamicRightsInterface::GetRunningApplicationStatus>, "GetRunningApplicationStatus"}, - {14, nullptr, "SelectApplicationLicense"}, - {15, nullptr, "RequestContentsAuthorizationToken"}, - {16, nullptr, "QualifyUser"}, - {17, nullptr, "QualifyUserWithProcessId"}, - {18, D<&IDynamicRightsInterface::NotifyApplicationRightsCheckStart>, "NotifyApplicationRightsCheckStart"}, - {19, nullptr, "UpdateUserList"}, - {20, nullptr, "IsRightsLostUser"}, - {21, nullptr, "SetRequiredAddOnContentsOnContentsAvailabilityTransition"}, - {22, nullptr, "GetLimitedApplicationLicense"}, - {23, nullptr, "GetLimitedApplicationLicenseUpgradableEvent"}, - {24, nullptr, "NotifyLimitedApplicationLicenseUpgradableEventForDebug"}, - {25, nullptr, "RequestProceedDynamicRightsState"}, - {26, D<&IDynamicRightsInterface::HasAccountRestrictedRightsInRunningApplications>, "HasAccountRestrictedRightsInRunningApplications"}, - {27, nullptr, "Unknown27"}, //20.0.0+ - {28, nullptr, "Unknown28"}, //20.0.0+ - {29, nullptr, "Unknown29"}, //21.0.0+ - {30, nullptr, "Unknown30"}, //21.0.0+ - }; - // clang-format on - - RegisterHandlers(functions); } IDynamicRightsInterface::~IDynamicRightsInterface() = default; diff --git a/src/core/hle/service/ns/dynamic_rights_interface.h b/src/core/hle/service/ns/dynamic_rights_interface.h index c3270aee05..e8a1d81491 100644 --- a/src/core/hle/service/ns/dynamic_rights_interface.h +++ b/src/core/hle/service/ns/dynamic_rights_interface.h @@ -21,6 +21,8 @@ private: Result GetRunningApplicationStatus(Out out_status, u64 rights_handle); Result VerifyActivatedRightsOwners(u64 rights_handle); Result HasAccountRestrictedRightsInRunningApplications(Out out_is_restricted); + + std::optional FindRequest(u32 key) override; }; } // namespace Service::NS diff --git a/src/core/hle/service/ns/ecommerce_interface.cpp b/src/core/hle/service/ns/ecommerce_interface.cpp index 76fc425f0c..5687d09a02 100644 --- a/src/core/hle/service/ns/ecommerce_interface.cpp +++ b/src/core/hle/service/ns/ecommerce_interface.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -7,19 +10,6 @@ namespace Service::NS { IECommerceInterface::IECommerceInterface(Core::System& system_) : ServiceFramework{system_, "IECommerceInterface"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "RequestLinkDevice"}, - {1, nullptr, "RequestCleanupAllPreInstalledApplications"}, - {2, nullptr, "RequestCleanupPreInstalledApplication"}, - {3, nullptr, "RequestSyncRights"}, - {4, nullptr, "RequestUnlinkDevice"}, - {5, nullptr, "RequestRevokeAllELicense"}, - {6, nullptr, "RequestSyncRightsBasedOnAssignedELicenses"}, - }; - // clang-format on - - RegisterHandlers(functions); } IECommerceInterface::~IECommerceInterface() = default; diff --git a/src/core/hle/service/ns/ecommerce_interface.h b/src/core/hle/service/ns/ecommerce_interface.h index 4352101f4a..d020ff5ef8 100644 --- a/src/core/hle/service/ns/ecommerce_interface.h +++ b/src/core/hle/service/ns/ecommerce_interface.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -11,6 +14,19 @@ class IECommerceInterface final : public ServiceFramework { public: explicit IECommerceInterface(Core::System& system_); ~IECommerceInterface() override; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "RequestLinkDevice"}, + FunctionInfo{1, nullptr, "RequestCleanupAllPreInstalledApplications"}, + FunctionInfo{2, nullptr, "RequestCleanupPreInstalledApplication"}, + FunctionInfo{3, nullptr, "RequestSyncRights"}, + FunctionInfo{4, nullptr, "RequestUnlinkDevice"}, + FunctionInfo{5, nullptr, "RequestRevokeAllELicense"}, + FunctionInfo{6, nullptr, "RequestSyncRightsBasedOnAssignedELicenses"} + ); }; } // namespace Service::NS diff --git a/src/core/hle/service/ns/factory_reset_interface.cpp b/src/core/hle/service/ns/factory_reset_interface.cpp index fd5cf7e1fd..1fc6edcc9b 100644 --- a/src/core/hle/service/ns/factory_reset_interface.cpp +++ b/src/core/hle/service/ns/factory_reset_interface.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -5,21 +8,21 @@ namespace Service::NS { +std::optional IFactoryResetInterface::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{100, nullptr, "ResetToFactorySettings"}, + FunctionInfo{101, nullptr, "ResetToFactorySettingsWithoutUserSaveData"}, + FunctionInfo{102, nullptr, "ResetToFactorySettingsForRefurbishment"}, + FunctionInfo{103, nullptr, "ResetToFactorySettingsWithPlatformRegion"}, + FunctionInfo{104, nullptr, "ResetToFactorySettingsWithPlatformRegionAuthentication"}, + FunctionInfo{105, nullptr, "RequestResetToFactorySettingsSecurely"}, + FunctionInfo{106, nullptr, "RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IFactoryResetInterface::IFactoryResetInterface(Core::System& system_) : ServiceFramework{system_, "IFactoryResetInterface"} { - // clang-format off - static const FunctionInfo functions[] = { - {100, nullptr, "ResetToFactorySettings"}, - {101, nullptr, "ResetToFactorySettingsWithoutUserSaveData"}, - {102, nullptr, "ResetToFactorySettingsForRefurbishment"}, - {103, nullptr, "ResetToFactorySettingsWithPlatformRegion"}, - {104, nullptr, "ResetToFactorySettingsWithPlatformRegionAuthentication"}, - {105, nullptr, "RequestResetToFactorySettingsSecurely"}, - {106, nullptr, "RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely"}, - }; - // clang-format on - - RegisterHandlers(functions); } IFactoryResetInterface::~IFactoryResetInterface() = default; diff --git a/src/core/hle/service/ns/factory_reset_interface.h b/src/core/hle/service/ns/factory_reset_interface.h index 50d1251239..3d5700fb71 100644 --- a/src/core/hle/service/ns/factory_reset_interface.h +++ b/src/core/hle/service/ns/factory_reset_interface.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -11,6 +14,7 @@ class IFactoryResetInterface final : public ServiceFramework FindRequest(u32 key) override; }; } // namespace Service::NS diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index fe057422ce..ff1654517b 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp @@ -19,25 +19,25 @@ namespace Service::NS { class INotifyService final : public ServiceFramework { public: - explicit INotifyService(Core::System& system_) : ServiceFramework{system_, "pdm:ntfy"} { - // clang-format off - static const FunctionInfo functions[] = { - { 0, nullptr, "NotifyAppletEvent" }, - { 2, nullptr, "NotifyOperationModeChangeEvent" }, - { 3, nullptr, "NotifyPowerStateChangeEvent" }, - { 4, nullptr, "NotifyClearAllEvent" }, - { 5, nullptr, "NotifyEventForDebug" }, - { 6, nullptr, "SuspendUserAccountEventService" }, - { 7, nullptr, "ResumeUserAccountEventService" }, - { 8, nullptr, "NotifyLibraryAppletEvent" }, - { 9, nullptr, "Cmd9" }, - { 20, nullptr, "Cmd20" }, - { 30, nullptr, "Cmd30" }, - { 100, nullptr, "Cmd100" }, - { 101, nullptr, "Cmd101" }, - }; - // clang-format on - RegisterHandlers(functions); + explicit INotifyService(Core::System& system_) : ServiceFramework{system_, "pdm:ntfy"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "NotifyAppletEvent" }, + FunctionInfo{2, nullptr, "NotifyOperationModeChangeEvent" }, + FunctionInfo{3, nullptr, "NotifyPowerStateChangeEvent" }, + FunctionInfo{4, nullptr, "NotifyClearAllEvent" }, + FunctionInfo{5, nullptr, "NotifyEventForDebug" }, + FunctionInfo{6, nullptr, "SuspendUserAccountEventService" }, + FunctionInfo{7, nullptr, "ResumeUserAccountEventService" }, + FunctionInfo{8, nullptr, "NotifyLibraryAppletEvent" }, + FunctionInfo{9, nullptr, "Cmd9" }, + FunctionInfo{20, nullptr, "Cmd20" }, + FunctionInfo{30, nullptr, "Cmd30" }, + FunctionInfo{100, nullptr, "Cmd100" }, + FunctionInfo{101, nullptr, "Cmd101" } + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; @@ -45,18 +45,10 @@ class IVulnerabilityManagerInterface final : public ServiceFramework { public: explicit IVulnerabilityManagerInterface(Core::System& system_) - : ServiceFramework{system_, "ns:vm"} { - // clang-format off - static const FunctionInfo functions[] = { - {1200, D<&IVulnerabilityManagerInterface::NeedsUpdateVulnerability>, "NeedsUpdateVulnerability"}, - {1201, nullptr, "UpdateSafeSystemVersionForDebug"}, - {1202, nullptr, "GetSafeSystemVersion"}, - {3100, D<&IVulnerabilityManagerInterface::GetSafeSystemVersionCheckInfo>, "GetSafeSystemVersionCheckInfo"}, - {3101, nullptr, "RequestUpdateSafeSystemVersionCheckInfo"}, - {3102, D<&IVulnerabilityManagerInterface::ResetSafeSystemVersionCheckInfo>, "ResetSafeSystemVersionCheckInfo"}, - }; - // clang-format on - RegisterHandlers(functions); + : ServiceFramework{system_, "ns:vm"} {} + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } ~IVulnerabilityManagerInterface() override = default; @@ -76,6 +68,15 @@ public: LOG_WARNING(Service_NS, "(STUBBED)"); R_SUCCEED(); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{1200, D<&IVulnerabilityManagerInterface::NeedsUpdateVulnerability>, "NeedsUpdateVulnerability"}, + FunctionInfo{1201, nullptr, "UpdateSafeSystemVersionForDebug"}, + FunctionInfo{1202, nullptr, "GetSafeSystemVersion"}, + FunctionInfo{3100, D<&IVulnerabilityManagerInterface::GetSafeSystemVersionCheckInfo>, "GetSafeSystemVersionCheckInfo"}, + FunctionInfo{3101, nullptr, "RequestUpdateSafeSystemVersionCheckInfo"}, + FunctionInfo{3102, D<&IVulnerabilityManagerInterface::ResetSafeSystemVersionCheckInfo>, "ResetSafeSystemVersionCheckInfo"} + ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/ns/platform_service_manager.cpp b/src/core/hle/service/ns/platform_service_manager.cpp index bf93a2edfa..dea6cb5c16 100644 --- a/src/core/hle/service/ns/platform_service_manager.cpp +++ b/src/core/hle/service/ns/platform_service_manager.cpp @@ -27,6 +27,28 @@ namespace Service::NS { +std::optional IPlatformServiceManager::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IPlatformServiceManager::RequestLoad>, "RequestLoad"}, + FunctionInfo{1, D<&IPlatformServiceManager::GetLoadState>, "GetLoadState"}, + FunctionInfo{2, D<&IPlatformServiceManager::GetSize>, "GetSize"}, + FunctionInfo{3, D<&IPlatformServiceManager::GetSharedMemoryAddressOffset>, "GetSharedMemoryAddressOffset"}, + FunctionInfo{4, D<&IPlatformServiceManager::GetSharedMemoryNativeHandle>, "GetSharedMemoryNativeHandle"}, + FunctionInfo{5, D<&IPlatformServiceManager::GetSharedFontInOrderOfPriority>, "GetSharedFontInOrderOfPriority"}, + FunctionInfo{6, D<&IPlatformServiceManager::GetSharedFontInOrderOfPriority>, "GetSharedFontInOrderOfPriorityForSystem"}, + FunctionInfo{100, nullptr, "RequestApplicationFunctionAuthorization"}, + FunctionInfo{101, nullptr, "RequestApplicationFunctionAuthorizationByProcessId"}, + FunctionInfo{102, nullptr, "RequestApplicationFunctionAuthorizationByApplicationId"}, + FunctionInfo{103, nullptr, "RefreshApplicationFunctionBlackListDebugRecord"}, + FunctionInfo{104, nullptr, "RequestApplicationFunctionAuthorizationByProgramId"}, + FunctionInfo{105, nullptr, "GetFunctionBlackListSystemVersionToAuthorize"}, + FunctionInfo{106, nullptr, "GetFunctionBlackListVersion"}, + FunctionInfo{1000, nullptr, "LoadNgWordDataForPlatformRegionChina"}, + FunctionInfo{1001, nullptr, "GetNgWordDataSizeForPlatformRegionChina"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + struct FontRegion { u32 offset; u32 size; @@ -89,28 +111,6 @@ struct IPlatformServiceManager::Impl { IPlatformServiceManager::IPlatformServiceManager(Core::System& system_, const char* service_name_) : ServiceFramework{system_, service_name_}, impl{std::make_unique()} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IPlatformServiceManager::RequestLoad>, "RequestLoad"}, - {1, D<&IPlatformServiceManager::GetLoadState>, "GetLoadState"}, - {2, D<&IPlatformServiceManager::GetSize>, "GetSize"}, - {3, D<&IPlatformServiceManager::GetSharedMemoryAddressOffset>, "GetSharedMemoryAddressOffset"}, - {4, D<&IPlatformServiceManager::GetSharedMemoryNativeHandle>, "GetSharedMemoryNativeHandle"}, - {5, D<&IPlatformServiceManager::GetSharedFontInOrderOfPriority>, "GetSharedFontInOrderOfPriority"}, - {6, D<&IPlatformServiceManager::GetSharedFontInOrderOfPriority>, "GetSharedFontInOrderOfPriorityForSystem"}, - {100, nullptr, "RequestApplicationFunctionAuthorization"}, - {101, nullptr, "RequestApplicationFunctionAuthorizationByProcessId"}, - {102, nullptr, "RequestApplicationFunctionAuthorizationByApplicationId"}, - {103, nullptr, "RefreshApplicationFunctionBlackListDebugRecord"}, - {104, nullptr, "RequestApplicationFunctionAuthorizationByProgramId"}, - {105, nullptr, "GetFunctionBlackListSystemVersionToAuthorize"}, - {106, nullptr, "GetFunctionBlackListVersion"}, - {1000, nullptr, "LoadNgWordDataForPlatformRegionChina"}, - {1001, nullptr, "GetNgWordDataSizeForPlatformRegionChina"}, - }; - // clang-format on - RegisterHandlers(functions); - auto& fsc = system.GetFileSystemController(); // Attempt to load shared font data from disk diff --git a/src/core/hle/service/ns/platform_service_manager.h b/src/core/hle/service/ns/platform_service_manager.h index b82c385a6c..fb99a441f5 100644 --- a/src/core/hle/service/ns/platform_service_manager.h +++ b/src/core/hle/service/ns/platform_service_manager.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -65,11 +68,12 @@ private: Result GetSharedMemoryNativeHandle( OutCopyHandle out_shared_memory_native_handle); Result GetSharedFontInOrderOfPriority(OutArray out_font_codes, - OutArray out_font_offsets, - OutArray out_font_sizes, - Out out_fonts_are_loaded, Out out_font_count, - Set::LanguageCode language_code); + OutArray out_font_offsets, + OutArray out_font_sizes, + Out out_fonts_are_loaded, Out out_font_count, + Set::LanguageCode language_code); + std::optional FindRequest(u32 key) override; struct Impl; std::unique_ptr impl; }; diff --git a/src/core/hle/service/ns/query_service.cpp b/src/core/hle/service/ns/query_service.cpp index d22de1d169..13a1f33866 100644 --- a/src/core/hle/service/ns/query_service.cpp +++ b/src/core/hle/service/ns/query_service.cpp @@ -14,40 +14,40 @@ namespace Service::NS { +std::optional IQueryService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "QueryAppletEvent"}, + FunctionInfo{1, nullptr, "QueryPlayStatistics"}, + FunctionInfo{2, nullptr, "QueryPlayStatisticsByUserAccountId"}, + FunctionInfo{3, nullptr, "QueryPlayStatisticsByNetworkServiceAccountId"}, + FunctionInfo{4, nullptr, "QueryPlayStatisticsByApplicationId"}, + FunctionInfo{5, D<&IQueryService::QueryPlayStatisticsByApplicationIdAndUserAccountId>, "QueryPlayStatisticsByApplicationIdAndUserAccountId"}, + FunctionInfo{6, nullptr, "QueryPlayStatisticsByApplicationIdAndNetworkServiceAccountId"}, + FunctionInfo{7, nullptr, "QueryLastPlayTimeV0"}, + FunctionInfo{8, nullptr, "QueryPlayEvent"}, + FunctionInfo{9, nullptr, "GetAvailablePlayEventRange"}, + FunctionInfo{10, nullptr, "QueryAccountEvent"}, + FunctionInfo{11, nullptr, "QueryAccountPlayEvent"}, + FunctionInfo{12, nullptr, "GetAvailableAccountPlayEventRange"}, + FunctionInfo{13, nullptr, "QueryApplicationPlayStatisticsForSystemV0"}, + FunctionInfo{14, nullptr, "QueryRecentlyPlayedApplication"}, + FunctionInfo{15, nullptr, "GetRecentlyPlayedApplicationUpdateEvent"}, + FunctionInfo{16, nullptr, "QueryApplicationPlayStatisticsByUserAccountIdForSystemV0"}, + FunctionInfo{17, D<&IQueryService::QueryLastPlayTime>, "QueryLastPlayTime"}, + FunctionInfo{18, D<&IQueryService::QueryApplicationPlayStatisticsForSystem>, "QueryApplicationPlayStatisticsForSystem"}, + FunctionInfo{19, D<&IQueryService::QueryApplicationPlayStatisticsByUserAccountIdForSystem>, "QueryApplicationPlayStatisticsByUserAccountIdForSystem"}, + FunctionInfo{30, nullptr, "Cmd30" }, + FunctionInfo{31, nullptr, "Cmd31" }, + FunctionInfo{100, nullptr, "Cmd100" }, + FunctionInfo{110, nullptr, "Cmd110" }, + FunctionInfo{118, nullptr, "Cmd118" }, + FunctionInfo{119, nullptr, "Cmd119" } + ); + return HandlerTableGenerateWithFind(key, functions); +} + IQueryService::IQueryService(Core::System& system_) : ServiceFramework{system_, "pdm:qry"}, play_time_manager{std::make_unique()} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "QueryAppletEvent"}, - {1, nullptr, "QueryPlayStatistics"}, - {2, nullptr, "QueryPlayStatisticsByUserAccountId"}, - {3, nullptr, "QueryPlayStatisticsByNetworkServiceAccountId"}, - {4, nullptr, "QueryPlayStatisticsByApplicationId"}, - {5, D<&IQueryService::QueryPlayStatisticsByApplicationIdAndUserAccountId>, "QueryPlayStatisticsByApplicationIdAndUserAccountId"}, - {6, nullptr, "QueryPlayStatisticsByApplicationIdAndNetworkServiceAccountId"}, - {7, nullptr, "QueryLastPlayTimeV0"}, - {8, nullptr, "QueryPlayEvent"}, - {9, nullptr, "GetAvailablePlayEventRange"}, - {10, nullptr, "QueryAccountEvent"}, - {11, nullptr, "QueryAccountPlayEvent"}, - {12, nullptr, "GetAvailableAccountPlayEventRange"}, - {13, nullptr, "QueryApplicationPlayStatisticsForSystemV0"}, - {14, nullptr, "QueryRecentlyPlayedApplication"}, - {15, nullptr, "GetRecentlyPlayedApplicationUpdateEvent"}, - {16, nullptr, "QueryApplicationPlayStatisticsByUserAccountIdForSystemV0"}, - {17, D<&IQueryService::QueryLastPlayTime>, "QueryLastPlayTime"}, - {18, D<&IQueryService::QueryApplicationPlayStatisticsForSystem>, "QueryApplicationPlayStatisticsForSystem"}, - {19, D<&IQueryService::QueryApplicationPlayStatisticsByUserAccountIdForSystem>, "QueryApplicationPlayStatisticsByUserAccountIdForSystem"}, - { 30, nullptr, "Cmd30" }, - { 31, nullptr, "Cmd31" }, - { 100, nullptr, "Cmd100" }, - { 110, nullptr, "Cmd110" }, - { 118, nullptr, "Cmd118" }, - { 119, nullptr, "Cmd119" }, - }; - // clang-format on - - RegisterHandlers(functions); } IQueryService::~IQueryService() = default; diff --git a/src/core/hle/service/ns/query_service.h b/src/core/hle/service/ns/query_service.h index f5c0ae1058..08267d3165 100644 --- a/src/core/hle/service/ns/query_service.h +++ b/src/core/hle/service/ns/query_service.h @@ -62,6 +62,7 @@ private: OutArray out_stats, InArray application_ids); + std::optional FindRequest(u32 key) override; std::unique_ptr play_time_manager; }; diff --git a/src/core/hle/service/ns/read_only_application_control_data_interface.cpp b/src/core/hle/service/ns/read_only_application_control_data_interface.cpp index 1359cdbb95..c6cd822d24 100644 --- a/src/core/hle/service/ns/read_only_application_control_data_interface.cpp +++ b/src/core/hle/service/ns/read_only_application_control_data_interface.cpp @@ -73,6 +73,21 @@ void SanitizeJPEGImageSize(std::vector& image) { } // namespace +std::optional IReadOnlyApplicationControlDataInterface::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IReadOnlyApplicationControlDataInterface::GetApplicationControlData>, "GetApplicationControlData"}, + FunctionInfo{1, D<&IReadOnlyApplicationControlDataInterface::GetApplicationDesiredLanguage>, "GetApplicationDesiredLanguage"}, + FunctionInfo{2, D<&IReadOnlyApplicationControlDataInterface::ConvertApplicationLanguageToLanguageCode>, "ConvertApplicationLanguageToLanguageCode"}, + FunctionInfo{3, nullptr, "ConvertLanguageCodeToApplicationLanguage"}, + FunctionInfo{4, nullptr, "SelectApplicationDesiredLanguage"}, + FunctionInfo{5, D<&IReadOnlyApplicationControlDataInterface::GetApplicationControlData2>, "GetApplicationControlData"}, + FunctionInfo{10, &IReadOnlyApplicationControlDataInterface::ListApplicationIcon, "ListApplicationIcon"}, + FunctionInfo{13, &IReadOnlyApplicationControlDataInterface::ListApplicationTitle, "ListApplicationTitle"}, + FunctionInfo{19, D<&IReadOnlyApplicationControlDataInterface::GetApplicationControlData3>, "GetApplicationControlData"}, + FunctionInfo{23, D<&IReadOnlyApplicationControlDataInterface::GetApplicationControlData3>, "GetApplicationControlData", MakeVersionGate({23,0,0})} + ); + return HandlerTableGenerateWithFind(key, functions); +} // IAsyncValue implementation for ListApplicationTitle // https://switchbrew.org/wiki/NS_services#ListApplicationTitle @@ -84,13 +99,6 @@ public: , data_offset{offset} , data_size{size} { - static const FunctionInfo functions[] = { - {0, D<&IAsyncValue::GetSize>, "GetSize"}, - {1, D<&IAsyncValue::Get>, "Get"}, - {2, D<&IAsyncValue::Cancel>, "Cancel"}, - {3, D<&IAsyncValue::GetErrorContext>, "GetErrorContext"}, - }; - RegisterHandlers(functions); completion_event = service_context.CreateEvent("IAsyncValue:Completion"); completion_event->GetReadableEvent().Signal(system.Kernel()); } @@ -122,6 +130,16 @@ private: LOG_DEBUG(Service_NS, "called"); R_SUCCEED(); } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IAsyncValue::GetSize>, "GetSize"}, + FunctionInfo{1, D<&IAsyncValue::Get>, "Get"}, + FunctionInfo{2, D<&IAsyncValue::Cancel>, "Cancel"}, + FunctionInfo{3, D<&IAsyncValue::GetErrorContext>, "GetErrorContext"} + ); KernelHelpers::ServiceContext service_context; Kernel::KEvent* completion_event{}; s32 data_offset; @@ -131,22 +149,6 @@ private: IReadOnlyApplicationControlDataInterface::IReadOnlyApplicationControlDataInterface( Core::System& system_) : ServiceFramework{system_, "IReadOnlyApplicationControlDataInterface"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IReadOnlyApplicationControlDataInterface::GetApplicationControlData>, "GetApplicationControlData"}, - {1, D<&IReadOnlyApplicationControlDataInterface::GetApplicationDesiredLanguage>, "GetApplicationDesiredLanguage"}, - {2, D<&IReadOnlyApplicationControlDataInterface::ConvertApplicationLanguageToLanguageCode>, "ConvertApplicationLanguageToLanguageCode"}, - {3, nullptr, "ConvertLanguageCodeToApplicationLanguage"}, - {4, nullptr, "SelectApplicationDesiredLanguage"}, - {5, D<&IReadOnlyApplicationControlDataInterface::GetApplicationControlData2>, "GetApplicationControlData"}, - {10, &IReadOnlyApplicationControlDataInterface::ListApplicationIcon, "ListApplicationIcon"}, - {13, &IReadOnlyApplicationControlDataInterface::ListApplicationTitle, "ListApplicationTitle"}, - {19, D<&IReadOnlyApplicationControlDataInterface::GetApplicationControlData3>, "GetApplicationControlData"}, - {23, D<&IReadOnlyApplicationControlDataInterface::GetApplicationControlData3>, "GetApplicationControlData"}, //23.0.0+ - }; - // clang-format on - - RegisterHandlers(functions); } IReadOnlyApplicationControlDataInterface::~IReadOnlyApplicationControlDataInterface() = default; diff --git a/src/core/hle/service/ns/read_only_application_control_data_interface.h b/src/core/hle/service/ns/read_only_application_control_data_interface.h index a4a285151a..3f68029583 100644 --- a/src/core/hle/service/ns/read_only_application_control_data_interface.h +++ b/src/core/hle/service/ns/read_only_application_control_data_interface.h @@ -45,6 +45,8 @@ public: u8 flag1, u8 flag2, u64 application_id); + + std::optional FindRequest(u32 key) override; }; } // namespace Service::NS diff --git a/src/core/hle/service/ns/read_only_application_record_interface.cpp b/src/core/hle/service/ns/read_only_application_record_interface.cpp index 8ce7851ae2..7a7cf9ec58 100644 --- a/src/core/hle/service/ns/read_only_application_record_interface.cpp +++ b/src/core/hle/service/ns/read_only_application_record_interface.cpp @@ -11,17 +11,18 @@ namespace Service::NS { +std::optional IReadOnlyApplicationRecordInterface::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IReadOnlyApplicationRecordInterface::HasApplicationRecord>, "HasApplicationRecord"}, + FunctionInfo{1, nullptr, "NotifyApplicationFailure"}, + FunctionInfo{2, D<&IReadOnlyApplicationRecordInterface::IsDataCorruptedResult>, "IsDataCorruptedResult"}, + FunctionInfo{3, D<&IReadOnlyApplicationRecordInterface::ListApplicationRecord>, "ListApplicationRecord"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IReadOnlyApplicationRecordInterface::IReadOnlyApplicationRecordInterface(Core::System& system_) : ServiceFramework{system_, "IReadOnlyApplicationRecordInterface"} { - static const FunctionInfo functions[] = { - {0, D<&IReadOnlyApplicationRecordInterface::HasApplicationRecord>, "HasApplicationRecord"}, - {1, nullptr, "NotifyApplicationFailure"}, - {2, D<&IReadOnlyApplicationRecordInterface::IsDataCorruptedResult>, "IsDataCorruptedResult"}, - {3, D<&IReadOnlyApplicationRecordInterface::ListApplicationRecord>, "ListApplicationRecord"}, - }; - // clang-format on - - RegisterHandlers(functions); } IReadOnlyApplicationRecordInterface::~IReadOnlyApplicationRecordInterface() = default; diff --git a/src/core/hle/service/ns/read_only_application_record_interface.h b/src/core/hle/service/ns/read_only_application_record_interface.h index fc43c768ba..308e753e7d 100644 --- a/src/core/hle/service/ns/read_only_application_record_interface.h +++ b/src/core/hle/service/ns/read_only_application_record_interface.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project @@ -24,6 +24,8 @@ private: Result ListApplicationRecord( OutArray out_records, Out out_count, s32 entry_offset); + + std::optional FindRequest(u32 key) override; }; } // namespace Service::NS diff --git a/src/core/hle/service/ns/service_getter_interface.cpp b/src/core/hle/service/ns/service_getter_interface.cpp index 1a3dd7166c..bbf30da3da 100644 --- a/src/core/hle/service/ns/service_getter_interface.cpp +++ b/src/core/hle/service/ns/service_getter_interface.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -17,25 +20,25 @@ namespace Service::NS { +std::optional IServiceGetterInterface::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{7988, D<&IServiceGetterInterface::GetDynamicRightsInterface>, "GetDynamicRightsInterface"}, + FunctionInfo{7989, D<&IServiceGetterInterface::GetReadOnlyApplicationControlDataInterface>, "GetReadOnlyApplicationControlDataInterface"}, + FunctionInfo{7991, D<&IServiceGetterInterface::GetReadOnlyApplicationRecordInterface>, "GetReadOnlyApplicationRecordInterface"}, + FunctionInfo{7992, D<&IServiceGetterInterface::GetECommerceInterface>, "GetECommerceInterface"}, + FunctionInfo{7993, D<&IServiceGetterInterface::GetApplicationVersionInterface>, "GetApplicationVersionInterface"}, + FunctionInfo{7994, D<&IServiceGetterInterface::GetFactoryResetInterface>, "GetFactoryResetInterface"}, + FunctionInfo{7995, D<&IServiceGetterInterface::GetAccountProxyInterface>, "GetAccountProxyInterface"}, + FunctionInfo{7996, D<&IServiceGetterInterface::GetApplicationManagerInterface>, "GetApplicationManagerInterface"}, + FunctionInfo{7997, D<&IServiceGetterInterface::GetDownloadTaskInterface>, "GetDownloadTaskInterface"}, + FunctionInfo{7998, D<&IServiceGetterInterface::GetContentManagementInterface>, "GetContentManagementInterface"}, + FunctionInfo{7999, D<&IServiceGetterInterface::GetDocumentInterface>, "GetDocumentInterface"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IServiceGetterInterface::IServiceGetterInterface(Core::System& system_, const char* name) : ServiceFramework{system_, name} { - // clang-format off - static const FunctionInfo functions[] = { - {7988, D<&IServiceGetterInterface::GetDynamicRightsInterface>, "GetDynamicRightsInterface"}, - {7989, D<&IServiceGetterInterface::GetReadOnlyApplicationControlDataInterface>, "GetReadOnlyApplicationControlDataInterface"}, - {7991, D<&IServiceGetterInterface::GetReadOnlyApplicationRecordInterface>, "GetReadOnlyApplicationRecordInterface"}, - {7992, D<&IServiceGetterInterface::GetECommerceInterface>, "GetECommerceInterface"}, - {7993, D<&IServiceGetterInterface::GetApplicationVersionInterface>, "GetApplicationVersionInterface"}, - {7994, D<&IServiceGetterInterface::GetFactoryResetInterface>, "GetFactoryResetInterface"}, - {7995, D<&IServiceGetterInterface::GetAccountProxyInterface>, "GetAccountProxyInterface"}, - {7996, D<&IServiceGetterInterface::GetApplicationManagerInterface>, "GetApplicationManagerInterface"}, - {7997, D<&IServiceGetterInterface::GetDownloadTaskInterface>, "GetDownloadTaskInterface"}, - {7998, D<&IServiceGetterInterface::GetContentManagementInterface>, "GetContentManagementInterface"}, - {7999, D<&IServiceGetterInterface::GetDocumentInterface>, "GetDocumentInterface"}, - }; - // clang-format on - - RegisterHandlers(functions); } IServiceGetterInterface::~IServiceGetterInterface() = default; diff --git a/src/core/hle/service/ns/service_getter_interface.h b/src/core/hle/service/ns/service_getter_interface.h index bbc18d4445..8c33aafc27 100644 --- a/src/core/hle/service/ns/service_getter_interface.h +++ b/src/core/hle/service/ns/service_getter_interface.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -42,6 +45,8 @@ public: Result GetContentManagementInterface( Out> out_interface); Result GetDocumentInterface(Out> out_interface); + + std::optional FindRequest(u32 key) override; }; } // namespace Service::NS diff --git a/src/core/hle/service/ns/system_update_control.cpp b/src/core/hle/service/ns/system_update_control.cpp index f5f5cfd909..3d1911c852 100644 --- a/src/core/hle/service/ns/system_update_control.cpp +++ b/src/core/hle/service/ns/system_update_control.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -8,35 +11,6 @@ namespace Service::NS { ISystemUpdateControl::ISystemUpdateControl(Core::System& system_) : ServiceFramework{system_, "ISystemUpdateControl"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "HasDownloaded"}, - {1, nullptr, "RequestCheckLatestUpdate"}, - {2, nullptr, "RequestDownloadLatestUpdate"}, - {3, nullptr, "GetDownloadProgress"}, - {4, nullptr, "ApplyDownloadedUpdate"}, - {5, nullptr, "RequestPrepareCardUpdate"}, - {6, nullptr, "GetPrepareCardUpdateProgress"}, - {7, nullptr, "HasPreparedCardUpdate"}, - {8, nullptr, "ApplyCardUpdate"}, - {9, nullptr, "GetDownloadedEulaDataSize"}, - {10, nullptr, "GetDownloadedEulaData"}, - {11, nullptr, "SetupCardUpdate"}, - {12, nullptr, "GetPreparedCardUpdateEulaDataSize"}, - {13, nullptr, "GetPreparedCardUpdateEulaData"}, - {14, nullptr, "SetupCardUpdateViaSystemUpdater"}, - {15, nullptr, "HasReceived"}, - {16, nullptr, "RequestReceiveSystemUpdate"}, - {17, nullptr, "GetReceiveProgress"}, - {18, nullptr, "ApplyReceivedUpdate"}, - {19, nullptr, "GetReceivedEulaDataSize"}, - {20, nullptr, "GetReceivedEulaData"}, - {21, nullptr, "SetupToReceiveSystemUpdate"}, - {22, nullptr, "RequestCheckLatestUpdateIncludesRebootlessUpdate"}, - }; - // clang-format on - - RegisterHandlers(functions); } ISystemUpdateControl::~ISystemUpdateControl() = default; diff --git a/src/core/hle/service/ns/system_update_control.h b/src/core/hle/service/ns/system_update_control.h index a30a090000..acdf048e6c 100644 --- a/src/core/hle/service/ns/system_update_control.h +++ b/src/core/hle/service/ns/system_update_control.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -11,6 +14,35 @@ class ISystemUpdateControl final : public ServiceFramework public: explicit ISystemUpdateControl(Core::System& system_); ~ISystemUpdateControl() override; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "HasDownloaded"}, + FunctionInfo{1, nullptr, "RequestCheckLatestUpdate"}, + FunctionInfo{2, nullptr, "RequestDownloadLatestUpdate"}, + FunctionInfo{3, nullptr, "GetDownloadProgress"}, + FunctionInfo{4, nullptr, "ApplyDownloadedUpdate"}, + FunctionInfo{5, nullptr, "RequestPrepareCardUpdate"}, + FunctionInfo{6, nullptr, "GetPrepareCardUpdateProgress"}, + FunctionInfo{7, nullptr, "HasPreparedCardUpdate"}, + FunctionInfo{8, nullptr, "ApplyCardUpdate"}, + FunctionInfo{9, nullptr, "GetDownloadedEulaDataSize"}, + FunctionInfo{10, nullptr, "GetDownloadedEulaData"}, + FunctionInfo{11, nullptr, "SetupCardUpdate"}, + FunctionInfo{12, nullptr, "GetPreparedCardUpdateEulaDataSize"}, + FunctionInfo{13, nullptr, "GetPreparedCardUpdateEulaData"}, + FunctionInfo{14, nullptr, "SetupCardUpdateViaSystemUpdater"}, + FunctionInfo{15, nullptr, "HasReceived"}, + FunctionInfo{16, nullptr, "RequestReceiveSystemUpdate"}, + FunctionInfo{17, nullptr, "GetReceiveProgress"}, + FunctionInfo{18, nullptr, "ApplyReceivedUpdate"}, + FunctionInfo{19, nullptr, "GetReceivedEulaDataSize"}, + FunctionInfo{20, nullptr, "GetReceivedEulaData"}, + FunctionInfo{21, nullptr, "SetupToReceiveSystemUpdate"}, + FunctionInfo{22, nullptr, "RequestCheckLatestUpdateIncludesRebootlessUpdate"} + ); }; } // namespace Service::NS diff --git a/src/core/hle/service/ns/system_update_interface.cpp b/src/core/hle/service/ns/system_update_interface.cpp index 7e22ca3db0..044d39835f 100644 --- a/src/core/hle/service/ns/system_update_interface.cpp +++ b/src/core/hle/service/ns/system_update_interface.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -7,32 +10,32 @@ namespace Service::NS { +std::optional ISystemUpdateInterface::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&ISystemUpdateInterface::GetBackgroundNetworkUpdateState>, "GetBackgroundNetworkUpdateState"}, + FunctionInfo{1, D<&ISystemUpdateInterface::OpenSystemUpdateControl>, "OpenSystemUpdateControl"}, + FunctionInfo{2, nullptr, "NotifyExFatDriverRequired"}, + FunctionInfo{3, nullptr, "ClearExFatDriverStatusForDebug"}, + FunctionInfo{4, nullptr, "RequestBackgroundNetworkUpdate"}, + FunctionInfo{5, nullptr, "NotifyBackgroundNetworkUpdate"}, + FunctionInfo{6, nullptr, "NotifyExFatDriverDownloadedForDebug"}, + FunctionInfo{9, D<&ISystemUpdateInterface::GetSystemUpdateNotificationEventForContentDelivery>, "GetSystemUpdateNotificationEventForContentDelivery"}, + FunctionInfo{10, nullptr, "NotifySystemUpdateForContentDelivery"}, + FunctionInfo{11, nullptr, "PrepareShutdown"}, + FunctionInfo{12, nullptr, "Unknown12"}, + FunctionInfo{13, nullptr, "Unknown13"}, + FunctionInfo{14, nullptr, "Unknown14"}, + FunctionInfo{15, nullptr, "Unknown15"}, + FunctionInfo{16, nullptr, "DestroySystemUpdateTask"}, + FunctionInfo{17, nullptr, "RequestSendSystemUpdate"}, + FunctionInfo{18, nullptr, "GetSendSystemUpdateProgress"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + ISystemUpdateInterface::ISystemUpdateInterface(Core::System& system_) : ServiceFramework{system_, "ns:su"}, service_context{system_, "ns:su"}, update_notification_event{service_context} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&ISystemUpdateInterface::GetBackgroundNetworkUpdateState>, "GetBackgroundNetworkUpdateState"}, - {1, D<&ISystemUpdateInterface::OpenSystemUpdateControl>, "OpenSystemUpdateControl"}, - {2, nullptr, "NotifyExFatDriverRequired"}, - {3, nullptr, "ClearExFatDriverStatusForDebug"}, - {4, nullptr, "RequestBackgroundNetworkUpdate"}, - {5, nullptr, "NotifyBackgroundNetworkUpdate"}, - {6, nullptr, "NotifyExFatDriverDownloadedForDebug"}, - {9, D<&ISystemUpdateInterface::GetSystemUpdateNotificationEventForContentDelivery>, "GetSystemUpdateNotificationEventForContentDelivery"}, - {10, nullptr, "NotifySystemUpdateForContentDelivery"}, - {11, nullptr, "PrepareShutdown"}, - {12, nullptr, "Unknown12"}, - {13, nullptr, "Unknown13"}, - {14, nullptr, "Unknown14"}, - {15, nullptr, "Unknown15"}, - {16, nullptr, "DestroySystemUpdateTask"}, - {17, nullptr, "RequestSendSystemUpdate"}, - {18, nullptr, "GetSendSystemUpdateProgress"}, - }; - // clang-format on - - RegisterHandlers(functions); } ISystemUpdateInterface::~ISystemUpdateInterface() = default; diff --git a/src/core/hle/service/ns/system_update_interface.h b/src/core/hle/service/ns/system_update_interface.h index 36a2880ec9..2ea14f4f5e 100644 --- a/src/core/hle/service/ns/system_update_interface.h +++ b/src/core/hle/service/ns/system_update_interface.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -30,7 +33,7 @@ private: Result GetSystemUpdateNotificationEventForContentDelivery( OutCopyHandle out_event); -private: + std::optional FindRequest(u32 key) override; KernelHelpers::ServiceContext service_context; Event update_notification_event; }; diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp index b252a2efa5..81d8a3a63b 100644 --- a/src/core/hle/service/nvdrv/nvdrv.cpp +++ b/src/core/hle/service/nvdrv/nvdrv.cpp @@ -50,55 +50,61 @@ class NVGEM_C final : public ServiceFramework { public: explicit NVGEM_C(Core::System& system_) : ServiceFramework{system_, "nvgem:c"} - { - static const FunctionInfo functions[] = { - {0, nullptr, "Initialize"}, - {1, nullptr, "GetEventHandle"}, - {2, nullptr, "ControlNotification"}, - {3, nullptr, "SetNotificationPerm"}, - {4, nullptr, "SetCoreDumpPerm"}, - {5, nullptr, "GetAruid"}, - {6, nullptr, "Reset"}, - {7, nullptr, "GetAruid2"}, - }; - RegisterHandlers(functions); + {} + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "Initialize"}, + FunctionInfo{1, nullptr, "GetEventHandle"}, + FunctionInfo{2, nullptr, "ControlNotification"}, + FunctionInfo{3, nullptr, "SetNotificationPerm"}, + FunctionInfo{4, nullptr, "SetCoreDumpPerm"}, + FunctionInfo{5, nullptr, "GetAruid"}, + FunctionInfo{6, nullptr, "Reset"}, + FunctionInfo{7, nullptr, "GetAruid2"} + ); }; class NVGEM_CD final : public ServiceFramework { public: explicit NVGEM_CD(Core::System& system_) : ServiceFramework{system_, "nvgem:cd"} - { - static const FunctionInfo functions[] = { - {0, nullptr, "Initialize"}, - {1, nullptr, "GetAruid"}, - {2, nullptr, "ReadNextBlock"}, - {3, nullptr, "GetNextBlockSize"}, - {4, nullptr, "ReadNextBlock2"}, - }; - RegisterHandlers(functions); + {} + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "Initialize"}, + FunctionInfo{1, nullptr, "GetAruid"}, + FunctionInfo{2, nullptr, "ReadNextBlock"}, + FunctionInfo{3, nullptr, "GetNextBlockSize"}, + FunctionInfo{4, nullptr, "ReadNextBlock2"} + ); }; class NVDBG_D final : public ServiceFramework { public: explicit NVDBG_D(Core::System& system_) : ServiceFramework{system_, "nvdbg:d"} - { - static const FunctionInfo functions[] = { - {0, nullptr, "Open"}, - {1, nullptr, "Ioctl"}, - {2, nullptr, "Close"}, - {4, nullptr, "QueryEvent"}, - {9, nullptr, "DumpStatus"}, - {10, nullptr, "InitializeDevtools"}, - {11, nullptr, "Ioctl2"}, - {12, nullptr, "Ioctl3"}, - {13, nullptr, "SetConfiguration"}, - }; - RegisterHandlers(functions); + {} + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "Open"}, + FunctionInfo{1, nullptr, "Ioctl"}, + FunctionInfo{2, nullptr, "Close"}, + FunctionInfo{4, nullptr, "QueryEvent"}, + FunctionInfo{9, nullptr, "DumpStatus"}, + FunctionInfo{10, nullptr, "InitializeDevtools"}, + FunctionInfo{11, nullptr, "Ioctl2"}, + FunctionInfo{12, nullptr, "Ioctl3"}, + FunctionInfo{13, nullptr, "SetConfiguration"} + ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/nvdrv/nvdrv_interface.cpp b/src/core/hle/service/nvdrv/nvdrv_interface.cpp index 5fae68adbb..db3dbd9f8e 100644 --- a/src/core/hle/service/nvdrv/nvdrv_interface.cpp +++ b/src/core/hle/service/nvdrv/nvdrv_interface.cpp @@ -245,24 +245,6 @@ void NVDRV::DumpGraphicsMemoryInfo(HLERequestContext& ctx) { NVDRV::NVDRV(Core::System& system_, std::shared_ptr nvdrv_, const char* name) : ServiceFramework{system_, name}, nvdrv{std::move(nvdrv_)} { - static const FunctionInfo functions[] = { - {0, &NVDRV::Open, "Open"}, - {1, &NVDRV::Ioctl1, "Ioctl"}, - {2, &NVDRV::Close, "Close"}, - {3, &NVDRV::Initialize, "Initialize"}, - {4, &NVDRV::QueryEvent, "QueryEvent"}, - {5, nullptr, "MapSharedMem"}, - {6, &NVDRV::GetStatus, "GetStatus"}, - {7, nullptr, "SetAruidForTest"}, - {8, &NVDRV::SetAruid, "SetAruid"}, - {9, &NVDRV::DumpGraphicsMemoryInfo, "DumpGraphicsMemoryInfo"}, - {10, nullptr, "InitializeDevtools"}, - {11, &NVDRV::Ioctl2, "Ioctl2"}, - {12, &NVDRV::Ioctl3, "Ioctl3"}, - {13, &NVDRV::SetGraphicsFirmwareMemoryMarginEnabled, - "SetGraphicsFirmwareMemoryMarginEnabled"}, - }; - RegisterHandlers(functions); } NVDRV::~NVDRV() { diff --git a/src/core/hle/service/nvdrv/nvdrv_interface.h b/src/core/hle/service/nvdrv/nvdrv_interface.h index c72f925979..b9b574398a 100644 --- a/src/core/hle/service/nvdrv/nvdrv_interface.h +++ b/src/core/hle/service/nvdrv/nvdrv_interface.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -35,8 +38,27 @@ private: void ServiceError(HLERequestContext& ctx, NvResult result); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &NVDRV::Open, "Open"}, + FunctionInfo{1, &NVDRV::Ioctl1, "Ioctl"}, + FunctionInfo{2, &NVDRV::Close, "Close"}, + FunctionInfo{3, &NVDRV::Initialize, "Initialize"}, + FunctionInfo{4, &NVDRV::QueryEvent, "QueryEvent"}, + FunctionInfo{5, nullptr, "MapSharedMem"}, + FunctionInfo{6, &NVDRV::GetStatus, "GetStatus"}, + FunctionInfo{7, nullptr, "SetAruidForTest"}, + FunctionInfo{8, &NVDRV::SetAruid, "SetAruid"}, + FunctionInfo{9, &NVDRV::DumpGraphicsMemoryInfo, "DumpGraphicsMemoryInfo"}, + FunctionInfo{10, nullptr, "InitializeDevtools"}, + FunctionInfo{11, &NVDRV::Ioctl2, "Ioctl2"}, + FunctionInfo{12, &NVDRV::Ioctl3, "Ioctl3"}, + FunctionInfo{13, &NVDRV::SetGraphicsFirmwareMemoryMarginEnabled, + "SetGraphicsFirmwareMemoryMarginEnabled"} + ); std::shared_ptr nvdrv; - u64 pid{}; bool is_initialized{}; NvCore::SessionId session_id{}; diff --git a/src/core/hle/service/nvdrv/nvmemp.cpp b/src/core/hle/service/nvdrv/nvmemp.cpp index a5477faf1a..8e2e4dfacb 100644 --- a/src/core/hle/service/nvdrv/nvmemp.cpp +++ b/src/core/hle/service/nvdrv/nvmemp.cpp @@ -11,11 +11,6 @@ namespace Service::Nvidia { NVMEMP::NVMEMP(Core::System& system_) : ServiceFramework{system_, "nvmemp"} { - static const FunctionInfo functions[] = { - {0, &NVMEMP::Open, "Open"}, - {1, &NVMEMP::GetAruid, "GetAruid"}, - }; - RegisterHandlers(functions); } NVMEMP::~NVMEMP() = default; diff --git a/src/core/hle/service/nvdrv/nvmemp.h b/src/core/hle/service/nvdrv/nvmemp.h index 85e3053a8d..e98b07c494 100644 --- a/src/core/hle/service/nvdrv/nvmemp.h +++ b/src/core/hle/service/nvdrv/nvmemp.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -19,6 +22,14 @@ public: private: void Open(HLERequestContext& ctx); void GetAruid(HLERequestContext& ctx); + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &NVMEMP::Open, "Open"}, + FunctionInfo{1, &NVMEMP::GetAruid, "GetAruid"} + ); }; } // namespace Service::Nvidia diff --git a/src/core/hle/service/nvnflinger/hos_binder_driver.cpp b/src/core/hle/service/nvnflinger/hos_binder_driver.cpp index d30aa3717d..c9023374c4 100644 --- a/src/core/hle/service/nvnflinger/hos_binder_driver.cpp +++ b/src/core/hle/service/nvnflinger/hos_binder_driver.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -8,18 +11,21 @@ namespace Service::Nvnflinger { +std::optional IHOSBinderDriver::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, C<&IHOSBinderDriver::TransactParcel>, "TransactParcel"}, + FunctionInfo{1, C<&IHOSBinderDriver::AdjustRefcount>, "AdjustRefcount"}, + FunctionInfo{2, C<&IHOSBinderDriver::GetNativeHandle>, "GetNativeHandle"}, + FunctionInfo{3, C<&IHOSBinderDriver::TransactParcelAuto>, "TransactParcelAuto"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IHOSBinderDriver::IHOSBinderDriver(Core::System& system_, std::shared_ptr server, std::shared_ptr surface_flinger) : ServiceFramework{system_, "IHOSBinderDriver"}, m_server(server), m_surface_flinger(surface_flinger) { - static const FunctionInfo functions[] = { - {0, C<&IHOSBinderDriver::TransactParcel>, "TransactParcel"}, - {1, C<&IHOSBinderDriver::AdjustRefcount>, "AdjustRefcount"}, - {2, C<&IHOSBinderDriver::GetNativeHandle>, "GetNativeHandle"}, - {3, C<&IHOSBinderDriver::TransactParcelAuto>, "TransactParcelAuto"}, - }; - RegisterHandlers(functions); } IHOSBinderDriver::~IHOSBinderDriver() = default; diff --git a/src/core/hle/service/nvnflinger/hos_binder_driver.h b/src/core/hle/service/nvnflinger/hos_binder_driver.h index 6b551c91d2..7d44046115 100644 --- a/src/core/hle/service/nvnflinger/hos_binder_driver.h +++ b/src/core/hle/service/nvnflinger/hos_binder_driver.h @@ -44,6 +44,7 @@ private: OutBuffer parcel_reply, u32 flags); private: + std::optional FindRequest(u32 key) override; const std::shared_ptr m_server; const std::shared_ptr m_surface_flinger; }; diff --git a/src/core/hle/service/olsc/daemon_controller.cpp b/src/core/hle/service/olsc/daemon_controller.cpp index c449c6ff31..f25888170c 100644 --- a/src/core/hle/service/olsc/daemon_controller.cpp +++ b/src/core/hle/service/olsc/daemon_controller.cpp @@ -9,27 +9,25 @@ namespace Service::OLSC { -IDaemonController::IDaemonController(Core::System& system_) - : ServiceFramework{system_, "IDaemonController"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IDaemonController::GetApplicationAutoTransferSetting>, "GetApplicationAutoTransferSetting"}, - {1, D<&IDaemonController::SetApplicationAutoTransferSetting>, "SetApplicationAutoTransferSetting"}, - {2, D<&IDaemonController::GetGlobalAutoUploadSetting>, "GetGlobalAutoUploadSetting"}, - {3, D<&IDaemonController::SetGlobalAutoUploadSetting>, "SetGlobalAutoUploadSetting"}, - {4, D<&IDaemonController::RunTransferTaskAutonomyRegistration>, "RunTransferTaskAutonomyRegistration"}, - {5, D<&IDaemonController::GetGlobalAutoDownloadSetting>, "GetGlobalAutoDownloadSetting"}, // 11.0.0+ - {6, D<&IDaemonController::SetGlobalAutoDownloadSetting>, "SetGlobalAutoDownloadSetting"}, // 11.0.0+ - {10, nullptr, "CreateForbiddenSaveDataInidication"}, - {11, D<&IDaemonController::StopAutonomyTaskExecution>, "StopAutonomyTaskExecution"}, - {12, D<&IDaemonController::GetAutonomyTaskStatus>, "GetAutonomyTaskStatus"}, - {13, nullptr, "Unknown13_20_0_0_Plus"}, // 20.0.0+ - }; - // clang-format on - - RegisterHandlers(functions); +std::optional IDaemonController::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IDaemonController::GetApplicationAutoTransferSetting>, "GetApplicationAutoTransferSetting"}, + FunctionInfo{1, D<&IDaemonController::SetApplicationAutoTransferSetting>, "SetApplicationAutoTransferSetting"}, + FunctionInfo{2, D<&IDaemonController::GetGlobalAutoUploadSetting>, "GetGlobalAutoUploadSetting"}, + FunctionInfo{3, D<&IDaemonController::SetGlobalAutoUploadSetting>, "SetGlobalAutoUploadSetting"}, + FunctionInfo{4, D<&IDaemonController::RunTransferTaskAutonomyRegistration>, "RunTransferTaskAutonomyRegistration"}, + FunctionInfo{5, D<&IDaemonController::GetGlobalAutoDownloadSetting>, "GetGlobalAutoDownloadSetting", MakeVersionGate({11,0,0})}, + FunctionInfo{6, D<&IDaemonController::SetGlobalAutoDownloadSetting>, "SetGlobalAutoDownloadSetting", MakeVersionGate({11,0,0})}, + FunctionInfo{10, nullptr, "CreateForbiddenSaveDataInidication"}, + FunctionInfo{11, D<&IDaemonController::StopAutonomyTaskExecution>, "StopAutonomyTaskExecution"}, + FunctionInfo{12, D<&IDaemonController::GetAutonomyTaskStatus>, "GetAutonomyTaskStatus"}, + FunctionInfo{13, nullptr, "Unknown13_20_0_0_Plus", MakeVersionGate({20,0,0})} + ); + return HandlerTableGenerateWithFind(key, functions); } +IDaemonController::IDaemonController(Core::System& system_) : ServiceFramework{system_, "IDaemonController"} {} + IDaemonController::~IDaemonController() = default; Result IDaemonController::GetApplicationAutoTransferSetting(Out out_is_enabled, diff --git a/src/core/hle/service/olsc/daemon_controller.h b/src/core/hle/service/olsc/daemon_controller.h index 70f3d9e235..b90d3ee778 100644 --- a/src/core/hle/service/olsc/daemon_controller.h +++ b/src/core/hle/service/olsc/daemon_controller.h @@ -38,6 +38,8 @@ private: Result GetAutonomyTaskStatus(Out out_status, Common::UUID user_id); + std::optional FindRequest(u32 key) override; + // Internal in-memory state to back the above APIs struct AppKey { Common::UUID user_id; diff --git a/src/core/hle/service/olsc/native_handle_holder.cpp b/src/core/hle/service/olsc/native_handle_holder.cpp index 1e50195539..1f6f8419fc 100644 --- a/src/core/hle/service/olsc/native_handle_holder.cpp +++ b/src/core/hle/service/olsc/native_handle_holder.cpp @@ -12,16 +12,16 @@ namespace Service::OLSC { +std::optional INativeHandleHolder::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&INativeHandleHolder::GetNativeHandle>, "GetNativeHandle"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + INativeHandleHolder::INativeHandleHolder(Core::System& system_) : ServiceFramework{system_, "INativeHandleHolder"}, service_context{system_, "OLSC"} { event = service_context.CreateEvent("OLSC::INativeHandleHolder"); - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&INativeHandleHolder::GetNativeHandle>, "GetNativeHandle"}, - }; - // clang-format on - - RegisterHandlers(functions); } INativeHandleHolder::~INativeHandleHolder() { diff --git a/src/core/hle/service/olsc/native_handle_holder.h b/src/core/hle/service/olsc/native_handle_holder.h index e0eac50c28..0ab51c7ca0 100644 --- a/src/core/hle/service/olsc/native_handle_holder.h +++ b/src/core/hle/service/olsc/native_handle_holder.h @@ -25,6 +25,7 @@ public: private: Result GetNativeHandle(OutCopyHandle out_event); + std::optional FindRequest(u32 key) override; Service::KernelHelpers::ServiceContext service_context; Kernel::KEvent* event{}; diff --git a/src/core/hle/service/olsc/olsc.cpp b/src/core/hle/service/olsc/olsc.cpp index a86c525f9a..03b8a696f5 100644 --- a/src/core/hle/service/olsc/olsc.cpp +++ b/src/core/hle/service/olsc/olsc.cpp @@ -6,22 +6,179 @@ #include "core/hle/service/olsc/olsc.h" #include "core/hle/service/olsc/olsc_service_for_application.h" -#include "core/hle/service/olsc/olsc_service_for_system_service.h" +#include "core/hle/service/olsc/native_handle_holder.h" +#include "core/hle/service/olsc/stopper_object.h" +#include "core/hle/service/olsc/daemon_controller.h" +#include "core/hle/service/olsc/transfer_task_list_controller.h" +#include "core/hle/service/olsc/remote_storage_controller.h" #include "core/hle/service/server_manager.h" #include "core/hle/service/service.h" +#include "core/hle/service/cmif_serialization.h" namespace Service::OLSC { class ISProfileBgAgentForSystemProcess final : public ServiceFramework { public: - explicit ISProfileBgAgentForSystemProcess(Core::System& system_) - : ServiceFramework{system_, "spbg:sp"} - { - static const FunctionInfo functions[] = { - { 100, nullptr, "OpenBgAgentController" }, - }; - RegisterHandlers(functions); + explicit ISProfileBgAgentForSystemProcess(Core::System& system_) : ServiceFramework{system_, "spbg:sp"} {} + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{100, nullptr, "OpenBgAgentController" } + ); +}; + +class IDaemonController; +class IRemoteStorageController; +class ITransferTaskListController; + +struct DataTransferPolicy { + u8 upload_policy; + u8 download_policy; +}; + +struct TransferTaskErrorInfo { + Common::UUID uid; + u64 application_id; + u8 unknown_0x18; + std::array reserved_0x19; + u64 unknown_0x20; + u32 error_code; + u32 reserved_0x2C; +}; +static_assert(sizeof(TransferTaskErrorInfo) == 0x30, "TransferTaskErrorInfo has incorrect size."); + +class IOlscServiceForSystemService final : public ServiceFramework { +public: + explicit IOlscServiceForSystemService(Core::System& system_) + : ServiceFramework{system_, "olsc:s"} { + } + + ~IOlscServiceForSystemService() override = default; + + Result GetTransferTaskListController( + Out> out_interface) { + LOG_INFO(Service_OLSC, "called"); + *out_interface = std::make_shared(system); + R_SUCCEED(); + } + + Result GetRemoteStorageController( + Out> out_interface) { + LOG_INFO(Service_OLSC, "called"); + *out_interface = std::make_shared(system); + R_SUCCEED(); + } + + Result GetDaemonController( + Out> out_interface) { + LOG_INFO(Service_OLSC, "called"); + *out_interface = std::make_shared(system); + R_SUCCEED(); + } + + Result GetDataTransferPolicy( + Out out_policy, u64 application_id) { + LOG_WARNING(Service_OLSC, "(STUBBED) called"); + DataTransferPolicy policy{}; + policy.upload_policy = 0; + policy.download_policy = 0; + *out_policy = policy; + R_SUCCEED(); + } + + Result GetTransferTaskErrorInfo(Out out_info, + Common::UUID uuid, u64 application_id) { + LOG_WARNING(Service_OLSC, "(STUBBED) called, uuid={} application_id={:016X}", + uuid.FormattedString(), application_id); + + TransferTaskErrorInfo info{}; + info.uid = uuid; + info.application_id = application_id; + info.unknown_0x18 = 0; + info.reserved_0x19.fill(0); + info.unknown_0x20 = 0; + info.error_code = 0; + info.reserved_0x2C = 0; + + *out_info = info; + R_SUCCEED(); + } + + Result GetOlscServiceForSystemService( + Out> out_interface) { + LOG_INFO(Service_OLSC, "called"); + *out_interface = std::static_pointer_cast(shared_from_this()); + R_SUCCEED(); + } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IOlscServiceForSystemService::GetTransferTaskListController>, "GetTransferTaskListController"}, + FunctionInfo{1, D<&IOlscServiceForSystemService::GetRemoteStorageController>, "GetRemoteStorageController"}, + FunctionInfo{2, D<&IOlscServiceForSystemService::GetDaemonController>, "GetDaemonController"}, + FunctionInfo{10, nullptr, "PrepareDeleteUserProperty"}, + FunctionInfo{11, nullptr, "DeleteUserSaveDataProperty"}, + FunctionInfo{12, nullptr, "InvalidateMountCache"}, + FunctionInfo{13, nullptr, "DeleteDeviceSaveDataProperty"}, + FunctionInfo{100, nullptr, "ListLastTransferTaskErrorInfo"}, + FunctionInfo{101, nullptr, "GetLastErrorInfoCount"}, + FunctionInfo{102, nullptr, "RemoveLastErrorInfoOld"}, + FunctionInfo{103, nullptr, "GetLastErrorInfo"}, + FunctionInfo{104, nullptr, "GetLastErrorEventHolder"}, + FunctionInfo{105, D<&IOlscServiceForSystemService::GetTransferTaskErrorInfo>, "GetTransferTaskErrorInfo"}, + FunctionInfo{200, D<&IOlscServiceForSystemService::GetDataTransferPolicy>, "GetDataTransferPolicy"}, + FunctionInfo{201, nullptr, "DeleteDataTransferPolicyCache"}, + FunctionInfo{202, nullptr, "Unknown202"}, + FunctionInfo{203, nullptr, "RequestUpdateDataTransferPolicyCacheAsync"}, + FunctionInfo{204, nullptr, "ClearDataTransferPolicyCache"}, + FunctionInfo{205, nullptr, "RequestGetDataTransferPolicyAsync"}, + FunctionInfo{206, nullptr, "Unknown206", MakeVersionGate({21,0,0})}, + FunctionInfo{300, nullptr, "GetUserSaveDataProperty"}, + FunctionInfo{301, nullptr, "SetUserSaveDataProperty"}, + FunctionInfo{302, nullptr, "Unknown302", MakeVersionGate({21,0,0})}, + FunctionInfo{400, nullptr, "CleanupSaveDataBackupContextForSpecificApplications"}, + FunctionInfo{900, nullptr, "DeleteAllTransferTask"}, + FunctionInfo{902, nullptr, "DeleteAllSeriesInfo"}, + FunctionInfo{903, nullptr, "DeleteAllSdaInfoCache"}, + FunctionInfo{904, nullptr, "DeleteAllApplicationSetting"}, + FunctionInfo{905, nullptr, "DeleteAllTransferTaskErrorInfo"}, + FunctionInfo{906, nullptr, "RegisterTransferTaskErrorInfo"}, + FunctionInfo{907, nullptr, "AddSaveDataArchiveInfoCache"}, + FunctionInfo{908, nullptr, "DeleteSeriesInfo"}, + FunctionInfo{909, nullptr, "GetSeriesInfo"}, + FunctionInfo{910, nullptr, "RemoveTransferTaskErrorInfo"}, + FunctionInfo{911, nullptr, "DeleteAllSeriesInfoForSaveDataBackup"}, + FunctionInfo{912, nullptr, "DeleteSeriesInfoForSaveDataBackup"}, + FunctionInfo{913, nullptr, "GetSeriesInfoForSaveDataBackup"}, + FunctionInfo{914, nullptr, "Unknown914", MakeVersionGate({20,2,0})}, + FunctionInfo{1000, nullptr, "UpdateIssueOld"}, + FunctionInfo{1010, nullptr, "Unknown1010"}, + FunctionInfo{1011, nullptr, "Unknown1011"}, + FunctionInfo{1012, nullptr, "Unknown1012"}, + FunctionInfo{1013, nullptr, "Unkown1013"}, + FunctionInfo{1014, nullptr, "Unknown1014"}, + FunctionInfo{1020, nullptr, "Unknown1020"}, + FunctionInfo{1021, nullptr, "Unknown1021"}, + FunctionInfo{1022, nullptr, "Unknown1022"}, + FunctionInfo{1023, nullptr, "Unknown1023"}, + FunctionInfo{1024, nullptr, "Unknown1024"}, + FunctionInfo{1100, nullptr, "RepairUpdateIssueInfoCacheAync"}, + FunctionInfo{1110, nullptr, "RepairGetIssueInfo"}, + FunctionInfo{1111, nullptr, "RepairListIssueInfo"}, + FunctionInfo{1112, nullptr, "RepairListOperationPermissionInfo"}, + FunctionInfo{1113, nullptr, "RepairListDataInfoForRepairedSaveDataDownload"}, + FunctionInfo{1114, nullptr, "RepairListDataInfoForOriginalSaveDataDownload"}, + FunctionInfo{1120, nullptr, "RepairUploadSaveDataAsync"}, + FunctionInfo{1121, nullptr, "RepairUploadSaveDataAsync1"}, + FunctionInfo{1122, nullptr, "RepairDownloadRepairedSaveDataAsync"}, + FunctionInfo{1123, nullptr, "RepairDownloadOriginalSaveDataAsync"}, + FunctionInfo{1124, nullptr, "RepairGetOperationProgressInfo"}, + FunctionInfo{10000, D<&IOlscServiceForSystemService::GetOlscServiceForSystemService>, "GetOlscServiceForSystemService"} + ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/olsc/olsc_service_for_application.cpp b/src/core/hle/service/olsc/olsc_service_for_application.cpp index 01360f5ef2..8d6b20d7ff 100644 --- a/src/core/hle/service/olsc/olsc_service_for_application.cpp +++ b/src/core/hle/service/olsc/olsc_service_for_application.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -6,36 +9,36 @@ namespace Service::OLSC { +std::optional IOlscServiceForApplication::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IOlscServiceForApplication::Initialize>, "Initialize"}, + FunctionInfo{10, nullptr, "VerifySaveDataBackupLicenseAsync"}, + FunctionInfo{13, D<&IOlscServiceForApplication::GetSaveDataBackupSetting>, "GetSaveDataBackupSetting"}, + FunctionInfo{14, D<&IOlscServiceForApplication::SetSaveDataBackupSettingEnabled>, "SetSaveDataBackupSettingEnabled"}, + FunctionInfo{15, nullptr, "SetCustomData"}, + FunctionInfo{16, nullptr, "DeleteSaveDataBackupSetting"}, + FunctionInfo{18, nullptr, "GetSaveDataBackupInfoCache"}, + FunctionInfo{19, nullptr, "UpdateSaveDataBackupInfoCacheAsync"}, + FunctionInfo{22, nullptr, "DeleteSaveDataBackupAsync"}, + FunctionInfo{25, nullptr, "ListDownloadableSaveDataBackupInfoAsync"}, + FunctionInfo{26, nullptr, "DownloadSaveDataBackupAsync"}, + FunctionInfo{27, nullptr, "UploadSaveDataBackupAsync"}, + FunctionInfo{9010, nullptr, "VerifySaveDataBackupLicenseAsyncForDebug"}, + FunctionInfo{9013, nullptr, "GetSaveDataBackupSettingForDebug"}, + FunctionInfo{9014, nullptr, "SetSaveDataBackupSettingEnabledForDebug"}, + FunctionInfo{9015, nullptr, "SetCustomDataForDebug"}, + FunctionInfo{9016, nullptr, "DeleteSaveDataBackupSettingForDebug"}, + FunctionInfo{9018, nullptr, "GetSaveDataBackupInfoCacheForDebug"}, + FunctionInfo{9019, nullptr, "UpdateSaveDataBackupInfoCacheAsyncForDebug"}, + FunctionInfo{9022, nullptr, "DeleteSaveDataBackupAsyncForDebug"}, + FunctionInfo{9025, nullptr, "ListDownloadableSaveDataBackupInfoAsyncForDebug"}, + FunctionInfo{9026, nullptr, "DownloadSaveDataBackupAsyncForDebug"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IOlscServiceForApplication::IOlscServiceForApplication(Core::System& system_) : ServiceFramework{system_, "olsc:u"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IOlscServiceForApplication::Initialize>, "Initialize"}, - {10, nullptr, "VerifySaveDataBackupLicenseAsync"}, - {13, D<&IOlscServiceForApplication::GetSaveDataBackupSetting>, "GetSaveDataBackupSetting"}, - {14, D<&IOlscServiceForApplication::SetSaveDataBackupSettingEnabled>, "SetSaveDataBackupSettingEnabled"}, - {15, nullptr, "SetCustomData"}, - {16, nullptr, "DeleteSaveDataBackupSetting"}, - {18, nullptr, "GetSaveDataBackupInfoCache"}, - {19, nullptr, "UpdateSaveDataBackupInfoCacheAsync"}, - {22, nullptr, "DeleteSaveDataBackupAsync"}, - {25, nullptr, "ListDownloadableSaveDataBackupInfoAsync"}, - {26, nullptr, "DownloadSaveDataBackupAsync"}, - {27, nullptr, "UploadSaveDataBackupAsync"}, - {9010, nullptr, "VerifySaveDataBackupLicenseAsyncForDebug"}, - {9013, nullptr, "GetSaveDataBackupSettingForDebug"}, - {9014, nullptr, "SetSaveDataBackupSettingEnabledForDebug"}, - {9015, nullptr, "SetCustomDataForDebug"}, - {9016, nullptr, "DeleteSaveDataBackupSettingForDebug"}, - {9018, nullptr, "GetSaveDataBackupInfoCacheForDebug"}, - {9019, nullptr, "UpdateSaveDataBackupInfoCacheAsyncForDebug"}, - {9022, nullptr, "DeleteSaveDataBackupAsyncForDebug"}, - {9025, nullptr, "ListDownloadableSaveDataBackupInfoAsyncForDebug"}, - {9026, nullptr, "DownloadSaveDataBackupAsyncForDebug"}, - }; - // clang-format on - - RegisterHandlers(functions); } IOlscServiceForApplication::~IOlscServiceForApplication() = default; diff --git a/src/core/hle/service/olsc/olsc_service_for_application.h b/src/core/hle/service/olsc/olsc_service_for_application.h index 8941659478..0d92f9ba78 100644 --- a/src/core/hle/service/olsc/olsc_service_for_application.h +++ b/src/core/hle/service/olsc/olsc_service_for_application.h @@ -22,6 +22,8 @@ private: Result GetSaveDataBackupSetting(Out out_save_data_backup_setting); Result SetSaveDataBackupSettingEnabled(bool enabled, NS::Uid account_id); + std::optional FindRequest(u32 key) override; + bool initialized{}; }; diff --git a/src/core/hle/service/olsc/olsc_service_for_system_service.cpp b/src/core/hle/service/olsc/olsc_service_for_system_service.cpp deleted file mode 100644 index 245bbd5c6b..0000000000 --- a/src/core/hle/service/olsc/olsc_service_for_system_service.cpp +++ /dev/null @@ -1,144 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/hle/service/cmif_serialization.h" -#include "core/hle/service/olsc/daemon_controller.h" -#include "core/hle/service/olsc/olsc_service_for_system_service.h" -#include "core/hle/service/olsc/remote_storage_controller.h" -#include "core/hle/service/olsc/transfer_task_list_controller.h" - -namespace Service::OLSC { - -IOlscServiceForSystemService::IOlscServiceForSystemService(Core::System& system_) - : ServiceFramework{system_, "olsc:s"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IOlscServiceForSystemService::GetTransferTaskListController>, "GetTransferTaskListController"}, - {1, D<&IOlscServiceForSystemService::GetRemoteStorageController>, "GetRemoteStorageController"}, - {2, D<&IOlscServiceForSystemService::GetDaemonController>, "GetDaemonController"}, - {10, nullptr, "PrepareDeleteUserProperty"}, - {11, nullptr, "DeleteUserSaveDataProperty"}, - {12, nullptr, "InvalidateMountCache"}, - {13, nullptr, "DeleteDeviceSaveDataProperty"}, - {100, nullptr, "ListLastTransferTaskErrorInfo"}, - {101, nullptr, "GetLastErrorInfoCount"}, - {102, nullptr, "RemoveLastErrorInfoOld"}, - {103, nullptr, "GetLastErrorInfo"}, - {104, nullptr, "GetLastErrorEventHolder"}, - {105, D<&IOlscServiceForSystemService::GetTransferTaskErrorInfo>, "GetTransferTaskErrorInfo"}, - {200, D<&IOlscServiceForSystemService::GetDataTransferPolicy>, "GetDataTransferPolicy"}, - {201, nullptr, "DeleteDataTransferPolicyCache"}, - {202, nullptr, "Unknown202"}, - {203, nullptr, "RequestUpdateDataTransferPolicyCacheAsync"}, - {204, nullptr, "ClearDataTransferPolicyCache"}, - {205, nullptr, "RequestGetDataTransferPolicyAsync"}, - {206, nullptr, "Unknown206"}, //21.0.0+ - {300, nullptr, "GetUserSaveDataProperty"}, - {301, nullptr, "SetUserSaveDataProperty"}, - {302, nullptr, "Unknown302"}, //21.0.0+ - {400, nullptr, "CleanupSaveDataBackupContextForSpecificApplications"}, - {900, nullptr, "DeleteAllTransferTask"}, - {902, nullptr, "DeleteAllSeriesInfo"}, - {903, nullptr, "DeleteAllSdaInfoCache"}, - {904, nullptr, "DeleteAllApplicationSetting"}, - {905, nullptr, "DeleteAllTransferTaskErrorInfo"}, - {906, nullptr, "RegisterTransferTaskErrorInfo"}, - {907, nullptr, "AddSaveDataArchiveInfoCache"}, - {908, nullptr, "DeleteSeriesInfo"}, - {909, nullptr, "GetSeriesInfo"}, - {910, nullptr, "RemoveTransferTaskErrorInfo"}, - {911, nullptr, "DeleteAllSeriesInfoForSaveDataBackup"}, - {912, nullptr, "DeleteSeriesInfoForSaveDataBackup"}, - {913, nullptr, "GetSeriesInfoForSaveDataBackup"}, - {914, nullptr, "Unknown914"}, //20.2.0+ - {1000, nullptr, "UpdateIssueOld"}, - {1010, nullptr, "Unknown1010"}, - {1011, nullptr, "Unknown1011"}, - {1012, nullptr, "Unknown1012"}, - {1013, nullptr, "Unkown1013"}, - {1014, nullptr, "Unknown1014"}, - {1020, nullptr, "Unknown1020"}, - {1021, nullptr, "Unknown1021"}, - {1022, nullptr, "Unknown1022"}, - {1023, nullptr, "Unknown1023"}, - {1024, nullptr, "Unknown1024"}, - {1100, nullptr, "RepairUpdateIssueInfoCacheAync"}, - {1110, nullptr, "RepairGetIssueInfo"}, - {1111, nullptr, "RepairListIssueInfo"}, - {1112, nullptr, "RepairListOperationPermissionInfo"}, - {1113, nullptr, "RepairListDataInfoForRepairedSaveDataDownload"}, - {1114, nullptr, "RepairListDataInfoForOriginalSaveDataDownload"}, - {1120, nullptr, "RepairUploadSaveDataAsync"}, - {1121, nullptr, "RepairUploadSaveDataAsync1"}, - {1122, nullptr, "RepairDownloadRepairedSaveDataAsync"}, - {1123, nullptr, "RepairDownloadOriginalSaveDataAsync"}, - {1124, nullptr, "RepairGetOperationProgressInfo"}, - {10000, D<&IOlscServiceForSystemService::GetOlscServiceForSystemService>, "GetOlscServiceForSystemService"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - -IOlscServiceForSystemService::~IOlscServiceForSystemService() = default; - -Result IOlscServiceForSystemService::GetTransferTaskListController( - Out> out_interface) { - LOG_INFO(Service_OLSC, "called"); - *out_interface = std::make_shared(system); - R_SUCCEED(); -} - -Result IOlscServiceForSystemService::GetRemoteStorageController( - Out> out_interface) { - LOG_INFO(Service_OLSC, "called"); - *out_interface = std::make_shared(system); - R_SUCCEED(); -} - -Result IOlscServiceForSystemService::GetDaemonController( - Out> out_interface) { - LOG_INFO(Service_OLSC, "called"); - *out_interface = std::make_shared(system); - R_SUCCEED(); -} - -Result IOlscServiceForSystemService::GetDataTransferPolicy( - Out out_policy, u64 application_id) { - LOG_WARNING(Service_OLSC, "(STUBBED) called"); - DataTransferPolicy policy{}; - policy.upload_policy = 0; - policy.download_policy = 0; - *out_policy = policy; - R_SUCCEED(); -} - -Result IOlscServiceForSystemService::GetTransferTaskErrorInfo(Out out_info, - Common::UUID uuid, u64 application_id) { - LOG_WARNING(Service_OLSC, "(STUBBED) called, uuid={} application_id={:016X}", - uuid.FormattedString(), application_id); - - TransferTaskErrorInfo info{}; - info.uid = uuid; - info.application_id = application_id; - info.unknown_0x18 = 0; - info.reserved_0x19.fill(0); - info.unknown_0x20 = 0; - info.error_code = 0; - info.reserved_0x2C = 0; - - *out_info = info; - R_SUCCEED(); -} - -Result IOlscServiceForSystemService::GetOlscServiceForSystemService( - Out> out_interface) { - LOG_INFO(Service_OLSC, "called"); - *out_interface = std::static_pointer_cast(shared_from_this()); - R_SUCCEED(); -} - -} // namespace Service::OLSC diff --git a/src/core/hle/service/olsc/olsc_service_for_system_service.h b/src/core/hle/service/olsc/olsc_service_for_system_service.h deleted file mode 100644 index d16c8b979b..0000000000 --- a/src/core/hle/service/olsc/olsc_service_for_system_service.h +++ /dev/null @@ -1,53 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include - -#include "common/uuid.h" -#include "core/hle/service/cmif_types.h" -#include "core/hle/service/service.h" - -namespace Service::OLSC { - -class IDaemonController; -class IRemoteStorageController; -class ITransferTaskListController; - -struct DataTransferPolicy { - u8 upload_policy; - u8 download_policy; -}; - -struct TransferTaskErrorInfo { - Common::UUID uid; - u64 application_id; - u8 unknown_0x18; - std::array reserved_0x19; - u64 unknown_0x20; - u32 error_code; - u32 reserved_0x2C; -}; -static_assert(sizeof(TransferTaskErrorInfo) == 0x30, "TransferTaskErrorInfo has incorrect size."); - -class IOlscServiceForSystemService final : public ServiceFramework { -public: - explicit IOlscServiceForSystemService(Core::System& system_); - ~IOlscServiceForSystemService() override; - -private: - Result GetTransferTaskListController( - Out> out_interface); - Result GetRemoteStorageController(Out> out_interface); - Result GetDaemonController(Out> out_interface); - Result GetDataTransferPolicy(Out out_policy, u64 application_id); - Result GetTransferTaskErrorInfo(Out out_info, Common::UUID uid, u64 application_id); - Result GetOlscServiceForSystemService( - Out> out_interface); -}; - -} // namespace Service::OLSC diff --git a/src/core/hle/service/olsc/remote_storage_controller.cpp b/src/core/hle/service/olsc/remote_storage_controller.cpp index 817097b426..1e7825da30 100644 --- a/src/core/hle/service/olsc/remote_storage_controller.cpp +++ b/src/core/hle/service/olsc/remote_storage_controller.cpp @@ -9,44 +9,44 @@ namespace Service::OLSC { + std::optional IRemoteStorageController::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetSaveDataArchiveInfoBySaveDataId"}, + FunctionInfo{1, nullptr, "GetSaveDataArchiveInfoByApplicationId"}, + FunctionInfo{3, nullptr, "GetSaveDataArchiveCount"}, + FunctionInfo{6, nullptr, "CleanupSaveDataArchives"}, + FunctionInfo{7, nullptr, "CreateSaveDataArchiveCacheUpdationTask"}, + FunctionInfo{8, nullptr, "CreateSaveDataArchiveCacheUpdationForSpecifiedApplicationTask"}, + FunctionInfo{9, nullptr, "Delete"}, + FunctionInfo{10, nullptr, "GetSeriesInfo"}, + FunctionInfo{11, nullptr, "CreateDeleteDataTask"}, + FunctionInfo{12, nullptr, "DeleteSeriesInfo"}, + FunctionInfo{13, nullptr, "CreateRegisterNotificationTokenTask"}, + FunctionInfo{14, D<&IRemoteStorageController::GetDataNewnessByApplicationId>, "GetDataNewnessByApplicationId"}, + FunctionInfo{15, nullptr, "RegisterUploadSaveDataTransferTaskForAutonomyRegistration"}, + FunctionInfo{16, nullptr, "CreateCleanupToDeleteSaveDataArchiveInfoTask"}, + FunctionInfo{17, nullptr, "ListDataInfo"}, + FunctionInfo{18, D<&IRemoteStorageController::GetDataInfo>, "GetDataInfoV1"}, + FunctionInfo{19, nullptr, "GetDataInfoCacheUpdateNativeHandleHolder"}, + FunctionInfo{20, nullptr, "CreateSaveDataArchiveInfoCacheForSaveDataBackupUpdationTask"}, + FunctionInfo{21, nullptr, "ListSecondarySaves"}, + FunctionInfo{22, D<&IRemoteStorageController::GetSecondarySave>, "GetSecondarySave"}, + FunctionInfo{23, nullptr, "TouchSecondarySave"}, + FunctionInfo{24, nullptr, "GetSecondarySaveDataInfo"}, + FunctionInfo{25, nullptr, "RegisterDownloadSaveDataTransferTaskForAutonomyRegistration"}, + FunctionInfo{26, nullptr, "Unknown26", MakeVersionGate({20,0,0})}, + FunctionInfo{27, D<&IRemoteStorageController::GetDataInfo>, "GetDataInfoV2", MakeVersionGate({20,0,0})}, + FunctionInfo{28, nullptr, "Unknown28", MakeVersionGate({20,0,0})}, + FunctionInfo{29, nullptr, "Unknown29", MakeVersionGate({21,0,0})}, + FunctionInfo{800, nullptr, "Unknown800", MakeVersionGate({20,0,0})}, + FunctionInfo{900, nullptr, "SetLoadedDataMissing"}, + FunctionInfo{901, nullptr, "Unknown901", MakeVersionGate({20,2,0})} + ); + return HandlerTableGenerateWithFind(key, functions); + } + IRemoteStorageController::IRemoteStorageController(Core::System& system_) : ServiceFramework{system_, "IRemoteStorageController"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetSaveDataArchiveInfoBySaveDataId"}, - {1, nullptr, "GetSaveDataArchiveInfoByApplicationId"}, - {3, nullptr, "GetSaveDataArchiveCount"}, - {6, nullptr, "CleanupSaveDataArchives"}, - {7, nullptr, "CreateSaveDataArchiveCacheUpdationTask"}, - {8, nullptr, "CreateSaveDataArchiveCacheUpdationForSpecifiedApplicationTask"}, - {9, nullptr, "Delete"}, - {10, nullptr, "GetSeriesInfo"}, - {11, nullptr, "CreateDeleteDataTask"}, - {12, nullptr, "DeleteSeriesInfo"}, - {13, nullptr, "CreateRegisterNotificationTokenTask"}, - {14, D<&IRemoteStorageController::GetDataNewnessByApplicationId>, "GetDataNewnessByApplicationId"}, - {15, nullptr, "RegisterUploadSaveDataTransferTaskForAutonomyRegistration"}, - {16, nullptr, "CreateCleanupToDeleteSaveDataArchiveInfoTask"}, - {17, nullptr, "ListDataInfo"}, - {18, D<&IRemoteStorageController::GetDataInfo>, "GetDataInfoV1"}, - {19, nullptr, "GetDataInfoCacheUpdateNativeHandleHolder"}, - {20, nullptr, "CreateSaveDataArchiveInfoCacheForSaveDataBackupUpdationTask"}, - {21, nullptr, "ListSecondarySaves"}, - {22, D<&IRemoteStorageController::GetSecondarySave>, "GetSecondarySave"}, - {23, nullptr, "TouchSecondarySave"}, - {24, nullptr, "GetSecondarySaveDataInfo"}, - {25, nullptr, "RegisterDownloadSaveDataTransferTaskForAutonomyRegistration"}, - {26, nullptr, "Unknown26"}, //20.0.0+ - {27, D<&IRemoteStorageController::GetDataInfo>, "GetDataInfoV2"}, //20.0.0+ - {28, nullptr, "Unknown28"}, //20.0.0+ - {29, nullptr, "Unknown29"}, //21.0.0+ - {800, nullptr, "Unknown800"}, //20.0.0+ - {900, nullptr, "SetLoadedDataMissing"}, - {901, nullptr, "Unknown901"}, //20.2.0+ - }; - // clang-format on - - RegisterHandlers(functions); } IRemoteStorageController::~IRemoteStorageController() = default; diff --git a/src/core/hle/service/olsc/remote_storage_controller.h b/src/core/hle/service/olsc/remote_storage_controller.h index 21b439013a..20503d9800 100644 --- a/src/core/hle/service/olsc/remote_storage_controller.h +++ b/src/core/hle/service/olsc/remote_storage_controller.h @@ -21,6 +21,8 @@ private: u64 application_id); Result GetDataNewnessByApplicationId(Out out_newness, u64 application_id); Result GetDataInfo(Out> out_data, u64 application_id); + + std::optional FindRequest(u32 key) override; }; } // namespace Service::OLSC diff --git a/src/core/hle/service/olsc/transfer_task_list_controller.cpp b/src/core/hle/service/olsc/transfer_task_list_controller.cpp index 95e41cdb51..af090fc292 100644 --- a/src/core/hle/service/olsc/transfer_task_list_controller.cpp +++ b/src/core/hle/service/olsc/transfer_task_list_controller.cpp @@ -11,45 +11,45 @@ namespace Service::OLSC { + std::optional ITransferTaskListController::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetTransferTaskCountForOcean"}, + FunctionInfo{1, nullptr, "GetTransferTaskInfoForOcean"}, + FunctionInfo{2, nullptr, "ListTransferTaskInfoForOcean"}, + FunctionInfo{3, nullptr, "DeleteTransferTaskForOcean"}, + FunctionInfo{4, nullptr, "RaiseTransferTaskPriorityForOcean"}, + FunctionInfo{5, D<&ITransferTaskListController::GetTransferTaskEndEventNativeHandleHolder>, "GetTransferTaskEndEventNativeHandleHolder"}, + FunctionInfo{6, nullptr, "GetTransferTaskProgressForOcean"}, + FunctionInfo{7, nullptr, "GetTransferTaskLastResultForOcean"}, + FunctionInfo{8, D<&ITransferTaskListController::StopNextTransferTaskExecution>, "StopNextTransferTaskExecution"}, + FunctionInfo{9, D<&ITransferTaskListController::GetTransferTaskStartEventNativeHandleHolder>, "GetTransferTaskStartEventNativeHandleHolder"}, + FunctionInfo{10, nullptr, "SuspendTransferTaskForOcean"}, + FunctionInfo{11, nullptr, "GetCurrentTransferTaskInfoForOcean"}, + FunctionInfo{12, nullptr, "FindTransferTaskInfoForOcean"}, + FunctionInfo{13, nullptr, "CancelCurrentRepairTransferTask"}, + FunctionInfo{14, nullptr, "GetRepairTransferTaskProgress"}, + FunctionInfo{15, nullptr, "EnsureExecutableForRepairTransferTask"}, + FunctionInfo{16, D<&ITransferTaskListController::GetTransferTaskCount>, "GetTransferTaskCount"}, + FunctionInfo{17, nullptr, "GetTransferTaskInfo"}, + FunctionInfo{18, nullptr, "ListTransferTaskInfo"}, + FunctionInfo{19, nullptr, "DeleteTransferTask"}, + FunctionInfo{20, nullptr, "RaiseTransferTaskPriority"}, + FunctionInfo{21, D<&ITransferTaskListController::GetTransferTaskProgress>, "GetTransferTaskProgress", MakeVersionGate({10,1,0})}, + FunctionInfo{22, nullptr, "GetTransferTaskLastResult"}, + FunctionInfo{23, nullptr, "SuspendTransferTask"}, + FunctionInfo{24, D<&ITransferTaskListController::GetCurrentTransferTaskInfo>, "GetCurrentTransferTaskInfo"}, + FunctionInfo{25, D<&ITransferTaskListController::FindTransferTaskInfo>, "FindTransferTaskInfo"}, + FunctionInfo{26, nullptr, "Unknown26", MakeVersionGate({20,1,0})}, + FunctionInfo{27, nullptr, "Unknown27", MakeVersionGate({20,1,0})}, + FunctionInfo{28, nullptr, "Unknown28", MakeVersionGate({20,1,0})}, + FunctionInfo{29, nullptr, "Unknown29", MakeVersionGate({20,1,0})}, + FunctionInfo{30, nullptr, "Unknown30", MakeVersionGate({20,1,0})} + ); + return HandlerTableGenerateWithFind(key, functions); + } + ITransferTaskListController::ITransferTaskListController(Core::System& system_) : ServiceFramework{system_, "ITransferTaskListController"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetTransferTaskCountForOcean"}, - {1, nullptr, "GetTransferTaskInfoForOcean"}, - {2, nullptr, "ListTransferTaskInfoForOcean"}, - {3, nullptr, "DeleteTransferTaskForOcean"}, - {4, nullptr, "RaiseTransferTaskPriorityForOcean"}, - {5, D<&ITransferTaskListController::GetTransferTaskEndEventNativeHandleHolder>, "GetTransferTaskEndEventNativeHandleHolder"}, - {6, nullptr, "GetTransferTaskProgressForOcean"}, - {7, nullptr, "GetTransferTaskLastResultForOcean"}, - {8, D<&ITransferTaskListController::StopNextTransferTaskExecution>, "StopNextTransferTaskExecution"}, - {9, D<&ITransferTaskListController::GetTransferTaskStartEventNativeHandleHolder>, "GetTransferTaskStartEventNativeHandleHolder"}, - {10, nullptr, "SuspendTransferTaskForOcean"}, - {11, nullptr, "GetCurrentTransferTaskInfoForOcean"}, - {12, nullptr, "FindTransferTaskInfoForOcean"}, - {13, nullptr, "CancelCurrentRepairTransferTask"}, - {14, nullptr, "GetRepairTransferTaskProgress"}, - {15, nullptr, "EnsureExecutableForRepairTransferTask"}, - {16, D<&ITransferTaskListController::GetTransferTaskCount>, "GetTransferTaskCount"}, - {17, nullptr, "GetTransferTaskInfo"}, - {18, nullptr, "ListTransferTaskInfo"}, - {19, nullptr, "DeleteTransferTask"}, - {20, nullptr, "RaiseTransferTaskPriority"}, - {21, D<&ITransferTaskListController::GetTransferTaskProgress>, "GetTransferTaskProgress"}, //10.1.0+ - {22, nullptr, "GetTransferTaskLastResult"}, - {23, nullptr, "SuspendTransferTask"}, - {24, D<&ITransferTaskListController::GetCurrentTransferTaskInfo>, "GetCurrentTransferTaskInfo"}, - {25, D<&ITransferTaskListController::FindTransferTaskInfo>, "FindTransferTaskInfo"}, - {26, nullptr, "Unknown26"}, //20.1.0+ - {27, nullptr, "Unknown27"}, //20.1.0+ - {28, nullptr, "Unknown28"}, //20.1.0+ - {29, nullptr, "Unknown29"}, //20.1.0+ - {30, nullptr, "Unknown30"}, //20.1.0+ - }; - // clang-format on - - RegisterHandlers(functions); } ITransferTaskListController::~ITransferTaskListController() = default; diff --git a/src/core/hle/service/olsc/transfer_task_list_controller.h b/src/core/hle/service/olsc/transfer_task_list_controller.h index 5f3429879a..74c5eddee3 100644 --- a/src/core/hle/service/olsc/transfer_task_list_controller.h +++ b/src/core/hle/service/olsc/transfer_task_list_controller.h @@ -27,6 +27,8 @@ private: Result GetTransferTaskProgress(); Result GetCurrentTransferTaskInfo(Out> out_info, u8 unknown); Result FindTransferTaskInfo(Out> out_info, InBuffer in); + + std::optional FindRequest(u32 key) override; }; } // namespace Service::OLSC diff --git a/src/core/hle/service/omm/operation_mode_manager.cpp b/src/core/hle/service/omm/operation_mode_manager.cpp index fe7ed84a7f..e36f606442 100644 --- a/src/core/hle/service/omm/operation_mode_manager.cpp +++ b/src/core/hle/service/omm/operation_mode_manager.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -7,41 +10,6 @@ namespace Service::OMM { IOperationModeManager::IOperationModeManager(Core::System& system_) : ServiceFramework{system_, "omm"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetOperationMode"}, - {1, nullptr, "GetOperationModeChangeEvent"}, - {2, nullptr, "EnableAudioVisual"}, - {3, nullptr, "DisableAudioVisual"}, - {4, nullptr, "EnterSleepAndWait"}, - {5, nullptr, "GetCradleStatus"}, - {6, nullptr, "FadeInDisplay"}, - {7, nullptr, "FadeOutDisplay"}, - {8, nullptr, "GetCradleFwVersion"}, - {9, nullptr, "NotifyCecSettingsChanged"}, - {10, nullptr, "SetOperationModePolicy"}, - {11, nullptr, "GetDefaultDisplayResolution"}, - {12, nullptr, "GetDefaultDisplayResolutionChangeEvent"}, - {13, nullptr, "UpdateDefaultDisplayResolution"}, - {14, nullptr, "ShouldSleepOnBoot"}, - {15, nullptr, "NotifyHdcpApplicationExecutionStarted"}, - {16, nullptr, "NotifyHdcpApplicationExecutionFinished"}, - {17, nullptr, "NotifyHdcpApplicationDrawingStarted"}, - {18, nullptr, "NotifyHdcpApplicationDrawingFinished"}, - {19, nullptr, "GetHdcpAuthenticationFailedEvent"}, - {20, nullptr, "GetHdcpAuthenticationFailedEmulationEnabled"}, - {21, nullptr, "SetHdcpAuthenticationFailedEmulation"}, - {22, nullptr, "GetHdcpStateChangeEvent"}, - {23, nullptr, "GetHdcpState"}, - {24, nullptr, "ShowCardUpdateProcessing"}, - {25, nullptr, "SetApplicationCecSettingsAndNotifyChanged"}, - {26, nullptr, "GetOperationModeSystemInfo"}, - {27, nullptr, "GetAppletFullAwakingSystemEvent"}, - {28, nullptr, "CreateCradleFirmwareUpdater"}, - }; - // clang-format on - - RegisterHandlers(functions); } IOperationModeManager::~IOperationModeManager() = default; diff --git a/src/core/hle/service/omm/operation_mode_manager.h b/src/core/hle/service/omm/operation_mode_manager.h index 32bc7b2f93..ea604c8f60 100644 --- a/src/core/hle/service/omm/operation_mode_manager.h +++ b/src/core/hle/service/omm/operation_mode_manager.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -15,6 +18,41 @@ class IOperationModeManager final : public ServiceFramework FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetOperationMode"}, + FunctionInfo{1, nullptr, "GetOperationModeChangeEvent"}, + FunctionInfo{2, nullptr, "EnableAudioVisual"}, + FunctionInfo{3, nullptr, "DisableAudioVisual"}, + FunctionInfo{4, nullptr, "EnterSleepAndWait"}, + FunctionInfo{5, nullptr, "GetCradleStatus"}, + FunctionInfo{6, nullptr, "FadeInDisplay"}, + FunctionInfo{7, nullptr, "FadeOutDisplay"}, + FunctionInfo{8, nullptr, "GetCradleFwVersion"}, + FunctionInfo{9, nullptr, "NotifyCecSettingsChanged"}, + FunctionInfo{10, nullptr, "SetOperationModePolicy"}, + FunctionInfo{11, nullptr, "GetDefaultDisplayResolution"}, + FunctionInfo{12, nullptr, "GetDefaultDisplayResolutionChangeEvent"}, + FunctionInfo{13, nullptr, "UpdateDefaultDisplayResolution"}, + FunctionInfo{14, nullptr, "ShouldSleepOnBoot"}, + FunctionInfo{15, nullptr, "NotifyHdcpApplicationExecutionStarted"}, + FunctionInfo{16, nullptr, "NotifyHdcpApplicationExecutionFinished"}, + FunctionInfo{17, nullptr, "NotifyHdcpApplicationDrawingStarted"}, + FunctionInfo{18, nullptr, "NotifyHdcpApplicationDrawingFinished"}, + FunctionInfo{19, nullptr, "GetHdcpAuthenticationFailedEvent"}, + FunctionInfo{20, nullptr, "GetHdcpAuthenticationFailedEmulationEnabled"}, + FunctionInfo{21, nullptr, "SetHdcpAuthenticationFailedEmulation"}, + FunctionInfo{22, nullptr, "GetHdcpStateChangeEvent"}, + FunctionInfo{23, nullptr, "GetHdcpState"}, + FunctionInfo{24, nullptr, "ShowCardUpdateProcessing"}, + FunctionInfo{25, nullptr, "SetApplicationCecSettingsAndNotifyChanged"}, + FunctionInfo{26, nullptr, "GetOperationModeSystemInfo"}, + FunctionInfo{27, nullptr, "GetAppletFullAwakingSystemEvent"}, + FunctionInfo{28, nullptr, "CreateCradleFirmwareUpdater"} + ); }; } // namespace Service::OMM diff --git a/src/core/hle/service/omm/policy_manager_system.cpp b/src/core/hle/service/omm/policy_manager_system.cpp index 1cd6fd807b..1d46de7f3e 100644 --- a/src/core/hle/service/omm/policy_manager_system.cpp +++ b/src/core/hle/service/omm/policy_manager_system.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -7,18 +10,6 @@ namespace Service::OMM { IPolicyManagerSystem::IPolicyManagerSystem(Core::System& system_) : ServiceFramework{system_, "idle:sys"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetAutoPowerDownEvent"}, - {1, nullptr, "IsAutoPowerDownRequested"}, - {2, nullptr, "Unknown2"}, - {3, nullptr, "SetHandlingContext"}, - {4, nullptr, "LoadAndApplySettings"}, - {5, nullptr, "ReportUserIsActive"}, - }; - // clang-format on - - RegisterHandlers(functions); } IPolicyManagerSystem::~IPolicyManagerSystem() = default; diff --git a/src/core/hle/service/omm/policy_manager_system.h b/src/core/hle/service/omm/policy_manager_system.h index 151ca0d2ee..c6ff451e61 100644 --- a/src/core/hle/service/omm/policy_manager_system.h +++ b/src/core/hle/service/omm/policy_manager_system.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -15,6 +18,18 @@ class IPolicyManagerSystem final : public ServiceFramework public: explicit IPolicyManagerSystem(Core::System& system_); ~IPolicyManagerSystem() override; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetAutoPowerDownEvent"}, + FunctionInfo{1, nullptr, "IsAutoPowerDownRequested"}, + FunctionInfo{2, nullptr, "Unknown2"}, + FunctionInfo{3, nullptr, "SetHandlingContext"}, + FunctionInfo{4, nullptr, "LoadAndApplySettings"}, + FunctionInfo{5, nullptr, "ReportUserIsActive"} + ); }; } // namespace Service::OMM diff --git a/src/core/hle/service/omm/power_state_interface.cpp b/src/core/hle/service/omm/power_state_interface.cpp index 22cac82595..4150882695 100644 --- a/src/core/hle/service/omm/power_state_interface.cpp +++ b/src/core/hle/service/omm/power_state_interface.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -7,24 +10,6 @@ namespace Service::OMM { IPowerStateInterface::IPowerStateInterface(Core::System& system_) : ServiceFramework{system_, "spsm"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetState"}, - {1, nullptr, "EnterSleep"}, - {2, nullptr, "GetLastWakeReason"}, - {3, nullptr, "Shutdown"}, - {4, nullptr, "GetNotificationMessageEventHandle"}, - {5, nullptr, "ReceiveNotificationMessage"}, - {6, nullptr, "AnalyzeLogForLastSleepWakeSequence"}, - {7, nullptr, "ResetEventLog"}, - {8, nullptr, "AnalyzePerformanceLogForLastSleepWakeSequence"}, - {9, nullptr, "ChangeHomeButtonLongPressingTime"}, - {10, nullptr, "PutErrorState"}, - {11, nullptr, "InvalidateCurrentHomeButtonPressing"}, - }; - // clang-format on - - RegisterHandlers(functions); } IPowerStateInterface::~IPowerStateInterface() = default; diff --git a/src/core/hle/service/omm/power_state_interface.h b/src/core/hle/service/omm/power_state_interface.h index 825a6512d9..fed55a4361 100644 --- a/src/core/hle/service/omm/power_state_interface.h +++ b/src/core/hle/service/omm/power_state_interface.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -15,6 +18,24 @@ class IPowerStateInterface final : public ServiceFramework public: explicit IPowerStateInterface(Core::System& system_); ~IPowerStateInterface() override; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetState"}, + FunctionInfo{1, nullptr, "EnterSleep"}, + FunctionInfo{2, nullptr, "GetLastWakeReason"}, + FunctionInfo{3, nullptr, "Shutdown"}, + FunctionInfo{4, nullptr, "GetNotificationMessageEventHandle"}, + FunctionInfo{5, nullptr, "ReceiveNotificationMessage"}, + FunctionInfo{6, nullptr, "AnalyzeLogForLastSleepWakeSequence"}, + FunctionInfo{7, nullptr, "ResetEventLog"}, + FunctionInfo{8, nullptr, "AnalyzePerformanceLogForLastSleepWakeSequence"}, + FunctionInfo{9, nullptr, "ChangeHomeButtonLongPressingTime"}, + FunctionInfo{10, nullptr, "PutErrorState"}, + FunctionInfo{11, nullptr, "InvalidateCurrentHomeButtonPressing"} + ); }; } // namespace Service::OMM diff --git a/src/core/hle/service/pcie/pcie.cpp b/src/core/hle/service/pcie/pcie.cpp index d162881ecf..f9aaa2d3b8 100644 --- a/src/core/hle/service/pcie/pcie.cpp +++ b/src/core/hle/service/pcie/pcie.cpp @@ -15,64 +15,62 @@ namespace Service::PCIe { class ISession final : public ServiceFramework { public: - explicit ISession(Core::System& system_) : ServiceFramework{system_, "ISession"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "QueryFunctions"}, - {1, nullptr, "AcquireFunction"}, - {2, nullptr, "ReleaseFunction"}, - {3, nullptr, "GetFunctionState"}, - {4, nullptr, "GetBarProfile"}, - {5, nullptr, "ReadConfig"}, - {6, nullptr, "WriteConfig"}, - {7, nullptr, "ReadBarRegion"}, - {8, nullptr, "WriteBarRegion"}, - {9, nullptr, "FindCapability"}, - {10, nullptr, "FindExtendedCapability"}, - {11, nullptr, "MapDma"}, - {12, nullptr, "UnmapDma"}, - {13, nullptr, "UnmapDmaBusAddress"}, - {14, nullptr, "GetDmaBusAddress"}, - {15, nullptr, "GetDmaBusAddressRange"}, - {16, nullptr, "SetDmaEnable"}, - {17, nullptr, "AcquireIrq"}, - {18, nullptr, "ReleaseIrq"}, - {19, nullptr, "SetIrqEnable"}, - {20, nullptr, "GetIrqEvent"}, - {21, nullptr, "SetAspmEnable"}, - {22, nullptr, "SetResetUponResumeEnable"}, - {23, nullptr, "ResetFunction"}, - }; - // clang-format on + explicit ISession(Core::System& system_) : ServiceFramework{system_, "ISession"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "QueryFunctions"}, + FunctionInfo{1, nullptr, "AcquireFunction"}, + FunctionInfo{2, nullptr, "ReleaseFunction"}, + FunctionInfo{3, nullptr, "GetFunctionState"}, + FunctionInfo{4, nullptr, "GetBarProfile"}, + FunctionInfo{5, nullptr, "ReadConfig"}, + FunctionInfo{6, nullptr, "WriteConfig"}, + FunctionInfo{7, nullptr, "ReadBarRegion"}, + FunctionInfo{8, nullptr, "WriteBarRegion"}, + FunctionInfo{9, nullptr, "FindCapability"}, + FunctionInfo{10, nullptr, "FindExtendedCapability"}, + FunctionInfo{11, nullptr, "MapDma"}, + FunctionInfo{12, nullptr, "UnmapDma"}, + FunctionInfo{13, nullptr, "UnmapDmaBusAddress"}, + FunctionInfo{14, nullptr, "GetDmaBusAddress"}, + FunctionInfo{15, nullptr, "GetDmaBusAddressRange"}, + FunctionInfo{16, nullptr, "SetDmaEnable"}, + FunctionInfo{17, nullptr, "AcquireIrq"}, + FunctionInfo{18, nullptr, "ReleaseIrq"}, + FunctionInfo{19, nullptr, "SetIrqEnable"}, + FunctionInfo{20, nullptr, "GetIrqEvent"}, + FunctionInfo{21, nullptr, "SetAspmEnable"}, + FunctionInfo{22, nullptr, "SetResetUponResumeEnable"}, + FunctionInfo{23, nullptr, "ResetFunction"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class PCIE final : public ServiceFramework { public: - explicit PCIE(Core::System& system_) : ServiceFramework{system_, "pcie"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "RegisterClassDriver"}, - {1, nullptr, "QueryFunctionsUnregistered"}, - }; - // clang-format on + explicit PCIE(Core::System& system_) : ServiceFramework{system_, "pcie"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "RegisterClassDriver"}, + FunctionInfo{1, nullptr, "QueryFunctionsUnregistered"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class PCIE_LOG final : public ServiceFramework { public: - explicit PCIE_LOG(Core::System& system_) : ServiceFramework{system_, "pcie:log"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetLoggedState"}, - {1, nullptr, "GetLoggedStateEvent"}, - }; - // clang-format on - RegisterHandlers(functions); + explicit PCIE_LOG(Core::System& system_) : ServiceFramework{system_, "pcie:log"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetLoggedState"}, + FunctionInfo{1, nullptr, "GetLoggedStateEvent"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; diff --git a/src/core/hle/service/pctl/parental_control_service.cpp b/src/core/hle/service/pctl/parental_control_service.cpp deleted file mode 100644 index 51953c2657..0000000000 --- a/src/core/hle/service/pctl/parental_control_service.cpp +++ /dev/null @@ -1,498 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include - -#include "core/core.h" -#include "core/file_sys/control_metadata.h" -#include "core/file_sys/patch_manager.h" -#include "core/hle/service/cmif_serialization.h" -#include "core/hle/service/pctl/parental_control_service.h" -#include "core/hle/service/pctl/pctl_results.h" - -namespace Service::PCTL { - -IParentalControlService::IParentalControlService(Core::System& system_, Capability capability_, - u64 program_id_) - : ServiceFramework{system_, "IParentalControlService"}, capability{capability_}, - program_id{program_id_}, - service_context{system_, "IParentalControlService"}, synchronization_event{service_context}, - unlinked_event{service_context}, request_suspension_event{service_context} { - // clang-format off - static const FunctionInfo functions[] = { - {1, D<&IParentalControlService::Initialize>, "Initialize"}, - {1001, D<&IParentalControlService::CheckFreeCommunicationPermission>, "CheckFreeCommunicationPermission"}, - {1002, D<&IParentalControlService::ConfirmLaunchApplicationPermission>, "ConfirmLaunchApplicationPermission"}, - {1003, D<&IParentalControlService::ConfirmResumeApplicationPermission>, "ConfirmResumeApplicationPermission"}, - {1004, D<&IParentalControlService::ConfirmSnsPostPermission>, "ConfirmSnsPostPermission"}, - {1005, D<&IParentalControlService::ConfirmSystemSettingsPermission>, "ConfirmSystemSettingsPermission"}, - {1006, D<&IParentalControlService::IsRestrictionTemporaryUnlocked>, "IsRestrictionTemporaryUnlocked"}, - {1007, nullptr, "RevertRestrictionTemporaryUnlocked"}, - {1008, nullptr, "EnterRestrictedSystemSettings"}, - {1009, nullptr, "LeaveRestrictedSystemSettings"}, - {1010, D<&IParentalControlService::IsRestrictedSystemSettingsEntered>, "IsRestrictedSystemSettingsEntered"}, - {1011, nullptr, "RevertRestrictedSystemSettingsEntered"}, - {1012, nullptr, "GetRestrictedFeatures"}, - {1013, D<&IParentalControlService::ConfirmStereoVisionPermission>, "ConfirmStereoVisionPermission"}, - {1014, nullptr, "ConfirmPlayableApplicationVideoOld"}, - {1015, nullptr, "ConfirmPlayableApplicationVideo"}, - {1016, nullptr, "ConfirmShowNewsPermission"}, - {1017, D<&IParentalControlService::EndFreeCommunication>, "EndFreeCommunication"}, - {1018, D<&IParentalControlService::IsFreeCommunicationAvailable>, "IsFreeCommunicationAvailable"}, - {1019, D<&IParentalControlService::ConfirmLaunchApplicationPermission>, "ConfirmLaunchApplicationPermission"}, - {1020, nullptr, "ConfirmLaunchSharedApplicationPermission"}, //20.0.0+ - {1021, nullptr, "TryBeginFreeCommunicationForStreamPlay"}, //21.0.0+ - {1022, nullptr, "EndFreeCommunicationForStreamPlay"}, //21.0.0+ - {1031, D<&IParentalControlService::IsRestrictionEnabled>, "IsRestrictionEnabled"}, - {1032, D<&IParentalControlService::GetSafetyLevel>, "GetSafetyLevel"}, - {1033, nullptr, "SetSafetyLevel"}, - {1034, nullptr, "GetSafetyLevelSettings"}, - {1035, D<&IParentalControlService::GetCurrentSettings>, "GetCurrentSettings"}, - {1036, nullptr, "SetCustomSafetyLevelSettings"}, - {1037, nullptr, "GetDefaultRatingOrganization"}, - {1038, nullptr, "SetDefaultRatingOrganization"}, - {1039, D<&IParentalControlService::GetFreeCommunicationApplicationListCount>, "GetFreeCommunicationApplicationListCount"}, - {1042, nullptr, "AddToFreeCommunicationApplicationList"}, - {1043, nullptr, "DeleteSettings"}, - {1044, nullptr, "GetFreeCommunicationApplicationList"}, - {1045, nullptr, "UpdateFreeCommunicationApplicationList"}, - {1046, nullptr, "DisableFeaturesForReset"}, - {1047, nullptr, "NotifyApplicationDownloadStarted"}, - {1048, nullptr, "NotifyNetworkProfileCreated"}, - {1049, nullptr, "ResetFreeCommunicationApplicationList"}, - {1050, nullptr, "AddToFreeCommunicationApplicationList"}, //20.0.0+ - {1051, nullptr, "NotifyApplicationDownloadStarted"}, //20.0.0+ - {1061, D<&IParentalControlService::ConfirmStereoVisionRestrictionConfigurable>, "ConfirmStereoVisionRestrictionConfigurable"}, - {1062, D<&IParentalControlService::GetStereoVisionRestriction>, "GetStereoVisionRestriction"}, - {1063, D<&IParentalControlService::SetStereoVisionRestriction>, "SetStereoVisionRestriction"}, - {1064, D<&IParentalControlService::ResetConfirmedStereoVisionPermission>, "ResetConfirmedStereoVisionPermission"}, - {1065, D<&IParentalControlService::IsStereoVisionPermitted>, "IsStereoVisionPermitted"}, - {1201, nullptr, "UnlockRestrictionTemporarily"}, - {1202, nullptr, "UnlockSystemSettingsRestriction"}, - {1203, nullptr, "SetPinCode"}, - {1204, nullptr, "GenerateInquiryCode"}, - {1205, nullptr, "CheckMasterKey"}, - {1206, D<&IParentalControlService::GetPinCodeLength>, "GetPinCodeLength"}, - {1207, nullptr, "GetPinCodeChangedEvent"}, - {1208, nullptr, "GetPinCode"}, - {1403, D<&IParentalControlService::IsPairingActive>, "IsPairingActive"}, - {1406, nullptr, "GetSettingsLastUpdated"}, - {1411, nullptr, "GetPairingAccountInfo"}, - {1421, nullptr, "GetAccountNickname"}, - {1424, nullptr, "GetAccountState"}, - {1425, nullptr, "RequestPostEvents"}, - {1426, nullptr, "GetPostEventInterval"}, - {1427, nullptr, "SetPostEventInterval"}, - {1432, D<&IParentalControlService::GetSynchronizationEvent>, "GetSynchronizationEvent"}, - {1451, D<&IParentalControlService::StartPlayTimer>, "StartPlayTimer"}, - {1452, D<&IParentalControlService::StopPlayTimer>, "StopPlayTimer"}, - {1453, D<&IParentalControlService::IsPlayTimerEnabled>, "IsPlayTimerEnabled"}, - {1454, D<&IParentalControlService::GetPlayTimerRemainingTime>, "GetPlayTimerRemainingTime"}, - {1455, D<&IParentalControlService::IsRestrictedByPlayTimer>, "IsRestrictedByPlayTimer"}, - {1456, D<&IParentalControlService::GetPlayTimerSettingsOld>, "GetPlayTimerSettingsOld"}, - {1457, D<&IParentalControlService::GetPlayTimerEventToRequestSuspension>, "GetPlayTimerEventToRequestSuspension"}, - {1458, D<&IParentalControlService::IsPlayTimerAlarmDisabled>, "IsPlayTimerAlarmDisabled"}, - {1459, D<&IParentalControlService::GetPlayTimerRemainingTimeDisplayInfo>, "GetPlayTimerRemainingTimeDisplayInfo"}, - {1460, D<&IParentalControlService::Unknown1460>, "Unknown1460"}, - {1471, nullptr, "NotifyWrongPinCodeInputManyTimes"}, - {1472, nullptr, "CancelNetworkRequest"}, - {1473, D<&IParentalControlService::GetUnlinkedEvent>, "GetUnlinkedEvent"}, - {1474, nullptr, "ClearUnlinkedEvent"}, - {1475, nullptr, "GetExtendedPlayTimerEvent"}, // 18.0.0+ - {1601, nullptr, "DisableAllFeatures"}, - {1602, nullptr, "PostEnableAllFeatures"}, - {1603, nullptr, "IsAllFeaturesDisabled"}, - {1901, nullptr, "DeleteFromFreeCommunicationApplicationListForDebug"}, - {1902, nullptr, "ClearFreeCommunicationApplicationListForDebug"}, - {1903, nullptr, "GetExemptApplicationListCountForDebug"}, - {1904, nullptr, "GetExemptApplicationListForDebug"}, - {1905, nullptr, "UpdateExemptApplicationListForDebug"}, - {1906, nullptr, "AddToExemptApplicationListForDebug"}, - {1907, nullptr, "DeleteFromExemptApplicationListForDebug"}, - {1908, nullptr, "ClearExemptApplicationListForDebug"}, - {1941, nullptr, "DeletePairing"}, - {1951, nullptr, "SetPlayTimerSettingsForDebug"}, - {1952, nullptr, "GetPlayTimerSpentTimeForTest"}, - {1953, nullptr, "SetPlayTimerAlarmDisabledForDebug"}, - {1954, nullptr, "IsBedtimeAlarmEnabled"}, // 18.0.0+ - {1955, nullptr, "GetBedtimeAlarmTime"}, // 18.0.0+ - {1956, nullptr, "GetBedtimeAlarmTimeHour"}, // 18.0.0+ - {1957, nullptr, "GetBedtimeAlarmTimeMinute"}, // 18.0.0+ - {2001, nullptr, "RequestPairingAsync"}, - {2002, nullptr, "FinishRequestPairing"}, - {2003, nullptr, "AuthorizePairingAsync"}, - {2004, nullptr, "FinishAuthorizePairing"}, - {2005, nullptr, "RetrievePairingInfoAsync"}, - {2006, nullptr, "FinishRetrievePairingInfo"}, - {2007, nullptr, "UnlinkPairingAsync"}, - {2008, nullptr, "FinishUnlinkPairing"}, - {2009, nullptr, "GetAccountMiiImageAsync"}, - {2010, nullptr, "FinishGetAccountMiiImage"}, - {2011, nullptr, "GetAccountMiiImageContentTypeAsync"}, - {2012, nullptr, "FinishGetAccountMiiImageContentType"}, - {2013, nullptr, "SynchronizeParentalControlSettingsAsync"}, - {2014, nullptr, "FinishSynchronizeParentalControlSettings"}, - {2015, nullptr, "FinishSynchronizeParentalControlSettingsWithLastUpdated"}, - {2016, nullptr, "RequestUpdateExemptionListAsync"}, //5.0.0+ - {145601, D<&IParentalControlService::GetPlayTimerSettings>, "GetPlayTimerSettings"}, // 18.0.0+ - {2017, nullptr, "AuthorizePairingAsync"}, //19.0.0+ - {2019, nullptr, "RequestUpdateDeviceUsersBackground"}, //19.0.0+ - {2021, nullptr, "RequestCopyPairingAsync"}, //20.0.0+ - {2022, nullptr, "FinishRequestCopyPairing"}, //20.0.0+ - {2023, nullptr, "IsFromPairingActiveDevice"}, //20.0.0+ - {2024, nullptr, "RollbackCopyPairing"}, //21.0.0+ - {3001, nullptr, "GetErrorContextChangedEvent"}, //20.0.0+ - {145601, D<&IParentalControlService::GetPlayTimerSettings>, "GetPlayTimerSettings"}, // 18.0.0+ - {195101, D<&IParentalControlService::SetPlayTimerSettings>, "SetPlayTimerSettingsForDebug"}, //18.0.0+ - }; - // clang-format on - RegisterHandlers(functions); -} - -IParentalControlService::~IParentalControlService() = default; - -bool IParentalControlService::CheckFreeCommunicationPermissionImpl() const { - if (states.temporary_unlocked) { - return true; - } - if ((states.application_info.parental_control_flag & 1) == 0) { - return true; - } - if (pin_code[0] == '\0') { - return true; - } - if (!settings.is_free_communication_default_on) { - return true; - } - // TODO(ogniK): Check for blacklisted/exempted applications. Return false can happen here - // but as we don't have multiproceses support yet, we can just assume our application is - // valid for the time being - return true; -} - -bool IParentalControlService::ConfirmStereoVisionPermissionImpl() const { - if (states.temporary_unlocked) { - return true; - } - if (pin_code[0] == '\0') { - return true; - } - if (!settings.is_stero_vision_restricted) { - return false; - } - return true; -} - -void IParentalControlService::SetStereoVisionRestrictionImpl(bool is_restricted) { - if (settings.disabled) { - return; - } - - if (pin_code[0] == '\0') { - return; - } - settings.is_stero_vision_restricted = is_restricted; -} - -Result IParentalControlService::Initialize() { - LOG_DEBUG(Service_PCTL, "called"); - - if (False(capability & (Capability::Application | Capability::System))) { - LOG_ERROR(Service_PCTL, "Invalid capability! capability={:X}", capability); - R_THROW(PCTL::ResultNoCapability); - } - - // TODO(ogniK): Recovery flag initialization for pctl:r - - if (program_id != 0) { - const FileSys::PatchManager pm{program_id, system.GetFileSystemController(), - system.GetContentProvider()}; - const auto control = pm.GetControlMetadata(); - if (control.first) { - states.tid_from_event = 0; - states.launch_time_valid = false; - states.is_suspended = false; - states.free_communication = false; - states.stereo_vision = false; - states.application_info = ApplicationInfo{ - .application_id = program_id, - .age_rating = control.first->GetRatingAge(), - .parental_control_flag = control.first->GetParentalControlFlag(), - .capability = capability, - }; - - if (False(capability & (Capability::System | Capability::Recovery))) { - // TODO(ogniK): Signal application launch event - } - } - } - - R_SUCCEED(); -} - -Result IParentalControlService::CheckFreeCommunicationPermission() { - LOG_DEBUG(Service_PCTL, "called"); - - if (!CheckFreeCommunicationPermissionImpl()) { - R_THROW(PCTL::ResultNoFreeCommunication); - } else { - states.free_communication = true; - R_SUCCEED(); - } -} - -Result IParentalControlService::ConfirmLaunchApplicationPermission( - InBuffer restriction_bitset, u64 nacp_flag, u64 application_id) { - LOG_WARNING(Service_PCTL, "(STUBBED) called, nacp_flag={:#x} application_id={:016X}", nacp_flag, - application_id); - R_SUCCEED(); -} - -Result IParentalControlService::ConfirmResumeApplicationPermission( - InBuffer restriction_bitset, u64 nacp_flag, u64 application_id) { - LOG_WARNING(Service_PCTL, "(STUBBED) called, nacp_flag={:#x} application_id={:016X}", nacp_flag, - application_id); - R_SUCCEED(); -} - -Result IParentalControlService::ConfirmSnsPostPermission() { - LOG_WARNING(Service_PCTL, "(STUBBED) called"); - R_THROW(PCTL::ResultNoFreeCommunication); -} - -Result IParentalControlService::ConfirmSystemSettingsPermission() { - LOG_WARNING(Service_PCTL, "(STUBBED) called"); - R_SUCCEED(); -} - -Result IParentalControlService::IsRestrictionTemporaryUnlocked( - Out out_is_temporary_unlocked) { - *out_is_temporary_unlocked = false; - LOG_WARNING(Service_PCTL, "(STUBBED) called, is_temporary_unlocked={}", - *out_is_temporary_unlocked); - R_SUCCEED(); -} - -Result IParentalControlService::IsRestrictedSystemSettingsEntered( - Out out_is_restricted_system_settings_entered) { - *out_is_restricted_system_settings_entered = false; - LOG_WARNING(Service_PCTL, "(STUBBED) called, is_temporary_unlocked={}", - *out_is_restricted_system_settings_entered); - R_SUCCEED(); -} - -Result IParentalControlService::ConfirmStereoVisionPermission() { - LOG_DEBUG(Service_PCTL, "called"); - states.stereo_vision = true; - R_SUCCEED(); -} - -Result IParentalControlService::EndFreeCommunication() { - LOG_WARNING(Service_PCTL, "(STUBBED) called"); - R_SUCCEED(); -} - -Result IParentalControlService::IsFreeCommunicationAvailable() { - LOG_DEBUG(Service_PCTL, "(STUBBED) called"); - - if (!CheckFreeCommunicationPermissionImpl()) { - R_THROW(PCTL::ResultNoFreeCommunication); - } else { - R_SUCCEED(); - } -} - -Result IParentalControlService::IsRestrictionEnabled(Out out_restriction_enabled) { - LOG_DEBUG(Service_PCTL, "called"); - - if (False(capability & (Capability::Status | Capability::Recovery))) { - LOG_ERROR(Service_PCTL, "Application does not have Status or Recovery capabilities!"); - *out_restriction_enabled = false; - R_THROW(PCTL::ResultNoCapability); - } - - *out_restriction_enabled = pin_code[0] != '\0'; - R_SUCCEED(); -} - -Result IParentalControlService::GetSafetyLevel(Out out_safety_level) { - *out_safety_level = 0; - LOG_WARNING(Service_PCTL, "(STUBBED) called, safety_level={}", *out_safety_level); - R_SUCCEED(); -} - -Result IParentalControlService::GetCurrentSettings(Out out_settings) { - LOG_INFO(Service_PCTL, "called"); - *out_settings = restriction_settings; - R_SUCCEED(); -} - -Result IParentalControlService::GetFreeCommunicationApplicationListCount(Out out_count) { - *out_count = 4; - LOG_WARNING(Service_PCTL, "(STUBBED) called, count={}", *out_count); - R_SUCCEED(); -} - -Result IParentalControlService::ConfirmStereoVisionRestrictionConfigurable() { - LOG_DEBUG(Service_PCTL, "called"); - - if (False(capability & Capability::StereoVision)) { - LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!"); - R_THROW(PCTL::ResultNoCapability); - } - - if (pin_code[0] == '\0') { - R_THROW(PCTL::ResultNoRestrictionEnabled); - } - - R_SUCCEED(); -} - -Result IParentalControlService::IsStereoVisionPermitted(Out out_is_permitted) { - LOG_DEBUG(Service_PCTL, "called"); - - if (!ConfirmStereoVisionPermissionImpl()) { - *out_is_permitted = false; - R_THROW(PCTL::ResultStereoVisionRestricted); - } else { - *out_is_permitted = true; - R_SUCCEED(); - } -} - -Result IParentalControlService::GetPinCodeLength(Out out_length) { - *out_length = 0; - LOG_WARNING(Service_PCTL, "(STUBBED) called, length={}", *out_length); - R_SUCCEED(); -} - -Result IParentalControlService::IsPairingActive(Out out_is_pairing_active) { - *out_is_pairing_active = false; - LOG_WARNING(Service_PCTL, "(STUBBED) called, is_pairing_active={}", *out_is_pairing_active); - R_SUCCEED(); -} - -Result IParentalControlService::GetSynchronizationEvent( - OutCopyHandle out_event) { - LOG_INFO(Service_PCTL, "called"); - *out_event = synchronization_event.GetHandle(); - R_SUCCEED(); -} - -Result IParentalControlService::StartPlayTimer() { - LOG_WARNING(Service_PCTL, "(STUBBED) called"); - R_SUCCEED(); -} - -Result IParentalControlService::StopPlayTimer() { - LOG_WARNING(Service_PCTL, "(STUBBED) called"); - R_SUCCEED(); -} - -Result IParentalControlService::IsPlayTimerEnabled(Out out_is_play_timer_enabled) { - *out_is_play_timer_enabled = false; - LOG_WARNING(Service_PCTL, "(STUBBED) called, enabled={}", *out_is_play_timer_enabled); - R_SUCCEED(); -} - -Result IParentalControlService::GetPlayTimerRemainingTime(Out out_remaining_time) { - LOG_WARNING(Service_PCTL, "(STUBBED) called"); - *out_remaining_time = std::numeric_limits::max(); - R_SUCCEED(); -} - -Result IParentalControlService::IsRestrictedByPlayTimer(Out out_is_restricted_by_play_timer) { - *out_is_restricted_by_play_timer = false; - LOG_WARNING(Service_PCTL, "(STUBBED) called, restricted={}", *out_is_restricted_by_play_timer); - R_SUCCEED(); -} - -Result IParentalControlService::GetPlayTimerSettingsOld( - Out out_play_timer_settings) { - LOG_WARNING(Service_PCTL, "(STUBBED) called"); - *out_play_timer_settings = {}; - R_SUCCEED(); -} - -Result IParentalControlService::GetPlayTimerSettings(Out out_play_timer_settings) { - LOG_WARNING(Service_PCTL, "(STUBBED) called"); - *out_play_timer_settings = raw_play_timer_settings; - R_SUCCEED(); -} - -Result IParentalControlService::SetPlayTimerSettings(PlayTimerSettings play_timer_settings) { - LOG_WARNING(Service_PCTL, "(STUBBED) called"); - raw_play_timer_settings = play_timer_settings; - R_SUCCEED(); -} - -Result IParentalControlService::GetPlayTimerEventToRequestSuspension( - OutCopyHandle out_event) { - LOG_INFO(Service_PCTL, "called"); - *out_event = request_suspension_event.GetHandle(); - R_SUCCEED(); -} - -Result IParentalControlService::IsPlayTimerAlarmDisabled(Out out_play_timer_alarm_disabled) { - *out_play_timer_alarm_disabled = false; - LOG_INFO(Service_PCTL, "called, is_play_timer_alarm_disabled={}", - *out_play_timer_alarm_disabled); - R_SUCCEED(); -} - -Result IParentalControlService::GetPlayTimerRemainingTimeDisplayInfo(Out out_display_info) { - LOG_DEBUG(Service_PCTL, "called"); - *out_display_info = {.state = PlayTimerDisplayState::NotConfigured}; - R_SUCCEED(); -} - -Result IParentalControlService::Unknown1460(u8 in_unk, Out out_display_info) { - LOG_DEBUG(Service_PCTL, "called, in_unk={}", in_unk); - *out_display_info = {.state = PlayTimerDisplayState::NotConfigured}; - R_SUCCEED(); -} - -Result IParentalControlService::GetUnlinkedEvent(OutCopyHandle out_event) { - LOG_INFO(Service_PCTL, "called"); - *out_event = unlinked_event.GetHandle(); - R_SUCCEED(); -} - -Result IParentalControlService::GetStereoVisionRestriction( - Out out_stereo_vision_restriction) { - LOG_DEBUG(Service_PCTL, "called"); - - if (False(capability & Capability::StereoVision)) { - LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!"); - *out_stereo_vision_restriction = false; - R_THROW(PCTL::ResultNoCapability); - } - - *out_stereo_vision_restriction = settings.is_stero_vision_restricted; - R_SUCCEED(); -} - -Result IParentalControlService::SetStereoVisionRestriction(bool stereo_vision_restriction) { - LOG_DEBUG(Service_PCTL, "called, can_use={}", stereo_vision_restriction); - - if (False(capability & Capability::StereoVision)) { - LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!"); - R_THROW(PCTL::ResultNoCapability); - } - - SetStereoVisionRestrictionImpl(stereo_vision_restriction); - R_SUCCEED(); -} - -Result IParentalControlService::ResetConfirmedStereoVisionPermission() { - LOG_DEBUG(Service_PCTL, "called"); - - states.stereo_vision = false; - - R_SUCCEED(); -} - -} // namespace Service::PCTL diff --git a/src/core/hle/service/pctl/parental_control_service.h b/src/core/hle/service/pctl/parental_control_service.h deleted file mode 100644 index 9dabe3d059..0000000000 --- a/src/core/hle/service/pctl/parental_control_service.h +++ /dev/null @@ -1,99 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator -// Project// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/cmif_types.h" -#include "core/hle/service/kernel_helpers.h" -#include "core/hle/service/os/event.h" -#include "core/hle/service/pctl/pctl_types.h" -#include "core/hle/service/service.h" - -namespace Service::PCTL { - -class IParentalControlService final : public ServiceFramework { -public: - explicit IParentalControlService(Core::System& system_, Capability capability_, - u64 program_id_); - ~IParentalControlService() override; - -private: - bool CheckFreeCommunicationPermissionImpl() const; - bool ConfirmStereoVisionPermissionImpl() const; - void SetStereoVisionRestrictionImpl(bool is_restricted); - - Result Initialize(); - Result CheckFreeCommunicationPermission(); - Result ConfirmLaunchApplicationPermission(InBuffer restriction_bitset, - u64 nacp_flag, u64 application_id); - Result ConfirmResumeApplicationPermission(InBuffer restriction_bitset, - u64 nacp_flag, u64 application_id); - Result ConfirmSnsPostPermission(); - Result ConfirmSystemSettingsPermission(); - Result IsRestrictionTemporaryUnlocked(Out out_is_temporary_unlocked); - Result IsRestrictedSystemSettingsEntered(Out out_is_restricted_system_settings_entered); - Result ConfirmStereoVisionPermission(); - Result EndFreeCommunication(); - Result IsFreeCommunicationAvailable(); - Result IsRestrictionEnabled(Out out_restriction_enabled); - Result GetSafetyLevel(Out out_safety_level); - Result GetCurrentSettings(Out out_settings); - Result GetFreeCommunicationApplicationListCount(Out out_count); - Result ConfirmStereoVisionRestrictionConfigurable(); - Result IsStereoVisionPermitted(Out out_is_permitted); - Result GetPinCodeLength(Out out_length); - Result IsPairingActive(Out out_is_pairing_active); - Result GetSynchronizationEvent(OutCopyHandle out_event); - Result StartPlayTimer(); - Result StopPlayTimer(); - Result IsPlayTimerEnabled(Out out_is_play_timer_enabled); - Result GetPlayTimerRemainingTime(Out out_remaining_time); - Result IsRestrictedByPlayTimer(Out out_is_restricted_by_play_timer); - Result GetPlayTimerSettingsOld(Out out_play_timer_settings); - Result GetPlayTimerEventToRequestSuspension(OutCopyHandle out_event); - Result IsPlayTimerAlarmDisabled(Out out_play_timer_alarm_disabled); - Result GetPlayTimerRemainingTimeDisplayInfo(Out out_display_info); - Result Unknown1460(u8 in_unk, Out out_display_info); - Result GetUnlinkedEvent(OutCopyHandle out_event); - Result GetStereoVisionRestriction(Out out_stereo_vision_restriction); - Result SetStereoVisionRestriction(bool stereo_vision_restriction); - Result ResetConfirmedStereoVisionPermission(); - Result GetPlayTimerSettings(Out out_play_timer_settings); - Result SetPlayTimerSettings(PlayTimerSettings out_play_timer_settings); - - struct States { - u64 current_tid{}; - ApplicationInfo application_info{}; - u64 tid_from_event{}; - bool launch_time_valid{}; - bool is_suspended{}; - bool temporary_unlocked{}; - bool free_communication{}; - bool stereo_vision{}; - }; - - struct ParentalControlSettings { - bool is_stero_vision_restricted{}; - bool is_free_communication_default_on{}; - bool disabled{}; - }; - - States states{}; - ParentalControlSettings settings{}; - RestrictionSettings restriction_settings{}; - std::array pin_code{}; - Capability capability{}; - u64 program_id{}; - // TODO: this is raw - PlayTimerSettings raw_play_timer_settings{}; - - KernelHelpers::ServiceContext service_context; - Event synchronization_event; - Event unlinked_event; - Event request_suspension_event; -}; - -} // namespace Service::PCTL diff --git a/src/core/hle/service/pctl/parental_control_service_factory.cpp b/src/core/hle/service/pctl/parental_control_service_factory.cpp deleted file mode 100644 index ae278a9bbc..0000000000 --- a/src/core/hle/service/pctl/parental_control_service_factory.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/core.h" -#include "core/hle/service/cmif_serialization.h" -#include "core/hle/service/pctl/parental_control_service.h" -#include "core/hle/service/pctl/parental_control_service_factory.h" - -namespace Service::PCTL { - -IParentalControlServiceFactory::IParentalControlServiceFactory(Core::System& system_, - const char* name_, - Capability capability_) - : ServiceFramework{system_, name_}, capability{capability_} { - static const FunctionInfo functions[] = { - {0, D<&IParentalControlServiceFactory::CreateService>, "CreateService"}, - {1, D<&IParentalControlServiceFactory::CreateServiceWithoutInitialize>, - "CreateServiceWithoutInitialize"}, - }; - RegisterHandlers(functions); -} - -IParentalControlServiceFactory::~IParentalControlServiceFactory() = default; - -Result IParentalControlServiceFactory::CreateService( - Out> out_service, ClientProcessId process_id) { - LOG_DEBUG(Service_PCTL, "called, process_id={}", process_id.pid); - *out_service = std::make_shared( - system, capability, system.ResolveCallerProgramId(*process_id)); - R_SUCCEED(); -} - -Result IParentalControlServiceFactory::CreateServiceWithoutInitialize( - Out> out_service, ClientProcessId process_id) { - LOG_DEBUG(Service_PCTL, "called, process_id={}", process_id.pid); - *out_service = std::make_shared( - system, capability, system.ResolveCallerProgramId(*process_id)); - R_SUCCEED(); -} - -} // namespace Service::PCTL diff --git a/src/core/hle/service/pctl/parental_control_service_factory.h b/src/core/hle/service/pctl/parental_control_service_factory.h deleted file mode 100644 index 362988add1..0000000000 --- a/src/core/hle/service/pctl/parental_control_service_factory.h +++ /dev/null @@ -1,31 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/cmif_types.h" -#include "core/hle/service/pctl/pctl_types.h" -#include "core/hle/service/service.h" - -namespace Service::PCTL { - -class IParentalControlService; - -class IParentalControlServiceFactory : public ServiceFramework { -public: - explicit IParentalControlServiceFactory(Core::System& system_, const char* name_, - Capability capability_); - ~IParentalControlServiceFactory() override; - - Result CreateService(Out> out_service, - ClientProcessId process_id); - Result CreateServiceWithoutInitialize(Out> out_service, - ClientProcessId process_id); - -private: - Capability capability{}; -}; - -void LoopProcess(Core::System& system); - -} // namespace Service::PCTL diff --git a/src/core/hle/service/pctl/pctl.cpp b/src/core/hle/service/pctl/pctl.cpp index d92dbe2169..4f0fbbe702 100644 --- a/src/core/hle/service/pctl/pctl.cpp +++ b/src/core/hle/service/pctl/pctl.cpp @@ -1,27 +1,639 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "core/hle/service/pctl/parental_control_service_factory.h" +#include "common/common_funcs.h" +#include "core/file_sys/control_metadata.h" +#include "core/file_sys/patch_manager.h" +#include "core/hle/service/cmif_types.h" #include "core/hle/service/pctl/pctl.h" #include "core/hle/service/server_manager.h" +#include "core/hle/service/service.h" +#include "core/hle/service/cmif_serialization.h" namespace Service::PCTL { +constexpr Result ResultNoFreeCommunication{ErrorModule::PCTL, 101}; +constexpr Result ResultStereoVisionRestricted{ErrorModule::PCTL, 104}; +constexpr Result ResultNoCapability{ErrorModule::PCTL, 131}; +constexpr Result ResultNoRestrictionEnabled{ErrorModule::PCTL, 181}; + +enum class Capability : u32 { + None = 0, + Application = 1 << 0, + SnsPost = 1 << 1, + Recovery = 1 << 6, + Status = 1 << 8, + StereoVision = 1 << 9, + System = 1 << 15, +}; +DECLARE_ENUM_FLAG_OPERATORS(Capability); + +struct ApplicationInfo { + u64 application_id{}; + std::array age_rating{}; + u32 parental_control_flag{}; + Capability capability{}; +}; +static_assert(sizeof(ApplicationInfo) == 0x30, "ApplicationInfo has incorrect size."); + +// This is nn::pctl::RestrictionSettings +struct RestrictionSettings { + u8 rating_age; + bool sns_post_restriction; + bool free_communication_restriction; +}; +static_assert(sizeof(RestrictionSettings) == 0x3, "RestrictionSettings has incorrect size."); + +// This is nn::pctl::PlayTimerSettingsOld +struct PlayTimerSettingsOld { + std::array settings; +}; +static_assert(sizeof(PlayTimerSettingsOld) == 0x34, "PlayTimerSettingsOld has incorrect size."); + +// This is nn::pctl::PlayTimerSettings +struct PlayTimerSettings { + std::array settings; //21.0.0+ now takes 0x44 +}; +static_assert(sizeof(PlayTimerSettings) == 0x44, "PlayTimerSettings has incorrect size."); + +enum class PlayTimerDisplayState : u8 { + TimesUp = 0, + BedtimeAlarm = 1, + RemainingTime = 2, + Unknown3 = 3, + Unknown4 = 4, + Unknown5 = 5, + TimerDisabled = 6, + NotConfigured = 7, +}; + +// This is nn::pctl::PlayTimerRemainingTimeDisplayInfo +struct PlayTimerRemainingTimeDisplayInfo { + PlayTimerDisplayState state; + INSERT_PADDING_BYTES(0x7); + u64 unknown_08; + u64 remaining_time; +}; +static_assert(sizeof(PlayTimerRemainingTimeDisplayInfo) == 0x18, "PlayTimerRemainingTimeDisplayInfo has incorrect size."); + +class IParentalControlService final : public ServiceFramework { +public: + explicit IParentalControlService(Core::System& system_, Capability capability_, + u64 program_id_) + : ServiceFramework{system_, "IParentalControlService"}, capability{capability_}, + program_id{program_id_}, + service_context{system_, "IParentalControlService"}, synchronization_event{service_context}, + unlinked_event{service_context}, request_suspension_event{service_context} { + } + + ~IParentalControlService() override = default; + + bool CheckFreeCommunicationPermissionImpl() const { + if (states.temporary_unlocked) { + return true; + } + if ((states.application_info.parental_control_flag & 1) == 0) { + return true; + } + if (pin_code[0] == '\0') { + return true; + } + if (!settings.is_free_communication_default_on) { + return true; + } + // TODO(ogniK): Check for blacklisted/exempted applications. Return false can happen here + // but as we don't have multiproceses support yet, we can just assume our application is + // valid for the time being + return true; + } + + bool ConfirmStereoVisionPermissionImpl() const { + if (states.temporary_unlocked) { + return true; + } + if (pin_code[0] == '\0') { + return true; + } + if (!settings.is_stero_vision_restricted) { + return false; + } + return true; + } + + void SetStereoVisionRestrictionImpl(bool is_restricted) { + if (settings.disabled) { + return; + } + + if (pin_code[0] == '\0') { + return; + } + settings.is_stero_vision_restricted = is_restricted; + } + + Result Initialize() { + LOG_DEBUG(Service_PCTL, "called"); + + if (False(capability & (Capability::Application | Capability::System))) { + LOG_ERROR(Service_PCTL, "Invalid capability! capability={:X}", capability); + R_THROW(PCTL::ResultNoCapability); + } + + // TODO(ogniK): Recovery flag initialization for pctl:r + + if (program_id != 0) { + const FileSys::PatchManager pm{program_id, system.GetFileSystemController(), + system.GetContentProvider()}; + const auto control = pm.GetControlMetadata(); + if (control.first) { + states.tid_from_event = 0; + states.launch_time_valid = false; + states.is_suspended = false; + states.free_communication = false; + states.stereo_vision = false; + states.application_info = ApplicationInfo{ + .application_id = program_id, + .age_rating = control.first->GetRatingAge(), + .parental_control_flag = control.first->GetParentalControlFlag(), + .capability = capability, + }; + + if (False(capability & (Capability::System | Capability::Recovery))) { + // TODO(ogniK): Signal application launch event + } + } + } + + R_SUCCEED(); + } + + Result CheckFreeCommunicationPermission() { + LOG_DEBUG(Service_PCTL, "called"); + + if (!CheckFreeCommunicationPermissionImpl()) { + R_THROW(PCTL::ResultNoFreeCommunication); + } else { + states.free_communication = true; + R_SUCCEED(); + } + } + + Result ConfirmLaunchApplicationPermission( + InBuffer restriction_bitset, u64 nacp_flag, u64 application_id) { + LOG_WARNING(Service_PCTL, "(STUBBED) called, nacp_flag={:#x} application_id={:016X}", nacp_flag, + application_id); + R_SUCCEED(); + } + + Result ConfirmResumeApplicationPermission( + InBuffer restriction_bitset, u64 nacp_flag, u64 application_id) { + LOG_WARNING(Service_PCTL, "(STUBBED) called, nacp_flag={:#x} application_id={:016X}", nacp_flag, + application_id); + R_SUCCEED(); + } + + Result ConfirmSnsPostPermission() { + LOG_WARNING(Service_PCTL, "(STUBBED) called"); + R_THROW(PCTL::ResultNoFreeCommunication); + } + + Result ConfirmSystemSettingsPermission() { + LOG_WARNING(Service_PCTL, "(STUBBED) called"); + R_SUCCEED(); + } + + Result IsRestrictionTemporaryUnlocked( + Out out_is_temporary_unlocked) { + *out_is_temporary_unlocked = false; + LOG_WARNING(Service_PCTL, "(STUBBED) called, is_temporary_unlocked={}", + *out_is_temporary_unlocked); + R_SUCCEED(); + } + + Result IsRestrictedSystemSettingsEntered( + Out out_is_restricted_system_settings_entered) { + *out_is_restricted_system_settings_entered = false; + LOG_WARNING(Service_PCTL, "(STUBBED) called, is_temporary_unlocked={}", + *out_is_restricted_system_settings_entered); + R_SUCCEED(); + } + + Result ConfirmStereoVisionPermission() { + LOG_DEBUG(Service_PCTL, "called"); + states.stereo_vision = true; + R_SUCCEED(); + } + + Result EndFreeCommunication() { + LOG_WARNING(Service_PCTL, "(STUBBED) called"); + R_SUCCEED(); + } + + Result IsFreeCommunicationAvailable() { + LOG_DEBUG(Service_PCTL, "(STUBBED) called"); + + if (!CheckFreeCommunicationPermissionImpl()) { + R_THROW(PCTL::ResultNoFreeCommunication); + } else { + R_SUCCEED(); + } + } + + Result IsRestrictionEnabled(Out out_restriction_enabled) { + LOG_DEBUG(Service_PCTL, "called"); + + if (False(capability & (Capability::Status | Capability::Recovery))) { + LOG_ERROR(Service_PCTL, "Application does not have Status or Recovery capabilities!"); + *out_restriction_enabled = false; + R_THROW(PCTL::ResultNoCapability); + } + + *out_restriction_enabled = pin_code[0] != '\0'; + R_SUCCEED(); + } + + Result GetSafetyLevel(Out out_safety_level) { + *out_safety_level = 0; + LOG_WARNING(Service_PCTL, "(STUBBED) called, safety_level={}", *out_safety_level); + R_SUCCEED(); + } + + Result GetCurrentSettings(Out out_settings) { + LOG_INFO(Service_PCTL, "called"); + *out_settings = restriction_settings; + R_SUCCEED(); + } + + Result GetFreeCommunicationApplicationListCount(Out out_count) { + *out_count = 4; + LOG_WARNING(Service_PCTL, "(STUBBED) called, count={}", *out_count); + R_SUCCEED(); + } + + Result ConfirmStereoVisionRestrictionConfigurable() { + LOG_DEBUG(Service_PCTL, "called"); + + if (False(capability & Capability::StereoVision)) { + LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!"); + R_THROW(PCTL::ResultNoCapability); + } + + if (pin_code[0] == '\0') { + R_THROW(PCTL::ResultNoRestrictionEnabled); + } + + R_SUCCEED(); + } + + Result IsStereoVisionPermitted(Out out_is_permitted) { + LOG_DEBUG(Service_PCTL, "called"); + + if (!ConfirmStereoVisionPermissionImpl()) { + *out_is_permitted = false; + R_THROW(PCTL::ResultStereoVisionRestricted); + } else { + *out_is_permitted = true; + R_SUCCEED(); + } + } + + Result GetPinCodeLength(Out out_length) { + *out_length = 0; + LOG_WARNING(Service_PCTL, "(STUBBED) called, length={}", *out_length); + R_SUCCEED(); + } + + Result IsPairingActive(Out out_is_pairing_active) { + *out_is_pairing_active = false; + LOG_WARNING(Service_PCTL, "(STUBBED) called, is_pairing_active={}", *out_is_pairing_active); + R_SUCCEED(); + } + + Result GetSynchronizationEvent( + OutCopyHandle out_event) { + LOG_INFO(Service_PCTL, "called"); + *out_event = synchronization_event.GetHandle(); + R_SUCCEED(); + } + + Result StartPlayTimer() { + LOG_WARNING(Service_PCTL, "(STUBBED) called"); + R_SUCCEED(); + } + + Result StopPlayTimer() { + LOG_WARNING(Service_PCTL, "(STUBBED) called"); + R_SUCCEED(); + } + + Result IsPlayTimerEnabled(Out out_is_play_timer_enabled) { + *out_is_play_timer_enabled = false; + LOG_WARNING(Service_PCTL, "(STUBBED) called, enabled={}", *out_is_play_timer_enabled); + R_SUCCEED(); + } + + Result GetPlayTimerRemainingTime(Out out_remaining_time) { + LOG_WARNING(Service_PCTL, "(STUBBED) called"); + *out_remaining_time = std::numeric_limits::max(); + R_SUCCEED(); + } + + Result IsRestrictedByPlayTimer(Out out_is_restricted_by_play_timer) { + *out_is_restricted_by_play_timer = false; + LOG_WARNING(Service_PCTL, "(STUBBED) called, restricted={}", *out_is_restricted_by_play_timer); + R_SUCCEED(); + } + + Result GetPlayTimerSettingsOld( + Out out_play_timer_settings) { + LOG_WARNING(Service_PCTL, "(STUBBED) called"); + *out_play_timer_settings = {}; + R_SUCCEED(); + } + + Result GetPlayTimerSettings(Out out_play_timer_settings) { + LOG_WARNING(Service_PCTL, "(STUBBED) called"); + *out_play_timer_settings = raw_play_timer_settings; + R_SUCCEED(); + } + + Result SetPlayTimerSettings(PlayTimerSettings play_timer_settings) { + LOG_WARNING(Service_PCTL, "(STUBBED) called"); + raw_play_timer_settings = play_timer_settings; + R_SUCCEED(); + } + + Result GetPlayTimerEventToRequestSuspension( + OutCopyHandle out_event) { + LOG_INFO(Service_PCTL, "called"); + *out_event = request_suspension_event.GetHandle(); + R_SUCCEED(); + } + + Result IsPlayTimerAlarmDisabled(Out out_play_timer_alarm_disabled) { + *out_play_timer_alarm_disabled = false; + LOG_INFO(Service_PCTL, "called, is_play_timer_alarm_disabled={}", + *out_play_timer_alarm_disabled); + R_SUCCEED(); + } + + Result GetPlayTimerRemainingTimeDisplayInfo(Out out_display_info) { + LOG_DEBUG(Service_PCTL, "called"); + *out_display_info = {.state = PlayTimerDisplayState::NotConfigured}; + R_SUCCEED(); + } + + Result Unknown1460(u8 in_unk, Out out_display_info) { + LOG_DEBUG(Service_PCTL, "called, in_unk={}", in_unk); + *out_display_info = {.state = PlayTimerDisplayState::NotConfigured}; + R_SUCCEED(); + } + + Result GetUnlinkedEvent(OutCopyHandle out_event) { + LOG_INFO(Service_PCTL, "called"); + *out_event = unlinked_event.GetHandle(); + R_SUCCEED(); + } + + Result GetStereoVisionRestriction( + Out out_stereo_vision_restriction) { + LOG_DEBUG(Service_PCTL, "called"); + + if (False(capability & Capability::StereoVision)) { + LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!"); + *out_stereo_vision_restriction = false; + R_THROW(PCTL::ResultNoCapability); + } + + *out_stereo_vision_restriction = settings.is_stero_vision_restricted; + R_SUCCEED(); + } + + Result SetStereoVisionRestriction(bool stereo_vision_restriction) { + LOG_DEBUG(Service_PCTL, "called, can_use={}", stereo_vision_restriction); + + if (False(capability & Capability::StereoVision)) { + LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!"); + R_THROW(PCTL::ResultNoCapability); + } + + SetStereoVisionRestrictionImpl(stereo_vision_restriction); + R_SUCCEED(); + } + + Result ResetConfirmedStereoVisionPermission() { + LOG_DEBUG(Service_PCTL, "called"); + + states.stereo_vision = false; + + R_SUCCEED(); + } + + struct States { + u64 current_tid{}; + ApplicationInfo application_info{}; + u64 tid_from_event{}; + bool launch_time_valid{}; + bool is_suspended{}; + bool temporary_unlocked{}; + bool free_communication{}; + bool stereo_vision{}; + }; + + struct ParentalControlSettings { + bool is_stero_vision_restricted{}; + bool is_free_communication_default_on{}; + bool disabled{}; + }; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{1, D<&IParentalControlService::Initialize>, "Initialize"}, + FunctionInfo{1001, D<&IParentalControlService::CheckFreeCommunicationPermission>, "CheckFreeCommunicationPermission"}, + FunctionInfo{1002, D<&IParentalControlService::ConfirmLaunchApplicationPermission>, "ConfirmLaunchApplicationPermission"}, + FunctionInfo{1003, D<&IParentalControlService::ConfirmResumeApplicationPermission>, "ConfirmResumeApplicationPermission"}, + FunctionInfo{1004, D<&IParentalControlService::ConfirmSnsPostPermission>, "ConfirmSnsPostPermission"}, + FunctionInfo{1005, D<&IParentalControlService::ConfirmSystemSettingsPermission>, "ConfirmSystemSettingsPermission"}, + FunctionInfo{1006, D<&IParentalControlService::IsRestrictionTemporaryUnlocked>, "IsRestrictionTemporaryUnlocked"}, + FunctionInfo{1007, nullptr, "RevertRestrictionTemporaryUnlocked"}, + FunctionInfo{1008, nullptr, "EnterRestrictedSystemSettings"}, + FunctionInfo{1009, nullptr, "LeaveRestrictedSystemSettings"}, + FunctionInfo{1010, D<&IParentalControlService::IsRestrictedSystemSettingsEntered>, "IsRestrictedSystemSettingsEntered"}, + FunctionInfo{1011, nullptr, "RevertRestrictedSystemSettingsEntered"}, + FunctionInfo{1012, nullptr, "GetRestrictedFeatures"}, + FunctionInfo{1013, D<&IParentalControlService::ConfirmStereoVisionPermission>, "ConfirmStereoVisionPermission"}, + FunctionInfo{1014, nullptr, "ConfirmPlayableApplicationVideoOld"}, + FunctionInfo{1015, nullptr, "ConfirmPlayableApplicationVideo"}, + FunctionInfo{1016, nullptr, "ConfirmShowNewsPermission"}, + FunctionInfo{1017, D<&IParentalControlService::EndFreeCommunication>, "EndFreeCommunication"}, + FunctionInfo{1018, D<&IParentalControlService::IsFreeCommunicationAvailable>, "IsFreeCommunicationAvailable"}, + FunctionInfo{1019, D<&IParentalControlService::ConfirmLaunchApplicationPermission>, "ConfirmLaunchApplicationPermission"}, + FunctionInfo{1020, nullptr, "ConfirmLaunchSharedApplicationPermission", MakeVersionGate({20,0,0})}, + FunctionInfo{1021, nullptr, "TryBeginFreeCommunicationForStreamPlay", MakeVersionGate({21,0,0})}, + FunctionInfo{1022, nullptr, "EndFreeCommunicationForStreamPlay", MakeVersionGate({21,0,0})}, + FunctionInfo{1031, D<&IParentalControlService::IsRestrictionEnabled>, "IsRestrictionEnabled"}, + FunctionInfo{1032, D<&IParentalControlService::GetSafetyLevel>, "GetSafetyLevel"}, + FunctionInfo{1033, nullptr, "SetSafetyLevel"}, + FunctionInfo{1034, nullptr, "GetSafetyLevelSettings"}, + FunctionInfo{1035, D<&IParentalControlService::GetCurrentSettings>, "GetCurrentSettings"}, + FunctionInfo{1036, nullptr, "SetCustomSafetyLevelSettings"}, + FunctionInfo{1037, nullptr, "GetDefaultRatingOrganization"}, + FunctionInfo{1038, nullptr, "SetDefaultRatingOrganization"}, + FunctionInfo{1039, D<&IParentalControlService::GetFreeCommunicationApplicationListCount>, "GetFreeCommunicationApplicationListCount"}, + FunctionInfo{1042, nullptr, "AddToFreeCommunicationApplicationList"}, + FunctionInfo{1043, nullptr, "DeleteSettings"}, + FunctionInfo{1044, nullptr, "GetFreeCommunicationApplicationList"}, + FunctionInfo{1045, nullptr, "UpdateFreeCommunicationApplicationList"}, + FunctionInfo{1046, nullptr, "DisableFeaturesForReset"}, + FunctionInfo{1047, nullptr, "NotifyApplicationDownloadStarted"}, + FunctionInfo{1048, nullptr, "NotifyNetworkProfileCreated"}, + FunctionInfo{1049, nullptr, "ResetFreeCommunicationApplicationList"}, + FunctionInfo{1050, nullptr, "AddToFreeCommunicationApplicationList", MakeVersionGate({20,0,0})}, + FunctionInfo{1051, nullptr, "NotifyApplicationDownloadStarted", MakeVersionGate({20,0,0})}, + FunctionInfo{1061, D<&IParentalControlService::ConfirmStereoVisionRestrictionConfigurable>, "ConfirmStereoVisionRestrictionConfigurable"}, + FunctionInfo{1062, D<&IParentalControlService::GetStereoVisionRestriction>, "GetStereoVisionRestriction"}, + FunctionInfo{1063, D<&IParentalControlService::SetStereoVisionRestriction>, "SetStereoVisionRestriction"}, + FunctionInfo{1064, D<&IParentalControlService::ResetConfirmedStereoVisionPermission>, "ResetConfirmedStereoVisionPermission"}, + FunctionInfo{1065, D<&IParentalControlService::IsStereoVisionPermitted>, "IsStereoVisionPermitted"}, + FunctionInfo{1201, nullptr, "UnlockRestrictionTemporarily"}, + FunctionInfo{1202, nullptr, "UnlockSystemSettingsRestriction"}, + FunctionInfo{1203, nullptr, "SetPinCode"}, + FunctionInfo{1204, nullptr, "GenerateInquiryCode"}, + FunctionInfo{1205, nullptr, "CheckMasterKey"}, + FunctionInfo{1206, D<&IParentalControlService::GetPinCodeLength>, "GetPinCodeLength"}, + FunctionInfo{1207, nullptr, "GetPinCodeChangedEvent"}, + FunctionInfo{1208, nullptr, "GetPinCode"}, + FunctionInfo{1403, D<&IParentalControlService::IsPairingActive>, "IsPairingActive"}, + FunctionInfo{1406, nullptr, "GetSettingsLastUpdated"}, + FunctionInfo{1411, nullptr, "GetPairingAccountInfo"}, + FunctionInfo{1421, nullptr, "GetAccountNickname"}, + FunctionInfo{1424, nullptr, "GetAccountState"}, + FunctionInfo{1425, nullptr, "RequestPostEvents"}, + FunctionInfo{1426, nullptr, "GetPostEventInterval"}, + FunctionInfo{1427, nullptr, "SetPostEventInterval"}, + FunctionInfo{1432, D<&IParentalControlService::GetSynchronizationEvent>, "GetSynchronizationEvent"}, + FunctionInfo{1451, D<&IParentalControlService::StartPlayTimer>, "StartPlayTimer"}, + FunctionInfo{1452, D<&IParentalControlService::StopPlayTimer>, "StopPlayTimer"}, + FunctionInfo{1453, D<&IParentalControlService::IsPlayTimerEnabled>, "IsPlayTimerEnabled"}, + FunctionInfo{1454, D<&IParentalControlService::GetPlayTimerRemainingTime>, "GetPlayTimerRemainingTime"}, + FunctionInfo{1455, D<&IParentalControlService::IsRestrictedByPlayTimer>, "IsRestrictedByPlayTimer"}, + FunctionInfo{1456, D<&IParentalControlService::GetPlayTimerSettingsOld>, "GetPlayTimerSettingsOld"}, + FunctionInfo{1457, D<&IParentalControlService::GetPlayTimerEventToRequestSuspension>, "GetPlayTimerEventToRequestSuspension"}, + FunctionInfo{1458, D<&IParentalControlService::IsPlayTimerAlarmDisabled>, "IsPlayTimerAlarmDisabled"}, + FunctionInfo{1459, D<&IParentalControlService::GetPlayTimerRemainingTimeDisplayInfo>, "GetPlayTimerRemainingTimeDisplayInfo"}, + FunctionInfo{1460, D<&IParentalControlService::Unknown1460>, "Unknown1460"}, + FunctionInfo{1471, nullptr, "NotifyWrongPinCodeInputManyTimes"}, + FunctionInfo{1472, nullptr, "CancelNetworkRequest"}, + FunctionInfo{1473, D<&IParentalControlService::GetUnlinkedEvent>, "GetUnlinkedEvent"}, + FunctionInfo{1474, nullptr, "ClearUnlinkedEvent"}, + FunctionInfo{1475, nullptr, "GetExtendedPlayTimerEvent", MakeVersionGate({18,0,0})}, + FunctionInfo{1601, nullptr, "DisableAllFeatures"}, + FunctionInfo{1602, nullptr, "PostEnableAllFeatures"}, + FunctionInfo{1603, nullptr, "IsAllFeaturesDisabled"}, + FunctionInfo{1901, nullptr, "DeleteFromFreeCommunicationApplicationListForDebug"}, + FunctionInfo{1902, nullptr, "ClearFreeCommunicationApplicationListForDebug"}, + FunctionInfo{1903, nullptr, "GetExemptApplicationListCountForDebug"}, + FunctionInfo{1904, nullptr, "GetExemptApplicationListForDebug"}, + FunctionInfo{1905, nullptr, "UpdateExemptApplicationListForDebug"}, + FunctionInfo{1906, nullptr, "AddToExemptApplicationListForDebug"}, + FunctionInfo{1907, nullptr, "DeleteFromExemptApplicationListForDebug"}, + FunctionInfo{1908, nullptr, "ClearExemptApplicationListForDebug"}, + FunctionInfo{1941, nullptr, "DeletePairing"}, + FunctionInfo{1951, nullptr, "SetPlayTimerSettingsForDebug"}, + FunctionInfo{1952, nullptr, "GetPlayTimerSpentTimeForTest"}, + FunctionInfo{1953, nullptr, "SetPlayTimerAlarmDisabledForDebug"}, + FunctionInfo{1954, nullptr, "IsBedtimeAlarmEnabled", MakeVersionGate({18,0,0})}, + FunctionInfo{1955, nullptr, "GetBedtimeAlarmTime", MakeVersionGate({18,0,0})}, + FunctionInfo{1956, nullptr, "GetBedtimeAlarmTimeHour", MakeVersionGate({18,0,0})}, + FunctionInfo{1957, nullptr, "GetBedtimeAlarmTimeMinute", MakeVersionGate({18,0,0})}, + FunctionInfo{2001, nullptr, "RequestPairingAsync"}, + FunctionInfo{2002, nullptr, "FinishRequestPairing"}, + FunctionInfo{2003, nullptr, "AuthorizePairingAsync"}, + FunctionInfo{2004, nullptr, "FinishAuthorizePairing"}, + FunctionInfo{2005, nullptr, "RetrievePairingInfoAsync"}, + FunctionInfo{2006, nullptr, "FinishRetrievePairingInfo"}, + FunctionInfo{2007, nullptr, "UnlinkPairingAsync"}, + FunctionInfo{2008, nullptr, "FinishUnlinkPairing"}, + FunctionInfo{2009, nullptr, "GetAccountMiiImageAsync"}, + FunctionInfo{2010, nullptr, "FinishGetAccountMiiImage"}, + FunctionInfo{2011, nullptr, "GetAccountMiiImageContentTypeAsync"}, + FunctionInfo{2012, nullptr, "FinishGetAccountMiiImageContentType"}, + FunctionInfo{2013, nullptr, "SynchronizeParentalControlSettingsAsync"}, + FunctionInfo{2014, nullptr, "FinishSynchronizeParentalControlSettings"}, + FunctionInfo{2015, nullptr, "FinishSynchronizeParentalControlSettingsWithLastUpdated"}, + FunctionInfo{2016, nullptr, "RequestUpdateExemptionListAsync", MakeVersionGate({5,0,0})}, + FunctionInfo{145601, D<&IParentalControlService::GetPlayTimerSettings>, "GetPlayTimerSettings", MakeVersionGate({18,0,0})}, + FunctionInfo{2017, nullptr, "AuthorizePairingAsync", MakeVersionGate({19,0,0})}, + FunctionInfo{2019, nullptr, "RequestUpdateDeviceUsersBackground", MakeVersionGate({19,0,0})}, + FunctionInfo{2021, nullptr, "RequestCopyPairingAsync", MakeVersionGate({20,0,0})}, + FunctionInfo{2022, nullptr, "FinishRequestCopyPairing", MakeVersionGate({20,0,0})}, + FunctionInfo{2023, nullptr, "IsFromPairingActiveDevice", MakeVersionGate({20,0,0})}, + FunctionInfo{2024, nullptr, "RollbackCopyPairing", MakeVersionGate({21,0,0})}, + FunctionInfo{3001, nullptr, "GetErrorContextChangedEvent", MakeVersionGate({20,0,0})}, + FunctionInfo{145601, D<&IParentalControlService::GetPlayTimerSettings>, "GetPlayTimerSettings", MakeVersionGate({18,0,0})}, + FunctionInfo{195101, D<&IParentalControlService::SetPlayTimerSettings>, "SetPlayTimerSettingsForDebug", MakeVersionGate({18,0,0})} + ); + States states{}; + ParentalControlSettings settings{}; + RestrictionSettings restriction_settings{}; + std::array pin_code{}; + Capability capability{}; + u64 program_id{}; + // TODO: this is raw + PlayTimerSettings raw_play_timer_settings{}; + + KernelHelpers::ServiceContext service_context; + Event synchronization_event; + Event unlinked_event; + Event request_suspension_event; +}; + +class IParentalControlServiceFactory : public ServiceFramework { +public: + explicit IParentalControlServiceFactory(Core::System& system_, const char* name_, Capability capability_) + : ServiceFramework{system_, name_}, capability{capability_} + {} + + ~IParentalControlServiceFactory() override = default; + + Result CreateService(Out> out_service, ClientProcessId process_id) { + LOG_DEBUG(Service_PCTL, "called, process_id={}", process_id.pid); + *out_service = std::make_shared( + system, capability, system.ResolveCallerProgramId(*process_id)); + R_SUCCEED(); + } + + Result CreateServiceWithoutInitialize(Out> out_service, ClientProcessId process_id) { + LOG_DEBUG(Service_PCTL, "called, process_id={}", process_id.pid); + *out_service = std::make_shared( + system, capability, system.ResolveCallerProgramId(*process_id)); + R_SUCCEED(); + } + +private: + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IParentalControlServiceFactory::CreateService>, "CreateService"}, + FunctionInfo{1, D<&IParentalControlServiceFactory::CreateServiceWithoutInitialize>, "CreateServiceWithoutInitialize"} + ); + Capability capability{}; +}; + void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); - server_manager->RegisterNamedService("pctl", - std::make_shared( - system, "pctl", - Capability::Application | Capability::SnsPost | - Capability::Status | Capability::StereoVision)); + server_manager->RegisterNamedService("pctl", std::make_shared(system, "pctl", Capability::Application | Capability::SnsPost | Capability::Status | Capability::StereoVision)); // TODO(ogniK): Implement remaining capabilities - server_manager->RegisterNamedService("pctl:a", std::make_shared( - system, "pctl:a", Capability::None)); - server_manager->RegisterNamedService("pctl:r", std::make_shared( - system, "pctl:r", Capability::None)); - server_manager->RegisterNamedService("pctl:s", std::make_shared( - system, "pctl:s", Capability::None)); + server_manager->RegisterNamedService("pctl:a", std::make_shared(system, "pctl:a", Capability::None)); + server_manager->RegisterNamedService("pctl:r", std::make_shared(system, "pctl:r", Capability::None)); + server_manager->RegisterNamedService("pctl:s", std::make_shared(system, "pctl:s", Capability::None)); ServerManager::RunServer(std::move(server_manager)); } diff --git a/src/core/hle/service/pctl/pctl_results.h b/src/core/hle/service/pctl/pctl_results.h deleted file mode 100644 index 1fc54727b7..0000000000 --- a/src/core/hle/service/pctl/pctl_results.h +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/result.h" - -namespace Service::PCTL { - -constexpr Result ResultNoFreeCommunication{ErrorModule::PCTL, 101}; -constexpr Result ResultStereoVisionRestricted{ErrorModule::PCTL, 104}; -constexpr Result ResultNoCapability{ErrorModule::PCTL, 131}; -constexpr Result ResultNoRestrictionEnabled{ErrorModule::PCTL, 181}; - -} // namespace Service::PCTL diff --git a/src/core/hle/service/pctl/pctl_types.h b/src/core/hle/service/pctl/pctl_types.h deleted file mode 100644 index 3a5a19099d..0000000000 --- a/src/core/hle/service/pctl/pctl_types.h +++ /dev/null @@ -1,73 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "common/common_funcs.h" - -namespace Service::PCTL { - -enum class Capability : u32 { - None = 0, - Application = 1 << 0, - SnsPost = 1 << 1, - Recovery = 1 << 6, - Status = 1 << 8, - StereoVision = 1 << 9, - System = 1 << 15, -}; -DECLARE_ENUM_FLAG_OPERATORS(Capability); - -struct ApplicationInfo { - u64 application_id{}; - std::array age_rating{}; - u32 parental_control_flag{}; - Capability capability{}; -}; -static_assert(sizeof(ApplicationInfo) == 0x30, "ApplicationInfo has incorrect size."); - -// This is nn::pctl::RestrictionSettings -struct RestrictionSettings { - u8 rating_age; - bool sns_post_restriction; - bool free_communication_restriction; -}; -static_assert(sizeof(RestrictionSettings) == 0x3, "RestrictionSettings has incorrect size."); - -// This is nn::pctl::PlayTimerSettingsOld -struct PlayTimerSettingsOld { - std::array settings; -}; -static_assert(sizeof(PlayTimerSettingsOld) == 0x34, "PlayTimerSettingsOld has incorrect size."); - -// This is nn::pctl::PlayTimerSettings -struct PlayTimerSettings { - std::array settings; //21.0.0+ now takes 0x44 -}; -static_assert(sizeof(PlayTimerSettings) == 0x44, "PlayTimerSettings has incorrect size."); - -enum class PlayTimerDisplayState : u8 { - TimesUp = 0, - BedtimeAlarm = 1, - RemainingTime = 2, - Unknown3 = 3, - Unknown4 = 4, - Unknown5 = 5, - TimerDisabled = 6, - NotConfigured = 7, -}; - -// This is nn::pctl::PlayTimerRemainingTimeDisplayInfo -struct PlayTimerRemainingTimeDisplayInfo { - PlayTimerDisplayState state; - INSERT_PADDING_BYTES(0x7); - u64 unknown_08; - u64 remaining_time; -}; -static_assert(sizeof(PlayTimerRemainingTimeDisplayInfo) == 0x18, - "PlayTimerRemainingTimeDisplayInfo has incorrect size."); - -} // namespace Service::PCTL diff --git a/src/core/hle/service/pcv/pcv.cpp b/src/core/hle/service/pcv/pcv.cpp index 1b314f3518..bb3d748527 100644 --- a/src/core/hle/service/pcv/pcv.cpp +++ b/src/core/hle/service/pcv/pcv.cpp @@ -15,91 +15,76 @@ namespace Service::PCV { class PCV final : public ServiceFramework { public: - explicit PCV(Core::System& system_) : ServiceFramework{system_, "pcv"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "SetPowerEnabled"}, - {1, nullptr, "SetClockEnabled"}, - {2, nullptr, "SetClockRate"}, - {3, nullptr, "GetClockRate"}, - {4, nullptr, "GetState"}, - {5, nullptr, "GetPossibleClockRates"}, - {6, nullptr, "SetMinVClockRate"}, - {7, nullptr, "SetReset"}, - {8, nullptr, "SetVoltageEnabled"}, - {9, nullptr, "GetVoltageEnabled"}, - {10, nullptr, "GetVoltageRange"}, - {11, nullptr, "SetVoltageValue"}, - {12, nullptr, "GetVoltageValue"}, - {13, nullptr, "GetTemperatureThresholds"}, - {14, nullptr, "SetTemperature"}, - {15, nullptr, "Initialize"}, - {16, nullptr, "IsInitialized"}, - {17, nullptr, "Finalize"}, - {18, nullptr, "PowerOn"}, - {19, nullptr, "PowerOff"}, - {20, nullptr, "ChangeVoltage"}, - {21, nullptr, "GetPowerClockInfoEvent"}, - {22, nullptr, "GetOscillatorClock"}, - {23, nullptr, "GetDvfsTable"}, - {24, nullptr, "GetModuleStateTable"}, - {25, nullptr, "GetPowerDomainStateTable"}, - {26, nullptr, "GetFuseInfo"}, - {27, nullptr, "GetDramId"}, - {28, nullptr, "IsPoweredOn"}, - {29, nullptr, "GetVoltage"}, - }; - // clang-format on + explicit PCV(Core::System& system_) : ServiceFramework{system_, "pcv"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "SetPowerEnabled"}, + FunctionInfo{1, nullptr, "SetClockEnabled"}, + FunctionInfo{2, nullptr, "SetClockRate"}, + FunctionInfo{3, nullptr, "GetClockRate"}, + FunctionInfo{4, nullptr, "GetState"}, + FunctionInfo{5, nullptr, "GetPossibleClockRates"}, + FunctionInfo{6, nullptr, "SetMinVClockRate"}, + FunctionInfo{7, nullptr, "SetReset"}, + FunctionInfo{8, nullptr, "SetVoltageEnabled"}, + FunctionInfo{9, nullptr, "GetVoltageEnabled"}, + FunctionInfo{10, nullptr, "GetVoltageRange"}, + FunctionInfo{11, nullptr, "SetVoltageValue"}, + FunctionInfo{12, nullptr, "GetVoltageValue"}, + FunctionInfo{13, nullptr, "GetTemperatureThresholds"}, + FunctionInfo{14, nullptr, "SetTemperature"}, + FunctionInfo{15, nullptr, "Initialize"}, + FunctionInfo{16, nullptr, "IsInitialized"}, + FunctionInfo{17, nullptr, "Finalize"}, + FunctionInfo{18, nullptr, "PowerOn"}, + FunctionInfo{19, nullptr, "PowerOff"}, + FunctionInfo{20, nullptr, "ChangeVoltage"}, + FunctionInfo{21, nullptr, "GetPowerClockInfoEvent"}, + FunctionInfo{22, nullptr, "GetOscillatorClock"}, + FunctionInfo{23, nullptr, "GetDvfsTable"}, + FunctionInfo{24, nullptr, "GetModuleStateTable"}, + FunctionInfo{25, nullptr, "GetPowerDomainStateTable"}, + FunctionInfo{26, nullptr, "GetFuseInfo"}, + FunctionInfo{27, nullptr, "GetDramId"}, + FunctionInfo{28, nullptr, "IsPoweredOn"}, + FunctionInfo{29, nullptr, "GetVoltage"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class PCV_ARB final : public ServiceFramework { public: - explicit PCV_ARB(Core::System& system_) : ServiceFramework{system_, "pcv:arb"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "ReleaseControl"}, - }; - // clang-format on - RegisterHandlers(functions); + explicit PCV_ARB(Core::System& system_) : ServiceFramework{system_, "pcv:arb"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "ReleaseControl"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class PCV_IMM final : public ServiceFramework { public: - explicit PCV_IMM(Core::System& system_) : ServiceFramework{system_, "pcv:imm"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "SetClockRate"}, - }; - // clang-format on - RegisterHandlers(functions); + explicit PCV_IMM(Core::System& system_) : ServiceFramework{system_, "pcv:imm"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "SetClockRate"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class IClkrstSession final : public ServiceFramework { public: explicit IClkrstSession(Core::System& system_, DeviceCode device_code_) - : ServiceFramework{system_, "IClkrstSession"}, device_code(device_code_) { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "SetClockEnabled"}, - {1, nullptr, "SetClockDisabled"}, - {2, nullptr, "SetResetAsserted"}, - {3, nullptr, "SetResetDeasserted"}, - {4, nullptr, "SetPowerEnabled"}, - {5, nullptr, "SetPowerDisabled"}, - {6, nullptr, "GetState"}, - {7, &IClkrstSession::SetClockRate, "SetClockRate"}, - {8, &IClkrstSession::GetClockRate, "GetClockRate"}, - {9, nullptr, "SetMinVClockRate"}, - {10, nullptr, "GetPossibleClockRates"}, - {11, nullptr, "GetDvfsTable"}, - }; - // clang-format on - RegisterHandlers(functions); + : ServiceFramework{system_, "IClkrstSession"}, device_code(device_code_) {} + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -120,25 +105,30 @@ private: rb.Push(clock_rate); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "SetClockEnabled"}, + FunctionInfo{1, nullptr, "SetClockDisabled"}, + FunctionInfo{2, nullptr, "SetResetAsserted"}, + FunctionInfo{3, nullptr, "SetResetDeasserted"}, + FunctionInfo{4, nullptr, "SetPowerEnabled"}, + FunctionInfo{5, nullptr, "SetPowerDisabled"}, + FunctionInfo{6, nullptr, "GetState"}, + FunctionInfo{7, &IClkrstSession::SetClockRate, "SetClockRate"}, + FunctionInfo{8, &IClkrstSession::GetClockRate, "GetClockRate"}, + FunctionInfo{9, nullptr, "SetMinVClockRate"}, + FunctionInfo{10, nullptr, "GetPossibleClockRates"}, + FunctionInfo{11, nullptr, "GetDvfsTable"} + ); DeviceCode device_code; u32 clock_rate{}; }; class CLKRST final : public ServiceFramework { public: - explicit CLKRST(Core::System& system_, const char* name) : ServiceFramework{system_, name} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &CLKRST::OpenSession, "OpenSession"}, - {1, nullptr, "GetTemperatureThresholds"}, - {2, nullptr, "SetTemperature"}, - {3, nullptr, "GetModuleStateTable"}, - {4, nullptr, "GetModuleStateTableEvent"}, - {5, nullptr, "GetModuleStateTableMaxCount"}, - }; - // clang-format on + explicit CLKRST(Core::System& system_, const char* name) : ServiceFramework{system_, name} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -153,18 +143,26 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system, device_code); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &CLKRST::OpenSession, "OpenSession"}, + FunctionInfo{1, nullptr, "GetTemperatureThresholds"}, + FunctionInfo{2, nullptr, "SetTemperature"}, + FunctionInfo{3, nullptr, "GetModuleStateTable"}, + FunctionInfo{4, nullptr, "GetModuleStateTableEvent"}, + FunctionInfo{5, nullptr, "GetModuleStateTableMaxCount"} + ); }; class CLKRST_A final : public ServiceFramework { public: - explicit CLKRST_A(Core::System& system_) : ServiceFramework{system_, "clkrst:a"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "ReleaseControl"}, - }; - // clang-format on + explicit CLKRST_A(Core::System& system_) : ServiceFramework{system_, "clkrst:a"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "ReleaseControl"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; diff --git a/src/core/hle/service/pm/pm.cpp b/src/core/hle/service/pm/pm.cpp index ff7053b690..3d431c305f 100644 --- a/src/core/hle/service/pm/pm.cpp +++ b/src/core/hle/service/pm/pm.cpp @@ -47,13 +47,7 @@ void GetApplicationPidGeneric(Kernel::KernelCore& kernel, HLERequestContext& ctx class BootMode final : public ServiceFramework { public: - explicit BootMode(Core::System& system_) : ServiceFramework{system_, "pm:bm"} { - static const FunctionInfo functions[] = { - {0, &BootMode::GetBootMode, "GetBootMode"}, - {1, &BootMode::SetMaintenanceBoot, "SetMaintenanceBoot"}, - }; - RegisterHandlers(functions); - } + explicit BootMode(Core::System& system_) : ServiceFramework{system_, "pm:bm"} {} private: void GetBootMode(HLERequestContext& ctx) { @@ -73,28 +67,19 @@ private: rb.Push(ResultSuccess); } + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &BootMode::GetBootMode, "GetBootMode"}, + FunctionInfo{1, &BootMode::SetMaintenanceBoot, "SetMaintenanceBoot"} + ); SystemBootMode boot_mode = SystemBootMode::Normal; }; class DebugMonitor final : public ServiceFramework { public: - explicit DebugMonitor(Core::System& system_) : ServiceFramework{system_, "pm:dmnt"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetJitDebugProcessIdList"}, - {1, nullptr, "StartProcess"}, - {2, &DebugMonitor::GetProcessId, "GetProcessId"}, - {3, nullptr, "HookToCreateProcess"}, - {4, &DebugMonitor::GetApplicationProcessId, "GetApplicationProcessId"}, - {5, nullptr, "HookToCreateApplicationProgress"}, - {6, nullptr, "ClearHook"}, - {65000, &DebugMonitor::AtmosphereGetProcessInfo, "AtmosphereGetProcessInfo"}, - {65001, nullptr, "AtmosphereGetCurrentLimitInfo"}, - }; - // clang-format on - - RegisterHandlers(functions); - } + explicit DebugMonitor(Core::System& system_) : ServiceFramework{system_, "pm:dmnt"} {} private: void GetProcessId(HLERequestContext& ctx) { @@ -164,19 +149,26 @@ private: rb.PushRaw(program_location); rb.PushRaw(override_status); } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetJitDebugProcessIdList"}, + FunctionInfo{1, nullptr, "StartProcess"}, + FunctionInfo{2, &DebugMonitor::GetProcessId, "GetProcessId"}, + FunctionInfo{3, nullptr, "HookToCreateProcess"}, + FunctionInfo{4, &DebugMonitor::GetApplicationProcessId, "GetApplicationProcessId"}, + FunctionInfo{5, nullptr, "HookToCreateApplicationProgress"}, + FunctionInfo{6, nullptr, "ClearHook"}, + FunctionInfo{65000, &DebugMonitor::AtmosphereGetProcessInfo, "AtmosphereGetProcessInfo"}, + FunctionInfo{65001, nullptr, "AtmosphereGetCurrentLimitInfo"} + ); }; class Info final : public ServiceFramework { public: - explicit Info(Core::System& system_) : ServiceFramework{system_, "pm:info"} { - static const FunctionInfo functions[] = { - {0, &Info::GetProgramId, "GetProgramId"}, - {65000, &Info::AtmosphereGetProcessId, "AtmosphereGetProcessId"}, - {65001, nullptr, "AtmosphereHasLaunchedProgram"}, - {65002, nullptr, "AtmosphereGetProcessInfo"}, - }; - RegisterHandlers(functions); - } + explicit Info(Core::System& system_) : ServiceFramework{system_, "pm:info"} {} private: void GetProgramId(HLERequestContext& ctx) { @@ -218,27 +210,24 @@ private: rb.Push(ResultSuccess); rb.Push(process->GetProcessId()); } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &Info::GetProgramId, "GetProgramId"}, + FunctionInfo{65000, &Info::AtmosphereGetProcessId, "AtmosphereGetProcessId"}, + FunctionInfo{65001, nullptr, "AtmosphereHasLaunchedProgram"}, + FunctionInfo{65002, nullptr, "AtmosphereGetProcessInfo"} + ); }; class Shell final : public ServiceFramework { public: - explicit Shell(Core::System& system_) : ServiceFramework{system_, "pm:shell"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "LaunchProgram"}, - {1, nullptr, "TerminateProcess"}, - {2, nullptr, "TerminateProgram"}, - {3, nullptr, "GetProcessEventHandle"}, - {4, nullptr, "GetProcessEventInfo"}, - {5, nullptr, "NotifyBootFinished"}, - {6, &Shell::GetApplicationProcessIdForShell, "GetApplicationProcessIdForShell"}, - {7, nullptr, "BoostSystemMemoryResourceLimit"}, - {8, nullptr, "BoostApplicationThreadResourceLimit"}, - {9, nullptr, "GetBootFinishedEventHandle"}, - }; - // clang-format on + explicit Shell(Core::System& system_) : ServiceFramework{system_, "pm:shell"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -247,6 +236,19 @@ private: auto list = kernel.GetProcessList(); GetApplicationPidGeneric(system.Kernel(), ctx, list); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "LaunchProgram"}, + FunctionInfo{1, nullptr, "TerminateProcess"}, + FunctionInfo{2, nullptr, "TerminateProgram"}, + FunctionInfo{3, nullptr, "GetProcessEventHandle"}, + FunctionInfo{4, nullptr, "GetProcessEventInfo"}, + FunctionInfo{5, nullptr, "NotifyBootFinished"}, + FunctionInfo{6, &Shell::GetApplicationProcessIdForShell, "GetApplicationProcessIdForShell"}, + FunctionInfo{7, nullptr, "BoostSystemMemoryResourceLimit"}, + FunctionInfo{8, nullptr, "BoostApplicationThreadResourceLimit"}, + FunctionInfo{9, nullptr, "GetBootFinishedEventHandle"} + ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/prepo/prepo.cpp b/src/core/hle/service/prepo/prepo.cpp index e76c3ea93c..a199c41d2c 100644 --- a/src/core/hle/service/prepo/prepo.cpp +++ b/src/core/hle/service/prepo/prepo.cpp @@ -21,45 +21,10 @@ namespace Service::PlayReport { class PlayReport final : public ServiceFramework { public: - explicit PlayReport(const char* name, Core::System& system_) : ServiceFramework{system_, name} { - // clang-format off - static const FunctionInfo functions[] = { - {10100, &PlayReport::SaveReport, "SaveReportOld"}, - {10101, &PlayReport::SaveReportWithUser, "SaveReportWithUserOld"}, - {10102, &PlayReport::SaveReport, "SaveReportOld2"}, - {10103, &PlayReport::SaveReportWithUser, "SaveReportWithUserOld2"}, - {10104, &PlayReport::SaveReport, "SaveReportOld3"}, - {10105, &PlayReport::SaveReportWithUser, "SaveReportWithUserOld3"}, - {10106, &PlayReport::SaveReport, "SaveReport"}, - {10107, &PlayReport::SaveReportWithUser, "SaveReportWithUser"}, - {10200, &PlayReport::RequestImmediateTransmission, "RequestImmediateTransmission"}, - {10300, &PlayReport::GetTransmissionStatus, "GetTransmissionStatus"}, - {10400, &PlayReport::GetSystemSessionId, "GetSystemSessionId"}, - {20100, &PlayReport::SaveSystemReportOld, "SaveSystemReport"}, - {20101, &PlayReport::SaveSystemReportWithUserOld, "SaveSystemReportWithUser"}, - {20102, &PlayReport::SaveSystemReport, "SaveSystemReport"}, - {20103, &PlayReport::SaveSystemReportWithUser, "SaveSystemReportWithUser"}, - {20200, nullptr, "SetOperationMode"}, - {30100, nullptr, "ClearStorage"}, - {30200, nullptr, "ClearStatistics"}, - {30300, nullptr, "GetStorageUsage"}, - {30400, nullptr, "GetStatistics"}, - {30401, nullptr, "GetThroughputHistory"}, - {30500, nullptr, "GetLastUploadError"}, - {30600, nullptr, "GetApplicationUploadSummary"}, - {40100, nullptr, "IsUserAgreementCheckEnabled"}, - {40101, nullptr, "SetUserAgreementCheckEnabled"}, - {50100, nullptr, "ReadAllApplicationReportFiles"}, - {90100, nullptr, "ReadAllReportFiles"}, - {90101, nullptr, "Unknown90101"}, - {90102, nullptr, "Unknown90102"}, - {90200, nullptr, "GetStatistics"}, - {90201, nullptr, "GetThroughputHistory"}, - {90300, nullptr, "GetLastUploadError"}, - }; - // clang-format on + explicit PlayReport(const char* name, Core::System& system_) : ServiceFramework{system_, name} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -214,21 +179,51 @@ private: IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{10100, &PlayReport::SaveReport, "SaveReportOld"}, + FunctionInfo{10101, &PlayReport::SaveReportWithUser, "SaveReportWithUserOld"}, + FunctionInfo{10102, &PlayReport::SaveReport, "SaveReportOld2"}, + FunctionInfo{10103, &PlayReport::SaveReportWithUser, "SaveReportWithUserOld2"}, + FunctionInfo{10104, &PlayReport::SaveReport, "SaveReportOld3"}, + FunctionInfo{10105, &PlayReport::SaveReportWithUser, "SaveReportWithUserOld3"}, + FunctionInfo{10106, &PlayReport::SaveReport, "SaveReport"}, + FunctionInfo{10107, &PlayReport::SaveReportWithUser, "SaveReportWithUser"}, + FunctionInfo{10200, &PlayReport::RequestImmediateTransmission, "RequestImmediateTransmission"}, + FunctionInfo{10300, &PlayReport::GetTransmissionStatus, "GetTransmissionStatus"}, + FunctionInfo{10400, &PlayReport::GetSystemSessionId, "GetSystemSessionId"}, + FunctionInfo{20100, &PlayReport::SaveSystemReportOld, "SaveSystemReport"}, + FunctionInfo{20101, &PlayReport::SaveSystemReportWithUserOld, "SaveSystemReportWithUser"}, + FunctionInfo{20102, &PlayReport::SaveSystemReport, "SaveSystemReport"}, + FunctionInfo{20103, &PlayReport::SaveSystemReportWithUser, "SaveSystemReportWithUser"}, + FunctionInfo{20200, nullptr, "SetOperationMode"}, + FunctionInfo{30100, nullptr, "ClearStorage"}, + FunctionInfo{30200, nullptr, "ClearStatistics"}, + FunctionInfo{30300, nullptr, "GetStorageUsage"}, + FunctionInfo{30400, nullptr, "GetStatistics"}, + FunctionInfo{30401, nullptr, "GetThroughputHistory"}, + FunctionInfo{30500, nullptr, "GetLastUploadError"}, + FunctionInfo{30600, nullptr, "GetApplicationUploadSummary"}, + FunctionInfo{40100, nullptr, "IsUserAgreementCheckEnabled"}, + FunctionInfo{40101, nullptr, "SetUserAgreementCheckEnabled"}, + FunctionInfo{50100, nullptr, "ReadAllApplicationReportFiles"}, + FunctionInfo{90100, nullptr, "ReadAllReportFiles"}, + FunctionInfo{90101, nullptr, "Unknown90101"}, + FunctionInfo{90102, nullptr, "Unknown90102"}, + FunctionInfo{90200, nullptr, "GetStatistics"}, + FunctionInfo{90201, nullptr, "GetThroughputHistory"}, + FunctionInfo{90300, nullptr, "GetLastUploadError"} + ); }; void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); - server_manager->RegisterNamedService("prepo:a", - std::make_shared("prepo:a", system)); - server_manager->RegisterNamedService("prepo:a2", - std::make_shared("prepo:a2", system)); - server_manager->RegisterNamedService("prepo:m", - std::make_shared("prepo:m", system)); - server_manager->RegisterNamedService("prepo:s", - std::make_shared("prepo:s", system)); - server_manager->RegisterNamedService("prepo:u", - std::make_shared("prepo:u", system)); + server_manager->RegisterNamedService("prepo:a", std::make_shared("prepo:a", system)); + server_manager->RegisterNamedService("prepo:a2", std::make_shared("prepo:a2", system)); + server_manager->RegisterNamedService("prepo:m", std::make_shared("prepo:m", system)); + server_manager->RegisterNamedService("prepo:s", std::make_shared("prepo:s", system)); + server_manager->RegisterNamedService("prepo:u", std::make_shared("prepo:u", system)); ServerManager::RunServer(std::move(server_manager)); } diff --git a/src/core/hle/service/psc/ovln/receiver.cpp b/src/core/hle/service/psc/ovln/receiver.cpp deleted file mode 100644 index f43d705126..0000000000 --- a/src/core/hle/service/psc/ovln/receiver.cpp +++ /dev/null @@ -1,118 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/hle/service/psc/ovln/receiver.h" -#include "core/hle/service/cmif_serialization.h" - -namespace Service::PSC { - -IReceiver::IReceiver(Core::System& system_) - : ServiceFramework{system_, "IReceiver"}, service_context{system_, "IReceiver"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IReceiver::AddSource>, "AddSource"}, - {1, D<&IReceiver::RemoveSource>, "RemoveSource"}, - {2, D<&IReceiver::GetReceiveEventHandle>, "GetReceiveEventHandle"}, - {3, D<&IReceiver::Receive>, "Receive"}, - {4, D<&IReceiver::ReceiveWithTick>, "ReceiveWithTick"}, - }; - // clang-format on - - RegisterHandlers(functions); - - receive_event = service_context.CreateEvent("IReceiver::ReceiveEvent"); -} - -IReceiver::~IReceiver() { - service_context.CloseEvent(receive_event); -} - -Result IReceiver::AddSource(SourceName source_name) { - const std::string name = source_name.GetString(); - LOG_INFO(Service_PSC, "called: source_name={}", name); - - // Add source if it doesn't already exist - if (message_sources.find(name) == message_sources.end()) { - message_sources[name] = {}; - } - - R_SUCCEED(); -} - -Result IReceiver::RemoveSource(SourceName source_name) { - const std::string name = source_name.GetString(); - LOG_INFO(Service_PSC, "called: source_name={}", name); - - // Remove source if it exists - message_sources.erase(name); - - R_SUCCEED(); -} - -Result IReceiver::GetReceiveEventHandle(OutCopyHandle out_event) { - LOG_INFO(Service_PSC, "called"); - *out_event = &receive_event->GetReadableEvent(); - R_SUCCEED(); -} - -Result IReceiver::Receive(Out out_notification, Out out_flags) { - u64 tick; - return ReceiveWithTick(out_notification, out_flags, Out(&tick)); -} - -Result IReceiver::ReceiveWithTick(Out out_notification, - Out out_flags, Out out_tick) { - LOG_DEBUG(Service_PSC, "called"); - - // Find the message with the lowest ID across all sources - const std::string* target_source = nullptr; - size_t target_index = 0; - - for (const auto& [source_name, messages] : message_sources) { - if (!messages.empty()) { - if (target_source == nullptr) { - target_source = &source_name; - target_index = 0; - } - // Note: In the real implementation, we would track message IDs - // For now, just use FIFO order - } - } - - if (target_source != nullptr) { - auto& messages = message_sources[*target_source]; - *out_notification = messages[target_index].first; - *out_flags = messages[target_index].second; - *out_tick = 0; // TODO: Implement tick tracking - - // Remove the message - messages.erase(messages.begin() + target_index); - - // Clear event if no more messages - bool has_messages = false; - for (const auto& [_, msgs] : message_sources) { - if (!msgs.empty()) { - has_messages = true; - break; - } - } - if (!has_messages) { - receive_event->Clear(system.Kernel()); - } - - R_SUCCEED(); - } - - // No messages available - *out_notification = {}; - *out_flags = {}; - *out_tick = 0; - - LOG_WARNING(Service_PSC, "No messages available"); - R_THROW(ResultUnknown); // TODO: Use proper OvlnResult::NoMessages when available -} - -} // namespace Service::PSC diff --git a/src/core/hle/service/psc/ovln/receiver.h b/src/core/hle/service/psc/ovln/receiver.h deleted file mode 100644 index 2b96216a1a..0000000000 --- a/src/core/hle/service/psc/ovln/receiver.h +++ /dev/null @@ -1,46 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include -#include -#include -#include "core/hle/result.h" -#include "core/hle/service/cmif_types.h" -#include "core/hle/service/kernel_helpers.h" -#include "core/hle/service/service.h" -#include "core/hle/service/psc/ovln/ovln_types.h" - -namespace Kernel { -class KReadableEvent; -} - -namespace Service::PSC { - -class IReceiver final : public ServiceFramework { -public: - explicit IReceiver(Core::System& system_); - ~IReceiver() override; - - IReceiver(const IReceiver&) = delete; - IReceiver& operator=(const IReceiver&) = delete; - -private: - Result AddSource(SourceName source_name); - Result RemoveSource(SourceName source_name); - Result GetReceiveEventHandle(OutCopyHandle out_event); - Result Receive(Out out_notification, Out out_flags); - Result ReceiveWithTick(Out out_notification, Out out_flags, - Out out_tick); - - KernelHelpers::ServiceContext service_context; - Kernel::KEvent* receive_event; - - std::map>> message_sources; -}; - -} // namespace Service::PSC diff --git a/src/core/hle/service/psc/ovln/receiver_service.cpp b/src/core/hle/service/psc/ovln/receiver_service.cpp index 3b0b180725..0df9d802b9 100644 --- a/src/core/hle/service/psc/ovln/receiver_service.cpp +++ b/src/core/hle/service/psc/ovln/receiver_service.cpp @@ -5,19 +5,126 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "core/hle/service/cmif_serialization.h" -#include "core/hle/service/psc/ovln/receiver.h" +#include "core/hle/service/psc/ovln/ovln_types.h" #include "core/hle/service/psc/ovln/receiver_service.h" namespace Service::PSC { -IReceiverService::IReceiverService(Core::System& system_) : ServiceFramework{system_, "ovln:rcv"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IReceiverService::OpenReceiver>, "OpenReceiver"}, - }; - // clang-format on +class IReceiver final : public ServiceFramework { +public: + explicit IReceiver(Core::System& system_) : ServiceFramework{system_, "IReceiver"}, service_context{system_, "IReceiver"} { + receive_event = service_context.CreateEvent("IReceiver::ReceiveEvent"); + } - RegisterHandlers(functions); + ~IReceiver() override { + service_context.CloseEvent(receive_event); + } + + Result AddSource(SourceName source_name) { + const std::string name = source_name.GetString(); + LOG_INFO(Service_PSC, "called: source_name={}", name); + // Add source if it doesn't already exist + if (message_sources.find(name) == message_sources.end()) { + message_sources[name] = {}; + } + R_SUCCEED(); + } + + Result RemoveSource(SourceName source_name) { + const std::string name = source_name.GetString(); + LOG_INFO(Service_PSC, "called: source_name={}", name); + // Remove source if it exists + message_sources.erase(name); + R_SUCCEED(); + } + + Result GetReceiveEventHandle(OutCopyHandle out_event) { + LOG_INFO(Service_PSC, "called"); + *out_event = &receive_event->GetReadableEvent(); + R_SUCCEED(); + } + + Result Receive(Out out_notification, Out out_flags) { + u64 tick; + return ReceiveWithTick(out_notification, out_flags, Out(&tick)); + } + + Result ReceiveWithTick(Out out_notification, Out out_flags, Out out_tick) { + LOG_DEBUG(Service_PSC, "called"); + + // Find the message with the lowest ID across all sources + const std::string* target_source = nullptr; + size_t target_index = 0; + + for (const auto& [source_name, messages] : message_sources) { + if (!messages.empty()) { + if (target_source == nullptr) { + target_source = &source_name; + target_index = 0; + } + // Note: In the real implementation, we would track message IDs + // For now, just use FIFO order + } + } + + if (target_source != nullptr) { + auto& messages = message_sources[*target_source]; + *out_notification = messages[target_index].first; + *out_flags = messages[target_index].second; + *out_tick = 0; // TODO: Implement tick tracking + + // Remove the message + messages.erase(messages.begin() + target_index); + + // Clear event if no more messages + bool has_messages = false; + for (const auto& [_, msgs] : message_sources) { + if (!msgs.empty()) { + has_messages = true; + break; + } + } + if (!has_messages) { + receive_event->Clear(system.Kernel()); + } + + R_SUCCEED(); + } + + // No messages available + *out_notification = {}; + *out_flags = {}; + *out_tick = 0; + + LOG_WARNING(Service_PSC, "No messages available"); + R_THROW(ResultUnknown); // TODO: Use proper OvlnResult::NoMessages when available + } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IReceiver::AddSource>, "AddSource"}, + FunctionInfo{1, D<&IReceiver::RemoveSource>, "RemoveSource"}, + FunctionInfo{2, D<&IReceiver::GetReceiveEventHandle>, "GetReceiveEventHandle"}, + FunctionInfo{3, D<&IReceiver::Receive>, "Receive"}, + FunctionInfo{4, D<&IReceiver::ReceiveWithTick>, "ReceiveWithTick"} + ); + + KernelHelpers::ServiceContext service_context; + Kernel::KEvent* receive_event; + + std::map>> message_sources; +}; + +std::optional IReceiverService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IReceiverService::OpenReceiver>, "OpenReceiver"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + +IReceiverService::IReceiverService(Core::System& system_) : ServiceFramework{system_, "ovln:rcv"} { } IReceiverService::~IReceiverService() = default; diff --git a/src/core/hle/service/psc/ovln/receiver_service.h b/src/core/hle/service/psc/ovln/receiver_service.h index b3b31ba4aa..bd053cd50c 100644 --- a/src/core/hle/service/psc/ovln/receiver_service.h +++ b/src/core/hle/service/psc/ovln/receiver_service.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -17,6 +20,8 @@ public: private: Result OpenReceiver(Out> out_receiver); + + std::optional FindRequest(u32 key) override; }; } // namespace Service::PSC diff --git a/src/core/hle/service/psc/ovln/sender.cpp b/src/core/hle/service/psc/ovln/sender.cpp deleted file mode 100644 index 3227a56f25..0000000000 --- a/src/core/hle/service/psc/ovln/sender.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/hle/service/cmif_serialization.h" -#include "core/hle/service/psc/ovln/sender.h" - -namespace Service::PSC { - -ISender::ISender(Core::System& system_) : ServiceFramework{system_, "ISender"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&ISender::Send>, "Send"}, - {1, nullptr, "GetUnreceivedMessageCount"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - -ISender::~ISender() = default; - -Result ISender::Send(const OverlayNotification& notification, MessageFlags flags) { - std::string data; - for (const auto m : notification) { - data += fmt::format("{:016X} ", m); - } - - LOG_WARNING(Service_PSC, "(STUBBED) called, flags={} notification={}", flags.raw, data); - R_SUCCEED(); -} - -} // namespace Service::PSC diff --git a/src/core/hle/service/psc/ovln/sender.h b/src/core/hle/service/psc/ovln/sender.h deleted file mode 100644 index c1575428e3..0000000000 --- a/src/core/hle/service/psc/ovln/sender.h +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/cmif_types.h" -#include "core/hle/service/psc/ovln/ovln_types.h" -#include "core/hle/service/service.h" - -namespace Service::PSC { - -class ISender final : public ServiceFramework { -public: - explicit ISender(Core::System& system_); - ~ISender() override; - -private: - Result Send(const OverlayNotification& notification, MessageFlags flags); -}; - -} // namespace Service::PSC diff --git a/src/core/hle/service/psc/ovln/sender_service.cpp b/src/core/hle/service/psc/ovln/sender_service.cpp index 18d2c83a3d..5a36f1e1ec 100644 --- a/src/core/hle/service/psc/ovln/sender_service.cpp +++ b/src/core/hle/service/psc/ovln/sender_service.cpp @@ -1,20 +1,47 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #include "core/hle/service/cmif_serialization.h" -#include "core/hle/service/psc/ovln/sender.h" +#include "core/hle/service/psc/ovln/ovln_types.h" #include "core/hle/service/psc/ovln/sender_service.h" namespace Service::PSC { -ISenderService::ISenderService(Core::System& system_) : ServiceFramework{system_, "ovln:snd"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&ISenderService::OpenSender>, "OpenSender"}, - }; - // clang-format on +class ISender final : public ServiceFramework { +public: + explicit ISender(Core::System& system_) : ServiceFramework{system_, "ISender"} {} + ~ISender() override = default; - RegisterHandlers(functions); + Result Send(const OverlayNotification& notification, MessageFlags flags) { + std::string data; + for (const auto m : notification) { + data += fmt::format("{:016X} ", m); + } + + LOG_WARNING(Service_PSC, "(STUBBED) called, flags={} notification={}", flags.raw, data); + R_SUCCEED(); + } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&ISender::Send>, "Send"}, + FunctionInfo{1, nullptr, "GetUnreceivedMessageCount"} + ); +}; + +std::optional ISenderService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&ISenderService::OpenSender>, "OpenSender"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + +ISenderService::ISenderService(Core::System& system_) : ServiceFramework{system_, "ovln:snd"} { } ISenderService::~ISenderService() = default; diff --git a/src/core/hle/service/psc/ovln/sender_service.h b/src/core/hle/service/psc/ovln/sender_service.h index 10027701f4..90a9a33872 100644 --- a/src/core/hle/service/psc/ovln/sender_service.h +++ b/src/core/hle/service/psc/ovln/sender_service.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -16,8 +19,9 @@ public: ~ISenderService() override; private: - Result OpenSender(Out> out_sender, u32 sender_id, - std::array data); + Result OpenSender(Out> out_sender, u32 sender_id, std::array data); + + std::optional FindRequest(u32 key) override; }; } // namespace Service::PSC diff --git a/src/core/hle/service/psc/pm_control.cpp b/src/core/hle/service/psc/pm_control.cpp deleted file mode 100644 index 7dedb76629..0000000000 --- a/src/core/hle/service/psc/pm_control.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/hle/service/psc/pm_control.h" - -namespace Service::PSC { - -IPmControl::IPmControl(Core::System& system_) : ServiceFramework{system_, "psc:c"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "Initialize"}, - {1, nullptr, "DispatchRequest"}, - {2, nullptr, "GetResult"}, - {3, nullptr, "GetState"}, - {4, nullptr, "Cancel"}, - {5, nullptr, "PrintModuleInformation"}, - {6, nullptr, "GetModuleInformation"}, - {10, nullptr, "AcquireStateLock"}, - {11, nullptr, "HasStateLock"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - -IPmControl::~IPmControl() = default; - -} // namespace Service::PSC diff --git a/src/core/hle/service/psc/pm_control.h b/src/core/hle/service/psc/pm_control.h deleted file mode 100644 index e0ae2f39ca..0000000000 --- a/src/core/hle/service/psc/pm_control.h +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/service.h" - -namespace Service::PSC { - -class IPmControl final : public ServiceFramework { -public: - explicit IPmControl(Core::System& system_); - ~IPmControl() override; -}; - -} // namespace Service::PSC diff --git a/src/core/hle/service/psc/pm_module.cpp b/src/core/hle/service/psc/pm_module.cpp deleted file mode 100644 index 74dc7ed4e8..0000000000 --- a/src/core/hle/service/psc/pm_module.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/hle/service/psc/pm_module.h" - -namespace Service::PSC { - -IPmModule::IPmModule(Core::System& system_) : ServiceFramework{system_, "IPmModule"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "Initialize"}, - {1, nullptr, "GetRequest"}, - {2, nullptr, "Acknowledge"}, - {3, nullptr, "Finalize"}, - {4, nullptr, "AcknowledgeEx"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - -IPmModule::~IPmModule() = default; - -} // namespace Service::PSC diff --git a/src/core/hle/service/psc/pm_module.h b/src/core/hle/service/psc/pm_module.h deleted file mode 100644 index b3a2d25842..0000000000 --- a/src/core/hle/service/psc/pm_module.h +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/service.h" - -namespace Service::PSC { - -class IPmModule final : public ServiceFramework { -public: - explicit IPmModule(Core::System& system_); - ~IPmModule() override; -}; - -} // namespace Service::PSC diff --git a/src/core/hle/service/psc/pm_service.cpp b/src/core/hle/service/psc/pm_service.cpp deleted file mode 100644 index c4e0ad2286..0000000000 --- a/src/core/hle/service/psc/pm_service.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/hle/service/cmif_serialization.h" -#include "core/hle/service/psc/pm_module.h" -#include "core/hle/service/psc/pm_service.h" - -namespace Service::PSC { - -IPmService::IPmService(Core::System& system_) : ServiceFramework{system_, "psc:m"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IPmService::GetPmModule>, "GetPmModule"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - -IPmService::~IPmService() = default; - -Result IPmService::GetPmModule(Out> out_module) { - LOG_DEBUG(Service_PSC, "called"); - *out_module = std::make_shared(system); - R_SUCCEED(); -} - -} // namespace Service::PSC diff --git a/src/core/hle/service/psc/pm_service.h b/src/core/hle/service/psc/pm_service.h deleted file mode 100644 index 08e14c6f8f..0000000000 --- a/src/core/hle/service/psc/pm_service.h +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/cmif_types.h" -#include "core/hle/service/service.h" - -namespace Service::PSC { - -class IPmModule; - -class IPmService final : public ServiceFramework { -public: - explicit IPmService(Core::System& system_); - ~IPmService() override; - -private: - Result GetPmModule(Out> out_module); -}; - -} // namespace Service::PSC diff --git a/src/core/hle/service/psc/psc.cpp b/src/core/hle/service/psc/psc.cpp index 31fb9f0117..553c4f63a4 100644 --- a/src/core/hle/service/psc/psc.cpp +++ b/src/core/hle/service/psc/psc.cpp @@ -6,102 +6,159 @@ #include "core/hle/service/psc/ovln/receiver_service.h" #include "core/hle/service/psc/ovln/sender_service.h" -#include "core/hle/service/psc/pm_control.h" -#include "core/hle/service/psc/pm_service.h" #include "core/hle/service/psc/psc.h" #include "core/hle/service/psc/time/manager.h" #include "core/hle/service/psc/time/power_state_service.h" #include "core/hle/service/psc/time/service_manager.h" #include "core/hle/service/psc/time/static.h" #include "core/hle/service/service.h" +#include "core/hle/service/cmif_serialization.h" namespace Service::PSC { class PSC_L final : public ServiceFramework { public: - explicit PSC_L(Core::System& system_) : ServiceFramework{system_, "psc:l"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "Initialize_3"}, - {1, nullptr, "Lock"}, - {2, nullptr, "Unlock"}, - {3, nullptr, "IsLocked"}, - {4, nullptr, "GetRelatedState"}, - }; - // clang-format on - RegisterHandlers(functions); + explicit PSC_L(Core::System& system_) : ServiceFramework{system_, "psc:l"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "Initialize_3"}, + FunctionInfo{1, nullptr, "Lock"}, + FunctionInfo{2, nullptr, "Unlock"}, + FunctionInfo{3, nullptr, "IsLocked"}, + FunctionInfo{4, nullptr, "GetRelatedState"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class INS_R final : public ServiceFramework { public: - explicit INS_R(Core::System& system_) : ServiceFramework{system_, "ins:r"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetInputSourceState"}, - {1, nullptr, "GetTriggerTargetEvent"}, - }; - // clang-format on - RegisterHandlers(functions); + explicit INS_R(Core::System& system_) : ServiceFramework{system_, "ins:r"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetInputSourceState"}, + FunctionInfo{1, nullptr, "GetTriggerTargetEvent"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class INS_S final : public ServiceFramework { public: - explicit INS_S(Core::System& system_) : ServiceFramework{system_, "ins:s"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetNotifyEvent"}, - }; - // clang-format on - RegisterHandlers(functions); + explicit INS_S(Core::System& system_) : ServiceFramework{system_, "ins:s"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetNotifyEvent"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class HSHL_SYS final : public ServiceFramework { public: - explicit HSHL_SYS(Core::System& system_) : ServiceFramework{system_, "hshl:sys"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetBatteryPercentage"}, - {1, nullptr, "GetChargerType"}, - {2, nullptr, "OpenChargeSession"}, - {3, nullptr, "GetRawBatteryPercentage"}, - {4, nullptr, "GetBatteryVoltageLevel"}, - {5, nullptr, "OpenThermalSession"}, - {6, nullptr, "GetAbnormalTemperatureSet"}, - {7, nullptr, "OpenClockSession"}, - {8, nullptr, "GetClockRate"}, - {9, nullptr, "OpenBridgeSession"}, - {10, nullptr, "GetBridgePowerSupply"}, - {11, nullptr, "OpenVsysVoltageSession"}, - {12, nullptr, "GetIsBatteryEnoughForFullAwake"}, - {13, nullptr, "GetIsCharging"}, - {14, nullptr, "Cmd14"}, - {15, nullptr, "Cmd15"}, - }; - // clang-format on - RegisterHandlers(functions); + explicit HSHL_SYS(Core::System& system_) : ServiceFramework{system_, "hshl:sys"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetBatteryPercentage"}, + FunctionInfo{1, nullptr, "GetChargerType"}, + FunctionInfo{2, nullptr, "OpenChargeSession"}, + FunctionInfo{3, nullptr, "GetRawBatteryPercentage"}, + FunctionInfo{4, nullptr, "GetBatteryVoltageLevel"}, + FunctionInfo{5, nullptr, "OpenThermalSession"}, + FunctionInfo{6, nullptr, "GetAbnormalTemperatureSet"}, + FunctionInfo{7, nullptr, "OpenClockSession"}, + FunctionInfo{8, nullptr, "GetClockRate"}, + FunctionInfo{9, nullptr, "OpenBridgeSession"}, + FunctionInfo{10, nullptr, "GetBridgePowerSupply"}, + FunctionInfo{11, nullptr, "OpenVsysVoltageSession"}, + FunctionInfo{12, nullptr, "GetIsBatteryEnoughForFullAwake"}, + FunctionInfo{13, nullptr, "GetIsCharging"}, + FunctionInfo{14, nullptr, "Cmd14"}, + FunctionInfo{15, nullptr, "Cmd15"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class HSHL_SET final : public ServiceFramework { public: - explicit HSHL_SET(Core::System& system_) : ServiceFramework{system_, "hshl:set"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "OpenChargeSession_2"}, - {1, nullptr, "OpenThermalSession_2"}, - {2, nullptr, "SetClockRate"}, - {3, nullptr, "SetBridgePowerSupply"}, - {4, nullptr, "Cmd4"}, - {5, nullptr, "Cmd5"}, - }; - // clang-format on - RegisterHandlers(functions); + explicit HSHL_SET(Core::System& system_) : ServiceFramework{system_, "hshl:set"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "OpenChargeSession_2"}, + FunctionInfo{1, nullptr, "OpenThermalSession_2"}, + FunctionInfo{2, nullptr, "SetClockRate"}, + FunctionInfo{3, nullptr, "SetBridgePowerSupply"}, + FunctionInfo{4, nullptr, "Cmd4"}, + FunctionInfo{5, nullptr, "Cmd5"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; +class IPmModule final : public ServiceFramework { +public: + explicit IPmModule(Core::System& system_) : ServiceFramework{system_, "IPmModule"} {} + ~IPmModule() override = default; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "Initialize"}, + FunctionInfo{1, nullptr, "GetRequest"}, + FunctionInfo{2, nullptr, "Acknowledge"}, + FunctionInfo{3, nullptr, "Finalize"}, + FunctionInfo{4, nullptr, "AcknowledgeEx"} + ); +}; + +class IPmService final : public ServiceFramework { +public: + explicit IPmService(Core::System& system_) : ServiceFramework{system_, "psc:m"} {} + ~IPmService() override = default; + +private: + Result GetPmModule(Out> out_module) { + LOG_DEBUG(Service_PSC, "called"); + *out_module = std::make_shared(system); + R_SUCCEED(); + } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IPmService::GetPmModule>, "GetPmModule"} + ); +}; + +class IPmControl final : public ServiceFramework { +public: + explicit IPmControl(Core::System& system_) : ServiceFramework{system_, "psc:c"} {} + ~IPmControl() override = default; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "Initialize"}, + FunctionInfo{1, nullptr, "DispatchRequest"}, + FunctionInfo{2, nullptr, "GetResult"}, + FunctionInfo{3, nullptr, "GetState"}, + FunctionInfo{4, nullptr, "Cancel"}, + FunctionInfo{5, nullptr, "PrintModuleInformation"}, + FunctionInfo{6, nullptr, "GetModuleInformation"}, + FunctionInfo{10, nullptr, "AcquireStateLock"}, + FunctionInfo{11, nullptr, "HasStateLock"} + ); +}; + void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); diff --git a/src/core/hle/service/psc/time/alarms.cpp b/src/core/hle/service/psc/time/alarms.cpp index 17a795c4c5..c9070896b3 100644 --- a/src/core/hle/service/psc/time/alarms.cpp +++ b/src/core/hle/service/psc/time/alarms.cpp @@ -33,8 +33,7 @@ Alarm::~Alarm() { } Alarms::Alarms(Core::System& system, StandardSteadyClockCore& steady_clock, PowerStateRequestManager& power_state_request_manager) - : m_system{system} - , m_ctx{system, "Psc:Alarms"} + : m_ctx{system, "Psc:Alarms"} , m_steady_clock{steady_clock} , m_power_state_request_manager{power_state_request_manager} , m_event{m_ctx.CreateEvent("Psc:Alarms:Event")} @@ -136,15 +135,7 @@ Result Alarms::UpdateClosestAndSignal(Kernel::KernelCore& kernel) { IAlarmService::IAlarmService(Core::System& system_, std::shared_ptr manager) : ServiceFramework{system_, "time:al"} , m_alarms{manager->m_alarms} -{ - // clang-format off - static const FunctionInfo functions[] = { - {0, &IAlarmService::CreateWakeupAlarm, "CreateWakeupAlarm"}, - {1, &IAlarmService::CreateBackgroundTaskAlarm, "CreateBackgroundTaskAlarm"}, - }; - // clang-format on - RegisterHandlers(functions); -} +{} void IAlarmService::CreateWakeupAlarm(HLERequestContext& ctx) { LOG_DEBUG(Service_Time, "called."); @@ -165,17 +156,6 @@ void IAlarmService::CreateBackgroundTaskAlarm(HLERequestContext& ctx) { ISteadyClockAlarm::ISteadyClockAlarm(Core::System& system_, Alarms& alarms, AlarmType type) : ServiceFramework{system_, "ISteadyClockAlarm"}, m_ctx{system, "Psc:ISteadyClockAlarm"}, m_alarms{alarms}, m_alarm{system, m_ctx, type} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &ISteadyClockAlarm::GetAlarmEvent, "GetAlarmEvent"}, - {1, &ISteadyClockAlarm::Enable, "Enable"}, - {2, &ISteadyClockAlarm::Disable, "Disable"}, - {3, &ISteadyClockAlarm::IsEnabled, "IsEnabled"}, - {10, nullptr, "CreateWakeLock"}, - {11, nullptr, "DestroyWakeLock"}, - }; - // clang-format on - RegisterHandlers(functions); } void ISteadyClockAlarm::GetAlarmEvent(HLERequestContext& ctx) { diff --git a/src/core/hle/service/psc/time/alarms.h b/src/core/hle/service/psc/time/alarms.h index 0a2fa7fac5..6d916ca198 100644 --- a/src/core/hle/service/psc/time/alarms.h +++ b/src/core/hle/service/psc/time/alarms.h @@ -95,7 +95,6 @@ private: void Erase(Kernel::KernelCore& kernel, Alarm& alarm); Result UpdateClosestAndSignal(Kernel::KernelCore& kernel); - Core::System& m_system; KernelHelpers::ServiceContext m_ctx; StandardSteadyClockCore& m_steady_clock; @@ -114,6 +113,14 @@ public: private: void CreateWakeupAlarm(HLERequestContext& ctx); void CreateBackgroundTaskAlarm(HLERequestContext& ctx); + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &IAlarmService::CreateWakeupAlarm, "CreateWakeupAlarm"}, + FunctionInfo{1, &IAlarmService::CreateBackgroundTaskAlarm, "CreateBackgroundTaskAlarm"} + ); Alarms& m_alarms; }; @@ -128,8 +135,18 @@ private: void Disable(HLERequestContext& ctx); void IsEnabled(HLERequestContext& ctx); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &ISteadyClockAlarm::GetAlarmEvent, "GetAlarmEvent"}, + FunctionInfo{1, &ISteadyClockAlarm::Enable, "Enable"}, + FunctionInfo{2, &ISteadyClockAlarm::Disable, "Disable"}, + FunctionInfo{3, &ISteadyClockAlarm::IsEnabled, "IsEnabled"}, + FunctionInfo{10, nullptr, "CreateWakeLock"}, + FunctionInfo{11, nullptr, "DestroyWakeLock"} + ); KernelHelpers::ServiceContext m_ctx; - Alarms& m_alarms; Alarm m_alarm; }; diff --git a/src/core/hle/service/psc/time/manager.h b/src/core/hle/service/psc/time/manager.h index 62ded12475..2cb8b58a2b 100644 --- a/src/core/hle/service/psc/time/manager.h +++ b/src/core/hle/service/psc/time/manager.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -23,20 +26,20 @@ namespace Service::PSC::Time { class TimeManager { public: explicit TimeManager(Core::System& system) - : m_system{system}, m_standard_steady_clock{system}, m_tick_based_steady_clock{m_system}, - m_standard_local_system_clock{m_standard_steady_clock}, - m_standard_network_system_clock{m_standard_steady_clock}, - m_standard_user_system_clock{m_system, m_standard_local_system_clock, - m_standard_network_system_clock}, - m_ephemeral_network_clock{m_tick_based_steady_clock}, m_shared_memory{m_system}, - m_power_state_request_manager{m_system}, m_alarms{m_system, m_standard_steady_clock, - m_power_state_request_manager}, - m_local_system_clock_context_writer{m_system, m_shared_memory}, - m_network_system_clock_context_writer{m_system, m_shared_memory, - m_standard_user_system_clock}, - m_ephemeral_network_clock_context_writer{m_system} {} - - Core::System& m_system; + : m_standard_steady_clock{system} + , m_tick_based_steady_clock{system} + , m_standard_local_system_clock{m_standard_steady_clock} + , m_standard_network_system_clock{m_standard_steady_clock} + , m_standard_user_system_clock{system, m_standard_local_system_clock + , m_standard_network_system_clock} + , m_ephemeral_network_clock{m_tick_based_steady_clock} + , m_shared_memory{system} + , m_power_state_request_manager{system} + , m_alarms{system, m_standard_steady_clock, m_power_state_request_manager} + , m_local_system_clock_context_writer{system, m_shared_memory} + , m_network_system_clock_context_writer{system, m_shared_memory, m_standard_user_system_clock} + , m_ephemeral_network_clock_context_writer{system} + {} StandardSteadyClockCore m_standard_steady_clock; TickBasedSteadyClockCore m_tick_based_steady_clock; diff --git a/src/core/hle/service/psc/time/power_state_service.cpp b/src/core/hle/service/psc/time/power_state_service.cpp index 39af16b6f1..795aeb94a8 100644 --- a/src/core/hle/service/psc/time/power_state_service.cpp +++ b/src/core/hle/service/psc/time/power_state_service.cpp @@ -9,20 +9,19 @@ namespace Service::PSC::Time { +std::optional IPowerStateRequestHandler::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IPowerStateRequestHandler::GetPowerStateRequestEventReadableHandle>, "GetPowerStateRequestEventReadableHandle"}, + FunctionInfo{1, D<&IPowerStateRequestHandler::GetAndClearPowerStateRequest>, "GetAndClearPowerStateRequest"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IPowerStateRequestHandler::IPowerStateRequestHandler( Core::System& system_, PowerStateRequestManager& power_state_request_manager) : ServiceFramework{system_, "time:p"} , m_power_state_request_manager{power_state_request_manager} -{ - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&IPowerStateRequestHandler::GetPowerStateRequestEventReadableHandle>, "GetPowerStateRequestEventReadableHandle"}, - {1, D<&IPowerStateRequestHandler::GetAndClearPowerStateRequest>, "GetAndClearPowerStateRequest"}, - }; - // clang-format on - - RegisterHandlers(functions); -} +{} Result IPowerStateRequestHandler::GetPowerStateRequestEventReadableHandle( OutCopyHandle out_event) { diff --git a/src/core/hle/service/psc/time/power_state_service.h b/src/core/hle/service/psc/time/power_state_service.h index 81b3adf234..14d9c1a77a 100644 --- a/src/core/hle/service/psc/time/power_state_service.h +++ b/src/core/hle/service/psc/time/power_state_service.h @@ -27,6 +27,7 @@ public: Result GetAndClearPowerStateRequest(Out out_cleared, Out out_priority); private: + std::optional FindRequest(u32 key) override; PowerStateRequestManager& m_power_state_request_manager; }; diff --git a/src/core/hle/service/psc/time/service_manager.cpp b/src/core/hle/service/psc/time/service_manager.cpp index e9f1407e4d..be25ee9a70 100644 --- a/src/core/hle/service/psc/time/service_manager.cpp +++ b/src/core/hle/service/psc/time/service_manager.cpp @@ -13,6 +13,30 @@ namespace Service::PSC::Time { + std::optional ServiceManager::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&ServiceManager::GetStaticServiceAsUser>, "GetStaticServiceAsUser"}, + FunctionInfo{5, D<&ServiceManager::GetStaticServiceAsAdmin>, "GetStaticServiceAsAdmin"}, + FunctionInfo{6, D<&ServiceManager::GetStaticServiceAsRepair>, "GetStaticServiceAsRepair"}, + FunctionInfo{9, D<&ServiceManager::GetStaticServiceAsServiceManager>, "GetStaticServiceAsServiceManager"}, + FunctionInfo{10, D<&ServiceManager::SetupStandardSteadyClockCore>, "SetupStandardSteadyClockCore"}, + FunctionInfo{11, D<&ServiceManager::SetupStandardLocalSystemClockCore>, "SetupStandardLocalSystemClockCore"}, + FunctionInfo{12, D<&ServiceManager::SetupStandardNetworkSystemClockCore>, "SetupStandardNetworkSystemClockCore"}, + FunctionInfo{13, D<&ServiceManager::SetupStandardUserSystemClockCore>, "SetupStandardUserSystemClockCore"}, + FunctionInfo{14, D<&ServiceManager::SetupTimeZoneServiceCore>, "SetupTimeZoneServiceCore"}, + FunctionInfo{15, D<&ServiceManager::SetupEphemeralNetworkSystemClockCore>, "SetupEphemeralNetworkSystemClockCore"}, + FunctionInfo{50, D<&ServiceManager::GetStandardLocalClockOperationEvent>, "GetStandardLocalClockOperationEvent"}, + FunctionInfo{51, D<&ServiceManager::GetStandardNetworkClockOperationEventForServiceManager>, "GetStandardNetworkClockOperationEventForServiceManager"}, + FunctionInfo{52, D<&ServiceManager::GetEphemeralNetworkClockOperationEventForServiceManager>, "GetEphemeralNetworkClockOperationEventForServiceManager"}, + FunctionInfo{60, D<&ServiceManager::GetStandardUserSystemClockAutomaticCorrectionUpdatedEvent>, "GetStandardUserSystemClockAutomaticCorrectionUpdatedEvent"}, + FunctionInfo{100, D<&ServiceManager::SetStandardSteadyClockBaseTime>, "SetStandardSteadyClockBaseTime"}, + FunctionInfo{200, D<&ServiceManager::GetClosestAlarmUpdatedEvent>, "GetClosestAlarmUpdatedEvent"}, + FunctionInfo{201, D<&ServiceManager::CheckAndSignalAlarms>, "CheckAndSignalAlarms"}, + FunctionInfo{202, D<&ServiceManager::GetClosestAlarmInfo>, "GetClosestAlarmInfo "} + ); + return HandlerTableGenerateWithFind(key, functions); + } + ServiceManager::ServiceManager(Core::System& system_, std::shared_ptr time, ServerManager* server_manager) : ServiceFramework{system_, "time:m"}, m_time{std::move(time)}, @@ -27,30 +51,6 @@ ServiceManager::ServiceManager(Core::System& system_, std::shared_ptrm_network_system_clock_context_writer}, m_ephemeral_system_context_writer{m_time->m_ephemeral_network_clock_context_writer}, m_local_operation{system_}, m_network_operation{system_}, m_ephemeral_operation{system_} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&ServiceManager::GetStaticServiceAsUser>, "GetStaticServiceAsUser"}, - {5, D<&ServiceManager::GetStaticServiceAsAdmin>, "GetStaticServiceAsAdmin"}, - {6, D<&ServiceManager::GetStaticServiceAsRepair>, "GetStaticServiceAsRepair"}, - {9, D<&ServiceManager::GetStaticServiceAsServiceManager>, "GetStaticServiceAsServiceManager"}, - {10, D<&ServiceManager::SetupStandardSteadyClockCore>, "SetupStandardSteadyClockCore"}, - {11, D<&ServiceManager::SetupStandardLocalSystemClockCore>, "SetupStandardLocalSystemClockCore"}, - {12, D<&ServiceManager::SetupStandardNetworkSystemClockCore>, "SetupStandardNetworkSystemClockCore"}, - {13, D<&ServiceManager::SetupStandardUserSystemClockCore>, "SetupStandardUserSystemClockCore"}, - {14, D<&ServiceManager::SetupTimeZoneServiceCore>, "SetupTimeZoneServiceCore"}, - {15, D<&ServiceManager::SetupEphemeralNetworkSystemClockCore>, "SetupEphemeralNetworkSystemClockCore"}, - {50, D<&ServiceManager::GetStandardLocalClockOperationEvent>, "GetStandardLocalClockOperationEvent"}, - {51, D<&ServiceManager::GetStandardNetworkClockOperationEventForServiceManager>, "GetStandardNetworkClockOperationEventForServiceManager"}, - {52, D<&ServiceManager::GetEphemeralNetworkClockOperationEventForServiceManager>, "GetEphemeralNetworkClockOperationEventForServiceManager"}, - {60, D<&ServiceManager::GetStandardUserSystemClockAutomaticCorrectionUpdatedEvent>, "GetStandardUserSystemClockAutomaticCorrectionUpdatedEvent"}, - {100, D<&ServiceManager::SetStandardSteadyClockBaseTime>, "SetStandardSteadyClockBaseTime"}, - {200, D<&ServiceManager::GetClosestAlarmUpdatedEvent>, "GetClosestAlarmUpdatedEvent"}, - {201, D<&ServiceManager::CheckAndSignalAlarms>, "CheckAndSignalAlarms"}, - {202, D<&ServiceManager::GetClosestAlarmInfo>, "GetClosestAlarmInfo "}, - }; - // clang-format on - RegisterHandlers(functions); - m_local_system_context_writer.Link(m_local_operation); m_network_system_context_writer.Link(m_network_operation); m_ephemeral_system_context_writer.Link(m_ephemeral_operation); diff --git a/src/core/hle/service/psc/time/service_manager.h b/src/core/hle/service/psc/time/service_manager.h index 09cff25038..a8b94d8939 100644 --- a/src/core/hle/service/psc/time/service_manager.h +++ b/src/core/hle/service/psc/time/service_manager.h @@ -65,6 +65,8 @@ private: void SetupSAndP(); Result GetStaticService(OutInterface out_service, StaticServiceSetupInfo setup_info, const char* name); + std::optional FindRequest(u32 key) override; + std::shared_ptr m_time; ServerManager& m_server_manager; bool m_is_s_and_p_setup{}; diff --git a/src/core/hle/service/psc/time/static.cpp b/src/core/hle/service/psc/time/static.cpp index 28cff3b764..2b2b6f1f04 100644 --- a/src/core/hle/service/psc/time/static.cpp +++ b/src/core/hle/service/psc/time/static.cpp @@ -33,6 +33,31 @@ constexpr Result GetTimeFromTimePointAndContext(s64* out_time, SteadyClockTimePo } } // namespace +std::optional StaticService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&StaticService::GetStandardUserSystemClock>, "GetStandardUserSystemClock"}, + FunctionInfo{1, D<&StaticService::GetStandardNetworkSystemClock>, "GetStandardNetworkSystemClock"}, + FunctionInfo{2, D<&StaticService::GetStandardSteadyClock>, "GetStandardSteadyClock"}, + FunctionInfo{3, D<&StaticService::GetTimeZoneService>, "GetTimeZoneService"}, + FunctionInfo{4, D<&StaticService::GetStandardLocalSystemClock>, "GetStandardLocalSystemClock"}, + FunctionInfo{5, D<&StaticService::GetEphemeralNetworkSystemClock>, "GetEphemeralNetworkSystemClock"}, + FunctionInfo{20, D<&StaticService::GetSharedMemoryNativeHandle>, "GetSharedMemoryNativeHandle"}, + FunctionInfo{50, D<&StaticService::SetStandardSteadyClockInternalOffset>, "SetStandardSteadyClockInternalOffset"}, + FunctionInfo{51, D<&StaticService::GetStandardSteadyClockRtcValue>, "GetStandardSteadyClockRtcValue"}, + FunctionInfo{100, D<&StaticService::IsStandardUserSystemClockAutomaticCorrectionEnabled>, "IsStandardUserSystemClockAutomaticCorrectionEnabled"}, + FunctionInfo{101, D<&StaticService::SetStandardUserSystemClockAutomaticCorrectionEnabled>, "SetStandardUserSystemClockAutomaticCorrectionEnabled"}, + FunctionInfo{102, D<&StaticService::GetStandardUserSystemClockInitialYear>, "GetStandardUserSystemClockInitialYear"}, + FunctionInfo{200, D<&StaticService::IsStandardNetworkSystemClockAccuracySufficient>, "IsStandardNetworkSystemClockAccuracySufficient"}, + FunctionInfo{201, D<&StaticService::GetStandardUserSystemClockAutomaticCorrectionUpdatedTime>, "GetStandardUserSystemClockAutomaticCorrectionUpdatedTime"}, + FunctionInfo{300, D<&StaticService::CalculateMonotonicSystemClockBaseTimePoint>, "CalculateMonotonicSystemClockBaseTimePoint"}, + FunctionInfo{400, D<&StaticService::GetClockSnapshot>, "GetClockSnapshot"}, + FunctionInfo{401, D<&StaticService::GetClockSnapshotFromSystemClockContext>, "GetClockSnapshotFromSystemClockContext"}, + FunctionInfo{500, D<&StaticService::CalculateStandardUserSystemClockDifferenceByUser>, "CalculateStandardUserSystemClockDifferenceByUser"}, + FunctionInfo{501, D<&StaticService::CalculateSpanBetween>, "CalculateSpanBetween"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + StaticService::StaticService(Core::System& system_, StaticServiceSetupInfo setup_info, std::shared_ptr time, const char* name) : ServiceFramework{system_, name}, m_setup_info{setup_info}, m_time{time}, @@ -42,31 +67,6 @@ StaticService::StaticService(Core::System& system_, StaticServiceSetupInfo setup m_time_zone{m_time->m_time_zone}, m_ephemeral_network_clock{m_time->m_ephemeral_network_clock}, m_shared_memory{ m_time->m_shared_memory} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&StaticService::GetStandardUserSystemClock>, "GetStandardUserSystemClock"}, - {1, D<&StaticService::GetStandardNetworkSystemClock>, "GetStandardNetworkSystemClock"}, - {2, D<&StaticService::GetStandardSteadyClock>, "GetStandardSteadyClock"}, - {3, D<&StaticService::GetTimeZoneService>, "GetTimeZoneService"}, - {4, D<&StaticService::GetStandardLocalSystemClock>, "GetStandardLocalSystemClock"}, - {5, D<&StaticService::GetEphemeralNetworkSystemClock>, "GetEphemeralNetworkSystemClock"}, - {20, D<&StaticService::GetSharedMemoryNativeHandle>, "GetSharedMemoryNativeHandle"}, - {50, D<&StaticService::SetStandardSteadyClockInternalOffset>, "SetStandardSteadyClockInternalOffset"}, - {51, D<&StaticService::GetStandardSteadyClockRtcValue>, "GetStandardSteadyClockRtcValue"}, - {100, D<&StaticService::IsStandardUserSystemClockAutomaticCorrectionEnabled>, "IsStandardUserSystemClockAutomaticCorrectionEnabled"}, - {101, D<&StaticService::SetStandardUserSystemClockAutomaticCorrectionEnabled>, "SetStandardUserSystemClockAutomaticCorrectionEnabled"}, - {102, D<&StaticService::GetStandardUserSystemClockInitialYear>, "GetStandardUserSystemClockInitialYear"}, - {200, D<&StaticService::IsStandardNetworkSystemClockAccuracySufficient>, "IsStandardNetworkSystemClockAccuracySufficient"}, - {201, D<&StaticService::GetStandardUserSystemClockAutomaticCorrectionUpdatedTime>, "GetStandardUserSystemClockAutomaticCorrectionUpdatedTime"}, - {300, D<&StaticService::CalculateMonotonicSystemClockBaseTimePoint>, "CalculateMonotonicSystemClockBaseTimePoint"}, - {400, D<&StaticService::GetClockSnapshot>, "GetClockSnapshot"}, - {401, D<&StaticService::GetClockSnapshotFromSystemClockContext>, "GetClockSnapshotFromSystemClockContext"}, - {500, D<&StaticService::CalculateStandardUserSystemClockDifferenceByUser>, "CalculateStandardUserSystemClockDifferenceByUser"}, - {501, D<&StaticService::CalculateSpanBetween>, "CalculateSpanBetween"}, - }; - // clang-format on - - RegisterHandlers(functions); } Result StaticService::GetStandardUserSystemClock(OutInterface out_service) { diff --git a/src/core/hle/service/psc/time/static.h b/src/core/hle/service/psc/time/static.h index 52659166f1..a86fec178f 100644 --- a/src/core/hle/service/psc/time/static.h +++ b/src/core/hle/service/psc/time/static.h @@ -71,6 +71,8 @@ private: Result GetClockSnapshotImpl(OutClockSnapshot out_snapshot, const SystemClockContext& user_context, const SystemClockContext& network_context, TimeType type); + std::optional FindRequest(u32 key) override; + StaticServiceSetupInfo m_setup_info; std::shared_ptr m_time; StandardLocalSystemClockCore& m_local_system_clock; diff --git a/src/core/hle/service/psc/time/steady_clock.cpp b/src/core/hle/service/psc/time/steady_clock.cpp index 1d1551acf9..3d138837d3 100644 --- a/src/core/hle/service/psc/time/steady_clock.cpp +++ b/src/core/hle/service/psc/time/steady_clock.cpp @@ -11,26 +11,26 @@ namespace Service::PSC::Time { +std::optional SteadyClock::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&SteadyClock::GetCurrentTimePoint>, "GetCurrentTimePoint"}, + FunctionInfo{2, D<&SteadyClock::GetTestOffset>, "GetTestOffset"}, + FunctionInfo{3, D<&SteadyClock::SetTestOffset>, "SetTestOffset"}, + FunctionInfo{100, D<&SteadyClock::GetRtcValue>, "GetRtcValue"}, + FunctionInfo{101, D<&SteadyClock::IsRtcResetDetected>, "IsRtcResetDetected"}, + FunctionInfo{102, D<&SteadyClock::GetSetupResultValue>, "GetSetupResultValue"}, + FunctionInfo{200, D<&SteadyClock::GetInternalOffset>, "GetInternalOffset"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + SteadyClock::SteadyClock(Core::System& system_, std::shared_ptr manager, bool can_write_steady_clock, bool can_write_uninitialized_clock) : ServiceFramework{system_, "ISteadyClock"} , m_clock_core{manager->m_standard_steady_clock} , m_can_write_steady_clock{can_write_steady_clock} , m_can_write_uninitialized_clock{can_write_uninitialized_clock} -{ - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&SteadyClock::GetCurrentTimePoint>, "GetCurrentTimePoint"}, - {2, D<&SteadyClock::GetTestOffset>, "GetTestOffset"}, - {3, D<&SteadyClock::SetTestOffset>, "SetTestOffset"}, - {100, D<&SteadyClock::GetRtcValue>, "GetRtcValue"}, - {101, D<&SteadyClock::IsRtcResetDetected>, "IsRtcResetDetected"}, - {102, D<&SteadyClock::GetSetupResultValue>, "GetSetupResultValue"}, - {200, D<&SteadyClock::GetInternalOffset>, "GetInternalOffset"}, - }; - // clang-format on - RegisterHandlers(functions); -} +{} Result SteadyClock::GetCurrentTimePoint(Out out_time_point) { SCOPE_EXIT { diff --git a/src/core/hle/service/psc/time/steady_clock.h b/src/core/hle/service/psc/time/steady_clock.h index 8d3d9a6280..e4de3e3717 100644 --- a/src/core/hle/service/psc/time/steady_clock.h +++ b/src/core/hle/service/psc/time/steady_clock.h @@ -34,6 +34,8 @@ public: Result GetSetupResultValue(Out out_result); Result GetInternalOffset(Out out_internal_offset); + std::optional FindRequest(u32 key) override; + private: StandardSteadyClockCore& m_clock_core; bool m_can_write_steady_clock; diff --git a/src/core/hle/service/psc/time/system_clock.cpp b/src/core/hle/service/psc/time/system_clock.cpp index e978ffb5e5..c08eca0b02 100644 --- a/src/core/hle/service/psc/time/system_clock.cpp +++ b/src/core/hle/service/psc/time/system_clock.cpp @@ -11,23 +11,23 @@ namespace Service::PSC::Time { +std::optional SystemClock::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&SystemClock::GetCurrentTime>, "GetCurrentTime"}, + FunctionInfo{1, D<&SystemClock::SetCurrentTime>, "SetCurrentTime"}, + FunctionInfo{2, D<&SystemClock::GetSystemClockContext>, "GetSystemClockContext"}, + FunctionInfo{3, D<&SystemClock::SetSystemClockContext>, "SetSystemClockContext"}, + FunctionInfo{4, D<&SystemClock::GetOperationEventReadableHandle>, "GetOperationEventReadableHandle"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + SystemClock::SystemClock(Core::System& system_, SystemClockCore& clock_core, bool can_write_clock, bool can_write_uninitialized_clock) : ServiceFramework{system_, "ISystemClock"} , m_clock_core{clock_core} , m_can_write_clock{can_write_clock} , m_can_write_uninitialized_clock{can_write_uninitialized_clock} -{ - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&SystemClock::GetCurrentTime>, "GetCurrentTime"}, - {1, D<&SystemClock::SetCurrentTime>, "SetCurrentTime"}, - {2, D<&SystemClock::GetSystemClockContext>, "GetSystemClockContext"}, - {3, D<&SystemClock::SetSystemClockContext>, "SetSystemClockContext"}, - {4, D<&SystemClock::GetOperationEventReadableHandle>, "GetOperationEventReadableHandle"}, - }; - // clang-format on - RegisterHandlers(functions); -} +{} Result SystemClock::GetCurrentTime(Out out_time) { SCOPE_EXIT { diff --git a/src/core/hle/service/psc/time/system_clock.h b/src/core/hle/service/psc/time/system_clock.h index 0d91aaa735..4f7d285d39 100644 --- a/src/core/hle/service/psc/time/system_clock.h +++ b/src/core/hle/service/psc/time/system_clock.h @@ -31,6 +31,7 @@ public: Result GetOperationEventReadableHandle(OutCopyHandle out_event); private: + std::optional FindRequest(u32 key) override; SystemClockCore& m_clock_core; bool m_can_write_clock; bool m_can_write_uninitialized_clock; diff --git a/src/core/hle/service/psc/time/time_zone_service.cpp b/src/core/hle/service/psc/time/time_zone_service.cpp index bd6bb3ba93..6a717846d3 100644 --- a/src/core/hle/service/psc/time/time_zone_service.cpp +++ b/src/core/hle/service/psc/time/time_zone_service.cpp @@ -13,33 +13,33 @@ namespace Service::PSC::Time { + std::optional TimeZoneService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&TimeZoneService::GetDeviceLocationName>, "GetDeviceLocationName"}, + FunctionInfo{1, D<&TimeZoneService::SetDeviceLocationName>, "SetDeviceLocationName"}, + FunctionInfo{2, D<&TimeZoneService::GetTotalLocationNameCount>, "GetTotalLocationNameCount"}, + FunctionInfo{3, D<&TimeZoneService::LoadLocationNameList>, "LoadLocationNameList"}, + FunctionInfo{4, D<&TimeZoneService::LoadTimeZoneRule>, "LoadTimeZoneRule"}, + FunctionInfo{5, D<&TimeZoneService::GetTimeZoneRuleVersion>, "GetTimeZoneRuleVersion"}, + FunctionInfo{6, D<&TimeZoneService::GetDeviceLocationNameAndUpdatedTime>, "GetDeviceLocationNameAndUpdatedTime"}, + FunctionInfo{7, D<&TimeZoneService::SetDeviceLocationNameWithTimeZoneRule>, "SetDeviceLocationNameWithTimeZoneRule"}, + FunctionInfo{8, D<&TimeZoneService::ParseTimeZoneBinary>, "ParseTimeZoneBinary"}, + FunctionInfo{20, D<&TimeZoneService::GetDeviceLocationNameOperationEventReadableHandle>, "GetDeviceLocationNameOperationEventReadableHandle"}, + FunctionInfo{100, D<&TimeZoneService::ToCalendarTime>, "ToCalendarTime"}, + FunctionInfo{101, D<&TimeZoneService::ToCalendarTimeWithMyRule>, "ToCalendarTimeWithMyRule"}, + FunctionInfo{201, D<&TimeZoneService::ToPosixTime>, "ToPosixTime"}, + FunctionInfo{202, D<&TimeZoneService::ToPosixTimeWithMyRule>, "ToPosixTimeWithMyRule"} + ); + return HandlerTableGenerateWithFind(key, functions); + } + TimeZoneService::TimeZoneService(Core::System& system_, StandardSteadyClockCore& clock_core, TimeZone& time_zone, bool can_write_timezone_device_location) : ServiceFramework{system_, "ITimeZoneService"} , m_clock_core{clock_core} , m_time_zone{time_zone} , m_can_write_timezone_device_location{can_write_timezone_device_location} -{ - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&TimeZoneService::GetDeviceLocationName>, "GetDeviceLocationName"}, - {1, D<&TimeZoneService::SetDeviceLocationName>, "SetDeviceLocationName"}, - {2, D<&TimeZoneService::GetTotalLocationNameCount>, "GetTotalLocationNameCount"}, - {3, D<&TimeZoneService::LoadLocationNameList>, "LoadLocationNameList"}, - {4, D<&TimeZoneService::LoadTimeZoneRule>, "LoadTimeZoneRule"}, - {5, D<&TimeZoneService::GetTimeZoneRuleVersion>, "GetTimeZoneRuleVersion"}, - {6, D<&TimeZoneService::GetDeviceLocationNameAndUpdatedTime>, "GetDeviceLocationNameAndUpdatedTime"}, - {7, D<&TimeZoneService::SetDeviceLocationNameWithTimeZoneRule>, "SetDeviceLocationNameWithTimeZoneRule"}, - {8, D<&TimeZoneService::ParseTimeZoneBinary>, "ParseTimeZoneBinary"}, - {20, D<&TimeZoneService::GetDeviceLocationNameOperationEventReadableHandle>, "GetDeviceLocationNameOperationEventReadableHandle"}, - {100, D<&TimeZoneService::ToCalendarTime>, "ToCalendarTime"}, - {101, D<&TimeZoneService::ToCalendarTimeWithMyRule>, "ToCalendarTimeWithMyRule"}, - {201, D<&TimeZoneService::ToPosixTime>, "ToPosixTime"}, - {202, D<&TimeZoneService::ToPosixTimeWithMyRule>, "ToPosixTimeWithMyRule"}, - }; - // clang-format on - RegisterHandlers(functions); -} +{} Result TimeZoneService::GetDeviceLocationName(Out out_location_name) { SCOPE_EXIT { diff --git a/src/core/hle/service/psc/time/time_zone_service.h b/src/core/hle/service/psc/time/time_zone_service.h index 0067b08258..fbb107f87c 100644 --- a/src/core/hle/service/psc/time/time_zone_service.h +++ b/src/core/hle/service/psc/time/time_zone_service.h @@ -59,6 +59,7 @@ public: const CalendarTime& calendar_time); private: + std::optional FindRequest(u32 key) override; StandardSteadyClockCore& m_clock_core; TimeZone& m_time_zone; bool m_can_write_timezone_device_location; diff --git a/src/core/hle/service/ptm/psm.cpp b/src/core/hle/service/ptm/psm.cpp index 41d172b71b..5cad46f997 100644 --- a/src/core/hle/service/ptm/psm.cpp +++ b/src/core/hle/service/ptm/psm.cpp @@ -21,22 +21,15 @@ namespace Service::PTM { class IPsmSession final : public ServiceFramework { public: explicit IPsmSession(Core::System& system_) - : ServiceFramework{system_, "IPsmSession"}, service_context{system_, "IPsmSession"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &IPsmSession::BindStateChangeEvent, "BindStateChangeEvent"}, - {1, &IPsmSession::UnbindStateChangeEvent, "UnbindStateChangeEvent"}, - {2, &IPsmSession::SetChargerTypeChangeEventEnabled, "SetChargerTypeChangeEventEnabled"}, - {3, &IPsmSession::SetPowerSupplyChangeEventEnabled, "SetPowerSupplyChangeEventEnabled"}, - {4, &IPsmSession::SetBatteryVoltageStateChangeEventEnabled, "SetBatteryVoltageStateChangeEventEnabled"}, - }; - // clang-format on - - RegisterHandlers(functions); - + : ServiceFramework{system_, "IPsmSession"} + , service_context{system_, "IPsmSession"} { state_change_event = service_context.CreateEvent("IPsmSession::state_change_event"); } + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + ~IPsmSession() override { service_context.CloseEvent(state_change_event); } @@ -112,8 +105,15 @@ private: rb.Push(ResultSuccess); } - KernelHelpers::ServiceContext service_context; + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &IPsmSession::BindStateChangeEvent, "BindStateChangeEvent"}, + FunctionInfo{1, &IPsmSession::UnbindStateChangeEvent, "UnbindStateChangeEvent"}, + FunctionInfo{2, &IPsmSession::SetChargerTypeChangeEventEnabled, "SetChargerTypeChangeEventEnabled"}, + FunctionInfo{3, &IPsmSession::SetPowerSupplyChangeEventEnabled, "SetPowerSupplyChangeEventEnabled"}, + FunctionInfo{4, &IPsmSession::SetBatteryVoltageStateChangeEventEnabled, "SetBatteryVoltageStateChangeEventEnabled"} + ); + KernelHelpers::ServiceContext service_context; bool should_signal_charger_type{}; bool should_signal_power_supply{}; bool should_signal_battery_voltage{}; @@ -122,31 +122,6 @@ private: }; PSM::PSM(Core::System& system_) : ServiceFramework{system_, "psm"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &PSM::GetBatteryChargePercentage, "GetBatteryChargePercentage"}, - {1, &PSM::GetChargerType, "GetChargerType"}, - {2, nullptr, "EnableBatteryCharging"}, - {3, nullptr, "DisableBatteryCharging"}, - {4, nullptr, "IsBatteryChargingEnabled"}, - {5, nullptr, "AcquireControllerPowerSupply"}, - {6, nullptr, "ReleaseControllerPowerSupply"}, - {7, &PSM::OpenSession, "OpenSession"}, - {8, nullptr, "EnableEnoughPowerChargeEmulation"}, - {9, nullptr, "DisableEnoughPowerChargeEmulation"}, - {10, nullptr, "EnableFastBatteryCharging"}, - {11, nullptr, "DisableFastBatteryCharging"}, - {12, &PSM::GetBatteryVoltageState, "GetBatteryVoltageState"}, - {13, nullptr, "GetRawBatteryChargePercentage"}, - {14, nullptr, "IsEnoughPowerSupplied"}, - {15, &PSM::GetBatteryAgePercentage, "GetBatteryAgePercentage"}, - {16, nullptr, "GetBatteryChargeInfoEvent"}, - {17, &PSM::GetBatteryChargeInfoFields, "GetBatteryChargeInfoFields"}, - {18, nullptr, "GetBatteryChargeCalibratedEvent"}, - }; - // clang-format on - - RegisterHandlers(functions); } PSM::~PSM() = default; diff --git a/src/core/hle/service/ptm/psm.h b/src/core/hle/service/ptm/psm.h index 77c38d1f9b..fe77b23d79 100644 --- a/src/core/hle/service/ptm/psm.h +++ b/src/core/hle/service/ptm/psm.h @@ -28,6 +28,31 @@ private: void GetBatteryVoltageState(HLERequestContext& ctx); void GetBatteryAgePercentage(HLERequestContext& ctx); void GetBatteryChargeInfoFields(HLERequestContext& ctx); + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &PSM::GetBatteryChargePercentage, "GetBatteryChargePercentage"}, + FunctionInfo{1, &PSM::GetChargerType, "GetChargerType"}, + FunctionInfo{2, nullptr, "EnableBatteryCharging"}, + FunctionInfo{3, nullptr, "DisableBatteryCharging"}, + FunctionInfo{4, nullptr, "IsBatteryChargingEnabled"}, + FunctionInfo{5, nullptr, "AcquireControllerPowerSupply"}, + FunctionInfo{6, nullptr, "ReleaseControllerPowerSupply"}, + FunctionInfo{7, &PSM::OpenSession, "OpenSession"}, + FunctionInfo{8, nullptr, "EnableEnoughPowerChargeEmulation"}, + FunctionInfo{9, nullptr, "DisableEnoughPowerChargeEmulation"}, + FunctionInfo{10, nullptr, "EnableFastBatteryCharging"}, + FunctionInfo{11, nullptr, "DisableFastBatteryCharging"}, + FunctionInfo{12, &PSM::GetBatteryVoltageState, "GetBatteryVoltageState"}, + FunctionInfo{13, nullptr, "GetRawBatteryChargePercentage"}, + FunctionInfo{14, nullptr, "IsEnoughPowerSupplied"}, + FunctionInfo{15, &PSM::GetBatteryAgePercentage, "GetBatteryAgePercentage"}, + FunctionInfo{16, nullptr, "GetBatteryChargeInfoEvent"}, + FunctionInfo{17, &PSM::GetBatteryChargeInfoFields, "GetBatteryChargeInfoFields"}, + FunctionInfo{18, nullptr, "GetBatteryChargeCalibratedEvent"} + ); }; } // namespace Service::PTM diff --git a/src/core/hle/service/ptm/ptm.cpp b/src/core/hle/service/ptm/ptm.cpp index de1d34a688..ad474ec411 100644 --- a/src/core/hle/service/ptm/ptm.cpp +++ b/src/core/hle/service/ptm/ptm.cpp @@ -17,28 +17,28 @@ namespace Service::PTM { class PSM_MANU final : public ServiceFramework { public: explicit PSM_MANU(Core::System& system_) - : ServiceFramework{system_, "psm:manu"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "EnableVdd50StateControl"}, - {1, nullptr, "DisableVdd50StateControl"}, - {2, nullptr, "SetVdd50State"}, - }; - // clang-format on - RegisterHandlers(functions); + : ServiceFramework{system_, "psm:manu"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "EnableVdd50StateControl"}, + FunctionInfo{1, nullptr, "DisableVdd50StateControl"}, + FunctionInfo{2, nullptr, "SetVdd50State"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class POWCTL final : public ServiceFramework { public: explicit POWCTL(Core::System& system_) - : ServiceFramework{system_, "powctl"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "OpenSession"}, - }; - // clang-format on - RegisterHandlers(functions); + : ServiceFramework{system_, "powctl"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "OpenSession"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; diff --git a/src/core/hle/service/ptm/ts.cpp b/src/core/hle/service/ptm/ts.cpp index b1ac0c8f11..f22ff2ec69 100644 --- a/src/core/hle/service/ptm/ts.cpp +++ b/src/core/hle/service/ptm/ts.cpp @@ -19,16 +19,10 @@ enum class Location : u8 { class ISession : public ServiceFramework { public: - explicit ISession(Core::System& system_) : ServiceFramework{system_, "ISession"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetTemperatureRange"}, - {2, nullptr, "SetMeasurementMode"}, - {4, &ISession::GetTemperature, "GetTemperature"}, - }; - // clang-format on + explicit ISession(Core::System& system_) : ServiceFramework{system_, "ISession"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -39,20 +33,15 @@ private: rb.Push(ResultSuccess); rb.Push(temperature); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetTemperatureRange"}, + FunctionInfo{2, nullptr, "SetMeasurementMode"}, + FunctionInfo{4, &ISession::GetTemperature, "GetTemperature"} + ); }; TS::TS(Core::System& system_) : ServiceFramework{system_, "ts"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetTemperatureRange"}, - {1, &TS::GetTemperature, "GetTemperature"}, - {2, nullptr, "SetMeasurementMode"}, - {3, &TS::GetTemperatureMilliC, "GetTemperatureMilliC"}, - {4, &TS::OpenSession, "OpenSession"}, - }; - // clang-format on - - RegisterHandlers(functions); } TS::~TS() = default; diff --git a/src/core/hle/service/ptm/ts.h b/src/core/hle/service/ptm/ts.h index a10a91a64b..21f3ac2b70 100644 --- a/src/core/hle/service/ptm/ts.h +++ b/src/core/hle/service/ptm/ts.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -17,6 +20,17 @@ private: void GetTemperature(HLERequestContext& ctx); void GetTemperatureMilliC(HLERequestContext& ctx); void OpenSession(HLERequestContext& ctx); + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetTemperatureRange"}, + FunctionInfo{1, &TS::GetTemperature, "GetTemperature"}, + FunctionInfo{2, nullptr, "SetMeasurementMode"}, + FunctionInfo{3, &TS::GetTemperatureMilliC, "GetTemperatureMilliC"}, + FunctionInfo{4, &TS::OpenSession, "OpenSession"} + ); }; } // namespace Service::PTM diff --git a/src/core/hle/service/ro/ro.cpp b/src/core/hle/service/ro/ro.cpp index 167bf04c9a..838ff136f6 100644 --- a/src/core/hle/service/ro/ro.cpp +++ b/src/core/hle/service/ro/ro.cpp @@ -8,21 +8,334 @@ #include #include "core/hle/kernel/k_process.h" - -#include "core/hle/service/cmif_serialization.h" #include "core/hle/service/ro/ro.h" -#include "core/hle/service/ro/ro_nro_utils.h" -#include "core/hle/service/ro/ro_results.h" -#include "core/hle/service/ro/ro_types.h" #include "core/hle/service/server_manager.h" #include "core/hle/service/service.h" #ifdef HAS_NCE #include "core/arm/nce/patcher.h" #include "core/hle/kernel/k_shared_memory.h" #endif +#include "core/hle/service/cmif_serialization.h" namespace Service::RO { +constexpr Result ResultOutOfAddressSpace{ErrorModule::RO, 2}; +constexpr Result ResultAlreadyLoaded{ErrorModule::RO, 3}; +constexpr Result ResultInvalidNro{ErrorModule::RO, 4}; +constexpr Result ResultInvalidNrr{ErrorModule::RO, 6}; +constexpr Result ResultTooManyNro{ErrorModule::RO, 7}; +constexpr Result ResultTooManyNrr{ErrorModule::RO, 8}; +constexpr Result ResultNotAuthorized{ErrorModule::RO, 9}; +constexpr Result ResultInvalidNrrKind{ErrorModule::RO, 10}; +constexpr Result ResultInternalError{ErrorModule::RO, 1023}; +constexpr Result ResultInvalidAddress{ErrorModule::RO, 1025}; +constexpr Result ResultInvalidSize{ErrorModule::RO, 1026}; +constexpr Result ResultNotLoaded{ErrorModule::RO, 1028}; +constexpr Result ResultNotRegistered{ErrorModule::RO, 1029}; +constexpr Result ResultInvalidSession{ErrorModule::RO, 1030}; +constexpr Result ResultInvalidProcess{ErrorModule::RO, 1031}; + +namespace { + +struct ProcessMemoryRegion { + u64 address; + u64 size; +}; + +size_t GetTotalProcessMemoryRegionSize(const ProcessMemoryRegion* regions, size_t num_regions) { + size_t total = 0; + + for (size_t i = 0; i < num_regions; ++i) { + total += regions[i].size; + } + + return total; +} + +size_t SetupNroProcessMemoryRegions(ProcessMemoryRegion* regions, u64 nro_heap_address, + u64 nro_heap_size, u64 bss_heap_address, u64 bss_heap_size) { + // Reset region count. + size_t num_regions = 0; + + // We always want a region for the nro. + regions[num_regions++] = {nro_heap_address, nro_heap_size}; + + // If we have bss, create a region for bss. + if (bss_heap_size > 0) { + regions[num_regions++] = {bss_heap_address, bss_heap_size}; + } + + return num_regions; +} + +Result SetProcessMemoryPermission(Kernel::KProcess* process, u64 address, u64 size, + Kernel::Svc::MemoryPermission permission) { + auto& page_table = process->GetPageTable(); + + // Set permission. + R_RETURN(page_table.SetProcessMemoryPermission(address, size, permission)); +} + +Result UnmapProcessCodeMemory(Kernel::KProcess* process, u64 process_code_address, + const ProcessMemoryRegion* regions, size_t num_regions) { + // Get the total process memory region size. + const size_t total_size = GetTotalProcessMemoryRegionSize(regions, num_regions); + + auto& page_table = process->GetPageTable(); + + // Unmap each region in order. + size_t cur_offset = total_size; + for (size_t i = 0; i < num_regions; ++i) { + // We want to unmap in reverse order. + const auto& cur_region = regions[num_regions - 1 - i]; + + // Subtract to update the current offset. + cur_offset -= cur_region.size; + + // Unmap. + R_TRY(page_table.UnmapCodeMemory(process_code_address + cur_offset, cur_region.address, + cur_region.size)); + } + + R_SUCCEED(); +} + +Result EnsureGuardPages(Kernel::KProcessPageTable& page_table, u64 map_address, u64 map_size) { + Kernel::KMemoryInfo memory_info; + Kernel::Svc::PageInfo page_info; + + // Ensure page before mapping is unmapped. + R_TRY(page_table.QueryInfo(std::addressof(memory_info), std::addressof(page_info), + map_address - 1)); + R_UNLESS(memory_info.GetSvcState() == Kernel::Svc::MemoryState::Free, + Kernel::ResultInvalidState); + + // Ensure page after mapping is unmapped. + R_TRY(page_table.QueryInfo(std::addressof(memory_info), std::addressof(page_info), + map_address + map_size)); + R_UNLESS(memory_info.GetSvcState() == Kernel::Svc::MemoryState::Free, + Kernel::ResultInvalidState); + + // Successfully verified guard pages. + R_SUCCEED(); +} + +Result MapProcessCodeMemory(u64* out, Kernel::KProcess* process, const ProcessMemoryRegion* regions, + size_t num_regions, std::mt19937_64& generate_random) { + auto& page_table = process->GetPageTable(); + const u64 alias_code_start = + GetInteger(page_table.GetAliasCodeRegionStart()) / Kernel::PageSize; + const u64 alias_code_size = page_table.GetAliasCodeRegionSize() / Kernel::PageSize; + + for (size_t trial = 0; trial < 64; trial++) { + // Generate a new trial address. + const u64 mapped_address = + (alias_code_start + (generate_random() % alias_code_size)) * Kernel::PageSize; + + const auto MapRegions = [&] { + // Map the regions in order. + u64 mapped_size = 0; + for (size_t i = 0; i < num_regions; ++i) { + // If we fail, unmap up to where we've mapped. + ON_RESULT_FAILURE { + R_ASSERT(UnmapProcessCodeMemory(process, mapped_address, regions, i)); + }; + + // Map the current region. + R_TRY(page_table.MapCodeMemory(mapped_address + mapped_size, regions[i].address, + regions[i].size)); + + mapped_size += regions[i].size; + } + + // If we fail, unmap all mapped regions. + ON_RESULT_FAILURE { + R_ASSERT(UnmapProcessCodeMemory(process, mapped_address, regions, num_regions)); + }; + + // Ensure guard pages. + R_RETURN(EnsureGuardPages(page_table, mapped_address, mapped_size)); + }; + + if (R_SUCCEEDED(MapRegions())) { + // Set the output address. + *out = mapped_address; + R_SUCCEED(); + } + } + + // We failed to map anything. + R_THROW(RO::ResultOutOfAddressSpace); +} + +Result MapNro(u64* out_base_address, Kernel::KProcess* process, u64 nro_heap_address, + u64 nro_heap_size, u64 bss_heap_address, u64 bss_heap_size, + std::mt19937_64& generate_random) { + // Set up the process memory regions. + std::array regions{}; + const size_t num_regions = SetupNroProcessMemoryRegions( + regions.data(), nro_heap_address, nro_heap_size, bss_heap_address, bss_heap_size); + + // Re-map the nro/bss as code memory in the destination process. + R_RETURN(MapProcessCodeMemory(out_base_address, process, regions.data(), num_regions, + generate_random)); +} + +Result SetNroPerms(Kernel::KProcess* process, u64 base_address, u64 rx_size, u64 ro_size, + u64 rw_size) { + const u64 rx_offset = 0; + const u64 ro_offset = rx_offset + rx_size; + const u64 rw_offset = ro_offset + ro_size; + + R_TRY(SetProcessMemoryPermission(process, base_address + rx_offset, rx_size, + Kernel::Svc::MemoryPermission::ReadExecute)); + R_TRY(SetProcessMemoryPermission(process, base_address + ro_offset, ro_size, + Kernel::Svc::MemoryPermission::Read)); + R_TRY(SetProcessMemoryPermission(process, base_address + rw_offset, rw_size, + Kernel::Svc::MemoryPermission::ReadWrite)); + + R_SUCCEED(); +} + +Result UnmapNro(Kernel::KProcess* process, u64 base_address, u64 nro_heap_address, + u64 nro_heap_size, u64 bss_heap_address, u64 bss_heap_size) { + // Set up the process memory regions. + std::array regions{}; + const size_t num_regions = SetupNroProcessMemoryRegions( + regions.data(), nro_heap_address, nro_heap_size, bss_heap_address, bss_heap_size); + + // Unmap the nro/bss. + R_RETURN(UnmapProcessCodeMemory(process, base_address, regions.data(), num_regions)); +} + +} // namespace + +enum class NrrKind : u8 { + User = 0, + JitPlugin = 1, + Count, +}; + +static constexpr size_t ModuleIdSize = 0x20; +struct ModuleId { + std::array data; +}; +static_assert(sizeof(ModuleId) == ModuleIdSize); + +struct NrrCertification { + static constexpr size_t RsaKeySize = 0x100; + static constexpr size_t SignedSize = 0x120; + + u64 program_id_mask; + u64 program_id_pattern; + std::array reserved_10; + std::array modulus; + std::array signature; +}; +static_assert(sizeof(NrrCertification) == NrrCertification::RsaKeySize + NrrCertification::SignedSize); + +class NrrHeader { +public: + static constexpr u32 Magic = Common::MakeMagic('N', 'R', 'R', '0'); + +public: + bool IsMagicValid() const { + return m_magic == Magic; + } + + bool IsProgramIdValid() const { + return (m_program_id & m_certification.program_id_mask) == + m_certification.program_id_pattern; + } + + NrrKind GetNrrKind() const { + const NrrKind kind = static_cast(m_nrr_kind); + ASSERT(kind < NrrKind::Count); + return kind; + } + + u64 GetProgramId() const { + return m_program_id; + } + + u32 GetSize() const { + return m_size; + } + + u32 GetNumHashes() const { + return m_num_hashes; + } + + size_t GetHashesOffset() const { + return m_hashes_offset; + } + + u32 GetKeyGeneration() const { + return m_key_generation; + } + + const u8* GetCertificationSignature() const { + return m_certification.signature.data(); + } + + const u8* GetCertificationSignedArea() const { + return reinterpret_cast(std::addressof(m_certification)); + } + + const u8* GetCertificationModulus() const { + return m_certification.modulus.data(); + } + + const u8* GetSignature() const { + return m_signature.data(); + } + + size_t GetSignedAreaSize() const { + return m_size - GetSignedAreaOffset(); + } + + static constexpr size_t GetSignedAreaOffset() { + return offsetof(NrrHeader, m_program_id); + } + +private: + u32 m_magic; + u32 m_key_generation; + INSERT_PADDING_BYTES_NOINIT(8); + NrrCertification m_certification; + std::array m_signature; + u64 m_program_id; + u32 m_size; + u8 m_nrr_kind; // 7.0.0+ + INSERT_PADDING_BYTES_NOINIT(3); + u32 m_hashes_offset; + u32 m_num_hashes; + INSERT_PADDING_BYTES_NOINIT(8); +}; +static_assert(sizeof(NrrHeader) == 0x350, "NrrHeader has wrong size"); + +static constexpr u32 NRO_HEADER_MAGIC = Common::MakeMagic('N', 'R', 'O', '0'); +struct NroHeader { + u32 m_entrypoint_insn; + u32 m_mod_offset; + INSERT_PADDING_BYTES_NOINIT(0x8); + u32 m_magic; + INSERT_PADDING_BYTES_NOINIT(0x4); + u32 m_size; + INSERT_PADDING_BYTES_NOINIT(0x4); + u32 m_text_offset; + u32 m_text_size; + u32 m_ro_offset; + u32 m_ro_size; + u32 m_rw_offset; + u32 m_rw_size; + u32 m_bss_size; + INSERT_PADDING_BYTES_NOINIT(0x4); + ModuleId m_module_id; + INSERT_PADDING_BYTES_NOINIT(0x20); +}; +static_assert(sizeof(NroHeader) == 0x80, "NroHeader has wrong size"); + namespace { // Atmosphere defines as follows: @@ -535,29 +848,21 @@ private: class RoInterface : public ServiceFramework { public: - explicit RoInterface(Core::System& system_, const char* name_, std::shared_ptr ro, - NrrKind nrr_kind) - : ServiceFramework{system_, name_}, m_ro(ro), m_context_id(InvalidContextId), - m_nrr_kind(nrr_kind) { - - // clang-format off - static const FunctionInfo functions[] = { - {0, C<&RoInterface::MapManualLoadModuleMemory>, "MapManualLoadModuleMemory"}, - {1, C<&RoInterface::UnmapManualLoadModuleMemory>, "UnmapManualLoadModuleMemory"}, - {2, C<&RoInterface::RegisterModuleInfo>, "RegisterModuleInfo"}, - {3, C<&RoInterface::UnregisterModuleInfo>, "UnregisterModuleInfo"}, - {4, C<&RoInterface::RegisterProcessHandle>, "RegisterProcessHandle"}, - {10, C<&RoInterface::RegisterProcessModuleInfo>, "RegisterProcessModuleInfo"}, - }; - // clang-format on - - RegisterHandlers(functions); - } + explicit RoInterface(Core::System& system_, const char* name_, std::shared_ptr ro, NrrKind nrr_kind) + : ServiceFramework{system_, name_} + , m_ro(ro) + , m_context_id(InvalidContextId) + , m_nrr_kind(nrr_kind) + {} ~RoInterface() { m_ro->UnregisterProcess(system.Kernel(), m_context_id); } + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + Result MapManualLoadModuleMemory(Out out_load_address, ClientProcessId client_pid, u64 nro_address, u64 nro_size, u64 bss_address, u64 bss_size) { R_TRY(m_ro->ValidateProcess(m_context_id, *client_pid)); @@ -594,6 +899,14 @@ public: } private: + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, C<&RoInterface::MapManualLoadModuleMemory>, "MapManualLoadModuleMemory"}, + FunctionInfo{1, C<&RoInterface::UnmapManualLoadModuleMemory>, "UnmapManualLoadModuleMemory"}, + FunctionInfo{2, C<&RoInterface::RegisterModuleInfo>, "RegisterModuleInfo"}, + FunctionInfo{3, C<&RoInterface::UnregisterModuleInfo>, "UnregisterModuleInfo"}, + FunctionInfo{4, C<&RoInterface::RegisterProcessHandle>, "RegisterProcessHandle"}, + FunctionInfo{10, C<&RoInterface::RegisterProcessModuleInfo>, "RegisterProcessModuleInfo"} + ); std::shared_ptr m_ro{}; size_t m_context_id{}; NrrKind m_nrr_kind{}; @@ -606,12 +919,14 @@ class IDebugMonitorInterface final : public ServiceFramework FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetProcessModuleInfo" } + ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/ro/ro_nro_utils.cpp b/src/core/hle/service/ro/ro_nro_utils.cpp deleted file mode 100644 index 268c7f93e7..0000000000 --- a/src/core/hle/service/ro/ro_nro_utils.cpp +++ /dev/null @@ -1,185 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/hle/kernel/k_process.h" -#include "core/hle/service/ro/ro_nro_utils.h" -#include "core/hle/service/ro/ro_results.h" - -namespace Service::RO { - -namespace { - -struct ProcessMemoryRegion { - u64 address; - u64 size; -}; - -size_t GetTotalProcessMemoryRegionSize(const ProcessMemoryRegion* regions, size_t num_regions) { - size_t total = 0; - - for (size_t i = 0; i < num_regions; ++i) { - total += regions[i].size; - } - - return total; -} - -size_t SetupNroProcessMemoryRegions(ProcessMemoryRegion* regions, u64 nro_heap_address, - u64 nro_heap_size, u64 bss_heap_address, u64 bss_heap_size) { - // Reset region count. - size_t num_regions = 0; - - // We always want a region for the nro. - regions[num_regions++] = {nro_heap_address, nro_heap_size}; - - // If we have bss, create a region for bss. - if (bss_heap_size > 0) { - regions[num_regions++] = {bss_heap_address, bss_heap_size}; - } - - return num_regions; -} - -Result SetProcessMemoryPermission(Kernel::KProcess* process, u64 address, u64 size, - Kernel::Svc::MemoryPermission permission) { - auto& page_table = process->GetPageTable(); - - // Set permission. - R_RETURN(page_table.SetProcessMemoryPermission(address, size, permission)); -} - -Result UnmapProcessCodeMemory(Kernel::KProcess* process, u64 process_code_address, - const ProcessMemoryRegion* regions, size_t num_regions) { - // Get the total process memory region size. - const size_t total_size = GetTotalProcessMemoryRegionSize(regions, num_regions); - - auto& page_table = process->GetPageTable(); - - // Unmap each region in order. - size_t cur_offset = total_size; - for (size_t i = 0; i < num_regions; ++i) { - // We want to unmap in reverse order. - const auto& cur_region = regions[num_regions - 1 - i]; - - // Subtract to update the current offset. - cur_offset -= cur_region.size; - - // Unmap. - R_TRY(page_table.UnmapCodeMemory(process_code_address + cur_offset, cur_region.address, - cur_region.size)); - } - - R_SUCCEED(); -} - -Result EnsureGuardPages(Kernel::KProcessPageTable& page_table, u64 map_address, u64 map_size) { - Kernel::KMemoryInfo memory_info; - Kernel::Svc::PageInfo page_info; - - // Ensure page before mapping is unmapped. - R_TRY(page_table.QueryInfo(std::addressof(memory_info), std::addressof(page_info), - map_address - 1)); - R_UNLESS(memory_info.GetSvcState() == Kernel::Svc::MemoryState::Free, - Kernel::ResultInvalidState); - - // Ensure page after mapping is unmapped. - R_TRY(page_table.QueryInfo(std::addressof(memory_info), std::addressof(page_info), - map_address + map_size)); - R_UNLESS(memory_info.GetSvcState() == Kernel::Svc::MemoryState::Free, - Kernel::ResultInvalidState); - - // Successfully verified guard pages. - R_SUCCEED(); -} - -Result MapProcessCodeMemory(u64* out, Kernel::KProcess* process, const ProcessMemoryRegion* regions, - size_t num_regions, std::mt19937_64& generate_random) { - auto& page_table = process->GetPageTable(); - const u64 alias_code_start = - GetInteger(page_table.GetAliasCodeRegionStart()) / Kernel::PageSize; - const u64 alias_code_size = page_table.GetAliasCodeRegionSize() / Kernel::PageSize; - - for (size_t trial = 0; trial < 64; trial++) { - // Generate a new trial address. - const u64 mapped_address = - (alias_code_start + (generate_random() % alias_code_size)) * Kernel::PageSize; - - const auto MapRegions = [&] { - // Map the regions in order. - u64 mapped_size = 0; - for (size_t i = 0; i < num_regions; ++i) { - // If we fail, unmap up to where we've mapped. - ON_RESULT_FAILURE { - R_ASSERT(UnmapProcessCodeMemory(process, mapped_address, regions, i)); - }; - - // Map the current region. - R_TRY(page_table.MapCodeMemory(mapped_address + mapped_size, regions[i].address, - regions[i].size)); - - mapped_size += regions[i].size; - } - - // If we fail, unmap all mapped regions. - ON_RESULT_FAILURE { - R_ASSERT(UnmapProcessCodeMemory(process, mapped_address, regions, num_regions)); - }; - - // Ensure guard pages. - R_RETURN(EnsureGuardPages(page_table, mapped_address, mapped_size)); - }; - - if (R_SUCCEEDED(MapRegions())) { - // Set the output address. - *out = mapped_address; - R_SUCCEED(); - } - } - - // We failed to map anything. - R_THROW(RO::ResultOutOfAddressSpace); -} - -} // namespace - -Result MapNro(u64* out_base_address, Kernel::KProcess* process, u64 nro_heap_address, - u64 nro_heap_size, u64 bss_heap_address, u64 bss_heap_size, - std::mt19937_64& generate_random) { - // Set up the process memory regions. - std::array regions{}; - const size_t num_regions = SetupNroProcessMemoryRegions( - regions.data(), nro_heap_address, nro_heap_size, bss_heap_address, bss_heap_size); - - // Re-map the nro/bss as code memory in the destination process. - R_RETURN(MapProcessCodeMemory(out_base_address, process, regions.data(), num_regions, - generate_random)); -} - -Result SetNroPerms(Kernel::KProcess* process, u64 base_address, u64 rx_size, u64 ro_size, - u64 rw_size) { - const u64 rx_offset = 0; - const u64 ro_offset = rx_offset + rx_size; - const u64 rw_offset = ro_offset + ro_size; - - R_TRY(SetProcessMemoryPermission(process, base_address + rx_offset, rx_size, - Kernel::Svc::MemoryPermission::ReadExecute)); - R_TRY(SetProcessMemoryPermission(process, base_address + ro_offset, ro_size, - Kernel::Svc::MemoryPermission::Read)); - R_TRY(SetProcessMemoryPermission(process, base_address + rw_offset, rw_size, - Kernel::Svc::MemoryPermission::ReadWrite)); - - R_SUCCEED(); -} - -Result UnmapNro(Kernel::KProcess* process, u64 base_address, u64 nro_heap_address, - u64 nro_heap_size, u64 bss_heap_address, u64 bss_heap_size) { - // Set up the process memory regions. - std::array regions{}; - const size_t num_regions = SetupNroProcessMemoryRegions( - regions.data(), nro_heap_address, nro_heap_size, bss_heap_address, bss_heap_size); - - // Unmap the nro/bss. - R_RETURN(UnmapProcessCodeMemory(process, base_address, regions.data(), num_regions)); -} - -} // namespace Service::RO diff --git a/src/core/hle/service/ro/ro_nro_utils.h b/src/core/hle/service/ro/ro_nro_utils.h deleted file mode 100644 index f7083a1ba3..0000000000 --- a/src/core/hle/service/ro/ro_nro_utils.h +++ /dev/null @@ -1,26 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include - -#include "common/common_types.h" - -namespace Kernel { -class KProcess; -} - -union Result; - -namespace Service::RO { - -Result MapNro(u64* out_base_address, Kernel::KProcess* process, u64 nro_heap_address, - u64 nro_heap_size, u64 bss_heap_address, u64 bss_heap_size, - std::mt19937_64& generate_random); -Result SetNroPerms(Kernel::KProcess* process, u64 base_address, u64 rx_size, u64 ro_size, - u64 rw_size); -Result UnmapNro(Kernel::KProcess* process, u64 base_address, u64 nro_heap_address, - u64 nro_heap_size, u64 bss_heap_address, u64 bss_heap_size); - -} // namespace Service::RO diff --git a/src/core/hle/service/ro/ro_results.h b/src/core/hle/service/ro/ro_results.h deleted file mode 100644 index 906378bc7f..0000000000 --- a/src/core/hle/service/ro/ro_results.h +++ /dev/null @@ -1,29 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/result.h" - -namespace Service::RO { - -constexpr Result ResultOutOfAddressSpace{ErrorModule::RO, 2}; -constexpr Result ResultAlreadyLoaded{ErrorModule::RO, 3}; -constexpr Result ResultInvalidNro{ErrorModule::RO, 4}; -constexpr Result ResultInvalidNrr{ErrorModule::RO, 6}; -constexpr Result ResultTooManyNro{ErrorModule::RO, 7}; -constexpr Result ResultTooManyNrr{ErrorModule::RO, 8}; -constexpr Result ResultNotAuthorized{ErrorModule::RO, 9}; -constexpr Result ResultInvalidNrrKind{ErrorModule::RO, 10}; -constexpr Result ResultInternalError{ErrorModule::RO, 1023}; -constexpr Result ResultInvalidAddress{ErrorModule::RO, 1025}; -constexpr Result ResultInvalidSize{ErrorModule::RO, 1026}; -constexpr Result ResultNotLoaded{ErrorModule::RO, 1028}; -constexpr Result ResultNotRegistered{ErrorModule::RO, 1029}; -constexpr Result ResultInvalidSession{ErrorModule::RO, 1030}; -constexpr Result ResultInvalidProcess{ErrorModule::RO, 1031}; - -} // namespace Service::RO diff --git a/src/core/hle/service/ro/ro_types.h b/src/core/hle/service/ro/ro_types.h deleted file mode 100644 index 8e88f43246..0000000000 --- a/src/core/hle/service/ro/ro_types.h +++ /dev/null @@ -1,142 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "common/assert.h" -#include "common/common_funcs.h" -#include "common/common_types.h" - -namespace Service::RO { - -enum class NrrKind : u8 { - User = 0, - JitPlugin = 1, - Count, -}; - -static constexpr size_t ModuleIdSize = 0x20; -struct ModuleId { - std::array data; -}; -static_assert(sizeof(ModuleId) == ModuleIdSize); - -struct NrrCertification { - static constexpr size_t RsaKeySize = 0x100; - static constexpr size_t SignedSize = 0x120; - - u64 program_id_mask; - u64 program_id_pattern; - std::array reserved_10; - std::array modulus; - std::array signature; -}; -static_assert(sizeof(NrrCertification) == - NrrCertification::RsaKeySize + NrrCertification::SignedSize); - -class NrrHeader { -public: - static constexpr u32 Magic = Common::MakeMagic('N', 'R', 'R', '0'); - -public: - bool IsMagicValid() const { - return m_magic == Magic; - } - - bool IsProgramIdValid() const { - return (m_program_id & m_certification.program_id_mask) == - m_certification.program_id_pattern; - } - - NrrKind GetNrrKind() const { - const NrrKind kind = static_cast(m_nrr_kind); - ASSERT(kind < NrrKind::Count); - return kind; - } - - u64 GetProgramId() const { - return m_program_id; - } - - u32 GetSize() const { - return m_size; - } - - u32 GetNumHashes() const { - return m_num_hashes; - } - - size_t GetHashesOffset() const { - return m_hashes_offset; - } - - u32 GetKeyGeneration() const { - return m_key_generation; - } - - const u8* GetCertificationSignature() const { - return m_certification.signature.data(); - } - - const u8* GetCertificationSignedArea() const { - return reinterpret_cast(std::addressof(m_certification)); - } - - const u8* GetCertificationModulus() const { - return m_certification.modulus.data(); - } - - const u8* GetSignature() const { - return m_signature.data(); - } - - size_t GetSignedAreaSize() const { - return m_size - GetSignedAreaOffset(); - } - - static constexpr size_t GetSignedAreaOffset() { - return offsetof(NrrHeader, m_program_id); - } - -private: - u32 m_magic; - u32 m_key_generation; - INSERT_PADDING_BYTES_NOINIT(8); - NrrCertification m_certification; - std::array m_signature; - u64 m_program_id; - u32 m_size; - u8 m_nrr_kind; // 7.0.0+ - INSERT_PADDING_BYTES_NOINIT(3); - u32 m_hashes_offset; - u32 m_num_hashes; - INSERT_PADDING_BYTES_NOINIT(8); -}; -static_assert(sizeof(NrrHeader) == 0x350, "NrrHeader has wrong size"); - -static constexpr u32 NRO_HEADER_MAGIC = Common::MakeMagic('N', 'R', 'O', '0'); -struct NroHeader { - u32 m_entrypoint_insn; - u32 m_mod_offset; - INSERT_PADDING_BYTES_NOINIT(0x8); - u32 m_magic; - INSERT_PADDING_BYTES_NOINIT(0x4); - u32 m_size; - INSERT_PADDING_BYTES_NOINIT(0x4); - u32 m_text_offset; - u32 m_text_size; - u32 m_ro_offset; - u32 m_ro_size; - u32 m_rw_offset; - u32 m_rw_size; - u32 m_bss_size; - INSERT_PADDING_BYTES_NOINIT(0x4); - ModuleId m_module_id; - INSERT_PADDING_BYTES_NOINIT(0x20); -}; -static_assert(sizeof(NroHeader) == 0x80, "NroHeader has wrong size"); - -} // namespace Service::RO diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 225b92a783..2c6e8d1c07 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -19,6 +19,7 @@ #include "core/hle/service/service.h" #include "core/hle/service/sm/sm.h" #include "core/reporter.h" +#include "frontend_common/firmware_manager.h" namespace Service { @@ -47,24 +48,9 @@ ServiceFrameworkBase::~ServiceFrameworkBase() { const auto guard = ServiceFrameworkBase::LockService(); } -void ServiceFrameworkBase::RegisterHandlersBase(const FunctionInfoBase* functions, std::size_t n) { - // Usually this array is sorted by id already, so hint to insert at the end - handlers.reserve(handlers.size() + n); - for (std::size_t i = 0; i < n; ++i) - handlers.emplace_hint(handlers.cend(), functions[i].expected_header, functions[i]); -} - -void ServiceFrameworkBase::RegisterHandlersBaseTipc(const FunctionInfoBase* functions, std::size_t n) { - // Usually this array is sorted by id already, so hint to insert at the end - handlers_tipc.reserve(handlers_tipc.size() + n); - for (std::size_t i = 0; i < n; ++i) - handlers_tipc.emplace_hint(handlers_tipc.cend(), functions[i].expected_header, functions[i]); -} - -void ServiceFrameworkBase::ReportUnimplementedFunction(HLERequestContext& ctx, - const FunctionInfoBase* info) { +void ServiceFrameworkBase::ReportUnimplementedFunction(HLERequestContext& ctx, const FunctionInfoBase* info, bool gated) { auto cmd_buf = ctx.CommandBuffer(); - std::string function_name = info == nullptr ? "" : info->name; + std::string function_name = bool(info) ? info->name : ""; fmt::memory_buffer buf; fmt::format_to(std::back_inserter(buf), "function '{}({})': port='{}' cmd_buf={{[0]={:#x}", ctx.GetCommand(), function_name, service_name, cmd_buf[0]); @@ -73,7 +59,11 @@ void ServiceFrameworkBase::ReportUnimplementedFunction(HLERequestContext& ctx, buf.push_back('}'); system.GetReporter().SaveUnimplementedFunctionReport(ctx, ctx.GetCommand(), function_name, service_name); - UNIMPLEMENTED_MSG("Unknown / unimplemented {}", fmt::to_string(buf)); + if (gated) { + LOG_ERROR(Service, "Version gated {}", fmt::to_string(buf)); + } else { + UNIMPLEMENTED_MSG("Unknown / unimplemented {}", fmt::to_string(buf)); + } if (Settings::values.use_auto_stub) { LOG_WARNING(Service, "Using auto stub fallback!"); IPC::ResponseBuilder rb{ctx, 2}; @@ -81,17 +71,33 @@ void ServiceFrameworkBase::ReportUnimplementedFunction(HLERequestContext& ctx, } } +[[nodiscard]] static bool VersionGateCheck(Core::System& system, u32 vg) { + u32 const c_maj = FirmwareManager::GetFirmwareVersion(system).first.major; + u32 const c_min = FirmwareManager::GetFirmwareVersion(system).first.minor; + u32 const c_pat = FirmwareManager::GetFirmwareVersion(system).first.micro; + u32 const cg = (c_pat << 0) | (c_min << 4) | (c_maj << 8); + u32 const sg = (vg >> 16) & 0xffff; + u32 const ug = vg & 0xffff; + // feature available after current + if (sg && cg < sg) + return false; + // feature until xxx (0 = up to current) + return ug ? ug >= cg : true; +} + void ServiceFrameworkBase::InvokeRequest(HLERequestContext& ctx) { - const auto command = ctx.GetCommand(); - auto it = handlers.find(command); - const bool is_cmd_read = command == 0; - FunctionInfoBase const* info = it == handlers.end() ? nullptr : &it->second; - if (info == nullptr || info->handler_callback == nullptr) - return ReportUnimplementedFunction(ctx, info); + const bool is_cmd_read = ctx.GetCommand() == 0; + auto const info = FindRequest(ctx.GetCommand()); + if (!info.has_value() || info->handler_callback == nullptr) + return ReportUnimplementedFunction(ctx, &*info, false); + + if (!VersionGateCheck(system, info->version_gating)) + { + return ReportUnimplementedFunction(ctx, &*info, true); + } LOG_TRACE(Service, "{}", MakeFunctionString(info->name, GetServiceName(), ctx.CommandBuffer())); handler_invoker(this, info->handler_callback, ctx); - if (is_i_storage && is_cmd_read) { const auto* const process = ctx.GetThread().GetOwnerProcess(); if (process != nullptr && system.IsNVDECActiveForProcess(process->GetId())) { @@ -101,10 +107,15 @@ void ServiceFrameworkBase::InvokeRequest(HLERequestContext& ctx) { } void ServiceFrameworkBase::InvokeRequestTipc(HLERequestContext& ctx) { - auto it = handlers_tipc.find(ctx.GetCommand()); - FunctionInfoBase const* info = it == handlers_tipc.end() ? nullptr : &it->second; - if (info == nullptr || info->handler_callback == nullptr) - return ReportUnimplementedFunction(ctx, info); + auto const info = FindRequestTipc(ctx.GetCommand()); + if (!info.has_value() || info->handler_callback == nullptr) + return ReportUnimplementedFunction(ctx, &*info, false); + + LOG_ERROR(Service, "check for {} version_gating: {}", info->name, info->version_gating); + if (!VersionGateCheck(system, info->version_gating)) + { + return ReportUnimplementedFunction(ctx, &*info, true); + } LOG_TRACE(Service, "{}", MakeFunctionString(info->name, GetServiceName(), ctx.CommandBuffer())); handler_invoker(this, info->handler_callback, ctx); diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index ea98897e79..e8bd8683ea 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -7,7 +7,11 @@ #pragma once #include +#include #include +#include +#include +#include "frozen/map.h" #include "common/container/unordered_map.h" #include "common/common_types.h" #include "core/hle/service/hle_ipc.h" @@ -77,30 +81,35 @@ protected: [[nodiscard]] virtual std::unique_lock LockService() noexcept { return std::unique_lock{lock_service}; } + + static constexpr u32 MakeVersionGate(std::tuple since, std::tuple until = {0, 0, 0}) { + auto const [s_maj, s_min, s_pat] = since; + auto const [u_maj, u_min, u_pat] = until; + return (u_pat << 0) | (u_min << 4) | (u_maj << 8) + | (s_pat << 16) | (s_min << 20) | (s_maj << 24); + } + + struct FunctionInfoBase { + HandlerFnP handler_callback; + const char* name; + u32 version_gating; + }; + static_assert(std::is_trivially_constructible_v); private: template friend class ServiceFramework; - struct FunctionInfoBase { - u32 expected_header; - HandlerFnP handler_callback; - const char* name; - }; + using InvokerFn = void(ServiceFrameworkBase* object, HandlerFnP member, HLERequestContext& ctx); - using InvokerFn = void(ServiceFrameworkBase* object, HandlerFnP member, - HLERequestContext& ctx); - - explicit ServiceFrameworkBase(Core::System& system_, const char* service_name_, - u32 max_sessions_, InvokerFn* handler_invoker_); + explicit ServiceFrameworkBase(Core::System& system_, const char* service_name_, u32 max_sessions_, InvokerFn* handler_invoker_); ~ServiceFrameworkBase() override; - void RegisterHandlersBase(const FunctionInfoBase* functions, std::size_t n); - void RegisterHandlersBaseTipc(const FunctionInfoBase* functions, std::size_t n); - void ReportUnimplementedFunction(HLERequestContext& ctx, const FunctionInfoBase* info); + virtual std::optional FindRequest(u32 key) = 0; + virtual std::optional FindRequestTipc(u32 key) = 0; + + void ReportUnimplementedFunction(HLERequestContext& ctx, const FunctionInfoBase* info, bool gated); protected: - ::Common::unordered_map handlers; - ::Common::unordered_map handlers_tipc; /// Used to gain exclusive access to the service members, e.g. from CoreTiming thread. std::mutex lock_service; /// System context that the service operates under. @@ -121,8 +130,7 @@ protected: /** * Framework for implementing HLE services. Dispatches on the header id of incoming SyncRequests * based on a table mapping header ids to handler functions. Service implementations should inherit - * from ServiceFramework using the CRTP (`class Foo : public ServiceFramework { ... };`) and - * populate it with handlers by calling #RegisterHandlers. + * from ServiceFramework using the CRTP (`class Foo : public ServiceFramework { ... };`) * * In order to avoid duplicating code in the binary and exposing too many implementation details in * the header, this class is split into a non-templated base (ServiceFrameworkBase) and a template @@ -143,50 +151,77 @@ protected: /// @param expected_header_ request header in the command buffer which will trigger dispatch to this handler /// @param handler_callback_ member function in this service which will be called to handle the request /// @param name_ human-friendly name for the request. Used mostly for logging purposes. - FunctionInfoTyped(u32 expected_header_, HandlerFnP handler_callback_, const char* name_) - : FunctionInfoBase{expected_header_, HandlerFnP(handler_callback_), name_} {} + explicit constexpr FunctionInfoTyped(u32 expected_header_, HandlerFnP handler_callback_, const char* name_, u32 version_gating_ = 0) + : handler_callback{handler_callback_} + , name{name_} + , version_gating{version_gating_} + , expected_header{expected_header_} + {} + HandlerFnP handler_callback; + const char* name; + u32 version_gating; + u32 expected_header; }; using FunctionInfo = FunctionInfoTyped; - /** - * Initializes the handler with no functions installed. - * - * @param system_ The system context to construct this service under. - * @param service_name_ Name of the service. - * @param max_sessions_ Maximum number of sessions that can be connected to this service at the - * same time. - */ + // expected_header serves as a key to 'address' function handlers, thus only include the minimal + template + struct FunctionValueInfo { + explicit constexpr FunctionValueInfo(HandlerFnP handler_callback_, const char* name_, u32 version_gating_) + : handler_callback{handler_callback_} + , name{name_} + , version_gating{version_gating_} + {} + HandlerFnP handler_callback; + const char* name; + u32 version_gating; + }; + + template + //requires (std::same_as && ...) + [[nodiscard]] static consteval frozen::map, sizeof...(Ts)> CreateStaticMap(Ts... args) { + return frozen::map, sizeof...(args)>{ + {args.expected_header, FunctionValueInfo{args.handler_callback, args.name, args.version_gating}}... + }; + } + + // Used exclusively by NFC + template + //requires (std::same_as> && ...) + [[nodiscard]] static consteval frozen::map, sizeof...(Ts)> CreateStaticMapWithClass(Ts... args) { + return frozen::map, sizeof...(args)>{ + {args.expected_header, FunctionValueInfo{args.handler_callback, args.name, args.version_gating}}... + }; + } + + template + [[nodiscard]] static std::optional HandlerTableGenerateWithFind(u32 key, T const& map) { + auto const it = map.find(key); + if (it != map.end()) { + auto const r = it->second; + return std::optional{{ + HandlerFnP(r.handler_callback), + r.name, + r.version_gating + }}; + } + return std::nullopt; + } + + /// @brief Initializes the handler with no functions installed. + /// @param system_ The system context to construct this service under. + /// @param service_name_ Name of the service. + /// @param max_sessions_ Maximum number of sessions that can be connected to this service at the + /// same time. explicit ServiceFramework(Core::System& system_, const char* service_name_, u32 max_sessions_ = ServerSessionCountMax) - : ServiceFrameworkBase(system_, service_name_, max_sessions_, Invoker) {} + : ServiceFrameworkBase(system_, service_name_, max_sessions_, Invoker) + {} - /// Registers handlers in the service. - template - void RegisterHandlers(const FunctionInfoTyped (&functions)[N]) { - RegisterHandlers(functions, N); + std::optional FindRequest(u32 key) override { + UNREACHABLE(); } - - /** - * Registers handlers in the service. Usually prefer using the other RegisterHandlers - * overload in order to avoid needing to specify the array size. - */ - template - void RegisterHandlers(const FunctionInfoTyped* functions, std::size_t n) { - RegisterHandlersBase(functions, n); - } - - /// Registers handlers in the service. - template - void RegisterHandlersTipc(const FunctionInfoTyped (&functions)[N]) { - RegisterHandlersTipc(functions, N); - } - - /** - * Registers handlers in the service. Usually prefer using the other RegisterHandlers - * overload in order to avoid needing to specify the array size. - */ - template - void RegisterHandlersTipc(const FunctionInfoTyped* functions, std::size_t n) { - RegisterHandlersBaseTipc(functions, n); + std::optional FindRequestTipc(u32 key) override { + UNREACHABLE(); } protected: diff --git a/src/core/hle/service/set/factory_settings_server.cpp b/src/core/hle/service/set/factory_settings_server.cpp index a8e307ae26..70d02fab3b 100644 --- a/src/core/hle/service/set/factory_settings_server.cpp +++ b/src/core/hle/service/set/factory_settings_server.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -7,55 +10,6 @@ namespace Service::Set { IFactorySettingsServer::IFactorySettingsServer(Core::System& system_) : ServiceFramework{system_, "set:cal"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetBluetoothBdAddress"}, - {1, nullptr, "GetConfigurationId1"}, - {2, nullptr, "GetAccelerometerOffset"}, - {3, nullptr, "GetAccelerometerScale"}, - {4, nullptr, "GetGyroscopeOffset"}, - {5, nullptr, "GetGyroscopeScale"}, - {6, nullptr, "GetWirelessLanMacAddress"}, - {7, nullptr, "GetWirelessLanCountryCodeCount"}, - {8, nullptr, "GetWirelessLanCountryCodes"}, - {9, nullptr, "GetSerialNumber"}, - {10, nullptr, "SetInitialSystemAppletProgramId"}, - {11, nullptr, "SetOverlayDispProgramId"}, - {12, nullptr, "GetBatteryLot"}, - {14, nullptr, "GetEciDeviceCertificate"}, - {15, nullptr, "GetEticketDeviceCertificate"}, - {16, nullptr, "GetSslKey"}, - {17, nullptr, "GetSslCertificate"}, - {18, nullptr, "GetGameCardKey"}, - {19, nullptr, "GetGameCardCertificate"}, - {20, nullptr, "GetEciDeviceKey"}, - {21, nullptr, "GetEticketDeviceKey"}, - {22, nullptr, "GetSpeakerParameter"}, - {23, nullptr, "GetLcdVendorId"}, - {24, nullptr, "GetEciDeviceCertificate2"}, - {25, nullptr, "GetEciDeviceKey2"}, - {26, nullptr, "GetAmiiboKey"}, - {27, nullptr, "GetAmiiboEcqvCertificate"}, - {28, nullptr, "GetAmiiboEcdsaCertificate"}, - {29, nullptr, "GetAmiiboEcqvBlsKey"}, - {30, nullptr, "GetAmiiboEcqvBlsCertificate"}, - {31, nullptr, "GetAmiiboEcqvBlsRootCertificate"}, - {32, nullptr, "GetUsbTypeCPowerSourceCircuitVersion"}, - {33, nullptr, "GetAnalogStickModuleTypeL"}, - {34, nullptr, "GetAnalogStickModelParameterL"}, - {35, nullptr, "GetAnalogStickFactoryCalibrationL"}, - {36, nullptr, "GetAnalogStickModuleTypeR"}, - {37, nullptr, "GetAnalogStickModelParameterR"}, - {38, nullptr, "GetAnalogStickFactoryCalibrationR"}, - {39, nullptr, "GetConsoleSixAxisSensorModuleType"}, - {40, nullptr, "GetConsoleSixAxisSensorHorizontalOffset"}, - {41, nullptr, "GetBatteryVersion"}, - {42, nullptr, "GetDeviceId"}, - {43, nullptr, "GetConsoleSixAxisSensorMountType"}, - }; - // clang-format on - - RegisterHandlers(functions); } IFactorySettingsServer::~IFactorySettingsServer() = default; diff --git a/src/core/hle/service/set/factory_settings_server.h b/src/core/hle/service/set/factory_settings_server.h index e64cd13809..dcc329f9c2 100644 --- a/src/core/hle/service/set/factory_settings_server.h +++ b/src/core/hle/service/set/factory_settings_server.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -15,6 +18,55 @@ class IFactorySettingsServer final : public ServiceFramework FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetBluetoothBdAddress"}, + FunctionInfo{1, nullptr, "GetConfigurationId1"}, + FunctionInfo{2, nullptr, "GetAccelerometerOffset"}, + FunctionInfo{3, nullptr, "GetAccelerometerScale"}, + FunctionInfo{4, nullptr, "GetGyroscopeOffset"}, + FunctionInfo{5, nullptr, "GetGyroscopeScale"}, + FunctionInfo{6, nullptr, "GetWirelessLanMacAddress"}, + FunctionInfo{7, nullptr, "GetWirelessLanCountryCodeCount"}, + FunctionInfo{8, nullptr, "GetWirelessLanCountryCodes"}, + FunctionInfo{9, nullptr, "GetSerialNumber"}, + FunctionInfo{10, nullptr, "SetInitialSystemAppletProgramId"}, + FunctionInfo{11, nullptr, "SetOverlayDispProgramId"}, + FunctionInfo{12, nullptr, "GetBatteryLot"}, + FunctionInfo{14, nullptr, "GetEciDeviceCertificate"}, + FunctionInfo{15, nullptr, "GetEticketDeviceCertificate"}, + FunctionInfo{16, nullptr, "GetSslKey"}, + FunctionInfo{17, nullptr, "GetSslCertificate"}, + FunctionInfo{18, nullptr, "GetGameCardKey"}, + FunctionInfo{19, nullptr, "GetGameCardCertificate"}, + FunctionInfo{20, nullptr, "GetEciDeviceKey"}, + FunctionInfo{21, nullptr, "GetEticketDeviceKey"}, + FunctionInfo{22, nullptr, "GetSpeakerParameter"}, + FunctionInfo{23, nullptr, "GetLcdVendorId"}, + FunctionInfo{24, nullptr, "GetEciDeviceCertificate2"}, + FunctionInfo{25, nullptr, "GetEciDeviceKey2"}, + FunctionInfo{26, nullptr, "GetAmiiboKey"}, + FunctionInfo{27, nullptr, "GetAmiiboEcqvCertificate"}, + FunctionInfo{28, nullptr, "GetAmiiboEcdsaCertificate"}, + FunctionInfo{29, nullptr, "GetAmiiboEcqvBlsKey"}, + FunctionInfo{30, nullptr, "GetAmiiboEcqvBlsCertificate"}, + FunctionInfo{31, nullptr, "GetAmiiboEcqvBlsRootCertificate"}, + FunctionInfo{32, nullptr, "GetUsbTypeCPowerSourceCircuitVersion"}, + FunctionInfo{33, nullptr, "GetAnalogStickModuleTypeL"}, + FunctionInfo{34, nullptr, "GetAnalogStickModelParameterL"}, + FunctionInfo{35, nullptr, "GetAnalogStickFactoryCalibrationL"}, + FunctionInfo{36, nullptr, "GetAnalogStickModuleTypeR"}, + FunctionInfo{37, nullptr, "GetAnalogStickModelParameterR"}, + FunctionInfo{38, nullptr, "GetAnalogStickFactoryCalibrationR"}, + FunctionInfo{39, nullptr, "GetConsoleSixAxisSensorModuleType"}, + FunctionInfo{40, nullptr, "GetConsoleSixAxisSensorHorizontalOffset"}, + FunctionInfo{41, nullptr, "GetBatteryVersion"}, + FunctionInfo{42, nullptr, "GetDeviceId"}, + FunctionInfo{43, nullptr, "GetConsoleSixAxisSensorMountType"} + ); }; } // namespace Service::Set diff --git a/src/core/hle/service/set/firmware_debug_settings_server.cpp b/src/core/hle/service/set/firmware_debug_settings_server.cpp index b7c66047e6..35fb43f7e7 100644 --- a/src/core/hle/service/set/firmware_debug_settings_server.cpp +++ b/src/core/hle/service/set/firmware_debug_settings_server.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project @@ -10,23 +10,6 @@ namespace Service::Set { IFirmwareDebugSettingsServer::IFirmwareDebugSettingsServer(Core::System& system_) : ServiceFramework{system_, "set:fd"} { - // clang-format off - static const FunctionInfo functions[] = { - {2, nullptr, "SetSettingsItemValue"}, - {3, nullptr, "ResetSettingsItemValue"}, - {4, nullptr, "CreateSettingsItemKeyIterator"}, - {10, nullptr, "ReadSettings"}, - {11, nullptr, "ResetSettings"}, - {20, nullptr, "SetWebInspectorFlag"}, - {21, nullptr, "SetAllowedSslHosts"}, - {22, nullptr, "SetHostFsMountPoint"}, - {23, nullptr, "SetMemoryUsageRateFlag"}, - {24, nullptr, "CommitSettings"}, //20.0.0+ - {27, nullptr, "SetHttpAuthConfigs"}, //21.0.0+ - }; - // clang-format on - - RegisterHandlers(functions); } IFirmwareDebugSettingsServer::~IFirmwareDebugSettingsServer() = default; diff --git a/src/core/hle/service/set/firmware_debug_settings_server.h b/src/core/hle/service/set/firmware_debug_settings_server.h index 5dae2263e9..3727a1a94c 100644 --- a/src/core/hle/service/set/firmware_debug_settings_server.h +++ b/src/core/hle/service/set/firmware_debug_settings_server.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -15,6 +18,23 @@ class IFirmwareDebugSettingsServer final : public ServiceFramework FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{2, nullptr, "SetSettingsItemValue"}, + FunctionInfo{3, nullptr, "ResetSettingsItemValue"}, + FunctionInfo{4, nullptr, "CreateSettingsItemKeyIterator"}, + FunctionInfo{10, nullptr, "ReadSettings"}, + FunctionInfo{11, nullptr, "ResetSettings"}, + FunctionInfo{20, nullptr, "SetWebInspectorFlag"}, + FunctionInfo{21, nullptr, "SetAllowedSslHosts"}, + FunctionInfo{22, nullptr, "SetHostFsMountPoint"}, + FunctionInfo{23, nullptr, "SetMemoryUsageRateFlag"}, + FunctionInfo{24, nullptr, "CommitSettings", MakeVersionGate({20,0,0})}, + FunctionInfo{27, nullptr, "SetHttpAuthConfigs", MakeVersionGate({21,0,0})} + ); }; } // namespace Service::Set diff --git a/src/core/hle/service/set/settings_server.cpp b/src/core/hle/service/set/settings_server.cpp index 942dddc9bc..4580cb723b 100644 --- a/src/core/hle/service/set/settings_server.cpp +++ b/src/core/hle/service/set/settings_server.cpp @@ -89,26 +89,26 @@ LanguageCode GetLanguageCodeFromIndex(std::size_t index) { return available_language_codes.at(index); } -ISettingsServer::ISettingsServer(Core::System& system_) : ServiceFramework{system_, "set"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, C<&ISettingsServer::GetLanguageCode>, "GetLanguageCode"}, - {1, C<&ISettingsServer::GetAvailableLanguageCodes>, "GetAvailableLanguageCodes"}, - {2, C<&ISettingsServer::MakeLanguageCode>, "MakeLanguageCode"}, - {3, C<&ISettingsServer::GetAvailableLanguageCodeCount>, "GetAvailableLanguageCodeCount"}, - {4, C<&ISettingsServer::GetRegionCode>, "GetRegionCode"}, - {5, C<&ISettingsServer::GetAvailableLanguageCodes2>, "GetAvailableLanguageCodes2"}, - {6, C<&ISettingsServer::GetAvailableLanguageCodeCount2>, "GetAvailableLanguageCodeCount2"}, - {7, C<&ISettingsServer::GetKeyCodeMap>, "GetKeyCodeMap"}, - {8, C<&ISettingsServer::GetQuestFlag>, "GetQuestFlag"}, - {9, C<&ISettingsServer::GetKeyCodeMap2>, "GetKeyCodeMap2"}, - {10, nullptr, "GetFirmwareVersionForDebug"}, - {11, C<&ISettingsServer::GetDeviceNickName>, "GetDeviceNickName"}, - {12, C<&ISettingsServer::GetKeyCodeMapByPort>, "GetKeyCodeMapByPort"}, - }; - // clang-format on +std::optional ISettingsServer::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, C<&ISettingsServer::GetLanguageCode>, "GetLanguageCode"}, + FunctionInfo{1, C<&ISettingsServer::GetAvailableLanguageCodes>, "GetAvailableLanguageCodes"}, + FunctionInfo{2, C<&ISettingsServer::MakeLanguageCode>, "MakeLanguageCode"}, + FunctionInfo{3, C<&ISettingsServer::GetAvailableLanguageCodeCount>, "GetAvailableLanguageCodeCount"}, + FunctionInfo{4, C<&ISettingsServer::GetRegionCode>, "GetRegionCode"}, + FunctionInfo{5, C<&ISettingsServer::GetAvailableLanguageCodes2>, "GetAvailableLanguageCodes2"}, + FunctionInfo{6, C<&ISettingsServer::GetAvailableLanguageCodeCount2>, "GetAvailableLanguageCodeCount2"}, + FunctionInfo{7, C<&ISettingsServer::GetKeyCodeMap>, "GetKeyCodeMap"}, + FunctionInfo{8, C<&ISettingsServer::GetQuestFlag>, "GetQuestFlag"}, + FunctionInfo{9, C<&ISettingsServer::GetKeyCodeMap2>, "GetKeyCodeMap2"}, + FunctionInfo{10, nullptr, "GetFirmwareVersionForDebug"}, + FunctionInfo{11, C<&ISettingsServer::GetDeviceNickName>, "GetDeviceNickName"}, + FunctionInfo{12, C<&ISettingsServer::GetKeyCodeMapByPort>, "GetKeyCodeMapByPort"} + ); + return HandlerTableGenerateWithFind(key, functions); +} - RegisterHandlers(functions); +ISettingsServer::ISettingsServer(Core::System& system_) : ServiceFramework{system_, "set"} { } ISettingsServer::~ISettingsServer() = default; diff --git a/src/core/hle/service/set/settings_server.h b/src/core/hle/service/set/settings_server.h index a9cee5f626..2aa487b8b1 100644 --- a/src/core/hle/service/set/settings_server.h +++ b/src/core/hle/service/set/settings_server.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -23,31 +26,19 @@ public: private: Result GetLanguageCode(Out out_language_code); - - Result GetAvailableLanguageCodes(Out out_count, - OutArray language_codes); - + Result GetAvailableLanguageCodes(Out out_count, OutArray language_codes); Result MakeLanguageCode(Out out_language_code, Language language); - Result GetAvailableLanguageCodeCount(Out out_count); - Result GetRegionCode(Out out_region_code); - - Result GetAvailableLanguageCodes2( - Out out_count, OutArray language_codes); - + Result GetAvailableLanguageCodes2(Out out_count, OutArray language_codes); Result GetAvailableLanguageCodeCount2(Out out_count); - Result GetKeyCodeMap(OutLargeData out_key_code_map); - Result GetQuestFlag(Out out_quest_flag); - Result GetKeyCodeMap2(OutLargeData out_key_code_map); - - Result GetDeviceNickName( - OutLargeData, BufferAttr_HipcMapAlias> out_device_name); - + Result GetDeviceNickName(OutLargeData, BufferAttr_HipcMapAlias> out_device_name); Result GetKeyCodeMapByPort(OutLargeData out_key_code_map, u32 port); + + std::optional FindRequest(u32 key) override; }; } // namespace Service::Set diff --git a/src/core/hle/service/set/system_settings_server.cpp b/src/core/hle/service/set/system_settings_server.cpp index 52642e37f7..925207d927 100644 --- a/src/core/hle/service/set/system_settings_server.cpp +++ b/src/core/hle/service/set/system_settings_server.cpp @@ -114,240 +114,239 @@ Result GetFirmwareVersionImpl(FirmwareVersionFormat& out_firmware, Core::System& return ResultSuccess; } +std::optional ISystemSettingsServer::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, C<&ISystemSettingsServer::SetLanguageCode>, "SetLanguageCode"}, + FunctionInfo{1, nullptr, "SetNetworkSettings"}, + FunctionInfo{2, nullptr, "GetNetworkSettings"}, + FunctionInfo{3, C<&ISystemSettingsServer::GetFirmwareVersion>, "GetFirmwareVersion"}, + FunctionInfo{4, C<&ISystemSettingsServer::GetFirmwareVersion2>, "GetFirmwareVersion2"}, + FunctionInfo{5, nullptr, "GetFirmwareVersionDigest"}, + FunctionInfo{7, C<&ISystemSettingsServer::GetLockScreenFlag>, "GetLockScreenFlag"}, + FunctionInfo{8, C<&ISystemSettingsServer::SetLockScreenFlag>, "SetLockScreenFlag"}, + FunctionInfo{9, nullptr, "GetBacklightSettings"}, + FunctionInfo{10, nullptr, "SetBacklightSettings"}, + FunctionInfo{11, nullptr, "SetBluetoothDevicesSettings"}, + FunctionInfo{12, nullptr, "GetBluetoothDevicesSettings"}, + FunctionInfo{13, C<&ISystemSettingsServer::GetExternalSteadyClockSourceId>, "GetExternalSteadyClockSourceId"}, + FunctionInfo{14, C<&ISystemSettingsServer::SetExternalSteadyClockSourceId>, "SetExternalSteadyClockSourceId"}, + FunctionInfo{15, C<&ISystemSettingsServer::GetUserSystemClockContext>, "GetUserSystemClockContext"}, + FunctionInfo{16, C<&ISystemSettingsServer::SetUserSystemClockContext>, "SetUserSystemClockContext"}, + FunctionInfo{17, C<&ISystemSettingsServer::GetAccountSettings>, "GetAccountSettings"}, + FunctionInfo{18, C<&ISystemSettingsServer::SetAccountSettings>, "SetAccountSettings"}, + FunctionInfo{19, nullptr, "GetAudioVolume"}, + FunctionInfo{20, nullptr, "SetAudioVolume"}, + FunctionInfo{21, C<&ISystemSettingsServer::GetEulaVersions>, "GetEulaVersions"}, + FunctionInfo{22, C<&ISystemSettingsServer::SetEulaVersions>, "SetEulaVersions"}, + FunctionInfo{23, C<&ISystemSettingsServer::GetColorSetId>, "GetColorSetId"}, + FunctionInfo{24, C<&ISystemSettingsServer::SetColorSetId>, "SetColorSetId"}, + FunctionInfo{25, C<&ISystemSettingsServer::GetConsoleInformationUploadFlag>, "GetConsoleInformationUploadFlag"}, + FunctionInfo{26, C<&ISystemSettingsServer::SetConsoleInformationUploadFlag>, "SetConsoleInformationUploadFlag"}, + FunctionInfo{27, C<&ISystemSettingsServer::GetAutomaticApplicationDownloadFlag>, "GetAutomaticApplicationDownloadFlag"}, + FunctionInfo{28, C<&ISystemSettingsServer::SetAutomaticApplicationDownloadFlag>, "SetAutomaticApplicationDownloadFlag"}, + FunctionInfo{29, C<&ISystemSettingsServer::GetNotificationSettings>, "GetNotificationSettings"}, + FunctionInfo{30, C<&ISystemSettingsServer::SetNotificationSettings>, "SetNotificationSettings"}, + FunctionInfo{31, C<&ISystemSettingsServer::GetAccountNotificationSettings>, "GetAccountNotificationSettings"}, + FunctionInfo{32, C<&ISystemSettingsServer::SetAccountNotificationSettings>, "SetAccountNotificationSettings"}, + FunctionInfo{35, C<&ISystemSettingsServer::GetVibrationMasterVolume>, "GetVibrationMasterVolume"}, + FunctionInfo{36, C<&ISystemSettingsServer::SetVibrationMasterVolume>, "SetVibrationMasterVolume"}, + FunctionInfo{37, C<&ISystemSettingsServer::GetSettingsItemValueSize>, "GetSettingsItemValueSize"}, + FunctionInfo{38, C<&ISystemSettingsServer::GetSettingsItemValue>, "GetSettingsItemValue"}, + FunctionInfo{39, C<&ISystemSettingsServer::GetTvSettings>, "GetTvSettings"}, + FunctionInfo{40, C<&ISystemSettingsServer::SetTvSettings>, "SetTvSettings"}, + FunctionInfo{41, nullptr, "GetEdid"}, + FunctionInfo{42, nullptr, "SetEdid"}, + FunctionInfo{43, C<&ISystemSettingsServer::GetAudioOutputMode>, "GetAudioOutputMode"}, + FunctionInfo{44, C<&ISystemSettingsServer::SetAudioOutputMode>, "SetAudioOutputMode"}, + FunctionInfo{45, C<&ISystemSettingsServer::GetSpeakerAutoMuteFlag>, "GetSpeakerAutoMuteFlag"}, + FunctionInfo{46, C<&ISystemSettingsServer::SetSpeakerAutoMuteFlag>, "SetSpeakerAutoMuteFlag"}, + FunctionInfo{47, C<&ISystemSettingsServer::GetQuestFlag>, "GetQuestFlag"}, + FunctionInfo{48, C<&ISystemSettingsServer::SetQuestFlag>, "SetQuestFlag"}, + FunctionInfo{49, nullptr, "GetDataDeletionSettings"}, + FunctionInfo{50, nullptr, "SetDataDeletionSettings"}, + FunctionInfo{51, nullptr, "GetInitialSystemAppletProgramId"}, + FunctionInfo{52, nullptr, "GetOverlayDispProgramId"}, + FunctionInfo{53, C<&ISystemSettingsServer::GetDeviceTimeZoneLocationName>, "GetDeviceTimeZoneLocationName"}, + FunctionInfo{54, C<&ISystemSettingsServer::SetDeviceTimeZoneLocationName>, "SetDeviceTimeZoneLocationName"}, + FunctionInfo{55, nullptr, "GetWirelessCertificationFileSize"}, + FunctionInfo{56, nullptr, "GetWirelessCertificationFile"}, + FunctionInfo{57, C<&ISystemSettingsServer::SetRegionCode>, "SetRegionCode"}, + FunctionInfo{58, C<&ISystemSettingsServer::GetNetworkSystemClockContext>, "GetNetworkSystemClockContext"}, + FunctionInfo{59, C<&ISystemSettingsServer::SetNetworkSystemClockContext>, "SetNetworkSystemClockContext"}, + FunctionInfo{60, C<&ISystemSettingsServer::IsUserSystemClockAutomaticCorrectionEnabled>, "IsUserSystemClockAutomaticCorrectionEnabled"}, + FunctionInfo{61, C<&ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionEnabled>, "SetUserSystemClockAutomaticCorrectionEnabled"}, + FunctionInfo{62, C<&ISystemSettingsServer::GetDebugModeFlag>, "GetDebugModeFlag"}, + FunctionInfo{63, C<&ISystemSettingsServer::GetPrimaryAlbumStorage>, "GetPrimaryAlbumStorage"}, + FunctionInfo{64, C<&ISystemSettingsServer::SetPrimaryAlbumStorage>, "SetPrimaryAlbumStorage"}, + FunctionInfo{65, C<&ISystemSettingsServer::GetUsb30EnableFlag>, "GetUsb30EnableFlag"}, + FunctionInfo{66, C<&ISystemSettingsServer::SetUsb30EnableFlag>, "SetUsb30EnableFlag"}, + FunctionInfo{67, C<&ISystemSettingsServer::GetBatteryLot>, "GetBatteryLot"}, + FunctionInfo{68, C<&ISystemSettingsServer::GetSerialNumber>, "GetSerialNumber"}, + FunctionInfo{69, C<&ISystemSettingsServer::GetNfcEnableFlag>, "GetNfcEnableFlag"}, + FunctionInfo{70, C<&ISystemSettingsServer::SetNfcEnableFlag>, "SetNfcEnableFlag"}, + FunctionInfo{71, C<&ISystemSettingsServer::GetSleepSettings>, "GetSleepSettings"}, + FunctionInfo{72, C<&ISystemSettingsServer::SetSleepSettings>, "SetSleepSettings"}, + FunctionInfo{73, C<&ISystemSettingsServer::GetWirelessLanEnableFlag>, "GetWirelessLanEnableFlag"}, + FunctionInfo{74, C<&ISystemSettingsServer::SetWirelessLanEnableFlag>, "SetWirelessLanEnableFlag"}, + FunctionInfo{75, C<&ISystemSettingsServer::GetInitialLaunchSettings>, "GetInitialLaunchSettings"}, + FunctionInfo{76, C<&ISystemSettingsServer::SetInitialLaunchSettings>, "SetInitialLaunchSettings"}, + FunctionInfo{77, C<&ISystemSettingsServer::GetDeviceNickName>, "GetDeviceNickName"}, + FunctionInfo{78, C<&ISystemSettingsServer::SetDeviceNickName>, "SetDeviceNickName"}, + FunctionInfo{79, C<&ISystemSettingsServer::GetProductModel>, "GetProductModel"}, + FunctionInfo{80, nullptr, "GetLdnChannel"}, + FunctionInfo{81, nullptr, "SetLdnChannel"}, + FunctionInfo{82, nullptr, "AcquireTelemetryDirtyFlagEventHandle"}, + FunctionInfo{83, nullptr, "GetTelemetryDirtyFlags"}, + FunctionInfo{84, nullptr, "GetPtmBatteryLot"}, + FunctionInfo{85, nullptr, "SetPtmBatteryLot"}, + FunctionInfo{86, nullptr, "GetPtmFuelGaugeParameter"}, + FunctionInfo{87, nullptr, "SetPtmFuelGaugeParameter"}, + FunctionInfo{88, C<&ISystemSettingsServer::GetBluetoothEnableFlag>, "GetBluetoothEnableFlag"}, + FunctionInfo{89, C<&ISystemSettingsServer::SetBluetoothEnableFlag>, "SetBluetoothEnableFlag"}, + FunctionInfo{90, C<&ISystemSettingsServer::GetMiiAuthorId>, "GetMiiAuthorId"}, + FunctionInfo{91, nullptr, "SetShutdownRtcValue"}, + FunctionInfo{92, nullptr, "GetShutdownRtcValue"}, + FunctionInfo{93, nullptr, "AcquireFatalDirtyFlagEventHandle"}, + FunctionInfo{94, nullptr, "GetFatalDirtyFlags"}, + FunctionInfo{95, C<&ISystemSettingsServer::GetAutoUpdateEnableFlag>, "GetAutoUpdateEnableFlag"}, + FunctionInfo{96, C<&ISystemSettingsServer::SetAutoUpdateEnableFlag>, "SetAutoUpdateEnableFlag"}, + FunctionInfo{97, nullptr, "GetNxControllerSettings"}, + FunctionInfo{98, nullptr, "SetNxControllerSettings"}, + FunctionInfo{99, C<&ISystemSettingsServer::GetBatteryPercentageFlag>, "GetBatteryPercentageFlag"}, + FunctionInfo{100, C<&ISystemSettingsServer::SetBatteryPercentageFlag>, "SetBatteryPercentageFlag"}, + FunctionInfo{101, nullptr, "GetExternalRtcResetFlag"}, + FunctionInfo{102, nullptr, "SetExternalRtcResetFlag"}, + FunctionInfo{103, nullptr, "GetUsbFullKeyEnableFlag"}, + FunctionInfo{104, nullptr, "SetUsbFullKeyEnableFlag"}, + FunctionInfo{105, C<&ISystemSettingsServer::SetExternalSteadyClockInternalOffset>, "SetExternalSteadyClockInternalOffset"}, + FunctionInfo{106, C<&ISystemSettingsServer::GetExternalSteadyClockInternalOffset>, "GetExternalSteadyClockInternalOffset"}, + FunctionInfo{107, nullptr, "GetBacklightSettingsEx"}, + FunctionInfo{108, nullptr, "SetBacklightSettingsEx"}, + FunctionInfo{109, nullptr, "GetHeadphoneVolumeWarningCount"}, + FunctionInfo{110, nullptr, "SetHeadphoneVolumeWarningCount"}, + FunctionInfo{111, nullptr, "GetBluetoothAfhEnableFlag"}, + FunctionInfo{112, nullptr, "SetBluetoothAfhEnableFlag"}, + FunctionInfo{113, nullptr, "GetBluetoothBoostEnableFlag"}, + FunctionInfo{114, nullptr, "SetBluetoothBoostEnableFlag"}, + FunctionInfo{115, nullptr, "GetInRepairProcessEnableFlag"}, + FunctionInfo{116, nullptr, "SetInRepairProcessEnableFlag"}, + FunctionInfo{117, nullptr, "GetHeadphoneVolumeUpdateFlag"}, + FunctionInfo{118, nullptr, "SetHeadphoneVolumeUpdateFlag"}, + FunctionInfo{119, nullptr, "NeedsToUpdateHeadphoneVolume"}, + FunctionInfo{120, C<&ISystemSettingsServer::GetPushNotificationActivityModeOnSleep>, "GetPushNotificationActivityModeOnSleep"}, + FunctionInfo{121, C<&ISystemSettingsServer::SetPushNotificationActivityModeOnSleep>, "SetPushNotificationActivityModeOnSleep"}, + FunctionInfo{122, nullptr, "GetServiceDiscoveryControlSettings"}, + FunctionInfo{123, nullptr, "SetServiceDiscoveryControlSettings"}, + FunctionInfo{124, C<&ISystemSettingsServer::GetErrorReportSharePermission>, "GetErrorReportSharePermission"}, + FunctionInfo{125, C<&ISystemSettingsServer::SetErrorReportSharePermission>, "SetErrorReportSharePermission"}, + FunctionInfo{126, C<&ISystemSettingsServer::GetAppletLaunchFlags>, "GetAppletLaunchFlags"}, + FunctionInfo{127, C<&ISystemSettingsServer::SetAppletLaunchFlags>, "SetAppletLaunchFlags"}, + FunctionInfo{128, nullptr, "GetConsoleSixAxisSensorAccelerationBias"}, + FunctionInfo{129, nullptr, "SetConsoleSixAxisSensorAccelerationBias"}, + FunctionInfo{130, nullptr, "GetConsoleSixAxisSensorAngularVelocityBias"}, + FunctionInfo{131, nullptr, "SetConsoleSixAxisSensorAngularVelocityBias"}, + FunctionInfo{132, nullptr, "GetConsoleSixAxisSensorAccelerationGain"}, + FunctionInfo{133, nullptr, "SetConsoleSixAxisSensorAccelerationGain"}, + FunctionInfo{134, nullptr, "GetConsoleSixAxisSensorAngularVelocityGain"}, + FunctionInfo{135, nullptr, "SetConsoleSixAxisSensorAngularVelocityGain"}, + FunctionInfo{136, C<&ISystemSettingsServer::GetKeyboardLayout>, "GetKeyboardLayout"}, + FunctionInfo{137, C<&ISystemSettingsServer::SetKeyboardLayout>, "SetKeyboardLayout"}, + FunctionInfo{138, nullptr, "GetWebInspectorFlag"}, + FunctionInfo{139, nullptr, "GetAllowedSslHosts"}, + FunctionInfo{140, nullptr, "GetHostFsMountPoint"}, + FunctionInfo{141, nullptr, "GetRequiresRunRepairTimeReviser"}, + FunctionInfo{142, nullptr, "SetRequiresRunRepairTimeReviser"}, + FunctionInfo{143, nullptr, "SetBlePairingSettings"}, + FunctionInfo{144, nullptr, "GetBlePairingSettings"}, + FunctionInfo{145, nullptr, "GetConsoleSixAxisSensorAngularVelocityTimeBias"}, + FunctionInfo{146, nullptr, "SetConsoleSixAxisSensorAngularVelocityTimeBias"}, + FunctionInfo{147, nullptr, "GetConsoleSixAxisSensorAngularAcceleration"}, + FunctionInfo{148, nullptr, "SetConsoleSixAxisSensorAngularAcceleration"}, + FunctionInfo{149, C<&ISystemSettingsServer::GetRebootlessSystemUpdateVersion>, "GetRebootlessSystemUpdateVersion"}, + FunctionInfo{150, C<&ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime>, "GetDeviceTimeZoneLocationUpdatedTime"}, + FunctionInfo{151, C<&ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime>, "SetDeviceTimeZoneLocationUpdatedTime"}, + FunctionInfo{152, C<&ISystemSettingsServer::GetUserSystemClockAutomaticCorrectionUpdatedTime>, "GetUserSystemClockAutomaticCorrectionUpdatedTime"}, + FunctionInfo{153, C<&ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime>, "SetUserSystemClockAutomaticCorrectionUpdatedTime"}, + FunctionInfo{154, nullptr, "GetAccountOnlineStorageSettings"}, + FunctionInfo{155, nullptr, "SetAccountOnlineStorageSettings"}, + FunctionInfo{156, nullptr, "GetPctlReadyFlag"}, + FunctionInfo{157, nullptr, "SetPctlReadyFlag"}, + FunctionInfo{158, nullptr, "GetAnalogStickUserCalibrationL"}, + FunctionInfo{159, nullptr, "SetAnalogStickUserCalibrationL"}, + FunctionInfo{160, nullptr, "GetAnalogStickUserCalibrationR"}, + FunctionInfo{161, nullptr, "SetAnalogStickUserCalibrationR"}, + FunctionInfo{162, nullptr, "GetPtmBatteryVersion"}, + FunctionInfo{163, nullptr, "SetPtmBatteryVersion"}, + FunctionInfo{164, nullptr, "GetUsb30HostEnableFlag"}, + FunctionInfo{165, nullptr, "SetUsb30HostEnableFlag"}, + FunctionInfo{166, nullptr, "GetUsb30DeviceEnableFlag"}, + FunctionInfo{167, nullptr, "SetUsb30DeviceEnableFlag"}, + FunctionInfo{168, nullptr, "GetThemeId"}, + FunctionInfo{169, nullptr, "SetThemeId"}, + FunctionInfo{170, C<&ISystemSettingsServer::GetChineseTraditionalInputMethod>, "GetChineseTraditionalInputMethod"}, + FunctionInfo{171, nullptr, "SetChineseTraditionalInputMethod"}, + FunctionInfo{172, nullptr, "GetPtmCycleCountReliability"}, + FunctionInfo{173, nullptr, "SetPtmCycleCountReliability"}, + FunctionInfo{174, C<&ISystemSettingsServer::GetHomeMenuScheme>, "GetHomeMenuScheme"}, + FunctionInfo{175, nullptr, "GetThemeSettings"}, + FunctionInfo{176, nullptr, "SetThemeSettings"}, + FunctionInfo{177, nullptr, "GetThemeKey"}, + FunctionInfo{178, nullptr, "SetThemeKey"}, + FunctionInfo{179, nullptr, "GetZoomFlag"}, + FunctionInfo{180, nullptr, "SetZoomFlag"}, + FunctionInfo{181, nullptr, "GetT"}, + FunctionInfo{182, nullptr, "SetT"}, + FunctionInfo{183, C<&ISystemSettingsServer::GetPlatformRegion>, "GetPlatformRegion"}, + FunctionInfo{184, C<&ISystemSettingsServer::SetPlatformRegion>, "SetPlatformRegion"}, + FunctionInfo{185, C<&ISystemSettingsServer::GetHomeMenuSchemeModel>, "GetHomeMenuSchemeModel"}, + FunctionInfo{186, nullptr, "GetMemoryUsageRateFlag"}, + FunctionInfo{187, C<&ISystemSettingsServer::GetTouchScreenMode>, "GetTouchScreenMode"}, + FunctionInfo{188, C<&ISystemSettingsServer::SetTouchScreenMode>, "SetTouchScreenMode"}, + FunctionInfo{189, nullptr, "GetButtonConfigSettingsFull"}, + FunctionInfo{190, nullptr, "SetButtonConfigSettingsFull"}, + FunctionInfo{191, nullptr, "GetButtonConfigSettingsEmbedded"}, + FunctionInfo{192, nullptr, "SetButtonConfigSettingsEmbedded"}, + FunctionInfo{193, nullptr, "GetButtonConfigSettingsLeft"}, + FunctionInfo{194, nullptr, "SetButtonConfigSettingsLeft"}, + FunctionInfo{195, nullptr, "GetButtonConfigSettingsRight"}, + FunctionInfo{196, nullptr, "SetButtonConfigSettingsRight"}, + FunctionInfo{197, nullptr, "GetButtonConfigRegisteredSettingsEmbedded"}, + FunctionInfo{198, nullptr, "SetButtonConfigRegisteredSettingsEmbedded"}, + FunctionInfo{199, nullptr, "GetButtonConfigRegisteredSettings"}, + FunctionInfo{200, nullptr, "SetButtonConfigRegisteredSettings"}, + FunctionInfo{201, C<&ISystemSettingsServer::GetFieldTestingFlag>, "GetFieldTestingFlag"}, + FunctionInfo{202, nullptr, "SetFieldTestingFlag"}, + FunctionInfo{203, C<&ISystemSettingsServer::GetPanelCrcMode>, "GetPanelCrcMode"}, + FunctionInfo{204, C<&ISystemSettingsServer::SetPanelCrcMode>, "SetPanelCrcMode"}, + FunctionInfo{205, nullptr, "GetNxControllerSettingsEx"}, + FunctionInfo{206, nullptr, "SetNxControllerSettingsEx"}, + FunctionInfo{207, nullptr, "GetHearingProtectionSafeguardFlag"}, + FunctionInfo{208, nullptr, "SetHearingProtectionSafeguardFlag"}, + FunctionInfo{209, nullptr, "GetHearingProtectionSafeguardRemainingTime"}, + FunctionInfo{210, nullptr, "SetHearingProtectionSafeguardRemainingTime"}, + FunctionInfo{221, nullptr, "GetForceMonauralOutputFlag", MakeVersionGate({17,0,0})}, + FunctionInfo{222, nullptr, "SetForceMonauralOutputFlag", MakeVersionGate({17,0,0})}, + FunctionInfo{251, nullptr, "GetAccountIdentificationSettings", MakeVersionGate({18,0,0})}, + FunctionInfo{252, nullptr, "SetAccountIdentificationSettings", MakeVersionGate({18,0,0})}, + FunctionInfo{263, nullptr, "AcquireVphymDirtyFlagEventHandle", MakeVersionGate({20,0,0})}, + FunctionInfo{264, nullptr, "GetVphymDirtyFlags", MakeVersionGate({20,0,0})}, + FunctionInfo{282, nullptr, "ConvertToProductModel", MakeVersionGate({20,0,0})}, + FunctionInfo{283, nullptr, "ConvertToProductModelName", MakeVersionGate({20,0,0})}, + FunctionInfo{289, nullptr, "GetDefaultAccountIdentificationFlagSet", MakeVersionGate({20,0,0})}, + FunctionInfo{300, nullptr, "AcquirePushNotificationDirtyFlagEventHandle", MakeVersionGate({20,0,0})}, + FunctionInfo{301, nullptr, "GetPushNotificationDirtyFlags", MakeVersionGate({20,0,0})}, + FunctionInfo{306, nullptr, "GetPinCodeReregistrationGuideAccounts", MakeVersionGate({20,0,0})}, + FunctionInfo{307, nullptr, "SetPinCodeReregistrationGuideAccounts", MakeVersionGate({20,0,0})}, + FunctionInfo{315, C<&ISystemSettingsServer::GetHttpAuthConfigs>, "GetHttpAuthConfigs", MakeVersionGate({21,0,0})}, + FunctionInfo{319, C<&ISystemSettingsServer::GetAccountUserSettings>, "GetAccountUserSettings", MakeVersionGate({21,0,0})}, + FunctionInfo{320, nullptr, "SetAccountUserSettings", MakeVersionGate({21,0,0})}, + FunctionInfo{321, C<&ISystemSettingsServer::GetDefaultAccountUserSettings>, "GetDefaultAccountUserSettings", MakeVersionGate({21,0,0})} + ); + return HandlerTableGenerateWithFind(key, functions); +} + ISystemSettingsServer::ISystemSettingsServer(Core::System& system_) - : ServiceFramework{system_, "set:sys"}, m_system{system} { - // clang-format off - static const FunctionInfo functions[] = { - {0, C<&ISystemSettingsServer::SetLanguageCode>, "SetLanguageCode"}, - {1, nullptr, "SetNetworkSettings"}, - {2, nullptr, "GetNetworkSettings"}, - {3, C<&ISystemSettingsServer::GetFirmwareVersion>, "GetFirmwareVersion"}, - {4, C<&ISystemSettingsServer::GetFirmwareVersion2>, "GetFirmwareVersion2"}, - {5, nullptr, "GetFirmwareVersionDigest"}, - {7, C<&ISystemSettingsServer::GetLockScreenFlag>, "GetLockScreenFlag"}, - {8, C<&ISystemSettingsServer::SetLockScreenFlag>, "SetLockScreenFlag"}, - {9, nullptr, "GetBacklightSettings"}, - {10, nullptr, "SetBacklightSettings"}, - {11, nullptr, "SetBluetoothDevicesSettings"}, - {12, nullptr, "GetBluetoothDevicesSettings"}, - {13, C<&ISystemSettingsServer::GetExternalSteadyClockSourceId>, "GetExternalSteadyClockSourceId"}, - {14, C<&ISystemSettingsServer::SetExternalSteadyClockSourceId>, "SetExternalSteadyClockSourceId"}, - {15, C<&ISystemSettingsServer::GetUserSystemClockContext>, "GetUserSystemClockContext"}, - {16, C<&ISystemSettingsServer::SetUserSystemClockContext>, "SetUserSystemClockContext"}, - {17, C<&ISystemSettingsServer::GetAccountSettings>, "GetAccountSettings"}, - {18, C<&ISystemSettingsServer::SetAccountSettings>, "SetAccountSettings"}, - {19, nullptr, "GetAudioVolume"}, - {20, nullptr, "SetAudioVolume"}, - {21, C<&ISystemSettingsServer::GetEulaVersions>, "GetEulaVersions"}, - {22, C<&ISystemSettingsServer::SetEulaVersions>, "SetEulaVersions"}, - {23, C<&ISystemSettingsServer::GetColorSetId>, "GetColorSetId"}, - {24, C<&ISystemSettingsServer::SetColorSetId>, "SetColorSetId"}, - {25, C<&ISystemSettingsServer::GetConsoleInformationUploadFlag>, "GetConsoleInformationUploadFlag"}, - {26, C<&ISystemSettingsServer::SetConsoleInformationUploadFlag>, "SetConsoleInformationUploadFlag"}, - {27, C<&ISystemSettingsServer::GetAutomaticApplicationDownloadFlag>, "GetAutomaticApplicationDownloadFlag"}, - {28, C<&ISystemSettingsServer::SetAutomaticApplicationDownloadFlag>, "SetAutomaticApplicationDownloadFlag"}, - {29, C<&ISystemSettingsServer::GetNotificationSettings>, "GetNotificationSettings"}, - {30, C<&ISystemSettingsServer::SetNotificationSettings>, "SetNotificationSettings"}, - {31, C<&ISystemSettingsServer::GetAccountNotificationSettings>, "GetAccountNotificationSettings"}, - {32, C<&ISystemSettingsServer::SetAccountNotificationSettings>, "SetAccountNotificationSettings"}, - {35, C<&ISystemSettingsServer::GetVibrationMasterVolume>, "GetVibrationMasterVolume"}, - {36, C<&ISystemSettingsServer::SetVibrationMasterVolume>, "SetVibrationMasterVolume"}, - {37, C<&ISystemSettingsServer::GetSettingsItemValueSize>, "GetSettingsItemValueSize"}, - {38, C<&ISystemSettingsServer::GetSettingsItemValue>, "GetSettingsItemValue"}, - {39, C<&ISystemSettingsServer::GetTvSettings>, "GetTvSettings"}, - {40, C<&ISystemSettingsServer::SetTvSettings>, "SetTvSettings"}, - {41, nullptr, "GetEdid"}, - {42, nullptr, "SetEdid"}, - {43, C<&ISystemSettingsServer::GetAudioOutputMode>, "GetAudioOutputMode"}, - {44, C<&ISystemSettingsServer::SetAudioOutputMode>, "SetAudioOutputMode"}, - {45, C<&ISystemSettingsServer::GetSpeakerAutoMuteFlag>, "GetSpeakerAutoMuteFlag"}, - {46, C<&ISystemSettingsServer::SetSpeakerAutoMuteFlag>, "SetSpeakerAutoMuteFlag"}, - {47, C<&ISystemSettingsServer::GetQuestFlag>, "GetQuestFlag"}, - {48, C<&ISystemSettingsServer::SetQuestFlag>, "SetQuestFlag"}, - {49, nullptr, "GetDataDeletionSettings"}, - {50, nullptr, "SetDataDeletionSettings"}, - {51, nullptr, "GetInitialSystemAppletProgramId"}, - {52, nullptr, "GetOverlayDispProgramId"}, - {53, C<&ISystemSettingsServer::GetDeviceTimeZoneLocationName>, "GetDeviceTimeZoneLocationName"}, - {54, C<&ISystemSettingsServer::SetDeviceTimeZoneLocationName>, "SetDeviceTimeZoneLocationName"}, - {55, nullptr, "GetWirelessCertificationFileSize"}, - {56, nullptr, "GetWirelessCertificationFile"}, - {57, C<&ISystemSettingsServer::SetRegionCode>, "SetRegionCode"}, - {58, C<&ISystemSettingsServer::GetNetworkSystemClockContext>, "GetNetworkSystemClockContext"}, - {59, C<&ISystemSettingsServer::SetNetworkSystemClockContext>, "SetNetworkSystemClockContext"}, - {60, C<&ISystemSettingsServer::IsUserSystemClockAutomaticCorrectionEnabled>, "IsUserSystemClockAutomaticCorrectionEnabled"}, - {61, C<&ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionEnabled>, "SetUserSystemClockAutomaticCorrectionEnabled"}, - {62, C<&ISystemSettingsServer::GetDebugModeFlag>, "GetDebugModeFlag"}, - {63, C<&ISystemSettingsServer::GetPrimaryAlbumStorage>, "GetPrimaryAlbumStorage"}, - {64, C<&ISystemSettingsServer::SetPrimaryAlbumStorage>, "SetPrimaryAlbumStorage"}, - {65, C<&ISystemSettingsServer::GetUsb30EnableFlag>, "GetUsb30EnableFlag"}, - {66, C<&ISystemSettingsServer::SetUsb30EnableFlag>, "SetUsb30EnableFlag"}, - {67, C<&ISystemSettingsServer::GetBatteryLot>, "GetBatteryLot"}, - {68, C<&ISystemSettingsServer::GetSerialNumber>, "GetSerialNumber"}, - {69, C<&ISystemSettingsServer::GetNfcEnableFlag>, "GetNfcEnableFlag"}, - {70, C<&ISystemSettingsServer::SetNfcEnableFlag>, "SetNfcEnableFlag"}, - {71, C<&ISystemSettingsServer::GetSleepSettings>, "GetSleepSettings"}, - {72, C<&ISystemSettingsServer::SetSleepSettings>, "SetSleepSettings"}, - {73, C<&ISystemSettingsServer::GetWirelessLanEnableFlag>, "GetWirelessLanEnableFlag"}, - {74, C<&ISystemSettingsServer::SetWirelessLanEnableFlag>, "SetWirelessLanEnableFlag"}, - {75, C<&ISystemSettingsServer::GetInitialLaunchSettings>, "GetInitialLaunchSettings"}, - {76, C<&ISystemSettingsServer::SetInitialLaunchSettings>, "SetInitialLaunchSettings"}, - {77, C<&ISystemSettingsServer::GetDeviceNickName>, "GetDeviceNickName"}, - {78, C<&ISystemSettingsServer::SetDeviceNickName>, "SetDeviceNickName"}, - {79, C<&ISystemSettingsServer::GetProductModel>, "GetProductModel"}, - {80, nullptr, "GetLdnChannel"}, - {81, nullptr, "SetLdnChannel"}, - {82, nullptr, "AcquireTelemetryDirtyFlagEventHandle"}, - {83, nullptr, "GetTelemetryDirtyFlags"}, - {84, nullptr, "GetPtmBatteryLot"}, - {85, nullptr, "SetPtmBatteryLot"}, - {86, nullptr, "GetPtmFuelGaugeParameter"}, - {87, nullptr, "SetPtmFuelGaugeParameter"}, - {88, C<&ISystemSettingsServer::GetBluetoothEnableFlag>, "GetBluetoothEnableFlag"}, - {89, C<&ISystemSettingsServer::SetBluetoothEnableFlag>, "SetBluetoothEnableFlag"}, - {90, C<&ISystemSettingsServer::GetMiiAuthorId>, "GetMiiAuthorId"}, - {91, nullptr, "SetShutdownRtcValue"}, - {92, nullptr, "GetShutdownRtcValue"}, - {93, nullptr, "AcquireFatalDirtyFlagEventHandle"}, - {94, nullptr, "GetFatalDirtyFlags"}, - {95, C<&ISystemSettingsServer::GetAutoUpdateEnableFlag>, "GetAutoUpdateEnableFlag"}, - {96, C<&ISystemSettingsServer::SetAutoUpdateEnableFlag>, "SetAutoUpdateEnableFlag"}, - {97, nullptr, "GetNxControllerSettings"}, - {98, nullptr, "SetNxControllerSettings"}, - {99, C<&ISystemSettingsServer::GetBatteryPercentageFlag>, "GetBatteryPercentageFlag"}, - {100, C<&ISystemSettingsServer::SetBatteryPercentageFlag>, "SetBatteryPercentageFlag"}, - {101, nullptr, "GetExternalRtcResetFlag"}, - {102, nullptr, "SetExternalRtcResetFlag"}, - {103, nullptr, "GetUsbFullKeyEnableFlag"}, - {104, nullptr, "SetUsbFullKeyEnableFlag"}, - {105, C<&ISystemSettingsServer::SetExternalSteadyClockInternalOffset>, "SetExternalSteadyClockInternalOffset"}, - {106, C<&ISystemSettingsServer::GetExternalSteadyClockInternalOffset>, "GetExternalSteadyClockInternalOffset"}, - {107, nullptr, "GetBacklightSettingsEx"}, - {108, nullptr, "SetBacklightSettingsEx"}, - {109, nullptr, "GetHeadphoneVolumeWarningCount"}, - {110, nullptr, "SetHeadphoneVolumeWarningCount"}, - {111, nullptr, "GetBluetoothAfhEnableFlag"}, - {112, nullptr, "SetBluetoothAfhEnableFlag"}, - {113, nullptr, "GetBluetoothBoostEnableFlag"}, - {114, nullptr, "SetBluetoothBoostEnableFlag"}, - {115, nullptr, "GetInRepairProcessEnableFlag"}, - {116, nullptr, "SetInRepairProcessEnableFlag"}, - {117, nullptr, "GetHeadphoneVolumeUpdateFlag"}, - {118, nullptr, "SetHeadphoneVolumeUpdateFlag"}, - {119, nullptr, "NeedsToUpdateHeadphoneVolume"}, - {120, C<&ISystemSettingsServer::GetPushNotificationActivityModeOnSleep>, "GetPushNotificationActivityModeOnSleep"}, - {121, C<&ISystemSettingsServer::SetPushNotificationActivityModeOnSleep>, "SetPushNotificationActivityModeOnSleep"}, - {122, nullptr, "GetServiceDiscoveryControlSettings"}, - {123, nullptr, "SetServiceDiscoveryControlSettings"}, - {124, C<&ISystemSettingsServer::GetErrorReportSharePermission>, "GetErrorReportSharePermission"}, - {125, C<&ISystemSettingsServer::SetErrorReportSharePermission>, "SetErrorReportSharePermission"}, - {126, C<&ISystemSettingsServer::GetAppletLaunchFlags>, "GetAppletLaunchFlags"}, - {127, C<&ISystemSettingsServer::SetAppletLaunchFlags>, "SetAppletLaunchFlags"}, - {128, nullptr, "GetConsoleSixAxisSensorAccelerationBias"}, - {129, nullptr, "SetConsoleSixAxisSensorAccelerationBias"}, - {130, nullptr, "GetConsoleSixAxisSensorAngularVelocityBias"}, - {131, nullptr, "SetConsoleSixAxisSensorAngularVelocityBias"}, - {132, nullptr, "GetConsoleSixAxisSensorAccelerationGain"}, - {133, nullptr, "SetConsoleSixAxisSensorAccelerationGain"}, - {134, nullptr, "GetConsoleSixAxisSensorAngularVelocityGain"}, - {135, nullptr, "SetConsoleSixAxisSensorAngularVelocityGain"}, - {136, C<&ISystemSettingsServer::GetKeyboardLayout>, "GetKeyboardLayout"}, - {137, C<&ISystemSettingsServer::SetKeyboardLayout>, "SetKeyboardLayout"}, - {138, nullptr, "GetWebInspectorFlag"}, - {139, nullptr, "GetAllowedSslHosts"}, - {140, nullptr, "GetHostFsMountPoint"}, - {141, nullptr, "GetRequiresRunRepairTimeReviser"}, - {142, nullptr, "SetRequiresRunRepairTimeReviser"}, - {143, nullptr, "SetBlePairingSettings"}, - {144, nullptr, "GetBlePairingSettings"}, - {145, nullptr, "GetConsoleSixAxisSensorAngularVelocityTimeBias"}, - {146, nullptr, "SetConsoleSixAxisSensorAngularVelocityTimeBias"}, - {147, nullptr, "GetConsoleSixAxisSensorAngularAcceleration"}, - {148, nullptr, "SetConsoleSixAxisSensorAngularAcceleration"}, - {149, C<&ISystemSettingsServer::GetRebootlessSystemUpdateVersion>, "GetRebootlessSystemUpdateVersion"}, - {150, C<&ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime>, "GetDeviceTimeZoneLocationUpdatedTime"}, - {151, C<&ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime>, "SetDeviceTimeZoneLocationUpdatedTime"}, - {152, C<&ISystemSettingsServer::GetUserSystemClockAutomaticCorrectionUpdatedTime>, "GetUserSystemClockAutomaticCorrectionUpdatedTime"}, - {153, C<&ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime>, "SetUserSystemClockAutomaticCorrectionUpdatedTime"}, - {154, nullptr, "GetAccountOnlineStorageSettings"}, - {155, nullptr, "SetAccountOnlineStorageSettings"}, - {156, nullptr, "GetPctlReadyFlag"}, - {157, nullptr, "SetPctlReadyFlag"}, - {158, nullptr, "GetAnalogStickUserCalibrationL"}, - {159, nullptr, "SetAnalogStickUserCalibrationL"}, - {160, nullptr, "GetAnalogStickUserCalibrationR"}, - {161, nullptr, "SetAnalogStickUserCalibrationR"}, - {162, nullptr, "GetPtmBatteryVersion"}, - {163, nullptr, "SetPtmBatteryVersion"}, - {164, nullptr, "GetUsb30HostEnableFlag"}, - {165, nullptr, "SetUsb30HostEnableFlag"}, - {166, nullptr, "GetUsb30DeviceEnableFlag"}, - {167, nullptr, "SetUsb30DeviceEnableFlag"}, - {168, nullptr, "GetThemeId"}, - {169, nullptr, "SetThemeId"}, - {170, C<&ISystemSettingsServer::GetChineseTraditionalInputMethod>, "GetChineseTraditionalInputMethod"}, - {171, nullptr, "SetChineseTraditionalInputMethod"}, - {172, nullptr, "GetPtmCycleCountReliability"}, - {173, nullptr, "SetPtmCycleCountReliability"}, - {174, C<&ISystemSettingsServer::GetHomeMenuScheme>, "GetHomeMenuScheme"}, - {175, nullptr, "GetThemeSettings"}, - {176, nullptr, "SetThemeSettings"}, - {177, nullptr, "GetThemeKey"}, - {178, nullptr, "SetThemeKey"}, - {179, nullptr, "GetZoomFlag"}, - {180, nullptr, "SetZoomFlag"}, - {181, nullptr, "GetT"}, - {182, nullptr, "SetT"}, - {183, C<&ISystemSettingsServer::GetPlatformRegion>, "GetPlatformRegion"}, - {184, C<&ISystemSettingsServer::SetPlatformRegion>, "SetPlatformRegion"}, - {185, C<&ISystemSettingsServer::GetHomeMenuSchemeModel>, "GetHomeMenuSchemeModel"}, - {186, nullptr, "GetMemoryUsageRateFlag"}, - {187, C<&ISystemSettingsServer::GetTouchScreenMode>, "GetTouchScreenMode"}, - {188, C<&ISystemSettingsServer::SetTouchScreenMode>, "SetTouchScreenMode"}, - {189, nullptr, "GetButtonConfigSettingsFull"}, - {190, nullptr, "SetButtonConfigSettingsFull"}, - {191, nullptr, "GetButtonConfigSettingsEmbedded"}, - {192, nullptr, "SetButtonConfigSettingsEmbedded"}, - {193, nullptr, "GetButtonConfigSettingsLeft"}, - {194, nullptr, "SetButtonConfigSettingsLeft"}, - {195, nullptr, "GetButtonConfigSettingsRight"}, - {196, nullptr, "SetButtonConfigSettingsRight"}, - {197, nullptr, "GetButtonConfigRegisteredSettingsEmbedded"}, - {198, nullptr, "SetButtonConfigRegisteredSettingsEmbedded"}, - {199, nullptr, "GetButtonConfigRegisteredSettings"}, - {200, nullptr, "SetButtonConfigRegisteredSettings"}, - {201, C<&ISystemSettingsServer::GetFieldTestingFlag>, "GetFieldTestingFlag"}, - {202, nullptr, "SetFieldTestingFlag"}, - {203, C<&ISystemSettingsServer::GetPanelCrcMode>, "GetPanelCrcMode"}, - {204, C<&ISystemSettingsServer::SetPanelCrcMode>, "SetPanelCrcMode"}, - {205, nullptr, "GetNxControllerSettingsEx"}, - {206, nullptr, "SetNxControllerSettingsEx"}, - {207, nullptr, "GetHearingProtectionSafeguardFlag"}, - {208, nullptr, "SetHearingProtectionSafeguardFlag"}, - {209, nullptr, "GetHearingProtectionSafeguardRemainingTime"}, - {210, nullptr, "SetHearingProtectionSafeguardRemainingTime"}, - {221, nullptr, "GetForceMonauralOutputFlag"}, //17.0.0+ - {222, nullptr, "SetForceMonauralOutputFlag"}, //17.0.0+ - {251, nullptr, "GetAccountIdentificationSettings"}, //18.0.0+ - {252, nullptr, "SetAccountIdentificationSettings"}, //18.0.0+ - {263, nullptr, "AcquireVphymDirtyFlagEventHandle"}, //20.0.0+ - {264, nullptr, "GetVphymDirtyFlags"}, //20.0.0+ - {282, nullptr, "ConvertToProductModel"}, //20.0.0+ - {283, nullptr, "ConvertToProductModelName"}, //20.0.0+ - {289, nullptr, "GetDefaultAccountIdentificationFlagSet"}, //20.0.0+ - {300, nullptr, "AcquirePushNotificationDirtyFlagEventHandle"}, //20.0.0+ - {301, nullptr, "GetPushNotificationDirtyFlags"}, //20.0.0+ - {306, nullptr, "GetPinCodeReregistrationGuideAccounts"}, //20.0.0+ - {307, nullptr, "SetPinCodeReregistrationGuideAccounts"}, //20.0.0+ - {315, C<&ISystemSettingsServer::GetHttpAuthConfigs>, "GetHttpAuthConfigs"}, //21.0.0+ - {319, C<&ISystemSettingsServer::GetAccountUserSettings>, "GetAccountUserSettings"}, //21.0.0+ - {320, nullptr, "SetAccountUserSettings"}, //21.0.0+ - {321, C<&ISystemSettingsServer::GetDefaultAccountUserSettings>, "GetDefaultAccountUserSettings"}, //21.0.0+ - }; - // clang-format on - - RegisterHandlers(functions); - + : ServiceFramework{system_, "set:sys"} { SetupSettings(); m_system_settings.region_code = diff --git a/src/core/hle/service/set/system_settings_server.h b/src/core/hle/service/set/system_settings_server.h index 1d56e61f88..471ed61176 100644 --- a/src/core/hle/service/set/system_settings_server.h +++ b/src/core/hle/service/set/system_settings_server.h @@ -179,7 +179,7 @@ private: void StoreSettings(); void SetSaveNeeded(); - Core::System& m_system; + std::optional FindRequest(u32 key) override; SystemSettings m_system_settings{}; PrivateSettings m_private_settings{}; DeviceSettings m_device_settings{}; diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp index c75c5437df..5c196b3218 100644 --- a/src/core/hle/service/sm/sm.cpp +++ b/src/core/hle/service/sm/sm.cpp @@ -18,7 +18,16 @@ #include "core/hle/service/ipc_helpers.h" #include "core/hle/service/server_manager.h" #include "core/hle/service/sm/sm.h" -#include "core/hle/service/sm/sm_controller.h" +#include "common/assert.h" +#include "common/logging.h" +#include "core/core.h" +#include "core/hle/kernel/k_client_port.h" +#include "core/hle/kernel/k_port.h" +#include "core/hle/kernel/k_scoped_resource_reservation.h" +#include "core/hle/kernel/k_server_session.h" +#include "core/hle/kernel/k_session.h" +#include "core/hle/service/ipc_helpers.h" +#include "core/hle/service/server_manager.h" namespace Service::SM { @@ -27,6 +36,116 @@ constexpr Result ResultAlreadyRegistered(ErrorModule::SM, 4); constexpr Result ResultInvalidServiceName(ErrorModule::SM, 6); constexpr Result ResultNotRegistered(ErrorModule::SM, 7); +class Controller final : public ServiceFramework { +public: + // https://switchbrew.org/wiki/IPC_Marshalling + explicit Controller(Core::System& system_) : ServiceFramework{system_, "IpcController"} {} + ~Controller() override = default; + + void ConvertCurrentObjectToDomain(HLERequestContext& ctx) { + ASSERT_MSG(!ctx.GetManager()->IsDomain(), "Session is already a domain"); + LOG_DEBUG(Service, "called, server_session={}", ctx.Session()->GetId()); + ctx.GetManager()->ConvertToDomainOnRequestEnd(); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(1); // Converted sessions start with 1 request handler + } + + void CloneCurrentObject(HLERequestContext& ctx) { + LOG_DEBUG(Service, "called"); + + auto session_manager = ctx.GetManager(); + + // FIXME: this is duplicated from the SVC, it should just call it instead + // once this is a proper process + + // Reserve a new session from the process resource limit. + Kernel::KScopedResourceReservation session_reservation(system.Kernel(), Kernel::GetCurrentProcessPointer(kernel), Kernel::LimitableResource::SessionCountMax); + ASSERT(session_reservation.Succeeded()); + + // Create the session. + Kernel::KSession* session = Kernel::KSession::Create(kernel); + ASSERT(session != nullptr); + + // Initialize the session. + session->Initialize(kernel, nullptr, 0); + + // Commit the session reservation. + session_reservation.Commit(); + + // Register the session. + Kernel::KSession::Register(kernel, session); + + // Register with server manager. + session_manager->GetServerManager().RegisterSession(&session->GetServerSession(), + session_manager); + + // We succeeded. + IPC::ResponseBuilder rb{ctx, 2, 0, 1, IPC::ResponseBuilder::Flags::AlwaysMoveHandles}; + rb.Push(ResultSuccess); + rb.PushMoveObjects(ctx, session->GetClientSession()); + } + + void CloneCurrentObjectEx(HLERequestContext& ctx) { + LOG_DEBUG(Service, "called"); + + CloneCurrentObject(ctx); + } + + void QueryPointerBufferSize(HLERequestContext& ctx) { + LOG_DEBUG(Service, "called"); + + auto* process = Kernel::GetCurrentProcessPointer(kernel); + ASSERT(process != nullptr); + + u32 buffer_size = process->GetPointerBufferSize(); + if (buffer_size > (std::numeric_limits::max)()) { + LOG_WARNING(Service, "Pointer buffer size exceeds u16 max, clamping"); + buffer_size = (std::numeric_limits::max)(); + } + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(static_cast(buffer_size)); + } + + void SetPointerBufferSize(HLERequestContext& ctx) { + LOG_DEBUG(Service, "called"); + + auto* process = Kernel::GetCurrentProcessPointer(kernel); + ASSERT(process != nullptr); + + IPC::RequestParser rp{ctx}; + + u32 requested_size = rp.PopRaw(); + + if (requested_size > (std::numeric_limits::max)()) { + LOG_WARNING(Service, "Requested pointer buffer size too large, clamping to 0xFFFF"); + requested_size = (std::numeric_limits::max)(); + } + + process->SetPointerBufferSize(requested_size); + + LOG_INFO(Service, "Pointer buffer size dynamically updated to {:#x} bytes by process", requested_size); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &Controller::ConvertCurrentObjectToDomain, "ConvertCurrentObjectToDomain"}, + FunctionInfo{1, nullptr, "CopyFromCurrentDomain"}, + FunctionInfo{2, &Controller::CloneCurrentObject, "CloneCurrentObject"}, + FunctionInfo{3, &Controller::QueryPointerBufferSize, "QueryPointerBufferSize"}, + FunctionInfo{4, &Controller::CloneCurrentObjectEx, "CloneCurrentObjectEx"}, + FunctionInfo{5, &Controller::SetPointerBufferSize, "SetPointerBufferSize"} //TODO: where does this come from + ); +}; + ServiceManager::ServiceManager(Kernel::KernelCore& kernel_) : kernel{kernel_} { controller_interface = std::make_unique(kernel.System()); } @@ -112,6 +231,51 @@ Result ServiceManager::GetServicePort(Kernel::KClientPort** out_client_port, return ResultSuccess; } +/// Interface to "sm:" service +class SM final : public ServiceFramework { +public: + explicit SM(ServiceManager& service_manager_, Core::System& system_); + ~SM() override; + +private: + void Initialize(HLERequestContext& ctx); + void GetServiceCmif(HLERequestContext& ctx); + void GetServiceTipc(HLERequestContext& ctx); + void RegisterServiceCmif(HLERequestContext& ctx); + void RegisterServiceTipc(HLERequestContext& ctx); + void UnregisterService(HLERequestContext& ctx); + void AtmosphereHasService(HLERequestContext& ctx); + + Result GetServiceImpl(Kernel::KClientSession** out_client_session, HLERequestContext& ctx); + void RegisterServiceImpl(HLERequestContext& ctx, std::string name, u32 max_session_count, bool is_light); + + // TODO: We reuse function list for both TIPC and non-TIPC + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + std::optional FindRequestTipc(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &SM::Initialize, "Initialize"}, + FunctionInfo{1, &SM::GetServiceTipc, "GetService"}, + FunctionInfo{2, &SM::RegisterServiceTipc, "RegisterService"}, + FunctionInfo{3, &SM::UnregisterService, "UnregisterService"}, + FunctionInfo{4, nullptr, "DetachClient"}, + FunctionInfo{65000, nullptr, "AtmosphereInstallMitm"}, + FunctionInfo{65001, nullptr, "AtmosphereUninstallMitm"}, + FunctionInfo{65002, nullptr, "Deprecated_AtmosphereAssociatePidTidForMitm"}, + FunctionInfo{65003, nullptr, "AtmosphereAcknowledgeMitmSession"}, + FunctionInfo{65004, nullptr, "AtmosphereHasMitm"}, + FunctionInfo{65005, nullptr, "AtmosphereWaitMitm"}, + FunctionInfo{65006, nullptr, "AtmosphereDeclareFutureMitm"}, + FunctionInfo{65100, &SM::AtmosphereHasService, "AtmosphereHasService"}, + FunctionInfo{65101, nullptr, "AtmosphereWaitService"} + ); + + ServiceManager& service_manager; +}; + /** * SM::Initialize service function * Inputs: @@ -194,7 +358,7 @@ Result SM::GetServiceImpl(Kernel::KClientSession** out_client_session, HLEReques // Create a new session. Kernel::KClientSession* session{}; - if (const auto result = client_port->CreateSession(kernel, &session); result.IsError()) { + if (const auto result = client_port->CreateSession(system.Kernel(), &session); result.IsError()) { LOG_ERROR(Service_SM, "called service={} -> error {:#08x}", name, result.raw); return result; } @@ -265,42 +429,7 @@ void SM::AtmosphereHasService(HLERequestContext& ctx) { SM::SM(ServiceManager& service_manager_, Core::System& system_) : ServiceFramework{system_, "sm:", 64} , service_manager{service_manager_} - , kernel{system_.Kernel()} -{ - RegisterHandlers({ - {0, &SM::Initialize, "Initialize"}, - {1, &SM::GetServiceCmif, "GetService"}, - {2, &SM::RegisterServiceCmif, "RegisterService"}, - {3, &SM::UnregisterService, "UnregisterService"}, - {4, nullptr, "DetachClient"}, - // TODO: are these non-TIPC as well? - {65000, nullptr, "AtmosphereInstallMitm"}, - {65001, nullptr, "AtmosphereUninstallMitm"}, - {65002, nullptr, "Deprecated_AtmosphereAssociatePidTidForMitm"}, - {65003, nullptr, "AtmosphereAcknowledgeMitmSession"}, - {65004, nullptr, "AtmosphereHasMitm"}, - {65005, nullptr, "AtmosphereWaitMitm"}, - {65006, nullptr, "AtmosphereDeclareFutureMitm"}, - {65100, &SM::AtmosphereHasService, "AtmosphereHasService"}, - {65101, nullptr, "AtmosphereWaitService"}, - }); - RegisterHandlersTipc({ - {0, &SM::Initialize, "Initialize"}, - {1, &SM::GetServiceTipc, "GetService"}, - {2, &SM::RegisterServiceTipc, "RegisterService"}, - {3, &SM::UnregisterService, "UnregisterService"}, - {4, nullptr, "DetachClient"}, - {65000, nullptr, "AtmosphereInstallMitm"}, - {65001, nullptr, "AtmosphereUninstallMitm"}, - {65002, nullptr, "Deprecated_AtmosphereAssociatePidTidForMitm"}, - {65003, nullptr, "AtmosphereAcknowledgeMitmSession"}, - {65004, nullptr, "AtmosphereHasMitm"}, - {65005, nullptr, "AtmosphereWaitMitm"}, - {65006, nullptr, "AtmosphereDeclareFutureMitm"}, - {65100, &SM::AtmosphereHasService, "AtmosphereHasService"}, - {65101, nullptr, "AtmosphereWaitService"}, - }); -} +{} SM::~SM() = default; diff --git a/src/core/hle/service/sm/sm.h b/src/core/hle/service/sm/sm.h index c520a46fb2..f17fc60080 100644 --- a/src/core/hle/service/sm/sm.h +++ b/src/core/hle/service/sm/sm.h @@ -33,29 +33,7 @@ class SessionRequestHandler; namespace Service::SM { class Controller; - -/// Interface to "sm:" service -class SM final : public ServiceFramework { -public: - explicit SM(ServiceManager& service_manager_, Core::System& system_); - ~SM() override; - -private: - void Initialize(HLERequestContext& ctx); - void GetServiceCmif(HLERequestContext& ctx); - void GetServiceTipc(HLERequestContext& ctx); - void RegisterServiceCmif(HLERequestContext& ctx); - void RegisterServiceTipc(HLERequestContext& ctx); - void UnregisterService(HLERequestContext& ctx); - void AtmosphereHasService(HLERequestContext& ctx); - - Result GetServiceImpl(Kernel::KClientSession** out_client_session, HLERequestContext& ctx); - void RegisterServiceImpl(HLERequestContext& ctx, std::string name, u32 max_session_count, - bool is_light); - - ServiceManager& service_manager; - Kernel::KernelCore& kernel; -}; +class SM; class ServiceManager { public: diff --git a/src/core/hle/service/sm/sm_controller.cpp b/src/core/hle/service/sm/sm_controller.cpp deleted file mode 100644 index 125eb4a247..0000000000 --- a/src/core/hle/service/sm/sm_controller.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "common/assert.h" -#include "common/logging.h" -#include "core/core.h" -#include "core/hle/kernel/k_client_port.h" -#include "core/hle/kernel/k_port.h" -#include "core/hle/kernel/k_scoped_resource_reservation.h" -#include "core/hle/kernel/k_server_session.h" -#include "core/hle/kernel/k_session.h" -#include "core/hle/service/ipc_helpers.h" -#include "core/hle/service/server_manager.h" -#include "core/hle/service/sm/sm_controller.h" - -namespace Service::SM { - -void Controller::ConvertCurrentObjectToDomain(HLERequestContext& ctx) { - ASSERT_MSG(!ctx.GetManager()->IsDomain(), "Session is already a domain"); - LOG_DEBUG(Service, "called, server_session={}", ctx.Session()->GetId()); - ctx.GetManager()->ConvertToDomainOnRequestEnd(); - - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(ResultSuccess); - rb.Push(1); // Converted sessions start with 1 request handler -} - -void Controller::CloneCurrentObject(HLERequestContext& ctx) { - LOG_DEBUG(Service, "called"); - - auto session_manager = ctx.GetManager(); - - // FIXME: this is duplicated from the SVC, it should just call it instead - // once this is a proper process - - // Reserve a new session from the process resource limit. - Kernel::KScopedResourceReservation session_reservation(system.Kernel(), Kernel::GetCurrentProcessPointer(kernel), Kernel::LimitableResource::SessionCountMax); - ASSERT(session_reservation.Succeeded()); - - // Create the session. - Kernel::KSession* session = Kernel::KSession::Create(kernel); - ASSERT(session != nullptr); - - // Initialize the session. - session->Initialize(kernel, nullptr, 0); - - // Commit the session reservation. - session_reservation.Commit(); - - // Register the session. - Kernel::KSession::Register(kernel, session); - - // Register with server manager. - session_manager->GetServerManager().RegisterSession(&session->GetServerSession(), - session_manager); - - // We succeeded. - IPC::ResponseBuilder rb{ctx, 2, 0, 1, IPC::ResponseBuilder::Flags::AlwaysMoveHandles}; - rb.Push(ResultSuccess); - rb.PushMoveObjects(ctx, session->GetClientSession()); -} - -void Controller::CloneCurrentObjectEx(HLERequestContext& ctx) { - LOG_DEBUG(Service, "called"); - - CloneCurrentObject(ctx); -} - -void Controller::QueryPointerBufferSize(HLERequestContext& ctx) { - LOG_DEBUG(Service, "called"); - - auto* process = Kernel::GetCurrentProcessPointer(kernel); - ASSERT(process != nullptr); - - u32 buffer_size = process->GetPointerBufferSize(); - if (buffer_size > (std::numeric_limits::max)()) { - LOG_WARNING(Service, "Pointer buffer size exceeds u16 max, clamping"); - buffer_size = (std::numeric_limits::max)(); - } - - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(ResultSuccess); - rb.Push(static_cast(buffer_size)); -} - -void Controller::SetPointerBufferSize(HLERequestContext& ctx) { - LOG_DEBUG(Service, "called"); - - auto* process = Kernel::GetCurrentProcessPointer(kernel); - ASSERT(process != nullptr); - - IPC::RequestParser rp{ctx}; - - u32 requested_size = rp.PopRaw(); - - if (requested_size > (std::numeric_limits::max)()) { - LOG_WARNING(Service, "Requested pointer buffer size too large, clamping to 0xFFFF"); - requested_size = (std::numeric_limits::max)(); - } - - process->SetPointerBufferSize(requested_size); - - LOG_INFO(Service, "Pointer buffer size dynamically updated to {:#x} bytes by process", requested_size); - - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); -} - - -// https://switchbrew.org/wiki/IPC_Marshalling -Controller::Controller(Core::System& system_) : ServiceFramework{system_, "IpcController"} { - static const FunctionInfo functions[] = { - {0, &Controller::ConvertCurrentObjectToDomain, "ConvertCurrentObjectToDomain"}, - {1, nullptr, "CopyFromCurrentDomain"}, - {2, &Controller::CloneCurrentObject, "CloneCurrentObject"}, - {3, &Controller::QueryPointerBufferSize, "QueryPointerBufferSize"}, - {4, &Controller::CloneCurrentObjectEx, "CloneCurrentObjectEx"}, - {5, &Controller::SetPointerBufferSize, "SetPointerBufferSize"}, //TODO: where does this come from - }; - RegisterHandlers(functions); -} - -Controller::~Controller() = default; - -} // namespace Service::SM diff --git a/src/core/hle/service/sm/sm_controller.h b/src/core/hle/service/sm/sm_controller.h deleted file mode 100644 index f7e529a269..0000000000 --- a/src/core/hle/service/sm/sm_controller.h +++ /dev/null @@ -1,27 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/service.h" - -namespace Core { -class System; -} - -namespace Service::SM { - -class Controller final : public ServiceFramework { -public: - explicit Controller(Core::System& system_); - ~Controller() override; - -private: - void ConvertCurrentObjectToDomain(HLERequestContext& ctx); - void CloneCurrentObject(HLERequestContext& ctx); - void CloneCurrentObjectEx(HLERequestContext& ctx); - void QueryPointerBufferSize(HLERequestContext& ctx); - void SetPointerBufferSize(HLERequestContext& ctx); -}; - -} // namespace Service::SM diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cpp index 0137a3be66..63bd7051ca 100644 --- a/src/core/hle/service/sockets/bsd.cpp +++ b/src/core/hle/service/sockets/bsd.cpp @@ -1083,59 +1083,6 @@ void BSD_USA::OnProxyPacketReceived(const Network::ProxyPacket& packet) { BSD_USA::BSD_USA(Core::System& system_, const char* name, bool is_user_) : ServiceFramework{system_, name} , is_user{is_user_} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &BSD_USA::RegisterClient, "RegisterClient"}, - {1, &BSD_USA::StartMonitoring, "StartMonitoring"}, - {2, &BSD_USA::Socket, "Socket"}, - {3, &BSD_USA::SocketExempt, "SocketExempt"}, - {4, nullptr, "Open"}, - {5, &BSD_USA::Select, "Select"}, - {6, &BSD_USA::Poll, "Poll"}, - {7, nullptr, "Sysctl"}, - {8, &BSD_USA::Recv, "Recv"}, - {9, &BSD_USA::RecvFrom, "RecvFrom"}, - {10, &BSD_USA::Send, "Send"}, - {11, &BSD_USA::SendTo, "SendTo"}, - {12, &BSD_USA::Accept, "Accept"}, - {13, &BSD_USA::Bind, "Bind"}, - {14, &BSD_USA::Connect, "Connect"}, - {15, &BSD_USA::GetPeerName, "GetPeerName"}, - {16, &BSD_USA::GetSockName, "GetSockName"}, - {17, &BSD_USA::GetSockOpt, "GetSockOpt"}, - {18, &BSD_USA::Listen, "Listen"}, - {19, nullptr, "Ioctl"}, - {20, &BSD_USA::Fcntl, "Fcntl"}, - {21, &BSD_USA::SetSockOpt, "SetSockOpt"}, - {22, &BSD_USA::Shutdown, "Shutdown"}, - {23, nullptr, "ShutdownAllSockets"}, - {24, &BSD_USA::Write, "Write"}, - {25, &BSD_USA::Read, "Read"}, - {26, &BSD_USA::Close, "Close"}, - {27, &BSD_USA::DuplicateSocket, "DuplicateSocket"}, - {28, nullptr, "GetResourceStatistics"}, - {29, nullptr, "RecvMMsg"}, //3.0.0+ - {30, nullptr, "SendMMsg"}, //3.0.0+ - {31, &BSD_USA::EventFd, "EventFd"}, //7.0.0+ - {32, nullptr, "RegisterResourceStatisticsName"}, //7.0.0+ - {33, nullptr, "RegisterClientShared"}, //10.0.0+ - {34, nullptr, "GetSocketStatistics"}, //15.0.0+ - {35, nullptr, "NifIoctl"}, //17.0.0+ - {36, nullptr, "Unknown36"}, //18.0.0+ - {37, nullptr, "Unknown37"}, //18.0.0+ - {38, nullptr, "Unknown38"}, //18.0.0+ - {39, nullptr, "Unknown39"}, //20.0.0+ - {40, nullptr, "Unknown40"}, //20.0.0+ - {41, nullptr, "Unknown41"}, //21.0.0+ - {42, nullptr, "Unknown42"}, //21.0.0+ - {43, nullptr, "Unknown43"}, //21.0.0+ - {200, nullptr, "SetThreadCoreMask"}, //15.0.0+ - {201, nullptr, "GetThreadCoreMask"}, //15.0.0+ - }; - // clang-format on - - RegisterHandlers(functions); - if (auto room_member = Network::GetRoomMember().lock()) { proxy_packet_received = room_member->BindOnProxyPacketReceived( [this](const Network::ProxyPacket& packet) { OnProxyPacketReceived(packet); }); @@ -1156,40 +1103,12 @@ std::unique_lock BSD_USA::LockService() noexcept { BSDCFG::BSDCFG(Core::System& system_, const char *name) : ServiceFramework{system_, name} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "SetIfUp"}, - {1, nullptr, "SetIfUpWithEvent"}, - {2, nullptr, "CancelIf"}, - {3, nullptr, "SetIfDown"}, - {4, nullptr, "GetIfState"}, - {5, nullptr, "DhcpRenew"}, - {6, nullptr, "AddStaticArpEntry"}, - {7, nullptr, "RemoveArpEntry"}, - {8, nullptr, "LookupArpEntry"}, - {9, nullptr, "LookupArpEntry2"}, - {10, nullptr, "ClearArpEntries"}, - {11, nullptr, "ClearArpEntries2"}, - {12, nullptr, "PrintArpEntries"}, - {13, nullptr, "Unknown13"}, - {14, nullptr, "Unknown14"}, - {15, nullptr, "Unknown15"}, - }; - // clang-format on - - RegisterHandlers(functions); } BSDCFG::~BSDCFG() = default; BSD_NU::BSD_NU(Core::System& system_) : ServiceFramework{system_, "bsd:nu"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "CreateUserService"}, - }; - // clang-format on - RegisterHandlers(functions); } BSD_NU::~BSD_NU() = default; diff --git a/src/core/hle/service/sockets/bsd.h b/src/core/hle/service/sockets/bsd.h index b542e196f0..c2aa343d51 100644 --- a/src/core/hle/service/sockets/bsd.h +++ b/src/core/hle/service/sockets/bsd.h @@ -189,6 +189,58 @@ private: protected: std::unique_lock LockService() noexcept override; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &BSD_USA::RegisterClient, "RegisterClient"}, + FunctionInfo{1, &BSD_USA::StartMonitoring, "StartMonitoring"}, + FunctionInfo{2, &BSD_USA::Socket, "Socket"}, + FunctionInfo{3, &BSD_USA::SocketExempt, "SocketExempt"}, + FunctionInfo{4, nullptr, "Open"}, + FunctionInfo{5, &BSD_USA::Select, "Select"}, + FunctionInfo{6, &BSD_USA::Poll, "Poll"}, + FunctionInfo{7, nullptr, "Sysctl"}, + FunctionInfo{8, &BSD_USA::Recv, "Recv"}, + FunctionInfo{9, &BSD_USA::RecvFrom, "RecvFrom"}, + FunctionInfo{10, &BSD_USA::Send, "Send"}, + FunctionInfo{11, &BSD_USA::SendTo, "SendTo"}, + FunctionInfo{12, &BSD_USA::Accept, "Accept"}, + FunctionInfo{13, &BSD_USA::Bind, "Bind"}, + FunctionInfo{14, &BSD_USA::Connect, "Connect"}, + FunctionInfo{15, &BSD_USA::GetPeerName, "GetPeerName"}, + FunctionInfo{16, &BSD_USA::GetSockName, "GetSockName"}, + FunctionInfo{17, &BSD_USA::GetSockOpt, "GetSockOpt"}, + FunctionInfo{18, &BSD_USA::Listen, "Listen"}, + FunctionInfo{19, nullptr, "Ioctl"}, + FunctionInfo{20, &BSD_USA::Fcntl, "Fcntl"}, + FunctionInfo{21, &BSD_USA::SetSockOpt, "SetSockOpt"}, + FunctionInfo{22, &BSD_USA::Shutdown, "Shutdown"}, + FunctionInfo{23, nullptr, "ShutdownAllSockets"}, + FunctionInfo{24, &BSD_USA::Write, "Write"}, + FunctionInfo{25, &BSD_USA::Read, "Read"}, + FunctionInfo{26, &BSD_USA::Close, "Close"}, + FunctionInfo{27, &BSD_USA::DuplicateSocket, "DuplicateSocket"}, + FunctionInfo{28, nullptr, "GetResourceStatistics"}, + FunctionInfo{29, nullptr, "RecvMMsg", MakeVersionGate({3,0,0})}, + FunctionInfo{30, nullptr, "SendMMsg", MakeVersionGate({3,0,0})}, + FunctionInfo{31, &BSD_USA::EventFd, "EventFd", MakeVersionGate({7,0,0})}, + FunctionInfo{32, nullptr, "RegisterResourceStatisticsName", MakeVersionGate({7,0,0})}, + FunctionInfo{33, nullptr, "RegisterClientShared", MakeVersionGate({10,0,0})}, + FunctionInfo{34, nullptr, "GetSocketStatistics", MakeVersionGate({15,0,0})}, + FunctionInfo{35, nullptr, "NifIoctl", MakeVersionGate({17,0,0})}, + FunctionInfo{36, nullptr, "Unknown36", MakeVersionGate({18,0,0})}, + FunctionInfo{37, nullptr, "Unknown37", MakeVersionGate({18,0,0})}, + FunctionInfo{38, nullptr, "Unknown38", MakeVersionGate({18,0,0})}, + FunctionInfo{39, nullptr, "Unknown39", MakeVersionGate({20,0,0})}, + FunctionInfo{40, nullptr, "Unknown40", MakeVersionGate({20,0,0})}, + FunctionInfo{41, nullptr, "Unknown41", MakeVersionGate({21,0,0})}, + FunctionInfo{42, nullptr, "Unknown42", MakeVersionGate({21,0,0})}, + FunctionInfo{43, nullptr, "Unknown43", MakeVersionGate({21,0,0})}, + FunctionInfo{200, nullptr, "SetThreadCoreMask", MakeVersionGate({15,0,0})}, + FunctionInfo{201, nullptr, "GetThreadCoreMask", MakeVersionGate({15,0,0})} + ); bool is_user = false; }; @@ -196,12 +248,41 @@ class BSDCFG final : public ServiceFramework { public: explicit BSDCFG(Core::System& system_, const char *name); ~BSDCFG() override; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "SetIfUp"}, + FunctionInfo{1, nullptr, "SetIfUpWithEvent"}, + FunctionInfo{2, nullptr, "CancelIf"}, + FunctionInfo{3, nullptr, "SetIfDown"}, + FunctionInfo{4, nullptr, "GetIfState"}, + FunctionInfo{5, nullptr, "DhcpRenew"}, + FunctionInfo{6, nullptr, "AddStaticArpEntry"}, + FunctionInfo{7, nullptr, "RemoveArpEntry"}, + FunctionInfo{8, nullptr, "LookupArpEntry"}, + FunctionInfo{9, nullptr, "LookupArpEntry2"}, + FunctionInfo{10, nullptr, "ClearArpEntries"}, + FunctionInfo{11, nullptr, "ClearArpEntries2"}, + FunctionInfo{12, nullptr, "PrintArpEntries"}, + FunctionInfo{13, nullptr, "Unknown13"}, + FunctionInfo{14, nullptr, "Unknown14"}, + FunctionInfo{15, nullptr, "Unknown15"} + ); }; class BSD_NU final : public ServiceFramework { public: explicit BSD_NU(Core::System& system_); ~BSD_NU() override; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "CreateUserService"} + ); }; } // namespace Service::Sockets diff --git a/src/core/hle/service/sockets/nsd.cpp b/src/core/hle/service/sockets/nsd.cpp index 241f2971ca..8f042aee75 100644 --- a/src/core/hle/service/sockets/nsd.cpp +++ b/src/core/hle/service/sockets/nsd.cpp @@ -29,38 +29,6 @@ struct EnvironmentIdentifier { static_assert(sizeof(EnvironmentIdentifier) == 0x8); NSD::NSD(Core::System& system_, const char* name) : ServiceFramework{system_, name} { - // clang-format off - static const FunctionInfo functions[] = { - {5, nullptr, "GetSettingUrl"}, - {10, nullptr, "GetSettingName"}, - {11, &NSD::GetEnvironmentIdentifier, "GetEnvironmentIdentifier"}, - {12, nullptr, "GetDeviceId"}, - {13, nullptr, "DeleteSettings"}, - {14, nullptr, "ImportSettings"}, - {15, &NSD::SetChangeEnvironmentIdentifierDisabled, "SetChangeEnvironmentIdentifierDisabled"}, - {20, &NSD::Resolve, "Resolve"}, - {21, &NSD::ResolveEx, "ResolveEx"}, - {30, nullptr, "GetNasServiceSetting"}, - {31, nullptr, "GetNasServiceSettingEx"}, - {40, nullptr, "GetNasRequestFqdn"}, - {41, nullptr, "GetNasRequestFqdnEx"}, - {42, nullptr, "GetNasApiFqdn"}, - {43, nullptr, "GetNasApiFqdnEx"}, - {50, nullptr, "GetCurrentSetting"}, - {51, nullptr, "WriteTestParameter"}, - {52, nullptr, "ReadTestParameter"}, - {60, nullptr, "ReadSaveDataFromFsForTest"}, - {61, nullptr, "WriteSaveDataToFsForTest"}, - {62, nullptr, "DeleteSaveDataOfFsForTest"}, - {63, nullptr, "IsChangeEnvironmentIdentifierDisabled"}, - {64, nullptr, "SetWithoutDomainExchangeFqdns"}, - {100, &NSD::GetApplicationServerEnvironmentType, "GetApplicationServerEnvironmentType"}, - {101, nullptr, "SetApplicationServerEnvironmentType"}, - {102, nullptr, "DeleteApplicationServerEnvironmentType"}, - }; - // clang-format on - - RegisterHandlers(functions); } static std::string ResolveImpl(const std::string& fqdn_in) { diff --git a/src/core/hle/service/sockets/nsd.h b/src/core/hle/service/sockets/nsd.h index e4a4588467..f3e4d48aff 100644 --- a/src/core/hle/service/sockets/nsd.h +++ b/src/core/hle/service/sockets/nsd.h @@ -25,6 +25,38 @@ private: void ResolveEx(HLERequestContext& ctx); void GetEnvironmentIdentifier(HLERequestContext& ctx); void GetApplicationServerEnvironmentType(HLERequestContext& ctx); + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{5, nullptr, "GetSettingUrl"}, + FunctionInfo{10, nullptr, "GetSettingName"}, + FunctionInfo{11, &NSD::GetEnvironmentIdentifier, "GetEnvironmentIdentifier"}, + FunctionInfo{12, nullptr, "GetDeviceId"}, + FunctionInfo{13, nullptr, "DeleteSettings"}, + FunctionInfo{14, nullptr, "ImportSettings"}, + FunctionInfo{15, &NSD::SetChangeEnvironmentIdentifierDisabled, "SetChangeEnvironmentIdentifierDisabled"}, + FunctionInfo{20, &NSD::Resolve, "Resolve"}, + FunctionInfo{21, &NSD::ResolveEx, "ResolveEx"}, + FunctionInfo{30, nullptr, "GetNasServiceSetting"}, + FunctionInfo{31, nullptr, "GetNasServiceSettingEx"}, + FunctionInfo{40, nullptr, "GetNasRequestFqdn"}, + FunctionInfo{41, nullptr, "GetNasRequestFqdnEx"}, + FunctionInfo{42, nullptr, "GetNasApiFqdn"}, + FunctionInfo{43, nullptr, "GetNasApiFqdnEx"}, + FunctionInfo{50, nullptr, "GetCurrentSetting"}, + FunctionInfo{51, nullptr, "WriteTestParameter"}, + FunctionInfo{52, nullptr, "ReadTestParameter"}, + FunctionInfo{60, nullptr, "ReadSaveDataFromFsForTest"}, + FunctionInfo{61, nullptr, "WriteSaveDataToFsForTest"}, + FunctionInfo{62, nullptr, "DeleteSaveDataOfFsForTest"}, + FunctionInfo{63, nullptr, "IsChangeEnvironmentIdentifierDisabled"}, + FunctionInfo{64, nullptr, "SetWithoutDomainExchangeFqdns"}, + FunctionInfo{100, &NSD::GetApplicationServerEnvironmentType, "GetApplicationServerEnvironmentType"}, + FunctionInfo{101, nullptr, "SetApplicationServerEnvironmentType"}, + FunctionInfo{102, nullptr, "DeleteApplicationServerEnvironmentType"} + ); }; } // namespace Service::Sockets diff --git a/src/core/hle/service/sockets/sfdnsres.cpp b/src/core/hle/service/sockets/sfdnsres.cpp index 93c01bf786..c89705356e 100644 --- a/src/core/hle/service/sockets/sfdnsres.cpp +++ b/src/core/hle/service/sockets/sfdnsres.cpp @@ -21,25 +21,6 @@ namespace Service::Sockets { SFDNSRES::SFDNSRES(Core::System& system_) : ServiceFramework{system_, "sfdnsres"} { - static const FunctionInfo functions[] = { - {0, nullptr, "SetDnsAddressesPrivateRequest"}, - {1, nullptr, "GetDnsAddressPrivateRequest"}, - {2, &SFDNSRES::GetHostByNameRequest, "GetHostByNameRequest"}, - {3, nullptr, "GetHostByAddrRequest"}, - {4, nullptr, "GetHostStringErrorRequest"}, - {5, &SFDNSRES::GetGaiStringErrorRequest, "GetGaiStringErrorRequest"}, - {6, &SFDNSRES::GetAddrInfoRequest, "GetAddrInfoRequest"}, - {7, nullptr, "GetNameInfoRequest"}, - {8, nullptr, "RequestCancelHandleRequest"}, - {9, nullptr, "CancelRequest"}, - {10, &SFDNSRES::GetHostByNameRequestWithOptions, "GetHostByNameRequestWithOptions"}, - {11, nullptr, "GetHostByAddrRequestWithOptions"}, - {12, &SFDNSRES::GetAddrInfoRequestWithOptions, "GetAddrInfoRequestWithOptions"}, - {13, nullptr, "GetNameInfoRequestWithOptions"}, - {14, &SFDNSRES::ResolverSetOptionRequest, "ResolverSetOptionRequest"}, - {15, nullptr, "ResolverGetOptionRequest"}, - }; - RegisterHandlers(functions); } SFDNSRES::~SFDNSRES() = default; @@ -410,14 +391,6 @@ void SFDNSRES::ResolverSetOptionRequest(HLERequestContext& ctx) { DNS_PRIV::DNS_PRIV(Core::System& system_) : ServiceFramework{system_, "dns:priv"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "Cmd0"}, - {1, nullptr, "Cmd1"}, - {2, nullptr, "Cmd2"}, - }; - // clang-format on - RegisterHandlers(functions); } DNS_PRIV::~DNS_PRIV() = default; diff --git a/src/core/hle/service/sockets/sfdnsres.h b/src/core/hle/service/sockets/sfdnsres.h index 4302edc43e..b365d03b2d 100644 --- a/src/core/hle/service/sockets/sfdnsres.h +++ b/src/core/hle/service/sockets/sfdnsres.h @@ -26,12 +26,43 @@ private: void GetAddrInfoRequest(HLERequestContext& ctx); void GetAddrInfoRequestWithOptions(HLERequestContext& ctx); void ResolverSetOptionRequest(HLERequestContext& ctx); + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "SetDnsAddressesPrivateRequest"}, + FunctionInfo{1, nullptr, "GetDnsAddressPrivateRequest"}, + FunctionInfo{2, &SFDNSRES::GetHostByNameRequest, "GetHostByNameRequest"}, + FunctionInfo{3, nullptr, "GetHostByAddrRequest"}, + FunctionInfo{4, nullptr, "GetHostStringErrorRequest"}, + FunctionInfo{5, &SFDNSRES::GetGaiStringErrorRequest, "GetGaiStringErrorRequest"}, + FunctionInfo{6, &SFDNSRES::GetAddrInfoRequest, "GetAddrInfoRequest"}, + FunctionInfo{7, nullptr, "GetNameInfoRequest"}, + FunctionInfo{8, nullptr, "RequestCancelHandleRequest"}, + FunctionInfo{9, nullptr, "CancelRequest"}, + FunctionInfo{10, &SFDNSRES::GetHostByNameRequestWithOptions, "GetHostByNameRequestWithOptions"}, + FunctionInfo{11, nullptr, "GetHostByAddrRequestWithOptions"}, + FunctionInfo{12, &SFDNSRES::GetAddrInfoRequestWithOptions, "GetAddrInfoRequestWithOptions"}, + FunctionInfo{13, nullptr, "GetNameInfoRequestWithOptions"}, + FunctionInfo{14, &SFDNSRES::ResolverSetOptionRequest, "ResolverSetOptionRequest"}, + FunctionInfo{15, nullptr, "ResolverGetOptionRequest"} + ); }; class DNS_PRIV final : public ServiceFramework { public: explicit DNS_PRIV(Core::System& system_); ~DNS_PRIV() override; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "Cmd0"}, + FunctionInfo{1, nullptr, "Cmd1"}, + FunctionInfo{2, nullptr, "Cmd2"} + ); }; } // namespace Service::Sockets diff --git a/src/core/hle/service/sockets/sockets.cpp b/src/core/hle/service/sockets/sockets.cpp index e96d7c5638..1c723e96a6 100644 --- a/src/core/hle/service/sockets/sockets.cpp +++ b/src/core/hle/service/sockets/sockets.cpp @@ -15,49 +15,49 @@ namespace Service::Sockets { class ETHC_C final : public ServiceFramework { public: explicit ETHC_C(Core::System& system_) - : ServiceFramework{system_, "ethc:c"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "Initialize"}, - {1, nullptr, "Cancel"}, - {2, nullptr, "GetResult"}, - {3, nullptr, "GetMediaList"}, - {4, nullptr, "SetMediaType"}, - {5, nullptr, "GetMediaType"}, - {6, nullptr, "GetMacAddress"}, - }; - // clang-format on - RegisterHandlers(functions); + : ServiceFramework{system_, "ethc:c"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "Initialize"}, + FunctionInfo{1, nullptr, "Cancel"}, + FunctionInfo{2, nullptr, "GetResult"}, + FunctionInfo{3, nullptr, "GetMediaList"}, + FunctionInfo{4, nullptr, "SetMediaType"}, + FunctionInfo{5, nullptr, "GetMediaType"}, + FunctionInfo{6, nullptr, "GetMacAddress"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class ETHC_I final : public ServiceFramework { public: explicit ETHC_I(Core::System& system_) - : ServiceFramework{system_, "ethc:i"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetReadableHandle"}, - {1, nullptr, "Cancel"}, - {2, nullptr, "GetResult"}, - {3, nullptr, "GetInterfaceList"}, - {4, nullptr, "GetInterfaceCount"}, - }; - // clang-format on - RegisterHandlers(functions); + : ServiceFramework{system_, "ethc:i"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetReadableHandle"}, + FunctionInfo{1, nullptr, "Cancel"}, + FunctionInfo{2, nullptr, "GetResult"}, + FunctionInfo{3, nullptr, "GetInterfaceList"}, + FunctionInfo{4, nullptr, "GetInterfaceCount"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class ISfDriverServiceCreator final : public ServiceFramework { public: explicit ISfDriverServiceCreator(Core::System& system_) - : ServiceFramework{system_, "eth:nd"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "CreateDriverService"}, - }; - // clang-format on - RegisterHandlers(functions); + : ServiceFramework{system_, "eth:nd"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "CreateDriverService"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; diff --git a/src/core/hle/service/spl/spl.cpp b/src/core/hle/service/spl/spl.cpp index 81be99c360..ad0251fac5 100644 --- a/src/core/hle/service/spl/spl.cpp +++ b/src/core/hle/service/spl/spl.cpp @@ -8,181 +8,22 @@ namespace Service::SPL { -SPL::SPL(Core::System& system_, std::shared_ptr module_) - : Interface(system_, std::move(module_), "spl:") { - // clang-format off - static const FunctionInfo functions[] = { - {0, &SPL::GetConfig, "GetConfig"}, - {1, &SPL::ModularExponentiate, "ModularExponentiate"}, - {5, &SPL::SetConfig, "SetConfig"}, - {7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"}, - {11, &SPL::IsDevelopment, "IsDevelopment"}, - {24, &SPL::SetBootReason, "SetBootReason"}, - {25, &SPL::GetBootReason, "GetBootReason"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - +SPL::SPL(Core::System& system_, std::shared_ptr module_) : Interface(system_, std::move(module_), "spl:") {} SPL::~SPL() = default; -SPL_MIG::SPL_MIG(Core::System& system_, std::shared_ptr module_) - : Interface(system_, std::move(module_), "spl:mig") { - // clang-format off - static const FunctionInfo functions[] = { - {0, &SPL::GetConfig, "GetConfig"}, - {1, &SPL::ModularExponentiate, "ModularExponentiate"}, - {2, &SPL::GenerateAesKek, "GenerateAesKek"}, - {3, nullptr, "LoadAesKey"}, - {4, &SPL::GenerateAesKey, "GenerateAesKey"}, - {5, &SPL::SetConfig, "SetConfig"}, - {7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"}, - {11, &SPL::IsDevelopment, "IsDevelopment"}, - {14, nullptr, "DecryptAesKey"}, - {15, nullptr, "CryptAesCtr"}, - {16, nullptr, "ComputeCmac"}, - {21, nullptr, "AllocateAesKeyslot"}, - {22, nullptr, "DeallocateAesKeySlot"}, - {23, nullptr, "GetAesKeyslotAvailableEvent"}, - {24, &SPL::SetBootReason, "SetBootReason"}, - {25, &SPL::GetBootReason, "GetBootReason"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - +SPL_MIG::SPL_MIG(Core::System& system_, std::shared_ptr module_) : Interface(system_, std::move(module_), "spl:mig") {} SPL_MIG::~SPL_MIG() = default; -SPL_FS::SPL_FS(Core::System& system_, std::shared_ptr module_) - : Interface(system_, std::move(module_), "spl:fs") { - // clang-format off - static const FunctionInfo functions[] = { - {0, &SPL::GetConfig, "GetConfig"}, - {1, &SPL::ModularExponentiate, "ModularExponentiate"}, - {2, nullptr, "GenerateAesKek"}, - {3, nullptr, "LoadAesKey"}, - {4, nullptr, "GenerateAesKey"}, - {5, &SPL::SetConfig, "SetConfig"}, - {7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"}, - {9, nullptr, "ImportLotusKey"}, - {10, nullptr, "DecryptLotusMessage"}, - {11, &SPL::IsDevelopment, "IsDevelopment"}, - {12, nullptr, "GenerateSpecificAesKey"}, - {14, nullptr, "DecryptAesKey"}, - {15, nullptr, "CryptAesCtr"}, - {16, nullptr, "ComputeCmac"}, - {19, nullptr, "LoadTitleKey"}, - {21, nullptr, "AllocateAesKeyslot"}, - {22, nullptr, "DeallocateAesKeySlot"}, - {23, nullptr, "GetAesKeyslotAvailableEvent"}, - {24, &SPL::SetBootReason, "SetBootReason"}, - {25, &SPL::GetBootReason, "GetBootReason"}, - {31, nullptr, "GetPackage2Hash"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - +SPL_FS::SPL_FS(Core::System& system_, std::shared_ptr module_) : Interface(system_, std::move(module_), "spl:fs") {} SPL_FS::~SPL_FS() = default; -SPL_SSL::SPL_SSL(Core::System& system_, std::shared_ptr module_) - : Interface(system_, std::move(module_), "spl:ssl") { - // clang-format off - static const FunctionInfo functions[] = { - {0, &SPL::GetConfig, "GetConfig"}, - {1, &SPL::ModularExponentiate, "ModularExponentiate"}, - {2, nullptr, "GenerateAesKek"}, - {3, nullptr, "LoadAesKey"}, - {4, nullptr, "GenerateAesKey"}, - {5, &SPL::SetConfig, "SetConfig"}, - {7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"}, - {11, &SPL::IsDevelopment, "IsDevelopment"}, - {13, nullptr, "DecryptDeviceUniqueData"}, - {14, nullptr, "DecryptAesKey"}, - {15, nullptr, "CryptAesCtr"}, - {16, nullptr, "ComputeCmac"}, - {21, nullptr, "AllocateAesKeyslot"}, - {22, nullptr, "DeallocateAesKeySlot"}, - {23, nullptr, "GetAesKeyslotAvailableEvent"}, - {24, &SPL::SetBootReason, "SetBootReason"}, - {25, &SPL::GetBootReason, "GetBootReason"}, - {26, nullptr, "DecryptAndStoreSslClientCertKey"}, - {27, nullptr, "ModularExponentiateWithSslClientCertKey"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - +SPL_SSL::SPL_SSL(Core::System& system_, std::shared_ptr module_) : Interface(system_, std::move(module_), "spl:ssl") {} SPL_SSL::~SPL_SSL() = default; -SPL_ES::SPL_ES(Core::System& system_, std::shared_ptr module_) - : Interface(system_, std::move(module_), "spl:es") { - // clang-format off - static const FunctionInfo functions[] = { - {0, &SPL::GetConfig, "GetConfig"}, - {1, &SPL::ModularExponentiate, "ModularExponentiate"}, - {2, nullptr, "GenerateAesKek"}, - {3, nullptr, "LoadAesKey"}, - {4, nullptr, "GenerateAesKey"}, - {5, &SPL::SetConfig, "SetConfig"}, - {7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"}, - {11, &SPL::IsDevelopment, "IsDevelopment"}, - {13, nullptr, "DecryptDeviceUniqueData"}, - {14, nullptr, "DecryptAesKey"}, - {15, nullptr, "CryptAesCtr"}, - {16, nullptr, "ComputeCmac"}, - {17, nullptr, "ImportEsKey"}, - {18, nullptr, "UnwrapTitleKey"}, - {20, nullptr, "PrepareEsCommonKey"}, - {21, nullptr, "AllocateAesKeyslot"}, - {22, nullptr, "DeallocateAesKeySlot"}, - {23, nullptr, "GetAesKeyslotAvailableEvent"}, - {24, &SPL::SetBootReason, "SetBootReason"}, - {25, &SPL::GetBootReason, "GetBootReason"}, - {28, nullptr, "DecryptAndStoreDrmDeviceCertKey"}, - {29, nullptr, "ModularExponentiateWithDrmDeviceCertKey"}, - {31, nullptr, "PrepareEsArchiveKey"}, - {32, nullptr, "LoadPreparedAesKey"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - +SPL_ES::SPL_ES(Core::System& system_, std::shared_ptr module_) : Interface(system_, std::move(module_), "spl:es") {} SPL_ES::~SPL_ES() = default; -SPL_MANU::SPL_MANU(Core::System& system_, std::shared_ptr module_) - : Interface(system_, std::move(module_), "spl:manu") { - // clang-format off - static const FunctionInfo functions[] = { - {0, &SPL::GetConfig, "GetConfig"}, - {1, &SPL::ModularExponentiate, "ModularExponentiate"}, - {2, nullptr, "GenerateAesKek"}, - {3, nullptr, "LoadAesKey"}, - {4, nullptr, "GenerateAesKey"}, - {5, &SPL::SetConfig, "SetConfig"}, - {7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"}, - {11, &SPL::IsDevelopment, "IsDevelopment"}, - {13, nullptr, "DecryptDeviceUniqueData"}, - {14, nullptr, "DecryptAesKey"}, - {15, nullptr, "CryptAesCtr"}, - {16, nullptr, "ComputeCmac"}, - {21, nullptr, "AllocateAesKeyslot"}, - {22, nullptr, "DeallocateAesKeySlot"}, - {23, nullptr, "GetAesKeyslotAvailableEvent"}, - {24, &SPL::SetBootReason, "SetBootReason"}, - {25, &SPL::GetBootReason, "GetBootReason"}, - {30, nullptr, "ReencryptDeviceUniqueData"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - +SPL_MANU::SPL_MANU(Core::System& system_, std::shared_ptr module_) : Interface(system_, std::move(module_), "spl:manu") {} SPL_MANU::~SPL_MANU() = default; } // namespace Service::SPL diff --git a/src/core/hle/service/spl/spl.h b/src/core/hle/service/spl/spl.h index 83a3cda539..8f84d2a3d3 100644 --- a/src/core/hle/service/spl/spl.h +++ b/src/core/hle/service/spl/spl.h @@ -18,36 +18,177 @@ class SPL final : public Module::Interface { public: explicit SPL(Core::System& system_, std::shared_ptr module_); ~SPL() override; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &SPL::GetConfig, "GetConfig"}, + FunctionInfo{1, &SPL::ModularExponentiate, "ModularExponentiate"}, + FunctionInfo{5, &SPL::SetConfig, "SetConfig"}, + FunctionInfo{7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"}, + FunctionInfo{11, &SPL::IsDevelopment, "IsDevelopment"}, + FunctionInfo{24, &SPL::SetBootReason, "SetBootReason"}, + FunctionInfo{25, &SPL::GetBootReason, "GetBootReason"} + ); }; class SPL_MIG final : public Module::Interface { public: explicit SPL_MIG(Core::System& system_, std::shared_ptr module_); ~SPL_MIG() override; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &SPL::GetConfig, "GetConfig"}, + FunctionInfo{1, &SPL::ModularExponentiate, "ModularExponentiate"}, + FunctionInfo{2, &SPL::GenerateAesKek, "GenerateAesKek"}, + FunctionInfo{3, nullptr, "LoadAesKey"}, + FunctionInfo{4, &SPL::GenerateAesKey, "GenerateAesKey"}, + FunctionInfo{5, &SPL::SetConfig, "SetConfig"}, + FunctionInfo{7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"}, + FunctionInfo{11, &SPL::IsDevelopment, "IsDevelopment"}, + FunctionInfo{14, nullptr, "DecryptAesKey"}, + FunctionInfo{15, nullptr, "CryptAesCtr"}, + FunctionInfo{16, nullptr, "ComputeCmac"}, + FunctionInfo{21, nullptr, "AllocateAesKeyslot"}, + FunctionInfo{22, nullptr, "DeallocateAesKeySlot"}, + FunctionInfo{23, nullptr, "GetAesKeyslotAvailableEvent"}, + FunctionInfo{24, &SPL::SetBootReason, "SetBootReason"}, + FunctionInfo{25, &SPL::GetBootReason, "GetBootReason"} + ); }; class SPL_FS final : public Module::Interface { public: explicit SPL_FS(Core::System& system_, std::shared_ptr module_); ~SPL_FS() override; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &SPL::GetConfig, "GetConfig"}, + FunctionInfo{1, &SPL::ModularExponentiate, "ModularExponentiate"}, + FunctionInfo{2, nullptr, "GenerateAesKek"}, + FunctionInfo{3, nullptr, "LoadAesKey"}, + FunctionInfo{4, nullptr, "GenerateAesKey"}, + FunctionInfo{5, &SPL::SetConfig, "SetConfig"}, + FunctionInfo{7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"}, + FunctionInfo{9, nullptr, "ImportLotusKey"}, + FunctionInfo{10, nullptr, "DecryptLotusMessage"}, + FunctionInfo{11, &SPL::IsDevelopment, "IsDevelopment"}, + FunctionInfo{12, nullptr, "GenerateSpecificAesKey"}, + FunctionInfo{14, nullptr, "DecryptAesKey"}, + FunctionInfo{15, nullptr, "CryptAesCtr"}, + FunctionInfo{16, nullptr, "ComputeCmac"}, + FunctionInfo{19, nullptr, "LoadTitleKey"}, + FunctionInfo{21, nullptr, "AllocateAesKeyslot"}, + FunctionInfo{22, nullptr, "DeallocateAesKeySlot"}, + FunctionInfo{23, nullptr, "GetAesKeyslotAvailableEvent"}, + FunctionInfo{24, &SPL::SetBootReason, "SetBootReason"}, + FunctionInfo{25, &SPL::GetBootReason, "GetBootReason"}, + FunctionInfo{31, nullptr, "GetPackage2Hash"} + ); }; class SPL_SSL final : public Module::Interface { public: explicit SPL_SSL(Core::System& system_, std::shared_ptr module_); ~SPL_SSL() override; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &SPL::GetConfig, "GetConfig"}, + FunctionInfo{1, &SPL::ModularExponentiate, "ModularExponentiate"}, + FunctionInfo{2, nullptr, "GenerateAesKek"}, + FunctionInfo{3, nullptr, "LoadAesKey"}, + FunctionInfo{4, nullptr, "GenerateAesKey"}, + FunctionInfo{5, &SPL::SetConfig, "SetConfig"}, + FunctionInfo{7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"}, + FunctionInfo{11, &SPL::IsDevelopment, "IsDevelopment"}, + FunctionInfo{13, nullptr, "DecryptDeviceUniqueData"}, + FunctionInfo{14, nullptr, "DecryptAesKey"}, + FunctionInfo{15, nullptr, "CryptAesCtr"}, + FunctionInfo{16, nullptr, "ComputeCmac"}, + FunctionInfo{21, nullptr, "AllocateAesKeyslot"}, + FunctionInfo{22, nullptr, "DeallocateAesKeySlot"}, + FunctionInfo{23, nullptr, "GetAesKeyslotAvailableEvent"}, + FunctionInfo{24, &SPL::SetBootReason, "SetBootReason"}, + FunctionInfo{25, &SPL::GetBootReason, "GetBootReason"}, + FunctionInfo{26, nullptr, "DecryptAndStoreSslClientCertKey"}, + FunctionInfo{27, nullptr, "ModularExponentiateWithSslClientCertKey"} + ); }; class SPL_ES final : public Module::Interface { public: explicit SPL_ES(Core::System& system_, std::shared_ptr module_); ~SPL_ES() override; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &SPL::GetConfig, "GetConfig"}, + FunctionInfo{1, &SPL::ModularExponentiate, "ModularExponentiate"}, + FunctionInfo{2, nullptr, "GenerateAesKek"}, + FunctionInfo{3, nullptr, "LoadAesKey"}, + FunctionInfo{4, nullptr, "GenerateAesKey"}, + FunctionInfo{5, &SPL::SetConfig, "SetConfig"}, + FunctionInfo{7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"}, + FunctionInfo{11, &SPL::IsDevelopment, "IsDevelopment"}, + FunctionInfo{13, nullptr, "DecryptDeviceUniqueData"}, + FunctionInfo{14, nullptr, "DecryptAesKey"}, + FunctionInfo{15, nullptr, "CryptAesCtr"}, + FunctionInfo{16, nullptr, "ComputeCmac"}, + FunctionInfo{17, nullptr, "ImportEsKey"}, + FunctionInfo{18, nullptr, "UnwrapTitleKey"}, + FunctionInfo{20, nullptr, "PrepareEsCommonKey"}, + FunctionInfo{21, nullptr, "AllocateAesKeyslot"}, + FunctionInfo{22, nullptr, "DeallocateAesKeySlot"}, + FunctionInfo{23, nullptr, "GetAesKeyslotAvailableEvent"}, + FunctionInfo{24, &SPL::SetBootReason, "SetBootReason"}, + FunctionInfo{25, &SPL::GetBootReason, "GetBootReason"}, + FunctionInfo{28, nullptr, "DecryptAndStoreDrmDeviceCertKey"}, + FunctionInfo{29, nullptr, "ModularExponentiateWithDrmDeviceCertKey"}, + FunctionInfo{31, nullptr, "PrepareEsArchiveKey"}, + FunctionInfo{32, nullptr, "LoadPreparedAesKey"} + ); }; class SPL_MANU final : public Module::Interface { public: explicit SPL_MANU(Core::System& system_, std::shared_ptr module_); ~SPL_MANU() override; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &SPL::GetConfig, "GetConfig"}, + FunctionInfo{1, &SPL::ModularExponentiate, "ModularExponentiate"}, + FunctionInfo{2, nullptr, "GenerateAesKek"}, + FunctionInfo{3, nullptr, "LoadAesKey"}, + FunctionInfo{4, nullptr, "GenerateAesKey"}, + FunctionInfo{5, &SPL::SetConfig, "SetConfig"}, + FunctionInfo{7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"}, + FunctionInfo{11, &SPL::IsDevelopment, "IsDevelopment"}, + FunctionInfo{13, nullptr, "DecryptDeviceUniqueData"}, + FunctionInfo{14, nullptr, "DecryptAesKey"}, + FunctionInfo{15, nullptr, "CryptAesCtr"}, + FunctionInfo{16, nullptr, "ComputeCmac"}, + FunctionInfo{21, nullptr, "AllocateAesKeyslot"}, + FunctionInfo{22, nullptr, "DeallocateAesKeySlot"}, + FunctionInfo{23, nullptr, "GetAesKeyslotAvailableEvent"}, + FunctionInfo{24, &SPL::SetBootReason, "SetBootReason"}, + FunctionInfo{25, &SPL::GetBootReason, "GetBootReason"}, + FunctionInfo{30, nullptr, "ReencryptDeviceUniqueData"} + ); }; } // namespace Service::SPL diff --git a/src/core/hle/service/spl/spl_module.cpp b/src/core/hle/service/spl/spl_module.cpp index 520cb1860b..594575d9a0 100644 --- a/src/core/hle/service/spl/spl_module.cpp +++ b/src/core/hle/service/spl/spl_module.cpp @@ -204,14 +204,15 @@ Result Module::Interface::GetConfigImpl(u64* out_config, ConfigItem config_item) class CSRNG final : public Module::Interface { public: - explicit CSRNG(Core::System& system_, std::shared_ptr module_) - : Interface(system_, std::move(module_), "csrng") { - static const FunctionInfo functions[] = { - {0, &CSRNG::GenerateRandomBytes, "GenerateRandomBytes"}, - }; - RegisterHandlers(functions); - } + explicit CSRNG(Core::System& system_, std::shared_ptr module_) : Interface(system_, std::move(module_), "csrng") {} ~CSRNG() override = default; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &CSRNG::GenerateRandomBytes, "GenerateRandomBytes"} + ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/ssl/ssl.cpp b/src/core/hle/service/ssl/ssl.cpp index 999efd4295..c5902079ee 100644 --- a/src/core/hle/service/ssl/ssl.cpp +++ b/src/core/hle/service/ssl/ssl.cpp @@ -74,59 +74,19 @@ struct SslContextSharedData { class ISslConnection final : public ServiceFramework { public: - explicit ISslConnection(Core::System& system_in, SslVersion ssl_version_in, - std::shared_ptr& shared_data_in, - std::unique_ptr&& backend_in) - : ServiceFramework{system_in, "ISslConnection"}, ssl_version{ssl_version_in}, - shared_data{shared_data_in}, backend{std::move(backend_in)} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&ISslConnection::SetSocketDescriptor>, "SetSocketDescriptor"}, - {1, D<&ISslConnection::SetHostName>, "SetHostName"}, - {2, D<&ISslConnection::SetVerifyOption>, "SetVerifyOption"}, - {3, D<&ISslConnection::SetIoMode>, "SetIoMode"}, - {4, D<&ISslConnection::GetSocketDescriptor>, "GetSocketDescriptor"}, - {5, D<&ISslConnection::GetHostName>, "GetHostName"}, - {6, nullptr, "GetVerifyOption"}, - {7, D<&ISslConnection::GetIoMode>, "GetIoMode"}, - {8, D<&ISslConnection::DoHandshake>, "DoHandshake"}, - {9, &ISslConnection::DoHandshakeGetServerCert, "DoHandshakeGetServerCert"}, - {10, D<&ISslConnection::Read>, "Read"}, - {11, D<&ISslConnection::Write>, "Write"}, - {12, D<&ISslConnection::Pending>, "Pending"}, - {13, D<&ISslConnection::Peek>, "Peek"}, - {14, D<&ISslConnection::Poll>, "Poll"}, - {15, D<&ISslConnection::GetVerifyCertError>, "GetVerifyCertError"}, - {16, D<&ISslConnection::GetNeededServerCertBufferSize>, "GetNeededServerCertBufferSize"}, - {17, D<&ISslConnection::SetSessionCacheMode>, "SetSessionCacheMode"}, - {18, D<&ISslConnection::GetSessionCacheMode>, "GetSessionCacheMode"}, - {19, D<&ISslConnection::FlushSessionCache>, "FlushSessionCache"}, - {20, D<&ISslConnection::SetRenegotiationMode>, "SetRenegotiationMode"}, - {21, D<&ISslConnection::GetRenegotiationMode>, "GetRenegotiationMode"}, - {22, D<&ISslConnection::SetOption>, "SetOption"}, - {23, D<&ISslConnection::GetOption>, "GetOption"}, - {24, nullptr, "GetVerifyCertErrors"}, - {25, nullptr, "GetCipherInfo"}, - {26, D<&ISslConnection::SetNextAlpnProto>, "SetNextAlpnProto"}, - {27, D<&ISslConnection::GetNextAlpnProto>, "GetNextAlpnProto"}, - {28, nullptr, "SetDtlsSocketDescriptor"}, - {29, nullptr, "GetDtlsHandshakeTimeout"}, - {30, nullptr, "SetPrivateOption"}, - {31, nullptr, "SetSrtpCiphers"}, - {32, nullptr, "GetSrtpCipher"}, - {33, nullptr, "ExportKeyingMaterial"}, - {34, nullptr, "SetIoTimeout"}, - {35, nullptr, "GetIoTimeout"}, - }; - // clang-format on - - RegisterHandlers(functions); - + explicit ISslConnection(Core::System& system_in, SslVersion ssl_version_in, std::shared_ptr& shared_data_in, std::unique_ptr&& backend_in) + : ServiceFramework{system_in, "ISslConnection"} + , ssl_version{ssl_version_in} + , shared_data{shared_data_in} + , backend{std::move(backend_in)} { backend->SetVerifyOption(verify_option); - shared_data->connection_count++; } + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + ~ISslConnection() { shared_data->connection_count--; if (fd_to_close.has_value()) { @@ -432,6 +392,44 @@ private: R_SUCCEED(); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&ISslConnection::SetSocketDescriptor>, "SetSocketDescriptor"}, + FunctionInfo{1, D<&ISslConnection::SetHostName>, "SetHostName"}, + FunctionInfo{2, D<&ISslConnection::SetVerifyOption>, "SetVerifyOption"}, + FunctionInfo{3, D<&ISslConnection::SetIoMode>, "SetIoMode"}, + FunctionInfo{4, D<&ISslConnection::GetSocketDescriptor>, "GetSocketDescriptor"}, + FunctionInfo{5, D<&ISslConnection::GetHostName>, "GetHostName"}, + FunctionInfo{6, nullptr, "GetVerifyOption"}, + FunctionInfo{7, D<&ISslConnection::GetIoMode>, "GetIoMode"}, + FunctionInfo{8, D<&ISslConnection::DoHandshake>, "DoHandshake"}, + FunctionInfo{9, &ISslConnection::DoHandshakeGetServerCert, "DoHandshakeGetServerCert"}, + FunctionInfo{10, D<&ISslConnection::Read>, "Read"}, + FunctionInfo{11, D<&ISslConnection::Write>, "Write"}, + FunctionInfo{12, D<&ISslConnection::Pending>, "Pending"}, + FunctionInfo{13, D<&ISslConnection::Peek>, "Peek"}, + FunctionInfo{14, D<&ISslConnection::Poll>, "Poll"}, + FunctionInfo{15, D<&ISslConnection::GetVerifyCertError>, "GetVerifyCertError"}, + FunctionInfo{16, D<&ISslConnection::GetNeededServerCertBufferSize>, "GetNeededServerCertBufferSize"}, + FunctionInfo{17, D<&ISslConnection::SetSessionCacheMode>, "SetSessionCacheMode"}, + FunctionInfo{18, D<&ISslConnection::GetSessionCacheMode>, "GetSessionCacheMode"}, + FunctionInfo{19, D<&ISslConnection::FlushSessionCache>, "FlushSessionCache"}, + FunctionInfo{20, D<&ISslConnection::SetRenegotiationMode>, "SetRenegotiationMode"}, + FunctionInfo{21, D<&ISslConnection::GetRenegotiationMode>, "GetRenegotiationMode"}, + FunctionInfo{22, D<&ISslConnection::SetOption>, "SetOption"}, + FunctionInfo{23, D<&ISslConnection::GetOption>, "GetOption"}, + FunctionInfo{24, nullptr, "GetVerifyCertErrors"}, + FunctionInfo{25, nullptr, "GetCipherInfo"}, + FunctionInfo{26, D<&ISslConnection::SetNextAlpnProto>, "SetNextAlpnProto"}, + FunctionInfo{27, D<&ISslConnection::GetNextAlpnProto>, "GetNextAlpnProto"}, + FunctionInfo{28, nullptr, "SetDtlsSocketDescriptor"}, + FunctionInfo{29, nullptr, "GetDtlsHandshakeTimeout"}, + FunctionInfo{30, nullptr, "SetPrivateOption"}, + FunctionInfo{31, nullptr, "SetSrtpCiphers"}, + FunctionInfo{32, nullptr, "GetSrtpCipher"}, + FunctionInfo{33, nullptr, "ExportKeyingMaterial"}, + FunctionInfo{34, nullptr, "SetIoTimeout"}, + FunctionInfo{35, nullptr, "GetIoTimeout"} + ); SslVersion ssl_version; std::shared_ptr shared_data; std::unique_ptr backend; @@ -452,29 +450,9 @@ public: explicit ISslContext(Core::System& system_, SslVersion version) : ServiceFramework{system_, "ISslContext"}, ssl_version{version}, shared_data{std::make_shared()} { - static const FunctionInfo functions[] = { - {0, &ISslContext::SetOption, "SetOption"}, - {1, &ISslContext::GetOption, "GetOption"}, - {2, &ISslContext::CreateConnection, "CreateConnection"}, - {3, &ISslContext::GetConnectionCount, "GetConnectionCount"}, - {4, &ISslContext::ImportServerPki, "ImportServerPki"}, - {5, &ISslContext::ImportClientPki, "ImportClientPki"}, - {6, nullptr, "RemoveServerPki"}, - {7, nullptr, "RemoveClientPki"}, - {8, D<&ISslContext::RegisterInternalPki>, "RegisterInternalPki"}, - {9, nullptr, "AddPolicyOid"}, - {10, nullptr, "ImportCrl"}, - {11, nullptr, "RemoveCrl"}, - {12, nullptr, "ImportClientCertKeyPki"}, - {13, nullptr, "GeneratePrivateKeyAndCert"}, - }; - RegisterHandlers(functions); } private: - SslVersion ssl_version; - std::shared_ptr shared_data; - void SetOption(HLERequestContext& ctx) { struct Parameters { ContextOption option; @@ -561,28 +539,36 @@ private: LOG_WARNING(Service_SSL, "(STUBBED) called"); R_SUCCEED(); } + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &ISslContext::SetOption, "SetOption"}, + FunctionInfo{1, &ISslContext::GetOption, "GetOption"}, + FunctionInfo{2, &ISslContext::CreateConnection, "CreateConnection"}, + FunctionInfo{3, &ISslContext::GetConnectionCount, "GetConnectionCount"}, + FunctionInfo{4, &ISslContext::ImportServerPki, "ImportServerPki"}, + FunctionInfo{5, &ISslContext::ImportClientPki, "ImportClientPki"}, + FunctionInfo{6, nullptr, "RemoveServerPki"}, + FunctionInfo{7, nullptr, "RemoveClientPki"}, + FunctionInfo{8, D<&ISslContext::RegisterInternalPki>, "RegisterInternalPki"}, + FunctionInfo{9, nullptr, "AddPolicyOid"}, + FunctionInfo{10, nullptr, "ImportCrl"}, + FunctionInfo{11, nullptr, "RemoveCrl"}, + FunctionInfo{12, nullptr, "ImportClientCertKeyPki"}, + FunctionInfo{13, nullptr, "GeneratePrivateKeyAndCert"} + ); + SslVersion ssl_version; + std::shared_ptr shared_data; }; class ISslService final : public ServiceFramework { public: - explicit ISslService(Core::System& system_) - : ServiceFramework{system_, "ssl"}, cert_store{system} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &ISslService::CreateContext, "CreateContext"}, - {1, nullptr, "GetContextCount"}, - {2, D<&ISslService::GetCertificates>, "GetCertificates"}, - {3, D<&ISslService::GetCertificateBufSize>, "GetCertificateBufSize"}, - {4, nullptr, "DebugIoctl"}, - {5, &ISslService::SetInterfaceVersion, "SetInterfaceVersion"}, - {6, nullptr, "FlushSessionCache"}, - {7, nullptr, "SetDebugOption"}, - {8, nullptr, "GetDebugOption"}, - {8, nullptr, "ClearTls12FallbackFlag"}, - }; - // clang-format on + explicit ISslService(Core::System& system_) : ServiceFramework{system_, "ssl"}, cert_store{system} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -628,147 +614,116 @@ private: } private: + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &ISslService::CreateContext, "CreateContext"}, + FunctionInfo{1, nullptr, "GetContextCount"}, + FunctionInfo{2, D<&ISslService::GetCertificates>, "GetCertificates"}, + FunctionInfo{3, D<&ISslService::GetCertificateBufSize>, "GetCertificateBufSize"}, + FunctionInfo{4, nullptr, "DebugIoctl"}, + FunctionInfo{5, &ISslService::SetInterfaceVersion, "SetInterfaceVersion"}, + FunctionInfo{6, nullptr, "FlushSessionCache"}, + FunctionInfo{7, nullptr, "SetDebugOption"}, + FunctionInfo{8, nullptr, "GetDebugOption"}, + FunctionInfo{8, nullptr, "ClearTls12FallbackFlag"} + ); CertStore cert_store; }; class ISslServiceForSystem final : public ServiceFramework { - public: - explicit ISslServiceForSystem(Core::System& system_) : ServiceFramework{system_, "ssl:s"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, D<&ISslServiceForSystem::CreateContext>, "CreateContext"}, - {1, D<&ISslServiceForSystem::GetContextCount>, "GetContextCount"}, - {2, D<&ISslServiceForSystem::GetCertificates>, "GetCertificates"}, - {3, D<&ISslServiceForSystem::GetCertificateBufSize>, "GetCertificateBufSize"}, - {4, D<&ISslServiceForSystem::DebugIoctl>, "DebugIoctl"}, - {5, D<&ISslServiceForSystem::SetInterfaceVersion>, "SetInterfaceVersion"}, - {6, D<&ISslServiceForSystem::FlushSessionCache>, "FlushSessionCache"}, - {7, D<&ISslServiceForSystem::SetDebugOption>, "SetDebugOption"}, - {8, D<&ISslServiceForSystem::GetDebugOption>, "GetDebugOption"}, - {9, D<&ISslServiceForSystem::ClearTls12FallbackFlag>, "ClearTls12FallbackFlag"}, - {100, D<&ISslServiceForSystem::CreateContextForSystem>, "CreateContextForSystem"}, - {101, D<&ISslServiceForSystem::SetThreadCoreMask>, "SetThreadCoreMask"}, - {102, D<&ISslServiceForSystem::GetThreadCoreMask>, "GetThreadCoreMask"}, - {103, D<&ISslServiceForSystem::VerifySignature>, "VerifySignature"} - }; - // clang-format on +public: + explicit ISslServiceForSystem(Core::System& system_) : ServiceFramework{system_, "ssl:s"} {} - RegisterHandlers(functions); - }; - - Result CreateContext() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - - // TODO (jarrodnorwell) - - return ResultSuccess; - }; - - Result GetContextCount() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - - // TODO (jarrodnorwell) - - return ResultSuccess; - }; - - Result GetCertificates() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - - // TODO (jarrodnorwell) - - return ResultSuccess; - }; - - Result GetCertificateBufSize() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - - // TODO (jarrodnorwell) - - return ResultSuccess; - }; - - Result DebugIoctl() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - - // TODO (jarrodnorwell) - - return ResultSuccess; - }; - - Result SetInterfaceVersion() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - - // TODO (jarrodnorwell) - - return ResultSuccess; - }; - - Result FlushSessionCache() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - - // TODO (jarrodnorwell) - - return ResultSuccess; - }; - - Result SetDebugOption() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - - // TODO (jarrodnorwell) - - return ResultSuccess; - }; - - Result GetDebugOption() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - - // TODO (jarrodnorwell) - - return ResultSuccess; - }; - - Result ClearTls12FallbackFlag() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - - // TODO (jarrodnorwell) - - return ResultSuccess; - }; - - Result CreateContextForSystem() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - - // TODO (jarrodnorwell) - - return ResultSuccess; - }; - - Result SetThreadCoreMask() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - - // TODO (jarrodnorwell) - - return ResultSuccess; - }; - - Result GetThreadCoreMask() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - - // TODO (jarrodnorwell) - - return ResultSuccess; - }; - - Result VerifySignature() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - - // TODO (jarrodnorwell) - - return ResultSuccess; - }; + Result CreateContext() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + R_SUCCEED(); }; + Result GetContextCount() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + R_SUCCEED(); + }; + + Result GetCertificates() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + R_SUCCEED(); + }; + + Result GetCertificateBufSize() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + R_SUCCEED(); + }; + + Result DebugIoctl() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + R_SUCCEED(); + }; + + Result SetInterfaceVersion() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + R_SUCCEED(); + }; + + Result FlushSessionCache() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + R_SUCCEED(); + }; + + Result SetDebugOption() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + R_SUCCEED(); + }; + + Result GetDebugOption() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + R_SUCCEED(); + }; + + Result ClearTls12FallbackFlag() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + R_SUCCEED(); + }; + + Result CreateContextForSystem() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + R_SUCCEED(); + }; + + Result SetThreadCoreMask() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + R_SUCCEED(); + }; + + Result GetThreadCoreMask() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + R_SUCCEED(); + }; + + Result VerifySignature() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + R_SUCCEED(); + }; + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&ISslServiceForSystem::CreateContext>, "CreateContext"}, + FunctionInfo{1, D<&ISslServiceForSystem::GetContextCount>, "GetContextCount"}, + FunctionInfo{2, D<&ISslServiceForSystem::GetCertificates>, "GetCertificates"}, + FunctionInfo{3, D<&ISslServiceForSystem::GetCertificateBufSize>, "GetCertificateBufSize"}, + FunctionInfo{4, D<&ISslServiceForSystem::DebugIoctl>, "DebugIoctl"}, + FunctionInfo{5, D<&ISslServiceForSystem::SetInterfaceVersion>, "SetInterfaceVersion"}, + FunctionInfo{6, D<&ISslServiceForSystem::FlushSessionCache>, "FlushSessionCache"}, + FunctionInfo{7, D<&ISslServiceForSystem::SetDebugOption>, "SetDebugOption"}, + FunctionInfo{8, D<&ISslServiceForSystem::GetDebugOption>, "GetDebugOption"}, + FunctionInfo{9, D<&ISslServiceForSystem::ClearTls12FallbackFlag>, "ClearTls12FallbackFlag"}, + FunctionInfo{100, D<&ISslServiceForSystem::CreateContextForSystem>, "CreateContextForSystem"}, + FunctionInfo{101, D<&ISslServiceForSystem::SetThreadCoreMask>, "SetThreadCoreMask"}, + FunctionInfo{102, D<&ISslServiceForSystem::GetThreadCoreMask>, "GetThreadCoreMask"}, + FunctionInfo{103, D<&ISslServiceForSystem::VerifySignature>, "VerifySignature"} + ); +}; + void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); diff --git a/src/core/hle/service/tma/tma.cpp b/src/core/hle/service/tma/tma.cpp index c2fb33cd16..e9198eea64 100644 --- a/src/core/hle/service/tma/tma.cpp +++ b/src/core/hle/service/tma/tma.cpp @@ -19,12 +19,14 @@ class HTC_TENV final : public ServiceFramework { public: explicit HTC_TENV(Core::System& system_) : ServiceFramework{system_, "htc:tenv"} - { - static const FunctionInfo functions[] = { - {0, nullptr, "GetServiceInterface"}, - }; - RegisterHandlers(functions); + {} + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetServiceInterface"} + ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/usb/usb.cpp b/src/core/hle/service/usb/usb.cpp index ff2a377172..f7dc15e3db 100644 --- a/src/core/hle/service/usb/usb.cpp +++ b/src/core/hle/service/usb/usb.cpp @@ -17,137 +17,127 @@ namespace Service::USB { class IDsInterface final : public ServiceFramework { public: - explicit IDsInterface(Core::System& system_) : ServiceFramework{system_, "IDsInterface"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "AddEndpoint"}, - {1, nullptr, "GetSetupEvent"}, - {2, nullptr, "GetSetupPacket"}, - {3, nullptr, "Enable"}, - {4, nullptr, "Disable"}, - {5, nullptr, "CtrlIn"}, - {6, nullptr, "CtrlOut"}, - {7, nullptr, "GetCtrlInCompletionEvent"}, - {8, nullptr, "GetCtrlInUrbReport"}, - {9, nullptr, "GetCtrlOutCompletionEvent"}, - {10, nullptr, "GetCtrlOutUrbReport"}, - {11, nullptr, "CtrlStall"}, - {12, nullptr, "AppendConfigurationData"}, - }; - // clang-format on + explicit IDsInterface(Core::System& system_) : ServiceFramework{system_, "IDsInterface"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "AddEndpoint"}, + FunctionInfo{1, nullptr, "GetSetupEvent"}, + FunctionInfo{2, nullptr, "GetSetupPacket"}, + FunctionInfo{3, nullptr, "Enable"}, + FunctionInfo{4, nullptr, "Disable"}, + FunctionInfo{5, nullptr, "CtrlIn"}, + FunctionInfo{6, nullptr, "CtrlOut"}, + FunctionInfo{7, nullptr, "GetCtrlInCompletionEvent"}, + FunctionInfo{8, nullptr, "GetCtrlInUrbReport"}, + FunctionInfo{9, nullptr, "GetCtrlOutCompletionEvent"}, + FunctionInfo{10, nullptr, "GetCtrlOutUrbReport"}, + FunctionInfo{11, nullptr, "CtrlStall"}, + FunctionInfo{12, nullptr, "AppendConfigurationData"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class IDsRootSession final : public ServiceFramework { public: - explicit IDsRootSession(Core::System& system_) : ServiceFramework{system_, "usb:ds"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "OpenDsService"}, - }; - // clang-format on + explicit IDsRootSession(Core::System& system_) : ServiceFramework{system_, "usb:ds"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "OpenDsService"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class IClientEpSession final : public ServiceFramework { public: explicit IClientEpSession(Core::System& system_) - : ServiceFramework{system_, "IClientEpSession"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "ReOpen"}, - {1, nullptr, "Close"}, - {2, nullptr, "GetCompletionEvent"}, - {3, nullptr, "PopulateRing"}, - {4, nullptr, "PostBufferAsync"}, - {5, nullptr, "GetXferReport"}, - {6, nullptr, "PostBufferMultiAsync"}, - {7, nullptr, "CreateSmmuSpace"}, - {8, nullptr, "ShareReportRing"}, - }; - // clang-format on + : ServiceFramework{system_, "IClientEpSession"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "ReOpen"}, + FunctionInfo{1, nullptr, "Close"}, + FunctionInfo{2, nullptr, "GetCompletionEvent"}, + FunctionInfo{3, nullptr, "PopulateRing"}, + FunctionInfo{4, nullptr, "PostBufferAsync"}, + FunctionInfo{5, nullptr, "GetXferReport"}, + FunctionInfo{6, nullptr, "PostBufferMultiAsync"}, + FunctionInfo{7, nullptr, "CreateSmmuSpace"}, + FunctionInfo{8, nullptr, "ShareReportRing"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class IClientIfSession final : public ServiceFramework { public: explicit IClientIfSession(Core::System& system_) - : ServiceFramework{system_, "IClientIfSession"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetStateChangeEvent"}, - {1, nullptr, "SetInterface"}, - {2, nullptr, "GetInterface"}, - {3, nullptr, "GetAlternateInterface"}, - {4, nullptr, "GetCurrentFrame"}, - {5, nullptr, "CtrlXferAsync"}, - {6, nullptr, "GetCtrlXferCompletionEvent"}, - {7, nullptr, "GetCtrlXferReport"}, - {8, nullptr, "ResetDevice"}, - {9, nullptr, "OpenUsbEp"}, - }; - // clang-format on + : ServiceFramework{system_, "IClientIfSession"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetStateChangeEvent"}, + FunctionInfo{1, nullptr, "SetInterface"}, + FunctionInfo{2, nullptr, "GetInterface"}, + FunctionInfo{3, nullptr, "GetAlternateInterface"}, + FunctionInfo{4, nullptr, "GetCurrentFrame"}, + FunctionInfo{5, nullptr, "CtrlXferAsync"}, + FunctionInfo{6, nullptr, "GetCtrlXferCompletionEvent"}, + FunctionInfo{7, nullptr, "GetCtrlXferReport"}, + FunctionInfo{8, nullptr, "ResetDevice"}, + FunctionInfo{9, nullptr, "OpenUsbEp"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class IClientRootSession final : public ServiceFramework { public: - explicit IClientRootSession(Core::System& system_) : ServiceFramework{system_, "usb:hs"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "BindClientProcess"}, - {1, nullptr, "QueryAllInterfaces"}, - {2, nullptr, "QueryAvailableInterfaces"}, - {3, nullptr, "QueryAcquiredInterfaces"}, - {4, nullptr, "CreateInterfaceAvailableEvent"}, - {5, nullptr, "DestroyInterfaceAvailableEvent"}, - {6, nullptr, "GetInterfaceStateChangeEvent"}, - {7, nullptr, "AcquireUsbIf"}, - {8, nullptr, "SetTestMode"}, - }; - // clang-format on + explicit IClientRootSession(Core::System& system_) : ServiceFramework{system_, "usb:hs"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "BindClientProcess"}, + FunctionInfo{1, nullptr, "QueryAllInterfaces"}, + FunctionInfo{2, nullptr, "QueryAvailableInterfaces"}, + FunctionInfo{3, nullptr, "QueryAcquiredInterfaces"}, + FunctionInfo{4, nullptr, "CreateInterfaceAvailableEvent"}, + FunctionInfo{5, nullptr, "DestroyInterfaceAvailableEvent"}, + FunctionInfo{6, nullptr, "GetInterfaceStateChangeEvent"}, + FunctionInfo{7, nullptr, "AcquireUsbIf"}, + FunctionInfo{8, nullptr, "SetTestMode"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class IPdSession final : public ServiceFramework { public: - explicit IPdSession(Core::System& system_) : ServiceFramework{system_, "IPdSession"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "BindNoticeEvent"}, - {1, nullptr, "UnbindNoticeEvent"}, - {2, nullptr, "GetStatus"}, - {3, nullptr, "GetNotice"}, - {4, nullptr, "EnablePowerRequestNotice"}, - {5, nullptr, "DisablePowerRequestNotice"}, - {6, nullptr, "ReplyPowerRequest"}, - }; - // clang-format on + explicit IPdSession(Core::System& system_) : ServiceFramework{system_, "IPdSession"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "BindNoticeEvent"}, + FunctionInfo{1, nullptr, "UnbindNoticeEvent"}, + FunctionInfo{2, nullptr, "GetStatus"}, + FunctionInfo{3, nullptr, "GetNotice"}, + FunctionInfo{4, nullptr, "EnablePowerRequestNotice"}, + FunctionInfo{5, nullptr, "DisablePowerRequestNotice"}, + FunctionInfo{6, nullptr, "ReplyPowerRequest"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class IPdManager final : public ServiceFramework { public: - explicit IPdManager(Core::System& system_) : ServiceFramework{system_, "usb:pd"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &IPdManager::OpenSession, "OpenSession"}, - }; - // clang-format on + explicit IPdManager(Core::System& system_) : ServiceFramework{system_, "usb:pd"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -158,40 +148,39 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &IPdManager::OpenSession, "OpenSession"} + ); }; class IPdCradleSession final : public ServiceFramework { public: explicit IPdCradleSession(Core::System& system_) - : ServiceFramework{system_, "IPdCradleSession"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "SetCradleVdo"}, - {1, nullptr, "GetCradleVdo"}, - {2, nullptr, "ResetCradleUsbHub"}, - {3, nullptr, "GetHostPdcFirmwareType"}, - {4, nullptr, "GetHostPdcFirmwareRevision"}, - {5, nullptr, "GetHostPdcManufactureId"}, - {6, nullptr, "GetHostPdcDeviceId"}, - {7, nullptr, "EnableCradleRecovery"}, - {8, nullptr, "DisableCradleRecovery"}, - }; - // clang-format on + : ServiceFramework{system_, "IPdCradleSession"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "SetCradleVdo"}, + FunctionInfo{1, nullptr, "GetCradleVdo"}, + FunctionInfo{2, nullptr, "ResetCradleUsbHub"}, + FunctionInfo{3, nullptr, "GetHostPdcFirmwareType"}, + FunctionInfo{4, nullptr, "GetHostPdcFirmwareRevision"}, + FunctionInfo{5, nullptr, "GetHostPdcManufactureId"}, + FunctionInfo{6, nullptr, "GetHostPdcDeviceId"}, + FunctionInfo{7, nullptr, "EnableCradleRecovery"}, + FunctionInfo{8, nullptr, "DisableCradleRecovery"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class IPdCradleManager final : public ServiceFramework { public: - explicit IPdCradleManager(Core::System& system_) : ServiceFramework{system_, "usb:pd:c"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, &IPdCradleManager::OpenCradleSession, "OpenCradleSession"}, - }; - // clang-format on + explicit IPdCradleManager(Core::System& system_) : ServiceFramework{system_, "usb:pd:c"} {} - RegisterHandlers(functions); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } private: @@ -202,61 +191,64 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &IPdCradleManager::OpenCradleSession, "OpenCradleSession"} + ); }; class IPmMainService final : public ServiceFramework { public: - explicit IPmMainService(Core::System& system_) : ServiceFramework{system_, "usb:pm"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetPowerEvent"}, - {1, nullptr, "GetPowerState"}, - {2, nullptr, "GetDataEvent"}, - {3, nullptr, "GetDataRole"}, - {4, nullptr, "SetDiagData"}, - {5, nullptr, "GetDiagData"}, - }; - // clang-format on + explicit IPmMainService(Core::System& system_) : ServiceFramework{system_, "usb:pm"} {} - RegisterHandlers(functions); + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetPowerEvent"}, + FunctionInfo{1, nullptr, "GetPowerState"}, + FunctionInfo{2, nullptr, "GetDataEvent"}, + FunctionInfo{3, nullptr, "GetDataRole"}, + FunctionInfo{4, nullptr, "SetDiagData"}, + FunctionInfo{5, nullptr, "GetDiagData"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class IPdManufactureManager final : public ServiceFramework { public: - explicit IPdManufactureManager(Core::System& system_) : ServiceFramework{system_, "usb:pd:m"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "OpenManufactureSession"}, - }; - // clang-format on - RegisterHandlers(functions); + explicit IPdManufactureManager(Core::System& system_) : ServiceFramework{system_, "usb:pd:m"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "OpenManufactureSession"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class IQdbManager final : public ServiceFramework { public: - explicit IQdbManager(Core::System& system_) : ServiceFramework{system_, "usb:qdb"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "ImportQuirkDevices"}, - {1, nullptr, "HasQuirk"}, - }; - // clang-format on - RegisterHandlers(functions); + explicit IQdbManager(Core::System& system_) : ServiceFramework{system_, "usb:qdb"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "ImportQuirkDevices"}, + FunctionInfo{1, nullptr, "HasQuirk"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; class IPmObserverService final : public ServiceFramework { public: - explicit IPmObserverService(Core::System& system_) : ServiceFramework{system_, "usb:obsv"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetTopologyChangeEvent"}, - {1, nullptr, "GetFlattenedTopology"}, - }; - // clang-format on - RegisterHandlers(functions); + explicit IPmObserverService(Core::System& system_) : ServiceFramework{system_, "usb:obsv"} {} + + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetTopologyChangeEvent"}, + FunctionInfo{1, nullptr, "GetFlattenedTopology"} + ); + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } }; diff --git a/src/core/hle/service/vi/application_display_service.cpp b/src/core/hle/service/vi/application_display_service.cpp index f179ba676a..dcebb2eba9 100644 --- a/src/core/hle/service/vi/application_display_service.cpp +++ b/src/core/hle/service/vi/application_display_service.cpp @@ -17,38 +17,38 @@ namespace Service::VI { +std::optional IApplicationDisplayService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{100, C<&IApplicationDisplayService::GetRelayService>, "GetRelayService"}, + FunctionInfo{101, C<&IApplicationDisplayService::GetSystemDisplayService>, "GetSystemDisplayService"}, + FunctionInfo{102, C<&IApplicationDisplayService::GetManagerDisplayService>, "GetManagerDisplayService"}, + FunctionInfo{103, C<&IApplicationDisplayService::GetIndirectDisplayTransactionService>, "GetIndirectDisplayTransactionService"}, + FunctionInfo{1000, C<&IApplicationDisplayService::ListDisplays>, "ListDisplays"}, + FunctionInfo{1010, C<&IApplicationDisplayService::OpenDisplay>, "OpenDisplay"}, + FunctionInfo{1011, C<&IApplicationDisplayService::OpenDefaultDisplay>, "OpenDefaultDisplay"}, + FunctionInfo{1020, C<&IApplicationDisplayService::CloseDisplay>, "CloseDisplay"}, + FunctionInfo{1101, C<&IApplicationDisplayService::SetDisplayEnabled>, "SetDisplayEnabled"}, + FunctionInfo{1102, C<&IApplicationDisplayService::GetDisplayResolution>, "GetDisplayResolution"}, + FunctionInfo{2020, C<&IApplicationDisplayService::OpenLayer>, "OpenLayer"}, + FunctionInfo{2021, C<&IApplicationDisplayService::CloseLayer>, "CloseLayer"}, + FunctionInfo{2030, C<&IApplicationDisplayService::CreateStrayLayer>, "CreateStrayLayer"}, + FunctionInfo{2031, C<&IApplicationDisplayService::DestroyStrayLayer>, "DestroyStrayLayer"}, + FunctionInfo{2101, C<&IApplicationDisplayService::SetLayerScalingMode>, "SetLayerScalingMode"}, + FunctionInfo{2102, C<&IApplicationDisplayService::ConvertScalingMode>, "ConvertScalingMode"}, + FunctionInfo{2103, C<&IApplicationDisplayService::Cmd2103>, "Cmd2103"}, + FunctionInfo{2450, C<&IApplicationDisplayService::GetIndirectLayerImageMap>, "GetIndirectLayerImageMap"}, + FunctionInfo{2451, nullptr, "GetIndirectLayerImageCropMap"}, + FunctionInfo{2460, C<&IApplicationDisplayService::GetIndirectLayerImageRequiredMemoryInfo>, "GetIndirectLayerImageRequiredMemoryInfo"}, + FunctionInfo{5202, C<&IApplicationDisplayService::GetDisplayVsyncEvent>, "GetDisplayVsyncEvent"}, + FunctionInfo{5203, nullptr, "GetDisplayVsyncEventForDebug"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IApplicationDisplayService::IApplicationDisplayService(Core::System& system_, std::shared_ptr container) : ServiceFramework{system_, "IApplicationDisplayService"}, m_container{std::move(container)}, m_context{system, "IApplicationDisplayService"} { - // clang-format off - static const FunctionInfo functions[] = { - {100, C<&IApplicationDisplayService::GetRelayService>, "GetRelayService"}, - {101, C<&IApplicationDisplayService::GetSystemDisplayService>, "GetSystemDisplayService"}, - {102, C<&IApplicationDisplayService::GetManagerDisplayService>, "GetManagerDisplayService"}, - {103, C<&IApplicationDisplayService::GetIndirectDisplayTransactionService>, "GetIndirectDisplayTransactionService"}, - {1000, C<&IApplicationDisplayService::ListDisplays>, "ListDisplays"}, - {1010, C<&IApplicationDisplayService::OpenDisplay>, "OpenDisplay"}, - {1011, C<&IApplicationDisplayService::OpenDefaultDisplay>, "OpenDefaultDisplay"}, - {1020, C<&IApplicationDisplayService::CloseDisplay>, "CloseDisplay"}, - {1101, C<&IApplicationDisplayService::SetDisplayEnabled>, "SetDisplayEnabled"}, - {1102, C<&IApplicationDisplayService::GetDisplayResolution>, "GetDisplayResolution"}, - {2020, C<&IApplicationDisplayService::OpenLayer>, "OpenLayer"}, - {2021, C<&IApplicationDisplayService::CloseLayer>, "CloseLayer"}, - {2030, C<&IApplicationDisplayService::CreateStrayLayer>, "CreateStrayLayer"}, - {2031, C<&IApplicationDisplayService::DestroyStrayLayer>, "DestroyStrayLayer"}, - {2101, C<&IApplicationDisplayService::SetLayerScalingMode>, "SetLayerScalingMode"}, - {2102, C<&IApplicationDisplayService::ConvertScalingMode>, "ConvertScalingMode"}, - {2103, C<&IApplicationDisplayService::Cmd2103>, "Cmd2103"}, - {2450, C<&IApplicationDisplayService::GetIndirectLayerImageMap>, "GetIndirectLayerImageMap"}, - {2451, nullptr, "GetIndirectLayerImageCropMap"}, - {2460, C<&IApplicationDisplayService::GetIndirectLayerImageRequiredMemoryInfo>, "GetIndirectLayerImageRequiredMemoryInfo"}, - {5202, C<&IApplicationDisplayService::GetDisplayVsyncEvent>, "GetDisplayVsyncEvent"}, - {5203, nullptr, "GetDisplayVsyncEventForDebug"}, - }; - // clang-format on - - RegisterHandlers(functions); } IApplicationDisplayService::~IApplicationDisplayService() { diff --git a/src/core/hle/service/vi/application_display_service.h b/src/core/hle/service/vi/application_display_service.h index d2db391efd..0b5898ee56 100644 --- a/src/core/hle/service/vi/application_display_service.h +++ b/src/core/hle/service/vi/application_display_service.h @@ -74,8 +74,8 @@ public: s64 width, s64 height); private: + std::optional FindRequest(u32 key) override; const std::shared_ptr m_container; - KernelHelpers::ServiceContext m_context; std::mutex m_lock{}; std::set m_open_layer_ids{}; diff --git a/src/core/hle/service/vi/application_root_service.cpp b/src/core/hle/service/vi/application_root_service.cpp index 7f35a048da..f12c564277 100644 --- a/src/core/hle/service/vi/application_root_service.cpp +++ b/src/core/hle/service/vi/application_root_service.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -11,14 +14,17 @@ namespace Service::VI { +std::optional IApplicationRootService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, C<&IApplicationRootService::GetDisplayService>, "GetDisplayService"}, + FunctionInfo{1, nullptr, "GetDisplayServiceWithProxyNameExchange"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IApplicationRootService::IApplicationRootService(Core::System& system_, std::shared_ptr container) : ServiceFramework{system_, "vi:u"}, m_container{std::move(container)} { - static const FunctionInfo functions[] = { - {0, C<&IApplicationRootService::GetDisplayService>, "GetDisplayService"}, - {1, nullptr, "GetDisplayServiceWithProxyNameExchange"}, - }; - RegisterHandlers(functions); } IApplicationRootService::~IApplicationRootService() = default; diff --git a/src/core/hle/service/vi/application_root_service.h b/src/core/hle/service/vi/application_root_service.h index 15aa4483d6..4deaa04f4c 100644 --- a/src/core/hle/service/vi/application_root_service.h +++ b/src/core/hle/service/vi/application_root_service.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -27,6 +30,7 @@ private: Policy policy); private: + std::optional FindRequest(u32 key) override; const std::shared_ptr m_container; }; diff --git a/src/core/hle/service/vi/manager_display_service.cpp b/src/core/hle/service/vi/manager_display_service.cpp index e4d22ca11c..1b3b0f3379 100644 --- a/src/core/hle/service/vi/manager_display_service.cpp +++ b/src/core/hle/service/vi/manager_display_service.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project @@ -10,96 +10,96 @@ namespace Service::VI { +std::optional IManagerDisplayService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{200, nullptr, "AllocateProcessHeapBlock"}, + FunctionInfo{201, nullptr, "FreeProcessHeapBlock"}, + FunctionInfo{1102, nullptr, "GetDisplayResolution"}, + FunctionInfo{2010, C<&IManagerDisplayService::CreateManagedLayer>, "CreateManagedLayer"}, + FunctionInfo{2011, C<&IManagerDisplayService::DestroyManagedLayer>, "DestroyManagedLayer"}, + FunctionInfo{2012, nullptr, "CreateStrayLayer"}, + FunctionInfo{2050, nullptr, "CreateIndirectLayer"}, + FunctionInfo{2051, nullptr, "DestroyIndirectLayer"}, + FunctionInfo{2052, nullptr, "CreateIndirectProducerEndPoint"}, + FunctionInfo{2053, nullptr, "DestroyIndirectProducerEndPoint"}, + FunctionInfo{2054, nullptr, "CreateIndirectConsumerEndPoint"}, + FunctionInfo{2055, nullptr, "DestroyIndirectConsumerEndPoint"}, + FunctionInfo{2060, nullptr, "CreateWatermarkCompositor"}, + FunctionInfo{2062, nullptr, "SetWatermarkText"}, + FunctionInfo{2063, nullptr, "SetWatermarkLayerStacks"}, + FunctionInfo{2300, nullptr, "AcquireLayerTexturePresentingEvent"}, + FunctionInfo{2301, nullptr, "ReleaseLayerTexturePresentingEvent"}, + FunctionInfo{2302, nullptr, "GetDisplayHotplugEvent"}, + FunctionInfo{2303, nullptr, "GetDisplayModeChangedEvent"}, + FunctionInfo{2402, nullptr, "GetDisplayHotplugState"}, + FunctionInfo{2501, nullptr, "GetCompositorErrorInfo"}, + FunctionInfo{2601, nullptr, "GetDisplayErrorEvent"}, + FunctionInfo{2701, nullptr, "GetDisplayFatalErrorEvent"}, + FunctionInfo{4201, nullptr, "SetDisplayAlpha"}, + FunctionInfo{4203, nullptr, "SetDisplayLayerStack"}, + FunctionInfo{4205, nullptr, "SetDisplayPowerState"}, + FunctionInfo{4206, nullptr, "SetDefaultDisplay"}, + FunctionInfo{4207, nullptr, "ResetDisplayPanel"}, + FunctionInfo{4208, nullptr, "SetDisplayFatalErrorEnabled"}, + FunctionInfo{4209, nullptr, "IsDisplayPanelOn"}, + FunctionInfo{4300, nullptr, "GetInternalPanelId"}, + FunctionInfo{6000, C<&IManagerDisplayService::AddToLayerStack>, "AddToLayerStack"}, + FunctionInfo{6001, nullptr, "RemoveFromLayerStack"}, + FunctionInfo{6002, C<&IManagerDisplayService::SetLayerVisibility>, "SetLayerVisibility"}, + FunctionInfo{6003, nullptr, "SetLayerConfig"}, + FunctionInfo{6004, nullptr, "AttachLayerPresentationTracer"}, + FunctionInfo{6005, nullptr, "DetachLayerPresentationTracer"}, + FunctionInfo{6006, nullptr, "StartLayerPresentationRecording"}, + FunctionInfo{6007, nullptr, "StopLayerPresentationRecording"}, + FunctionInfo{6008, nullptr, "StartLayerPresentationFenceWait"}, + FunctionInfo{6009, nullptr, "StopLayerPresentationFenceWait"}, + FunctionInfo{6010, nullptr, "GetLayerPresentationAllFencesExpiredEvent"}, + FunctionInfo{6011, nullptr, "EnableLayerAutoClearTransitionBuffer"}, + FunctionInfo{6012, nullptr, "DisableLayerAutoClearTransitionBuffer"}, + FunctionInfo{6013, nullptr, "SetLayerOpacity"}, + FunctionInfo{6014, nullptr, "AttachLayerWatermarkCompositor"}, + FunctionInfo{6015, nullptr, "DetachLayerWatermarkCompositor"}, + FunctionInfo{7000, nullptr, "SetContentVisibility"}, + FunctionInfo{8000, nullptr, "SetConductorLayer"}, + FunctionInfo{8001, nullptr, "SetTimestampTracking"}, + FunctionInfo{8100, nullptr, "SetIndirectProducerFlipOffset"}, + FunctionInfo{8200, nullptr, "CreateSharedBufferStaticStorage"}, + FunctionInfo{8201, nullptr, "CreateSharedBufferTransferMemory"}, + FunctionInfo{8202, nullptr, "DestroySharedBuffer"}, + FunctionInfo{8203, nullptr, "BindSharedLowLevelLayerToManagedLayer"}, + FunctionInfo{8204, nullptr, "BindSharedLowLevelLayerToIndirectLayer"}, + FunctionInfo{8207, nullptr, "UnbindSharedLowLevelLayer"}, + FunctionInfo{8208, nullptr, "ConnectSharedLowLevelLayerToSharedBuffer"}, + FunctionInfo{8209, nullptr, "DisconnectSharedLowLevelLayerFromSharedBuffer"}, + FunctionInfo{8210, nullptr, "CreateSharedLayer"}, + FunctionInfo{8211, nullptr, "DestroySharedLayer"}, + FunctionInfo{8216, nullptr, "AttachSharedLayerToLowLevelLayer"}, + FunctionInfo{8217, nullptr, "ForceDetachSharedLayerFromLowLevelLayer"}, + FunctionInfo{8218, nullptr, "StartDetachSharedLayerFromLowLevelLayer"}, + FunctionInfo{8219, nullptr, "FinishDetachSharedLayerFromLowLevelLayer"}, + FunctionInfo{8220, nullptr, "GetSharedLayerDetachReadyEvent"}, + FunctionInfo{8221, nullptr, "GetSharedLowLevelLayerSynchronizedEvent"}, + FunctionInfo{8222, nullptr, "CheckSharedLowLevelLayerSynchronized"}, + FunctionInfo{8223, nullptr, "RegisterSharedBufferImporterAruid"}, + FunctionInfo{8224, nullptr, "UnregisterSharedBufferImporterAruid"}, + FunctionInfo{8227, nullptr, "CreateSharedBufferProcessHeap"}, + FunctionInfo{8228, nullptr, "GetSharedLayerLayerStacks"}, + FunctionInfo{8229, nullptr, "SetSharedLayerLayerStacks"}, + FunctionInfo{8291, nullptr, "PresentDetachedSharedFrameBufferToLowLevelLayer"}, + FunctionInfo{8292, nullptr, "FillDetachedSharedFrameBufferColor"}, + FunctionInfo{8293, nullptr, "GetDetachedSharedFrameBufferImage"}, + FunctionInfo{8294, nullptr, "SetDetachedSharedFrameBufferImage"}, + FunctionInfo{8295, nullptr, "CopyDetachedSharedFrameBufferImage"}, + FunctionInfo{8296, nullptr, "SetDetachedSharedFrameBufferSubImage"}, + FunctionInfo{8297, nullptr, "GetSharedFrameBufferContentParameter"}, + FunctionInfo{8298, nullptr, "ExpandStartupLogoOnSharedFrameBuffer"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IManagerDisplayService::IManagerDisplayService(Core::System& system_, std::shared_ptr container) : ServiceFramework{system_, "IManagerDisplayService"}, m_container{std::move(container)} { - // clang-format off - static const FunctionInfo functions[] = { - {200, nullptr, "AllocateProcessHeapBlock"}, - {201, nullptr, "FreeProcessHeapBlock"}, - {1102, nullptr, "GetDisplayResolution"}, - {2010, C<&IManagerDisplayService::CreateManagedLayer>, "CreateManagedLayer"}, - {2011, C<&IManagerDisplayService::DestroyManagedLayer>, "DestroyManagedLayer"}, - {2012, nullptr, "CreateStrayLayer"}, - {2050, nullptr, "CreateIndirectLayer"}, - {2051, nullptr, "DestroyIndirectLayer"}, - {2052, nullptr, "CreateIndirectProducerEndPoint"}, - {2053, nullptr, "DestroyIndirectProducerEndPoint"}, - {2054, nullptr, "CreateIndirectConsumerEndPoint"}, - {2055, nullptr, "DestroyIndirectConsumerEndPoint"}, - {2060, nullptr, "CreateWatermarkCompositor"}, - {2062, nullptr, "SetWatermarkText"}, - {2063, nullptr, "SetWatermarkLayerStacks"}, - {2300, nullptr, "AcquireLayerTexturePresentingEvent"}, - {2301, nullptr, "ReleaseLayerTexturePresentingEvent"}, - {2302, nullptr, "GetDisplayHotplugEvent"}, - {2303, nullptr, "GetDisplayModeChangedEvent"}, - {2402, nullptr, "GetDisplayHotplugState"}, - {2501, nullptr, "GetCompositorErrorInfo"}, - {2601, nullptr, "GetDisplayErrorEvent"}, - {2701, nullptr, "GetDisplayFatalErrorEvent"}, - {4201, nullptr, "SetDisplayAlpha"}, - {4203, nullptr, "SetDisplayLayerStack"}, - {4205, nullptr, "SetDisplayPowerState"}, - {4206, nullptr, "SetDefaultDisplay"}, - {4207, nullptr, "ResetDisplayPanel"}, - {4208, nullptr, "SetDisplayFatalErrorEnabled"}, - {4209, nullptr, "IsDisplayPanelOn"}, - {4300, nullptr, "GetInternalPanelId"}, - {6000, C<&IManagerDisplayService::AddToLayerStack>, "AddToLayerStack"}, - {6001, nullptr, "RemoveFromLayerStack"}, - {6002, C<&IManagerDisplayService::SetLayerVisibility>, "SetLayerVisibility"}, - {6003, nullptr, "SetLayerConfig"}, - {6004, nullptr, "AttachLayerPresentationTracer"}, - {6005, nullptr, "DetachLayerPresentationTracer"}, - {6006, nullptr, "StartLayerPresentationRecording"}, - {6007, nullptr, "StopLayerPresentationRecording"}, - {6008, nullptr, "StartLayerPresentationFenceWait"}, - {6009, nullptr, "StopLayerPresentationFenceWait"}, - {6010, nullptr, "GetLayerPresentationAllFencesExpiredEvent"}, - {6011, nullptr, "EnableLayerAutoClearTransitionBuffer"}, - {6012, nullptr, "DisableLayerAutoClearTransitionBuffer"}, - {6013, nullptr, "SetLayerOpacity"}, - {6014, nullptr, "AttachLayerWatermarkCompositor"}, - {6015, nullptr, "DetachLayerWatermarkCompositor"}, - {7000, nullptr, "SetContentVisibility"}, - {8000, nullptr, "SetConductorLayer"}, - {8001, nullptr, "SetTimestampTracking"}, - {8100, nullptr, "SetIndirectProducerFlipOffset"}, - {8200, nullptr, "CreateSharedBufferStaticStorage"}, - {8201, nullptr, "CreateSharedBufferTransferMemory"}, - {8202, nullptr, "DestroySharedBuffer"}, - {8203, nullptr, "BindSharedLowLevelLayerToManagedLayer"}, - {8204, nullptr, "BindSharedLowLevelLayerToIndirectLayer"}, - {8207, nullptr, "UnbindSharedLowLevelLayer"}, - {8208, nullptr, "ConnectSharedLowLevelLayerToSharedBuffer"}, - {8209, nullptr, "DisconnectSharedLowLevelLayerFromSharedBuffer"}, - {8210, nullptr, "CreateSharedLayer"}, - {8211, nullptr, "DestroySharedLayer"}, - {8216, nullptr, "AttachSharedLayerToLowLevelLayer"}, - {8217, nullptr, "ForceDetachSharedLayerFromLowLevelLayer"}, - {8218, nullptr, "StartDetachSharedLayerFromLowLevelLayer"}, - {8219, nullptr, "FinishDetachSharedLayerFromLowLevelLayer"}, - {8220, nullptr, "GetSharedLayerDetachReadyEvent"}, - {8221, nullptr, "GetSharedLowLevelLayerSynchronizedEvent"}, - {8222, nullptr, "CheckSharedLowLevelLayerSynchronized"}, - {8223, nullptr, "RegisterSharedBufferImporterAruid"}, - {8224, nullptr, "UnregisterSharedBufferImporterAruid"}, - {8227, nullptr, "CreateSharedBufferProcessHeap"}, - {8228, nullptr, "GetSharedLayerLayerStacks"}, - {8229, nullptr, "SetSharedLayerLayerStacks"}, - {8291, nullptr, "PresentDetachedSharedFrameBufferToLowLevelLayer"}, - {8292, nullptr, "FillDetachedSharedFrameBufferColor"}, - {8293, nullptr, "GetDetachedSharedFrameBufferImage"}, - {8294, nullptr, "SetDetachedSharedFrameBufferImage"}, - {8295, nullptr, "CopyDetachedSharedFrameBufferImage"}, - {8296, nullptr, "SetDetachedSharedFrameBufferSubImage"}, - {8297, nullptr, "GetSharedFrameBufferContentParameter"}, - {8298, nullptr, "ExpandStartupLogoOnSharedFrameBuffer"}, - }; - // clang-format on - - RegisterHandlers(functions); } IManagerDisplayService::~IManagerDisplayService() = default; diff --git a/src/core/hle/service/vi/manager_display_service.h b/src/core/hle/service/vi/manager_display_service.h index 14a107cb43..1c7a79f337 100644 --- a/src/core/hle/service/vi/manager_display_service.h +++ b/src/core/hle/service/vi/manager_display_service.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project @@ -37,6 +37,7 @@ public: Result SetLayerVisibility(bool visible, u64 layer_id); private: + std::optional FindRequest(u32 key) override; const std::shared_ptr m_container; }; diff --git a/src/core/hle/service/vi/manager_root_service.cpp b/src/core/hle/service/vi/manager_root_service.cpp index 0f16a15b4a..0cc98bc2c0 100644 --- a/src/core/hle/service/vi/manager_root_service.cpp +++ b/src/core/hle/service/vi/manager_root_service.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -12,18 +15,21 @@ namespace Service::VI { +std::optional IManagerRootService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{2, C<&IManagerRootService::GetDisplayService>, "GetDisplayService"}, + FunctionInfo{3, nullptr, "GetDisplayServiceWithProxyNameExchange"}, + FunctionInfo{100, nullptr, "PrepareFatal"}, + FunctionInfo{101, nullptr, "ShowFatal"}, + FunctionInfo{102, nullptr, "DrawFatalRectangle"}, + FunctionInfo{103, nullptr, "DrawFatalText32"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IManagerRootService::IManagerRootService(Core::System& system_, std::shared_ptr container) : ServiceFramework{system_, "vi:m"}, m_container{std::move(container)} { - static const FunctionInfo functions[] = { - {2, C<&IManagerRootService::GetDisplayService>, "GetDisplayService"}, - {3, nullptr, "GetDisplayServiceWithProxyNameExchange"}, - {100, nullptr, "PrepareFatal"}, - {101, nullptr, "ShowFatal"}, - {102, nullptr, "DrawFatalRectangle"}, - {103, nullptr, "DrawFatalText32"}, - }; - RegisterHandlers(functions); } IManagerRootService::~IManagerRootService() = default; diff --git a/src/core/hle/service/vi/manager_root_service.h b/src/core/hle/service/vi/manager_root_service.h index 77cd328699..78c0d1f80d 100644 --- a/src/core/hle/service/vi/manager_root_service.h +++ b/src/core/hle/service/vi/manager_root_service.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -26,6 +29,7 @@ public: Policy policy); private: + std::optional FindRequest(u32 key) override; const std::shared_ptr m_container; }; diff --git a/src/core/hle/service/vi/shared_buffer_manager.h b/src/core/hle/service/vi/shared_buffer_manager.h index 807db10f31..d1ce57ee27 100644 --- a/src/core/hle/service/vi/shared_buffer_manager.h +++ b/src/core/hle/service/vi/shared_buffer_manager.h @@ -18,6 +18,10 @@ class KPageGroup; class KReadableEvent; } // namespace Kernel +namespace Core { +class System; +} + namespace Service::android { class BufferQueueProducer; } diff --git a/src/core/hle/service/vi/system_display_service.cpp b/src/core/hle/service/vi/system_display_service.cpp index 0956053dcf..997f0a51fc 100644 --- a/src/core/hle/service/vi/system_display_service.cpp +++ b/src/core/hle/service/vi/system_display_service.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project @@ -12,63 +12,63 @@ namespace Service::VI { -ISystemDisplayService::ISystemDisplayService(Core::System& system_, - std::shared_ptr container) - : ServiceFramework{system_, "ISystemDisplayService"}, m_container{std::move(container)} { - // clang-format off - static const FunctionInfo functions[] = { - {1200, nullptr, "GetZOrderCountMin"}, - {1202, nullptr, "GetZOrderCountMax"}, - {1203, nullptr, "GetDisplayLogicalResolution"}, - {1204, nullptr, "SetDisplayMagnification"}, - {2201, nullptr, "SetLayerPosition"}, - {2203, nullptr, "SetLayerSize"}, - {2204, C<&ISystemDisplayService::GetLayerZ>, "GetLayerZ"}, - {2205, C<&ISystemDisplayService::SetLayerZ>, "SetLayerZ"}, - {2207, C<&ISystemDisplayService::SetLayerVisibility>, "SetLayerVisibility"}, - {2209, nullptr, "SetLayerAlpha"}, - {2210, nullptr, "SetLayerPositionAndSize"}, - {2312, nullptr, "CreateStrayLayer"}, - {2400, nullptr, "OpenIndirectLayer"}, - {2401, nullptr, "CloseIndirectLayer"}, - {2402, nullptr, "FlipIndirectLayer"}, - {3000, C<&ISystemDisplayService::ListDisplayModes>, "ListDisplayModes"}, - {3001, nullptr, "ListDisplayRgbRanges"}, - {3002, nullptr, "ListDisplayContentTypes"}, - {3200, C<&ISystemDisplayService::GetDisplayMode>, "GetDisplayMode"}, - {3201, nullptr, "SetDisplayMode"}, - {3202, nullptr, "GetDisplayUnderscan"}, - {3203, nullptr, "SetDisplayUnderscan"}, - {3204, nullptr, "GetDisplayContentType"}, - {3205, nullptr, "SetDisplayContentType"}, - {3206, nullptr, "GetDisplayRgbRange"}, - {3207, nullptr, "SetDisplayRgbRange"}, - {3208, nullptr, "GetDisplayCmuMode"}, - {3209, nullptr, "SetDisplayCmuMode"}, - {3210, nullptr, "GetDisplayContrastRatio"}, - {3211, nullptr, "SetDisplayContrastRatio"}, - {3214, nullptr, "GetDisplayGamma"}, - {3215, nullptr, "SetDisplayGamma"}, - {3216, nullptr, "GetDisplayCmuLuma"}, - {3217, nullptr, "SetDisplayCmuLuma"}, - {3218, nullptr, "SetDisplayCrcMode"}, - {6013, nullptr, "GetLayerPresentationSubmissionTimestamps"}, - {8225, C<&ISystemDisplayService::GetSharedBufferMemoryHandleId>, "GetSharedBufferMemoryHandleId"}, - {8250, C<&ISystemDisplayService::OpenSharedLayer>, "OpenSharedLayer"}, - {8251, nullptr, "CloseSharedLayer"}, - {8252, C<&ISystemDisplayService::ConnectSharedLayer>, "ConnectSharedLayer"}, - {8253, nullptr, "DisconnectSharedLayer"}, - {8254, C<&ISystemDisplayService::AcquireSharedFrameBuffer>, "AcquireSharedFrameBuffer"}, - {8255, C<&ISystemDisplayService::PresentSharedFrameBuffer>, "PresentSharedFrameBuffer"}, - {8256, C<&ISystemDisplayService::GetSharedFrameBufferAcquirableEvent>, "GetSharedFrameBufferAcquirableEvent"}, - {8257, nullptr, "FillSharedFrameBufferColor"}, - {8258, C<&ISystemDisplayService::CancelSharedFrameBuffer>, "CancelSharedFrameBuffer"}, - {9000, nullptr, "GetDp2hdmiController"}, - }; - // clang-format on - RegisterHandlers(functions); +std::optional ISystemDisplayService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{1200, nullptr, "GetZOrderCountMin"}, + FunctionInfo{1202, nullptr, "GetZOrderCountMax"}, + FunctionInfo{1203, nullptr, "GetDisplayLogicalResolution"}, + FunctionInfo{1204, nullptr, "SetDisplayMagnification"}, + FunctionInfo{2201, nullptr, "SetLayerPosition"}, + FunctionInfo{2203, nullptr, "SetLayerSize"}, + FunctionInfo{2204, C<&ISystemDisplayService::GetLayerZ>, "GetLayerZ"}, + FunctionInfo{2205, C<&ISystemDisplayService::SetLayerZ>, "SetLayerZ"}, + FunctionInfo{2207, C<&ISystemDisplayService::SetLayerVisibility>, "SetLayerVisibility"}, + FunctionInfo{2209, nullptr, "SetLayerAlpha"}, + FunctionInfo{2210, nullptr, "SetLayerPositionAndSize"}, + FunctionInfo{2312, nullptr, "CreateStrayLayer"}, + FunctionInfo{2400, nullptr, "OpenIndirectLayer"}, + FunctionInfo{2401, nullptr, "CloseIndirectLayer"}, + FunctionInfo{2402, nullptr, "FlipIndirectLayer"}, + FunctionInfo{3000, C<&ISystemDisplayService::ListDisplayModes>, "ListDisplayModes"}, + FunctionInfo{3001, nullptr, "ListDisplayRgbRanges"}, + FunctionInfo{3002, nullptr, "ListDisplayContentTypes"}, + FunctionInfo{3200, C<&ISystemDisplayService::GetDisplayMode>, "GetDisplayMode"}, + FunctionInfo{3201, nullptr, "SetDisplayMode"}, + FunctionInfo{3202, nullptr, "GetDisplayUnderscan"}, + FunctionInfo{3203, nullptr, "SetDisplayUnderscan"}, + FunctionInfo{3204, nullptr, "GetDisplayContentType"}, + FunctionInfo{3205, nullptr, "SetDisplayContentType"}, + FunctionInfo{3206, nullptr, "GetDisplayRgbRange"}, + FunctionInfo{3207, nullptr, "SetDisplayRgbRange"}, + FunctionInfo{3208, nullptr, "GetDisplayCmuMode"}, + FunctionInfo{3209, nullptr, "SetDisplayCmuMode"}, + FunctionInfo{3210, nullptr, "GetDisplayContrastRatio"}, + FunctionInfo{3211, nullptr, "SetDisplayContrastRatio"}, + FunctionInfo{3214, nullptr, "GetDisplayGamma"}, + FunctionInfo{3215, nullptr, "SetDisplayGamma"}, + FunctionInfo{3216, nullptr, "GetDisplayCmuLuma"}, + FunctionInfo{3217, nullptr, "SetDisplayCmuLuma"}, + FunctionInfo{3218, nullptr, "SetDisplayCrcMode"}, + FunctionInfo{6013, nullptr, "GetLayerPresentationSubmissionTimestamps"}, + FunctionInfo{8225, C<&ISystemDisplayService::GetSharedBufferMemoryHandleId>, "GetSharedBufferMemoryHandleId"}, + FunctionInfo{8250, C<&ISystemDisplayService::OpenSharedLayer>, "OpenSharedLayer"}, + FunctionInfo{8251, nullptr, "CloseSharedLayer"}, + FunctionInfo{8252, C<&ISystemDisplayService::ConnectSharedLayer>, "ConnectSharedLayer"}, + FunctionInfo{8253, nullptr, "DisconnectSharedLayer"}, + FunctionInfo{8254, C<&ISystemDisplayService::AcquireSharedFrameBuffer>, "AcquireSharedFrameBuffer"}, + FunctionInfo{8255, C<&ISystemDisplayService::PresentSharedFrameBuffer>, "PresentSharedFrameBuffer"}, + FunctionInfo{8256, C<&ISystemDisplayService::GetSharedFrameBufferAcquirableEvent>, "GetSharedFrameBufferAcquirableEvent"}, + FunctionInfo{8257, nullptr, "FillSharedFrameBufferColor"}, + FunctionInfo{8258, C<&ISystemDisplayService::CancelSharedFrameBuffer>, "CancelSharedFrameBuffer"}, + FunctionInfo{9000, nullptr, "GetDp2hdmiController"} + ); + return HandlerTableGenerateWithFind(key, functions); } +ISystemDisplayService::ISystemDisplayService(Core::System& system_, std::shared_ptr container) + : ServiceFramework{system_, "ISystemDisplayService"}, m_container{std::move(container)} +{} + ISystemDisplayService::~ISystemDisplayService() = default; Result ISystemDisplayService::GetLayerZ(Out out_z_value, u64 layer_id) { diff --git a/src/core/hle/service/vi/system_display_service.h b/src/core/hle/service/vi/system_display_service.h index a3b88c519d..04c9f0977e 100644 --- a/src/core/hle/service/vi/system_display_service.h +++ b/src/core/hle/service/vi/system_display_service.h @@ -47,6 +47,7 @@ private: Result CancelSharedFrameBuffer(u64 layer_id, s64 slot); private: + std::optional FindRequest(u32 key) override; const std::shared_ptr m_container; }; diff --git a/src/core/hle/service/vi/system_root_service.cpp b/src/core/hle/service/vi/system_root_service.cpp index 3489727d81..c078be37a3 100644 --- a/src/core/hle/service/vi/system_root_service.cpp +++ b/src/core/hle/service/vi/system_root_service.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -11,15 +14,18 @@ namespace Service::VI { -ISystemRootService::ISystemRootService(Core::System& system_, std::shared_ptr container) - : ServiceFramework{system_, "vi:s"}, m_container{std::move(container)} { - static const FunctionInfo functions[] = { - {1, C<&ISystemRootService::GetDisplayService>, "GetDisplayService"}, - {3, nullptr, "GetDisplayServiceWithProxyNameExchange"}, - }; - RegisterHandlers(functions); +std::optional ISystemRootService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{1, C<&ISystemRootService::GetDisplayService>, "GetDisplayService"}, + FunctionInfo{3, nullptr, "GetDisplayServiceWithProxyNameExchange"} + ); + return HandlerTableGenerateWithFind(key, functions); } +ISystemRootService::ISystemRootService(Core::System& system_, std::shared_ptr container) + : ServiceFramework{system_, "vi:s"}, m_container{std::move(container)} +{} + ISystemRootService::~ISystemRootService() = default; Result ISystemRootService::GetDisplayService( diff --git a/src/core/hle/service/vi/system_root_service.h b/src/core/hle/service/vi/system_root_service.h index 9d5aa53d38..baf516fec5 100644 --- a/src/core/hle/service/vi/system_root_service.h +++ b/src/core/hle/service/vi/system_root_service.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -26,6 +29,7 @@ private: Out> out_application_display_service, Policy policy); + std::optional FindRequest(u32 key) override; const std::shared_ptr m_container; }; diff --git a/src/core/hle/service/wlan/wlan.cpp b/src/core/hle/service/wlan/wlan.cpp index bcd357d57a..fa68ff51ba 100644 --- a/src/core/hle/service/wlan/wlan.cpp +++ b/src/core/hle/service/wlan/wlan.cpp @@ -16,232 +16,248 @@ class ILocalManager final : public ServiceFramework { public: explicit ILocalManager(Core::System& system_) : ServiceFramework{system_, "wlan:lcl"} - { - static const FunctionInfo functions[] = { - { 0, nullptr, "OpenMasterMode" }, - { 0, nullptr, "OpenMode_2" }, - { 1, nullptr, "CloseMasterMode" }, - { 1, nullptr, "CloseMode_2" }, - { 2, nullptr, "OpenClientMode" }, - { 2, nullptr, "GetMacAddress_2" }, - { 3, nullptr, "CloseClientMode" }, - { 3, nullptr, "CreateBss" }, - { 4, nullptr, "OpenSpectatorMode" }, - { 4, nullptr, "DestroyBss" }, - { 5, nullptr, "CloseSpectatorMode" }, - { 5, nullptr, "StartScan_2" }, - { 6, nullptr, "GetMacAddress_2" }, - { 6, nullptr, "StopScan_2" }, - { 7, nullptr, "CreateBss" }, - { 7, nullptr, "Connect_2" }, - { 8, nullptr, "DestroyBss" }, - { 8, nullptr, "CancelConnect_2" }, - { 9, nullptr, "StartScan_2" }, - { 9, nullptr, "Join" }, - { 10, nullptr, "StopScan_2" }, - { 10, nullptr, "CancelJoin" }, - { 11, nullptr, "Connect_2" }, - { 11, nullptr, "Disconnect_2" }, - { 12, nullptr, "CancelConnect_2" }, - { 12, nullptr, "SetBeaconLostCount" }, - { 13, nullptr, "Join" }, - { 13, nullptr, "GetSystemEvent_2" }, - { 14, nullptr, "CancelJoin" }, - { 14, nullptr, "GetConnectionStatus_2" }, - { 15, nullptr, "Disconnect_2" }, - { 15, nullptr, "GetClientStatus" }, - { 16, nullptr, "SetBeaconLostCount" }, - { 16, nullptr, "GetBssIndicationEvent" }, - { 17, nullptr, "GetSystemEvent_2" }, - { 17, nullptr, "GetBssIndicationInfo" }, - { 18, nullptr, "GetConnectionStatus_2" }, - { 18, nullptr, "GetState_2" }, - { 19, nullptr, "GetClientStatus" }, - { 19, nullptr, "GetAllowedChannels" }, - { 20, nullptr, "GetBssIndicationEvent" }, - { 20, nullptr, "AddIe" }, - { 21, nullptr, "GetBssIndicationInfo" }, - { 21, nullptr, "DeleteIe" }, - { 22, nullptr, "GetState_2" }, - { 22, nullptr, "PutFrameRaw" }, - { 23, nullptr, "GetAllowedChannels" }, - { 23, nullptr, "CancelGetFrame" }, - { 24, nullptr, "AddIe" }, - { 24, nullptr, "CreateRxEntry" }, - { 25, nullptr, "DeleteIe" }, - { 25, nullptr, "DeleteRxEntry" }, - { 26, nullptr, "PutFrameRaw" }, - { 26, nullptr, "AddEthertypeToRxEntry" }, - { 27, nullptr, "CancelGetFrame" }, - { 27, nullptr, "DeleteEthertypeFromRxEntry" }, - { 28, nullptr, "CreateRxEntry" }, - { 28, nullptr, "AddMatchingDataToRxEntry" }, - { 29, nullptr, "DeleteRxEntry" }, - { 29, nullptr, "RemoveMatchingDataFromRxEntry" }, - { 30, nullptr, "AddEthertypeToRxEntry" }, - { 30, nullptr, "GetScanResult_2" }, - { 31, nullptr, "DeleteEthertypeFromRxEntry" }, - { 31, nullptr, "PutActionFrameOneShot" }, - { 32, nullptr, "AddMatchingDataToRxEntry" }, - { 32, nullptr, "SetActionFrameWithBeacon" }, - { 33, nullptr, "RemoveMatchingDataFromRxEntry" }, - { 33, nullptr, "CancelActionFrameWithBeacon" }, - { 34, nullptr, "GetScanResult_2" }, - { 34, nullptr, "CreateRxEntryForActionFrame" }, - { 35, nullptr, "PutActionFrameOneShot" }, - { 35, nullptr, "DeleteRxEntryForActionFrame" }, - { 36, nullptr, "SetActionFrameWithBeacon" }, - { 36, nullptr, "AddSubtypeToRxEntryForActionFrame" }, - { 37, nullptr, "CancelActionFrameWithBeacon" }, - { 37, nullptr, "DeleteSubtypeFromRxEntryForActionFrame" }, - { 38, nullptr, "CreateRxEntryForActionFrame" }, - { 38, nullptr, "CancelGetActionFrame" }, - { 39, nullptr, "DeleteRxEntryForActionFrame" }, - { 39, nullptr, "GetRssi_2" }, - { 40, nullptr, "AddSubtypeToRxEntryForActionFrame" }, - { 40, nullptr, "SetMaxAssociationNumber" }, - { 41, nullptr, "DeleteSubtypeFromRxEntryForActionFrame" }, - { 41, nullptr, "Cmd41" }, - { 42, nullptr, "CancelGetActionFrame" }, - { 42, nullptr, "Cmd42" }, - { 43, nullptr, "GetRssi_2" }, - { 43, nullptr, "Cmd43" }, - { 44, nullptr, "SetMaxAssociationNumber" }, - { 45, nullptr, "OpenLcsMasterMode" }, - { 46, nullptr, "CloseLcsMasterMode" }, - { 47, nullptr, "OpenLcsClientMode" }, - { 48, nullptr, "CloseLcsClientMode" }, - { 49, nullptr, "GetChannelStats" }, - { 50, nullptr, "Cmd50" }, - { 51, nullptr, "Cmd51" }, - { 52, nullptr, "Cmd52" }, - }; - RegisterHandlers(functions); + {} + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "OpenMasterMode"}, + FunctionInfo{0, nullptr, "OpenMode_2"}, + FunctionInfo{1, nullptr, "CloseMasterMode"}, + FunctionInfo{1, nullptr, "CloseMode_2"}, + FunctionInfo{2, nullptr, "OpenClientMode"}, + FunctionInfo{2, nullptr, "GetMacAddress_2"}, + FunctionInfo{3, nullptr, "CloseClientMode"}, + FunctionInfo{3, nullptr, "CreateBss"}, + FunctionInfo{4, nullptr, "OpenSpectatorMode"}, + FunctionInfo{4, nullptr, "DestroyBss"}, + FunctionInfo{5, nullptr, "CloseSpectatorMode"}, + FunctionInfo{5, nullptr, "StartScan_2"}, + FunctionInfo{6, nullptr, "GetMacAddress_2"}, + FunctionInfo{6, nullptr, "StopScan_2"}, + FunctionInfo{7, nullptr, "CreateBss"}, + FunctionInfo{7, nullptr, "Connect_2"}, + FunctionInfo{8, nullptr, "DestroyBss"}, + FunctionInfo{8, nullptr, "CancelConnect_2"}, + FunctionInfo{9, nullptr, "StartScan_2"}, + FunctionInfo{9, nullptr, "Join"}, + FunctionInfo{10, nullptr, "StopScan_2"}, + FunctionInfo{10, nullptr, "CancelJoin"}, + FunctionInfo{11, nullptr, "Connect_2"}, + FunctionInfo{11, nullptr, "Disconnect_2"}, + FunctionInfo{12, nullptr, "CancelConnect_2"}, + FunctionInfo{12, nullptr, "SetBeaconLostCount"}, + FunctionInfo{13, nullptr, "Join"}, + FunctionInfo{13, nullptr, "GetSystemEvent_2"}, + FunctionInfo{14, nullptr, "CancelJoin"}, + FunctionInfo{14, nullptr, "GetConnectionStatus_2"}, + FunctionInfo{15, nullptr, "Disconnect_2"}, + FunctionInfo{15, nullptr, "GetClientStatus"}, + FunctionInfo{16, nullptr, "SetBeaconLostCount"}, + FunctionInfo{16, nullptr, "GetBssIndicationEvent"}, + FunctionInfo{17, nullptr, "GetSystemEvent_2"}, + FunctionInfo{17, nullptr, "GetBssIndicationInfo"}, + FunctionInfo{18, nullptr, "GetConnectionStatus_2"}, + FunctionInfo{18, nullptr, "GetState_2"}, + FunctionInfo{19, nullptr, "GetClientStatus"}, + FunctionInfo{19, nullptr, "GetAllowedChannels"}, + FunctionInfo{20, nullptr, "GetBssIndicationEvent"}, + FunctionInfo{20, nullptr, "AddIe"}, + FunctionInfo{21, nullptr, "GetBssIndicationInfo"}, + FunctionInfo{21, nullptr, "DeleteIe"}, + FunctionInfo{22, nullptr, "GetState_2"}, + FunctionInfo{22, nullptr, "PutFrameRaw"}, + FunctionInfo{23, nullptr, "GetAllowedChannels"}, + FunctionInfo{23, nullptr, "CancelGetFrame"}, + FunctionInfo{24, nullptr, "AddIe"}, + FunctionInfo{24, nullptr, "CreateRxEntry"}, + FunctionInfo{25, nullptr, "DeleteIe"}, + FunctionInfo{25, nullptr, "DeleteRxEntry"}, + FunctionInfo{26, nullptr, "PutFrameRaw"}, + FunctionInfo{26, nullptr, "AddEthertypeToRxEntry"}, + FunctionInfo{27, nullptr, "CancelGetFrame"}, + FunctionInfo{27, nullptr, "DeleteEthertypeFromRxEntry"}, + FunctionInfo{28, nullptr, "CreateRxEntry"}, + FunctionInfo{28, nullptr, "AddMatchingDataToRxEntry"}, + FunctionInfo{29, nullptr, "DeleteRxEntry"}, + FunctionInfo{29, nullptr, "RemoveMatchingDataFromRxEntry"}, + FunctionInfo{30, nullptr, "AddEthertypeToRxEntry"}, + FunctionInfo{30, nullptr, "GetScanResult_2"}, + FunctionInfo{31, nullptr, "DeleteEthertypeFromRxEntry"}, + FunctionInfo{31, nullptr, "PutActionFrameOneShot"}, + FunctionInfo{32, nullptr, "AddMatchingDataToRxEntry"}, + FunctionInfo{32, nullptr, "SetActionFrameWithBeacon"}, + FunctionInfo{33, nullptr, "RemoveMatchingDataFromRxEntry"}, + FunctionInfo{33, nullptr, "CancelActionFrameWithBeacon"}, + FunctionInfo{34, nullptr, "GetScanResult_2"}, + FunctionInfo{34, nullptr, "CreateRxEntryForActionFrame"}, + FunctionInfo{35, nullptr, "PutActionFrameOneShot"}, + FunctionInfo{35, nullptr, "DeleteRxEntryForActionFrame"}, + FunctionInfo{36, nullptr, "SetActionFrameWithBeacon"}, + FunctionInfo{36, nullptr, "AddSubtypeToRxEntryForActionFrame"}, + FunctionInfo{37, nullptr, "CancelActionFrameWithBeacon"}, + FunctionInfo{37, nullptr, "DeleteSubtypeFromRxEntryForActionFrame"}, + FunctionInfo{38, nullptr, "CreateRxEntryForActionFrame"}, + FunctionInfo{38, nullptr, "CancelGetActionFrame"}, + FunctionInfo{39, nullptr, "DeleteRxEntryForActionFrame"}, + FunctionInfo{39, nullptr, "GetRssi_2"}, + FunctionInfo{40, nullptr, "AddSubtypeToRxEntryForActionFrame"}, + FunctionInfo{40, nullptr, "SetMaxAssociationNumber"}, + FunctionInfo{41, nullptr, "DeleteSubtypeFromRxEntryForActionFrame"}, + FunctionInfo{41, nullptr, "Cmd41"}, + FunctionInfo{42, nullptr, "CancelGetActionFrame"}, + FunctionInfo{42, nullptr, "Cmd42"}, + FunctionInfo{43, nullptr, "GetRssi_2"}, + FunctionInfo{43, nullptr, "Cmd43"}, + FunctionInfo{44, nullptr, "SetMaxAssociationNumber"}, + FunctionInfo{45, nullptr, "OpenLcsMasterMode"}, + FunctionInfo{46, nullptr, "CloseLcsMasterMode"}, + FunctionInfo{47, nullptr, "OpenLcsClientMode"}, + FunctionInfo{48, nullptr, "CloseLcsClientMode"}, + FunctionInfo{49, nullptr, "GetChannelStats"}, + FunctionInfo{50, nullptr, "Cmd50"}, + FunctionInfo{51, nullptr, "Cmd51"}, + FunctionInfo{52, nullptr, "Cmd52"} + ); }; class ILocalGetFrame final : public ServiceFramework { public: explicit ILocalGetFrame(Core::System& system_) : ServiceFramework{system_, "wlan:lg"} - { - static const FunctionInfo functions[] = { - { 0, nullptr, "GetFrameRaw" }, - }; - RegisterHandlers(functions); + {} + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetFrameRaw" } + ); }; class ILocalGetActionFrame final : public ServiceFramework { public: explicit ILocalGetActionFrame(Core::System& system_) : ServiceFramework{system_, "wlan:lga"} - { - static const FunctionInfo functions[] = { - { 0, nullptr, "GetActionFrame" }, - }; - RegisterHandlers(functions); + {} + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetActionFrame" } + ); }; class ISocketGetFrame final : public ServiceFramework { public: explicit ISocketGetFrame(Core::System& system_) : ServiceFramework{system_, "wlan:sg"} - { - static const FunctionInfo functions[] = { - { 0, nullptr, "GetFrameRaw" }, - }; - RegisterHandlers(functions); + {} + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetFrameRaw" } + ); }; class ISocketManager final : public ServiceFramework { public: explicit ISocketManager(Core::System& system_) : ServiceFramework{system_, "wlan:soc"} - { - static const FunctionInfo functions[] = { - { 0, nullptr, "PutFrameRaw_2" }, - { 1, nullptr, "CancelGetFrame_2" }, - { 2, nullptr, "CreateRxEntry_2" }, - { 3, nullptr, "DeleteRxEntry_2" }, - { 4, nullptr, "AddEthertypeToRxEntry_2" }, - { 5, nullptr, "DeleteEthertypeFromRxEntry_2" }, - { 6, nullptr, "GetMacAddress_3" }, - { 7, nullptr, "SwitchTsfTimerFunction" }, - { 8, nullptr, "GetDeltaTimeBetweenSystemAndTsf" }, - { 9, nullptr, "RegisterSharedMemory" }, - { 10, nullptr, "UnregisterSharedMemory" }, - { 11, nullptr, "EnableSharedMemory" }, - { 12, nullptr, "SetMulticastFilter" }, - }; - RegisterHandlers(functions); + {} + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "PutFrameRaw_2"}, + FunctionInfo{1, nullptr, "CancelGetFrame_2"}, + FunctionInfo{2, nullptr, "CreateRxEntry_2"}, + FunctionInfo{3, nullptr, "DeleteRxEntry_2"}, + FunctionInfo{4, nullptr, "AddEthertypeToRxEntry_2"}, + FunctionInfo{5, nullptr, "DeleteEthertypeFromRxEntry_2"}, + FunctionInfo{6, nullptr, "GetMacAddress_3"}, + FunctionInfo{7, nullptr, "SwitchTsfTimerFunction"}, + FunctionInfo{8, nullptr, "GetDeltaTimeBetweenSystemAndTsf"}, + FunctionInfo{9, nullptr, "RegisterSharedMemory"}, + FunctionInfo{10, nullptr, "UnregisterSharedMemory"}, + FunctionInfo{11, nullptr, "EnableSharedMemory"}, + FunctionInfo{12, nullptr, "SetMulticastFilter"} + ); }; class IDetectManager final : public ServiceFramework { public: explicit IDetectManager(Core::System& system_) : ServiceFramework{system_, "wlan:dtc"} - { - static const FunctionInfo functions[] = { - { 0, nullptr, "Cmd0" }, - { 1, nullptr, "Cmd1" }, - { 2, nullptr, "Cmd2" }, - { 3, nullptr, "Cmd3" }, - { 4, nullptr, "Cmd4" }, - { 5, nullptr, "Cmd5" }, - { 6, nullptr, "Cmd6" }, - { 7, nullptr, "Cmd7" }, - { 8, nullptr, "Cmd8" }, - { 9, nullptr, "Cmd9" }, - { 10, nullptr, "Cmd10" }, - { 11, nullptr, "Cmd11" }, - { 12, nullptr, "Cmd12" }, - { 13, nullptr, "Cmd13" }, - { 14, nullptr, "Cmd14" }, - { 15, nullptr, "Cmd15" }, - { 16, nullptr, "Cmd16" }, - { 17, nullptr, "Cmd17" }, - { 18, nullptr, "Cmd18" }, - { 19, nullptr, "Cmd19" }, - { 20, nullptr, "Cmd20" }, - { 21, nullptr, "Cmd21" }, - { 22, nullptr, "Cmd22" }, - { 23, nullptr, "Cmd23" }, - { 24, nullptr, "Cmd24" }, - { 25, nullptr, "Cmd25" }, - { 26, nullptr, "Cmd26" }, - { 27, nullptr, "Cmd27" }, - }; - RegisterHandlers(functions); + {} + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "Cmd0"}, + FunctionInfo{1, nullptr, "Cmd1"}, + FunctionInfo{2, nullptr, "Cmd2"}, + FunctionInfo{3, nullptr, "Cmd3"}, + FunctionInfo{4, nullptr, "Cmd4"}, + FunctionInfo{5, nullptr, "Cmd5"}, + FunctionInfo{6, nullptr, "Cmd6"}, + FunctionInfo{7, nullptr, "Cmd7"}, + FunctionInfo{8, nullptr, "Cmd8"}, + FunctionInfo{9, nullptr, "Cmd9"}, + FunctionInfo{10, nullptr, "Cmd10"}, + FunctionInfo{11, nullptr, "Cmd11"}, + FunctionInfo{12, nullptr, "Cmd12"}, + FunctionInfo{13, nullptr, "Cmd13"}, + FunctionInfo{14, nullptr, "Cmd14"}, + FunctionInfo{15, nullptr, "Cmd15"}, + FunctionInfo{16, nullptr, "Cmd16"}, + FunctionInfo{17, nullptr, "Cmd17"}, + FunctionInfo{18, nullptr, "Cmd18"}, + FunctionInfo{19, nullptr, "Cmd19"}, + FunctionInfo{20, nullptr, "Cmd20"}, + FunctionInfo{21, nullptr, "Cmd21"}, + FunctionInfo{22, nullptr, "Cmd22"}, + FunctionInfo{23, nullptr, "Cmd23"}, + FunctionInfo{24, nullptr, "Cmd24"}, + FunctionInfo{25, nullptr, "Cmd25"}, + FunctionInfo{26, nullptr, "Cmd26"}, + FunctionInfo{27, nullptr, "Cmd27"} + ); }; class IPrivateServiceCreator final : public ServiceFramework { public: explicit IPrivateServiceCreator(Core::System& system_) : ServiceFramework{system_, "wlan:p"} - { - static const FunctionInfo functions[] = { - { 0, nullptr, "CreateWirelessCommunicationService" }, - { 1, nullptr, "CreatePrivateWirelessCommunicationService" }, - }; - RegisterHandlers(functions); + {} + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "CreateWirelessCommunicationService"}, + FunctionInfo{1, nullptr, "CreatePrivateWirelessCommunicationService"} + ); }; class ISfDriverServiceCreator final : public ServiceFramework { public: explicit ISfDriverServiceCreator(Core::System& system_) : ServiceFramework{system_, "wlan:nd"} - { - static const FunctionInfo functions[] = { - { 0, nullptr, "CreateDriverService" }, - }; - RegisterHandlers(functions); + {} + + std::optional FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "CreateDriverService" } + ); }; void LoopProcess(Core::System& system) { diff --git a/tools/README.md b/tools/README.md index cde6a21464..f6a520a69c 100644 --- a/tools/README.md +++ b/tools/README.md @@ -8,7 +8,7 @@ Tools for Eden and other subprojects. When adding new scripts please use `#!/bin ## Binaries -- `maxwell-spirv`: Converts Maxwell shaders (dumped from `.ash` files) into SPIR-V code (emitted into STDOUT). +- `maxwell-spirv`: Converts Maxwell shaders (dumped from `.ash` files) into SPIR-V code sent to stdout. - `maxwell-disas`: Dumb raw Maxwell disassembler. - `maxwell-ir`: Dump generated IR of Maxwell shaders. From 6b3cb5772b6e4875f088e5b48e089a3b3fda7f0d Mon Sep 17 00:00:00 2001 From: crueter Date: Tue, 13 Oct 2026 23:54:51 +0200 Subject: [PATCH 10/32] [docs] revise AI policy (#4522) spent 2 hours on a document award This is a revised version of our original AI policy that is cautiously permissive to skilled developers using AI responsibly, while hopefully keeping out the script kiddies spamming their mom's credit card on Claude tokens. This will be trialed for at least a week once merged, any revisions/changes should be made within the next few months Signed-off-by: crueter - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4522 Reviewed-by: lizzie Reviewed-by: MaranBr --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- AGENTS.md | 8 +- CLAUDE.md | 1 - CONTRIBUTING.md | 7 +- docs/policies/AI.md | 199 ++++++++++++++++++++++--------- 5 files changed, 152 insertions(+), 65 deletions(-) delete mode 100644 CLAUDE.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 8d42a0ab27..422efb5fdc 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,5 +1,5 @@ - [ ] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). -- [ ] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) +- [ ] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md). - [ ] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- diff --git a/AGENTS.md b/AGENTS.md index aabea77170..05ab7f1160 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1 +1,7 @@ -AI and LLM use is *strictly* prohibited within our codebase and surrounding community, including issues and comments. This includes using AI or LLMs to write docs/commit messages, debug issues, brainstorm ideas, research concepts, or search the codebase. +# AGENTS + +Read and follow the AI policy found in `docs/policies/AI.md`, and the coding policies found in `docs/policies/Coding.md`. + +Do not, under any circumstances, ever submit PRs or push commits on behalf of the user. + +Keep comments to a reasonable level. Do not overexplain or add/remove comments from unrelated parts of the codebase. diff --git a/CLAUDE.md b/CLAUDE.md deleted file mode 100644 index aabea77170..0000000000 --- a/CLAUDE.md +++ /dev/null @@ -1 +0,0 @@ -AI and LLM use is *strictly* prohibited within our codebase and surrounding community, including issues and comments. This includes using AI or LLMs to write docs/commit messages, debug issues, brainstorm ideas, research concepts, or search the codebase. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c09b1c3679..8c16de9ddb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,9 +1,5 @@ # Contributing - - Eden has lots of different ways that you can contribute to its efforts, even without knowing how to write code: - Donate! This will help us live our lives, pay for infrastructure/testing hardware, and more @@ -20,8 +16,7 @@ Eden is free, open-source, copyleft software, licensed under the terms of the [G ### Policies -- No LLM or AI usage, *period*, for patches, pull requests, issues, comments, debugging, brainstorming, etc. - - For details on why, see the [detailed AI policy](docs/policies/AI.md). +- We are trialing a slightly relaxed AI policy to allow high-quality contributors to use AI *responsibly*. Please read our [detailed AI policy](docs/policies/AI.md) for more info. - Usage of any form of profanity or otherwise unsavory language is generally discouraged. - This is primarily because it rarely helps to actually understand what's going on. - Remember that your comments should be focused and actually address what's happening. With very few exceptions, expletives are actively detrimental at best. diff --git a/docs/policies/AI.md b/docs/policies/AI.md index 554a805331..dd4b4a7fb2 100644 --- a/docs/policies/AI.md +++ b/docs/policies/AI.md @@ -1,65 +1,159 @@ # AI Policy -AI and LLM use is *strictly* prohibited within our codebase and surrounding community, including issues and comments. This includes using AI or LLMs to write docs/commit messages, debug issues, brainstorm ideas, research concepts, or search the codebase. +> [!WARNING] +> We are trialing a slightly relaxed AI policy to allow high-quality contributors to use AI *responsibly*. +> This policy is subject to change at any point in time, so check back frequently. +> +> This banner will be removed once we have finalized our revised policy. - [AI Policy](#ai-policy) - - [Low-quality code](#low-quality-code) - - [Licensing concerns](#licensing-concerns) - - [Vibe-coding](#vibe-coding) - - [Commit messages](#commit-messages) - - [Miscellaneous concerns](#miscellaneous-concerns) - - [Unacceptable Use Examples](#unacceptable-use-examples) - - [Addendum: Commit Messages](#addendum-commit-messages) + - [TL;DR](#tldr) + - [Definitions](#definitions) + - [Scope](#scope) + - [Introduction](#introduction) + - [Requirements](#requirements) + - [Sign-off, Authorship, and Copyright](#sign-off-authorship-and-copyright) + - [Permitted Usage](#permitted-usage) + - [Recommended Prior Discussion](#recommended-prior-discussion) + - [Forbidden Usage](#forbidden-usage) + - [Human Effort Denial of Service](#human-effort-denial-of-service) + - [Disclosure](#disclosure) + - [Codebase Ingestion](#codebase-ingestion) + - [Enforcement](#enforcement) + - [Addendum: AI Commit Messages](#addendum-ai-commit-messages) + - [References](#references) -## Low-quality code +## TL;DR -AI is notorious for producing low-quality code; be it: +AI-assisted contributions are welcome, provided you take responsibility for them. -- nonfunctional, -- verbose/inefficient, -- breaking other parts of the codebase, -- or writing/architecting in a completely different style +- You **must** disclose any AI or LLM usage in your pull request description *and* commit message. +- You **must** be able to explain, defend, and revise every line of code you submit. +- Commit messages, PR descriptions, issues, and comments **must** be written by you. Verbatim AI output is not acceptable. +- Undisclosed AI usage will result in your contribution being rejected. +- Low-quality contributions, disclosed or not, will be reworked or rejected. +- Spamming automated PRs, comments, or issues is treated as a Denial of Service (DoS) attack on our reviewers; see [Human Effort Denial of Service](#human-effort-denial-of-service). -All code, AI or not, is held under a **strict standard of excellence**. AI/LLM-generated code will fail this test 10 times out of 10. +## Definitions -## Licensing concerns +An *AI or LLM-based tool* is any piece of software that generates code, text, or other content through machine learning models. This includes, but is not limited to: chat assistants, agentic coding tools/harnesses, inline code completion suggestions you have accepted into the code, and AI-driven explanation/refactoring features. -This is an area of ongoing litigation, and as such, is still very iffy. For the time being, know that allowing AI to ingest the codebase may end up with its copyleft code regurgitated into incompatibly-licensed proprietary or permissive software. For you, this means to **not** feed code into LLMs. +For the purposes of this policy, basic deterministic/static development tools (such as clang-tidy, git, compilers, etc.) are not considered AI tools. -AI models may have also ingested AGPLv3 code, which is license-incompatible with our codebase. +Terms such as "substantially", "large-scale", "majority", and "low-quality" are intentionally left vague, and will be interpreted at the maintainers' discretion. When in doubt, ask first. -## Vibe-coding +## Scope -Just don't. If you're not going to put the effort in to understand every line of code you wrote, neither will we, and your patch or pull request will be ignored. +This policy applies to all code contributions, alongside issues and pull requests surrounding this codebase. This includes: -## Commit messages +- Commit messages +- PR descriptions +- Code review comments +- Issue/PR comments +- Patches submitted via e-mail -AI-generated commit messages are absolutely terrible, and your pull request or patch will immediately be rejected if you choose to do this. They are, quite simply, actively detrimental to our understanding of your changes, and if you're not willing to summarize the intent behind your changes, then we're not going to bother reading the code you wrote. +Areas that are not directly related to code--such as our surrounding communities--are not covered by the terms of this policy. Additionally, spelling/grammar checking via AI or LLM-based tools is not covered under this document. -Write concise, simple, and descriptive commit messages that actually convey the proper intent behind what your change is trying to do. +## Introduction -See the [Addendum](#addendum-commit-messages) for an instance of how bad AI models are at commit messages. +In the right hands, AI and LLM-based tools are incredibly useful for getting features and bugfixes out the door as fast as possible. At the same time, reviewer bandwidth is a scarce resource. We are therefore open to AI-assisted contributions, provided they are produced and disclosed properly. -## Miscellaneous concerns +The goal of this document is *not* to set arbitrary restrictions, but rather to keep our development healthy and stable, while still allowing contributors to use the tools they find helpful. A contribution must be worth more to the project than the time it takes to review it. -- While many environmental concerns about AI are typically blown out of proportion, it *is* a legitimate issue, and should be taken into account. -- Many people have significant concerns over the ethics of AI usage due to inhumane and predatory behavior by large AI companies, particularly Anthropic and OpenAI. This can technically be avoided through the usage of local LLMs. -- LLMs have a tendency to add unicode characters (such as the arrow → and the em-dash — symbols) to their output, which can make viewing code or documents harder on command-line editors and viewers. -- Dedicated coding models--namely Claude--also like to add a lot of comments to overexplain every individual line of code it produces. This actually makes it *harder* to understand the code! +Throughout this document, **must** and **must not** are inflexible, binding requirements. Refusal to follow these is treated as a violation of the terms outlined in this document. -## Unacceptable Use Examples +## Requirements -Here are a few examples of unacceptable use: +These apply to all contributions, whether AI-assisted or not. AI-assisted contributions also carry additional disclosure requirements as outlined in [Disclosure](#disclosure). -- Solving problems - - Slapping a few files and a "please fix bug XYZ" into an LLM is a recipe for disaster that will pretty much never work. -- Fully AI-generated code, aka "vibecoding" -- Writing code based on pseudo-instructions - - If you don't know how to write code, don't. If you've figured out the root cause (preferably without feeding random files into an LLM) and actively know what's going on, provide information to other developers or friends of yours who have knowledge of the language and/or the codebase. +1. *Disclosure*. Any and all usage of AI or LLM-based tools within any contribution **must** be explicitly marked and disclosed as appropriate. +2. *Responsibility*. The human submitter of any contribution is held wholly responsible for the accuracy, completeness, and intent of what is submitted. You **must** be able to explain, defend, and revise your code during review. +3. *Review*. All code **must** be thoroughly reviewed by the author before opening a PR or marking it ready for review. +4. *Testing*. All code changes **must** be tested directly by the human author. +5. *Quality*. All submitted code is held to a strict standard of excellence. Low-quality AI-generated content does not uphold this standard. +6. *Licensing*. All code **must** be compatible with the GPLv3 or later. You **must** warrant that you have the right to submit it under those terms, and that it was not copied from work published under an incompatible license. -## Addendum: Commit Messages +## Sign-off, Authorship, and Copyright -The patchset for pull request [#3422](https://git.eden-emu.dev/eden-emu/eden/pulls/3422) was fed into several LLMs to generate a commit message. One LLM produced the following: +AI agents **must not** add `Signed-off-by:` tags. The human submitter **must** sign off on all changes. + +Similarly, AI agents cannot hold authorship or copyright over code, and **must not** add `Co-authored-by:` or `Co-developed-by:` tags. The human submitter **must** author all changes. + +## Permitted Usage + +This is a non-exhaustive list of permitted uses of AI and LLM-based tools, provided they are disclosed properly. + +- Drafting issues and pull requests, provided the final text and submitted code are substantially your own. +- Debugging issues, bugs, glitches, and crashes, whether pre-existing or introduced by your own changes. +- Reviewing your own changes before submitting a PR. +- Research, brainstorming, and codebase searching/understanding. +- Applying tedious but not particularly large changes, such as mass-migrating specific classes to polyfills or abstractions. + +## Recommended Prior Discussion + +Some usage cases are not necessarily forbidden nor permitted. These should be discussed with maintainers in an issue or e-mail *before* submission. Maintainers and reviewers may also comment on this during the review/submission phase. + +- Generating boilerplate/scaffolding for new code. +- Writing unit tests. +- Large-scale refactors primarily driven by an AI agent. +- Any contribution where an AI agent or model was responsible for the majority of the implementation. + +## Forbidden Usage + +This is a non-exhaustive list of strictly forbidden uses of AI and LLM-based tools. + +- Vibecoding, or changes entirely authored by AI agents without human intervention or understanding. + - If you don't choose to put in the necessary effort to understand every line of code you submitted, neither will we. +- Fully AI-generated commit messages, PR descriptions, issues, or comments. See [Addendum: AI Commit Messages](#addendum-ai-commit-messages). +- Submission of AI-assisted work that is not disclosed per the [Disclosure](#disclosure) requirements. +- Low-quality submissions that fail to satisfy our standard of code excellence. +- Submitting secrets, credentials, private user data, or unpublished security reports to third-party AI services. + - This includes console keys, encryption material, and private vulnerability disclosures. +- Verbatim AI code reviews (e.g. Codex/Copilot reviews). + +## Human Effort Denial of Service + +Using automated tools and AI to submit PRs, issues, and comments that we have to carefully review and handle is considered a [Denial-of-service attack](https://en.wikipedia.org/wiki/Denial-of-service_attack) on our human effort. + +It takes very little effort on your side (an LLM prompt) to generate a large amount of effort on ours (careful and thorough code review). Please respect our time and don't do that. + +## Disclosure + +How you disclose AI usage is up to you. However, it **must** be explicit, easy to identify, and placed both within the commit message *and* the surrounding PR description. For patches submitted by e-mail, the cover letter counts as the PR description. We recommend an `Assisted-by:` footer: + +```txt +Assisted-by: () +``` + +For instance: + +```txt +Assisted-by: Claude Opus 5.5 (initial draft and code review) +``` + +Contributions without a commit message (e.g. issues/comments) should instead use a plain sentence in the text body such as `I used to help with `. PRs and commit messages may opt to use this format as well. + +Multi-commit series/squashes **must** maintain the trailer. Maintainers will handle this for merges to master, but you are responsible for ensuring the disclosure survives into the final commit/PR body of squashes within your branches. + +Regardless, what matters is that reviewers can tell *at a glance* where and how AI was involved in your contribution. + +## Codebase Ingestion + +Ingestion of this codebase by LLMs for any purpose--such as training or prompt context--is permitted *for now*. This may change at any point as litigation and court rulings around AI and code copyright proceed. + +AI models may have ingested AGPLv3 or otherwise copyleft-incompatible code and may regurgitate it. You remain responsible for ensuring that all code you submit is compatible with the GPLv3 or later. + +## Enforcement + +- If we suspect undisclosed AI usage in a contribution, we will ask for disclosure. +- Refusal to provide disclosure will result in rejection of the contribution, and your PR or issue will be closed. Maintainers may choose to rework it themselves if the change is worth having. +- Accounts that spam us with repeated automated PRs or comments will be blocked or permanently suspended from our Git instance. +- Maintainers reserve the right to close your issues and pull requests if you don't follow the guidelines and procedures outlined in this document, and refuse or fail to make changes as necessary to comply. +- Repeated failures to comply may result in loss of contribution privileges. + +## Addendum: AI Commit Messages + +The patchset for pull request [#3422](https://git.eden-emu.dev/eden-emu/eden/pulls/3422) was fed into a dedicated code AI model, and it produced the following: ```txt profile_manager: Refactor user deletion to use index instead of UUID @@ -89,28 +183,21 @@ These changes eliminate redundant code, reduce the risk of UUID → index mismat Fixes: potential inconsistency when user order changes between UI and backend ``` -This is: +This: -- Needlessly verbose (nobody cares about most of these details) +- Is needlessly verbose (nobody cares about most of these details) - Doesn't address the actual purpose of the PR (fixing a double-deletion bug in the profile manager) - Has unicode arrows (this is bad for command-line editors) -- Uses corporate and word-salad language +- Uses corporate and word-salad language that pads out the message to make it look like a lot changed -Another (code-oriented) LLM output the following: +A good commit message should be concise, descriptive, and convey the *intent* behind the change, such as the bug being fixed or the feature being added. It should *not* be a detailed changelog of every individual byte that's changed. -```txt -profile(manager/ui): switch to index-based deletion and unify removal logic +## References -- Make ConfigureProfileManagerDeleteDialog emit a deleteUser(int) signal instead of taking a callback. Store the target index in the dialog (m_index) and emit it on acceptance. -- Change ConfigureProfileManager to pass an index to SetInfo and to accept an index in DeleteUser. Wire the dialog signal to the new DeleteUser slot. -- Update headers: add the signal and m_index, add TODO to move dialog to a .ui file, and update slot/signature declarations. -- Add ProfileManager::RemoveProfileAtIndex(std::size_t) and refactor RemoveUser(UUID) to call RemoveProfileAtIndex to avoid duplicated removal logic. Ensure the removal path marks saves as needed and writes the user save file. -- Ensure the profile list updates immediately after deletes by calling profile_manager.ResetUserSaveFile() when populating the user list (qlaunch fix). -- Misc: update SPDX copyright year and fix build breakages caused by the API changes. +This policy document has been adapted from the AI policies of numerous other free and open-source projects, whether restrictive or permissive. -This consolidates profile removal behavior, fixes potential race conditions in the profile dialog, and removes duplicated removal code. -``` - -This has all of the same problems as the other one. Needlessly verbose, doesn't address *what* it actually fixes ("consolidates profile removal behavior"... okay, why? What does it fix?), etc. It even has the bonus of totally hallucinating the addition of a method! - -On a more "philosophical" note, LLMs tend to be geared towards *corporate language*, as that's what they're trained on. This is why AI-generated commit messages feel like "word salad", and typically pad out the commit message to make it *look* like a lot of things were changed (trust me, it's like that in the corporate world). They typically also drift towards unneeded buzzwords and useless implementation details. +- [Gitea](https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md#ai-contribution-policy) +- The [Linux kernel](https://kernel.org/doc/html/next/process/coding-assistants.html) +- [Gentoo Linux](https://wiki.gentoo.org/wiki/Project:Council/AI_policy) +- [cURL](https://curl.se/dev/contribute.html#on-ai-use-in-curl) +- [FastAPI](https://tiangolo.com/open-source/contributing/#automated-code-and-ai) From a594c8d60ef79280adc046760561912207e16e17 Mon Sep 17 00:00:00 2001 From: CamilleLaVey Date: Wed, 14 Oct 2026 00:04:16 +0200 Subject: [PATCH 11/32] [shader_recompiler, vulkan, qcom, tu] Provide handling to missing shader subgroups on QCOM (#4508) This works provides better emulation on certain GS missing for shader invocation data + geometry pass fallback in qcom/turnip drivers, some of those were provided as community patch by @a.kamaltdinov; which was refined to address the requirements on forced gpu reads; which used to kill some performance on low end devices; now, the stability with some of the graphical problems have been addressed and balanced. Shuffle shaders (SHFFL) are not actually provided on QCOM and turnip drivers, so any game that previously required this stage draw, will now avoid being ignored and tax some performance based on the complexity of the stage draw from now on. This will also address partially some tessellation problems as well. _Special Thanks:_ 1.- @a.kamaltdinov (for the initial patch "early fix for nier" provided for #4325) 2.- @PavelBARABANOV (because the making the cherry-pick easier for a new PR) Co-authored-by: PavelBARABANOV Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4508 Reviewed-by: lizzie Reviewed-by: crueter --- src/shader_recompiler/CMakeLists.txt | 1 + .../backend/spirv/emit_spirv.cpp | 33 ++++- .../backend/spirv/emit_spirv_warp.cpp | 127 ++++++++++++----- .../backend/spirv/spirv_emit_context.h | 1 + .../frontend/maxwell/translate_program.cpp | 110 ++++++++++++++- src/shader_recompiler/host_translate_info.h | 2 + .../ir_opt/constant_propagation_pass.cpp | 48 +++++-- .../ir_opt/geometry_compaction_pass.cpp | 129 ++++++++++++++++++ src/shader_recompiler/ir_opt/passes.h | 1 + src/shader_recompiler/profile.h | 3 + .../renderer_vulkan/vk_pipeline_cache.cpp | 17 ++- src/video_core/vulkan_common/vulkan_device.h | 5 + 12 files changed, 417 insertions(+), 60 deletions(-) create mode 100644 src/shader_recompiler/ir_opt/geometry_compaction_pass.cpp diff --git a/src/shader_recompiler/CMakeLists.txt b/src/shader_recompiler/CMakeLists.txt index 957ed5fb55..cc9ce95d92 100644 --- a/src/shader_recompiler/CMakeLists.txt +++ b/src/shader_recompiler/CMakeLists.txt @@ -172,6 +172,7 @@ add_library(shader_recompiler STATIC ir_opt/constant_propagation_pass.cpp ir_opt/dead_code_elimination_pass.cpp ir_opt/dual_vertex_pass.cpp + ir_opt/geometry_compaction_pass.cpp ir_opt/global_memory_to_storage_buffer_pass.cpp ir_opt/identity_removal_pass.cpp ir_opt/layer_pass.cpp diff --git a/src/shader_recompiler/backend/spirv/emit_spirv.cpp b/src/shader_recompiler/backend/spirv/emit_spirv.cpp index c221888c09..a903480c78 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv.cpp @@ -4,6 +4,7 @@ // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include #include #include #include @@ -439,10 +440,13 @@ void SetupCapabilities(const Profile& profile, const Info& info, EmitContext& ct ctx.AddCapability(spv::Capability::DrawParameters); } if ((info.uses_subgroup_vote || info.uses_subgroup_invocation_id || - info.uses_subgroup_shuffles) && + info.uses_subgroup_shuffles || info.uses_subgroup_mask) && profile.support_vote && profile.SupportsSubgroupStage(ctx.stage)) { ctx.AddCapability(spv::Capability::GroupNonUniformBallot); ctx.AddCapability(spv::Capability::GroupNonUniformShuffle); + if (info.uses_subgroup_shuffles && profile.support_shuffle_relative) { + ctx.AddCapability(spv::Capability::GroupNonUniformShuffleRelative); + } if (!profile.warp_size_potentially_larger_than_guest) { // vote ops are only used when not taking the long path ctx.AddCapability(spv::Capability::GroupNonUniformVote); @@ -521,6 +525,29 @@ void PatchPhiNodes(IR::Program& program, EmitContext& ctx) { return { ctx.Def(phi->Arg(phi_arg)), parent }; }); } + +void RewriteOpcodes(std::vector& code, std::span> rewrites) { + if (rewrites.empty()) { + return; + } + size_t offset = 5; + while (offset + 2 < code.size()) { + const u32 word_count{code[offset] >> 16}; + const auto opcode{static_cast(code[offset] & 0xFFFFu)}; + if (word_count == 0) { + return; + } + if (opcode == spv::Op::OpGroupNonUniformShuffleXor || + opcode == spv::Op::OpGroupNonUniformQuadBroadcast) { + const auto it{std::ranges::find(rewrites, code[offset + 2], + &std::pair::first)}; + if (it != rewrites.end()) { + code[offset] = (code[offset] & 0xFFFF0000u) | static_cast(it->second); + } + } + offset += word_count; + } +} } // Anonymous namespace std::vector EmitSPIRV(const Profile& profile, const RuntimeInfo& runtime_info, IR::Program& program, Bindings& bindings) { @@ -535,7 +562,9 @@ std::vector EmitSPIRV(const Profile& profile, const RuntimeInfo& runtime_in SetupCapabilities(profile, program.info, ctx); SetupTransformFeedbackCapabilities(ctx, main); PatchPhiNodes(program, ctx); - return ctx.Assemble(); + std::vector code{ctx.Assemble()}; + RewriteOpcodes(code, ctx.opcode_rewrites); + return code; } Id EmitPhi(EmitContext& ctx, IR::Inst* inst) { diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_warp.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_warp.cpp index ffd5d9c29f..8d83509961 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_warp.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_warp.cpp @@ -77,20 +77,57 @@ Id GetMaxThreadId(EmitContext& ctx, Id thread_id, Id clamp, Id segmentation_mask return ComputeMaxThreadId(ctx, min_thread_id, clamp, not_seg_mask); } -Id SelectValue(EmitContext& ctx, Id in_range, Id value, Id src_thread_id) { - if (!StageSupportsSubgroups(ctx)) { - return value; +Id HostThreadId(EmitContext& ctx, Id thread_id) { + if (!ctx.profile.warp_size_potentially_larger_than_guest) { + return thread_id; } - return ctx.OpSelect( - ctx.U32[1], in_range, - ctx.OpGroupNonUniformShuffle(ctx.U32[1], SubgroupScope(ctx), value, src_thread_id), value); -} - -Id AddPartitionBase(EmitContext& ctx, Id thread_id) { const Id partition_idx{ctx.OpShiftRightLogical(ctx.U32[1], GetThreadId(ctx), ctx.Const(5u))}; const Id partition_base{ctx.OpShiftLeftLogical(ctx.U32[1], partition_idx, ctx.Const(5u))}; return ctx.OpIAdd(ctx.U32[1], thread_id, partition_base); } + +Id GuestLane(EmitContext& ctx, Id index) { + return ctx.OpBitwiseAnd(ctx.U32[1], index, ctx.Const(31U)); +} + +Id ShuffleAbsolute(EmitContext& ctx, Id value, Id src_thread_id) { + if (!ctx.profile.has_broken_spirv_subgroup_shuffle) { + return ctx.OpGroupNonUniformShuffle(ctx.U32[1], SubgroupScope(ctx), value, src_thread_id); + } + Id result{ctx.u32_zero_value}; + for (u32 lane = 0; lane < ctx.profile.max_subgroup_size; ++lane) { + const Id read{ + ctx.OpGroupNonUniformBroadcast(ctx.U32[1], SubgroupScope(ctx), value, ctx.Const(lane))}; + const Id matches{ctx.OpIEqual(ctx.U1, src_thread_id, ctx.Const(lane))}; + result = ctx.OpSelect(ctx.U32[1], matches, read, result); + } + return result; +} + +Id ShuffleRelative(EmitContext& ctx, Id value, Id delta, Id src_thread_id, spv::Op op) { + if (!ctx.profile.support_shuffle_relative) { + return ShuffleAbsolute(ctx, value, HostThreadId(ctx, src_thread_id)); + } + const Id result{ctx.OpGroupNonUniformShuffleXor(ctx.U32[1], SubgroupScope(ctx), value, delta)}; + ctx.opcode_rewrites.emplace_back(result.value, op); + return result; +} + +Id BroadcastLane(EmitContext& ctx, Id value, u32 lane) { + Id result{ + ctx.OpGroupNonUniformBroadcast(ctx.U32[1], SubgroupScope(ctx), value, ctx.Const(lane))}; + if (!ctx.profile.warp_size_potentially_larger_than_guest) { + return result; + } + const Id partition_idx{ctx.OpShiftRightLogical(ctx.U32[1], GetThreadId(ctx), ctx.Const(5u))}; + for (u32 base = 32; base < ctx.profile.max_subgroup_size; base += 32) { + const Id read{ctx.OpGroupNonUniformBroadcast(ctx.U32[1], SubgroupScope(ctx), value, + ctx.Const(base + lane))}; + const Id matches{ctx.OpIEqual(ctx.U1, partition_idx, ctx.Const(base >> 5))}; + result = ctx.OpSelect(ctx.U32[1], matches, read, result); + } + return result; +} } // Anonymous namespace Id EmitLaneId(EmitContext& ctx) { @@ -203,61 +240,75 @@ Id EmitShuffleIndex(EmitContext& ctx, IR::Inst* inst, Id value, Id index, Id cla const Id min_thread_id{ComputeMinThreadId(ctx, thread_id, segmentation_mask)}; const Id max_thread_id{ComputeMaxThreadId(ctx, min_thread_id, clamp, not_seg_mask)}; - const Id lhs{ctx.OpBitwiseAnd(ctx.U32[1], index, not_seg_mask)}; - Id src_thread_id{ctx.OpBitwiseOr(ctx.U32[1], lhs, min_thread_id)}; + const Id lhs{ctx.OpBitwiseAnd(ctx.U32[1], GuestLane(ctx, index), not_seg_mask)}; + const Id src_thread_id{ctx.OpBitwiseOr(ctx.U32[1], lhs, min_thread_id)}; const Id in_range{ctx.OpSLessThanEqual(ctx.U1, src_thread_id, max_thread_id)}; - if (ctx.profile.warp_size_potentially_larger_than_guest) { - src_thread_id = AddPartitionBase(ctx, src_thread_id); - } - SetInBoundsFlag(inst, in_range); - return SelectValue(ctx, in_range, value, src_thread_id); + if (!StageSupportsSubgroups(ctx)) { + return value; + } + const IR::Value lane{inst->Arg(1).Resolve()}; + const IR::Value segment{inst->Arg(3).Resolve()}; + if (lane.IsImmediate() && segment.IsImmediate() && segment.U32() == 0) { + return ctx.OpSelect(ctx.U32[1], in_range, BroadcastLane(ctx, value, lane.U32() & 31), + value); + } + const Id shuffled{ShuffleAbsolute(ctx, value, HostThreadId(ctx, src_thread_id))}; + return ctx.OpSelect(ctx.U32[1], in_range, shuffled, value); } Id EmitShuffleUp(EmitContext& ctx, IR::Inst* inst, Id value, Id index, Id clamp, Id segmentation_mask) { + if (!StageSupportsSubgroups(ctx)) { + SetInBoundsFlag(inst, ctx.false_value); + return value; + } + const Id delta{GuestLane(ctx, index)}; const Id thread_id{EmitLaneId(ctx)}; const Id max_thread_id{GetMaxThreadId(ctx, thread_id, clamp, segmentation_mask)}; - Id src_thread_id{ctx.OpISub(ctx.U32[1], thread_id, index)}; + const Id src_thread_id{ctx.OpISub(ctx.U32[1], thread_id, delta)}; const Id in_range{ctx.OpSGreaterThanEqual(ctx.U1, src_thread_id, max_thread_id)}; - if (ctx.profile.warp_size_potentially_larger_than_guest) { - src_thread_id = AddPartitionBase(ctx, src_thread_id); - } - SetInBoundsFlag(inst, in_range); - return SelectValue(ctx, in_range, value, src_thread_id); + const Id shuffled{ShuffleRelative(ctx, value, delta, src_thread_id, + spv::Op::OpGroupNonUniformShuffleUp)}; + return ctx.OpSelect(ctx.U32[1], in_range, shuffled, value); } Id EmitShuffleDown(EmitContext& ctx, IR::Inst* inst, Id value, Id index, Id clamp, Id segmentation_mask) { + if (!StageSupportsSubgroups(ctx)) { + SetInBoundsFlag(inst, ctx.false_value); + return value; + } + const Id delta{GuestLane(ctx, index)}; const Id thread_id{EmitLaneId(ctx)}; const Id max_thread_id{GetMaxThreadId(ctx, thread_id, clamp, segmentation_mask)}; - Id src_thread_id{ctx.OpIAdd(ctx.U32[1], thread_id, index)}; + const Id src_thread_id{ctx.OpIAdd(ctx.U32[1], thread_id, delta)}; const Id in_range{ctx.OpSLessThanEqual(ctx.U1, src_thread_id, max_thread_id)}; - if (ctx.profile.warp_size_potentially_larger_than_guest) { - src_thread_id = AddPartitionBase(ctx, src_thread_id); - } - SetInBoundsFlag(inst, in_range); - return SelectValue(ctx, in_range, value, src_thread_id); + const Id shuffled{ShuffleRelative(ctx, value, delta, src_thread_id, + spv::Op::OpGroupNonUniformShuffleDown)}; + return ctx.OpSelect(ctx.U32[1], in_range, shuffled, value); } Id EmitShuffleButterfly(EmitContext& ctx, IR::Inst* inst, Id value, Id index, Id clamp, Id segmentation_mask) { + if (!StageSupportsSubgroups(ctx)) { + SetInBoundsFlag(inst, ctx.false_value); + return value; + } + const Id mask{GuestLane(ctx, index)}; const Id thread_id{EmitLaneId(ctx)}; const Id max_thread_id{GetMaxThreadId(ctx, thread_id, clamp, segmentation_mask)}; - Id src_thread_id{ctx.OpBitwiseXor(ctx.U32[1], thread_id, index)}; + const Id src_thread_id{ctx.OpBitwiseXor(ctx.U32[1], thread_id, mask)}; const Id in_range{ctx.OpSLessThanEqual(ctx.U1, src_thread_id, max_thread_id)}; - if (ctx.profile.warp_size_potentially_larger_than_guest) { - src_thread_id = AddPartitionBase(ctx, src_thread_id); - } - SetInBoundsFlag(inst, in_range); - return SelectValue(ctx, in_range, value, src_thread_id); + const Id shuffled{ctx.OpGroupNonUniformShuffleXor(ctx.U32[1], SubgroupScope(ctx), value, mask)}; + return ctx.OpSelect(ctx.U32[1], in_range, shuffled, value); } Id EmitQuadBroadcast(EmitContext& ctx, Id value, Id lane) { @@ -267,10 +318,16 @@ Id EmitQuadBroadcast(EmitContext& ctx, Id value, Id lane) { const Id base{ctx.OpBitwiseAnd(ctx.U32[1], GetThreadId(ctx), ctx.Const(~3u))}; const Id local_lane{ctx.OpBitwiseAnd(ctx.U32[1], lane, ctx.Const(3u))}; const Id src_thread_id{ctx.OpBitwiseOr(ctx.U32[1], base, local_lane)}; - return ctx.OpGroupNonUniformShuffle(ctx.U32[1], SubgroupScope(ctx), value, src_thread_id); + return ShuffleAbsolute(ctx, value, src_thread_id); } Id EmitQuadSwap(EmitContext& ctx, Id value, Id direction) { + if (ctx.profile.support_quad_shuffles) { + const Id result{ + ctx.OpGroupNonUniformQuadBroadcast(ctx.U32[1], SubgroupScope(ctx), value, direction)}; + ctx.opcode_rewrites.emplace_back(result.value, spv::Op::OpGroupNonUniformQuadSwap); + return result; + } const Id xor_mask{ctx.OpIAdd(ctx.U32[1], direction, ctx.Const(1u))}; return ctx.OpGroupNonUniformShuffleXor(ctx.U32[1], SubgroupScope(ctx), value, xor_mask); } diff --git a/src/shader_recompiler/backend/spirv/spirv_emit_context.h b/src/shader_recompiler/backend/spirv/spirv_emit_context.h index 7edc104708..a5821e9e93 100644 --- a/src/shader_recompiler/backend/spirv/spirv_emit_context.h +++ b/src/shader_recompiler/backend/spirv/spirv_emit_context.h @@ -361,6 +361,7 @@ public: Id frag_depth{}; std::vector interfaces; + std::vector> opcode_rewrites; Id load_const_func_u8{}; Id load_const_func_u16{}; diff --git a/src/shader_recompiler/frontend/maxwell/translate_program.cpp b/src/shader_recompiler/frontend/maxwell/translate_program.cpp index 1b2ec5502d..0cc4b3b844 100644 --- a/src/shader_recompiler/frontend/maxwell/translate_program.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate_program.cpp @@ -5,7 +5,10 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include +#include +#include #include +#include #include #include @@ -172,7 +175,17 @@ std::map GenerateLegacyToGenericMappings( void EmitGeometryPassthrough(IR::IREmitter& ir, const IR::Program& program, const Shader::VaryingState& passthrough_mask, bool passthrough_position, - std::optional passthrough_layer_attr) { + std::optional passthrough_layer_attr, + std::optional viewport_mask_reg) { + constexpr std::array CULLED_POSITION{2.0f, 2.0f, 2.0f, 1.0f}; + IR::U1 culled{ir.Imm1(false)}; + IR::U32 viewport{ir.Imm32(0)}; + if (viewport_mask_reg) { + const IR::U32 mask{ir.GetReg(*viewport_mask_reg)}; + const IR::U32 lowest_bit{ir.BitwiseAnd(mask, IR::U32{ir.INeg(mask)})}; + culled = ir.IEqual(mask, ir.Imm32(0)); + viewport = IR::U32{ir.Select(culled, ir.Imm32(0), ir.FindUMsb(lowest_bit))}; + } for (u32 i = 0; i < program.output_vertices; i++) { // Assign generics from input for (u32 j = 0; j < 32; j++) { @@ -190,10 +203,19 @@ void EmitGeometryPassthrough(IR::IREmitter& ir, const IR::Program& program, if (passthrough_position) { // Assign position from input const IR::Attribute attr = IR::Attribute::PositionX; - ir.SetAttribute(attr + 0, ir.GetAttribute(attr + 0, ir.Imm32(i)), ir.Imm32(0)); - ir.SetAttribute(attr + 1, ir.GetAttribute(attr + 1, ir.Imm32(i)), ir.Imm32(0)); - ir.SetAttribute(attr + 2, ir.GetAttribute(attr + 2, ir.Imm32(i)), ir.Imm32(0)); - ir.SetAttribute(attr + 3, ir.GetAttribute(attr + 3, ir.Imm32(i)), ir.Imm32(0)); + for (u32 component = 0; component < 4; ++component) { + IR::F32 value{ir.GetAttribute(attr + component, ir.Imm32(i))}; + if (viewport_mask_reg) { + value = IR::F32{ + ir.Select(culled, ir.Imm32(CULLED_POSITION[component]), value)}; + } + ir.SetAttribute(attr + component, value, ir.Imm32(0)); + } + } + + if (viewport_mask_reg) { + ir.SetAttribute(IR::Attribute::ViewportIndex, ir.BitCast(viewport), + ir.Imm32(0)); } if (passthrough_layer_attr) { @@ -219,19 +241,91 @@ u32 GetOutputTopologyVertices(OutputTopology output_topology) { } } +std::optional FindFreeRegister(const IR::Program& program) { + std::bitset used; + for (IR::Block* const block : program.blocks) { + for (const IR::Inst& inst : block->Instructions()) { + const IR::Opcode opcode{inst.GetOpcode()}; + if (opcode == IR::Opcode::GetRegister || opcode == IR::Opcode::SetRegister) { + used.set(IR::RegIndex(inst.Arg(0).Reg())); + } + } + } + for (size_t index = IR::NUM_USER_REGS; index-- > 0;) { + if (!used.test(index)) { + return static_cast(index); + } + } + return std::nullopt; +} + +std::optional LowerViewportMask(const IR::Program& program) { + const std::optional reg{FindFreeRegister(program)}; + if (!reg || program.blocks.empty()) { + return std::nullopt; + } + bool stores_mask{}; + for (IR::Block* const block : program.blocks) { + for (IR::Inst& inst : block->Instructions()) { + if (inst.GetOpcode() != IR::Opcode::SetAttribute || + inst.Arg(0).Attribute() != IR::Attribute::ViewportMask) { + continue; + } + IR::IREmitter ir{*block, IR::Block::InstructionList::s_iterator_to(inst)}; + ir.SetReg(*reg, ir.BitCast(IR::F32{inst.Arg(1)})); + inst.Invalidate(); + stores_mask = true; + } + } + if (!stores_mask) { + return std::nullopt; + } + IR::Block& entry{*program.blocks.front()}; + IR::IREmitter ir{entry, entry.begin()}; + ir.SetReg(*reg, ir.Imm32(1)); + return reg; +} + void LowerGeometryPassthrough(const IR::Program& program, const HostTranslateInfo& host_info) { + std::optional viewport_mask_reg; + if (!host_info.support_viewport_mask) { + viewport_mask_reg = LowerViewportMask(program); + } for (IR::Block* const block : program.blocks) { for (IR::Inst& inst : block->Instructions()) { if (inst.GetOpcode() == IR::Opcode::Epilogue) { IR::IREmitter ir{*block, IR::Block::InstructionList::s_iterator_to(inst)}; EmitGeometryPassthrough( ir, program, program.info.passthrough, - program.info.passthrough.AnyComponent(IR::Attribute::PositionX), {}); + program.info.passthrough.AnyComponent(IR::Attribute::PositionX), {}, + viewport_mask_reg); } } } } +void TightenOutputVertices(IR::Program& program) { + if (program.stage != Stage::Geometry || program.is_geometry_passthrough) { + return; + } + const bool has_loops = std::ranges::any_of(program.syntax_list, [](const auto& node) { + return node.type == IR::AbstractSyntaxNode::Type::Loop; + }); + if (has_loops) { + return; + } + u32 num_emits = 0; + for (IR::Block* const block : program.blocks) { + for (const IR::Inst& inst : block->Instructions()) { + if (inst.GetOpcode() == IR::Opcode::EmitVertex) { + ++num_emits; + } + } + } + if (num_emits != 0) { + program.output_vertices = (std::min)(program.output_vertices, num_emits); + } +} } // Anonymous namespace IR::Program TranslateProgram(ObjectPool& inst_pool, ObjectPool& block_pool, @@ -299,12 +393,14 @@ IR::Program TranslateProgram(ObjectPool& inst_pool, ObjectPool& inst_pool, IR::IREmitter ir{*current_block}; EmitGeometryPassthrough(ir, program, program.info.stores, true, - source_program.info.emulated_layer); + source_program.info.emulated_layer, std::nullopt); IR::Block* return_block{block_pool.Create(inst_pool)}; IR::IREmitter{*return_block}.Epilogue(); diff --git a/src/shader_recompiler/host_translate_info.h b/src/shader_recompiler/host_translate_info.h index 93ce881c2d..44df85ccb2 100644 --- a/src/shader_recompiler/host_translate_info.h +++ b/src/shader_recompiler/host_translate_info.h @@ -34,10 +34,12 @@ struct HostTranslateInfo { bool needs_demote_reorder{}; ///< True when the device needs DemoteToHelperInvocation reordered bool support_snorm_render_buffer{}; ///< True when the device supports SNORM render buffers bool support_viewport_index_layer{}; ///< True when the device supports gl_Layer in VS + bool support_viewport_mask{}; bool support_geometry_shader_passthrough{}; ///< True when the device supports geometry ///< passthrough shaders bool support_conditional_barrier{}; ///< True when the device supports barriers in conditional ///< control flow + bool single_lane_geometry_subgroups{}; void ApplyDescriptorLimitPolicy() noexcept { if (min_ssbo_alignment == 0) { diff --git a/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp b/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp index 57c08588fb..6285fef16f 100644 --- a/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp +++ b/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project @@ -651,6 +651,29 @@ IR::Value GetThroughCast(IR::Value value, IR::Opcode expected_cast) { return value; } +u32 QuadButterflyMask(const IR::Inst& inst) { + if (inst.GetOpcode() == IR::Opcode::QuadSwap) { + const IR::Value direction{inst.Arg(1)}; + if (!direction.IsImmediate()) { + return 0; + } + return direction.U32() + 1; + } + if (inst.GetOpcode() != IR::Opcode::ShuffleButterfly) { + return 0; + } + const IR::Value index{inst.Arg(1)}; + const IR::Value clamp{inst.Arg(2)}; + const IR::Value segmentation_mask{inst.Arg(3)}; + if (!index.IsImmediate() || !clamp.IsImmediate() || !segmentation_mask.IsImmediate()) { + return 0; + } + if (clamp.U32() != 3 || segmentation_mask.U32() != 28) { + return 0; + } + return index.U32(); +} + void FoldFSwizzleAdd(IR::Block& block, IR::Inst& inst) { const IR::Value swizzle{inst.Arg(2)}; if (!swizzle.IsImmediate()) { @@ -666,7 +689,8 @@ void FoldFSwizzleAdd(IR::Block& block, IR::Inst& inst) { return; } IR::Inst* const inst2{value_1.InstRecursive()}; - if (inst2->GetOpcode() != IR::Opcode::ShuffleButterfly) { + const u32 lane_mask{QuadButterflyMask(*inst2)}; + if (lane_mask == 0) { return; } const IR::Value value_3{GetThroughCast(inst2->Arg(0).Resolve(), IR::Opcode::BitCastU32F32)}; @@ -678,24 +702,15 @@ void FoldFSwizzleAdd(IR::Block& block, IR::Inst& inst) { return; } } - const IR::Value index{inst2->Arg(1)}; - const IR::Value clamp{inst2->Arg(2)}; - const IR::Value segmentation_mask{inst2->Arg(3)}; - if (!index.IsImmediate() || !clamp.IsImmediate() || !segmentation_mask.IsImmediate()) { - return; - } - if (clamp.U32() != 3 || segmentation_mask.U32() != 28) { - return; - } if (swizzle_value == 0x99) { // DPdxFine - if (index.U32() == 1) { + if (lane_mask == 1) { IR::IREmitter ir{block, IR::Block::InstructionList::s_iterator_to(inst)}; inst.ReplaceUsesWith(ir.DPdxFine(IR::F32{inst.Arg(1)})); } } else if (swizzle_value == 0xA5) { // DPdyFine - if (index.U32() == 2) { + if (lane_mask == 2) { IR::IREmitter ir{block, IR::Block::InstructionList::s_iterator_to(inst)}; inst.ReplaceUsesWith(ir.DPdyFine(IR::F32{inst.Arg(1)})); } @@ -709,6 +724,13 @@ bool FindGradient3DDerivatives(std::array& results, IR::Value coor const auto check_through_shuffle = [](IR::Value input, IR::Value& result) { const IR::Value value_1{GetThroughCast(input.Resolve(), IR::Opcode::BitCastF32U32)}; IR::Inst* const inst2{value_1.InstRecursive()}; + if (inst2->GetOpcode() == IR::Opcode::QuadBroadcast) { + if (!inst2->Arg(1).Resolve().IsImmediate()) { + return false; + } + result = GetThroughCast(inst2->Arg(0).Resolve(), IR::Opcode::BitCastU32F32); + return true; + } if (inst2->GetOpcode() != IR::Opcode::ShuffleIndex) { return false; } diff --git a/src/shader_recompiler/ir_opt/geometry_compaction_pass.cpp b/src/shader_recompiler/ir_opt/geometry_compaction_pass.cpp new file mode 100644 index 0000000000..98cfa47401 --- /dev/null +++ b/src/shader_recompiler/ir_opt/geometry_compaction_pass.cpp @@ -0,0 +1,129 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +#include + +#include "shader_recompiler/frontend/ir/ir_emitter.h" +#include "shader_recompiler/host_translate_info.h" +#include "shader_recompiler/ir_opt/passes.h" + +namespace Shader::Optimization { +namespace { +constexpr int MAX_BALLOT_DEPTH = 8; + +struct SlotAtomic { + IR::Block* block; + IR::Inst* atomic; + IR::Inst* ballot; +}; + +IR::Inst* FindBallot(const IR::Value& value, int depth) { + if (depth > MAX_BALLOT_DEPTH || value.IsImmediate()) { + return nullptr; + } + IR::Inst* const inst{value.InstRecursive()}; + if (inst->GetOpcode() == IR::Opcode::SubgroupBallot) { + return inst; + } + if (inst->GetOpcode() == IR::Opcode::Phi) { + return nullptr; + } + for (size_t index = 0; index < inst->NumArgs(); ++index) { + if (IR::Inst* const ballot{FindBallot(inst->Arg(index), depth + 1)}) { + return ballot; + } + } + return nullptr; +} + +bool IsShuffle(IR::Opcode opcode) { + switch (opcode) { + case IR::Opcode::ShuffleIndex: + case IR::Opcode::ShuffleUp: + case IR::Opcode::ShuffleDown: + case IR::Opcode::ShuffleButterfly: + return true; + default: + return false; + } +} + +IR::U32 PrimitiveSlot(IR::IREmitter& ir, u32 invocations, const IR::U32& amount) { + IR::U32 key{ir.GetAttributeU32(IR::Attribute::PrimitiveId)}; + if (invocations > 1) { + key = ir.IAdd(ir.IMul(key, ir.Imm32(invocations)), ir.InvocationId()); + } + return ir.IMul(key, amount); +} + +bool MergesAtomic(const IR::Inst& phi, const IR::Block& block, const IR::Inst& atomic) { + for (size_t index = 0; index < phi.NumArgs(); ++index) { + const IR::Value arg{phi.Arg(index)}; + if (phi.PhiBlock(index) == &block && !arg.IsImmediate() && + arg.InstRecursive() == &atomic) { + return true; + } + } + return false; +} + +void RewriteMergedSlots(IR::Block& block, IR::Inst& atomic, u32 invocations) { + for (IR::Block* const successor : block.ImmSuccessors()) { + for (IR::Inst& phi : successor->Instructions()) { + if (phi.GetOpcode() != IR::Opcode::Phi || !MergesAtomic(phi, block, atomic)) { + continue; + } + for (size_t index = 0; index < phi.NumArgs(); ++index) { + const IR::Value arg{phi.Arg(index)}; + if (arg.IsImmediate() || !IsShuffle(arg.InstRecursive()->GetOpcode())) { + continue; + } + IR::IREmitter ir{*phi.PhiBlock(index)}; + const IR::U32 amount{arg.InstRecursive()->Arg(0)}; + phi.SetArg(index, PrimitiveSlot(ir, invocations, amount)); + } + } + } +} + +void RewriteAtomic(IR::Block& block, IR::Inst& atomic, u32 invocations) { + const auto insert_point{IR::Block::InstructionList::s_iterator_to(atomic)}; + IR::IREmitter ir{block, insert_point}; + const IR::U32 amount{atomic.Arg(2)}; + const IR::U32 slot{PrimitiveSlot(ir, invocations, amount)}; + block.PrependNewInst(insert_point, IR::Opcode::StorageAtomicUMax32, + {atomic.Arg(0), atomic.Arg(1), ir.IAdd(slot, amount)}); + atomic.ReplaceUsesWith(slot); +} + +void NeutralizePredicate(IR::Inst& ballot) { + const IR::Value pred{ballot.Arg(0)}; + if (!pred.IsImmediate()) { + pred.InstRecursive()->ReplaceUsesWith(IR::Value{true}); + } +} +} + +void GeometryCompactionPass(IR::Program& program, const HostTranslateInfo& host_info) { + if (program.stage != Stage::Geometry || !host_info.single_lane_geometry_subgroups) { + return; + } + boost::container::small_vector slot_atomics; + for (IR::Block* const block : program.post_order_blocks) { + for (IR::Inst& inst : block->Instructions()) { + if (inst.GetOpcode() != IR::Opcode::StorageAtomicIAdd32) { + continue; + } + if (IR::Inst* const ballot{FindBallot(inst.Arg(2), 0)}) { + slot_atomics.push_back({block, &inst, ballot}); + } + } + } + for (const SlotAtomic& slot_atomic : slot_atomics) { + RewriteMergedSlots(*slot_atomic.block, *slot_atomic.atomic, program.invocations); + RewriteAtomic(*slot_atomic.block, *slot_atomic.atomic, program.invocations); + NeutralizePredicate(*slot_atomic.ballot); + } +} + +} diff --git a/src/shader_recompiler/ir_opt/passes.h b/src/shader_recompiler/ir_opt/passes.h index 068d7fdfe8..bf325a4cd9 100644 --- a/src/shader_recompiler/ir_opt/passes.h +++ b/src/shader_recompiler/ir_opt/passes.h @@ -19,6 +19,7 @@ void CollectShaderInfoPass(Environment& env, IR::Program& program); void ConditionalBarrierPass(IR::Program& program); void ConstantPropagationPass(Environment& env, IR::Program& program); void DeadCodeEliminationPass(IR::Program& program); +void GeometryCompactionPass(IR::Program& program, const HostTranslateInfo& host_info); void GlobalMemoryToStorageBufferPass(IR::Program& program, const HostTranslateInfo& host_info); void IdentityRemovalPass(IR::Program& program); void LowerFp64ToFp32(IR::Program& program); diff --git a/src/shader_recompiler/profile.h b/src/shader_recompiler/profile.h index d2ac480ab8..8e9c83f888 100644 --- a/src/shader_recompiler/profile.h +++ b/src/shader_recompiler/profile.h @@ -40,6 +40,7 @@ struct Profile { bool support_shader_quad_control{}; bool support_quad_shuffles{}; bool support_vote{}; + bool support_shuffle_relative{}; u32 supported_subgroup_stages{0x7F}; bool support_viewport_index_layer_non_geometry{}; bool support_viewport_mask{}; @@ -102,6 +103,8 @@ struct Profile { bool ignore_nan_fp_comparisons{}; /// Some drivers have broken support for OpVectorExtractDynamic on subgroup mask inputs bool has_broken_spirv_subgroup_mask_vector_extract_dynamic{}; + bool has_broken_spirv_subgroup_shuffle{}; + u32 max_subgroup_size{}; u32 gl_max_compute_smem_size{}; diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index 5e057dd4cf..a85e2811a3 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp @@ -363,7 +363,7 @@ PipelineCache::PipelineCache(Tegra::MaxwellDeviceMemoryManager& device_memory_, const auto subgroup_stage_bit{[subgroup_stages](VkShaderStageFlags flag, Shader::Stage stage) { return (subgroup_stages & flag) != 0 ? (1u << static_cast(stage)) : 0u; }}; - const u32 supported_subgroup_stages{ + u32 supported_subgroup_stages{ subgroup_stage_bit(VK_SHADER_STAGE_VERTEX_BIT, Shader::Stage::VertexA) | subgroup_stage_bit(VK_SHADER_STAGE_VERTEX_BIT, Shader::Stage::VertexB) | subgroup_stage_bit(VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT, @@ -373,6 +373,9 @@ PipelineCache::PipelineCache(Tegra::MaxwellDeviceMemoryManager& device_memory_, subgroup_stage_bit(VK_SHADER_STAGE_GEOMETRY_BIT, Shader::Stage::Geometry) | subgroup_stage_bit(VK_SHADER_STAGE_FRAGMENT_BIT, Shader::Stage::Fragment) | subgroup_stage_bit(VK_SHADER_STAGE_COMPUTE_BIT, Shader::Stage::Compute)}; + if (driver_id == VK_DRIVER_ID_MESA_TURNIP) { + supported_subgroup_stages &= ~(1u << static_cast(Shader::Stage::Geometry)); + } profile = Shader::Profile{ .supported_spirv = device.SupportedSpirvVersion(), .unified_descriptor_binding = true, @@ -410,6 +413,8 @@ PipelineCache::PipelineCache(Tegra::MaxwellDeviceMemoryManager& device_memory_, .support_shader_quad_control = device.IsKhrShaderQuadControlSupported(), .support_quad_shuffles = device.IsSubgroupFeatureSupported(VK_SUBGROUP_FEATURE_QUAD_BIT), .support_vote = device.IsSubgroupFeatureSupported(VK_SUBGROUP_FEATURE_VOTE_BIT), + .support_shuffle_relative = + device.IsSubgroupFeatureSupported(VK_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT), .supported_subgroup_stages = supported_subgroup_stages, .support_viewport_index_layer_non_geometry = device.IsExtShaderViewportIndexLayerSupported(), @@ -445,13 +450,17 @@ PipelineCache::PipelineCache(Tegra::MaxwellDeviceMemoryManager& device_memory_, driver_id == VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA, .has_broken_spirv_clamp = driver_id == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS, - .has_broken_spirv_position_input = driver_id == false, + .has_broken_spirv_position_input = driver_id == VK_DRIVER_ID_QUALCOMM_PROPRIETARY, .has_broken_unsigned_image_offsets = false, .has_broken_signed_operations = false, .has_broken_fp16_float_controls = driver_id == VK_DRIVER_ID_NVIDIA_PROPRIETARY, .has_broken_fp32_denorm_flush = driver_id == VK_DRIVER_ID_QUALCOMM_PROPRIETARY, .ignore_nan_fp_comparisons = false, - .has_broken_spirv_subgroup_mask_vector_extract_dynamic = false, + .has_broken_spirv_subgroup_mask_vector_extract_dynamic = + driver_id == VK_DRIVER_ID_QUALCOMM_PROPRIETARY && + device.GetDriverVersion() < VK_MAKE_VERSION(512, 672, 0), + .has_broken_spirv_subgroup_shuffle = driver_id == VK_DRIVER_ID_QUALCOMM_PROPRIETARY, + .max_subgroup_size = device.GetMaxSubgroupSize(), .has_broken_robust = device.IsNvidia() && device.GetNvidiaArch() <= NvidiaArchitecture::Arch_Pascal, .min_ssbo_alignment = device.GetStorageBufferAlignment(), @@ -478,8 +487,10 @@ PipelineCache::PipelineCache(Tegra::MaxwellDeviceMemoryManager& device_memory_, driver_id == VK_DRIVER_ID_SAMSUNG_PROPRIETARY, .support_snorm_render_buffer = true, .support_viewport_index_layer = device.IsExtShaderViewportIndexLayerSupported(), + .support_viewport_mask = device.IsNvViewportArray2Supported(), .support_geometry_shader_passthrough = device.IsNvGeometryShaderPassthroughSupported(), .support_conditional_barrier = device.SupportsConditionalBarriers(), + .single_lane_geometry_subgroups = !profile.SupportsSubgroupStage(Shader::Stage::Geometry), }; host_info.ApplyDescriptorLimitPolicy(); diff --git a/src/video_core/vulkan_common/vulkan_device.h b/src/video_core/vulkan_common/vulkan_device.h index 077b1c3e23..bbf3754e39 100644 --- a/src/video_core/vulkan_common/vulkan_device.h +++ b/src/video_core/vulkan_common/vulkan_device.h @@ -483,6 +483,11 @@ FN_MAX_LIMIT_LIST return properties.subgroup_properties.supportedStages; } + u32 GetMaxSubgroupSize() const { + return (std::max)(properties.subgroup_properties.subgroupSize, + properties.subgroup_size_control.maxSubgroupSize); + } + /// Returns the maximum number of push descriptors. u32 MaxPushDescriptors() const { return properties.push_descriptor.maxPushDescriptors; From fb51a1253447a2655382d3cf952c4c470a1d96c6 Mon Sep 17 00:00:00 2001 From: lizzie Date: Wed, 14 Oct 2026 21:24:35 +0200 Subject: [PATCH 12/32] [input/sdl] nuke SDL_Vibration thread (#4299) Signed-off-by: lizzie - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- isn't it net faster to just...send things, serially? especially since vibration occurs so non-often... i dont think it would cause any issues TEST: if this causes ANY sort of perf regression on games when the thing vibrates WITH AN SDL CONFIGURED GAMEPAD OR WHATEVER Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4299 Reviewed-by: Maufeat Reviewed-by: CamilleLaVey --- src/input_common/drivers/sdl_driver.cpp | 41 +------------------------ src/input_common/drivers/sdl_driver.h | 7 +---- 2 files changed, 2 insertions(+), 46 deletions(-) diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp index 91589063b5..c3e9a066b3 100644 --- a/src/input_common/drivers/sdl_driver.cpp +++ b/src/input_common/drivers/sdl_driver.cpp @@ -697,16 +697,6 @@ SDLDriver::SDLDriver(std::string input_engine_) : InputEngine(std::move(input_en SDL_AddEventWatch(&SDLEventWatcher, this); initialized = true; - if (start_thread) { - vibration_thread = std::thread([this] { - Common::SetCurrentThreadName("SDL_Vibration"); - using namespace std::chrono_literals; - while (initialized) { - SendVibrations(); - std::this_thread::sleep_for(250ms); // 4 TPS - } - }); - } // Because the events for joystick connection happens before we have our event watcher added, we // can just open all the joysticks right here int joystick_count = 0; @@ -725,7 +715,6 @@ SDLDriver::~SDLDriver() { initialized = false; if (start_thread) { - vibration_thread.join(); SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD); } } @@ -805,10 +794,7 @@ Common::Input::DriverResult SDLDriver::SetVibration( .type = Common::Input::VibrationAmplificationType::Exponential, }; - vibration_queue.Push(VibrationRequest{ - .identifier = identifier, - .vibration = new_vibration, - }); + joystick->RumblePlay(new_vibration); return Common::Input::DriverResult::Success; } @@ -852,31 +838,6 @@ bool SDLDriver::IsVibrationEnabled(const PadIdentifier& identifier) { return true; } -void SDLDriver::SendVibrations() { - std::vector filtered_vibrations{}; - while (!vibration_queue.Empty()) { - VibrationRequest request; - vibration_queue.Pop(request); - const auto joystick = GetSDLJoystickByGUID(request.identifier.guid.RawString(), - static_cast(request.identifier.port)); - const auto it = std::find_if(filtered_vibrations.begin(), filtered_vibrations.end(), - [request](VibrationRequest vibration) { - return vibration.identifier == request.identifier; - }); - if (it == filtered_vibrations.end()) { - filtered_vibrations.push_back(std::move(request)); - continue; - } - *it = request; - } - - for (const auto& vibration : filtered_vibrations) { - const auto joystick = GetSDLJoystickByGUID(vibration.identifier.guid.RawString(), - static_cast(vibration.identifier.port)); - joystick->RumblePlay(vibration.vibration); - } -} - Common::ParamPackage SDLDriver::BuildAnalogParamPackageForButton(int port, const Common::UUID& guid, s32 axis, float value) const { Common::ParamPackage params{}; diff --git a/src/input_common/drivers/sdl_driver.h b/src/input_common/drivers/sdl_driver.h index 9a279e926f..e6751b6688 100644 --- a/src/input_common/drivers/sdl_driver.h +++ b/src/input_common/drivers/sdl_driver.h @@ -113,16 +113,11 @@ private: /// Returns true if the button is on the left joycon bool IsButtonOnLeftSide(Settings::NativeButton::Values button) const; - /// Queue of vibration request to controllers - Common::SPSCQueue vibration_queue; - /// Map of GUID of a list of corresponding virtual Joysticks ::Common::unordered_map>> joystick_map; std::mutex joystick_map_mutex; - bool start_thread = false; std::atomic initialized = false; - - std::thread vibration_thread; + bool start_thread; }; } // namespace InputCommon From 14da4482a4668928bad43bb67ef12f96b9c9d972 Mon Sep 17 00:00:00 2001 From: lizzie Date: Wed, 14 Oct 2026 21:24:58 +0200 Subject: [PATCH 13/32] [input_common/joycon] Enumerate SDL devices iff SDL signals change (#4486) As per SDL documentation this is the "desired" loop. > Enumerating the HID devices is an expensive operation, so you can call this to see if there have been any system device changes since the last call to this function. A change in the counter returned doesn't necessarily mean that anything has changed, but you can call SDL_hid_enumerate() to get an updated device list. https://wiki.libsdl.org/SDL3/SDL_hid_device_change_count Signed-off-by: lizzie - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4486 Reviewed-by: Maufeat Reviewed-by: CamilleLaVey --- src/input_common/drivers/joycon.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/input_common/drivers/joycon.cpp b/src/input_common/drivers/joycon.cpp index fb2d75e384..047e7eb6d8 100644 --- a/src/input_common/drivers/joycon.cpp +++ b/src/input_common/drivers/joycon.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project @@ -83,20 +83,21 @@ void Joycons::ScanThread(std::stop_token stop_token) { constexpr u16 nintendo_vendor_id = 0x057e; Common::SetCurrentThreadName("JoyconScanThread"); + auto last_ret = 0u; do { - SDL_hid_device_info* devs = SDL_hid_enumerate(nintendo_vendor_id, 0x0); - SDL_hid_device_info* cur_dev = devs; - - while (cur_dev) { - if (IsDeviceNew(cur_dev)) { - LOG_DEBUG(Input, "Device Found,type : {:04X} {:04X}", cur_dev->vendor_id, - cur_dev->product_id); - RegisterNewDevice(cur_dev); + auto ret = SDL_hid_device_change_count(); + if (last_ret == 0u || last_ret != ret) { + last_ret = ret; + SDL_hid_device_info* devs = SDL_hid_enumerate(nintendo_vendor_id, 0x0); + for (auto* cur_dev = devs; cur_dev; cur_dev = cur_dev->next) { + if (IsDeviceNew(cur_dev)) { + LOG_DEBUG(Input, "Device Found,type : {:04X} {:04X}", cur_dev->vendor_id, cur_dev->product_id); + RegisterNewDevice(cur_dev); + } + cur_dev = cur_dev->next; } - cur_dev = cur_dev->next; + SDL_hid_free_enumeration(devs); } - - SDL_hid_free_enumeration(devs); } while (Common::StoppableTimedWait(stop_token, std::chrono::seconds{5})); } From e255c20db4111485d228c10478bda63aabcfdde5 Mon Sep 17 00:00:00 2001 From: PavelBARABANOV Date: Thu, 15 Oct 2026 08:45:15 +0200 Subject: [PATCH 14/32] Revert "[hle] constexpr handler dispatch maps, introduce version gating (#4480)" (#4532) This reverts commit 218c6705d950635bc18f8458d738a1996fb592b6. - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md). - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4532 Reviewed-by: lizzie Reviewed-by: CamilleLaVey Reviewed-by: Maufeat --- docs/DesignOverview.md | 2 +- docs/{SubsystemHLE.md => HosKernel.md} | 53 +- docs/README.md | 2 +- src/core/CMakeLists.txt | 70 +- src/core/hle/service/acc/acc.cpp | 2027 ++++++++--------- src/core/hle/service/acc/acc.h | 64 + src/core/hle/service/acc/async_context.cpp | 11 + src/core/hle/service/acc/async_context.h | 10 - src/core/hle/service/acc/errors.h | 3 + src/core/hle/service/am/am.cpp | 1338 +---------- src/core/hle/service/am/am.h | 3 + src/core/hle/service/am/applet_manager.h | 2 +- .../hle/service/am/frontend/applet_cabinet.h | 3 + .../service/am/frontend/applet_controller.h | 2 +- .../hle/service/am/frontend/applet_error.h | 3 + .../hle/service/am/frontend/applet_general.h | 3 + .../hle/service/am/frontend/applet_mii_edit.h | 3 + .../am/frontend/applet_mii_edit_types.h | 3 + .../service/am/frontend/applet_net_connect.h | 2 +- .../am/frontend/applet_profile_select.cpp | 3 + .../am/frontend/applet_profile_select.h | 3 + .../frontend/applet_software_keyboard_types.h | 3 + .../service/am/frontend/applet_web_browser.h | 2 +- src/core/hle/service/am/frontend/applets.h | 2 +- src/core/hle/service/am/process_holder.cpp | 3 + src/core/hle/service/am/process_holder.h | 3 + .../all_system_applet_proxies_service.cpp | 135 ++ .../all_system_applet_proxies_service.h | 56 + .../am/service/applet_common_functions.cpp | 98 + .../am/service/applet_common_functions.h | 33 + .../am/service/application_accessor.cpp | 64 +- .../service/am/service/application_accessor.h | 1 - .../am/service/application_creator.cpp | 20 +- .../service/am/service/application_creator.h | 1 - .../am/service/application_functions.cpp | 153 +- .../am/service/application_functions.h | 1 - .../service/am/service/application_proxy.cpp | 109 + .../service/am/service/application_proxy.h | 52 + .../am/service/application_proxy_service.cpp | 47 + .../am/service/application_proxy_service.h | 36 + .../service/am/service/audio_controller.cpp | 24 +- .../hle/service/am/service/audio_controller.h | 1 - .../am/service/common_state_getter.cpp | 209 +- .../service/am/service/common_state_getter.h | 1 - .../am/service/cradle_firmware_updater.cpp | 25 +- .../am/service/cradle_firmware_updater.h | 1 - .../service/am/service/debug_functions.cpp | 46 + .../hle/service/am/service/debug_functions.h | 19 + .../service/am/service/display_controller.cpp | 68 +- .../service/am/service/display_controller.h | 1 - .../am/service/global_state_controller.cpp | 38 +- .../am/service/global_state_controller.h | 4 +- .../am/service/home_menu_functions.cpp | 42 +- .../service/am/service/home_menu_functions.h | 1 - .../am/service/library_applet_accessor.cpp | 64 +- .../am/service/library_applet_accessor.h | 22 +- .../am/service/library_applet_creator.cpp | 287 +++ .../am/service/library_applet_creator.h | 44 + .../am/service/library_applet_proxy.cpp | 137 ++ .../service/am/service/library_applet_proxy.h | 59 + .../service/library_applet_self_accessor.cpp | 332 +++ .../am/service/library_applet_self_accessor.h | 87 + .../hle/service/am/service/lock_accessor.cpp | 78 + .../hle/service/am/service/lock_accessor.h | 35 + .../am/service/overlay_applet_proxy.cpp | 120 + .../service/am/service/overlay_applet_proxy.h | 55 + .../service/am/service/overlay_functions.cpp | 52 +- .../service/am/service/overlay_functions.h | 35 +- .../am/service/process_winding_controller.cpp | 28 +- .../am/service/process_winding_controller.h | 1 - .../service/am/service/self_controller.cpp | 113 +- .../hle/service/am/service/self_controller.h | 1 - src/core/hle/service/am/service/storage.cpp | 78 +- src/core/hle/service/am/service/storage.h | 1 - .../service/am/service/storage_accessor.cpp | 71 + .../hle/service/am/service/storage_accessor.h | 41 + .../am/service/system_applet_proxy.cpp | 136 ++ .../service/am/service/system_applet_proxy.h | 58 + .../service/am/service/window_controller.cpp | 28 +- .../service/am/service/window_controller.h | 1 - .../hle/service/aoc/addon_content_manager.cpp | 57 +- .../hle/service/aoc/addon_content_manager.h | 2 +- .../service/aoc/purchase_event_manager.cpp | 27 +- .../hle/service/aoc/purchase_event_manager.h | 2 - src/core/hle/service/apm/apm.h | 3 + src/core/hle/service/apm/apm_controller.h | 3 + src/core/hle/service/apm/apm_interface.cpp | 38 +- src/core/hle/service/apm/apm_interface.h | 21 - src/core/hle/service/audio/audio.cpp | 208 +- src/core/hle/service/audio/audio.h | 3 + .../hle/service/audio/audio_controller.cpp | 139 +- src/core/hle/service/audio/audio_controller.h | 2 +- src/core/hle/service/audio/audio_device.cpp | 52 +- src/core/hle/service/audio/audio_device.h | 1 - src/core/hle/service/audio/audio_in.cpp | 50 +- src/core/hle/service/audio/audio_in.h | 1 - .../hle/service/audio/audio_in_manager.cpp | 30 +- src/core/hle/service/audio/audio_in_manager.h | 1 - src/core/hle/service/audio/audio_out.cpp | 40 +- src/core/hle/service/audio/audio_out.h | 2 - .../hle/service/audio/audio_out_manager.cpp | 20 +- .../hle/service/audio/audio_out_manager.h | 1 - src/core/hle/service/audio/audio_renderer.cpp | 51 +- src/core/hle/service/audio/audio_renderer.h | 1 - .../service/audio/audio_renderer_manager.cpp | 22 +- .../service/audio/audio_renderer_manager.h | 1 - .../audio/final_output_recorder_manager.cpp | 39 +- .../audio/final_output_recorder_manager.h | 7 - ...nal_output_recorder_manager_for_applet.cpp | 8 + ...final_output_recorder_manager_for_applet.h | 8 - .../service/audio/hardware_opus_decoder.cpp | 32 +- .../hle/service/audio/hardware_opus_decoder.h | 1 - .../audio/hardware_opus_decoder_manager.cpp | 31 +- .../audio/hardware_opus_decoder_manager.h | 1 - src/core/hle/service/bcat/bcat.h | 3 + src/core/hle/service/bcat/bcat_result.h | 3 + src/core/hle/service/bcat/bcat_service.cpp | 75 +- src/core/hle/service/bcat/bcat_service.h | 1 - .../bcat/delivery_cache_directory_service.cpp | 18 +- .../bcat/delivery_cache_directory_service.h | 1 - .../bcat/delivery_cache_file_service.cpp | 20 +- .../bcat/delivery_cache_file_service.h | 1 - .../bcat/delivery_cache_progress_service.cpp | 16 +- .../bcat/delivery_cache_progress_service.h | 1 - .../bcat/delivery_cache_storage_service.cpp | 18 +- .../bcat/delivery_cache_storage_service.h | 1 - src/core/hle/service/bcat/news/builtin_news.h | 2 +- src/core/hle/service/bcat/news/msgpack.cpp | 2 +- src/core/hle/service/bcat/news/msgpack.h | 2 +- .../bcat/news/newly_arrived_event_holder.cpp | 19 +- .../bcat/news/newly_arrived_event_holder.h | 1 - .../service/bcat/news/news_data_service.cpp | 19 +- .../hle/service/bcat/news/news_data_service.h | 1 - .../bcat/news/news_database_service.cpp | 23 +- .../service/bcat/news/news_database_service.h | 2 - .../hle/service/bcat/news/news_service.cpp | 50 +- src/core/hle/service/bcat/news/news_service.h | 9 +- .../hle/service/bcat/news/news_storage.cpp | 2 +- .../bcat/news/overwrite_event_holder.cpp | 18 +- .../bcat/news/overwrite_event_holder.h | 1 - .../hle/service/bcat/news/service_creator.cpp | 22 +- .../hle/service/bcat/news/service_creator.h | 1 - src/core/hle/service/bcat/service_creator.cpp | 26 +- src/core/hle/service/bcat/service_creator.h | 1 - src/core/hle/service/bpc/bpc.cpp | 138 +- src/core/hle/service/bpc/bpc.h | 3 + src/core/hle/service/btdrv/btdrv.cpp | 310 +-- src/core/hle/service/btdrv/btdrv.h | 3 + src/core/hle/service/btm/btm.cpp | 495 +--- src/core/hle/service/btm/btm.h | 3 + src/core/hle/service/btm/btm_debug.cpp | 40 + src/core/hle/service/btm/btm_debug.h | 24 + src/core/hle/service/btm/btm_system.cpp | 34 + src/core/hle/service/btm/btm_system.h | 28 + src/core/hle/service/btm/btm_system_core.cpp | 135 ++ src/core/hle/service/btm/btm_system_core.h | 62 + src/core/hle/service/btm/btm_user.cpp | 33 + src/core/hle/service/btm/btm_user.h | 28 + src/core/hle/service/btm/btm_user_core.cpp | 106 + src/core/hle/service/btm/btm_user_core.h | 50 + src/core/hle/service/caps/caps.cpp | 218 +- src/core/hle/service/caps/caps.h | 3 + src/core/hle/service/caps/caps_a.cpp | 211 ++ src/core/hle/service/caps/caps_a.h | 63 + src/core/hle/service/caps/caps_c.cpp | 50 +- src/core/hle/service/caps/caps_c.h | 9 +- src/core/hle/service/caps/caps_result.h | 3 + src/core/hle/service/caps/caps_sc.cpp | 26 + src/core/hle/service/caps/caps_sc.h | 26 - src/core/hle/service/caps/caps_ss.cpp | 26 +- src/core/hle/service/caps/caps_ss.h | 1 - src/core/hle/service/caps/caps_su.cpp | 22 +- src/core/hle/service/caps/caps_su.h | 2 +- src/core/hle/service/caps/caps_u.cpp | 40 +- src/core/hle/service/caps/caps_u.h | 1 - src/core/hle/service/cmif_types.h | 3 + src/core/hle/service/erpt/erpt.cpp | 64 +- src/core/hle/service/erpt/erpt.h | 3 + src/core/hle/service/es/es.cpp | 342 +-- src/core/hle/service/es/es.h | 3 + src/core/hle/service/eupld/eupld.cpp | 44 +- src/core/hle/service/eupld/eupld.h | 3 + src/core/hle/service/fatal/fatal.cpp | 31 +- src/core/hle/service/fatal/fatal.h | 3 + src/core/hle/service/fatal/fatal_p.cpp | 22 + src/core/hle/service/fatal/fatal_p.h | 19 + src/core/hle/service/fatal/fatal_u.cpp | 23 + src/core/hle/service/fatal/fatal_u.h | 19 + src/core/hle/service/fgm/fgm.cpp | 52 +- src/core/hle/service/fgm/fgm.h | 3 + .../service/filesystem/fsp/fs_i_directory.cpp | 13 +- .../service/filesystem/fsp/fs_i_directory.h | 2 - .../hle/service/filesystem/fsp/fs_i_file.cpp | 12 + .../hle/service/filesystem/fsp/fs_i_file.h | 13 - .../filesystem/fsp/fs_i_filesystem.cpp | 43 +- .../service/filesystem/fsp/fs_i_filesystem.h | 1 - .../fsp/fs_i_multi_commit_manager.cpp | 5 + .../fsp/fs_i_multi_commit_manager.h | 7 - .../fsp/fs_i_save_data_info_reader.cpp | 5 + .../fsp/fs_i_save_data_info_reader.h | 6 - .../service/filesystem/fsp/fs_i_storage.cpp | 9 + .../hle/service/filesystem/fsp/fs_i_storage.h | 15 +- .../hle/service/filesystem/fsp/fsp_ldr.cpp | 9 + src/core/hle/service/filesystem/fsp/fsp_ldr.h | 9 - .../hle/service/filesystem/fsp/fsp_pr.cpp | 10 + src/core/hle/service/filesystem/fsp/fsp_pr.h | 10 - .../hle/service/filesystem/fsp/fsp_srv.cpp | 271 +-- src/core/hle/service/filesystem/fsp/fsp_srv.h | 1 - .../hle/service/filesystem/fsp/fsp_types.h | 3 + .../fsp/save_data_transfer_prohibiter.cpp | 3 + .../fsp/save_data_transfer_prohibiter.h | 3 + .../service/filesystem/romfs_controller.cpp | 3 + .../hle/service/filesystem/romfs_controller.h | 3 + .../filesystem/save_data_controller.cpp | 2 +- .../service/filesystem/save_data_controller.h | 3 + src/core/hle/service/friend/friend.cpp | 378 ++- src/core/hle/service/friend/friend.h | 3 + .../hle/service/friend/friend_interface.cpp | 23 + .../hle/service/friend/friend_interface.h | 19 + src/core/hle/service/glue/arp.cpp | 42 +- src/core/hle/service/glue/arp.h | 23 - src/core/hle/service/glue/bgtc.cpp | 43 +- src/core/hle/service/glue/bgtc.h | 39 - src/core/hle/service/glue/ectx.cpp | 38 +- src/core/hle/service/glue/ectx.h | 26 - src/core/hle/service/glue/errors.h | 3 + src/core/hle/service/glue/glue.h | 3 + src/core/hle/service/glue/glue_manager.cpp | 3 + src/core/hle/service/glue/glue_manager.h | 3 + src/core/hle/service/glue/notif.cpp | 96 +- src/core/hle/service/glue/notif.h | 2 - src/core/hle/service/glue/time/alarm_worker.h | 3 + .../glue/time/file_timestamp_worker.cpp | 3 + .../service/glue/time/file_timestamp_worker.h | 3 + src/core/hle/service/glue/time/manager.cpp | 2 +- src/core/hle/service/glue/time/manager.h | 3 + .../glue/time/pm_state_change_handler.cpp | 3 + .../glue/time/pm_state_change_handler.h | 3 + .../time/standard_steady_clock_resource.cpp | 3 + .../time/standard_steady_clock_resource.h | 3 + src/core/hle/service/glue/time/static.cpp | 56 +- src/core/hle/service/glue/time/static.h | 3 +- src/core/hle/service/glue/time/time_zone.cpp | 40 +- src/core/hle/service/glue/time/time_zone.h | 1 - .../service/glue/time/time_zone_binary.cpp | 3 + .../hle/service/glue/time/time_zone_binary.h | 3 + src/core/hle/service/glue/time/worker.h | 3 + src/core/hle/service/gpio/gpio.cpp | 16 +- src/core/hle/service/grc/grc.cpp | 39 +- src/core/hle/service/grc/grc.h | 3 + .../hid/active_vibration_device_list.cpp | 14 +- .../hid/active_vibration_device_list.h | 2 +- src/core/hle/service/hid/applet_resource.cpp | 11 +- src/core/hle/service/hid/applet_resource.h | 1 - src/core/hle/service/hid/hid.cpp | 365 +-- src/core/hle/service/hid/hid.h | 3 + src/core/hle/service/hid/hid_debug_server.cpp | 294 +++ src/core/hle/service/hid/hid_debug_server.h | 26 + src/core/hle/service/hid/hid_server.cpp | 396 ++-- src/core/hle/service/hid/hid_server.h | 2 - .../hle/service/hid/hid_system_server.cpp | 246 ++ src/core/hle/service/hid/hid_system_server.h | 246 -- src/core/hle/service/hid/hidbus.cpp | 42 +- src/core/hle/service/hid/hidbus.h | 2 - src/core/hle/service/hid/irs.cpp | 58 +- src/core/hle/service/hid/irs.h | 12 - src/core/hle/service/hid/xcd.cpp | 27 + src/core/hle/service/hid/xcd.h | 27 - src/core/hle/service/i2c/i2c.cpp | 54 +- src/core/hle/service/jit/jit.cpp | 37 +- src/core/hle/service/jit/jit.h | 3 + src/core/hle/service/jit/jit_context.h | 3 + src/core/hle/service/lbl/lbl.cpp | 71 +- src/core/hle/service/lbl/lbl.h | 3 + src/core/hle/service/ldn/lan_discovery.cpp | 3 +- src/core/hle/service/ldn/lan_discovery.h | 3 + src/core/hle/service/ldn/ldn.cpp | 138 +- src/core/hle/service/ldn/ldn.h | 3 + src/core/hle/service/ldn/ldn_results.h | 3 + src/core/hle/service/ldn/monitor_service.cpp | 28 +- src/core/hle/service/ldn/monitor_service.h | 1 - .../hle/service/ldn/sf_monitor_service.cpp | 18 +- src/core/hle/service/ldn/sf_monitor_service.h | 1 - src/core/hle/service/ldn/sf_service.cpp | 40 + src/core/hle/service/ldn/sf_service.h | 24 + .../hle/service/ldn/sf_service_monitor.cpp | 38 +- src/core/hle/service/ldn/sf_service_monitor.h | 4 +- .../system_local_communication_service.cpp | 72 +- .../ldn/system_local_communication_service.h | 1 - .../ldn/user_local_communication_service.cpp | 73 +- .../ldn/user_local_communication_service.h | 5 +- src/core/hle/service/ldr/ldr.cpp | 53 +- src/core/hle/service/ldr/ldr.h | 3 + src/core/hle/service/lm/lm.cpp | 55 +- src/core/hle/service/lm/lm.h | 3 + src/core/hle/service/mig/mig.cpp | 84 +- src/core/hle/service/mig/mig.h | 3 + src/core/hle/service/mii/mii.cpp | 134 +- src/core/hle/service/mii/mii.h | 1 - src/core/hle/service/mii/mii_database.cpp | 2 +- src/core/hle/service/mii/mii_database.h | 3 + .../hle/service/mii/mii_database_manager.h | 3 + src/core/hle/service/mii/mii_manager.h | 3 + src/core/hle/service/mii/mii_result.h | 3 + src/core/hle/service/mii/mii_types.h | 3 + src/core/hle/service/mii/types/char_info.cpp | 3 + src/core/hle/service/mii/types/char_info.h | 3 + src/core/hle/service/mii/types/core_data.cpp | 3 + src/core/hle/service/mii/types/core_data.h | 3 + src/core/hle/service/mii/types/raw_data.h | 3 + src/core/hle/service/mii/types/store_data.cpp | 3 + src/core/hle/service/mii/types/store_data.h | 3 + .../hle/service/mii/types/ver3_store_data.cpp | 3 + .../hle/service/mii/types/ver3_store_data.h | 3 + src/core/hle/service/mm/mm_u.cpp | 27 +- src/core/hle/service/mm/mm_u.h | 3 + src/core/hle/service/mnpp/mnpp.cpp | 62 +- src/core/hle/service/ncm/ncm.cpp | 220 +- src/core/hle/service/ncm/ncm.h | 3 + src/core/hle/service/nfc/common/device.h | 3 + .../hle/service/nfc/common/device_manager.h | 3 + src/core/hle/service/nfc/mifare_result.h | 3 + src/core/hle/service/nfc/mifare_types.h | 3 + src/core/hle/service/nfc/nfc.cpp | 230 +- src/core/hle/service/nfc/nfc.h | 3 + src/core/hle/service/nfc/nfc_interface.h | 3 + src/core/hle/service/nfc/nfc_result.h | 3 + src/core/hle/service/nfc/nfc_types.h | 2 +- src/core/hle/service/nfp/nfp.cpp | 266 +-- src/core/hle/service/nfp/nfp.h | 3 + src/core/hle/service/nfp/nfp_interface.h | 3 + src/core/hle/service/nfp/nfp_result.h | 3 + src/core/hle/service/nfp/nfp_types.h | 2 +- src/core/hle/service/ngc/ngc.cpp | 160 +- src/core/hle/service/ngc/ngc.h | 3 + src/core/hle/service/nifm/nifm.cpp | 227 +- src/core/hle/service/nifm/nifm.h | 1 - src/core/hle/service/nim/nim.cpp | 681 +++--- src/core/hle/service/nim/nim.h | 3 + src/core/hle/service/npns/npns.cpp | 196 +- src/core/hle/service/npns/npns.h | 3 + .../service/ns/account_proxy_interface.cpp | 7 + .../hle/service/ns/account_proxy_interface.h | 7 - .../ns/application_manager_interface.cpp | 904 ++++---- .../ns/application_manager_interface.h | 1 - .../ns/application_version_interface.cpp | 19 + .../ns/application_version_interface.h | 19 - src/core/hle/service/ns/async_result.cpp | 18 +- src/core/hle/service/ns/async_result.h | 1 - .../ns/content_management_interface.cpp | 16 + .../service/ns/content_management_interface.h | 16 - src/core/hle/service/ns/develop_interface.cpp | 25 + src/core/hle/service/ns/develop_interface.h | 25 - .../hle/service/ns/document_interface.cpp | 9 + src/core/hle/service/ns/document_interface.h | 9 - .../service/ns/download_task_interface.cpp | 15 + .../hle/service/ns/download_task_interface.h | 15 - .../service/ns/dynamic_rights_interface.cpp | 70 +- .../hle/service/ns/dynamic_rights_interface.h | 2 - .../hle/service/ns/ecommerce_interface.cpp | 13 + src/core/hle/service/ns/ecommerce_interface.h | 13 - .../service/ns/factory_reset_interface.cpp | 26 +- .../hle/service/ns/factory_reset_interface.h | 1 - src/core/hle/service/ns/ns.cpp | 63 +- src/core/hle/service/ns/ns.h | 3 + src/core/hle/service/ns/ns_results.h | 3 + .../service/ns/platform_service_manager.cpp | 44 +- .../hle/service/ns/platform_service_manager.h | 9 +- src/core/hle/service/ns/query_service.cpp | 64 +- src/core/hle/service/ns/query_service.h | 1 - ...nly_application_control_data_interface.cpp | 48 +- ..._only_application_control_data_interface.h | 2 - ...read_only_application_record_interface.cpp | 19 +- .../read_only_application_record_interface.h | 2 - .../service/ns/service_getter_interface.cpp | 34 +- .../hle/service/ns/service_getter_interface.h | 2 - .../hle/service/ns/system_update_control.cpp | 29 + .../hle/service/ns/system_update_control.h | 29 - .../service/ns/system_update_interface.cpp | 46 +- .../hle/service/ns/system_update_interface.h | 2 +- .../nvdrv/devices/ioctl_serialization.h | 2 +- src/core/hle/service/nvdrv/devices/nvdevice.h | 3 + .../hle/service/nvdrv/devices/nvhost_gpu.cpp | 2 +- .../hle/service/nvdrv/devices/nvhost_nvdec.h | 3 + .../hle/service/nvdrv/devices/nvhost_nvjpg.h | 3 + .../hle/service/nvdrv/devices/nvhost_vic.h | 3 + src/core/hle/service/nvdrv/nvdrv.cpp | 74 +- .../hle/service/nvdrv/nvdrv_interface.cpp | 18 + src/core/hle/service/nvdrv/nvdrv_interface.h | 21 +- src/core/hle/service/nvdrv/nvmemp.cpp | 5 + src/core/hle/service/nvdrv/nvmemp.h | 8 - src/core/hle/service/nvnflinger/binder.h | 3 + src/core/hle/service/nvnflinger/buffer_item.h | 3 + .../service/nvnflinger/buffer_item_consumer.h | 3 + .../nvnflinger/buffer_queue_consumer.h | 3 + .../service/nvnflinger/buffer_queue_defs.h | 3 + .../nvnflinger/buffer_transform_flags.h | 3 + .../hle/service/nvnflinger/consumer_base.h | 3 + .../service/nvnflinger/consumer_listener.h | 3 + .../nvnflinger/graphic_buffer_producer.cpp | 3 + .../nvnflinger/graphic_buffer_producer.h | 3 + .../service/nvnflinger/hos_binder_driver.cpp | 17 +- .../service/nvnflinger/hos_binder_driver.h | 1 - .../hle/service/nvnflinger/nvnflinger.cpp | 3 + src/core/hle/service/nvnflinger/nvnflinger.h | 3 + src/core/hle/service/nvnflinger/parcel.h | 2 +- .../hle/service/nvnflinger/pixel_format.h | 3 + .../service/nvnflinger/producer_listener.h | 3 + src/core/hle/service/nvnflinger/status.h | 3 + .../service/nvnflinger/ui/graphic_buffer.cpp | 3 + .../service/nvnflinger/ui/graphic_buffer.h | 3 + src/core/hle/service/nvnflinger/window.h | 3 + .../hle/service/olsc/daemon_controller.cpp | 36 +- src/core/hle/service/olsc/daemon_controller.h | 2 - .../hle/service/olsc/native_handle_holder.cpp | 14 +- .../hle/service/olsc/native_handle_holder.h | 1 - src/core/hle/service/olsc/olsc.cpp | 173 +- src/core/hle/service/olsc/olsc.h | 3 + .../olsc/olsc_service_for_application.cpp | 56 +- .../olsc/olsc_service_for_application.h | 2 - .../olsc/olsc_service_for_system_service.cpp | 144 ++ .../olsc/olsc_service_for_system_service.h | 53 + .../olsc/remote_storage_controller.cpp | 72 +- .../service/olsc/remote_storage_controller.h | 2 - .../olsc/transfer_task_list_controller.cpp | 74 +- .../olsc/transfer_task_list_controller.h | 2 - src/core/hle/service/omm/omm.cpp | 3 + src/core/hle/service/omm/omm.h | 3 + .../service/omm/operation_mode_manager.cpp | 35 + .../hle/service/omm/operation_mode_manager.h | 35 - .../hle/service/omm/policy_manager_system.cpp | 12 + .../hle/service/omm/policy_manager_system.h | 12 - .../hle/service/omm/power_state_interface.cpp | 18 + .../hle/service/omm/power_state_interface.h | 18 - src/core/hle/service/os/multi_wait.cpp | 3 + src/core/hle/service/os/multi_wait.h | 3 + src/core/hle/service/os/multi_wait_holder.cpp | 3 + src/core/hle/service/os/multi_wait_holder.h | 3 + src/core/hle/service/os/multi_wait_utils.h | 3 + src/core/hle/service/os/mutex.h | 3 + src/core/hle/service/pcie/pcie.cpp | 90 +- src/core/hle/service/pcie/pcie.h | 3 + .../service/pctl/parental_control_service.cpp | 498 ++++ .../service/pctl/parental_control_service.h | 99 + .../pctl/parental_control_service_factory.cpp | 44 + .../pctl/parental_control_service_factory.h | 34 + src/core/hle/service/pctl/pctl.cpp | 633 +---- src/core/hle/service/pctl/pctl.h | 3 + src/core/hle/service/pctl/pctl_results.h | 18 + src/core/hle/service/pctl/pctl_types.h | 73 + src/core/hle/service/pcv/pcv.cpp | 172 +- src/core/hle/service/pcv/pcv.h | 3 + src/core/hle/service/pm/pm.cpp | 100 +- src/core/hle/service/pm/pm.h | 3 + src/core/hle/service/prepo/prepo.cpp | 91 +- src/core/hle/service/prepo/prepo.h | 3 + src/core/hle/service/psc/ovln/ovln_types.h | 2 +- src/core/hle/service/psc/ovln/receiver.cpp | 118 + src/core/hle/service/psc/ovln/receiver.h | 46 + .../hle/service/psc/ovln/receiver_service.cpp | 123 +- .../hle/service/psc/ovln/receiver_service.h | 2 - src/core/hle/service/psc/ovln/sender.cpp | 35 + src/core/hle/service/psc/ovln/sender.h | 24 + .../hle/service/psc/ovln/sender_service.cpp | 40 +- .../hle/service/psc/ovln/sender_service.h | 5 +- src/core/hle/service/psc/pm_control.cpp | 31 + src/core/hle/service/psc/pm_control.h | 19 + src/core/hle/service/psc/pm_module.cpp | 27 + src/core/hle/service/psc/pm_module.h | 19 + src/core/hle/service/psc/pm_service.cpp | 31 + src/core/hle/service/psc/pm_service.h | 25 + src/core/hle/service/psc/psc.cpp | 181 +- src/core/hle/service/psc/psc.h | 3 + src/core/hle/service/psc/time/alarms.cpp | 24 +- src/core/hle/service/psc/time/alarms.h | 21 +- .../ephemeral_network_system_clock_core.h | 3 + .../standard_local_system_clock_core.cpp | 3 + .../clocks/standard_local_system_clock_core.h | 3 + .../standard_network_system_clock_core.cpp | 3 + .../standard_network_system_clock_core.h | 3 + .../clocks/standard_steady_clock_core.cpp | 3 + .../time/clocks/standard_steady_clock_core.h | 3 + .../clocks/standard_user_system_clock_core.h | 3 + .../psc/time/clocks/steady_clock_core.h | 3 + .../psc/time/clocks/system_clock_core.cpp | 3 + .../psc/time/clocks/system_clock_core.h | 3 + .../clocks/tick_based_steady_clock_core.cpp | 3 + .../clocks/tick_based_steady_clock_core.h | 3 + src/core/hle/service/psc/time/common.cpp | 3 + src/core/hle/service/psc/time/manager.h | 28 +- .../psc/time/power_state_request_manager.h | 3 + .../service/psc/time/power_state_service.cpp | 19 +- .../service/psc/time/power_state_service.h | 1 - .../hle/service/psc/time/service_manager.cpp | 48 +- .../hle/service/psc/time/service_manager.h | 2 - .../hle/service/psc/time/shared_memory.cpp | 3 + src/core/hle/service/psc/time/static.cpp | 50 +- src/core/hle/service/psc/time/static.h | 2 - .../hle/service/psc/time/steady_clock.cpp | 28 +- src/core/hle/service/psc/time/steady_clock.h | 2 - .../hle/service/psc/time/system_clock.cpp | 24 +- src/core/hle/service/psc/time/system_clock.h | 1 - src/core/hle/service/psc/time/time_zone.cpp | 3 + src/core/hle/service/psc/time/time_zone.h | 3 + .../service/psc/time/time_zone_service.cpp | 42 +- .../hle/service/psc/time/time_zone_service.h | 1 - src/core/hle/service/ptm/psm.cpp | 53 +- src/core/hle/service/ptm/psm.h | 25 - src/core/hle/service/ptm/ptm.cpp | 32 +- src/core/hle/service/ptm/ptm.h | 3 + src/core/hle/service/ptm/ts.cpp | 29 +- src/core/hle/service/ptm/ts.h | 11 - src/core/hle/service/ro/ro.cpp | 371 +-- src/core/hle/service/ro/ro.h | 3 + src/core/hle/service/ro/ro_nro_utils.cpp | 188 ++ src/core/hle/service/ro/ro_nro_utils.h | 29 + src/core/hle/service/ro/ro_results.h | 29 + src/core/hle/service/ro/ro_types.h | 142 ++ src/core/hle/service/server_manager.h | 3 + src/core/hle/service/service.cpp | 69 +- src/core/hle/service/service.h | 145 +- src/core/hle/service/services.h | 2 +- .../service/set/factory_settings_server.cpp | 49 + .../hle/service/set/factory_settings_server.h | 49 - .../set/firmware_debug_settings_server.cpp | 17 + .../set/firmware_debug_settings_server.h | 17 - src/core/hle/service/set/key_code_map.h | 3 + .../set/setting_formats/appln_settings.cpp | 3 + .../set/setting_formats/appln_settings.h | 3 + .../set/setting_formats/device_settings.cpp | 3 + .../set/setting_formats/private_settings.cpp | 3 + .../set/setting_formats/private_settings.h | 3 + .../set/setting_formats/system_settings.cpp | 2 +- src/core/hle/service/set/settings.h | 3 + src/core/hle/service/set/settings_server.cpp | 38 +- src/core/hle/service/set/settings_server.h | 36 +- .../service/set/system_settings_server.cpp | 465 ++-- .../hle/service/set/system_settings_server.h | 2 +- src/core/hle/service/sm/sm.cpp | 205 +- src/core/hle/service/sm/sm.h | 24 +- src/core/hle/service/sm/sm_controller.cpp | 128 ++ src/core/hle/service/sm/sm_controller.h | 30 + src/core/hle/service/sockets/bsd.cpp | 81 + src/core/hle/service/sockets/bsd.h | 82 +- src/core/hle/service/sockets/nsd.cpp | 32 + src/core/hle/service/sockets/nsd.h | 32 - src/core/hle/service/sockets/sfdnsres.cpp | 27 + src/core/hle/service/sockets/sfdnsres.h | 31 - src/core/hle/service/sockets/sockets.cpp | 62 +- .../hle/service/sockets/sockets_translate.h | 3 + src/core/hle/service/spl/spl.cpp | 171 +- src/core/hle/service/spl/spl.h | 141 -- src/core/hle/service/spl/spl_module.cpp | 15 +- src/core/hle/service/spl/spl_results.h | 3 + src/core/hle/service/spl/spl_types.h | 3 + src/core/hle/service/ssl/cert_store.cpp | 3 + src/core/hle/service/ssl/cert_store.h | 3 + src/core/hle/service/ssl/ssl.cpp | 397 ++-- src/core/hle/service/ssl/ssl.h | 3 + src/core/hle/service/ssl/ssl_types.h | 3 + src/core/hle/service/tma/tma.cpp | 12 +- src/core/hle/service/usb/usb.cpp | 290 +-- src/core/hle/service/usb/usb.h | 3 + .../vi/application_display_service.cpp | 56 +- .../service/vi/application_display_service.h | 2 +- .../service/vi/application_root_service.cpp | 13 +- .../hle/service/vi/application_root_service.h | 1 - src/core/hle/service/vi/display.h | 3 + src/core/hle/service/vi/display_list.h | 3 + src/core/hle/service/vi/layer.h | 3 + src/core/hle/service/vi/layer_list.h | 3 + .../service/vi/manager_display_service.cpp | 174 +- .../hle/service/vi/manager_display_service.h | 1 - .../hle/service/vi/manager_root_service.cpp | 21 +- .../hle/service/vi/manager_root_service.h | 1 - src/core/hle/service/vi/service_creator.cpp | 3 + src/core/hle/service/vi/service_creator.h | 3 + .../hle/service/vi/shared_buffer_manager.h | 4 - .../hle/service/vi/system_display_service.cpp | 110 +- .../hle/service/vi/system_display_service.h | 1 - .../hle/service/vi/system_root_service.cpp | 17 +- src/core/hle/service/vi/system_root_service.h | 1 - src/core/hle/service/vi/vi.cpp | 3 + src/core/hle/service/vi/vi.h | 3 + src/core/hle/service/vi/vi_results.h | 3 + src/core/hle/service/vi/vi_types.h | 3 + src/core/hle/service/wlan/wlan.cpp | 368 ++- tools/README.md | 2 +- 588 files changed, 14723 insertions(+), 12534 deletions(-) rename docs/{SubsystemHLE.md => HosKernel.md} (55%) create mode 100644 src/core/hle/service/am/service/all_system_applet_proxies_service.cpp create mode 100644 src/core/hle/service/am/service/all_system_applet_proxies_service.h create mode 100644 src/core/hle/service/am/service/applet_common_functions.cpp create mode 100644 src/core/hle/service/am/service/applet_common_functions.h create mode 100644 src/core/hle/service/am/service/application_proxy.cpp create mode 100644 src/core/hle/service/am/service/application_proxy.h create mode 100644 src/core/hle/service/am/service/application_proxy_service.cpp create mode 100644 src/core/hle/service/am/service/application_proxy_service.h create mode 100644 src/core/hle/service/am/service/debug_functions.cpp create mode 100644 src/core/hle/service/am/service/debug_functions.h create mode 100644 src/core/hle/service/am/service/library_applet_creator.cpp create mode 100644 src/core/hle/service/am/service/library_applet_creator.h create mode 100644 src/core/hle/service/am/service/library_applet_proxy.cpp create mode 100644 src/core/hle/service/am/service/library_applet_proxy.h create mode 100644 src/core/hle/service/am/service/library_applet_self_accessor.cpp create mode 100644 src/core/hle/service/am/service/library_applet_self_accessor.h create mode 100644 src/core/hle/service/am/service/lock_accessor.cpp create mode 100644 src/core/hle/service/am/service/lock_accessor.h create mode 100644 src/core/hle/service/am/service/overlay_applet_proxy.cpp create mode 100644 src/core/hle/service/am/service/overlay_applet_proxy.h create mode 100644 src/core/hle/service/am/service/storage_accessor.cpp create mode 100644 src/core/hle/service/am/service/storage_accessor.h create mode 100644 src/core/hle/service/am/service/system_applet_proxy.cpp create mode 100644 src/core/hle/service/am/service/system_applet_proxy.h create mode 100644 src/core/hle/service/btm/btm_debug.cpp create mode 100644 src/core/hle/service/btm/btm_debug.h create mode 100644 src/core/hle/service/btm/btm_system.cpp create mode 100644 src/core/hle/service/btm/btm_system.h create mode 100644 src/core/hle/service/btm/btm_system_core.cpp create mode 100644 src/core/hle/service/btm/btm_system_core.h create mode 100644 src/core/hle/service/btm/btm_user.cpp create mode 100644 src/core/hle/service/btm/btm_user.h create mode 100644 src/core/hle/service/btm/btm_user_core.cpp create mode 100644 src/core/hle/service/btm/btm_user_core.h create mode 100644 src/core/hle/service/caps/caps_a.cpp create mode 100644 src/core/hle/service/caps/caps_a.h create mode 100644 src/core/hle/service/fatal/fatal_p.cpp create mode 100644 src/core/hle/service/fatal/fatal_p.h create mode 100644 src/core/hle/service/fatal/fatal_u.cpp create mode 100644 src/core/hle/service/fatal/fatal_u.h create mode 100644 src/core/hle/service/friend/friend_interface.cpp create mode 100644 src/core/hle/service/friend/friend_interface.h create mode 100644 src/core/hle/service/ldn/sf_service.cpp create mode 100644 src/core/hle/service/ldn/sf_service.h create mode 100644 src/core/hle/service/olsc/olsc_service_for_system_service.cpp create mode 100644 src/core/hle/service/olsc/olsc_service_for_system_service.h create mode 100644 src/core/hle/service/pctl/parental_control_service.cpp create mode 100644 src/core/hle/service/pctl/parental_control_service.h create mode 100644 src/core/hle/service/pctl/parental_control_service_factory.cpp create mode 100644 src/core/hle/service/pctl/parental_control_service_factory.h create mode 100644 src/core/hle/service/pctl/pctl_results.h create mode 100644 src/core/hle/service/pctl/pctl_types.h create mode 100644 src/core/hle/service/psc/ovln/receiver.cpp create mode 100644 src/core/hle/service/psc/ovln/receiver.h create mode 100644 src/core/hle/service/psc/ovln/sender.cpp create mode 100644 src/core/hle/service/psc/ovln/sender.h create mode 100644 src/core/hle/service/psc/pm_control.cpp create mode 100644 src/core/hle/service/psc/pm_control.h create mode 100644 src/core/hle/service/psc/pm_module.cpp create mode 100644 src/core/hle/service/psc/pm_module.h create mode 100644 src/core/hle/service/psc/pm_service.cpp create mode 100644 src/core/hle/service/psc/pm_service.h create mode 100644 src/core/hle/service/ro/ro_nro_utils.cpp create mode 100644 src/core/hle/service/ro/ro_nro_utils.h create mode 100644 src/core/hle/service/ro/ro_results.h create mode 100644 src/core/hle/service/ro/ro_types.h create mode 100644 src/core/hle/service/sm/sm_controller.cpp create mode 100644 src/core/hle/service/sm/sm_controller.h diff --git a/docs/DesignOverview.md b/docs/DesignOverview.md index 959fbfdbb2..c6a328cb9c 100644 --- a/docs/DesignOverview.md +++ b/docs/DesignOverview.md @@ -1,6 +1,6 @@ # Design Overview -Modern game consoles require heavy power to emulate. This is why the emulator uses an approach known as HLE (High-Level-Emulation), in a nutshell: Instead of accurately emulating every subsystem that forms part of a component, emulate the resulting visible output of said interface instead. +Modern game consoles require heavy power to be emulated appropriately. This is why the emulator uses an approach known as HLE (High-Level-Emulation), in a nutshell: Instead of accurately emulating every subsystem that forms part of a component, emulate the resulting visible I/O interface instead. For example, take a disk write, instead of emulating a proper SD card we instead use the C++ standard library for I/O. Additionally we use the abstractions provided by the `fs` service to "lie" to programs about certain SD card properties. Notably this includes making up sizes for the fake SD card, giving "realistic" values or expected outputs for a given card, and so on. And instead of writing to an actual SD card, the emulator simply writes to a file. diff --git a/docs/SubsystemHLE.md b/docs/HosKernel.md similarity index 55% rename from docs/SubsystemHLE.md rename to docs/HosKernel.md index 7a59fef9fa..87df2072a5 100644 --- a/docs/SubsystemHLE.md +++ b/docs/HosKernel.md @@ -1,6 +1,4 @@ -# Subsystem: HLE - -## HOS Kernel +# HOS Kernel In brief, the HOS kernel is a microkernel, all services and programs run in userspace, the primary way to do communication between these is via `HIPC` (not covered here); otherwise most of the primitives reside in the forms of syscalls invoked via `svc #imm`. The kernel supports both 32-bit and 64-bit programs, and has the capacity to use 32, 36 and 39 bits of address space for spawned processes. Most of the networking stack is based off FreeBSD's network stack. @@ -31,52 +29,3 @@ Every process keeps it's own tracking of the following structures: The emulator willingly restricts itself to only use 4 threads (to emulate 4 cores), this is because most existing applications do not benefit greatly from the added core count, and in fact can be detrimental due to extra contention. This translates equitatively to about 4 `ArmInterface` slots for each process, these are then redirected to whatever is the last `pc` of the last thread running on the core is meant to be; proceed to run it, then when returning (due to halt or interruption), proceed to reschedule the thread. The scheduler as-is isn't 100% faithful to the original (for example the original is cooperative and not preemptive), and has great timing variance (especially due to the fact the emulator can run in systems with wildly different timings). - -## Services - -Consult [SwitchBrew](https://switchbrew.org/) for per-service methods, and implementation details. - -All services are instatiated implicitly using `ServiceFramework`. To register a new interface or service, you can inherit from said class, providing additionally a template parameter that references `Self`, for example: - -```c++ -// Follows as: -// class MyInterface [final] : public ServiceFramework { ... }; -// [final] is optional, but should be used whenever there is no intention of this class itself being inherited. -class IFloatingRegistrationRequest final : public ServiceFramework { -public: - // ctor, you can pass extra parameters here (if so required) - explicit IFloatingRegistrationRequest(Core::System& system_) - : ServiceFramework{system_, "IFloatingRegistrationRequest"} - {} - - // Must be placed after all methods are defined (or declared). - // Define here your functions and methods, please order them. - // Use FindRequestTipc for TIPC handlers. - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetSessionId"}, - FunctionInfo{12, nullptr, "GetAccountId"}, - FunctionInfo{13, nullptr, "GetLinkedNintendoAccountId"}, - FunctionInfo{14, nullptr, "GetNickname"}, - FunctionInfo{15, nullptr, "GetProfileImage"}, - FunctionInfo{16, nullptr, "GetProfileLargeImage", MakeVersionGate({18,0,0})}, - FunctionInfo{21, nullptr, "LoadIdTokenCache"}, - FunctionInfo{100, nullptr, "RegisterUser"}, - FunctionInfo{101, nullptr, "RegisterUserWithUid"}, - FunctionInfo{102, nullptr, "RegisterNetworkServiceAccountAsync", MakeVersionGate({4,0,0})}, - FunctionInfo{103, nullptr, "RegisterNetworkServiceAccountWithUidAsync", MakeVersionGate({4,0,0})}, - FunctionInfo{110, nullptr, "SetSystemProgramIdentification"}, - FunctionInfo{111, nullptr, "EnsureIdTokenCacheAsync"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } -}; -``` - -Try to keep service structures local, that is, don't place them on header files if they're only going to be used by a specific service. - -In each `.cpp` file that uses `D<...>/C<...>` CMIF wrapper helpers, remember to include the corresponding instancer, so you don't face linker errors: -```c++ -#include "core/hle/service/cmif_serialization.h" -``` -This will properly instatiate the corresponding wrappers and decompose the provided arguments in the wiring order. diff --git a/docs/README.md b/docs/README.md index f7568e16f3..5bcaf30239 100644 --- a/docs/README.md +++ b/docs/README.md @@ -21,7 +21,7 @@ This contains documentation created by developers, build instructions, guideline - Subsystems: - **[Design Overview](./DesignOverview.md)** - **[Dynarmic](./dynarmic/README.md)** - - **[Subsystem: HLE](./SubsystemHLE.md)** + - **[HOS Kernel](./HosKernel.md)** - **[Settings](./Settings.md)** ## Policies diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index f1d4bdae42..31f9931d3a 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -444,18 +444,28 @@ add_library(core STATIC hle/service/am/process_creation.h hle/service/am/process_holder.cpp hle/service/am/process_holder.h + hle/service/am/service/all_system_applet_proxies_service.cpp + hle/service/am/service/all_system_applet_proxies_service.h + hle/service/am/service/applet_common_functions.cpp + hle/service/am/service/applet_common_functions.h hle/service/am/service/application_accessor.cpp hle/service/am/service/application_accessor.h hle/service/am/service/application_creator.cpp hle/service/am/service/application_creator.h hle/service/am/service/application_functions.cpp hle/service/am/service/application_functions.h + hle/service/am/service/application_proxy.cpp + hle/service/am/service/application_proxy.h + hle/service/am/service/application_proxy_service.cpp + hle/service/am/service/application_proxy_service.h hle/service/am/service/audio_controller.cpp hle/service/am/service/audio_controller.h hle/service/am/service/common_state_getter.cpp hle/service/am/service/common_state_getter.h hle/service/am/service/cradle_firmware_updater.cpp hle/service/am/service/cradle_firmware_updater.h + hle/service/am/service/debug_functions.cpp + hle/service/am/service/debug_functions.h hle/service/am/service/display_controller.cpp hle/service/am/service/display_controller.h hle/service/am/service/global_state_controller.cpp @@ -464,14 +474,28 @@ add_library(core STATIC hle/service/am/service/home_menu_functions.h hle/service/am/service/library_applet_accessor.cpp hle/service/am/service/library_applet_accessor.h + hle/service/am/service/library_applet_creator.cpp + hle/service/am/service/library_applet_creator.h + hle/service/am/service/library_applet_proxy.cpp + hle/service/am/service/library_applet_proxy.h + hle/service/am/service/library_applet_self_accessor.cpp + hle/service/am/service/library_applet_self_accessor.h + hle/service/am/service/lock_accessor.cpp + hle/service/am/service/lock_accessor.h hle/service/am/service/overlay_functions.cpp hle/service/am/service/overlay_functions.h + hle/service/am/service/overlay_applet_proxy.cpp + hle/service/am/service/overlay_applet_proxy.h hle/service/am/service/process_winding_controller.cpp hle/service/am/service/process_winding_controller.h hle/service/am/service/self_controller.cpp hle/service/am/service/self_controller.h hle/service/am/service/storage.cpp hle/service/am/service/storage.h + hle/service/am/service/storage_accessor.cpp + hle/service/am/service/storage_accessor.h + hle/service/am/service/system_applet_proxy.cpp + hle/service/am/service/system_applet_proxy.h hle/service/am/service/window_controller.cpp hle/service/am/service/window_controller.h hle/service/am/window_system.cpp @@ -556,8 +580,20 @@ add_library(core STATIC hle/service/btdrv/btdrv.h hle/service/btm/btm.cpp hle/service/btm/btm.h + hle/service/btm/btm_debug.cpp + hle/service/btm/btm_debug.h + hle/service/btm/btm_system.cpp + hle/service/btm/btm_system.h + hle/service/btm/btm_system_core.cpp + hle/service/btm/btm_system_core.h + hle/service/btm/btm_user.cpp + hle/service/btm/btm_user.h + hle/service/btm/btm_user_core.cpp + hle/service/btm/btm_user_core.h hle/service/caps/caps.cpp hle/service/caps/caps.h + hle/service/caps/caps_a.cpp + hle/service/caps/caps_a.h hle/service/caps/caps_c.cpp hle/service/caps/caps_c.h hle/service/caps/caps_manager.cpp @@ -582,6 +618,10 @@ add_library(core STATIC hle/service/eupld/eupld.h hle/service/fatal/fatal.cpp hle/service/fatal/fatal.h + hle/service/fatal/fatal_p.cpp + hle/service/fatal/fatal_p.h + hle/service/fatal/fatal_u.cpp + hle/service/fatal/fatal_u.h hle/service/fgm/fgm.cpp hle/service/fgm/fgm.h hle/service/filesystem/filesystem.cpp @@ -613,6 +653,8 @@ add_library(core STATIC hle/service/filesystem/save_data_controller.h hle/service/friend/friend.cpp hle/service/friend/friend.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 @@ -681,6 +723,8 @@ add_library(core STATIC hle/service/ldn/monitor_service.h hle/service/ldn/sf_monitor_service.cpp hle/service/ldn/sf_monitor_service.h + hle/service/ldn/sf_service.cpp + hle/service/ldn/sf_service.h hle/service/ldn/sf_service_monitor.cpp hle/service/ldn/sf_service_monitor.h hle/service/ldn/system_local_communication_service.cpp @@ -869,6 +913,8 @@ add_library(core STATIC hle/service/olsc/native_handle_holder.h hle/service/olsc/olsc_service_for_application.cpp hle/service/olsc/olsc_service_for_application.h + hle/service/olsc/olsc_service_for_system_service.cpp + hle/service/olsc/olsc_service_for_system_service.h hle/service/olsc/olsc.cpp hle/service/olsc/olsc.h hle/service/olsc/remote_storage_controller.cpp @@ -898,8 +944,14 @@ add_library(core STATIC hle/service/os/process.h hle/service/pcie/pcie.cpp hle/service/pcie/pcie.h + hle/service/pctl/parental_control_service_factory.cpp + hle/service/pctl/parental_control_service_factory.h + hle/service/pctl/parental_control_service.cpp + hle/service/pctl/parental_control_service.h hle/service/pctl/pctl.cpp hle/service/pctl/pctl.h + hle/service/pctl/pctl_results.h + hle/service/pctl/pctl_types.h hle/service/pcv/pcv.cpp hle/service/pcv/pcv.h hle/service/pm/pm.cpp @@ -909,8 +961,18 @@ add_library(core STATIC hle/service/psc/ovln/ovln_types.h hle/service/psc/ovln/receiver_service.cpp hle/service/psc/ovln/receiver_service.h + hle/service/psc/ovln/receiver.cpp + hle/service/psc/ovln/receiver.h hle/service/psc/ovln/sender_service.cpp hle/service/psc/ovln/sender_service.h + hle/service/psc/ovln/sender.cpp + hle/service/psc/ovln/sender.h + hle/service/psc/pm_control.cpp + hle/service/psc/pm_control.h + hle/service/psc/pm_module.cpp + hle/service/psc/pm_module.h + hle/service/psc/pm_service.cpp + hle/service/psc/pm_service.h hle/service/psc/psc.cpp hle/service/psc/psc.h hle/service/psc/time/alarms.cpp @@ -961,6 +1023,10 @@ add_library(core STATIC hle/service/ptm/ts.h hle/service/ro/ro.cpp hle/service/ro/ro.h + hle/service/ro/ro_nro_utils.cpp + hle/service/ro/ro_nro_utils.h + hle/service/ro/ro_results.h + hle/service/ro/ro_types.h hle/service/server_manager.cpp hle/service/server_manager.h hle/service/service.cpp @@ -989,6 +1055,8 @@ add_library(core STATIC hle/service/set/system_settings_server.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/nsd.cpp @@ -1154,7 +1222,7 @@ target_link_libraries(core PRIVATE RenderDoc::API ZLIB::ZLIB) -target_link_libraries(core PUBLIC httplib::httplib zstd::zstd frozen::frozen-headers) +target_link_libraries(core PUBLIC httplib::httplib zstd::zstd) if (ENABLE_WEB_SERVICE) target_compile_definitions(core PUBLIC ENABLE_WEB_SERVICE) diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 9b29a7773c..d68b6bde0d 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -75,6 +75,41 @@ class IManagerForSystemService final : public ServiceFramework, "CheckAvailability"}, + {1, D<&IManagerForSystemService::GetAccountId>, "GetAccountId"}, + {2, nullptr, "EnsureIdTokenCacheAsync"}, + {3, D<&IManagerForSystemService::LoadIdTokenCacheDeprecated>, "LoadIdTokenCacheDeprecated"}, // 19.0.0+ + {4, D<&IManagerForSystemService::LoadIdTokenCache>, "LoadIdTokenCache"}, // 19.0.0+ + {100, nullptr, "SetSystemProgramIdentification"}, + {101, nullptr, "RefreshNotificationTokenAsync"}, // 7.0.0+ + {110, nullptr, "GetServiceEntryRequirementCache"}, // 4.0.0+ + {111, nullptr, "InvalidateServiceEntryRequirementCache"}, // 4.0.0+ + {112, nullptr, "InvalidateTokenCache"}, // 4.0.0 - 6.2.0 + {113, nullptr, "GetServiceEntryRequirementCacheForOnlinePlay"}, // 6.1.0+ + {120, nullptr, "GetNintendoAccountId"}, + {121, nullptr, "CalculateNintendoAccountAuthenticationFingerprint"}, // 9.0.0+ + {130, nullptr, "GetNintendoAccountUserResourceCache"}, + {131, nullptr, "RefreshNintendoAccountUserResourceCacheAsync"}, + {132, nullptr, "RefreshNintendoAccountUserResourceCacheAsyncIfSecondsElapsed"}, + {133, nullptr, "GetNintendoAccountVerificationUrlCache"}, // 9.0.0+ + {134, nullptr, "RefreshNintendoAccountVerificationUrlCache"}, // 9.0.0+ + {135, nullptr, "RefreshNintendoAccountVerificationUrlCacheAsyncIfSecondsElapsed"}, // 9.0.0+ + {136, nullptr, "GetNintendoAccountUserResourceCache"}, // 19.0.0+ + {140, nullptr, "GetNetworkServiceLicenseCache"}, // 5.0.0+ + {141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+ + {142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+ + {143, D<&IManagerForSystemService::GetNetworkServiceLicenseCacheEx>, "GetNetworkServiceLicenseCacheEx"}, // 15.0.0+ + {150, nullptr, "CreateAuthorizationRequest"}, + {160, nullptr, "RequiresUpdateNetworkServiceAccountIdTokenCache"}, + {161, nullptr, "RequireReauthenticationOfNetworkServiceAccount"}, + {170, nullptr, "CreateDeviceHistoryRequest"}, // 17.0.0+ + {180, nullptr, "GetRequestForNintendoAccountReauthentication"} // 18.0.0+ + }; + // clang-format on + + RegisterHandlers(functions); } private: @@ -108,40 +143,6 @@ private: R_SUCCEED(); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IManagerForSystemService::CheckAvailability>, "CheckAvailability"}, - FunctionInfo{1, D<&IManagerForSystemService::GetAccountId>, "GetAccountId"}, - FunctionInfo{2, nullptr, "EnsureIdTokenCacheAsync"}, - FunctionInfo{3, D<&IManagerForSystemService::LoadIdTokenCacheDeprecated>, "LoadIdTokenCacheDeprecated", MakeVersionGate({19,0,0})}, - FunctionInfo{4, D<&IManagerForSystemService::LoadIdTokenCache>, "LoadIdTokenCache", MakeVersionGate({19,0,0})}, - FunctionInfo{100, nullptr, "SetSystemProgramIdentification"}, - FunctionInfo{101, nullptr, "RefreshNotificationTokenAsync", MakeVersionGate({7,0,0})}, - FunctionInfo{110, nullptr, "GetServiceEntryRequirementCache", MakeVersionGate({4,0,0})}, - FunctionInfo{111, nullptr, "InvalidateServiceEntryRequirementCache", MakeVersionGate({4,0,0})}, - FunctionInfo{112, nullptr, "InvalidateTokenCache", MakeVersionGate({4,0,0}, {6,2,0})}, - FunctionInfo{113, nullptr, "GetServiceEntryRequirementCacheForOnlinePlay", MakeVersionGate({6,1,0})}, - FunctionInfo{120, nullptr, "GetNintendoAccountId"}, - FunctionInfo{121, nullptr, "CalculateNintendoAccountAuthenticationFingerprint", MakeVersionGate({9,0,0})}, - FunctionInfo{130, nullptr, "GetNintendoAccountUserResourceCache"}, - FunctionInfo{131, nullptr, "RefreshNintendoAccountUserResourceCacheAsync"}, - FunctionInfo{132, nullptr, "RefreshNintendoAccountUserResourceCacheAsyncIfSecondsElapsed"}, - FunctionInfo{133, nullptr, "GetNintendoAccountVerificationUrlCache", MakeVersionGate({9,0,0})}, - FunctionInfo{134, nullptr, "RefreshNintendoAccountVerificationUrlCache", MakeVersionGate({9,0,0})}, - FunctionInfo{135, nullptr, "RefreshNintendoAccountVerificationUrlCacheAsyncIfSecondsElapsed", MakeVersionGate({9,0,0})}, - FunctionInfo{136, nullptr, "GetNintendoAccountUserResourceCache", MakeVersionGate({19,0,0})}, - FunctionInfo{140, nullptr, "GetNetworkServiceLicenseCache", MakeVersionGate({5,0,0})}, - FunctionInfo{141, nullptr, "RefreshNetworkServiceLicenseCacheAsync", MakeVersionGate({5,0,0})}, - FunctionInfo{142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed", MakeVersionGate({5,0,0})}, - FunctionInfo{143, D<&IManagerForSystemService::GetNetworkServiceLicenseCacheEx>, "GetNetworkServiceLicenseCacheEx", MakeVersionGate({15,0,0})}, - FunctionInfo{150, nullptr, "CreateAuthorizationRequest"}, - FunctionInfo{160, nullptr, "RequiresUpdateNetworkServiceAccountIdTokenCache"}, - FunctionInfo{161, nullptr, "RequireReauthenticationOfNetworkServiceAccount"}, - FunctionInfo{170, nullptr, "CreateDeviceHistoryRequest", MakeVersionGate({17,0,0})}, - FunctionInfo{180, nullptr, "GetRequestForNintendoAccountReauthentication", MakeVersionGate({18,0,0})} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } Common::UUID account_id; }; @@ -150,25 +151,25 @@ class IFloatingRegistrationRequest final : public ServiceFramework FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; @@ -176,6 +177,62 @@ class IAdministrator final : public ServiceFramework { public: explicit IAdministrator(Core::System& system_, Common::UUID) : ServiceFramework{system_, "IAdministrator"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "CheckAvailability"}, + {1, nullptr, "GetAccountId"}, + {2, nullptr, "EnsureIdTokenCacheAsync"}, + {3, nullptr, "LoadIdTokenCache"}, + {100, nullptr, "SetSystemProgramIdentification"}, + {101, nullptr, "RefreshNotificationTokenAsync"}, // 7.0.0+ + {110, nullptr, "GetServiceEntryRequirementCache"}, // 4.0.0+ + {111, nullptr, "InvalidateServiceEntryRequirementCache"}, // 4.0.0+ + {112, nullptr, "InvalidateTokenCache"}, // 4.0.0 - 6.2.0 + {113, nullptr, "GetServiceEntryRequirementCacheForOnlinePlay"}, // 6.1.0+ + {120, nullptr, "GetNintendoAccountId"}, + {121, nullptr, "CalculateNintendoAccountAuthenticationFingerprint"}, // 9.0.0+ + {130, nullptr, "GetNintendoAccountUserResourceCache"}, + {131, nullptr, "RefreshNintendoAccountUserResourceCacheAsync"}, + {132, nullptr, "RefreshNintendoAccountUserResourceCacheAsyncIfSecondsElapsed"}, + {133, nullptr, "GetNintendoAccountVerificationUrlCache"}, // 9.0.0+ + {134, nullptr, "RefreshNintendoAccountVerificationUrlCacheAsync"}, // 9.0.0+ + {135, nullptr, "RefreshNintendoAccountVerificationUrlCacheAsyncIfSecondsElapsed"}, // 9.0.0+ + {140, nullptr, "GetNetworkServiceLicenseCache"}, // 5.0.0+ + {141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+ + {142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+ + {143, nullptr, "GetNetworkServiceLicenseCacheEx"}, + {150, nullptr, "CreateAuthorizationRequest"}, + {160, nullptr, "RequiresUpdateNetworkServiceAccountIdTokenCache"}, + {161, nullptr, "RequireReauthenticationOfNetworkServiceAccount"}, + {170, nullptr, "CreateDeviceHistoryRequest"}, // 17.0.0+ + {180, nullptr, "GetRequestForNintendoAccountReauthentication"}, // 18.0.0+ + {200, nullptr, "IsRegistered"}, + {201, nullptr, "RegisterAsync"}, + {202, nullptr, "UnregisterAsync"}, + {203, nullptr, "DeleteRegistrationInfoLocally"}, + {220, nullptr, "SynchronizeProfileAsync"}, + {221, nullptr, "UploadProfileAsync"}, + {222, nullptr, "SynchronizaProfileAsyncIfSecondsElapsed"}, + {250, &IAdministrator::IsLinkedWithNintendoAccount, "IsLinkedWithNintendoAccount"}, + {251, nullptr, "CreateProcedureToLinkWithNintendoAccount"}, + {252, nullptr, "ResumeProcedureToLinkWithNintendoAccount"}, + {255, nullptr, "CreateProcedureToUpdateLinkageStateOfNintendoAccount"}, + {256, nullptr, "ResumeProcedureToUpdateLinkageStateOfNintendoAccount"}, + {260, nullptr, "CreateProcedureToLinkNnidWithNintendoAccount"}, // 3.0.0+ + {261, nullptr, "ResumeProcedureToLinkNnidWithNintendoAccount"}, // 3.0.0+ + {280, nullptr, "ProxyProcedureToAcquireApplicationAuthorizationForNintendoAccount"}, + {290, nullptr, "GetRequestForNintendoAccountUserResourceView"}, // 8.0.0+ + {300, nullptr, "TryRecoverNintendoAccountUserStateAsync"}, // 6.0.0+ + {400, nullptr, "IsServiceEntryRequirementCacheRefreshRequiredForOnlinePlay"}, // 6.1.0+ + {401, nullptr, "RefreshServiceEntryRequirementCacheForOnlinePlayAsync"}, // 6.1.0+ + {900, nullptr, "GetAuthenticationInfoForWin"}, // 9.0.0+ + {901, nullptr, "ImportAsyncForWin"}, // 9.0.0+ + {997, nullptr, "DebugUnlinkNintendoAccountAsync"}, + {998, nullptr, "DebugSetAvailabilityErrorDetail"}, + }; + // clang-format on + + RegisterHandlers(functions); } private: @@ -184,97 +241,42 @@ private: rb.Push(ResultSuccess); rb.Push(false); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "CheckAvailability"}, - FunctionInfo{1, nullptr, "GetAccountId"}, - FunctionInfo{2, nullptr, "EnsureIdTokenCacheAsync"}, - FunctionInfo{3, nullptr, "LoadIdTokenCache"}, - FunctionInfo{100, nullptr, "SetSystemProgramIdentification"}, - FunctionInfo{101, nullptr, "RefreshNotificationTokenAsync", MakeVersionGate({7,0,0})}, - FunctionInfo{110, nullptr, "GetServiceEntryRequirementCache", MakeVersionGate({4,0,0})}, - FunctionInfo{111, nullptr, "InvalidateServiceEntryRequirementCache", MakeVersionGate({4,0,0})}, - FunctionInfo{112, nullptr, "InvalidateTokenCache", MakeVersionGate({4,0,0}, {6,2,0})}, - FunctionInfo{113, nullptr, "GetServiceEntryRequirementCacheForOnlinePlay", MakeVersionGate({6,1,0})}, - FunctionInfo{120, nullptr, "GetNintendoAccountId"}, - FunctionInfo{121, nullptr, "CalculateNintendoAccountAuthenticationFingerprint", MakeVersionGate({9,0,0})}, - FunctionInfo{130, nullptr, "GetNintendoAccountUserResourceCache"}, - FunctionInfo{131, nullptr, "RefreshNintendoAccountUserResourceCacheAsync"}, - FunctionInfo{132, nullptr, "RefreshNintendoAccountUserResourceCacheAsyncIfSecondsElapsed"}, - FunctionInfo{133, nullptr, "GetNintendoAccountVerificationUrlCache", MakeVersionGate({9,0,0})}, - FunctionInfo{134, nullptr, "RefreshNintendoAccountVerificationUrlCacheAsync", MakeVersionGate({9,0,0})}, - FunctionInfo{135, nullptr, "RefreshNintendoAccountVerificationUrlCacheAsyncIfSecondsElapsed", MakeVersionGate({9,0,0})}, - FunctionInfo{140, nullptr, "GetNetworkServiceLicenseCache", MakeVersionGate({5,0,0})}, - FunctionInfo{141, nullptr, "RefreshNetworkServiceLicenseCacheAsync", MakeVersionGate({5,0,0})}, - FunctionInfo{142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed", MakeVersionGate({5,0,0})}, - FunctionInfo{143, nullptr, "GetNetworkServiceLicenseCacheEx"}, - FunctionInfo{150, nullptr, "CreateAuthorizationRequest"}, - FunctionInfo{160, nullptr, "RequiresUpdateNetworkServiceAccountIdTokenCache"}, - FunctionInfo{161, nullptr, "RequireReauthenticationOfNetworkServiceAccount"}, - FunctionInfo{170, nullptr, "CreateDeviceHistoryRequest", MakeVersionGate({17,0,0})}, - FunctionInfo{180, nullptr, "GetRequestForNintendoAccountReauthentication", MakeVersionGate({18,0,0})}, - FunctionInfo{200, nullptr, "IsRegistered"}, - FunctionInfo{201, nullptr, "RegisterAsync"}, - FunctionInfo{202, nullptr, "UnregisterAsync"}, - FunctionInfo{203, nullptr, "DeleteRegistrationInfoLocally"}, - FunctionInfo{220, nullptr, "SynchronizeProfileAsync"}, - FunctionInfo{221, nullptr, "UploadProfileAsync"}, - FunctionInfo{222, nullptr, "SynchronizaProfileAsyncIfSecondsElapsed"}, - FunctionInfo{250, &IAdministrator::IsLinkedWithNintendoAccount, "IsLinkedWithNintendoAccount"}, - FunctionInfo{251, nullptr, "CreateProcedureToLinkWithNintendoAccount"}, - FunctionInfo{252, nullptr, "ResumeProcedureToLinkWithNintendoAccount"}, - FunctionInfo{255, nullptr, "CreateProcedureToUpdateLinkageStateOfNintendoAccount"}, - FunctionInfo{256, nullptr, "ResumeProcedureToUpdateLinkageStateOfNintendoAccount"}, - FunctionInfo{260, nullptr, "CreateProcedureToLinkNnidWithNintendoAccount", MakeVersionGate({3,0,0})}, - FunctionInfo{261, nullptr, "ResumeProcedureToLinkNnidWithNintendoAccount", MakeVersionGate({3,0,0})}, - FunctionInfo{280, nullptr, "ProxyProcedureToAcquireApplicationAuthorizationForNintendoAccount"}, - FunctionInfo{290, nullptr, "GetRequestForNintendoAccountUserResourceView", MakeVersionGate({8,0,0})}, - FunctionInfo{300, nullptr, "TryRecoverNintendoAccountUserStateAsync", MakeVersionGate({6,0,0})}, - FunctionInfo{400, nullptr, "IsServiceEntryRequirementCacheRefreshRequiredForOnlinePlay", MakeVersionGate({6,1,0})}, - FunctionInfo{401, nullptr, "RefreshServiceEntryRequirementCacheForOnlinePlayAsync", MakeVersionGate({6,1,0})}, - FunctionInfo{900, nullptr, "GetAuthenticationInfoForWin", MakeVersionGate({9,0,0})}, - FunctionInfo{901, nullptr, "ImportAsyncForWin", MakeVersionGate({9,0,0})}, - FunctionInfo{997, nullptr, "DebugUnlinkNintendoAccountAsync"}, - FunctionInfo{998, nullptr, "DebugSetAvailabilityErrorDetail"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } }; class IAuthorizationRequest final : public ServiceFramework { public: explicit IAuthorizationRequest(Core::System& system_, Common::UUID) : ServiceFramework{system_, "IAuthorizationRequest"} { - } + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetSessionId"}, + {10, nullptr, "InvokeWithoutInteractionAsync"}, + {19, nullptr, "IsAuthorized"}, + {20, nullptr, "GetAuthorizationCode"}, + {21, nullptr, "GetIdToken"}, + {22, nullptr, "GetState"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetSessionId"}, - FunctionInfo{10, nullptr, "InvokeWithoutInteractionAsync"}, - FunctionInfo{19, nullptr, "IsAuthorized"}, - FunctionInfo{20, nullptr, "GetAuthorizationCode"}, - FunctionInfo{21, nullptr, "GetIdToken"}, - FunctionInfo{22, nullptr, "GetState"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; class IOAuthProcedure final : public ServiceFramework { public: explicit IOAuthProcedure(Core::System& system_, Common::UUID) - : ServiceFramework{system_, "IOAuthProcedure"} {} + : ServiceFramework{system_, "IOAuthProcedure"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "PrepareAsync"}, + {1, nullptr, "GetRequest"}, + {2, nullptr, "ApplyResponse"}, + {3, nullptr, "ApplyResponseAsync"}, + {10, nullptr, "Suspend"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "PrepareAsync"}, - FunctionInfo{1, nullptr, "GetRequest"}, - FunctionInfo{2, nullptr, "ApplyResponse"}, - FunctionInfo{3, nullptr, "ApplyResponseAsync"}, - FunctionInfo{10, nullptr, "Suspend"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; @@ -282,69 +284,96 @@ public: class IOAuthProcedureForExternalNsa final : public ServiceFramework { public: explicit IOAuthProcedureForExternalNsa(Core::System& system_, Common::UUID) - : ServiceFramework{system_, "IOAuthProcedureForExternalNsa"} - {} + : ServiceFramework{system_, "IOAuthProcedureForExternalNsa"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "PrepareAsync"}, + {1, nullptr, "GetRequest"}, + {2, nullptr, "ApplyResponse"}, + {3, nullptr, "ApplyResponseAsync"}, + {10, nullptr, "Suspend"}, + {100, nullptr, "GetAccountId"}, + {101, nullptr, "GetLinkedNintendoAccountId"}, + {102, nullptr, "GetNickname"}, + {103, nullptr, "GetProfileImage"}, + {104, nullptr, "GetProfileLargeImage"} // 18.0.0+ + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "PrepareAsync"}, - FunctionInfo{1, nullptr, "GetRequest"}, - FunctionInfo{2, nullptr, "ApplyResponse"}, - FunctionInfo{3, nullptr, "ApplyResponseAsync"}, - FunctionInfo{10, nullptr, "Suspend"}, - FunctionInfo{100, nullptr, "GetAccountId"}, - FunctionInfo{101, nullptr, "GetLinkedNintendoAccountId"}, - FunctionInfo{102, nullptr, "GetNickname"}, - FunctionInfo{103, nullptr, "GetProfileImage"}, - FunctionInfo{104, nullptr, "GetProfileLargeImage", MakeVersionGate({18,0,0})} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; -class IOAuthProcedureForNintendoAccountLinkage final : public ServiceFramework { +class IOAuthProcedureForNintendoAccountLinkage final + : public ServiceFramework { public: explicit IOAuthProcedureForNintendoAccountLinkage(Core::System& system_, Common::UUID) - : ServiceFramework{system_, "IOAuthProcedureForNintendoAccountLinkage"} - {} + : ServiceFramework{system_, "IOAuthProcedureForNintendoAccountLinkage"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "PrepareAsync"}, + {1, nullptr, "GetRequest"}, + {2, nullptr, "ApplyResponse"}, + {3, nullptr, "ApplyResponseAsync"}, + {10, nullptr, "Suspend"}, + {100, nullptr, "GetRequestWithTheme"}, + {101, nullptr, "IsNetworkServiceAccountReplaced"}, + {199, nullptr, "GetUrlForIntroductionOfExtraMembership"}, // 2.0.0 - 5.1.0 + {200, nullptr, "ApplyAsyncWithAuthorizedToken"}, + {210, nullptr, "IsProfileAvailable"}, // 17.0.0+ + {220, nullptr, "RegisterUserAsyncWithoutProfile"}, // 17.0.0+ + {221, nullptr, "RegisterUserWithProfileAsync"}, // 17.0.0+ + {230, nullptr, "RegisterUserWithLargeImageProfileAsync"}, // 18.0.0+ + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "PrepareAsync"}, - FunctionInfo{1, nullptr, "GetRequest"}, - FunctionInfo{2, nullptr, "ApplyResponse"}, - FunctionInfo{3, nullptr, "ApplyResponseAsync"}, - FunctionInfo{10, nullptr, "Suspend"}, - FunctionInfo{100, nullptr, "GetRequestWithTheme"}, - FunctionInfo{101, nullptr, "IsNetworkServiceAccountReplaced"}, - FunctionInfo{199, nullptr, "GetUrlForIntroductionOfExtraMembership", MakeVersionGate({2,0,0}, {5,1,0})}, - FunctionInfo{200, nullptr, "ApplyAsyncWithAuthorizedToken"}, - FunctionInfo{210, nullptr, "IsProfileAvailable", MakeVersionGate({17,0,0})}, - FunctionInfo{220, nullptr, "RegisterUserAsyncWithoutProfile", MakeVersionGate({17,0,0})}, - FunctionInfo{221, nullptr, "RegisterUserWithProfileAsync", MakeVersionGate({17,0,0})}, - FunctionInfo{230, nullptr, "RegisterUserWithLargeImageProfileAsync", MakeVersionGate({18,0,0})} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; class INotifier final : public ServiceFramework { public: explicit INotifier(Core::System& system_, Common::UUID) - : ServiceFramework{system_, "INotifier"} {} + : ServiceFramework{system_, "INotifier"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetSystemEvent"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetSystemEvent"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; class IProfileCommon : public ServiceFramework { public: - explicit IProfileCommon(Core::System& system_, const char* name, bool editor_commands, Common::UUID user_id_, ProfileManager& profile_manager_) + explicit IProfileCommon(Core::System& system_, const char* name, bool editor_commands, + Common::UUID user_id_, ProfileManager& profile_manager_) : ServiceFramework{system_, name}, profile_manager{profile_manager_}, user_id{user_id_} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &IProfileCommon::Get, "Get"}, + {1, &IProfileCommon::GetBase, "GetBase"}, + {10, &IProfileCommon::GetImageSize, "GetImageSize"}, + {11, &IProfileCommon::LoadImage, "LoadImage"}, + {20, &IProfileCommon::Unknown20, "Unknown20"}, + {21, &IProfileCommon::Unknown21, "Unknown21"}, + {30, &IProfileCommon::Unknown30, "Unknown30"} + }; + // clang-format on + RegisterHandlers(functions); + + if (editor_commands) { + // clang-format off + static const FunctionInfo editor_functions[] = { + {100, &IProfileCommon::Store, "Store"}, + {101, &IProfileCommon::StoreWithImage, "StoreWithImage"}, + {110, &IProfileCommon::Unknown110, "Unknown110"} + }; + // clang-format on + + RegisterHandlers(editor_functions); + } } protected: @@ -571,22 +600,6 @@ protected: rb.Push(ResultSuccess); } - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &IProfileCommon::Get, "Get"}, - FunctionInfo{1, &IProfileCommon::GetBase, "GetBase"}, - FunctionInfo{10, &IProfileCommon::GetImageSize, "GetImageSize"}, - FunctionInfo{11, &IProfileCommon::LoadImage, "LoadImage"}, - FunctionInfo{20, &IProfileCommon::Unknown20, "Unknown20"}, - FunctionInfo{21, &IProfileCommon::Unknown21, "Unknown21"}, - FunctionInfo{30, &IProfileCommon::Unknown30, "Unknown30"}, - // Editor commands - FunctionInfo{100, &IProfileCommon::Store, "Store"}, - FunctionInfo{101, &IProfileCommon::StoreWithImage, "StoreWithImage"}, - FunctionInfo{110, &IProfileCommon::Unknown110, "Unknown110"} - ); ProfileManager& profile_manager; Common::UUID user_id{}; ///< The user id this profile refers to. }; @@ -608,33 +621,35 @@ public: class ISessionObject final : public ServiceFramework { public: explicit ISessionObject(Core::System& system_, Common::UUID) - : ServiceFramework{system_, "ISessionObject"} {} + : ServiceFramework{system_, "ISessionObject"} { + // clang-format off + static const FunctionInfo functions[] = { + {999, nullptr, "Dummy"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{999, nullptr, "Dummy"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; class IGuestLoginRequest final : public ServiceFramework { public: explicit IGuestLoginRequest(Core::System& system_, Common::UUID) - : ServiceFramework{system_, "IGuestLoginRequest"} {} + : ServiceFramework{system_, "IGuestLoginRequest"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetSessionId"}, + {11, nullptr, "Unknown"}, // 1.0.0 - 2.3.0 (the name is blank on Switchbrew) + {12, nullptr, "GetAccountId"}, + {13, nullptr, "GetLinkedNintendoAccountId"}, + {14, nullptr, "GetNickname"}, + {15, nullptr, "GetProfileImage"}, + {16, nullptr, "GetProfileLargeImage"}, // 18.0.0+ + {21, nullptr, "LoadIdTokenCache"}, // 3.0.0+ + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetSessionId"}, - FunctionInfo{11, nullptr, "Unknown", MakeVersionGate({1,0,0}, {2,3,0})}, // the name is blank on Switchbrew - FunctionInfo{12, nullptr, "GetAccountId"}, - FunctionInfo{13, nullptr, "GetLinkedNintendoAccountId"}, - FunctionInfo{14, nullptr, "GetNickname"}, - FunctionInfo{15, nullptr, "GetProfileImage"}, - FunctionInfo{16, nullptr, "GetProfileLargeImage", MakeVersionGate({18,0,0})}, - FunctionInfo{21, nullptr, "LoadIdTokenCache", MakeVersionGate({3,0,0})} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; @@ -671,10 +686,23 @@ public: const std::shared_ptr& profile_manager_) : ServiceFramework{system_, "IManagerForApplication"}, ensure_token_id{std::make_shared(system)}, - profile_manager{profile_manager_} {} + profile_manager{profile_manager_} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &IManagerForApplication::CheckAvailability, "CheckAvailability"}, + {1, &IManagerForApplication::GetAccountId, "GetAccountId"}, + {2, &IManagerForApplication::EnsureIdTokenCacheAsync, "EnsureIdTokenCacheAsync"}, + {3, &IManagerForApplication::LoadIdTokenCacheDeprecated, "LoadIdTokenCacheDeprecated"}, + {4, &IManagerForApplication::LoadIdTokenCache, "LoadIdTokenCache"}, + {130, &IManagerForApplication::GetNintendoAccountUserResourceCacheForApplication, "GetNintendoAccountUserResourceCacheForApplication"}, + {136, &IManagerForApplication::GetNintendoAccountUserResourceCacheForApplication, "GetNintendoAccountUserResourceCache"}, // 19.0.0+ + {150, nullptr, "CreateAuthorizationRequest"}, + {160, &IManagerForApplication::StoreOpenContext, "StoreOpenContext"}, + {170, nullptr, "LoadNetworkServiceLicenseKindAsync"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -744,18 +772,6 @@ private: rb.Push(ResultSuccess); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &IManagerForApplication::CheckAvailability, "CheckAvailability"}, - FunctionInfo{1, &IManagerForApplication::GetAccountId, "GetAccountId"}, - FunctionInfo{2, &IManagerForApplication::EnsureIdTokenCacheAsync, "EnsureIdTokenCacheAsync"}, - FunctionInfo{3, &IManagerForApplication::LoadIdTokenCacheDeprecated, "LoadIdTokenCacheDeprecated"}, - FunctionInfo{4, &IManagerForApplication::LoadIdTokenCache, "LoadIdTokenCache"}, - FunctionInfo{130, &IManagerForApplication::GetNintendoAccountUserResourceCacheForApplication, "GetNintendoAccountUserResourceCacheForApplication"}, - FunctionInfo{136, &IManagerForApplication::GetNintendoAccountUserResourceCacheForApplication, "GetNintendoAccountUserResourceCache", MakeVersionGate({19,0,0})}, - FunctionInfo{150, nullptr, "CreateAuthorizationRequest"}, - FunctionInfo{160, &IManagerForApplication::StoreOpenContext, "StoreOpenContext"}, - FunctionInfo{170, nullptr, "LoadNetworkServiceLicenseKindAsync"} - ); std::shared_ptr ensure_token_id{}; std::shared_ptr profile_manager; }; @@ -765,17 +781,18 @@ class IAsyncNetworkServiceLicenseKindContext final : public ServiceFramework { public: explicit IAsyncNetworkServiceLicenseKindContext(Core::System& system_, Common::UUID) - : ServiceFramework{system_, "IAsyncNetworkServiceLicenseKindContext"} {} + : ServiceFramework{system_, "IAsyncNetworkServiceLicenseKindContext"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetSystemEvent"}, + {1, nullptr, "Cancel"}, + {2, nullptr, "HasDone"}, + {3, nullptr, "GetResult"}, + {4, nullptr, "GetNetworkServiceLicenseKind"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetSystemEvent"}, - FunctionInfo{1, nullptr, "Cancel"}, - FunctionInfo{2, nullptr, "HasDone"}, - FunctionInfo{3, nullptr, "GetResult"}, - FunctionInfo{4, nullptr, "GetNetworkServiceLicenseKind"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; @@ -784,54 +801,56 @@ class IOAuthProcedureForUserRegistration final : public ServiceFramework { public: explicit IOAuthProcedureForUserRegistration(Core::System& system_, Common::UUID) - : ServiceFramework{system_, "IOAuthProcedureForUserRegistration"} {} + : ServiceFramework{system_, "IOAuthProcedureForUserRegistration"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "PrepareAsync"}, + {1, nullptr, "GetRequest"}, + {2, nullptr, "ApplyResponse"}, + {3, nullptr, "ApplyResponseAsync"}, + {10, nullptr, "Suspend"}, + {100, nullptr, "GetAccountId"}, + {101, nullptr, "GetLinkedNintendoAccountId"}, + {102, nullptr, "GetNickname"}, + {103, nullptr, "GetProfileImage"}, + {104, nullptr, "GetProfileLargeImage"}, // 18.0.0+ + {110, nullptr, "RegisterUserAsync"}, + {111, nullptr, "GetUid"}, + {200, nullptr, "ApplyResponseForUserCreationAsync"}, // 17.0.0+ + {205, nullptr, "SuspendAfterApplyResponse"}, // 17.0.0+ + {210, nullptr, "IsProfileAvailable"}, // 17.0.0+ + {220, nullptr, "RegisterUserAsyncWithoutProfile"}, // 17.0.0+ + {221, nullptr, "RegisterUserWithProfileAsync"}, // 17.0.0+ + {230, nullptr, "RegisterUserWithLargeImageProfileAsync"} // 18.0.0+ + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "PrepareAsync"}, - FunctionInfo{1, nullptr, "GetRequest"}, - FunctionInfo{2, nullptr, "ApplyResponse"}, - FunctionInfo{3, nullptr, "ApplyResponseAsync"}, - FunctionInfo{10, nullptr, "Suspend"}, - FunctionInfo{100, nullptr, "GetAccountId"}, - FunctionInfo{101, nullptr, "GetLinkedNintendoAccountId"}, - FunctionInfo{102, nullptr, "GetNickname"}, - FunctionInfo{103, nullptr, "GetProfileImage"}, - FunctionInfo{104, nullptr, "GetProfileLargeImage", MakeVersionGate({18,0,0})}, - FunctionInfo{110, nullptr, "RegisterUserAsync"}, - FunctionInfo{111, nullptr, "GetUid"}, - FunctionInfo{200, nullptr, "ApplyResponseForUserCreationAsync", MakeVersionGate({17,0,0})}, - FunctionInfo{205, nullptr, "SuspendAfterApplyResponse", MakeVersionGate({17,0,0})}, - FunctionInfo{210, nullptr, "IsProfileAvailable", MakeVersionGate({17,0,0})}, - FunctionInfo{220, nullptr, "RegisterUserAsyncWithoutProfile", MakeVersionGate({17,0,0})}, - FunctionInfo{221, nullptr, "RegisterUserWithProfileAsync", MakeVersionGate({17,0,0})}, - FunctionInfo{230, nullptr, "RegisterUserWithLargeImageProfileAsync", MakeVersionGate({18,0,0})} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; class DAUTH_O final : public ServiceFramework { public: - explicit DAUTH_O(Core::System& system_, Common::UUID) : ServiceFramework{system_, "dauth:o"} {} + explicit DAUTH_O(Core::System& system_, Common::UUID) : ServiceFramework{system_, "dauth:o"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "EnsureAuthenticationTokenCacheAsync"}, + {1, nullptr, "LoadAuthenticationTokenCache"}, + {2, nullptr, "InvalidateAuthenticationTokenCache"}, + {3, nullptr, "IsDeviceAuthenticationTokenCacheAvailable"}, + {10, nullptr, "EnsureEdgeTokenCacheAsync"}, + {11, nullptr, "LoadEdgeTokenCache"}, + {12, nullptr, "InvalidateEdgeTokenCache"}, + {13, nullptr, "IsEdgeTokenCacheAvailable"}, + {20, nullptr, "EnsureApplicationAuthenticationCacheAsync"}, + {21, nullptr, "LoadApplicationAuthenticationTokenCache"}, + {22, nullptr, "LoadApplicationNetworkServiceClientConfigCache"}, + {23, nullptr, "IsApplicationAuthenticationCacheAvailable"}, + {24, nullptr, "InvalidateApplicationAuthenticationCache"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "EnsureAuthenticationTokenCacheAsync"}, - FunctionInfo{1, nullptr, "LoadAuthenticationTokenCache"}, - FunctionInfo{2, nullptr, "InvalidateAuthenticationTokenCache"}, - FunctionInfo{3, nullptr, "IsDeviceAuthenticationTokenCacheAvailable"}, - FunctionInfo{10, nullptr, "EnsureEdgeTokenCacheAsync"}, - FunctionInfo{11, nullptr, "LoadEdgeTokenCache"}, - FunctionInfo{12, nullptr, "InvalidateEdgeTokenCache"}, - FunctionInfo{13, nullptr, "IsEdgeTokenCacheAvailable"}, - FunctionInfo{20, nullptr, "EnsureApplicationAuthenticationCacheAsync"}, - FunctionInfo{21, nullptr, "LoadApplicationAuthenticationTokenCache"}, - FunctionInfo{22, nullptr, "LoadApplicationNetworkServiceClientConfigCache"}, - FunctionInfo{23, nullptr, "IsApplicationAuthenticationCacheAvailable"}, - FunctionInfo{24, nullptr, "InvalidateApplicationAuthenticationCache"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; @@ -839,809 +858,781 @@ public: class IAsyncResult final : public ServiceFramework { public: explicit IAsyncResult(Core::System& system_, Common::UUID) - : ServiceFramework{system_, "IAsyncResult"} {} + : ServiceFramework{system_, "IAsyncResult"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetResult"}, + {1, nullptr, "Cancel"}, + {2, nullptr, "IsAvailable"}, + {3, nullptr, "GetSystemEvent"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetResult"}, - FunctionInfo{1, nullptr, "Cancel"}, - FunctionInfo{2, nullptr, "IsAvailable"}, - FunctionInfo{3, nullptr, "GetSystemEvent"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; -class Module final { -public: - class Interface : public ServiceFramework { - public: - explicit Interface(std::shared_ptr module_, std::shared_ptr profile_manager_, Core::System& system_, const char* name) - : ServiceFramework{system_, name} - , module{std::move(module_)} - , profile_manager{std::move(profile_manager_)} - {} - ~Interface() override = default; +void Module::Interface::GetUserCount(HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(static_cast(profile_manager->GetUserCount())); +} - void GetUserCount(HLERequestContext& ctx) { - LOG_DEBUG(Service_ACC, "called"); - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(ResultSuccess); - rb.Push(static_cast(profile_manager->GetUserCount())); +void Module::Interface::GetUserExistence(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + Common::UUID user_id = rp.PopRaw(); + LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString()); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(profile_manager->UserExists(user_id)); +} + +void Module::Interface::ListAllUsers(HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); + ctx.WriteBuffer(profile_manager->GetAllUsers()); + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + +void Module::Interface::ListOpenUsers(HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); + ctx.WriteBuffer(profile_manager->GetOpenUsers()); + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + +void Module::Interface::GetLastOpenedUser(HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); + IPC::ResponseBuilder rb{ctx, 6}; + rb.Push(ResultSuccess); + rb.PushRaw(profile_manager->GetLastOpenedUser()); +} + +void Module::Interface::GetProfile(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + Common::UUID user_id = rp.PopRaw(); + LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString()); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(ctx, system, user_id, *profile_manager); +} + +void Module::Interface::IsUserRegistrationRequestPermitted(HLERequestContext& ctx) { + LOG_WARNING(Service_ACC, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(profile_manager->CanSystemRegisterUser()); +} + +void Module::Interface::InitializeApplicationInfo(HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(InitializeApplicationInfoBase()); +} + +void Module::Interface::InitializeApplicationInfoRestricted(HLERequestContext& ctx) { + LOG_WARNING(Service_ACC, "(Partial implementation) called"); + + // TODO(ogniK): We require checking if the user actually owns the title and what not. As of + // currently, we assume the user owns the title. InitializeApplicationInfoBase SHOULD be called + // first then we do extra checks if the game is a digital copy. + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(InitializeApplicationInfoBase()); +} + +Result Module::Interface::InitializeApplicationInfoBase() { + if (application_info) { + LOG_ERROR(Service_ACC, "Application already initialized"); + return Account::ResultApplicationInfoAlreadyInitialized; + } + + // TODO(ogniK): This should be changed to reflect the target process for when we have multiple + // processes emulated. As we don't actually have pid support we should assume we're just using + // our own process + Glue::ApplicationLaunchProperty launch_property{}; + const auto result = system.GetARPManager().GetLaunchProperty( + &launch_property, system.GetApplicationProcessProgramID()); + + if (result != ResultSuccess) { + LOG_ERROR(Service_ACC, "Failed to get launch property"); + return Account::ResultInvalidApplication; + } + + switch (launch_property.base_game_storage_id) { + case FileSys::StorageId::GameCard: + application_info.application_type = ApplicationType::GameCard; + break; + case FileSys::StorageId::Host: + case FileSys::StorageId::NandSystem: + case FileSys::StorageId::NandUser: + case FileSys::StorageId::SdCard: + case FileSys::StorageId::None: // Yuzu specific, differs from hardware + application_info.application_type = ApplicationType::Digital; + break; + default: + LOG_ERROR(Service_ACC, "Invalid game storage ID! storage_id={}", + launch_property.base_game_storage_id); + return Account::ResultInvalidApplication; + } + + LOG_WARNING(Service_ACC, "ApplicationInfo init required"); + // TODO(ogniK): Actual initialization here + + return ResultSuccess; +} + +void Module::Interface::GetBaasAccountManagerForApplication(HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(ctx, system, profile_manager); +} + +void Module::Interface::IsUserAccountSwitchLocked(HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); + FileSys::NACP nacp; + const auto res = system.GetAppLoader().ReadControlData(nacp); + + bool is_locked = false; + + if (res != Loader::ResultStatus::Success) { + const FileSys::PatchManager pm{system.GetApplicationProcessProgramID(), + system.GetFileSystemController(), + system.GetContentProvider()}; + const auto nacp_unique = pm.GetControlMetadata().first; + + if (nacp_unique != nullptr) { + is_locked = nacp_unique->GetUserAccountSwitchLock(); + } else { + LOG_ERROR(Service_ACC, "nacp_unique is null!"); } + } else { + is_locked = nacp.GetUserAccountSwitchLock(); + } - void GetUserExistence(HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - Common::UUID user_id = rp.PopRaw(); - LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString()); - - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(ResultSuccess); - rb.Push(profile_manager->UserExists(user_id)); - } - - void ListAllUsers(HLERequestContext& ctx) { - LOG_DEBUG(Service_ACC, "called"); - ctx.WriteBuffer(profile_manager->GetAllUsers()); - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); - } - - void ListOpenUsers(HLERequestContext& ctx) { - LOG_DEBUG(Service_ACC, "called"); - ctx.WriteBuffer(profile_manager->GetOpenUsers()); - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); - } - - void GetLastOpenedUser(HLERequestContext& ctx) { - LOG_DEBUG(Service_ACC, "called"); - IPC::ResponseBuilder rb{ctx, 6}; - rb.Push(ResultSuccess); - rb.PushRaw(profile_manager->GetLastOpenedUser()); - } - - void GetProfile(HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - Common::UUID user_id = rp.PopRaw(); - LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString()); - - IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(ResultSuccess); - rb.PushIpcInterface(ctx, system, user_id, *profile_manager); - } - - void IsUserRegistrationRequestPermitted(HLERequestContext& ctx) { - LOG_WARNING(Service_ACC, "(STUBBED) called"); - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(ResultSuccess); - rb.Push(profile_manager->CanSystemRegisterUser()); - } - - void InitializeApplicationInfo(HLERequestContext& ctx) { - LOG_DEBUG(Service_ACC, "called"); - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(InitializeApplicationInfoBase()); - } - - void InitializeApplicationInfoRestricted(HLERequestContext& ctx) { - LOG_WARNING(Service_ACC, "(Partial implementation) called"); - - // TODO(ogniK): We require checking if the user actually owns the title and what not. As of - // currently, we assume the user owns the title. InitializeApplicationInfoBase SHOULD be called - // first then we do extra checks if the game is a digital copy. - - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(InitializeApplicationInfoBase()); - } - - void GetBaasAccountManagerForApplication(HLERequestContext& ctx) { - LOG_DEBUG(Service_ACC, "called"); - IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(ResultSuccess); - rb.PushIpcInterface(ctx, system, profile_manager); - } - - void IsUserAccountSwitchLocked(HLERequestContext& ctx) { - LOG_DEBUG(Service_ACC, "called"); - FileSys::NACP nacp; - const auto res = system.GetAppLoader().ReadControlData(nacp); - - bool is_locked = false; - - if (res != Loader::ResultStatus::Success) { - const FileSys::PatchManager pm{system.GetApplicationProcessProgramID(), - system.GetFileSystemController(), - system.GetContentProvider()}; - const auto nacp_unique = pm.GetControlMetadata().first; - - if (nacp_unique != nullptr) { - is_locked = nacp_unique->GetUserAccountSwitchLock(); - } else { - LOG_ERROR(Service_ACC, "nacp_unique is null!"); - } - } else { - is_locked = nacp.GetUserAccountSwitchLock(); - } - - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(ResultSuccess); - rb.Push(is_locked); - } - - void InitializeApplicationInfoV2(HLERequestContext& ctx) { - LOG_WARNING(Service_ACC, "(STUBBED) called"); - - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); - } - - void BeginUserRegistration(HLERequestContext& ctx) { - const auto user_id = Common::UUID::MakeRandom(); - profile_manager->CreateNewUser(user_id, "Eden"); - - LOG_INFO(Service_ACC, "called, uuid={}", user_id.FormattedString()); - - IPC::ResponseBuilder rb{ctx, 6}; - rb.Push(ResultSuccess); - rb.PushRaw(user_id); - } - - void CompleteUserRegistration(HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - Common::UUID user_id = rp.PopRaw(); - - LOG_INFO(Service_ACC, "called, uuid={}", user_id.FormattedString()); - - profile_manager->WriteUserSaveFile(); - - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); - } - - void DeleteUser(HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - Common::UUID user_id = rp.PopRaw(); - LOG_INFO(Service_ACC, "called, uuid={}", user_id.FormattedString()); - if (!profile_manager->RemoveUser(user_id)) { - LOG_ERROR(Service_ACC, "Failed to delete user with uuid={}", user_id.RawString()); - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(1U); - return; - } - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); - } - - void SetUserPosition(HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - - u64 position = rp.Pop(); - Common::UUID user_id = rp.PopRaw(); - - LOG_DEBUG(Service_ACC, "called, position={} user_id={}", position, user_id.FormattedString()); - - profile_manager->SetUserPosition(position, user_id); - - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); - } - - void GetProfileEditor(HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - Common::UUID user_id = rp.PopRaw(); - - LOG_DEBUG(Service_ACC, "called, user_id=0x{}", user_id.RawString()); - - IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(ResultSuccess); - rb.PushIpcInterface(ctx, system, user_id, *profile_manager); - } - - void GetBaasAccountAdministrator(HLERequestContext &ctx) { - IPC::RequestParser rp{ctx}; - const auto uuid = rp.PopRaw(); - - LOG_INFO(Service_ACC, "called, uuid=0x{}", uuid.RawString()); - - IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(ResultSuccess); - rb.PushIpcInterface(ctx, system, uuid); - } - - void ListQualifiedUsers(HLERequestContext& ctx) { - LOG_DEBUG(Service_ACC, "called"); - - // All users should be qualified. We don't actually have parental control or anything to do with - // nintendo online currently. We're just going to assume the user running the game has access to - // the game regardless of parental control settings. - ctx.WriteBuffer(profile_manager->GetAllUsers()); - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); - } - - void ListOpenContextStoredUsers(HLERequestContext& ctx) { - LOG_DEBUG(Service_ACC, "called"); - - ctx.WriteBuffer(profile_manager->GetStoredOpenedUsers()); - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); - } - - void StoreSaveDataThumbnailApplication(HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - const auto uuid = rp.PopRaw(); - - LOG_WARNING(Service_ACC, "(STUBBED) called, uuid=0x{}", uuid.RawString()); - - // TODO(ogniK): Check if application ID is zero on acc initialize. As we don't have a reliable - // way of confirming things like the TID, we're going to assume a non zero value for the time - // being. - constexpr u64 tid{1}; - StoreSaveDataThumbnail(ctx, uuid, tid); - } - - void GetBaasAccountManagerForSystemService(HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - const auto uuid = rp.PopRaw(); - - LOG_INFO(Service_ACC, "called, uuid=0x{}", uuid.RawString()); - - IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(ResultSuccess); - rb.PushIpcInterface(ctx, system, uuid); - } - - void StoreSaveDataThumbnailSystem(HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - const auto uuid = rp.PopRaw(); - const auto tid = rp.Pop(); - - LOG_WARNING(Service_ACC, "(STUBBED) called, uuid=0x{}, tid={:016X}", uuid.RawString(), tid); - StoreSaveDataThumbnail(ctx, uuid, tid); - } - - void GetPinCodeLength(HLERequestContext& ctx) { - LOG_WARNING(Service_ACC, "(STUBBED) called"); - - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(ResultSuccess); - rb.Push(0); - } - - void TrySelectUserWithoutInteractionDeprecated(HLERequestContext& ctx) { - LOG_DEBUG(Service_ACC, "called"); - // A u8 is passed into this function which we can safely ignore. It's to determine if we have - // access to use the network or not by the looks of it - IPC::ResponseBuilder rb{ctx, 6}; - if (profile_manager->GetUserCount() != 1) { - rb.Push(ResultSuccess); - rb.PushRaw(Common::InvalidUUID); - return; - } - - const auto user_list = profile_manager->GetAllUsers(); - if (std::ranges::all_of(user_list, [](const auto& user) { return user.IsInvalid(); })) { - rb.Push(ResultUnknown); // TODO(ogniK): Find the correct error code - rb.PushRaw(Common::InvalidUUID); - return; - } - - // Select the first user we have - rb.Push(ResultSuccess); - rb.PushRaw(profile_manager->GetUser(0)->uuid); - } - - void TrySelectUserWithoutInteraction(HLERequestContext& ctx) { - LOG_DEBUG(Service_ACC, "called"); - // A u8 is passed into this function which we can safely ignore. It's to determine if we have - // access to use the network or not by the looks of it - IPC::ResponseBuilder rb{ctx, 6}; - if (profile_manager->GetUserCount() != 1) { - rb.Push(ResultSuccess); - rb.PushRaw(Common::InvalidUUID); - return; - } - - const auto user_list = profile_manager->GetAllUsers(); - if (std::ranges::all_of(user_list, [](const auto& user) { return user.IsInvalid(); })) { - rb.Push(ResultUnknown); // TODO(ogniK): Find the correct error code - rb.PushRaw(Common::InvalidUUID); - return; - } - - // Select the first user we have - rb.Push(ResultSuccess); - rb.PushRaw(profile_manager->GetUser(0)->uuid); - } - - private: - Result InitializeApplicationInfoBase() { - if (application_info) { - LOG_ERROR(Service_ACC, "Application already initialized"); - return Account::ResultApplicationInfoAlreadyInitialized; - } - - // TODO(ogniK): This should be changed to reflect the target process for when we have multiple - // processes emulated. As we don't actually have pid support we should assume we're just using - // our own process - Glue::ApplicationLaunchProperty launch_property{}; - const auto result = system.GetARPManager().GetLaunchProperty( - &launch_property, system.GetApplicationProcessProgramID()); - - if (result != ResultSuccess) { - LOG_ERROR(Service_ACC, "Failed to get launch property"); - return Account::ResultInvalidApplication; - } - - switch (launch_property.base_game_storage_id) { - case FileSys::StorageId::GameCard: - application_info.application_type = ApplicationType::GameCard; - break; - case FileSys::StorageId::Host: - case FileSys::StorageId::NandSystem: - case FileSys::StorageId::NandUser: - case FileSys::StorageId::SdCard: - case FileSys::StorageId::None: // Yuzu specific, differs from hardware - application_info.application_type = ApplicationType::Digital; - break; - default: - LOG_ERROR(Service_ACC, "Invalid game storage ID! storage_id={}", - launch_property.base_game_storage_id); - return Account::ResultInvalidApplication; - } - - LOG_WARNING(Service_ACC, "ApplicationInfo init required"); - // TODO(ogniK): Actual initialization here - - return ResultSuccess; - } - - void StoreSaveDataThumbnail(HLERequestContext& ctx, const Common::UUID& uuid, - const u64 tid) { - IPC::ResponseBuilder rb{ctx, 2}; - - if (tid == 0) { - LOG_ERROR(Service_ACC, "TitleID is not valid!"); - rb.Push(Account::ResultInvalidApplication); - return; - } - - if (uuid.IsInvalid()) { - LOG_ERROR(Service_ACC, "User ID is not valid!"); - rb.Push(Account::ResultInvalidUserId); - return; - } - const auto thumbnail_size = ctx.GetReadBufferSize(); - if (thumbnail_size != THUMBNAIL_SIZE) { - LOG_ERROR(Service_ACC, "Buffer size is empty! size={:X} expecting {:X}", thumbnail_size, - THUMBNAIL_SIZE); - rb.Push(Account::ResultInvalidArrayLength); - return; - } - - // TODO(ogniK): Construct save data thumbnail - rb.Push(ResultSuccess); - } - - enum class ApplicationType : u32_le { - GameCard = 0, - Digital = 1, - Unknown = 3, - }; - - struct ApplicationInfo { - Service::Glue::ApplicationLaunchProperty launch_property; - ApplicationType application_type; - - constexpr explicit operator bool() const { - return launch_property.title_id != 0x0; - } - }; - - ApplicationInfo application_info{}; - protected: - std::shared_ptr module; - std::shared_ptr profile_manager; - }; -}; + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(is_locked); +} + +void Module::Interface::InitializeApplicationInfoV2(HLERequestContext& ctx) { + LOG_WARNING(Service_ACC, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + +void Module::Interface::BeginUserRegistration(HLERequestContext& ctx) { + const auto user_id = Common::UUID::MakeRandom(); + profile_manager->CreateNewUser(user_id, "Eden"); + + LOG_INFO(Service_ACC, "called, uuid={}", user_id.FormattedString()); + + IPC::ResponseBuilder rb{ctx, 6}; + rb.Push(ResultSuccess); + rb.PushRaw(user_id); +} + +void Module::Interface::CompleteUserRegistration(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + Common::UUID user_id = rp.PopRaw(); + + LOG_INFO(Service_ACC, "called, uuid={}", user_id.FormattedString()); + + profile_manager->WriteUserSaveFile(); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + +void Module::Interface::DeleteUser(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + Common::UUID user_id = rp.PopRaw(); + LOG_INFO(Service_ACC, "called, uuid={}", user_id.FormattedString()); + if (!profile_manager->RemoveUser(user_id)) { + LOG_ERROR(Service_ACC, "Failed to delete user with uuid={}", user_id.RawString()); + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(1U); + return; + } + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + +void Module::Interface::SetUserPosition(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + + u64 position = rp.Pop(); + Common::UUID user_id = rp.PopRaw(); + + LOG_DEBUG(Service_ACC, "called, position={} user_id={}", position, user_id.FormattedString()); + + profile_manager->SetUserPosition(position, user_id); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + +void Module::Interface::GetProfileEditor(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + Common::UUID user_id = rp.PopRaw(); + + LOG_DEBUG(Service_ACC, "called, user_id=0x{}", user_id.RawString()); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(ctx, system, user_id, *profile_manager); +} + +void Module::Interface::GetBaasAccountAdministrator(HLERequestContext &ctx) { + IPC::RequestParser rp{ctx}; + const auto uuid = rp.PopRaw(); + + LOG_INFO(Service_ACC, "called, uuid=0x{}", uuid.RawString()); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(ctx, system, uuid); +} + +void Module::Interface::ListQualifiedUsers(HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); + + // All users should be qualified. We don't actually have parental control or anything to do with + // nintendo online currently. We're just going to assume the user running the game has access to + // the game regardless of parental control settings. + ctx.WriteBuffer(profile_manager->GetAllUsers()); + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + +void Module::Interface::ListOpenContextStoredUsers(HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); + + ctx.WriteBuffer(profile_manager->GetStoredOpenedUsers()); + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + +void Module::Interface::StoreSaveDataThumbnailApplication(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + const auto uuid = rp.PopRaw(); + + LOG_WARNING(Service_ACC, "(STUBBED) called, uuid=0x{}", uuid.RawString()); + + // TODO(ogniK): Check if application ID is zero on acc initialize. As we don't have a reliable + // way of confirming things like the TID, we're going to assume a non zero value for the time + // being. + constexpr u64 tid{1}; + StoreSaveDataThumbnail(ctx, uuid, tid); +} + +void Module::Interface::GetBaasAccountManagerForSystemService(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + const auto uuid = rp.PopRaw(); + + LOG_INFO(Service_ACC, "called, uuid=0x{}", uuid.RawString()); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(ctx, system, uuid); +} + +void Module::Interface::StoreSaveDataThumbnailSystem(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + const auto uuid = rp.PopRaw(); + const auto tid = rp.Pop(); + + LOG_WARNING(Service_ACC, "(STUBBED) called, uuid=0x{}, tid={:016X}", uuid.RawString(), tid); + StoreSaveDataThumbnail(ctx, uuid, tid); +} + +void Module::Interface::GetPinCodeLength(HLERequestContext& ctx) { + LOG_WARNING(Service_ACC, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(0); +} + +void Module::Interface::StoreSaveDataThumbnail(HLERequestContext& ctx, const Common::UUID& uuid, + const u64 tid) { + IPC::ResponseBuilder rb{ctx, 2}; + + if (tid == 0) { + LOG_ERROR(Service_ACC, "TitleID is not valid!"); + rb.Push(Account::ResultInvalidApplication); + return; + } + + if (uuid.IsInvalid()) { + LOG_ERROR(Service_ACC, "User ID is not valid!"); + rb.Push(Account::ResultInvalidUserId); + return; + } + const auto thumbnail_size = ctx.GetReadBufferSize(); + if (thumbnail_size != THUMBNAIL_SIZE) { + LOG_ERROR(Service_ACC, "Buffer size is empty! size={:X} expecting {:X}", thumbnail_size, + THUMBNAIL_SIZE); + rb.Push(Account::ResultInvalidArrayLength); + return; + } + + // TODO(ogniK): Construct save data thumbnail + rb.Push(ResultSuccess); +} + +void Module::Interface::TrySelectUserWithoutInteractionDeprecated(HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); + // A u8 is passed into this function which we can safely ignore. It's to determine if we have + // access to use the network or not by the looks of it + IPC::ResponseBuilder rb{ctx, 6}; + if (profile_manager->GetUserCount() != 1) { + rb.Push(ResultSuccess); + rb.PushRaw(Common::InvalidUUID); + return; + } + + const auto user_list = profile_manager->GetAllUsers(); + if (std::ranges::all_of(user_list, [](const auto& user) { return user.IsInvalid(); })) { + rb.Push(ResultUnknown); // TODO(ogniK): Find the correct error code + rb.PushRaw(Common::InvalidUUID); + return; + } + + // Select the first user we have + rb.Push(ResultSuccess); + rb.PushRaw(profile_manager->GetUser(0)->uuid); +} + +void Module::Interface::TrySelectUserWithoutInteraction(HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); + // A u8 is passed into this function which we can safely ignore. It's to determine if we have + // access to use the network or not by the looks of it + IPC::ResponseBuilder rb{ctx, 6}; + if (profile_manager->GetUserCount() != 1) { + rb.Push(ResultSuccess); + rb.PushRaw(Common::InvalidUUID); + return; + } + + const auto user_list = profile_manager->GetAllUsers(); + if (std::ranges::all_of(user_list, [](const auto& user) { return user.IsInvalid(); })) { + rb.Push(ResultUnknown); // TODO(ogniK): Find the correct error code + rb.PushRaw(Common::InvalidUUID); + return; + } + + // Select the first user we have + rb.Push(ResultSuccess); + rb.PushRaw(profile_manager->GetUser(0)->uuid); +} + +Module::Interface::Interface(std::shared_ptr module_, + std::shared_ptr profile_manager_, + Core::System& system_, const char* name) + : ServiceFramework{system_, name}, module{std::move(module_)}, + profile_manager{std::move(profile_manager_)} {} + +Module::Interface::~Interface() = default; class ACC_AA final : public Module::Interface { public: explicit ACC_AA(std::shared_ptr module_, std::shared_ptr profile_manager_, Core::System& system_) - : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:aa") {} - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:aa") { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "EnsureCacheAsync"}, + {1, nullptr, "LoadCache"}, + {2, nullptr, "GetDeviceAccountId"}, + {50, nullptr, "RegisterNotificationTokenAsync"}, // 1.0.0 - 6.2.0 + {51, nullptr, "UnregisterNotificationTokenAsync"}, // 1.0.0 - 6.2.0 + }; + // clang-format on + RegisterHandlers(functions); } ~ACC_AA() override = default; - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "EnsureCacheAsync"}, - FunctionInfo{1, nullptr, "LoadCache"}, - FunctionInfo{2, nullptr, "GetDeviceAccountId"}, - FunctionInfo{50, nullptr, "RegisterNotificationTokenAsync", MakeVersionGate({1,0,0}, {6,2,0})}, - FunctionInfo{51, nullptr, "UnregisterNotificationTokenAsync", MakeVersionGate({1,0,0}, {6,2,0})} - ); }; class ACC_SU final : public Module::Interface { public: explicit ACC_SU(std::shared_ptr module_, std::shared_ptr profile_manager_, Core::System& system_) - : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:su") {} + : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:su") { + // clang-format off + static const FunctionInfo functions[] = { + {0, &ACC_SU::GetUserCount, "GetUserCount"}, + {1, &ACC_SU::GetUserExistence, "GetUserExistence"}, + {2, &ACC_SU::ListAllUsers, "ListAllUsers"}, + {3, &ACC_SU::ListOpenUsers, "ListOpenUsers"}, + {4, &ACC_SU::GetLastOpenedUser, "GetLastOpenedUser"}, + {5, &ACC_SU::GetProfile, "GetProfile"}, + {6, nullptr, "GetProfileDigest"}, + {50, &ACC_SU::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, + {51, &ACC_SU::TrySelectUserWithoutInteractionDeprecated, "TrySelectUserWithoutInteractionDeprecated"}, + {52, &ACC_SU::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, // 19.0.0+ + {60, &ACC_SU::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, + {99, nullptr, "DebugActivateOpenContextRetention"}, + {100, nullptr, "GetUserRegistrationNotifier"}, + {101, nullptr, "GetUserStateChangeNotifier"}, + {102, &ACC_SU::GetBaasAccountManagerForSystemService, "GetBaasAccountManagerForSystemService"}, + {103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, + {104, nullptr, "GetProfileUpdateNotifier"}, + {105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, + {106, nullptr, "GetProfileSyncNotifier"}, + {110, &ACC_SU::StoreSaveDataThumbnailSystem, "StoreSaveDataThumbnail"}, + {111, nullptr, "ClearSaveDataThumbnail"}, + {112, nullptr, "LoadSaveDataThumbnail"}, + {113, nullptr, "GetSaveDataThumbnailExistence"}, + {120, nullptr, "ListOpenUsersInApplication"}, + {130, nullptr, "ActivateOpenContextRetention"}, + {140, &ACC_SU::ListQualifiedUsers, "ListQualifiedUsers"}, + {150, nullptr, "AuthenticateApplicationAsync"}, + {151, nullptr, "EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync"}, + {152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"}, + {190, nullptr, "GetUserLastOpenedApplication"}, + {191, nullptr, "ActivateOpenContextHolder"}, + {200, &ACC_SU::BeginUserRegistration, "BeginUserRegistration"}, + {201, &ACC_SU::CompleteUserRegistration, "CompleteUserRegistration"}, + {202, nullptr, "CancelUserRegistration"}, + {203, &ACC_SU::DeleteUser, "DeleteUser"}, + {204, &ACC_SU::SetUserPosition, "SetUserPosition"}, + {205, &ACC_SU::GetProfileEditor, "GetProfileEditor"}, + {206, nullptr, "CompleteUserRegistrationForcibly"}, + {210, nullptr, "CreateFloatingRegistrationRequest"}, + {211, nullptr, "CreateProcedureToRegisterUserWithNintendoAccount"}, + {212, nullptr, "ResumeProcedureToRegisterUserWithNintendoAccount"}, + {230, nullptr, "AuthenticateServiceAsync"}, + {250, &ACC_SU::GetBaasAccountAdministrator, "GetBaasAccountAdministrator"}, + {290, nullptr, "ProxyProcedureForGuestLoginWithNintendoAccount"}, + {291, nullptr, "ProxyProcedureForFloatingRegistrationWithNintendoAccount"}, + {299, nullptr, "SuspendBackgroundDaemon"}, + {400, nullptr, "SetPinCode"}, // 18.0.0+ + {401, &ACC_SU::GetPinCodeLength, "GetPinCodeLength"}, // 18.0.0+ + {402, nullptr, "GetPinCode"}, // 18.0.0+ + {403, nullptr, "GetPinCodeParity"}, + {404, nullptr, "VerifyPinCode"}, + {405, nullptr, "IsPinCodeVerificationForbidden"}, + {410, nullptr, "GetPinCodeErrorCount"}, // 18.0.0+ + {411, nullptr, "ResetPinCodeErrorCount"}, // 18.0.0+ + {412, nullptr, "IncrementPinCodeErrorCount"}, // 18.0.0+ + {900, nullptr, "SetUserUnqualifiedForDebug"}, + {901, nullptr, "UnsetUserUnqualifiedForDebug"}, + {902, nullptr, "ListUsersUnqualifiedForDebug"}, + {910, nullptr, "RefreshFirmwareSettingsForDebug"}, + {997, nullptr, "DebugInvalidateTokenCacheForUser"}, + {998, nullptr, "DebugSetUserStateClose"}, + {999, nullptr, "DebugSetUserStateOpen"}, + }; + // clang-format on - ~ACC_SU() override = default; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &ACC_SU::GetUserCount, "GetUserCount"}, - FunctionInfo{1, &ACC_SU::GetUserExistence, "GetUserExistence"}, - FunctionInfo{2, &ACC_SU::ListAllUsers, "ListAllUsers"}, - FunctionInfo{3, &ACC_SU::ListOpenUsers, "ListOpenUsers"}, - FunctionInfo{4, &ACC_SU::GetLastOpenedUser, "GetLastOpenedUser"}, - FunctionInfo{5, &ACC_SU::GetProfile, "GetProfile"}, - FunctionInfo{6, nullptr, "GetProfileDigest"}, - FunctionInfo{50, &ACC_SU::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, - FunctionInfo{51, &ACC_SU::TrySelectUserWithoutInteractionDeprecated, "TrySelectUserWithoutInteractionDeprecated"}, - FunctionInfo{52, &ACC_SU::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction", MakeVersionGate({19,0,0})}, - FunctionInfo{60, &ACC_SU::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, - FunctionInfo{99, nullptr, "DebugActivateOpenContextRetention"}, - FunctionInfo{100, nullptr, "GetUserRegistrationNotifier"}, - FunctionInfo{101, nullptr, "GetUserStateChangeNotifier"}, - FunctionInfo{102, &ACC_SU::GetBaasAccountManagerForSystemService, "GetBaasAccountManagerForSystemService"}, - FunctionInfo{103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, - FunctionInfo{104, nullptr, "GetProfileUpdateNotifier"}, - FunctionInfo{105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, - FunctionInfo{106, nullptr, "GetProfileSyncNotifier"}, - FunctionInfo{110, &ACC_SU::StoreSaveDataThumbnailSystem, "StoreSaveDataThumbnail"}, - FunctionInfo{111, nullptr, "ClearSaveDataThumbnail"}, - FunctionInfo{112, nullptr, "LoadSaveDataThumbnail"}, - FunctionInfo{113, nullptr, "GetSaveDataThumbnailExistence"}, - FunctionInfo{120, nullptr, "ListOpenUsersInApplication"}, - FunctionInfo{130, nullptr, "ActivateOpenContextRetention"}, - FunctionInfo{140, &ACC_SU::ListQualifiedUsers, "ListQualifiedUsers"}, - FunctionInfo{150, nullptr, "AuthenticateApplicationAsync"}, - FunctionInfo{151, nullptr, "EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync"}, - FunctionInfo{152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"}, - FunctionInfo{190, nullptr, "GetUserLastOpenedApplication"}, - FunctionInfo{191, nullptr, "ActivateOpenContextHolder"}, - FunctionInfo{200, &ACC_SU::BeginUserRegistration, "BeginUserRegistration"}, - FunctionInfo{201, &ACC_SU::CompleteUserRegistration, "CompleteUserRegistration"}, - FunctionInfo{202, nullptr, "CancelUserRegistration"}, - FunctionInfo{203, &ACC_SU::DeleteUser, "DeleteUser"}, - FunctionInfo{204, &ACC_SU::SetUserPosition, "SetUserPosition"}, - FunctionInfo{205, &ACC_SU::GetProfileEditor, "GetProfileEditor"}, - FunctionInfo{206, nullptr, "CompleteUserRegistrationForcibly"}, - FunctionInfo{210, nullptr, "CreateFloatingRegistrationRequest"}, - FunctionInfo{211, nullptr, "CreateProcedureToRegisterUserWithNintendoAccount"}, - FunctionInfo{212, nullptr, "ResumeProcedureToRegisterUserWithNintendoAccount"}, - FunctionInfo{230, nullptr, "AuthenticateServiceAsync"}, - FunctionInfo{250, &ACC_SU::GetBaasAccountAdministrator, "GetBaasAccountAdministrator"}, - FunctionInfo{290, nullptr, "ProxyProcedureForGuestLoginWithNintendoAccount"}, - FunctionInfo{291, nullptr, "ProxyProcedureForFloatingRegistrationWithNintendoAccount"}, - FunctionInfo{299, nullptr, "SuspendBackgroundDaemon"}, - FunctionInfo{400, nullptr, "SetPinCode", MakeVersionGate({18,0,0})}, - FunctionInfo{401, &ACC_SU::GetPinCodeLength, "GetPinCodeLength", MakeVersionGate({18,0,0})}, - FunctionInfo{402, nullptr, "GetPinCode", MakeVersionGate({18,0,0})}, - FunctionInfo{403, nullptr, "GetPinCodeParity"}, - FunctionInfo{404, nullptr, "VerifyPinCode"}, - FunctionInfo{405, nullptr, "IsPinCodeVerificationForbidden"}, - FunctionInfo{410, nullptr, "GetPinCodeErrorCount", MakeVersionGate({18,0,0})}, - FunctionInfo{411, nullptr, "ResetPinCodeErrorCount", MakeVersionGate({18,0,0})}, - FunctionInfo{412, nullptr, "IncrementPinCodeErrorCount", MakeVersionGate({18,0,0})}, - FunctionInfo{900, nullptr, "SetUserUnqualifiedForDebug"}, - FunctionInfo{901, nullptr, "UnsetUserUnqualifiedForDebug"}, - FunctionInfo{902, nullptr, "ListUsersUnqualifiedForDebug"}, - FunctionInfo{910, nullptr, "RefreshFirmwareSettingsForDebug"}, - FunctionInfo{997, nullptr, "DebugInvalidateTokenCacheForUser"}, - FunctionInfo{998, nullptr, "DebugSetUserStateClose"}, - FunctionInfo{999, nullptr, "DebugSetUserStateOpen"} - ); + ~ACC_SU() override = default; }; class ACC_U0 final : public Module::Interface { public: ACC_U0(std::shared_ptr module_, std::shared_ptr profile_manager_, Core::System& system_) - : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:u0") {} + : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:u0") { + // clang-format off + static const FunctionInfo functions[] = { + {0, &ACC_U0::GetUserCount, "GetUserCount"}, + {1, &ACC_U0::GetUserExistence, "GetUserExistence"}, + {2, &ACC_U0::ListAllUsers, "ListAllUsers"}, + {3, &ACC_U0::ListOpenUsers, "ListOpenUsers"}, + {4, &ACC_U0::GetLastOpenedUser, "GetLastOpenedUser"}, + {5, &ACC_U0::GetProfile, "GetProfile"}, + {6, nullptr, "GetProfileDigest"}, // 3.0.0+ + {50, &ACC_U0::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, + {51, &ACC_U0::TrySelectUserWithoutInteractionDeprecated, "TrySelectUserWithoutInteractionDeprecated"}, + {52, &ACC_U0::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, + {60, &ACC_U0::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, // 5.0.0 - 5.1.0 + {99, nullptr, "DebugActivateOpenContextRetention"}, // 6.0.0+ + {100, &ACC_U0::InitializeApplicationInfo, "InitializeApplicationInfo"}, + {101, &ACC_U0::GetBaasAccountManagerForApplication, "GetBaasAccountManagerForApplication"}, + {102, nullptr, "AuthenticateApplicationAsync"}, + {103, nullptr, "CheckNetworkServiceAvailabilityAsync"}, // 4.0.0+ + {110, &ACC_U0::StoreSaveDataThumbnailApplication, "StoreSaveDataThumbnail"}, + {111, nullptr, "ClearSaveDataThumbnail"}, + {120, nullptr, "CreateGuestLoginRequest"}, + {130, nullptr, "LoadOpenContext"}, // 5.0.0+ + {131, &ACC_U0::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, // 6.0.0+ + {140, &ACC_U0::InitializeApplicationInfoRestricted, "InitializeApplicationInfoRestricted"}, // 6.0.0+ + {141, &ACC_U0::ListQualifiedUsers, "ListQualifiedUsers"}, // 6.0.0+ + {150, &ACC_U0::IsUserAccountSwitchLocked, "IsUserAccountSwitchLocked"}, // 6.0.0+ + {160, &ACC_U0::InitializeApplicationInfoV2, "InitializeApplicationInfoV2"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } ~ACC_U0() override = default; - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &ACC_U0::GetUserCount, "GetUserCount"}, - FunctionInfo{1, &ACC_U0::GetUserExistence, "GetUserExistence"}, - FunctionInfo{2, &ACC_U0::ListAllUsers, "ListAllUsers"}, - FunctionInfo{3, &ACC_U0::ListOpenUsers, "ListOpenUsers"}, - FunctionInfo{4, &ACC_U0::GetLastOpenedUser, "GetLastOpenedUser"}, - FunctionInfo{5, &ACC_U0::GetProfile, "GetProfile"}, - FunctionInfo{6, nullptr, "GetProfileDigest", MakeVersionGate({3,0,0})}, - FunctionInfo{50, &ACC_U0::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, - FunctionInfo{51, &ACC_U0::TrySelectUserWithoutInteractionDeprecated, "TrySelectUserWithoutInteractionDeprecated"}, - FunctionInfo{52, &ACC_U0::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, - FunctionInfo{60, &ACC_U0::ListOpenContextStoredUsers, "ListOpenContextStoredUsers", MakeVersionGate({5,0,0}, {5,1,0})}, - FunctionInfo{99, nullptr, "DebugActivateOpenContextRetention", MakeVersionGate({6,0,0})}, - FunctionInfo{100, &ACC_U0::InitializeApplicationInfo, "InitializeApplicationInfo"}, - FunctionInfo{101, &ACC_U0::GetBaasAccountManagerForApplication, "GetBaasAccountManagerForApplication"}, - FunctionInfo{102, nullptr, "AuthenticateApplicationAsync"}, - FunctionInfo{103, nullptr, "CheckNetworkServiceAvailabilityAsync", MakeVersionGate({4,0,0})}, - FunctionInfo{110, &ACC_U0::StoreSaveDataThumbnailApplication, "StoreSaveDataThumbnail"}, - FunctionInfo{111, nullptr, "ClearSaveDataThumbnail"}, - FunctionInfo{120, nullptr, "CreateGuestLoginRequest"}, - FunctionInfo{130, nullptr, "LoadOpenContext", MakeVersionGate({5,0,0})}, - FunctionInfo{131, &ACC_U0::ListOpenContextStoredUsers, "ListOpenContextStoredUsers", MakeVersionGate({6,0,0})}, - FunctionInfo{140, &ACC_U0::InitializeApplicationInfoRestricted, "InitializeApplicationInfoRestricted", MakeVersionGate({6,0,0})}, - FunctionInfo{141, &ACC_U0::ListQualifiedUsers, "ListQualifiedUsers", MakeVersionGate({6,0,0})}, - FunctionInfo{150, &ACC_U0::IsUserAccountSwitchLocked, "IsUserAccountSwitchLocked", MakeVersionGate({6,0,0})}, - FunctionInfo{160, &ACC_U0::InitializeApplicationInfoV2, "InitializeApplicationInfoV2"} - ); }; class ACC_U1 final : public Module::Interface { public: ACC_U1(std::shared_ptr module_, std::shared_ptr profile_manager_, Core::System& system_) - : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:u1") {} + : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:u1") { + // clang-format off + static const FunctionInfo functions[] = { + {0, &ACC_U1::GetUserCount, "GetUserCount"}, + {1, &ACC_U1::GetUserExistence, "GetUserExistence"}, + {2, &ACC_U1::ListAllUsers, "ListAllUsers"}, + {3, &ACC_U1::ListOpenUsers, "ListOpenUsers"}, + {4, &ACC_U1::GetLastOpenedUser, "GetLastOpenedUser"}, + {5, &ACC_U1::GetProfile, "GetProfile"}, + {6, nullptr, "GetProfileDigest"}, + {50, &ACC_U1::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, + {51, &ACC_U1::TrySelectUserWithoutInteractionDeprecated, "TrySelectUserWithoutInteractionDeprecated"}, + {52, &ACC_U1::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, + {60, &ACC_U1::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, + {99, nullptr, "DebugActivateOpenContextRetention"}, + {100, nullptr, "GetUserRegistrationNotifier"}, + {101, nullptr, "GetUserStateChangeNotifier"}, + {102, &ACC_U1::GetBaasAccountManagerForSystemService, "GetBaasAccountManagerForSystemService"}, + {103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, + {104, nullptr, "GetProfileUpdateNotifier"}, + {105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, + {106, nullptr, "GetProfileSyncNotifier"}, + {110, &ACC_U1::StoreSaveDataThumbnailApplication, "StoreSaveDataThumbnail"}, + {111, nullptr, "ClearSaveDataThumbnail"}, + {112, nullptr, "LoadSaveDataThumbnail"}, + {113, nullptr, "GetSaveDataThumbnailExistence"}, + {120, nullptr, "ListOpenUsersInApplication"}, + {130, nullptr, "ActivateOpenContextRetention"}, + {140, &ACC_U1::ListQualifiedUsers, "ListQualifiedUsers"}, + {150, nullptr, "AuthenticateApplicationAsync"}, + {151, nullptr, "EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync"}, + {152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"}, + {190, nullptr, "GetUserLastOpenedApplication"}, + {191, nullptr, "ActivateOpenContextHolder"}, + {401, &ACC_U1::GetPinCodeLength, "GetPinCodeLength"}, // 18.0.0+ + {402, nullptr, "GetPinCode"}, // 18.0.0+ + {997, nullptr, "DebugInvalidateTokenCacheForUser"}, + {998, nullptr, "DebugSetUserStateClose"}, + {999, nullptr, "DebugSetUserStateOpen"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } ~ACC_U1() override = default; - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &ACC_U1::GetUserCount, "GetUserCount"}, - FunctionInfo{1, &ACC_U1::GetUserExistence, "GetUserExistence"}, - FunctionInfo{2, &ACC_U1::ListAllUsers, "ListAllUsers"}, - FunctionInfo{3, &ACC_U1::ListOpenUsers, "ListOpenUsers"}, - FunctionInfo{4, &ACC_U1::GetLastOpenedUser, "GetLastOpenedUser"}, - FunctionInfo{5, &ACC_U1::GetProfile, "GetProfile"}, - FunctionInfo{6, nullptr, "GetProfileDigest"}, - FunctionInfo{50, &ACC_U1::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, - FunctionInfo{51, &ACC_U1::TrySelectUserWithoutInteractionDeprecated, "TrySelectUserWithoutInteractionDeprecated"}, - FunctionInfo{52, &ACC_U1::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, - FunctionInfo{60, &ACC_U1::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, - FunctionInfo{99, nullptr, "DebugActivateOpenContextRetention"}, - FunctionInfo{100, nullptr, "GetUserRegistrationNotifier"}, - FunctionInfo{101, nullptr, "GetUserStateChangeNotifier"}, - FunctionInfo{102, &ACC_U1::GetBaasAccountManagerForSystemService, "GetBaasAccountManagerForSystemService"}, - FunctionInfo{103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, - FunctionInfo{104, nullptr, "GetProfileUpdateNotifier"}, - FunctionInfo{105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, - FunctionInfo{106, nullptr, "GetProfileSyncNotifier"}, - FunctionInfo{110, &ACC_U1::StoreSaveDataThumbnailApplication, "StoreSaveDataThumbnail"}, - FunctionInfo{111, nullptr, "ClearSaveDataThumbnail"}, - FunctionInfo{112, nullptr, "LoadSaveDataThumbnail"}, - FunctionInfo{113, nullptr, "GetSaveDataThumbnailExistence"}, - FunctionInfo{120, nullptr, "ListOpenUsersInApplication"}, - FunctionInfo{130, nullptr, "ActivateOpenContextRetention"}, - FunctionInfo{140, &ACC_U1::ListQualifiedUsers, "ListQualifiedUsers"}, - FunctionInfo{150, nullptr, "AuthenticateApplicationAsync"}, - FunctionInfo{151, nullptr, "EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync"}, - FunctionInfo{152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"}, - FunctionInfo{190, nullptr, "GetUserLastOpenedApplication"}, - FunctionInfo{191, nullptr, "ActivateOpenContextHolder"}, - FunctionInfo{401, &ACC_U1::GetPinCodeLength, "GetPinCodeLength", MakeVersionGate({18,0,0})}, - FunctionInfo{402, nullptr, "GetPinCode", MakeVersionGate({18,0,0})}, - FunctionInfo{997, nullptr, "DebugInvalidateTokenCacheForUser"}, - FunctionInfo{998, nullptr, "DebugSetUserStateClose"}, - FunctionInfo{999, nullptr, "DebugSetUserStateOpen"} - ); }; class DAUTH_0 final : public ServiceFramework { public: - explicit DAUTH_0(Core::System& system_) : ServiceFramework{system_, "dauth:0"} {} - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit DAUTH_0(Core::System& system_) : ServiceFramework{system_, "dauth:0"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "EnsureAuthenticationTokenCacheAsync"}, + {1, nullptr, "LoadAuthenticationTokenCache"}, + {2, nullptr, "InvalidateAuthenticationTokenCache"}, + {3, nullptr, "IsDeviceAuthenticationTokenCacheAvailable"}, + {10, nullptr, "EnsureEdgeTokenCacheAsync"}, + {11, nullptr, "LoadEdgeTokenCache"}, + {12, nullptr, "InvalidateEdgeTokenCache"}, + {13, nullptr, "IsEdgeTokenCacheAvailable"}, + {20, nullptr, "EnsureApplicationAuthenticationCacheAsync"}, + {21, nullptr, "LoadApplicationAuthenticationTokenCache"}, + {22, nullptr, "LoadApplicationNetworkServiceClientConfigCache"}, + {23, nullptr, "IsApplicationAuthenticationCacheAvailable"}, + {24, nullptr, "InvalidateApplicationAuthenticationCache"}, + {30, nullptr, "EnsureGameCardAuthenticationCacheAsync"}, + {31, nullptr, "LoadGameCardAuthenticationTokenCache"}, + {32, nullptr, "IsGameCardAuthenticationCacheAvailable"}, + {33, nullptr, "InvalidateGameCardAuthenticationCache"}, + {1000, nullptr, "GetInactiveElicenseUsedEvent"}, + {9000, nullptr, "ImportVirtualClientCertificate"}, + {9010, nullptr, "DeleteVirtualClientCertificate"}, + }; + // clang-format on + RegisterHandlers(functions); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "EnsureAuthenticationTokenCacheAsync"}, - FunctionInfo{1, nullptr, "LoadAuthenticationTokenCache"}, - FunctionInfo{2, nullptr, "InvalidateAuthenticationTokenCache"}, - FunctionInfo{3, nullptr, "IsDeviceAuthenticationTokenCacheAvailable"}, - FunctionInfo{10, nullptr, "EnsureEdgeTokenCacheAsync"}, - FunctionInfo{11, nullptr, "LoadEdgeTokenCache"}, - FunctionInfo{12, nullptr, "InvalidateEdgeTokenCache"}, - FunctionInfo{13, nullptr, "IsEdgeTokenCacheAvailable"}, - FunctionInfo{20, nullptr, "EnsureApplicationAuthenticationCacheAsync"}, - FunctionInfo{21, nullptr, "LoadApplicationAuthenticationTokenCache"}, - FunctionInfo{22, nullptr, "LoadApplicationNetworkServiceClientConfigCache"}, - FunctionInfo{23, nullptr, "IsApplicationAuthenticationCacheAvailable"}, - FunctionInfo{24, nullptr, "InvalidateApplicationAuthenticationCache"}, - FunctionInfo{30, nullptr, "EnsureGameCardAuthenticationCacheAsync"}, - FunctionInfo{31, nullptr, "LoadGameCardAuthenticationTokenCache"}, - FunctionInfo{32, nullptr, "IsGameCardAuthenticationCacheAvailable"}, - FunctionInfo{33, nullptr, "InvalidateGameCardAuthenticationCache"}, - FunctionInfo{1000, nullptr, "GetInactiveElicenseUsedEvent"}, - FunctionInfo{9000, nullptr, "ImportVirtualClientCertificate"}, - FunctionInfo{9010, nullptr, "DeleteVirtualClientCertificate"} - ); }; class ACC_E final : public Module::Interface { public: explicit ACC_E(std::shared_ptr module_, std::shared_ptr profile_manager_, Core::System& system_) - : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:e") {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetUserCount"}, - FunctionInfo{1, nullptr, "GetUserExistence"}, - FunctionInfo{2, nullptr, "ListAllUsers"}, - FunctionInfo{3, nullptr, "ListOpenUsers"}, - FunctionInfo{4, nullptr, "GetLastOpenedUser"}, - FunctionInfo{5, nullptr, "GetProfile"}, - FunctionInfo{6, nullptr, "GetProfileDigest"}, - FunctionInfo{50, nullptr, "IsUserRegistrationRequestPermitted"}, - FunctionInfo{51, nullptr, "TrySelectUserWithoutInteractionDeprecated"}, - FunctionInfo{52, nullptr, "TrySelectUserWithoutInteraction"}, - FunctionInfo{99, nullptr, "DebugActivateOpenContextRetention"}, - FunctionInfo{100, nullptr, "GetUserRegistrationNotifier"}, - FunctionInfo{101, nullptr, "GetUserStateChangeNotifier"}, - FunctionInfo{102, nullptr, "GetBaasAccountManagerForSystemService"}, - FunctionInfo{103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, - FunctionInfo{104, nullptr, "GetProfileUpdateNotifier"}, - FunctionInfo{105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, - FunctionInfo{106, nullptr, "GetProfileSyncNotifier"}, - FunctionInfo{110, nullptr, "StoreSaveDataThumbnail"}, - FunctionInfo{111, nullptr, "ClearSaveDataThumbnail"}, - FunctionInfo{112, nullptr, "LoadSaveDataThumbnail"}, - FunctionInfo{113, nullptr, "GetSaveDataThumbnailExistence"}, - FunctionInfo{120, nullptr, "ListOpenUsersInApplication"}, - FunctionInfo{130, nullptr, "ActivateOpenContextRetention"}, - FunctionInfo{140, nullptr, "ListQualifiedUsers"}, - FunctionInfo{151, nullptr, "EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync"}, - FunctionInfo{152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"}, - FunctionInfo{170, nullptr, "GetNasOp2MembershipStateChangeNotifier"}, - FunctionInfo{191, nullptr, "UpdateNotificationReceiverInfo"}, - FunctionInfo{200, nullptr, "BeginUserRegistration"}, - FunctionInfo{201, nullptr, "CompleteUserRegistration"}, - FunctionInfo{202, nullptr, "CancelUserRegistration"}, - FunctionInfo{203, nullptr, "DeleteUser"}, - FunctionInfo{204, nullptr, "SetUserPosition"}, - FunctionInfo{205, nullptr, "GetProfileEditor"}, - FunctionInfo{206, nullptr, "CompleteUserRegistrationForcibly"}, - FunctionInfo{210, nullptr, "CreateFloatingRegistrationRequest"}, - FunctionInfo{211, nullptr, "CreateProcedureToRegisterUserWithNintendoAccount"}, - FunctionInfo{212, nullptr, "ResumeProcedureToRegisterUserWithNintendoAccount"}, - FunctionInfo{213, nullptr, "CreateProcedureToCreateUserWithNintendoAccount"}, - FunctionInfo{214, nullptr, "ResumeProcedureToCreateUserWithNintendoAccount"}, - FunctionInfo{215, nullptr, "ResumeProcedureToCreateUserWithNintendoAccountAfterApplyResponse"}, - FunctionInfo{230, nullptr, "AuthenticateServiceAsync"}, - FunctionInfo{250, nullptr, "GetBaasAccountAdministrator"}, - FunctionInfo{251, nullptr, "SynchronizeNetworkServiceAccountsSnapshotAsync"}, - FunctionInfo{290, nullptr, "ProxyProcedureForGuestLoginWithNintendoAccount"}, - FunctionInfo{291, nullptr, "ProxyProcedureForFloatingRegistrationWithNintendoAccount"}, - FunctionInfo{292, nullptr, "ProxyProcedureForDeviceMigrationAuthenticatingOperatingUser"}, - FunctionInfo{293, nullptr, "ProxyProcedureForDeviceMigrationDownload"}, - FunctionInfo{299, nullptr, "SuspendBackgroundDaemon"}, - FunctionInfo{350, nullptr, "CreateDeviceMigrationUserExportRequest"}, - FunctionInfo{351, nullptr, "UploadNasCredential"}, - FunctionInfo{352, nullptr, "CreateDeviceMigrationUserImportRequest"}, - FunctionInfo{353, nullptr, "DeleteUserMigrationSaveData"}, - FunctionInfo{400, nullptr, "SetPinCode"}, - FunctionInfo{401, nullptr, "GetPinCodeLength"}, - FunctionInfo{402, nullptr, "GetPinCode"}, - FunctionInfo{403, nullptr, "GetPinCodeParity"}, - FunctionInfo{404, nullptr, "VerifyPinCode"}, - FunctionInfo{405, nullptr, "IsPinCodeVerificationForbidden"}, - FunctionInfo{410, nullptr, "GetPinCodeErrorCount"}, - FunctionInfo{411, nullptr, "ResetPinCodeErrorCount"}, - FunctionInfo{412, nullptr, "IncrementPinCodeErrorCount"}, - FunctionInfo{413, nullptr, "SetPinCodeErrorCount"}, - FunctionInfo{420, nullptr, "SetStartPenaltyTime"}, - FunctionInfo{421, nullptr, "GetStartPenaltyTime"}, - FunctionInfo{900, nullptr, "SetUserUnqualifiedForDebug"}, - FunctionInfo{901, nullptr, "UnsetUserUnqualifiedForDebug"}, - FunctionInfo{902, nullptr, "ListUsersUnqualifiedForDebug"}, - FunctionInfo{910, nullptr, "RefreshFirmwareSettingsForDebug"}, - FunctionInfo{997, nullptr, "DebugInvalidateTokenCacheForUser"}, - FunctionInfo{998, nullptr, "DebugSetUserStateClose"}, - FunctionInfo{999, nullptr, "DebugSetUserStateOpen"}, - FunctionInfo{1000, nullptr, "CreateIAccountEntityServiceForApplication"}, - FunctionInfo{1100, nullptr, "CreateIUserStateManager"}, - FunctionInfo{10050, nullptr, "IsUserRegistrationRequestPermittedForAccountPolicy"}, - FunctionInfo{10105, nullptr, "CheckNetworkServiceAvailabilityAsyncForAccountPolicy"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:e") { + // clang-format off + static const FunctionInfo functions[] = { + { 0, nullptr, "GetUserCount"}, + { 1, nullptr, "GetUserExistence"}, + { 2, nullptr, "ListAllUsers"}, + { 3, nullptr, "ListOpenUsers"}, + { 4, nullptr, "GetLastOpenedUser"}, + { 5, nullptr, "GetProfile"}, + { 6, nullptr, "GetProfileDigest"}, + { 50, nullptr, "IsUserRegistrationRequestPermitted"}, + { 51, nullptr, "TrySelectUserWithoutInteractionDeprecated"}, + { 52, nullptr, "TrySelectUserWithoutInteraction"}, + { 99, nullptr, "DebugActivateOpenContextRetention"}, + { 100, nullptr, "GetUserRegistrationNotifier"}, + { 101, nullptr, "GetUserStateChangeNotifier"}, + { 102, nullptr, "GetBaasAccountManagerForSystemService"}, + { 103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, + { 104, nullptr, "GetProfileUpdateNotifier"}, + { 105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, + { 106, nullptr, "GetProfileSyncNotifier"}, + { 110, nullptr, "StoreSaveDataThumbnail"}, + { 111, nullptr, "ClearSaveDataThumbnail"}, + { 112, nullptr, "LoadSaveDataThumbnail"}, + { 113, nullptr, "GetSaveDataThumbnailExistence"}, + { 120, nullptr, "ListOpenUsersInApplication"}, + { 130, nullptr, "ActivateOpenContextRetention"}, + { 140, nullptr, "ListQualifiedUsers"}, + { 151, nullptr, "EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync"}, + { 152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"}, + { 170, nullptr, "GetNasOp2MembershipStateChangeNotifier"}, + { 191, nullptr, "UpdateNotificationReceiverInfo"}, + { 200, nullptr, "BeginUserRegistration"}, + { 201, nullptr, "CompleteUserRegistration"}, + { 202, nullptr, "CancelUserRegistration"}, + { 203, nullptr, "DeleteUser"}, + { 204, nullptr, "SetUserPosition"}, + { 205, nullptr, "GetProfileEditor"}, + { 206, nullptr, "CompleteUserRegistrationForcibly"}, + { 210, nullptr, "CreateFloatingRegistrationRequest"}, + { 211, nullptr, "CreateProcedureToRegisterUserWithNintendoAccount"}, + { 212, nullptr, "ResumeProcedureToRegisterUserWithNintendoAccount"}, + { 213, nullptr, "CreateProcedureToCreateUserWithNintendoAccount"}, + { 214, nullptr, "ResumeProcedureToCreateUserWithNintendoAccount"}, + { 215, nullptr, "ResumeProcedureToCreateUserWithNintendoAccountAfterApplyResponse"}, + { 230, nullptr, "AuthenticateServiceAsync"}, + { 250, nullptr, "GetBaasAccountAdministrator"}, + { 251, nullptr, "SynchronizeNetworkServiceAccountsSnapshotAsync"}, + { 290, nullptr, "ProxyProcedureForGuestLoginWithNintendoAccount"}, + { 291, nullptr, "ProxyProcedureForFloatingRegistrationWithNintendoAccount"}, + { 292, nullptr, "ProxyProcedureForDeviceMigrationAuthenticatingOperatingUser"}, + { 293, nullptr, "ProxyProcedureForDeviceMigrationDownload"}, + { 299, nullptr, "SuspendBackgroundDaemon"}, + { 350, nullptr, "CreateDeviceMigrationUserExportRequest"}, + { 351, nullptr, "UploadNasCredential"}, + { 352, nullptr, "CreateDeviceMigrationUserImportRequest"}, + { 353, nullptr, "DeleteUserMigrationSaveData"}, + { 400, nullptr, "SetPinCode"}, + { 401, nullptr, "GetPinCodeLength"}, + { 402, nullptr, "GetPinCode"}, + { 403, nullptr, "GetPinCodeParity"}, + { 404, nullptr, "VerifyPinCode"}, + { 405, nullptr, "IsPinCodeVerificationForbidden"}, + { 410, nullptr, "GetPinCodeErrorCount"}, + { 411, nullptr, "ResetPinCodeErrorCount"}, + { 412, nullptr, "IncrementPinCodeErrorCount"}, + { 413, nullptr, "SetPinCodeErrorCount"}, + { 420, nullptr, "SetStartPenaltyTime"}, + { 421, nullptr, "GetStartPenaltyTime"}, + { 900, nullptr, "SetUserUnqualifiedForDebug"}, + { 901, nullptr, "UnsetUserUnqualifiedForDebug"}, + { 902, nullptr, "ListUsersUnqualifiedForDebug"}, + { 910, nullptr, "RefreshFirmwareSettingsForDebug"}, + { 997, nullptr, "DebugInvalidateTokenCacheForUser"}, + { 998, nullptr, "DebugSetUserStateClose"}, + { 999, nullptr, "DebugSetUserStateOpen"}, + { 1000, nullptr, "CreateIAccountEntityServiceForApplication"}, + { 1100, nullptr, "CreateIUserStateManager"}, + { 10050, nullptr, "IsUserRegistrationRequestPermittedForAccountPolicy"}, + { 10105, nullptr, "CheckNetworkServiceAvailabilityAsyncForAccountPolicy"}, + }; + // clang-format on + RegisterHandlers(functions); } }; class ACC_E_U1 final : public Module::Interface { public: explicit ACC_E_U1(std::shared_ptr module_, std::shared_ptr profile_manager_, Core::System& system_) - : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:e:u1") {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetUserCount"}, - FunctionInfo{1, nullptr, "GetUserExistence"}, - FunctionInfo{2, nullptr, "ListAllUsers"}, - FunctionInfo{3, nullptr, "ListOpenUsers"}, - FunctionInfo{4, nullptr, "GetLastOpenedUser"}, - FunctionInfo{5, nullptr, "GetProfile"}, - FunctionInfo{6, nullptr, "GetProfileDigest"}, - FunctionInfo{50, nullptr, "IsUserRegistrationRequestPermitted"}, - FunctionInfo{51, nullptr, "TrySelectUserWithoutInteractionDeprecated"}, - FunctionInfo{99, nullptr, "DebugActivateOpenContextRetention"}, - FunctionInfo{100, nullptr, "GetUserRegistrationNotifier"}, - FunctionInfo{101, nullptr, "GetUserStateChangeNotifier"}, - FunctionInfo{102, nullptr, "GetBaasAccountManagerForSystemService"}, - FunctionInfo{103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, - FunctionInfo{104, nullptr, "GetProfileUpdateNotifier"}, - FunctionInfo{105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, - FunctionInfo{106, nullptr, "GetProfileSyncNotifier"}, - FunctionInfo{110, nullptr, "StoreSaveDataThumbnail"}, - FunctionInfo{111, nullptr, "ClearSaveDataThumbnail"}, - FunctionInfo{112, nullptr, "LoadSaveDataThumbnail"}, - FunctionInfo{113, nullptr, "GetSaveDataThumbnailExistence"}, - FunctionInfo{120, nullptr, "ListOpenUsersInApplication"}, - FunctionInfo{130, nullptr, "ActivateOpenContextRetention"}, - FunctionInfo{140, nullptr, "ListQualifiedUsers"}, - FunctionInfo{151, nullptr, "EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync"}, - FunctionInfo{152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"}, - FunctionInfo{170, nullptr, "GetNasOp2MembershipStateChangeNotifier"}, - FunctionInfo{191, nullptr, "UpdateNotificationReceiverInfo"}, - FunctionInfo{997, nullptr, "DebugInvalidateTokenCacheForUser"}, - FunctionInfo{998, nullptr, "DebugSetUserStateClose"}, - FunctionInfo{999, nullptr, "DebugSetUserStateOpen"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:e:u1") { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetUserCount"}, + {1, nullptr, "GetUserExistence"}, + {2, nullptr, "ListAllUsers"}, + {3, nullptr, "ListOpenUsers"}, + {4, nullptr, "GetLastOpenedUser"}, + {5, nullptr, "GetProfile"}, + {6, nullptr, "GetProfileDigest"}, + {50, nullptr, "IsUserRegistrationRequestPermitted"}, + {51, nullptr, "TrySelectUserWithoutInteractionDeprecated"}, + {99, nullptr, "DebugActivateOpenContextRetention"}, + {100, nullptr, "GetUserRegistrationNotifier"}, + {101, nullptr, "GetUserStateChangeNotifier"}, + {102, nullptr, "GetBaasAccountManagerForSystemService"}, + {103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, + {104, nullptr, "GetProfileUpdateNotifier"}, + {105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, + {106, nullptr, "GetProfileSyncNotifier"}, + {110, nullptr, "StoreSaveDataThumbnail"}, + {111, nullptr, "ClearSaveDataThumbnail"}, + {112, nullptr, "LoadSaveDataThumbnail"}, + {113, nullptr, "GetSaveDataThumbnailExistence"}, + {120, nullptr, "ListOpenUsersInApplication"}, + {130, nullptr, "ActivateOpenContextRetention"}, + {140, nullptr, "ListQualifiedUsers"}, + {151, nullptr, "EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync"}, + {152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"}, + {170, nullptr, "GetNasOp2MembershipStateChangeNotifier"}, + {191, nullptr, "UpdateNotificationReceiverInfo"}, + {997, nullptr, "DebugInvalidateTokenCacheForUser"}, + {998, nullptr, "DebugSetUserStateClose"}, + {999, nullptr, "DebugSetUserStateOpen"}, + }; + // clang-format on + RegisterHandlers(functions); } }; class ACC_E_U2 final : public Module::Interface { public: explicit ACC_E_U2(std::shared_ptr module_, std::shared_ptr profile_manager_, Core::System& system_) - : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:e:u2") {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetUserCount"}, - FunctionInfo{1, nullptr, "GetUserExistence"}, - FunctionInfo{2, nullptr, "ListAllUsers"}, - FunctionInfo{3, nullptr, "ListOpenUsers"}, - FunctionInfo{4, nullptr, "GetLastOpenedUser"}, - FunctionInfo{5, nullptr, "GetProfile"}, - FunctionInfo{6, nullptr, "GetProfileDigest"}, - FunctionInfo{50, nullptr, "IsUserRegistrationRequestPermitted"}, - FunctionInfo{51, nullptr, "TrySelectUserWithoutInteractionDeprecated"}, - FunctionInfo{52, nullptr, "TrySelectUserWithoutInteraction"}, - FunctionInfo{99, nullptr, "DebugActivateOpenContextRetention"}, - FunctionInfo{100, nullptr, "GetUserRegistrationNotifier"}, - FunctionInfo{101, nullptr, "GetUserStateChangeNotifier"}, - FunctionInfo{102, nullptr, "GetBaasAccountManagerForSystemService"}, - FunctionInfo{103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, - FunctionInfo{104, nullptr, "GetProfileUpdateNotifier"}, - FunctionInfo{105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, - FunctionInfo{106, nullptr, "GetProfileSyncNotifier"}, - FunctionInfo{110, nullptr, "StoreSaveDataThumbnail"}, - FunctionInfo{111, nullptr, "ClearSaveDataThumbnail"}, - FunctionInfo{112, nullptr, "LoadSaveDataThumbnail"}, - FunctionInfo{113, nullptr, "GetSaveDataThumbnailExistence"}, - FunctionInfo{120, nullptr, "ListOpenUsersInApplication"}, - FunctionInfo{130, nullptr, "ActivateOpenContextRetention"}, - FunctionInfo{140, nullptr, "ListQualifiedUsers"}, - FunctionInfo{151, nullptr, "EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync"}, - FunctionInfo{152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"}, - FunctionInfo{170, nullptr, "GetNasOp2MembershipStateChangeNotifier"}, - FunctionInfo{191, nullptr, "UpdateNotificationReceiverInfo"}, - FunctionInfo{205, nullptr, "GetProfileEditor"}, - FunctionInfo{401, nullptr, "GetPinCodeLength"}, - FunctionInfo{402, nullptr, "GetPinCode"}, - FunctionInfo{403, nullptr, "GetPinCodeParity"}, - FunctionInfo{404, nullptr, "VerifyPinCode"}, - FunctionInfo{405, nullptr, "IsPinCodeVerificationForbidden"}, - FunctionInfo{997, nullptr, "DebugInvalidateTokenCacheForUser"}, - FunctionInfo{998, nullptr, "DebugSetUserStateClose"}, - FunctionInfo{999, nullptr, "DebugSetUserStateOpen"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:e:u2") { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetUserCount"}, + {1, nullptr, "GetUserExistence"}, + {2, nullptr, "ListAllUsers"}, + {3, nullptr, "ListOpenUsers"}, + {4, nullptr, "GetLastOpenedUser"}, + {5, nullptr, "GetProfile"}, + {6, nullptr, "GetProfileDigest"}, + {50, nullptr, "#IsUserRegistrationRequestPermitted"}, + {51, nullptr, "TrySelectUserWithoutInteractionDeprecated"}, + {52, nullptr, "TrySelectUserWithoutInteraction"}, + {99, nullptr, "DebugActivateOpenContextRetention"}, + {100, nullptr, "GetUserRegistrationNotifier"}, + {101, nullptr, "GetUserStateChangeNotifier"}, + {102, nullptr, "GetBaasAccountManagerForSystemService"}, + {103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, + {104, nullptr, "GetProfileUpdateNotifier"}, + {105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, + {106, nullptr, "GetProfileSyncNotifier"}, + {110, nullptr, "StoreSaveDataThumbnail"}, + {111, nullptr, "ClearSaveDataThumbnail"}, + {112, nullptr, "LoadSaveDataThumbnail"}, + {113, nullptr, "GetSaveDataThumbnailExistence"}, + {120, nullptr, "ListOpenUsersInApplication"}, + {130, nullptr, "ActivateOpenContextRetention"}, + {140, nullptr, "ListQualifiedUsers"}, + {151, nullptr, "EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync"}, + {152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"}, + {170, nullptr, "GetNasOp2MembershipStateChangeNotifier"}, + {191, nullptr, "UpdateNotificationReceiverInfo"}, + {205, nullptr, "GetProfileEditor"}, + {401, nullptr, "GetPinCodeLength"}, + {402, nullptr, "GetPinCode"}, + {403, nullptr, "GetPinCodeParity"}, + {404, nullptr, "VerifyPinCode"}, + {405, nullptr, "IsPinCodeVerificationForbidden"}, + {997, nullptr, "DebugInvalidateTokenCacheForUser"}, + {998, nullptr, "DebugSetUserStateClose"}, + {999, nullptr, "DebugSetUserStateOpen"}, + }; + // clang-format on + RegisterHandlers(functions); } }; diff --git a/src/core/hle/service/acc/acc.h b/src/core/hle/service/acc/acc.h index 9c2c96acdb..19af7c74c9 100644 --- a/src/core/hle/service/acc/acc.h +++ b/src/core/hle/service/acc/acc.h @@ -14,6 +14,70 @@ namespace Service::Account { class ProfileManager; +class Module final { +public: + class Interface : public ServiceFramework { + public: + explicit Interface(std::shared_ptr module_, + std::shared_ptr profile_manager_, Core::System& system_, + const char* name); + ~Interface() override; + + void GetUserCount(HLERequestContext& ctx); + void GetUserExistence(HLERequestContext& ctx); + void ListAllUsers(HLERequestContext& ctx); + void ListOpenUsers(HLERequestContext& ctx); + void GetLastOpenedUser(HLERequestContext& ctx); + void GetProfile(HLERequestContext& ctx); + void InitializeApplicationInfo(HLERequestContext& ctx); + void InitializeApplicationInfoRestricted(HLERequestContext& ctx); + void GetBaasAccountManagerForApplication(HLERequestContext& ctx); + void IsUserRegistrationRequestPermitted(HLERequestContext& ctx); + void TrySelectUserWithoutInteractionDeprecated(HLERequestContext& ctx); + void TrySelectUserWithoutInteraction(HLERequestContext& ctx); + void IsUserAccountSwitchLocked(HLERequestContext& ctx); + void InitializeApplicationInfoV2(HLERequestContext& ctx); + void BeginUserRegistration(HLERequestContext& ctx); + void CompleteUserRegistration(HLERequestContext& ctx); + void DeleteUser(HLERequestContext& ctx); + void SetUserPosition(HLERequestContext& ctx); + void GetProfileEditor(HLERequestContext& ctx); + void GetBaasAccountAdministrator(HLERequestContext &ctx); + void ListQualifiedUsers(HLERequestContext& ctx); + void ListOpenContextStoredUsers(HLERequestContext& ctx); + void StoreSaveDataThumbnailApplication(HLERequestContext& ctx); + void GetBaasAccountManagerForSystemService(HLERequestContext& ctx); + void StoreSaveDataThumbnailSystem(HLERequestContext& ctx); + void GetPinCodeLength(HLERequestContext& ctx); + + private: + Result InitializeApplicationInfoBase(); + void StoreSaveDataThumbnail(HLERequestContext& ctx, const Common::UUID& uuid, + const u64 tid); + + enum class ApplicationType : u32_le { + GameCard = 0, + Digital = 1, + Unknown = 3, + }; + + struct ApplicationInfo { + Service::Glue::ApplicationLaunchProperty launch_property; + ApplicationType application_type; + + constexpr explicit operator bool() const { + return launch_property.title_id != 0x0; + } + }; + + ApplicationInfo application_info{}; + + protected: + std::shared_ptr module; + std::shared_ptr profile_manager; + }; +}; + void LoopProcess(Core::System& system); } // namespace Service::Account diff --git a/src/core/hle/service/acc/async_context.cpp b/src/core/hle/service/acc/async_context.cpp index a7f751d756..8dec886ad7 100644 --- a/src/core/hle/service/acc/async_context.cpp +++ b/src/core/hle/service/acc/async_context.cpp @@ -12,6 +12,17 @@ namespace Service::Account { IAsyncContext::IAsyncContext(Core::System& system_) : ServiceFramework{system_, "IAsyncContext"}, service_context{system_, "IAsyncContext"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &IAsyncContext::GetSystemEvent, "GetSystemEvent"}, + {1, &IAsyncContext::Cancel, "Cancel"}, + {2, &IAsyncContext::HasDone, "HasDone"}, + {3, &IAsyncContext::GetResult, "GetResult"}, + }; + // clang-format on + + RegisterHandlers(functions); + completion_event = service_context.CreateEvent("IAsyncContext:CompletionEvent"); } diff --git a/src/core/hle/service/acc/async_context.h b/src/core/hle/service/acc/async_context.h index 0137567d11..c50537d4ae 100644 --- a/src/core/hle/service/acc/async_context.h +++ b/src/core/hle/service/acc/async_context.h @@ -33,16 +33,6 @@ protected: void MarkComplete(); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &IAsyncContext::GetSystemEvent, "GetSystemEvent"}, - FunctionInfo{1, &IAsyncContext::Cancel, "Cancel"}, - FunctionInfo{2, &IAsyncContext::HasDone, "HasDone"}, - FunctionInfo{3, &IAsyncContext::GetResult, "GetResult"} - ); - KernelHelpers::ServiceContext service_context; std::atomic is_complete{false}; diff --git a/src/core/hle/service/acc/errors.h b/src/core/hle/service/acc/errors.h index 433ebfe9d6..b7cf8b5f93 100644 --- a/src/core/hle/service/acc/errors.h +++ b/src/core/hle/service/acc/errors.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 472be8f0f0..86d9d52e34 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -4,1340 +4,16 @@ // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "common/settings.h" -#include "core/core.h" -#include "core/file_sys/common_funcs.h" -#include "core/file_sys/patch_manager.h" -#include "core/file_sys/romfs_factory.h" -#include "core/file_sys/control_metadata.h" -#include "core/hle/api_version.h" -#include "core/hle/kernel/k_transfer_memory.h" -#include "core/hle/service/server_manager.h" -#include "core/hle/service/am/applet_manager.h" -#include "core/hle/service/am/window_system.h" #include "core/hle/service/am/am.h" #include "core/hle/service/am/button_poller.h" #include "core/hle/service/am/event_observer.h" -#include "core/hle/service/am/service/application_creator.h" -#include "core/hle/service/am/service/audio_controller.h" -#include "core/hle/service/am/service/common_state_getter.h" -#include "core/hle/service/am/service/display_controller.h" -#include "core/hle/service/am/service/global_state_controller.h" -#include "core/hle/service/am/service/home_menu_functions.h" -#include "core/hle/service/am/service/process_winding_controller.h" -#include "core/hle/service/am/service/self_controller.h" -#include "core/hle/service/am/service/window_controller.h" -#include "core/hle/service/am/service/application_functions.h" -#include "core/hle/service/am/applet_data_broker.h" -#include "core/hle/service/am/frontend/applets.h" -#include "core/hle/service/am/library_applet_storage.h" -#include "core/hle/service/am/process_creation.h" -#include "core/hle/service/am/service/library_applet_accessor.h" -#include "core/hle/service/am/service/overlay_functions.h" -#include "core/hle/service/am/service/storage.h" -#include "core/hle/service/ns/language.h" -#include "core/hle/service/ns/application_manager_interface.h" -#include "core/hle/service/ns/service_getter_interface.h" -#include "core/hle/service/glue/glue_manager.h" -#include "core/hle/service/sm/sm.h" -#include "core/hle/service/acc/profile_manager.h" -#include "core/hle/service/am/frontend/applet_profile_select.h" -#include "core/hle/service/cmif_serialization.h" +#include "core/hle/service/am/service/all_system_applet_proxies_service.h" +#include "core/hle/service/am/service/application_proxy_service.h" +#include "core/hle/service/am/window_system.h" +#include "core/hle/service/server_manager.h" namespace Service::AM { -struct Applet; -class IAppletCommonFunctions; -class IApplicationCreator; -class IAudioController; -class ICommonStateGetter; -class IDebugFunctions; -class IDisplayController; -class IHomeMenuFunctions; -class IGlobalStateController; -class ILibraryAppletCreator; -class IProcessWindingController; -class ISelfController; -class IWindowController; -class WindowSystem; - -class IDebugFunctions final : public ServiceFramework { -public: - explicit IDebugFunctions(Core::System& system_) : ServiceFramework{system_, "IDebugFunctions"} {} - ~IDebugFunctions() override = default; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "NotifyMessageToHomeMenuForDebug"}, - FunctionInfo{1, nullptr, "OpenMainApplication"}, - FunctionInfo{10, nullptr, "PerformSystemButtonPressing"}, - FunctionInfo{20, nullptr, "InvalidateTransitionLayer"}, - FunctionInfo{30, nullptr, "RequestLaunchApplicationWithUserAndArgumentForDebug"}, - FunctionInfo{31, nullptr, "RequestLaunchApplicationByApplicationLaunchInfoForDebug"}, - FunctionInfo{40, nullptr, "GetAppletResourceUsageInfo"}, - FunctionInfo{50, nullptr, "AddSystemProgramIdAndAppletIdForDebug"}, - FunctionInfo{51, nullptr, "AddOperationConfirmedLibraryAppletIdForDebug"}, - FunctionInfo{100, nullptr, "SetCpuBoostModeForApplet"}, - FunctionInfo{101, nullptr, "CancelCpuBoostModeForApplet"}, - FunctionInfo{110, nullptr, "PushToAppletBoundChannelForDebug"}, - FunctionInfo{111, nullptr, "TryPopFromAppletBoundChannelForDebug"}, - FunctionInfo{120, nullptr, "AlarmSettingNotificationEnableAppEventReserve"}, - FunctionInfo{121, nullptr, "AlarmSettingNotificationDisableAppEventReserve"}, - FunctionInfo{122, nullptr, "AlarmSettingNotificationPushAppEventNotify"}, - FunctionInfo{130, nullptr, "FriendInvitationSetApplicationParameter"}, - FunctionInfo{131, nullptr, "FriendInvitationClearApplicationParameter"}, - FunctionInfo{132, nullptr, "FriendInvitationPushApplicationParameter"}, - FunctionInfo{140, nullptr, "RestrictPowerOperationForSecureLaunchModeForDebug"}, - FunctionInfo{200, nullptr, "CreateFloatingLibraryAppletAccepterForDebug"}, - FunctionInfo{300, nullptr, "TerminateAllRunningApplicationsForDebug"}, - FunctionInfo{900, nullptr, "GetGrcProcessLaunchedSystemEvent"} - ); -}; - -class IApplicationProxy final : public ServiceFramework { -public: - explicit IApplicationProxy(Core::System& system_, std::shared_ptr applet, - Kernel::KProcess* process, WindowSystem& window_system) - : ServiceFramework{system_, "IApplicationProxy"}, - m_window_system{window_system}, m_process{process}, m_applet{std::move(applet)} { - } - - ~IApplicationProxy() override = default; - - Result GetAudioController( - Out> out_audio_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_audio_controller = std::make_shared(system); - R_SUCCEED(); - } - - Result GetDisplayController( - Out> out_display_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_display_controller = std::make_shared(system, m_applet); - R_SUCCEED(); - } - - Result GetProcessWindingController( - Out> out_process_winding_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_process_winding_controller = std::make_shared(system, m_applet); - R_SUCCEED(); - } - - Result GetDebugFunctions( - Out> out_debug_functions) { - LOG_DEBUG(Service_AM, "called"); - *out_debug_functions = std::make_shared(system); - R_SUCCEED(); - } - - Result GetWindowController( - Out> out_window_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_window_controller = std::make_shared(system, m_applet, m_window_system); - R_SUCCEED(); - } - - Result GetSelfController( - Out> out_self_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_self_controller = std::make_shared(system, m_applet, m_process); - R_SUCCEED(); - } - - Result GetCommonStateGetter( - Out> out_common_state_getter) { - LOG_DEBUG(Service_AM, "called"); - *out_common_state_getter = std::make_shared(system, m_applet); - R_SUCCEED(); - } - - Result GetLibraryAppletCreator( - Out> out_library_applet_creator) { - LOG_DEBUG(Service_AM, "called"); - *out_library_applet_creator = - std::make_shared(system, m_applet, m_window_system); - R_SUCCEED(); - } - - Result GetApplicationFunctions( - Out> out_application_functions) { - LOG_DEBUG(Service_AM, "called"); - *out_application_functions = std::make_shared(system, m_applet); - R_SUCCEED(); - } - -private: - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IApplicationProxy::GetCommonStateGetter>, "GetCommonStateGetter"}, - FunctionInfo{1, D<&IApplicationProxy::GetSelfController>, "GetSelfController"}, - FunctionInfo{2, D<&IApplicationProxy::GetWindowController>, "GetWindowController"}, - FunctionInfo{3, D<&IApplicationProxy::GetAudioController>, "GetAudioController"}, - FunctionInfo{4, D<&IApplicationProxy::GetDisplayController>, "GetDisplayController"}, - FunctionInfo{10, D<&IApplicationProxy::GetProcessWindingController>, "GetProcessWindingController"}, - FunctionInfo{11, D<&IApplicationProxy::GetLibraryAppletCreator>, "GetLibraryAppletCreator"}, - FunctionInfo{20, D<&IApplicationProxy::GetApplicationFunctions>, "GetApplicationFunctions"}, - FunctionInfo{1000, D<&IApplicationProxy::GetDebugFunctions>, "GetDebugFunctions"} - ); - WindowSystem& m_window_system; - Kernel::KProcess* const m_process; - const std::shared_ptr m_applet; -}; - -class IApplicationProxyService final : public ServiceFramework { -public: - explicit IApplicationProxyService(Core::System& system_, - WindowSystem& window_system) - : ServiceFramework{system_, "appletOE"}, m_window_system{window_system} { - } - - ~IApplicationProxyService() override = default; - - Result OpenApplicationProxy( - Out> out_application_proxy, ClientProcessId pid, - InCopyHandle process_handle) { - LOG_DEBUG(Service_AM, "called"); - - if (const auto applet = this->GetAppletFromProcessId(pid)) { - *out_application_proxy = std::make_shared( - system, applet, process_handle.Get(), m_window_system); - R_SUCCEED(); - } else { - UNIMPLEMENTED(); - R_THROW(ResultUnknown); - } - } - - std::shared_ptr GetAppletFromProcessId(ProcessId process_id) { - return m_window_system.GetByAppletResourceUserId(process_id.pid); - } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IApplicationProxyService::OpenApplicationProxy>, "OpenApplicationProxy"} - ); - WindowSystem& m_window_system; -}; - -class IAppletCommonFunctions final : public ServiceFramework { -public: - explicit IAppletCommonFunctions(Core::System& system_, std::shared_ptr applet_) : ServiceFramework{system_, "IAppletCommonFunctions"}, applet{std::move(applet_)} {} - ~IAppletCommonFunctions() override = default; - - Result SetHomeButtonDoubleClickEnabled( - bool home_button_double_click_enabled) { - LOG_WARNING(Service_AM, "(STUBBED) called, home_button_double_click_enabled={}", home_button_double_click_enabled); - R_SUCCEED(); - } - - Result GetHomeButtonDoubleClickEnabled( - Out out_home_button_double_click_enabled) { - LOG_WARNING(Service_AM, "(STUBBED) called"); - *out_home_button_double_click_enabled = false; - R_SUCCEED(); - } - - Result SetDisplayMagnification(f32 x, f32 y, f32 width, f32 height) { - LOG_DEBUG(Service_AM, "(STUBBED) called, x={}, y={}, width={}, height={}", x, y, width, height); - std::scoped_lock lk{applet->lock}; - applet->display_magnification = Common::Rectangle{x, y, x + width, y + height}; - R_SUCCEED(); - } - - Result SetCpuBoostRequestPriority(s32 priority) { - LOG_WARNING(Service_AM, "(STUBBED) called"); - std::scoped_lock lk{applet->lock}; - applet->cpu_boost_request_priority = priority; - R_SUCCEED(); - } - - Result GetCurrentApplicationId(Out out_application_id) { - LOG_WARNING(Service_AM, "(STUBBED) called"); - *out_application_id = FileSys::GetBaseTitleID(system.GetApplicationProcessProgramID()); - R_SUCCEED(); - } - - Result SetGpuTimeSliceBoost(s64 time_span) { - LOG_WARNING(Service_AM, "(STUBBED) called, time_span={}", time_span); - R_SUCCEED(); - } - - Result Unknown350(Out out_unknown) { - LOG_WARNING(Service_AM, "(STUBBED) called"); - *out_unknown = 0; - R_SUCCEED(); - } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "SetTerminateResult"}, - FunctionInfo{10, nullptr, "ReadThemeStorage"}, - FunctionInfo{11, nullptr, "WriteThemeStorage"}, - FunctionInfo{20, nullptr, "PushToAppletBoundChannel"}, - FunctionInfo{21, nullptr, "TryPopFromAppletBoundChannel"}, - FunctionInfo{40, nullptr, "GetDisplayLogicalResolution"}, - FunctionInfo{42, D<&IAppletCommonFunctions::SetDisplayMagnification>, "SetDisplayMagnification"}, - FunctionInfo{50, D<&IAppletCommonFunctions::SetHomeButtonDoubleClickEnabled>, "SetHomeButtonDoubleClickEnabled"}, - FunctionInfo{51, D<&IAppletCommonFunctions::GetHomeButtonDoubleClickEnabled>, "GetHomeButtonDoubleClickEnabled"}, - FunctionInfo{52, nullptr, "IsHomeButtonShortPressedBlocked"}, - FunctionInfo{60, nullptr, "IsVrModeCurtainRequired"}, - FunctionInfo{61, nullptr, "IsSleepRequiredByHighTemperature"}, - FunctionInfo{62, nullptr, "IsSleepRequiredByLowBattery"}, - FunctionInfo{70, D<&IAppletCommonFunctions::SetCpuBoostRequestPriority>, "SetCpuBoostRequestPriority"}, - FunctionInfo{80, nullptr, "SetHandlingCaptureButtonShortPressedMessageEnabledForApplet"}, - FunctionInfo{81, nullptr, "SetHandlingCaptureButtonLongPressedMessageEnabledForApplet"}, - FunctionInfo{90, nullptr, "OpenNamedChannelAsParent"}, - FunctionInfo{91, nullptr, "OpenNamedChannelAsChild"}, - FunctionInfo{100, nullptr, "SetApplicationCoreUsageMode"}, - FunctionInfo{300, D<&IAppletCommonFunctions::GetCurrentApplicationId>, "GetCurrentApplicationId"}, - FunctionInfo{310, nullptr, "IsSystemAppletHomeMenu", MakeVersionGate({19,0,0})}, - FunctionInfo{320, D<&IAppletCommonFunctions::SetGpuTimeSliceBoost>, "SetGpuTimeSliceBoost", MakeVersionGate({19,0,0})}, - FunctionInfo{321, nullptr, "SetGpuTimeSliceBoostDueToApplication", MakeVersionGate({19,0,0})}, - FunctionInfo{350, D<&IAppletCommonFunctions::Unknown350>, "Unknown350", MakeVersionGate({20,0,0})} - ); - const std::shared_ptr applet; -}; - -class ISystemAppletProxy final : public ServiceFramework { -public: - explicit ISystemAppletProxy(Core::System& system_, std::shared_ptr applet, Kernel::KProcess* process, WindowSystem& window_system) - : ServiceFramework{system_, "ISystemAppletProxy"}, - m_window_system{window_system}, m_process{process}, m_applet{std::move(applet)} { - } - - ~ISystemAppletProxy() override = default; - - Result GetAudioController( - Out> out_audio_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_audio_controller = std::make_shared(system); - R_SUCCEED(); - } - - Result GetDisplayController( - Out> out_display_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_display_controller = std::make_shared(system, m_applet); - R_SUCCEED(); - } - - Result GetProcessWindingController( - Out> out_process_winding_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_process_winding_controller = std::make_shared(system, m_applet); - R_SUCCEED(); - } - - Result GetDebugFunctions( - Out> out_debug_functions) { - LOG_DEBUG(Service_AM, "called"); - *out_debug_functions = std::make_shared(system); - R_SUCCEED(); - } - - Result GetWindowController( - Out> out_window_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_window_controller = std::make_shared(system, m_applet, m_window_system); - R_SUCCEED(); - } - - Result GetSelfController( - Out> out_self_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_self_controller = std::make_shared(system, m_applet, m_process); - R_SUCCEED(); - } - - Result GetCommonStateGetter( - Out> out_common_state_getter) { - LOG_DEBUG(Service_AM, "called"); - *out_common_state_getter = std::make_shared(system, m_applet); - R_SUCCEED(); - } - - Result GetLibraryAppletCreator( - Out> out_library_applet_creator) { - LOG_DEBUG(Service_AM, "called"); - *out_library_applet_creator = - std::make_shared(system, m_applet, m_window_system); - R_SUCCEED(); - } - - Result GetApplicationCreator( - Out> out_application_creator) { - LOG_DEBUG(Service_AM, "called"); - *out_application_creator = std::make_shared(system, m_window_system); - R_SUCCEED(); - } - - Result GetAppletCommonFunctions( - Out> out_applet_common_functions) { - LOG_DEBUG(Service_AM, "called"); - *out_applet_common_functions = std::make_shared(system, m_applet); - R_SUCCEED(); - } - - Result GetHomeMenuFunctions( - Out> out_home_menu_functions) { - LOG_DEBUG(Service_AM, "called"); - *out_home_menu_functions = - std::make_shared(system, m_applet, m_window_system); - R_SUCCEED(); - } - - Result GetGlobalStateController( - Out> out_global_state_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_global_state_controller = std::make_shared(system); - R_SUCCEED(); - } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&ISystemAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"}, - FunctionInfo{1, D<&ISystemAppletProxy::GetSelfController>, "GetSelfController"}, - FunctionInfo{2, D<&ISystemAppletProxy::GetWindowController>, "GetWindowController"}, - FunctionInfo{3, D<&ISystemAppletProxy::GetAudioController>, "GetAudioController"}, - FunctionInfo{4, D<&ISystemAppletProxy::GetDisplayController>, "GetDisplayController"}, - FunctionInfo{10, D<&ISystemAppletProxy::GetProcessWindingController>, "GetProcessWindingController"}, - FunctionInfo{11, D<&ISystemAppletProxy::GetLibraryAppletCreator>, "GetLibraryAppletCreator"}, - FunctionInfo{20, D<&ISystemAppletProxy::GetHomeMenuFunctions>, "GetHomeMenuFunctions"}, - FunctionInfo{21, D<&ISystemAppletProxy::GetGlobalStateController>, "GetGlobalStateController"}, - FunctionInfo{22, D<&ISystemAppletProxy::GetApplicationCreator>, "GetApplicationCreator"}, - FunctionInfo{23, D<&ISystemAppletProxy::GetAppletCommonFunctions>, "GetAppletCommonFunctions"}, - FunctionInfo{1000, D<&ISystemAppletProxy::GetDebugFunctions>, "GetDebugFunctions"} - ); - WindowSystem& m_window_system; - Kernel::KProcess* const m_process; - const std::shared_ptr m_applet; -}; - -static AppletIdentityInfo GetCallerIdentity(Applet& applet) { - if (const auto caller_applet = applet.caller_applet.lock(); caller_applet) { - // TODO: is this actually the application ID? - return { - .applet_id = caller_applet->applet_id, - .application_id = caller_applet->program_id, - }; - } else { - return { - .applet_id = AppletId::QLaunch, - .application_id = 0x0100000000001000ull, - }; - } -} - -class ILibraryAppletSelfAccessor final : public ServiceFramework { -public: - ILibraryAppletSelfAccessor(Core::System& system_, - std::shared_ptr applet) - : ServiceFramework{system_, "ILibraryAppletSelfAccessor"}, m_applet{std::move(applet)}, - m_broker{m_applet->caller_applet_broker} { - } - - ~ILibraryAppletSelfAccessor() = default; - - Result PopInData(Out> out_storage) { - LOG_INFO(Service_AM, "called"); - R_RETURN(m_broker->GetInData().Pop(system.Kernel(), out_storage)); - } - - Result PushOutData(SharedPointer storage) { - LOG_INFO(Service_AM, "called"); - m_broker->GetOutData().Push(system.Kernel(), storage); - R_SUCCEED(); - } - - Result PopInteractiveInData(Out> out_storage) { - LOG_INFO(Service_AM, "called"); - R_RETURN(m_broker->GetInteractiveInData().Pop(system.Kernel(), out_storage)); - } - - Result PushInteractiveOutData(SharedPointer storage) { - LOG_INFO(Service_AM, "called"); - m_broker->GetInteractiveOutData().Push(system.Kernel(), storage); - R_SUCCEED(); - } - - Result GetPopInDataEvent( - OutCopyHandle out_event) { - LOG_INFO(Service_AM, "called"); - *out_event = m_broker->GetInData().GetEvent(); - R_SUCCEED(); - } - - Result GetPopInteractiveInDataEvent( - OutCopyHandle out_event) { - LOG_INFO(Service_AM, "called"); - *out_event = m_broker->GetInteractiveInData().GetEvent(); - R_SUCCEED(); - } - - Result GetLibraryAppletInfo( - Out out_library_applet_info) { - LOG_INFO(Service_AM, "called"); - *out_library_applet_info = { - .applet_id = m_applet->applet_id, - .library_applet_mode = m_applet->library_applet_mode, - }; - R_SUCCEED(); - } - - Result GetMainAppletIdentityInfo( - Out out_identity_info) { - LOG_WARNING(Service_AM, "(STUBBED) called"); - *out_identity_info = { - .applet_id = AppletId::QLaunch, - .application_id = 0x0100000000001000ull, - }; - R_SUCCEED(); - } - - Result CanUseApplicationCore(Out out_can_use_application_core) { - // TODO: This appears to read the NPDM from state and check the core mask of the applet. - LOG_WARNING(Service_AM, "(STUBBED) called"); - *out_can_use_application_core = false; - R_SUCCEED(); - } - - Result GetMainAppletApplicationControlProperty( - OutLargeData, BufferAttr_HipcMapAlias> out_nacp) { - LOG_WARNING(Service_AM, "(STUBBED) called"); - - // TODO: this should be the main applet, not the caller applet - const auto application = GetCallerIdentity(*m_applet); - std::vector nacp; - const auto result = - system.GetARPManager().GetControlProperty(&nacp, application.application_id); - - if (R_SUCCEEDED(result)) { - std::memcpy(out_nacp->data(), nacp.data(), (std::min)(nacp.size(), out_nacp->size())); - } - - R_RETURN(result); - } - - Result GetMainAppletStorageId(Out out_storage_id) { - LOG_INFO(Service_AM, "(STUBBED) called"); - *out_storage_id = FileSys::StorageId::NandUser; - R_SUCCEED(); - } - - Result ExitProcessAndReturn() { - LOG_INFO(Service_AM, "called"); - - if (const auto caller_applet = m_applet->caller_applet.lock(); caller_applet) { - m_applet->process->Terminate(); - } else { - system.GetUserChannel() = m_applet->user_channel_launch_parameter; - system.ExecuteProgram(0); - } - - R_SUCCEED(); - } - - Result GetCallerAppletIdentityInfo( - Out out_identity_info) { - LOG_INFO(Service_AM, "called"); - *out_identity_info = GetCallerIdentity(*m_applet); - R_SUCCEED(); - } - - Result GetCallerAppletIdentityInfoStack( - Out out_count, OutArray out_identity_info) { - LOG_INFO(Service_AM, "called"); - - std::shared_ptr applet = m_applet; - *out_count = 0; - - do { - if (*out_count >= static_cast(out_identity_info.size())) { - break; - } - out_identity_info[(*out_count)++] = GetCallerIdentity(*applet); - } while ((applet = applet->caller_applet.lock())); - - R_SUCCEED(); - } - - Result GetDesirableKeyboardLayout(Out out_desirable_layout) { - LOG_WARNING(Service_AM, "(STUBBED) called"); - *out_desirable_layout = 0; - R_SUCCEED(); - } - - Result ReportVisibleError(ErrorCode error_code) { - LOG_WARNING(Service_AM, "(STUBBED) called, error {}-{}", error_code.category, - error_code.number); - R_SUCCEED(); - } - - Result ReportVisibleErrorWithErrorContext( - ErrorCode error_code, InLargeData error_context) { - LOG_WARNING(Service_AM, "(STUBBED) called, error {}-{}", error_code.category, - error_code.number); - R_SUCCEED(); - } - - Result UnpopInData(SharedPointer storage) { - LOG_INFO(Service_AM, "called"); - m_broker->GetInData().Unpop(system.Kernel(), storage); - R_SUCCEED(); - } - - Result GetMainAppletApplicationDesiredLanguage( - Out out_desired_language) { - // FIXME: this is copied from IApplicationFunctions::GetDesiredLanguage - // FIXME: all of this stuff belongs to ns - auto identity = GetCallerIdentity(*m_applet); - - // TODO(bunnei): This should be configurable - LOG_DEBUG(Service_AM, "called"); - - // Get supported languages from NACP, if possible - // Default to 0 (all languages supported) - u32 supported_languages = 0; - - const auto res = FileSys::PatchManager::GetMetadataFromBaseOrUpdate(system, identity.application_id); - - if (res.first != nullptr) { - supported_languages = res.first->GetSupportedLanguages(); - } - - // Call IApplicationManagerInterface implementation. - auto& service_manager = system.ServiceManager(); - auto ns_am2 = service_manager.GetService("ns:am2"); - - std::shared_ptr app_man; - R_TRY(ns_am2->GetApplicationManagerInterface(&app_man)); - - // Get desired application language - NS::ApplicationLanguage desired_language{}; - R_TRY(app_man->GetApplicationDesiredLanguage(&desired_language, supported_languages)); - - // Convert to settings language code. - u64 language_code{}; - R_TRY(app_man->ConvertApplicationLanguageToLanguageCode(&language_code, desired_language)); - - LOG_DEBUG(Service_AM, "got desired_language={:016X}", language_code); - - *out_desired_language = language_code; - R_SUCCEED(); - } - - Result GetCurrentApplicationId(Out out_application_id) { - LOG_WARNING(Service_AM, "(STUBBED) called"); - - // TODO: this should be the main applet, not the caller applet - const auto main_applet = GetCallerIdentity(*m_applet); - *out_application_id = main_applet.application_id; - - R_SUCCEED(); - } - - Result GetMainAppletAvailableUsers( - Out out_can_select_any_user, Out out_users_count, - OutArray out_users) { - const Service::Account::ProfileManager manager{}; - - *out_can_select_any_user = false; - *out_users_count = -1; - - LOG_INFO(Service_AM, "called"); - - if (manager.GetUserCount() > 0) { - *out_can_select_any_user = true; - *out_users_count = static_cast(manager.GetUserCount()); - - const auto users = manager.GetAllUsers(); - for (size_t i = 0; i < users.size() && i < out_users.size(); i++) { - out_users[i] = users[i]; - } - } - - R_SUCCEED(); - } - - Result ShouldSetGpuTimeSliceManually( - Out out_should_set_gpu_time_slice_manually) { - LOG_INFO(Service_AM, "(STUBBED) called"); - *out_should_set_gpu_time_slice_manually = false; - R_SUCCEED(); - } - - Result GetLibraryAppletInfoEx( - Out out_library_applet_info) { - LOG_INFO(Service_AM, "called"); - *out_library_applet_info = { - .applet_id = m_applet->applet_id, - .library_applet_mode = m_applet->library_applet_mode, - }; - R_SUCCEED(); - } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&ILibraryAppletSelfAccessor::PopInData>, "PopInData"}, - FunctionInfo{1, D<&ILibraryAppletSelfAccessor::PushOutData>, "PushOutData"}, - FunctionInfo{2, D<&ILibraryAppletSelfAccessor::PopInteractiveInData>, "PopInteractiveInData"}, - FunctionInfo{3, D<&ILibraryAppletSelfAccessor::PushInteractiveOutData>, "PushInteractiveOutData"}, - FunctionInfo{5, D<&ILibraryAppletSelfAccessor::GetPopInDataEvent>, "GetPopInDataEvent"}, - FunctionInfo{6, D<&ILibraryAppletSelfAccessor::GetPopInteractiveInDataEvent>, "GetPopInteractiveInDataEvent"}, - FunctionInfo{10, D<&ILibraryAppletSelfAccessor::ExitProcessAndReturn>, "ExitProcessAndReturn"}, - FunctionInfo{11, D<&ILibraryAppletSelfAccessor::GetLibraryAppletInfo>, "GetLibraryAppletInfo"}, - FunctionInfo{12, D<&ILibraryAppletSelfAccessor::GetMainAppletIdentityInfo>, "GetMainAppletIdentityInfo"}, - FunctionInfo{13, D<&ILibraryAppletSelfAccessor::CanUseApplicationCore>, "CanUseApplicationCore"}, - FunctionInfo{14, D<&ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfo>, "GetCallerAppletIdentityInfo"}, - FunctionInfo{15, D<&ILibraryAppletSelfAccessor::GetMainAppletApplicationControlProperty>, "GetMainAppletApplicationControlProperty"}, - FunctionInfo{16, D<&ILibraryAppletSelfAccessor::GetMainAppletStorageId>, "GetMainAppletStorageId"}, - FunctionInfo{17, D<&ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfoStack>, "GetCallerAppletIdentityInfoStack"}, - FunctionInfo{18, nullptr, "GetNextReturnDestinationAppletIdentityInfo"}, - FunctionInfo{19, D<&ILibraryAppletSelfAccessor::GetDesirableKeyboardLayout>, "GetDesirableKeyboardLayout"}, - FunctionInfo{20, nullptr, "PopExtraStorage"}, - FunctionInfo{25, nullptr, "GetPopExtraStorageEvent"}, - FunctionInfo{30, D<&ILibraryAppletSelfAccessor::UnpopInData>, "UnpopInData"}, - FunctionInfo{31, nullptr, "UnpopExtraStorage"}, - FunctionInfo{40, nullptr, "GetIndirectLayerProducerHandle"}, - FunctionInfo{50, D<&ILibraryAppletSelfAccessor::ReportVisibleError>, "ReportVisibleError"}, - FunctionInfo{51, D<&ILibraryAppletSelfAccessor::ReportVisibleErrorWithErrorContext>, "ReportVisibleErrorWithErrorContext"}, - FunctionInfo{60, D<&ILibraryAppletSelfAccessor::GetMainAppletApplicationDesiredLanguage>, "GetMainAppletApplicationDesiredLanguage"}, - FunctionInfo{70, D<&ILibraryAppletSelfAccessor::GetCurrentApplicationId>, "GetCurrentApplicationId"}, - FunctionInfo{80, nullptr, "RequestExitToSelf"}, - FunctionInfo{90, nullptr, "CreateApplicationAndPushAndRequestToLaunch"}, - FunctionInfo{100, nullptr, "CreateGameMovieTrimmer"}, - FunctionInfo{101, nullptr, "ReserveResourceForMovieOperation"}, - FunctionInfo{102, nullptr, "UnreserveResourceForMovieOperation"}, - FunctionInfo{110, D<&ILibraryAppletSelfAccessor::GetMainAppletAvailableUsers>, "GetMainAppletAvailableUsers"}, - FunctionInfo{120, nullptr, "GetLaunchStorageInfoForDebug"}, - FunctionInfo{130, nullptr, "GetGpuErrorDetectedSystemEvent"}, - FunctionInfo{140, nullptr, "SetApplicationMemoryReservation"}, - FunctionInfo{150, D<&ILibraryAppletSelfAccessor::ShouldSetGpuTimeSliceManually>, "ShouldSetGpuTimeSliceManually"}, - FunctionInfo{160, D<&ILibraryAppletSelfAccessor::GetLibraryAppletInfoEx>, "GetLibraryAppletInfoEx"} - ); - const std::shared_ptr m_applet; - const std::shared_ptr m_broker; -}; - -class ILibraryAppletProxy final : public ServiceFramework { -public: - explicit ILibraryAppletProxy(Core::System& system_, std::shared_ptr applet, - Kernel::KProcess* process, WindowSystem& window_system) - : ServiceFramework{system_, "ILibraryAppletProxy"}, - m_window_system{window_system}, m_process{process}, m_applet{std::move(applet)} { - } - ~ILibraryAppletProxy() override = default; - - Result GetAudioController( - Out> out_audio_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_audio_controller = std::make_shared(system); - R_SUCCEED(); - } - - Result GetDisplayController( - Out> out_display_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_display_controller = std::make_shared(system, m_applet); - R_SUCCEED(); - } - - Result GetProcessWindingController( - Out> out_process_winding_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_process_winding_controller = std::make_shared(system, m_applet); - R_SUCCEED(); - } - - Result GetDebugFunctions( - Out> out_debug_functions) { - LOG_DEBUG(Service_AM, "called"); - *out_debug_functions = std::make_shared(system); - R_SUCCEED(); - } - - Result GetWindowController( - Out> out_window_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_window_controller = std::make_shared(system, m_applet, m_window_system); - R_SUCCEED(); - } - - Result GetSelfController( - Out> out_self_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_self_controller = std::make_shared(system, m_applet, m_process); - R_SUCCEED(); - } - - Result GetCommonStateGetter( - Out> out_common_state_getter) { - LOG_DEBUG(Service_AM, "called"); - *out_common_state_getter = std::make_shared(system, m_applet); - R_SUCCEED(); - } - - Result GetLibraryAppletCreator( - Out> out_library_applet_creator) { - LOG_DEBUG(Service_AM, "called"); - *out_library_applet_creator = - std::make_shared(system, m_applet, m_window_system); - R_SUCCEED(); - } - - Result OpenLibraryAppletSelfAccessor( - Out> out_library_applet_self_accessor) { - LOG_DEBUG(Service_AM, "called"); - *out_library_applet_self_accessor = - std::make_shared(system, m_applet); - R_SUCCEED(); - } - - Result GetAppletCommonFunctions( - Out> out_applet_common_functions) { - LOG_DEBUG(Service_AM, "called"); - *out_applet_common_functions = std::make_shared(system, m_applet); - R_SUCCEED(); - } - - Result GetHomeMenuFunctions( - Out> out_home_menu_functions) { - LOG_DEBUG(Service_AM, "called"); - *out_home_menu_functions = - std::make_shared(system, m_applet, m_window_system); - R_SUCCEED(); - } - - Result GetGlobalStateController( - Out> out_global_state_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_global_state_controller = std::make_shared(system); - R_SUCCEED(); - } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&ILibraryAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"}, - FunctionInfo{1, D<&ILibraryAppletProxy::GetSelfController>, "GetSelfController"}, - FunctionInfo{2, D<&ILibraryAppletProxy::GetWindowController>, "GetWindowController"}, - FunctionInfo{3, D<&ILibraryAppletProxy::GetAudioController>, "GetAudioController"}, - FunctionInfo{4, D<&ILibraryAppletProxy::GetDisplayController>, "GetDisplayController"}, - FunctionInfo{10, D<&ILibraryAppletProxy::GetProcessWindingController>, "GetProcessWindingController"}, - FunctionInfo{11, D<&ILibraryAppletProxy::GetLibraryAppletCreator>, "GetLibraryAppletCreator"}, - FunctionInfo{20, D<&ILibraryAppletProxy::OpenLibraryAppletSelfAccessor>, "OpenLibraryAppletSelfAccessor"}, - FunctionInfo{21, D<&ILibraryAppletProxy::GetAppletCommonFunctions>, "GetAppletCommonFunctions"}, - FunctionInfo{22, D<&ILibraryAppletProxy::GetHomeMenuFunctions>, "GetHomeMenuFunctions"}, - FunctionInfo{23, D<&ILibraryAppletProxy::GetGlobalStateController>, "GetGlobalStateController"}, - FunctionInfo{1000, D<&ILibraryAppletProxy::GetDebugFunctions>, "GetDebugFunctions"} - ); - WindowSystem& m_window_system; - Kernel::KProcess* const m_process; - const std::shared_ptr m_applet; -}; - -class IOverlayAppletProxy final : public ServiceFramework { -public: - explicit IOverlayAppletProxy(Core::System &system_, std::shared_ptr applet, - Kernel::KProcess *process, WindowSystem &window_system) - : ServiceFramework{system_, "IOverlayAppletProxy"}, - m_window_system{window_system}, m_process{process}, m_applet{std::move(applet)} { - } - - ~IOverlayAppletProxy() override = default; - - Result GetCommonStateGetter( - Out > out_common_state_getter) { - LOG_DEBUG(Service_AM, "called"); - *out_common_state_getter = std::make_shared(system, m_applet); - R_SUCCEED(); - } - - Result GetSelfController( - Out > out_self_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_self_controller = std::make_shared(system, m_applet, m_process); - R_SUCCEED(); - } - - Result GetWindowController( - Out > out_window_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_window_controller = std::make_shared(system, m_applet, m_window_system); - R_SUCCEED(); - } - - Result GetAudioController( - Out > out_audio_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_audio_controller = std::make_shared(system); - R_SUCCEED(); - } - - Result GetDisplayController( - Out > out_display_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_display_controller = std::make_shared(system, m_applet); - R_SUCCEED(); - } - - Result GetProcessWindingController( - Out > out_process_winding_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_process_winding_controller = std::make_shared(system, m_applet); - R_SUCCEED(); - } - - Result GetLibraryAppletCreator( - Out > out_library_applet_creator) { - LOG_DEBUG(Service_AM, "called"); - *out_library_applet_creator = - std::make_shared(system, m_applet, m_window_system); - R_SUCCEED(); - } - - Result GetOverlayFunctions( - Out > out_overlay_functions) { - LOG_DEBUG(Service_AM, "called"); - *out_overlay_functions = std::make_shared(system, m_applet); - R_SUCCEED(); - } - - Result GetAppletCommonFunctions( - Out > out_applet_common_functions) { - LOG_DEBUG(Service_AM, "called"); - *out_applet_common_functions = std::make_shared(system, m_applet); - R_SUCCEED(); - } - - Result GetGlobalStateController( - Out > out_global_state_controller) { - LOG_DEBUG(Service_AM, "called"); - *out_global_state_controller = std::make_shared(system); - R_SUCCEED(); - } - - Result GetDebugFunctions( - Out > out_debug_functions) { - LOG_DEBUG(Service_AM, "called"); - *out_debug_functions = std::make_shared(system); - R_SUCCEED(); - } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IOverlayAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"}, - FunctionInfo{1, D<&IOverlayAppletProxy::GetSelfController>, "GetSelfController"}, - FunctionInfo{2, D<&IOverlayAppletProxy::GetWindowController>, "GetWindowController"}, - FunctionInfo{3, D<&IOverlayAppletProxy::GetAudioController>, "GetAudioController"}, - FunctionInfo{4, D<&IOverlayAppletProxy::GetDisplayController>, "GetDisplayController"}, - FunctionInfo{10, D<&IOverlayAppletProxy::GetProcessWindingController>, "GetProcessWindingController"}, - FunctionInfo{11, D<&IOverlayAppletProxy::GetLibraryAppletCreator>, "GetLibraryAppletCreator"}, - FunctionInfo{20, D<&IOverlayAppletProxy::GetOverlayFunctions>, "GetOverlayFunctions"}, - FunctionInfo{21, D<&IOverlayAppletProxy::GetAppletCommonFunctions>, "GetAppletCommonFunctions"}, - FunctionInfo{23, D<&IOverlayAppletProxy::GetGlobalStateController>, "GetGlobalStateController"}, - FunctionInfo{1000, D<&IOverlayAppletProxy::GetDebugFunctions>, "GetDebugFunctions"} - ); - WindowSystem& m_window_system; - Kernel::KProcess* const m_process; - const std::shared_ptr m_applet; -}; - -static bool ShouldCreateGuestApplet(AppletId applet_id) { -#define X(Name, name) \ - if (applet_id == AppletId::Name && \ - Settings::values.name##_applet_mode.GetValue() != Settings::AppletMode::LLE) { \ - return false; \ - } - - X(Cabinet, cabinet) - X(Controller, controller) - X(DataErase, data_erase) - X(Error, error) - X(NetConnect, net_connect) - X(ProfileSelect, player_select) - X(SoftwareKeyboard, swkbd) - X(MiiEdit, mii_edit) - X(Web, web) - X(Shop, shop) - X(PhotoViewer, photo_viewer) - X(OfflineWeb, offline_web) - X(LoginShare, login_share) - X(WebAuth, wifi_web_auth) - X(MyPage, my_page) - -#undef X - - return true; -} - -static AppletProgramId AppletIdToProgramId(AppletId applet_id) { - switch (applet_id) { - case AppletId::OverlayDisplay: - return AppletProgramId::OverlayDisplay; - case AppletId::QLaunch: - return AppletProgramId::QLaunch; - case AppletId::Starter: - return AppletProgramId::Starter; - case AppletId::Auth: - return AppletProgramId::Auth; - case AppletId::Cabinet: - return AppletProgramId::Cabinet; - case AppletId::Controller: - return AppletProgramId::Controller; - case AppletId::DataErase: - return AppletProgramId::DataErase; - case AppletId::Error: - return AppletProgramId::Error; - case AppletId::NetConnect: - return AppletProgramId::NetConnect; - case AppletId::ProfileSelect: - return AppletProgramId::ProfileSelect; - case AppletId::SoftwareKeyboard: - return AppletProgramId::SoftwareKeyboard; - case AppletId::MiiEdit: - return AppletProgramId::MiiEdit; - case AppletId::Web: - return AppletProgramId::Web; - case AppletId::Shop: - return AppletProgramId::Shop; - case AppletId::PhotoViewer: - return AppletProgramId::PhotoViewer; - case AppletId::Settings: - return AppletProgramId::Settings; - case AppletId::OfflineWeb: - return AppletProgramId::OfflineWeb; - case AppletId::LoginShare: - return AppletProgramId::LoginShare; - case AppletId::WebAuth: - return AppletProgramId::WebAuth; - case AppletId::MyPage: - return AppletProgramId::MyPage; - default: - return static_cast(0); - } -} - -static std::shared_ptr CreateGuestApplet(Core::System& system, - WindowSystem& window_system, - std::shared_ptr caller_applet, - AppletId applet_id, - LibraryAppletMode mode) { - const auto program_id = static_cast(AppletIdToProgramId(applet_id)); - if (program_id == 0) { - // Unknown applet - return {}; - } - - auto process = CreateProcess(system, program_id, 1, HLE::ApiVersion::HOS_VERSION_MAJOR); - if (process) { - const auto applet = std::make_shared(system, std::move(process), false); - applet->program_id = program_id; - applet->applet_id = applet_id; - applet->type = AppletType::LibraryApplet; - applet->library_applet_mode = mode; - applet->window_visible = mode != LibraryAppletMode::AllForegroundInitiallyHidden; - - auto broker = std::make_shared(system); - applet->caller_applet = caller_applet; - applet->caller_applet_broker = broker; - { - std::scoped_lock lk{caller_applet->lock}; - caller_applet->child_applets.push_back(applet); - } - window_system.TrackApplet(applet, false); - return std::make_shared(system, broker, applet); - } - // Couldn't initialize the guest process - return {}; -} - -static std::shared_ptr CreateFrontendApplet(Core::System& system, - WindowSystem& window_system, - std::shared_ptr caller_applet, - AppletId applet_id, - LibraryAppletMode mode) { - const auto program_id = static_cast(AppletIdToProgramId(applet_id)); - - auto process = std::make_unique(system); - auto applet = std::make_shared(system, std::move(process), false); - applet->program_id = program_id; - applet->applet_id = applet_id; - applet->type = AppletType::LibraryApplet; - applet->library_applet_mode = mode; - - auto storage = std::make_shared(system); - applet->caller_applet = caller_applet; - applet->caller_applet_broker = storage; - applet->frontend = system.GetFrontendAppletHolder().GetApplet(applet, applet_id, mode); - { - std::scoped_lock lk{caller_applet->lock}; - caller_applet->child_applets.push_back(applet); - } - return std::make_shared(system, storage, applet); -} - -class ILibraryAppletCreator final : public ServiceFramework { -public: - explicit ILibraryAppletCreator(Core::System& system_, std::shared_ptr applet, WindowSystem& window_system) - : ServiceFramework{system_, "ILibraryAppletCreator"} - , m_window_system{window_system}, m_applet{std::move(applet)} { - } - ~ILibraryAppletCreator() override = default; - - Result CreateLibraryApplet( - Out> out_library_applet_accessor, AppletId applet_id, - LibraryAppletMode library_applet_mode) { - LOG_DEBUG(Service_AM, "called with applet_id={} applet_mode={}", applet_id, - library_applet_mode); - - std::shared_ptr library_applet; - if (ShouldCreateGuestApplet(applet_id)) { - library_applet = - CreateGuestApplet(system, m_window_system, m_applet, applet_id, library_applet_mode); - } - if (!library_applet) { - library_applet = - CreateFrontendApplet(system, m_window_system, m_applet, applet_id, library_applet_mode); - } - if (!library_applet) { - LOG_ERROR(Service_AM, "Applet doesn't exist! applet_id={}", applet_id); - R_THROW(ResultUnknown); - } - - // Applet is created, can now be launched. - m_applet->library_applet_launchable_event.Signal(system.Kernel()); - *out_library_applet_accessor = library_applet; - R_SUCCEED(); - } - - Result CreateLibraryAppletEx( - Out> out_library_applet_accessor, AppletId applet_id, - LibraryAppletMode library_applet_mode, u64 thread_id) { - LOG_DEBUG(Service_AM, "called with applet_id={} applet_mode={} thread_id={}", applet_id, - library_applet_mode, thread_id); - - std::shared_ptr library_applet; - if (ShouldCreateGuestApplet(applet_id)) { - library_applet = - CreateGuestApplet(system, m_window_system, m_applet, applet_id, library_applet_mode); - } - if (!library_applet) { - library_applet = - CreateFrontendApplet(system, m_window_system, m_applet, applet_id, library_applet_mode); - } - if (!library_applet) { - LOG_ERROR(Service_AM, "Applet doesn't exist! applet_id={}", applet_id); - R_THROW(ResultUnknown); - } - - // Applet is created, can now be launched. - m_applet->library_applet_launchable_event.Signal(system.Kernel()); - *out_library_applet_accessor = library_applet; - R_SUCCEED(); - } - - Result CreateStorage(Out> out_storage, s64 size) { - LOG_DEBUG(Service_AM, "called, size={}", size); - - if (size <= 0) { - LOG_ERROR(Service_AM, "size is less than or equal to 0"); - R_THROW(ResultUnknown); - } - - *out_storage = std::make_shared(system, AM::CreateStorage(std::vector(size))); - R_SUCCEED(); - } - - Result CreateTransferMemoryStorage( - Out> out_storage, bool is_writable, s64 size, - InCopyHandle transfer_memory_handle) { - LOG_DEBUG(Service_AM, "called, is_writable={} size={}", is_writable, size); - - if (size <= 0) { - LOG_ERROR(Service_AM, "size is less than or equal to 0"); - R_THROW(ResultUnknown); - } - - if (!transfer_memory_handle) { - LOG_ERROR(Service_AM, "transfer_memory_handle is null"); - R_THROW(ResultUnknown); - } - - *out_storage = std::make_shared( - system, AM::CreateTransferMemoryStorage(system.Kernel(), transfer_memory_handle->GetOwner()->GetMemory(), - transfer_memory_handle.Get(), is_writable, size)); - R_SUCCEED(); - } - - Result CreateHandleStorage( - Out> out_storage, s64 size, - InCopyHandle transfer_memory_handle) { - LOG_DEBUG(Service_AM, "called, size={}", size); - - if (size <= 0) { - LOG_ERROR(Service_AM, "size is less than or equal to 0"); - R_THROW(ResultUnknown); - } - - if (!transfer_memory_handle) { - LOG_ERROR(Service_AM, "transfer_memory_handle is null"); - R_THROW(ResultUnknown); - } - - *out_storage = std::make_shared( - system, AM::CreateHandleStorage(system.Kernel(), transfer_memory_handle->GetOwner()->GetMemory(), - transfer_memory_handle.Get(), size)); - R_SUCCEED(); - } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&ILibraryAppletCreator::CreateLibraryApplet>, "CreateLibraryApplet"}, - FunctionInfo{1, nullptr, "TerminateAllLibraryApplets"}, - FunctionInfo{2, nullptr, "AreAnyLibraryAppletsLeft"}, - FunctionInfo{3, D<&ILibraryAppletCreator::CreateLibraryAppletEx>, "CreateLibraryAppletEx"}, - FunctionInfo{10, D<&ILibraryAppletCreator::CreateStorage>, "CreateStorage"}, - FunctionInfo{11, D<&ILibraryAppletCreator::CreateTransferMemoryStorage>, "CreateTransferMemoryStorage"}, - FunctionInfo{12, D<&ILibraryAppletCreator::CreateHandleStorage>, "CreateHandleStorage"} - ); - WindowSystem& m_window_system; - const std::shared_ptr m_applet; -}; - -class IAllSystemAppletProxiesService final - : public ServiceFramework { -public: - explicit IAllSystemAppletProxiesService(Core::System& system_, WindowSystem& window_system) - : ServiceFramework{system_, "appletAE"}, m_window_system{window_system} { - } - - ~IAllSystemAppletProxiesService() override = default; - - Result OpenSystemAppletProxy( - Out> out_system_applet_proxy, ClientProcessId pid, - InCopyHandle process_handle) { - LOG_DEBUG(Service_AM, "called"); - - if (const auto applet = this->GetAppletFromProcessId(pid); applet) { - *out_system_applet_proxy = std::make_shared( - system, applet, process_handle.Get(), m_window_system); - R_SUCCEED(); - } else { - UNIMPLEMENTED(); - R_THROW(ResultUnknown); - } - } - - Result OpenLibraryAppletProxy( - Out> out_library_applet_proxy, ClientProcessId pid, - InCopyHandle process_handle, - InLargeData attribute) { - LOG_DEBUG(Service_AM, "called"); - - if (const auto applet = this->GetAppletFromProcessId(pid); applet) { - *out_library_applet_proxy = std::make_shared( - system, applet, process_handle.Get(), m_window_system); - R_SUCCEED(); - } else { - UNIMPLEMENTED(); - R_THROW(ResultUnknown); - } - } - - Result OpenOverlayAppletProxy( - Out> out_overlay_applet_proxy, ClientProcessId pid, - InCopyHandle process_handle) { - LOG_WARNING(Service_AM, "called"); - - if (const auto applet = this->GetAppletFromProcessId(pid); applet) { - *out_overlay_applet_proxy = std::make_shared( - system, applet, process_handle.Get(), m_window_system); - R_SUCCEED(); - } else { - UNIMPLEMENTED(); - R_THROW(ResultUnknown); - } - } - - Result OpenSystemApplicationProxy( - Out> out_system_application_proxy, ClientProcessId pid, - InCopyHandle process_handle) { - LOG_DEBUG(Service_AM, "called"); - - if (const auto applet = this->GetAppletFromProcessId(pid); applet) { - *out_system_application_proxy = std::make_shared( - system, applet, process_handle.Get(), m_window_system); - R_SUCCEED(); - } else { - UNIMPLEMENTED(); - R_THROW(ResultUnknown); - } - } - - Result OpenLibraryAppletProxyOld( - Out> out_library_applet_proxy, ClientProcessId pid, - InCopyHandle process_handle) { - LOG_DEBUG(Service_AM, "called"); - - AppletAttribute attribute{}; - R_RETURN(this->OpenLibraryAppletProxy(out_library_applet_proxy, pid, process_handle, attribute)); - } - - Result GetSystemProcessCommonFunctions() { - LOG_DEBUG(Service_AM, "(STUBBED) called."); - // TODO (jarrodnorwell) - R_SUCCEED(); - } - - Result GetAppletAlternativeFunctions() { - LOG_DEBUG(Service_AM, "(STUBBED) called."); - // TODO (maufeat) - R_SUCCEED(); - } - - std::shared_ptr GetAppletFromProcessId(ProcessId process_id) { - return m_window_system.GetByAppletResourceUserId(process_id.pid); - } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{100, D<&IAllSystemAppletProxiesService::OpenSystemAppletProxy>, "OpenSystemAppletProxy"}, - FunctionInfo{110, D<&IAllSystemAppletProxiesService::OpenSystemAppletProxy>, "OpenSystemAppletProxyEx"}, - FunctionInfo{200, D<&IAllSystemAppletProxiesService::OpenLibraryAppletProxyOld>, "OpenLibraryAppletProxyOld"}, - FunctionInfo{201, D<&IAllSystemAppletProxiesService::OpenLibraryAppletProxy>, "OpenLibraryAppletProxy"}, - FunctionInfo{300, D<&IAllSystemAppletProxiesService::OpenOverlayAppletProxy>, "OpenOverlayAppletProxy"}, - FunctionInfo{350, D<&IAllSystemAppletProxiesService::OpenSystemApplicationProxy>, "OpenSystemApplicationProxy"}, - FunctionInfo{400, nullptr, "CreateSelfLibraryAppletCreatorForDevelop"}, - FunctionInfo{410, nullptr, "GetSystemAppletControllerForDebug"}, - FunctionInfo{450, D<&IAllSystemAppletProxiesService::GetSystemProcessCommonFunctions>, "GetSystemProcessCommonFunctions", MakeVersionGate({19,0,0})}, - FunctionInfo{460, D<&IAllSystemAppletProxiesService::GetAppletAlternativeFunctions>, "GetAppletAlternativeFunctions", MakeVersionGate({20,0,0})}, - FunctionInfo{1000, nullptr, "GetDebugFunctions"} - ); - WindowSystem& m_window_system; -}; - void LoopProcess(Core::System& system) { WindowSystem window_system(system); ButtonPoller button_poller(system, window_system); @@ -1345,8 +21,10 @@ void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); - server_manager->RegisterNamedService("appletAE", std::make_shared(system, window_system)); - server_manager->RegisterNamedService("appletOE", std::make_shared(system, window_system)); + server_manager->RegisterNamedService( + "appletAE", std::make_shared(system, window_system)); + server_manager->RegisterNamedService( + "appletOE", std::make_shared(system, window_system)); ServerManager::RunServer(std::move(server_manager)); } diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index 1afe253aed..0bf5880f30 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/am/applet_manager.h b/src/core/hle/service/am/applet_manager.h index 2b0714adf7..cd3035de31 100644 --- a/src/core/hle/service/am/applet_manager.h +++ b/src/core/hle/service/am/applet_manager.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project diff --git a/src/core/hle/service/am/frontend/applet_cabinet.h b/src/core/hle/service/am/frontend/applet_cabinet.h index 3a211ed372..a74f233569 100644 --- a/src/core/hle/service/am/frontend/applet_cabinet.h +++ b/src/core/hle/service/am/frontend/applet_cabinet.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/am/frontend/applet_controller.h b/src/core/hle/service/am/frontend/applet_controller.h index 341ebed234..3877a7b02e 100644 --- a/src/core/hle/service/am/frontend/applet_controller.h +++ b/src/core/hle/service/am/frontend/applet_controller.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project diff --git a/src/core/hle/service/am/frontend/applet_error.h b/src/core/hle/service/am/frontend/applet_error.h index 678bf33fac..af3e2134a5 100644 --- a/src/core/hle/service/am/frontend/applet_error.h +++ b/src/core/hle/service/am/frontend/applet_error.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/am/frontend/applet_general.h b/src/core/hle/service/am/frontend/applet_general.h index eaa7ae25fe..ceb0537119 100644 --- a/src/core/hle/service/am/frontend/applet_general.h +++ b/src/core/hle/service/am/frontend/applet_general.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/am/frontend/applet_mii_edit.h b/src/core/hle/service/am/frontend/applet_mii_edit.h index 5db792f7d2..8654426431 100644 --- a/src/core/hle/service/am/frontend/applet_mii_edit.h +++ b/src/core/hle/service/am/frontend/applet_mii_edit.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/am/frontend/applet_mii_edit_types.h b/src/core/hle/service/am/frontend/applet_mii_edit_types.h index 23d9d7a69b..9c354bd947 100644 --- a/src/core/hle/service/am/frontend/applet_mii_edit_types.h +++ b/src/core/hle/service/am/frontend/applet_mii_edit_types.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/am/frontend/applet_net_connect.h b/src/core/hle/service/am/frontend/applet_net_connect.h index d5d503ed41..0986b63c60 100644 --- a/src/core/hle/service/am/frontend/applet_net_connect.h +++ b/src/core/hle/service/am/frontend/applet_net_connect.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later #pragma once diff --git a/src/core/hle/service/am/frontend/applet_profile_select.cpp b/src/core/hle/service/am/frontend/applet_profile_select.cpp index 89b5a1eabe..0f46ee6232 100644 --- a/src/core/hle/service/am/frontend/applet_profile_select.cpp +++ b/src/core/hle/service/am/frontend/applet_profile_select.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/am/frontend/applet_profile_select.h b/src/core/hle/service/am/frontend/applet_profile_select.h index 674e7afe17..4feba73a37 100644 --- a/src/core/hle/service/am/frontend/applet_profile_select.h +++ b/src/core/hle/service/am/frontend/applet_profile_select.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/am/frontend/applet_software_keyboard_types.h b/src/core/hle/service/am/frontend/applet_software_keyboard_types.h index a25ff2a6d2..6bb8f437d3 100644 --- a/src/core/hle/service/am/frontend/applet_software_keyboard_types.h +++ b/src/core/hle/service/am/frontend/applet_software_keyboard_types.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/am/frontend/applet_web_browser.h b/src/core/hle/service/am/frontend/applet_web_browser.h index ae62389f13..41461a93d0 100644 --- a/src/core/hle/service/am/frontend/applet_web_browser.h +++ b/src/core/hle/service/am/frontend/applet_web_browser.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project diff --git a/src/core/hle/service/am/frontend/applets.h b/src/core/hle/service/am/frontend/applets.h index 8eb08ea77b..6259a5668a 100644 --- a/src/core/hle/service/am/frontend/applets.h +++ b/src/core/hle/service/am/frontend/applets.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project diff --git a/src/core/hle/service/am/process_holder.cpp b/src/core/hle/service/am/process_holder.cpp index 21ef5bf838..8ad6599fd6 100644 --- a/src/core/hle/service/am/process_holder.cpp +++ b/src/core/hle/service/am/process_holder.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/am/process_holder.h b/src/core/hle/service/am/process_holder.h index 3a9b81dfb4..dbf04668dc 100644 --- a/src/core/hle/service/am/process_holder.h +++ b/src/core/hle/service/am/process_holder.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/am/service/all_system_applet_proxies_service.cpp b/src/core/hle/service/am/service/all_system_applet_proxies_service.cpp new file mode 100644 index 0000000000..437032c2f4 --- /dev/null +++ b/src/core/hle/service/am/service/all_system_applet_proxies_service.cpp @@ -0,0 +1,135 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/core.h" +#include "core/hle/service/am/applet_manager.h" +#include "core/hle/service/am/service/all_system_applet_proxies_service.h" +#include "core/hle/service/am/service/application_proxy.h" +#include "core/hle/service/am/service/library_applet_proxy.h" +#include "core/hle/service/am/service/system_applet_proxy.h" +#include "core/hle/service/am/service/overlay_applet_proxy.h" +#include "core/hle/service/am/window_system.h" +#include "core/hle/service/cmif_serialization.h" + +namespace Service::AM { + +IAllSystemAppletProxiesService::IAllSystemAppletProxiesService(Core::System& system_, + WindowSystem& window_system) + : ServiceFramework{system_, "appletAE"}, m_window_system{window_system} { + // clang-format off + static const FunctionInfo functions[] = { + {100, D<&IAllSystemAppletProxiesService::OpenSystemAppletProxy>, "OpenSystemAppletProxy"}, + {110, D<&IAllSystemAppletProxiesService::OpenSystemAppletProxy>, "OpenSystemAppletProxyEx"}, + {200, D<&IAllSystemAppletProxiesService::OpenLibraryAppletProxyOld>, "OpenLibraryAppletProxyOld"}, + {201, D<&IAllSystemAppletProxiesService::OpenLibraryAppletProxy>, "OpenLibraryAppletProxy"}, + {300, D<&IAllSystemAppletProxiesService::OpenOverlayAppletProxy>, "OpenOverlayAppletProxy"}, + {350, D<&IAllSystemAppletProxiesService::OpenSystemApplicationProxy>, "OpenSystemApplicationProxy"}, + {400, nullptr, "CreateSelfLibraryAppletCreatorForDevelop"}, + {410, nullptr, "GetSystemAppletControllerForDebug"}, + {450, D<&IAllSystemAppletProxiesService::GetSystemProcessCommonFunctions>, "GetSystemProcessCommonFunctions"}, // 19.0.0+ + {460, D<&IAllSystemAppletProxiesService::GetAppletAlternativeFunctions>, "GetAppletAlternativeFunctions"}, // 20.0.0+ + {1000, nullptr, "GetDebugFunctions"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +IAllSystemAppletProxiesService::~IAllSystemAppletProxiesService() = default; + +Result IAllSystemAppletProxiesService::OpenSystemAppletProxy( + Out> out_system_applet_proxy, ClientProcessId pid, + InCopyHandle process_handle) { + LOG_DEBUG(Service_AM, "called"); + + if (const auto applet = this->GetAppletFromProcessId(pid); applet) { + *out_system_applet_proxy = std::make_shared( + system, applet, process_handle.Get(), m_window_system); + R_SUCCEED(); + } else { + UNIMPLEMENTED(); + R_THROW(ResultUnknown); + } +} + +Result IAllSystemAppletProxiesService::OpenLibraryAppletProxy( + Out> out_library_applet_proxy, ClientProcessId pid, + InCopyHandle process_handle, + InLargeData attribute) { + LOG_DEBUG(Service_AM, "called"); + + if (const auto applet = this->GetAppletFromProcessId(pid); applet) { + *out_library_applet_proxy = std::make_shared( + system, applet, process_handle.Get(), m_window_system); + R_SUCCEED(); + } else { + UNIMPLEMENTED(); + R_THROW(ResultUnknown); + } +} + +Result IAllSystemAppletProxiesService::OpenOverlayAppletProxy( + Out> out_overlay_applet_proxy, ClientProcessId pid, + InCopyHandle process_handle) { + LOG_WARNING(Service_AM, "called"); + + if (const auto applet = this->GetAppletFromProcessId(pid); applet) { + *out_overlay_applet_proxy = std::make_shared( + system, applet, process_handle.Get(), m_window_system); + R_SUCCEED(); + } else { + UNIMPLEMENTED(); + R_THROW(ResultUnknown); + } +} + +Result IAllSystemAppletProxiesService::OpenSystemApplicationProxy( + Out> out_system_application_proxy, ClientProcessId pid, + InCopyHandle process_handle) { + LOG_DEBUG(Service_AM, "called"); + + if (const auto applet = this->GetAppletFromProcessId(pid); applet) { + *out_system_application_proxy = std::make_shared( + system, applet, process_handle.Get(), m_window_system); + R_SUCCEED(); + } else { + UNIMPLEMENTED(); + R_THROW(ResultUnknown); + } +} + +Result IAllSystemAppletProxiesService::OpenLibraryAppletProxyOld( + Out> out_library_applet_proxy, ClientProcessId pid, + InCopyHandle process_handle) { + LOG_DEBUG(Service_AM, "called"); + + AppletAttribute attribute{}; + R_RETURN( + this->OpenLibraryAppletProxy(out_library_applet_proxy, pid, process_handle, attribute)); +} + +Result IAllSystemAppletProxiesService::GetSystemProcessCommonFunctions() { + LOG_DEBUG(Service_AM, "(STUBBED) called."); + + // TODO (jarrodnorwell) + + R_SUCCEED(); +} + +Result IAllSystemAppletProxiesService::GetAppletAlternativeFunctions() { + LOG_DEBUG(Service_AM, "(STUBBED) called."); + + // TODO (maufeat) + + R_SUCCEED(); +} + +std::shared_ptr IAllSystemAppletProxiesService::GetAppletFromProcessId( + ProcessId process_id) { + return m_window_system.GetByAppletResourceUserId(process_id.pid); +} + +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/all_system_applet_proxies_service.h b/src/core/hle/service/am/service/all_system_applet_proxies_service.h new file mode 100644 index 0000000000..73cb8a09ac --- /dev/null +++ b/src/core/hle/service/am/service/all_system_applet_proxies_service.h @@ -0,0 +1,56 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/service.h" +#include "core/hle/service/am/service/overlay_applet_proxy.h" + +namespace Service { + +namespace AM { + +struct Applet; +struct AppletAttribute; +class IApplicationProxy; +class ILibraryAppletProxy; +class ISystemAppletProxy; +class WindowSystem; + +class IAllSystemAppletProxiesService final + : public ServiceFramework { +public: + explicit IAllSystemAppletProxiesService(Core::System& system_, WindowSystem& window_system); + ~IAllSystemAppletProxiesService() override; + +private: + Result OpenSystemAppletProxy(Out> out_system_applet_proxy, + ClientProcessId pid, + InCopyHandle process_handle); + Result OpenLibraryAppletProxy(Out> out_library_applet_proxy, + ClientProcessId pid, + InCopyHandle process_handle, + InLargeData attribute); + Result OpenOverlayAppletProxy(Out> out_overlay_applet_proxy, + ClientProcessId pid, InCopyHandle process_handle); + Result OpenLibraryAppletProxyOld( + Out> out_library_applet_proxy, ClientProcessId pid, + InCopyHandle process_handle); + Result OpenSystemApplicationProxy( + Out> out_system_application_proxy, ClientProcessId pid, + InCopyHandle process_handle); + Result GetSystemProcessCommonFunctions(); + Result GetAppletAlternativeFunctions(); + +private: + std::shared_ptr GetAppletFromProcessId(ProcessId pid); + + WindowSystem& m_window_system; +}; + +} // namespace AM +} // namespace Service diff --git a/src/core/hle/service/am/service/applet_common_functions.cpp b/src/core/hle/service/am/service/applet_common_functions.cpp new file mode 100644 index 0000000000..5ffec23b3e --- /dev/null +++ b/src/core/hle/service/am/service/applet_common_functions.cpp @@ -0,0 +1,98 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/core.h" +#include "core/file_sys/common_funcs.h" +#include "core/hle/service/am/applet.h" +#include "core/hle/service/am/service/applet_common_functions.h" +#include "core/hle/service/cmif_serialization.h" + +namespace Service::AM { + +IAppletCommonFunctions::IAppletCommonFunctions(Core::System& system_, + std::shared_ptr applet_) + : ServiceFramework{system_, "IAppletCommonFunctions"}, applet{std::move(applet_)} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "SetTerminateResult"}, + {10, nullptr, "ReadThemeStorage"}, + {11, nullptr, "WriteThemeStorage"}, + {20, nullptr, "PushToAppletBoundChannel"}, + {21, nullptr, "TryPopFromAppletBoundChannel"}, + {40, nullptr, "GetDisplayLogicalResolution"}, + {42, D<&IAppletCommonFunctions::SetDisplayMagnification>, "SetDisplayMagnification"}, + {50, D<&IAppletCommonFunctions::SetHomeButtonDoubleClickEnabled>, "SetHomeButtonDoubleClickEnabled"}, + {51, D<&IAppletCommonFunctions::GetHomeButtonDoubleClickEnabled>, "GetHomeButtonDoubleClickEnabled"}, + {52, nullptr, "IsHomeButtonShortPressedBlocked"}, + {60, nullptr, "IsVrModeCurtainRequired"}, + {61, nullptr, "IsSleepRequiredByHighTemperature"}, + {62, nullptr, "IsSleepRequiredByLowBattery"}, + {70, D<&IAppletCommonFunctions::SetCpuBoostRequestPriority>, "SetCpuBoostRequestPriority"}, + {80, nullptr, "SetHandlingCaptureButtonShortPressedMessageEnabledForApplet"}, + {81, nullptr, "SetHandlingCaptureButtonLongPressedMessageEnabledForApplet"}, + {90, nullptr, "OpenNamedChannelAsParent"}, + {91, nullptr, "OpenNamedChannelAsChild"}, + {100, nullptr, "SetApplicationCoreUsageMode"}, + {300, D<&IAppletCommonFunctions::GetCurrentApplicationId>, "GetCurrentApplicationId"}, + {310, nullptr, "IsSystemAppletHomeMenu"}, //19.0.0+ + {320, D<&IAppletCommonFunctions::SetGpuTimeSliceBoost>, "SetGpuTimeSliceBoost"}, //19.0.0+ + {321, nullptr, "SetGpuTimeSliceBoostDueToApplication"}, //19.0.0+ + {350, D<&IAppletCommonFunctions::Unknown350>, "Unknown350"} //20.0.0+ + }; + // clang-format on + + RegisterHandlers(functions); +} + +IAppletCommonFunctions::~IAppletCommonFunctions() = default; + +Result IAppletCommonFunctions::SetHomeButtonDoubleClickEnabled( + bool home_button_double_click_enabled) { + LOG_WARNING(Service_AM, "(STUBBED) called, home_button_double_click_enabled={}", + home_button_double_click_enabled); + R_SUCCEED(); +} + +Result IAppletCommonFunctions::GetHomeButtonDoubleClickEnabled( + Out out_home_button_double_click_enabled) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + *out_home_button_double_click_enabled = false; + R_SUCCEED(); +} + +Result IAppletCommonFunctions::SetDisplayMagnification(f32 x, f32 y, f32 width, f32 height) { + LOG_DEBUG(Service_AM, "(STUBBED) called, x={}, y={}, width={}, height={}", x, y, width, + height); + std::scoped_lock lk{applet->lock}; + applet->display_magnification = Common::Rectangle{x, y, x + width, y + height}; + R_SUCCEED(); +} + +Result IAppletCommonFunctions::SetCpuBoostRequestPriority(s32 priority) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + std::scoped_lock lk{applet->lock}; + applet->cpu_boost_request_priority = priority; + R_SUCCEED(); +} + +Result IAppletCommonFunctions::GetCurrentApplicationId(Out out_application_id) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + *out_application_id = FileSys::GetBaseTitleID(system.GetApplicationProcessProgramID()); + R_SUCCEED(); +} + +Result IAppletCommonFunctions::SetGpuTimeSliceBoost(s64 time_span) { + LOG_WARNING(Service_AM, "(STUBBED) called, time_span={}", time_span); + R_SUCCEED(); +} + +Result IAppletCommonFunctions::Unknown350(Out out_unknown) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + *out_unknown = 0; + R_SUCCEED(); +} + +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/applet_common_functions.h b/src/core/hle/service/am/service/applet_common_functions.h new file mode 100644 index 0000000000..696fcd5bd1 --- /dev/null +++ b/src/core/hle/service/am/service/applet_common_functions.h @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/service.h" + +namespace Service::AM { + +struct Applet; + +class IAppletCommonFunctions final : public ServiceFramework { +public: + explicit IAppletCommonFunctions(Core::System& system_, std::shared_ptr applet_); + ~IAppletCommonFunctions() override; + +private: + Result SetHomeButtonDoubleClickEnabled(bool home_button_double_click_enabled); + Result GetHomeButtonDoubleClickEnabled(Out out_home_button_double_click_enabled); + Result SetDisplayMagnification(f32 x, f32 y, f32 width, f32 height); + Result SetCpuBoostRequestPriority(s32 priority); + Result GetCurrentApplicationId(Out out_application_id); + Result SetGpuTimeSliceBoost(s64 time_span); + Result Unknown350(Out out_unknown); + + const std::shared_ptr applet; +}; + +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/application_accessor.cpp b/src/core/hle/service/am/service/application_accessor.cpp index d24c2616dc..f357871706 100644 --- a/src/core/hle/service/am/service/application_accessor.cpp +++ b/src/core/hle/service/am/service/application_accessor.cpp @@ -18,42 +18,42 @@ namespace Service::AM { -std::optional IApplicationAccessor::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IApplicationAccessor::GetAppletStateChangedEvent>, "GetAppletStateChangedEvent"}, - FunctionInfo{1, nullptr, "IsCompleted"}, - FunctionInfo{10, D<&IApplicationAccessor::Start>, "Start"}, - FunctionInfo{20, D<&IApplicationAccessor::RequestExit>, "RequestExit"}, - FunctionInfo{25, D<&IApplicationAccessor::Terminate>, "Terminate"}, - FunctionInfo{30, D<&IApplicationAccessor::GetResult>, "GetResult"}, - FunctionInfo{101, D<&IApplicationAccessor::RequestForApplicationToGetForeground>, "RequestForApplicationToGetForeground"}, - FunctionInfo{110, nullptr, "TerminateAllLibraryApplets"}, - FunctionInfo{111, nullptr, "AreAnyLibraryAppletsLeft"}, - FunctionInfo{112, D<&IApplicationAccessor::GetCurrentLibraryApplet>, "GetCurrentLibraryApplet"}, - FunctionInfo{120, nullptr, "GetApplicationId"}, - FunctionInfo{121, D<&IApplicationAccessor::PushLaunchParameter>, "PushLaunchParameter"}, - FunctionInfo{122, D<&IApplicationAccessor::GetApplicationControlProperty>, "GetApplicationControlProperty"}, - FunctionInfo{123, nullptr, "GetApplicationLaunchProperty"}, - FunctionInfo{124, nullptr, "GetApplicationLaunchRequestInfo"}, - FunctionInfo{130, D<&IApplicationAccessor::SetUsers>, "SetUsers"}, - FunctionInfo{131, D<&IApplicationAccessor::CheckRightsEnvironmentAvailable>, "CheckRightsEnvironmentAvailable"}, - FunctionInfo{132, D<&IApplicationAccessor::GetNsRightsEnvironmentHandle>, "GetNsRightsEnvironmentHandle"}, - FunctionInfo{140, nullptr, "GetDesirableUids"}, - FunctionInfo{150, D<&IApplicationAccessor::ReportApplicationExitTimeout>, "ReportApplicationExitTimeout"}, - FunctionInfo{160, nullptr, "SetApplicationAttribute"}, - FunctionInfo{170, nullptr, "HasSaveDataAccessPermission"}, - FunctionInfo{180, nullptr, "PushToFriendInvitationStorageChannel"}, - FunctionInfo{190, nullptr, "PushToNotificationStorageChannel"}, - FunctionInfo{200, nullptr, "RequestApplicationSoftReset"}, - FunctionInfo{201, nullptr, "RestartApplicationTimer"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IApplicationAccessor::IApplicationAccessor(Core::System& system_, std::shared_ptr applet, WindowSystem& window_system) : ServiceFramework{system_, "IApplicationAccessor"}, m_window_system(window_system), m_applet(std::move(applet)) { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IApplicationAccessor::GetAppletStateChangedEvent>, "GetAppletStateChangedEvent"}, + {1, nullptr, "IsCompleted"}, + {10, D<&IApplicationAccessor::Start>, "Start"}, + {20, D<&IApplicationAccessor::RequestExit>, "RequestExit"}, + {25, D<&IApplicationAccessor::Terminate>, "Terminate"}, + {30, D<&IApplicationAccessor::GetResult>, "GetResult"}, + {101, D<&IApplicationAccessor::RequestForApplicationToGetForeground>, "RequestForApplicationToGetForeground"}, + {110, nullptr, "TerminateAllLibraryApplets"}, + {111, nullptr, "AreAnyLibraryAppletsLeft"}, + {112, D<&IApplicationAccessor::GetCurrentLibraryApplet>, "GetCurrentLibraryApplet"}, + {120, nullptr, "GetApplicationId"}, + {121, D<&IApplicationAccessor::PushLaunchParameter>, "PushLaunchParameter"}, + {122, D<&IApplicationAccessor::GetApplicationControlProperty>, "GetApplicationControlProperty"}, + {123, nullptr, "GetApplicationLaunchProperty"}, + {124, nullptr, "GetApplicationLaunchRequestInfo"}, + {130, D<&IApplicationAccessor::SetUsers>, "SetUsers"}, + {131, D<&IApplicationAccessor::CheckRightsEnvironmentAvailable>, "CheckRightsEnvironmentAvailable"}, + {132, D<&IApplicationAccessor::GetNsRightsEnvironmentHandle>, "GetNsRightsEnvironmentHandle"}, + {140, nullptr, "GetDesirableUids"}, + {150, D<&IApplicationAccessor::ReportApplicationExitTimeout>, "ReportApplicationExitTimeout"}, + {160, nullptr, "SetApplicationAttribute"}, + {170, nullptr, "HasSaveDataAccessPermission"}, + {180, nullptr, "PushToFriendInvitationStorageChannel"}, + {190, nullptr, "PushToNotificationStorageChannel"}, + {200, nullptr, "RequestApplicationSoftReset"}, + {201, nullptr, "RestartApplicationTimer"}, + }; + // clang-format on + + RegisterHandlers(functions); } IApplicationAccessor::~IApplicationAccessor() = default; diff --git a/src/core/hle/service/am/service/application_accessor.h b/src/core/hle/service/am/service/application_accessor.h index 57b222fc19..7908099916 100644 --- a/src/core/hle/service/am/service/application_accessor.h +++ b/src/core/hle/service/am/service/application_accessor.h @@ -39,7 +39,6 @@ private: Result GetNsRightsEnvironmentHandle(Out out_handle); Result ReportApplicationExitTimeout(); - std::optional FindRequest(u32 key) override; WindowSystem& m_window_system; const std::shared_ptr m_applet; }; diff --git a/src/core/hle/service/am/service/application_creator.cpp b/src/core/hle/service/am/service/application_creator.cpp index 8d57f917fb..4eb2f29e22 100644 --- a/src/core/hle/service/am/service/application_creator.cpp +++ b/src/core/hle/service/am/service/application_creator.cpp @@ -20,16 +20,6 @@ namespace Service::AM { -std::optional IApplicationCreator::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IApplicationCreator::CreateApplication>, "CreateApplication"}, - FunctionInfo{1, nullptr, "PopLaunchRequestedApplication"}, - FunctionInfo{10, D<&IApplicationCreator::CreateSystemApplication>, "CreateSystemApplication"}, - FunctionInfo{100, nullptr, "PopFloatingApplicationForDevelopment"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - namespace { Result CreateGuestApplication(SharedPointer* out_application_accessor, Core::System& system, WindowSystem& window_system, u64 program_id) { @@ -64,6 +54,16 @@ Result CreateGuestApplication(SharedPointer* out_applicati IApplicationCreator::IApplicationCreator(Core::System& system_, WindowSystem& window_system) : ServiceFramework{system_, "IApplicationCreator"}, m_window_system{window_system} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IApplicationCreator::CreateApplication>, "CreateApplication"}, + {1, nullptr, "PopLaunchRequestedApplication"}, + {10, D<&IApplicationCreator::CreateSystemApplication>, "CreateSystemApplication"}, + {100, nullptr, "PopFloatingApplicationForDevelopment"}, + }; + // clang-format on + + RegisterHandlers(functions); } IApplicationCreator::~IApplicationCreator() = default; diff --git a/src/core/hle/service/am/service/application_creator.h b/src/core/hle/service/am/service/application_creator.h index 64434af542..59ae924131 100644 --- a/src/core/hle/service/am/service/application_creator.h +++ b/src/core/hle/service/am/service/application_creator.h @@ -24,7 +24,6 @@ private: Result CreateApplication(Out>, u64 application_id); Result CreateSystemApplication(Out>, u64 application_id); - std::optional FindRequest(u32 key) override; WindowSystem& m_window_system; }; diff --git a/src/core/hle/service/am/service/application_functions.cpp b/src/core/hle/service/am/service/application_functions.cpp index 4fda5eedd6..90d292c4a2 100644 --- a/src/core/hle/service/am/service/application_functions.cpp +++ b/src/core/hle/service/am/service/application_functions.cpp @@ -51,84 +51,83 @@ FileSys::PatchManager::Metadata GetApplicationMetadata(Core::System& system, u64 } // Anonymous namespace -std::optional IApplicationFunctions::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{1, D<&IApplicationFunctions::PopLaunchParameter>, "PopLaunchParameter"}, - FunctionInfo{10, nullptr, "CreateApplicationAndPushAndRequestToStart"}, - FunctionInfo{11, nullptr, "CreateApplicationAndPushAndRequestToStartForQuest"}, - FunctionInfo{12, D<&IApplicationFunctions::CreateApplicationAndRequestToStart>, "CreateApplicationAndRequestToStart"}, - FunctionInfo{13, nullptr, "CreateApplicationAndRequestToStartForQuest"}, - FunctionInfo{14, nullptr, "CreateApplicationWithAttributeAndPushAndRequestToStartForQuest"}, - FunctionInfo{15, nullptr, "CreateApplicationWithAttributeAndRequestToStartForQuest"}, - FunctionInfo{20, D<&IApplicationFunctions::EnsureSaveData>, "EnsureSaveData"}, - FunctionInfo{21, D<&IApplicationFunctions::GetDesiredLanguage>, "GetDesiredLanguage"}, - FunctionInfo{22, D<&IApplicationFunctions::SetTerminateResult>, "SetTerminateResult"}, - FunctionInfo{23, D<&IApplicationFunctions::GetDisplayVersion>, "GetDisplayVersion"}, - FunctionInfo{24, nullptr, "GetLaunchStorageInfoForDebug"}, - FunctionInfo{25, D<&IApplicationFunctions::ExtendSaveData>, "ExtendSaveData"}, - FunctionInfo{26, D<&IApplicationFunctions::GetSaveDataSize>, "GetSaveDataSize"}, - FunctionInfo{27, D<&IApplicationFunctions::CreateCacheStorage>, "CreateCacheStorage"}, - FunctionInfo{28, D<&IApplicationFunctions::GetSaveDataSizeMax>, "GetSaveDataSizeMax"}, - FunctionInfo{29, D<&IApplicationFunctions::GetCacheStorageMax>, "GetCacheStorageMax"}, - FunctionInfo{30, D<&IApplicationFunctions::BeginBlockingHomeButtonShortAndLongPressed>, "BeginBlockingHomeButtonShortAndLongPressed"}, - FunctionInfo{31, D<&IApplicationFunctions::EndBlockingHomeButtonShortAndLongPressed>, "EndBlockingHomeButtonShortAndLongPressed"}, - FunctionInfo{32, D<&IApplicationFunctions::BeginBlockingHomeButton>, "BeginBlockingHomeButton"}, - FunctionInfo{33, D<&IApplicationFunctions::EndBlockingHomeButton>, "EndBlockingHomeButton"}, - FunctionInfo{34, nullptr, "SelectApplicationLicense"}, - FunctionInfo{35, nullptr, "GetDeviceSaveDataSizeMax"}, - FunctionInfo{36, nullptr, "GetLimitedApplicationLicense"}, - FunctionInfo{37, nullptr, "GetLimitedApplicationLicenseUpgradableEvent"}, - FunctionInfo{40, D<&IApplicationFunctions::NotifyRunning>, "NotifyRunning"}, - FunctionInfo{50, D<&IApplicationFunctions::GetPseudoDeviceId>, "GetPseudoDeviceId"}, - FunctionInfo{60, D<&IApplicationFunctions::SetMediaPlaybackStateForApplication>, "SetMediaPlaybackStateForApplication"}, - FunctionInfo{65, D<&IApplicationFunctions::IsGamePlayRecordingSupported>, "IsGamePlayRecordingSupported"}, - FunctionInfo{66, D<&IApplicationFunctions::InitializeGamePlayRecording>, "InitializeGamePlayRecording"}, - FunctionInfo{67, D<&IApplicationFunctions::SetGamePlayRecordingState>, "SetGamePlayRecordingState"}, - FunctionInfo{68, nullptr, "RequestFlushGamePlayingMovieForDebug"}, - FunctionInfo{70, nullptr, "RequestToShutdown"}, - FunctionInfo{71, nullptr, "RequestToReboot"}, - FunctionInfo{72, nullptr, "RequestToSleep"}, - FunctionInfo{80, nullptr, "ExitAndRequestToShowThanksMessage"}, - FunctionInfo{90, D<&IApplicationFunctions::EnableApplicationCrashReport>, "EnableApplicationCrashReport"}, - FunctionInfo{100, D<&IApplicationFunctions::InitializeApplicationCopyrightFrameBuffer>, "InitializeApplicationCopyrightFrameBuffer"}, - FunctionInfo{101, D<&IApplicationFunctions::SetApplicationCopyrightImage>, "SetApplicationCopyrightImage"}, - FunctionInfo{102, D<&IApplicationFunctions::SetApplicationCopyrightVisibility>, "SetApplicationCopyrightVisibility"}, - FunctionInfo{110, D<&IApplicationFunctions::QueryApplicationPlayStatistics>, "QueryApplicationPlayStatistics"}, - FunctionInfo{111, D<&IApplicationFunctions::QueryApplicationPlayStatisticsByUid>, "QueryApplicationPlayStatisticsByUid"}, - FunctionInfo{120, D<&IApplicationFunctions::ExecuteProgram>, "ExecuteProgram"}, - FunctionInfo{121, D<&IApplicationFunctions::ClearUserChannel>, "ClearUserChannel"}, - FunctionInfo{122, D<&IApplicationFunctions::UnpopToUserChannel>, "UnpopToUserChannel"}, - FunctionInfo{123, D<&IApplicationFunctions::GetPreviousProgramIndex>, "GetPreviousProgramIndex"}, - FunctionInfo{124, nullptr, "EnableApplicationAllThreadDumpOnCrash"}, - FunctionInfo{130, D<&IApplicationFunctions::GetGpuErrorDetectedSystemEvent>, "GetGpuErrorDetectedSystemEvent"}, - FunctionInfo{131, nullptr, "SetDelayTimeToAbortOnGpuError"}, - FunctionInfo{140, D<&IApplicationFunctions::GetFriendInvitationStorageChannelEvent>, "GetFriendInvitationStorageChannelEvent"}, - FunctionInfo{141, D<&IApplicationFunctions::TryPopFromFriendInvitationStorageChannel>, "TryPopFromFriendInvitationStorageChannel"}, - FunctionInfo{150, D<&IApplicationFunctions::GetNotificationStorageChannelEvent>, "GetNotificationStorageChannelEvent"}, - FunctionInfo{151, nullptr, "TryPopFromNotificationStorageChannel"}, - FunctionInfo{160, D<&IApplicationFunctions::GetHealthWarningDisappearedSystemEvent>, "GetHealthWarningDisappearedSystemEvent"}, - FunctionInfo{170, nullptr, "SetHdcpAuthenticationActivated"}, - FunctionInfo{180, nullptr, "GetLaunchRequiredVersion"}, - FunctionInfo{181, nullptr, "UpgradeLaunchRequiredVersion"}, - FunctionInfo{190, nullptr, "SendServerMaintenanceOverlayNotification"}, - FunctionInfo{200, nullptr, "GetLastApplicationExitReason"}, - FunctionInfo{210, D<&IApplicationFunctions::GetUnknownEvent210>, "Unknown210"}, - FunctionInfo{220, nullptr, "Unknown220"}, // [20.0.0+] - FunctionInfo{300, nullptr, "CreateMovieWriter"}, // [19.0.0+] - FunctionInfo{310, nullptr, "Unknown310"}, // [20.0.0+] - FunctionInfo{320, nullptr, "Unknown320"}, // [20.0.0+] - FunctionInfo{330, D<&IApplicationFunctions::Unknown330>, "Unknown330"}, // [20.0.0+] - FunctionInfo{500, nullptr, "StartContinuousRecordingFlushForDebug"}, - FunctionInfo{1000, nullptr, "CreateMovieMaker"}, - FunctionInfo{1001, D<&IApplicationFunctions::PrepareForJit>, "PrepareForJit"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IApplicationFunctions::IApplicationFunctions(Core::System& system_, std::shared_ptr applet) - : ServiceFramework{system_, "IApplicationFunctions"} - , m_applet{std::move(applet)} -{} + : ServiceFramework{system_, "IApplicationFunctions"}, m_applet{std::move(applet)} { + // clang-format off + static const FunctionInfo functions[] = { + {1, D<&IApplicationFunctions::PopLaunchParameter>, "PopLaunchParameter"}, + {10, nullptr, "CreateApplicationAndPushAndRequestToStart"}, + {11, nullptr, "CreateApplicationAndPushAndRequestToStartForQuest"}, + {12, D<&IApplicationFunctions::CreateApplicationAndRequestToStart>, "CreateApplicationAndRequestToStart"}, + {13, nullptr, "CreateApplicationAndRequestToStartForQuest"}, + {14, nullptr, "CreateApplicationWithAttributeAndPushAndRequestToStartForQuest"}, + {15, nullptr, "CreateApplicationWithAttributeAndRequestToStartForQuest"}, + {20, D<&IApplicationFunctions::EnsureSaveData>, "EnsureSaveData"}, + {21, D<&IApplicationFunctions::GetDesiredLanguage>, "GetDesiredLanguage"}, + {22, D<&IApplicationFunctions::SetTerminateResult>, "SetTerminateResult"}, + {23, D<&IApplicationFunctions::GetDisplayVersion>, "GetDisplayVersion"}, + {24, nullptr, "GetLaunchStorageInfoForDebug"}, + {25, D<&IApplicationFunctions::ExtendSaveData>, "ExtendSaveData"}, + {26, D<&IApplicationFunctions::GetSaveDataSize>, "GetSaveDataSize"}, + {27, D<&IApplicationFunctions::CreateCacheStorage>, "CreateCacheStorage"}, + {28, D<&IApplicationFunctions::GetSaveDataSizeMax>, "GetSaveDataSizeMax"}, + {29, D<&IApplicationFunctions::GetCacheStorageMax>, "GetCacheStorageMax"}, + {30, D<&IApplicationFunctions::BeginBlockingHomeButtonShortAndLongPressed>, "BeginBlockingHomeButtonShortAndLongPressed"}, + {31, D<&IApplicationFunctions::EndBlockingHomeButtonShortAndLongPressed>, "EndBlockingHomeButtonShortAndLongPressed"}, + {32, D<&IApplicationFunctions::BeginBlockingHomeButton>, "BeginBlockingHomeButton"}, + {33, D<&IApplicationFunctions::EndBlockingHomeButton>, "EndBlockingHomeButton"}, + {34, nullptr, "SelectApplicationLicense"}, + {35, nullptr, "GetDeviceSaveDataSizeMax"}, + {36, nullptr, "GetLimitedApplicationLicense"}, + {37, nullptr, "GetLimitedApplicationLicenseUpgradableEvent"}, + {40, D<&IApplicationFunctions::NotifyRunning>, "NotifyRunning"}, + {50, D<&IApplicationFunctions::GetPseudoDeviceId>, "GetPseudoDeviceId"}, + {60, D<&IApplicationFunctions::SetMediaPlaybackStateForApplication>, "SetMediaPlaybackStateForApplication"}, + {65, D<&IApplicationFunctions::IsGamePlayRecordingSupported>, "IsGamePlayRecordingSupported"}, + {66, D<&IApplicationFunctions::InitializeGamePlayRecording>, "InitializeGamePlayRecording"}, + {67, D<&IApplicationFunctions::SetGamePlayRecordingState>, "SetGamePlayRecordingState"}, + {68, nullptr, "RequestFlushGamePlayingMovieForDebug"}, + {70, nullptr, "RequestToShutdown"}, + {71, nullptr, "RequestToReboot"}, + {72, nullptr, "RequestToSleep"}, + {80, nullptr, "ExitAndRequestToShowThanksMessage"}, + {90, D<&IApplicationFunctions::EnableApplicationCrashReport>, "EnableApplicationCrashReport"}, + {100, D<&IApplicationFunctions::InitializeApplicationCopyrightFrameBuffer>, "InitializeApplicationCopyrightFrameBuffer"}, + {101, D<&IApplicationFunctions::SetApplicationCopyrightImage>, "SetApplicationCopyrightImage"}, + {102, D<&IApplicationFunctions::SetApplicationCopyrightVisibility>, "SetApplicationCopyrightVisibility"}, + {110, D<&IApplicationFunctions::QueryApplicationPlayStatistics>, "QueryApplicationPlayStatistics"}, + {111, D<&IApplicationFunctions::QueryApplicationPlayStatisticsByUid>, "QueryApplicationPlayStatisticsByUid"}, + {120, D<&IApplicationFunctions::ExecuteProgram>, "ExecuteProgram"}, + {121, D<&IApplicationFunctions::ClearUserChannel>, "ClearUserChannel"}, + {122, D<&IApplicationFunctions::UnpopToUserChannel>, "UnpopToUserChannel"}, + {123, D<&IApplicationFunctions::GetPreviousProgramIndex>, "GetPreviousProgramIndex"}, + {124, nullptr, "EnableApplicationAllThreadDumpOnCrash"}, + {130, D<&IApplicationFunctions::GetGpuErrorDetectedSystemEvent>, "GetGpuErrorDetectedSystemEvent"}, + {131, nullptr, "SetDelayTimeToAbortOnGpuError"}, + {140, D<&IApplicationFunctions::GetFriendInvitationStorageChannelEvent>, "GetFriendInvitationStorageChannelEvent"}, + {141, D<&IApplicationFunctions::TryPopFromFriendInvitationStorageChannel>, "TryPopFromFriendInvitationStorageChannel"}, + {150, D<&IApplicationFunctions::GetNotificationStorageChannelEvent>, "GetNotificationStorageChannelEvent"}, + {151, nullptr, "TryPopFromNotificationStorageChannel"}, + {160, D<&IApplicationFunctions::GetHealthWarningDisappearedSystemEvent>, "GetHealthWarningDisappearedSystemEvent"}, + {170, nullptr, "SetHdcpAuthenticationActivated"}, + {180, nullptr, "GetLaunchRequiredVersion"}, + {181, nullptr, "UpgradeLaunchRequiredVersion"}, + {190, nullptr, "SendServerMaintenanceOverlayNotification"}, + {200, nullptr, "GetLastApplicationExitReason"}, + {210, D<&IApplicationFunctions::GetUnknownEvent210>, "Unknown210"}, + {220, nullptr, "Unknown220"}, // [20.0.0+] + {300, nullptr, "CreateMovieWriter"}, // [19.0.0+] + {310, nullptr, "Unknown310"}, // [20.0.0+] + {320, nullptr, "Unknown320"}, // [20.0.0+] + {330, D<&IApplicationFunctions::Unknown330>, "Unknown330"}, // [20.0.0+] + {500, nullptr, "StartContinuousRecordingFlushForDebug"}, + {1000, nullptr, "CreateMovieMaker"}, + {1001, D<&IApplicationFunctions::PrepareForJit>, "PrepareForJit"}, + }; + // clang-format on + + RegisterHandlers(functions); +} IApplicationFunctions::~IApplicationFunctions() = default; diff --git a/src/core/hle/service/am/service/application_functions.h b/src/core/hle/service/am/service/application_functions.h index 7093d13f82..b97ed7e25e 100644 --- a/src/core/hle/service/am/service/application_functions.h +++ b/src/core/hle/service/am/service/application_functions.h @@ -84,7 +84,6 @@ private: Result GetUnknownEvent210(OutCopyHandle out_event); Result Unknown330(Out out); Result PrepareForJit(); - std::optional FindRequest(u32 key) override; const std::shared_ptr m_applet; }; diff --git a/src/core/hle/service/am/service/application_proxy.cpp b/src/core/hle/service/am/service/application_proxy.cpp new file mode 100644 index 0000000000..df438e1e17 --- /dev/null +++ b/src/core/hle/service/am/service/application_proxy.cpp @@ -0,0 +1,109 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/hle/service/am/service/applet_common_functions.h" +#include "core/hle/service/am/service/application_functions.h" +#include "core/hle/service/am/service/application_proxy.h" +#include "core/hle/service/am/service/audio_controller.h" +#include "core/hle/service/am/service/common_state_getter.h" +#include "core/hle/service/am/service/debug_functions.h" +#include "core/hle/service/am/service/display_controller.h" +#include "core/hle/service/am/service/library_applet_creator.h" +#include "core/hle/service/am/service/process_winding_controller.h" +#include "core/hle/service/am/service/self_controller.h" +#include "core/hle/service/am/service/window_controller.h" +#include "core/hle/service/cmif_serialization.h" + +namespace Service::AM { + +IApplicationProxy::IApplicationProxy(Core::System& system_, std::shared_ptr applet, + Kernel::KProcess* process, WindowSystem& window_system) + : ServiceFramework{system_, "IApplicationProxy"}, + m_window_system{window_system}, m_process{process}, m_applet{std::move(applet)} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IApplicationProxy::GetCommonStateGetter>, "GetCommonStateGetter"}, + {1, D<&IApplicationProxy::GetSelfController>, "GetSelfController"}, + {2, D<&IApplicationProxy::GetWindowController>, "GetWindowController"}, + {3, D<&IApplicationProxy::GetAudioController>, "GetAudioController"}, + {4, D<&IApplicationProxy::GetDisplayController>, "GetDisplayController"}, + {10, D<&IApplicationProxy::GetProcessWindingController>, "GetProcessWindingController"}, + {11, D<&IApplicationProxy::GetLibraryAppletCreator>, "GetLibraryAppletCreator"}, + {20, D<&IApplicationProxy::GetApplicationFunctions>, "GetApplicationFunctions"}, + {1000, D<&IApplicationProxy::GetDebugFunctions>, "GetDebugFunctions"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +IApplicationProxy::~IApplicationProxy() = default; + +Result IApplicationProxy::GetAudioController( + Out> out_audio_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_audio_controller = std::make_shared(system); + R_SUCCEED(); +} + +Result IApplicationProxy::GetDisplayController( + Out> out_display_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_display_controller = std::make_shared(system, m_applet); + R_SUCCEED(); +} + +Result IApplicationProxy::GetProcessWindingController( + Out> out_process_winding_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_process_winding_controller = std::make_shared(system, m_applet); + R_SUCCEED(); +} + +Result IApplicationProxy::GetDebugFunctions( + Out> out_debug_functions) { + LOG_DEBUG(Service_AM, "called"); + *out_debug_functions = std::make_shared(system); + R_SUCCEED(); +} + +Result IApplicationProxy::GetWindowController( + Out> out_window_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_window_controller = std::make_shared(system, m_applet, m_window_system); + R_SUCCEED(); +} + +Result IApplicationProxy::GetSelfController( + Out> out_self_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_self_controller = std::make_shared(system, m_applet, m_process); + R_SUCCEED(); +} + +Result IApplicationProxy::GetCommonStateGetter( + Out> out_common_state_getter) { + LOG_DEBUG(Service_AM, "called"); + *out_common_state_getter = std::make_shared(system, m_applet); + R_SUCCEED(); +} + +Result IApplicationProxy::GetLibraryAppletCreator( + Out> out_library_applet_creator) { + LOG_DEBUG(Service_AM, "called"); + *out_library_applet_creator = + std::make_shared(system, m_applet, m_window_system); + R_SUCCEED(); +} + +Result IApplicationProxy::GetApplicationFunctions( + Out> out_application_functions) { + LOG_DEBUG(Service_AM, "called"); + *out_application_functions = std::make_shared(system, m_applet); + R_SUCCEED(); +} + +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/application_proxy.h b/src/core/hle/service/am/service/application_proxy.h new file mode 100644 index 0000000000..b56f597605 --- /dev/null +++ b/src/core/hle/service/am/service/application_proxy.h @@ -0,0 +1,52 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/service.h" + +namespace Service::AM { + +struct Applet; +class IAudioController; +class IApplicationFunctions; +class ICommonStateGetter; +class IDebugFunctions; +class IDisplayController; +class ILibraryAppletCreator; +class IProcessWindingController; +class ISelfController; +class IWindowController; +class WindowSystem; + +class IApplicationProxy final : public ServiceFramework { +public: + explicit IApplicationProxy(Core::System& system_, std::shared_ptr applet, + Kernel::KProcess* process, WindowSystem& window_system); + ~IApplicationProxy(); + +private: + Result GetAudioController(Out> out_audio_controller); + Result GetDisplayController(Out> out_display_controller); + Result GetProcessWindingController( + Out> out_process_winding_controller); + Result GetDebugFunctions(Out> out_debug_functions); + Result GetWindowController(Out> out_window_controller); + Result GetSelfController(Out> out_self_controller); + Result GetCommonStateGetter(Out> out_common_state_getter); + Result GetLibraryAppletCreator( + Out> out_library_applet_creator); + Result GetApplicationFunctions( + Out> out_application_functions); + +private: + WindowSystem& m_window_system; + Kernel::KProcess* const m_process; + const std::shared_ptr m_applet; +}; + +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/application_proxy_service.cpp b/src/core/hle/service/am/service/application_proxy_service.cpp new file mode 100644 index 0000000000..7727951d8c --- /dev/null +++ b/src/core/hle/service/am/service/application_proxy_service.cpp @@ -0,0 +1,47 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/core.h" +#include "core/hle/service/am/am.h" +#include "core/hle/service/am/applet_manager.h" +#include "core/hle/service/am/service/application_proxy.h" +#include "core/hle/service/am/service/application_proxy_service.h" +#include "core/hle/service/am/window_system.h" +#include "core/hle/service/cmif_serialization.h" + +namespace Service::AM { + +IApplicationProxyService::IApplicationProxyService(Core::System& system_, + WindowSystem& window_system) + : ServiceFramework{system_, "appletOE"}, m_window_system{window_system} { + static const FunctionInfo functions[] = { + {0, D<&IApplicationProxyService::OpenApplicationProxy>, "OpenApplicationProxy"}, + }; + RegisterHandlers(functions); +} + +IApplicationProxyService::~IApplicationProxyService() = default; + +Result IApplicationProxyService::OpenApplicationProxy( + Out> out_application_proxy, ClientProcessId pid, + InCopyHandle process_handle) { + LOG_DEBUG(Service_AM, "called"); + + if (const auto applet = this->GetAppletFromProcessId(pid)) { + *out_application_proxy = std::make_shared( + system, applet, process_handle.Get(), m_window_system); + R_SUCCEED(); + } else { + UNIMPLEMENTED(); + R_THROW(ResultUnknown); + } +} + +std::shared_ptr IApplicationProxyService::GetAppletFromProcessId(ProcessId process_id) { + return m_window_system.GetByAppletResourceUserId(process_id.pid); +} + +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/application_proxy_service.h b/src/core/hle/service/am/service/application_proxy_service.h new file mode 100644 index 0000000000..fce860a7c1 --- /dev/null +++ b/src/core/hle/service/am/service/application_proxy_service.h @@ -0,0 +1,36 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/service.h" + +namespace Service { + +namespace AM { + +struct Applet; +class IApplicationProxy; +class WindowSystem; + +class IApplicationProxyService final : public ServiceFramework { +public: + explicit IApplicationProxyService(Core::System& system_, WindowSystem& window_system); + ~IApplicationProxyService() override; + +private: + Result OpenApplicationProxy(Out> out_application_proxy, + ClientProcessId pid, InCopyHandle process_handle); + +private: + std::shared_ptr GetAppletFromProcessId(ProcessId pid); + + WindowSystem& m_window_system; +}; + +} // namespace AM +} // namespace Service diff --git a/src/core/hle/service/am/service/audio_controller.cpp b/src/core/hle/service/am/service/audio_controller.cpp index 2c8494e056..4e9af756f2 100644 --- a/src/core/hle/service/am/service/audio_controller.cpp +++ b/src/core/hle/service/am/service/audio_controller.cpp @@ -9,20 +9,20 @@ namespace Service::AM { -std::optional IAudioController::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IAudioController::SetExpectedMasterVolume>, "SetExpectedMasterVolume"}, - FunctionInfo{1, D<&IAudioController::GetMainAppletExpectedMasterVolume>, "GetMainAppletExpectedMasterVolume"}, - FunctionInfo{2, D<&IAudioController::GetLibraryAppletExpectedMasterVolume>, "GetLibraryAppletExpectedMasterVolume"}, - FunctionInfo{3, D<&IAudioController::ChangeMainAppletMasterVolume>, "ChangeMainAppletMasterVolume"}, - FunctionInfo{4, D<&IAudioController::SetTransparentVolumeRate>, "SetTransparentVolumeRate"}, - FunctionInfo{5, nullptr, "Unknown5", MakeVersionGate({20,0,0})} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IAudioController::IAudioController(Core::System& system_) : ServiceFramework{system_, "IAudioController"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IAudioController::SetExpectedMasterVolume>, "SetExpectedMasterVolume"}, + {1, D<&IAudioController::GetMainAppletExpectedMasterVolume>, "GetMainAppletExpectedMasterVolume"}, + {2, D<&IAudioController::GetLibraryAppletExpectedMasterVolume>, "GetLibraryAppletExpectedMasterVolume"}, + {3, D<&IAudioController::ChangeMainAppletMasterVolume>, "ChangeMainAppletMasterVolume"}, + {4, D<&IAudioController::SetTransparentVolumeRate>, "SetTransparentVolumeRate"}, + {5, nullptr, "Unknown5"}, //20.0.0+ + }; + // clang-format on + + RegisterHandlers(functions); } IAudioController::~IAudioController() = default; diff --git a/src/core/hle/service/am/service/audio_controller.h b/src/core/hle/service/am/service/audio_controller.h index 9cdb33820d..a13f3b199b 100644 --- a/src/core/hle/service/am/service/audio_controller.h +++ b/src/core/hle/service/am/service/audio_controller.h @@ -23,7 +23,6 @@ private: Result ChangeMainAppletMasterVolume(f32 volume, s64 fade_time_ns); Result SetTransparentVolumeRate(f32 transparent_volume_rate); - std::optional FindRequest(u32 key) override; static constexpr float MinAllowedVolume = 0.0f; static constexpr float MaxAllowedVolume = 1.0f; diff --git a/src/core/hle/service/am/service/common_state_getter.cpp b/src/core/hle/service/am/service/common_state_getter.cpp index 6a6a51f42e..044929e434 100644 --- a/src/core/hle/service/am/service/common_state_getter.cpp +++ b/src/core/hle/service/am/service/common_state_getter.cpp @@ -8,6 +8,7 @@ #include "core/hle/service/am/am_results.h" #include "core/hle/service/am/applet.h" #include "core/hle/service/am/service/common_state_getter.h" +#include "core/hle/service/am/service/lock_accessor.h" #include "core/hle/service/am/service/storage.h" #include "core/hle/service/apm/apm_interface.h" #include "core/hle/service/cmif_serialization.h" @@ -17,147 +18,77 @@ namespace Service::AM { -std::optional ICommonStateGetter::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&ICommonStateGetter::GetEventHandle>, "GetEventHandle"}, - FunctionInfo{1, D<&ICommonStateGetter::ReceiveMessage>, "ReceiveMessage"}, - FunctionInfo{2, nullptr, "GetThisAppletKind"}, - FunctionInfo{3, nullptr, "AllowToEnterSleep"}, - FunctionInfo{4, nullptr, "DisallowToEnterSleep"}, - FunctionInfo{5, D<&ICommonStateGetter::GetOperationMode>, "GetOperationMode"}, - FunctionInfo{6, D<&ICommonStateGetter::GetPerformanceMode>, "GetPerformanceMode"}, - FunctionInfo{7, nullptr, "GetCradleStatus"}, - FunctionInfo{8, D<&ICommonStateGetter::GetBootMode>, "GetBootMode"}, - FunctionInfo{9, D<&ICommonStateGetter::GetCurrentFocusState>, "GetCurrentFocusState"}, - FunctionInfo{10, D<&ICommonStateGetter::RequestToAcquireSleepLock>, "RequestToAcquireSleepLock"}, - FunctionInfo{11, D<&ICommonStateGetter::ReleaseSleepLock>, "ReleaseSleepLock"}, - FunctionInfo{12, D<&ICommonStateGetter::ReleaseSleepLockTransiently>, "ReleaseSleepLockTransiently"}, - FunctionInfo{13, D<&ICommonStateGetter::GetAcquiredSleepLockEvent>, "GetAcquiredSleepLockEvent"}, - FunctionInfo{14, nullptr, "GetWakeupCount", MakeVersionGate({11,0,0})}, - FunctionInfo{15, nullptr, "Unknown15", MakeVersionGate({19,0,0})}, - FunctionInfo{20, D<&ICommonStateGetter::PushToGeneralChannel>, "PushToGeneralChannel"}, - FunctionInfo{30, D<&ICommonStateGetter::GetHomeButtonReaderLockAccessor>, "GetHomeButtonReaderLockAccessor"}, - FunctionInfo{31, D<&ICommonStateGetter::GetReaderLockAccessorEx>, "GetReaderLockAccessorEx", MakeVersionGate({2,0,0})}, - FunctionInfo{32, D<&ICommonStateGetter::GetWriterLockAccessorEx>, "GetWriterLockAccessorEx", MakeVersionGate({7,0,0})}, - FunctionInfo{40, nullptr, "GetCradleFwVersion", MakeVersionGate({2,0,0})}, - FunctionInfo{50, D<&ICommonStateGetter::IsVrModeEnabled>, "IsVrModeEnabled", MakeVersionGate({3,0,0})}, - FunctionInfo{51, D<&ICommonStateGetter::SetVrModeEnabled>, "SetVrModeEnabled", MakeVersionGate({3,0,0})}, - FunctionInfo{52, D<&ICommonStateGetter::SetLcdBacklighOffEnabled>, "SetLcdBacklighOffEnabled", MakeVersionGate({4,0,0})}, - FunctionInfo{53, D<&ICommonStateGetter::BeginVrModeEx>, "BeginVrModeEx", MakeVersionGate({7,0,0})}, - FunctionInfo{54, D<&ICommonStateGetter::EndVrModeEx>, "EndVrModeEx", MakeVersionGate({7,0,0})}, - FunctionInfo{55, D<&ICommonStateGetter::IsInControllerFirmwareUpdateSection>, "IsInControllerFirmwareUpdateSection", MakeVersionGate({3,0,0})}, - FunctionInfo{59, nullptr, "SetVrPositionForDebug", MakeVersionGate({1,0,0})}, - FunctionInfo{60, D<&ICommonStateGetter::GetDefaultDisplayResolution>, "GetDefaultDisplayResolution"}, - FunctionInfo{61, D<&ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent>, "GetDefaultDisplayResolutionChangeEvent"}, - FunctionInfo{62, D<&ICommonStateGetter::GetHdcpAuthenticationState>, "GetHdcpAuthenticationState"}, - FunctionInfo{63, D<&ICommonStateGetter::GetHdcpAuthenticationStateChangeEvent>, "GetHdcpAuthenticationStateChangeEvent"}, - FunctionInfo{64, nullptr, "SetTvPowerStateMatchingMode"}, - FunctionInfo{65, nullptr, "GetApplicationIdByContentActionName"}, - FunctionInfo{66, &ICommonStateGetter::SetCpuBoostMode, "SetCpuBoostMode"}, - FunctionInfo{67, nullptr, "CancelCpuBoostMode"}, - FunctionInfo{68, D<&ICommonStateGetter::GetBuiltInDisplayType>, "GetBuiltInDisplayType"}, - FunctionInfo{80, D<&ICommonStateGetter::PerformSystemButtonPressingIfInFocus>, "PerformSystemButtonPressingIfInFocus"}, - FunctionInfo{90, nullptr, "SetPerformanceConfigurationChangedNotification"}, - FunctionInfo{91, nullptr, "GetCurrentPerformanceConfiguration"}, - FunctionInfo{100, D<&ICommonStateGetter::SetHandlingHomeButtonShortPressedEnabled>, "SetHandlingHomeButtonShortPressedEnabled"}, - FunctionInfo{110, nullptr, "OpenMyGpuErrorHandler"}, - FunctionInfo{120, D<&ICommonStateGetter::GetAppletLaunchedHistory>, "GetAppletLaunchedHistory", MakeVersionGate({13,0,0})}, - FunctionInfo{130, D<&ICommonStateGetter::EnableStartupLogoDisappearedMessage>, "EnableStartupLogoDisappearedMessage", MakeVersionGate({21,0,0})}, - FunctionInfo{200, D<&ICommonStateGetter::GetOperationModeSystemInfo>, "GetOperationModeSystemInfo"}, - FunctionInfo{300, D<&ICommonStateGetter::GetSettingsPlatformRegion>, "GetSettingsPlatformRegion"}, - FunctionInfo{400, nullptr, "ActivateMigrationService"}, - FunctionInfo{401, nullptr, "DeactivateMigrationService"}, - FunctionInfo{500, nullptr, "DisableSleepTillShutdown"}, - FunctionInfo{501, nullptr, "SuppressDisablingSleepTemporarily"}, - FunctionInfo{502, nullptr, "IsSleepEnabled"}, - FunctionInfo{503, nullptr, "IsDisablingSleepSuppressed"}, - FunctionInfo{600, nullptr, "SetHidInputMagnificationForApplication", MakeVersionGate({20,0,0})}, - FunctionInfo{610, D<&ICommonStateGetter::Unknown610>, "Unknown610", MakeVersionGate({21,0,0})}, - FunctionInfo{611, D<&ICommonStateGetter::Unknown611>, "Unknown611", MakeVersionGate({22,0,0})}, - FunctionInfo{900, D<&ICommonStateGetter::SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled>, "SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled", MakeVersionGate({11,0,0})}, - FunctionInfo{910, nullptr, "GetLaunchRequiredTick", MakeVersionGate({17,0,0})}, - FunctionInfo{1000, D<&ICommonStateGetter::BeginVrMode3d>, "BeginVrMode3d", MakeVersionGate({19,0,0})}, - FunctionInfo{1001, D<&ICommonStateGetter::EndVrMode3d>, "EndVrMode3d", MakeVersionGate({19,0,0})}, - FunctionInfo{1002, D<&ICommonStateGetter::IsVrModeEnabled3d>, "IsVrModeEnabled3d", MakeVersionGate({19,0,0})}, - FunctionInfo{1003, D<&ICommonStateGetter::GetVrLaboGoggleViewport>, "GetVrLaboGoggleViewport", MakeVersionGate({21,0,0})}, - FunctionInfo{1004, D<&ICommonStateGetter::GetPanelPhysicalSizeForSpecificTitle>, "GetPanelPhysicalSizeForSpecificTitle", MakeVersionGate({21,0,0})}, - FunctionInfo{1005, D<&ICommonStateGetter::GetPanelResolutionForSpecificTitle>, "GetPanelResolutionForSpecificTitle", MakeVersionGate({21,0,0})} - ); - return HandlerTableGenerateWithFind(key, functions); -} - -class ILockAccessor final : public ServiceFramework { -public: - explicit ILockAccessor(Core::System& system_) - : ServiceFramework{system_, "ILockAccessor"}, m_context{system_, "ILockAccessor"}, - m_event{m_context} { - m_event.Signal(system.Kernel()); - } - ~ILockAccessor() override = default; - - Result TryLock(Out out_is_locked, OutCopyHandle out_handle, bool return_handle) { - LOG_INFO(Service_AM, "called, return_handle={}", return_handle); - - { - std::scoped_lock lk{m_mutex}; - if (m_is_locked) { - *out_is_locked = false; - } else { - m_is_locked = true; - *out_is_locked = true; - } - } - - if (return_handle) { - *out_handle = m_event.GetHandle(); - } - - R_SUCCEED(); - } - - Result Unlock() { - LOG_INFO(Service_AM, "called"); - - { - std::scoped_lock lk{m_mutex}; - m_is_locked = false; - } - - m_event.Signal(system.Kernel()); - R_SUCCEED(); - } - - Result GetEvent(OutCopyHandle out_handle) { - LOG_INFO(Service_AM, "called"); - *out_handle = m_event.GetHandle(); - R_SUCCEED(); - } - - Result IsLocked(Out out_is_locked) { - LOG_INFO(Service_AM, "called"); - std::scoped_lock lk{m_mutex}; - *out_is_locked = m_is_locked; - R_SUCCEED(); - } - -private: - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{1, D<&ILockAccessor::TryLock>, "TryLock"}, - FunctionInfo{2, D<&ILockAccessor::Unlock>, "Unlock"}, - FunctionInfo{3, D<&ILockAccessor::GetEvent>, "GetEvent"}, - FunctionInfo{4, D<&ILockAccessor::IsLocked>, "IsLocked"} - ); - KernelHelpers::ServiceContext m_context; - Event m_event; - std::mutex m_mutex{}; - bool m_is_locked{}; -}; - ICommonStateGetter::ICommonStateGetter(Core::System& system_, std::shared_ptr applet) : ServiceFramework{system_, "ICommonStateGetter"}, m_applet{std::move(applet)} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&ICommonStateGetter::GetEventHandle>, "GetEventHandle"}, + {1, D<&ICommonStateGetter::ReceiveMessage>, "ReceiveMessage"}, + {2, nullptr, "GetThisAppletKind"}, + {3, nullptr, "AllowToEnterSleep"}, + {4, nullptr, "DisallowToEnterSleep"}, + {5, D<&ICommonStateGetter::GetOperationMode>, "GetOperationMode"}, + {6, D<&ICommonStateGetter::GetPerformanceMode>, "GetPerformanceMode"}, + {7, nullptr, "GetCradleStatus"}, + {8, D<&ICommonStateGetter::GetBootMode>, "GetBootMode"}, + {9, D<&ICommonStateGetter::GetCurrentFocusState>, "GetCurrentFocusState"}, + {10, D<&ICommonStateGetter::RequestToAcquireSleepLock>, "RequestToAcquireSleepLock"}, + {11, D<&ICommonStateGetter::ReleaseSleepLock>, "ReleaseSleepLock"}, + {12, D<&ICommonStateGetter::ReleaseSleepLockTransiently>, "ReleaseSleepLockTransiently"}, + {13, D<&ICommonStateGetter::GetAcquiredSleepLockEvent>, "GetAcquiredSleepLockEvent"}, + {14, nullptr, "GetWakeupCount"}, //11.0.0+ + {15, nullptr, "Unknown15"}, //19.0.0+ + {20, D<&ICommonStateGetter::PushToGeneralChannel>, "PushToGeneralChannel"}, + {30, D<&ICommonStateGetter::GetHomeButtonReaderLockAccessor>, "GetHomeButtonReaderLockAccessor"}, + {31, D<&ICommonStateGetter::GetReaderLockAccessorEx>, "GetReaderLockAccessorEx"}, //2.0.0+ + {32, D<&ICommonStateGetter::GetWriterLockAccessorEx>, "GetWriterLockAccessorEx"}, //7.0.0+ + {40, nullptr, "GetCradleFwVersion"}, //2.0.0+ + {50, D<&ICommonStateGetter::IsVrModeEnabled>, "IsVrModeEnabled"}, //3.0.0+ + {51, D<&ICommonStateGetter::SetVrModeEnabled>, "SetVrModeEnabled"}, //3.0.0+ + {52, D<&ICommonStateGetter::SetLcdBacklighOffEnabled>, "SetLcdBacklighOffEnabled"}, //4.0.0+ + {53, D<&ICommonStateGetter::BeginVrModeEx>, "BeginVrModeEx"}, //7.0.0+ + {54, D<&ICommonStateGetter::EndVrModeEx>, "EndVrModeEx"}, //7.0.0+ + {55, D<&ICommonStateGetter::IsInControllerFirmwareUpdateSection>, "IsInControllerFirmwareUpdateSection"}, //3.0.0+ + {59, nullptr, "SetVrPositionForDebug"}, //1.0.0+ + {60, D<&ICommonStateGetter::GetDefaultDisplayResolution>, "GetDefaultDisplayResolution"}, + {61, D<&ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent>, "GetDefaultDisplayResolutionChangeEvent"}, + {62, D<&ICommonStateGetter::GetHdcpAuthenticationState>, "GetHdcpAuthenticationState"}, + {63, D<&ICommonStateGetter::GetHdcpAuthenticationStateChangeEvent>, "GetHdcpAuthenticationStateChangeEvent"}, + {64, nullptr, "SetTvPowerStateMatchingMode"}, + {65, nullptr, "GetApplicationIdByContentActionName"}, + {66, &ICommonStateGetter::SetCpuBoostMode, "SetCpuBoostMode"}, + {67, nullptr, "CancelCpuBoostMode"}, + {68, D<&ICommonStateGetter::GetBuiltInDisplayType>, "GetBuiltInDisplayType"}, + {80, D<&ICommonStateGetter::PerformSystemButtonPressingIfInFocus>, "PerformSystemButtonPressingIfInFocus"}, + {90, nullptr, "SetPerformanceConfigurationChangedNotification"}, + {91, nullptr, "GetCurrentPerformanceConfiguration"}, + {100, D<&ICommonStateGetter::SetHandlingHomeButtonShortPressedEnabled>, "SetHandlingHomeButtonShortPressedEnabled"}, + {110, nullptr, "OpenMyGpuErrorHandler"}, + {120, D<&ICommonStateGetter::GetAppletLaunchedHistory>, "GetAppletLaunchedHistory"}, //13.0.0+ + {130, D<&ICommonStateGetter::EnableStartupLogoDisappearedMessage>, "EnableStartupLogoDisappearedMessage"}, //21.0.0+ + {200, D<&ICommonStateGetter::GetOperationModeSystemInfo>, "GetOperationModeSystemInfo"}, + {300, D<&ICommonStateGetter::GetSettingsPlatformRegion>, "GetSettingsPlatformRegion"}, + {400, nullptr, "ActivateMigrationService"}, + {401, nullptr, "DeactivateMigrationService"}, + {500, nullptr, "DisableSleepTillShutdown"}, + {501, nullptr, "SuppressDisablingSleepTemporarily"}, + {502, nullptr, "IsSleepEnabled"}, + {503, nullptr, "IsDisablingSleepSuppressed"}, + {600, nullptr, "SetHidInputMagnificationForApplication"}, //20.0.0+ + {610, D<&ICommonStateGetter::Unknown610>, "Unknown610"}, //21.0.0+ + {611, D<&ICommonStateGetter::Unknown611>, "Unknown611"}, //22.0.0+ + {900, D<&ICommonStateGetter::SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled>, "SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled"}, //11.0.0+ + {910, nullptr, "GetLaunchRequiredTick"}, //17.0.0+ + {1000, D<&ICommonStateGetter::BeginVrMode3d>, "BeginVrMode3d"}, //19.0.0+ + {1001, D<&ICommonStateGetter::EndVrMode3d>, "EndVrMode3d"}, //19.0.0+ + {1002, D<&ICommonStateGetter::IsVrModeEnabled3d>, "IsVrModeEnabled3d"}, //19.0.0+ + {1003, D<&ICommonStateGetter::GetVrLaboGoggleViewport>, "GetVrLaboGoggleViewport"}, //21.0.0+ + {1004, D<&ICommonStateGetter::GetPanelPhysicalSizeForSpecificTitle>, "GetPanelPhysicalSizeForSpecificTitle"}, //21.0.0+ + {1005, D<&ICommonStateGetter::GetPanelResolutionForSpecificTitle>, "GetPanelResolutionForSpecificTitle"}, //21.0.0+ + }; + // clang-format on + + RegisterHandlers(functions); } ICommonStateGetter::~ICommonStateGetter() = default; diff --git a/src/core/hle/service/am/service/common_state_getter.h b/src/core/hle/service/am/service/common_state_getter.h index ad782ca48e..da86b5d079 100644 --- a/src/core/hle/service/am/service/common_state_getter.h +++ b/src/core/hle/service/am/service/common_state_getter.h @@ -76,7 +76,6 @@ private: void SetCpuBoostMode(HLERequestContext& ctx); - std::optional FindRequest(u32 key) override; const std::shared_ptr m_applet; }; diff --git a/src/core/hle/service/am/service/cradle_firmware_updater.cpp b/src/core/hle/service/am/service/cradle_firmware_updater.cpp index a8097ea209..b9f19e59d2 100644 --- a/src/core/hle/service/am/service/cradle_firmware_updater.cpp +++ b/src/core/hle/service/am/service/cradle_firmware_updater.cpp @@ -9,21 +9,22 @@ namespace Service::AM { - std::optional ICradleFirmwareUpdater::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&ICradleFirmwareUpdater::StartUpdate>, "StartUpdate"}, - FunctionInfo{1, D<&ICradleFirmwareUpdater::FinishUpdate>, "FinishUpdate"}, - FunctionInfo{2, D<&ICradleFirmwareUpdater::GetCradleDeviceInfo>, "GetCradleDeviceInfo"}, - FunctionInfo{3, D<&ICradleFirmwareUpdater::GetCradleDeviceInfoChangeEvent>, "GetCradleDeviceInfoChangeEvent"}, - FunctionInfo{4, nullptr, "GetUpdateProgressInfo"}, - FunctionInfo{5, nullptr, "GetLastInternalResult"} - ); - return HandlerTableGenerateWithFind(key, functions); - } - ICradleFirmwareUpdater::ICradleFirmwareUpdater(Core::System& system_) : ServiceFramework{system_, "ICradleFirmwareUpdater"}, m_context{system, "ICradleFirmwareUpdater"}, m_cradle_device_info_event{m_context} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&ICradleFirmwareUpdater::StartUpdate>, "StartUpdate"}, + {1, D<&ICradleFirmwareUpdater::FinishUpdate>, "FinishUpdate"}, + {2, D<&ICradleFirmwareUpdater::GetCradleDeviceInfo>, "GetCradleDeviceInfo"}, + {3, D<&ICradleFirmwareUpdater::GetCradleDeviceInfoChangeEvent>, "GetCradleDeviceInfoChangeEvent"}, + {4, nullptr, "GetUpdateProgressInfo"}, + {5, nullptr, "GetLastInternalResult"}, + + }; + // clang-format on + + RegisterHandlers(functions); } ICradleFirmwareUpdater::~ICradleFirmwareUpdater() = default; diff --git a/src/core/hle/service/am/service/cradle_firmware_updater.h b/src/core/hle/service/am/service/cradle_firmware_updater.h index f8e4b93b27..c895a34c22 100644 --- a/src/core/hle/service/am/service/cradle_firmware_updater.h +++ b/src/core/hle/service/am/service/cradle_firmware_updater.h @@ -33,7 +33,6 @@ private: Result GetCradleDeviceInfoChangeEvent(OutCopyHandle out_event); private: - std::optional FindRequest(u32 key) override; KernelHelpers::ServiceContext m_context; Event m_cradle_device_info_event; }; diff --git a/src/core/hle/service/am/service/debug_functions.cpp b/src/core/hle/service/am/service/debug_functions.cpp new file mode 100644 index 0000000000..4128366270 --- /dev/null +++ b/src/core/hle/service/am/service/debug_functions.cpp @@ -0,0 +1,46 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/hle/service/am/service/debug_functions.h" + +namespace Service::AM { + +IDebugFunctions::IDebugFunctions(Core::System& system_) + : ServiceFramework{system_, "IDebugFunctions"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "NotifyMessageToHomeMenuForDebug"}, + {1, nullptr, "OpenMainApplication"}, + {10, nullptr, "PerformSystemButtonPressing"}, + {20, nullptr, "InvalidateTransitionLayer"}, + {30, nullptr, "RequestLaunchApplicationWithUserAndArgumentForDebug"}, + {31, nullptr, "RequestLaunchApplicationByApplicationLaunchInfoForDebug"}, + {40, nullptr, "GetAppletResourceUsageInfo"}, + {50, nullptr, "AddSystemProgramIdAndAppletIdForDebug"}, + {51, nullptr, "AddOperationConfirmedLibraryAppletIdForDebug"}, + {100, nullptr, "SetCpuBoostModeForApplet"}, + {101, nullptr, "CancelCpuBoostModeForApplet"}, + {110, nullptr, "PushToAppletBoundChannelForDebug"}, + {111, nullptr, "TryPopFromAppletBoundChannelForDebug"}, + {120, nullptr, "AlarmSettingNotificationEnableAppEventReserve"}, + {121, nullptr, "AlarmSettingNotificationDisableAppEventReserve"}, + {122, nullptr, "AlarmSettingNotificationPushAppEventNotify"}, + {130, nullptr, "FriendInvitationSetApplicationParameter"}, + {131, nullptr, "FriendInvitationClearApplicationParameter"}, + {132, nullptr, "FriendInvitationPushApplicationParameter"}, + {140, nullptr, "RestrictPowerOperationForSecureLaunchModeForDebug"}, + {200, nullptr, "CreateFloatingLibraryAppletAccepterForDebug"}, + {300, nullptr, "TerminateAllRunningApplicationsForDebug"}, + {900, nullptr, "GetGrcProcessLaunchedSystemEvent"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +IDebugFunctions::~IDebugFunctions() = default; + +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/debug_functions.h b/src/core/hle/service/am/service/debug_functions.h new file mode 100644 index 0000000000..381499e93d --- /dev/null +++ b/src/core/hle/service/am/service/debug_functions.h @@ -0,0 +1,19 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/service.h" + +namespace Service::AM { + +class IDebugFunctions final : public ServiceFramework { +public: + explicit IDebugFunctions(Core::System& system_); + ~IDebugFunctions() override; +}; + +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/display_controller.cpp b/src/core/hle/service/am/service/display_controller.cpp index eb95dd1b86..8f87327b17 100644 --- a/src/core/hle/service/am/service/display_controller.cpp +++ b/src/core/hle/service/am/service/display_controller.cpp @@ -12,42 +12,42 @@ namespace Service::AM { -std::optional IDisplayController::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetLastForegroundCaptureImage"}, - FunctionInfo{1, nullptr, "UpdateLastForegroundCaptureImage"}, - FunctionInfo{2, nullptr, "GetLastApplicationCaptureImage"}, - FunctionInfo{3, nullptr, "GetCallerAppletCaptureImage"}, - FunctionInfo{4, nullptr, "UpdateCallerAppletCaptureImage"}, - FunctionInfo{5, D<&IDisplayController::GetLastForegroundCaptureImageEx>, "GetLastForegroundCaptureImageEx"}, - FunctionInfo{6, nullptr, "GetLastApplicationCaptureImageEx"}, - FunctionInfo{7, D<&IDisplayController::GetCallerAppletCaptureImageEx>, "GetCallerAppletCaptureImageEx"}, - FunctionInfo{8, D<&IDisplayController::TakeScreenShotOfOwnLayer>, "TakeScreenShotOfOwnLayer"}, - FunctionInfo{9, nullptr, "CopyBetweenCaptureBuffers"}, - FunctionInfo{10, nullptr, "AcquireLastApplicationCaptureBuffer"}, - FunctionInfo{11, nullptr, "ReleaseLastApplicationCaptureBuffer"}, - FunctionInfo{12, nullptr, "AcquireLastForegroundCaptureBuffer"}, - FunctionInfo{13, nullptr, "ReleaseLastForegroundCaptureBuffer"}, - FunctionInfo{14, nullptr, "AcquireCallerAppletCaptureBuffer"}, - FunctionInfo{15, nullptr, "ReleaseCallerAppletCaptureBuffer"}, - FunctionInfo{16, nullptr, "AcquireLastApplicationCaptureBufferEx"}, - FunctionInfo{17, nullptr, "AcquireLastForegroundCaptureBufferEx"}, - FunctionInfo{18, nullptr, "AcquireCallerAppletCaptureBufferEx"}, - FunctionInfo{20, D<&IDisplayController::ClearCaptureBuffer>, "ClearCaptureBuffer"}, - FunctionInfo{21, nullptr, "ClearAppletTransitionBuffer"}, - FunctionInfo{22, D<&IDisplayController::AcquireLastApplicationCaptureSharedBuffer>, "AcquireLastApplicationCaptureSharedBuffer"}, - FunctionInfo{23, D<&IDisplayController::ReleaseLastApplicationCaptureSharedBuffer>, "ReleaseLastApplicationCaptureSharedBuffer"}, - FunctionInfo{24, D<&IDisplayController::AcquireLastForegroundCaptureSharedBuffer>, "AcquireLastForegroundCaptureSharedBuffer"}, - FunctionInfo{25, D<&IDisplayController::ReleaseLastForegroundCaptureSharedBuffer>, "ReleaseLastForegroundCaptureSharedBuffer"}, - FunctionInfo{26, D<&IDisplayController::AcquireCallerAppletCaptureSharedBuffer>, "AcquireCallerAppletCaptureSharedBuffer"}, - FunctionInfo{27, D<&IDisplayController::ReleaseCallerAppletCaptureSharedBuffer>, "ReleaseCallerAppletCaptureSharedBuffer"}, - FunctionInfo{28, nullptr, "TakeScreenShotOfOwnLayerEx"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IDisplayController::IDisplayController(Core::System& system_, std::shared_ptr applet_) : ServiceFramework{system_, "IDisplayController"}, applet(std::move(applet_)) { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetLastForegroundCaptureImage"}, + {1, nullptr, "UpdateLastForegroundCaptureImage"}, + {2, nullptr, "GetLastApplicationCaptureImage"}, + {3, nullptr, "GetCallerAppletCaptureImage"}, + {4, nullptr, "UpdateCallerAppletCaptureImage"}, + {5, D<&IDisplayController::GetLastForegroundCaptureImageEx>, "GetLastForegroundCaptureImageEx"}, + {6, nullptr, "GetLastApplicationCaptureImageEx"}, + {7, D<&IDisplayController::GetCallerAppletCaptureImageEx>, "GetCallerAppletCaptureImageEx"}, + {8, D<&IDisplayController::TakeScreenShotOfOwnLayer>, "TakeScreenShotOfOwnLayer"}, + {9, nullptr, "CopyBetweenCaptureBuffers"}, + {10, nullptr, "AcquireLastApplicationCaptureBuffer"}, + {11, nullptr, "ReleaseLastApplicationCaptureBuffer"}, + {12, nullptr, "AcquireLastForegroundCaptureBuffer"}, + {13, nullptr, "ReleaseLastForegroundCaptureBuffer"}, + {14, nullptr, "AcquireCallerAppletCaptureBuffer"}, + {15, nullptr, "ReleaseCallerAppletCaptureBuffer"}, + {16, nullptr, "AcquireLastApplicationCaptureBufferEx"}, + {17, nullptr, "AcquireLastForegroundCaptureBufferEx"}, + {18, nullptr, "AcquireCallerAppletCaptureBufferEx"}, + {20, D<&IDisplayController::ClearCaptureBuffer>, "ClearCaptureBuffer"}, + {21, nullptr, "ClearAppletTransitionBuffer"}, + {22, D<&IDisplayController::AcquireLastApplicationCaptureSharedBuffer>, "AcquireLastApplicationCaptureSharedBuffer"}, + {23, D<&IDisplayController::ReleaseLastApplicationCaptureSharedBuffer>, "ReleaseLastApplicationCaptureSharedBuffer"}, + {24, D<&IDisplayController::AcquireLastForegroundCaptureSharedBuffer>, "AcquireLastForegroundCaptureSharedBuffer"}, + {25, D<&IDisplayController::ReleaseLastForegroundCaptureSharedBuffer>, "ReleaseLastForegroundCaptureSharedBuffer"}, + {26, D<&IDisplayController::AcquireCallerAppletCaptureSharedBuffer>, "AcquireCallerAppletCaptureSharedBuffer"}, + {27, D<&IDisplayController::ReleaseCallerAppletCaptureSharedBuffer>, "ReleaseCallerAppletCaptureSharedBuffer"}, + {28, nullptr, "TakeScreenShotOfOwnLayerEx"}, + }; + // clang-format on + + RegisterHandlers(functions); } IDisplayController::~IDisplayController() = default; diff --git a/src/core/hle/service/am/service/display_controller.h b/src/core/hle/service/am/service/display_controller.h index 03d29f93c5..35e98b9ad3 100644 --- a/src/core/hle/service/am/service/display_controller.h +++ b/src/core/hle/service/am/service/display_controller.h @@ -35,7 +35,6 @@ private: Out out_fbshare_layer_index); Result ReleaseLastApplicationCaptureSharedBuffer(); - std::optional FindRequest(u32 key) override; const std::shared_ptr applet; }; diff --git a/src/core/hle/service/am/service/global_state_controller.cpp b/src/core/hle/service/am/service/global_state_controller.cpp index be080ffcb3..e7cd60927c 100644 --- a/src/core/hle/service/am/service/global_state_controller.cpp +++ b/src/core/hle/service/am/service/global_state_controller.cpp @@ -10,28 +10,28 @@ namespace Service::AM { - std::optional IGlobalStateController::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "RequestToEnterSleep"}, - FunctionInfo{1, nullptr, "EnterSleep"}, - FunctionInfo{2, nullptr, "StartSleepSequence"}, - FunctionInfo{3, D<&IGlobalStateController::StartShutdownSequence>, "StartShutdownSequence"}, - FunctionInfo{4, D<&IGlobalStateController::StartRebootSequence>, "StartRebootSequence"}, - FunctionInfo{9, nullptr, "IsAutoPowerDownRequested"}, - FunctionInfo{10, D<&IGlobalStateController::LoadAndApplyIdlePolicySettings>, "LoadAndApplyIdlePolicySettings"}, - FunctionInfo{11, nullptr, "NotifyCecSettingsChanged"}, - FunctionInfo{12, nullptr, "SetDefaultHomeButtonLongPressTime"}, - FunctionInfo{13, nullptr, "UpdateDefaultDisplayResolution"}, - FunctionInfo{14, D<&IGlobalStateController::ShouldSleepOnBoot>, "ShouldSleepOnBoot"}, - FunctionInfo{15, D<&IGlobalStateController::GetHdcpAuthenticationFailedEvent>, "GetHdcpAuthenticationFailedEvent"}, - FunctionInfo{30, D<&IGlobalStateController::OpenCradleFirmwareUpdater>, "OpenCradleFirmwareUpdater"} - ); - return HandlerTableGenerateWithFind(key, functions); - } - IGlobalStateController::IGlobalStateController(Core::System& system_) : ServiceFramework{system_, "IGlobalStateController"}, m_context{system_, "IGlobalStateController"}, m_hdcp_authentication_failed_event{m_context} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "RequestToEnterSleep"}, + {1, nullptr, "EnterSleep"}, + {2, nullptr, "StartSleepSequence"}, + {3, D<&IGlobalStateController::StartShutdownSequence>, "StartShutdownSequence"}, + {4, D<&IGlobalStateController::StartRebootSequence>, "StartRebootSequence"}, + {9, nullptr, "IsAutoPowerDownRequested"}, + {10, D<&IGlobalStateController::LoadAndApplyIdlePolicySettings>, "LoadAndApplyIdlePolicySettings"}, + {11, nullptr, "NotifyCecSettingsChanged"}, + {12, nullptr, "SetDefaultHomeButtonLongPressTime"}, + {13, nullptr, "UpdateDefaultDisplayResolution"}, + {14, D<&IGlobalStateController::ShouldSleepOnBoot>, "ShouldSleepOnBoot"}, + {15, D<&IGlobalStateController::GetHdcpAuthenticationFailedEvent>, "GetHdcpAuthenticationFailedEvent"}, + {30, D<&IGlobalStateController::OpenCradleFirmwareUpdater>, "OpenCradleFirmwareUpdater"}, + }; + // clang-format on + + RegisterHandlers(functions); } Result IGlobalStateController::StartShutdownSequence() { diff --git a/src/core/hle/service/am/service/global_state_controller.h b/src/core/hle/service/am/service/global_state_controller.h index 0de1415295..012692ecd8 100644 --- a/src/core/hle/service/am/service/global_state_controller.h +++ b/src/core/hle/service/am/service/global_state_controller.h @@ -26,9 +26,9 @@ private: Result LoadAndApplyIdlePolicySettings(); Result ShouldSleepOnBoot(Out out_should_sleep_on_boot); Result GetHdcpAuthenticationFailedEvent(OutCopyHandle out_event); - Result OpenCradleFirmwareUpdater(Out> out_cradle_firmware_updater); + Result OpenCradleFirmwareUpdater( + Out> out_cradle_firmware_updater); - std::optional FindRequest(u32 key) override; KernelHelpers::ServiceContext m_context; Event m_hdcp_authentication_failed_event; }; diff --git a/src/core/hle/service/am/service/home_menu_functions.cpp b/src/core/hle/service/am/service/home_menu_functions.cpp index 5f61c842a2..f9d402ca99 100644 --- a/src/core/hle/service/am/service/home_menu_functions.cpp +++ b/src/core/hle/service/am/service/home_menu_functions.cpp @@ -14,31 +14,31 @@ namespace Service::AM { -std::optional IHomeMenuFunctions::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{10, D<&IHomeMenuFunctions::RequestToGetForeground>, "RequestToGetForeground"}, - FunctionInfo{11, D<&IHomeMenuFunctions::LockForeground>, "LockForeground"}, - FunctionInfo{12, D<&IHomeMenuFunctions::UnlockForeground>, "UnlockForeground"}, - FunctionInfo{20, D<&IHomeMenuFunctions::PopFromGeneralChannel>, "PopFromGeneralChannel"}, - FunctionInfo{21, D<&IHomeMenuFunctions::GetPopFromGeneralChannelEvent>, "GetPopFromGeneralChannelEvent"}, - FunctionInfo{30, nullptr, "GetHomeButtonWriterLockAccessor"}, - FunctionInfo{31, nullptr, "GetWriterLockAccessorEx"}, - FunctionInfo{40, D<&IHomeMenuFunctions::IsSleepEnabled>, "IsSleepEnabled"}, - FunctionInfo{41, D<&IHomeMenuFunctions::IsRebootEnabled>, "IsRebootEnabled"}, - FunctionInfo{50, nullptr, "LaunchSystemApplet"}, - FunctionInfo{51, nullptr, "LaunchStarter"}, - FunctionInfo{100, nullptr, "PopRequestLaunchApplicationForDebug"}, - FunctionInfo{110, D<&IHomeMenuFunctions::IsForceTerminateApplicationDisabledForDebug>, "IsForceTerminateApplicationDisabledForDebug"}, - FunctionInfo{200, nullptr, "LaunchDevMenu"}, - FunctionInfo{1000, nullptr, "SetLastApplicationExitReason"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_, std::shared_ptr applet, WindowSystem& window_system) : ServiceFramework{system_, "IHomeMenuFunctions"}, m_window_system{window_system}, m_applet{std::move(applet)}, m_context{system, "IHomeMenuFunctions"} { + // clang-format off + static const FunctionInfo functions[] = { + {10, D<&IHomeMenuFunctions::RequestToGetForeground>, "RequestToGetForeground"}, + {11, D<&IHomeMenuFunctions::LockForeground>, "LockForeground"}, + {12, D<&IHomeMenuFunctions::UnlockForeground>, "UnlockForeground"}, + {20, D<&IHomeMenuFunctions::PopFromGeneralChannel>, "PopFromGeneralChannel"}, + {21, D<&IHomeMenuFunctions::GetPopFromGeneralChannelEvent>, "GetPopFromGeneralChannelEvent"}, + {30, nullptr, "GetHomeButtonWriterLockAccessor"}, + {31, nullptr, "GetWriterLockAccessorEx"}, + {40, D<&IHomeMenuFunctions::IsSleepEnabled>, "IsSleepEnabled"}, + {41, D<&IHomeMenuFunctions::IsRebootEnabled>, "IsRebootEnabled"}, + {50, nullptr, "LaunchSystemApplet"}, + {51, nullptr, "LaunchStarter"}, + {100, nullptr, "PopRequestLaunchApplicationForDebug"}, + {110, D<&IHomeMenuFunctions::IsForceTerminateApplicationDisabledForDebug>, "IsForceTerminateApplicationDisabledForDebug"}, + {200, nullptr, "LaunchDevMenu"}, + {1000, nullptr, "SetLastApplicationExitReason"}, + }; + // clang-format on + + RegisterHandlers(functions); } IHomeMenuFunctions::~IHomeMenuFunctions() = default; diff --git a/src/core/hle/service/am/service/home_menu_functions.h b/src/core/hle/service/am/service/home_menu_functions.h index 25eb9db45e..2c3ef54375 100644 --- a/src/core/hle/service/am/service/home_menu_functions.h +++ b/src/core/hle/service/am/service/home_menu_functions.h @@ -34,7 +34,6 @@ private: Result IsForceTerminateApplicationDisabledForDebug( Out out_is_force_terminate_application_disabled_for_debug); - std::optional FindRequest(u32 key) override; WindowSystem& m_window_system; const std::shared_ptr m_applet; KernelHelpers::ServiceContext m_context; diff --git a/src/core/hle/service/am/service/library_applet_accessor.cpp b/src/core/hle/service/am/service/library_applet_accessor.cpp index c5386fb1a1..849e5794cf 100644 --- a/src/core/hle/service/am/service/library_applet_accessor.cpp +++ b/src/core/hle/service/am/service/library_applet_accessor.cpp @@ -17,7 +17,9 @@ namespace Service::AM { -static void EnableSingleUserPlay(const std::shared_ptr& impl) { +namespace { + +void EnableSingleUserPlay(const std::shared_ptr& impl) { constexpr s64 DisplayOptionsOffset = 0x90; constexpr s64 IsSkipEnabledOffset = 1; constexpr s64 ShowSkipButtonOffset = 4; @@ -27,7 +29,7 @@ static void EnableSingleUserPlay(const std::shared_ptr& im impl->Write(DisplayOptionsOffset + ShowSkipButtonOffset, &enabled, sizeof(enabled)); } -static void ReplaceEmptyUuidWithCurrentUser(const std::shared_ptr& impl) { +void ReplaceEmptyUuidWithCurrentUser(const std::shared_ptr& impl) { Frontend::UiReturnArg return_arg{}; impl->Read(0, &return_arg, sizeof(return_arg)); @@ -45,40 +47,42 @@ static void ReplaceEmptyUuidWithCurrentUser(const std::shared_ptr ILibraryAppletAccessor::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&ILibraryAppletAccessor::GetAppletStateChangedEvent>, "GetAppletStateChangedEvent"}, - FunctionInfo{1, D<&ILibraryAppletAccessor::IsCompleted>, "IsCompleted"}, - FunctionInfo{10, D<&ILibraryAppletAccessor::Start>, "Start"}, - FunctionInfo{20, D<&ILibraryAppletAccessor::RequestExit>, "RequestExit"}, - FunctionInfo{25, D<&ILibraryAppletAccessor::Terminate>, "Terminate"}, - FunctionInfo{30, D<&ILibraryAppletAccessor::GetResult>, "GetResult"}, - FunctionInfo{50, nullptr, "SetOutOfFocusApplicationSuspendingEnabled"}, - FunctionInfo{60, D<&ILibraryAppletAccessor::PresetLibraryAppletGpuTimeSliceZero>, "PresetLibraryAppletGpuTimeSliceZero", MakeVersionGate({10,0,0})}, - FunctionInfo{80, nullptr, "RequestForLibraryAppletToGetForeground", MakeVersionGate({19,0,0})}, - FunctionInfo{81, nullptr, "GetCurrentChildLibraryApplet", MakeVersionGate({19,0,0})}, - FunctionInfo{90, D<&ILibraryAppletAccessor::Unknown90>, "Unknown90", MakeVersionGate({20,0,0})}, - FunctionInfo{100, D<&ILibraryAppletAccessor::PushInData>, "PushInData"}, - FunctionInfo{101, D<&ILibraryAppletAccessor::PopOutData>, "PopOutData"}, - FunctionInfo{102, nullptr, "PushExtraStorage"}, - FunctionInfo{103, D<&ILibraryAppletAccessor::PushInteractiveInData>, "PushInteractiveInData"}, - FunctionInfo{104, D<&ILibraryAppletAccessor::PopInteractiveOutData>, "PopInteractiveOutData"}, - FunctionInfo{105, D<&ILibraryAppletAccessor::GetPopOutDataEvent>, "GetPopOutDataEvent"}, - FunctionInfo{106, D<&ILibraryAppletAccessor::GetPopInteractiveOutDataEvent>, "GetPopInteractiveOutDataEvent"}, - FunctionInfo{110, nullptr, "NeedsToExitProcess"}, - FunctionInfo{120, D<&ILibraryAppletAccessor::GetLibraryAppletInfo>, "GetLibraryAppletInfo"}, - FunctionInfo{150, nullptr, "RequestForAppletToGetForeground"}, - FunctionInfo{160, D<&ILibraryAppletAccessor::GetIndirectLayerConsumerHandle>, "GetIndirectLayerConsumerHandle", MakeVersionGate({2,0,0})}, - FunctionInfo{170, D<&ILibraryAppletAccessor::Unknown170>, "Unknown170", MakeVersionGate({22,0,0})} - ); - return HandlerTableGenerateWithFind(key, functions); - } +} // namespace ILibraryAppletAccessor::ILibraryAppletAccessor(Core::System& system_, std::shared_ptr broker, std::shared_ptr applet) : ServiceFramework{system_, "ILibraryAppletAccessor"}, m_broker{std::move(broker)}, m_applet{std::move(applet)} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&ILibraryAppletAccessor::GetAppletStateChangedEvent>, "GetAppletStateChangedEvent"}, + {1, D<&ILibraryAppletAccessor::IsCompleted>, "IsCompleted"}, + {10, D<&ILibraryAppletAccessor::Start>, "Start"}, + {20, D<&ILibraryAppletAccessor::RequestExit>, "RequestExit"}, + {25, D<&ILibraryAppletAccessor::Terminate>, "Terminate"}, + {30, D<&ILibraryAppletAccessor::GetResult>, "GetResult"}, + {50, nullptr, "SetOutOfFocusApplicationSuspendingEnabled"}, + {60, D<&ILibraryAppletAccessor::PresetLibraryAppletGpuTimeSliceZero>, "PresetLibraryAppletGpuTimeSliceZero"}, //10.0.0+ + {80, nullptr, "RequestForLibraryAppletToGetForeground"}, //19.0.0+ + {81, nullptr, "GetCurrentChildLibraryApplet"}, //19.0.0+ + {90, D<&ILibraryAppletAccessor::Unknown90>, "Unknown90"}, //20.0.0+ + {100, D<&ILibraryAppletAccessor::PushInData>, "PushInData"}, + {101, D<&ILibraryAppletAccessor::PopOutData>, "PopOutData"}, + {102, nullptr, "PushExtraStorage"}, + {103, D<&ILibraryAppletAccessor::PushInteractiveInData>, "PushInteractiveInData"}, + {104, D<&ILibraryAppletAccessor::PopInteractiveOutData>, "PopInteractiveOutData"}, + {105, D<&ILibraryAppletAccessor::GetPopOutDataEvent>, "GetPopOutDataEvent"}, + {106, D<&ILibraryAppletAccessor::GetPopInteractiveOutDataEvent>, "GetPopInteractiveOutDataEvent"}, + {110, nullptr, "NeedsToExitProcess"}, + {120, D<&ILibraryAppletAccessor::GetLibraryAppletInfo>, "GetLibraryAppletInfo"}, + {150, nullptr, "RequestForAppletToGetForeground"}, + {160, D<&ILibraryAppletAccessor::GetIndirectLayerConsumerHandle>, "GetIndirectLayerConsumerHandle"}, //2.0.0+ + {170, D<&ILibraryAppletAccessor::Unknown170>, "Unknown170"}, //22.0.0+ + }; + // clang-format on + + RegisterHandlers(functions); } ILibraryAppletAccessor::~ILibraryAppletAccessor() = default; diff --git a/src/core/hle/service/am/service/library_applet_accessor.h b/src/core/hle/service/am/service/library_applet_accessor.h index e14ddb3bde..ad40bc76c7 100644 --- a/src/core/hle/service/am/service/library_applet_accessor.h +++ b/src/core/hle/service/am/service/library_applet_accessor.h @@ -6,6 +6,7 @@ #pragma once +#include "core/hle/service/am/service/library_applet_self_accessor.h" #include "core/hle/service/cmif_types.h" #include "core/hle/service/service.h" @@ -15,26 +16,6 @@ class AppletDataBroker; struct Applet; class IStorage; -struct LibraryAppletInfo { - AppletId applet_id; - LibraryAppletMode library_applet_mode; -}; -static_assert(sizeof(LibraryAppletInfo) == 0x8, "LibraryAppletInfo has incorrect size."); - -struct ErrorCode { - u32 category; - u32 number; -}; -static_assert(sizeof(ErrorCode) == 0x8, "ErrorCode has incorrect size."); - -struct ErrorContext { - u8 type; - INSERT_PADDING_BYTES_NOINIT(0x7); - std::array data; - Result result; -}; -static_assert(sizeof(ErrorContext) == 0x200, "ErrorContext has incorrect size."); - class ILibraryAppletAccessor final : public ServiceFramework { public: explicit ILibraryAppletAccessor(Core::System& system_, std::shared_ptr broker, @@ -68,7 +49,6 @@ private: void FrontendExecuteInteractive(); void FrontendRequestExit(); - std::optional FindRequest(u32 key) override; const std::shared_ptr m_broker; const std::shared_ptr m_applet; }; diff --git a/src/core/hle/service/am/service/library_applet_creator.cpp b/src/core/hle/service/am/service/library_applet_creator.cpp new file mode 100644 index 0000000000..4ee92908b5 --- /dev/null +++ b/src/core/hle/service/am/service/library_applet_creator.cpp @@ -0,0 +1,287 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "common/settings.h" +#include "core/hle/kernel/k_transfer_memory.h" +#include "core/hle/service/am/applet_data_broker.h" +#include "core/hle/service/am/applet_manager.h" +#include "core/hle/service/am/frontend/applets.h" +#include "core/hle/service/am/library_applet_storage.h" +#include "core/hle/service/am/process_creation.h" +#include "core/hle/service/am/service/library_applet_accessor.h" +#include "core/hle/service/am/service/library_applet_creator.h" + +#include "core/hle/api_version.h" +#include "core/hle/service/am/service/storage.h" +#include "core/hle/service/am/window_system.h" +#include "core/hle/service/cmif_serialization.h" +#include "core/hle/service/sm/sm.h" + +namespace Service::AM { + +namespace { + +bool ShouldCreateGuestApplet(AppletId applet_id) { +#define X(Name, name) \ + if (applet_id == AppletId::Name && \ + Settings::values.name##_applet_mode.GetValue() != Settings::AppletMode::LLE) { \ + return false; \ + } + + X(Cabinet, cabinet) + X(Controller, controller) + X(DataErase, data_erase) + X(Error, error) + X(NetConnect, net_connect) + X(ProfileSelect, player_select) + X(SoftwareKeyboard, swkbd) + X(MiiEdit, mii_edit) + X(Web, web) + X(Shop, shop) + X(PhotoViewer, photo_viewer) + X(OfflineWeb, offline_web) + X(LoginShare, login_share) + X(WebAuth, wifi_web_auth) + X(MyPage, my_page) + +#undef X + + return true; +} + +AppletProgramId AppletIdToProgramId(AppletId applet_id) { + switch (applet_id) { + case AppletId::OverlayDisplay: + return AppletProgramId::OverlayDisplay; + case AppletId::QLaunch: + return AppletProgramId::QLaunch; + case AppletId::Starter: + return AppletProgramId::Starter; + case AppletId::Auth: + return AppletProgramId::Auth; + case AppletId::Cabinet: + return AppletProgramId::Cabinet; + case AppletId::Controller: + return AppletProgramId::Controller; + case AppletId::DataErase: + return AppletProgramId::DataErase; + case AppletId::Error: + return AppletProgramId::Error; + case AppletId::NetConnect: + return AppletProgramId::NetConnect; + case AppletId::ProfileSelect: + return AppletProgramId::ProfileSelect; + case AppletId::SoftwareKeyboard: + return AppletProgramId::SoftwareKeyboard; + case AppletId::MiiEdit: + return AppletProgramId::MiiEdit; + case AppletId::Web: + return AppletProgramId::Web; + case AppletId::Shop: + return AppletProgramId::Shop; + case AppletId::PhotoViewer: + return AppletProgramId::PhotoViewer; + case AppletId::Settings: + return AppletProgramId::Settings; + case AppletId::OfflineWeb: + return AppletProgramId::OfflineWeb; + case AppletId::LoginShare: + return AppletProgramId::LoginShare; + case AppletId::WebAuth: + return AppletProgramId::WebAuth; + case AppletId::MyPage: + return AppletProgramId::MyPage; + default: + return static_cast(0); + } +} + +std::shared_ptr CreateGuestApplet(Core::System& system, + WindowSystem& window_system, + std::shared_ptr caller_applet, + AppletId applet_id, + LibraryAppletMode mode) { + const auto program_id = static_cast(AppletIdToProgramId(applet_id)); + if (program_id == 0) { + // Unknown applet + return {}; + } + + auto process = CreateProcess(system, program_id, 1, HLE::ApiVersion::HOS_VERSION_MAJOR); + if (process) { + const auto applet = std::make_shared(system, std::move(process), false); + applet->program_id = program_id; + applet->applet_id = applet_id; + applet->type = AppletType::LibraryApplet; + applet->library_applet_mode = mode; + applet->window_visible = mode != LibraryAppletMode::AllForegroundInitiallyHidden; + + auto broker = std::make_shared(system); + applet->caller_applet = caller_applet; + applet->caller_applet_broker = broker; + { + std::scoped_lock lk{caller_applet->lock}; + caller_applet->child_applets.push_back(applet); + } + window_system.TrackApplet(applet, false); + return std::make_shared(system, broker, applet); + } + // Couldn't initialize the guest process + return {}; +} + +std::shared_ptr CreateFrontendApplet(Core::System& system, + WindowSystem& window_system, + std::shared_ptr caller_applet, + AppletId applet_id, + LibraryAppletMode mode) { + const auto program_id = static_cast(AppletIdToProgramId(applet_id)); + + auto process = std::make_unique(system); + auto applet = std::make_shared(system, std::move(process), false); + applet->program_id = program_id; + applet->applet_id = applet_id; + applet->type = AppletType::LibraryApplet; + applet->library_applet_mode = mode; + + auto storage = std::make_shared(system); + applet->caller_applet = caller_applet; + applet->caller_applet_broker = storage; + applet->frontend = system.GetFrontendAppletHolder().GetApplet(applet, applet_id, mode); + { + std::scoped_lock lk{caller_applet->lock}; + caller_applet->child_applets.push_back(applet); + } + return std::make_shared(system, storage, applet); +} + +} // namespace + +ILibraryAppletCreator::ILibraryAppletCreator(Core::System& system_, std::shared_ptr applet, + WindowSystem& window_system) + : ServiceFramework{system_, "ILibraryAppletCreator"}, + m_window_system{window_system}, m_applet{std::move(applet)} { + static const FunctionInfo functions[] = { + {0, D<&ILibraryAppletCreator::CreateLibraryApplet>, "CreateLibraryApplet"}, + {1, nullptr, "TerminateAllLibraryApplets"}, + {2, nullptr, "AreAnyLibraryAppletsLeft"}, + {3, D<&ILibraryAppletCreator::CreateLibraryAppletEx>, "CreateLibraryAppletEx"}, + {10, D<&ILibraryAppletCreator::CreateStorage>, "CreateStorage"}, + {11, D<&ILibraryAppletCreator::CreateTransferMemoryStorage>, "CreateTransferMemoryStorage"}, + {12, D<&ILibraryAppletCreator::CreateHandleStorage>, "CreateHandleStorage"}, + }; + RegisterHandlers(functions); +} + +ILibraryAppletCreator::~ILibraryAppletCreator() = default; + +Result ILibraryAppletCreator::CreateLibraryApplet( + Out> out_library_applet_accessor, AppletId applet_id, + LibraryAppletMode library_applet_mode) { + LOG_DEBUG(Service_AM, "called with applet_id={} applet_mode={}", applet_id, + library_applet_mode); + + std::shared_ptr library_applet; + if (ShouldCreateGuestApplet(applet_id)) { + library_applet = + CreateGuestApplet(system, m_window_system, m_applet, applet_id, library_applet_mode); + } + if (!library_applet) { + library_applet = + CreateFrontendApplet(system, m_window_system, m_applet, applet_id, library_applet_mode); + } + if (!library_applet) { + LOG_ERROR(Service_AM, "Applet doesn't exist! applet_id={}", applet_id); + R_THROW(ResultUnknown); + } + + // Applet is created, can now be launched. + m_applet->library_applet_launchable_event.Signal(system.Kernel()); + *out_library_applet_accessor = library_applet; + R_SUCCEED(); +} + +Result ILibraryAppletCreator::CreateLibraryAppletEx( + Out> out_library_applet_accessor, AppletId applet_id, + LibraryAppletMode library_applet_mode, u64 thread_id) { + LOG_DEBUG(Service_AM, "called with applet_id={} applet_mode={} thread_id={}", applet_id, + library_applet_mode, thread_id); + + std::shared_ptr library_applet; + if (ShouldCreateGuestApplet(applet_id)) { + library_applet = + CreateGuestApplet(system, m_window_system, m_applet, applet_id, library_applet_mode); + } + if (!library_applet) { + library_applet = + CreateFrontendApplet(system, m_window_system, m_applet, applet_id, library_applet_mode); + } + if (!library_applet) { + LOG_ERROR(Service_AM, "Applet doesn't exist! applet_id={}", applet_id); + R_THROW(ResultUnknown); + } + + // Applet is created, can now be launched. + m_applet->library_applet_launchable_event.Signal(system.Kernel()); + *out_library_applet_accessor = library_applet; + R_SUCCEED(); +} + +Result ILibraryAppletCreator::CreateStorage(Out> out_storage, s64 size) { + LOG_DEBUG(Service_AM, "called, size={}", size); + + if (size <= 0) { + LOG_ERROR(Service_AM, "size is less than or equal to 0"); + R_THROW(ResultUnknown); + } + + *out_storage = std::make_shared(system, AM::CreateStorage(std::vector(size))); + R_SUCCEED(); +} + +Result ILibraryAppletCreator::CreateTransferMemoryStorage( + Out> out_storage, bool is_writable, s64 size, + InCopyHandle transfer_memory_handle) { + LOG_DEBUG(Service_AM, "called, is_writable={} size={}", is_writable, size); + + if (size <= 0) { + LOG_ERROR(Service_AM, "size is less than or equal to 0"); + R_THROW(ResultUnknown); + } + + if (!transfer_memory_handle) { + LOG_ERROR(Service_AM, "transfer_memory_handle is null"); + R_THROW(ResultUnknown); + } + + *out_storage = std::make_shared( + system, AM::CreateTransferMemoryStorage(system.Kernel(), transfer_memory_handle->GetOwner()->GetMemory(), + transfer_memory_handle.Get(), is_writable, size)); + R_SUCCEED(); +} + +Result ILibraryAppletCreator::CreateHandleStorage( + Out> out_storage, s64 size, + InCopyHandle transfer_memory_handle) { + LOG_DEBUG(Service_AM, "called, size={}", size); + + if (size <= 0) { + LOG_ERROR(Service_AM, "size is less than or equal to 0"); + R_THROW(ResultUnknown); + } + + if (!transfer_memory_handle) { + LOG_ERROR(Service_AM, "transfer_memory_handle is null"); + R_THROW(ResultUnknown); + } + + *out_storage = std::make_shared( + system, AM::CreateHandleStorage(system.Kernel(), transfer_memory_handle->GetOwner()->GetMemory(), + transfer_memory_handle.Get(), size)); + R_SUCCEED(); +} + +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/library_applet_creator.h b/src/core/hle/service/am/service/library_applet_creator.h new file mode 100644 index 0000000000..1c7f930055 --- /dev/null +++ b/src/core/hle/service/am/service/library_applet_creator.h @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/am/am_types.h" +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/service.h" + +namespace Service::AM { + +struct Applet; +class ILibraryAppletAccessor; +class IStorage; +class WindowSystem; + +class ILibraryAppletCreator final : public ServiceFramework { +public: + explicit ILibraryAppletCreator(Core::System& system_, std::shared_ptr applet, + WindowSystem& window_system); + ~ILibraryAppletCreator() override; + +private: + Result CreateLibraryApplet( + Out> out_library_applet_accessor, AppletId applet_id, + LibraryAppletMode library_applet_mode); + Result CreateLibraryAppletEx( + Out> out_library_applet_accessor, AppletId applet_id, + LibraryAppletMode library_applet_mode, u64 thread_id); + Result CreateStorage(Out> out_storage, s64 size); + Result CreateTransferMemoryStorage( + Out> out_storage, bool is_writable, s64 size, + InCopyHandle transfer_memory_handle); + Result CreateHandleStorage(Out> out_storage, s64 size, + InCopyHandle transfer_memory_handle); + + WindowSystem& m_window_system; + const std::shared_ptr m_applet; +}; + +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/library_applet_proxy.cpp b/src/core/hle/service/am/service/library_applet_proxy.cpp new file mode 100644 index 0000000000..567ff75797 --- /dev/null +++ b/src/core/hle/service/am/service/library_applet_proxy.cpp @@ -0,0 +1,137 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/hle/service/am/service/applet_common_functions.h" +#include "core/hle/service/am/service/audio_controller.h" +#include "core/hle/service/am/service/common_state_getter.h" +#include "core/hle/service/am/service/debug_functions.h" +#include "core/hle/service/am/service/display_controller.h" +#include "core/hle/service/am/service/global_state_controller.h" +#include "core/hle/service/am/service/home_menu_functions.h" +#include "core/hle/service/am/service/library_applet_creator.h" +#include "core/hle/service/am/service/library_applet_proxy.h" +#include "core/hle/service/am/service/library_applet_self_accessor.h" +#include "core/hle/service/am/service/process_winding_controller.h" +#include "core/hle/service/am/service/self_controller.h" +#include "core/hle/service/am/service/window_controller.h" +#include "core/hle/service/cmif_serialization.h" + +namespace Service::AM { + +ILibraryAppletProxy::ILibraryAppletProxy(Core::System& system_, std::shared_ptr applet, + Kernel::KProcess* process, WindowSystem& window_system) + : ServiceFramework{system_, "ILibraryAppletProxy"}, + m_window_system{window_system}, m_process{process}, m_applet{std::move(applet)} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&ILibraryAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"}, + {1, D<&ILibraryAppletProxy::GetSelfController>, "GetSelfController"}, + {2, D<&ILibraryAppletProxy::GetWindowController>, "GetWindowController"}, + {3, D<&ILibraryAppletProxy::GetAudioController>, "GetAudioController"}, + {4, D<&ILibraryAppletProxy::GetDisplayController>, "GetDisplayController"}, + {10, D<&ILibraryAppletProxy::GetProcessWindingController>, "GetProcessWindingController"}, + {11, D<&ILibraryAppletProxy::GetLibraryAppletCreator>, "GetLibraryAppletCreator"}, + {20, D<&ILibraryAppletProxy::OpenLibraryAppletSelfAccessor>, "OpenLibraryAppletSelfAccessor"}, + {21, D<&ILibraryAppletProxy::GetAppletCommonFunctions>, "GetAppletCommonFunctions"}, + {22, D<&ILibraryAppletProxy::GetHomeMenuFunctions>, "GetHomeMenuFunctions"}, + {23, D<&ILibraryAppletProxy::GetGlobalStateController>, "GetGlobalStateController"}, + {1000, D<&ILibraryAppletProxy::GetDebugFunctions>, "GetDebugFunctions"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +ILibraryAppletProxy::~ILibraryAppletProxy() = default; + +Result ILibraryAppletProxy::GetAudioController( + Out> out_audio_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_audio_controller = std::make_shared(system); + R_SUCCEED(); +} + +Result ILibraryAppletProxy::GetDisplayController( + Out> out_display_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_display_controller = std::make_shared(system, m_applet); + R_SUCCEED(); +} + +Result ILibraryAppletProxy::GetProcessWindingController( + Out> out_process_winding_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_process_winding_controller = std::make_shared(system, m_applet); + R_SUCCEED(); +} + +Result ILibraryAppletProxy::GetDebugFunctions( + Out> out_debug_functions) { + LOG_DEBUG(Service_AM, "called"); + *out_debug_functions = std::make_shared(system); + R_SUCCEED(); +} + +Result ILibraryAppletProxy::GetWindowController( + Out> out_window_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_window_controller = std::make_shared(system, m_applet, m_window_system); + R_SUCCEED(); +} + +Result ILibraryAppletProxy::GetSelfController( + Out> out_self_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_self_controller = std::make_shared(system, m_applet, m_process); + R_SUCCEED(); +} + +Result ILibraryAppletProxy::GetCommonStateGetter( + Out> out_common_state_getter) { + LOG_DEBUG(Service_AM, "called"); + *out_common_state_getter = std::make_shared(system, m_applet); + R_SUCCEED(); +} + +Result ILibraryAppletProxy::GetLibraryAppletCreator( + Out> out_library_applet_creator) { + LOG_DEBUG(Service_AM, "called"); + *out_library_applet_creator = + std::make_shared(system, m_applet, m_window_system); + R_SUCCEED(); +} + +Result ILibraryAppletProxy::OpenLibraryAppletSelfAccessor( + Out> out_library_applet_self_accessor) { + LOG_DEBUG(Service_AM, "called"); + *out_library_applet_self_accessor = + std::make_shared(system, m_applet); + R_SUCCEED(); +} + +Result ILibraryAppletProxy::GetAppletCommonFunctions( + Out> out_applet_common_functions) { + LOG_DEBUG(Service_AM, "called"); + *out_applet_common_functions = std::make_shared(system, m_applet); + R_SUCCEED(); +} + +Result ILibraryAppletProxy::GetHomeMenuFunctions( + Out> out_home_menu_functions) { + LOG_DEBUG(Service_AM, "called"); + *out_home_menu_functions = + std::make_shared(system, m_applet, m_window_system); + R_SUCCEED(); +} + +Result ILibraryAppletProxy::GetGlobalStateController( + Out> out_global_state_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_global_state_controller = std::make_shared(system); + R_SUCCEED(); +} + +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/library_applet_proxy.h b/src/core/hle/service/am/service/library_applet_proxy.h new file mode 100644 index 0000000000..c659dbe187 --- /dev/null +++ b/src/core/hle/service/am/service/library_applet_proxy.h @@ -0,0 +1,59 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/service.h" + +namespace Service::AM { + +struct Applet; +class IAppletCommonFunctions; +class IAudioController; +class ICommonStateGetter; +class IDebugFunctions; +class IDisplayController; +class IHomeMenuFunctions; +class IGlobalStateController; +class ILibraryAppletCreator; +class ILibraryAppletSelfAccessor; +class IProcessWindingController; +class ISelfController; +class IWindowController; +class WindowSystem; + +class ILibraryAppletProxy final : public ServiceFramework { +public: + explicit ILibraryAppletProxy(Core::System& system_, std::shared_ptr applet, + Kernel::KProcess* process, WindowSystem& window_system); + ~ILibraryAppletProxy(); + +private: + Result GetAudioController(Out> out_audio_controller); + Result GetDisplayController(Out> out_display_controller); + Result GetProcessWindingController( + Out> out_process_winding_controller); + Result GetDebugFunctions(Out> out_debug_functions); + Result GetWindowController(Out> out_window_controller); + Result GetSelfController(Out> out_self_controller); + Result GetCommonStateGetter(Out> out_common_state_getter); + Result GetLibraryAppletCreator( + Out> out_library_applet_creator); + Result OpenLibraryAppletSelfAccessor( + Out> out_library_applet_self_accessor); + Result GetAppletCommonFunctions( + Out> out_applet_common_functions); + Result GetHomeMenuFunctions(Out> out_home_menu_functions); + Result GetGlobalStateController( + Out> out_global_state_controller); + + WindowSystem& m_window_system; + Kernel::KProcess* const m_process; + const std::shared_ptr m_applet; +}; + +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/library_applet_self_accessor.cpp b/src/core/hle/service/am/service/library_applet_self_accessor.cpp new file mode 100644 index 0000000000..907be49204 --- /dev/null +++ b/src/core/hle/service/am/service/library_applet_self_accessor.cpp @@ -0,0 +1,332 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/core_timing.h" +#include "core/file_sys/control_metadata.h" +#include "core/file_sys/patch_manager.h" +#include "core/file_sys/registered_cache.h" +#include "core/hle/service/acc/profile_manager.h" +#include "core/hle/service/am/applet_data_broker.h" +#include "core/hle/service/am/applet_manager.h" +#include "core/hle/service/am/frontend/applets.h" +#include "core/hle/service/am/service/library_applet_self_accessor.h" +#include "core/hle/service/am/service/storage.h" +#include "core/hle/service/cmif_serialization.h" +#include "core/hle/service/filesystem/filesystem.h" +#include "core/hle/service/glue/glue_manager.h" +#include "core/hle/service/ns/application_manager_interface.h" +#include "core/hle/service/ns/service_getter_interface.h" +#include "core/hle/service/sm/sm.h" + +namespace Service::AM { + +namespace { + +AppletIdentityInfo GetCallerIdentity(Applet& applet) { + if (const auto caller_applet = applet.caller_applet.lock(); caller_applet) { + // TODO: is this actually the application ID? + return { + .applet_id = caller_applet->applet_id, + .application_id = caller_applet->program_id, + }; + } else { + return { + .applet_id = AppletId::QLaunch, + .application_id = 0x0100000000001000ull, + }; + } +} + +} // namespace + +ILibraryAppletSelfAccessor::ILibraryAppletSelfAccessor(Core::System& system_, + std::shared_ptr applet) + : ServiceFramework{system_, "ILibraryAppletSelfAccessor"}, m_applet{std::move(applet)}, + m_broker{m_applet->caller_applet_broker} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&ILibraryAppletSelfAccessor::PopInData>, "PopInData"}, + {1, D<&ILibraryAppletSelfAccessor::PushOutData>, "PushOutData"}, + {2, D<&ILibraryAppletSelfAccessor::PopInteractiveInData>, "PopInteractiveInData"}, + {3, D<&ILibraryAppletSelfAccessor::PushInteractiveOutData>, "PushInteractiveOutData"}, + {5, D<&ILibraryAppletSelfAccessor::GetPopInDataEvent>, "GetPopInDataEvent"}, + {6, D<&ILibraryAppletSelfAccessor::GetPopInteractiveInDataEvent>, "GetPopInteractiveInDataEvent"}, + {10, D<&ILibraryAppletSelfAccessor::ExitProcessAndReturn>, "ExitProcessAndReturn"}, + {11, D<&ILibraryAppletSelfAccessor::GetLibraryAppletInfo>, "GetLibraryAppletInfo"}, + {12, D<&ILibraryAppletSelfAccessor::GetMainAppletIdentityInfo>, "GetMainAppletIdentityInfo"}, + {13, D<&ILibraryAppletSelfAccessor::CanUseApplicationCore>, "CanUseApplicationCore"}, + {14, D<&ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfo>, "GetCallerAppletIdentityInfo"}, + {15, D<&ILibraryAppletSelfAccessor::GetMainAppletApplicationControlProperty>, "GetMainAppletApplicationControlProperty"}, + {16, D<&ILibraryAppletSelfAccessor::GetMainAppletStorageId>, "GetMainAppletStorageId"}, + {17, D<&ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfoStack>, "GetCallerAppletIdentityInfoStack"}, + {18, nullptr, "GetNextReturnDestinationAppletIdentityInfo"}, + {19, D<&ILibraryAppletSelfAccessor::GetDesirableKeyboardLayout>, "GetDesirableKeyboardLayout"}, + {20, nullptr, "PopExtraStorage"}, + {25, nullptr, "GetPopExtraStorageEvent"}, + {30, D<&ILibraryAppletSelfAccessor::UnpopInData>, "UnpopInData"}, + {31, nullptr, "UnpopExtraStorage"}, + {40, nullptr, "GetIndirectLayerProducerHandle"}, + {50, D<&ILibraryAppletSelfAccessor::ReportVisibleError>, "ReportVisibleError"}, + {51, D<&ILibraryAppletSelfAccessor::ReportVisibleErrorWithErrorContext>, "ReportVisibleErrorWithErrorContext"}, + {60, D<&ILibraryAppletSelfAccessor::GetMainAppletApplicationDesiredLanguage>, "GetMainAppletApplicationDesiredLanguage"}, + {70, D<&ILibraryAppletSelfAccessor::GetCurrentApplicationId>, "GetCurrentApplicationId"}, + {80, nullptr, "RequestExitToSelf"}, + {90, nullptr, "CreateApplicationAndPushAndRequestToLaunch"}, + {100, nullptr, "CreateGameMovieTrimmer"}, + {101, nullptr, "ReserveResourceForMovieOperation"}, + {102, nullptr, "UnreserveResourceForMovieOperation"}, + {110, D<&ILibraryAppletSelfAccessor::GetMainAppletAvailableUsers>, "GetMainAppletAvailableUsers"}, + {120, nullptr, "GetLaunchStorageInfoForDebug"}, + {130, nullptr, "GetGpuErrorDetectedSystemEvent"}, + {140, nullptr, "SetApplicationMemoryReservation"}, + {150, D<&ILibraryAppletSelfAccessor::ShouldSetGpuTimeSliceManually>, "ShouldSetGpuTimeSliceManually"}, + {160, D<&ILibraryAppletSelfAccessor::GetLibraryAppletInfoEx>, "GetLibraryAppletInfoEx"}, + }; + // clang-format on + RegisterHandlers(functions); +} + +ILibraryAppletSelfAccessor::~ILibraryAppletSelfAccessor() = default; + +Result ILibraryAppletSelfAccessor::PopInData(Out> out_storage) { + LOG_INFO(Service_AM, "called"); + R_RETURN(m_broker->GetInData().Pop(system.Kernel(), out_storage)); +} + +Result ILibraryAppletSelfAccessor::PushOutData(SharedPointer storage) { + LOG_INFO(Service_AM, "called"); + m_broker->GetOutData().Push(system.Kernel(), storage); + R_SUCCEED(); +} + +Result ILibraryAppletSelfAccessor::PopInteractiveInData(Out> out_storage) { + LOG_INFO(Service_AM, "called"); + R_RETURN(m_broker->GetInteractiveInData().Pop(system.Kernel(), out_storage)); +} + +Result ILibraryAppletSelfAccessor::PushInteractiveOutData(SharedPointer storage) { + LOG_INFO(Service_AM, "called"); + m_broker->GetInteractiveOutData().Push(system.Kernel(), storage); + R_SUCCEED(); +} + +Result ILibraryAppletSelfAccessor::GetPopInDataEvent( + OutCopyHandle out_event) { + LOG_INFO(Service_AM, "called"); + *out_event = m_broker->GetInData().GetEvent(); + R_SUCCEED(); +} + +Result ILibraryAppletSelfAccessor::GetPopInteractiveInDataEvent( + OutCopyHandle out_event) { + LOG_INFO(Service_AM, "called"); + *out_event = m_broker->GetInteractiveInData().GetEvent(); + R_SUCCEED(); +} + +Result ILibraryAppletSelfAccessor::GetLibraryAppletInfo( + Out out_library_applet_info) { + LOG_INFO(Service_AM, "called"); + *out_library_applet_info = { + .applet_id = m_applet->applet_id, + .library_applet_mode = m_applet->library_applet_mode, + }; + R_SUCCEED(); +} + +Result ILibraryAppletSelfAccessor::GetMainAppletIdentityInfo( + Out out_identity_info) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + *out_identity_info = { + .applet_id = AppletId::QLaunch, + .application_id = 0x0100000000001000ull, + }; + R_SUCCEED(); +} + +Result ILibraryAppletSelfAccessor::CanUseApplicationCore(Out out_can_use_application_core) { + // TODO: This appears to read the NPDM from state and check the core mask of the applet. + LOG_WARNING(Service_AM, "(STUBBED) called"); + *out_can_use_application_core = false; + R_SUCCEED(); +} + +Result ILibraryAppletSelfAccessor::GetMainAppletApplicationControlProperty( + OutLargeData, BufferAttr_HipcMapAlias> out_nacp) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + + // TODO: this should be the main applet, not the caller applet + const auto application = GetCallerIdentity(*m_applet); + std::vector nacp; + const auto result = + system.GetARPManager().GetControlProperty(&nacp, application.application_id); + + if (R_SUCCEEDED(result)) { + std::memcpy(out_nacp->data(), nacp.data(), (std::min)(nacp.size(), out_nacp->size())); + } + + R_RETURN(result); +} + +Result ILibraryAppletSelfAccessor::GetMainAppletStorageId(Out out_storage_id) { + LOG_INFO(Service_AM, "(STUBBED) called"); + *out_storage_id = FileSys::StorageId::NandUser; + R_SUCCEED(); +} + +Result ILibraryAppletSelfAccessor::ExitProcessAndReturn() { + LOG_INFO(Service_AM, "called"); + + if (const auto caller_applet = m_applet->caller_applet.lock(); caller_applet) { + m_applet->process->Terminate(); + } else { + system.GetUserChannel() = m_applet->user_channel_launch_parameter; + system.ExecuteProgram(0); + } + + R_SUCCEED(); +} + +Result ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfo( + Out out_identity_info) { + LOG_INFO(Service_AM, "called"); + *out_identity_info = GetCallerIdentity(*m_applet); + R_SUCCEED(); +} + +Result ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfoStack( + Out out_count, OutArray out_identity_info) { + LOG_INFO(Service_AM, "called"); + + std::shared_ptr applet = m_applet; + *out_count = 0; + + do { + if (*out_count >= static_cast(out_identity_info.size())) { + break; + } + out_identity_info[(*out_count)++] = GetCallerIdentity(*applet); + } while ((applet = applet->caller_applet.lock())); + + R_SUCCEED(); +} + +Result ILibraryAppletSelfAccessor::GetDesirableKeyboardLayout(Out out_desirable_layout) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + *out_desirable_layout = 0; + R_SUCCEED(); +} + +Result ILibraryAppletSelfAccessor::ReportVisibleError(ErrorCode error_code) { + LOG_WARNING(Service_AM, "(STUBBED) called, error {}-{}", error_code.category, + error_code.number); + R_SUCCEED(); +} + +Result ILibraryAppletSelfAccessor::ReportVisibleErrorWithErrorContext( + ErrorCode error_code, InLargeData error_context) { + LOG_WARNING(Service_AM, "(STUBBED) called, error {}-{}", error_code.category, + error_code.number); + R_SUCCEED(); +} + +Result ILibraryAppletSelfAccessor::UnpopInData(SharedPointer storage) { + LOG_INFO(Service_AM, "called"); + m_broker->GetInData().Unpop(system.Kernel(), storage); + R_SUCCEED(); +} + +Result ILibraryAppletSelfAccessor::GetMainAppletApplicationDesiredLanguage( + Out out_desired_language) { + // FIXME: this is copied from IApplicationFunctions::GetDesiredLanguage + // FIXME: all of this stuff belongs to ns + auto identity = GetCallerIdentity(*m_applet); + + // TODO(bunnei): This should be configurable + LOG_DEBUG(Service_AM, "called"); + + // Get supported languages from NACP, if possible + // Default to 0 (all languages supported) + u32 supported_languages = 0; + + const auto res = FileSys::PatchManager::GetMetadataFromBaseOrUpdate(system, identity.application_id); + + if (res.first != nullptr) { + supported_languages = res.first->GetSupportedLanguages(); + } + + // Call IApplicationManagerInterface implementation. + auto& service_manager = system.ServiceManager(); + auto ns_am2 = service_manager.GetService("ns:am2"); + + std::shared_ptr app_man; + R_TRY(ns_am2->GetApplicationManagerInterface(&app_man)); + + // Get desired application language + NS::ApplicationLanguage desired_language{}; + R_TRY(app_man->GetApplicationDesiredLanguage(&desired_language, supported_languages)); + + // Convert to settings language code. + u64 language_code{}; + R_TRY(app_man->ConvertApplicationLanguageToLanguageCode(&language_code, desired_language)); + + LOG_DEBUG(Service_AM, "got desired_language={:016X}", language_code); + + *out_desired_language = language_code; + R_SUCCEED(); +} + +Result ILibraryAppletSelfAccessor::GetCurrentApplicationId(Out out_application_id) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + + // TODO: this should be the main applet, not the caller applet + const auto main_applet = GetCallerIdentity(*m_applet); + *out_application_id = main_applet.application_id; + + R_SUCCEED(); +} + +Result ILibraryAppletSelfAccessor::GetMainAppletAvailableUsers( + Out out_can_select_any_user, Out out_users_count, + OutArray out_users) { + const Service::Account::ProfileManager manager{}; + + *out_can_select_any_user = false; + *out_users_count = -1; + + LOG_INFO(Service_AM, "called"); + + if (manager.GetUserCount() > 0) { + *out_can_select_any_user = true; + *out_users_count = static_cast(manager.GetUserCount()); + + const auto users = manager.GetAllUsers(); + for (size_t i = 0; i < users.size() && i < out_users.size(); i++) { + out_users[i] = users[i]; + } + } + + R_SUCCEED(); +} + +Result ILibraryAppletSelfAccessor::ShouldSetGpuTimeSliceManually( + Out out_should_set_gpu_time_slice_manually) { + LOG_INFO(Service_AM, "(STUBBED) called"); + *out_should_set_gpu_time_slice_manually = false; + R_SUCCEED(); +} + +Result ILibraryAppletSelfAccessor::GetLibraryAppletInfoEx( + Out out_library_applet_info) { + LOG_INFO(Service_AM, "called"); + *out_library_applet_info = { + .applet_id = m_applet->applet_id, + .library_applet_mode = m_applet->library_applet_mode, + }; + R_SUCCEED(); +} + +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/library_applet_self_accessor.h b/src/core/hle/service/am/service/library_applet_self_accessor.h new file mode 100644 index 0000000000..d287f6b403 --- /dev/null +++ b/src/core/hle/service/am/service/library_applet_self_accessor.h @@ -0,0 +1,87 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "common/uuid.h" +#include "core/hle/service/am/am_types.h" +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/service.h" + +namespace FileSys { +enum class StorageId : u8; +} + +namespace Kernel { +class KReadableEvent; +} + +namespace Service::AM { + +class AppletDataBroker; +struct Applet; +class IStorage; + +struct LibraryAppletInfo { + AppletId applet_id; + LibraryAppletMode library_applet_mode; +}; +static_assert(sizeof(LibraryAppletInfo) == 0x8, "LibraryAppletInfo has incorrect size."); + +struct ErrorCode { + u32 category; + u32 number; +}; +static_assert(sizeof(ErrorCode) == 0x8, "ErrorCode has incorrect size."); + +struct ErrorContext { + u8 type; + INSERT_PADDING_BYTES_NOINIT(0x7); + std::array data; + Result result; +}; +static_assert(sizeof(ErrorContext) == 0x200, "ErrorContext has incorrect size."); + +class ILibraryAppletSelfAccessor final : public ServiceFramework { +public: + explicit ILibraryAppletSelfAccessor(Core::System& system_, std::shared_ptr applet); + ~ILibraryAppletSelfAccessor() override; + +private: + Result PopInData(Out> out_storage); + Result PushOutData(SharedPointer storage); + Result PopInteractiveInData(Out> out_storage); + Result PushInteractiveOutData(SharedPointer storage); + Result GetPopInDataEvent(OutCopyHandle out_event); + Result GetPopInteractiveInDataEvent(OutCopyHandle out_event); + Result GetLibraryAppletInfo(Out out_library_applet_info); + Result GetMainAppletIdentityInfo(Out out_identity_info); + Result CanUseApplicationCore(Out out_can_use_application_core); + Result GetMainAppletApplicationControlProperty( + OutLargeData, BufferAttr_HipcMapAlias> out_nacp); + Result GetMainAppletStorageId(Out out_storage_id); + Result ExitProcessAndReturn(); + Result GetCallerAppletIdentityInfo(Out out_identity_info); + Result GetCallerAppletIdentityInfoStack( + Out out_count, + OutArray out_identity_info); + Result GetDesirableKeyboardLayout(Out out_desirable_layout); + Result ReportVisibleError(ErrorCode error_code); + Result ReportVisibleErrorWithErrorContext( + ErrorCode error_code, InLargeData error_context); + Result UnpopInData(SharedPointer storage); + Result GetMainAppletApplicationDesiredLanguage(Out out_desired_language); + Result GetCurrentApplicationId(Out out_application_id); + Result GetMainAppletAvailableUsers(Out out_can_select_any_user, Out out_users_count, + OutArray out_users); + Result ShouldSetGpuTimeSliceManually(Out out_should_set_gpu_time_slice_manually); + Result GetLibraryAppletInfoEx(Out out_library_applet_info); + + const std::shared_ptr m_applet; + const std::shared_ptr m_broker; +}; + +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/lock_accessor.cpp b/src/core/hle/service/am/service/lock_accessor.cpp new file mode 100644 index 0000000000..0341254449 --- /dev/null +++ b/src/core/hle/service/am/service/lock_accessor.cpp @@ -0,0 +1,78 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/hle/service/am/service/lock_accessor.h" +#include "core/hle/service/cmif_serialization.h" + +namespace Service::AM { + +ILockAccessor::ILockAccessor(Core::System& system_) + : ServiceFramework{system_, "ILockAccessor"}, m_context{system_, "ILockAccessor"}, + m_event{m_context} { + // clang-format off + static const FunctionInfo functions[] = { + {1, D<&ILockAccessor::TryLock>, "TryLock"}, + {2, D<&ILockAccessor::Unlock>, "Unlock"}, + {3, D<&ILockAccessor::GetEvent>, "GetEvent"}, + {4, D<&ILockAccessor::IsLocked>, "IsLocked"}, + }; + // clang-format on + + RegisterHandlers(functions); + + m_event.Signal(system.Kernel()); +} + +ILockAccessor::~ILockAccessor() = default; + +Result ILockAccessor::TryLock(Out out_is_locked, + OutCopyHandle out_handle, + bool return_handle) { + LOG_INFO(Service_AM, "called, return_handle={}", return_handle); + + { + std::scoped_lock lk{m_mutex}; + if (m_is_locked) { + *out_is_locked = false; + } else { + m_is_locked = true; + *out_is_locked = true; + } + } + + if (return_handle) { + *out_handle = m_event.GetHandle(); + } + + R_SUCCEED(); +} + +Result ILockAccessor::Unlock() { + LOG_INFO(Service_AM, "called"); + + { + std::scoped_lock lk{m_mutex}; + m_is_locked = false; + } + + m_event.Signal(system.Kernel()); + R_SUCCEED(); +} + +Result ILockAccessor::GetEvent(OutCopyHandle out_handle) { + LOG_INFO(Service_AM, "called"); + *out_handle = m_event.GetHandle(); + R_SUCCEED(); +} + +Result ILockAccessor::IsLocked(Out out_is_locked) { + LOG_INFO(Service_AM, "called"); + std::scoped_lock lk{m_mutex}; + *out_is_locked = m_is_locked; + R_SUCCEED(); +} + +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/lock_accessor.h b/src/core/hle/service/am/service/lock_accessor.h new file mode 100644 index 0000000000..fe3f11dcf0 --- /dev/null +++ b/src/core/hle/service/am/service/lock_accessor.h @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/kernel_helpers.h" +#include "core/hle/service/os/event.h" +#include "core/hle/service/service.h" + +namespace Service::AM { + +class ILockAccessor final : public ServiceFramework { +public: + explicit ILockAccessor(Core::System& system_); + ~ILockAccessor() override; + +private: + Result TryLock(Out out_is_locked, OutCopyHandle out_handle, + bool return_handle); + Result Unlock(); + Result GetEvent(OutCopyHandle out_handle); + Result IsLocked(Out out_is_locked); + +private: + KernelHelpers::ServiceContext m_context; + Event m_event; + std::mutex m_mutex{}; + bool m_is_locked{}; +}; + +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/overlay_applet_proxy.cpp b/src/core/hle/service/am/service/overlay_applet_proxy.cpp new file mode 100644 index 0000000000..735ba9d307 --- /dev/null +++ b/src/core/hle/service/am/service/overlay_applet_proxy.cpp @@ -0,0 +1,120 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "core/hle/service/am/service/common_state_getter.h" +#include "core/hle/service/am/service/display_controller.h" +#include "core/hle/service/am/service/global_state_controller.h" +#include "core/hle/service/am/service/audio_controller.h" +#include "core/hle/service/am/service/applet_common_functions.h" +#include "core/hle/service/am/service/overlay_applet_proxy.h" +#include "core/hle/service/am/service/library_applet_creator.h" +#include "core/hle/service/am/service/process_winding_controller.h" +#include "core/hle/service/am/service/self_controller.h" +#include "core/hle/service/am/service/window_controller.h" +#include "core/hle/service/am/service/debug_functions.h" +#include "core/hle/service/cmif_serialization.h" + +namespace Service::AM { + IOverlayAppletProxy::IOverlayAppletProxy(Core::System &system_, std::shared_ptr applet, + Kernel::KProcess *process, WindowSystem &window_system) + : ServiceFramework{system_, "IOverlayAppletProxy"}, + m_window_system{window_system}, m_process{process}, m_applet{std::move(applet)} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IOverlayAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"}, + {1, D<&IOverlayAppletProxy::GetSelfController>, "GetSelfController"}, + {2, D<&IOverlayAppletProxy::GetWindowController>, "GetWindowController"}, + {3, D<&IOverlayAppletProxy::GetAudioController>, "GetAudioController"}, + {4, D<&IOverlayAppletProxy::GetDisplayController>, "GetDisplayController"}, + {10, D<&IOverlayAppletProxy::GetProcessWindingController>, "GetProcessWindingController"}, + {11, D<&IOverlayAppletProxy::GetLibraryAppletCreator>, "GetLibraryAppletCreator"}, + {20, D<&IOverlayAppletProxy::GetOverlayFunctions>, "GetOverlayFunctions"}, + {21, D<&IOverlayAppletProxy::GetAppletCommonFunctions>, "GetAppletCommonFunctions"}, + {23, D<&IOverlayAppletProxy::GetGlobalStateController>, "GetGlobalStateController"}, + {1000, D<&IOverlayAppletProxy::GetDebugFunctions>, "GetDebugFunctions"}, + }; + // clang-format on + + RegisterHandlers(functions); + } + + IOverlayAppletProxy::~IOverlayAppletProxy() = default; + + Result IOverlayAppletProxy::GetCommonStateGetter( + Out > out_common_state_getter) { + LOG_DEBUG(Service_AM, "called"); + *out_common_state_getter = std::make_shared(system, m_applet); + R_SUCCEED(); + } + + Result IOverlayAppletProxy::GetSelfController( + Out > out_self_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_self_controller = std::make_shared(system, m_applet, m_process); + R_SUCCEED(); + } + + Result IOverlayAppletProxy::GetWindowController( + Out > out_window_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_window_controller = std::make_shared(system, m_applet, m_window_system); + R_SUCCEED(); + } + + Result IOverlayAppletProxy::GetAudioController( + Out > out_audio_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_audio_controller = std::make_shared(system); + R_SUCCEED(); + } + + Result IOverlayAppletProxy::GetDisplayController( + Out > out_display_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_display_controller = std::make_shared(system, m_applet); + R_SUCCEED(); + } + + Result IOverlayAppletProxy::GetProcessWindingController( + Out > out_process_winding_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_process_winding_controller = std::make_shared(system, m_applet); + R_SUCCEED(); + } + + Result IOverlayAppletProxy::GetLibraryAppletCreator( + Out > out_library_applet_creator) { + LOG_DEBUG(Service_AM, "called"); + *out_library_applet_creator = + std::make_shared(system, m_applet, m_window_system); + R_SUCCEED(); + } + + Result IOverlayAppletProxy::GetOverlayFunctions( + Out > out_overlay_functions) { + LOG_DEBUG(Service_AM, "called"); + *out_overlay_functions = std::make_shared(system, m_applet); + R_SUCCEED(); + } + + Result IOverlayAppletProxy::GetAppletCommonFunctions( + Out > out_applet_common_functions) { + LOG_DEBUG(Service_AM, "called"); + *out_applet_common_functions = std::make_shared(system, m_applet); + R_SUCCEED(); + } + + Result IOverlayAppletProxy::GetGlobalStateController( + Out > out_global_state_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_global_state_controller = std::make_shared(system); + R_SUCCEED(); + } + + Result IOverlayAppletProxy::GetDebugFunctions( + Out > out_debug_functions) { + LOG_DEBUG(Service_AM, "called"); + *out_debug_functions = std::make_shared(system); + R_SUCCEED(); + } +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/overlay_applet_proxy.h b/src/core/hle/service/am/service/overlay_applet_proxy.h new file mode 100644 index 0000000000..6c02166a2d --- /dev/null +++ b/src/core/hle/service/am/service/overlay_applet_proxy.h @@ -0,0 +1,55 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/service.h" +#include "core/hle/service/am/service/overlay_functions.h" + +namespace Service::AM { + +struct Applet; +class IAppletCommonFunctions; +class IAudioController; +class ICommonStateGetter; +class IDebugFunctions; +class IDisplayController; +class IHomeMenuFunctions; +class IGlobalStateController; +class ILibraryAppletCreator; +class ILibraryAppletSelfAccessor; +class IProcessWindingController; +class ISelfController; +class IWindowController; +class WindowSystem; + +class IOverlayAppletProxy final : public ServiceFramework { +public: + explicit IOverlayAppletProxy(Core::System& system_, std::shared_ptr applet, + Kernel::KProcess* process, WindowSystem& window_system); + ~IOverlayAppletProxy(); + +private: + Result GetCommonStateGetter(Out> out_common_state_getter); + Result GetSelfController(Out> out_self_controller); + Result GetWindowController(Out> out_window_controller); + Result GetAudioController(Out> out_audio_controller); + Result GetDisplayController(Out> out_display_controller); + Result GetProcessWindingController( + Out> out_process_winding_controller); + Result GetLibraryAppletCreator( + Out> out_library_applet_creator); + Result GetOverlayFunctions(Out> out_overlay_functions); + Result GetAppletCommonFunctions( + Out> out_applet_common_functions); + Result GetGlobalStateController( + Out> out_global_state_controller); + Result GetDebugFunctions(Out> out_debug_functions); + + WindowSystem& m_window_system; + Kernel::KProcess* const m_process; + const std::shared_ptr m_applet; +}; + +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/overlay_functions.cpp b/src/core/hle/service/am/service/overlay_functions.cpp index 006610bd47..8150b5dd07 100644 --- a/src/core/hle/service/am/service/overlay_functions.cpp +++ b/src/core/hle/service/am/service/overlay_functions.cpp @@ -8,34 +8,34 @@ #include "core/hle/service/am/window_system.h" namespace Service::AM { - std::optional IOverlayFunctions::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IOverlayFunctions::BeginToWatchShortHomeButtonMessage>, "BeginToWatchShortHomeButtonMessage"}, - FunctionInfo{1, D<&IOverlayFunctions::EndToWatchShortHomeButtonMessage>, "EndToWatchShortHomeButtonMessage"}, - FunctionInfo{2, D<&IOverlayFunctions::GetApplicationIdForLogo>, "GetApplicationIdForLogo"}, - FunctionInfo{3, nullptr, "SetGpuTimeSliceBoost"}, - FunctionInfo{4, D<&IOverlayFunctions::SetAutoSleepTimeAndDimmingTimeEnabled>, "SetAutoSleepTimeAndDimmingTimeEnabled"}, - FunctionInfo{5, nullptr, "TerminateApplicationAndSetReason"}, - FunctionInfo{6, nullptr, "SetScreenShotPermissionGlobally"}, - FunctionInfo{10, nullptr, "StartShutdownSequenceForOverlay"}, - FunctionInfo{11, nullptr, "StartRebootSequenceForOverlay"}, - FunctionInfo{20, D<&IOverlayFunctions::SetHandlingHomeButtonShortPressedEnabled>, "SetHandlingHomeButtonShortPressedEnabled"}, - FunctionInfo{21, D<&IOverlayFunctions::SetHandlingTouchScreenInputEnabled>, "SetHandlingTouchScreenInputEnabled"}, - FunctionInfo{30, nullptr, "SetHealthWarningShowingState"}, - FunctionInfo{31, D<&IOverlayFunctions::IsHealthWarningRequired>, "IsHealthWarningRequired"}, - FunctionInfo{40, nullptr, "GetApplicationNintendoLogo"}, - FunctionInfo{41, nullptr, "GetApplicationStartupMovie"}, - FunctionInfo{50, nullptr, "SetGpuTimeSliceBoostForApplication"}, - FunctionInfo{60, nullptr, "Unknown60"}, - FunctionInfo{70, D<&IOverlayFunctions::Unknown70>, "Unknown70"}, - FunctionInfo{90, nullptr, "SetRequiresGpuResourceUse"}, - FunctionInfo{101, nullptr, "BeginToObserveHidInputForDevelop"} - ); - return HandlerTableGenerateWithFind(key, functions); - } - IOverlayFunctions::IOverlayFunctions(Core::System &system_, std::shared_ptr applet) : ServiceFramework{system_, "IOverlayFunctions"}, m_applet{std::move(applet)} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IOverlayFunctions::BeginToWatchShortHomeButtonMessage>, "BeginToWatchShortHomeButtonMessage"}, + {1, D<&IOverlayFunctions::EndToWatchShortHomeButtonMessage>, "EndToWatchShortHomeButtonMessage"}, + {2, D<&IOverlayFunctions::GetApplicationIdForLogo>, "GetApplicationIdForLogo"}, + {3, nullptr, "SetGpuTimeSliceBoost"}, + {4, D<&IOverlayFunctions::SetAutoSleepTimeAndDimmingTimeEnabled>, "SetAutoSleepTimeAndDimmingTimeEnabled"}, + {5, nullptr, "TerminateApplicationAndSetReason"}, + {6, nullptr, "SetScreenShotPermissionGlobally"}, + {10, nullptr, "StartShutdownSequenceForOverlay"}, + {11, nullptr, "StartRebootSequenceForOverlay"}, + {20, D<&IOverlayFunctions::SetHandlingHomeButtonShortPressedEnabled>, "SetHandlingHomeButtonShortPressedEnabled"}, + {21, D<&IOverlayFunctions::SetHandlingTouchScreenInputEnabled>, "SetHandlingTouchScreenInputEnabled"}, + {30, nullptr, "SetHealthWarningShowingState"}, + {31, D<&IOverlayFunctions::IsHealthWarningRequired>, "IsHealthWarningRequired"}, + {40, nullptr, "GetApplicationNintendoLogo"}, + {41, nullptr, "GetApplicationStartupMovie"}, + {50, nullptr, "SetGpuTimeSliceBoostForApplication"}, + {60, nullptr, "Unknown60"}, + {70, D<&IOverlayFunctions::Unknown70>, "Unknown70"}, + {90, nullptr, "SetRequiresGpuResourceUse"}, + {101, nullptr, "BeginToObserveHidInputForDevelop"}, + }; + // clang-format on + + RegisterHandlers(functions); } IOverlayFunctions::~IOverlayFunctions() = default; diff --git a/src/core/hle/service/am/service/overlay_functions.h b/src/core/hle/service/am/service/overlay_functions.h index b94f0cc0d5..eefd8d862b 100644 --- a/src/core/hle/service/am/service/overlay_functions.h +++ b/src/core/hle/service/am/service/overlay_functions.h @@ -6,25 +6,24 @@ #include "core/hle/service/service.h" namespace Service::AM { -struct Applet; + struct Applet; -class IOverlayFunctions final : public ServiceFramework { -public: - explicit IOverlayFunctions(Core::System &system_, std::shared_ptr applet); - ~IOverlayFunctions() override; + class IOverlayFunctions final : public ServiceFramework { + public: + explicit IOverlayFunctions(Core::System &system_, std::shared_ptr applet); + ~IOverlayFunctions() override; -private: - Result BeginToWatchShortHomeButtonMessage(); - Result EndToWatchShortHomeButtonMessage(); - Result GetApplicationIdForLogo(Out out_application_id); - Result SetAutoSleepTimeAndDimmingTimeEnabled(bool enabled); - Result IsHealthWarningRequired(Out is_required); - Result SetHandlingHomeButtonShortPressedEnabled(bool enabled); - Result SetHandlingTouchScreenInputEnabled(bool enabled); - Result Unknown70(); + private: + Result BeginToWatchShortHomeButtonMessage(); + Result EndToWatchShortHomeButtonMessage(); + Result GetApplicationIdForLogo(Out out_application_id); + Result SetAutoSleepTimeAndDimmingTimeEnabled(bool enabled); + Result IsHealthWarningRequired(Out is_required); + Result SetHandlingHomeButtonShortPressedEnabled(bool enabled); + Result SetHandlingTouchScreenInputEnabled(bool enabled); + Result Unknown70(); -private: - std::optional FindRequest(u32 key) override; - const std::shared_ptr m_applet; -}; + private: + const std::shared_ptr m_applet; + }; } // namespace Service::AM diff --git a/src/core/hle/service/am/service/process_winding_controller.cpp b/src/core/hle/service/am/service/process_winding_controller.cpp index 159f4dfd5c..e284aa2d89 100644 --- a/src/core/hle/service/am/service/process_winding_controller.cpp +++ b/src/core/hle/service/am/service/process_winding_controller.cpp @@ -13,23 +13,23 @@ namespace Service::AM { - std::optional IProcessWindingController::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IProcessWindingController::GetLaunchReason>, "GetLaunchReason"}, - FunctionInfo{11, D<&IProcessWindingController::OpenCallingLibraryApplet>, "OpenCallingLibraryApplet"}, - FunctionInfo{21, D<&IProcessWindingController::PushContext>, "PushContext"}, - FunctionInfo{22, D<&IProcessWindingController::PopContext>, "PopContext"}, - FunctionInfo{23, D<&IProcessWindingController::CancelWindingReservation>, "CancelWindingReservation"}, - FunctionInfo{30, D<&IProcessWindingController::WindAndDoReserved>, "WindAndDoReserved"}, - FunctionInfo{40, D<&IProcessWindingController::ReserveToStartAndWaitAndUnwindThis>, "ReserveToStartAndWaitAndUnwindThis"}, - FunctionInfo{41, D<&IProcessWindingController::ReserveToStartAndWait>, "ReserveToStartAndWait"} - ); - return HandlerTableGenerateWithFind(key, functions); - } - IProcessWindingController::IProcessWindingController(Core::System& system_, std::shared_ptr applet) : ServiceFramework{system_, "IProcessWindingController"}, m_applet{std::move(applet)} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IProcessWindingController::GetLaunchReason>, "GetLaunchReason"}, + {11, D<&IProcessWindingController::OpenCallingLibraryApplet>, "OpenCallingLibraryApplet"}, + {21, D<&IProcessWindingController::PushContext>, "PushContext"}, + {22, D<&IProcessWindingController::PopContext>, "PopContext"}, + {23, D<&IProcessWindingController::CancelWindingReservation>, "CancelWindingReservation"}, + {30, D<&IProcessWindingController::WindAndDoReserved>, "WindAndDoReserved"}, + {40, D<&IProcessWindingController::ReserveToStartAndWaitAndUnwindThis>, "ReserveToStartAndWaitAndUnwindThis"}, + {41, D<&IProcessWindingController::ReserveToStartAndWait>, "ReserveToStartAndWait"}, + }; + // clang-format on + + RegisterHandlers(functions); } IProcessWindingController::~IProcessWindingController() = default; diff --git a/src/core/hle/service/am/service/process_winding_controller.h b/src/core/hle/service/am/service/process_winding_controller.h index 91b29ac04b..f3417bcd97 100644 --- a/src/core/hle/service/am/service/process_winding_controller.h +++ b/src/core/hle/service/am/service/process_winding_controller.h @@ -33,7 +33,6 @@ private: SharedPointer reserved_applet_accessor); Result ReserveToStartAndWait(SharedPointer reserved_applet_accessor); - std::optional FindRequest(u32 key) override; const std::shared_ptr m_applet; }; diff --git a/src/core/hle/service/am/service/self_controller.cpp b/src/core/hle/service/am/service/self_controller.cpp index ce8a308d6a..3a654b9daa 100644 --- a/src/core/hle/service/am/service/self_controller.cpp +++ b/src/core/hle/service/am/service/self_controller.cpp @@ -17,66 +17,67 @@ namespace Service::AM { - std::optional ISelfController::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&ISelfController::Exit>, "Exit"}, - FunctionInfo{1, D<&ISelfController::LockExit>, "LockExit"}, - FunctionInfo{2, D<&ISelfController::UnlockExit>, "UnlockExit"}, - FunctionInfo{3, D<&ISelfController::EnterFatalSection>, "EnterFatalSection"}, - FunctionInfo{4, D<&ISelfController::LeaveFatalSection>, "LeaveFatalSection"}, - FunctionInfo{9, D<&ISelfController::GetLibraryAppletLaunchableEvent>, "GetLibraryAppletLaunchableEvent"}, - FunctionInfo{10, D<&ISelfController::SetScreenShotPermission>, "SetScreenShotPermission"}, - FunctionInfo{11, D<&ISelfController::SetOperationModeChangedNotification>, "SetOperationModeChangedNotification"}, - FunctionInfo{12, D<&ISelfController::SetPerformanceModeChangedNotification>, "SetPerformanceModeChangedNotification"}, - FunctionInfo{13, D<&ISelfController::SetFocusHandlingMode>, "SetFocusHandlingMode"}, - FunctionInfo{14, D<&ISelfController::SetRestartMessageEnabled>, "SetRestartMessageEnabled"}, - FunctionInfo{15, D<&ISelfController::SetScreenShotAppletIdentityInfo>, "SetScreenShotAppletIdentityInfo"}, - FunctionInfo{16, D<&ISelfController::SetOutOfFocusSuspendingEnabled>, "SetOutOfFocusSuspendingEnabled"}, - FunctionInfo{17, nullptr, "SetControllerFirmwareUpdateSection"}, - FunctionInfo{18, nullptr, "SetRequiresCaptureButtonShortPressedMessage"}, - FunctionInfo{19, D<&ISelfController::SetAlbumImageOrientation>, "SetAlbumImageOrientation"}, - FunctionInfo{20, nullptr, "SetDesirableKeyboardLayout"}, - FunctionInfo{21, nullptr, "GetScreenShotProgramId"}, - FunctionInfo{40, D<&ISelfController::CreateManagedDisplayLayer>, "CreateManagedDisplayLayer"}, - FunctionInfo{41, D<&ISelfController::IsSystemBufferSharingEnabled>, "IsSystemBufferSharingEnabled"}, - FunctionInfo{42, D<&ISelfController::GetSystemSharedLayerHandle>, "GetSystemSharedLayerHandle"}, - FunctionInfo{43, D<&ISelfController::GetSystemSharedBufferHandle>, "GetSystemSharedBufferHandle"}, - FunctionInfo{44, D<&ISelfController::CreateManagedDisplaySeparableLayer>, "CreateManagedDisplaySeparableLayer"}, - FunctionInfo{45, nullptr, "SetManagedDisplayLayerSeparationMode"}, - FunctionInfo{46, nullptr, "SetRecordingLayerCompositionEnabled"}, - FunctionInfo{50, D<&ISelfController::SetHandlesRequestToDisplay>, "SetHandlesRequestToDisplay"}, - FunctionInfo{51, D<&ISelfController::ApproveToDisplay>, "ApproveToDisplay"}, - FunctionInfo{60, D<&ISelfController::OverrideAutoSleepTimeAndDimmingTime>, "OverrideAutoSleepTimeAndDimmingTime"}, - FunctionInfo{61, D<&ISelfController::SetMediaPlaybackState>, "SetMediaPlaybackState"}, - FunctionInfo{62, D<&ISelfController::SetIdleTimeDetectionExtension>, "SetIdleTimeDetectionExtension"}, - FunctionInfo{63, D<&ISelfController::GetIdleTimeDetectionExtension>, "GetIdleTimeDetectionExtension"}, - FunctionInfo{64, nullptr, "SetInputDetectionSourceSet"}, - FunctionInfo{65, D<&ISelfController::ReportUserIsActive>, "ReportUserIsActive"}, - FunctionInfo{66, nullptr, "GetCurrentIlluminance"}, - FunctionInfo{67, D<&ISelfController::IsIlluminanceAvailable>, "IsIlluminanceAvailable"}, - FunctionInfo{68, D<&ISelfController::SetAutoSleepDisabled>, "SetAutoSleepDisabled"}, - FunctionInfo{69, D<&ISelfController::IsAutoSleepDisabled>, "IsAutoSleepDisabled"}, - FunctionInfo{70, nullptr, "ReportMultimediaError"}, - FunctionInfo{71, nullptr, "GetCurrentIlluminanceEx"}, - FunctionInfo{72, D<&ISelfController::SetInputDetectionPolicy>, "SetInputDetectionPolicy"}, - FunctionInfo{80, nullptr, "SetWirelessPriorityMode"}, - FunctionInfo{90, D<&ISelfController::GetAccumulatedSuspendedTickValue>, "GetAccumulatedSuspendedTickValue"}, - FunctionInfo{91, D<&ISelfController::GetAccumulatedSuspendedTickChangedEvent>, "GetAccumulatedSuspendedTickChangedEvent"}, - FunctionInfo{100, D<&ISelfController::SetAlbumImageTakenNotificationEnabled>, "SetAlbumImageTakenNotificationEnabled"}, - FunctionInfo{110, nullptr, "SetApplicationAlbumUserData"}, - FunctionInfo{120, D<&ISelfController::SaveCurrentScreenshot>, "SaveCurrentScreenshot"}, - FunctionInfo{130, D<&ISelfController::SetRecordVolumeMuted>, "SetRecordVolumeMuted"}, - FunctionInfo{230, D<&ISelfController::Unknown230>, "Unknown230"}, - FunctionInfo{240, D<&ISelfController::Unknown240>, "Unknown240"}, - FunctionInfo{1000, nullptr, "GetDebugStorageChannel"} - ); - return HandlerTableGenerateWithFind(key, functions); - } - ISelfController::ISelfController(Core::System& system_, std::shared_ptr applet, Kernel::KProcess* process) : ServiceFramework{system_, "ISelfController"}, m_process{process}, m_applet{ std::move(applet)} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&ISelfController::Exit>, "Exit"}, + {1, D<&ISelfController::LockExit>, "LockExit"}, + {2, D<&ISelfController::UnlockExit>, "UnlockExit"}, + {3, D<&ISelfController::EnterFatalSection>, "EnterFatalSection"}, + {4, D<&ISelfController::LeaveFatalSection>, "LeaveFatalSection"}, + {9, D<&ISelfController::GetLibraryAppletLaunchableEvent>, "GetLibraryAppletLaunchableEvent"}, + {10, D<&ISelfController::SetScreenShotPermission>, "SetScreenShotPermission"}, + {11, D<&ISelfController::SetOperationModeChangedNotification>, "SetOperationModeChangedNotification"}, + {12, D<&ISelfController::SetPerformanceModeChangedNotification>, "SetPerformanceModeChangedNotification"}, + {13, D<&ISelfController::SetFocusHandlingMode>, "SetFocusHandlingMode"}, + {14, D<&ISelfController::SetRestartMessageEnabled>, "SetRestartMessageEnabled"}, + {15, D<&ISelfController::SetScreenShotAppletIdentityInfo>, "SetScreenShotAppletIdentityInfo"}, + {16, D<&ISelfController::SetOutOfFocusSuspendingEnabled>, "SetOutOfFocusSuspendingEnabled"}, + {17, nullptr, "SetControllerFirmwareUpdateSection"}, + {18, nullptr, "SetRequiresCaptureButtonShortPressedMessage"}, + {19, D<&ISelfController::SetAlbumImageOrientation>, "SetAlbumImageOrientation"}, + {20, nullptr, "SetDesirableKeyboardLayout"}, + {21, nullptr, "GetScreenShotProgramId"}, + {40, D<&ISelfController::CreateManagedDisplayLayer>, "CreateManagedDisplayLayer"}, + {41, D<&ISelfController::IsSystemBufferSharingEnabled>, "IsSystemBufferSharingEnabled"}, + {42, D<&ISelfController::GetSystemSharedLayerHandle>, "GetSystemSharedLayerHandle"}, + {43, D<&ISelfController::GetSystemSharedBufferHandle>, "GetSystemSharedBufferHandle"}, + {44, D<&ISelfController::CreateManagedDisplaySeparableLayer>, "CreateManagedDisplaySeparableLayer"}, + {45, nullptr, "SetManagedDisplayLayerSeparationMode"}, + {46, nullptr, "SetRecordingLayerCompositionEnabled"}, + {50, D<&ISelfController::SetHandlesRequestToDisplay>, "SetHandlesRequestToDisplay"}, + {51, D<&ISelfController::ApproveToDisplay>, "ApproveToDisplay"}, + {60, D<&ISelfController::OverrideAutoSleepTimeAndDimmingTime>, "OverrideAutoSleepTimeAndDimmingTime"}, + {61, D<&ISelfController::SetMediaPlaybackState>, "SetMediaPlaybackState"}, + {62, D<&ISelfController::SetIdleTimeDetectionExtension>, "SetIdleTimeDetectionExtension"}, + {63, D<&ISelfController::GetIdleTimeDetectionExtension>, "GetIdleTimeDetectionExtension"}, + {64, nullptr, "SetInputDetectionSourceSet"}, + {65, D<&ISelfController::ReportUserIsActive>, "ReportUserIsActive"}, + {66, nullptr, "GetCurrentIlluminance"}, + {67, D<&ISelfController::IsIlluminanceAvailable>, "IsIlluminanceAvailable"}, + {68, D<&ISelfController::SetAutoSleepDisabled>, "SetAutoSleepDisabled"}, + {69, D<&ISelfController::IsAutoSleepDisabled>, "IsAutoSleepDisabled"}, + {70, nullptr, "ReportMultimediaError"}, + {71, nullptr, "GetCurrentIlluminanceEx"}, + {72, D<&ISelfController::SetInputDetectionPolicy>, "SetInputDetectionPolicy"}, + {80, nullptr, "SetWirelessPriorityMode"}, + {90, D<&ISelfController::GetAccumulatedSuspendedTickValue>, "GetAccumulatedSuspendedTickValue"}, + {91, D<&ISelfController::GetAccumulatedSuspendedTickChangedEvent>, "GetAccumulatedSuspendedTickChangedEvent"}, + {100, D<&ISelfController::SetAlbumImageTakenNotificationEnabled>, "SetAlbumImageTakenNotificationEnabled"}, + {110, nullptr, "SetApplicationAlbumUserData"}, + {120, D<&ISelfController::SaveCurrentScreenshot>, "SaveCurrentScreenshot"}, + {130, D<&ISelfController::SetRecordVolumeMuted>, "SetRecordVolumeMuted"}, + {230, D<&ISelfController::Unknown230>, "Unknown230"}, + {240, D<&ISelfController::Unknown240>, "Unknown240"}, + {1000, nullptr, "GetDebugStorageChannel"}, + }; + // clang-format on + + RegisterHandlers(functions); + std::scoped_lock lk{m_applet->lock}; m_applet->display_layer_manager.Initialize(system, m_process, m_applet->applet_id, m_applet->library_applet_mode); diff --git a/src/core/hle/service/am/service/self_controller.h b/src/core/hle/service/am/service/self_controller.h index ce77769da2..c9f480f575 100644 --- a/src/core/hle/service/am/service/self_controller.h +++ b/src/core/hle/service/am/service/self_controller.h @@ -70,7 +70,6 @@ private: Result Unknown230(u32 in_val, Out out_val); Result Unknown240(u32 in_val); - std::optional FindRequest(u32 key) override; Kernel::KProcess* const m_process; const std::shared_ptr m_applet; }; diff --git a/src/core/hle/service/am/service/storage.cpp b/src/core/hle/service/am/service/storage.cpp index 110a9f5a42..5fe191bf2f 100644 --- a/src/core/hle/service/am/service/storage.cpp +++ b/src/core/hle/service/am/service/storage.cpp @@ -4,86 +4,22 @@ // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "core/hle/kernel/k_transfer_memory.h" #include "core/hle/service/am/am_results.h" #include "core/hle/service/am/library_applet_storage.h" #include "core/hle/service/am/service/storage.h" +#include "core/hle/service/am/service/storage_accessor.h" #include "core/hle/service/cmif_serialization.h" namespace Service::AM { -class IStorageAccessor final : public ServiceFramework { -public: - explicit IStorageAccessor(Core::System& system_, std::shared_ptr impl) : ServiceFramework{system_, "IStorageAccessor"}, m_impl{std::move(impl)} {} - ~IStorageAccessor() override = default; - - Result GetSize(Out out_size) { - LOG_DEBUG(Service_AM, "called"); - *out_size = m_impl->GetSize(); - R_SUCCEED(); - } - - Result Write(InBuffer buffer, s64 offset) { - LOG_DEBUG(Service_AM, "called, offset={} size={}", offset, buffer.size()); - R_RETURN(m_impl->Write(offset, buffer.data(), buffer.size())); - } - - Result Read(OutBuffer out_buffer, s64 offset) { - LOG_DEBUG(Service_AM, "called, offset={} size={}", offset, out_buffer.size()); - R_RETURN(m_impl->Read(offset, out_buffer.data(), out_buffer.size())); - } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IStorageAccessor::GetSize>, "GetSize"}, - FunctionInfo{10, D<&IStorageAccessor::Write>, "Write"}, - FunctionInfo{11, D<&IStorageAccessor::Read>, "Read"} - ); - - const std::shared_ptr m_impl; -}; - -class ITransferStorageAccessor final : public ServiceFramework { -public: - explicit ITransferStorageAccessor(Core::System& system_, std::shared_ptr impl) : ServiceFramework{system_, "ITransferStorageAccessor"}, m_impl{std::move(impl)} {} - ~ITransferStorageAccessor() override = default; - - Result GetSize(Out out_size) { - LOG_DEBUG(Service_AM, "called"); - *out_size = m_impl->GetSize(); - R_SUCCEED(); - } - - Result GetHandle(Out out_size, OutCopyHandle out_handle) { - LOG_INFO(Service_AM, "called"); - *out_size = m_impl->GetSize(); - *out_handle = m_impl->GetHandle(); - R_SUCCEED(); - } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&ITransferStorageAccessor::GetSize>, "GetSize"}, - FunctionInfo{1, D<&ITransferStorageAccessor::GetHandle>, "GetHandle"} - ); - - const std::shared_ptr m_impl; -}; - -std::optional IStorage::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IStorage::Open>, "Open"}, - FunctionInfo{1, D<&IStorage::OpenTransferStorage>, "OpenTransferStorage"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IStorage::IStorage(Core::System& system_, std::shared_ptr impl) : ServiceFramework{system_, "IStorage"}, m_impl{std::move(impl)} { + static const FunctionInfo functions[] = { + {0, D<&IStorage::Open>, "Open"}, + {1, D<&IStorage::OpenTransferStorage>, "OpenTransferStorage"}, + }; + + RegisterHandlers(functions); } IStorage::IStorage(Core::System& system_, std::vector&& data) diff --git a/src/core/hle/service/am/service/storage.h b/src/core/hle/service/am/service/storage.h index 63b7a0ad4c..462c823206 100644 --- a/src/core/hle/service/am/service/storage.h +++ b/src/core/hle/service/am/service/storage.h @@ -32,7 +32,6 @@ private: Result OpenTransferStorage( Out> out_transfer_storage_accessor); - std::optional FindRequest(u32 key) override; const std::shared_ptr m_impl; }; diff --git a/src/core/hle/service/am/service/storage_accessor.cpp b/src/core/hle/service/am/service/storage_accessor.cpp new file mode 100644 index 0000000000..2fe379a74d --- /dev/null +++ b/src/core/hle/service/am/service/storage_accessor.cpp @@ -0,0 +1,71 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/hle/kernel/k_transfer_memory.h" +#include "core/hle/service/am/library_applet_storage.h" +#include "core/hle/service/am/service/storage_accessor.h" +#include "core/hle/service/cmif_serialization.h" + +namespace Service::AM { + +IStorageAccessor::IStorageAccessor(Core::System& system_, + std::shared_ptr impl) + : ServiceFramework{system_, "IStorageAccessor"}, m_impl{std::move(impl)} { + static const FunctionInfo functions[] = { + {0, D<&IStorageAccessor::GetSize>, "GetSize"}, + {10, D<&IStorageAccessor::Write>, "Write"}, + {11, D<&IStorageAccessor::Read>, "Read"}, + }; + + RegisterHandlers(functions); +} + +IStorageAccessor::~IStorageAccessor() = default; + +Result IStorageAccessor::GetSize(Out out_size) { + LOG_DEBUG(Service_AM, "called"); + *out_size = m_impl->GetSize(); + R_SUCCEED(); +} + +Result IStorageAccessor::Write(InBuffer buffer, s64 offset) { + LOG_DEBUG(Service_AM, "called, offset={} size={}", offset, buffer.size()); + R_RETURN(m_impl->Write(offset, buffer.data(), buffer.size())); +} + +Result IStorageAccessor::Read(OutBuffer out_buffer, s64 offset) { + LOG_DEBUG(Service_AM, "called, offset={} size={}", offset, out_buffer.size()); + R_RETURN(m_impl->Read(offset, out_buffer.data(), out_buffer.size())); +} + +ITransferStorageAccessor::ITransferStorageAccessor(Core::System& system_, + std::shared_ptr impl) + : ServiceFramework{system_, "ITransferStorageAccessor"}, m_impl{std::move(impl)} { + static const FunctionInfo functions[] = { + {0, D<&ITransferStorageAccessor::GetSize>, "GetSize"}, + {1, D<&ITransferStorageAccessor::GetHandle>, "GetHandle"}, + }; + + RegisterHandlers(functions); +} + +ITransferStorageAccessor::~ITransferStorageAccessor() = default; + +Result ITransferStorageAccessor::GetSize(Out out_size) { + LOG_DEBUG(Service_AM, "called"); + *out_size = m_impl->GetSize(); + R_SUCCEED(); +} + +Result ITransferStorageAccessor::GetHandle(Out out_size, + OutCopyHandle out_handle) { + LOG_INFO(Service_AM, "called"); + *out_size = m_impl->GetSize(); + *out_handle = m_impl->GetHandle(); + R_SUCCEED(); +} + +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/storage_accessor.h b/src/core/hle/service/am/service/storage_accessor.h new file mode 100644 index 0000000000..76af3de363 --- /dev/null +++ b/src/core/hle/service/am/service/storage_accessor.h @@ -0,0 +1,41 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/am/library_applet_storage.h" +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/service.h" + +namespace Service::AM { + +class IStorageAccessor final : public ServiceFramework { +public: + explicit IStorageAccessor(Core::System& system_, std::shared_ptr impl); + ~IStorageAccessor() override; + +private: + Result GetSize(Out out_size); + Result Write(InBuffer buffer, s64 offset); + Result Read(OutBuffer out_buffer, s64 offset); + + const std::shared_ptr m_impl; +}; + +class ITransferStorageAccessor final : public ServiceFramework { +public: + explicit ITransferStorageAccessor(Core::System& system_, + std::shared_ptr impl); + ~ITransferStorageAccessor() override; + +private: + Result GetSize(Out out_size); + Result GetHandle(Out out_size, OutCopyHandle out_handle); + + const std::shared_ptr m_impl; +}; + +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/system_applet_proxy.cpp b/src/core/hle/service/am/service/system_applet_proxy.cpp new file mode 100644 index 0000000000..bb56750d09 --- /dev/null +++ b/src/core/hle/service/am/service/system_applet_proxy.cpp @@ -0,0 +1,136 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/hle/service/am/service/applet_common_functions.h" +#include "core/hle/service/am/service/application_creator.h" +#include "core/hle/service/am/service/audio_controller.h" +#include "core/hle/service/am/service/common_state_getter.h" +#include "core/hle/service/am/service/debug_functions.h" +#include "core/hle/service/am/service/display_controller.h" +#include "core/hle/service/am/service/global_state_controller.h" +#include "core/hle/service/am/service/home_menu_functions.h" +#include "core/hle/service/am/service/library_applet_creator.h" +#include "core/hle/service/am/service/process_winding_controller.h" +#include "core/hle/service/am/service/self_controller.h" +#include "core/hle/service/am/service/system_applet_proxy.h" +#include "core/hle/service/am/service/window_controller.h" +#include "core/hle/service/cmif_serialization.h" + +namespace Service::AM { + +ISystemAppletProxy::ISystemAppletProxy(Core::System& system_, std::shared_ptr applet, + Kernel::KProcess* process, WindowSystem& window_system) + : ServiceFramework{system_, "ISystemAppletProxy"}, + m_window_system{window_system}, m_process{process}, m_applet{std::move(applet)} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&ISystemAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"}, + {1, D<&ISystemAppletProxy::GetSelfController>, "GetSelfController"}, + {2, D<&ISystemAppletProxy::GetWindowController>, "GetWindowController"}, + {3, D<&ISystemAppletProxy::GetAudioController>, "GetAudioController"}, + {4, D<&ISystemAppletProxy::GetDisplayController>, "GetDisplayController"}, + {10, D<&ISystemAppletProxy::GetProcessWindingController>, "GetProcessWindingController"}, + {11, D<&ISystemAppletProxy::GetLibraryAppletCreator>, "GetLibraryAppletCreator"}, + {20, D<&ISystemAppletProxy::GetHomeMenuFunctions>, "GetHomeMenuFunctions"}, + {21, D<&ISystemAppletProxy::GetGlobalStateController>, "GetGlobalStateController"}, + {22, D<&ISystemAppletProxy::GetApplicationCreator>, "GetApplicationCreator"}, + {23, D<&ISystemAppletProxy::GetAppletCommonFunctions>, "GetAppletCommonFunctions"}, + {1000, D<&ISystemAppletProxy::GetDebugFunctions>, "GetDebugFunctions"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +ISystemAppletProxy::~ISystemAppletProxy() = default; + +Result ISystemAppletProxy::GetAudioController( + Out> out_audio_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_audio_controller = std::make_shared(system); + R_SUCCEED(); +} + +Result ISystemAppletProxy::GetDisplayController( + Out> out_display_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_display_controller = std::make_shared(system, m_applet); + R_SUCCEED(); +} + +Result ISystemAppletProxy::GetProcessWindingController( + Out> out_process_winding_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_process_winding_controller = std::make_shared(system, m_applet); + R_SUCCEED(); +} + +Result ISystemAppletProxy::GetDebugFunctions( + Out> out_debug_functions) { + LOG_DEBUG(Service_AM, "called"); + *out_debug_functions = std::make_shared(system); + R_SUCCEED(); +} + +Result ISystemAppletProxy::GetWindowController( + Out> out_window_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_window_controller = std::make_shared(system, m_applet, m_window_system); + R_SUCCEED(); +} + +Result ISystemAppletProxy::GetSelfController( + Out> out_self_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_self_controller = std::make_shared(system, m_applet, m_process); + R_SUCCEED(); +} + +Result ISystemAppletProxy::GetCommonStateGetter( + Out> out_common_state_getter) { + LOG_DEBUG(Service_AM, "called"); + *out_common_state_getter = std::make_shared(system, m_applet); + R_SUCCEED(); +} + +Result ISystemAppletProxy::GetLibraryAppletCreator( + Out> out_library_applet_creator) { + LOG_DEBUG(Service_AM, "called"); + *out_library_applet_creator = + std::make_shared(system, m_applet, m_window_system); + R_SUCCEED(); +} + +Result ISystemAppletProxy::GetApplicationCreator( + Out> out_application_creator) { + LOG_DEBUG(Service_AM, "called"); + *out_application_creator = std::make_shared(system, m_window_system); + R_SUCCEED(); +} + +Result ISystemAppletProxy::GetAppletCommonFunctions( + Out> out_applet_common_functions) { + LOG_DEBUG(Service_AM, "called"); + *out_applet_common_functions = std::make_shared(system, m_applet); + R_SUCCEED(); +} + +Result ISystemAppletProxy::GetHomeMenuFunctions( + Out> out_home_menu_functions) { + LOG_DEBUG(Service_AM, "called"); + *out_home_menu_functions = + std::make_shared(system, m_applet, m_window_system); + R_SUCCEED(); +} + +Result ISystemAppletProxy::GetGlobalStateController( + Out> out_global_state_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_global_state_controller = std::make_shared(system); + R_SUCCEED(); +} + +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/system_applet_proxy.h b/src/core/hle/service/am/service/system_applet_proxy.h new file mode 100644 index 0000000000..76cef507a5 --- /dev/null +++ b/src/core/hle/service/am/service/system_applet_proxy.h @@ -0,0 +1,58 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/service.h" + +namespace Service::AM { + +struct Applet; +class IAppletCommonFunctions; +class IApplicationCreator; +class IAudioController; +class ICommonStateGetter; +class IDebugFunctions; +class IDisplayController; +class IHomeMenuFunctions; +class IGlobalStateController; +class ILibraryAppletCreator; +class IProcessWindingController; +class ISelfController; +class IWindowController; +class WindowSystem; + +class ISystemAppletProxy final : public ServiceFramework { +public: + explicit ISystemAppletProxy(Core::System& system, std::shared_ptr applet, + Kernel::KProcess* process, WindowSystem& window_system); + ~ISystemAppletProxy(); + +private: + Result GetCommonStateGetter(Out> out_common_state_getter); + Result GetSelfController(Out> out_self_controller); + Result GetWindowController(Out> out_window_controller); + Result GetAudioController(Out> out_audio_controller); + Result GetDisplayController(Out> out_display_controller); + Result GetProcessWindingController( + Out> out_process_winding_controller); + Result GetDebugFunctions(Out> out_debug_functions); + Result GetLibraryAppletCreator( + Out> out_library_applet_creator); + Result GetApplicationCreator(Out> out_application_creator); + Result GetAppletCommonFunctions( + Out> out_applet_common_functions); + Result GetHomeMenuFunctions(Out> out_home_menu_functions); + Result GetGlobalStateController( + Out> out_global_state_controller); + + WindowSystem& m_window_system; + Kernel::KProcess* const m_process; + const std::shared_ptr m_applet; +}; + +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/window_controller.cpp b/src/core/hle/service/am/service/window_controller.cpp index d07aba0c79..f2b9dccb27 100644 --- a/src/core/hle/service/am/service/window_controller.cpp +++ b/src/core/hle/service/am/service/window_controller.cpp @@ -12,24 +12,24 @@ namespace Service::AM { -std::optional IWindowController::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "CreateWindow"}, - FunctionInfo{1, D<&IWindowController::GetAppletResourceUserId>, "GetAppletResourceUserId"}, - FunctionInfo{2, D<&IWindowController::GetAppletResourceUserIdOfCallerApplet>, "GetAppletResourceUserIdOfCallerApplet"}, - FunctionInfo{10, D<&IWindowController::AcquireForegroundRights>, "AcquireForegroundRights"}, - FunctionInfo{11, D<&IWindowController::ReleaseForegroundRights>, "ReleaseForegroundRights"}, - FunctionInfo{12, D<&IWindowController::RejectToChangeIntoBackground>, "RejectToChangeIntoBackground"}, - FunctionInfo{20, D<&IWindowController::SetAppletWindowVisibility>, "SetAppletWindowVisibility"}, - FunctionInfo{21, D<&IWindowController::SetAppletGpuTimeSlice>, "SetAppletGpuTimeSlice"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IWindowController::IWindowController(Core::System& system_, std::shared_ptr applet, WindowSystem& window_system) : ServiceFramework{system_, "IWindowController"}, m_window_system{window_system}, m_applet{std::move(applet)} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "CreateWindow"}, + {1, D<&IWindowController::GetAppletResourceUserId>, "GetAppletResourceUserId"}, + {2, D<&IWindowController::GetAppletResourceUserIdOfCallerApplet>, "GetAppletResourceUserIdOfCallerApplet"}, + {10, D<&IWindowController::AcquireForegroundRights>, "AcquireForegroundRights"}, + {11, D<&IWindowController::ReleaseForegroundRights>, "ReleaseForegroundRights"}, + {12, D<&IWindowController::RejectToChangeIntoBackground>, "RejectToChangeIntoBackground"}, + {20, D<&IWindowController::SetAppletWindowVisibility>, "SetAppletWindowVisibility"}, + {21, D<&IWindowController::SetAppletGpuTimeSlice>, "SetAppletGpuTimeSlice"}, + }; + // clang-format on + + RegisterHandlers(functions); } IWindowController::~IWindowController() = default; diff --git a/src/core/hle/service/am/service/window_controller.h b/src/core/hle/service/am/service/window_controller.h index 29fd723421..51a67f3039 100644 --- a/src/core/hle/service/am/service/window_controller.h +++ b/src/core/hle/service/am/service/window_controller.h @@ -29,7 +29,6 @@ private: Result SetAppletWindowVisibility(bool visible); Result SetAppletGpuTimeSlice(s64 time_slice); - std::optional FindRequest(u32 key) override; WindowSystem& m_window_system; const std::shared_ptr m_applet; }; diff --git a/src/core/hle/service/aoc/addon_content_manager.cpp b/src/core/hle/service/aoc/addon_content_manager.cpp index 0222d9c52b..be2aa34baa 100644 --- a/src/core/hle/service/aoc/addon_content_manager.cpp +++ b/src/core/hle/service/aoc/addon_content_manager.cpp @@ -28,34 +28,6 @@ namespace Service::AOC { -std::optional IAddOnContentManager::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "CountAddOnContentByApplicationId"}, - FunctionInfo{1, nullptr, "ListAddOnContentByApplicationId"}, - FunctionInfo{2, D<&IAddOnContentManager::CountAddOnContent>, "CountAddOnContent"}, - FunctionInfo{3, D<&IAddOnContentManager::ListAddOnContent>, "ListAddOnContent"}, - FunctionInfo{4, nullptr, "GetAddOnContentBaseIdByApplicationId"}, - FunctionInfo{5, D<&IAddOnContentManager::GetAddOnContentBaseId>, "GetAddOnContentBaseId"}, - FunctionInfo{6, nullptr, "PrepareAddOnContentByApplicationId"}, - FunctionInfo{7, D<&IAddOnContentManager::PrepareAddOnContent>, "PrepareAddOnContent"}, - FunctionInfo{8, D<&IAddOnContentManager::GetAddOnContentListChangedEvent>, "GetAddOnContentListChangedEvent"}, - FunctionInfo{9, nullptr, "GetAddOnContentLostErrorCode"}, - FunctionInfo{10, D<&IAddOnContentManager::GetAddOnContentListChangedEventWithProcessId>, "GetAddOnContentListChangedEventWithProcessId"}, - FunctionInfo{11, D<&IAddOnContentManager::NotifyMountAddOnContent>, "NotifyMountAddOnContent"}, - FunctionInfo{12, D<&IAddOnContentManager::NotifyUnmountAddOnContent>, "NotifyUnmountAddOnContent"}, - FunctionInfo{13, nullptr, "IsAddOnContentMountedForDebug"}, - FunctionInfo{50, D<&IAddOnContentManager::CheckAddOnContentMountStatus>, "CheckAddOnContentMountStatus"}, - FunctionInfo{100, D<&IAddOnContentManager::CreateEcPurchasedEventManager>, "CreateEcPurchasedEventManager"}, - FunctionInfo{101, D<&IAddOnContentManager::CreatePermanentEcPurchasedEventManager>, "CreatePermanentEcPurchasedEventManager"}, - FunctionInfo{110, nullptr, "CreateContentsServiceManager"}, - FunctionInfo{200, nullptr, "SetRequiredAddOnContentsOnContentsAvailabilityTransition"}, - FunctionInfo{300, nullptr, "SetupHostAddOnContent"}, - FunctionInfo{301, nullptr, "GetRegisteredAddOnContentPath"}, - FunctionInfo{302, nullptr, "UpdateCachedList"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - static bool CheckAOCTitleIDMatchesBase(u64 title_id, u64 base) { return FileSys::GetBaseTitleID(title_id) == base; } @@ -85,6 +57,35 @@ static std::vector AccumulateAOCTitleIDs(Core::System& system) { IAddOnContentManager::IAddOnContentManager(Core::System& system_) : ServiceFramework{system_, "aoc:u"}, add_on_content{AccumulateAOCTitleIDs(system)}, service_context{system_, "aoc:u"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "CountAddOnContentByApplicationId"}, + {1, nullptr, "ListAddOnContentByApplicationId"}, + {2, D<&IAddOnContentManager::CountAddOnContent>, "CountAddOnContent"}, + {3, D<&IAddOnContentManager::ListAddOnContent>, "ListAddOnContent"}, + {4, nullptr, "GetAddOnContentBaseIdByApplicationId"}, + {5, D<&IAddOnContentManager::GetAddOnContentBaseId>, "GetAddOnContentBaseId"}, + {6, nullptr, "PrepareAddOnContentByApplicationId"}, + {7, D<&IAddOnContentManager::PrepareAddOnContent>, "PrepareAddOnContent"}, + {8, D<&IAddOnContentManager::GetAddOnContentListChangedEvent>, "GetAddOnContentListChangedEvent"}, + {9, nullptr, "GetAddOnContentLostErrorCode"}, + {10, D<&IAddOnContentManager::GetAddOnContentListChangedEventWithProcessId>, "GetAddOnContentListChangedEventWithProcessId"}, + {11, D<&IAddOnContentManager::NotifyMountAddOnContent>, "NotifyMountAddOnContent"}, + {12, D<&IAddOnContentManager::NotifyUnmountAddOnContent>, "NotifyUnmountAddOnContent"}, + {13, nullptr, "IsAddOnContentMountedForDebug"}, + {50, D<&IAddOnContentManager::CheckAddOnContentMountStatus>, "CheckAddOnContentMountStatus"}, + {100, D<&IAddOnContentManager::CreateEcPurchasedEventManager>, "CreateEcPurchasedEventManager"}, + {101, D<&IAddOnContentManager::CreatePermanentEcPurchasedEventManager>, "CreatePermanentEcPurchasedEventManager"}, + {110, nullptr, "CreateContentsServiceManager"}, + {200, nullptr, "SetRequiredAddOnContentsOnContentsAvailabilityTransition"}, + {300, nullptr, "SetupHostAddOnContent"}, + {301, nullptr, "GetRegisteredAddOnContentPath"}, + {302, nullptr, "UpdateCachedList"}, + }; + // clang-format on + + RegisterHandlers(functions); + aoc_change_event = service_context.CreateEvent("GetAddOnContentListChanged:Event"); } diff --git a/src/core/hle/service/aoc/addon_content_manager.h b/src/core/hle/service/aoc/addon_content_manager.h index 8ddb86cf19..b505525590 100644 --- a/src/core/hle/service/aoc/addon_content_manager.h +++ b/src/core/hle/service/aoc/addon_content_manager.h @@ -43,9 +43,9 @@ public: OutInterface out_interface); private: - std::optional FindRequest(u32 key) override; std::vector add_on_content; KernelHelpers::ServiceContext service_context; + Kernel::KEvent* aoc_change_event; }; diff --git a/src/core/hle/service/aoc/purchase_event_manager.cpp b/src/core/hle/service/aoc/purchase_event_manager.cpp index eded803b25..64e1244967 100644 --- a/src/core/hle/service/aoc/purchase_event_manager.cpp +++ b/src/core/hle/service/aoc/purchase_event_manager.cpp @@ -11,20 +11,21 @@ namespace Service::AOC { constexpr Result ResultNoPurchasedProductInfoAvailable{ErrorModule::NIMShop, 400}; -std::optional IPurchaseEventManager::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IPurchaseEventManager::SetDefaultDeliveryTarget>, "SetDefaultDeliveryTarget"}, - FunctionInfo{1, D<&IPurchaseEventManager::SetDeliveryTarget>, "SetDeliveryTarget"}, - FunctionInfo{2, D<&IPurchaseEventManager::GetPurchasedEvent>, "GetPurchasedEvent"}, - FunctionInfo{3, D<&IPurchaseEventManager::PopPurchasedProductInfo>, "PopPurchasedProductInfo"}, - FunctionInfo{4, D<&IPurchaseEventManager::PopPurchasedProductInfoWithUid>, "PopPurchasedProductInfoWithUid"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IPurchaseEventManager::IPurchaseEventManager(Core::System& system_) - : ServiceFramework{system_, "IPurchaseEventManager"} - , service_context{system, "IPurchaseEventManager"} { + : ServiceFramework{system_, "IPurchaseEventManager"}, service_context{system, + "IPurchaseEventManager"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IPurchaseEventManager::SetDefaultDeliveryTarget>, "SetDefaultDeliveryTarget"}, + {1, D<&IPurchaseEventManager::SetDeliveryTarget>, "SetDeliveryTarget"}, + {2, D<&IPurchaseEventManager::GetPurchasedEvent>, "GetPurchasedEvent"}, + {3, D<&IPurchaseEventManager::PopPurchasedProductInfo>, "PopPurchasedProductInfo"}, + {4, D<&IPurchaseEventManager::PopPurchasedProductInfoWithUid>, "PopPurchasedProductInfoWithUid"}, + }; + // clang-format on + + RegisterHandlers(functions); + purchased_event = service_context.CreateEvent("IPurchaseEventManager:PurchasedEvent"); } diff --git a/src/core/hle/service/aoc/purchase_event_manager.h b/src/core/hle/service/aoc/purchase_event_manager.h index d11089e567..c0bdfaf242 100644 --- a/src/core/hle/service/aoc/purchase_event_manager.h +++ b/src/core/hle/service/aoc/purchase_event_manager.h @@ -25,8 +25,6 @@ public: Result PopPurchasedProductInfo(); Result PopPurchasedProductInfoWithUid(); - std::optional FindRequest(u32 key) override; - private: KernelHelpers::ServiceContext service_context; Kernel::KEvent* purchased_event; diff --git a/src/core/hle/service/apm/apm.h b/src/core/hle/service/apm/apm.h index e188b4e446..265e581697 100644 --- a/src/core/hle/service/apm/apm.h +++ b/src/core/hle/service/apm/apm.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/apm/apm_controller.h b/src/core/hle/service/apm/apm_controller.h index 3357b7762a..c2f65a2f0e 100644 --- a/src/core/hle/service/apm/apm_controller.h +++ b/src/core/hle/service/apm/apm_controller.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/apm/apm_interface.cpp b/src/core/hle/service/apm/apm_interface.cpp index 2b4768478e..51c01e2f25 100644 --- a/src/core/hle/service/apm/apm_interface.cpp +++ b/src/core/hle/service/apm/apm_interface.cpp @@ -14,7 +14,15 @@ namespace Service::APM { class ISession final : public ServiceFramework { public: - explicit ISession(Core::System& system_, Controller& controller_) : ServiceFramework{system_, "ISession"}, controller{controller_} {} + explicit ISession(Core::System& system_, Controller& controller_) + : ServiceFramework{system_, "ISession"}, controller{controller_} { + static const FunctionInfo functions[] = { + {0, &ISession::SetPerformanceConfiguration, "SetPerformanceConfiguration"}, + {1, &ISession::GetPerformanceConfiguration, "GetPerformanceConfiguration"}, + {2, &ISession::SetCpuOverclockEnabled, "SetCpuOverclockEnabled"}, + }; + RegisterHandlers(functions); + } private: void SetPerformanceConfiguration(HLERequestContext& ctx) { @@ -53,20 +61,18 @@ private: rb.Push(ResultSuccess); } - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &ISession::SetPerformanceConfiguration, "SetPerformanceConfiguration"}, - FunctionInfo{1, &ISession::GetPerformanceConfiguration, "GetPerformanceConfiguration"}, - FunctionInfo{2, &ISession::SetCpuOverclockEnabled, "SetCpuOverclockEnabled"} - ); Controller& controller; }; APM::APM(Core::System& system_, std::shared_ptr apm_, Controller& controller_, const char* name) : ServiceFramework{system_, name}, apm(std::move(apm_)), controller{controller_} { + static const FunctionInfo functions[] = { + {0, &APM::OpenSession, "OpenSession"}, + {1, &APM::GetPerformanceMode, "GetPerformanceMode"}, + {6, &APM::IsCpuOverclockEnabled, "IsCpuOverclockEnabled"}, + }; + RegisterHandlers(functions); } APM::~APM() = default; @@ -96,6 +102,20 @@ void APM::IsCpuOverclockEnabled(HLERequestContext& ctx) { APM_Sys::APM_Sys(Core::System& system_, Controller& controller_) : ServiceFramework{system_, "apm:sys"}, controller{controller_} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "RequestPerformanceMode"}, + {1, &APM_Sys::GetPerformanceEvent, "GetPerformanceEvent"}, + {2, nullptr, "GetThrottlingState"}, + {3, nullptr, "GetLastThrottlingState"}, + {4, nullptr, "ClearLastThrottlingState"}, + {5, nullptr, "LoadAndApplySettings"}, + {6, &APM_Sys::SetCpuBoostMode, "SetCpuBoostMode"}, + {7, &APM_Sys::GetCurrentPerformanceConfiguration, "GetCurrentPerformanceConfiguration"}, + }; + // clang-format on + + RegisterHandlers(functions); } APM_Sys::~APM_Sys() = default; diff --git a/src/core/hle/service/apm/apm_interface.h b/src/core/hle/service/apm/apm_interface.h index 0bbcd185a3..eeac3474b0 100644 --- a/src/core/hle/service/apm/apm_interface.h +++ b/src/core/hle/service/apm/apm_interface.h @@ -24,14 +24,6 @@ private: void GetPerformanceMode(HLERequestContext& ctx); void IsCpuOverclockEnabled(HLERequestContext& ctx); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &APM::OpenSession, "OpenSession"}, - FunctionInfo{1, &APM::GetPerformanceMode, "GetPerformanceMode"}, - FunctionInfo{6, &APM::IsCpuOverclockEnabled, "IsCpuOverclockEnabled"} - ); std::shared_ptr apm; Controller& controller; }; @@ -47,19 +39,6 @@ private: void GetPerformanceEvent(HLERequestContext& ctx); void GetCurrentPerformanceConfiguration(HLERequestContext& ctx); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "RequestPerformanceMode"}, - FunctionInfo{1, &APM_Sys::GetPerformanceEvent, "GetPerformanceEvent"}, - FunctionInfo{2, nullptr, "GetThrottlingState"}, - FunctionInfo{3, nullptr, "GetLastThrottlingState"}, - FunctionInfo{4, nullptr, "ClearLastThrottlingState"}, - FunctionInfo{5, nullptr, "LoadAndApplySettings"}, - FunctionInfo{6, &APM_Sys::SetCpuBoostMode, "SetCpuBoostMode"}, - FunctionInfo{7, &APM_Sys::GetCurrentPerformanceConfiguration, "GetCurrentPerformanceConfiguration"} - ); Controller& controller; }; diff --git a/src/core/hle/service/audio/audio.cpp b/src/core/hle/service/audio/audio.cpp index 6177efd46c..fde766a275 100644 --- a/src/core/hle/service/audio/audio.cpp +++ b/src/core/hle/service/audio/audio.cpp @@ -21,164 +21,164 @@ namespace Service::Audio { class IAudioOutManagerForApplet final : public ServiceFramework { public: explicit IAudioOutManagerForApplet(Core::System& system_) - : ServiceFramework{system_, "audout:a"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "RequestSuspend"}, - FunctionInfo{1, nullptr, "RequestResume"}, - FunctionInfo{2, nullptr, "GetProcessMasterVolume"}, - FunctionInfo{3, nullptr, "SetProcessMasterVolume"}, - FunctionInfo{4, nullptr, "GetProcessRecordVolume"}, - FunctionInfo{5, nullptr, "SetProcessRecordVolume"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + : ServiceFramework{system_, "audout:a"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "RequestSuspend"}, + {1, nullptr, "RequestResume"}, + {2, nullptr, "GetProcessMasterVolume"}, + {3, nullptr, "SetProcessMasterVolume"}, + {4, nullptr, "GetProcessRecordVolume"}, + {5, nullptr, "SetProcessRecordVolume"}, + }; + // clang-format on + RegisterHandlers(functions); } }; class IAudioSnoopManager final : public ServiceFramework { public: explicit IAudioSnoopManager(Core::System& system_) - : ServiceFramework{system_, "auddev"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetDspStatistics"}, - FunctionInfo{1, nullptr, "GetAppletStateSummaries"}, - FunctionInfo{2, nullptr, "SetDspStatisticsParameter"}, - FunctionInfo{3, nullptr, "GetDspStatisticsParameter"}, - FunctionInfo{6, nullptr, "GetDspUsage"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + : ServiceFramework{system_, "auddev"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetDspStatistics"}, + {1, nullptr, "GetAppletStateSummaries"}, + {2, nullptr, "SetDspStatisticsParameter"}, + {3, nullptr, "GetDspStatisticsParameter"}, + {6, nullptr, "GetDspUsage"}, + }; + // clang-format on + RegisterHandlers(functions); } }; class IAudioInManagerForApplet final : public ServiceFramework { public: explicit IAudioInManagerForApplet(Core::System& system_) - : ServiceFramework{system_, "audin:a"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "RequestSuspend"}, - FunctionInfo{1, nullptr, "RequestResume"}, - FunctionInfo{2, nullptr, "GetProcessMasterVolume"}, - FunctionInfo{3, nullptr, "SetProcessMasterVolume"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + : ServiceFramework{system_, "audin:a"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "RequestSuspend"}, + {1, nullptr, "RequestResume"}, + {2, nullptr, "GetProcessMasterVolume"}, + {3, nullptr, "SetProcessMasterVolume"}, + }; + // clang-format on + RegisterHandlers(functions); } }; class IAudioRendererManagerForApplet final : public ServiceFramework { public: explicit IAudioRendererManagerForApplet(Core::System& system_) - : ServiceFramework{system_, "audren:a"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "RequestSuspend"}, - FunctionInfo{1, nullptr, "RequestResume"}, - FunctionInfo{2, nullptr, "GetProcessMasterVolume"}, - FunctionInfo{3, nullptr, "SetProcessMasterVolume"}, - FunctionInfo{4, nullptr, "RegisterAppletResourceUserId"}, - FunctionInfo{5, nullptr, "UnregisterAppletResourceUserId"}, - FunctionInfo{6, nullptr, "GetProcessRecordVolume"}, - FunctionInfo{7, nullptr, "SetProcessRecordVolume"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + : ServiceFramework{system_, "audren:a"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "RequestSuspend"}, + {1, nullptr, "RequestResume"}, + {2, nullptr, "GetProcessMasterVolume"}, + {3, nullptr, "SetProcessMasterVolume"}, + {4, nullptr, "RegisterAppletResourceUserId"}, + {5, nullptr, "UnregisterAppletResourceUserId"}, + {6, nullptr, "GetProcessRecordVolume"}, + {7, nullptr, "SetProcessRecordVolume"}, + }; + // clang-format on + RegisterHandlers(functions); } }; class IAudioOutManagerForDebugger final : public ServiceFramework { public: explicit IAudioOutManagerForDebugger(Core::System& system_) - : ServiceFramework{system_, "audout:d"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "RequestSuspend"}, - FunctionInfo{1, nullptr, "RequestResume"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + : ServiceFramework{system_, "audout:d"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "RequestSuspend"}, + {1, nullptr, "RequestResume"}, + }; + // clang-format on + RegisterHandlers(functions); } }; class IAudioInManagerForDebugger final : public ServiceFramework { public: explicit IAudioInManagerForDebugger(Core::System& system_) - : ServiceFramework{system_, "audin:d"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "RequestSuspend"}, - FunctionInfo{1, nullptr, "RequestResume"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + : ServiceFramework{system_, "audin:d"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "RequestSuspend"}, + {1, nullptr, "RequestResume"}, + }; + // clang-format on + RegisterHandlers(functions); } }; class IFinalOutputRecorderManagerForDebugger final : public ServiceFramework { public: explicit IFinalOutputRecorderManagerForDebugger(Core::System& system_) - : ServiceFramework{system_, "audrec:d"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "RequestSuspend"}, - FunctionInfo{1, nullptr, "RequestResume"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + : ServiceFramework{system_, "audrec:d"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "RequestSuspend"}, + {1, nullptr, "RequestResume"}, + }; + // clang-format on + RegisterHandlers(functions); } }; class IAudioRendererManagerForDebugger final : public ServiceFramework { public: explicit IAudioRendererManagerForDebugger(Core::System& system_) - : ServiceFramework{system_, "audren:d"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "RequestSuspend"}, - FunctionInfo{1, nullptr, "RequestResume"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + : ServiceFramework{system_, "audren:d"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "RequestSuspend"}, + {1, nullptr, "RequestResume"}, + }; + // clang-format on + RegisterHandlers(functions); } }; class IAudioSystemManagerForApplet final : public ServiceFramework { public: explicit IAudioSystemManagerForApplet(Core::System& system_) - : ServiceFramework{system_, "aud:a"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "RegisterAppletResourceUserId"}, - FunctionInfo{1, nullptr, "UnregisterAppletResourceUserId"}, - FunctionInfo{2, nullptr, "RequestSuspendAudio"}, - FunctionInfo{3, nullptr, "RequestResumeAudio"}, - FunctionInfo{4, nullptr, "GetAudioOutputProcessMasterVolume"}, - FunctionInfo{5, nullptr, "SetAudioOutputProcessMasterVolume"}, - FunctionInfo{6, nullptr, "GetAudioInputProcessMasterVolume"}, - FunctionInfo{7, nullptr, "SetAudioInputProcessMasterVolume"}, - FunctionInfo{8, nullptr, "GetAudioOutputProcessRecordVolume"}, - FunctionInfo{9, nullptr, "SetAudioOutputProcessRecordVolume"}, - FunctionInfo{10, nullptr, "GetAppletStateSummaries"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + : ServiceFramework{system_, "aud:a"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "RegisterAppletResourceUserId"}, + {1, nullptr, "UnregisterAppletResourceUserId"}, + {2, nullptr, "RequestSuspendAudio"}, + {3, nullptr, "RequestResumeAudio"}, + {4, nullptr, "GetAudioOutputProcessMasterVolume"}, + {5, nullptr, "SetAudioOutputProcessMasterVolume"}, + {6, nullptr, "GetAudioInputProcessMasterVolume"}, + {7, nullptr, "SetAudioInputProcessMasterVolume"}, + {8, nullptr, "GetAudioOutputProcessRecordVolume"}, + {9, nullptr, "SetAudioOutputProcessRecordVolume"}, + {10, nullptr, "GetAppletStateSummaries"}, + }; + // clang-format on + RegisterHandlers(functions); } }; class IAudioSystemManagerForDebugger final : public ServiceFramework { public: explicit IAudioSystemManagerForDebugger(Core::System& system_) - : ServiceFramework{system_, "aud:d"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "RequestSuspendAudioForDebug"}, - FunctionInfo{1, nullptr, "RequestResumeAudioForDebug"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + : ServiceFramework{system_, "aud:d"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "RequestSuspendAudioForDebug"}, + {1, nullptr, "RequestResumeAudioForDebug"}, + }; + // clang-format on + RegisterHandlers(functions); } }; diff --git a/src/core/hle/service/audio/audio.h b/src/core/hle/service/audio/audio.h index d70f022c73..eb8f482690 100644 --- a/src/core/hle/service/audio/audio.h +++ b/src/core/hle/service/audio/audio.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/audio/audio_controller.cpp b/src/core/hle/service/audio/audio_controller.cpp index d912a5e86a..9e2db4a84c 100644 --- a/src/core/hle/service/audio/audio_controller.cpp +++ b/src/core/hle/service/audio/audio_controller.cpp @@ -1,9 +1,6 @@ // SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -20,75 +17,77 @@ namespace Service::Audio { -std::optional IAudioController::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IAudioController::GetTargetVolume>, "GetTargetVolume"}, - FunctionInfo{1, D<&IAudioController::SetTargetVolume>, "SetTargetVolume"}, - FunctionInfo{2, D<&IAudioController::GetTargetVolumeMin>, "GetTargetVolumeMin"}, - FunctionInfo{3, D<&IAudioController::GetTargetVolumeMax>, "GetTargetVolumeMax"}, - FunctionInfo{4, D<&IAudioController::IsTargetMute>, "IsTargetMute"}, - FunctionInfo{5, D<&IAudioController::SetTargetMute>, "SetTargetMute"}, - FunctionInfo{6, nullptr, "IsTargetConnected", MakeVersionGate({20,0,0})}, - FunctionInfo{7, nullptr, "SetDefaultTarget"}, - FunctionInfo{8, nullptr, "GetDefaultTarget"}, - FunctionInfo{9, D<&IAudioController::GetAudioOutputMode>, "GetAudioOutputMode"}, - FunctionInfo{10, D<&IAudioController::SetAudioOutputMode>, "SetAudioOutputMode"}, - FunctionInfo{11, nullptr, "SetForceMutePolicy"}, - FunctionInfo{12, D<&IAudioController::GetForceMutePolicy>, "GetForceMutePolicy"}, - FunctionInfo{13, D<&IAudioController::GetOutputModeSetting>, "GetOutputModeSetting"}, - FunctionInfo{14, D<&IAudioController::SetOutputModeSetting>, "SetOutputModeSetting"}, - FunctionInfo{15, nullptr, "SetOutputTarget"}, - FunctionInfo{16, nullptr, "SetInputTargetForceEnabled"}, - FunctionInfo{17, D<&IAudioController::SetHeadphoneOutputLevelMode>, "SetHeadphoneOutputLevelMode"}, - FunctionInfo{18, D<&IAudioController::GetHeadphoneOutputLevelMode>, "GetHeadphoneOutputLevelMode"}, - FunctionInfo{19, nullptr, "AcquireAudioVolumeUpdateEventForPlayReport"}, - FunctionInfo{20, nullptr, "AcquireAudioOutputDeviceUpdateEventForPlayReport"}, - FunctionInfo{21, nullptr, "GetAudioOutputTargetForPlayReport"}, - FunctionInfo{22, D<&IAudioController::NotifyHeadphoneVolumeWarningDisplayedEvent>, "NotifyHeadphoneVolumeWarningDisplayedEvent"}, - FunctionInfo{23, nullptr, "SetSystemOutputMasterVolume"}, - FunctionInfo{24, nullptr, "GetSystemOutputMasterVolume"}, - FunctionInfo{25, nullptr, "GetAudioVolumeDataForPlayReport"}, - FunctionInfo{26, nullptr, "UpdateHeadphoneSettings"}, - FunctionInfo{27, nullptr, "SetVolumeMappingTableForDev"}, - FunctionInfo{28, nullptr, "GetAudioOutputChannelCountForPlayReport"}, - FunctionInfo{29, nullptr, "BindAudioOutputChannelCountUpdateEventForPlayReport"}, - FunctionInfo{30, D<&IAudioController::SetSpeakerAutoMuteEnabled>, "SetSpeakerAutoMuteEnabled"}, - FunctionInfo{31, D<&IAudioController::IsSpeakerAutoMuteEnabled>, "IsSpeakerAutoMuteEnabled"}, - FunctionInfo{32, D<&IAudioController::GetActiveOutputTarget>, "GetActiveOutputTarget"}, - FunctionInfo{33, nullptr, "GetTargetDeviceInfo"}, - FunctionInfo{34, D<&IAudioController::AcquireTargetNotification>, "AcquireTargetNotification"}, - FunctionInfo{35, nullptr, "SetHearingProtectionSafeguardTimerRemainingTimeForDebug"}, - FunctionInfo{36, nullptr, "GetHearingProtectionSafeguardTimerRemainingTimeForDebug"}, - FunctionInfo{37, nullptr, "SetHearingProtectionSafeguardEnabled"}, - FunctionInfo{38, nullptr, "IsHearingProtectionSafeguardEnabled"}, - FunctionInfo{39, nullptr, "IsHearingProtectionSafeguardMonitoringOutputForDebug"}, - FunctionInfo{40, nullptr, "GetSystemInformationForDebug"}, - FunctionInfo{41, nullptr, "SetVolumeButtonLongPressTime"}, - FunctionInfo{42, nullptr, "SetNativeVolumeForDebug"}, - FunctionInfo{43, nullptr, "Unknown43", MakeVersionGate({21,0,0})}, - FunctionInfo{5000, D<&IAudioController::Unknown5000>, "Unknown5000", MakeVersionGate({19,0,0})}, - FunctionInfo{10000, nullptr, "NotifyAudioOutputTargetForPlayReport"}, - FunctionInfo{10001, nullptr, "NotifyAudioOutputChannelCountForPlayReport"}, - FunctionInfo{10002, nullptr, "NotifyUnsupportedUsbOutputDeviceAttachedForPlayReport"}, - FunctionInfo{10100, nullptr, "GetAudioVolumeDataForPlayReport"}, - FunctionInfo{10101, nullptr, "BindAudioVolumeUpdateEventForPlayReport"}, - FunctionInfo{10102, nullptr, "BindAudioOutputTargetUpdateEventForPlayReport"}, - FunctionInfo{10103, nullptr, "GetAudioOutputTargetForPlayReport"}, - FunctionInfo{10104, nullptr, "GetAudioOutputChannelCountForPlayReport"}, - FunctionInfo{10105, nullptr, "BindAudioOutputChannelCountUpdateEventForPlayReport", MakeVersionGate({14,0,0}, {19,0,1})}, - FunctionInfo{10106, nullptr, "GetDefaultAudioOutputTargetForPlayReport", MakeVersionGate({14,0,0}, {19,0,1})}, - FunctionInfo{10200, nullptr, "Unknown10200", MakeVersionGate({20,0,0})}, - FunctionInfo{50000, nullptr, "SetAnalogInputBoostGainForPrototyping", MakeVersionGate({15,0,0}, {18,1,0})}, - FunctionInfo{50001, nullptr, "OverrideDefaultTargetForDebug", MakeVersionGate({19,0,0}, {19,0,1})}, - FunctionInfo{50003, nullptr, "SetForceOverrideExternalDeviceNameForDebug", MakeVersionGate({19,0,0})}, - FunctionInfo{50004, nullptr, "ClearForceOverrideExternalDeviceNameForDebug", MakeVersionGate({19,0,0})} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IAudioController::IAudioController(Core::System& system_) : ServiceFramework{system_, "audctl"}, service_context{system, "audctl"} { - m_set_sys = system.ServiceManager().GetService("set:sys", true); + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IAudioController::GetTargetVolume>, "GetTargetVolume"}, + {1, D<&IAudioController::SetTargetVolume>, "SetTargetVolume"}, + {2, D<&IAudioController::GetTargetVolumeMin>, "GetTargetVolumeMin"}, + {3, D<&IAudioController::GetTargetVolumeMax>, "GetTargetVolumeMax"}, + {4, D<&IAudioController::IsTargetMute>, "IsTargetMute"}, + {5, D<&IAudioController::SetTargetMute>, "SetTargetMute"}, + {6, nullptr, "IsTargetConnected"}, //20.0.0+ + {7, nullptr, "SetDefaultTarget"}, + {8, nullptr, "GetDefaultTarget"}, + {9, D<&IAudioController::GetAudioOutputMode>, "GetAudioOutputMode"}, + {10, D<&IAudioController::SetAudioOutputMode>, "SetAudioOutputMode"}, + {11, nullptr, "SetForceMutePolicy"}, + {12, D<&IAudioController::GetForceMutePolicy>, "GetForceMutePolicy"}, + {13, D<&IAudioController::GetOutputModeSetting>, "GetOutputModeSetting"}, + {14, D<&IAudioController::SetOutputModeSetting>, "SetOutputModeSetting"}, + {15, nullptr, "SetOutputTarget"}, + {16, nullptr, "SetInputTargetForceEnabled"}, + {17, D<&IAudioController::SetHeadphoneOutputLevelMode>, "SetHeadphoneOutputLevelMode"}, + {18, D<&IAudioController::GetHeadphoneOutputLevelMode>, "GetHeadphoneOutputLevelMode"}, + {19, nullptr, "AcquireAudioVolumeUpdateEventForPlayReport"}, + {20, nullptr, "AcquireAudioOutputDeviceUpdateEventForPlayReport"}, + {21, nullptr, "GetAudioOutputTargetForPlayReport"}, + {22, D<&IAudioController::NotifyHeadphoneVolumeWarningDisplayedEvent>, "NotifyHeadphoneVolumeWarningDisplayedEvent"}, + {23, nullptr, "SetSystemOutputMasterVolume"}, + {24, nullptr, "GetSystemOutputMasterVolume"}, + {25, nullptr, "GetAudioVolumeDataForPlayReport"}, + {26, nullptr, "UpdateHeadphoneSettings"}, + {27, nullptr, "SetVolumeMappingTableForDev"}, + {28, nullptr, "GetAudioOutputChannelCountForPlayReport"}, + {29, nullptr, "BindAudioOutputChannelCountUpdateEventForPlayReport"}, + {30, D<&IAudioController::SetSpeakerAutoMuteEnabled>, "SetSpeakerAutoMuteEnabled"}, + {31, D<&IAudioController::IsSpeakerAutoMuteEnabled>, "IsSpeakerAutoMuteEnabled"}, + {32, D<&IAudioController::GetActiveOutputTarget>, "GetActiveOutputTarget"}, + {33, nullptr, "GetTargetDeviceInfo"}, + {34, D<&IAudioController::AcquireTargetNotification>, "AcquireTargetNotification"}, + {35, nullptr, "SetHearingProtectionSafeguardTimerRemainingTimeForDebug"}, + {36, nullptr, "GetHearingProtectionSafeguardTimerRemainingTimeForDebug"}, + {37, nullptr, "SetHearingProtectionSafeguardEnabled"}, + {38, nullptr, "IsHearingProtectionSafeguardEnabled"}, + {39, nullptr, "IsHearingProtectionSafeguardMonitoringOutputForDebug"}, + {40, nullptr, "GetSystemInformationForDebug"}, + {41, nullptr, "SetVolumeButtonLongPressTime"}, + {42, nullptr, "SetNativeVolumeForDebug"}, + {43, nullptr, "Unknown43"}, //21.0.0+ + {5000, D<&IAudioController::Unknown5000>, "Unknown5000"}, //19.0.0+ + {10000, nullptr, "NotifyAudioOutputTargetForPlayReport"}, + {10001, nullptr, "NotifyAudioOutputChannelCountForPlayReport"}, + {10002, nullptr, "NotifyUnsupportedUsbOutputDeviceAttachedForPlayReport"}, + {10100, nullptr, "GetAudioVolumeDataForPlayReport"}, + {10101, nullptr, "BindAudioVolumeUpdateEventForPlayReport"}, + {10102, nullptr, "BindAudioOutputTargetUpdateEventForPlayReport"}, + {10103, nullptr, "GetAudioOutputTargetForPlayReport"}, + {10104, nullptr, "GetAudioOutputChannelCountForPlayReport"}, + {10105, nullptr, "BindAudioOutputChannelCountUpdateEventForPlayReport"}, //14.0.0-19.0.1 + {10106, nullptr, "GetDefaultAudioOutputTargetForPlayReport"}, //14.0.0-19.0.1 + {10200, nullptr, "Unknown10200"}, //20.0.0+ + {50000, nullptr, "SetAnalogInputBoostGainForPrototyping"}, //15.0.0-18.1.0 + {50001, nullptr, "OverrideDefaultTargetForDebug"}, //19.0.0-19.0.1 + {50003, nullptr, "SetForceOverrideExternalDeviceNameForDebug"}, //19.0.0+ + {50004, nullptr, "ClearForceOverrideExternalDeviceNameForDebug"} //19.0.0+ + }; + // clang-format on + + RegisterHandlers(functions); + + m_set_sys = + system.ServiceManager().GetService("set:sys", true); notification_event = service_context.CreateEvent("IAudioController:NotificationEvent"); // Probably shouldn't do this in constructor? diff --git a/src/core/hle/service/audio/audio_controller.h b/src/core/hle/service/audio/audio_controller.h index e5c615fa21..a30b572ac7 100644 --- a/src/core/hle/service/audio/audio_controller.h +++ b/src/core/hle/service/audio/audio_controller.h @@ -59,8 +59,8 @@ private: Result AcquireTargetNotification(OutCopyHandle out_notification_event); Result Unknown5000(Out> out_audio_controller); - std::optional FindRequest(u32 key) override; KernelHelpers::ServiceContext service_context; + Kernel::KEvent* notification_event; std::shared_ptr m_set_sys; std::array m_target_volumes{{15, 15, 15, 15, 15, 15}}; diff --git a/src/core/hle/service/audio/audio_device.cpp b/src/core/hle/service/audio/audio_device.cpp index fc24bf3ccd..e9f7e074a1 100644 --- a/src/core/hle/service/audio/audio_device.cpp +++ b/src/core/hle/service/audio/audio_device.cpp @@ -12,38 +12,36 @@ namespace Service::Audio { using namespace AudioCore::Renderer; -std::optional IAudioDevice::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IAudioDevice::ListAudioDeviceName>, "ListAudioDeviceName"}, - FunctionInfo{1, D<&IAudioDevice::SetAudioDeviceOutputVolume>, "SetAudioDeviceOutputVolume"}, - FunctionInfo{2, D<&IAudioDevice::GetAudioDeviceOutputVolume>, "GetAudioDeviceOutputVolume"}, - FunctionInfo{3, D<&IAudioDevice::GetActiveAudioDeviceName>, "GetActiveAudioDeviceName"}, - FunctionInfo{4, D<&IAudioDevice::QueryAudioDeviceSystemEvent>, "QueryAudioDeviceSystemEvent"}, - FunctionInfo{5, D<&IAudioDevice::GetActiveChannelCount>, "GetActiveChannelCount"}, - FunctionInfo{6, D<&IAudioDevice::ListAudioDeviceNameAuto>, "ListAudioDeviceNameAuto"}, - FunctionInfo{7, D<&IAudioDevice::SetAudioDeviceOutputVolumeAuto>, "SetAudioDeviceOutputVolumeAuto"}, - FunctionInfo{8, D<&IAudioDevice::GetAudioDeviceOutputVolumeAuto>, "GetAudioDeviceOutputVolumeAuto"}, - FunctionInfo{10, D<&IAudioDevice::GetActiveAudioDeviceNameAuto>, "GetActiveAudioDeviceNameAuto"}, - FunctionInfo{11, D<&IAudioDevice::QueryAudioDeviceInputEvent>, "QueryAudioDeviceInputEvent"}, - FunctionInfo{12, D<&IAudioDevice::QueryAudioDeviceOutputEvent>, "QueryAudioDeviceOutputEvent"}, - FunctionInfo{13, D<&IAudioDevice::GetActiveAudioDeviceName>, "GetActiveAudioOutputDeviceName"}, - FunctionInfo{14, D<&IAudioDevice::ListAudioOutputDeviceName>, "ListAudioOutputDeviceName"}, - FunctionInfo{15, nullptr, "AcquireAudioInputDeviceNotification", MakeVersionGate({17,0,0})}, - FunctionInfo{16, nullptr, "ReleaseAudioInputDeviceNotification", MakeVersionGate({17,0,0})}, - FunctionInfo{17, nullptr, "AcquireAudioOutputDeviceNotification", MakeVersionGate({17,0,0})}, - FunctionInfo{18, nullptr, "ReleaseAudioOutputDeviceNotification", MakeVersionGate({17,0,0})}, - FunctionInfo{19, D<&IAudioDevice::SetAudioDeviceOutputVolumeAutoTuneEnabled>, "SetAudioDeviceOutputVolumeAutoTuneEnabled", MakeVersionGate({18,0,0})}, - FunctionInfo{20, D<&IAudioDevice::IsAudioDeviceOutputVolumeAutoTuneEnabled>, "IsAudioDeviceOutputVolumeAutoTuneEnabled", MakeVersionGate({18,0,0})}, - FunctionInfo{21, nullptr, "IsActiveOutputDeviceEstimatedLowLatency", MakeVersionGate({21,0,0})} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IAudioDevice::IAudioDevice(Core::System& system_, u64 applet_resource_user_id, u32 revision, u32 device_num) : ServiceFramework{system_, "IAudioDevice"}, service_context{system_, "IAudioDevice"}, impl{std::make_unique(system_, applet_resource_user_id, revision)}, event{service_context.CreateEvent(fmt::format("IAudioDeviceEvent-{}", device_num))} { + static const FunctionInfo functions[] = { + {0, D<&IAudioDevice::ListAudioDeviceName>, "ListAudioDeviceName"}, + {1, D<&IAudioDevice::SetAudioDeviceOutputVolume>, "SetAudioDeviceOutputVolume"}, + {2, D<&IAudioDevice::GetAudioDeviceOutputVolume>, "GetAudioDeviceOutputVolume"}, + {3, D<&IAudioDevice::GetActiveAudioDeviceName>, "GetActiveAudioDeviceName"}, + {4, D<&IAudioDevice::QueryAudioDeviceSystemEvent>, "QueryAudioDeviceSystemEvent"}, + {5, D<&IAudioDevice::GetActiveChannelCount>, "GetActiveChannelCount"}, + {6, D<&IAudioDevice::ListAudioDeviceNameAuto>, "ListAudioDeviceNameAuto"}, + {7, D<&IAudioDevice::SetAudioDeviceOutputVolumeAuto>, "SetAudioDeviceOutputVolumeAuto"}, + {8, D<&IAudioDevice::GetAudioDeviceOutputVolumeAuto>, "GetAudioDeviceOutputVolumeAuto"}, + {10, D<&IAudioDevice::GetActiveAudioDeviceNameAuto>, "GetActiveAudioDeviceNameAuto"}, + {11, D<&IAudioDevice::QueryAudioDeviceInputEvent>, "QueryAudioDeviceInputEvent"}, + {12, D<&IAudioDevice::QueryAudioDeviceOutputEvent>, "QueryAudioDeviceOutputEvent"}, + {13, D<&IAudioDevice::GetActiveAudioDeviceName>, "GetActiveAudioOutputDeviceName"}, + {14, D<&IAudioDevice::ListAudioOutputDeviceName>, "ListAudioOutputDeviceName"}, + {15, nullptr, "AcquireAudioInputDeviceNotification"}, //17.0.0+ + {16, nullptr, "ReleaseAudioInputDeviceNotification"}, //17.0.0+ + {17, nullptr, "AcquireAudioOutputDeviceNotification"}, //17.0.0+ + {18, nullptr, "ReleaseAudioOutputDeviceNotification"}, //17.0.0+ + {19, D<&IAudioDevice::SetAudioDeviceOutputVolumeAutoTuneEnabled>, "SetAudioDeviceOutputVolumeAutoTuneEnabled"}, //18.0.0+ + {20, D<&IAudioDevice::IsAudioDeviceOutputVolumeAutoTuneEnabled>, "IsAudioDeviceOutputVolumeAutoTuneEnabled"}, //18.0.0+ + {21, nullptr, "IsActiveOutputDeviceEstimatedLowLatency"} //21.0.0+ + }; + RegisterHandlers(functions); + event->Signal(system.Kernel()); } diff --git a/src/core/hle/service/audio/audio_device.h b/src/core/hle/service/audio/audio_device.h index bd0aaa5f7c..f6c12fbfeb 100644 --- a/src/core/hle/service/audio/audio_device.h +++ b/src/core/hle/service/audio/audio_device.h @@ -55,7 +55,6 @@ private: Result SetAudioDeviceOutputVolumeAutoTuneEnabled(bool enabled); Result IsAudioDeviceOutputVolumeAutoTuneEnabled(Out out_enabled); - std::optional FindRequest(u32 key) override; KernelHelpers::ServiceContext service_context; std::unique_ptr impl; Kernel::KEvent* event; diff --git a/src/core/hle/service/audio/audio_in.cpp b/src/core/hle/service/audio/audio_in.cpp index 068574dbd2..6208c2d104 100644 --- a/src/core/hle/service/audio/audio_in.cpp +++ b/src/core/hle/service/audio/audio_in.cpp @@ -11,33 +11,35 @@ namespace Service::Audio { using namespace AudioCore::AudioIn; -std::optional IAudioIn::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IAudioIn::GetAudioInState>, "GetAudioInState"}, - FunctionInfo{1, D<&IAudioIn::Start>, "Start"}, - FunctionInfo{2, D<&IAudioIn::Stop>, "Stop"}, - FunctionInfo{3, D<&IAudioIn::AppendAudioInBuffer>, "AppendAudioInBuffer"}, - FunctionInfo{4, D<&IAudioIn::RegisterBufferEvent>, "RegisterBufferEvent"}, - FunctionInfo{5, D<&IAudioIn::GetReleasedAudioInBuffers>, "GetReleasedAudioInBuffers"}, - FunctionInfo{6, D<&IAudioIn::ContainsAudioInBuffer>, "ContainsAudioInBuffer"}, - FunctionInfo{7, D<&IAudioIn::AppendAudioInBuffer>, "AppendUacInBuffer"}, - FunctionInfo{8, D<&IAudioIn::AppendAudioInBufferAuto>, "AppendAudioInBufferAuto"}, - FunctionInfo{9, D<&IAudioIn::GetReleasedAudioInBuffersAuto>, "GetReleasedAudioInBuffersAuto"}, - FunctionInfo{10, D<&IAudioIn::AppendAudioInBufferAuto>, "AppendUacInBufferAuto"}, - FunctionInfo{11, D<&IAudioIn::GetAudioInBufferCount>, "GetAudioInBufferCount"}, - FunctionInfo{12, D<&IAudioIn::SetDeviceGain>, "SetDeviceGain"}, - FunctionInfo{13, D<&IAudioIn::GetDeviceGain>, "GetDeviceGain"}, - FunctionInfo{14, D<&IAudioIn::FlushAudioInBuffers>, "FlushAudioInBuffers"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IAudioIn::IAudioIn(Core::System& system_, Manager& manager, size_t session_id, const std::string& device_name, const AudioInParameter& in_params, Kernel::KProcess* handle, u64 applet_resource_user_id) - : ServiceFramework{system_, "IAudioIn"}, process{handle}, service_context{system_, "IAudioIn"} - , event{service_context.CreateEvent("AudioInEvent")}, impl{std::make_shared(system_, manager, event, session_id)} -{ + : ServiceFramework{system_, "IAudioIn"}, process{handle}, service_context{system_, "IAudioIn"}, + event{service_context.CreateEvent("AudioInEvent")}, impl{std::make_shared(system_, + manager, event, + session_id)} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IAudioIn::GetAudioInState>, "GetAudioInState"}, + {1, D<&IAudioIn::Start>, "Start"}, + {2, D<&IAudioIn::Stop>, "Stop"}, + {3, D<&IAudioIn::AppendAudioInBuffer>, "AppendAudioInBuffer"}, + {4, D<&IAudioIn::RegisterBufferEvent>, "RegisterBufferEvent"}, + {5, D<&IAudioIn::GetReleasedAudioInBuffers>, "GetReleasedAudioInBuffers"}, + {6, D<&IAudioIn::ContainsAudioInBuffer>, "ContainsAudioInBuffer"}, + {7, D<&IAudioIn::AppendAudioInBuffer>, "AppendUacInBuffer"}, + {8, D<&IAudioIn::AppendAudioInBufferAuto>, "AppendAudioInBufferAuto"}, + {9, D<&IAudioIn::GetReleasedAudioInBuffersAuto>, "GetReleasedAudioInBuffersAuto"}, + {10, D<&IAudioIn::AppendAudioInBufferAuto>, "AppendUacInBufferAuto"}, + {11, D<&IAudioIn::GetAudioInBufferCount>, "GetAudioInBufferCount"}, + {12, D<&IAudioIn::SetDeviceGain>, "SetDeviceGain"}, + {13, D<&IAudioIn::GetDeviceGain>, "GetDeviceGain"}, + {14, D<&IAudioIn::FlushAudioInBuffers>, "FlushAudioInBuffers"}, + }; + // clang-format on + + RegisterHandlers(functions); + process->Open(system.Kernel()); if (impl->GetSystem() diff --git a/src/core/hle/service/audio/audio_in.h b/src/core/hle/service/audio/audio_in.h index dd7a41f300..793d2b3ad4 100644 --- a/src/core/hle/service/audio/audio_in.h +++ b/src/core/hle/service/audio/audio_in.h @@ -46,7 +46,6 @@ public: Result FlushAudioInBuffers(Out out_flushed); private: - std::optional FindRequest(u32 key) override; Kernel::KProcess* process; KernelHelpers::ServiceContext service_context; Kernel::KEvent* event; diff --git a/src/core/hle/service/audio/audio_in_manager.cpp b/src/core/hle/service/audio/audio_in_manager.cpp index 422e72148b..fccfe38b3b 100644 --- a/src/core/hle/service/audio/audio_in_manager.cpp +++ b/src/core/hle/service/audio/audio_in_manager.cpp @@ -12,22 +12,22 @@ namespace Service::Audio { using namespace AudioCore::AudioIn; -std::optional IAudioInManager::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IAudioInManager::ListAudioIns>, "ListAudioIns"}, - FunctionInfo{1, D<&IAudioInManager::OpenAudioIn>, "OpenAudioIn"}, - FunctionInfo{2, D<&IAudioInManager::ListAudioIns>, "ListAudioInsAuto"}, - FunctionInfo{3, D<&IAudioInManager::OpenAudioIn>, "OpenAudioInAuto"}, - FunctionInfo{4, D<&IAudioInManager::ListAudioInsAutoFiltered>, "ListAudioInsAutoFiltered"}, - FunctionInfo{5, D<&IAudioInManager::OpenAudioInProtocolSpecified>, "OpenAudioInProtocolSpecified"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IAudioInManager::IAudioInManager(Core::System& system_) - : ServiceFramework{system_, "audin:u"} - , impl{std::make_unique(system_)} -{} + : ServiceFramework{system_, "audin:u"}, impl{std::make_unique( + system_)} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IAudioInManager::ListAudioIns>, "ListAudioIns"}, + {1, D<&IAudioInManager::OpenAudioIn>, "OpenAudioIn"}, + {2, D<&IAudioInManager::ListAudioIns>, "ListAudioInsAuto"}, + {3, D<&IAudioInManager::OpenAudioIn>, "OpenAudioInAuto"}, + {4, D<&IAudioInManager::ListAudioInsAutoFiltered>, "ListAudioInsAutoFiltered"}, + {5, D<&IAudioInManager::OpenAudioInProtocolSpecified>, "OpenAudioInProtocolSpecified"}, + }; + // clang-format on + + RegisterHandlers(functions); +} IAudioInManager::~IAudioInManager() = default; diff --git a/src/core/hle/service/audio/audio_in_manager.h b/src/core/hle/service/audio/audio_in_manager.h index 0ee0badba7..d8f63972c3 100644 --- a/src/core/hle/service/audio/audio_in_manager.h +++ b/src/core/hle/service/audio/audio_in_manager.h @@ -54,7 +54,6 @@ private: AudioCore::AudioIn::AudioInParameter parameter, InCopyHandle process_handle, ClientAppletResourceUserId aruid); - std::optional FindRequest(u32 key) override; std::unique_ptr impl; }; diff --git a/src/core/hle/service/audio/audio_out.cpp b/src/core/hle/service/audio/audio_out.cpp index a5f06faab8..996eeede58 100644 --- a/src/core/hle/service/audio/audio_out.cpp +++ b/src/core/hle/service/audio/audio_out.cpp @@ -15,26 +15,6 @@ namespace Service::Audio { using namespace AudioCore::AudioOut; -std::optional IAudioOut::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IAudioOut::GetAudioOutState>, "GetAudioOutState"}, - FunctionInfo{1, D<&IAudioOut::Start>, "Start"}, - FunctionInfo{2, D<&IAudioOut::Stop>, "Stop"}, - FunctionInfo{3, D<&IAudioOut::AppendAudioOutBuffer>, "AppendAudioOutBuffer"}, - FunctionInfo{4, D<&IAudioOut::RegisterBufferEvent>, "RegisterBufferEvent"}, - FunctionInfo{5, D<&IAudioOut::GetReleasedAudioOutBuffers>, "GetReleasedAudioOutBuffers"}, - FunctionInfo{6, D<&IAudioOut::ContainsAudioOutBuffer>, "ContainsAudioOutBuffer"}, - FunctionInfo{7, D<&IAudioOut::AppendAudioOutBufferAuto>, "AppendAudioOutBufferAuto"}, - FunctionInfo{8, D<&IAudioOut::GetReleasedAudioOutBuffersAuto>, "GetReleasedAudioOutBuffersAuto"}, - FunctionInfo{9, D<&IAudioOut::GetAudioOutBufferCount>, "GetAudioOutBufferCount"}, - FunctionInfo{10, D<&IAudioOut::GetAudioOutPlayedSampleCount>, "GetAudioOutPlayedSampleCount"}, - FunctionInfo{11, D<&IAudioOut::FlushAudioOutBuffers>, "FlushAudioOutBuffers"}, - FunctionInfo{12, D<&IAudioOut::SetAudioOutVolume>, "SetAudioOutVolume"}, - FunctionInfo{13, D<&IAudioOut::GetAudioOutVolume>, "GetAudioOutVolume"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IAudioOut::IAudioOut(Core::System& system_, Manager& manager, size_t session_id, const std::string& device_name, const AudioOutParameter& in_params, Kernel::KProcess* handle, u64 applet_resource_user_id) @@ -42,6 +22,26 @@ IAudioOut::IAudioOut(Core::System& system_, Manager& manager, size_t session_id, event{service_context.CreateEvent("AudioOutEvent")}, process{handle}, impl{std::make_shared(system_, manager, event, session_id)} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IAudioOut::GetAudioOutState>, "GetAudioOutState"}, + {1, D<&IAudioOut::Start>, "Start"}, + {2, D<&IAudioOut::Stop>, "Stop"}, + {3, D<&IAudioOut::AppendAudioOutBuffer>, "AppendAudioOutBuffer"}, + {4, D<&IAudioOut::RegisterBufferEvent>, "RegisterBufferEvent"}, + {5, D<&IAudioOut::GetReleasedAudioOutBuffers>, "GetReleasedAudioOutBuffers"}, + {6, D<&IAudioOut::ContainsAudioOutBuffer>, "ContainsAudioOutBuffer"}, + {7, D<&IAudioOut::AppendAudioOutBufferAuto>, "AppendAudioOutBufferAuto"}, + {8, D<&IAudioOut::GetReleasedAudioOutBuffersAuto>, "GetReleasedAudioOutBuffersAuto"}, + {9, D<&IAudioOut::GetAudioOutBufferCount>, "GetAudioOutBufferCount"}, + {10, D<&IAudioOut::GetAudioOutPlayedSampleCount>, "GetAudioOutPlayedSampleCount"}, + {11, D<&IAudioOut::FlushAudioOutBuffers>, "FlushAudioOutBuffers"}, + {12, D<&IAudioOut::SetAudioOutVolume>, "SetAudioOutVolume"}, + {13, D<&IAudioOut::GetAudioOutVolume>, "GetAudioOutVolume"}, + }; + // clang-format on + RegisterHandlers(functions); + process->Open(system.Kernel()); } diff --git a/src/core/hle/service/audio/audio_out.h b/src/core/hle/service/audio/audio_out.h index 311eb84afe..178ee57df6 100644 --- a/src/core/hle/service/audio/audio_out.h +++ b/src/core/hle/service/audio/audio_out.h @@ -52,8 +52,6 @@ public: Result GetAudioOutVolume(Out out_volume); private: - std::optional FindRequest(u32 key) override; - KernelHelpers::ServiceContext service_context; Kernel::KEvent* event; Kernel::KProcess* process; diff --git a/src/core/hle/service/audio/audio_out_manager.cpp b/src/core/hle/service/audio/audio_out_manager.cpp index 9f24bc3513..3b2087932c 100644 --- a/src/core/hle/service/audio/audio_out_manager.cpp +++ b/src/core/hle/service/audio/audio_out_manager.cpp @@ -13,20 +13,20 @@ namespace Service::Audio { using namespace AudioCore::AudioOut; -std::optional IAudioOutManager::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IAudioOutManager::ListAudioOuts>, "ListAudioOuts"}, - FunctionInfo{1, D<&IAudioOutManager::OpenAudioOut>, "OpenAudioOut"}, - FunctionInfo{2, D<&IAudioOutManager::ListAudioOutsAuto>, "ListAudioOutsAuto"}, - FunctionInfo{3, D<&IAudioOutManager::OpenAudioOutAuto>, "OpenAudioOutAuto"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IAudioOutManager::IAudioOutManager(Core::System& system_) : ServiceFramework{system_, "audout:u"} , impl(system_) { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IAudioOutManager::ListAudioOuts>, "ListAudioOuts"}, + {1, D<&IAudioOutManager::OpenAudioOut>, "OpenAudioOut"}, + {2, D<&IAudioOutManager::ListAudioOutsAuto>, "ListAudioOutsAuto"}, + {3, D<&IAudioOutManager::OpenAudioOutAuto>, "OpenAudioOutAuto"}, + }; + // clang-format on + + RegisterHandlers(functions); } IAudioOutManager::~IAudioOutManager() = default; diff --git a/src/core/hle/service/audio/audio_out_manager.h b/src/core/hle/service/audio/audio_out_manager.h index 4c71c12cdf..ec974aaba4 100644 --- a/src/core/hle/service/audio/audio_out_manager.h +++ b/src/core/hle/service/audio/audio_out_manager.h @@ -43,7 +43,6 @@ private: AudioCore::AudioOut::AudioOutParameter parameter, InCopyHandle process_handle, ClientAppletResourceUserId aruid); - std::optional FindRequest(u32 key) override; std::optional impl; }; diff --git a/src/core/hle/service/audio/audio_renderer.cpp b/src/core/hle/service/audio/audio_renderer.cpp index bcb2adaf61..dd76544094 100644 --- a/src/core/hle/service/audio/audio_renderer.cpp +++ b/src/core/hle/service/audio/audio_renderer.cpp @@ -10,37 +10,38 @@ namespace Service::Audio { using namespace AudioCore::Renderer; -std::optional IAudioRenderer::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IAudioRenderer::GetSampleRate>, "GetSampleRate"}, - FunctionInfo{1, D<&IAudioRenderer::GetSampleCount>, "GetSampleCount"}, - FunctionInfo{2, D<&IAudioRenderer::GetMixBufferCount>, "GetMixBufferCount"}, - FunctionInfo{3, D<&IAudioRenderer::GetState>, "GetState"}, - FunctionInfo{4, D<&IAudioRenderer::RequestUpdate>, "RequestUpdate"}, - FunctionInfo{5, D<&IAudioRenderer::Start>, "Start"}, - FunctionInfo{6, D<&IAudioRenderer::Stop>, "Stop"}, - FunctionInfo{7, D<&IAudioRenderer::QuerySystemEvent>, "QuerySystemEvent"}, - FunctionInfo{8, D<&IAudioRenderer::SetRenderingTimeLimit>, "SetRenderingTimeLimit"}, - FunctionInfo{9, D<&IAudioRenderer::GetRenderingTimeLimit>, "GetRenderingTimeLimit"}, - FunctionInfo{10, D<&IAudioRenderer::RequestUpdateAuto>, "RequestUpdateAuto", MakeVersionGate({3,0,0})}, - FunctionInfo{11, nullptr, "ExecuteAudioRendererRendering", MakeVersionGate({3,0,0})}, - FunctionInfo{12, D<&IAudioRenderer::SetVoiceDropParameter>, "SetVoiceDropParameter", MakeVersionGate({15,0,0})}, - FunctionInfo{13, D<&IAudioRenderer::GetVoiceDropParameter>, "GetVoiceDropParameter", MakeVersionGate({15,0,0})} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IAudioRenderer::IAudioRenderer(Core::System& system_, Manager& manager_, AudioCore::AudioRendererParameterInternal& params, Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size, Kernel::KProcess* process_handle_, u64 applet_resource_user_id, s32 session_id) - : ServiceFramework{system_, "IAudioRenderer"}, service_context{system_, "IAudioRenderer"} - , rendered_event{service_context.CreateEvent("IAudioRendererEvent")}, manager{manager_} - , impl{std::make_unique(system_, manager, rendered_event)} - , process_handle{process_handle_} { + : ServiceFramework{system_, "IAudioRenderer"}, service_context{system_, "IAudioRenderer"}, + rendered_event{service_context.CreateEvent("IAudioRendererEvent")}, manager{manager_}, + impl{std::make_unique(system_, manager, rendered_event)}, process_handle{ + process_handle_} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IAudioRenderer::GetSampleRate>, "GetSampleRate"}, + {1, D<&IAudioRenderer::GetSampleCount>, "GetSampleCount"}, + {2, D<&IAudioRenderer::GetMixBufferCount>, "GetMixBufferCount"}, + {3, D<&IAudioRenderer::GetState>, "GetState"}, + {4, D<&IAudioRenderer::RequestUpdate>, "RequestUpdate"}, + {5, D<&IAudioRenderer::Start>, "Start"}, + {6, D<&IAudioRenderer::Stop>, "Stop"}, + {7, D<&IAudioRenderer::QuerySystemEvent>, "QuerySystemEvent"}, + {8, D<&IAudioRenderer::SetRenderingTimeLimit>, "SetRenderingTimeLimit"}, + {9, D<&IAudioRenderer::GetRenderingTimeLimit>, "GetRenderingTimeLimit"}, + {10, D<&IAudioRenderer::RequestUpdateAuto>, "RequestUpdateAuto"}, //3.0.0+ + {11, nullptr, "ExecuteAudioRendererRendering"}, //3.0.0+ + {12, D<&IAudioRenderer::SetVoiceDropParameter>, "SetVoiceDropParameter"}, //15.0.0+ + {13, D<&IAudioRenderer::GetVoiceDropParameter>, "GetVoiceDropParameter"}, //15.0.0+ + }; + // clang-format on + RegisterHandlers(functions); + process_handle->Open(system_.Kernel()); - impl->Initialize(params, transfer_memory, transfer_memory_size, process_handle, applet_resource_user_id, session_id); + impl->Initialize(params, transfer_memory, transfer_memory_size, process_handle, + applet_resource_user_id, session_id); } IAudioRenderer::~IAudioRenderer() { diff --git a/src/core/hle/service/audio/audio_renderer.h b/src/core/hle/service/audio/audio_renderer.h index e03fc6551d..7f4ea9a662 100644 --- a/src/core/hle/service/audio/audio_renderer.h +++ b/src/core/hle/service/audio/audio_renderer.h @@ -45,7 +45,6 @@ private: Result SetVoiceDropParameter(f32 voice_drop_parameter); Result GetVoiceDropParameter(Out out_voice_drop_parameter); - std::optional FindRequest(u32 key) override; KernelHelpers::ServiceContext service_context; Kernel::KEvent* rendered_event; AudioCore::Renderer::Manager& manager; diff --git a/src/core/hle/service/audio/audio_renderer_manager.cpp b/src/core/hle/service/audio/audio_renderer_manager.cpp index 98701c79c1..4756802eeb 100644 --- a/src/core/hle/service/audio/audio_renderer_manager.cpp +++ b/src/core/hle/service/audio/audio_renderer_manager.cpp @@ -18,21 +18,21 @@ namespace Service::Audio { using namespace AudioCore::Renderer; -std::optional IAudioRendererManager::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IAudioRendererManager::OpenAudioRenderer>, "OpenAudioRenderer"}, - FunctionInfo{1, D<&IAudioRendererManager::GetWorkBufferSize>, "GetWorkBufferSize"}, - FunctionInfo{2, D<&IAudioRendererManager::GetAudioDeviceService>, "GetAudioDeviceService"}, - FunctionInfo{3, nullptr, "OpenAudioRendererForManualExecution"}, - FunctionInfo{4, D<&IAudioRendererManager::GetAudioDeviceServiceWithRevisionInfo>, "GetAudioDeviceServiceWithRevisionInfo"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IAudioRendererManager::IAudioRendererManager(Core::System& system_) : ServiceFramework{system_, "audren:u"} , impl(system_) { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IAudioRendererManager::OpenAudioRenderer>, "OpenAudioRenderer"}, + {1, D<&IAudioRendererManager::GetWorkBufferSize>, "GetWorkBufferSize"}, + {2, D<&IAudioRendererManager::GetAudioDeviceService>, "GetAudioDeviceService"}, + {3, nullptr, "OpenAudioRendererForManualExecution"}, + {4, D<&IAudioRendererManager::GetAudioDeviceServiceWithRevisionInfo>, "GetAudioDeviceServiceWithRevisionInfo"}, + }; + // clang-format on + + RegisterHandlers(functions); } IAudioRendererManager::~IAudioRendererManager() = default; diff --git a/src/core/hle/service/audio/audio_renderer_manager.h b/src/core/hle/service/audio/audio_renderer_manager.h index bd3ea06326..fdce8b6ffa 100644 --- a/src/core/hle/service/audio/audio_renderer_manager.h +++ b/src/core/hle/service/audio/audio_renderer_manager.h @@ -33,7 +33,6 @@ private: Result GetAudioDeviceServiceWithRevisionInfo(Out> out_audio_device, u32 revision, ClientAppletResourceUserId aruid); - std::optional FindRequest(u32 key) override; std::optional impl; u32 num_audio_devices{0}; }; diff --git a/src/core/hle/service/audio/final_output_recorder_manager.cpp b/src/core/hle/service/audio/final_output_recorder_manager.cpp index 9c51613de6..2bc9d29e3e 100644 --- a/src/core/hle/service/audio/final_output_recorder_manager.cpp +++ b/src/core/hle/service/audio/final_output_recorder_manager.cpp @@ -11,29 +11,34 @@ namespace Service::Audio { class IFinalOutputRecorder final : public ServiceFramework { public: explicit IFinalOutputRecorder(Core::System& system_) - : ServiceFramework{system_, "IFinalOutputRecorder"} {} + : ServiceFramework{system_, "IFinalOutputRecorder"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetFinalOutputRecorderState"}, + {1, nullptr, "Start"}, + {2, nullptr, "Stop"}, + {3, nullptr, "AppendFinalOutputRecorderBuffer"}, + {4, nullptr, "RegisterBufferEvent"}, + {5, nullptr, "GetReleasedFinalOutputRecorderBuffers"}, + {6, nullptr, "ContainsFinalOutputRecorderBuffer"}, + {7, nullptr, "GetFinalOutputRecorderBufferEndTime"}, + {8, nullptr, "AppendFinalOutputRecorderBufferAuto"}, + {9, nullptr, "GetReleasedFinalOutputRecorderBufferAuto"}, + {10, nullptr, "FlushFinalOutputRecorderBuffers"}, + {11, nullptr, "AttachWorkBuffer"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetFinalOutputRecorderState"}, - FunctionInfo{1, nullptr, "Start"}, - FunctionInfo{2, nullptr, "Stop"}, - FunctionInfo{3, nullptr, "AppendFinalOutputRecorderBuffer"}, - FunctionInfo{4, nullptr, "RegisterBufferEvent"}, - FunctionInfo{5, nullptr, "GetReleasedFinalOutputRecorderBuffers"}, - FunctionInfo{6, nullptr, "ContainsFinalOutputRecorderBuffer"}, - FunctionInfo{7, nullptr, "GetFinalOutputRecorderBufferEndTime"}, - FunctionInfo{8, nullptr, "AppendFinalOutputRecorderBufferAuto"}, - FunctionInfo{9, nullptr, "GetReleasedFinalOutputRecorderBufferAuto"}, - FunctionInfo{10, nullptr, "FlushFinalOutputRecorderBuffers"}, - FunctionInfo{11, nullptr, "AttachWorkBuffer"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; IFinalOutputRecorderManager::IFinalOutputRecorderManager(Core::System& system_) : ServiceFramework{system_, "audrec:u"} { + static const FunctionInfo functions[] = { + {0, nullptr, "OpenFinalOutputRecorder"}, + }; + RegisterHandlers(functions); } IFinalOutputRecorderManager::~IFinalOutputRecorderManager() = default; diff --git a/src/core/hle/service/audio/final_output_recorder_manager.h b/src/core/hle/service/audio/final_output_recorder_manager.h index ee392b2ada..833c621be7 100644 --- a/src/core/hle/service/audio/final_output_recorder_manager.h +++ b/src/core/hle/service/audio/final_output_recorder_manager.h @@ -18,13 +18,6 @@ class IFinalOutputRecorderManager final : public ServiceFramework FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "OpenFinalOutputRecorder"} - ); }; } // namespace Service::Audio diff --git a/src/core/hle/service/audio/final_output_recorder_manager_for_applet.cpp b/src/core/hle/service/audio/final_output_recorder_manager_for_applet.cpp index 42c08d90ec..dc2ea63aa0 100644 --- a/src/core/hle/service/audio/final_output_recorder_manager_for_applet.cpp +++ b/src/core/hle/service/audio/final_output_recorder_manager_for_applet.cpp @@ -10,6 +10,14 @@ namespace Service::Audio { IFinalOutputRecorderManagerForApplet::IFinalOutputRecorderManagerForApplet(Core::System& system_) : ServiceFramework{system_, "audrec:a"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "RequestSuspend"}, + {1, nullptr, "RequestResume"}, + }; + // clang-format on + + RegisterHandlers(functions); } IFinalOutputRecorderManagerForApplet::~IFinalOutputRecorderManagerForApplet() = default; diff --git a/src/core/hle/service/audio/final_output_recorder_manager_for_applet.h b/src/core/hle/service/audio/final_output_recorder_manager_for_applet.h index 7beaa888ff..32efb75b5e 100644 --- a/src/core/hle/service/audio/final_output_recorder_manager_for_applet.h +++ b/src/core/hle/service/audio/final_output_recorder_manager_for_applet.h @@ -19,14 +19,6 @@ class IFinalOutputRecorderManagerForApplet final public: explicit IFinalOutputRecorderManagerForApplet(Core::System& system_); ~IFinalOutputRecorderManagerForApplet() override; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "RequestSuspend"}, - FunctionInfo{1, nullptr, "RequestResume"} - ); }; } // namespace Service::Audio diff --git a/src/core/hle/service/audio/hardware_opus_decoder.cpp b/src/core/hle/service/audio/hardware_opus_decoder.cpp index f0dde63e14..14888afa0d 100644 --- a/src/core/hle/service/audio/hardware_opus_decoder.cpp +++ b/src/core/hle/service/audio/hardware_opus_decoder.cpp @@ -11,25 +11,25 @@ namespace Service::Audio { using namespace AudioCore::OpusDecoder; - std::optional IHardwareOpusDecoder::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IHardwareOpusDecoder::DecodeInterleavedOld>, "DecodeInterleavedOld"}, - FunctionInfo{1, D<&IHardwareOpusDecoder::SetContext>, "SetContext"}, - FunctionInfo{2, D<&IHardwareOpusDecoder::DecodeInterleavedForMultiStreamOld>, "DecodeInterleavedForMultiStreamOld"}, - FunctionInfo{3, D<&IHardwareOpusDecoder::SetContextForMultiStream>, "SetContextForMultiStream"}, - FunctionInfo{4, D<&IHardwareOpusDecoder::DecodeInterleavedWithPerfOld>, "DecodeInterleavedWithPerfOld"}, - FunctionInfo{5, D<&IHardwareOpusDecoder::DecodeInterleavedForMultiStreamWithPerfOld>, "DecodeInterleavedForMultiStreamWithPerfOld"}, - FunctionInfo{6, D<&IHardwareOpusDecoder::DecodeInterleavedWithPerfAndResetOld>, "DecodeInterleavedWithPerfAndResetOld"}, - FunctionInfo{7, D<&IHardwareOpusDecoder::DecodeInterleavedForMultiStreamWithPerfAndResetOld>, "DecodeInterleavedForMultiStreamWithPerfAndResetOld"}, - FunctionInfo{8, D<&IHardwareOpusDecoder::DecodeInterleaved>, "DecodeInterleaved"}, - FunctionInfo{9, D<&IHardwareOpusDecoder::DecodeInterleavedForMultiStream>, "DecodeInterleavedForMultiStream"} - ); - return HandlerTableGenerateWithFind(key, functions); - } - IHardwareOpusDecoder::IHardwareOpusDecoder(Core::System& system_, HardwareOpus& hardware_opus) : ServiceFramework{system_, "IHardwareOpusDecoder"}, impl{std::make_unique(system_, hardware_opus)} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IHardwareOpusDecoder::DecodeInterleavedOld>, "DecodeInterleavedOld"}, + {1, D<&IHardwareOpusDecoder::SetContext>, "SetContext"}, + {2, D<&IHardwareOpusDecoder::DecodeInterleavedForMultiStreamOld>, "DecodeInterleavedForMultiStreamOld"}, + {3, D<&IHardwareOpusDecoder::SetContextForMultiStream>, "SetContextForMultiStream"}, + {4, D<&IHardwareOpusDecoder::DecodeInterleavedWithPerfOld>, "DecodeInterleavedWithPerfOld"}, + {5, D<&IHardwareOpusDecoder::DecodeInterleavedForMultiStreamWithPerfOld>, "DecodeInterleavedForMultiStreamWithPerfOld"}, + {6, D<&IHardwareOpusDecoder::DecodeInterleavedWithPerfAndResetOld>, "DecodeInterleavedWithPerfAndResetOld"}, + {7, D<&IHardwareOpusDecoder::DecodeInterleavedForMultiStreamWithPerfAndResetOld>, "DecodeInterleavedForMultiStreamWithPerfAndResetOld"}, + {8, D<&IHardwareOpusDecoder::DecodeInterleaved>, "DecodeInterleaved"}, + {9, D<&IHardwareOpusDecoder::DecodeInterleavedForMultiStream>, "DecodeInterleavedForMultiStream"}, + }; + // clang-format on + + RegisterHandlers(functions); } IHardwareOpusDecoder::~IHardwareOpusDecoder() = default; diff --git a/src/core/hle/service/audio/hardware_opus_decoder.h b/src/core/hle/service/audio/hardware_opus_decoder.h index 9f9b17bc81..5297572da8 100644 --- a/src/core/hle/service/audio/hardware_opus_decoder.h +++ b/src/core/hle/service/audio/hardware_opus_decoder.h @@ -58,7 +58,6 @@ private: Out out_data_size, Out out_sample_count, Out out_time_taken, InBuffer opus_data, bool reset); - std::optional FindRequest(u32 key) override; std::unique_ptr impl; Common::ScratchBuffer output_data; diff --git a/src/core/hle/service/audio/hardware_opus_decoder_manager.cpp b/src/core/hle/service/audio/hardware_opus_decoder_manager.cpp index 3000ba8c60..b89e210012 100644 --- a/src/core/hle/service/audio/hardware_opus_decoder_manager.cpp +++ b/src/core/hle/service/audio/hardware_opus_decoder_manager.cpp @@ -12,24 +12,23 @@ namespace Service::Audio { using namespace AudioCore::OpusDecoder; -std::optional IHardwareOpusDecoderManager::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IHardwareOpusDecoderManager::OpenHardwareOpusDecoder>, "OpenHardwareOpusDecoder"}, - FunctionInfo{1, D<&IHardwareOpusDecoderManager::GetWorkBufferSize>, "GetWorkBufferSize"}, - FunctionInfo{2, D<&IHardwareOpusDecoderManager::OpenHardwareOpusDecoderForMultiStream>, "OpenOpusDecoderForMultiStream"}, - FunctionInfo{3, D<&IHardwareOpusDecoderManager::GetWorkBufferSizeForMultiStream>, "GetWorkBufferSizeForMultiStream"}, - FunctionInfo{4, D<&IHardwareOpusDecoderManager::OpenHardwareOpusDecoderEx>, "OpenHardwareOpusDecoderEx"}, - FunctionInfo{5, D<&IHardwareOpusDecoderManager::GetWorkBufferSizeEx>, "GetWorkBufferSizeEx"}, - FunctionInfo{6, D<&IHardwareOpusDecoderManager::OpenHardwareOpusDecoderForMultiStreamEx>, "OpenHardwareOpusDecoderForMultiStreamEx"}, - FunctionInfo{7, D<&IHardwareOpusDecoderManager::GetWorkBufferSizeForMultiStreamEx>, "GetWorkBufferSizeForMultiStreamEx"}, - FunctionInfo{8, D<&IHardwareOpusDecoderManager::GetWorkBufferSizeExEx>, "GetWorkBufferSizeExEx"}, - FunctionInfo{9, D<&IHardwareOpusDecoderManager::GetWorkBufferSizeForMultiStreamExEx>, "GetWorkBufferSizeForMultiStreamExEx"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IHardwareOpusDecoderManager::IHardwareOpusDecoderManager(Core::System& system_) : ServiceFramework{system_, "hwopus"}, system{system_}, impl{system} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IHardwareOpusDecoderManager::OpenHardwareOpusDecoder>, "OpenHardwareOpusDecoder"}, + {1, D<&IHardwareOpusDecoderManager::GetWorkBufferSize>, "GetWorkBufferSize"}, + {2, D<&IHardwareOpusDecoderManager::OpenHardwareOpusDecoderForMultiStream>, "OpenOpusDecoderForMultiStream"}, + {3, D<&IHardwareOpusDecoderManager::GetWorkBufferSizeForMultiStream>, "GetWorkBufferSizeForMultiStream"}, + {4, D<&IHardwareOpusDecoderManager::OpenHardwareOpusDecoderEx>, "OpenHardwareOpusDecoderEx"}, + {5, D<&IHardwareOpusDecoderManager::GetWorkBufferSizeEx>, "GetWorkBufferSizeEx"}, + {6, D<&IHardwareOpusDecoderManager::OpenHardwareOpusDecoderForMultiStreamEx>, "OpenHardwareOpusDecoderForMultiStreamEx"}, + {7, D<&IHardwareOpusDecoderManager::GetWorkBufferSizeForMultiStreamEx>, "GetWorkBufferSizeForMultiStreamEx"}, + {8, D<&IHardwareOpusDecoderManager::GetWorkBufferSizeExEx>, "GetWorkBufferSizeExEx"}, + {9, D<&IHardwareOpusDecoderManager::GetWorkBufferSizeForMultiStreamExEx>, "GetWorkBufferSizeForMultiStreamExEx"}, + }; + // clang-format on + RegisterHandlers(functions); } IHardwareOpusDecoderManager::~IHardwareOpusDecoderManager() = default; diff --git a/src/core/hle/service/audio/hardware_opus_decoder_manager.h b/src/core/hle/service/audio/hardware_opus_decoder_manager.h index 1dbac9addb..4dd211e232 100644 --- a/src/core/hle/service/audio/hardware_opus_decoder_manager.h +++ b/src/core/hle/service/audio/hardware_opus_decoder_manager.h @@ -49,7 +49,6 @@ private: Result GetWorkBufferSizeForMultiStreamExEx( Out out_size, InLargeData params); - std::optional FindRequest(u32 key) override; Core::System& system; AudioCore::OpusDecoder::OpusDecoderManager impl; }; diff --git a/src/core/hle/service/bcat/bcat.h b/src/core/hle/service/bcat/bcat.h index 2aaffc693b..65961baffe 100644 --- a/src/core/hle/service/bcat/bcat.h +++ b/src/core/hle/service/bcat/bcat.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/bcat/bcat_result.h b/src/core/hle/service/bcat/bcat_result.h index edf8a65641..c6fa1b4e26 100644 --- a/src/core/hle/service/bcat/bcat_result.h +++ b/src/core/hle/service/bcat/bcat_result.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/core/hle/service/bcat/bcat_service.cpp b/src/core/hle/service/bcat/bcat_service.cpp index 85f262f6eb..bc2a3e3457 100644 --- a/src/core/hle/service/bcat/bcat_service.cpp +++ b/src/core/hle/service/bcat/bcat_service.cpp @@ -24,45 +24,44 @@ static u64 GetCurrentBuildID(const Core::System::CurrentBuildProcessID& id) { return out; } -std::optional IBcatService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{10100, D<&IBcatService::RequestSyncDeliveryCache>, "RequestSyncDeliveryCache"}, - FunctionInfo{10101, D<&IBcatService::RequestSyncDeliveryCacheWithDirectoryName>, "RequestSyncDeliveryCacheWithDirectoryName"}, - FunctionInfo{10200, nullptr, "CancelSyncDeliveryCacheRequest"}, - FunctionInfo{20100, nullptr, "RequestSyncDeliveryCacheWithApplicationId"}, - FunctionInfo{20101, nullptr, "RequestSyncDeliveryCacheWithApplicationIdAndDirectoryName"}, - FunctionInfo{20300, nullptr, "GetDeliveryCacheStorageUpdateNotifier"}, - FunctionInfo{20301, nullptr, "RequestSuspendDeliveryTask"}, - FunctionInfo{20400, nullptr, "RegisterSystemApplicationDeliveryTask"}, - FunctionInfo{20401, nullptr, "UnregisterSystemApplicationDeliveryTask"}, - FunctionInfo{20410, nullptr, "SetSystemApplicationDeliveryTaskTimer"}, - FunctionInfo{30100, D<&IBcatService::SetPassphrase>, "SetPassphrase"}, - FunctionInfo{30101, nullptr, "Unknown30101", MakeVersionGate({2,0,0}, {2,3,0})}, - FunctionInfo{30102, nullptr, "Unknown30102", MakeVersionGate({2,0,0}, {2,3,0})}, - FunctionInfo{30200, nullptr, "RegisterBackgroundDeliveryTask"}, - FunctionInfo{30201, nullptr, "UnregisterBackgroundDeliveryTask"}, - FunctionInfo{30202, nullptr, "BlockDeliveryTask"}, - FunctionInfo{30203, nullptr, "UnblockDeliveryTask"}, - FunctionInfo{30210, nullptr, "SetDeliveryTaskTimer"}, - FunctionInfo{30300, D<&IBcatService::RegisterSystemApplicationDeliveryTasks>, "RegisterSystemApplicationDeliveryTasks"}, - FunctionInfo{90100, nullptr, "GetDeliveryTaskList"}, - FunctionInfo{90101, nullptr, "GetDeliveryTaskListForSystem", MakeVersionGate({11,0,0})}, - FunctionInfo{90200, nullptr, "GetDeliveryList"}, - FunctionInfo{90201, D<&IBcatService::ClearDeliveryCacheStorage>, "ClearDeliveryCacheStorage"}, - FunctionInfo{90202, nullptr, "ClearDeliveryTaskSubscriptionStatus"}, - FunctionInfo{90300, nullptr, "GetPushNotificationLog"}, - FunctionInfo{90301, nullptr, "GetDeliveryCacheStorageUsage", MakeVersionGate({11,0,0})} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IBcatService::IBcatService(Core::System& system_, BcatBackend& backend_, u64 program_id_) - : ServiceFramework{system_, "IBcatService"}, backend{backend_}, program_id{program_id_} - , progress{{ - ProgressServiceBackend{system_, "Normal"}, - ProgressServiceBackend{system_, "Directory"}, - }} -{} + : ServiceFramework{system_, "IBcatService"}, backend{backend_}, program_id{program_id_}, + progress{{ + ProgressServiceBackend{system_, "Normal"}, + ProgressServiceBackend{system_, "Directory"}, + }} { + // clang-format off + static const FunctionInfo functions[] = { + {10100, D<&IBcatService::RequestSyncDeliveryCache>, "RequestSyncDeliveryCache"}, + {10101, D<&IBcatService::RequestSyncDeliveryCacheWithDirectoryName>, "RequestSyncDeliveryCacheWithDirectoryName"}, + {10200, nullptr, "CancelSyncDeliveryCacheRequest"}, + {20100, nullptr, "RequestSyncDeliveryCacheWithApplicationId"}, + {20101, nullptr, "RequestSyncDeliveryCacheWithApplicationIdAndDirectoryName"}, + {20300, nullptr, "GetDeliveryCacheStorageUpdateNotifier"}, + {20301, nullptr, "RequestSuspendDeliveryTask"}, + {20400, nullptr, "RegisterSystemApplicationDeliveryTask"}, + {20401, nullptr, "UnregisterSystemApplicationDeliveryTask"}, + {20410, nullptr, "SetSystemApplicationDeliveryTaskTimer"}, + {30100, D<&IBcatService::SetPassphrase>, "SetPassphrase"}, + {30101, nullptr, "Unknown30101"}, //2.0.0-2.3.0 + {30102, nullptr, "Unknown30102"}, //2.0.0-2.3.0 + {30200, nullptr, "RegisterBackgroundDeliveryTask"}, + {30201, nullptr, "UnregisterBackgroundDeliveryTask"}, + {30202, nullptr, "BlockDeliveryTask"}, + {30203, nullptr, "UnblockDeliveryTask"}, + {30210, nullptr, "SetDeliveryTaskTimer"}, + {30300, D<&IBcatService::RegisterSystemApplicationDeliveryTasks>, "RegisterSystemApplicationDeliveryTasks"}, + {90100, nullptr, "GetDeliveryTaskList"}, + {90101, nullptr, "GetDeliveryTaskListForSystem"}, //11.0.0+ + {90200, nullptr, "GetDeliveryList"}, + {90201, D<&IBcatService::ClearDeliveryCacheStorage>, "ClearDeliveryCacheStorage"}, + {90202, nullptr, "ClearDeliveryTaskSubscriptionStatus"}, + {90300, nullptr, "GetPushNotificationLog"}, + {90301, nullptr, "GetDeliveryCacheStorageUsage"}, //11.0.0+ + }; + // clang-format on + RegisterHandlers(functions); +} IBcatService::~IBcatService() = default; diff --git a/src/core/hle/service/bcat/bcat_service.h b/src/core/hle/service/bcat/bcat_service.h index ed95f021d0..5e11059a78 100644 --- a/src/core/hle/service/bcat/bcat_service.h +++ b/src/core/hle/service/bcat/bcat_service.h @@ -41,7 +41,6 @@ private: ProgressServiceBackend& GetProgressBackend(SyncType type); const ProgressServiceBackend& GetProgressBackend(SyncType type) const; - std::optional FindRequest(u32 key) override; BcatBackend& backend; u64 program_id; std::array(SyncType::Count)> progress; diff --git a/src/core/hle/service/bcat/delivery_cache_directory_service.cpp b/src/core/hle/service/bcat/delivery_cache_directory_service.cpp index 0d464a2fdc..8ead0bae99 100644 --- a/src/core/hle/service/bcat/delivery_cache_directory_service.cpp +++ b/src/core/hle/service/bcat/delivery_cache_directory_service.cpp @@ -27,18 +27,18 @@ static BcatDigest DigestFile(const FileSys::VirtualFile& file) { return out; } -std::optional IDeliveryCacheDirectoryService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IDeliveryCacheDirectoryService::Open>, "Open"}, - FunctionInfo{1, D<&IDeliveryCacheDirectoryService::Read>, "Read"}, - FunctionInfo{2, D<&IDeliveryCacheDirectoryService::GetCount>, "GetCount"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IDeliveryCacheDirectoryService::IDeliveryCacheDirectoryService(Core::System& system_, FileSys::VirtualDir root_) : ServiceFramework{system_, "IDeliveryCacheDirectoryService"}, root(std::move(root_)) { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IDeliveryCacheDirectoryService::Open>, "Open"}, + {1, D<&IDeliveryCacheDirectoryService::Read>, "Read"}, + {2, D<&IDeliveryCacheDirectoryService::GetCount>, "GetCount"}, + }; + // clang-format on + + RegisterHandlers(functions); } IDeliveryCacheDirectoryService::~IDeliveryCacheDirectoryService() = default; diff --git a/src/core/hle/service/bcat/delivery_cache_directory_service.h b/src/core/hle/service/bcat/delivery_cache_directory_service.h index af90680390..cea67b0d87 100644 --- a/src/core/hle/service/bcat/delivery_cache_directory_service.h +++ b/src/core/hle/service/bcat/delivery_cache_directory_service.h @@ -29,7 +29,6 @@ private: OutArray out_buffer); Result GetCount(Out out_count); - std::optional FindRequest(u32 key) override; FileSys::VirtualDir root; FileSys::VirtualDir current_dir; }; diff --git a/src/core/hle/service/bcat/delivery_cache_file_service.cpp b/src/core/hle/service/bcat/delivery_cache_file_service.cpp index d9b6ff77ee..1d961e1655 100644 --- a/src/core/hle/service/bcat/delivery_cache_file_service.cpp +++ b/src/core/hle/service/bcat/delivery_cache_file_service.cpp @@ -12,19 +12,19 @@ namespace Service::BCAT { -std::optional IDeliveryCacheFileService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IDeliveryCacheFileService::Open>, "Open"}, - FunctionInfo{1, D<&IDeliveryCacheFileService::Read>, "Read"}, - FunctionInfo{2, D<&IDeliveryCacheFileService::GetSize>, "GetSize"}, - FunctionInfo{3, D<&IDeliveryCacheFileService::GetDigest>, "GetDigest"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IDeliveryCacheFileService::IDeliveryCacheFileService(Core::System& system_, FileSys::VirtualDir root_) : ServiceFramework{system_, "IDeliveryCacheFileService"}, root(std::move(root_)) { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IDeliveryCacheFileService::Open>, "Open"}, + {1, D<&IDeliveryCacheFileService::Read>, "Read"}, + {2, D<&IDeliveryCacheFileService::GetSize>, "GetSize"}, + {3, D<&IDeliveryCacheFileService::GetDigest>, "GetDigest"}, + }; + // clang-format on + + RegisterHandlers(functions); } IDeliveryCacheFileService::~IDeliveryCacheFileService() = default; diff --git a/src/core/hle/service/bcat/delivery_cache_file_service.h b/src/core/hle/service/bcat/delivery_cache_file_service.h index 176c8eb3e5..911bda55b3 100644 --- a/src/core/hle/service/bcat/delivery_cache_file_service.h +++ b/src/core/hle/service/bcat/delivery_cache_file_service.h @@ -29,7 +29,6 @@ private: Result GetSize(Out out_size); Result GetDigest(Out out_digest); - std::optional FindRequest(u32 key) override; FileSys::VirtualDir root; FileSys::VirtualFile current_file; }; diff --git a/src/core/hle/service/bcat/delivery_cache_progress_service.cpp b/src/core/hle/service/bcat/delivery_cache_progress_service.cpp index 4de42dd580..873977bf90 100644 --- a/src/core/hle/service/bcat/delivery_cache_progress_service.cpp +++ b/src/core/hle/service/bcat/delivery_cache_progress_service.cpp @@ -10,18 +10,18 @@ namespace Service::BCAT { -std::optional IDeliveryCacheProgressService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IDeliveryCacheProgressService::GetEvent>, "GetEvent"}, - FunctionInfo{1, D<&IDeliveryCacheProgressService::GetImpl>, "GetImpl"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IDeliveryCacheProgressService::IDeliveryCacheProgressService(Core::System& system_, Kernel::KReadableEvent& event_, const DeliveryCacheProgressImpl& impl_) : ServiceFramework{system_, "IDeliveryCacheProgressService"}, event{event_}, impl{impl_} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IDeliveryCacheProgressService::GetEvent>, "Get"}, + {1, D<&IDeliveryCacheProgressService::GetImpl>, "Get"}, + }; + // clang-format on + + RegisterHandlers(functions); } IDeliveryCacheProgressService::~IDeliveryCacheProgressService() = default; diff --git a/src/core/hle/service/bcat/delivery_cache_progress_service.h b/src/core/hle/service/bcat/delivery_cache_progress_service.h index 88f49cea85..83d4d35827 100644 --- a/src/core/hle/service/bcat/delivery_cache_progress_service.h +++ b/src/core/hle/service/bcat/delivery_cache_progress_service.h @@ -31,7 +31,6 @@ private: Result GetEvent(OutCopyHandle out_event); Result GetImpl(OutLargeData out_impl); - std::optional FindRequest(u32 key) override; Kernel::KReadableEvent& event; const DeliveryCacheProgressImpl& impl; }; diff --git a/src/core/hle/service/bcat/delivery_cache_storage_service.cpp b/src/core/hle/service/bcat/delivery_cache_storage_service.cpp index 67dc857642..a363bcb2d1 100644 --- a/src/core/hle/service/bcat/delivery_cache_storage_service.cpp +++ b/src/core/hle/service/bcat/delivery_cache_storage_service.cpp @@ -12,18 +12,18 @@ namespace Service::BCAT { -std::optional IDeliveryCacheStorageService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IDeliveryCacheStorageService::CreateFileService>, "CreateFileService"}, - FunctionInfo{1, D<&IDeliveryCacheStorageService::CreateDirectoryService>, "CreateDirectoryService"}, - FunctionInfo{10, D<&IDeliveryCacheStorageService::EnumerateDeliveryCacheDirectory>, "EnumerateDeliveryCacheDirectory"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IDeliveryCacheStorageService::IDeliveryCacheStorageService(Core::System& system_, FileSys::VirtualDir root_) : ServiceFramework{system_, "IDeliveryCacheStorageService"}, root(std::move(root_)) { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IDeliveryCacheStorageService::CreateFileService>, "CreateFileService"}, + {1, D<&IDeliveryCacheStorageService::CreateDirectoryService>, "CreateDirectoryService"}, + {10, D<&IDeliveryCacheStorageService::EnumerateDeliveryCacheDirectory>, "EnumerateDeliveryCacheDirectory"}, + }; + // clang-format on + + RegisterHandlers(functions); } IDeliveryCacheStorageService::~IDeliveryCacheStorageService() = default; diff --git a/src/core/hle/service/bcat/delivery_cache_storage_service.h b/src/core/hle/service/bcat/delivery_cache_storage_service.h index b30f24fb47..4849e58047 100644 --- a/src/core/hle/service/bcat/delivery_cache_storage_service.h +++ b/src/core/hle/service/bcat/delivery_cache_storage_service.h @@ -31,7 +31,6 @@ private: Out out_directory_count, OutArray out_directories); - std::optional FindRequest(u32 key) override; FileSys::VirtualDir root; std::vector entries; std::size_t next_read_index = 0; diff --git a/src/core/hle/service/bcat/news/builtin_news.h b/src/core/hle/service/bcat/news/builtin_news.h index cb06b2d4e3..e47cc89588 100644 --- a/src/core/hle/service/bcat/news/builtin_news.h +++ b/src/core/hle/service/bcat/news/builtin_news.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later #pragma once diff --git a/src/core/hle/service/bcat/news/msgpack.cpp b/src/core/hle/service/bcat/news/msgpack.cpp index b67b75ea9d..9cea2de522 100644 --- a/src/core/hle/service/bcat/news/msgpack.cpp +++ b/src/core/hle/service/bcat/news/msgpack.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later #include "core/hle/service/bcat/news/msgpack.h" diff --git a/src/core/hle/service/bcat/news/msgpack.h b/src/core/hle/service/bcat/news/msgpack.h index a7a2aa40ba..3163689782 100644 --- a/src/core/hle/service/bcat/news/msgpack.h +++ b/src/core/hle/service/bcat/news/msgpack.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later #pragma once diff --git a/src/core/hle/service/bcat/news/newly_arrived_event_holder.cpp b/src/core/hle/service/bcat/news/newly_arrived_event_holder.cpp index 57d71c49d8..b60de3b1f5 100644 --- a/src/core/hle/service/bcat/news/newly_arrived_event_holder.cpp +++ b/src/core/hle/service/bcat/news/newly_arrived_event_holder.cpp @@ -9,16 +9,17 @@ namespace Service::News { -std::optional INewlyArrivedEventHolder::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&INewlyArrivedEventHolder::Get>, "Get"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - INewlyArrivedEventHolder::INewlyArrivedEventHolder(Core::System& system_) - : ServiceFramework{system_, "INewlyArrivedEventHolder"} - , service_context{system_, "INewlyArrivedEventHolder"} { + : ServiceFramework{system_, "INewlyArrivedEventHolder"}, service_context{ + system_, + "INewlyArrivedEventHolder"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&INewlyArrivedEventHolder::Get>, "Get"}, + }; + // clang-format on + + RegisterHandlers(functions); arrived_event = service_context.CreateEvent("INewlyArrivedEventHolder::ArrivedEvent"); } diff --git a/src/core/hle/service/bcat/news/newly_arrived_event_holder.h b/src/core/hle/service/bcat/news/newly_arrived_event_holder.h index fccc8d6e55..5c2aeec182 100644 --- a/src/core/hle/service/bcat/news/newly_arrived_event_holder.h +++ b/src/core/hle/service/bcat/news/newly_arrived_event_holder.h @@ -29,7 +29,6 @@ public: private: Result Get(OutCopyHandle out_event); - std::optional FindRequest(u32 key) override; Kernel::KEvent* arrived_event; KernelHelpers::ServiceContext service_context; }; diff --git a/src/core/hle/service/bcat/news/news_data_service.cpp b/src/core/hle/service/bcat/news/news_data_service.cpp index f5de93db49..200d00e785 100644 --- a/src/core/hle/service/bcat/news/news_data_service.cpp +++ b/src/core/hle/service/bcat/news/news_data_service.cpp @@ -24,19 +24,16 @@ std::string_view ToStringView(std::span buf) { } // namespace -std::optional INewsDataService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&INewsDataService::Open>, "Open"}, - FunctionInfo{1, D<&INewsDataService::OpenWithNewsRecordV1>, "OpenWithNewsRecordV1"}, - FunctionInfo{2, D<&INewsDataService::Read>, "Read"}, - FunctionInfo{3, D<&INewsDataService::GetSize>, "GetSize"}, - FunctionInfo{1001, D<&INewsDataService::OpenWithNewsRecord>, "OpenWithNewsRecord"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - INewsDataService::INewsDataService(Core::System& system_) : ServiceFramework{system_, "INewsDataService"} { + static const FunctionInfo functions[] = { + {0, D<&INewsDataService::Open>, "Open"}, + {1, D<&INewsDataService::OpenWithNewsRecordV1>, "OpenWithNewsRecordV1"}, + {2, D<&INewsDataService::Read>, "Read"}, + {3, D<&INewsDataService::GetSize>, "GetSize"}, + {1001, D<&INewsDataService::OpenWithNewsRecord>, "OpenWithNewsRecord"}, + }; + RegisterHandlers(functions); } INewsDataService::~INewsDataService() = default; diff --git a/src/core/hle/service/bcat/news/news_data_service.h b/src/core/hle/service/bcat/news/news_data_service.h index 8ce10c045d..45fe4bafcc 100644 --- a/src/core/hle/service/bcat/news/news_data_service.h +++ b/src/core/hle/service/bcat/news/news_data_service.h @@ -31,7 +31,6 @@ private: Result Read(Out out_size, s64 offset, OutBuffer out_buffer); Result GetSize(Out out_size); - std::optional FindRequest(u32 key) override; std::vector opened_payload; }; diff --git a/src/core/hle/service/bcat/news/news_database_service.cpp b/src/core/hle/service/bcat/news/news_database_service.cpp index 08fdfcb58b..27ca1ad378 100644 --- a/src/core/hle/service/bcat/news/news_database_service.cpp +++ b/src/core/hle/service/bcat/news/news_database_service.cpp @@ -45,21 +45,18 @@ bool UpdateField(NewsRecord& rec, std::string_view column, s32 value, bool addit } // namespace -std::optional INewsDatabaseService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&INewsDatabaseService::GetListV1>, "GetListV1"}, - FunctionInfo{1, D<&INewsDatabaseService::Count>, "Count"}, - FunctionInfo{2, D<&INewsDatabaseService::CountWithKey>, "CountWithKey"}, - FunctionInfo{3, D<&INewsDatabaseService::UpdateIntegerValue>, "UpdateIntegerValue"}, - FunctionInfo{4, D<&INewsDatabaseService::UpdateIntegerValueWithAddition>, "UpdateIntegerValueWithAddition"}, - FunctionInfo{5, D<&INewsDatabaseService::UpdateStringValue>, "UpdateStringValue"}, - FunctionInfo{1000, D<&INewsDatabaseService::GetList>, "GetList"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - INewsDatabaseService::INewsDatabaseService(Core::System& system_) : ServiceFramework{system_, "INewsDatabaseService"} { + static const FunctionInfo functions[] = { + {0, D<&INewsDatabaseService::GetListV1>, "GetListV1"}, + {1, D<&INewsDatabaseService::Count>, "Count"}, + {2, D<&INewsDatabaseService::CountWithKey>, "CountWithKey"}, + {3, D<&INewsDatabaseService::UpdateIntegerValue>, "UpdateIntegerValue"}, + {4, D<&INewsDatabaseService::UpdateIntegerValueWithAddition>, "UpdateIntegerValueWithAddition"}, + {5, D<&INewsDatabaseService::UpdateStringValue>, "UpdateStringValue"}, + {1000, D<&INewsDatabaseService::GetList>, "GetList"}, + }; + RegisterHandlers(functions); } INewsDatabaseService::~INewsDatabaseService() = default; diff --git a/src/core/hle/service/bcat/news/news_database_service.h b/src/core/hle/service/bcat/news/news_database_service.h index 0a097b97bc..7552da23de 100644 --- a/src/core/hle/service/bcat/news/news_database_service.h +++ b/src/core/hle/service/bcat/news/news_database_service.h @@ -49,8 +49,6 @@ private: InBuffer where_phrase, InBuffer order_by_phrase, s32 offset); - - std::optional FindRequest(u32 key) override; }; } // namespace Service::News diff --git a/src/core/hle/service/bcat/news/news_service.cpp b/src/core/hle/service/bcat/news/news_service.cpp index 7cb931896c..4dcaa14881 100644 --- a/src/core/hle/service/bcat/news/news_service.cpp +++ b/src/core/hle/service/bcat/news/news_service.cpp @@ -12,32 +12,32 @@ namespace Service::News { -std::optional INewsService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{10100, D<&INewsService::PostLocalNews>, "PostLocalNews"}, - FunctionInfo{20100, D<&INewsService::SetPassphrase>, "SetPassphrase"}, - FunctionInfo{30100, D<&INewsService::GetSubscriptionStatus>, "GetSubscriptionStatus"}, - FunctionInfo{30101, D<&INewsService::GetTopicList>, "GetTopicList", MakeVersionGate({3,0,0})}, - FunctionInfo{30110, D<&INewsService::GetTopicList>, "Unknown30110", MakeVersionGate({6,0,0})}, // stub - FunctionInfo{30200, D<&INewsService::IsSystemUpdateRequired>, "IsSystemUpdateRequired"}, - FunctionInfo{30201, D<&INewsService::IsSystemUpdateRequired>, "Unknown30201", MakeVersionGate({8,0,0})}, // stub - FunctionInfo{30210, D<&INewsService::IsSystemUpdateRequired>, "Unknown30210", MakeVersionGate({10,0,0})}, // stub - FunctionInfo{30300, nullptr, "RequestImmediateReception"}, - FunctionInfo{30400, nullptr, "DecodeArchiveFile", MakeVersionGate({3,0,0}, {18,1,0})}, // stub - FunctionInfo{30500, nullptr, "Unknown30500", MakeVersionGate({8,0,0})}, // stub - FunctionInfo{30900, nullptr, "Unknown30900", MakeVersionGate({1,0,0})}, // stub - FunctionInfo{30901, nullptr, "Unknown30901", MakeVersionGate({1,0,0})}, // stub - FunctionInfo{30902, nullptr, "Unknown30902", MakeVersionGate({1,0,0})}, // stub - FunctionInfo{40100, nullptr, "SetSubscriptionStatus"}, - FunctionInfo{40101, D<&INewsService::RequestAutoSubscription>, "RequestAutoSubscription", MakeVersionGate({3,0,0})}, - FunctionInfo{40200, D<&INewsService::ClearStorage>, "ClearStorage"}, - FunctionInfo{40201, D<&INewsService::ClearSubscriptionStatusAll>, "ClearSubscriptionStatusAll"}, - FunctionInfo{90100, D<&INewsService::GetNewsDatabaseDump>, "GetNewsDatabaseDump"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - INewsService::INewsService(Core::System& system_) : ServiceFramework{system_, "INewsService"} { + // clang-format off + static const FunctionInfo functions[] = { + {10100, D<&INewsService::PostLocalNews>, "PostLocalNews"}, + {20100, D<&INewsService::SetPassphrase>, "SetPassphrase"}, + {30100, D<&INewsService::GetSubscriptionStatus>, "GetSubscriptionStatus"}, + {30101, D<&INewsService::GetTopicList>, "GetTopicList"}, //3.0.0+ + {30110, D<&INewsService::GetTopicList>, "Unknown30110"}, //6.0.0+ (stub) + {30200, D<&INewsService::IsSystemUpdateRequired>, "IsSystemUpdateRequired"}, + {30201, D<&INewsService::IsSystemUpdateRequired>, "Unknown30201"}, //8.0.0+ (stub) + {30210, D<&INewsService::IsSystemUpdateRequired>, "Unknown30210"}, //10.0.0+ (stub) + {30300, nullptr, "RequestImmediateReception"}, + {30400, nullptr, "DecodeArchiveFile"}, //3.0.0-18.1.0 (stub) + {30500, nullptr, "Unknown30500"}, //8.0.0+ (stub) + {30900, nullptr, "Unknown30900"}, //1.0.0 (stub) + {30901, nullptr, "Unknown30901"}, //1.0.0 (stub) + {30902, nullptr, "Unknown30902"}, //1.0.0 (stub) + {40100, nullptr, "SetSubscriptionStatus"}, + {40101, D<&INewsService::RequestAutoSubscription>, "RequestAutoSubscription"}, //3.0.0+ + {40200, D<&INewsService::ClearStorage>, "ClearStorage"}, + {40201, D<&INewsService::ClearSubscriptionStatusAll>, "ClearSubscriptionStatusAll"}, + {90100, D<&INewsService::GetNewsDatabaseDump>, "GetNewsDatabaseDump"}, + }; + // clang-format on + + RegisterHandlers(functions); } INewsService::~INewsService() = default; diff --git a/src/core/hle/service/bcat/news/news_service.h b/src/core/hle/service/bcat/news/news_service.h index 577147e604..5d6109243b 100644 --- a/src/core/hle/service/bcat/news/news_service.h +++ b/src/core/hle/service/bcat/news/news_service.h @@ -22,15 +22,22 @@ public: private: Result PostLocalNews(InBuffer buffer_data); + Result SetPassphrase(InBuffer buffer_data); + Result GetSubscriptionStatus(Out out_status, InBuffer buffer_data); + Result GetTopicList(Out out_count, OutBuffer out_topics, s32 filter); + Result IsSystemUpdateRequired(Out out_is_system_update_required); + Result RequestAutoSubscription(u64 value); + Result ClearStorage(); + Result ClearSubscriptionStatusAll(); + Result GetNewsDatabaseDump(); - std::optional FindRequest(u32 key) override; }; } // namespace Service::News diff --git a/src/core/hle/service/bcat/news/news_storage.cpp b/src/core/hle/service/bcat/news/news_storage.cpp index 793c1fa94f..b65b680771 100644 --- a/src/core/hle/service/bcat/news/news_storage.cpp +++ b/src/core/hle/service/bcat/news/news_storage.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later #include "core/hle/service/bcat/news/news_storage.h" diff --git a/src/core/hle/service/bcat/news/overwrite_event_holder.cpp b/src/core/hle/service/bcat/news/overwrite_event_holder.cpp index a6b3029e83..08449f1c4a 100644 --- a/src/core/hle/service/bcat/news/overwrite_event_holder.cpp +++ b/src/core/hle/service/bcat/news/overwrite_event_holder.cpp @@ -9,16 +9,16 @@ namespace Service::News { -std::optional IOverwriteEventHolder::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IOverwriteEventHolder::Get>, "Get"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IOverwriteEventHolder::IOverwriteEventHolder(Core::System& system_) - : ServiceFramework{system_, "IOverwriteEventHolder"} - , service_context{system_, "IOverwriteEventHolder"} { + : ServiceFramework{system_, "IOverwriteEventHolder"}, service_context{system_, + "IOverwriteEventHolder"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IOverwriteEventHolder::Get>, "Get"}, + }; + // clang-format on + + RegisterHandlers(functions); overwrite_event = service_context.CreateEvent("IOverwriteEventHolder::OverwriteEvent"); } diff --git a/src/core/hle/service/bcat/news/overwrite_event_holder.h b/src/core/hle/service/bcat/news/overwrite_event_holder.h index ba52a36527..507f6ab668 100644 --- a/src/core/hle/service/bcat/news/overwrite_event_holder.h +++ b/src/core/hle/service/bcat/news/overwrite_event_holder.h @@ -29,7 +29,6 @@ public: private: Result Get(OutCopyHandle out_event); - std::optional FindRequest(u32 key) override; Kernel::KEvent* overwrite_event; KernelHelpers::ServiceContext service_context; }; diff --git a/src/core/hle/service/bcat/news/service_creator.cpp b/src/core/hle/service/bcat/news/service_creator.cpp index 66e3b1277e..f27e4e52e6 100644 --- a/src/core/hle/service/bcat/news/service_creator.cpp +++ b/src/core/hle/service/bcat/news/service_creator.cpp @@ -14,19 +14,19 @@ namespace Service::News { -std::optional IServiceCreator::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IServiceCreator::CreateNewsService>, "CreateNewsService"}, - FunctionInfo{1, D<&IServiceCreator::CreateNewlyArrivedEventHolder>, "CreateNewlyArrivedEventHolder"}, - FunctionInfo{2, D<&IServiceCreator::CreateNewsDataService>, "CreateNewsDataService"}, - FunctionInfo{3, D<&IServiceCreator::CreateNewsDatabaseService>, "CreateNewsDatabaseService"}, - FunctionInfo{4, D<&IServiceCreator::CreateOverwriteEventHolder>, "CreateOverwriteEventHolder"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IServiceCreator::IServiceCreator(Core::System& system_, u32 permissions_, const char* name_) : ServiceFramework{system_, name_}, permissions{permissions_} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IServiceCreator::CreateNewsService>, "CreateNewsService"}, + {1, D<&IServiceCreator::CreateNewlyArrivedEventHolder>, "CreateNewlyArrivedEventHolder"}, + {2, D<&IServiceCreator::CreateNewsDataService>, "CreateNewsDataService"}, + {3, D<&IServiceCreator::CreateNewsDatabaseService>, "CreateNewsDatabaseService"}, + {4, D<&IServiceCreator::CreateOverwriteEventHolder>, "CreateOverwriteEventHolder"}, + }; + // clang-format on + + RegisterHandlers(functions); } IServiceCreator::~IServiceCreator() = default; diff --git a/src/core/hle/service/bcat/news/service_creator.h b/src/core/hle/service/bcat/news/service_creator.h index a87f30b67e..42fbccd2a0 100644 --- a/src/core/hle/service/bcat/news/service_creator.h +++ b/src/core/hle/service/bcat/news/service_creator.h @@ -32,7 +32,6 @@ private: Result CreateNewsDatabaseService(OutInterface out_interface); Result CreateOverwriteEventHolder(OutInterface out_interface); - std::optional FindRequest(u32 key) override; u32 permissions; }; diff --git a/src/core/hle/service/bcat/service_creator.cpp b/src/core/hle/service/bcat/service_creator.cpp index 83f97bb17a..15f59d3056 100644 --- a/src/core/hle/service/bcat/service_creator.cpp +++ b/src/core/hle/service/bcat/service_creator.cpp @@ -13,17 +13,6 @@ namespace Service::BCAT { -std::optional IServiceCreator::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IServiceCreator::CreateBcatService>, "CreateBcatService"}, - FunctionInfo{1, D<&IServiceCreator::CreateDeliveryCacheStorageService>, "CreateDeliveryCacheStorageService"}, - FunctionInfo{2, D<&IServiceCreator::CreateDeliveryCacheStorageServiceWithApplicationId>, "CreateDeliveryCacheStorageServiceWithApplicationId"}, - FunctionInfo{3, nullptr, "CreateDeliveryCacheProgressService"}, - FunctionInfo{4, nullptr, "CreateDeliveryCacheProgressServiceWithApplicationId"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - std::unique_ptr CreateBackendFromSettings([[maybe_unused]] Core::System& system, DirectoryGetter getter) { return std::make_unique(std::move(getter)); @@ -31,7 +20,20 @@ std::unique_ptr CreateBackendFromSettings([[maybe_unused]] Core::Sy IServiceCreator::IServiceCreator(Core::System& system_, const char* name_) : ServiceFramework{system_, name_}, fsc{system.GetFileSystemController()} { - backend = CreateBackendFromSettings(system_, [this](u64 tid) { return fsc.GetBCATDirectory(tid); }); + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IServiceCreator::CreateBcatService>, "CreateBcatService"}, + {1, D<&IServiceCreator::CreateDeliveryCacheStorageService>, "CreateDeliveryCacheStorageService"}, + {2, D<&IServiceCreator::CreateDeliveryCacheStorageServiceWithApplicationId>, "CreateDeliveryCacheStorageServiceWithApplicationId"}, + {3, nullptr, "CreateDeliveryCacheProgressService"}, + {4, nullptr, "CreateDeliveryCacheProgressServiceWithApplicationId"}, + }; + // clang-format on + + RegisterHandlers(functions); + + backend = + CreateBackendFromSettings(system_, [this](u64 tid) { return fsc.GetBCATDirectory(tid); }); } IServiceCreator::~IServiceCreator() = default; diff --git a/src/core/hle/service/bcat/service_creator.h b/src/core/hle/service/bcat/service_creator.h index 02527574dc..2245007d6c 100644 --- a/src/core/hle/service/bcat/service_creator.h +++ b/src/core/hle/service/bcat/service_creator.h @@ -36,7 +36,6 @@ private: Result CreateDeliveryCacheStorageServiceWithApplicationId( u64 application_id, OutInterface out_interface); - std::optional FindRequest(u32 key) override; std::unique_ptr backend; Service::FileSystem::FileSystemController& fsc; }; diff --git a/src/core/hle/service/bpc/bpc.cpp b/src/core/hle/service/bpc/bpc.cpp index 7c31cd190d..6f2e00b22b 100644 --- a/src/core/hle/service/bpc/bpc.cpp +++ b/src/core/hle/service/bpc/bpc.cpp @@ -14,101 +14,103 @@ namespace Service::BPC { class BPC final : public ServiceFramework { public: - explicit BPC(Core::System& system_) : ServiceFramework{system_, "bpc"} {} + explicit BPC(Core::System& system_) : ServiceFramework{system_, "bpc"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "ShutdownSystem"}, + {1, nullptr, "RebootSystem"}, + {2, nullptr, "GetWakeupReason"}, + {3, nullptr, "GetShutdownReason"}, + {4, nullptr, "GetAcOk"}, + {5, nullptr, "GetBoardPowerControlEvent"}, + {6, nullptr, "GetSleepButtonState"}, + {7, nullptr, "GetPowerEvent"}, + {8, nullptr, "CreateWakeupTimer"}, + {9, nullptr, "CancelWakeupTimer"}, + {10, nullptr, "EnableWakeupTimerOnDevice"}, + {11, nullptr, "CreateWakeupTimerEx"}, + {12, nullptr, "GetLastEnabledWakeupTimerType"}, + {13, nullptr, "CleanAllWakeupTimers"}, + {14, nullptr, "GetPowerButton"}, + {15, nullptr, "SetEnableWakeupTimer"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "ShutdownSystem"}, - FunctionInfo{1, nullptr, "RebootSystem"}, - FunctionInfo{2, nullptr, "GetWakeupReason"}, - FunctionInfo{3, nullptr, "GetShutdownReason"}, - FunctionInfo{4, nullptr, "GetAcOk"}, - FunctionInfo{5, nullptr, "GetBoardPowerControlEvent"}, - FunctionInfo{6, nullptr, "GetSleepButtonState"}, - FunctionInfo{7, nullptr, "GetPowerEvent"}, - FunctionInfo{8, nullptr, "CreateWakeupTimer"}, - FunctionInfo{9, nullptr, "CancelWakeupTimer"}, - FunctionInfo{10, nullptr, "EnableWakeupTimerOnDevice"}, - FunctionInfo{11, nullptr, "CreateWakeupTimerEx"}, - FunctionInfo{12, nullptr, "GetLastEnabledWakeupTimerType"}, - FunctionInfo{13, nullptr, "CleanAllWakeupTimers"}, - FunctionInfo{14, nullptr, "GetPowerButton"}, - FunctionInfo{15, nullptr, "SetEnableWakeupTimer"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; class BPC_R final : public ServiceFramework { public: - explicit BPC_R(Core::System& system_) : ServiceFramework{system_, "bpc:r"} {} + explicit BPC_R(Core::System& system_) : ServiceFramework{system_, "bpc:r"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetRtcTime"}, + {1, nullptr, "SetRtcTime"}, + {2, nullptr, "GetRtcResetDetected"}, + {3, nullptr, "ClearRtcResetDetected"}, + {4, nullptr, "SetUpRtcResetOnShutdown"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetRtcTime"}, - FunctionInfo{1, nullptr, "SetRtcTime"}, - FunctionInfo{2, nullptr, "GetRtcResetDetected"}, - FunctionInfo{3, nullptr, "ClearRtcResetDetected"}, - FunctionInfo{4, nullptr, "SetUpRtcResetOnShutdown"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; class BPC_C final : public ServiceFramework { public: - explicit BPC_C(Core::System& system_) : ServiceFramework{system_, "bpc:c"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "ShutdownSystem"}, - FunctionInfo{1, nullptr, "RebootSystem"}, - FunctionInfo{2, nullptr, "GetWakeupReason"}, - FunctionInfo{3, nullptr, "GetShutdownReason"}, - FunctionInfo{4, nullptr, "GetAcOk"}, - FunctionInfo{5, nullptr, "GetPowerEvent"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit BPC_C(Core::System& system_) : ServiceFramework{system_, "bpc:c"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "ShutdownSystem"}, + {1, nullptr, "RebootSystem"}, + {2, nullptr, "GetWakeupReason"}, + {3, nullptr, "GetShutdownReason"}, + {4, nullptr, "GetAcOk"}, + {5, nullptr, "GetPowerEvent"}, + }; + // clang-format on + RegisterHandlers(functions); } }; class BPC_B final : public ServiceFramework { public: - explicit BPC_B(Core::System& system_) : ServiceFramework{system_, "bpc:b"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetSleepButtonState"}, - FunctionInfo{1, nullptr, "GetPowerButtonEvent"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit BPC_B(Core::System& system_) : ServiceFramework{system_, "bpc:b"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetSleepButtonState"}, + {1, nullptr, "GetPowerButtonEvent"}, + }; + // clang-format on + RegisterHandlers(functions); } }; class BPC_W final : public ServiceFramework { public: - explicit BPC_W(Core::System& system_) : ServiceFramework{system_, "bpc:w"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "CreateWakeupTimer"}, - FunctionInfo{1, nullptr, "CancelWakeupTimer"}, - FunctionInfo{2, nullptr, "EnableWakeupTimerOnDevice"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit BPC_W(Core::System& system_) : ServiceFramework{system_, "bpc:w"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "CreateWakeupTimer"}, + {1, nullptr, "CancelWakeupTimer"}, + {2, nullptr, "EnableWakeupTimerOnDevice"}, + }; + // clang-format on + RegisterHandlers(functions); } }; class BPC_AMS final : public ServiceFramework { public: - explicit BPC_AMS(Core::System& system_) : ServiceFramework{system_, "bpc:ams"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{65000, nullptr, "RebootToFatalError"}, - FunctionInfo{65001, nullptr, "SetRebootPayload"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit BPC_AMS(Core::System& system_) : ServiceFramework{system_, "bpc:ams"} { + // clang-format off + static const FunctionInfo functions[] = { + {65000, nullptr, "RebootToFatalError"}, + {65001, nullptr, "SetRebootPayload"}, + }; + // clang-format on + RegisterHandlers(functions); } }; diff --git a/src/core/hle/service/bpc/bpc.h b/src/core/hle/service/bpc/bpc.h index 524391ddb5..bf13ce5bae 100644 --- a/src/core/hle/service/bpc/bpc.h +++ b/src/core/hle/service/bpc/bpc.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/btdrv/btdrv.cpp b/src/core/hle/service/btdrv/btdrv.cpp index 913c9475e9..256a722a84 100644 --- a/src/core/hle/service/btdrv/btdrv.cpp +++ b/src/core/hle/service/btdrv/btdrv.cpp @@ -20,13 +20,24 @@ namespace Service::BtDrv { class IBluetoothUser final : public ServiceFramework { public: explicit IBluetoothUser(Core::System& system_) - : ServiceFramework{system_, "bt"} - , service_context{system_, "bt"} { - register_event = service_context.CreateEvent("BT:RegisterEvent"); - } + : ServiceFramework{system_, "bt"}, service_context{system_, "bt"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "LeClientReadCharacteristic"}, + {1, nullptr, "LeClientReadDescriptor"}, + {2, nullptr, "LeClientWriteCharacteristic"}, + {3, nullptr, "LeClientWriteDescriptor"}, + {4, nullptr, "LeClientRegisterNotification"}, + {5, nullptr, "LeClientDeregisterNotification"}, + {6, nullptr, "SetLeResponse"}, + {7, nullptr, "LeSendIndication"}, + {8, nullptr, "GetLeEventInfo"}, + {9, C<&IBluetoothUser::RegisterBleEvent>, "RegisterBleEvent"}, + }; + // clang-format on + RegisterHandlers(functions); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + register_event = service_context.CreateEvent("BT:RegisterEvent"); } ~IBluetoothUser() override { @@ -41,28 +52,151 @@ private: R_SUCCEED(); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "LeClientReadCharacteristic"}, - FunctionInfo{1, nullptr, "LeClientReadDescriptor"}, - FunctionInfo{2, nullptr, "LeClientWriteCharacteristic"}, - FunctionInfo{3, nullptr, "LeClientWriteDescriptor"}, - FunctionInfo{4, nullptr, "LeClientRegisterNotification"}, - FunctionInfo{5, nullptr, "LeClientDeregisterNotification"}, - FunctionInfo{6, nullptr, "SetLeResponse"}, - FunctionInfo{7, nullptr, "LeSendIndication"}, - FunctionInfo{8, nullptr, "GetLeEventInfo"}, - FunctionInfo{9, C<&IBluetoothUser::RegisterBleEvent>, "RegisterBleEvent"} - ); KernelHelpers::ServiceContext service_context; + Kernel::KEvent* register_event; }; class IBluetoothDriver final : public ServiceFramework { public: - explicit IBluetoothDriver(Core::System& system_) : ServiceFramework{system_, "btdrv"} {} + explicit IBluetoothDriver(Core::System& system_) : ServiceFramework{system_, "btdrv"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "InitializeBluetoothDriver"}, + {1, nullptr, "InitializeBluetooth"}, + {2, nullptr, "EnableBluetooth"}, + {3, nullptr, "DisableBluetooth"}, + {4, nullptr, "FinalizeBluetooth"}, + {5, nullptr, "GetAdapterProperties"}, + {6, nullptr, "GetAdapterProperty"}, + {7, nullptr, "SetAdapterProperty"}, + {8, nullptr, "StartInquiry"}, + {9, nullptr, "StopInquiry"}, + {10, nullptr, "CreateBond"}, + {11, nullptr, "RemoveBond"}, + {12, nullptr, "CancelBond"}, + {13, nullptr, "RespondToPinRequest"}, + {14, nullptr, "RespondToSspRequest"}, + {15, nullptr, "GetEventInfo"}, + {16, nullptr, "InitializeHid"}, + {17, nullptr, "OpenHidConnection"}, + {18, nullptr, "CloseHidConnection"}, + {19, nullptr, "WriteHidData"}, + {20, nullptr, "WriteHidData2"}, + {21, nullptr, "SetHidReport"}, + {22, nullptr, "GetHidReport"}, + {23, nullptr, "TriggerConnection"}, + {24, nullptr, "AddPairedDeviceInfo"}, + {25, nullptr, "GetPairedDeviceInfo"}, + {26, nullptr, "FinalizeHid"}, + {27, nullptr, "GetHidEventInfo"}, + {28, nullptr, "SetTsi"}, + {29, nullptr, "EnableBurstMode"}, + {30, nullptr, "SetZeroRetransmission"}, + {31, nullptr, "EnableMcMode"}, + {32, nullptr, "EnableLlrScan"}, + {33, nullptr, "DisableLlrScan"}, + {34, C<&IBluetoothDriver::EnableRadio>, "EnableRadio"}, + {35, nullptr, "SetVisibility"}, + {36, nullptr, "EnableTbfcScan"}, + {37, nullptr, "RegisterHidReportEvent"}, + {38, nullptr, "GetHidReportEventInfo"}, + {39, nullptr, "GetLatestPlr"}, + {40, nullptr, "GetPendingConnections"}, + {41, nullptr, "GetChannelMap"}, + {42, nullptr, "EnableTxPowerBoostSetting"}, + {43, nullptr, "IsTxPowerBoostSettingEnabled"}, + {44, nullptr, "EnableAfhSetting"}, + {45, nullptr, "IsAfhSettingEnabled"}, + {46, nullptr, "InitializeBle"}, + {47, nullptr, "EnableBle"}, + {48, nullptr, "DisableBle"}, + {49, nullptr, "FinalizeBle"}, + {50, nullptr, "SetBleVisibility"}, + {51, nullptr, "SetBleConnectionParameter"}, + {52, nullptr, "SetBleDefaultConnectionParameter"}, + {53, nullptr, "SetBleAdvertiseData"}, + {54, nullptr, "SetBleAdvertiseParameter"}, + {55, nullptr, "StartBleScan"}, + {56, nullptr, "StopBleScan"}, + {57, nullptr, "AddBleScanFilterCondition"}, + {58, nullptr, "DeleteBleScanFilterCondition"}, + {59, nullptr, "DeleteBleScanFilter"}, + {60, nullptr, "ClearBleScanFilters"}, + {61, nullptr, "EnableBleScanFilter"}, + {62, nullptr, "RegisterGattClient"}, + {63, nullptr, "UnregisterGattClient"}, + {64, nullptr, "UnregisterAllGattClients"}, + {65, nullptr, "ConnectGattServer"}, + {66, nullptr, "CancelConnectGattServer"}, + {67, nullptr, "DisconnectGattServer"}, + {68, nullptr, "GetGattAttribute"}, + {69, nullptr, "GetGattService"}, + {70, nullptr, "ConfigureAttMtu"}, + {71, nullptr, "RegisterGattServer"}, + {72, nullptr, "UnregisterGattServer"}, + {73, nullptr, "ConnectGattClient"}, + {74, nullptr, "DisconnectGattClient"}, + {75, nullptr, "AddGattService"}, + {76, nullptr, "EnableGattService"}, + {77, nullptr, "AddGattCharacteristic"}, + {78, nullptr, "AddGattDescriptor"}, + {79, nullptr, "GetBleManagedEventInfo"}, + {80, nullptr, "GetGattFirstCharacteristic"}, + {81, nullptr, "GetGattNextCharacteristic"}, + {82, nullptr, "GetGattFirstDescriptor"}, + {83, nullptr, "GetGattNextDescriptor"}, + {84, nullptr, "RegisterGattManagedDataPath"}, + {85, nullptr, "UnregisterGattManagedDataPath"}, + {86, nullptr, "RegisterGattHidDataPath"}, + {87, nullptr, "UnregisterGattHidDataPath"}, + {88, nullptr, "RegisterGattDataPath"}, + {89, nullptr, "UnregisterGattDataPath"}, + {90, nullptr, "ReadGattCharacteristic"}, + {91, nullptr, "ReadGattDescriptor"}, + {92, nullptr, "WriteGattCharacteristic"}, + {93, nullptr, "WriteGattDescriptor"}, + {94, nullptr, "RegisterGattNotification"}, + {95, nullptr, "UnregisterGattNotification"}, + {96, nullptr, "GetLeHidEventInfo"}, + {97, nullptr, "RegisterBleHidEvent"}, + {98, nullptr, "SetBleScanParameter"}, + {99, nullptr, "MoveToSecondaryPiconet"}, + {100, nullptr, "IsBluetoothEnabled"}, + {128, nullptr, "AcquireAudioEvent"}, + {129, nullptr, "GetAudioEventInfo"}, + {130, nullptr, "OpenAudioConnection"}, + {131, nullptr, "CloseAudioConnection"}, + {132, nullptr, "OpenAudioOut"}, + {133, nullptr, "CloseAudioOut"}, + {134, nullptr, "AcquireAudioOutStateChangedEvent"}, + {135, nullptr, "StartAudioOut"}, + {136, nullptr, "StopAudioOut"}, + {137, nullptr, "GetAudioOutState"}, + {138, nullptr, "GetAudioOutFeedingCodec"}, + {139, nullptr, "GetAudioOutFeedingParameter"}, + {140, nullptr, "AcquireAudioOutBufferAvailableEvent"}, + {141, nullptr, "SendAudioData"}, + {142, nullptr, "AcquireAudioControlInputStateChangedEvent"}, + {143, nullptr, "GetAudioControlInputState"}, + {144, nullptr, "AcquireAudioConnectionStateChangedEvent"}, + {145, nullptr, "GetConnectedAudioDevice"}, + {146, nullptr, "CloseAudioControlInput"}, + {147, nullptr, "RegisterAudioControlNotification"}, + {148, nullptr, "SendAudioControlPassthroughCommand"}, + {149, nullptr, "SendAudioControlSetAbsoluteVolumeCommand"}, + {150, nullptr, "AcquireAudioSinkVolumeLocallyChangedEvent"}, + {151, nullptr, "AcquireAudioSinkVolumeUpdateRequestCompletedEvent"}, + {152, nullptr, "GetAudioSinkVolume"}, + {153, nullptr, "RequestUpdateAudioSinkVolume"}, + {154, nullptr, "IsAudioSinkVolumeSupported"}, + {256, nullptr, "IsManufacturingMode"}, + {257, nullptr, "EmulateBluetoothCrash"}, + {258, nullptr, "GetBleChannelMap"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -70,140 +204,6 @@ private: LOG_WARNING(Service_BTDRV, "(STUBBED) called"); R_SUCCEED(); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "InitializeBluetoothDriver"}, - FunctionInfo{1, nullptr, "InitializeBluetooth"}, - FunctionInfo{2, nullptr, "EnableBluetooth"}, - FunctionInfo{3, nullptr, "DisableBluetooth"}, - FunctionInfo{4, nullptr, "FinalizeBluetooth"}, - FunctionInfo{5, nullptr, "GetAdapterProperties"}, - FunctionInfo{6, nullptr, "GetAdapterProperty"}, - FunctionInfo{7, nullptr, "SetAdapterProperty"}, - FunctionInfo{8, nullptr, "StartInquiry"}, - FunctionInfo{9, nullptr, "StopInquiry"}, - FunctionInfo{10, nullptr, "CreateBond"}, - FunctionInfo{11, nullptr, "RemoveBond"}, - FunctionInfo{12, nullptr, "CancelBond"}, - FunctionInfo{13, nullptr, "RespondToPinRequest"}, - FunctionInfo{14, nullptr, "RespondToSspRequest"}, - FunctionInfo{15, nullptr, "GetEventInfo"}, - FunctionInfo{16, nullptr, "InitializeHid"}, - FunctionInfo{17, nullptr, "OpenHidConnection"}, - FunctionInfo{18, nullptr, "CloseHidConnection"}, - FunctionInfo{19, nullptr, "WriteHidData"}, - FunctionInfo{20, nullptr, "WriteHidData2"}, - FunctionInfo{21, nullptr, "SetHidReport"}, - FunctionInfo{22, nullptr, "GetHidReport"}, - FunctionInfo{23, nullptr, "TriggerConnection"}, - FunctionInfo{24, nullptr, "AddPairedDeviceInfo"}, - FunctionInfo{25, nullptr, "GetPairedDeviceInfo"}, - FunctionInfo{26, nullptr, "FinalizeHid"}, - FunctionInfo{27, nullptr, "GetHidEventInfo"}, - FunctionInfo{28, nullptr, "SetTsi"}, - FunctionInfo{29, nullptr, "EnableBurstMode"}, - FunctionInfo{30, nullptr, "SetZeroRetransmission"}, - FunctionInfo{31, nullptr, "EnableMcMode"}, - FunctionInfo{32, nullptr, "EnableLlrScan"}, - FunctionInfo{33, nullptr, "DisableLlrScan"}, - FunctionInfo{34, C<&IBluetoothDriver::EnableRadio>, "EnableRadio"}, - FunctionInfo{35, nullptr, "SetVisibility"}, - FunctionInfo{36, nullptr, "EnableTbfcScan"}, - FunctionInfo{37, nullptr, "RegisterHidReportEvent"}, - FunctionInfo{38, nullptr, "GetHidReportEventInfo"}, - FunctionInfo{39, nullptr, "GetLatestPlr"}, - FunctionInfo{40, nullptr, "GetPendingConnections"}, - FunctionInfo{41, nullptr, "GetChannelMap"}, - FunctionInfo{42, nullptr, "EnableTxPowerBoostSetting"}, - FunctionInfo{43, nullptr, "IsTxPowerBoostSettingEnabled"}, - FunctionInfo{44, nullptr, "EnableAfhSetting"}, - FunctionInfo{45, nullptr, "IsAfhSettingEnabled"}, - FunctionInfo{46, nullptr, "InitializeBle"}, - FunctionInfo{47, nullptr, "EnableBle"}, - FunctionInfo{48, nullptr, "DisableBle"}, - FunctionInfo{49, nullptr, "FinalizeBle"}, - FunctionInfo{50, nullptr, "SetBleVisibility"}, - FunctionInfo{51, nullptr, "SetBleConnectionParameter"}, - FunctionInfo{52, nullptr, "SetBleDefaultConnectionParameter"}, - FunctionInfo{53, nullptr, "SetBleAdvertiseData"}, - FunctionInfo{54, nullptr, "SetBleAdvertiseParameter"}, - FunctionInfo{55, nullptr, "StartBleScan"}, - FunctionInfo{56, nullptr, "StopBleScan"}, - FunctionInfo{57, nullptr, "AddBleScanFilterCondition"}, - FunctionInfo{58, nullptr, "DeleteBleScanFilterCondition"}, - FunctionInfo{59, nullptr, "DeleteBleScanFilter"}, - FunctionInfo{60, nullptr, "ClearBleScanFilters"}, - FunctionInfo{61, nullptr, "EnableBleScanFilter"}, - FunctionInfo{62, nullptr, "RegisterGattClient"}, - FunctionInfo{63, nullptr, "UnregisterGattClient"}, - FunctionInfo{64, nullptr, "UnregisterAllGattClients"}, - FunctionInfo{65, nullptr, "ConnectGattServer"}, - FunctionInfo{66, nullptr, "CancelConnectGattServer"}, - FunctionInfo{67, nullptr, "DisconnectGattServer"}, - FunctionInfo{68, nullptr, "GetGattAttribute"}, - FunctionInfo{69, nullptr, "GetGattService"}, - FunctionInfo{70, nullptr, "ConfigureAttMtu"}, - FunctionInfo{71, nullptr, "RegisterGattServer"}, - FunctionInfo{72, nullptr, "UnregisterGattServer"}, - FunctionInfo{73, nullptr, "ConnectGattClient"}, - FunctionInfo{74, nullptr, "DisconnectGattClient"}, - FunctionInfo{75, nullptr, "AddGattService"}, - FunctionInfo{76, nullptr, "EnableGattService"}, - FunctionInfo{77, nullptr, "AddGattCharacteristic"}, - FunctionInfo{78, nullptr, "AddGattDescriptor"}, - FunctionInfo{79, nullptr, "GetBleManagedEventInfo"}, - FunctionInfo{80, nullptr, "GetGattFirstCharacteristic"}, - FunctionInfo{81, nullptr, "GetGattNextCharacteristic"}, - FunctionInfo{82, nullptr, "GetGattFirstDescriptor"}, - FunctionInfo{83, nullptr, "GetGattNextDescriptor"}, - FunctionInfo{84, nullptr, "RegisterGattManagedDataPath"}, - FunctionInfo{85, nullptr, "UnregisterGattManagedDataPath"}, - FunctionInfo{86, nullptr, "RegisterGattHidDataPath"}, - FunctionInfo{87, nullptr, "UnregisterGattHidDataPath"}, - FunctionInfo{88, nullptr, "RegisterGattDataPath"}, - FunctionInfo{89, nullptr, "UnregisterGattDataPath"}, - FunctionInfo{90, nullptr, "ReadGattCharacteristic"}, - FunctionInfo{91, nullptr, "ReadGattDescriptor"}, - FunctionInfo{92, nullptr, "WriteGattCharacteristic"}, - FunctionInfo{93, nullptr, "WriteGattDescriptor"}, - FunctionInfo{94, nullptr, "RegisterGattNotification"}, - FunctionInfo{95, nullptr, "UnregisterGattNotification"}, - FunctionInfo{96, nullptr, "GetLeHidEventInfo"}, - FunctionInfo{97, nullptr, "RegisterBleHidEvent"}, - FunctionInfo{98, nullptr, "SetBleScanParameter"}, - FunctionInfo{99, nullptr, "MoveToSecondaryPiconet"}, - FunctionInfo{100, nullptr, "IsBluetoothEnabled"}, - FunctionInfo{128, nullptr, "AcquireAudioEvent"}, - FunctionInfo{129, nullptr, "GetAudioEventInfo"}, - FunctionInfo{130, nullptr, "OpenAudioConnection"}, - FunctionInfo{131, nullptr, "CloseAudioConnection"}, - FunctionInfo{132, nullptr, "OpenAudioOut"}, - FunctionInfo{133, nullptr, "CloseAudioOut"}, - FunctionInfo{134, nullptr, "AcquireAudioOutStateChangedEvent"}, - FunctionInfo{135, nullptr, "StartAudioOut"}, - FunctionInfo{136, nullptr, "StopAudioOut"}, - FunctionInfo{137, nullptr, "GetAudioOutState"}, - FunctionInfo{138, nullptr, "GetAudioOutFeedingCodec"}, - FunctionInfo{139, nullptr, "GetAudioOutFeedingParameter"}, - FunctionInfo{140, nullptr, "AcquireAudioOutBufferAvailableEvent"}, - FunctionInfo{141, nullptr, "SendAudioData"}, - FunctionInfo{142, nullptr, "AcquireAudioControlInputStateChangedEvent"}, - FunctionInfo{143, nullptr, "GetAudioControlInputState"}, - FunctionInfo{144, nullptr, "AcquireAudioConnectionStateChangedEvent"}, - FunctionInfo{145, nullptr, "GetConnectedAudioDevice"}, - FunctionInfo{146, nullptr, "CloseAudioControlInput"}, - FunctionInfo{147, nullptr, "RegisterAudioControlNotification"}, - FunctionInfo{148, nullptr, "SendAudioControlPassthroughCommand"}, - FunctionInfo{149, nullptr, "SendAudioControlSetAbsoluteVolumeCommand"}, - FunctionInfo{150, nullptr, "AcquireAudioSinkVolumeLocallyChangedEvent"}, - FunctionInfo{151, nullptr, "AcquireAudioSinkVolumeUpdateRequestCompletedEvent"}, - FunctionInfo{152, nullptr, "GetAudioSinkVolume"}, - FunctionInfo{153, nullptr, "RequestUpdateAudioSinkVolume"}, - FunctionInfo{154, nullptr, "IsAudioSinkVolumeSupported"}, - FunctionInfo{256, nullptr, "IsManufacturingMode"}, - FunctionInfo{257, nullptr, "EmulateBluetoothCrash"}, - FunctionInfo{258, nullptr, "GetBleChannelMap"} - ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/btdrv/btdrv.h b/src/core/hle/service/btdrv/btdrv.h index 42713860e6..4e739a96e3 100644 --- a/src/core/hle/service/btdrv/btdrv.h +++ b/src/core/hle/service/btdrv/btdrv.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/btm/btm.cpp b/src/core/hle/service/btm/btm.cpp index e8fa29af7c..b358387ffe 100644 --- a/src/core/hle/service/btm/btm.cpp +++ b/src/core/hle/service/btm/btm.cpp @@ -6,414 +6,111 @@ #include -#include "common/logging.h" -#include "core/hle/service/cmif_serialization.h" -#include "core/hle/service/set/system_settings_server.h" -#include "core/hle/service/sm/sm.h" #include "core/hle/service/btm/btm.h" +#include "core/hle/service/btm/btm_debug.h" +#include "core/hle/service/btm/btm_system.h" +#include "core/hle/service/btm/btm_user.h" #include "core/hle/service/server_manager.h" #include "core/hle/service/service.h" -namespace Kernel { -class KEvent; -class KReadableEvent; -} // namespace Kernel - -namespace Core { -class System; -} - -namespace Service::Set { -class ISystemSettingsServer; -} - namespace Service::BTM { -class IBtmSystemCore final : public ServiceFramework { -public: - explicit IBtmSystemCore(Core::System& system_) - : ServiceFramework{system_, "IBtmSystemCore"}, service_context{system_, "IBtmSystemCore"} { - radio_event = service_context.CreateEvent("IBtmSystemCore:RadioEvent"); - audio_device_connection_event = service_context.CreateEvent("IBtmSystemCore:AudioDeviceConnectionEvent"); - m_set_sys = system.ServiceManager().GetService("set:sys", true); - } - - ~IBtmSystemCore() override { - service_context.CloseEvent(radio_event); - service_context.CloseEvent(audio_device_connection_event); - } - - Result StartGamepadPairing() { - LOG_WARNING(Service_BTM, "(STUBBED) called"); - R_SUCCEED(); - } - - Result CancelGamepadPairing() { - LOG_WARNING(Service_BTM, "(STUBBED) called"); - R_SUCCEED(); - } - - Result EnableRadio() { - LOG_DEBUG(Service_BTM, "called"); - - R_RETURN(m_set_sys->SetBluetoothEnableFlag(true)); - } - Result DisableRadio() { - LOG_DEBUG(Service_BTM, "called"); - - R_RETURN(m_set_sys->SetBluetoothEnableFlag(false)); - } - - Result IsRadioEnabled(Out out_is_enabled) { - LOG_DEBUG(Service_BTM, "called"); - - R_RETURN(m_set_sys->GetBluetoothEnableFlag(out_is_enabled)); - } - - Result AcquireRadioEvent(Out out_is_valid, - OutCopyHandle out_event) { - LOG_WARNING(Service_BTM, "(STUBBED) called"); - - *out_is_valid = true; - *out_event = &radio_event->GetReadableEvent(); - R_SUCCEED(); - } - - Result GetDiscoveredAudioDevice(OutArray, BufferAttr_HipcPointer> out_audio_devices, s32 count, Out out_total) { - LOG_WARNING(Service_BTM, "(STUBBED) called"); - R_SUCCEED(); - } - - Result AcquireAudioDeviceConnectionEvent( - OutCopyHandle out_event) { - LOG_WARNING(Service_BTM, "(STUBBED) called"); - - *out_event = &audio_device_connection_event->GetReadableEvent(); - R_SUCCEED(); - } - - Result GetConnectedAudioDevices( - Out out_count, OutArray, BufferAttr_HipcPointer> out_audio_devices) { - LOG_WARNING(Service_BTM, "(STUBBED) called"); - - *out_count = 0; - R_SUCCEED(); - } - - Result GetPairedAudioDevices( - Out out_count, OutArray, BufferAttr_HipcPointer> out_audio_devices) { - LOG_WARNING(Service_BTM, "(STUBBED) called"); - - *out_count = 0; - R_SUCCEED(); - } - - Result RequestAudioDeviceConnectionRejection(ClientAppletResourceUserId aruid) { - LOG_WARNING(Service_BTM, "(STUBBED) called, applet_resource_user_id={}", aruid.pid); - R_SUCCEED(); - } - - Result CancelAudioDeviceConnectionRejection(ClientAppletResourceUserId aruid) { - LOG_WARNING(Service_BTM, "(STUBBED) called, applet_resource_user_id={}", aruid.pid); - R_SUCCEED(); - } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&IBtmSystemCore::StartGamepadPairing>, "StartGamepadPairing"}, - FunctionInfo{1, C<&IBtmSystemCore::CancelGamepadPairing>, "CancelGamepadPairing"}, - FunctionInfo{2, nullptr, "ClearGamepadPairingDatabase"}, - FunctionInfo{3, nullptr, "GetPairedGamepadCount"}, - FunctionInfo{4, C<&IBtmSystemCore::EnableRadio>, "EnableRadio"}, - FunctionInfo{5, C<&IBtmSystemCore::DisableRadio>, "DisableRadio"}, - FunctionInfo{6, C<&IBtmSystemCore::IsRadioEnabled>, "IsRadioEnabled"}, - FunctionInfo{7, C<&IBtmSystemCore::AcquireRadioEvent>, "AcquireRadioEvent"}, - FunctionInfo{8, nullptr, "AcquireGamepadPairingEvent"}, - FunctionInfo{9, nullptr, "IsGamepadPairingStarted"}, - FunctionInfo{10, nullptr, "StartAudioDeviceDiscovery"}, - FunctionInfo{11, nullptr, "StopAudioDeviceDiscovery"}, - FunctionInfo{12, nullptr, "IsDiscoveryingAudioDevice"}, - FunctionInfo{13, C<&IBtmSystemCore::GetDiscoveredAudioDevice>, "GetDiscoveredAudioDevice"}, - FunctionInfo{14, C<&IBtmSystemCore::AcquireAudioDeviceConnectionEvent>, "AcquireAudioDeviceConnectionEvent"}, - FunctionInfo{15, nullptr, "ConnectAudioDevice"}, - FunctionInfo{16, nullptr, "IsConnectingAudioDevice"}, - FunctionInfo{17, C<&IBtmSystemCore::GetConnectedAudioDevices>, "GetConnectedAudioDevices"}, - FunctionInfo{18, nullptr, "DisconnectAudioDevice"}, - FunctionInfo{19, nullptr, "AcquirePairedAudioDeviceInfoChangedEvent"}, - FunctionInfo{20, C<&IBtmSystemCore::GetPairedAudioDevices>, "GetPairedAudioDevices"}, - FunctionInfo{21, nullptr, "RemoveAudioDevicePairing"}, - FunctionInfo{22, C<&IBtmSystemCore::RequestAudioDeviceConnectionRejection>, "RequestAudioDeviceConnectionRejection"}, - FunctionInfo{23, C<&IBtmSystemCore::CancelAudioDeviceConnectionRejection>, "CancelAudioDeviceConnectionRejection"} - ); - KernelHelpers::ServiceContext service_context; - Kernel::KEvent* radio_event; - Kernel::KEvent* audio_device_connection_event; - std::shared_ptr m_set_sys; -}; - -class IBtmSystem final : public ServiceFramework { -public: - explicit IBtmSystem(Core::System& system_) : ServiceFramework{system_, "btm:sys"} {} - ~IBtmSystem() override = default; - - Result GetCore(OutInterface out_interface) { - LOG_WARNING(Service_BTM, "called"); - - *out_interface = std::make_shared(system); - R_SUCCEED(); - } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&IBtmSystem::GetCore>, "GetCore"} - ); -}; - -class IBtmUserCore final : public ServiceFramework { -public: - explicit IBtmUserCore(Core::System& system_) - : ServiceFramework{system_, "IBtmUserCore"}, service_context{system_, "IBtmUserCore"} { - scan_event = service_context.CreateEvent("IBtmUserCore:ScanEvent"); - connection_event = service_context.CreateEvent("IBtmUserCore:ConnectionEvent"); - service_discovery_event = service_context.CreateEvent("IBtmUserCore:DiscoveryEvent"); - config_event = service_context.CreateEvent("IBtmUserCore:ConfigEvent"); - } - - ~IBtmUserCore() override { - service_context.CloseEvent(scan_event); - service_context.CloseEvent(connection_event); - service_context.CloseEvent(service_discovery_event); - service_context.CloseEvent(config_event); - } - - Result AcquireBleScanEvent(Out out_is_valid, - OutCopyHandle out_event) { - LOG_WARNING(Service_BTM, "(STUBBED) called"); - - *out_is_valid = true; - *out_event = &scan_event->GetReadableEvent(); - R_SUCCEED(); - } - - Result AcquireBleConnectionEvent(Out out_is_valid, - OutCopyHandle out_event) { - LOG_WARNING(Service_BTM, "(STUBBED) called"); - - *out_is_valid = true; - *out_event = &connection_event->GetReadableEvent(); - R_SUCCEED(); - } - - Result AcquireBleServiceDiscoveryEvent( - Out out_is_valid, OutCopyHandle out_event) { - LOG_WARNING(Service_BTM, "(STUBBED) called"); - - *out_is_valid = true; - *out_event = &service_discovery_event->GetReadableEvent(); - R_SUCCEED(); - } - - Result AcquireBleMtuConfigEvent(Out out_is_valid, - OutCopyHandle out_event) { - LOG_WARNING(Service_BTM, "(STUBBED) called"); - - *out_is_valid = true; - *out_event = &config_event->GetReadableEvent(); - R_SUCCEED(); - } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&IBtmUserCore::AcquireBleScanEvent>, "AcquireBleScanEvent"}, - FunctionInfo{1, nullptr, "GetBleScanFilterParameter"}, - FunctionInfo{2, nullptr, "GetBleScanFilterParameter2"}, - FunctionInfo{3, nullptr, "StartBleScanForGeneral"}, - FunctionInfo{4, nullptr, "StopBleScanForGeneral"}, - FunctionInfo{5, nullptr, "GetBleScanResultsForGeneral"}, - FunctionInfo{6, nullptr, "StartBleScanForPaired"}, - FunctionInfo{7, nullptr, "StopBleScanForPaired"}, - FunctionInfo{8, nullptr, "StartBleScanForSmartDevice"}, - FunctionInfo{9, nullptr, "StopBleScanForSmartDevice"}, - FunctionInfo{10, nullptr, "GetBleScanResultsForSmartDevice"}, - FunctionInfo{17, C<&IBtmUserCore::AcquireBleConnectionEvent>, "AcquireBleConnectionEvent"}, - FunctionInfo{18, nullptr, "BleConnect"}, - FunctionInfo{19, nullptr, "BleDisconnect"}, - FunctionInfo{20, nullptr, "BleGetConnectionState"}, - FunctionInfo{21, nullptr, "AcquireBlePairingEvent"}, - FunctionInfo{22, nullptr, "BlePairDevice"}, - FunctionInfo{23, nullptr, "BleUnPairDevice"}, - FunctionInfo{24, nullptr, "BleUnPairDevice2"}, - FunctionInfo{25, nullptr, "BleGetPairedDevices"}, - FunctionInfo{26, C<&IBtmUserCore::AcquireBleServiceDiscoveryEvent>, "AcquireBleServiceDiscoveryEvent"}, - FunctionInfo{27, nullptr, "GetGattServices"}, - FunctionInfo{28, nullptr, "GetGattService"}, - FunctionInfo{29, nullptr, "GetGattIncludedServices"}, - FunctionInfo{30, nullptr, "GetBelongingGattService"}, - FunctionInfo{31, nullptr, "GetGattCharacteristics"}, - FunctionInfo{32, nullptr, "GetGattDescriptors"}, - FunctionInfo{33, C<&IBtmUserCore::AcquireBleMtuConfigEvent>, "AcquireBleMtuConfigEvent"}, - FunctionInfo{34, nullptr, "ConfigureBleMtu"}, - FunctionInfo{35, nullptr, "GetBleMtu"}, - FunctionInfo{36, nullptr, "RegisterBleGattDataPath"}, - FunctionInfo{37, nullptr, "UnregisterBleGattDataPath"} - ); - KernelHelpers::ServiceContext service_context; - Kernel::KEvent* scan_event; - Kernel::KEvent* connection_event; - Kernel::KEvent* service_discovery_event; - Kernel::KEvent* config_event; -}; - -class IBtmUser final : public ServiceFramework { -public: - explicit IBtmUser(Core::System& system_) : ServiceFramework{system_, "btm:u"} {} - ~IBtmUser() override = default; - - Result GetCore(OutInterface out_interface) { - LOG_WARNING(Service_BTM, "called"); - - *out_interface = std::make_shared(system); - R_SUCCEED(); - } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&IBtmUser::GetCore>, "GetCore"} - ); -}; - -class IBtmDebug final : public ServiceFramework { -public: - explicit IBtmDebug(Core::System& system_) : ServiceFramework{system_, "btm:dbg"} {} - ~IBtmDebug() override = default; - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "AcquireDiscoveryEvent"}, - FunctionInfo{1, nullptr, "StartDiscovery"}, - FunctionInfo{2, nullptr, "CancelDiscovery"}, - FunctionInfo{3, nullptr, "GetDeviceProperty"}, - FunctionInfo{4, nullptr, "CreateBond"}, - FunctionInfo{5, nullptr, "CancelBond"}, - FunctionInfo{6, nullptr, "SetTsiMode"}, - FunctionInfo{7, nullptr, "GeneralTest"}, - FunctionInfo{8, nullptr, "HidConnect"}, - FunctionInfo{9, nullptr, "GeneralGet", MakeVersionGate({5,0,0})}, - FunctionInfo{10, nullptr, "GetGattClientDisconnectionReason", MakeVersionGate({5,0,0})}, - FunctionInfo{11, nullptr, "GetBleConnectionParameter", MakeVersionGate({5,1,0})}, - FunctionInfo{12, nullptr, "GetBleConnectionParameterRequest", MakeVersionGate({5,1,0})}, - FunctionInfo{13, nullptr, "GetDiscoveredDevice", MakeVersionGate({12,0,0})}, - FunctionInfo{14, nullptr, "SleepAwakeLoopTest", MakeVersionGate({15,0,0})}, - FunctionInfo{15, nullptr, "SleepTest", MakeVersionGate({15,0,0})}, - FunctionInfo{16, nullptr, "MinimumAwakeTest", MakeVersionGate({15,0,0})}, - FunctionInfo{17, nullptr, "ForceEnableBtm", MakeVersionGate({15,0,0})} - ); -}; - class IBtm final : public ServiceFramework { public: - explicit IBtm(Core::System& system_) : ServiceFramework{system_, "btm"} {} + explicit IBtm(Core::System& system_) : ServiceFramework{system_, "btm"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetState"}, + {1, nullptr, "GetHostDeviceProperty"}, + {2, nullptr, "AcquireDeviceConditionEvent"}, + {3, nullptr, "GetDeviceCondition"}, + {4, nullptr, "SetBurstMode"}, + {5, nullptr, "SetSlotMode"}, + {6, nullptr, "SetBluetoothMode"}, + {7, nullptr, "SetWlanMode"}, + {8, nullptr, "AcquireDeviceInfoEvent"}, + {9, nullptr, "GetDeviceInfo"}, + {10, nullptr, "AddDeviceInfo"}, + {11, nullptr, "RemoveDeviceInfo"}, + {12, nullptr, "IncreaseDeviceInfoOrder"}, + {13, nullptr, "LlrNotify"}, + {14, nullptr, "EnableRadio"}, + {15, nullptr, "DisableRadio"}, + {16, nullptr, "HidDisconnect"}, + {17, nullptr, "HidSetRetransmissionMode"}, + {18, nullptr, "AcquireAwakeReqEvent"}, + {19, nullptr, "AcquireLlrStateEvent"}, + {20, nullptr, "IsLlrStarted"}, + {21, nullptr, "EnableSlotSaving"}, + {22, nullptr, "ProtectDeviceInfo"}, + {23, nullptr, "AcquireBleScanEvent"}, + {24, nullptr, "GetBleScanParameterGeneral"}, + {25, nullptr, "GetBleScanParameterSmartDevice"}, + {26, nullptr, "StartBleScanForGeneral"}, + {27, nullptr, "StopBleScanForGeneral"}, + {28, nullptr, "GetBleScanResultsForGeneral"}, + {29, nullptr, "StartBleScanForPairedDevice"}, + {30, nullptr, "StopBleScanForPairedDevice"}, + {31, nullptr, "StartBleScanForSmartDevice"}, + {32, nullptr, "StopBleScanForSmartDevice"}, + {33, nullptr, "GetBleScanResultsForSmartDevice"}, + {34, nullptr, "AcquireBleConnectionEvent"}, + {35, nullptr, "BleConnect"}, + {36, nullptr, "BleOverrideConnection"}, + {37, nullptr, "BleDisconnect"}, + {38, nullptr, "BleGetConnectionState"}, + {39, nullptr, "BleGetGattClientConditionList"}, + {40, nullptr, "AcquireBlePairingEvent"}, + {41, nullptr, "BlePairDevice"}, + {42, nullptr, "BleUnpairDeviceOnBoth"}, + {43, nullptr, "BleUnpairDevice"}, + {44, nullptr, "BleGetPairedAddresses"}, + {45, nullptr, "AcquireBleServiceDiscoveryEvent"}, + {46, nullptr, "GetGattServices"}, + {47, nullptr, "GetGattService"}, + {48, nullptr, "GetGattIncludedServices"}, + {49, nullptr, "GetBelongingService"}, + {50, nullptr, "GetGattCharacteristics"}, + {51, nullptr, "GetGattDescriptors"}, + {52, nullptr, "AcquireBleMtuConfigEvent"}, + {53, nullptr, "ConfigureBleMtu"}, + {54, nullptr, "GetBleMtu"}, + {55, nullptr, "RegisterBleGattDataPath"}, + {56, nullptr, "UnregisterBleGattDataPath"}, + {57, nullptr, "RegisterAppletResourceUserId"}, + {58, nullptr, "UnregisterAppletResourceUserId"}, + {59, nullptr, "SetAppletResourceUserId"}, + {60, nullptr, "AcquireBleConnectionParameterUpdateEvent"}, //8.0.0+ + {61, nullptr, "SetCeLength"}, //8.0.0+ + {62, nullptr, "EnsureSlotExpansion"}, //9.0.0+ + {63, nullptr, "IsSlotExpansionEnsured"}, //9.0.0+ + {64, nullptr, "CancelConnectionTrigger"}, //10.0.0+ + {65, nullptr, "GetConnectionCapacity"}, //13.0.0+ + {66, nullptr, "GetWlanMode"}, //13.0.0+ + {67, nullptr, "IsSlotSavingEnabled"}, //13.0.0+ + {68, nullptr, "IsSlotSavingForPairingEnabled"}, //13.0.0+ + {69, nullptr, "AcquireAudioDeviceConnectionEvent"}, //13.0.0+ + {70, nullptr, "GetConnectedAudioDevices"}, //13.0.0+ + {71, nullptr, "SetAudioSourceVolume"}, //13.0.0+ + {72, nullptr, "GetAudioSourceVolume"}, //13.0.0+ + {73, nullptr, "RequestAudioDeviceConnectionRejection"}, //13.0.0+ + {74, nullptr, "CancelAudioDeviceConnectionRejection"}, //13.0.0+ + {75, nullptr, "GetPairedAudioDevices"}, //13.0.0+ + {76, nullptr, "SetWlanModeWithOption"}, //13.1.0+ + {100, nullptr, "AcquireConnectionDisallowedEvent"}, //13.0.0+ + {101, nullptr, "GetUsecaseViolationFactor"}, //13.0.0+ + {110, nullptr, "GetShortenedDeviceInfo"}, //13.0.0+ + {111, nullptr, "AcquirePairingCountUpdateEvent"},//13.0.0+ + {112, nullptr, "Unknown112"}, //14.0.0-14.1.2 + {113, nullptr, "Unknown113"}, //14.0.0-14.1.2 + {114, nullptr, "IsFirstAudioControlConnection"}, //14.0.0+ + {115, nullptr, "GetShortenedDeviceCondition"}, //14.0.0+ + {116, nullptr, "SetAudioSinkVolume"}, //15.0.0+ + {117, nullptr, "GetAudioSinkVolume"}, //15.0.0+ + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetState"}, - FunctionInfo{1, nullptr, "GetHostDeviceProperty"}, - FunctionInfo{2, nullptr, "AcquireDeviceConditionEvent"}, - FunctionInfo{3, nullptr, "GetDeviceCondition"}, - FunctionInfo{4, nullptr, "SetBurstMode"}, - FunctionInfo{5, nullptr, "SetSlotMode"}, - FunctionInfo{6, nullptr, "SetBluetoothMode"}, - FunctionInfo{7, nullptr, "SetWlanMode"}, - FunctionInfo{8, nullptr, "AcquireDeviceInfoEvent"}, - FunctionInfo{9, nullptr, "GetDeviceInfo"}, - FunctionInfo{10, nullptr, "AddDeviceInfo"}, - FunctionInfo{11, nullptr, "RemoveDeviceInfo"}, - FunctionInfo{12, nullptr, "IncreaseDeviceInfoOrder"}, - FunctionInfo{13, nullptr, "LlrNotify"}, - FunctionInfo{14, nullptr, "EnableRadio"}, - FunctionInfo{15, nullptr, "DisableRadio"}, - FunctionInfo{16, nullptr, "HidDisconnect"}, - FunctionInfo{17, nullptr, "HidSetRetransmissionMode"}, - FunctionInfo{18, nullptr, "AcquireAwakeReqEvent"}, - FunctionInfo{19, nullptr, "AcquireLlrStateEvent"}, - FunctionInfo{20, nullptr, "IsLlrStarted"}, - FunctionInfo{21, nullptr, "EnableSlotSaving"}, - FunctionInfo{22, nullptr, "ProtectDeviceInfo"}, - FunctionInfo{23, nullptr, "AcquireBleScanEvent"}, - FunctionInfo{24, nullptr, "GetBleScanParameterGeneral"}, - FunctionInfo{25, nullptr, "GetBleScanParameterSmartDevice"}, - FunctionInfo{26, nullptr, "StartBleScanForGeneral"}, - FunctionInfo{27, nullptr, "StopBleScanForGeneral"}, - FunctionInfo{28, nullptr, "GetBleScanResultsForGeneral"}, - FunctionInfo{29, nullptr, "StartBleScanForPairedDevice"}, - FunctionInfo{30, nullptr, "StopBleScanForPairedDevice"}, - FunctionInfo{31, nullptr, "StartBleScanForSmartDevice"}, - FunctionInfo{32, nullptr, "StopBleScanForSmartDevice"}, - FunctionInfo{33, nullptr, "GetBleScanResultsForSmartDevice"}, - FunctionInfo{34, nullptr, "AcquireBleConnectionEvent"}, - FunctionInfo{35, nullptr, "BleConnect"}, - FunctionInfo{36, nullptr, "BleOverrideConnection"}, - FunctionInfo{37, nullptr, "BleDisconnect"}, - FunctionInfo{38, nullptr, "BleGetConnectionState"}, - FunctionInfo{39, nullptr, "BleGetGattClientConditionList"}, - FunctionInfo{40, nullptr, "AcquireBlePairingEvent"}, - FunctionInfo{41, nullptr, "BlePairDevice"}, - FunctionInfo{42, nullptr, "BleUnpairDeviceOnBoth"}, - FunctionInfo{43, nullptr, "BleUnpairDevice"}, - FunctionInfo{44, nullptr, "BleGetPairedAddresses"}, - FunctionInfo{45, nullptr, "AcquireBleServiceDiscoveryEvent"}, - FunctionInfo{46, nullptr, "GetGattServices"}, - FunctionInfo{47, nullptr, "GetGattService"}, - FunctionInfo{48, nullptr, "GetGattIncludedServices"}, - FunctionInfo{49, nullptr, "GetBelongingService"}, - FunctionInfo{50, nullptr, "GetGattCharacteristics"}, - FunctionInfo{51, nullptr, "GetGattDescriptors"}, - FunctionInfo{52, nullptr, "AcquireBleMtuConfigEvent"}, - FunctionInfo{53, nullptr, "ConfigureBleMtu"}, - FunctionInfo{54, nullptr, "GetBleMtu"}, - FunctionInfo{55, nullptr, "RegisterBleGattDataPath"}, - FunctionInfo{56, nullptr, "UnregisterBleGattDataPath"}, - FunctionInfo{57, nullptr, "RegisterAppletResourceUserId"}, - FunctionInfo{58, nullptr, "UnregisterAppletResourceUserId"}, - FunctionInfo{59, nullptr, "SetAppletResourceUserId"}, - FunctionInfo{60, nullptr, "AcquireBleConnectionParameterUpdateEvent", MakeVersionGate({8,0,0})}, - FunctionInfo{61, nullptr, "SetCeLength", MakeVersionGate({8,0,0})}, - FunctionInfo{62, nullptr, "EnsureSlotExpansion", MakeVersionGate({9,0,0})}, - FunctionInfo{63, nullptr, "IsSlotExpansionEnsured", MakeVersionGate({9,0,0})}, - FunctionInfo{64, nullptr, "CancelConnectionTrigger", MakeVersionGate({10,0,0})}, - FunctionInfo{65, nullptr, "GetConnectionCapacity", MakeVersionGate({13,0,0})}, - FunctionInfo{66, nullptr, "GetWlanMode", MakeVersionGate({13,0,0})}, - FunctionInfo{67, nullptr, "IsSlotSavingEnabled", MakeVersionGate({13,0,0})}, - FunctionInfo{68, nullptr, "IsSlotSavingForPairingEnabled", MakeVersionGate({13,0,0})}, - FunctionInfo{69, nullptr, "AcquireAudioDeviceConnectionEvent", MakeVersionGate({13,0,0})}, - FunctionInfo{70, nullptr, "GetConnectedAudioDevices", MakeVersionGate({13,0,0})}, - FunctionInfo{71, nullptr, "SetAudioSourceVolume", MakeVersionGate({13,0,0})}, - FunctionInfo{72, nullptr, "GetAudioSourceVolume", MakeVersionGate({13,0,0})}, - FunctionInfo{73, nullptr, "RequestAudioDeviceConnectionRejection", MakeVersionGate({13,0,0})}, - FunctionInfo{74, nullptr, "CancelAudioDeviceConnectionRejection", MakeVersionGate({13,0,0})}, - FunctionInfo{75, nullptr, "GetPairedAudioDevices", MakeVersionGate({13,0,0})}, - FunctionInfo{76, nullptr, "SetWlanModeWithOption", MakeVersionGate({13,1,0})}, - FunctionInfo{100, nullptr, "AcquireConnectionDisallowedEvent", MakeVersionGate({13,0,0})}, - FunctionInfo{101, nullptr, "GetUsecaseViolationFactor", MakeVersionGate({13,0,0})}, - FunctionInfo{110, nullptr, "GetShortenedDeviceInfo", MakeVersionGate({13,0,0})}, - FunctionInfo{111, nullptr, "AcquirePairingCountUpdateEvent"},//13.0.0+ - FunctionInfo{112, nullptr, "Unknown112", MakeVersionGate({14,0,0}, {14,1,2})}, - FunctionInfo{113, nullptr, "Unknown113", MakeVersionGate({14,0,0}, {14,1,2})}, - FunctionInfo{114, nullptr, "IsFirstAudioControlConnection", MakeVersionGate({14,0,0})}, - FunctionInfo{115, nullptr, "GetShortenedDeviceCondition", MakeVersionGate({14,0,0})}, - FunctionInfo{116, nullptr, "SetAudioSinkVolume", MakeVersionGate({15,0,0})}, - FunctionInfo{117, nullptr, "GetAudioSinkVolume", MakeVersionGate({15,0,0})} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; diff --git a/src/core/hle/service/btm/btm.h b/src/core/hle/service/btm/btm.h index 0bf77d053e..902a61d8cc 100644 --- a/src/core/hle/service/btm/btm.h +++ b/src/core/hle/service/btm/btm.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/btm/btm_debug.cpp b/src/core/hle/service/btm/btm_debug.cpp new file mode 100644 index 0000000000..abbe7d4832 --- /dev/null +++ b/src/core/hle/service/btm/btm_debug.cpp @@ -0,0 +1,40 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "core/hle/service/btm/btm_debug.h" + +namespace Service::BTM { + +IBtmDebug::IBtmDebug(Core::System& system_) : ServiceFramework{system_, "btm:dbg"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "AcquireDiscoveryEvent"}, + {1, nullptr, "StartDiscovery"}, + {2, nullptr, "CancelDiscovery"}, + {3, nullptr, "GetDeviceProperty"}, + {4, nullptr, "CreateBond"}, + {5, nullptr, "CancelBond"}, + {6, nullptr, "SetTsiMode"}, + {7, nullptr, "GeneralTest"}, + {8, nullptr, "HidConnect"}, + {9, nullptr, "GeneralGet"}, //5.0.0+ + {10, nullptr, "GetGattClientDisconnectionReason"}, //5.0.0+ + {11, nullptr, "GetBleConnectionParameter"}, //5.1.0+ + {12, nullptr, "GetBleConnectionParameterRequest"}, //5.1.0+ + {13, nullptr, "GetDiscoveredDevice"}, //12.0.0+ + {14, nullptr, "SleepAwakeLoopTest"}, //15.0.0+ + {15, nullptr, "SleepTest"}, //15.0.0+ + {16, nullptr, "MinimumAwakeTest"}, //15.0.0+ + {17, nullptr, "ForceEnableBtm"}, //15.0.0+ + }; + // clang-format on + + RegisterHandlers(functions); +} + +IBtmDebug::~IBtmDebug() = default; + +} // namespace Service::BTM diff --git a/src/core/hle/service/btm/btm_debug.h b/src/core/hle/service/btm/btm_debug.h new file mode 100644 index 0000000000..fad760d674 --- /dev/null +++ b/src/core/hle/service/btm/btm_debug.h @@ -0,0 +1,24 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/service.h" + +namespace Core { +class System; +} + +namespace Service::BTM { + +class IBtmDebug final : public ServiceFramework { +public: + explicit IBtmDebug(Core::System& system_); + ~IBtmDebug() override; +}; + +} // namespace Service::BTM diff --git a/src/core/hle/service/btm/btm_system.cpp b/src/core/hle/service/btm/btm_system.cpp new file mode 100644 index 0000000000..1684b0193e --- /dev/null +++ b/src/core/hle/service/btm/btm_system.cpp @@ -0,0 +1,34 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "common/logging.h" +#include "core/hle/service/btm/btm_system.h" +#include "core/hle/service/btm/btm_system_core.h" +#include "core/hle/service/cmif_serialization.h" +#include "core/hle/service/service.h" + +namespace Service::BTM { + +IBtmSystem::IBtmSystem(Core::System& system_) : ServiceFramework{system_, "btm:sys"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, C<&IBtmSystem::GetCore>, "GetCore"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +IBtmSystem::~IBtmSystem() = default; + +Result IBtmSystem::GetCore(OutInterface out_interface) { + LOG_WARNING(Service_BTM, "called"); + + *out_interface = std::make_shared(system); + R_SUCCEED(); +} + +} // namespace Service::BTM diff --git a/src/core/hle/service/btm/btm_system.h b/src/core/hle/service/btm/btm_system.h new file mode 100644 index 0000000000..9755540204 --- /dev/null +++ b/src/core/hle/service/btm/btm_system.h @@ -0,0 +1,28 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/service.h" + +namespace Core { +class System; +} + +namespace Service::BTM { +class IBtmSystemCore; + +class IBtmSystem final : public ServiceFramework { +public: + explicit IBtmSystem(Core::System& system_); + ~IBtmSystem() override; + +private: + Result GetCore(OutInterface out_interface); +}; + +} // namespace Service::BTM diff --git a/src/core/hle/service/btm/btm_system_core.cpp b/src/core/hle/service/btm/btm_system_core.cpp new file mode 100644 index 0000000000..318657fc32 --- /dev/null +++ b/src/core/hle/service/btm/btm_system_core.cpp @@ -0,0 +1,135 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "common/logging.h" +#include "core/hle/service/btm/btm_system_core.h" +#include "core/hle/service/cmif_serialization.h" +#include "core/hle/service/set/system_settings_server.h" +#include "core/hle/service/sm/sm.h" + +namespace Service::BTM { + +IBtmSystemCore::IBtmSystemCore(Core::System& system_) + : ServiceFramework{system_, "IBtmSystemCore"}, service_context{system_, "IBtmSystemCore"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, C<&IBtmSystemCore::StartGamepadPairing>, "StartGamepadPairing"}, + {1, C<&IBtmSystemCore::CancelGamepadPairing>, "CancelGamepadPairing"}, + {2, nullptr, "ClearGamepadPairingDatabase"}, + {3, nullptr, "GetPairedGamepadCount"}, + {4, C<&IBtmSystemCore::EnableRadio>, "EnableRadio"}, + {5, C<&IBtmSystemCore::DisableRadio>, "DisableRadio"}, + {6, C<&IBtmSystemCore::IsRadioEnabled>, "IsRadioEnabled"}, + {7, C<&IBtmSystemCore::AcquireRadioEvent>, "AcquireRadioEvent"}, + {8, nullptr, "AcquireGamepadPairingEvent"}, + {9, nullptr, "IsGamepadPairingStarted"}, + {10, nullptr, "StartAudioDeviceDiscovery"}, + {11, nullptr, "StopAudioDeviceDiscovery"}, + {12, nullptr, "IsDiscoveryingAudioDevice"}, + {13, C<&IBtmSystemCore::GetDiscoveredAudioDevice>, "GetDiscoveredAudioDevice"}, + {14, C<&IBtmSystemCore::AcquireAudioDeviceConnectionEvent>, "AcquireAudioDeviceConnectionEvent"}, + {15, nullptr, "ConnectAudioDevice"}, + {16, nullptr, "IsConnectingAudioDevice"}, + {17, C<&IBtmSystemCore::GetConnectedAudioDevices>, "GetConnectedAudioDevices"}, + {18, nullptr, "DisconnectAudioDevice"}, + {19, nullptr, "AcquirePairedAudioDeviceInfoChangedEvent"}, + {20, C<&IBtmSystemCore::GetPairedAudioDevices>, "GetPairedAudioDevices"}, + {21, nullptr, "RemoveAudioDevicePairing"}, + {22, C<&IBtmSystemCore::RequestAudioDeviceConnectionRejection>, "RequestAudioDeviceConnectionRejection"}, + {23, C<&IBtmSystemCore::CancelAudioDeviceConnectionRejection>, "CancelAudioDeviceConnectionRejection"} + }; + // clang-format on + + RegisterHandlers(functions); + radio_event = service_context.CreateEvent("IBtmSystemCore::RadioEvent"); + audio_device_connection_event = + service_context.CreateEvent("IBtmSystemCore::AudioDeviceConnectionEvent"); + + m_set_sys = + system.ServiceManager().GetService("set:sys", true); +} + +IBtmSystemCore::~IBtmSystemCore() { + service_context.CloseEvent(radio_event); + service_context.CloseEvent(audio_device_connection_event); +} + +Result IBtmSystemCore::StartGamepadPairing() { + LOG_WARNING(Service_BTM, "(STUBBED) called"); + R_SUCCEED(); +} + +Result IBtmSystemCore::CancelGamepadPairing() { + LOG_WARNING(Service_BTM, "(STUBBED) called"); + R_SUCCEED(); +} + +Result IBtmSystemCore::EnableRadio() { + LOG_DEBUG(Service_BTM, "called"); + + R_RETURN(m_set_sys->SetBluetoothEnableFlag(true)); +} +Result IBtmSystemCore::DisableRadio() { + LOG_DEBUG(Service_BTM, "called"); + + R_RETURN(m_set_sys->SetBluetoothEnableFlag(false)); +} + +Result IBtmSystemCore::IsRadioEnabled(Out out_is_enabled) { + LOG_DEBUG(Service_BTM, "called"); + + R_RETURN(m_set_sys->GetBluetoothEnableFlag(out_is_enabled)); +} + +Result IBtmSystemCore::AcquireRadioEvent(Out out_is_valid, + OutCopyHandle out_event) { + LOG_WARNING(Service_BTM, "(STUBBED) called"); + + *out_is_valid = true; + *out_event = &radio_event->GetReadableEvent(); + R_SUCCEED(); +} + +Result IBtmSystemCore::GetDiscoveredAudioDevice(OutArray, BufferAttr_HipcPointer> out_audio_devices, s32 count, Out out_total) { + LOG_WARNING(Service_BTM, "(STUBBED) called"); + R_SUCCEED(); +} + +Result IBtmSystemCore::AcquireAudioDeviceConnectionEvent( + OutCopyHandle out_event) { + LOG_WARNING(Service_BTM, "(STUBBED) called"); + + *out_event = &audio_device_connection_event->GetReadableEvent(); + R_SUCCEED(); +} + +Result IBtmSystemCore::GetConnectedAudioDevices( + Out out_count, OutArray, BufferAttr_HipcPointer> out_audio_devices) { + LOG_WARNING(Service_BTM, "(STUBBED) called"); + + *out_count = 0; + R_SUCCEED(); +} + +Result IBtmSystemCore::GetPairedAudioDevices( + Out out_count, OutArray, BufferAttr_HipcPointer> out_audio_devices) { + LOG_WARNING(Service_BTM, "(STUBBED) called"); + + *out_count = 0; + R_SUCCEED(); +} + +Result IBtmSystemCore::RequestAudioDeviceConnectionRejection(ClientAppletResourceUserId aruid) { + LOG_WARNING(Service_BTM, "(STUBBED) called, applet_resource_user_id={}", aruid.pid); + R_SUCCEED(); +} + +Result IBtmSystemCore::CancelAudioDeviceConnectionRejection(ClientAppletResourceUserId aruid) { + LOG_WARNING(Service_BTM, "(STUBBED) called, applet_resource_user_id={}", aruid.pid); + R_SUCCEED(); +} + +} // namespace Service::BTM diff --git a/src/core/hle/service/btm/btm_system_core.h b/src/core/hle/service/btm/btm_system_core.h new file mode 100644 index 0000000000..3fc4c0d56c --- /dev/null +++ b/src/core/hle/service/btm/btm_system_core.h @@ -0,0 +1,62 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/kernel_helpers.h" +#include "core/hle/service/service.h" + +namespace Kernel { +class KEvent; +class KReadableEvent; +} // namespace Kernel + +namespace Core { +class System; +} + +namespace Service::Set { +class ISystemSettingsServer; +} + +namespace Service::BTM { + +class IBtmSystemCore final : public ServiceFramework { +public: + explicit IBtmSystemCore(Core::System& system_); + ~IBtmSystemCore() override; + +private: + Result StartGamepadPairing(); + Result CancelGamepadPairing(); + Result EnableRadio(); + Result DisableRadio(); + Result IsRadioEnabled(Out out_is_enabled); + + Result AcquireRadioEvent(Out out_is_valid, OutCopyHandle out_event); + Result GetDiscoveredAudioDevice(OutArray, BufferAttr_HipcPointer> out_audio_devices, s32 count, Out out_total); + Result AcquireAudioDeviceConnectionEvent(OutCopyHandle out_event); + + Result GetConnectedAudioDevices( + Out out_count, + OutArray, BufferAttr_HipcPointer> out_audio_devices); + + Result GetPairedAudioDevices( + Out out_count, + OutArray, BufferAttr_HipcPointer> out_audio_devices); + + Result RequestAudioDeviceConnectionRejection(ClientAppletResourceUserId aruid); + Result CancelAudioDeviceConnectionRejection(ClientAppletResourceUserId aruid); + + KernelHelpers::ServiceContext service_context; + + Kernel::KEvent* radio_event; + Kernel::KEvent* audio_device_connection_event; + std::shared_ptr m_set_sys; +}; + +} // namespace Service::BTM diff --git a/src/core/hle/service/btm/btm_user.cpp b/src/core/hle/service/btm/btm_user.cpp new file mode 100644 index 0000000000..c380c573fa --- /dev/null +++ b/src/core/hle/service/btm/btm_user.cpp @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "common/logging.h" +#include "core/hle/service/btm/btm_user.h" +#include "core/hle/service/btm/btm_user_core.h" +#include "core/hle/service/cmif_serialization.h" + +namespace Service::BTM { + +IBtmUser::IBtmUser(Core::System& system_) : ServiceFramework{system_, "btm:u"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, C<&IBtmUser::GetCore>, "GetCore"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +IBtmUser::~IBtmUser() = default; + +Result IBtmUser::GetCore(OutInterface out_interface) { + LOG_WARNING(Service_BTM, "called"); + + *out_interface = std::make_shared(system); + R_SUCCEED(); +} + +} // namespace Service::BTM diff --git a/src/core/hle/service/btm/btm_user.h b/src/core/hle/service/btm/btm_user.h new file mode 100644 index 0000000000..d6cf330ed6 --- /dev/null +++ b/src/core/hle/service/btm/btm_user.h @@ -0,0 +1,28 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/service.h" + +namespace Core { +class System; +} + +namespace Service::BTM { +class IBtmUserCore; + +class IBtmUser final : public ServiceFramework { +public: + explicit IBtmUser(Core::System& system_); + ~IBtmUser() override; + +private: + Result GetCore(OutInterface out_interface); +}; + +} // namespace Service::BTM diff --git a/src/core/hle/service/btm/btm_user_core.cpp b/src/core/hle/service/btm/btm_user_core.cpp new file mode 100644 index 0000000000..b120df14c0 --- /dev/null +++ b/src/core/hle/service/btm/btm_user_core.cpp @@ -0,0 +1,106 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +#include + +#include "common/logging.h" +#include "core/core.h" +#include "core/hle/kernel/k_event.h" +#include "core/hle/service/btm/btm_user_core.h" +#include "core/hle/service/cmif_serialization.h" + +namespace Service::BTM { + +IBtmUserCore::IBtmUserCore(Core::System& system_) + : ServiceFramework{system_, "IBtmUserCore"}, service_context{system_, "IBtmUserCore"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, C<&IBtmUserCore::AcquireBleScanEvent>, "AcquireBleScanEvent"}, + {1, nullptr, "GetBleScanFilterParameter"}, + {2, nullptr, "GetBleScanFilterParameter2"}, + {3, nullptr, "StartBleScanForGeneral"}, + {4, nullptr, "StopBleScanForGeneral"}, + {5, nullptr, "GetBleScanResultsForGeneral"}, + {6, nullptr, "StartBleScanForPaired"}, + {7, nullptr, "StopBleScanForPaired"}, + {8, nullptr, "StartBleScanForSmartDevice"}, + {9, nullptr, "StopBleScanForSmartDevice"}, + {10, nullptr, "GetBleScanResultsForSmartDevice"}, + {17, C<&IBtmUserCore::AcquireBleConnectionEvent>, "AcquireBleConnectionEvent"}, + {18, nullptr, "BleConnect"}, + {19, nullptr, "BleDisconnect"}, + {20, nullptr, "BleGetConnectionState"}, + {21, nullptr, "AcquireBlePairingEvent"}, + {22, nullptr, "BlePairDevice"}, + {23, nullptr, "BleUnPairDevice"}, + {24, nullptr, "BleUnPairDevice2"}, + {25, nullptr, "BleGetPairedDevices"}, + {26, C<&IBtmUserCore::AcquireBleServiceDiscoveryEvent>, "AcquireBleServiceDiscoveryEvent"}, + {27, nullptr, "GetGattServices"}, + {28, nullptr, "GetGattService"}, + {29, nullptr, "GetGattIncludedServices"}, + {30, nullptr, "GetBelongingGattService"}, + {31, nullptr, "GetGattCharacteristics"}, + {32, nullptr, "GetGattDescriptors"}, + {33, C<&IBtmUserCore::AcquireBleMtuConfigEvent>, "AcquireBleMtuConfigEvent"}, + {34, nullptr, "ConfigureBleMtu"}, + {35, nullptr, "GetBleMtu"}, + {36, nullptr, "RegisterBleGattDataPath"}, + {37, nullptr, "UnregisterBleGattDataPath"}, + }; + // clang-format on + RegisterHandlers(functions); + + scan_event = service_context.CreateEvent("IBtmUserCore:ScanEvent"); + connection_event = service_context.CreateEvent("IBtmUserCore:ConnectionEvent"); + service_discovery_event = service_context.CreateEvent("IBtmUserCore:DiscoveryEvent"); + config_event = service_context.CreateEvent("IBtmUserCore:ConfigEvent"); +} + +IBtmUserCore::~IBtmUserCore() { + service_context.CloseEvent(scan_event); + service_context.CloseEvent(connection_event); + service_context.CloseEvent(service_discovery_event); + service_context.CloseEvent(config_event); +} + +Result IBtmUserCore::AcquireBleScanEvent(Out out_is_valid, + OutCopyHandle out_event) { + LOG_WARNING(Service_BTM, "(STUBBED) called"); + + *out_is_valid = true; + *out_event = &scan_event->GetReadableEvent(); + R_SUCCEED(); +} + +Result IBtmUserCore::AcquireBleConnectionEvent(Out out_is_valid, + OutCopyHandle out_event) { + LOG_WARNING(Service_BTM, "(STUBBED) called"); + + *out_is_valid = true; + *out_event = &connection_event->GetReadableEvent(); + R_SUCCEED(); +} + +Result IBtmUserCore::AcquireBleServiceDiscoveryEvent( + Out out_is_valid, OutCopyHandle out_event) { + LOG_WARNING(Service_BTM, "(STUBBED) called"); + + *out_is_valid = true; + *out_event = &service_discovery_event->GetReadableEvent(); + R_SUCCEED(); +} + +Result IBtmUserCore::AcquireBleMtuConfigEvent(Out out_is_valid, + OutCopyHandle out_event) { + LOG_WARNING(Service_BTM, "(STUBBED) called"); + + *out_is_valid = true; + *out_event = &config_event->GetReadableEvent(); + R_SUCCEED(); +} + +} // namespace Service::BTM diff --git a/src/core/hle/service/btm/btm_user_core.h b/src/core/hle/service/btm/btm_user_core.h new file mode 100644 index 0000000000..5a565a5897 --- /dev/null +++ b/src/core/hle/service/btm/btm_user_core.h @@ -0,0 +1,50 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/kernel_helpers.h" +#include "core/hle/service/service.h" + +namespace Kernel { +class KEvent; +class KReadableEvent; +} // namespace Kernel + +namespace Core { +class System; +} + +namespace Service::BTM { + +class IBtmUserCore final : public ServiceFramework { +public: + explicit IBtmUserCore(Core::System& system_); + ~IBtmUserCore() override; + +private: + Result AcquireBleScanEvent(Out out_is_valid, + OutCopyHandle out_event); + + Result AcquireBleConnectionEvent(Out out_is_valid, + OutCopyHandle out_event); + + Result AcquireBleServiceDiscoveryEvent(Out out_is_valid, + OutCopyHandle out_event); + + Result AcquireBleMtuConfigEvent(Out out_is_valid, + OutCopyHandle out_event); + + KernelHelpers::ServiceContext service_context; + + Kernel::KEvent* scan_event; + Kernel::KEvent* connection_event; + Kernel::KEvent* service_discovery_event; + Kernel::KEvent* config_event; +}; + +} // namespace Service::BTM diff --git a/src/core/hle/service/caps/caps.cpp b/src/core/hle/service/caps/caps.cpp index 6cc37999f3..f07fbd2185 100644 --- a/src/core/hle/service/caps/caps.cpp +++ b/src/core/hle/service/caps/caps.cpp @@ -5,6 +5,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "core/hle/service/caps/caps.h" +#include "core/hle/service/caps/caps_a.h" #include "core/hle/service/caps/caps_c.h" #include "core/hle/service/caps/caps_manager.h" #include "core/hle/service/caps/caps_sc.h" @@ -13,223 +14,24 @@ #include "core/hle/service/caps/caps_u.h" #include "core/hle/service/server_manager.h" #include "core/hle/service/service.h" -#include "common/logging.h" #include "frontend_common/firmware_manager.h" -#include "core/hle/service/caps/caps_result.h" -#include "core/hle/service/cmif_serialization.h" -#include "core/hle/service/ipc_helpers.h" namespace Service::Capture { class IDecoderControlService final : public ServiceFramework { public: - explicit IDecoderControlService(Core::System& system_) : ServiceFramework{system_, "grc:d"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{3001, nullptr, "DecodeJpeg"}, - FunctionInfo{4001, nullptr, "ShrinkJpeg"}, - FunctionInfo{4002, nullptr, "ShrinkJpegEx"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit IDecoderControlService(Core::System& system_) : ServiceFramework{system_, "grc:d"} { + // clang-format off + static const FunctionInfo functions[] = { + {3001, nullptr, "DecodeJpeg"}, + {4001, nullptr, "ShrinkJpeg"}, + {4002, nullptr, "ShrinkJpegEx"}, + }; + // clang-format on + RegisterHandlers(functions); } }; -class IAlbumAccessorService final : public ServiceFramework { -public: - explicit IAlbumAccessorService(Core::System& system_, std::shared_ptr album_manager) : ServiceFramework{system_, "caps:a"}, manager{album_manager} {} - ~IAlbumAccessorService() override = default; - - Result GetAlbumFileList( - Out out_count, AlbumStorage storage, - OutArray out_entries) { - LOG_INFO(Service_Capture, "called, storage={}", storage); - - const Result result = manager->GetAlbumFileList(out_entries, *out_count, storage, 0); - R_RETURN(TranslateResult(result)); - } - - Result DeleteAlbumFile(AlbumFileId file_id) { - LOG_INFO(Service_Capture, "called, application_id={:#0x}, storage={}, type={}", - file_id.application_id, file_id.storage, file_id.type); - - const Result result = manager->DeleteAlbumFile(file_id); - R_RETURN(TranslateResult(result)); - } - - Result IsAlbumMounted(Out out_is_mounted, AlbumStorage storage) { - LOG_INFO(Service_Capture, "called, storage={}", storage); - - const Result result = manager->IsAlbumMounted(storage); - *out_is_mounted = result.IsSuccess(); - R_RETURN(TranslateResult(result)); - } - - Result Unknown18( - Out out_buffer_size, - OutArray out_buffer) { - LOG_WARNING(Service_Capture, "(STUBBED) called"); - *out_buffer_size = 0; - R_SUCCEED(); - } - - Result GetAlbumFileListEx0( - Out out_entries_size, AlbumStorage storage, u8 flags, - OutArray out_entries) { - LOG_INFO(Service_Capture, "called, storage={}, flags={}", storage, flags); - - const Result result = manager->GetAlbumFileList(out_entries, *out_entries_size, storage, flags); - R_RETURN(TranslateResult(result)); - } - - Result GetAutoSavingStorage(Out out_is_autosaving) { - LOG_WARNING(Service_Capture, "(STUBBED) called"); - - const Result result = manager->GetAutoSavingStorage(*out_is_autosaving); - R_RETURN(TranslateResult(result)); - } - - Result LoadAlbumScreenShotImageEx1( - const AlbumFileId& file_id, const ScreenShotDecodeOption& decoder_options, - OutLargeData out_image_output, - OutArray out_image, - OutArray out_buffer) { - LOG_INFO(Service_Capture, "called, application_id={:#0x}, storage={}, type={}, flags={}", - file_id.application_id, file_id.storage, file_id.type, decoder_options.flags); - - const Result result = - manager->LoadAlbumScreenShotImage(*out_image_output, out_image, file_id, decoder_options); - R_RETURN(TranslateResult(result)); - } - - Result LoadAlbumScreenShotThumbnailImageEx1( - const AlbumFileId& file_id, const ScreenShotDecodeOption& decoder_options, - OutLargeData out_image_output, - OutArray out_image, - OutArray out_buffer) { - LOG_INFO(Service_Capture, "called, application_id={:#0x}, storage={}, type={}, flags={}", - file_id.application_id, file_id.storage, file_id.type, decoder_options.flags); - - const Result result = manager->LoadAlbumScreenShotThumbnail(*out_image_output, out_image, - file_id, decoder_options); - R_RETURN(TranslateResult(result)); - } - - Result TranslateResult(Result in_result) { - if (in_result.IsSuccess()) { - return in_result; - } - - if ((in_result.raw & 0x3801ff) == ResultUnknown1024.raw) { - if (in_result.GetDescription() - 0x514 < 100) { - return ResultInvalidFileData; - } - if (in_result.GetDescription() - 0x5dc < 100) { - return ResultInvalidFileData; - } - - if (in_result.GetDescription() - 0x578 < 100) { - if (in_result == ResultFileCountLimit) { - return ResultUnknown22; - } - return ResultUnknown25; - } - - if (in_result.raw < ResultUnknown1801.raw) { - if (in_result == ResultUnknown1202) { - return ResultUnknown810; - } - if (in_result == ResultUnknown1203) { - return ResultUnknown810; - } - if (in_result == ResultUnknown1701) { - return ResultUnknown5; - } - } else if (in_result.raw < ResultUnknown1803.raw) { - if (in_result == ResultUnknown1801) { - return ResultUnknown5; - } - if (in_result == ResultUnknown1802) { - return ResultUnknown6; - } - } else { - if (in_result == ResultUnknown1803) { - return ResultUnknown7; - } - if (in_result == ResultUnknown1804) { - return ResultOutOfRange; - } - } - return ResultUnknown1024; - } - - if (in_result.GetModule() == ErrorModule::FS) { - if ((in_result.GetDescription() >> 0xc < 0x7d) || - (in_result.GetDescription() - 1000 < 2000) || - (((in_result.GetDescription() - 3000) >> 3) < 0x271)) { - // TODO: Translate FS error - return in_result; - } - } - - return in_result; - } - - Result GetAlbumAccessResultForDebug(Out out_result) { - LOG_WARNING(Service_Capture, "(STUBBED) called"); - *out_result = ResultSuccess; - R_SUCCEED(); - } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetAlbumFileCount"}, - FunctionInfo{1, C<&IAlbumAccessorService::GetAlbumFileList>, "GetAlbumFileList"}, - FunctionInfo{2, nullptr, "LoadAlbumFile"}, - FunctionInfo{3, C<&IAlbumAccessorService::DeleteAlbumFile>, "DeleteAlbumFile"}, - FunctionInfo{4, nullptr, "StorageCopyAlbumFile"}, - FunctionInfo{5, C<&IAlbumAccessorService::IsAlbumMounted>, "IsAlbumMounted"}, - FunctionInfo{6, nullptr, "GetAlbumUsage"}, - FunctionInfo{7, nullptr, "GetAlbumFileSize"}, - FunctionInfo{8, nullptr, "LoadAlbumFileThumbnail"}, - FunctionInfo{9, nullptr, "LoadAlbumScreenShotImage"}, - FunctionInfo{10, nullptr, "LoadAlbumScreenShotThumbnailImage"}, - FunctionInfo{11, nullptr, "GetAlbumEntryFromApplicationAlbumEntry"}, - FunctionInfo{12, nullptr, "LoadAlbumScreenShotImageEx"}, - FunctionInfo{13, nullptr, "LoadAlbumScreenShotThumbnailImageEx"}, - FunctionInfo{14, nullptr, "LoadAlbumScreenShotImageEx0"}, - FunctionInfo{15, nullptr, "GetAlbumUsage3"}, - FunctionInfo{16, nullptr, "GetAlbumMountResult"}, - FunctionInfo{17, nullptr, "GetAlbumUsage16"}, - FunctionInfo{18, C<&IAlbumAccessorService::Unknown18>, "Unknown18"}, - FunctionInfo{19, nullptr, "Unknown19"}, - FunctionInfo{100, nullptr, "GetAlbumFileCountEx0"}, - FunctionInfo{101, C<&IAlbumAccessorService::GetAlbumFileListEx0>, "GetAlbumFileListEx0"}, - FunctionInfo{202, nullptr, "SaveEditedScreenShot"}, - FunctionInfo{301, nullptr, "GetLastThumbnail"}, - FunctionInfo{302, nullptr, "GetLastOverlayMovieThumbnail"}, - FunctionInfo{401, C<&IAlbumAccessorService::GetAutoSavingStorage>, "GetAutoSavingStorage"}, - FunctionInfo{501, nullptr, "GetRequiredStorageSpaceSizeToCopyAll"}, - FunctionInfo{1001, nullptr, "LoadAlbumScreenShotThumbnailImageEx0"}, - FunctionInfo{1002, C<&IAlbumAccessorService::LoadAlbumScreenShotImageEx1>, "LoadAlbumScreenShotImageEx1"}, - FunctionInfo{1003, C<&IAlbumAccessorService::LoadAlbumScreenShotThumbnailImageEx1>, "LoadAlbumScreenShotThumbnailImageEx1"}, - FunctionInfo{8001, nullptr, "ForceAlbumUnmounted"}, - FunctionInfo{8002, nullptr, "ResetAlbumMountStatus"}, - FunctionInfo{8011, nullptr, "RefreshAlbumCache"}, - FunctionInfo{8012, nullptr, "GetAlbumCache"}, - FunctionInfo{8013, nullptr, "GetAlbumCacheEx"}, - FunctionInfo{8021, nullptr, "GetAlbumEntryFromApplicationAlbumEntryAruid"}, - FunctionInfo{10011, nullptr, "SetInternalErrorConversionEnabled"}, - FunctionInfo{50000, nullptr, "LoadMakerNoteInfoForDebug"}, - FunctionInfo{50011, C<&IAlbumAccessorService::GetAlbumAccessResultForDebug>, "GetAlbumAccessResultForDebug"}, - FunctionInfo{60002, nullptr, "OpenAccessorSession"} - ); - - std::shared_ptr manager = nullptr; -}; - void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); auto album_manager = std::make_shared(system); diff --git a/src/core/hle/service/caps/caps.h b/src/core/hle/service/caps/caps.h index 58e9725b85..670ee59cda 100644 --- a/src/core/hle/service/caps/caps.h +++ b/src/core/hle/service/caps/caps.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/caps/caps_a.cpp b/src/core/hle/service/caps/caps_a.cpp new file mode 100644 index 0000000000..8f561bfcdc --- /dev/null +++ b/src/core/hle/service/caps/caps_a.cpp @@ -0,0 +1,211 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "common/logging.h" +#include "core/hle/service/caps/caps_a.h" +#include "core/hle/service/caps/caps_manager.h" +#include "core/hle/service/caps/caps_result.h" +#include "core/hle/service/cmif_serialization.h" +#include "core/hle/service/ipc_helpers.h" + +namespace Service::Capture { + +IAlbumAccessorService::IAlbumAccessorService(Core::System& system_, + std::shared_ptr album_manager) + : ServiceFramework{system_, "caps:a"}, manager{album_manager} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetAlbumFileCount"}, + {1, C<&IAlbumAccessorService::GetAlbumFileList>, "GetAlbumFileList"}, + {2, nullptr, "LoadAlbumFile"}, + {3, C<&IAlbumAccessorService::DeleteAlbumFile>, "DeleteAlbumFile"}, + {4, nullptr, "StorageCopyAlbumFile"}, + {5, C<&IAlbumAccessorService::IsAlbumMounted>, "IsAlbumMounted"}, + {6, nullptr, "GetAlbumUsage"}, + {7, nullptr, "GetAlbumFileSize"}, + {8, nullptr, "LoadAlbumFileThumbnail"}, + {9, nullptr, "LoadAlbumScreenShotImage"}, + {10, nullptr, "LoadAlbumScreenShotThumbnailImage"}, + {11, nullptr, "GetAlbumEntryFromApplicationAlbumEntry"}, + {12, nullptr, "LoadAlbumScreenShotImageEx"}, + {13, nullptr, "LoadAlbumScreenShotThumbnailImageEx"}, + {14, nullptr, "LoadAlbumScreenShotImageEx0"}, + {15, nullptr, "GetAlbumUsage3"}, + {16, nullptr, "GetAlbumMountResult"}, + {17, nullptr, "GetAlbumUsage16"}, + {18, C<&IAlbumAccessorService::Unknown18>, "Unknown18"}, + {19, nullptr, "Unknown19"}, + {100, nullptr, "GetAlbumFileCountEx0"}, + {101, C<&IAlbumAccessorService::GetAlbumFileListEx0>, "GetAlbumFileListEx0"}, + {202, nullptr, "SaveEditedScreenShot"}, + {301, nullptr, "GetLastThumbnail"}, + {302, nullptr, "GetLastOverlayMovieThumbnail"}, + {401, C<&IAlbumAccessorService::GetAutoSavingStorage>, "GetAutoSavingStorage"}, + {501, nullptr, "GetRequiredStorageSpaceSizeToCopyAll"}, + {1001, nullptr, "LoadAlbumScreenShotThumbnailImageEx0"}, + {1002, C<&IAlbumAccessorService::LoadAlbumScreenShotImageEx1>, "LoadAlbumScreenShotImageEx1"}, + {1003, C<&IAlbumAccessorService::LoadAlbumScreenShotThumbnailImageEx1>, "LoadAlbumScreenShotThumbnailImageEx1"}, + {8001, nullptr, "ForceAlbumUnmounted"}, + {8002, nullptr, "ResetAlbumMountStatus"}, + {8011, nullptr, "RefreshAlbumCache"}, + {8012, nullptr, "GetAlbumCache"}, + {8013, nullptr, "GetAlbumCacheEx"}, + {8021, nullptr, "GetAlbumEntryFromApplicationAlbumEntryAruid"}, + {10011, nullptr, "SetInternalErrorConversionEnabled"}, + {50000, nullptr, "LoadMakerNoteInfoForDebug"}, + {50011, C<&IAlbumAccessorService::GetAlbumAccessResultForDebug>, "GetAlbumAccessResultForDebug"}, + {60002, nullptr, "OpenAccessorSession"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +IAlbumAccessorService::~IAlbumAccessorService() = default; + +Result IAlbumAccessorService::GetAlbumFileList( + Out out_count, AlbumStorage storage, + OutArray out_entries) { + LOG_INFO(Service_Capture, "called, storage={}", storage); + + const Result result = manager->GetAlbumFileList(out_entries, *out_count, storage, 0); + R_RETURN(TranslateResult(result)); +} + +Result IAlbumAccessorService::DeleteAlbumFile(AlbumFileId file_id) { + LOG_INFO(Service_Capture, "called, application_id={:#0x}, storage={}, type={}", + file_id.application_id, file_id.storage, file_id.type); + + const Result result = manager->DeleteAlbumFile(file_id); + R_RETURN(TranslateResult(result)); +} + +Result IAlbumAccessorService::IsAlbumMounted(Out out_is_mounted, AlbumStorage storage) { + LOG_INFO(Service_Capture, "called, storage={}", storage); + + const Result result = manager->IsAlbumMounted(storage); + *out_is_mounted = result.IsSuccess(); + R_RETURN(TranslateResult(result)); +} + +Result IAlbumAccessorService::Unknown18( + Out out_buffer_size, + OutArray out_buffer) { + LOG_WARNING(Service_Capture, "(STUBBED) called"); + *out_buffer_size = 0; + R_SUCCEED(); +} + +Result IAlbumAccessorService::GetAlbumFileListEx0( + Out out_entries_size, AlbumStorage storage, u8 flags, + OutArray out_entries) { + LOG_INFO(Service_Capture, "called, storage={}, flags={}", storage, flags); + + const Result result = manager->GetAlbumFileList(out_entries, *out_entries_size, storage, flags); + R_RETURN(TranslateResult(result)); +} + +Result IAlbumAccessorService::GetAutoSavingStorage(Out out_is_autosaving) { + LOG_WARNING(Service_Capture, "(STUBBED) called"); + + const Result result = manager->GetAutoSavingStorage(*out_is_autosaving); + R_RETURN(TranslateResult(result)); +} + +Result IAlbumAccessorService::LoadAlbumScreenShotImageEx1( + const AlbumFileId& file_id, const ScreenShotDecodeOption& decoder_options, + OutLargeData out_image_output, + OutArray out_image, + OutArray out_buffer) { + LOG_INFO(Service_Capture, "called, application_id={:#0x}, storage={}, type={}, flags={}", + file_id.application_id, file_id.storage, file_id.type, decoder_options.flags); + + const Result result = + manager->LoadAlbumScreenShotImage(*out_image_output, out_image, file_id, decoder_options); + R_RETURN(TranslateResult(result)); +} + +Result IAlbumAccessorService::LoadAlbumScreenShotThumbnailImageEx1( + const AlbumFileId& file_id, const ScreenShotDecodeOption& decoder_options, + OutLargeData out_image_output, + OutArray out_image, + OutArray out_buffer) { + LOG_INFO(Service_Capture, "called, application_id={:#0x}, storage={}, type={}, flags={}", + file_id.application_id, file_id.storage, file_id.type, decoder_options.flags); + + const Result result = manager->LoadAlbumScreenShotThumbnail(*out_image_output, out_image, + file_id, decoder_options); + R_RETURN(TranslateResult(result)); +} + +Result IAlbumAccessorService::TranslateResult(Result in_result) { + if (in_result.IsSuccess()) { + return in_result; + } + + if ((in_result.raw & 0x3801ff) == ResultUnknown1024.raw) { + if (in_result.GetDescription() - 0x514 < 100) { + return ResultInvalidFileData; + } + if (in_result.GetDescription() - 0x5dc < 100) { + return ResultInvalidFileData; + } + + if (in_result.GetDescription() - 0x578 < 100) { + if (in_result == ResultFileCountLimit) { + return ResultUnknown22; + } + return ResultUnknown25; + } + + if (in_result.raw < ResultUnknown1801.raw) { + if (in_result == ResultUnknown1202) { + return ResultUnknown810; + } + if (in_result == ResultUnknown1203) { + return ResultUnknown810; + } + if (in_result == ResultUnknown1701) { + return ResultUnknown5; + } + } else if (in_result.raw < ResultUnknown1803.raw) { + if (in_result == ResultUnknown1801) { + return ResultUnknown5; + } + if (in_result == ResultUnknown1802) { + return ResultUnknown6; + } + } else { + if (in_result == ResultUnknown1803) { + return ResultUnknown7; + } + if (in_result == ResultUnknown1804) { + return ResultOutOfRange; + } + } + return ResultUnknown1024; + } + + if (in_result.GetModule() == ErrorModule::FS) { + if ((in_result.GetDescription() >> 0xc < 0x7d) || + (in_result.GetDescription() - 1000 < 2000) || + (((in_result.GetDescription() - 3000) >> 3) < 0x271)) { + // TODO: Translate FS error + return in_result; + } + } + + return in_result; +} + + +Result IAlbumAccessorService::GetAlbumAccessResultForDebug(Out out_result) { + LOG_WARNING(Service_Capture, "(STUBBED) called"); + *out_result = ResultSuccess; + R_SUCCEED(); +} + +} // namespace Service::Capture diff --git a/src/core/hle/service/caps/caps_a.h b/src/core/hle/service/caps/caps_a.h new file mode 100644 index 0000000000..c6aa8f9210 --- /dev/null +++ b/src/core/hle/service/caps/caps_a.h @@ -0,0 +1,63 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/caps/caps_types.h" +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/service.h" + +namespace Core { +class System; +} + +namespace Service::Capture { +class AlbumManager; + +class IAlbumAccessorService final : public ServiceFramework { +public: + explicit IAlbumAccessorService(Core::System& system_, + std::shared_ptr album_manager); + ~IAlbumAccessorService() override; + +private: + Result GetAlbumFileList(Out out_count, AlbumStorage storage, + OutArray out_entries); + + Result DeleteAlbumFile(AlbumFileId file_id); + + Result IsAlbumMounted(Out out_is_mounted, AlbumStorage storage); + + Result Unknown18( + Out out_buffer_size, + OutArray + out_buffer); + + Result GetAlbumFileListEx0(Out out_entries_size, AlbumStorage storage, u8 flags, + OutArray out_entries); + + Result GetAutoSavingStorage(Out out_is_autosaving); + + Result LoadAlbumScreenShotImageEx1( + const AlbumFileId& file_id, const ScreenShotDecodeOption& decoder_options, + OutLargeData out_image_output, + OutArray out_image, + OutArray out_buffer); + + Result LoadAlbumScreenShotThumbnailImageEx1( + const AlbumFileId& file_id, const ScreenShotDecodeOption& decoder_options, + OutLargeData out_image_output, + OutArray out_image, + OutArray out_buffer); + + Result TranslateResult(Result in_result); + + Result GetAlbumAccessResultForDebug(Out out_result); + + std::shared_ptr manager = nullptr; +}; + +} // namespace Service::Capture diff --git a/src/core/hle/service/caps/caps_c.cpp b/src/core/hle/service/caps/caps_c.cpp index c62c3cd5d3..6c9f8e964d 100644 --- a/src/core/hle/service/caps/caps_c.cpp +++ b/src/core/hle/service/caps/caps_c.cpp @@ -14,34 +14,34 @@ namespace Service::Capture { -std::optional IAlbumControlService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{1, nullptr, "CaptureRawImage"}, - FunctionInfo{2, nullptr, "CaptureRawImageWithTimeout"}, - FunctionInfo{33, C<&IAlbumControlService::SetShimLibraryVersion>, "SetShimLibraryVersion"}, - FunctionInfo{1001, nullptr, "RequestTakingScreenShot"}, - FunctionInfo{1002, nullptr, "RequestTakingScreenShotWithTimeout"}, - FunctionInfo{1011, nullptr, "NotifyTakingScreenShotRefused"}, - FunctionInfo{2001, nullptr, "NotifyAlbumStorageIsAvailable"}, - FunctionInfo{2002, nullptr, "NotifyAlbumStorageIsUnavailable"}, - FunctionInfo{2011, nullptr, "RegisterAppletResourceUserId"}, - FunctionInfo{2012, nullptr, "UnregisterAppletResourceUserId"}, - FunctionInfo{2013, nullptr, "GetApplicationIdFromAruid"}, - FunctionInfo{2014, nullptr, "CheckApplicationIdRegistered"}, - FunctionInfo{2101, nullptr, "GenerateCurrentAlbumFileId"}, - FunctionInfo{2102, nullptr, "GenerateApplicationAlbumEntry"}, - FunctionInfo{2201, nullptr, "SaveAlbumScreenShotFile"}, - FunctionInfo{2202, nullptr, "SaveAlbumScreenShotFileEx"}, - FunctionInfo{2301, nullptr, "SetOverlayScreenShotThumbnailData"}, - FunctionInfo{2302, nullptr, "SetOverlayMovieThumbnailData"}, - FunctionInfo{60001, nullptr, "OpenControlSession"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IAlbumControlService::IAlbumControlService(Core::System& system_, std::shared_ptr album_manager) : ServiceFramework{system_, "caps:c"}, manager{album_manager} { + // clang-format off + static const FunctionInfo functions[] = { + {1, nullptr, "CaptureRawImage"}, + {2, nullptr, "CaptureRawImageWithTimeout"}, + {33, C<&IAlbumControlService::SetShimLibraryVersion>, "SetShimLibraryVersion"}, + {1001, nullptr, "RequestTakingScreenShot"}, + {1002, nullptr, "RequestTakingScreenShotWithTimeout"}, + {1011, nullptr, "NotifyTakingScreenShotRefused"}, + {2001, nullptr, "NotifyAlbumStorageIsAvailable"}, + {2002, nullptr, "NotifyAlbumStorageIsUnavailable"}, + {2011, nullptr, "RegisterAppletResourceUserId"}, + {2012, nullptr, "UnregisterAppletResourceUserId"}, + {2013, nullptr, "GetApplicationIdFromAruid"}, + {2014, nullptr, "CheckApplicationIdRegistered"}, + {2101, nullptr, "GenerateCurrentAlbumFileId"}, + {2102, nullptr, "GenerateApplicationAlbumEntry"}, + {2201, nullptr, "SaveAlbumScreenShotFile"}, + {2202, nullptr, "SaveAlbumScreenShotFileEx"}, + {2301, nullptr, "SetOverlayScreenShotThumbnailData"}, + {2302, nullptr, "SetOverlayMovieThumbnailData"}, + {60001, nullptr, "OpenControlSession"}, + }; + // clang-format on + + RegisterHandlers(functions); } IAlbumControlService::~IAlbumControlService() = default; diff --git a/src/core/hle/service/caps/caps_c.h b/src/core/hle/service/caps/caps_c.h index a1f19bbfc3..f50de0ee8c 100644 --- a/src/core/hle/service/caps/caps_c.h +++ b/src/core/hle/service/caps/caps_c.h @@ -19,11 +19,14 @@ enum class ShimLibraryVersion : u64; class IAlbumControlService final : public ServiceFramework { public: - explicit IAlbumControlService(Core::System& system_, std::shared_ptr album_manager); + explicit IAlbumControlService(Core::System& system_, + std::shared_ptr album_manager); ~IAlbumControlService() override; + private: - Result SetShimLibraryVersion(ShimLibraryVersion library_version, ClientAppletResourceUserId aruid); - std::optional FindRequest(u32 key) override; + Result SetShimLibraryVersion(ShimLibraryVersion library_version, + ClientAppletResourceUserId aruid); + std::shared_ptr manager = nullptr; }; diff --git a/src/core/hle/service/caps/caps_result.h b/src/core/hle/service/caps/caps_result.h index 179ae48409..b7ba2a642d 100644 --- a/src/core/hle/service/caps/caps_result.h +++ b/src/core/hle/service/caps/caps_result.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/caps/caps_sc.cpp b/src/core/hle/service/caps/caps_sc.cpp index 59119d8ed7..92d53da9f5 100644 --- a/src/core/hle/service/caps/caps_sc.cpp +++ b/src/core/hle/service/caps/caps_sc.cpp @@ -10,6 +10,32 @@ namespace Service::Capture { IScreenShotControlService::IScreenShotControlService(Core::System& system_) : ServiceFramework{system_, "caps:sc"} { + // clang-format off + static const FunctionInfo functions[] = { + {1, nullptr, "CaptureRawImage"}, + {2, nullptr, "CaptureRawImageWithTimeout"}, + {3, nullptr, "AttachSharedBuffer"}, + {5, nullptr, "CaptureRawImageToAttachedSharedBuffer"}, + {210, nullptr, "Unknown210"}, + {1001, nullptr, "RequestTakingScreenShot"}, + {1002, nullptr, "RequestTakingScreenShotWithTimeout"}, + {1003, nullptr, "RequestTakingScreenShotEx"}, + {1004, nullptr, "RequestTakingScreenShotEx1"}, + {1009, nullptr, "CancelTakingScreenShot"}, + {1010, nullptr, "SetTakingScreenShotCancelState"}, + {1011, nullptr, "NotifyTakingScreenShotRefused"}, + {1012, nullptr, "NotifyTakingScreenShotFailed"}, + {1101, nullptr, "SetupOverlayMovieThumbnail"}, + {1106, nullptr, "Unknown1106"}, + {1107, nullptr, "Unknown1107"}, + {1201, nullptr, "OpenRawScreenShotReadStream"}, + {1202, nullptr, "CloseRawScreenShotReadStream"}, + {1203, nullptr, "ReadRawScreenShotReadStream"}, + {1204, nullptr, "Unknown1204"}, + }; + // clang-format on + + RegisterHandlers(functions); } IScreenShotControlService::~IScreenShotControlService() = default; diff --git a/src/core/hle/service/caps/caps_sc.h b/src/core/hle/service/caps/caps_sc.h index 422f062e59..72e947bf16 100644 --- a/src/core/hle/service/caps/caps_sc.h +++ b/src/core/hle/service/caps/caps_sc.h @@ -18,32 +18,6 @@ class IScreenShotControlService final : public ServiceFramework FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{1, nullptr, "CaptureRawImage"}, - FunctionInfo{2, nullptr, "CaptureRawImageWithTimeout"}, - FunctionInfo{3, nullptr, "AttachSharedBuffer"}, - FunctionInfo{5, nullptr, "CaptureRawImageToAttachedSharedBuffer"}, - FunctionInfo{210, nullptr, "Unknown210"}, - FunctionInfo{1001, nullptr, "RequestTakingScreenShot"}, - FunctionInfo{1002, nullptr, "RequestTakingScreenShotWithTimeout"}, - FunctionInfo{1003, nullptr, "RequestTakingScreenShotEx"}, - FunctionInfo{1004, nullptr, "RequestTakingScreenShotEx1"}, - FunctionInfo{1009, nullptr, "CancelTakingScreenShot"}, - FunctionInfo{1010, nullptr, "SetTakingScreenShotCancelState"}, - FunctionInfo{1011, nullptr, "NotifyTakingScreenShotRefused"}, - FunctionInfo{1012, nullptr, "NotifyTakingScreenShotFailed"}, - FunctionInfo{1101, nullptr, "SetupOverlayMovieThumbnail"}, - FunctionInfo{1106, nullptr, "Unknown1106"}, - FunctionInfo{1107, nullptr, "Unknown1107"}, - FunctionInfo{1201, nullptr, "OpenRawScreenShotReadStream"}, - FunctionInfo{1202, nullptr, "CloseRawScreenShotReadStream"}, - FunctionInfo{1203, nullptr, "ReadRawScreenShotReadStream"}, - FunctionInfo{1204, nullptr, "Unknown1204"} - ); }; } // namespace Service::Capture diff --git a/src/core/hle/service/caps/caps_ss.cpp b/src/core/hle/service/caps/caps_ss.cpp index 0c444116b7..0cd641f551 100644 --- a/src/core/hle/service/caps/caps_ss.cpp +++ b/src/core/hle/service/caps/caps_ss.cpp @@ -12,22 +12,22 @@ namespace Service::Capture { -std::optional IScreenShotService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{201, nullptr, "SaveScreenShot"}, - FunctionInfo{202, nullptr, "SaveEditedScreenShot"}, - FunctionInfo{203, C<&IScreenShotService::SaveScreenShotEx0>, "SaveScreenShotEx0"}, - FunctionInfo{204, nullptr, "SaveEditedScreenShotEx0"}, - FunctionInfo{206, C<&IScreenShotService::SaveEditedScreenShotEx1>, "SaveEditedScreenShotEx1"}, - FunctionInfo{208, nullptr, "SaveScreenShotOfMovieEx1"}, - FunctionInfo{1000, nullptr, "Unknown1000"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IScreenShotService::IScreenShotService(Core::System& system_, std::shared_ptr album_manager) : ServiceFramework{system_, "caps:ss"}, manager{album_manager} { + // clang-format off + static const FunctionInfo functions[] = { + {201, nullptr, "SaveScreenShot"}, + {202, nullptr, "SaveEditedScreenShot"}, + {203, C<&IScreenShotService::SaveScreenShotEx0>, "SaveScreenShotEx0"}, + {204, nullptr, "SaveEditedScreenShotEx0"}, + {206, C<&IScreenShotService::SaveEditedScreenShotEx1>, "SaveEditedScreenShotEx1"}, + {208, nullptr, "SaveScreenShotOfMovieEx1"}, + {1000, nullptr, "Unknown1000"}, + }; + // clang-format on + + RegisterHandlers(functions); } IScreenShotService::~IScreenShotService() = default; diff --git a/src/core/hle/service/caps/caps_ss.h b/src/core/hle/service/caps/caps_ss.h index 8817637fb8..78971bde0e 100644 --- a/src/core/hle/service/caps/caps_ss.h +++ b/src/core/hle/service/caps/caps_ss.h @@ -37,7 +37,6 @@ private: const InBuffer thumbnail_image_data_buffer); - std::optional FindRequest(u32 key) override; std::shared_ptr manager; }; diff --git a/src/core/hle/service/caps/caps_su.cpp b/src/core/hle/service/caps/caps_su.cpp index e708ddbb68..4ecfc840e4 100644 --- a/src/core/hle/service/caps/caps_su.cpp +++ b/src/core/hle/service/caps/caps_su.cpp @@ -15,20 +15,20 @@ namespace Service::Capture { -std::optional IScreenShotApplicationService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{32, C<&IScreenShotApplicationService::SetShimLibraryVersion>, "SetShimLibraryVersion"}, - FunctionInfo{201, nullptr, "SaveScreenShot"}, - FunctionInfo{203, C<&IScreenShotApplicationService::SaveScreenShotEx0>, "SaveScreenShotEx0"}, - FunctionInfo{205, C<&IScreenShotApplicationService::SaveScreenShotEx1>, "SaveScreenShotEx1"}, - FunctionInfo{210, nullptr, "SaveScreenShotEx2"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IScreenShotApplicationService::IScreenShotApplicationService( Core::System& system_, std::shared_ptr album_manager) : ServiceFramework{system_, "caps:su"}, manager{album_manager} { + // clang-format off + static const FunctionInfo functions[] = { + {32, C<&IScreenShotApplicationService::SetShimLibraryVersion>, "SetShimLibraryVersion"}, + {201, nullptr, "SaveScreenShot"}, + {203, C<&IScreenShotApplicationService::SaveScreenShotEx0>, "SaveScreenShotEx0"}, + {205, C<&IScreenShotApplicationService::SaveScreenShotEx1>, "SaveScreenShotEx1"}, + {210, nullptr, "SaveScreenShotEx2"}, + }; + // clang-format on + + RegisterHandlers(functions); } IScreenShotApplicationService::~IScreenShotApplicationService() = default; diff --git a/src/core/hle/service/caps/caps_su.h b/src/core/hle/service/caps/caps_su.h index 0fdc994a25..b7e53007ce 100644 --- a/src/core/hle/service/caps/caps_su.h +++ b/src/core/hle/service/caps/caps_su.h @@ -45,8 +45,8 @@ private: const InBuffer image_data_buffer); - std::optional FindRequest(u32 key) override; std::array image_data; + std::shared_ptr manager; }; diff --git a/src/core/hle/service/caps/caps_u.cpp b/src/core/hle/service/caps/caps_u.cpp index c1fa418e03..6472b2bac6 100644 --- a/src/core/hle/service/caps/caps_u.cpp +++ b/src/core/hle/service/caps/caps_u.cpp @@ -13,29 +13,29 @@ namespace Service::Capture { -std::optional IAlbumApplicationService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{32, C<&IAlbumApplicationService::SetShimLibraryVersion>, "SetShimLibraryVersion"}, - FunctionInfo{102, C<&IAlbumApplicationService::GetAlbumFileList0AafeAruidDeprecated>, "GetAlbumFileList0AafeAruidDeprecated"}, - FunctionInfo{103, nullptr, "DeleteAlbumFileByAruid"}, - FunctionInfo{104, nullptr, "GetAlbumFileSizeByAruid"}, - FunctionInfo{105, nullptr, "DeleteAlbumFileByAruidForDebug"}, - FunctionInfo{110, nullptr, "LoadAlbumScreenShotImageByAruid"}, - FunctionInfo{120, nullptr, "LoadAlbumScreenShotThumbnailImageByAruid"}, - FunctionInfo{130, nullptr, "PrecheckToCreateContentsByAruid"}, - FunctionInfo{140, nullptr, "GetAlbumFileList1AafeAruidDeprecated"}, - FunctionInfo{141, nullptr, "GetAlbumFileList2AafeUidAruidDeprecated"}, - FunctionInfo{142, C<&IAlbumApplicationService::GetAlbumFileList3AaeAruid>, "GetAlbumFileList3AaeAruid"}, - FunctionInfo{143, nullptr, "GetAlbumFileList4AaeUidAruid"}, - FunctionInfo{144, nullptr, "GetAllAlbumFileList3AaeAruid"}, - FunctionInfo{60002, nullptr, "OpenAccessorSessionForApplication"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IAlbumApplicationService::IAlbumApplicationService(Core::System& system_, std::shared_ptr album_manager) : ServiceFramework{system_, "caps:u"}, manager{album_manager} { + // clang-format off + static const FunctionInfo functions[] = { + {32, C<&IAlbumApplicationService::SetShimLibraryVersion>, "SetShimLibraryVersion"}, + {102, C<&IAlbumApplicationService::GetAlbumFileList0AafeAruidDeprecated>, "GetAlbumFileList0AafeAruidDeprecated"}, + {103, nullptr, "DeleteAlbumFileByAruid"}, + {104, nullptr, "GetAlbumFileSizeByAruid"}, + {105, nullptr, "DeleteAlbumFileByAruidForDebug"}, + {110, nullptr, "LoadAlbumScreenShotImageByAruid"}, + {120, nullptr, "LoadAlbumScreenShotThumbnailImageByAruid"}, + {130, nullptr, "PrecheckToCreateContentsByAruid"}, + {140, nullptr, "GetAlbumFileList1AafeAruidDeprecated"}, + {141, nullptr, "GetAlbumFileList2AafeUidAruidDeprecated"}, + {142, C<&IAlbumApplicationService::GetAlbumFileList3AaeAruid>, "GetAlbumFileList3AaeAruid"}, + {143, nullptr, "GetAlbumFileList4AaeUidAruid"}, + {144, nullptr, "GetAllAlbumFileList3AaeAruid"}, + {60002, nullptr, "OpenAccessorSessionForApplication"}, + }; + // clang-format on + + RegisterHandlers(functions); } IAlbumApplicationService::~IAlbumApplicationService() = default; diff --git a/src/core/hle/service/caps/caps_u.h b/src/core/hle/service/caps/caps_u.h index 52e151bbe2..debae97a46 100644 --- a/src/core/hle/service/caps/caps_u.h +++ b/src/core/hle/service/caps/caps_u.h @@ -36,7 +36,6 @@ private: AlbumFileDateTime end_date_time, ClientAppletResourceUserId aruid, OutArray out_entries); - std::optional FindRequest(u32 key) override; std::shared_ptr manager = nullptr; }; diff --git a/src/core/hle/service/cmif_types.h b/src/core/hle/service/cmif_types.h index dad358b87c..783bce7781 100644 --- a/src/core/hle/service/cmif_types.h +++ b/src/core/hle/service/cmif_types.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/erpt/erpt.cpp b/src/core/hle/service/erpt/erpt.cpp index 7bed893bd7..014f1da62f 100644 --- a/src/core/hle/service/erpt/erpt.cpp +++ b/src/core/hle/service/erpt/erpt.cpp @@ -17,10 +17,30 @@ namespace Service::ERPT { class ErrorReportContext final : public ServiceFramework { public: - explicit ErrorReportContext(Core::System& system_) : ServiceFramework{system_, "erpt:c"} {} + explicit ErrorReportContext(Core::System& system_) : ServiceFramework{system_, "erpt:c"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, C<&ErrorReportContext::SubmitContext>, "SubmitContext"}, + {1, C<&ErrorReportContext::CreateReportV0>, "CreateReportV0"}, + {2, nullptr, "SetInitialLaunchSettingsCompletionTime"}, + {3, nullptr, "ClearInitialLaunchSettingsCompletionTime"}, + {4, nullptr, "UpdatePowerOnTime"}, + {5, D<&ErrorReportContext::UpdateAwakeTime>, "UpdateAwakeTime"}, + {6, nullptr, "SubmitMultipleCategoryContext"}, + {7, nullptr, "UpdateApplicationLaunchTime"}, + {8, nullptr, "ClearApplicationLaunchTime"}, + {9, nullptr, "SubmitAttachment"}, + {10, nullptr, "CreateReportWithAttachments"}, + {11, C<&ErrorReportContext::CreateReportV1>, "CreateReportV1"}, + {12, C<&ErrorReportContext::CreateReport>, "CreateReport"}, + {20, nullptr, "RegisterRunningApplet"}, + {21, nullptr, "UnregisterRunningApplet"}, + {22, nullptr, "UpdateAppletSuspendedDuration"}, + {30, nullptr, "InvalidateForcedShutdownDetection"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -65,41 +85,21 @@ private: data_a.size(), data_b.size(), flag_a, flag_b); R_SUCCEED(); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&ErrorReportContext::SubmitContext>, "SubmitContext"}, - FunctionInfo{1, C<&ErrorReportContext::CreateReportV0>, "CreateReportV0"}, - FunctionInfo{2, nullptr, "SetInitialLaunchSettingsCompletionTime"}, - FunctionInfo{3, nullptr, "ClearInitialLaunchSettingsCompletionTime"}, - FunctionInfo{4, nullptr, "UpdatePowerOnTime"}, - FunctionInfo{5, D<&ErrorReportContext::UpdateAwakeTime>, "UpdateAwakeTime"}, - FunctionInfo{6, nullptr, "SubmitMultipleCategoryContext"}, - FunctionInfo{7, nullptr, "UpdateApplicationLaunchTime"}, - FunctionInfo{8, nullptr, "ClearApplicationLaunchTime"}, - FunctionInfo{9, nullptr, "SubmitAttachment"}, - FunctionInfo{10, nullptr, "CreateReportWithAttachments"}, - FunctionInfo{11, C<&ErrorReportContext::CreateReportV1>, "CreateReportV1"}, - FunctionInfo{12, C<&ErrorReportContext::CreateReport>, "CreateReport"}, - FunctionInfo{20, nullptr, "RegisterRunningApplet"}, - FunctionInfo{21, nullptr, "UnregisterRunningApplet"}, - FunctionInfo{22, nullptr, "UpdateAppletSuspendedDuration"}, - FunctionInfo{30, nullptr, "InvalidateForcedShutdownDetection"} - ); }; class ErrorReportSession final : public ServiceFramework { public: - explicit ErrorReportSession(Core::System& system_) : ServiceFramework{system_, "erpt:r"} {} + explicit ErrorReportSession(Core::System& system_) : ServiceFramework{system_, "erpt:r"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "OpenReport"}, + {1, nullptr, "OpenManager"}, + {2, nullptr, "OpenAttachment"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "OpenReport"}, - FunctionInfo{1, nullptr, "OpenManager"}, - FunctionInfo{2, nullptr, "OpenAttachment"} - ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/erpt/erpt.h b/src/core/hle/service/erpt/erpt.h index 60094f556e..456e9af910 100644 --- a/src/core/hle/service/erpt/erpt.h +++ b/src/core/hle/service/erpt/erpt.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/es/es.cpp b/src/core/hle/service/es/es.cpp index 01d11183c9..432783f96e 100644 --- a/src/core/hle/service/es/es.cpp +++ b/src/core/hle/service/es/es.cpp @@ -19,14 +19,110 @@ constexpr Result ERROR_INVALID_RIGHTS_ID{ErrorModule::ETicket, 3}; class ETicket final : public ServiceFramework { public: explicit ETicket(Core::System& system_) : ServiceFramework{system_, "es"} { + // clang-format off + static const FunctionInfo functions[] = { + {1, &ETicket::ImportTicket, "ImportTicket"}, + {2, nullptr, "ImportTicketCertificateSet"}, + {3, nullptr, "DeleteTicket"}, + {4, nullptr, "DeletePersonalizedTicket"}, + {5, nullptr, "DeleteAllCommonTicket"}, + {6, nullptr, "DeleteAllPersonalizedTicket"}, + {7, nullptr, "DeleteAllPersonalizedTicketEx"}, + {8, &ETicket::GetTitleKey, "GetTitleKey"}, + {9, &ETicket::CountCommonTicket, "CountCommonTicket"}, + {10, &ETicket::CountPersonalizedTicket, "CountPersonalizedTicket"}, + {11, &ETicket::ListCommonTicketRightsIds, "ListCommonTicketRightsIds"}, + {12, &ETicket::ListPersonalizedTicketRightsIds, "ListPersonalizedTicketRightsIds"}, + {13, nullptr, "ListMissingPersonalizedTicket"}, + {14, &ETicket::GetCommonTicketSize, "GetCommonTicketSize"}, + {15, &ETicket::GetPersonalizedTicketSize, "GetPersonalizedTicketSize"}, + {16, &ETicket::GetCommonTicketData, "GetCommonTicketData"}, + {17, &ETicket::GetPersonalizedTicketData, "GetPersonalizedTicketData"}, + {18, nullptr, "OwnTicket"}, + {19, nullptr, "GetTicketInfo"}, + {20, nullptr, "ListLightTicketInfo"}, + {21, nullptr, "SignData"}, + {22, nullptr, "GetCommonTicketAndCertificateSize"}, + {23, nullptr, "GetCommonTicketAndCertificateData"}, + {24, nullptr, "ImportPrepurchaseRecord"}, + {25, nullptr, "DeletePrepurchaseRecord"}, + {26, nullptr, "DeleteAllPrepurchaseRecord"}, + {27, nullptr, "CountPrepurchaseRecord"}, + {28, nullptr, "ListPrepurchaseRecordRightsIds"}, + {29, nullptr, "ListPrepurchaseRecordInfo"}, + {30, nullptr, "CountTicket"}, + {31, nullptr, "ListTicketRightsIds"}, + {32, nullptr, "CountPrepurchaseRecordEx"}, + {33, nullptr, "ListPrepurchaseRecordRightsIdsEx"}, + {34, nullptr, "GetEncryptedTicketSize"}, + {35, nullptr, "GetEncryptedTicketData"}, + {36, nullptr, "DeleteAllInactiveELicenseRequiredPersonalizedTicket"}, + {37, nullptr, "OwnTicket2"}, + {38, nullptr, "OwnTicket3"}, + {39, nullptr, "DeleteAllInactivePersonalizedTicket"}, + {40, nullptr, "DeletePrepurchaseRecordByNintendoAccountId"}, + {101, nullptr, "Unknown101"}, //18.0.0+ + {102, nullptr, "Unknown102"}, //18.0.0+ + {103, nullptr, "Unknown103"}, //18.0.0+ + {104, nullptr, "Unknown104"}, //18.0.0+ + {105, nullptr, "Unknown105"}, //20.0.0+ + {201, nullptr, "Unknown201"}, //18.0.0+ + {202, nullptr, "Unknown202"}, //18.0.0+ + {203, nullptr, "Unknown203"}, //18.0.0+ + {204, nullptr, "Unknown204"}, //18.0.0+ + {205, nullptr, "Unknown205"}, //18.0.0+ + {501, nullptr, "Unknown501"}, + {502, nullptr, "Unknown502"}, + {503, nullptr, "GetTitleKey"}, + {504, nullptr, "Unknown504"}, + {508, nullptr, "Unknown508"}, + {509, nullptr, "Unknown509"}, + {510, nullptr, "Unknown510"}, + {511, nullptr, "Unknown511"}, + {1001, nullptr, "Unknown1001"}, + {1002, nullptr, "Unknown1001"}, + {1003, nullptr, "Unknown1003"}, + {1004, nullptr, "Unknown1004"}, + {1005, nullptr, "Unknown1005"}, + {1006, nullptr, "Unknown1006"}, + {1007, nullptr, "Unknown1007"}, + {1009, nullptr, "Unknown1009"}, + {1010, nullptr, "Unknown1010"}, + {1011, nullptr, "Unknown1011"}, + {1012, nullptr, "Unknown1012"}, + {1013, nullptr, "Unknown1013"}, + {1014, nullptr, "Unknown1014"}, + {1015, nullptr, "Unknown1015"}, + {1016, nullptr, "Unknown1016"}, + {1017, nullptr, "Unknown1017"}, + {1018, nullptr, "Unknown1018"}, + {1019, nullptr, "Unknown1019"}, + {1020, nullptr, "Unknown1020"}, + {1021, nullptr, "Unknown1021"}, + {1501, nullptr, "Unknown1501"}, + {1502, nullptr, "Unknown1502"}, + {1503, nullptr, "Unknown1503"}, + {1504, nullptr, "Unknown1504"}, + {1505, nullptr, "Unknown1505"}, + {1506, nullptr, "Unknown1506"}, + {2000, nullptr, "Unknown2000"}, + {2001, nullptr, "Unknown2001"}, + {2002, nullptr, "Unknown2002"}, + {2003, nullptr, "Unknown2003"}, + {2100, nullptr, "Unknown2100"}, + {2501, nullptr, "Unknown2501"}, + {2502, nullptr, "Unknown2502"}, + {2601, nullptr, "Unknown2601"}, + {3001, nullptr, "Unknown3001"}, + {3002, nullptr, "Unknown3002"}, + }; + // clang-format on + RegisterHandlers(functions); + keys.PopulateTickets(); keys.SynthesizeTickets(); } - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - private: bool CheckRightsId(HLERequestContext& ctx, const u128& rights_id) { if (rights_id == u128{}) { @@ -221,185 +317,89 @@ private: rb.Push(write_size); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{1, &ETicket::ImportTicket, "ImportTicket"}, - FunctionInfo{2, nullptr, "ImportTicketCertificateSet"}, - FunctionInfo{3, nullptr, "DeleteTicket"}, - FunctionInfo{4, nullptr, "DeletePersonalizedTicket"}, - FunctionInfo{5, nullptr, "DeleteAllCommonTicket"}, - FunctionInfo{6, nullptr, "DeleteAllPersonalizedTicket"}, - FunctionInfo{7, nullptr, "DeleteAllPersonalizedTicketEx"}, - FunctionInfo{8, &ETicket::GetTitleKey, "GetTitleKey"}, - FunctionInfo{9, &ETicket::CountCommonTicket, "CountCommonTicket"}, - FunctionInfo{10, &ETicket::CountPersonalizedTicket, "CountPersonalizedTicket"}, - FunctionInfo{11, &ETicket::ListCommonTicketRightsIds, "ListCommonTicketRightsIds"}, - FunctionInfo{12, &ETicket::ListPersonalizedTicketRightsIds, "ListPersonalizedTicketRightsIds"}, - FunctionInfo{13, nullptr, "ListMissingPersonalizedTicket"}, - FunctionInfo{14, &ETicket::GetCommonTicketSize, "GetCommonTicketSize"}, - FunctionInfo{15, &ETicket::GetPersonalizedTicketSize, "GetPersonalizedTicketSize"}, - FunctionInfo{16, &ETicket::GetCommonTicketData, "GetCommonTicketData"}, - FunctionInfo{17, &ETicket::GetPersonalizedTicketData, "GetPersonalizedTicketData"}, - FunctionInfo{18, nullptr, "OwnTicket"}, - FunctionInfo{19, nullptr, "GetTicketInfo"}, - FunctionInfo{20, nullptr, "ListLightTicketInfo"}, - FunctionInfo{21, nullptr, "SignData"}, - FunctionInfo{22, nullptr, "GetCommonTicketAndCertificateSize"}, - FunctionInfo{23, nullptr, "GetCommonTicketAndCertificateData"}, - FunctionInfo{24, nullptr, "ImportPrepurchaseRecord"}, - FunctionInfo{25, nullptr, "DeletePrepurchaseRecord"}, - FunctionInfo{26, nullptr, "DeleteAllPrepurchaseRecord"}, - FunctionInfo{27, nullptr, "CountPrepurchaseRecord"}, - FunctionInfo{28, nullptr, "ListPrepurchaseRecordRightsIds"}, - FunctionInfo{29, nullptr, "ListPrepurchaseRecordInfo"}, - FunctionInfo{30, nullptr, "CountTicket"}, - FunctionInfo{31, nullptr, "ListTicketRightsIds"}, - FunctionInfo{32, nullptr, "CountPrepurchaseRecordEx"}, - FunctionInfo{33, nullptr, "ListPrepurchaseRecordRightsIdsEx"}, - FunctionInfo{34, nullptr, "GetEncryptedTicketSize"}, - FunctionInfo{35, nullptr, "GetEncryptedTicketData"}, - FunctionInfo{36, nullptr, "DeleteAllInactiveELicenseRequiredPersonalizedTicket"}, - FunctionInfo{37, nullptr, "OwnTicket2"}, - FunctionInfo{38, nullptr, "OwnTicket3"}, - FunctionInfo{39, nullptr, "DeleteAllInactivePersonalizedTicket"}, - FunctionInfo{40, nullptr, "DeletePrepurchaseRecordByNintendoAccountId"}, - FunctionInfo{101, nullptr, "Unknown101", MakeVersionGate({18,0,0})}, - FunctionInfo{102, nullptr, "Unknown102", MakeVersionGate({18,0,0})}, - FunctionInfo{103, nullptr, "Unknown103", MakeVersionGate({18,0,0})}, - FunctionInfo{104, nullptr, "Unknown104", MakeVersionGate({18,0,0})}, - FunctionInfo{105, nullptr, "Unknown105", MakeVersionGate({20,0,0})}, - FunctionInfo{201, nullptr, "Unknown201", MakeVersionGate({18,0,0})}, - FunctionInfo{202, nullptr, "Unknown202", MakeVersionGate({18,0,0})}, - FunctionInfo{203, nullptr, "Unknown203", MakeVersionGate({18,0,0})}, - FunctionInfo{204, nullptr, "Unknown204", MakeVersionGate({18,0,0})}, - FunctionInfo{205, nullptr, "Unknown205", MakeVersionGate({18,0,0})}, - FunctionInfo{501, nullptr, "Unknown501"}, - FunctionInfo{502, nullptr, "Unknown502"}, - FunctionInfo{503, nullptr, "GetTitleKey"}, - FunctionInfo{504, nullptr, "Unknown504"}, - FunctionInfo{508, nullptr, "Unknown508"}, - FunctionInfo{509, nullptr, "Unknown509"}, - FunctionInfo{510, nullptr, "Unknown510"}, - FunctionInfo{511, nullptr, "Unknown511"}, - FunctionInfo{1001, nullptr, "Unknown1001"}, - FunctionInfo{1002, nullptr, "Unknown1001"}, - FunctionInfo{1003, nullptr, "Unknown1003"}, - FunctionInfo{1004, nullptr, "Unknown1004"}, - FunctionInfo{1005, nullptr, "Unknown1005"}, - FunctionInfo{1006, nullptr, "Unknown1006"}, - FunctionInfo{1007, nullptr, "Unknown1007"}, - FunctionInfo{1009, nullptr, "Unknown1009"}, - FunctionInfo{1010, nullptr, "Unknown1010"}, - FunctionInfo{1011, nullptr, "Unknown1011"}, - FunctionInfo{1012, nullptr, "Unknown1012"}, - FunctionInfo{1013, nullptr, "Unknown1013"}, - FunctionInfo{1014, nullptr, "Unknown1014"}, - FunctionInfo{1015, nullptr, "Unknown1015"}, - FunctionInfo{1016, nullptr, "Unknown1016"}, - FunctionInfo{1017, nullptr, "Unknown1017"}, - FunctionInfo{1018, nullptr, "Unknown1018"}, - FunctionInfo{1019, nullptr, "Unknown1019"}, - FunctionInfo{1020, nullptr, "Unknown1020"}, - FunctionInfo{1021, nullptr, "Unknown1021"}, - FunctionInfo{1501, nullptr, "Unknown1501"}, - FunctionInfo{1502, nullptr, "Unknown1502"}, - FunctionInfo{1503, nullptr, "Unknown1503"}, - FunctionInfo{1504, nullptr, "Unknown1504"}, - FunctionInfo{1505, nullptr, "Unknown1505"}, - FunctionInfo{1506, nullptr, "Unknown1506"}, - FunctionInfo{2000, nullptr, "Unknown2000"}, - FunctionInfo{2001, nullptr, "Unknown2001"}, - FunctionInfo{2002, nullptr, "Unknown2002"}, - FunctionInfo{2003, nullptr, "Unknown2003"}, - FunctionInfo{2100, nullptr, "Unknown2100"}, - FunctionInfo{2501, nullptr, "Unknown2501"}, - FunctionInfo{2502, nullptr, "Unknown2502"}, - FunctionInfo{2601, nullptr, "Unknown2601"}, - FunctionInfo{3001, nullptr, "Unknown3001"}, - FunctionInfo{3002, nullptr, "Unknown3002"} - ); Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance(); }; class NDRM_LU final : public ServiceFramework { public: explicit NDRM_LU(Core::System& system_) - : ServiceFramework{system_, "ndrm:lu"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{1, nullptr, "Cmd1"}, - FunctionInfo{2, nullptr, "Cmd2"}, - FunctionInfo{3, nullptr, "Cmd3"}, - FunctionInfo{1000, nullptr, "Cmd1000"}, - FunctionInfo{8000, nullptr, "Cmd8000"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + : ServiceFramework{system_, "ndrm:lu"} { + // clang-format off + static const FunctionInfo functions[] = { + {1, nullptr, "Cmd1"}, + {2, nullptr, "Cmd2"}, + {3, nullptr, "Cmd3"}, + {1000, nullptr, "Cmd1000"}, + {8000, nullptr, "Cmd8000"}, + }; + // clang-format on + RegisterHandlers(functions); } }; class NDRM_LA final : public ServiceFramework { public: explicit NDRM_LA(Core::System& system_) - : ServiceFramework{system_, "ndrm:la"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{1, nullptr, "Cmd1"}, - FunctionInfo{2, nullptr, "Cmd2"}, - FunctionInfo{3, nullptr, "Cmd3"}, - FunctionInfo{4, nullptr, "Cmd4"}, - FunctionInfo{5, nullptr, "Cmd5"}, - FunctionInfo{6, nullptr, "Cmd6"}, - FunctionInfo{7, nullptr, "Cmd7"}, - FunctionInfo{8, nullptr, "Cmd8"}, - FunctionInfo{9, nullptr, "Cmd9"}, - FunctionInfo{10, nullptr, "Cmd10"}, - FunctionInfo{11, nullptr, "Cmd11"}, - FunctionInfo{12, nullptr, "Cmd12"}, - FunctionInfo{13, nullptr, "Cmd13"}, - FunctionInfo{14, nullptr, "Cmd14"}, - FunctionInfo{15, nullptr, "Cmd15"}, - FunctionInfo{16, nullptr, "Cmd16"}, - FunctionInfo{17, nullptr, "Cmd17"}, - FunctionInfo{18, nullptr, "Cmd18"}, - FunctionInfo{19, nullptr, "Cmd19"}, - FunctionInfo{20, nullptr, "Cmd20"}, - FunctionInfo{21, nullptr, "Cmd21"}, - FunctionInfo{22, nullptr, "Cmd22"}, - FunctionInfo{23, nullptr, "Cmd23"}, - FunctionInfo{24, nullptr, "Cmd24"}, - FunctionInfo{25, nullptr, "Cmd25"}, - FunctionInfo{26, nullptr, "Cmd26"}, - FunctionInfo{27, nullptr, "Cmd27"}, - FunctionInfo{28, nullptr, "Cmd28"}, - FunctionInfo{29, nullptr, "Cmd29"}, - FunctionInfo{30, nullptr, "Cmd30"}, - FunctionInfo{31, nullptr, "Cmd31"}, - FunctionInfo{32, nullptr, "Cmd32"}, - FunctionInfo{33, nullptr, "Cmd33"}, - FunctionInfo{34, nullptr, "Cmd34"}, - FunctionInfo{35, nullptr, "Cmd35"}, - FunctionInfo{36, nullptr, "Cmd36"}, - FunctionInfo{37, nullptr, "Cmd37"}, - FunctionInfo{38, nullptr, "Cmd38"}, - FunctionInfo{39, nullptr, "Cmd39"}, - FunctionInfo{40, nullptr, "Cmd40"}, - FunctionInfo{42, nullptr, "Cmd42"}, - FunctionInfo{43, nullptr, "Cmd43"}, - FunctionInfo{44, nullptr, "Cmd44"}, - FunctionInfo{45, nullptr, "Cmd45"}, - FunctionInfo{46, nullptr, "Cmd46"}, - FunctionInfo{47, nullptr, "Cmd47"}, - FunctionInfo{48, nullptr, "Cmd48"}, - FunctionInfo{49, nullptr, "Cmd49"}, - FunctionInfo{50, nullptr, "Cmd50"}, - FunctionInfo{51, nullptr, "Cmd51"}, - FunctionInfo{8000, nullptr, "Cmd8000"}, - FunctionInfo{8001, nullptr, "Cmd8001"}, - FunctionInfo{8002, nullptr, "Cmd8002"}, - FunctionInfo{8003, nullptr, "Cmd8003"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + : ServiceFramework{system_, "ndrm:la"} { + // clang-format off + static const FunctionInfo functions[] = { + {1, nullptr, "Cmd1"}, + {2, nullptr, "Cmd2"}, + {3, nullptr, "Cmd3"}, + {4, nullptr, "Cmd4"}, + {5, nullptr, "Cmd5"}, + {6, nullptr, "Cmd6"}, + {7, nullptr, "Cmd7"}, + {8, nullptr, "Cmd8"}, + {9, nullptr, "Cmd9"}, + {10, nullptr, "Cmd10"}, + {11, nullptr, "Cmd11"}, + {12, nullptr, "Cmd12"}, + {13, nullptr, "Cmd13"}, + {14, nullptr, "Cmd14"}, + {15, nullptr, "Cmd15"}, + {16, nullptr, "Cmd16"}, + {17, nullptr, "Cmd17"}, + {18, nullptr, "Cmd18"}, + {19, nullptr, "Cmd19"}, + {20, nullptr, "Cmd20"}, + {21, nullptr, "Cmd21"}, + {22, nullptr, "Cmd22"}, + {23, nullptr, "Cmd23"}, + {24, nullptr, "Cmd24"}, + {25, nullptr, "Cmd25"}, + {26, nullptr, "Cmd26"}, + {27, nullptr, "Cmd27"}, + {28, nullptr, "Cmd28"}, + {29, nullptr, "Cmd29"}, + {30, nullptr, "Cmd30"}, + {31, nullptr, "Cmd31"}, + {32, nullptr, "Cmd32"}, + {33, nullptr, "Cmd33"}, + {34, nullptr, "Cmd34"}, + {35, nullptr, "Cmd35"}, + {36, nullptr, "Cmd36"}, + {37, nullptr, "Cmd37"}, + {38, nullptr, "Cmd38"}, + {39, nullptr, "Cmd39"}, + {40, nullptr, "Cmd40"}, + {42, nullptr, "Cmd42"}, + {43, nullptr, "Cmd43"}, + {44, nullptr, "Cmd44"}, + {45, nullptr, "Cmd45"}, + {46, nullptr, "Cmd46"}, + {47, nullptr, "Cmd47"}, + {48, nullptr, "Cmd48"}, + {49, nullptr, "Cmd49"}, + {50, nullptr, "Cmd50"}, + {51, nullptr, "Cmd51"}, + {8000, nullptr, "Cmd8000"}, + {8001, nullptr, "Cmd8001"}, + {8002, nullptr, "Cmd8002"}, + {8003, nullptr, "Cmd8003"}, + }; + // clang-format on + RegisterHandlers(functions); } }; diff --git a/src/core/hle/service/es/es.h b/src/core/hle/service/es/es.h index 3176806252..215aadb98f 100644 --- a/src/core/hle/service/es/es.h +++ b/src/core/hle/service/es/es.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/eupld/eupld.cpp b/src/core/hle/service/eupld/eupld.cpp index ed1e1c19c5..9b26ae9c83 100644 --- a/src/core/hle/service/eupld/eupld.cpp +++ b/src/core/hle/service/eupld/eupld.cpp @@ -14,34 +14,36 @@ namespace Service::EUPLD { class ErrorUploadContext final : public ServiceFramework { public: - explicit ErrorUploadContext(Core::System& system_) : ServiceFramework{system_, "eupld:c"} {} + explicit ErrorUploadContext(Core::System& system_) : ServiceFramework{system_, "eupld:c"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "SetUrl"}, + {1, nullptr, "ImportCrt"}, + {2, nullptr, "ImportPki"}, + {3, nullptr, "SetAutoUpload"}, + {4, nullptr, "GetAutoUpload"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "SetUrl"}, - FunctionInfo{1, nullptr, "ImportCrt"}, - FunctionInfo{2, nullptr, "ImportPki"}, - FunctionInfo{3, nullptr, "SetAutoUpload"}, - FunctionInfo{4, nullptr, "GetAutoUpload"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; class ErrorUploadRequest final : public ServiceFramework { public: - explicit ErrorUploadRequest(Core::System& system_) : ServiceFramework{system_, "eupld:r"} {} + explicit ErrorUploadRequest(Core::System& system_) : ServiceFramework{system_, "eupld:r"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "Initialize"}, + {1, nullptr, "UploadAll"}, + {2, nullptr, "UploadSelected"}, + {3, nullptr, "GetUploadStatus"}, + {4, nullptr, "CancelUpload"}, + {5, nullptr, "GetResult"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "Initialize"}, - FunctionInfo{1, nullptr, "UploadAll"}, - FunctionInfo{2, nullptr, "UploadSelected"}, - FunctionInfo{3, nullptr, "GetUploadStatus"}, - FunctionInfo{4, nullptr, "CancelUpload"}, - FunctionInfo{5, nullptr, "GetResult"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; diff --git a/src/core/hle/service/eupld/eupld.h b/src/core/hle/service/eupld/eupld.h index 8eb0a5b4f2..851e286733 100644 --- a/src/core/hle/service/eupld/eupld.h +++ b/src/core/hle/service/eupld/eupld.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/fatal/fatal.cpp b/src/core/hle/service/fatal/fatal.cpp index 4c9eca5d5b..db48526614 100644 --- a/src/core/hle/service/fatal/fatal.cpp +++ b/src/core/hle/service/fatal/fatal.cpp @@ -13,6 +13,8 @@ #include "common/swap.h" #include "core/core.h" #include "core/hle/service/fatal/fatal.h" +#include "core/hle/service/fatal/fatal_p.h" +#include "core/hle/service/fatal/fatal_u.h" #include "core/hle/service/ipc_helpers.h" #include "core/hle/service/server_manager.h" #include "core/reporter.h" @@ -165,35 +167,6 @@ void Module::Interface::ThrowFatalWithCpuContext(HLERequestContext& ctx) { rb.Push(ResultSuccess); } -class Fatal_P final : public Module::Interface { -public: - explicit Fatal_P(std::shared_ptr module_, Core::System& system_) : Interface(std::move(module_), system_, "fatal:p") {} - ~Fatal_P() override = default; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetFatalEvent"}, - FunctionInfo{10, nullptr, "GetFatalContext"} - ); -}; - -class Fatal_U final : public Module::Interface { -public: - explicit Fatal_U(std::shared_ptr module_, Core::System& system_) : Interface(std::move(module_), system_, "fatal:u") {} - ~Fatal_U() override = default; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &Fatal_U::ThrowFatal, "ThrowFatal"}, - FunctionInfo{1, &Fatal_U::ThrowFatalWithPolicy, "ThrowFatalWithPolicy"}, - FunctionInfo{2, &Fatal_U::ThrowFatalWithCpuContext, "ThrowFatalWithCpuContext"} - ); -}; - void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); auto module = std::make_shared(); diff --git a/src/core/hle/service/fatal/fatal.h b/src/core/hle/service/fatal/fatal.h index f1c1104060..176ad8d0d9 100644 --- a/src/core/hle/service/fatal/fatal.h +++ b/src/core/hle/service/fatal/fatal.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/fatal/fatal_p.cpp b/src/core/hle/service/fatal/fatal_p.cpp new file mode 100644 index 0000000000..345743d6bc --- /dev/null +++ b/src/core/hle/service/fatal/fatal_p.cpp @@ -0,0 +1,22 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/hle/service/fatal/fatal_p.h" + +namespace Service::Fatal { + +Fatal_P::Fatal_P(std::shared_ptr module_, Core::System& system_) + : Interface(std::move(module_), system_, "fatal:p") { + static const FunctionInfo functions[] = { + {0, nullptr, "GetFatalEvent"}, + {10, nullptr, "GetFatalContext"}, + }; + RegisterHandlers(functions); +} + +Fatal_P::~Fatal_P() = default; + +} // namespace Service::Fatal diff --git a/src/core/hle/service/fatal/fatal_p.h b/src/core/hle/service/fatal/fatal_p.h new file mode 100644 index 0000000000..ea2183c125 --- /dev/null +++ b/src/core/hle/service/fatal/fatal_p.h @@ -0,0 +1,19 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/fatal/fatal.h" + +namespace Service::Fatal { + +class Fatal_P final : public Module::Interface { +public: + explicit Fatal_P(std::shared_ptr module_, Core::System& system_); + ~Fatal_P() override; +}; + +} // namespace Service::Fatal diff --git a/src/core/hle/service/fatal/fatal_u.cpp b/src/core/hle/service/fatal/fatal_u.cpp new file mode 100644 index 0000000000..b2850c3e62 --- /dev/null +++ b/src/core/hle/service/fatal/fatal_u.cpp @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/hle/service/fatal/fatal_u.h" + +namespace Service::Fatal { + +Fatal_U::Fatal_U(std::shared_ptr module_, Core::System& system_) + : Interface(std::move(module_), system_, "fatal:u") { + static const FunctionInfo functions[] = { + {0, &Fatal_U::ThrowFatal, "ThrowFatal"}, + {1, &Fatal_U::ThrowFatalWithPolicy, "ThrowFatalWithPolicy"}, + {2, &Fatal_U::ThrowFatalWithCpuContext, "ThrowFatalWithCpuContext"}, + }; + RegisterHandlers(functions); +} + +Fatal_U::~Fatal_U() = default; + +} // namespace Service::Fatal diff --git a/src/core/hle/service/fatal/fatal_u.h b/src/core/hle/service/fatal/fatal_u.h new file mode 100644 index 0000000000..4d193857d0 --- /dev/null +++ b/src/core/hle/service/fatal/fatal_u.h @@ -0,0 +1,19 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/fatal/fatal.h" + +namespace Service::Fatal { + +class Fatal_U final : public Module::Interface { +public: + explicit Fatal_U(std::shared_ptr module_, Core::System& system_); + ~Fatal_U() override; +}; + +} // namespace Service::Fatal diff --git a/src/core/hle/service/fgm/fgm.cpp b/src/core/hle/service/fgm/fgm.cpp index 96ea3478ea..cac03ae24c 100644 --- a/src/core/hle/service/fgm/fgm.cpp +++ b/src/core/hle/service/fgm/fgm.cpp @@ -16,26 +16,30 @@ namespace Service::FGM { class IRequest final : public ServiceFramework { public: - explicit IRequest(Core::System& system_) : ServiceFramework{system_, "IRequest"} {} + explicit IRequest(Core::System& system_) : ServiceFramework{system_, "IRequest"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "Initialize"}, + {1, nullptr, "Set"}, + {2, nullptr, "Get"}, + {3, nullptr, "Cancel"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "Initialize"}, - FunctionInfo{1, nullptr, "Set"}, - FunctionInfo{2, nullptr, "Get"}, - FunctionInfo{3, nullptr, "Cancel"} - ); }; class FGM final : public ServiceFramework { public: - explicit FGM(Core::System& system_, const char* name) : ServiceFramework{system_, name} {} + explicit FGM(Core::System& system_, const char* name) : ServiceFramework{system_, name} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &FGM::Initialize, "Initialize"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -46,25 +50,21 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &FGM::Initialize, "Initialize"} - ); }; class FGM_DBG final : public ServiceFramework { public: - explicit FGM_DBG(Core::System& system_) : ServiceFramework{system_, "fgm:dbg"} {} + explicit FGM_DBG(Core::System& system_) : ServiceFramework{system_, "fgm:dbg"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "Initialize"}, + {1, nullptr, "Read"}, + {2, nullptr, "Cancel"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "Initialize"}, - FunctionInfo{1, nullptr, "Read"}, - FunctionInfo{2, nullptr, "Cancel"} - ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/fgm/fgm.h b/src/core/hle/service/fgm/fgm.h index 9d2465c0fb..89ef7096bb 100644 --- a/src/core/hle/service/fgm/fgm.h +++ b/src/core/hle/service/fgm/fgm.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/filesystem/fsp/fs_i_directory.cpp b/src/core/hle/service/filesystem/fsp/fs_i_directory.cpp index 793b86cc51..c4e3c81f22 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_directory.cpp +++ b/src/core/hle/service/filesystem/fsp/fs_i_directory.cpp @@ -11,18 +11,15 @@ namespace Service::FileSystem { -std::optional IDirectory::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IDirectory::Read>, "Read"}, - FunctionInfo{1, D<&IDirectory::GetEntryCount>, "GetEntryCount"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IDirectory::IDirectory(Core::System& system_, FileSys::VirtualDir directory_, FileSys::OpenDirectoryMode mode) : ServiceFramework{system_, "IDirectory"}, backend(std::make_unique(directory_, mode)) { + static const FunctionInfo functions[] = { + {0, D<&IDirectory::Read>, "Read"}, + {1, D<&IDirectory::GetEntryCount>, "GetEntryCount"}, + }; + RegisterHandlers(functions); } Result IDirectory::Read( diff --git a/src/core/hle/service/filesystem/fsp/fs_i_directory.h b/src/core/hle/service/filesystem/fsp/fs_i_directory.h index f2a57260e1..79256604f3 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_directory.h +++ b/src/core/hle/service/filesystem/fsp/fs_i_directory.h @@ -29,8 +29,6 @@ private: Result Read(Out out_count, const OutArray out_entries); Result GetEntryCount(Out out_count); - - std::optional FindRequest(u32 key) override; }; } // namespace Service::FileSystem diff --git a/src/core/hle/service/filesystem/fsp/fs_i_file.cpp b/src/core/hle/service/filesystem/fsp/fs_i_file.cpp index 78ca90a4af..22cbe2be2c 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_file.cpp +++ b/src/core/hle/service/filesystem/fsp/fs_i_file.cpp @@ -12,6 +12,18 @@ namespace Service::FileSystem { IFile::IFile(Core::System& system_, FileSys::VirtualFile file_) : ServiceFramework{system_, "IFile"}, backend{std::make_unique(file_)} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IFile::Read>, "Read"}, + {1, D<&IFile::Write>, "Write"}, + {2, D<&IFile::Flush>, "Flush"}, + {3, D<&IFile::SetSize>, "SetSize"}, + {4, D<&IFile::GetSize>, "GetSize"}, + {5, nullptr, "OperateRange"}, + {6, nullptr, "OperateRangeWithBuffer"}, + }; + // clang-format on + RegisterHandlers(functions); } Result IFile::Read( diff --git a/src/core/hle/service/filesystem/fsp/fs_i_file.h b/src/core/hle/service/filesystem/fsp/fs_i_file.h index 992330e149..14348f7fc6 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_file.h +++ b/src/core/hle/service/filesystem/fsp/fs_i_file.h @@ -30,19 +30,6 @@ private: Result Flush(); Result SetSize(s64 size); Result GetSize(Out out_size); - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IFile::Read>, "Read"}, - FunctionInfo{1, D<&IFile::Write>, "Write"}, - FunctionInfo{2, D<&IFile::Flush>, "Flush"}, - FunctionInfo{3, D<&IFile::SetSize>, "SetSize"}, - FunctionInfo{4, D<&IFile::GetSize>, "GetSize"}, - FunctionInfo{5, nullptr, "OperateRange"}, - FunctionInfo{6, nullptr, "OperateRangeWithBuffer"} - ); }; } // namespace Service::FileSystem diff --git a/src/core/hle/service/filesystem/fsp/fs_i_filesystem.cpp b/src/core/hle/service/filesystem/fsp/fs_i_filesystem.cpp index 6ab4916a36..edd381f57c 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_filesystem.cpp +++ b/src/core/hle/service/filesystem/fsp/fs_i_filesystem.cpp @@ -13,33 +13,30 @@ namespace Service::FileSystem { -std::optional IFileSystem::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IFileSystem::CreateFile>, "CreateFile"}, - FunctionInfo{1, D<&IFileSystem::DeleteFile>, "DeleteFile"}, - FunctionInfo{2, D<&IFileSystem::CreateDirectory>, "CreateDirectory"}, - FunctionInfo{3, D<&IFileSystem::DeleteDirectory>, "DeleteDirectory"}, - FunctionInfo{4, D<&IFileSystem::DeleteDirectoryRecursively>, "DeleteDirectoryRecursively"}, - FunctionInfo{5, D<&IFileSystem::RenameFile>, "RenameFile"}, - FunctionInfo{6, D<&IFileSystem::RenameDirectory>, "RenameDirectory"}, - FunctionInfo{7, D<&IFileSystem::GetEntryType>, "GetEntryType"}, - FunctionInfo{8, D<&IFileSystem::OpenFile>, "OpenFile"}, - FunctionInfo{9, D<&IFileSystem::OpenDirectory>, "OpenDirectory"}, - FunctionInfo{10, D<&IFileSystem::Commit>, "Commit"}, - FunctionInfo{11, D<&IFileSystem::GetFreeSpaceSize>, "GetFreeSpaceSize"}, - FunctionInfo{12, D<&IFileSystem::GetTotalSpaceSize>, "GetTotalSpaceSize"}, - FunctionInfo{13, D<&IFileSystem::CleanDirectoryRecursively>, "CleanDirectoryRecursively"}, - FunctionInfo{14, D<&IFileSystem::GetFileTimeStampRaw>, "GetFileTimeStampRaw"}, - FunctionInfo{15, nullptr, "QueryEntry"}, - FunctionInfo{16, D<&IFileSystem::GetFileSystemAttribute>, "GetFileSystemAttribute"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IFileSystem::IFileSystem(Core::System& system_, FileSys::VirtualDir dir_, SizeGetter size_getter_) : ServiceFramework{system_, "IFileSystem"}, backend{std::make_unique( dir_)}, size_getter{std::move(size_getter_)} { + static const FunctionInfo functions[] = { + {0, D<&IFileSystem::CreateFile>, "CreateFile"}, + {1, D<&IFileSystem::DeleteFile>, "DeleteFile"}, + {2, D<&IFileSystem::CreateDirectory>, "CreateDirectory"}, + {3, D<&IFileSystem::DeleteDirectory>, "DeleteDirectory"}, + {4, D<&IFileSystem::DeleteDirectoryRecursively>, "DeleteDirectoryRecursively"}, + {5, D<&IFileSystem::RenameFile>, "RenameFile"}, + {6, D<&IFileSystem::RenameDirectory>, "RenameDirectory"}, + {7, D<&IFileSystem::GetEntryType>, "GetEntryType"}, + {8, D<&IFileSystem::OpenFile>, "OpenFile"}, + {9, D<&IFileSystem::OpenDirectory>, "OpenDirectory"}, + {10, D<&IFileSystem::Commit>, "Commit"}, + {11, D<&IFileSystem::GetFreeSpaceSize>, "GetFreeSpaceSize"}, + {12, D<&IFileSystem::GetTotalSpaceSize>, "GetTotalSpaceSize"}, + {13, D<&IFileSystem::CleanDirectoryRecursively>, "CleanDirectoryRecursively"}, + {14, D<&IFileSystem::GetFileTimeStampRaw>, "GetFileTimeStampRaw"}, + {15, nullptr, "QueryEntry"}, + {16, D<&IFileSystem::GetFileSystemAttribute>, "GetFileSystemAttribute"}, + }; + RegisterHandlers(functions); } Result IFileSystem::CreateFile(const InLargeData path, diff --git a/src/core/hle/service/filesystem/fsp/fs_i_filesystem.h b/src/core/hle/service/filesystem/fsp/fs_i_filesystem.h index 11d3c7fb31..ed03c3ef83 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_filesystem.h +++ b/src/core/hle/service/filesystem/fsp/fs_i_filesystem.h @@ -58,7 +58,6 @@ public: Result GetFileSystemAttribute(Out out_attribute); private: - std::optional FindRequest(u32 key) override; std::unique_ptr backend; SizeGetter size_getter; }; diff --git a/src/core/hle/service/filesystem/fsp/fs_i_multi_commit_manager.cpp b/src/core/hle/service/filesystem/fsp/fs_i_multi_commit_manager.cpp index f6eac6ca10..4af0a4ea2d 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_multi_commit_manager.cpp +++ b/src/core/hle/service/filesystem/fsp/fs_i_multi_commit_manager.cpp @@ -12,6 +12,11 @@ namespace Service::FileSystem { IMultiCommitManager::IMultiCommitManager(Core::System& system_) : ServiceFramework{system_, "IMultiCommitManager"} { + static const FunctionInfo functions[] = { + {1, D<&IMultiCommitManager::Add>, "Add"}, + {2, D<&IMultiCommitManager::Commit>, "Commit"}, + }; + RegisterHandlers(functions); } IMultiCommitManager::~IMultiCommitManager() = default; diff --git a/src/core/hle/service/filesystem/fsp/fs_i_multi_commit_manager.h b/src/core/hle/service/filesystem/fsp/fs_i_multi_commit_manager.h index 31182e9159..3ebeb2cb0a 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_multi_commit_manager.h +++ b/src/core/hle/service/filesystem/fsp/fs_i_multi_commit_manager.h @@ -20,13 +20,6 @@ private: Result Add(std::shared_ptr filesystem); Result Commit(); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{1, D<&IMultiCommitManager::Add>, "Add"}, - FunctionInfo{2, D<&IMultiCommitManager::Commit>, "Commit"} - ); FileSys::VirtualFile backend; }; diff --git a/src/core/hle/service/filesystem/fsp/fs_i_save_data_info_reader.cpp b/src/core/hle/service/filesystem/fsp/fs_i_save_data_info_reader.cpp index 8353b72c24..0cac094caf 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_save_data_info_reader.cpp +++ b/src/core/hle/service/filesystem/fsp/fs_i_save_data_info_reader.cpp @@ -17,6 +17,11 @@ ISaveDataInfoReader::ISaveDataInfoReader(Core::System& system_, FileSys::SaveDataSpaceId space) : ServiceFramework{system_, "ISaveDataInfoReader"}, save_data_controller{ save_data_controller_} { + static const FunctionInfo functions[] = { + {0, D<&ISaveDataInfoReader::ReadSaveDataInfo>, "ReadSaveDataInfo"}, + }; + RegisterHandlers(functions); + FindAllSaves(space); } diff --git a/src/core/hle/service/filesystem/fsp/fs_i_save_data_info_reader.h b/src/core/hle/service/filesystem/fsp/fs_i_save_data_info_reader.h index 7faa4291c0..d2b8eb97cf 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_save_data_info_reader.h +++ b/src/core/hle/service/filesystem/fsp/fs_i_save_data_info_reader.h @@ -45,12 +45,6 @@ private: void FindNormalSaves(FileSys::SaveDataSpaceId space, const FileSys::VirtualDir& type); void FindTemporaryStorageSaves(FileSys::SaveDataSpaceId space, const FileSys::VirtualDir& type); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&ISaveDataInfoReader::ReadSaveDataInfo>, "ReadSaveDataInfo"} - ); std::shared_ptr save_data_controller; std::vector info; u64 next_entry_index = 0; diff --git a/src/core/hle/service/filesystem/fsp/fs_i_storage.cpp b/src/core/hle/service/filesystem/fsp/fs_i_storage.cpp index ac884b3b28..50b7d1e765 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_storage.cpp +++ b/src/core/hle/service/filesystem/fsp/fs_i_storage.cpp @@ -12,6 +12,15 @@ namespace Service::FileSystem { IStorage::IStorage(Core::System& system_, FileSys::VirtualFile backend_) : ServiceFramework{system_, "IStorage"}, backend(std::move(backend_)) { + static const FunctionInfo functions[] = { + {0, D<&IStorage::Read>, "Read"}, + {1, nullptr, "Write"}, + {2, nullptr, "Flush"}, + {3, nullptr, "SetSize"}, + {4, D<&IStorage::GetSize>, "GetSize"}, + {5, nullptr, "OperateRange"}, + }; + RegisterHandlers(functions); } Result IStorage::Read( diff --git a/src/core/hle/service/filesystem/fsp/fs_i_storage.h b/src/core/hle/service/filesystem/fsp/fs_i_storage.h index 44d5a6c8bb..e676c52220 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_storage.h +++ b/src/core/hle/service/filesystem/fsp/fs_i_storage.h @@ -18,23 +18,12 @@ public: explicit IStorage(Core::System& system_, FileSys::VirtualFile backend_); private: + FileSys::VirtualFile backend; + Result Read( OutBuffer out_bytes, s64 offset, s64 length); Result GetSize(Out out_size); - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IStorage::Read>, "Read"}, - FunctionInfo{1, nullptr, "Write"}, - FunctionInfo{2, nullptr, "Flush"}, - FunctionInfo{3, nullptr, "SetSize"}, - FunctionInfo{4, D<&IStorage::GetSize>, "GetSize"}, - FunctionInfo{5, nullptr, "OperateRange"} - ); - FileSys::VirtualFile backend; }; } // namespace Service::FileSystem diff --git a/src/core/hle/service/filesystem/fsp/fsp_ldr.cpp b/src/core/hle/service/filesystem/fsp/fsp_ldr.cpp index 1f83d6509b..1dcacb0231 100644 --- a/src/core/hle/service/filesystem/fsp/fsp_ldr.cpp +++ b/src/core/hle/service/filesystem/fsp/fsp_ldr.cpp @@ -9,6 +9,15 @@ namespace Service::FileSystem { FSP_LDR::FSP_LDR(Core::System& system_) : ServiceFramework{system_, "fsp:ldr"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "OpenCodeFileSystem"}, + {1, nullptr, "IsArchivedProgram"}, + {2, nullptr, "SetCurrentProcess"}, + }; + // clang-format on + + RegisterHandlers(functions); } FSP_LDR::~FSP_LDR() = default; diff --git a/src/core/hle/service/filesystem/fsp/fsp_ldr.h b/src/core/hle/service/filesystem/fsp/fsp_ldr.h index fe3abeff1d..b642efe7ad 100644 --- a/src/core/hle/service/filesystem/fsp/fsp_ldr.h +++ b/src/core/hle/service/filesystem/fsp/fsp_ldr.h @@ -18,15 +18,6 @@ class FSP_LDR final : public ServiceFramework { public: explicit FSP_LDR(Core::System& system_); ~FSP_LDR() override; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "OpenCodeFileSystem"}, - FunctionInfo{1, nullptr, "IsArchivedProgram"}, - FunctionInfo{2, nullptr, "SetCurrentProcess"} - ); }; } // namespace Service::FileSystem diff --git a/src/core/hle/service/filesystem/fsp/fsp_pr.cpp b/src/core/hle/service/filesystem/fsp/fsp_pr.cpp index 9378e6e0c6..e7941ef9c9 100644 --- a/src/core/hle/service/filesystem/fsp/fsp_pr.cpp +++ b/src/core/hle/service/filesystem/fsp/fsp_pr.cpp @@ -9,6 +9,16 @@ namespace Service::FileSystem { FSP_PR::FSP_PR(Core::System& system_) : ServiceFramework{system_, "fsp:pr"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "RegisterProgram"}, + {1, nullptr, "UnregisterProgram"}, + {2, nullptr, "SetCurrentProcess"}, + {256, nullptr, "SetEnabledProgramVerification"}, + }; + // clang-format on + + RegisterHandlers(functions); } FSP_PR::~FSP_PR() = default; diff --git a/src/core/hle/service/filesystem/fsp/fsp_pr.h b/src/core/hle/service/filesystem/fsp/fsp_pr.h index bc692151a5..175a3c7a23 100644 --- a/src/core/hle/service/filesystem/fsp/fsp_pr.h +++ b/src/core/hle/service/filesystem/fsp/fsp_pr.h @@ -18,16 +18,6 @@ class FSP_PR final : public ServiceFramework { public: explicit FSP_PR(Core::System& system_); ~FSP_PR() override; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "RegisterProgram"}, - FunctionInfo{1, nullptr, "UnregisterProgram"}, - FunctionInfo{2, nullptr, "SetCurrentProcess"}, - FunctionInfo{256, nullptr, "SetEnabledProgramVerification"} - ); }; } // namespace Service::FileSystem diff --git a/src/core/hle/service/filesystem/fsp/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp/fsp_srv.cpp index cb349636d5..58303a0bd6 100644 --- a/src/core/hle/service/filesystem/fsp/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp/fsp_srv.cpp @@ -47,142 +47,143 @@ namespace Service::FileSystem { -std::optional FSP_SRV::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "OpenFileSystem"}, - FunctionInfo{1, D<&FSP_SRV::SetCurrentProcess>, "SetCurrentProcess"}, - FunctionInfo{2, D<&FSP_SRV::OpenDataFileSystemByCurrentProcess>, "OpenDataFileSystemByCurrentProcess"}, - FunctionInfo{7, D<&FSP_SRV::OpenFileSystemWithPatch>, "OpenFileSystemWithPatch"}, - FunctionInfo{8, nullptr, "OpenFileSystemWithId"}, - FunctionInfo{9, nullptr, "OpenDataFileSystemByApplicationId"}, - FunctionInfo{11, nullptr, "OpenBisFileSystem"}, - FunctionInfo{12, nullptr, "OpenBisStorage"}, - FunctionInfo{13, nullptr, "InvalidateBisCache"}, - FunctionInfo{17, nullptr, "OpenHostFileSystem"}, - FunctionInfo{18, D<&FSP_SRV::OpenSdCardFileSystem>, "OpenSdCardFileSystem"}, - FunctionInfo{19, nullptr, "FormatSdCardFileSystem"}, - FunctionInfo{21, nullptr, "DeleteSaveDataFileSystem"}, - FunctionInfo{22, D<&FSP_SRV::CreateSaveDataFileSystem>, "CreateSaveDataFileSystem"}, - FunctionInfo{23, D<&FSP_SRV::CreateSaveDataFileSystemBySystemSaveDataId>, "CreateSaveDataFileSystemBySystemSaveDataId"}, - FunctionInfo{24, nullptr, "RegisterSaveDataFileSystemAtomicDeletion"}, - FunctionInfo{25, nullptr, "DeleteSaveDataFileSystemBySaveDataSpaceId"}, - FunctionInfo{26, nullptr, "FormatSdCardDryRun"}, - FunctionInfo{27, D<&FSP_SRV::IsExFatSupported>, "IsExFatSupported"}, - FunctionInfo{28, nullptr, "DeleteSaveDataFileSystemBySaveDataAttribute"}, - FunctionInfo{30, nullptr, "OpenGameCardStorage"}, - FunctionInfo{31, nullptr, "OpenGameCardFileSystem"}, - FunctionInfo{32, D<&FSP_SRV::ExtendSaveDataFileSystem>, "ExtendSaveDataFileSystem"}, - FunctionInfo{33, nullptr, "DeleteCacheStorage"}, - FunctionInfo{34, D<&FSP_SRV::GetCacheStorageSize>, "GetCacheStorageSize"}, - FunctionInfo{35, nullptr, "CreateSaveDataFileSystemByHashSalt"}, - FunctionInfo{36, nullptr, "OpenHostFileSystemWithOption"}, - FunctionInfo{37, D<&FSP_SRV::CreateSaveDataFileSystemWithCreationInfo2>, "CreateSaveDataFileSystemWithCreationInfo2"}, - FunctionInfo{51, D<&FSP_SRV::OpenSaveDataFileSystem>, "OpenSaveDataFileSystem"}, - FunctionInfo{52, D<&FSP_SRV::OpenSaveDataFileSystemBySystemSaveDataId>, "OpenSaveDataFileSystemBySystemSaveDataId"}, - FunctionInfo{53, D<&FSP_SRV::OpenReadOnlySaveDataFileSystem>, "OpenReadOnlySaveDataFileSystem"}, - FunctionInfo{57, D<&FSP_SRV::ReadSaveDataFileSystemExtraDataBySaveDataSpaceId>, "ReadSaveDataFileSystemExtraDataBySaveDataSpaceId"}, - FunctionInfo{58, D<&FSP_SRV::ReadSaveDataFileSystemExtraData>, "ReadSaveDataFileSystemExtraData"}, - FunctionInfo{59, D<&FSP_SRV::WriteSaveDataFileSystemExtraData>, "WriteSaveDataFileSystemExtraData"}, - FunctionInfo{60, nullptr, "OpenSaveDataInfoReader"}, - FunctionInfo{61, D<&FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId>, "OpenSaveDataInfoReaderBySaveDataSpaceId"}, - FunctionInfo{62, D<&FSP_SRV::OpenSaveDataInfoReaderOnlyCacheStorage>, "OpenSaveDataInfoReaderOnlyCacheStorage"}, - FunctionInfo{64, nullptr, "OpenSaveDataInternalStorageFileSystem"}, - FunctionInfo{65, nullptr, "UpdateSaveDataMacForDebug"}, - FunctionInfo{66, nullptr, "WriteSaveDataFileSystemExtraData2"}, - FunctionInfo{67, D<&FSP_SRV::FindSaveDataWithFilter>, "FindSaveDataWithFilter"}, - FunctionInfo{68, nullptr, "OpenSaveDataInfoReaderBySaveDataFilter"}, - FunctionInfo{69, D<&FSP_SRV::ReadSaveDataFileSystemExtraDataBySaveDataAttribute>, "ReadSaveDataFileSystemExtraDataBySaveDataAttribute"}, - FunctionInfo{70, D<&FSP_SRV::WriteSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute>, "WriteSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute"}, - FunctionInfo{71, D<&FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute>, "ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute"}, - FunctionInfo{80, nullptr, "OpenSaveDataMetaFile"}, - FunctionInfo{81, nullptr, "OpenSaveDataTransferManager"}, - FunctionInfo{82, nullptr, "OpenSaveDataTransferManagerVersion2"}, - FunctionInfo{83, D<&FSP_SRV::OpenSaveDataTransferProhibiter>, "OpenSaveDataTransferProhibiter"}, - FunctionInfo{84, nullptr, "ListApplicationAccessibleSaveDataOwnerId"}, - FunctionInfo{85, nullptr, "OpenSaveDataTransferManagerForSaveDataRepair"}, - FunctionInfo{86, nullptr, "OpenSaveDataMover"}, - FunctionInfo{87, nullptr, "OpenSaveDataTransferManagerForRepair"}, - FunctionInfo{100, nullptr, "OpenImageDirectoryFileSystem"}, - FunctionInfo{101, nullptr, "OpenBaseFileSystem"}, - FunctionInfo{102, nullptr, "FormatBaseFileSystem"}, - FunctionInfo{110, nullptr, "OpenContentStorageFileSystem"}, - FunctionInfo{120, nullptr, "OpenCloudBackupWorkStorageFileSystem"}, - FunctionInfo{130, nullptr, "OpenCustomStorageFileSystem"}, - FunctionInfo{200, D<&FSP_SRV::OpenDataStorageByCurrentProcess>, "OpenDataStorageByCurrentProcess"}, - FunctionInfo{201, nullptr, "OpenDataStorageByProgramId"}, - FunctionInfo{202, D<&FSP_SRV::OpenDataStorageByDataId>, "OpenDataStorageByDataId"}, - FunctionInfo{203, D<&FSP_SRV::OpenPatchDataStorageByCurrentProcess>, "OpenPatchDataStorageByCurrentProcess"}, - FunctionInfo{204, nullptr, "OpenDataFileSystemByProgramIndex"}, - FunctionInfo{205, D<&FSP_SRV::OpenDataStorageWithProgramIndex>, "OpenDataStorageWithProgramIndex"}, - FunctionInfo{206, nullptr, "OpenDataStorageByPath"}, - FunctionInfo{210, D<&FSP_SRV::SetCurrentProcess>, "SetCurrentProcess"}, - FunctionInfo{400, nullptr, "OpenDeviceOperator"}, - FunctionInfo{500, nullptr, "OpenSdCardDetectionEventNotifier"}, - FunctionInfo{501, nullptr, "OpenGameCardDetectionEventNotifier"}, - FunctionInfo{510, nullptr, "OpenSystemDataUpdateEventNotifier"}, - FunctionInfo{511, nullptr, "NotifySystemDataUpdateEvent"}, - FunctionInfo{520, nullptr, "SimulateGameCardDetectionEvent"}, - FunctionInfo{600, nullptr, "SetCurrentPosixTime"}, - FunctionInfo{601, nullptr, "QuerySaveDataTotalSize"}, - FunctionInfo{602, nullptr, "VerifySaveDataFileSystem"}, - FunctionInfo{603, nullptr, "CorruptSaveDataFileSystem"}, - FunctionInfo{604, nullptr, "CreatePaddingFile"}, - FunctionInfo{605, nullptr, "DeleteAllPaddingFiles"}, - FunctionInfo{606, nullptr, "GetRightsId"}, - FunctionInfo{607, nullptr, "RegisterExternalKey"}, - FunctionInfo{608, nullptr, "UnregisterAllExternalKey"}, - FunctionInfo{609, nullptr, "GetRightsIdByPath"}, - FunctionInfo{610, nullptr, "GetRightsIdAndKeyGenerationByPath"}, - FunctionInfo{611, nullptr, "SetCurrentPosixTimeWithTimeDifference"}, - FunctionInfo{612, nullptr, "GetFreeSpaceSizeForSaveData"}, - FunctionInfo{613, nullptr, "VerifySaveDataFileSystemBySaveDataSpaceId"}, - FunctionInfo{614, nullptr, "CorruptSaveDataFileSystemBySaveDataSpaceId"}, - FunctionInfo{615, nullptr, "QuerySaveDataInternalStorageTotalSize"}, - FunctionInfo{616, nullptr, "GetSaveDataCommitId"}, - FunctionInfo{617, nullptr, "UnregisterExternalKey"}, - FunctionInfo{620, nullptr, "SetSdCardEncryptionSeed"}, - FunctionInfo{630, nullptr, "SetSdCardAccessibility"}, - FunctionInfo{631, D<&FSP_SRV::IsSdCardAccessible>, "IsSdCardAccessible"}, - FunctionInfo{640, nullptr, "IsSignedSystemPartitionOnSdCardValid"}, - FunctionInfo{700, nullptr, "OpenAccessFailureResolver"}, - FunctionInfo{701, nullptr, "GetAccessFailureDetectionEvent"}, - FunctionInfo{702, nullptr, "IsAccessFailureDetected"}, - FunctionInfo{710, nullptr, "ResolveAccessFailure"}, - FunctionInfo{720, nullptr, "AbandonAccessFailure"}, - FunctionInfo{800, nullptr, "GetAndClearFileSystemProxyErrorInfo"}, - FunctionInfo{810, nullptr, "RegisterProgramIndexMapInfo"}, - FunctionInfo{820, nullptr, "GetContentStorageInfoIndex"}, - FunctionInfo{830, nullptr, "EncryptStreamPlaySaveData"}, - FunctionInfo{831, nullptr, "DecryptStreamPlaySaveData"}, - FunctionInfo{1000, nullptr, "SetBisRootForHost"}, - FunctionInfo{1001, nullptr, "SetSaveDataSize"}, - FunctionInfo{1002, nullptr, "SetSaveDataRootPath"}, - FunctionInfo{1003, D<&FSP_SRV::DisableAutoSaveDataCreation>, "DisableAutoSaveDataCreation"}, - FunctionInfo{1004, D<&FSP_SRV::SetGlobalAccessLogMode>, "SetGlobalAccessLogMode"}, - FunctionInfo{1005, D<&FSP_SRV::GetGlobalAccessLogMode>, "GetGlobalAccessLogMode"}, - FunctionInfo{1006, D<&FSP_SRV::OutputAccessLogToSdCard>, "OutputAccessLogToSdCard"}, - FunctionInfo{1007, nullptr, "RegisterUpdatePartition"}, - FunctionInfo{1008, nullptr, "OpenRegisteredUpdatePartition"}, - FunctionInfo{1009, nullptr, "GetAndClearMemoryReportInfo"}, - FunctionInfo{1010, nullptr, "SetDataStorageRedirectTarget"}, - FunctionInfo{1011, D<&FSP_SRV::GetProgramIndexForAccessLog>, "GetProgramIndexForAccessLog"}, - FunctionInfo{1012, nullptr, "GetFsStackUsage"}, - FunctionInfo{1013, nullptr, "UnsetSaveDataRootPath"}, - FunctionInfo{1014, nullptr, "OutputMultiProgramTagAccessLog"}, - FunctionInfo{1016, D<&FSP_SRV::FlushAccessLogOnSdCard>, "FlushAccessLogOnSdCard"}, - FunctionInfo{1017, nullptr, "OutputApplicationInfoAccessLog"}, - FunctionInfo{1018, nullptr, "SetDebugOption"}, - FunctionInfo{1019, nullptr, "UnsetDebugOption"}, - FunctionInfo{1100, nullptr, "OverrideSaveDataTransferTokenSignVerificationKey"}, - FunctionInfo{1110, nullptr, "CorruptSaveDataFileSystemBySaveDataSpaceId2"}, - FunctionInfo{1200, D<&FSP_SRV::OpenMultiCommitManager>, "OpenMultiCommitManager"}, - FunctionInfo{1300, nullptr, "OpenBisWiper"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - FSP_SRV::FSP_SRV(Core::System& system_) - : ServiceFramework{system_, "fsp-srv"}, fsc{system.GetFileSystemController()}, content_provider{system.GetContentProvider()}, reporter{system.GetReporter()} { + : ServiceFramework{system_, "fsp-srv"}, fsc{system.GetFileSystemController()}, + content_provider{system.GetContentProvider()}, reporter{system.GetReporter()} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "OpenFileSystem"}, + {1, D<&FSP_SRV::SetCurrentProcess>, "SetCurrentProcess"}, + {2, D<&FSP_SRV::OpenDataFileSystemByCurrentProcess>, "OpenDataFileSystemByCurrentProcess"}, + {7, D<&FSP_SRV::OpenFileSystemWithPatch>, "OpenFileSystemWithPatch"}, + {8, nullptr, "OpenFileSystemWithId"}, + {9, nullptr, "OpenDataFileSystemByApplicationId"}, + {11, nullptr, "OpenBisFileSystem"}, + {12, nullptr, "OpenBisStorage"}, + {13, nullptr, "InvalidateBisCache"}, + {17, nullptr, "OpenHostFileSystem"}, + {18, D<&FSP_SRV::OpenSdCardFileSystem>, "OpenSdCardFileSystem"}, + {19, nullptr, "FormatSdCardFileSystem"}, + {21, nullptr, "DeleteSaveDataFileSystem"}, + {22, D<&FSP_SRV::CreateSaveDataFileSystem>, "CreateSaveDataFileSystem"}, + {23, D<&FSP_SRV::CreateSaveDataFileSystemBySystemSaveDataId>, "CreateSaveDataFileSystemBySystemSaveDataId"}, + {24, nullptr, "RegisterSaveDataFileSystemAtomicDeletion"}, + {25, nullptr, "DeleteSaveDataFileSystemBySaveDataSpaceId"}, + {26, nullptr, "FormatSdCardDryRun"}, + {27, D<&FSP_SRV::IsExFatSupported>, "IsExFatSupported"}, + {28, nullptr, "DeleteSaveDataFileSystemBySaveDataAttribute"}, + {30, nullptr, "OpenGameCardStorage"}, + {31, nullptr, "OpenGameCardFileSystem"}, + {32, D<&FSP_SRV::ExtendSaveDataFileSystem>, "ExtendSaveDataFileSystem"}, + {33, nullptr, "DeleteCacheStorage"}, + {34, D<&FSP_SRV::GetCacheStorageSize>, "GetCacheStorageSize"}, + {35, nullptr, "CreateSaveDataFileSystemByHashSalt"}, + {36, nullptr, "OpenHostFileSystemWithOption"}, + {37, D<&FSP_SRV::CreateSaveDataFileSystemWithCreationInfo2>, "CreateSaveDataFileSystemWithCreationInfo2"}, + {51, D<&FSP_SRV::OpenSaveDataFileSystem>, "OpenSaveDataFileSystem"}, + {52, D<&FSP_SRV::OpenSaveDataFileSystemBySystemSaveDataId>, "OpenSaveDataFileSystemBySystemSaveDataId"}, + {53, D<&FSP_SRV::OpenReadOnlySaveDataFileSystem>, "OpenReadOnlySaveDataFileSystem"}, + {57, D<&FSP_SRV::ReadSaveDataFileSystemExtraDataBySaveDataSpaceId>, "ReadSaveDataFileSystemExtraDataBySaveDataSpaceId"}, + {58, D<&FSP_SRV::ReadSaveDataFileSystemExtraData>, "ReadSaveDataFileSystemExtraData"}, + {59, D<&FSP_SRV::WriteSaveDataFileSystemExtraData>, "WriteSaveDataFileSystemExtraData"}, + {60, nullptr, "OpenSaveDataInfoReader"}, + {61, D<&FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId>, "OpenSaveDataInfoReaderBySaveDataSpaceId"}, + {62, D<&FSP_SRV::OpenSaveDataInfoReaderOnlyCacheStorage>, "OpenSaveDataInfoReaderOnlyCacheStorage"}, + {64, nullptr, "OpenSaveDataInternalStorageFileSystem"}, + {65, nullptr, "UpdateSaveDataMacForDebug"}, + {66, nullptr, "WriteSaveDataFileSystemExtraData2"}, + {67, D<&FSP_SRV::FindSaveDataWithFilter>, "FindSaveDataWithFilter"}, + {68, nullptr, "OpenSaveDataInfoReaderBySaveDataFilter"}, + {69, D<&FSP_SRV::ReadSaveDataFileSystemExtraDataBySaveDataAttribute>, "ReadSaveDataFileSystemExtraDataBySaveDataAttribute"}, + {70, D<&FSP_SRV::WriteSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute>, "WriteSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute"}, + {71, D<&FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute>, "ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute"}, + {80, nullptr, "OpenSaveDataMetaFile"}, + {81, nullptr, "OpenSaveDataTransferManager"}, + {82, nullptr, "OpenSaveDataTransferManagerVersion2"}, + {83, D<&FSP_SRV::OpenSaveDataTransferProhibiter>, "OpenSaveDataTransferProhibiter"}, + {84, nullptr, "ListApplicationAccessibleSaveDataOwnerId"}, + {85, nullptr, "OpenSaveDataTransferManagerForSaveDataRepair"}, + {86, nullptr, "OpenSaveDataMover"}, + {87, nullptr, "OpenSaveDataTransferManagerForRepair"}, + {100, nullptr, "OpenImageDirectoryFileSystem"}, + {101, nullptr, "OpenBaseFileSystem"}, + {102, nullptr, "FormatBaseFileSystem"}, + {110, nullptr, "OpenContentStorageFileSystem"}, + {120, nullptr, "OpenCloudBackupWorkStorageFileSystem"}, + {130, nullptr, "OpenCustomStorageFileSystem"}, + {200, D<&FSP_SRV::OpenDataStorageByCurrentProcess>, "OpenDataStorageByCurrentProcess"}, + {201, nullptr, "OpenDataStorageByProgramId"}, + {202, D<&FSP_SRV::OpenDataStorageByDataId>, "OpenDataStorageByDataId"}, + {203, D<&FSP_SRV::OpenPatchDataStorageByCurrentProcess>, "OpenPatchDataStorageByCurrentProcess"}, + {204, nullptr, "OpenDataFileSystemByProgramIndex"}, + {205, D<&FSP_SRV::OpenDataStorageWithProgramIndex>, "OpenDataStorageWithProgramIndex"}, + {206, nullptr, "OpenDataStorageByPath"}, + {210, D<&FSP_SRV::SetCurrentProcess>, "SetCurrentProcess"}, + {400, nullptr, "OpenDeviceOperator"}, + {500, nullptr, "OpenSdCardDetectionEventNotifier"}, + {501, nullptr, "OpenGameCardDetectionEventNotifier"}, + {510, nullptr, "OpenSystemDataUpdateEventNotifier"}, + {511, nullptr, "NotifySystemDataUpdateEvent"}, + {520, nullptr, "SimulateGameCardDetectionEvent"}, + {600, nullptr, "SetCurrentPosixTime"}, + {601, nullptr, "QuerySaveDataTotalSize"}, + {602, nullptr, "VerifySaveDataFileSystem"}, + {603, nullptr, "CorruptSaveDataFileSystem"}, + {604, nullptr, "CreatePaddingFile"}, + {605, nullptr, "DeleteAllPaddingFiles"}, + {606, nullptr, "GetRightsId"}, + {607, nullptr, "RegisterExternalKey"}, + {608, nullptr, "UnregisterAllExternalKey"}, + {609, nullptr, "GetRightsIdByPath"}, + {610, nullptr, "GetRightsIdAndKeyGenerationByPath"}, + {611, nullptr, "SetCurrentPosixTimeWithTimeDifference"}, + {612, nullptr, "GetFreeSpaceSizeForSaveData"}, + {613, nullptr, "VerifySaveDataFileSystemBySaveDataSpaceId"}, + {614, nullptr, "CorruptSaveDataFileSystemBySaveDataSpaceId"}, + {615, nullptr, "QuerySaveDataInternalStorageTotalSize"}, + {616, nullptr, "GetSaveDataCommitId"}, + {617, nullptr, "UnregisterExternalKey"}, + {620, nullptr, "SetSdCardEncryptionSeed"}, + {630, nullptr, "SetSdCardAccessibility"}, + {631, D<&FSP_SRV::IsSdCardAccessible>, "IsSdCardAccessible"}, + {640, nullptr, "IsSignedSystemPartitionOnSdCardValid"}, + {700, nullptr, "OpenAccessFailureResolver"}, + {701, nullptr, "GetAccessFailureDetectionEvent"}, + {702, nullptr, "IsAccessFailureDetected"}, + {710, nullptr, "ResolveAccessFailure"}, + {720, nullptr, "AbandonAccessFailure"}, + {800, nullptr, "GetAndClearFileSystemProxyErrorInfo"}, + {810, nullptr, "RegisterProgramIndexMapInfo"}, + {820, nullptr, "GetContentStorageInfoIndex"}, + {830, nullptr, "EncryptStreamPlaySaveData"}, + {831, nullptr, "DecryptStreamPlaySaveData"}, + {1000, nullptr, "SetBisRootForHost"}, + {1001, nullptr, "SetSaveDataSize"}, + {1002, nullptr, "SetSaveDataRootPath"}, + {1003, D<&FSP_SRV::DisableAutoSaveDataCreation>, "DisableAutoSaveDataCreation"}, + {1004, D<&FSP_SRV::SetGlobalAccessLogMode>, "SetGlobalAccessLogMode"}, + {1005, D<&FSP_SRV::GetGlobalAccessLogMode>, "GetGlobalAccessLogMode"}, + {1006, D<&FSP_SRV::OutputAccessLogToSdCard>, "OutputAccessLogToSdCard"}, + {1007, nullptr, "RegisterUpdatePartition"}, + {1008, nullptr, "OpenRegisteredUpdatePartition"}, + {1009, nullptr, "GetAndClearMemoryReportInfo"}, + {1010, nullptr, "SetDataStorageRedirectTarget"}, + {1011, D<&FSP_SRV::GetProgramIndexForAccessLog>, "GetProgramIndexForAccessLog"}, + {1012, nullptr, "GetFsStackUsage"}, + {1013, nullptr, "UnsetSaveDataRootPath"}, + {1014, nullptr, "OutputMultiProgramTagAccessLog"}, + {1016, D<&FSP_SRV::FlushAccessLogOnSdCard>, "FlushAccessLogOnSdCard"}, + {1017, nullptr, "OutputApplicationInfoAccessLog"}, + {1018, nullptr, "SetDebugOption"}, + {1019, nullptr, "UnsetDebugOption"}, + {1100, nullptr, "OverrideSaveDataTransferTokenSignVerificationKey"}, + {1110, nullptr, "CorruptSaveDataFileSystemBySaveDataSpaceId2"}, + {1200, D<&FSP_SRV::OpenMultiCommitManager>, "OpenMultiCommitManager"}, + {1300, nullptr, "OpenBisWiper"}, + }; + // clang-format on + RegisterHandlers(functions); + if (Settings::values.enable_fs_access_log) { access_log_mode = AccessLogMode::SdCard; } diff --git a/src/core/hle/service/filesystem/fsp/fsp_srv.h b/src/core/hle/service/filesystem/fsp/fsp_srv.h index ebda008bcc..156cf4e571 100644 --- a/src/core/hle/service/filesystem/fsp/fsp_srv.h +++ b/src/core/hle/service/filesystem/fsp/fsp_srv.h @@ -115,7 +115,6 @@ private: s64 available_size, s64 journal_size); Result GetCacheStorageSize(s32 index, Out out_data_size, Out out_journal_size); - std::optional FindRequest(u32 key) override; FileSystemController& fsc; const FileSys::ContentProvider& content_provider; const Core::Reporter& reporter; diff --git a/src/core/hle/service/filesystem/fsp/fsp_types.h b/src/core/hle/service/filesystem/fsp/fsp_types.h index 294da6a2de..c704203ad1 100644 --- a/src/core/hle/service/filesystem/fsp/fsp_types.h +++ b/src/core/hle/service/filesystem/fsp/fsp_types.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/filesystem/fsp/save_data_transfer_prohibiter.cpp b/src/core/hle/service/filesystem/fsp/save_data_transfer_prohibiter.cpp index d8d6289fe1..f4c218db8d 100644 --- a/src/core/hle/service/filesystem/fsp/save_data_transfer_prohibiter.cpp +++ b/src/core/hle/service/filesystem/fsp/save_data_transfer_prohibiter.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/filesystem/fsp/save_data_transfer_prohibiter.h b/src/core/hle/service/filesystem/fsp/save_data_transfer_prohibiter.h index d206e1dea4..6141bae18c 100644 --- a/src/core/hle/service/filesystem/fsp/save_data_transfer_prohibiter.h +++ b/src/core/hle/service/filesystem/fsp/save_data_transfer_prohibiter.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/filesystem/romfs_controller.cpp b/src/core/hle/service/filesystem/romfs_controller.cpp index 19c9cec722..9725d02f4b 100644 --- a/src/core/hle/service/filesystem/romfs_controller.cpp +++ b/src/core/hle/service/filesystem/romfs_controller.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/filesystem/romfs_controller.h b/src/core/hle/service/filesystem/romfs_controller.h index 3c3ead344c..5471e136c3 100644 --- a/src/core/hle/service/filesystem/romfs_controller.h +++ b/src/core/hle/service/filesystem/romfs_controller.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/filesystem/save_data_controller.cpp b/src/core/hle/service/filesystem/save_data_controller.cpp index 8720681d17..d3e22b1552 100644 --- a/src/core/hle/service/filesystem/save_data_controller.cpp +++ b/src/core/hle/service/filesystem/save_data_controller.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project diff --git a/src/core/hle/service/filesystem/save_data_controller.h b/src/core/hle/service/filesystem/save_data_controller.h index dc9d713dfb..afb95cb949 100644 --- a/src/core/hle/service/filesystem/save_data_controller.h +++ b/src/core/hle/service/filesystem/save_data_controller.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp index 5480d22b83..f8690dbb8b 100644 --- a/src/core/hle/service/friend/friend.cpp +++ b/src/core/hle/service/friend/friend.cpp @@ -11,36 +11,137 @@ #include "core/hle/kernel/k_event.h" #include "core/hle/service/acc/errors.h" #include "core/hle/service/friend/friend.h" +#include "core/hle/service/friend/friend_interface.h" #include "core/hle/service/ipc_helpers.h" #include "core/hle/service/kernel_helpers.h" #include "core/hle/service/server_manager.h" namespace Service::Friend { -class Friend final : public Module::Interface { -public: - explicit Friend(std::shared_ptr module_, Core::System& system_, const char* name) : Interface(std::move(module_), system_, name) {} - ~Friend() override = default; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &Friend::CreateFriendService, "CreateFriendService"}, - FunctionInfo{1, &Friend::CreateNotificationService, "CreateNotificationService"}, - FunctionInfo{2, nullptr, "CreateDaemonSuspendSessionService"} - ); -}; - class IFriendService final : public ServiceFramework { public: explicit IFriendService(Core::System& system_) : ServiceFramework{system_, "IFriendService"}, service_context{system, "IFriendService"} { - completion_event = service_context.CreateEvent("IFriendService:CompletionEvent"); - } + // clang-format off + static const FunctionInfo functions[] = { + {0, &IFriendService::GetCompletionEvent, "GetCompletionEvent"}, + {1, &IFriendService::Cancel, "Cancel"}, + {10100, nullptr, "GetFriendListIds"}, + {10101, &IFriendService::GetFriendList, "GetFriendList"}, + {10102, nullptr, "UpdateFriendInfo"}, + {10110, nullptr, "GetFriendProfileImage"}, + {10111, nullptr, "GetFriendProfileImageWithImageSize"}, // 18.0.0+ + {10120, &IFriendService::CheckFriendListAvailability, "CheckFriendListAvailability"}, + {10121, nullptr, "EnsureFriendListAvailable"}, + {10200, nullptr, "SendFriendRequestForApplication"}, + {10211, nullptr, "AddFacedFriendRequestForApplication"}, + {10400, &IFriendService::GetBlockedUserListIds, "GetBlockedUserListIds"}, + {10420, &IFriendService::CheckBlockedUserListAvailability, "CheckBlockedUserListAvailability"}, + {10421, nullptr, "EnsureBlockedUserListAvailable"}, + {10500, nullptr, "GetProfileList"}, + {10501, nullptr, "GetProfileListV2"}, // 18.0.0+ + {10600, nullptr, "DeclareOpenOnlinePlaySession"}, + {10601, &IFriendService::DeclareCloseOnlinePlaySession, "DeclareCloseOnlinePlaySession"}, + {10610, &IFriendService::UpdateUserPresence, "UpdateUserPresence"}, + {10700, &IFriendService::GetPlayHistoryRegistrationKey, "GetPlayHistoryRegistrationKey"}, + {10701, nullptr, "GetPlayHistoryRegistrationKeyWithNetworkServiceAccountId"}, + {10702, nullptr, "AddPlayHistory"}, + {11000, nullptr, "GetProfileImageUrl"}, + {11001, nullptr, "GetProfileImageUrlV2"}, // 18.0.0+ + {20100, &IFriendService::GetFriendCount, "GetFriendCount"}, + {20101, &IFriendService::GetNewlyFriendCount, "GetNewlyFriendCount"}, + {20102, nullptr, "GetFriendDetailedInfo"}, + {20103, nullptr, "SyncFriendList"}, + {20104, &IFriendService::RequestSyncFriendList, "RequestSyncFriendList"}, + {20105, &IFriendService::GetFriendListForViewer, "GetFriendListForViewerV1"}, + {20106, nullptr, "UpdateFriendInfoForViewerV1"}, + {20107, nullptr, "GetFriendDetailedInfoV2"}, // 20.0.0+ + {20108, &IFriendService::GetFriendListForViewer, "GetFriendListForViewerV2"}, // 22.0.0+ + {20109, nullptr, "UpdateFriendInfoForViewerV2"}, // 22.0.0+ + {20110, nullptr, "LoadFriendSettingV1"}, + {20111, nullptr, "LoadFriendSettingV2"}, // 22.0.0+ + {20200, &IFriendService::GetReceivedFriendRequestCount, "GetReceivedFriendRequestCount"}, + {20201, nullptr, "GetFriendRequestListV1"}, + {20202, nullptr, "GetFriendRequestListV2"}, // 20.0.0+ + {20203, nullptr, "GetFriendRequestReceivedNotificationCount"}, // 22.0.0+ + {20300, nullptr, "GetFriendCandidateList"}, + {20301, nullptr, "GetNintendoNetworkIdInfo"}, + {20302, nullptr, "GetSnsAccountLinkage"}, // 5.0.0-19.0.1 + {20303, nullptr, "GetSnsAccountProfile"}, // 5.0.0-19.0.1 + {20304, nullptr, "GetSnsAccountFriendList"}, // 5.0.0-19.0.1 + {20400, nullptr, "GetBlockedUserListV1"}, + {20401, nullptr, "SyncBlockedUserList"}, + {20402, nullptr, "GetBlockedUserListV2"}, // 20.0.0+ + {20500, nullptr, "GetProfileExtraListV1"}, + {20501, nullptr, "GetRelationship"}, + {20502, nullptr, "GetProfileExtraListV2"}, // 19.0.0+ + {20600, &IFriendService::GetUserPresenceView, "GetUserPresenceViewV1"}, + {20601, &IFriendService::GetUserPresenceView, "GetUserPresenceViewV2"}, // 19.0.0+ + {20700, nullptr, "GetPlayHistoryListV1"}, + {20701, &IFriendService::GetPlayHistoryStatistics, "GetPlayHistoryStatistics"}, + {20702, nullptr, "GetPlayHistoryListV2"}, // 19.0.0+ + {20800, &IFriendService::LoadUserSetting, "LoadUserSettingV1"}, + {20801, nullptr, "SyncUserSetting"}, + {20802, &IFriendService::LoadUserSetting, "LoadUserSettingV2"}, // 19.0.0+ + {20900, &IFriendService::RequestListSummaryOverlayNotification, "RequestListSummaryOverlayNotification"}, + {21000, nullptr, "GetExternalApplicationCatalog"}, + {22000, nullptr, "GetReceivedFriendInvitationListV1"}, + {22001, nullptr, "GetReceivedFriendInvitationDetailedInfoV1"}, + {22002, nullptr, "GetReceivedFriendInvitationListV2"}, // 19.0.0+ + {22003, nullptr, "GetReceivedFriendInvitationDetailedInfoV2"}, // 19.0.0+ + {22010, &IFriendService::GetReceivedFriendInvitationCountCache, "GetReceivedFriendInvitationCountCache"}, + {30100, nullptr, "DropFriendNewlyFlags"}, + {30101, nullptr, "DeleteFriend"}, + {30110, nullptr, "DropFriendNewlyFlag"}, + {30120, nullptr, "ChangeFriendFavoriteFlag"}, + {30121, nullptr, "ChangeFriendOnlineNotificationFlag"}, + {30130, nullptr, "SetFriendNote"}, // 22.0.0+ + {30131, nullptr, "RequestUploadPendingNote"}, // 22.0.0+ + {30190, nullptr, "RequestSyncLocalUpdates"}, // 22.0.0+ + {30200, nullptr, "SendFriendRequest"}, + {30201, nullptr, "SendFriendRequestWithApplicationInfoV1"}, + {30202, nullptr, "CancelFriendRequest"}, + {30203, nullptr, "AcceptFriendRequest"}, + {30204, nullptr, "RejectFriendRequest"}, + {30205, nullptr, "ReadFriendRequest"}, + {30210, nullptr, "GetFacedFriendRequestRegistrationKey"}, + {30211, nullptr, "AddFacedFriendRequest"}, + {30212, nullptr, "CancelFacedFriendRequest"}, + {30213, nullptr, "GetFacedFriendRequestProfileImage"}, + {30214, nullptr, "GetFacedFriendRequestProfileImageFromPath"}, + {30215, nullptr, "SendFriendRequestWithExternalApplicationCatalogId"}, + {30216, nullptr, "ResendFacedFriendRequest"}, + {30217, nullptr, "SendFriendRequestWithNintendoNetworkIdInfo"}, + {30218, nullptr, "SendFriendRequestWithApplicationInfoV2"}, // 20.0.0+ + {30300, nullptr, "GetSnsAccountLinkPageUrl"}, // 5.0.0-19.0.1 + {30301, nullptr, "UnlinkSnsAccount"}, // 5.0.0-19.0.1 + {30400, nullptr, "BlockUser"}, + {30401, nullptr, "BlockUserWithApplicationInfoV1"}, + {30402, nullptr, "UnblockUser"}, + {30403, nullptr, "BlockUserWithApplicationInfoV2"}, // 20.0.0+ + {30500, nullptr, "GetProfileExtraFromFriendCodeV1"}, + {30501, nullptr, "GetProfileExtraFromFriendCodeV2"}, // 19.0.0+ + {30700, nullptr, "DeletePlayHistory"}, + {30701, nullptr, "AddPlayHistoryWithApplication"}, // 19.0.0+ + {30810, nullptr, "ChangePresencePermission"}, + {30811, nullptr, "ChangeFriendRequestReception"}, + {30812, nullptr, "ChangePlayLogPermission"}, + {30820, nullptr, "IssueFriendCode"}, + {30830, nullptr, "ClearPlayLog"}, + {30900, nullptr, "SendFriendInvitationV1"}, + {30901, nullptr, "SendFriendInvitationV2"}, // 19.0.0+ + {30910, nullptr, "ReadFriendInvitation"}, + {30911, nullptr, "ReadAllFriendInvitations"}, + {31000, nullptr, "OpenUser"}, // 19.0.0+ + {40100, nullptr, "DeleteFriendListCache"}, + {40400, nullptr, "DeleteBlockedUserListCache"}, + {49900, nullptr, "DeleteNetworkServiceAccountCache"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); + + completion_event = service_context.CreateEvent("IFriendService:CompletionEvent"); } ~IFriendService() override { @@ -266,134 +367,27 @@ private: rb.Push(0); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &IFriendService::GetCompletionEvent, "GetCompletionEvent"}, - FunctionInfo{1, &IFriendService::Cancel, "Cancel"}, - FunctionInfo{10100, nullptr, "GetFriendListIds"}, - FunctionInfo{10101, &IFriendService::GetFriendList, "GetFriendList"}, - FunctionInfo{10102, nullptr, "UpdateFriendInfo"}, - FunctionInfo{10110, nullptr, "GetFriendProfileImage"}, - FunctionInfo{10111, nullptr, "GetFriendProfileImageWithImageSize", MakeVersionGate({18,0,0})}, - FunctionInfo{10120, &IFriendService::CheckFriendListAvailability, "CheckFriendListAvailability"}, - FunctionInfo{10121, nullptr, "EnsureFriendListAvailable"}, - FunctionInfo{10200, nullptr, "SendFriendRequestForApplication"}, - FunctionInfo{10211, nullptr, "AddFacedFriendRequestForApplication"}, - FunctionInfo{10400, &IFriendService::GetBlockedUserListIds, "GetBlockedUserListIds"}, - FunctionInfo{10420, &IFriendService::CheckBlockedUserListAvailability, "CheckBlockedUserListAvailability"}, - FunctionInfo{10421, nullptr, "EnsureBlockedUserListAvailable"}, - FunctionInfo{10500, nullptr, "GetProfileList"}, - FunctionInfo{10501, nullptr, "GetProfileListV2", MakeVersionGate({18,0,0})}, - FunctionInfo{10600, nullptr, "DeclareOpenOnlinePlaySession"}, - FunctionInfo{10601, &IFriendService::DeclareCloseOnlinePlaySession, "DeclareCloseOnlinePlaySession"}, - FunctionInfo{10610, &IFriendService::UpdateUserPresence, "UpdateUserPresence"}, - FunctionInfo{10700, &IFriendService::GetPlayHistoryRegistrationKey, "GetPlayHistoryRegistrationKey"}, - FunctionInfo{10701, nullptr, "GetPlayHistoryRegistrationKeyWithNetworkServiceAccountId"}, - FunctionInfo{10702, nullptr, "AddPlayHistory"}, - FunctionInfo{11000, nullptr, "GetProfileImageUrl"}, - FunctionInfo{11001, nullptr, "GetProfileImageUrlV2", MakeVersionGate({18,0,0})}, - FunctionInfo{20100, &IFriendService::GetFriendCount, "GetFriendCount"}, - FunctionInfo{20101, &IFriendService::GetNewlyFriendCount, "GetNewlyFriendCount"}, - FunctionInfo{20102, nullptr, "GetFriendDetailedInfo"}, - FunctionInfo{20103, nullptr, "SyncFriendList"}, - FunctionInfo{20104, &IFriendService::RequestSyncFriendList, "RequestSyncFriendList"}, - FunctionInfo{20105, &IFriendService::GetFriendListForViewer, "GetFriendListForViewerV1"}, - FunctionInfo{20106, nullptr, "UpdateFriendInfoForViewerV1"}, - FunctionInfo{20107, nullptr, "GetFriendDetailedInfoV2", MakeVersionGate({20,0,0})}, - FunctionInfo{20108, &IFriendService::GetFriendListForViewer, "GetFriendListForViewerV2", MakeVersionGate({22,0,0})}, - FunctionInfo{20109, nullptr, "UpdateFriendInfoForViewerV2", MakeVersionGate({22,0,0})}, - FunctionInfo{20110, nullptr, "LoadFriendSettingV1"}, - FunctionInfo{20111, nullptr, "LoadFriendSettingV2", MakeVersionGate({22,0,0})}, - FunctionInfo{20200, &IFriendService::GetReceivedFriendRequestCount, "GetReceivedFriendRequestCount"}, - FunctionInfo{20201, nullptr, "GetFriendRequestListV1"}, - FunctionInfo{20202, nullptr, "GetFriendRequestListV2", MakeVersionGate({20,0,0})}, - FunctionInfo{20203, nullptr, "GetFriendRequestReceivedNotificationCount", MakeVersionGate({22,0,0})}, - FunctionInfo{20300, nullptr, "GetFriendCandidateList"}, - FunctionInfo{20301, nullptr, "GetNintendoNetworkIdInfo"}, - FunctionInfo{20302, nullptr, "GetSnsAccountLinkage", MakeVersionGate({5,0,0}, {19,0,1})}, - FunctionInfo{20303, nullptr, "GetSnsAccountProfile", MakeVersionGate({5,0,0}, {19,0,1})}, - FunctionInfo{20304, nullptr, "GetSnsAccountFriendList", MakeVersionGate({5,0,0}, {19,0,1})}, - FunctionInfo{20400, nullptr, "GetBlockedUserListV1"}, - FunctionInfo{20401, nullptr, "SyncBlockedUserList"}, - FunctionInfo{20402, nullptr, "GetBlockedUserListV2", MakeVersionGate({20,0,0})}, - FunctionInfo{20500, nullptr, "GetProfileExtraListV1"}, - FunctionInfo{20501, nullptr, "GetRelationship"}, - FunctionInfo{20502, nullptr, "GetProfileExtraListV2", MakeVersionGate({19,0,0})}, - FunctionInfo{20600, &IFriendService::GetUserPresenceView, "GetUserPresenceViewV1"}, - FunctionInfo{20601, &IFriendService::GetUserPresenceView, "GetUserPresenceViewV2", MakeVersionGate({19,0,0})}, - FunctionInfo{20700, nullptr, "GetPlayHistoryListV1"}, - FunctionInfo{20701, &IFriendService::GetPlayHistoryStatistics, "GetPlayHistoryStatistics"}, - FunctionInfo{20702, nullptr, "GetPlayHistoryListV2", MakeVersionGate({19,0,0})}, - FunctionInfo{20800, &IFriendService::LoadUserSetting, "LoadUserSettingV1"}, - FunctionInfo{20801, nullptr, "SyncUserSetting"}, - FunctionInfo{20802, &IFriendService::LoadUserSetting, "LoadUserSettingV2", MakeVersionGate({19,0,0})}, - FunctionInfo{20900, &IFriendService::RequestListSummaryOverlayNotification, "RequestListSummaryOverlayNotification"}, - FunctionInfo{21000, nullptr, "GetExternalApplicationCatalog"}, - FunctionInfo{22000, nullptr, "GetReceivedFriendInvitationListV1"}, - FunctionInfo{22001, nullptr, "GetReceivedFriendInvitationDetailedInfoV1"}, - FunctionInfo{22002, nullptr, "GetReceivedFriendInvitationListV2", MakeVersionGate({19,0,0})}, - FunctionInfo{22003, nullptr, "GetReceivedFriendInvitationDetailedInfoV2", MakeVersionGate({19,0,0})}, - FunctionInfo{22010, &IFriendService::GetReceivedFriendInvitationCountCache, "GetReceivedFriendInvitationCountCache"}, - FunctionInfo{30100, nullptr, "DropFriendNewlyFlags"}, - FunctionInfo{30101, nullptr, "DeleteFriend"}, - FunctionInfo{30110, nullptr, "DropFriendNewlyFlag"}, - FunctionInfo{30120, nullptr, "ChangeFriendFavoriteFlag"}, - FunctionInfo{30121, nullptr, "ChangeFriendOnlineNotificationFlag"}, - FunctionInfo{30130, nullptr, "SetFriendNote", MakeVersionGate({22,0,0})}, - FunctionInfo{30131, nullptr, "RequestUploadPendingNote", MakeVersionGate({22,0,0})}, - FunctionInfo{30190, nullptr, "RequestSyncLocalUpdates", MakeVersionGate({22,0,0})}, - FunctionInfo{30200, nullptr, "SendFriendRequest"}, - FunctionInfo{30201, nullptr, "SendFriendRequestWithApplicationInfoV1"}, - FunctionInfo{30202, nullptr, "CancelFriendRequest"}, - FunctionInfo{30203, nullptr, "AcceptFriendRequest"}, - FunctionInfo{30204, nullptr, "RejectFriendRequest"}, - FunctionInfo{30205, nullptr, "ReadFriendRequest"}, - FunctionInfo{30210, nullptr, "GetFacedFriendRequestRegistrationKey"}, - FunctionInfo{30211, nullptr, "AddFacedFriendRequest"}, - FunctionInfo{30212, nullptr, "CancelFacedFriendRequest"}, - FunctionInfo{30213, nullptr, "GetFacedFriendRequestProfileImage"}, - FunctionInfo{30214, nullptr, "GetFacedFriendRequestProfileImageFromPath"}, - FunctionInfo{30215, nullptr, "SendFriendRequestWithExternalApplicationCatalogId"}, - FunctionInfo{30216, nullptr, "ResendFacedFriendRequest"}, - FunctionInfo{30217, nullptr, "SendFriendRequestWithNintendoNetworkIdInfo"}, - FunctionInfo{30218, nullptr, "SendFriendRequestWithApplicationInfoV2", MakeVersionGate({20,0,0})}, - FunctionInfo{30300, nullptr, "GetSnsAccountLinkPageUrl", MakeVersionGate({5,0,0}, {19,0,1})}, - FunctionInfo{30301, nullptr, "UnlinkSnsAccount", MakeVersionGate({5,0,0}, {19,0,1})}, - FunctionInfo{30400, nullptr, "BlockUser"}, - FunctionInfo{30401, nullptr, "BlockUserWithApplicationInfoV1"}, - FunctionInfo{30402, nullptr, "UnblockUser"}, - FunctionInfo{30403, nullptr, "BlockUserWithApplicationInfoV2", MakeVersionGate({20,0,0})}, - FunctionInfo{30500, nullptr, "GetProfileExtraFromFriendCodeV1"}, - FunctionInfo{30501, nullptr, "GetProfileExtraFromFriendCodeV2", MakeVersionGate({19,0,0})}, - FunctionInfo{30700, nullptr, "DeletePlayHistory"}, - FunctionInfo{30701, nullptr, "AddPlayHistoryWithApplication", MakeVersionGate({19,0,0})}, - FunctionInfo{30810, nullptr, "ChangePresencePermission"}, - FunctionInfo{30811, nullptr, "ChangeFriendRequestReception"}, - FunctionInfo{30812, nullptr, "ChangePlayLogPermission"}, - FunctionInfo{30820, nullptr, "IssueFriendCode"}, - FunctionInfo{30830, nullptr, "ClearPlayLog"}, - FunctionInfo{30900, nullptr, "SendFriendInvitationV1"}, - FunctionInfo{30901, nullptr, "SendFriendInvitationV2", MakeVersionGate({19,0,0})}, - FunctionInfo{30910, nullptr, "ReadFriendInvitation"}, - FunctionInfo{30911, nullptr, "ReadAllFriendInvitations"}, - FunctionInfo{31000, nullptr, "OpenUser", MakeVersionGate({19,0,0})}, - FunctionInfo{40100, nullptr, "DeleteFriendListCache"}, - FunctionInfo{40400, nullptr, "DeleteBlockedUserListCache"}, - FunctionInfo{49900, nullptr, "DeleteNetworkServiceAccountCache"} - ); KernelHelpers::ServiceContext service_context; + Kernel::KEvent* completion_event; }; class INotificationService final : public ServiceFramework { public: explicit INotificationService(Core::System& system_, Common::UUID uuid_) - : ServiceFramework{system_, "INotificationService"}, uuid{uuid_} - , service_context{system_, "INotificationService"} { - notification_event = service_context.CreateEvent("INotificationService:NotifyEvent"); - } + : ServiceFramework{system_, "INotificationService"}, uuid{uuid_}, + service_context{system_, "INotificationService"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &INotificationService::GetEvent, "GetEvent"}, + {1, &INotificationService::Clear, "Clear"}, + {2, &INotificationService::Pop, "Pop"} + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); + + notification_event = service_context.CreateEvent("INotificationService:NotifyEvent"); } ~INotificationService() override { @@ -471,13 +465,9 @@ private: bool has_received_friend_request; }; - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &INotificationService::GetEvent, "GetEvent"}, - FunctionInfo{1, &INotificationService::Clear, "Clear"}, - FunctionInfo{2, &INotificationService::Pop, "Pop"} - ); Common::UUID uuid; KernelHelpers::ServiceContext service_context; + Kernel::KEvent* notification_event; std::queue notifications; States states{}; @@ -511,67 +501,61 @@ class IServiceForApplication final : public ServiceFramework FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + { + static const FunctionInfo functions[] = { + {0, nullptr, "GetReceivableNeighborInfoCountMax"}, + {10, nullptr, "IsNeighborDetectionEnabled"}, + }; + RegisterHandlers(functions); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetReceivableNeighborInfoCountMax"}, - FunctionInfo{10, nullptr, "IsNeighborDetectionEnabled"} - ); }; class IServiceForSystem final : public ServiceFramework { public: explicit IServiceForSystem(Core::System& system_) : ServiceFramework{system_, "nd:sys"} - {} - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + { + static const FunctionInfo functions[] = { + {0, nullptr, "GetReceivableNeighborInfoCountMax"}, + {10, nullptr, "IsNeighborDetectionEnabled"}, + {200, nullptr, "SetSystemData"}, + {201, nullptr, "ClearSystemData"}, + {203, nullptr, "GetReceivableNeighborInfoCountForSystem"}, + {204, nullptr, "ReceiveNeighborInfoForSystem"}, + {205, nullptr, "SetSender"}, + {206, nullptr, "GetSender"}, + {207, nullptr, "CreateScannerForSystem"}, + {208, nullptr, "CreateReceiveEventHolderForSystem"}, + {223, nullptr, "EnableNeighborDetection"}, + {224, nullptr, "DisableNeighborDetection"}, + {226, nullptr, "EnablePowerSave"}, + {227, nullptr, "DisablePowerSave"}, + {228, nullptr, "IsPowerSaveEnabled"}, + {232, nullptr, "ClearBlockedUsers"}, + {233, nullptr, "GetBlockedUserCount"}, + {234, nullptr, "BlockUserByLocalUserId"}, + {235, nullptr, "BlockUserByNetworkUserId"}, + {236, nullptr, "UnblockUserByLocalUserId"}, + {237, nullptr, "UnblockUserByNetworkUserId"}, + {240, nullptr, "DeleteApplication"}, + {250, nullptr, "InitializeApplicationInfo"}, + {260, nullptr, "CreateAccountSystemSaveDataAccessSuppressor"}, + {300, nullptr, "AddReceivedNeighborInfoForSystemForDebug"}, + {301, nullptr, "GetSendDataForDebug"}, + {302, nullptr, "ClearReceiveCounterForDebug"}, + {303, nullptr, "GetNextReceiveCounterForDebug"}, + {304, nullptr, "ListBlockedUsersForDebug"}, + {305, nullptr, "RefreshSendDataIdForDebug"}, + {306, nullptr, "ReloadFwdbgSettingsForDebug"}, + {307, nullptr, "EnableApplicationForDebug"}, + {308, nullptr, "GetNextReceiveCountersForDebug"}, + {309, nullptr, "ListApplicationInfoForDebug"}, + {310, nullptr, "SetApplicationDataForDebug"}, + {400, nullptr, "GetNetworkUserId"}, + {401, nullptr, "DeleteNetworkUserId"}, + }; + RegisterHandlers(functions); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetReceivableNeighborInfoCountMax"}, - FunctionInfo{10, nullptr, "IsNeighborDetectionEnabled"}, - FunctionInfo{200, nullptr, "SetSystemData"}, - FunctionInfo{201, nullptr, "ClearSystemData"}, - FunctionInfo{203, nullptr, "GetReceivableNeighborInfoCountForSystem"}, - FunctionInfo{204, nullptr, "ReceiveNeighborInfoForSystem"}, - FunctionInfo{205, nullptr, "SetSender"}, - FunctionInfo{206, nullptr, "GetSender"}, - FunctionInfo{207, nullptr, "CreateScannerForSystem"}, - FunctionInfo{208, nullptr, "CreateReceiveEventHolderForSystem"}, - FunctionInfo{223, nullptr, "EnableNeighborDetection"}, - FunctionInfo{224, nullptr, "DisableNeighborDetection"}, - FunctionInfo{226, nullptr, "EnablePowerSave"}, - FunctionInfo{227, nullptr, "DisablePowerSave"}, - FunctionInfo{228, nullptr, "IsPowerSaveEnabled"}, - FunctionInfo{232, nullptr, "ClearBlockedUsers"}, - FunctionInfo{233, nullptr, "GetBlockedUserCount"}, - FunctionInfo{234, nullptr, "BlockUserByLocalUserId"}, - FunctionInfo{235, nullptr, "BlockUserByNetworkUserId"}, - FunctionInfo{236, nullptr, "UnblockUserByLocalUserId"}, - FunctionInfo{237, nullptr, "UnblockUserByNetworkUserId"}, - FunctionInfo{240, nullptr, "DeleteApplication"}, - FunctionInfo{250, nullptr, "InitializeApplicationInfo"}, - FunctionInfo{260, nullptr, "CreateAccountSystemSaveDataAccessSuppressor"}, - FunctionInfo{300, nullptr, "AddReceivedNeighborInfoForSystemForDebug"}, - FunctionInfo{301, nullptr, "GetSendDataForDebug"}, - FunctionInfo{302, nullptr, "ClearReceiveCounterForDebug"}, - FunctionInfo{303, nullptr, "GetNextReceiveCounterForDebug"}, - FunctionInfo{304, nullptr, "ListBlockedUsersForDebug"}, - FunctionInfo{305, nullptr, "RefreshSendDataIdForDebug"}, - FunctionInfo{306, nullptr, "ReloadFwdbgSettingsForDebug"}, - FunctionInfo{307, nullptr, "EnableApplicationForDebug"}, - FunctionInfo{308, nullptr, "GetNextReceiveCountersForDebug"}, - FunctionInfo{309, nullptr, "ListApplicationInfoForDebug"}, - FunctionInfo{310, nullptr, "SetApplicationDataForDebug"}, - FunctionInfo{400, nullptr, "GetNetworkUserId"}, - FunctionInfo{401, nullptr, "DeleteNetworkUserId"} - ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/friend/friend.h b/src/core/hle/service/friend/friend.h index 2824dc7866..61ac92fbb4 100644 --- a/src/core/hle/service/friend/friend.h +++ b/src/core/hle/service/friend/friend.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/friend/friend_interface.cpp b/src/core/hle/service/friend/friend_interface.cpp new file mode 100644 index 0000000000..b436d43303 --- /dev/null +++ b/src/core/hle/service/friend/friend_interface.cpp @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/hle/service/friend/friend_interface.h" + +namespace Service::Friend { + +Friend::Friend(std::shared_ptr module_, Core::System& system_, const char* name) + : Interface(std::move(module_), system_, name) { + static const FunctionInfo functions[] = { + {0, &Friend::CreateFriendService, "CreateFriendService"}, + {1, &Friend::CreateNotificationService, "CreateNotificationService"}, + {2, nullptr, "CreateDaemonSuspendSessionService"}, + }; + RegisterHandlers(functions); +} + +Friend::~Friend() = default; + +} // namespace Service::Friend diff --git a/src/core/hle/service/friend/friend_interface.h b/src/core/hle/service/friend/friend_interface.h new file mode 100644 index 0000000000..0315c62c39 --- /dev/null +++ b/src/core/hle/service/friend/friend_interface.h @@ -0,0 +1,19 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/friend/friend.h" + +namespace Service::Friend { + +class Friend final : public Module::Interface { +public: + explicit Friend(std::shared_ptr module_, Core::System& system_, const char* name); + ~Friend() override; +}; + +} // namespace Service::Friend diff --git a/src/core/hle/service/glue/arp.cpp b/src/core/hle/service/glue/arp.cpp index 203adb7ca7..7eda57ddc3 100644 --- a/src/core/hle/service/glue/arp.cpp +++ b/src/core/hle/service/glue/arp.cpp @@ -35,6 +35,22 @@ std::optional GetTitleIDForProcessID(Core::System& system, u64 process_id) ARP_R::ARP_R(Core::System& system_, const ARPManager& manager_) : ServiceFramework{system_, "arp:r"}, manager{manager_} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &ARP_R::GetApplicationLaunchProperty, "GetApplicationLaunchProperty"}, + {1, &ARP_R::GetApplicationLaunchPropertyWithApplicationId, "GetApplicationLaunchPropertyWithApplicationId"}, + {2, &ARP_R::GetApplicationControlProperty, "GetApplicationControlProperty"}, + {3, &ARP_R::GetApplicationControlPropertyWithApplicationId, "GetApplicationControlPropertyWithApplicationId"}, + {4, nullptr, "GetApplicationInstanceUnregistrationNotifier"}, + {5, nullptr, "ListApplicationInstanceId"}, + {6, nullptr, "GetMicroApplicationInstanceId"}, + {7, nullptr, "GetApplicationCertificate"}, + {9998, nullptr, "GetPreomiaApplicationLaunchProperty"}, + {9999, nullptr, "GetPreomiaApplicationControlProperty"}, + }; + // clang-format on + + RegisterHandlers(functions); } ARP_R::~ARP_R() = default; @@ -148,10 +164,16 @@ public: using IssuerFn = std::function)>; explicit IRegistrar(Core::System& system_, IssuerFn&& issuer) - : ServiceFramework{system_, "IRegistrar"}, issue_process_id{std::move(issuer)} {} + : ServiceFramework{system_, "IRegistrar"}, issue_process_id{std::move(issuer)} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &IRegistrar::Issue, "Issue"}, + {1, &IRegistrar::SetApplicationLaunchProperty, "SetApplicationLaunchProperty"}, + {2, &IRegistrar::SetApplicationControlProperty, "SetApplicationControlProperty"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -216,11 +238,6 @@ private: rb.Push(ResultSuccess); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &IRegistrar::Issue, "Issue"}, - FunctionInfo{1, &IRegistrar::SetApplicationLaunchProperty, "SetApplicationLaunchProperty"}, - FunctionInfo{2, &IRegistrar::SetApplicationControlProperty, "SetApplicationControlProperty"} - ); IssuerFn issue_process_id; bool issued = false; ApplicationLaunchProperty launch{}; @@ -229,6 +246,15 @@ private: ARP_W::ARP_W(Core::System& system_, ARPManager& manager_) : ServiceFramework{system_, "arp:w"}, manager{manager_} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &ARP_W::AcquireRegistrar, "AcquireRegistrar"}, + {1, &ARP_W::UnregisterApplicationInstance , "UnregisterApplicationInstance "}, + {2, nullptr, "AcquireUpdater"}, + }; + // clang-format on + + RegisterHandlers(functions); } ARP_W::~ARP_W() = default; diff --git a/src/core/hle/service/glue/arp.h b/src/core/hle/service/glue/arp.h index de966475f9..ec3d809b5b 100644 --- a/src/core/hle/service/glue/arp.h +++ b/src/core/hle/service/glue/arp.h @@ -24,21 +24,6 @@ private: void GetApplicationControlProperty(HLERequestContext& ctx); void GetApplicationControlPropertyWithApplicationId(HLERequestContext& ctx); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &ARP_R::GetApplicationLaunchProperty, "GetApplicationLaunchProperty"}, - FunctionInfo{1, &ARP_R::GetApplicationLaunchPropertyWithApplicationId, "GetApplicationLaunchPropertyWithApplicationId"}, - FunctionInfo{2, &ARP_R::GetApplicationControlProperty, "GetApplicationControlProperty"}, - FunctionInfo{3, &ARP_R::GetApplicationControlPropertyWithApplicationId, "GetApplicationControlPropertyWithApplicationId"}, - FunctionInfo{4, nullptr, "GetApplicationInstanceUnregistrationNotifier"}, - FunctionInfo{5, nullptr, "ListApplicationInstanceId"}, - FunctionInfo{6, nullptr, "GetMicroApplicationInstanceId"}, - FunctionInfo{7, nullptr, "GetApplicationCertificate"}, - FunctionInfo{9998, nullptr, "GetPreomiaApplicationLaunchProperty"}, - FunctionInfo{9999, nullptr, "GetPreomiaApplicationControlProperty"} - ); const ARPManager& manager; }; @@ -51,14 +36,6 @@ private: void AcquireRegistrar(HLERequestContext& ctx); void UnregisterApplicationInstance(HLERequestContext& ctx); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &ARP_W::AcquireRegistrar, "AcquireRegistrar"}, - FunctionInfo{1, &ARP_W::UnregisterApplicationInstance , "UnregisterApplicationInstance "}, - FunctionInfo{2, nullptr, "AcquireUpdater"} - ); ARPManager& manager; std::shared_ptr registrar; }; diff --git a/src/core/hle/service/glue/bgtc.cpp b/src/core/hle/service/glue/bgtc.cpp index 7c7b5ea13c..360f16f0dd 100644 --- a/src/core/hle/service/glue/bgtc.cpp +++ b/src/core/hle/service/glue/bgtc.cpp @@ -11,7 +11,15 @@ namespace Service::Glue { -BGTC_T::BGTC_T(Core::System& system_) : ServiceFramework{system_, "bgtc:t"} {} +BGTC_T::BGTC_T(Core::System& system_) : ServiceFramework{system_, "bgtc:t"} { + // clang-format off + static const FunctionInfo functions[] = { + {100, &BGTC_T::OpenTaskService, "OpenTaskService"}, + }; + // clang-format on + + RegisterHandlers(functions); +} BGTC_T::~BGTC_T() = default; @@ -24,11 +32,44 @@ void BGTC_T::OpenTaskService(HLERequestContext& ctx) { } ITaskService::ITaskService(Core::System& system_) : ServiceFramework{system_, "ITaskService"} { + // clang-format off + static const FunctionInfo functions[] = { + {1, nullptr, "NotifyTaskStarting"}, + {2, nullptr, "NotifyTaskFinished"}, + {3, nullptr, "GetTriggerEvent"}, + {4, nullptr, "IsInHalfAwake"}, + {5, nullptr, "NotifyClientName"}, + {6, nullptr, "IsInFullAwake"}, + {11, nullptr, "ScheduleTask"}, + {12, nullptr, "GetScheduledTaskInterval"}, + {13, nullptr, "UnscheduleTask"}, + {14, nullptr, "GetScheduleEvent"}, + {15, nullptr, "SchedulePeriodicTask"}, + {16, nullptr, "Unknown16"}, + {101, nullptr, "GetOperationMode"}, + {102, nullptr, "WillDisconnectNetworkWhenEnteringSleep"}, + {103, nullptr, "WillStayHalfAwakeInsteadSleep"}, + {200, nullptr, "Unknown200"}, + }; + // clang-format on + + RegisterHandlers(functions); } ITaskService::~ITaskService() = default; BGTC_SC::BGTC_SC(Core::System& system_) : ServiceFramework{system_, "bgtc:sc"} { + // clang-format off + static const FunctionInfo functions[] = { + {1, nullptr, "GetState"}, + {2, nullptr, "GetStateChangedEvent"}, + {3, nullptr, "NotifyEnteringHalfAwake"}, + {4, nullptr, "NotifyLeavingHalfAwake"}, + {5, nullptr, "SetIsUsingSleepUnsupportedDevices"}, + }; + // clang-format on + + RegisterHandlers(functions); } BGTC_SC::~BGTC_SC() = default; diff --git a/src/core/hle/service/glue/bgtc.h b/src/core/hle/service/glue/bgtc.h index 0ef0ab902f..129193da1f 100644 --- a/src/core/hle/service/glue/bgtc.h +++ b/src/core/hle/service/glue/bgtc.h @@ -20,57 +20,18 @@ public: ~BGTC_T() override; void OpenTaskService(HLERequestContext& ctx); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{100, &BGTC_T::OpenTaskService, "OpenTaskService"} - ); }; class ITaskService final : public ServiceFramework { public: explicit ITaskService(Core::System& system_); ~ITaskService() override; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{1, nullptr, "NotifyTaskStarting"}, - FunctionInfo{2, nullptr, "NotifyTaskFinished"}, - FunctionInfo{3, nullptr, "GetTriggerEvent"}, - FunctionInfo{4, nullptr, "IsInHalfAwake"}, - FunctionInfo{5, nullptr, "NotifyClientName"}, - FunctionInfo{6, nullptr, "IsInFullAwake"}, - FunctionInfo{11, nullptr, "ScheduleTask"}, - FunctionInfo{12, nullptr, "GetScheduledTaskInterval"}, - FunctionInfo{13, nullptr, "UnscheduleTask"}, - FunctionInfo{14, nullptr, "GetScheduleEvent"}, - FunctionInfo{15, nullptr, "SchedulePeriodicTask"}, - FunctionInfo{16, nullptr, "Unknown16"}, - FunctionInfo{101, nullptr, "GetOperationMode"}, - FunctionInfo{102, nullptr, "WillDisconnectNetworkWhenEnteringSleep"}, - FunctionInfo{103, nullptr, "WillStayHalfAwakeInsteadSleep"}, - FunctionInfo{200, nullptr, "Unknown200"} - ); }; class BGTC_SC final : public ServiceFramework { public: explicit BGTC_SC(Core::System& system_); ~BGTC_SC() override; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{1, nullptr, "GetState"}, - FunctionInfo{2, nullptr, "GetStateChangedEvent"}, - FunctionInfo{3, nullptr, "NotifyEnteringHalfAwake"}, - FunctionInfo{4, nullptr, "NotifyLeavingHalfAwake"}, - FunctionInfo{5, nullptr, "SetIsUsingSleepUnsupportedDevices"} - ); }; } // namespace Service::Glue diff --git a/src/core/hle/service/glue/ectx.cpp b/src/core/hle/service/glue/ectx.cpp index 80d22a0ca7..322ae45254 100644 --- a/src/core/hle/service/glue/ectx.cpp +++ b/src/core/hle/service/glue/ectx.cpp @@ -12,10 +12,14 @@ namespace Service::Glue { // This is nn::err::context::IContextRegistrar class IContextRegistrar : public ServiceFramework { public: - IContextRegistrar(Core::System& system_) : ServiceFramework{system_, "IContextRegistrar"} {} + IContextRegistrar(Core::System& system_) : ServiceFramework{system_, "IContextRegistrar"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &IContextRegistrar::Complete, "Complete"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } ~IContextRegistrar() override = default; @@ -37,21 +41,41 @@ private: rb.Push(ResultSuccess); rb.Push(0); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &IContextRegistrar::Complete, "Complete"} - ); }; ECTX_W::ECTX_W(Core::System& system_) : ServiceFramework{system_, "ectx:w"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "CreateContextRegistrar"}, + {1, nullptr, "CommitContext"}, + {2, nullptr, "RemoveContext"}, + }; + // clang-format on + RegisterHandlers(functions); } ECTX_W::~ECTX_W() = default; ECTX_R::ECTX_R(Core::System& system_) : ServiceFramework{system_, "ectx:r"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetContextInfo"}, + {1, nullptr, "PullContext"}, + {2, nullptr, "ListContextDescriptorWithResultForDebug"}, + }; + // clang-format on + RegisterHandlers(functions); } ECTX_R::~ECTX_R() = default; ECTX_AW::ECTX_AW(Core::System& system_) : ServiceFramework{system_, "ectx:aw"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &ECTX_AW::CreateContextRegistrar, "CreateContextRegistrar"}, + {1, nullptr, "CommitContext"}, + }; + // clang-format on + + RegisterHandlers(functions); } ECTX_AW::~ECTX_AW() = default; diff --git a/src/core/hle/service/glue/ectx.h b/src/core/hle/service/glue/ectx.h index 01f109c609..ff48075eda 100644 --- a/src/core/hle/service/glue/ectx.h +++ b/src/core/hle/service/glue/ectx.h @@ -18,30 +18,12 @@ class ECTX_W final : public ServiceFramework { public: explicit ECTX_W(Core::System& system_); ~ECTX_W() override; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "CreateContextRegistrar"}, - FunctionInfo{1, nullptr, "CommitContext"}, - FunctionInfo{2, nullptr, "RemoveContext"} - ); }; class ECTX_R final : public ServiceFramework { public: explicit ECTX_R(Core::System& system_); ~ECTX_R() override; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetContextInfo"}, - FunctionInfo{1, nullptr, "PullContext"}, - FunctionInfo{2, nullptr, "ListContextDescriptorWithResultForDebug"} - ); }; class ECTX_AW final : public ServiceFramework { @@ -51,14 +33,6 @@ public: private: void CreateContextRegistrar(HLERequestContext& ctx); - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &ECTX_AW::CreateContextRegistrar, "CreateContextRegistrar"}, - FunctionInfo{1, nullptr, "CommitContext"} - ); }; } // namespace Service::Glue diff --git a/src/core/hle/service/glue/errors.h b/src/core/hle/service/glue/errors.h index 30feaa5c03..9839271447 100644 --- a/src/core/hle/service/glue/errors.h +++ b/src/core/hle/service/glue/errors.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/glue/glue.h b/src/core/hle/service/glue/glue.h index 2a906f5ad6..64d45cfc14 100644 --- a/src/core/hle/service/glue/glue.h +++ b/src/core/hle/service/glue/glue.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/glue/glue_manager.cpp b/src/core/hle/service/glue/glue_manager.cpp index 22f0017044..78fc5ebac3 100644 --- a/src/core/hle/service/glue/glue_manager.cpp +++ b/src/core/hle/service/glue/glue_manager.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/glue/glue_manager.h b/src/core/hle/service/glue/glue_manager.h index 216aa34c19..6330828834 100644 --- a/src/core/hle/service/glue/glue_manager.h +++ b/src/core/hle/service/glue/glue_manager.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/glue/notif.cpp b/src/core/hle/service/glue/notif.cpp index a369b78ddd..716e4da32d 100644 --- a/src/core/hle/service/glue/notif.cpp +++ b/src/core/hle/service/glue/notif.cpp @@ -17,45 +17,9 @@ namespace Service::Glue { namespace { + constexpr inline std::size_t MaxAlarms = 8; -} -std::optional INotificationServicesForApplication::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{500, D<&INotificationServicesForApplication::RegisterAlarmSetting>, "RegisterAlarmSetting"}, - FunctionInfo{510, D<&INotificationServicesForApplication::UpdateAlarmSetting>, "UpdateAlarmSetting"}, - FunctionInfo{520, D<&INotificationServicesForApplication::ListAlarmSettings>, "ListAlarmSettings"}, - FunctionInfo{530, D<&INotificationServicesForApplication::LoadApplicationParameter>, "LoadApplicationParameter"}, - FunctionInfo{540, D<&INotificationServicesForApplication::DeleteAlarmSetting>, "DeleteAlarmSetting"}, - FunctionInfo{1000, D<&INotificationServicesForApplication::Initialize>, "Initialize"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - -std::optional INotificationServices::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{500, D<&INotificationServices::RegisterAlarmSetting>, "RegisterAlarmSetting"}, - FunctionInfo{510, D<&INotificationServices::UpdateAlarmSetting>, "UpdateAlarmSetting"}, - FunctionInfo{520, D<&INotificationServices::ListAlarmSettings>, "ListAlarmSettings"}, - FunctionInfo{530, D<&INotificationServices::LoadApplicationParameter>, "LoadApplicationParameter"}, - FunctionInfo{540, D<&INotificationServices::DeleteAlarmSetting>, "DeleteAlarmSetting"}, - FunctionInfo{1000, D<&INotificationServices::Initialize>, "Initialize"}, - FunctionInfo{1010, nullptr, "ListNotifications"}, - FunctionInfo{1020, nullptr, "DeleteNotification"}, - FunctionInfo{1030, nullptr, "ClearNotifications"}, - FunctionInfo{1040, D<&INotificationServices::OpenNotificationSystemEventAccessor>, "OpenNotificationSystemEventAccessor"}, - FunctionInfo{1500, nullptr, "SetNotificationPresentationSetting"}, - FunctionInfo{1510, D<&INotificationServices::GetNotificationPresentationSetting>, "GetNotificationPresentationSetting"}, - FunctionInfo{2000, nullptr, "GetAlarmSetting"}, - FunctionInfo{2001, nullptr, "GetAlarmSettingWithApplicationParameter"}, - FunctionInfo{2010, nullptr, "MuteAlarmSetting"}, - FunctionInfo{2020, nullptr, "IsAlarmSettingReady"}, - FunctionInfo{8000, nullptr, "RegisterAppletResourceUserId"}, - FunctionInfo{8010, nullptr, "UnregisterAppletResourceUserId"}, - FunctionInfo{8999, nullptr, "GetCurrentTime"}, - FunctionInfo{9000, nullptr, "GetAlarmSettingNextNotificationTime"} - ); - return HandlerTableGenerateWithFind(key, functions); } Result NotificationServiceImpl::RegisterAlarmSetting(AlarmSettingId* out_alarm_setting_id, @@ -160,6 +124,18 @@ std::vector::iterator NotificationServiceImpl::GetAlarmFromId(Alar INotificationServicesForApplication::INotificationServicesForApplication(Core::System& system_) : ServiceFramework{system_, "notif:a"} { + // clang-format off + static const FunctionInfo functions[] = { + {500, D<&INotificationServicesForApplication::RegisterAlarmSetting>, "RegisterAlarmSetting"}, + {510, D<&INotificationServicesForApplication::UpdateAlarmSetting>, "UpdateAlarmSetting"}, + {520, D<&INotificationServicesForApplication::ListAlarmSettings>, "ListAlarmSettings"}, + {530, D<&INotificationServicesForApplication::LoadApplicationParameter>, "LoadApplicationParameter"}, + {540, D<&INotificationServicesForApplication::DeleteAlarmSetting>, "DeleteAlarmSetting"}, + {1000, D<&INotificationServicesForApplication::Initialize>, "Initialize"}, + }; + // clang-format on + + RegisterHandlers(functions); } INotificationServicesForApplication::~INotificationServicesForApplication() = default; @@ -202,13 +178,18 @@ class INotificationSystemEventAccessor final : public ServiceFramework { public: explicit INotificationSystemEventAccessor(Core::System& system_) - : ServiceFramework{system_, "INotificationSystemEventAccessor"} - , service_context{system_, "INotificationSystemEventAccessor"} { - notification_event = service_context.CreateEvent("INotificationSystemEventAccessor:NotificationEvent"); - } + : ServiceFramework{system_, "INotificationSystemEventAccessor"}, + service_context{system_, "INotificationSystemEventAccessor"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&INotificationSystemEventAccessor::GetSystemEvent>, "GetSystemEvent"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); + + notification_event = + service_context.CreateEvent("INotificationSystemEventAccessor:NotificationEvent"); } ~INotificationSystemEventAccessor() { @@ -223,15 +204,38 @@ private: R_SUCCEED(); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&INotificationSystemEventAccessor::GetSystemEvent>, "GetSystemEvent"} - ); KernelHelpers::ServiceContext service_context; Kernel::KEvent* notification_event; }; INotificationServices::INotificationServices(Core::System& system_) : ServiceFramework{system_, "notif:s"} { + // clang-format off + static const FunctionInfo functions[] = { + {500, D<&INotificationServices::RegisterAlarmSetting>, "RegisterAlarmSetting"}, + {510, D<&INotificationServices::UpdateAlarmSetting>, "UpdateAlarmSetting"}, + {520, D<&INotificationServices::ListAlarmSettings>, "ListAlarmSettings"}, + {530, D<&INotificationServices::LoadApplicationParameter>, "LoadApplicationParameter"}, + {540, D<&INotificationServices::DeleteAlarmSetting>, "DeleteAlarmSetting"}, + {1000, D<&INotificationServices::Initialize>, "Initialize"}, + {1010, nullptr, "ListNotifications"}, + {1020, nullptr, "DeleteNotification"}, + {1030, nullptr, "ClearNotifications"}, + {1040, D<&INotificationServices::OpenNotificationSystemEventAccessor>, "OpenNotificationSystemEventAccessor"}, + {1500, nullptr, "SetNotificationPresentationSetting"}, + {1510, D<&INotificationServices::GetNotificationPresentationSetting>, "GetNotificationPresentationSetting"}, + {2000, nullptr, "GetAlarmSetting"}, + {2001, nullptr, "GetAlarmSettingWithApplicationParameter"}, + {2010, nullptr, "MuteAlarmSetting"}, + {2020, nullptr, "IsAlarmSettingReady"}, + {8000, nullptr, "RegisterAppletResourceUserId"}, + {8010, nullptr, "UnregisterAppletResourceUserId"}, + {8999, nullptr, "GetCurrentTime"}, + {9000, nullptr, "GetAlarmSettingNextNotificationTime"}, + }; + // clang-format on + + RegisterHandlers(functions); } INotificationServices::~INotificationServices() = default; diff --git a/src/core/hle/service/glue/notif.h b/src/core/hle/service/glue/notif.h index c5367e5da4..7ae20ba6f8 100644 --- a/src/core/hle/service/glue/notif.h +++ b/src/core/hle/service/glue/notif.h @@ -101,7 +101,6 @@ private: Result DeleteAlarmSetting(AlarmSettingId alarm_setting_id); Result Initialize(ClientAppletResourceUserId aruid); - std::optional FindRequest(u32 key) override; NotificationServiceImpl impl; }; @@ -131,7 +130,6 @@ private: Out out_notification_presentation_setting, NotificationChannel notification_channel); - std::optional FindRequest(u32 key) override; NotificationServiceImpl impl; }; } // namespace Service::Glue diff --git a/src/core/hle/service/glue/time/alarm_worker.h b/src/core/hle/service/glue/time/alarm_worker.h index 131d012a6a..c8882fed88 100644 --- a/src/core/hle/service/glue/time/alarm_worker.h +++ b/src/core/hle/service/glue/time/alarm_worker.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/glue/time/file_timestamp_worker.cpp b/src/core/hle/service/glue/time/file_timestamp_worker.cpp index 048ff174c9..60bd688e72 100644 --- a/src/core/hle/service/glue/time/file_timestamp_worker.cpp +++ b/src/core/hle/service/glue/time/file_timestamp_worker.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/glue/time/file_timestamp_worker.h b/src/core/hle/service/glue/time/file_timestamp_worker.h index 5f8b9b0499..58f74e7d29 100644 --- a/src/core/hle/service/glue/time/file_timestamp_worker.h +++ b/src/core/hle/service/glue/time/file_timestamp_worker.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/glue/time/manager.cpp b/src/core/hle/service/glue/time/manager.cpp index 0da790e1c8..0b3312904e 100644 --- a/src/core/hle/service/glue/time/manager.cpp +++ b/src/core/hle/service/glue/time/manager.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project diff --git a/src/core/hle/service/glue/time/manager.h b/src/core/hle/service/glue/time/manager.h index 87e6a21fd5..5a86585754 100644 --- a/src/core/hle/service/glue/time/manager.h +++ b/src/core/hle/service/glue/time/manager.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/glue/time/pm_state_change_handler.cpp b/src/core/hle/service/glue/time/pm_state_change_handler.cpp index 7470fb2259..0bc37f75da 100644 --- a/src/core/hle/service/glue/time/pm_state_change_handler.cpp +++ b/src/core/hle/service/glue/time/pm_state_change_handler.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/glue/time/pm_state_change_handler.h b/src/core/hle/service/glue/time/pm_state_change_handler.h index 27d9f78726..bf99fa8a14 100644 --- a/src/core/hle/service/glue/time/pm_state_change_handler.h +++ b/src/core/hle/service/glue/time/pm_state_change_handler.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/glue/time/standard_steady_clock_resource.cpp b/src/core/hle/service/glue/time/standard_steady_clock_resource.cpp index 5ebaa33e00..e191405567 100644 --- a/src/core/hle/service/glue/time/standard_steady_clock_resource.cpp +++ b/src/core/hle/service/glue/time/standard_steady_clock_resource.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/glue/time/standard_steady_clock_resource.h b/src/core/hle/service/glue/time/standard_steady_clock_resource.h index 978d6b63b8..b5168cb837 100644 --- a/src/core/hle/service/glue/time/standard_steady_clock_resource.h +++ b/src/core/hle/service/glue/time/standard_steady_clock_resource.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/glue/time/static.cpp b/src/core/hle/service/glue/time/static.cpp index dc7651fd1f..beccf6ce43 100644 --- a/src/core/hle/service/glue/time/static.cpp +++ b/src/core/hle/service/glue/time/static.cpp @@ -24,42 +24,42 @@ namespace Service::Glue::Time { -std::optional StaticService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&StaticService::GetStandardUserSystemClock>, "GetStandardUserSystemClock"}, - FunctionInfo{1, D<&StaticService::GetStandardNetworkSystemClock>, "GetStandardNetworkSystemClock"}, - FunctionInfo{2, D<&StaticService::GetStandardSteadyClock>, "GetStandardSteadyClock"}, - FunctionInfo{3, D<&StaticService::GetTimeZoneService>, "GetTimeZoneService"}, - FunctionInfo{4, D<&StaticService::GetStandardLocalSystemClock>, "GetStandardLocalSystemClock"}, - FunctionInfo{5, D<&StaticService::GetEphemeralNetworkSystemClock>, "GetEphemeralNetworkSystemClock"}, - FunctionInfo{20, D<&StaticService::GetSharedMemoryNativeHandle>, "GetSharedMemoryNativeHandle"}, - FunctionInfo{50, D<&StaticService::SetStandardSteadyClockInternalOffset>, "SetStandardSteadyClockInternalOffset"}, - FunctionInfo{51, D<&StaticService::GetStandardSteadyClockRtcValue>, "GetStandardSteadyClockRtcValue"}, - FunctionInfo{100, D<&StaticService::IsStandardUserSystemClockAutomaticCorrectionEnabled>, "IsStandardUserSystemClockAutomaticCorrectionEnabled"}, - FunctionInfo{101, D<&StaticService::SetStandardUserSystemClockAutomaticCorrectionEnabled>, "SetStandardUserSystemClockAutomaticCorrectionEnabled"}, - FunctionInfo{102, D<&StaticService::GetStandardUserSystemClockInitialYear>, "GetStandardUserSystemClockInitialYear"}, - FunctionInfo{200, D<&StaticService::IsStandardNetworkSystemClockAccuracySufficient>, "IsStandardNetworkSystemClockAccuracySufficient"}, - FunctionInfo{201, D<&StaticService::GetStandardUserSystemClockAutomaticCorrectionUpdatedTime>, "GetStandardUserSystemClockAutomaticCorrectionUpdatedTime"}, - FunctionInfo{300, D<&StaticService::CalculateMonotonicSystemClockBaseTimePoint>, "CalculateMonotonicSystemClockBaseTimePoint"}, - FunctionInfo{400, D<&StaticService::GetClockSnapshot>, "GetClockSnapshot"}, - FunctionInfo{401, D<&StaticService::GetClockSnapshotFromSystemClockContext>, "GetClockSnapshotFromSystemClockContext"}, - FunctionInfo{500, D<&StaticService::CalculateStandardUserSystemClockDifferenceByUser>, "CalculateStandardUserSystemClockDifferenceByUser"}, - FunctionInfo{501, D<&StaticService::CalculateSpanBetween>, "CalculateSpanBetween"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - StaticService::StaticService(Core::System& system_, Service::PSC::Time::StaticServiceSetupInfo setup_info, std::shared_ptr time, const char* name) - : ServiceFramework{system_, name}, m_time_m{time->m_time_m}, + : ServiceFramework{system_, name}, m_system{system_}, m_time_m{time->m_time_m}, m_setup_info{setup_info}, m_time_sm{time->m_time_sm}, m_file_timestamp_worker{time->m_file_timestamp_worker}, m_standard_steady_clock_resource{time->m_steady_clock_resource}, m_time_zone_binary{time->m_time_zone_binary} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&StaticService::GetStandardUserSystemClock>, "GetStandardUserSystemClock"}, + {1, D<&StaticService::GetStandardNetworkSystemClock>, "GetStandardNetworkSystemClock"}, + {2, D<&StaticService::GetStandardSteadyClock>, "GetStandardSteadyClock"}, + {3, D<&StaticService::GetTimeZoneService>, "GetTimeZoneService"}, + {4, D<&StaticService::GetStandardLocalSystemClock>, "GetStandardLocalSystemClock"}, + {5, D<&StaticService::GetEphemeralNetworkSystemClock>, "GetEphemeralNetworkSystemClock"}, + {20, D<&StaticService::GetSharedMemoryNativeHandle>, "GetSharedMemoryNativeHandle"}, + {50, D<&StaticService::SetStandardSteadyClockInternalOffset>, "SetStandardSteadyClockInternalOffset"}, + {51, D<&StaticService::GetStandardSteadyClockRtcValue>, "GetStandardSteadyClockRtcValue"}, + {100, D<&StaticService::IsStandardUserSystemClockAutomaticCorrectionEnabled>, "IsStandardUserSystemClockAutomaticCorrectionEnabled"}, + {101, D<&StaticService::SetStandardUserSystemClockAutomaticCorrectionEnabled>, "SetStandardUserSystemClockAutomaticCorrectionEnabled"}, + {102, D<&StaticService::GetStandardUserSystemClockInitialYear>, "GetStandardUserSystemClockInitialYear"}, + {200, D<&StaticService::IsStandardNetworkSystemClockAccuracySufficient>, "IsStandardNetworkSystemClockAccuracySufficient"}, + {201, D<&StaticService::GetStandardUserSystemClockAutomaticCorrectionUpdatedTime>, "GetStandardUserSystemClockAutomaticCorrectionUpdatedTime"}, + {300, D<&StaticService::CalculateMonotonicSystemClockBaseTimePoint>, "CalculateMonotonicSystemClockBaseTimePoint"}, + {400, D<&StaticService::GetClockSnapshot>, "GetClockSnapshot"}, + {401, D<&StaticService::GetClockSnapshotFromSystemClockContext>, "GetClockSnapshotFromSystemClockContext"}, + {500, D<&StaticService::CalculateStandardUserSystemClockDifferenceByUser>, "CalculateStandardUserSystemClockDifferenceByUser"}, + {501, D<&StaticService::CalculateSpanBetween>, "CalculateSpanBetween"}, + }; + // clang-format on + + RegisterHandlers(functions); m_set_sys = - system.ServiceManager().GetService("set:sys", true); + m_system.ServiceManager().GetService("set:sys", true); if (m_setup_info.can_write_local_clock && m_setup_info.can_write_user_clock && !m_setup_info.can_write_network_clock && m_setup_info.can_write_timezone_device_location && @@ -109,7 +109,7 @@ Result StaticService::GetTimeZoneService(OutInterface out_servi LOG_DEBUG(Service_Time, "called."); *out_service = std::make_shared( - system, m_file_timestamp_worker, m_setup_info.can_write_timezone_device_location, + m_system, m_file_timestamp_worker, m_setup_info.can_write_timezone_device_location, m_time_zone_binary, m_time_zone); R_SUCCEED(); } diff --git a/src/core/hle/service/glue/time/static.h b/src/core/hle/service/glue/time/static.h index 5856553461..a52b84bf31 100644 --- a/src/core/hle/service/glue/time/static.h +++ b/src/core/hle/service/glue/time/static.h @@ -72,11 +72,12 @@ public: Result CalculateSpanBetween(Out out_time, InClockSnapshot a, InClockSnapshot b); private: - std::optional FindRequest(u32 key) override; + Core::System& m_system; std::shared_ptr m_set_sys; std::shared_ptr m_time_m; std::shared_ptr m_wrapped_service; + Service::PSC::Time::StaticServiceSetupInfo m_setup_info; std::shared_ptr m_time_sm; std::shared_ptr m_time_zone; diff --git a/src/core/hle/service/glue/time/time_zone.cpp b/src/core/hle/service/glue/time/time_zone.cpp index 6e861b4060..52bd651f2b 100644 --- a/src/core/hle/service/glue/time/time_zone.cpp +++ b/src/core/hle/service/glue/time/time_zone.cpp @@ -19,26 +19,6 @@ namespace Service::Glue::Time { -std::optional TimeZoneService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&TimeZoneService::GetDeviceLocationName>, "GetDeviceLocationName"}, - FunctionInfo{1, D<&TimeZoneService::SetDeviceLocationName>, "SetDeviceLocationName"}, - FunctionInfo{2, D<&TimeZoneService::GetTotalLocationNameCount>, "GetTotalLocationNameCount"}, - FunctionInfo{3, D<&TimeZoneService::LoadLocationNameList>, "LoadLocationNameList"}, - FunctionInfo{4, D<&TimeZoneService::LoadTimeZoneRule>, "LoadTimeZoneRule"}, - FunctionInfo{5, D<&TimeZoneService::GetTimeZoneRuleVersion>, "GetTimeZoneRuleVersion"}, - FunctionInfo{6, D<&TimeZoneService::GetDeviceLocationNameAndUpdatedTime>, "GetDeviceLocationNameAndUpdatedTime"}, - FunctionInfo{7, D<&TimeZoneService::SetDeviceLocationNameWithTimeZoneRule>, "SetDeviceLocationNameWithTimeZoneRule"}, - FunctionInfo{8, D<&TimeZoneService::ParseTimeZoneBinary>, "ParseTimeZoneBinary"}, - FunctionInfo{20, D<&TimeZoneService::GetDeviceLocationNameOperationEventReadableHandle>, "GetDeviceLocationNameOperationEventReadableHandle"}, - FunctionInfo{100, D<&TimeZoneService::ToCalendarTime>, "ToCalendarTime"}, - FunctionInfo{101, D<&TimeZoneService::ToCalendarTimeWithMyRule>, "ToCalendarTimeWithMyRule"}, - FunctionInfo{201, D<&TimeZoneService::ToPosixTime>, "ToPosixTime"}, - FunctionInfo{202, D<&TimeZoneService::ToPosixTimeWithMyRule>, "ToPosixTimeWithMyRule"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - TimeZoneService::TimeZoneService( Core::System& system_, FileTimestampWorker& file_timestamp_worker, bool can_write_timezone_device_location, TimeZoneBinary& time_zone_binary, @@ -50,6 +30,26 @@ TimeZoneService::TimeZoneService( , m_operation_event{system} , m_time_zone_binary{time_zone_binary} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&TimeZoneService::GetDeviceLocationName>, "GetDeviceLocationName"}, + {1, D<&TimeZoneService::SetDeviceLocationName>, "SetDeviceLocationName"}, + {2, D<&TimeZoneService::GetTotalLocationNameCount>, "GetTotalLocationNameCount"}, + {3, D<&TimeZoneService::LoadLocationNameList>, "LoadLocationNameList"}, + {4, D<&TimeZoneService::LoadTimeZoneRule>, "LoadTimeZoneRule"}, + {5, D<&TimeZoneService::GetTimeZoneRuleVersion>, "GetTimeZoneRuleVersion"}, + {6, D<&TimeZoneService::GetDeviceLocationNameAndUpdatedTime>, "GetDeviceLocationNameAndUpdatedTime"}, + {7, D<&TimeZoneService::SetDeviceLocationNameWithTimeZoneRule>, "SetDeviceLocationNameWithTimeZoneRule"}, + {8, D<&TimeZoneService::ParseTimeZoneBinary>, "ParseTimeZoneBinary"}, + {20, D<&TimeZoneService::GetDeviceLocationNameOperationEventReadableHandle>, "GetDeviceLocationNameOperationEventReadableHandle"}, + {100, D<&TimeZoneService::ToCalendarTime>, "ToCalendarTime"}, + {101, D<&TimeZoneService::ToCalendarTimeWithMyRule>, "ToCalendarTimeWithMyRule"}, + {201, D<&TimeZoneService::ToPosixTime>, "ToPosixTime"}, + {202, D<&TimeZoneService::ToPosixTimeWithMyRule>, "ToPosixTimeWithMyRule"}, + }; + // clang-format on + RegisterHandlers(functions); + m_set_sys = system.ServiceManager().GetService("set:sys", true); } diff --git a/src/core/hle/service/glue/time/time_zone.h b/src/core/hle/service/glue/time/time_zone.h index 839d823e67..635070263b 100644 --- a/src/core/hle/service/glue/time/time_zone.h +++ b/src/core/hle/service/glue/time/time_zone.h @@ -80,7 +80,6 @@ public: const Service::PSC::Time::CalendarTime& calendar_time); private: - std::optional FindRequest(u32 key) override; std::shared_ptr m_set_sys; bool m_can_write_timezone_device_location; FileTimestampWorker& m_file_timestamp_worker; diff --git a/src/core/hle/service/glue/time/time_zone_binary.cpp b/src/core/hle/service/glue/time/time_zone_binary.cpp index 3cc1a62afd..eadad551e5 100644 --- a/src/core/hle/service/glue/time/time_zone_binary.cpp +++ b/src/core/hle/service/glue/time/time_zone_binary.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/glue/time/time_zone_binary.h b/src/core/hle/service/glue/time/time_zone_binary.h index 135da631f2..012b933573 100644 --- a/src/core/hle/service/glue/time/time_zone_binary.h +++ b/src/core/hle/service/glue/time/time_zone_binary.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/glue/time/worker.h b/src/core/hle/service/glue/time/worker.h index 69904e6748..f4be2ff367 100644 --- a/src/core/hle/service/glue/time/worker.h +++ b/src/core/hle/service/glue/time/worker.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/gpio/gpio.cpp b/src/core/hle/service/gpio/gpio.cpp index 5441149c65..8b4aa0f5ab 100644 --- a/src/core/hle/service/gpio/gpio.cpp +++ b/src/core/hle/service/gpio/gpio.cpp @@ -13,15 +13,15 @@ namespace Service::GPIO { class GPIO final : public ServiceFramework { public: - explicit GPIO(Core::System& system_) : ServiceFramework{system_, "gpio"} {} - ~GPIO() override = default; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit GPIO(Core::System& system_) + : ServiceFramework{system_, "gpio"} + { + static const FunctionInfo functions[] = { + {0, nullptr, "Cmd0"}, + }; + RegisterHandlers(functions); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "Cmd0"} - ); + ~GPIO() override = default; }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/grc/grc.cpp b/src/core/hle/service/grc/grc.cpp index 5f6c84e914..e8e901662d 100644 --- a/src/core/hle/service/grc/grc.cpp +++ b/src/core/hle/service/grc/grc.cpp @@ -14,31 +14,32 @@ namespace Service::GRC { class GRC final : public ServiceFramework { public: - explicit GRC(Core::System& system_) : ServiceFramework{system_, "grc:c"} {} + explicit GRC(Core::System& system_) : ServiceFramework{system_, "grc:c"} { + // clang-format off + static const FunctionInfo functions[] = { + {1, nullptr, "OpenContinuousRecorder"}, + {2, nullptr, "OpenGameMovieTrimmer"}, + {3, nullptr, "OpenOffscreenRecorder"}, + {101, nullptr, "CreateMovieMaker"}, + {9903, nullptr, "SetOffscreenRecordingMarker"} + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{1, nullptr, "OpenContinuousRecorder"}, - FunctionInfo{2, nullptr, "OpenGameMovieTrimmer"}, - FunctionInfo{3, nullptr, "OpenOffscreenRecorder"}, - FunctionInfo{101, nullptr, "CreateMovieMaker"}, - FunctionInfo{9903, nullptr, "SetOffscreenRecordingMarker"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; class GRC_D final : public ServiceFramework { public: - explicit GRC_D(Core::System& system_) : ServiceFramework{system_, "grc:d"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{1, nullptr, "Initialize"}, - FunctionInfo{2, nullptr, "Transfer"}, - FunctionInfo{3, nullptr, "Cmd3"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit GRC_D(Core::System& system_) : ServiceFramework{system_, "grc:d"} { + // clang-format off + static const FunctionInfo functions[] = { + {1, nullptr, "Initialize"}, + {2, nullptr, "Transfer"}, + {3, nullptr, "Cmd3"}, + }; + // clang-format on + RegisterHandlers(functions); } }; diff --git a/src/core/hle/service/grc/grc.h b/src/core/hle/service/grc/grc.h index a3f8a5b90e..4c2b45057d 100644 --- a/src/core/hle/service/grc/grc.h +++ b/src/core/hle/service/grc/grc.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/hid/active_vibration_device_list.cpp b/src/core/hle/service/hid/active_vibration_device_list.cpp index 7a4f4cce2c..e0d6d3f2d9 100644 --- a/src/core/hle/service/hid/active_vibration_device_list.cpp +++ b/src/core/hle/service/hid/active_vibration_device_list.cpp @@ -14,16 +14,16 @@ namespace Service::HID { -std::optional IActiveVibrationDeviceList::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&IActiveVibrationDeviceList::ActivateVibrationDevice>, "ActivateVibrationDevice"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IActiveVibrationDeviceList::IActiveVibrationDeviceList(Core::System& system_, std::shared_ptr resource) : ServiceFramework{system_, "IActiveVibrationDeviceList"}, resource_manager(resource) { + // clang-format off + static const FunctionInfo functions[] = { + {0, C<&IActiveVibrationDeviceList::ActivateVibrationDevice>, "ActivateVibrationDevice"}, + }; + // clang-format on + + RegisterHandlers(functions); } IActiveVibrationDeviceList::~IActiveVibrationDeviceList() = default; diff --git a/src/core/hle/service/hid/active_vibration_device_list.h b/src/core/hle/service/hid/active_vibration_device_list.h index 57c31a8df1..f155eaf839 100644 --- a/src/core/hle/service/hid/active_vibration_device_list.h +++ b/src/core/hle/service/hid/active_vibration_device_list.h @@ -29,8 +29,8 @@ public: private: static constexpr std::size_t MaxVibrationDevicesHandles{0x100}; + Result ActivateVibrationDevice(Core::HID::VibrationDeviceHandle vibration_device_handle); - std::optional FindRequest(u32 key) override; mutable std::mutex mutex; std::size_t list_size{}; diff --git a/src/core/hle/service/hid/applet_resource.cpp b/src/core/hle/service/hid/applet_resource.cpp index 6f658fa875..44ae767841 100644 --- a/src/core/hle/service/hid/applet_resource.cpp +++ b/src/core/hle/service/hid/applet_resource.cpp @@ -12,17 +12,14 @@ namespace Service::HID { -std::optional IAppletResource::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&IAppletResource::GetSharedMemoryHandle>, "GetSharedMemoryHandle"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IAppletResource::IAppletResource(Core::System& system_, std::shared_ptr resource, u64 applet_resource_user_id) : ServiceFramework{system_, "IAppletResource"}, aruid{applet_resource_user_id}, resource_manager{resource} { + static const FunctionInfo functions[] = { + {0, C<&IAppletResource::GetSharedMemoryHandle>, "GetSharedMemoryHandle"}, + }; + RegisterHandlers(functions); } IAppletResource::~IAppletResource() { diff --git a/src/core/hle/service/hid/applet_resource.h b/src/core/hle/service/hid/applet_resource.h index 7b5d915218..40c3852baa 100644 --- a/src/core/hle/service/hid/applet_resource.h +++ b/src/core/hle/service/hid/applet_resource.h @@ -32,7 +32,6 @@ public: private: Result GetSharedMemoryHandle(OutCopyHandle out_shared_memory_handle); - std::optional FindRequest(u32 key) override; u64 aruid{}; std::shared_ptr resource_manager; }; diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 0ea587312b..25096ff36f 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -16,24 +16,19 @@ #include "core/hle/service/server_manager.h" #include "hid_core/resource_manager.h" #include "hid_core/resources/hid_firmware_settings.h" -#include "core/hle/service/ipc_helpers.h" -#include "hid_core/hid_types.h" -#include "hid_core/resources/touch_screen/gesture.h" -#include "hid_core/resources/touch_screen/touch_screen.h" -#include "core/hle/service/cmif_serialization.h" namespace Service::HID { class IHidTemporaryServer final : public ServiceFramework { public: explicit IHidTemporaryServer(Core::System& system_) - : ServiceFramework{system_, "hid:tmp"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetConsoleSixAxisSensorCalibrationValues"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + : ServiceFramework{system_, "hid:tmp"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetConsoleSixAxisSensorCalibrationValues"}, + }; + // clang-format on + RegisterHandlers(functions); } ~IHidTemporaryServer() override = default; }; @@ -41,17 +36,17 @@ public: class AHID_CD final : public ServiceFramework { public: explicit AHID_CD(Core::System& system_) - : ServiceFramework{system_, "ahid:cd"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "AcquireDevice"}, - FunctionInfo{1, nullptr, "ReleaseDevice"}, - FunctionInfo{2, nullptr, "GetCtrlSession"}, - FunctionInfo{3, nullptr, "GetReadSession"}, - FunctionInfo{4, nullptr, "GetWriteSession"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + : ServiceFramework{system_, "ahid:cd"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "AcquireDevice"}, + {1, nullptr, "ReleaseDevice"}, + {2, nullptr, "GetCtrlSession"}, + {3, nullptr, "GetReadSession"}, + {4, nullptr, "GetWriteSession"}, + }; + // clang-format on + RegisterHandlers(functions); } ~AHID_CD() override = default; }; @@ -59,322 +54,22 @@ public: class AHID_HDR final : public ServiceFramework { public: explicit AHID_HDR(Core::System& system_) - : ServiceFramework{system_, "ahid:hdr"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetDeviceEntries"}, - FunctionInfo{1, nullptr, "GetDeviceList"}, - FunctionInfo{2, nullptr, "GetDeviceParameters"}, - FunctionInfo{3, nullptr, "AttachDevice"}, - FunctionInfo{4, nullptr, "DetachDevice"}, - FunctionInfo{5, nullptr, "SetDeviceFilter"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + : ServiceFramework{system_, "ahid:hdr"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetDeviceEntries"}, + {1, nullptr, "GetDeviceList"}, + {2, nullptr, "GetDeviceParameters"}, + {3, nullptr, "AttachDevice"}, + {4, nullptr, "DetachDevice"}, + {5, nullptr, "SetDeviceFilter"}, + }; + // clang-format on + RegisterHandlers(functions); } ~AHID_HDR() override = default; }; -class IHidDebugServer final : public ServiceFramework { -public: - explicit IHidDebugServer(Core::System& system_, std::shared_ptr resource, - std::shared_ptr settings) - : ServiceFramework{system_, "hid:dbg"} - , resource_manager{resource} - , firmware_settings{settings} - {} - - ~IHidDebugServer() override = default; - - Result DeactivateTouchScreen() { - LOG_INFO(Service_HID, "called"); - - if (!firmware_settings->IsDeviceManaged()) { - R_RETURN(GetResourceManager()->GetTouchScreen()->Deactivate()); - } - - R_SUCCEED(); - } - - Result SetTouchScreenAutoPilotState( - InArray auto_pilot_buffer) { - AutoPilotState auto_pilot{}; - - auto_pilot.count = - static_cast((std::min)(auto_pilot_buffer.size(), auto_pilot.state.size())); - memcpy(auto_pilot.state.data(), auto_pilot_buffer.data(), - auto_pilot.count * sizeof(TouchState)); - - LOG_INFO(Service_HID, "called, auto_pilot_count={}", auto_pilot.count); - - R_RETURN(GetResourceManager()->GetTouchScreen()->SetTouchScreenAutoPilotState(auto_pilot)); - } - - Result UnsetTouchScreenAutoPilotState() { - LOG_INFO(Service_HID, "called"); - R_RETURN(GetResourceManager()->GetTouchScreen()->UnsetTouchScreenAutoPilotState()); - } - - Result GetTouchScreenConfiguration( - Out out_touchscreen_config, - ClientAppletResourceUserId aruid) { - LOG_INFO(Service_HID, "called, applet_resource_user_id={}", aruid.pid); - - R_TRY(GetResourceManager()->GetTouchScreen()->GetTouchScreenConfiguration( - *out_touchscreen_config, aruid.pid)); - - if (out_touchscreen_config->mode != Core::HID::TouchScreenModeForNx::Heat2 && - out_touchscreen_config->mode != Core::HID::TouchScreenModeForNx::Finger) { - out_touchscreen_config->mode = Core::HID::TouchScreenModeForNx::UseSystemSetting; - } - - R_SUCCEED(); - } - - Result ProcessTouchScreenAutoTune() { - LOG_INFO(Service_HID, "called"); - R_RETURN(GetResourceManager()->GetTouchScreen()->ProcessTouchScreenAutoTune()); - } - - Result ForceStopTouchScreenManagement() { - LOG_INFO(Service_HID, "called"); - - if (!firmware_settings->IsDeviceManaged()) { - R_SUCCEED(); - } - - auto touch_screen = GetResourceManager()->GetTouchScreen(); - auto gesture = GetResourceManager()->GetGesture(); - - if (firmware_settings->IsTouchI2cManaged()) { - bool is_touch_active{}; - bool is_gesture_active{}; - R_TRY(touch_screen->IsActive(is_touch_active)); - R_TRY(gesture->IsActive(is_gesture_active)); - - if (is_touch_active) { - R_TRY(touch_screen->Deactivate()); - } - if (is_gesture_active) { - R_TRY(gesture->Deactivate()); - } - } - - R_SUCCEED(); - } - - Result ForceRestartTouchScreenManagement(u32 basic_gesture_id, - ClientAppletResourceUserId aruid) { - LOG_INFO(Service_HID, "called, basic_gesture_id={}, applet_resource_user_id={}", - basic_gesture_id, aruid.pid); - - auto touch_screen = GetResourceManager()->GetTouchScreen(); - auto gesture = GetResourceManager()->GetGesture(); - - if (firmware_settings->IsDeviceManaged() && firmware_settings->IsTouchI2cManaged()) { - R_TRY(gesture->Activate()); - R_TRY(gesture->Activate(aruid.pid, basic_gesture_id)); - R_TRY(touch_screen->Activate()); - R_TRY(touch_screen->Activate(aruid.pid)); - } - - R_SUCCEED(); - } - - Result IsTouchScreenManaged(Out out_is_managed) { - LOG_INFO(Service_HID, "called"); - - bool is_touch_active{}; - bool is_gesture_active{}; - R_TRY(GetResourceManager()->GetTouchScreen()->IsActive(is_touch_active)); - R_TRY(GetResourceManager()->GetGesture()->IsActive(is_gesture_active)); - - *out_is_managed = is_touch_active || is_gesture_active; - R_SUCCEED(); - } - - Result DeactivateGesture() { - LOG_INFO(Service_HID, "called"); - - if (!firmware_settings->IsDeviceManaged()) { - R_RETURN(GetResourceManager()->GetGesture()->Deactivate()); - } - - R_SUCCEED(); - } - - std::shared_ptr GetResourceManager() { - resource_manager->Initialize(); - return resource_manager; - } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "DeactivateDebugPad"}, - FunctionInfo{1, nullptr, "SetDebugPadAutoPilotState"}, - FunctionInfo{2, nullptr, "UnsetDebugPadAutoPilotState"}, - FunctionInfo{10, C<&IHidDebugServer::DeactivateTouchScreen>, "DeactivateTouchScreen"}, - FunctionInfo{11, C<&IHidDebugServer::SetTouchScreenAutoPilotState>, "SetTouchScreenAutoPilotState"}, - FunctionInfo{12, C<&IHidDebugServer::UnsetTouchScreenAutoPilotState>, "UnsetTouchScreenAutoPilotState"}, - FunctionInfo{13, C<&IHidDebugServer::GetTouchScreenConfiguration>, "GetTouchScreenConfiguration"}, - FunctionInfo{14, C<&IHidDebugServer::ProcessTouchScreenAutoTune>, "ProcessTouchScreenAutoTune"}, - FunctionInfo{15, C<&IHidDebugServer::ForceStopTouchScreenManagement>, "ForceStopTouchScreenManagement"}, - FunctionInfo{16, C<&IHidDebugServer::ForceRestartTouchScreenManagement>, "ForceRestartTouchScreenManagement"}, - FunctionInfo{17, C<&IHidDebugServer::IsTouchScreenManaged>, "IsTouchScreenManaged"}, - FunctionInfo{20, nullptr, "DeactivateMouse"}, - FunctionInfo{21, nullptr, "SetMouseAutoPilotState"}, - FunctionInfo{22, nullptr, "UnsetMouseAutoPilotState"}, - FunctionInfo{23, nullptr, "AddMouseSideWheelDelta"}, - FunctionInfo{25, nullptr, "SetDebugMouseAutoPilotState"}, - FunctionInfo{26, nullptr, "UnsetDebugMouseAutoPilotState"}, - FunctionInfo{30, nullptr, "DeactivateKeyboard"}, - FunctionInfo{31, nullptr, "SetKeyboardAutoPilotState"}, - FunctionInfo{32, nullptr, "UnsetKeyboardAutoPilotState"}, - FunctionInfo{50, nullptr, "DeactivateXpad"}, - FunctionInfo{51, nullptr, "SetXpadAutoPilotState"}, - FunctionInfo{52, nullptr, "UnsetXpadAutoPilotState"}, - FunctionInfo{53, nullptr, "DeactivateJoyXpad"}, - FunctionInfo{60, nullptr, "ClearNpadSystemCommonPolicy"}, - FunctionInfo{61, nullptr, "DeactivateNpad"}, - FunctionInfo{62, nullptr, "ForceDisconnectNpad"}, - FunctionInfo{91, C<&IHidDebugServer::DeactivateGesture>, "DeactivateGesture"}, - FunctionInfo{110, nullptr, "DeactivateHomeButton"}, - FunctionInfo{111, nullptr, "SetHomeButtonAutoPilotState"}, - FunctionInfo{112, nullptr, "UnsetHomeButtonAutoPilotState"}, - FunctionInfo{120, nullptr, "DeactivateSleepButton"}, - FunctionInfo{121, nullptr, "SetSleepButtonAutoPilotState"}, - FunctionInfo{122, nullptr, "UnsetSleepButtonAutoPilotState"}, - FunctionInfo{123, nullptr, "DeactivateInputDetector"}, - FunctionInfo{130, nullptr, "DeactivateCaptureButton"}, - FunctionInfo{131, nullptr, "SetCaptureButtonAutoPilotState"}, - FunctionInfo{132, nullptr, "UnsetCaptureButtonAutoPilotState"}, - FunctionInfo{133, nullptr, "SetShiftAccelerometerCalibrationValue"}, - FunctionInfo{134, nullptr, "GetShiftAccelerometerCalibrationValue"}, - FunctionInfo{135, nullptr, "SetShiftGyroscopeCalibrationValue"}, - FunctionInfo{136, nullptr, "GetShiftGyroscopeCalibrationValue"}, - FunctionInfo{140, nullptr, "DeactivateConsoleSixAxisSensor"}, - FunctionInfo{141, nullptr, "GetConsoleSixAxisSensorSamplingFrequency"}, - FunctionInfo{142, nullptr, "DeactivateSevenSixAxisSensor"}, - FunctionInfo{143, nullptr, "GetConsoleSixAxisSensorCountStates"}, - FunctionInfo{144, nullptr, "GetAccelerometerFsr"}, - FunctionInfo{145, nullptr, "SetAccelerometerFsr"}, - FunctionInfo{146, nullptr, "GetAccelerometerOdr"}, - FunctionInfo{147, nullptr, "SetAccelerometerOdr"}, - FunctionInfo{148, nullptr, "GetGyroscopeFsr"}, - FunctionInfo{149, nullptr, "SetGyroscopeFsr"}, - FunctionInfo{150, nullptr, "GetGyroscopeOdr"}, - FunctionInfo{151, nullptr, "SetGyroscopeOdr"}, - FunctionInfo{152, nullptr, "GetWhoAmI"}, - FunctionInfo{201, nullptr, "ActivateFirmwareUpdate"}, - FunctionInfo{202, nullptr, "DeactivateFirmwareUpdate"}, - FunctionInfo{203, nullptr, "StartFirmwareUpdate"}, - FunctionInfo{204, nullptr, "GetFirmwareUpdateStage"}, - FunctionInfo{205, nullptr, "GetFirmwareVersion"}, - FunctionInfo{206, nullptr, "GetDestinationFirmwareVersion"}, - FunctionInfo{207, nullptr, "DiscardFirmwareInfoCacheForRevert"}, - FunctionInfo{208, nullptr, "StartFirmwareUpdateForRevert"}, - FunctionInfo{209, nullptr, "GetAvailableFirmwareVersionForRevert"}, - FunctionInfo{210, nullptr, "IsFirmwareUpdatingDevice"}, - FunctionInfo{211, nullptr, "StartFirmwareUpdateIndividual"}, - FunctionInfo{212, nullptr, "GetDetailFirmwareVersion", MakeVersionGate({19,0,0})}, - FunctionInfo{215, nullptr, "SetUsbFirmwareForceUpdateEnabled"}, - FunctionInfo{216, nullptr, "SetAllKuinaDevicesToFirmwareUpdateMode"}, - FunctionInfo{221, nullptr, "UpdateControllerColor"}, - FunctionInfo{222, nullptr, "ConnectUsbPadsAsync"}, - FunctionInfo{223, nullptr, "DisconnectUsbPadsAsync"}, - FunctionInfo{224, nullptr, "UpdateDesignInfo"}, - FunctionInfo{225, nullptr, "GetUniquePadDriverState"}, - FunctionInfo{226, nullptr, "GetSixAxisSensorDriverStates"}, - FunctionInfo{227, nullptr, "GetRxPacketHistory"}, - FunctionInfo{228, nullptr, "AcquireOperationEventHandle"}, - FunctionInfo{229, nullptr, "ReadSerialFlash"}, - FunctionInfo{230, nullptr, "WriteSerialFlash"}, - FunctionInfo{231, nullptr, "GetOperationResult"}, - FunctionInfo{232, nullptr, "EnableShipmentMode"}, - FunctionInfo{233, nullptr, "ClearPairingInfo"}, - FunctionInfo{234, nullptr, "GetUniquePadDeviceTypeSetInternal"}, - FunctionInfo{235, nullptr, "EnableAnalogStickPower"}, - FunctionInfo{236, nullptr, "RequestKuinaUartClockCal"}, - FunctionInfo{237, nullptr, "GetKuinaUartClockCal"}, - FunctionInfo{238, nullptr, "SetKuinaUartClockTrim"}, - FunctionInfo{239, nullptr, "KuinaLoopbackTest"}, - FunctionInfo{240, nullptr, "RequestBatteryVoltage"}, - FunctionInfo{241, nullptr, "GetBatteryVoltage"}, - FunctionInfo{242, nullptr, "GetUniquePadPowerInfo"}, - FunctionInfo{243, nullptr, "RebootUniquePad"}, - FunctionInfo{244, nullptr, "RequestKuinaFirmwareVersion"}, - FunctionInfo{245, nullptr, "GetKuinaFirmwareVersion"}, - FunctionInfo{246, nullptr, "GetVidPid"}, - FunctionInfo{247, nullptr, "GetAnalogStickCalibrationValue"}, - FunctionInfo{248, nullptr, "GetUniquePadIdsFull"}, - FunctionInfo{249, nullptr, "ConnectUniquePad"}, - FunctionInfo{250, nullptr, "IsVirtual"}, - FunctionInfo{251, nullptr, "GetAnalogStickModuleParam"}, - FunctionInfo{253, nullptr, "ClearStorageForShipment", MakeVersionGate({19,0,0})}, - FunctionInfo{261, nullptr, "UpdateDesignInfo12", MakeVersionGate({21,0,0})}, - FunctionInfo{262, nullptr, "GetUniquePadButtonCount", MakeVersionGate({21,0,0})}, - FunctionInfo{267, nullptr, "SetAnalogStickCalibration", MakeVersionGate({21,0,0})}, - FunctionInfo{268, nullptr, "ResetAnalogStickCalibration", MakeVersionGate({21,0,0})}, - FunctionInfo{301, nullptr, "GetAbstractedPadHandles"}, - FunctionInfo{302, nullptr, "GetAbstractedPadState"}, - FunctionInfo{303, nullptr, "GetAbstractedPadsState"}, - FunctionInfo{321, nullptr, "SetAutoPilotVirtualPadState"}, - FunctionInfo{322, nullptr, "UnsetAutoPilotVirtualPadState"}, - FunctionInfo{323, nullptr, "UnsetAllAutoPilotVirtualPadState"}, - FunctionInfo{324, nullptr, "AttachHdlsWorkBuffer"}, - FunctionInfo{325, nullptr, "ReleaseHdlsWorkBuffer"}, - FunctionInfo{326, nullptr, "DumpHdlsNpadAssignmentState"}, - FunctionInfo{327, nullptr, "DumpHdlsStates"}, - FunctionInfo{328, nullptr, "ApplyHdlsNpadAssignmentState"}, - FunctionInfo{329, nullptr, "ApplyHdlsStateList"}, - FunctionInfo{330, nullptr, "AttachHdlsVirtualDevice"}, - FunctionInfo{331, nullptr, "DetachHdlsVirtualDevice"}, - FunctionInfo{332, nullptr, "SetHdlsState"}, - FunctionInfo{350, nullptr, "AddRegisteredDevice"}, - FunctionInfo{351, nullptr, "GetRegisteredDevicesCountDebug", MakeVersionGate({17,0,0}, {18,1,0})}, - FunctionInfo{352, nullptr, "DeleteRegisteredDevicesDebug", MakeVersionGate({17,0,0}, {18,1,0})}, - FunctionInfo{400, nullptr, "DisableExternalMcuOnNxDevice"}, - FunctionInfo{401, nullptr, "DisableRailDeviceFiltering"}, - FunctionInfo{402, nullptr, "EnableWiredPairing"}, - FunctionInfo{403, nullptr, "EnableShipmentModeAutoClear"}, - FunctionInfo{404, nullptr, "SetRailEnabled"}, - FunctionInfo{500, nullptr, "SetFactoryInt"}, - FunctionInfo{501, nullptr, "IsFactoryBootEnabled"}, - FunctionInfo{550, nullptr, "SetAnalogStickModelDataTemporarily"}, - FunctionInfo{551, nullptr, "GetAnalogStickModelData"}, - FunctionInfo{552, nullptr, "ResetAnalogStickModelData"}, - FunctionInfo{600, nullptr, "ConvertPadState"}, - FunctionInfo{601, nullptr, "IsButtonConfigSupported", MakeVersionGate({18,0,0})}, - FunctionInfo{602, nullptr, "IsButtonConfigEmbeddedSupported", MakeVersionGate({18,0,0})}, - FunctionInfo{603, nullptr, "DeleteButtonConfig", MakeVersionGate({18,0,0})}, - FunctionInfo{604, nullptr, "DeleteButtonConfigEmbedded", MakeVersionGate({18,0,0})}, - FunctionInfo{605, nullptr, "SetButtonConfigEnabled", MakeVersionGate({18,0,0})}, - FunctionInfo{606, nullptr, "SetButtonConfigEmbeddedEnabled", MakeVersionGate({18,0,0})}, - FunctionInfo{607, nullptr, "IsButtonConfigEnabled", MakeVersionGate({18,0,0})}, - FunctionInfo{608, nullptr, "IsButtonConfigEmbeddedEnabled", MakeVersionGate({18,0,0})}, - FunctionInfo{609, nullptr, "SetButtonConfigEmbedded", MakeVersionGate({18,0,0})}, - FunctionInfo{610, nullptr, "SetButtonConfigFull", MakeVersionGate({18,0,0})}, - FunctionInfo{611, nullptr, "SetButtonConfigLeft", MakeVersionGate({18,0,0})}, - FunctionInfo{612, nullptr, "SetButtonConfigRight", MakeVersionGate({18,0,0})}, - FunctionInfo{613, nullptr, "GetButtonConfigEmbedded", MakeVersionGate({18,0,0})}, - FunctionInfo{614, nullptr, "GetButtonConfigFull", MakeVersionGate({18,0,0})}, - FunctionInfo{615, nullptr, "GetButtonConfigLeft", MakeVersionGate({18,0,0})}, - FunctionInfo{616, nullptr, "GetButtonConfigRight", MakeVersionGate({18,0,0})}, - FunctionInfo{650, nullptr, "AddButtonPlayData"}, - FunctionInfo{651, nullptr, "StartButtonPlayData"}, - FunctionInfo{652, nullptr, "StopButtonPlayData"}, - FunctionInfo{700, nullptr, "GetRailAttachEventCount", MakeVersionGate({21,0,0})}, - FunctionInfo{2000, nullptr, "DeactivateDigitizer"}, - FunctionInfo{2001, nullptr, "SetDigitizerAutoPilotState"}, - FunctionInfo{2002, nullptr, "UnsetDigitizerAutoPilotState"}, - FunctionInfo{3000, nullptr, "ReloadFirmwareDebugSettings"} - ); - std::shared_ptr resource_manager; - std::shared_ptr firmware_settings; -}; - void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); auto firmware_settings = std::make_shared(system); diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index ec5463f4e2..bf8cd44481 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/hid/hid_debug_server.cpp b/src/core/hle/service/hid/hid_debug_server.cpp index 091d09dae5..42428a9ff9 100644 --- a/src/core/hle/service/hid/hid_debug_server.cpp +++ b/src/core/hle/service/hid/hid_debug_server.cpp @@ -18,4 +18,298 @@ namespace Service::HID { +IHidDebugServer::IHidDebugServer(Core::System& system_, std::shared_ptr resource, + std::shared_ptr settings) + : ServiceFramework{system_, "hid:dbg"}, resource_manager{resource}, firmware_settings{ + settings} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "DeactivateDebugPad"}, + {1, nullptr, "SetDebugPadAutoPilotState"}, + {2, nullptr, "UnsetDebugPadAutoPilotState"}, + {10, C<&IHidDebugServer::DeactivateTouchScreen>, "DeactivateTouchScreen"}, + {11, C<&IHidDebugServer::SetTouchScreenAutoPilotState>, "SetTouchScreenAutoPilotState"}, + {12, C<&IHidDebugServer::UnsetTouchScreenAutoPilotState>, "UnsetTouchScreenAutoPilotState"}, + {13, C<&IHidDebugServer::GetTouchScreenConfiguration>, "GetTouchScreenConfiguration"}, + {14, C<&IHidDebugServer::ProcessTouchScreenAutoTune>, "ProcessTouchScreenAutoTune"}, + {15, C<&IHidDebugServer::ForceStopTouchScreenManagement>, "ForceStopTouchScreenManagement"}, + {16, C<&IHidDebugServer::ForceRestartTouchScreenManagement>, "ForceRestartTouchScreenManagement"}, + {17, C<&IHidDebugServer::IsTouchScreenManaged>, "IsTouchScreenManaged"}, + {20, nullptr, "DeactivateMouse"}, + {21, nullptr, "SetMouseAutoPilotState"}, + {22, nullptr, "UnsetMouseAutoPilotState"}, + {23, nullptr, "AddMouseSideWheelDelta"}, + {25, nullptr, "SetDebugMouseAutoPilotState"}, + {26, nullptr, "UnsetDebugMouseAutoPilotState"}, + {30, nullptr, "DeactivateKeyboard"}, + {31, nullptr, "SetKeyboardAutoPilotState"}, + {32, nullptr, "UnsetKeyboardAutoPilotState"}, + {50, nullptr, "DeactivateXpad"}, + {51, nullptr, "SetXpadAutoPilotState"}, + {52, nullptr, "UnsetXpadAutoPilotState"}, + {53, nullptr, "DeactivateJoyXpad"}, + {60, nullptr, "ClearNpadSystemCommonPolicy"}, + {61, nullptr, "DeactivateNpad"}, + {62, nullptr, "ForceDisconnectNpad"}, + {91, C<&IHidDebugServer::DeactivateGesture>, "DeactivateGesture"}, + {110, nullptr, "DeactivateHomeButton"}, + {111, nullptr, "SetHomeButtonAutoPilotState"}, + {112, nullptr, "UnsetHomeButtonAutoPilotState"}, + {120, nullptr, "DeactivateSleepButton"}, + {121, nullptr, "SetSleepButtonAutoPilotState"}, + {122, nullptr, "UnsetSleepButtonAutoPilotState"}, + {123, nullptr, "DeactivateInputDetector"}, + {130, nullptr, "DeactivateCaptureButton"}, + {131, nullptr, "SetCaptureButtonAutoPilotState"}, + {132, nullptr, "UnsetCaptureButtonAutoPilotState"}, + {133, nullptr, "SetShiftAccelerometerCalibrationValue"}, + {134, nullptr, "GetShiftAccelerometerCalibrationValue"}, + {135, nullptr, "SetShiftGyroscopeCalibrationValue"}, + {136, nullptr, "GetShiftGyroscopeCalibrationValue"}, + {140, nullptr, "DeactivateConsoleSixAxisSensor"}, + {141, nullptr, "GetConsoleSixAxisSensorSamplingFrequency"}, + {142, nullptr, "DeactivateSevenSixAxisSensor"}, + {143, nullptr, "GetConsoleSixAxisSensorCountStates"}, + {144, nullptr, "GetAccelerometerFsr"}, + {145, nullptr, "SetAccelerometerFsr"}, + {146, nullptr, "GetAccelerometerOdr"}, + {147, nullptr, "SetAccelerometerOdr"}, + {148, nullptr, "GetGyroscopeFsr"}, + {149, nullptr, "SetGyroscopeFsr"}, + {150, nullptr, "GetGyroscopeOdr"}, + {151, nullptr, "SetGyroscopeOdr"}, + {152, nullptr, "GetWhoAmI"}, + {201, nullptr, "ActivateFirmwareUpdate"}, + {202, nullptr, "DeactivateFirmwareUpdate"}, + {203, nullptr, "StartFirmwareUpdate"}, + {204, nullptr, "GetFirmwareUpdateStage"}, + {205, nullptr, "GetFirmwareVersion"}, + {206, nullptr, "GetDestinationFirmwareVersion"}, + {207, nullptr, "DiscardFirmwareInfoCacheForRevert"}, + {208, nullptr, "StartFirmwareUpdateForRevert"}, + {209, nullptr, "GetAvailableFirmwareVersionForRevert"}, + {210, nullptr, "IsFirmwareUpdatingDevice"}, + {211, nullptr, "StartFirmwareUpdateIndividual"}, + {212, nullptr, "GetDetailFirmwareVersion"}, // 19.0.0+ + {215, nullptr, "SetUsbFirmwareForceUpdateEnabled"}, + {216, nullptr, "SetAllKuinaDevicesToFirmwareUpdateMode"}, + {221, nullptr, "UpdateControllerColor"}, + {222, nullptr, "ConnectUsbPadsAsync"}, + {223, nullptr, "DisconnectUsbPadsAsync"}, + {224, nullptr, "UpdateDesignInfo"}, + {225, nullptr, "GetUniquePadDriverState"}, + {226, nullptr, "GetSixAxisSensorDriverStates"}, + {227, nullptr, "GetRxPacketHistory"}, + {228, nullptr, "AcquireOperationEventHandle"}, + {229, nullptr, "ReadSerialFlash"}, + {230, nullptr, "WriteSerialFlash"}, + {231, nullptr, "GetOperationResult"}, + {232, nullptr, "EnableShipmentMode"}, + {233, nullptr, "ClearPairingInfo"}, + {234, nullptr, "GetUniquePadDeviceTypeSetInternal"}, + {235, nullptr, "EnableAnalogStickPower"}, + {236, nullptr, "RequestKuinaUartClockCal"}, + {237, nullptr, "GetKuinaUartClockCal"}, + {238, nullptr, "SetKuinaUartClockTrim"}, + {239, nullptr, "KuinaLoopbackTest"}, + {240, nullptr, "RequestBatteryVoltage"}, + {241, nullptr, "GetBatteryVoltage"}, + {242, nullptr, "GetUniquePadPowerInfo"}, + {243, nullptr, "RebootUniquePad"}, + {244, nullptr, "RequestKuinaFirmwareVersion"}, + {245, nullptr, "GetKuinaFirmwareVersion"}, + {246, nullptr, "GetVidPid"}, + {247, nullptr, "GetAnalogStickCalibrationValue"}, + {248, nullptr, "GetUniquePadIdsFull"}, + {249, nullptr, "ConnectUniquePad"}, + {250, nullptr, "IsVirtual"}, + {251, nullptr, "GetAnalogStickModuleParam"}, + {253, nullptr, "ClearStorageForShipment"}, //19.0.0+ + {261, nullptr, "UpdateDesignInfo12"}, //21.0.0+ + {262, nullptr, "GetUniquePadButtonCount"}, //21.0.0+ + {267, nullptr, "SetAnalogStickCalibration"}, //21.0.0+ + {268, nullptr, "ResetAnalogStickCalibration"}, //21.0.0+ + {301, nullptr, "GetAbstractedPadHandles"}, + {302, nullptr, "GetAbstractedPadState"}, + {303, nullptr, "GetAbstractedPadsState"}, + {321, nullptr, "SetAutoPilotVirtualPadState"}, + {322, nullptr, "UnsetAutoPilotVirtualPadState"}, + {323, nullptr, "UnsetAllAutoPilotVirtualPadState"}, + {324, nullptr, "AttachHdlsWorkBuffer"}, + {325, nullptr, "ReleaseHdlsWorkBuffer"}, + {326, nullptr, "DumpHdlsNpadAssignmentState"}, + {327, nullptr, "DumpHdlsStates"}, + {328, nullptr, "ApplyHdlsNpadAssignmentState"}, + {329, nullptr, "ApplyHdlsStateList"}, + {330, nullptr, "AttachHdlsVirtualDevice"}, + {331, nullptr, "DetachHdlsVirtualDevice"}, + {332, nullptr, "SetHdlsState"}, + {350, nullptr, "AddRegisteredDevice"}, + {351, nullptr, "GetRegisteredDevicesCountDebug"}, //17.0.0-18.1.0 + {352, nullptr, "DeleteRegisteredDevicesDebug"}, //17.0.0-18.1.0 + {400, nullptr, "DisableExternalMcuOnNxDevice"}, + {401, nullptr, "DisableRailDeviceFiltering"}, + {402, nullptr, "EnableWiredPairing"}, + {403, nullptr, "EnableShipmentModeAutoClear"}, + {404, nullptr, "SetRailEnabled"}, + {500, nullptr, "SetFactoryInt"}, + {501, nullptr, "IsFactoryBootEnabled"}, + {550, nullptr, "SetAnalogStickModelDataTemporarily"}, + {551, nullptr, "GetAnalogStickModelData"}, + {552, nullptr, "ResetAnalogStickModelData"}, + {600, nullptr, "ConvertPadState"}, + {601, nullptr, "IsButtonConfigSupported"}, //18.0.0+ + {602, nullptr, "IsButtonConfigEmbeddedSupported"}, //18.0.0+ + {603, nullptr, "DeleteButtonConfig"}, //18.0.0+ + {604, nullptr, "DeleteButtonConfigEmbedded"}, //18.0.0+ + {605, nullptr, "SetButtonConfigEnabled"}, //18.0.0+ + {606, nullptr, "SetButtonConfigEmbeddedEnabled"}, //18.0.0+ + {607, nullptr, "IsButtonConfigEnabled"}, //18.0.0+ + {608, nullptr, "IsButtonConfigEmbeddedEnabled"}, //18.0.0+ + {609, nullptr, "SetButtonConfigEmbedded"}, //18.0.0+ + {610, nullptr, "SetButtonConfigFull"}, //18.0.0+ + {611, nullptr, "SetButtonConfigLeft"}, //18.0.0+ + {612, nullptr, "SetButtonConfigRight"}, //18.0.0+ + {613, nullptr, "GetButtonConfigEmbedded"}, //18.0.0+ + {614, nullptr, "GetButtonConfigFull"}, //18.0.0+ + {615, nullptr, "GetButtonConfigLeft"}, //18.0.0+ + {616, nullptr, "GetButtonConfigRight"}, //18.0.0+ + {650, nullptr, "AddButtonPlayData"}, + {651, nullptr, "StartButtonPlayData"}, + {652, nullptr, "StopButtonPlayData"}, + {700, nullptr, "GetRailAttachEventCount"}, //21.0.0+ + {2000, nullptr, "DeactivateDigitizer"}, + {2001, nullptr, "SetDigitizerAutoPilotState"}, + {2002, nullptr, "UnsetDigitizerAutoPilotState"}, + {3000, nullptr, "ReloadFirmwareDebugSettings"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +IHidDebugServer::~IHidDebugServer() = default; + +Result IHidDebugServer::DeactivateTouchScreen() { + LOG_INFO(Service_HID, "called"); + + if (!firmware_settings->IsDeviceManaged()) { + R_RETURN(GetResourceManager()->GetTouchScreen()->Deactivate()); + } + + R_SUCCEED(); +} + +Result IHidDebugServer::SetTouchScreenAutoPilotState( + InArray auto_pilot_buffer) { + AutoPilotState auto_pilot{}; + + auto_pilot.count = + static_cast((std::min)(auto_pilot_buffer.size(), auto_pilot.state.size())); + memcpy(auto_pilot.state.data(), auto_pilot_buffer.data(), + auto_pilot.count * sizeof(TouchState)); + + LOG_INFO(Service_HID, "called, auto_pilot_count={}", auto_pilot.count); + + R_RETURN(GetResourceManager()->GetTouchScreen()->SetTouchScreenAutoPilotState(auto_pilot)); +} + +Result IHidDebugServer::UnsetTouchScreenAutoPilotState() { + LOG_INFO(Service_HID, "called"); + R_RETURN(GetResourceManager()->GetTouchScreen()->UnsetTouchScreenAutoPilotState()); +} + +Result IHidDebugServer::GetTouchScreenConfiguration( + Out out_touchscreen_config, + ClientAppletResourceUserId aruid) { + LOG_INFO(Service_HID, "called, applet_resource_user_id={}", aruid.pid); + + R_TRY(GetResourceManager()->GetTouchScreen()->GetTouchScreenConfiguration( + *out_touchscreen_config, aruid.pid)); + + if (out_touchscreen_config->mode != Core::HID::TouchScreenModeForNx::Heat2 && + out_touchscreen_config->mode != Core::HID::TouchScreenModeForNx::Finger) { + out_touchscreen_config->mode = Core::HID::TouchScreenModeForNx::UseSystemSetting; + } + + R_SUCCEED(); +} + +Result IHidDebugServer::ProcessTouchScreenAutoTune() { + LOG_INFO(Service_HID, "called"); + R_RETURN(GetResourceManager()->GetTouchScreen()->ProcessTouchScreenAutoTune()); +} + +Result IHidDebugServer::ForceStopTouchScreenManagement() { + LOG_INFO(Service_HID, "called"); + + if (!firmware_settings->IsDeviceManaged()) { + R_SUCCEED(); + } + + auto touch_screen = GetResourceManager()->GetTouchScreen(); + auto gesture = GetResourceManager()->GetGesture(); + + if (firmware_settings->IsTouchI2cManaged()) { + bool is_touch_active{}; + bool is_gesture_active{}; + R_TRY(touch_screen->IsActive(is_touch_active)); + R_TRY(gesture->IsActive(is_gesture_active)); + + if (is_touch_active) { + R_TRY(touch_screen->Deactivate()); + } + if (is_gesture_active) { + R_TRY(gesture->Deactivate()); + } + } + + R_SUCCEED(); +} + +Result IHidDebugServer::ForceRestartTouchScreenManagement(u32 basic_gesture_id, + ClientAppletResourceUserId aruid) { + LOG_INFO(Service_HID, "called, basic_gesture_id={}, applet_resource_user_id={}", + basic_gesture_id, aruid.pid); + + auto touch_screen = GetResourceManager()->GetTouchScreen(); + auto gesture = GetResourceManager()->GetGesture(); + + if (firmware_settings->IsDeviceManaged() && firmware_settings->IsTouchI2cManaged()) { + R_TRY(gesture->Activate()); + R_TRY(gesture->Activate(aruid.pid, basic_gesture_id)); + R_TRY(touch_screen->Activate()); + R_TRY(touch_screen->Activate(aruid.pid)); + } + + R_SUCCEED(); +} + +Result IHidDebugServer::IsTouchScreenManaged(Out out_is_managed) { + LOG_INFO(Service_HID, "called"); + + bool is_touch_active{}; + bool is_gesture_active{}; + R_TRY(GetResourceManager()->GetTouchScreen()->IsActive(is_touch_active)); + R_TRY(GetResourceManager()->GetGesture()->IsActive(is_gesture_active)); + + *out_is_managed = is_touch_active || is_gesture_active; + R_SUCCEED(); +} + +Result IHidDebugServer::DeactivateGesture() { + LOG_INFO(Service_HID, "called"); + + if (!firmware_settings->IsDeviceManaged()) { + R_RETURN(GetResourceManager()->GetGesture()->Deactivate()); + } + + R_SUCCEED(); +} + +std::shared_ptr IHidDebugServer::GetResourceManager() { + resource_manager->Initialize(); + return resource_manager; +} + } // namespace Service::HID diff --git a/src/core/hle/service/hid/hid_debug_server.h b/src/core/hle/service/hid/hid_debug_server.h index 20cc1ed541..f48f0205ed 100644 --- a/src/core/hle/service/hid/hid_debug_server.h +++ b/src/core/hle/service/hid/hid_debug_server.h @@ -18,5 +18,31 @@ namespace Service::HID { class ResourceManager; class HidFirmwareSettings; +class IHidDebugServer final : public ServiceFramework { +public: + explicit IHidDebugServer(Core::System& system_, std::shared_ptr resource, + std::shared_ptr settings); + ~IHidDebugServer() override; + +private: + Result DeactivateTouchScreen(); + Result SetTouchScreenAutoPilotState( + InArray auto_pilot_buffer); + Result UnsetTouchScreenAutoPilotState(); + Result GetTouchScreenConfiguration( + Out out_touchscreen_config, + ClientAppletResourceUserId aruid); + Result ProcessTouchScreenAutoTune(); + Result ForceStopTouchScreenManagement(); + Result ForceRestartTouchScreenManagement(u32 basic_gesture_id, + ClientAppletResourceUserId aruid); + Result IsTouchScreenManaged(Out out_is_managed); + Result DeactivateGesture(); + + std::shared_ptr GetResourceManager(); + + std::shared_ptr resource_manager; + std::shared_ptr firmware_settings; +}; } // namespace Service::HID diff --git a/src/core/hle/service/hid/hid_server.cpp b/src/core/hle/service/hid/hid_server.cpp index 18e57628d0..9689bce8dd 100644 --- a/src/core/hle/service/hid/hid_server.cpp +++ b/src/core/hle/service/hid/hid_server.cpp @@ -42,207 +42,207 @@ namespace Service::HID { -std::optional IHidServer::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&IHidServer::CreateAppletResource>, "CreateAppletResource"}, - FunctionInfo{1, C<&IHidServer::ActivateDebugPad>, "ActivateDebugPad"}, - FunctionInfo{11, C<&IHidServer::ActivateTouchScreen>, "ActivateTouchScreen"}, - FunctionInfo{21, C<&IHidServer::ActivateMouse>, "ActivateMouse"}, - FunctionInfo{26, C<&IHidServer::ActivateDebugMouse>, "ActivateDebugMouse"}, - FunctionInfo{31, C<&IHidServer::ActivateKeyboard>, "ActivateKeyboard"}, - FunctionInfo{32, C<&IHidServer::SendKeyboardLockKeyEvent>, "SendKeyboardLockKeyEvent"}, - FunctionInfo{40, C<&IHidServer::AcquireXpadIdEventHandle>, "AcquireXpadIdEventHandle"}, - FunctionInfo{41, C<&IHidServer::ReleaseXpadIdEventHandle>, "ReleaseXpadIdEventHandle"}, - FunctionInfo{51, C<&IHidServer::ActivateXpad>, "ActivateXpad"}, - FunctionInfo{55, C<&IHidServer::GetXpadIds>, "GetXpadIds"}, - FunctionInfo{56, C<&IHidServer::ActivateJoyXpad>, "ActivateJoyXpad"}, - FunctionInfo{58, C<&IHidServer::GetJoyXpadLifoHandle>, "GetJoyXpadLifoHandle"}, - FunctionInfo{59, C<&IHidServer::GetJoyXpadIds>, "GetJoyXpadIds"}, - FunctionInfo{60, C<&IHidServer::ActivateSixAxisSensor>, "ActivateSixAxisSensor"}, - FunctionInfo{61, C<&IHidServer::DeactivateSixAxisSensor>, "DeactivateSixAxisSensor"}, - FunctionInfo{62, C<&IHidServer::GetSixAxisSensorLifoHandle>, "GetSixAxisSensorLifoHandle"}, - FunctionInfo{63, C<&IHidServer::ActivateJoySixAxisSensor>, "ActivateJoySixAxisSensor"}, - FunctionInfo{64, C<&IHidServer::DeactivateJoySixAxisSensor>, "DeactivateJoySixAxisSensor"}, - FunctionInfo{65, C<&IHidServer::GetJoySixAxisSensorLifoHandle>, "GetJoySixAxisSensorLifoHandle"}, - FunctionInfo{66, C<&IHidServer::StartSixAxisSensor>, "StartSixAxisSensor"}, - FunctionInfo{67, C<&IHidServer::StopSixAxisSensor>, "StopSixAxisSensor"}, - FunctionInfo{68, C<&IHidServer::IsSixAxisSensorFusionEnabled>, "IsSixAxisSensorFusionEnabled"}, - FunctionInfo{69, C<&IHidServer::EnableSixAxisSensorFusion>, "EnableSixAxisSensorFusion"}, - FunctionInfo{70, C<&IHidServer::SetSixAxisSensorFusionParameters>, "SetSixAxisSensorFusionParameters"}, - FunctionInfo{71, C<&IHidServer::GetSixAxisSensorFusionParameters>, "GetSixAxisSensorFusionParameters"}, - FunctionInfo{72, C<&IHidServer::ResetSixAxisSensorFusionParameters>, "ResetSixAxisSensorFusionParameters"}, - FunctionInfo{73, nullptr, "SetAccelerometerParameters"}, - FunctionInfo{74, nullptr, "GetAccelerometerParameters"}, - FunctionInfo{75, nullptr, "ResetAccelerometerParameters"}, - FunctionInfo{76, nullptr, "SetAccelerometerPlayMode"}, - FunctionInfo{77, nullptr, "GetAccelerometerPlayMode"}, - FunctionInfo{78, nullptr, "ResetAccelerometerPlayMode"}, - FunctionInfo{79, C<&IHidServer::SetGyroscopeZeroDriftMode>, "SetGyroscopeZeroDriftMode"}, - FunctionInfo{80, C<&IHidServer::GetGyroscopeZeroDriftMode>, "GetGyroscopeZeroDriftMode"}, - FunctionInfo{81, C<&IHidServer::ResetGyroscopeZeroDriftMode>, "ResetGyroscopeZeroDriftMode"}, - FunctionInfo{82, C<&IHidServer::IsSixAxisSensorAtRest>, "IsSixAxisSensorAtRest"}, - FunctionInfo{83, C<&IHidServer::IsFirmwareUpdateAvailableForSixAxisSensor>, "IsFirmwareUpdateAvailableForSixAxisSensor"}, - FunctionInfo{84, C<&IHidServer::EnableSixAxisSensorUnalteredPassthrough>, "EnableSixAxisSensorUnalteredPassthrough"}, - FunctionInfo{85, C<&IHidServer::IsSixAxisSensorUnalteredPassthroughEnabled>, "IsSixAxisSensorUnalteredPassthroughEnabled"}, - FunctionInfo{86, nullptr, "StoreSixAxisSensorCalibrationParameter"}, - FunctionInfo{87, C<&IHidServer::LoadSixAxisSensorCalibrationParameter>, "LoadSixAxisSensorCalibrationParameter"}, - FunctionInfo{88, C<&IHidServer::GetSixAxisSensorIcInformation>, "GetSixAxisSensorIcInformation"}, - FunctionInfo{89, C<&IHidServer::ResetIsSixAxisSensorDeviceNewlyAssigned>, "ResetIsSixAxisSensorDeviceNewlyAssigned"}, - FunctionInfo{91, C<&IHidServer::ActivateGesture>, "ActivateGesture"}, - FunctionInfo{92, C<&IHidServer::SetGestureOutputRanges>, "SetGestureOutputRanges"}, - FunctionInfo{100, C<&IHidServer::SetSupportedNpadStyleSet>, "SetSupportedNpadStyleSet"}, - FunctionInfo{101, C<&IHidServer::GetSupportedNpadStyleSet>, "GetSupportedNpadStyleSet"}, - FunctionInfo{102, C<&IHidServer::SetSupportedNpadIdType>, "SetSupportedNpadIdType"}, - FunctionInfo{103, C<&IHidServer::ActivateNpad>, "ActivateNpad"}, - FunctionInfo{104, C<&IHidServer::DeactivateNpad>, "DeactivateNpad"}, - FunctionInfo{106, C<&IHidServer::AcquireNpadStyleSetUpdateEventHandle>, "AcquireNpadStyleSetUpdateEventHandle"}, - FunctionInfo{107, C<&IHidServer::DisconnectNpad>, "DisconnectNpad"}, - FunctionInfo{108, C<&IHidServer::GetPlayerLedPattern>, "GetPlayerLedPattern"}, - FunctionInfo{109, C<&IHidServer::ActivateNpadWithRevision>, "ActivateNpadWithRevision"}, - FunctionInfo{120, C<&IHidServer::SetNpadJoyHoldType>, "SetNpadJoyHoldType"}, - FunctionInfo{121, C<&IHidServer::GetNpadJoyHoldType>, "GetNpadJoyHoldType"}, - FunctionInfo{122, C<&IHidServer::SetNpadJoyAssignmentModeSingleByDefault>, "SetNpadJoyAssignmentModeSingleByDefault"}, - FunctionInfo{123, C<&IHidServer::SetNpadJoyAssignmentModeSingle>, "SetNpadJoyAssignmentModeSingle"}, - FunctionInfo{124, C<&IHidServer::SetNpadJoyAssignmentModeDual>, "SetNpadJoyAssignmentModeDual"}, - FunctionInfo{125, C<&IHidServer::MergeSingleJoyAsDualJoy>, "MergeSingleJoyAsDualJoy"}, - FunctionInfo{126, C<&IHidServer::StartLrAssignmentMode>, "StartLrAssignmentMode"}, - FunctionInfo{127, C<&IHidServer::StopLrAssignmentMode>, "StopLrAssignmentMode"}, - FunctionInfo{128, C<&IHidServer::SetNpadHandheldActivationMode>, "SetNpadHandheldActivationMode"}, - FunctionInfo{129, C<&IHidServer::GetNpadHandheldActivationMode>, "GetNpadHandheldActivationMode"}, - FunctionInfo{130, C<&IHidServer::SwapNpadAssignment>, "SwapNpadAssignment"}, - FunctionInfo{131, C<&IHidServer::IsUnintendedHomeButtonInputProtectionEnabled>, "IsUnintendedHomeButtonInputProtectionEnabled"}, - FunctionInfo{132, C<&IHidServer::EnableUnintendedHomeButtonInputProtection>, "EnableUnintendedHomeButtonInputProtection"}, - FunctionInfo{133, C<&IHidServer::SetNpadJoyAssignmentModeSingleWithDestination>, "SetNpadJoyAssignmentModeSingleWithDestination"}, - FunctionInfo{134, C<&IHidServer::SetNpadAnalogStickUseCenterClamp>, "SetNpadAnalogStickUseCenterClamp"}, - FunctionInfo{135, C<&IHidServer::SetNpadCaptureButtonAssignment>, "SetNpadCaptureButtonAssignment"}, - FunctionInfo{136, C<&IHidServer::ClearNpadCaptureButtonAssignment>, "ClearNpadCaptureButtonAssignment"}, - FunctionInfo{200, C<&IHidServer::GetVibrationDeviceInfo>, "GetVibrationDeviceInfo"}, - FunctionInfo{201, C<&IHidServer::SendVibrationValue>, "SendVibrationValue"}, - FunctionInfo{202, C<&IHidServer::GetActualVibrationValue>, "GetActualVibrationValue"}, - FunctionInfo{203, C<&IHidServer::CreateActiveVibrationDeviceList>, "CreateActiveVibrationDeviceList"}, - FunctionInfo{204, C<&IHidServer::PermitVibration>, "PermitVibration"}, - FunctionInfo{205, C<&IHidServer::IsVibrationPermitted>, "IsVibrationPermitted"}, - FunctionInfo{206, C<&IHidServer::SendVibrationValues>, "SendVibrationValues"}, - FunctionInfo{207, C<&IHidServer::SendVibrationGcErmCommand>, "SendVibrationGcErmCommand"}, - FunctionInfo{208, C<&IHidServer::GetActualVibrationGcErmCommand>, "GetActualVibrationGcErmCommand"}, - FunctionInfo{209, C<&IHidServer::BeginPermitVibrationSession>, "BeginPermitVibrationSession"}, - FunctionInfo{210, C<&IHidServer::EndPermitVibrationSession>, "EndPermitVibrationSession"}, - FunctionInfo{211, C<&IHidServer::IsVibrationDeviceMounted>, "IsVibrationDeviceMounted"}, - FunctionInfo{212, C<&IHidServer::SendVibrationValueInBool>, "SendVibrationValueInBool"}, - FunctionInfo{300, C<&IHidServer::ActivateConsoleSixAxisSensor>, "ActivateConsoleSixAxisSensor"}, - FunctionInfo{301, C<&IHidServer::StartConsoleSixAxisSensor>, "StartConsoleSixAxisSensor"}, - FunctionInfo{302, C<&IHidServer::StopConsoleSixAxisSensor>, "StopConsoleSixAxisSensor"}, - FunctionInfo{303, C<&IHidServer::ActivateSevenSixAxisSensor>, "ActivateSevenSixAxisSensor"}, - FunctionInfo{304, C<&IHidServer::StartSevenSixAxisSensor>, "StartSevenSixAxisSensor"}, - FunctionInfo{305, C<&IHidServer::StopSevenSixAxisSensor>, "StopSevenSixAxisSensor"}, - FunctionInfo{306, C<&IHidServer::InitializeSevenSixAxisSensor>, "InitializeSevenSixAxisSensor"}, - FunctionInfo{307, C<&IHidServer::FinalizeSevenSixAxisSensor>, "FinalizeSevenSixAxisSensor"}, - FunctionInfo{308, nullptr, "SetSevenSixAxisSensorFusionStrength"}, - FunctionInfo{309, nullptr, "GetSevenSixAxisSensorFusionStrength"}, - FunctionInfo{310, C<&IHidServer::ResetSevenSixAxisSensorTimestamp>, "ResetSevenSixAxisSensorTimestamp"}, - FunctionInfo{320, nullptr, "EnableNpadImu", MakeVersionGate({21,0,0})}, - FunctionInfo{321, nullptr, "DisableNpadImu", MakeVersionGate({21,0,0})}, - FunctionInfo{400, C<&IHidServer::IsUsbFullKeyControllerEnabled>, "IsUsbFullKeyControllerEnabled"}, - FunctionInfo{401, nullptr, "EnableUsbFullKeyController"}, - FunctionInfo{402, nullptr, "IsUsbFullKeyControllerConnected"}, - FunctionInfo{403, nullptr, "HasBattery"}, - FunctionInfo{404, nullptr, "HasLeftRightBattery"}, - FunctionInfo{405, nullptr, "GetNpadInterfaceType"}, - FunctionInfo{406, nullptr, "GetNpadLeftRightInterfaceType"}, - FunctionInfo{407, nullptr, "GetNpadOfHighestBatteryLevel"}, - FunctionInfo{408, nullptr, "GetNpadOfHighestBatteryLevelForJoyRight"}, - FunctionInfo{500, C<&IHidServer::GetPalmaConnectionHandle>, "GetPalmaConnectionHandle"}, - FunctionInfo{501, C<&IHidServer::InitializePalma>, "InitializePalma"}, - FunctionInfo{502, C<&IHidServer::AcquirePalmaOperationCompleteEvent>, "AcquirePalmaOperationCompleteEvent"}, - FunctionInfo{503, C<&IHidServer::GetPalmaOperationInfo>, "GetPalmaOperationInfo"}, - FunctionInfo{504, C<&IHidServer::PlayPalmaActivity>, "PlayPalmaActivity"}, - FunctionInfo{505, C<&IHidServer::SetPalmaFrModeType>, "SetPalmaFrModeType"}, - FunctionInfo{506, C<&IHidServer::ReadPalmaStep>, "ReadPalmaStep"}, - FunctionInfo{507, C<&IHidServer::EnablePalmaStep>, "EnablePalmaStep"}, - FunctionInfo{508, C<&IHidServer::ResetPalmaStep>, "ResetPalmaStep"}, - FunctionInfo{509, C<&IHidServer::ReadPalmaApplicationSection>, "ReadPalmaApplicationSection"}, - FunctionInfo{510, C<&IHidServer::WritePalmaApplicationSection>, "WritePalmaApplicationSection"}, - FunctionInfo{511, C<&IHidServer::ReadPalmaUniqueCode>, "ReadPalmaUniqueCode"}, - FunctionInfo{512, C<&IHidServer::SetPalmaUniqueCodeInvalid>, "SetPalmaUniqueCodeInvalid"}, - FunctionInfo{513, C<&IHidServer::WritePalmaActivityEntry>, "WritePalmaActivityEntry"}, - FunctionInfo{514, C<&IHidServer::WritePalmaRgbLedPatternEntry>, "WritePalmaRgbLedPatternEntry"}, - FunctionInfo{515, C<&IHidServer::WritePalmaWaveEntry>, "WritePalmaWaveEntry"}, - FunctionInfo{516, C<&IHidServer::SetPalmaDataBaseIdentificationVersion>, "SetPalmaDataBaseIdentificationVersion"}, - FunctionInfo{517, C<&IHidServer::GetPalmaDataBaseIdentificationVersion>, "GetPalmaDataBaseIdentificationVersion"}, - FunctionInfo{518, C<&IHidServer::SuspendPalmaFeature>, "SuspendPalmaFeature"}, - FunctionInfo{519, C<&IHidServer::GetPalmaOperationResult>, "GetPalmaOperationResult"}, - FunctionInfo{520, C<&IHidServer::ReadPalmaPlayLog>, "ReadPalmaPlayLog"}, - FunctionInfo{521, C<&IHidServer::ResetPalmaPlayLog>, "ResetPalmaPlayLog"}, - FunctionInfo{522, C<&IHidServer::SetIsPalmaAllConnectable>, "SetIsPalmaAllConnectable"}, - FunctionInfo{523, C<&IHidServer::SetIsPalmaPairedConnectable>, "SetIsPalmaPairedConnectable"}, - FunctionInfo{524, C<&IHidServer::PairPalma>, "PairPalma"}, - FunctionInfo{525, C<&IHidServer::SetPalmaBoostMode>, "SetPalmaBoostMode"}, - FunctionInfo{526, C<&IHidServer::CancelWritePalmaWaveEntry>, "CancelWritePalmaWaveEntry"}, - FunctionInfo{527, C<&IHidServer::EnablePalmaBoostMode>, "EnablePalmaBoostMode"}, - FunctionInfo{528, C<&IHidServer::GetPalmaBluetoothAddress>, "GetPalmaBluetoothAddress"}, - FunctionInfo{529, C<&IHidServer::SetDisallowedPalmaConnection>, "SetDisallowedPalmaConnection"}, - FunctionInfo{1000, C<&IHidServer::SetNpadCommunicationMode>, "SetNpadCommunicationMode"}, - FunctionInfo{1001, C<&IHidServer::GetNpadCommunicationMode>, "GetNpadCommunicationMode"}, - FunctionInfo{1002, C<&IHidServer::SetTouchScreenConfiguration>, "SetTouchScreenConfiguration"}, - FunctionInfo{1003, C<&IHidServer::IsFirmwareUpdateNeededForNotification>, "IsFirmwareUpdateNeededForNotification"}, - FunctionInfo{1004, C<&IHidServer::SetTouchScreenResolution>, "SetTouchScreenResolution"}, - FunctionInfo{1270, nullptr, "DeleteButtonConfigStorageRight"}, - FunctionInfo{1271, nullptr, "IsUsingCustomButtonConfig"}, - FunctionInfo{1272, nullptr, "IsAnyCustomButtonConfigEnabled"}, - FunctionInfo{1273, nullptr, "SetAllCustomButtonConfigEnabled"}, - FunctionInfo{1274, nullptr, "SetDefaultButtonConfig"}, - FunctionInfo{1275, nullptr, "SetAllDefaultButtonConfig"}, - FunctionInfo{1276, nullptr, "SetHidButtonConfigEmbedded"}, - FunctionInfo{1277, nullptr, "SetHidButtonConfigFull"}, - FunctionInfo{1278, nullptr, "SetHidButtonConfigLeft"}, - FunctionInfo{1279, nullptr, "SetHidButtonConfigRight"}, - FunctionInfo{1280, nullptr, "GetHidButtonConfigEmbedded"}, - FunctionInfo{1281, nullptr, "GetHidButtonConfigFull"}, - FunctionInfo{1282, nullptr, "GetHidButtonConfigLeft"}, - FunctionInfo{1283, nullptr, "GetHidButtonConfigRight"}, - FunctionInfo{1284, nullptr, "GetButtonConfigStorageEmbedded"}, - FunctionInfo{1285, nullptr, "GetButtonConfigStorageFull"}, - FunctionInfo{1286, nullptr, "GetButtonConfigStorageLeft"}, - FunctionInfo{1287, nullptr, "GetButtonConfigStorageRight"}, - FunctionInfo{1288, nullptr, "SetButtonConfigStorageEmbedded"}, - FunctionInfo{1289, nullptr, "SetButtonConfigStorageFull"}, - FunctionInfo{1290, nullptr, "SetButtonConfigStorageLeft"}, - FunctionInfo{1291, nullptr, "SetButtonConfigStorageRight"}, - FunctionInfo{1308, nullptr, "SetButtonConfigVisible"}, - FunctionInfo{1309, nullptr, "IsButtonConfigVisible"}, - FunctionInfo{1320, nullptr, "WakeTouchScreenUp"}, - FunctionInfo{1321, nullptr, "PutTouchScreenToSleep"}, - FunctionInfo{1322, nullptr, "AcquireTouchScreenAsyncWakeCompletedEvent"}, - FunctionInfo{1323, nullptr, "StartTouchScreenAutoTuneForSystemSettings"}, - FunctionInfo{1324, nullptr, "AcquireTouchScreenAutoTuneCompletedEvent"}, - FunctionInfo{1325, nullptr, "IsTouchScreenAutoTuneRequiredForRepairProviderReplacement"}, - FunctionInfo{1420, nullptr, "GetAppletResourceProperty"}, - FunctionInfo{2000, nullptr, "ActivateDigitizer"}, - FunctionInfo{3000, nullptr, "GetDebugPadGenericPadMap"}, - FunctionInfo{3001, nullptr, "SetDebugPadGenericPadMap"}, - FunctionInfo{3002, nullptr, "ResetDebugPadGenericPadMap"}, - FunctionInfo{3003, nullptr, "GetDebugPadKeyboardMap"}, - FunctionInfo{3004, nullptr, "SetDebugPadKeyboardMap"}, - FunctionInfo{3005, nullptr, "ResetDebugPadKeyboardMap"}, - FunctionInfo{3006, nullptr, "GetFullKeyGenericPadMap"}, - FunctionInfo{3007, nullptr, "SetFullKeyGenericPadMap"}, - FunctionInfo{3008, nullptr, "ResetFullKeyGenericPadMap"}, - FunctionInfo{3009, nullptr, "GetFullKeyKeyboardMap"}, - FunctionInfo{3010, nullptr, "SetFullKeyKeyboardMap"}, - FunctionInfo{3011, nullptr, "ResetFullKeyKeyboardMap"}, - FunctionInfo{3012, nullptr, "GetDebugPadGenericPadMap", MakeVersionGate({21,0,0})}, - FunctionInfo{3013, nullptr, "SetDebugPadGenericPadMap", MakeVersionGate({21,0,0})}, - FunctionInfo{3014, nullptr, "GetDebugPadKeyboardMap", MakeVersionGate({21,0,0})}, - FunctionInfo{3015, nullptr, "SetDebugPadKeyboardMap", MakeVersionGate({21,0,0})}, - FunctionInfo{3150, C<&IHidServer::SetMouseLibraryVersion>, "SetMouseLibraryVersion", MakeVersionGate({21,0,0})} - // What? -- {12010, nullptr, "SetButtonConfigLeft"}, - ); - return HandlerTableGenerateWithFind(key, functions); -} - IHidServer::IHidServer(Core::System& system_, std::shared_ptr resource, std::shared_ptr settings) : ServiceFramework{system_, "hid"}, resource_manager{resource}, firmware_settings{settings} { + // clang-format off + static const FunctionInfo functions[] = { + {0, C<&IHidServer::CreateAppletResource>, "CreateAppletResource"}, + {1, C<&IHidServer::ActivateDebugPad>, "ActivateDebugPad"}, + {11, C<&IHidServer::ActivateTouchScreen>, "ActivateTouchScreen"}, + {21, C<&IHidServer::ActivateMouse>, "ActivateMouse"}, + {26, C<&IHidServer::ActivateDebugMouse>, "ActivateDebugMouse"}, + {31, C<&IHidServer::ActivateKeyboard>, "ActivateKeyboard"}, + {32, C<&IHidServer::SendKeyboardLockKeyEvent>, "SendKeyboardLockKeyEvent"}, + {40, C<&IHidServer::AcquireXpadIdEventHandle>, "AcquireXpadIdEventHandle"}, + {41, C<&IHidServer::ReleaseXpadIdEventHandle>, "ReleaseXpadIdEventHandle"}, + {51, C<&IHidServer::ActivateXpad>, "ActivateXpad"}, + {55, C<&IHidServer::GetXpadIds>, "GetXpadIds"}, + {56, C<&IHidServer::ActivateJoyXpad>, "ActivateJoyXpad"}, + {58, C<&IHidServer::GetJoyXpadLifoHandle>, "GetJoyXpadLifoHandle"}, + {59, C<&IHidServer::GetJoyXpadIds>, "GetJoyXpadIds"}, + {60, C<&IHidServer::ActivateSixAxisSensor>, "ActivateSixAxisSensor"}, + {61, C<&IHidServer::DeactivateSixAxisSensor>, "DeactivateSixAxisSensor"}, + {62, C<&IHidServer::GetSixAxisSensorLifoHandle>, "GetSixAxisSensorLifoHandle"}, + {63, C<&IHidServer::ActivateJoySixAxisSensor>, "ActivateJoySixAxisSensor"}, + {64, C<&IHidServer::DeactivateJoySixAxisSensor>, "DeactivateJoySixAxisSensor"}, + {65, C<&IHidServer::GetJoySixAxisSensorLifoHandle>, "GetJoySixAxisSensorLifoHandle"}, + {66, C<&IHidServer::StartSixAxisSensor>, "StartSixAxisSensor"}, + {67, C<&IHidServer::StopSixAxisSensor>, "StopSixAxisSensor"}, + {68, C<&IHidServer::IsSixAxisSensorFusionEnabled>, "IsSixAxisSensorFusionEnabled"}, + {69, C<&IHidServer::EnableSixAxisSensorFusion>, "EnableSixAxisSensorFusion"}, + {70, C<&IHidServer::SetSixAxisSensorFusionParameters>, "SetSixAxisSensorFusionParameters"}, + {71, C<&IHidServer::GetSixAxisSensorFusionParameters>, "GetSixAxisSensorFusionParameters"}, + {72, C<&IHidServer::ResetSixAxisSensorFusionParameters>, "ResetSixAxisSensorFusionParameters"}, + {73, nullptr, "SetAccelerometerParameters"}, + {74, nullptr, "GetAccelerometerParameters"}, + {75, nullptr, "ResetAccelerometerParameters"}, + {76, nullptr, "SetAccelerometerPlayMode"}, + {77, nullptr, "GetAccelerometerPlayMode"}, + {78, nullptr, "ResetAccelerometerPlayMode"}, + {79, C<&IHidServer::SetGyroscopeZeroDriftMode>, "SetGyroscopeZeroDriftMode"}, + {80, C<&IHidServer::GetGyroscopeZeroDriftMode>, "GetGyroscopeZeroDriftMode"}, + {81, C<&IHidServer::ResetGyroscopeZeroDriftMode>, "ResetGyroscopeZeroDriftMode"}, + {82, C<&IHidServer::IsSixAxisSensorAtRest>, "IsSixAxisSensorAtRest"}, + {83, C<&IHidServer::IsFirmwareUpdateAvailableForSixAxisSensor>, "IsFirmwareUpdateAvailableForSixAxisSensor"}, + {84, C<&IHidServer::EnableSixAxisSensorUnalteredPassthrough>, "EnableSixAxisSensorUnalteredPassthrough"}, + {85, C<&IHidServer::IsSixAxisSensorUnalteredPassthroughEnabled>, "IsSixAxisSensorUnalteredPassthroughEnabled"}, + {86, nullptr, "StoreSixAxisSensorCalibrationParameter"}, + {87, C<&IHidServer::LoadSixAxisSensorCalibrationParameter>, "LoadSixAxisSensorCalibrationParameter"}, + {88, C<&IHidServer::GetSixAxisSensorIcInformation>, "GetSixAxisSensorIcInformation"}, + {89, C<&IHidServer::ResetIsSixAxisSensorDeviceNewlyAssigned>, "ResetIsSixAxisSensorDeviceNewlyAssigned"}, + {91, C<&IHidServer::ActivateGesture>, "ActivateGesture"}, + {92, C<&IHidServer::SetGestureOutputRanges>, "SetGestureOutputRanges"}, + {100, C<&IHidServer::SetSupportedNpadStyleSet>, "SetSupportedNpadStyleSet"}, + {101, C<&IHidServer::GetSupportedNpadStyleSet>, "GetSupportedNpadStyleSet"}, + {102, C<&IHidServer::SetSupportedNpadIdType>, "SetSupportedNpadIdType"}, + {103, C<&IHidServer::ActivateNpad>, "ActivateNpad"}, + {104, C<&IHidServer::DeactivateNpad>, "DeactivateNpad"}, + {106, C<&IHidServer::AcquireNpadStyleSetUpdateEventHandle>, "AcquireNpadStyleSetUpdateEventHandle"}, + {107, C<&IHidServer::DisconnectNpad>, "DisconnectNpad"}, + {108, C<&IHidServer::GetPlayerLedPattern>, "GetPlayerLedPattern"}, + {109, C<&IHidServer::ActivateNpadWithRevision>, "ActivateNpadWithRevision"}, + {120, C<&IHidServer::SetNpadJoyHoldType>, "SetNpadJoyHoldType"}, + {121, C<&IHidServer::GetNpadJoyHoldType>, "GetNpadJoyHoldType"}, + {122, C<&IHidServer::SetNpadJoyAssignmentModeSingleByDefault>, "SetNpadJoyAssignmentModeSingleByDefault"}, + {123, C<&IHidServer::SetNpadJoyAssignmentModeSingle>, "SetNpadJoyAssignmentModeSingle"}, + {124, C<&IHidServer::SetNpadJoyAssignmentModeDual>, "SetNpadJoyAssignmentModeDual"}, + {125, C<&IHidServer::MergeSingleJoyAsDualJoy>, "MergeSingleJoyAsDualJoy"}, + {126, C<&IHidServer::StartLrAssignmentMode>, "StartLrAssignmentMode"}, + {127, C<&IHidServer::StopLrAssignmentMode>, "StopLrAssignmentMode"}, + {128, C<&IHidServer::SetNpadHandheldActivationMode>, "SetNpadHandheldActivationMode"}, + {129, C<&IHidServer::GetNpadHandheldActivationMode>, "GetNpadHandheldActivationMode"}, + {130, C<&IHidServer::SwapNpadAssignment>, "SwapNpadAssignment"}, + {131, C<&IHidServer::IsUnintendedHomeButtonInputProtectionEnabled>, "IsUnintendedHomeButtonInputProtectionEnabled"}, + {132, C<&IHidServer::EnableUnintendedHomeButtonInputProtection>, "EnableUnintendedHomeButtonInputProtection"}, + {133, C<&IHidServer::SetNpadJoyAssignmentModeSingleWithDestination>, "SetNpadJoyAssignmentModeSingleWithDestination"}, + {134, C<&IHidServer::SetNpadAnalogStickUseCenterClamp>, "SetNpadAnalogStickUseCenterClamp"}, + {135, C<&IHidServer::SetNpadCaptureButtonAssignment>, "SetNpadCaptureButtonAssignment"}, + {136, C<&IHidServer::ClearNpadCaptureButtonAssignment>, "ClearNpadCaptureButtonAssignment"}, + {200, C<&IHidServer::GetVibrationDeviceInfo>, "GetVibrationDeviceInfo"}, + {201, C<&IHidServer::SendVibrationValue>, "SendVibrationValue"}, + {202, C<&IHidServer::GetActualVibrationValue>, "GetActualVibrationValue"}, + {203, C<&IHidServer::CreateActiveVibrationDeviceList>, "CreateActiveVibrationDeviceList"}, + {204, C<&IHidServer::PermitVibration>, "PermitVibration"}, + {205, C<&IHidServer::IsVibrationPermitted>, "IsVibrationPermitted"}, + {206, C<&IHidServer::SendVibrationValues>, "SendVibrationValues"}, + {207, C<&IHidServer::SendVibrationGcErmCommand>, "SendVibrationGcErmCommand"}, + {208, C<&IHidServer::GetActualVibrationGcErmCommand>, "GetActualVibrationGcErmCommand"}, + {209, C<&IHidServer::BeginPermitVibrationSession>, "BeginPermitVibrationSession"}, + {210, C<&IHidServer::EndPermitVibrationSession>, "EndPermitVibrationSession"}, + {211, C<&IHidServer::IsVibrationDeviceMounted>, "IsVibrationDeviceMounted"}, + {212, C<&IHidServer::SendVibrationValueInBool>, "SendVibrationValueInBool"}, + {300, C<&IHidServer::ActivateConsoleSixAxisSensor>, "ActivateConsoleSixAxisSensor"}, + {301, C<&IHidServer::StartConsoleSixAxisSensor>, "StartConsoleSixAxisSensor"}, + {302, C<&IHidServer::StopConsoleSixAxisSensor>, "StopConsoleSixAxisSensor"}, + {303, C<&IHidServer::ActivateSevenSixAxisSensor>, "ActivateSevenSixAxisSensor"}, + {304, C<&IHidServer::StartSevenSixAxisSensor>, "StartSevenSixAxisSensor"}, + {305, C<&IHidServer::StopSevenSixAxisSensor>, "StopSevenSixAxisSensor"}, + {306, C<&IHidServer::InitializeSevenSixAxisSensor>, "InitializeSevenSixAxisSensor"}, + {307, C<&IHidServer::FinalizeSevenSixAxisSensor>, "FinalizeSevenSixAxisSensor"}, + {308, nullptr, "SetSevenSixAxisSensorFusionStrength"}, + {309, nullptr, "GetSevenSixAxisSensorFusionStrength"}, + {310, C<&IHidServer::ResetSevenSixAxisSensorTimestamp>, "ResetSevenSixAxisSensorTimestamp"}, + {320, nullptr, "EnableNpadImu"}, //21.0.0+ + {321, nullptr, "DisableNpadImu"}, //21.0.0+ + {400, C<&IHidServer::IsUsbFullKeyControllerEnabled>, "IsUsbFullKeyControllerEnabled"}, + {401, nullptr, "EnableUsbFullKeyController"}, + {402, nullptr, "IsUsbFullKeyControllerConnected"}, + {403, nullptr, "HasBattery"}, + {404, nullptr, "HasLeftRightBattery"}, + {405, nullptr, "GetNpadInterfaceType"}, + {406, nullptr, "GetNpadLeftRightInterfaceType"}, + {407, nullptr, "GetNpadOfHighestBatteryLevel"}, + {408, nullptr, "GetNpadOfHighestBatteryLevelForJoyRight"}, + {500, C<&IHidServer::GetPalmaConnectionHandle>, "GetPalmaConnectionHandle"}, + {501, C<&IHidServer::InitializePalma>, "InitializePalma"}, + {502, C<&IHidServer::AcquirePalmaOperationCompleteEvent>, "AcquirePalmaOperationCompleteEvent"}, + {503, C<&IHidServer::GetPalmaOperationInfo>, "GetPalmaOperationInfo"}, + {504, C<&IHidServer::PlayPalmaActivity>, "PlayPalmaActivity"}, + {505, C<&IHidServer::SetPalmaFrModeType>, "SetPalmaFrModeType"}, + {506, C<&IHidServer::ReadPalmaStep>, "ReadPalmaStep"}, + {507, C<&IHidServer::EnablePalmaStep>, "EnablePalmaStep"}, + {508, C<&IHidServer::ResetPalmaStep>, "ResetPalmaStep"}, + {509, C<&IHidServer::ReadPalmaApplicationSection>, "ReadPalmaApplicationSection"}, + {510, C<&IHidServer::WritePalmaApplicationSection>, "WritePalmaApplicationSection"}, + {511, C<&IHidServer::ReadPalmaUniqueCode>, "ReadPalmaUniqueCode"}, + {512, C<&IHidServer::SetPalmaUniqueCodeInvalid>, "SetPalmaUniqueCodeInvalid"}, + {513, C<&IHidServer::WritePalmaActivityEntry>, "WritePalmaActivityEntry"}, + {514, C<&IHidServer::WritePalmaRgbLedPatternEntry>, "WritePalmaRgbLedPatternEntry"}, + {515, C<&IHidServer::WritePalmaWaveEntry>, "WritePalmaWaveEntry"}, + {516, C<&IHidServer::SetPalmaDataBaseIdentificationVersion>, "SetPalmaDataBaseIdentificationVersion"}, + {517, C<&IHidServer::GetPalmaDataBaseIdentificationVersion>, "GetPalmaDataBaseIdentificationVersion"}, + {518, C<&IHidServer::SuspendPalmaFeature>, "SuspendPalmaFeature"}, + {519, C<&IHidServer::GetPalmaOperationResult>, "GetPalmaOperationResult"}, + {520, C<&IHidServer::ReadPalmaPlayLog>, "ReadPalmaPlayLog"}, + {521, C<&IHidServer::ResetPalmaPlayLog>, "ResetPalmaPlayLog"}, + {522, C<&IHidServer::SetIsPalmaAllConnectable>, "SetIsPalmaAllConnectable"}, + {523, C<&IHidServer::SetIsPalmaPairedConnectable>, "SetIsPalmaPairedConnectable"}, + {524, C<&IHidServer::PairPalma>, "PairPalma"}, + {525, C<&IHidServer::SetPalmaBoostMode>, "SetPalmaBoostMode"}, + {526, C<&IHidServer::CancelWritePalmaWaveEntry>, "CancelWritePalmaWaveEntry"}, + {527, C<&IHidServer::EnablePalmaBoostMode>, "EnablePalmaBoostMode"}, + {528, C<&IHidServer::GetPalmaBluetoothAddress>, "GetPalmaBluetoothAddress"}, + {529, C<&IHidServer::SetDisallowedPalmaConnection>, "SetDisallowedPalmaConnection"}, + {1000, C<&IHidServer::SetNpadCommunicationMode>, "SetNpadCommunicationMode"}, + {1001, C<&IHidServer::GetNpadCommunicationMode>, "GetNpadCommunicationMode"}, + {1002, C<&IHidServer::SetTouchScreenConfiguration>, "SetTouchScreenConfiguration"}, + {1003, C<&IHidServer::IsFirmwareUpdateNeededForNotification>, "IsFirmwareUpdateNeededForNotification"}, + {1004, C<&IHidServer::SetTouchScreenResolution>, "SetTouchScreenResolution"}, + {1270, nullptr, "DeleteButtonConfigStorageRight"}, + {1271, nullptr, "IsUsingCustomButtonConfig"}, + {1272, nullptr, "IsAnyCustomButtonConfigEnabled"}, + {1273, nullptr, "SetAllCustomButtonConfigEnabled"}, + {1274, nullptr, "SetDefaultButtonConfig"}, + {1275, nullptr, "SetAllDefaultButtonConfig"}, + {1276, nullptr, "SetHidButtonConfigEmbedded"}, + {1277, nullptr, "SetHidButtonConfigFull"}, + {1278, nullptr, "SetHidButtonConfigLeft"}, + {1279, nullptr, "SetHidButtonConfigRight"}, + {1280, nullptr, "GetHidButtonConfigEmbedded"}, + {1281, nullptr, "GetHidButtonConfigFull"}, + {1282, nullptr, "GetHidButtonConfigLeft"}, + {1283, nullptr, "GetHidButtonConfigRight"}, + {1284, nullptr, "GetButtonConfigStorageEmbedded"}, + {1285, nullptr, "GetButtonConfigStorageFull"}, + {1286, nullptr, "GetButtonConfigStorageLeft"}, + {1287, nullptr, "GetButtonConfigStorageRight"}, + {1288, nullptr, "SetButtonConfigStorageEmbedded"}, + {1289, nullptr, "SetButtonConfigStorageFull"}, + {1290, nullptr, "SetButtonConfigStorageLeft"}, + {1291, nullptr, "SetButtonConfigStorageRight"}, + {1308, nullptr, "SetButtonConfigVisible"}, + {1309, nullptr, "IsButtonConfigVisible"}, + {1320, nullptr, "WakeTouchScreenUp"}, + {1321, nullptr, "PutTouchScreenToSleep"}, + {1322, nullptr, "AcquireTouchScreenAsyncWakeCompletedEvent"}, + {1323, nullptr, "StartTouchScreenAutoTuneForSystemSettings"}, + {1324, nullptr, "AcquireTouchScreenAutoTuneCompletedEvent"}, + {1325, nullptr, "IsTouchScreenAutoTuneRequiredForRepairProviderReplacement"}, + {1420, nullptr, "GetAppletResourceProperty"}, + {2000, nullptr, "ActivateDigitizer"}, + {3000, nullptr, "GetDebugPadGenericPadMap"}, + {3001, nullptr, "SetDebugPadGenericPadMap"}, + {3002, nullptr, "ResetDebugPadGenericPadMap"}, + {3003, nullptr, "GetDebugPadKeyboardMap"}, + {3004, nullptr, "SetDebugPadKeyboardMap"}, + {3005, nullptr, "ResetDebugPadKeyboardMap"}, + {3006, nullptr, "GetFullKeyGenericPadMap"}, + {3007, nullptr, "SetFullKeyGenericPadMap"}, + {3008, nullptr, "ResetFullKeyGenericPadMap"}, + {3009, nullptr, "GetFullKeyKeyboardMap"}, + {3010, nullptr, "SetFullKeyKeyboardMap"}, + {3011, nullptr, "ResetFullKeyKeyboardMap"}, + {3012, nullptr, "GetDebugPadGenericPadMap"}, //21.0.0+ + {3013, nullptr, "SetDebugPadGenericPadMap"}, //21.0.0+ + {3014, nullptr, "GetDebugPadKeyboardMap"}, //21.0.0+ + {3015, nullptr, "SetDebugPadKeyboardMap"}, //21.0.0+ + {3150, C<&IHidServer::SetMouseLibraryVersion>, "SetMouseLibraryVersion"}, //21.0.0+ + // What? -- {12010, nullptr, "SetButtonConfigLeft"}, + }; + // clang-format on + + RegisterHandlers(functions); } IHidServer::~IHidServer() = default; diff --git a/src/core/hle/service/hid/hid_server.h b/src/core/hle/service/hid/hid_server.h index f2c08e9df8..57a1a04b9c 100644 --- a/src/core/hle/service/hid/hid_server.h +++ b/src/core/hle/service/hid/hid_server.h @@ -265,8 +265,6 @@ private: Result SetTouchScreenResolution(u32 width, u32 height, ClientAppletResourceUserId aruid); Result SetMouseLibraryVersion(ClientAppletResourceUserId aruid); - std::optional FindRequest(u32 key) override; - std::shared_ptr resource_manager; std::shared_ptr firmware_settings; }; diff --git a/src/core/hle/service/hid/hid_system_server.cpp b/src/core/hle/service/hid/hid_system_server.cpp index 4df021f443..e544adf03c 100644 --- a/src/core/hle/service/hid/hid_system_server.cpp +++ b/src/core/hle/service/hid/hid_system_server.cpp @@ -22,6 +22,252 @@ IHidSystemServer::IHidSystemServer(Core::System& system_, std::shared_ptr settings) : ServiceFramework{system_, "hid:sys"}, service_context{system_, service_name}, resource_manager{resource}, firmware_settings{settings} { + // clang-format off + static const FunctionInfo functions[] = { + {31, nullptr, "SendKeyboardLockKeyEvent"}, + {101, nullptr, "AcquireHomeButtonEventHandle"}, + {111, nullptr, "ActivateHomeButton"}, + {121, nullptr, "AcquireSleepButtonEventHandle"}, + {131, nullptr, "ActivateSleepButton"}, + {141, nullptr, "AcquireCaptureButtonEventHandle"}, + {151, nullptr, "ActivateCaptureButton"}, + {161, &IHidSystemServer::GetPlatformConfig, "GetPlatformConfig"}, + {210, nullptr, "AcquireNfcDeviceUpdateEventHandle"}, + {211, nullptr, "GetNpadsWithNfc"}, + {212, nullptr, "AcquireNfcActivateEventHandle"}, + {213, nullptr, "ActivateNfc"}, + {214, nullptr, "GetXcdHandleForNpadWithNfc"}, + {215, nullptr, "IsNfcActivated"}, + {216, nullptr, "GetAbstractedPadIdForNpadWithNfc"}, + {217, nullptr, "SetNfcEvent"}, + {218, nullptr, "GetNfcInfo"}, + {219, nullptr, "StartNfcDiscovery"}, + {220, nullptr, "StopNfcDiscovery"}, + {221, nullptr, "StartNtagRead"}, + {222, nullptr, "StartNtagWrite"}, + {223, nullptr, "SendNfcRawData"}, + {224, nullptr, "RegisterMifareKey"}, + {225, nullptr, "ClearMifareKey"}, + {226, nullptr, "StartMifareRead"}, + {227, nullptr, "StartMifareWrite"}, + {230, nullptr, "AcquireIrSensorEventHndle" }, + {231, nullptr, "ActivateIrSensor"}, + {232, nullptr, "GetIrSensorState"}, + {233, nullptr, "GetXcdHandleForNpadWihIrSensor" }, + {234, nullptr, "GetNpadJoyHoldType"}, + {241, nullptr, "GetDataFormat"}, + {242, nullptr, "SetDataFormat"}, + {243, nullptr, "GetMcuState"}, + {244, nullptr, "SetMcuState"}, + {245, nullptr, "GetMcuVersionForNfc"}, + {246, nullptr, "CheckNfcDevicePower"}, + {247, nullptr, "SetMcuStateImmediate"}, + {301, nullptr, "ActivateNpadSystem"}, + {303, &IHidSystemServer::ApplyNpadSystemCommonPolicy, "ApplyNpadSystemCommonPolicy"}, + {304, &IHidSystemServer::EnableAssigningSingleOnSlSrPress, "EnableAssigningSingleOnSlSrPress"}, + {305, &IHidSystemServer::DisableAssigningSingleOnSlSrPress, "DisableAssigningSingleOnSlSrPress"}, + {306, &IHidSystemServer::GetLastActiveNpad, "GetLastActiveNpad"}, + {307, nullptr, "GetNpadSystemExtStyle"}, + {308, &IHidSystemServer::ApplyNpadSystemCommonPolicyFull, "ApplyNpadSystemCommonPolicyFull"}, + {309, &IHidSystemServer::GetNpadFullKeyGripColor, "GetNpadFullKeyGripColor"}, + {310, &IHidSystemServer::GetMaskedSupportedNpadStyleSet, "GetMaskedSupportedNpadStyleSet"}, + {311, nullptr, "SetNpadPlayerLedBlinkingDevice"}, + {312, &IHidSystemServer::SetSupportedNpadStyleSetAll, "SetSupportedNpadStyleSetAll"}, + {313, &IHidSystemServer::GetNpadCaptureButtonAssignment, "GetNpadCaptureButtonAssignment"}, + {314, nullptr, "GetAppletFooterUiType"}, + {315, &IHidSystemServer::GetAppletDetailedUiType, "GetAppletDetailedUiType"}, + {316, &IHidSystemServer::GetNpadInterfaceType, "GetNpadInterfaceType"}, + {317, &IHidSystemServer::GetNpadLeftRightInterfaceType, "GetNpadLeftRightInterfaceType"}, + {318, &IHidSystemServer::HasBattery, "HasBattery"}, + {319, &IHidSystemServer::HasLeftRightBattery, "HasLeftRightBattery"}, + {321, &IHidSystemServer::GetUniquePadsFromNpad, "GetUniquePadsFromNpad"}, + {322, &IHidSystemServer::SetNpadSystemExtStateEnabled, "SetNpadSystemExtStateEnabled"}, + {323, nullptr, "GetLastActiveUniquePad"}, + {324, nullptr, "GetUniquePadButtonSet"}, + {325, nullptr, "GetUniquePadColor"}, + {326, nullptr, "GetUniquePadAppletDetailedUiType"}, + {327, nullptr, "GetAbstractedPadIdDataFromNpad"}, + {328, nullptr, "AttachAbstractedPadToNpad"}, + {329, nullptr, "DetachAbstractedPadAll"}, + {330, nullptr, "CheckAbstractedPadConnection"}, + {332, nullptr, "ConvertAppletDetailedUiTypeFromPlayReportType"}, //19.0.0+ + {333, nullptr, "SetNpadUserSpgApplet"}, //20.0.0+ + {334, nullptr, "AcquireUniquePadButtonStateChangedEventHandle"}, //20.0.0+ + {501, &IHidSystemServer::RegisterAppletResourceUserId, "RegisterAppletResourceUserId"}, + {502, &IHidSystemServer::UnregisterAppletResourceUserId, "UnregisterAppletResourceUserId"}, + {503, &IHidSystemServer::EnableAppletToGetInput, "EnableAppletToGetInput"}, + {504, &IHidSystemServer::SetAruidValidForVibration, "SetAruidValidForVibration"}, + {505, &IHidSystemServer::EnableAppletToGetSixAxisSensor, "EnableAppletToGetSixAxisSensor"}, + {506, &IHidSystemServer::EnableAppletToGetPadInput, "EnableAppletToGetPadInput"}, + {507, &IHidSystemServer::EnableAppletToGetTouchScreen, "EnableAppletToGetTouchScreen"}, + {510, &IHidSystemServer::SetVibrationMasterVolume, "SetVibrationMasterVolume"}, + {511, &IHidSystemServer::GetVibrationMasterVolume, "GetVibrationMasterVolume"}, + {512, &IHidSystemServer::BeginPermitVibrationSession, "BeginPermitVibrationSession"}, + {513, &IHidSystemServer::EndPermitVibrationSession, "EndPermitVibrationSession"}, + {514, nullptr, "Unknown514"}, + {520, nullptr, "EnableHandheldHids"}, + {521, nullptr, "DisableHandheldHids"}, + {522, nullptr, "SetJoyConRailEnabled"}, + {523, &IHidSystemServer::IsJoyConRailEnabled, "IsJoyConRailEnabled"}, + {524, nullptr, "IsHandheldHidsEnabled"}, + {525, &IHidSystemServer::IsJoyConAttachedOnAllRail, "IsJoyConAttachedOnAllRail"}, + {540, nullptr, "AcquirePlayReportControllerUsageUpdateEvent"}, + {541, nullptr, "GetPlayReportControllerUsages"}, + {542, nullptr, "AcquirePlayReportRegisteredDeviceUpdateEvent"}, + {543, nullptr, "GetRegisteredDevicesOld"}, + {544, &IHidSystemServer::AcquireConnectionTriggerTimeoutEvent, "AcquireConnectionTriggerTimeoutEvent"}, + {545, nullptr, "SendConnectionTrigger"}, + {546, &IHidSystemServer::AcquireDeviceRegisteredEventForControllerSupport, "AcquireDeviceRegisteredEventForControllerSupport"}, + {547, nullptr, "GetAllowedBluetoothLinksCount"}, + {548, &IHidSystemServer::GetRegisteredDevices, "GetRegisteredDevices"}, + {549, nullptr, "GetConnectableRegisteredDevices"}, + {551, &IHidSystemServer::GetRegisteredDevices, "GetRegisteredDevicesForControllerSupport"}, //20.0.0+ //mocked via 548 for Diablo 3 (at least) + {700, nullptr, "ActivateUniquePad"}, + {702, &IHidSystemServer::AcquireUniquePadConnectionEventHandle, "AcquireUniquePadConnectionEventHandle"}, + {703, &IHidSystemServer::GetUniquePadIds, "GetUniquePadIds"}, + {711, nullptr, "AcquireUniquePadConnectionOnHandheldForNsEventHandle"}, //20.0.0+ + {712, nullptr, "GetUniquePadColor12"}, //20.0.0+ + {751, &IHidSystemServer::AcquireJoyDetachOnBluetoothOffEventHandle, "AcquireJoyDetachOnBluetoothOffEventHandle"}, + {800, nullptr, "ListSixAxisSensorHandles"}, + {801, nullptr, "IsSixAxisSensorUserCalibrationSupported"}, + {802, nullptr, "ResetSixAxisSensorCalibrationValues"}, + {803, nullptr, "StartSixAxisSensorUserCalibration"}, + {804, nullptr, "CancelSixAxisSensorUserCalibration"}, + {805, nullptr, "GetUniquePadBluetoothAddress"}, + {806, nullptr, "DisconnectUniquePad"}, + {807, nullptr, "GetUniquePadType"}, + {808, nullptr, "GetUniquePadInterface"}, + {809, nullptr, "GetUniquePadSerialNumber"}, + {810, nullptr, "GetUniquePadControllerNumber"}, + {811, nullptr, "GetSixAxisSensorUserCalibrationStage"}, + {812, nullptr, "GetConsoleUniqueSixAxisSensorHandle"}, + {813, nullptr, "GetDeviceType"}, + {821, nullptr, "StartAnalogStickManualCalibration"}, + {822, nullptr, "RetryCurrentAnalogStickManualCalibrationStage"}, + {823, nullptr, "CancelAnalogStickManualCalibration"}, + {824, nullptr, "ResetAnalogStickManualCalibration"}, + {825, nullptr, "GetAnalogStickState"}, + {826, nullptr, "GetAnalogStickManualCalibrationStage"}, + {827, nullptr, "IsAnalogStickButtonPressed"}, + {828, nullptr, "IsAnalogStickInReleasePosition"}, + {829, nullptr, "IsAnalogStickInCircumference"}, + {830, nullptr, "SetNotificationLedPattern"}, + {831, nullptr, "SetNotificationLedPatternWithTimeout"}, + {832, nullptr, "PrepareHidsForNotificationWake"}, + {850, &IHidSystemServer::IsUsbFullKeyControllerEnabled, "IsUsbFullKeyControllerEnabled"}, + {851, &IHidSystemServer::EnableUsbFullKeyController, "EnableUsbFullKeyController"}, + {852, nullptr, "IsUsbConnected"}, + {870, &IHidSystemServer::IsHandheldButtonPressedOnConsoleMode, "IsHandheldButtonPressedOnConsoleMode"}, + {900, nullptr, "ActivateInputDetector"}, + {901, nullptr, "NotifyInputDetector"}, + {1000, &IHidSystemServer::InitializeFirmwareUpdate, "InitializeFirmwareUpdate"}, + {1001, nullptr, "GetFirmwareVersion"}, + {1002, nullptr, "GetAvailableFirmwareVersion"}, + {1003, nullptr, "IsFirmwareUpdateAvailable"}, + {1004, &IHidSystemServer::CheckFirmwareUpdateRequired, "CheckFirmwareUpdateRequired"}, + {1005, nullptr, "StartFirmwareUpdate"}, + {1006, nullptr, "AbortFirmwareUpdate"}, + {1007, nullptr, "GetFirmwareUpdateState"}, + {1008, nullptr, "ActivateAudioControl"}, + {1009, nullptr, "AcquireAudioControlEventHandle"}, + {1010, nullptr, "GetAudioControlStates"}, + {1011, nullptr, "DeactivateAudioControl"}, + {1012, nullptr, "GetFirmwareVersionStringForUserSupportPage"}, + {1050, nullptr, "IsSixAxisSensorAccurateUserCalibrationSupported"}, + {1051, nullptr, "StartSixAxisSensorAccurateUserCalibration"}, + {1052, nullptr, "CancelSixAxisSensorAccurateUserCalibration"}, + {1053, nullptr, "GetSixAxisSensorAccurateUserCalibrationState"}, + {1100, nullptr, "GetHidbusSystemServiceObject"}, + {1120, &IHidSystemServer::SetFirmwareHotfixUpdateSkipEnabled, "SetFirmwareHotfixUpdateSkipEnabled"}, + {1130, &IHidSystemServer::InitializeUsbFirmwareUpdate, "InitializeUsbFirmwareUpdate"}, + {1131, &IHidSystemServer::FinalizeUsbFirmwareUpdate, "FinalizeUsbFirmwareUpdate"}, + {1132, &IHidSystemServer::CheckUsbFirmwareUpdateRequired, "CheckUsbFirmwareUpdateRequired"}, + {1133, nullptr, "StartUsbFirmwareUpdate"}, + {1134, nullptr, "GetUsbFirmwareUpdateState"}, + {1135, &IHidSystemServer::InitializeUsbFirmwareUpdateWithoutMemory, "InitializeUsbFirmwareUpdateWithoutMemory"}, + {1150, &IHidSystemServer::SetTouchScreenMagnification, "SetTouchScreenMagnification"}, + {1151, &IHidSystemServer::GetTouchScreenFirmwareVersion, "GetTouchScreenFirmwareVersion"}, + {1152, &IHidSystemServer::SetTouchScreenDefaultConfiguration, "SetTouchScreenDefaultConfiguration"}, + {1153, &IHidSystemServer::GetTouchScreenDefaultConfiguration, "GetTouchScreenDefaultConfiguration"}, + {1154, nullptr, "IsFirmwareAvailableForNotification"}, + {1155, &IHidSystemServer::SetForceHandheldStyleVibration, "SetForceHandheldStyleVibration"}, + {1156, nullptr, "SendConnectionTriggerWithoutTimeoutEvent"}, + {1157, nullptr, "CancelConnectionTrigger"}, + {1158, nullptr, "SetConnectionLimitForSplay"}, //20.1.0+ + {1159, nullptr, "ClearConnectionLimitForSplay"}, //20.1.0+ + {1200, nullptr, "IsButtonConfigSupported"}, + {1201, nullptr, "IsButtonConfigEmbeddedSupported"}, + {1202, nullptr, "DeleteButtonConfig"}, + {1203, nullptr, "DeleteButtonConfigEmbedded"}, + {1204, nullptr, "SetButtonConfigEnabled"}, + {1205, nullptr, "SetButtonConfigEmbeddedEnabled"}, + {1206, nullptr, "IsButtonConfigEnabled"}, + {1207, nullptr, "IsButtonConfigEmbeddedEnabled"}, + {1208, nullptr, "SetButtonConfigEmbedded"}, + {1209, nullptr, "SetButtonConfigFull"}, + {1210, nullptr, "SetButtonConfigLeft"}, + {1211, nullptr, "SetButtonConfigRight"}, + {1212, nullptr, "GetButtonConfigEmbedded"}, + {1213, nullptr, "GetButtonConfigFull"}, + {1214, nullptr, "GetButtonConfigLeft"}, + {1215, nullptr, "GetButtonConfigRight"}, + {1250, nullptr, "IsCustomButtonConfigSupported"}, + {1251, nullptr, "IsDefaultButtonConfigEmbedded"}, + {1252, nullptr, "IsDefaultButtonConfigFull"}, + {1253, nullptr, "IsDefaultButtonConfigLeft"}, + {1254, nullptr, "IsDefaultButtonConfigRight"}, + {1255, nullptr, "IsButtonConfigStorageEmbeddedEmpty"}, + {1256, nullptr, "IsButtonConfigStorageFullEmpty"}, + {1257, nullptr, "IsButtonConfigStorageLeftEmpty"}, + {1258, nullptr, "IsButtonConfigStorageRightEmpty"}, + {1259, nullptr, "GetButtonConfigStorageEmbeddedDeprecated"}, + {1260, nullptr, "GetButtonConfigStorageFullDeprecated"}, + {1261, nullptr, "GetButtonConfigStorageLeftDeprecated"}, + {1262, nullptr, "GetButtonConfigStorageRightDeprecated"}, + {1263, nullptr, "SetButtonConfigStorageEmbeddedDeprecated"}, + {1264, nullptr, "SetButtonConfigStorageFullDeprecated"}, + {1265, nullptr, "SetButtonConfigStorageLeftDeprecated"}, + {1266, nullptr, "SetButtonConfigStorageRightDeprecated"}, + {1267, nullptr, "DeleteButtonConfigStorageEmbedded"}, + {1268, nullptr, "DeleteButtonConfigStorageFull"}, + {1269, nullptr, "DeleteButtonConfigStorageLeft"}, + {1270, nullptr, "DeleteButtonConfigStorageRight"}, + {1271, &IHidSystemServer::IsUsingCustomButtonConfig, "IsUsingCustomButtonConfig"}, + {1272, &IHidSystemServer::IsAnyCustomButtonConfigEnabled, "IsAnyCustomButtonConfigEnabled"}, + {1273, nullptr, "SetAllCustomButtonConfigEnabled"}, + {1274, nullptr, "SetDefaultButtonConfig"}, + {1275, nullptr, "SetAllDefaultButtonConfig"}, + {1276, nullptr, "SetHidButtonConfigEmbedded"}, + {1277, nullptr, "SetHidButtonConfigFull"}, + {1278, nullptr, "SetHidButtonConfigLeft"}, + {1279, nullptr, "SetHidButtonConfigRight"}, + {1280, nullptr, "GetHidButtonConfigEmbedded"}, + {1281, nullptr, "GetHidButtonConfigFull"}, + {1282, nullptr, "GetHidButtonConfigLeft"}, + {1283, nullptr, "GetHidButtonConfigRight"}, + {1284, nullptr, "GetButtonConfigStorageEmbedded"}, + {1285, nullptr, "GetButtonConfigStorageFull"}, + {1286, nullptr, "GetButtonConfigStorageLeft"}, + {1287, nullptr, "GetButtonConfigStorageRight"}, + {1288, nullptr, "SetButtonConfigStorageEmbedded"}, + {1289, nullptr, "SetButtonConfigStorageFull"}, + {1290, nullptr, "DeleteButtonConfigStorageRight"}, + {1291, nullptr, "DeleteButtonConfigStorageRight"}, + {1308, nullptr, "SetButtonConfigVisible"}, //18.0.0+ + {1309, nullptr, "IsButtonConfigVisible"}, //18.0.0+ + {1320, nullptr, "WakeTouchScreenUp"}, //17.0.0+ + {1321, nullptr, "PutTouchScreenToSleep"}, //17.0.0+ + {1322, nullptr, "AcquireTouchScreenAsyncWakeCompletedEvent"}, //20.0.0+ + {1323, nullptr, "StartTouchScreenAutoTuneForSystemSettings"}, //21.0.0+ + {1324, nullptr, "AcquireTouchScreenAutoTuneCompletedEvent"}, //21.0.0+ + {1325, nullptr, "IsTouchScreenAutoTuneRequiredForRepairProviderReplacement"}, //21.0.0+ + {1326, nullptr, "SetTouchScreenOffset"}, //21.0.0+ + {1420, nullptr, "GetAppletResourceProperty"}, //19.0.0+ + {12010, nullptr, "SetButtonConfigLeft"} //11.0.0-17.0.1 + }; + // clang-format on + + RegisterHandlers(functions); joy_detach_event = service_context.CreateEvent("IHidSystemServer::JoyDetachEvent"); acquire_device_registered_event = diff --git a/src/core/hle/service/hid/hid_system_server.h b/src/core/hle/service/hid/hid_system_server.h index e5da7bbdac..150b697305 100644 --- a/src/core/hle/service/hid/hid_system_server.h +++ b/src/core/hle/service/hid/hid_system_server.h @@ -84,252 +84,6 @@ private: std::shared_ptr GetResourceManager(); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{31, nullptr, "SendKeyboardLockKeyEvent"}, - FunctionInfo{101, nullptr, "AcquireHomeButtonEventHandle"}, - FunctionInfo{111, nullptr, "ActivateHomeButton"}, - FunctionInfo{121, nullptr, "AcquireSleepButtonEventHandle"}, - FunctionInfo{131, nullptr, "ActivateSleepButton"}, - FunctionInfo{141, nullptr, "AcquireCaptureButtonEventHandle"}, - FunctionInfo{151, nullptr, "ActivateCaptureButton"}, - FunctionInfo{161, &IHidSystemServer::GetPlatformConfig, "GetPlatformConfig"}, - FunctionInfo{210, nullptr, "AcquireNfcDeviceUpdateEventHandle"}, - FunctionInfo{211, nullptr, "GetNpadsWithNfc"}, - FunctionInfo{212, nullptr, "AcquireNfcActivateEventHandle"}, - FunctionInfo{213, nullptr, "ActivateNfc"}, - FunctionInfo{214, nullptr, "GetXcdHandleForNpadWithNfc"}, - FunctionInfo{215, nullptr, "IsNfcActivated"}, - FunctionInfo{216, nullptr, "GetAbstractedPadIdForNpadWithNfc"}, - FunctionInfo{217, nullptr, "SetNfcEvent"}, - FunctionInfo{218, nullptr, "GetNfcInfo"}, - FunctionInfo{219, nullptr, "StartNfcDiscovery"}, - FunctionInfo{220, nullptr, "StopNfcDiscovery"}, - FunctionInfo{221, nullptr, "StartNtagRead"}, - FunctionInfo{222, nullptr, "StartNtagWrite"}, - FunctionInfo{223, nullptr, "SendNfcRawData"}, - FunctionInfo{224, nullptr, "RegisterMifareKey"}, - FunctionInfo{225, nullptr, "ClearMifareKey"}, - FunctionInfo{226, nullptr, "StartMifareRead"}, - FunctionInfo{227, nullptr, "StartMifareWrite"}, - FunctionInfo{230, nullptr, "AcquireIrSensorEventHndle" }, - FunctionInfo{231, nullptr, "ActivateIrSensor"}, - FunctionInfo{232, nullptr, "GetIrSensorState"}, - FunctionInfo{233, nullptr, "GetXcdHandleForNpadWihIrSensor" }, - FunctionInfo{234, nullptr, "GetNpadJoyHoldType"}, - FunctionInfo{241, nullptr, "GetDataFormat"}, - FunctionInfo{242, nullptr, "SetDataFormat"}, - FunctionInfo{243, nullptr, "GetMcuState"}, - FunctionInfo{244, nullptr, "SetMcuState"}, - FunctionInfo{245, nullptr, "GetMcuVersionForNfc"}, - FunctionInfo{246, nullptr, "CheckNfcDevicePower"}, - FunctionInfo{247, nullptr, "SetMcuStateImmediate"}, - FunctionInfo{301, nullptr, "ActivateNpadSystem"}, - FunctionInfo{303, &IHidSystemServer::ApplyNpadSystemCommonPolicy, "ApplyNpadSystemCommonPolicy"}, - FunctionInfo{304, &IHidSystemServer::EnableAssigningSingleOnSlSrPress, "EnableAssigningSingleOnSlSrPress"}, - FunctionInfo{305, &IHidSystemServer::DisableAssigningSingleOnSlSrPress, "DisableAssigningSingleOnSlSrPress"}, - FunctionInfo{306, &IHidSystemServer::GetLastActiveNpad, "GetLastActiveNpad"}, - FunctionInfo{307, nullptr, "GetNpadSystemExtStyle"}, - FunctionInfo{308, &IHidSystemServer::ApplyNpadSystemCommonPolicyFull, "ApplyNpadSystemCommonPolicyFull"}, - FunctionInfo{309, &IHidSystemServer::GetNpadFullKeyGripColor, "GetNpadFullKeyGripColor"}, - FunctionInfo{310, &IHidSystemServer::GetMaskedSupportedNpadStyleSet, "GetMaskedSupportedNpadStyleSet"}, - FunctionInfo{311, nullptr, "SetNpadPlayerLedBlinkingDevice"}, - FunctionInfo{312, &IHidSystemServer::SetSupportedNpadStyleSetAll, "SetSupportedNpadStyleSetAll"}, - FunctionInfo{313, &IHidSystemServer::GetNpadCaptureButtonAssignment, "GetNpadCaptureButtonAssignment"}, - FunctionInfo{314, nullptr, "GetAppletFooterUiType"}, - FunctionInfo{315, &IHidSystemServer::GetAppletDetailedUiType, "GetAppletDetailedUiType"}, - FunctionInfo{316, &IHidSystemServer::GetNpadInterfaceType, "GetNpadInterfaceType"}, - FunctionInfo{317, &IHidSystemServer::GetNpadLeftRightInterfaceType, "GetNpadLeftRightInterfaceType"}, - FunctionInfo{318, &IHidSystemServer::HasBattery, "HasBattery"}, - FunctionInfo{319, &IHidSystemServer::HasLeftRightBattery, "HasLeftRightBattery"}, - FunctionInfo{321, &IHidSystemServer::GetUniquePadsFromNpad, "GetUniquePadsFromNpad"}, - FunctionInfo{322, &IHidSystemServer::SetNpadSystemExtStateEnabled, "SetNpadSystemExtStateEnabled"}, - FunctionInfo{323, nullptr, "GetLastActiveUniquePad"}, - FunctionInfo{324, nullptr, "GetUniquePadButtonSet"}, - FunctionInfo{325, nullptr, "GetUniquePadColor"}, - FunctionInfo{326, nullptr, "GetUniquePadAppletDetailedUiType"}, - FunctionInfo{327, nullptr, "GetAbstractedPadIdDataFromNpad"}, - FunctionInfo{328, nullptr, "AttachAbstractedPadToNpad"}, - FunctionInfo{329, nullptr, "DetachAbstractedPadAll"}, - FunctionInfo{330, nullptr, "CheckAbstractedPadConnection"}, - FunctionInfo{332, nullptr, "ConvertAppletDetailedUiTypeFromPlayReportType", MakeVersionGate({19,0,0})}, - FunctionInfo{333, nullptr, "SetNpadUserSpgApplet", MakeVersionGate({20,0,0})}, - FunctionInfo{334, nullptr, "AcquireUniquePadButtonStateChangedEventHandle", MakeVersionGate({20,0,0})}, - FunctionInfo{501, &IHidSystemServer::RegisterAppletResourceUserId, "RegisterAppletResourceUserId"}, - FunctionInfo{502, &IHidSystemServer::UnregisterAppletResourceUserId, "UnregisterAppletResourceUserId"}, - FunctionInfo{503, &IHidSystemServer::EnableAppletToGetInput, "EnableAppletToGetInput"}, - FunctionInfo{504, &IHidSystemServer::SetAruidValidForVibration, "SetAruidValidForVibration"}, - FunctionInfo{505, &IHidSystemServer::EnableAppletToGetSixAxisSensor, "EnableAppletToGetSixAxisSensor"}, - FunctionInfo{506, &IHidSystemServer::EnableAppletToGetPadInput, "EnableAppletToGetPadInput"}, - FunctionInfo{507, &IHidSystemServer::EnableAppletToGetTouchScreen, "EnableAppletToGetTouchScreen"}, - FunctionInfo{510, &IHidSystemServer::SetVibrationMasterVolume, "SetVibrationMasterVolume"}, - FunctionInfo{511, &IHidSystemServer::GetVibrationMasterVolume, "GetVibrationMasterVolume"}, - FunctionInfo{512, &IHidSystemServer::BeginPermitVibrationSession, "BeginPermitVibrationSession"}, - FunctionInfo{513, &IHidSystemServer::EndPermitVibrationSession, "EndPermitVibrationSession"}, - FunctionInfo{514, nullptr, "Unknown514"}, - FunctionInfo{520, nullptr, "EnableHandheldHids"}, - FunctionInfo{521, nullptr, "DisableHandheldHids"}, - FunctionInfo{522, nullptr, "SetJoyConRailEnabled"}, - FunctionInfo{523, &IHidSystemServer::IsJoyConRailEnabled, "IsJoyConRailEnabled"}, - FunctionInfo{524, nullptr, "IsHandheldHidsEnabled"}, - FunctionInfo{525, &IHidSystemServer::IsJoyConAttachedOnAllRail, "IsJoyConAttachedOnAllRail"}, - FunctionInfo{540, nullptr, "AcquirePlayReportControllerUsageUpdateEvent"}, - FunctionInfo{541, nullptr, "GetPlayReportControllerUsages"}, - FunctionInfo{542, nullptr, "AcquirePlayReportRegisteredDeviceUpdateEvent"}, - FunctionInfo{543, nullptr, "GetRegisteredDevicesOld"}, - FunctionInfo{544, &IHidSystemServer::AcquireConnectionTriggerTimeoutEvent, "AcquireConnectionTriggerTimeoutEvent"}, - FunctionInfo{545, nullptr, "SendConnectionTrigger"}, - FunctionInfo{546, &IHidSystemServer::AcquireDeviceRegisteredEventForControllerSupport, "AcquireDeviceRegisteredEventForControllerSupport"}, - FunctionInfo{547, nullptr, "GetAllowedBluetoothLinksCount"}, - FunctionInfo{548, &IHidSystemServer::GetRegisteredDevices, "GetRegisteredDevices"}, - FunctionInfo{549, nullptr, "GetConnectableRegisteredDevices"}, - FunctionInfo{551, &IHidSystemServer::GetRegisteredDevices, "GetRegisteredDevicesForControllerSupport", MakeVersionGate({20,0,0})}, //mocked via 548 for Diablo 3 (at least) - FunctionInfo{700, nullptr, "ActivateUniquePad"}, - FunctionInfo{702, &IHidSystemServer::AcquireUniquePadConnectionEventHandle, "AcquireUniquePadConnectionEventHandle"}, - FunctionInfo{703, &IHidSystemServer::GetUniquePadIds, "GetUniquePadIds"}, - FunctionInfo{711, nullptr, "AcquireUniquePadConnectionOnHandheldForNsEventHandle", MakeVersionGate({20,0,0})}, - FunctionInfo{712, nullptr, "GetUniquePadColor12", MakeVersionGate({20,0,0})}, - FunctionInfo{751, &IHidSystemServer::AcquireJoyDetachOnBluetoothOffEventHandle, "AcquireJoyDetachOnBluetoothOffEventHandle"}, - FunctionInfo{800, nullptr, "ListSixAxisSensorHandles"}, - FunctionInfo{801, nullptr, "IsSixAxisSensorUserCalibrationSupported"}, - FunctionInfo{802, nullptr, "ResetSixAxisSensorCalibrationValues"}, - FunctionInfo{803, nullptr, "StartSixAxisSensorUserCalibration"}, - FunctionInfo{804, nullptr, "CancelSixAxisSensorUserCalibration"}, - FunctionInfo{805, nullptr, "GetUniquePadBluetoothAddress"}, - FunctionInfo{806, nullptr, "DisconnectUniquePad"}, - FunctionInfo{807, nullptr, "GetUniquePadType"}, - FunctionInfo{808, nullptr, "GetUniquePadInterface"}, - FunctionInfo{809, nullptr, "GetUniquePadSerialNumber"}, - FunctionInfo{810, nullptr, "GetUniquePadControllerNumber"}, - FunctionInfo{811, nullptr, "GetSixAxisSensorUserCalibrationStage"}, - FunctionInfo{812, nullptr, "GetConsoleUniqueSixAxisSensorHandle"}, - FunctionInfo{813, nullptr, "GetDeviceType"}, - FunctionInfo{821, nullptr, "StartAnalogStickManualCalibration"}, - FunctionInfo{822, nullptr, "RetryCurrentAnalogStickManualCalibrationStage"}, - FunctionInfo{823, nullptr, "CancelAnalogStickManualCalibration"}, - FunctionInfo{824, nullptr, "ResetAnalogStickManualCalibration"}, - FunctionInfo{825, nullptr, "GetAnalogStickState"}, - FunctionInfo{826, nullptr, "GetAnalogStickManualCalibrationStage"}, - FunctionInfo{827, nullptr, "IsAnalogStickButtonPressed"}, - FunctionInfo{828, nullptr, "IsAnalogStickInReleasePosition"}, - FunctionInfo{829, nullptr, "IsAnalogStickInCircumference"}, - FunctionInfo{830, nullptr, "SetNotificationLedPattern"}, - FunctionInfo{831, nullptr, "SetNotificationLedPatternWithTimeout"}, - FunctionInfo{832, nullptr, "PrepareHidsForNotificationWake"}, - FunctionInfo{850, &IHidSystemServer::IsUsbFullKeyControllerEnabled, "IsUsbFullKeyControllerEnabled"}, - FunctionInfo{851, &IHidSystemServer::EnableUsbFullKeyController, "EnableUsbFullKeyController"}, - FunctionInfo{852, nullptr, "IsUsbConnected"}, - FunctionInfo{870, &IHidSystemServer::IsHandheldButtonPressedOnConsoleMode, "IsHandheldButtonPressedOnConsoleMode"}, - FunctionInfo{900, nullptr, "ActivateInputDetector"}, - FunctionInfo{901, nullptr, "NotifyInputDetector"}, - FunctionInfo{1000, &IHidSystemServer::InitializeFirmwareUpdate, "InitializeFirmwareUpdate"}, - FunctionInfo{1001, nullptr, "GetFirmwareVersion"}, - FunctionInfo{1002, nullptr, "GetAvailableFirmwareVersion"}, - FunctionInfo{1003, nullptr, "IsFirmwareUpdateAvailable"}, - FunctionInfo{1004, &IHidSystemServer::CheckFirmwareUpdateRequired, "CheckFirmwareUpdateRequired"}, - FunctionInfo{1005, nullptr, "StartFirmwareUpdate"}, - FunctionInfo{1006, nullptr, "AbortFirmwareUpdate"}, - FunctionInfo{1007, nullptr, "GetFirmwareUpdateState"}, - FunctionInfo{1008, nullptr, "ActivateAudioControl"}, - FunctionInfo{1009, nullptr, "AcquireAudioControlEventHandle"}, - FunctionInfo{1010, nullptr, "GetAudioControlStates"}, - FunctionInfo{1011, nullptr, "DeactivateAudioControl"}, - FunctionInfo{1012, nullptr, "GetFirmwareVersionStringForUserSupportPage"}, - FunctionInfo{1050, nullptr, "IsSixAxisSensorAccurateUserCalibrationSupported"}, - FunctionInfo{1051, nullptr, "StartSixAxisSensorAccurateUserCalibration"}, - FunctionInfo{1052, nullptr, "CancelSixAxisSensorAccurateUserCalibration"}, - FunctionInfo{1053, nullptr, "GetSixAxisSensorAccurateUserCalibrationState"}, - FunctionInfo{1100, nullptr, "GetHidbusSystemServiceObject"}, - FunctionInfo{1120, &IHidSystemServer::SetFirmwareHotfixUpdateSkipEnabled, "SetFirmwareHotfixUpdateSkipEnabled"}, - FunctionInfo{1130, &IHidSystemServer::InitializeUsbFirmwareUpdate, "InitializeUsbFirmwareUpdate"}, - FunctionInfo{1131, &IHidSystemServer::FinalizeUsbFirmwareUpdate, "FinalizeUsbFirmwareUpdate"}, - FunctionInfo{1132, &IHidSystemServer::CheckUsbFirmwareUpdateRequired, "CheckUsbFirmwareUpdateRequired"}, - FunctionInfo{1133, nullptr, "StartUsbFirmwareUpdate"}, - FunctionInfo{1134, nullptr, "GetUsbFirmwareUpdateState"}, - FunctionInfo{1135, &IHidSystemServer::InitializeUsbFirmwareUpdateWithoutMemory, "InitializeUsbFirmwareUpdateWithoutMemory"}, - FunctionInfo{1150, &IHidSystemServer::SetTouchScreenMagnification, "SetTouchScreenMagnification"}, - FunctionInfo{1151, &IHidSystemServer::GetTouchScreenFirmwareVersion, "GetTouchScreenFirmwareVersion"}, - FunctionInfo{1152, &IHidSystemServer::SetTouchScreenDefaultConfiguration, "SetTouchScreenDefaultConfiguration"}, - FunctionInfo{1153, &IHidSystemServer::GetTouchScreenDefaultConfiguration, "GetTouchScreenDefaultConfiguration"}, - FunctionInfo{1154, nullptr, "IsFirmwareAvailableForNotification"}, - FunctionInfo{1155, &IHidSystemServer::SetForceHandheldStyleVibration, "SetForceHandheldStyleVibration"}, - FunctionInfo{1156, nullptr, "SendConnectionTriggerWithoutTimeoutEvent"}, - FunctionInfo{1157, nullptr, "CancelConnectionTrigger"}, - FunctionInfo{1158, nullptr, "SetConnectionLimitForSplay", MakeVersionGate({20,1,0})}, - FunctionInfo{1159, nullptr, "ClearConnectionLimitForSplay", MakeVersionGate({20,1,0})}, - FunctionInfo{1200, nullptr, "IsButtonConfigSupported"}, - FunctionInfo{1201, nullptr, "IsButtonConfigEmbeddedSupported"}, - FunctionInfo{1202, nullptr, "DeleteButtonConfig"}, - FunctionInfo{1203, nullptr, "DeleteButtonConfigEmbedded"}, - FunctionInfo{1204, nullptr, "SetButtonConfigEnabled"}, - FunctionInfo{1205, nullptr, "SetButtonConfigEmbeddedEnabled"}, - FunctionInfo{1206, nullptr, "IsButtonConfigEnabled"}, - FunctionInfo{1207, nullptr, "IsButtonConfigEmbeddedEnabled"}, - FunctionInfo{1208, nullptr, "SetButtonConfigEmbedded"}, - FunctionInfo{1209, nullptr, "SetButtonConfigFull"}, - FunctionInfo{1210, nullptr, "SetButtonConfigLeft"}, - FunctionInfo{1211, nullptr, "SetButtonConfigRight"}, - FunctionInfo{1212, nullptr, "GetButtonConfigEmbedded"}, - FunctionInfo{1213, nullptr, "GetButtonConfigFull"}, - FunctionInfo{1214, nullptr, "GetButtonConfigLeft"}, - FunctionInfo{1215, nullptr, "GetButtonConfigRight"}, - FunctionInfo{1250, nullptr, "IsCustomButtonConfigSupported"}, - FunctionInfo{1251, nullptr, "IsDefaultButtonConfigEmbedded"}, - FunctionInfo{1252, nullptr, "IsDefaultButtonConfigFull"}, - FunctionInfo{1253, nullptr, "IsDefaultButtonConfigLeft"}, - FunctionInfo{1254, nullptr, "IsDefaultButtonConfigRight"}, - FunctionInfo{1255, nullptr, "IsButtonConfigStorageEmbeddedEmpty"}, - FunctionInfo{1256, nullptr, "IsButtonConfigStorageFullEmpty"}, - FunctionInfo{1257, nullptr, "IsButtonConfigStorageLeftEmpty"}, - FunctionInfo{1258, nullptr, "IsButtonConfigStorageRightEmpty"}, - FunctionInfo{1259, nullptr, "GetButtonConfigStorageEmbeddedDeprecated"}, - FunctionInfo{1260, nullptr, "GetButtonConfigStorageFullDeprecated"}, - FunctionInfo{1261, nullptr, "GetButtonConfigStorageLeftDeprecated"}, - FunctionInfo{1262, nullptr, "GetButtonConfigStorageRightDeprecated"}, - FunctionInfo{1263, nullptr, "SetButtonConfigStorageEmbeddedDeprecated"}, - FunctionInfo{1264, nullptr, "SetButtonConfigStorageFullDeprecated"}, - FunctionInfo{1265, nullptr, "SetButtonConfigStorageLeftDeprecated"}, - FunctionInfo{1266, nullptr, "SetButtonConfigStorageRightDeprecated"}, - FunctionInfo{1267, nullptr, "DeleteButtonConfigStorageEmbedded"}, - FunctionInfo{1268, nullptr, "DeleteButtonConfigStorageFull"}, - FunctionInfo{1269, nullptr, "DeleteButtonConfigStorageLeft"}, - FunctionInfo{1270, nullptr, "DeleteButtonConfigStorageRight"}, - FunctionInfo{1271, &IHidSystemServer::IsUsingCustomButtonConfig, "IsUsingCustomButtonConfig"}, - FunctionInfo{1272, &IHidSystemServer::IsAnyCustomButtonConfigEnabled, "IsAnyCustomButtonConfigEnabled"}, - FunctionInfo{1273, nullptr, "SetAllCustomButtonConfigEnabled"}, - FunctionInfo{1274, nullptr, "SetDefaultButtonConfig"}, - FunctionInfo{1275, nullptr, "SetAllDefaultButtonConfig"}, - FunctionInfo{1276, nullptr, "SetHidButtonConfigEmbedded"}, - FunctionInfo{1277, nullptr, "SetHidButtonConfigFull"}, - FunctionInfo{1278, nullptr, "SetHidButtonConfigLeft"}, - FunctionInfo{1279, nullptr, "SetHidButtonConfigRight"}, - FunctionInfo{1280, nullptr, "GetHidButtonConfigEmbedded"}, - FunctionInfo{1281, nullptr, "GetHidButtonConfigFull"}, - FunctionInfo{1282, nullptr, "GetHidButtonConfigLeft"}, - FunctionInfo{1283, nullptr, "GetHidButtonConfigRight"}, - FunctionInfo{1284, nullptr, "GetButtonConfigStorageEmbedded"}, - FunctionInfo{1285, nullptr, "GetButtonConfigStorageFull"}, - FunctionInfo{1286, nullptr, "GetButtonConfigStorageLeft"}, - FunctionInfo{1287, nullptr, "GetButtonConfigStorageRight"}, - FunctionInfo{1288, nullptr, "SetButtonConfigStorageEmbedded"}, - FunctionInfo{1289, nullptr, "SetButtonConfigStorageFull"}, - FunctionInfo{1290, nullptr, "DeleteButtonConfigStorageRight"}, - FunctionInfo{1291, nullptr, "DeleteButtonConfigStorageRight"}, - FunctionInfo{1308, nullptr, "SetButtonConfigVisible", MakeVersionGate({18,0,0})}, - FunctionInfo{1309, nullptr, "IsButtonConfigVisible", MakeVersionGate({18,0,0})}, - FunctionInfo{1320, nullptr, "WakeTouchScreenUp", MakeVersionGate({17,0,0})}, - FunctionInfo{1321, nullptr, "PutTouchScreenToSleep", MakeVersionGate({17,0,0})}, - FunctionInfo{1322, nullptr, "AcquireTouchScreenAsyncWakeCompletedEvent", MakeVersionGate({20,0,0})}, - FunctionInfo{1323, nullptr, "StartTouchScreenAutoTuneForSystemSettings", MakeVersionGate({21,0,0})}, - FunctionInfo{1324, nullptr, "AcquireTouchScreenAutoTuneCompletedEvent", MakeVersionGate({21,0,0})}, - FunctionInfo{1325, nullptr, "IsTouchScreenAutoTuneRequiredForRepairProviderReplacement", MakeVersionGate({21,0,0})}, - FunctionInfo{1326, nullptr, "SetTouchScreenOffset", MakeVersionGate({21,0,0})}, - FunctionInfo{1420, nullptr, "GetAppletResourceProperty", MakeVersionGate({19,0,0})}, - FunctionInfo{12010, nullptr, "SetButtonConfigLeft", MakeVersionGate({11,0,0}, {17,0,1})} - ); - Kernel::KEvent* acquire_connection_trigger_timeout_event; Kernel::KEvent* acquire_device_registered_event; Kernel::KEvent* joy_detach_event; diff --git a/src/core/hle/service/hid/hidbus.cpp b/src/core/hle/service/hid/hidbus.cpp index 326cfbf74b..70bb5437e3 100644 --- a/src/core/hle/service/hid/hidbus.cpp +++ b/src/core/hle/service/hid/hidbus.cpp @@ -26,28 +26,30 @@ namespace Service::HID { // (15ms, 66Hz) constexpr auto hidbus_update_ns = std::chrono::nanoseconds{15 * 1000 * 1000}; -std::optional Hidbus::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{1, C<&Hidbus::GetBusHandle>, "GetBusHandle"}, - FunctionInfo{2, C<&Hidbus::IsExternalDeviceConnected>, "IsExternalDeviceConnected"}, - FunctionInfo{3, C<&Hidbus::Initialize>, "Initialize"}, - FunctionInfo{4, C<&Hidbus::Finalize>, "Finalize"}, - FunctionInfo{5, C<&Hidbus::EnableExternalDevice>, "EnableExternalDevice"}, - FunctionInfo{6, C<&Hidbus::GetExternalDeviceId>, "GetExternalDeviceId"}, - FunctionInfo{7, C<&Hidbus::SendCommandAsync>, "SendCommandAsync"}, - FunctionInfo{8, C<&Hidbus::GetSendCommandAsynceResult>, "GetSendCommandAsynceResult"}, - FunctionInfo{9, C<&Hidbus::SetEventForSendCommandAsycResult>, "SetEventForSendCommandAsycResult"}, - FunctionInfo{10, C<&Hidbus::GetSharedMemoryHandle>, "GetSharedMemoryHandle"}, - FunctionInfo{11, C<&Hidbus::EnableJoyPollingReceiveMode>, "EnableJoyPollingReceiveMode"}, - FunctionInfo{12, C<&Hidbus::DisableJoyPollingReceiveMode>, "DisableJoyPollingReceiveMode"}, - FunctionInfo{13, nullptr, "GetPollingData"}, - FunctionInfo{14, C<&Hidbus::SetStatusManagerType>, "SetStatusManagerType"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - Hidbus::Hidbus(Core::System& system_) : ServiceFramework{system_, "hidbus"}, service_context{system_, service_name} { + + // clang-format off + static const FunctionInfo functions[] = { + {1, C<&Hidbus::GetBusHandle>, "GetBusHandle"}, + {2, C<&Hidbus::IsExternalDeviceConnected>, "IsExternalDeviceConnected"}, + {3, C<&Hidbus::Initialize>, "Initialize"}, + {4, C<&Hidbus::Finalize>, "Finalize"}, + {5, C<&Hidbus::EnableExternalDevice>, "EnableExternalDevice"}, + {6, C<&Hidbus::GetExternalDeviceId>, "GetExternalDeviceId"}, + {7, C<&Hidbus::SendCommandAsync>, "SendCommandAsync"}, + {8, C<&Hidbus::GetSendCommandAsynceResult>, "GetSendCommandAsynceResult"}, + {9, C<&Hidbus::SetEventForSendCommandAsycResult>, "SetEventForSendCommandAsycResult"}, + {10, C<&Hidbus::GetSharedMemoryHandle>, "GetSharedMemoryHandle"}, + {11, C<&Hidbus::EnableJoyPollingReceiveMode>, "EnableJoyPollingReceiveMode"}, + {12, C<&Hidbus::DisableJoyPollingReceiveMode>, "DisableJoyPollingReceiveMode"}, + {13, nullptr, "GetPollingData"}, + {14, C<&Hidbus::SetStatusManagerType>, "SetStatusManagerType"}, + }; + // clang-format on + + RegisterHandlers(functions); + // Register update callbacks hidbus_update_event = Core::Timing::CreateEvent( "Hidbus::UpdateCallback", diff --git a/src/core/hle/service/hid/hidbus.h b/src/core/hle/service/hid/hidbus.h index 9ad097150e..19dd894ed3 100644 --- a/src/core/hle/service/hid/hidbus.h +++ b/src/core/hle/service/hid/hidbus.h @@ -147,8 +147,6 @@ private: } } - std::optional FindRequest(u32 key) override; - bool is_hidbus_enabled{false}; HidbusStatusManager hidbus_status{}; std::array devices{}; diff --git a/src/core/hle/service/hid/irs.cpp b/src/core/hle/service/hid/irs.cpp index a17395b596..3d87e6788d 100644 --- a/src/core/hle/service/hid/irs.cpp +++ b/src/core/hle/service/hid/irs.cpp @@ -29,32 +29,32 @@ namespace Service::IRS { -std::optional IRS::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{302, C<&IRS::ActivateIrsensor>, "ActivateIrsensor"}, - FunctionInfo{303, C<&IRS::DeactivateIrsensor>, "DeactivateIrsensor"}, - FunctionInfo{304, C<&IRS::GetIrsensorSharedMemoryHandle>, "GetIrsensorSharedMemoryHandle"}, - FunctionInfo{305, C<&IRS::StopImageProcessor>, "StopImageProcessor"}, - FunctionInfo{306, C<&IRS::RunMomentProcessor>, "RunMomentProcessor"}, - FunctionInfo{307, C<&IRS::RunClusteringProcessor>, "RunClusteringProcessor"}, - FunctionInfo{308, C<&IRS::RunImageTransferProcessor>, "RunImageTransferProcessor"}, - FunctionInfo{309, C<&IRS::GetImageTransferProcessorState>, "GetImageTransferProcessorState"}, - FunctionInfo{310, C<&IRS::RunTeraPluginProcessor>, "RunTeraPluginProcessor"}, - FunctionInfo{311, C<&IRS::GetNpadIrCameraHandle>, "GetNpadIrCameraHandle"}, - FunctionInfo{312, C<&IRS::RunPointingProcessor>, "RunPointingProcessor"}, - FunctionInfo{313, C<&IRS::SuspendImageProcessor>, "SuspendImageProcessor"}, - FunctionInfo{314, C<&IRS::CheckFirmwareVersion>, "CheckFirmwareVersion"}, - FunctionInfo{315, C<&IRS::SetFunctionLevel>, "SetFunctionLevel"}, - FunctionInfo{316, C<&IRS::RunImageTransferExProcessor>, "RunImageTransferExProcessor"}, - FunctionInfo{317, C<&IRS::RunIrLedProcessor>, "RunIrLedProcessor"}, - FunctionInfo{318, C<&IRS::StopImageProcessorAsync>, "StopImageProcessorAsync"}, - FunctionInfo{319, C<&IRS::ActivateIrsensorWithFunctionLevel>, "ActivateIrsensorWithFunctionLevel"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IRS::IRS(Core::System& system_) : ServiceFramework{system_, "irs"} { + // clang-format off + static const FunctionInfo functions[] = { + {302, C<&IRS::ActivateIrsensor>, "ActivateIrsensor"}, + {303, C<&IRS::DeactivateIrsensor>, "DeactivateIrsensor"}, + {304, C<&IRS::GetIrsensorSharedMemoryHandle>, "GetIrsensorSharedMemoryHandle"}, + {305, C<&IRS::StopImageProcessor>, "StopImageProcessor"}, + {306, C<&IRS::RunMomentProcessor>, "RunMomentProcessor"}, + {307, C<&IRS::RunClusteringProcessor>, "RunClusteringProcessor"}, + {308, C<&IRS::RunImageTransferProcessor>, "RunImageTransferProcessor"}, + {309, C<&IRS::GetImageTransferProcessorState>, "GetImageTransferProcessorState"}, + {310, C<&IRS::RunTeraPluginProcessor>, "RunTeraPluginProcessor"}, + {311, C<&IRS::GetNpadIrCameraHandle>, "GetNpadIrCameraHandle"}, + {312, C<&IRS::RunPointingProcessor>, "RunPointingProcessor"}, + {313, C<&IRS::SuspendImageProcessor>, "SuspendImageProcessor"}, + {314, C<&IRS::CheckFirmwareVersion>, "CheckFirmwareVersion"}, + {315, C<&IRS::SetFunctionLevel>, "SetFunctionLevel"}, + {316, C<&IRS::RunImageTransferExProcessor>, "RunImageTransferExProcessor"}, + {317, C<&IRS::RunIrLedProcessor>, "RunIrLedProcessor"}, + {318, C<&IRS::StopImageProcessorAsync>, "StopImageProcessorAsync"}, + {319, C<&IRS::ActivateIrsensorWithFunctionLevel>, "ActivateIrsensorWithFunctionLevel"}, + }; + // clang-format on + u8* raw_shared_memory = system.Kernel().GetIrsSharedMem().GetPointer(); + RegisterHandlers(functions); shared_memory = std::construct_at(reinterpret_cast(raw_shared_memory)); npad_device = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1); @@ -369,6 +369,16 @@ Core::IrSensor::DeviceFormat& IRS::GetIrCameraSharedMemoryDeviceEntry( } IRS_SYS::IRS_SYS(Core::System& system_) : ServiceFramework{system_, "irs:sys"} { + // clang-format off + static const FunctionInfo functions[] = { + {500, nullptr, "SetAppletResourceUserId"}, + {501, nullptr, "RegisterAppletResourceUserId"}, + {502, nullptr, "UnregisterAppletResourceUserId"}, + {503, nullptr, "EnableAppletToGetInput"}, + }; + // clang-format on + + RegisterHandlers(functions); } IRS_SYS::~IRS_SYS() = default; diff --git a/src/core/hle/service/hid/irs.h b/src/core/hle/service/hid/irs.h index be81ea75a9..2ca34b9106 100644 --- a/src/core/hle/service/hid/irs.h +++ b/src/core/hle/service/hid/irs.h @@ -157,8 +157,6 @@ private: return static_cast(*processors[index]); } - std::optional FindRequest(u32 key) override; - Core::HID::EmulatedController* npad_device = nullptr; StatusManager* shared_memory = nullptr; std::array, 9> processors{}; @@ -168,16 +166,6 @@ class IRS_SYS final : public ServiceFramework { public: explicit IRS_SYS(Core::System& system); ~IRS_SYS() override; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{500, nullptr, "SetAppletResourceUserId"}, - FunctionInfo{501, nullptr, "RegisterAppletResourceUserId"}, - FunctionInfo{502, nullptr, "UnregisterAppletResourceUserId"}, - FunctionInfo{503, nullptr, "EnableAppletToGetInput"} - ); }; } // namespace Service::IRS diff --git a/src/core/hle/service/hid/xcd.cpp b/src/core/hle/service/hid/xcd.cpp index 6b8ae7048c..2e41cbd3da 100644 --- a/src/core/hle/service/hid/xcd.cpp +++ b/src/core/hle/service/hid/xcd.cpp @@ -9,6 +9,33 @@ namespace Service::HID { XCD_SYS::XCD_SYS(Core::System& system_) : ServiceFramework{system_, "xcd:sys"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetDataFormat"}, + {1, nullptr, "SetDataFormat"}, + {2, nullptr, "GetMcuState"}, + {3, nullptr, "SetMcuState"}, + {4, nullptr, "GetMcuVersionForNfc"}, + {5, nullptr, "CheckNfcDevicePower"}, + {10, nullptr, "SetNfcEvent"}, + {11, nullptr, "GetNfcInfo"}, + {12, nullptr, "StartNfcDiscovery"}, + {13, nullptr, "StopNfcDiscovery"}, + {14, nullptr, "StartNtagRead"}, + {15, nullptr, "StartNtagWrite"}, + {16, nullptr, "SendNfcRawData"}, + {17, nullptr, "RegisterMifareKey"}, + {18, nullptr, "ClearMifareKey"}, + {19, nullptr, "StartMifareRead"}, + {20, nullptr, "StartMifareWrite"}, + {101, nullptr, "GetAwakeTriggerReasonForLeftRail"}, + {102, nullptr, "GetAwakeTriggerReasonForRightRail"}, + {103, nullptr, "GetAwakeTriggerBatteryLevelTransitionForLeftRail"}, + {104, nullptr, "GetAwakeTriggerBatteryLevelTransitionForRightRail"}, + }; + // clang-format on + + RegisterHandlers(functions); } XCD_SYS::~XCD_SYS() = default; diff --git a/src/core/hle/service/hid/xcd.h b/src/core/hle/service/hid/xcd.h index af1dd88ef7..9000110a9a 100644 --- a/src/core/hle/service/hid/xcd.h +++ b/src/core/hle/service/hid/xcd.h @@ -18,33 +18,6 @@ class XCD_SYS final : public ServiceFramework { public: explicit XCD_SYS(Core::System& system_); ~XCD_SYS() override; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetDataFormat"}, - FunctionInfo{1, nullptr, "SetDataFormat"}, - FunctionInfo{2, nullptr, "GetMcuState"}, - FunctionInfo{3, nullptr, "SetMcuState"}, - FunctionInfo{4, nullptr, "GetMcuVersionForNfc"}, - FunctionInfo{5, nullptr, "CheckNfcDevicePower"}, - FunctionInfo{10, nullptr, "SetNfcEvent"}, - FunctionInfo{11, nullptr, "GetNfcInfo"}, - FunctionInfo{12, nullptr, "StartNfcDiscovery"}, - FunctionInfo{13, nullptr, "StopNfcDiscovery"}, - FunctionInfo{14, nullptr, "StartNtagRead"}, - FunctionInfo{15, nullptr, "StartNtagWrite"}, - FunctionInfo{16, nullptr, "SendNfcRawData"}, - FunctionInfo{17, nullptr, "RegisterMifareKey"}, - FunctionInfo{18, nullptr, "ClearMifareKey"}, - FunctionInfo{19, nullptr, "StartMifareRead"}, - FunctionInfo{20, nullptr, "StartMifareWrite"}, - FunctionInfo{101, nullptr, "GetAwakeTriggerReasonForLeftRail"}, - FunctionInfo{102, nullptr, "GetAwakeTriggerReasonForRightRail"}, - FunctionInfo{103, nullptr, "GetAwakeTriggerBatteryLevelTransitionForLeftRail"}, - FunctionInfo{104, nullptr, "GetAwakeTriggerBatteryLevelTransitionForRightRail"} - ); }; } // namespace Service::HID diff --git a/src/core/hle/service/i2c/i2c.cpp b/src/core/hle/service/i2c/i2c.cpp index d0a5e29f8c..0b242768c2 100644 --- a/src/core/hle/service/i2c/i2c.cpp +++ b/src/core/hle/service/i2c/i2c.cpp @@ -17,26 +17,25 @@ namespace Service::I2C { class I2CSession final : public ServiceFramework { public: - explicit I2CSession(Core::System& system_) : ServiceFramework{system_, "I2CSession"} {} + explicit I2CSession(Core::System& system_) + : ServiceFramework{system_, "I2CSession"} + { + static const FunctionInfo functions[] = { + {0, nullptr, "SendOld"}, + {1, nullptr, "ReceiveOld"}, + {2, nullptr, "ExecuteCommandListOld"}, + {10, C<&I2CSession::Send>, "Send"}, + {11, nullptr, "Receive"}, + {12, nullptr, "ExecuteCommandList"}, + {13, nullptr, "SetRetryPolicy"}, + }; + RegisterHandlers(functions); + } ~I2CSession() override = default; - Result Send(InBuffer in_data, u32 transaction_option) { LOG_WARNING(Service, "(stubbed) topt={}", transaction_option); R_THROW(ResultUnknown); } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "SendOld"}, - FunctionInfo{1, nullptr, "ReceiveOld"}, - FunctionInfo{2, nullptr, "ExecuteCommandListOld"}, - FunctionInfo{10, C<&I2CSession::Send>, "Send"}, - FunctionInfo{11, nullptr, "Receive"}, - FunctionInfo{12, nullptr, "ExecuteCommandList"}, - FunctionInfo{13, nullptr, "SetRetryPolicy"} - ); }; enum class I2CDevice : u32 { @@ -46,9 +45,19 @@ enum class I2CDevice : u32 { class I2C final : public ServiceFramework { public: - explicit I2C(Core::System& system_) : ServiceFramework{system_, "i2c"} {} + explicit I2C(Core::System& system_) + : ServiceFramework{system_, "i2c"} + { + static const FunctionInfo functions[] = { + {0, C<&I2C::OpenSessionForDev>, "OpenSessionForDev"}, + {1, C<&I2C::OpenSession>, "OpenSession"}, + {2, C<&I2C::HasDevice>, "HasDevice"}, + {3, C<&I2C::HasDeviceForDev>, "HasDeviceForDev"}, + {4, C<&I2C::OpenSession2>, "OpenSession2"}, + }; + RegisterHandlers(functions); + } ~I2C() override = default; - Result OpenSessionForDev(OutInterface out_session, s32 bus_idx, u32 slave_address, u32 addressing_mode, u32 speed_mode) { LOG_DEBUG(Service, "(stubbed)"); *out_session = std::make_shared(system); @@ -74,17 +83,6 @@ public: *out_session = std::make_shared(system); R_SUCCEED(); } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&I2C::OpenSessionForDev>, "OpenSessionForDev"}, - FunctionInfo{1, C<&I2C::OpenSession>, "OpenSession"}, - FunctionInfo{2, C<&I2C::HasDevice>, "HasDevice"}, - FunctionInfo{3, C<&I2C::HasDeviceForDev>, "HasDeviceForDev"}, - FunctionInfo{4, C<&I2C::OpenSession2>, "OpenSession2"} - ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/jit/jit.cpp b/src/core/hle/service/jit/jit.cpp index 9059aaf518..ec3a3a8dcb 100644 --- a/src/core/hle/service/jit/jit.cpp +++ b/src/core/hle/service/jit/jit.cpp @@ -37,6 +37,18 @@ public: , user_ro{std::move(user_ro_)} , context{process_->GetMemory()} { + + // clang-format off + static const FunctionInfo functions[] = { + {0, C<&IJitEnvironment::GenerateCode>, "GenerateCode"}, + {1, C<&IJitEnvironment::Control>, "Control"}, + {1000, C<&IJitEnvironment::LoadPlugin>, "LoadPlugin"}, + {1001, C<&IJitEnvironment::GetCodeAddress>, "GetCodeAddress"}, + }; + // clang-format on + + RegisterHandlers(functions); + // Identity map user code range into sysmodule context configuration.user_rx_memory.size = user_rx.GetSize(); configuration.user_rx_memory.offset = user_rx.GetAddress(); @@ -47,10 +59,6 @@ public: configuration.sys_ro_memory = configuration.user_ro_memory; } - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - ~IJitEnvironment() { user_rx.Finalize(system.Kernel()); user_ro.Finalize(system.Kernel()); @@ -240,13 +248,6 @@ private: return in; } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&IJitEnvironment::GenerateCode>, "GenerateCode"}, - FunctionInfo{1, C<&IJitEnvironment::Control>, "Control"}, - FunctionInfo{1000, C<&IJitEnvironment::LoadPlugin>, "LoadPlugin"}, - FunctionInfo{1001, C<&IJitEnvironment::GetCodeAddress>, "GetCodeAddress"} - ); - Kernel::KScopedAutoObject process; CodeMemory user_rx; CodeMemory user_ro; @@ -257,10 +258,14 @@ private: class JITU final : public ServiceFramework { public: - explicit JITU(Core::System& system_) : ServiceFramework{system_, "jit:u"} {} + explicit JITU(Core::System& system_) : ServiceFramework{system_, "jit:u"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, C<&JITU::CreateJitEnvironment>, "CreateJitEnvironment"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -289,10 +294,6 @@ private: } private: - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&JITU::CreateJitEnvironment>, "CreateJitEnvironment"} - ); - std::mt19937_64 generate_random{}; }; diff --git a/src/core/hle/service/jit/jit.h b/src/core/hle/service/jit/jit.h index 19014c75a4..a9ebf146ec 100644 --- a/src/core/hle/service/jit/jit.h +++ b/src/core/hle/service/jit/jit.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/jit/jit_context.h b/src/core/hle/service/jit/jit_context.h index f17fc5e244..aa9a2d3589 100644 --- a/src/core/hle/service/jit/jit_context.h +++ b/src/core/hle/service/jit/jit_context.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/lbl/lbl.cpp b/src/core/hle/service/lbl/lbl.cpp index 9b245201ff..68a9bff2df 100644 --- a/src/core/hle/service/lbl/lbl.cpp +++ b/src/core/hle/service/lbl/lbl.cpp @@ -18,10 +18,43 @@ namespace Service::LBL { class LBL final : public ServiceFramework { public: - explicit LBL(Core::System& system_) : ServiceFramework{system_, "lbl"} {} + explicit LBL(Core::System& system_) : ServiceFramework{system_, "lbl"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &LBL::SaveCurrentSetting, "SaveCurrentSetting"}, + {1, &LBL::LoadCurrentSetting, "LoadCurrentSetting"}, + {2, &LBL::SetCurrentBrightnessSetting, "SetCurrentBrightnessSetting"}, + {3, &LBL::GetCurrentBrightnessSetting, "GetCurrentBrightnessSetting"}, + {4, nullptr, "ApplyCurrentBrightnessSettingToBacklight"}, + {5, nullptr, "GetBrightnessSettingAppliedToBacklight"}, + {6, &LBL::SwitchBacklightOn, "SwitchBacklightOn"}, + {7, &LBL::SwitchBacklightOff, "SwitchBacklightOff"}, + {8, &LBL::GetBacklightSwitchStatus, "GetBacklightSwitchStatus"}, + {9, &LBL::EnableDimming, "EnableDimming"}, + {10, &LBL::DisableDimming, "DisableDimming"}, + {11, &LBL::IsDimmingEnabled, "IsDimmingEnabled"}, + {12, &LBL::EnableAutoBrightnessControl, "EnableAutoBrightnessControl"}, + {13, &LBL::DisableAutoBrightnessControl, "DisableAutoBrightnessControl"}, + {14, &LBL::IsAutoBrightnessControlEnabled, "IsAutoBrightnessControlEnabled"}, + {15, &LBL::SetAmbientLightSensorValue, "SetAmbientLightSensorValue"}, + {16, &LBL::GetAmbientLightSensorValue, "GetAmbientLightSensorValue"}, + {17, &LBL::SetBrightnessReflectionDelayLevel, "SetBrightnessReflectionDelayLevel"}, + {18, &LBL::GetBrightnessReflectionDelayLevel, "GetBrightnessReflectionDelayLevel"}, + {19, &LBL::SetCurrentBrightnessMapping, "SetCurrentBrightnessMapping"}, + {20, &LBL::GetCurrentBrightnessMapping, "GetCurrentBrightnessMapping"}, + {21, &LBL::SetCurrentAmbientLightSensorMapping, "SetCurrentAmbientLightSensorMapping"}, + {22, &LBL::GetCurrentAmbientLightSensorMapping, "GetCurrentAmbientLightSensorMapping"}, + {23, &LBL::IsAmbientLightSensorAvailable, "IsAmbientLightSensorAvailable"}, + {24, &LBL::SetCurrentBrightnessSettingForVrMode, "SetCurrentBrightnessSettingForVrMode"}, + {25, &LBL::GetCurrentBrightnessSettingForVrMode, "GetCurrentBrightnessSettingForVrMode"}, + {26, &LBL::EnableVrMode, "EnableVrMode"}, + {27, &LBL::DisableVrMode, "DisableVrMode"}, + {28, &LBL::IsVrModeEnabled, "IsVrModeEnabled"}, + {29, &LBL::IsAutoBrightnessControlSupported, "IsAutoBrightnessControlSupported"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -302,38 +335,6 @@ private: rb.Push(auto_brightness_supported); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &LBL::SaveCurrentSetting, "SaveCurrentSetting"}, - FunctionInfo{1, &LBL::LoadCurrentSetting, "LoadCurrentSetting"}, - FunctionInfo{2, &LBL::SetCurrentBrightnessSetting, "SetCurrentBrightnessSetting"}, - FunctionInfo{3, &LBL::GetCurrentBrightnessSetting, "GetCurrentBrightnessSetting"}, - FunctionInfo{4, nullptr, "ApplyCurrentBrightnessSettingToBacklight"}, - FunctionInfo{5, nullptr, "GetBrightnessSettingAppliedToBacklight"}, - FunctionInfo{6, &LBL::SwitchBacklightOn, "SwitchBacklightOn"}, - FunctionInfo{7, &LBL::SwitchBacklightOff, "SwitchBacklightOff"}, - FunctionInfo{8, &LBL::GetBacklightSwitchStatus, "GetBacklightSwitchStatus"}, - FunctionInfo{9, &LBL::EnableDimming, "EnableDimming"}, - FunctionInfo{10, &LBL::DisableDimming, "DisableDimming"}, - FunctionInfo{11, &LBL::IsDimmingEnabled, "IsDimmingEnabled"}, - FunctionInfo{12, &LBL::EnableAutoBrightnessControl, "EnableAutoBrightnessControl"}, - FunctionInfo{13, &LBL::DisableAutoBrightnessControl, "DisableAutoBrightnessControl"}, - FunctionInfo{14, &LBL::IsAutoBrightnessControlEnabled, "IsAutoBrightnessControlEnabled"}, - FunctionInfo{15, &LBL::SetAmbientLightSensorValue, "SetAmbientLightSensorValue"}, - FunctionInfo{16, &LBL::GetAmbientLightSensorValue, "GetAmbientLightSensorValue"}, - FunctionInfo{17, &LBL::SetBrightnessReflectionDelayLevel, "SetBrightnessReflectionDelayLevel"}, - FunctionInfo{18, &LBL::GetBrightnessReflectionDelayLevel, "GetBrightnessReflectionDelayLevel"}, - FunctionInfo{19, &LBL::SetCurrentBrightnessMapping, "SetCurrentBrightnessMapping"}, - FunctionInfo{20, &LBL::GetCurrentBrightnessMapping, "GetCurrentBrightnessMapping"}, - FunctionInfo{21, &LBL::SetCurrentAmbientLightSensorMapping, "SetCurrentAmbientLightSensorMapping"}, - FunctionInfo{22, &LBL::GetCurrentAmbientLightSensorMapping, "GetCurrentAmbientLightSensorMapping"}, - FunctionInfo{23, &LBL::IsAmbientLightSensorAvailable, "IsAmbientLightSensorAvailable"}, - FunctionInfo{24, &LBL::SetCurrentBrightnessSettingForVrMode, "SetCurrentBrightnessSettingForVrMode"}, - FunctionInfo{25, &LBL::GetCurrentBrightnessSettingForVrMode, "GetCurrentBrightnessSettingForVrMode"}, - FunctionInfo{26, &LBL::EnableVrMode, "EnableVrMode"}, - FunctionInfo{27, &LBL::DisableVrMode, "DisableVrMode"}, - FunctionInfo{28, &LBL::IsVrModeEnabled, "IsVrModeEnabled"}, - FunctionInfo{29, &LBL::IsAutoBrightnessControlSupported, "IsAutoBrightnessControlSupported"} - ); bool vr_mode_enabled = false; float current_brightness = 1.0f; float ambient_light_value = 0.0f; diff --git a/src/core/hle/service/lbl/lbl.h b/src/core/hle/service/lbl/lbl.h index e47759c01c..e2cd1b3980 100644 --- a/src/core/hle/service/lbl/lbl.h +++ b/src/core/hle/service/lbl/lbl.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/ldn/lan_discovery.cpp b/src/core/hle/service/ldn/lan_discovery.cpp index f37dbe492f..90adcdcee4 100644 --- a/src/core/hle/service/ldn/lan_discovery.cpp +++ b/src/core/hle/service/ldn/lan_discovery.cpp @@ -1,5 +1,6 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/ldn/lan_discovery.h b/src/core/hle/service/ldn/lan_discovery.h index 5d0642bd0f..f1f3c4bece 100644 --- a/src/core/hle/service/ldn/lan_discovery.h +++ b/src/core/hle/service/ldn/lan_discovery.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/ldn/ldn.cpp b/src/core/hle/service/ldn/ldn.cpp index 838fe85f79..1a0165fd2e 100644 --- a/src/core/hle/service/ldn/ldn.cpp +++ b/src/core/hle/service/ldn/ldn.cpp @@ -9,6 +9,7 @@ #include "core/hle/service/ldn/ldn.h" #include "core/hle/service/ldn/monitor_service.h" #include "core/hle/service/ldn/sf_monitor_service.h" +#include "core/hle/service/ldn/sf_service.h" #include "core/hle/service/ldn/sf_service_monitor.h" #include "core/hle/service/ldn/system_local_communication_service.h" #include "core/hle/service/ldn/user_local_communication_service.h" @@ -18,10 +19,14 @@ namespace Service::LDN { class IClientProcessMonitor final : public ServiceFramework { public: - explicit IClientProcessMonitor(Core::System& system_) : ServiceFramework{system_, "IClientProcessMonitor"} {} - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit IClientProcessMonitor(Core::System& system_) + : ServiceFramework{system_, "IClientProcessMonitor"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IClientProcessMonitor::RegisterClient>, "RegisterClient"}, + }; + // clang-format on + RegisterHandlers(functions); } ~IClientProcessMonitor() override = default; private: @@ -29,19 +34,19 @@ private: LOG_WARNING(Service_LDN, "(STUBBED) called"); R_SUCCEED(); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IClientProcessMonitor::RegisterClient>, "RegisterClient"} - ); }; class IMonitorServiceCreator final : public ServiceFramework { public: - explicit IMonitorServiceCreator(Core::System& system_) : ServiceFramework{system_, "ldn:m"} {} - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit IMonitorServiceCreator(Core::System& system_) : ServiceFramework{system_, "ldn:m"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, C<&IMonitorServiceCreator::CreateMonitorService>, "CreateMonitorService"} + }; + // clang-format on + RegisterHandlers(functions); } + private: Result CreateMonitorService(OutInterface out_interface) { LOG_DEBUG(Service_LDN, "called"); @@ -49,19 +54,21 @@ private: *out_interface = std::make_shared(system); R_SUCCEED(); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&IMonitorServiceCreator::CreateMonitorService>, "CreateMonitorService"} - ); }; class ISystemServiceCreator final : public ServiceFramework { public: - explicit ISystemServiceCreator(Core::System& system_) : ServiceFramework{system_, "ldn:s"} {} + explicit ISystemServiceCreator(Core::System& system_) : ServiceFramework{system_, "ldn:s"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, C<&ISystemServiceCreator::CreateSystemLocalCommunicationService>, "CreateSystemLocalCommunicationService"}, + {1, C<&ISystemServiceCreator::CreateClientProcessMonitor>, "CreateClientProcessMonitor"} // 18.0.0+ + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } + private: Result CreateSystemLocalCommunicationService( OutInterface out_interface) { @@ -78,20 +85,21 @@ private: *out_interface = std::make_shared(system); R_SUCCEED(); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&ISystemServiceCreator::CreateSystemLocalCommunicationService>, "CreateSystemLocalCommunicationService"}, - FunctionInfo{1, C<&ISystemServiceCreator::CreateClientProcessMonitor>, "CreateClientProcessMonitor", MakeVersionGate({18,0,0})} - ); }; class IUserServiceCreator final : public ServiceFramework { public: - explicit IUserServiceCreator(Core::System& system_) : ServiceFramework{system_, "ldn:u"} {} + explicit IUserServiceCreator(Core::System& system_) : ServiceFramework{system_, "ldn:u"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IUserServiceCreator::CreateUserLocalCommunicationService>, "CreateUserLocalCommunicationService"}, + {1, D<&IUserServiceCreator::CreateClientProcessMonitor>, "CreateClientProcessMonitor"} // 18.0.0+ + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } + private: Result CreateUserLocalCommunicationService( OutInterface out_interface) { @@ -108,50 +116,22 @@ private: *out_interface = std::make_shared(system); R_SUCCEED(); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IUserServiceCreator::CreateUserLocalCommunicationService>, "CreateUserLocalCommunicationService"}, - FunctionInfo{1, D<&IUserServiceCreator::CreateClientProcessMonitor>, "CreateClientProcessMonitor", MakeVersionGate({18,0,0})} - ); -}; - -class ISfService final : public ServiceFramework { -public: - explicit ISfService(Core::System& system_) : ServiceFramework{system_, "ISfService"} {} - ~ISfService() override = default; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "Initialize"}, - FunctionInfo{256, nullptr, "AttachNetworkInterfaceStateChangeEvent"}, - FunctionInfo{264, nullptr, "GetNetworkInterfaceLastError"}, - FunctionInfo{272, nullptr, "GetRole"}, - FunctionInfo{280, nullptr, "GetAdvertiseData"}, - FunctionInfo{288, nullptr, "GetGroupInfo"}, - FunctionInfo{296, nullptr, "GetGroupInfo2"}, - FunctionInfo{304, nullptr, "GetGroupOwner"}, - FunctionInfo{312, nullptr, "GetIpConfig"}, - FunctionInfo{320, nullptr, "GetLinkLevel"}, - FunctionInfo{512, nullptr, "Scan"}, - FunctionInfo{768, nullptr, "CreateGroup"}, - FunctionInfo{776, nullptr, "DestroyGroup"}, - FunctionInfo{784, nullptr, "SetAdvertiseData"}, - FunctionInfo{1536, nullptr, "SendToOtherGroup"}, - FunctionInfo{1544, nullptr, "RecvFromOtherGroup"}, - FunctionInfo{1552, nullptr, "AddAcceptableGroupId"}, - FunctionInfo{1560, nullptr, "ClearAcceptableGroupId"} - ); }; class ISfServiceCreator final : public ServiceFramework { public: - explicit ISfServiceCreator(Core::System& system_, bool is_system_, const char* name_) : ServiceFramework{system_, name_}, is_system{is_system_} {} + explicit ISfServiceCreator(Core::System& system_, bool is_system_, const char* name_) + : ServiceFramework{system_, name_}, is_system{is_system_} { + // clang-format off + static const FunctionInfo functions[] = { + {0, C<&ISfServiceCreator::CreateNetworkService>, "CreateNetworkService"}, + {8, C<&ISfServiceCreator::CreateNetworkServiceMonitor>, "CreateNetworkServiceMonitor"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } + private: Result CreateNetworkService(OutInterface out_interface, u32 input, u64 reserved_input) { @@ -170,20 +150,21 @@ private: R_SUCCEED(); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&ISfServiceCreator::CreateNetworkService>, "CreateNetworkService"}, - FunctionInfo{8, C<&ISfServiceCreator::CreateNetworkServiceMonitor>, "CreateNetworkServiceMonitor"} - ); bool is_system{}; }; class ISfMonitorServiceCreator final : public ServiceFramework { public: - explicit ISfMonitorServiceCreator(Core::System& system_) : ServiceFramework{system_, "lp2p:m"} {} + explicit ISfMonitorServiceCreator(Core::System& system_) : ServiceFramework{system_, "lp2p:m"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, C<&ISfMonitorServiceCreator::CreateMonitorService>, "CreateMonitorService"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } + private: Result CreateMonitorService(OutInterface out_interface, u64 reserved_input) { LOG_INFO(Service_LDN, "called, reserved_input={}", reserved_input); @@ -191,10 +172,6 @@ private: *out_interface = std::make_shared(system); R_SUCCEED(); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&ISfMonitorServiceCreator::CreateMonitorService>, "CreateMonitorService"} - ); }; void LoopProcess(Core::System& system) { @@ -204,9 +181,12 @@ void LoopProcess(Core::System& system) { server_manager->RegisterNamedService("ldn:s", std::make_shared(system)); server_manager->RegisterNamedService("ldn:u", std::make_shared(system)); - server_manager->RegisterNamedService("lp2p:app", std::make_shared(system, false, "lp2p:app")); - server_manager->RegisterNamedService("lp2p:sys", std::make_shared(system, true, "lp2p:sys")); - server_manager->RegisterNamedService("lp2p:m", std::make_shared(system)); + server_manager->RegisterNamedService( + "lp2p:app", std::make_shared(system, false, "lp2p:app")); + server_manager->RegisterNamedService( + "lp2p:sys", std::make_shared(system, true, "lp2p:sys")); + server_manager->RegisterNamedService("lp2p:m", + std::make_shared(system)); ServerManager::RunServer(std::move(server_manager)); } diff --git a/src/core/hle/service/ldn/ldn.h b/src/core/hle/service/ldn/ldn.h index dae037fa8f..76c7f4f439 100644 --- a/src/core/hle/service/ldn/ldn.h +++ b/src/core/hle/service/ldn/ldn.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/ldn/ldn_results.h b/src/core/hle/service/ldn/ldn_results.h index f340bda422..cf6c22b54b 100644 --- a/src/core/hle/service/ldn/ldn_results.h +++ b/src/core/hle/service/ldn/ldn_results.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/core/hle/service/ldn/monitor_service.cpp b/src/core/hle/service/ldn/monitor_service.cpp index 6a60b0b3d8..6cb7180b15 100644 --- a/src/core/hle/service/ldn/monitor_service.cpp +++ b/src/core/hle/service/ldn/monitor_service.cpp @@ -10,22 +10,22 @@ namespace Service::LDN { -std::optional IMonitorService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&IMonitorService::GetStateForMonitor>, "GetStateForMonitor"}, - FunctionInfo{1, nullptr, "GetNetworkInfoForMonitor"}, - FunctionInfo{2, nullptr, "GetIpv4AddressForMonitor"}, - FunctionInfo{3, nullptr, "GetDisconnectReasonForMonitor"}, - FunctionInfo{4, nullptr, "GetSecurityParameterForMonitor"}, - FunctionInfo{5, nullptr, "GetNetworkConfigForMonitor"}, - FunctionInfo{100, C<&IMonitorService::InitializeMonitor>, "InitializeMonitor"}, - FunctionInfo{101, C<&IMonitorService::FinalizeMonitor>, "FinalizeMonitor"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IMonitorService::IMonitorService(Core::System& system_) : ServiceFramework{system_, "IMonitorService"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, C<&IMonitorService::GetStateForMonitor>, "GetStateForMonitor"}, + {1, nullptr, "GetNetworkInfoForMonitor"}, + {2, nullptr, "GetIpv4AddressForMonitor"}, + {3, nullptr, "GetDisconnectReasonForMonitor"}, + {4, nullptr, "GetSecurityParameterForMonitor"}, + {5, nullptr, "GetNetworkConfigForMonitor"}, + {100, C<&IMonitorService::InitializeMonitor>, "InitializeMonitor"}, + {101, C<&IMonitorService::FinalizeMonitor>, "FinalizeMonitor"}, + }; + // clang-format on + + RegisterHandlers(functions); } IMonitorService::~IMonitorService() = default; diff --git a/src/core/hle/service/ldn/monitor_service.h b/src/core/hle/service/ldn/monitor_service.h index 9c1acd0a1e..2d4a69c311 100644 --- a/src/core/hle/service/ldn/monitor_service.h +++ b/src/core/hle/service/ldn/monitor_service.h @@ -26,7 +26,6 @@ private: Result InitializeMonitor(); Result FinalizeMonitor(); - std::optional FindRequest(u32 key) override; State state{State::None}; }; diff --git a/src/core/hle/service/ldn/sf_monitor_service.cpp b/src/core/hle/service/ldn/sf_monitor_service.cpp index ebe06b2059..5ac663b4c2 100644 --- a/src/core/hle/service/ldn/sf_monitor_service.cpp +++ b/src/core/hle/service/ldn/sf_monitor_service.cpp @@ -10,17 +10,17 @@ namespace Service::LDN { -std::optional ISfMonitorService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&ISfMonitorService::Initialize>, "Initialize"}, - FunctionInfo{288, C<&ISfMonitorService::GetGroupInfo>, "GetGroupInfo"}, - FunctionInfo{320, nullptr, "GetLinkLevel"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - ISfMonitorService::ISfMonitorService(Core::System& system_) : ServiceFramework{system_, "ISfMonitorService"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, C<&ISfMonitorService::Initialize>, "Initialize"}, + {288, C<&ISfMonitorService::GetGroupInfo>, "GetGroupInfo"}, + {320, nullptr, "GetLinkLevel"}, + }; + // clang-format on + + RegisterHandlers(functions); } ISfMonitorService::~ISfMonitorService() = default; diff --git a/src/core/hle/service/ldn/sf_monitor_service.h b/src/core/hle/service/ldn/sf_monitor_service.h index 09ca16727d..a596093f1b 100644 --- a/src/core/hle/service/ldn/sf_monitor_service.h +++ b/src/core/hle/service/ldn/sf_monitor_service.h @@ -24,7 +24,6 @@ public: private: Result Initialize(Out out_value); Result GetGroupInfo(OutLargeData out_group_info); - std::optional FindRequest(u32 key) override; }; } // namespace Service::LDN diff --git a/src/core/hle/service/ldn/sf_service.cpp b/src/core/hle/service/ldn/sf_service.cpp new file mode 100644 index 0000000000..b77672a1b6 --- /dev/null +++ b/src/core/hle/service/ldn/sf_service.cpp @@ -0,0 +1,40 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "core/hle/service/ldn/sf_service.h" + +namespace Service::LDN { + +ISfService::ISfService(Core::System& system_) : ServiceFramework{system_, "ISfService"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "Initialize"}, + {256, nullptr, "AttachNetworkInterfaceStateChangeEvent"}, + {264, nullptr, "GetNetworkInterfaceLastError"}, + {272, nullptr, "GetRole"}, + {280, nullptr, "GetAdvertiseData"}, + {288, nullptr, "GetGroupInfo"}, + {296, nullptr, "GetGroupInfo2"}, + {304, nullptr, "GetGroupOwner"}, + {312, nullptr, "GetIpConfig"}, + {320, nullptr, "GetLinkLevel"}, + {512, nullptr, "Scan"}, + {768, nullptr, "CreateGroup"}, + {776, nullptr, "DestroyGroup"}, + {784, nullptr, "SetAdvertiseData"}, + {1536, nullptr, "SendToOtherGroup"}, + {1544, nullptr, "RecvFromOtherGroup"}, + {1552, nullptr, "AddAcceptableGroupId"}, + {1560, nullptr, "ClearAcceptableGroupId"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +ISfService::~ISfService() = default; + +} // namespace Service::LDN diff --git a/src/core/hle/service/ldn/sf_service.h b/src/core/hle/service/ldn/sf_service.h new file mode 100644 index 0000000000..ca7a81cf29 --- /dev/null +++ b/src/core/hle/service/ldn/sf_service.h @@ -0,0 +1,24 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/service.h" + +namespace Core { +class System; +} + +namespace Service::LDN { + +class ISfService final : public ServiceFramework { +public: + explicit ISfService(Core::System& system_); + ~ISfService() override; +}; + +} // namespace Service::LDN diff --git a/src/core/hle/service/ldn/sf_service_monitor.cpp b/src/core/hle/service/ldn/sf_service_monitor.cpp index 574ba82a0b..95a9bcaf71 100644 --- a/src/core/hle/service/ldn/sf_service_monitor.cpp +++ b/src/core/hle/service/ldn/sf_service_monitor.cpp @@ -10,27 +10,27 @@ namespace Service::LDN { -std::optional ISfServiceMonitor::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&ISfServiceMonitor::Initialize>, "Initialize"}, - FunctionInfo{256, nullptr, "AttachNetworkInterfaceStateChangeEvent"}, - FunctionInfo{264, nullptr, "GetNetworkInterfaceLastError"}, - FunctionInfo{272, nullptr, "GetRole"}, - FunctionInfo{280, nullptr, "GetAdvertiseData"}, - FunctionInfo{281, nullptr, "GetAdvertiseData2"}, - FunctionInfo{288, C<&ISfServiceMonitor::GetGroupInfo>, "GetGroupInfo"}, - FunctionInfo{296, nullptr, "GetGroupInfo2"}, - FunctionInfo{304, nullptr, "GetGroupOwner"}, - FunctionInfo{312, nullptr, "GetIpConfig"}, - FunctionInfo{320, nullptr, "GetLinkLevel"}, - FunctionInfo{328, nullptr, "AttachJoinEvent"}, - FunctionInfo{336, nullptr, "GetMembers"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - ISfServiceMonitor::ISfServiceMonitor(Core::System& system_) : ServiceFramework{system_, "ISfServiceMonitor"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, C<&ISfServiceMonitor::Initialize>, "Initialize"}, + {256, nullptr, "AttachNetworkInterfaceStateChangeEvent"}, + {264, nullptr, "GetNetworkInterfaceLastError"}, + {272, nullptr, "GetRole"}, + {280, nullptr, "GetAdvertiseData"}, + {281, nullptr, "GetAdvertiseData2"}, + {288, C<&ISfServiceMonitor::GetGroupInfo>, "GetGroupInfo"}, + {296, nullptr, "GetGroupInfo2"}, + {304, nullptr, "GetGroupOwner"}, + {312, nullptr, "GetIpConfig"}, + {320, nullptr, "GetLinkLevel"}, + {328, nullptr, "AttachJoinEvent"}, + {336, nullptr, "GetMembers"}, + }; + // clang-format on + + RegisterHandlers(functions); } ISfServiceMonitor::~ISfServiceMonitor() = default; diff --git a/src/core/hle/service/ldn/sf_service_monitor.h b/src/core/hle/service/ldn/sf_service_monitor.h index 5e5e64ae6c..87854b868d 100644 --- a/src/core/hle/service/ldn/sf_service_monitor.h +++ b/src/core/hle/service/ldn/sf_service_monitor.h @@ -23,8 +23,8 @@ public: private: Result Initialize(Out out_value); - Result GetGroupInfo(OutLargeData out_group_info, GroupInfo in_group_info); - std::optional FindRequest(u32 key) override; + Result GetGroupInfo(OutLargeData out_group_info, + GroupInfo in_group_info); }; } // namespace Service::LDN diff --git a/src/core/hle/service/ldn/system_local_communication_service.cpp b/src/core/hle/service/ldn/system_local_communication_service.cpp index 9d3d49aac4..57a1c6a6c2 100644 --- a/src/core/hle/service/ldn/system_local_communication_service.cpp +++ b/src/core/hle/service/ldn/system_local_communication_service.cpp @@ -9,44 +9,44 @@ namespace Service::LDN { -std::optional ISystemLocalCommunicationService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetState"}, - FunctionInfo{1, nullptr, "GetNetworkInfo"}, - FunctionInfo{2, nullptr, "GetIpv4Address"}, - FunctionInfo{3, nullptr, "GetDisconnectReason"}, - FunctionInfo{4, nullptr, "GetSecurityParameter"}, - FunctionInfo{5, nullptr, "GetNetworkConfig"}, - FunctionInfo{100, nullptr, "AttachStateChangeEvent"}, - FunctionInfo{101, nullptr, "GetNetworkInfoLatestUpdate"}, - FunctionInfo{102, nullptr, "Scan"}, - FunctionInfo{103, nullptr, "ScanPrivate"}, - FunctionInfo{104, nullptr, "SetWirelessControllerRestriction"}, - FunctionInfo{200, nullptr, "OpenAccessPoint"}, - FunctionInfo{201, nullptr, "CloseAccessPoint"}, - FunctionInfo{202, nullptr, "CreateNetwork"}, - FunctionInfo{203, nullptr, "CreateNetworkPrivate"}, - FunctionInfo{204, nullptr, "DestroyNetwork"}, - FunctionInfo{205, nullptr, "Reject"}, - FunctionInfo{206, nullptr, "SetAdvertiseData"}, - FunctionInfo{207, nullptr, "SetStationAcceptPolicy"}, - FunctionInfo{208, nullptr, "AddAcceptFilterEntry"}, - FunctionInfo{209, nullptr, "ClearAcceptFilter"}, - FunctionInfo{300, nullptr, "OpenStation"}, - FunctionInfo{301, nullptr, "CloseStation"}, - FunctionInfo{302, nullptr, "Connect"}, - FunctionInfo{303, nullptr, "ConnectPrivate"}, - FunctionInfo{304, nullptr, "Disconnect"}, - FunctionInfo{400, nullptr, "InitializeSystem"}, - FunctionInfo{401, nullptr, "FinalizeSystem"}, - FunctionInfo{402, nullptr, "SetOperationMode"}, - FunctionInfo{403, C<&ISystemLocalCommunicationService::InitializeSystem2>, "InitializeSystem2"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - ISystemLocalCommunicationService::ISystemLocalCommunicationService(Core::System& system_) : ServiceFramework{system_, "ISystemLocalCommunicationService"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetState"}, + {1, nullptr, "GetNetworkInfo"}, + {2, nullptr, "GetIpv4Address"}, + {3, nullptr, "GetDisconnectReason"}, + {4, nullptr, "GetSecurityParameter"}, + {5, nullptr, "GetNetworkConfig"}, + {100, nullptr, "AttachStateChangeEvent"}, + {101, nullptr, "GetNetworkInfoLatestUpdate"}, + {102, nullptr, "Scan"}, + {103, nullptr, "ScanPrivate"}, + {104, nullptr, "SetWirelessControllerRestriction"}, + {200, nullptr, "OpenAccessPoint"}, + {201, nullptr, "CloseAccessPoint"}, + {202, nullptr, "CreateNetwork"}, + {203, nullptr, "CreateNetworkPrivate"}, + {204, nullptr, "DestroyNetwork"}, + {205, nullptr, "Reject"}, + {206, nullptr, "SetAdvertiseData"}, + {207, nullptr, "SetStationAcceptPolicy"}, + {208, nullptr, "AddAcceptFilterEntry"}, + {209, nullptr, "ClearAcceptFilter"}, + {300, nullptr, "OpenStation"}, + {301, nullptr, "CloseStation"}, + {302, nullptr, "Connect"}, + {303, nullptr, "ConnectPrivate"}, + {304, nullptr, "Disconnect"}, + {400, nullptr, "InitializeSystem"}, + {401, nullptr, "FinalizeSystem"}, + {402, nullptr, "SetOperationMode"}, + {403, C<&ISystemLocalCommunicationService::InitializeSystem2>, "InitializeSystem2"}, + }; + // clang-format on + + RegisterHandlers(functions); } ISystemLocalCommunicationService::~ISystemLocalCommunicationService() = default; diff --git a/src/core/hle/service/ldn/system_local_communication_service.h b/src/core/hle/service/ldn/system_local_communication_service.h index c7e937e3a2..fa0e45bde4 100644 --- a/src/core/hle/service/ldn/system_local_communication_service.h +++ b/src/core/hle/service/ldn/system_local_communication_service.h @@ -23,7 +23,6 @@ public: private: Result InitializeSystem2(); - std::optional FindRequest(u32 key) override; }; } // namespace Service::LDN diff --git a/src/core/hle/service/ldn/user_local_communication_service.cpp b/src/core/hle/service/ldn/user_local_communication_service.cpp index 26a742bf0b..7011bd52f2 100644 --- a/src/core/hle/service/ldn/user_local_communication_service.cpp +++ b/src/core/hle/service/ldn/user_local_communication_service.cpp @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -21,46 +22,46 @@ namespace Service::LDN { -std::optional IUserLocalCommunicationService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IUserLocalCommunicationService::GetState>, "GetState"}, - FunctionInfo{1, D<&IUserLocalCommunicationService::GetNetworkInfo>, "GetNetworkInfo"}, - FunctionInfo{2, D<&IUserLocalCommunicationService::GetIpv4Address>, "GetIpv4Address"}, - FunctionInfo{3, D<&IUserLocalCommunicationService::GetDisconnectReason>, "GetDisconnectReason"}, - FunctionInfo{4, D<&IUserLocalCommunicationService::GetSecurityParameter>, "GetSecurityParameter"}, - FunctionInfo{5, D<&IUserLocalCommunicationService::GetNetworkConfig>, "GetNetworkConfig"}, - FunctionInfo{100, D<&IUserLocalCommunicationService::AttachStateChangeEvent>, "AttachStateChangeEvent"}, - FunctionInfo{101, D<&IUserLocalCommunicationService::GetNetworkInfoLatestUpdate>, "GetNetworkInfoLatestUpdate"}, - FunctionInfo{102, D<&IUserLocalCommunicationService::Scan>, "Scan"}, - FunctionInfo{103, D<&IUserLocalCommunicationService::ScanPrivate>, "ScanPrivate"}, - FunctionInfo{104, D<&IUserLocalCommunicationService::SetWirelessControllerRestriction>, "SetWirelessControllerRestriction"}, - FunctionInfo{106, D<&IUserLocalCommunicationService::SetProtocol>, "SetProtocol" }, - FunctionInfo{200, D<&IUserLocalCommunicationService::OpenAccessPoint>, "OpenAccessPoint"}, - FunctionInfo{201, D<&IUserLocalCommunicationService::CloseAccessPoint>, "CloseAccessPoint"}, - FunctionInfo{202, D<&IUserLocalCommunicationService::CreateNetwork>, "CreateNetwork"}, - FunctionInfo{203, D<&IUserLocalCommunicationService::CreateNetworkPrivate>, "CreateNetworkPrivate"}, - FunctionInfo{204, D<&IUserLocalCommunicationService::DestroyNetwork>, "DestroyNetwork"}, - FunctionInfo{205, nullptr, "Reject"}, - FunctionInfo{206, D<&IUserLocalCommunicationService::SetAdvertiseData>, "SetAdvertiseData"}, - FunctionInfo{207, D<&IUserLocalCommunicationService::SetStationAcceptPolicy>, "SetStationAcceptPolicy"}, - FunctionInfo{208, D<&IUserLocalCommunicationService::AddAcceptFilterEntry>, "AddAcceptFilterEntry"}, - FunctionInfo{209, nullptr, "ClearAcceptFilter"}, - FunctionInfo{300, D<&IUserLocalCommunicationService::OpenStation>, "OpenStation"}, - FunctionInfo{301, D<&IUserLocalCommunicationService::CloseStation>, "CloseStation"}, - FunctionInfo{302, D<&IUserLocalCommunicationService::Connect>, "Connect"}, - FunctionInfo{303, nullptr, "ConnectPrivate"}, - FunctionInfo{304, D<&IUserLocalCommunicationService::Disconnect>, "Disconnect"}, - FunctionInfo{400, D<&IUserLocalCommunicationService::Initialize>, "Initialize"}, - FunctionInfo{401, D<&IUserLocalCommunicationService::Finalize>, "Finalize"}, - FunctionInfo{402, D<&IUserLocalCommunicationService::Initialize2>, "Initialize2"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IUserLocalCommunicationService::IUserLocalCommunicationService(Core::System& system_) : ServiceFramework{system_, "IUserLocalCommunicationService"}, service_context{system, "IUserLocalCommunicationService"}, lan_discovery{} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IUserLocalCommunicationService::GetState>, "GetState"}, + {1, D<&IUserLocalCommunicationService::GetNetworkInfo>, "GetNetworkInfo"}, + {2, D<&IUserLocalCommunicationService::GetIpv4Address>, "GetIpv4Address"}, + {3, D<&IUserLocalCommunicationService::GetDisconnectReason>, "GetDisconnectReason"}, + {4, D<&IUserLocalCommunicationService::GetSecurityParameter>, "GetSecurityParameter"}, + {5, D<&IUserLocalCommunicationService::GetNetworkConfig>, "GetNetworkConfig"}, + {100, D<&IUserLocalCommunicationService::AttachStateChangeEvent>, "AttachStateChangeEvent"}, + {101, D<&IUserLocalCommunicationService::GetNetworkInfoLatestUpdate>, "GetNetworkInfoLatestUpdate"}, + {102, D<&IUserLocalCommunicationService::Scan>, "Scan"}, + {103, D<&IUserLocalCommunicationService::ScanPrivate>, "ScanPrivate"}, + {104, D<&IUserLocalCommunicationService::SetWirelessControllerRestriction>, "SetWirelessControllerRestriction"}, + { 106, D<&IUserLocalCommunicationService::SetProtocol>, "SetProtocol" }, + {200, D<&IUserLocalCommunicationService::OpenAccessPoint>, "OpenAccessPoint"}, + {201, D<&IUserLocalCommunicationService::CloseAccessPoint>, "CloseAccessPoint"}, + {202, D<&IUserLocalCommunicationService::CreateNetwork>, "CreateNetwork"}, + {203, D<&IUserLocalCommunicationService::CreateNetworkPrivate>, "CreateNetworkPrivate"}, + {204, D<&IUserLocalCommunicationService::DestroyNetwork>, "DestroyNetwork"}, + {205, nullptr, "Reject"}, + {206, D<&IUserLocalCommunicationService::SetAdvertiseData>, "SetAdvertiseData"}, + {207, D<&IUserLocalCommunicationService::SetStationAcceptPolicy>, "SetStationAcceptPolicy"}, + {208, D<&IUserLocalCommunicationService::AddAcceptFilterEntry>, "AddAcceptFilterEntry"}, + {209, nullptr, "ClearAcceptFilter"}, + {300, D<&IUserLocalCommunicationService::OpenStation>, "OpenStation"}, + {301, D<&IUserLocalCommunicationService::CloseStation>, "CloseStation"}, + {302, D<&IUserLocalCommunicationService::Connect>, "Connect"}, + {303, nullptr, "ConnectPrivate"}, + {304, D<&IUserLocalCommunicationService::Disconnect>, "Disconnect"}, + {400, D<&IUserLocalCommunicationService::Initialize>, "Initialize"}, + {401, D<&IUserLocalCommunicationService::Finalize>, "Finalize"}, + {402, D<&IUserLocalCommunicationService::Initialize2>, "Initialize2"}, + }; + // clang-format on + + RegisterHandlers(functions); state_change_event = service_context.CreateEvent("IUserLocalCommunicationService:StateChangeEvent"); diff --git a/src/core/hle/service/ldn/user_local_communication_service.h b/src/core/hle/service/ldn/user_local_communication_service.h index 6f832b7a23..720d5e9bf4 100644 --- a/src/core/hle/service/ldn/user_local_communication_service.h +++ b/src/core/hle/service/ldn/user_local_communication_service.h @@ -1,7 +1,7 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later #pragma once @@ -89,7 +89,6 @@ private: /// Callback to parse and handle a received LDN packet. void OnLDNPacketReceived(const Network::LDNPacket& packet); void OnEventFired(); - std::optional FindRequest(u32 key) override; KernelHelpers::ServiceContext service_context; Kernel::KEvent* state_change_event; diff --git a/src/core/hle/service/ldr/ldr.cpp b/src/core/hle/service/ldr/ldr.cpp index 25ecc58fa4..db4d51b49d 100644 --- a/src/core/hle/service/ldr/ldr.cpp +++ b/src/core/hle/service/ldr/ldr.cpp @@ -12,44 +12,47 @@ namespace Service::LDR { class DebugMonitor final : public ServiceFramework { public: - explicit DebugMonitor(Core::System& system_) : ServiceFramework{system_, "ldr:dmnt"} {} + explicit DebugMonitor(Core::System& system_) : ServiceFramework{system_, "ldr:dmnt"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "SetProgramArgument"}, + {1, nullptr, "FlushArguments"}, + {2, nullptr, "GetProcessModuleInfo"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "SetProgramArgument"}, - FunctionInfo{1, nullptr, "FlushArguments"}, - FunctionInfo{2, nullptr, "GetProcessModuleInfo"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; class ProcessManager final : public ServiceFramework { public: - explicit ProcessManager(Core::System& system_) : ServiceFramework{system_, "ldr:pm"} {} + explicit ProcessManager(Core::System& system_) : ServiceFramework{system_, "ldr:pm"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "CreateProcess"}, + {1, nullptr, "GetProgramInfo"}, + {2, nullptr, "PinProgram"}, + {3, nullptr, "UnpinProgram"}, + {4, nullptr, "SetEnabledProgramVerification"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "CreateProcess"}, - FunctionInfo{1, nullptr, "GetProgramInfo"}, - FunctionInfo{2, nullptr, "PinProgram"}, - FunctionInfo{3, nullptr, "UnpinProgram"}, - FunctionInfo{4, nullptr, "SetEnabledProgramVerification"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; class Shell final : public ServiceFramework { public: - explicit Shell(Core::System& system_) : ServiceFramework{system_, "ldr:shel"} {} + explicit Shell(Core::System& system_) : ServiceFramework{system_, "ldr:shel"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "SetProgramArgument"}, + {1, nullptr, "FlushArguments"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "SetProgramArgument"}, - FunctionInfo{1, nullptr, "FlushArguments"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; diff --git a/src/core/hle/service/ldr/ldr.h b/src/core/hle/service/ldr/ldr.h index c9281dbfb2..12a6b1f507 100644 --- a/src/core/hle/service/ldr/ldr.h +++ b/src/core/hle/service/ldr/ldr.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/lm/lm.cpp b/src/core/hle/service/lm/lm.cpp index be8cdf9aa9..d631a6dd80 100644 --- a/src/core/hle/service/lm/lm.cpp +++ b/src/core/hle/service/lm/lm.cpp @@ -87,7 +87,16 @@ DECLARE_ENUM_FLAG_OPERATORS(LogPacketFlags); class ILogger final : public ServiceFramework { public: - explicit ILogger(Core::System& system_) : ServiceFramework{system_, "ILogger"} {} + explicit ILogger(Core::System& system_) : ServiceFramework{system_, "ILogger"} { + static const FunctionInfo functions[] = { + {0, &ILogger::Log, "Log"}, + {1, &ILogger::SetDestination, "SetDestination"}, + {2, nullptr, "TransmitHashedLog"}, //20.0.0+ + {3, nullptr, "DevNotify"}, //20.0.0+ + }; + RegisterHandlers(functions); + } + private: void Log(HLERequestContext& ctx) { std::size_t offset{}; @@ -322,25 +331,20 @@ private: }; static_assert(sizeof(LogPacketHeader) == 0x18, "LogPacketHeader is an invalid size"); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &ILogger::Log, "Log"}, - FunctionInfo{1, &ILogger::SetDestination, "SetDestination"}, - FunctionInfo{2, nullptr, "TransmitHashedLog", MakeVersionGate({20,0,0})}, - FunctionInfo{3, nullptr, "DevNotify", MakeVersionGate({20,0,0})} - ); ::Common::unordered_map> entries{}; LogDestination destination{LogDestination::All}; }; class LM final : public ServiceFramework { public: - explicit LM(Core::System& system_) : ServiceFramework{system_, "lm"} {} + explicit LM(Core::System& system_) : ServiceFramework{system_, "lm"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &LM::OpenLogger, "OpenLogger"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -351,26 +355,21 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &LM::OpenLogger, "OpenLogger"} - ); }; class LM_GET final : public ServiceFramework { public: - explicit LM_GET(Core::System& system_) : ServiceFramework{system_, "lm:get"} {} - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit LM_GET(Core::System& system_) + : ServiceFramework{system_, "lm:get"} + { + static const FunctionInfo functions[] = { + {0, nullptr, "StartLogging"}, + {1, nullptr, "StopLogging"}, + {2, nullptr, "GetLog"}, + {100, nullptr, "CreateDevNotificationReceiver"}, + }; + RegisterHandlers(functions); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "StartLogging"}, - FunctionInfo{1, nullptr, "StopLogging"}, - FunctionInfo{2, nullptr, "GetLog"}, - FunctionInfo{100, nullptr, "CreateDevNotificationReceiver"} - ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/lm/lm.h b/src/core/hle/service/lm/lm.h index 0d7c39cbc3..890344f44a 100644 --- a/src/core/hle/service/lm/lm.h +++ b/src/core/hle/service/lm/lm.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/mig/mig.cpp b/src/core/hle/service/mig/mig.cpp index 2560050622..7412674417 100644 --- a/src/core/hle/service/mig/mig.cpp +++ b/src/core/hle/service/mig/mig.cpp @@ -14,50 +14,50 @@ namespace Service::Migration { class MIG_USR final : public ServiceFramework { public: - explicit MIG_USR(Core::System& system_) : ServiceFramework{system_, "mig:usr"} {} + explicit MIG_USR(Core::System& system_) : ServiceFramework{system_, "mig:usr"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "Unknown0"}, //19.0.0+ + {1, nullptr, "Unknown1"}, //20.0.0+ + {2, nullptr, "Unknown2"}, //20.0.0+ + {10, nullptr, "TryGetLastMigrationInfo"}, + {11, nullptr, "Unknown11"}, //20.0.0+ + {100, nullptr, "CreateUserMigrationServer"}, //7.0.0+ + {101, nullptr, "ResumeUserMigrationServer"}, //7.0.0+ + {200, nullptr, "CreateUserMigrationClient"}, //7.0.0+ + {201, nullptr, "ResumeUserMigrationClient"}, //7.0.0+ + {1001, nullptr, "GetSaveDataMigrationPolicyInfoAsync"}, //8.0.0-20.5.0 + {1010, nullptr, "TryGetLastSaveDataMigrationInfo"}, //7.0.0+ + {1100, nullptr, "CreateSaveDataMigrationServer"}, //7.0.0-19.0.1 + {1101, nullptr, "ResumeSaveDataMigrationServer"}, //7.0.0+ + {1110, nullptr, "Unknown1101"}, //17.0.0+ + {1200, nullptr, "CreateSaveDataMigrationClient"}, //7.0.0+ + {1201, nullptr, "ResumeSaveDataMigrationClient"}, //7.0.0+ + {2001, nullptr, "Unknown2001"}, //20.0.0+ + {2010, nullptr, "Unknown2010"}, //20.0.0+ + {2100, nullptr, "Unknown2100"}, //20.0.0+ + {2110, nullptr, "Unknown2110"}, //20.0.0+ + {2200, nullptr, "Unknown2200"}, //20.0.0+ + {2210, nullptr, "Unknown2210"}, //20.0.0+ + {2220, nullptr, "Unknown2220"}, //20.0.0+ + {2230, nullptr, "Unknown2230"}, //20.0.0+ + {2231, nullptr, "Unknown2231"}, //20.0.0+ + {2232, nullptr, "Unknown2232"}, //20.0.0+ + {2233, nullptr, "Unknown2233"}, //20.0.0+ + {2234, nullptr, "Unknown2234"}, //20.0.0+ + {2250, nullptr, "Unknown2250"}, //20.0.0+ + {2260, nullptr, "Unknown2260"}, //20.0.0+ + {2270, nullptr, "Unknown2270"}, //20.0.0+ + {2280, nullptr, "Unknown2280"}, //20.0.0+ + {2300, nullptr, "Unknown2300"}, //20.0.0+ + {2310, nullptr, "Unknown2310"}, //20.0.0+ + {2400, nullptr, "Unknown2400"}, //20.0.0+ + {2420, nullptr, "Unknown2420"}, //20.0.0+ + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "Unknown0", MakeVersionGate({19,0,0})}, - FunctionInfo{1, nullptr, "Unknown1", MakeVersionGate({20,0,0})}, - FunctionInfo{2, nullptr, "Unknown2", MakeVersionGate({20,0,0})}, - FunctionInfo{10, nullptr, "TryGetLastMigrationInfo"}, - FunctionInfo{11, nullptr, "Unknown11", MakeVersionGate({20,0,0})}, - FunctionInfo{100, nullptr, "CreateUserMigrationServer", MakeVersionGate({7,0,0})}, - FunctionInfo{101, nullptr, "ResumeUserMigrationServer", MakeVersionGate({7,0,0})}, - FunctionInfo{200, nullptr, "CreateUserMigrationClient", MakeVersionGate({7,0,0})}, - FunctionInfo{201, nullptr, "ResumeUserMigrationClient", MakeVersionGate({7,0,0})}, - FunctionInfo{1001, nullptr, "GetSaveDataMigrationPolicyInfoAsync", MakeVersionGate({8,0,0}, {20,5,0})}, - FunctionInfo{1010, nullptr, "TryGetLastSaveDataMigrationInfo", MakeVersionGate({7,0,0})}, - FunctionInfo{1100, nullptr, "CreateSaveDataMigrationServer", MakeVersionGate({7,0,0}, {19,0,1})}, - FunctionInfo{1101, nullptr, "ResumeSaveDataMigrationServer", MakeVersionGate({7,0,0})}, - FunctionInfo{1110, nullptr, "Unknown1101", MakeVersionGate({17,0,0})}, - FunctionInfo{1200, nullptr, "CreateSaveDataMigrationClient", MakeVersionGate({7,0,0})}, - FunctionInfo{1201, nullptr, "ResumeSaveDataMigrationClient", MakeVersionGate({7,0,0})}, - FunctionInfo{2001, nullptr, "Unknown2001", MakeVersionGate({20,0,0})}, - FunctionInfo{2010, nullptr, "Unknown2010", MakeVersionGate({20,0,0})}, - FunctionInfo{2100, nullptr, "Unknown2100", MakeVersionGate({20,0,0})}, - FunctionInfo{2110, nullptr, "Unknown2110", MakeVersionGate({20,0,0})}, - FunctionInfo{2200, nullptr, "Unknown2200", MakeVersionGate({20,0,0})}, - FunctionInfo{2210, nullptr, "Unknown2210", MakeVersionGate({20,0,0})}, - FunctionInfo{2220, nullptr, "Unknown2220", MakeVersionGate({20,0,0})}, - FunctionInfo{2230, nullptr, "Unknown2230", MakeVersionGate({20,0,0})}, - FunctionInfo{2231, nullptr, "Unknown2231", MakeVersionGate({20,0,0})}, - FunctionInfo{2232, nullptr, "Unknown2232", MakeVersionGate({20,0,0})}, - FunctionInfo{2233, nullptr, "Unknown2233", MakeVersionGate({20,0,0})}, - FunctionInfo{2234, nullptr, "Unknown2234", MakeVersionGate({20,0,0})}, - FunctionInfo{2250, nullptr, "Unknown2250", MakeVersionGate({20,0,0})}, - FunctionInfo{2260, nullptr, "Unknown2260", MakeVersionGate({20,0,0})}, - FunctionInfo{2270, nullptr, "Unknown2270", MakeVersionGate({20,0,0})}, - FunctionInfo{2280, nullptr, "Unknown2280", MakeVersionGate({20,0,0})}, - FunctionInfo{2300, nullptr, "Unknown2300", MakeVersionGate({20,0,0})}, - FunctionInfo{2310, nullptr, "Unknown2310", MakeVersionGate({20,0,0})}, - FunctionInfo{2400, nullptr, "Unknown2400", MakeVersionGate({20,0,0})}, - FunctionInfo{2420, nullptr, "Unknown2420", MakeVersionGate({20,0,0})} - ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/mig/mig.h b/src/core/hle/service/mig/mig.h index c8ed732a5b..39e92a59eb 100644 --- a/src/core/hle/service/mig/mig.h +++ b/src/core/hle/service/mig/mig.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/mii/mii.cpp b/src/core/hle/service/mii/mii.cpp index 642a9e4907..513bb671f8 100644 --- a/src/core/hle/service/mii/mii.cpp +++ b/src/core/hle/service/mii/mii.cpp @@ -22,25 +22,49 @@ namespace Service::Mii { -std::optional IStaticService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IStaticService::GetDatabaseService>, "GetDatabaseService"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - class IDatabaseService final : public ServiceFramework { public: - explicit IDatabaseService(Core::System& system_, std::shared_ptr mii_manager, bool is_system_) - : ServiceFramework{system_, "IDatabaseService"} - , manager{mii_manager} - , is_system{is_system_} { - m_set_sys = system.ServiceManager().GetService("set:sys", true); - manager->Initialize(metadata); - } + explicit IDatabaseService(Core::System& system_, std::shared_ptr mii_manager, + bool is_system_) + : ServiceFramework{system_, "IDatabaseService"}, manager{mii_manager}, is_system{ + is_system_} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IDatabaseService::IsUpdated>, "IsUpdated"}, + {1, D<&IDatabaseService::IsFullDatabase>, "IsFullDatabase"}, + {2, D<&IDatabaseService::GetCount>, "GetCount"}, + {3, D<&IDatabaseService::Get>, "Get"}, + {4, D<&IDatabaseService::Get1>, "Get1"}, + {5, D<&IDatabaseService::UpdateLatest>, "UpdateLatest"}, + {6, D<&IDatabaseService::BuildRandom>, "BuildRandom"}, + {7, D<&IDatabaseService::BuildDefault>, "BuildDefault"}, + {8, D<&IDatabaseService::Get2>, "Get2"}, + {9, D<&IDatabaseService::Get3>, "Get3"}, + {10, D<&IDatabaseService::UpdateLatest1>, "UpdateLatest1"}, + {11, D<&IDatabaseService::FindIndex>, "FindIndex"}, + {12, D<&IDatabaseService::Move>, "Move"}, + {13, D<&IDatabaseService::AddOrReplace>, "AddOrReplace"}, + {14, D<&IDatabaseService::Delete>, "Delete"}, + {15, D<&IDatabaseService::DestroyFile>, "DestroyFile"}, + {16, D<&IDatabaseService::DeleteFile>, "DeleteFile"}, + {17, D<&IDatabaseService::Format>, "Format"}, + {18, nullptr, "Import"}, + {19, nullptr, "Export"}, + {20, D<&IDatabaseService::IsBrokenDatabaseWithClearFlag>, "IsBrokenDatabaseWithClearFlag"}, + {21, D<&IDatabaseService::GetIndex>, "GetIndex"}, + {22, D<&IDatabaseService::SetInterfaceVersion>, "SetInterfaceVersion"}, + {23, D<&IDatabaseService::Convert>, "Convert"}, + {24, D<&IDatabaseService::ConvertCoreDataToCharInfo>, "ConvertCoreDataToCharInfo"}, + {25, D<&IDatabaseService::ConvertCharInfoToCoreData>, "ConvertCharInfoToCoreData"}, + {26, D<&IDatabaseService::Append>, "Append"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); + + m_set_sys = system.ServiceManager().GetService( + "set:sys", true); + manager->Initialize(metadata); } private: @@ -264,45 +288,23 @@ private: R_RETURN(manager->Append(metadata, char_info)); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IDatabaseService::IsUpdated>, "IsUpdated"}, - FunctionInfo{1, D<&IDatabaseService::IsFullDatabase>, "IsFullDatabase"}, - FunctionInfo{2, D<&IDatabaseService::GetCount>, "GetCount"}, - FunctionInfo{3, D<&IDatabaseService::Get>, "Get"}, - FunctionInfo{4, D<&IDatabaseService::Get1>, "Get1"}, - FunctionInfo{5, D<&IDatabaseService::UpdateLatest>, "UpdateLatest"}, - FunctionInfo{6, D<&IDatabaseService::BuildRandom>, "BuildRandom"}, - FunctionInfo{7, D<&IDatabaseService::BuildDefault>, "BuildDefault"}, - FunctionInfo{8, D<&IDatabaseService::Get2>, "Get2"}, - FunctionInfo{9, D<&IDatabaseService::Get3>, "Get3"}, - FunctionInfo{10, D<&IDatabaseService::UpdateLatest1>, "UpdateLatest1"}, - FunctionInfo{11, D<&IDatabaseService::FindIndex>, "FindIndex"}, - FunctionInfo{12, D<&IDatabaseService::Move>, "Move"}, - FunctionInfo{13, D<&IDatabaseService::AddOrReplace>, "AddOrReplace"}, - FunctionInfo{14, D<&IDatabaseService::Delete>, "Delete"}, - FunctionInfo{15, D<&IDatabaseService::DestroyFile>, "DestroyFile"}, - FunctionInfo{16, D<&IDatabaseService::DeleteFile>, "DeleteFile"}, - FunctionInfo{17, D<&IDatabaseService::Format>, "Format"}, - FunctionInfo{18, nullptr, "Import"}, - FunctionInfo{19, nullptr, "Export"}, - FunctionInfo{20, D<&IDatabaseService::IsBrokenDatabaseWithClearFlag>, "IsBrokenDatabaseWithClearFlag"}, - FunctionInfo{21, D<&IDatabaseService::GetIndex>, "GetIndex"}, - FunctionInfo{22, D<&IDatabaseService::SetInterfaceVersion>, "SetInterfaceVersion"}, - FunctionInfo{23, D<&IDatabaseService::Convert>, "Convert"}, - FunctionInfo{24, D<&IDatabaseService::ConvertCoreDataToCharInfo>, "ConvertCoreDataToCharInfo"}, - FunctionInfo{25, D<&IDatabaseService::ConvertCharInfoToCoreData>, "ConvertCharInfoToCoreData"}, - FunctionInfo{26, D<&IDatabaseService::Append>, "Append"} - ); - std::shared_ptr manager = nullptr; DatabaseSessionMetadata metadata{}; bool is_system{}; + std::shared_ptr m_set_sys; }; IStaticService::IStaticService(Core::System& system_, const char* name_, std::shared_ptr mii_manager, bool is_system_) : ServiceFramework{system_, name_}, manager{mii_manager}, is_system{is_system_} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IStaticService::GetDatabaseService>, "GetDatabaseService"}, + }; + // clang-format on + + RegisterHandlers(functions); } IStaticService::~IStaticService() = default; @@ -322,10 +324,27 @@ std::shared_ptr IStaticService::GetMiiManager() { class IImageDatabaseService final : public ServiceFramework { public: - explicit IImageDatabaseService(Core::System& system_) : ServiceFramework{system_, "miiimg"} {} + explicit IImageDatabaseService(Core::System& system_) : ServiceFramework{system_, "miiimg"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IImageDatabaseService::Initialize>, "Initialize"}, + {10, nullptr, "Reload"}, + {11, D<&IImageDatabaseService::GetCount>, "GetCount"}, + {12, nullptr, "IsEmpty"}, + {13, nullptr, "IsFull"}, + {14, nullptr, "GetAttribute"}, + {15, nullptr, "LoadImage"}, + {16, nullptr, "AddOrUpdateImage"}, + {17, nullptr, "DeleteImages"}, + {100, nullptr, "DeleteFile"}, + {101, nullptr, "DestroyFile"}, + {102, nullptr, "ImportFile"}, + {103, nullptr, "ExportFile"}, + {104, nullptr, "ForceInitialize"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -342,23 +361,6 @@ private: R_SUCCEED(); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IImageDatabaseService::Initialize>, "Initialize"}, - FunctionInfo{10, nullptr, "Reload"}, - FunctionInfo{11, D<&IImageDatabaseService::GetCount>, "GetCount"}, - FunctionInfo{12, nullptr, "IsEmpty"}, - FunctionInfo{13, nullptr, "IsFull"}, - FunctionInfo{14, nullptr, "GetAttribute"}, - FunctionInfo{15, nullptr, "LoadImage"}, - FunctionInfo{16, nullptr, "AddOrUpdateImage"}, - FunctionInfo{17, nullptr, "DeleteImages"}, - FunctionInfo{100, nullptr, "DeleteFile"}, - FunctionInfo{101, nullptr, "DestroyFile"}, - FunctionInfo{102, nullptr, "ImportFile"}, - FunctionInfo{103, nullptr, "ExportFile"}, - FunctionInfo{104, nullptr, "ForceInitialize"} - ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/mii/mii.h b/src/core/hle/service/mii/mii.h index ba20db40d7..9ec6f248e5 100644 --- a/src/core/hle/service/mii/mii.h +++ b/src/core/hle/service/mii/mii.h @@ -27,7 +27,6 @@ public: private: Result GetDatabaseService(Out> out_database_service); - std::optional FindRequest(u32 key) override; std::shared_ptr manager{nullptr}; bool is_system{}; }; diff --git a/src/core/hle/service/mii/mii_database.cpp b/src/core/hle/service/mii/mii_database.cpp index d1f4e1f198..6dd9773b2b 100644 --- a/src/core/hle/service/mii/mii_database.cpp +++ b/src/core/hle/service/mii/mii_database.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project diff --git a/src/core/hle/service/mii/mii_database.h b/src/core/hle/service/mii/mii_database.h index 3bd240f93b..6d28696206 100644 --- a/src/core/hle/service/mii/mii_database.h +++ b/src/core/hle/service/mii/mii_database.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/mii/mii_database_manager.h b/src/core/hle/service/mii/mii_database_manager.h index 52c32be82c..52ec3a91cc 100644 --- a/src/core/hle/service/mii/mii_database_manager.h +++ b/src/core/hle/service/mii/mii_database_manager.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/mii/mii_manager.h b/src/core/hle/service/mii/mii_manager.h index 48d8e8bb7d..9c546d2cbf 100644 --- a/src/core/hle/service/mii/mii_manager.h +++ b/src/core/hle/service/mii/mii_manager.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/mii/mii_result.h b/src/core/hle/service/mii/mii_result.h index e2c36e556d..f4964133e7 100644 --- a/src/core/hle/service/mii/mii_result.h +++ b/src/core/hle/service/mii/mii_result.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/mii/mii_types.h b/src/core/hle/service/mii/mii_types.h index 08c6029dff..6afa07ef43 100644 --- a/src/core/hle/service/mii/mii_types.h +++ b/src/core/hle/service/mii/mii_types.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/mii/types/char_info.cpp b/src/core/hle/service/mii/types/char_info.cpp index e90124af4c..b5f4492994 100644 --- a/src/core/hle/service/mii/types/char_info.cpp +++ b/src/core/hle/service/mii/types/char_info.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/mii/types/char_info.h b/src/core/hle/service/mii/types/char_info.h index d0c457fd56..e9c41435e1 100644 --- a/src/core/hle/service/mii/types/char_info.h +++ b/src/core/hle/service/mii/types/char_info.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/mii/types/core_data.cpp b/src/core/hle/service/mii/types/core_data.cpp index ba1da76bae..7f2acea3ef 100644 --- a/src/core/hle/service/mii/types/core_data.cpp +++ b/src/core/hle/service/mii/types/core_data.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/mii/types/core_data.h b/src/core/hle/service/mii/types/core_data.h index 8897e4f3b3..48a1ba5c73 100644 --- a/src/core/hle/service/mii/types/core_data.h +++ b/src/core/hle/service/mii/types/core_data.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/mii/types/raw_data.h b/src/core/hle/service/mii/types/raw_data.h index 9a4cfa738e..f8182847ec 100644 --- a/src/core/hle/service/mii/types/raw_data.h +++ b/src/core/hle/service/mii/types/raw_data.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/mii/types/store_data.cpp b/src/core/hle/service/mii/types/store_data.cpp index 127221fdb6..fcef3850f2 100644 --- a/src/core/hle/service/mii/types/store_data.cpp +++ b/src/core/hle/service/mii/types/store_data.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/mii/types/store_data.h b/src/core/hle/service/mii/types/store_data.h index ed5dfb9494..5d5269a15b 100644 --- a/src/core/hle/service/mii/types/store_data.h +++ b/src/core/hle/service/mii/types/store_data.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/mii/types/ver3_store_data.cpp b/src/core/hle/service/mii/types/ver3_store_data.cpp index c27646fcfd..840e0f35b3 100644 --- a/src/core/hle/service/mii/types/ver3_store_data.cpp +++ b/src/core/hle/service/mii/types/ver3_store_data.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/mii/types/ver3_store_data.h b/src/core/hle/service/mii/types/ver3_store_data.h index 47907bf7d7..f2cb395136 100644 --- a/src/core/hle/service/mii/types/ver3_store_data.h +++ b/src/core/hle/service/mii/types/ver3_store_data.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/mm/mm_u.cpp b/src/core/hle/service/mm/mm_u.cpp index 0b361ecdd2..e5353ee42c 100644 --- a/src/core/hle/service/mm/mm_u.cpp +++ b/src/core/hle/service/mm/mm_u.cpp @@ -49,10 +49,21 @@ public: class MM_U final : public ServiceFramework { public: - explicit MM_U(Core::System& system_) : ServiceFramework{system_, "mm:u"} {} + explicit MM_U(Core::System& system_) : ServiceFramework{system_, "mm:u"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &MM_U::InitializeOld, "InitializeOld"}, + {1, &MM_U::FinalizeOld, "FinalizeOld"}, + {2, &MM_U::SetAndWaitOld, "SetAndWaitOld"}, + {3, &MM_U::GetOld, "GetOld"}, + {4, &MM_U::Initialize, "Initialize"}, + {5, &MM_U::Finalize, "Finalize"}, + {6, &MM_U::SetAndWait, "SetAndWait"}, + {7, &MM_U::Get, "Get"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -201,16 +212,6 @@ private: rb.Push(0); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &MM_U::InitializeOld, "InitializeOld"}, - FunctionInfo{1, &MM_U::FinalizeOld, "FinalizeOld"}, - FunctionInfo{2, &MM_U::SetAndWaitOld, "SetAndWaitOld"}, - FunctionInfo{3, &MM_U::GetOld, "GetOld"}, - FunctionInfo{4, &MM_U::Initialize, "Initialize"}, - FunctionInfo{5, &MM_U::Finalize, "Finalize"}, - FunctionInfo{6, &MM_U::SetAndWait, "SetAndWait"}, - FunctionInfo{7, &MM_U::Get, "Get"} - ); std::vector sessions; u32 request_id{1}; }; diff --git a/src/core/hle/service/mm/mm_u.h b/src/core/hle/service/mm/mm_u.h index 43117c9b1c..ab0e76f40a 100644 --- a/src/core/hle/service/mm/mm_u.h +++ b/src/core/hle/service/mm/mm_u.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/mnpp/mnpp.cpp b/src/core/hle/service/mnpp/mnpp.cpp index c5bc306302..11b6f3a386 100644 --- a/src/core/hle/service/mnpp/mnpp.cpp +++ b/src/core/hle/service/mnpp/mnpp.cpp @@ -14,10 +14,15 @@ namespace Service::MNPP { class MNPP_APP final : public ServiceFramework { public: - explicit MNPP_APP(Core::System& system_) : ServiceFramework{system_, "mnpp:app"} {} + explicit MNPP_APP(Core::System& system_) : ServiceFramework{system_, "mnpp:app"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &MNPP_APP::Cmd0, "Cmd0"}, + {1, &MNPP_APP::Cmd1, "Cmd1"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -34,43 +39,38 @@ private: IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &MNPP_APP::Cmd0, "Cmd0"}, - FunctionInfo{1, &MNPP_APP::Cmd1, "Cmd1"} - ); }; class MNPP_SYS final : public ServiceFramework { public: - explicit MNPP_SYS(Core::System& system_) : ServiceFramework{system_, "mnpp:sys"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "Cmd0"}, - FunctionInfo{10, nullptr, "Cmd10"}, - FunctionInfo{100, nullptr, "Cmd100"}, - FunctionInfo{200, nullptr, "Cmd200"}, - FunctionInfo{300, nullptr, "Cmd300"}, - FunctionInfo{400, nullptr, "Cmd400"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit MNPP_SYS(Core::System& system_) : ServiceFramework{system_, "mnpp:sys"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "Cmd0"}, + {10, nullptr, "Cmd10"}, + {100, nullptr, "Cmd100"}, + {200, nullptr, "Cmd200"}, + {300, nullptr, "Cmd300"}, + {400, nullptr, "Cmd400"}, + }; + // clang-format on + RegisterHandlers(functions); } }; class MNPP_WEB final : public ServiceFramework { public: - explicit MNPP_WEB(Core::System& system_) : ServiceFramework{system_, "mnpp:web"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "Cmd0"}, - FunctionInfo{1, nullptr, "Cmd1"}, - FunctionInfo{10, nullptr, "Cmd10"}, - FunctionInfo{20, nullptr, "Cmd20"}, - FunctionInfo{100, nullptr, "Cmd100"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit MNPP_WEB(Core::System& system_) : ServiceFramework{system_, "mnpp:web"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "Cmd0"}, + {1, nullptr, "Cmd1"}, + {10, nullptr, "Cmd10"}, + {20, nullptr, "Cmd20"}, + {100, nullptr, "Cmd100"}, + }; + // clang-format on + RegisterHandlers(functions); } }; diff --git a/src/core/hle/service/ncm/ncm.cpp b/src/core/hle/service/ncm/ncm.cpp index 4091eadcf9..6c754d5567 100644 --- a/src/core/hle/service/ncm/ncm.cpp +++ b/src/core/hle/service/ncm/ncm.cpp @@ -24,32 +24,33 @@ namespace Service::NCM { class ILocationResolver final : public ServiceFramework { public: explicit ILocationResolver(Core::System& system_, FileSys::StorageId id) - : ServiceFramework{system_, "ILocationResolver"}, storage{id} {} + : ServiceFramework{system_, "ILocationResolver"}, storage{id} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "ResolveProgramPath"}, + {1, nullptr, "RedirectProgramPath"}, + {2, nullptr, "ResolveApplicationControlPath"}, + {3, nullptr, "ResolveApplicationHtmlDocumentPath"}, + {4, nullptr, "ResolveDataPath"}, + {5, nullptr, "RedirectApplicationControlPath"}, + {6, nullptr, "RedirectApplicationHtmlDocumentPath"}, + {7, nullptr, "ResolveApplicationLegalInformationPath"}, + {8, nullptr, "RedirectApplicationLegalInformationPath"}, + {9, nullptr, "Refresh"}, + {10, nullptr, "RedirectApplicationProgramPath"}, + {11, nullptr, "ClearApplicationRedirection"}, + {12, nullptr, "EraseProgramRedirection"}, + {13, nullptr, "EraseApplicationControlRedirection"}, + {14, nullptr, "EraseApplicationHtmlDocumentRedirection"}, + {15, nullptr, "EraseApplicationLegalInformationRedirection"}, + {16, nullptr, "ResolveProgramPathForDebug"}, + {17, nullptr, "RedirectProgramPathForDebug"}, + {18, nullptr, "RedirectApplicationProgramPathForDebug"}, + {19, nullptr, "EraseProgramRedirectionForDebug"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "ResolveProgramPath"}, - FunctionInfo{1, nullptr, "RedirectProgramPath"}, - FunctionInfo{2, nullptr, "ResolveApplicationControlPath"}, - FunctionInfo{3, nullptr, "ResolveApplicationHtmlDocumentPath"}, - FunctionInfo{4, nullptr, "ResolveDataPath"}, - FunctionInfo{5, nullptr, "RedirectApplicationControlPath"}, - FunctionInfo{6, nullptr, "RedirectApplicationHtmlDocumentPath"}, - FunctionInfo{7, nullptr, "ResolveApplicationLegalInformationPath"}, - FunctionInfo{8, nullptr, "RedirectApplicationLegalInformationPath"}, - FunctionInfo{9, nullptr, "Refresh"}, - FunctionInfo{10, nullptr, "RedirectApplicationProgramPath"}, - FunctionInfo{11, nullptr, "ClearApplicationRedirection"}, - FunctionInfo{12, nullptr, "EraseProgramRedirection"}, - FunctionInfo{13, nullptr, "EraseApplicationControlRedirection"}, - FunctionInfo{14, nullptr, "EraseApplicationHtmlDocumentRedirection"}, - FunctionInfo{15, nullptr, "EraseApplicationLegalInformationRedirection"}, - FunctionInfo{16, nullptr, "ResolveProgramPathForDebug"}, - FunctionInfo{17, nullptr, "RedirectProgramPathForDebug"}, - FunctionInfo{18, nullptr, "RedirectApplicationProgramPathForDebug"}, - FunctionInfo{19, nullptr, "EraseProgramRedirectionForDebug"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -59,49 +60,60 @@ private: class IRegisteredLocationResolver final : public ServiceFramework { public: explicit IRegisteredLocationResolver(Core::System& system_) - : ServiceFramework{system_, "IRegisteredLocationResolver"} {} + : ServiceFramework{system_, "IRegisteredLocationResolver"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "ResolveProgramPath"}, + {1, nullptr, "RegisterProgramPath"}, + {2, nullptr, "UnregisterProgramPath"}, + {3, nullptr, "RedirectProgramPath"}, + {4, nullptr, "ResolveHtmlDocumentPath"}, + {5, nullptr, "RegisterHtmlDocumentPath"}, + {6, nullptr, "UnregisterHtmlDocumentPath"}, + {7, nullptr, "RedirectHtmlDocumentPath"}, + {8, nullptr, "Refresh"}, + {9, nullptr, "RefreshExcluding"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "ResolveProgramPath"}, - FunctionInfo{1, nullptr, "RegisterProgramPath"}, - FunctionInfo{2, nullptr, "UnregisterProgramPath"}, - FunctionInfo{3, nullptr, "RedirectProgramPath"}, - FunctionInfo{4, nullptr, "ResolveHtmlDocumentPath"}, - FunctionInfo{5, nullptr, "RegisterHtmlDocumentPath"}, - FunctionInfo{6, nullptr, "UnregisterHtmlDocumentPath"}, - FunctionInfo{7, nullptr, "RedirectHtmlDocumentPath"}, - FunctionInfo{8, nullptr, "Refresh"}, - FunctionInfo{9, nullptr, "RefreshExcluding"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; class IAddOnContentLocationResolver final : public ServiceFramework { public: explicit IAddOnContentLocationResolver(Core::System& system_) - : ServiceFramework{system_, "IAddOnContentLocationResolver"} {} + : ServiceFramework{system_, "IAddOnContentLocationResolver"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "ResolveAddOnContentPath"}, + {1, nullptr, "RegisterAddOnContentStorage"}, + {2, nullptr, "UnregisterAllAddOnContentPath"}, + {3, nullptr, "RefreshApplicationAddOnContent"}, + {4, nullptr, "UnregisterApplicationAddOnContent"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "ResolveAddOnContentPath"}, - FunctionInfo{1, nullptr, "RegisterAddOnContentStorage"}, - FunctionInfo{2, nullptr, "UnregisterAllAddOnContentPath"}, - FunctionInfo{3, nullptr, "RefreshApplicationAddOnContent"}, - FunctionInfo{4, nullptr, "UnregisterApplicationAddOnContent"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; class IContentStorage final : public ServiceFramework { public: explicit IContentStorage(Core::System& system_, FileSys::StorageId id) - : ServiceFramework{system_, "IContentStorage"}, storage{id} {} + : ServiceFramework{system_, "IContentStorage"}, storage{id} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &IContentStorage::GeneratePlaceHolderId, "GeneratePlaceHolderId"}, + {1, &IContentStorage::CreatePlaceHolder, "CreatePlaceHolder"}, + {2, &IContentStorage::DeletePlaceHolder, "DeletePlaceHolder"}, + {4, &IContentStorage::WritePlaceHolder, "WritePlaceHolder"}, + {5, &IContentStorage::Register, "Register"}, + {6, &IContentStorage::Delete, "Delete"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -240,24 +252,23 @@ private: rb.Push(succeeded ? ResultSuccess : ResultUnknown); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &IContentStorage::GeneratePlaceHolderId, "GeneratePlaceHolderId"}, - FunctionInfo{1, &IContentStorage::CreatePlaceHolder, "CreatePlaceHolder"}, - FunctionInfo{2, &IContentStorage::DeletePlaceHolder, "DeletePlaceHolder"}, - FunctionInfo{4, &IContentStorage::WritePlaceHolder, "WritePlaceHolder"}, - FunctionInfo{5, &IContentStorage::Register, "Register"}, - FunctionInfo{6, &IContentStorage::Delete, "Delete"} - ); FileSys::StorageId storage; }; class IContentMetaDatabase final : public ServiceFramework { public: explicit IContentMetaDatabase(Core::System& system_, FileSys::StorageId id) - : ServiceFramework{system_, "IContentMetaDatabase"}, storage{id} {} + : ServiceFramework{system_, "IContentMetaDatabase"}, storage{id} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &IContentMetaDatabase::Set, "Set"}, + {2, &IContentMetaDatabase::Remove, "Remove"}, + {8, &IContentMetaDatabase::Has, "Has"}, + {15, &IContentMetaDatabase::Commit, "Commit"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -345,37 +356,51 @@ private: rb.Push(ResultSuccess); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &IContentMetaDatabase::Set, "Set"}, - FunctionInfo{2, &IContentMetaDatabase::Remove, "Remove"}, - FunctionInfo{8, &IContentMetaDatabase::Has, "Has"}, - FunctionInfo{15, &IContentMetaDatabase::Commit, "Commit"} - ); FileSys::StorageId storage; std::vector entries; }; class LR final : public ServiceFramework { public: - explicit LR(Core::System& system_) : ServiceFramework{system_, "lr"} {} + explicit LR(Core::System& system_) : ServiceFramework{system_, "lr"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "OpenLocationResolver"}, + {1, nullptr, "OpenRegisteredLocationResolver"}, + {2, nullptr, "RefreshLocationResolver"}, + {3, nullptr, "OpenAddOnContentLocationResolver"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "OpenLocationResolver"}, - FunctionInfo{1, nullptr, "OpenRegisteredLocationResolver"}, - FunctionInfo{2, nullptr, "RefreshLocationResolver"}, - FunctionInfo{3, nullptr, "OpenAddOnContentLocationResolver"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; class NCM final : public ServiceFramework { public: - explicit NCM(Core::System& system_) : ServiceFramework{system_, "ncm"} {} + explicit NCM(Core::System& system_) : ServiceFramework{system_, "ncm"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "CreateContentStorage"}, + {1, nullptr, "CreateContentMetaDatabase"}, + {2, nullptr, "VerifyContentStorage"}, + {3, nullptr, "VerifyContentMetaDatabase"}, + {4, &NCM::OpenContentStorage, "OpenContentStorage"}, + {5, &NCM::OpenContentMetaDatabase, "OpenContentMetaDatabase"}, + {6, nullptr, "CloseContentStorageForcibly"}, + {7, nullptr, "CloseContentMetaDatabaseForcibly"}, + {8, nullptr, "CleanupContentMetaDatabase"}, + {9, nullptr, "ActivateContentStorage"}, + {10, nullptr, "InactivateContentStorage"}, + {11, nullptr, "ActivateContentMetaDatabase"}, + {12, nullptr, "InactivateContentMetaDatabase"}, + {13, nullptr, "InvalidateRightsIdCache"}, + {14, nullptr, "GetMemoryReport"}, + {15, nullptr, "ActivateFsContentStorage"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -400,39 +425,18 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system, storage_id); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "CreateContentStorage"}, - FunctionInfo{1, nullptr, "CreateContentMetaDatabase"}, - FunctionInfo{2, nullptr, "VerifyContentStorage"}, - FunctionInfo{3, nullptr, "VerifyContentMetaDatabase"}, - FunctionInfo{4, &NCM::OpenContentStorage, "OpenContentStorage"}, - FunctionInfo{5, &NCM::OpenContentMetaDatabase, "OpenContentMetaDatabase"}, - FunctionInfo{6, nullptr, "CloseContentStorageForcibly"}, - FunctionInfo{7, nullptr, "CloseContentMetaDatabaseForcibly"}, - FunctionInfo{8, nullptr, "CleanupContentMetaDatabase"}, - FunctionInfo{9, nullptr, "ActivateContentStorage"}, - FunctionInfo{10, nullptr, "InactivateContentStorage"}, - FunctionInfo{11, nullptr, "ActivateContentMetaDatabase"}, - FunctionInfo{12, nullptr, "InactivateContentMetaDatabase"}, - FunctionInfo{13, nullptr, "InvalidateRightsIdCache"}, - FunctionInfo{14, nullptr, "GetMemoryReport"}, - FunctionInfo{15, nullptr, "ActivateFsContentStorage"} - ); }; class NCM_V final : public ServiceFramework { public: explicit NCM_V(Core::System& system_) : ServiceFramework{system_, "ncm:v"} - {} - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + { + static const FunctionInfo functions[] = { + {0, nullptr, "GetSystemVersion"}, + }; + RegisterHandlers(functions); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetSystemVersion"} - ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/ncm/ncm.h b/src/core/hle/service/ncm/ncm.h index b78efdcd79..1d8bc7a9ea 100644 --- a/src/core/hle/service/ncm/ncm.h +++ b/src/core/hle/service/ncm/ncm.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/nfc/common/device.h b/src/core/hle/service/nfc/common/device.h index d59202d18f..98063bbc29 100644 --- a/src/core/hle/service/nfc/common/device.h +++ b/src/core/hle/service/nfc/common/device.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/nfc/common/device_manager.h b/src/core/hle/service/nfc/common/device_manager.h index 6c0e6b255e..116ae8cb7e 100644 --- a/src/core/hle/service/nfc/common/device_manager.h +++ b/src/core/hle/service/nfc/common/device_manager.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/core/hle/service/nfc/mifare_result.h b/src/core/hle/service/nfc/mifare_result.h index 16a9171e60..399f01313e 100644 --- a/src/core/hle/service/nfc/mifare_result.h +++ b/src/core/hle/service/nfc/mifare_result.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/core/hle/service/nfc/mifare_types.h b/src/core/hle/service/nfc/mifare_types.h index 4679373994..237f60f0de 100644 --- a/src/core/hle/service/nfc/mifare_types.h +++ b/src/core/hle/service/nfc/mifare_types.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/core/hle/service/nfc/nfc.cpp b/src/core/hle/service/nfc/nfc.cpp index d3a986faea..f64445835e 100644 --- a/src/core/hle/service/nfc/nfc.cpp +++ b/src/core/hle/service/nfc/nfc.cpp @@ -18,71 +18,74 @@ namespace Service::NFC { class IUser final : public NfcInterface { public: - explicit IUser(Core::System& system_) : NfcInterface(system_, "NFC::IUser", BackendType::Nfc) {} + explicit IUser(Core::System& system_) : NfcInterface(system_, "NFC::IUser", BackendType::Nfc) { + // clang-format off + static const FunctionInfo functions[] = { + {0, &NfcInterface::Initialize, "InitializeOld"}, + {1, &NfcInterface::Finalize, "FinalizeOld"}, + {2, &NfcInterface::GetState, "GetStateOld"}, + {3, &NfcInterface::IsNfcEnabled, "IsNfcEnabledOld"}, + {400, &NfcInterface::Initialize, "Initialize"}, + {401, &NfcInterface::Finalize, "Finalize"}, + {402, &NfcInterface::GetState, "GetState"}, + {403, &NfcInterface::IsNfcEnabled, "IsNfcEnabled"}, + {404, &NfcInterface::ListDevices, "ListDevices"}, + {405, &NfcInterface::GetDeviceState, "GetDeviceState"}, + {406, &NfcInterface::GetNpadId, "GetNpadId"}, + {407, &NfcInterface::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, + {408, &NfcInterface::StartDetection, "StartDetection"}, + {409, &NfcInterface::StopDetection, "StopDetection"}, + {410, &NfcInterface::GetTagInfo, "GetTagInfo"}, + {411, &NfcInterface::AttachActivateEvent, "AttachActivateEvent"}, + {412, &NfcInterface::AttachDeactivateEvent, "AttachDeactivateEvent"}, + {1000, &NfcInterface::ReadMifare, "ReadMifare"}, + {1001, &NfcInterface::WriteMifare ,"WriteMifare"}, + {1300, &NfcInterface::SendCommandByPassThrough, "SendCommandByPassThrough"}, + {1301, nullptr, "KeepPassThroughSession"}, + {1302, nullptr, "ReleasePassThroughSession"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } - static constexpr auto functions = CreateStaticMapWithClass( - FunctionInfoTyped{0, &NfcInterface::Initialize, "InitializeOld"}, - FunctionInfoTyped{1, &NfcInterface::Finalize, "FinalizeOld"}, - FunctionInfoTyped{2, &NfcInterface::GetState, "GetStateOld"}, - FunctionInfoTyped{3, &NfcInterface::IsNfcEnabled, "IsNfcEnabledOld"}, - FunctionInfoTyped{400, &NfcInterface::Initialize, "Initialize"}, - FunctionInfoTyped{401, &NfcInterface::Finalize, "Finalize"}, - FunctionInfoTyped{402, &NfcInterface::GetState, "GetState"}, - FunctionInfoTyped{403, &NfcInterface::IsNfcEnabled, "IsNfcEnabled"}, - FunctionInfoTyped{404, &NfcInterface::ListDevices, "ListDevices"}, - FunctionInfoTyped{405, &NfcInterface::GetDeviceState, "GetDeviceState"}, - FunctionInfoTyped{406, &NfcInterface::GetNpadId, "GetNpadId"}, - FunctionInfoTyped{407, &NfcInterface::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, - FunctionInfoTyped{408, &NfcInterface::StartDetection, "StartDetection"}, - FunctionInfoTyped{409, &NfcInterface::StopDetection, "StopDetection"}, - FunctionInfoTyped{410, &NfcInterface::GetTagInfo, "GetTagInfo"}, - FunctionInfoTyped{411, &NfcInterface::AttachActivateEvent, "AttachActivateEvent"}, - FunctionInfoTyped{412, &NfcInterface::AttachDeactivateEvent, "AttachDeactivateEvent"}, - FunctionInfoTyped{1000, &NfcInterface::ReadMifare, "ReadMifare"}, - FunctionInfoTyped{1001, &NfcInterface::WriteMifare ,"WriteMifare"}, - FunctionInfoTyped{1300, &NfcInterface::SendCommandByPassThrough, "SendCommandByPassThrough"}, - FunctionInfoTyped{1301, nullptr, "KeepPassThroughSession"}, - FunctionInfoTyped{1302, nullptr, "ReleasePassThroughSession"} - ); }; class ISystem final : public NfcInterface { public: - explicit ISystem(Core::System& system_) : NfcInterface{system_, "NFC::ISystem", BackendType::Nfc} {} + explicit ISystem(Core::System& system_) + : NfcInterface{system_, "NFC::ISystem", BackendType::Nfc} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &NfcInterface::Initialize, "InitializeOld"}, + {1, &NfcInterface::Finalize, "FinalizeOld"}, + {2, &NfcInterface::GetState, "GetStateOld"}, + {3, &NfcInterface::IsNfcEnabled, "IsNfcEnabledOld"}, + {100, &NfcInterface::SetNfcEnabled, "SetNfcEnabledOld"}, + {400, &NfcInterface::Initialize, "Initialize"}, + {401, &NfcInterface::Finalize, "Finalize"}, + {402, &NfcInterface::GetState, "GetState"}, + {403, &NfcInterface::IsNfcEnabled, "IsNfcEnabled"}, + {404, &NfcInterface::ListDevices, "ListDevices"}, + {405, &NfcInterface::GetDeviceState, "GetDeviceState"}, + {406, &NfcInterface::GetNpadId, "GetNpadId"}, + {407, &NfcInterface::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, + {408, &NfcInterface::StartDetection, "StartDetection"}, + {409, &NfcInterface::StopDetection, "StopDetection"}, + {410, &NfcInterface::GetTagInfo, "GetTagInfo"}, + {411, &NfcInterface::AttachActivateEvent, "AttachActivateEvent"}, + {412, &NfcInterface::AttachDeactivateEvent, "AttachDeactivateEvent"}, + {500, &NfcInterface::SetNfcEnabled, "SetNfcEnabled"}, + {510, nullptr, "OutputTestWave"}, + {1000, &NfcInterface::ReadMifare, "ReadMifare"}, + {1001, &NfcInterface::WriteMifare, "WriteMifare"}, + {1300, &NfcInterface::SendCommandByPassThrough, "SendCommandByPassThrough"}, + {1301, nullptr, "KeepPassThroughSession"}, + {1302, nullptr, "ReleasePassThroughSession"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } - static constexpr auto functions = CreateStaticMapWithClass( - FunctionInfoTyped{0, &NfcInterface::Initialize, "InitializeOld"}, - FunctionInfoTyped{1, &NfcInterface::Finalize, "FinalizeOld"}, - FunctionInfoTyped{2, &NfcInterface::GetState, "GetStateOld"}, - FunctionInfoTyped{3, &NfcInterface::IsNfcEnabled, "IsNfcEnabledOld"}, - FunctionInfoTyped{100, &NfcInterface::SetNfcEnabled, "SetNfcEnabledOld"}, - FunctionInfoTyped{400, &NfcInterface::Initialize, "Initialize"}, - FunctionInfoTyped{401, &NfcInterface::Finalize, "Finalize"}, - FunctionInfoTyped{402, &NfcInterface::GetState, "GetState"}, - FunctionInfoTyped{403, &NfcInterface::IsNfcEnabled, "IsNfcEnabled"}, - FunctionInfoTyped{404, &NfcInterface::ListDevices, "ListDevices"}, - FunctionInfoTyped{405, &NfcInterface::GetDeviceState, "GetDeviceState"}, - FunctionInfoTyped{406, &NfcInterface::GetNpadId, "GetNpadId"}, - FunctionInfoTyped{407, &NfcInterface::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, - FunctionInfoTyped{408, &NfcInterface::StartDetection, "StartDetection"}, - FunctionInfoTyped{409, &NfcInterface::StopDetection, "StopDetection"}, - FunctionInfoTyped{410, &NfcInterface::GetTagInfo, "GetTagInfo"}, - FunctionInfoTyped{411, &NfcInterface::AttachActivateEvent, "AttachActivateEvent"}, - FunctionInfoTyped{412, &NfcInterface::AttachDeactivateEvent, "AttachDeactivateEvent"}, - FunctionInfoTyped{500, &NfcInterface::SetNfcEnabled, "SetNfcEnabled"}, - FunctionInfoTyped{510, nullptr, "OutputTestWave"}, - FunctionInfoTyped{1000, &NfcInterface::ReadMifare, "ReadMifare"}, - FunctionInfoTyped{1001, &NfcInterface::WriteMifare, "WriteMifare"}, - FunctionInfoTyped{1300, &NfcInterface::SendCommandByPassThrough, "SendCommandByPassThrough"}, - FunctionInfoTyped{1301, nullptr, "KeepPassThroughSession"}, - FunctionInfoTyped{1302, nullptr, "ReleasePassThroughSession"} - ); }; // MFInterface has an unique interface but it's identical to NfcInterface so we can keep the code @@ -90,49 +93,56 @@ public: using MFInterface = NfcInterface; class MFIUser final : public MFInterface { public: - explicit MFIUser(Core::System& system_) : MFInterface{system_, "NFC::MFInterface", BackendType::Mifare} {} + explicit MFIUser(Core::System& system_) + : MFInterface{system_, "NFC::MFInterface", BackendType::Mifare} { + // clang-format off + static const FunctionInfoTyped functions[] = { + {0, &MFIUser::Initialize, "Initialize"}, + {1, &MFIUser::Finalize, "Finalize"}, + {2, &MFIUser::ListDevices, "ListDevices"}, + {3, &MFIUser::StartDetection, "StartDetection"}, + {4, &MFIUser::StopDetection, "StopDetection"}, + {5, &MFIUser::ReadMifare, "Read"}, + {6, &MFIUser::WriteMifare, "Write"}, + {7, &MFIUser::GetTagInfo, "GetTagInfo"}, + {8, &MFIUser::AttachActivateEvent, "GetActivateEventHandle"}, + {9, &MFIUser::AttachDeactivateEvent, "GetDeactivateEventHandle"}, + {10, &MFIUser::GetState, "GetState"}, + {11, &MFIUser::GetDeviceState, "GetDeviceState"}, + {12, &MFIUser::GetNpadId, "GetNpadId"}, + {13, &MFIUser::AttachAvailabilityChangeEvent, "GetAvailabilityChangeEventHandle"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } - static constexpr auto functions = CreateStaticMapWithClass( - FunctionInfoTyped{0, &MFIUser::Initialize, "Initialize"}, - FunctionInfoTyped{1, &MFIUser::Finalize, "Finalize"}, - FunctionInfoTyped{2, &MFIUser::ListDevices, "ListDevices"}, - FunctionInfoTyped{3, &MFIUser::StartDetection, "StartDetection"}, - FunctionInfoTyped{4, &MFIUser::StopDetection, "StopDetection"}, - FunctionInfoTyped{5, &MFIUser::ReadMifare, "Read"}, - FunctionInfoTyped{6, &MFIUser::WriteMifare, "Write"}, - FunctionInfoTyped{7, &MFIUser::GetTagInfo, "GetTagInfo"}, - FunctionInfoTyped{8, &MFIUser::AttachActivateEvent, "GetActivateEventHandle"}, - FunctionInfoTyped{9, &MFIUser::AttachDeactivateEvent, "GetDeactivateEventHandle"}, - FunctionInfoTyped{10, &MFIUser::GetState, "GetState"}, - FunctionInfoTyped{11, &MFIUser::GetDeviceState, "GetDeviceState"}, - FunctionInfoTyped{12, &MFIUser::GetNpadId, "GetNpadId"}, - FunctionInfoTyped{13, &MFIUser::AttachAvailabilityChangeEvent, "GetAvailabilityChangeEventHandle"} - ); }; class IAm final : public ServiceFramework { public: - explicit IAm(Core::System& system_) : ServiceFramework{system_, "NFC::IAm"} {} + explicit IAm(Core::System& system_) : ServiceFramework{system_, "NFC::IAm"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "Initialize"}, + {1, nullptr, "Finalize"}, + {2, nullptr, "NotifyForegroundApplet"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "Initialize"}, - FunctionInfo{1, nullptr, "Finalize"}, - FunctionInfo{2, nullptr, "NotifyForegroundApplet"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; class NFC_AM final : public ServiceFramework { public: - explicit NFC_AM(Core::System& system_) : ServiceFramework{system_, "nfc:am"} {} + explicit NFC_AM(Core::System& system_) : ServiceFramework{system_, "nfc:am"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &NFC_AM::CreateAmNfcInterface, "CreateAmNfcInterface"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -143,18 +153,18 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &NFC_AM::CreateAmNfcInterface, "CreateAmNfcInterface"} - ); }; class NFC_MF_U final : public ServiceFramework { public: - explicit NFC_MF_U(Core::System& system_) : ServiceFramework{system_, "nfc:mf:u"} {} + explicit NFC_MF_U(Core::System& system_) : ServiceFramework{system_, "nfc:mf:u"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &NFC_MF_U::CreateUserNfcInterface, "CreateUserNfcInterface"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -165,18 +175,18 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &NFC_MF_U::CreateUserNfcInterface, "CreateUserNfcInterface"} - ); }; class NFC_U final : public ServiceFramework { public: - explicit NFC_U(Core::System& system_) : ServiceFramework{system_, "nfc:user"} {} + explicit NFC_U(Core::System& system_) : ServiceFramework{system_, "nfc:user"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &NFC_U::CreateUserNfcInterface, "CreateUserNfcInterface"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -187,18 +197,18 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &NFC_U::CreateUserNfcInterface, "CreateUserNfcInterface"} - ); }; class NFC_SYS final : public ServiceFramework { public: - explicit NFC_SYS(Core::System& system_) : ServiceFramework{system_, "nfc:sys"} {} + explicit NFC_SYS(Core::System& system_) : ServiceFramework{system_, "nfc:sys"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &NFC_SYS::CreateSystemNfcInterface, "CreateSystemNfcInterface"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -209,10 +219,6 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &NFC_SYS::CreateSystemNfcInterface, "CreateSystemNfcInterface"} - ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/nfc/nfc.h b/src/core/hle/service/nfc/nfc.h index d15955b755..bfda30d6f1 100644 --- a/src/core/hle/service/nfc/nfc.h +++ b/src/core/hle/service/nfc/nfc.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/nfc/nfc_interface.h b/src/core/hle/service/nfc/nfc_interface.h index 5cc0d8ec04..a1e0d8d9ca 100644 --- a/src/core/hle/service/nfc/nfc_interface.h +++ b/src/core/hle/service/nfc/nfc_interface.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/nfc/nfc_result.h b/src/core/hle/service/nfc/nfc_result.h index 464b5fd69a..aab83c326c 100644 --- a/src/core/hle/service/nfc/nfc_result.h +++ b/src/core/hle/service/nfc/nfc_result.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/core/hle/service/nfc/nfc_types.h b/src/core/hle/service/nfc/nfc_types.h index 6d44014ea1..6774a9b4d6 100644 --- a/src/core/hle/service/nfc/nfc_types.h +++ b/src/core/hle/service/nfc/nfc_types.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project diff --git a/src/core/hle/service/nfp/nfp.cpp b/src/core/hle/service/nfp/nfp.cpp index bfeb7d5553..e0c24679ab 100644 --- a/src/core/hle/service/nfp/nfp.cpp +++ b/src/core/hle/service/nfp/nfp.cpp @@ -14,134 +14,145 @@ namespace Service::NFP { class IUser final : public Interface { public: - explicit IUser(Core::System& system_) : Interface(system_, "NFP:IUser") {} + explicit IUser(Core::System& system_) : Interface(system_, "NFP:IUser") { + // clang-format off + static const FunctionInfoTyped functions[] = { + {0, &IUser::Initialize, "Initialize"}, + {1, &IUser::Finalize, "Finalize"}, + {2, &IUser::ListDevices, "ListDevices"}, + {3, &IUser::StartDetection, "StartDetection"}, + {4, &IUser::StopDetection, "StopDetection"}, + {5, &IUser::Mount, "Mount"}, + {6, &IUser::Unmount, "Unmount"}, + {7, &IUser::OpenApplicationArea, "OpenApplicationArea"}, + {8, &IUser::GetApplicationArea, "GetApplicationArea"}, + {9, &IUser::SetApplicationArea, "SetApplicationArea"}, + {10, &IUser::Flush, "Flush"}, + {11, &IUser::Restore, "Restore"}, + {12, &IUser::CreateApplicationArea, "CreateApplicationArea"}, + {13, &IUser::GetTagInfo, "GetTagInfo"}, + {14, &IUser::GetRegisterInfo, "GetRegisterInfo"}, + {15, &IUser::GetCommonInfo, "GetCommonInfo"}, + {16, &IUser::GetModelInfo, "GetModelInfo"}, + {17, &IUser::AttachActivateEvent, "AttachActivateEvent"}, + {18, &IUser::AttachDeactivateEvent, "AttachDeactivateEvent"}, + {19, &IUser::GetState, "GetState"}, + {20, &IUser::GetDeviceState, "GetDeviceState"}, + {21, &IUser::GetNpadId, "GetNpadId"}, + {22, &IUser::GetApplicationAreaSize, "GetApplicationAreaSize"}, + {23, &IUser::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, + {24, &IUser::RecreateApplicationArea, "RecreateApplicationArea"}, + {25, &IUser::StartDetection, "StartDetectionWithFilter"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } - static constexpr auto functions = CreateStaticMapWithClass( - FunctionInfoTyped{0, &IUser::Initialize, "Initialize"}, - FunctionInfoTyped{1, &IUser::Finalize, "Finalize"}, - FunctionInfoTyped{2, &IUser::ListDevices, "ListDevices"}, - FunctionInfoTyped{3, &IUser::StartDetection, "StartDetection"}, - FunctionInfoTyped{4, &IUser::StopDetection, "StopDetection"}, - FunctionInfoTyped{5, &IUser::Mount, "Mount"}, - FunctionInfoTyped{6, &IUser::Unmount, "Unmount"}, - FunctionInfoTyped{7, &IUser::OpenApplicationArea, "OpenApplicationArea"}, - FunctionInfoTyped{8, &IUser::GetApplicationArea, "GetApplicationArea"}, - FunctionInfoTyped{9, &IUser::SetApplicationArea, "SetApplicationArea"}, - FunctionInfoTyped{10, &IUser::Flush, "Flush"}, - FunctionInfoTyped{11, &IUser::Restore, "Restore"}, - FunctionInfoTyped{12, &IUser::CreateApplicationArea, "CreateApplicationArea"}, - FunctionInfoTyped{13, &IUser::GetTagInfo, "GetTagInfo"}, - FunctionInfoTyped{14, &IUser::GetRegisterInfo, "GetRegisterInfo"}, - FunctionInfoTyped{15, &IUser::GetCommonInfo, "GetCommonInfo"}, - FunctionInfoTyped{16, &IUser::GetModelInfo, "GetModelInfo"}, - FunctionInfoTyped{17, &IUser::AttachActivateEvent, "AttachActivateEvent"}, - FunctionInfoTyped{18, &IUser::AttachDeactivateEvent, "AttachDeactivateEvent"}, - FunctionInfoTyped{19, &IUser::GetState, "GetState"}, - FunctionInfoTyped{20, &IUser::GetDeviceState, "GetDeviceState"}, - FunctionInfoTyped{21, &IUser::GetNpadId, "GetNpadId"}, - FunctionInfoTyped{22, &IUser::GetApplicationAreaSize, "GetApplicationAreaSize"}, - FunctionInfoTyped{23, &IUser::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, - FunctionInfoTyped{24, &IUser::RecreateApplicationArea, "RecreateApplicationArea"}, - FunctionInfoTyped{25, &IUser::StartDetection, "StartDetectionWithFilter"} - ); }; class ISystem final : public Interface { public: - explicit ISystem(Core::System& system_) : Interface(system_, "NFP:ISystem") {} + explicit ISystem(Core::System& system_) : Interface(system_, "NFP:ISystem") { + // clang-format off + static const FunctionInfoTyped functions[] = { + {0, &ISystem::InitializeSystem, "InitializeSystem"}, + {1, &ISystem::FinalizeSystem, "FinalizeSystem"}, + {2, &ISystem::ListDevices, "ListDevices"}, + {3, &ISystem::StartDetection, "StartDetection"}, + {4, &ISystem::StopDetection, "StopDetection"}, + {5, &ISystem::Mount, "Mount"}, + {6, &ISystem::Unmount, "Unmount"}, + {10, &ISystem::Flush, "Flush"}, + {11, &ISystem::Restore, "Restore"}, + {12, &ISystem::CreateApplicationArea, "CreateApplicationArea"}, + {13, &ISystem::GetTagInfo, "GetTagInfo"}, + {14, &ISystem::GetRegisterInfo, "GetRegisterInfo"}, + {15, &ISystem::GetCommonInfo, "GetCommonInfo"}, + {16, &ISystem::GetModelInfo, "GetModelInfo"}, + {17, &ISystem::AttachActivateEvent, "AttachActivateEvent"}, + {18, &ISystem::AttachDeactivateEvent, "AttachDeactivateEvent"}, + {19, &ISystem::GetState, "GetState"}, + {20, &ISystem::GetDeviceState, "GetDeviceState"}, + {21, &ISystem::GetNpadId, "GetNpadId"}, + {23, &ISystem::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, + {25, &ISystem::StartDetection, "StartDetectionWithFilter"}, + {100, &ISystem::Format, "Format"}, + {101, &ISystem::GetAdminInfo, "GetAdminInfo"}, + {102, &ISystem::GetRegisterInfoPrivate, "GetRegisterInfoPrivate"}, + {103, &ISystem::SetRegisterInfoPrivate, "SetRegisterInfoPrivate"}, + {104, &ISystem::DeleteRegisterInfo, "DeleteRegisterInfo"}, + {105, &ISystem::DeleteApplicationArea, "DeleteApplicationArea"}, + {106, &ISystem::ExistsApplicationArea, "ExistsApplicationArea"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } - static constexpr auto functions = CreateStaticMapWithClass( - FunctionInfoTyped{0, &ISystem::InitializeSystem, "InitializeSystem"}, - FunctionInfoTyped{1, &ISystem::FinalizeSystem, "FinalizeSystem"}, - FunctionInfoTyped{2, &ISystem::ListDevices, "ListDevices"}, - FunctionInfoTyped{3, &ISystem::StartDetection, "StartDetection"}, - FunctionInfoTyped{4, &ISystem::StopDetection, "StopDetection"}, - FunctionInfoTyped{5, &ISystem::Mount, "Mount"}, - FunctionInfoTyped{6, &ISystem::Unmount, "Unmount"}, - FunctionInfoTyped{10, &ISystem::Flush, "Flush"}, - FunctionInfoTyped{11, &ISystem::Restore, "Restore"}, - FunctionInfoTyped{12, &ISystem::CreateApplicationArea, "CreateApplicationArea"}, - FunctionInfoTyped{13, &ISystem::GetTagInfo, "GetTagInfo"}, - FunctionInfoTyped{14, &ISystem::GetRegisterInfo, "GetRegisterInfo"}, - FunctionInfoTyped{15, &ISystem::GetCommonInfo, "GetCommonInfo"}, - FunctionInfoTyped{16, &ISystem::GetModelInfo, "GetModelInfo"}, - FunctionInfoTyped{17, &ISystem::AttachActivateEvent, "AttachActivateEvent"}, - FunctionInfoTyped{18, &ISystem::AttachDeactivateEvent, "AttachDeactivateEvent"}, - FunctionInfoTyped{19, &ISystem::GetState, "GetState"}, - FunctionInfoTyped{20, &ISystem::GetDeviceState, "GetDeviceState"}, - FunctionInfoTyped{21, &ISystem::GetNpadId, "GetNpadId"}, - FunctionInfoTyped{23, &ISystem::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, - FunctionInfoTyped{25, &ISystem::StartDetection, "StartDetectionWithFilter"}, - FunctionInfoTyped{100, &ISystem::Format, "Format"}, - FunctionInfoTyped{101, &ISystem::GetAdminInfo, "GetAdminInfo"}, - FunctionInfoTyped{102, &ISystem::GetRegisterInfoPrivate, "GetRegisterInfoPrivate"}, - FunctionInfoTyped{103, &ISystem::SetRegisterInfoPrivate, "SetRegisterInfoPrivate"}, - FunctionInfoTyped{104, &ISystem::DeleteRegisterInfo, "DeleteRegisterInfo"}, - FunctionInfoTyped{105, &ISystem::DeleteApplicationArea, "DeleteApplicationArea"}, - FunctionInfoTyped{106, &ISystem::ExistsApplicationArea, "ExistsApplicationArea"} - ); }; class IDebug final : public Interface { public: - explicit IDebug(Core::System& system_) : Interface(system_, "NFP:IDebug") {} + explicit IDebug(Core::System& system_) : Interface(system_, "NFP:IDebug") { + // clang-format off + static const FunctionInfoTyped functions[] = { + {0, &IDebug::InitializeDebug, "InitializeDebug"}, + {1, &IDebug::FinalizeDebug, "FinalizeDebug"}, + {2, &IDebug::ListDevices, "ListDevices"}, + {3, &IDebug::StartDetection, "StartDetection"}, + {4, &IDebug::StopDetection, "StopDetection"}, + {5, &IDebug::Mount, "Mount"}, + {6, &IDebug::Unmount, "Unmount"}, + {7, &IDebug::OpenApplicationArea, "OpenApplicationArea"}, + {8, &IDebug::GetApplicationArea, "GetApplicationArea"}, + {9, &IDebug::SetApplicationArea, "SetApplicationArea"}, + {10, &IDebug::Flush, "Flush"}, + {11, &IDebug::Restore, "Restore"}, + {12, &IDebug::CreateApplicationArea, "CreateApplicationArea"}, + {13, &IDebug::GetTagInfo, "GetTagInfo"}, + {14, &IDebug::GetRegisterInfo, "GetRegisterInfo"}, + {15, &IDebug::GetCommonInfo, "GetCommonInfo"}, + {16, &IDebug::GetModelInfo, "GetModelInfo"}, + {17, &IDebug::AttachActivateEvent, "AttachActivateEvent"}, + {18, &IDebug::AttachDeactivateEvent, "AttachDeactivateEvent"}, + {19, &IDebug::GetState, "GetState"}, + {20, &IDebug::GetDeviceState, "GetDeviceState"}, + {21, &IDebug::GetNpadId, "GetNpadId"}, + {22, &IDebug::GetApplicationAreaSize, "GetApplicationAreaSize"}, + {23, &IDebug::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, + {24, &IDebug::RecreateApplicationArea, "RecreateApplicationArea"}, + {25, &IDebug::StartDetection, "StartDetectionWithFilter"}, + {100, &IDebug::Format, "Format"}, + {101, &IDebug::GetAdminInfo, "GetAdminInfo"}, + {102, &IDebug::GetRegisterInfoPrivate, "GetRegisterInfoPrivate"}, + {103, &IDebug::SetRegisterInfoPrivate, "SetRegisterInfoPrivate"}, + {104, &IDebug::DeleteRegisterInfo, "DeleteRegisterInfo"}, + {105, &IDebug::DeleteApplicationArea, "DeleteApplicationArea"}, + {106, &IDebug::ExistsApplicationArea, "ExistsApplicationArea"}, + {200, &IDebug::GetAll, "GetAll"}, + {201, &IDebug::SetAll, "SetAll"}, + {202, &IDebug::FlushDebug, "FlushDebug"}, + {203, &IDebug::BreakTag, "BreakTag"}, + {204, &IDebug::ReadBackupData, "ReadBackupData"}, + {205, &IDebug::WriteBackupData, "WriteBackupData"}, + {206, &IDebug::WriteNtf, "WriteNtf"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } - static constexpr auto functions = CreateStaticMapWithClass( - FunctionInfoTyped{0, &IDebug::InitializeDebug, "InitializeDebug"}, - FunctionInfoTyped{1, &IDebug::FinalizeDebug, "FinalizeDebug"}, - FunctionInfoTyped{2, &IDebug::ListDevices, "ListDevices"}, - FunctionInfoTyped{3, &IDebug::StartDetection, "StartDetection"}, - FunctionInfoTyped{4, &IDebug::StopDetection, "StopDetection"}, - FunctionInfoTyped{5, &IDebug::Mount, "Mount"}, - FunctionInfoTyped{6, &IDebug::Unmount, "Unmount"}, - FunctionInfoTyped{7, &IDebug::OpenApplicationArea, "OpenApplicationArea"}, - FunctionInfoTyped{8, &IDebug::GetApplicationArea, "GetApplicationArea"}, - FunctionInfoTyped{9, &IDebug::SetApplicationArea, "SetApplicationArea"}, - FunctionInfoTyped{10, &IDebug::Flush, "Flush"}, - FunctionInfoTyped{11, &IDebug::Restore, "Restore"}, - FunctionInfoTyped{12, &IDebug::CreateApplicationArea, "CreateApplicationArea"}, - FunctionInfoTyped{13, &IDebug::GetTagInfo, "GetTagInfo"}, - FunctionInfoTyped{14, &IDebug::GetRegisterInfo, "GetRegisterInfo"}, - FunctionInfoTyped{15, &IDebug::GetCommonInfo, "GetCommonInfo"}, - FunctionInfoTyped{16, &IDebug::GetModelInfo, "GetModelInfo"}, - FunctionInfoTyped{17, &IDebug::AttachActivateEvent, "AttachActivateEvent"}, - FunctionInfoTyped{18, &IDebug::AttachDeactivateEvent, "AttachDeactivateEvent"}, - FunctionInfoTyped{19, &IDebug::GetState, "GetState"}, - FunctionInfoTyped{20, &IDebug::GetDeviceState, "GetDeviceState"}, - FunctionInfoTyped{21, &IDebug::GetNpadId, "GetNpadId"}, - FunctionInfoTyped{22, &IDebug::GetApplicationAreaSize, "GetApplicationAreaSize"}, - FunctionInfoTyped{23, &IDebug::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, - FunctionInfoTyped{24, &IDebug::RecreateApplicationArea, "RecreateApplicationArea"}, - FunctionInfoTyped{25, &IDebug::StartDetection, "StartDetectionWithFilter"}, - FunctionInfoTyped{100, &IDebug::Format, "Format"}, - FunctionInfoTyped{101, &IDebug::GetAdminInfo, "GetAdminInfo"}, - FunctionInfoTyped{102, &IDebug::GetRegisterInfoPrivate, "GetRegisterInfoPrivate"}, - FunctionInfoTyped{103, &IDebug::SetRegisterInfoPrivate, "SetRegisterInfoPrivate"}, - FunctionInfoTyped{104, &IDebug::DeleteRegisterInfo, "DeleteRegisterInfo"}, - FunctionInfoTyped{105, &IDebug::DeleteApplicationArea, "DeleteApplicationArea"}, - FunctionInfoTyped{106, &IDebug::ExistsApplicationArea, "ExistsApplicationArea"}, - FunctionInfoTyped{200, &IDebug::GetAll, "GetAll"}, - FunctionInfoTyped{201, &IDebug::SetAll, "SetAll"}, - FunctionInfoTyped{202, &IDebug::FlushDebug, "FlushDebug"}, - FunctionInfoTyped{203, &IDebug::BreakTag, "BreakTag"}, - FunctionInfoTyped{204, &IDebug::ReadBackupData, "ReadBackupData"}, - FunctionInfoTyped{205, &IDebug::WriteBackupData, "WriteBackupData"}, - FunctionInfoTyped{206, &IDebug::WriteNtf, "WriteNtf"} - ); }; class IUserManager final : public ServiceFramework { public: - explicit IUserManager(Core::System& system_) : ServiceFramework{system_, "nfp:user"} {} + explicit IUserManager(Core::System& system_) : ServiceFramework{system_, "nfp:user"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &IUserManager::CreateUserInterface, "CreateUserInterface"}, + }; + // clang-format on + + RegisterHandlers(functions); + } private: void CreateUserInterface(HLERequestContext& ctx) { @@ -151,21 +162,18 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &IUserManager::CreateUserInterface, "CreateUserInterface"} - ); }; class ISystemManager final : public ServiceFramework { public: - explicit ISystemManager(Core::System& system_) : ServiceFramework{system_, "nfp:sys"} {} + explicit ISystemManager(Core::System& system_) : ServiceFramework{system_, "nfp:sys"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &ISystemManager::CreateSystemInterface, "CreateSystemInterface"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -176,18 +184,18 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &ISystemManager::CreateSystemInterface, "CreateSystemInterface"} - ); }; class IDebugManager final : public ServiceFramework { public: - explicit IDebugManager(Core::System& system_) : ServiceFramework{system_, "nfp:dbg"} {} + explicit IDebugManager(Core::System& system_) : ServiceFramework{system_, "nfp:dbg"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &IDebugManager::CreateDebugInterface, "CreateDebugInterface"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -198,10 +206,6 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &IDebugManager::CreateDebugInterface, "CreateDebugInterface"} - ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/nfp/nfp.h b/src/core/hle/service/nfp/nfp.h index a5aac710b5..e7af7ae39d 100644 --- a/src/core/hle/service/nfp/nfp.h +++ b/src/core/hle/service/nfp/nfp.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/nfp/nfp_interface.h b/src/core/hle/service/nfp/nfp_interface.h index fa985b068e..531db84652 100644 --- a/src/core/hle/service/nfp/nfp_interface.h +++ b/src/core/hle/service/nfp/nfp_interface.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/nfp/nfp_result.h b/src/core/hle/service/nfp/nfp_result.h index 6185338438..528b5417fa 100644 --- a/src/core/hle/service/nfp/nfp_result.h +++ b/src/core/hle/service/nfp/nfp_result.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/nfp/nfp_types.h b/src/core/hle/service/nfp/nfp_types.h index 8330134d18..108548ea46 100644 --- a/src/core/hle/service/nfp/nfp_types.h +++ b/src/core/hle/service/nfp/nfp_types.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project diff --git a/src/core/hle/service/ngc/ngc.cpp b/src/core/hle/service/ngc/ngc.cpp index fb3ef39093..e79108a1eb 100644 --- a/src/core/hle/service/ngc/ngc.cpp +++ b/src/core/hle/service/ngc/ngc.cpp @@ -21,10 +21,15 @@ namespace Service::NGC { class IService final : public ServiceFramework { public: - explicit IService(Core::System& system_) : ServiceFramework{system_, "ngct:u"} {} + explicit IService(Core::System& system_) : ServiceFramework{system_, "ngct:u"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &IService::Match, "Match"}, + {1, &IService::Filter, "Filter"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -56,19 +61,23 @@ private: IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &IService::Match, "Match"}, - FunctionInfo{1, &IService::Filter, "Filter"} - ); }; class NgcServiceImpl final : public ServiceFramework { public: - explicit NgcServiceImpl(Core::System& system_) : ServiceFramework(system_, "ngc:u") {} + explicit NgcServiceImpl(Core::System& system_) : ServiceFramework(system_, "ngc:u") { + // clang-format off + static const FunctionInfo functions[] = { + {0, &NgcServiceImpl::GetContentVersion, "GetContentVersion"}, + {1, &NgcServiceImpl::Check, "Check"}, + {2, &NgcServiceImpl::Mask, "Mask"}, + {3, &NgcServiceImpl::Reload, "Reload"}, + {4, &NgcServiceImpl::Check, "Check2"}, + {5, &NgcServiceImpl::Mask, "Mask2"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -141,34 +150,25 @@ private: IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &NgcServiceImpl::GetContentVersion, "GetContentVersion"}, - FunctionInfo{1, &NgcServiceImpl::Check, "Check"}, - FunctionInfo{2, &NgcServiceImpl::Mask, "Mask"}, - FunctionInfo{3, &NgcServiceImpl::Reload, "Reload"}, - FunctionInfo{4, &NgcServiceImpl::Check, "Check2"}, - FunctionInfo{5, &NgcServiceImpl::Mask, "Mask2"} - ); }; class IServiceWithManagementApi final : public ServiceFramework { public: - explicit IServiceWithManagementApi(Core::System& system_) : ServiceFramework(system_, "ngct:s") {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "Match"}, - FunctionInfo{1, nullptr, "Filter"}, - FunctionInfo{100, nullptr, "ConfigureAutoUpdateSetting"}, - FunctionInfo{101, nullptr, "RequestResourceUpdateCheck"}, - FunctionInfo{110, nullptr, "Reload"}, - FunctionInfo{111, nullptr, "IsReloadRequired"}, - FunctionInfo{112, nullptr, "TryAcquireReloadRequestNotifier"}, - FunctionInfo{120, nullptr, "CalculateContentFingerprint"}, - FunctionInfo{130, nullptr, "TryEnableTemporalPassThrough"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit IServiceWithManagementApi(Core::System& system_) : ServiceFramework(system_, "ngct:s") { + // clang-format off + static const FunctionInfo functions[] = { + {0 , nullptr, "Match"}, + {1 , nullptr, "Filter"}, + {100, nullptr, "ConfigureAutoUpdateSetting"}, + {101, nullptr, "RequestResourceUpdateCheck"}, + {110, nullptr, "Reload"}, + {111, nullptr, "IsReloadRequired"}, + {112, nullptr, "TryAcquireReloadRequestNotifier"}, + {120, nullptr, "CalculateContentFingerprint"}, + {130, nullptr, "TryEnableTemporalPassThrough"}, + }; + // clang-format on + RegisterHandlers(functions); } }; @@ -179,10 +179,20 @@ static_assert(sizeof(SaveDataHandle) == 0x08); class IUserShimScopedObject final : public ServiceFramework { public: - explicit IUserShimScopedObject(Core::System& system_) : ServiceFramework(system_, "IUserShimScopedObject") {} - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit IUserShimScopedObject(Core::System& system_) : ServiceFramework(system_, "IUserShimScopedObject") { + // clang-format off + static const FunctionInfo functions[] = { + {450, nullptr, "InitializeForSaveData"}, + {451, nullptr, "FinalizeForSaveData"}, + {452, D<&IUserShimScopedObject::OpenSaveData>, "OpenSaveData"}, + {453, nullptr, "CloseSaveData"}, + {454, D<&IUserShimScopedObject::ReadSaveSlot>, "ReadSaveSlot"}, + {455, D<&IUserShimScopedObject::WriteSaveSlot>, "WriteSaveSlot"}, + {456, nullptr, "FlushSaveSlot"}, + {457, nullptr, "CommitSaveData"}, + }; + // clang-format on + RegisterHandlers(functions); } Result OpenSaveData(Account::Uid unk0, Out unk1) { @@ -200,43 +210,42 @@ public: // to implement R_SUCCEED(); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{450, nullptr, "InitializeForSaveData"}, - FunctionInfo{451, nullptr, "FinalizeForSaveData"}, - FunctionInfo{452, D<&IUserShimScopedObject::OpenSaveData>, "OpenSaveData"}, - FunctionInfo{453, nullptr, "CloseSaveData"}, - FunctionInfo{454, D<&IUserShimScopedObject::ReadSaveSlot>, "ReadSaveSlot"}, - FunctionInfo{455, D<&IUserShimScopedObject::WriteSaveSlot>, "WriteSaveSlot"}, - FunctionInfo{456, nullptr, "FlushSaveSlot"}, - FunctionInfo{457, nullptr, "CommitSaveData"} - ); }; class IUserService final : public ServiceFramework { public: - explicit IUserService(Core::System& system_) : ServiceFramework(system_, "stpl:u") {} - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit IUserService(Core::System& system_) : ServiceFramework(system_, "stpl:u") { + // clang-format off + static const FunctionInfo functions[] = { + {0 , D<&IUserService::Cmd0>, "Cmd0"}, + }; + // clang-format on + RegisterHandlers(functions); } Result Cmd0(u32 unk0, OutInterface out_interface) { LOG_WARNING(Service_NGC, "stubbed"); *out_interface = std::make_shared(system); R_SUCCEED(); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IUserService::Cmd0>, "Cmd0"} - ); }; class ISystemShimScopedObject final : public ServiceFramework { public: - explicit ISystemShimScopedObject(Core::System& system_) : ServiceFramework(system_, "ISystemShimScopedObject") {} - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit ISystemShimScopedObject(Core::System& system_) : ServiceFramework(system_, "ISystemShimScopedObject") { + // clang-format off + static const FunctionInfo functions[] = { + {106, nullptr, "Cmd106"}, + {107, nullptr, "Cmd107"}, + {108, D<&ISystemShimScopedObject::Cmd108>, "Cmd108"}, + {207, nullptr, "Cmd207"}, + {208, D<&ISystemShimScopedObject::Cmd208>, "Cmd208"}, + {209, nullptr, "Cmd209"}, + {210, nullptr, "Cmd210"}, + {211, nullptr, "Cmd211"}, + {212, nullptr, "Cmd212"}, + }; + // clang-format on + RegisterHandlers(functions); } Result Cmd108() { @@ -248,36 +257,23 @@ public: LOG_WARNING(Service_NGC, "stubbed"); R_THROW(IPC::ResultNotSupported); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{106, nullptr, "Cmd106"}, - FunctionInfo{107, nullptr, "Cmd107"}, - FunctionInfo{108, D<&ISystemShimScopedObject::Cmd108>, "Cmd108"}, - FunctionInfo{207, nullptr, "Cmd207"}, - FunctionInfo{208, D<&ISystemShimScopedObject::Cmd208>, "Cmd208"}, - FunctionInfo{209, nullptr, "Cmd209"}, - FunctionInfo{210, nullptr, "Cmd210"}, - FunctionInfo{211, nullptr, "Cmd211"}, - FunctionInfo{212, nullptr, "Cmd212"} - ); }; class ISystemService final : public ServiceFramework { public: - explicit ISystemService(Core::System& system_) : ServiceFramework(system_, "stpl:sys") {} - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit ISystemService(Core::System& system_) : ServiceFramework(system_, "stpl:sys") { + // clang-format off + static const FunctionInfo functions[] = { + {0 , D<&ISystemService::Cmd0>, "Cmd0"}, + }; + // clang-format on + RegisterHandlers(functions); } Result Cmd0(OutInterface out_interface) { LOG_WARNING(Service_NGC, "stubbed"); *out_interface = std::make_shared(system); R_SUCCEED(); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&ISystemService::Cmd0>, "Cmd0"} - ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/ngc/ngc.h b/src/core/hle/service/ngc/ngc.h index 823b1aa819..7dc4a46577 100644 --- a/src/core/hle/service/ngc/ngc.h +++ b/src/core/hle/service/ngc/ngc.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp index 5befe8e943..efada9b807 100644 --- a/src/core/hle/service/nifm/nifm.cpp +++ b/src/core/hle/service/nifm/nifm.cpp @@ -235,6 +235,15 @@ public: explicit IScanRequest(Core::System& system_) : ServiceFramework{system_, "IScanRequest"}, svc_ctx{system_, "IScanRequest"} { + static const FunctionInfo functions[] = { + {0, &IScanRequest::Submit, "Submit"}, + {1, &IScanRequest::IsProcessing, "IsProcessing"}, + {2, &IScanRequest::GetResult, "GetResult"}, + {3, &IScanRequest::GetSystemEventReadableHandle, "GetSystemEventReadableHandle"}, + {4, &IScanRequest::SetChannels, "SetChannels"}, + }; + RegisterHandlers(functions); + evt_scan_complete = CreateKEvent(svc_ctx, "IScanRequest:Complete"); evt_processing = CreateKEvent(svc_ctx, "IScanRequest:Processing"); } @@ -248,6 +257,8 @@ public: } private: + std::vector scan_results; + void Submit(HLERequestContext& ctx) { if (state.load() == State::Finished) { @@ -318,17 +329,6 @@ private: evt_scan_complete->Signal(system.Kernel()); } - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &IScanRequest::Submit, "Submit"}, - FunctionInfo{1, &IScanRequest::IsProcessing, "IsProcessing"}, - FunctionInfo{2, &IScanRequest::GetResult, "GetResult"}, - FunctionInfo{3, &IScanRequest::GetSystemEventReadableHandle, "GetSystemEventReadableHandle"}, - FunctionInfo{4, &IScanRequest::SetChannels, "SetChannels"} - ); - std::vector scan_results; KernelHelpers::ServiceContext svc_ctx; Kernel::KEvent* evt_scan_complete{}; @@ -342,6 +342,36 @@ class IRequest final : public ServiceFramework { public: explicit IRequest(Core::System& system_) : ServiceFramework{system_, "IRequest"}, service_context{system_, "IRequest"} { + static const FunctionInfo functions[] = { + {0, &IRequest::GetRequestState, "GetRequestState"}, + {1, &IRequest::GetResult, "GetResult"}, + {2, &IRequest::GetSystemEventReadableHandles, "GetSystemEventReadableHandles"}, + {3, &IRequest::Cancel, "Cancel"}, + {4, &IRequest::Submit, "Submit"}, + {5, nullptr, "SetRequirement"}, + {6, &IRequest::SetRequirementPreset, "SetRequirementPreset"}, + {8, nullptr, "SetPriority"}, + {9, &IRequest::SetNetworkProfileId, "SetNetworkProfileId"}, + {10, nullptr, "SetRejectable"}, + {11, &IRequest::SetConnectionConfirmationOption, "SetConnectionConfirmationOption"}, + {12, nullptr, "SetPersistent"}, + {13, nullptr, "SetInstant"}, + {14, nullptr, "SetSustainable"}, + {15, nullptr, "SetRawPriority"}, + {16, nullptr, "SetGreedy"}, + {17, nullptr, "SetSharable"}, + {18, nullptr, "SetRequirementByRevision"}, + {19, nullptr, "GetRequirement"}, + {20, nullptr, "GetRevision"}, + {21, &IRequest::GetAppletInfo, "GetAppletInfo"}, + {22, nullptr, "GetAdditionalInfo"}, + {23, nullptr, "SetKeptInSleep"}, + {24, nullptr, "RegisterSocketDescriptor"}, + {25, nullptr, "UnregisterSocketDescriptor"}, + {26, nullptr, "GetNetworkAccessStatus"}, //21.0.0+ + }; + RegisterHandlers(functions); + event1 = CreateKEvent(service_context, "IRequest:Event1"); event2 = CreateKEvent(service_context, "IRequest:Event2"); state = RequestState::NotSubmitted; @@ -464,37 +494,6 @@ private: event1->Signal(system.Kernel()); } - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &IRequest::GetRequestState, "GetRequestState"}, - FunctionInfo{1, &IRequest::GetResult, "GetResult"}, - FunctionInfo{2, &IRequest::GetSystemEventReadableHandles, "GetSystemEventReadableHandles"}, - FunctionInfo{3, &IRequest::Cancel, "Cancel"}, - FunctionInfo{4, &IRequest::Submit, "Submit"}, - FunctionInfo{5, nullptr, "SetRequirement"}, - FunctionInfo{6, &IRequest::SetRequirementPreset, "SetRequirementPreset"}, - FunctionInfo{8, nullptr, "SetPriority"}, - FunctionInfo{9, &IRequest::SetNetworkProfileId, "SetNetworkProfileId"}, - FunctionInfo{10, nullptr, "SetRejectable"}, - FunctionInfo{11, &IRequest::SetConnectionConfirmationOption, "SetConnectionConfirmationOption"}, - FunctionInfo{12, nullptr, "SetPersistent"}, - FunctionInfo{13, nullptr, "SetInstant"}, - FunctionInfo{14, nullptr, "SetSustainable"}, - FunctionInfo{15, nullptr, "SetRawPriority"}, - FunctionInfo{16, nullptr, "SetGreedy"}, - FunctionInfo{17, nullptr, "SetSharable"}, - FunctionInfo{18, nullptr, "SetRequirementByRevision"}, - FunctionInfo{19, nullptr, "GetRequirement"}, - FunctionInfo{20, nullptr, "GetRevision"}, - FunctionInfo{21, &IRequest::GetAppletInfo, "GetAppletInfo"}, - FunctionInfo{22, nullptr, "GetAdditionalInfo"}, - FunctionInfo{23, nullptr, "SetKeptInSleep"}, - FunctionInfo{24, nullptr, "RegisterSocketDescriptor"}, - FunctionInfo{25, nullptr, "UnregisterSocketDescriptor"}, - FunctionInfo{26, nullptr, "GetNetworkAccessStatus", MakeVersionGate({21,0,0})} - ); KernelHelpers::ServiceContext service_context; RequestState state; @@ -509,16 +508,14 @@ private: class INetworkProfile final : public ServiceFramework { public: - explicit INetworkProfile(Core::System& system_) : ServiceFramework{system_, "INetworkProfile"} {} - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit INetworkProfile(Core::System& system_) : ServiceFramework{system_, "INetworkProfile"} { + static const FunctionInfo functions[] = { + {0, nullptr, "Update"}, + {1, nullptr, "PersistOld"}, + {2, nullptr, "Persist"}, + }; + RegisterHandlers(functions); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "Update"}, - FunctionInfo{1, nullptr, "PersistOld"}, - FunctionInfo{2, nullptr, "Persist"} - ); }; void IGeneralService::GetClientId(HLERequestContext& ctx) { @@ -1053,70 +1050,78 @@ void IGeneralService::GetCurrentAccessPoint(HLERequestContext& ctx) { rb.Push(ResultSuccess); } -std::optional IGeneralService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{1, &IGeneralService::GetClientId, "GetClientId"}, - FunctionInfo{2, &IGeneralService::CreateScanRequest, "CreateScanRequest"}, - FunctionInfo{4, &IGeneralService::CreateRequest, "CreateRequest"}, - FunctionInfo{5, &IGeneralService::GetCurrentNetworkProfile, "GetCurrentNetworkProfile"}, - FunctionInfo{6, &IGeneralService::EnumerateNetworkInterfaces, "EnumerateNetworkInterfaces"}, - FunctionInfo{7, &IGeneralService::EnumerateNetworkProfiles, "EnumerateNetworkProfiles"}, - FunctionInfo{8, &IGeneralService::GetNetworkProfile, "GetNetworkProfile"}, - FunctionInfo{9, &IGeneralService::SetNetworkProfile, "SetNetworkProfile"}, - FunctionInfo{10, &IGeneralService::RemoveNetworkProfile, "RemoveNetworkProfile"}, - FunctionInfo{11, &IGeneralService::GetScanData, "GetScanDataOld"}, - FunctionInfo{12, &IGeneralService::GetCurrentIpAddress, "GetCurrentIpAddress"}, - FunctionInfo{13, nullptr, "GetCurrentAccessPointOld"}, - FunctionInfo{14, &IGeneralService::CreateTemporaryNetworkProfile, "CreateTemporaryNetworkProfile"}, - FunctionInfo{15, &IGeneralService::GetCurrentIpConfigInfo, "GetCurrentIpConfigInfo"}, - FunctionInfo{16, &IGeneralService::SetWirelessCommunicationEnabled, "SetWirelessCommunicationEnabled"}, - FunctionInfo{17, &IGeneralService::IsWirelessCommunicationEnabled, "IsWirelessCommunicationEnabled"}, - FunctionInfo{18, &IGeneralService::GetInternetConnectionStatus, "GetInternetConnectionStatus"}, - FunctionInfo{19, &IGeneralService::SetEthernetCommunicationEnabled, "SetEthernetCommunicationEnabled"}, - FunctionInfo{20, &IGeneralService::IsEthernetCommunicationEnabled, "IsEthernetCommunicationEnabled"}, - FunctionInfo{21, &IGeneralService::IsAnyInternetRequestAccepted, "IsAnyInternetRequestAccepted"}, - FunctionInfo{22, &IGeneralService::IsAnyForegroundRequestAccepted, "IsAnyForegroundRequestAccepted"}, - FunctionInfo{23, nullptr, "PutToSleep"}, - FunctionInfo{24, nullptr, "WakeUp"}, - FunctionInfo{25, &IGeneralService::GetSsidListVersion, "GetSsidListVersion"}, - FunctionInfo{26, nullptr, "SetExclusiveClient"}, - FunctionInfo{27, nullptr, "GetDefaultIpSetting"}, - FunctionInfo{28, nullptr, "SetDefaultIpSetting"}, - FunctionInfo{29, nullptr, "SetWirelessCommunicationEnabledForTest"}, - FunctionInfo{30, nullptr, "SetEthernetCommunicationEnabledForTest"}, - FunctionInfo{31, nullptr, "GetTelemetorySystemEventReadableHandle"}, - FunctionInfo{32, nullptr, "GetTelemetryInfo"}, - FunctionInfo{33, &IGeneralService::ConfirmSystemAvailability, "ConfirmSystemAvailability", MakeVersionGate({2,0,0})}, - FunctionInfo{34, &IGeneralService::SetBackgroundRequestEnabled, "SetBackgroundRequestEnabled", MakeVersionGate({4,0,0})}, - FunctionInfo{35, &IGeneralService::GetScanDataV2, "GetScanData"}, - FunctionInfo{36, &IGeneralService::GetCurrentAccessPoint, "GetCurrentAccessPoint"}, - FunctionInfo{37, nullptr, "Shutdown"}, - FunctionInfo{38, nullptr, "GetAllowedChannels"}, - FunctionInfo{39, nullptr, "NotifyApplicationSuspended"}, - FunctionInfo{40, nullptr, "SetAcceptableNetworkTypeFlag"}, - FunctionInfo{41, nullptr, "GetAcceptableNetworkTypeFlag"}, - FunctionInfo{42, nullptr, "NotifyConnectionStateChanged"}, - FunctionInfo{43, nullptr, "SetWowlDelayedWakeTime"}, - FunctionInfo{44, nullptr, "IsWiredConnectionAvailable", MakeVersionGate({18,0,0})}, - FunctionInfo{45, nullptr, "IsNetworkEmulationFeatureEnabled", MakeVersionGate({18,0,0})}, - FunctionInfo{46, nullptr, "SelectActiveNetworkEmulationProfileIdForDebug", MakeVersionGate({18,0,0})}, - FunctionInfo{47, &IGeneralService::GetScanDataV3, "GetScanData", MakeVersionGate({19,0,0})}, - FunctionInfo{50, nullptr, "IsRewriteFeatureEnabled", MakeVersionGate({18,0,0})}, - FunctionInfo{51, nullptr, "CreateRewriteRule", MakeVersionGate({18,0,0})}, - FunctionInfo{52, nullptr, "DestroyRewriteRule", MakeVersionGate({18,0,0})} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IGeneralService::IGeneralService(Core::System& system_) : ServiceFramework{system_, "IGeneralService"} { + // clang-format off + + static const FunctionInfo functions[] = { + {1, &IGeneralService::GetClientId, "GetClientId"}, + {2, &IGeneralService::CreateScanRequest, "CreateScanRequest"}, + {4, &IGeneralService::CreateRequest, "CreateRequest"}, + {5, &IGeneralService::GetCurrentNetworkProfile, "GetCurrentNetworkProfile"}, + {6, &IGeneralService::EnumerateNetworkInterfaces, "EnumerateNetworkInterfaces"}, + {7, &IGeneralService::EnumerateNetworkProfiles, "EnumerateNetworkProfiles"}, + {8, &IGeneralService::GetNetworkProfile, "GetNetworkProfile"}, + {9, &IGeneralService::SetNetworkProfile, "SetNetworkProfile"}, + {10, &IGeneralService::RemoveNetworkProfile, "RemoveNetworkProfile"}, + {11, &IGeneralService::GetScanData, "GetScanDataOld"}, + {12, &IGeneralService::GetCurrentIpAddress, "GetCurrentIpAddress"}, + {13, nullptr, "GetCurrentAccessPointOld"}, + {14, &IGeneralService::CreateTemporaryNetworkProfile, "CreateTemporaryNetworkProfile"}, + {15, &IGeneralService::GetCurrentIpConfigInfo, "GetCurrentIpConfigInfo"}, + {16, &IGeneralService::SetWirelessCommunicationEnabled, "SetWirelessCommunicationEnabled"}, + {17, &IGeneralService::IsWirelessCommunicationEnabled, "IsWirelessCommunicationEnabled"}, + {18, &IGeneralService::GetInternetConnectionStatus, "GetInternetConnectionStatus"}, + {19, &IGeneralService::SetEthernetCommunicationEnabled, "SetEthernetCommunicationEnabled"}, + {20, &IGeneralService::IsEthernetCommunicationEnabled, "IsEthernetCommunicationEnabled"}, + {21, &IGeneralService::IsAnyInternetRequestAccepted, "IsAnyInternetRequestAccepted"}, + {22, &IGeneralService::IsAnyForegroundRequestAccepted, "IsAnyForegroundRequestAccepted"}, + {23, nullptr, "PutToSleep"}, + {24, nullptr, "WakeUp"}, + {25, &IGeneralService::GetSsidListVersion, "GetSsidListVersion"}, + {26, nullptr, "SetExclusiveClient"}, + {27, nullptr, "GetDefaultIpSetting"}, + {28, nullptr, "SetDefaultIpSetting"}, + {29, nullptr, "SetWirelessCommunicationEnabledForTest"}, + {30, nullptr, "SetEthernetCommunicationEnabledForTest"}, + {31, nullptr, "GetTelemetorySystemEventReadableHandle"}, + {32, nullptr, "GetTelemetryInfo"}, + {33, &IGeneralService::ConfirmSystemAvailability, "ConfirmSystemAvailability"}, // 2.0.0+ + {34, &IGeneralService::SetBackgroundRequestEnabled, "SetBackgroundRequestEnabled"}, // 4.0.0+ + {35, &IGeneralService::GetScanDataV2, "GetScanData"}, + {36, &IGeneralService::GetCurrentAccessPoint, "GetCurrentAccessPoint"}, + {37, nullptr, "Shutdown"}, + {38, nullptr, "GetAllowedChannels"}, + {39, nullptr, "NotifyApplicationSuspended"}, + {40, nullptr, "SetAcceptableNetworkTypeFlag"}, + {41, nullptr, "GetAcceptableNetworkTypeFlag"}, + {42, nullptr, "NotifyConnectionStateChanged"}, + {43, nullptr, "SetWowlDelayedWakeTime"}, + {44, nullptr, "IsWiredConnectionAvailable"}, // 18.0.0+ + {45, nullptr, "IsNetworkEmulationFeatureEnabled"}, // 18.0.0+ + {46, nullptr, "SelectActiveNetworkEmulationProfileIdForDebug"}, // 18.0.0+ + {47, &IGeneralService::GetScanDataV3, "GetScanData"}, // 19.0.0+ + {50, nullptr, "IsRewriteFeatureEnabled"}, // 18.0.0+ + {51, nullptr, "CreateRewriteRule"}, // 18.0.0+ + {52, nullptr, "DestroyRewriteRule"} // 18.0.0+ + }; + // clang-format on + + RegisterHandlers(functions); } IGeneralService::~IGeneralService() = default; class NetworkInterface final : public ServiceFramework { public: - explicit NetworkInterface(const char* name, Core::System& system_) : ServiceFramework{system_, name} {} + explicit NetworkInterface(const char* name, Core::System& system_) + : ServiceFramework{system_, name} { + static const FunctionInfo functions[] = { + {4, &NetworkInterface::CreateGeneralServiceOld, "CreateGeneralServiceOld"}, + {5, &NetworkInterface::CreateGeneralService, "CreateGeneralService"}, + }; + RegisterHandlers(functions); + } private: void CreateGeneralServiceOld(HLERequestContext& ctx) { @@ -1134,14 +1139,6 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{4, &NetworkInterface::CreateGeneralServiceOld, "CreateGeneralServiceOld"}, - FunctionInfo{5, &NetworkInterface::CreateGeneralService, "CreateGeneralService"} - ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/nifm/nifm.h b/src/core/hle/service/nifm/nifm.h index 3f3535fa93..44859e0c51 100644 --- a/src/core/hle/service/nifm/nifm.h +++ b/src/core/hle/service/nifm/nifm.h @@ -51,7 +51,6 @@ private: void SetBackgroundRequestEnabled(HLERequestContext& ctx); void GetCurrentAccessPoint(HLERequestContext& ctx); void GetScanDataV3(HLERequestContext& ctx); - std::optional FindRequest(u32 key) override; }; } // namespace Service::NIFM diff --git a/src/core/hle/service/nim/nim.cpp b/src/core/hle/service/nim/nim.cpp index c48bf54646..e5f2d85dde 100644 --- a/src/core/hle/service/nim/nim.cpp +++ b/src/core/hle/service/nim/nim.cpp @@ -24,13 +24,22 @@ namespace Service::NIM { class IShopServiceAsync final : public ServiceFramework { public: explicit IShopServiceAsync(Core::System& system_) - : ServiceFramework{system_, "IShopServiceAsync"} - , service_context{system_, "IShopServiceAsync"} { - completion_event = service_context.CreateEvent("IShopServiceAsync:Completion"); - } + : ServiceFramework{system_, "IShopServiceAsync"}, + service_context{system_, "IShopServiceAsync"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IShopServiceAsync::Cancel>, "Cancel"}, + {1, D<&IShopServiceAsync::GetSize>, "GetSize"}, + {2, D<&IShopServiceAsync::Read>, "Read"}, + {3, D<&IShopServiceAsync::GetErrorCode>, "GetErrorCode"}, + {4, D<&IShopServiceAsync::Request>, "Request"}, + {5, D<&IShopServiceAsync::Prepare>, "Prepare"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); + + completion_event = service_context.CreateEvent("IShopServiceAsync:Completion"); } ~IShopServiceAsync() override { @@ -43,6 +52,15 @@ public: } private: + KernelHelpers::ServiceContext service_context; + Kernel::KEvent* completion_event; + + std::jthread worker; + std::atomic error_code{0}; + + std::mutex data_mutex; + std::vector download_data; + void CancelImpl() { worker.request_stop(); if (worker.joinable()) { @@ -118,30 +136,19 @@ private: } R_SUCCEED(); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IShopServiceAsync::Cancel>, "Cancel"}, - FunctionInfo{1, D<&IShopServiceAsync::GetSize>, "GetSize"}, - FunctionInfo{2, D<&IShopServiceAsync::Read>, "Read"}, - FunctionInfo{3, D<&IShopServiceAsync::GetErrorCode>, "GetErrorCode"}, - FunctionInfo{4, D<&IShopServiceAsync::Request>, "Request"}, - FunctionInfo{5, D<&IShopServiceAsync::Prepare>, "Prepare"} - ); - KernelHelpers::ServiceContext service_context; - Kernel::KEvent* completion_event; - std::jthread worker; - std::atomic error_code{0}; - std::mutex data_mutex; - std::vector download_data; }; class IShopServiceAccessor final : public ServiceFramework { public: explicit IShopServiceAccessor(Core::System& system_) - : ServiceFramework{system_, "IShopServiceAccessor"} {} + : ServiceFramework{system_, "IShopServiceAccessor"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &IShopServiceAccessor::CreateAsyncInterface, "CreateAsyncInterface"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -153,19 +160,19 @@ private: rb.PushCopyObjects(ctx, async_interface->GetEvent()); rb.PushIpcInterface(ctx, std::move(async_interface)); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &IShopServiceAccessor::CreateAsyncInterface, "CreateAsyncInterface"} - ); }; class IShopServiceAccessServer final : public ServiceFramework { public: explicit IShopServiceAccessServer(Core::System& system_) - : ServiceFramework{system_, "IShopServiceAccessServer"} {} + : ServiceFramework{system_, "IShopServiceAccessServer"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &IShopServiceAccessServer::CreateAccessorInterface, "CreateAccessorInterface"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -175,252 +182,258 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &IShopServiceAccessServer::CreateAccessorInterface, "CreateAccessorInterface"} - ); }; class NIM final : public ServiceFramework { public: - explicit NIM(Core::System& system_) : ServiceFramework{system_, "nim"} {} + explicit NIM(Core::System& system_) : ServiceFramework{system_, "nim"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "CreateSystemUpdateTask"}, + {1, nullptr, "DestroySystemUpdateTask"}, + {2, nullptr, "ListSystemUpdateTask"}, + {3, nullptr, "RequestSystemUpdateTaskRun"}, + {4, nullptr, "GetSystemUpdateTaskInfo"}, + {5, nullptr, "CommitSystemUpdateTask"}, + {6, nullptr, "CreateNetworkInstallTask"}, + {7, nullptr, "DestroyNetworkInstallTask"}, + {8, nullptr, "ListNetworkInstallTask"}, + {9, nullptr, "RequestNetworkInstallTaskRun"}, + {10, nullptr, "GetNetworkInstallTaskInfo"}, + {11, nullptr, "CommitNetworkInstallTask"}, + {12, nullptr, "RequestLatestSystemUpdateMeta"}, + {14, nullptr, "ListApplicationNetworkInstallTask"}, + {15, nullptr, "ListNetworkInstallTaskContentMeta"}, + {16, nullptr, "RequestLatestVersion"}, + {17, nullptr, "SetNetworkInstallTaskAttribute"}, + {18, nullptr, "AddNetworkInstallTaskContentMeta"}, + {19, nullptr, "GetDownloadedSystemDataPath"}, + {20, nullptr, "CalculateNetworkInstallTaskRequiredSize"}, + {21, nullptr, "IsExFatDriverIncluded"}, + {22, nullptr, "GetBackgroundDownloadStressTaskInfo"}, + {23, nullptr, "RequestDeviceAuthenticationToken"}, + {24, nullptr, "RequestGameCardRegistrationStatus"}, + {25, nullptr, "RequestRegisterGameCard"}, + {26, nullptr, "RequestRegisterNotificationToken"}, + {27, nullptr, "RequestDownloadTaskList"}, + {28, nullptr, "RequestApplicationControl"}, + {29, nullptr, "RequestLatestApplicationControl"}, + {30, nullptr, "RequestVersionList"}, + {31, nullptr, "CreateApplyDeltaTask"}, + {32, nullptr, "DestroyApplyDeltaTask"}, + {33, nullptr, "ListApplicationApplyDeltaTask"}, + {34, nullptr, "RequestApplyDeltaTaskRun"}, + {35, nullptr, "GetApplyDeltaTaskInfo"}, + {36, nullptr, "ListApplyDeltaTask"}, + {37, nullptr, "CommitApplyDeltaTask"}, + {38, nullptr, "CalculateApplyDeltaTaskRequiredSize"}, + {39, nullptr, "PrepareShutdown"}, + {40, nullptr, "ListApplyDeltaTask"}, + {41, nullptr, "ClearNotEnoughSpaceStateOfApplyDeltaTask"}, + {42, nullptr, "CreateApplyDeltaTaskFromDownloadTask"}, + {43, nullptr, "GetBackgroundApplyDeltaStressTaskInfo"}, + {44, nullptr, "GetApplyDeltaTaskRequiredStorage"}, + {45, nullptr, "CalculateNetworkInstallTaskContentsSize"}, + {46, nullptr, "PrepareShutdownForSystemUpdate"}, + {47, nullptr, "FindMaxRequiredApplicationVersionOfTask"}, + {48, nullptr, "CommitNetworkInstallTaskPartially"}, + {49, nullptr, "ListNetworkInstallTaskCommittedContentMeta"}, + {50, nullptr, "ListNetworkInstallTaskNotCommittedContentMeta"}, + {51, nullptr, "FindMaxRequiredSystemVersionOfTask"}, + {52, nullptr, "GetNetworkInstallTaskErrorContext"}, + {53, nullptr, "CreateLocalCommunicationReceiveApplicationTask"}, + {54, nullptr, "DestroyLocalCommunicationReceiveApplicationTask"}, + {55, nullptr, "ListLocalCommunicationReceiveApplicationTask"}, + {56, nullptr, "RequestLocalCommunicationReceiveApplicationTaskRun"}, + {57, nullptr, "GetLocalCommunicationReceiveApplicationTaskInfo"}, + {58, nullptr, "CommitLocalCommunicationReceiveApplicationTask"}, + {59, nullptr, "ListLocalCommunicationReceiveApplicationTaskContentMeta"}, + {60, nullptr, "CreateLocalCommunicationSendApplicationTask"}, + {61, nullptr, "RequestLocalCommunicationSendApplicationTaskRun"}, + {62, nullptr, "GetLocalCommunicationReceiveApplicationTaskErrorContext"}, + {63, nullptr, "GetLocalCommunicationSendApplicationTaskInfo"}, + {64, nullptr, "DestroyLocalCommunicationSendApplicationTask"}, + {65, nullptr, "GetLocalCommunicationSendApplicationTaskErrorContext"}, + {66, nullptr, "CalculateLocalCommunicationReceiveApplicationTaskRequiredSize"}, + {67, nullptr, "ListApplicationLocalCommunicationReceiveApplicationTask"}, + {68, nullptr, "ListApplicationLocalCommunicationSendApplicationTask"}, + {69, nullptr, "CreateLocalCommunicationReceiveSystemUpdateTask"}, + {70, nullptr, "DestroyLocalCommunicationReceiveSystemUpdateTask"}, + {71, nullptr, "ListLocalCommunicationReceiveSystemUpdateTask"}, + {72, nullptr, "RequestLocalCommunicationReceiveSystemUpdateTaskRun"}, + {73, nullptr, "GetLocalCommunicationReceiveSystemUpdateTaskInfo"}, + {74, nullptr, "CommitLocalCommunicationReceiveSystemUpdateTask"}, + {75, nullptr, "GetLocalCommunicationReceiveSystemUpdateTaskErrorContext"}, + {76, nullptr, "CreateLocalCommunicationSendSystemUpdateTask"}, + {77, nullptr, "RequestLocalCommunicationSendSystemUpdateTaskRun"}, + {78, nullptr, "GetLocalCommunicationSendSystemUpdateTaskInfo"}, + {79, nullptr, "DestroyLocalCommunicationSendSystemUpdateTask"}, + {80, nullptr, "GetLocalCommunicationSendSystemUpdateTaskErrorContext"}, + {81, nullptr, "ListLocalCommunicationSendSystemUpdateTask"}, + {82, nullptr, "GetReceivedSystemDataPath"}, + {83, nullptr, "CalculateApplyDeltaTaskOccupiedSize"}, + {84, nullptr, "ReloadErrorSimulation"}, + {85, nullptr, "ListNetworkInstallTaskContentMetaFromInstallMeta"}, + {86, nullptr, "ListNetworkInstallTaskOccupiedSize"}, + {87, nullptr, "RequestQueryAvailableELicenses"}, + {88, nullptr, "RequestAssignELicenses"}, + {89, nullptr, "RequestExtendELicenses"}, + {90, nullptr, "RequestSyncELicenses"}, + {91, nullptr, "Unknown91"}, //6.0.0-14.1.2 + {92, nullptr, "Unknown92"}, //21.0.0+ + {93, nullptr, "RequestReportActiveELicenses"}, + {94, nullptr, "RequestReportActiveELicensesPassively"}, + {95, nullptr, "RequestRegisterDynamicRightsNotificationToken"}, + {96, nullptr, "RequestAssignAllDeviceLinkedELicenses"}, + {97, nullptr, "RequestRevokeAllELicenses"}, + {98, nullptr, "RequestPrefetchForDynamicRights"}, + {99, nullptr, "CreateNetworkInstallTask"}, + {100, nullptr, "ListNetworkInstallTaskRightsIds"}, + {101, nullptr, "RequestDownloadETickets"}, + {102, nullptr, "RequestQueryDownloadableContents"}, + {103, nullptr, "DeleteNetworkInstallTaskContentMeta"}, + {104, nullptr, "RequestIssueEdgeTokenForDebug"}, + {105, nullptr, "RequestQueryAvailableELicenses2"}, + {106, nullptr, "RequestAssignELicenses2"}, + {107, nullptr, "GetNetworkInstallTaskStateCounter"}, + {108, nullptr, "InvalidateDynamicRightsNaIdTokenCacheForDebug"}, + {109, nullptr, "ListNetworkInstallTaskPartialInstallContentMeta"}, + {110, nullptr, "ListNetworkInstallTaskRightsIdsFromIndex"}, + {111, nullptr, "AddNetworkInstallTaskContentMetaForUser"}, + {112, nullptr, "RequestAssignELicensesAndDownloadETickets"}, + {113, nullptr, "RequestQueryAvailableCommonELicenses"}, + {114, nullptr, "SetNetworkInstallTaskExtendedAttribute"}, + {115, nullptr, "GetNetworkInstallTaskExtendedAttribute"}, + {116, nullptr, "GetAllocatorInfo"}, + {117, nullptr, "RequestQueryDownloadableContentsByApplicationId"}, + {118, nullptr, "MarkNoDownloadRightsErrorResolved"}, + {119, nullptr, "GetApplyDeltaTaskAllAppliedContentMeta"}, + {120, nullptr, "PrioritizeNetworkInstallTask"}, + {121, nullptr, "RequestQueryAvailableCommonELicenses2"}, + {122, nullptr, "RequestAssignCommonELicenses"}, + {123, nullptr, "RequestAssignCommonELicenses2"}, + {124, nullptr, "IsNetworkInstallTaskFrontOfQueue"}, + {125, nullptr, "PrioritizeApplyDeltaTask"}, + {126, nullptr, "RerouteDownloadingPatch"}, + {127, nullptr, "UnmarkNoDownloadRightsErrorResolved"}, + {128, nullptr, "RequestContentsSize"}, + {129, nullptr, "RequestContentsAuthorizationToken"}, + {130, nullptr, "RequestCdnVendorDiscovery"}, + {131, nullptr, "RefreshDebugAvailability"}, + {132, nullptr, "ClearResponseSimulationEntry"}, + {133, nullptr, "RegisterResponseSimulationEntry"}, + {134, nullptr, "GetProcessedCdnVendors"}, + {135, nullptr, "RefreshRuntimeBehaviorsForDebug"}, + {136, nullptr, "RequestOnlineSubscriptionFreeTrialAvailability"}, + {137, nullptr, "GetNetworkInstallTaskContentMetaCount"}, + {138, nullptr, "RequestRevokeELicenses"}, + {139, nullptr, "EnableNetworkConnectionToUseApplicationCore"}, + {140, nullptr, "DisableNetworkConnectionToUseApplicationCore"}, + {141, nullptr, "IsNetworkConnectionEnabledToUseApplicationCore"}, + {142, nullptr, "RequestCheckSafeSystemVersion"}, + {143, nullptr, "RequestApplicationIcon"}, + {144, nullptr, "RequestDownloadIdbeIconFile"}, + {147, nullptr, "Unknown147"}, //18.0.0+ + {148, nullptr, "Unknown148"}, //18.0.0+ + {150, nullptr, "Unknown150"}, //19.0.0+ + {151, nullptr, "Unknown151"}, //20.0.0+ + {152, nullptr, "Unknown152"}, //20.0.0+ + {153, nullptr, "Unknown153"}, //20.0.0+ + {154, nullptr, "Unknown154"}, //20.0.0+ + {155, nullptr, "Unknown155"}, //20.0.0+ + {156, nullptr, "Unknown156"}, //20.0.0+ + {157, nullptr, "Unknown157"}, //20.0.0+ + {158, nullptr, "Unknown158"}, //20.0.0+ + {159, nullptr, "Unknown159"}, //20.0.0+ + {160, nullptr, "Unknown160"}, //20.0.0+ + {161, nullptr, "Unknown161"}, //20.0.0+ + {162, nullptr, "Unknown162"}, //20.0.0+ + {163, nullptr, "Unknown163"}, //20.0.0+ + {164, nullptr, "Unknown164"}, //20.0.0+ + {165, nullptr, "Unknown165"}, //20.0.0+ + {166, nullptr, "Unknown166"}, //20.0.0+ + {167, nullptr, "Unknown167"}, //20.0.0+ + {168, nullptr, "Unknown168"}, //20.0.0+ + {169, nullptr, "Unknown169"}, //20.0.0+ + {170, nullptr, "Unknown170"}, //20.0.0+ + {171, nullptr, "Unknown171"}, //20.0.0+ + {172, nullptr, "Unknown172"}, //20.0.0+ + {173, nullptr, "Unknown173"}, //20.0.0+ + {174, nullptr, "Unknown174"}, //20.0.0+ + {175, nullptr, "Unknown175"}, //20.0.0+ + {176, nullptr, "Unknown176"}, //20.0.0+ + {177, nullptr, "Unknown177"}, //20.0.0+ + {2000, nullptr, "Unknown2000"}, //20.0.0+ + {2001, nullptr, "Unknown2001"}, //20.0.0+ + {2002, nullptr, "Unknown2002"}, //20.0.0+ + {2003, nullptr, "Unknown2003"}, //20.0.0+ + {2004, nullptr, "Unknown2004"}, //20.0.0+ + {2007, nullptr, "Unknown2007"}, //20.0.0+ + {2011, nullptr, "Unknown2011"}, //20.0.0+ + {2012, nullptr, "Unknown2012"}, //20.0.0+ + {2013, nullptr, "Unknown2013"}, //20.0.0+ + {2014, nullptr, "Unknown2014"}, //20.0.0+ + {2015, nullptr, "Unknown2015"}, //20.0.0+ + {2016, nullptr, "Unknown2016"}, //20.0.0+ + {2017, nullptr, "Unknown2017"}, //20.0.0+ + {2018, nullptr, "Unknown2018"}, //20.0.0+ + {2019, nullptr, "Unknown2019"}, //20.0.0+ + {2020, nullptr, "Unknown2020"}, //20.0.0+ + {2021, nullptr, "Unknown2021"}, //20.0.0+ + {2022, nullptr, "Unknown2022"}, //20.0.0+ + {2023, nullptr, "Unknown2023"}, //20.0.0+ + {2024, nullptr, "Unknown2024"}, //20.0.0+ + {2025, nullptr, "Unknown2025"}, //20.0.0+ + {2026, nullptr, "Unknown2026"}, //20.0.0+ + {2027, nullptr, "Unknown2027"}, //20.0.0+ + {2028, nullptr, "Unknown2028"}, //20.0.0+ + {2029, nullptr, "Unknown2029"}, //20.0.0+ + {2030, nullptr, "Unknown2030"}, //20.0.0+ + {2031, nullptr, "Unknown2031"}, //20.0.0+ + {2032, nullptr, "Unknown2032"}, //20.0.0+ + {2033, nullptr, "Unknown2033"}, //20.0.0+ + {2034, nullptr, "Unknown2034"}, //20.0.0+ + {2035, nullptr, "Unknown2035"}, //20.0.0+ + {2036, nullptr, "Unknown2036"}, //20.0.0+ + {2037, nullptr, "Unknown2037"}, //20.0.0+ + {2038, nullptr, "Unknown2038"}, //20.0.0+ + {2039, nullptr, "Unknown2039"}, //20.0.0+ + {2040, nullptr, "Unknown2040"}, //20.0.0+ + {2041, nullptr, "Unknown2041"}, //20.0.0+ + {2042, nullptr, "Unknown2042"}, //20.0.0+ + {2043, nullptr, "Unknown2043"}, //20.0.0+ + {2044, nullptr, "Unknown2044"}, //20.0.0+ + {2045, nullptr, "Unknown2045"}, //20.0.0+ + {2046, nullptr, "Unknown2046"}, //20.0.0+ + {2047, nullptr, "Unknown2047"}, //20.0.0+ + {2048, nullptr, "Unknown2048"}, //20.0.0+ + {2049, nullptr, "Unknown2049"}, //20.0.0+ + {2050, nullptr, "Unknown2050"}, //20.0.0+ + {2051, nullptr, "Unknown2051"}, //20.0.0+ + {3000, nullptr, "RequestLatestApplicationIcon"}, //17.0.0+ + {3001, nullptr, "RequestDownloadIdbeLatestIconFile"}, //17.0.0+ + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "CreateSystemUpdateTask"}, - FunctionInfo{1, nullptr, "DestroySystemUpdateTask"}, - FunctionInfo{2, nullptr, "ListSystemUpdateTask"}, - FunctionInfo{3, nullptr, "RequestSystemUpdateTaskRun"}, - FunctionInfo{4, nullptr, "GetSystemUpdateTaskInfo"}, - FunctionInfo{5, nullptr, "CommitSystemUpdateTask"}, - FunctionInfo{6, nullptr, "CreateNetworkInstallTask"}, - FunctionInfo{7, nullptr, "DestroyNetworkInstallTask"}, - FunctionInfo{8, nullptr, "ListNetworkInstallTask"}, - FunctionInfo{9, nullptr, "RequestNetworkInstallTaskRun"}, - FunctionInfo{10, nullptr, "GetNetworkInstallTaskInfo"}, - FunctionInfo{11, nullptr, "CommitNetworkInstallTask"}, - FunctionInfo{12, nullptr, "RequestLatestSystemUpdateMeta"}, - FunctionInfo{14, nullptr, "ListApplicationNetworkInstallTask"}, - FunctionInfo{15, nullptr, "ListNetworkInstallTaskContentMeta"}, - FunctionInfo{16, nullptr, "RequestLatestVersion"}, - FunctionInfo{17, nullptr, "SetNetworkInstallTaskAttribute"}, - FunctionInfo{18, nullptr, "AddNetworkInstallTaskContentMeta"}, - FunctionInfo{19, nullptr, "GetDownloadedSystemDataPath"}, - FunctionInfo{20, nullptr, "CalculateNetworkInstallTaskRequiredSize"}, - FunctionInfo{21, nullptr, "IsExFatDriverIncluded"}, - FunctionInfo{22, nullptr, "GetBackgroundDownloadStressTaskInfo"}, - FunctionInfo{23, nullptr, "RequestDeviceAuthenticationToken"}, - FunctionInfo{24, nullptr, "RequestGameCardRegistrationStatus"}, - FunctionInfo{25, nullptr, "RequestRegisterGameCard"}, - FunctionInfo{26, nullptr, "RequestRegisterNotificationToken"}, - FunctionInfo{27, nullptr, "RequestDownloadTaskList"}, - FunctionInfo{28, nullptr, "RequestApplicationControl"}, - FunctionInfo{29, nullptr, "RequestLatestApplicationControl"}, - FunctionInfo{30, nullptr, "RequestVersionList"}, - FunctionInfo{31, nullptr, "CreateApplyDeltaTask"}, - FunctionInfo{32, nullptr, "DestroyApplyDeltaTask"}, - FunctionInfo{33, nullptr, "ListApplicationApplyDeltaTask"}, - FunctionInfo{34, nullptr, "RequestApplyDeltaTaskRun"}, - FunctionInfo{35, nullptr, "GetApplyDeltaTaskInfo"}, - FunctionInfo{36, nullptr, "ListApplyDeltaTask"}, - FunctionInfo{37, nullptr, "CommitApplyDeltaTask"}, - FunctionInfo{38, nullptr, "CalculateApplyDeltaTaskRequiredSize"}, - FunctionInfo{39, nullptr, "PrepareShutdown"}, - FunctionInfo{40, nullptr, "ListApplyDeltaTask"}, - FunctionInfo{41, nullptr, "ClearNotEnoughSpaceStateOfApplyDeltaTask"}, - FunctionInfo{42, nullptr, "CreateApplyDeltaTaskFromDownloadTask"}, - FunctionInfo{43, nullptr, "GetBackgroundApplyDeltaStressTaskInfo"}, - FunctionInfo{44, nullptr, "GetApplyDeltaTaskRequiredStorage"}, - FunctionInfo{45, nullptr, "CalculateNetworkInstallTaskContentsSize"}, - FunctionInfo{46, nullptr, "PrepareShutdownForSystemUpdate"}, - FunctionInfo{47, nullptr, "FindMaxRequiredApplicationVersionOfTask"}, - FunctionInfo{48, nullptr, "CommitNetworkInstallTaskPartially"}, - FunctionInfo{49, nullptr, "ListNetworkInstallTaskCommittedContentMeta"}, - FunctionInfo{50, nullptr, "ListNetworkInstallTaskNotCommittedContentMeta"}, - FunctionInfo{51, nullptr, "FindMaxRequiredSystemVersionOfTask"}, - FunctionInfo{52, nullptr, "GetNetworkInstallTaskErrorContext"}, - FunctionInfo{53, nullptr, "CreateLocalCommunicationReceiveApplicationTask"}, - FunctionInfo{54, nullptr, "DestroyLocalCommunicationReceiveApplicationTask"}, - FunctionInfo{55, nullptr, "ListLocalCommunicationReceiveApplicationTask"}, - FunctionInfo{56, nullptr, "RequestLocalCommunicationReceiveApplicationTaskRun"}, - FunctionInfo{57, nullptr, "GetLocalCommunicationReceiveApplicationTaskInfo"}, - FunctionInfo{58, nullptr, "CommitLocalCommunicationReceiveApplicationTask"}, - FunctionInfo{59, nullptr, "ListLocalCommunicationReceiveApplicationTaskContentMeta"}, - FunctionInfo{60, nullptr, "CreateLocalCommunicationSendApplicationTask"}, - FunctionInfo{61, nullptr, "RequestLocalCommunicationSendApplicationTaskRun"}, - FunctionInfo{62, nullptr, "GetLocalCommunicationReceiveApplicationTaskErrorContext"}, - FunctionInfo{63, nullptr, "GetLocalCommunicationSendApplicationTaskInfo"}, - FunctionInfo{64, nullptr, "DestroyLocalCommunicationSendApplicationTask"}, - FunctionInfo{65, nullptr, "GetLocalCommunicationSendApplicationTaskErrorContext"}, - FunctionInfo{66, nullptr, "CalculateLocalCommunicationReceiveApplicationTaskRequiredSize"}, - FunctionInfo{67, nullptr, "ListApplicationLocalCommunicationReceiveApplicationTask"}, - FunctionInfo{68, nullptr, "ListApplicationLocalCommunicationSendApplicationTask"}, - FunctionInfo{69, nullptr, "CreateLocalCommunicationReceiveSystemUpdateTask"}, - FunctionInfo{70, nullptr, "DestroyLocalCommunicationReceiveSystemUpdateTask"}, - FunctionInfo{71, nullptr, "ListLocalCommunicationReceiveSystemUpdateTask"}, - FunctionInfo{72, nullptr, "RequestLocalCommunicationReceiveSystemUpdateTaskRun"}, - FunctionInfo{73, nullptr, "GetLocalCommunicationReceiveSystemUpdateTaskInfo"}, - FunctionInfo{74, nullptr, "CommitLocalCommunicationReceiveSystemUpdateTask"}, - FunctionInfo{75, nullptr, "GetLocalCommunicationReceiveSystemUpdateTaskErrorContext"}, - FunctionInfo{76, nullptr, "CreateLocalCommunicationSendSystemUpdateTask"}, - FunctionInfo{77, nullptr, "RequestLocalCommunicationSendSystemUpdateTaskRun"}, - FunctionInfo{78, nullptr, "GetLocalCommunicationSendSystemUpdateTaskInfo"}, - FunctionInfo{79, nullptr, "DestroyLocalCommunicationSendSystemUpdateTask"}, - FunctionInfo{80, nullptr, "GetLocalCommunicationSendSystemUpdateTaskErrorContext"}, - FunctionInfo{81, nullptr, "ListLocalCommunicationSendSystemUpdateTask"}, - FunctionInfo{82, nullptr, "GetReceivedSystemDataPath"}, - FunctionInfo{83, nullptr, "CalculateApplyDeltaTaskOccupiedSize"}, - FunctionInfo{84, nullptr, "ReloadErrorSimulation"}, - FunctionInfo{85, nullptr, "ListNetworkInstallTaskContentMetaFromInstallMeta"}, - FunctionInfo{86, nullptr, "ListNetworkInstallTaskOccupiedSize"}, - FunctionInfo{87, nullptr, "RequestQueryAvailableELicenses"}, - FunctionInfo{88, nullptr, "RequestAssignELicenses"}, - FunctionInfo{89, nullptr, "RequestExtendELicenses"}, - FunctionInfo{90, nullptr, "RequestSyncELicenses"}, - FunctionInfo{91, nullptr, "Unknown91", MakeVersionGate({6,0,0}, {14,1,2})}, - FunctionInfo{92, nullptr, "Unknown92", MakeVersionGate({21,0,0})}, - FunctionInfo{93, nullptr, "RequestReportActiveELicenses"}, - FunctionInfo{94, nullptr, "RequestReportActiveELicensesPassively"}, - FunctionInfo{95, nullptr, "RequestRegisterDynamicRightsNotificationToken"}, - FunctionInfo{96, nullptr, "RequestAssignAllDeviceLinkedELicenses"}, - FunctionInfo{97, nullptr, "RequestRevokeAllELicenses"}, - FunctionInfo{98, nullptr, "RequestPrefetchForDynamicRights"}, - FunctionInfo{99, nullptr, "CreateNetworkInstallTask"}, - FunctionInfo{100, nullptr, "ListNetworkInstallTaskRightsIds"}, - FunctionInfo{101, nullptr, "RequestDownloadETickets"}, - FunctionInfo{102, nullptr, "RequestQueryDownloadableContents"}, - FunctionInfo{103, nullptr, "DeleteNetworkInstallTaskContentMeta"}, - FunctionInfo{104, nullptr, "RequestIssueEdgeTokenForDebug"}, - FunctionInfo{105, nullptr, "RequestQueryAvailableELicenses2"}, - FunctionInfo{106, nullptr, "RequestAssignELicenses2"}, - FunctionInfo{107, nullptr, "GetNetworkInstallTaskStateCounter"}, - FunctionInfo{108, nullptr, "InvalidateDynamicRightsNaIdTokenCacheForDebug"}, - FunctionInfo{109, nullptr, "ListNetworkInstallTaskPartialInstallContentMeta"}, - FunctionInfo{110, nullptr, "ListNetworkInstallTaskRightsIdsFromIndex"}, - FunctionInfo{111, nullptr, "AddNetworkInstallTaskContentMetaForUser"}, - FunctionInfo{112, nullptr, "RequestAssignELicensesAndDownloadETickets"}, - FunctionInfo{113, nullptr, "RequestQueryAvailableCommonELicenses"}, - FunctionInfo{114, nullptr, "SetNetworkInstallTaskExtendedAttribute"}, - FunctionInfo{115, nullptr, "GetNetworkInstallTaskExtendedAttribute"}, - FunctionInfo{116, nullptr, "GetAllocatorInfo"}, - FunctionInfo{117, nullptr, "RequestQueryDownloadableContentsByApplicationId"}, - FunctionInfo{118, nullptr, "MarkNoDownloadRightsErrorResolved"}, - FunctionInfo{119, nullptr, "GetApplyDeltaTaskAllAppliedContentMeta"}, - FunctionInfo{120, nullptr, "PrioritizeNetworkInstallTask"}, - FunctionInfo{121, nullptr, "RequestQueryAvailableCommonELicenses2"}, - FunctionInfo{122, nullptr, "RequestAssignCommonELicenses"}, - FunctionInfo{123, nullptr, "RequestAssignCommonELicenses2"}, - FunctionInfo{124, nullptr, "IsNetworkInstallTaskFrontOfQueue"}, - FunctionInfo{125, nullptr, "PrioritizeApplyDeltaTask"}, - FunctionInfo{126, nullptr, "RerouteDownloadingPatch"}, - FunctionInfo{127, nullptr, "UnmarkNoDownloadRightsErrorResolved"}, - FunctionInfo{128, nullptr, "RequestContentsSize"}, - FunctionInfo{129, nullptr, "RequestContentsAuthorizationToken"}, - FunctionInfo{130, nullptr, "RequestCdnVendorDiscovery"}, - FunctionInfo{131, nullptr, "RefreshDebugAvailability"}, - FunctionInfo{132, nullptr, "ClearResponseSimulationEntry"}, - FunctionInfo{133, nullptr, "RegisterResponseSimulationEntry"}, - FunctionInfo{134, nullptr, "GetProcessedCdnVendors"}, - FunctionInfo{135, nullptr, "RefreshRuntimeBehaviorsForDebug"}, - FunctionInfo{136, nullptr, "RequestOnlineSubscriptionFreeTrialAvailability"}, - FunctionInfo{137, nullptr, "GetNetworkInstallTaskContentMetaCount"}, - FunctionInfo{138, nullptr, "RequestRevokeELicenses"}, - FunctionInfo{139, nullptr, "EnableNetworkConnectionToUseApplicationCore"}, - FunctionInfo{140, nullptr, "DisableNetworkConnectionToUseApplicationCore"}, - FunctionInfo{141, nullptr, "IsNetworkConnectionEnabledToUseApplicationCore"}, - FunctionInfo{142, nullptr, "RequestCheckSafeSystemVersion"}, - FunctionInfo{143, nullptr, "RequestApplicationIcon"}, - FunctionInfo{144, nullptr, "RequestDownloadIdbeIconFile"}, - FunctionInfo{147, nullptr, "Unknown147", MakeVersionGate({18,0,0})}, - FunctionInfo{148, nullptr, "Unknown148", MakeVersionGate({18,0,0})}, - FunctionInfo{150, nullptr, "Unknown150", MakeVersionGate({19,0,0})}, - FunctionInfo{151, nullptr, "Unknown151", MakeVersionGate({20,0,0})}, - FunctionInfo{152, nullptr, "Unknown152", MakeVersionGate({20,0,0})}, - FunctionInfo{153, nullptr, "Unknown153", MakeVersionGate({20,0,0})}, - FunctionInfo{154, nullptr, "Unknown154", MakeVersionGate({20,0,0})}, - FunctionInfo{155, nullptr, "Unknown155", MakeVersionGate({20,0,0})}, - FunctionInfo{156, nullptr, "Unknown156", MakeVersionGate({20,0,0})}, - FunctionInfo{157, nullptr, "Unknown157", MakeVersionGate({20,0,0})}, - FunctionInfo{158, nullptr, "Unknown158", MakeVersionGate({20,0,0})}, - FunctionInfo{159, nullptr, "Unknown159", MakeVersionGate({20,0,0})}, - FunctionInfo{160, nullptr, "Unknown160", MakeVersionGate({20,0,0})}, - FunctionInfo{161, nullptr, "Unknown161", MakeVersionGate({20,0,0})}, - FunctionInfo{162, nullptr, "Unknown162", MakeVersionGate({20,0,0})}, - FunctionInfo{163, nullptr, "Unknown163", MakeVersionGate({20,0,0})}, - FunctionInfo{164, nullptr, "Unknown164", MakeVersionGate({20,0,0})}, - FunctionInfo{165, nullptr, "Unknown165", MakeVersionGate({20,0,0})}, - FunctionInfo{166, nullptr, "Unknown166", MakeVersionGate({20,0,0})}, - FunctionInfo{167, nullptr, "Unknown167", MakeVersionGate({20,0,0})}, - FunctionInfo{168, nullptr, "Unknown168", MakeVersionGate({20,0,0})}, - FunctionInfo{169, nullptr, "Unknown169", MakeVersionGate({20,0,0})}, - FunctionInfo{170, nullptr, "Unknown170", MakeVersionGate({20,0,0})}, - FunctionInfo{171, nullptr, "Unknown171", MakeVersionGate({20,0,0})}, - FunctionInfo{172, nullptr, "Unknown172", MakeVersionGate({20,0,0})}, - FunctionInfo{173, nullptr, "Unknown173", MakeVersionGate({20,0,0})}, - FunctionInfo{174, nullptr, "Unknown174", MakeVersionGate({20,0,0})}, - FunctionInfo{175, nullptr, "Unknown175", MakeVersionGate({20,0,0})}, - FunctionInfo{176, nullptr, "Unknown176", MakeVersionGate({20,0,0})}, - FunctionInfo{177, nullptr, "Unknown177", MakeVersionGate({20,0,0})}, - FunctionInfo{2000, nullptr, "Unknown2000", MakeVersionGate({20,0,0})}, - FunctionInfo{2001, nullptr, "Unknown2001", MakeVersionGate({20,0,0})}, - FunctionInfo{2002, nullptr, "Unknown2002", MakeVersionGate({20,0,0})}, - FunctionInfo{2003, nullptr, "Unknown2003", MakeVersionGate({20,0,0})}, - FunctionInfo{2004, nullptr, "Unknown2004", MakeVersionGate({20,0,0})}, - FunctionInfo{2007, nullptr, "Unknown2007", MakeVersionGate({20,0,0})}, - FunctionInfo{2011, nullptr, "Unknown2011", MakeVersionGate({20,0,0})}, - FunctionInfo{2012, nullptr, "Unknown2012", MakeVersionGate({20,0,0})}, - FunctionInfo{2013, nullptr, "Unknown2013", MakeVersionGate({20,0,0})}, - FunctionInfo{2014, nullptr, "Unknown2014", MakeVersionGate({20,0,0})}, - FunctionInfo{2015, nullptr, "Unknown2015", MakeVersionGate({20,0,0})}, - FunctionInfo{2016, nullptr, "Unknown2016", MakeVersionGate({20,0,0})}, - FunctionInfo{2017, nullptr, "Unknown2017", MakeVersionGate({20,0,0})}, - FunctionInfo{2018, nullptr, "Unknown2018", MakeVersionGate({20,0,0})}, - FunctionInfo{2019, nullptr, "Unknown2019", MakeVersionGate({20,0,0})}, - FunctionInfo{2020, nullptr, "Unknown2020", MakeVersionGate({20,0,0})}, - FunctionInfo{2021, nullptr, "Unknown2021", MakeVersionGate({20,0,0})}, - FunctionInfo{2022, nullptr, "Unknown2022", MakeVersionGate({20,0,0})}, - FunctionInfo{2023, nullptr, "Unknown2023", MakeVersionGate({20,0,0})}, - FunctionInfo{2024, nullptr, "Unknown2024", MakeVersionGate({20,0,0})}, - FunctionInfo{2025, nullptr, "Unknown2025", MakeVersionGate({20,0,0})}, - FunctionInfo{2026, nullptr, "Unknown2026", MakeVersionGate({20,0,0})}, - FunctionInfo{2027, nullptr, "Unknown2027", MakeVersionGate({20,0,0})}, - FunctionInfo{2028, nullptr, "Unknown2028", MakeVersionGate({20,0,0})}, - FunctionInfo{2029, nullptr, "Unknown2029", MakeVersionGate({20,0,0})}, - FunctionInfo{2030, nullptr, "Unknown2030", MakeVersionGate({20,0,0})}, - FunctionInfo{2031, nullptr, "Unknown2031", MakeVersionGate({20,0,0})}, - FunctionInfo{2032, nullptr, "Unknown2032", MakeVersionGate({20,0,0})}, - FunctionInfo{2033, nullptr, "Unknown2033", MakeVersionGate({20,0,0})}, - FunctionInfo{2034, nullptr, "Unknown2034", MakeVersionGate({20,0,0})}, - FunctionInfo{2035, nullptr, "Unknown2035", MakeVersionGate({20,0,0})}, - FunctionInfo{2036, nullptr, "Unknown2036", MakeVersionGate({20,0,0})}, - FunctionInfo{2037, nullptr, "Unknown2037", MakeVersionGate({20,0,0})}, - FunctionInfo{2038, nullptr, "Unknown2038", MakeVersionGate({20,0,0})}, - FunctionInfo{2039, nullptr, "Unknown2039", MakeVersionGate({20,0,0})}, - FunctionInfo{2040, nullptr, "Unknown2040", MakeVersionGate({20,0,0})}, - FunctionInfo{2041, nullptr, "Unknown2041", MakeVersionGate({20,0,0})}, - FunctionInfo{2042, nullptr, "Unknown2042", MakeVersionGate({20,0,0})}, - FunctionInfo{2043, nullptr, "Unknown2043", MakeVersionGate({20,0,0})}, - FunctionInfo{2044, nullptr, "Unknown2044", MakeVersionGate({20,0,0})}, - FunctionInfo{2045, nullptr, "Unknown2045", MakeVersionGate({20,0,0})}, - FunctionInfo{2046, nullptr, "Unknown2046", MakeVersionGate({20,0,0})}, - FunctionInfo{2047, nullptr, "Unknown2047", MakeVersionGate({20,0,0})}, - FunctionInfo{2048, nullptr, "Unknown2048", MakeVersionGate({20,0,0})}, - FunctionInfo{2049, nullptr, "Unknown2049", MakeVersionGate({20,0,0})}, - FunctionInfo{2050, nullptr, "Unknown2050", MakeVersionGate({20,0,0})}, - FunctionInfo{2051, nullptr, "Unknown2051", MakeVersionGate({20,0,0})}, - FunctionInfo{3000, nullptr, "RequestLatestApplicationIcon", MakeVersionGate({17,0,0})}, - FunctionInfo{3001, nullptr, "RequestDownloadIdbeLatestIconFile", MakeVersionGate({17,0,0})} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; class NIM_ECA final : public ServiceFramework { public: - explicit NIM_ECA(Core::System& system_) : ServiceFramework{system_, "nim:eca"} {} + explicit NIM_ECA(Core::System& system_) : ServiceFramework{system_, "nim:eca"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &NIM_ECA::CreateServerInterface, "CreateServerInterface"}, + {1, nullptr, "RefreshDebugAvailability"}, + {2, nullptr, "ClearDebugResponse"}, + {3, nullptr, "RegisterDebugResponse"}, + {4, &NIM_ECA::IsLargeResourceAvailable, "IsLargeResourceAvailable"}, + {5, &NIM_ECA::CreateServerInterface2, "CreateServerInterface2"} // 17.0.0+ + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -450,53 +463,45 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &NIM_ECA::CreateServerInterface, "CreateServerInterface"}, - FunctionInfo{1, nullptr, "RefreshDebugAvailability"}, - FunctionInfo{2, nullptr, "ClearDebugResponse"}, - FunctionInfo{3, nullptr, "RegisterDebugResponse"}, - FunctionInfo{4, &NIM_ECA::IsLargeResourceAvailable, "IsLargeResourceAvailable"}, - FunctionInfo{5, &NIM_ECA::CreateServerInterface2, "CreateServerInterface2", MakeVersionGate({17,0,0})} - ); }; class NIM_SHP final : public ServiceFramework { public: - explicit NIM_SHP(Core::System& system_) : ServiceFramework{system_, "nim:shp"} {} + explicit NIM_SHP(Core::System& system_) : ServiceFramework{system_, "nim:shp"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "RequestDeviceAuthenticationToken"}, + {1, nullptr, "RequestCachedDeviceAuthenticationToken"}, + {2, nullptr, "RequestEdgeToken"}, + {3, nullptr, "RequestCachedEdgeToken"}, + {100, nullptr, "RequestRegisterDeviceAccount"}, + {101, nullptr, "RequestUnregisterDeviceAccount"}, + {102, nullptr, "RequestDeviceAccountStatus"}, + {103, nullptr, "GetDeviceAccountInfo"}, + {104, nullptr, "RequestDeviceRegistrationInfo"}, + {105, nullptr, "RequestTransferDeviceAccount"}, + {106, nullptr, "RequestSyncRegistration"}, + {107, nullptr, "IsOwnDeviceId"}, + {200, nullptr, "RequestRegisterNotificationToken"}, + {300, nullptr, "RequestUnlinkDevice"}, + {301, nullptr, "RequestUnlinkDeviceIntegrated"}, + {302, nullptr, "RequestLinkDevice"}, + {303, nullptr, "HasDeviceLink"}, + {304, nullptr, "RequestUnlinkDeviceAll"}, + {305, nullptr, "RequestCreateVirtualAccount"}, + {306, nullptr, "RequestDeviceLinkStatus"}, + {400, nullptr, "GetAccountByVirtualAccount"}, + {401, nullptr, "GetVirtualAccount"}, + {500, nullptr, "RequestSyncTicketLegacy"}, + {501, nullptr, "RequestDownloadTicket"}, + {502, nullptr, "RequestDownloadTicketForPrepurchasedContents"}, + {503, nullptr, "RequestSyncTicket"}, + {504, nullptr, "RequestDownloadTicketForPrepurchasedContents2"}, + {505, nullptr, "RequestDownloadTicketForPrepurchasedContentsForAccount"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "RequestDeviceAuthenticationToken"}, - FunctionInfo{1, nullptr, "RequestCachedDeviceAuthenticationToken"}, - FunctionInfo{2, nullptr, "RequestEdgeToken"}, - FunctionInfo{3, nullptr, "RequestCachedEdgeToken"}, - FunctionInfo{100, nullptr, "RequestRegisterDeviceAccount"}, - FunctionInfo{101, nullptr, "RequestUnregisterDeviceAccount"}, - FunctionInfo{102, nullptr, "RequestDeviceAccountStatus"}, - FunctionInfo{103, nullptr, "GetDeviceAccountInfo"}, - FunctionInfo{104, nullptr, "RequestDeviceRegistrationInfo"}, - FunctionInfo{105, nullptr, "RequestTransferDeviceAccount"}, - FunctionInfo{106, nullptr, "RequestSyncRegistration"}, - FunctionInfo{107, nullptr, "IsOwnDeviceId"}, - FunctionInfo{200, nullptr, "RequestRegisterNotificationToken"}, - FunctionInfo{300, nullptr, "RequestUnlinkDevice"}, - FunctionInfo{301, nullptr, "RequestUnlinkDeviceIntegrated"}, - FunctionInfo{302, nullptr, "RequestLinkDevice"}, - FunctionInfo{303, nullptr, "HasDeviceLink"}, - FunctionInfo{304, nullptr, "RequestUnlinkDeviceAll"}, - FunctionInfo{305, nullptr, "RequestCreateVirtualAccount"}, - FunctionInfo{306, nullptr, "RequestDeviceLinkStatus"}, - FunctionInfo{400, nullptr, "GetAccountByVirtualAccount"}, - FunctionInfo{401, nullptr, "GetVirtualAccount"}, - FunctionInfo{500, nullptr, "RequestSyncTicketLegacy"}, - FunctionInfo{501, nullptr, "RequestDownloadTicket"}, - FunctionInfo{502, nullptr, "RequestDownloadTicketForPrepurchasedContents"}, - FunctionInfo{503, nullptr, "RequestSyncTicket"}, - FunctionInfo{504, nullptr, "RequestDownloadTicketForPrepurchasedContents2"}, - FunctionInfo{505, nullptr, "RequestDownloadTicketForPrepurchasedContentsForAccount"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; @@ -506,7 +511,19 @@ public: explicit IEnsureNetworkClockAvailabilityService(Core::System& system_) : ServiceFramework{system_, "IEnsureNetworkClockAvailabilityService"}, service_context{system_, "IEnsureNetworkClockAvailabilityService"} { - finished_event = service_context.CreateEvent("IEnsureNetworkClockAvailabilityService:FinishEvent"); + static const FunctionInfo functions[] = { + {0, &IEnsureNetworkClockAvailabilityService::StartTask, "StartTask"}, + {1, &IEnsureNetworkClockAvailabilityService::GetFinishNotificationEvent, + "GetFinishNotificationEvent"}, + {2, &IEnsureNetworkClockAvailabilityService::GetResult, "GetResult"}, + {3, &IEnsureNetworkClockAvailabilityService::Cancel, "Cancel"}, + {4, &IEnsureNetworkClockAvailabilityService::IsProcessing, "IsProcessing"}, + {5, &IEnsureNetworkClockAvailabilityService::GetServerTime, "GetServerTime"}, + }; + RegisterHandlers(functions); + + finished_event = + service_context.CreateEvent("IEnsureNetworkClockAvailabilityService:FinishEvent"); } ~IEnsureNetworkClockAvailabilityService() override { @@ -563,27 +580,23 @@ private: rb.PushRaw(server_time); } - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &IEnsureNetworkClockAvailabilityService::StartTask, "StartTask"}, - FunctionInfo{1, &IEnsureNetworkClockAvailabilityService::GetFinishNotificationEvent, "GetFinishNotificationEvent"}, - FunctionInfo{2, &IEnsureNetworkClockAvailabilityService::GetResult, "GetResult"}, - FunctionInfo{3, &IEnsureNetworkClockAvailabilityService::Cancel, "Cancel"}, - FunctionInfo{4, &IEnsureNetworkClockAvailabilityService::IsProcessing, "IsProcessing"}, - FunctionInfo{5, &IEnsureNetworkClockAvailabilityService::GetServerTime, "GetServerTime"} - ); KernelHelpers::ServiceContext service_context; + Kernel::KEvent* finished_event; }; class NTC final : public ServiceFramework { public: - explicit NTC(Core::System& system_) : ServiceFramework{system_, "ntc"} {} + explicit NTC(Core::System& system_) : ServiceFramework{system_, "ntc"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &NTC::OpenEnsureNetworkClockAvailabilityService, "OpenEnsureNetworkClockAvailabilityService"}, + {100, &NTC::SuspendAutonomicTimeCorrection, "SuspendAutonomicTimeCorrection"}, + {101, &NTC::ResumeAutonomicTimeCorrection, "ResumeAutonomicTimeCorrection"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -609,24 +622,18 @@ private: IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &NTC::OpenEnsureNetworkClockAvailabilityService, "OpenEnsureNetworkClockAvailabilityService"}, - FunctionInfo{100, &NTC::SuspendAutonomicTimeCorrection, "SuspendAutonomicTimeCorrection"}, - FunctionInfo{101, &NTC::ResumeAutonomicTimeCorrection, "ResumeAutonomicTimeCorrection"} - ); }; class NIM_ECAS final : public ServiceFramework { public: - explicit NIM_ECAS(Core::System& system_) : ServiceFramework{system_, "nim:ecas"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "RegisterSpecialClient"}, - FunctionInfo{1, nullptr, "UnregisterSpecialClient"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit NIM_ECAS(Core::System& system_) : ServiceFramework{system_, "nim:ecas"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "RegisterSpecialClient"}, + {1, nullptr, "UnregisterSpecialClient"}, + }; + // clang-format on + RegisterHandlers(functions); } }; diff --git a/src/core/hle/service/nim/nim.h b/src/core/hle/service/nim/nim.h index e7d599908d..0fad2a71af 100644 --- a/src/core/hle/service/nim/nim.h +++ b/src/core/hle/service/nim/nim.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/npns/npns.cpp b/src/core/hle/service/npns/npns.cpp index 90bf633e8b..b0f74bef06 100644 --- a/src/core/hle/service/npns/npns.cpp +++ b/src/core/hle/service/npns/npns.cpp @@ -19,10 +19,79 @@ class INpnsSystem final : public ServiceFramework { public: explicit INpnsSystem(Core::System& system_) : ServiceFramework{system_, "npns:s"}, service_context{system, "npns:s"}, - get_receive_event{service_context}, get_request_change_state_cancel_event{service_context} {} + get_receive_event{service_context}, get_request_change_state_cancel_event{service_context} { + // clang-format off + static const FunctionInfo functions[] = { + {1, nullptr, "ListenAll"}, + {2, C<&INpnsSystem::ListenTo>, "ListenTo"}, + {3, nullptr, "Receive"}, + {4, nullptr, "ReceiveRaw"}, + {5, C<&INpnsSystem::GetReceiveEvent>, "GetReceiveEvent"}, + {6, nullptr, "ListenUndelivered"}, + {7, nullptr, "GetStateChangeEvent"}, + {8, C<&INpnsSystem::ListenToByName>, "ListenToByName"}, + {11, nullptr, "SubscribeTopic"}, + {12, nullptr, "UnsubscribeTopic"}, + {13, nullptr, "QueryIsTopicExist"}, + {14, nullptr, "SubscribeTopicByAccount"}, // 18.0.0+ + {15, nullptr, "UnsubscribeTopicByAccount"}, // 18.0.0+ + {16, nullptr, "DownloadSubscriptionList"}, // 18.0.0+ + {21, nullptr, "CreateToken"}, + {22, nullptr, "CreateTokenWithApplicationId"}, + {23, nullptr, "DestroyToken"}, + {24, nullptr, "DestroyTokenWithApplicationId"}, + {25, nullptr, "QueryIsTokenValid"}, + {26, nullptr, "ListenToMyApplicationId"}, + {27, nullptr, "DestroyTokenAll"}, + {28, nullptr, "CreateTokenWithName"}, // 18.0.0+ + {29, nullptr, "DestroyTokenWithName"}, // 18.0.0+ + {31, nullptr, "UploadTokenToBaaS"}, + {32, nullptr, "DestroyTokenForBaaS"}, + {33, nullptr, "CreateTokenForBaaS"}, + {34, nullptr, "SetBaaSDeviceAccountIdList"}, + {35, nullptr, "LinkNsaId"}, // 17.0.0+ + {36, nullptr, "UnlinkNsaId"}, // 17.0.0+ + {37, nullptr, "RelinkNsaId"}, // 18.0.0+ + {40, nullptr, "GetNetworkServiceAccountIdTokenRequestEvent"}, // 17.0.0+ + {41, nullptr, "TryPopNetworkServiceAccountIdTokenRequestUid"}, // 17.0.0+ + {42, nullptr, "SetNetworkServiceAccountIdTokenSuccess"}, // 17.0.0+ + {43, nullptr, "SetNetworkServiceAccountIdTokenFailure"}, // 17.0.0+ + {44, nullptr, "SetUidList"}, // 17.0.0+ + {45, nullptr, "PutDigitalTwinKeyValue"}, // 17.0.0+ + {51, nullptr, "DeleteDigitalTwinKeyValue"}, // 18.0.0+ + {101, nullptr, "Suspend"}, + {102, nullptr, "Resume"}, + {103, C<&INpnsSystem::GetState>, "GetState"}, + {104, nullptr, "GetStatistics"}, + {105, nullptr, "GetPlayReportRequestEvent"}, + {106, C<&INpnsSystem::GetLastNotifiedTime>, "GetLastNotifiedTime"}, // 18.0.0+ + {107, nullptr, "SetLastNotifiedTime"}, // 18.0.0+ + {111, nullptr, "GetJid"}, + {112, nullptr, "CreateJid"}, + {113, nullptr, "DestroyJid"}, + {114, nullptr, "AttachJid"}, + {115, nullptr, "DetachJid"}, + {120, nullptr, "CreateNotificationReceiver"}, + {151, nullptr, "GetStateWithHandover"}, + {152, nullptr, "GetStateChangeEventWithHandover"}, + {153, nullptr, "GetDropEventWithHandover"}, + {154, nullptr, "CreateTokenAsync"}, + {155, nullptr, "CreateTokenAsyncWithApplicationId"}, + {156, nullptr, "CreateTokenWithNameAsync"}, // 18.0.0+ + {161, C<&INpnsSystem::GetRequestChangeStateCancelEvent>, "GetRequestChangeStateCancelEvent"}, // 10.0.0+ + {162, nullptr, "RequestChangeStateForceTimedWithCancelEvent"}, + {201, nullptr, "RequestChangeStateForceTimed"}, + {202, nullptr, "RequestChangeStateForceAsync"}, + {301, nullptr, "GetPassword"}, // 18.0.0+ + {302, nullptr, "GetAllImmigration"}, // 18.0.0+ + {303, nullptr, "GetNotificationHistories"}, // 18.0.0+ + {304, nullptr, "GetPersistentConnectionSummary"}, // 18.0.0+ + {305, nullptr, "GetDigitalTwinSummary"}, // 18.0.0+ + {306, nullptr, "GetDigitalTwinValue"}, // 18.0.0+ + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } ~INpnsSystem() override = default; @@ -71,74 +140,6 @@ private: R_SUCCEED(); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{1, nullptr, "ListenAll"}, - FunctionInfo{2, C<&INpnsSystem::ListenTo>, "ListenTo"}, - FunctionInfo{3, nullptr, "Receive"}, - FunctionInfo{4, nullptr, "ReceiveRaw"}, - FunctionInfo{5, C<&INpnsSystem::GetReceiveEvent>, "GetReceiveEvent"}, - FunctionInfo{6, nullptr, "ListenUndelivered"}, - FunctionInfo{7, nullptr, "GetStateChangeEvent"}, - FunctionInfo{8, C<&INpnsSystem::ListenToByName>, "ListenToByName"}, - FunctionInfo{11, nullptr, "SubscribeTopic"}, - FunctionInfo{12, nullptr, "UnsubscribeTopic"}, - FunctionInfo{13, nullptr, "QueryIsTopicExist"}, - FunctionInfo{14, nullptr, "SubscribeTopicByAccount", MakeVersionGate({18,0,0})}, - FunctionInfo{15, nullptr, "UnsubscribeTopicByAccount", MakeVersionGate({18,0,0})}, - FunctionInfo{16, nullptr, "DownloadSubscriptionList", MakeVersionGate({18,0,0})}, - FunctionInfo{21, nullptr, "CreateToken"}, - FunctionInfo{22, nullptr, "CreateTokenWithApplicationId"}, - FunctionInfo{23, nullptr, "DestroyToken"}, - FunctionInfo{24, nullptr, "DestroyTokenWithApplicationId"}, - FunctionInfo{25, nullptr, "QueryIsTokenValid"}, - FunctionInfo{26, nullptr, "ListenToMyApplicationId"}, - FunctionInfo{27, nullptr, "DestroyTokenAll"}, - FunctionInfo{28, nullptr, "CreateTokenWithName", MakeVersionGate({18,0,0})}, - FunctionInfo{29, nullptr, "DestroyTokenWithName", MakeVersionGate({18,0,0})}, - FunctionInfo{31, nullptr, "UploadTokenToBaaS"}, - FunctionInfo{32, nullptr, "DestroyTokenForBaaS"}, - FunctionInfo{33, nullptr, "CreateTokenForBaaS"}, - FunctionInfo{34, nullptr, "SetBaaSDeviceAccountIdList"}, - FunctionInfo{35, nullptr, "LinkNsaId", MakeVersionGate({17,0,0})}, - FunctionInfo{36, nullptr, "UnlinkNsaId", MakeVersionGate({17,0,0})}, - FunctionInfo{37, nullptr, "RelinkNsaId", MakeVersionGate({18,0,0})}, - FunctionInfo{40, nullptr, "GetNetworkServiceAccountIdTokenRequestEvent", MakeVersionGate({17,0,0})}, - FunctionInfo{41, nullptr, "TryPopNetworkServiceAccountIdTokenRequestUid", MakeVersionGate({17,0,0})}, - FunctionInfo{42, nullptr, "SetNetworkServiceAccountIdTokenSuccess", MakeVersionGate({17,0,0})}, - FunctionInfo{43, nullptr, "SetNetworkServiceAccountIdTokenFailure", MakeVersionGate({17,0,0})}, - FunctionInfo{44, nullptr, "SetUidList", MakeVersionGate({17,0,0})}, - FunctionInfo{45, nullptr, "PutDigitalTwinKeyValue", MakeVersionGate({17,0,0})}, - FunctionInfo{51, nullptr, "DeleteDigitalTwinKeyValue", MakeVersionGate({18,0,0})}, - FunctionInfo{101, nullptr, "Suspend"}, - FunctionInfo{102, nullptr, "Resume"}, - FunctionInfo{103, C<&INpnsSystem::GetState>, "GetState"}, - FunctionInfo{104, nullptr, "GetStatistics"}, - FunctionInfo{105, nullptr, "GetPlayReportRequestEvent"}, - FunctionInfo{106, C<&INpnsSystem::GetLastNotifiedTime>, "GetLastNotifiedTime", MakeVersionGate({18,0,0})}, - FunctionInfo{107, nullptr, "SetLastNotifiedTime", MakeVersionGate({18,0,0})}, - FunctionInfo{111, nullptr, "GetJid"}, - FunctionInfo{112, nullptr, "CreateJid"}, - FunctionInfo{113, nullptr, "DestroyJid"}, - FunctionInfo{114, nullptr, "AttachJid"}, - FunctionInfo{115, nullptr, "DetachJid"}, - FunctionInfo{120, nullptr, "CreateNotificationReceiver"}, - FunctionInfo{151, nullptr, "GetStateWithHandover"}, - FunctionInfo{152, nullptr, "GetStateChangeEventWithHandover"}, - FunctionInfo{153, nullptr, "GetDropEventWithHandover"}, - FunctionInfo{154, nullptr, "CreateTokenAsync"}, - FunctionInfo{155, nullptr, "CreateTokenAsyncWithApplicationId"}, - FunctionInfo{156, nullptr, "CreateTokenWithNameAsync", MakeVersionGate({18,0,0})}, - FunctionInfo{161, C<&INpnsSystem::GetRequestChangeStateCancelEvent>, "GetRequestChangeStateCancelEvent", MakeVersionGate({10,0,0})}, - FunctionInfo{162, nullptr, "RequestChangeStateForceTimedWithCancelEvent"}, - FunctionInfo{201, nullptr, "RequestChangeStateForceTimed"}, - FunctionInfo{202, nullptr, "RequestChangeStateForceAsync"}, - FunctionInfo{301, nullptr, "GetPassword", MakeVersionGate({18,0,0})}, - FunctionInfo{302, nullptr, "GetAllImmigration", MakeVersionGate({18,0,0})}, - FunctionInfo{303, nullptr, "GetNotificationHistories", MakeVersionGate({18,0,0})}, - FunctionInfo{304, nullptr, "GetPersistentConnectionSummary", MakeVersionGate({18,0,0})}, - FunctionInfo{305, nullptr, "GetDigitalTwinSummary", MakeVersionGate({18,0,0})}, - FunctionInfo{306, nullptr, "GetDigitalTwinValue", MakeVersionGate({18,0,0})} - ); KernelHelpers::ServiceContext service_context; Event get_receive_event; Event get_request_change_state_cancel_event; @@ -147,10 +148,34 @@ private: class INpnsUser final : public ServiceFramework { public: explicit INpnsUser(Core::System& system_) - : ServiceFramework{system_, "npns:u"}, service_context{system, "npns:u"}, get_receive_event{service_context} {} + : ServiceFramework{system_, "npns:u"}, service_context{system, "npns:u"}, get_receive_event{service_context} { + // clang-format off + static const FunctionInfo functions[] = { + {1, nullptr, "ListenAll"}, + {2, nullptr, "ListenTo"}, + {3, nullptr, "Receive"}, + {4, nullptr, "ReceiveRaw"}, + {5, C<&INpnsUser::GetReceiveEvent>, "GetReceiveEvent"}, + {7, nullptr, "GetStateChangeEvent"}, + {8, C<&INpnsUser::ListenToByName>, "ListenToByName"}, // 18.0.0+ + {21, nullptr, "CreateToken"}, + {23, nullptr, "DestroyToken"}, + {25, nullptr, "QueryIsTokenValid"}, + {26, nullptr, "ListenToMyApplicationId"}, + {101, nullptr, "Suspend"}, + {102, nullptr, "Resume"}, + {103, nullptr, "GetState"}, + {104, nullptr, "GetStatistics"}, + {111, nullptr, "GetJid"}, + {120, nullptr, "CreateNotificationReceiver"}, + {151, nullptr, "GetStateWithHandover"}, + {152, nullptr, "GetStateChangeEventWithHandover"}, + {153, nullptr, "GetDropEventWithHandover"}, + {154, nullptr, "CreateTokenAsync"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -170,29 +195,6 @@ private: R_SUCCEED(); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{1, nullptr, "ListenAll"}, - FunctionInfo{2, nullptr, "ListenTo"}, - FunctionInfo{3, nullptr, "Receive"}, - FunctionInfo{4, nullptr, "ReceiveRaw"}, - FunctionInfo{5, C<&INpnsUser::GetReceiveEvent>, "GetReceiveEvent"}, - FunctionInfo{7, nullptr, "GetStateChangeEvent"}, - FunctionInfo{8, C<&INpnsUser::ListenToByName>, "ListenToByName", MakeVersionGate({18,0,0})}, - FunctionInfo{21, nullptr, "CreateToken"}, - FunctionInfo{23, nullptr, "DestroyToken"}, - FunctionInfo{25, nullptr, "QueryIsTokenValid"}, - FunctionInfo{26, nullptr, "ListenToMyApplicationId"}, - FunctionInfo{101, nullptr, "Suspend"}, - FunctionInfo{102, nullptr, "Resume"}, - FunctionInfo{103, nullptr, "GetState"}, - FunctionInfo{104, nullptr, "GetStatistics"}, - FunctionInfo{111, nullptr, "GetJid"}, - FunctionInfo{120, nullptr, "CreateNotificationReceiver"}, - FunctionInfo{151, nullptr, "GetStateWithHandover"}, - FunctionInfo{152, nullptr, "GetStateChangeEventWithHandover"}, - FunctionInfo{153, nullptr, "GetDropEventWithHandover"}, - FunctionInfo{154, nullptr, "CreateTokenAsync"} - ); KernelHelpers::ServiceContext service_context; Event get_receive_event; }; diff --git a/src/core/hle/service/npns/npns.h b/src/core/hle/service/npns/npns.h index 0019fca763..e54a91a213 100644 --- a/src/core/hle/service/npns/npns.h +++ b/src/core/hle/service/npns/npns.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/ns/account_proxy_interface.cpp b/src/core/hle/service/ns/account_proxy_interface.cpp index 0107e16b72..2e3dcf928d 100644 --- a/src/core/hle/service/ns/account_proxy_interface.cpp +++ b/src/core/hle/service/ns/account_proxy_interface.cpp @@ -10,6 +10,13 @@ namespace Service::NS { IAccountProxyInterface::IAccountProxyInterface(Core::System& system_) : ServiceFramework{system_, "IAccountProxyInterface"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "CreateUserAccount"}, + }; + // clang-format on + + RegisterHandlers(functions); } IAccountProxyInterface::~IAccountProxyInterface() = default; diff --git a/src/core/hle/service/ns/account_proxy_interface.h b/src/core/hle/service/ns/account_proxy_interface.h index 37248726a9..14cec4ddbc 100644 --- a/src/core/hle/service/ns/account_proxy_interface.h +++ b/src/core/hle/service/ns/account_proxy_interface.h @@ -14,13 +14,6 @@ class IAccountProxyInterface final : public ServiceFramework FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "CreateUserAccount"} - ); }; } // namespace Service::NS diff --git a/src/core/hle/service/ns/application_manager_interface.cpp b/src/core/hle/service/ns/application_manager_interface.cpp index 7220c52dcb..348649917e 100644 --- a/src/core/hle/service/ns/application_manager_interface.cpp +++ b/src/core/hle/service/ns/application_manager_interface.cpp @@ -25,458 +25,6 @@ namespace Service::NS { -std::optional IApplicationManagerInterface::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IApplicationManagerInterface::ListApplicationRecord>, "ListApplicationRecord"}, - FunctionInfo{1, nullptr, "GenerateApplicationRecordCount"}, - FunctionInfo{2, D<&IApplicationManagerInterface::GetApplicationRecordUpdateSystemEvent>, "GetApplicationRecordUpdateSystemEvent"}, - FunctionInfo{3, nullptr, "GetApplicationViewDeprecated"}, - FunctionInfo{4, D<&IApplicationManagerInterface::DeleteApplicationEntity>, "DeleteApplicationEntity"}, - FunctionInfo{5, D<&IApplicationManagerInterface::DeleteApplicationCompletely>, "DeleteApplicationCompletely"}, - FunctionInfo{6, nullptr, "IsAnyApplicationEntityRedundant"}, - FunctionInfo{7, nullptr, "DeleteRedundantApplicationEntity"}, - FunctionInfo{8, nullptr, "IsApplicationEntityMovable"}, - FunctionInfo{9, nullptr, "MoveApplicationEntity"}, - FunctionInfo{11, nullptr, "CalculateApplicationOccupiedSize"}, - FunctionInfo{16, &IApplicationManagerInterface::PushApplicationRecord, "PushApplicationRecord"}, - FunctionInfo{17, nullptr, "ListApplicationRecordContentMeta"}, - FunctionInfo{19, nullptr, "LaunchApplicationOld"}, - FunctionInfo{21, nullptr, "GetApplicationContentPath"}, - FunctionInfo{22, nullptr, "TerminateApplication"}, - FunctionInfo{23, nullptr, "ResolveApplicationContentPath"}, - FunctionInfo{26, nullptr, "BeginInstallApplication"}, - FunctionInfo{27, nullptr, "DeleteApplicationRecord"}, - FunctionInfo{30, nullptr, "RequestApplicationUpdateInfo"}, - FunctionInfo{31, nullptr, "RequestUpdateApplication"}, - FunctionInfo{32, nullptr, "CancelApplicationDownload"}, - FunctionInfo{33, nullptr, "ResumeApplicationDownload"}, - FunctionInfo{35, nullptr, "UpdateVersionList"}, - FunctionInfo{36, nullptr, "PushLaunchVersion"}, - FunctionInfo{37, nullptr, "ListRequiredVersion"}, - FunctionInfo{38, D<&IApplicationManagerInterface::CheckApplicationLaunchVersion>, "CheckApplicationLaunchVersion"}, - FunctionInfo{39, nullptr, "CheckApplicationLaunchRights"}, - FunctionInfo{40, D<&IApplicationManagerInterface::GetApplicationLogoData>, "GetApplicationLogoData"}, - FunctionInfo{41, nullptr, "CalculateApplicationDownloadRequiredSize"}, - FunctionInfo{42, nullptr, "CleanupSdCard"}, - FunctionInfo{43, D<&IApplicationManagerInterface::CheckSdCardMountStatus>, "CheckSdCardMountStatus"}, - FunctionInfo{44, D<&IApplicationManagerInterface::GetSdCardMountStatusChangedEvent>, "GetSdCardMountStatusChangedEvent"}, - FunctionInfo{45, nullptr, "GetGameCardAttachmentEvent"}, - FunctionInfo{46, nullptr, "GetGameCardAttachmentInfo"}, - FunctionInfo{47, D<&IApplicationManagerInterface::GetTotalSpaceSize>, "GetTotalSpaceSize"}, - FunctionInfo{48, D<&IApplicationManagerInterface::GetFreeSpaceSize>, "GetFreeSpaceSize"}, - FunctionInfo{49, nullptr, "GetSdCardRemovedEvent"}, - FunctionInfo{52, D<&IApplicationManagerInterface::GetGameCardUpdateDetectionEvent>, "GetGameCardUpdateDetectionEvent"}, - FunctionInfo{53, nullptr, "DisableApplicationAutoDelete"}, - FunctionInfo{54, nullptr, "EnableApplicationAutoDelete"}, - FunctionInfo{55, D<&IApplicationManagerInterface::GetApplicationDesiredLanguage>, "GetApplicationDesiredLanguage"}, - FunctionInfo{56, nullptr, "SetApplicationTerminateResult"}, - FunctionInfo{57, nullptr, "ClearApplicationTerminateResult"}, - FunctionInfo{58, nullptr, "GetLastSdCardMountUnexpectedResult"}, - FunctionInfo{59, D<&IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode>, "ConvertApplicationLanguageToLanguageCode"}, - FunctionInfo{60, nullptr, "ConvertLanguageCodeToApplicationLanguage"}, - FunctionInfo{61, nullptr, "GetBackgroundDownloadStressTaskInfo"}, - FunctionInfo{62, nullptr, "GetGameCardStopper"}, - FunctionInfo{63, nullptr, "IsSystemProgramInstalled"}, - FunctionInfo{64, nullptr, "StartApplyDeltaTask"}, - FunctionInfo{65, nullptr, "GetRequestServerStopper"}, - FunctionInfo{66, nullptr, "GetBackgroundApplyDeltaStressTaskInfo"}, - FunctionInfo{67, nullptr, "CancelApplicationApplyDelta"}, - FunctionInfo{68, nullptr, "ResumeApplicationApplyDelta"}, - FunctionInfo{69, nullptr, "CalculateApplicationApplyDeltaRequiredSize"}, - FunctionInfo{70, D<&IApplicationManagerInterface::ResumeAll>, "ResumeAll"}, - FunctionInfo{71, D<&IApplicationManagerInterface::GetStorageSize>, "GetStorageSize"}, - FunctionInfo{80, nullptr, "RequestDownloadApplication"}, - FunctionInfo{81, nullptr, "RequestDownloadAddOnContent"}, - FunctionInfo{82, nullptr, "DownloadApplication"}, - FunctionInfo{83, nullptr, "CheckApplicationResumeRights"}, - FunctionInfo{84, nullptr, "GetDynamicCommitEvent"}, - FunctionInfo{85, nullptr, "RequestUpdateApplication2"}, - FunctionInfo{86, nullptr, "EnableApplicationCrashReport"}, - FunctionInfo{87, nullptr, "IsApplicationCrashReportEnabled"}, - FunctionInfo{90, nullptr, "BoostSystemMemoryResourceLimit"}, - FunctionInfo{91, nullptr, "DeprecatedLaunchApplication"}, - FunctionInfo{92, nullptr, "GetRunningApplicationProgramId"}, - FunctionInfo{93, nullptr, "GetMainApplicationProgramIndex"}, - FunctionInfo{94, nullptr, "LaunchApplication"}, - FunctionInfo{95, nullptr, "GetApplicationLaunchInfo"}, - FunctionInfo{96, nullptr, "AcquireApplicationLaunchInfo"}, - FunctionInfo{97, nullptr, "GetMainApplicationProgramIndexByApplicationLaunchInfo"}, - FunctionInfo{98, nullptr, "EnableApplicationAllThreadDumpOnCrash"}, - FunctionInfo{99, nullptr, "LaunchDevMenu"}, - FunctionInfo{100, nullptr, "ResetToFactorySettings"}, - FunctionInfo{101, nullptr, "ResetToFactorySettingsWithoutUserSaveData"}, - FunctionInfo{102, nullptr, "ResetToFactorySettingsForRefurbishment"}, - FunctionInfo{103, nullptr, "ResetToFactorySettingsWithPlatformRegion"}, - FunctionInfo{104, nullptr, "ResetToFactorySettingsWithPlatformRegionAuthentication"}, - FunctionInfo{105, nullptr, "RequestResetToFactorySettingsSecurely"}, - FunctionInfo{106, nullptr, "RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely"}, - FunctionInfo{200, nullptr, "CalculateUserSaveDataStatistics"}, - FunctionInfo{201, nullptr, "DeleteUserSaveDataAll"}, - FunctionInfo{210, nullptr, "DeleteUserSystemSaveData"}, - FunctionInfo{211, nullptr, "DeleteSaveData"}, - FunctionInfo{220, nullptr, "UnregisterNetworkServiceAccount"}, - FunctionInfo{221, D<&IApplicationManagerInterface::UnregisterNetworkServiceAccountWithUserSaveDataDeletion>, "UnregisterNetworkServiceAccountWithUserSaveDataDeletion"}, - FunctionInfo{300, nullptr, "GetApplicationShellEvent"}, - FunctionInfo{301, nullptr, "PopApplicationShellEventInfo"}, - FunctionInfo{302, nullptr, "LaunchLibraryApplet"}, - FunctionInfo{303, nullptr, "TerminateLibraryApplet"}, - FunctionInfo{304, nullptr, "LaunchSystemApplet"}, - FunctionInfo{305, nullptr, "TerminateSystemApplet"}, - FunctionInfo{306, nullptr, "LaunchOverlayApplet"}, - FunctionInfo{307, nullptr, "TerminateOverlayApplet"}, - FunctionInfo{400, D<&IApplicationManagerInterface::GetApplicationControlData>, "GetApplicationControlData"}, - FunctionInfo{401, nullptr, "InvalidateAllApplicationControlCache"}, - FunctionInfo{402, nullptr, "RequestDownloadApplicationControlData"}, - FunctionInfo{403, nullptr, "GetMaxApplicationControlCacheCount"}, - FunctionInfo{404, nullptr, "InvalidateApplicationControlCache"}, - FunctionInfo{405, nullptr, "ListApplicationControlCacheEntryInfo"}, - FunctionInfo{406, nullptr, "GetApplicationControlProperty"}, - FunctionInfo{407, &IApplicationManagerInterface::ListApplicationTitle, "ListApplicationTitle"}, - FunctionInfo{408, &IApplicationManagerInterface::ListApplicationIcon, "ListApplicationIcon"}, - FunctionInfo{411, nullptr, "Unknown411", MakeVersionGate({19,0,0})}, - FunctionInfo{412, nullptr, "Unknown412", MakeVersionGate({19,0,0})}, - FunctionInfo{413, nullptr, "Unknown413", MakeVersionGate({19,0,0})}, - FunctionInfo{414, nullptr, "Unknown414", MakeVersionGate({19,0,0})}, - FunctionInfo{415, nullptr, "Unknown415", MakeVersionGate({19,0,0})}, - FunctionInfo{416, nullptr, "Unknown416", MakeVersionGate({19,0,0})}, - FunctionInfo{417, nullptr, "InvalidateAllApplicationControlCacheOfTheStage", MakeVersionGate({19,0,0})}, - FunctionInfo{418, nullptr, "InvalidateApplicationControlCacheOfTheStage", MakeVersionGate({19,0,0})}, - FunctionInfo{419, D<&IApplicationManagerInterface::RequestDownloadApplicationControlDataInBackground>, "RequestDownloadApplicationControlDataInBackground"}, - FunctionInfo{420, nullptr, "CloneApplicationControlDataCacheForDebug"}, - FunctionInfo{421, nullptr, "Unknown421", MakeVersionGate({20,0,0})}, - FunctionInfo{422, nullptr, "Unknown422", MakeVersionGate({20,0,0})}, - FunctionInfo{423, nullptr, "Unknown423", MakeVersionGate({20,0,0})}, - FunctionInfo{424, nullptr, "Unknown424", MakeVersionGate({20,0,0})}, - FunctionInfo{425, nullptr, "Unknown425", MakeVersionGate({20,0,0})}, - FunctionInfo{426, nullptr, "Unknown426", MakeVersionGate({20,0,0})}, - FunctionInfo{427, nullptr, "Unknown427", MakeVersionGate({20,0,0})}, - FunctionInfo{428, nullptr, "Unknown428", MakeVersionGate({21,0,0})}, - FunctionInfo{429, nullptr, "Unknown429", MakeVersionGate({21,0,0})}, - FunctionInfo{430, nullptr, "Unknown430", MakeVersionGate({21,0,0})}, - FunctionInfo{502, nullptr, "RequestCheckGameCardRegistration"}, - FunctionInfo{503, nullptr, "RequestGameCardRegistrationGoldPoint"}, - FunctionInfo{504, nullptr, "RequestRegisterGameCard"}, - FunctionInfo{505, D<&IApplicationManagerInterface::GetGameCardMountFailureEvent>, "GetGameCardMountFailureEvent"}, - FunctionInfo{506, nullptr, "IsGameCardInserted"}, - FunctionInfo{507, nullptr, "EnsureGameCardAccess"}, - FunctionInfo{508, nullptr, "GetLastGameCardMountFailureResult"}, - FunctionInfo{509, nullptr, "ListApplicationIdOnGameCard"}, - FunctionInfo{510, nullptr, "GetGameCardPlatformRegion"}, - FunctionInfo{511, D<&IApplicationManagerInterface::GetGameCardWakenReadyEvent>, "GetGameCardWakenReadyEvent"}, - FunctionInfo{512, D<&IApplicationManagerInterface::IsGameCardApplicationRunning>, "IsGameCardApplicationRunning"}, - FunctionInfo{513, nullptr, "Unknown513", MakeVersionGate({20,0,0})}, - FunctionInfo{514, nullptr, "Unknown514", MakeVersionGate({20,0,0})}, - FunctionInfo{515, nullptr, "Unknown515", MakeVersionGate({20,0,0})}, - FunctionInfo{516, nullptr, "Unknown516", MakeVersionGate({21,0,0})}, - FunctionInfo{517, nullptr, "Unknown517", MakeVersionGate({21,0,0})}, - FunctionInfo{518, nullptr, "Unknown518", MakeVersionGate({21,0,0})}, - FunctionInfo{519, nullptr, "Unknown519", MakeVersionGate({21,0,0})}, - FunctionInfo{600, nullptr, "CountApplicationContentMeta"}, - FunctionInfo{601, nullptr, "ListApplicationContentMetaStatus"}, - FunctionInfo{602, nullptr, "ListAvailableAddOnContent"}, - FunctionInfo{603, nullptr, "GetOwnedApplicationContentMetaStatus"}, - FunctionInfo{604, nullptr, "RegisterContentsExternalKey"}, - FunctionInfo{605, nullptr, "ListApplicationContentMetaStatusWithRightsCheck"}, - FunctionInfo{606, nullptr, "GetContentMetaStorage"}, - FunctionInfo{607, nullptr, "ListAvailableAddOnContent"}, - FunctionInfo{609, nullptr, "ListAvailabilityAssuredAddOnContent"}, - FunctionInfo{610, nullptr, "GetInstalledContentMetaStorage"}, - FunctionInfo{611, nullptr, "PrepareAddOnContent"}, - FunctionInfo{700, nullptr, "PushDownloadTaskList"}, - FunctionInfo{701, nullptr, "ClearTaskStatusList"}, - FunctionInfo{702, nullptr, "RequestDownloadTaskList"}, - FunctionInfo{703, nullptr, "RequestEnsureDownloadTask"}, - FunctionInfo{704, nullptr, "ListDownloadTaskStatus"}, - FunctionInfo{705, nullptr, "RequestDownloadTaskListData"}, - FunctionInfo{800, nullptr, "RequestVersionList"}, - FunctionInfo{801, nullptr, "ListVersionList"}, - FunctionInfo{802, nullptr, "RequestVersionListData"}, - FunctionInfo{900, nullptr, "GetApplicationRecord"}, - FunctionInfo{901, nullptr, "GetApplicationRecordProperty"}, - FunctionInfo{902, nullptr, "EnableApplicationAutoUpdate"}, - FunctionInfo{903, nullptr, "DisableApplicationAutoUpdate"}, - FunctionInfo{904, D<&IApplicationManagerInterface::TouchApplication>, "TouchApplication"}, - FunctionInfo{905, nullptr, "RequestApplicationUpdate"}, - FunctionInfo{906, D<&IApplicationManagerInterface::IsApplicationUpdateRequested>, "IsApplicationUpdateRequested"}, - FunctionInfo{907, nullptr, "WithdrawApplicationUpdateRequest"}, - FunctionInfo{908, nullptr, "ListApplicationRecordInstalledContentMeta"}, - FunctionInfo{909, nullptr, "WithdrawCleanupAddOnContentsWithNoRightsRecommendation"}, - FunctionInfo{910, nullptr, "HasApplicationRecord"}, - FunctionInfo{911, nullptr, "SetPreInstalledApplication"}, - FunctionInfo{912, nullptr, "ClearPreInstalledApplicationFlag"}, - FunctionInfo{913, nullptr, "ListAllApplicationRecord"}, - FunctionInfo{914, nullptr, "HideApplicationRecord"}, - FunctionInfo{915, nullptr, "ShowApplicationRecord"}, - FunctionInfo{916, nullptr, "IsApplicationAutoDeleteDisabled"}, - FunctionInfo{916, nullptr, "Unknown916", MakeVersionGate({20,0,0})}, - FunctionInfo{917, nullptr, "Unknown917", MakeVersionGate({20,0,0})}, - FunctionInfo{918, nullptr, "Unknown918", MakeVersionGate({20,0,0})}, - FunctionInfo{919, nullptr, "Unknown919", MakeVersionGate({20,0,0})}, - FunctionInfo{920, nullptr, "Unknown920", MakeVersionGate({20,0,0})}, - FunctionInfo{921, nullptr, "Unknown921", MakeVersionGate({20,0,0})}, - FunctionInfo{922, nullptr, "Unknown922", MakeVersionGate({20,0,0})}, - FunctionInfo{923, nullptr, "Unknown923", MakeVersionGate({20,0,0})}, - FunctionInfo{928, nullptr, "Unknown928", MakeVersionGate({20,0,0})}, - FunctionInfo{929, nullptr, "Unknown929", MakeVersionGate({20,0,0})}, - FunctionInfo{930, nullptr, "Unknown930", MakeVersionGate({20,0,0})}, - FunctionInfo{931, nullptr, "Unknown931", MakeVersionGate({20,0,0})}, - FunctionInfo{933, nullptr, "Unknown933", MakeVersionGate({20,0,0})}, - FunctionInfo{934, nullptr, "Unknown934", MakeVersionGate({21,0,0})}, - FunctionInfo{935, nullptr, "Unknown935", MakeVersionGate({21,0,0})}, - FunctionInfo{936, D<&IApplicationManagerInterface::Unknown936>, "Unknown936", MakeVersionGate({21,0,0})}, - FunctionInfo{1000, nullptr, "RequestVerifyApplicationDeprecated"}, - FunctionInfo{1001, nullptr, "CorruptApplicationForDebug"}, - FunctionInfo{1002, nullptr, "RequestVerifyAddOnContentsRights"}, - FunctionInfo{1003, nullptr, "RequestVerifyApplication"}, - FunctionInfo{1004, nullptr, "CorruptContentForDebug"}, - FunctionInfo{1200, nullptr, "NeedsUpdateVulnerability"}, - FunctionInfo{1300, D<&IApplicationManagerInterface::IsAnyApplicationEntityInstalled>, "IsAnyApplicationEntityInstalled"}, - FunctionInfo{1301, nullptr, "DeleteApplicationContentEntities"}, - FunctionInfo{1302, nullptr, "CleanupUnrecordedApplicationEntity"}, - FunctionInfo{1303, nullptr, "CleanupAddOnContentsWithNoRights"}, - FunctionInfo{1304, nullptr, "DeleteApplicationContentEntity"}, - FunctionInfo{1305, nullptr, "TryDeleteRunningApplicationEntity"}, - FunctionInfo{1306, nullptr, "TryDeleteRunningApplicationCompletely"}, - FunctionInfo{1307, nullptr, "TryDeleteRunningApplicationContentEntities"}, - FunctionInfo{1308, nullptr, "DeleteApplicationCompletelyForDebug"}, - FunctionInfo{1309, nullptr, "CleanupUnavailableAddOnContents"}, - FunctionInfo{1310, nullptr, "RequestMoveApplicationEntity"}, - FunctionInfo{1311, nullptr, "EstimateSizeToMove"}, - FunctionInfo{1312, nullptr, "HasMovableEntity"}, - FunctionInfo{1313, nullptr, "CleanupOrphanContents"}, - FunctionInfo{1314, nullptr, "CheckPreconditionSatisfiedToMove"}, - FunctionInfo{1400, nullptr, "PrepareShutdown"}, - FunctionInfo{1500, nullptr, "FormatSdCard"}, - FunctionInfo{1501, nullptr, "NeedsSystemUpdateToFormatSdCard"}, - FunctionInfo{1502, nullptr, "GetLastSdCardFormatUnexpectedResult"}, - FunctionInfo{1504, nullptr, "InsertSdCard"}, - FunctionInfo{1505, nullptr, "RemoveSdCard"}, - FunctionInfo{1506, nullptr, "GetSdCardStartupStatus"}, - FunctionInfo{1508, nullptr, "Unknown1508", MakeVersionGate({20,0,0})}, - FunctionInfo{1509, nullptr, "Unknown1509", MakeVersionGate({20,0,0})}, - FunctionInfo{1510, nullptr, "Unknown1510", MakeVersionGate({20,0,0})}, - FunctionInfo{1511, nullptr, "Unknown1511", MakeVersionGate({20,0,0})}, - FunctionInfo{1512, nullptr, "Unknown1512", MakeVersionGate({20,0,0})}, - FunctionInfo{1600, nullptr, "GetSystemSeedForPseudoDeviceId"}, - FunctionInfo{1601, nullptr, "ResetSystemSeedForPseudoDeviceId"}, - FunctionInfo{1700, nullptr, "ListApplicationDownloadingContentMeta"}, - FunctionInfo{1701, D<&IApplicationManagerInterface::GetApplicationViewDeprecated>, "GetApplicationViewDeprecated"}, - FunctionInfo{1702, nullptr, "GetApplicationDownloadTaskStatus"}, - FunctionInfo{1703, nullptr, "GetApplicationViewDownloadErrorContext"}, - FunctionInfo{1704, D<&IApplicationManagerInterface::GetApplicationViewWithPromotionInfo>, "GetApplicationViewWithPromotionInfo"}, - FunctionInfo{1705, nullptr, "IsPatchAutoDeletableApplication"}, - FunctionInfo{1706, D<&IApplicationManagerInterface::GetApplicationView>, "GetApplicationView"}, - FunctionInfo{1800, nullptr, "IsNotificationSetupCompleted"}, - FunctionInfo{1801, nullptr, "GetLastNotificationInfoCount"}, - FunctionInfo{1802, nullptr, "ListLastNotificationInfo"}, - FunctionInfo{1803, nullptr, "ListNotificationTask"}, - FunctionInfo{1900, nullptr, "IsActiveAccount"}, - FunctionInfo{1901, nullptr, "RequestDownloadApplicationPrepurchasedRights"}, - FunctionInfo{1902, nullptr, "GetApplicationTicketInfo"}, - FunctionInfo{1903, nullptr, "RequestDownloadApplicationPrepurchasedRightsForAccount"}, - FunctionInfo{2000, nullptr, "GetSystemDeliveryInfo"}, - FunctionInfo{2001, nullptr, "SelectLatestSystemDeliveryInfo"}, - FunctionInfo{2002, nullptr, "VerifyDeliveryProtocolVersion"}, - FunctionInfo{2003, nullptr, "GetApplicationDeliveryInfo"}, - FunctionInfo{2004, nullptr, "HasAllContentsToDeliver"}, - FunctionInfo{2005, nullptr, "CompareApplicationDeliveryInfo"}, - FunctionInfo{2006, nullptr, "CanDeliverApplication"}, - FunctionInfo{2007, nullptr, "ListContentMetaKeyToDeliverApplication"}, - FunctionInfo{2008, nullptr, "NeedsSystemUpdateToDeliverApplication"}, - FunctionInfo{2009, nullptr, "EstimateRequiredSize"}, - FunctionInfo{2010, nullptr, "RequestReceiveApplication"}, - FunctionInfo{2011, nullptr, "CommitReceiveApplication"}, - FunctionInfo{2012, nullptr, "GetReceiveApplicationProgress"}, - FunctionInfo{2013, nullptr, "RequestSendApplication"}, - FunctionInfo{2014, nullptr, "GetSendApplicationProgress"}, - FunctionInfo{2015, nullptr, "CompareSystemDeliveryInfo"}, - FunctionInfo{2016, nullptr, "ListNotCommittedContentMeta"}, - FunctionInfo{2017, nullptr, "CreateDownloadTask"}, - FunctionInfo{2018, nullptr, "GetApplicationDeliveryInfoHash"}, - FunctionInfo{2019, nullptr, "Unknown2019", MakeVersionGate({20,0,0})}, - FunctionInfo{2050, D<&IApplicationManagerInterface::GetApplicationRightsOnClient>, "GetApplicationRightsOnClient"}, - FunctionInfo{2051, nullptr, "InvalidateRightsIdCache"}, - FunctionInfo{2052, nullptr, "Unknown2052", MakeVersionGate({20,0,0})}, - FunctionInfo{2053, nullptr, "Unknown2053", MakeVersionGate({20,0,0})}, - FunctionInfo{2100, D<&IApplicationManagerInterface::GetApplicationTerminateResult>, "GetApplicationTerminateResult"}, - FunctionInfo{2101, nullptr, "GetRawApplicationTerminateResult"}, - FunctionInfo{2150, nullptr, "CreateRightsEnvironment"}, - FunctionInfo{2151, nullptr, "DestroyRightsEnvironment"}, - FunctionInfo{2152, nullptr, "ActivateRightsEnvironment"}, - FunctionInfo{2153, nullptr, "DeactivateRightsEnvironment"}, - FunctionInfo{2154, nullptr, "ForceActivateRightsContextForExit"}, - FunctionInfo{2155, nullptr, "UpdateRightsEnvironmentStatus"}, - FunctionInfo{2156, nullptr, "CreateRightsEnvironmentForMicroApplication"}, - FunctionInfo{2160, nullptr, "AddTargetApplicationToRightsEnvironment"}, - FunctionInfo{2161, nullptr, "SetUsersToRightsEnvironment"}, - FunctionInfo{2170, nullptr, "GetRightsEnvironmentStatus"}, - FunctionInfo{2171, nullptr, "GetRightsEnvironmentStatusChangedEvent"}, - FunctionInfo{2180, nullptr, "RequestExtendRightsInRightsEnvironment"}, - FunctionInfo{2181, nullptr, "GetResultOfExtendRightsInRightsEnvironment"}, - FunctionInfo{2182, nullptr, "SetActiveRightsContextUsingStateToRightsEnvironment"}, - FunctionInfo{2183, nullptr, "Unknown2183", MakeVersionGate({20,1,0})}, - FunctionInfo{2190, nullptr, "GetRightsEnvironmentHandleForApplication"}, - FunctionInfo{2199, nullptr, "GetRightsEnvironmentCountForDebug"}, - FunctionInfo{2200, nullptr, "GetGameCardApplicationCopyIdentifier"}, - FunctionInfo{2201, nullptr, "GetInstalledApplicationCopyIdentifier"}, - FunctionInfo{2250, nullptr, "RequestReportActiveELicence"}, - FunctionInfo{2300, nullptr, "ListEventLog"}, - FunctionInfo{2350, nullptr, "PerformAutoUpdateByApplicationId"}, - FunctionInfo{2351, nullptr, "RequestNoDownloadRightsErrorResolution"}, - FunctionInfo{2352, nullptr, "RequestResolveNoDownloadRightsError"}, - FunctionInfo{2353, nullptr, "GetApplicationDownloadTaskInfo"}, - FunctionInfo{2354, nullptr, "PrioritizeApplicationBackgroundTask"}, - FunctionInfo{2355, nullptr, "PreferStorageEfficientUpdate"}, - FunctionInfo{2356, nullptr, "RequestStorageEfficientUpdatePreferable"}, - FunctionInfo{2357, nullptr, "EnableMultiCoreDownload"}, - FunctionInfo{2358, nullptr, "DisableMultiCoreDownload"}, - FunctionInfo{2359, nullptr, "IsMultiCoreDownloadEnabled"}, - FunctionInfo{2360, nullptr, "GetApplicationDownloadTaskCount", MakeVersionGate({19,0,0})}, - FunctionInfo{2361, nullptr, "GetMaxApplicationDownloadTaskCount", MakeVersionGate({19,0,0})}, - FunctionInfo{2362, nullptr, "Unknown2362", MakeVersionGate({20,0,0})}, - FunctionInfo{2363, nullptr, "Unknown2363", MakeVersionGate({20,0,0})}, - FunctionInfo{2364, nullptr, "Unknown2364", MakeVersionGate({20,0,0})}, - FunctionInfo{2365, nullptr, "Unknown2365", MakeVersionGate({20,0,0})}, - FunctionInfo{2366, nullptr, "Unknown2366", MakeVersionGate({20,0,0})}, - FunctionInfo{2367, nullptr, "Unknown2367", MakeVersionGate({20,0,0})}, - FunctionInfo{2368, nullptr, "Unknown2368", MakeVersionGate({20,0,0})}, - FunctionInfo{2369, nullptr, "Unknown2369", MakeVersionGate({21,0,0})}, - FunctionInfo{2400, nullptr, "GetPromotionInfo"}, - FunctionInfo{2401, nullptr, "CountPromotionInfo"}, - FunctionInfo{2402, nullptr, "ListPromotionInfo"}, - FunctionInfo{2403, nullptr, "ImportPromotionJsonForDebug"}, - FunctionInfo{2404, nullptr, "ClearPromotionInfoForDebug"}, - FunctionInfo{2500, nullptr, "ConfirmAvailableTime"}, - FunctionInfo{2510, nullptr, "CreateApplicationResource"}, - FunctionInfo{2511, nullptr, "GetApplicationResource"}, - FunctionInfo{2513, nullptr, "LaunchMicroApplication"}, - FunctionInfo{2514, nullptr, "ClearTaskOfAsyncTaskManager"}, - FunctionInfo{2515, nullptr, "CleanupAllPlaceHolderAndFragmentsIfNoTask"}, - FunctionInfo{2516, nullptr, "EnsureApplicationCertificate"}, - FunctionInfo{2517, nullptr, "CreateApplicationInstance"}, - FunctionInfo{2518, nullptr, "UpdateQualificationForDebug"}, - FunctionInfo{2519, nullptr, "IsQualificationTransitionSupported"}, - FunctionInfo{2520, D<&IApplicationManagerInterface::IsQualificationTransitionSupportedByProcessId>, "IsQualificationTransitionSupportedByProcessId"}, - FunctionInfo{2521, nullptr, "GetRightsUserChangedEvent"}, - FunctionInfo{2522, nullptr, "IsRomRedirectionAvailable"}, - FunctionInfo{2523, nullptr, "GetProgramId", MakeVersionGate({17,0,0})}, - FunctionInfo{2524, nullptr, "Unknown2524", MakeVersionGate({19,0,0})}, - FunctionInfo{2525, nullptr, "Unknown2525", MakeVersionGate({20,0,0})}, - FunctionInfo{2800, nullptr, "GetApplicationIdOfPreomia"}, - FunctionInfo{3000, nullptr, "RegisterDeviceLockKey"}, - FunctionInfo{3001, nullptr, "UnregisterDeviceLockKey"}, - FunctionInfo{3002, nullptr, "VerifyDeviceLockKey"}, - FunctionInfo{3003, nullptr, "HideApplicationIcon"}, - FunctionInfo{3004, nullptr, "ShowApplicationIcon"}, - FunctionInfo{3005, nullptr, "HideApplicationTitle"}, - FunctionInfo{3006, nullptr, "ShowApplicationTitle"}, - FunctionInfo{3007, nullptr, "EnableGameCard"}, - FunctionInfo{3008, nullptr, "DisableGameCard"}, - FunctionInfo{3009, nullptr, "EnableLocalContentShare"}, - FunctionInfo{3010, nullptr, "DisableLocalContentShare"}, - FunctionInfo{3011, nullptr, "IsApplicationIconHidden"}, - FunctionInfo{3012, nullptr, "IsApplicationTitleHidden"}, - FunctionInfo{3013, nullptr, "IsGameCardEnabled"}, - FunctionInfo{3014, nullptr, "IsLocalContentShareEnabled"}, - FunctionInfo{3050, nullptr, "ListAssignELicenseTaskResult"}, - FunctionInfo{3104, nullptr, "GetApplicationNintendoLogo", MakeVersionGate({18,0,0})}, - FunctionInfo{3105, nullptr, "GetApplicationStartupMovie", MakeVersionGate({18,0,0})}, - FunctionInfo{4000, nullptr, "Unknown4000", MakeVersionGate({20,0,0})}, - FunctionInfo{4004, nullptr, "Unknown4004", MakeVersionGate({20,0,0})}, - FunctionInfo{4006, nullptr, "Unknown4006", MakeVersionGate({20,0,0})}, - FunctionInfo{4007, nullptr, "Unknown4007", MakeVersionGate({20,0,0})}, - FunctionInfo{4008, nullptr, "Unknown4008", MakeVersionGate({20,0,0})}, - FunctionInfo{4009, nullptr, "Unknown4009", MakeVersionGate({20,0,0})}, - FunctionInfo{4010, nullptr, "Unknown4010", MakeVersionGate({20,0,0})}, - FunctionInfo{4011, nullptr, "Unknown4011", MakeVersionGate({20,0,0})}, - FunctionInfo{4012, nullptr, "Unknown4012", MakeVersionGate({20,0,0})}, - FunctionInfo{4013, nullptr, "Unknown4013", MakeVersionGate({20,0,0})}, - FunctionInfo{4015, nullptr, "Unknown4015", MakeVersionGate({20,0,0})}, - FunctionInfo{4017, nullptr, "Unknown4017", MakeVersionGate({20,0,0})}, - FunctionInfo{4019, nullptr, "Unknown4019", MakeVersionGate({20,0,0})}, - FunctionInfo{4020, nullptr, "Unknown4020", MakeVersionGate({20,0,0})}, - FunctionInfo{4021, nullptr, "Unknown4021", MakeVersionGate({20,0,0})}, - FunctionInfo{4022, D<&IApplicationManagerInterface::Unknown4022>, "Unknown4022", MakeVersionGate({20,0,0})}, - FunctionInfo{4023, D<&IApplicationManagerInterface::Unknown4023>, "Unknown4023", MakeVersionGate({20,0,0})}, - FunctionInfo{4024, nullptr, "Unknown4024", MakeVersionGate({20,0,0})}, - FunctionInfo{4025, nullptr, "Unknown4025", MakeVersionGate({20,0,0})}, - FunctionInfo{4026, nullptr, "Unknown4026", MakeVersionGate({20,0,0})}, - FunctionInfo{4027, nullptr, "Unknown4027", MakeVersionGate({20,0,0})}, - FunctionInfo{4028, nullptr, "Unknown4028", MakeVersionGate({20,0,0})}, - FunctionInfo{4029, nullptr, "Unknown4029", MakeVersionGate({20,0,0})}, - FunctionInfo{4030, nullptr, "Unknown4030", MakeVersionGate({20,0,0})}, - FunctionInfo{4031, nullptr, "Unknown4031", MakeVersionGate({20,0,0})}, - FunctionInfo{4032, nullptr, "Unknown4032", MakeVersionGate({20,0,0})}, - FunctionInfo{4033, nullptr, "Unknown4033", MakeVersionGate({20,0,0})}, - FunctionInfo{4034, nullptr, "Unknown4034", MakeVersionGate({20,0,0})}, - FunctionInfo{4035, nullptr, "Unknown4035", MakeVersionGate({20,0,0})}, - FunctionInfo{4037, nullptr, "Unknown4037", MakeVersionGate({20,0,0})}, - FunctionInfo{4038, nullptr, "Unknown4038", MakeVersionGate({20,0,0})}, - FunctionInfo{4039, nullptr, "Unknown4039", MakeVersionGate({20,0,0})}, - FunctionInfo{4040, nullptr, "Unknown4040", MakeVersionGate({20,0,0})}, - FunctionInfo{4041, nullptr, "Unknown4041", MakeVersionGate({20,0,0})}, - FunctionInfo{4042, D<&IApplicationManagerInterface::Unknown4042>, "Unknown4042", MakeVersionGate({20,0,0})}, - FunctionInfo{4043, nullptr, "Unknown4043", MakeVersionGate({20,0,0})}, - FunctionInfo{4044, nullptr, "Unknown4044", MakeVersionGate({20,0,0})}, - FunctionInfo{4045, nullptr, "Unknown4045", MakeVersionGate({20,0,0})}, - FunctionInfo{4046, nullptr, "Unknown4046", MakeVersionGate({20,0,0})}, - FunctionInfo{4049, nullptr, "Unknown4049", MakeVersionGate({20,0,0})}, - FunctionInfo{4050, nullptr, "Unknown4050", MakeVersionGate({20,0,0})}, - FunctionInfo{4051, nullptr, "Unknown4051", MakeVersionGate({20,0,0})}, - FunctionInfo{4052, nullptr, "Unknown4052", MakeVersionGate({20,0,0})}, - FunctionInfo{4053, D<&IApplicationManagerInterface::Unknown4053>, "Unknown4053", MakeVersionGate({20,0,0})}, - FunctionInfo{4054, nullptr, "Unknown4054", MakeVersionGate({20,0,0})}, - FunctionInfo{4055, nullptr, "Unknown4055", MakeVersionGate({20,0,0})}, - FunctionInfo{4056, nullptr, "Unknown4056", MakeVersionGate({20,0,0})}, - FunctionInfo{4057, nullptr, "Unknown4057", MakeVersionGate({20,0,0})}, - FunctionInfo{4058, nullptr, "Unknown4058", MakeVersionGate({20,0,0})}, - FunctionInfo{4059, nullptr, "Unknown4059", MakeVersionGate({20,0,0})}, - FunctionInfo{4060, nullptr, "Unknown4060", MakeVersionGate({20,0,0})}, - FunctionInfo{4061, nullptr, "Unknown4061", MakeVersionGate({20,0,0})}, - FunctionInfo{4062, nullptr, "Unknown4062", MakeVersionGate({20,0,0})}, - FunctionInfo{4063, nullptr, "Unknown4063", MakeVersionGate({20,0,0})}, - FunctionInfo{4064, nullptr, "Unknown4064", MakeVersionGate({20,0,0})}, - FunctionInfo{4065, nullptr, "Unknown4065", MakeVersionGate({20,0,0})}, - FunctionInfo{4066, nullptr, "Unknown4066", MakeVersionGate({20,0,0})}, - FunctionInfo{4067, nullptr, "Unknown4067", MakeVersionGate({20,0,0})}, - FunctionInfo{4068, nullptr, "Unknown4068", MakeVersionGate({20,0,0})}, - FunctionInfo{4069, nullptr, "Unknown4069", MakeVersionGate({20,0,0})}, - FunctionInfo{4070, nullptr, "Unknown4070", MakeVersionGate({20,0,0})}, - FunctionInfo{4071, nullptr, "Unknown4071", MakeVersionGate({20,0,0})}, - FunctionInfo{4072, nullptr, "Unknown4072", MakeVersionGate({20,0,0})}, - FunctionInfo{4073, nullptr, "Unknown4073", MakeVersionGate({20,0,0})}, - FunctionInfo{4074, nullptr, "Unknown4074", MakeVersionGate({20,0,0})}, - FunctionInfo{4075, nullptr, "Unknown4075", MakeVersionGate({20,0,0})}, - FunctionInfo{4076, nullptr, "Unknown4076", MakeVersionGate({20,0,0})}, - FunctionInfo{4077, nullptr, "Unknown4077", MakeVersionGate({20,0,0})}, - FunctionInfo{4078, nullptr, "Unknown4078", MakeVersionGate({20,0,0})}, - FunctionInfo{4079, nullptr, "Unknown4079", MakeVersionGate({20,0,0})}, - FunctionInfo{4080, nullptr, "Unknown4080", MakeVersionGate({20,0,0})}, - FunctionInfo{4081, nullptr, "Unknown4081", MakeVersionGate({20,0,0})}, - FunctionInfo{4083, nullptr, "Unknown4083", MakeVersionGate({20,0,0})}, - FunctionInfo{4084, nullptr, "Unknown4084", MakeVersionGate({20,0,0})}, - FunctionInfo{4085, nullptr, "Unknown4085", MakeVersionGate({20,0,0})}, - FunctionInfo{4086, nullptr, "Unknown4086", MakeVersionGate({20,0,0})}, - FunctionInfo{4087, nullptr, "Unknown4087", MakeVersionGate({20,0,0})}, - FunctionInfo{4088, D<&IApplicationManagerInterface::Unknown4022>, "Unknown4088", MakeVersionGate({20,0,0})}, - FunctionInfo{4089, nullptr, "Unknown4089", MakeVersionGate({20,0,0})}, - FunctionInfo{4090, nullptr, "Unknown4090", MakeVersionGate({20,0,0})}, - FunctionInfo{4091, nullptr, "Unknown4091", MakeVersionGate({20,0,0})}, - FunctionInfo{4092, nullptr, "Unknown4092", MakeVersionGate({20,0,0})}, - FunctionInfo{4093, nullptr, "Unknown4093", MakeVersionGate({20,0,0})}, - FunctionInfo{4094, nullptr, "Unknown4094", MakeVersionGate({20,0,0})}, - FunctionInfo{4095, nullptr, "Unknown4095", MakeVersionGate({20,0,0})}, - FunctionInfo{4096, nullptr, "Unknown4096", MakeVersionGate({20,0,0})}, - FunctionInfo{4097, nullptr, "Unknown4097", MakeVersionGate({20,0,0})}, - FunctionInfo{4099, nullptr, "Unknown4099", MakeVersionGate({21,0,0})}, - FunctionInfo{4105, D<&IApplicationManagerInterface::Unknown4105>, "Unknown4105", MakeVersionGate({23,0,0})}, - FunctionInfo{5000, nullptr, "Unknown5000", MakeVersionGate({18,0,0})}, - FunctionInfo{5001, nullptr, "Unknown5001", MakeVersionGate({18,0,0})}, - FunctionInfo{9999, nullptr, "GetApplicationCertificate", MakeVersionGate({10,0,0}, {10,2,0})} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_) : ServiceFramework{system_, "IApplicationManagerInterface"}, service_context{system, "IApplicationManagerInterface"}, @@ -484,6 +32,458 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ gamecard_update_detection_event{service_context}, gamecard_mount_status_event{service_context}, gamecard_mount_failure_event{service_context}, gamecard_waken_ready_event{service_context}, unknown_event{service_context} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IApplicationManagerInterface::ListApplicationRecord>, "ListApplicationRecord"}, + {1, nullptr, "GenerateApplicationRecordCount"}, + {2, D<&IApplicationManagerInterface::GetApplicationRecordUpdateSystemEvent>, "GetApplicationRecordUpdateSystemEvent"}, + {3, nullptr, "GetApplicationViewDeprecated"}, + {4, D<&IApplicationManagerInterface::DeleteApplicationEntity>, "DeleteApplicationEntity"}, + {5, D<&IApplicationManagerInterface::DeleteApplicationCompletely>, "DeleteApplicationCompletely"}, + {6, nullptr, "IsAnyApplicationEntityRedundant"}, + {7, nullptr, "DeleteRedundantApplicationEntity"}, + {8, nullptr, "IsApplicationEntityMovable"}, + {9, nullptr, "MoveApplicationEntity"}, + {11, nullptr, "CalculateApplicationOccupiedSize"}, + {16, &IApplicationManagerInterface::PushApplicationRecord, "PushApplicationRecord"}, + {17, nullptr, "ListApplicationRecordContentMeta"}, + {19, nullptr, "LaunchApplicationOld"}, + {21, nullptr, "GetApplicationContentPath"}, + {22, nullptr, "TerminateApplication"}, + {23, nullptr, "ResolveApplicationContentPath"}, + {26, nullptr, "BeginInstallApplication"}, + {27, nullptr, "DeleteApplicationRecord"}, + {30, nullptr, "RequestApplicationUpdateInfo"}, + {31, nullptr, "RequestUpdateApplication"}, + {32, nullptr, "CancelApplicationDownload"}, + {33, nullptr, "ResumeApplicationDownload"}, + {35, nullptr, "UpdateVersionList"}, + {36, nullptr, "PushLaunchVersion"}, + {37, nullptr, "ListRequiredVersion"}, + {38, D<&IApplicationManagerInterface::CheckApplicationLaunchVersion>, "CheckApplicationLaunchVersion"}, + {39, nullptr, "CheckApplicationLaunchRights"}, + {40, D<&IApplicationManagerInterface::GetApplicationLogoData>, "GetApplicationLogoData"}, + {41, nullptr, "CalculateApplicationDownloadRequiredSize"}, + {42, nullptr, "CleanupSdCard"}, + {43, D<&IApplicationManagerInterface::CheckSdCardMountStatus>, "CheckSdCardMountStatus"}, + {44, D<&IApplicationManagerInterface::GetSdCardMountStatusChangedEvent>, "GetSdCardMountStatusChangedEvent"}, + {45, nullptr, "GetGameCardAttachmentEvent"}, + {46, nullptr, "GetGameCardAttachmentInfo"}, + {47, D<&IApplicationManagerInterface::GetTotalSpaceSize>, "GetTotalSpaceSize"}, + {48, D<&IApplicationManagerInterface::GetFreeSpaceSize>, "GetFreeSpaceSize"}, + {49, nullptr, "GetSdCardRemovedEvent"}, + {52, D<&IApplicationManagerInterface::GetGameCardUpdateDetectionEvent>, "GetGameCardUpdateDetectionEvent"}, + {53, nullptr, "DisableApplicationAutoDelete"}, + {54, nullptr, "EnableApplicationAutoDelete"}, + {55, D<&IApplicationManagerInterface::GetApplicationDesiredLanguage>, "GetApplicationDesiredLanguage"}, + {56, nullptr, "SetApplicationTerminateResult"}, + {57, nullptr, "ClearApplicationTerminateResult"}, + {58, nullptr, "GetLastSdCardMountUnexpectedResult"}, + {59, D<&IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode>, "ConvertApplicationLanguageToLanguageCode"}, + {60, nullptr, "ConvertLanguageCodeToApplicationLanguage"}, + {61, nullptr, "GetBackgroundDownloadStressTaskInfo"}, + {62, nullptr, "GetGameCardStopper"}, + {63, nullptr, "IsSystemProgramInstalled"}, + {64, nullptr, "StartApplyDeltaTask"}, + {65, nullptr, "GetRequestServerStopper"}, + {66, nullptr, "GetBackgroundApplyDeltaStressTaskInfo"}, + {67, nullptr, "CancelApplicationApplyDelta"}, + {68, nullptr, "ResumeApplicationApplyDelta"}, + {69, nullptr, "CalculateApplicationApplyDeltaRequiredSize"}, + {70, D<&IApplicationManagerInterface::ResumeAll>, "ResumeAll"}, + {71, D<&IApplicationManagerInterface::GetStorageSize>, "GetStorageSize"}, + {80, nullptr, "RequestDownloadApplication"}, + {81, nullptr, "RequestDownloadAddOnContent"}, + {82, nullptr, "DownloadApplication"}, + {83, nullptr, "CheckApplicationResumeRights"}, + {84, nullptr, "GetDynamicCommitEvent"}, + {85, nullptr, "RequestUpdateApplication2"}, + {86, nullptr, "EnableApplicationCrashReport"}, + {87, nullptr, "IsApplicationCrashReportEnabled"}, + {90, nullptr, "BoostSystemMemoryResourceLimit"}, + {91, nullptr, "DeprecatedLaunchApplication"}, + {92, nullptr, "GetRunningApplicationProgramId"}, + {93, nullptr, "GetMainApplicationProgramIndex"}, + {94, nullptr, "LaunchApplication"}, + {95, nullptr, "GetApplicationLaunchInfo"}, + {96, nullptr, "AcquireApplicationLaunchInfo"}, + {97, nullptr, "GetMainApplicationProgramIndexByApplicationLaunchInfo"}, + {98, nullptr, "EnableApplicationAllThreadDumpOnCrash"}, + {99, nullptr, "LaunchDevMenu"}, + {100, nullptr, "ResetToFactorySettings"}, + {101, nullptr, "ResetToFactorySettingsWithoutUserSaveData"}, + {102, nullptr, "ResetToFactorySettingsForRefurbishment"}, + {103, nullptr, "ResetToFactorySettingsWithPlatformRegion"}, + {104, nullptr, "ResetToFactorySettingsWithPlatformRegionAuthentication"}, + {105, nullptr, "RequestResetToFactorySettingsSecurely"}, + {106, nullptr, "RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely"}, + {200, nullptr, "CalculateUserSaveDataStatistics"}, + {201, nullptr, "DeleteUserSaveDataAll"}, + {210, nullptr, "DeleteUserSystemSaveData"}, + {211, nullptr, "DeleteSaveData"}, + {220, nullptr, "UnregisterNetworkServiceAccount"}, + {221, D<&IApplicationManagerInterface::UnregisterNetworkServiceAccountWithUserSaveDataDeletion>, "UnregisterNetworkServiceAccountWithUserSaveDataDeletion"}, + {300, nullptr, "GetApplicationShellEvent"}, + {301, nullptr, "PopApplicationShellEventInfo"}, + {302, nullptr, "LaunchLibraryApplet"}, + {303, nullptr, "TerminateLibraryApplet"}, + {304, nullptr, "LaunchSystemApplet"}, + {305, nullptr, "TerminateSystemApplet"}, + {306, nullptr, "LaunchOverlayApplet"}, + {307, nullptr, "TerminateOverlayApplet"}, + {400, D<&IApplicationManagerInterface::GetApplicationControlData>, "GetApplicationControlData"}, + {401, nullptr, "InvalidateAllApplicationControlCache"}, + {402, nullptr, "RequestDownloadApplicationControlData"}, + {403, nullptr, "GetMaxApplicationControlCacheCount"}, + {404, nullptr, "InvalidateApplicationControlCache"}, + {405, nullptr, "ListApplicationControlCacheEntryInfo"}, + {406, nullptr, "GetApplicationControlProperty"}, + {407, &IApplicationManagerInterface::ListApplicationTitle, "ListApplicationTitle"}, + {408, &IApplicationManagerInterface::ListApplicationIcon, "ListApplicationIcon"}, + {411, nullptr, "Unknown411"}, //19.0.0+ + {412, nullptr, "Unknown412"}, //19.0.0+ + {413, nullptr, "Unknown413"}, //19.0.0+ + {414, nullptr, "Unknown414"}, //19.0.0+ + {415, nullptr, "Unknown415"}, //19.0.0+ + {416, nullptr, "Unknown416"}, //19.0.0+ + {417, nullptr, "InvalidateAllApplicationControlCacheOfTheStage"}, //19.0.0+ + {418, nullptr, "InvalidateApplicationControlCacheOfTheStage"}, //19.0.0+ + {419, D<&IApplicationManagerInterface::RequestDownloadApplicationControlDataInBackground>, "RequestDownloadApplicationControlDataInBackground"}, + {420, nullptr, "CloneApplicationControlDataCacheForDebug"}, + {421, nullptr, "Unknown421"}, //20.0.0+ + {422, nullptr, "Unknown422"}, //20.0.0+ + {423, nullptr, "Unknown423"}, //20.0.0+ + {424, nullptr, "Unknown424"}, //20.0.0+ + {425, nullptr, "Unknown425"}, //20.0.0+ + {426, nullptr, "Unknown426"}, //20.0.0+ + {427, nullptr, "Unknown427"}, //20.0.0+ + {428, nullptr, "Unknown428"}, //21.0.0+ + {429, nullptr, "Unknown429"}, //21.0.0+ + {430, nullptr, "Unknown430"}, //21.0.0+ + {502, nullptr, "RequestCheckGameCardRegistration"}, + {503, nullptr, "RequestGameCardRegistrationGoldPoint"}, + {504, nullptr, "RequestRegisterGameCard"}, + {505, D<&IApplicationManagerInterface::GetGameCardMountFailureEvent>, "GetGameCardMountFailureEvent"}, + {506, nullptr, "IsGameCardInserted"}, + {507, nullptr, "EnsureGameCardAccess"}, + {508, nullptr, "GetLastGameCardMountFailureResult"}, + {509, nullptr, "ListApplicationIdOnGameCard"}, + {510, nullptr, "GetGameCardPlatformRegion"}, + {511, D<&IApplicationManagerInterface::GetGameCardWakenReadyEvent>, "GetGameCardWakenReadyEvent"}, + {512, D<&IApplicationManagerInterface::IsGameCardApplicationRunning>, "IsGameCardApplicationRunning"}, + {513, nullptr, "Unknown513"}, //20.0.0+ + {514, nullptr, "Unknown514"}, //20.0.0+ + {515, nullptr, "Unknown515"}, //20.0.0+ + {516, nullptr, "Unknown516"}, //21.0.0+ + {517, nullptr, "Unknown517"}, //21.0.0+ + {518, nullptr, "Unknown518"}, //21.0.0+ + {519, nullptr, "Unknown519"}, //21.0.0+ + {600, nullptr, "CountApplicationContentMeta"}, + {601, nullptr, "ListApplicationContentMetaStatus"}, + {602, nullptr, "ListAvailableAddOnContent"}, + {603, nullptr, "GetOwnedApplicationContentMetaStatus"}, + {604, nullptr, "RegisterContentsExternalKey"}, + {605, nullptr, "ListApplicationContentMetaStatusWithRightsCheck"}, + {606, nullptr, "GetContentMetaStorage"}, + {607, nullptr, "ListAvailableAddOnContent"}, + {609, nullptr, "ListAvailabilityAssuredAddOnContent"}, + {610, nullptr, "GetInstalledContentMetaStorage"}, + {611, nullptr, "PrepareAddOnContent"}, + {700, nullptr, "PushDownloadTaskList"}, + {701, nullptr, "ClearTaskStatusList"}, + {702, nullptr, "RequestDownloadTaskList"}, + {703, nullptr, "RequestEnsureDownloadTask"}, + {704, nullptr, "ListDownloadTaskStatus"}, + {705, nullptr, "RequestDownloadTaskListData"}, + {800, nullptr, "RequestVersionList"}, + {801, nullptr, "ListVersionList"}, + {802, nullptr, "RequestVersionListData"}, + {900, nullptr, "GetApplicationRecord"}, + {901, nullptr, "GetApplicationRecordProperty"}, + {902, nullptr, "EnableApplicationAutoUpdate"}, + {903, nullptr, "DisableApplicationAutoUpdate"}, + {904, D<&IApplicationManagerInterface::TouchApplication>, "TouchApplication"}, + {905, nullptr, "RequestApplicationUpdate"}, + {906, D<&IApplicationManagerInterface::IsApplicationUpdateRequested>, "IsApplicationUpdateRequested"}, + {907, nullptr, "WithdrawApplicationUpdateRequest"}, + {908, nullptr, "ListApplicationRecordInstalledContentMeta"}, + {909, nullptr, "WithdrawCleanupAddOnContentsWithNoRightsRecommendation"}, + {910, nullptr, "HasApplicationRecord"}, + {911, nullptr, "SetPreInstalledApplication"}, + {912, nullptr, "ClearPreInstalledApplicationFlag"}, + {913, nullptr, "ListAllApplicationRecord"}, + {914, nullptr, "HideApplicationRecord"}, + {915, nullptr, "ShowApplicationRecord"}, + {916, nullptr, "IsApplicationAutoDeleteDisabled"}, + {916, nullptr, "Unknown916"}, //20.0.0+ + {917, nullptr, "Unknown917"}, //20.0.0+ + {918, nullptr, "Unknown918"}, //20.0.0+ + {919, nullptr, "Unknown919"}, //20.0.0+ + {920, nullptr, "Unknown920"}, //20.0.0+ + {921, nullptr, "Unknown921"}, //20.0.0+ + {922, nullptr, "Unknown922"}, //20.0.0+ + {923, nullptr, "Unknown923"}, //20.0.0+ + {928, nullptr, "Unknown928"}, //20.0.0+ + {929, nullptr, "Unknown929"}, //20.0.0+ + {930, nullptr, "Unknown930"}, //20.0.0+ + {931, nullptr, "Unknown931"}, //20.0.0+ + {933, nullptr, "Unknown933"}, //20.0.0+ + {934, nullptr, "Unknown934"}, //21.0.0+ + {935, nullptr, "Unknown935"}, //21.0.0+ + {936, D<&IApplicationManagerInterface::Unknown936>, "Unknown936"}, //21.0.0+ + {1000, nullptr, "RequestVerifyApplicationDeprecated"}, + {1001, nullptr, "CorruptApplicationForDebug"}, + {1002, nullptr, "RequestVerifyAddOnContentsRights"}, + {1003, nullptr, "RequestVerifyApplication"}, + {1004, nullptr, "CorruptContentForDebug"}, + {1200, nullptr, "NeedsUpdateVulnerability"}, + {1300, D<&IApplicationManagerInterface::IsAnyApplicationEntityInstalled>, "IsAnyApplicationEntityInstalled"}, + {1301, nullptr, "DeleteApplicationContentEntities"}, + {1302, nullptr, "CleanupUnrecordedApplicationEntity"}, + {1303, nullptr, "CleanupAddOnContentsWithNoRights"}, + {1304, nullptr, "DeleteApplicationContentEntity"}, + {1305, nullptr, "TryDeleteRunningApplicationEntity"}, + {1306, nullptr, "TryDeleteRunningApplicationCompletely"}, + {1307, nullptr, "TryDeleteRunningApplicationContentEntities"}, + {1308, nullptr, "DeleteApplicationCompletelyForDebug"}, + {1309, nullptr, "CleanupUnavailableAddOnContents"}, + {1310, nullptr, "RequestMoveApplicationEntity"}, + {1311, nullptr, "EstimateSizeToMove"}, + {1312, nullptr, "HasMovableEntity"}, + {1313, nullptr, "CleanupOrphanContents"}, + {1314, nullptr, "CheckPreconditionSatisfiedToMove"}, + {1400, nullptr, "PrepareShutdown"}, + {1500, nullptr, "FormatSdCard"}, + {1501, nullptr, "NeedsSystemUpdateToFormatSdCard"}, + {1502, nullptr, "GetLastSdCardFormatUnexpectedResult"}, + {1504, nullptr, "InsertSdCard"}, + {1505, nullptr, "RemoveSdCard"}, + {1506, nullptr, "GetSdCardStartupStatus"}, + {1508, nullptr, "Unknown1508"}, //20.0.0+ + {1509, nullptr, "Unknown1509"}, //20.0.0+ + {1510, nullptr, "Unknown1510"}, //20.0.0+ + {1511, nullptr, "Unknown1511"}, //20.0.0+ + {1512, nullptr, "Unknown1512"}, //20.0.0+ + {1600, nullptr, "GetSystemSeedForPseudoDeviceId"}, + {1601, nullptr, "ResetSystemSeedForPseudoDeviceId"}, + {1700, nullptr, "ListApplicationDownloadingContentMeta"}, + {1701, D<&IApplicationManagerInterface::GetApplicationViewDeprecated>, "GetApplicationViewDeprecated"}, + {1702, nullptr, "GetApplicationDownloadTaskStatus"}, + {1703, nullptr, "GetApplicationViewDownloadErrorContext"}, + {1704, D<&IApplicationManagerInterface::GetApplicationViewWithPromotionInfo>, "GetApplicationViewWithPromotionInfo"}, + {1705, nullptr, "IsPatchAutoDeletableApplication"}, + {1706, D<&IApplicationManagerInterface::GetApplicationView>, "GetApplicationView"}, + {1800, nullptr, "IsNotificationSetupCompleted"}, + {1801, nullptr, "GetLastNotificationInfoCount"}, + {1802, nullptr, "ListLastNotificationInfo"}, + {1803, nullptr, "ListNotificationTask"}, + {1900, nullptr, "IsActiveAccount"}, + {1901, nullptr, "RequestDownloadApplicationPrepurchasedRights"}, + {1902, nullptr, "GetApplicationTicketInfo"}, + {1903, nullptr, "RequestDownloadApplicationPrepurchasedRightsForAccount"}, + {2000, nullptr, "GetSystemDeliveryInfo"}, + {2001, nullptr, "SelectLatestSystemDeliveryInfo"}, + {2002, nullptr, "VerifyDeliveryProtocolVersion"}, + {2003, nullptr, "GetApplicationDeliveryInfo"}, + {2004, nullptr, "HasAllContentsToDeliver"}, + {2005, nullptr, "CompareApplicationDeliveryInfo"}, + {2006, nullptr, "CanDeliverApplication"}, + {2007, nullptr, "ListContentMetaKeyToDeliverApplication"}, + {2008, nullptr, "NeedsSystemUpdateToDeliverApplication"}, + {2009, nullptr, "EstimateRequiredSize"}, + {2010, nullptr, "RequestReceiveApplication"}, + {2011, nullptr, "CommitReceiveApplication"}, + {2012, nullptr, "GetReceiveApplicationProgress"}, + {2013, nullptr, "RequestSendApplication"}, + {2014, nullptr, "GetSendApplicationProgress"}, + {2015, nullptr, "CompareSystemDeliveryInfo"}, + {2016, nullptr, "ListNotCommittedContentMeta"}, + {2017, nullptr, "CreateDownloadTask"}, + {2018, nullptr, "GetApplicationDeliveryInfoHash"}, + {2019, nullptr, "Unknown2019"}, //20.0.0+ + {2050, D<&IApplicationManagerInterface::GetApplicationRightsOnClient>, "GetApplicationRightsOnClient"}, + {2051, nullptr, "InvalidateRightsIdCache"}, + {2052, nullptr, "Unknown2052"}, //20.0.0+ + {2053, nullptr, "Unknown2053"}, //20.0.0+ + {2100, D<&IApplicationManagerInterface::GetApplicationTerminateResult>, "GetApplicationTerminateResult"}, + {2101, nullptr, "GetRawApplicationTerminateResult"}, + {2150, nullptr, "CreateRightsEnvironment"}, + {2151, nullptr, "DestroyRightsEnvironment"}, + {2152, nullptr, "ActivateRightsEnvironment"}, + {2153, nullptr, "DeactivateRightsEnvironment"}, + {2154, nullptr, "ForceActivateRightsContextForExit"}, + {2155, nullptr, "UpdateRightsEnvironmentStatus"}, + {2156, nullptr, "CreateRightsEnvironmentForMicroApplication"}, + {2160, nullptr, "AddTargetApplicationToRightsEnvironment"}, + {2161, nullptr, "SetUsersToRightsEnvironment"}, + {2170, nullptr, "GetRightsEnvironmentStatus"}, + {2171, nullptr, "GetRightsEnvironmentStatusChangedEvent"}, + {2180, nullptr, "RequestExtendRightsInRightsEnvironment"}, + {2181, nullptr, "GetResultOfExtendRightsInRightsEnvironment"}, + {2182, nullptr, "SetActiveRightsContextUsingStateToRightsEnvironment"}, + {2183, nullptr, "Unknown2183"}, //20.1.0+ + {2190, nullptr, "GetRightsEnvironmentHandleForApplication"}, + {2199, nullptr, "GetRightsEnvironmentCountForDebug"}, + {2200, nullptr, "GetGameCardApplicationCopyIdentifier"}, + {2201, nullptr, "GetInstalledApplicationCopyIdentifier"}, + {2250, nullptr, "RequestReportActiveELicence"}, + {2300, nullptr, "ListEventLog"}, + {2350, nullptr, "PerformAutoUpdateByApplicationId"}, + {2351, nullptr, "RequestNoDownloadRightsErrorResolution"}, + {2352, nullptr, "RequestResolveNoDownloadRightsError"}, + {2353, nullptr, "GetApplicationDownloadTaskInfo"}, + {2354, nullptr, "PrioritizeApplicationBackgroundTask"}, + {2355, nullptr, "PreferStorageEfficientUpdate"}, + {2356, nullptr, "RequestStorageEfficientUpdatePreferable"}, + {2357, nullptr, "EnableMultiCoreDownload"}, + {2358, nullptr, "DisableMultiCoreDownload"}, + {2359, nullptr, "IsMultiCoreDownloadEnabled"}, + {2360, nullptr, "GetApplicationDownloadTaskCount"}, //19.0.0+ + {2361, nullptr, "GetMaxApplicationDownloadTaskCount"}, //19.0.0+ + {2362, nullptr, "Unknown2362"}, //20.0.0+ + {2363, nullptr, "Unknown2363"}, //20.0.0+ + {2364, nullptr, "Unknown2364"}, //20.0.0+ + {2365, nullptr, "Unknown2365"}, //20.0.0+ + {2366, nullptr, "Unknown2366"}, //20.0.0+ + {2367, nullptr, "Unknown2367"}, //20.0.0+ + {2368, nullptr, "Unknown2368"}, //20.0.0+ + {2369, nullptr, "Unknown2369"}, //21.0.0+ + {2400, nullptr, "GetPromotionInfo"}, + {2401, nullptr, "CountPromotionInfo"}, + {2402, nullptr, "ListPromotionInfo"}, + {2403, nullptr, "ImportPromotionJsonForDebug"}, + {2404, nullptr, "ClearPromotionInfoForDebug"}, + {2500, nullptr, "ConfirmAvailableTime"}, + {2510, nullptr, "CreateApplicationResource"}, + {2511, nullptr, "GetApplicationResource"}, + {2513, nullptr, "LaunchMicroApplication"}, + {2514, nullptr, "ClearTaskOfAsyncTaskManager"}, + {2515, nullptr, "CleanupAllPlaceHolderAndFragmentsIfNoTask"}, + {2516, nullptr, "EnsureApplicationCertificate"}, + {2517, nullptr, "CreateApplicationInstance"}, + {2518, nullptr, "UpdateQualificationForDebug"}, + {2519, nullptr, "IsQualificationTransitionSupported"}, + {2520, D<&IApplicationManagerInterface::IsQualificationTransitionSupportedByProcessId>, "IsQualificationTransitionSupportedByProcessId"}, + {2521, nullptr, "GetRightsUserChangedEvent"}, + {2522, nullptr, "IsRomRedirectionAvailable"}, + {2523, nullptr, "GetProgramId"}, //17.0.0+ + {2524, nullptr, "Unknown2524"}, //19.0.0+ + {2525, nullptr, "Unknown2525"}, //20.0.0+ + {2800, nullptr, "GetApplicationIdOfPreomia"}, + {3000, nullptr, "RegisterDeviceLockKey"}, + {3001, nullptr, "UnregisterDeviceLockKey"}, + {3002, nullptr, "VerifyDeviceLockKey"}, + {3003, nullptr, "HideApplicationIcon"}, + {3004, nullptr, "ShowApplicationIcon"}, + {3005, nullptr, "HideApplicationTitle"}, + {3006, nullptr, "ShowApplicationTitle"}, + {3007, nullptr, "EnableGameCard"}, + {3008, nullptr, "DisableGameCard"}, + {3009, nullptr, "EnableLocalContentShare"}, + {3010, nullptr, "DisableLocalContentShare"}, + {3011, nullptr, "IsApplicationIconHidden"}, + {3012, nullptr, "IsApplicationTitleHidden"}, + {3013, nullptr, "IsGameCardEnabled"}, + {3014, nullptr, "IsLocalContentShareEnabled"}, + {3050, nullptr, "ListAssignELicenseTaskResult"}, + {3104, nullptr, "GetApplicationNintendoLogo"}, //18.0.0+ + {3105, nullptr, "GetApplicationStartupMovie"}, //18.0.0+ + {4000, nullptr, "Unknown4000"}, //20.0.0+ + {4004, nullptr, "Unknown4004"}, //20.0.0+ + {4006, nullptr, "Unknown4006"}, //20.0.0+ + {4007, nullptr, "Unknown4007"}, //20.0.0+ + {4008, nullptr, "Unknown4008"}, //20.0.0+ + {4009, nullptr, "Unknown4009"}, //20.0.0+ + {4010, nullptr, "Unknown4010"}, //20.0.0+ + {4011, nullptr, "Unknown4011"}, //20.0.0+ + {4012, nullptr, "Unknown4012"}, //20.0.0+ + {4013, nullptr, "Unknown4013"}, //20.0.0+ + {4015, nullptr, "Unknown4015"}, //20.0.0+ + {4017, nullptr, "Unknown4017"}, //20.0.0+ + {4019, nullptr, "Unknown4019"}, //20.0.0+ + {4020, nullptr, "Unknown4020"}, //20.0.0+ + {4021, nullptr, "Unknown4021"}, //20.0.0+ + {4022, D<&IApplicationManagerInterface::Unknown4022>, "Unknown4022"}, //20.0.0+ + {4023, D<&IApplicationManagerInterface::Unknown4023>, "Unknown4023"}, //20.0.0+ + {4024, nullptr, "Unknown4024"}, //20.0.0+ + {4025, nullptr, "Unknown4025"}, //20.0.0+ + {4026, nullptr, "Unknown4026"}, //20.0.0+ + {4027, nullptr, "Unknown4027"}, //20.0.0+ + {4028, nullptr, "Unknown4028"}, //20.0.0+ + {4029, nullptr, "Unknown4029"}, //20.0.0+ + {4030, nullptr, "Unknown4030"}, //20.0.0+ + {4031, nullptr, "Unknown4031"}, //20.0.0+ + {4032, nullptr, "Unknown4032"}, //20.0.0+ + {4033, nullptr, "Unknown4033"}, //20.0.0+ + {4034, nullptr, "Unknown4034"}, //20.0.0+ + {4035, nullptr, "Unknown4035"}, //20.0.0+ + {4037, nullptr, "Unknown4037"}, //20.0.0+ + {4038, nullptr, "Unknown4038"}, //20.0.0+ + {4039, nullptr, "Unknown4039"}, //20.0.0+ + {4040, nullptr, "Unknown4040"}, //20.0.0+ + {4041, nullptr, "Unknown4041"}, //20.0.0+ + {4042, D<&IApplicationManagerInterface::Unknown4042>, "Unknown4042"}, //20.0.0+ + {4043, nullptr, "Unknown4043"}, //20.0.0+ + {4044, nullptr, "Unknown4044"}, //20.0.0+ + {4045, nullptr, "Unknown4045"}, //20.0.0+ + {4046, nullptr, "Unknown4046"}, //20.0.0+ + {4049, nullptr, "Unknown4049"}, //20.0.0+ + {4050, nullptr, "Unknown4050"}, //20.0.0+ + {4051, nullptr, "Unknown4051"}, //20.0.0+ + {4052, nullptr, "Unknown4052"}, //20.0.0+ + {4053, D<&IApplicationManagerInterface::Unknown4053>, "Unknown4053"}, //20.0.0+ + {4054, nullptr, "Unknown4054"}, //20.0.0+ + {4055, nullptr, "Unknown4055"}, //20.0.0+ + {4056, nullptr, "Unknown4056"}, //20.0.0+ + {4057, nullptr, "Unknown4057"}, //20.0.0+ + {4058, nullptr, "Unknown4058"}, //20.0.0+ + {4059, nullptr, "Unknown4059"}, //20.0.0+ + {4060, nullptr, "Unknown4060"}, //20.0.0+ + {4061, nullptr, "Unknown4061"}, //20.0.0+ + {4062, nullptr, "Unknown4062"}, //20.0.0+ + {4063, nullptr, "Unknown4063"}, //20.0.0+ + {4064, nullptr, "Unknown4064"}, //20.0.0+ + {4065, nullptr, "Unknown4065"}, //20.0.0+ + {4066, nullptr, "Unknown4066"}, //20.0.0+ + {4067, nullptr, "Unknown4067"}, //20.0.0+ + {4068, nullptr, "Unknown4068"}, //20.0.0+ + {4069, nullptr, "Unknown4069"}, //20.0.0+ + {4070, nullptr, "Unknown4070"}, //20.0.0+ + {4071, nullptr, "Unknown4071"}, //20.0.0+ + {4072, nullptr, "Unknown4072"}, //20.0.0+ + {4073, nullptr, "Unknown4073"}, //20.0.0+ + {4074, nullptr, "Unknown4074"}, //20.0.0+ + {4075, nullptr, "Unknown4075"}, //20.0.0+ + {4076, nullptr, "Unknown4076"}, //20.0.0+ + {4077, nullptr, "Unknown4077"}, //20.0.0+ + {4078, nullptr, "Unknown4078"}, //20.0.0+ + {4079, nullptr, "Unknown4079"}, //20.0.0+ + {4080, nullptr, "Unknown4080"}, //20.0.0+ + {4081, nullptr, "Unknown4081"}, //20.0.0+ + {4083, nullptr, "Unknown4083"}, //20.0.0+ + {4084, nullptr, "Unknown4084"}, //20.0.0+ + {4085, nullptr, "Unknown4085"}, //20.0.0+ + {4086, nullptr, "Unknown4086"}, //20.0.0+ + {4087, nullptr, "Unknown4087"}, //20.0.0+ + {4088, D<&IApplicationManagerInterface::Unknown4022>, "Unknown4088"}, //20.0.0+ + {4089, nullptr, "Unknown4089"}, //20.0.0+ + {4090, nullptr, "Unknown4090"}, //20.0.0+ + {4091, nullptr, "Unknown4091"}, //20.0.0+ + {4092, nullptr, "Unknown4092"}, //20.0.0+ + {4093, nullptr, "Unknown4093"}, //20.0.0+ + {4094, nullptr, "Unknown4094"}, //20.0.0+ + {4095, nullptr, "Unknown4095"}, //20.0.0+ + {4096, nullptr, "Unknown4096"}, //20.0.0+ + {4097, nullptr, "Unknown4097"}, //20.0.0+ + {4099, nullptr, "Unknown4099"}, //21.0.0+ + {4105, D<&IApplicationManagerInterface::Unknown4105>, "Unknown4105"}, //23.0.0+ + {5000, nullptr, "Unknown5000"}, //18.0.0+ + {5001, nullptr, "Unknown5001"}, //18.0.0+ + {9999, nullptr, "GetApplicationCertificate"}, //10.0.0-10.2.0 + }; + // clang-format on + + RegisterHandlers(functions); } IApplicationManagerInterface::~IApplicationManagerInterface() = default; diff --git a/src/core/hle/service/ns/application_manager_interface.h b/src/core/hle/service/ns/application_manager_interface.h index 592068823c..c4ca66f319 100644 --- a/src/core/hle/service/ns/application_manager_interface.h +++ b/src/core/hle/service/ns/application_manager_interface.h @@ -85,7 +85,6 @@ public: void PushApplicationRecord(HLERequestContext& ctx); void ListApplicationTitle(HLERequestContext& ctx); void ListApplicationIcon(HLERequestContext& ctx); - std::optional FindRequest(u32 key) override; private: KernelHelpers::ServiceContext service_context; diff --git a/src/core/hle/service/ns/application_version_interface.cpp b/src/core/hle/service/ns/application_version_interface.cpp index e1e747f6d2..0ed9514c2c 100644 --- a/src/core/hle/service/ns/application_version_interface.cpp +++ b/src/core/hle/service/ns/application_version_interface.cpp @@ -10,6 +10,25 @@ namespace Service::NS { IApplicationVersionInterface::IApplicationVersionInterface(Core::System& system_) : ServiceFramework{system_, "IApplicationVersionInterface"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetLaunchRequiredVersion"}, + {1, nullptr, "UpgradeLaunchRequiredVersion"}, + {35, nullptr, "UpdateVersionList"}, + {36, nullptr, "PushLaunchVersion"}, + {37, nullptr, "ListRequiredVersion"}, + {800, nullptr, "RequestVersionList"}, + {801, nullptr, "ListVersionList"}, + {802, nullptr, "RequestVersionListData"}, + {900, nullptr, "ImportAutoUpdatePolicyJsonForDebug"}, + {901, nullptr, "ListDefaultAutoUpdatePolicy"}, + {902, nullptr, "ListAutoUpdatePolicyForSpecificApplication"}, + {1000, nullptr, "PerformAutoUpdate"}, + {1001, nullptr, "ListAutoUpdateSchedule"}, + }; + // clang-format on + + RegisterHandlers(functions); } IApplicationVersionInterface::~IApplicationVersionInterface() = default; diff --git a/src/core/hle/service/ns/application_version_interface.h b/src/core/hle/service/ns/application_version_interface.h index c1f7710a00..fcbb966a4d 100644 --- a/src/core/hle/service/ns/application_version_interface.h +++ b/src/core/hle/service/ns/application_version_interface.h @@ -14,25 +14,6 @@ class IApplicationVersionInterface final : public ServiceFramework FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetLaunchRequiredVersion"}, - FunctionInfo{1, nullptr, "UpgradeLaunchRequiredVersion"}, - FunctionInfo{35, nullptr, "UpdateVersionList"}, - FunctionInfo{36, nullptr, "PushLaunchVersion"}, - FunctionInfo{37, nullptr, "ListRequiredVersion"}, - FunctionInfo{800, nullptr, "RequestVersionList"}, - FunctionInfo{801, nullptr, "ListVersionList"}, - FunctionInfo{802, nullptr, "RequestVersionListData"}, - FunctionInfo{900, nullptr, "ImportAutoUpdatePolicyJsonForDebug"}, - FunctionInfo{901, nullptr, "ListDefaultAutoUpdatePolicy"}, - FunctionInfo{902, nullptr, "ListAutoUpdatePolicyForSpecificApplication"}, - FunctionInfo{1000, nullptr, "PerformAutoUpdate"}, - FunctionInfo{1001, nullptr, "ListAutoUpdateSchedule"} - ); }; } // namespace Service::NS diff --git a/src/core/hle/service/ns/async_result.cpp b/src/core/hle/service/ns/async_result.cpp index d93c510141..8617280bef 100644 --- a/src/core/hle/service/ns/async_result.cpp +++ b/src/core/hle/service/ns/async_result.cpp @@ -8,17 +8,17 @@ namespace Service::NS { -std::optional IAsyncResult::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "Get"}, - FunctionInfo{1, D<&IAsyncResult::Cancel>, "Cancel"}, - FunctionInfo{2, nullptr, "GetErrorContext", MakeVersionGate({4,0,0})} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IAsyncResult::IAsyncResult(Core::System& system_, Service::Event* event_) : ServiceFramework{system_, "nn::ns::detail::IAsyncResult"}, event{event_} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "Get"}, + {1, D<&IAsyncResult::Cancel>, "Cancel"}, + {2, nullptr, "GetErrorContext"}, // 4.0.0+ + }; + // clang-format on + + RegisterHandlers(functions); } IAsyncResult::~IAsyncResult() = default; diff --git a/src/core/hle/service/ns/async_result.h b/src/core/hle/service/ns/async_result.h index 1cad75bf47..914ea5a42c 100644 --- a/src/core/hle/service/ns/async_result.h +++ b/src/core/hle/service/ns/async_result.h @@ -13,7 +13,6 @@ public: private: Result Cancel(); - std::optional FindRequest(u32 key) override; Service::Event* event{}; }; diff --git a/src/core/hle/service/ns/content_management_interface.cpp b/src/core/hle/service/ns/content_management_interface.cpp index 45922ffab3..39b9cb6f70 100644 --- a/src/core/hle/service/ns/content_management_interface.cpp +++ b/src/core/hle/service/ns/content_management_interface.cpp @@ -15,6 +15,22 @@ namespace Service::NS { IContentManagementInterface::IContentManagementInterface(Core::System& system_) : ServiceFramework{system_, "IContentManagementInterface"} { + // clang-format off + static const FunctionInfo functions[] = { + {11, D<&IContentManagementInterface::CalculateApplicationOccupiedSize>, "CalculateApplicationOccupiedSize"}, + {43, D<&IContentManagementInterface::CheckSdCardMountStatus>, "CheckSdCardMountStatus"}, + {47, D<&IContentManagementInterface::GetTotalSpaceSize>, "GetTotalSpaceSize"}, + {48, D<&IContentManagementInterface::GetFreeSpaceSize>, "GetFreeSpaceSize"}, + {71, D<&IContentManagementInterface::GetUnknown71>, "Unknown71"}, + {600, nullptr, "CountApplicationContentMeta"}, + {601, nullptr, "ListApplicationContentMetaStatus"}, + {605, nullptr, "ListApplicationContentMetaStatusWithRightsCheck"}, + {607, nullptr, "IsAnyApplicationRunning"}, + {608, nullptr, "Unknown608"}, //21.0.0+ + }; + // clang-format on + + RegisterHandlers(functions); } IContentManagementInterface::~IContentManagementInterface() = default; diff --git a/src/core/hle/service/ns/content_management_interface.h b/src/core/hle/service/ns/content_management_interface.h index bddd044b45..df0c51a184 100644 --- a/src/core/hle/service/ns/content_management_interface.h +++ b/src/core/hle/service/ns/content_management_interface.h @@ -24,22 +24,6 @@ public: Result GetTotalSpaceSize(Out out_total_space_size, FileSys::StorageId storage_id); Result GetFreeSpaceSize(Out out_free_space_size, FileSys::StorageId storage_id); Result GetUnknown71(Out out_value_a, Out out_value_b, u8 flag); - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{11, D<&IContentManagementInterface::CalculateApplicationOccupiedSize>, "CalculateApplicationOccupiedSize"}, - FunctionInfo{43, D<&IContentManagementInterface::CheckSdCardMountStatus>, "CheckSdCardMountStatus"}, - FunctionInfo{47, D<&IContentManagementInterface::GetTotalSpaceSize>, "GetTotalSpaceSize"}, - FunctionInfo{48, D<&IContentManagementInterface::GetFreeSpaceSize>, "GetFreeSpaceSize"}, - FunctionInfo{71, D<&IContentManagementInterface::GetUnknown71>, "Unknown71"}, - FunctionInfo{600, nullptr, "CountApplicationContentMeta"}, - FunctionInfo{601, nullptr, "ListApplicationContentMetaStatus"}, - FunctionInfo{605, nullptr, "ListApplicationContentMetaStatusWithRightsCheck"}, - FunctionInfo{607, nullptr, "IsAnyApplicationRunning"}, - FunctionInfo{608, nullptr, "Unknown608", MakeVersionGate({21,0,0})} - ); }; } // namespace Service::NS diff --git a/src/core/hle/service/ns/develop_interface.cpp b/src/core/hle/service/ns/develop_interface.cpp index 2fc41cd7dd..5a44c61f1b 100644 --- a/src/core/hle/service/ns/develop_interface.cpp +++ b/src/core/hle/service/ns/develop_interface.cpp @@ -9,6 +9,31 @@ namespace Service::NS { IDevelopInterface::IDevelopInterface(Core::System& system_) : ServiceFramework{system_, "ns:dev"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "LaunchProgram"}, + {1, nullptr, "TerminateProcess"}, + {2, nullptr, "TerminateProgram"}, + {4, nullptr, "GetShellEvent"}, + {5, nullptr, "GetShellEventInfo"}, + {6, nullptr, "TerminateApplication"}, + {7, nullptr, "PrepareLaunchProgramFromHost"}, + {8, nullptr, "LaunchApplicationFromHost"}, + {9, nullptr, "LaunchApplicationWithStorageIdForDevelop"}, + {10, nullptr, "IsSystemMemoryResourceLimitBoosted"}, + {11, nullptr, "GetRunningApplicationProcessIdForDevelop"}, + {12, nullptr, "SetCurrentApplicationRightsEnvironmentCanBeActiveForDevelop"}, + {13, nullptr, "CreateApplicationResourceForDevelop"}, + {14, nullptr, "IsPreomiaForDevelop"}, + {15, nullptr, "GetApplicationProgramIdFromHost"}, + {16, nullptr, "RefreshCachedDebugValues"}, + {17, nullptr, "PrepareLaunchApplicationFromHost"}, + {18, nullptr, "GetLaunchEvent"}, + {19, nullptr, "GetLaunchResult"}, + }; + // clang-format on + + RegisterHandlers(functions); } IDevelopInterface::~IDevelopInterface() = default; diff --git a/src/core/hle/service/ns/develop_interface.h b/src/core/hle/service/ns/develop_interface.h index 55e54fa38d..d7cb9e7a56 100644 --- a/src/core/hle/service/ns/develop_interface.h +++ b/src/core/hle/service/ns/develop_interface.h @@ -14,31 +14,6 @@ class IDevelopInterface final : public ServiceFramework { public: explicit IDevelopInterface(Core::System& system_); ~IDevelopInterface() override; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "LaunchProgram"}, - FunctionInfo{1, nullptr, "TerminateProcess"}, - FunctionInfo{2, nullptr, "TerminateProgram"}, - FunctionInfo{4, nullptr, "GetShellEvent"}, - FunctionInfo{5, nullptr, "GetShellEventInfo"}, - FunctionInfo{6, nullptr, "TerminateApplication"}, - FunctionInfo{7, nullptr, "PrepareLaunchProgramFromHost"}, - FunctionInfo{8, nullptr, "LaunchApplicationFromHost"}, - FunctionInfo{9, nullptr, "LaunchApplicationWithStorageIdForDevelop"}, - FunctionInfo{10, nullptr, "IsSystemMemoryResourceLimitBoosted"}, - FunctionInfo{11, nullptr, "GetRunningApplicationProcessIdForDevelop"}, - FunctionInfo{12, nullptr, "SetCurrentApplicationRightsEnvironmentCanBeActiveForDevelop"}, - FunctionInfo{13, nullptr, "CreateApplicationResourceForDevelop"}, - FunctionInfo{14, nullptr, "IsPreomiaForDevelop"}, - FunctionInfo{15, nullptr, "GetApplicationProgramIdFromHost"}, - FunctionInfo{16, nullptr, "RefreshCachedDebugValues"}, - FunctionInfo{17, nullptr, "PrepareLaunchApplicationFromHost"}, - FunctionInfo{18, nullptr, "GetLaunchEvent"}, - FunctionInfo{19, nullptr, "GetLaunchResult"} - ); }; } // namespace Service::NS diff --git a/src/core/hle/service/ns/document_interface.cpp b/src/core/hle/service/ns/document_interface.cpp index f9a1e2267a..00593d1edc 100644 --- a/src/core/hle/service/ns/document_interface.cpp +++ b/src/core/hle/service/ns/document_interface.cpp @@ -12,6 +12,15 @@ namespace Service::NS { IDocumentInterface::IDocumentInterface(Core::System& system_) : ServiceFramework{system_, "IDocumentInterface"} { + // clang-format off + static const FunctionInfo functions[] = { + {21, nullptr, "GetApplicationContentPath"}, + {23, D<&IDocumentInterface::ResolveApplicationContentPath>, "ResolveApplicationContentPath"}, + {92, D<&IDocumentInterface::GetRunningApplicationProgramId>, "GetRunningApplicationProgramId"}, + }; + // clang-format on + + RegisterHandlers(functions); } IDocumentInterface::~IDocumentInterface() = default; diff --git a/src/core/hle/service/ns/document_interface.h b/src/core/hle/service/ns/document_interface.h index 43a194c3e6..4c8b15b54a 100644 --- a/src/core/hle/service/ns/document_interface.h +++ b/src/core/hle/service/ns/document_interface.h @@ -20,15 +20,6 @@ public: private: Result ResolveApplicationContentPath(ContentPath content_path); Result GetRunningApplicationProgramId(Out out_program_id, u64 caller_program_id); - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{21, nullptr, "GetApplicationContentPath"}, - FunctionInfo{23, D<&IDocumentInterface::ResolveApplicationContentPath>, "ResolveApplicationContentPath"}, - FunctionInfo{92, D<&IDocumentInterface::GetRunningApplicationProgramId>, "GetRunningApplicationProgramId"} - ); }; } // namespace Service::NS diff --git a/src/core/hle/service/ns/download_task_interface.cpp b/src/core/hle/service/ns/download_task_interface.cpp index 9fe6ca512f..18db60e7b0 100644 --- a/src/core/hle/service/ns/download_task_interface.cpp +++ b/src/core/hle/service/ns/download_task_interface.cpp @@ -11,6 +11,21 @@ namespace Service::NS { IDownloadTaskInterface::IDownloadTaskInterface(Core::System& system_) : ServiceFramework{system_, "IDownloadTaskInterface"} { + // clang-format off + static const FunctionInfo functions[] = { + {701, nullptr, "ClearTaskStatusList"}, + {702, nullptr, "RequestDownloadTaskList"}, + {703, nullptr, "RequestEnsureDownloadTask"}, + {704, nullptr, "ListDownloadTaskStatus"}, + {705, nullptr, "RequestDownloadTaskListData"}, + {706, nullptr, "TryCommitCurrentApplicationDownloadTask"}, + {707, D<&IDownloadTaskInterface::EnableAutoCommit>, "EnableAutoCommit"}, + {708, D<&IDownloadTaskInterface::DisableAutoCommit>, "DisableAutoCommit"}, + {709, nullptr, "TriggerDynamicCommitEvent"}, + }; + // clang-format on + + RegisterHandlers(functions); } IDownloadTaskInterface::~IDownloadTaskInterface() = default; diff --git a/src/core/hle/service/ns/download_task_interface.h b/src/core/hle/service/ns/download_task_interface.h index 0fd2bacd42..1c46339daa 100644 --- a/src/core/hle/service/ns/download_task_interface.h +++ b/src/core/hle/service/ns/download_task_interface.h @@ -18,21 +18,6 @@ public: private: Result EnableAutoCommit(); Result DisableAutoCommit(); - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{701, nullptr, "ClearTaskStatusList"}, - FunctionInfo{702, nullptr, "RequestDownloadTaskList"}, - FunctionInfo{703, nullptr, "RequestEnsureDownloadTask"}, - FunctionInfo{704, nullptr, "ListDownloadTaskStatus"}, - FunctionInfo{705, nullptr, "RequestDownloadTaskListData"}, - FunctionInfo{706, nullptr, "TryCommitCurrentApplicationDownloadTask"}, - FunctionInfo{707, D<&IDownloadTaskInterface::EnableAutoCommit>, "EnableAutoCommit"}, - FunctionInfo{708, D<&IDownloadTaskInterface::DisableAutoCommit>, "DisableAutoCommit"}, - FunctionInfo{709, nullptr, "TriggerDynamicCommitEvent"} - ); }; } // namespace Service::NS diff --git a/src/core/hle/service/ns/dynamic_rights_interface.cpp b/src/core/hle/service/ns/dynamic_rights_interface.cpp index 951ef4c4b2..0301085670 100644 --- a/src/core/hle/service/ns/dynamic_rights_interface.cpp +++ b/src/core/hle/service/ns/dynamic_rights_interface.cpp @@ -9,43 +9,43 @@ namespace Service::NS { -std::optional IDynamicRightsInterface::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "RequestApplicationRightsOnServer"}, - FunctionInfo{1, nullptr, "RequestAssignRights"}, - FunctionInfo{4, nullptr, "DeprecatedRequestAssignRightsToResume"}, - FunctionInfo{5, D<&IDynamicRightsInterface::VerifyActivatedRightsOwners>, "VerifyActivatedRightsOwners"}, - FunctionInfo{6, nullptr, "DeprecatedGetApplicationRightsStatus"}, - FunctionInfo{7, nullptr, "RequestPrefetchForDynamicRights"}, - FunctionInfo{8, nullptr, "GetDynamicRightsState"}, - FunctionInfo{9, nullptr, "RequestApplicationRightsOnServerToResume"}, - FunctionInfo{10, nullptr, "RequestAssignRightsToResume"}, - FunctionInfo{11, nullptr, "GetActivatedRightsUsers"}, - FunctionInfo{12, nullptr, "GetApplicationRightsStatus"}, - FunctionInfo{13, D<&IDynamicRightsInterface::GetRunningApplicationStatus>, "GetRunningApplicationStatus"}, - FunctionInfo{14, nullptr, "SelectApplicationLicense"}, - FunctionInfo{15, nullptr, "RequestContentsAuthorizationToken"}, - FunctionInfo{16, nullptr, "QualifyUser"}, - FunctionInfo{17, nullptr, "QualifyUserWithProcessId"}, - FunctionInfo{18, D<&IDynamicRightsInterface::NotifyApplicationRightsCheckStart>, "NotifyApplicationRightsCheckStart"}, - FunctionInfo{19, nullptr, "UpdateUserList"}, - FunctionInfo{20, nullptr, "IsRightsLostUser"}, - FunctionInfo{21, nullptr, "SetRequiredAddOnContentsOnContentsAvailabilityTransition"}, - FunctionInfo{22, nullptr, "GetLimitedApplicationLicense"}, - FunctionInfo{23, nullptr, "GetLimitedApplicationLicenseUpgradableEvent"}, - FunctionInfo{24, nullptr, "NotifyLimitedApplicationLicenseUpgradableEventForDebug"}, - FunctionInfo{25, nullptr, "RequestProceedDynamicRightsState"}, - FunctionInfo{26, D<&IDynamicRightsInterface::HasAccountRestrictedRightsInRunningApplications>, "HasAccountRestrictedRightsInRunningApplications"}, - FunctionInfo{27, nullptr, "Unknown27", MakeVersionGate({20,0,0})}, - FunctionInfo{28, nullptr, "Unknown28", MakeVersionGate({20,0,0})}, - FunctionInfo{29, nullptr, "Unknown29", MakeVersionGate({21,0,0})}, - FunctionInfo{30, nullptr, "Unknown30", MakeVersionGate({21,0,0})} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IDynamicRightsInterface::IDynamicRightsInterface(Core::System& system_) : ServiceFramework{system_, "DynamicRightsInterface"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "RequestApplicationRightsOnServer"}, + {1, nullptr, "RequestAssignRights"}, + {4, nullptr, "DeprecatedRequestAssignRightsToResume"}, + {5, D<&IDynamicRightsInterface::VerifyActivatedRightsOwners>, "VerifyActivatedRightsOwners"}, + {6, nullptr, "DeprecatedGetApplicationRightsStatus"}, + {7, nullptr, "RequestPrefetchForDynamicRights"}, + {8, nullptr, "GetDynamicRightsState"}, + {9, nullptr, "RequestApplicationRightsOnServerToResume"}, + {10, nullptr, "RequestAssignRightsToResume"}, + {11, nullptr, "GetActivatedRightsUsers"}, + {12, nullptr, "GetApplicationRightsStatus"}, + {13, D<&IDynamicRightsInterface::GetRunningApplicationStatus>, "GetRunningApplicationStatus"}, + {14, nullptr, "SelectApplicationLicense"}, + {15, nullptr, "RequestContentsAuthorizationToken"}, + {16, nullptr, "QualifyUser"}, + {17, nullptr, "QualifyUserWithProcessId"}, + {18, D<&IDynamicRightsInterface::NotifyApplicationRightsCheckStart>, "NotifyApplicationRightsCheckStart"}, + {19, nullptr, "UpdateUserList"}, + {20, nullptr, "IsRightsLostUser"}, + {21, nullptr, "SetRequiredAddOnContentsOnContentsAvailabilityTransition"}, + {22, nullptr, "GetLimitedApplicationLicense"}, + {23, nullptr, "GetLimitedApplicationLicenseUpgradableEvent"}, + {24, nullptr, "NotifyLimitedApplicationLicenseUpgradableEventForDebug"}, + {25, nullptr, "RequestProceedDynamicRightsState"}, + {26, D<&IDynamicRightsInterface::HasAccountRestrictedRightsInRunningApplications>, "HasAccountRestrictedRightsInRunningApplications"}, + {27, nullptr, "Unknown27"}, //20.0.0+ + {28, nullptr, "Unknown28"}, //20.0.0+ + {29, nullptr, "Unknown29"}, //21.0.0+ + {30, nullptr, "Unknown30"}, //21.0.0+ + }; + // clang-format on + + RegisterHandlers(functions); } IDynamicRightsInterface::~IDynamicRightsInterface() = default; diff --git a/src/core/hle/service/ns/dynamic_rights_interface.h b/src/core/hle/service/ns/dynamic_rights_interface.h index e8a1d81491..c3270aee05 100644 --- a/src/core/hle/service/ns/dynamic_rights_interface.h +++ b/src/core/hle/service/ns/dynamic_rights_interface.h @@ -21,8 +21,6 @@ private: Result GetRunningApplicationStatus(Out out_status, u64 rights_handle); Result VerifyActivatedRightsOwners(u64 rights_handle); Result HasAccountRestrictedRightsInRunningApplications(Out out_is_restricted); - - std::optional FindRequest(u32 key) override; }; } // namespace Service::NS diff --git a/src/core/hle/service/ns/ecommerce_interface.cpp b/src/core/hle/service/ns/ecommerce_interface.cpp index 5687d09a02..b8794bb5fb 100644 --- a/src/core/hle/service/ns/ecommerce_interface.cpp +++ b/src/core/hle/service/ns/ecommerce_interface.cpp @@ -10,6 +10,19 @@ namespace Service::NS { IECommerceInterface::IECommerceInterface(Core::System& system_) : ServiceFramework{system_, "IECommerceInterface"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "RequestLinkDevice"}, + {1, nullptr, "RequestCleanupAllPreInstalledApplications"}, + {2, nullptr, "RequestCleanupPreInstalledApplication"}, + {3, nullptr, "RequestSyncRights"}, + {4, nullptr, "RequestUnlinkDevice"}, + {5, nullptr, "RequestRevokeAllELicense"}, + {6, nullptr, "RequestSyncRightsBasedOnAssignedELicenses"}, + }; + // clang-format on + + RegisterHandlers(functions); } IECommerceInterface::~IECommerceInterface() = default; diff --git a/src/core/hle/service/ns/ecommerce_interface.h b/src/core/hle/service/ns/ecommerce_interface.h index d020ff5ef8..6ff9512123 100644 --- a/src/core/hle/service/ns/ecommerce_interface.h +++ b/src/core/hle/service/ns/ecommerce_interface.h @@ -14,19 +14,6 @@ class IECommerceInterface final : public ServiceFramework { public: explicit IECommerceInterface(Core::System& system_); ~IECommerceInterface() override; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "RequestLinkDevice"}, - FunctionInfo{1, nullptr, "RequestCleanupAllPreInstalledApplications"}, - FunctionInfo{2, nullptr, "RequestCleanupPreInstalledApplication"}, - FunctionInfo{3, nullptr, "RequestSyncRights"}, - FunctionInfo{4, nullptr, "RequestUnlinkDevice"}, - FunctionInfo{5, nullptr, "RequestRevokeAllELicense"}, - FunctionInfo{6, nullptr, "RequestSyncRightsBasedOnAssignedELicenses"} - ); }; } // namespace Service::NS diff --git a/src/core/hle/service/ns/factory_reset_interface.cpp b/src/core/hle/service/ns/factory_reset_interface.cpp index 1fc6edcc9b..11cdefb4be 100644 --- a/src/core/hle/service/ns/factory_reset_interface.cpp +++ b/src/core/hle/service/ns/factory_reset_interface.cpp @@ -8,21 +8,21 @@ namespace Service::NS { -std::optional IFactoryResetInterface::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{100, nullptr, "ResetToFactorySettings"}, - FunctionInfo{101, nullptr, "ResetToFactorySettingsWithoutUserSaveData"}, - FunctionInfo{102, nullptr, "ResetToFactorySettingsForRefurbishment"}, - FunctionInfo{103, nullptr, "ResetToFactorySettingsWithPlatformRegion"}, - FunctionInfo{104, nullptr, "ResetToFactorySettingsWithPlatformRegionAuthentication"}, - FunctionInfo{105, nullptr, "RequestResetToFactorySettingsSecurely"}, - FunctionInfo{106, nullptr, "RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IFactoryResetInterface::IFactoryResetInterface(Core::System& system_) : ServiceFramework{system_, "IFactoryResetInterface"} { + // clang-format off + static const FunctionInfo functions[] = { + {100, nullptr, "ResetToFactorySettings"}, + {101, nullptr, "ResetToFactorySettingsWithoutUserSaveData"}, + {102, nullptr, "ResetToFactorySettingsForRefurbishment"}, + {103, nullptr, "ResetToFactorySettingsWithPlatformRegion"}, + {104, nullptr, "ResetToFactorySettingsWithPlatformRegionAuthentication"}, + {105, nullptr, "RequestResetToFactorySettingsSecurely"}, + {106, nullptr, "RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely"}, + }; + // clang-format on + + RegisterHandlers(functions); } IFactoryResetInterface::~IFactoryResetInterface() = default; diff --git a/src/core/hle/service/ns/factory_reset_interface.h b/src/core/hle/service/ns/factory_reset_interface.h index 3d5700fb71..8181d6b379 100644 --- a/src/core/hle/service/ns/factory_reset_interface.h +++ b/src/core/hle/service/ns/factory_reset_interface.h @@ -14,7 +14,6 @@ class IFactoryResetInterface final : public ServiceFramework FindRequest(u32 key) override; }; } // namespace Service::NS diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index ff1654517b..fe057422ce 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp @@ -19,25 +19,25 @@ namespace Service::NS { class INotifyService final : public ServiceFramework { public: - explicit INotifyService(Core::System& system_) : ServiceFramework{system_, "pdm:ntfy"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "NotifyAppletEvent" }, - FunctionInfo{2, nullptr, "NotifyOperationModeChangeEvent" }, - FunctionInfo{3, nullptr, "NotifyPowerStateChangeEvent" }, - FunctionInfo{4, nullptr, "NotifyClearAllEvent" }, - FunctionInfo{5, nullptr, "NotifyEventForDebug" }, - FunctionInfo{6, nullptr, "SuspendUserAccountEventService" }, - FunctionInfo{7, nullptr, "ResumeUserAccountEventService" }, - FunctionInfo{8, nullptr, "NotifyLibraryAppletEvent" }, - FunctionInfo{9, nullptr, "Cmd9" }, - FunctionInfo{20, nullptr, "Cmd20" }, - FunctionInfo{30, nullptr, "Cmd30" }, - FunctionInfo{100, nullptr, "Cmd100" }, - FunctionInfo{101, nullptr, "Cmd101" } - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit INotifyService(Core::System& system_) : ServiceFramework{system_, "pdm:ntfy"} { + // clang-format off + static const FunctionInfo functions[] = { + { 0, nullptr, "NotifyAppletEvent" }, + { 2, nullptr, "NotifyOperationModeChangeEvent" }, + { 3, nullptr, "NotifyPowerStateChangeEvent" }, + { 4, nullptr, "NotifyClearAllEvent" }, + { 5, nullptr, "NotifyEventForDebug" }, + { 6, nullptr, "SuspendUserAccountEventService" }, + { 7, nullptr, "ResumeUserAccountEventService" }, + { 8, nullptr, "NotifyLibraryAppletEvent" }, + { 9, nullptr, "Cmd9" }, + { 20, nullptr, "Cmd20" }, + { 30, nullptr, "Cmd30" }, + { 100, nullptr, "Cmd100" }, + { 101, nullptr, "Cmd101" }, + }; + // clang-format on + RegisterHandlers(functions); } }; @@ -45,10 +45,18 @@ class IVulnerabilityManagerInterface final : public ServiceFramework { public: explicit IVulnerabilityManagerInterface(Core::System& system_) - : ServiceFramework{system_, "ns:vm"} {} - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + : ServiceFramework{system_, "ns:vm"} { + // clang-format off + static const FunctionInfo functions[] = { + {1200, D<&IVulnerabilityManagerInterface::NeedsUpdateVulnerability>, "NeedsUpdateVulnerability"}, + {1201, nullptr, "UpdateSafeSystemVersionForDebug"}, + {1202, nullptr, "GetSafeSystemVersion"}, + {3100, D<&IVulnerabilityManagerInterface::GetSafeSystemVersionCheckInfo>, "GetSafeSystemVersionCheckInfo"}, + {3101, nullptr, "RequestUpdateSafeSystemVersionCheckInfo"}, + {3102, D<&IVulnerabilityManagerInterface::ResetSafeSystemVersionCheckInfo>, "ResetSafeSystemVersionCheckInfo"}, + }; + // clang-format on + RegisterHandlers(functions); } ~IVulnerabilityManagerInterface() override = default; @@ -68,15 +76,6 @@ public: LOG_WARNING(Service_NS, "(STUBBED)"); R_SUCCEED(); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{1200, D<&IVulnerabilityManagerInterface::NeedsUpdateVulnerability>, "NeedsUpdateVulnerability"}, - FunctionInfo{1201, nullptr, "UpdateSafeSystemVersionForDebug"}, - FunctionInfo{1202, nullptr, "GetSafeSystemVersion"}, - FunctionInfo{3100, D<&IVulnerabilityManagerInterface::GetSafeSystemVersionCheckInfo>, "GetSafeSystemVersionCheckInfo"}, - FunctionInfo{3101, nullptr, "RequestUpdateSafeSystemVersionCheckInfo"}, - FunctionInfo{3102, D<&IVulnerabilityManagerInterface::ResetSafeSystemVersionCheckInfo>, "ResetSafeSystemVersionCheckInfo"} - ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/ns/ns.h b/src/core/hle/service/ns/ns.h index f79b4ae3d6..2b14d115ca 100644 --- a/src/core/hle/service/ns/ns.h +++ b/src/core/hle/service/ns/ns.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/ns/ns_results.h b/src/core/hle/service/ns/ns_results.h index 16d2ea6f7b..52f4c0ea59 100644 --- a/src/core/hle/service/ns/ns_results.h +++ b/src/core/hle/service/ns/ns_results.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/ns/platform_service_manager.cpp b/src/core/hle/service/ns/platform_service_manager.cpp index dea6cb5c16..bf93a2edfa 100644 --- a/src/core/hle/service/ns/platform_service_manager.cpp +++ b/src/core/hle/service/ns/platform_service_manager.cpp @@ -27,28 +27,6 @@ namespace Service::NS { -std::optional IPlatformServiceManager::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IPlatformServiceManager::RequestLoad>, "RequestLoad"}, - FunctionInfo{1, D<&IPlatformServiceManager::GetLoadState>, "GetLoadState"}, - FunctionInfo{2, D<&IPlatformServiceManager::GetSize>, "GetSize"}, - FunctionInfo{3, D<&IPlatformServiceManager::GetSharedMemoryAddressOffset>, "GetSharedMemoryAddressOffset"}, - FunctionInfo{4, D<&IPlatformServiceManager::GetSharedMemoryNativeHandle>, "GetSharedMemoryNativeHandle"}, - FunctionInfo{5, D<&IPlatformServiceManager::GetSharedFontInOrderOfPriority>, "GetSharedFontInOrderOfPriority"}, - FunctionInfo{6, D<&IPlatformServiceManager::GetSharedFontInOrderOfPriority>, "GetSharedFontInOrderOfPriorityForSystem"}, - FunctionInfo{100, nullptr, "RequestApplicationFunctionAuthorization"}, - FunctionInfo{101, nullptr, "RequestApplicationFunctionAuthorizationByProcessId"}, - FunctionInfo{102, nullptr, "RequestApplicationFunctionAuthorizationByApplicationId"}, - FunctionInfo{103, nullptr, "RefreshApplicationFunctionBlackListDebugRecord"}, - FunctionInfo{104, nullptr, "RequestApplicationFunctionAuthorizationByProgramId"}, - FunctionInfo{105, nullptr, "GetFunctionBlackListSystemVersionToAuthorize"}, - FunctionInfo{106, nullptr, "GetFunctionBlackListVersion"}, - FunctionInfo{1000, nullptr, "LoadNgWordDataForPlatformRegionChina"}, - FunctionInfo{1001, nullptr, "GetNgWordDataSizeForPlatformRegionChina"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - struct FontRegion { u32 offset; u32 size; @@ -111,6 +89,28 @@ struct IPlatformServiceManager::Impl { IPlatformServiceManager::IPlatformServiceManager(Core::System& system_, const char* service_name_) : ServiceFramework{system_, service_name_}, impl{std::make_unique()} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IPlatformServiceManager::RequestLoad>, "RequestLoad"}, + {1, D<&IPlatformServiceManager::GetLoadState>, "GetLoadState"}, + {2, D<&IPlatformServiceManager::GetSize>, "GetSize"}, + {3, D<&IPlatformServiceManager::GetSharedMemoryAddressOffset>, "GetSharedMemoryAddressOffset"}, + {4, D<&IPlatformServiceManager::GetSharedMemoryNativeHandle>, "GetSharedMemoryNativeHandle"}, + {5, D<&IPlatformServiceManager::GetSharedFontInOrderOfPriority>, "GetSharedFontInOrderOfPriority"}, + {6, D<&IPlatformServiceManager::GetSharedFontInOrderOfPriority>, "GetSharedFontInOrderOfPriorityForSystem"}, + {100, nullptr, "RequestApplicationFunctionAuthorization"}, + {101, nullptr, "RequestApplicationFunctionAuthorizationByProcessId"}, + {102, nullptr, "RequestApplicationFunctionAuthorizationByApplicationId"}, + {103, nullptr, "RefreshApplicationFunctionBlackListDebugRecord"}, + {104, nullptr, "RequestApplicationFunctionAuthorizationByProgramId"}, + {105, nullptr, "GetFunctionBlackListSystemVersionToAuthorize"}, + {106, nullptr, "GetFunctionBlackListVersion"}, + {1000, nullptr, "LoadNgWordDataForPlatformRegionChina"}, + {1001, nullptr, "GetNgWordDataSizeForPlatformRegionChina"}, + }; + // clang-format on + RegisterHandlers(functions); + auto& fsc = system.GetFileSystemController(); // Attempt to load shared font data from disk diff --git a/src/core/hle/service/ns/platform_service_manager.h b/src/core/hle/service/ns/platform_service_manager.h index fb99a441f5..73521abbc2 100644 --- a/src/core/hle/service/ns/platform_service_manager.h +++ b/src/core/hle/service/ns/platform_service_manager.h @@ -68,12 +68,11 @@ private: Result GetSharedMemoryNativeHandle( OutCopyHandle out_shared_memory_native_handle); Result GetSharedFontInOrderOfPriority(OutArray out_font_codes, - OutArray out_font_offsets, - OutArray out_font_sizes, - Out out_fonts_are_loaded, Out out_font_count, - Set::LanguageCode language_code); + OutArray out_font_offsets, + OutArray out_font_sizes, + Out out_fonts_are_loaded, Out out_font_count, + Set::LanguageCode language_code); - std::optional FindRequest(u32 key) override; struct Impl; std::unique_ptr impl; }; diff --git a/src/core/hle/service/ns/query_service.cpp b/src/core/hle/service/ns/query_service.cpp index 13a1f33866..d22de1d169 100644 --- a/src/core/hle/service/ns/query_service.cpp +++ b/src/core/hle/service/ns/query_service.cpp @@ -14,40 +14,40 @@ namespace Service::NS { -std::optional IQueryService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "QueryAppletEvent"}, - FunctionInfo{1, nullptr, "QueryPlayStatistics"}, - FunctionInfo{2, nullptr, "QueryPlayStatisticsByUserAccountId"}, - FunctionInfo{3, nullptr, "QueryPlayStatisticsByNetworkServiceAccountId"}, - FunctionInfo{4, nullptr, "QueryPlayStatisticsByApplicationId"}, - FunctionInfo{5, D<&IQueryService::QueryPlayStatisticsByApplicationIdAndUserAccountId>, "QueryPlayStatisticsByApplicationIdAndUserAccountId"}, - FunctionInfo{6, nullptr, "QueryPlayStatisticsByApplicationIdAndNetworkServiceAccountId"}, - FunctionInfo{7, nullptr, "QueryLastPlayTimeV0"}, - FunctionInfo{8, nullptr, "QueryPlayEvent"}, - FunctionInfo{9, nullptr, "GetAvailablePlayEventRange"}, - FunctionInfo{10, nullptr, "QueryAccountEvent"}, - FunctionInfo{11, nullptr, "QueryAccountPlayEvent"}, - FunctionInfo{12, nullptr, "GetAvailableAccountPlayEventRange"}, - FunctionInfo{13, nullptr, "QueryApplicationPlayStatisticsForSystemV0"}, - FunctionInfo{14, nullptr, "QueryRecentlyPlayedApplication"}, - FunctionInfo{15, nullptr, "GetRecentlyPlayedApplicationUpdateEvent"}, - FunctionInfo{16, nullptr, "QueryApplicationPlayStatisticsByUserAccountIdForSystemV0"}, - FunctionInfo{17, D<&IQueryService::QueryLastPlayTime>, "QueryLastPlayTime"}, - FunctionInfo{18, D<&IQueryService::QueryApplicationPlayStatisticsForSystem>, "QueryApplicationPlayStatisticsForSystem"}, - FunctionInfo{19, D<&IQueryService::QueryApplicationPlayStatisticsByUserAccountIdForSystem>, "QueryApplicationPlayStatisticsByUserAccountIdForSystem"}, - FunctionInfo{30, nullptr, "Cmd30" }, - FunctionInfo{31, nullptr, "Cmd31" }, - FunctionInfo{100, nullptr, "Cmd100" }, - FunctionInfo{110, nullptr, "Cmd110" }, - FunctionInfo{118, nullptr, "Cmd118" }, - FunctionInfo{119, nullptr, "Cmd119" } - ); - return HandlerTableGenerateWithFind(key, functions); -} - IQueryService::IQueryService(Core::System& system_) : ServiceFramework{system_, "pdm:qry"}, play_time_manager{std::make_unique()} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "QueryAppletEvent"}, + {1, nullptr, "QueryPlayStatistics"}, + {2, nullptr, "QueryPlayStatisticsByUserAccountId"}, + {3, nullptr, "QueryPlayStatisticsByNetworkServiceAccountId"}, + {4, nullptr, "QueryPlayStatisticsByApplicationId"}, + {5, D<&IQueryService::QueryPlayStatisticsByApplicationIdAndUserAccountId>, "QueryPlayStatisticsByApplicationIdAndUserAccountId"}, + {6, nullptr, "QueryPlayStatisticsByApplicationIdAndNetworkServiceAccountId"}, + {7, nullptr, "QueryLastPlayTimeV0"}, + {8, nullptr, "QueryPlayEvent"}, + {9, nullptr, "GetAvailablePlayEventRange"}, + {10, nullptr, "QueryAccountEvent"}, + {11, nullptr, "QueryAccountPlayEvent"}, + {12, nullptr, "GetAvailableAccountPlayEventRange"}, + {13, nullptr, "QueryApplicationPlayStatisticsForSystemV0"}, + {14, nullptr, "QueryRecentlyPlayedApplication"}, + {15, nullptr, "GetRecentlyPlayedApplicationUpdateEvent"}, + {16, nullptr, "QueryApplicationPlayStatisticsByUserAccountIdForSystemV0"}, + {17, D<&IQueryService::QueryLastPlayTime>, "QueryLastPlayTime"}, + {18, D<&IQueryService::QueryApplicationPlayStatisticsForSystem>, "QueryApplicationPlayStatisticsForSystem"}, + {19, D<&IQueryService::QueryApplicationPlayStatisticsByUserAccountIdForSystem>, "QueryApplicationPlayStatisticsByUserAccountIdForSystem"}, + { 30, nullptr, "Cmd30" }, + { 31, nullptr, "Cmd31" }, + { 100, nullptr, "Cmd100" }, + { 110, nullptr, "Cmd110" }, + { 118, nullptr, "Cmd118" }, + { 119, nullptr, "Cmd119" }, + }; + // clang-format on + + RegisterHandlers(functions); } IQueryService::~IQueryService() = default; diff --git a/src/core/hle/service/ns/query_service.h b/src/core/hle/service/ns/query_service.h index 08267d3165..f5c0ae1058 100644 --- a/src/core/hle/service/ns/query_service.h +++ b/src/core/hle/service/ns/query_service.h @@ -62,7 +62,6 @@ private: OutArray out_stats, InArray application_ids); - std::optional FindRequest(u32 key) override; std::unique_ptr play_time_manager; }; diff --git a/src/core/hle/service/ns/read_only_application_control_data_interface.cpp b/src/core/hle/service/ns/read_only_application_control_data_interface.cpp index c6cd822d24..1359cdbb95 100644 --- a/src/core/hle/service/ns/read_only_application_control_data_interface.cpp +++ b/src/core/hle/service/ns/read_only_application_control_data_interface.cpp @@ -73,21 +73,6 @@ void SanitizeJPEGImageSize(std::vector& image) { } // namespace -std::optional IReadOnlyApplicationControlDataInterface::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IReadOnlyApplicationControlDataInterface::GetApplicationControlData>, "GetApplicationControlData"}, - FunctionInfo{1, D<&IReadOnlyApplicationControlDataInterface::GetApplicationDesiredLanguage>, "GetApplicationDesiredLanguage"}, - FunctionInfo{2, D<&IReadOnlyApplicationControlDataInterface::ConvertApplicationLanguageToLanguageCode>, "ConvertApplicationLanguageToLanguageCode"}, - FunctionInfo{3, nullptr, "ConvertLanguageCodeToApplicationLanguage"}, - FunctionInfo{4, nullptr, "SelectApplicationDesiredLanguage"}, - FunctionInfo{5, D<&IReadOnlyApplicationControlDataInterface::GetApplicationControlData2>, "GetApplicationControlData"}, - FunctionInfo{10, &IReadOnlyApplicationControlDataInterface::ListApplicationIcon, "ListApplicationIcon"}, - FunctionInfo{13, &IReadOnlyApplicationControlDataInterface::ListApplicationTitle, "ListApplicationTitle"}, - FunctionInfo{19, D<&IReadOnlyApplicationControlDataInterface::GetApplicationControlData3>, "GetApplicationControlData"}, - FunctionInfo{23, D<&IReadOnlyApplicationControlDataInterface::GetApplicationControlData3>, "GetApplicationControlData", MakeVersionGate({23,0,0})} - ); - return HandlerTableGenerateWithFind(key, functions); -} // IAsyncValue implementation for ListApplicationTitle // https://switchbrew.org/wiki/NS_services#ListApplicationTitle @@ -99,6 +84,13 @@ public: , data_offset{offset} , data_size{size} { + static const FunctionInfo functions[] = { + {0, D<&IAsyncValue::GetSize>, "GetSize"}, + {1, D<&IAsyncValue::Get>, "Get"}, + {2, D<&IAsyncValue::Cancel>, "Cancel"}, + {3, D<&IAsyncValue::GetErrorContext>, "GetErrorContext"}, + }; + RegisterHandlers(functions); completion_event = service_context.CreateEvent("IAsyncValue:Completion"); completion_event->GetReadableEvent().Signal(system.Kernel()); } @@ -130,16 +122,6 @@ private: LOG_DEBUG(Service_NS, "called"); R_SUCCEED(); } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IAsyncValue::GetSize>, "GetSize"}, - FunctionInfo{1, D<&IAsyncValue::Get>, "Get"}, - FunctionInfo{2, D<&IAsyncValue::Cancel>, "Cancel"}, - FunctionInfo{3, D<&IAsyncValue::GetErrorContext>, "GetErrorContext"} - ); KernelHelpers::ServiceContext service_context; Kernel::KEvent* completion_event{}; s32 data_offset; @@ -149,6 +131,22 @@ private: IReadOnlyApplicationControlDataInterface::IReadOnlyApplicationControlDataInterface( Core::System& system_) : ServiceFramework{system_, "IReadOnlyApplicationControlDataInterface"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IReadOnlyApplicationControlDataInterface::GetApplicationControlData>, "GetApplicationControlData"}, + {1, D<&IReadOnlyApplicationControlDataInterface::GetApplicationDesiredLanguage>, "GetApplicationDesiredLanguage"}, + {2, D<&IReadOnlyApplicationControlDataInterface::ConvertApplicationLanguageToLanguageCode>, "ConvertApplicationLanguageToLanguageCode"}, + {3, nullptr, "ConvertLanguageCodeToApplicationLanguage"}, + {4, nullptr, "SelectApplicationDesiredLanguage"}, + {5, D<&IReadOnlyApplicationControlDataInterface::GetApplicationControlData2>, "GetApplicationControlData"}, + {10, &IReadOnlyApplicationControlDataInterface::ListApplicationIcon, "ListApplicationIcon"}, + {13, &IReadOnlyApplicationControlDataInterface::ListApplicationTitle, "ListApplicationTitle"}, + {19, D<&IReadOnlyApplicationControlDataInterface::GetApplicationControlData3>, "GetApplicationControlData"}, + {23, D<&IReadOnlyApplicationControlDataInterface::GetApplicationControlData3>, "GetApplicationControlData"}, //23.0.0+ + }; + // clang-format on + + RegisterHandlers(functions); } IReadOnlyApplicationControlDataInterface::~IReadOnlyApplicationControlDataInterface() = default; diff --git a/src/core/hle/service/ns/read_only_application_control_data_interface.h b/src/core/hle/service/ns/read_only_application_control_data_interface.h index 3f68029583..a4a285151a 100644 --- a/src/core/hle/service/ns/read_only_application_control_data_interface.h +++ b/src/core/hle/service/ns/read_only_application_control_data_interface.h @@ -45,8 +45,6 @@ public: u8 flag1, u8 flag2, u64 application_id); - - std::optional FindRequest(u32 key) override; }; } // namespace Service::NS diff --git a/src/core/hle/service/ns/read_only_application_record_interface.cpp b/src/core/hle/service/ns/read_only_application_record_interface.cpp index 7a7cf9ec58..8ce7851ae2 100644 --- a/src/core/hle/service/ns/read_only_application_record_interface.cpp +++ b/src/core/hle/service/ns/read_only_application_record_interface.cpp @@ -11,18 +11,17 @@ namespace Service::NS { -std::optional IReadOnlyApplicationRecordInterface::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IReadOnlyApplicationRecordInterface::HasApplicationRecord>, "HasApplicationRecord"}, - FunctionInfo{1, nullptr, "NotifyApplicationFailure"}, - FunctionInfo{2, D<&IReadOnlyApplicationRecordInterface::IsDataCorruptedResult>, "IsDataCorruptedResult"}, - FunctionInfo{3, D<&IReadOnlyApplicationRecordInterface::ListApplicationRecord>, "ListApplicationRecord"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IReadOnlyApplicationRecordInterface::IReadOnlyApplicationRecordInterface(Core::System& system_) : ServiceFramework{system_, "IReadOnlyApplicationRecordInterface"} { + static const FunctionInfo functions[] = { + {0, D<&IReadOnlyApplicationRecordInterface::HasApplicationRecord>, "HasApplicationRecord"}, + {1, nullptr, "NotifyApplicationFailure"}, + {2, D<&IReadOnlyApplicationRecordInterface::IsDataCorruptedResult>, "IsDataCorruptedResult"}, + {3, D<&IReadOnlyApplicationRecordInterface::ListApplicationRecord>, "ListApplicationRecord"}, + }; + // clang-format on + + RegisterHandlers(functions); } IReadOnlyApplicationRecordInterface::~IReadOnlyApplicationRecordInterface() = default; diff --git a/src/core/hle/service/ns/read_only_application_record_interface.h b/src/core/hle/service/ns/read_only_application_record_interface.h index 308e753e7d..dd842070e8 100644 --- a/src/core/hle/service/ns/read_only_application_record_interface.h +++ b/src/core/hle/service/ns/read_only_application_record_interface.h @@ -24,8 +24,6 @@ private: Result ListApplicationRecord( OutArray out_records, Out out_count, s32 entry_offset); - - std::optional FindRequest(u32 key) override; }; } // namespace Service::NS diff --git a/src/core/hle/service/ns/service_getter_interface.cpp b/src/core/hle/service/ns/service_getter_interface.cpp index bbf30da3da..7b7f791650 100644 --- a/src/core/hle/service/ns/service_getter_interface.cpp +++ b/src/core/hle/service/ns/service_getter_interface.cpp @@ -20,25 +20,25 @@ namespace Service::NS { -std::optional IServiceGetterInterface::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{7988, D<&IServiceGetterInterface::GetDynamicRightsInterface>, "GetDynamicRightsInterface"}, - FunctionInfo{7989, D<&IServiceGetterInterface::GetReadOnlyApplicationControlDataInterface>, "GetReadOnlyApplicationControlDataInterface"}, - FunctionInfo{7991, D<&IServiceGetterInterface::GetReadOnlyApplicationRecordInterface>, "GetReadOnlyApplicationRecordInterface"}, - FunctionInfo{7992, D<&IServiceGetterInterface::GetECommerceInterface>, "GetECommerceInterface"}, - FunctionInfo{7993, D<&IServiceGetterInterface::GetApplicationVersionInterface>, "GetApplicationVersionInterface"}, - FunctionInfo{7994, D<&IServiceGetterInterface::GetFactoryResetInterface>, "GetFactoryResetInterface"}, - FunctionInfo{7995, D<&IServiceGetterInterface::GetAccountProxyInterface>, "GetAccountProxyInterface"}, - FunctionInfo{7996, D<&IServiceGetterInterface::GetApplicationManagerInterface>, "GetApplicationManagerInterface"}, - FunctionInfo{7997, D<&IServiceGetterInterface::GetDownloadTaskInterface>, "GetDownloadTaskInterface"}, - FunctionInfo{7998, D<&IServiceGetterInterface::GetContentManagementInterface>, "GetContentManagementInterface"}, - FunctionInfo{7999, D<&IServiceGetterInterface::GetDocumentInterface>, "GetDocumentInterface"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IServiceGetterInterface::IServiceGetterInterface(Core::System& system_, const char* name) : ServiceFramework{system_, name} { + // clang-format off + static const FunctionInfo functions[] = { + {7988, D<&IServiceGetterInterface::GetDynamicRightsInterface>, "GetDynamicRightsInterface"}, + {7989, D<&IServiceGetterInterface::GetReadOnlyApplicationControlDataInterface>, "GetReadOnlyApplicationControlDataInterface"}, + {7991, D<&IServiceGetterInterface::GetReadOnlyApplicationRecordInterface>, "GetReadOnlyApplicationRecordInterface"}, + {7992, D<&IServiceGetterInterface::GetECommerceInterface>, "GetECommerceInterface"}, + {7993, D<&IServiceGetterInterface::GetApplicationVersionInterface>, "GetApplicationVersionInterface"}, + {7994, D<&IServiceGetterInterface::GetFactoryResetInterface>, "GetFactoryResetInterface"}, + {7995, D<&IServiceGetterInterface::GetAccountProxyInterface>, "GetAccountProxyInterface"}, + {7996, D<&IServiceGetterInterface::GetApplicationManagerInterface>, "GetApplicationManagerInterface"}, + {7997, D<&IServiceGetterInterface::GetDownloadTaskInterface>, "GetDownloadTaskInterface"}, + {7998, D<&IServiceGetterInterface::GetContentManagementInterface>, "GetContentManagementInterface"}, + {7999, D<&IServiceGetterInterface::GetDocumentInterface>, "GetDocumentInterface"}, + }; + // clang-format on + + RegisterHandlers(functions); } IServiceGetterInterface::~IServiceGetterInterface() = default; diff --git a/src/core/hle/service/ns/service_getter_interface.h b/src/core/hle/service/ns/service_getter_interface.h index 8c33aafc27..fc36b04325 100644 --- a/src/core/hle/service/ns/service_getter_interface.h +++ b/src/core/hle/service/ns/service_getter_interface.h @@ -45,8 +45,6 @@ public: Result GetContentManagementInterface( Out> out_interface); Result GetDocumentInterface(Out> out_interface); - - std::optional FindRequest(u32 key) override; }; } // namespace Service::NS diff --git a/src/core/hle/service/ns/system_update_control.cpp b/src/core/hle/service/ns/system_update_control.cpp index 3d1911c852..2711db508c 100644 --- a/src/core/hle/service/ns/system_update_control.cpp +++ b/src/core/hle/service/ns/system_update_control.cpp @@ -11,6 +11,35 @@ namespace Service::NS { ISystemUpdateControl::ISystemUpdateControl(Core::System& system_) : ServiceFramework{system_, "ISystemUpdateControl"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "HasDownloaded"}, + {1, nullptr, "RequestCheckLatestUpdate"}, + {2, nullptr, "RequestDownloadLatestUpdate"}, + {3, nullptr, "GetDownloadProgress"}, + {4, nullptr, "ApplyDownloadedUpdate"}, + {5, nullptr, "RequestPrepareCardUpdate"}, + {6, nullptr, "GetPrepareCardUpdateProgress"}, + {7, nullptr, "HasPreparedCardUpdate"}, + {8, nullptr, "ApplyCardUpdate"}, + {9, nullptr, "GetDownloadedEulaDataSize"}, + {10, nullptr, "GetDownloadedEulaData"}, + {11, nullptr, "SetupCardUpdate"}, + {12, nullptr, "GetPreparedCardUpdateEulaDataSize"}, + {13, nullptr, "GetPreparedCardUpdateEulaData"}, + {14, nullptr, "SetupCardUpdateViaSystemUpdater"}, + {15, nullptr, "HasReceived"}, + {16, nullptr, "RequestReceiveSystemUpdate"}, + {17, nullptr, "GetReceiveProgress"}, + {18, nullptr, "ApplyReceivedUpdate"}, + {19, nullptr, "GetReceivedEulaDataSize"}, + {20, nullptr, "GetReceivedEulaData"}, + {21, nullptr, "SetupToReceiveSystemUpdate"}, + {22, nullptr, "RequestCheckLatestUpdateIncludesRebootlessUpdate"}, + }; + // clang-format on + + RegisterHandlers(functions); } ISystemUpdateControl::~ISystemUpdateControl() = default; diff --git a/src/core/hle/service/ns/system_update_control.h b/src/core/hle/service/ns/system_update_control.h index acdf048e6c..70794f4abd 100644 --- a/src/core/hle/service/ns/system_update_control.h +++ b/src/core/hle/service/ns/system_update_control.h @@ -14,35 +14,6 @@ class ISystemUpdateControl final : public ServiceFramework public: explicit ISystemUpdateControl(Core::System& system_); ~ISystemUpdateControl() override; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "HasDownloaded"}, - FunctionInfo{1, nullptr, "RequestCheckLatestUpdate"}, - FunctionInfo{2, nullptr, "RequestDownloadLatestUpdate"}, - FunctionInfo{3, nullptr, "GetDownloadProgress"}, - FunctionInfo{4, nullptr, "ApplyDownloadedUpdate"}, - FunctionInfo{5, nullptr, "RequestPrepareCardUpdate"}, - FunctionInfo{6, nullptr, "GetPrepareCardUpdateProgress"}, - FunctionInfo{7, nullptr, "HasPreparedCardUpdate"}, - FunctionInfo{8, nullptr, "ApplyCardUpdate"}, - FunctionInfo{9, nullptr, "GetDownloadedEulaDataSize"}, - FunctionInfo{10, nullptr, "GetDownloadedEulaData"}, - FunctionInfo{11, nullptr, "SetupCardUpdate"}, - FunctionInfo{12, nullptr, "GetPreparedCardUpdateEulaDataSize"}, - FunctionInfo{13, nullptr, "GetPreparedCardUpdateEulaData"}, - FunctionInfo{14, nullptr, "SetupCardUpdateViaSystemUpdater"}, - FunctionInfo{15, nullptr, "HasReceived"}, - FunctionInfo{16, nullptr, "RequestReceiveSystemUpdate"}, - FunctionInfo{17, nullptr, "GetReceiveProgress"}, - FunctionInfo{18, nullptr, "ApplyReceivedUpdate"}, - FunctionInfo{19, nullptr, "GetReceivedEulaDataSize"}, - FunctionInfo{20, nullptr, "GetReceivedEulaData"}, - FunctionInfo{21, nullptr, "SetupToReceiveSystemUpdate"}, - FunctionInfo{22, nullptr, "RequestCheckLatestUpdateIncludesRebootlessUpdate"} - ); }; } // namespace Service::NS diff --git a/src/core/hle/service/ns/system_update_interface.cpp b/src/core/hle/service/ns/system_update_interface.cpp index 044d39835f..3f4d42fdb6 100644 --- a/src/core/hle/service/ns/system_update_interface.cpp +++ b/src/core/hle/service/ns/system_update_interface.cpp @@ -10,32 +10,32 @@ namespace Service::NS { -std::optional ISystemUpdateInterface::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&ISystemUpdateInterface::GetBackgroundNetworkUpdateState>, "GetBackgroundNetworkUpdateState"}, - FunctionInfo{1, D<&ISystemUpdateInterface::OpenSystemUpdateControl>, "OpenSystemUpdateControl"}, - FunctionInfo{2, nullptr, "NotifyExFatDriverRequired"}, - FunctionInfo{3, nullptr, "ClearExFatDriverStatusForDebug"}, - FunctionInfo{4, nullptr, "RequestBackgroundNetworkUpdate"}, - FunctionInfo{5, nullptr, "NotifyBackgroundNetworkUpdate"}, - FunctionInfo{6, nullptr, "NotifyExFatDriverDownloadedForDebug"}, - FunctionInfo{9, D<&ISystemUpdateInterface::GetSystemUpdateNotificationEventForContentDelivery>, "GetSystemUpdateNotificationEventForContentDelivery"}, - FunctionInfo{10, nullptr, "NotifySystemUpdateForContentDelivery"}, - FunctionInfo{11, nullptr, "PrepareShutdown"}, - FunctionInfo{12, nullptr, "Unknown12"}, - FunctionInfo{13, nullptr, "Unknown13"}, - FunctionInfo{14, nullptr, "Unknown14"}, - FunctionInfo{15, nullptr, "Unknown15"}, - FunctionInfo{16, nullptr, "DestroySystemUpdateTask"}, - FunctionInfo{17, nullptr, "RequestSendSystemUpdate"}, - FunctionInfo{18, nullptr, "GetSendSystemUpdateProgress"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - ISystemUpdateInterface::ISystemUpdateInterface(Core::System& system_) : ServiceFramework{system_, "ns:su"}, service_context{system_, "ns:su"}, update_notification_event{service_context} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&ISystemUpdateInterface::GetBackgroundNetworkUpdateState>, "GetBackgroundNetworkUpdateState"}, + {1, D<&ISystemUpdateInterface::OpenSystemUpdateControl>, "OpenSystemUpdateControl"}, + {2, nullptr, "NotifyExFatDriverRequired"}, + {3, nullptr, "ClearExFatDriverStatusForDebug"}, + {4, nullptr, "RequestBackgroundNetworkUpdate"}, + {5, nullptr, "NotifyBackgroundNetworkUpdate"}, + {6, nullptr, "NotifyExFatDriverDownloadedForDebug"}, + {9, D<&ISystemUpdateInterface::GetSystemUpdateNotificationEventForContentDelivery>, "GetSystemUpdateNotificationEventForContentDelivery"}, + {10, nullptr, "NotifySystemUpdateForContentDelivery"}, + {11, nullptr, "PrepareShutdown"}, + {12, nullptr, "Unknown12"}, + {13, nullptr, "Unknown13"}, + {14, nullptr, "Unknown14"}, + {15, nullptr, "Unknown15"}, + {16, nullptr, "DestroySystemUpdateTask"}, + {17, nullptr, "RequestSendSystemUpdate"}, + {18, nullptr, "GetSendSystemUpdateProgress"}, + }; + // clang-format on + + RegisterHandlers(functions); } ISystemUpdateInterface::~ISystemUpdateInterface() = default; diff --git a/src/core/hle/service/ns/system_update_interface.h b/src/core/hle/service/ns/system_update_interface.h index 2ea14f4f5e..76f8959ed6 100644 --- a/src/core/hle/service/ns/system_update_interface.h +++ b/src/core/hle/service/ns/system_update_interface.h @@ -33,7 +33,7 @@ private: Result GetSystemUpdateNotificationEventForContentDelivery( OutCopyHandle out_event); - std::optional FindRequest(u32 key) override; +private: KernelHelpers::ServiceContext service_context; Event update_notification_event; }; diff --git a/src/core/hle/service/nvdrv/devices/ioctl_serialization.h b/src/core/hle/service/nvdrv/devices/ioctl_serialization.h index c3baa3a75b..37d04e3cf1 100644 --- a/src/core/hle/service/nvdrv/devices/ioctl_serialization.h +++ b/src/core/hle/service/nvdrv/devices/ioctl_serialization.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project diff --git a/src/core/hle/service/nvdrv/devices/nvdevice.h b/src/core/hle/service/nvdrv/devices/nvdevice.h index 8adaddc60b..d23ec63bae 100644 --- a/src/core/hle/service/nvdrv/devices/nvdevice.h +++ b/src/core/hle/service/nvdrv/devices/nvdevice.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp index 358679b831..1e571be4c9 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp @@ -278,7 +278,7 @@ NvResult nvhost_gpu::AllocateObjectContext(IoctlAllocObjCtx& params) { params.flags = allowed_mask; } - s32_le ctx_class_number_index = + s32_le ctx_class_number_index = GetObjectContextClassNumberIndex(static_cast(params.class_num)); if (ctx_class_number_index < 0) { LOG_ERROR(Service_NVDRV, "Invalid class number for object context: {:#x}", diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h index 627686757b..1747881d48 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h index def9c254d1..e0735b7f01 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/nvdrv/devices/nvhost_vic.h b/src/core/hle/service/nvdrv/devices/nvhost_vic.h index 0cc04354a0..b1cbcb9ad7 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_vic.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_vic.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp index 81d8a3a63b..b252a2efa5 100644 --- a/src/core/hle/service/nvdrv/nvdrv.cpp +++ b/src/core/hle/service/nvdrv/nvdrv.cpp @@ -50,61 +50,55 @@ class NVGEM_C final : public ServiceFramework { public: explicit NVGEM_C(Core::System& system_) : ServiceFramework{system_, "nvgem:c"} - {} - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + { + static const FunctionInfo functions[] = { + {0, nullptr, "Initialize"}, + {1, nullptr, "GetEventHandle"}, + {2, nullptr, "ControlNotification"}, + {3, nullptr, "SetNotificationPerm"}, + {4, nullptr, "SetCoreDumpPerm"}, + {5, nullptr, "GetAruid"}, + {6, nullptr, "Reset"}, + {7, nullptr, "GetAruid2"}, + }; + RegisterHandlers(functions); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "Initialize"}, - FunctionInfo{1, nullptr, "GetEventHandle"}, - FunctionInfo{2, nullptr, "ControlNotification"}, - FunctionInfo{3, nullptr, "SetNotificationPerm"}, - FunctionInfo{4, nullptr, "SetCoreDumpPerm"}, - FunctionInfo{5, nullptr, "GetAruid"}, - FunctionInfo{6, nullptr, "Reset"}, - FunctionInfo{7, nullptr, "GetAruid2"} - ); }; class NVGEM_CD final : public ServiceFramework { public: explicit NVGEM_CD(Core::System& system_) : ServiceFramework{system_, "nvgem:cd"} - {} - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + { + static const FunctionInfo functions[] = { + {0, nullptr, "Initialize"}, + {1, nullptr, "GetAruid"}, + {2, nullptr, "ReadNextBlock"}, + {3, nullptr, "GetNextBlockSize"}, + {4, nullptr, "ReadNextBlock2"}, + }; + RegisterHandlers(functions); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "Initialize"}, - FunctionInfo{1, nullptr, "GetAruid"}, - FunctionInfo{2, nullptr, "ReadNextBlock"}, - FunctionInfo{3, nullptr, "GetNextBlockSize"}, - FunctionInfo{4, nullptr, "ReadNextBlock2"} - ); }; class NVDBG_D final : public ServiceFramework { public: explicit NVDBG_D(Core::System& system_) : ServiceFramework{system_, "nvdbg:d"} - {} - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + { + static const FunctionInfo functions[] = { + {0, nullptr, "Open"}, + {1, nullptr, "Ioctl"}, + {2, nullptr, "Close"}, + {4, nullptr, "QueryEvent"}, + {9, nullptr, "DumpStatus"}, + {10, nullptr, "InitializeDevtools"}, + {11, nullptr, "Ioctl2"}, + {12, nullptr, "Ioctl3"}, + {13, nullptr, "SetConfiguration"}, + }; + RegisterHandlers(functions); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "Open"}, - FunctionInfo{1, nullptr, "Ioctl"}, - FunctionInfo{2, nullptr, "Close"}, - FunctionInfo{4, nullptr, "QueryEvent"}, - FunctionInfo{9, nullptr, "DumpStatus"}, - FunctionInfo{10, nullptr, "InitializeDevtools"}, - FunctionInfo{11, nullptr, "Ioctl2"}, - FunctionInfo{12, nullptr, "Ioctl3"}, - FunctionInfo{13, nullptr, "SetConfiguration"} - ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/nvdrv/nvdrv_interface.cpp b/src/core/hle/service/nvdrv/nvdrv_interface.cpp index db3dbd9f8e..5fae68adbb 100644 --- a/src/core/hle/service/nvdrv/nvdrv_interface.cpp +++ b/src/core/hle/service/nvdrv/nvdrv_interface.cpp @@ -245,6 +245,24 @@ void NVDRV::DumpGraphicsMemoryInfo(HLERequestContext& ctx) { NVDRV::NVDRV(Core::System& system_, std::shared_ptr nvdrv_, const char* name) : ServiceFramework{system_, name}, nvdrv{std::move(nvdrv_)} { + static const FunctionInfo functions[] = { + {0, &NVDRV::Open, "Open"}, + {1, &NVDRV::Ioctl1, "Ioctl"}, + {2, &NVDRV::Close, "Close"}, + {3, &NVDRV::Initialize, "Initialize"}, + {4, &NVDRV::QueryEvent, "QueryEvent"}, + {5, nullptr, "MapSharedMem"}, + {6, &NVDRV::GetStatus, "GetStatus"}, + {7, nullptr, "SetAruidForTest"}, + {8, &NVDRV::SetAruid, "SetAruid"}, + {9, &NVDRV::DumpGraphicsMemoryInfo, "DumpGraphicsMemoryInfo"}, + {10, nullptr, "InitializeDevtools"}, + {11, &NVDRV::Ioctl2, "Ioctl2"}, + {12, &NVDRV::Ioctl3, "Ioctl3"}, + {13, &NVDRV::SetGraphicsFirmwareMemoryMarginEnabled, + "SetGraphicsFirmwareMemoryMarginEnabled"}, + }; + RegisterHandlers(functions); } NVDRV::~NVDRV() { diff --git a/src/core/hle/service/nvdrv/nvdrv_interface.h b/src/core/hle/service/nvdrv/nvdrv_interface.h index b9b574398a..f628fca7df 100644 --- a/src/core/hle/service/nvdrv/nvdrv_interface.h +++ b/src/core/hle/service/nvdrv/nvdrv_interface.h @@ -38,27 +38,8 @@ private: void ServiceError(HLERequestContext& ctx, NvResult result); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &NVDRV::Open, "Open"}, - FunctionInfo{1, &NVDRV::Ioctl1, "Ioctl"}, - FunctionInfo{2, &NVDRV::Close, "Close"}, - FunctionInfo{3, &NVDRV::Initialize, "Initialize"}, - FunctionInfo{4, &NVDRV::QueryEvent, "QueryEvent"}, - FunctionInfo{5, nullptr, "MapSharedMem"}, - FunctionInfo{6, &NVDRV::GetStatus, "GetStatus"}, - FunctionInfo{7, nullptr, "SetAruidForTest"}, - FunctionInfo{8, &NVDRV::SetAruid, "SetAruid"}, - FunctionInfo{9, &NVDRV::DumpGraphicsMemoryInfo, "DumpGraphicsMemoryInfo"}, - FunctionInfo{10, nullptr, "InitializeDevtools"}, - FunctionInfo{11, &NVDRV::Ioctl2, "Ioctl2"}, - FunctionInfo{12, &NVDRV::Ioctl3, "Ioctl3"}, - FunctionInfo{13, &NVDRV::SetGraphicsFirmwareMemoryMarginEnabled, - "SetGraphicsFirmwareMemoryMarginEnabled"} - ); std::shared_ptr nvdrv; + u64 pid{}; bool is_initialized{}; NvCore::SessionId session_id{}; diff --git a/src/core/hle/service/nvdrv/nvmemp.cpp b/src/core/hle/service/nvdrv/nvmemp.cpp index 8e2e4dfacb..a5477faf1a 100644 --- a/src/core/hle/service/nvdrv/nvmemp.cpp +++ b/src/core/hle/service/nvdrv/nvmemp.cpp @@ -11,6 +11,11 @@ namespace Service::Nvidia { NVMEMP::NVMEMP(Core::System& system_) : ServiceFramework{system_, "nvmemp"} { + static const FunctionInfo functions[] = { + {0, &NVMEMP::Open, "Open"}, + {1, &NVMEMP::GetAruid, "GetAruid"}, + }; + RegisterHandlers(functions); } NVMEMP::~NVMEMP() = default; diff --git a/src/core/hle/service/nvdrv/nvmemp.h b/src/core/hle/service/nvdrv/nvmemp.h index e98b07c494..6ff59834fe 100644 --- a/src/core/hle/service/nvdrv/nvmemp.h +++ b/src/core/hle/service/nvdrv/nvmemp.h @@ -22,14 +22,6 @@ public: private: void Open(HLERequestContext& ctx); void GetAruid(HLERequestContext& ctx); - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &NVMEMP::Open, "Open"}, - FunctionInfo{1, &NVMEMP::GetAruid, "GetAruid"} - ); }; } // namespace Service::Nvidia diff --git a/src/core/hle/service/nvnflinger/binder.h b/src/core/hle/service/nvnflinger/binder.h index 124accb946..6c7ce0ed0f 100644 --- a/src/core/hle/service/nvnflinger/binder.h +++ b/src/core/hle/service/nvnflinger/binder.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2014 The Android Open Source Project // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/core/hle/service/nvnflinger/buffer_item.h b/src/core/hle/service/nvnflinger/buffer_item.h index 7fd808f546..718188d849 100644 --- a/src/core/hle/service/nvnflinger/buffer_item.h +++ b/src/core/hle/service/nvnflinger/buffer_item.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2014 The Android Open Source Project // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/core/hle/service/nvnflinger/buffer_item_consumer.h b/src/core/hle/service/nvnflinger/buffer_item_consumer.h index 9f95c92800..7857569c0f 100644 --- a/src/core/hle/service/nvnflinger/buffer_item_consumer.h +++ b/src/core/hle/service/nvnflinger/buffer_item_consumer.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2012 The Android Open Source Project // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/core/hle/service/nvnflinger/buffer_queue_consumer.h b/src/core/hle/service/nvnflinger/buffer_queue_consumer.h index a9226f1c35..84f36285c0 100644 --- a/src/core/hle/service/nvnflinger/buffer_queue_consumer.h +++ b/src/core/hle/service/nvnflinger/buffer_queue_consumer.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2014 The Android Open Source Project // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/core/hle/service/nvnflinger/buffer_queue_defs.h b/src/core/hle/service/nvnflinger/buffer_queue_defs.h index 6fd3156f4a..77ebd0a6a0 100644 --- a/src/core/hle/service/nvnflinger/buffer_queue_defs.h +++ b/src/core/hle/service/nvnflinger/buffer_queue_defs.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2014 The Android Open Source Project // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/core/hle/service/nvnflinger/buffer_transform_flags.h b/src/core/hle/service/nvnflinger/buffer_transform_flags.h index ffe579718f..6fb40d0a72 100644 --- a/src/core/hle/service/nvnflinger/buffer_transform_flags.h +++ b/src/core/hle/service/nvnflinger/buffer_transform_flags.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/core/hle/service/nvnflinger/consumer_base.h b/src/core/hle/service/nvnflinger/consumer_base.h index b29c16f86b..e187b520ca 100644 --- a/src/core/hle/service/nvnflinger/consumer_base.h +++ b/src/core/hle/service/nvnflinger/consumer_base.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2010 The Android Open Source Project // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/core/hle/service/nvnflinger/consumer_listener.h b/src/core/hle/service/nvnflinger/consumer_listener.h index 74a1939883..4b4d939551 100644 --- a/src/core/hle/service/nvnflinger/consumer_listener.h +++ b/src/core/hle/service/nvnflinger/consumer_listener.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2014 The Android Open Source Project // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/core/hle/service/nvnflinger/graphic_buffer_producer.cpp b/src/core/hle/service/nvnflinger/graphic_buffer_producer.cpp index d72b49a8e7..5de604233d 100644 --- a/src/core/hle/service/nvnflinger/graphic_buffer_producer.cpp +++ b/src/core/hle/service/nvnflinger/graphic_buffer_producer.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2010 The Android Open Source Project // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/core/hle/service/nvnflinger/graphic_buffer_producer.h b/src/core/hle/service/nvnflinger/graphic_buffer_producer.h index 5d7cff7d38..05980eb482 100644 --- a/src/core/hle/service/nvnflinger/graphic_buffer_producer.h +++ b/src/core/hle/service/nvnflinger/graphic_buffer_producer.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2010 The Android Open Source Project // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/core/hle/service/nvnflinger/hos_binder_driver.cpp b/src/core/hle/service/nvnflinger/hos_binder_driver.cpp index c9023374c4..fa1becc34e 100644 --- a/src/core/hle/service/nvnflinger/hos_binder_driver.cpp +++ b/src/core/hle/service/nvnflinger/hos_binder_driver.cpp @@ -11,21 +11,18 @@ namespace Service::Nvnflinger { -std::optional IHOSBinderDriver::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&IHOSBinderDriver::TransactParcel>, "TransactParcel"}, - FunctionInfo{1, C<&IHOSBinderDriver::AdjustRefcount>, "AdjustRefcount"}, - FunctionInfo{2, C<&IHOSBinderDriver::GetNativeHandle>, "GetNativeHandle"}, - FunctionInfo{3, C<&IHOSBinderDriver::TransactParcelAuto>, "TransactParcelAuto"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IHOSBinderDriver::IHOSBinderDriver(Core::System& system_, std::shared_ptr server, std::shared_ptr surface_flinger) : ServiceFramework{system_, "IHOSBinderDriver"}, m_server(server), m_surface_flinger(surface_flinger) { + static const FunctionInfo functions[] = { + {0, C<&IHOSBinderDriver::TransactParcel>, "TransactParcel"}, + {1, C<&IHOSBinderDriver::AdjustRefcount>, "AdjustRefcount"}, + {2, C<&IHOSBinderDriver::GetNativeHandle>, "GetNativeHandle"}, + {3, C<&IHOSBinderDriver::TransactParcelAuto>, "TransactParcelAuto"}, + }; + RegisterHandlers(functions); } IHOSBinderDriver::~IHOSBinderDriver() = default; diff --git a/src/core/hle/service/nvnflinger/hos_binder_driver.h b/src/core/hle/service/nvnflinger/hos_binder_driver.h index 7d44046115..6b551c91d2 100644 --- a/src/core/hle/service/nvnflinger/hos_binder_driver.h +++ b/src/core/hle/service/nvnflinger/hos_binder_driver.h @@ -44,7 +44,6 @@ private: OutBuffer parcel_reply, u32 flags); private: - std::optional FindRequest(u32 key) override; const std::shared_ptr m_server; const std::shared_ptr m_surface_flinger; }; diff --git a/src/core/hle/service/nvnflinger/nvnflinger.cpp b/src/core/hle/service/nvnflinger/nvnflinger.cpp index 9e3b68b8a0..48862a747d 100644 --- a/src/core/hle/service/nvnflinger/nvnflinger.cpp +++ b/src/core/hle/service/nvnflinger/nvnflinger.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/core/hle/service/nvnflinger/nvnflinger.h b/src/core/hle/service/nvnflinger/nvnflinger.h index 5c41f3013c..2f5465e7ef 100644 --- a/src/core/hle/service/nvnflinger/nvnflinger.h +++ b/src/core/hle/service/nvnflinger/nvnflinger.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/core/hle/service/nvnflinger/parcel.h b/src/core/hle/service/nvnflinger/parcel.h index 4567942016..ed85512792 100644 --- a/src/core/hle/service/nvnflinger/parcel.h +++ b/src/core/hle/service/nvnflinger/parcel.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project diff --git a/src/core/hle/service/nvnflinger/pixel_format.h b/src/core/hle/service/nvnflinger/pixel_format.h index f77d0acfb3..b6e8b5f8a0 100644 --- a/src/core/hle/service/nvnflinger/pixel_format.h +++ b/src/core/hle/service/nvnflinger/pixel_format.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/core/hle/service/nvnflinger/producer_listener.h b/src/core/hle/service/nvnflinger/producer_listener.h index 6bf8aaf1ee..892f6d531d 100644 --- a/src/core/hle/service/nvnflinger/producer_listener.h +++ b/src/core/hle/service/nvnflinger/producer_listener.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2014 The Android Open Source Project // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/core/hle/service/nvnflinger/status.h b/src/core/hle/service/nvnflinger/status.h index 3fa0fe15b9..7b188b42f5 100644 --- a/src/core/hle/service/nvnflinger/status.h +++ b/src/core/hle/service/nvnflinger/status.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/core/hle/service/nvnflinger/ui/graphic_buffer.cpp b/src/core/hle/service/nvnflinger/ui/graphic_buffer.cpp index ede2a11933..5ba7a31cc8 100644 --- a/src/core/hle/service/nvnflinger/ui/graphic_buffer.cpp +++ b/src/core/hle/service/nvnflinger/ui/graphic_buffer.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/core/hle/service/nvnflinger/ui/graphic_buffer.h b/src/core/hle/service/nvnflinger/ui/graphic_buffer.h index da430aa752..099429b3f0 100644 --- a/src/core/hle/service/nvnflinger/ui/graphic_buffer.h +++ b/src/core/hle/service/nvnflinger/ui/graphic_buffer.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2007 The Android Open Source Project // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/core/hle/service/nvnflinger/window.h b/src/core/hle/service/nvnflinger/window.h index 36d6cde3db..78a99f57ae 100644 --- a/src/core/hle/service/nvnflinger/window.h +++ b/src/core/hle/service/nvnflinger/window.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/core/hle/service/olsc/daemon_controller.cpp b/src/core/hle/service/olsc/daemon_controller.cpp index f25888170c..c449c6ff31 100644 --- a/src/core/hle/service/olsc/daemon_controller.cpp +++ b/src/core/hle/service/olsc/daemon_controller.cpp @@ -9,24 +9,26 @@ namespace Service::OLSC { -std::optional IDaemonController::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IDaemonController::GetApplicationAutoTransferSetting>, "GetApplicationAutoTransferSetting"}, - FunctionInfo{1, D<&IDaemonController::SetApplicationAutoTransferSetting>, "SetApplicationAutoTransferSetting"}, - FunctionInfo{2, D<&IDaemonController::GetGlobalAutoUploadSetting>, "GetGlobalAutoUploadSetting"}, - FunctionInfo{3, D<&IDaemonController::SetGlobalAutoUploadSetting>, "SetGlobalAutoUploadSetting"}, - FunctionInfo{4, D<&IDaemonController::RunTransferTaskAutonomyRegistration>, "RunTransferTaskAutonomyRegistration"}, - FunctionInfo{5, D<&IDaemonController::GetGlobalAutoDownloadSetting>, "GetGlobalAutoDownloadSetting", MakeVersionGate({11,0,0})}, - FunctionInfo{6, D<&IDaemonController::SetGlobalAutoDownloadSetting>, "SetGlobalAutoDownloadSetting", MakeVersionGate({11,0,0})}, - FunctionInfo{10, nullptr, "CreateForbiddenSaveDataInidication"}, - FunctionInfo{11, D<&IDaemonController::StopAutonomyTaskExecution>, "StopAutonomyTaskExecution"}, - FunctionInfo{12, D<&IDaemonController::GetAutonomyTaskStatus>, "GetAutonomyTaskStatus"}, - FunctionInfo{13, nullptr, "Unknown13_20_0_0_Plus", MakeVersionGate({20,0,0})} - ); - return HandlerTableGenerateWithFind(key, functions); -} +IDaemonController::IDaemonController(Core::System& system_) + : ServiceFramework{system_, "IDaemonController"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IDaemonController::GetApplicationAutoTransferSetting>, "GetApplicationAutoTransferSetting"}, + {1, D<&IDaemonController::SetApplicationAutoTransferSetting>, "SetApplicationAutoTransferSetting"}, + {2, D<&IDaemonController::GetGlobalAutoUploadSetting>, "GetGlobalAutoUploadSetting"}, + {3, D<&IDaemonController::SetGlobalAutoUploadSetting>, "SetGlobalAutoUploadSetting"}, + {4, D<&IDaemonController::RunTransferTaskAutonomyRegistration>, "RunTransferTaskAutonomyRegistration"}, + {5, D<&IDaemonController::GetGlobalAutoDownloadSetting>, "GetGlobalAutoDownloadSetting"}, // 11.0.0+ + {6, D<&IDaemonController::SetGlobalAutoDownloadSetting>, "SetGlobalAutoDownloadSetting"}, // 11.0.0+ + {10, nullptr, "CreateForbiddenSaveDataInidication"}, + {11, D<&IDaemonController::StopAutonomyTaskExecution>, "StopAutonomyTaskExecution"}, + {12, D<&IDaemonController::GetAutonomyTaskStatus>, "GetAutonomyTaskStatus"}, + {13, nullptr, "Unknown13_20_0_0_Plus"}, // 20.0.0+ + }; + // clang-format on -IDaemonController::IDaemonController(Core::System& system_) : ServiceFramework{system_, "IDaemonController"} {} + RegisterHandlers(functions); +} IDaemonController::~IDaemonController() = default; diff --git a/src/core/hle/service/olsc/daemon_controller.h b/src/core/hle/service/olsc/daemon_controller.h index b90d3ee778..70f3d9e235 100644 --- a/src/core/hle/service/olsc/daemon_controller.h +++ b/src/core/hle/service/olsc/daemon_controller.h @@ -38,8 +38,6 @@ private: Result GetAutonomyTaskStatus(Out out_status, Common::UUID user_id); - std::optional FindRequest(u32 key) override; - // Internal in-memory state to back the above APIs struct AppKey { Common::UUID user_id; diff --git a/src/core/hle/service/olsc/native_handle_holder.cpp b/src/core/hle/service/olsc/native_handle_holder.cpp index 1f6f8419fc..1e50195539 100644 --- a/src/core/hle/service/olsc/native_handle_holder.cpp +++ b/src/core/hle/service/olsc/native_handle_holder.cpp @@ -12,16 +12,16 @@ namespace Service::OLSC { -std::optional INativeHandleHolder::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&INativeHandleHolder::GetNativeHandle>, "GetNativeHandle"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - INativeHandleHolder::INativeHandleHolder(Core::System& system_) : ServiceFramework{system_, "INativeHandleHolder"}, service_context{system_, "OLSC"} { event = service_context.CreateEvent("OLSC::INativeHandleHolder"); + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&INativeHandleHolder::GetNativeHandle>, "GetNativeHandle"}, + }; + // clang-format on + + RegisterHandlers(functions); } INativeHandleHolder::~INativeHandleHolder() { diff --git a/src/core/hle/service/olsc/native_handle_holder.h b/src/core/hle/service/olsc/native_handle_holder.h index 0ab51c7ca0..e0eac50c28 100644 --- a/src/core/hle/service/olsc/native_handle_holder.h +++ b/src/core/hle/service/olsc/native_handle_holder.h @@ -25,7 +25,6 @@ public: private: Result GetNativeHandle(OutCopyHandle out_event); - std::optional FindRequest(u32 key) override; Service::KernelHelpers::ServiceContext service_context; Kernel::KEvent* event{}; diff --git a/src/core/hle/service/olsc/olsc.cpp b/src/core/hle/service/olsc/olsc.cpp index 03b8a696f5..a86c525f9a 100644 --- a/src/core/hle/service/olsc/olsc.cpp +++ b/src/core/hle/service/olsc/olsc.cpp @@ -6,179 +6,22 @@ #include "core/hle/service/olsc/olsc.h" #include "core/hle/service/olsc/olsc_service_for_application.h" -#include "core/hle/service/olsc/native_handle_holder.h" -#include "core/hle/service/olsc/stopper_object.h" -#include "core/hle/service/olsc/daemon_controller.h" -#include "core/hle/service/olsc/transfer_task_list_controller.h" -#include "core/hle/service/olsc/remote_storage_controller.h" +#include "core/hle/service/olsc/olsc_service_for_system_service.h" #include "core/hle/service/server_manager.h" #include "core/hle/service/service.h" -#include "core/hle/service/cmif_serialization.h" namespace Service::OLSC { class ISProfileBgAgentForSystemProcess final : public ServiceFramework { public: - explicit ISProfileBgAgentForSystemProcess(Core::System& system_) : ServiceFramework{system_, "spbg:sp"} {} - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit ISProfileBgAgentForSystemProcess(Core::System& system_) + : ServiceFramework{system_, "spbg:sp"} + { + static const FunctionInfo functions[] = { + { 100, nullptr, "OpenBgAgentController" }, + }; + RegisterHandlers(functions); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{100, nullptr, "OpenBgAgentController" } - ); -}; - -class IDaemonController; -class IRemoteStorageController; -class ITransferTaskListController; - -struct DataTransferPolicy { - u8 upload_policy; - u8 download_policy; -}; - -struct TransferTaskErrorInfo { - Common::UUID uid; - u64 application_id; - u8 unknown_0x18; - std::array reserved_0x19; - u64 unknown_0x20; - u32 error_code; - u32 reserved_0x2C; -}; -static_assert(sizeof(TransferTaskErrorInfo) == 0x30, "TransferTaskErrorInfo has incorrect size."); - -class IOlscServiceForSystemService final : public ServiceFramework { -public: - explicit IOlscServiceForSystemService(Core::System& system_) - : ServiceFramework{system_, "olsc:s"} { - } - - ~IOlscServiceForSystemService() override = default; - - Result GetTransferTaskListController( - Out> out_interface) { - LOG_INFO(Service_OLSC, "called"); - *out_interface = std::make_shared(system); - R_SUCCEED(); - } - - Result GetRemoteStorageController( - Out> out_interface) { - LOG_INFO(Service_OLSC, "called"); - *out_interface = std::make_shared(system); - R_SUCCEED(); - } - - Result GetDaemonController( - Out> out_interface) { - LOG_INFO(Service_OLSC, "called"); - *out_interface = std::make_shared(system); - R_SUCCEED(); - } - - Result GetDataTransferPolicy( - Out out_policy, u64 application_id) { - LOG_WARNING(Service_OLSC, "(STUBBED) called"); - DataTransferPolicy policy{}; - policy.upload_policy = 0; - policy.download_policy = 0; - *out_policy = policy; - R_SUCCEED(); - } - - Result GetTransferTaskErrorInfo(Out out_info, - Common::UUID uuid, u64 application_id) { - LOG_WARNING(Service_OLSC, "(STUBBED) called, uuid={} application_id={:016X}", - uuid.FormattedString(), application_id); - - TransferTaskErrorInfo info{}; - info.uid = uuid; - info.application_id = application_id; - info.unknown_0x18 = 0; - info.reserved_0x19.fill(0); - info.unknown_0x20 = 0; - info.error_code = 0; - info.reserved_0x2C = 0; - - *out_info = info; - R_SUCCEED(); - } - - Result GetOlscServiceForSystemService( - Out> out_interface) { - LOG_INFO(Service_OLSC, "called"); - *out_interface = std::static_pointer_cast(shared_from_this()); - R_SUCCEED(); - } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IOlscServiceForSystemService::GetTransferTaskListController>, "GetTransferTaskListController"}, - FunctionInfo{1, D<&IOlscServiceForSystemService::GetRemoteStorageController>, "GetRemoteStorageController"}, - FunctionInfo{2, D<&IOlscServiceForSystemService::GetDaemonController>, "GetDaemonController"}, - FunctionInfo{10, nullptr, "PrepareDeleteUserProperty"}, - FunctionInfo{11, nullptr, "DeleteUserSaveDataProperty"}, - FunctionInfo{12, nullptr, "InvalidateMountCache"}, - FunctionInfo{13, nullptr, "DeleteDeviceSaveDataProperty"}, - FunctionInfo{100, nullptr, "ListLastTransferTaskErrorInfo"}, - FunctionInfo{101, nullptr, "GetLastErrorInfoCount"}, - FunctionInfo{102, nullptr, "RemoveLastErrorInfoOld"}, - FunctionInfo{103, nullptr, "GetLastErrorInfo"}, - FunctionInfo{104, nullptr, "GetLastErrorEventHolder"}, - FunctionInfo{105, D<&IOlscServiceForSystemService::GetTransferTaskErrorInfo>, "GetTransferTaskErrorInfo"}, - FunctionInfo{200, D<&IOlscServiceForSystemService::GetDataTransferPolicy>, "GetDataTransferPolicy"}, - FunctionInfo{201, nullptr, "DeleteDataTransferPolicyCache"}, - FunctionInfo{202, nullptr, "Unknown202"}, - FunctionInfo{203, nullptr, "RequestUpdateDataTransferPolicyCacheAsync"}, - FunctionInfo{204, nullptr, "ClearDataTransferPolicyCache"}, - FunctionInfo{205, nullptr, "RequestGetDataTransferPolicyAsync"}, - FunctionInfo{206, nullptr, "Unknown206", MakeVersionGate({21,0,0})}, - FunctionInfo{300, nullptr, "GetUserSaveDataProperty"}, - FunctionInfo{301, nullptr, "SetUserSaveDataProperty"}, - FunctionInfo{302, nullptr, "Unknown302", MakeVersionGate({21,0,0})}, - FunctionInfo{400, nullptr, "CleanupSaveDataBackupContextForSpecificApplications"}, - FunctionInfo{900, nullptr, "DeleteAllTransferTask"}, - FunctionInfo{902, nullptr, "DeleteAllSeriesInfo"}, - FunctionInfo{903, nullptr, "DeleteAllSdaInfoCache"}, - FunctionInfo{904, nullptr, "DeleteAllApplicationSetting"}, - FunctionInfo{905, nullptr, "DeleteAllTransferTaskErrorInfo"}, - FunctionInfo{906, nullptr, "RegisterTransferTaskErrorInfo"}, - FunctionInfo{907, nullptr, "AddSaveDataArchiveInfoCache"}, - FunctionInfo{908, nullptr, "DeleteSeriesInfo"}, - FunctionInfo{909, nullptr, "GetSeriesInfo"}, - FunctionInfo{910, nullptr, "RemoveTransferTaskErrorInfo"}, - FunctionInfo{911, nullptr, "DeleteAllSeriesInfoForSaveDataBackup"}, - FunctionInfo{912, nullptr, "DeleteSeriesInfoForSaveDataBackup"}, - FunctionInfo{913, nullptr, "GetSeriesInfoForSaveDataBackup"}, - FunctionInfo{914, nullptr, "Unknown914", MakeVersionGate({20,2,0})}, - FunctionInfo{1000, nullptr, "UpdateIssueOld"}, - FunctionInfo{1010, nullptr, "Unknown1010"}, - FunctionInfo{1011, nullptr, "Unknown1011"}, - FunctionInfo{1012, nullptr, "Unknown1012"}, - FunctionInfo{1013, nullptr, "Unkown1013"}, - FunctionInfo{1014, nullptr, "Unknown1014"}, - FunctionInfo{1020, nullptr, "Unknown1020"}, - FunctionInfo{1021, nullptr, "Unknown1021"}, - FunctionInfo{1022, nullptr, "Unknown1022"}, - FunctionInfo{1023, nullptr, "Unknown1023"}, - FunctionInfo{1024, nullptr, "Unknown1024"}, - FunctionInfo{1100, nullptr, "RepairUpdateIssueInfoCacheAync"}, - FunctionInfo{1110, nullptr, "RepairGetIssueInfo"}, - FunctionInfo{1111, nullptr, "RepairListIssueInfo"}, - FunctionInfo{1112, nullptr, "RepairListOperationPermissionInfo"}, - FunctionInfo{1113, nullptr, "RepairListDataInfoForRepairedSaveDataDownload"}, - FunctionInfo{1114, nullptr, "RepairListDataInfoForOriginalSaveDataDownload"}, - FunctionInfo{1120, nullptr, "RepairUploadSaveDataAsync"}, - FunctionInfo{1121, nullptr, "RepairUploadSaveDataAsync1"}, - FunctionInfo{1122, nullptr, "RepairDownloadRepairedSaveDataAsync"}, - FunctionInfo{1123, nullptr, "RepairDownloadOriginalSaveDataAsync"}, - FunctionInfo{1124, nullptr, "RepairGetOperationProgressInfo"}, - FunctionInfo{10000, D<&IOlscServiceForSystemService::GetOlscServiceForSystemService>, "GetOlscServiceForSystemService"} - ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/olsc/olsc.h b/src/core/hle/service/olsc/olsc.h index 620b634fae..62000529c5 100644 --- a/src/core/hle/service/olsc/olsc.h +++ b/src/core/hle/service/olsc/olsc.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/olsc/olsc_service_for_application.cpp b/src/core/hle/service/olsc/olsc_service_for_application.cpp index 8d6b20d7ff..73d7d4ed64 100644 --- a/src/core/hle/service/olsc/olsc_service_for_application.cpp +++ b/src/core/hle/service/olsc/olsc_service_for_application.cpp @@ -9,36 +9,36 @@ namespace Service::OLSC { -std::optional IOlscServiceForApplication::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IOlscServiceForApplication::Initialize>, "Initialize"}, - FunctionInfo{10, nullptr, "VerifySaveDataBackupLicenseAsync"}, - FunctionInfo{13, D<&IOlscServiceForApplication::GetSaveDataBackupSetting>, "GetSaveDataBackupSetting"}, - FunctionInfo{14, D<&IOlscServiceForApplication::SetSaveDataBackupSettingEnabled>, "SetSaveDataBackupSettingEnabled"}, - FunctionInfo{15, nullptr, "SetCustomData"}, - FunctionInfo{16, nullptr, "DeleteSaveDataBackupSetting"}, - FunctionInfo{18, nullptr, "GetSaveDataBackupInfoCache"}, - FunctionInfo{19, nullptr, "UpdateSaveDataBackupInfoCacheAsync"}, - FunctionInfo{22, nullptr, "DeleteSaveDataBackupAsync"}, - FunctionInfo{25, nullptr, "ListDownloadableSaveDataBackupInfoAsync"}, - FunctionInfo{26, nullptr, "DownloadSaveDataBackupAsync"}, - FunctionInfo{27, nullptr, "UploadSaveDataBackupAsync"}, - FunctionInfo{9010, nullptr, "VerifySaveDataBackupLicenseAsyncForDebug"}, - FunctionInfo{9013, nullptr, "GetSaveDataBackupSettingForDebug"}, - FunctionInfo{9014, nullptr, "SetSaveDataBackupSettingEnabledForDebug"}, - FunctionInfo{9015, nullptr, "SetCustomDataForDebug"}, - FunctionInfo{9016, nullptr, "DeleteSaveDataBackupSettingForDebug"}, - FunctionInfo{9018, nullptr, "GetSaveDataBackupInfoCacheForDebug"}, - FunctionInfo{9019, nullptr, "UpdateSaveDataBackupInfoCacheAsyncForDebug"}, - FunctionInfo{9022, nullptr, "DeleteSaveDataBackupAsyncForDebug"}, - FunctionInfo{9025, nullptr, "ListDownloadableSaveDataBackupInfoAsyncForDebug"}, - FunctionInfo{9026, nullptr, "DownloadSaveDataBackupAsyncForDebug"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IOlscServiceForApplication::IOlscServiceForApplication(Core::System& system_) : ServiceFramework{system_, "olsc:u"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IOlscServiceForApplication::Initialize>, "Initialize"}, + {10, nullptr, "VerifySaveDataBackupLicenseAsync"}, + {13, D<&IOlscServiceForApplication::GetSaveDataBackupSetting>, "GetSaveDataBackupSetting"}, + {14, D<&IOlscServiceForApplication::SetSaveDataBackupSettingEnabled>, "SetSaveDataBackupSettingEnabled"}, + {15, nullptr, "SetCustomData"}, + {16, nullptr, "DeleteSaveDataBackupSetting"}, + {18, nullptr, "GetSaveDataBackupInfoCache"}, + {19, nullptr, "UpdateSaveDataBackupInfoCacheAsync"}, + {22, nullptr, "DeleteSaveDataBackupAsync"}, + {25, nullptr, "ListDownloadableSaveDataBackupInfoAsync"}, + {26, nullptr, "DownloadSaveDataBackupAsync"}, + {27, nullptr, "UploadSaveDataBackupAsync"}, + {9010, nullptr, "VerifySaveDataBackupLicenseAsyncForDebug"}, + {9013, nullptr, "GetSaveDataBackupSettingForDebug"}, + {9014, nullptr, "SetSaveDataBackupSettingEnabledForDebug"}, + {9015, nullptr, "SetCustomDataForDebug"}, + {9016, nullptr, "DeleteSaveDataBackupSettingForDebug"}, + {9018, nullptr, "GetSaveDataBackupInfoCacheForDebug"}, + {9019, nullptr, "UpdateSaveDataBackupInfoCacheAsyncForDebug"}, + {9022, nullptr, "DeleteSaveDataBackupAsyncForDebug"}, + {9025, nullptr, "ListDownloadableSaveDataBackupInfoAsyncForDebug"}, + {9026, nullptr, "DownloadSaveDataBackupAsyncForDebug"}, + }; + // clang-format on + + RegisterHandlers(functions); } IOlscServiceForApplication::~IOlscServiceForApplication() = default; diff --git a/src/core/hle/service/olsc/olsc_service_for_application.h b/src/core/hle/service/olsc/olsc_service_for_application.h index 0d92f9ba78..8941659478 100644 --- a/src/core/hle/service/olsc/olsc_service_for_application.h +++ b/src/core/hle/service/olsc/olsc_service_for_application.h @@ -22,8 +22,6 @@ private: Result GetSaveDataBackupSetting(Out out_save_data_backup_setting); Result SetSaveDataBackupSettingEnabled(bool enabled, NS::Uid account_id); - std::optional FindRequest(u32 key) override; - bool initialized{}; }; diff --git a/src/core/hle/service/olsc/olsc_service_for_system_service.cpp b/src/core/hle/service/olsc/olsc_service_for_system_service.cpp new file mode 100644 index 0000000000..245bbd5c6b --- /dev/null +++ b/src/core/hle/service/olsc/olsc_service_for_system_service.cpp @@ -0,0 +1,144 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/hle/service/cmif_serialization.h" +#include "core/hle/service/olsc/daemon_controller.h" +#include "core/hle/service/olsc/olsc_service_for_system_service.h" +#include "core/hle/service/olsc/remote_storage_controller.h" +#include "core/hle/service/olsc/transfer_task_list_controller.h" + +namespace Service::OLSC { + +IOlscServiceForSystemService::IOlscServiceForSystemService(Core::System& system_) + : ServiceFramework{system_, "olsc:s"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IOlscServiceForSystemService::GetTransferTaskListController>, "GetTransferTaskListController"}, + {1, D<&IOlscServiceForSystemService::GetRemoteStorageController>, "GetRemoteStorageController"}, + {2, D<&IOlscServiceForSystemService::GetDaemonController>, "GetDaemonController"}, + {10, nullptr, "PrepareDeleteUserProperty"}, + {11, nullptr, "DeleteUserSaveDataProperty"}, + {12, nullptr, "InvalidateMountCache"}, + {13, nullptr, "DeleteDeviceSaveDataProperty"}, + {100, nullptr, "ListLastTransferTaskErrorInfo"}, + {101, nullptr, "GetLastErrorInfoCount"}, + {102, nullptr, "RemoveLastErrorInfoOld"}, + {103, nullptr, "GetLastErrorInfo"}, + {104, nullptr, "GetLastErrorEventHolder"}, + {105, D<&IOlscServiceForSystemService::GetTransferTaskErrorInfo>, "GetTransferTaskErrorInfo"}, + {200, D<&IOlscServiceForSystemService::GetDataTransferPolicy>, "GetDataTransferPolicy"}, + {201, nullptr, "DeleteDataTransferPolicyCache"}, + {202, nullptr, "Unknown202"}, + {203, nullptr, "RequestUpdateDataTransferPolicyCacheAsync"}, + {204, nullptr, "ClearDataTransferPolicyCache"}, + {205, nullptr, "RequestGetDataTransferPolicyAsync"}, + {206, nullptr, "Unknown206"}, //21.0.0+ + {300, nullptr, "GetUserSaveDataProperty"}, + {301, nullptr, "SetUserSaveDataProperty"}, + {302, nullptr, "Unknown302"}, //21.0.0+ + {400, nullptr, "CleanupSaveDataBackupContextForSpecificApplications"}, + {900, nullptr, "DeleteAllTransferTask"}, + {902, nullptr, "DeleteAllSeriesInfo"}, + {903, nullptr, "DeleteAllSdaInfoCache"}, + {904, nullptr, "DeleteAllApplicationSetting"}, + {905, nullptr, "DeleteAllTransferTaskErrorInfo"}, + {906, nullptr, "RegisterTransferTaskErrorInfo"}, + {907, nullptr, "AddSaveDataArchiveInfoCache"}, + {908, nullptr, "DeleteSeriesInfo"}, + {909, nullptr, "GetSeriesInfo"}, + {910, nullptr, "RemoveTransferTaskErrorInfo"}, + {911, nullptr, "DeleteAllSeriesInfoForSaveDataBackup"}, + {912, nullptr, "DeleteSeriesInfoForSaveDataBackup"}, + {913, nullptr, "GetSeriesInfoForSaveDataBackup"}, + {914, nullptr, "Unknown914"}, //20.2.0+ + {1000, nullptr, "UpdateIssueOld"}, + {1010, nullptr, "Unknown1010"}, + {1011, nullptr, "Unknown1011"}, + {1012, nullptr, "Unknown1012"}, + {1013, nullptr, "Unkown1013"}, + {1014, nullptr, "Unknown1014"}, + {1020, nullptr, "Unknown1020"}, + {1021, nullptr, "Unknown1021"}, + {1022, nullptr, "Unknown1022"}, + {1023, nullptr, "Unknown1023"}, + {1024, nullptr, "Unknown1024"}, + {1100, nullptr, "RepairUpdateIssueInfoCacheAync"}, + {1110, nullptr, "RepairGetIssueInfo"}, + {1111, nullptr, "RepairListIssueInfo"}, + {1112, nullptr, "RepairListOperationPermissionInfo"}, + {1113, nullptr, "RepairListDataInfoForRepairedSaveDataDownload"}, + {1114, nullptr, "RepairListDataInfoForOriginalSaveDataDownload"}, + {1120, nullptr, "RepairUploadSaveDataAsync"}, + {1121, nullptr, "RepairUploadSaveDataAsync1"}, + {1122, nullptr, "RepairDownloadRepairedSaveDataAsync"}, + {1123, nullptr, "RepairDownloadOriginalSaveDataAsync"}, + {1124, nullptr, "RepairGetOperationProgressInfo"}, + {10000, D<&IOlscServiceForSystemService::GetOlscServiceForSystemService>, "GetOlscServiceForSystemService"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +IOlscServiceForSystemService::~IOlscServiceForSystemService() = default; + +Result IOlscServiceForSystemService::GetTransferTaskListController( + Out> out_interface) { + LOG_INFO(Service_OLSC, "called"); + *out_interface = std::make_shared(system); + R_SUCCEED(); +} + +Result IOlscServiceForSystemService::GetRemoteStorageController( + Out> out_interface) { + LOG_INFO(Service_OLSC, "called"); + *out_interface = std::make_shared(system); + R_SUCCEED(); +} + +Result IOlscServiceForSystemService::GetDaemonController( + Out> out_interface) { + LOG_INFO(Service_OLSC, "called"); + *out_interface = std::make_shared(system); + R_SUCCEED(); +} + +Result IOlscServiceForSystemService::GetDataTransferPolicy( + Out out_policy, u64 application_id) { + LOG_WARNING(Service_OLSC, "(STUBBED) called"); + DataTransferPolicy policy{}; + policy.upload_policy = 0; + policy.download_policy = 0; + *out_policy = policy; + R_SUCCEED(); +} + +Result IOlscServiceForSystemService::GetTransferTaskErrorInfo(Out out_info, + Common::UUID uuid, u64 application_id) { + LOG_WARNING(Service_OLSC, "(STUBBED) called, uuid={} application_id={:016X}", + uuid.FormattedString(), application_id); + + TransferTaskErrorInfo info{}; + info.uid = uuid; + info.application_id = application_id; + info.unknown_0x18 = 0; + info.reserved_0x19.fill(0); + info.unknown_0x20 = 0; + info.error_code = 0; + info.reserved_0x2C = 0; + + *out_info = info; + R_SUCCEED(); +} + +Result IOlscServiceForSystemService::GetOlscServiceForSystemService( + Out> out_interface) { + LOG_INFO(Service_OLSC, "called"); + *out_interface = std::static_pointer_cast(shared_from_this()); + R_SUCCEED(); +} + +} // namespace Service::OLSC diff --git a/src/core/hle/service/olsc/olsc_service_for_system_service.h b/src/core/hle/service/olsc/olsc_service_for_system_service.h new file mode 100644 index 0000000000..d16c8b979b --- /dev/null +++ b/src/core/hle/service/olsc/olsc_service_for_system_service.h @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include + +#include "common/uuid.h" +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/service.h" + +namespace Service::OLSC { + +class IDaemonController; +class IRemoteStorageController; +class ITransferTaskListController; + +struct DataTransferPolicy { + u8 upload_policy; + u8 download_policy; +}; + +struct TransferTaskErrorInfo { + Common::UUID uid; + u64 application_id; + u8 unknown_0x18; + std::array reserved_0x19; + u64 unknown_0x20; + u32 error_code; + u32 reserved_0x2C; +}; +static_assert(sizeof(TransferTaskErrorInfo) == 0x30, "TransferTaskErrorInfo has incorrect size."); + +class IOlscServiceForSystemService final : public ServiceFramework { +public: + explicit IOlscServiceForSystemService(Core::System& system_); + ~IOlscServiceForSystemService() override; + +private: + Result GetTransferTaskListController( + Out> out_interface); + Result GetRemoteStorageController(Out> out_interface); + Result GetDaemonController(Out> out_interface); + Result GetDataTransferPolicy(Out out_policy, u64 application_id); + Result GetTransferTaskErrorInfo(Out out_info, Common::UUID uid, u64 application_id); + Result GetOlscServiceForSystemService( + Out> out_interface); +}; + +} // namespace Service::OLSC diff --git a/src/core/hle/service/olsc/remote_storage_controller.cpp b/src/core/hle/service/olsc/remote_storage_controller.cpp index 1e7825da30..817097b426 100644 --- a/src/core/hle/service/olsc/remote_storage_controller.cpp +++ b/src/core/hle/service/olsc/remote_storage_controller.cpp @@ -9,44 +9,44 @@ namespace Service::OLSC { - std::optional IRemoteStorageController::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetSaveDataArchiveInfoBySaveDataId"}, - FunctionInfo{1, nullptr, "GetSaveDataArchiveInfoByApplicationId"}, - FunctionInfo{3, nullptr, "GetSaveDataArchiveCount"}, - FunctionInfo{6, nullptr, "CleanupSaveDataArchives"}, - FunctionInfo{7, nullptr, "CreateSaveDataArchiveCacheUpdationTask"}, - FunctionInfo{8, nullptr, "CreateSaveDataArchiveCacheUpdationForSpecifiedApplicationTask"}, - FunctionInfo{9, nullptr, "Delete"}, - FunctionInfo{10, nullptr, "GetSeriesInfo"}, - FunctionInfo{11, nullptr, "CreateDeleteDataTask"}, - FunctionInfo{12, nullptr, "DeleteSeriesInfo"}, - FunctionInfo{13, nullptr, "CreateRegisterNotificationTokenTask"}, - FunctionInfo{14, D<&IRemoteStorageController::GetDataNewnessByApplicationId>, "GetDataNewnessByApplicationId"}, - FunctionInfo{15, nullptr, "RegisterUploadSaveDataTransferTaskForAutonomyRegistration"}, - FunctionInfo{16, nullptr, "CreateCleanupToDeleteSaveDataArchiveInfoTask"}, - FunctionInfo{17, nullptr, "ListDataInfo"}, - FunctionInfo{18, D<&IRemoteStorageController::GetDataInfo>, "GetDataInfoV1"}, - FunctionInfo{19, nullptr, "GetDataInfoCacheUpdateNativeHandleHolder"}, - FunctionInfo{20, nullptr, "CreateSaveDataArchiveInfoCacheForSaveDataBackupUpdationTask"}, - FunctionInfo{21, nullptr, "ListSecondarySaves"}, - FunctionInfo{22, D<&IRemoteStorageController::GetSecondarySave>, "GetSecondarySave"}, - FunctionInfo{23, nullptr, "TouchSecondarySave"}, - FunctionInfo{24, nullptr, "GetSecondarySaveDataInfo"}, - FunctionInfo{25, nullptr, "RegisterDownloadSaveDataTransferTaskForAutonomyRegistration"}, - FunctionInfo{26, nullptr, "Unknown26", MakeVersionGate({20,0,0})}, - FunctionInfo{27, D<&IRemoteStorageController::GetDataInfo>, "GetDataInfoV2", MakeVersionGate({20,0,0})}, - FunctionInfo{28, nullptr, "Unknown28", MakeVersionGate({20,0,0})}, - FunctionInfo{29, nullptr, "Unknown29", MakeVersionGate({21,0,0})}, - FunctionInfo{800, nullptr, "Unknown800", MakeVersionGate({20,0,0})}, - FunctionInfo{900, nullptr, "SetLoadedDataMissing"}, - FunctionInfo{901, nullptr, "Unknown901", MakeVersionGate({20,2,0})} - ); - return HandlerTableGenerateWithFind(key, functions); - } - IRemoteStorageController::IRemoteStorageController(Core::System& system_) : ServiceFramework{system_, "IRemoteStorageController"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetSaveDataArchiveInfoBySaveDataId"}, + {1, nullptr, "GetSaveDataArchiveInfoByApplicationId"}, + {3, nullptr, "GetSaveDataArchiveCount"}, + {6, nullptr, "CleanupSaveDataArchives"}, + {7, nullptr, "CreateSaveDataArchiveCacheUpdationTask"}, + {8, nullptr, "CreateSaveDataArchiveCacheUpdationForSpecifiedApplicationTask"}, + {9, nullptr, "Delete"}, + {10, nullptr, "GetSeriesInfo"}, + {11, nullptr, "CreateDeleteDataTask"}, + {12, nullptr, "DeleteSeriesInfo"}, + {13, nullptr, "CreateRegisterNotificationTokenTask"}, + {14, D<&IRemoteStorageController::GetDataNewnessByApplicationId>, "GetDataNewnessByApplicationId"}, + {15, nullptr, "RegisterUploadSaveDataTransferTaskForAutonomyRegistration"}, + {16, nullptr, "CreateCleanupToDeleteSaveDataArchiveInfoTask"}, + {17, nullptr, "ListDataInfo"}, + {18, D<&IRemoteStorageController::GetDataInfo>, "GetDataInfoV1"}, + {19, nullptr, "GetDataInfoCacheUpdateNativeHandleHolder"}, + {20, nullptr, "CreateSaveDataArchiveInfoCacheForSaveDataBackupUpdationTask"}, + {21, nullptr, "ListSecondarySaves"}, + {22, D<&IRemoteStorageController::GetSecondarySave>, "GetSecondarySave"}, + {23, nullptr, "TouchSecondarySave"}, + {24, nullptr, "GetSecondarySaveDataInfo"}, + {25, nullptr, "RegisterDownloadSaveDataTransferTaskForAutonomyRegistration"}, + {26, nullptr, "Unknown26"}, //20.0.0+ + {27, D<&IRemoteStorageController::GetDataInfo>, "GetDataInfoV2"}, //20.0.0+ + {28, nullptr, "Unknown28"}, //20.0.0+ + {29, nullptr, "Unknown29"}, //21.0.0+ + {800, nullptr, "Unknown800"}, //20.0.0+ + {900, nullptr, "SetLoadedDataMissing"}, + {901, nullptr, "Unknown901"}, //20.2.0+ + }; + // clang-format on + + RegisterHandlers(functions); } IRemoteStorageController::~IRemoteStorageController() = default; diff --git a/src/core/hle/service/olsc/remote_storage_controller.h b/src/core/hle/service/olsc/remote_storage_controller.h index 20503d9800..21b439013a 100644 --- a/src/core/hle/service/olsc/remote_storage_controller.h +++ b/src/core/hle/service/olsc/remote_storage_controller.h @@ -21,8 +21,6 @@ private: u64 application_id); Result GetDataNewnessByApplicationId(Out out_newness, u64 application_id); Result GetDataInfo(Out> out_data, u64 application_id); - - std::optional FindRequest(u32 key) override; }; } // namespace Service::OLSC diff --git a/src/core/hle/service/olsc/transfer_task_list_controller.cpp b/src/core/hle/service/olsc/transfer_task_list_controller.cpp index af090fc292..95e41cdb51 100644 --- a/src/core/hle/service/olsc/transfer_task_list_controller.cpp +++ b/src/core/hle/service/olsc/transfer_task_list_controller.cpp @@ -11,45 +11,45 @@ namespace Service::OLSC { - std::optional ITransferTaskListController::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetTransferTaskCountForOcean"}, - FunctionInfo{1, nullptr, "GetTransferTaskInfoForOcean"}, - FunctionInfo{2, nullptr, "ListTransferTaskInfoForOcean"}, - FunctionInfo{3, nullptr, "DeleteTransferTaskForOcean"}, - FunctionInfo{4, nullptr, "RaiseTransferTaskPriorityForOcean"}, - FunctionInfo{5, D<&ITransferTaskListController::GetTransferTaskEndEventNativeHandleHolder>, "GetTransferTaskEndEventNativeHandleHolder"}, - FunctionInfo{6, nullptr, "GetTransferTaskProgressForOcean"}, - FunctionInfo{7, nullptr, "GetTransferTaskLastResultForOcean"}, - FunctionInfo{8, D<&ITransferTaskListController::StopNextTransferTaskExecution>, "StopNextTransferTaskExecution"}, - FunctionInfo{9, D<&ITransferTaskListController::GetTransferTaskStartEventNativeHandleHolder>, "GetTransferTaskStartEventNativeHandleHolder"}, - FunctionInfo{10, nullptr, "SuspendTransferTaskForOcean"}, - FunctionInfo{11, nullptr, "GetCurrentTransferTaskInfoForOcean"}, - FunctionInfo{12, nullptr, "FindTransferTaskInfoForOcean"}, - FunctionInfo{13, nullptr, "CancelCurrentRepairTransferTask"}, - FunctionInfo{14, nullptr, "GetRepairTransferTaskProgress"}, - FunctionInfo{15, nullptr, "EnsureExecutableForRepairTransferTask"}, - FunctionInfo{16, D<&ITransferTaskListController::GetTransferTaskCount>, "GetTransferTaskCount"}, - FunctionInfo{17, nullptr, "GetTransferTaskInfo"}, - FunctionInfo{18, nullptr, "ListTransferTaskInfo"}, - FunctionInfo{19, nullptr, "DeleteTransferTask"}, - FunctionInfo{20, nullptr, "RaiseTransferTaskPriority"}, - FunctionInfo{21, D<&ITransferTaskListController::GetTransferTaskProgress>, "GetTransferTaskProgress", MakeVersionGate({10,1,0})}, - FunctionInfo{22, nullptr, "GetTransferTaskLastResult"}, - FunctionInfo{23, nullptr, "SuspendTransferTask"}, - FunctionInfo{24, D<&ITransferTaskListController::GetCurrentTransferTaskInfo>, "GetCurrentTransferTaskInfo"}, - FunctionInfo{25, D<&ITransferTaskListController::FindTransferTaskInfo>, "FindTransferTaskInfo"}, - FunctionInfo{26, nullptr, "Unknown26", MakeVersionGate({20,1,0})}, - FunctionInfo{27, nullptr, "Unknown27", MakeVersionGate({20,1,0})}, - FunctionInfo{28, nullptr, "Unknown28", MakeVersionGate({20,1,0})}, - FunctionInfo{29, nullptr, "Unknown29", MakeVersionGate({20,1,0})}, - FunctionInfo{30, nullptr, "Unknown30", MakeVersionGate({20,1,0})} - ); - return HandlerTableGenerateWithFind(key, functions); - } - ITransferTaskListController::ITransferTaskListController(Core::System& system_) : ServiceFramework{system_, "ITransferTaskListController"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetTransferTaskCountForOcean"}, + {1, nullptr, "GetTransferTaskInfoForOcean"}, + {2, nullptr, "ListTransferTaskInfoForOcean"}, + {3, nullptr, "DeleteTransferTaskForOcean"}, + {4, nullptr, "RaiseTransferTaskPriorityForOcean"}, + {5, D<&ITransferTaskListController::GetTransferTaskEndEventNativeHandleHolder>, "GetTransferTaskEndEventNativeHandleHolder"}, + {6, nullptr, "GetTransferTaskProgressForOcean"}, + {7, nullptr, "GetTransferTaskLastResultForOcean"}, + {8, D<&ITransferTaskListController::StopNextTransferTaskExecution>, "StopNextTransferTaskExecution"}, + {9, D<&ITransferTaskListController::GetTransferTaskStartEventNativeHandleHolder>, "GetTransferTaskStartEventNativeHandleHolder"}, + {10, nullptr, "SuspendTransferTaskForOcean"}, + {11, nullptr, "GetCurrentTransferTaskInfoForOcean"}, + {12, nullptr, "FindTransferTaskInfoForOcean"}, + {13, nullptr, "CancelCurrentRepairTransferTask"}, + {14, nullptr, "GetRepairTransferTaskProgress"}, + {15, nullptr, "EnsureExecutableForRepairTransferTask"}, + {16, D<&ITransferTaskListController::GetTransferTaskCount>, "GetTransferTaskCount"}, + {17, nullptr, "GetTransferTaskInfo"}, + {18, nullptr, "ListTransferTaskInfo"}, + {19, nullptr, "DeleteTransferTask"}, + {20, nullptr, "RaiseTransferTaskPriority"}, + {21, D<&ITransferTaskListController::GetTransferTaskProgress>, "GetTransferTaskProgress"}, //10.1.0+ + {22, nullptr, "GetTransferTaskLastResult"}, + {23, nullptr, "SuspendTransferTask"}, + {24, D<&ITransferTaskListController::GetCurrentTransferTaskInfo>, "GetCurrentTransferTaskInfo"}, + {25, D<&ITransferTaskListController::FindTransferTaskInfo>, "FindTransferTaskInfo"}, + {26, nullptr, "Unknown26"}, //20.1.0+ + {27, nullptr, "Unknown27"}, //20.1.0+ + {28, nullptr, "Unknown28"}, //20.1.0+ + {29, nullptr, "Unknown29"}, //20.1.0+ + {30, nullptr, "Unknown30"}, //20.1.0+ + }; + // clang-format on + + RegisterHandlers(functions); } ITransferTaskListController::~ITransferTaskListController() = default; diff --git a/src/core/hle/service/olsc/transfer_task_list_controller.h b/src/core/hle/service/olsc/transfer_task_list_controller.h index 74c5eddee3..5f3429879a 100644 --- a/src/core/hle/service/olsc/transfer_task_list_controller.h +++ b/src/core/hle/service/olsc/transfer_task_list_controller.h @@ -27,8 +27,6 @@ private: Result GetTransferTaskProgress(); Result GetCurrentTransferTaskInfo(Out> out_info, u8 unknown); Result FindTransferTaskInfo(Out> out_info, InBuffer in); - - std::optional FindRequest(u32 key) override; }; } // namespace Service::OLSC diff --git a/src/core/hle/service/omm/omm.cpp b/src/core/hle/service/omm/omm.cpp index b95319e26b..cc0b686ab1 100644 --- a/src/core/hle/service/omm/omm.cpp +++ b/src/core/hle/service/omm/omm.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/omm/omm.h b/src/core/hle/service/omm/omm.h index 7bf04688ae..6b100a6d61 100644 --- a/src/core/hle/service/omm/omm.h +++ b/src/core/hle/service/omm/omm.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/omm/operation_mode_manager.cpp b/src/core/hle/service/omm/operation_mode_manager.cpp index e36f606442..1af7714d0d 100644 --- a/src/core/hle/service/omm/operation_mode_manager.cpp +++ b/src/core/hle/service/omm/operation_mode_manager.cpp @@ -10,6 +10,41 @@ namespace Service::OMM { IOperationModeManager::IOperationModeManager(Core::System& system_) : ServiceFramework{system_, "omm"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetOperationMode"}, + {1, nullptr, "GetOperationModeChangeEvent"}, + {2, nullptr, "EnableAudioVisual"}, + {3, nullptr, "DisableAudioVisual"}, + {4, nullptr, "EnterSleepAndWait"}, + {5, nullptr, "GetCradleStatus"}, + {6, nullptr, "FadeInDisplay"}, + {7, nullptr, "FadeOutDisplay"}, + {8, nullptr, "GetCradleFwVersion"}, + {9, nullptr, "NotifyCecSettingsChanged"}, + {10, nullptr, "SetOperationModePolicy"}, + {11, nullptr, "GetDefaultDisplayResolution"}, + {12, nullptr, "GetDefaultDisplayResolutionChangeEvent"}, + {13, nullptr, "UpdateDefaultDisplayResolution"}, + {14, nullptr, "ShouldSleepOnBoot"}, + {15, nullptr, "NotifyHdcpApplicationExecutionStarted"}, + {16, nullptr, "NotifyHdcpApplicationExecutionFinished"}, + {17, nullptr, "NotifyHdcpApplicationDrawingStarted"}, + {18, nullptr, "NotifyHdcpApplicationDrawingFinished"}, + {19, nullptr, "GetHdcpAuthenticationFailedEvent"}, + {20, nullptr, "GetHdcpAuthenticationFailedEmulationEnabled"}, + {21, nullptr, "SetHdcpAuthenticationFailedEmulation"}, + {22, nullptr, "GetHdcpStateChangeEvent"}, + {23, nullptr, "GetHdcpState"}, + {24, nullptr, "ShowCardUpdateProcessing"}, + {25, nullptr, "SetApplicationCecSettingsAndNotifyChanged"}, + {26, nullptr, "GetOperationModeSystemInfo"}, + {27, nullptr, "GetAppletFullAwakingSystemEvent"}, + {28, nullptr, "CreateCradleFirmwareUpdater"}, + }; + // clang-format on + + RegisterHandlers(functions); } IOperationModeManager::~IOperationModeManager() = default; diff --git a/src/core/hle/service/omm/operation_mode_manager.h b/src/core/hle/service/omm/operation_mode_manager.h index ea604c8f60..dd6753757c 100644 --- a/src/core/hle/service/omm/operation_mode_manager.h +++ b/src/core/hle/service/omm/operation_mode_manager.h @@ -18,41 +18,6 @@ class IOperationModeManager final : public ServiceFramework FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetOperationMode"}, - FunctionInfo{1, nullptr, "GetOperationModeChangeEvent"}, - FunctionInfo{2, nullptr, "EnableAudioVisual"}, - FunctionInfo{3, nullptr, "DisableAudioVisual"}, - FunctionInfo{4, nullptr, "EnterSleepAndWait"}, - FunctionInfo{5, nullptr, "GetCradleStatus"}, - FunctionInfo{6, nullptr, "FadeInDisplay"}, - FunctionInfo{7, nullptr, "FadeOutDisplay"}, - FunctionInfo{8, nullptr, "GetCradleFwVersion"}, - FunctionInfo{9, nullptr, "NotifyCecSettingsChanged"}, - FunctionInfo{10, nullptr, "SetOperationModePolicy"}, - FunctionInfo{11, nullptr, "GetDefaultDisplayResolution"}, - FunctionInfo{12, nullptr, "GetDefaultDisplayResolutionChangeEvent"}, - FunctionInfo{13, nullptr, "UpdateDefaultDisplayResolution"}, - FunctionInfo{14, nullptr, "ShouldSleepOnBoot"}, - FunctionInfo{15, nullptr, "NotifyHdcpApplicationExecutionStarted"}, - FunctionInfo{16, nullptr, "NotifyHdcpApplicationExecutionFinished"}, - FunctionInfo{17, nullptr, "NotifyHdcpApplicationDrawingStarted"}, - FunctionInfo{18, nullptr, "NotifyHdcpApplicationDrawingFinished"}, - FunctionInfo{19, nullptr, "GetHdcpAuthenticationFailedEvent"}, - FunctionInfo{20, nullptr, "GetHdcpAuthenticationFailedEmulationEnabled"}, - FunctionInfo{21, nullptr, "SetHdcpAuthenticationFailedEmulation"}, - FunctionInfo{22, nullptr, "GetHdcpStateChangeEvent"}, - FunctionInfo{23, nullptr, "GetHdcpState"}, - FunctionInfo{24, nullptr, "ShowCardUpdateProcessing"}, - FunctionInfo{25, nullptr, "SetApplicationCecSettingsAndNotifyChanged"}, - FunctionInfo{26, nullptr, "GetOperationModeSystemInfo"}, - FunctionInfo{27, nullptr, "GetAppletFullAwakingSystemEvent"}, - FunctionInfo{28, nullptr, "CreateCradleFirmwareUpdater"} - ); }; } // namespace Service::OMM diff --git a/src/core/hle/service/omm/policy_manager_system.cpp b/src/core/hle/service/omm/policy_manager_system.cpp index 1d46de7f3e..b9e8277f8c 100644 --- a/src/core/hle/service/omm/policy_manager_system.cpp +++ b/src/core/hle/service/omm/policy_manager_system.cpp @@ -10,6 +10,18 @@ namespace Service::OMM { IPolicyManagerSystem::IPolicyManagerSystem(Core::System& system_) : ServiceFramework{system_, "idle:sys"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetAutoPowerDownEvent"}, + {1, nullptr, "IsAutoPowerDownRequested"}, + {2, nullptr, "Unknown2"}, + {3, nullptr, "SetHandlingContext"}, + {4, nullptr, "LoadAndApplySettings"}, + {5, nullptr, "ReportUserIsActive"}, + }; + // clang-format on + + RegisterHandlers(functions); } IPolicyManagerSystem::~IPolicyManagerSystem() = default; diff --git a/src/core/hle/service/omm/policy_manager_system.h b/src/core/hle/service/omm/policy_manager_system.h index c6ff451e61..2fb6eb9293 100644 --- a/src/core/hle/service/omm/policy_manager_system.h +++ b/src/core/hle/service/omm/policy_manager_system.h @@ -18,18 +18,6 @@ class IPolicyManagerSystem final : public ServiceFramework public: explicit IPolicyManagerSystem(Core::System& system_); ~IPolicyManagerSystem() override; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetAutoPowerDownEvent"}, - FunctionInfo{1, nullptr, "IsAutoPowerDownRequested"}, - FunctionInfo{2, nullptr, "Unknown2"}, - FunctionInfo{3, nullptr, "SetHandlingContext"}, - FunctionInfo{4, nullptr, "LoadAndApplySettings"}, - FunctionInfo{5, nullptr, "ReportUserIsActive"} - ); }; } // namespace Service::OMM diff --git a/src/core/hle/service/omm/power_state_interface.cpp b/src/core/hle/service/omm/power_state_interface.cpp index 4150882695..04ea75b496 100644 --- a/src/core/hle/service/omm/power_state_interface.cpp +++ b/src/core/hle/service/omm/power_state_interface.cpp @@ -10,6 +10,24 @@ namespace Service::OMM { IPowerStateInterface::IPowerStateInterface(Core::System& system_) : ServiceFramework{system_, "spsm"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetState"}, + {1, nullptr, "EnterSleep"}, + {2, nullptr, "GetLastWakeReason"}, + {3, nullptr, "Shutdown"}, + {4, nullptr, "GetNotificationMessageEventHandle"}, + {5, nullptr, "ReceiveNotificationMessage"}, + {6, nullptr, "AnalyzeLogForLastSleepWakeSequence"}, + {7, nullptr, "ResetEventLog"}, + {8, nullptr, "AnalyzePerformanceLogForLastSleepWakeSequence"}, + {9, nullptr, "ChangeHomeButtonLongPressingTime"}, + {10, nullptr, "PutErrorState"}, + {11, nullptr, "InvalidateCurrentHomeButtonPressing"}, + }; + // clang-format on + + RegisterHandlers(functions); } IPowerStateInterface::~IPowerStateInterface() = default; diff --git a/src/core/hle/service/omm/power_state_interface.h b/src/core/hle/service/omm/power_state_interface.h index fed55a4361..dc1d376a13 100644 --- a/src/core/hle/service/omm/power_state_interface.h +++ b/src/core/hle/service/omm/power_state_interface.h @@ -18,24 +18,6 @@ class IPowerStateInterface final : public ServiceFramework public: explicit IPowerStateInterface(Core::System& system_); ~IPowerStateInterface() override; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetState"}, - FunctionInfo{1, nullptr, "EnterSleep"}, - FunctionInfo{2, nullptr, "GetLastWakeReason"}, - FunctionInfo{3, nullptr, "Shutdown"}, - FunctionInfo{4, nullptr, "GetNotificationMessageEventHandle"}, - FunctionInfo{5, nullptr, "ReceiveNotificationMessage"}, - FunctionInfo{6, nullptr, "AnalyzeLogForLastSleepWakeSequence"}, - FunctionInfo{7, nullptr, "ResetEventLog"}, - FunctionInfo{8, nullptr, "AnalyzePerformanceLogForLastSleepWakeSequence"}, - FunctionInfo{9, nullptr, "ChangeHomeButtonLongPressingTime"}, - FunctionInfo{10, nullptr, "PutErrorState"}, - FunctionInfo{11, nullptr, "InvalidateCurrentHomeButtonPressing"} - ); }; } // namespace Service::OMM diff --git a/src/core/hle/service/os/multi_wait.cpp b/src/core/hle/service/os/multi_wait.cpp index 7b80d28bed..c9bb256ab0 100644 --- a/src/core/hle/service/os/multi_wait.cpp +++ b/src/core/hle/service/os/multi_wait.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/os/multi_wait.h b/src/core/hle/service/os/multi_wait.h index 340c611b5b..c9076c21d7 100644 --- a/src/core/hle/service/os/multi_wait.h +++ b/src/core/hle/service/os/multi_wait.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/os/multi_wait_holder.cpp b/src/core/hle/service/os/multi_wait_holder.cpp index 01efa045b5..f3864218c9 100644 --- a/src/core/hle/service/os/multi_wait_holder.cpp +++ b/src/core/hle/service/os/multi_wait_holder.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/os/multi_wait_holder.h b/src/core/hle/service/os/multi_wait_holder.h index 646395a3f3..3b28ec6b5a 100644 --- a/src/core/hle/service/os/multi_wait_holder.h +++ b/src/core/hle/service/os/multi_wait_holder.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/os/multi_wait_utils.h b/src/core/hle/service/os/multi_wait_utils.h index 96d3a10f37..d8f3ade4c1 100644 --- a/src/core/hle/service/os/multi_wait_utils.h +++ b/src/core/hle/service/os/multi_wait_utils.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/os/mutex.h b/src/core/hle/service/os/mutex.h index 95ac9b117a..8e29bbb633 100644 --- a/src/core/hle/service/os/mutex.h +++ b/src/core/hle/service/os/mutex.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/pcie/pcie.cpp b/src/core/hle/service/pcie/pcie.cpp index f9aaa2d3b8..d162881ecf 100644 --- a/src/core/hle/service/pcie/pcie.cpp +++ b/src/core/hle/service/pcie/pcie.cpp @@ -15,62 +15,64 @@ namespace Service::PCIe { class ISession final : public ServiceFramework { public: - explicit ISession(Core::System& system_) : ServiceFramework{system_, "ISession"} {} + explicit ISession(Core::System& system_) : ServiceFramework{system_, "ISession"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "QueryFunctions"}, + {1, nullptr, "AcquireFunction"}, + {2, nullptr, "ReleaseFunction"}, + {3, nullptr, "GetFunctionState"}, + {4, nullptr, "GetBarProfile"}, + {5, nullptr, "ReadConfig"}, + {6, nullptr, "WriteConfig"}, + {7, nullptr, "ReadBarRegion"}, + {8, nullptr, "WriteBarRegion"}, + {9, nullptr, "FindCapability"}, + {10, nullptr, "FindExtendedCapability"}, + {11, nullptr, "MapDma"}, + {12, nullptr, "UnmapDma"}, + {13, nullptr, "UnmapDmaBusAddress"}, + {14, nullptr, "GetDmaBusAddress"}, + {15, nullptr, "GetDmaBusAddressRange"}, + {16, nullptr, "SetDmaEnable"}, + {17, nullptr, "AcquireIrq"}, + {18, nullptr, "ReleaseIrq"}, + {19, nullptr, "SetIrqEnable"}, + {20, nullptr, "GetIrqEvent"}, + {21, nullptr, "SetAspmEnable"}, + {22, nullptr, "SetResetUponResumeEnable"}, + {23, nullptr, "ResetFunction"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "QueryFunctions"}, - FunctionInfo{1, nullptr, "AcquireFunction"}, - FunctionInfo{2, nullptr, "ReleaseFunction"}, - FunctionInfo{3, nullptr, "GetFunctionState"}, - FunctionInfo{4, nullptr, "GetBarProfile"}, - FunctionInfo{5, nullptr, "ReadConfig"}, - FunctionInfo{6, nullptr, "WriteConfig"}, - FunctionInfo{7, nullptr, "ReadBarRegion"}, - FunctionInfo{8, nullptr, "WriteBarRegion"}, - FunctionInfo{9, nullptr, "FindCapability"}, - FunctionInfo{10, nullptr, "FindExtendedCapability"}, - FunctionInfo{11, nullptr, "MapDma"}, - FunctionInfo{12, nullptr, "UnmapDma"}, - FunctionInfo{13, nullptr, "UnmapDmaBusAddress"}, - FunctionInfo{14, nullptr, "GetDmaBusAddress"}, - FunctionInfo{15, nullptr, "GetDmaBusAddressRange"}, - FunctionInfo{16, nullptr, "SetDmaEnable"}, - FunctionInfo{17, nullptr, "AcquireIrq"}, - FunctionInfo{18, nullptr, "ReleaseIrq"}, - FunctionInfo{19, nullptr, "SetIrqEnable"}, - FunctionInfo{20, nullptr, "GetIrqEvent"}, - FunctionInfo{21, nullptr, "SetAspmEnable"}, - FunctionInfo{22, nullptr, "SetResetUponResumeEnable"}, - FunctionInfo{23, nullptr, "ResetFunction"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; class PCIE final : public ServiceFramework { public: - explicit PCIE(Core::System& system_) : ServiceFramework{system_, "pcie"} {} + explicit PCIE(Core::System& system_) : ServiceFramework{system_, "pcie"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "RegisterClassDriver"}, + {1, nullptr, "QueryFunctionsUnregistered"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "RegisterClassDriver"}, - FunctionInfo{1, nullptr, "QueryFunctionsUnregistered"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; class PCIE_LOG final : public ServiceFramework { public: - explicit PCIE_LOG(Core::System& system_) : ServiceFramework{system_, "pcie:log"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetLoggedState"}, - FunctionInfo{1, nullptr, "GetLoggedStateEvent"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit PCIE_LOG(Core::System& system_) : ServiceFramework{system_, "pcie:log"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetLoggedState"}, + {1, nullptr, "GetLoggedStateEvent"}, + }; + // clang-format on + RegisterHandlers(functions); } }; diff --git a/src/core/hle/service/pcie/pcie.h b/src/core/hle/service/pcie/pcie.h index 5c2d4b805b..cf2048ce65 100644 --- a/src/core/hle/service/pcie/pcie.h +++ b/src/core/hle/service/pcie/pcie.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/pctl/parental_control_service.cpp b/src/core/hle/service/pctl/parental_control_service.cpp new file mode 100644 index 0000000000..51953c2657 --- /dev/null +++ b/src/core/hle/service/pctl/parental_control_service.cpp @@ -0,0 +1,498 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include + +#include "core/core.h" +#include "core/file_sys/control_metadata.h" +#include "core/file_sys/patch_manager.h" +#include "core/hle/service/cmif_serialization.h" +#include "core/hle/service/pctl/parental_control_service.h" +#include "core/hle/service/pctl/pctl_results.h" + +namespace Service::PCTL { + +IParentalControlService::IParentalControlService(Core::System& system_, Capability capability_, + u64 program_id_) + : ServiceFramework{system_, "IParentalControlService"}, capability{capability_}, + program_id{program_id_}, + service_context{system_, "IParentalControlService"}, synchronization_event{service_context}, + unlinked_event{service_context}, request_suspension_event{service_context} { + // clang-format off + static const FunctionInfo functions[] = { + {1, D<&IParentalControlService::Initialize>, "Initialize"}, + {1001, D<&IParentalControlService::CheckFreeCommunicationPermission>, "CheckFreeCommunicationPermission"}, + {1002, D<&IParentalControlService::ConfirmLaunchApplicationPermission>, "ConfirmLaunchApplicationPermission"}, + {1003, D<&IParentalControlService::ConfirmResumeApplicationPermission>, "ConfirmResumeApplicationPermission"}, + {1004, D<&IParentalControlService::ConfirmSnsPostPermission>, "ConfirmSnsPostPermission"}, + {1005, D<&IParentalControlService::ConfirmSystemSettingsPermission>, "ConfirmSystemSettingsPermission"}, + {1006, D<&IParentalControlService::IsRestrictionTemporaryUnlocked>, "IsRestrictionTemporaryUnlocked"}, + {1007, nullptr, "RevertRestrictionTemporaryUnlocked"}, + {1008, nullptr, "EnterRestrictedSystemSettings"}, + {1009, nullptr, "LeaveRestrictedSystemSettings"}, + {1010, D<&IParentalControlService::IsRestrictedSystemSettingsEntered>, "IsRestrictedSystemSettingsEntered"}, + {1011, nullptr, "RevertRestrictedSystemSettingsEntered"}, + {1012, nullptr, "GetRestrictedFeatures"}, + {1013, D<&IParentalControlService::ConfirmStereoVisionPermission>, "ConfirmStereoVisionPermission"}, + {1014, nullptr, "ConfirmPlayableApplicationVideoOld"}, + {1015, nullptr, "ConfirmPlayableApplicationVideo"}, + {1016, nullptr, "ConfirmShowNewsPermission"}, + {1017, D<&IParentalControlService::EndFreeCommunication>, "EndFreeCommunication"}, + {1018, D<&IParentalControlService::IsFreeCommunicationAvailable>, "IsFreeCommunicationAvailable"}, + {1019, D<&IParentalControlService::ConfirmLaunchApplicationPermission>, "ConfirmLaunchApplicationPermission"}, + {1020, nullptr, "ConfirmLaunchSharedApplicationPermission"}, //20.0.0+ + {1021, nullptr, "TryBeginFreeCommunicationForStreamPlay"}, //21.0.0+ + {1022, nullptr, "EndFreeCommunicationForStreamPlay"}, //21.0.0+ + {1031, D<&IParentalControlService::IsRestrictionEnabled>, "IsRestrictionEnabled"}, + {1032, D<&IParentalControlService::GetSafetyLevel>, "GetSafetyLevel"}, + {1033, nullptr, "SetSafetyLevel"}, + {1034, nullptr, "GetSafetyLevelSettings"}, + {1035, D<&IParentalControlService::GetCurrentSettings>, "GetCurrentSettings"}, + {1036, nullptr, "SetCustomSafetyLevelSettings"}, + {1037, nullptr, "GetDefaultRatingOrganization"}, + {1038, nullptr, "SetDefaultRatingOrganization"}, + {1039, D<&IParentalControlService::GetFreeCommunicationApplicationListCount>, "GetFreeCommunicationApplicationListCount"}, + {1042, nullptr, "AddToFreeCommunicationApplicationList"}, + {1043, nullptr, "DeleteSettings"}, + {1044, nullptr, "GetFreeCommunicationApplicationList"}, + {1045, nullptr, "UpdateFreeCommunicationApplicationList"}, + {1046, nullptr, "DisableFeaturesForReset"}, + {1047, nullptr, "NotifyApplicationDownloadStarted"}, + {1048, nullptr, "NotifyNetworkProfileCreated"}, + {1049, nullptr, "ResetFreeCommunicationApplicationList"}, + {1050, nullptr, "AddToFreeCommunicationApplicationList"}, //20.0.0+ + {1051, nullptr, "NotifyApplicationDownloadStarted"}, //20.0.0+ + {1061, D<&IParentalControlService::ConfirmStereoVisionRestrictionConfigurable>, "ConfirmStereoVisionRestrictionConfigurable"}, + {1062, D<&IParentalControlService::GetStereoVisionRestriction>, "GetStereoVisionRestriction"}, + {1063, D<&IParentalControlService::SetStereoVisionRestriction>, "SetStereoVisionRestriction"}, + {1064, D<&IParentalControlService::ResetConfirmedStereoVisionPermission>, "ResetConfirmedStereoVisionPermission"}, + {1065, D<&IParentalControlService::IsStereoVisionPermitted>, "IsStereoVisionPermitted"}, + {1201, nullptr, "UnlockRestrictionTemporarily"}, + {1202, nullptr, "UnlockSystemSettingsRestriction"}, + {1203, nullptr, "SetPinCode"}, + {1204, nullptr, "GenerateInquiryCode"}, + {1205, nullptr, "CheckMasterKey"}, + {1206, D<&IParentalControlService::GetPinCodeLength>, "GetPinCodeLength"}, + {1207, nullptr, "GetPinCodeChangedEvent"}, + {1208, nullptr, "GetPinCode"}, + {1403, D<&IParentalControlService::IsPairingActive>, "IsPairingActive"}, + {1406, nullptr, "GetSettingsLastUpdated"}, + {1411, nullptr, "GetPairingAccountInfo"}, + {1421, nullptr, "GetAccountNickname"}, + {1424, nullptr, "GetAccountState"}, + {1425, nullptr, "RequestPostEvents"}, + {1426, nullptr, "GetPostEventInterval"}, + {1427, nullptr, "SetPostEventInterval"}, + {1432, D<&IParentalControlService::GetSynchronizationEvent>, "GetSynchronizationEvent"}, + {1451, D<&IParentalControlService::StartPlayTimer>, "StartPlayTimer"}, + {1452, D<&IParentalControlService::StopPlayTimer>, "StopPlayTimer"}, + {1453, D<&IParentalControlService::IsPlayTimerEnabled>, "IsPlayTimerEnabled"}, + {1454, D<&IParentalControlService::GetPlayTimerRemainingTime>, "GetPlayTimerRemainingTime"}, + {1455, D<&IParentalControlService::IsRestrictedByPlayTimer>, "IsRestrictedByPlayTimer"}, + {1456, D<&IParentalControlService::GetPlayTimerSettingsOld>, "GetPlayTimerSettingsOld"}, + {1457, D<&IParentalControlService::GetPlayTimerEventToRequestSuspension>, "GetPlayTimerEventToRequestSuspension"}, + {1458, D<&IParentalControlService::IsPlayTimerAlarmDisabled>, "IsPlayTimerAlarmDisabled"}, + {1459, D<&IParentalControlService::GetPlayTimerRemainingTimeDisplayInfo>, "GetPlayTimerRemainingTimeDisplayInfo"}, + {1460, D<&IParentalControlService::Unknown1460>, "Unknown1460"}, + {1471, nullptr, "NotifyWrongPinCodeInputManyTimes"}, + {1472, nullptr, "CancelNetworkRequest"}, + {1473, D<&IParentalControlService::GetUnlinkedEvent>, "GetUnlinkedEvent"}, + {1474, nullptr, "ClearUnlinkedEvent"}, + {1475, nullptr, "GetExtendedPlayTimerEvent"}, // 18.0.0+ + {1601, nullptr, "DisableAllFeatures"}, + {1602, nullptr, "PostEnableAllFeatures"}, + {1603, nullptr, "IsAllFeaturesDisabled"}, + {1901, nullptr, "DeleteFromFreeCommunicationApplicationListForDebug"}, + {1902, nullptr, "ClearFreeCommunicationApplicationListForDebug"}, + {1903, nullptr, "GetExemptApplicationListCountForDebug"}, + {1904, nullptr, "GetExemptApplicationListForDebug"}, + {1905, nullptr, "UpdateExemptApplicationListForDebug"}, + {1906, nullptr, "AddToExemptApplicationListForDebug"}, + {1907, nullptr, "DeleteFromExemptApplicationListForDebug"}, + {1908, nullptr, "ClearExemptApplicationListForDebug"}, + {1941, nullptr, "DeletePairing"}, + {1951, nullptr, "SetPlayTimerSettingsForDebug"}, + {1952, nullptr, "GetPlayTimerSpentTimeForTest"}, + {1953, nullptr, "SetPlayTimerAlarmDisabledForDebug"}, + {1954, nullptr, "IsBedtimeAlarmEnabled"}, // 18.0.0+ + {1955, nullptr, "GetBedtimeAlarmTime"}, // 18.0.0+ + {1956, nullptr, "GetBedtimeAlarmTimeHour"}, // 18.0.0+ + {1957, nullptr, "GetBedtimeAlarmTimeMinute"}, // 18.0.0+ + {2001, nullptr, "RequestPairingAsync"}, + {2002, nullptr, "FinishRequestPairing"}, + {2003, nullptr, "AuthorizePairingAsync"}, + {2004, nullptr, "FinishAuthorizePairing"}, + {2005, nullptr, "RetrievePairingInfoAsync"}, + {2006, nullptr, "FinishRetrievePairingInfo"}, + {2007, nullptr, "UnlinkPairingAsync"}, + {2008, nullptr, "FinishUnlinkPairing"}, + {2009, nullptr, "GetAccountMiiImageAsync"}, + {2010, nullptr, "FinishGetAccountMiiImage"}, + {2011, nullptr, "GetAccountMiiImageContentTypeAsync"}, + {2012, nullptr, "FinishGetAccountMiiImageContentType"}, + {2013, nullptr, "SynchronizeParentalControlSettingsAsync"}, + {2014, nullptr, "FinishSynchronizeParentalControlSettings"}, + {2015, nullptr, "FinishSynchronizeParentalControlSettingsWithLastUpdated"}, + {2016, nullptr, "RequestUpdateExemptionListAsync"}, //5.0.0+ + {145601, D<&IParentalControlService::GetPlayTimerSettings>, "GetPlayTimerSettings"}, // 18.0.0+ + {2017, nullptr, "AuthorizePairingAsync"}, //19.0.0+ + {2019, nullptr, "RequestUpdateDeviceUsersBackground"}, //19.0.0+ + {2021, nullptr, "RequestCopyPairingAsync"}, //20.0.0+ + {2022, nullptr, "FinishRequestCopyPairing"}, //20.0.0+ + {2023, nullptr, "IsFromPairingActiveDevice"}, //20.0.0+ + {2024, nullptr, "RollbackCopyPairing"}, //21.0.0+ + {3001, nullptr, "GetErrorContextChangedEvent"}, //20.0.0+ + {145601, D<&IParentalControlService::GetPlayTimerSettings>, "GetPlayTimerSettings"}, // 18.0.0+ + {195101, D<&IParentalControlService::SetPlayTimerSettings>, "SetPlayTimerSettingsForDebug"}, //18.0.0+ + }; + // clang-format on + RegisterHandlers(functions); +} + +IParentalControlService::~IParentalControlService() = default; + +bool IParentalControlService::CheckFreeCommunicationPermissionImpl() const { + if (states.temporary_unlocked) { + return true; + } + if ((states.application_info.parental_control_flag & 1) == 0) { + return true; + } + if (pin_code[0] == '\0') { + return true; + } + if (!settings.is_free_communication_default_on) { + return true; + } + // TODO(ogniK): Check for blacklisted/exempted applications. Return false can happen here + // but as we don't have multiproceses support yet, we can just assume our application is + // valid for the time being + return true; +} + +bool IParentalControlService::ConfirmStereoVisionPermissionImpl() const { + if (states.temporary_unlocked) { + return true; + } + if (pin_code[0] == '\0') { + return true; + } + if (!settings.is_stero_vision_restricted) { + return false; + } + return true; +} + +void IParentalControlService::SetStereoVisionRestrictionImpl(bool is_restricted) { + if (settings.disabled) { + return; + } + + if (pin_code[0] == '\0') { + return; + } + settings.is_stero_vision_restricted = is_restricted; +} + +Result IParentalControlService::Initialize() { + LOG_DEBUG(Service_PCTL, "called"); + + if (False(capability & (Capability::Application | Capability::System))) { + LOG_ERROR(Service_PCTL, "Invalid capability! capability={:X}", capability); + R_THROW(PCTL::ResultNoCapability); + } + + // TODO(ogniK): Recovery flag initialization for pctl:r + + if (program_id != 0) { + const FileSys::PatchManager pm{program_id, system.GetFileSystemController(), + system.GetContentProvider()}; + const auto control = pm.GetControlMetadata(); + if (control.first) { + states.tid_from_event = 0; + states.launch_time_valid = false; + states.is_suspended = false; + states.free_communication = false; + states.stereo_vision = false; + states.application_info = ApplicationInfo{ + .application_id = program_id, + .age_rating = control.first->GetRatingAge(), + .parental_control_flag = control.first->GetParentalControlFlag(), + .capability = capability, + }; + + if (False(capability & (Capability::System | Capability::Recovery))) { + // TODO(ogniK): Signal application launch event + } + } + } + + R_SUCCEED(); +} + +Result IParentalControlService::CheckFreeCommunicationPermission() { + LOG_DEBUG(Service_PCTL, "called"); + + if (!CheckFreeCommunicationPermissionImpl()) { + R_THROW(PCTL::ResultNoFreeCommunication); + } else { + states.free_communication = true; + R_SUCCEED(); + } +} + +Result IParentalControlService::ConfirmLaunchApplicationPermission( + InBuffer restriction_bitset, u64 nacp_flag, u64 application_id) { + LOG_WARNING(Service_PCTL, "(STUBBED) called, nacp_flag={:#x} application_id={:016X}", nacp_flag, + application_id); + R_SUCCEED(); +} + +Result IParentalControlService::ConfirmResumeApplicationPermission( + InBuffer restriction_bitset, u64 nacp_flag, u64 application_id) { + LOG_WARNING(Service_PCTL, "(STUBBED) called, nacp_flag={:#x} application_id={:016X}", nacp_flag, + application_id); + R_SUCCEED(); +} + +Result IParentalControlService::ConfirmSnsPostPermission() { + LOG_WARNING(Service_PCTL, "(STUBBED) called"); + R_THROW(PCTL::ResultNoFreeCommunication); +} + +Result IParentalControlService::ConfirmSystemSettingsPermission() { + LOG_WARNING(Service_PCTL, "(STUBBED) called"); + R_SUCCEED(); +} + +Result IParentalControlService::IsRestrictionTemporaryUnlocked( + Out out_is_temporary_unlocked) { + *out_is_temporary_unlocked = false; + LOG_WARNING(Service_PCTL, "(STUBBED) called, is_temporary_unlocked={}", + *out_is_temporary_unlocked); + R_SUCCEED(); +} + +Result IParentalControlService::IsRestrictedSystemSettingsEntered( + Out out_is_restricted_system_settings_entered) { + *out_is_restricted_system_settings_entered = false; + LOG_WARNING(Service_PCTL, "(STUBBED) called, is_temporary_unlocked={}", + *out_is_restricted_system_settings_entered); + R_SUCCEED(); +} + +Result IParentalControlService::ConfirmStereoVisionPermission() { + LOG_DEBUG(Service_PCTL, "called"); + states.stereo_vision = true; + R_SUCCEED(); +} + +Result IParentalControlService::EndFreeCommunication() { + LOG_WARNING(Service_PCTL, "(STUBBED) called"); + R_SUCCEED(); +} + +Result IParentalControlService::IsFreeCommunicationAvailable() { + LOG_DEBUG(Service_PCTL, "(STUBBED) called"); + + if (!CheckFreeCommunicationPermissionImpl()) { + R_THROW(PCTL::ResultNoFreeCommunication); + } else { + R_SUCCEED(); + } +} + +Result IParentalControlService::IsRestrictionEnabled(Out out_restriction_enabled) { + LOG_DEBUG(Service_PCTL, "called"); + + if (False(capability & (Capability::Status | Capability::Recovery))) { + LOG_ERROR(Service_PCTL, "Application does not have Status or Recovery capabilities!"); + *out_restriction_enabled = false; + R_THROW(PCTL::ResultNoCapability); + } + + *out_restriction_enabled = pin_code[0] != '\0'; + R_SUCCEED(); +} + +Result IParentalControlService::GetSafetyLevel(Out out_safety_level) { + *out_safety_level = 0; + LOG_WARNING(Service_PCTL, "(STUBBED) called, safety_level={}", *out_safety_level); + R_SUCCEED(); +} + +Result IParentalControlService::GetCurrentSettings(Out out_settings) { + LOG_INFO(Service_PCTL, "called"); + *out_settings = restriction_settings; + R_SUCCEED(); +} + +Result IParentalControlService::GetFreeCommunicationApplicationListCount(Out out_count) { + *out_count = 4; + LOG_WARNING(Service_PCTL, "(STUBBED) called, count={}", *out_count); + R_SUCCEED(); +} + +Result IParentalControlService::ConfirmStereoVisionRestrictionConfigurable() { + LOG_DEBUG(Service_PCTL, "called"); + + if (False(capability & Capability::StereoVision)) { + LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!"); + R_THROW(PCTL::ResultNoCapability); + } + + if (pin_code[0] == '\0') { + R_THROW(PCTL::ResultNoRestrictionEnabled); + } + + R_SUCCEED(); +} + +Result IParentalControlService::IsStereoVisionPermitted(Out out_is_permitted) { + LOG_DEBUG(Service_PCTL, "called"); + + if (!ConfirmStereoVisionPermissionImpl()) { + *out_is_permitted = false; + R_THROW(PCTL::ResultStereoVisionRestricted); + } else { + *out_is_permitted = true; + R_SUCCEED(); + } +} + +Result IParentalControlService::GetPinCodeLength(Out out_length) { + *out_length = 0; + LOG_WARNING(Service_PCTL, "(STUBBED) called, length={}", *out_length); + R_SUCCEED(); +} + +Result IParentalControlService::IsPairingActive(Out out_is_pairing_active) { + *out_is_pairing_active = false; + LOG_WARNING(Service_PCTL, "(STUBBED) called, is_pairing_active={}", *out_is_pairing_active); + R_SUCCEED(); +} + +Result IParentalControlService::GetSynchronizationEvent( + OutCopyHandle out_event) { + LOG_INFO(Service_PCTL, "called"); + *out_event = synchronization_event.GetHandle(); + R_SUCCEED(); +} + +Result IParentalControlService::StartPlayTimer() { + LOG_WARNING(Service_PCTL, "(STUBBED) called"); + R_SUCCEED(); +} + +Result IParentalControlService::StopPlayTimer() { + LOG_WARNING(Service_PCTL, "(STUBBED) called"); + R_SUCCEED(); +} + +Result IParentalControlService::IsPlayTimerEnabled(Out out_is_play_timer_enabled) { + *out_is_play_timer_enabled = false; + LOG_WARNING(Service_PCTL, "(STUBBED) called, enabled={}", *out_is_play_timer_enabled); + R_SUCCEED(); +} + +Result IParentalControlService::GetPlayTimerRemainingTime(Out out_remaining_time) { + LOG_WARNING(Service_PCTL, "(STUBBED) called"); + *out_remaining_time = std::numeric_limits::max(); + R_SUCCEED(); +} + +Result IParentalControlService::IsRestrictedByPlayTimer(Out out_is_restricted_by_play_timer) { + *out_is_restricted_by_play_timer = false; + LOG_WARNING(Service_PCTL, "(STUBBED) called, restricted={}", *out_is_restricted_by_play_timer); + R_SUCCEED(); +} + +Result IParentalControlService::GetPlayTimerSettingsOld( + Out out_play_timer_settings) { + LOG_WARNING(Service_PCTL, "(STUBBED) called"); + *out_play_timer_settings = {}; + R_SUCCEED(); +} + +Result IParentalControlService::GetPlayTimerSettings(Out out_play_timer_settings) { + LOG_WARNING(Service_PCTL, "(STUBBED) called"); + *out_play_timer_settings = raw_play_timer_settings; + R_SUCCEED(); +} + +Result IParentalControlService::SetPlayTimerSettings(PlayTimerSettings play_timer_settings) { + LOG_WARNING(Service_PCTL, "(STUBBED) called"); + raw_play_timer_settings = play_timer_settings; + R_SUCCEED(); +} + +Result IParentalControlService::GetPlayTimerEventToRequestSuspension( + OutCopyHandle out_event) { + LOG_INFO(Service_PCTL, "called"); + *out_event = request_suspension_event.GetHandle(); + R_SUCCEED(); +} + +Result IParentalControlService::IsPlayTimerAlarmDisabled(Out out_play_timer_alarm_disabled) { + *out_play_timer_alarm_disabled = false; + LOG_INFO(Service_PCTL, "called, is_play_timer_alarm_disabled={}", + *out_play_timer_alarm_disabled); + R_SUCCEED(); +} + +Result IParentalControlService::GetPlayTimerRemainingTimeDisplayInfo(Out out_display_info) { + LOG_DEBUG(Service_PCTL, "called"); + *out_display_info = {.state = PlayTimerDisplayState::NotConfigured}; + R_SUCCEED(); +} + +Result IParentalControlService::Unknown1460(u8 in_unk, Out out_display_info) { + LOG_DEBUG(Service_PCTL, "called, in_unk={}", in_unk); + *out_display_info = {.state = PlayTimerDisplayState::NotConfigured}; + R_SUCCEED(); +} + +Result IParentalControlService::GetUnlinkedEvent(OutCopyHandle out_event) { + LOG_INFO(Service_PCTL, "called"); + *out_event = unlinked_event.GetHandle(); + R_SUCCEED(); +} + +Result IParentalControlService::GetStereoVisionRestriction( + Out out_stereo_vision_restriction) { + LOG_DEBUG(Service_PCTL, "called"); + + if (False(capability & Capability::StereoVision)) { + LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!"); + *out_stereo_vision_restriction = false; + R_THROW(PCTL::ResultNoCapability); + } + + *out_stereo_vision_restriction = settings.is_stero_vision_restricted; + R_SUCCEED(); +} + +Result IParentalControlService::SetStereoVisionRestriction(bool stereo_vision_restriction) { + LOG_DEBUG(Service_PCTL, "called, can_use={}", stereo_vision_restriction); + + if (False(capability & Capability::StereoVision)) { + LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!"); + R_THROW(PCTL::ResultNoCapability); + } + + SetStereoVisionRestrictionImpl(stereo_vision_restriction); + R_SUCCEED(); +} + +Result IParentalControlService::ResetConfirmedStereoVisionPermission() { + LOG_DEBUG(Service_PCTL, "called"); + + states.stereo_vision = false; + + R_SUCCEED(); +} + +} // namespace Service::PCTL diff --git a/src/core/hle/service/pctl/parental_control_service.h b/src/core/hle/service/pctl/parental_control_service.h new file mode 100644 index 0000000000..9dabe3d059 --- /dev/null +++ b/src/core/hle/service/pctl/parental_control_service.h @@ -0,0 +1,99 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator +// Project// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/kernel_helpers.h" +#include "core/hle/service/os/event.h" +#include "core/hle/service/pctl/pctl_types.h" +#include "core/hle/service/service.h" + +namespace Service::PCTL { + +class IParentalControlService final : public ServiceFramework { +public: + explicit IParentalControlService(Core::System& system_, Capability capability_, + u64 program_id_); + ~IParentalControlService() override; + +private: + bool CheckFreeCommunicationPermissionImpl() const; + bool ConfirmStereoVisionPermissionImpl() const; + void SetStereoVisionRestrictionImpl(bool is_restricted); + + Result Initialize(); + Result CheckFreeCommunicationPermission(); + Result ConfirmLaunchApplicationPermission(InBuffer restriction_bitset, + u64 nacp_flag, u64 application_id); + Result ConfirmResumeApplicationPermission(InBuffer restriction_bitset, + u64 nacp_flag, u64 application_id); + Result ConfirmSnsPostPermission(); + Result ConfirmSystemSettingsPermission(); + Result IsRestrictionTemporaryUnlocked(Out out_is_temporary_unlocked); + Result IsRestrictedSystemSettingsEntered(Out out_is_restricted_system_settings_entered); + Result ConfirmStereoVisionPermission(); + Result EndFreeCommunication(); + Result IsFreeCommunicationAvailable(); + Result IsRestrictionEnabled(Out out_restriction_enabled); + Result GetSafetyLevel(Out out_safety_level); + Result GetCurrentSettings(Out out_settings); + Result GetFreeCommunicationApplicationListCount(Out out_count); + Result ConfirmStereoVisionRestrictionConfigurable(); + Result IsStereoVisionPermitted(Out out_is_permitted); + Result GetPinCodeLength(Out out_length); + Result IsPairingActive(Out out_is_pairing_active); + Result GetSynchronizationEvent(OutCopyHandle out_event); + Result StartPlayTimer(); + Result StopPlayTimer(); + Result IsPlayTimerEnabled(Out out_is_play_timer_enabled); + Result GetPlayTimerRemainingTime(Out out_remaining_time); + Result IsRestrictedByPlayTimer(Out out_is_restricted_by_play_timer); + Result GetPlayTimerSettingsOld(Out out_play_timer_settings); + Result GetPlayTimerEventToRequestSuspension(OutCopyHandle out_event); + Result IsPlayTimerAlarmDisabled(Out out_play_timer_alarm_disabled); + Result GetPlayTimerRemainingTimeDisplayInfo(Out out_display_info); + Result Unknown1460(u8 in_unk, Out out_display_info); + Result GetUnlinkedEvent(OutCopyHandle out_event); + Result GetStereoVisionRestriction(Out out_stereo_vision_restriction); + Result SetStereoVisionRestriction(bool stereo_vision_restriction); + Result ResetConfirmedStereoVisionPermission(); + Result GetPlayTimerSettings(Out out_play_timer_settings); + Result SetPlayTimerSettings(PlayTimerSettings out_play_timer_settings); + + struct States { + u64 current_tid{}; + ApplicationInfo application_info{}; + u64 tid_from_event{}; + bool launch_time_valid{}; + bool is_suspended{}; + bool temporary_unlocked{}; + bool free_communication{}; + bool stereo_vision{}; + }; + + struct ParentalControlSettings { + bool is_stero_vision_restricted{}; + bool is_free_communication_default_on{}; + bool disabled{}; + }; + + States states{}; + ParentalControlSettings settings{}; + RestrictionSettings restriction_settings{}; + std::array pin_code{}; + Capability capability{}; + u64 program_id{}; + // TODO: this is raw + PlayTimerSettings raw_play_timer_settings{}; + + KernelHelpers::ServiceContext service_context; + Event synchronization_event; + Event unlinked_event; + Event request_suspension_event; +}; + +} // namespace Service::PCTL diff --git a/src/core/hle/service/pctl/parental_control_service_factory.cpp b/src/core/hle/service/pctl/parental_control_service_factory.cpp new file mode 100644 index 0000000000..ae278a9bbc --- /dev/null +++ b/src/core/hle/service/pctl/parental_control_service_factory.cpp @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/core.h" +#include "core/hle/service/cmif_serialization.h" +#include "core/hle/service/pctl/parental_control_service.h" +#include "core/hle/service/pctl/parental_control_service_factory.h" + +namespace Service::PCTL { + +IParentalControlServiceFactory::IParentalControlServiceFactory(Core::System& system_, + const char* name_, + Capability capability_) + : ServiceFramework{system_, name_}, capability{capability_} { + static const FunctionInfo functions[] = { + {0, D<&IParentalControlServiceFactory::CreateService>, "CreateService"}, + {1, D<&IParentalControlServiceFactory::CreateServiceWithoutInitialize>, + "CreateServiceWithoutInitialize"}, + }; + RegisterHandlers(functions); +} + +IParentalControlServiceFactory::~IParentalControlServiceFactory() = default; + +Result IParentalControlServiceFactory::CreateService( + Out> out_service, ClientProcessId process_id) { + LOG_DEBUG(Service_PCTL, "called, process_id={}", process_id.pid); + *out_service = std::make_shared( + system, capability, system.ResolveCallerProgramId(*process_id)); + R_SUCCEED(); +} + +Result IParentalControlServiceFactory::CreateServiceWithoutInitialize( + Out> out_service, ClientProcessId process_id) { + LOG_DEBUG(Service_PCTL, "called, process_id={}", process_id.pid); + *out_service = std::make_shared( + system, capability, system.ResolveCallerProgramId(*process_id)); + R_SUCCEED(); +} + +} // namespace Service::PCTL diff --git a/src/core/hle/service/pctl/parental_control_service_factory.h b/src/core/hle/service/pctl/parental_control_service_factory.h new file mode 100644 index 0000000000..0b5afede82 --- /dev/null +++ b/src/core/hle/service/pctl/parental_control_service_factory.h @@ -0,0 +1,34 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/pctl/pctl_types.h" +#include "core/hle/service/service.h" + +namespace Service::PCTL { + +class IParentalControlService; + +class IParentalControlServiceFactory : public ServiceFramework { +public: + explicit IParentalControlServiceFactory(Core::System& system_, const char* name_, + Capability capability_); + ~IParentalControlServiceFactory() override; + + Result CreateService(Out> out_service, + ClientProcessId process_id); + Result CreateServiceWithoutInitialize(Out> out_service, + ClientProcessId process_id); + +private: + Capability capability{}; +}; + +void LoopProcess(Core::System& system); + +} // namespace Service::PCTL diff --git a/src/core/hle/service/pctl/pctl.cpp b/src/core/hle/service/pctl/pctl.cpp index 4f0fbbe702..37f18a5d58 100644 --- a/src/core/hle/service/pctl/pctl.cpp +++ b/src/core/hle/service/pctl/pctl.cpp @@ -4,636 +4,27 @@ // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "common/common_funcs.h" -#include "core/file_sys/control_metadata.h" -#include "core/file_sys/patch_manager.h" -#include "core/hle/service/cmif_types.h" +#include "core/hle/service/pctl/parental_control_service_factory.h" #include "core/hle/service/pctl/pctl.h" #include "core/hle/service/server_manager.h" -#include "core/hle/service/service.h" -#include "core/hle/service/cmif_serialization.h" namespace Service::PCTL { -constexpr Result ResultNoFreeCommunication{ErrorModule::PCTL, 101}; -constexpr Result ResultStereoVisionRestricted{ErrorModule::PCTL, 104}; -constexpr Result ResultNoCapability{ErrorModule::PCTL, 131}; -constexpr Result ResultNoRestrictionEnabled{ErrorModule::PCTL, 181}; - -enum class Capability : u32 { - None = 0, - Application = 1 << 0, - SnsPost = 1 << 1, - Recovery = 1 << 6, - Status = 1 << 8, - StereoVision = 1 << 9, - System = 1 << 15, -}; -DECLARE_ENUM_FLAG_OPERATORS(Capability); - -struct ApplicationInfo { - u64 application_id{}; - std::array age_rating{}; - u32 parental_control_flag{}; - Capability capability{}; -}; -static_assert(sizeof(ApplicationInfo) == 0x30, "ApplicationInfo has incorrect size."); - -// This is nn::pctl::RestrictionSettings -struct RestrictionSettings { - u8 rating_age; - bool sns_post_restriction; - bool free_communication_restriction; -}; -static_assert(sizeof(RestrictionSettings) == 0x3, "RestrictionSettings has incorrect size."); - -// This is nn::pctl::PlayTimerSettingsOld -struct PlayTimerSettingsOld { - std::array settings; -}; -static_assert(sizeof(PlayTimerSettingsOld) == 0x34, "PlayTimerSettingsOld has incorrect size."); - -// This is nn::pctl::PlayTimerSettings -struct PlayTimerSettings { - std::array settings; //21.0.0+ now takes 0x44 -}; -static_assert(sizeof(PlayTimerSettings) == 0x44, "PlayTimerSettings has incorrect size."); - -enum class PlayTimerDisplayState : u8 { - TimesUp = 0, - BedtimeAlarm = 1, - RemainingTime = 2, - Unknown3 = 3, - Unknown4 = 4, - Unknown5 = 5, - TimerDisabled = 6, - NotConfigured = 7, -}; - -// This is nn::pctl::PlayTimerRemainingTimeDisplayInfo -struct PlayTimerRemainingTimeDisplayInfo { - PlayTimerDisplayState state; - INSERT_PADDING_BYTES(0x7); - u64 unknown_08; - u64 remaining_time; -}; -static_assert(sizeof(PlayTimerRemainingTimeDisplayInfo) == 0x18, "PlayTimerRemainingTimeDisplayInfo has incorrect size."); - -class IParentalControlService final : public ServiceFramework { -public: - explicit IParentalControlService(Core::System& system_, Capability capability_, - u64 program_id_) - : ServiceFramework{system_, "IParentalControlService"}, capability{capability_}, - program_id{program_id_}, - service_context{system_, "IParentalControlService"}, synchronization_event{service_context}, - unlinked_event{service_context}, request_suspension_event{service_context} { - } - - ~IParentalControlService() override = default; - - bool CheckFreeCommunicationPermissionImpl() const { - if (states.temporary_unlocked) { - return true; - } - if ((states.application_info.parental_control_flag & 1) == 0) { - return true; - } - if (pin_code[0] == '\0') { - return true; - } - if (!settings.is_free_communication_default_on) { - return true; - } - // TODO(ogniK): Check for blacklisted/exempted applications. Return false can happen here - // but as we don't have multiproceses support yet, we can just assume our application is - // valid for the time being - return true; - } - - bool ConfirmStereoVisionPermissionImpl() const { - if (states.temporary_unlocked) { - return true; - } - if (pin_code[0] == '\0') { - return true; - } - if (!settings.is_stero_vision_restricted) { - return false; - } - return true; - } - - void SetStereoVisionRestrictionImpl(bool is_restricted) { - if (settings.disabled) { - return; - } - - if (pin_code[0] == '\0') { - return; - } - settings.is_stero_vision_restricted = is_restricted; - } - - Result Initialize() { - LOG_DEBUG(Service_PCTL, "called"); - - if (False(capability & (Capability::Application | Capability::System))) { - LOG_ERROR(Service_PCTL, "Invalid capability! capability={:X}", capability); - R_THROW(PCTL::ResultNoCapability); - } - - // TODO(ogniK): Recovery flag initialization for pctl:r - - if (program_id != 0) { - const FileSys::PatchManager pm{program_id, system.GetFileSystemController(), - system.GetContentProvider()}; - const auto control = pm.GetControlMetadata(); - if (control.first) { - states.tid_from_event = 0; - states.launch_time_valid = false; - states.is_suspended = false; - states.free_communication = false; - states.stereo_vision = false; - states.application_info = ApplicationInfo{ - .application_id = program_id, - .age_rating = control.first->GetRatingAge(), - .parental_control_flag = control.first->GetParentalControlFlag(), - .capability = capability, - }; - - if (False(capability & (Capability::System | Capability::Recovery))) { - // TODO(ogniK): Signal application launch event - } - } - } - - R_SUCCEED(); - } - - Result CheckFreeCommunicationPermission() { - LOG_DEBUG(Service_PCTL, "called"); - - if (!CheckFreeCommunicationPermissionImpl()) { - R_THROW(PCTL::ResultNoFreeCommunication); - } else { - states.free_communication = true; - R_SUCCEED(); - } - } - - Result ConfirmLaunchApplicationPermission( - InBuffer restriction_bitset, u64 nacp_flag, u64 application_id) { - LOG_WARNING(Service_PCTL, "(STUBBED) called, nacp_flag={:#x} application_id={:016X}", nacp_flag, - application_id); - R_SUCCEED(); - } - - Result ConfirmResumeApplicationPermission( - InBuffer restriction_bitset, u64 nacp_flag, u64 application_id) { - LOG_WARNING(Service_PCTL, "(STUBBED) called, nacp_flag={:#x} application_id={:016X}", nacp_flag, - application_id); - R_SUCCEED(); - } - - Result ConfirmSnsPostPermission() { - LOG_WARNING(Service_PCTL, "(STUBBED) called"); - R_THROW(PCTL::ResultNoFreeCommunication); - } - - Result ConfirmSystemSettingsPermission() { - LOG_WARNING(Service_PCTL, "(STUBBED) called"); - R_SUCCEED(); - } - - Result IsRestrictionTemporaryUnlocked( - Out out_is_temporary_unlocked) { - *out_is_temporary_unlocked = false; - LOG_WARNING(Service_PCTL, "(STUBBED) called, is_temporary_unlocked={}", - *out_is_temporary_unlocked); - R_SUCCEED(); - } - - Result IsRestrictedSystemSettingsEntered( - Out out_is_restricted_system_settings_entered) { - *out_is_restricted_system_settings_entered = false; - LOG_WARNING(Service_PCTL, "(STUBBED) called, is_temporary_unlocked={}", - *out_is_restricted_system_settings_entered); - R_SUCCEED(); - } - - Result ConfirmStereoVisionPermission() { - LOG_DEBUG(Service_PCTL, "called"); - states.stereo_vision = true; - R_SUCCEED(); - } - - Result EndFreeCommunication() { - LOG_WARNING(Service_PCTL, "(STUBBED) called"); - R_SUCCEED(); - } - - Result IsFreeCommunicationAvailable() { - LOG_DEBUG(Service_PCTL, "(STUBBED) called"); - - if (!CheckFreeCommunicationPermissionImpl()) { - R_THROW(PCTL::ResultNoFreeCommunication); - } else { - R_SUCCEED(); - } - } - - Result IsRestrictionEnabled(Out out_restriction_enabled) { - LOG_DEBUG(Service_PCTL, "called"); - - if (False(capability & (Capability::Status | Capability::Recovery))) { - LOG_ERROR(Service_PCTL, "Application does not have Status or Recovery capabilities!"); - *out_restriction_enabled = false; - R_THROW(PCTL::ResultNoCapability); - } - - *out_restriction_enabled = pin_code[0] != '\0'; - R_SUCCEED(); - } - - Result GetSafetyLevel(Out out_safety_level) { - *out_safety_level = 0; - LOG_WARNING(Service_PCTL, "(STUBBED) called, safety_level={}", *out_safety_level); - R_SUCCEED(); - } - - Result GetCurrentSettings(Out out_settings) { - LOG_INFO(Service_PCTL, "called"); - *out_settings = restriction_settings; - R_SUCCEED(); - } - - Result GetFreeCommunicationApplicationListCount(Out out_count) { - *out_count = 4; - LOG_WARNING(Service_PCTL, "(STUBBED) called, count={}", *out_count); - R_SUCCEED(); - } - - Result ConfirmStereoVisionRestrictionConfigurable() { - LOG_DEBUG(Service_PCTL, "called"); - - if (False(capability & Capability::StereoVision)) { - LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!"); - R_THROW(PCTL::ResultNoCapability); - } - - if (pin_code[0] == '\0') { - R_THROW(PCTL::ResultNoRestrictionEnabled); - } - - R_SUCCEED(); - } - - Result IsStereoVisionPermitted(Out out_is_permitted) { - LOG_DEBUG(Service_PCTL, "called"); - - if (!ConfirmStereoVisionPermissionImpl()) { - *out_is_permitted = false; - R_THROW(PCTL::ResultStereoVisionRestricted); - } else { - *out_is_permitted = true; - R_SUCCEED(); - } - } - - Result GetPinCodeLength(Out out_length) { - *out_length = 0; - LOG_WARNING(Service_PCTL, "(STUBBED) called, length={}", *out_length); - R_SUCCEED(); - } - - Result IsPairingActive(Out out_is_pairing_active) { - *out_is_pairing_active = false; - LOG_WARNING(Service_PCTL, "(STUBBED) called, is_pairing_active={}", *out_is_pairing_active); - R_SUCCEED(); - } - - Result GetSynchronizationEvent( - OutCopyHandle out_event) { - LOG_INFO(Service_PCTL, "called"); - *out_event = synchronization_event.GetHandle(); - R_SUCCEED(); - } - - Result StartPlayTimer() { - LOG_WARNING(Service_PCTL, "(STUBBED) called"); - R_SUCCEED(); - } - - Result StopPlayTimer() { - LOG_WARNING(Service_PCTL, "(STUBBED) called"); - R_SUCCEED(); - } - - Result IsPlayTimerEnabled(Out out_is_play_timer_enabled) { - *out_is_play_timer_enabled = false; - LOG_WARNING(Service_PCTL, "(STUBBED) called, enabled={}", *out_is_play_timer_enabled); - R_SUCCEED(); - } - - Result GetPlayTimerRemainingTime(Out out_remaining_time) { - LOG_WARNING(Service_PCTL, "(STUBBED) called"); - *out_remaining_time = std::numeric_limits::max(); - R_SUCCEED(); - } - - Result IsRestrictedByPlayTimer(Out out_is_restricted_by_play_timer) { - *out_is_restricted_by_play_timer = false; - LOG_WARNING(Service_PCTL, "(STUBBED) called, restricted={}", *out_is_restricted_by_play_timer); - R_SUCCEED(); - } - - Result GetPlayTimerSettingsOld( - Out out_play_timer_settings) { - LOG_WARNING(Service_PCTL, "(STUBBED) called"); - *out_play_timer_settings = {}; - R_SUCCEED(); - } - - Result GetPlayTimerSettings(Out out_play_timer_settings) { - LOG_WARNING(Service_PCTL, "(STUBBED) called"); - *out_play_timer_settings = raw_play_timer_settings; - R_SUCCEED(); - } - - Result SetPlayTimerSettings(PlayTimerSettings play_timer_settings) { - LOG_WARNING(Service_PCTL, "(STUBBED) called"); - raw_play_timer_settings = play_timer_settings; - R_SUCCEED(); - } - - Result GetPlayTimerEventToRequestSuspension( - OutCopyHandle out_event) { - LOG_INFO(Service_PCTL, "called"); - *out_event = request_suspension_event.GetHandle(); - R_SUCCEED(); - } - - Result IsPlayTimerAlarmDisabled(Out out_play_timer_alarm_disabled) { - *out_play_timer_alarm_disabled = false; - LOG_INFO(Service_PCTL, "called, is_play_timer_alarm_disabled={}", - *out_play_timer_alarm_disabled); - R_SUCCEED(); - } - - Result GetPlayTimerRemainingTimeDisplayInfo(Out out_display_info) { - LOG_DEBUG(Service_PCTL, "called"); - *out_display_info = {.state = PlayTimerDisplayState::NotConfigured}; - R_SUCCEED(); - } - - Result Unknown1460(u8 in_unk, Out out_display_info) { - LOG_DEBUG(Service_PCTL, "called, in_unk={}", in_unk); - *out_display_info = {.state = PlayTimerDisplayState::NotConfigured}; - R_SUCCEED(); - } - - Result GetUnlinkedEvent(OutCopyHandle out_event) { - LOG_INFO(Service_PCTL, "called"); - *out_event = unlinked_event.GetHandle(); - R_SUCCEED(); - } - - Result GetStereoVisionRestriction( - Out out_stereo_vision_restriction) { - LOG_DEBUG(Service_PCTL, "called"); - - if (False(capability & Capability::StereoVision)) { - LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!"); - *out_stereo_vision_restriction = false; - R_THROW(PCTL::ResultNoCapability); - } - - *out_stereo_vision_restriction = settings.is_stero_vision_restricted; - R_SUCCEED(); - } - - Result SetStereoVisionRestriction(bool stereo_vision_restriction) { - LOG_DEBUG(Service_PCTL, "called, can_use={}", stereo_vision_restriction); - - if (False(capability & Capability::StereoVision)) { - LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!"); - R_THROW(PCTL::ResultNoCapability); - } - - SetStereoVisionRestrictionImpl(stereo_vision_restriction); - R_SUCCEED(); - } - - Result ResetConfirmedStereoVisionPermission() { - LOG_DEBUG(Service_PCTL, "called"); - - states.stereo_vision = false; - - R_SUCCEED(); - } - - struct States { - u64 current_tid{}; - ApplicationInfo application_info{}; - u64 tid_from_event{}; - bool launch_time_valid{}; - bool is_suspended{}; - bool temporary_unlocked{}; - bool free_communication{}; - bool stereo_vision{}; - }; - - struct ParentalControlSettings { - bool is_stero_vision_restricted{}; - bool is_free_communication_default_on{}; - bool disabled{}; - }; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{1, D<&IParentalControlService::Initialize>, "Initialize"}, - FunctionInfo{1001, D<&IParentalControlService::CheckFreeCommunicationPermission>, "CheckFreeCommunicationPermission"}, - FunctionInfo{1002, D<&IParentalControlService::ConfirmLaunchApplicationPermission>, "ConfirmLaunchApplicationPermission"}, - FunctionInfo{1003, D<&IParentalControlService::ConfirmResumeApplicationPermission>, "ConfirmResumeApplicationPermission"}, - FunctionInfo{1004, D<&IParentalControlService::ConfirmSnsPostPermission>, "ConfirmSnsPostPermission"}, - FunctionInfo{1005, D<&IParentalControlService::ConfirmSystemSettingsPermission>, "ConfirmSystemSettingsPermission"}, - FunctionInfo{1006, D<&IParentalControlService::IsRestrictionTemporaryUnlocked>, "IsRestrictionTemporaryUnlocked"}, - FunctionInfo{1007, nullptr, "RevertRestrictionTemporaryUnlocked"}, - FunctionInfo{1008, nullptr, "EnterRestrictedSystemSettings"}, - FunctionInfo{1009, nullptr, "LeaveRestrictedSystemSettings"}, - FunctionInfo{1010, D<&IParentalControlService::IsRestrictedSystemSettingsEntered>, "IsRestrictedSystemSettingsEntered"}, - FunctionInfo{1011, nullptr, "RevertRestrictedSystemSettingsEntered"}, - FunctionInfo{1012, nullptr, "GetRestrictedFeatures"}, - FunctionInfo{1013, D<&IParentalControlService::ConfirmStereoVisionPermission>, "ConfirmStereoVisionPermission"}, - FunctionInfo{1014, nullptr, "ConfirmPlayableApplicationVideoOld"}, - FunctionInfo{1015, nullptr, "ConfirmPlayableApplicationVideo"}, - FunctionInfo{1016, nullptr, "ConfirmShowNewsPermission"}, - FunctionInfo{1017, D<&IParentalControlService::EndFreeCommunication>, "EndFreeCommunication"}, - FunctionInfo{1018, D<&IParentalControlService::IsFreeCommunicationAvailable>, "IsFreeCommunicationAvailable"}, - FunctionInfo{1019, D<&IParentalControlService::ConfirmLaunchApplicationPermission>, "ConfirmLaunchApplicationPermission"}, - FunctionInfo{1020, nullptr, "ConfirmLaunchSharedApplicationPermission", MakeVersionGate({20,0,0})}, - FunctionInfo{1021, nullptr, "TryBeginFreeCommunicationForStreamPlay", MakeVersionGate({21,0,0})}, - FunctionInfo{1022, nullptr, "EndFreeCommunicationForStreamPlay", MakeVersionGate({21,0,0})}, - FunctionInfo{1031, D<&IParentalControlService::IsRestrictionEnabled>, "IsRestrictionEnabled"}, - FunctionInfo{1032, D<&IParentalControlService::GetSafetyLevel>, "GetSafetyLevel"}, - FunctionInfo{1033, nullptr, "SetSafetyLevel"}, - FunctionInfo{1034, nullptr, "GetSafetyLevelSettings"}, - FunctionInfo{1035, D<&IParentalControlService::GetCurrentSettings>, "GetCurrentSettings"}, - FunctionInfo{1036, nullptr, "SetCustomSafetyLevelSettings"}, - FunctionInfo{1037, nullptr, "GetDefaultRatingOrganization"}, - FunctionInfo{1038, nullptr, "SetDefaultRatingOrganization"}, - FunctionInfo{1039, D<&IParentalControlService::GetFreeCommunicationApplicationListCount>, "GetFreeCommunicationApplicationListCount"}, - FunctionInfo{1042, nullptr, "AddToFreeCommunicationApplicationList"}, - FunctionInfo{1043, nullptr, "DeleteSettings"}, - FunctionInfo{1044, nullptr, "GetFreeCommunicationApplicationList"}, - FunctionInfo{1045, nullptr, "UpdateFreeCommunicationApplicationList"}, - FunctionInfo{1046, nullptr, "DisableFeaturesForReset"}, - FunctionInfo{1047, nullptr, "NotifyApplicationDownloadStarted"}, - FunctionInfo{1048, nullptr, "NotifyNetworkProfileCreated"}, - FunctionInfo{1049, nullptr, "ResetFreeCommunicationApplicationList"}, - FunctionInfo{1050, nullptr, "AddToFreeCommunicationApplicationList", MakeVersionGate({20,0,0})}, - FunctionInfo{1051, nullptr, "NotifyApplicationDownloadStarted", MakeVersionGate({20,0,0})}, - FunctionInfo{1061, D<&IParentalControlService::ConfirmStereoVisionRestrictionConfigurable>, "ConfirmStereoVisionRestrictionConfigurable"}, - FunctionInfo{1062, D<&IParentalControlService::GetStereoVisionRestriction>, "GetStereoVisionRestriction"}, - FunctionInfo{1063, D<&IParentalControlService::SetStereoVisionRestriction>, "SetStereoVisionRestriction"}, - FunctionInfo{1064, D<&IParentalControlService::ResetConfirmedStereoVisionPermission>, "ResetConfirmedStereoVisionPermission"}, - FunctionInfo{1065, D<&IParentalControlService::IsStereoVisionPermitted>, "IsStereoVisionPermitted"}, - FunctionInfo{1201, nullptr, "UnlockRestrictionTemporarily"}, - FunctionInfo{1202, nullptr, "UnlockSystemSettingsRestriction"}, - FunctionInfo{1203, nullptr, "SetPinCode"}, - FunctionInfo{1204, nullptr, "GenerateInquiryCode"}, - FunctionInfo{1205, nullptr, "CheckMasterKey"}, - FunctionInfo{1206, D<&IParentalControlService::GetPinCodeLength>, "GetPinCodeLength"}, - FunctionInfo{1207, nullptr, "GetPinCodeChangedEvent"}, - FunctionInfo{1208, nullptr, "GetPinCode"}, - FunctionInfo{1403, D<&IParentalControlService::IsPairingActive>, "IsPairingActive"}, - FunctionInfo{1406, nullptr, "GetSettingsLastUpdated"}, - FunctionInfo{1411, nullptr, "GetPairingAccountInfo"}, - FunctionInfo{1421, nullptr, "GetAccountNickname"}, - FunctionInfo{1424, nullptr, "GetAccountState"}, - FunctionInfo{1425, nullptr, "RequestPostEvents"}, - FunctionInfo{1426, nullptr, "GetPostEventInterval"}, - FunctionInfo{1427, nullptr, "SetPostEventInterval"}, - FunctionInfo{1432, D<&IParentalControlService::GetSynchronizationEvent>, "GetSynchronizationEvent"}, - FunctionInfo{1451, D<&IParentalControlService::StartPlayTimer>, "StartPlayTimer"}, - FunctionInfo{1452, D<&IParentalControlService::StopPlayTimer>, "StopPlayTimer"}, - FunctionInfo{1453, D<&IParentalControlService::IsPlayTimerEnabled>, "IsPlayTimerEnabled"}, - FunctionInfo{1454, D<&IParentalControlService::GetPlayTimerRemainingTime>, "GetPlayTimerRemainingTime"}, - FunctionInfo{1455, D<&IParentalControlService::IsRestrictedByPlayTimer>, "IsRestrictedByPlayTimer"}, - FunctionInfo{1456, D<&IParentalControlService::GetPlayTimerSettingsOld>, "GetPlayTimerSettingsOld"}, - FunctionInfo{1457, D<&IParentalControlService::GetPlayTimerEventToRequestSuspension>, "GetPlayTimerEventToRequestSuspension"}, - FunctionInfo{1458, D<&IParentalControlService::IsPlayTimerAlarmDisabled>, "IsPlayTimerAlarmDisabled"}, - FunctionInfo{1459, D<&IParentalControlService::GetPlayTimerRemainingTimeDisplayInfo>, "GetPlayTimerRemainingTimeDisplayInfo"}, - FunctionInfo{1460, D<&IParentalControlService::Unknown1460>, "Unknown1460"}, - FunctionInfo{1471, nullptr, "NotifyWrongPinCodeInputManyTimes"}, - FunctionInfo{1472, nullptr, "CancelNetworkRequest"}, - FunctionInfo{1473, D<&IParentalControlService::GetUnlinkedEvent>, "GetUnlinkedEvent"}, - FunctionInfo{1474, nullptr, "ClearUnlinkedEvent"}, - FunctionInfo{1475, nullptr, "GetExtendedPlayTimerEvent", MakeVersionGate({18,0,0})}, - FunctionInfo{1601, nullptr, "DisableAllFeatures"}, - FunctionInfo{1602, nullptr, "PostEnableAllFeatures"}, - FunctionInfo{1603, nullptr, "IsAllFeaturesDisabled"}, - FunctionInfo{1901, nullptr, "DeleteFromFreeCommunicationApplicationListForDebug"}, - FunctionInfo{1902, nullptr, "ClearFreeCommunicationApplicationListForDebug"}, - FunctionInfo{1903, nullptr, "GetExemptApplicationListCountForDebug"}, - FunctionInfo{1904, nullptr, "GetExemptApplicationListForDebug"}, - FunctionInfo{1905, nullptr, "UpdateExemptApplicationListForDebug"}, - FunctionInfo{1906, nullptr, "AddToExemptApplicationListForDebug"}, - FunctionInfo{1907, nullptr, "DeleteFromExemptApplicationListForDebug"}, - FunctionInfo{1908, nullptr, "ClearExemptApplicationListForDebug"}, - FunctionInfo{1941, nullptr, "DeletePairing"}, - FunctionInfo{1951, nullptr, "SetPlayTimerSettingsForDebug"}, - FunctionInfo{1952, nullptr, "GetPlayTimerSpentTimeForTest"}, - FunctionInfo{1953, nullptr, "SetPlayTimerAlarmDisabledForDebug"}, - FunctionInfo{1954, nullptr, "IsBedtimeAlarmEnabled", MakeVersionGate({18,0,0})}, - FunctionInfo{1955, nullptr, "GetBedtimeAlarmTime", MakeVersionGate({18,0,0})}, - FunctionInfo{1956, nullptr, "GetBedtimeAlarmTimeHour", MakeVersionGate({18,0,0})}, - FunctionInfo{1957, nullptr, "GetBedtimeAlarmTimeMinute", MakeVersionGate({18,0,0})}, - FunctionInfo{2001, nullptr, "RequestPairingAsync"}, - FunctionInfo{2002, nullptr, "FinishRequestPairing"}, - FunctionInfo{2003, nullptr, "AuthorizePairingAsync"}, - FunctionInfo{2004, nullptr, "FinishAuthorizePairing"}, - FunctionInfo{2005, nullptr, "RetrievePairingInfoAsync"}, - FunctionInfo{2006, nullptr, "FinishRetrievePairingInfo"}, - FunctionInfo{2007, nullptr, "UnlinkPairingAsync"}, - FunctionInfo{2008, nullptr, "FinishUnlinkPairing"}, - FunctionInfo{2009, nullptr, "GetAccountMiiImageAsync"}, - FunctionInfo{2010, nullptr, "FinishGetAccountMiiImage"}, - FunctionInfo{2011, nullptr, "GetAccountMiiImageContentTypeAsync"}, - FunctionInfo{2012, nullptr, "FinishGetAccountMiiImageContentType"}, - FunctionInfo{2013, nullptr, "SynchronizeParentalControlSettingsAsync"}, - FunctionInfo{2014, nullptr, "FinishSynchronizeParentalControlSettings"}, - FunctionInfo{2015, nullptr, "FinishSynchronizeParentalControlSettingsWithLastUpdated"}, - FunctionInfo{2016, nullptr, "RequestUpdateExemptionListAsync", MakeVersionGate({5,0,0})}, - FunctionInfo{145601, D<&IParentalControlService::GetPlayTimerSettings>, "GetPlayTimerSettings", MakeVersionGate({18,0,0})}, - FunctionInfo{2017, nullptr, "AuthorizePairingAsync", MakeVersionGate({19,0,0})}, - FunctionInfo{2019, nullptr, "RequestUpdateDeviceUsersBackground", MakeVersionGate({19,0,0})}, - FunctionInfo{2021, nullptr, "RequestCopyPairingAsync", MakeVersionGate({20,0,0})}, - FunctionInfo{2022, nullptr, "FinishRequestCopyPairing", MakeVersionGate({20,0,0})}, - FunctionInfo{2023, nullptr, "IsFromPairingActiveDevice", MakeVersionGate({20,0,0})}, - FunctionInfo{2024, nullptr, "RollbackCopyPairing", MakeVersionGate({21,0,0})}, - FunctionInfo{3001, nullptr, "GetErrorContextChangedEvent", MakeVersionGate({20,0,0})}, - FunctionInfo{145601, D<&IParentalControlService::GetPlayTimerSettings>, "GetPlayTimerSettings", MakeVersionGate({18,0,0})}, - FunctionInfo{195101, D<&IParentalControlService::SetPlayTimerSettings>, "SetPlayTimerSettingsForDebug", MakeVersionGate({18,0,0})} - ); - States states{}; - ParentalControlSettings settings{}; - RestrictionSettings restriction_settings{}; - std::array pin_code{}; - Capability capability{}; - u64 program_id{}; - // TODO: this is raw - PlayTimerSettings raw_play_timer_settings{}; - - KernelHelpers::ServiceContext service_context; - Event synchronization_event; - Event unlinked_event; - Event request_suspension_event; -}; - -class IParentalControlServiceFactory : public ServiceFramework { -public: - explicit IParentalControlServiceFactory(Core::System& system_, const char* name_, Capability capability_) - : ServiceFramework{system_, name_}, capability{capability_} - {} - - ~IParentalControlServiceFactory() override = default; - - Result CreateService(Out> out_service, ClientProcessId process_id) { - LOG_DEBUG(Service_PCTL, "called, process_id={}", process_id.pid); - *out_service = std::make_shared( - system, capability, system.ResolveCallerProgramId(*process_id)); - R_SUCCEED(); - } - - Result CreateServiceWithoutInitialize(Out> out_service, ClientProcessId process_id) { - LOG_DEBUG(Service_PCTL, "called, process_id={}", process_id.pid); - *out_service = std::make_shared( - system, capability, system.ResolveCallerProgramId(*process_id)); - R_SUCCEED(); - } - -private: - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IParentalControlServiceFactory::CreateService>, "CreateService"}, - FunctionInfo{1, D<&IParentalControlServiceFactory::CreateServiceWithoutInitialize>, "CreateServiceWithoutInitialize"} - ); - Capability capability{}; -}; - void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); - server_manager->RegisterNamedService("pctl", std::make_shared(system, "pctl", Capability::Application | Capability::SnsPost | Capability::Status | Capability::StereoVision)); + server_manager->RegisterNamedService("pctl", + std::make_shared( + system, "pctl", + Capability::Application | Capability::SnsPost | + Capability::Status | Capability::StereoVision)); // TODO(ogniK): Implement remaining capabilities - server_manager->RegisterNamedService("pctl:a", std::make_shared(system, "pctl:a", Capability::None)); - server_manager->RegisterNamedService("pctl:r", std::make_shared(system, "pctl:r", Capability::None)); - server_manager->RegisterNamedService("pctl:s", std::make_shared(system, "pctl:s", Capability::None)); + server_manager->RegisterNamedService("pctl:a", std::make_shared( + system, "pctl:a", Capability::None)); + server_manager->RegisterNamedService("pctl:r", std::make_shared( + system, "pctl:r", Capability::None)); + server_manager->RegisterNamedService("pctl:s", std::make_shared( + system, "pctl:s", Capability::None)); ServerManager::RunServer(std::move(server_manager)); } diff --git a/src/core/hle/service/pctl/pctl.h b/src/core/hle/service/pctl/pctl.h index 5f9d03d4df..020866aa3d 100644 --- a/src/core/hle/service/pctl/pctl.h +++ b/src/core/hle/service/pctl/pctl.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/pctl/pctl_results.h b/src/core/hle/service/pctl/pctl_results.h new file mode 100644 index 0000000000..0aa4714a9c --- /dev/null +++ b/src/core/hle/service/pctl/pctl_results.h @@ -0,0 +1,18 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/result.h" + +namespace Service::PCTL { + +constexpr Result ResultNoFreeCommunication{ErrorModule::PCTL, 101}; +constexpr Result ResultStereoVisionRestricted{ErrorModule::PCTL, 104}; +constexpr Result ResultNoCapability{ErrorModule::PCTL, 131}; +constexpr Result ResultNoRestrictionEnabled{ErrorModule::PCTL, 181}; + +} // namespace Service::PCTL diff --git a/src/core/hle/service/pctl/pctl_types.h b/src/core/hle/service/pctl/pctl_types.h new file mode 100644 index 0000000000..3a5a19099d --- /dev/null +++ b/src/core/hle/service/pctl/pctl_types.h @@ -0,0 +1,73 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "common/common_funcs.h" + +namespace Service::PCTL { + +enum class Capability : u32 { + None = 0, + Application = 1 << 0, + SnsPost = 1 << 1, + Recovery = 1 << 6, + Status = 1 << 8, + StereoVision = 1 << 9, + System = 1 << 15, +}; +DECLARE_ENUM_FLAG_OPERATORS(Capability); + +struct ApplicationInfo { + u64 application_id{}; + std::array age_rating{}; + u32 parental_control_flag{}; + Capability capability{}; +}; +static_assert(sizeof(ApplicationInfo) == 0x30, "ApplicationInfo has incorrect size."); + +// This is nn::pctl::RestrictionSettings +struct RestrictionSettings { + u8 rating_age; + bool sns_post_restriction; + bool free_communication_restriction; +}; +static_assert(sizeof(RestrictionSettings) == 0x3, "RestrictionSettings has incorrect size."); + +// This is nn::pctl::PlayTimerSettingsOld +struct PlayTimerSettingsOld { + std::array settings; +}; +static_assert(sizeof(PlayTimerSettingsOld) == 0x34, "PlayTimerSettingsOld has incorrect size."); + +// This is nn::pctl::PlayTimerSettings +struct PlayTimerSettings { + std::array settings; //21.0.0+ now takes 0x44 +}; +static_assert(sizeof(PlayTimerSettings) == 0x44, "PlayTimerSettings has incorrect size."); + +enum class PlayTimerDisplayState : u8 { + TimesUp = 0, + BedtimeAlarm = 1, + RemainingTime = 2, + Unknown3 = 3, + Unknown4 = 4, + Unknown5 = 5, + TimerDisabled = 6, + NotConfigured = 7, +}; + +// This is nn::pctl::PlayTimerRemainingTimeDisplayInfo +struct PlayTimerRemainingTimeDisplayInfo { + PlayTimerDisplayState state; + INSERT_PADDING_BYTES(0x7); + u64 unknown_08; + u64 remaining_time; +}; +static_assert(sizeof(PlayTimerRemainingTimeDisplayInfo) == 0x18, + "PlayTimerRemainingTimeDisplayInfo has incorrect size."); + +} // namespace Service::PCTL diff --git a/src/core/hle/service/pcv/pcv.cpp b/src/core/hle/service/pcv/pcv.cpp index bb3d748527..1b314f3518 100644 --- a/src/core/hle/service/pcv/pcv.cpp +++ b/src/core/hle/service/pcv/pcv.cpp @@ -15,76 +15,91 @@ namespace Service::PCV { class PCV final : public ServiceFramework { public: - explicit PCV(Core::System& system_) : ServiceFramework{system_, "pcv"} {} + explicit PCV(Core::System& system_) : ServiceFramework{system_, "pcv"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "SetPowerEnabled"}, + {1, nullptr, "SetClockEnabled"}, + {2, nullptr, "SetClockRate"}, + {3, nullptr, "GetClockRate"}, + {4, nullptr, "GetState"}, + {5, nullptr, "GetPossibleClockRates"}, + {6, nullptr, "SetMinVClockRate"}, + {7, nullptr, "SetReset"}, + {8, nullptr, "SetVoltageEnabled"}, + {9, nullptr, "GetVoltageEnabled"}, + {10, nullptr, "GetVoltageRange"}, + {11, nullptr, "SetVoltageValue"}, + {12, nullptr, "GetVoltageValue"}, + {13, nullptr, "GetTemperatureThresholds"}, + {14, nullptr, "SetTemperature"}, + {15, nullptr, "Initialize"}, + {16, nullptr, "IsInitialized"}, + {17, nullptr, "Finalize"}, + {18, nullptr, "PowerOn"}, + {19, nullptr, "PowerOff"}, + {20, nullptr, "ChangeVoltage"}, + {21, nullptr, "GetPowerClockInfoEvent"}, + {22, nullptr, "GetOscillatorClock"}, + {23, nullptr, "GetDvfsTable"}, + {24, nullptr, "GetModuleStateTable"}, + {25, nullptr, "GetPowerDomainStateTable"}, + {26, nullptr, "GetFuseInfo"}, + {27, nullptr, "GetDramId"}, + {28, nullptr, "IsPoweredOn"}, + {29, nullptr, "GetVoltage"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "SetPowerEnabled"}, - FunctionInfo{1, nullptr, "SetClockEnabled"}, - FunctionInfo{2, nullptr, "SetClockRate"}, - FunctionInfo{3, nullptr, "GetClockRate"}, - FunctionInfo{4, nullptr, "GetState"}, - FunctionInfo{5, nullptr, "GetPossibleClockRates"}, - FunctionInfo{6, nullptr, "SetMinVClockRate"}, - FunctionInfo{7, nullptr, "SetReset"}, - FunctionInfo{8, nullptr, "SetVoltageEnabled"}, - FunctionInfo{9, nullptr, "GetVoltageEnabled"}, - FunctionInfo{10, nullptr, "GetVoltageRange"}, - FunctionInfo{11, nullptr, "SetVoltageValue"}, - FunctionInfo{12, nullptr, "GetVoltageValue"}, - FunctionInfo{13, nullptr, "GetTemperatureThresholds"}, - FunctionInfo{14, nullptr, "SetTemperature"}, - FunctionInfo{15, nullptr, "Initialize"}, - FunctionInfo{16, nullptr, "IsInitialized"}, - FunctionInfo{17, nullptr, "Finalize"}, - FunctionInfo{18, nullptr, "PowerOn"}, - FunctionInfo{19, nullptr, "PowerOff"}, - FunctionInfo{20, nullptr, "ChangeVoltage"}, - FunctionInfo{21, nullptr, "GetPowerClockInfoEvent"}, - FunctionInfo{22, nullptr, "GetOscillatorClock"}, - FunctionInfo{23, nullptr, "GetDvfsTable"}, - FunctionInfo{24, nullptr, "GetModuleStateTable"}, - FunctionInfo{25, nullptr, "GetPowerDomainStateTable"}, - FunctionInfo{26, nullptr, "GetFuseInfo"}, - FunctionInfo{27, nullptr, "GetDramId"}, - FunctionInfo{28, nullptr, "IsPoweredOn"}, - FunctionInfo{29, nullptr, "GetVoltage"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; class PCV_ARB final : public ServiceFramework { public: - explicit PCV_ARB(Core::System& system_) : ServiceFramework{system_, "pcv:arb"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "ReleaseControl"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit PCV_ARB(Core::System& system_) : ServiceFramework{system_, "pcv:arb"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "ReleaseControl"}, + }; + // clang-format on + RegisterHandlers(functions); } }; class PCV_IMM final : public ServiceFramework { public: - explicit PCV_IMM(Core::System& system_) : ServiceFramework{system_, "pcv:imm"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "SetClockRate"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit PCV_IMM(Core::System& system_) : ServiceFramework{system_, "pcv:imm"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "SetClockRate"}, + }; + // clang-format on + RegisterHandlers(functions); } }; class IClkrstSession final : public ServiceFramework { public: explicit IClkrstSession(Core::System& system_, DeviceCode device_code_) - : ServiceFramework{system_, "IClkrstSession"}, device_code(device_code_) {} - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + : ServiceFramework{system_, "IClkrstSession"}, device_code(device_code_) { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "SetClockEnabled"}, + {1, nullptr, "SetClockDisabled"}, + {2, nullptr, "SetResetAsserted"}, + {3, nullptr, "SetResetDeasserted"}, + {4, nullptr, "SetPowerEnabled"}, + {5, nullptr, "SetPowerDisabled"}, + {6, nullptr, "GetState"}, + {7, &IClkrstSession::SetClockRate, "SetClockRate"}, + {8, &IClkrstSession::GetClockRate, "GetClockRate"}, + {9, nullptr, "SetMinVClockRate"}, + {10, nullptr, "GetPossibleClockRates"}, + {11, nullptr, "GetDvfsTable"}, + }; + // clang-format on + RegisterHandlers(functions); } private: @@ -105,30 +120,25 @@ private: rb.Push(clock_rate); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "SetClockEnabled"}, - FunctionInfo{1, nullptr, "SetClockDisabled"}, - FunctionInfo{2, nullptr, "SetResetAsserted"}, - FunctionInfo{3, nullptr, "SetResetDeasserted"}, - FunctionInfo{4, nullptr, "SetPowerEnabled"}, - FunctionInfo{5, nullptr, "SetPowerDisabled"}, - FunctionInfo{6, nullptr, "GetState"}, - FunctionInfo{7, &IClkrstSession::SetClockRate, "SetClockRate"}, - FunctionInfo{8, &IClkrstSession::GetClockRate, "GetClockRate"}, - FunctionInfo{9, nullptr, "SetMinVClockRate"}, - FunctionInfo{10, nullptr, "GetPossibleClockRates"}, - FunctionInfo{11, nullptr, "GetDvfsTable"} - ); DeviceCode device_code; u32 clock_rate{}; }; class CLKRST final : public ServiceFramework { public: - explicit CLKRST(Core::System& system_, const char* name) : ServiceFramework{system_, name} {} + explicit CLKRST(Core::System& system_, const char* name) : ServiceFramework{system_, name} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &CLKRST::OpenSession, "OpenSession"}, + {1, nullptr, "GetTemperatureThresholds"}, + {2, nullptr, "SetTemperature"}, + {3, nullptr, "GetModuleStateTable"}, + {4, nullptr, "GetModuleStateTableEvent"}, + {5, nullptr, "GetModuleStateTableMaxCount"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -143,26 +153,18 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system, device_code); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &CLKRST::OpenSession, "OpenSession"}, - FunctionInfo{1, nullptr, "GetTemperatureThresholds"}, - FunctionInfo{2, nullptr, "SetTemperature"}, - FunctionInfo{3, nullptr, "GetModuleStateTable"}, - FunctionInfo{4, nullptr, "GetModuleStateTableEvent"}, - FunctionInfo{5, nullptr, "GetModuleStateTableMaxCount"} - ); }; class CLKRST_A final : public ServiceFramework { public: - explicit CLKRST_A(Core::System& system_) : ServiceFramework{system_, "clkrst:a"} {} + explicit CLKRST_A(Core::System& system_) : ServiceFramework{system_, "clkrst:a"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "ReleaseControl"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "ReleaseControl"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; diff --git a/src/core/hle/service/pcv/pcv.h b/src/core/hle/service/pcv/pcv.h index bf541e6feb..27eb179ff4 100644 --- a/src/core/hle/service/pcv/pcv.h +++ b/src/core/hle/service/pcv/pcv.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/pm/pm.cpp b/src/core/hle/service/pm/pm.cpp index 3d431c305f..ff7053b690 100644 --- a/src/core/hle/service/pm/pm.cpp +++ b/src/core/hle/service/pm/pm.cpp @@ -47,7 +47,13 @@ void GetApplicationPidGeneric(Kernel::KernelCore& kernel, HLERequestContext& ctx class BootMode final : public ServiceFramework { public: - explicit BootMode(Core::System& system_) : ServiceFramework{system_, "pm:bm"} {} + explicit BootMode(Core::System& system_) : ServiceFramework{system_, "pm:bm"} { + static const FunctionInfo functions[] = { + {0, &BootMode::GetBootMode, "GetBootMode"}, + {1, &BootMode::SetMaintenanceBoot, "SetMaintenanceBoot"}, + }; + RegisterHandlers(functions); + } private: void GetBootMode(HLERequestContext& ctx) { @@ -67,19 +73,28 @@ private: rb.Push(ResultSuccess); } - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &BootMode::GetBootMode, "GetBootMode"}, - FunctionInfo{1, &BootMode::SetMaintenanceBoot, "SetMaintenanceBoot"} - ); SystemBootMode boot_mode = SystemBootMode::Normal; }; class DebugMonitor final : public ServiceFramework { public: - explicit DebugMonitor(Core::System& system_) : ServiceFramework{system_, "pm:dmnt"} {} + explicit DebugMonitor(Core::System& system_) : ServiceFramework{system_, "pm:dmnt"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetJitDebugProcessIdList"}, + {1, nullptr, "StartProcess"}, + {2, &DebugMonitor::GetProcessId, "GetProcessId"}, + {3, nullptr, "HookToCreateProcess"}, + {4, &DebugMonitor::GetApplicationProcessId, "GetApplicationProcessId"}, + {5, nullptr, "HookToCreateApplicationProgress"}, + {6, nullptr, "ClearHook"}, + {65000, &DebugMonitor::AtmosphereGetProcessInfo, "AtmosphereGetProcessInfo"}, + {65001, nullptr, "AtmosphereGetCurrentLimitInfo"}, + }; + // clang-format on + + RegisterHandlers(functions); + } private: void GetProcessId(HLERequestContext& ctx) { @@ -149,26 +164,19 @@ private: rb.PushRaw(program_location); rb.PushRaw(override_status); } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetJitDebugProcessIdList"}, - FunctionInfo{1, nullptr, "StartProcess"}, - FunctionInfo{2, &DebugMonitor::GetProcessId, "GetProcessId"}, - FunctionInfo{3, nullptr, "HookToCreateProcess"}, - FunctionInfo{4, &DebugMonitor::GetApplicationProcessId, "GetApplicationProcessId"}, - FunctionInfo{5, nullptr, "HookToCreateApplicationProgress"}, - FunctionInfo{6, nullptr, "ClearHook"}, - FunctionInfo{65000, &DebugMonitor::AtmosphereGetProcessInfo, "AtmosphereGetProcessInfo"}, - FunctionInfo{65001, nullptr, "AtmosphereGetCurrentLimitInfo"} - ); }; class Info final : public ServiceFramework { public: - explicit Info(Core::System& system_) : ServiceFramework{system_, "pm:info"} {} + explicit Info(Core::System& system_) : ServiceFramework{system_, "pm:info"} { + static const FunctionInfo functions[] = { + {0, &Info::GetProgramId, "GetProgramId"}, + {65000, &Info::AtmosphereGetProcessId, "AtmosphereGetProcessId"}, + {65001, nullptr, "AtmosphereHasLaunchedProgram"}, + {65002, nullptr, "AtmosphereGetProcessInfo"}, + }; + RegisterHandlers(functions); + } private: void GetProgramId(HLERequestContext& ctx) { @@ -210,24 +218,27 @@ private: rb.Push(ResultSuccess); rb.Push(process->GetProcessId()); } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &Info::GetProgramId, "GetProgramId"}, - FunctionInfo{65000, &Info::AtmosphereGetProcessId, "AtmosphereGetProcessId"}, - FunctionInfo{65001, nullptr, "AtmosphereHasLaunchedProgram"}, - FunctionInfo{65002, nullptr, "AtmosphereGetProcessInfo"} - ); }; class Shell final : public ServiceFramework { public: - explicit Shell(Core::System& system_) : ServiceFramework{system_, "pm:shell"} {} + explicit Shell(Core::System& system_) : ServiceFramework{system_, "pm:shell"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "LaunchProgram"}, + {1, nullptr, "TerminateProcess"}, + {2, nullptr, "TerminateProgram"}, + {3, nullptr, "GetProcessEventHandle"}, + {4, nullptr, "GetProcessEventInfo"}, + {5, nullptr, "NotifyBootFinished"}, + {6, &Shell::GetApplicationProcessIdForShell, "GetApplicationProcessIdForShell"}, + {7, nullptr, "BoostSystemMemoryResourceLimit"}, + {8, nullptr, "BoostApplicationThreadResourceLimit"}, + {9, nullptr, "GetBootFinishedEventHandle"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -236,19 +247,6 @@ private: auto list = kernel.GetProcessList(); GetApplicationPidGeneric(system.Kernel(), ctx, list); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "LaunchProgram"}, - FunctionInfo{1, nullptr, "TerminateProcess"}, - FunctionInfo{2, nullptr, "TerminateProgram"}, - FunctionInfo{3, nullptr, "GetProcessEventHandle"}, - FunctionInfo{4, nullptr, "GetProcessEventInfo"}, - FunctionInfo{5, nullptr, "NotifyBootFinished"}, - FunctionInfo{6, &Shell::GetApplicationProcessIdForShell, "GetApplicationProcessIdForShell"}, - FunctionInfo{7, nullptr, "BoostSystemMemoryResourceLimit"}, - FunctionInfo{8, nullptr, "BoostApplicationThreadResourceLimit"}, - FunctionInfo{9, nullptr, "GetBootFinishedEventHandle"} - ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/pm/pm.h b/src/core/hle/service/pm/pm.h index 5d4a1a171c..da70cfc6b8 100644 --- a/src/core/hle/service/pm/pm.h +++ b/src/core/hle/service/pm/pm.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/prepo/prepo.cpp b/src/core/hle/service/prepo/prepo.cpp index a199c41d2c..e76c3ea93c 100644 --- a/src/core/hle/service/prepo/prepo.cpp +++ b/src/core/hle/service/prepo/prepo.cpp @@ -21,10 +21,45 @@ namespace Service::PlayReport { class PlayReport final : public ServiceFramework { public: - explicit PlayReport(const char* name, Core::System& system_) : ServiceFramework{system_, name} {} + explicit PlayReport(const char* name, Core::System& system_) : ServiceFramework{system_, name} { + // clang-format off + static const FunctionInfo functions[] = { + {10100, &PlayReport::SaveReport, "SaveReportOld"}, + {10101, &PlayReport::SaveReportWithUser, "SaveReportWithUserOld"}, + {10102, &PlayReport::SaveReport, "SaveReportOld2"}, + {10103, &PlayReport::SaveReportWithUser, "SaveReportWithUserOld2"}, + {10104, &PlayReport::SaveReport, "SaveReportOld3"}, + {10105, &PlayReport::SaveReportWithUser, "SaveReportWithUserOld3"}, + {10106, &PlayReport::SaveReport, "SaveReport"}, + {10107, &PlayReport::SaveReportWithUser, "SaveReportWithUser"}, + {10200, &PlayReport::RequestImmediateTransmission, "RequestImmediateTransmission"}, + {10300, &PlayReport::GetTransmissionStatus, "GetTransmissionStatus"}, + {10400, &PlayReport::GetSystemSessionId, "GetSystemSessionId"}, + {20100, &PlayReport::SaveSystemReportOld, "SaveSystemReport"}, + {20101, &PlayReport::SaveSystemReportWithUserOld, "SaveSystemReportWithUser"}, + {20102, &PlayReport::SaveSystemReport, "SaveSystemReport"}, + {20103, &PlayReport::SaveSystemReportWithUser, "SaveSystemReportWithUser"}, + {20200, nullptr, "SetOperationMode"}, + {30100, nullptr, "ClearStorage"}, + {30200, nullptr, "ClearStatistics"}, + {30300, nullptr, "GetStorageUsage"}, + {30400, nullptr, "GetStatistics"}, + {30401, nullptr, "GetThroughputHistory"}, + {30500, nullptr, "GetLastUploadError"}, + {30600, nullptr, "GetApplicationUploadSummary"}, + {40100, nullptr, "IsUserAgreementCheckEnabled"}, + {40101, nullptr, "SetUserAgreementCheckEnabled"}, + {50100, nullptr, "ReadAllApplicationReportFiles"}, + {90100, nullptr, "ReadAllReportFiles"}, + {90101, nullptr, "Unknown90101"}, + {90102, nullptr, "Unknown90102"}, + {90200, nullptr, "GetStatistics"}, + {90201, nullptr, "GetThroughputHistory"}, + {90300, nullptr, "GetLastUploadError"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -179,51 +214,21 @@ private: IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{10100, &PlayReport::SaveReport, "SaveReportOld"}, - FunctionInfo{10101, &PlayReport::SaveReportWithUser, "SaveReportWithUserOld"}, - FunctionInfo{10102, &PlayReport::SaveReport, "SaveReportOld2"}, - FunctionInfo{10103, &PlayReport::SaveReportWithUser, "SaveReportWithUserOld2"}, - FunctionInfo{10104, &PlayReport::SaveReport, "SaveReportOld3"}, - FunctionInfo{10105, &PlayReport::SaveReportWithUser, "SaveReportWithUserOld3"}, - FunctionInfo{10106, &PlayReport::SaveReport, "SaveReport"}, - FunctionInfo{10107, &PlayReport::SaveReportWithUser, "SaveReportWithUser"}, - FunctionInfo{10200, &PlayReport::RequestImmediateTransmission, "RequestImmediateTransmission"}, - FunctionInfo{10300, &PlayReport::GetTransmissionStatus, "GetTransmissionStatus"}, - FunctionInfo{10400, &PlayReport::GetSystemSessionId, "GetSystemSessionId"}, - FunctionInfo{20100, &PlayReport::SaveSystemReportOld, "SaveSystemReport"}, - FunctionInfo{20101, &PlayReport::SaveSystemReportWithUserOld, "SaveSystemReportWithUser"}, - FunctionInfo{20102, &PlayReport::SaveSystemReport, "SaveSystemReport"}, - FunctionInfo{20103, &PlayReport::SaveSystemReportWithUser, "SaveSystemReportWithUser"}, - FunctionInfo{20200, nullptr, "SetOperationMode"}, - FunctionInfo{30100, nullptr, "ClearStorage"}, - FunctionInfo{30200, nullptr, "ClearStatistics"}, - FunctionInfo{30300, nullptr, "GetStorageUsage"}, - FunctionInfo{30400, nullptr, "GetStatistics"}, - FunctionInfo{30401, nullptr, "GetThroughputHistory"}, - FunctionInfo{30500, nullptr, "GetLastUploadError"}, - FunctionInfo{30600, nullptr, "GetApplicationUploadSummary"}, - FunctionInfo{40100, nullptr, "IsUserAgreementCheckEnabled"}, - FunctionInfo{40101, nullptr, "SetUserAgreementCheckEnabled"}, - FunctionInfo{50100, nullptr, "ReadAllApplicationReportFiles"}, - FunctionInfo{90100, nullptr, "ReadAllReportFiles"}, - FunctionInfo{90101, nullptr, "Unknown90101"}, - FunctionInfo{90102, nullptr, "Unknown90102"}, - FunctionInfo{90200, nullptr, "GetStatistics"}, - FunctionInfo{90201, nullptr, "GetThroughputHistory"}, - FunctionInfo{90300, nullptr, "GetLastUploadError"} - ); }; void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); - server_manager->RegisterNamedService("prepo:a", std::make_shared("prepo:a", system)); - server_manager->RegisterNamedService("prepo:a2", std::make_shared("prepo:a2", system)); - server_manager->RegisterNamedService("prepo:m", std::make_shared("prepo:m", system)); - server_manager->RegisterNamedService("prepo:s", std::make_shared("prepo:s", system)); - server_manager->RegisterNamedService("prepo:u", std::make_shared("prepo:u", system)); + server_manager->RegisterNamedService("prepo:a", + std::make_shared("prepo:a", system)); + server_manager->RegisterNamedService("prepo:a2", + std::make_shared("prepo:a2", system)); + server_manager->RegisterNamedService("prepo:m", + std::make_shared("prepo:m", system)); + server_manager->RegisterNamedService("prepo:s", + std::make_shared("prepo:s", system)); + server_manager->RegisterNamedService("prepo:u", + std::make_shared("prepo:u", system)); ServerManager::RunServer(std::move(server_manager)); } diff --git a/src/core/hle/service/prepo/prepo.h b/src/core/hle/service/prepo/prepo.h index 2c2462f936..4caf752888 100644 --- a/src/core/hle/service/prepo/prepo.h +++ b/src/core/hle/service/prepo/prepo.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/psc/ovln/ovln_types.h b/src/core/hle/service/psc/ovln/ovln_types.h index f96b52fb49..d827f039fe 100644 --- a/src/core/hle/service/psc/ovln/ovln_types.h +++ b/src/core/hle/service/psc/ovln/ovln_types.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project diff --git a/src/core/hle/service/psc/ovln/receiver.cpp b/src/core/hle/service/psc/ovln/receiver.cpp new file mode 100644 index 0000000000..f43d705126 --- /dev/null +++ b/src/core/hle/service/psc/ovln/receiver.cpp @@ -0,0 +1,118 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/hle/service/psc/ovln/receiver.h" +#include "core/hle/service/cmif_serialization.h" + +namespace Service::PSC { + +IReceiver::IReceiver(Core::System& system_) + : ServiceFramework{system_, "IReceiver"}, service_context{system_, "IReceiver"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IReceiver::AddSource>, "AddSource"}, + {1, D<&IReceiver::RemoveSource>, "RemoveSource"}, + {2, D<&IReceiver::GetReceiveEventHandle>, "GetReceiveEventHandle"}, + {3, D<&IReceiver::Receive>, "Receive"}, + {4, D<&IReceiver::ReceiveWithTick>, "ReceiveWithTick"}, + }; + // clang-format on + + RegisterHandlers(functions); + + receive_event = service_context.CreateEvent("IReceiver::ReceiveEvent"); +} + +IReceiver::~IReceiver() { + service_context.CloseEvent(receive_event); +} + +Result IReceiver::AddSource(SourceName source_name) { + const std::string name = source_name.GetString(); + LOG_INFO(Service_PSC, "called: source_name={}", name); + + // Add source if it doesn't already exist + if (message_sources.find(name) == message_sources.end()) { + message_sources[name] = {}; + } + + R_SUCCEED(); +} + +Result IReceiver::RemoveSource(SourceName source_name) { + const std::string name = source_name.GetString(); + LOG_INFO(Service_PSC, "called: source_name={}", name); + + // Remove source if it exists + message_sources.erase(name); + + R_SUCCEED(); +} + +Result IReceiver::GetReceiveEventHandle(OutCopyHandle out_event) { + LOG_INFO(Service_PSC, "called"); + *out_event = &receive_event->GetReadableEvent(); + R_SUCCEED(); +} + +Result IReceiver::Receive(Out out_notification, Out out_flags) { + u64 tick; + return ReceiveWithTick(out_notification, out_flags, Out(&tick)); +} + +Result IReceiver::ReceiveWithTick(Out out_notification, + Out out_flags, Out out_tick) { + LOG_DEBUG(Service_PSC, "called"); + + // Find the message with the lowest ID across all sources + const std::string* target_source = nullptr; + size_t target_index = 0; + + for (const auto& [source_name, messages] : message_sources) { + if (!messages.empty()) { + if (target_source == nullptr) { + target_source = &source_name; + target_index = 0; + } + // Note: In the real implementation, we would track message IDs + // For now, just use FIFO order + } + } + + if (target_source != nullptr) { + auto& messages = message_sources[*target_source]; + *out_notification = messages[target_index].first; + *out_flags = messages[target_index].second; + *out_tick = 0; // TODO: Implement tick tracking + + // Remove the message + messages.erase(messages.begin() + target_index); + + // Clear event if no more messages + bool has_messages = false; + for (const auto& [_, msgs] : message_sources) { + if (!msgs.empty()) { + has_messages = true; + break; + } + } + if (!has_messages) { + receive_event->Clear(system.Kernel()); + } + + R_SUCCEED(); + } + + // No messages available + *out_notification = {}; + *out_flags = {}; + *out_tick = 0; + + LOG_WARNING(Service_PSC, "No messages available"); + R_THROW(ResultUnknown); // TODO: Use proper OvlnResult::NoMessages when available +} + +} // namespace Service::PSC diff --git a/src/core/hle/service/psc/ovln/receiver.h b/src/core/hle/service/psc/ovln/receiver.h new file mode 100644 index 0000000000..5f73d1a66c --- /dev/null +++ b/src/core/hle/service/psc/ovln/receiver.h @@ -0,0 +1,46 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include +#include +#include +#include "core/hle/result.h" +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/kernel_helpers.h" +#include "core/hle/service/service.h" +#include "core/hle/service/psc/ovln/ovln_types.h" + +namespace Kernel { +class KReadableEvent; +} + +namespace Service::PSC { + +class IReceiver final : public ServiceFramework { +public: + explicit IReceiver(Core::System& system_); + ~IReceiver() override; + + IReceiver(const IReceiver&) = delete; + IReceiver& operator=(const IReceiver&) = delete; + +private: + Result AddSource(SourceName source_name); + Result RemoveSource(SourceName source_name); + Result GetReceiveEventHandle(OutCopyHandle out_event); + Result Receive(Out out_notification, Out out_flags); + Result ReceiveWithTick(Out out_notification, Out out_flags, + Out out_tick); + + KernelHelpers::ServiceContext service_context; + Kernel::KEvent* receive_event; + + std::map>> message_sources; +}; + +} // namespace Service::PSC diff --git a/src/core/hle/service/psc/ovln/receiver_service.cpp b/src/core/hle/service/psc/ovln/receiver_service.cpp index 0df9d802b9..3b0b180725 100644 --- a/src/core/hle/service/psc/ovln/receiver_service.cpp +++ b/src/core/hle/service/psc/ovln/receiver_service.cpp @@ -5,126 +5,19 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "core/hle/service/cmif_serialization.h" -#include "core/hle/service/psc/ovln/ovln_types.h" +#include "core/hle/service/psc/ovln/receiver.h" #include "core/hle/service/psc/ovln/receiver_service.h" namespace Service::PSC { -class IReceiver final : public ServiceFramework { -public: - explicit IReceiver(Core::System& system_) : ServiceFramework{system_, "IReceiver"}, service_context{system_, "IReceiver"} { - receive_event = service_context.CreateEvent("IReceiver::ReceiveEvent"); - } - - ~IReceiver() override { - service_context.CloseEvent(receive_event); - } - - Result AddSource(SourceName source_name) { - const std::string name = source_name.GetString(); - LOG_INFO(Service_PSC, "called: source_name={}", name); - // Add source if it doesn't already exist - if (message_sources.find(name) == message_sources.end()) { - message_sources[name] = {}; - } - R_SUCCEED(); - } - - Result RemoveSource(SourceName source_name) { - const std::string name = source_name.GetString(); - LOG_INFO(Service_PSC, "called: source_name={}", name); - // Remove source if it exists - message_sources.erase(name); - R_SUCCEED(); - } - - Result GetReceiveEventHandle(OutCopyHandle out_event) { - LOG_INFO(Service_PSC, "called"); - *out_event = &receive_event->GetReadableEvent(); - R_SUCCEED(); - } - - Result Receive(Out out_notification, Out out_flags) { - u64 tick; - return ReceiveWithTick(out_notification, out_flags, Out(&tick)); - } - - Result ReceiveWithTick(Out out_notification, Out out_flags, Out out_tick) { - LOG_DEBUG(Service_PSC, "called"); - - // Find the message with the lowest ID across all sources - const std::string* target_source = nullptr; - size_t target_index = 0; - - for (const auto& [source_name, messages] : message_sources) { - if (!messages.empty()) { - if (target_source == nullptr) { - target_source = &source_name; - target_index = 0; - } - // Note: In the real implementation, we would track message IDs - // For now, just use FIFO order - } - } - - if (target_source != nullptr) { - auto& messages = message_sources[*target_source]; - *out_notification = messages[target_index].first; - *out_flags = messages[target_index].second; - *out_tick = 0; // TODO: Implement tick tracking - - // Remove the message - messages.erase(messages.begin() + target_index); - - // Clear event if no more messages - bool has_messages = false; - for (const auto& [_, msgs] : message_sources) { - if (!msgs.empty()) { - has_messages = true; - break; - } - } - if (!has_messages) { - receive_event->Clear(system.Kernel()); - } - - R_SUCCEED(); - } - - // No messages available - *out_notification = {}; - *out_flags = {}; - *out_tick = 0; - - LOG_WARNING(Service_PSC, "No messages available"); - R_THROW(ResultUnknown); // TODO: Use proper OvlnResult::NoMessages when available - } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IReceiver::AddSource>, "AddSource"}, - FunctionInfo{1, D<&IReceiver::RemoveSource>, "RemoveSource"}, - FunctionInfo{2, D<&IReceiver::GetReceiveEventHandle>, "GetReceiveEventHandle"}, - FunctionInfo{3, D<&IReceiver::Receive>, "Receive"}, - FunctionInfo{4, D<&IReceiver::ReceiveWithTick>, "ReceiveWithTick"} - ); - - KernelHelpers::ServiceContext service_context; - Kernel::KEvent* receive_event; - - std::map>> message_sources; -}; - -std::optional IReceiverService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IReceiverService::OpenReceiver>, "OpenReceiver"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IReceiverService::IReceiverService(Core::System& system_) : ServiceFramework{system_, "ovln:rcv"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IReceiverService::OpenReceiver>, "OpenReceiver"}, + }; + // clang-format on + + RegisterHandlers(functions); } IReceiverService::~IReceiverService() = default; diff --git a/src/core/hle/service/psc/ovln/receiver_service.h b/src/core/hle/service/psc/ovln/receiver_service.h index bd053cd50c..a7a9b012e8 100644 --- a/src/core/hle/service/psc/ovln/receiver_service.h +++ b/src/core/hle/service/psc/ovln/receiver_service.h @@ -20,8 +20,6 @@ public: private: Result OpenReceiver(Out> out_receiver); - - std::optional FindRequest(u32 key) override; }; } // namespace Service::PSC diff --git a/src/core/hle/service/psc/ovln/sender.cpp b/src/core/hle/service/psc/ovln/sender.cpp new file mode 100644 index 0000000000..dffcd4bc36 --- /dev/null +++ b/src/core/hle/service/psc/ovln/sender.cpp @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/hle/service/cmif_serialization.h" +#include "core/hle/service/psc/ovln/sender.h" + +namespace Service::PSC { + +ISender::ISender(Core::System& system_) : ServiceFramework{system_, "ISender"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&ISender::Send>, "Send"}, + {1, nullptr, "GetUnreceivedMessageCount"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +ISender::~ISender() = default; + +Result ISender::Send(const OverlayNotification& notification, MessageFlags flags) { + std::string data; + for (const auto m : notification) { + data += fmt::format("{:016X} ", m); + } + + LOG_WARNING(Service_PSC, "(STUBBED) called, flags={} notification={}", flags.raw, data); + R_SUCCEED(); +} + +} // namespace Service::PSC diff --git a/src/core/hle/service/psc/ovln/sender.h b/src/core/hle/service/psc/ovln/sender.h new file mode 100644 index 0000000000..9b0fe786bd --- /dev/null +++ b/src/core/hle/service/psc/ovln/sender.h @@ -0,0 +1,24 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/psc/ovln/ovln_types.h" +#include "core/hle/service/service.h" + +namespace Service::PSC { + +class ISender final : public ServiceFramework { +public: + explicit ISender(Core::System& system_); + ~ISender() override; + +private: + Result Send(const OverlayNotification& notification, MessageFlags flags); +}; + +} // namespace Service::PSC diff --git a/src/core/hle/service/psc/ovln/sender_service.cpp b/src/core/hle/service/psc/ovln/sender_service.cpp index 5a36f1e1ec..8f80a5c461 100644 --- a/src/core/hle/service/psc/ovln/sender_service.cpp +++ b/src/core/hle/service/psc/ovln/sender_service.cpp @@ -5,43 +5,19 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "core/hle/service/cmif_serialization.h" -#include "core/hle/service/psc/ovln/ovln_types.h" +#include "core/hle/service/psc/ovln/sender.h" #include "core/hle/service/psc/ovln/sender_service.h" namespace Service::PSC { -class ISender final : public ServiceFramework { -public: - explicit ISender(Core::System& system_) : ServiceFramework{system_, "ISender"} {} - ~ISender() override = default; - - Result Send(const OverlayNotification& notification, MessageFlags flags) { - std::string data; - for (const auto m : notification) { - data += fmt::format("{:016X} ", m); - } - - LOG_WARNING(Service_PSC, "(STUBBED) called, flags={} notification={}", flags.raw, data); - R_SUCCEED(); - } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&ISender::Send>, "Send"}, - FunctionInfo{1, nullptr, "GetUnreceivedMessageCount"} - ); -}; - -std::optional ISenderService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&ISenderService::OpenSender>, "OpenSender"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - ISenderService::ISenderService(Core::System& system_) : ServiceFramework{system_, "ovln:snd"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&ISenderService::OpenSender>, "OpenSender"}, + }; + // clang-format on + + RegisterHandlers(functions); } ISenderService::~ISenderService() = default; diff --git a/src/core/hle/service/psc/ovln/sender_service.h b/src/core/hle/service/psc/ovln/sender_service.h index 90a9a33872..8176e85e23 100644 --- a/src/core/hle/service/psc/ovln/sender_service.h +++ b/src/core/hle/service/psc/ovln/sender_service.h @@ -19,9 +19,8 @@ public: ~ISenderService() override; private: - Result OpenSender(Out> out_sender, u32 sender_id, std::array data); - - std::optional FindRequest(u32 key) override; + Result OpenSender(Out> out_sender, u32 sender_id, + std::array data); }; } // namespace Service::PSC diff --git a/src/core/hle/service/psc/pm_control.cpp b/src/core/hle/service/psc/pm_control.cpp new file mode 100644 index 0000000000..fc5852f863 --- /dev/null +++ b/src/core/hle/service/psc/pm_control.cpp @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/hle/service/psc/pm_control.h" + +namespace Service::PSC { + +IPmControl::IPmControl(Core::System& system_) : ServiceFramework{system_, "psc:c"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "Initialize"}, + {1, nullptr, "DispatchRequest"}, + {2, nullptr, "GetResult"}, + {3, nullptr, "GetState"}, + {4, nullptr, "Cancel"}, + {5, nullptr, "PrintModuleInformation"}, + {6, nullptr, "GetModuleInformation"}, + {10, nullptr, "AcquireStateLock"}, + {11, nullptr, "HasStateLock"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +IPmControl::~IPmControl() = default; + +} // namespace Service::PSC diff --git a/src/core/hle/service/psc/pm_control.h b/src/core/hle/service/psc/pm_control.h new file mode 100644 index 0000000000..7967f7ab18 --- /dev/null +++ b/src/core/hle/service/psc/pm_control.h @@ -0,0 +1,19 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/service.h" + +namespace Service::PSC { + +class IPmControl final : public ServiceFramework { +public: + explicit IPmControl(Core::System& system_); + ~IPmControl() override; +}; + +} // namespace Service::PSC diff --git a/src/core/hle/service/psc/pm_module.cpp b/src/core/hle/service/psc/pm_module.cpp new file mode 100644 index 0000000000..38ca36ab8f --- /dev/null +++ b/src/core/hle/service/psc/pm_module.cpp @@ -0,0 +1,27 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/hle/service/psc/pm_module.h" + +namespace Service::PSC { + +IPmModule::IPmModule(Core::System& system_) : ServiceFramework{system_, "IPmModule"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "Initialize"}, + {1, nullptr, "GetRequest"}, + {2, nullptr, "Acknowledge"}, + {3, nullptr, "Finalize"}, + {4, nullptr, "AcknowledgeEx"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +IPmModule::~IPmModule() = default; + +} // namespace Service::PSC diff --git a/src/core/hle/service/psc/pm_module.h b/src/core/hle/service/psc/pm_module.h new file mode 100644 index 0000000000..dac8fcff2a --- /dev/null +++ b/src/core/hle/service/psc/pm_module.h @@ -0,0 +1,19 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/service.h" + +namespace Service::PSC { + +class IPmModule final : public ServiceFramework { +public: + explicit IPmModule(Core::System& system_); + ~IPmModule() override; +}; + +} // namespace Service::PSC diff --git a/src/core/hle/service/psc/pm_service.cpp b/src/core/hle/service/psc/pm_service.cpp new file mode 100644 index 0000000000..d1803bdf48 --- /dev/null +++ b/src/core/hle/service/psc/pm_service.cpp @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/hle/service/cmif_serialization.h" +#include "core/hle/service/psc/pm_module.h" +#include "core/hle/service/psc/pm_service.h" + +namespace Service::PSC { + +IPmService::IPmService(Core::System& system_) : ServiceFramework{system_, "psc:m"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IPmService::GetPmModule>, "GetPmModule"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +IPmService::~IPmService() = default; + +Result IPmService::GetPmModule(Out> out_module) { + LOG_DEBUG(Service_PSC, "called"); + *out_module = std::make_shared(system); + R_SUCCEED(); +} + +} // namespace Service::PSC diff --git a/src/core/hle/service/psc/pm_service.h b/src/core/hle/service/psc/pm_service.h new file mode 100644 index 0000000000..721a0602c9 --- /dev/null +++ b/src/core/hle/service/psc/pm_service.h @@ -0,0 +1,25 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/service.h" + +namespace Service::PSC { + +class IPmModule; + +class IPmService final : public ServiceFramework { +public: + explicit IPmService(Core::System& system_); + ~IPmService() override; + +private: + Result GetPmModule(Out> out_module); +}; + +} // namespace Service::PSC diff --git a/src/core/hle/service/psc/psc.cpp b/src/core/hle/service/psc/psc.cpp index 553c4f63a4..31fb9f0117 100644 --- a/src/core/hle/service/psc/psc.cpp +++ b/src/core/hle/service/psc/psc.cpp @@ -6,159 +6,102 @@ #include "core/hle/service/psc/ovln/receiver_service.h" #include "core/hle/service/psc/ovln/sender_service.h" +#include "core/hle/service/psc/pm_control.h" +#include "core/hle/service/psc/pm_service.h" #include "core/hle/service/psc/psc.h" #include "core/hle/service/psc/time/manager.h" #include "core/hle/service/psc/time/power_state_service.h" #include "core/hle/service/psc/time/service_manager.h" #include "core/hle/service/psc/time/static.h" #include "core/hle/service/service.h" -#include "core/hle/service/cmif_serialization.h" namespace Service::PSC { class PSC_L final : public ServiceFramework { public: - explicit PSC_L(Core::System& system_) : ServiceFramework{system_, "psc:l"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "Initialize_3"}, - FunctionInfo{1, nullptr, "Lock"}, - FunctionInfo{2, nullptr, "Unlock"}, - FunctionInfo{3, nullptr, "IsLocked"}, - FunctionInfo{4, nullptr, "GetRelatedState"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit PSC_L(Core::System& system_) : ServiceFramework{system_, "psc:l"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "Initialize_3"}, + {1, nullptr, "Lock"}, + {2, nullptr, "Unlock"}, + {3, nullptr, "IsLocked"}, + {4, nullptr, "GetRelatedState"}, + }; + // clang-format on + RegisterHandlers(functions); } }; class INS_R final : public ServiceFramework { public: - explicit INS_R(Core::System& system_) : ServiceFramework{system_, "ins:r"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetInputSourceState"}, - FunctionInfo{1, nullptr, "GetTriggerTargetEvent"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit INS_R(Core::System& system_) : ServiceFramework{system_, "ins:r"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetInputSourceState"}, + {1, nullptr, "GetTriggerTargetEvent"}, + }; + // clang-format on + RegisterHandlers(functions); } }; class INS_S final : public ServiceFramework { public: - explicit INS_S(Core::System& system_) : ServiceFramework{system_, "ins:s"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetNotifyEvent"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit INS_S(Core::System& system_) : ServiceFramework{system_, "ins:s"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetNotifyEvent"}, + }; + // clang-format on + RegisterHandlers(functions); } }; class HSHL_SYS final : public ServiceFramework { public: - explicit HSHL_SYS(Core::System& system_) : ServiceFramework{system_, "hshl:sys"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetBatteryPercentage"}, - FunctionInfo{1, nullptr, "GetChargerType"}, - FunctionInfo{2, nullptr, "OpenChargeSession"}, - FunctionInfo{3, nullptr, "GetRawBatteryPercentage"}, - FunctionInfo{4, nullptr, "GetBatteryVoltageLevel"}, - FunctionInfo{5, nullptr, "OpenThermalSession"}, - FunctionInfo{6, nullptr, "GetAbnormalTemperatureSet"}, - FunctionInfo{7, nullptr, "OpenClockSession"}, - FunctionInfo{8, nullptr, "GetClockRate"}, - FunctionInfo{9, nullptr, "OpenBridgeSession"}, - FunctionInfo{10, nullptr, "GetBridgePowerSupply"}, - FunctionInfo{11, nullptr, "OpenVsysVoltageSession"}, - FunctionInfo{12, nullptr, "GetIsBatteryEnoughForFullAwake"}, - FunctionInfo{13, nullptr, "GetIsCharging"}, - FunctionInfo{14, nullptr, "Cmd14"}, - FunctionInfo{15, nullptr, "Cmd15"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit HSHL_SYS(Core::System& system_) : ServiceFramework{system_, "hshl:sys"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetBatteryPercentage"}, + {1, nullptr, "GetChargerType"}, + {2, nullptr, "OpenChargeSession"}, + {3, nullptr, "GetRawBatteryPercentage"}, + {4, nullptr, "GetBatteryVoltageLevel"}, + {5, nullptr, "OpenThermalSession"}, + {6, nullptr, "GetAbnormalTemperatureSet"}, + {7, nullptr, "OpenClockSession"}, + {8, nullptr, "GetClockRate"}, + {9, nullptr, "OpenBridgeSession"}, + {10, nullptr, "GetBridgePowerSupply"}, + {11, nullptr, "OpenVsysVoltageSession"}, + {12, nullptr, "GetIsBatteryEnoughForFullAwake"}, + {13, nullptr, "GetIsCharging"}, + {14, nullptr, "Cmd14"}, + {15, nullptr, "Cmd15"}, + }; + // clang-format on + RegisterHandlers(functions); } }; class HSHL_SET final : public ServiceFramework { public: - explicit HSHL_SET(Core::System& system_) : ServiceFramework{system_, "hshl:set"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "OpenChargeSession_2"}, - FunctionInfo{1, nullptr, "OpenThermalSession_2"}, - FunctionInfo{2, nullptr, "SetClockRate"}, - FunctionInfo{3, nullptr, "SetBridgePowerSupply"}, - FunctionInfo{4, nullptr, "Cmd4"}, - FunctionInfo{5, nullptr, "Cmd5"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit HSHL_SET(Core::System& system_) : ServiceFramework{system_, "hshl:set"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "OpenChargeSession_2"}, + {1, nullptr, "OpenThermalSession_2"}, + {2, nullptr, "SetClockRate"}, + {3, nullptr, "SetBridgePowerSupply"}, + {4, nullptr, "Cmd4"}, + {5, nullptr, "Cmd5"}, + }; + // clang-format on + RegisterHandlers(functions); } }; -class IPmModule final : public ServiceFramework { -public: - explicit IPmModule(Core::System& system_) : ServiceFramework{system_, "IPmModule"} {} - ~IPmModule() override = default; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "Initialize"}, - FunctionInfo{1, nullptr, "GetRequest"}, - FunctionInfo{2, nullptr, "Acknowledge"}, - FunctionInfo{3, nullptr, "Finalize"}, - FunctionInfo{4, nullptr, "AcknowledgeEx"} - ); -}; - -class IPmService final : public ServiceFramework { -public: - explicit IPmService(Core::System& system_) : ServiceFramework{system_, "psc:m"} {} - ~IPmService() override = default; - -private: - Result GetPmModule(Out> out_module) { - LOG_DEBUG(Service_PSC, "called"); - *out_module = std::make_shared(system); - R_SUCCEED(); - } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IPmService::GetPmModule>, "GetPmModule"} - ); -}; - -class IPmControl final : public ServiceFramework { -public: - explicit IPmControl(Core::System& system_) : ServiceFramework{system_, "psc:c"} {} - ~IPmControl() override = default; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "Initialize"}, - FunctionInfo{1, nullptr, "DispatchRequest"}, - FunctionInfo{2, nullptr, "GetResult"}, - FunctionInfo{3, nullptr, "GetState"}, - FunctionInfo{4, nullptr, "Cancel"}, - FunctionInfo{5, nullptr, "PrintModuleInformation"}, - FunctionInfo{6, nullptr, "GetModuleInformation"}, - FunctionInfo{10, nullptr, "AcquireStateLock"}, - FunctionInfo{11, nullptr, "HasStateLock"} - ); -}; - void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); diff --git a/src/core/hle/service/psc/psc.h b/src/core/hle/service/psc/psc.h index c83d07ca80..d89e6854cc 100644 --- a/src/core/hle/service/psc/psc.h +++ b/src/core/hle/service/psc/psc.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/psc/time/alarms.cpp b/src/core/hle/service/psc/time/alarms.cpp index c9070896b3..17a795c4c5 100644 --- a/src/core/hle/service/psc/time/alarms.cpp +++ b/src/core/hle/service/psc/time/alarms.cpp @@ -33,7 +33,8 @@ Alarm::~Alarm() { } Alarms::Alarms(Core::System& system, StandardSteadyClockCore& steady_clock, PowerStateRequestManager& power_state_request_manager) - : m_ctx{system, "Psc:Alarms"} + : m_system{system} + , m_ctx{system, "Psc:Alarms"} , m_steady_clock{steady_clock} , m_power_state_request_manager{power_state_request_manager} , m_event{m_ctx.CreateEvent("Psc:Alarms:Event")} @@ -135,7 +136,15 @@ Result Alarms::UpdateClosestAndSignal(Kernel::KernelCore& kernel) { IAlarmService::IAlarmService(Core::System& system_, std::shared_ptr manager) : ServiceFramework{system_, "time:al"} , m_alarms{manager->m_alarms} -{} +{ + // clang-format off + static const FunctionInfo functions[] = { + {0, &IAlarmService::CreateWakeupAlarm, "CreateWakeupAlarm"}, + {1, &IAlarmService::CreateBackgroundTaskAlarm, "CreateBackgroundTaskAlarm"}, + }; + // clang-format on + RegisterHandlers(functions); +} void IAlarmService::CreateWakeupAlarm(HLERequestContext& ctx) { LOG_DEBUG(Service_Time, "called."); @@ -156,6 +165,17 @@ void IAlarmService::CreateBackgroundTaskAlarm(HLERequestContext& ctx) { ISteadyClockAlarm::ISteadyClockAlarm(Core::System& system_, Alarms& alarms, AlarmType type) : ServiceFramework{system_, "ISteadyClockAlarm"}, m_ctx{system, "Psc:ISteadyClockAlarm"}, m_alarms{alarms}, m_alarm{system, m_ctx, type} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &ISteadyClockAlarm::GetAlarmEvent, "GetAlarmEvent"}, + {1, &ISteadyClockAlarm::Enable, "Enable"}, + {2, &ISteadyClockAlarm::Disable, "Disable"}, + {3, &ISteadyClockAlarm::IsEnabled, "IsEnabled"}, + {10, nullptr, "CreateWakeLock"}, + {11, nullptr, "DestroyWakeLock"}, + }; + // clang-format on + RegisterHandlers(functions); } void ISteadyClockAlarm::GetAlarmEvent(HLERequestContext& ctx) { diff --git a/src/core/hle/service/psc/time/alarms.h b/src/core/hle/service/psc/time/alarms.h index 6d916ca198..0a2fa7fac5 100644 --- a/src/core/hle/service/psc/time/alarms.h +++ b/src/core/hle/service/psc/time/alarms.h @@ -95,6 +95,7 @@ private: void Erase(Kernel::KernelCore& kernel, Alarm& alarm); Result UpdateClosestAndSignal(Kernel::KernelCore& kernel); + Core::System& m_system; KernelHelpers::ServiceContext m_ctx; StandardSteadyClockCore& m_steady_clock; @@ -113,14 +114,6 @@ public: private: void CreateWakeupAlarm(HLERequestContext& ctx); void CreateBackgroundTaskAlarm(HLERequestContext& ctx); - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &IAlarmService::CreateWakeupAlarm, "CreateWakeupAlarm"}, - FunctionInfo{1, &IAlarmService::CreateBackgroundTaskAlarm, "CreateBackgroundTaskAlarm"} - ); Alarms& m_alarms; }; @@ -135,18 +128,8 @@ private: void Disable(HLERequestContext& ctx); void IsEnabled(HLERequestContext& ctx); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &ISteadyClockAlarm::GetAlarmEvent, "GetAlarmEvent"}, - FunctionInfo{1, &ISteadyClockAlarm::Enable, "Enable"}, - FunctionInfo{2, &ISteadyClockAlarm::Disable, "Disable"}, - FunctionInfo{3, &ISteadyClockAlarm::IsEnabled, "IsEnabled"}, - FunctionInfo{10, nullptr, "CreateWakeLock"}, - FunctionInfo{11, nullptr, "DestroyWakeLock"} - ); KernelHelpers::ServiceContext m_ctx; + Alarms& m_alarms; Alarm m_alarm; }; diff --git a/src/core/hle/service/psc/time/clocks/ephemeral_network_system_clock_core.h b/src/core/hle/service/psc/time/clocks/ephemeral_network_system_clock_core.h index 0a68867d94..0abe200206 100644 --- a/src/core/hle/service/psc/time/clocks/ephemeral_network_system_clock_core.h +++ b/src/core/hle/service/psc/time/clocks/ephemeral_network_system_clock_core.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/psc/time/clocks/standard_local_system_clock_core.cpp b/src/core/hle/service/psc/time/clocks/standard_local_system_clock_core.cpp index 6a74d45946..d0e596c504 100644 --- a/src/core/hle/service/psc/time/clocks/standard_local_system_clock_core.cpp +++ b/src/core/hle/service/psc/time/clocks/standard_local_system_clock_core.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/psc/time/clocks/standard_local_system_clock_core.h b/src/core/hle/service/psc/time/clocks/standard_local_system_clock_core.h index 5722d8e965..832c6907a0 100644 --- a/src/core/hle/service/psc/time/clocks/standard_local_system_clock_core.h +++ b/src/core/hle/service/psc/time/clocks/standard_local_system_clock_core.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/psc/time/clocks/standard_network_system_clock_core.cpp b/src/core/hle/service/psc/time/clocks/standard_network_system_clock_core.cpp index 6938d369fe..b3143ead71 100644 --- a/src/core/hle/service/psc/time/clocks/standard_network_system_clock_core.cpp +++ b/src/core/hle/service/psc/time/clocks/standard_network_system_clock_core.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/psc/time/clocks/standard_network_system_clock_core.h b/src/core/hle/service/psc/time/clocks/standard_network_system_clock_core.h index bfafc7d71f..47a411e811 100644 --- a/src/core/hle/service/psc/time/clocks/standard_network_system_clock_core.h +++ b/src/core/hle/service/psc/time/clocks/standard_network_system_clock_core.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/psc/time/clocks/standard_steady_clock_core.cpp b/src/core/hle/service/psc/time/clocks/standard_steady_clock_core.cpp index 7a72d7aa25..8fc44fd691 100644 --- a/src/core/hle/service/psc/time/clocks/standard_steady_clock_core.cpp +++ b/src/core/hle/service/psc/time/clocks/standard_steady_clock_core.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/psc/time/clocks/standard_steady_clock_core.h b/src/core/hle/service/psc/time/clocks/standard_steady_clock_core.h index bbf98fcd5c..342d6385fd 100644 --- a/src/core/hle/service/psc/time/clocks/standard_steady_clock_core.h +++ b/src/core/hle/service/psc/time/clocks/standard_steady_clock_core.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/psc/time/clocks/standard_user_system_clock_core.h b/src/core/hle/service/psc/time/clocks/standard_user_system_clock_core.h index 32b8bc3bcd..14c8e613f4 100644 --- a/src/core/hle/service/psc/time/clocks/standard_user_system_clock_core.h +++ b/src/core/hle/service/psc/time/clocks/standard_user_system_clock_core.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/psc/time/clocks/steady_clock_core.h b/src/core/hle/service/psc/time/clocks/steady_clock_core.h index f933cc15f8..31be5e25ad 100644 --- a/src/core/hle/service/psc/time/clocks/steady_clock_core.h +++ b/src/core/hle/service/psc/time/clocks/steady_clock_core.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/psc/time/clocks/system_clock_core.cpp b/src/core/hle/service/psc/time/clocks/system_clock_core.cpp index 2b7466831d..7ca5e8515e 100644 --- a/src/core/hle/service/psc/time/clocks/system_clock_core.cpp +++ b/src/core/hle/service/psc/time/clocks/system_clock_core.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/psc/time/clocks/system_clock_core.h b/src/core/hle/service/psc/time/clocks/system_clock_core.h index 0b928432fb..d95bab5191 100644 --- a/src/core/hle/service/psc/time/clocks/system_clock_core.h +++ b/src/core/hle/service/psc/time/clocks/system_clock_core.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/psc/time/clocks/tick_based_steady_clock_core.cpp b/src/core/hle/service/psc/time/clocks/tick_based_steady_clock_core.cpp index 22da1fbccc..8666df57f1 100644 --- a/src/core/hle/service/psc/time/clocks/tick_based_steady_clock_core.cpp +++ b/src/core/hle/service/psc/time/clocks/tick_based_steady_clock_core.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/psc/time/clocks/tick_based_steady_clock_core.h b/src/core/hle/service/psc/time/clocks/tick_based_steady_clock_core.h index a7bea86a25..62890cd5ca 100644 --- a/src/core/hle/service/psc/time/clocks/tick_based_steady_clock_core.h +++ b/src/core/hle/service/psc/time/clocks/tick_based_steady_clock_core.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/psc/time/common.cpp b/src/core/hle/service/psc/time/common.cpp index a6d9f02ca3..dce2249ea1 100644 --- a/src/core/hle/service/psc/time/common.cpp +++ b/src/core/hle/service/psc/time/common.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/psc/time/manager.h b/src/core/hle/service/psc/time/manager.h index 2cb8b58a2b..7c771d25f5 100644 --- a/src/core/hle/service/psc/time/manager.h +++ b/src/core/hle/service/psc/time/manager.h @@ -26,20 +26,20 @@ namespace Service::PSC::Time { class TimeManager { public: explicit TimeManager(Core::System& system) - : m_standard_steady_clock{system} - , m_tick_based_steady_clock{system} - , m_standard_local_system_clock{m_standard_steady_clock} - , m_standard_network_system_clock{m_standard_steady_clock} - , m_standard_user_system_clock{system, m_standard_local_system_clock - , m_standard_network_system_clock} - , m_ephemeral_network_clock{m_tick_based_steady_clock} - , m_shared_memory{system} - , m_power_state_request_manager{system} - , m_alarms{system, m_standard_steady_clock, m_power_state_request_manager} - , m_local_system_clock_context_writer{system, m_shared_memory} - , m_network_system_clock_context_writer{system, m_shared_memory, m_standard_user_system_clock} - , m_ephemeral_network_clock_context_writer{system} - {} + : m_system{system}, m_standard_steady_clock{system}, m_tick_based_steady_clock{m_system}, + m_standard_local_system_clock{m_standard_steady_clock}, + m_standard_network_system_clock{m_standard_steady_clock}, + m_standard_user_system_clock{m_system, m_standard_local_system_clock, + m_standard_network_system_clock}, + m_ephemeral_network_clock{m_tick_based_steady_clock}, m_shared_memory{m_system}, + m_power_state_request_manager{m_system}, m_alarms{m_system, m_standard_steady_clock, + m_power_state_request_manager}, + m_local_system_clock_context_writer{m_system, m_shared_memory}, + m_network_system_clock_context_writer{m_system, m_shared_memory, + m_standard_user_system_clock}, + m_ephemeral_network_clock_context_writer{m_system} {} + + Core::System& m_system; StandardSteadyClockCore m_standard_steady_clock; TickBasedSteadyClockCore m_tick_based_steady_clock; diff --git a/src/core/hle/service/psc/time/power_state_request_manager.h b/src/core/hle/service/psc/time/power_state_request_manager.h index 30a0c947d6..325f73913b 100644 --- a/src/core/hle/service/psc/time/power_state_request_manager.h +++ b/src/core/hle/service/psc/time/power_state_request_manager.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/psc/time/power_state_service.cpp b/src/core/hle/service/psc/time/power_state_service.cpp index 795aeb94a8..39af16b6f1 100644 --- a/src/core/hle/service/psc/time/power_state_service.cpp +++ b/src/core/hle/service/psc/time/power_state_service.cpp @@ -9,19 +9,20 @@ namespace Service::PSC::Time { -std::optional IPowerStateRequestHandler::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IPowerStateRequestHandler::GetPowerStateRequestEventReadableHandle>, "GetPowerStateRequestEventReadableHandle"}, - FunctionInfo{1, D<&IPowerStateRequestHandler::GetAndClearPowerStateRequest>, "GetAndClearPowerStateRequest"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IPowerStateRequestHandler::IPowerStateRequestHandler( Core::System& system_, PowerStateRequestManager& power_state_request_manager) : ServiceFramework{system_, "time:p"} , m_power_state_request_manager{power_state_request_manager} -{} +{ + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&IPowerStateRequestHandler::GetPowerStateRequestEventReadableHandle>, "GetPowerStateRequestEventReadableHandle"}, + {1, D<&IPowerStateRequestHandler::GetAndClearPowerStateRequest>, "GetAndClearPowerStateRequest"}, + }; + // clang-format on + + RegisterHandlers(functions); +} Result IPowerStateRequestHandler::GetPowerStateRequestEventReadableHandle( OutCopyHandle out_event) { diff --git a/src/core/hle/service/psc/time/power_state_service.h b/src/core/hle/service/psc/time/power_state_service.h index 14d9c1a77a..81b3adf234 100644 --- a/src/core/hle/service/psc/time/power_state_service.h +++ b/src/core/hle/service/psc/time/power_state_service.h @@ -27,7 +27,6 @@ public: Result GetAndClearPowerStateRequest(Out out_cleared, Out out_priority); private: - std::optional FindRequest(u32 key) override; PowerStateRequestManager& m_power_state_request_manager; }; diff --git a/src/core/hle/service/psc/time/service_manager.cpp b/src/core/hle/service/psc/time/service_manager.cpp index be25ee9a70..e9f1407e4d 100644 --- a/src/core/hle/service/psc/time/service_manager.cpp +++ b/src/core/hle/service/psc/time/service_manager.cpp @@ -13,30 +13,6 @@ namespace Service::PSC::Time { - std::optional ServiceManager::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&ServiceManager::GetStaticServiceAsUser>, "GetStaticServiceAsUser"}, - FunctionInfo{5, D<&ServiceManager::GetStaticServiceAsAdmin>, "GetStaticServiceAsAdmin"}, - FunctionInfo{6, D<&ServiceManager::GetStaticServiceAsRepair>, "GetStaticServiceAsRepair"}, - FunctionInfo{9, D<&ServiceManager::GetStaticServiceAsServiceManager>, "GetStaticServiceAsServiceManager"}, - FunctionInfo{10, D<&ServiceManager::SetupStandardSteadyClockCore>, "SetupStandardSteadyClockCore"}, - FunctionInfo{11, D<&ServiceManager::SetupStandardLocalSystemClockCore>, "SetupStandardLocalSystemClockCore"}, - FunctionInfo{12, D<&ServiceManager::SetupStandardNetworkSystemClockCore>, "SetupStandardNetworkSystemClockCore"}, - FunctionInfo{13, D<&ServiceManager::SetupStandardUserSystemClockCore>, "SetupStandardUserSystemClockCore"}, - FunctionInfo{14, D<&ServiceManager::SetupTimeZoneServiceCore>, "SetupTimeZoneServiceCore"}, - FunctionInfo{15, D<&ServiceManager::SetupEphemeralNetworkSystemClockCore>, "SetupEphemeralNetworkSystemClockCore"}, - FunctionInfo{50, D<&ServiceManager::GetStandardLocalClockOperationEvent>, "GetStandardLocalClockOperationEvent"}, - FunctionInfo{51, D<&ServiceManager::GetStandardNetworkClockOperationEventForServiceManager>, "GetStandardNetworkClockOperationEventForServiceManager"}, - FunctionInfo{52, D<&ServiceManager::GetEphemeralNetworkClockOperationEventForServiceManager>, "GetEphemeralNetworkClockOperationEventForServiceManager"}, - FunctionInfo{60, D<&ServiceManager::GetStandardUserSystemClockAutomaticCorrectionUpdatedEvent>, "GetStandardUserSystemClockAutomaticCorrectionUpdatedEvent"}, - FunctionInfo{100, D<&ServiceManager::SetStandardSteadyClockBaseTime>, "SetStandardSteadyClockBaseTime"}, - FunctionInfo{200, D<&ServiceManager::GetClosestAlarmUpdatedEvent>, "GetClosestAlarmUpdatedEvent"}, - FunctionInfo{201, D<&ServiceManager::CheckAndSignalAlarms>, "CheckAndSignalAlarms"}, - FunctionInfo{202, D<&ServiceManager::GetClosestAlarmInfo>, "GetClosestAlarmInfo "} - ); - return HandlerTableGenerateWithFind(key, functions); - } - ServiceManager::ServiceManager(Core::System& system_, std::shared_ptr time, ServerManager* server_manager) : ServiceFramework{system_, "time:m"}, m_time{std::move(time)}, @@ -51,6 +27,30 @@ ServiceManager::ServiceManager(Core::System& system_, std::shared_ptrm_network_system_clock_context_writer}, m_ephemeral_system_context_writer{m_time->m_ephemeral_network_clock_context_writer}, m_local_operation{system_}, m_network_operation{system_}, m_ephemeral_operation{system_} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&ServiceManager::GetStaticServiceAsUser>, "GetStaticServiceAsUser"}, + {5, D<&ServiceManager::GetStaticServiceAsAdmin>, "GetStaticServiceAsAdmin"}, + {6, D<&ServiceManager::GetStaticServiceAsRepair>, "GetStaticServiceAsRepair"}, + {9, D<&ServiceManager::GetStaticServiceAsServiceManager>, "GetStaticServiceAsServiceManager"}, + {10, D<&ServiceManager::SetupStandardSteadyClockCore>, "SetupStandardSteadyClockCore"}, + {11, D<&ServiceManager::SetupStandardLocalSystemClockCore>, "SetupStandardLocalSystemClockCore"}, + {12, D<&ServiceManager::SetupStandardNetworkSystemClockCore>, "SetupStandardNetworkSystemClockCore"}, + {13, D<&ServiceManager::SetupStandardUserSystemClockCore>, "SetupStandardUserSystemClockCore"}, + {14, D<&ServiceManager::SetupTimeZoneServiceCore>, "SetupTimeZoneServiceCore"}, + {15, D<&ServiceManager::SetupEphemeralNetworkSystemClockCore>, "SetupEphemeralNetworkSystemClockCore"}, + {50, D<&ServiceManager::GetStandardLocalClockOperationEvent>, "GetStandardLocalClockOperationEvent"}, + {51, D<&ServiceManager::GetStandardNetworkClockOperationEventForServiceManager>, "GetStandardNetworkClockOperationEventForServiceManager"}, + {52, D<&ServiceManager::GetEphemeralNetworkClockOperationEventForServiceManager>, "GetEphemeralNetworkClockOperationEventForServiceManager"}, + {60, D<&ServiceManager::GetStandardUserSystemClockAutomaticCorrectionUpdatedEvent>, "GetStandardUserSystemClockAutomaticCorrectionUpdatedEvent"}, + {100, D<&ServiceManager::SetStandardSteadyClockBaseTime>, "SetStandardSteadyClockBaseTime"}, + {200, D<&ServiceManager::GetClosestAlarmUpdatedEvent>, "GetClosestAlarmUpdatedEvent"}, + {201, D<&ServiceManager::CheckAndSignalAlarms>, "CheckAndSignalAlarms"}, + {202, D<&ServiceManager::GetClosestAlarmInfo>, "GetClosestAlarmInfo "}, + }; + // clang-format on + RegisterHandlers(functions); + m_local_system_context_writer.Link(m_local_operation); m_network_system_context_writer.Link(m_network_operation); m_ephemeral_system_context_writer.Link(m_ephemeral_operation); diff --git a/src/core/hle/service/psc/time/service_manager.h b/src/core/hle/service/psc/time/service_manager.h index a8b94d8939..09cff25038 100644 --- a/src/core/hle/service/psc/time/service_manager.h +++ b/src/core/hle/service/psc/time/service_manager.h @@ -65,8 +65,6 @@ private: void SetupSAndP(); Result GetStaticService(OutInterface out_service, StaticServiceSetupInfo setup_info, const char* name); - std::optional FindRequest(u32 key) override; - std::shared_ptr m_time; ServerManager& m_server_manager; bool m_is_s_and_p_setup{}; diff --git a/src/core/hle/service/psc/time/shared_memory.cpp b/src/core/hle/service/psc/time/shared_memory.cpp index adef6bcd8b..b6841a87cb 100644 --- a/src/core/hle/service/psc/time/shared_memory.cpp +++ b/src/core/hle/service/psc/time/shared_memory.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/psc/time/static.cpp b/src/core/hle/service/psc/time/static.cpp index 2b2b6f1f04..28cff3b764 100644 --- a/src/core/hle/service/psc/time/static.cpp +++ b/src/core/hle/service/psc/time/static.cpp @@ -33,31 +33,6 @@ constexpr Result GetTimeFromTimePointAndContext(s64* out_time, SteadyClockTimePo } } // namespace -std::optional StaticService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&StaticService::GetStandardUserSystemClock>, "GetStandardUserSystemClock"}, - FunctionInfo{1, D<&StaticService::GetStandardNetworkSystemClock>, "GetStandardNetworkSystemClock"}, - FunctionInfo{2, D<&StaticService::GetStandardSteadyClock>, "GetStandardSteadyClock"}, - FunctionInfo{3, D<&StaticService::GetTimeZoneService>, "GetTimeZoneService"}, - FunctionInfo{4, D<&StaticService::GetStandardLocalSystemClock>, "GetStandardLocalSystemClock"}, - FunctionInfo{5, D<&StaticService::GetEphemeralNetworkSystemClock>, "GetEphemeralNetworkSystemClock"}, - FunctionInfo{20, D<&StaticService::GetSharedMemoryNativeHandle>, "GetSharedMemoryNativeHandle"}, - FunctionInfo{50, D<&StaticService::SetStandardSteadyClockInternalOffset>, "SetStandardSteadyClockInternalOffset"}, - FunctionInfo{51, D<&StaticService::GetStandardSteadyClockRtcValue>, "GetStandardSteadyClockRtcValue"}, - FunctionInfo{100, D<&StaticService::IsStandardUserSystemClockAutomaticCorrectionEnabled>, "IsStandardUserSystemClockAutomaticCorrectionEnabled"}, - FunctionInfo{101, D<&StaticService::SetStandardUserSystemClockAutomaticCorrectionEnabled>, "SetStandardUserSystemClockAutomaticCorrectionEnabled"}, - FunctionInfo{102, D<&StaticService::GetStandardUserSystemClockInitialYear>, "GetStandardUserSystemClockInitialYear"}, - FunctionInfo{200, D<&StaticService::IsStandardNetworkSystemClockAccuracySufficient>, "IsStandardNetworkSystemClockAccuracySufficient"}, - FunctionInfo{201, D<&StaticService::GetStandardUserSystemClockAutomaticCorrectionUpdatedTime>, "GetStandardUserSystemClockAutomaticCorrectionUpdatedTime"}, - FunctionInfo{300, D<&StaticService::CalculateMonotonicSystemClockBaseTimePoint>, "CalculateMonotonicSystemClockBaseTimePoint"}, - FunctionInfo{400, D<&StaticService::GetClockSnapshot>, "GetClockSnapshot"}, - FunctionInfo{401, D<&StaticService::GetClockSnapshotFromSystemClockContext>, "GetClockSnapshotFromSystemClockContext"}, - FunctionInfo{500, D<&StaticService::CalculateStandardUserSystemClockDifferenceByUser>, "CalculateStandardUserSystemClockDifferenceByUser"}, - FunctionInfo{501, D<&StaticService::CalculateSpanBetween>, "CalculateSpanBetween"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - StaticService::StaticService(Core::System& system_, StaticServiceSetupInfo setup_info, std::shared_ptr time, const char* name) : ServiceFramework{system_, name}, m_setup_info{setup_info}, m_time{time}, @@ -67,6 +42,31 @@ StaticService::StaticService(Core::System& system_, StaticServiceSetupInfo setup m_time_zone{m_time->m_time_zone}, m_ephemeral_network_clock{m_time->m_ephemeral_network_clock}, m_shared_memory{ m_time->m_shared_memory} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&StaticService::GetStandardUserSystemClock>, "GetStandardUserSystemClock"}, + {1, D<&StaticService::GetStandardNetworkSystemClock>, "GetStandardNetworkSystemClock"}, + {2, D<&StaticService::GetStandardSteadyClock>, "GetStandardSteadyClock"}, + {3, D<&StaticService::GetTimeZoneService>, "GetTimeZoneService"}, + {4, D<&StaticService::GetStandardLocalSystemClock>, "GetStandardLocalSystemClock"}, + {5, D<&StaticService::GetEphemeralNetworkSystemClock>, "GetEphemeralNetworkSystemClock"}, + {20, D<&StaticService::GetSharedMemoryNativeHandle>, "GetSharedMemoryNativeHandle"}, + {50, D<&StaticService::SetStandardSteadyClockInternalOffset>, "SetStandardSteadyClockInternalOffset"}, + {51, D<&StaticService::GetStandardSteadyClockRtcValue>, "GetStandardSteadyClockRtcValue"}, + {100, D<&StaticService::IsStandardUserSystemClockAutomaticCorrectionEnabled>, "IsStandardUserSystemClockAutomaticCorrectionEnabled"}, + {101, D<&StaticService::SetStandardUserSystemClockAutomaticCorrectionEnabled>, "SetStandardUserSystemClockAutomaticCorrectionEnabled"}, + {102, D<&StaticService::GetStandardUserSystemClockInitialYear>, "GetStandardUserSystemClockInitialYear"}, + {200, D<&StaticService::IsStandardNetworkSystemClockAccuracySufficient>, "IsStandardNetworkSystemClockAccuracySufficient"}, + {201, D<&StaticService::GetStandardUserSystemClockAutomaticCorrectionUpdatedTime>, "GetStandardUserSystemClockAutomaticCorrectionUpdatedTime"}, + {300, D<&StaticService::CalculateMonotonicSystemClockBaseTimePoint>, "CalculateMonotonicSystemClockBaseTimePoint"}, + {400, D<&StaticService::GetClockSnapshot>, "GetClockSnapshot"}, + {401, D<&StaticService::GetClockSnapshotFromSystemClockContext>, "GetClockSnapshotFromSystemClockContext"}, + {500, D<&StaticService::CalculateStandardUserSystemClockDifferenceByUser>, "CalculateStandardUserSystemClockDifferenceByUser"}, + {501, D<&StaticService::CalculateSpanBetween>, "CalculateSpanBetween"}, + }; + // clang-format on + + RegisterHandlers(functions); } Result StaticService::GetStandardUserSystemClock(OutInterface out_service) { diff --git a/src/core/hle/service/psc/time/static.h b/src/core/hle/service/psc/time/static.h index a86fec178f..52659166f1 100644 --- a/src/core/hle/service/psc/time/static.h +++ b/src/core/hle/service/psc/time/static.h @@ -71,8 +71,6 @@ private: Result GetClockSnapshotImpl(OutClockSnapshot out_snapshot, const SystemClockContext& user_context, const SystemClockContext& network_context, TimeType type); - std::optional FindRequest(u32 key) override; - StaticServiceSetupInfo m_setup_info; std::shared_ptr m_time; StandardLocalSystemClockCore& m_local_system_clock; diff --git a/src/core/hle/service/psc/time/steady_clock.cpp b/src/core/hle/service/psc/time/steady_clock.cpp index 3d138837d3..1d1551acf9 100644 --- a/src/core/hle/service/psc/time/steady_clock.cpp +++ b/src/core/hle/service/psc/time/steady_clock.cpp @@ -11,26 +11,26 @@ namespace Service::PSC::Time { -std::optional SteadyClock::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&SteadyClock::GetCurrentTimePoint>, "GetCurrentTimePoint"}, - FunctionInfo{2, D<&SteadyClock::GetTestOffset>, "GetTestOffset"}, - FunctionInfo{3, D<&SteadyClock::SetTestOffset>, "SetTestOffset"}, - FunctionInfo{100, D<&SteadyClock::GetRtcValue>, "GetRtcValue"}, - FunctionInfo{101, D<&SteadyClock::IsRtcResetDetected>, "IsRtcResetDetected"}, - FunctionInfo{102, D<&SteadyClock::GetSetupResultValue>, "GetSetupResultValue"}, - FunctionInfo{200, D<&SteadyClock::GetInternalOffset>, "GetInternalOffset"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - SteadyClock::SteadyClock(Core::System& system_, std::shared_ptr manager, bool can_write_steady_clock, bool can_write_uninitialized_clock) : ServiceFramework{system_, "ISteadyClock"} , m_clock_core{manager->m_standard_steady_clock} , m_can_write_steady_clock{can_write_steady_clock} , m_can_write_uninitialized_clock{can_write_uninitialized_clock} -{} +{ + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&SteadyClock::GetCurrentTimePoint>, "GetCurrentTimePoint"}, + {2, D<&SteadyClock::GetTestOffset>, "GetTestOffset"}, + {3, D<&SteadyClock::SetTestOffset>, "SetTestOffset"}, + {100, D<&SteadyClock::GetRtcValue>, "GetRtcValue"}, + {101, D<&SteadyClock::IsRtcResetDetected>, "IsRtcResetDetected"}, + {102, D<&SteadyClock::GetSetupResultValue>, "GetSetupResultValue"}, + {200, D<&SteadyClock::GetInternalOffset>, "GetInternalOffset"}, + }; + // clang-format on + RegisterHandlers(functions); +} Result SteadyClock::GetCurrentTimePoint(Out out_time_point) { SCOPE_EXIT { diff --git a/src/core/hle/service/psc/time/steady_clock.h b/src/core/hle/service/psc/time/steady_clock.h index e4de3e3717..8d3d9a6280 100644 --- a/src/core/hle/service/psc/time/steady_clock.h +++ b/src/core/hle/service/psc/time/steady_clock.h @@ -34,8 +34,6 @@ public: Result GetSetupResultValue(Out out_result); Result GetInternalOffset(Out out_internal_offset); - std::optional FindRequest(u32 key) override; - private: StandardSteadyClockCore& m_clock_core; bool m_can_write_steady_clock; diff --git a/src/core/hle/service/psc/time/system_clock.cpp b/src/core/hle/service/psc/time/system_clock.cpp index c08eca0b02..e978ffb5e5 100644 --- a/src/core/hle/service/psc/time/system_clock.cpp +++ b/src/core/hle/service/psc/time/system_clock.cpp @@ -11,23 +11,23 @@ namespace Service::PSC::Time { -std::optional SystemClock::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&SystemClock::GetCurrentTime>, "GetCurrentTime"}, - FunctionInfo{1, D<&SystemClock::SetCurrentTime>, "SetCurrentTime"}, - FunctionInfo{2, D<&SystemClock::GetSystemClockContext>, "GetSystemClockContext"}, - FunctionInfo{3, D<&SystemClock::SetSystemClockContext>, "SetSystemClockContext"}, - FunctionInfo{4, D<&SystemClock::GetOperationEventReadableHandle>, "GetOperationEventReadableHandle"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - SystemClock::SystemClock(Core::System& system_, SystemClockCore& clock_core, bool can_write_clock, bool can_write_uninitialized_clock) : ServiceFramework{system_, "ISystemClock"} , m_clock_core{clock_core} , m_can_write_clock{can_write_clock} , m_can_write_uninitialized_clock{can_write_uninitialized_clock} -{} +{ + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&SystemClock::GetCurrentTime>, "GetCurrentTime"}, + {1, D<&SystemClock::SetCurrentTime>, "SetCurrentTime"}, + {2, D<&SystemClock::GetSystemClockContext>, "GetSystemClockContext"}, + {3, D<&SystemClock::SetSystemClockContext>, "SetSystemClockContext"}, + {4, D<&SystemClock::GetOperationEventReadableHandle>, "GetOperationEventReadableHandle"}, + }; + // clang-format on + RegisterHandlers(functions); +} Result SystemClock::GetCurrentTime(Out out_time) { SCOPE_EXIT { diff --git a/src/core/hle/service/psc/time/system_clock.h b/src/core/hle/service/psc/time/system_clock.h index 4f7d285d39..0d91aaa735 100644 --- a/src/core/hle/service/psc/time/system_clock.h +++ b/src/core/hle/service/psc/time/system_clock.h @@ -31,7 +31,6 @@ public: Result GetOperationEventReadableHandle(OutCopyHandle out_event); private: - std::optional FindRequest(u32 key) override; SystemClockCore& m_clock_core; bool m_can_write_clock; bool m_can_write_uninitialized_clock; diff --git a/src/core/hle/service/psc/time/time_zone.cpp b/src/core/hle/service/psc/time/time_zone.cpp index 81bfb90929..e537a821db 100644 --- a/src/core/hle/service/psc/time/time_zone.cpp +++ b/src/core/hle/service/psc/time/time_zone.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/psc/time/time_zone.h b/src/core/hle/service/psc/time/time_zone.h index 0e4ed6ed00..68a235e440 100644 --- a/src/core/hle/service/psc/time/time_zone.h +++ b/src/core/hle/service/psc/time/time_zone.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/psc/time/time_zone_service.cpp b/src/core/hle/service/psc/time/time_zone_service.cpp index 6a717846d3..bd6bb3ba93 100644 --- a/src/core/hle/service/psc/time/time_zone_service.cpp +++ b/src/core/hle/service/psc/time/time_zone_service.cpp @@ -13,33 +13,33 @@ namespace Service::PSC::Time { - std::optional TimeZoneService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&TimeZoneService::GetDeviceLocationName>, "GetDeviceLocationName"}, - FunctionInfo{1, D<&TimeZoneService::SetDeviceLocationName>, "SetDeviceLocationName"}, - FunctionInfo{2, D<&TimeZoneService::GetTotalLocationNameCount>, "GetTotalLocationNameCount"}, - FunctionInfo{3, D<&TimeZoneService::LoadLocationNameList>, "LoadLocationNameList"}, - FunctionInfo{4, D<&TimeZoneService::LoadTimeZoneRule>, "LoadTimeZoneRule"}, - FunctionInfo{5, D<&TimeZoneService::GetTimeZoneRuleVersion>, "GetTimeZoneRuleVersion"}, - FunctionInfo{6, D<&TimeZoneService::GetDeviceLocationNameAndUpdatedTime>, "GetDeviceLocationNameAndUpdatedTime"}, - FunctionInfo{7, D<&TimeZoneService::SetDeviceLocationNameWithTimeZoneRule>, "SetDeviceLocationNameWithTimeZoneRule"}, - FunctionInfo{8, D<&TimeZoneService::ParseTimeZoneBinary>, "ParseTimeZoneBinary"}, - FunctionInfo{20, D<&TimeZoneService::GetDeviceLocationNameOperationEventReadableHandle>, "GetDeviceLocationNameOperationEventReadableHandle"}, - FunctionInfo{100, D<&TimeZoneService::ToCalendarTime>, "ToCalendarTime"}, - FunctionInfo{101, D<&TimeZoneService::ToCalendarTimeWithMyRule>, "ToCalendarTimeWithMyRule"}, - FunctionInfo{201, D<&TimeZoneService::ToPosixTime>, "ToPosixTime"}, - FunctionInfo{202, D<&TimeZoneService::ToPosixTimeWithMyRule>, "ToPosixTimeWithMyRule"} - ); - return HandlerTableGenerateWithFind(key, functions); - } - TimeZoneService::TimeZoneService(Core::System& system_, StandardSteadyClockCore& clock_core, TimeZone& time_zone, bool can_write_timezone_device_location) : ServiceFramework{system_, "ITimeZoneService"} , m_clock_core{clock_core} , m_time_zone{time_zone} , m_can_write_timezone_device_location{can_write_timezone_device_location} -{} +{ + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&TimeZoneService::GetDeviceLocationName>, "GetDeviceLocationName"}, + {1, D<&TimeZoneService::SetDeviceLocationName>, "SetDeviceLocationName"}, + {2, D<&TimeZoneService::GetTotalLocationNameCount>, "GetTotalLocationNameCount"}, + {3, D<&TimeZoneService::LoadLocationNameList>, "LoadLocationNameList"}, + {4, D<&TimeZoneService::LoadTimeZoneRule>, "LoadTimeZoneRule"}, + {5, D<&TimeZoneService::GetTimeZoneRuleVersion>, "GetTimeZoneRuleVersion"}, + {6, D<&TimeZoneService::GetDeviceLocationNameAndUpdatedTime>, "GetDeviceLocationNameAndUpdatedTime"}, + {7, D<&TimeZoneService::SetDeviceLocationNameWithTimeZoneRule>, "SetDeviceLocationNameWithTimeZoneRule"}, + {8, D<&TimeZoneService::ParseTimeZoneBinary>, "ParseTimeZoneBinary"}, + {20, D<&TimeZoneService::GetDeviceLocationNameOperationEventReadableHandle>, "GetDeviceLocationNameOperationEventReadableHandle"}, + {100, D<&TimeZoneService::ToCalendarTime>, "ToCalendarTime"}, + {101, D<&TimeZoneService::ToCalendarTimeWithMyRule>, "ToCalendarTimeWithMyRule"}, + {201, D<&TimeZoneService::ToPosixTime>, "ToPosixTime"}, + {202, D<&TimeZoneService::ToPosixTimeWithMyRule>, "ToPosixTimeWithMyRule"}, + }; + // clang-format on + RegisterHandlers(functions); +} Result TimeZoneService::GetDeviceLocationName(Out out_location_name) { SCOPE_EXIT { diff --git a/src/core/hle/service/psc/time/time_zone_service.h b/src/core/hle/service/psc/time/time_zone_service.h index fbb107f87c..0067b08258 100644 --- a/src/core/hle/service/psc/time/time_zone_service.h +++ b/src/core/hle/service/psc/time/time_zone_service.h @@ -59,7 +59,6 @@ public: const CalendarTime& calendar_time); private: - std::optional FindRequest(u32 key) override; StandardSteadyClockCore& m_clock_core; TimeZone& m_time_zone; bool m_can_write_timezone_device_location; diff --git a/src/core/hle/service/ptm/psm.cpp b/src/core/hle/service/ptm/psm.cpp index 5cad46f997..41d172b71b 100644 --- a/src/core/hle/service/ptm/psm.cpp +++ b/src/core/hle/service/ptm/psm.cpp @@ -21,13 +21,20 @@ namespace Service::PTM { class IPsmSession final : public ServiceFramework { public: explicit IPsmSession(Core::System& system_) - : ServiceFramework{system_, "IPsmSession"} - , service_context{system_, "IPsmSession"} { - state_change_event = service_context.CreateEvent("IPsmSession::state_change_event"); - } + : ServiceFramework{system_, "IPsmSession"}, service_context{system_, "IPsmSession"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &IPsmSession::BindStateChangeEvent, "BindStateChangeEvent"}, + {1, &IPsmSession::UnbindStateChangeEvent, "UnbindStateChangeEvent"}, + {2, &IPsmSession::SetChargerTypeChangeEventEnabled, "SetChargerTypeChangeEventEnabled"}, + {3, &IPsmSession::SetPowerSupplyChangeEventEnabled, "SetPowerSupplyChangeEventEnabled"}, + {4, &IPsmSession::SetBatteryVoltageStateChangeEventEnabled, "SetBatteryVoltageStateChangeEventEnabled"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); + + state_change_event = service_context.CreateEvent("IPsmSession::state_change_event"); } ~IPsmSession() override { @@ -105,15 +112,8 @@ private: rb.Push(ResultSuccess); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &IPsmSession::BindStateChangeEvent, "BindStateChangeEvent"}, - FunctionInfo{1, &IPsmSession::UnbindStateChangeEvent, "UnbindStateChangeEvent"}, - FunctionInfo{2, &IPsmSession::SetChargerTypeChangeEventEnabled, "SetChargerTypeChangeEventEnabled"}, - FunctionInfo{3, &IPsmSession::SetPowerSupplyChangeEventEnabled, "SetPowerSupplyChangeEventEnabled"}, - FunctionInfo{4, &IPsmSession::SetBatteryVoltageStateChangeEventEnabled, "SetBatteryVoltageStateChangeEventEnabled"} - ); - KernelHelpers::ServiceContext service_context; + bool should_signal_charger_type{}; bool should_signal_power_supply{}; bool should_signal_battery_voltage{}; @@ -122,6 +122,31 @@ private: }; PSM::PSM(Core::System& system_) : ServiceFramework{system_, "psm"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &PSM::GetBatteryChargePercentage, "GetBatteryChargePercentage"}, + {1, &PSM::GetChargerType, "GetChargerType"}, + {2, nullptr, "EnableBatteryCharging"}, + {3, nullptr, "DisableBatteryCharging"}, + {4, nullptr, "IsBatteryChargingEnabled"}, + {5, nullptr, "AcquireControllerPowerSupply"}, + {6, nullptr, "ReleaseControllerPowerSupply"}, + {7, &PSM::OpenSession, "OpenSession"}, + {8, nullptr, "EnableEnoughPowerChargeEmulation"}, + {9, nullptr, "DisableEnoughPowerChargeEmulation"}, + {10, nullptr, "EnableFastBatteryCharging"}, + {11, nullptr, "DisableFastBatteryCharging"}, + {12, &PSM::GetBatteryVoltageState, "GetBatteryVoltageState"}, + {13, nullptr, "GetRawBatteryChargePercentage"}, + {14, nullptr, "IsEnoughPowerSupplied"}, + {15, &PSM::GetBatteryAgePercentage, "GetBatteryAgePercentage"}, + {16, nullptr, "GetBatteryChargeInfoEvent"}, + {17, &PSM::GetBatteryChargeInfoFields, "GetBatteryChargeInfoFields"}, + {18, nullptr, "GetBatteryChargeCalibratedEvent"}, + }; + // clang-format on + + RegisterHandlers(functions); } PSM::~PSM() = default; diff --git a/src/core/hle/service/ptm/psm.h b/src/core/hle/service/ptm/psm.h index fe77b23d79..77c38d1f9b 100644 --- a/src/core/hle/service/ptm/psm.h +++ b/src/core/hle/service/ptm/psm.h @@ -28,31 +28,6 @@ private: void GetBatteryVoltageState(HLERequestContext& ctx); void GetBatteryAgePercentage(HLERequestContext& ctx); void GetBatteryChargeInfoFields(HLERequestContext& ctx); - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &PSM::GetBatteryChargePercentage, "GetBatteryChargePercentage"}, - FunctionInfo{1, &PSM::GetChargerType, "GetChargerType"}, - FunctionInfo{2, nullptr, "EnableBatteryCharging"}, - FunctionInfo{3, nullptr, "DisableBatteryCharging"}, - FunctionInfo{4, nullptr, "IsBatteryChargingEnabled"}, - FunctionInfo{5, nullptr, "AcquireControllerPowerSupply"}, - FunctionInfo{6, nullptr, "ReleaseControllerPowerSupply"}, - FunctionInfo{7, &PSM::OpenSession, "OpenSession"}, - FunctionInfo{8, nullptr, "EnableEnoughPowerChargeEmulation"}, - FunctionInfo{9, nullptr, "DisableEnoughPowerChargeEmulation"}, - FunctionInfo{10, nullptr, "EnableFastBatteryCharging"}, - FunctionInfo{11, nullptr, "DisableFastBatteryCharging"}, - FunctionInfo{12, &PSM::GetBatteryVoltageState, "GetBatteryVoltageState"}, - FunctionInfo{13, nullptr, "GetRawBatteryChargePercentage"}, - FunctionInfo{14, nullptr, "IsEnoughPowerSupplied"}, - FunctionInfo{15, &PSM::GetBatteryAgePercentage, "GetBatteryAgePercentage"}, - FunctionInfo{16, nullptr, "GetBatteryChargeInfoEvent"}, - FunctionInfo{17, &PSM::GetBatteryChargeInfoFields, "GetBatteryChargeInfoFields"}, - FunctionInfo{18, nullptr, "GetBatteryChargeCalibratedEvent"} - ); }; } // namespace Service::PTM diff --git a/src/core/hle/service/ptm/ptm.cpp b/src/core/hle/service/ptm/ptm.cpp index ad474ec411..de1d34a688 100644 --- a/src/core/hle/service/ptm/ptm.cpp +++ b/src/core/hle/service/ptm/ptm.cpp @@ -17,28 +17,28 @@ namespace Service::PTM { class PSM_MANU final : public ServiceFramework { public: explicit PSM_MANU(Core::System& system_) - : ServiceFramework{system_, "psm:manu"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "EnableVdd50StateControl"}, - FunctionInfo{1, nullptr, "DisableVdd50StateControl"}, - FunctionInfo{2, nullptr, "SetVdd50State"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + : ServiceFramework{system_, "psm:manu"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "EnableVdd50StateControl"}, + {1, nullptr, "DisableVdd50StateControl"}, + {2, nullptr, "SetVdd50State"}, + }; + // clang-format on + RegisterHandlers(functions); } }; class POWCTL final : public ServiceFramework { public: explicit POWCTL(Core::System& system_) - : ServiceFramework{system_, "powctl"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "OpenSession"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + : ServiceFramework{system_, "powctl"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "OpenSession"}, + }; + // clang-format on + RegisterHandlers(functions); } }; diff --git a/src/core/hle/service/ptm/ptm.h b/src/core/hle/service/ptm/ptm.h index a0ae03d282..a62877e441 100644 --- a/src/core/hle/service/ptm/ptm.h +++ b/src/core/hle/service/ptm/ptm.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/core/hle/service/ptm/ts.cpp b/src/core/hle/service/ptm/ts.cpp index f22ff2ec69..b1ac0c8f11 100644 --- a/src/core/hle/service/ptm/ts.cpp +++ b/src/core/hle/service/ptm/ts.cpp @@ -19,10 +19,16 @@ enum class Location : u8 { class ISession : public ServiceFramework { public: - explicit ISession(Core::System& system_) : ServiceFramework{system_, "ISession"} {} + explicit ISession(Core::System& system_) : ServiceFramework{system_, "ISession"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetTemperatureRange"}, + {2, nullptr, "SetMeasurementMode"}, + {4, &ISession::GetTemperature, "GetTemperature"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -33,15 +39,20 @@ private: rb.Push(ResultSuccess); rb.Push(temperature); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetTemperatureRange"}, - FunctionInfo{2, nullptr, "SetMeasurementMode"}, - FunctionInfo{4, &ISession::GetTemperature, "GetTemperature"} - ); }; TS::TS(Core::System& system_) : ServiceFramework{system_, "ts"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetTemperatureRange"}, + {1, &TS::GetTemperature, "GetTemperature"}, + {2, nullptr, "SetMeasurementMode"}, + {3, &TS::GetTemperatureMilliC, "GetTemperatureMilliC"}, + {4, &TS::OpenSession, "OpenSession"}, + }; + // clang-format on + + RegisterHandlers(functions); } TS::~TS() = default; diff --git a/src/core/hle/service/ptm/ts.h b/src/core/hle/service/ptm/ts.h index 21f3ac2b70..d8a0d49bf8 100644 --- a/src/core/hle/service/ptm/ts.h +++ b/src/core/hle/service/ptm/ts.h @@ -20,17 +20,6 @@ private: void GetTemperature(HLERequestContext& ctx); void GetTemperatureMilliC(HLERequestContext& ctx); void OpenSession(HLERequestContext& ctx); - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetTemperatureRange"}, - FunctionInfo{1, &TS::GetTemperature, "GetTemperature"}, - FunctionInfo{2, nullptr, "SetMeasurementMode"}, - FunctionInfo{3, &TS::GetTemperatureMilliC, "GetTemperatureMilliC"}, - FunctionInfo{4, &TS::OpenSession, "OpenSession"} - ); }; } // namespace Service::PTM diff --git a/src/core/hle/service/ro/ro.cpp b/src/core/hle/service/ro/ro.cpp index 838ff136f6..167bf04c9a 100644 --- a/src/core/hle/service/ro/ro.cpp +++ b/src/core/hle/service/ro/ro.cpp @@ -8,334 +8,21 @@ #include #include "core/hle/kernel/k_process.h" + +#include "core/hle/service/cmif_serialization.h" #include "core/hle/service/ro/ro.h" +#include "core/hle/service/ro/ro_nro_utils.h" +#include "core/hle/service/ro/ro_results.h" +#include "core/hle/service/ro/ro_types.h" #include "core/hle/service/server_manager.h" #include "core/hle/service/service.h" #ifdef HAS_NCE #include "core/arm/nce/patcher.h" #include "core/hle/kernel/k_shared_memory.h" #endif -#include "core/hle/service/cmif_serialization.h" namespace Service::RO { -constexpr Result ResultOutOfAddressSpace{ErrorModule::RO, 2}; -constexpr Result ResultAlreadyLoaded{ErrorModule::RO, 3}; -constexpr Result ResultInvalidNro{ErrorModule::RO, 4}; -constexpr Result ResultInvalidNrr{ErrorModule::RO, 6}; -constexpr Result ResultTooManyNro{ErrorModule::RO, 7}; -constexpr Result ResultTooManyNrr{ErrorModule::RO, 8}; -constexpr Result ResultNotAuthorized{ErrorModule::RO, 9}; -constexpr Result ResultInvalidNrrKind{ErrorModule::RO, 10}; -constexpr Result ResultInternalError{ErrorModule::RO, 1023}; -constexpr Result ResultInvalidAddress{ErrorModule::RO, 1025}; -constexpr Result ResultInvalidSize{ErrorModule::RO, 1026}; -constexpr Result ResultNotLoaded{ErrorModule::RO, 1028}; -constexpr Result ResultNotRegistered{ErrorModule::RO, 1029}; -constexpr Result ResultInvalidSession{ErrorModule::RO, 1030}; -constexpr Result ResultInvalidProcess{ErrorModule::RO, 1031}; - -namespace { - -struct ProcessMemoryRegion { - u64 address; - u64 size; -}; - -size_t GetTotalProcessMemoryRegionSize(const ProcessMemoryRegion* regions, size_t num_regions) { - size_t total = 0; - - for (size_t i = 0; i < num_regions; ++i) { - total += regions[i].size; - } - - return total; -} - -size_t SetupNroProcessMemoryRegions(ProcessMemoryRegion* regions, u64 nro_heap_address, - u64 nro_heap_size, u64 bss_heap_address, u64 bss_heap_size) { - // Reset region count. - size_t num_regions = 0; - - // We always want a region for the nro. - regions[num_regions++] = {nro_heap_address, nro_heap_size}; - - // If we have bss, create a region for bss. - if (bss_heap_size > 0) { - regions[num_regions++] = {bss_heap_address, bss_heap_size}; - } - - return num_regions; -} - -Result SetProcessMemoryPermission(Kernel::KProcess* process, u64 address, u64 size, - Kernel::Svc::MemoryPermission permission) { - auto& page_table = process->GetPageTable(); - - // Set permission. - R_RETURN(page_table.SetProcessMemoryPermission(address, size, permission)); -} - -Result UnmapProcessCodeMemory(Kernel::KProcess* process, u64 process_code_address, - const ProcessMemoryRegion* regions, size_t num_regions) { - // Get the total process memory region size. - const size_t total_size = GetTotalProcessMemoryRegionSize(regions, num_regions); - - auto& page_table = process->GetPageTable(); - - // Unmap each region in order. - size_t cur_offset = total_size; - for (size_t i = 0; i < num_regions; ++i) { - // We want to unmap in reverse order. - const auto& cur_region = regions[num_regions - 1 - i]; - - // Subtract to update the current offset. - cur_offset -= cur_region.size; - - // Unmap. - R_TRY(page_table.UnmapCodeMemory(process_code_address + cur_offset, cur_region.address, - cur_region.size)); - } - - R_SUCCEED(); -} - -Result EnsureGuardPages(Kernel::KProcessPageTable& page_table, u64 map_address, u64 map_size) { - Kernel::KMemoryInfo memory_info; - Kernel::Svc::PageInfo page_info; - - // Ensure page before mapping is unmapped. - R_TRY(page_table.QueryInfo(std::addressof(memory_info), std::addressof(page_info), - map_address - 1)); - R_UNLESS(memory_info.GetSvcState() == Kernel::Svc::MemoryState::Free, - Kernel::ResultInvalidState); - - // Ensure page after mapping is unmapped. - R_TRY(page_table.QueryInfo(std::addressof(memory_info), std::addressof(page_info), - map_address + map_size)); - R_UNLESS(memory_info.GetSvcState() == Kernel::Svc::MemoryState::Free, - Kernel::ResultInvalidState); - - // Successfully verified guard pages. - R_SUCCEED(); -} - -Result MapProcessCodeMemory(u64* out, Kernel::KProcess* process, const ProcessMemoryRegion* regions, - size_t num_regions, std::mt19937_64& generate_random) { - auto& page_table = process->GetPageTable(); - const u64 alias_code_start = - GetInteger(page_table.GetAliasCodeRegionStart()) / Kernel::PageSize; - const u64 alias_code_size = page_table.GetAliasCodeRegionSize() / Kernel::PageSize; - - for (size_t trial = 0; trial < 64; trial++) { - // Generate a new trial address. - const u64 mapped_address = - (alias_code_start + (generate_random() % alias_code_size)) * Kernel::PageSize; - - const auto MapRegions = [&] { - // Map the regions in order. - u64 mapped_size = 0; - for (size_t i = 0; i < num_regions; ++i) { - // If we fail, unmap up to where we've mapped. - ON_RESULT_FAILURE { - R_ASSERT(UnmapProcessCodeMemory(process, mapped_address, regions, i)); - }; - - // Map the current region. - R_TRY(page_table.MapCodeMemory(mapped_address + mapped_size, regions[i].address, - regions[i].size)); - - mapped_size += regions[i].size; - } - - // If we fail, unmap all mapped regions. - ON_RESULT_FAILURE { - R_ASSERT(UnmapProcessCodeMemory(process, mapped_address, regions, num_regions)); - }; - - // Ensure guard pages. - R_RETURN(EnsureGuardPages(page_table, mapped_address, mapped_size)); - }; - - if (R_SUCCEEDED(MapRegions())) { - // Set the output address. - *out = mapped_address; - R_SUCCEED(); - } - } - - // We failed to map anything. - R_THROW(RO::ResultOutOfAddressSpace); -} - -Result MapNro(u64* out_base_address, Kernel::KProcess* process, u64 nro_heap_address, - u64 nro_heap_size, u64 bss_heap_address, u64 bss_heap_size, - std::mt19937_64& generate_random) { - // Set up the process memory regions. - std::array regions{}; - const size_t num_regions = SetupNroProcessMemoryRegions( - regions.data(), nro_heap_address, nro_heap_size, bss_heap_address, bss_heap_size); - - // Re-map the nro/bss as code memory in the destination process. - R_RETURN(MapProcessCodeMemory(out_base_address, process, regions.data(), num_regions, - generate_random)); -} - -Result SetNroPerms(Kernel::KProcess* process, u64 base_address, u64 rx_size, u64 ro_size, - u64 rw_size) { - const u64 rx_offset = 0; - const u64 ro_offset = rx_offset + rx_size; - const u64 rw_offset = ro_offset + ro_size; - - R_TRY(SetProcessMemoryPermission(process, base_address + rx_offset, rx_size, - Kernel::Svc::MemoryPermission::ReadExecute)); - R_TRY(SetProcessMemoryPermission(process, base_address + ro_offset, ro_size, - Kernel::Svc::MemoryPermission::Read)); - R_TRY(SetProcessMemoryPermission(process, base_address + rw_offset, rw_size, - Kernel::Svc::MemoryPermission::ReadWrite)); - - R_SUCCEED(); -} - -Result UnmapNro(Kernel::KProcess* process, u64 base_address, u64 nro_heap_address, - u64 nro_heap_size, u64 bss_heap_address, u64 bss_heap_size) { - // Set up the process memory regions. - std::array regions{}; - const size_t num_regions = SetupNroProcessMemoryRegions( - regions.data(), nro_heap_address, nro_heap_size, bss_heap_address, bss_heap_size); - - // Unmap the nro/bss. - R_RETURN(UnmapProcessCodeMemory(process, base_address, regions.data(), num_regions)); -} - -} // namespace - -enum class NrrKind : u8 { - User = 0, - JitPlugin = 1, - Count, -}; - -static constexpr size_t ModuleIdSize = 0x20; -struct ModuleId { - std::array data; -}; -static_assert(sizeof(ModuleId) == ModuleIdSize); - -struct NrrCertification { - static constexpr size_t RsaKeySize = 0x100; - static constexpr size_t SignedSize = 0x120; - - u64 program_id_mask; - u64 program_id_pattern; - std::array reserved_10; - std::array modulus; - std::array signature; -}; -static_assert(sizeof(NrrCertification) == NrrCertification::RsaKeySize + NrrCertification::SignedSize); - -class NrrHeader { -public: - static constexpr u32 Magic = Common::MakeMagic('N', 'R', 'R', '0'); - -public: - bool IsMagicValid() const { - return m_magic == Magic; - } - - bool IsProgramIdValid() const { - return (m_program_id & m_certification.program_id_mask) == - m_certification.program_id_pattern; - } - - NrrKind GetNrrKind() const { - const NrrKind kind = static_cast(m_nrr_kind); - ASSERT(kind < NrrKind::Count); - return kind; - } - - u64 GetProgramId() const { - return m_program_id; - } - - u32 GetSize() const { - return m_size; - } - - u32 GetNumHashes() const { - return m_num_hashes; - } - - size_t GetHashesOffset() const { - return m_hashes_offset; - } - - u32 GetKeyGeneration() const { - return m_key_generation; - } - - const u8* GetCertificationSignature() const { - return m_certification.signature.data(); - } - - const u8* GetCertificationSignedArea() const { - return reinterpret_cast(std::addressof(m_certification)); - } - - const u8* GetCertificationModulus() const { - return m_certification.modulus.data(); - } - - const u8* GetSignature() const { - return m_signature.data(); - } - - size_t GetSignedAreaSize() const { - return m_size - GetSignedAreaOffset(); - } - - static constexpr size_t GetSignedAreaOffset() { - return offsetof(NrrHeader, m_program_id); - } - -private: - u32 m_magic; - u32 m_key_generation; - INSERT_PADDING_BYTES_NOINIT(8); - NrrCertification m_certification; - std::array m_signature; - u64 m_program_id; - u32 m_size; - u8 m_nrr_kind; // 7.0.0+ - INSERT_PADDING_BYTES_NOINIT(3); - u32 m_hashes_offset; - u32 m_num_hashes; - INSERT_PADDING_BYTES_NOINIT(8); -}; -static_assert(sizeof(NrrHeader) == 0x350, "NrrHeader has wrong size"); - -static constexpr u32 NRO_HEADER_MAGIC = Common::MakeMagic('N', 'R', 'O', '0'); -struct NroHeader { - u32 m_entrypoint_insn; - u32 m_mod_offset; - INSERT_PADDING_BYTES_NOINIT(0x8); - u32 m_magic; - INSERT_PADDING_BYTES_NOINIT(0x4); - u32 m_size; - INSERT_PADDING_BYTES_NOINIT(0x4); - u32 m_text_offset; - u32 m_text_size; - u32 m_ro_offset; - u32 m_ro_size; - u32 m_rw_offset; - u32 m_rw_size; - u32 m_bss_size; - INSERT_PADDING_BYTES_NOINIT(0x4); - ModuleId m_module_id; - INSERT_PADDING_BYTES_NOINIT(0x20); -}; -static_assert(sizeof(NroHeader) == 0x80, "NroHeader has wrong size"); - namespace { // Atmosphere defines as follows: @@ -848,21 +535,29 @@ private: class RoInterface : public ServiceFramework { public: - explicit RoInterface(Core::System& system_, const char* name_, std::shared_ptr ro, NrrKind nrr_kind) - : ServiceFramework{system_, name_} - , m_ro(ro) - , m_context_id(InvalidContextId) - , m_nrr_kind(nrr_kind) - {} + explicit RoInterface(Core::System& system_, const char* name_, std::shared_ptr ro, + NrrKind nrr_kind) + : ServiceFramework{system_, name_}, m_ro(ro), m_context_id(InvalidContextId), + m_nrr_kind(nrr_kind) { + + // clang-format off + static const FunctionInfo functions[] = { + {0, C<&RoInterface::MapManualLoadModuleMemory>, "MapManualLoadModuleMemory"}, + {1, C<&RoInterface::UnmapManualLoadModuleMemory>, "UnmapManualLoadModuleMemory"}, + {2, C<&RoInterface::RegisterModuleInfo>, "RegisterModuleInfo"}, + {3, C<&RoInterface::UnregisterModuleInfo>, "UnregisterModuleInfo"}, + {4, C<&RoInterface::RegisterProcessHandle>, "RegisterProcessHandle"}, + {10, C<&RoInterface::RegisterProcessModuleInfo>, "RegisterProcessModuleInfo"}, + }; + // clang-format on + + RegisterHandlers(functions); + } ~RoInterface() { m_ro->UnregisterProcess(system.Kernel(), m_context_id); } - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - Result MapManualLoadModuleMemory(Out out_load_address, ClientProcessId client_pid, u64 nro_address, u64 nro_size, u64 bss_address, u64 bss_size) { R_TRY(m_ro->ValidateProcess(m_context_id, *client_pid)); @@ -899,14 +594,6 @@ public: } private: - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&RoInterface::MapManualLoadModuleMemory>, "MapManualLoadModuleMemory"}, - FunctionInfo{1, C<&RoInterface::UnmapManualLoadModuleMemory>, "UnmapManualLoadModuleMemory"}, - FunctionInfo{2, C<&RoInterface::RegisterModuleInfo>, "RegisterModuleInfo"}, - FunctionInfo{3, C<&RoInterface::UnregisterModuleInfo>, "UnregisterModuleInfo"}, - FunctionInfo{4, C<&RoInterface::RegisterProcessHandle>, "RegisterProcessHandle"}, - FunctionInfo{10, C<&RoInterface::RegisterProcessModuleInfo>, "RegisterProcessModuleInfo"} - ); std::shared_ptr m_ro{}; size_t m_context_id{}; NrrKind m_nrr_kind{}; @@ -919,14 +606,12 @@ class IDebugMonitorInterface final : public ServiceFramework FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + { + static const FunctionInfo functions[] = { + { 0, nullptr, "GetProcessModuleInfo" }, + }; + RegisterHandlers(functions); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetProcessModuleInfo" } - ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/ro/ro.h b/src/core/hle/service/ro/ro.h index 74dc085368..c93aac3833 100644 --- a/src/core/hle/service/ro/ro.h +++ b/src/core/hle/service/ro/ro.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/ro/ro_nro_utils.cpp b/src/core/hle/service/ro/ro_nro_utils.cpp new file mode 100644 index 0000000000..1c2a97619d --- /dev/null +++ b/src/core/hle/service/ro/ro_nro_utils.cpp @@ -0,0 +1,188 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/hle/kernel/k_process.h" +#include "core/hle/service/ro/ro_nro_utils.h" +#include "core/hle/service/ro/ro_results.h" + +namespace Service::RO { + +namespace { + +struct ProcessMemoryRegion { + u64 address; + u64 size; +}; + +size_t GetTotalProcessMemoryRegionSize(const ProcessMemoryRegion* regions, size_t num_regions) { + size_t total = 0; + + for (size_t i = 0; i < num_regions; ++i) { + total += regions[i].size; + } + + return total; +} + +size_t SetupNroProcessMemoryRegions(ProcessMemoryRegion* regions, u64 nro_heap_address, + u64 nro_heap_size, u64 bss_heap_address, u64 bss_heap_size) { + // Reset region count. + size_t num_regions = 0; + + // We always want a region for the nro. + regions[num_regions++] = {nro_heap_address, nro_heap_size}; + + // If we have bss, create a region for bss. + if (bss_heap_size > 0) { + regions[num_regions++] = {bss_heap_address, bss_heap_size}; + } + + return num_regions; +} + +Result SetProcessMemoryPermission(Kernel::KProcess* process, u64 address, u64 size, + Kernel::Svc::MemoryPermission permission) { + auto& page_table = process->GetPageTable(); + + // Set permission. + R_RETURN(page_table.SetProcessMemoryPermission(address, size, permission)); +} + +Result UnmapProcessCodeMemory(Kernel::KProcess* process, u64 process_code_address, + const ProcessMemoryRegion* regions, size_t num_regions) { + // Get the total process memory region size. + const size_t total_size = GetTotalProcessMemoryRegionSize(regions, num_regions); + + auto& page_table = process->GetPageTable(); + + // Unmap each region in order. + size_t cur_offset = total_size; + for (size_t i = 0; i < num_regions; ++i) { + // We want to unmap in reverse order. + const auto& cur_region = regions[num_regions - 1 - i]; + + // Subtract to update the current offset. + cur_offset -= cur_region.size; + + // Unmap. + R_TRY(page_table.UnmapCodeMemory(process_code_address + cur_offset, cur_region.address, + cur_region.size)); + } + + R_SUCCEED(); +} + +Result EnsureGuardPages(Kernel::KProcessPageTable& page_table, u64 map_address, u64 map_size) { + Kernel::KMemoryInfo memory_info; + Kernel::Svc::PageInfo page_info; + + // Ensure page before mapping is unmapped. + R_TRY(page_table.QueryInfo(std::addressof(memory_info), std::addressof(page_info), + map_address - 1)); + R_UNLESS(memory_info.GetSvcState() == Kernel::Svc::MemoryState::Free, + Kernel::ResultInvalidState); + + // Ensure page after mapping is unmapped. + R_TRY(page_table.QueryInfo(std::addressof(memory_info), std::addressof(page_info), + map_address + map_size)); + R_UNLESS(memory_info.GetSvcState() == Kernel::Svc::MemoryState::Free, + Kernel::ResultInvalidState); + + // Successfully verified guard pages. + R_SUCCEED(); +} + +Result MapProcessCodeMemory(u64* out, Kernel::KProcess* process, const ProcessMemoryRegion* regions, + size_t num_regions, std::mt19937_64& generate_random) { + auto& page_table = process->GetPageTable(); + const u64 alias_code_start = + GetInteger(page_table.GetAliasCodeRegionStart()) / Kernel::PageSize; + const u64 alias_code_size = page_table.GetAliasCodeRegionSize() / Kernel::PageSize; + + for (size_t trial = 0; trial < 64; trial++) { + // Generate a new trial address. + const u64 mapped_address = + (alias_code_start + (generate_random() % alias_code_size)) * Kernel::PageSize; + + const auto MapRegions = [&] { + // Map the regions in order. + u64 mapped_size = 0; + for (size_t i = 0; i < num_regions; ++i) { + // If we fail, unmap up to where we've mapped. + ON_RESULT_FAILURE { + R_ASSERT(UnmapProcessCodeMemory(process, mapped_address, regions, i)); + }; + + // Map the current region. + R_TRY(page_table.MapCodeMemory(mapped_address + mapped_size, regions[i].address, + regions[i].size)); + + mapped_size += regions[i].size; + } + + // If we fail, unmap all mapped regions. + ON_RESULT_FAILURE { + R_ASSERT(UnmapProcessCodeMemory(process, mapped_address, regions, num_regions)); + }; + + // Ensure guard pages. + R_RETURN(EnsureGuardPages(page_table, mapped_address, mapped_size)); + }; + + if (R_SUCCEEDED(MapRegions())) { + // Set the output address. + *out = mapped_address; + R_SUCCEED(); + } + } + + // We failed to map anything. + R_THROW(RO::ResultOutOfAddressSpace); +} + +} // namespace + +Result MapNro(u64* out_base_address, Kernel::KProcess* process, u64 nro_heap_address, + u64 nro_heap_size, u64 bss_heap_address, u64 bss_heap_size, + std::mt19937_64& generate_random) { + // Set up the process memory regions. + std::array regions{}; + const size_t num_regions = SetupNroProcessMemoryRegions( + regions.data(), nro_heap_address, nro_heap_size, bss_heap_address, bss_heap_size); + + // Re-map the nro/bss as code memory in the destination process. + R_RETURN(MapProcessCodeMemory(out_base_address, process, regions.data(), num_regions, + generate_random)); +} + +Result SetNroPerms(Kernel::KProcess* process, u64 base_address, u64 rx_size, u64 ro_size, + u64 rw_size) { + const u64 rx_offset = 0; + const u64 ro_offset = rx_offset + rx_size; + const u64 rw_offset = ro_offset + ro_size; + + R_TRY(SetProcessMemoryPermission(process, base_address + rx_offset, rx_size, + Kernel::Svc::MemoryPermission::ReadExecute)); + R_TRY(SetProcessMemoryPermission(process, base_address + ro_offset, ro_size, + Kernel::Svc::MemoryPermission::Read)); + R_TRY(SetProcessMemoryPermission(process, base_address + rw_offset, rw_size, + Kernel::Svc::MemoryPermission::ReadWrite)); + + R_SUCCEED(); +} + +Result UnmapNro(Kernel::KProcess* process, u64 base_address, u64 nro_heap_address, + u64 nro_heap_size, u64 bss_heap_address, u64 bss_heap_size) { + // Set up the process memory regions. + std::array regions{}; + const size_t num_regions = SetupNroProcessMemoryRegions( + regions.data(), nro_heap_address, nro_heap_size, bss_heap_address, bss_heap_size); + + // Unmap the nro/bss. + R_RETURN(UnmapProcessCodeMemory(process, base_address, regions.data(), num_regions)); +} + +} // namespace Service::RO diff --git a/src/core/hle/service/ro/ro_nro_utils.h b/src/core/hle/service/ro/ro_nro_utils.h new file mode 100644 index 0000000000..32b97abed2 --- /dev/null +++ b/src/core/hle/service/ro/ro_nro_utils.h @@ -0,0 +1,29 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include + +#include "common/common_types.h" + +namespace Kernel { +class KProcess; +} + +union Result; + +namespace Service::RO { + +Result MapNro(u64* out_base_address, Kernel::KProcess* process, u64 nro_heap_address, + u64 nro_heap_size, u64 bss_heap_address, u64 bss_heap_size, + std::mt19937_64& generate_random); +Result SetNroPerms(Kernel::KProcess* process, u64 base_address, u64 rx_size, u64 ro_size, + u64 rw_size); +Result UnmapNro(Kernel::KProcess* process, u64 base_address, u64 nro_heap_address, + u64 nro_heap_size, u64 bss_heap_address, u64 bss_heap_size); + +} // namespace Service::RO diff --git a/src/core/hle/service/ro/ro_results.h b/src/core/hle/service/ro/ro_results.h new file mode 100644 index 0000000000..906378bc7f --- /dev/null +++ b/src/core/hle/service/ro/ro_results.h @@ -0,0 +1,29 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/result.h" + +namespace Service::RO { + +constexpr Result ResultOutOfAddressSpace{ErrorModule::RO, 2}; +constexpr Result ResultAlreadyLoaded{ErrorModule::RO, 3}; +constexpr Result ResultInvalidNro{ErrorModule::RO, 4}; +constexpr Result ResultInvalidNrr{ErrorModule::RO, 6}; +constexpr Result ResultTooManyNro{ErrorModule::RO, 7}; +constexpr Result ResultTooManyNrr{ErrorModule::RO, 8}; +constexpr Result ResultNotAuthorized{ErrorModule::RO, 9}; +constexpr Result ResultInvalidNrrKind{ErrorModule::RO, 10}; +constexpr Result ResultInternalError{ErrorModule::RO, 1023}; +constexpr Result ResultInvalidAddress{ErrorModule::RO, 1025}; +constexpr Result ResultInvalidSize{ErrorModule::RO, 1026}; +constexpr Result ResultNotLoaded{ErrorModule::RO, 1028}; +constexpr Result ResultNotRegistered{ErrorModule::RO, 1029}; +constexpr Result ResultInvalidSession{ErrorModule::RO, 1030}; +constexpr Result ResultInvalidProcess{ErrorModule::RO, 1031}; + +} // namespace Service::RO diff --git a/src/core/hle/service/ro/ro_types.h b/src/core/hle/service/ro/ro_types.h new file mode 100644 index 0000000000..8e88f43246 --- /dev/null +++ b/src/core/hle/service/ro/ro_types.h @@ -0,0 +1,142 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "common/assert.h" +#include "common/common_funcs.h" +#include "common/common_types.h" + +namespace Service::RO { + +enum class NrrKind : u8 { + User = 0, + JitPlugin = 1, + Count, +}; + +static constexpr size_t ModuleIdSize = 0x20; +struct ModuleId { + std::array data; +}; +static_assert(sizeof(ModuleId) == ModuleIdSize); + +struct NrrCertification { + static constexpr size_t RsaKeySize = 0x100; + static constexpr size_t SignedSize = 0x120; + + u64 program_id_mask; + u64 program_id_pattern; + std::array reserved_10; + std::array modulus; + std::array signature; +}; +static_assert(sizeof(NrrCertification) == + NrrCertification::RsaKeySize + NrrCertification::SignedSize); + +class NrrHeader { +public: + static constexpr u32 Magic = Common::MakeMagic('N', 'R', 'R', '0'); + +public: + bool IsMagicValid() const { + return m_magic == Magic; + } + + bool IsProgramIdValid() const { + return (m_program_id & m_certification.program_id_mask) == + m_certification.program_id_pattern; + } + + NrrKind GetNrrKind() const { + const NrrKind kind = static_cast(m_nrr_kind); + ASSERT(kind < NrrKind::Count); + return kind; + } + + u64 GetProgramId() const { + return m_program_id; + } + + u32 GetSize() const { + return m_size; + } + + u32 GetNumHashes() const { + return m_num_hashes; + } + + size_t GetHashesOffset() const { + return m_hashes_offset; + } + + u32 GetKeyGeneration() const { + return m_key_generation; + } + + const u8* GetCertificationSignature() const { + return m_certification.signature.data(); + } + + const u8* GetCertificationSignedArea() const { + return reinterpret_cast(std::addressof(m_certification)); + } + + const u8* GetCertificationModulus() const { + return m_certification.modulus.data(); + } + + const u8* GetSignature() const { + return m_signature.data(); + } + + size_t GetSignedAreaSize() const { + return m_size - GetSignedAreaOffset(); + } + + static constexpr size_t GetSignedAreaOffset() { + return offsetof(NrrHeader, m_program_id); + } + +private: + u32 m_magic; + u32 m_key_generation; + INSERT_PADDING_BYTES_NOINIT(8); + NrrCertification m_certification; + std::array m_signature; + u64 m_program_id; + u32 m_size; + u8 m_nrr_kind; // 7.0.0+ + INSERT_PADDING_BYTES_NOINIT(3); + u32 m_hashes_offset; + u32 m_num_hashes; + INSERT_PADDING_BYTES_NOINIT(8); +}; +static_assert(sizeof(NrrHeader) == 0x350, "NrrHeader has wrong size"); + +static constexpr u32 NRO_HEADER_MAGIC = Common::MakeMagic('N', 'R', 'O', '0'); +struct NroHeader { + u32 m_entrypoint_insn; + u32 m_mod_offset; + INSERT_PADDING_BYTES_NOINIT(0x8); + u32 m_magic; + INSERT_PADDING_BYTES_NOINIT(0x4); + u32 m_size; + INSERT_PADDING_BYTES_NOINIT(0x4); + u32 m_text_offset; + u32 m_text_size; + u32 m_ro_offset; + u32 m_ro_size; + u32 m_rw_offset; + u32 m_rw_size; + u32 m_bss_size; + INSERT_PADDING_BYTES_NOINIT(0x4); + ModuleId m_module_id; + INSERT_PADDING_BYTES_NOINIT(0x20); +}; +static_assert(sizeof(NroHeader) == 0x80, "NroHeader has wrong size"); + +} // namespace Service::RO diff --git a/src/core/hle/service/server_manager.h b/src/core/hle/service/server_manager.h index 5173ce46e1..d86d20b7c5 100644 --- a/src/core/hle/service/server_manager.h +++ b/src/core/hle/service/server_manager.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 2c6e8d1c07..225b92a783 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -19,7 +19,6 @@ #include "core/hle/service/service.h" #include "core/hle/service/sm/sm.h" #include "core/reporter.h" -#include "frontend_common/firmware_manager.h" namespace Service { @@ -48,9 +47,24 @@ ServiceFrameworkBase::~ServiceFrameworkBase() { const auto guard = ServiceFrameworkBase::LockService(); } -void ServiceFrameworkBase::ReportUnimplementedFunction(HLERequestContext& ctx, const FunctionInfoBase* info, bool gated) { +void ServiceFrameworkBase::RegisterHandlersBase(const FunctionInfoBase* functions, std::size_t n) { + // Usually this array is sorted by id already, so hint to insert at the end + handlers.reserve(handlers.size() + n); + for (std::size_t i = 0; i < n; ++i) + handlers.emplace_hint(handlers.cend(), functions[i].expected_header, functions[i]); +} + +void ServiceFrameworkBase::RegisterHandlersBaseTipc(const FunctionInfoBase* functions, std::size_t n) { + // Usually this array is sorted by id already, so hint to insert at the end + handlers_tipc.reserve(handlers_tipc.size() + n); + for (std::size_t i = 0; i < n; ++i) + handlers_tipc.emplace_hint(handlers_tipc.cend(), functions[i].expected_header, functions[i]); +} + +void ServiceFrameworkBase::ReportUnimplementedFunction(HLERequestContext& ctx, + const FunctionInfoBase* info) { auto cmd_buf = ctx.CommandBuffer(); - std::string function_name = bool(info) ? info->name : ""; + std::string function_name = info == nullptr ? "" : info->name; fmt::memory_buffer buf; fmt::format_to(std::back_inserter(buf), "function '{}({})': port='{}' cmd_buf={{[0]={:#x}", ctx.GetCommand(), function_name, service_name, cmd_buf[0]); @@ -59,11 +73,7 @@ void ServiceFrameworkBase::ReportUnimplementedFunction(HLERequestContext& ctx, c buf.push_back('}'); system.GetReporter().SaveUnimplementedFunctionReport(ctx, ctx.GetCommand(), function_name, service_name); - if (gated) { - LOG_ERROR(Service, "Version gated {}", fmt::to_string(buf)); - } else { - UNIMPLEMENTED_MSG("Unknown / unimplemented {}", fmt::to_string(buf)); - } + UNIMPLEMENTED_MSG("Unknown / unimplemented {}", fmt::to_string(buf)); if (Settings::values.use_auto_stub) { LOG_WARNING(Service, "Using auto stub fallback!"); IPC::ResponseBuilder rb{ctx, 2}; @@ -71,33 +81,17 @@ void ServiceFrameworkBase::ReportUnimplementedFunction(HLERequestContext& ctx, c } } -[[nodiscard]] static bool VersionGateCheck(Core::System& system, u32 vg) { - u32 const c_maj = FirmwareManager::GetFirmwareVersion(system).first.major; - u32 const c_min = FirmwareManager::GetFirmwareVersion(system).first.minor; - u32 const c_pat = FirmwareManager::GetFirmwareVersion(system).first.micro; - u32 const cg = (c_pat << 0) | (c_min << 4) | (c_maj << 8); - u32 const sg = (vg >> 16) & 0xffff; - u32 const ug = vg & 0xffff; - // feature available after current - if (sg && cg < sg) - return false; - // feature until xxx (0 = up to current) - return ug ? ug >= cg : true; -} - void ServiceFrameworkBase::InvokeRequest(HLERequestContext& ctx) { - const bool is_cmd_read = ctx.GetCommand() == 0; - auto const info = FindRequest(ctx.GetCommand()); - if (!info.has_value() || info->handler_callback == nullptr) - return ReportUnimplementedFunction(ctx, &*info, false); - - if (!VersionGateCheck(system, info->version_gating)) - { - return ReportUnimplementedFunction(ctx, &*info, true); - } + const auto command = ctx.GetCommand(); + auto it = handlers.find(command); + const bool is_cmd_read = command == 0; + FunctionInfoBase const* info = it == handlers.end() ? nullptr : &it->second; + if (info == nullptr || info->handler_callback == nullptr) + return ReportUnimplementedFunction(ctx, info); LOG_TRACE(Service, "{}", MakeFunctionString(info->name, GetServiceName(), ctx.CommandBuffer())); handler_invoker(this, info->handler_callback, ctx); + if (is_i_storage && is_cmd_read) { const auto* const process = ctx.GetThread().GetOwnerProcess(); if (process != nullptr && system.IsNVDECActiveForProcess(process->GetId())) { @@ -107,15 +101,10 @@ void ServiceFrameworkBase::InvokeRequest(HLERequestContext& ctx) { } void ServiceFrameworkBase::InvokeRequestTipc(HLERequestContext& ctx) { - auto const info = FindRequestTipc(ctx.GetCommand()); - if (!info.has_value() || info->handler_callback == nullptr) - return ReportUnimplementedFunction(ctx, &*info, false); - - LOG_ERROR(Service, "check for {} version_gating: {}", info->name, info->version_gating); - if (!VersionGateCheck(system, info->version_gating)) - { - return ReportUnimplementedFunction(ctx, &*info, true); - } + auto it = handlers_tipc.find(ctx.GetCommand()); + FunctionInfoBase const* info = it == handlers_tipc.end() ? nullptr : &it->second; + if (info == nullptr || info->handler_callback == nullptr) + return ReportUnimplementedFunction(ctx, info); LOG_TRACE(Service, "{}", MakeFunctionString(info->name, GetServiceName(), ctx.CommandBuffer())); handler_invoker(this, info->handler_callback, ctx); diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index e8bd8683ea..ea98897e79 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -7,11 +7,7 @@ #pragma once #include -#include #include -#include -#include -#include "frozen/map.h" #include "common/container/unordered_map.h" #include "common/common_types.h" #include "core/hle/service/hle_ipc.h" @@ -81,35 +77,30 @@ protected: [[nodiscard]] virtual std::unique_lock LockService() noexcept { return std::unique_lock{lock_service}; } - - static constexpr u32 MakeVersionGate(std::tuple since, std::tuple until = {0, 0, 0}) { - auto const [s_maj, s_min, s_pat] = since; - auto const [u_maj, u_min, u_pat] = until; - return (u_pat << 0) | (u_min << 4) | (u_maj << 8) - | (s_pat << 16) | (s_min << 20) | (s_maj << 24); - } - - struct FunctionInfoBase { - HandlerFnP handler_callback; - const char* name; - u32 version_gating; - }; - static_assert(std::is_trivially_constructible_v); private: template friend class ServiceFramework; - using InvokerFn = void(ServiceFrameworkBase* object, HandlerFnP member, HLERequestContext& ctx); + struct FunctionInfoBase { + u32 expected_header; + HandlerFnP handler_callback; + const char* name; + }; - explicit ServiceFrameworkBase(Core::System& system_, const char* service_name_, u32 max_sessions_, InvokerFn* handler_invoker_); + using InvokerFn = void(ServiceFrameworkBase* object, HandlerFnP member, + HLERequestContext& ctx); + + explicit ServiceFrameworkBase(Core::System& system_, const char* service_name_, + u32 max_sessions_, InvokerFn* handler_invoker_); ~ServiceFrameworkBase() override; - virtual std::optional FindRequest(u32 key) = 0; - virtual std::optional FindRequestTipc(u32 key) = 0; - - void ReportUnimplementedFunction(HLERequestContext& ctx, const FunctionInfoBase* info, bool gated); + void RegisterHandlersBase(const FunctionInfoBase* functions, std::size_t n); + void RegisterHandlersBaseTipc(const FunctionInfoBase* functions, std::size_t n); + void ReportUnimplementedFunction(HLERequestContext& ctx, const FunctionInfoBase* info); protected: + ::Common::unordered_map handlers; + ::Common::unordered_map handlers_tipc; /// Used to gain exclusive access to the service members, e.g. from CoreTiming thread. std::mutex lock_service; /// System context that the service operates under. @@ -130,7 +121,8 @@ protected: /** * Framework for implementing HLE services. Dispatches on the header id of incoming SyncRequests * based on a table mapping header ids to handler functions. Service implementations should inherit - * from ServiceFramework using the CRTP (`class Foo : public ServiceFramework { ... };`) + * from ServiceFramework using the CRTP (`class Foo : public ServiceFramework { ... };`) and + * populate it with handlers by calling #RegisterHandlers. * * In order to avoid duplicating code in the binary and exposing too many implementation details in * the header, this class is split into a non-templated base (ServiceFrameworkBase) and a template @@ -151,77 +143,50 @@ protected: /// @param expected_header_ request header in the command buffer which will trigger dispatch to this handler /// @param handler_callback_ member function in this service which will be called to handle the request /// @param name_ human-friendly name for the request. Used mostly for logging purposes. - explicit constexpr FunctionInfoTyped(u32 expected_header_, HandlerFnP handler_callback_, const char* name_, u32 version_gating_ = 0) - : handler_callback{handler_callback_} - , name{name_} - , version_gating{version_gating_} - , expected_header{expected_header_} - {} - HandlerFnP handler_callback; - const char* name; - u32 version_gating; - u32 expected_header; + FunctionInfoTyped(u32 expected_header_, HandlerFnP handler_callback_, const char* name_) + : FunctionInfoBase{expected_header_, HandlerFnP(handler_callback_), name_} {} }; using FunctionInfo = FunctionInfoTyped; - // expected_header serves as a key to 'address' function handlers, thus only include the minimal - template - struct FunctionValueInfo { - explicit constexpr FunctionValueInfo(HandlerFnP handler_callback_, const char* name_, u32 version_gating_) - : handler_callback{handler_callback_} - , name{name_} - , version_gating{version_gating_} - {} - HandlerFnP handler_callback; - const char* name; - u32 version_gating; - }; - - template - //requires (std::same_as && ...) - [[nodiscard]] static consteval frozen::map, sizeof...(Ts)> CreateStaticMap(Ts... args) { - return frozen::map, sizeof...(args)>{ - {args.expected_header, FunctionValueInfo{args.handler_callback, args.name, args.version_gating}}... - }; - } - - // Used exclusively by NFC - template - //requires (std::same_as> && ...) - [[nodiscard]] static consteval frozen::map, sizeof...(Ts)> CreateStaticMapWithClass(Ts... args) { - return frozen::map, sizeof...(args)>{ - {args.expected_header, FunctionValueInfo{args.handler_callback, args.name, args.version_gating}}... - }; - } - - template - [[nodiscard]] static std::optional HandlerTableGenerateWithFind(u32 key, T const& map) { - auto const it = map.find(key); - if (it != map.end()) { - auto const r = it->second; - return std::optional{{ - HandlerFnP(r.handler_callback), - r.name, - r.version_gating - }}; - } - return std::nullopt; - } - - /// @brief Initializes the handler with no functions installed. - /// @param system_ The system context to construct this service under. - /// @param service_name_ Name of the service. - /// @param max_sessions_ Maximum number of sessions that can be connected to this service at the - /// same time. + /** + * Initializes the handler with no functions installed. + * + * @param system_ The system context to construct this service under. + * @param service_name_ Name of the service. + * @param max_sessions_ Maximum number of sessions that can be connected to this service at the + * same time. + */ explicit ServiceFramework(Core::System& system_, const char* service_name_, u32 max_sessions_ = ServerSessionCountMax) - : ServiceFrameworkBase(system_, service_name_, max_sessions_, Invoker) - {} + : ServiceFrameworkBase(system_, service_name_, max_sessions_, Invoker) {} - std::optional FindRequest(u32 key) override { - UNREACHABLE(); + /// Registers handlers in the service. + template + void RegisterHandlers(const FunctionInfoTyped (&functions)[N]) { + RegisterHandlers(functions, N); } - std::optional FindRequestTipc(u32 key) override { - UNREACHABLE(); + + /** + * Registers handlers in the service. Usually prefer using the other RegisterHandlers + * overload in order to avoid needing to specify the array size. + */ + template + void RegisterHandlers(const FunctionInfoTyped* functions, std::size_t n) { + RegisterHandlersBase(functions, n); + } + + /// Registers handlers in the service. + template + void RegisterHandlersTipc(const FunctionInfoTyped (&functions)[N]) { + RegisterHandlersTipc(functions, N); + } + + /** + * Registers handlers in the service. Usually prefer using the other RegisterHandlers + * overload in order to avoid needing to specify the array size. + */ + template + void RegisterHandlersTipc(const FunctionInfoTyped* functions, std::size_t n) { + RegisterHandlersBaseTipc(functions, n); } protected: diff --git a/src/core/hle/service/services.h b/src/core/hle/service/services.h index da5281ff29..4072afa3d1 100644 --- a/src/core/hle/service/services.h +++ b/src/core/hle/service/services.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project diff --git a/src/core/hle/service/set/factory_settings_server.cpp b/src/core/hle/service/set/factory_settings_server.cpp index 70d02fab3b..d663283c98 100644 --- a/src/core/hle/service/set/factory_settings_server.cpp +++ b/src/core/hle/service/set/factory_settings_server.cpp @@ -10,6 +10,55 @@ namespace Service::Set { IFactorySettingsServer::IFactorySettingsServer(Core::System& system_) : ServiceFramework{system_, "set:cal"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetBluetoothBdAddress"}, + {1, nullptr, "GetConfigurationId1"}, + {2, nullptr, "GetAccelerometerOffset"}, + {3, nullptr, "GetAccelerometerScale"}, + {4, nullptr, "GetGyroscopeOffset"}, + {5, nullptr, "GetGyroscopeScale"}, + {6, nullptr, "GetWirelessLanMacAddress"}, + {7, nullptr, "GetWirelessLanCountryCodeCount"}, + {8, nullptr, "GetWirelessLanCountryCodes"}, + {9, nullptr, "GetSerialNumber"}, + {10, nullptr, "SetInitialSystemAppletProgramId"}, + {11, nullptr, "SetOverlayDispProgramId"}, + {12, nullptr, "GetBatteryLot"}, + {14, nullptr, "GetEciDeviceCertificate"}, + {15, nullptr, "GetEticketDeviceCertificate"}, + {16, nullptr, "GetSslKey"}, + {17, nullptr, "GetSslCertificate"}, + {18, nullptr, "GetGameCardKey"}, + {19, nullptr, "GetGameCardCertificate"}, + {20, nullptr, "GetEciDeviceKey"}, + {21, nullptr, "GetEticketDeviceKey"}, + {22, nullptr, "GetSpeakerParameter"}, + {23, nullptr, "GetLcdVendorId"}, + {24, nullptr, "GetEciDeviceCertificate2"}, + {25, nullptr, "GetEciDeviceKey2"}, + {26, nullptr, "GetAmiiboKey"}, + {27, nullptr, "GetAmiiboEcqvCertificate"}, + {28, nullptr, "GetAmiiboEcdsaCertificate"}, + {29, nullptr, "GetAmiiboEcqvBlsKey"}, + {30, nullptr, "GetAmiiboEcqvBlsCertificate"}, + {31, nullptr, "GetAmiiboEcqvBlsRootCertificate"}, + {32, nullptr, "GetUsbTypeCPowerSourceCircuitVersion"}, + {33, nullptr, "GetAnalogStickModuleTypeL"}, + {34, nullptr, "GetAnalogStickModelParameterL"}, + {35, nullptr, "GetAnalogStickFactoryCalibrationL"}, + {36, nullptr, "GetAnalogStickModuleTypeR"}, + {37, nullptr, "GetAnalogStickModelParameterR"}, + {38, nullptr, "GetAnalogStickFactoryCalibrationR"}, + {39, nullptr, "GetConsoleSixAxisSensorModuleType"}, + {40, nullptr, "GetConsoleSixAxisSensorHorizontalOffset"}, + {41, nullptr, "GetBatteryVersion"}, + {42, nullptr, "GetDeviceId"}, + {43, nullptr, "GetConsoleSixAxisSensorMountType"}, + }; + // clang-format on + + RegisterHandlers(functions); } IFactorySettingsServer::~IFactorySettingsServer() = default; diff --git a/src/core/hle/service/set/factory_settings_server.h b/src/core/hle/service/set/factory_settings_server.h index dcc329f9c2..ddffcee643 100644 --- a/src/core/hle/service/set/factory_settings_server.h +++ b/src/core/hle/service/set/factory_settings_server.h @@ -18,55 +18,6 @@ class IFactorySettingsServer final : public ServiceFramework FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetBluetoothBdAddress"}, - FunctionInfo{1, nullptr, "GetConfigurationId1"}, - FunctionInfo{2, nullptr, "GetAccelerometerOffset"}, - FunctionInfo{3, nullptr, "GetAccelerometerScale"}, - FunctionInfo{4, nullptr, "GetGyroscopeOffset"}, - FunctionInfo{5, nullptr, "GetGyroscopeScale"}, - FunctionInfo{6, nullptr, "GetWirelessLanMacAddress"}, - FunctionInfo{7, nullptr, "GetWirelessLanCountryCodeCount"}, - FunctionInfo{8, nullptr, "GetWirelessLanCountryCodes"}, - FunctionInfo{9, nullptr, "GetSerialNumber"}, - FunctionInfo{10, nullptr, "SetInitialSystemAppletProgramId"}, - FunctionInfo{11, nullptr, "SetOverlayDispProgramId"}, - FunctionInfo{12, nullptr, "GetBatteryLot"}, - FunctionInfo{14, nullptr, "GetEciDeviceCertificate"}, - FunctionInfo{15, nullptr, "GetEticketDeviceCertificate"}, - FunctionInfo{16, nullptr, "GetSslKey"}, - FunctionInfo{17, nullptr, "GetSslCertificate"}, - FunctionInfo{18, nullptr, "GetGameCardKey"}, - FunctionInfo{19, nullptr, "GetGameCardCertificate"}, - FunctionInfo{20, nullptr, "GetEciDeviceKey"}, - FunctionInfo{21, nullptr, "GetEticketDeviceKey"}, - FunctionInfo{22, nullptr, "GetSpeakerParameter"}, - FunctionInfo{23, nullptr, "GetLcdVendorId"}, - FunctionInfo{24, nullptr, "GetEciDeviceCertificate2"}, - FunctionInfo{25, nullptr, "GetEciDeviceKey2"}, - FunctionInfo{26, nullptr, "GetAmiiboKey"}, - FunctionInfo{27, nullptr, "GetAmiiboEcqvCertificate"}, - FunctionInfo{28, nullptr, "GetAmiiboEcdsaCertificate"}, - FunctionInfo{29, nullptr, "GetAmiiboEcqvBlsKey"}, - FunctionInfo{30, nullptr, "GetAmiiboEcqvBlsCertificate"}, - FunctionInfo{31, nullptr, "GetAmiiboEcqvBlsRootCertificate"}, - FunctionInfo{32, nullptr, "GetUsbTypeCPowerSourceCircuitVersion"}, - FunctionInfo{33, nullptr, "GetAnalogStickModuleTypeL"}, - FunctionInfo{34, nullptr, "GetAnalogStickModelParameterL"}, - FunctionInfo{35, nullptr, "GetAnalogStickFactoryCalibrationL"}, - FunctionInfo{36, nullptr, "GetAnalogStickModuleTypeR"}, - FunctionInfo{37, nullptr, "GetAnalogStickModelParameterR"}, - FunctionInfo{38, nullptr, "GetAnalogStickFactoryCalibrationR"}, - FunctionInfo{39, nullptr, "GetConsoleSixAxisSensorModuleType"}, - FunctionInfo{40, nullptr, "GetConsoleSixAxisSensorHorizontalOffset"}, - FunctionInfo{41, nullptr, "GetBatteryVersion"}, - FunctionInfo{42, nullptr, "GetDeviceId"}, - FunctionInfo{43, nullptr, "GetConsoleSixAxisSensorMountType"} - ); }; } // namespace Service::Set diff --git a/src/core/hle/service/set/firmware_debug_settings_server.cpp b/src/core/hle/service/set/firmware_debug_settings_server.cpp index 35fb43f7e7..c491675567 100644 --- a/src/core/hle/service/set/firmware_debug_settings_server.cpp +++ b/src/core/hle/service/set/firmware_debug_settings_server.cpp @@ -10,6 +10,23 @@ namespace Service::Set { IFirmwareDebugSettingsServer::IFirmwareDebugSettingsServer(Core::System& system_) : ServiceFramework{system_, "set:fd"} { + // clang-format off + static const FunctionInfo functions[] = { + {2, nullptr, "SetSettingsItemValue"}, + {3, nullptr, "ResetSettingsItemValue"}, + {4, nullptr, "CreateSettingsItemKeyIterator"}, + {10, nullptr, "ReadSettings"}, + {11, nullptr, "ResetSettings"}, + {20, nullptr, "SetWebInspectorFlag"}, + {21, nullptr, "SetAllowedSslHosts"}, + {22, nullptr, "SetHostFsMountPoint"}, + {23, nullptr, "SetMemoryUsageRateFlag"}, + {24, nullptr, "CommitSettings"}, //20.0.0+ + {27, nullptr, "SetHttpAuthConfigs"}, //21.0.0+ + }; + // clang-format on + + RegisterHandlers(functions); } IFirmwareDebugSettingsServer::~IFirmwareDebugSettingsServer() = default; diff --git a/src/core/hle/service/set/firmware_debug_settings_server.h b/src/core/hle/service/set/firmware_debug_settings_server.h index 3727a1a94c..05019faa9f 100644 --- a/src/core/hle/service/set/firmware_debug_settings_server.h +++ b/src/core/hle/service/set/firmware_debug_settings_server.h @@ -18,23 +18,6 @@ class IFirmwareDebugSettingsServer final : public ServiceFramework FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{2, nullptr, "SetSettingsItemValue"}, - FunctionInfo{3, nullptr, "ResetSettingsItemValue"}, - FunctionInfo{4, nullptr, "CreateSettingsItemKeyIterator"}, - FunctionInfo{10, nullptr, "ReadSettings"}, - FunctionInfo{11, nullptr, "ResetSettings"}, - FunctionInfo{20, nullptr, "SetWebInspectorFlag"}, - FunctionInfo{21, nullptr, "SetAllowedSslHosts"}, - FunctionInfo{22, nullptr, "SetHostFsMountPoint"}, - FunctionInfo{23, nullptr, "SetMemoryUsageRateFlag"}, - FunctionInfo{24, nullptr, "CommitSettings", MakeVersionGate({20,0,0})}, - FunctionInfo{27, nullptr, "SetHttpAuthConfigs", MakeVersionGate({21,0,0})} - ); }; } // namespace Service::Set diff --git a/src/core/hle/service/set/key_code_map.h b/src/core/hle/service/set/key_code_map.h index c76dc57298..8e010e718b 100644 --- a/src/core/hle/service/set/key_code_map.h +++ b/src/core/hle/service/set/key_code_map.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/core/hle/service/set/setting_formats/appln_settings.cpp b/src/core/hle/service/set/setting_formats/appln_settings.cpp index f7c7d5b912..5726a41cdf 100644 --- a/src/core/hle/service/set/setting_formats/appln_settings.cpp +++ b/src/core/hle/service/set/setting_formats/appln_settings.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/set/setting_formats/appln_settings.h b/src/core/hle/service/set/setting_formats/appln_settings.h index ba9af998ab..2128a631e0 100644 --- a/src/core/hle/service/set/setting_formats/appln_settings.h +++ b/src/core/hle/service/set/setting_formats/appln_settings.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/set/setting_formats/device_settings.cpp b/src/core/hle/service/set/setting_formats/device_settings.cpp index 5f295404d9..6e9c321d8e 100644 --- a/src/core/hle/service/set/setting_formats/device_settings.cpp +++ b/src/core/hle/service/set/setting_formats/device_settings.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/set/setting_formats/private_settings.cpp b/src/core/hle/service/set/setting_formats/private_settings.cpp index 81c3624826..c3a67b60eb 100644 --- a/src/core/hle/service/set/setting_formats/private_settings.cpp +++ b/src/core/hle/service/set/setting_formats/private_settings.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/set/setting_formats/private_settings.h b/src/core/hle/service/set/setting_formats/private_settings.h index 6579e95e04..75e3e03886 100644 --- a/src/core/hle/service/set/setting_formats/private_settings.h +++ b/src/core/hle/service/set/setting_formats/private_settings.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/set/setting_formats/system_settings.cpp b/src/core/hle/service/set/setting_formats/system_settings.cpp index 258e213e13..fd70e2ace3 100644 --- a/src/core/hle/service/set/setting_formats/system_settings.cpp +++ b/src/core/hle/service/set/setting_formats/system_settings.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project diff --git a/src/core/hle/service/set/settings.h b/src/core/hle/service/set/settings.h index 03cd4bb661..e6288af2e5 100644 --- a/src/core/hle/service/set/settings.h +++ b/src/core/hle/service/set/settings.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/set/settings_server.cpp b/src/core/hle/service/set/settings_server.cpp index 4580cb723b..942dddc9bc 100644 --- a/src/core/hle/service/set/settings_server.cpp +++ b/src/core/hle/service/set/settings_server.cpp @@ -89,26 +89,26 @@ LanguageCode GetLanguageCodeFromIndex(std::size_t index) { return available_language_codes.at(index); } -std::optional ISettingsServer::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&ISettingsServer::GetLanguageCode>, "GetLanguageCode"}, - FunctionInfo{1, C<&ISettingsServer::GetAvailableLanguageCodes>, "GetAvailableLanguageCodes"}, - FunctionInfo{2, C<&ISettingsServer::MakeLanguageCode>, "MakeLanguageCode"}, - FunctionInfo{3, C<&ISettingsServer::GetAvailableLanguageCodeCount>, "GetAvailableLanguageCodeCount"}, - FunctionInfo{4, C<&ISettingsServer::GetRegionCode>, "GetRegionCode"}, - FunctionInfo{5, C<&ISettingsServer::GetAvailableLanguageCodes2>, "GetAvailableLanguageCodes2"}, - FunctionInfo{6, C<&ISettingsServer::GetAvailableLanguageCodeCount2>, "GetAvailableLanguageCodeCount2"}, - FunctionInfo{7, C<&ISettingsServer::GetKeyCodeMap>, "GetKeyCodeMap"}, - FunctionInfo{8, C<&ISettingsServer::GetQuestFlag>, "GetQuestFlag"}, - FunctionInfo{9, C<&ISettingsServer::GetKeyCodeMap2>, "GetKeyCodeMap2"}, - FunctionInfo{10, nullptr, "GetFirmwareVersionForDebug"}, - FunctionInfo{11, C<&ISettingsServer::GetDeviceNickName>, "GetDeviceNickName"}, - FunctionInfo{12, C<&ISettingsServer::GetKeyCodeMapByPort>, "GetKeyCodeMapByPort"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - ISettingsServer::ISettingsServer(Core::System& system_) : ServiceFramework{system_, "set"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, C<&ISettingsServer::GetLanguageCode>, "GetLanguageCode"}, + {1, C<&ISettingsServer::GetAvailableLanguageCodes>, "GetAvailableLanguageCodes"}, + {2, C<&ISettingsServer::MakeLanguageCode>, "MakeLanguageCode"}, + {3, C<&ISettingsServer::GetAvailableLanguageCodeCount>, "GetAvailableLanguageCodeCount"}, + {4, C<&ISettingsServer::GetRegionCode>, "GetRegionCode"}, + {5, C<&ISettingsServer::GetAvailableLanguageCodes2>, "GetAvailableLanguageCodes2"}, + {6, C<&ISettingsServer::GetAvailableLanguageCodeCount2>, "GetAvailableLanguageCodeCount2"}, + {7, C<&ISettingsServer::GetKeyCodeMap>, "GetKeyCodeMap"}, + {8, C<&ISettingsServer::GetQuestFlag>, "GetQuestFlag"}, + {9, C<&ISettingsServer::GetKeyCodeMap2>, "GetKeyCodeMap2"}, + {10, nullptr, "GetFirmwareVersionForDebug"}, + {11, C<&ISettingsServer::GetDeviceNickName>, "GetDeviceNickName"}, + {12, C<&ISettingsServer::GetKeyCodeMapByPort>, "GetKeyCodeMapByPort"}, + }; + // clang-format on + + RegisterHandlers(functions); } ISettingsServer::~ISettingsServer() = default; diff --git a/src/core/hle/service/set/settings_server.h b/src/core/hle/service/set/settings_server.h index 2aa487b8b1..c37a65cbc9 100644 --- a/src/core/hle/service/set/settings_server.h +++ b/src/core/hle/service/set/settings_server.h @@ -26,19 +26,31 @@ public: private: Result GetLanguageCode(Out out_language_code); - Result GetAvailableLanguageCodes(Out out_count, OutArray language_codes); - Result MakeLanguageCode(Out out_language_code, Language language); - Result GetAvailableLanguageCodeCount(Out out_count); - Result GetRegionCode(Out out_region_code); - Result GetAvailableLanguageCodes2(Out out_count, OutArray language_codes); - Result GetAvailableLanguageCodeCount2(Out out_count); - Result GetKeyCodeMap(OutLargeData out_key_code_map); - Result GetQuestFlag(Out out_quest_flag); - Result GetKeyCodeMap2(OutLargeData out_key_code_map); - Result GetDeviceNickName(OutLargeData, BufferAttr_HipcMapAlias> out_device_name); - Result GetKeyCodeMapByPort(OutLargeData out_key_code_map, u32 port); - std::optional FindRequest(u32 key) override; + Result GetAvailableLanguageCodes(Out out_count, + OutArray language_codes); + + Result MakeLanguageCode(Out out_language_code, Language language); + + Result GetAvailableLanguageCodeCount(Out out_count); + + Result GetRegionCode(Out out_region_code); + + Result GetAvailableLanguageCodes2( + Out out_count, OutArray language_codes); + + Result GetAvailableLanguageCodeCount2(Out out_count); + + Result GetKeyCodeMap(OutLargeData out_key_code_map); + + Result GetQuestFlag(Out out_quest_flag); + + Result GetKeyCodeMap2(OutLargeData out_key_code_map); + + Result GetDeviceNickName( + OutLargeData, BufferAttr_HipcMapAlias> out_device_name); + + Result GetKeyCodeMapByPort(OutLargeData out_key_code_map, u32 port); }; } // namespace Service::Set diff --git a/src/core/hle/service/set/system_settings_server.cpp b/src/core/hle/service/set/system_settings_server.cpp index 925207d927..52642e37f7 100644 --- a/src/core/hle/service/set/system_settings_server.cpp +++ b/src/core/hle/service/set/system_settings_server.cpp @@ -114,239 +114,240 @@ Result GetFirmwareVersionImpl(FirmwareVersionFormat& out_firmware, Core::System& return ResultSuccess; } -std::optional ISystemSettingsServer::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&ISystemSettingsServer::SetLanguageCode>, "SetLanguageCode"}, - FunctionInfo{1, nullptr, "SetNetworkSettings"}, - FunctionInfo{2, nullptr, "GetNetworkSettings"}, - FunctionInfo{3, C<&ISystemSettingsServer::GetFirmwareVersion>, "GetFirmwareVersion"}, - FunctionInfo{4, C<&ISystemSettingsServer::GetFirmwareVersion2>, "GetFirmwareVersion2"}, - FunctionInfo{5, nullptr, "GetFirmwareVersionDigest"}, - FunctionInfo{7, C<&ISystemSettingsServer::GetLockScreenFlag>, "GetLockScreenFlag"}, - FunctionInfo{8, C<&ISystemSettingsServer::SetLockScreenFlag>, "SetLockScreenFlag"}, - FunctionInfo{9, nullptr, "GetBacklightSettings"}, - FunctionInfo{10, nullptr, "SetBacklightSettings"}, - FunctionInfo{11, nullptr, "SetBluetoothDevicesSettings"}, - FunctionInfo{12, nullptr, "GetBluetoothDevicesSettings"}, - FunctionInfo{13, C<&ISystemSettingsServer::GetExternalSteadyClockSourceId>, "GetExternalSteadyClockSourceId"}, - FunctionInfo{14, C<&ISystemSettingsServer::SetExternalSteadyClockSourceId>, "SetExternalSteadyClockSourceId"}, - FunctionInfo{15, C<&ISystemSettingsServer::GetUserSystemClockContext>, "GetUserSystemClockContext"}, - FunctionInfo{16, C<&ISystemSettingsServer::SetUserSystemClockContext>, "SetUserSystemClockContext"}, - FunctionInfo{17, C<&ISystemSettingsServer::GetAccountSettings>, "GetAccountSettings"}, - FunctionInfo{18, C<&ISystemSettingsServer::SetAccountSettings>, "SetAccountSettings"}, - FunctionInfo{19, nullptr, "GetAudioVolume"}, - FunctionInfo{20, nullptr, "SetAudioVolume"}, - FunctionInfo{21, C<&ISystemSettingsServer::GetEulaVersions>, "GetEulaVersions"}, - FunctionInfo{22, C<&ISystemSettingsServer::SetEulaVersions>, "SetEulaVersions"}, - FunctionInfo{23, C<&ISystemSettingsServer::GetColorSetId>, "GetColorSetId"}, - FunctionInfo{24, C<&ISystemSettingsServer::SetColorSetId>, "SetColorSetId"}, - FunctionInfo{25, C<&ISystemSettingsServer::GetConsoleInformationUploadFlag>, "GetConsoleInformationUploadFlag"}, - FunctionInfo{26, C<&ISystemSettingsServer::SetConsoleInformationUploadFlag>, "SetConsoleInformationUploadFlag"}, - FunctionInfo{27, C<&ISystemSettingsServer::GetAutomaticApplicationDownloadFlag>, "GetAutomaticApplicationDownloadFlag"}, - FunctionInfo{28, C<&ISystemSettingsServer::SetAutomaticApplicationDownloadFlag>, "SetAutomaticApplicationDownloadFlag"}, - FunctionInfo{29, C<&ISystemSettingsServer::GetNotificationSettings>, "GetNotificationSettings"}, - FunctionInfo{30, C<&ISystemSettingsServer::SetNotificationSettings>, "SetNotificationSettings"}, - FunctionInfo{31, C<&ISystemSettingsServer::GetAccountNotificationSettings>, "GetAccountNotificationSettings"}, - FunctionInfo{32, C<&ISystemSettingsServer::SetAccountNotificationSettings>, "SetAccountNotificationSettings"}, - FunctionInfo{35, C<&ISystemSettingsServer::GetVibrationMasterVolume>, "GetVibrationMasterVolume"}, - FunctionInfo{36, C<&ISystemSettingsServer::SetVibrationMasterVolume>, "SetVibrationMasterVolume"}, - FunctionInfo{37, C<&ISystemSettingsServer::GetSettingsItemValueSize>, "GetSettingsItemValueSize"}, - FunctionInfo{38, C<&ISystemSettingsServer::GetSettingsItemValue>, "GetSettingsItemValue"}, - FunctionInfo{39, C<&ISystemSettingsServer::GetTvSettings>, "GetTvSettings"}, - FunctionInfo{40, C<&ISystemSettingsServer::SetTvSettings>, "SetTvSettings"}, - FunctionInfo{41, nullptr, "GetEdid"}, - FunctionInfo{42, nullptr, "SetEdid"}, - FunctionInfo{43, C<&ISystemSettingsServer::GetAudioOutputMode>, "GetAudioOutputMode"}, - FunctionInfo{44, C<&ISystemSettingsServer::SetAudioOutputMode>, "SetAudioOutputMode"}, - FunctionInfo{45, C<&ISystemSettingsServer::GetSpeakerAutoMuteFlag>, "GetSpeakerAutoMuteFlag"}, - FunctionInfo{46, C<&ISystemSettingsServer::SetSpeakerAutoMuteFlag>, "SetSpeakerAutoMuteFlag"}, - FunctionInfo{47, C<&ISystemSettingsServer::GetQuestFlag>, "GetQuestFlag"}, - FunctionInfo{48, C<&ISystemSettingsServer::SetQuestFlag>, "SetQuestFlag"}, - FunctionInfo{49, nullptr, "GetDataDeletionSettings"}, - FunctionInfo{50, nullptr, "SetDataDeletionSettings"}, - FunctionInfo{51, nullptr, "GetInitialSystemAppletProgramId"}, - FunctionInfo{52, nullptr, "GetOverlayDispProgramId"}, - FunctionInfo{53, C<&ISystemSettingsServer::GetDeviceTimeZoneLocationName>, "GetDeviceTimeZoneLocationName"}, - FunctionInfo{54, C<&ISystemSettingsServer::SetDeviceTimeZoneLocationName>, "SetDeviceTimeZoneLocationName"}, - FunctionInfo{55, nullptr, "GetWirelessCertificationFileSize"}, - FunctionInfo{56, nullptr, "GetWirelessCertificationFile"}, - FunctionInfo{57, C<&ISystemSettingsServer::SetRegionCode>, "SetRegionCode"}, - FunctionInfo{58, C<&ISystemSettingsServer::GetNetworkSystemClockContext>, "GetNetworkSystemClockContext"}, - FunctionInfo{59, C<&ISystemSettingsServer::SetNetworkSystemClockContext>, "SetNetworkSystemClockContext"}, - FunctionInfo{60, C<&ISystemSettingsServer::IsUserSystemClockAutomaticCorrectionEnabled>, "IsUserSystemClockAutomaticCorrectionEnabled"}, - FunctionInfo{61, C<&ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionEnabled>, "SetUserSystemClockAutomaticCorrectionEnabled"}, - FunctionInfo{62, C<&ISystemSettingsServer::GetDebugModeFlag>, "GetDebugModeFlag"}, - FunctionInfo{63, C<&ISystemSettingsServer::GetPrimaryAlbumStorage>, "GetPrimaryAlbumStorage"}, - FunctionInfo{64, C<&ISystemSettingsServer::SetPrimaryAlbumStorage>, "SetPrimaryAlbumStorage"}, - FunctionInfo{65, C<&ISystemSettingsServer::GetUsb30EnableFlag>, "GetUsb30EnableFlag"}, - FunctionInfo{66, C<&ISystemSettingsServer::SetUsb30EnableFlag>, "SetUsb30EnableFlag"}, - FunctionInfo{67, C<&ISystemSettingsServer::GetBatteryLot>, "GetBatteryLot"}, - FunctionInfo{68, C<&ISystemSettingsServer::GetSerialNumber>, "GetSerialNumber"}, - FunctionInfo{69, C<&ISystemSettingsServer::GetNfcEnableFlag>, "GetNfcEnableFlag"}, - FunctionInfo{70, C<&ISystemSettingsServer::SetNfcEnableFlag>, "SetNfcEnableFlag"}, - FunctionInfo{71, C<&ISystemSettingsServer::GetSleepSettings>, "GetSleepSettings"}, - FunctionInfo{72, C<&ISystemSettingsServer::SetSleepSettings>, "SetSleepSettings"}, - FunctionInfo{73, C<&ISystemSettingsServer::GetWirelessLanEnableFlag>, "GetWirelessLanEnableFlag"}, - FunctionInfo{74, C<&ISystemSettingsServer::SetWirelessLanEnableFlag>, "SetWirelessLanEnableFlag"}, - FunctionInfo{75, C<&ISystemSettingsServer::GetInitialLaunchSettings>, "GetInitialLaunchSettings"}, - FunctionInfo{76, C<&ISystemSettingsServer::SetInitialLaunchSettings>, "SetInitialLaunchSettings"}, - FunctionInfo{77, C<&ISystemSettingsServer::GetDeviceNickName>, "GetDeviceNickName"}, - FunctionInfo{78, C<&ISystemSettingsServer::SetDeviceNickName>, "SetDeviceNickName"}, - FunctionInfo{79, C<&ISystemSettingsServer::GetProductModel>, "GetProductModel"}, - FunctionInfo{80, nullptr, "GetLdnChannel"}, - FunctionInfo{81, nullptr, "SetLdnChannel"}, - FunctionInfo{82, nullptr, "AcquireTelemetryDirtyFlagEventHandle"}, - FunctionInfo{83, nullptr, "GetTelemetryDirtyFlags"}, - FunctionInfo{84, nullptr, "GetPtmBatteryLot"}, - FunctionInfo{85, nullptr, "SetPtmBatteryLot"}, - FunctionInfo{86, nullptr, "GetPtmFuelGaugeParameter"}, - FunctionInfo{87, nullptr, "SetPtmFuelGaugeParameter"}, - FunctionInfo{88, C<&ISystemSettingsServer::GetBluetoothEnableFlag>, "GetBluetoothEnableFlag"}, - FunctionInfo{89, C<&ISystemSettingsServer::SetBluetoothEnableFlag>, "SetBluetoothEnableFlag"}, - FunctionInfo{90, C<&ISystemSettingsServer::GetMiiAuthorId>, "GetMiiAuthorId"}, - FunctionInfo{91, nullptr, "SetShutdownRtcValue"}, - FunctionInfo{92, nullptr, "GetShutdownRtcValue"}, - FunctionInfo{93, nullptr, "AcquireFatalDirtyFlagEventHandle"}, - FunctionInfo{94, nullptr, "GetFatalDirtyFlags"}, - FunctionInfo{95, C<&ISystemSettingsServer::GetAutoUpdateEnableFlag>, "GetAutoUpdateEnableFlag"}, - FunctionInfo{96, C<&ISystemSettingsServer::SetAutoUpdateEnableFlag>, "SetAutoUpdateEnableFlag"}, - FunctionInfo{97, nullptr, "GetNxControllerSettings"}, - FunctionInfo{98, nullptr, "SetNxControllerSettings"}, - FunctionInfo{99, C<&ISystemSettingsServer::GetBatteryPercentageFlag>, "GetBatteryPercentageFlag"}, - FunctionInfo{100, C<&ISystemSettingsServer::SetBatteryPercentageFlag>, "SetBatteryPercentageFlag"}, - FunctionInfo{101, nullptr, "GetExternalRtcResetFlag"}, - FunctionInfo{102, nullptr, "SetExternalRtcResetFlag"}, - FunctionInfo{103, nullptr, "GetUsbFullKeyEnableFlag"}, - FunctionInfo{104, nullptr, "SetUsbFullKeyEnableFlag"}, - FunctionInfo{105, C<&ISystemSettingsServer::SetExternalSteadyClockInternalOffset>, "SetExternalSteadyClockInternalOffset"}, - FunctionInfo{106, C<&ISystemSettingsServer::GetExternalSteadyClockInternalOffset>, "GetExternalSteadyClockInternalOffset"}, - FunctionInfo{107, nullptr, "GetBacklightSettingsEx"}, - FunctionInfo{108, nullptr, "SetBacklightSettingsEx"}, - FunctionInfo{109, nullptr, "GetHeadphoneVolumeWarningCount"}, - FunctionInfo{110, nullptr, "SetHeadphoneVolumeWarningCount"}, - FunctionInfo{111, nullptr, "GetBluetoothAfhEnableFlag"}, - FunctionInfo{112, nullptr, "SetBluetoothAfhEnableFlag"}, - FunctionInfo{113, nullptr, "GetBluetoothBoostEnableFlag"}, - FunctionInfo{114, nullptr, "SetBluetoothBoostEnableFlag"}, - FunctionInfo{115, nullptr, "GetInRepairProcessEnableFlag"}, - FunctionInfo{116, nullptr, "SetInRepairProcessEnableFlag"}, - FunctionInfo{117, nullptr, "GetHeadphoneVolumeUpdateFlag"}, - FunctionInfo{118, nullptr, "SetHeadphoneVolumeUpdateFlag"}, - FunctionInfo{119, nullptr, "NeedsToUpdateHeadphoneVolume"}, - FunctionInfo{120, C<&ISystemSettingsServer::GetPushNotificationActivityModeOnSleep>, "GetPushNotificationActivityModeOnSleep"}, - FunctionInfo{121, C<&ISystemSettingsServer::SetPushNotificationActivityModeOnSleep>, "SetPushNotificationActivityModeOnSleep"}, - FunctionInfo{122, nullptr, "GetServiceDiscoveryControlSettings"}, - FunctionInfo{123, nullptr, "SetServiceDiscoveryControlSettings"}, - FunctionInfo{124, C<&ISystemSettingsServer::GetErrorReportSharePermission>, "GetErrorReportSharePermission"}, - FunctionInfo{125, C<&ISystemSettingsServer::SetErrorReportSharePermission>, "SetErrorReportSharePermission"}, - FunctionInfo{126, C<&ISystemSettingsServer::GetAppletLaunchFlags>, "GetAppletLaunchFlags"}, - FunctionInfo{127, C<&ISystemSettingsServer::SetAppletLaunchFlags>, "SetAppletLaunchFlags"}, - FunctionInfo{128, nullptr, "GetConsoleSixAxisSensorAccelerationBias"}, - FunctionInfo{129, nullptr, "SetConsoleSixAxisSensorAccelerationBias"}, - FunctionInfo{130, nullptr, "GetConsoleSixAxisSensorAngularVelocityBias"}, - FunctionInfo{131, nullptr, "SetConsoleSixAxisSensorAngularVelocityBias"}, - FunctionInfo{132, nullptr, "GetConsoleSixAxisSensorAccelerationGain"}, - FunctionInfo{133, nullptr, "SetConsoleSixAxisSensorAccelerationGain"}, - FunctionInfo{134, nullptr, "GetConsoleSixAxisSensorAngularVelocityGain"}, - FunctionInfo{135, nullptr, "SetConsoleSixAxisSensorAngularVelocityGain"}, - FunctionInfo{136, C<&ISystemSettingsServer::GetKeyboardLayout>, "GetKeyboardLayout"}, - FunctionInfo{137, C<&ISystemSettingsServer::SetKeyboardLayout>, "SetKeyboardLayout"}, - FunctionInfo{138, nullptr, "GetWebInspectorFlag"}, - FunctionInfo{139, nullptr, "GetAllowedSslHosts"}, - FunctionInfo{140, nullptr, "GetHostFsMountPoint"}, - FunctionInfo{141, nullptr, "GetRequiresRunRepairTimeReviser"}, - FunctionInfo{142, nullptr, "SetRequiresRunRepairTimeReviser"}, - FunctionInfo{143, nullptr, "SetBlePairingSettings"}, - FunctionInfo{144, nullptr, "GetBlePairingSettings"}, - FunctionInfo{145, nullptr, "GetConsoleSixAxisSensorAngularVelocityTimeBias"}, - FunctionInfo{146, nullptr, "SetConsoleSixAxisSensorAngularVelocityTimeBias"}, - FunctionInfo{147, nullptr, "GetConsoleSixAxisSensorAngularAcceleration"}, - FunctionInfo{148, nullptr, "SetConsoleSixAxisSensorAngularAcceleration"}, - FunctionInfo{149, C<&ISystemSettingsServer::GetRebootlessSystemUpdateVersion>, "GetRebootlessSystemUpdateVersion"}, - FunctionInfo{150, C<&ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime>, "GetDeviceTimeZoneLocationUpdatedTime"}, - FunctionInfo{151, C<&ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime>, "SetDeviceTimeZoneLocationUpdatedTime"}, - FunctionInfo{152, C<&ISystemSettingsServer::GetUserSystemClockAutomaticCorrectionUpdatedTime>, "GetUserSystemClockAutomaticCorrectionUpdatedTime"}, - FunctionInfo{153, C<&ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime>, "SetUserSystemClockAutomaticCorrectionUpdatedTime"}, - FunctionInfo{154, nullptr, "GetAccountOnlineStorageSettings"}, - FunctionInfo{155, nullptr, "SetAccountOnlineStorageSettings"}, - FunctionInfo{156, nullptr, "GetPctlReadyFlag"}, - FunctionInfo{157, nullptr, "SetPctlReadyFlag"}, - FunctionInfo{158, nullptr, "GetAnalogStickUserCalibrationL"}, - FunctionInfo{159, nullptr, "SetAnalogStickUserCalibrationL"}, - FunctionInfo{160, nullptr, "GetAnalogStickUserCalibrationR"}, - FunctionInfo{161, nullptr, "SetAnalogStickUserCalibrationR"}, - FunctionInfo{162, nullptr, "GetPtmBatteryVersion"}, - FunctionInfo{163, nullptr, "SetPtmBatteryVersion"}, - FunctionInfo{164, nullptr, "GetUsb30HostEnableFlag"}, - FunctionInfo{165, nullptr, "SetUsb30HostEnableFlag"}, - FunctionInfo{166, nullptr, "GetUsb30DeviceEnableFlag"}, - FunctionInfo{167, nullptr, "SetUsb30DeviceEnableFlag"}, - FunctionInfo{168, nullptr, "GetThemeId"}, - FunctionInfo{169, nullptr, "SetThemeId"}, - FunctionInfo{170, C<&ISystemSettingsServer::GetChineseTraditionalInputMethod>, "GetChineseTraditionalInputMethod"}, - FunctionInfo{171, nullptr, "SetChineseTraditionalInputMethod"}, - FunctionInfo{172, nullptr, "GetPtmCycleCountReliability"}, - FunctionInfo{173, nullptr, "SetPtmCycleCountReliability"}, - FunctionInfo{174, C<&ISystemSettingsServer::GetHomeMenuScheme>, "GetHomeMenuScheme"}, - FunctionInfo{175, nullptr, "GetThemeSettings"}, - FunctionInfo{176, nullptr, "SetThemeSettings"}, - FunctionInfo{177, nullptr, "GetThemeKey"}, - FunctionInfo{178, nullptr, "SetThemeKey"}, - FunctionInfo{179, nullptr, "GetZoomFlag"}, - FunctionInfo{180, nullptr, "SetZoomFlag"}, - FunctionInfo{181, nullptr, "GetT"}, - FunctionInfo{182, nullptr, "SetT"}, - FunctionInfo{183, C<&ISystemSettingsServer::GetPlatformRegion>, "GetPlatformRegion"}, - FunctionInfo{184, C<&ISystemSettingsServer::SetPlatformRegion>, "SetPlatformRegion"}, - FunctionInfo{185, C<&ISystemSettingsServer::GetHomeMenuSchemeModel>, "GetHomeMenuSchemeModel"}, - FunctionInfo{186, nullptr, "GetMemoryUsageRateFlag"}, - FunctionInfo{187, C<&ISystemSettingsServer::GetTouchScreenMode>, "GetTouchScreenMode"}, - FunctionInfo{188, C<&ISystemSettingsServer::SetTouchScreenMode>, "SetTouchScreenMode"}, - FunctionInfo{189, nullptr, "GetButtonConfigSettingsFull"}, - FunctionInfo{190, nullptr, "SetButtonConfigSettingsFull"}, - FunctionInfo{191, nullptr, "GetButtonConfigSettingsEmbedded"}, - FunctionInfo{192, nullptr, "SetButtonConfigSettingsEmbedded"}, - FunctionInfo{193, nullptr, "GetButtonConfigSettingsLeft"}, - FunctionInfo{194, nullptr, "SetButtonConfigSettingsLeft"}, - FunctionInfo{195, nullptr, "GetButtonConfigSettingsRight"}, - FunctionInfo{196, nullptr, "SetButtonConfigSettingsRight"}, - FunctionInfo{197, nullptr, "GetButtonConfigRegisteredSettingsEmbedded"}, - FunctionInfo{198, nullptr, "SetButtonConfigRegisteredSettingsEmbedded"}, - FunctionInfo{199, nullptr, "GetButtonConfigRegisteredSettings"}, - FunctionInfo{200, nullptr, "SetButtonConfigRegisteredSettings"}, - FunctionInfo{201, C<&ISystemSettingsServer::GetFieldTestingFlag>, "GetFieldTestingFlag"}, - FunctionInfo{202, nullptr, "SetFieldTestingFlag"}, - FunctionInfo{203, C<&ISystemSettingsServer::GetPanelCrcMode>, "GetPanelCrcMode"}, - FunctionInfo{204, C<&ISystemSettingsServer::SetPanelCrcMode>, "SetPanelCrcMode"}, - FunctionInfo{205, nullptr, "GetNxControllerSettingsEx"}, - FunctionInfo{206, nullptr, "SetNxControllerSettingsEx"}, - FunctionInfo{207, nullptr, "GetHearingProtectionSafeguardFlag"}, - FunctionInfo{208, nullptr, "SetHearingProtectionSafeguardFlag"}, - FunctionInfo{209, nullptr, "GetHearingProtectionSafeguardRemainingTime"}, - FunctionInfo{210, nullptr, "SetHearingProtectionSafeguardRemainingTime"}, - FunctionInfo{221, nullptr, "GetForceMonauralOutputFlag", MakeVersionGate({17,0,0})}, - FunctionInfo{222, nullptr, "SetForceMonauralOutputFlag", MakeVersionGate({17,0,0})}, - FunctionInfo{251, nullptr, "GetAccountIdentificationSettings", MakeVersionGate({18,0,0})}, - FunctionInfo{252, nullptr, "SetAccountIdentificationSettings", MakeVersionGate({18,0,0})}, - FunctionInfo{263, nullptr, "AcquireVphymDirtyFlagEventHandle", MakeVersionGate({20,0,0})}, - FunctionInfo{264, nullptr, "GetVphymDirtyFlags", MakeVersionGate({20,0,0})}, - FunctionInfo{282, nullptr, "ConvertToProductModel", MakeVersionGate({20,0,0})}, - FunctionInfo{283, nullptr, "ConvertToProductModelName", MakeVersionGate({20,0,0})}, - FunctionInfo{289, nullptr, "GetDefaultAccountIdentificationFlagSet", MakeVersionGate({20,0,0})}, - FunctionInfo{300, nullptr, "AcquirePushNotificationDirtyFlagEventHandle", MakeVersionGate({20,0,0})}, - FunctionInfo{301, nullptr, "GetPushNotificationDirtyFlags", MakeVersionGate({20,0,0})}, - FunctionInfo{306, nullptr, "GetPinCodeReregistrationGuideAccounts", MakeVersionGate({20,0,0})}, - FunctionInfo{307, nullptr, "SetPinCodeReregistrationGuideAccounts", MakeVersionGate({20,0,0})}, - FunctionInfo{315, C<&ISystemSettingsServer::GetHttpAuthConfigs>, "GetHttpAuthConfigs", MakeVersionGate({21,0,0})}, - FunctionInfo{319, C<&ISystemSettingsServer::GetAccountUserSettings>, "GetAccountUserSettings", MakeVersionGate({21,0,0})}, - FunctionInfo{320, nullptr, "SetAccountUserSettings", MakeVersionGate({21,0,0})}, - FunctionInfo{321, C<&ISystemSettingsServer::GetDefaultAccountUserSettings>, "GetDefaultAccountUserSettings", MakeVersionGate({21,0,0})} - ); - return HandlerTableGenerateWithFind(key, functions); -} - ISystemSettingsServer::ISystemSettingsServer(Core::System& system_) - : ServiceFramework{system_, "set:sys"} { + : ServiceFramework{system_, "set:sys"}, m_system{system} { + // clang-format off + static const FunctionInfo functions[] = { + {0, C<&ISystemSettingsServer::SetLanguageCode>, "SetLanguageCode"}, + {1, nullptr, "SetNetworkSettings"}, + {2, nullptr, "GetNetworkSettings"}, + {3, C<&ISystemSettingsServer::GetFirmwareVersion>, "GetFirmwareVersion"}, + {4, C<&ISystemSettingsServer::GetFirmwareVersion2>, "GetFirmwareVersion2"}, + {5, nullptr, "GetFirmwareVersionDigest"}, + {7, C<&ISystemSettingsServer::GetLockScreenFlag>, "GetLockScreenFlag"}, + {8, C<&ISystemSettingsServer::SetLockScreenFlag>, "SetLockScreenFlag"}, + {9, nullptr, "GetBacklightSettings"}, + {10, nullptr, "SetBacklightSettings"}, + {11, nullptr, "SetBluetoothDevicesSettings"}, + {12, nullptr, "GetBluetoothDevicesSettings"}, + {13, C<&ISystemSettingsServer::GetExternalSteadyClockSourceId>, "GetExternalSteadyClockSourceId"}, + {14, C<&ISystemSettingsServer::SetExternalSteadyClockSourceId>, "SetExternalSteadyClockSourceId"}, + {15, C<&ISystemSettingsServer::GetUserSystemClockContext>, "GetUserSystemClockContext"}, + {16, C<&ISystemSettingsServer::SetUserSystemClockContext>, "SetUserSystemClockContext"}, + {17, C<&ISystemSettingsServer::GetAccountSettings>, "GetAccountSettings"}, + {18, C<&ISystemSettingsServer::SetAccountSettings>, "SetAccountSettings"}, + {19, nullptr, "GetAudioVolume"}, + {20, nullptr, "SetAudioVolume"}, + {21, C<&ISystemSettingsServer::GetEulaVersions>, "GetEulaVersions"}, + {22, C<&ISystemSettingsServer::SetEulaVersions>, "SetEulaVersions"}, + {23, C<&ISystemSettingsServer::GetColorSetId>, "GetColorSetId"}, + {24, C<&ISystemSettingsServer::SetColorSetId>, "SetColorSetId"}, + {25, C<&ISystemSettingsServer::GetConsoleInformationUploadFlag>, "GetConsoleInformationUploadFlag"}, + {26, C<&ISystemSettingsServer::SetConsoleInformationUploadFlag>, "SetConsoleInformationUploadFlag"}, + {27, C<&ISystemSettingsServer::GetAutomaticApplicationDownloadFlag>, "GetAutomaticApplicationDownloadFlag"}, + {28, C<&ISystemSettingsServer::SetAutomaticApplicationDownloadFlag>, "SetAutomaticApplicationDownloadFlag"}, + {29, C<&ISystemSettingsServer::GetNotificationSettings>, "GetNotificationSettings"}, + {30, C<&ISystemSettingsServer::SetNotificationSettings>, "SetNotificationSettings"}, + {31, C<&ISystemSettingsServer::GetAccountNotificationSettings>, "GetAccountNotificationSettings"}, + {32, C<&ISystemSettingsServer::SetAccountNotificationSettings>, "SetAccountNotificationSettings"}, + {35, C<&ISystemSettingsServer::GetVibrationMasterVolume>, "GetVibrationMasterVolume"}, + {36, C<&ISystemSettingsServer::SetVibrationMasterVolume>, "SetVibrationMasterVolume"}, + {37, C<&ISystemSettingsServer::GetSettingsItemValueSize>, "GetSettingsItemValueSize"}, + {38, C<&ISystemSettingsServer::GetSettingsItemValue>, "GetSettingsItemValue"}, + {39, C<&ISystemSettingsServer::GetTvSettings>, "GetTvSettings"}, + {40, C<&ISystemSettingsServer::SetTvSettings>, "SetTvSettings"}, + {41, nullptr, "GetEdid"}, + {42, nullptr, "SetEdid"}, + {43, C<&ISystemSettingsServer::GetAudioOutputMode>, "GetAudioOutputMode"}, + {44, C<&ISystemSettingsServer::SetAudioOutputMode>, "SetAudioOutputMode"}, + {45, C<&ISystemSettingsServer::GetSpeakerAutoMuteFlag>, "GetSpeakerAutoMuteFlag"}, + {46, C<&ISystemSettingsServer::SetSpeakerAutoMuteFlag>, "SetSpeakerAutoMuteFlag"}, + {47, C<&ISystemSettingsServer::GetQuestFlag>, "GetQuestFlag"}, + {48, C<&ISystemSettingsServer::SetQuestFlag>, "SetQuestFlag"}, + {49, nullptr, "GetDataDeletionSettings"}, + {50, nullptr, "SetDataDeletionSettings"}, + {51, nullptr, "GetInitialSystemAppletProgramId"}, + {52, nullptr, "GetOverlayDispProgramId"}, + {53, C<&ISystemSettingsServer::GetDeviceTimeZoneLocationName>, "GetDeviceTimeZoneLocationName"}, + {54, C<&ISystemSettingsServer::SetDeviceTimeZoneLocationName>, "SetDeviceTimeZoneLocationName"}, + {55, nullptr, "GetWirelessCertificationFileSize"}, + {56, nullptr, "GetWirelessCertificationFile"}, + {57, C<&ISystemSettingsServer::SetRegionCode>, "SetRegionCode"}, + {58, C<&ISystemSettingsServer::GetNetworkSystemClockContext>, "GetNetworkSystemClockContext"}, + {59, C<&ISystemSettingsServer::SetNetworkSystemClockContext>, "SetNetworkSystemClockContext"}, + {60, C<&ISystemSettingsServer::IsUserSystemClockAutomaticCorrectionEnabled>, "IsUserSystemClockAutomaticCorrectionEnabled"}, + {61, C<&ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionEnabled>, "SetUserSystemClockAutomaticCorrectionEnabled"}, + {62, C<&ISystemSettingsServer::GetDebugModeFlag>, "GetDebugModeFlag"}, + {63, C<&ISystemSettingsServer::GetPrimaryAlbumStorage>, "GetPrimaryAlbumStorage"}, + {64, C<&ISystemSettingsServer::SetPrimaryAlbumStorage>, "SetPrimaryAlbumStorage"}, + {65, C<&ISystemSettingsServer::GetUsb30EnableFlag>, "GetUsb30EnableFlag"}, + {66, C<&ISystemSettingsServer::SetUsb30EnableFlag>, "SetUsb30EnableFlag"}, + {67, C<&ISystemSettingsServer::GetBatteryLot>, "GetBatteryLot"}, + {68, C<&ISystemSettingsServer::GetSerialNumber>, "GetSerialNumber"}, + {69, C<&ISystemSettingsServer::GetNfcEnableFlag>, "GetNfcEnableFlag"}, + {70, C<&ISystemSettingsServer::SetNfcEnableFlag>, "SetNfcEnableFlag"}, + {71, C<&ISystemSettingsServer::GetSleepSettings>, "GetSleepSettings"}, + {72, C<&ISystemSettingsServer::SetSleepSettings>, "SetSleepSettings"}, + {73, C<&ISystemSettingsServer::GetWirelessLanEnableFlag>, "GetWirelessLanEnableFlag"}, + {74, C<&ISystemSettingsServer::SetWirelessLanEnableFlag>, "SetWirelessLanEnableFlag"}, + {75, C<&ISystemSettingsServer::GetInitialLaunchSettings>, "GetInitialLaunchSettings"}, + {76, C<&ISystemSettingsServer::SetInitialLaunchSettings>, "SetInitialLaunchSettings"}, + {77, C<&ISystemSettingsServer::GetDeviceNickName>, "GetDeviceNickName"}, + {78, C<&ISystemSettingsServer::SetDeviceNickName>, "SetDeviceNickName"}, + {79, C<&ISystemSettingsServer::GetProductModel>, "GetProductModel"}, + {80, nullptr, "GetLdnChannel"}, + {81, nullptr, "SetLdnChannel"}, + {82, nullptr, "AcquireTelemetryDirtyFlagEventHandle"}, + {83, nullptr, "GetTelemetryDirtyFlags"}, + {84, nullptr, "GetPtmBatteryLot"}, + {85, nullptr, "SetPtmBatteryLot"}, + {86, nullptr, "GetPtmFuelGaugeParameter"}, + {87, nullptr, "SetPtmFuelGaugeParameter"}, + {88, C<&ISystemSettingsServer::GetBluetoothEnableFlag>, "GetBluetoothEnableFlag"}, + {89, C<&ISystemSettingsServer::SetBluetoothEnableFlag>, "SetBluetoothEnableFlag"}, + {90, C<&ISystemSettingsServer::GetMiiAuthorId>, "GetMiiAuthorId"}, + {91, nullptr, "SetShutdownRtcValue"}, + {92, nullptr, "GetShutdownRtcValue"}, + {93, nullptr, "AcquireFatalDirtyFlagEventHandle"}, + {94, nullptr, "GetFatalDirtyFlags"}, + {95, C<&ISystemSettingsServer::GetAutoUpdateEnableFlag>, "GetAutoUpdateEnableFlag"}, + {96, C<&ISystemSettingsServer::SetAutoUpdateEnableFlag>, "SetAutoUpdateEnableFlag"}, + {97, nullptr, "GetNxControllerSettings"}, + {98, nullptr, "SetNxControllerSettings"}, + {99, C<&ISystemSettingsServer::GetBatteryPercentageFlag>, "GetBatteryPercentageFlag"}, + {100, C<&ISystemSettingsServer::SetBatteryPercentageFlag>, "SetBatteryPercentageFlag"}, + {101, nullptr, "GetExternalRtcResetFlag"}, + {102, nullptr, "SetExternalRtcResetFlag"}, + {103, nullptr, "GetUsbFullKeyEnableFlag"}, + {104, nullptr, "SetUsbFullKeyEnableFlag"}, + {105, C<&ISystemSettingsServer::SetExternalSteadyClockInternalOffset>, "SetExternalSteadyClockInternalOffset"}, + {106, C<&ISystemSettingsServer::GetExternalSteadyClockInternalOffset>, "GetExternalSteadyClockInternalOffset"}, + {107, nullptr, "GetBacklightSettingsEx"}, + {108, nullptr, "SetBacklightSettingsEx"}, + {109, nullptr, "GetHeadphoneVolumeWarningCount"}, + {110, nullptr, "SetHeadphoneVolumeWarningCount"}, + {111, nullptr, "GetBluetoothAfhEnableFlag"}, + {112, nullptr, "SetBluetoothAfhEnableFlag"}, + {113, nullptr, "GetBluetoothBoostEnableFlag"}, + {114, nullptr, "SetBluetoothBoostEnableFlag"}, + {115, nullptr, "GetInRepairProcessEnableFlag"}, + {116, nullptr, "SetInRepairProcessEnableFlag"}, + {117, nullptr, "GetHeadphoneVolumeUpdateFlag"}, + {118, nullptr, "SetHeadphoneVolumeUpdateFlag"}, + {119, nullptr, "NeedsToUpdateHeadphoneVolume"}, + {120, C<&ISystemSettingsServer::GetPushNotificationActivityModeOnSleep>, "GetPushNotificationActivityModeOnSleep"}, + {121, C<&ISystemSettingsServer::SetPushNotificationActivityModeOnSleep>, "SetPushNotificationActivityModeOnSleep"}, + {122, nullptr, "GetServiceDiscoveryControlSettings"}, + {123, nullptr, "SetServiceDiscoveryControlSettings"}, + {124, C<&ISystemSettingsServer::GetErrorReportSharePermission>, "GetErrorReportSharePermission"}, + {125, C<&ISystemSettingsServer::SetErrorReportSharePermission>, "SetErrorReportSharePermission"}, + {126, C<&ISystemSettingsServer::GetAppletLaunchFlags>, "GetAppletLaunchFlags"}, + {127, C<&ISystemSettingsServer::SetAppletLaunchFlags>, "SetAppletLaunchFlags"}, + {128, nullptr, "GetConsoleSixAxisSensorAccelerationBias"}, + {129, nullptr, "SetConsoleSixAxisSensorAccelerationBias"}, + {130, nullptr, "GetConsoleSixAxisSensorAngularVelocityBias"}, + {131, nullptr, "SetConsoleSixAxisSensorAngularVelocityBias"}, + {132, nullptr, "GetConsoleSixAxisSensorAccelerationGain"}, + {133, nullptr, "SetConsoleSixAxisSensorAccelerationGain"}, + {134, nullptr, "GetConsoleSixAxisSensorAngularVelocityGain"}, + {135, nullptr, "SetConsoleSixAxisSensorAngularVelocityGain"}, + {136, C<&ISystemSettingsServer::GetKeyboardLayout>, "GetKeyboardLayout"}, + {137, C<&ISystemSettingsServer::SetKeyboardLayout>, "SetKeyboardLayout"}, + {138, nullptr, "GetWebInspectorFlag"}, + {139, nullptr, "GetAllowedSslHosts"}, + {140, nullptr, "GetHostFsMountPoint"}, + {141, nullptr, "GetRequiresRunRepairTimeReviser"}, + {142, nullptr, "SetRequiresRunRepairTimeReviser"}, + {143, nullptr, "SetBlePairingSettings"}, + {144, nullptr, "GetBlePairingSettings"}, + {145, nullptr, "GetConsoleSixAxisSensorAngularVelocityTimeBias"}, + {146, nullptr, "SetConsoleSixAxisSensorAngularVelocityTimeBias"}, + {147, nullptr, "GetConsoleSixAxisSensorAngularAcceleration"}, + {148, nullptr, "SetConsoleSixAxisSensorAngularAcceleration"}, + {149, C<&ISystemSettingsServer::GetRebootlessSystemUpdateVersion>, "GetRebootlessSystemUpdateVersion"}, + {150, C<&ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime>, "GetDeviceTimeZoneLocationUpdatedTime"}, + {151, C<&ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime>, "SetDeviceTimeZoneLocationUpdatedTime"}, + {152, C<&ISystemSettingsServer::GetUserSystemClockAutomaticCorrectionUpdatedTime>, "GetUserSystemClockAutomaticCorrectionUpdatedTime"}, + {153, C<&ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime>, "SetUserSystemClockAutomaticCorrectionUpdatedTime"}, + {154, nullptr, "GetAccountOnlineStorageSettings"}, + {155, nullptr, "SetAccountOnlineStorageSettings"}, + {156, nullptr, "GetPctlReadyFlag"}, + {157, nullptr, "SetPctlReadyFlag"}, + {158, nullptr, "GetAnalogStickUserCalibrationL"}, + {159, nullptr, "SetAnalogStickUserCalibrationL"}, + {160, nullptr, "GetAnalogStickUserCalibrationR"}, + {161, nullptr, "SetAnalogStickUserCalibrationR"}, + {162, nullptr, "GetPtmBatteryVersion"}, + {163, nullptr, "SetPtmBatteryVersion"}, + {164, nullptr, "GetUsb30HostEnableFlag"}, + {165, nullptr, "SetUsb30HostEnableFlag"}, + {166, nullptr, "GetUsb30DeviceEnableFlag"}, + {167, nullptr, "SetUsb30DeviceEnableFlag"}, + {168, nullptr, "GetThemeId"}, + {169, nullptr, "SetThemeId"}, + {170, C<&ISystemSettingsServer::GetChineseTraditionalInputMethod>, "GetChineseTraditionalInputMethod"}, + {171, nullptr, "SetChineseTraditionalInputMethod"}, + {172, nullptr, "GetPtmCycleCountReliability"}, + {173, nullptr, "SetPtmCycleCountReliability"}, + {174, C<&ISystemSettingsServer::GetHomeMenuScheme>, "GetHomeMenuScheme"}, + {175, nullptr, "GetThemeSettings"}, + {176, nullptr, "SetThemeSettings"}, + {177, nullptr, "GetThemeKey"}, + {178, nullptr, "SetThemeKey"}, + {179, nullptr, "GetZoomFlag"}, + {180, nullptr, "SetZoomFlag"}, + {181, nullptr, "GetT"}, + {182, nullptr, "SetT"}, + {183, C<&ISystemSettingsServer::GetPlatformRegion>, "GetPlatformRegion"}, + {184, C<&ISystemSettingsServer::SetPlatformRegion>, "SetPlatformRegion"}, + {185, C<&ISystemSettingsServer::GetHomeMenuSchemeModel>, "GetHomeMenuSchemeModel"}, + {186, nullptr, "GetMemoryUsageRateFlag"}, + {187, C<&ISystemSettingsServer::GetTouchScreenMode>, "GetTouchScreenMode"}, + {188, C<&ISystemSettingsServer::SetTouchScreenMode>, "SetTouchScreenMode"}, + {189, nullptr, "GetButtonConfigSettingsFull"}, + {190, nullptr, "SetButtonConfigSettingsFull"}, + {191, nullptr, "GetButtonConfigSettingsEmbedded"}, + {192, nullptr, "SetButtonConfigSettingsEmbedded"}, + {193, nullptr, "GetButtonConfigSettingsLeft"}, + {194, nullptr, "SetButtonConfigSettingsLeft"}, + {195, nullptr, "GetButtonConfigSettingsRight"}, + {196, nullptr, "SetButtonConfigSettingsRight"}, + {197, nullptr, "GetButtonConfigRegisteredSettingsEmbedded"}, + {198, nullptr, "SetButtonConfigRegisteredSettingsEmbedded"}, + {199, nullptr, "GetButtonConfigRegisteredSettings"}, + {200, nullptr, "SetButtonConfigRegisteredSettings"}, + {201, C<&ISystemSettingsServer::GetFieldTestingFlag>, "GetFieldTestingFlag"}, + {202, nullptr, "SetFieldTestingFlag"}, + {203, C<&ISystemSettingsServer::GetPanelCrcMode>, "GetPanelCrcMode"}, + {204, C<&ISystemSettingsServer::SetPanelCrcMode>, "SetPanelCrcMode"}, + {205, nullptr, "GetNxControllerSettingsEx"}, + {206, nullptr, "SetNxControllerSettingsEx"}, + {207, nullptr, "GetHearingProtectionSafeguardFlag"}, + {208, nullptr, "SetHearingProtectionSafeguardFlag"}, + {209, nullptr, "GetHearingProtectionSafeguardRemainingTime"}, + {210, nullptr, "SetHearingProtectionSafeguardRemainingTime"}, + {221, nullptr, "GetForceMonauralOutputFlag"}, //17.0.0+ + {222, nullptr, "SetForceMonauralOutputFlag"}, //17.0.0+ + {251, nullptr, "GetAccountIdentificationSettings"}, //18.0.0+ + {252, nullptr, "SetAccountIdentificationSettings"}, //18.0.0+ + {263, nullptr, "AcquireVphymDirtyFlagEventHandle"}, //20.0.0+ + {264, nullptr, "GetVphymDirtyFlags"}, //20.0.0+ + {282, nullptr, "ConvertToProductModel"}, //20.0.0+ + {283, nullptr, "ConvertToProductModelName"}, //20.0.0+ + {289, nullptr, "GetDefaultAccountIdentificationFlagSet"}, //20.0.0+ + {300, nullptr, "AcquirePushNotificationDirtyFlagEventHandle"}, //20.0.0+ + {301, nullptr, "GetPushNotificationDirtyFlags"}, //20.0.0+ + {306, nullptr, "GetPinCodeReregistrationGuideAccounts"}, //20.0.0+ + {307, nullptr, "SetPinCodeReregistrationGuideAccounts"}, //20.0.0+ + {315, C<&ISystemSettingsServer::GetHttpAuthConfigs>, "GetHttpAuthConfigs"}, //21.0.0+ + {319, C<&ISystemSettingsServer::GetAccountUserSettings>, "GetAccountUserSettings"}, //21.0.0+ + {320, nullptr, "SetAccountUserSettings"}, //21.0.0+ + {321, C<&ISystemSettingsServer::GetDefaultAccountUserSettings>, "GetDefaultAccountUserSettings"}, //21.0.0+ + }; + // clang-format on + + RegisterHandlers(functions); + SetupSettings(); m_system_settings.region_code = diff --git a/src/core/hle/service/set/system_settings_server.h b/src/core/hle/service/set/system_settings_server.h index 471ed61176..1d56e61f88 100644 --- a/src/core/hle/service/set/system_settings_server.h +++ b/src/core/hle/service/set/system_settings_server.h @@ -179,7 +179,7 @@ private: void StoreSettings(); void SetSaveNeeded(); - std::optional FindRequest(u32 key) override; + Core::System& m_system; SystemSettings m_system_settings{}; PrivateSettings m_private_settings{}; DeviceSettings m_device_settings{}; diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp index 5c196b3218..c75c5437df 100644 --- a/src/core/hle/service/sm/sm.cpp +++ b/src/core/hle/service/sm/sm.cpp @@ -18,16 +18,7 @@ #include "core/hle/service/ipc_helpers.h" #include "core/hle/service/server_manager.h" #include "core/hle/service/sm/sm.h" -#include "common/assert.h" -#include "common/logging.h" -#include "core/core.h" -#include "core/hle/kernel/k_client_port.h" -#include "core/hle/kernel/k_port.h" -#include "core/hle/kernel/k_scoped_resource_reservation.h" -#include "core/hle/kernel/k_server_session.h" -#include "core/hle/kernel/k_session.h" -#include "core/hle/service/ipc_helpers.h" -#include "core/hle/service/server_manager.h" +#include "core/hle/service/sm/sm_controller.h" namespace Service::SM { @@ -36,116 +27,6 @@ constexpr Result ResultAlreadyRegistered(ErrorModule::SM, 4); constexpr Result ResultInvalidServiceName(ErrorModule::SM, 6); constexpr Result ResultNotRegistered(ErrorModule::SM, 7); -class Controller final : public ServiceFramework { -public: - // https://switchbrew.org/wiki/IPC_Marshalling - explicit Controller(Core::System& system_) : ServiceFramework{system_, "IpcController"} {} - ~Controller() override = default; - - void ConvertCurrentObjectToDomain(HLERequestContext& ctx) { - ASSERT_MSG(!ctx.GetManager()->IsDomain(), "Session is already a domain"); - LOG_DEBUG(Service, "called, server_session={}", ctx.Session()->GetId()); - ctx.GetManager()->ConvertToDomainOnRequestEnd(); - - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(ResultSuccess); - rb.Push(1); // Converted sessions start with 1 request handler - } - - void CloneCurrentObject(HLERequestContext& ctx) { - LOG_DEBUG(Service, "called"); - - auto session_manager = ctx.GetManager(); - - // FIXME: this is duplicated from the SVC, it should just call it instead - // once this is a proper process - - // Reserve a new session from the process resource limit. - Kernel::KScopedResourceReservation session_reservation(system.Kernel(), Kernel::GetCurrentProcessPointer(kernel), Kernel::LimitableResource::SessionCountMax); - ASSERT(session_reservation.Succeeded()); - - // Create the session. - Kernel::KSession* session = Kernel::KSession::Create(kernel); - ASSERT(session != nullptr); - - // Initialize the session. - session->Initialize(kernel, nullptr, 0); - - // Commit the session reservation. - session_reservation.Commit(); - - // Register the session. - Kernel::KSession::Register(kernel, session); - - // Register with server manager. - session_manager->GetServerManager().RegisterSession(&session->GetServerSession(), - session_manager); - - // We succeeded. - IPC::ResponseBuilder rb{ctx, 2, 0, 1, IPC::ResponseBuilder::Flags::AlwaysMoveHandles}; - rb.Push(ResultSuccess); - rb.PushMoveObjects(ctx, session->GetClientSession()); - } - - void CloneCurrentObjectEx(HLERequestContext& ctx) { - LOG_DEBUG(Service, "called"); - - CloneCurrentObject(ctx); - } - - void QueryPointerBufferSize(HLERequestContext& ctx) { - LOG_DEBUG(Service, "called"); - - auto* process = Kernel::GetCurrentProcessPointer(kernel); - ASSERT(process != nullptr); - - u32 buffer_size = process->GetPointerBufferSize(); - if (buffer_size > (std::numeric_limits::max)()) { - LOG_WARNING(Service, "Pointer buffer size exceeds u16 max, clamping"); - buffer_size = (std::numeric_limits::max)(); - } - - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(ResultSuccess); - rb.Push(static_cast(buffer_size)); - } - - void SetPointerBufferSize(HLERequestContext& ctx) { - LOG_DEBUG(Service, "called"); - - auto* process = Kernel::GetCurrentProcessPointer(kernel); - ASSERT(process != nullptr); - - IPC::RequestParser rp{ctx}; - - u32 requested_size = rp.PopRaw(); - - if (requested_size > (std::numeric_limits::max)()) { - LOG_WARNING(Service, "Requested pointer buffer size too large, clamping to 0xFFFF"); - requested_size = (std::numeric_limits::max)(); - } - - process->SetPointerBufferSize(requested_size); - - LOG_INFO(Service, "Pointer buffer size dynamically updated to {:#x} bytes by process", requested_size); - - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); - } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &Controller::ConvertCurrentObjectToDomain, "ConvertCurrentObjectToDomain"}, - FunctionInfo{1, nullptr, "CopyFromCurrentDomain"}, - FunctionInfo{2, &Controller::CloneCurrentObject, "CloneCurrentObject"}, - FunctionInfo{3, &Controller::QueryPointerBufferSize, "QueryPointerBufferSize"}, - FunctionInfo{4, &Controller::CloneCurrentObjectEx, "CloneCurrentObjectEx"}, - FunctionInfo{5, &Controller::SetPointerBufferSize, "SetPointerBufferSize"} //TODO: where does this come from - ); -}; - ServiceManager::ServiceManager(Kernel::KernelCore& kernel_) : kernel{kernel_} { controller_interface = std::make_unique(kernel.System()); } @@ -231,51 +112,6 @@ Result ServiceManager::GetServicePort(Kernel::KClientPort** out_client_port, return ResultSuccess; } -/// Interface to "sm:" service -class SM final : public ServiceFramework { -public: - explicit SM(ServiceManager& service_manager_, Core::System& system_); - ~SM() override; - -private: - void Initialize(HLERequestContext& ctx); - void GetServiceCmif(HLERequestContext& ctx); - void GetServiceTipc(HLERequestContext& ctx); - void RegisterServiceCmif(HLERequestContext& ctx); - void RegisterServiceTipc(HLERequestContext& ctx); - void UnregisterService(HLERequestContext& ctx); - void AtmosphereHasService(HLERequestContext& ctx); - - Result GetServiceImpl(Kernel::KClientSession** out_client_session, HLERequestContext& ctx); - void RegisterServiceImpl(HLERequestContext& ctx, std::string name, u32 max_session_count, bool is_light); - - // TODO: We reuse function list for both TIPC and non-TIPC - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - std::optional FindRequestTipc(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &SM::Initialize, "Initialize"}, - FunctionInfo{1, &SM::GetServiceTipc, "GetService"}, - FunctionInfo{2, &SM::RegisterServiceTipc, "RegisterService"}, - FunctionInfo{3, &SM::UnregisterService, "UnregisterService"}, - FunctionInfo{4, nullptr, "DetachClient"}, - FunctionInfo{65000, nullptr, "AtmosphereInstallMitm"}, - FunctionInfo{65001, nullptr, "AtmosphereUninstallMitm"}, - FunctionInfo{65002, nullptr, "Deprecated_AtmosphereAssociatePidTidForMitm"}, - FunctionInfo{65003, nullptr, "AtmosphereAcknowledgeMitmSession"}, - FunctionInfo{65004, nullptr, "AtmosphereHasMitm"}, - FunctionInfo{65005, nullptr, "AtmosphereWaitMitm"}, - FunctionInfo{65006, nullptr, "AtmosphereDeclareFutureMitm"}, - FunctionInfo{65100, &SM::AtmosphereHasService, "AtmosphereHasService"}, - FunctionInfo{65101, nullptr, "AtmosphereWaitService"} - ); - - ServiceManager& service_manager; -}; - /** * SM::Initialize service function * Inputs: @@ -358,7 +194,7 @@ Result SM::GetServiceImpl(Kernel::KClientSession** out_client_session, HLEReques // Create a new session. Kernel::KClientSession* session{}; - if (const auto result = client_port->CreateSession(system.Kernel(), &session); result.IsError()) { + if (const auto result = client_port->CreateSession(kernel, &session); result.IsError()) { LOG_ERROR(Service_SM, "called service={} -> error {:#08x}", name, result.raw); return result; } @@ -429,7 +265,42 @@ void SM::AtmosphereHasService(HLERequestContext& ctx) { SM::SM(ServiceManager& service_manager_, Core::System& system_) : ServiceFramework{system_, "sm:", 64} , service_manager{service_manager_} -{} + , kernel{system_.Kernel()} +{ + RegisterHandlers({ + {0, &SM::Initialize, "Initialize"}, + {1, &SM::GetServiceCmif, "GetService"}, + {2, &SM::RegisterServiceCmif, "RegisterService"}, + {3, &SM::UnregisterService, "UnregisterService"}, + {4, nullptr, "DetachClient"}, + // TODO: are these non-TIPC as well? + {65000, nullptr, "AtmosphereInstallMitm"}, + {65001, nullptr, "AtmosphereUninstallMitm"}, + {65002, nullptr, "Deprecated_AtmosphereAssociatePidTidForMitm"}, + {65003, nullptr, "AtmosphereAcknowledgeMitmSession"}, + {65004, nullptr, "AtmosphereHasMitm"}, + {65005, nullptr, "AtmosphereWaitMitm"}, + {65006, nullptr, "AtmosphereDeclareFutureMitm"}, + {65100, &SM::AtmosphereHasService, "AtmosphereHasService"}, + {65101, nullptr, "AtmosphereWaitService"}, + }); + RegisterHandlersTipc({ + {0, &SM::Initialize, "Initialize"}, + {1, &SM::GetServiceTipc, "GetService"}, + {2, &SM::RegisterServiceTipc, "RegisterService"}, + {3, &SM::UnregisterService, "UnregisterService"}, + {4, nullptr, "DetachClient"}, + {65000, nullptr, "AtmosphereInstallMitm"}, + {65001, nullptr, "AtmosphereUninstallMitm"}, + {65002, nullptr, "Deprecated_AtmosphereAssociatePidTidForMitm"}, + {65003, nullptr, "AtmosphereAcknowledgeMitmSession"}, + {65004, nullptr, "AtmosphereHasMitm"}, + {65005, nullptr, "AtmosphereWaitMitm"}, + {65006, nullptr, "AtmosphereDeclareFutureMitm"}, + {65100, &SM::AtmosphereHasService, "AtmosphereHasService"}, + {65101, nullptr, "AtmosphereWaitService"}, + }); +} SM::~SM() = default; diff --git a/src/core/hle/service/sm/sm.h b/src/core/hle/service/sm/sm.h index f17fc60080..c520a46fb2 100644 --- a/src/core/hle/service/sm/sm.h +++ b/src/core/hle/service/sm/sm.h @@ -33,7 +33,29 @@ class SessionRequestHandler; namespace Service::SM { class Controller; -class SM; + +/// Interface to "sm:" service +class SM final : public ServiceFramework { +public: + explicit SM(ServiceManager& service_manager_, Core::System& system_); + ~SM() override; + +private: + void Initialize(HLERequestContext& ctx); + void GetServiceCmif(HLERequestContext& ctx); + void GetServiceTipc(HLERequestContext& ctx); + void RegisterServiceCmif(HLERequestContext& ctx); + void RegisterServiceTipc(HLERequestContext& ctx); + void UnregisterService(HLERequestContext& ctx); + void AtmosphereHasService(HLERequestContext& ctx); + + Result GetServiceImpl(Kernel::KClientSession** out_client_session, HLERequestContext& ctx); + void RegisterServiceImpl(HLERequestContext& ctx, std::string name, u32 max_session_count, + bool is_light); + + ServiceManager& service_manager; + Kernel::KernelCore& kernel; +}; class ServiceManager { public: diff --git a/src/core/hle/service/sm/sm_controller.cpp b/src/core/hle/service/sm/sm_controller.cpp new file mode 100644 index 0000000000..125eb4a247 --- /dev/null +++ b/src/core/hle/service/sm/sm_controller.cpp @@ -0,0 +1,128 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "common/assert.h" +#include "common/logging.h" +#include "core/core.h" +#include "core/hle/kernel/k_client_port.h" +#include "core/hle/kernel/k_port.h" +#include "core/hle/kernel/k_scoped_resource_reservation.h" +#include "core/hle/kernel/k_server_session.h" +#include "core/hle/kernel/k_session.h" +#include "core/hle/service/ipc_helpers.h" +#include "core/hle/service/server_manager.h" +#include "core/hle/service/sm/sm_controller.h" + +namespace Service::SM { + +void Controller::ConvertCurrentObjectToDomain(HLERequestContext& ctx) { + ASSERT_MSG(!ctx.GetManager()->IsDomain(), "Session is already a domain"); + LOG_DEBUG(Service, "called, server_session={}", ctx.Session()->GetId()); + ctx.GetManager()->ConvertToDomainOnRequestEnd(); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(1); // Converted sessions start with 1 request handler +} + +void Controller::CloneCurrentObject(HLERequestContext& ctx) { + LOG_DEBUG(Service, "called"); + + auto session_manager = ctx.GetManager(); + + // FIXME: this is duplicated from the SVC, it should just call it instead + // once this is a proper process + + // Reserve a new session from the process resource limit. + Kernel::KScopedResourceReservation session_reservation(system.Kernel(), Kernel::GetCurrentProcessPointer(kernel), Kernel::LimitableResource::SessionCountMax); + ASSERT(session_reservation.Succeeded()); + + // Create the session. + Kernel::KSession* session = Kernel::KSession::Create(kernel); + ASSERT(session != nullptr); + + // Initialize the session. + session->Initialize(kernel, nullptr, 0); + + // Commit the session reservation. + session_reservation.Commit(); + + // Register the session. + Kernel::KSession::Register(kernel, session); + + // Register with server manager. + session_manager->GetServerManager().RegisterSession(&session->GetServerSession(), + session_manager); + + // We succeeded. + IPC::ResponseBuilder rb{ctx, 2, 0, 1, IPC::ResponseBuilder::Flags::AlwaysMoveHandles}; + rb.Push(ResultSuccess); + rb.PushMoveObjects(ctx, session->GetClientSession()); +} + +void Controller::CloneCurrentObjectEx(HLERequestContext& ctx) { + LOG_DEBUG(Service, "called"); + + CloneCurrentObject(ctx); +} + +void Controller::QueryPointerBufferSize(HLERequestContext& ctx) { + LOG_DEBUG(Service, "called"); + + auto* process = Kernel::GetCurrentProcessPointer(kernel); + ASSERT(process != nullptr); + + u32 buffer_size = process->GetPointerBufferSize(); + if (buffer_size > (std::numeric_limits::max)()) { + LOG_WARNING(Service, "Pointer buffer size exceeds u16 max, clamping"); + buffer_size = (std::numeric_limits::max)(); + } + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(static_cast(buffer_size)); +} + +void Controller::SetPointerBufferSize(HLERequestContext& ctx) { + LOG_DEBUG(Service, "called"); + + auto* process = Kernel::GetCurrentProcessPointer(kernel); + ASSERT(process != nullptr); + + IPC::RequestParser rp{ctx}; + + u32 requested_size = rp.PopRaw(); + + if (requested_size > (std::numeric_limits::max)()) { + LOG_WARNING(Service, "Requested pointer buffer size too large, clamping to 0xFFFF"); + requested_size = (std::numeric_limits::max)(); + } + + process->SetPointerBufferSize(requested_size); + + LOG_INFO(Service, "Pointer buffer size dynamically updated to {:#x} bytes by process", requested_size); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + + +// https://switchbrew.org/wiki/IPC_Marshalling +Controller::Controller(Core::System& system_) : ServiceFramework{system_, "IpcController"} { + static const FunctionInfo functions[] = { + {0, &Controller::ConvertCurrentObjectToDomain, "ConvertCurrentObjectToDomain"}, + {1, nullptr, "CopyFromCurrentDomain"}, + {2, &Controller::CloneCurrentObject, "CloneCurrentObject"}, + {3, &Controller::QueryPointerBufferSize, "QueryPointerBufferSize"}, + {4, &Controller::CloneCurrentObjectEx, "CloneCurrentObjectEx"}, + {5, &Controller::SetPointerBufferSize, "SetPointerBufferSize"}, //TODO: where does this come from + }; + RegisterHandlers(functions); +} + +Controller::~Controller() = default; + +} // namespace Service::SM diff --git a/src/core/hle/service/sm/sm_controller.h b/src/core/hle/service/sm/sm_controller.h new file mode 100644 index 0000000000..f1fa327ff7 --- /dev/null +++ b/src/core/hle/service/sm/sm_controller.h @@ -0,0 +1,30 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/service.h" + +namespace Core { +class System; +} + +namespace Service::SM { + +class Controller final : public ServiceFramework { +public: + explicit Controller(Core::System& system_); + ~Controller() override; + +private: + void ConvertCurrentObjectToDomain(HLERequestContext& ctx); + void CloneCurrentObject(HLERequestContext& ctx); + void CloneCurrentObjectEx(HLERequestContext& ctx); + void QueryPointerBufferSize(HLERequestContext& ctx); + void SetPointerBufferSize(HLERequestContext& ctx); +}; + +} // namespace Service::SM diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cpp index 63bd7051ca..0137a3be66 100644 --- a/src/core/hle/service/sockets/bsd.cpp +++ b/src/core/hle/service/sockets/bsd.cpp @@ -1083,6 +1083,59 @@ void BSD_USA::OnProxyPacketReceived(const Network::ProxyPacket& packet) { BSD_USA::BSD_USA(Core::System& system_, const char* name, bool is_user_) : ServiceFramework{system_, name} , is_user{is_user_} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &BSD_USA::RegisterClient, "RegisterClient"}, + {1, &BSD_USA::StartMonitoring, "StartMonitoring"}, + {2, &BSD_USA::Socket, "Socket"}, + {3, &BSD_USA::SocketExempt, "SocketExempt"}, + {4, nullptr, "Open"}, + {5, &BSD_USA::Select, "Select"}, + {6, &BSD_USA::Poll, "Poll"}, + {7, nullptr, "Sysctl"}, + {8, &BSD_USA::Recv, "Recv"}, + {9, &BSD_USA::RecvFrom, "RecvFrom"}, + {10, &BSD_USA::Send, "Send"}, + {11, &BSD_USA::SendTo, "SendTo"}, + {12, &BSD_USA::Accept, "Accept"}, + {13, &BSD_USA::Bind, "Bind"}, + {14, &BSD_USA::Connect, "Connect"}, + {15, &BSD_USA::GetPeerName, "GetPeerName"}, + {16, &BSD_USA::GetSockName, "GetSockName"}, + {17, &BSD_USA::GetSockOpt, "GetSockOpt"}, + {18, &BSD_USA::Listen, "Listen"}, + {19, nullptr, "Ioctl"}, + {20, &BSD_USA::Fcntl, "Fcntl"}, + {21, &BSD_USA::SetSockOpt, "SetSockOpt"}, + {22, &BSD_USA::Shutdown, "Shutdown"}, + {23, nullptr, "ShutdownAllSockets"}, + {24, &BSD_USA::Write, "Write"}, + {25, &BSD_USA::Read, "Read"}, + {26, &BSD_USA::Close, "Close"}, + {27, &BSD_USA::DuplicateSocket, "DuplicateSocket"}, + {28, nullptr, "GetResourceStatistics"}, + {29, nullptr, "RecvMMsg"}, //3.0.0+ + {30, nullptr, "SendMMsg"}, //3.0.0+ + {31, &BSD_USA::EventFd, "EventFd"}, //7.0.0+ + {32, nullptr, "RegisterResourceStatisticsName"}, //7.0.0+ + {33, nullptr, "RegisterClientShared"}, //10.0.0+ + {34, nullptr, "GetSocketStatistics"}, //15.0.0+ + {35, nullptr, "NifIoctl"}, //17.0.0+ + {36, nullptr, "Unknown36"}, //18.0.0+ + {37, nullptr, "Unknown37"}, //18.0.0+ + {38, nullptr, "Unknown38"}, //18.0.0+ + {39, nullptr, "Unknown39"}, //20.0.0+ + {40, nullptr, "Unknown40"}, //20.0.0+ + {41, nullptr, "Unknown41"}, //21.0.0+ + {42, nullptr, "Unknown42"}, //21.0.0+ + {43, nullptr, "Unknown43"}, //21.0.0+ + {200, nullptr, "SetThreadCoreMask"}, //15.0.0+ + {201, nullptr, "GetThreadCoreMask"}, //15.0.0+ + }; + // clang-format on + + RegisterHandlers(functions); + if (auto room_member = Network::GetRoomMember().lock()) { proxy_packet_received = room_member->BindOnProxyPacketReceived( [this](const Network::ProxyPacket& packet) { OnProxyPacketReceived(packet); }); @@ -1103,12 +1156,40 @@ std::unique_lock BSD_USA::LockService() noexcept { BSDCFG::BSDCFG(Core::System& system_, const char *name) : ServiceFramework{system_, name} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "SetIfUp"}, + {1, nullptr, "SetIfUpWithEvent"}, + {2, nullptr, "CancelIf"}, + {3, nullptr, "SetIfDown"}, + {4, nullptr, "GetIfState"}, + {5, nullptr, "DhcpRenew"}, + {6, nullptr, "AddStaticArpEntry"}, + {7, nullptr, "RemoveArpEntry"}, + {8, nullptr, "LookupArpEntry"}, + {9, nullptr, "LookupArpEntry2"}, + {10, nullptr, "ClearArpEntries"}, + {11, nullptr, "ClearArpEntries2"}, + {12, nullptr, "PrintArpEntries"}, + {13, nullptr, "Unknown13"}, + {14, nullptr, "Unknown14"}, + {15, nullptr, "Unknown15"}, + }; + // clang-format on + + RegisterHandlers(functions); } BSDCFG::~BSDCFG() = default; BSD_NU::BSD_NU(Core::System& system_) : ServiceFramework{system_, "bsd:nu"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "CreateUserService"}, + }; + // clang-format on + RegisterHandlers(functions); } BSD_NU::~BSD_NU() = default; diff --git a/src/core/hle/service/sockets/bsd.h b/src/core/hle/service/sockets/bsd.h index c2aa343d51..5cc3eb5b81 100644 --- a/src/core/hle/service/sockets/bsd.h +++ b/src/core/hle/service/sockets/bsd.h @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -189,58 +190,6 @@ private: protected: std::unique_lock LockService() noexcept override; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &BSD_USA::RegisterClient, "RegisterClient"}, - FunctionInfo{1, &BSD_USA::StartMonitoring, "StartMonitoring"}, - FunctionInfo{2, &BSD_USA::Socket, "Socket"}, - FunctionInfo{3, &BSD_USA::SocketExempt, "SocketExempt"}, - FunctionInfo{4, nullptr, "Open"}, - FunctionInfo{5, &BSD_USA::Select, "Select"}, - FunctionInfo{6, &BSD_USA::Poll, "Poll"}, - FunctionInfo{7, nullptr, "Sysctl"}, - FunctionInfo{8, &BSD_USA::Recv, "Recv"}, - FunctionInfo{9, &BSD_USA::RecvFrom, "RecvFrom"}, - FunctionInfo{10, &BSD_USA::Send, "Send"}, - FunctionInfo{11, &BSD_USA::SendTo, "SendTo"}, - FunctionInfo{12, &BSD_USA::Accept, "Accept"}, - FunctionInfo{13, &BSD_USA::Bind, "Bind"}, - FunctionInfo{14, &BSD_USA::Connect, "Connect"}, - FunctionInfo{15, &BSD_USA::GetPeerName, "GetPeerName"}, - FunctionInfo{16, &BSD_USA::GetSockName, "GetSockName"}, - FunctionInfo{17, &BSD_USA::GetSockOpt, "GetSockOpt"}, - FunctionInfo{18, &BSD_USA::Listen, "Listen"}, - FunctionInfo{19, nullptr, "Ioctl"}, - FunctionInfo{20, &BSD_USA::Fcntl, "Fcntl"}, - FunctionInfo{21, &BSD_USA::SetSockOpt, "SetSockOpt"}, - FunctionInfo{22, &BSD_USA::Shutdown, "Shutdown"}, - FunctionInfo{23, nullptr, "ShutdownAllSockets"}, - FunctionInfo{24, &BSD_USA::Write, "Write"}, - FunctionInfo{25, &BSD_USA::Read, "Read"}, - FunctionInfo{26, &BSD_USA::Close, "Close"}, - FunctionInfo{27, &BSD_USA::DuplicateSocket, "DuplicateSocket"}, - FunctionInfo{28, nullptr, "GetResourceStatistics"}, - FunctionInfo{29, nullptr, "RecvMMsg", MakeVersionGate({3,0,0})}, - FunctionInfo{30, nullptr, "SendMMsg", MakeVersionGate({3,0,0})}, - FunctionInfo{31, &BSD_USA::EventFd, "EventFd", MakeVersionGate({7,0,0})}, - FunctionInfo{32, nullptr, "RegisterResourceStatisticsName", MakeVersionGate({7,0,0})}, - FunctionInfo{33, nullptr, "RegisterClientShared", MakeVersionGate({10,0,0})}, - FunctionInfo{34, nullptr, "GetSocketStatistics", MakeVersionGate({15,0,0})}, - FunctionInfo{35, nullptr, "NifIoctl", MakeVersionGate({17,0,0})}, - FunctionInfo{36, nullptr, "Unknown36", MakeVersionGate({18,0,0})}, - FunctionInfo{37, nullptr, "Unknown37", MakeVersionGate({18,0,0})}, - FunctionInfo{38, nullptr, "Unknown38", MakeVersionGate({18,0,0})}, - FunctionInfo{39, nullptr, "Unknown39", MakeVersionGate({20,0,0})}, - FunctionInfo{40, nullptr, "Unknown40", MakeVersionGate({20,0,0})}, - FunctionInfo{41, nullptr, "Unknown41", MakeVersionGate({21,0,0})}, - FunctionInfo{42, nullptr, "Unknown42", MakeVersionGate({21,0,0})}, - FunctionInfo{43, nullptr, "Unknown43", MakeVersionGate({21,0,0})}, - FunctionInfo{200, nullptr, "SetThreadCoreMask", MakeVersionGate({15,0,0})}, - FunctionInfo{201, nullptr, "GetThreadCoreMask", MakeVersionGate({15,0,0})} - ); bool is_user = false; }; @@ -248,41 +197,12 @@ class BSDCFG final : public ServiceFramework { public: explicit BSDCFG(Core::System& system_, const char *name); ~BSDCFG() override; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "SetIfUp"}, - FunctionInfo{1, nullptr, "SetIfUpWithEvent"}, - FunctionInfo{2, nullptr, "CancelIf"}, - FunctionInfo{3, nullptr, "SetIfDown"}, - FunctionInfo{4, nullptr, "GetIfState"}, - FunctionInfo{5, nullptr, "DhcpRenew"}, - FunctionInfo{6, nullptr, "AddStaticArpEntry"}, - FunctionInfo{7, nullptr, "RemoveArpEntry"}, - FunctionInfo{8, nullptr, "LookupArpEntry"}, - FunctionInfo{9, nullptr, "LookupArpEntry2"}, - FunctionInfo{10, nullptr, "ClearArpEntries"}, - FunctionInfo{11, nullptr, "ClearArpEntries2"}, - FunctionInfo{12, nullptr, "PrintArpEntries"}, - FunctionInfo{13, nullptr, "Unknown13"}, - FunctionInfo{14, nullptr, "Unknown14"}, - FunctionInfo{15, nullptr, "Unknown15"} - ); }; class BSD_NU final : public ServiceFramework { public: explicit BSD_NU(Core::System& system_); ~BSD_NU() override; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "CreateUserService"} - ); }; } // namespace Service::Sockets diff --git a/src/core/hle/service/sockets/nsd.cpp b/src/core/hle/service/sockets/nsd.cpp index 8f042aee75..241f2971ca 100644 --- a/src/core/hle/service/sockets/nsd.cpp +++ b/src/core/hle/service/sockets/nsd.cpp @@ -29,6 +29,38 @@ struct EnvironmentIdentifier { static_assert(sizeof(EnvironmentIdentifier) == 0x8); NSD::NSD(Core::System& system_, const char* name) : ServiceFramework{system_, name} { + // clang-format off + static const FunctionInfo functions[] = { + {5, nullptr, "GetSettingUrl"}, + {10, nullptr, "GetSettingName"}, + {11, &NSD::GetEnvironmentIdentifier, "GetEnvironmentIdentifier"}, + {12, nullptr, "GetDeviceId"}, + {13, nullptr, "DeleteSettings"}, + {14, nullptr, "ImportSettings"}, + {15, &NSD::SetChangeEnvironmentIdentifierDisabled, "SetChangeEnvironmentIdentifierDisabled"}, + {20, &NSD::Resolve, "Resolve"}, + {21, &NSD::ResolveEx, "ResolveEx"}, + {30, nullptr, "GetNasServiceSetting"}, + {31, nullptr, "GetNasServiceSettingEx"}, + {40, nullptr, "GetNasRequestFqdn"}, + {41, nullptr, "GetNasRequestFqdnEx"}, + {42, nullptr, "GetNasApiFqdn"}, + {43, nullptr, "GetNasApiFqdnEx"}, + {50, nullptr, "GetCurrentSetting"}, + {51, nullptr, "WriteTestParameter"}, + {52, nullptr, "ReadTestParameter"}, + {60, nullptr, "ReadSaveDataFromFsForTest"}, + {61, nullptr, "WriteSaveDataToFsForTest"}, + {62, nullptr, "DeleteSaveDataOfFsForTest"}, + {63, nullptr, "IsChangeEnvironmentIdentifierDisabled"}, + {64, nullptr, "SetWithoutDomainExchangeFqdns"}, + {100, &NSD::GetApplicationServerEnvironmentType, "GetApplicationServerEnvironmentType"}, + {101, nullptr, "SetApplicationServerEnvironmentType"}, + {102, nullptr, "DeleteApplicationServerEnvironmentType"}, + }; + // clang-format on + + RegisterHandlers(functions); } static std::string ResolveImpl(const std::string& fqdn_in) { diff --git a/src/core/hle/service/sockets/nsd.h b/src/core/hle/service/sockets/nsd.h index f3e4d48aff..e4a4588467 100644 --- a/src/core/hle/service/sockets/nsd.h +++ b/src/core/hle/service/sockets/nsd.h @@ -25,38 +25,6 @@ private: void ResolveEx(HLERequestContext& ctx); void GetEnvironmentIdentifier(HLERequestContext& ctx); void GetApplicationServerEnvironmentType(HLERequestContext& ctx); - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{5, nullptr, "GetSettingUrl"}, - FunctionInfo{10, nullptr, "GetSettingName"}, - FunctionInfo{11, &NSD::GetEnvironmentIdentifier, "GetEnvironmentIdentifier"}, - FunctionInfo{12, nullptr, "GetDeviceId"}, - FunctionInfo{13, nullptr, "DeleteSettings"}, - FunctionInfo{14, nullptr, "ImportSettings"}, - FunctionInfo{15, &NSD::SetChangeEnvironmentIdentifierDisabled, "SetChangeEnvironmentIdentifierDisabled"}, - FunctionInfo{20, &NSD::Resolve, "Resolve"}, - FunctionInfo{21, &NSD::ResolveEx, "ResolveEx"}, - FunctionInfo{30, nullptr, "GetNasServiceSetting"}, - FunctionInfo{31, nullptr, "GetNasServiceSettingEx"}, - FunctionInfo{40, nullptr, "GetNasRequestFqdn"}, - FunctionInfo{41, nullptr, "GetNasRequestFqdnEx"}, - FunctionInfo{42, nullptr, "GetNasApiFqdn"}, - FunctionInfo{43, nullptr, "GetNasApiFqdnEx"}, - FunctionInfo{50, nullptr, "GetCurrentSetting"}, - FunctionInfo{51, nullptr, "WriteTestParameter"}, - FunctionInfo{52, nullptr, "ReadTestParameter"}, - FunctionInfo{60, nullptr, "ReadSaveDataFromFsForTest"}, - FunctionInfo{61, nullptr, "WriteSaveDataToFsForTest"}, - FunctionInfo{62, nullptr, "DeleteSaveDataOfFsForTest"}, - FunctionInfo{63, nullptr, "IsChangeEnvironmentIdentifierDisabled"}, - FunctionInfo{64, nullptr, "SetWithoutDomainExchangeFqdns"}, - FunctionInfo{100, &NSD::GetApplicationServerEnvironmentType, "GetApplicationServerEnvironmentType"}, - FunctionInfo{101, nullptr, "SetApplicationServerEnvironmentType"}, - FunctionInfo{102, nullptr, "DeleteApplicationServerEnvironmentType"} - ); }; } // namespace Service::Sockets diff --git a/src/core/hle/service/sockets/sfdnsres.cpp b/src/core/hle/service/sockets/sfdnsres.cpp index c89705356e..93c01bf786 100644 --- a/src/core/hle/service/sockets/sfdnsres.cpp +++ b/src/core/hle/service/sockets/sfdnsres.cpp @@ -21,6 +21,25 @@ namespace Service::Sockets { SFDNSRES::SFDNSRES(Core::System& system_) : ServiceFramework{system_, "sfdnsres"} { + static const FunctionInfo functions[] = { + {0, nullptr, "SetDnsAddressesPrivateRequest"}, + {1, nullptr, "GetDnsAddressPrivateRequest"}, + {2, &SFDNSRES::GetHostByNameRequest, "GetHostByNameRequest"}, + {3, nullptr, "GetHostByAddrRequest"}, + {4, nullptr, "GetHostStringErrorRequest"}, + {5, &SFDNSRES::GetGaiStringErrorRequest, "GetGaiStringErrorRequest"}, + {6, &SFDNSRES::GetAddrInfoRequest, "GetAddrInfoRequest"}, + {7, nullptr, "GetNameInfoRequest"}, + {8, nullptr, "RequestCancelHandleRequest"}, + {9, nullptr, "CancelRequest"}, + {10, &SFDNSRES::GetHostByNameRequestWithOptions, "GetHostByNameRequestWithOptions"}, + {11, nullptr, "GetHostByAddrRequestWithOptions"}, + {12, &SFDNSRES::GetAddrInfoRequestWithOptions, "GetAddrInfoRequestWithOptions"}, + {13, nullptr, "GetNameInfoRequestWithOptions"}, + {14, &SFDNSRES::ResolverSetOptionRequest, "ResolverSetOptionRequest"}, + {15, nullptr, "ResolverGetOptionRequest"}, + }; + RegisterHandlers(functions); } SFDNSRES::~SFDNSRES() = default; @@ -391,6 +410,14 @@ void SFDNSRES::ResolverSetOptionRequest(HLERequestContext& ctx) { DNS_PRIV::DNS_PRIV(Core::System& system_) : ServiceFramework{system_, "dns:priv"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "Cmd0"}, + {1, nullptr, "Cmd1"}, + {2, nullptr, "Cmd2"}, + }; + // clang-format on + RegisterHandlers(functions); } DNS_PRIV::~DNS_PRIV() = default; diff --git a/src/core/hle/service/sockets/sfdnsres.h b/src/core/hle/service/sockets/sfdnsres.h index b365d03b2d..4302edc43e 100644 --- a/src/core/hle/service/sockets/sfdnsres.h +++ b/src/core/hle/service/sockets/sfdnsres.h @@ -26,43 +26,12 @@ private: void GetAddrInfoRequest(HLERequestContext& ctx); void GetAddrInfoRequestWithOptions(HLERequestContext& ctx); void ResolverSetOptionRequest(HLERequestContext& ctx); - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "SetDnsAddressesPrivateRequest"}, - FunctionInfo{1, nullptr, "GetDnsAddressPrivateRequest"}, - FunctionInfo{2, &SFDNSRES::GetHostByNameRequest, "GetHostByNameRequest"}, - FunctionInfo{3, nullptr, "GetHostByAddrRequest"}, - FunctionInfo{4, nullptr, "GetHostStringErrorRequest"}, - FunctionInfo{5, &SFDNSRES::GetGaiStringErrorRequest, "GetGaiStringErrorRequest"}, - FunctionInfo{6, &SFDNSRES::GetAddrInfoRequest, "GetAddrInfoRequest"}, - FunctionInfo{7, nullptr, "GetNameInfoRequest"}, - FunctionInfo{8, nullptr, "RequestCancelHandleRequest"}, - FunctionInfo{9, nullptr, "CancelRequest"}, - FunctionInfo{10, &SFDNSRES::GetHostByNameRequestWithOptions, "GetHostByNameRequestWithOptions"}, - FunctionInfo{11, nullptr, "GetHostByAddrRequestWithOptions"}, - FunctionInfo{12, &SFDNSRES::GetAddrInfoRequestWithOptions, "GetAddrInfoRequestWithOptions"}, - FunctionInfo{13, nullptr, "GetNameInfoRequestWithOptions"}, - FunctionInfo{14, &SFDNSRES::ResolverSetOptionRequest, "ResolverSetOptionRequest"}, - FunctionInfo{15, nullptr, "ResolverGetOptionRequest"} - ); }; class DNS_PRIV final : public ServiceFramework { public: explicit DNS_PRIV(Core::System& system_); ~DNS_PRIV() override; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "Cmd0"}, - FunctionInfo{1, nullptr, "Cmd1"}, - FunctionInfo{2, nullptr, "Cmd2"} - ); }; } // namespace Service::Sockets diff --git a/src/core/hle/service/sockets/sockets.cpp b/src/core/hle/service/sockets/sockets.cpp index 1c723e96a6..e96d7c5638 100644 --- a/src/core/hle/service/sockets/sockets.cpp +++ b/src/core/hle/service/sockets/sockets.cpp @@ -15,49 +15,49 @@ namespace Service::Sockets { class ETHC_C final : public ServiceFramework { public: explicit ETHC_C(Core::System& system_) - : ServiceFramework{system_, "ethc:c"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "Initialize"}, - FunctionInfo{1, nullptr, "Cancel"}, - FunctionInfo{2, nullptr, "GetResult"}, - FunctionInfo{3, nullptr, "GetMediaList"}, - FunctionInfo{4, nullptr, "SetMediaType"}, - FunctionInfo{5, nullptr, "GetMediaType"}, - FunctionInfo{6, nullptr, "GetMacAddress"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + : ServiceFramework{system_, "ethc:c"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "Initialize"}, + {1, nullptr, "Cancel"}, + {2, nullptr, "GetResult"}, + {3, nullptr, "GetMediaList"}, + {4, nullptr, "SetMediaType"}, + {5, nullptr, "GetMediaType"}, + {6, nullptr, "GetMacAddress"}, + }; + // clang-format on + RegisterHandlers(functions); } }; class ETHC_I final : public ServiceFramework { public: explicit ETHC_I(Core::System& system_) - : ServiceFramework{system_, "ethc:i"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetReadableHandle"}, - FunctionInfo{1, nullptr, "Cancel"}, - FunctionInfo{2, nullptr, "GetResult"}, - FunctionInfo{3, nullptr, "GetInterfaceList"}, - FunctionInfo{4, nullptr, "GetInterfaceCount"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + : ServiceFramework{system_, "ethc:i"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetReadableHandle"}, + {1, nullptr, "Cancel"}, + {2, nullptr, "GetResult"}, + {3, nullptr, "GetInterfaceList"}, + {4, nullptr, "GetInterfaceCount"}, + }; + // clang-format on + RegisterHandlers(functions); } }; class ISfDriverServiceCreator final : public ServiceFramework { public: explicit ISfDriverServiceCreator(Core::System& system_) - : ServiceFramework{system_, "eth:nd"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "CreateDriverService"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + : ServiceFramework{system_, "eth:nd"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "CreateDriverService"}, + }; + // clang-format on + RegisterHandlers(functions); } }; diff --git a/src/core/hle/service/sockets/sockets_translate.h b/src/core/hle/service/sockets/sockets_translate.h index bd6721fd3e..b1dfc71961 100644 --- a/src/core/hle/service/sockets/sockets_translate.h +++ b/src/core/hle/service/sockets/sockets_translate.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/spl/spl.cpp b/src/core/hle/service/spl/spl.cpp index ad0251fac5..81be99c360 100644 --- a/src/core/hle/service/spl/spl.cpp +++ b/src/core/hle/service/spl/spl.cpp @@ -8,22 +8,181 @@ namespace Service::SPL { -SPL::SPL(Core::System& system_, std::shared_ptr module_) : Interface(system_, std::move(module_), "spl:") {} +SPL::SPL(Core::System& system_, std::shared_ptr module_) + : Interface(system_, std::move(module_), "spl:") { + // clang-format off + static const FunctionInfo functions[] = { + {0, &SPL::GetConfig, "GetConfig"}, + {1, &SPL::ModularExponentiate, "ModularExponentiate"}, + {5, &SPL::SetConfig, "SetConfig"}, + {7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"}, + {11, &SPL::IsDevelopment, "IsDevelopment"}, + {24, &SPL::SetBootReason, "SetBootReason"}, + {25, &SPL::GetBootReason, "GetBootReason"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + SPL::~SPL() = default; -SPL_MIG::SPL_MIG(Core::System& system_, std::shared_ptr module_) : Interface(system_, std::move(module_), "spl:mig") {} +SPL_MIG::SPL_MIG(Core::System& system_, std::shared_ptr module_) + : Interface(system_, std::move(module_), "spl:mig") { + // clang-format off + static const FunctionInfo functions[] = { + {0, &SPL::GetConfig, "GetConfig"}, + {1, &SPL::ModularExponentiate, "ModularExponentiate"}, + {2, &SPL::GenerateAesKek, "GenerateAesKek"}, + {3, nullptr, "LoadAesKey"}, + {4, &SPL::GenerateAesKey, "GenerateAesKey"}, + {5, &SPL::SetConfig, "SetConfig"}, + {7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"}, + {11, &SPL::IsDevelopment, "IsDevelopment"}, + {14, nullptr, "DecryptAesKey"}, + {15, nullptr, "CryptAesCtr"}, + {16, nullptr, "ComputeCmac"}, + {21, nullptr, "AllocateAesKeyslot"}, + {22, nullptr, "DeallocateAesKeySlot"}, + {23, nullptr, "GetAesKeyslotAvailableEvent"}, + {24, &SPL::SetBootReason, "SetBootReason"}, + {25, &SPL::GetBootReason, "GetBootReason"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + SPL_MIG::~SPL_MIG() = default; -SPL_FS::SPL_FS(Core::System& system_, std::shared_ptr module_) : Interface(system_, std::move(module_), "spl:fs") {} +SPL_FS::SPL_FS(Core::System& system_, std::shared_ptr module_) + : Interface(system_, std::move(module_), "spl:fs") { + // clang-format off + static const FunctionInfo functions[] = { + {0, &SPL::GetConfig, "GetConfig"}, + {1, &SPL::ModularExponentiate, "ModularExponentiate"}, + {2, nullptr, "GenerateAesKek"}, + {3, nullptr, "LoadAesKey"}, + {4, nullptr, "GenerateAesKey"}, + {5, &SPL::SetConfig, "SetConfig"}, + {7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"}, + {9, nullptr, "ImportLotusKey"}, + {10, nullptr, "DecryptLotusMessage"}, + {11, &SPL::IsDevelopment, "IsDevelopment"}, + {12, nullptr, "GenerateSpecificAesKey"}, + {14, nullptr, "DecryptAesKey"}, + {15, nullptr, "CryptAesCtr"}, + {16, nullptr, "ComputeCmac"}, + {19, nullptr, "LoadTitleKey"}, + {21, nullptr, "AllocateAesKeyslot"}, + {22, nullptr, "DeallocateAesKeySlot"}, + {23, nullptr, "GetAesKeyslotAvailableEvent"}, + {24, &SPL::SetBootReason, "SetBootReason"}, + {25, &SPL::GetBootReason, "GetBootReason"}, + {31, nullptr, "GetPackage2Hash"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + SPL_FS::~SPL_FS() = default; -SPL_SSL::SPL_SSL(Core::System& system_, std::shared_ptr module_) : Interface(system_, std::move(module_), "spl:ssl") {} +SPL_SSL::SPL_SSL(Core::System& system_, std::shared_ptr module_) + : Interface(system_, std::move(module_), "spl:ssl") { + // clang-format off + static const FunctionInfo functions[] = { + {0, &SPL::GetConfig, "GetConfig"}, + {1, &SPL::ModularExponentiate, "ModularExponentiate"}, + {2, nullptr, "GenerateAesKek"}, + {3, nullptr, "LoadAesKey"}, + {4, nullptr, "GenerateAesKey"}, + {5, &SPL::SetConfig, "SetConfig"}, + {7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"}, + {11, &SPL::IsDevelopment, "IsDevelopment"}, + {13, nullptr, "DecryptDeviceUniqueData"}, + {14, nullptr, "DecryptAesKey"}, + {15, nullptr, "CryptAesCtr"}, + {16, nullptr, "ComputeCmac"}, + {21, nullptr, "AllocateAesKeyslot"}, + {22, nullptr, "DeallocateAesKeySlot"}, + {23, nullptr, "GetAesKeyslotAvailableEvent"}, + {24, &SPL::SetBootReason, "SetBootReason"}, + {25, &SPL::GetBootReason, "GetBootReason"}, + {26, nullptr, "DecryptAndStoreSslClientCertKey"}, + {27, nullptr, "ModularExponentiateWithSslClientCertKey"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + SPL_SSL::~SPL_SSL() = default; -SPL_ES::SPL_ES(Core::System& system_, std::shared_ptr module_) : Interface(system_, std::move(module_), "spl:es") {} +SPL_ES::SPL_ES(Core::System& system_, std::shared_ptr module_) + : Interface(system_, std::move(module_), "spl:es") { + // clang-format off + static const FunctionInfo functions[] = { + {0, &SPL::GetConfig, "GetConfig"}, + {1, &SPL::ModularExponentiate, "ModularExponentiate"}, + {2, nullptr, "GenerateAesKek"}, + {3, nullptr, "LoadAesKey"}, + {4, nullptr, "GenerateAesKey"}, + {5, &SPL::SetConfig, "SetConfig"}, + {7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"}, + {11, &SPL::IsDevelopment, "IsDevelopment"}, + {13, nullptr, "DecryptDeviceUniqueData"}, + {14, nullptr, "DecryptAesKey"}, + {15, nullptr, "CryptAesCtr"}, + {16, nullptr, "ComputeCmac"}, + {17, nullptr, "ImportEsKey"}, + {18, nullptr, "UnwrapTitleKey"}, + {20, nullptr, "PrepareEsCommonKey"}, + {21, nullptr, "AllocateAesKeyslot"}, + {22, nullptr, "DeallocateAesKeySlot"}, + {23, nullptr, "GetAesKeyslotAvailableEvent"}, + {24, &SPL::SetBootReason, "SetBootReason"}, + {25, &SPL::GetBootReason, "GetBootReason"}, + {28, nullptr, "DecryptAndStoreDrmDeviceCertKey"}, + {29, nullptr, "ModularExponentiateWithDrmDeviceCertKey"}, + {31, nullptr, "PrepareEsArchiveKey"}, + {32, nullptr, "LoadPreparedAesKey"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + SPL_ES::~SPL_ES() = default; -SPL_MANU::SPL_MANU(Core::System& system_, std::shared_ptr module_) : Interface(system_, std::move(module_), "spl:manu") {} +SPL_MANU::SPL_MANU(Core::System& system_, std::shared_ptr module_) + : Interface(system_, std::move(module_), "spl:manu") { + // clang-format off + static const FunctionInfo functions[] = { + {0, &SPL::GetConfig, "GetConfig"}, + {1, &SPL::ModularExponentiate, "ModularExponentiate"}, + {2, nullptr, "GenerateAesKek"}, + {3, nullptr, "LoadAesKey"}, + {4, nullptr, "GenerateAesKey"}, + {5, &SPL::SetConfig, "SetConfig"}, + {7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"}, + {11, &SPL::IsDevelopment, "IsDevelopment"}, + {13, nullptr, "DecryptDeviceUniqueData"}, + {14, nullptr, "DecryptAesKey"}, + {15, nullptr, "CryptAesCtr"}, + {16, nullptr, "ComputeCmac"}, + {21, nullptr, "AllocateAesKeyslot"}, + {22, nullptr, "DeallocateAesKeySlot"}, + {23, nullptr, "GetAesKeyslotAvailableEvent"}, + {24, &SPL::SetBootReason, "SetBootReason"}, + {25, &SPL::GetBootReason, "GetBootReason"}, + {30, nullptr, "ReencryptDeviceUniqueData"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + SPL_MANU::~SPL_MANU() = default; } // namespace Service::SPL diff --git a/src/core/hle/service/spl/spl.h b/src/core/hle/service/spl/spl.h index 8f84d2a3d3..83a3cda539 100644 --- a/src/core/hle/service/spl/spl.h +++ b/src/core/hle/service/spl/spl.h @@ -18,177 +18,36 @@ class SPL final : public Module::Interface { public: explicit SPL(Core::System& system_, std::shared_ptr module_); ~SPL() override; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &SPL::GetConfig, "GetConfig"}, - FunctionInfo{1, &SPL::ModularExponentiate, "ModularExponentiate"}, - FunctionInfo{5, &SPL::SetConfig, "SetConfig"}, - FunctionInfo{7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"}, - FunctionInfo{11, &SPL::IsDevelopment, "IsDevelopment"}, - FunctionInfo{24, &SPL::SetBootReason, "SetBootReason"}, - FunctionInfo{25, &SPL::GetBootReason, "GetBootReason"} - ); }; class SPL_MIG final : public Module::Interface { public: explicit SPL_MIG(Core::System& system_, std::shared_ptr module_); ~SPL_MIG() override; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &SPL::GetConfig, "GetConfig"}, - FunctionInfo{1, &SPL::ModularExponentiate, "ModularExponentiate"}, - FunctionInfo{2, &SPL::GenerateAesKek, "GenerateAesKek"}, - FunctionInfo{3, nullptr, "LoadAesKey"}, - FunctionInfo{4, &SPL::GenerateAesKey, "GenerateAesKey"}, - FunctionInfo{5, &SPL::SetConfig, "SetConfig"}, - FunctionInfo{7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"}, - FunctionInfo{11, &SPL::IsDevelopment, "IsDevelopment"}, - FunctionInfo{14, nullptr, "DecryptAesKey"}, - FunctionInfo{15, nullptr, "CryptAesCtr"}, - FunctionInfo{16, nullptr, "ComputeCmac"}, - FunctionInfo{21, nullptr, "AllocateAesKeyslot"}, - FunctionInfo{22, nullptr, "DeallocateAesKeySlot"}, - FunctionInfo{23, nullptr, "GetAesKeyslotAvailableEvent"}, - FunctionInfo{24, &SPL::SetBootReason, "SetBootReason"}, - FunctionInfo{25, &SPL::GetBootReason, "GetBootReason"} - ); }; class SPL_FS final : public Module::Interface { public: explicit SPL_FS(Core::System& system_, std::shared_ptr module_); ~SPL_FS() override; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &SPL::GetConfig, "GetConfig"}, - FunctionInfo{1, &SPL::ModularExponentiate, "ModularExponentiate"}, - FunctionInfo{2, nullptr, "GenerateAesKek"}, - FunctionInfo{3, nullptr, "LoadAesKey"}, - FunctionInfo{4, nullptr, "GenerateAesKey"}, - FunctionInfo{5, &SPL::SetConfig, "SetConfig"}, - FunctionInfo{7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"}, - FunctionInfo{9, nullptr, "ImportLotusKey"}, - FunctionInfo{10, nullptr, "DecryptLotusMessage"}, - FunctionInfo{11, &SPL::IsDevelopment, "IsDevelopment"}, - FunctionInfo{12, nullptr, "GenerateSpecificAesKey"}, - FunctionInfo{14, nullptr, "DecryptAesKey"}, - FunctionInfo{15, nullptr, "CryptAesCtr"}, - FunctionInfo{16, nullptr, "ComputeCmac"}, - FunctionInfo{19, nullptr, "LoadTitleKey"}, - FunctionInfo{21, nullptr, "AllocateAesKeyslot"}, - FunctionInfo{22, nullptr, "DeallocateAesKeySlot"}, - FunctionInfo{23, nullptr, "GetAesKeyslotAvailableEvent"}, - FunctionInfo{24, &SPL::SetBootReason, "SetBootReason"}, - FunctionInfo{25, &SPL::GetBootReason, "GetBootReason"}, - FunctionInfo{31, nullptr, "GetPackage2Hash"} - ); }; class SPL_SSL final : public Module::Interface { public: explicit SPL_SSL(Core::System& system_, std::shared_ptr module_); ~SPL_SSL() override; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &SPL::GetConfig, "GetConfig"}, - FunctionInfo{1, &SPL::ModularExponentiate, "ModularExponentiate"}, - FunctionInfo{2, nullptr, "GenerateAesKek"}, - FunctionInfo{3, nullptr, "LoadAesKey"}, - FunctionInfo{4, nullptr, "GenerateAesKey"}, - FunctionInfo{5, &SPL::SetConfig, "SetConfig"}, - FunctionInfo{7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"}, - FunctionInfo{11, &SPL::IsDevelopment, "IsDevelopment"}, - FunctionInfo{13, nullptr, "DecryptDeviceUniqueData"}, - FunctionInfo{14, nullptr, "DecryptAesKey"}, - FunctionInfo{15, nullptr, "CryptAesCtr"}, - FunctionInfo{16, nullptr, "ComputeCmac"}, - FunctionInfo{21, nullptr, "AllocateAesKeyslot"}, - FunctionInfo{22, nullptr, "DeallocateAesKeySlot"}, - FunctionInfo{23, nullptr, "GetAesKeyslotAvailableEvent"}, - FunctionInfo{24, &SPL::SetBootReason, "SetBootReason"}, - FunctionInfo{25, &SPL::GetBootReason, "GetBootReason"}, - FunctionInfo{26, nullptr, "DecryptAndStoreSslClientCertKey"}, - FunctionInfo{27, nullptr, "ModularExponentiateWithSslClientCertKey"} - ); }; class SPL_ES final : public Module::Interface { public: explicit SPL_ES(Core::System& system_, std::shared_ptr module_); ~SPL_ES() override; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &SPL::GetConfig, "GetConfig"}, - FunctionInfo{1, &SPL::ModularExponentiate, "ModularExponentiate"}, - FunctionInfo{2, nullptr, "GenerateAesKek"}, - FunctionInfo{3, nullptr, "LoadAesKey"}, - FunctionInfo{4, nullptr, "GenerateAesKey"}, - FunctionInfo{5, &SPL::SetConfig, "SetConfig"}, - FunctionInfo{7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"}, - FunctionInfo{11, &SPL::IsDevelopment, "IsDevelopment"}, - FunctionInfo{13, nullptr, "DecryptDeviceUniqueData"}, - FunctionInfo{14, nullptr, "DecryptAesKey"}, - FunctionInfo{15, nullptr, "CryptAesCtr"}, - FunctionInfo{16, nullptr, "ComputeCmac"}, - FunctionInfo{17, nullptr, "ImportEsKey"}, - FunctionInfo{18, nullptr, "UnwrapTitleKey"}, - FunctionInfo{20, nullptr, "PrepareEsCommonKey"}, - FunctionInfo{21, nullptr, "AllocateAesKeyslot"}, - FunctionInfo{22, nullptr, "DeallocateAesKeySlot"}, - FunctionInfo{23, nullptr, "GetAesKeyslotAvailableEvent"}, - FunctionInfo{24, &SPL::SetBootReason, "SetBootReason"}, - FunctionInfo{25, &SPL::GetBootReason, "GetBootReason"}, - FunctionInfo{28, nullptr, "DecryptAndStoreDrmDeviceCertKey"}, - FunctionInfo{29, nullptr, "ModularExponentiateWithDrmDeviceCertKey"}, - FunctionInfo{31, nullptr, "PrepareEsArchiveKey"}, - FunctionInfo{32, nullptr, "LoadPreparedAesKey"} - ); }; class SPL_MANU final : public Module::Interface { public: explicit SPL_MANU(Core::System& system_, std::shared_ptr module_); ~SPL_MANU() override; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &SPL::GetConfig, "GetConfig"}, - FunctionInfo{1, &SPL::ModularExponentiate, "ModularExponentiate"}, - FunctionInfo{2, nullptr, "GenerateAesKek"}, - FunctionInfo{3, nullptr, "LoadAesKey"}, - FunctionInfo{4, nullptr, "GenerateAesKey"}, - FunctionInfo{5, &SPL::SetConfig, "SetConfig"}, - FunctionInfo{7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"}, - FunctionInfo{11, &SPL::IsDevelopment, "IsDevelopment"}, - FunctionInfo{13, nullptr, "DecryptDeviceUniqueData"}, - FunctionInfo{14, nullptr, "DecryptAesKey"}, - FunctionInfo{15, nullptr, "CryptAesCtr"}, - FunctionInfo{16, nullptr, "ComputeCmac"}, - FunctionInfo{21, nullptr, "AllocateAesKeyslot"}, - FunctionInfo{22, nullptr, "DeallocateAesKeySlot"}, - FunctionInfo{23, nullptr, "GetAesKeyslotAvailableEvent"}, - FunctionInfo{24, &SPL::SetBootReason, "SetBootReason"}, - FunctionInfo{25, &SPL::GetBootReason, "GetBootReason"}, - FunctionInfo{30, nullptr, "ReencryptDeviceUniqueData"} - ); }; } // namespace Service::SPL diff --git a/src/core/hle/service/spl/spl_module.cpp b/src/core/hle/service/spl/spl_module.cpp index 594575d9a0..520cb1860b 100644 --- a/src/core/hle/service/spl/spl_module.cpp +++ b/src/core/hle/service/spl/spl_module.cpp @@ -204,15 +204,14 @@ Result Module::Interface::GetConfigImpl(u64* out_config, ConfigItem config_item) class CSRNG final : public Module::Interface { public: - explicit CSRNG(Core::System& system_, std::shared_ptr module_) : Interface(system_, std::move(module_), "csrng") {} - ~CSRNG() override = default; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit CSRNG(Core::System& system_, std::shared_ptr module_) + : Interface(system_, std::move(module_), "csrng") { + static const FunctionInfo functions[] = { + {0, &CSRNG::GenerateRandomBytes, "GenerateRandomBytes"}, + }; + RegisterHandlers(functions); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &CSRNG::GenerateRandomBytes, "GenerateRandomBytes"} - ); + ~CSRNG() override = default; }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/spl/spl_results.h b/src/core/hle/service/spl/spl_results.h index dd7ba11f34..8c09be49ab 100644 --- a/src/core/hle/service/spl/spl_results.h +++ b/src/core/hle/service/spl/spl_results.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/spl/spl_types.h b/src/core/hle/service/spl/spl_types.h index 91f9cc0321..d7f0c4afbb 100644 --- a/src/core/hle/service/spl/spl_types.h +++ b/src/core/hle/service/spl/spl_types.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/ssl/cert_store.cpp b/src/core/hle/service/ssl/cert_store.cpp index b321e5d32b..ee5bf8306b 100644 --- a/src/core/hle/service/ssl/cert_store.cpp +++ b/src/core/hle/service/ssl/cert_store.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/ssl/cert_store.h b/src/core/hle/service/ssl/cert_store.h index 613d7b02af..4bbb3c9c1a 100644 --- a/src/core/hle/service/ssl/cert_store.h +++ b/src/core/hle/service/ssl/cert_store.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/ssl/ssl.cpp b/src/core/hle/service/ssl/ssl.cpp index c5902079ee..999efd4295 100644 --- a/src/core/hle/service/ssl/ssl.cpp +++ b/src/core/hle/service/ssl/ssl.cpp @@ -74,17 +74,57 @@ struct SslContextSharedData { class ISslConnection final : public ServiceFramework { public: - explicit ISslConnection(Core::System& system_in, SslVersion ssl_version_in, std::shared_ptr& shared_data_in, std::unique_ptr&& backend_in) - : ServiceFramework{system_in, "ISslConnection"} - , ssl_version{ssl_version_in} - , shared_data{shared_data_in} - , backend{std::move(backend_in)} { - backend->SetVerifyOption(verify_option); - shared_data->connection_count++; - } + explicit ISslConnection(Core::System& system_in, SslVersion ssl_version_in, + std::shared_ptr& shared_data_in, + std::unique_ptr&& backend_in) + : ServiceFramework{system_in, "ISslConnection"}, ssl_version{ssl_version_in}, + shared_data{shared_data_in}, backend{std::move(backend_in)} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&ISslConnection::SetSocketDescriptor>, "SetSocketDescriptor"}, + {1, D<&ISslConnection::SetHostName>, "SetHostName"}, + {2, D<&ISslConnection::SetVerifyOption>, "SetVerifyOption"}, + {3, D<&ISslConnection::SetIoMode>, "SetIoMode"}, + {4, D<&ISslConnection::GetSocketDescriptor>, "GetSocketDescriptor"}, + {5, D<&ISslConnection::GetHostName>, "GetHostName"}, + {6, nullptr, "GetVerifyOption"}, + {7, D<&ISslConnection::GetIoMode>, "GetIoMode"}, + {8, D<&ISslConnection::DoHandshake>, "DoHandshake"}, + {9, &ISslConnection::DoHandshakeGetServerCert, "DoHandshakeGetServerCert"}, + {10, D<&ISslConnection::Read>, "Read"}, + {11, D<&ISslConnection::Write>, "Write"}, + {12, D<&ISslConnection::Pending>, "Pending"}, + {13, D<&ISslConnection::Peek>, "Peek"}, + {14, D<&ISslConnection::Poll>, "Poll"}, + {15, D<&ISslConnection::GetVerifyCertError>, "GetVerifyCertError"}, + {16, D<&ISslConnection::GetNeededServerCertBufferSize>, "GetNeededServerCertBufferSize"}, + {17, D<&ISslConnection::SetSessionCacheMode>, "SetSessionCacheMode"}, + {18, D<&ISslConnection::GetSessionCacheMode>, "GetSessionCacheMode"}, + {19, D<&ISslConnection::FlushSessionCache>, "FlushSessionCache"}, + {20, D<&ISslConnection::SetRenegotiationMode>, "SetRenegotiationMode"}, + {21, D<&ISslConnection::GetRenegotiationMode>, "GetRenegotiationMode"}, + {22, D<&ISslConnection::SetOption>, "SetOption"}, + {23, D<&ISslConnection::GetOption>, "GetOption"}, + {24, nullptr, "GetVerifyCertErrors"}, + {25, nullptr, "GetCipherInfo"}, + {26, D<&ISslConnection::SetNextAlpnProto>, "SetNextAlpnProto"}, + {27, D<&ISslConnection::GetNextAlpnProto>, "GetNextAlpnProto"}, + {28, nullptr, "SetDtlsSocketDescriptor"}, + {29, nullptr, "GetDtlsHandshakeTimeout"}, + {30, nullptr, "SetPrivateOption"}, + {31, nullptr, "SetSrtpCiphers"}, + {32, nullptr, "GetSrtpCipher"}, + {33, nullptr, "ExportKeyingMaterial"}, + {34, nullptr, "SetIoTimeout"}, + {35, nullptr, "GetIoTimeout"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); + + backend->SetVerifyOption(verify_option); + + shared_data->connection_count++; } ~ISslConnection() { @@ -392,44 +432,6 @@ private: R_SUCCEED(); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&ISslConnection::SetSocketDescriptor>, "SetSocketDescriptor"}, - FunctionInfo{1, D<&ISslConnection::SetHostName>, "SetHostName"}, - FunctionInfo{2, D<&ISslConnection::SetVerifyOption>, "SetVerifyOption"}, - FunctionInfo{3, D<&ISslConnection::SetIoMode>, "SetIoMode"}, - FunctionInfo{4, D<&ISslConnection::GetSocketDescriptor>, "GetSocketDescriptor"}, - FunctionInfo{5, D<&ISslConnection::GetHostName>, "GetHostName"}, - FunctionInfo{6, nullptr, "GetVerifyOption"}, - FunctionInfo{7, D<&ISslConnection::GetIoMode>, "GetIoMode"}, - FunctionInfo{8, D<&ISslConnection::DoHandshake>, "DoHandshake"}, - FunctionInfo{9, &ISslConnection::DoHandshakeGetServerCert, "DoHandshakeGetServerCert"}, - FunctionInfo{10, D<&ISslConnection::Read>, "Read"}, - FunctionInfo{11, D<&ISslConnection::Write>, "Write"}, - FunctionInfo{12, D<&ISslConnection::Pending>, "Pending"}, - FunctionInfo{13, D<&ISslConnection::Peek>, "Peek"}, - FunctionInfo{14, D<&ISslConnection::Poll>, "Poll"}, - FunctionInfo{15, D<&ISslConnection::GetVerifyCertError>, "GetVerifyCertError"}, - FunctionInfo{16, D<&ISslConnection::GetNeededServerCertBufferSize>, "GetNeededServerCertBufferSize"}, - FunctionInfo{17, D<&ISslConnection::SetSessionCacheMode>, "SetSessionCacheMode"}, - FunctionInfo{18, D<&ISslConnection::GetSessionCacheMode>, "GetSessionCacheMode"}, - FunctionInfo{19, D<&ISslConnection::FlushSessionCache>, "FlushSessionCache"}, - FunctionInfo{20, D<&ISslConnection::SetRenegotiationMode>, "SetRenegotiationMode"}, - FunctionInfo{21, D<&ISslConnection::GetRenegotiationMode>, "GetRenegotiationMode"}, - FunctionInfo{22, D<&ISslConnection::SetOption>, "SetOption"}, - FunctionInfo{23, D<&ISslConnection::GetOption>, "GetOption"}, - FunctionInfo{24, nullptr, "GetVerifyCertErrors"}, - FunctionInfo{25, nullptr, "GetCipherInfo"}, - FunctionInfo{26, D<&ISslConnection::SetNextAlpnProto>, "SetNextAlpnProto"}, - FunctionInfo{27, D<&ISslConnection::GetNextAlpnProto>, "GetNextAlpnProto"}, - FunctionInfo{28, nullptr, "SetDtlsSocketDescriptor"}, - FunctionInfo{29, nullptr, "GetDtlsHandshakeTimeout"}, - FunctionInfo{30, nullptr, "SetPrivateOption"}, - FunctionInfo{31, nullptr, "SetSrtpCiphers"}, - FunctionInfo{32, nullptr, "GetSrtpCipher"}, - FunctionInfo{33, nullptr, "ExportKeyingMaterial"}, - FunctionInfo{34, nullptr, "SetIoTimeout"}, - FunctionInfo{35, nullptr, "GetIoTimeout"} - ); SslVersion ssl_version; std::shared_ptr shared_data; std::unique_ptr backend; @@ -450,9 +452,29 @@ public: explicit ISslContext(Core::System& system_, SslVersion version) : ServiceFramework{system_, "ISslContext"}, ssl_version{version}, shared_data{std::make_shared()} { + static const FunctionInfo functions[] = { + {0, &ISslContext::SetOption, "SetOption"}, + {1, &ISslContext::GetOption, "GetOption"}, + {2, &ISslContext::CreateConnection, "CreateConnection"}, + {3, &ISslContext::GetConnectionCount, "GetConnectionCount"}, + {4, &ISslContext::ImportServerPki, "ImportServerPki"}, + {5, &ISslContext::ImportClientPki, "ImportClientPki"}, + {6, nullptr, "RemoveServerPki"}, + {7, nullptr, "RemoveClientPki"}, + {8, D<&ISslContext::RegisterInternalPki>, "RegisterInternalPki"}, + {9, nullptr, "AddPolicyOid"}, + {10, nullptr, "ImportCrl"}, + {11, nullptr, "RemoveCrl"}, + {12, nullptr, "ImportClientCertKeyPki"}, + {13, nullptr, "GeneratePrivateKeyAndCert"}, + }; + RegisterHandlers(functions); } private: + SslVersion ssl_version; + std::shared_ptr shared_data; + void SetOption(HLERequestContext& ctx) { struct Parameters { ContextOption option; @@ -539,36 +561,28 @@ private: LOG_WARNING(Service_SSL, "(STUBBED) called"); R_SUCCEED(); } - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &ISslContext::SetOption, "SetOption"}, - FunctionInfo{1, &ISslContext::GetOption, "GetOption"}, - FunctionInfo{2, &ISslContext::CreateConnection, "CreateConnection"}, - FunctionInfo{3, &ISslContext::GetConnectionCount, "GetConnectionCount"}, - FunctionInfo{4, &ISslContext::ImportServerPki, "ImportServerPki"}, - FunctionInfo{5, &ISslContext::ImportClientPki, "ImportClientPki"}, - FunctionInfo{6, nullptr, "RemoveServerPki"}, - FunctionInfo{7, nullptr, "RemoveClientPki"}, - FunctionInfo{8, D<&ISslContext::RegisterInternalPki>, "RegisterInternalPki"}, - FunctionInfo{9, nullptr, "AddPolicyOid"}, - FunctionInfo{10, nullptr, "ImportCrl"}, - FunctionInfo{11, nullptr, "RemoveCrl"}, - FunctionInfo{12, nullptr, "ImportClientCertKeyPki"}, - FunctionInfo{13, nullptr, "GeneratePrivateKeyAndCert"} - ); - SslVersion ssl_version; - std::shared_ptr shared_data; }; class ISslService final : public ServiceFramework { public: - explicit ISslService(Core::System& system_) : ServiceFramework{system_, "ssl"}, cert_store{system} {} + explicit ISslService(Core::System& system_) + : ServiceFramework{system_, "ssl"}, cert_store{system} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &ISslService::CreateContext, "CreateContext"}, + {1, nullptr, "GetContextCount"}, + {2, D<&ISslService::GetCertificates>, "GetCertificates"}, + {3, D<&ISslService::GetCertificateBufSize>, "GetCertificateBufSize"}, + {4, nullptr, "DebugIoctl"}, + {5, &ISslService::SetInterfaceVersion, "SetInterfaceVersion"}, + {6, nullptr, "FlushSessionCache"}, + {7, nullptr, "SetDebugOption"}, + {8, nullptr, "GetDebugOption"}, + {8, nullptr, "ClearTls12FallbackFlag"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -614,116 +628,147 @@ private: } private: - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &ISslService::CreateContext, "CreateContext"}, - FunctionInfo{1, nullptr, "GetContextCount"}, - FunctionInfo{2, D<&ISslService::GetCertificates>, "GetCertificates"}, - FunctionInfo{3, D<&ISslService::GetCertificateBufSize>, "GetCertificateBufSize"}, - FunctionInfo{4, nullptr, "DebugIoctl"}, - FunctionInfo{5, &ISslService::SetInterfaceVersion, "SetInterfaceVersion"}, - FunctionInfo{6, nullptr, "FlushSessionCache"}, - FunctionInfo{7, nullptr, "SetDebugOption"}, - FunctionInfo{8, nullptr, "GetDebugOption"}, - FunctionInfo{8, nullptr, "ClearTls12FallbackFlag"} - ); CertStore cert_store; }; class ISslServiceForSystem final : public ServiceFramework { -public: - explicit ISslServiceForSystem(Core::System& system_) : ServiceFramework{system_, "ssl:s"} {} + public: + explicit ISslServiceForSystem(Core::System& system_) : ServiceFramework{system_, "ssl:s"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, D<&ISslServiceForSystem::CreateContext>, "CreateContext"}, + {1, D<&ISslServiceForSystem::GetContextCount>, "GetContextCount"}, + {2, D<&ISslServiceForSystem::GetCertificates>, "GetCertificates"}, + {3, D<&ISslServiceForSystem::GetCertificateBufSize>, "GetCertificateBufSize"}, + {4, D<&ISslServiceForSystem::DebugIoctl>, "DebugIoctl"}, + {5, D<&ISslServiceForSystem::SetInterfaceVersion>, "SetInterfaceVersion"}, + {6, D<&ISslServiceForSystem::FlushSessionCache>, "FlushSessionCache"}, + {7, D<&ISslServiceForSystem::SetDebugOption>, "SetDebugOption"}, + {8, D<&ISslServiceForSystem::GetDebugOption>, "GetDebugOption"}, + {9, D<&ISslServiceForSystem::ClearTls12FallbackFlag>, "ClearTls12FallbackFlag"}, + {100, D<&ISslServiceForSystem::CreateContextForSystem>, "CreateContextForSystem"}, + {101, D<&ISslServiceForSystem::SetThreadCoreMask>, "SetThreadCoreMask"}, + {102, D<&ISslServiceForSystem::GetThreadCoreMask>, "GetThreadCoreMask"}, + {103, D<&ISslServiceForSystem::VerifySignature>, "VerifySignature"} + }; + // clang-format on - Result CreateContext() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - R_SUCCEED(); + RegisterHandlers(functions); + }; + + Result CreateContext() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + + // TODO (jarrodnorwell) + + return ResultSuccess; + }; + + Result GetContextCount() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + + // TODO (jarrodnorwell) + + return ResultSuccess; + }; + + Result GetCertificates() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + + // TODO (jarrodnorwell) + + return ResultSuccess; + }; + + Result GetCertificateBufSize() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + + // TODO (jarrodnorwell) + + return ResultSuccess; + }; + + Result DebugIoctl() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + + // TODO (jarrodnorwell) + + return ResultSuccess; + }; + + Result SetInterfaceVersion() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + + // TODO (jarrodnorwell) + + return ResultSuccess; + }; + + Result FlushSessionCache() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + + // TODO (jarrodnorwell) + + return ResultSuccess; + }; + + Result SetDebugOption() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + + // TODO (jarrodnorwell) + + return ResultSuccess; + }; + + Result GetDebugOption() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + + // TODO (jarrodnorwell) + + return ResultSuccess; + }; + + Result ClearTls12FallbackFlag() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + + // TODO (jarrodnorwell) + + return ResultSuccess; + }; + + Result CreateContextForSystem() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + + // TODO (jarrodnorwell) + + return ResultSuccess; + }; + + Result SetThreadCoreMask() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + + // TODO (jarrodnorwell) + + return ResultSuccess; + }; + + Result GetThreadCoreMask() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + + // TODO (jarrodnorwell) + + return ResultSuccess; + }; + + Result VerifySignature() { + LOG_DEBUG(Service_SSL, "(STUBBED) called."); + + // TODO (jarrodnorwell) + + return ResultSuccess; + }; }; - Result GetContextCount() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - R_SUCCEED(); - }; - - Result GetCertificates() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - R_SUCCEED(); - }; - - Result GetCertificateBufSize() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - R_SUCCEED(); - }; - - Result DebugIoctl() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - R_SUCCEED(); - }; - - Result SetInterfaceVersion() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - R_SUCCEED(); - }; - - Result FlushSessionCache() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - R_SUCCEED(); - }; - - Result SetDebugOption() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - R_SUCCEED(); - }; - - Result GetDebugOption() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - R_SUCCEED(); - }; - - Result ClearTls12FallbackFlag() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - R_SUCCEED(); - }; - - Result CreateContextForSystem() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - R_SUCCEED(); - }; - - Result SetThreadCoreMask() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - R_SUCCEED(); - }; - - Result GetThreadCoreMask() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - R_SUCCEED(); - }; - - Result VerifySignature() { - LOG_DEBUG(Service_SSL, "(STUBBED) called."); - R_SUCCEED(); - }; - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&ISslServiceForSystem::CreateContext>, "CreateContext"}, - FunctionInfo{1, D<&ISslServiceForSystem::GetContextCount>, "GetContextCount"}, - FunctionInfo{2, D<&ISslServiceForSystem::GetCertificates>, "GetCertificates"}, - FunctionInfo{3, D<&ISslServiceForSystem::GetCertificateBufSize>, "GetCertificateBufSize"}, - FunctionInfo{4, D<&ISslServiceForSystem::DebugIoctl>, "DebugIoctl"}, - FunctionInfo{5, D<&ISslServiceForSystem::SetInterfaceVersion>, "SetInterfaceVersion"}, - FunctionInfo{6, D<&ISslServiceForSystem::FlushSessionCache>, "FlushSessionCache"}, - FunctionInfo{7, D<&ISslServiceForSystem::SetDebugOption>, "SetDebugOption"}, - FunctionInfo{8, D<&ISslServiceForSystem::GetDebugOption>, "GetDebugOption"}, - FunctionInfo{9, D<&ISslServiceForSystem::ClearTls12FallbackFlag>, "ClearTls12FallbackFlag"}, - FunctionInfo{100, D<&ISslServiceForSystem::CreateContextForSystem>, "CreateContextForSystem"}, - FunctionInfo{101, D<&ISslServiceForSystem::SetThreadCoreMask>, "SetThreadCoreMask"}, - FunctionInfo{102, D<&ISslServiceForSystem::GetThreadCoreMask>, "GetThreadCoreMask"}, - FunctionInfo{103, D<&ISslServiceForSystem::VerifySignature>, "VerifySignature"} - ); -}; - void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); diff --git a/src/core/hle/service/ssl/ssl.h b/src/core/hle/service/ssl/ssl.h index f6e21bbb3b..dc9f2b746b 100644 --- a/src/core/hle/service/ssl/ssl.h +++ b/src/core/hle/service/ssl/ssl.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/ssl/ssl_types.h b/src/core/hle/service/ssl/ssl_types.h index 16623c0fc5..cbd84ad1f9 100644 --- a/src/core/hle/service/ssl/ssl_types.h +++ b/src/core/hle/service/ssl/ssl_types.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/tma/tma.cpp b/src/core/hle/service/tma/tma.cpp index e9198eea64..c2fb33cd16 100644 --- a/src/core/hle/service/tma/tma.cpp +++ b/src/core/hle/service/tma/tma.cpp @@ -19,14 +19,12 @@ class HTC_TENV final : public ServiceFramework { public: explicit HTC_TENV(Core::System& system_) : ServiceFramework{system_, "htc:tenv"} - {} - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + { + static const FunctionInfo functions[] = { + {0, nullptr, "GetServiceInterface"}, + }; + RegisterHandlers(functions); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetServiceInterface"} - ); }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/usb/usb.cpp b/src/core/hle/service/usb/usb.cpp index f7dc15e3db..ff2a377172 100644 --- a/src/core/hle/service/usb/usb.cpp +++ b/src/core/hle/service/usb/usb.cpp @@ -17,127 +17,137 @@ namespace Service::USB { class IDsInterface final : public ServiceFramework { public: - explicit IDsInterface(Core::System& system_) : ServiceFramework{system_, "IDsInterface"} {} + explicit IDsInterface(Core::System& system_) : ServiceFramework{system_, "IDsInterface"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "AddEndpoint"}, + {1, nullptr, "GetSetupEvent"}, + {2, nullptr, "GetSetupPacket"}, + {3, nullptr, "Enable"}, + {4, nullptr, "Disable"}, + {5, nullptr, "CtrlIn"}, + {6, nullptr, "CtrlOut"}, + {7, nullptr, "GetCtrlInCompletionEvent"}, + {8, nullptr, "GetCtrlInUrbReport"}, + {9, nullptr, "GetCtrlOutCompletionEvent"}, + {10, nullptr, "GetCtrlOutUrbReport"}, + {11, nullptr, "CtrlStall"}, + {12, nullptr, "AppendConfigurationData"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "AddEndpoint"}, - FunctionInfo{1, nullptr, "GetSetupEvent"}, - FunctionInfo{2, nullptr, "GetSetupPacket"}, - FunctionInfo{3, nullptr, "Enable"}, - FunctionInfo{4, nullptr, "Disable"}, - FunctionInfo{5, nullptr, "CtrlIn"}, - FunctionInfo{6, nullptr, "CtrlOut"}, - FunctionInfo{7, nullptr, "GetCtrlInCompletionEvent"}, - FunctionInfo{8, nullptr, "GetCtrlInUrbReport"}, - FunctionInfo{9, nullptr, "GetCtrlOutCompletionEvent"}, - FunctionInfo{10, nullptr, "GetCtrlOutUrbReport"}, - FunctionInfo{11, nullptr, "CtrlStall"}, - FunctionInfo{12, nullptr, "AppendConfigurationData"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; class IDsRootSession final : public ServiceFramework { public: - explicit IDsRootSession(Core::System& system_) : ServiceFramework{system_, "usb:ds"} {} + explicit IDsRootSession(Core::System& system_) : ServiceFramework{system_, "usb:ds"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "OpenDsService"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "OpenDsService"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; class IClientEpSession final : public ServiceFramework { public: explicit IClientEpSession(Core::System& system_) - : ServiceFramework{system_, "IClientEpSession"} {} + : ServiceFramework{system_, "IClientEpSession"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "ReOpen"}, + {1, nullptr, "Close"}, + {2, nullptr, "GetCompletionEvent"}, + {3, nullptr, "PopulateRing"}, + {4, nullptr, "PostBufferAsync"}, + {5, nullptr, "GetXferReport"}, + {6, nullptr, "PostBufferMultiAsync"}, + {7, nullptr, "CreateSmmuSpace"}, + {8, nullptr, "ShareReportRing"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "ReOpen"}, - FunctionInfo{1, nullptr, "Close"}, - FunctionInfo{2, nullptr, "GetCompletionEvent"}, - FunctionInfo{3, nullptr, "PopulateRing"}, - FunctionInfo{4, nullptr, "PostBufferAsync"}, - FunctionInfo{5, nullptr, "GetXferReport"}, - FunctionInfo{6, nullptr, "PostBufferMultiAsync"}, - FunctionInfo{7, nullptr, "CreateSmmuSpace"}, - FunctionInfo{8, nullptr, "ShareReportRing"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; class IClientIfSession final : public ServiceFramework { public: explicit IClientIfSession(Core::System& system_) - : ServiceFramework{system_, "IClientIfSession"} {} + : ServiceFramework{system_, "IClientIfSession"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetStateChangeEvent"}, + {1, nullptr, "SetInterface"}, + {2, nullptr, "GetInterface"}, + {3, nullptr, "GetAlternateInterface"}, + {4, nullptr, "GetCurrentFrame"}, + {5, nullptr, "CtrlXferAsync"}, + {6, nullptr, "GetCtrlXferCompletionEvent"}, + {7, nullptr, "GetCtrlXferReport"}, + {8, nullptr, "ResetDevice"}, + {9, nullptr, "OpenUsbEp"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetStateChangeEvent"}, - FunctionInfo{1, nullptr, "SetInterface"}, - FunctionInfo{2, nullptr, "GetInterface"}, - FunctionInfo{3, nullptr, "GetAlternateInterface"}, - FunctionInfo{4, nullptr, "GetCurrentFrame"}, - FunctionInfo{5, nullptr, "CtrlXferAsync"}, - FunctionInfo{6, nullptr, "GetCtrlXferCompletionEvent"}, - FunctionInfo{7, nullptr, "GetCtrlXferReport"}, - FunctionInfo{8, nullptr, "ResetDevice"}, - FunctionInfo{9, nullptr, "OpenUsbEp"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; class IClientRootSession final : public ServiceFramework { public: - explicit IClientRootSession(Core::System& system_) : ServiceFramework{system_, "usb:hs"} {} + explicit IClientRootSession(Core::System& system_) : ServiceFramework{system_, "usb:hs"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "BindClientProcess"}, + {1, nullptr, "QueryAllInterfaces"}, + {2, nullptr, "QueryAvailableInterfaces"}, + {3, nullptr, "QueryAcquiredInterfaces"}, + {4, nullptr, "CreateInterfaceAvailableEvent"}, + {5, nullptr, "DestroyInterfaceAvailableEvent"}, + {6, nullptr, "GetInterfaceStateChangeEvent"}, + {7, nullptr, "AcquireUsbIf"}, + {8, nullptr, "SetTestMode"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "BindClientProcess"}, - FunctionInfo{1, nullptr, "QueryAllInterfaces"}, - FunctionInfo{2, nullptr, "QueryAvailableInterfaces"}, - FunctionInfo{3, nullptr, "QueryAcquiredInterfaces"}, - FunctionInfo{4, nullptr, "CreateInterfaceAvailableEvent"}, - FunctionInfo{5, nullptr, "DestroyInterfaceAvailableEvent"}, - FunctionInfo{6, nullptr, "GetInterfaceStateChangeEvent"}, - FunctionInfo{7, nullptr, "AcquireUsbIf"}, - FunctionInfo{8, nullptr, "SetTestMode"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; class IPdSession final : public ServiceFramework { public: - explicit IPdSession(Core::System& system_) : ServiceFramework{system_, "IPdSession"} {} + explicit IPdSession(Core::System& system_) : ServiceFramework{system_, "IPdSession"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "BindNoticeEvent"}, + {1, nullptr, "UnbindNoticeEvent"}, + {2, nullptr, "GetStatus"}, + {3, nullptr, "GetNotice"}, + {4, nullptr, "EnablePowerRequestNotice"}, + {5, nullptr, "DisablePowerRequestNotice"}, + {6, nullptr, "ReplyPowerRequest"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "BindNoticeEvent"}, - FunctionInfo{1, nullptr, "UnbindNoticeEvent"}, - FunctionInfo{2, nullptr, "GetStatus"}, - FunctionInfo{3, nullptr, "GetNotice"}, - FunctionInfo{4, nullptr, "EnablePowerRequestNotice"}, - FunctionInfo{5, nullptr, "DisablePowerRequestNotice"}, - FunctionInfo{6, nullptr, "ReplyPowerRequest"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; class IPdManager final : public ServiceFramework { public: - explicit IPdManager(Core::System& system_) : ServiceFramework{system_, "usb:pd"} {} + explicit IPdManager(Core::System& system_) : ServiceFramework{system_, "usb:pd"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &IPdManager::OpenSession, "OpenSession"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -148,39 +158,40 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &IPdManager::OpenSession, "OpenSession"} - ); }; class IPdCradleSession final : public ServiceFramework { public: explicit IPdCradleSession(Core::System& system_) - : ServiceFramework{system_, "IPdCradleSession"} {} + : ServiceFramework{system_, "IPdCradleSession"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "SetCradleVdo"}, + {1, nullptr, "GetCradleVdo"}, + {2, nullptr, "ResetCradleUsbHub"}, + {3, nullptr, "GetHostPdcFirmwareType"}, + {4, nullptr, "GetHostPdcFirmwareRevision"}, + {5, nullptr, "GetHostPdcManufactureId"}, + {6, nullptr, "GetHostPdcDeviceId"}, + {7, nullptr, "EnableCradleRecovery"}, + {8, nullptr, "DisableCradleRecovery"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "SetCradleVdo"}, - FunctionInfo{1, nullptr, "GetCradleVdo"}, - FunctionInfo{2, nullptr, "ResetCradleUsbHub"}, - FunctionInfo{3, nullptr, "GetHostPdcFirmwareType"}, - FunctionInfo{4, nullptr, "GetHostPdcFirmwareRevision"}, - FunctionInfo{5, nullptr, "GetHostPdcManufactureId"}, - FunctionInfo{6, nullptr, "GetHostPdcDeviceId"}, - FunctionInfo{7, nullptr, "EnableCradleRecovery"}, - FunctionInfo{8, nullptr, "DisableCradleRecovery"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; class IPdCradleManager final : public ServiceFramework { public: - explicit IPdCradleManager(Core::System& system_) : ServiceFramework{system_, "usb:pd:c"} {} + explicit IPdCradleManager(Core::System& system_) : ServiceFramework{system_, "usb:pd:c"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &IPdCradleManager::OpenCradleSession, "OpenCradleSession"}, + }; + // clang-format on - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -191,64 +202,61 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(ctx, system); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &IPdCradleManager::OpenCradleSession, "OpenCradleSession"} - ); }; class IPmMainService final : public ServiceFramework { public: - explicit IPmMainService(Core::System& system_) : ServiceFramework{system_, "usb:pm"} {} + explicit IPmMainService(Core::System& system_) : ServiceFramework{system_, "usb:pm"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetPowerEvent"}, + {1, nullptr, "GetPowerState"}, + {2, nullptr, "GetDataEvent"}, + {3, nullptr, "GetDataRole"}, + {4, nullptr, "SetDiagData"}, + {5, nullptr, "GetDiagData"}, + }; + // clang-format on - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetPowerEvent"}, - FunctionInfo{1, nullptr, "GetPowerState"}, - FunctionInfo{2, nullptr, "GetDataEvent"}, - FunctionInfo{3, nullptr, "GetDataRole"}, - FunctionInfo{4, nullptr, "SetDiagData"}, - FunctionInfo{5, nullptr, "GetDiagData"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } }; class IPdManufactureManager final : public ServiceFramework { public: - explicit IPdManufactureManager(Core::System& system_) : ServiceFramework{system_, "usb:pd:m"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "OpenManufactureSession"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit IPdManufactureManager(Core::System& system_) : ServiceFramework{system_, "usb:pd:m"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "OpenManufactureSession"}, + }; + // clang-format on + RegisterHandlers(functions); } }; class IQdbManager final : public ServiceFramework { public: - explicit IQdbManager(Core::System& system_) : ServiceFramework{system_, "usb:qdb"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "ImportQuirkDevices"}, - FunctionInfo{1, nullptr, "HasQuirk"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit IQdbManager(Core::System& system_) : ServiceFramework{system_, "usb:qdb"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "ImportQuirkDevices"}, + {1, nullptr, "HasQuirk"}, + }; + // clang-format on + RegisterHandlers(functions); } }; class IPmObserverService final : public ServiceFramework { public: - explicit IPmObserverService(Core::System& system_) : ServiceFramework{system_, "usb:obsv"} {} - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetTopologyChangeEvent"}, - FunctionInfo{1, nullptr, "GetFlattenedTopology"} - ); - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit IPmObserverService(Core::System& system_) : ServiceFramework{system_, "usb:obsv"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetTopologyChangeEvent"}, + {1, nullptr, "GetFlattenedTopology"}, + }; + // clang-format on + RegisterHandlers(functions); } }; diff --git a/src/core/hle/service/usb/usb.h b/src/core/hle/service/usb/usb.h index 98376ebc0c..cc25a3b29e 100644 --- a/src/core/hle/service/usb/usb.h +++ b/src/core/hle/service/usb/usb.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/vi/application_display_service.cpp b/src/core/hle/service/vi/application_display_service.cpp index dcebb2eba9..f179ba676a 100644 --- a/src/core/hle/service/vi/application_display_service.cpp +++ b/src/core/hle/service/vi/application_display_service.cpp @@ -17,38 +17,38 @@ namespace Service::VI { -std::optional IApplicationDisplayService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{100, C<&IApplicationDisplayService::GetRelayService>, "GetRelayService"}, - FunctionInfo{101, C<&IApplicationDisplayService::GetSystemDisplayService>, "GetSystemDisplayService"}, - FunctionInfo{102, C<&IApplicationDisplayService::GetManagerDisplayService>, "GetManagerDisplayService"}, - FunctionInfo{103, C<&IApplicationDisplayService::GetIndirectDisplayTransactionService>, "GetIndirectDisplayTransactionService"}, - FunctionInfo{1000, C<&IApplicationDisplayService::ListDisplays>, "ListDisplays"}, - FunctionInfo{1010, C<&IApplicationDisplayService::OpenDisplay>, "OpenDisplay"}, - FunctionInfo{1011, C<&IApplicationDisplayService::OpenDefaultDisplay>, "OpenDefaultDisplay"}, - FunctionInfo{1020, C<&IApplicationDisplayService::CloseDisplay>, "CloseDisplay"}, - FunctionInfo{1101, C<&IApplicationDisplayService::SetDisplayEnabled>, "SetDisplayEnabled"}, - FunctionInfo{1102, C<&IApplicationDisplayService::GetDisplayResolution>, "GetDisplayResolution"}, - FunctionInfo{2020, C<&IApplicationDisplayService::OpenLayer>, "OpenLayer"}, - FunctionInfo{2021, C<&IApplicationDisplayService::CloseLayer>, "CloseLayer"}, - FunctionInfo{2030, C<&IApplicationDisplayService::CreateStrayLayer>, "CreateStrayLayer"}, - FunctionInfo{2031, C<&IApplicationDisplayService::DestroyStrayLayer>, "DestroyStrayLayer"}, - FunctionInfo{2101, C<&IApplicationDisplayService::SetLayerScalingMode>, "SetLayerScalingMode"}, - FunctionInfo{2102, C<&IApplicationDisplayService::ConvertScalingMode>, "ConvertScalingMode"}, - FunctionInfo{2103, C<&IApplicationDisplayService::Cmd2103>, "Cmd2103"}, - FunctionInfo{2450, C<&IApplicationDisplayService::GetIndirectLayerImageMap>, "GetIndirectLayerImageMap"}, - FunctionInfo{2451, nullptr, "GetIndirectLayerImageCropMap"}, - FunctionInfo{2460, C<&IApplicationDisplayService::GetIndirectLayerImageRequiredMemoryInfo>, "GetIndirectLayerImageRequiredMemoryInfo"}, - FunctionInfo{5202, C<&IApplicationDisplayService::GetDisplayVsyncEvent>, "GetDisplayVsyncEvent"}, - FunctionInfo{5203, nullptr, "GetDisplayVsyncEventForDebug"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IApplicationDisplayService::IApplicationDisplayService(Core::System& system_, std::shared_ptr container) : ServiceFramework{system_, "IApplicationDisplayService"}, m_container{std::move(container)}, m_context{system, "IApplicationDisplayService"} { + // clang-format off + static const FunctionInfo functions[] = { + {100, C<&IApplicationDisplayService::GetRelayService>, "GetRelayService"}, + {101, C<&IApplicationDisplayService::GetSystemDisplayService>, "GetSystemDisplayService"}, + {102, C<&IApplicationDisplayService::GetManagerDisplayService>, "GetManagerDisplayService"}, + {103, C<&IApplicationDisplayService::GetIndirectDisplayTransactionService>, "GetIndirectDisplayTransactionService"}, + {1000, C<&IApplicationDisplayService::ListDisplays>, "ListDisplays"}, + {1010, C<&IApplicationDisplayService::OpenDisplay>, "OpenDisplay"}, + {1011, C<&IApplicationDisplayService::OpenDefaultDisplay>, "OpenDefaultDisplay"}, + {1020, C<&IApplicationDisplayService::CloseDisplay>, "CloseDisplay"}, + {1101, C<&IApplicationDisplayService::SetDisplayEnabled>, "SetDisplayEnabled"}, + {1102, C<&IApplicationDisplayService::GetDisplayResolution>, "GetDisplayResolution"}, + {2020, C<&IApplicationDisplayService::OpenLayer>, "OpenLayer"}, + {2021, C<&IApplicationDisplayService::CloseLayer>, "CloseLayer"}, + {2030, C<&IApplicationDisplayService::CreateStrayLayer>, "CreateStrayLayer"}, + {2031, C<&IApplicationDisplayService::DestroyStrayLayer>, "DestroyStrayLayer"}, + {2101, C<&IApplicationDisplayService::SetLayerScalingMode>, "SetLayerScalingMode"}, + {2102, C<&IApplicationDisplayService::ConvertScalingMode>, "ConvertScalingMode"}, + {2103, C<&IApplicationDisplayService::Cmd2103>, "Cmd2103"}, + {2450, C<&IApplicationDisplayService::GetIndirectLayerImageMap>, "GetIndirectLayerImageMap"}, + {2451, nullptr, "GetIndirectLayerImageCropMap"}, + {2460, C<&IApplicationDisplayService::GetIndirectLayerImageRequiredMemoryInfo>, "GetIndirectLayerImageRequiredMemoryInfo"}, + {5202, C<&IApplicationDisplayService::GetDisplayVsyncEvent>, "GetDisplayVsyncEvent"}, + {5203, nullptr, "GetDisplayVsyncEventForDebug"}, + }; + // clang-format on + + RegisterHandlers(functions); } IApplicationDisplayService::~IApplicationDisplayService() { diff --git a/src/core/hle/service/vi/application_display_service.h b/src/core/hle/service/vi/application_display_service.h index 0b5898ee56..d2db391efd 100644 --- a/src/core/hle/service/vi/application_display_service.h +++ b/src/core/hle/service/vi/application_display_service.h @@ -74,8 +74,8 @@ public: s64 width, s64 height); private: - std::optional FindRequest(u32 key) override; const std::shared_ptr m_container; + KernelHelpers::ServiceContext m_context; std::mutex m_lock{}; std::set m_open_layer_ids{}; diff --git a/src/core/hle/service/vi/application_root_service.cpp b/src/core/hle/service/vi/application_root_service.cpp index f12c564277..2204f77ed4 100644 --- a/src/core/hle/service/vi/application_root_service.cpp +++ b/src/core/hle/service/vi/application_root_service.cpp @@ -14,17 +14,14 @@ namespace Service::VI { -std::optional IApplicationRootService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&IApplicationRootService::GetDisplayService>, "GetDisplayService"}, - FunctionInfo{1, nullptr, "GetDisplayServiceWithProxyNameExchange"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IApplicationRootService::IApplicationRootService(Core::System& system_, std::shared_ptr container) : ServiceFramework{system_, "vi:u"}, m_container{std::move(container)} { + static const FunctionInfo functions[] = { + {0, C<&IApplicationRootService::GetDisplayService>, "GetDisplayService"}, + {1, nullptr, "GetDisplayServiceWithProxyNameExchange"}, + }; + RegisterHandlers(functions); } IApplicationRootService::~IApplicationRootService() = default; diff --git a/src/core/hle/service/vi/application_root_service.h b/src/core/hle/service/vi/application_root_service.h index 4deaa04f4c..b66293b73f 100644 --- a/src/core/hle/service/vi/application_root_service.h +++ b/src/core/hle/service/vi/application_root_service.h @@ -30,7 +30,6 @@ private: Policy policy); private: - std::optional FindRequest(u32 key) override; const std::shared_ptr m_container; }; diff --git a/src/core/hle/service/vi/display.h b/src/core/hle/service/vi/display.h index fceda75e39..543c6ee68d 100644 --- a/src/core/hle/service/vi/display.h +++ b/src/core/hle/service/vi/display.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/vi/display_list.h b/src/core/hle/service/vi/display_list.h index f710ac472c..bf9cf78a27 100644 --- a/src/core/hle/service/vi/display_list.h +++ b/src/core/hle/service/vi/display_list.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/vi/layer.h b/src/core/hle/service/vi/layer.h index e4c9c98646..9bd6d033ac 100644 --- a/src/core/hle/service/vi/layer.h +++ b/src/core/hle/service/vi/layer.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/vi/layer_list.h b/src/core/hle/service/vi/layer_list.h index 4afca6f403..8fc7cd3ade 100644 --- a/src/core/hle/service/vi/layer_list.h +++ b/src/core/hle/service/vi/layer_list.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/vi/manager_display_service.cpp b/src/core/hle/service/vi/manager_display_service.cpp index 1b3b0f3379..34a0175b49 100644 --- a/src/core/hle/service/vi/manager_display_service.cpp +++ b/src/core/hle/service/vi/manager_display_service.cpp @@ -10,96 +10,96 @@ namespace Service::VI { -std::optional IManagerDisplayService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{200, nullptr, "AllocateProcessHeapBlock"}, - FunctionInfo{201, nullptr, "FreeProcessHeapBlock"}, - FunctionInfo{1102, nullptr, "GetDisplayResolution"}, - FunctionInfo{2010, C<&IManagerDisplayService::CreateManagedLayer>, "CreateManagedLayer"}, - FunctionInfo{2011, C<&IManagerDisplayService::DestroyManagedLayer>, "DestroyManagedLayer"}, - FunctionInfo{2012, nullptr, "CreateStrayLayer"}, - FunctionInfo{2050, nullptr, "CreateIndirectLayer"}, - FunctionInfo{2051, nullptr, "DestroyIndirectLayer"}, - FunctionInfo{2052, nullptr, "CreateIndirectProducerEndPoint"}, - FunctionInfo{2053, nullptr, "DestroyIndirectProducerEndPoint"}, - FunctionInfo{2054, nullptr, "CreateIndirectConsumerEndPoint"}, - FunctionInfo{2055, nullptr, "DestroyIndirectConsumerEndPoint"}, - FunctionInfo{2060, nullptr, "CreateWatermarkCompositor"}, - FunctionInfo{2062, nullptr, "SetWatermarkText"}, - FunctionInfo{2063, nullptr, "SetWatermarkLayerStacks"}, - FunctionInfo{2300, nullptr, "AcquireLayerTexturePresentingEvent"}, - FunctionInfo{2301, nullptr, "ReleaseLayerTexturePresentingEvent"}, - FunctionInfo{2302, nullptr, "GetDisplayHotplugEvent"}, - FunctionInfo{2303, nullptr, "GetDisplayModeChangedEvent"}, - FunctionInfo{2402, nullptr, "GetDisplayHotplugState"}, - FunctionInfo{2501, nullptr, "GetCompositorErrorInfo"}, - FunctionInfo{2601, nullptr, "GetDisplayErrorEvent"}, - FunctionInfo{2701, nullptr, "GetDisplayFatalErrorEvent"}, - FunctionInfo{4201, nullptr, "SetDisplayAlpha"}, - FunctionInfo{4203, nullptr, "SetDisplayLayerStack"}, - FunctionInfo{4205, nullptr, "SetDisplayPowerState"}, - FunctionInfo{4206, nullptr, "SetDefaultDisplay"}, - FunctionInfo{4207, nullptr, "ResetDisplayPanel"}, - FunctionInfo{4208, nullptr, "SetDisplayFatalErrorEnabled"}, - FunctionInfo{4209, nullptr, "IsDisplayPanelOn"}, - FunctionInfo{4300, nullptr, "GetInternalPanelId"}, - FunctionInfo{6000, C<&IManagerDisplayService::AddToLayerStack>, "AddToLayerStack"}, - FunctionInfo{6001, nullptr, "RemoveFromLayerStack"}, - FunctionInfo{6002, C<&IManagerDisplayService::SetLayerVisibility>, "SetLayerVisibility"}, - FunctionInfo{6003, nullptr, "SetLayerConfig"}, - FunctionInfo{6004, nullptr, "AttachLayerPresentationTracer"}, - FunctionInfo{6005, nullptr, "DetachLayerPresentationTracer"}, - FunctionInfo{6006, nullptr, "StartLayerPresentationRecording"}, - FunctionInfo{6007, nullptr, "StopLayerPresentationRecording"}, - FunctionInfo{6008, nullptr, "StartLayerPresentationFenceWait"}, - FunctionInfo{6009, nullptr, "StopLayerPresentationFenceWait"}, - FunctionInfo{6010, nullptr, "GetLayerPresentationAllFencesExpiredEvent"}, - FunctionInfo{6011, nullptr, "EnableLayerAutoClearTransitionBuffer"}, - FunctionInfo{6012, nullptr, "DisableLayerAutoClearTransitionBuffer"}, - FunctionInfo{6013, nullptr, "SetLayerOpacity"}, - FunctionInfo{6014, nullptr, "AttachLayerWatermarkCompositor"}, - FunctionInfo{6015, nullptr, "DetachLayerWatermarkCompositor"}, - FunctionInfo{7000, nullptr, "SetContentVisibility"}, - FunctionInfo{8000, nullptr, "SetConductorLayer"}, - FunctionInfo{8001, nullptr, "SetTimestampTracking"}, - FunctionInfo{8100, nullptr, "SetIndirectProducerFlipOffset"}, - FunctionInfo{8200, nullptr, "CreateSharedBufferStaticStorage"}, - FunctionInfo{8201, nullptr, "CreateSharedBufferTransferMemory"}, - FunctionInfo{8202, nullptr, "DestroySharedBuffer"}, - FunctionInfo{8203, nullptr, "BindSharedLowLevelLayerToManagedLayer"}, - FunctionInfo{8204, nullptr, "BindSharedLowLevelLayerToIndirectLayer"}, - FunctionInfo{8207, nullptr, "UnbindSharedLowLevelLayer"}, - FunctionInfo{8208, nullptr, "ConnectSharedLowLevelLayerToSharedBuffer"}, - FunctionInfo{8209, nullptr, "DisconnectSharedLowLevelLayerFromSharedBuffer"}, - FunctionInfo{8210, nullptr, "CreateSharedLayer"}, - FunctionInfo{8211, nullptr, "DestroySharedLayer"}, - FunctionInfo{8216, nullptr, "AttachSharedLayerToLowLevelLayer"}, - FunctionInfo{8217, nullptr, "ForceDetachSharedLayerFromLowLevelLayer"}, - FunctionInfo{8218, nullptr, "StartDetachSharedLayerFromLowLevelLayer"}, - FunctionInfo{8219, nullptr, "FinishDetachSharedLayerFromLowLevelLayer"}, - FunctionInfo{8220, nullptr, "GetSharedLayerDetachReadyEvent"}, - FunctionInfo{8221, nullptr, "GetSharedLowLevelLayerSynchronizedEvent"}, - FunctionInfo{8222, nullptr, "CheckSharedLowLevelLayerSynchronized"}, - FunctionInfo{8223, nullptr, "RegisterSharedBufferImporterAruid"}, - FunctionInfo{8224, nullptr, "UnregisterSharedBufferImporterAruid"}, - FunctionInfo{8227, nullptr, "CreateSharedBufferProcessHeap"}, - FunctionInfo{8228, nullptr, "GetSharedLayerLayerStacks"}, - FunctionInfo{8229, nullptr, "SetSharedLayerLayerStacks"}, - FunctionInfo{8291, nullptr, "PresentDetachedSharedFrameBufferToLowLevelLayer"}, - FunctionInfo{8292, nullptr, "FillDetachedSharedFrameBufferColor"}, - FunctionInfo{8293, nullptr, "GetDetachedSharedFrameBufferImage"}, - FunctionInfo{8294, nullptr, "SetDetachedSharedFrameBufferImage"}, - FunctionInfo{8295, nullptr, "CopyDetachedSharedFrameBufferImage"}, - FunctionInfo{8296, nullptr, "SetDetachedSharedFrameBufferSubImage"}, - FunctionInfo{8297, nullptr, "GetSharedFrameBufferContentParameter"}, - FunctionInfo{8298, nullptr, "ExpandStartupLogoOnSharedFrameBuffer"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IManagerDisplayService::IManagerDisplayService(Core::System& system_, std::shared_ptr container) : ServiceFramework{system_, "IManagerDisplayService"}, m_container{std::move(container)} { + // clang-format off + static const FunctionInfo functions[] = { + {200, nullptr, "AllocateProcessHeapBlock"}, + {201, nullptr, "FreeProcessHeapBlock"}, + {1102, nullptr, "GetDisplayResolution"}, + {2010, C<&IManagerDisplayService::CreateManagedLayer>, "CreateManagedLayer"}, + {2011, C<&IManagerDisplayService::DestroyManagedLayer>, "DestroyManagedLayer"}, + {2012, nullptr, "CreateStrayLayer"}, + {2050, nullptr, "CreateIndirectLayer"}, + {2051, nullptr, "DestroyIndirectLayer"}, + {2052, nullptr, "CreateIndirectProducerEndPoint"}, + {2053, nullptr, "DestroyIndirectProducerEndPoint"}, + {2054, nullptr, "CreateIndirectConsumerEndPoint"}, + {2055, nullptr, "DestroyIndirectConsumerEndPoint"}, + {2060, nullptr, "CreateWatermarkCompositor"}, + {2062, nullptr, "SetWatermarkText"}, + {2063, nullptr, "SetWatermarkLayerStacks"}, + {2300, nullptr, "AcquireLayerTexturePresentingEvent"}, + {2301, nullptr, "ReleaseLayerTexturePresentingEvent"}, + {2302, nullptr, "GetDisplayHotplugEvent"}, + {2303, nullptr, "GetDisplayModeChangedEvent"}, + {2402, nullptr, "GetDisplayHotplugState"}, + {2501, nullptr, "GetCompositorErrorInfo"}, + {2601, nullptr, "GetDisplayErrorEvent"}, + {2701, nullptr, "GetDisplayFatalErrorEvent"}, + {4201, nullptr, "SetDisplayAlpha"}, + {4203, nullptr, "SetDisplayLayerStack"}, + {4205, nullptr, "SetDisplayPowerState"}, + {4206, nullptr, "SetDefaultDisplay"}, + {4207, nullptr, "ResetDisplayPanel"}, + {4208, nullptr, "SetDisplayFatalErrorEnabled"}, + {4209, nullptr, "IsDisplayPanelOn"}, + {4300, nullptr, "GetInternalPanelId"}, + {6000, C<&IManagerDisplayService::AddToLayerStack>, "AddToLayerStack"}, + {6001, nullptr, "RemoveFromLayerStack"}, + {6002, C<&IManagerDisplayService::SetLayerVisibility>, "SetLayerVisibility"}, + {6003, nullptr, "SetLayerConfig"}, + {6004, nullptr, "AttachLayerPresentationTracer"}, + {6005, nullptr, "DetachLayerPresentationTracer"}, + {6006, nullptr, "StartLayerPresentationRecording"}, + {6007, nullptr, "StopLayerPresentationRecording"}, + {6008, nullptr, "StartLayerPresentationFenceWait"}, + {6009, nullptr, "StopLayerPresentationFenceWait"}, + {6010, nullptr, "GetLayerPresentationAllFencesExpiredEvent"}, + {6011, nullptr, "EnableLayerAutoClearTransitionBuffer"}, + {6012, nullptr, "DisableLayerAutoClearTransitionBuffer"}, + {6013, nullptr, "SetLayerOpacity"}, + {6014, nullptr, "AttachLayerWatermarkCompositor"}, + {6015, nullptr, "DetachLayerWatermarkCompositor"}, + {7000, nullptr, "SetContentVisibility"}, + {8000, nullptr, "SetConductorLayer"}, + {8001, nullptr, "SetTimestampTracking"}, + {8100, nullptr, "SetIndirectProducerFlipOffset"}, + {8200, nullptr, "CreateSharedBufferStaticStorage"}, + {8201, nullptr, "CreateSharedBufferTransferMemory"}, + {8202, nullptr, "DestroySharedBuffer"}, + {8203, nullptr, "BindSharedLowLevelLayerToManagedLayer"}, + {8204, nullptr, "BindSharedLowLevelLayerToIndirectLayer"}, + {8207, nullptr, "UnbindSharedLowLevelLayer"}, + {8208, nullptr, "ConnectSharedLowLevelLayerToSharedBuffer"}, + {8209, nullptr, "DisconnectSharedLowLevelLayerFromSharedBuffer"}, + {8210, nullptr, "CreateSharedLayer"}, + {8211, nullptr, "DestroySharedLayer"}, + {8216, nullptr, "AttachSharedLayerToLowLevelLayer"}, + {8217, nullptr, "ForceDetachSharedLayerFromLowLevelLayer"}, + {8218, nullptr, "StartDetachSharedLayerFromLowLevelLayer"}, + {8219, nullptr, "FinishDetachSharedLayerFromLowLevelLayer"}, + {8220, nullptr, "GetSharedLayerDetachReadyEvent"}, + {8221, nullptr, "GetSharedLowLevelLayerSynchronizedEvent"}, + {8222, nullptr, "CheckSharedLowLevelLayerSynchronized"}, + {8223, nullptr, "RegisterSharedBufferImporterAruid"}, + {8224, nullptr, "UnregisterSharedBufferImporterAruid"}, + {8227, nullptr, "CreateSharedBufferProcessHeap"}, + {8228, nullptr, "GetSharedLayerLayerStacks"}, + {8229, nullptr, "SetSharedLayerLayerStacks"}, + {8291, nullptr, "PresentDetachedSharedFrameBufferToLowLevelLayer"}, + {8292, nullptr, "FillDetachedSharedFrameBufferColor"}, + {8293, nullptr, "GetDetachedSharedFrameBufferImage"}, + {8294, nullptr, "SetDetachedSharedFrameBufferImage"}, + {8295, nullptr, "CopyDetachedSharedFrameBufferImage"}, + {8296, nullptr, "SetDetachedSharedFrameBufferSubImage"}, + {8297, nullptr, "GetSharedFrameBufferContentParameter"}, + {8298, nullptr, "ExpandStartupLogoOnSharedFrameBuffer"}, + }; + // clang-format on + + RegisterHandlers(functions); } IManagerDisplayService::~IManagerDisplayService() = default; diff --git a/src/core/hle/service/vi/manager_display_service.h b/src/core/hle/service/vi/manager_display_service.h index 1c7a79f337..2e05e730c7 100644 --- a/src/core/hle/service/vi/manager_display_service.h +++ b/src/core/hle/service/vi/manager_display_service.h @@ -37,7 +37,6 @@ public: Result SetLayerVisibility(bool visible, u64 layer_id); private: - std::optional FindRequest(u32 key) override; const std::shared_ptr m_container; }; diff --git a/src/core/hle/service/vi/manager_root_service.cpp b/src/core/hle/service/vi/manager_root_service.cpp index 0cc98bc2c0..094261e060 100644 --- a/src/core/hle/service/vi/manager_root_service.cpp +++ b/src/core/hle/service/vi/manager_root_service.cpp @@ -15,21 +15,18 @@ namespace Service::VI { -std::optional IManagerRootService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{2, C<&IManagerRootService::GetDisplayService>, "GetDisplayService"}, - FunctionInfo{3, nullptr, "GetDisplayServiceWithProxyNameExchange"}, - FunctionInfo{100, nullptr, "PrepareFatal"}, - FunctionInfo{101, nullptr, "ShowFatal"}, - FunctionInfo{102, nullptr, "DrawFatalRectangle"}, - FunctionInfo{103, nullptr, "DrawFatalText32"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - IManagerRootService::IManagerRootService(Core::System& system_, std::shared_ptr container) : ServiceFramework{system_, "vi:m"}, m_container{std::move(container)} { + static const FunctionInfo functions[] = { + {2, C<&IManagerRootService::GetDisplayService>, "GetDisplayService"}, + {3, nullptr, "GetDisplayServiceWithProxyNameExchange"}, + {100, nullptr, "PrepareFatal"}, + {101, nullptr, "ShowFatal"}, + {102, nullptr, "DrawFatalRectangle"}, + {103, nullptr, "DrawFatalText32"}, + }; + RegisterHandlers(functions); } IManagerRootService::~IManagerRootService() = default; diff --git a/src/core/hle/service/vi/manager_root_service.h b/src/core/hle/service/vi/manager_root_service.h index 78c0d1f80d..114dc36c07 100644 --- a/src/core/hle/service/vi/manager_root_service.h +++ b/src/core/hle/service/vi/manager_root_service.h @@ -29,7 +29,6 @@ public: Policy policy); private: - std::optional FindRequest(u32 key) override; const std::shared_ptr m_container; }; diff --git a/src/core/hle/service/vi/service_creator.cpp b/src/core/hle/service/vi/service_creator.cpp index 2b8e5f9577..34dbf7baae 100644 --- a/src/core/hle/service/vi/service_creator.cpp +++ b/src/core/hle/service/vi/service_creator.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/vi/service_creator.h b/src/core/hle/service/vi/service_creator.h index c6ba1797dc..8b50e94af5 100644 --- a/src/core/hle/service/vi/service_creator.h +++ b/src/core/hle/service/vi/service_creator.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/vi/shared_buffer_manager.h b/src/core/hle/service/vi/shared_buffer_manager.h index d1ce57ee27..807db10f31 100644 --- a/src/core/hle/service/vi/shared_buffer_manager.h +++ b/src/core/hle/service/vi/shared_buffer_manager.h @@ -18,10 +18,6 @@ class KPageGroup; class KReadableEvent; } // namespace Kernel -namespace Core { -class System; -} - namespace Service::android { class BufferQueueProducer; } diff --git a/src/core/hle/service/vi/system_display_service.cpp b/src/core/hle/service/vi/system_display_service.cpp index 997f0a51fc..aa225f69df 100644 --- a/src/core/hle/service/vi/system_display_service.cpp +++ b/src/core/hle/service/vi/system_display_service.cpp @@ -12,63 +12,63 @@ namespace Service::VI { -std::optional ISystemDisplayService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{1200, nullptr, "GetZOrderCountMin"}, - FunctionInfo{1202, nullptr, "GetZOrderCountMax"}, - FunctionInfo{1203, nullptr, "GetDisplayLogicalResolution"}, - FunctionInfo{1204, nullptr, "SetDisplayMagnification"}, - FunctionInfo{2201, nullptr, "SetLayerPosition"}, - FunctionInfo{2203, nullptr, "SetLayerSize"}, - FunctionInfo{2204, C<&ISystemDisplayService::GetLayerZ>, "GetLayerZ"}, - FunctionInfo{2205, C<&ISystemDisplayService::SetLayerZ>, "SetLayerZ"}, - FunctionInfo{2207, C<&ISystemDisplayService::SetLayerVisibility>, "SetLayerVisibility"}, - FunctionInfo{2209, nullptr, "SetLayerAlpha"}, - FunctionInfo{2210, nullptr, "SetLayerPositionAndSize"}, - FunctionInfo{2312, nullptr, "CreateStrayLayer"}, - FunctionInfo{2400, nullptr, "OpenIndirectLayer"}, - FunctionInfo{2401, nullptr, "CloseIndirectLayer"}, - FunctionInfo{2402, nullptr, "FlipIndirectLayer"}, - FunctionInfo{3000, C<&ISystemDisplayService::ListDisplayModes>, "ListDisplayModes"}, - FunctionInfo{3001, nullptr, "ListDisplayRgbRanges"}, - FunctionInfo{3002, nullptr, "ListDisplayContentTypes"}, - FunctionInfo{3200, C<&ISystemDisplayService::GetDisplayMode>, "GetDisplayMode"}, - FunctionInfo{3201, nullptr, "SetDisplayMode"}, - FunctionInfo{3202, nullptr, "GetDisplayUnderscan"}, - FunctionInfo{3203, nullptr, "SetDisplayUnderscan"}, - FunctionInfo{3204, nullptr, "GetDisplayContentType"}, - FunctionInfo{3205, nullptr, "SetDisplayContentType"}, - FunctionInfo{3206, nullptr, "GetDisplayRgbRange"}, - FunctionInfo{3207, nullptr, "SetDisplayRgbRange"}, - FunctionInfo{3208, nullptr, "GetDisplayCmuMode"}, - FunctionInfo{3209, nullptr, "SetDisplayCmuMode"}, - FunctionInfo{3210, nullptr, "GetDisplayContrastRatio"}, - FunctionInfo{3211, nullptr, "SetDisplayContrastRatio"}, - FunctionInfo{3214, nullptr, "GetDisplayGamma"}, - FunctionInfo{3215, nullptr, "SetDisplayGamma"}, - FunctionInfo{3216, nullptr, "GetDisplayCmuLuma"}, - FunctionInfo{3217, nullptr, "SetDisplayCmuLuma"}, - FunctionInfo{3218, nullptr, "SetDisplayCrcMode"}, - FunctionInfo{6013, nullptr, "GetLayerPresentationSubmissionTimestamps"}, - FunctionInfo{8225, C<&ISystemDisplayService::GetSharedBufferMemoryHandleId>, "GetSharedBufferMemoryHandleId"}, - FunctionInfo{8250, C<&ISystemDisplayService::OpenSharedLayer>, "OpenSharedLayer"}, - FunctionInfo{8251, nullptr, "CloseSharedLayer"}, - FunctionInfo{8252, C<&ISystemDisplayService::ConnectSharedLayer>, "ConnectSharedLayer"}, - FunctionInfo{8253, nullptr, "DisconnectSharedLayer"}, - FunctionInfo{8254, C<&ISystemDisplayService::AcquireSharedFrameBuffer>, "AcquireSharedFrameBuffer"}, - FunctionInfo{8255, C<&ISystemDisplayService::PresentSharedFrameBuffer>, "PresentSharedFrameBuffer"}, - FunctionInfo{8256, C<&ISystemDisplayService::GetSharedFrameBufferAcquirableEvent>, "GetSharedFrameBufferAcquirableEvent"}, - FunctionInfo{8257, nullptr, "FillSharedFrameBufferColor"}, - FunctionInfo{8258, C<&ISystemDisplayService::CancelSharedFrameBuffer>, "CancelSharedFrameBuffer"}, - FunctionInfo{9000, nullptr, "GetDp2hdmiController"} - ); - return HandlerTableGenerateWithFind(key, functions); +ISystemDisplayService::ISystemDisplayService(Core::System& system_, + std::shared_ptr container) + : ServiceFramework{system_, "ISystemDisplayService"}, m_container{std::move(container)} { + // clang-format off + static const FunctionInfo functions[] = { + {1200, nullptr, "GetZOrderCountMin"}, + {1202, nullptr, "GetZOrderCountMax"}, + {1203, nullptr, "GetDisplayLogicalResolution"}, + {1204, nullptr, "SetDisplayMagnification"}, + {2201, nullptr, "SetLayerPosition"}, + {2203, nullptr, "SetLayerSize"}, + {2204, C<&ISystemDisplayService::GetLayerZ>, "GetLayerZ"}, + {2205, C<&ISystemDisplayService::SetLayerZ>, "SetLayerZ"}, + {2207, C<&ISystemDisplayService::SetLayerVisibility>, "SetLayerVisibility"}, + {2209, nullptr, "SetLayerAlpha"}, + {2210, nullptr, "SetLayerPositionAndSize"}, + {2312, nullptr, "CreateStrayLayer"}, + {2400, nullptr, "OpenIndirectLayer"}, + {2401, nullptr, "CloseIndirectLayer"}, + {2402, nullptr, "FlipIndirectLayer"}, + {3000, C<&ISystemDisplayService::ListDisplayModes>, "ListDisplayModes"}, + {3001, nullptr, "ListDisplayRgbRanges"}, + {3002, nullptr, "ListDisplayContentTypes"}, + {3200, C<&ISystemDisplayService::GetDisplayMode>, "GetDisplayMode"}, + {3201, nullptr, "SetDisplayMode"}, + {3202, nullptr, "GetDisplayUnderscan"}, + {3203, nullptr, "SetDisplayUnderscan"}, + {3204, nullptr, "GetDisplayContentType"}, + {3205, nullptr, "SetDisplayContentType"}, + {3206, nullptr, "GetDisplayRgbRange"}, + {3207, nullptr, "SetDisplayRgbRange"}, + {3208, nullptr, "GetDisplayCmuMode"}, + {3209, nullptr, "SetDisplayCmuMode"}, + {3210, nullptr, "GetDisplayContrastRatio"}, + {3211, nullptr, "SetDisplayContrastRatio"}, + {3214, nullptr, "GetDisplayGamma"}, + {3215, nullptr, "SetDisplayGamma"}, + {3216, nullptr, "GetDisplayCmuLuma"}, + {3217, nullptr, "SetDisplayCmuLuma"}, + {3218, nullptr, "SetDisplayCrcMode"}, + {6013, nullptr, "GetLayerPresentationSubmissionTimestamps"}, + {8225, C<&ISystemDisplayService::GetSharedBufferMemoryHandleId>, "GetSharedBufferMemoryHandleId"}, + {8250, C<&ISystemDisplayService::OpenSharedLayer>, "OpenSharedLayer"}, + {8251, nullptr, "CloseSharedLayer"}, + {8252, C<&ISystemDisplayService::ConnectSharedLayer>, "ConnectSharedLayer"}, + {8253, nullptr, "DisconnectSharedLayer"}, + {8254, C<&ISystemDisplayService::AcquireSharedFrameBuffer>, "AcquireSharedFrameBuffer"}, + {8255, C<&ISystemDisplayService::PresentSharedFrameBuffer>, "PresentSharedFrameBuffer"}, + {8256, C<&ISystemDisplayService::GetSharedFrameBufferAcquirableEvent>, "GetSharedFrameBufferAcquirableEvent"}, + {8257, nullptr, "FillSharedFrameBufferColor"}, + {8258, C<&ISystemDisplayService::CancelSharedFrameBuffer>, "CancelSharedFrameBuffer"}, + {9000, nullptr, "GetDp2hdmiController"}, + }; + // clang-format on + RegisterHandlers(functions); } -ISystemDisplayService::ISystemDisplayService(Core::System& system_, std::shared_ptr container) - : ServiceFramework{system_, "ISystemDisplayService"}, m_container{std::move(container)} -{} - ISystemDisplayService::~ISystemDisplayService() = default; Result ISystemDisplayService::GetLayerZ(Out out_z_value, u64 layer_id) { diff --git a/src/core/hle/service/vi/system_display_service.h b/src/core/hle/service/vi/system_display_service.h index 04c9f0977e..a3b88c519d 100644 --- a/src/core/hle/service/vi/system_display_service.h +++ b/src/core/hle/service/vi/system_display_service.h @@ -47,7 +47,6 @@ private: Result CancelSharedFrameBuffer(u64 layer_id, s64 slot); private: - std::optional FindRequest(u32 key) override; const std::shared_ptr m_container; }; diff --git a/src/core/hle/service/vi/system_root_service.cpp b/src/core/hle/service/vi/system_root_service.cpp index c078be37a3..c761f136e2 100644 --- a/src/core/hle/service/vi/system_root_service.cpp +++ b/src/core/hle/service/vi/system_root_service.cpp @@ -14,17 +14,14 @@ namespace Service::VI { -std::optional ISystemRootService::FindRequest(u32 key) { - static constexpr auto functions = CreateStaticMap( - FunctionInfo{1, C<&ISystemRootService::GetDisplayService>, "GetDisplayService"}, - FunctionInfo{3, nullptr, "GetDisplayServiceWithProxyNameExchange"} - ); - return HandlerTableGenerateWithFind(key, functions); -} - ISystemRootService::ISystemRootService(Core::System& system_, std::shared_ptr container) - : ServiceFramework{system_, "vi:s"}, m_container{std::move(container)} -{} + : ServiceFramework{system_, "vi:s"}, m_container{std::move(container)} { + static const FunctionInfo functions[] = { + {1, C<&ISystemRootService::GetDisplayService>, "GetDisplayService"}, + {3, nullptr, "GetDisplayServiceWithProxyNameExchange"}, + }; + RegisterHandlers(functions); +} ISystemRootService::~ISystemRootService() = default; diff --git a/src/core/hle/service/vi/system_root_service.h b/src/core/hle/service/vi/system_root_service.h index baf516fec5..1587e0e30f 100644 --- a/src/core/hle/service/vi/system_root_service.h +++ b/src/core/hle/service/vi/system_root_service.h @@ -29,7 +29,6 @@ private: Out> out_application_display_service, Policy policy); - std::optional FindRequest(u32 key) override; const std::shared_ptr m_container; }; diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index b388efaf6f..2ea64f5d32 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/vi/vi.h b/src/core/hle/service/vi/vi.h index 7c1f350d84..bcc55228aa 100644 --- a/src/core/hle/service/vi/vi.h +++ b/src/core/hle/service/vi/vi.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/vi/vi_results.h b/src/core/hle/service/vi/vi_results.h index 22bac799f0..89b7317792 100644 --- a/src/core/hle/service/vi/vi_results.h +++ b/src/core/hle/service/vi/vi_results.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/vi/vi_types.h b/src/core/hle/service/vi/vi_types.h index 95ff663582..2d4287169a 100644 --- a/src/core/hle/service/vi/vi_types.h +++ b/src/core/hle/service/vi/vi_types.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/service/wlan/wlan.cpp b/src/core/hle/service/wlan/wlan.cpp index fa68ff51ba..bcd357d57a 100644 --- a/src/core/hle/service/wlan/wlan.cpp +++ b/src/core/hle/service/wlan/wlan.cpp @@ -16,248 +16,232 @@ class ILocalManager final : public ServiceFramework { public: explicit ILocalManager(Core::System& system_) : ServiceFramework{system_, "wlan:lcl"} - {} - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + { + static const FunctionInfo functions[] = { + { 0, nullptr, "OpenMasterMode" }, + { 0, nullptr, "OpenMode_2" }, + { 1, nullptr, "CloseMasterMode" }, + { 1, nullptr, "CloseMode_2" }, + { 2, nullptr, "OpenClientMode" }, + { 2, nullptr, "GetMacAddress_2" }, + { 3, nullptr, "CloseClientMode" }, + { 3, nullptr, "CreateBss" }, + { 4, nullptr, "OpenSpectatorMode" }, + { 4, nullptr, "DestroyBss" }, + { 5, nullptr, "CloseSpectatorMode" }, + { 5, nullptr, "StartScan_2" }, + { 6, nullptr, "GetMacAddress_2" }, + { 6, nullptr, "StopScan_2" }, + { 7, nullptr, "CreateBss" }, + { 7, nullptr, "Connect_2" }, + { 8, nullptr, "DestroyBss" }, + { 8, nullptr, "CancelConnect_2" }, + { 9, nullptr, "StartScan_2" }, + { 9, nullptr, "Join" }, + { 10, nullptr, "StopScan_2" }, + { 10, nullptr, "CancelJoin" }, + { 11, nullptr, "Connect_2" }, + { 11, nullptr, "Disconnect_2" }, + { 12, nullptr, "CancelConnect_2" }, + { 12, nullptr, "SetBeaconLostCount" }, + { 13, nullptr, "Join" }, + { 13, nullptr, "GetSystemEvent_2" }, + { 14, nullptr, "CancelJoin" }, + { 14, nullptr, "GetConnectionStatus_2" }, + { 15, nullptr, "Disconnect_2" }, + { 15, nullptr, "GetClientStatus" }, + { 16, nullptr, "SetBeaconLostCount" }, + { 16, nullptr, "GetBssIndicationEvent" }, + { 17, nullptr, "GetSystemEvent_2" }, + { 17, nullptr, "GetBssIndicationInfo" }, + { 18, nullptr, "GetConnectionStatus_2" }, + { 18, nullptr, "GetState_2" }, + { 19, nullptr, "GetClientStatus" }, + { 19, nullptr, "GetAllowedChannels" }, + { 20, nullptr, "GetBssIndicationEvent" }, + { 20, nullptr, "AddIe" }, + { 21, nullptr, "GetBssIndicationInfo" }, + { 21, nullptr, "DeleteIe" }, + { 22, nullptr, "GetState_2" }, + { 22, nullptr, "PutFrameRaw" }, + { 23, nullptr, "GetAllowedChannels" }, + { 23, nullptr, "CancelGetFrame" }, + { 24, nullptr, "AddIe" }, + { 24, nullptr, "CreateRxEntry" }, + { 25, nullptr, "DeleteIe" }, + { 25, nullptr, "DeleteRxEntry" }, + { 26, nullptr, "PutFrameRaw" }, + { 26, nullptr, "AddEthertypeToRxEntry" }, + { 27, nullptr, "CancelGetFrame" }, + { 27, nullptr, "DeleteEthertypeFromRxEntry" }, + { 28, nullptr, "CreateRxEntry" }, + { 28, nullptr, "AddMatchingDataToRxEntry" }, + { 29, nullptr, "DeleteRxEntry" }, + { 29, nullptr, "RemoveMatchingDataFromRxEntry" }, + { 30, nullptr, "AddEthertypeToRxEntry" }, + { 30, nullptr, "GetScanResult_2" }, + { 31, nullptr, "DeleteEthertypeFromRxEntry" }, + { 31, nullptr, "PutActionFrameOneShot" }, + { 32, nullptr, "AddMatchingDataToRxEntry" }, + { 32, nullptr, "SetActionFrameWithBeacon" }, + { 33, nullptr, "RemoveMatchingDataFromRxEntry" }, + { 33, nullptr, "CancelActionFrameWithBeacon" }, + { 34, nullptr, "GetScanResult_2" }, + { 34, nullptr, "CreateRxEntryForActionFrame" }, + { 35, nullptr, "PutActionFrameOneShot" }, + { 35, nullptr, "DeleteRxEntryForActionFrame" }, + { 36, nullptr, "SetActionFrameWithBeacon" }, + { 36, nullptr, "AddSubtypeToRxEntryForActionFrame" }, + { 37, nullptr, "CancelActionFrameWithBeacon" }, + { 37, nullptr, "DeleteSubtypeFromRxEntryForActionFrame" }, + { 38, nullptr, "CreateRxEntryForActionFrame" }, + { 38, nullptr, "CancelGetActionFrame" }, + { 39, nullptr, "DeleteRxEntryForActionFrame" }, + { 39, nullptr, "GetRssi_2" }, + { 40, nullptr, "AddSubtypeToRxEntryForActionFrame" }, + { 40, nullptr, "SetMaxAssociationNumber" }, + { 41, nullptr, "DeleteSubtypeFromRxEntryForActionFrame" }, + { 41, nullptr, "Cmd41" }, + { 42, nullptr, "CancelGetActionFrame" }, + { 42, nullptr, "Cmd42" }, + { 43, nullptr, "GetRssi_2" }, + { 43, nullptr, "Cmd43" }, + { 44, nullptr, "SetMaxAssociationNumber" }, + { 45, nullptr, "OpenLcsMasterMode" }, + { 46, nullptr, "CloseLcsMasterMode" }, + { 47, nullptr, "OpenLcsClientMode" }, + { 48, nullptr, "CloseLcsClientMode" }, + { 49, nullptr, "GetChannelStats" }, + { 50, nullptr, "Cmd50" }, + { 51, nullptr, "Cmd51" }, + { 52, nullptr, "Cmd52" }, + }; + RegisterHandlers(functions); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "OpenMasterMode"}, - FunctionInfo{0, nullptr, "OpenMode_2"}, - FunctionInfo{1, nullptr, "CloseMasterMode"}, - FunctionInfo{1, nullptr, "CloseMode_2"}, - FunctionInfo{2, nullptr, "OpenClientMode"}, - FunctionInfo{2, nullptr, "GetMacAddress_2"}, - FunctionInfo{3, nullptr, "CloseClientMode"}, - FunctionInfo{3, nullptr, "CreateBss"}, - FunctionInfo{4, nullptr, "OpenSpectatorMode"}, - FunctionInfo{4, nullptr, "DestroyBss"}, - FunctionInfo{5, nullptr, "CloseSpectatorMode"}, - FunctionInfo{5, nullptr, "StartScan_2"}, - FunctionInfo{6, nullptr, "GetMacAddress_2"}, - FunctionInfo{6, nullptr, "StopScan_2"}, - FunctionInfo{7, nullptr, "CreateBss"}, - FunctionInfo{7, nullptr, "Connect_2"}, - FunctionInfo{8, nullptr, "DestroyBss"}, - FunctionInfo{8, nullptr, "CancelConnect_2"}, - FunctionInfo{9, nullptr, "StartScan_2"}, - FunctionInfo{9, nullptr, "Join"}, - FunctionInfo{10, nullptr, "StopScan_2"}, - FunctionInfo{10, nullptr, "CancelJoin"}, - FunctionInfo{11, nullptr, "Connect_2"}, - FunctionInfo{11, nullptr, "Disconnect_2"}, - FunctionInfo{12, nullptr, "CancelConnect_2"}, - FunctionInfo{12, nullptr, "SetBeaconLostCount"}, - FunctionInfo{13, nullptr, "Join"}, - FunctionInfo{13, nullptr, "GetSystemEvent_2"}, - FunctionInfo{14, nullptr, "CancelJoin"}, - FunctionInfo{14, nullptr, "GetConnectionStatus_2"}, - FunctionInfo{15, nullptr, "Disconnect_2"}, - FunctionInfo{15, nullptr, "GetClientStatus"}, - FunctionInfo{16, nullptr, "SetBeaconLostCount"}, - FunctionInfo{16, nullptr, "GetBssIndicationEvent"}, - FunctionInfo{17, nullptr, "GetSystemEvent_2"}, - FunctionInfo{17, nullptr, "GetBssIndicationInfo"}, - FunctionInfo{18, nullptr, "GetConnectionStatus_2"}, - FunctionInfo{18, nullptr, "GetState_2"}, - FunctionInfo{19, nullptr, "GetClientStatus"}, - FunctionInfo{19, nullptr, "GetAllowedChannels"}, - FunctionInfo{20, nullptr, "GetBssIndicationEvent"}, - FunctionInfo{20, nullptr, "AddIe"}, - FunctionInfo{21, nullptr, "GetBssIndicationInfo"}, - FunctionInfo{21, nullptr, "DeleteIe"}, - FunctionInfo{22, nullptr, "GetState_2"}, - FunctionInfo{22, nullptr, "PutFrameRaw"}, - FunctionInfo{23, nullptr, "GetAllowedChannels"}, - FunctionInfo{23, nullptr, "CancelGetFrame"}, - FunctionInfo{24, nullptr, "AddIe"}, - FunctionInfo{24, nullptr, "CreateRxEntry"}, - FunctionInfo{25, nullptr, "DeleteIe"}, - FunctionInfo{25, nullptr, "DeleteRxEntry"}, - FunctionInfo{26, nullptr, "PutFrameRaw"}, - FunctionInfo{26, nullptr, "AddEthertypeToRxEntry"}, - FunctionInfo{27, nullptr, "CancelGetFrame"}, - FunctionInfo{27, nullptr, "DeleteEthertypeFromRxEntry"}, - FunctionInfo{28, nullptr, "CreateRxEntry"}, - FunctionInfo{28, nullptr, "AddMatchingDataToRxEntry"}, - FunctionInfo{29, nullptr, "DeleteRxEntry"}, - FunctionInfo{29, nullptr, "RemoveMatchingDataFromRxEntry"}, - FunctionInfo{30, nullptr, "AddEthertypeToRxEntry"}, - FunctionInfo{30, nullptr, "GetScanResult_2"}, - FunctionInfo{31, nullptr, "DeleteEthertypeFromRxEntry"}, - FunctionInfo{31, nullptr, "PutActionFrameOneShot"}, - FunctionInfo{32, nullptr, "AddMatchingDataToRxEntry"}, - FunctionInfo{32, nullptr, "SetActionFrameWithBeacon"}, - FunctionInfo{33, nullptr, "RemoveMatchingDataFromRxEntry"}, - FunctionInfo{33, nullptr, "CancelActionFrameWithBeacon"}, - FunctionInfo{34, nullptr, "GetScanResult_2"}, - FunctionInfo{34, nullptr, "CreateRxEntryForActionFrame"}, - FunctionInfo{35, nullptr, "PutActionFrameOneShot"}, - FunctionInfo{35, nullptr, "DeleteRxEntryForActionFrame"}, - FunctionInfo{36, nullptr, "SetActionFrameWithBeacon"}, - FunctionInfo{36, nullptr, "AddSubtypeToRxEntryForActionFrame"}, - FunctionInfo{37, nullptr, "CancelActionFrameWithBeacon"}, - FunctionInfo{37, nullptr, "DeleteSubtypeFromRxEntryForActionFrame"}, - FunctionInfo{38, nullptr, "CreateRxEntryForActionFrame"}, - FunctionInfo{38, nullptr, "CancelGetActionFrame"}, - FunctionInfo{39, nullptr, "DeleteRxEntryForActionFrame"}, - FunctionInfo{39, nullptr, "GetRssi_2"}, - FunctionInfo{40, nullptr, "AddSubtypeToRxEntryForActionFrame"}, - FunctionInfo{40, nullptr, "SetMaxAssociationNumber"}, - FunctionInfo{41, nullptr, "DeleteSubtypeFromRxEntryForActionFrame"}, - FunctionInfo{41, nullptr, "Cmd41"}, - FunctionInfo{42, nullptr, "CancelGetActionFrame"}, - FunctionInfo{42, nullptr, "Cmd42"}, - FunctionInfo{43, nullptr, "GetRssi_2"}, - FunctionInfo{43, nullptr, "Cmd43"}, - FunctionInfo{44, nullptr, "SetMaxAssociationNumber"}, - FunctionInfo{45, nullptr, "OpenLcsMasterMode"}, - FunctionInfo{46, nullptr, "CloseLcsMasterMode"}, - FunctionInfo{47, nullptr, "OpenLcsClientMode"}, - FunctionInfo{48, nullptr, "CloseLcsClientMode"}, - FunctionInfo{49, nullptr, "GetChannelStats"}, - FunctionInfo{50, nullptr, "Cmd50"}, - FunctionInfo{51, nullptr, "Cmd51"}, - FunctionInfo{52, nullptr, "Cmd52"} - ); }; class ILocalGetFrame final : public ServiceFramework { public: explicit ILocalGetFrame(Core::System& system_) : ServiceFramework{system_, "wlan:lg"} - {} - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + { + static const FunctionInfo functions[] = { + { 0, nullptr, "GetFrameRaw" }, + }; + RegisterHandlers(functions); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetFrameRaw" } - ); }; class ILocalGetActionFrame final : public ServiceFramework { public: explicit ILocalGetActionFrame(Core::System& system_) : ServiceFramework{system_, "wlan:lga"} - {} - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + { + static const FunctionInfo functions[] = { + { 0, nullptr, "GetActionFrame" }, + }; + RegisterHandlers(functions); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetActionFrame" } - ); }; class ISocketGetFrame final : public ServiceFramework { public: explicit ISocketGetFrame(Core::System& system_) : ServiceFramework{system_, "wlan:sg"} - {} - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + { + static const FunctionInfo functions[] = { + { 0, nullptr, "GetFrameRaw" }, + }; + RegisterHandlers(functions); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetFrameRaw" } - ); }; class ISocketManager final : public ServiceFramework { public: explicit ISocketManager(Core::System& system_) : ServiceFramework{system_, "wlan:soc"} - {} - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + { + static const FunctionInfo functions[] = { + { 0, nullptr, "PutFrameRaw_2" }, + { 1, nullptr, "CancelGetFrame_2" }, + { 2, nullptr, "CreateRxEntry_2" }, + { 3, nullptr, "DeleteRxEntry_2" }, + { 4, nullptr, "AddEthertypeToRxEntry_2" }, + { 5, nullptr, "DeleteEthertypeFromRxEntry_2" }, + { 6, nullptr, "GetMacAddress_3" }, + { 7, nullptr, "SwitchTsfTimerFunction" }, + { 8, nullptr, "GetDeltaTimeBetweenSystemAndTsf" }, + { 9, nullptr, "RegisterSharedMemory" }, + { 10, nullptr, "UnregisterSharedMemory" }, + { 11, nullptr, "EnableSharedMemory" }, + { 12, nullptr, "SetMulticastFilter" }, + }; + RegisterHandlers(functions); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "PutFrameRaw_2"}, - FunctionInfo{1, nullptr, "CancelGetFrame_2"}, - FunctionInfo{2, nullptr, "CreateRxEntry_2"}, - FunctionInfo{3, nullptr, "DeleteRxEntry_2"}, - FunctionInfo{4, nullptr, "AddEthertypeToRxEntry_2"}, - FunctionInfo{5, nullptr, "DeleteEthertypeFromRxEntry_2"}, - FunctionInfo{6, nullptr, "GetMacAddress_3"}, - FunctionInfo{7, nullptr, "SwitchTsfTimerFunction"}, - FunctionInfo{8, nullptr, "GetDeltaTimeBetweenSystemAndTsf"}, - FunctionInfo{9, nullptr, "RegisterSharedMemory"}, - FunctionInfo{10, nullptr, "UnregisterSharedMemory"}, - FunctionInfo{11, nullptr, "EnableSharedMemory"}, - FunctionInfo{12, nullptr, "SetMulticastFilter"} - ); }; class IDetectManager final : public ServiceFramework { public: explicit IDetectManager(Core::System& system_) : ServiceFramework{system_, "wlan:dtc"} - {} - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + { + static const FunctionInfo functions[] = { + { 0, nullptr, "Cmd0" }, + { 1, nullptr, "Cmd1" }, + { 2, nullptr, "Cmd2" }, + { 3, nullptr, "Cmd3" }, + { 4, nullptr, "Cmd4" }, + { 5, nullptr, "Cmd5" }, + { 6, nullptr, "Cmd6" }, + { 7, nullptr, "Cmd7" }, + { 8, nullptr, "Cmd8" }, + { 9, nullptr, "Cmd9" }, + { 10, nullptr, "Cmd10" }, + { 11, nullptr, "Cmd11" }, + { 12, nullptr, "Cmd12" }, + { 13, nullptr, "Cmd13" }, + { 14, nullptr, "Cmd14" }, + { 15, nullptr, "Cmd15" }, + { 16, nullptr, "Cmd16" }, + { 17, nullptr, "Cmd17" }, + { 18, nullptr, "Cmd18" }, + { 19, nullptr, "Cmd19" }, + { 20, nullptr, "Cmd20" }, + { 21, nullptr, "Cmd21" }, + { 22, nullptr, "Cmd22" }, + { 23, nullptr, "Cmd23" }, + { 24, nullptr, "Cmd24" }, + { 25, nullptr, "Cmd25" }, + { 26, nullptr, "Cmd26" }, + { 27, nullptr, "Cmd27" }, + }; + RegisterHandlers(functions); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "Cmd0"}, - FunctionInfo{1, nullptr, "Cmd1"}, - FunctionInfo{2, nullptr, "Cmd2"}, - FunctionInfo{3, nullptr, "Cmd3"}, - FunctionInfo{4, nullptr, "Cmd4"}, - FunctionInfo{5, nullptr, "Cmd5"}, - FunctionInfo{6, nullptr, "Cmd6"}, - FunctionInfo{7, nullptr, "Cmd7"}, - FunctionInfo{8, nullptr, "Cmd8"}, - FunctionInfo{9, nullptr, "Cmd9"}, - FunctionInfo{10, nullptr, "Cmd10"}, - FunctionInfo{11, nullptr, "Cmd11"}, - FunctionInfo{12, nullptr, "Cmd12"}, - FunctionInfo{13, nullptr, "Cmd13"}, - FunctionInfo{14, nullptr, "Cmd14"}, - FunctionInfo{15, nullptr, "Cmd15"}, - FunctionInfo{16, nullptr, "Cmd16"}, - FunctionInfo{17, nullptr, "Cmd17"}, - FunctionInfo{18, nullptr, "Cmd18"}, - FunctionInfo{19, nullptr, "Cmd19"}, - FunctionInfo{20, nullptr, "Cmd20"}, - FunctionInfo{21, nullptr, "Cmd21"}, - FunctionInfo{22, nullptr, "Cmd22"}, - FunctionInfo{23, nullptr, "Cmd23"}, - FunctionInfo{24, nullptr, "Cmd24"}, - FunctionInfo{25, nullptr, "Cmd25"}, - FunctionInfo{26, nullptr, "Cmd26"}, - FunctionInfo{27, nullptr, "Cmd27"} - ); }; class IPrivateServiceCreator final : public ServiceFramework { public: explicit IPrivateServiceCreator(Core::System& system_) : ServiceFramework{system_, "wlan:p"} - {} - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + { + static const FunctionInfo functions[] = { + { 0, nullptr, "CreateWirelessCommunicationService" }, + { 1, nullptr, "CreatePrivateWirelessCommunicationService" }, + }; + RegisterHandlers(functions); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "CreateWirelessCommunicationService"}, - FunctionInfo{1, nullptr, "CreatePrivateWirelessCommunicationService"} - ); }; class ISfDriverServiceCreator final : public ServiceFramework { public: explicit ISfDriverServiceCreator(Core::System& system_) : ServiceFramework{system_, "wlan:nd"} - {} - - std::optional FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + { + static const FunctionInfo functions[] = { + { 0, nullptr, "CreateDriverService" }, + }; + RegisterHandlers(functions); } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "CreateDriverService" } - ); }; void LoopProcess(Core::System& system) { diff --git a/tools/README.md b/tools/README.md index f6a520a69c..cde6a21464 100644 --- a/tools/README.md +++ b/tools/README.md @@ -8,7 +8,7 @@ Tools for Eden and other subprojects. When adding new scripts please use `#!/bin ## Binaries -- `maxwell-spirv`: Converts Maxwell shaders (dumped from `.ash` files) into SPIR-V code sent to stdout. +- `maxwell-spirv`: Converts Maxwell shaders (dumped from `.ash` files) into SPIR-V code (emitted into STDOUT). - `maxwell-disas`: Dumb raw Maxwell disassembler. - `maxwell-ir`: Dump generated IR of Maxwell shaders. From aaa0bcb9bf5694d62538c361b210147294a5ce3d Mon Sep 17 00:00:00 2001 From: xbzk Date: Thu, 15 Oct 2026 12:13:17 +0200 Subject: [PATCH 15/32] [patcher, ro, settings] runtime tls patch (#4492) optimization and nuke toggle (#4502) (#4523) - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- This is a follow up for the biomutant fix. By the time i knew it was shallow, coz i was running patchtext routine even for svc and modules, causing a routine which were needed to run 14 times to run 4000+ instead. Since some perf loss was reported in 30 sep nightly, and it caused ac3r to not boot, we had added a temp toggle, which is now being removed as optimizations + fix are in. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4523 Reviewed-by: lizzie Reviewed-by: MaranBr --- .../features/settings/model/BooleanSetting.kt | 3 +- .../settings/model/view/SettingsItem.kt | 7 --- .../settings/ui/SettingsFragmentPresenter.kt | 1 - .../app/src/main/res/values/strings.xml | 2 - src/common/settings.h | 2 - src/core/arm/nce/patcher.cpp | 42 +++++++++++++ src/core/arm/nce/patcher.h | 7 +++ src/core/hle/service/ro/ro.cpp | 62 ++++++++++++------- src/qt_common/config/shared_translation.cpp | 4 -- 9 files changed, 89 insertions(+), 41 deletions(-) diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt index 2f2d3823f8..0548004cf5 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt @@ -17,7 +17,6 @@ enum class BooleanSetting(override val key: String) : AbstractBooleanSetting { USE_CUSTOM_CPU_TICKS("use_custom_cpu_ticks"), SKIP_CPU_INNER_INVALIDATION("skip_cpu_inner_invalidation"), NCE_INVALIDATION_GPU_READBACK("nce_invalidation_gpu_readback"), - NCE_RUNTIME_NRO_PATCH("nce_runtime_nro_patch"), FIX_BLOOM_EFFECTS("fix_bloom_effects"), EMULATE_BGR565("emulate_bgr565"), RESCALE_HACK("rescale_hack"), @@ -95,7 +94,7 @@ enum class BooleanSetting(override val key: String) : AbstractBooleanSetting { ENABLE_QUICK_SETTINGS("enable_quick_settings"); -// external fun isFrameSkippingEnabled(): Boolean + //external fun isFrameSkippingEnabled(): Boolean external fun isFrameInterpolationEnabled(): Boolean override fun getBoolean(needsGlobal: Boolean): Boolean = diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt index 8346339ee4..690c746628 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt @@ -866,13 +866,6 @@ abstract class SettingsItem( descriptionId = R.string.nce_invalidation_gpu_readback_description ) ) - put( - SwitchSetting( - BooleanSetting.NCE_RUNTIME_NRO_PATCH, - titleId = R.string.nce_runtime_nro_patch, - descriptionId = R.string.nce_runtime_nro_patch_description - ) - ) put( SwitchSetting( BooleanSetting.FIX_BLOOM_EFFECTS, diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt index 74e1e90836..f9185e39e6 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt @@ -555,7 +555,6 @@ class SettingsFragmentPresenter( add(BooleanSetting.SKIP_CPU_INNER_INVALIDATION.key) add(BooleanSetting.NCE_INVALIDATION_GPU_READBACK.key) - add(BooleanSetting.NCE_RUNTIME_NRO_PATCH.key) add(BooleanSetting.FIX_BLOOM_EFFECTS.key) add(BooleanSetting.EMULATE_BGR565.key) add(BooleanSetting.RENDERER_ASYNCHRONOUS_SHADERS.key) diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml index 703a91fd02..191506c818 100644 --- a/src/android/app/src/main/res/values/strings.xml +++ b/src/android/app/src/main/res/values/strings.xml @@ -595,8 +595,6 @@ Skips certain CPU-side cache invalidations during memory updates, reducing CPU usage and improving it\'s performance. This may cause glitches or crashes on some games. GPU Readback Before NCE Invalidation Temporary. Fix Ender Magnolia (and other UE titles) crashes. May reduce performance. Improvement in progress. - Patch Runtime NROs for NCE - Temporary. Fix Biomutant boot. May impact performance. Improvement in progress. Fix Bloom Effects Reduces bloom blur in LA/EOW (Adreno A6XX - A7XX/ Turnip), removes bloom in Burnout. Warning: may cause graphical artifacts in other games. Emulate BGR565 diff --git a/src/common/settings.h b/src/common/settings.h index 2a4bf3e9e4..d1f891607b 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -641,8 +641,6 @@ struct Values { true}; SwitchableSetting nce_invalidation_gpu_readback{ linkage, false, "nce_invalidation_gpu_readback", Category::RendererHacks}; - SwitchableSetting nce_runtime_nro_patch{ - linkage, false, "nce_runtime_nro_patch", Category::RendererHacks}; SwitchableSetting async_presentation{linkage, #ifdef __ANDROID__ true, diff --git a/src/core/arm/nce/patcher.cpp b/src/core/arm/nce/patcher.cpp index 7d2041d4d2..f21d7cacdc 100644 --- a/src/core/arm/nce/patcher.cpp +++ b/src/core/arm/nce/patcher.cpp @@ -45,6 +45,23 @@ Patcher::Patcher() : c(m_patch_instructions), c_pre(m_patch_instructions_pre) { WriteLoadContext(c_pre); } +Patcher::Patcher(std::span text) : c(m_patch_instructions), c_pre(m_patch_instructions_pre) { + modules.emplace_back(); + curr_patch = &modules.back(); + const auto words = std::span{reinterpret_cast(text.data()), text.size() / sizeof(u32)}; + for (u32 i = ModuleCodeIndex; i < static_cast(words.size()); ++i) { + const uintptr_t offset = i * sizeof(u32); + if (auto mrs = MRS{words[i]}; mrs.Verify() && mrs.GetRt() != 31 && (mrs.GetSystemReg() == TpidrEl0 || mrs.GetSystemReg() == TpidrroEl0)) { + BranchToPatch(offset); + const auto src_reg = mrs.GetSystemReg() == TpidrroEl0 ? oaknut::SystemReg::TPIDRRO_EL0 : oaknut::SystemReg::TPIDR_EL0; + WriteMrsHandler(offset + sizeof(u32), oaknut::XReg{static_cast(mrs.GetRt())}, src_reg); + } else if (auto msr = MSR{words[i]}; msr.Verify() && msr.GetSystemReg() == TpidrEl0) { + BranchToPatch(offset); + WriteMsrHandler(offset + sizeof(u32), oaknut::XReg{static_cast(msr.GetRt())}); + } + } +} + Patcher::~Patcher() = default; bool Patcher::PatchText(std::span program_image, const Kernel::CodeSet::Segment& code) { @@ -182,6 +199,31 @@ bool Patcher::PatchText(std::span program_image, const Kernel::CodeSet return true; } +std::span Patcher::RelocateRuntimeTls( + s64 patch_offset, std::vector& out_patches) { + const auto& patch = modules.front(); + const auto can_branch = [](s64 offset) { + return offset % 4 == 0 && offset >= -static_cast(MaxRelativeBranch) && offset < static_cast(MaxRelativeBranch); + }; + out_patches.clear(); + out_patches.reserve(patch.m_branch_to_patch_relocations.size()); + for (const auto& rel : patch.m_branch_to_patch_relocations) { + const s64 offset = patch_offset + rel.patch_offset - static_cast(rel.module_offset); + if (!can_branch(offset)) {return {};} + u32 replacement; + oaknut::CodeGenerator rc{&replacement}; + rc.B(offset); + out_patches.push_back({rel.module_offset, replacement}); + } + for (const auto& rel : patch.m_branch_to_module_relocations) { + const s64 offset = static_cast(rel.module_offset) - patch_offset - rel.patch_offset; + if (!can_branch(offset)) {return {};} + oaknut::CodeGenerator rc{m_patch_instructions.data() + rel.patch_offset / sizeof(u32)}; + rc.B(offset); + } + return m_patch_instructions; +} + bool Patcher::RelocateAndCopy(Common::ProcessAddress load_base, const Kernel::CodeSet::Segment& code, std::vector& program_image, EntryTrampolines* out_trampolines) { const size_t patch_size = GetSectionSize(); const size_t pre_patch_size = GetPreSectionSize(); diff --git a/src/core/arm/nce/patcher.h b/src/core/arm/nce/patcher.h index a3b314000c..695161cd18 100644 --- a/src/core/arm/nce/patcher.h +++ b/src/core/arm/nce/patcher.h @@ -48,15 +48,22 @@ using ModuleTextAddress = u64; using PatchTextAddress = u64; using EntryTrampolines = ::Common::unordered_map; +struct InstructionPatch { + u64 offset; + u32 replacement; +}; + class Patcher { public: void SetModuleID(const ModuleID& id) { module_id = id; } explicit Patcher(); + explicit Patcher(std::span text); ~Patcher(); bool PatchText(std::span program_image, const Kernel::CodeSet::Segment& code); bool RelocateAndCopy(Common::ProcessAddress load_base, const Kernel::CodeSet::Segment& code, std::vector& program_image, EntryTrampolines* out_trampolines); + std::span RelocateRuntimeTls(s64 patch_offset, std::vector& out_patches); size_t GetSectionSize() const noexcept; size_t GetPreSectionSize() const noexcept; diff --git a/src/core/hle/service/ro/ro.cpp b/src/core/hle/service/ro/ro.cpp index 167bf04c9a..335efa3ad3 100644 --- a/src/core/hle/service/ro/ro.cpp +++ b/src/core/hle/service/ro/ro.cpp @@ -7,6 +7,7 @@ #include #include +#include "common/scope_exit.h" #include "core/hle/kernel/k_process.h" #include "core/hle/service/cmif_serialization.h" @@ -425,36 +426,51 @@ public: R_TRY(context->ValidateNro(std::addressof(nro_info->module_id), std::addressof(rx_size), std::addressof(ro_size), std::addressof(rw_size), nro_info->base_address, nro_size, bss_size)); + R_TRY(SetNroPerms(context->GetProcess(), nro_info->base_address, rx_size, ro_size, rw_size + bss_size)); #ifdef HAS_NCE - if (Settings::values.nce_runtime_nro_patch.GetValue()) { - if (Settings::IsNceEnabled()) { - auto* process = context->GetProcess(); - auto& memory = process->GetMemory(); - - std::vector image(total_size); - memory.ReadBlock(nro_info->base_address, image.data(), rx_size); - - Kernel::CodeSet::Segment code{.size = static_cast(rx_size)}; - Core::NCE::Patcher patch; - patch.PatchText(image, code); - patch.RelocateAndCopy(nro_info->base_address, code, image, nullptr); - - const u64 patch_address = nro_info->base_address + total_size; - const size_t patch_size = patch.GetSectionSize(); + if (Settings::IsNceEnabled()) { + auto* process = context->GetProcess(); + auto& memory = process->GetMemory(); + std::vector text(rx_size); + memory.ReadBlock(nro_info->base_address, text.data(), text.size()); + Core::NCE::Patcher patch{text}; + const size_t patch_size = patch.GetSectionSize(); + if (patch_size != 0) { constexpr auto permission = Kernel::Svc::MemoryPermission::ReadExecute; - auto* patch_memory = Kernel::KSharedMemory::Create(kernel); + SCOPE_EXIT { patch_memory->Close(kernel); }; R_TRY(patch_memory->Initialize(kernel, kernel.System().DeviceMemory(), process, permission, permission, patch_size)); - std::memcpy(patch_memory->GetPointer(), image.data() + total_size, patch_size); - R_TRY(process->AddSharedMemory(kernel, patch_memory, patch_address, patch_size)); - R_TRY(patch_memory->Map(*process, patch_address, patch_size, permission)); - memory.WriteBlock(nro_info->base_address, image.data(), rx_size); + Kernel::KSharedMemory::Register(kernel, patch_memory); + const std::array offsets{static_cast(total_size + Kernel::PageSize),-static_cast(patch_size + Kernel::PageSize)}; + std::vector tls_patches; + std::span instructions; + u64 patch_address = 0; + for (const s64 offset : offsets) { + instructions = patch.RelocateRuntimeTls(offset, tls_patches); + if (instructions.empty()) {continue;} + const u64 address = static_cast(static_cast(nro_info->base_address) + offset); + if (R_FAILED(patch_memory->Map(*process, address, patch_size, permission))) {continue;} + patch_address = address; + break; + } + R_UNLESS(patch_address != 0, RO::ResultOutOfAddressSpace); + const Result add_shared_memory_result = process->AddSharedMemory(kernel, patch_memory, patch_address, patch_size); + if (R_FAILED(add_shared_memory_result)) { + R_ASSERT(patch_memory->Unmap(*process, patch_address, patch_size)); + } + R_TRY(add_shared_memory_result); + std::memcpy(patch_memory->GetPointer(), instructions.data(), instructions.size_bytes()); + auto* ptr = reinterpret_cast(patch_address); + __builtin___clear_cache(ptr, ptr + instructions.size_bytes()); + for (const auto& instruction : tls_patches) { + const u64 address = nro_info->base_address + instruction.offset; + memory.Write32(address, instruction.replacement); + ptr = reinterpret_cast(address); + __builtin___clear_cache(ptr, ptr + sizeof(u32)); + } } } #endif - // Set NRO perms. - R_TRY(SetNroPerms(context->GetProcess(), nro_info->base_address, rx_size, ro_size, - rw_size + bss_size)); context->SetNroInfoInUse(nro_info, true); nro_info->code_size = rx_size + ro_size; diff --git a/src/qt_common/config/shared_translation.cpp b/src/qt_common/config/shared_translation.cpp index 964a4cdad4..09e64b98f0 100644 --- a/src/qt_common/config/shared_translation.cpp +++ b/src/qt_common/config/shared_translation.cpp @@ -198,10 +198,6 @@ std::unique_ptr InitializeTranslations(QObject* parent) { tr("GPU Readback Before NCE Invalidation"), tr("Flushes GPU buffer data back to guest memory before NCE invalidates the whole " "guest page, preserving it while the CPU store proceeds.")); - INSERT(Settings, nce_runtime_nro_patch, - tr("Patch Runtime NROs for NCE"), - tr("Applies NCE code patches to runtime-loaded NRO modules." - "This is required for some games to run correctly.")); INSERT(Settings, vsync_mode, tr("VSync Mode:"), tr("FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen " "refresh rate.\nFIFO Relaxed allows tearing as it recovers from a slow down.\n" From d8c6c59b679867d2595fdc0953df033475e23380 Mon Sep 17 00:00:00 2001 From: PavelBARABANOV Date: Fri, 16 Oct 2026 01:17:53 +0200 Subject: [PATCH 16/32] Fix Check Strings after 4523 (#4534) - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md). - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4534 --- src/android/app/src/main/res/values-ar/strings.xml | 2 -- src/android/app/src/main/res/values-zh-rTW/strings.xml | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/android/app/src/main/res/values-ar/strings.xml b/src/android/app/src/main/res/values-ar/strings.xml index 09722b486e..2fdff9847b 100644 --- a/src/android/app/src/main/res/values-ar/strings.xml +++ b/src/android/app/src/main/res/values-ar/strings.xml @@ -589,8 +589,6 @@ يتخطى بعض عمليات إبطال ذاكرة التخزين المؤقتة من جانب وحدة المعالجة المركزية أثناء تحديثات الذاكرة، مما يقلل من استخدام وحدة المعالجة المركزية ويحسن أداءها. قد يتسبب ذلك في حدوث أعطال أو تعطل في بعض الألعاب. إعادة قراءة وحدة معالجة الرسومات قبل إبطال صلاحية NCE إصلاح مؤقت. يعالج مشكلة تعطل لعبة Ender Magnolia (وغيرها من ألعاب UE). قد يؤدي إلى انخفاض في الأداء. يجري العمل على تحسينه. - تصحيح حالات NRO في وقت التشغيل لـ NCE - حل مؤقت. إصلاح مشكلة تشغيل لعبة Biomutant. قد يؤثر ذلك على الأداء. يجري العمل على تحسينه. إصلاح تأثيرات التوهج يقلل من ضبابية التوهج في LA/EOW (Adreno A6XX - A7XX/ Turnip)، ويزيل التوهج في Burnout. تحذير: قد يسبب تشوهات رسومية في ألعاب أخرى. محاكاة BGR565 diff --git a/src/android/app/src/main/res/values-zh-rTW/strings.xml b/src/android/app/src/main/res/values-zh-rTW/strings.xml index 3f3272daf4..3f0c6d9215 100644 --- a/src/android/app/src/main/res/values-zh-rTW/strings.xml +++ b/src/android/app/src/main/res/values-zh-rTW/strings.xml @@ -579,8 +579,6 @@ 在記憶體更新期間跳過某些 CPU 端快取的失效處理,減少 CPU 使用率並提高其性能。可能會導致某些遊戲出現故障或當機 在 NCE 無效化前進行 GPU 回讀 (暫時性功能)修復 \"終結者瑪格諾莉亞:霧中綻放\" 及其它使用虛幻引擎之遊戲中的當機問題,可能會降低效能。此功能正在改善中 - 對 NCE Runtime 的 NRO 檔案進行修補 - (暫時性功能)修復 \"Biomutant\" 的啟動問題,可能會對效能造成影響。此功能正在改善中 修正光暈特效 在 \"薩爾達傳說:織夢島\" 和 \"薩爾達傳說:智慧的再現\" 中減少光暈模糊的問題並移除 \"橫衝直撞:狂飆樂園重製版\" 中的光暈效果(適用於 Adreno A6XX - A7XX/ Turnip)。警告:可能會在其它遊戲中導致圖形異常 模擬 BGR565 @@ -1197,4 +1195,4 @@ 授權 來自 AMD 的升級圖像品質 - + \ No newline at end of file From e0d47f2790e3f758fa2188926a0bb2f56af6b310 Mon Sep 17 00:00:00 2001 From: crueter Date: Fri, 16 Oct 2026 21:41:11 +0200 Subject: [PATCH 17/32] [cmake] fix macOS compilation by forcing lz4 to be static (#4540) Signed-off-by: crueter - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md). - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4540 --- CMakeModules/find/Findlz4.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeModules/find/Findlz4.cmake b/CMakeModules/find/Findlz4.cmake index d4f2153162..77ac390160 100644 --- a/CMakeModules/find/Findlz4.cmake +++ b/CMakeModules/find/Findlz4.cmake @@ -24,7 +24,7 @@ else() endif() if (lz4_FOUND AND NOT TARGET lz4::lz4) - if (TARGET LZ4::lz4_shared) + if (TARGET LZ4::lz4_shared AND NOT YUZU_STATIC_BUILD) add_library(lz4::lz4 ALIAS LZ4::lz4_shared) elseif (TARGET LZ4::lz4_static) add_library(lz4::lz4 ALIAS LZ4::lz4_static) From de7e6e01d43e8cf2ec193d74fa053b0d7949955f Mon Sep 17 00:00:00 2001 From: John Date: Sun, 18 Oct 2026 00:17:28 +0200 Subject: [PATCH 18/32] Revert [input_common/joycon] Enumerate SDL devices iff SDL signals change (#4486) (#4545) Due to causing the platform windows to crash when a controller is activated. - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md). - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Co-authored-by: Your Name Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4545 Reviewed-by: lizzie Reviewed-by: Maufeat --- src/input_common/drivers/joycon.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/input_common/drivers/joycon.cpp b/src/input_common/drivers/joycon.cpp index 047e7eb6d8..ded92d3f1d 100644 --- a/src/input_common/drivers/joycon.cpp +++ b/src/input_common/drivers/joycon.cpp @@ -83,21 +83,20 @@ void Joycons::ScanThread(std::stop_token stop_token) { constexpr u16 nintendo_vendor_id = 0x057e; Common::SetCurrentThreadName("JoyconScanThread"); - auto last_ret = 0u; do { - auto ret = SDL_hid_device_change_count(); - if (last_ret == 0u || last_ret != ret) { - last_ret = ret; - SDL_hid_device_info* devs = SDL_hid_enumerate(nintendo_vendor_id, 0x0); - for (auto* cur_dev = devs; cur_dev; cur_dev = cur_dev->next) { - if (IsDeviceNew(cur_dev)) { - LOG_DEBUG(Input, "Device Found,type : {:04X} {:04X}", cur_dev->vendor_id, cur_dev->product_id); - RegisterNewDevice(cur_dev); - } - cur_dev = cur_dev->next; + SDL_hid_device_info* devs = SDL_hid_enumerate(nintendo_vendor_id, 0x0); + SDL_hid_device_info* cur_dev = devs; + + while (cur_dev) { + if (IsDeviceNew(cur_dev)) { + LOG_DEBUG(Input, "Device Found,type : {:04X} {:04X}", cur_dev->vendor_id, + cur_dev->product_id); + RegisterNewDevice(cur_dev); } - SDL_hid_free_enumeration(devs); + cur_dev = cur_dev->next; } + + SDL_hid_free_enumeration(devs); } while (Common::StoppableTimedWait(stop_token, std::chrono::seconds{5})); } From 989768aa46720e3fcab9e2111e3ddd70819c382b Mon Sep 17 00:00:00 2001 From: John Date: Mon, 19 Oct 2026 15:58:04 +0200 Subject: [PATCH 19/32] Fix [core, gpu, threads] Multithreading refactor (#4254) (#4548) Performance loss regression fixed in Link's Awakening, Castlevania, Super Mario RPG, etc Tested by Mr. Knobs on Android and myself on Linux Multicore ON may be fixed for some users using Intel CPUs. Games include: FF Tactics, Shredder's Revenge, Unity Engine Games. - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md). - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4548 Reviewed-by: Maufeat Reviewed-by: lizzie --- .../service/nvnflinger/hardware_composer.cpp | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/core/hle/service/nvnflinger/hardware_composer.cpp b/src/core/hle/service/nvnflinger/hardware_composer.cpp index 5decb791e1..9ac56e17bb 100644 --- a/src/core/hle/service/nvnflinger/hardware_composer.cpp +++ b/src/core/hle/service/nvnflinger/hardware_composer.cpp @@ -57,8 +57,21 @@ u32 HardwareComposer::ComposeLocked(f32* out_speed_scale, Display& display, // Set default speed limit to 100%. *out_speed_scale = 1.0f; + // If no layers are visible, skip the logic. Acquiring and holding buffers here would + // consume the producer's queue without ever presenting. + bool any_visible = false; + for (auto& layer : display.stack.layers) { + if (layer->visible) { + any_visible = true; + break; + } + } + if (!any_visible) { + return 1; + } + + // Wait for the previous composite, bounding the number of in-flight composites. nvdisp.WaitForComposite(); - this->ReleaseFramebuffersLocked(display); // Determine the number of vsync periods to wait before composing again. std::optional swap_interval{}; @@ -152,6 +165,13 @@ u32 HardwareComposer::ComposeLocked(f32* out_speed_scale, Display& display, // Advance by 1 frame (60 FPS compositing) m_frame_number += 1; + // Release framebuffers once the frame has been handed to the compositor. This happens + // within the same vsync period as the acquire (release_frame_number is checked against + // the advanced counter), so the producer gets its buffers back immediately instead of + // losing a queue slot for a whole frame. + // TODO: support release fences; releasing before the composite has finished can tear. + this->ReleaseFramebuffersLocked(display); + return 1; } From 305f40100d76ec57b13c2f03eafd490db83691cb Mon Sep 17 00:00:00 2001 From: PavelBARABANOV Date: Sun, 25 Oct 2026 10:03:16 +0100 Subject: [PATCH 20/32] Fix aarch and android builds (#4576) - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md). - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- credit: John and Crueter Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4576 Reviewed-by: crueter --- src/android/app/build.gradle.kts | 2 +- src/core/arm/nce/arm_nce_asm_definitions.h | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/android/app/build.gradle.kts b/src/android/app/build.gradle.kts index 3ae6d73994..69dd6a8e4f 100644 --- a/src/android/app/build.gradle.kts +++ b/src/android/app/build.gradle.kts @@ -259,7 +259,7 @@ android { externalNativeBuild { cmake { - version = "3.31.6" + version = "3.31.5" path = file("${edenDir}/CMakeLists.txt") } } diff --git a/src/core/arm/nce/arm_nce_asm_definitions.h b/src/core/arm/nce/arm_nce_asm_definitions.h index 8ea4383f73..ec6abd62d2 100644 --- a/src/core/arm/nce/arm_nce_asm_definitions.h +++ b/src/core/arm/nce/arm_nce_asm_definitions.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + /* SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project */ /* SPDX-License-Identifier: GPL-2.0-or-later */ @@ -5,9 +8,22 @@ #define __ASSEMBLY__ +// Newer Linux UAPI headers check __ASSEMBLER__ instead of __ASSEMBLY__ to hide C declarations. +// Without it, asm-generic/signal.h redeclares sigset_t and clashes with glibc's. Only define it +// around these includes, since glibc headers also look at __ASSEMBLER__. +#ifndef __ASSEMBLER__ +#define __ASSEMBLER__ +#define EDEN_NCE_UNDEF_ASSEMBLER +#endif + #include #include +#ifdef EDEN_NCE_UNDEF_ASSEMBLER +#undef __ASSEMBLER__ +#undef EDEN_NCE_UNDEF_ASSEMBLER +#endif + #define ReturnToRunCodeByExceptionLevelChangeSignal SIGUSR2 #define BreakFromRunCodeSignal SIGURG #define GuestAccessFaultSignal SIGSEGV From eb88a40a8eb0fe847281ea6913fcc7ff7daedcd2 Mon Sep 17 00:00:00 2001 From: PavelBARABANOV Date: Sun, 25 Oct 2026 16:06:46 +0100 Subject: [PATCH 21/32] [qt] fix graphics API toggle getting stuck on OpenGL_GLSL (#4577) - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md). - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4577 Reviewed-by: crueter Reviewed-by: CamilleLaVey --- src/yuzu/main_window.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/yuzu/main_window.cpp b/src/yuzu/main_window.cpp index 60bfbae5cd..6e21265f9e 100644 --- a/src/yuzu/main_window.cpp +++ b/src/yuzu/main_window.cpp @@ -3661,12 +3661,12 @@ void MainWindow::OnToggleGraphicsAPI() { api = Settings::RendererBackend::OpenGL_GLSL; break; case Settings::RendererBackend::OpenGL_GLSL: - api = Settings::RendererBackend::OpenGL_GLSL; - break; - case Settings::RendererBackend::OpenGL_SPIRV: api = Settings::RendererBackend::OpenGL_GLASM; break; case Settings::RendererBackend::OpenGL_GLASM: + api = Settings::RendererBackend::OpenGL_SPIRV; + break; + case Settings::RendererBackend::OpenGL_SPIRV: api = Settings::RendererBackend::Null; break; #else From 05f36d990ce5301b310871451201a72e4c52b4df Mon Sep 17 00:00:00 2001 From: PavelBARABANOV Date: Mon, 26 Oct 2026 16:23:23 +0100 Subject: [PATCH 22/32] [chore] re-add out/ to .gitignore (#4578) - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md). - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4578 Reviewed-by: crueter Reviewed-by: CamilleLaVey --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 20ed5e93c1..873b99bec2 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ # Build directory /[Bb]uild*/ doc-build/ +out/ AppDir/ uruntime From 58968bd1274d8ebb1f159ad31500dde8d74abea6 Mon Sep 17 00:00:00 2001 From: PavelBARABANOV Date: Mon, 26 Oct 2026 17:23:18 +0100 Subject: [PATCH 23/32] [core] Support block-compressed NSZ and XCZ (#4552) - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md). - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- - Add NCZBLOCK (nsz -B / .xcz) reader: each read decodes only the covered blocks and re-encrypts CTR sections, no disk output. - Allow installing solid .nsz to NAND via DecompressNCZForInstall (lazy, incremental decode with frontier, O(n) instead of O(n^2)). - Accept BKTR updates with thousands of sections (MaxSectionCount = 0x10000). - Wire .nsz/.xcz into loader, registered cache, scanner, and NAND install (content_manager.h), and reject solid NCZ from the game list. - Bump the pinned zstd to 33618c8 in cpmfile.json, which includes the upstream AArch64 revert ([33618c89](https://github.com/facebook/zstd/commit/33618c89e511637f8a6ef955b3501766d71feb53)) for a ZSTD_decodeSequence branch optimization that could corrupt data on ARM64; without it, solid NCZ decoding on Android fails with "Data corruption detected". NCZ format and CTR counter semantics follow the reference nsz tool and its Rust port: - https://github.com/nicoboss/nsz (Decompressor.py, BlockDecompressorReader.py) - https://docs.rs/nsz-rs/0.3.0/src/nsz_rs/decompress.rs.html The last-block edge case (decompressed size is an exact multiple of block size) is handled as described in https://github.com/nicoboss/nsz/issues/210 Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4552 Reviewed-by: CamilleLaVey Reviewed-by: Shinmegumi --- cpmfile.json | 4 +- .../main/java/org/yuzu/yuzu_emu/model/Game.kt | 2 +- .../org/yuzu/yuzu_emu/utils/GameHelper.kt | 2 +- .../app/src/main/jni/game_metadata.cpp | 4 +- src/common/zstd_compression.cpp | 9 + src/common/zstd_compression.h | 14 + src/core/CMakeLists.txt | 2 + src/core/crypto/ncz_decompressor.cpp | 430 ++++++++++++++++++ src/core/crypto/ncz_decompressor.h | 35 ++ src/core/file_sys/registered_cache.cpp | 46 +- src/core/file_sys/submission_package.cpp | 12 + src/core/loader/loader.cpp | 48 +- src/core/loader/loader.h | 2 + src/core/loader/nsp.cpp | 11 + src/frontend_common/content_manager.h | 6 +- src/qt_common/game_list/worker.cpp | 10 +- src/qt_common/qt_common.cpp | 3 +- src/yuzu/main_window.cpp | 11 +- 18 files changed, 624 insertions(+), 27 deletions(-) create mode 100644 src/core/crypto/ncz_decompressor.cpp create mode 100644 src/core/crypto/ncz_decompressor.h diff --git a/cpmfile.json b/cpmfile.json index 9cac812b7a..0032734712 100644 --- a/cpmfile.json +++ b/cpmfile.json @@ -351,13 +351,13 @@ }, "zstd": { "find_args": "MODULE", - "hash": "cc5ad4b119a9c2ea57f0b71eeff01113bb506e0d17000159c5409cb8236d22e38c52d5e9e97e7947a4bf1b2dfc44b6c503ab2d9aedbd59458435c6a2849cb029", + "hash": "2b006c3c110c38bd2f5896b42d36a38931c8eae261f30552f9a9fd04458d218d8f1a1425f117fd12af545ed77042e4b2d1a1a9b6286c4d0b9d74ef79f20a8f08", "min_version": "1.5", "options": [ "ZSTD_BUILD_SHARED OFF" ], "repo": "facebook/zstd", "source_subdir": "build/cmake", - "version": "b8d6101fba" + "version": "33618c8" } } diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/Game.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/Game.kt index 6717894c93..f5f0cda0e9 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/Game.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/Game.kt @@ -100,7 +100,7 @@ class Game( companion object { val extensions: Set = HashSet( - listOf("xci", "nsp", "nca", "nro") + listOf("xci", "nsp", "nca", "nro", "nsz", "xcz") ) } } diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GameHelper.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GameHelper.kt index 411b764e36..bb2337a310 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GameHelper.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GameHelper.kt @@ -109,7 +109,7 @@ object GameHelper { // File extensions considered as external content, buuut should // be done better imo. - private val externalContentExtensions = setOf("nsp", "xci") + private val externalContentExtensions = setOf("nsp", "xci", "nsz", "xcz") private fun scanContentContainersRecursive( files: Array, diff --git a/src/android/app/src/main/jni/game_metadata.cpp b/src/android/app/src/main/jni/game_metadata.cpp index 49d92bca75..9b6cd44e9f 100644 --- a/src/android/app/src/main/jni/game_metadata.cpp +++ b/src/android/app/src/main/jni/game_metadata.cpp @@ -76,7 +76,9 @@ jboolean Java_org_yuzu_yuzu_1emu_utils_GameMetadata_getIsValid(JNIEnv* env, jobj auto const file_type = loader->GetFileType(); if (file_type == Loader::FileType::Unknown || file_type == Loader::FileType::Error) return false; - if ((file_type == Loader::FileType::NSP || file_type == Loader::FileType::XCI) && !Loader::IsBootableGameContainer(file, file_type)) + if ((file_type == Loader::FileType::NSP || file_type == Loader::FileType::XCI || + file_type == Loader::FileType::NSZ || file_type == Loader::FileType::XCZ) && + !Loader::IsBootableGameContainer(file, file_type)) return false; u64 program_id = 0; return loader->ReadProgramId(program_id) == Loader::ResultStatus::Success; diff --git a/src/common/zstd_compression.cpp b/src/common/zstd_compression.cpp index cb6ec171b5..7665482ee6 100644 --- a/src/common/zstd_compression.cpp +++ b/src/common/zstd_compression.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -46,4 +49,10 @@ std::vector DecompressDataZSTD(std::span compressed) { return decompressed; } +std::size_t DecompressDataZSTD(std::span compressed, std::span output) { + const std::size_t result = + ZSTD_decompress(output.data(), output.size(), compressed.data(), compressed.size()); + return ZSTD_isError(result) ? 0 : result; +} + } // namespace Common::Compression diff --git a/src/common/zstd_compression.h b/src/common/zstd_compression.h index a5ab2d05bd..819d7d201a 100644 --- a/src/common/zstd_compression.h +++ b/src/common/zstd_compression.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -42,4 +45,15 @@ namespace Common::Compression { */ [[nodiscard]] std::vector DecompressDataZSTD(std::span compressed); +/** + * Decompresses a single Zstandard frame into a caller-provided buffer of known size. + * + * @param compressed the compressed source memory region. + * @param output the destination buffer. Its size is the maximum number of bytes to write. + * + * @return the number of bytes written, or 0 if the frame is invalid or doesn't fit. An empty + * frame also returns 0. + */ +[[nodiscard]] std::size_t DecompressDataZSTD(std::span compressed, std::span output); + } // namespace Common::Compression diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 31f9931d3a..1b578f67ba 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -33,6 +33,8 @@ add_library(core STATIC crypto/encryption_layer.h crypto/key_manager.cpp crypto/key_manager.h + crypto/ncz_decompressor.cpp + crypto/ncz_decompressor.h crypto/partition_data_manager.cpp crypto/partition_data_manager.h crypto/xts_encryption_layer.cpp diff --git a/src/core/crypto/ncz_decompressor.cpp b/src/core/crypto/ncz_decompressor.cpp new file mode 100644 index 0000000000..5f56e55375 --- /dev/null +++ b/src/core/crypto/ncz_decompressor.cpp @@ -0,0 +1,430 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "common/common_types.h" +#include "common/logging.h" +#include "common/zstd_compression.h" +#include "core/crypto/aes_util.h" +#include "core/crypto/key_manager.h" +#include "core/crypto/ncz_decompressor.h" +#include "core/file_sys/vfs/vfs.h" + +namespace Core::Crypto { + +namespace { + +constexpr u64 HeaderSize = 0x4000; +constexpr std::size_t SectionWire = 0x40; +constexpr std::size_t BlockFixed = 0x18; +constexpr std::size_t Chunk = 0x100000; +// Upper bound on NCZ section entries (64 bytes each, so the table is at most 4 MiB). A base NCA +// has a handful of sections, but nsz stores an update's patch (BKTR) data one entry per +// subsection, which is thousands of them. +constexpr u64 MaxSectionCount = 0x10000; +constexpr std::array SectionsMagic{'N', 'C', 'Z', 'S', 'E', 'C', 'T', 'N'}; +constexpr std::array BlockMagic{'N', 'C', 'Z', 'B', 'L', 'O', 'C', 'K'}; + +struct Section { + s64 offset, size; + u64 crypto_type; + Key128 key, counter; + bool Ctr() const { return crypto_type == 3 || crypto_type == 4; } +}; + +struct BlockHeader { + u32 exponent; + u64 decompressed_size; + std::vector sizes; +}; + +u64 Le(const u8* p, std::size_t n) { + u64 v = 0; + for (std::size_t i = n; i-- > 0;) v = (v << 8) | p[i]; + return v; +} + +// Mirrors nsz AESCTR.seek(): upper 8 bytes = stored counter, lower 8 = absolute NCA offset / 16. +void SetIv(Key128& iv, const Key128& base, u64 off) { + iv = base; + u64 blk = off >> 4; + for (std::size_t i = 0; i < 8; ++i) { iv[15 - i] = static_cast(blk & 0xFF); blk >>= 8; } +} + +// Parse header + section table + optional block header. Returns payload_start. +std::optional, std::optional>> ParseHeader( + const FileSys::VirtualFile& f, u64& payload_start) { + const u64 fsize = f->GetSize(); + if (fsize < HeaderSize + 16) return std::nullopt; + + const auto head = f->ReadBytes(16, HeaderSize); + if (head.size() != 16 || !std::equal(head.begin(), head.begin() + 8, SectionsMagic.begin())) + return std::nullopt; + const u64 count = Le(head.data() + 8, 8); + if (count == 0 || count > MaxSectionCount || count * SectionWire > fsize - HeaderSize - 16) + return std::nullopt; + + const auto table = f->ReadBytes(count * SectionWire, HeaderSize + 16); + if (table.size() != count * SectionWire) return std::nullopt; + + std::vector
sections; + sections.reserve(count + 1); + for (u64 i = 0; i < count; ++i) { + const u8* e = table.data() + i * SectionWire; + Section s{}; + s.offset = static_cast(Le(e, 8)); + s.size = static_cast(Le(e + 8, 8)); + s.crypto_type = Le(e + 16, 8); + std::memcpy(s.key.data(), e + 32, 16); + std::memcpy(s.counter.data(), e + 48, 16); + sections.push_back(s); + } + + const u64 block_start = HeaderSize + 16 + count * SectionWire; + const auto fixed = f->ReadBytes(BlockFixed, block_start); + std::optional bh; + if (fixed.size() == BlockFixed && + std::equal(fixed.begin(), fixed.begin() + 8, BlockMagic.begin())) { + BlockHeader b{}; + b.exponent = fixed[11]; + const s32 n = static_cast(Le(fixed.data() + 12, 4)); + if (n <= 0) return std::nullopt; + b.decompressed_size = Le(fixed.data() + 16, 8); + const auto sizes = f->ReadBytes(static_cast(n) * 4, block_start + BlockFixed); + if (sizes.size() != static_cast(n) * 4) return std::nullopt; + b.sizes.resize(n); + for (s32 i = 0; i < n; ++i) b.sizes[i] = static_cast(Le(sizes.data() + i * 4, 4)); + payload_start = block_start + BlockFixed + static_cast(n) * 4; + bh = std::move(b); + } else { + payload_start = block_start; + } + + if (!sections.empty() && sections[0].offset > static_cast(HeaderSize)) { + Section fake{}; + fake.offset = static_cast(HeaderSize); + fake.size = sections[0].offset - static_cast(HeaderSize); + sections.insert(sections.begin(), fake); + } + return std::make_pair(std::move(sections), std::move(bh)); +} + +// Sequential reader over independently-compressed blocks, one block cached (like nsz_rs). +class BlockReader { +public: + BlockReader(FileSys::VirtualFile f, const BlockHeader& bh, u64 payload_start) + : source{std::move(f)}, block_size{1ULL << bh.exponent}, sizes{bh.sizes}, + decompressed_size{bh.decompressed_size} { + if (bh.exponent < 14 || bh.exponent > 32 || sizes.empty()) + throw std::runtime_error("bad NCZBLOCK header"); + u64 off = payload_start; + offsets.reserve(sizes.size()); + for (u32 s : sizes) { offsets.push_back(off); off += s; } + } + + // Fills `out` from `position`; returns bytes written. + std::size_t ReadAt(u64 position, std::span out) { + std::size_t done = 0; + while (done < out.size() && position < decompressed_size) { + const u64 id = position / block_size; + if (id >= sizes.size()) break; + if (cache_id != id && !Load(id)) break; + const u64 in = position - id * block_size; + const std::size_t n = static_cast( + std::min(out.size() - done, cache.size() - in)); + std::memcpy(out.data() + done, cache.data() + in, n); + done += n; + position += n; + } + return done; + } + +private: + bool Load(u64 id) { + u64 want = block_size; + if (id + 1 == sizes.size()) { + const u64 rem = decompressed_size % block_size; + if (rem > 0) want = rem; // avoid the 0-size bug from the original nsz + } + try { cache.resize(static_cast(want)); } + catch (const std::bad_alloc&) { return false; } + const u32 csize = sizes[id]; + if (csize < want) { + const auto comp = source->ReadBytes(csize, offsets[id]); + if (comp.size() != csize || + Common::Compression::DecompressDataZSTD(comp, cache) != want) return false; + } else if (source->Read(cache.data(), cache.size(), offsets[id]) != cache.size()) { + return false; + } + cache_id = id; + return true; + } + + FileSys::VirtualFile source; + u64 block_size; + std::vector offsets; + std::vector sizes; + u64 decompressed_size; + u64 cache_id = ~0ULL; + std::vector cache; +}; + +class BlockNczFile final : public FileSys::VfsFile { +public: + BlockNczFile(std::string name_, std::vector hdr_, std::vector
sections_, + std::unique_ptr body_) + : name{std::move(name_)}, hdr{std::move(hdr_)}, sections{std::move(sections_)}, + body{std::move(body_)} { + nca_size = HeaderSize; + for (const auto& s : sections) + nca_size = std::max(nca_size, static_cast(s.offset + s.size)); + ciphers.reserve(sections.size()); + for (const auto& s : sections) + ciphers.push_back(s.Ctr() ? std::make_unique>(s.key, Mode::CTR) + : nullptr); + } + + std::string GetName() const override { return name; } + std::size_t GetSize() const override { return static_cast(nca_size); } + bool Resize(std::size_t) override { return false; } + FileSys::VirtualDir GetContainingDirectory() const override { return nullptr; } + bool IsWritable() const override { return false; } + bool IsReadable() const override { return true; } + + std::size_t Read(u8* data, std::size_t len, std::size_t off) const override { + if (off >= nca_size) return 0; + len = static_cast(std::min(len, nca_size - off)); + const u64 end = off + len; + u64 pos = off; + if (pos < HeaderSize) { + const u64 n = std::min(end, HeaderSize) - pos; + std::memcpy(data, hdr.data() + pos, static_cast(n)); + pos += n; + } + std::scoped_lock lock{mutex}; + for (std::size_t i = 0; i < sections.size() && pos < end; ++i) { + const auto& s = sections[i]; + const u64 begin = std::max(static_cast(s.offset), HeaderSize); + const u64 stop = std::max(static_cast(s.offset + s.size), begin); + if (stop <= pos) continue; + if (pos < begin) { + const u64 g = std::min(end, begin); + std::memset(data + (pos - off), 0, static_cast(g - pos)); + pos = g; + if (pos >= end) break; + } + const u64 pe = std::min(end, stop); + const std::span piece(data + (pos - off), static_cast(pe - pos)); + if (body->ReadAt(pos - HeaderSize, piece) != piece.size()) + return static_cast(pos - off); + if (ciphers[i]) { + Key128 iv{}; + SetIv(iv, s.counter, pos); + ciphers[i]->SetIV(iv); + ciphers[i]->Transcode(piece.data(), piece.size(), piece.data(), Op::Encrypt); + } + pos = pe; + } + return len; + } + + std::size_t Write(const u8*, std::size_t, std::size_t) override { return 0; } + bool Rename(std::string_view) override { return false; } + +private: + const std::string name; + const std::vector hdr; + const std::vector
sections; + const std::unique_ptr body; + std::vector>> ciphers; + mutable std::mutex mutex; + u64 nca_size{}; +}; + +// Solid NCZ: one zstd stream over the whole body. Decoded incrementally into memory, up to the +// requested offset, so sequential install reads are O(n) instead of O(n^2). +class SolidNczFile final : public FileSys::VfsFile { +public: + SolidNczFile(std::string name_, FileSys::VirtualFile source_, + std::vector
sections_, u64 payload_start_) + : name{std::move(name_)}, source{std::move(source_)}, sections{std::move(sections_)}, + payload_start{payload_start_} { + const auto raw_header = source->ReadBytes(HeaderSize, 0); + data.assign(raw_header.begin(), raw_header.end()); + frontier = HeaderSize; + } + + ~SolidNczFile() override { + if (stream != nullptr) ZSTD_freeDStream(stream); + } + + std::string GetName() const override { return name; } + std::size_t GetSize() const override { + u64 size = HeaderSize; + for (const auto& s : sections) + size = std::max(size, static_cast(s.offset + s.size)); + return static_cast(size); + } + bool Resize(std::size_t) override { return false; } + FileSys::VirtualDir GetContainingDirectory() const override { return nullptr; } + bool IsWritable() const override { return false; } + bool IsReadable() const override { return true; } + + std::size_t Read(u8* out, std::size_t len, std::size_t off) const override { + std::scoped_lock lock{mutex}; + const u64 nca_size = GetSize(); + if (off >= nca_size) return 0; + len = static_cast(std::min(len, nca_size - off)); + const u64 needed = off + len; + if (needed > frontier && !DecodeTo(needed)) return 0; + std::memcpy(out, data.data() + off, len); + return len; + } + + std::size_t Write(const u8*, std::size_t, std::size_t) override { return 0; } + bool Rename(std::string_view) override { return false; } + +private: + bool DecodeTo(u64 needed) const { + if (stream == nullptr) { + stream = ZSTD_createDStream(); + if (stream == nullptr) return false; + ZSTD_DCtx_setParameter(stream, ZSTD_d_windowLogMax, 31); + read_pos = payload_start; + } + + const u64 file_size = source->GetSize(); + std::vector out_buf(Chunk); + + std::size_t index = 0; + for (; index < sections.size(); ++index) { + const auto& s = sections[index]; + const u64 begin = std::max(static_cast(s.offset), HeaderSize); + const u64 end = std::max(static_cast(s.offset) + static_cast(s.size), + begin); + if (end > frontier) break; + } + + for (; index < sections.size() && frontier < needed; ++index) { + const auto& s = sections[index]; + const u64 begin = std::max(static_cast(s.offset), HeaderSize); + const u64 end = std::max(static_cast(s.offset) + static_cast(s.size), + begin); + if (end <= frontier) continue; + u64 pos = std::max(begin, frontier); + + std::optional> cipher; + if (s.Ctr()) cipher.emplace(s.key, Mode::CTR); + + while (pos < end && frontier < needed) { + const u64 want = std::min(end - pos, out_buf.size()); + std::size_t produced = 0; + while (produced < want) { + if (in.pos >= in.size) { + const u64 remaining = file_size - read_pos; + const std::size_t chunk = static_cast( + std::min(Chunk, remaining)); + if (chunk == 0) { LOG_ERROR(Crypto, "Solid NCZ: truncated"); return false; } + const auto bytes = source->ReadBytes(chunk, read_pos); + if (bytes.empty()) { LOG_ERROR(Crypto, "Solid NCZ: truncated"); return false; } + read_pos += bytes.size(); + in_buf.assign(bytes.begin(), bytes.end()); + in.src = in_buf.data(); + in.size = in_buf.size(); + in.pos = 0; + } + ZSTD_outBuffer outb{out_buf.data() + produced, want - produced, 0}; + const std::size_t res = ZSTD_decompressStream(stream, &outb, &in); + if (ZSTD_isError(res)) { + LOG_ERROR(Crypto, "Solid NCZ: zstd error"); + return false; + } + produced += outb.pos; + } + if (cipher) { + Key128 iv{}; + SetIv(iv, s.counter, pos); + cipher->SetIV(iv); + cipher->Transcode(out_buf.data(), produced, out_buf.data(), Op::Encrypt); + } + data.insert(data.end(), out_buf.begin(), out_buf.begin() + produced); + pos += produced; + frontier = pos; + } + } + return frontier >= needed; + } + + const std::string name; + const FileSys::VirtualFile source; + const std::vector
sections; + const u64 payload_start; + mutable std::mutex mutex; + mutable std::vector data; + mutable ZSTD_DStream* stream = nullptr; + mutable u64 read_pos = 0; + mutable u64 frontier = 0; + mutable std::vector in_buf; + mutable ZSTD_inBuffer in{nullptr, 0, 0}; +}; + +// Shared opener: block path always; solid only when allow_solid is true. +FileSys::VirtualFile OpenNcz(const FileSys::VirtualFile& f, std::string_view name, + bool allow_solid) { + if (!f) return nullptr; + u64 ps = 0; + auto parsed = ParseHeader(f, ps); + if (!parsed) return nullptr; + auto& [sections, block] = *parsed; + + if (block) { + auto hdr = f->ReadBytes(HeaderSize, 0); + if (hdr.size() != HeaderSize) return nullptr; + std::unique_ptr body; + try { body = std::make_unique(f, *block, ps); } + catch (const std::exception& e) { + LOG_ERROR(Crypto, "Failed to open NCZBLOCK: {}", e.what()); + return nullptr; + } + return std::make_shared(std::string{name}, std::move(hdr), + std::move(sections), std::move(body)); + } + + if (allow_solid) { + return std::make_shared(std::string{name}, f, std::move(sections), ps); + } + + LOG_DEBUG(Crypto, "Solid NCZ {} skipped (only NCZBLOCK is supported for play)", name); + return nullptr; +} + +} // Anonymous namespace + +bool IsBlockCompressedNCZ(const FileSys::VirtualFile& f) { + if (!f) return false; + u64 ps = 0; + const auto p = ParseHeader(f, ps); + return p && p->second.has_value(); +} + +FileSys::VirtualFile DecompressNCZ(const FileSys::VirtualFile& f, std::string_view name) { + return OpenNcz(f, name, /*allow_solid=*/false); +} + +FileSys::VirtualFile DecompressNCZForInstall(const FileSys::VirtualFile& f, + std::string_view name) { + return OpenNcz(f, name, /*allow_solid=*/true); +} + +} // namespace Core::Crypto \ No newline at end of file diff --git a/src/core/crypto/ncz_decompressor.h b/src/core/crypto/ncz_decompressor.h new file mode 100644 index 0000000000..9557f8c517 --- /dev/null +++ b/src/core/crypto/ncz_decompressor.h @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include + +#include "core/file_sys/vfs/vfs_types.h" + +namespace Core::Crypto { + +/** + * Opens an NCZBLOCK-compressed NCA (nsz -B / .xcz block format) as a VirtualFile backed by + * on-demand block decoding. Nothing is written to disk; each read decodes only the blocks it + * covers and re-encrypts CTR sections. Solid NCZ is not supported. + * + * @param ncz_file The raw NCZ payload (e.g. ".ncz" entry from an NSZ/XCZ PFS0). + * @param output_name Name to give the returned VirtualFile (e.g. ".nca"). + * + * @return a VirtualFile for the NCA, or nullptr if the NCZ is malformed or not NCZBLOCK. + */ +[[nodiscard]] FileSys::VirtualFile DecompressNCZ(const FileSys::VirtualFile& ncz_file, + std::string_view output_name); + +/** + * Returns true if the given file is an NCZ payload in block-compressed (NCZBLOCK) form, + * i.e. one that DecompressNCZ() can open. Solid NCZ returns false. + */ +[[nodiscard]] bool IsBlockCompressedNCZ(const FileSys::VirtualFile& ncz_file); + +// Install to NAND: same as DecompressNCZ, but solid NCZ is decoded on demand too. +[[nodiscard]] FileSys::VirtualFile DecompressNCZForInstall( + const FileSys::VirtualFile& ncz_file, std::string_view output_name); + +} // namespace Core::Crypto \ No newline at end of file diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp index 1f430434f7..26e73d260a 100644 --- a/src/core/file_sys/registered_cache.cpp +++ b/src/core/file_sys/registered_cache.cpp @@ -16,6 +16,7 @@ #include "common/random.h" #include "common/string_util.h" #include "core/crypto/key_manager.h" +#include "core/crypto/ncz_decompressor.h" #include "core/file_sys/card_image.h" #include "core/file_sys/common_funcs.h" #include "core/file_sys/content_archive.h" @@ -158,6 +159,25 @@ static std::shared_ptr OpenContainerAsNsp(const VirtualFile& file, Loader:: return nullptr; } +// Checks that every .ncz entry in the container is NCZBLOCK. Solid NCZ has no random access, +// and the whole point of this build is to reject it at scan time so such files never appear +// in the game list. Containers without any .ncz (plain NSP/XCI) pass through. +static bool ContainerIsFullyBlockCompressed(const std::shared_ptr& nsp) { + if (!nsp) { + return false; + } + for (const auto& entry : nsp->GetFiles()) { + const auto name = entry->GetName(); + if (name.size() < 4 || name.substr(name.size() - 4) != ".ncz") { + continue; + } + if (!Core::Crypto::IsBlockCompressedNCZ(entry)) { + return false; // solid NCZ -> reject the whole container + } + } + return true; // no .ncz at all, or all block-compressed +} + template bool ForEachContainerEntry(const std::shared_ptr& nsp, bool only_content, std::optional base_program_id, Callback&& on_entry) { @@ -811,7 +831,14 @@ std::vector RegisteredCache::ListEntriesFilter( } static std::shared_ptr GetNCAFromNSPForID(const NSP& nsp, const NcaID& id) { - auto file = nsp.GetFile(fmt::format("{}.nca", Common::HexToString(id, false))); + const auto id_string = Common::HexToString(id, false); + auto file = nsp.GetFile(fmt::format("{}.nca", id_string)); + if (file == nullptr) { + if (auto ncz_file = nsp.GetFile(fmt::format("{}.ncz", id_string))) { + file = Core::Crypto::DecompressNCZForInstall( + ncz_file, fmt::format("{}.nca", id_string)); + } + } if (file == nullptr) { return nullptr; } @@ -1273,6 +1300,12 @@ bool ManualContentProvider::AddEntriesFromContainer(VirtualFile file, bool only_ return false; } + // Reject solid NCZ (.nsz without -B): only block-compressed NCZ is supported. + if (!ContainerIsFullyBlockCompressed(nsp)) { + LOG_DEBUG(Service_FS, "Skipping solid-compressed container: {}", file->GetName()); + return false; + } + return ForEachContainerEntry( nsp, only_content, base_program_id, [this](TitleType title_type, ContentRecordType content_type, u64 title_id, @@ -1415,8 +1448,9 @@ void ExternalContentProvider::ScanDirectory(const VirtualDir& dir) { } const auto extension = Common::ToLower(filename.substr(dot_pos + 1)); - - if (extension == "nsp") { + // .xcz is an XCI container, but its updates only work through the NSP/PFS0 path + // (DecompressNCZ), not ProcessXCI. So route .xcz here on purpose. + if (extension == "nsp" || extension == "nsz" || extension == "xcz") { ProcessNSP(file); } else if (extension == "xci") { ProcessXCI(file); @@ -1434,6 +1468,12 @@ void ExternalContentProvider::ProcessNSP(const VirtualFile& file) { return; } + // Reject solid NCZ (.nsz without -B): Eden only supports block-compressed NCZ. + if (!ContainerIsFullyBlockCompressed(nsp)) { + LOG_DEBUG(Service_FS, "Skipping solid-compressed container: {}", file->GetName()); + return; + } + LOG_DEBUG(Service_FS, "Processing NSP file: {}", file->GetName()); AddExternalEntriesFromContainer(nsp, entries, versions, multi_version_entries); } diff --git a/src/core/file_sys/submission_package.cpp b/src/core/file_sys/submission_package.cpp index 0ea323492b..1a39d819f6 100644 --- a/src/core/file_sys/submission_package.cpp +++ b/src/core/file_sys/submission_package.cpp @@ -12,6 +12,7 @@ #include "common/hex_util.h" #include "common/logging.h" #include "core/crypto/key_manager.h" +#include "core/crypto/ncz_decompressor.h" #include "core/file_sys/common_funcs.h" #include "core/file_sys/content_archive.h" #include "core/file_sys/nca_metadata.h" @@ -246,6 +247,17 @@ void NSP::ReadNCAs(const std::vector& files) { const auto id_string = Common::HexToString(rec.nca_id, false); auto next_file = pfs->GetFile(fmt::format("{}.nca", id_string)); + if (next_file == nullptr) { + auto ncz_file = pfs->GetFile(fmt::format("{}.ncz", id_string)); + if (ncz_file != nullptr) { + next_file = Core::Crypto::DecompressNCZ(ncz_file, fmt::format("{}.nca", id_string)); + if (next_file == nullptr) { + LOG_DEBUG(Service_FS, "Skipping solid or unsupported NCZ content {}.ncz", id_string); + continue; + } + } + } + if (next_file == nullptr) { if (rec.type != ContentRecordType::DeltaFragment) { LOG_WARNING(Service_FS, diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp index 90e23ccc11..92e2e2f602 100644 --- a/src/core/loader/loader.cpp +++ b/src/core/loader/loader.cpp @@ -82,23 +82,27 @@ std::shared_ptr OpenContainerAsNsp(FileSys::VirtualFile file, File return nullptr; } - if (type == FileType::NSP) { + if (type == FileType::NSP || type == FileType::NSZ) { auto nsp = std::make_shared(file, program_id, program_index); return nsp->GetStatus() == ResultStatus::Success ? nsp : nullptr; } - if (type == FileType::XCI) { + if (type == FileType::XCI || type == FileType::XCZ) { FileSys::XCI xci{file, program_id, program_index}; - if (xci.GetStatus() != ResultStatus::Success) { - return nullptr; + if (xci.GetStatus() == ResultStatus::Success) { + auto secure_nsp = xci.GetSecurePartitionNSP(); + if (secure_nsp != nullptr && secure_nsp->GetStatus() == ResultStatus::Success) { + return secure_nsp; + } } - auto secure_nsp = xci.GetSecurePartitionNSP(); - if (secure_nsp == nullptr || secure_nsp->GetStatus() != ResultStatus::Success) { - return nullptr; + // PFS0-shaped .xcz (NSZ-style container) does not parse as XCI; fall back to NSP. + if (type == FileType::XCZ) { + auto nsp = std::make_shared(file, program_id, program_index); + return nsp->GetStatus() == ResultStatus::Success ? nsp : nullptr; } - return secure_nsp; + return nullptr; } return nullptr; @@ -144,7 +148,8 @@ FileType IdentifyFile(FileSys::VirtualFile file) { } bool IsContainerType(FileType type) { - return type == FileType::NSP || type == FileType::XCI; + return type == FileType::NSP || type == FileType::NSZ || type == FileType::XCI || + type == FileType::XCZ; } bool IsBootableGameContainer(FileSys::VirtualFile file, FileType type, u64 program_id, @@ -180,8 +185,12 @@ FileType GuessFromFilename(const std::string& name) { return FileType::NCA; else if (extension == "xci") return FileType::XCI; + else if (extension == "xcz") + return FileType::XCZ; else if (extension == "nsp") return FileType::NSP; + else if (extension == "nsz") + return FileType::NSZ; else if (extension == "kip") return FileType::KIP; return FileType::Unknown; @@ -197,10 +206,14 @@ std::string GetFileTypeString(FileType type) { return "NCA"; case FileType::XCI: return "XCI"; + case FileType::XCZ: + return "XCZ"; case FileType::NAX: return "NAX"; case FileType::NSP: return "NSP"; + case FileType::NSZ: + return "NSZ"; case FileType::KIP: return "KIP"; case FileType::DeconstructedRomDirectory: @@ -326,12 +339,29 @@ static std::unique_ptr GetFileLoader(Core::System& system, FileSys::V system.GetContentProvider(), program_id, program_index); + // NCZ-compressed XCI container. XCI-shaped .xcz goes to the XCI loader, while + // PFS0-shaped (NSZ-style) .xcz containers fall back to the NSP loader. + case FileType::XCZ: { + FileSys::XCI probe{file, program_id, program_index}; + if (probe.GetStatus() == ResultStatus::Success && + probe.GetSecurePartitionNSP() != nullptr) { + return std::make_unique(std::move(file), + system.GetFileSystemController(), + system.GetContentProvider(), program_id, + program_index); + } + return std::make_unique(std::move(file), system.GetFileSystemController(), + system.GetContentProvider(), program_id, + program_index); + } + // NX NAX (NintendoAesXts) file format. case FileType::NAX: return std::make_unique(std::move(file)); // NX NSP (Nintendo Submission Package) file format case FileType::NSP: + case FileType::NSZ: return std::make_unique(std::move(file), system.GetFileSystemController(), system.GetContentProvider(), program_id, program_index); diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h index 95ce638da0..d3c0230cb0 100644 --- a/src/core/loader/loader.h +++ b/src/core/loader/loader.h @@ -42,7 +42,9 @@ enum class FileType { NRO, NCA, NSP, + NSZ, XCI, + XCZ, NAX, KIP, DeconstructedRomDirectory, diff --git a/src/core/loader/nsp.cpp b/src/core/loader/nsp.cpp index cfc908b4ef..8b2c79394d 100644 --- a/src/core/loader/nsp.cpp +++ b/src/core/loader/nsp.cpp @@ -56,6 +56,17 @@ AppLoader_NSP::AppLoader_NSP(FileSys::VirtualFile file_, AppLoader_NSP::~AppLoader_NSP() = default; FileType AppLoader_NSP::IdentifyType(const FileSys::VirtualFile& nsp_file) { + // .nsz is NSP-compatible; return NSZ so the game list shows the right type. + if (nsp_file->GetName().ends_with(".nsz")) { + return FileType::NSZ; + } + + // PFS0-shaped .xcz containers are handled by this loader too; report XCZ so the game + // list does not show them as NSP. XCI-shaped .xcz is identified by AppLoader_XCI. + if (nsp_file->GetName().ends_with(".xcz")) { + return FileType::XCZ; + } + const FileSys::NSP nsp(nsp_file); if (nsp.GetStatus() != ResultStatus::Success) { diff --git a/src/frontend_common/content_manager.h b/src/frontend_common/content_manager.h index 4f3112e3fb..6d79098efa 100644 --- a/src/frontend_common/content_manager.h +++ b/src/frontend_common/content_manager.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: 2024 yuzu Emulator Project @@ -163,7 +163,9 @@ inline InstallResult InstallNSP(Core::System& system, FileSys::VfsFilesystem& vf std::shared_ptr nsp; FileSys::VirtualFile file = vfs.OpenFile(filename, FileSys::OpenMode::Read); - if (boost::to_lower_copy(file->GetName()).ends_with("nsp")) { + const auto lower_name = boost::to_lower_copy(file->GetName()); + + if (lower_name.ends_with("nsp") || lower_name.ends_with("nsz")) { nsp = std::make_shared(file); if (nsp->IsExtractedType()) { return InstallResult::Failure; diff --git a/src/qt_common/game_list/worker.cpp b/src/qt_common/game_list/worker.cpp index 586a26e8b9..6b6f93447d 100644 --- a/src/qt_common/game_list/worker.cpp +++ b/src/qt_common/game_list/worker.cpp @@ -360,7 +360,8 @@ void GameListWorker::ScanFileSystem(ScanTarget target, const std::string& dir_pa } if (target == ScanTarget::PopulateGameList && - (file_type == Loader::FileType::XCI || file_type == Loader::FileType::NSP) && + (file_type == Loader::FileType::XCI || file_type == Loader::FileType::XCZ || + file_type == Loader::FileType::NSP || file_type == Loader::FileType::NSZ) && !Loader::IsBootableGameContainer(file, file_type)) { return true; } @@ -375,7 +376,9 @@ void GameListWorker::ScanFileSystem(ScanTarget target, const std::string& dir_pa program_id, file); } else if (Settings::values.ext_content_from_game_dirs.GetValue() && (file_type == Loader::FileType::XCI || - file_type == Loader::FileType::NSP)) { + file_type == Loader::FileType::XCZ || + file_type == Loader::FileType::NSP || + file_type == Loader::FileType::NSZ)) { void(provider->AddEntriesFromContainer(file)); } } else { @@ -402,7 +405,8 @@ void GameListWorker::ScanFileSystem(ScanTarget target, const std::string& dir_pa }; if (res2 == Loader::ResultStatus::Success && program_ids.size() > 1 && - (file_type == Loader::FileType::XCI || file_type == Loader::FileType::NSP)) { + (file_type == Loader::FileType::XCI || file_type == Loader::FileType::XCZ || + file_type == Loader::FileType::NSP || file_type == Loader::FileType::NSZ)) { for (const auto id : program_ids) { // dravee suggested this, only viable way to // not show sub-games in qlaunch for now. diff --git a/src/qt_common/qt_common.cpp b/src/qt_common/qt_common.cpp index b9b8caf6e8..794aeaabb1 100644 --- a/src/qt_common/qt_common.cpp +++ b/src/qt_common/qt_common.cpp @@ -57,7 +57,8 @@ std::unique_ptr emu_thread = nullptr; const QStringList supported_file_extensions = {QStringLiteral("nro"), QStringLiteral("nso"), QStringLiteral("nca"), QStringLiteral("xci"), - QStringLiteral("nsp"), QStringLiteral("kip")}; + QStringLiteral("xcz"), QStringLiteral("nsp"), + QStringLiteral("nsz"), QStringLiteral("kip")}; Core::Frontend::WindowSystemType GetWindowSystemType() { // Determine WSI type based on Qt platform. diff --git a/src/yuzu/main_window.cpp b/src/yuzu/main_window.cpp index 6e21265f9e..ad76e5b2db 100644 --- a/src/yuzu/main_window.cpp +++ b/src/yuzu/main_window.cpp @@ -2797,9 +2797,9 @@ void MainWindow::IncrementInstallProgress() { void MainWindow::OnMenuInstallToNAND() { const QString file_filter = - tr("Installable Switch File (*.nca *.nsp *.xci);;Nintendo Content Archive " - "(*.nca);;Nintendo Submission Package (*.nsp);;NX Cartridge " - "Image (*.xci)"); + tr("Installable Switch File (*.nca *.nsp *.nsz *.xci *.xcz);;Nintendo Content Archive " + "(*.nca);;Nintendo Submission Package (*.nsp *.nsz);;NX Cartridge " + "Image (*.xci *.xcz)"); QStringList filenames = QFileDialog::getOpenFileNames( this, tr("Install Files"), QString::fromStdString(UISettings::values.roms_path), @@ -2856,7 +2856,10 @@ void MainWindow::OnMenuInstallToNAND() { QFuture future; ContentManager::InstallResult result; - if (file.endsWith(QStringLiteral("nsp"), Qt::CaseInsensitive)) { + if (file.endsWith(QStringLiteral("nsp"), Qt::CaseInsensitive) || + file.endsWith(QStringLiteral("nsz"), Qt::CaseInsensitive) || + file.endsWith(QStringLiteral("xci"), Qt::CaseInsensitive) || + file.endsWith(QStringLiteral("xcz"), Qt::CaseInsensitive)) { const auto progress_callback = [this](size_t size, size_t progress) { emit UpdateInstallProgress(); if (install_progress->wasCanceled()) { From a95efaf18f50721aa6f5cdce8b5b94e858ffd8d1 Mon Sep 17 00:00:00 2001 From: wildcard Date: Mon, 26 Oct 2026 17:23:45 +0100 Subject: [PATCH 24/32] [vulkan] Fix TOTK dark squares (#4565) Qualcomm and Turnip use different subpixel rounding for Vulkan texture gather coordinates than the Switch's Maxwell GPU. This can select the wrong texels near texture boundaries, producing large black squares in TOTK - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md). - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4565 Reviewed-by: CamilleLaVey Reviewed-by: Shinmegumi --- src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index a85e2811a3..e9403580d5 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp @@ -447,7 +447,9 @@ PipelineCache::PipelineCache(Tegra::MaxwellDeviceMemoryManager& device_memory_, driver_id == VK_DRIVER_ID_AMD_OPEN_SOURCE || driver_id == VK_DRIVER_ID_MESA_RADV || driver_id == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS || - driver_id == VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA, + driver_id == VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA || + driver_id == VK_DRIVER_ID_QUALCOMM_PROPRIETARY || + driver_id == VK_DRIVER_ID_MESA_TURNIP, .has_broken_spirv_clamp = driver_id == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS, .has_broken_spirv_position_input = driver_id == VK_DRIVER_ID_QUALCOMM_PROPRIETARY, From 0689f73147ebeddb9ac5fb8b0edf2625425f8d71 Mon Sep 17 00:00:00 2001 From: xbzk Date: Mon, 26 Oct 2026 17:24:00 +0100 Subject: [PATCH 25/32] [ir] resolve conditional Phi inputs when tracking bindless texture handles (#4551) - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md). - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Aimed to fix Ender Magnolia missing shader textures. Main example is Yolvan character bullets. By using windows version of the game, dxvk lib to make it vulkan, and renderdoc, it was possible to capture bullets, and by tracking backward composition and comparing with a similar scene from eden with missing bullets, it was possible to unveil the missing functionality: conditional Phi inputs resolve for bindless handles. By ignoring the boolean predicate register in the shader, handles for these shaders were resolving to some old value instead of proper live conditional ones. TESTS: -Compare Yolvan bullets -Usual roam on main titles for regression check. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4551 Reviewed-by: CamilleLaVey Reviewed-by: Shinmegumi --- .../frontend/ir/breadth_first_search.h | 11 ++- src/shader_recompiler/ir_opt/texture_pass.cpp | 87 +++++++++++++++---- 2 files changed, 79 insertions(+), 19 deletions(-) diff --git a/src/shader_recompiler/frontend/ir/breadth_first_search.h b/src/shader_recompiler/frontend/ir/breadth_first_search.h index ec55425549..afe153f180 100644 --- a/src/shader_recompiler/frontend/ir/breadth_first_search.h +++ b/src/shader_recompiler/frontend/ir/breadth_first_search.h @@ -1,8 +1,12 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #pragma once +#include #include #include #include @@ -13,9 +17,10 @@ namespace Shader::IR { -template -auto BreadthFirstSearch(const Value& value, Pred&& pred) +template +auto BreadthFirstSearch(Value value, Pred&& pred, Resolve&& resolve = {}) -> std::invoke_result_t { + value = resolve(value); if (value.IsImmediate()) { // Nothing to do with immediates return std::nullopt; @@ -36,7 +41,7 @@ auto BreadthFirstSearch(const Value& value, Pred&& pred) } // Visit the right most arguments first for (size_t arg = inst->NumArgs(); arg--;) { - const Value arg_value{inst->Arg(arg)}; + const Value arg_value{resolve(inst->Arg(arg))}; if (arg_value.IsImmediate()) { continue; } diff --git a/src/shader_recompiler/ir_opt/texture_pass.cpp b/src/shader_recompiler/ir_opt/texture_pass.cpp index fe34a67555..fae69ab91b 100644 --- a/src/shader_recompiler/ir_opt/texture_pass.cpp +++ b/src/shader_recompiler/ir_opt/texture_pass.cpp @@ -31,6 +31,60 @@ struct TextureInst { using TextureInstVector = boost::container::small_vector; +const IR::Block* ConditionalHeader(const IR::Block* body) { + const auto predecessors{body->ImmPredecessors()}; + const auto successors{body->ImmSuccessors()}; + if (predecessors.size() != 1 || successors.size() != 1) return nullptr; + const IR::Block* const header{predecessors[0]}; + const auto targets{header->ImmSuccessors()}; + if (targets.size() != 2 || targets[0] != body || targets[1] != successors[0] || + targets[1]->ImmPredecessors().size() != 2 || header->empty() || + header->back().GetOpcode() != IR::Opcode::ConditionRef) { + return nullptr; + } + return header; +} + +std::pair Condition(IR::Value value) { + bool negated{}; + while (const IR::Inst* inst = value.TryInstRecursive()) { + if (inst->GetOpcode() == IR::Opcode::LogicalNot) negated = !negated; + else if (inst->GetOpcode() != IR::Opcode::ConditionRef) break; + value = inst->Arg(0); + } + return {value.Resolve(), negated}; +} + +IR::Value ResolveConditionalPhi(IR::Value value, const IR::Block* block) { + if (!value.Resolve().IsPhi() || !(block = ConditionalHeader(block))) return value; + const auto [condition, negated]{Condition(block->back().Arg(0))}; + boost::container::small_vector visited; + while (value.Resolve().IsPhi() && std::ranges::find(visited, block) == visited.end()) { + visited.push_back(block); + const IR::Inst* const phi{value.InstRecursive()}; + const auto predecessors{block->ImmPredecessors()}; + if (predecessors.size() == 1) { + block = predecessors[0]; + continue; + } + if (predecessors.size() != 2 || phi->NumArgs() != 2) break; + const IR::Block* body{predecessors[0]}; + const IR::Block* header{ConditionalHeader(body)}; + if (header != predecessors[1]) { + body = predecessors[1]; + header = ConditionalHeader(body); + if (header != predecessors[0]) break; + } + const auto [other_condition, other_negated]{Condition(header->back().Arg(0))}; + if (condition == other_condition && (phi->PhiBlock(0) == header || phi->PhiBlock(0) == body)) { + const IR::Block* const incoming{negated == other_negated ? body : header}; + value = phi->Arg(phi->PhiBlock(0) == incoming ? 0 : 1); + } + block = header; + } + return value; +} + constexpr u32 DESCRIPTOR_SIZE = 8; constexpr u32 DESCRIPTOR_SIZE_SHIFT = u32(std::countr_zero(DESCRIPTOR_SIZE)); constexpr u32 DESCRIPTOR_MAX_COUNT = 1024; @@ -299,23 +353,23 @@ static inline bool IsTexturePixelFormatIntegerCached(Environment& env, } -std::optional Track(const IR::Value& value, Environment& env, const HostTranslateInfo& host_info); -static inline std::optional TrackCached(const IR::Value& v, Environment& env, const HostTranslateInfo& host_info) { - if (const IR::Inst* key = v.InstRecursive()) { +std::optional Track(const IR::Value& value, Environment& env, const HostTranslateInfo& host_info, const IR::Block* block); +static inline std::optional TrackCached(const IR::Value& v, Environment& env, const HostTranslateInfo& host_info, const IR::Block* block) { + if (const IR::Inst* key = v.TryInstRecursive()) { if (auto it = env.track_cache.find(key); it != env.track_cache.end()) return it->second; - auto found = Track(v, env, host_info); + auto found = Track(v, env, host_info, block); if (found) env.track_cache.emplace(key, *found); return found; } - return Track(v, env, host_info); + return Track(v, env, host_info, block); } -std::optional TryGetConstBuffer(const IR::Inst* inst, Environment& env, const HostTranslateInfo& host_info); +std::optional TryGetConstBuffer(const IR::Inst* inst, Environment& env, const HostTranslateInfo& host_info, const IR::Block* block); -std::optional Track(const IR::Value& value, Environment& env, const HostTranslateInfo& host_info) { - return IR::BreadthFirstSearch(value, [&env, &host_info](const IR::Inst* inst) { - return TryGetConstBuffer(inst, env, host_info); - }); +std::optional Track(const IR::Value& value, Environment& env, const HostTranslateInfo& host_info, const IR::Block* block) { + return IR::BreadthFirstSearch(value, [&env, &host_info, block](const IR::Inst* inst) { + return TryGetConstBuffer(inst, env, host_info, block); + }, [&](IR::Value operand) { return ResolveConditionalPhi(operand, block); }); } std::optional TryGetConstant(IR::Value& value, Environment& env) { @@ -339,13 +393,13 @@ std::optional TryGetConstant(IR::Value& value, Environment& env) { return ReadCbufCached(env, index_number, offset_number); } -std::optional TryGetConstBuffer(const IR::Inst* inst, Environment& env, const HostTranslateInfo& host_info) { +std::optional TryGetConstBuffer(const IR::Inst* inst, Environment& env, const HostTranslateInfo& host_info, const IR::Block* block) { switch (inst->GetOpcode()) { default: return std::nullopt; case IR::Opcode::BitwiseOr32: { - std::optional lhs{TrackCached(inst->Arg(0), env, host_info)}; - std::optional rhs{TrackCached(inst->Arg(1), env, host_info)}; + std::optional lhs{TrackCached(inst->Arg(0), env, host_info, block)}; + std::optional rhs{TrackCached(inst->Arg(1), env, host_info, block)}; if (!lhs || !rhs) { return std::nullopt; } @@ -375,7 +429,7 @@ std::optional TryGetConstBuffer(const IR::Inst* inst, Environme if (!shift.IsImmediate()) { return std::nullopt; } - std::optional lhs{TrackCached(inst->Arg(0), env, host_info)}; + std::optional lhs{TrackCached(inst->Arg(0), env, host_info, block)}; if (lhs) { lhs->shift_left = shift.U32(); } @@ -403,7 +457,7 @@ std::optional TryGetConstBuffer(const IR::Inst* inst, Environme return std::nullopt; } while (false); } - std::optional lhs{TrackCached(op1, env, host_info)}; + std::optional lhs{TrackCached(op1, env, host_info, block)}; if (lhs) { lhs->shift_left = static_cast(std::countr_zero(op2.U32())); } @@ -469,7 +523,7 @@ std::optional TryGetConstBuffer(const IR::Inst* inst, Environme TextureInst MakeInst(Environment& env, IR::Block* block, IR::Inst& inst, const HostTranslateInfo& host_info) { ConstBufferAddr addr; if (IsBindless(inst)) { - const std::optional track_addr{TrackCached(inst.Arg(0), env, host_info)}; + const std::optional track_addr{TrackCached(inst.Arg(0), env, host_info, block)}; if (!track_addr) { throw NotImplementedException("Failed to track bindless texture constant buffer"); @@ -671,6 +725,7 @@ void TexturePass(Environment& env, IR::Program& program, const HostTranslateInfo env.track_cache.clear(); TextureInstVector to_replace; for (IR::Block* const block : program.post_order_blocks) { + env.track_cache.clear(); for (IR::Inst& inst : block->Instructions()) { if (!IsTextureInstruction(inst)) { continue; From 0e11fe8b5e3d3b563946726ed06cb44b2bf5ccb3 Mon Sep 17 00:00:00 2001 From: xbzk Date: Mon, 26 Oct 2026 17:24:28 +0100 Subject: [PATCH 26/32] [video_core, settings] readback for nce invalidations (#4490) optimization and nuke toggles (#4502) (#4531) - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md). - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Follow up for #4490: Originally i was racing locks between dirty and clean invalidations, but +94% were clean so it was causing useless locks. Solutioin was to share locks between both. P.S.: THIS IS INTENDED TO FIX RANDOM CRASHES IN UE, OBJECTIVELY REPRODUCIBLE IN ENDER MAGNOLIA IN ANDROID. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4531 Reviewed-by: CamilleLaVey Reviewed-by: Shinmegumi --- .../features/settings/model/BooleanSetting.kt | 1 - .../features/settings/model/view/SettingsItem.kt | 7 ------- .../settings/ui/SettingsFragmentPresenter.kt | 1 - src/android/app/src/main/res/values-ar/strings.xml | 2 -- .../app/src/main/res/values-zh-rTW/strings.xml | 2 -- src/android/app/src/main/res/values/strings.xml | 2 -- src/common/settings.h | 2 -- src/qt_common/config/shared_translation.cpp | 4 ---- src/video_core/gpu.cpp | 6 +++--- src/video_core/rasterizer_interface.h | 9 +++++++++ src/video_core/renderer_vulkan/vk_rasterizer.cpp | 12 ++++++++++++ src/video_core/renderer_vulkan/vk_rasterizer.h | 1 + 12 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt index 0548004cf5..6c33fc7812 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt @@ -16,7 +16,6 @@ enum class BooleanSetting(override val key: String) : AbstractBooleanSetting { RENDERER_USE_SPEED_LIMIT("use_speed_limit"), USE_CUSTOM_CPU_TICKS("use_custom_cpu_ticks"), SKIP_CPU_INNER_INVALIDATION("skip_cpu_inner_invalidation"), - NCE_INVALIDATION_GPU_READBACK("nce_invalidation_gpu_readback"), FIX_BLOOM_EFFECTS("fix_bloom_effects"), EMULATE_BGR565("emulate_bgr565"), RESCALE_HACK("rescale_hack"), diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt index 690c746628..f968a0ae18 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt @@ -859,13 +859,6 @@ abstract class SettingsItem( descriptionId = R.string.skip_cpu_inner_invalidation_description ) ) - put( - SwitchSetting( - BooleanSetting.NCE_INVALIDATION_GPU_READBACK, - titleId = R.string.nce_invalidation_gpu_readback, - descriptionId = R.string.nce_invalidation_gpu_readback_description - ) - ) put( SwitchSetting( BooleanSetting.FIX_BLOOM_EFFECTS, diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt index f9185e39e6..824a54181e 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt @@ -554,7 +554,6 @@ class SettingsFragmentPresenter( add(HeaderSetting(R.string.hacks)) add(BooleanSetting.SKIP_CPU_INNER_INVALIDATION.key) - add(BooleanSetting.NCE_INVALIDATION_GPU_READBACK.key) add(BooleanSetting.FIX_BLOOM_EFFECTS.key) add(BooleanSetting.EMULATE_BGR565.key) add(BooleanSetting.RENDERER_ASYNCHRONOUS_SHADERS.key) diff --git a/src/android/app/src/main/res/values-ar/strings.xml b/src/android/app/src/main/res/values-ar/strings.xml index 2fdff9847b..3be04d9186 100644 --- a/src/android/app/src/main/res/values-ar/strings.xml +++ b/src/android/app/src/main/res/values-ar/strings.xml @@ -587,8 +587,6 @@ يجعل اللعبة تعتقد أن عمل وحدة معالجة الرسومات ينتهي بشكل أسرع مما هو عليه في الواقع، لذلك تتوقف عن خفض الدقة ومسافة العرض لتتناسب مع سرعات جهاز Switch. تخطي إبطال صلاحية وحدة المعالجة المركزية الداخلية يتخطى بعض عمليات إبطال ذاكرة التخزين المؤقتة من جانب وحدة المعالجة المركزية أثناء تحديثات الذاكرة، مما يقلل من استخدام وحدة المعالجة المركزية ويحسن أداءها. قد يتسبب ذلك في حدوث أعطال أو تعطل في بعض الألعاب. - إعادة قراءة وحدة معالجة الرسومات قبل إبطال صلاحية NCE - إصلاح مؤقت. يعالج مشكلة تعطل لعبة Ender Magnolia (وغيرها من ألعاب UE). قد يؤدي إلى انخفاض في الأداء. يجري العمل على تحسينه. إصلاح تأثيرات التوهج يقلل من ضبابية التوهج في LA/EOW (Adreno A6XX - A7XX/ Turnip)، ويزيل التوهج في Burnout. تحذير: قد يسبب تشوهات رسومية في ألعاب أخرى. محاكاة BGR565 diff --git a/src/android/app/src/main/res/values-zh-rTW/strings.xml b/src/android/app/src/main/res/values-zh-rTW/strings.xml index 3f0c6d9215..1391f1bc6e 100644 --- a/src/android/app/src/main/res/values-zh-rTW/strings.xml +++ b/src/android/app/src/main/res/values-zh-rTW/strings.xml @@ -577,8 +577,6 @@ 讓遊戲誤以為 GPU 工作能更快完成,避免遊戲為了配合 Switch 的時脈而降低解析度與渲染距離 跳過 CPU 內部失效處理 在記憶體更新期間跳過某些 CPU 端快取的失效處理,減少 CPU 使用率並提高其性能。可能會導致某些遊戲出現故障或當機 - 在 NCE 無效化前進行 GPU 回讀 - (暫時性功能)修復 \"終結者瑪格諾莉亞:霧中綻放\" 及其它使用虛幻引擎之遊戲中的當機問題,可能會降低效能。此功能正在改善中 修正光暈特效 在 \"薩爾達傳說:織夢島\" 和 \"薩爾達傳說:智慧的再現\" 中減少光暈模糊的問題並移除 \"橫衝直撞:狂飆樂園重製版\" 中的光暈效果(適用於 Adreno A6XX - A7XX/ Turnip)。警告:可能會在其它遊戲中導致圖形異常 模擬 BGR565 diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml index 191506c818..33e1eaa340 100644 --- a/src/android/app/src/main/res/values/strings.xml +++ b/src/android/app/src/main/res/values/strings.xml @@ -593,8 +593,6 @@ Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch\'s clocks. Skip CPU Inner Invalidation Skips certain CPU-side cache invalidations during memory updates, reducing CPU usage and improving it\'s performance. This may cause glitches or crashes on some games. - GPU Readback Before NCE Invalidation - Temporary. Fix Ender Magnolia (and other UE titles) crashes. May reduce performance. Improvement in progress. Fix Bloom Effects Reduces bloom blur in LA/EOW (Adreno A6XX - A7XX/ Turnip), removes bloom in Burnout. Warning: may cause graphical artifacts in other games. Emulate BGR565 diff --git a/src/common/settings.h b/src/common/settings.h index d1f891607b..b57bec5c12 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -639,8 +639,6 @@ struct Values { Specialization::Default, true, true}; - SwitchableSetting nce_invalidation_gpu_readback{ - linkage, false, "nce_invalidation_gpu_readback", Category::RendererHacks}; SwitchableSetting async_presentation{linkage, #ifdef __ANDROID__ true, diff --git a/src/qt_common/config/shared_translation.cpp b/src/qt_common/config/shared_translation.cpp index 09e64b98f0..bb92d896f8 100644 --- a/src/qt_common/config/shared_translation.cpp +++ b/src/qt_common/config/shared_translation.cpp @@ -194,10 +194,6 @@ std::unique_ptr InitializeTranslations(QObject* parent) { INSERT(Settings, skip_cpu_inner_invalidation, tr("Skip CPU Inner Invalidation"), tr("Skips certain cache invalidations during memory updates, reducing CPU usage and " "improving latency. This may cause soft-crashes.")); - INSERT(Settings, nce_invalidation_gpu_readback, - tr("GPU Readback Before NCE Invalidation"), - tr("Flushes GPU buffer data back to guest memory before NCE invalidates the whole " - "guest page, preserving it while the CPU store proceeds.")); INSERT(Settings, vsync_mode, tr("VSync Mode:"), tr("FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen " "refresh rate.\nFIFO Relaxed allows tearing as it recovers from a slow down.\n" diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 4e36d086e6..1621b24125 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp @@ -227,17 +227,17 @@ struct GPU::Impl { /// Notify rasterizer that any caches of the specified region should be invalidated void InvalidateRegion(DAddr addr, u64 size, bool preserve_gpu_writes) { - if (Settings::values.nce_invalidation_gpu_readback.GetValue()) { + if (preserve_gpu_writes) { VideoCore::RasterizerInterface* rasterizer = renderer->ReadRasterizer(); - if (preserve_gpu_writes && rasterizer->MustFlushRegion(addr, size, VideoCommon::CacheType::BufferCache)) { + if (!rasterizer->TryCacheInvalidation(addr, size)) { const u64 fence = RequestSyncOperation([rasterizer, addr, size] { rasterizer->FlushRegion(addr, size, VideoCommon::CacheType::BufferCache); rasterizer->OnCacheInvalidation(addr, size); }); gpu_thread.TickGPU(is_async); WaitForSyncOperation(fence); - return; } + return; } gpu_thread.InvalidateRegion(addr, size); } diff --git a/src/video_core/rasterizer_interface.h b/src/video_core/rasterizer_interface.h index 481efbf53b..b527c0e2a9 100644 --- a/src/video_core/rasterizer_interface.h +++ b/src/video_core/rasterizer_interface.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -111,6 +114,12 @@ public: /// Notify rasterizer that any caches of the specified region are desync with guest virtual void OnCacheInvalidation(PAddr addr, u64 size) = 0; + virtual bool TryCacheInvalidation(DAddr addr, u64 size) { + if (MustFlushRegion(addr, size, VideoCommon::CacheType::BufferCache)) return false; + OnCacheInvalidation(addr, size); + return true; + } + virtual bool OnCPUWrite(PAddr addr, u64 size) = 0; /// Sync memory between guest and host. diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index f43bea1220..264ffb28b5 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -798,6 +798,18 @@ void RasterizerVulkan::OnCacheInvalidation(DAddr addr, u64 size) { pipeline_cache.InvalidateRegion(addr, size); } +bool RasterizerVulkan::TryCacheInvalidation(DAddr addr, u64 size) { + if (addr == 0 || size == 0) return true; + { + std::scoped_lock lock{buffer_cache.mutex, texture_cache.mutex}; + if (buffer_cache.IsRegionGpuModified(addr, size)) return false; + texture_cache.WriteMemory(addr, size); + buffer_cache.WriteMemory(addr, size); + } + pipeline_cache.InvalidateRegion(addr, size); + return true; +} + void RasterizerVulkan::InvalidateGPUCache() { gpu.InvalidateGPUCache(); } diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.h b/src/video_core/renderer_vulkan/vk_rasterizer.h index 7470aa4f14..ae9929ca0b 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.h +++ b/src/video_core/renderer_vulkan/vk_rasterizer.h @@ -106,6 +106,7 @@ public: VideoCommon::CacheType which = VideoCommon::CacheType::All) override; void InnerInvalidation(std::span> sequences) override; void OnCacheInvalidation(DAddr addr, u64 size) override; + bool TryCacheInvalidation(DAddr addr, u64 size) override; bool OnCPUWrite(DAddr addr, u64 size) override; void InvalidateGPUCache() override; void UnmapMemory(DAddr addr, u64 size) override; From 5239cbe2a78d6533e3541a71c4d3c723818dcb6e Mon Sep 17 00:00:00 2001 From: xbzk Date: Mon, 26 Oct 2026 17:24:45 +0100 Subject: [PATCH 27/32] [nce] handles duplicate NCE interrupts (#4530) - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md). - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Another crash observed in Ender Magnolia: A deadlock caused between CPUCore_0/GPU/GPUFencingThread. CPUCore_0 waits for GPU work inside the NCE fault handler GPU waits for the syncpoint mutex GPUFencingThread holds that mutex while waiting for CPUCore_0 NCE interrupt lock The fix makes duplicate interrupts return before acquiring the lock, while the first request keeps its original behavior. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4530 Reviewed-by: CamilleLaVey Reviewed-by: Shinmegumi --- src/core/arm/nce/arm_nce.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/arm/nce/arm_nce.cpp b/src/core/arm/nce/arm_nce.cpp index 63d5638fce..438dd4d981 100644 --- a/src/core/arm/nce/arm_nce.cpp +++ b/src/core/arm/nce/arm_nce.cpp @@ -369,8 +369,8 @@ void ArmNce::SetContext(const Kernel::Svc::ThreadContext& ctx) { } void ArmNce::SignalInterrupt(Kernel::KThread* thread) { - // Add break loop condition. - m_guest_ctx.esr_el1.fetch_or(static_cast(HaltReason::BreakLoop)); + constexpr u64 break_loop = static_cast(HaltReason::BreakLoop); + if ((m_guest_ctx.esr_el1.fetch_or(break_loop) & break_loop) != 0) return; auto* params = &thread->GetNativeExecutionParameters(); LockThreadParameters(params); From a3debcf731143aabd6eefee406d511551d3c9a73 Mon Sep 17 00:00:00 2001 From: PavelBARABANOV Date: Mon, 26 Oct 2026 17:25:24 +0100 Subject: [PATCH 28/32] [buffer_cashe] use old logic when Optimized Vertex Buffers is disabled (#4528) - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Fixes vertex explosions on Turnip. Fixes Celeste on QCOM. Fixes new issues discovered after #3579 Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4528 Reviewed-by: CamilleLaVey Reviewed-by: Shinmegumi --- src/video_core/buffer_cache/buffer_cache.h | 82 +++++++++++++++------- 1 file changed, 55 insertions(+), 27 deletions(-) diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index 53addb5dec..f30c85911f 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h @@ -1738,36 +1738,64 @@ void BufferCache

::TouchBuffer(Buffer& buffer, BufferId buffer_id) noexcept { template bool BufferCache

::SynchronizeBuffer(Buffer& buffer, DAddr device_addr, u32 size) { - upload_copies.clear(); - u64 total_size_bytes = 0; - u64 largest_copy = 0; - const DAddr buffer_start = buffer.cpu_addr_cached; - const auto add_upload = [&](DAddr start, DAddr end) { - if (start == end) return; - const u64 range_size = end - start; - upload_copies.push_back(BufferCopy{ - .src_offset = total_size_bytes, - .dst_offset = start - buffer_start, - .size = range_size, +#ifdef __ANDROID__ + const bool use_optimized_vertex_buffers = Settings::values.use_optimized_vertex_buffers.GetValue(); +#else + constexpr bool use_optimized_vertex_buffers = true; +#endif + + if (use_optimized_vertex_buffers) { + upload_copies.clear(); + u64 total_size_bytes = 0; + u64 largest_copy = 0; + const DAddr buffer_start = buffer.cpu_addr_cached; + const auto add_upload = [&](DAddr start, DAddr end) { + if (start == end) return; + const u64 range_size = end - start; + upload_copies.push_back(BufferCopy{ + .src_offset = total_size_bytes, + .dst_offset = start - buffer_start, + .size = range_size, + }); + total_size_bytes += range_size; + largest_copy = (std::max)(largest_copy, range_size); + }; + memory_tracker.ForEachUploadRange(device_addr, size, [&](u64 device_addr_out, u64 range_size) { + DAddr upload_start = device_addr_out; + gpu_modified_ranges.ForEachInRange(device_addr_out, range_size, [&](DAddr gpu_start, DAddr gpu_end) { + add_upload(upload_start, gpu_start); + upload_start = gpu_end; + }); + add_upload(upload_start, device_addr_out + range_size); }); - total_size_bytes += range_size; - largest_copy = (std::max)(largest_copy, range_size); - }; - memory_tracker.ForEachUploadRange(device_addr, size, [&](u64 device_addr_out, u64 range_size) { - DAddr upload_start = device_addr_out; - gpu_modified_ranges.ForEachInRange(device_addr_out, range_size, [&](DAddr gpu_start, DAddr gpu_end) { - add_upload(upload_start, gpu_start); - upload_start = gpu_end; + if (total_size_bytes == 0) { + return true; + } + const std::span copies_span(upload_copies.data(), upload_copies.size()); + UploadMemory(buffer, total_size_bytes, largest_copy, copies_span); + any_buffer_uploaded = true; + return false; + } else { + boost::container::small_vector copies; + u64 total_size_bytes = 0; + u64 largest_copy = 0; + DAddr buffer_start = buffer.CpuAddr(); + memory_tracker.ForEachUploadRange(device_addr, size, [&](u64 device_addr_out, u64 range_size) { + copies.push_back(BufferCopy{ + .src_offset = total_size_bytes, + .dst_offset = device_addr_out - buffer_start, + .size = range_size, + }); + total_size_bytes += range_size; + largest_copy = (std::max)(largest_copy, range_size); }); - add_upload(upload_start, device_addr_out + range_size); - }); - if (total_size_bytes == 0) { - return true; + if (total_size_bytes == 0) { + return true; + } + const std::span copies_span(copies.data(), copies.size()); + UploadMemory(buffer, total_size_bytes, largest_copy, copies_span); + return false; } - const std::span copies_span(upload_copies.data(), upload_copies.size()); - UploadMemory(buffer, total_size_bytes, largest_copy, copies_span); - any_buffer_uploaded = true; - return false; } template From cbd4cf2d8ce9b66936bff8a19be4715e770e0c71 Mon Sep 17 00:00:00 2001 From: John Date: Mon, 26 Oct 2026 17:25:47 +0100 Subject: [PATCH 29/32] [hle][core] Hang Freeze Fix - Video Fixes - Revert Microsleep (#4316) (#4525) - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Credit: amicuchu Co-Authored-By: Claude Opus 5.5 - Fixes Mario Strikers Intro Freezing from legacy. - Microsleep no longer needed for Absolum Video freezing and other videos freezing. - Revert `[service, nvhost] added machinery to allow microsleep between nvdec read requests to avoid guest panic in some games #4316` - Tested with CPU/GPU decoding on Linux/Windows. Special thanks to xbzk Co-authored-by: Your Name Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4525 Reviewed-by: Maufeat Reviewed-by: Shinmegumi --- src/core/core.cpp | 40 +++---------------- src/core/core.h | 4 +- .../service/filesystem/fsp/fs_i_storage.cpp | 12 ++++++ .../hle/service/filesystem/fsp/fs_i_storage.h | 6 +++ .../service/nvdrv/devices/nvhost_nvdec.cpp | 11 +---- src/core/hle/service/service.cpp | 16 +------- src/core/hle/service/service.h | 2 - 7 files changed, 28 insertions(+), 63 deletions(-) diff --git a/src/core/core.cpp b/src/core/core.cpp index 046ee53346..06543b0833 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -4,7 +4,6 @@ #include #include #include -#include #include #include "game_settings.h" @@ -249,30 +248,12 @@ struct System::Impl { } } - void NotifyNVDECChannelOpen(u64 process_id) { - std::scoped_lock lock{nvdec_active_mutex}; - ++nvdec_active_channels[process_id]; - } - - void NotifyNVDECChannelClose(u64 process_id) { - std::scoped_lock lock{nvdec_active_mutex}; - const auto it = nvdec_active_channels.find(process_id); - if (it == nvdec_active_channels.end()) { - return; - } - if (--it->second == 0) { - nvdec_active_channels.erase(it); - } + void SetNVDECActive(bool is_nvdec_active) { + nvdec_active = is_nvdec_active; } bool GetNVDECActive() { - std::scoped_lock lock{nvdec_active_mutex}; - return !nvdec_active_channels.empty(); - } - - bool IsNVDECActiveForProcess(u64 process_id) { - std::scoped_lock lock{nvdec_active_mutex}; - return nvdec_active_channels.contains(process_id); + return nvdec_active; } void InitializeDebugger(System& system, u16 port) { @@ -528,8 +509,6 @@ struct System::Impl { mutable std::mutex suspend_guard; std::mutex general_channel_mutex; - std::mutex nvdec_active_mutex; - std::unordered_map nvdec_active_channels; std::atomic_bool is_paused{}; std::atomic_bool is_shutting_down{}; std::atomic_bool is_powered_on{}; @@ -537,6 +516,7 @@ struct System::Impl { bool extended_memory_layout : 1 = false; bool exit_locked : 1 = false; bool exit_requested : 1 = false; + bool nvdec_active : 1 = false; void EnsureGeneralChannelInitialized(System& system) { if (!general_channel_event) { @@ -600,22 +580,14 @@ void System::UnstallApplication() { impl->UnstallApplication(); } -void System::NotifyNVDECChannelOpen(u64 process_id) { - impl->NotifyNVDECChannelOpen(process_id); -} - -void System::NotifyNVDECChannelClose(u64 process_id) { - impl->NotifyNVDECChannelClose(process_id); +void System::SetNVDECActive(bool is_nvdec_active) { + impl->SetNVDECActive(is_nvdec_active); } bool System::GetNVDECActive() { return impl->GetNVDECActive(); } -bool System::IsNVDECActiveForProcess(u64 process_id) { - return impl->IsNVDECActiveForProcess(process_id); -} - void System::InitializeDebugger() { impl->InitializeDebugger(*this, Settings::values.gdbstub_port.GetValue()); } diff --git a/src/core/core.h b/src/core/core.h index e26093f260..d88ed64151 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -191,10 +191,8 @@ public: std::unique_lock StallApplication(); void UnstallApplication(); - void NotifyNVDECChannelOpen(u64 process_id); - void NotifyNVDECChannelClose(u64 process_id); + void SetNVDECActive(bool is_nvdec_active); [[nodiscard]] bool GetNVDECActive(); - [[nodiscard]] bool IsNVDECActiveForProcess(u64 process_id); /** * Initialize the debugger. diff --git a/src/core/hle/service/filesystem/fsp/fs_i_storage.cpp b/src/core/hle/service/filesystem/fsp/fs_i_storage.cpp index 50b7d1e765..8541c17817 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_storage.cpp +++ b/src/core/hle/service/filesystem/fsp/fs_i_storage.cpp @@ -4,6 +4,10 @@ // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include +#include +#include + #include "core/file_sys/errors.h" #include "core/hle/service/cmif_serialization.h" #include "core/hle/service/filesystem/fsp/fs_i_storage.h" @@ -31,6 +35,14 @@ Result IStorage::Read( R_UNLESS(length >= 0, FileSys::ResultInvalidSize); R_UNLESS(offset >= 0, FileSys::ResultInvalidOffset); + const auto now = std::chrono::steady_clock::now(); + if (now < next_read_tick) { + std::this_thread::sleep_for(next_read_tick - now); + } + next_read_tick = std::chrono::steady_clock::now() + + std::chrono::nanoseconds{std::min(length, MaxChargedReadSize) * + 1'000'000'000 / ReadBytesPerSecond}; + // Read the data from the Storage backend backend->Read(out_bytes.data(), length, offset); diff --git a/src/core/hle/service/filesystem/fsp/fs_i_storage.h b/src/core/hle/service/filesystem/fsp/fs_i_storage.h index e676c52220..bac72d73c7 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_storage.h +++ b/src/core/hle/service/filesystem/fsp/fs_i_storage.h @@ -6,6 +6,8 @@ #pragma once +#include + #include "core/file_sys/vfs/vfs.h" #include "core/hle/service/cmif_types.h" #include "core/hle/service/filesystem/filesystem.h" @@ -20,6 +22,10 @@ public: private: FileSys::VirtualFile backend; + static constexpr s64 ReadBytesPerSecond = 40'000'000; + static constexpr s64 MaxChargedReadSize = 64 * 1024; + std::chrono::steady_clock::time_point next_read_tick{}; + Result Read( OutBuffer out_bytes, s64 offset, s64 length); diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp index f47369adb8..7ac3dfaa46 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp @@ -8,7 +8,6 @@ #include "common/assert.h" #include "common/logging.h" #include "core/core.h" -#include "core/hle/kernel/k_process.h" #include "core/hle/service/nvdrv/core/container.h" #include "core/hle/service/nvdrv/devices/ioctl_serialization.h" #include "core/hle/service/nvdrv/devices/nvhost_nvdec.h" @@ -72,23 +71,17 @@ NvResult nvhost_nvdec::Ioctl3(DeviceFD fd, Ioctl command, std::span in void nvhost_nvdec::OnOpen(NvCore::SessionId session_id, DeviceFD fd) { LOG_INFO(Service_NVDRV, "NVDEC video stream started"); + system.SetNVDECActive(true); sessions[fd] = session_id; - if (const auto* session = core.GetSession(session_id); - session != nullptr && session->process != nullptr) { - system.NotifyNVDECChannelOpen(session->process->GetId()); - } host1x.StartDevice(fd, Tegra::Host1x::ChannelType::NvDec, channel_syncpoint); } void nvhost_nvdec::OnClose(DeviceFD fd) { LOG_INFO(Service_NVDRV, "NVDEC video stream ended"); host1x.StopDevice(fd, Tegra::Host1x::ChannelType::NvDec); + system.SetNVDECActive(false); auto it = sessions.find(fd); if (it != sessions.end()) { - if (const auto* session = core.GetSession(it->second); - session != nullptr && session->process != nullptr) { - system.NotifyNVDECChannelClose(session->process->GetId()); - } sessions.erase(it); } } diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 225b92a783..b4fe2b3ed5 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -4,16 +4,12 @@ // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include #include -#include -#include #include "common/assert.h" #include "common/logging.h" #include "common/settings.h" #include "core/core.h" #include "core/hle/ipc.h" -#include "core/hle/kernel/k_process.h" #include "core/hle/kernel/kernel.h" #include "core/hle/service/ipc_helpers.h" #include "core/hle/service/service.h" @@ -37,7 +33,6 @@ ServiceFrameworkBase::ServiceFrameworkBase(Core::System& system_, const char* se : SessionRequestHandler(system_.Kernel(), service_name_) , system{system_} , service_name{service_name_} - , is_i_storage{std::string_view{service_name_} == "IStorage"} , handler_invoker{handler_invoker_} , max_sessions{max_sessions_} {} @@ -82,22 +77,13 @@ void ServiceFrameworkBase::ReportUnimplementedFunction(HLERequestContext& ctx, } void ServiceFrameworkBase::InvokeRequest(HLERequestContext& ctx) { - const auto command = ctx.GetCommand(); - auto it = handlers.find(command); - const bool is_cmd_read = command == 0; + auto it = handlers.find(ctx.GetCommand()); FunctionInfoBase const* info = it == handlers.end() ? nullptr : &it->second; if (info == nullptr || info->handler_callback == nullptr) return ReportUnimplementedFunction(ctx, info); LOG_TRACE(Service, "{}", MakeFunctionString(info->name, GetServiceName(), ctx.CommandBuffer())); handler_invoker(this, info->handler_callback, ctx); - - if (is_i_storage && is_cmd_read) { - const auto* const process = ctx.GetThread().GetOwnerProcess(); - if (process != nullptr && system.IsNVDECActiveForProcess(process->GetId())) { - std::this_thread::sleep_for(std::chrono::microseconds{600}); - } - } } void ServiceFrameworkBase::InvokeRequestTipc(HLERequestContext& ctx) { diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index ea98897e79..68b0d636d8 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -107,8 +107,6 @@ protected: Core::System& system; /// Identifier string used to connect to the service. const char* service_name; - /// Whether this is the IStorage service. - const bool is_i_storage; /// Function used to safely up-cast pointers to the derived class before invoking a handler. InvokerFn* handler_invoker; /// Maximum number of concurrent sessions that this service can handle. From b7c1ded1593c3c2dc58625824a04e30a63fe80c7 Mon Sep 17 00:00:00 2001 From: xbzk Date: Mon, 26 Oct 2026 17:26:07 +0100 Subject: [PATCH 30/32] [file_sys] added log for newer keys needed error (#4519) - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- One log line which could have spared me from a lot of trouble. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4519 Reviewed-by: CamilleLaVey Reviewed-by: Shinmegumi --- src/core/file_sys/content_archive.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/file_sys/content_archive.cpp b/src/core/file_sys/content_archive.cpp index b47b9437d0..1ba7bd3de3 100644 --- a/src/core/file_sys/content_archive.cpp +++ b/src/core/file_sys/content_archive.cpp @@ -45,6 +45,7 @@ NCA::NCA(VirtualFile file_, const NCA* base_nca, bool allow_missing_base) // Ensure we have the proper key area keys to continue. const u8 master_key_id = MasterKeyIdForKeyGeneration(reader->GetKeyGeneration()); if (!keys.HasKey(Core::Crypto::S128KeyType::KeyArea, master_key_id, reader->GetKeyIndex())) { + LOG_ERROR(Loader, "Cannot decrypt {}: keys for gen 0x{:02X}+ required.", file->GetName(), reader->GetKeyGeneration()); status = Loader::ResultStatus::ErrorMissingKeyAreaKey; return; } From 26a03d2473787abf3223b2d0e65b291eee00c1e1 Mon Sep 17 00:00:00 2001 From: John Date: Mon, 26 Oct 2026 17:26:32 +0100 Subject: [PATCH 31/32] Revert "[video_core] Improve asynchronous shader building (#2560)" (#4512) Restores performance but need to check TOTK item icons and Jamboree graphic issues. - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4512 Reviewed-by: CamilleLaVey Reviewed-by: Shinmegumi --- src/video_core/renderer_opengl/gl_shader_cache.cpp | 5 +++++ src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp index df69eb97f5..277cf222fa 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp @@ -414,6 +414,11 @@ GraphicsPipeline* ShaderCache::BuiltPipeline(GraphicsPipeline* pipeline) const n if (!use_asynchronous_shaders) { return pipeline; } + // If something is using depth, we can assume that games are not rendering anything which + // will be used one time. + if (maxwell3d->regs.zeta_enable) { + return nullptr; + } // If games are using a small index count, we can assume these are full screen quads. // Usually these shaders are only used once for building textures so we can assume they // can't be built async diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index e9403580d5..d4ffcd8317 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp @@ -789,6 +789,11 @@ GraphicsPipeline* PipelineCache::BuiltPipeline(GraphicsPipeline* pipeline) const if (!use_asynchronous_shaders) { return pipeline; } + // If something is using depth, we can assume that games are not rendering anything which + // will be used one time. + if (maxwell3d->regs.zeta_enable) { + return nullptr; + } // If games are using a small index count, we can assume these are full screen quads. // Usually these shaders are only used once for building textures so we can assume they // can't be built async From a2aa4d97e10a8345babfe647e1abd5ed5909c623 Mon Sep 17 00:00:00 2001 From: crueter Date: Thu, 29 Oct 2026 17:10:37 +0100 Subject: [PATCH 32/32] [docs] Remove AI restrictions, and adapt to new open registration (#4585) Registration is now open. Enjoy Signed-off-by: crueter - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4585 Reviewed-by: lizzie --- .github/PULL_REQUEST_TEMPLATE.md | 1 - CONTRIBUTING.md | 39 ++---- docs/policies/AI.md | 203 ------------------------------- 3 files changed, 8 insertions(+), 235 deletions(-) delete mode 100644 docs/policies/AI.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 422efb5fdc..bdf9d048e8 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,5 +1,4 @@ - [ ] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). -- [ ] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md). - [ ] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8c16de9ddb..c87dd11dbe 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,15 +16,14 @@ Eden is free, open-source, copyleft software, licensed under the terms of the [G ### Policies -- We are trialing a slightly relaxed AI policy to allow high-quality contributors to use AI *responsibly*. Please read our [detailed AI policy](docs/policies/AI.md) for more info. -- Usage of any form of profanity or otherwise unsavory language is generally discouraged. - - This is primarily because it rarely helps to actually understand what's going on. - - Remember that your comments should be focused and actually address what's happening. With very few exceptions, expletives are actively detrimental at best. -- New code must follow the same general style as the surrounding codebase. Exceptions may be granted in certain cases. +- AI usage is allowed, but we reserve the right to close and rework your PR if you don't fully understand the changes you're making. + - As a common courtesy, please disclose your AI usage under the PR description, as `Assisted-by: ()`. +- Usage of any form of profanity or otherwise unsavory language is discouraged but not strictly disallowed. +- New code must follow the same style as the surrounding codebase. Exceptions may be granted in certain cases. - Maintainers reserve the right to change your patches and pull requests at will. We will try to avoid this. - You should generally respect all decisions made by the [code owners](docs/CODEOWNERS) in your particular subsystem. - However, if you feel they are overstepping or are incorrect, don't be afraid to stand your ground! Maintainers are not always correct. -- While we do *not* adhere to the terms of a formal code of conduct, you will generally be expected to respect other developers, contributors, and community members. +- While we do *not* adhere to the terms of a formal code of conduct, you are expected to treat other developers, contributors, and community members respectfully. - You **must** have basic knowledge of [Git](https://git-scm.com/learn). Knowing how to manage your branches and follow proper fork policies is a necessity. ### Where do I start? @@ -38,7 +37,8 @@ You may also search for open issues on [GitHub](https://github.com/eden-emulator There are five primary ways to contribute. - Submit pull requests directly to our source tree - - You must first request an account on our Forgejo. See [Signup](#how-do-i-sign-up) + - You must first [create an account](https://git.eden-emu.dev/user/sign_up). + - You may use an internal account, or you may use a GitHub/Codeberg account linked to our instance. - Submit pull requests to our [GitHub mirror](https://github.com/eden-emulator/Issue-Reports) - Note that this is subject to being removed by DMCA, so don't rely on this. - Submit pull requests to our [Codeberg mirror](https://codeberg.org/eden-emu/eden) @@ -50,31 +50,8 @@ There are five primary ways to contribute. To test your changes, ensure to read the [build documentation](./docs/Build.md) for your specific platform(s) to ensure everything compiles and works properly. You should also make sure that your branch is up-to-date with the upstream `master` branch before opening a pull request. -### How do I sign up? - -

-To sign up and begin contributing... (click to open) - -Email [crueter@crueter.xyz](mailto:crueter@crueter.xyz) with the following format: - -```txt -Subject: [Eden Git] Registration Request -Username: -Email: -I wish to sign up because... -``` - -Received mail that does not follow this format will be ignored. - -Once your request is processed, you will receive a confirmation email with your temporary password and some information on Git access and policies. If you do not receive a response within 48 hours, feel free to send another email. - -> [!WARNING] -> Some email providers may place the response email in your spam/junk folder; notable offenders include Gmail and Outlook. *Always* ensure to check your Spam or Junk folder. - -
- ## Non-code Contributions Alongside the other contribution methods listed up top, you can also choose to contribute through documentation, organization, or community guides. These can be done either through the code contribution methods described above, or created externally and shared via our Discord community. -If you have an external tool/page that you believe would be handy to integrate/link into Eden, please additionally email our developers at [`developers@eden-emu.dev`](mailto:developers@eden-emu.dev). **Do not submit vibe-coded or AI generated tools or applications**. +If you have an external tool/page that you believe would be handy to integrate/link into Eden, please additionally email our developers at [`developers@eden-emu.dev`](mailto:developers@eden-emu.dev). diff --git a/docs/policies/AI.md b/docs/policies/AI.md deleted file mode 100644 index dd4b4a7fb2..0000000000 --- a/docs/policies/AI.md +++ /dev/null @@ -1,203 +0,0 @@ -# AI Policy - -> [!WARNING] -> We are trialing a slightly relaxed AI policy to allow high-quality contributors to use AI *responsibly*. -> This policy is subject to change at any point in time, so check back frequently. -> -> This banner will be removed once we have finalized our revised policy. - -- [AI Policy](#ai-policy) - - [TL;DR](#tldr) - - [Definitions](#definitions) - - [Scope](#scope) - - [Introduction](#introduction) - - [Requirements](#requirements) - - [Sign-off, Authorship, and Copyright](#sign-off-authorship-and-copyright) - - [Permitted Usage](#permitted-usage) - - [Recommended Prior Discussion](#recommended-prior-discussion) - - [Forbidden Usage](#forbidden-usage) - - [Human Effort Denial of Service](#human-effort-denial-of-service) - - [Disclosure](#disclosure) - - [Codebase Ingestion](#codebase-ingestion) - - [Enforcement](#enforcement) - - [Addendum: AI Commit Messages](#addendum-ai-commit-messages) - - [References](#references) - -## TL;DR - -AI-assisted contributions are welcome, provided you take responsibility for them. - -- You **must** disclose any AI or LLM usage in your pull request description *and* commit message. -- You **must** be able to explain, defend, and revise every line of code you submit. -- Commit messages, PR descriptions, issues, and comments **must** be written by you. Verbatim AI output is not acceptable. -- Undisclosed AI usage will result in your contribution being rejected. -- Low-quality contributions, disclosed or not, will be reworked or rejected. -- Spamming automated PRs, comments, or issues is treated as a Denial of Service (DoS) attack on our reviewers; see [Human Effort Denial of Service](#human-effort-denial-of-service). - -## Definitions - -An *AI or LLM-based tool* is any piece of software that generates code, text, or other content through machine learning models. This includes, but is not limited to: chat assistants, agentic coding tools/harnesses, inline code completion suggestions you have accepted into the code, and AI-driven explanation/refactoring features. - -For the purposes of this policy, basic deterministic/static development tools (such as clang-tidy, git, compilers, etc.) are not considered AI tools. - -Terms such as "substantially", "large-scale", "majority", and "low-quality" are intentionally left vague, and will be interpreted at the maintainers' discretion. When in doubt, ask first. - -## Scope - -This policy applies to all code contributions, alongside issues and pull requests surrounding this codebase. This includes: - -- Commit messages -- PR descriptions -- Code review comments -- Issue/PR comments -- Patches submitted via e-mail - -Areas that are not directly related to code--such as our surrounding communities--are not covered by the terms of this policy. Additionally, spelling/grammar checking via AI or LLM-based tools is not covered under this document. - -## Introduction - -In the right hands, AI and LLM-based tools are incredibly useful for getting features and bugfixes out the door as fast as possible. At the same time, reviewer bandwidth is a scarce resource. We are therefore open to AI-assisted contributions, provided they are produced and disclosed properly. - -The goal of this document is *not* to set arbitrary restrictions, but rather to keep our development healthy and stable, while still allowing contributors to use the tools they find helpful. A contribution must be worth more to the project than the time it takes to review it. - -Throughout this document, **must** and **must not** are inflexible, binding requirements. Refusal to follow these is treated as a violation of the terms outlined in this document. - -## Requirements - -These apply to all contributions, whether AI-assisted or not. AI-assisted contributions also carry additional disclosure requirements as outlined in [Disclosure](#disclosure). - -1. *Disclosure*. Any and all usage of AI or LLM-based tools within any contribution **must** be explicitly marked and disclosed as appropriate. -2. *Responsibility*. The human submitter of any contribution is held wholly responsible for the accuracy, completeness, and intent of what is submitted. You **must** be able to explain, defend, and revise your code during review. -3. *Review*. All code **must** be thoroughly reviewed by the author before opening a PR or marking it ready for review. -4. *Testing*. All code changes **must** be tested directly by the human author. -5. *Quality*. All submitted code is held to a strict standard of excellence. Low-quality AI-generated content does not uphold this standard. -6. *Licensing*. All code **must** be compatible with the GPLv3 or later. You **must** warrant that you have the right to submit it under those terms, and that it was not copied from work published under an incompatible license. - -## Sign-off, Authorship, and Copyright - -AI agents **must not** add `Signed-off-by:` tags. The human submitter **must** sign off on all changes. - -Similarly, AI agents cannot hold authorship or copyright over code, and **must not** add `Co-authored-by:` or `Co-developed-by:` tags. The human submitter **must** author all changes. - -## Permitted Usage - -This is a non-exhaustive list of permitted uses of AI and LLM-based tools, provided they are disclosed properly. - -- Drafting issues and pull requests, provided the final text and submitted code are substantially your own. -- Debugging issues, bugs, glitches, and crashes, whether pre-existing or introduced by your own changes. -- Reviewing your own changes before submitting a PR. -- Research, brainstorming, and codebase searching/understanding. -- Applying tedious but not particularly large changes, such as mass-migrating specific classes to polyfills or abstractions. - -## Recommended Prior Discussion - -Some usage cases are not necessarily forbidden nor permitted. These should be discussed with maintainers in an issue or e-mail *before* submission. Maintainers and reviewers may also comment on this during the review/submission phase. - -- Generating boilerplate/scaffolding for new code. -- Writing unit tests. -- Large-scale refactors primarily driven by an AI agent. -- Any contribution where an AI agent or model was responsible for the majority of the implementation. - -## Forbidden Usage - -This is a non-exhaustive list of strictly forbidden uses of AI and LLM-based tools. - -- Vibecoding, or changes entirely authored by AI agents without human intervention or understanding. - - If you don't choose to put in the necessary effort to understand every line of code you submitted, neither will we. -- Fully AI-generated commit messages, PR descriptions, issues, or comments. See [Addendum: AI Commit Messages](#addendum-ai-commit-messages). -- Submission of AI-assisted work that is not disclosed per the [Disclosure](#disclosure) requirements. -- Low-quality submissions that fail to satisfy our standard of code excellence. -- Submitting secrets, credentials, private user data, or unpublished security reports to third-party AI services. - - This includes console keys, encryption material, and private vulnerability disclosures. -- Verbatim AI code reviews (e.g. Codex/Copilot reviews). - -## Human Effort Denial of Service - -Using automated tools and AI to submit PRs, issues, and comments that we have to carefully review and handle is considered a [Denial-of-service attack](https://en.wikipedia.org/wiki/Denial-of-service_attack) on our human effort. - -It takes very little effort on your side (an LLM prompt) to generate a large amount of effort on ours (careful and thorough code review). Please respect our time and don't do that. - -## Disclosure - -How you disclose AI usage is up to you. However, it **must** be explicit, easy to identify, and placed both within the commit message *and* the surrounding PR description. For patches submitted by e-mail, the cover letter counts as the PR description. We recommend an `Assisted-by:` footer: - -```txt -Assisted-by: () -``` - -For instance: - -```txt -Assisted-by: Claude Opus 5.5 (initial draft and code review) -``` - -Contributions without a commit message (e.g. issues/comments) should instead use a plain sentence in the text body such as `I used to help with `. PRs and commit messages may opt to use this format as well. - -Multi-commit series/squashes **must** maintain the trailer. Maintainers will handle this for merges to master, but you are responsible for ensuring the disclosure survives into the final commit/PR body of squashes within your branches. - -Regardless, what matters is that reviewers can tell *at a glance* where and how AI was involved in your contribution. - -## Codebase Ingestion - -Ingestion of this codebase by LLMs for any purpose--such as training or prompt context--is permitted *for now*. This may change at any point as litigation and court rulings around AI and code copyright proceed. - -AI models may have ingested AGPLv3 or otherwise copyleft-incompatible code and may regurgitate it. You remain responsible for ensuring that all code you submit is compatible with the GPLv3 or later. - -## Enforcement - -- If we suspect undisclosed AI usage in a contribution, we will ask for disclosure. -- Refusal to provide disclosure will result in rejection of the contribution, and your PR or issue will be closed. Maintainers may choose to rework it themselves if the change is worth having. -- Accounts that spam us with repeated automated PRs or comments will be blocked or permanently suspended from our Git instance. -- Maintainers reserve the right to close your issues and pull requests if you don't follow the guidelines and procedures outlined in this document, and refuse or fail to make changes as necessary to comply. -- Repeated failures to comply may result in loss of contribution privileges. - -## Addendum: AI Commit Messages - -The patchset for pull request [#3422](https://git.eden-emu.dev/eden-emu/eden/pulls/3422) was fed into a dedicated code AI model, and it produced the following: - -```txt -profile_manager: Refactor user deletion to use index instead of UUID - -This commit improves the user profile deletion flow in the following ways: - -1. **UI layer (ConfigureProfileManager)**: - - Replaces UUID-based deletion with index-based deletion - - Passes the selected row index from the tree view to the confirmation dialog - - Emits deleteUser(int index) signal from ConfigureProfileManagerDeleteDialog - - Removes lambda capture and std::function callback in favor of direct signal/slot connection - -2. **Delete dialog**: - - Changes SetInfo() signature to accept index instead of accept callback - - Stores index internally and emits it via deleteUser signal on acceptance - -3. **Core ProfileManager**: - - Refactors RemoveUser(UUID) → RemoveProfileAtIndex(index) - - Removes duplicated stable_partition + save logic from RemoveUser() - - Centralizes profile removal and save-file writing in RemoveProfileAtIndex() - -4. **Minor follow-up**: - - Adds profile_manager.ResetUserSaveFile() call in PopulateUserList() to ensure consistent state when refreshing the user list - -These changes eliminate redundant code, reduce the risk of UUID → index mismatch bugs, and make the deletion path more straightforward and maintainable. - -Fixes: potential inconsistency when user order changes between UI and backend -``` - -This: - -- Is needlessly verbose (nobody cares about most of these details) -- Doesn't address the actual purpose of the PR (fixing a double-deletion bug in the profile manager) -- Has unicode arrows (this is bad for command-line editors) -- Uses corporate and word-salad language that pads out the message to make it look like a lot changed - -A good commit message should be concise, descriptive, and convey the *intent* behind the change, such as the bug being fixed or the feature being added. It should *not* be a detailed changelog of every individual byte that's changed. - -## References - -This policy document has been adapted from the AI policies of numerous other free and open-source projects, whether restrictive or permissive. - -- [Gitea](https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md#ai-contribution-policy) -- The [Linux kernel](https://kernel.org/doc/html/next/process/coding-assistants.html) -- [Gentoo Linux](https://wiki.gentoo.org/wiki/Project:Council/AI_policy) -- [cURL](https://curl.se/dev/contribute.html#on-ai-use-in-curl) -- [FastAPI](https://tiangolo.com/open-source/contributing/#automated-code-and-ai)