From 67a8353e608418d1a23137dfff31d019084443ec Mon Sep 17 00:00:00 2001 From: lizzie Date: Sat, 26 Sep 2026 10:24:21 +0000 Subject: [PATCH] 2026-09-26 10:24:21 Signed-off-by: lizzie --- src/core/CMakeLists.txt | 38 - src/core/hle/service/am/am.cpp | 1223 ++++++++++++++++- .../all_system_applet_proxies_service.cpp | 118 -- .../all_system_applet_proxies_service.h | 72 - .../am/service/applet_common_functions.cpp | 30 + .../am/service/applet_common_functions.h | 30 +- .../am/service/application_accessor.cpp | 32 + .../service/am/service/application_accessor.h | 32 +- .../am/service/application_creator.cpp | 10 + .../service/am/service/application_creator.h | 10 +- .../service/am/service/application_proxy.cpp | 91 -- .../service/am/service/application_proxy.h | 63 - .../am/service/application_proxy_service.cpp | 40 - .../am/service/application_proxy_service.h | 39 - .../service/am/service/audio_controller.cpp | 12 + .../hle/service/am/service/audio_controller.h | 12 +- .../am/service/common_state_getter.cpp | 140 +- .../service/am/service/common_state_getter.h | 69 +- .../am/service/cradle_firmware_updater.cpp | 12 + .../am/service/cradle_firmware_updater.h | 12 +- .../service/am/service/display_controller.cpp | 34 + .../service/am/service/display_controller.h | 34 +- .../am/service/global_state_controller.cpp | 19 + .../am/service/global_state_controller.h | 19 +- .../am/service/home_menu_functions.cpp | 21 + .../service/am/service/home_menu_functions.h | 21 +- .../am/service/library_applet_accessor.cpp | 35 +- .../am/service/library_applet_accessor.h | 50 +- .../am/service/library_applet_creator.cpp | 277 ---- .../am/service/library_applet_creator.h | 56 - .../am/service/library_applet_proxy.cpp | 116 -- .../service/am/service/library_applet_proxy.h | 73 - .../service/library_applet_self_accessor.cpp | 291 ---- .../am/service/library_applet_self_accessor.h | 128 -- .../hle/service/am/service/lock_accessor.cpp | 67 - .../hle/service/am/service/lock_accessor.h | 41 - .../am/service/overlay_applet_proxy.cpp | 103 -- .../service/am/service/overlay_applet_proxy.h | 71 - .../service/am/service/overlay_functions.cpp | 26 + .../service/am/service/overlay_functions.h | 26 +- .../am/service/process_winding_controller.cpp | 14 + .../am/service/process_winding_controller.h | 14 +- .../service/am/service/self_controller.cpp | 56 + .../hle/service/am/service/self_controller.h | 56 +- .../am/service/system_applet_proxy.cpp | 115 -- .../service/am/service/system_applet_proxy.h | 75 - .../service/am/service/window_controller.cpp | 14 + .../service/am/service/window_controller.h | 14 +- .../hle/service/aoc/addon_content_manager.cpp | 28 + .../hle/service/aoc/addon_content_manager.h | 28 +- .../service/aoc/purchase_event_manager.cpp | 25 +- .../hle/service/aoc/purchase_event_manager.h | 2 + src/core/hle/service/audio/audio_in.cpp | 21 + src/core/hle/service/audio/audio_in.h | 21 +- .../hle/service/audio/audio_in_manager.cpp | 12 + src/core/hle/service/audio/audio_in_manager.h | 12 +- src/core/hle/service/audio/audio_out.cpp | 21 +- src/core/hle/service/audio/audio_out.h | 2 + .../hle/service/audio/audio_out_manager.cpp | 10 + .../hle/service/audio/audio_out_manager.h | 10 +- src/core/hle/service/audio/audio_renderer.cpp | 20 + src/core/hle/service/audio/audio_renderer.h | 20 +- .../service/audio/audio_renderer_manager.cpp | 11 + .../service/audio/audio_renderer_manager.h | 11 +- .../service/audio/hardware_opus_decoder.cpp | 16 + .../hle/service/audio/hardware_opus_decoder.h | 16 +- .../audio/hardware_opus_decoder_manager.cpp | 16 + .../audio/hardware_opus_decoder_manager.h | 16 +- .../bcat/delivery_cache_directory_service.cpp | 9 + .../bcat/delivery_cache_directory_service.h | 9 +- .../bcat/delivery_cache_file_service.cpp | 10 + .../bcat/delivery_cache_file_service.h | 10 +- .../bcat/delivery_cache_progress_service.cpp | 8 + .../bcat/delivery_cache_progress_service.h | 8 +- .../bcat/delivery_cache_storage_service.cpp | 9 + .../bcat/delivery_cache_storage_service.h | 9 +- .../bcat/news/newly_arrived_event_holder.cpp | 7 + .../bcat/news/newly_arrived_event_holder.h | 7 +- .../service/bcat/news/news_data_service.cpp | 11 + .../hle/service/bcat/news/news_data_service.h | 11 +- .../bcat/news/news_database_service.cpp | 13 + .../service/bcat/news/news_database_service.h | 13 +- .../bcat/news/overwrite_event_holder.cpp | 7 + .../bcat/news/overwrite_event_holder.h | 7 +- .../hle/service/bcat/news/service_creator.cpp | 11 + .../hle/service/bcat/news/service_creator.h | 11 +- src/core/hle/service/bcat/service_creator.cpp | 11 + src/core/hle/service/bcat/service_creator.h | 11 +- src/core/hle/service/btm/btm.cpp | 310 ++++- src/core/hle/service/btm/btm_debug.cpp | 16 - src/core/hle/service/btm/btm_debug.h | 45 - src/core/hle/service/btm/btm_system.cpp | 27 - src/core/hle/service/btm/btm_system.h | 32 - src/core/hle/service/btm/btm_system_core.cpp | 102 -- src/core/hle/service/btm/btm_system_core.h | 90 -- src/core/hle/service/btm/btm_user.cpp | 26 - src/core/hle/service/btm/btm_user.h | 32 - src/core/hle/service/btm/btm_user_core.cpp | 68 - src/core/hle/service/btm/btm_user_core.h | 76 - src/core/hle/service/caps/caps_a.cpp | 46 + src/core/hle/service/caps/caps_a.h | 46 +- src/core/hle/service/caps/caps_c.cpp | 25 + src/core/hle/service/caps/caps_c.h | 33 +- src/core/hle/service/caps/caps_ss.cpp | 13 + src/core/hle/service/caps/caps_ss.h | 13 +- src/core/hle/service/caps/caps_su.cpp | 11 + src/core/hle/service/caps/caps_su.h | 11 +- src/core/hle/service/caps/caps_u.cpp | 20 + src/core/hle/service/caps/caps_u.h | 20 +- .../service/filesystem/fsp/fs_i_directory.cpp | 8 + .../service/filesystem/fsp/fs_i_directory.h | 8 +- .../filesystem/fsp/fs_i_filesystem.cpp | 23 + .../service/filesystem/fsp/fs_i_filesystem.h | 23 +- src/core/hle/service/glue/notif.cpp | 38 +- src/core/hle/service/glue/notif.h | 38 +- 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 | 20 + src/core/hle/service/glue/time/time_zone.h | 20 +- .../hid/active_vibration_device_list.cpp | 14 +- .../hid/active_vibration_device_list.h | 2 +- src/core/hle/service/hid/applet_resource.cpp | 7 + src/core/hle/service/hid/applet_resource.h | 7 +- src/core/hle/service/hid/hidbus.cpp | 42 +- src/core/hle/service/hid/hidbus.h | 2 + src/core/hle/service/ldn/monitor_service.cpp | 14 + src/core/hle/service/ldn/monitor_service.h | 14 +- .../hle/service/ldn/sf_monitor_service.cpp | 18 +- src/core/hle/service/ldn/sf_monitor_service.h | 1 + .../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 | 72 +- .../ldn/user_local_communication_service.h | 1 + src/core/hle/service/mii/mii.cpp | 7 + src/core/hle/service/mii/mii.h | 7 +- src/core/hle/service/nfc/nfc.cpp | 122 +- src/core/hle/service/nfp/nfp.cpp | 188 +-- src/core/hle/service/nifm/nifm.cpp | 13 +- src/core/hle/service/nifm/nifm.h | 1 + src/core/hle/service/ns/async_result.cpp | 9 + src/core/hle/service/ns/async_result.h | 9 +- .../service/ns/content_management_interface.h | 2 +- .../service/ns/dynamic_rights_interface.cpp | 35 + .../hle/service/ns/dynamic_rights_interface.h | 35 +- .../service/ns/factory_reset_interface.cpp | 26 +- .../hle/service/ns/factory_reset_interface.h | 1 + .../service/ns/platform_service_manager.cpp | 22 + .../hle/service/ns/platform_service_manager.h | 22 +- src/core/hle/service/ns/query_service.cpp | 32 + src/core/hle/service/ns/query_service.h | 32 +- ...nly_application_control_data_interface.cpp | 15 + ..._only_application_control_data_interface.h | 16 +- ...read_only_application_record_interface.cpp | 10 + .../read_only_application_record_interface.h | 10 +- .../service/ns/service_getter_interface.cpp | 17 + .../hle/service/ns/service_getter_interface.h | 17 +- .../service/ns/system_update_interface.cpp | 23 + .../hle/service/ns/system_update_interface.h | 24 +- .../service/nvnflinger/hos_binder_driver.cpp | 10 + .../service/nvnflinger/hos_binder_driver.h | 10 +- .../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 | 56 +- .../olsc/olsc_service_for_application.h | 2 + .../olsc/olsc_service_for_system_service.cpp | 77 -- .../olsc/olsc_service_for_system_service.h | 119 -- .../olsc/remote_storage_controller.cpp | 36 + .../service/olsc/remote_storage_controller.h | 36 +- .../olsc/transfer_task_list_controller.cpp | 37 + .../olsc/transfer_task_list_controller.h | 37 +- .../service/pctl/parental_control_service.cpp | 369 ----- .../service/pctl/parental_control_service.h | 228 --- .../pctl/parental_control_service_factory.cpp | 38 - .../pctl/parental_control_service_factory.h | 38 - src/core/hle/service/pctl/pctl.cpp | 633 ++++++++- src/core/hle/service/pctl/pctl_results.h | 15 - src/core/hle/service/pctl/pctl_types.h | 73 - src/core/hle/service/psc/ovln/receiver.cpp | 23 +- src/core/hle/service/psc/ovln/receiver.h | 1 + .../hle/service/psc/ovln/receiver_service.cpp | 7 + .../hle/service/psc/ovln/receiver_service.h | 7 +- src/core/hle/service/psc/ovln/sender.cpp | 8 + src/core/hle/service/psc/ovln/sender.h | 8 +- .../hle/service/psc/ovln/sender_service.cpp | 7 + .../hle/service/psc/ovln/sender_service.h | 7 +- src/core/hle/service/psc/pm_module.cpp | 22 +- src/core/hle/service/psc/pm_module.h | 1 + src/core/hle/service/psc/pm_service.cpp | 21 - src/core/hle/service/psc/pm_service.h | 29 - src/core/hle/service/psc/psc.cpp | 23 +- .../service/psc/time/power_state_service.cpp | 19 +- .../service/psc/time/power_state_service.h | 1 + .../hle/service/psc/time/service_manager.cpp | 24 + .../hle/service/psc/time/service_manager.h | 25 +- 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 | 21 +- src/core/hle/service/psc/time/steady_clock.h | 2 + .../hle/service/psc/time/system_clock.cpp | 11 + src/core/hle/service/psc/time/system_clock.h | 11 +- .../service/psc/time/time_zone_service.cpp | 20 + .../hle/service/psc/time/time_zone_service.h | 20 +- src/core/hle/service/services.h | 3 - .../set/firmware_debug_settings_server.h | 2 +- src/core/hle/service/set/settings_server.cpp | 19 + src/core/hle/service/set/settings_server.h | 19 +- .../service/set/system_settings_server.cpp | 231 ++++ .../hle/service/set/system_settings_server.h | 231 +--- src/core/hle/service/ssl/ssl.cpp | 223 ++- .../vi/application_display_service.cpp | 28 + .../service/vi/application_display_service.h | 28 +- .../service/vi/application_root_service.cpp | 8 + .../hle/service/vi/application_root_service.h | 8 +- .../service/vi/manager_display_service.cpp | 87 ++ .../hle/service/vi/manager_display_service.h | 87 +- .../hle/service/vi/manager_root_service.cpp | 12 + .../hle/service/vi/manager_root_service.h | 12 +- .../hle/service/vi/system_display_service.cpp | 53 + .../hle/service/vi/system_display_service.h | 53 +- .../hle/service/vi/system_root_service.cpp | 8 + src/core/hle/service/vi/system_root_service.h | 8 +- 224 files changed, 4671 insertions(+), 5585 deletions(-) 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/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/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/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/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/pm_service.cpp delete mode 100644 src/core/hle/service/psc/pm_service.h diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index fddb6ed779..a7ada68380 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -444,8 +444,6 @@ 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 @@ -454,10 +452,6 @@ add_library(core STATIC 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 @@ -474,18 +468,8 @@ 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 @@ -494,8 +478,6 @@ add_library(core STATIC 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,16 +562,6 @@ 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 @@ -913,8 +885,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 +914,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 @@ -971,8 +935,6 @@ add_library(core STATIC 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 diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 2ef393439b..ee5c500a7f 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -1,16 +1,1225 @@ // 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/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/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/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 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: + FunctionInfoBase const* 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); + } + + FunctionInfoBase const* FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IApplicationProxyService::OpenApplicationProxy>, "OpenApplicationProxy"} + ); + WindowSystem& m_window_system; +}; + +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(); + } + + FunctionInfoBase const* 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(); + } + + FunctionInfoBase const* 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(); + } + + FunctionInfoBase const* 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(); + } + + FunctionInfoBase const* 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(); + } + + FunctionInfoBase const* 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); + } + + FunctionInfoBase const* 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"}, // 19.0.0+ + FunctionInfo{460, D<&IAllSystemAppletProxiesService::GetAppletAlternativeFunctions>, "GetAppletAlternativeFunctions"}, // 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 +1227,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 a6c435983f..0000000000 --- a/src/core/hle/service/am/service/all_system_applet_proxies_service.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 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} { -} - -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 bb26f62503..0000000000 --- a/src/core/hle/service/am/service/all_system_applet_proxies_service.h +++ /dev/null @@ -1,72 +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); - - FunctionInfoBase const* 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"}, // 19.0.0+ - FunctionInfo{460, D<&IAllSystemAppletProxiesService::GetAppletAlternativeFunctions>, "GetAppletAlternativeFunctions"}, // 20.0.0+ - FunctionInfo{1000, nullptr, "GetDebugFunctions"} - ); - 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 index c8792f1a45..92f3ceda96 100644 --- a/src/core/hle/service/am/service/applet_common_functions.cpp +++ b/src/core/hle/service/am/service/applet_common_functions.cpp @@ -12,6 +12,36 @@ namespace Service::AM { +ServiceFrameworkBase::FunctionInfoBase const* IAppletCommonFunctions::FindRequest(u32 key) { + 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"}, //19.0.0+ + FunctionInfo{320, D<&IAppletCommonFunctions::SetGpuTimeSliceBoost>, "SetGpuTimeSliceBoost"}, //19.0.0+ + FunctionInfo{321, nullptr, "SetGpuTimeSliceBoostDueToApplication"}, //19.0.0+ + FunctionInfo{350, D<&IAppletCommonFunctions::Unknown350>, "Unknown350"} //20.0.0+ + ); + return HandlerTableGenerateWithFind(key, functions); +} + IAppletCommonFunctions::IAppletCommonFunctions(Core::System& system_, std::shared_ptr applet_) : ServiceFramework{system_, "IAppletCommonFunctions"}, applet{std::move(applet_)} { diff --git a/src/core/hle/service/am/service/applet_common_functions.h b/src/core/hle/service/am/service/applet_common_functions.h index daf0353c39..48b00cbfde 100644 --- a/src/core/hle/service/am/service/applet_common_functions.h +++ b/src/core/hle/service/am/service/applet_common_functions.h @@ -27,35 +27,7 @@ private: Result SetGpuTimeSliceBoost(s64 time_span); Result Unknown350(Out out_unknown); - FunctionInfoBase const* 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"}, //19.0.0+ - FunctionInfo{320, D<&IAppletCommonFunctions::SetGpuTimeSliceBoost>, "SetGpuTimeSliceBoost"}, //19.0.0+ - FunctionInfo{321, nullptr, "SetGpuTimeSliceBoostDueToApplication"}, //19.0.0+ - FunctionInfo{350, D<&IAppletCommonFunctions::Unknown350>, "Unknown350"} //20.0.0+ - ); + FunctionInfoBase const* FindRequest(u32 key) override; const std::shared_ptr applet; }; diff --git a/src/core/hle/service/am/service/application_accessor.cpp b/src/core/hle/service/am/service/application_accessor.cpp index 8dc67c340c..df35700db1 100644 --- a/src/core/hle/service/am/service/application_accessor.cpp +++ b/src/core/hle/service/am/service/application_accessor.cpp @@ -18,6 +18,38 @@ namespace Service::AM { +ServiceFrameworkBase::FunctionInfoBase const* 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), diff --git a/src/core/hle/service/am/service/application_accessor.h b/src/core/hle/service/am/service/application_accessor.h index 497b3b8ca8..0549df8ff4 100644 --- a/src/core/hle/service/am/service/application_accessor.h +++ b/src/core/hle/service/am/service/application_accessor.h @@ -36,37 +36,7 @@ private: Result GetNsRightsEnvironmentHandle(Out out_handle); Result ReportApplicationExitTimeout(); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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 b27eef5f06..687cde587c 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 { +ServiceFrameworkBase::FunctionInfoBase const* 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) { diff --git a/src/core/hle/service/am/service/application_creator.h b/src/core/hle/service/am/service/application_creator.h index 13897591ed..5a7f8896a2 100644 --- a/src/core/hle/service/am/service/application_creator.h +++ b/src/core/hle/service/am/service/application_creator.h @@ -24,15 +24,7 @@ private: Result CreateApplication(Out>, u64 application_id); Result CreateSystemApplication(Out>, u64 application_id); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* FindRequest(u32 key) override; WindowSystem& m_window_system; }; 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 c9cd26d2be..0000000000 --- a/src/core/hle/service/am/service/application_proxy.cpp +++ /dev/null @@ -1,91 +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)} { -} - -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 2d2fef4b81..0000000000 --- a/src/core/hle/service/am/service/application_proxy.h +++ /dev/null @@ -1,63 +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: - FunctionInfoBase const* 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; -}; - -} // 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 bc6703be7d..0000000000 --- a/src/core/hle/service/am/service/application_proxy_service.cpp +++ /dev/null @@ -1,40 +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} { -} - -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 50134818ca..0000000000 --- a/src/core/hle/service/am/service/application_proxy_service.h +++ /dev/null @@ -1,39 +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); - - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IApplicationProxyService::OpenApplicationProxy>, "OpenApplicationProxy"} - ); - 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 3d93384ea2..39de9bf62b 100644 --- a/src/core/hle/service/am/service/audio_controller.cpp +++ b/src/core/hle/service/am/service/audio_controller.cpp @@ -9,6 +9,18 @@ namespace Service::AM { +ServiceFrameworkBase::FunctionInfoBase const* 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"} //20.0.0+ + ); + return HandlerTableGenerateWithFind(key, functions); +} + IAudioController::IAudioController(Core::System& system_) : ServiceFramework{system_, "IAudioController"} { } diff --git a/src/core/hle/service/am/service/audio_controller.h b/src/core/hle/service/am/service/audio_controller.h index 5524a15a91..06fdecb07a 100644 --- a/src/core/hle/service/am/service/audio_controller.h +++ b/src/core/hle/service/am/service/audio_controller.h @@ -20,17 +20,7 @@ private: Result ChangeMainAppletMasterVolume(f32 volume, s64 fade_time_ns); Result SetTransparentVolumeRate(f32 transparent_volume_rate); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"}, //20.0.0+ - ); + FunctionInfoBase const* 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 466b9686e5..8e5b854ce9 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,6 +17,145 @@ namespace Service::AM { +ServiceFrameworkBase::FunctionInfoBase const* 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"}, //11.0.0+ + FunctionInfo{15, nullptr, "Unknown15"}, //19.0.0+ + FunctionInfo{20, D<&ICommonStateGetter::PushToGeneralChannel>, "PushToGeneralChannel"}, + FunctionInfo{30, D<&ICommonStateGetter::GetHomeButtonReaderLockAccessor>, "GetHomeButtonReaderLockAccessor"}, + FunctionInfo{31, D<&ICommonStateGetter::GetReaderLockAccessorEx>, "GetReaderLockAccessorEx"}, //2.0.0+ + FunctionInfo{32, D<&ICommonStateGetter::GetWriterLockAccessorEx>, "GetWriterLockAccessorEx"}, //7.0.0+ + FunctionInfo{40, nullptr, "GetCradleFwVersion"}, //2.0.0+ + FunctionInfo{50, D<&ICommonStateGetter::IsVrModeEnabled>, "IsVrModeEnabled"}, //3.0.0+ + FunctionInfo{51, D<&ICommonStateGetter::SetVrModeEnabled>, "SetVrModeEnabled"}, //3.0.0+ + FunctionInfo{52, D<&ICommonStateGetter::SetLcdBacklighOffEnabled>, "SetLcdBacklighOffEnabled"}, //4.0.0+ + FunctionInfo{53, D<&ICommonStateGetter::BeginVrModeEx>, "BeginVrModeEx"}, //7.0.0+ + FunctionInfo{54, D<&ICommonStateGetter::EndVrModeEx>, "EndVrModeEx"}, //7.0.0+ + FunctionInfo{55, D<&ICommonStateGetter::IsInControllerFirmwareUpdateSection>, "IsInControllerFirmwareUpdateSection"}, //3.0.0+ + FunctionInfo{59, nullptr, "SetVrPositionForDebug"}, //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"}, //13.0.0+ + FunctionInfo{130, D<&ICommonStateGetter::EnableStartupLogoDisappearedMessage>, "EnableStartupLogoDisappearedMessage"}, //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"}, //20.0.0+ + FunctionInfo{610, D<&ICommonStateGetter::Unknown610>, "Unknown610"}, //21.0.0+ + FunctionInfo{611, D<&ICommonStateGetter::Unknown611>, "Unknown611"}, //22.0.0+ + FunctionInfo{900, D<&ICommonStateGetter::SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled>, "SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled"}, //11.0.0+ + FunctionInfo{910, nullptr, "GetLaunchRequiredTick"}, //17.0.0+ + FunctionInfo{1000, D<&ICommonStateGetter::BeginVrMode3d>, "BeginVrMode3d"}, //19.0.0+ + FunctionInfo{1001, D<&ICommonStateGetter::EndVrMode3d>, "EndVrMode3d"}, //19.0.0+ + FunctionInfo{1002, D<&ICommonStateGetter::IsVrModeEnabled3d>, "IsVrModeEnabled3d"}, //19.0.0+ + FunctionInfo{1003, D<&ICommonStateGetter::GetVrLaboGoggleViewport>, "GetVrLaboGoggleViewport"}, //21.0.0+ + FunctionInfo{1004, D<&ICommonStateGetter::GetPanelPhysicalSizeForSpecificTitle>, "GetPanelPhysicalSizeForSpecificTitle"}, //21.0.0+ + FunctionInfo{1005, D<&ICommonStateGetter::GetPanelResolutionForSpecificTitle>, "GetPanelResolutionForSpecificTitle"} //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: + FunctionInfoBase const* 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)} { } 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 2d2c0f07ac..07a0c9b905 100644 --- a/src/core/hle/service/am/service/common_state_getter.h +++ b/src/core/hle/service/am/service/common_state_getter.h @@ -76,74 +76,7 @@ private: void SetCpuBoostMode(HLERequestContext& ctx); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"}, //11.0.0+ - FunctionInfo{15, nullptr, "Unknown15"}, //19.0.0+ - FunctionInfo{20, D<&ICommonStateGetter::PushToGeneralChannel>, "PushToGeneralChannel"}, - FunctionInfo{30, D<&ICommonStateGetter::GetHomeButtonReaderLockAccessor>, "GetHomeButtonReaderLockAccessor"}, - FunctionInfo{31, D<&ICommonStateGetter::GetReaderLockAccessorEx>, "GetReaderLockAccessorEx"}, //2.0.0+ - FunctionInfo{32, D<&ICommonStateGetter::GetWriterLockAccessorEx>, "GetWriterLockAccessorEx"}, //7.0.0+ - FunctionInfo{40, nullptr, "GetCradleFwVersion"}, //2.0.0+ - FunctionInfo{50, D<&ICommonStateGetter::IsVrModeEnabled>, "IsVrModeEnabled"}, //3.0.0+ - FunctionInfo{51, D<&ICommonStateGetter::SetVrModeEnabled>, "SetVrModeEnabled"}, //3.0.0+ - FunctionInfo{52, D<&ICommonStateGetter::SetLcdBacklighOffEnabled>, "SetLcdBacklighOffEnabled"}, //4.0.0+ - FunctionInfo{53, D<&ICommonStateGetter::BeginVrModeEx>, "BeginVrModeEx"}, //7.0.0+ - FunctionInfo{54, D<&ICommonStateGetter::EndVrModeEx>, "EndVrModeEx"}, //7.0.0+ - FunctionInfo{55, D<&ICommonStateGetter::IsInControllerFirmwareUpdateSection>, "IsInControllerFirmwareUpdateSection"}, //3.0.0+ - FunctionInfo{59, nullptr, "SetVrPositionForDebug"}, //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"}, //13.0.0+ - FunctionInfo{130, D<&ICommonStateGetter::EnableStartupLogoDisappearedMessage>, "EnableStartupLogoDisappearedMessage"}, //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"}, //20.0.0+ - FunctionInfo{610, D<&ICommonStateGetter::Unknown610>, "Unknown610"}, //21.0.0+ - FunctionInfo{611, D<&ICommonStateGetter::Unknown611>, "Unknown611"}, //22.0.0+ - FunctionInfo{900, D<&ICommonStateGetter::SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled>, "SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled"}, //11.0.0+ - FunctionInfo{910, nullptr, "GetLaunchRequiredTick"}, //17.0.0+ - FunctionInfo{1000, D<&ICommonStateGetter::BeginVrMode3d>, "BeginVrMode3d"}, //19.0.0+ - FunctionInfo{1001, D<&ICommonStateGetter::EndVrMode3d>, "EndVrMode3d"}, //19.0.0+ - FunctionInfo{1002, D<&ICommonStateGetter::IsVrModeEnabled3d>, "IsVrModeEnabled3d"}, //19.0.0+ - FunctionInfo{1003, D<&ICommonStateGetter::GetVrLaboGoggleViewport>, "GetVrLaboGoggleViewport"}, //21.0.0+ - FunctionInfo{1004, D<&ICommonStateGetter::GetPanelPhysicalSizeForSpecificTitle>, "GetPanelPhysicalSizeForSpecificTitle"}, //21.0.0+ - FunctionInfo{1005, D<&ICommonStateGetter::GetPanelResolutionForSpecificTitle>, "GetPanelResolutionForSpecificTitle"}, //21.0.0+ - ); + FunctionInfoBase const* 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 062a81be2d..83cb11026b 100644 --- a/src/core/hle/service/am/service/cradle_firmware_updater.cpp +++ b/src/core/hle/service/am/service/cradle_firmware_updater.cpp @@ -6,6 +6,18 @@ namespace Service::AM { + ServiceFrameworkBase::FunctionInfoBase const* 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} { 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 9a4d620685..2c0e84c889 100644 --- a/src/core/hle/service/am/service/cradle_firmware_updater.h +++ b/src/core/hle/service/am/service/cradle_firmware_updater.h @@ -30,17 +30,7 @@ private: Result GetCradleDeviceInfoChangeEvent(OutCopyHandle out_event); private: - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* FindRequest(u32 key) override; KernelHelpers::ServiceContext m_context; Event m_cradle_device_info_event; }; diff --git a/src/core/hle/service/am/service/display_controller.cpp b/src/core/hle/service/am/service/display_controller.cpp index 08aa6518fc..40db3d1184 100644 --- a/src/core/hle/service/am/service/display_controller.cpp +++ b/src/core/hle/service/am/service/display_controller.cpp @@ -12,6 +12,40 @@ namespace Service::AM { +ServiceFrameworkBase::FunctionInfoBase const* 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_)) { } diff --git a/src/core/hle/service/am/service/display_controller.h b/src/core/hle/service/am/service/display_controller.h index f3f947178f..851c400142 100644 --- a/src/core/hle/service/am/service/display_controller.h +++ b/src/core/hle/service/am/service/display_controller.h @@ -35,39 +35,7 @@ private: Out out_fbshare_layer_index); Result ReleaseLastApplicationCaptureSharedBuffer(); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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 2b2f6f5da4..b28c96e549 100644 --- a/src/core/hle/service/am/service/global_state_controller.cpp +++ b/src/core/hle/service/am/service/global_state_controller.cpp @@ -7,6 +7,25 @@ namespace Service::AM { + ServiceFrameworkBase::FunctionInfoBase const* 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} { 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 02e07dafe9..4209a490f7 100644 --- a/src/core/hle/service/am/service/global_state_controller.h +++ b/src/core/hle/service/am/service/global_state_controller.h @@ -25,24 +25,7 @@ private: Result GetHdcpAuthenticationFailedEvent(OutCopyHandle out_event); Result OpenCradleFirmwareUpdater(Out> out_cradle_firmware_updater); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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 91916924fa..00f127314a 100644 --- a/src/core/hle/service/am/service/home_menu_functions.cpp +++ b/src/core/hle/service/am/service/home_menu_functions.cpp @@ -14,6 +14,27 @@ namespace Service::AM { +ServiceFrameworkBase::FunctionInfoBase const* 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}, 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 0db812f6d5..2062aa580b 100644 --- a/src/core/hle/service/am/service/home_menu_functions.h +++ b/src/core/hle/service/am/service/home_menu_functions.h @@ -34,26 +34,7 @@ private: Result IsForceTerminateApplicationDisabledForDebug( Out out_is_force_terminate_application_disabled_for_debug); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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 7904b7b943..852220902d 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,7 +45,34 @@ void ReplaceEmptyUuidWithCurrentUser(const std::shared_ptr } } -} // namespace + ServiceFrameworkBase::FunctionInfoBase const* 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"}, //10.0.0+ + FunctionInfo{80, nullptr, "RequestForLibraryAppletToGetForeground"}, //19.0.0+ + FunctionInfo{81, nullptr, "GetCurrentChildLibraryApplet"}, //19.0.0+ + FunctionInfo{90, D<&ILibraryAppletAccessor::Unknown90>, "Unknown90"}, //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"}, //2.0.0+ + FunctionInfo{170, D<&ILibraryAppletAccessor::Unknown170>, "Unknown170"} //22.0.0+ + ); + return HandlerTableGenerateWithFind(key, functions); + } ILibraryAppletAccessor::ILibraryAppletAccessor(Core::System& system_, std::shared_ptr broker, 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 933c522c70..9618a1e9d2 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,34 +68,7 @@ private: void FrontendExecuteInteractive(); void FrontendRequestExit(); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"}, //10.0.0+ - FunctionInfo{80, nullptr, "RequestForLibraryAppletToGetForeground"}, //19.0.0+ - FunctionInfo{81, nullptr, "GetCurrentChildLibraryApplet"}, //19.0.0+ - FunctionInfo{90, D<&ILibraryAppletAccessor::Unknown90>, "Unknown90"}, //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"}, //2.0.0+ - FunctionInfo{170, D<&ILibraryAppletAccessor::Unknown170>, "Unknown170"}, //22.0.0+ - ); + FunctionInfoBase const* 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 f9a317e09e..0000000000 --- a/src/core/hle/service/am/service/library_applet_creator.cpp +++ /dev/null @@ -1,277 +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)} { -} - -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 419fb80e4d..0000000000 --- a/src/core/hle/service/am/service/library_applet_creator.h +++ /dev/null @@ -1,56 +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); - - FunctionInfoBase const* 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; -}; - -} // 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 87da2e9304..0000000000 --- a/src/core/hle/service/am/service/library_applet_proxy.cpp +++ /dev/null @@ -1,116 +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)} { -} - -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 8edb593f92..0000000000 --- a/src/core/hle/service/am/service/library_applet_proxy.h +++ /dev/null @@ -1,73 +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); - - FunctionInfoBase const* 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; -}; - -} // 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 a3beb5ea70..0000000000 --- a/src/core/hle/service/am/service/library_applet_self_accessor.cpp +++ /dev/null @@ -1,291 +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} { -} - -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 2a4e4e800c..0000000000 --- a/src/core/hle/service/am/service/library_applet_self_accessor.h +++ /dev/null @@ -1,128 +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); - - FunctionInfoBase const* 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; -}; - -} // 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 314377e4b4..0000000000 --- a/src/core/hle/service/am/service/lock_accessor.cpp +++ /dev/null @@ -1,67 +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} { - 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 2cdec5af0b..0000000000 --- a/src/core/hle/service/am/service/lock_accessor.h +++ /dev/null @@ -1,41 +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: - FunctionInfoBase const* 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{}; -}; - -} // 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 c7e235e8f2..0000000000 --- a/src/core/hle/service/am/service/overlay_applet_proxy.cpp +++ /dev/null @@ -1,103 +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)} { - } - - 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 6966ae936b..0000000000 --- a/src/core/hle/service/am/service/overlay_applet_proxy.h +++ /dev/null @@ -1,71 +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); - - FunctionInfoBase const* 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; -}; - -} // 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 367b0cc218..5dcdaaab43 100644 --- a/src/core/hle/service/am/service/overlay_functions.cpp +++ b/src/core/hle/service/am/service/overlay_functions.cpp @@ -8,6 +8,32 @@ #include "core/hle/service/am/window_system.h" namespace Service::AM { + ServiceFrameworkBase::FunctionInfoBase const* 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)} { } diff --git a/src/core/hle/service/am/service/overlay_functions.h b/src/core/hle/service/am/service/overlay_functions.h index 1f0d682821..0ed608e0c7 100644 --- a/src/core/hle/service/am/service/overlay_functions.h +++ b/src/core/hle/service/am/service/overlay_functions.h @@ -24,31 +24,7 @@ private: Result Unknown70(); private: - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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 95cd20366e..33792b20bf 100644 --- a/src/core/hle/service/am/service/process_winding_controller.cpp +++ b/src/core/hle/service/am/service/process_winding_controller.cpp @@ -13,6 +13,20 @@ namespace Service::AM { + ServiceFrameworkBase::FunctionInfoBase const* 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)} { 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 f17008722f..27ab33407e 100644 --- a/src/core/hle/service/am/service/process_winding_controller.h +++ b/src/core/hle/service/am/service/process_winding_controller.h @@ -33,19 +33,7 @@ private: SharedPointer reserved_applet_accessor); Result ReserveToStartAndWait(SharedPointer reserved_applet_accessor); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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 d110ac4048..eee7a6034e 100644 --- a/src/core/hle/service/am/service/self_controller.cpp +++ b/src/core/hle/service/am/service/self_controller.cpp @@ -17,6 +17,62 @@ namespace Service::AM { + ServiceFrameworkBase::FunctionInfoBase const* 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{ diff --git a/src/core/hle/service/am/service/self_controller.h b/src/core/hle/service/am/service/self_controller.h index 567303390f..ddea4c5109 100644 --- a/src/core/hle/service/am/service/self_controller.h +++ b/src/core/hle/service/am/service/self_controller.h @@ -70,61 +70,7 @@ private: Result Unknown230(u32 in_val, Out out_val); Result Unknown240(u32 in_val); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* FindRequest(u32 key) override; Kernel::KProcess* const m_process; const std::shared_ptr m_applet; }; 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 37a0a225cb..0000000000 --- a/src/core/hle/service/am/service/system_applet_proxy.cpp +++ /dev/null @@ -1,115 +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)} { -} - -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 8ed82bfbfd..0000000000 --- a/src/core/hle/service/am/service/system_applet_proxy.h +++ /dev/null @@ -1,75 +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); - - FunctionInfoBase const* 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; -}; - -} // 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 3612428e1c..601415f530 100644 --- a/src/core/hle/service/am/service/window_controller.cpp +++ b/src/core/hle/service/am/service/window_controller.cpp @@ -9,6 +9,20 @@ namespace Service::AM { +ServiceFrameworkBase::FunctionInfoBase const* 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"}, diff --git a/src/core/hle/service/am/service/window_controller.h b/src/core/hle/service/am/service/window_controller.h index 8d4d045ece..d8683eb1a2 100644 --- a/src/core/hle/service/am/service/window_controller.h +++ b/src/core/hle/service/am/service/window_controller.h @@ -26,19 +26,7 @@ private: Result SetAppletWindowVisibility(bool visible); Result SetAppletGpuTimeSlice(s64 time_slice); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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 a1c64f4bcb..434c758dfc 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 { +ServiceFrameworkBase::FunctionInfoBase const* 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; } diff --git a/src/core/hle/service/aoc/addon_content_manager.h b/src/core/hle/service/aoc/addon_content_manager.h index fce0787977..0ec2d0fec6 100644 --- a/src/core/hle/service/aoc/addon_content_manager.h +++ b/src/core/hle/service/aoc/addon_content_manager.h @@ -40,33 +40,7 @@ public: OutInterface out_interface); private: - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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 2a75767f2b..0eb7592f19 100644 --- a/src/core/hle/service/aoc/purchase_event_manager.cpp +++ b/src/core/hle/service/aoc/purchase_event_manager.cpp @@ -11,21 +11,20 @@ namespace Service::AOC { constexpr Result ResultNoPurchasedProductInfoAvailable{ErrorModule::NIMShop, 400}; -IPurchaseEventManager::IPurchaseEventManager(Core::System& system_) - : ServiceFramework{system_, "IPurchaseEventManager"}, service_context{system, - "IPurchaseEventManager"} { - // clang-format off - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } +ServiceFrameworkBase::FunctionInfoBase const* 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"} - ); + 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"} { 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..081b4b6fbd 100644 --- a/src/core/hle/service/aoc/purchase_event_manager.h +++ b/src/core/hle/service/aoc/purchase_event_manager.h @@ -22,6 +22,8 @@ public: Result PopPurchasedProductInfo(); Result PopPurchasedProductInfoWithUid(); + FunctionInfoBase const* FindRequest(u32 key) override; + private: KernelHelpers::ServiceContext service_context; Kernel::KEvent* purchased_event; diff --git a/src/core/hle/service/audio/audio_in.cpp b/src/core/hle/service/audio/audio_in.cpp index 9132c0ca32..24eab7b058 100644 --- a/src/core/hle/service/audio/audio_in.cpp +++ b/src/core/hle/service/audio/audio_in.cpp @@ -11,6 +11,27 @@ namespace Service::Audio { using namespace AudioCore::AudioIn; +ServiceFrameworkBase::FunctionInfoBase const* 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) diff --git a/src/core/hle/service/audio/audio_in.h b/src/core/hle/service/audio/audio_in.h index 5e216fb1b1..97ee4b5a0f 100644 --- a/src/core/hle/service/audio/audio_in.h +++ b/src/core/hle/service/audio/audio_in.h @@ -43,26 +43,7 @@ public: Result FlushAudioInBuffers(Out out_flushed); private: - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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 07e4731ade..5981df50b0 100644 --- a/src/core/hle/service/audio/audio_in_manager.cpp +++ b/src/core/hle/service/audio/audio_in_manager.cpp @@ -9,6 +9,18 @@ namespace Service::Audio { using namespace AudioCore::AudioIn; +ServiceFrameworkBase::FunctionInfoBase const* 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_)} diff --git a/src/core/hle/service/audio/audio_in_manager.h b/src/core/hle/service/audio/audio_in_manager.h index 492194d764..70cd72db52 100644 --- a/src/core/hle/service/audio/audio_in_manager.h +++ b/src/core/hle/service/audio/audio_in_manager.h @@ -51,17 +51,7 @@ private: AudioCore::AudioIn::AudioInParameter parameter, InCopyHandle process_handle, ClientAppletResourceUserId aruid); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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 23e52ba24d..b6f6bcaf00 100644 --- a/src/core/hle/service/audio/audio_out.cpp +++ b/src/core/hle/service/audio/audio_out.cpp @@ -15,17 +15,7 @@ namespace Service::Audio { using namespace AudioCore::AudioOut; -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) - : ServiceFramework{system_, "IAudioOut"}, service_context{system_, "IAudioOut"}, - event{service_context.CreateEvent("AudioOutEvent")}, process{handle}, - impl{std::make_shared(system_, manager, event, session_id)} { - - // clang-format off - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } +ServiceFrameworkBase::FunctionInfoBase const* IAudioOut::FindRequest(u32 key) { static constexpr auto functions = CreateStaticMap( FunctionInfo{0, D<&IAudioOut::GetAudioOutState>, "GetAudioOutState"}, FunctionInfo{1, D<&IAudioOut::Start>, "Start"}, @@ -42,6 +32,15 @@ IAudioOut::IAudioOut(Core::System& system_, Manager& manager, size_t session_id, 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) + : ServiceFramework{system_, "IAudioOut"}, service_context{system_, "IAudioOut"}, + event{service_context.CreateEvent("AudioOutEvent")}, process{handle}, + impl{std::make_shared(system_, manager, event, session_id)} { 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..bac1672a75 100644 --- a/src/core/hle/service/audio/audio_out.h +++ b/src/core/hle/service/audio/audio_out.h @@ -49,6 +49,8 @@ public: Result GetAudioOutVolume(Out out_volume); private: + FunctionInfoBase const* 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 73006b5dee..a34c1410e2 100644 --- a/src/core/hle/service/audio/audio_out_manager.cpp +++ b/src/core/hle/service/audio/audio_out_manager.cpp @@ -13,6 +13,16 @@ namespace Service::Audio { using namespace AudioCore::AudioOut; +ServiceFrameworkBase::FunctionInfoBase const* 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_) diff --git a/src/core/hle/service/audio/audio_out_manager.h b/src/core/hle/service/audio/audio_out_manager.h index 781d2bb33f..7e48360ed0 100644 --- a/src/core/hle/service/audio/audio_out_manager.h +++ b/src/core/hle/service/audio/audio_out_manager.h @@ -43,15 +43,7 @@ private: AudioCore::AudioOut::AudioOutParameter parameter, InCopyHandle process_handle, ClientAppletResourceUserId aruid); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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 48b26c83a4..141f9d6472 100644 --- a/src/core/hle/service/audio/audio_renderer.cpp +++ b/src/core/hle/service/audio/audio_renderer.cpp @@ -10,6 +10,26 @@ namespace Service::Audio { using namespace AudioCore::Renderer; +ServiceFrameworkBase::FunctionInfoBase const* 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"}, //3.0.0+ + FunctionInfo{11, nullptr, "ExecuteAudioRendererRendering"}, //3.0.0+ + FunctionInfo{12, D<&IAudioRenderer::SetVoiceDropParameter>, "SetVoiceDropParameter"}, //15.0.0+ + FunctionInfo{13, D<&IAudioRenderer::GetVoiceDropParameter>, "GetVoiceDropParameter"} //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, diff --git a/src/core/hle/service/audio/audio_renderer.h b/src/core/hle/service/audio/audio_renderer.h index e88173804b..4031558d77 100644 --- a/src/core/hle/service/audio/audio_renderer.h +++ b/src/core/hle/service/audio/audio_renderer.h @@ -42,25 +42,7 @@ private: Result SetVoiceDropParameter(f32 voice_drop_parameter); Result GetVoiceDropParameter(Out out_voice_drop_parameter); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"}, //3.0.0+ - FunctionInfo{11, nullptr, "ExecuteAudioRendererRendering"}, //3.0.0+ - FunctionInfo{12, D<&IAudioRenderer::SetVoiceDropParameter>, "SetVoiceDropParameter"}, //15.0.0+ - FunctionInfo{13, D<&IAudioRenderer::GetVoiceDropParameter>, "GetVoiceDropParameter"}, //15.0.0+ - ); + FunctionInfoBase const* 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 c5e15d69fe..cb35da1bf2 100644 --- a/src/core/hle/service/audio/audio_renderer_manager.cpp +++ b/src/core/hle/service/audio/audio_renderer_manager.cpp @@ -18,6 +18,17 @@ namespace Service::Audio { using namespace AudioCore::Renderer; +ServiceFrameworkBase::FunctionInfoBase const* 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_) diff --git a/src/core/hle/service/audio/audio_renderer_manager.h b/src/core/hle/service/audio/audio_renderer_manager.h index 213affa783..f327403d84 100644 --- a/src/core/hle/service/audio/audio_renderer_manager.h +++ b/src/core/hle/service/audio/audio_renderer_manager.h @@ -33,16 +33,7 @@ private: Result GetAudioDeviceServiceWithRevisionInfo(Out> out_audio_device, u32 revision, ClientAppletResourceUserId aruid); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* FindRequest(u32 key) override; std::optional impl; u32 num_audio_devices{0}; }; diff --git a/src/core/hle/service/audio/hardware_opus_decoder.cpp b/src/core/hle/service/audio/hardware_opus_decoder.cpp index 9e435dad9c..034ab9cfc0 100644 --- a/src/core/hle/service/audio/hardware_opus_decoder.cpp +++ b/src/core/hle/service/audio/hardware_opus_decoder.cpp @@ -8,6 +8,22 @@ namespace Service::Audio { using namespace AudioCore::OpusDecoder; + ServiceFrameworkBase::FunctionInfoBase const* 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)} { diff --git a/src/core/hle/service/audio/hardware_opus_decoder.h b/src/core/hle/service/audio/hardware_opus_decoder.h index fce35613a8..73670ececa 100644 --- a/src/core/hle/service/audio/hardware_opus_decoder.h +++ b/src/core/hle/service/audio/hardware_opus_decoder.h @@ -55,22 +55,8 @@ private: Out out_data_size, Out out_sample_count, Out out_time_taken, InBuffer opus_data, bool reset); + FunctionInfoBase const* FindRequest(u32 key) override; - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); 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 c4a115f873..4a9af72ebe 100644 --- a/src/core/hle/service/audio/hardware_opus_decoder_manager.cpp +++ b/src/core/hle/service/audio/hardware_opus_decoder_manager.cpp @@ -9,6 +9,22 @@ namespace Service::Audio { using namespace AudioCore::OpusDecoder; +ServiceFrameworkBase::FunctionInfoBase const* 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} { } 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 b842455d64..acf5551bac 100644 --- a/src/core/hle/service/audio/hardware_opus_decoder_manager.h +++ b/src/core/hle/service/audio/hardware_opus_decoder_manager.h @@ -46,21 +46,7 @@ private: Result GetWorkBufferSizeForMultiStreamExEx( Out out_size, InLargeData params); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* FindRequest(u32 key) override; Core::System& system; AudioCore::OpusDecoder::OpusDecoderManager impl; }; 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 7e1e5ec7b0..7e855661d9 100644 --- a/src/core/hle/service/bcat/delivery_cache_directory_service.cpp +++ b/src/core/hle/service/bcat/delivery_cache_directory_service.cpp @@ -27,6 +27,15 @@ static BcatDigest DigestFile(const FileSys::VirtualFile& file) { return out; } +ServiceFrameworkBase::FunctionInfoBase const* 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_)) { 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 8abc88eb86..f0108d38f5 100644 --- a/src/core/hle/service/bcat/delivery_cache_directory_service.h +++ b/src/core/hle/service/bcat/delivery_cache_directory_service.h @@ -26,14 +26,7 @@ private: OutArray out_buffer); Result GetCount(Out out_count); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IDeliveryCacheDirectoryService::Open>, "Open"}, - FunctionInfo{1, D<&IDeliveryCacheDirectoryService::Read>, "Read"}, - FunctionInfo{2, D<&IDeliveryCacheDirectoryService::GetCount>, "GetCount"} - ); + FunctionInfoBase const* 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 bc67117054..817a2c75ab 100644 --- a/src/core/hle/service/bcat/delivery_cache_file_service.cpp +++ b/src/core/hle/service/bcat/delivery_cache_file_service.cpp @@ -9,6 +9,16 @@ namespace Service::BCAT { +ServiceFrameworkBase::FunctionInfoBase const* 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_)) { 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 2eb6f116fe..88c345cfec 100644 --- a/src/core/hle/service/bcat/delivery_cache_file_service.h +++ b/src/core/hle/service/bcat/delivery_cache_file_service.h @@ -26,15 +26,7 @@ private: Result GetSize(Out out_size); Result GetDigest(Out out_digest); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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 303df839d5..1ac9d89305 100644 --- a/src/core/hle/service/bcat/delivery_cache_progress_service.cpp +++ b/src/core/hle/service/bcat/delivery_cache_progress_service.cpp @@ -7,6 +7,14 @@ namespace Service::BCAT { +ServiceFrameworkBase::FunctionInfoBase const* 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_) 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 ec6aa16abd..3d4ae8bb57 100644 --- a/src/core/hle/service/bcat/delivery_cache_progress_service.h +++ b/src/core/hle/service/bcat/delivery_cache_progress_service.h @@ -28,13 +28,7 @@ private: Result GetEvent(OutCopyHandle out_event); Result GetImpl(OutLargeData out_impl); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IDeliveryCacheProgressService::GetEvent>, "Get"}, - FunctionInfo{1, D<&IDeliveryCacheProgressService::GetImpl>, "Get"} - ); + FunctionInfoBase const* 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 7f2ee73cc5..b2652895eb 100644 --- a/src/core/hle/service/bcat/delivery_cache_storage_service.cpp +++ b/src/core/hle/service/bcat/delivery_cache_storage_service.cpp @@ -12,6 +12,15 @@ namespace Service::BCAT { +ServiceFrameworkBase::FunctionInfoBase const* 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_)) { 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 d2ef3882fe..1f9de50105 100644 --- a/src/core/hle/service/bcat/delivery_cache_storage_service.h +++ b/src/core/hle/service/bcat/delivery_cache_storage_service.h @@ -28,14 +28,7 @@ private: Out out_directory_count, OutArray out_directories); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IDeliveryCacheStorageService::CreateFileService>, "CreateFileService"}, - FunctionInfo{1, D<&IDeliveryCacheStorageService::CreateDirectoryService>, "CreateDirectoryService"}, - FunctionInfo{10, D<&IDeliveryCacheStorageService::EnumerateDeliveryCacheDirectory>, "EnumerateDeliveryCacheDirectory"} - ); + FunctionInfoBase const* 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 79f080df93..ee806268c2 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 @@ -6,6 +6,13 @@ namespace Service::News { +ServiceFrameworkBase::FunctionInfoBase const* 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"} { 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 91dca6511a..b9184817e3 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 @@ -26,12 +26,7 @@ public: private: Result Get(OutCopyHandle out_event); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&INewlyArrivedEventHolder::Get>, "Get"} - ); + FunctionInfoBase const* 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 eee8c0ed7a..db14bba80c 100644 --- a/src/core/hle/service/bcat/news/news_data_service.cpp +++ b/src/core/hle/service/bcat/news/news_data_service.cpp @@ -24,6 +24,17 @@ std::string_view ToStringView(std::span buf) { } // namespace +ServiceFrameworkBase::FunctionInfoBase const* 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"} { } 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 0146e43ff1..2c48d0e4d3 100644 --- a/src/core/hle/service/bcat/news/news_data_service.h +++ b/src/core/hle/service/bcat/news/news_data_service.h @@ -31,16 +31,7 @@ private: Result Read(Out out_size, s64 offset, OutBuffer out_buffer); Result GetSize(Out out_size); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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 27201f251b..0591d920fe 100644 --- a/src/core/hle/service/bcat/news/news_database_service.cpp +++ b/src/core/hle/service/bcat/news/news_database_service.cpp @@ -45,6 +45,19 @@ bool UpdateField(NewsRecord& rec, std::string_view column, s32 value, bool addit } // namespace +ServiceFrameworkBase::FunctionInfoBase const* 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"} { } 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 33308e9b97..ac82e7a658 100644 --- a/src/core/hle/service/bcat/news/news_database_service.h +++ b/src/core/hle/service/bcat/news/news_database_service.h @@ -50,18 +50,7 @@ private: InBuffer order_by_phrase, s32 offset); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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 b761f34826..714f48dae1 100644 --- a/src/core/hle/service/bcat/news/overwrite_event_holder.cpp +++ b/src/core/hle/service/bcat/news/overwrite_event_holder.cpp @@ -6,6 +6,13 @@ namespace Service::News { +ServiceFrameworkBase::FunctionInfoBase const* 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"} { 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 7eedb276f1..37c762d3c9 100644 --- a/src/core/hle/service/bcat/news/overwrite_event_holder.h +++ b/src/core/hle/service/bcat/news/overwrite_event_holder.h @@ -26,12 +26,7 @@ public: private: Result Get(OutCopyHandle out_event); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IOverwriteEventHolder::Get>, "Get"} - ); + FunctionInfoBase const* 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 4c664f1c9e..9dcf338b86 100644 --- a/src/core/hle/service/bcat/news/service_creator.cpp +++ b/src/core/hle/service/bcat/news/service_creator.cpp @@ -11,6 +11,17 @@ namespace Service::News { +ServiceFrameworkBase::FunctionInfoBase const* 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_} { } diff --git a/src/core/hle/service/bcat/news/service_creator.h b/src/core/hle/service/bcat/news/service_creator.h index 883018ee95..0549a371e7 100644 --- a/src/core/hle/service/bcat/news/service_creator.h +++ b/src/core/hle/service/bcat/news/service_creator.h @@ -29,16 +29,7 @@ private: Result CreateNewsDatabaseService(OutInterface out_interface); Result CreateOverwriteEventHolder(OutInterface out_interface); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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 450f9046be..dd47dc6d11 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 { +ServiceFrameworkBase::FunctionInfoBase const* 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)); diff --git a/src/core/hle/service/bcat/service_creator.h b/src/core/hle/service/bcat/service_creator.h index 015d839046..35335bb3a7 100644 --- a/src/core/hle/service/bcat/service_creator.h +++ b/src/core/hle/service/bcat/service_creator.h @@ -33,16 +33,7 @@ private: Result CreateDeliveryCacheStorageServiceWithApplicationId( u64 application_id, OutInterface out_interface); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* FindRequest(u32 key) override; std::unique_ptr backend; Service::FileSystem::FileSystemController& fsc; }; diff --git a/src/core/hle/service/btm/btm.cpp b/src/core/hle/service/btm/btm.cpp index c643ab4b63..0bc6d8a3fa 100644 --- a/src/core/hle/service/btm/btm.cpp +++ b/src/core/hle/service/btm/btm.cpp @@ -6,15 +6,319 @@ #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(); + } + + FunctionInfoBase const* 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(); + } + + FunctionInfoBase const* 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(); + } + + FunctionInfoBase const* 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(); + } + + FunctionInfoBase const* 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; + FunctionInfoBase const* 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"}, //5.0.0+ + FunctionInfo{10, nullptr, "GetGattClientDisconnectionReason"}, //5.0.0+ + FunctionInfo{11, nullptr, "GetBleConnectionParameter"}, //5.1.0+ + FunctionInfo{12, nullptr, "GetBleConnectionParameterRequest"}, //5.1.0+ + FunctionInfo{13, nullptr, "GetDiscoveredDevice"}, //12.0.0+ + FunctionInfo{14, nullptr, "SleepAwakeLoopTest"}, //15.0.0+ + FunctionInfo{15, nullptr, "SleepTest"}, //15.0.0+ + FunctionInfo{16, nullptr, "MinimumAwakeTest"}, //15.0.0+ + FunctionInfo{17, nullptr, "ForceEnableBtm"} //15.0.0+ + ); +}; + class IBtm final : public ServiceFramework { public: explicit IBtm(Core::System& system_) : ServiceFramework{system_, "btm"} {} 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 30a8ed8aa8..0000000000 --- a/src/core/hle/service/btm/btm_debug.cpp +++ /dev/null @@ -1,16 +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"} { -} - -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 769e700aac..0000000000 --- a/src/core/hle/service/btm/btm_debug.h +++ /dev/null @@ -1,45 +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; - - FunctionInfoBase const* 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"}, //5.0.0+ - FunctionInfo{10, nullptr, "GetGattClientDisconnectionReason"}, //5.0.0+ - FunctionInfo{11, nullptr, "GetBleConnectionParameter"}, //5.1.0+ - FunctionInfo{12, nullptr, "GetBleConnectionParameterRequest"}, //5.1.0+ - FunctionInfo{13, nullptr, "GetDiscoveredDevice"}, //12.0.0+ - FunctionInfo{14, nullptr, "SleepAwakeLoopTest"}, //15.0.0+ - FunctionInfo{15, nullptr, "SleepTest"}, //15.0.0+ - FunctionInfo{16, nullptr, "MinimumAwakeTest"}, //15.0.0+ - FunctionInfo{17, nullptr, "ForceEnableBtm"}, //15.0.0+ - ); -}; - -} // 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 b4905354ec..0000000000 --- a/src/core/hle/service/btm/btm_system.cpp +++ /dev/null @@ -1,27 +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"} { -} - -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 ae4d0106b9..0000000000 --- a/src/core/hle/service/btm/btm_system.h +++ /dev/null @@ -1,32 +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); - - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&IBtmSystem::GetCore>, "GetCore"} - ); -}; - -} // 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 57dc805d7b..0000000000 --- a/src/core/hle/service/btm/btm_system_core.cpp +++ /dev/null @@ -1,102 +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"} { - 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 8dd533eb95..0000000000 --- a/src/core/hle/service/btm/btm_system_core.h +++ /dev/null @@ -1,90 +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); - - FunctionInfoBase const* 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; -}; - -} // 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 f3e18e8ae0..0000000000 --- a/src/core/hle/service/btm/btm_user.cpp +++ /dev/null @@ -1,26 +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"} { -} - -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 bdfe63471e..0000000000 --- a/src/core/hle/service/btm/btm_user.h +++ /dev/null @@ -1,32 +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); - - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&IBtmUser::GetCore>, "GetCore"} - ); -}; - -} // 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 76d68cf1d1..0000000000 --- a/src/core/hle/service/btm/btm_user_core.cpp +++ /dev/null @@ -1,68 +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"} { - 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 693225ac3c..0000000000 --- a/src/core/hle/service/btm/btm_user_core.h +++ /dev/null @@ -1,76 +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); - - FunctionInfoBase const* 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; -}; - -} // namespace Service::BTM diff --git a/src/core/hle/service/caps/caps_a.cpp b/src/core/hle/service/caps/caps_a.cpp index 00de6ad25c..dfada135ef 100644 --- a/src/core/hle/service/caps/caps_a.cpp +++ b/src/core/hle/service/caps/caps_a.cpp @@ -13,6 +13,52 @@ namespace Service::Capture { +ServiceFrameworkBase::FunctionInfoBase const* IAlbumAccessorService::FindRequest(u32 key) { + 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"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IAlbumAccessorService::IAlbumAccessorService(Core::System& system_, std::shared_ptr album_manager) : ServiceFramework{system_, "caps:a"}, manager{album_manager} { diff --git a/src/core/hle/service/caps/caps_a.h b/src/core/hle/service/caps/caps_a.h index 5f671c7cb1..7202aa25cd 100644 --- a/src/core/hle/service/caps/caps_a.h +++ b/src/core/hle/service/caps/caps_a.h @@ -57,51 +57,7 @@ private: Result GetAlbumAccessResultForDebug(Out out_result); - FunctionInfoBase const* 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"} - ); + FunctionInfoBase const* FindRequest(u32 key) override; std::shared_ptr manager = nullptr; }; diff --git a/src/core/hle/service/caps/caps_c.cpp b/src/core/hle/service/caps/caps_c.cpp index b978e80db2..f3ef1dff0b 100644 --- a/src/core/hle/service/caps/caps_c.cpp +++ b/src/core/hle/service/caps/caps_c.cpp @@ -14,6 +14,31 @@ namespace Service::Capture { +ServiceFrameworkBase::FunctionInfoBase const* 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} { diff --git a/src/core/hle/service/caps/caps_c.h b/src/core/hle/service/caps/caps_c.h index 245b61a29f..a739cd9757 100644 --- a/src/core/hle/service/caps/caps_c.h +++ b/src/core/hle/service/caps/caps_c.h @@ -16,38 +16,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); - - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + Result SetShimLibraryVersion(ShimLibraryVersion library_version, ClientAppletResourceUserId aruid); + FunctionInfoBase const* FindRequest(u32 key) override; std::shared_ptr manager = nullptr; }; diff --git a/src/core/hle/service/caps/caps_ss.cpp b/src/core/hle/service/caps/caps_ss.cpp index a68e7fc1e6..a422df2022 100644 --- a/src/core/hle/service/caps/caps_ss.cpp +++ b/src/core/hle/service/caps/caps_ss.cpp @@ -12,6 +12,19 @@ namespace Service::Capture { +ServiceFrameworkBase::FunctionInfoBase const* 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} { diff --git a/src/core/hle/service/caps/caps_ss.h b/src/core/hle/service/caps/caps_ss.h index 0ad8db3100..613fa90e31 100644 --- a/src/core/hle/service/caps/caps_ss.h +++ b/src/core/hle/service/caps/caps_ss.h @@ -34,18 +34,7 @@ private: const InBuffer thumbnail_image_data_buffer); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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 aa39beb117..6ad54b341f 100644 --- a/src/core/hle/service/caps/caps_su.cpp +++ b/src/core/hle/service/caps/caps_su.cpp @@ -15,6 +15,17 @@ namespace Service::Capture { +ServiceFrameworkBase::FunctionInfoBase const* 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} { diff --git a/src/core/hle/service/caps/caps_su.h b/src/core/hle/service/caps/caps_su.h index 2565789f90..cf2547547b 100644 --- a/src/core/hle/service/caps/caps_su.h +++ b/src/core/hle/service/caps/caps_su.h @@ -42,16 +42,7 @@ private: const InBuffer image_data_buffer); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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 5b07c82224..5ed39fc3e9 100644 --- a/src/core/hle/service/caps/caps_u.cpp +++ b/src/core/hle/service/caps/caps_u.cpp @@ -13,6 +13,26 @@ namespace Service::Capture { +ServiceFrameworkBase::FunctionInfoBase const* 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} { diff --git a/src/core/hle/service/caps/caps_u.h b/src/core/hle/service/caps/caps_u.h index 25dc13d218..236d036136 100644 --- a/src/core/hle/service/caps/caps_u.h +++ b/src/core/hle/service/caps/caps_u.h @@ -33,25 +33,7 @@ private: AlbumFileDateTime end_date_time, ClientAppletResourceUserId aruid, OutArray out_entries); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* FindRequest(u32 key) override; std::shared_ptr manager = nullptr; }; 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 7f8a4375ef..dd01595dcf 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_directory.cpp +++ b/src/core/hle/service/filesystem/fsp/fs_i_directory.cpp @@ -8,6 +8,14 @@ namespace Service::FileSystem { +ServiceFrameworkBase::FunctionInfoBase const* 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"}, 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 96673e9ded..ac739a284f 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_directory.h +++ b/src/core/hle/service/filesystem/fsp/fs_i_directory.h @@ -27,13 +27,7 @@ private: const OutArray out_entries); Result GetEntryCount(Out out_count); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IDirectory::Read>, "Read"}, - FunctionInfo{1, D<&IDirectory::GetEntryCount>, "GetEntryCount"} - ); + FunctionInfoBase const* FindRequest(u32 key) override; }; } // 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 16eb817be7..f7a4bce8d9 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_filesystem.cpp +++ b/src/core/hle/service/filesystem/fsp/fs_i_filesystem.cpp @@ -13,6 +13,29 @@ namespace Service::FileSystem { +ServiceFrameworkBase::FunctionInfoBase const* 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_)}, 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 652877b5c9..e14cd953c0 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_filesystem.h +++ b/src/core/hle/service/filesystem/fsp/fs_i_filesystem.h @@ -58,28 +58,7 @@ public: Result GetFileSystemAttribute(Out out_attribute); private: - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* FindRequest(u32 key) override; std::unique_ptr backend; SizeGetter size_getter; }; diff --git a/src/core/hle/service/glue/notif.cpp b/src/core/hle/service/glue/notif.cpp index 43e72eb882..f582b7b8cc 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; +} +ServiceFrameworkBase::FunctionInfoBase const* 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); +} + +ServiceFrameworkBase::FunctionInfoBase const* 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, diff --git a/src/core/hle/service/glue/notif.h b/src/core/hle/service/glue/notif.h index 8be6671cab..769ca4decb 100644 --- a/src/core/hle/service/glue/notif.h +++ b/src/core/hle/service/glue/notif.h @@ -98,17 +98,7 @@ private: Result DeleteAlarmSetting(AlarmSettingId alarm_setting_id); Result Initialize(ClientAppletResourceUserId aruid); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* FindRequest(u32 key) override; NotificationServiceImpl impl; }; @@ -138,31 +128,7 @@ private: Out out_notification_presentation_setting, NotificationChannel notification_channel); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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 a471343a1e..a8bd1f271c 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 { +ServiceFrameworkBase::FunctionInfoBase const* 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 - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); 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 && @@ -109,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..dcbd607fda 100644 --- a/src/core/hle/service/glue/time/static.h +++ b/src/core/hle/service/glue/time/static.h @@ -69,12 +69,11 @@ public: Result CalculateSpanBetween(Out out_time, InClockSnapshot a, InClockSnapshot b); private: - Core::System& m_system; + FunctionInfoBase const* 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 c0dbc00588..403c9f51d9 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 { +ServiceFrameworkBase::FunctionInfoBase const* 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, diff --git a/src/core/hle/service/glue/time/time_zone.h b/src/core/hle/service/glue/time/time_zone.h index 4f46c48cbb..604c590d30 100644 --- a/src/core/hle/service/glue/time/time_zone.h +++ b/src/core/hle/service/glue/time/time_zone.h @@ -80,25 +80,7 @@ public: const Service::PSC::Time::CalendarTime& calendar_time); private: - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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/hid/active_vibration_device_list.cpp b/src/core/hle/service/hid/active_vibration_device_list.cpp index 2e0b6ba555..9a4c8aef14 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 { +ServiceFrameworkBase::FunctionInfoBase const* 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 - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&IActiveVibrationDeviceList::ActivateVibrationDevice>, "ActivateVibrationDevice"} - ); } 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..3fd6b9e768 100644 --- a/src/core/hle/service/hid/active_vibration_device_list.h +++ b/src/core/hle/service/hid/active_vibration_device_list.h @@ -26,8 +26,8 @@ public: private: static constexpr std::size_t MaxVibrationDevicesHandles{0x100}; - Result ActivateVibrationDevice(Core::HID::VibrationDeviceHandle vibration_device_handle); + FunctionInfoBase const* 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 148049c10f..0192ea9085 100644 --- a/src/core/hle/service/hid/applet_resource.cpp +++ b/src/core/hle/service/hid/applet_resource.cpp @@ -12,6 +12,13 @@ namespace Service::HID { +ServiceFrameworkBase::FunctionInfoBase const* 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}, diff --git a/src/core/hle/service/hid/applet_resource.h b/src/core/hle/service/hid/applet_resource.h index f80f7b43dc..df8c7d71a5 100644 --- a/src/core/hle/service/hid/applet_resource.h +++ b/src/core/hle/service/hid/applet_resource.h @@ -29,12 +29,7 @@ public: private: Result GetSharedMemoryHandle(OutCopyHandle out_shared_memory_handle); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&IAppletResource::GetSharedMemoryHandle>, "GetSharedMemoryHandle"} - ); + FunctionInfoBase const* FindRequest(u32 key) override; u64 aruid{}; std::shared_ptr resource_manager; }; diff --git a/src/core/hle/service/hid/hidbus.cpp b/src/core/hle/service/hid/hidbus.cpp index a06bb15423..8042e7949d 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}; +ServiceFrameworkBase::FunctionInfoBase const* 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 - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); - // 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..56fed118be 100644 --- a/src/core/hle/service/hid/hidbus.h +++ b/src/core/hle/service/hid/hidbus.h @@ -144,6 +144,8 @@ private: } } + FunctionInfoBase const* FindRequest(u32 key) override; + bool is_hidbus_enabled{false}; HidbusStatusManager hidbus_status{}; std::array devices{}; diff --git a/src/core/hle/service/ldn/monitor_service.cpp b/src/core/hle/service/ldn/monitor_service.cpp index 797a84006f..246bd5de94 100644 --- a/src/core/hle/service/ldn/monitor_service.cpp +++ b/src/core/hle/service/ldn/monitor_service.cpp @@ -7,6 +7,20 @@ namespace Service::LDN { +ServiceFrameworkBase::FunctionInfoBase const* 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"} { } diff --git a/src/core/hle/service/ldn/monitor_service.h b/src/core/hle/service/ldn/monitor_service.h index 431c665d46..591fcc0724 100644 --- a/src/core/hle/service/ldn/monitor_service.h +++ b/src/core/hle/service/ldn/monitor_service.h @@ -23,19 +23,7 @@ private: Result InitializeMonitor(); Result FinalizeMonitor(); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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 7d929911d0..d31bc7fd9c 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 { +ServiceFrameworkBase::FunctionInfoBase const* 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 - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&ISfMonitorService::Initialize>, "Initialize"}, - FunctionInfo{288, C<&ISfMonitorService::GetGroupInfo>, "GetGroupInfo"}, - FunctionInfo{320, nullptr, "GetLinkLevel"} - ); } 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..297f1be063 100644 --- a/src/core/hle/service/ldn/sf_monitor_service.h +++ b/src/core/hle/service/ldn/sf_monitor_service.h @@ -21,6 +21,7 @@ public: private: Result Initialize(Out out_value); Result GetGroupInfo(OutLargeData out_group_info); + FunctionInfoBase const* FindRequest(u32 key) 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 4db73ff733..e28bf22aad 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 { +ServiceFrameworkBase::FunctionInfoBase const* 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 - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); } 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..eefeff27c3 100644 --- a/src/core/hle/service/ldn/sf_service_monitor.h +++ b/src/core/hle/service/ldn/sf_service_monitor.h @@ -20,8 +20,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); + FunctionInfoBase const* 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 18d5ee6826..7f262afd13 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 { +ServiceFrameworkBase::FunctionInfoBase const* 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 - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); } 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..7aecccefc2 100644 --- a/src/core/hle/service/ldn/system_local_communication_service.h +++ b/src/core/hle/service/ldn/system_local_communication_service.h @@ -20,6 +20,7 @@ public: private: Result InitializeSystem2(); + FunctionInfoBase const* 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 81048260a2..1596d58a6b 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 { +ServiceFrameworkBase::FunctionInfoBase const* 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 - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); 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..caa8fcb664 100644 --- a/src/core/hle/service/ldn/user_local_communication_service.h +++ b/src/core/hle/service/ldn/user_local_communication_service.h @@ -89,6 +89,7 @@ private: /// Callback to parse and handle a received LDN packet. void OnLDNPacketReceived(const Network::LDNPacket& packet); void OnEventFired(); + FunctionInfoBase const* FindRequest(u32 key) override; KernelHelpers::ServiceContext service_context; Kernel::KEvent* state_change_event; diff --git a/src/core/hle/service/mii/mii.cpp b/src/core/hle/service/mii/mii.cpp index 21cc9862b8..8977dccabe 100644 --- a/src/core/hle/service/mii/mii.cpp +++ b/src/core/hle/service/mii/mii.cpp @@ -22,6 +22,13 @@ namespace Service::Mii { +ServiceFrameworkBase::FunctionInfoBase const* 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_) diff --git a/src/core/hle/service/mii/mii.h b/src/core/hle/service/mii/mii.h index 4c7e9415e3..91cdc26430 100644 --- a/src/core/hle/service/mii/mii.h +++ b/src/core/hle/service/mii/mii.h @@ -24,12 +24,7 @@ public: private: Result GetDatabaseService(Out> out_database_service); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IStaticService::GetDatabaseService>, "GetDatabaseService"} - ); + FunctionInfoBase const* FindRequest(u32 key) override; std::shared_ptr manager{nullptr}; bool is_system{}; }; diff --git a/src/core/hle/service/nfc/nfc.cpp b/src/core/hle/service/nfc/nfc.cpp index be34e143ae..74885cfa1d 100644 --- a/src/core/hle/service/nfc/nfc.cpp +++ b/src/core/hle/service/nfc/nfc.cpp @@ -20,28 +20,28 @@ class IUser final : public NfcInterface { public: explicit IUser(Core::System& system_) : NfcInterface(system_, "NFC::IUser", BackendType::Nfc) { static const FunctionInfoTyped functions[] = { - FunctionInfo{0, &NfcInterface::Initialize, "InitializeOld"}, - FunctionInfo{1, &NfcInterface::Finalize, "FinalizeOld"}, - FunctionInfo{2, &NfcInterface::GetState, "GetStateOld"}, - FunctionInfo{3, &NfcInterface::IsNfcEnabled, "IsNfcEnabledOld"}, - FunctionInfo{400, &NfcInterface::Initialize, "Initialize"}, - FunctionInfo{401, &NfcInterface::Finalize, "Finalize"}, - FunctionInfo{402, &NfcInterface::GetState, "GetState"}, - FunctionInfo{403, &NfcInterface::IsNfcEnabled, "IsNfcEnabled"}, - FunctionInfo{404, &NfcInterface::ListDevices, "ListDevices"}, - FunctionInfo{405, &NfcInterface::GetDeviceState, "GetDeviceState"}, - FunctionInfo{406, &NfcInterface::GetNpadId, "GetNpadId"}, - FunctionInfo{407, &NfcInterface::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, - FunctionInfo{408, &NfcInterface::StartDetection, "StartDetection"}, - FunctionInfo{409, &NfcInterface::StopDetection, "StopDetection"}, - FunctionInfo{410, &NfcInterface::GetTagInfo, "GetTagInfo"}, - FunctionInfo{411, &NfcInterface::AttachActivateEvent, "AttachActivateEvent"}, - FunctionInfo{412, &NfcInterface::AttachDeactivateEvent, "AttachDeactivateEvent"}, - FunctionInfo{1000, &NfcInterface::ReadMifare, "ReadMifare"}, - FunctionInfo{1001, &NfcInterface::WriteMifare ,"WriteMifare"}, - FunctionInfo{1300, &NfcInterface::SendCommandByPassThrough, "SendCommandByPassThrough"}, - FunctionInfo{1301, nullptr, "KeepPassThroughSession"}, - FunctionInfo{1302, nullptr, "ReleasePassThroughSession"} + 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"} }; RegisterHandlers(functions); } @@ -52,31 +52,31 @@ public: explicit ISystem(Core::System& system_) : NfcInterface{system_, "NFC::ISystem", BackendType::Nfc} { static const FunctionInfoTyped functions[] = { - FunctionInfo{0, &NfcInterface::Initialize, "InitializeOld"}, - FunctionInfo{1, &NfcInterface::Finalize, "FinalizeOld"}, - FunctionInfo{2, &NfcInterface::GetState, "GetStateOld"}, - FunctionInfo{3, &NfcInterface::IsNfcEnabled, "IsNfcEnabledOld"}, - FunctionInfo{100, &NfcInterface::SetNfcEnabled, "SetNfcEnabledOld"}, - FunctionInfo{400, &NfcInterface::Initialize, "Initialize"}, - FunctionInfo{401, &NfcInterface::Finalize, "Finalize"}, - FunctionInfo{402, &NfcInterface::GetState, "GetState"}, - FunctionInfo{403, &NfcInterface::IsNfcEnabled, "IsNfcEnabled"}, - FunctionInfo{404, &NfcInterface::ListDevices, "ListDevices"}, - FunctionInfo{405, &NfcInterface::GetDeviceState, "GetDeviceState"}, - FunctionInfo{406, &NfcInterface::GetNpadId, "GetNpadId"}, - FunctionInfo{407, &NfcInterface::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, - FunctionInfo{408, &NfcInterface::StartDetection, "StartDetection"}, - FunctionInfo{409, &NfcInterface::StopDetection, "StopDetection"}, - FunctionInfo{410, &NfcInterface::GetTagInfo, "GetTagInfo"}, - FunctionInfo{411, &NfcInterface::AttachActivateEvent, "AttachActivateEvent"}, - FunctionInfo{412, &NfcInterface::AttachDeactivateEvent, "AttachDeactivateEvent"}, - FunctionInfo{500, &NfcInterface::SetNfcEnabled, "SetNfcEnabled"}, - FunctionInfo{510, nullptr, "OutputTestWave"}, - FunctionInfo{1000, &NfcInterface::ReadMifare, "ReadMifare"}, - FunctionInfo{1001, &NfcInterface::WriteMifare, "WriteMifare"}, - FunctionInfo{1300, &NfcInterface::SendCommandByPassThrough, "SendCommandByPassThrough"}, - FunctionInfo{1301, nullptr, "KeepPassThroughSession"}, - FunctionInfo{1302, nullptr, "ReleasePassThroughSession"} + 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"} }; RegisterHandlers(functions); } @@ -89,20 +89,20 @@ class MFIUser final : public MFInterface { public: explicit MFIUser(Core::System& system_) : MFInterface{system_, "NFC::MFInterface", BackendType::Mifare} { static const FunctionInfoTyped functions[] = { - FunctionInfo{0, &MFIUser::Initialize, "Initialize"}, - FunctionInfo{1, &MFIUser::Finalize, "Finalize"}, - FunctionInfo{2, &MFIUser::ListDevices, "ListDevices"}, - FunctionInfo{3, &MFIUser::StartDetection, "StartDetection"}, - FunctionInfo{4, &MFIUser::StopDetection, "StopDetection"}, - FunctionInfo{5, &MFIUser::ReadMifare, "Read"}, - FunctionInfo{6, &MFIUser::WriteMifare, "Write"}, - FunctionInfo{7, &MFIUser::GetTagInfo, "GetTagInfo"}, - FunctionInfo{8, &MFIUser::AttachActivateEvent, "GetActivateEventHandle"}, - FunctionInfo{9, &MFIUser::AttachDeactivateEvent, "GetDeactivateEventHandle"}, - FunctionInfo{10, &MFIUser::GetState, "GetState"}, - FunctionInfo{11, &MFIUser::GetDeviceState, "GetDeviceState"}, - FunctionInfo{12, &MFIUser::GetNpadId, "GetNpadId"}, - FunctionInfo{13, &MFIUser::AttachAvailabilityChangeEvent, "GetAvailabilityChangeEventHandle"} + 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"} }; RegisterHandlers(functions); } diff --git a/src/core/hle/service/nfp/nfp.cpp b/src/core/hle/service/nfp/nfp.cpp index f0000e1b82..871b477125 100644 --- a/src/core/hle/service/nfp/nfp.cpp +++ b/src/core/hle/service/nfp/nfp.cpp @@ -16,32 +16,32 @@ class IUser final : public Interface { public: explicit IUser(Core::System& system_) : Interface(system_, "NFP:IUser") { static const FunctionInfoTyped functions[] = { - FunctionInfo{0, &IUser::Initialize, "Initialize"}, - FunctionInfo{1, &IUser::Finalize, "Finalize"}, - FunctionInfo{2, &IUser::ListDevices, "ListDevices"}, - FunctionInfo{3, &IUser::StartDetection, "StartDetection"}, - FunctionInfo{4, &IUser::StopDetection, "StopDetection"}, - FunctionInfo{5, &IUser::Mount, "Mount"}, - FunctionInfo{6, &IUser::Unmount, "Unmount"}, - FunctionInfo{7, &IUser::OpenApplicationArea, "OpenApplicationArea"}, - FunctionInfo{8, &IUser::GetApplicationArea, "GetApplicationArea"}, - FunctionInfo{9, &IUser::SetApplicationArea, "SetApplicationArea"}, - FunctionInfo{10, &IUser::Flush, "Flush"}, - FunctionInfo{11, &IUser::Restore, "Restore"}, - FunctionInfo{12, &IUser::CreateApplicationArea, "CreateApplicationArea"}, - FunctionInfo{13, &IUser::GetTagInfo, "GetTagInfo"}, - FunctionInfo{14, &IUser::GetRegisterInfo, "GetRegisterInfo"}, - FunctionInfo{15, &IUser::GetCommonInfo, "GetCommonInfo"}, - FunctionInfo{16, &IUser::GetModelInfo, "GetModelInfo"}, - FunctionInfo{17, &IUser::AttachActivateEvent, "AttachActivateEvent"}, - FunctionInfo{18, &IUser::AttachDeactivateEvent, "AttachDeactivateEvent"}, - FunctionInfo{19, &IUser::GetState, "GetState"}, - FunctionInfo{20, &IUser::GetDeviceState, "GetDeviceState"}, - FunctionInfo{21, &IUser::GetNpadId, "GetNpadId"}, - FunctionInfo{22, &IUser::GetApplicationAreaSize, "GetApplicationAreaSize"}, - FunctionInfo{23, &IUser::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, - FunctionInfo{24, &IUser::RecreateApplicationArea, "RecreateApplicationArea"}, - FunctionInfo{25, &IUser::StartDetection, "StartDetectionWithFilter"} + 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"} }; RegisterHandlers(functions); } @@ -51,34 +51,34 @@ class ISystem final : public Interface { public: explicit ISystem(Core::System& system_) : Interface(system_, "NFP:ISystem") { static const FunctionInfoTyped functions[] = { - FunctionInfo{0, &ISystem::InitializeSystem, "InitializeSystem"}, - FunctionInfo{1, &ISystem::FinalizeSystem, "FinalizeSystem"}, - FunctionInfo{2, &ISystem::ListDevices, "ListDevices"}, - FunctionInfo{3, &ISystem::StartDetection, "StartDetection"}, - FunctionInfo{4, &ISystem::StopDetection, "StopDetection"}, - FunctionInfo{5, &ISystem::Mount, "Mount"}, - FunctionInfo{6, &ISystem::Unmount, "Unmount"}, - FunctionInfo{10, &ISystem::Flush, "Flush"}, - FunctionInfo{11, &ISystem::Restore, "Restore"}, - FunctionInfo{12, &ISystem::CreateApplicationArea, "CreateApplicationArea"}, - FunctionInfo{13, &ISystem::GetTagInfo, "GetTagInfo"}, - FunctionInfo{14, &ISystem::GetRegisterInfo, "GetRegisterInfo"}, - FunctionInfo{15, &ISystem::GetCommonInfo, "GetCommonInfo"}, - FunctionInfo{16, &ISystem::GetModelInfo, "GetModelInfo"}, - FunctionInfo{17, &ISystem::AttachActivateEvent, "AttachActivateEvent"}, - FunctionInfo{18, &ISystem::AttachDeactivateEvent, "AttachDeactivateEvent"}, - FunctionInfo{19, &ISystem::GetState, "GetState"}, - FunctionInfo{20, &ISystem::GetDeviceState, "GetDeviceState"}, - FunctionInfo{21, &ISystem::GetNpadId, "GetNpadId"}, - FunctionInfo{23, &ISystem::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, - FunctionInfo{25, &ISystem::StartDetection, "StartDetectionWithFilter"}, - FunctionInfo{100, &ISystem::Format, "Format"}, - FunctionInfo{101, &ISystem::GetAdminInfo, "GetAdminInfo"}, - FunctionInfo{102, &ISystem::GetRegisterInfoPrivate, "GetRegisterInfoPrivate"}, - FunctionInfo{103, &ISystem::SetRegisterInfoPrivate, "SetRegisterInfoPrivate"}, - FunctionInfo{104, &ISystem::DeleteRegisterInfo, "DeleteRegisterInfo"}, - FunctionInfo{105, &ISystem::DeleteApplicationArea, "DeleteApplicationArea"}, - FunctionInfo{106, &ISystem::ExistsApplicationArea, "ExistsApplicationArea"} + 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"} }; RegisterHandlers(functions); } @@ -88,46 +88,46 @@ class IDebug final : public Interface { public: explicit IDebug(Core::System& system_) : Interface(system_, "NFP:IDebug") { static const FunctionInfoTyped functions[] = { - FunctionInfo{0, &IDebug::InitializeDebug, "InitializeDebug"}, - FunctionInfo{1, &IDebug::FinalizeDebug, "FinalizeDebug"}, - FunctionInfo{2, &IDebug::ListDevices, "ListDevices"}, - FunctionInfo{3, &IDebug::StartDetection, "StartDetection"}, - FunctionInfo{4, &IDebug::StopDetection, "StopDetection"}, - FunctionInfo{5, &IDebug::Mount, "Mount"}, - FunctionInfo{6, &IDebug::Unmount, "Unmount"}, - FunctionInfo{7, &IDebug::OpenApplicationArea, "OpenApplicationArea"}, - FunctionInfo{8, &IDebug::GetApplicationArea, "GetApplicationArea"}, - FunctionInfo{9, &IDebug::SetApplicationArea, "SetApplicationArea"}, - FunctionInfo{10, &IDebug::Flush, "Flush"}, - FunctionInfo{11, &IDebug::Restore, "Restore"}, - FunctionInfo{12, &IDebug::CreateApplicationArea, "CreateApplicationArea"}, - FunctionInfo{13, &IDebug::GetTagInfo, "GetTagInfo"}, - FunctionInfo{14, &IDebug::GetRegisterInfo, "GetRegisterInfo"}, - FunctionInfo{15, &IDebug::GetCommonInfo, "GetCommonInfo"}, - FunctionInfo{16, &IDebug::GetModelInfo, "GetModelInfo"}, - FunctionInfo{17, &IDebug::AttachActivateEvent, "AttachActivateEvent"}, - FunctionInfo{18, &IDebug::AttachDeactivateEvent, "AttachDeactivateEvent"}, - FunctionInfo{19, &IDebug::GetState, "GetState"}, - FunctionInfo{20, &IDebug::GetDeviceState, "GetDeviceState"}, - FunctionInfo{21, &IDebug::GetNpadId, "GetNpadId"}, - FunctionInfo{22, &IDebug::GetApplicationAreaSize, "GetApplicationAreaSize"}, - FunctionInfo{23, &IDebug::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, - FunctionInfo{24, &IDebug::RecreateApplicationArea, "RecreateApplicationArea"}, - FunctionInfo{25, &IDebug::StartDetection, "StartDetectionWithFilter"}, - FunctionInfo{100, &IDebug::Format, "Format"}, - FunctionInfo{101, &IDebug::GetAdminInfo, "GetAdminInfo"}, - FunctionInfo{102, &IDebug::GetRegisterInfoPrivate, "GetRegisterInfoPrivate"}, - FunctionInfo{103, &IDebug::SetRegisterInfoPrivate, "SetRegisterInfoPrivate"}, - FunctionInfo{104, &IDebug::DeleteRegisterInfo, "DeleteRegisterInfo"}, - FunctionInfo{105, &IDebug::DeleteApplicationArea, "DeleteApplicationArea"}, - FunctionInfo{106, &IDebug::ExistsApplicationArea, "ExistsApplicationArea"}, - FunctionInfo{200, &IDebug::GetAll, "GetAll"}, - FunctionInfo{201, &IDebug::SetAll, "SetAll"}, - FunctionInfo{202, &IDebug::FlushDebug, "FlushDebug"}, - FunctionInfo{203, &IDebug::BreakTag, "BreakTag"}, - FunctionInfo{204, &IDebug::ReadBackupData, "ReadBackupData"}, - FunctionInfo{205, &IDebug::WriteBackupData, "WriteBackupData"}, - FunctionInfo{206, &IDebug::WriteNtf, "WriteNtf"} + 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"} }; RegisterHandlers(functions); } diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp index b590dc1882..2ca298e0e8 100644 --- a/src/core/hle/service/nifm/nifm.cpp +++ b/src/core/hle/service/nifm/nifm.cpp @@ -1050,13 +1050,7 @@ void IGeneralService::GetCurrentAccessPoint(HLERequestContext& ctx) { rb.Push(ResultSuccess); } -IGeneralService::IGeneralService(Core::System& system_) - : ServiceFramework{system_, "IGeneralService"} { - // clang-format off - - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } +ServiceFrameworkBase::FunctionInfoBase const* IGeneralService::FindRequest(u32 key) { static constexpr auto functions = CreateStaticMap( FunctionInfo{1, &IGeneralService::GetClientId, "GetClientId"}, FunctionInfo{2, &IGeneralService::CreateScanRequest, "CreateScanRequest"}, @@ -1108,6 +1102,11 @@ IGeneralService::IGeneralService(Core::System& system_) FunctionInfo{51, nullptr, "CreateRewriteRule"}, // 18.0.0+ FunctionInfo{52, nullptr, "DestroyRewriteRule"} // 18.0.0+ ); + return HandlerTableGenerateWithFind(key, functions); +} + +IGeneralService::IGeneralService(Core::System& system_) + : ServiceFramework{system_, "IGeneralService"} { } IGeneralService::~IGeneralService() = default; diff --git a/src/core/hle/service/nifm/nifm.h b/src/core/hle/service/nifm/nifm.h index 3b5a438c75..648e96cd39 100644 --- a/src/core/hle/service/nifm/nifm.h +++ b/src/core/hle/service/nifm/nifm.h @@ -51,6 +51,7 @@ private: void SetBackgroundRequestEnabled(HLERequestContext& ctx); void GetCurrentAccessPoint(HLERequestContext& ctx); void GetScanDataV3(HLERequestContext& ctx); + FunctionInfoBase const* FindRequest(u32 key) override; }; } // namespace Service::NIFM diff --git a/src/core/hle/service/ns/async_result.cpp b/src/core/hle/service/ns/async_result.cpp index 11ed594da6..ccb576cb0f 100644 --- a/src/core/hle/service/ns/async_result.cpp +++ b/src/core/hle/service/ns/async_result.cpp @@ -8,6 +8,15 @@ namespace Service::NS { +ServiceFrameworkBase::FunctionInfoBase const* IAsyncResult::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "Get"}, + FunctionInfo{1, D<&IAsyncResult::Cancel>, "Cancel"}, + FunctionInfo{2, nullptr, "GetErrorContext"} // 4.0.0+ + ); + return HandlerTableGenerateWithFind(key, functions); +} + IAsyncResult::IAsyncResult(Core::System& system_, Service::Event* event_) : ServiceFramework{system_, "nn::ns::detail::IAsyncResult"}, event{event_} { } diff --git a/src/core/hle/service/ns/async_result.h b/src/core/hle/service/ns/async_result.h index 3f2d5b349f..2e8d88096a 100644 --- a/src/core/hle/service/ns/async_result.h +++ b/src/core/hle/service/ns/async_result.h @@ -13,14 +13,7 @@ public: private: Result Cancel(); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "Get"}, - FunctionInfo{1, D<&IAsyncResult::Cancel>, "Cancel"}, - FunctionInfo{2, nullptr, "GetErrorContext"}, // 4.0.0+ - ); + FunctionInfoBase const* FindRequest(u32 key) override; Service::Event* event{}; }; diff --git a/src/core/hle/service/ns/content_management_interface.h b/src/core/hle/service/ns/content_management_interface.h index 6670bbf754..34f52c5f20 100644 --- a/src/core/hle/service/ns/content_management_interface.h +++ b/src/core/hle/service/ns/content_management_interface.h @@ -38,7 +38,7 @@ public: FunctionInfo{601, nullptr, "ListApplicationContentMetaStatus"}, FunctionInfo{605, nullptr, "ListApplicationContentMetaStatusWithRightsCheck"}, FunctionInfo{607, nullptr, "IsAnyApplicationRunning"}, - FunctionInfo{608, nullptr, "Unknown608"}, //21.0.0+ + FunctionInfo{608, nullptr, "Unknown608"} //21.0.0+ ); }; diff --git a/src/core/hle/service/ns/dynamic_rights_interface.cpp b/src/core/hle/service/ns/dynamic_rights_interface.cpp index 34d607835d..40e172b220 100644 --- a/src/core/hle/service/ns/dynamic_rights_interface.cpp +++ b/src/core/hle/service/ns/dynamic_rights_interface.cpp @@ -9,6 +9,41 @@ namespace Service::NS { +ServiceFrameworkBase::FunctionInfoBase const* 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"}, //20.0.0+ + FunctionInfo{28, nullptr, "Unknown28"}, //20.0.0+ + FunctionInfo{29, nullptr, "Unknown29"}, //21.0.0+ + FunctionInfo{30, nullptr, "Unknown30"} //21.0.0+ + ); + return HandlerTableGenerateWithFind(key, functions); +} + IDynamicRightsInterface::IDynamicRightsInterface(Core::System& system_) : ServiceFramework{system_, "DynamicRightsInterface"} { } diff --git a/src/core/hle/service/ns/dynamic_rights_interface.h b/src/core/hle/service/ns/dynamic_rights_interface.h index 793e2c3586..be7e282bad 100644 --- a/src/core/hle/service/ns/dynamic_rights_interface.h +++ b/src/core/hle/service/ns/dynamic_rights_interface.h @@ -22,40 +22,7 @@ private: Result VerifyActivatedRightsOwners(u64 rights_handle); Result HasAccountRestrictedRightsInRunningApplications(Out out_is_restricted); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"}, //20.0.0+ - FunctionInfo{28, nullptr, "Unknown28"}, //20.0.0+ - FunctionInfo{29, nullptr, "Unknown29"}, //21.0.0+ - FunctionInfo{30, nullptr, "Unknown30"}, //21.0.0+ - ); + FunctionInfoBase const* FindRequest(u32 key) override; }; } // 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 e724bdbb23..6f2a5ff2aa 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 { +ServiceFrameworkBase::FunctionInfoBase const* 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 - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); } 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..7a881e0028 100644 --- a/src/core/hle/service/ns/factory_reset_interface.h +++ b/src/core/hle/service/ns/factory_reset_interface.h @@ -11,6 +11,7 @@ class IFactoryResetInterface final : public ServiceFramework, "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; diff --git a/src/core/hle/service/ns/platform_service_manager.h b/src/core/hle/service/ns/platform_service_manager.h index d9760a0bfa..1d7c4a784a 100644 --- a/src/core/hle/service/ns/platform_service_manager.h +++ b/src/core/hle/service/ns/platform_service_manager.h @@ -70,27 +70,7 @@ private: Out out_fonts_are_loaded, Out out_font_count, Set::LanguageCode language_code); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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 963f24853f..9bf6a20b96 100644 --- a/src/core/hle/service/ns/query_service.cpp +++ b/src/core/hle/service/ns/query_service.cpp @@ -14,6 +14,38 @@ namespace Service::NS { +ServiceFrameworkBase::FunctionInfoBase const* 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()} { } diff --git a/src/core/hle/service/ns/query_service.h b/src/core/hle/service/ns/query_service.h index 63dbe89b20..53232a79b6 100644 --- a/src/core/hle/service/ns/query_service.h +++ b/src/core/hle/service/ns/query_service.h @@ -62,37 +62,7 @@ private: OutArray out_stats, InArray application_ids); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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" }, - ); + FunctionInfoBase const* 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 ab35f0c888..44817eff91 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 +ServiceFrameworkBase::FunctionInfoBase const* 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"} //23.0.0+ + ); + return HandlerTableGenerateWithFind(key, functions); +} // IAsyncValue implementation for ListApplicationTitle // https://switchbrew.org/wiki/NS_services#ListApplicationTitle 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 753677a731..89270533da 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 @@ -46,21 +46,7 @@ public: u8 flag2, u64 application_id); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"}, //23.0.0+ - ); + FunctionInfoBase const* 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 1b2de026cc..076a194401 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,6 +11,16 @@ namespace Service::NS { +ServiceFrameworkBase::FunctionInfoBase const* 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"} { } 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 248e39ce2f..ff1f4f1d2b 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 @@ -25,15 +25,7 @@ private: OutArray out_records, Out out_count, s32 entry_offset); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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 c5fa04d9e4..cdf758e997 100644 --- a/src/core/hle/service/ns/service_getter_interface.cpp +++ b/src/core/hle/service/ns/service_getter_interface.cpp @@ -17,6 +17,23 @@ namespace Service::NS { +ServiceFrameworkBase::FunctionInfoBase const* 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} { } diff --git a/src/core/hle/service/ns/service_getter_interface.h b/src/core/hle/service/ns/service_getter_interface.h index 29c1adcb47..1ec40563dc 100644 --- a/src/core/hle/service/ns/service_getter_interface.h +++ b/src/core/hle/service/ns/service_getter_interface.h @@ -43,22 +43,7 @@ public: Out> out_interface); Result GetDocumentInterface(Out> out_interface); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* FindRequest(u32 key) override; }; } // 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 df3fa0a7ac..e52c464faf 100644 --- a/src/core/hle/service/ns/system_update_interface.cpp +++ b/src/core/hle/service/ns/system_update_interface.cpp @@ -7,6 +7,29 @@ namespace Service::NS { +ServiceFrameworkBase::FunctionInfoBase const* 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} { diff --git a/src/core/hle/service/ns/system_update_interface.h b/src/core/hle/service/ns/system_update_interface.h index 04493bbed5..d0f765f344 100644 --- a/src/core/hle/service/ns/system_update_interface.h +++ b/src/core/hle/service/ns/system_update_interface.h @@ -30,29 +30,7 @@ private: Result GetSystemUpdateNotificationEventForContentDelivery( OutCopyHandle out_event); -private: - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* FindRequest(u32 key) override; KernelHelpers::ServiceContext service_context; Event update_notification_event; }; diff --git a/src/core/hle/service/nvnflinger/hos_binder_driver.cpp b/src/core/hle/service/nvnflinger/hos_binder_driver.cpp index 98ce6e8a81..cc314c56e8 100644 --- a/src/core/hle/service/nvnflinger/hos_binder_driver.cpp +++ b/src/core/hle/service/nvnflinger/hos_binder_driver.cpp @@ -8,6 +8,16 @@ namespace Service::Nvnflinger { +ServiceFrameworkBase::FunctionInfoBase const* 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) diff --git a/src/core/hle/service/nvnflinger/hos_binder_driver.h b/src/core/hle/service/nvnflinger/hos_binder_driver.h index 95b7105cd3..f561814f19 100644 --- a/src/core/hle/service/nvnflinger/hos_binder_driver.h +++ b/src/core/hle/service/nvnflinger/hos_binder_driver.h @@ -44,15 +44,7 @@ private: OutBuffer parcel_reply, u32 flags); private: - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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/native_handle_holder.cpp b/src/core/hle/service/olsc/native_handle_holder.cpp index b40d4bf154..cfabb97499 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 { -INativeHandleHolder::INativeHandleHolder(Core::System& system_) - : ServiceFramework{system_, "INativeHandleHolder"}, service_context{system_, "OLSC"} { - event = service_context.CreateEvent("OLSC::INativeHandleHolder"); - // clang-format off - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } +ServiceFrameworkBase::FunctionInfoBase const* 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"); } 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..ab76969bfb 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); + FunctionInfoBase const* 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 538972fb0f..0386504b83 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[] = { - FunctionInfo{100, nullptr, "OpenBgAgentController" }, - }; - RegisterHandlers(functions); + explicit ISProfileBgAgentForSystemProcess(Core::System& system_) : ServiceFramework{system_, "spbg:sp"} {} + + FunctionInfoBase const* 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(); + } + + FunctionInfoBase const* 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"}, //21.0.0+ + FunctionInfo{300, nullptr, "GetUserSaveDataProperty"}, + FunctionInfo{301, nullptr, "SetUserSaveDataProperty"}, + FunctionInfo{302, nullptr, "Unknown302"}, //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"}, //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 bce0e47c68..66a339369f 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 { +ServiceFrameworkBase::FunctionInfoBase const* 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 - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); } 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..4c7683bf76 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); + FunctionInfoBase const* 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 788019ea5a..0000000000 --- a/src/core/hle/service/olsc/olsc_service_for_system_service.cpp +++ /dev/null @@ -1,77 +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"} { -} - -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 77169cd9e2..0000000000 --- a/src/core/hle/service/olsc/olsc_service_for_system_service.h +++ /dev/null @@ -1,119 +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); - - FunctionInfoBase const* 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"}, //21.0.0+ - FunctionInfo{300, nullptr, "GetUserSaveDataProperty"}, - FunctionInfo{301, nullptr, "SetUserSaveDataProperty"}, - FunctionInfo{302, nullptr, "Unknown302"}, //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"}, //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"} - ); -}; - -} // 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 a8a903d4ae..aaf0456f7f 100644 --- a/src/core/hle/service/olsc/remote_storage_controller.cpp +++ b/src/core/hle/service/olsc/remote_storage_controller.cpp @@ -9,6 +9,42 @@ namespace Service::OLSC { + ServiceFrameworkBase::FunctionInfoBase const* 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"}, //20.0.0+ + FunctionInfo{27, D<&IRemoteStorageController::GetDataInfo>, "GetDataInfoV2"}, //20.0.0+ + FunctionInfo{28, nullptr, "Unknown28"}, //20.0.0+ + FunctionInfo{29, nullptr, "Unknown29"}, //21.0.0+ + FunctionInfo{800, nullptr, "Unknown800"}, //20.0.0+ + FunctionInfo{900, nullptr, "SetLoadedDataMissing"}, + FunctionInfo{901, nullptr, "Unknown901"} //20.2.0+ + ); + return HandlerTableGenerateWithFind(key, functions); + } + IRemoteStorageController::IRemoteStorageController(Core::System& system_) : ServiceFramework{system_, "IRemoteStorageController"} { } diff --git a/src/core/hle/service/olsc/remote_storage_controller.h b/src/core/hle/service/olsc/remote_storage_controller.h index 637296430f..29afc1d5e0 100644 --- a/src/core/hle/service/olsc/remote_storage_controller.h +++ b/src/core/hle/service/olsc/remote_storage_controller.h @@ -22,41 +22,7 @@ private: Result GetDataNewnessByApplicationId(Out out_newness, u64 application_id); Result GetDataInfo(Out> out_data, u64 application_id); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"}, //20.0.0+ - FunctionInfo{27, D<&IRemoteStorageController::GetDataInfo>, "GetDataInfoV2"}, //20.0.0+ - FunctionInfo{28, nullptr, "Unknown28"}, //20.0.0+ - FunctionInfo{29, nullptr, "Unknown29"}, //21.0.0+ - FunctionInfo{800, nullptr, "Unknown800"}, //20.0.0+ - FunctionInfo{900, nullptr, "SetLoadedDataMissing"}, - FunctionInfo{901, nullptr, "Unknown901"}, //20.2.0+ - ); + FunctionInfoBase const* 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 a27ca68d2d..5023f0c892 100644 --- a/src/core/hle/service/olsc/transfer_task_list_controller.cpp +++ b/src/core/hle/service/olsc/transfer_task_list_controller.cpp @@ -11,6 +11,43 @@ namespace Service::OLSC { + ServiceFrameworkBase::FunctionInfoBase const* 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"}, //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"}, //20.1.0+ + FunctionInfo{27, nullptr, "Unknown27"}, //20.1.0+ + FunctionInfo{28, nullptr, "Unknown28"}, //20.1.0+ + FunctionInfo{29, nullptr, "Unknown29"}, //20.1.0+ + FunctionInfo{30, nullptr, "Unknown30"} //20.1.0+ + ); + return HandlerTableGenerateWithFind(key, functions); + } + ITransferTaskListController::ITransferTaskListController(Core::System& system_) : ServiceFramework{system_, "ITransferTaskListController"} { } 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 207e469117..3bb780e98c 100644 --- a/src/core/hle/service/olsc/transfer_task_list_controller.h +++ b/src/core/hle/service/olsc/transfer_task_list_controller.h @@ -28,42 +28,7 @@ private: Result GetCurrentTransferTaskInfo(Out> out_info, u8 unknown); Result FindTransferTaskInfo(Out> out_info, InBuffer in); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"}, //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"}, //20.1.0+ - FunctionInfo{27, nullptr, "Unknown27"}, //20.1.0+ - FunctionInfo{28, nullptr, "Unknown28"}, //20.1.0+ - FunctionInfo{29, nullptr, "Unknown29"}, //20.1.0+ - FunctionInfo{30, nullptr, "Unknown30"}, //20.1.0+ - ); + FunctionInfoBase const* FindRequest(u32 key) override; }; } // namespace Service::OLSC 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 e524ce4469..0000000000 --- a/src/core/hle/service/pctl/parental_control_service.cpp +++ /dev/null @@ -1,369 +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} { -} - -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 7396537939..0000000000 --- a/src/core/hle/service/pctl/parental_control_service.h +++ /dev/null @@ -1,228 +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{}; - }; - - FunctionInfoBase const* 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"}, //20.0.0+ - FunctionInfo{1021, nullptr, "TryBeginFreeCommunicationForStreamPlay"}, //21.0.0+ - FunctionInfo{1022, nullptr, "EndFreeCommunicationForStreamPlay"}, //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"}, //20.0.0+ - FunctionInfo{1051, nullptr, "NotifyApplicationDownloadStarted"}, //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"}, // 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"}, // 18.0.0+ - FunctionInfo{1955, nullptr, "GetBedtimeAlarmTime"}, // 18.0.0+ - FunctionInfo{1956, nullptr, "GetBedtimeAlarmTimeHour"}, // 18.0.0+ - FunctionInfo{1957, nullptr, "GetBedtimeAlarmTimeMinute"}, // 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"}, //5.0.0+ - FunctionInfo{145601, D<&IParentalControlService::GetPlayTimerSettings>, "GetPlayTimerSettings"}, // 18.0.0+ - FunctionInfo{2017, nullptr, "AuthorizePairingAsync"}, //19.0.0+ - FunctionInfo{2019, nullptr, "RequestUpdateDeviceUsersBackground"}, //19.0.0+ - FunctionInfo{2021, nullptr, "RequestCopyPairingAsync"}, //20.0.0+ - FunctionInfo{2022, nullptr, "FinishRequestCopyPairing"}, //20.0.0+ - FunctionInfo{2023, nullptr, "IsFromPairingActiveDevice"}, //20.0.0+ - FunctionInfo{2024, nullptr, "RollbackCopyPairing"}, //21.0.0+ - FunctionInfo{3001, nullptr, "GetErrorContextChangedEvent"}, //20.0.0+ - FunctionInfo{145601, D<&IParentalControlService::GetPlayTimerSettings>, "GetPlayTimerSettings"}, // 18.0.0+ - FunctionInfo{195101, D<&IParentalControlService::SetPlayTimerSettings>, "SetPlayTimerSettingsForDebug"}, //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; -}; - -} // 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 c89a73cb9b..0000000000 --- a/src/core/hle/service/pctl/parental_control_service_factory.cpp +++ /dev/null @@ -1,38 +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_} { -} - -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 6727a81b18..0000000000 --- a/src/core/hle/service/pctl/parental_control_service_factory.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/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: - FunctionInfoBase const* 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); - -} // namespace Service::PCTL diff --git a/src/core/hle/service/pctl/pctl.cpp b/src/core/hle/service/pctl/pctl.cpp index d92dbe2169..24c81e342f 100644 --- a/src/core/hle/service/pctl/pctl.cpp +++ b/src/core/hle/service/pctl/pctl.cpp @@ -1,27 +1,636 @@ // 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{}; + }; + + FunctionInfoBase const* 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"}, //20.0.0+ + FunctionInfo{1021, nullptr, "TryBeginFreeCommunicationForStreamPlay"}, //21.0.0+ + FunctionInfo{1022, nullptr, "EndFreeCommunicationForStreamPlay"}, //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"}, //20.0.0+ + FunctionInfo{1051, nullptr, "NotifyApplicationDownloadStarted"}, //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"}, // 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"}, // 18.0.0+ + FunctionInfo{1955, nullptr, "GetBedtimeAlarmTime"}, // 18.0.0+ + FunctionInfo{1956, nullptr, "GetBedtimeAlarmTimeHour"}, // 18.0.0+ + FunctionInfo{1957, nullptr, "GetBedtimeAlarmTimeMinute"}, // 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"}, //5.0.0+ + FunctionInfo{145601, D<&IParentalControlService::GetPlayTimerSettings>, "GetPlayTimerSettings"}, // 18.0.0+ + FunctionInfo{2017, nullptr, "AuthorizePairingAsync"}, //19.0.0+ + FunctionInfo{2019, nullptr, "RequestUpdateDeviceUsersBackground"}, //19.0.0+ + FunctionInfo{2021, nullptr, "RequestCopyPairingAsync"}, //20.0.0+ + FunctionInfo{2022, nullptr, "FinishRequestCopyPairing"}, //20.0.0+ + FunctionInfo{2023, nullptr, "IsFromPairingActiveDevice"}, //20.0.0+ + FunctionInfo{2024, nullptr, "RollbackCopyPairing"}, //21.0.0+ + FunctionInfo{3001, nullptr, "GetErrorContextChangedEvent"}, //20.0.0+ + FunctionInfo{145601, D<&IParentalControlService::GetPlayTimerSettings>, "GetPlayTimerSettings"}, // 18.0.0+ + FunctionInfo{195101, D<&IParentalControlService::SetPlayTimerSettings>, "SetPlayTimerSettingsForDebug"} //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: + FunctionInfoBase const* 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/psc/ovln/receiver.cpp b/src/core/hle/service/psc/ovln/receiver.cpp index 02b262ad45..55045ed5e1 100644 --- a/src/core/hle/service/psc/ovln/receiver.cpp +++ b/src/core/hle/service/psc/ovln/receiver.cpp @@ -9,20 +9,19 @@ namespace Service::PSC { +ServiceFrameworkBase::FunctionInfoBase const* IReceiver::FindRequest(u32 key) { + 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"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IReceiver::IReceiver(Core::System& system_) : ServiceFramework{system_, "IReceiver"}, service_context{system_, "IReceiver"} { - // clang-format off - FunctionInfoBase const* 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"} - ); - receive_event = service_context.CreateEvent("IReceiver::ReceiveEvent"); } diff --git a/src/core/hle/service/psc/ovln/receiver.h b/src/core/hle/service/psc/ovln/receiver.h index 2b96216a1a..63fa869cf4 100644 --- a/src/core/hle/service/psc/ovln/receiver.h +++ b/src/core/hle/service/psc/ovln/receiver.h @@ -36,6 +36,7 @@ private: Result Receive(Out out_notification, Out out_flags); Result ReceiveWithTick(Out out_notification, Out out_flags, Out out_tick); + FunctionInfoBase const* FindRequest(u32 key) override; KernelHelpers::ServiceContext service_context; Kernel::KEvent* receive_event; diff --git a/src/core/hle/service/psc/ovln/receiver_service.cpp b/src/core/hle/service/psc/ovln/receiver_service.cpp index 602cacc36c..98be2d89dd 100644 --- a/src/core/hle/service/psc/ovln/receiver_service.cpp +++ b/src/core/hle/service/psc/ovln/receiver_service.cpp @@ -10,6 +10,13 @@ namespace Service::PSC { + ServiceFrameworkBase::FunctionInfoBase const* 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"} { } diff --git a/src/core/hle/service/psc/ovln/receiver_service.h b/src/core/hle/service/psc/ovln/receiver_service.h index 28e480b4d8..08cb357e17 100644 --- a/src/core/hle/service/psc/ovln/receiver_service.h +++ b/src/core/hle/service/psc/ovln/receiver_service.h @@ -18,12 +18,7 @@ public: private: Result OpenReceiver(Out> out_receiver); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IReceiverService::OpenReceiver>, "OpenReceiver"} - ); + FunctionInfoBase const* 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 index ac8c06d071..3ce2221f8c 100644 --- a/src/core/hle/service/psc/ovln/sender.cpp +++ b/src/core/hle/service/psc/ovln/sender.cpp @@ -6,6 +6,14 @@ namespace Service::PSC { + ServiceFrameworkBase::FunctionInfoBase const* ISender::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&ISender::Send>, "Send"}, + FunctionInfo{1, nullptr, "GetUnreceivedMessageCount"} + ); + return HandlerTableGenerateWithFind(key, functions); + } + ISender::ISender(Core::System& system_) : ServiceFramework{system_, "ISender"} { } diff --git a/src/core/hle/service/psc/ovln/sender.h b/src/core/hle/service/psc/ovln/sender.h index 5e6effdc96..e1c31ed683 100644 --- a/src/core/hle/service/psc/ovln/sender.h +++ b/src/core/hle/service/psc/ovln/sender.h @@ -17,13 +17,7 @@ public: private: Result Send(const OverlayNotification& notification, MessageFlags flags); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&ISender::Send>, "Send"}, - FunctionInfo{1, nullptr, "GetUnreceivedMessageCount"} - ); + FunctionInfoBase const* FindRequest(u32 key) override; }; } // 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 39a44bea67..25ee56402b 100644 --- a/src/core/hle/service/psc/ovln/sender_service.cpp +++ b/src/core/hle/service/psc/ovln/sender_service.cpp @@ -7,6 +7,13 @@ namespace Service::PSC { + ServiceFrameworkBase::FunctionInfoBase const* 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"} { } diff --git a/src/core/hle/service/psc/ovln/sender_service.h b/src/core/hle/service/psc/ovln/sender_service.h index cad5b903bf..b7425031c4 100644 --- a/src/core/hle/service/psc/ovln/sender_service.h +++ b/src/core/hle/service/psc/ovln/sender_service.h @@ -18,12 +18,7 @@ public: private: Result OpenSender(Out> out_sender, u32 sender_id, std::array data); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&ISenderService::OpenSender>, "OpenSender"} - ); + FunctionInfoBase const* FindRequest(u32 key) override; }; } // namespace Service::PSC diff --git a/src/core/hle/service/psc/pm_module.cpp b/src/core/hle/service/psc/pm_module.cpp index 71ce109364..94f586203a 100644 --- a/src/core/hle/service/psc/pm_module.cpp +++ b/src/core/hle/service/psc/pm_module.cpp @@ -8,18 +8,18 @@ namespace Service::PSC { -IPmModule::IPmModule(Core::System& system_) : ServiceFramework{system_, "IPmModule"} { - // clang-format off - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } +ServiceFrameworkBase::FunctionInfoBase const* IPmModule::FindRequest(u32 key) { 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"} - ); + FunctionInfo{0, nullptr, "Initialize"}, + FunctionInfo{1, nullptr, "GetRequest"}, + FunctionInfo{2, nullptr, "Acknowledge"}, + FunctionInfo{3, nullptr, "Finalize"}, + FunctionInfo{4, nullptr, "AcknowledgeEx"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + +IPmModule::IPmModule(Core::System& system_) : ServiceFramework{system_, "IPmModule"} { } IPmModule::~IPmModule() = default; diff --git a/src/core/hle/service/psc/pm_module.h b/src/core/hle/service/psc/pm_module.h index b3a2d25842..5dc44e357c 100644 --- a/src/core/hle/service/psc/pm_module.h +++ b/src/core/hle/service/psc/pm_module.h @@ -11,6 +11,7 @@ class IPmModule final : public ServiceFramework { public: explicit IPmModule(Core::System& system_); ~IPmModule() override; + FunctionInfoBase const* FindRequest(u32 key) 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 1b3ff98f38..0000000000 --- a/src/core/hle/service/psc/pm_service.cpp +++ /dev/null @@ -1,21 +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"} { -} - -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 8713f1e9df..0000000000 --- a/src/core/hle/service/psc/pm_service.h +++ /dev/null @@ -1,29 +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); - - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IPmService::GetPmModule>, "GetPmModule"} - ); -}; - -} // namespace Service::PSC diff --git a/src/core/hle/service/psc/psc.cpp b/src/core/hle/service/psc/psc.cpp index 01f65ff32d..45e18202b6 100644 --- a/src/core/hle/service/psc/psc.cpp +++ b/src/core/hle/service/psc/psc.cpp @@ -7,7 +7,7 @@ #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/pm_module.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" @@ -102,6 +102,27 @@ public: } }; +class IPmModule; + +class IPmService final : public ServiceFramework { +public: + explicit IPmService(Core::System& system_) : ServiceFramework{system_, "psc:m"} {} + ~IPmService() override = default; + + Result GetPmModule(Out> out_module) { + LOG_DEBUG(Service_PSC, "called"); + *out_module = std::make_shared(system); + R_SUCCEED(); + } + + FunctionInfoBase const* FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IPmService::GetPmModule>, "GetPmModule"} + ); +}; + void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); 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 c28cf621be..16d387b1f7 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 { +ServiceFrameworkBase::FunctionInfoBase const* 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 - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, D<&IPowerStateRequestHandler::GetPowerStateRequestEventReadableHandle>, "GetPowerStateRequestEventReadableHandle"}, - FunctionInfo{1, D<&IPowerStateRequestHandler::GetAndClearPowerStateRequest>, "GetAndClearPowerStateRequest"} - ); -} +{} 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..f8c7370b71 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: + FunctionInfoBase const* 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 2f099e24dd..3188eef94c 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 { + ServiceFrameworkBase::FunctionInfoBase const* 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)}, diff --git a/src/core/hle/service/psc/time/service_manager.h b/src/core/hle/service/psc/time/service_manager.h index b4b25681c6..a729b49c8b 100644 --- a/src/core/hle/service/psc/time/service_manager.h +++ b/src/core/hle/service/psc/time/service_manager.h @@ -65,29 +65,8 @@ private: void SetupSAndP(); Result GetStaticService(OutInterface out_service, StaticServiceSetupInfo setup_info, const char* name); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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 "} - ); + FunctionInfoBase const* 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 4a68910f3a..03f2079297 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 +ServiceFrameworkBase::FunctionInfoBase const* 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 - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); } 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..b6fd522099 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); + FunctionInfoBase const* 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 d2aa1a2dec..6ab74cddcb 100644 --- a/src/core/hle/service/psc/time/steady_clock.cpp +++ b/src/core/hle/service/psc/time/steady_clock.cpp @@ -11,17 +11,7 @@ namespace Service::PSC::Time { -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 - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } +ServiceFrameworkBase::FunctionInfoBase const* SteadyClock::FindRequest(u32 key) { static constexpr auto functions = CreateStaticMap( FunctionInfo{0, D<&SteadyClock::GetCurrentTimePoint>, "GetCurrentTimePoint"}, FunctionInfo{2, D<&SteadyClock::GetTestOffset>, "GetTestOffset"}, @@ -31,8 +21,17 @@ SteadyClock::SteadyClock(Core::System& system_, std::shared_ptr man 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} +{} + Result SteadyClock::GetCurrentTimePoint(Out out_time_point) { SCOPE_EXIT { LOG_DEBUG(Service_Time, "called. out_time_point={}", *out_time_point); diff --git a/src/core/hle/service/psc/time/steady_clock.h b/src/core/hle/service/psc/time/steady_clock.h index 8d3d9a6280..c149b10dd2 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); + FunctionInfoBase const* 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 8e0d654f4c..c861234ec0 100644 --- a/src/core/hle/service/psc/time/system_clock.cpp +++ b/src/core/hle/service/psc/time/system_clock.cpp @@ -11,6 +11,17 @@ namespace Service::PSC::Time { +ServiceFrameworkBase::FunctionInfoBase const* 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} diff --git a/src/core/hle/service/psc/time/system_clock.h b/src/core/hle/service/psc/time/system_clock.h index 262b8c333c..e795061a4c 100644 --- a/src/core/hle/service/psc/time/system_clock.h +++ b/src/core/hle/service/psc/time/system_clock.h @@ -31,16 +31,7 @@ public: Result GetOperationEventReadableHandle(OutCopyHandle out_event); private: - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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 789304bfd2..7616801743 100644 --- a/src/core/hle/service/psc/time/time_zone_service.cpp +++ b/src/core/hle/service/psc/time/time_zone_service.cpp @@ -13,6 +13,26 @@ namespace Service::PSC::Time { + ServiceFrameworkBase::FunctionInfoBase const* 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"} 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 da4fd24e0e..4a6341e9aa 100644 --- a/src/core/hle/service/psc/time/time_zone_service.h +++ b/src/core/hle/service/psc/time/time_zone_service.h @@ -59,25 +59,7 @@ public: const CalendarTime& calendar_time); private: - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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/services.h b/src/core/hle/service/services.h index 97bd0973f5..da5281ff29 100644 --- a/src/core/hle/service/services.h +++ b/src/core/hle/service/services.h @@ -8,9 +8,6 @@ #include "common/polyfill_thread.h" #include "core/hle/service/sm/sm.h" -// Include these for proper template instancing -#include "core/hle/service/ipc_helpers.h" -#include "core/hle/service/cmif_serialization.h" namespace Service { 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 fd2fd5c52e..b0635614c6 100644 --- a/src/core/hle/service/set/firmware_debug_settings_server.h +++ b/src/core/hle/service/set/firmware_debug_settings_server.h @@ -30,7 +30,7 @@ public: FunctionInfo{22, nullptr, "SetHostFsMountPoint"}, FunctionInfo{23, nullptr, "SetMemoryUsageRateFlag"}, FunctionInfo{24, nullptr, "CommitSettings"}, //20.0.0+ - FunctionInfo{27, nullptr, "SetHttpAuthConfigs"}, //21.0.0+ + FunctionInfo{27, nullptr, "SetHttpAuthConfigs"} //21.0.0+ ); }; diff --git a/src/core/hle/service/set/settings_server.cpp b/src/core/hle/service/set/settings_server.cpp index 233e5d0fa4..6576b8121f 100644 --- a/src/core/hle/service/set/settings_server.cpp +++ b/src/core/hle/service/set/settings_server.cpp @@ -89,6 +89,25 @@ LanguageCode GetLanguageCodeFromIndex(std::size_t index) { return available_language_codes.at(index); } +ServiceFrameworkBase::FunctionInfoBase const* 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"} { } diff --git a/src/core/hle/service/set/settings_server.h b/src/core/hle/service/set/settings_server.h index a897d8b377..b2d6290aef 100644 --- a/src/core/hle/service/set/settings_server.h +++ b/src/core/hle/service/set/settings_server.h @@ -35,24 +35,7 @@ private: Result GetDeviceNickName(OutLargeData, BufferAttr_HipcMapAlias> out_device_name); Result GetKeyCodeMapByPort(OutLargeData out_key_code_map, u32 port); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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 e82bd72cab..3cea0997f6 100644 --- a/src/core/hle/service/set/system_settings_server.cpp +++ b/src/core/hle/service/set/system_settings_server.cpp @@ -114,6 +114,237 @@ Result GetFirmwareVersionImpl(FirmwareVersionFormat& out_firmware, Core::System& return ResultSuccess; } +ServiceFrameworkBase::FunctionInfoBase const* 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"}, //17.0.0+ + FunctionInfo{222, nullptr, "SetForceMonauralOutputFlag"}, //17.0.0+ + FunctionInfo{251, nullptr, "GetAccountIdentificationSettings"}, //18.0.0+ + FunctionInfo{252, nullptr, "SetAccountIdentificationSettings"}, //18.0.0+ + FunctionInfo{263, nullptr, "AcquireVphymDirtyFlagEventHandle"}, //20.0.0+ + FunctionInfo{264, nullptr, "GetVphymDirtyFlags"}, //20.0.0+ + FunctionInfo{282, nullptr, "ConvertToProductModel"}, //20.0.0+ + FunctionInfo{283, nullptr, "ConvertToProductModelName"}, //20.0.0+ + FunctionInfo{289, nullptr, "GetDefaultAccountIdentificationFlagSet"}, //20.0.0+ + FunctionInfo{300, nullptr, "AcquirePushNotificationDirtyFlagEventHandle"}, //20.0.0+ + FunctionInfo{301, nullptr, "GetPushNotificationDirtyFlags"}, //20.0.0+ + FunctionInfo{306, nullptr, "GetPinCodeReregistrationGuideAccounts"}, //20.0.0+ + FunctionInfo{307, nullptr, "SetPinCodeReregistrationGuideAccounts"}, //20.0.0+ + FunctionInfo{315, C<&ISystemSettingsServer::GetHttpAuthConfigs>, "GetHttpAuthConfigs"}, //21.0.0+ + FunctionInfo{319, C<&ISystemSettingsServer::GetAccountUserSettings>, "GetAccountUserSettings"}, //21.0.0+ + FunctionInfo{320, nullptr, "SetAccountUserSettings"}, //21.0.0+ + FunctionInfo{321, C<&ISystemSettingsServer::GetDefaultAccountUserSettings>, "GetDefaultAccountUserSettings"} //21.0.0+ + ); + return HandlerTableGenerateWithFind(key, functions); +} + ISystemSettingsServer::ISystemSettingsServer(Core::System& system_) : ServiceFramework{system_, "set:sys"}, m_system{system} { SetupSettings(); diff --git a/src/core/hle/service/set/system_settings_server.h b/src/core/hle/service/set/system_settings_server.h index a1429d6213..1de2944387 100644 --- a/src/core/hle/service/set/system_settings_server.h +++ b/src/core/hle/service/set/system_settings_server.h @@ -179,236 +179,7 @@ private: void StoreSettings(); void SetSaveNeeded(); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"}, //17.0.0+ - FunctionInfo{222, nullptr, "SetForceMonauralOutputFlag"}, //17.0.0+ - FunctionInfo{251, nullptr, "GetAccountIdentificationSettings"}, //18.0.0+ - FunctionInfo{252, nullptr, "SetAccountIdentificationSettings"}, //18.0.0+ - FunctionInfo{263, nullptr, "AcquireVphymDirtyFlagEventHandle"}, //20.0.0+ - FunctionInfo{264, nullptr, "GetVphymDirtyFlags"}, //20.0.0+ - FunctionInfo{282, nullptr, "ConvertToProductModel"}, //20.0.0+ - FunctionInfo{283, nullptr, "ConvertToProductModelName"}, //20.0.0+ - FunctionInfo{289, nullptr, "GetDefaultAccountIdentificationFlagSet"}, //20.0.0+ - FunctionInfo{300, nullptr, "AcquirePushNotificationDirtyFlagEventHandle"}, //20.0.0+ - FunctionInfo{301, nullptr, "GetPushNotificationDirtyFlags"}, //20.0.0+ - FunctionInfo{306, nullptr, "GetPinCodeReregistrationGuideAccounts"}, //20.0.0+ - FunctionInfo{307, nullptr, "SetPinCodeReregistrationGuideAccounts"}, //20.0.0+ - FunctionInfo{315, C<&ISystemSettingsServer::GetHttpAuthConfigs>, "GetHttpAuthConfigs"}, //21.0.0+ - FunctionInfo{319, C<&ISystemSettingsServer::GetAccountUserSettings>, "GetAccountUserSettings"}, //21.0.0+ - FunctionInfo{320, nullptr, "SetAccountUserSettings"}, //21.0.0+ - FunctionInfo{321, C<&ISystemSettingsServer::GetDefaultAccountUserSettings>, "GetDefaultAccountUserSettings"} //21.0.0+ - ); + FunctionInfoBase const* FindRequest(u32 key) override; Core::System& m_system; SystemSettings m_system_settings{}; PrivateSettings m_private_settings{}; diff --git a/src/core/hle/service/ssl/ssl.cpp b/src/core/hle/service/ssl/ssl.cpp index 25b7631d5b..f49156b046 100644 --- a/src/core/hle/service/ssl/ssl.cpp +++ b/src/core/hle/service/ssl/ssl.cpp @@ -628,142 +628,99 @@ private: }; class ISslServiceForSystem final : public ServiceFramework { - public: - explicit ISslServiceForSystem(Core::System& system_) : ServiceFramework{system_, "ssl:s"} { - // clang-format off - FunctionInfoBase const* FindRequest(u32 key) override { +public: + explicit ISslServiceForSystem(Core::System& system_) : ServiceFramework{system_, "ssl:s"} {} + + 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(); + }; + + FunctionInfoBase const* 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"} - ); - }; - - 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; - }; - }; + 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/vi/application_display_service.cpp b/src/core/hle/service/vi/application_display_service.cpp index 924055885e..88030d66b4 100644 --- a/src/core/hle/service/vi/application_display_service.cpp +++ b/src/core/hle/service/vi/application_display_service.cpp @@ -17,6 +17,34 @@ namespace Service::VI { +ServiceFrameworkBase::FunctionInfoBase const* 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"}, diff --git a/src/core/hle/service/vi/application_display_service.h b/src/core/hle/service/vi/application_display_service.h index c06efaff65..eb22b28223 100644 --- a/src/core/hle/service/vi/application_display_service.h +++ b/src/core/hle/service/vi/application_display_service.h @@ -74,33 +74,7 @@ public: s64 width, s64 height); private: - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* FindRequest(u32 key) override; const std::shared_ptr m_container; KernelHelpers::ServiceContext m_context; std::mutex m_lock{}; diff --git a/src/core/hle/service/vi/application_root_service.cpp b/src/core/hle/service/vi/application_root_service.cpp index f8e68cb6e6..7c87cddce4 100644 --- a/src/core/hle/service/vi/application_root_service.cpp +++ b/src/core/hle/service/vi/application_root_service.cpp @@ -11,6 +11,14 @@ namespace Service::VI { +ServiceFrameworkBase::FunctionInfoBase const* 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)} { diff --git a/src/core/hle/service/vi/application_root_service.h b/src/core/hle/service/vi/application_root_service.h index cc0578de52..2020c55490 100644 --- a/src/core/hle/service/vi/application_root_service.h +++ b/src/core/hle/service/vi/application_root_service.h @@ -27,13 +27,7 @@ private: Policy policy); private: - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, C<&IApplicationRootService::GetDisplayService>, "GetDisplayService"}, - FunctionInfo{1, nullptr, "GetDisplayServiceWithProxyNameExchange"} - ); + FunctionInfoBase const* 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 ec5387781e..449f5efa9e 100644 --- a/src/core/hle/service/vi/manager_display_service.cpp +++ b/src/core/hle/service/vi/manager_display_service.cpp @@ -10,6 +10,93 @@ namespace Service::VI { +ServiceFrameworkBase::FunctionInfoBase const* 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)} { diff --git a/src/core/hle/service/vi/manager_display_service.h b/src/core/hle/service/vi/manager_display_service.h index 43cd02698d..d2bde2abb3 100644 --- a/src/core/hle/service/vi/manager_display_service.h +++ b/src/core/hle/service/vi/manager_display_service.h @@ -37,92 +37,7 @@ public: Result SetLayerVisibility(bool visible, u64 layer_id); private: - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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 3c5110ca09..43848c3ad8 100644 --- a/src/core/hle/service/vi/manager_root_service.cpp +++ b/src/core/hle/service/vi/manager_root_service.cpp @@ -12,6 +12,18 @@ namespace Service::VI { +ServiceFrameworkBase::FunctionInfoBase const* 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)} { diff --git a/src/core/hle/service/vi/manager_root_service.h b/src/core/hle/service/vi/manager_root_service.h index e1661dffd6..7cbe685348 100644 --- a/src/core/hle/service/vi/manager_root_service.h +++ b/src/core/hle/service/vi/manager_root_service.h @@ -26,17 +26,7 @@ public: Policy policy); private: - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* FindRequest(u32 key) override; const std::shared_ptr m_container; }; diff --git a/src/core/hle/service/vi/system_display_service.cpp b/src/core/hle/service/vi/system_display_service.cpp index f3ca92aea8..9af26740db 100644 --- a/src/core/hle/service/vi/system_display_service.cpp +++ b/src/core/hle/service/vi/system_display_service.cpp @@ -12,6 +12,59 @@ namespace Service::VI { +ServiceFrameworkBase::FunctionInfoBase const* 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)} {} diff --git a/src/core/hle/service/vi/system_display_service.h b/src/core/hle/service/vi/system_display_service.h index 12f64ac45c..f6e83863cd 100644 --- a/src/core/hle/service/vi/system_display_service.h +++ b/src/core/hle/service/vi/system_display_service.h @@ -47,58 +47,7 @@ private: Result CancelSharedFrameBuffer(u64 layer_id, s64 slot); private: - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - 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"} - ); + FunctionInfoBase const* 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 1b71634c8a..11adf7d97e 100644 --- a/src/core/hle/service/vi/system_root_service.cpp +++ b/src/core/hle/service/vi/system_root_service.cpp @@ -11,6 +11,14 @@ namespace Service::VI { +ServiceFrameworkBase::FunctionInfoBase const* 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)} {} diff --git a/src/core/hle/service/vi/system_root_service.h b/src/core/hle/service/vi/system_root_service.h index 49b4165f54..9afb3b07f4 100644 --- a/src/core/hle/service/vi/system_root_service.h +++ b/src/core/hle/service/vi/system_root_service.h @@ -26,13 +26,7 @@ private: Out> out_application_display_service, Policy policy); - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{1, C<&ISystemRootService::GetDisplayService>, "GetDisplayService"}, - FunctionInfo{3, nullptr, "GetDisplayServiceWithProxyNameExchange"} - ); + FunctionInfoBase const* FindRequest(u32 key) override; const std::shared_ptr m_container; };