summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/logging/filter.cpp2
-rw-r--r--src/common/logging/types.h202
-rw-r--r--src/common/settings.h8
-rw-r--r--src/core/CMakeLists.txt64
-rw-r--r--src/core/constants.cpp27
-rw-r--r--src/core/constants.h2
-rw-r--r--src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp21
-rw-r--r--src/core/hle/kernel/init/init_slab_setup.cpp8
-rw-r--r--src/core/hle/kernel/k_address_arbiter.cpp8
-rw-r--r--src/core/hle/kernel/k_address_space_info.cpp79
-rw-r--r--src/core/hle/kernel/k_client_port.cpp1
-rw-r--r--src/core/hle/kernel/k_client_port.h1
-rw-r--r--src/core/hle/kernel/k_client_session.cpp1
-rw-r--r--src/core/hle/kernel/k_condition_variable.cpp50
-rw-r--r--src/core/hle/kernel/k_light_lock.cpp8
-rw-r--r--src/core/hle/kernel/k_port.cpp1
-rw-r--r--src/core/hle/kernel/k_process.cpp6
-rw-r--r--src/core/hle/kernel/k_scheduler_lock.h11
-rw-r--r--src/core/hle/kernel/k_scoped_lock.h1
-rw-r--r--src/core/hle/kernel/k_server_session.cpp11
-rw-r--r--src/core/hle/kernel/k_server_session.h12
-rw-r--r--src/core/hle/kernel/k_thread.cpp271
-rw-r--r--src/core/hle/kernel/k_thread.h175
-rw-r--r--src/core/hle/kernel/kernel.cpp93
-rw-r--r--src/core/hle/kernel/kernel.h67
-rw-r--r--src/core/hle/kernel/svc_types.h1
-rw-r--r--src/core/hle/service/acc/acc.cpp68
-rw-r--r--src/core/hle/service/acc/acc.h38
-rw-r--r--src/core/hle/service/acc/async_context.cpp10
-rw-r--r--src/core/hle/service/acc/async_context.h8
-rw-r--r--src/core/hle/service/am/am.cpp238
-rw-r--r--src/core/hle/service/am/am.h195
-rw-r--r--src/core/hle/service/am/applet_ae.cpp82
-rw-r--r--src/core/hle/service/am/applet_ae.h14
-rw-r--r--src/core/hle/service/am/applet_oe.cpp42
-rw-r--r--src/core/hle/service/am/applet_oe.h10
-rw-r--r--src/core/hle/service/aoc/aoc_u.cpp30
-rw-r--r--src/core/hle/service/aoc/aoc_u.h22
-rw-r--r--src/core/hle/service/apm/apm_interface.cpp20
-rw-r--r--src/core/hle/service/apm/apm_interface.h12
-rw-r--r--src/core/hle/service/audio/audctl.cpp6
-rw-r--r--src/core/hle/service/audio/audctl.h4
-rw-r--r--src/core/hle/service/audio/audin_u.cpp32
-rw-r--r--src/core/hle/service/audio/audin_u.h14
-rw-r--r--src/core/hle/service/audio/audout_u.cpp30
-rw-r--r--src/core/hle/service/audio/audout_u.h8
-rw-r--r--src/core/hle/service/audio/audren_u.cpp56
-rw-r--r--src/core/hle/service/audio/audren_u.h14
-rw-r--r--src/core/hle/service/audio/hwopus.cpp22
-rw-r--r--src/core/hle/service/audio/hwopus.h10
-rw-r--r--src/core/hle/service/bcat/bcat_module.cpp48
-rw-r--r--src/core/hle/service/bcat/bcat_module.h6
-rw-r--r--src/core/hle/service/btdrv/btdrv.cpp4
-rw-r--r--src/core/hle/service/btm/btm.cpp14
-rw-r--r--src/core/hle/service/caps/caps_a.h4
-rw-r--r--src/core/hle/service/caps/caps_c.cpp4
-rw-r--r--src/core/hle/service/caps/caps_c.h6
-rw-r--r--src/core/hle/service/caps/caps_su.cpp4
-rw-r--r--src/core/hle/service/caps/caps_su.h6
-rw-r--r--src/core/hle/service/caps/caps_u.cpp8
-rw-r--r--src/core/hle/service/caps/caps_u.h10
-rw-r--r--src/core/hle/service/es/es.cpp24
-rw-r--r--src/core/hle/service/fatal/fatal.cpp8
-rw-r--r--src/core/hle/service/fatal/fatal.h6
-rw-r--r--src/core/hle/service/fgm/fgm.cpp4
-rw-r--r--src/core/hle/service/filesystem/fsp_srv.cpp95
-rw-r--r--src/core/hle/service/filesystem/fsp_srv.h40
-rw-r--r--src/core/hle/service/friend/friend.cpp26
-rw-r--r--src/core/hle/service/friend/friend.h4
-rw-r--r--src/core/hle/service/glue/arp.cpp20
-rw-r--r--src/core/hle/service/glue/arp.h12
-rw-r--r--src/core/hle/service/glue/bgtc.cpp4
-rw-r--r--src/core/hle/service/glue/bgtc.h2
-rw-r--r--src/core/hle/service/glue/notif.cpp14
-rw-r--r--src/core/hle/service/glue/notif.h12
-rw-r--r--src/core/hle/service/hid/hid.cpp228
-rw-r--r--src/core/hle/service/hid/hid.h220
-rw-r--r--src/core/hle/service/hid/hidbus.cpp28
-rw-r--r--src/core/hle/service/hid/hidbus.h26
-rw-r--r--src/core/hle/service/hid/irs.cpp38
-rw-r--r--src/core/hle/service/hid/irs.h36
-rw-r--r--src/core/hle/service/hle_ipc.cpp (renamed from src/core/hle/kernel/hle_ipc.cpp)33
-rw-r--r--src/core/hle/service/hle_ipc.h (renamed from src/core/hle/kernel/hle_ipc.h)77
-rw-r--r--src/core/hle/service/ipc_helpers.h (renamed from src/core/hle/ipc_helpers.h)12
-rw-r--r--src/core/hle/service/jit/jit.cpp12
-rw-r--r--src/core/hle/service/lbl/lbl.cpp52
-rw-r--r--src/core/hle/service/ldn/ldn.cpp74
-rw-r--r--src/core/hle/service/ldn/ldn.h2
-rw-r--r--src/core/hle/service/ldr/ldr.cpp12
-rw-r--r--src/core/hle/service/lm/lm.cpp8
-rw-r--r--src/core/hle/service/mii/mii.cpp26
-rw-r--r--src/core/hle/service/mm/mm_u.cpp18
-rw-r--r--src/core/hle/service/mnpp/mnpp_app.cpp6
-rw-r--r--src/core/hle/service/ncm/ncm.cpp2
-rw-r--r--src/core/hle/service/nfc/mifare_user.cpp30
-rw-r--r--src/core/hle/service/nfc/mifare_user.h28
-rw-r--r--src/core/hle/service/nfc/nfc.cpp10
-rw-r--r--src/core/hle/service/nfc/nfc_device.cpp2
-rw-r--r--src/core/hle/service/nfc/nfc_user.cpp30
-rw-r--r--src/core/hle/service/nfc/nfc_user.h28
-rw-r--r--src/core/hle/service/nfp/nfp.cpp4
-rw-r--r--src/core/hle/service/nfp/nfp_device.cpp2
-rw-r--r--src/core/hle/service/nfp/nfp_user.cpp52
-rw-r--r--src/core/hle/service/nfp/nfp_user.h50
-rw-r--r--src/core/hle/service/ngct/ngct.cpp6
-rw-r--r--src/core/hle/service/nifm/nifm.cpp44
-rw-r--r--src/core/hle/service/nifm/nifm.h24
-rw-r--r--src/core/hle/service/nim/nim.cpp28
-rw-r--r--src/core/hle/service/ns/iplatform_service_manager.cpp14
-rw-r--r--src/core/hle/service/ns/iplatform_service_manager.h12
-rw-r--r--src/core/hle/service/ns/ns.cpp15
-rw-r--r--src/core/hle/service/ns/ns.h14
-rw-r--r--src/core/hle/service/ns/pdm_qry.cpp4
-rw-r--r--src/core/hle/service/ns/pdm_qry.h2
-rw-r--r--src/core/hle/service/nvdrv/devices/nvdisp_disp0.h4
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.cpp8
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.h10
-rw-r--r--src/core/hle/service/nvdrv/nvdrv_interface.cpp26
-rw-r--r--src/core/hle/service/nvdrv/nvdrv_interface.h26
-rw-r--r--src/core/hle/service/nvdrv/nvmemp.cpp4
-rw-r--r--src/core/hle/service/nvdrv/nvmemp.h4
-rw-r--r--src/core/hle/service/nvnflinger/binder.h (renamed from src/core/hle/service/nvflinger/binder.h)8
-rw-r--r--src/core/hle/service/nvnflinger/buffer_item.h (renamed from src/core/hle/service/nvflinger/buffer_item.h)4
-rw-r--r--src/core/hle/service/nvnflinger/buffer_item_consumer.cpp (renamed from src/core/hle/service/nvflinger/buffer_item_consumer.cpp)12
-rw-r--r--src/core/hle/service/nvnflinger/buffer_item_consumer.h (renamed from src/core/hle/service/nvflinger/buffer_item_consumer.h)4
-rw-r--r--src/core/hle/service/nvnflinger/buffer_queue_consumer.cpp (renamed from src/core/hle/service/nvflinger/buffer_queue_consumer.cpp)40
-rw-r--r--src/core/hle/service/nvnflinger/buffer_queue_consumer.h (renamed from src/core/hle/service/nvflinger/buffer_queue_consumer.h)4
-rw-r--r--src/core/hle/service/nvnflinger/buffer_queue_core.cpp (renamed from src/core/hle/service/nvflinger/buffer_queue_core.cpp)4
-rw-r--r--src/core/hle/service/nvnflinger/buffer_queue_core.h (renamed from src/core/hle/service/nvflinger/buffer_queue_core.h)10
-rw-r--r--src/core/hle/service/nvnflinger/buffer_queue_defs.h (renamed from src/core/hle/service/nvflinger/buffer_queue_defs.h)2
-rw-r--r--src/core/hle/service/nvnflinger/buffer_queue_producer.cpp (renamed from src/core/hle/service/nvflinger/buffer_queue_producer.cpp)140
-rw-r--r--src/core/hle/service/nvnflinger/buffer_queue_producer.h (renamed from src/core/hle/service/nvflinger/buffer_queue_producer.h)16
-rw-r--r--src/core/hle/service/nvnflinger/buffer_slot.h (renamed from src/core/hle/service/nvflinger/buffer_slot.h)2
-rw-r--r--src/core/hle/service/nvnflinger/buffer_transform_flags.h (renamed from src/core/hle/service/nvflinger/buffer_transform_flags.h)0
-rw-r--r--src/core/hle/service/nvnflinger/consumer_base.cpp (renamed from src/core/hle/service/nvflinger/consumer_base.cpp)24
-rw-r--r--src/core/hle/service/nvnflinger/consumer_base.h (renamed from src/core/hle/service/nvflinger/consumer_base.h)6
-rw-r--r--src/core/hle/service/nvnflinger/consumer_listener.h (renamed from src/core/hle/service/nvflinger/consumer_listener.h)0
-rw-r--r--src/core/hle/service/nvnflinger/graphic_buffer_producer.cpp (renamed from src/core/hle/service/nvflinger/graphic_buffer_producer.cpp)4
-rw-r--r--src/core/hle/service/nvnflinger/graphic_buffer_producer.h (renamed from src/core/hle/service/nvflinger/graphic_buffer_producer.h)4
-rw-r--r--src/core/hle/service/nvnflinger/hos_binder_driver_server.cpp (renamed from src/core/hle/service/nvflinger/hos_binder_driver_server.cpp)6
-rw-r--r--src/core/hle/service/nvnflinger/hos_binder_driver_server.h (renamed from src/core/hle/service/nvflinger/hos_binder_driver_server.h)6
-rw-r--r--src/core/hle/service/nvnflinger/nvnflinger.cpp (renamed from src/core/hle/service/nvflinger/nvflinger.cpp)58
-rw-r--r--src/core/hle/service/nvnflinger/nvnflinger.h (renamed from src/core/hle/service/nvflinger/nvflinger.h)10
-rw-r--r--src/core/hle/service/nvnflinger/parcel.h (renamed from src/core/hle/service/nvflinger/parcel.h)0
-rw-r--r--src/core/hle/service/nvnflinger/pixel_format.h (renamed from src/core/hle/service/nvflinger/pixel_format.h)0
-rw-r--r--src/core/hle/service/nvnflinger/producer_listener.h (renamed from src/core/hle/service/nvflinger/producer_listener.h)0
-rw-r--r--src/core/hle/service/nvnflinger/status.h (renamed from src/core/hle/service/nvflinger/status.h)0
-rw-r--r--src/core/hle/service/nvnflinger/ui/fence.h (renamed from src/core/hle/service/nvflinger/ui/fence.h)0
-rw-r--r--src/core/hle/service/nvnflinger/ui/graphic_buffer.h (renamed from src/core/hle/service/nvflinger/ui/graphic_buffer.h)2
-rw-r--r--src/core/hle/service/nvnflinger/window.h (renamed from src/core/hle/service/nvflinger/window.h)0
-rw-r--r--src/core/hle/service/olsc/olsc.cpp8
-rw-r--r--src/core/hle/service/pctl/pctl_module.cpp28
-rw-r--r--src/core/hle/service/pctl/pctl_module.h4
-rw-r--r--src/core/hle/service/pcv/pcv.cpp8
-rw-r--r--src/core/hle/service/pm/pm.cpp20
-rw-r--r--src/core/hle/service/prepo/prepo.cpp16
-rw-r--r--src/core/hle/service/psc/psc.cpp22
-rw-r--r--src/core/hle/service/ptm/psm.cpp18
-rw-r--r--src/core/hle/service/ptm/psm.h6
-rw-r--r--src/core/hle/service/ptm/ts.cpp6
-rw-r--r--src/core/hle/service/ptm/ts.h4
-rw-r--r--src/core/hle/service/server_manager.cpp22
-rw-r--r--src/core/hle/service/server_manager.h27
-rw-r--r--src/core/hle/service/service.cpp20
-rw-r--r--src/core/hle/service/service.h30
-rw-r--r--src/core/hle/service/set/set.cpp30
-rw-r--r--src/core/hle/service/set/set.h22
-rw-r--r--src/core/hle/service/set/set_sys.cpp18
-rw-r--r--src/core/hle/service/set/set_sys.h14
-rw-r--r--src/core/hle/service/sm/sm.cpp18
-rw-r--r--src/core/hle/service/sm/sm.h22
-rw-r--r--src/core/hle/service/sm/sm_controller.cpp10
-rw-r--r--src/core/hle/service/sm/sm_controller.h8
-rw-r--r--src/core/hle/service/sockets/bsd.cpp66
-rw-r--r--src/core/hle/service/sockets/bsd.h64
-rw-r--r--src/core/hle/service/sockets/sfdnsres.cpp8
-rw-r--r--src/core/hle/service/sockets/sfdnsres.h4
-rw-r--r--src/core/hle/service/spl/spl_module.cpp16
-rw-r--r--src/core/hle/service/spl/spl_module.h14
-rw-r--r--src/core/hle/service/ssl/ssl.cpp90
-rw-r--r--src/core/hle/service/time/time.cpp34
-rw-r--r--src/core/hle/service/time/time.h24
-rw-r--r--src/core/hle/service/time/time_zone_service.cpp14
-rw-r--r--src/core/hle/service/time/time_zone_service.h12
-rw-r--r--src/core/hle/service/usb/usb.cpp72
-rw-r--r--src/core/hle/service/vi/display/vi_display.cpp12
-rw-r--r--src/core/hle/service/vi/display/vi_display.h8
-rw-r--r--src/core/hle/service/vi/vi.cpp98
-rw-r--r--src/core/hle/service/vi/vi.h18
-rw-r--r--src/core/hle/service/vi/vi_m.cpp6
-rw-r--r--src/core/hle/service/vi/vi_m.h20
-rw-r--r--src/core/hle/service/vi/vi_s.cpp6
-rw-r--r--src/core/hle/service/vi/vi_s.h20
-rw-r--r--src/core/hle/service/vi/vi_u.cpp6
-rw-r--r--src/core/hle/service/vi/vi_u.h20
-rw-r--r--src/core/reporter.cpp6
-rw-r--r--src/core/reporter.h6
-rw-r--r--src/input_common/helpers/joycon_protocol/joycon_types.h12
-rw-r--r--src/input_common/helpers/joycon_protocol/poller.cpp95
-rw-r--r--src/input_common/helpers/joycon_protocol/poller.h9
-rw-r--r--src/video_core/buffer_cache/buffer_cache.h53
-rw-r--r--src/video_core/engines/maxwell_dma.cpp107
-rw-r--r--src/video_core/engines/maxwell_dma.h88
-rw-r--r--src/video_core/framebuffer_config.h4
-rw-r--r--src/video_core/renderer_null/null_rasterizer.h8
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h10
-rw-r--r--src/video_core/renderer_vulkan/vk_rasterizer.cpp234
-rw-r--r--src/video_core/renderer_vulkan/vk_rasterizer.h11
-rw-r--r--src/video_core/renderer_vulkan/vk_texture_cache.cpp14
-rw-r--r--src/video_core/texture_cache/image_info.cpp45
-rw-r--r--src/video_core/texture_cache/image_info.h2
-rw-r--r--src/video_core/texture_cache/texture_cache.h69
-rw-r--r--src/video_core/texture_cache/texture_cache_base.h5
-rw-r--r--src/video_core/texture_cache/types.h1
-rw-r--r--src/video_core/texture_cache/util.cpp98
-rw-r--r--src/video_core/texture_cache/util.h10
-rw-r--r--src/video_core/vulkan_common/vulkan_device.cpp1
217 files changed, 3490 insertions, 2669 deletions
diff --git a/src/common/logging/filter.cpp b/src/common/logging/filter.cpp
index a959acb74..c95909561 100644
--- a/src/common/logging/filter.cpp
+++ b/src/common/logging/filter.cpp
@@ -119,7 +119,7 @@ bool ParseFilterRule(Filter& instance, Iterator begin, Iterator end) {
119 SUB(Service, NPNS) \ 119 SUB(Service, NPNS) \
120 SUB(Service, NS) \ 120 SUB(Service, NS) \
121 SUB(Service, NVDRV) \ 121 SUB(Service, NVDRV) \
122 SUB(Service, NVFlinger) \ 122 SUB(Service, Nvnflinger) \
123 SUB(Service, OLSC) \ 123 SUB(Service, OLSC) \
124 SUB(Service, PCIE) \ 124 SUB(Service, PCIE) \
125 SUB(Service, PCTL) \ 125 SUB(Service, PCTL) \
diff --git a/src/common/logging/types.h b/src/common/logging/types.h
index 595c15ada..8356e3183 100644
--- a/src/common/logging/types.h
+++ b/src/common/logging/types.h
@@ -29,107 +29,107 @@ enum class Level : u8 {
29 * filter.cpp. 29 * filter.cpp.
30 */ 30 */
31enum class Class : u8 { 31enum class Class : u8 {
32 Log, ///< Messages about the log system itself 32 Log, ///< Messages about the log system itself
33 Common, ///< Library routines 33 Common, ///< Library routines
34 Common_Filesystem, ///< Filesystem interface library 34 Common_Filesystem, ///< Filesystem interface library
35 Common_Memory, ///< Memory mapping and management functions 35 Common_Memory, ///< Memory mapping and management functions
36 Core, ///< LLE emulation core 36 Core, ///< LLE emulation core
37 Core_ARM, ///< ARM CPU core 37 Core_ARM, ///< ARM CPU core
38 Core_Timing, ///< CoreTiming functions 38 Core_Timing, ///< CoreTiming functions
39 Config, ///< Emulator configuration (including commandline) 39 Config, ///< Emulator configuration (including commandline)
40 Debug, ///< Debugging tools 40 Debug, ///< Debugging tools
41 Debug_Emulated, ///< Debug messages from the emulated programs 41 Debug_Emulated, ///< Debug messages from the emulated programs
42 Debug_GPU, ///< GPU debugging tools 42 Debug_GPU, ///< GPU debugging tools
43 Debug_Breakpoint, ///< Logging breakpoints and watchpoints 43 Debug_Breakpoint, ///< Logging breakpoints and watchpoints
44 Debug_GDBStub, ///< GDB Stub 44 Debug_GDBStub, ///< GDB Stub
45 Kernel, ///< The HLE implementation of the CTR kernel 45 Kernel, ///< The HLE implementation of the CTR kernel
46 Kernel_SVC, ///< Kernel system calls 46 Kernel_SVC, ///< Kernel system calls
47 Service, ///< HLE implementation of system services. Each major service 47 Service, ///< HLE implementation of system services. Each major service
48 ///< should have its own subclass. 48 ///< should have its own subclass.
49 Service_ACC, ///< The ACC (Accounts) service 49 Service_ACC, ///< The ACC (Accounts) service
50 Service_AM, ///< The AM (Applet manager) service 50 Service_AM, ///< The AM (Applet manager) service
51 Service_AOC, ///< The AOC (AddOn Content) service 51 Service_AOC, ///< The AOC (AddOn Content) service
52 Service_APM, ///< The APM (Performance) service 52 Service_APM, ///< The APM (Performance) service
53 Service_ARP, ///< The ARP service 53 Service_ARP, ///< The ARP service
54 Service_Audio, ///< The Audio (Audio control) service 54 Service_Audio, ///< The Audio (Audio control) service
55 Service_BCAT, ///< The BCAT service 55 Service_BCAT, ///< The BCAT service
56 Service_BGTC, ///< The BGTC (Background Task Controller) service 56 Service_BGTC, ///< The BGTC (Background Task Controller) service
57 Service_BPC, ///< The BPC service 57 Service_BPC, ///< The BPC service
58 Service_BTDRV, ///< The Bluetooth driver service 58 Service_BTDRV, ///< The Bluetooth driver service
59 Service_BTM, ///< The BTM service 59 Service_BTM, ///< The BTM service
60 Service_Capture, ///< The capture service 60 Service_Capture, ///< The capture service
61 Service_ERPT, ///< The error reporting service 61 Service_ERPT, ///< The error reporting service
62 Service_ETicket, ///< The ETicket service 62 Service_ETicket, ///< The ETicket service
63 Service_EUPLD, ///< The error upload service 63 Service_EUPLD, ///< The error upload service
64 Service_Fatal, ///< The Fatal service 64 Service_Fatal, ///< The Fatal service
65 Service_FGM, ///< The FGM service 65 Service_FGM, ///< The FGM service
66 Service_Friend, ///< The friend service 66 Service_Friend, ///< The friend service
67 Service_FS, ///< The FS (Filesystem) service 67 Service_FS, ///< The FS (Filesystem) service
68 Service_GRC, ///< The game recording service 68 Service_GRC, ///< The game recording service
69 Service_HID, ///< The HID (Human interface device) service 69 Service_HID, ///< The HID (Human interface device) service
70 Service_IRS, ///< The IRS service 70 Service_IRS, ///< The IRS service
71 Service_JIT, ///< The JIT service 71 Service_JIT, ///< The JIT service
72 Service_LBL, ///< The LBL (LCD backlight) service 72 Service_LBL, ///< The LBL (LCD backlight) service
73 Service_LDN, ///< The LDN (Local domain network) service 73 Service_LDN, ///< The LDN (Local domain network) service
74 Service_LDR, ///< The loader service 74 Service_LDR, ///< The loader service
75 Service_LM, ///< The LM (Logger) service 75 Service_LM, ///< The LM (Logger) service
76 Service_Migration, ///< The migration service 76 Service_Migration, ///< The migration service
77 Service_Mii, ///< The Mii service 77 Service_Mii, ///< The Mii service
78 Service_MM, ///< The MM (Multimedia) service 78 Service_MM, ///< The MM (Multimedia) service
79 Service_MNPP, ///< The MNPP service 79 Service_MNPP, ///< The MNPP service
80 Service_NCM, ///< The NCM service 80 Service_NCM, ///< The NCM service
81 Service_NFC, ///< The NFC (Near-field communication) service 81 Service_NFC, ///< The NFC (Near-field communication) service
82 Service_NFP, ///< The NFP service 82 Service_NFP, ///< The NFP service
83 Service_NGCT, ///< The NGCT (No Good Content for Terra) service 83 Service_NGCT, ///< The NGCT (No Good Content for Terra) service
84 Service_NIFM, ///< The NIFM (Network interface) service 84 Service_NIFM, ///< The NIFM (Network interface) service
85 Service_NIM, ///< The NIM service 85 Service_NIM, ///< The NIM service
86 Service_NOTIF, ///< The NOTIF (Notification) service 86 Service_NOTIF, ///< The NOTIF (Notification) service
87 Service_NPNS, ///< The NPNS service 87 Service_NPNS, ///< The NPNS service
88 Service_NS, ///< The NS services 88 Service_NS, ///< The NS services
89 Service_NVDRV, ///< The NVDRV (Nvidia driver) service 89 Service_NVDRV, ///< The NVDRV (Nvidia driver) service
90 Service_NVFlinger, ///< The NVFlinger service 90 Service_Nvnflinger, ///< The Nvnflinger service
91 Service_OLSC, ///< The OLSC service 91 Service_OLSC, ///< The OLSC service
92 Service_PCIE, ///< The PCIe service 92 Service_PCIE, ///< The PCIe service
93 Service_PCTL, ///< The PCTL (Parental control) service 93 Service_PCTL, ///< The PCTL (Parental control) service
94 Service_PCV, ///< The PCV service 94 Service_PCV, ///< The PCV service
95 Service_PM, ///< The PM service 95 Service_PM, ///< The PM service
96 Service_PREPO, ///< The PREPO (Play report) service 96 Service_PREPO, ///< The PREPO (Play report) service
97 Service_PSC, ///< The PSC service 97 Service_PSC, ///< The PSC service
98 Service_PTM, ///< The PTM service 98 Service_PTM, ///< The PTM service
99 Service_SET, ///< The SET (Settings) service 99 Service_SET, ///< The SET (Settings) service
100 Service_SM, ///< The SM (Service manager) service 100 Service_SM, ///< The SM (Service manager) service
101 Service_SPL, ///< The SPL service 101 Service_SPL, ///< The SPL service
102 Service_SSL, ///< The SSL service 102 Service_SSL, ///< The SSL service
103 Service_TCAP, ///< The TCAP service. 103 Service_TCAP, ///< The TCAP service.
104 Service_Time, ///< The time service 104 Service_Time, ///< The time service
105 Service_USB, ///< The USB (Universal Serial Bus) service 105 Service_USB, ///< The USB (Universal Serial Bus) service
106 Service_VI, ///< The VI (Video interface) service 106 Service_VI, ///< The VI (Video interface) service
107 Service_WLAN, ///< The WLAN (Wireless local area network) service 107 Service_WLAN, ///< The WLAN (Wireless local area network) service
108 HW, ///< Low-level hardware emulation 108 HW, ///< Low-level hardware emulation
109 HW_Memory, ///< Memory-map and address translation 109 HW_Memory, ///< Memory-map and address translation
110 HW_LCD, ///< LCD register emulation 110 HW_LCD, ///< LCD register emulation
111 HW_GPU, ///< GPU control emulation 111 HW_GPU, ///< GPU control emulation
112 HW_AES, ///< AES engine emulation 112 HW_AES, ///< AES engine emulation
113 IPC, ///< IPC interface 113 IPC, ///< IPC interface
114 Frontend, ///< Emulator UI 114 Frontend, ///< Emulator UI
115 Render, ///< Emulator video output and hardware acceleration 115 Render, ///< Emulator video output and hardware acceleration
116 Render_Software, ///< Software renderer backend 116 Render_Software, ///< Software renderer backend
117 Render_OpenGL, ///< OpenGL backend 117 Render_OpenGL, ///< OpenGL backend
118 Render_Vulkan, ///< Vulkan backend 118 Render_Vulkan, ///< Vulkan backend
119 Shader, ///< Shader recompiler 119 Shader, ///< Shader recompiler
120 Shader_SPIRV, ///< Shader SPIR-V code generation 120 Shader_SPIRV, ///< Shader SPIR-V code generation
121 Shader_GLASM, ///< Shader GLASM code generation 121 Shader_GLASM, ///< Shader GLASM code generation
122 Shader_GLSL, ///< Shader GLSL code generation 122 Shader_GLSL, ///< Shader GLSL code generation
123 Audio, ///< Audio emulation 123 Audio, ///< Audio emulation
124 Audio_DSP, ///< The HLE implementation of the DSP 124 Audio_DSP, ///< The HLE implementation of the DSP
125 Audio_Sink, ///< Emulator audio output backend 125 Audio_Sink, ///< Emulator audio output backend
126 Loader, ///< ROM loader 126 Loader, ///< ROM loader
127 CheatEngine, ///< Memory manipulation and engine VM functions 127 CheatEngine, ///< Memory manipulation and engine VM functions
128 Crypto, ///< Cryptographic engine/functions 128 Crypto, ///< Cryptographic engine/functions
129 Input, ///< Input emulation 129 Input, ///< Input emulation
130 Network, ///< Network emulation 130 Network, ///< Network emulation
131 WebService, ///< Interface to yuzu Web Services 131 WebService, ///< Interface to yuzu Web Services
132 Count ///< Total number of logging classes 132 Count ///< Total number of logging classes
133}; 133};
134 134
135} // namespace Common::Log 135} // namespace Common::Log
diff --git a/src/common/settings.h b/src/common/settings.h
index 512ecff69..1ae28ce93 100644
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -128,7 +128,7 @@ public:
128 /** 128 /**
129 * Sets a default value, label, and setting value. 129 * Sets a default value, label, and setting value.
130 * 130 *
131 * @param default_val Intial value of the setting, and default value of the setting 131 * @param default_val Initial value of the setting, and default value of the setting
132 * @param name Label for the setting 132 * @param name Label for the setting
133 */ 133 */
134 explicit Setting(const Type& default_val, const std::string& name) 134 explicit Setting(const Type& default_val, const std::string& name)
@@ -139,7 +139,7 @@ public:
139 /** 139 /**
140 * Sets a default value, minimum value, maximum value, and label. 140 * Sets a default value, minimum value, maximum value, and label.
141 * 141 *
142 * @param default_val Intial value of the setting, and default value of the setting 142 * @param default_val Initial value of the setting, and default value of the setting
143 * @param min_val Sets the minimum allowed value of the setting 143 * @param min_val Sets the minimum allowed value of the setting
144 * @param max_val Sets the maximum allowed value of the setting 144 * @param max_val Sets the maximum allowed value of the setting
145 * @param name Label for the setting 145 * @param name Label for the setting
@@ -231,7 +231,7 @@ public:
231 /** 231 /**
232 * Sets a default value, label, and setting value. 232 * Sets a default value, label, and setting value.
233 * 233 *
234 * @param default_val Intial value of the setting, and default value of the setting 234 * @param default_val Initial value of the setting, and default value of the setting
235 * @param name Label for the setting 235 * @param name Label for the setting
236 */ 236 */
237 explicit SwitchableSetting(const Type& default_val, const std::string& name) 237 explicit SwitchableSetting(const Type& default_val, const std::string& name)
@@ -242,7 +242,7 @@ public:
242 /** 242 /**
243 * Sets a default value, minimum value, maximum value, and label. 243 * Sets a default value, minimum value, maximum value, and label.
244 * 244 *
245 * @param default_val Intial value of the setting, and default value of the setting 245 * @param default_val Initial value of the setting, and default value of the setting
246 * @param min_val Sets the minimum allowed value of the setting 246 * @param min_val Sets the minimum allowed value of the setting
247 * @param max_val Sets the maximum allowed value of the setting 247 * @param max_val Sets the maximum allowed value of the setting
248 * @param name Label for the setting 248 * @param name Label for the setting
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index cdebb0bd8..4a1a8bb43 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -158,7 +158,6 @@ add_library(core STATIC
158 hid/motion_input.h 158 hid/motion_input.h
159 hle/api_version.h 159 hle/api_version.h
160 hle/ipc.h 160 hle/ipc.h
161 hle/ipc_helpers.h
162 hle/kernel/board/nintendo/nx/k_memory_layout.h 161 hle/kernel/board/nintendo/nx/k_memory_layout.h
163 hle/kernel/board/nintendo/nx/k_system_control.cpp 162 hle/kernel/board/nintendo/nx/k_system_control.cpp
164 hle/kernel/board/nintendo/nx/k_system_control.h 163 hle/kernel/board/nintendo/nx/k_system_control.h
@@ -168,8 +167,6 @@ add_library(core STATIC
168 hle/kernel/svc_results.h 167 hle/kernel/svc_results.h
169 hle/kernel/global_scheduler_context.cpp 168 hle/kernel/global_scheduler_context.cpp
170 hle/kernel/global_scheduler_context.h 169 hle/kernel/global_scheduler_context.h
171 hle/kernel/hle_ipc.cpp
172 hle/kernel/hle_ipc.h
173 hle/kernel/init/init_slab_setup.cpp 170 hle/kernel/init/init_slab_setup.cpp
174 hle/kernel/init/init_slab_setup.h 171 hle/kernel/init/init_slab_setup.h
175 hle/kernel/initial_process.h 172 hle/kernel/initial_process.h
@@ -629,35 +626,35 @@ add_library(core STATIC
629 hle/service/nvdrv/nvdrv_interface.h 626 hle/service/nvdrv/nvdrv_interface.h
630 hle/service/nvdrv/nvmemp.cpp 627 hle/service/nvdrv/nvmemp.cpp
631 hle/service/nvdrv/nvmemp.h 628 hle/service/nvdrv/nvmemp.h
632 hle/service/nvflinger/binder.h 629 hle/service/nvnflinger/binder.h
633 hle/service/nvflinger/buffer_item.h 630 hle/service/nvnflinger/buffer_item.h
634 hle/service/nvflinger/buffer_item_consumer.cpp 631 hle/service/nvnflinger/buffer_item_consumer.cpp
635 hle/service/nvflinger/buffer_item_consumer.h 632 hle/service/nvnflinger/buffer_item_consumer.h
636 hle/service/nvflinger/buffer_queue_consumer.cpp 633 hle/service/nvnflinger/buffer_queue_consumer.cpp
637 hle/service/nvflinger/buffer_queue_consumer.h 634 hle/service/nvnflinger/buffer_queue_consumer.h
638 hle/service/nvflinger/buffer_queue_core.cpp 635 hle/service/nvnflinger/buffer_queue_core.cpp
639 hle/service/nvflinger/buffer_queue_core.h 636 hle/service/nvnflinger/buffer_queue_core.h
640 hle/service/nvflinger/buffer_queue_defs.h 637 hle/service/nvnflinger/buffer_queue_defs.h
641 hle/service/nvflinger/buffer_queue_producer.cpp 638 hle/service/nvnflinger/buffer_queue_producer.cpp
642 hle/service/nvflinger/buffer_queue_producer.h 639 hle/service/nvnflinger/buffer_queue_producer.h
643 hle/service/nvflinger/buffer_slot.h 640 hle/service/nvnflinger/buffer_slot.h
644 hle/service/nvflinger/buffer_transform_flags.h 641 hle/service/nvnflinger/buffer_transform_flags.h
645 hle/service/nvflinger/consumer_base.cpp 642 hle/service/nvnflinger/consumer_base.cpp
646 hle/service/nvflinger/consumer_base.h 643 hle/service/nvnflinger/consumer_base.h
647 hle/service/nvflinger/consumer_listener.h 644 hle/service/nvnflinger/consumer_listener.h
648 hle/service/nvflinger/graphic_buffer_producer.cpp 645 hle/service/nvnflinger/graphic_buffer_producer.cpp
649 hle/service/nvflinger/graphic_buffer_producer.h 646 hle/service/nvnflinger/graphic_buffer_producer.h
650 hle/service/nvflinger/hos_binder_driver_server.cpp 647 hle/service/nvnflinger/hos_binder_driver_server.cpp
651 hle/service/nvflinger/hos_binder_driver_server.h 648 hle/service/nvnflinger/hos_binder_driver_server.h
652 hle/service/nvflinger/nvflinger.cpp 649 hle/service/nvnflinger/nvnflinger.cpp
653 hle/service/nvflinger/nvflinger.h 650 hle/service/nvnflinger/nvnflinger.h
654 hle/service/nvflinger/parcel.h 651 hle/service/nvnflinger/parcel.h
655 hle/service/nvflinger/pixel_format.h 652 hle/service/nvnflinger/pixel_format.h
656 hle/service/nvflinger/producer_listener.h 653 hle/service/nvnflinger/producer_listener.h
657 hle/service/nvflinger/status.h 654 hle/service/nvnflinger/status.h
658 hle/service/nvflinger/ui/fence.h 655 hle/service/nvnflinger/ui/fence.h
659 hle/service/nvflinger/ui/graphic_buffer.h 656 hle/service/nvnflinger/ui/graphic_buffer.h
660 hle/service/nvflinger/window.h 657 hle/service/nvnflinger/window.h
661 hle/service/olsc/olsc.cpp 658 hle/service/olsc/olsc.cpp
662 hle/service/olsc/olsc.h 659 hle/service/olsc/olsc.h
663 hle/service/pcie/pcie.cpp 660 hle/service/pcie/pcie.cpp
@@ -680,6 +677,9 @@ add_library(core STATIC
680 hle/service/ptm/ptm.h 677 hle/service/ptm/ptm.h
681 hle/service/ptm/ts.cpp 678 hle/service/ptm/ts.cpp
682 hle/service/ptm/ts.h 679 hle/service/ptm/ts.h
680 hle/service/hle_ipc.cpp
681 hle/service/hle_ipc.h
682 hle/service/ipc_helpers.h
683 hle/service/kernel_helpers.cpp 683 hle/service/kernel_helpers.cpp
684 hle/service/kernel_helpers.h 684 hle/service/kernel_helpers.h
685 hle/service/mutex.cpp 685 hle/service/mutex.cpp
diff --git a/src/core/constants.cpp b/src/core/constants.cpp
index 4430173ef..760dc5f23 100644
--- a/src/core/constants.cpp
+++ b/src/core/constants.cpp
@@ -4,13 +4,24 @@
4#include "core/constants.h" 4#include "core/constants.h"
5 5
6namespace Core::Constants { 6namespace Core::Constants {
7const std::array<u8, 107> ACCOUNT_BACKUP_JPEG{{ 7const std::array<u8, 287> ACCOUNT_BACKUP_JPEG{{
8 0xff, 0xd8, 0xff, 0xdb, 0x00, 0x43, 0x00, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x02, 0x02, 8 0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01, 0x01, 0x01, 0x00, 0x48,
9 0x02, 0x03, 0x03, 0x03, 0x03, 0x04, 0x06, 0x04, 0x04, 0x04, 0x04, 0x04, 0x08, 0x06, 0x06, 0x05, 9 0x00, 0x48, 0x00, 0x00, 0xff, 0xdb, 0x00, 0x43, 0x00, 0x06, 0x04, 0x04, 0x04, 0x05, 0x04, 0x06,
10 0x06, 0x09, 0x08, 0x0a, 0x0a, 0x09, 0x08, 0x09, 0x09, 0x0a, 0x0c, 0x0f, 0x0c, 0x0a, 0x0b, 0x0e, 10 0x05, 0x05, 0x06, 0x09, 0x06, 0x05, 0x06, 0x09, 0x0b, 0x08, 0x06, 0x06, 0x08, 0x0b, 0x0c, 0x0a,
11 0x0b, 0x09, 0x09, 0x0d, 0x11, 0x0d, 0x0e, 0x0f, 0x10, 0x10, 0x11, 0x10, 0x0a, 0x0c, 0x12, 0x13, 11 0x0a, 0x0b, 0x0a, 0x0a, 0x0c, 0x10, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x10, 0x0c, 0x0e, 0x0f,
12 0x12, 0x10, 0x13, 0x0f, 0x10, 0x10, 0x10, 0xff, 0xc9, 0x00, 0x0b, 0x08, 0x00, 0x01, 0x00, 0x01, 12 0x10, 0x0f, 0x0e, 0x0c, 0x13, 0x13, 0x14, 0x14, 0x13, 0x13, 0x1c, 0x1b, 0x1b, 0x1b, 0x1c, 0x20,
13 0x01, 0x01, 0x11, 0x00, 0xff, 0xcc, 0x00, 0x06, 0x00, 0x10, 0x10, 0x05, 0xff, 0xda, 0x00, 0x08, 13 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xff, 0xdb, 0x00, 0x43, 0x01, 0x07, 0x07,
14 0x01, 0x01, 0x00, 0x00, 0x3f, 0x00, 0xd2, 0xcf, 0x20, 0xff, 0xd9, 14 0x07, 0x0d, 0x0c, 0x0d, 0x18, 0x10, 0x10, 0x18, 0x1a, 0x15, 0x11, 0x15, 0x1a, 0x20, 0x20, 0x20,
15 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
16 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
17 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xff, 0xc0,
18 0x00, 0x11, 0x08, 0x00, 0x20, 0x00, 0x20, 0x03, 0x01, 0x22, 0x00, 0x02, 0x11, 0x01, 0x03, 0x11,
19 0x01, 0xff, 0xc4, 0x00, 0x14, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
20 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xc4, 0x00, 0x14, 0x10, 0x01, 0x00, 0x00, 0x00,
21 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xc4, 0x00,
22 0x14, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
23 0x00, 0x00, 0x00, 0xff, 0xc4, 0x00, 0x14, 0x11, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
24 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xda, 0x00, 0x0c, 0x03, 0x01, 0x00,
25 0x02, 0x11, 0x03, 0x11, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xd9,
15}}; 26}};
16} 27}
diff --git a/src/core/constants.h b/src/core/constants.h
index f916ce0b6..f1f67d3b8 100644
--- a/src/core/constants.h
+++ b/src/core/constants.h
@@ -12,6 +12,6 @@
12namespace Core::Constants { 12namespace Core::Constants {
13 13
14// ACC Service - Blank JPEG used as user icon in absentia of real one. 14// ACC Service - Blank JPEG used as user icon in absentia of real one.
15extern const std::array<u8, 107> ACCOUNT_BACKUP_JPEG; 15extern const std::array<u8, 287> ACCOUNT_BACKUP_JPEG;
16 16
17} // namespace Core::Constants 17} // namespace Core::Constants
diff --git a/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp b/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp
index c10b7bf30..5b8a248c8 100644
--- a/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp
+++ b/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp
@@ -14,9 +14,12 @@ namespace Kernel::Board::Nintendo::Nx {
14 14
15namespace impl { 15namespace impl {
16 16
17constexpr const std::size_t RequiredNonSecureSystemMemorySizeVi = 0x2238 * 4 * 1024; 17using namespace Common::Literals;
18constexpr const std::size_t RequiredNonSecureSystemMemorySizeNvservices = 0x710 * 4 * 1024; 18
19constexpr const std::size_t RequiredNonSecureSystemMemorySizeMisc = 0x80 * 4 * 1024; 19constexpr const std::size_t RequiredNonSecureSystemMemorySizeVi = 0x2280 * 4_KiB;
20constexpr const std::size_t RequiredNonSecureSystemMemorySizeViFatal = 0x200 * 4_KiB;
21constexpr const std::size_t RequiredNonSecureSystemMemorySizeNvservices = 0x704 * 4_KiB;
22constexpr const std::size_t RequiredNonSecureSystemMemorySizeMisc = 0x80 * 4_KiB;
20 23
21} // namespace impl 24} // namespace impl
22 25
@@ -24,6 +27,9 @@ constexpr const std::size_t RequiredNonSecureSystemMemorySize =
24 impl::RequiredNonSecureSystemMemorySizeVi + impl::RequiredNonSecureSystemMemorySizeNvservices + 27 impl::RequiredNonSecureSystemMemorySizeVi + impl::RequiredNonSecureSystemMemorySizeNvservices +
25 impl::RequiredNonSecureSystemMemorySizeMisc; 28 impl::RequiredNonSecureSystemMemorySizeMisc;
26 29
30constexpr const std::size_t RequiredNonSecureSystemMemorySizeWithFatal =
31 RequiredNonSecureSystemMemorySize + impl::RequiredNonSecureSystemMemorySizeViFatal;
32
27namespace { 33namespace {
28 34
29using namespace Common::Literals; 35using namespace Common::Literals;
@@ -120,10 +126,13 @@ size_t KSystemControl::Init::GetAppletPoolSize() {
120 126
121size_t KSystemControl::Init::GetMinimumNonSecureSystemPoolSize() { 127size_t KSystemControl::Init::GetMinimumNonSecureSystemPoolSize() {
122 // Verify that our minimum is at least as large as Nintendo's. 128 // Verify that our minimum is at least as large as Nintendo's.
123 constexpr size_t MinimumSize = RequiredNonSecureSystemMemorySize; 129 constexpr size_t MinimumSizeWithFatal = RequiredNonSecureSystemMemorySizeWithFatal;
124 static_assert(MinimumSize >= 0x29C8000); 130 static_assert(MinimumSizeWithFatal >= 0x2C04000);
131
132 constexpr size_t MinimumSizeWithoutFatal = RequiredNonSecureSystemMemorySize;
133 static_assert(MinimumSizeWithoutFatal >= 0x2A00000);
125 134
126 return MinimumSize; 135 return MinimumSizeWithFatal;
127} 136}
128 137
129namespace { 138namespace {
diff --git a/src/core/hle/kernel/init/init_slab_setup.cpp b/src/core/hle/kernel/init/init_slab_setup.cpp
index abdb5639f..5e4090e2b 100644
--- a/src/core/hle/kernel/init/init_slab_setup.cpp
+++ b/src/core/hle/kernel/init/init_slab_setup.cpp
@@ -33,6 +33,9 @@
33 33
34namespace Kernel::Init { 34namespace Kernel::Init {
35 35
36// For macro convenience.
37using KThreadLockInfo = KThread::LockWithPriorityInheritanceInfo;
38
36#define SLAB_COUNT(CLASS) kernel.SlabResourceCounts().num_##CLASS 39#define SLAB_COUNT(CLASS) kernel.SlabResourceCounts().num_##CLASS
37 40
38#define FOREACH_SLAB_TYPE(HANDLER, ...) \ 41#define FOREACH_SLAB_TYPE(HANDLER, ...) \
@@ -54,7 +57,8 @@ namespace Kernel::Init {
54 HANDLER(KResourceLimit, (SLAB_COUNT(KResourceLimit)), ##__VA_ARGS__) \ 57 HANDLER(KResourceLimit, (SLAB_COUNT(KResourceLimit)), ##__VA_ARGS__) \
55 HANDLER(KEventInfo, (SLAB_COUNT(KThread) + SLAB_COUNT(KDebug)), ##__VA_ARGS__) \ 58 HANDLER(KEventInfo, (SLAB_COUNT(KThread) + SLAB_COUNT(KDebug)), ##__VA_ARGS__) \
56 HANDLER(KDebug, (SLAB_COUNT(KDebug)), ##__VA_ARGS__) \ 59 HANDLER(KDebug, (SLAB_COUNT(KDebug)), ##__VA_ARGS__) \
57 HANDLER(KSecureSystemResource, (SLAB_COUNT(KProcess)), ##__VA_ARGS__) 60 HANDLER(KSecureSystemResource, (SLAB_COUNT(KProcess)), ##__VA_ARGS__) \
61 HANDLER(KThreadLockInfo, (SLAB_COUNT(KThread)), ##__VA_ARGS__)
58 62
59namespace { 63namespace {
60 64
@@ -131,7 +135,7 @@ VAddr InitializeSlabHeap(Core::System& system, KMemoryLayout& memory_layout, VAd
131} 135}
132 136
133size_t CalculateSlabHeapGapSize() { 137size_t CalculateSlabHeapGapSize() {
134 constexpr size_t KernelSlabHeapGapSize = 2_MiB - 320_KiB; 138 constexpr size_t KernelSlabHeapGapSize = 2_MiB - 356_KiB;
135 static_assert(KernelSlabHeapGapSize <= KernelSlabHeapGapsSizeMax); 139 static_assert(KernelSlabHeapGapSize <= KernelSlabHeapGapsSizeMax);
136 return KernelSlabHeapGapSize; 140 return KernelSlabHeapGapSize;
137} 141}
diff --git a/src/core/hle/kernel/k_address_arbiter.cpp b/src/core/hle/kernel/k_address_arbiter.cpp
index a442a3b98..fb86451ea 100644
--- a/src/core/hle/kernel/k_address_arbiter.cpp
+++ b/src/core/hle/kernel/k_address_arbiter.cpp
@@ -29,7 +29,9 @@ bool DecrementIfLessThan(Core::System& system, s32* out, VAddr address, s32 valu
29 auto& monitor = system.Monitor(); 29 auto& monitor = system.Monitor();
30 const auto current_core = system.Kernel().CurrentPhysicalCoreIndex(); 30 const auto current_core = system.Kernel().CurrentPhysicalCoreIndex();
31 31
32 // TODO(bunnei): We should disable interrupts here via KScopedInterruptDisable. 32 // NOTE: If scheduler lock is not held here, interrupt disable is required.
33 // KScopedInterruptDisable di;
34
33 // TODO(bunnei): We should call CanAccessAtomic(..) here. 35 // TODO(bunnei): We should call CanAccessAtomic(..) here.
34 36
35 // Load the value from the address. 37 // Load the value from the address.
@@ -59,7 +61,9 @@ bool UpdateIfEqual(Core::System& system, s32* out, VAddr address, s32 value, s32
59 auto& monitor = system.Monitor(); 61 auto& monitor = system.Monitor();
60 const auto current_core = system.Kernel().CurrentPhysicalCoreIndex(); 62 const auto current_core = system.Kernel().CurrentPhysicalCoreIndex();
61 63
62 // TODO(bunnei): We should disable interrupts here via KScopedInterruptDisable. 64 // NOTE: If scheduler lock is not held here, interrupt disable is required.
65 // KScopedInterruptDisable di;
66
63 // TODO(bunnei): We should call CanAccessAtomic(..) here. 67 // TODO(bunnei): We should call CanAccessAtomic(..) here.
64 68
65 // Load the value from the address. 69 // Load the value from the address.
diff --git a/src/core/hle/kernel/k_address_space_info.cpp b/src/core/hle/kernel/k_address_space_info.cpp
index 3e612a207..97972ebae 100644
--- a/src/core/hle/kernel/k_address_space_info.cpp
+++ b/src/core/hle/kernel/k_address_space_info.cpp
@@ -23,86 +23,33 @@ constexpr std::array<KAddressSpaceInfo, 13> AddressSpaceInfos{{
23 { .bit_width = 32, .address = Size_Invalid, .size = 1_GiB , .type = KAddressSpaceInfo::Type::Heap, }, 23 { .bit_width = 32, .address = Size_Invalid, .size = 1_GiB , .type = KAddressSpaceInfo::Type::Heap, },
24 { .bit_width = 36, .address = 128_MiB , .size = 2_GiB - 128_MiB, .type = KAddressSpaceInfo::Type::MapSmall, }, 24 { .bit_width = 36, .address = 128_MiB , .size = 2_GiB - 128_MiB, .type = KAddressSpaceInfo::Type::MapSmall, },
25 { .bit_width = 36, .address = 2_GiB , .size = 64_GiB - 2_GiB , .type = KAddressSpaceInfo::Type::MapLarge, }, 25 { .bit_width = 36, .address = 2_GiB , .size = 64_GiB - 2_GiB , .type = KAddressSpaceInfo::Type::MapLarge, },
26 { .bit_width = 36, .address = Size_Invalid, .size = 6_GiB , .type = KAddressSpaceInfo::Type::Heap, }, 26 { .bit_width = 36, .address = Size_Invalid, .size = 8_GiB , .type = KAddressSpaceInfo::Type::Heap, },
27 { .bit_width = 36, .address = Size_Invalid, .size = 6_GiB , .type = KAddressSpaceInfo::Type::Alias, }, 27 { .bit_width = 36, .address = Size_Invalid, .size = 6_GiB , .type = KAddressSpaceInfo::Type::Alias, },
28 { .bit_width = 39, .address = 128_MiB , .size = 512_GiB - 128_MiB, .type = KAddressSpaceInfo::Type::Map39Bit, }, 28 { .bit_width = 39, .address = 128_MiB , .size = 512_GiB - 128_MiB, .type = KAddressSpaceInfo::Type::Map39Bit, },
29 { .bit_width = 39, .address = Size_Invalid, .size = 64_GiB , .type = KAddressSpaceInfo::Type::MapSmall }, 29 { .bit_width = 39, .address = Size_Invalid, .size = 64_GiB , .type = KAddressSpaceInfo::Type::MapSmall },
30 { .bit_width = 39, .address = Size_Invalid, .size = 6_GiB , .type = KAddressSpaceInfo::Type::Heap, }, 30 { .bit_width = 39, .address = Size_Invalid, .size = 8_GiB , .type = KAddressSpaceInfo::Type::Heap, },
31 { .bit_width = 39, .address = Size_Invalid, .size = 64_GiB , .type = KAddressSpaceInfo::Type::Alias, }, 31 { .bit_width = 39, .address = Size_Invalid, .size = 64_GiB , .type = KAddressSpaceInfo::Type::Alias, },
32 { .bit_width = 39, .address = Size_Invalid, .size = 2_GiB , .type = KAddressSpaceInfo::Type::Stack, }, 32 { .bit_width = 39, .address = Size_Invalid, .size = 2_GiB , .type = KAddressSpaceInfo::Type::Stack, },
33}}; 33}};
34// clang-format on 34// clang-format on
35 35
36constexpr bool IsAllowedIndexForAddress(std::size_t index) { 36const KAddressSpaceInfo& GetAddressSpaceInfo(size_t width, KAddressSpaceInfo::Type type) {
37 return index < AddressSpaceInfos.size() && AddressSpaceInfos[index].address != Size_Invalid; 37 for (auto& info : AddressSpaceInfos) {
38} 38 if (info.bit_width == width && info.type == type) {
39 39 return info;
40using IndexArray = 40 }
41 std::array<std::size_t, static_cast<std::size_t>(KAddressSpaceInfo::Type::Count)>; 41 }
42 42 UNREACHABLE_MSG("Could not find AddressSpaceInfo");
43constexpr IndexArray AddressSpaceIndices32Bit{
44 0, 1, 0, 2, 0, 3,
45};
46
47constexpr IndexArray AddressSpaceIndices36Bit{
48 4, 5, 4, 6, 4, 7,
49};
50
51constexpr IndexArray AddressSpaceIndices39Bit{
52 9, 8, 8, 10, 12, 11,
53};
54
55constexpr bool IsAllowed32BitType(KAddressSpaceInfo::Type type) {
56 return type < KAddressSpaceInfo::Type::Count && type != KAddressSpaceInfo::Type::Map39Bit &&
57 type != KAddressSpaceInfo::Type::Stack;
58}
59
60constexpr bool IsAllowed36BitType(KAddressSpaceInfo::Type type) {
61 return type < KAddressSpaceInfo::Type::Count && type != KAddressSpaceInfo::Type::Map39Bit &&
62 type != KAddressSpaceInfo::Type::Stack;
63}
64
65constexpr bool IsAllowed39BitType(KAddressSpaceInfo::Type type) {
66 return type < KAddressSpaceInfo::Type::Count && type != KAddressSpaceInfo::Type::MapLarge;
67} 43}
68 44
69} // namespace 45} // namespace
70 46
71u64 KAddressSpaceInfo::GetAddressSpaceStart(std::size_t width, Type type) { 47uintptr_t KAddressSpaceInfo::GetAddressSpaceStart(size_t width, KAddressSpaceInfo::Type type) {
72 const std::size_t index{static_cast<std::size_t>(type)}; 48 return GetAddressSpaceInfo(width, type).address;
73 switch (width) {
74 case 32:
75 ASSERT(IsAllowed32BitType(type));
76 ASSERT(IsAllowedIndexForAddress(AddressSpaceIndices32Bit[index]));
77 return AddressSpaceInfos[AddressSpaceIndices32Bit[index]].address;
78 case 36:
79 ASSERT(IsAllowed36BitType(type));
80 ASSERT(IsAllowedIndexForAddress(AddressSpaceIndices36Bit[index]));
81 return AddressSpaceInfos[AddressSpaceIndices36Bit[index]].address;
82 case 39:
83 ASSERT(IsAllowed39BitType(type));
84 ASSERT(IsAllowedIndexForAddress(AddressSpaceIndices39Bit[index]));
85 return AddressSpaceInfos[AddressSpaceIndices39Bit[index]].address;
86 }
87 ASSERT(false);
88 return 0;
89} 49}
90 50
91std::size_t KAddressSpaceInfo::GetAddressSpaceSize(std::size_t width, Type type) { 51size_t KAddressSpaceInfo::GetAddressSpaceSize(size_t width, KAddressSpaceInfo::Type type) {
92 const std::size_t index{static_cast<std::size_t>(type)}; 52 return GetAddressSpaceInfo(width, type).size;
93 switch (width) {
94 case 32:
95 ASSERT(IsAllowed32BitType(type));
96 return AddressSpaceInfos[AddressSpaceIndices32Bit[index]].size;
97 case 36:
98 ASSERT(IsAllowed36BitType(type));
99 return AddressSpaceInfos[AddressSpaceIndices36Bit[index]].size;
100 case 39:
101 ASSERT(IsAllowed39BitType(type));
102 return AddressSpaceInfos[AddressSpaceIndices39Bit[index]].size;
103 }
104 ASSERT(false);
105 return 0;
106} 53}
107 54
108} // namespace Kernel 55} // namespace Kernel
diff --git a/src/core/hle/kernel/k_client_port.cpp b/src/core/hle/kernel/k_client_port.cpp
index c72a91a76..700ae71e3 100644
--- a/src/core/hle/kernel/k_client_port.cpp
+++ b/src/core/hle/kernel/k_client_port.cpp
@@ -2,7 +2,6 @@
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "common/scope_exit.h" 4#include "common/scope_exit.h"
5#include "core/hle/kernel/hle_ipc.h"
6#include "core/hle/kernel/k_client_port.h" 5#include "core/hle/kernel/k_client_port.h"
7#include "core/hle/kernel/k_port.h" 6#include "core/hle/kernel/k_port.h"
8#include "core/hle/kernel/k_scheduler.h" 7#include "core/hle/kernel/k_scheduler.h"
diff --git a/src/core/hle/kernel/k_client_port.h b/src/core/hle/kernel/k_client_port.h
index 81046fb86..a757cf9cd 100644
--- a/src/core/hle/kernel/k_client_port.h
+++ b/src/core/hle/kernel/k_client_port.h
@@ -15,7 +15,6 @@ namespace Kernel {
15class KClientSession; 15class KClientSession;
16class KernelCore; 16class KernelCore;
17class KPort; 17class KPort;
18class SessionRequestManager;
19 18
20class KClientPort final : public KSynchronizationObject { 19class KClientPort final : public KSynchronizationObject {
21 KERNEL_AUTOOBJECT_TRAITS(KClientPort, KSynchronizationObject); 20 KERNEL_AUTOOBJECT_TRAITS(KClientPort, KSynchronizationObject);
diff --git a/src/core/hle/kernel/k_client_session.cpp b/src/core/hle/kernel/k_client_session.cpp
index b4197a8d5..da0c9ac8c 100644
--- a/src/core/hle/kernel/k_client_session.cpp
+++ b/src/core/hle/kernel/k_client_session.cpp
@@ -2,7 +2,6 @@
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "common/scope_exit.h" 4#include "common/scope_exit.h"
5#include "core/hle/kernel/hle_ipc.h"
6#include "core/hle/kernel/k_client_session.h" 5#include "core/hle/kernel/k_client_session.h"
7#include "core/hle/kernel/k_server_session.h" 6#include "core/hle/kernel/k_server_session.h"
8#include "core/hle/kernel/k_session.h" 7#include "core/hle/kernel/k_session.h"
diff --git a/src/core/hle/kernel/k_condition_variable.cpp b/src/core/hle/kernel/k_condition_variable.cpp
index 3f0be1c3f..f40cf92b1 100644
--- a/src/core/hle/kernel/k_condition_variable.cpp
+++ b/src/core/hle/kernel/k_condition_variable.cpp
@@ -111,36 +111,36 @@ Result KConditionVariable::SignalToAddress(VAddr addr) {
111 KScopedSchedulerLock sl(kernel); 111 KScopedSchedulerLock sl(kernel);
112 112
113 // Remove waiter thread. 113 // Remove waiter thread.
114 s32 num_waiters{}; 114 bool has_waiters{};
115 KThread* next_owner_thread = 115 KThread* const next_owner_thread =
116 owner_thread->RemoveWaiterByKey(std::addressof(num_waiters), addr); 116 owner_thread->RemoveUserWaiterByKey(std::addressof(has_waiters), addr);
117 117
118 // Determine the next tag. 118 // Determine the next tag.
119 u32 next_value{}; 119 u32 next_value{};
120 if (next_owner_thread != nullptr) { 120 if (next_owner_thread != nullptr) {
121 next_value = next_owner_thread->GetAddressKeyValue(); 121 next_value = next_owner_thread->GetAddressKeyValue();
122 if (num_waiters > 1) { 122 if (has_waiters) {
123 next_value |= Svc::HandleWaitMask; 123 next_value |= Svc::HandleWaitMask;
124 } 124 }
125 }
125 126
126 // Write the value to userspace. 127 // Synchronize memory before proceeding.
127 Result result{ResultSuccess}; 128 std::atomic_thread_fence(std::memory_order_seq_cst);
128 if (WriteToUser(system, addr, std::addressof(next_value))) [[likely]] {
129 result = ResultSuccess;
130 } else {
131 result = ResultInvalidCurrentMemory;
132 }
133 129
134 // Signal the next owner thread. 130 // Write the value to userspace.
135 next_owner_thread->EndWait(result); 131 Result result{ResultSuccess};
136 return result; 132 if (WriteToUser(system, addr, std::addressof(next_value))) [[likely]] {
133 result = ResultSuccess;
137 } else { 134 } else {
138 // Just write the value to userspace. 135 result = ResultInvalidCurrentMemory;
139 R_UNLESS(WriteToUser(system, addr, std::addressof(next_value)), 136 }
140 ResultInvalidCurrentMemory);
141 137
142 return ResultSuccess; 138 // If necessary, signal the next owner thread.
139 if (next_owner_thread != nullptr) {
140 next_owner_thread->EndWait(result);
143 } 141 }
142
143 R_RETURN(result);
144 } 144 }
145} 145}
146 146
@@ -198,7 +198,9 @@ void KConditionVariable::SignalImpl(KThread* thread) {
198 u32 prev_tag{}; 198 u32 prev_tag{};
199 bool can_access{}; 199 bool can_access{};
200 { 200 {
201 // TODO(bunnei): We should disable interrupts here via KScopedInterruptDisable. 201 // NOTE: If scheduler lock is not held here, interrupt disable is required.
202 // KScopedInterruptDisable di;
203
202 // TODO(bunnei): We should call CanAccessAtomic(..) here. 204 // TODO(bunnei): We should call CanAccessAtomic(..) here.
203 can_access = true; 205 can_access = true;
204 if (can_access) [[likely]] { 206 if (can_access) [[likely]] {
@@ -245,9 +247,11 @@ void KConditionVariable::Signal(u64 cv_key, s32 count) {
245 (it->GetConditionVariableKey() == cv_key)) { 247 (it->GetConditionVariableKey() == cv_key)) {
246 KThread* target_thread = std::addressof(*it); 248 KThread* target_thread = std::addressof(*it);
247 249
248 this->SignalImpl(target_thread);
249 it = thread_tree.erase(it); 250 it = thread_tree.erase(it);
250 target_thread->ClearConditionVariable(); 251 target_thread->ClearConditionVariable();
252
253 this->SignalImpl(target_thread);
254
251 ++num_waiters; 255 ++num_waiters;
252 } 256 }
253 257
@@ -277,16 +281,16 @@ Result KConditionVariable::Wait(VAddr addr, u64 key, u32 value, s64 timeout) {
277 // Update the value and process for the next owner. 281 // Update the value and process for the next owner.
278 { 282 {
279 // Remove waiter thread. 283 // Remove waiter thread.
280 s32 num_waiters{}; 284 bool has_waiters{};
281 KThread* next_owner_thread = 285 KThread* next_owner_thread =
282 cur_thread->RemoveWaiterByKey(std::addressof(num_waiters), addr); 286 cur_thread->RemoveUserWaiterByKey(std::addressof(has_waiters), addr);
283 287
284 // Update for the next owner thread. 288 // Update for the next owner thread.
285 u32 next_value{}; 289 u32 next_value{};
286 if (next_owner_thread != nullptr) { 290 if (next_owner_thread != nullptr) {
287 // Get the next tag value. 291 // Get the next tag value.
288 next_value = next_owner_thread->GetAddressKeyValue(); 292 next_value = next_owner_thread->GetAddressKeyValue();
289 if (num_waiters > 1) { 293 if (has_waiters) {
290 next_value |= Svc::HandleWaitMask; 294 next_value |= Svc::HandleWaitMask;
291 } 295 }
292 296
diff --git a/src/core/hle/kernel/k_light_lock.cpp b/src/core/hle/kernel/k_light_lock.cpp
index d791acbe3..14cb615da 100644
--- a/src/core/hle/kernel/k_light_lock.cpp
+++ b/src/core/hle/kernel/k_light_lock.cpp
@@ -90,15 +90,15 @@ void KLightLock::UnlockSlowPath(uintptr_t _cur_thread) {
90 KScopedSchedulerLock sl(kernel); 90 KScopedSchedulerLock sl(kernel);
91 91
92 // Get the next owner. 92 // Get the next owner.
93 s32 num_waiters; 93 bool has_waiters;
94 KThread* next_owner = owner_thread->RemoveWaiterByKey( 94 KThread* next_owner = owner_thread->RemoveKernelWaiterByKey(
95 std::addressof(num_waiters), reinterpret_cast<uintptr_t>(std::addressof(tag))); 95 std::addressof(has_waiters), reinterpret_cast<uintptr_t>(std::addressof(tag)));
96 96
97 // Pass the lock to the next owner. 97 // Pass the lock to the next owner.
98 uintptr_t next_tag = 0; 98 uintptr_t next_tag = 0;
99 if (next_owner != nullptr) { 99 if (next_owner != nullptr) {
100 next_tag = 100 next_tag =
101 reinterpret_cast<uintptr_t>(next_owner) | static_cast<uintptr_t>(num_waiters > 1); 101 reinterpret_cast<uintptr_t>(next_owner) | static_cast<uintptr_t>(has_waiters);
102 102
103 next_owner->EndWait(ResultSuccess); 103 next_owner->EndWait(ResultSuccess);
104 104
diff --git a/src/core/hle/kernel/k_port.cpp b/src/core/hle/kernel/k_port.cpp
index 77d00ae2c..0a45ffd57 100644
--- a/src/core/hle/kernel/k_port.cpp
+++ b/src/core/hle/kernel/k_port.cpp
@@ -1,7 +1,6 @@
1// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project 1// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "core/hle/kernel/hle_ipc.h"
5#include "core/hle/kernel/k_port.h" 4#include "core/hle/kernel/k_port.h"
6#include "core/hle/kernel/k_scheduler.h" 5#include "core/hle/kernel/k_scheduler.h"
7#include "core/hle/kernel/svc_results.h" 6#include "core/hle/kernel/svc_results.h"
diff --git a/src/core/hle/kernel/k_process.cpp b/src/core/hle/kernel/k_process.cpp
index d9c1a0eb3..d44f6e921 100644
--- a/src/core/hle/kernel/k_process.cpp
+++ b/src/core/hle/kernel/k_process.cpp
@@ -156,9 +156,9 @@ bool KProcess::ReleaseUserException(KThread* thread) {
156 exception_thread = nullptr; 156 exception_thread = nullptr;
157 157
158 // Remove waiter thread. 158 // Remove waiter thread.
159 s32 num_waiters{}; 159 bool has_waiters{};
160 if (KThread* next = thread->RemoveWaiterByKey( 160 if (KThread* next = thread->RemoveKernelWaiterByKey(
161 std::addressof(num_waiters), 161 std::addressof(has_waiters),
162 reinterpret_cast<uintptr_t>(std::addressof(exception_thread))); 162 reinterpret_cast<uintptr_t>(std::addressof(exception_thread)));
163 next != nullptr) { 163 next != nullptr) {
164 next->EndWait(ResultSuccess); 164 next->EndWait(ResultSuccess);
diff --git a/src/core/hle/kernel/k_scheduler_lock.h b/src/core/hle/kernel/k_scheduler_lock.h
index 129d60472..13463717f 100644
--- a/src/core/hle/kernel/k_scheduler_lock.h
+++ b/src/core/hle/kernel/k_scheduler_lock.h
@@ -31,22 +31,23 @@ public:
31 } 31 }
32 32
33 if (IsLockedByCurrentThread()) { 33 if (IsLockedByCurrentThread()) {
34 // If we already own the lock, we can just increment the count. 34 // If we already own the lock, the lock count should be > 0.
35 // For debug, ensure this is true.
35 ASSERT(lock_count > 0); 36 ASSERT(lock_count > 0);
36 lock_count++;
37 } else { 37 } else {
38 // Otherwise, we want to disable scheduling and acquire the spinlock. 38 // Otherwise, we want to disable scheduling and acquire the spinlock.
39 SchedulerType::DisableScheduling(kernel); 39 SchedulerType::DisableScheduling(kernel);
40 spin_lock.Lock(); 40 spin_lock.Lock();
41 41
42 // For debug, ensure that our state is valid.
43 ASSERT(lock_count == 0); 42 ASSERT(lock_count == 0);
44 ASSERT(owner_thread == nullptr); 43 ASSERT(owner_thread == nullptr);
45 44
46 // Increment count, take ownership. 45 // Take ownership of the lock.
47 lock_count = 1;
48 owner_thread = GetCurrentThreadPointer(kernel); 46 owner_thread = GetCurrentThreadPointer(kernel);
49 } 47 }
48
49 // Increment the lock count.
50 lock_count++;
50 } 51 }
51 52
52 void Unlock() { 53 void Unlock() {
diff --git a/src/core/hle/kernel/k_scoped_lock.h b/src/core/hle/kernel/k_scoped_lock.h
index 59b3e32ae..a15640fd2 100644
--- a/src/core/hle/kernel/k_scoped_lock.h
+++ b/src/core/hle/kernel/k_scoped_lock.h
@@ -4,6 +4,7 @@
4#pragma once 4#pragma once
5 5
6#include <concepts> 6#include <concepts>
7#include <memory>
7#include <type_traits> 8#include <type_traits>
8 9
9namespace Kernel { 10namespace Kernel {
diff --git a/src/core/hle/kernel/k_server_session.cpp b/src/core/hle/kernel/k_server_session.cpp
index aa1941f01..01591af5b 100644
--- a/src/core/hle/kernel/k_server_session.cpp
+++ b/src/core/hle/kernel/k_server_session.cpp
@@ -10,8 +10,6 @@
10#include "common/scope_exit.h" 10#include "common/scope_exit.h"
11#include "core/core.h" 11#include "core/core.h"
12#include "core/core_timing.h" 12#include "core/core_timing.h"
13#include "core/hle/ipc_helpers.h"
14#include "core/hle/kernel/hle_ipc.h"
15#include "core/hle/kernel/k_client_port.h" 13#include "core/hle/kernel/k_client_port.h"
16#include "core/hle/kernel/k_handle_table.h" 14#include "core/hle/kernel/k_handle_table.h"
17#include "core/hle/kernel/k_process.h" 15#include "core/hle/kernel/k_process.h"
@@ -22,6 +20,8 @@
22#include "core/hle/kernel/k_thread.h" 20#include "core/hle/kernel/k_thread.h"
23#include "core/hle/kernel/k_thread_queue.h" 21#include "core/hle/kernel/k_thread_queue.h"
24#include "core/hle/kernel/kernel.h" 22#include "core/hle/kernel/kernel.h"
23#include "core/hle/service/hle_ipc.h"
24#include "core/hle/service/ipc_helpers.h"
25#include "core/memory.h" 25#include "core/memory.h"
26 26
27namespace Kernel { 27namespace Kernel {
@@ -281,8 +281,8 @@ Result KServerSession::SendReply(bool is_hle) {
281 return result; 281 return result;
282} 282}
283 283
284Result KServerSession::ReceiveRequest(std::shared_ptr<HLERequestContext>* out_context, 284Result KServerSession::ReceiveRequest(std::shared_ptr<Service::HLERequestContext>* out_context,
285 std::weak_ptr<SessionRequestManager> manager) { 285 std::weak_ptr<Service::SessionRequestManager> manager) {
286 // Lock the session. 286 // Lock the session.
287 KScopedLightLock lk{m_lock}; 287 KScopedLightLock lk{m_lock};
288 288
@@ -329,7 +329,8 @@ Result KServerSession::ReceiveRequest(std::shared_ptr<HLERequestContext>* out_co
329 if (out_context != nullptr) { 329 if (out_context != nullptr) {
330 // HLE request. 330 // HLE request.
331 u32* cmd_buf{reinterpret_cast<u32*>(memory.GetPointer(client_message))}; 331 u32* cmd_buf{reinterpret_cast<u32*>(memory.GetPointer(client_message))};
332 *out_context = std::make_shared<HLERequestContext>(kernel, memory, this, client_thread); 332 *out_context =
333 std::make_shared<Service::HLERequestContext>(kernel, memory, this, client_thread);
333 (*out_context)->SetSessionRequestManager(manager); 334 (*out_context)->SetSessionRequestManager(manager);
334 (*out_context) 335 (*out_context)
335 ->PopulateFromIncomingCommandBuffer(client_thread->GetOwnerProcess()->GetHandleTable(), 336 ->PopulateFromIncomingCommandBuffer(client_thread->GetOwnerProcess()->GetHandleTable(),
diff --git a/src/core/hle/kernel/k_server_session.h b/src/core/hle/kernel/k_server_session.h
index 6e189af8b..33f380352 100644
--- a/src/core/hle/kernel/k_server_session.h
+++ b/src/core/hle/kernel/k_server_session.h
@@ -10,18 +10,20 @@
10 10
11#include <boost/intrusive/list.hpp> 11#include <boost/intrusive/list.hpp>
12 12
13#include "core/hle/kernel/hle_ipc.h"
14#include "core/hle/kernel/k_light_lock.h" 13#include "core/hle/kernel/k_light_lock.h"
15#include "core/hle/kernel/k_session_request.h" 14#include "core/hle/kernel/k_session_request.h"
16#include "core/hle/kernel/k_synchronization_object.h" 15#include "core/hle/kernel/k_synchronization_object.h"
17#include "core/hle/result.h" 16#include "core/hle/result.h"
18 17
18namespace Service {
19class HLERequestContext;
20class SessionRequestManager;
21} // namespace Service
22
19namespace Kernel { 23namespace Kernel {
20 24
21class HLERequestContext;
22class KernelCore; 25class KernelCore;
23class KSession; 26class KSession;
24class SessionRequestManager;
25class KThread; 27class KThread;
26 28
27class KServerSession final : public KSynchronizationObject, 29class KServerSession final : public KSynchronizationObject,
@@ -52,8 +54,8 @@ public:
52 /// TODO: flesh these out to match the real kernel 54 /// TODO: flesh these out to match the real kernel
53 Result OnRequest(KSessionRequest* request); 55 Result OnRequest(KSessionRequest* request);
54 Result SendReply(bool is_hle = false); 56 Result SendReply(bool is_hle = false);
55 Result ReceiveRequest(std::shared_ptr<HLERequestContext>* out_context = nullptr, 57 Result ReceiveRequest(std::shared_ptr<Service::HLERequestContext>* out_context = nullptr,
56 std::weak_ptr<SessionRequestManager> manager = {}); 58 std::weak_ptr<Service::SessionRequestManager> manager = {});
57 59
58 Result SendReplyHLE() { 60 Result SendReplyHLE() {
59 return SendReply(true); 61 return SendReply(true);
diff --git a/src/core/hle/kernel/k_thread.cpp b/src/core/hle/kernel/k_thread.cpp
index 599d05947..8c403f5fd 100644
--- a/src/core/hle/kernel/k_thread.cpp
+++ b/src/core/hle/kernel/k_thread.cpp
@@ -191,7 +191,7 @@ Result KThread::Initialize(KThreadFunction func, uintptr_t arg, VAddr user_stack
191 light_ipc_data = nullptr; 191 light_ipc_data = nullptr;
192 192
193 // We're not waiting for a lock, and we haven't disabled migration. 193 // We're not waiting for a lock, and we haven't disabled migration.
194 lock_owner = nullptr; 194 waiting_lock_info = nullptr;
195 num_core_migration_disables = 0; 195 num_core_migration_disables = 0;
196 196
197 // We have no waiters, but we do have an entrypoint. 197 // We have no waiters, but we do have an entrypoint.
@@ -341,25 +341,39 @@ void KThread::Finalize() {
341 341
342 // Release any waiters. 342 // Release any waiters.
343 { 343 {
344 ASSERT(lock_owner == nullptr); 344 ASSERT(waiting_lock_info == nullptr);
345 KScopedSchedulerLock sl{kernel}; 345 KScopedSchedulerLock sl{kernel};
346 346
347 auto it = waiter_list.begin(); 347 // Check that we have no kernel waiters.
348 while (it != waiter_list.end()) { 348 ASSERT(num_kernel_waiters == 0);
349 // Get the thread.
350 KThread* const waiter = std::addressof(*it);
351 349
352 // The thread shouldn't be a kernel waiter. 350 auto it = held_lock_info_list.begin();
353 ASSERT(!waiter->GetAddressKeyIsKernel()); 351 while (it != held_lock_info_list.end()) {
352 // Get the lock info.
353 auto* const lock_info = std::addressof(*it);
354 354
355 // Clear the lock owner. 355 // The lock shouldn't have a kernel waiter.
356 waiter->SetLockOwner(nullptr); 356 ASSERT(!lock_info->GetIsKernelAddressKey());
357 357
358 // Erase the waiter from our list. 358 // Remove all waiters.
359 it = waiter_list.erase(it); 359 while (lock_info->GetWaiterCount() != 0) {
360 // Get the front waiter.
361 KThread* const waiter = lock_info->GetHighestPriorityWaiter();
360 362
361 // Cancel the thread's wait. 363 // Remove it from the lock.
362 waiter->CancelWait(ResultInvalidState, true); 364 if (lock_info->RemoveWaiter(waiter)) {
365 ASSERT(lock_info->GetWaiterCount() == 0);
366 }
367
368 // Cancel the thread's wait.
369 waiter->CancelWait(ResultInvalidState, true);
370 }
371
372 // Remove the held lock from our list.
373 it = held_lock_info_list.erase(it);
374
375 // Free the lock info.
376 LockWithPriorityInheritanceInfo::Free(kernel, lock_info);
363 } 377 }
364 } 378 }
365 379
@@ -708,6 +722,24 @@ void KThread::SetBasePriority(s32 value) {
708 RestorePriority(kernel, this); 722 RestorePriority(kernel, this);
709} 723}
710 724
725KThread* KThread::GetLockOwner() const {
726 return waiting_lock_info != nullptr ? waiting_lock_info->GetOwner() : nullptr;
727}
728
729void KThread::IncreaseBasePriority(s32 priority_) {
730 ASSERT(Svc::HighestThreadPriority <= priority_ && priority_ <= Svc::LowestThreadPriority);
731 ASSERT(KScheduler::IsSchedulerLockedByCurrentThread(kernel));
732 ASSERT(!this->GetStackParameters().is_pinned);
733
734 // Set our base priority.
735 if (base_priority > priority_) {
736 base_priority = priority_;
737
738 // Perform a priority restoration.
739 RestorePriority(kernel, this);
740 }
741}
742
711void KThread::RequestSuspend(SuspendType type) { 743void KThread::RequestSuspend(SuspendType type) {
712 KScopedSchedulerLock sl{kernel}; 744 KScopedSchedulerLock sl{kernel};
713 745
@@ -891,51 +923,89 @@ Result KThread::GetThreadContext3(std::vector<u8>& out) {
891 R_SUCCEED(); 923 R_SUCCEED();
892} 924}
893 925
894void KThread::AddWaiterImpl(KThread* thread) { 926void KThread::AddHeldLock(LockWithPriorityInheritanceInfo* lock_info) {
895 ASSERT(kernel.GlobalSchedulerContext().IsLocked()); 927 ASSERT(KScheduler::IsSchedulerLockedByCurrentThread(kernel));
928
929 // Set ourselves as the lock's owner.
930 lock_info->SetOwner(this);
896 931
897 // Find the right spot to insert the waiter. 932 // Add the lock to our held list.
898 auto it = waiter_list.begin(); 933 held_lock_info_list.push_front(*lock_info);
899 while (it != waiter_list.end()) { 934}
900 if (it->GetPriority() > thread->GetPriority()) { 935
901 break; 936KThread::LockWithPriorityInheritanceInfo* KThread::FindHeldLock(VAddr address_key_,
937 bool is_kernel_address_key_) {
938 ASSERT(KScheduler::IsSchedulerLockedByCurrentThread(kernel));
939
940 // Try to find an existing held lock.
941 for (auto& held_lock : held_lock_info_list) {
942 if (held_lock.GetAddressKey() == address_key_ &&
943 held_lock.GetIsKernelAddressKey() == is_kernel_address_key_) {
944 return std::addressof(held_lock);
902 } 945 }
903 it++;
904 } 946 }
905 947
948 return nullptr;
949}
950
951void KThread::AddWaiterImpl(KThread* thread) {
952 ASSERT(KScheduler::IsSchedulerLockedByCurrentThread(kernel));
953 ASSERT(thread->GetConditionVariableTree() == nullptr);
954
955 // Get the thread's address key.
956 const auto address_key_ = thread->GetAddressKey();
957 const auto is_kernel_address_key_ = thread->GetIsKernelAddressKey();
958
906 // Keep track of how many kernel waiters we have. 959 // Keep track of how many kernel waiters we have.
907 if (thread->GetAddressKeyIsKernel()) { 960 if (is_kernel_address_key_) {
908 ASSERT((num_kernel_waiters++) >= 0); 961 ASSERT((num_kernel_waiters++) >= 0);
909 KScheduler::SetSchedulerUpdateNeeded(kernel); 962 KScheduler::SetSchedulerUpdateNeeded(kernel);
910 } 963 }
911 964
912 // Insert the waiter. 965 // Get the relevant lock info.
913 waiter_list.insert(it, *thread); 966 auto* lock_info = this->FindHeldLock(address_key_, is_kernel_address_key_);
914 thread->SetLockOwner(this); 967 if (lock_info == nullptr) {
968 // Create a new lock for the address key.
969 lock_info =
970 LockWithPriorityInheritanceInfo::Create(kernel, address_key_, is_kernel_address_key_);
971
972 // Add the new lock to our list.
973 this->AddHeldLock(lock_info);
974 }
975
976 // Add the thread as waiter to the lock info.
977 lock_info->AddWaiter(thread);
915} 978}
916 979
917void KThread::RemoveWaiterImpl(KThread* thread) { 980void KThread::RemoveWaiterImpl(KThread* thread) {
918 ASSERT(kernel.GlobalSchedulerContext().IsLocked()); 981 ASSERT(KScheduler::IsSchedulerLockedByCurrentThread(kernel));
919 982
920 // Keep track of how many kernel waiters we have. 983 // Keep track of how many kernel waiters we have.
921 if (thread->GetAddressKeyIsKernel()) { 984 if (thread->GetIsKernelAddressKey()) {
922 ASSERT((num_kernel_waiters--) > 0); 985 ASSERT((num_kernel_waiters--) > 0);
923 KScheduler::SetSchedulerUpdateNeeded(kernel); 986 KScheduler::SetSchedulerUpdateNeeded(kernel);
924 } 987 }
925 988
989 // Get the info for the lock the thread is waiting on.
990 auto* lock_info = thread->GetWaitingLockInfo();
991 ASSERT(lock_info->GetOwner() == this);
992
926 // Remove the waiter. 993 // Remove the waiter.
927 waiter_list.erase(waiter_list.iterator_to(*thread)); 994 if (lock_info->RemoveWaiter(thread)) {
928 thread->SetLockOwner(nullptr); 995 held_lock_info_list.erase(held_lock_info_list.iterator_to(*lock_info));
996 LockWithPriorityInheritanceInfo::Free(kernel, lock_info);
997 }
929} 998}
930 999
931void KThread::RestorePriority(KernelCore& kernel_ctx, KThread* thread) { 1000void KThread::RestorePriority(KernelCore& kernel, KThread* thread) {
932 ASSERT(kernel_ctx.GlobalSchedulerContext().IsLocked()); 1001 ASSERT(KScheduler::IsSchedulerLockedByCurrentThread(kernel));
933 1002
934 while (true) { 1003 while (thread != nullptr) {
935 // We want to inherit priority where possible. 1004 // We want to inherit priority where possible.
936 s32 new_priority = thread->GetBasePriority(); 1005 s32 new_priority = thread->GetBasePriority();
937 if (thread->HasWaiters()) { 1006 for (const auto& held_lock : thread->held_lock_info_list) {
938 new_priority = std::min(new_priority, thread->waiter_list.front().GetPriority()); 1007 new_priority =
1008 std::min(new_priority, held_lock.GetHighestPriorityWaiter()->GetPriority());
939 } 1009 }
940 1010
941 // If the priority we would inherit is not different from ours, don't do anything. 1011 // If the priority we would inherit is not different from ours, don't do anything.
@@ -943,9 +1013,18 @@ void KThread::RestorePriority(KernelCore& kernel_ctx, KThread* thread) {
943 return; 1013 return;
944 } 1014 }
945 1015
1016 // Get the owner of whatever lock this thread is waiting on.
1017 KThread* const lock_owner = thread->GetLockOwner();
1018
1019 // If the thread is waiting on some lock, remove it as a waiter to prevent violating red
1020 // black tree invariants.
1021 if (lock_owner != nullptr) {
1022 lock_owner->RemoveWaiterImpl(thread);
1023 }
1024
946 // Ensure we don't violate condition variable red black tree invariants. 1025 // Ensure we don't violate condition variable red black tree invariants.
947 if (auto* cv_tree = thread->GetConditionVariableTree(); cv_tree != nullptr) { 1026 if (auto* cv_tree = thread->GetConditionVariableTree(); cv_tree != nullptr) {
948 BeforeUpdatePriority(kernel_ctx, cv_tree, thread); 1027 BeforeUpdatePriority(kernel, cv_tree, thread);
949 } 1028 }
950 1029
951 // Change the priority. 1030 // Change the priority.
@@ -954,73 +1033,99 @@ void KThread::RestorePriority(KernelCore& kernel_ctx, KThread* thread) {
954 1033
955 // Restore the condition variable, if relevant. 1034 // Restore the condition variable, if relevant.
956 if (auto* cv_tree = thread->GetConditionVariableTree(); cv_tree != nullptr) { 1035 if (auto* cv_tree = thread->GetConditionVariableTree(); cv_tree != nullptr) {
957 AfterUpdatePriority(kernel_ctx, cv_tree, thread); 1036 AfterUpdatePriority(kernel, cv_tree, thread);
958 } 1037 }
959 1038
960 // Update the scheduler. 1039 // If we removed the thread from some lock's waiting list, add it back.
961 KScheduler::OnThreadPriorityChanged(kernel_ctx, thread, old_priority); 1040 if (lock_owner != nullptr) {
962 1041 lock_owner->AddWaiterImpl(thread);
963 // Keep the lock owner up to date.
964 KThread* lock_owner = thread->GetLockOwner();
965 if (lock_owner == nullptr) {
966 return;
967 } 1042 }
968 1043
969 // Update the thread in the lock owner's sorted list, and continue inheriting. 1044 // Update the scheduler.
970 lock_owner->RemoveWaiterImpl(thread); 1045 KScheduler::OnThreadPriorityChanged(kernel, thread, old_priority);
971 lock_owner->AddWaiterImpl(thread); 1046
1047 // Continue inheriting priority.
972 thread = lock_owner; 1048 thread = lock_owner;
973 } 1049 }
974} 1050}
975 1051
976void KThread::AddWaiter(KThread* thread) { 1052void KThread::AddWaiter(KThread* thread) {
977 AddWaiterImpl(thread); 1053 this->AddWaiterImpl(thread);
978 RestorePriority(kernel, this); 1054
1055 // If the thread has a higher priority than us, we should inherit.
1056 if (thread->GetPriority() < this->GetPriority()) {
1057 RestorePriority(kernel, this);
1058 }
979} 1059}
980 1060
981void KThread::RemoveWaiter(KThread* thread) { 1061void KThread::RemoveWaiter(KThread* thread) {
982 RemoveWaiterImpl(thread); 1062 this->RemoveWaiterImpl(thread);
983 RestorePriority(kernel, this); 1063
1064 // If our priority is the same as the thread's (and we've inherited), we may need to restore to
1065 // lower priority.
1066 if (this->GetPriority() == thread->GetPriority() &&
1067 this->GetPriority() < this->GetBasePriority()) {
1068 RestorePriority(kernel, this);
1069 }
984} 1070}
985 1071
986KThread* KThread::RemoveWaiterByKey(s32* out_num_waiters, VAddr key) { 1072KThread* KThread::RemoveWaiterByKey(bool* out_has_waiters, VAddr key, bool is_kernel_address_key_) {
987 ASSERT(kernel.GlobalSchedulerContext().IsLocked()); 1073 ASSERT(KScheduler::IsSchedulerLockedByCurrentThread(kernel));
988 1074
989 s32 num_waiters{}; 1075 // Get the relevant lock info.
990 KThread* next_lock_owner{}; 1076 auto* lock_info = this->FindHeldLock(key, is_kernel_address_key_);
991 auto it = waiter_list.begin(); 1077 if (lock_info == nullptr) {
992 while (it != waiter_list.end()) { 1078 *out_has_waiters = false;
993 if (it->GetAddressKey() == key) { 1079 return nullptr;
994 KThread* thread = std::addressof(*it); 1080 }
995
996 // Keep track of how many kernel waiters we have.
997 if (thread->GetAddressKeyIsKernel()) {
998 ASSERT((num_kernel_waiters--) > 0);
999 KScheduler::SetSchedulerUpdateNeeded(kernel);
1000 }
1001 it = waiter_list.erase(it);
1002 1081
1003 // Update the next lock owner. 1082 // Remove the lock info from our held list.
1004 if (next_lock_owner == nullptr) { 1083 held_lock_info_list.erase(held_lock_info_list.iterator_to(*lock_info));
1005 next_lock_owner = thread; 1084
1006 next_lock_owner->SetLockOwner(nullptr); 1085 // Keep track of how many kernel waiters we have.
1007 } else { 1086 if (lock_info->GetIsKernelAddressKey()) {
1008 next_lock_owner->AddWaiterImpl(thread); 1087 num_kernel_waiters -= lock_info->GetWaiterCount();
1009 } 1088 ASSERT(num_kernel_waiters >= 0);
1010 num_waiters++; 1089 KScheduler::SetSchedulerUpdateNeeded(kernel);
1011 } else { 1090 }
1012 it++; 1091
1092 ASSERT(lock_info->GetWaiterCount() > 0);
1093
1094 // Remove the highest priority waiter from the lock to be the next owner.
1095 KThread* next_lock_owner = lock_info->GetHighestPriorityWaiter();
1096 if (lock_info->RemoveWaiter(next_lock_owner)) {
1097 // The new owner was the only waiter.
1098 *out_has_waiters = false;
1099
1100 // Free the lock info, since it has no waiters.
1101 LockWithPriorityInheritanceInfo::Free(kernel, lock_info);
1102 } else {
1103 // There are additional waiters on the lock.
1104 *out_has_waiters = true;
1105
1106 // Add the lock to the new owner's held list.
1107 next_lock_owner->AddHeldLock(lock_info);
1108
1109 // Keep track of any kernel waiters for the new owner.
1110 if (lock_info->GetIsKernelAddressKey()) {
1111 next_lock_owner->num_kernel_waiters += lock_info->GetWaiterCount();
1112 ASSERT(next_lock_owner->num_kernel_waiters > 0);
1113
1114 // NOTE: No need to set scheduler update needed, because we will have already done so
1115 // when removing earlier.
1013 } 1116 }
1014 } 1117 }
1015 1118
1016 // Do priority updates, if we have a next owner. 1119 // If our priority is the same as the next owner's (and we've inherited), we may need to restore
1017 if (next_lock_owner) { 1120 // to lower priority.
1121 if (this->GetPriority() == next_lock_owner->GetPriority() &&
1122 this->GetPriority() < this->GetBasePriority()) {
1018 RestorePriority(kernel, this); 1123 RestorePriority(kernel, this);
1019 RestorePriority(kernel, next_lock_owner); 1124 // NOTE: No need to restore priority on the next lock owner, because it was already the
1125 // highest priority waiter on the lock.
1020 } 1126 }
1021 1127
1022 // Return output. 1128 // Return the next lock owner.
1023 *out_num_waiters = num_waiters;
1024 return next_lock_owner; 1129 return next_lock_owner;
1025} 1130}
1026 1131
@@ -1137,9 +1242,7 @@ ThreadState KThread::RequestTerminate() {
1137 } 1242 }
1138 1243
1139 // Change the thread's priority to be higher than any system thread's. 1244 // Change the thread's priority to be higher than any system thread's.
1140 if (this->GetBasePriority() >= Svc::SystemThreadPriorityHighest) { 1245 this->IncreaseBasePriority(TerminatingThreadPriority);
1141 this->SetBasePriority(TerminatingThreadPriority);
1142 }
1143 1246
1144 // If the thread is runnable, send a termination interrupt to other cores. 1247 // If the thread is runnable, send a termination interrupt to other cores.
1145 if (this->GetState() == ThreadState::Runnable) { 1248 if (this->GetState() == ThreadState::Runnable) {
diff --git a/src/core/hle/kernel/k_thread.h b/src/core/hle/kernel/k_thread.h
index a04de21bc..bd125f5f1 100644
--- a/src/core/hle/kernel/k_thread.h
+++ b/src/core/hle/kernel/k_thread.h
@@ -339,13 +339,7 @@ public:
339 void SetInterruptFlag(); 339 void SetInterruptFlag();
340 void ClearInterruptFlag(); 340 void ClearInterruptFlag();
341 341
342 [[nodiscard]] KThread* GetLockOwner() const { 342 KThread* GetLockOwner() const;
343 return lock_owner;
344 }
345
346 void SetLockOwner(KThread* owner) {
347 lock_owner = owner;
348 }
349 343
350 [[nodiscard]] const KAffinityMask& GetAffinityMask() const { 344 [[nodiscard]] const KAffinityMask& GetAffinityMask() const {
351 return physical_affinity_mask; 345 return physical_affinity_mask;
@@ -601,7 +595,13 @@ public:
601 595
602 [[nodiscard]] Result GetThreadContext3(std::vector<u8>& out); 596 [[nodiscard]] Result GetThreadContext3(std::vector<u8>& out);
603 597
604 [[nodiscard]] KThread* RemoveWaiterByKey(s32* out_num_waiters, VAddr key); 598 [[nodiscard]] KThread* RemoveUserWaiterByKey(bool* out_has_waiters, VAddr key) {
599 return this->RemoveWaiterByKey(out_has_waiters, key, false);
600 }
601
602 [[nodiscard]] KThread* RemoveKernelWaiterByKey(bool* out_has_waiters, VAddr key) {
603 return this->RemoveWaiterByKey(out_has_waiters, key, true);
604 }
605 605
606 [[nodiscard]] VAddr GetAddressKey() const { 606 [[nodiscard]] VAddr GetAddressKey() const {
607 return address_key; 607 return address_key;
@@ -611,8 +611,8 @@ public:
611 return address_key_value; 611 return address_key_value;
612 } 612 }
613 613
614 [[nodiscard]] bool GetAddressKeyIsKernel() const { 614 [[nodiscard]] bool GetIsKernelAddressKey() const {
615 return address_key_is_kernel; 615 return is_kernel_address_key;
616 } 616 }
617 617
618 //! NB: intentional deviation from official kernel. 618 //! NB: intentional deviation from official kernel.
@@ -621,20 +621,17 @@ public:
621 // to cope with arbitrary host pointers making their way 621 // to cope with arbitrary host pointers making their way
622 // into things. 622 // into things.
623 623
624 void SetUserAddressKey(VAddr key) {
625 address_key = key;
626 address_key_is_kernel = false;
627 }
628
629 void SetUserAddressKey(VAddr key, u32 val) { 624 void SetUserAddressKey(VAddr key, u32 val) {
625 ASSERT(waiting_lock_info == nullptr);
630 address_key = key; 626 address_key = key;
631 address_key_value = val; 627 address_key_value = val;
632 address_key_is_kernel = false; 628 is_kernel_address_key = false;
633 } 629 }
634 630
635 void SetKernelAddressKey(VAddr key) { 631 void SetKernelAddressKey(VAddr key) {
632 ASSERT(waiting_lock_info == nullptr);
636 address_key = key; 633 address_key = key;
637 address_key_is_kernel = true; 634 is_kernel_address_key = true;
638 } 635 }
639 636
640 void ClearWaitQueue() { 637 void ClearWaitQueue() {
@@ -646,10 +643,6 @@ public:
646 void EndWait(Result wait_result_); 643 void EndWait(Result wait_result_);
647 void CancelWait(Result wait_result_, bool cancel_timer_task); 644 void CancelWait(Result wait_result_, bool cancel_timer_task);
648 645
649 [[nodiscard]] bool HasWaiters() const {
650 return !waiter_list.empty();
651 }
652
653 [[nodiscard]] s32 GetNumKernelWaiters() const { 646 [[nodiscard]] s32 GetNumKernelWaiters() const {
654 return num_kernel_waiters; 647 return num_kernel_waiters;
655 } 648 }
@@ -679,6 +672,9 @@ public:
679 } 672 }
680 673
681private: 674private:
675 [[nodiscard]] KThread* RemoveWaiterByKey(bool* out_has_waiters, VAddr key,
676 bool is_kernel_address_key);
677
682 static constexpr size_t PriorityInheritanceCountMax = 10; 678 static constexpr size_t PriorityInheritanceCountMax = 10;
683 union SyncObjectBuffer { 679 union SyncObjectBuffer {
684 std::array<KSynchronizationObject*, Svc::ArgumentHandleCountMax> sync_objects{}; 680 std::array<KSynchronizationObject*, Svc::ArgumentHandleCountMax> sync_objects{};
@@ -722,13 +718,14 @@ private:
722 }; 718 };
723 719
724 void AddWaiterImpl(KThread* thread); 720 void AddWaiterImpl(KThread* thread);
725
726 void RemoveWaiterImpl(KThread* thread); 721 void RemoveWaiterImpl(KThread* thread);
722 static void RestorePriority(KernelCore& kernel, KThread* thread);
727 723
728 void StartTermination(); 724 void StartTermination();
729
730 void FinishTermination(); 725 void FinishTermination();
731 726
727 void IncreaseBasePriority(s32 priority);
728
732 [[nodiscard]] Result Initialize(KThreadFunction func, uintptr_t arg, VAddr user_stack_top, 729 [[nodiscard]] Result Initialize(KThreadFunction func, uintptr_t arg, VAddr user_stack_top,
733 s32 prio, s32 virt_core, KProcess* owner, ThreadType type); 730 s32 prio, s32 virt_core, KProcess* owner, ThreadType type);
734 731
@@ -737,8 +734,6 @@ private:
737 s32 core, KProcess* owner, ThreadType type, 734 s32 core, KProcess* owner, ThreadType type,
738 std::function<void()>&& init_func); 735 std::function<void()>&& init_func);
739 736
740 static void RestorePriority(KernelCore& kernel_ctx, KThread* thread);
741
742 // For core KThread implementation 737 // For core KThread implementation
743 ThreadContext32 thread_context_32{}; 738 ThreadContext32 thread_context_32{};
744 ThreadContext64 thread_context_64{}; 739 ThreadContext64 thread_context_64{};
@@ -749,6 +744,127 @@ private:
749 &KThread::condvar_arbiter_tree_node>; 744 &KThread::condvar_arbiter_tree_node>;
750 using ConditionVariableThreadTree = 745 using ConditionVariableThreadTree =
751 ConditionVariableThreadTreeTraits::TreeType<ConditionVariableComparator>; 746 ConditionVariableThreadTreeTraits::TreeType<ConditionVariableComparator>;
747
748private:
749 struct LockWithPriorityInheritanceComparator {
750 struct RedBlackKeyType {
751 s32 m_priority;
752
753 constexpr s32 GetPriority() const {
754 return m_priority;
755 }
756 };
757
758 template <typename T>
759 requires(std::same_as<T, KThread> || std::same_as<T, RedBlackKeyType>)
760 static constexpr int Compare(const T& lhs, const KThread& rhs) {
761 if (lhs.GetPriority() < rhs.GetPriority()) {
762 // Sort by priority.
763 return -1;
764 } else {
765 return 1;
766 }
767 }
768 };
769 static_assert(std::same_as<Common::RedBlackKeyType<LockWithPriorityInheritanceComparator, void>,
770 LockWithPriorityInheritanceComparator::RedBlackKeyType>);
771
772 using LockWithPriorityInheritanceThreadTreeTraits =
773 Common::IntrusiveRedBlackTreeMemberTraitsDeferredAssert<
774 &KThread::condvar_arbiter_tree_node>;
775 using LockWithPriorityInheritanceThreadTree =
776 ConditionVariableThreadTreeTraits::TreeType<LockWithPriorityInheritanceComparator>;
777
778public:
779 class LockWithPriorityInheritanceInfo : public KSlabAllocated<LockWithPriorityInheritanceInfo>,
780 public boost::intrusive::list_base_hook<> {
781 public:
782 explicit LockWithPriorityInheritanceInfo(KernelCore&) {}
783
784 static LockWithPriorityInheritanceInfo* Create(KernelCore& kernel, VAddr address_key,
785 bool is_kernel_address_key) {
786 // Create a new lock info.
787 auto* new_lock = LockWithPriorityInheritanceInfo::Allocate(kernel);
788 ASSERT(new_lock != nullptr);
789
790 // Set the new lock's address key.
791 new_lock->m_address_key = address_key;
792 new_lock->m_is_kernel_address_key = is_kernel_address_key;
793
794 return new_lock;
795 }
796
797 void SetOwner(KThread* new_owner) {
798 // Set new owner.
799 m_owner = new_owner;
800 }
801
802 void AddWaiter(KThread* waiter) {
803 // Insert the waiter.
804 m_tree.insert(*waiter);
805 m_waiter_count++;
806
807 waiter->SetWaitingLockInfo(this);
808 }
809
810 [[nodiscard]] bool RemoveWaiter(KThread* waiter) {
811 m_tree.erase(m_tree.iterator_to(*waiter));
812
813 waiter->SetWaitingLockInfo(nullptr);
814
815 return (--m_waiter_count) == 0;
816 }
817
818 KThread* GetHighestPriorityWaiter() {
819 return std::addressof(m_tree.front());
820 }
821 const KThread* GetHighestPriorityWaiter() const {
822 return std::addressof(m_tree.front());
823 }
824
825 LockWithPriorityInheritanceThreadTree& GetThreadTree() {
826 return m_tree;
827 }
828 const LockWithPriorityInheritanceThreadTree& GetThreadTree() const {
829 return m_tree;
830 }
831
832 VAddr GetAddressKey() const {
833 return m_address_key;
834 }
835 bool GetIsKernelAddressKey() const {
836 return m_is_kernel_address_key;
837 }
838 KThread* GetOwner() const {
839 return m_owner;
840 }
841 u32 GetWaiterCount() const {
842 return m_waiter_count;
843 }
844
845 private:
846 LockWithPriorityInheritanceThreadTree m_tree{};
847 VAddr m_address_key{};
848 KThread* m_owner{};
849 u32 m_waiter_count{};
850 bool m_is_kernel_address_key{};
851 };
852
853 void SetWaitingLockInfo(LockWithPriorityInheritanceInfo* lock) {
854 waiting_lock_info = lock;
855 }
856
857 LockWithPriorityInheritanceInfo* GetWaitingLockInfo() {
858 return waiting_lock_info;
859 }
860
861 void AddHeldLock(LockWithPriorityInheritanceInfo* lock_info);
862 LockWithPriorityInheritanceInfo* FindHeldLock(VAddr address_key, bool is_kernel_address_key);
863
864private:
865 using LockWithPriorityInheritanceInfoList =
866 boost::intrusive::list<LockWithPriorityInheritanceInfo>;
867
752 ConditionVariableThreadTree* condvar_tree{}; 868 ConditionVariableThreadTree* condvar_tree{};
753 u64 condvar_key{}; 869 u64 condvar_key{};
754 u64 virtual_affinity_mask{}; 870 u64 virtual_affinity_mask{};
@@ -765,9 +881,9 @@ private:
765 s64 last_scheduled_tick{}; 881 s64 last_scheduled_tick{};
766 std::array<QueueEntry, Core::Hardware::NUM_CPU_CORES> per_core_priority_queue_entry{}; 882 std::array<QueueEntry, Core::Hardware::NUM_CPU_CORES> per_core_priority_queue_entry{};
767 KThreadQueue* wait_queue{}; 883 KThreadQueue* wait_queue{};
768 WaiterList waiter_list{}; 884 LockWithPriorityInheritanceInfoList held_lock_info_list{};
885 LockWithPriorityInheritanceInfo* waiting_lock_info{};
769 WaiterList pinned_waiter_list{}; 886 WaiterList pinned_waiter_list{};
770 KThread* lock_owner{};
771 u32 address_key_value{}; 887 u32 address_key_value{};
772 u32 suspend_request_flags{}; 888 u32 suspend_request_flags{};
773 u32 suspend_allowed_flags{}; 889 u32 suspend_allowed_flags{};
@@ -791,7 +907,7 @@ private:
791 bool debug_attached{}; 907 bool debug_attached{};
792 s8 priority_inheritance_count{}; 908 s8 priority_inheritance_count{};
793 bool resource_limit_release_hint{}; 909 bool resource_limit_release_hint{};
794 bool address_key_is_kernel{}; 910 bool is_kernel_address_key{};
795 StackParameters stack_parameters{}; 911 StackParameters stack_parameters{};
796 Common::SpinLock context_guard{}; 912 Common::SpinLock context_guard{};
797 913
@@ -814,10 +930,12 @@ public:
814 930
815 void SetConditionVariable(ConditionVariableThreadTree* tree, VAddr address, u64 cv_key, 931 void SetConditionVariable(ConditionVariableThreadTree* tree, VAddr address, u64 cv_key,
816 u32 value) { 932 u32 value) {
933 ASSERT(waiting_lock_info == nullptr);
817 condvar_tree = tree; 934 condvar_tree = tree;
818 condvar_key = cv_key; 935 condvar_key = cv_key;
819 address_key = address; 936 address_key = address;
820 address_key_value = value; 937 address_key_value = value;
938 is_kernel_address_key = false;
821 } 939 }
822 940
823 void ClearConditionVariable() { 941 void ClearConditionVariable() {
@@ -829,6 +947,7 @@ public:
829 } 947 }
830 948
831 void SetAddressArbiter(ConditionVariableThreadTree* tree, u64 address) { 949 void SetAddressArbiter(ConditionVariableThreadTree* tree, u64 address) {
950 ASSERT(waiting_lock_info == nullptr);
832 condvar_tree = tree; 951 condvar_tree = tree;
833 condvar_key = address; 952 condvar_key = address;
834 } 953 }
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index ce94d3605..ef7057ff7 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -1318,4 +1318,97 @@ const Core::System& KernelCore::System() const {
1318 return impl->system; 1318 return impl->system;
1319} 1319}
1320 1320
1321struct KernelCore::SlabHeapContainer {
1322 KSlabHeap<KClientSession> client_session;
1323 KSlabHeap<KEvent> event;
1324 KSlabHeap<KLinkedListNode> linked_list_node;
1325 KSlabHeap<KPort> port;
1326 KSlabHeap<KProcess> process;
1327 KSlabHeap<KResourceLimit> resource_limit;
1328 KSlabHeap<KSession> session;
1329 KSlabHeap<KSharedMemory> shared_memory;
1330 KSlabHeap<KSharedMemoryInfo> shared_memory_info;
1331 KSlabHeap<KThread> thread;
1332 KSlabHeap<KTransferMemory> transfer_memory;
1333 KSlabHeap<KCodeMemory> code_memory;
1334 KSlabHeap<KDeviceAddressSpace> device_address_space;
1335 KSlabHeap<KPageBuffer> page_buffer;
1336 KSlabHeap<KThreadLocalPage> thread_local_page;
1337 KSlabHeap<KObjectName> object_name;
1338 KSlabHeap<KSessionRequest> session_request;
1339 KSlabHeap<KSecureSystemResource> secure_system_resource;
1340 KSlabHeap<KThread::LockWithPriorityInheritanceInfo> lock_info;
1341 KSlabHeap<KEventInfo> event_info;
1342 KSlabHeap<KDebug> debug;
1343};
1344
1345template <typename T>
1346KSlabHeap<T>& KernelCore::SlabHeap() {
1347 if constexpr (std::is_same_v<T, KClientSession>) {
1348 return slab_heap_container->client_session;
1349 } else if constexpr (std::is_same_v<T, KEvent>) {
1350 return slab_heap_container->event;
1351 } else if constexpr (std::is_same_v<T, KLinkedListNode>) {
1352 return slab_heap_container->linked_list_node;
1353 } else if constexpr (std::is_same_v<T, KPort>) {
1354 return slab_heap_container->port;
1355 } else if constexpr (std::is_same_v<T, KProcess>) {
1356 return slab_heap_container->process;
1357 } else if constexpr (std::is_same_v<T, KResourceLimit>) {
1358 return slab_heap_container->resource_limit;
1359 } else if constexpr (std::is_same_v<T, KSession>) {
1360 return slab_heap_container->session;
1361 } else if constexpr (std::is_same_v<T, KSharedMemory>) {
1362 return slab_heap_container->shared_memory;
1363 } else if constexpr (std::is_same_v<T, KSharedMemoryInfo>) {
1364 return slab_heap_container->shared_memory_info;
1365 } else if constexpr (std::is_same_v<T, KThread>) {
1366 return slab_heap_container->thread;
1367 } else if constexpr (std::is_same_v<T, KTransferMemory>) {
1368 return slab_heap_container->transfer_memory;
1369 } else if constexpr (std::is_same_v<T, KCodeMemory>) {
1370 return slab_heap_container->code_memory;
1371 } else if constexpr (std::is_same_v<T, KDeviceAddressSpace>) {
1372 return slab_heap_container->device_address_space;
1373 } else if constexpr (std::is_same_v<T, KPageBuffer>) {
1374 return slab_heap_container->page_buffer;
1375 } else if constexpr (std::is_same_v<T, KThreadLocalPage>) {
1376 return slab_heap_container->thread_local_page;
1377 } else if constexpr (std::is_same_v<T, KObjectName>) {
1378 return slab_heap_container->object_name;
1379 } else if constexpr (std::is_same_v<T, KSessionRequest>) {
1380 return slab_heap_container->session_request;
1381 } else if constexpr (std::is_same_v<T, KSecureSystemResource>) {
1382 return slab_heap_container->secure_system_resource;
1383 } else if constexpr (std::is_same_v<T, KThread::LockWithPriorityInheritanceInfo>) {
1384 return slab_heap_container->lock_info;
1385 } else if constexpr (std::is_same_v<T, KEventInfo>) {
1386 return slab_heap_container->event_info;
1387 } else if constexpr (std::is_same_v<T, KDebug>) {
1388 return slab_heap_container->debug;
1389 }
1390}
1391
1392template KSlabHeap<KClientSession>& KernelCore::SlabHeap();
1393template KSlabHeap<KEvent>& KernelCore::SlabHeap();
1394template KSlabHeap<KLinkedListNode>& KernelCore::SlabHeap();
1395template KSlabHeap<KPort>& KernelCore::SlabHeap();
1396template KSlabHeap<KProcess>& KernelCore::SlabHeap();
1397template KSlabHeap<KResourceLimit>& KernelCore::SlabHeap();
1398template KSlabHeap<KSession>& KernelCore::SlabHeap();
1399template KSlabHeap<KSharedMemory>& KernelCore::SlabHeap();
1400template KSlabHeap<KSharedMemoryInfo>& KernelCore::SlabHeap();
1401template KSlabHeap<KThread>& KernelCore::SlabHeap();
1402template KSlabHeap<KTransferMemory>& KernelCore::SlabHeap();
1403template KSlabHeap<KCodeMemory>& KernelCore::SlabHeap();
1404template KSlabHeap<KDeviceAddressSpace>& KernelCore::SlabHeap();
1405template KSlabHeap<KPageBuffer>& KernelCore::SlabHeap();
1406template KSlabHeap<KThreadLocalPage>& KernelCore::SlabHeap();
1407template KSlabHeap<KObjectName>& KernelCore::SlabHeap();
1408template KSlabHeap<KSessionRequest>& KernelCore::SlabHeap();
1409template KSlabHeap<KSecureSystemResource>& KernelCore::SlabHeap();
1410template KSlabHeap<KThread::LockWithPriorityInheritanceInfo>& KernelCore::SlabHeap();
1411template KSlabHeap<KEventInfo>& KernelCore::SlabHeap();
1412template KSlabHeap<KDebug>& KernelCore::SlabHeap();
1413
1321} // namespace Kernel 1414} // namespace Kernel
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h
index 4449f6949..1b380a07b 100644
--- a/src/core/hle/kernel/kernel.h
+++ b/src/core/hle/kernel/kernel.h
@@ -305,49 +305,7 @@ public:
305 305
306 /// Gets the slab heap for the specified kernel object type. 306 /// Gets the slab heap for the specified kernel object type.
307 template <typename T> 307 template <typename T>
308 KSlabHeap<T>& SlabHeap() { 308 KSlabHeap<T>& SlabHeap();
309 if constexpr (std::is_same_v<T, KClientSession>) {
310 return slab_heap_container->client_session;
311 } else if constexpr (std::is_same_v<T, KEvent>) {
312 return slab_heap_container->event;
313 } else if constexpr (std::is_same_v<T, KLinkedListNode>) {
314 return slab_heap_container->linked_list_node;
315 } else if constexpr (std::is_same_v<T, KPort>) {
316 return slab_heap_container->port;
317 } else if constexpr (std::is_same_v<T, KProcess>) {
318 return slab_heap_container->process;
319 } else if constexpr (std::is_same_v<T, KResourceLimit>) {
320 return slab_heap_container->resource_limit;
321 } else if constexpr (std::is_same_v<T, KSession>) {
322 return slab_heap_container->session;
323 } else if constexpr (std::is_same_v<T, KSharedMemory>) {
324 return slab_heap_container->shared_memory;
325 } else if constexpr (std::is_same_v<T, KSharedMemoryInfo>) {
326 return slab_heap_container->shared_memory_info;
327 } else if constexpr (std::is_same_v<T, KThread>) {
328 return slab_heap_container->thread;
329 } else if constexpr (std::is_same_v<T, KTransferMemory>) {
330 return slab_heap_container->transfer_memory;
331 } else if constexpr (std::is_same_v<T, KCodeMemory>) {
332 return slab_heap_container->code_memory;
333 } else if constexpr (std::is_same_v<T, KDeviceAddressSpace>) {
334 return slab_heap_container->device_address_space;
335 } else if constexpr (std::is_same_v<T, KPageBuffer>) {
336 return slab_heap_container->page_buffer;
337 } else if constexpr (std::is_same_v<T, KThreadLocalPage>) {
338 return slab_heap_container->thread_local_page;
339 } else if constexpr (std::is_same_v<T, KObjectName>) {
340 return slab_heap_container->object_name;
341 } else if constexpr (std::is_same_v<T, KSessionRequest>) {
342 return slab_heap_container->session_request;
343 } else if constexpr (std::is_same_v<T, KSecureSystemResource>) {
344 return slab_heap_container->secure_system_resource;
345 } else if constexpr (std::is_same_v<T, KEventInfo>) {
346 return slab_heap_container->event_info;
347 } else if constexpr (std::is_same_v<T, KDebug>) {
348 return slab_heap_container->debug;
349 }
350 }
351 309
352 /// Gets the current slab resource counts. 310 /// Gets the current slab resource counts.
353 Init::KSlabResourceCounts& SlabResourceCounts(); 311 Init::KSlabResourceCounts& SlabResourceCounts();
@@ -393,28 +351,7 @@ private:
393 351
394private: 352private:
395 /// Helper to encapsulate all slab heaps in a single heap allocated container 353 /// Helper to encapsulate all slab heaps in a single heap allocated container
396 struct SlabHeapContainer { 354 struct SlabHeapContainer;
397 KSlabHeap<KClientSession> client_session;
398 KSlabHeap<KEvent> event;
399 KSlabHeap<KLinkedListNode> linked_list_node;
400 KSlabHeap<KPort> port;
401 KSlabHeap<KProcess> process;
402 KSlabHeap<KResourceLimit> resource_limit;
403 KSlabHeap<KSession> session;
404 KSlabHeap<KSharedMemory> shared_memory;
405 KSlabHeap<KSharedMemoryInfo> shared_memory_info;
406 KSlabHeap<KThread> thread;
407 KSlabHeap<KTransferMemory> transfer_memory;
408 KSlabHeap<KCodeMemory> code_memory;
409 KSlabHeap<KDeviceAddressSpace> device_address_space;
410 KSlabHeap<KPageBuffer> page_buffer;
411 KSlabHeap<KThreadLocalPage> thread_local_page;
412 KSlabHeap<KObjectName> object_name;
413 KSlabHeap<KSessionRequest> session_request;
414 KSlabHeap<KSecureSystemResource> secure_system_resource;
415 KSlabHeap<KEventInfo> event_info;
416 KSlabHeap<KDebug> debug;
417 };
418 355
419 std::unique_ptr<SlabHeapContainer> slab_heap_container; 356 std::unique_ptr<SlabHeapContainer> slab_heap_container;
420}; 357};
diff --git a/src/core/hle/kernel/svc_types.h b/src/core/hle/kernel/svc_types.h
index 542c13461..39355d9c4 100644
--- a/src/core/hle/kernel/svc_types.h
+++ b/src/core/hle/kernel/svc_types.h
@@ -151,6 +151,7 @@ enum class InfoType : u32 {
151 FreeThreadCount = 24, 151 FreeThreadCount = 24,
152 ThreadTickCount = 25, 152 ThreadTickCount = 25,
153 IsSvcPermitted = 26, 153 IsSvcPermitted = 26,
154 IoRegionHint = 27,
154 155
155 MesosphereMeta = 65000, 156 MesosphereMeta = 65000,
156 MesosphereCurrentProcess = 65001, 157 MesosphereCurrentProcess = 65001,
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp
index c3e5c4462..ddc3a6dbe 100644
--- a/src/core/hle/service/acc/acc.cpp
+++ b/src/core/hle/service/acc/acc.cpp
@@ -15,7 +15,6 @@
15#include "core/core_timing.h" 15#include "core/core_timing.h"
16#include "core/file_sys/control_metadata.h" 16#include "core/file_sys/control_metadata.h"
17#include "core/file_sys/patch_manager.h" 17#include "core/file_sys/patch_manager.h"
18#include "core/hle/ipc_helpers.h"
19#include "core/hle/service/acc/acc.h" 18#include "core/hle/service/acc/acc.h"
20#include "core/hle/service/acc/acc_aa.h" 19#include "core/hle/service/acc/acc_aa.h"
21#include "core/hle/service/acc/acc_su.h" 20#include "core/hle/service/acc/acc_su.h"
@@ -25,6 +24,7 @@
25#include "core/hle/service/acc/errors.h" 24#include "core/hle/service/acc/errors.h"
26#include "core/hle/service/acc/profile_manager.h" 25#include "core/hle/service/acc/profile_manager.h"
27#include "core/hle/service/glue/glue_manager.h" 26#include "core/hle/service/glue/glue_manager.h"
27#include "core/hle/service/ipc_helpers.h"
28#include "core/hle/service/server_manager.h" 28#include "core/hle/service/server_manager.h"
29#include "core/loader/loader.h" 29#include "core/loader/loader.h"
30 30
@@ -295,7 +295,7 @@ public:
295 } 295 }
296 296
297protected: 297protected:
298 void Get(Kernel::HLERequestContext& ctx) { 298 void Get(HLERequestContext& ctx) {
299 LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString()); 299 LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString());
300 ProfileBase profile_base{}; 300 ProfileBase profile_base{};
301 UserData data{}; 301 UserData data{};
@@ -312,7 +312,7 @@ protected:
312 } 312 }
313 } 313 }
314 314
315 void GetBase(Kernel::HLERequestContext& ctx) { 315 void GetBase(HLERequestContext& ctx) {
316 LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString()); 316 LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString());
317 ProfileBase profile_base{}; 317 ProfileBase profile_base{};
318 if (profile_manager.GetProfileBase(user_id, profile_base)) { 318 if (profile_manager.GetProfileBase(user_id, profile_base)) {
@@ -326,7 +326,7 @@ protected:
326 } 326 }
327 } 327 }
328 328
329 void LoadImage(Kernel::HLERequestContext& ctx) { 329 void LoadImage(HLERequestContext& ctx) {
330 LOG_DEBUG(Service_ACC, "called"); 330 LOG_DEBUG(Service_ACC, "called");
331 331
332 IPC::ResponseBuilder rb{ctx, 3}; 332 IPC::ResponseBuilder rb{ctx, 3};
@@ -353,7 +353,7 @@ protected:
353 rb.Push<u32>(size); 353 rb.Push<u32>(size);
354 } 354 }
355 355
356 void GetImageSize(Kernel::HLERequestContext& ctx) { 356 void GetImageSize(HLERequestContext& ctx) {
357 LOG_DEBUG(Service_ACC, "called"); 357 LOG_DEBUG(Service_ACC, "called");
358 IPC::ResponseBuilder rb{ctx, 3}; 358 IPC::ResponseBuilder rb{ctx, 3};
359 rb.Push(ResultSuccess); 359 rb.Push(ResultSuccess);
@@ -370,7 +370,7 @@ protected:
370 } 370 }
371 } 371 }
372 372
373 void Store(Kernel::HLERequestContext& ctx) { 373 void Store(HLERequestContext& ctx) {
374 IPC::RequestParser rp{ctx}; 374 IPC::RequestParser rp{ctx};
375 const auto base = rp.PopRaw<ProfileBase>(); 375 const auto base = rp.PopRaw<ProfileBase>();
376 376
@@ -402,7 +402,7 @@ protected:
402 rb.Push(ResultSuccess); 402 rb.Push(ResultSuccess);
403 } 403 }
404 404
405 void StoreWithImage(Kernel::HLERequestContext& ctx) { 405 void StoreWithImage(HLERequestContext& ctx) {
406 IPC::RequestParser rp{ctx}; 406 IPC::RequestParser rp{ctx};
407 const auto base = rp.PopRaw<ProfileBase>(); 407 const auto base = rp.PopRaw<ProfileBase>();
408 408
@@ -499,7 +499,7 @@ public:
499 } 499 }
500 ~EnsureTokenIdCacheAsyncInterface() = default; 500 ~EnsureTokenIdCacheAsyncInterface() = default;
501 501
502 void LoadIdTokenCache(Kernel::HLERequestContext& ctx) { 502 void LoadIdTokenCache(HLERequestContext& ctx) {
503 LOG_WARNING(Service_ACC, "(STUBBED) called"); 503 LOG_WARNING(Service_ACC, "(STUBBED) called");
504 504
505 IPC::ResponseBuilder rb{ctx, 2}; 505 IPC::ResponseBuilder rb{ctx, 2};
@@ -542,14 +542,14 @@ public:
542 } 542 }
543 543
544private: 544private:
545 void CheckAvailability(Kernel::HLERequestContext& ctx) { 545 void CheckAvailability(HLERequestContext& ctx) {
546 LOG_DEBUG(Service_ACC, "(STUBBED) called"); 546 LOG_DEBUG(Service_ACC, "(STUBBED) called");
547 IPC::ResponseBuilder rb{ctx, 3}; 547 IPC::ResponseBuilder rb{ctx, 3};
548 rb.Push(ResultSuccess); 548 rb.Push(ResultSuccess);
549 rb.Push(false); // TODO: Check when this is supposed to return true and when not 549 rb.Push(false); // TODO: Check when this is supposed to return true and when not
550 } 550 }
551 551
552 void GetAccountId(Kernel::HLERequestContext& ctx) { 552 void GetAccountId(HLERequestContext& ctx) {
553 LOG_DEBUG(Service_ACC, "called"); 553 LOG_DEBUG(Service_ACC, "called");
554 554
555 IPC::ResponseBuilder rb{ctx, 4}; 555 IPC::ResponseBuilder rb{ctx, 4};
@@ -557,7 +557,7 @@ private:
557 rb.PushRaw<u64>(profile_manager->GetLastOpenedUser().Hash()); 557 rb.PushRaw<u64>(profile_manager->GetLastOpenedUser().Hash());
558 } 558 }
559 559
560 void EnsureIdTokenCacheAsync(Kernel::HLERequestContext& ctx) { 560 void EnsureIdTokenCacheAsync(HLERequestContext& ctx) {
561 LOG_WARNING(Service_ACC, "(STUBBED) called"); 561 LOG_WARNING(Service_ACC, "(STUBBED) called");
562 562
563 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 563 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -565,13 +565,13 @@ private:
565 rb.PushIpcInterface(ensure_token_id); 565 rb.PushIpcInterface(ensure_token_id);
566 } 566 }
567 567
568 void LoadIdTokenCache(Kernel::HLERequestContext& ctx) { 568 void LoadIdTokenCache(HLERequestContext& ctx) {
569 LOG_WARNING(Service_ACC, "(STUBBED) called"); 569 LOG_WARNING(Service_ACC, "(STUBBED) called");
570 570
571 ensure_token_id->LoadIdTokenCache(ctx); 571 ensure_token_id->LoadIdTokenCache(ctx);
572 } 572 }
573 573
574 void GetNintendoAccountUserResourceCacheForApplication(Kernel::HLERequestContext& ctx) { 574 void GetNintendoAccountUserResourceCacheForApplication(HLERequestContext& ctx) {
575 LOG_WARNING(Service_ACC, "(STUBBED) called"); 575 LOG_WARNING(Service_ACC, "(STUBBED) called");
576 576
577 std::vector<u8> nas_user_base_for_application(0x68); 577 std::vector<u8> nas_user_base_for_application(0x68);
@@ -587,7 +587,7 @@ private:
587 rb.PushRaw<u64>(profile_manager->GetLastOpenedUser().Hash()); 587 rb.PushRaw<u64>(profile_manager->GetLastOpenedUser().Hash());
588 } 588 }
589 589
590 void StoreOpenContext(Kernel::HLERequestContext& ctx) { 590 void StoreOpenContext(HLERequestContext& ctx) {
591 LOG_DEBUG(Service_ACC, "called"); 591 LOG_DEBUG(Service_ACC, "called");
592 592
593 profile_manager->StoreOpenedUsers(); 593 profile_manager->StoreOpenedUsers();
@@ -689,14 +689,14 @@ public:
689 } 689 }
690}; 690};
691 691
692void Module::Interface::GetUserCount(Kernel::HLERequestContext& ctx) { 692void Module::Interface::GetUserCount(HLERequestContext& ctx) {
693 LOG_DEBUG(Service_ACC, "called"); 693 LOG_DEBUG(Service_ACC, "called");
694 IPC::ResponseBuilder rb{ctx, 3}; 694 IPC::ResponseBuilder rb{ctx, 3};
695 rb.Push(ResultSuccess); 695 rb.Push(ResultSuccess);
696 rb.Push<u32>(static_cast<u32>(profile_manager->GetUserCount())); 696 rb.Push<u32>(static_cast<u32>(profile_manager->GetUserCount()));
697} 697}
698 698
699void Module::Interface::GetUserExistence(Kernel::HLERequestContext& ctx) { 699void Module::Interface::GetUserExistence(HLERequestContext& ctx) {
700 IPC::RequestParser rp{ctx}; 700 IPC::RequestParser rp{ctx};
701 Common::UUID user_id = rp.PopRaw<Common::UUID>(); 701 Common::UUID user_id = rp.PopRaw<Common::UUID>();
702 LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString()); 702 LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString());
@@ -706,28 +706,28 @@ void Module::Interface::GetUserExistence(Kernel::HLERequestContext& ctx) {
706 rb.Push(profile_manager->UserExists(user_id)); 706 rb.Push(profile_manager->UserExists(user_id));
707} 707}
708 708
709void Module::Interface::ListAllUsers(Kernel::HLERequestContext& ctx) { 709void Module::Interface::ListAllUsers(HLERequestContext& ctx) {
710 LOG_DEBUG(Service_ACC, "called"); 710 LOG_DEBUG(Service_ACC, "called");
711 ctx.WriteBuffer(profile_manager->GetAllUsers()); 711 ctx.WriteBuffer(profile_manager->GetAllUsers());
712 IPC::ResponseBuilder rb{ctx, 2}; 712 IPC::ResponseBuilder rb{ctx, 2};
713 rb.Push(ResultSuccess); 713 rb.Push(ResultSuccess);
714} 714}
715 715
716void Module::Interface::ListOpenUsers(Kernel::HLERequestContext& ctx) { 716void Module::Interface::ListOpenUsers(HLERequestContext& ctx) {
717 LOG_DEBUG(Service_ACC, "called"); 717 LOG_DEBUG(Service_ACC, "called");
718 ctx.WriteBuffer(profile_manager->GetOpenUsers()); 718 ctx.WriteBuffer(profile_manager->GetOpenUsers());
719 IPC::ResponseBuilder rb{ctx, 2}; 719 IPC::ResponseBuilder rb{ctx, 2};
720 rb.Push(ResultSuccess); 720 rb.Push(ResultSuccess);
721} 721}
722 722
723void Module::Interface::GetLastOpenedUser(Kernel::HLERequestContext& ctx) { 723void Module::Interface::GetLastOpenedUser(HLERequestContext& ctx) {
724 LOG_DEBUG(Service_ACC, "called"); 724 LOG_DEBUG(Service_ACC, "called");
725 IPC::ResponseBuilder rb{ctx, 6}; 725 IPC::ResponseBuilder rb{ctx, 6};
726 rb.Push(ResultSuccess); 726 rb.Push(ResultSuccess);
727 rb.PushRaw<Common::UUID>(profile_manager->GetLastOpenedUser()); 727 rb.PushRaw<Common::UUID>(profile_manager->GetLastOpenedUser());
728} 728}
729 729
730void Module::Interface::GetProfile(Kernel::HLERequestContext& ctx) { 730void Module::Interface::GetProfile(HLERequestContext& ctx) {
731 IPC::RequestParser rp{ctx}; 731 IPC::RequestParser rp{ctx};
732 Common::UUID user_id = rp.PopRaw<Common::UUID>(); 732 Common::UUID user_id = rp.PopRaw<Common::UUID>();
733 LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString()); 733 LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString());
@@ -737,20 +737,20 @@ void Module::Interface::GetProfile(Kernel::HLERequestContext& ctx) {
737 rb.PushIpcInterface<IProfile>(system, user_id, *profile_manager); 737 rb.PushIpcInterface<IProfile>(system, user_id, *profile_manager);
738} 738}
739 739
740void Module::Interface::IsUserRegistrationRequestPermitted(Kernel::HLERequestContext& ctx) { 740void Module::Interface::IsUserRegistrationRequestPermitted(HLERequestContext& ctx) {
741 LOG_WARNING(Service_ACC, "(STUBBED) called"); 741 LOG_WARNING(Service_ACC, "(STUBBED) called");
742 IPC::ResponseBuilder rb{ctx, 3}; 742 IPC::ResponseBuilder rb{ctx, 3};
743 rb.Push(ResultSuccess); 743 rb.Push(ResultSuccess);
744 rb.Push(profile_manager->CanSystemRegisterUser()); 744 rb.Push(profile_manager->CanSystemRegisterUser());
745} 745}
746 746
747void Module::Interface::InitializeApplicationInfo(Kernel::HLERequestContext& ctx) { 747void Module::Interface::InitializeApplicationInfo(HLERequestContext& ctx) {
748 LOG_DEBUG(Service_ACC, "called"); 748 LOG_DEBUG(Service_ACC, "called");
749 IPC::ResponseBuilder rb{ctx, 2}; 749 IPC::ResponseBuilder rb{ctx, 2};
750 rb.Push(InitializeApplicationInfoBase()); 750 rb.Push(InitializeApplicationInfoBase());
751} 751}
752 752
753void Module::Interface::InitializeApplicationInfoRestricted(Kernel::HLERequestContext& ctx) { 753void Module::Interface::InitializeApplicationInfoRestricted(HLERequestContext& ctx) {
754 LOG_WARNING(Service_ACC, "(Partial implementation) called"); 754 LOG_WARNING(Service_ACC, "(Partial implementation) called");
755 755
756 // TODO(ogniK): We require checking if the user actually owns the title and what not. As of 756 // TODO(ogniK): We require checking if the user actually owns the title and what not. As of
@@ -800,14 +800,14 @@ Result Module::Interface::InitializeApplicationInfoBase() {
800 return ResultSuccess; 800 return ResultSuccess;
801} 801}
802 802
803void Module::Interface::GetBaasAccountManagerForApplication(Kernel::HLERequestContext& ctx) { 803void Module::Interface::GetBaasAccountManagerForApplication(HLERequestContext& ctx) {
804 LOG_DEBUG(Service_ACC, "called"); 804 LOG_DEBUG(Service_ACC, "called");
805 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 805 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
806 rb.Push(ResultSuccess); 806 rb.Push(ResultSuccess);
807 rb.PushIpcInterface<IManagerForApplication>(system, profile_manager); 807 rb.PushIpcInterface<IManagerForApplication>(system, profile_manager);
808} 808}
809 809
810void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx) { 810void Module::Interface::IsUserAccountSwitchLocked(HLERequestContext& ctx) {
811 LOG_DEBUG(Service_ACC, "called"); 811 LOG_DEBUG(Service_ACC, "called");
812 FileSys::NACP nacp; 812 FileSys::NACP nacp;
813 const auto res = system.GetAppLoader().ReadControlData(nacp); 813 const auto res = system.GetAppLoader().ReadControlData(nacp);
@@ -834,14 +834,14 @@ void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx
834 rb.Push(is_locked); 834 rb.Push(is_locked);
835} 835}
836 836
837void Module::Interface::InitializeApplicationInfoV2(Kernel::HLERequestContext& ctx) { 837void Module::Interface::InitializeApplicationInfoV2(HLERequestContext& ctx) {
838 LOG_WARNING(Service_ACC, "(STUBBED) called"); 838 LOG_WARNING(Service_ACC, "(STUBBED) called");
839 839
840 IPC::ResponseBuilder rb{ctx, 2}; 840 IPC::ResponseBuilder rb{ctx, 2};
841 rb.Push(ResultSuccess); 841 rb.Push(ResultSuccess);
842} 842}
843 843
844void Module::Interface::GetProfileEditor(Kernel::HLERequestContext& ctx) { 844void Module::Interface::GetProfileEditor(HLERequestContext& ctx) {
845 IPC::RequestParser rp{ctx}; 845 IPC::RequestParser rp{ctx};
846 Common::UUID user_id = rp.PopRaw<Common::UUID>(); 846 Common::UUID user_id = rp.PopRaw<Common::UUID>();
847 847
@@ -852,7 +852,7 @@ void Module::Interface::GetProfileEditor(Kernel::HLERequestContext& ctx) {
852 rb.PushIpcInterface<IProfileEditor>(system, user_id, *profile_manager); 852 rb.PushIpcInterface<IProfileEditor>(system, user_id, *profile_manager);
853} 853}
854 854
855void Module::Interface::ListQualifiedUsers(Kernel::HLERequestContext& ctx) { 855void Module::Interface::ListQualifiedUsers(HLERequestContext& ctx) {
856 LOG_DEBUG(Service_ACC, "called"); 856 LOG_DEBUG(Service_ACC, "called");
857 857
858 // All users should be qualified. We don't actually have parental control or anything to do with 858 // All users should be qualified. We don't actually have parental control or anything to do with
@@ -863,7 +863,7 @@ void Module::Interface::ListQualifiedUsers(Kernel::HLERequestContext& ctx) {
863 rb.Push(ResultSuccess); 863 rb.Push(ResultSuccess);
864} 864}
865 865
866void Module::Interface::ListOpenContextStoredUsers(Kernel::HLERequestContext& ctx) { 866void Module::Interface::ListOpenContextStoredUsers(HLERequestContext& ctx) {
867 LOG_DEBUG(Service_ACC, "called"); 867 LOG_DEBUG(Service_ACC, "called");
868 868
869 ctx.WriteBuffer(profile_manager->GetStoredOpenedUsers()); 869 ctx.WriteBuffer(profile_manager->GetStoredOpenedUsers());
@@ -871,7 +871,7 @@ void Module::Interface::ListOpenContextStoredUsers(Kernel::HLERequestContext& ct
871 rb.Push(ResultSuccess); 871 rb.Push(ResultSuccess);
872} 872}
873 873
874void Module::Interface::StoreSaveDataThumbnailApplication(Kernel::HLERequestContext& ctx) { 874void Module::Interface::StoreSaveDataThumbnailApplication(HLERequestContext& ctx) {
875 IPC::RequestParser rp{ctx}; 875 IPC::RequestParser rp{ctx};
876 const auto uuid = rp.PopRaw<Common::UUID>(); 876 const auto uuid = rp.PopRaw<Common::UUID>();
877 877
@@ -884,7 +884,7 @@ void Module::Interface::StoreSaveDataThumbnailApplication(Kernel::HLERequestCont
884 StoreSaveDataThumbnail(ctx, uuid, tid); 884 StoreSaveDataThumbnail(ctx, uuid, tid);
885} 885}
886 886
887void Module::Interface::StoreSaveDataThumbnailSystem(Kernel::HLERequestContext& ctx) { 887void Module::Interface::StoreSaveDataThumbnailSystem(HLERequestContext& ctx) {
888 IPC::RequestParser rp{ctx}; 888 IPC::RequestParser rp{ctx};
889 const auto uuid = rp.PopRaw<Common::UUID>(); 889 const auto uuid = rp.PopRaw<Common::UUID>();
890 const auto tid = rp.Pop<u64_le>(); 890 const auto tid = rp.Pop<u64_le>();
@@ -893,8 +893,8 @@ void Module::Interface::StoreSaveDataThumbnailSystem(Kernel::HLERequestContext&
893 StoreSaveDataThumbnail(ctx, uuid, tid); 893 StoreSaveDataThumbnail(ctx, uuid, tid);
894} 894}
895 895
896void Module::Interface::StoreSaveDataThumbnail(Kernel::HLERequestContext& ctx, 896void Module::Interface::StoreSaveDataThumbnail(HLERequestContext& ctx, const Common::UUID& uuid,
897 const Common::UUID& uuid, const u64 tid) { 897 const u64 tid) {
898 IPC::ResponseBuilder rb{ctx, 2}; 898 IPC::ResponseBuilder rb{ctx, 2};
899 899
900 if (tid == 0) { 900 if (tid == 0) {
@@ -920,7 +920,7 @@ void Module::Interface::StoreSaveDataThumbnail(Kernel::HLERequestContext& ctx,
920 rb.Push(ResultSuccess); 920 rb.Push(ResultSuccess);
921} 921}
922 922
923void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx) { 923void Module::Interface::TrySelectUserWithoutInteraction(HLERequestContext& ctx) {
924 LOG_DEBUG(Service_ACC, "called"); 924 LOG_DEBUG(Service_ACC, "called");
925 // A u8 is passed into this function which we can safely ignore. It's to determine if we have 925 // A u8 is passed into this function which we can safely ignore. It's to determine if we have
926 // access to use the network or not by the looks of it 926 // access to use the network or not by the looks of it
diff --git a/src/core/hle/service/acc/acc.h b/src/core/hle/service/acc/acc.h
index a2fdafd82..6b4735c2f 100644
--- a/src/core/hle/service/acc/acc.h
+++ b/src/core/hle/service/acc/acc.h
@@ -20,28 +20,28 @@ public:
20 const char* name); 20 const char* name);
21 ~Interface() override; 21 ~Interface() override;
22 22
23 void GetUserCount(Kernel::HLERequestContext& ctx); 23 void GetUserCount(HLERequestContext& ctx);
24 void GetUserExistence(Kernel::HLERequestContext& ctx); 24 void GetUserExistence(HLERequestContext& ctx);
25 void ListAllUsers(Kernel::HLERequestContext& ctx); 25 void ListAllUsers(HLERequestContext& ctx);
26 void ListOpenUsers(Kernel::HLERequestContext& ctx); 26 void ListOpenUsers(HLERequestContext& ctx);
27 void GetLastOpenedUser(Kernel::HLERequestContext& ctx); 27 void GetLastOpenedUser(HLERequestContext& ctx);
28 void GetProfile(Kernel::HLERequestContext& ctx); 28 void GetProfile(HLERequestContext& ctx);
29 void InitializeApplicationInfo(Kernel::HLERequestContext& ctx); 29 void InitializeApplicationInfo(HLERequestContext& ctx);
30 void InitializeApplicationInfoRestricted(Kernel::HLERequestContext& ctx); 30 void InitializeApplicationInfoRestricted(HLERequestContext& ctx);
31 void GetBaasAccountManagerForApplication(Kernel::HLERequestContext& ctx); 31 void GetBaasAccountManagerForApplication(HLERequestContext& ctx);
32 void IsUserRegistrationRequestPermitted(Kernel::HLERequestContext& ctx); 32 void IsUserRegistrationRequestPermitted(HLERequestContext& ctx);
33 void TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx); 33 void TrySelectUserWithoutInteraction(HLERequestContext& ctx);
34 void IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx); 34 void IsUserAccountSwitchLocked(HLERequestContext& ctx);
35 void InitializeApplicationInfoV2(Kernel::HLERequestContext& ctx); 35 void InitializeApplicationInfoV2(HLERequestContext& ctx);
36 void GetProfileEditor(Kernel::HLERequestContext& ctx); 36 void GetProfileEditor(HLERequestContext& ctx);
37 void ListQualifiedUsers(Kernel::HLERequestContext& ctx); 37 void ListQualifiedUsers(HLERequestContext& ctx);
38 void ListOpenContextStoredUsers(Kernel::HLERequestContext& ctx); 38 void ListOpenContextStoredUsers(HLERequestContext& ctx);
39 void StoreSaveDataThumbnailApplication(Kernel::HLERequestContext& ctx); 39 void StoreSaveDataThumbnailApplication(HLERequestContext& ctx);
40 void StoreSaveDataThumbnailSystem(Kernel::HLERequestContext& ctx); 40 void StoreSaveDataThumbnailSystem(HLERequestContext& ctx);
41 41
42 private: 42 private:
43 Result InitializeApplicationInfoBase(); 43 Result InitializeApplicationInfoBase();
44 void StoreSaveDataThumbnail(Kernel::HLERequestContext& ctx, const Common::UUID& uuid, 44 void StoreSaveDataThumbnail(HLERequestContext& ctx, const Common::UUID& uuid,
45 const u64 tid); 45 const u64 tid);
46 46
47 enum class ApplicationType : u32_le { 47 enum class ApplicationType : u32_le {
diff --git a/src/core/hle/service/acc/async_context.cpp b/src/core/hle/service/acc/async_context.cpp
index 713689d8f..c9e0af90c 100644
--- a/src/core/hle/service/acc/async_context.cpp
+++ b/src/core/hle/service/acc/async_context.cpp
@@ -2,9 +2,9 @@
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "core/core.h" 4#include "core/core.h"
5#include "core/hle/ipc_helpers.h"
6#include "core/hle/kernel/k_event.h" 5#include "core/hle/kernel/k_event.h"
7#include "core/hle/service/acc/async_context.h" 6#include "core/hle/service/acc/async_context.h"
7#include "core/hle/service/ipc_helpers.h"
8 8
9namespace Service::Account { 9namespace Service::Account {
10IAsyncContext::IAsyncContext(Core::System& system_) 10IAsyncContext::IAsyncContext(Core::System& system_)
@@ -27,7 +27,7 @@ IAsyncContext::~IAsyncContext() {
27 service_context.CloseEvent(completion_event); 27 service_context.CloseEvent(completion_event);
28} 28}
29 29
30void IAsyncContext::GetSystemEvent(Kernel::HLERequestContext& ctx) { 30void IAsyncContext::GetSystemEvent(HLERequestContext& ctx) {
31 LOG_DEBUG(Service_ACC, "called"); 31 LOG_DEBUG(Service_ACC, "called");
32 32
33 IPC::ResponseBuilder rb{ctx, 2, 1}; 33 IPC::ResponseBuilder rb{ctx, 2, 1};
@@ -35,7 +35,7 @@ void IAsyncContext::GetSystemEvent(Kernel::HLERequestContext& ctx) {
35 rb.PushCopyObjects(completion_event->GetReadableEvent()); 35 rb.PushCopyObjects(completion_event->GetReadableEvent());
36} 36}
37 37
38void IAsyncContext::Cancel(Kernel::HLERequestContext& ctx) { 38void IAsyncContext::Cancel(HLERequestContext& ctx) {
39 LOG_DEBUG(Service_ACC, "called"); 39 LOG_DEBUG(Service_ACC, "called");
40 40
41 Cancel(); 41 Cancel();
@@ -45,7 +45,7 @@ void IAsyncContext::Cancel(Kernel::HLERequestContext& ctx) {
45 rb.Push(ResultSuccess); 45 rb.Push(ResultSuccess);
46} 46}
47 47
48void IAsyncContext::HasDone(Kernel::HLERequestContext& ctx) { 48void IAsyncContext::HasDone(HLERequestContext& ctx) {
49 LOG_DEBUG(Service_ACC, "called"); 49 LOG_DEBUG(Service_ACC, "called");
50 50
51 is_complete.store(IsComplete()); 51 is_complete.store(IsComplete());
@@ -55,7 +55,7 @@ void IAsyncContext::HasDone(Kernel::HLERequestContext& ctx) {
55 rb.Push(is_complete.load()); 55 rb.Push(is_complete.load());
56} 56}
57 57
58void IAsyncContext::GetResult(Kernel::HLERequestContext& ctx) { 58void IAsyncContext::GetResult(HLERequestContext& ctx) {
59 LOG_DEBUG(Service_ACC, "called"); 59 LOG_DEBUG(Service_ACC, "called");
60 60
61 IPC::ResponseBuilder rb{ctx, 3}; 61 IPC::ResponseBuilder rb{ctx, 3};
diff --git a/src/core/hle/service/acc/async_context.h b/src/core/hle/service/acc/async_context.h
index 26332d241..d7bffc055 100644
--- a/src/core/hle/service/acc/async_context.h
+++ b/src/core/hle/service/acc/async_context.h
@@ -18,10 +18,10 @@ public:
18 explicit IAsyncContext(Core::System& system_); 18 explicit IAsyncContext(Core::System& system_);
19 ~IAsyncContext() override; 19 ~IAsyncContext() override;
20 20
21 void GetSystemEvent(Kernel::HLERequestContext& ctx); 21 void GetSystemEvent(HLERequestContext& ctx);
22 void Cancel(Kernel::HLERequestContext& ctx); 22 void Cancel(HLERequestContext& ctx);
23 void HasDone(Kernel::HLERequestContext& ctx); 23 void HasDone(HLERequestContext& ctx);
24 void GetResult(Kernel::HLERequestContext& ctx); 24 void GetResult(HLERequestContext& ctx);
25 25
26protected: 26protected:
27 virtual bool IsComplete() const = 0; 27 virtual bool IsComplete() const = 0;
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index 3cd772b83..f74c7b550 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -11,7 +11,6 @@
11#include "core/file_sys/patch_manager.h" 11#include "core/file_sys/patch_manager.h"
12#include "core/file_sys/registered_cache.h" 12#include "core/file_sys/registered_cache.h"
13#include "core/file_sys/savedata_factory.h" 13#include "core/file_sys/savedata_factory.h"
14#include "core/hle/ipc_helpers.h"
15#include "core/hle/kernel/k_event.h" 14#include "core/hle/kernel/k_event.h"
16#include "core/hle/kernel/k_transfer_memory.h" 15#include "core/hle/kernel/k_transfer_memory.h"
17#include "core/hle/service/acc/profile_manager.h" 16#include "core/hle/service/acc/profile_manager.h"
@@ -29,8 +28,9 @@
29#include "core/hle/service/bcat/backend/backend.h" 28#include "core/hle/service/bcat/backend/backend.h"
30#include "core/hle/service/caps/caps.h" 29#include "core/hle/service/caps/caps.h"
31#include "core/hle/service/filesystem/filesystem.h" 30#include "core/hle/service/filesystem/filesystem.h"
31#include "core/hle/service/ipc_helpers.h"
32#include "core/hle/service/ns/ns.h" 32#include "core/hle/service/ns/ns.h"
33#include "core/hle/service/nvflinger/nvflinger.h" 33#include "core/hle/service/nvnflinger/nvnflinger.h"
34#include "core/hle/service/pm/pm.h" 34#include "core/hle/service/pm/pm.h"
35#include "core/hle/service/server_manager.h" 35#include "core/hle/service/server_manager.h"
36#include "core/hle/service/sm/sm.h" 36#include "core/hle/service/sm/sm.h"
@@ -78,7 +78,7 @@ IWindowController::IWindowController(Core::System& system_)
78 78
79IWindowController::~IWindowController() = default; 79IWindowController::~IWindowController() = default;
80 80
81void IWindowController::GetAppletResourceUserId(Kernel::HLERequestContext& ctx) { 81void IWindowController::GetAppletResourceUserId(HLERequestContext& ctx) {
82 const u64 process_id = system.ApplicationProcess()->GetProcessID(); 82 const u64 process_id = system.ApplicationProcess()->GetProcessID();
83 83
84 LOG_DEBUG(Service_AM, "called. Process ID=0x{:016X}", process_id); 84 LOG_DEBUG(Service_AM, "called. Process ID=0x{:016X}", process_id);
@@ -88,7 +88,7 @@ void IWindowController::GetAppletResourceUserId(Kernel::HLERequestContext& ctx)
88 rb.Push<u64>(process_id); 88 rb.Push<u64>(process_id);
89} 89}
90 90
91void IWindowController::AcquireForegroundRights(Kernel::HLERequestContext& ctx) { 91void IWindowController::AcquireForegroundRights(HLERequestContext& ctx) {
92 LOG_WARNING(Service_AM, "(STUBBED) called"); 92 LOG_WARNING(Service_AM, "(STUBBED) called");
93 IPC::ResponseBuilder rb{ctx, 2}; 93 IPC::ResponseBuilder rb{ctx, 2};
94 rb.Push(ResultSuccess); 94 rb.Push(ResultSuccess);
@@ -111,7 +111,7 @@ IAudioController::IAudioController(Core::System& system_)
111 111
112IAudioController::~IAudioController() = default; 112IAudioController::~IAudioController() = default;
113 113
114void IAudioController::SetExpectedMasterVolume(Kernel::HLERequestContext& ctx) { 114void IAudioController::SetExpectedMasterVolume(HLERequestContext& ctx) {
115 IPC::RequestParser rp{ctx}; 115 IPC::RequestParser rp{ctx};
116 const float main_applet_volume_tmp = rp.Pop<float>(); 116 const float main_applet_volume_tmp = rp.Pop<float>();
117 const float library_applet_volume_tmp = rp.Pop<float>(); 117 const float library_applet_volume_tmp = rp.Pop<float>();
@@ -128,21 +128,21 @@ void IAudioController::SetExpectedMasterVolume(Kernel::HLERequestContext& ctx) {
128 rb.Push(ResultSuccess); 128 rb.Push(ResultSuccess);
129} 129}
130 130
131void IAudioController::GetMainAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx) { 131void IAudioController::GetMainAppletExpectedMasterVolume(HLERequestContext& ctx) {
132 LOG_DEBUG(Service_AM, "called. main_applet_volume={}", main_applet_volume); 132 LOG_DEBUG(Service_AM, "called. main_applet_volume={}", main_applet_volume);
133 IPC::ResponseBuilder rb{ctx, 3}; 133 IPC::ResponseBuilder rb{ctx, 3};
134 rb.Push(ResultSuccess); 134 rb.Push(ResultSuccess);
135 rb.Push(main_applet_volume); 135 rb.Push(main_applet_volume);
136} 136}
137 137
138void IAudioController::GetLibraryAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx) { 138void IAudioController::GetLibraryAppletExpectedMasterVolume(HLERequestContext& ctx) {
139 LOG_DEBUG(Service_AM, "called. library_applet_volume={}", library_applet_volume); 139 LOG_DEBUG(Service_AM, "called. library_applet_volume={}", library_applet_volume);
140 IPC::ResponseBuilder rb{ctx, 3}; 140 IPC::ResponseBuilder rb{ctx, 3};
141 rb.Push(ResultSuccess); 141 rb.Push(ResultSuccess);
142 rb.Push(library_applet_volume); 142 rb.Push(library_applet_volume);
143} 143}
144 144
145void IAudioController::ChangeMainAppletMasterVolume(Kernel::HLERequestContext& ctx) { 145void IAudioController::ChangeMainAppletMasterVolume(HLERequestContext& ctx) {
146 struct Parameters { 146 struct Parameters {
147 float volume; 147 float volume;
148 s64 fade_time_ns; 148 s64 fade_time_ns;
@@ -162,7 +162,7 @@ void IAudioController::ChangeMainAppletMasterVolume(Kernel::HLERequestContext& c
162 rb.Push(ResultSuccess); 162 rb.Push(ResultSuccess);
163} 163}
164 164
165void IAudioController::SetTransparentAudioRate(Kernel::HLERequestContext& ctx) { 165void IAudioController::SetTransparentAudioRate(HLERequestContext& ctx) {
166 IPC::RequestParser rp{ctx}; 166 IPC::RequestParser rp{ctx};
167 const float transparent_volume_rate_tmp = rp.Pop<float>(); 167 const float transparent_volume_rate_tmp = rp.Pop<float>();
168 168
@@ -251,10 +251,9 @@ IDebugFunctions::IDebugFunctions(Core::System& system_)
251 251
252IDebugFunctions::~IDebugFunctions() = default; 252IDebugFunctions::~IDebugFunctions() = default;
253 253
254ISelfController::ISelfController(Core::System& system_, NVFlinger::NVFlinger& nvflinger_) 254ISelfController::ISelfController(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger_)
255 : ServiceFramework{system_, "ISelfController"}, nvflinger{nvflinger_}, service_context{ 255 : ServiceFramework{system_, "ISelfController"}, nvnflinger{nvnflinger_},
256 system, 256 service_context{system, "ISelfController"} {
257 "ISelfController"} {
258 // clang-format off 257 // clang-format off
259 static const FunctionInfo functions[] = { 258 static const FunctionInfo functions[] = {
260 {0, &ISelfController::Exit, "Exit"}, 259 {0, &ISelfController::Exit, "Exit"},
@@ -328,7 +327,7 @@ ISelfController::~ISelfController() {
328 service_context.CloseEvent(accumulated_suspended_tick_changed_event); 327 service_context.CloseEvent(accumulated_suspended_tick_changed_event);
329} 328}
330 329
331void ISelfController::Exit(Kernel::HLERequestContext& ctx) { 330void ISelfController::Exit(HLERequestContext& ctx) {
332 LOG_DEBUG(Service_AM, "called"); 331 LOG_DEBUG(Service_AM, "called");
333 332
334 IPC::ResponseBuilder rb{ctx, 2}; 333 IPC::ResponseBuilder rb{ctx, 2};
@@ -337,7 +336,7 @@ void ISelfController::Exit(Kernel::HLERequestContext& ctx) {
337 system.Exit(); 336 system.Exit();
338} 337}
339 338
340void ISelfController::LockExit(Kernel::HLERequestContext& ctx) { 339void ISelfController::LockExit(HLERequestContext& ctx) {
341 LOG_DEBUG(Service_AM, "called"); 340 LOG_DEBUG(Service_AM, "called");
342 341
343 system.SetExitLock(true); 342 system.SetExitLock(true);
@@ -346,7 +345,7 @@ void ISelfController::LockExit(Kernel::HLERequestContext& ctx) {
346 rb.Push(ResultSuccess); 345 rb.Push(ResultSuccess);
347} 346}
348 347
349void ISelfController::UnlockExit(Kernel::HLERequestContext& ctx) { 348void ISelfController::UnlockExit(HLERequestContext& ctx) {
350 LOG_DEBUG(Service_AM, "called"); 349 LOG_DEBUG(Service_AM, "called");
351 350
352 system.SetExitLock(false); 351 system.SetExitLock(false);
@@ -355,7 +354,7 @@ void ISelfController::UnlockExit(Kernel::HLERequestContext& ctx) {
355 rb.Push(ResultSuccess); 354 rb.Push(ResultSuccess);
356} 355}
357 356
358void ISelfController::EnterFatalSection(Kernel::HLERequestContext& ctx) { 357void ISelfController::EnterFatalSection(HLERequestContext& ctx) {
359 ++num_fatal_sections_entered; 358 ++num_fatal_sections_entered;
360 LOG_DEBUG(Service_AM, "called. Num fatal sections entered: {}", num_fatal_sections_entered); 359 LOG_DEBUG(Service_AM, "called. Num fatal sections entered: {}", num_fatal_sections_entered);
361 360
@@ -363,7 +362,7 @@ void ISelfController::EnterFatalSection(Kernel::HLERequestContext& ctx) {
363 rb.Push(ResultSuccess); 362 rb.Push(ResultSuccess);
364} 363}
365 364
366void ISelfController::LeaveFatalSection(Kernel::HLERequestContext& ctx) { 365void ISelfController::LeaveFatalSection(HLERequestContext& ctx) {
367 LOG_DEBUG(Service_AM, "called."); 366 LOG_DEBUG(Service_AM, "called.");
368 367
369 // Entry and exit of fatal sections must be balanced. 368 // Entry and exit of fatal sections must be balanced.
@@ -379,7 +378,7 @@ void ISelfController::LeaveFatalSection(Kernel::HLERequestContext& ctx) {
379 rb.Push(ResultSuccess); 378 rb.Push(ResultSuccess);
380} 379}
381 380
382void ISelfController::GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& ctx) { 381void ISelfController::GetLibraryAppletLaunchableEvent(HLERequestContext& ctx) {
383 LOG_WARNING(Service_AM, "(STUBBED) called"); 382 LOG_WARNING(Service_AM, "(STUBBED) called");
384 383
385 launchable_event->Signal(); 384 launchable_event->Signal();
@@ -389,7 +388,7 @@ void ISelfController::GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext&
389 rb.PushCopyObjects(launchable_event->GetReadableEvent()); 388 rb.PushCopyObjects(launchable_event->GetReadableEvent());
390} 389}
391 390
392void ISelfController::SetScreenShotPermission(Kernel::HLERequestContext& ctx) { 391void ISelfController::SetScreenShotPermission(HLERequestContext& ctx) {
393 IPC::RequestParser rp{ctx}; 392 IPC::RequestParser rp{ctx};
394 const auto permission = rp.PopEnum<ScreenshotPermission>(); 393 const auto permission = rp.PopEnum<ScreenshotPermission>();
395 LOG_DEBUG(Service_AM, "called, permission={}", permission); 394 LOG_DEBUG(Service_AM, "called, permission={}", permission);
@@ -400,7 +399,7 @@ void ISelfController::SetScreenShotPermission(Kernel::HLERequestContext& ctx) {
400 rb.Push(ResultSuccess); 399 rb.Push(ResultSuccess);
401} 400}
402 401
403void ISelfController::SetOperationModeChangedNotification(Kernel::HLERequestContext& ctx) { 402void ISelfController::SetOperationModeChangedNotification(HLERequestContext& ctx) {
404 IPC::RequestParser rp{ctx}; 403 IPC::RequestParser rp{ctx};
405 404
406 bool flag = rp.Pop<bool>(); 405 bool flag = rp.Pop<bool>();
@@ -410,7 +409,7 @@ void ISelfController::SetOperationModeChangedNotification(Kernel::HLERequestCont
410 rb.Push(ResultSuccess); 409 rb.Push(ResultSuccess);
411} 410}
412 411
413void ISelfController::SetPerformanceModeChangedNotification(Kernel::HLERequestContext& ctx) { 412void ISelfController::SetPerformanceModeChangedNotification(HLERequestContext& ctx) {
414 IPC::RequestParser rp{ctx}; 413 IPC::RequestParser rp{ctx};
415 414
416 bool flag = rp.Pop<bool>(); 415 bool flag = rp.Pop<bool>();
@@ -420,7 +419,7 @@ void ISelfController::SetPerformanceModeChangedNotification(Kernel::HLERequestCo
420 rb.Push(ResultSuccess); 419 rb.Push(ResultSuccess);
421} 420}
422 421
423void ISelfController::SetFocusHandlingMode(Kernel::HLERequestContext& ctx) { 422void ISelfController::SetFocusHandlingMode(HLERequestContext& ctx) {
424 // Takes 3 input u8s with each field located immediately after the previous 423 // Takes 3 input u8s with each field located immediately after the previous
425 // u8, these are bool flags. No output. 424 // u8, these are bool flags. No output.
426 IPC::RequestParser rp{ctx}; 425 IPC::RequestParser rp{ctx};
@@ -439,14 +438,14 @@ void ISelfController::SetFocusHandlingMode(Kernel::HLERequestContext& ctx) {
439 rb.Push(ResultSuccess); 438 rb.Push(ResultSuccess);
440} 439}
441 440
442void ISelfController::SetRestartMessageEnabled(Kernel::HLERequestContext& ctx) { 441void ISelfController::SetRestartMessageEnabled(HLERequestContext& ctx) {
443 LOG_WARNING(Service_AM, "(STUBBED) called"); 442 LOG_WARNING(Service_AM, "(STUBBED) called");
444 443
445 IPC::ResponseBuilder rb{ctx, 2}; 444 IPC::ResponseBuilder rb{ctx, 2};
446 rb.Push(ResultSuccess); 445 rb.Push(ResultSuccess);
447} 446}
448 447
449void ISelfController::SetOutOfFocusSuspendingEnabled(Kernel::HLERequestContext& ctx) { 448void ISelfController::SetOutOfFocusSuspendingEnabled(HLERequestContext& ctx) {
450 // Takes 3 input u8s with each field located immediately after the previous 449 // Takes 3 input u8s with each field located immediately after the previous
451 // u8, these are bool flags. No output. 450 // u8, these are bool flags. No output.
452 IPC::RequestParser rp{ctx}; 451 IPC::RequestParser rp{ctx};
@@ -458,27 +457,27 @@ void ISelfController::SetOutOfFocusSuspendingEnabled(Kernel::HLERequestContext&
458 rb.Push(ResultSuccess); 457 rb.Push(ResultSuccess);
459} 458}
460 459
461void ISelfController::SetAlbumImageOrientation(Kernel::HLERequestContext& ctx) { 460void ISelfController::SetAlbumImageOrientation(HLERequestContext& ctx) {
462 LOG_WARNING(Service_AM, "(STUBBED) called"); 461 LOG_WARNING(Service_AM, "(STUBBED) called");
463 462
464 IPC::ResponseBuilder rb{ctx, 2}; 463 IPC::ResponseBuilder rb{ctx, 2};
465 rb.Push(ResultSuccess); 464 rb.Push(ResultSuccess);
466} 465}
467 466
468void ISelfController::CreateManagedDisplayLayer(Kernel::HLERequestContext& ctx) { 467void ISelfController::CreateManagedDisplayLayer(HLERequestContext& ctx) {
469 LOG_WARNING(Service_AM, "(STUBBED) called"); 468 LOG_WARNING(Service_AM, "(STUBBED) called");
470 469
471 // TODO(Subv): Find out how AM determines the display to use, for now just 470 // TODO(Subv): Find out how AM determines the display to use, for now just
472 // create the layer in the Default display. 471 // create the layer in the Default display.
473 const auto display_id = nvflinger.OpenDisplay("Default"); 472 const auto display_id = nvnflinger.OpenDisplay("Default");
474 const auto layer_id = nvflinger.CreateLayer(*display_id); 473 const auto layer_id = nvnflinger.CreateLayer(*display_id);
475 474
476 IPC::ResponseBuilder rb{ctx, 4}; 475 IPC::ResponseBuilder rb{ctx, 4};
477 rb.Push(ResultSuccess); 476 rb.Push(ResultSuccess);
478 rb.Push(*layer_id); 477 rb.Push(*layer_id);
479} 478}
480 479
481void ISelfController::CreateManagedDisplaySeparableLayer(Kernel::HLERequestContext& ctx) { 480void ISelfController::CreateManagedDisplaySeparableLayer(HLERequestContext& ctx) {
482 LOG_WARNING(Service_AM, "(STUBBED) called"); 481 LOG_WARNING(Service_AM, "(STUBBED) called");
483 482
484 // TODO(Subv): Find out how AM determines the display to use, for now just 483 // TODO(Subv): Find out how AM determines the display to use, for now just
@@ -488,22 +487,22 @@ void ISelfController::CreateManagedDisplaySeparableLayer(Kernel::HLERequestConte
488 // Outputting 1 layer id instead of the expected 2 has not been observed to cause any adverse 487 // Outputting 1 layer id instead of the expected 2 has not been observed to cause any adverse
489 // side effects. 488 // side effects.
490 // TODO: Support multiple layers 489 // TODO: Support multiple layers
491 const auto display_id = nvflinger.OpenDisplay("Default"); 490 const auto display_id = nvnflinger.OpenDisplay("Default");
492 const auto layer_id = nvflinger.CreateLayer(*display_id); 491 const auto layer_id = nvnflinger.CreateLayer(*display_id);
493 492
494 IPC::ResponseBuilder rb{ctx, 4}; 493 IPC::ResponseBuilder rb{ctx, 4};
495 rb.Push(ResultSuccess); 494 rb.Push(ResultSuccess);
496 rb.Push(*layer_id); 495 rb.Push(*layer_id);
497} 496}
498 497
499void ISelfController::SetHandlesRequestToDisplay(Kernel::HLERequestContext& ctx) { 498void ISelfController::SetHandlesRequestToDisplay(HLERequestContext& ctx) {
500 LOG_WARNING(Service_AM, "(STUBBED) called"); 499 LOG_WARNING(Service_AM, "(STUBBED) called");
501 500
502 IPC::ResponseBuilder rb{ctx, 2}; 501 IPC::ResponseBuilder rb{ctx, 2};
503 rb.Push(ResultSuccess); 502 rb.Push(ResultSuccess);
504} 503}
505 504
506void ISelfController::SetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx) { 505void ISelfController::SetIdleTimeDetectionExtension(HLERequestContext& ctx) {
507 IPC::RequestParser rp{ctx}; 506 IPC::RequestParser rp{ctx};
508 idle_time_detection_extension = rp.Pop<u32>(); 507 idle_time_detection_extension = rp.Pop<u32>();
509 LOG_WARNING(Service_AM, "(STUBBED) called idle_time_detection_extension={}", 508 LOG_WARNING(Service_AM, "(STUBBED) called idle_time_detection_extension={}",
@@ -513,7 +512,7 @@ void ISelfController::SetIdleTimeDetectionExtension(Kernel::HLERequestContext& c
513 rb.Push(ResultSuccess); 512 rb.Push(ResultSuccess);
514} 513}
515 514
516void ISelfController::GetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx) { 515void ISelfController::GetIdleTimeDetectionExtension(HLERequestContext& ctx) {
517 LOG_WARNING(Service_AM, "(STUBBED) called"); 516 LOG_WARNING(Service_AM, "(STUBBED) called");
518 517
519 IPC::ResponseBuilder rb{ctx, 3}; 518 IPC::ResponseBuilder rb{ctx, 3};
@@ -521,14 +520,14 @@ void ISelfController::GetIdleTimeDetectionExtension(Kernel::HLERequestContext& c
521 rb.Push<u32>(idle_time_detection_extension); 520 rb.Push<u32>(idle_time_detection_extension);
522} 521}
523 522
524void ISelfController::ReportUserIsActive(Kernel::HLERequestContext& ctx) { 523void ISelfController::ReportUserIsActive(HLERequestContext& ctx) {
525 LOG_WARNING(Service_AM, "(STUBBED) called"); 524 LOG_WARNING(Service_AM, "(STUBBED) called");
526 525
527 IPC::ResponseBuilder rb{ctx, 2}; 526 IPC::ResponseBuilder rb{ctx, 2};
528 rb.Push(ResultSuccess); 527 rb.Push(ResultSuccess);
529} 528}
530 529
531void ISelfController::SetAutoSleepDisabled(Kernel::HLERequestContext& ctx) { 530void ISelfController::SetAutoSleepDisabled(HLERequestContext& ctx) {
532 IPC::RequestParser rp{ctx}; 531 IPC::RequestParser rp{ctx};
533 is_auto_sleep_disabled = rp.Pop<bool>(); 532 is_auto_sleep_disabled = rp.Pop<bool>();
534 533
@@ -548,7 +547,7 @@ void ISelfController::SetAutoSleepDisabled(Kernel::HLERequestContext& ctx) {
548 rb.Push(ResultSuccess); 547 rb.Push(ResultSuccess);
549} 548}
550 549
551void ISelfController::IsAutoSleepDisabled(Kernel::HLERequestContext& ctx) { 550void ISelfController::IsAutoSleepDisabled(HLERequestContext& ctx) {
552 LOG_DEBUG(Service_AM, "called."); 551 LOG_DEBUG(Service_AM, "called.");
553 552
554 IPC::ResponseBuilder rb{ctx, 3}; 553 IPC::ResponseBuilder rb{ctx, 3};
@@ -556,7 +555,7 @@ void ISelfController::IsAutoSleepDisabled(Kernel::HLERequestContext& ctx) {
556 rb.Push(is_auto_sleep_disabled); 555 rb.Push(is_auto_sleep_disabled);
557} 556}
558 557
559void ISelfController::GetAccumulatedSuspendedTickValue(Kernel::HLERequestContext& ctx) { 558void ISelfController::GetAccumulatedSuspendedTickValue(HLERequestContext& ctx) {
560 LOG_DEBUG(Service_AM, "called."); 559 LOG_DEBUG(Service_AM, "called.");
561 560
562 // This command returns the total number of system ticks since ISelfController creation 561 // This command returns the total number of system ticks since ISelfController creation
@@ -567,7 +566,7 @@ void ISelfController::GetAccumulatedSuspendedTickValue(Kernel::HLERequestContext
567 rb.Push<u64>(0); 566 rb.Push<u64>(0);
568} 567}
569 568
570void ISelfController::GetAccumulatedSuspendedTickChangedEvent(Kernel::HLERequestContext& ctx) { 569void ISelfController::GetAccumulatedSuspendedTickChangedEvent(HLERequestContext& ctx) {
571 LOG_DEBUG(Service_AM, "called."); 570 LOG_DEBUG(Service_AM, "called.");
572 571
573 IPC::ResponseBuilder rb{ctx, 2, 1}; 572 IPC::ResponseBuilder rb{ctx, 2, 1};
@@ -575,7 +574,7 @@ void ISelfController::GetAccumulatedSuspendedTickChangedEvent(Kernel::HLERequest
575 rb.PushCopyObjects(accumulated_suspended_tick_changed_event->GetReadableEvent()); 574 rb.PushCopyObjects(accumulated_suspended_tick_changed_event->GetReadableEvent());
576} 575}
577 576
578void ISelfController::SetAlbumImageTakenNotificationEnabled(Kernel::HLERequestContext& ctx) { 577void ISelfController::SetAlbumImageTakenNotificationEnabled(HLERequestContext& ctx) {
579 IPC::RequestParser rp{ctx}; 578 IPC::RequestParser rp{ctx};
580 579
581 // This service call sets an internal flag whether a notification is shown when an image is 580 // This service call sets an internal flag whether a notification is shown when an image is
@@ -590,7 +589,7 @@ void ISelfController::SetAlbumImageTakenNotificationEnabled(Kernel::HLERequestCo
590 rb.Push(ResultSuccess); 589 rb.Push(ResultSuccess);
591} 590}
592 591
593void ISelfController::SaveCurrentScreenshot(Kernel::HLERequestContext& ctx) { 592void ISelfController::SaveCurrentScreenshot(HLERequestContext& ctx) {
594 IPC::RequestParser rp{ctx}; 593 IPC::RequestParser rp{ctx};
595 594
596 const auto album_report_option = rp.PopEnum<Capture::AlbumReportOption>(); 595 const auto album_report_option = rp.PopEnum<Capture::AlbumReportOption>();
@@ -601,7 +600,7 @@ void ISelfController::SaveCurrentScreenshot(Kernel::HLERequestContext& ctx) {
601 rb.Push(ResultSuccess); 600 rb.Push(ResultSuccess);
602} 601}
603 602
604void ISelfController::SetRecordVolumeMuted(Kernel::HLERequestContext& ctx) { 603void ISelfController::SetRecordVolumeMuted(HLERequestContext& ctx) {
605 IPC::RequestParser rp{ctx}; 604 IPC::RequestParser rp{ctx};
606 605
607 const auto is_record_volume_muted = rp.Pop<bool>(); 606 const auto is_record_volume_muted = rp.Pop<bool>();
@@ -735,7 +734,7 @@ ICommonStateGetter::ICommonStateGetter(Core::System& system_,
735 734
736ICommonStateGetter::~ICommonStateGetter() = default; 735ICommonStateGetter::~ICommonStateGetter() = default;
737 736
738void ICommonStateGetter::GetBootMode(Kernel::HLERequestContext& ctx) { 737void ICommonStateGetter::GetBootMode(HLERequestContext& ctx) {
739 LOG_DEBUG(Service_AM, "called"); 738 LOG_DEBUG(Service_AM, "called");
740 739
741 IPC::ResponseBuilder rb{ctx, 3}; 740 IPC::ResponseBuilder rb{ctx, 3};
@@ -743,7 +742,7 @@ void ICommonStateGetter::GetBootMode(Kernel::HLERequestContext& ctx) {
743 rb.Push<u8>(static_cast<u8>(Service::PM::SystemBootMode::Normal)); // Normal boot mode 742 rb.Push<u8>(static_cast<u8>(Service::PM::SystemBootMode::Normal)); // Normal boot mode
744} 743}
745 744
746void ICommonStateGetter::GetEventHandle(Kernel::HLERequestContext& ctx) { 745void ICommonStateGetter::GetEventHandle(HLERequestContext& ctx) {
747 LOG_DEBUG(Service_AM, "called"); 746 LOG_DEBUG(Service_AM, "called");
748 747
749 IPC::ResponseBuilder rb{ctx, 2, 1}; 748 IPC::ResponseBuilder rb{ctx, 2, 1};
@@ -751,7 +750,7 @@ void ICommonStateGetter::GetEventHandle(Kernel::HLERequestContext& ctx) {
751 rb.PushCopyObjects(msg_queue->GetMessageReceiveEvent()); 750 rb.PushCopyObjects(msg_queue->GetMessageReceiveEvent());
752} 751}
753 752
754void ICommonStateGetter::ReceiveMessage(Kernel::HLERequestContext& ctx) { 753void ICommonStateGetter::ReceiveMessage(HLERequestContext& ctx) {
755 LOG_DEBUG(Service_AM, "called"); 754 LOG_DEBUG(Service_AM, "called");
756 755
757 const auto message = msg_queue->PopMessage(); 756 const auto message = msg_queue->PopMessage();
@@ -768,7 +767,7 @@ void ICommonStateGetter::ReceiveMessage(Kernel::HLERequestContext& ctx) {
768 rb.PushEnum<AppletMessageQueue::AppletMessage>(message); 767 rb.PushEnum<AppletMessageQueue::AppletMessage>(message);
769} 768}
770 769
771void ICommonStateGetter::GetCurrentFocusState(Kernel::HLERequestContext& ctx) { 770void ICommonStateGetter::GetCurrentFocusState(HLERequestContext& ctx) {
772 LOG_DEBUG(Service_AM, "(STUBBED) called"); 771 LOG_DEBUG(Service_AM, "(STUBBED) called");
773 772
774 IPC::ResponseBuilder rb{ctx, 3}; 773 IPC::ResponseBuilder rb{ctx, 3};
@@ -776,7 +775,7 @@ void ICommonStateGetter::GetCurrentFocusState(Kernel::HLERequestContext& ctx) {
776 rb.Push(static_cast<u8>(FocusState::InFocus)); 775 rb.Push(static_cast<u8>(FocusState::InFocus));
777} 776}
778 777
779void ICommonStateGetter::IsVrModeEnabled(Kernel::HLERequestContext& ctx) { 778void ICommonStateGetter::IsVrModeEnabled(HLERequestContext& ctx) {
780 LOG_DEBUG(Service_AM, "called"); 779 LOG_DEBUG(Service_AM, "called");
781 780
782 IPC::ResponseBuilder rb{ctx, 3}; 781 IPC::ResponseBuilder rb{ctx, 3};
@@ -784,7 +783,7 @@ void ICommonStateGetter::IsVrModeEnabled(Kernel::HLERequestContext& ctx) {
784 rb.Push(vr_mode_state); 783 rb.Push(vr_mode_state);
785} 784}
786 785
787void ICommonStateGetter::SetVrModeEnabled(Kernel::HLERequestContext& ctx) { 786void ICommonStateGetter::SetVrModeEnabled(HLERequestContext& ctx) {
788 IPC::RequestParser rp{ctx}; 787 IPC::RequestParser rp{ctx};
789 vr_mode_state = rp.Pop<bool>(); 788 vr_mode_state = rp.Pop<bool>();
790 789
@@ -794,7 +793,7 @@ void ICommonStateGetter::SetVrModeEnabled(Kernel::HLERequestContext& ctx) {
794 rb.Push(ResultSuccess); 793 rb.Push(ResultSuccess);
795} 794}
796 795
797void ICommonStateGetter::SetLcdBacklighOffEnabled(Kernel::HLERequestContext& ctx) { 796void ICommonStateGetter::SetLcdBacklighOffEnabled(HLERequestContext& ctx) {
798 IPC::RequestParser rp{ctx}; 797 IPC::RequestParser rp{ctx};
799 const auto is_lcd_backlight_off_enabled = rp.Pop<bool>(); 798 const auto is_lcd_backlight_off_enabled = rp.Pop<bool>();
800 799
@@ -805,21 +804,21 @@ void ICommonStateGetter::SetLcdBacklighOffEnabled(Kernel::HLERequestContext& ctx
805 rb.Push(ResultSuccess); 804 rb.Push(ResultSuccess);
806} 805}
807 806
808void ICommonStateGetter::BeginVrModeEx(Kernel::HLERequestContext& ctx) { 807void ICommonStateGetter::BeginVrModeEx(HLERequestContext& ctx) {
809 LOG_WARNING(Service_AM, "(STUBBED) called"); 808 LOG_WARNING(Service_AM, "(STUBBED) called");
810 809
811 IPC::ResponseBuilder rb{ctx, 2}; 810 IPC::ResponseBuilder rb{ctx, 2};
812 rb.Push(ResultSuccess); 811 rb.Push(ResultSuccess);
813} 812}
814 813
815void ICommonStateGetter::EndVrModeEx(Kernel::HLERequestContext& ctx) { 814void ICommonStateGetter::EndVrModeEx(HLERequestContext& ctx) {
816 LOG_WARNING(Service_AM, "(STUBBED) called"); 815 LOG_WARNING(Service_AM, "(STUBBED) called");
817 816
818 IPC::ResponseBuilder rb{ctx, 2}; 817 IPC::ResponseBuilder rb{ctx, 2};
819 rb.Push(ResultSuccess); 818 rb.Push(ResultSuccess);
820} 819}
821 820
822void ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent(Kernel::HLERequestContext& ctx) { 821void ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent(HLERequestContext& ctx) {
823 LOG_DEBUG(Service_AM, "called"); 822 LOG_DEBUG(Service_AM, "called");
824 823
825 IPC::ResponseBuilder rb{ctx, 2, 1}; 824 IPC::ResponseBuilder rb{ctx, 2, 1};
@@ -827,7 +826,7 @@ void ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent(Kernel::HLEReque
827 rb.PushCopyObjects(msg_queue->GetOperationModeChangedEvent()); 826 rb.PushCopyObjects(msg_queue->GetOperationModeChangedEvent());
828} 827}
829 828
830void ICommonStateGetter::GetDefaultDisplayResolution(Kernel::HLERequestContext& ctx) { 829void ICommonStateGetter::GetDefaultDisplayResolution(HLERequestContext& ctx) {
831 LOG_DEBUG(Service_AM, "called"); 830 LOG_DEBUG(Service_AM, "called");
832 831
833 IPC::ResponseBuilder rb{ctx, 4}; 832 IPC::ResponseBuilder rb{ctx, 4};
@@ -842,7 +841,7 @@ void ICommonStateGetter::GetDefaultDisplayResolution(Kernel::HLERequestContext&
842 } 841 }
843} 842}
844 843
845void ICommonStateGetter::SetCpuBoostMode(Kernel::HLERequestContext& ctx) { 844void ICommonStateGetter::SetCpuBoostMode(HLERequestContext& ctx) {
846 LOG_DEBUG(Service_AM, "called, forwarding to APM:SYS"); 845 LOG_DEBUG(Service_AM, "called, forwarding to APM:SYS");
847 846
848 const auto& sm = system.ServiceManager(); 847 const auto& sm = system.ServiceManager();
@@ -852,7 +851,7 @@ void ICommonStateGetter::SetCpuBoostMode(Kernel::HLERequestContext& ctx) {
852 apm_sys->SetCpuBoostMode(ctx); 851 apm_sys->SetCpuBoostMode(ctx);
853} 852}
854 853
855void ICommonStateGetter::PerformSystemButtonPressingIfInFocus(Kernel::HLERequestContext& ctx) { 854void ICommonStateGetter::PerformSystemButtonPressingIfInFocus(HLERequestContext& ctx) {
856 IPC::RequestParser rp{ctx}; 855 IPC::RequestParser rp{ctx};
857 const auto system_button{rp.PopEnum<SystemButtonType>()}; 856 const auto system_button{rp.PopEnum<SystemButtonType>()};
858 857
@@ -863,7 +862,7 @@ void ICommonStateGetter::PerformSystemButtonPressingIfInFocus(Kernel::HLERequest
863} 862}
864 863
865void ICommonStateGetter::SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled( 864void ICommonStateGetter::SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled(
866 Kernel::HLERequestContext& ctx) { 865 HLERequestContext& ctx) {
867 LOG_WARNING(Service_AM, "(STUBBED) called"); 866 LOG_WARNING(Service_AM, "(STUBBED) called");
868 867
869 IPC::ResponseBuilder rb{ctx, 2}; 868 IPC::ResponseBuilder rb{ctx, 2};
@@ -911,7 +910,7 @@ void IStorage::Register() {
911 910
912IStorage::~IStorage() = default; 911IStorage::~IStorage() = default;
913 912
914void IStorage::Open(Kernel::HLERequestContext& ctx) { 913void IStorage::Open(HLERequestContext& ctx) {
915 LOG_DEBUG(Service_AM, "called"); 914 LOG_DEBUG(Service_AM, "called");
916 915
917 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 916 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -920,7 +919,7 @@ void IStorage::Open(Kernel::HLERequestContext& ctx) {
920 rb.PushIpcInterface<IStorageAccessor>(system, *this); 919 rb.PushIpcInterface<IStorageAccessor>(system, *this);
921} 920}
922 921
923void ICommonStateGetter::GetOperationMode(Kernel::HLERequestContext& ctx) { 922void ICommonStateGetter::GetOperationMode(HLERequestContext& ctx) {
924 const bool use_docked_mode{Settings::values.use_docked_mode.GetValue()}; 923 const bool use_docked_mode{Settings::values.use_docked_mode.GetValue()};
925 LOG_DEBUG(Service_AM, "called, use_docked_mode={}", use_docked_mode); 924 LOG_DEBUG(Service_AM, "called, use_docked_mode={}", use_docked_mode);
926 925
@@ -929,7 +928,7 @@ void ICommonStateGetter::GetOperationMode(Kernel::HLERequestContext& ctx) {
929 rb.Push(static_cast<u8>(use_docked_mode ? OperationMode::Docked : OperationMode::Handheld)); 928 rb.Push(static_cast<u8>(use_docked_mode ? OperationMode::Docked : OperationMode::Handheld));
930} 929}
931 930
932void ICommonStateGetter::GetPerformanceMode(Kernel::HLERequestContext& ctx) { 931void ICommonStateGetter::GetPerformanceMode(HLERequestContext& ctx) {
933 LOG_DEBUG(Service_AM, "called"); 932 LOG_DEBUG(Service_AM, "called");
934 933
935 IPC::ResponseBuilder rb{ctx, 3}; 934 IPC::ResponseBuilder rb{ctx, 3};
@@ -969,7 +968,7 @@ public:
969 } 968 }
970 969
971private: 970private:
972 void GetAppletStateChangedEvent(Kernel::HLERequestContext& ctx) { 971 void GetAppletStateChangedEvent(HLERequestContext& ctx) {
973 LOG_DEBUG(Service_AM, "called"); 972 LOG_DEBUG(Service_AM, "called");
974 973
975 IPC::ResponseBuilder rb{ctx, 2, 1}; 974 IPC::ResponseBuilder rb{ctx, 2, 1};
@@ -977,7 +976,7 @@ private:
977 rb.PushCopyObjects(applet->GetBroker().GetStateChangedEvent()); 976 rb.PushCopyObjects(applet->GetBroker().GetStateChangedEvent());
978 } 977 }
979 978
980 void IsCompleted(Kernel::HLERequestContext& ctx) { 979 void IsCompleted(HLERequestContext& ctx) {
981 LOG_DEBUG(Service_AM, "called"); 980 LOG_DEBUG(Service_AM, "called");
982 981
983 IPC::ResponseBuilder rb{ctx, 3}; 982 IPC::ResponseBuilder rb{ctx, 3};
@@ -985,21 +984,21 @@ private:
985 rb.Push<u32>(applet->TransactionComplete()); 984 rb.Push<u32>(applet->TransactionComplete());
986 } 985 }
987 986
988 void GetResult(Kernel::HLERequestContext& ctx) { 987 void GetResult(HLERequestContext& ctx) {
989 LOG_DEBUG(Service_AM, "called"); 988 LOG_DEBUG(Service_AM, "called");
990 989
991 IPC::ResponseBuilder rb{ctx, 2}; 990 IPC::ResponseBuilder rb{ctx, 2};
992 rb.Push(applet->GetStatus()); 991 rb.Push(applet->GetStatus());
993 } 992 }
994 993
995 void PresetLibraryAppletGpuTimeSliceZero(Kernel::HLERequestContext& ctx) { 994 void PresetLibraryAppletGpuTimeSliceZero(HLERequestContext& ctx) {
996 LOG_WARNING(Service_AM, "(STUBBED) called"); 995 LOG_WARNING(Service_AM, "(STUBBED) called");
997 996
998 IPC::ResponseBuilder rb{ctx, 2}; 997 IPC::ResponseBuilder rb{ctx, 2};
999 rb.Push(ResultSuccess); 998 rb.Push(ResultSuccess);
1000 } 999 }
1001 1000
1002 void Start(Kernel::HLERequestContext& ctx) { 1001 void Start(HLERequestContext& ctx) {
1003 LOG_DEBUG(Service_AM, "called"); 1002 LOG_DEBUG(Service_AM, "called");
1004 1003
1005 ASSERT(applet != nullptr); 1004 ASSERT(applet != nullptr);
@@ -1011,7 +1010,7 @@ private:
1011 rb.Push(ResultSuccess); 1010 rb.Push(ResultSuccess);
1012 } 1011 }
1013 1012
1014 void PushInData(Kernel::HLERequestContext& ctx) { 1013 void PushInData(HLERequestContext& ctx) {
1015 LOG_DEBUG(Service_AM, "called"); 1014 LOG_DEBUG(Service_AM, "called");
1016 1015
1017 IPC::RequestParser rp{ctx}; 1016 IPC::RequestParser rp{ctx};
@@ -1021,7 +1020,7 @@ private:
1021 rb.Push(ResultSuccess); 1020 rb.Push(ResultSuccess);
1022 } 1021 }
1023 1022
1024 void PopOutData(Kernel::HLERequestContext& ctx) { 1023 void PopOutData(HLERequestContext& ctx) {
1025 LOG_DEBUG(Service_AM, "called"); 1024 LOG_DEBUG(Service_AM, "called");
1026 1025
1027 auto storage = applet->GetBroker().PopNormalDataToGame(); 1026 auto storage = applet->GetBroker().PopNormalDataToGame();
@@ -1038,7 +1037,7 @@ private:
1038 rb.PushIpcInterface<IStorage>(std::move(storage)); 1037 rb.PushIpcInterface<IStorage>(std::move(storage));
1039 } 1038 }
1040 1039
1041 void PushInteractiveInData(Kernel::HLERequestContext& ctx) { 1040 void PushInteractiveInData(HLERequestContext& ctx) {
1042 LOG_DEBUG(Service_AM, "called"); 1041 LOG_DEBUG(Service_AM, "called");
1043 1042
1044 IPC::RequestParser rp{ctx}; 1043 IPC::RequestParser rp{ctx};
@@ -1052,7 +1051,7 @@ private:
1052 rb.Push(ResultSuccess); 1051 rb.Push(ResultSuccess);
1053 } 1052 }
1054 1053
1055 void PopInteractiveOutData(Kernel::HLERequestContext& ctx) { 1054 void PopInteractiveOutData(HLERequestContext& ctx) {
1056 LOG_DEBUG(Service_AM, "called"); 1055 LOG_DEBUG(Service_AM, "called");
1057 1056
1058 auto storage = applet->GetBroker().PopInteractiveDataToGame(); 1057 auto storage = applet->GetBroker().PopInteractiveDataToGame();
@@ -1069,7 +1068,7 @@ private:
1069 rb.PushIpcInterface<IStorage>(std::move(storage)); 1068 rb.PushIpcInterface<IStorage>(std::move(storage));
1070 } 1069 }
1071 1070
1072 void GetPopOutDataEvent(Kernel::HLERequestContext& ctx) { 1071 void GetPopOutDataEvent(HLERequestContext& ctx) {
1073 LOG_DEBUG(Service_AM, "called"); 1072 LOG_DEBUG(Service_AM, "called");
1074 1073
1075 IPC::ResponseBuilder rb{ctx, 2, 1}; 1074 IPC::ResponseBuilder rb{ctx, 2, 1};
@@ -1077,7 +1076,7 @@ private:
1077 rb.PushCopyObjects(applet->GetBroker().GetNormalDataEvent()); 1076 rb.PushCopyObjects(applet->GetBroker().GetNormalDataEvent());
1078 } 1077 }
1079 1078
1080 void GetPopInteractiveOutDataEvent(Kernel::HLERequestContext& ctx) { 1079 void GetPopInteractiveOutDataEvent(HLERequestContext& ctx) {
1081 LOG_DEBUG(Service_AM, "called"); 1080 LOG_DEBUG(Service_AM, "called");
1082 1081
1083 IPC::ResponseBuilder rb{ctx, 2, 1}; 1082 IPC::ResponseBuilder rb{ctx, 2, 1};
@@ -1085,7 +1084,7 @@ private:
1085 rb.PushCopyObjects(applet->GetBroker().GetInteractiveDataEvent()); 1084 rb.PushCopyObjects(applet->GetBroker().GetInteractiveDataEvent());
1086 } 1085 }
1087 1086
1088 void GetIndirectLayerConsumerHandle(Kernel::HLERequestContext& ctx) { 1087 void GetIndirectLayerConsumerHandle(HLERequestContext& ctx) {
1089 LOG_WARNING(Service_AM, "(STUBBED) called"); 1088 LOG_WARNING(Service_AM, "(STUBBED) called");
1090 1089
1091 // We require a non-zero handle to be valid. Using 0xdeadbeef allows us to trace if this is 1090 // We require a non-zero handle to be valid. Using 0xdeadbeef allows us to trace if this is
@@ -1115,7 +1114,7 @@ IStorageAccessor::IStorageAccessor(Core::System& system_, IStorage& backing_)
1115 1114
1116IStorageAccessor::~IStorageAccessor() = default; 1115IStorageAccessor::~IStorageAccessor() = default;
1117 1116
1118void IStorageAccessor::GetSize(Kernel::HLERequestContext& ctx) { 1117void IStorageAccessor::GetSize(HLERequestContext& ctx) {
1119 LOG_DEBUG(Service_AM, "called"); 1118 LOG_DEBUG(Service_AM, "called");
1120 1119
1121 IPC::ResponseBuilder rb{ctx, 4}; 1120 IPC::ResponseBuilder rb{ctx, 4};
@@ -1124,7 +1123,7 @@ void IStorageAccessor::GetSize(Kernel::HLERequestContext& ctx) {
1124 rb.Push(static_cast<u64>(backing.GetSize())); 1123 rb.Push(static_cast<u64>(backing.GetSize()));
1125} 1124}
1126 1125
1127void IStorageAccessor::Write(Kernel::HLERequestContext& ctx) { 1126void IStorageAccessor::Write(HLERequestContext& ctx) {
1128 IPC::RequestParser rp{ctx}; 1127 IPC::RequestParser rp{ctx};
1129 1128
1130 const u64 offset{rp.Pop<u64>()}; 1129 const u64 offset{rp.Pop<u64>()};
@@ -1149,7 +1148,7 @@ void IStorageAccessor::Write(Kernel::HLERequestContext& ctx) {
1149 rb.Push(ResultSuccess); 1148 rb.Push(ResultSuccess);
1150} 1149}
1151 1150
1152void IStorageAccessor::Read(Kernel::HLERequestContext& ctx) { 1151void IStorageAccessor::Read(HLERequestContext& ctx) {
1153 IPC::RequestParser rp{ctx}; 1152 IPC::RequestParser rp{ctx};
1154 1153
1155 const u64 offset{rp.Pop<u64>()}; 1154 const u64 offset{rp.Pop<u64>()};
@@ -1187,7 +1186,7 @@ ILibraryAppletCreator::ILibraryAppletCreator(Core::System& system_)
1187 1186
1188ILibraryAppletCreator::~ILibraryAppletCreator() = default; 1187ILibraryAppletCreator::~ILibraryAppletCreator() = default;
1189 1188
1190void ILibraryAppletCreator::CreateLibraryApplet(Kernel::HLERequestContext& ctx) { 1189void ILibraryAppletCreator::CreateLibraryApplet(HLERequestContext& ctx) {
1191 IPC::RequestParser rp{ctx}; 1190 IPC::RequestParser rp{ctx};
1192 1191
1193 const auto applet_id = rp.PopRaw<Applets::AppletId>(); 1192 const auto applet_id = rp.PopRaw<Applets::AppletId>();
@@ -1213,7 +1212,7 @@ void ILibraryAppletCreator::CreateLibraryApplet(Kernel::HLERequestContext& ctx)
1213 rb.PushIpcInterface<ILibraryAppletAccessor>(system, applet); 1212 rb.PushIpcInterface<ILibraryAppletAccessor>(system, applet);
1214} 1213}
1215 1214
1216void ILibraryAppletCreator::CreateStorage(Kernel::HLERequestContext& ctx) { 1215void ILibraryAppletCreator::CreateStorage(HLERequestContext& ctx) {
1217 IPC::RequestParser rp{ctx}; 1216 IPC::RequestParser rp{ctx};
1218 1217
1219 const s64 size{rp.Pop<s64>()}; 1218 const s64 size{rp.Pop<s64>()};
@@ -1234,7 +1233,7 @@ void ILibraryAppletCreator::CreateStorage(Kernel::HLERequestContext& ctx) {
1234 rb.PushIpcInterface<IStorage>(system, std::move(buffer)); 1233 rb.PushIpcInterface<IStorage>(system, std::move(buffer));
1235} 1234}
1236 1235
1237void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContext& ctx) { 1236void ILibraryAppletCreator::CreateTransferMemoryStorage(HLERequestContext& ctx) {
1238 IPC::RequestParser rp{ctx}; 1237 IPC::RequestParser rp{ctx};
1239 1238
1240 struct Parameters { 1239 struct Parameters {
@@ -1273,7 +1272,7 @@ void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContex
1273 rb.PushIpcInterface<IStorage>(system, std::move(memory)); 1272 rb.PushIpcInterface<IStorage>(system, std::move(memory));
1274} 1273}
1275 1274
1276void ILibraryAppletCreator::CreateHandleStorage(Kernel::HLERequestContext& ctx) { 1275void ILibraryAppletCreator::CreateHandleStorage(HLERequestContext& ctx) {
1277 IPC::RequestParser rp{ctx}; 1276 IPC::RequestParser rp{ctx};
1278 1277
1279 const s64 size{rp.Pop<s64>()}; 1278 const s64 size{rp.Pop<s64>()};
@@ -1395,29 +1394,28 @@ IApplicationFunctions::~IApplicationFunctions() {
1395 service_context.CloseEvent(health_warning_disappeared_system_event); 1394 service_context.CloseEvent(health_warning_disappeared_system_event);
1396} 1395}
1397 1396
1398void IApplicationFunctions::EnableApplicationCrashReport(Kernel::HLERequestContext& ctx) { 1397void IApplicationFunctions::EnableApplicationCrashReport(HLERequestContext& ctx) {
1399 LOG_WARNING(Service_AM, "(STUBBED) called"); 1398 LOG_WARNING(Service_AM, "(STUBBED) called");
1400 1399
1401 IPC::ResponseBuilder rb{ctx, 2}; 1400 IPC::ResponseBuilder rb{ctx, 2};
1402 rb.Push(ResultSuccess); 1401 rb.Push(ResultSuccess);
1403} 1402}
1404 1403
1405void IApplicationFunctions::InitializeApplicationCopyrightFrameBuffer( 1404void IApplicationFunctions::InitializeApplicationCopyrightFrameBuffer(HLERequestContext& ctx) {
1406 Kernel::HLERequestContext& ctx) {
1407 LOG_WARNING(Service_AM, "(STUBBED) called"); 1405 LOG_WARNING(Service_AM, "(STUBBED) called");
1408 1406
1409 IPC::ResponseBuilder rb{ctx, 2}; 1407 IPC::ResponseBuilder rb{ctx, 2};
1410 rb.Push(ResultSuccess); 1408 rb.Push(ResultSuccess);
1411} 1409}
1412 1410
1413void IApplicationFunctions::SetApplicationCopyrightImage(Kernel::HLERequestContext& ctx) { 1411void IApplicationFunctions::SetApplicationCopyrightImage(HLERequestContext& ctx) {
1414 LOG_WARNING(Service_AM, "(STUBBED) called"); 1412 LOG_WARNING(Service_AM, "(STUBBED) called");
1415 1413
1416 IPC::ResponseBuilder rb{ctx, 2}; 1414 IPC::ResponseBuilder rb{ctx, 2};
1417 rb.Push(ResultSuccess); 1415 rb.Push(ResultSuccess);
1418} 1416}
1419 1417
1420void IApplicationFunctions::SetApplicationCopyrightVisibility(Kernel::HLERequestContext& ctx) { 1418void IApplicationFunctions::SetApplicationCopyrightVisibility(HLERequestContext& ctx) {
1421 IPC::RequestParser rp{ctx}; 1419 IPC::RequestParser rp{ctx};
1422 const auto is_visible = rp.Pop<bool>(); 1420 const auto is_visible = rp.Pop<bool>();
1423 1421
@@ -1427,37 +1425,35 @@ void IApplicationFunctions::SetApplicationCopyrightVisibility(Kernel::HLERequest
1427 rb.Push(ResultSuccess); 1425 rb.Push(ResultSuccess);
1428} 1426}
1429 1427
1430void IApplicationFunctions::BeginBlockingHomeButtonShortAndLongPressed( 1428void IApplicationFunctions::BeginBlockingHomeButtonShortAndLongPressed(HLERequestContext& ctx) {
1431 Kernel::HLERequestContext& ctx) {
1432 LOG_WARNING(Service_AM, "(STUBBED) called"); 1429 LOG_WARNING(Service_AM, "(STUBBED) called");
1433 1430
1434 IPC::ResponseBuilder rb{ctx, 2}; 1431 IPC::ResponseBuilder rb{ctx, 2};
1435 rb.Push(ResultSuccess); 1432 rb.Push(ResultSuccess);
1436} 1433}
1437 1434
1438void IApplicationFunctions::EndBlockingHomeButtonShortAndLongPressed( 1435void IApplicationFunctions::EndBlockingHomeButtonShortAndLongPressed(HLERequestContext& ctx) {
1439 Kernel::HLERequestContext& ctx) {
1440 LOG_WARNING(Service_AM, "(STUBBED) called"); 1436 LOG_WARNING(Service_AM, "(STUBBED) called");
1441 1437
1442 IPC::ResponseBuilder rb{ctx, 2}; 1438 IPC::ResponseBuilder rb{ctx, 2};
1443 rb.Push(ResultSuccess); 1439 rb.Push(ResultSuccess);
1444} 1440}
1445 1441
1446void IApplicationFunctions::BeginBlockingHomeButton(Kernel::HLERequestContext& ctx) { 1442void IApplicationFunctions::BeginBlockingHomeButton(HLERequestContext& ctx) {
1447 LOG_WARNING(Service_AM, "(STUBBED) called"); 1443 LOG_WARNING(Service_AM, "(STUBBED) called");
1448 1444
1449 IPC::ResponseBuilder rb{ctx, 2}; 1445 IPC::ResponseBuilder rb{ctx, 2};
1450 rb.Push(ResultSuccess); 1446 rb.Push(ResultSuccess);
1451} 1447}
1452 1448
1453void IApplicationFunctions::EndBlockingHomeButton(Kernel::HLERequestContext& ctx) { 1449void IApplicationFunctions::EndBlockingHomeButton(HLERequestContext& ctx) {
1454 LOG_WARNING(Service_AM, "(STUBBED) called"); 1450 LOG_WARNING(Service_AM, "(STUBBED) called");
1455 1451
1456 IPC::ResponseBuilder rb{ctx, 2}; 1452 IPC::ResponseBuilder rb{ctx, 2};
1457 rb.Push(ResultSuccess); 1453 rb.Push(ResultSuccess);
1458} 1454}
1459 1455
1460void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) { 1456void IApplicationFunctions::PopLaunchParameter(HLERequestContext& ctx) {
1461 IPC::RequestParser rp{ctx}; 1457 IPC::RequestParser rp{ctx};
1462 const auto kind = rp.PopEnum<LaunchParameterKind>(); 1458 const auto kind = rp.PopEnum<LaunchParameterKind>();
1463 1459
@@ -1509,15 +1505,14 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) {
1509 rb.Push(ERR_NO_DATA_IN_CHANNEL); 1505 rb.Push(ERR_NO_DATA_IN_CHANNEL);
1510} 1506}
1511 1507
1512void IApplicationFunctions::CreateApplicationAndRequestToStartForQuest( 1508void IApplicationFunctions::CreateApplicationAndRequestToStartForQuest(HLERequestContext& ctx) {
1513 Kernel::HLERequestContext& ctx) {
1514 LOG_WARNING(Service_AM, "(STUBBED) called"); 1509 LOG_WARNING(Service_AM, "(STUBBED) called");
1515 1510
1516 IPC::ResponseBuilder rb{ctx, 2}; 1511 IPC::ResponseBuilder rb{ctx, 2};
1517 rb.Push(ResultSuccess); 1512 rb.Push(ResultSuccess);
1518} 1513}
1519 1514
1520void IApplicationFunctions::EnsureSaveData(Kernel::HLERequestContext& ctx) { 1515void IApplicationFunctions::EnsureSaveData(HLERequestContext& ctx) {
1521 IPC::RequestParser rp{ctx}; 1516 IPC::RequestParser rp{ctx};
1522 u128 user_id = rp.PopRaw<u128>(); 1517 u128 user_id = rp.PopRaw<u128>();
1523 1518
@@ -1535,7 +1530,7 @@ void IApplicationFunctions::EnsureSaveData(Kernel::HLERequestContext& ctx) {
1535 rb.Push<u64>(0); 1530 rb.Push<u64>(0);
1536} 1531}
1537 1532
1538void IApplicationFunctions::SetTerminateResult(Kernel::HLERequestContext& ctx) { 1533void IApplicationFunctions::SetTerminateResult(HLERequestContext& ctx) {
1539 // Takes an input u32 Result, no output. 1534 // Takes an input u32 Result, no output.
1540 // For example, in some cases official apps use this with error 0x2A2 then 1535 // For example, in some cases official apps use this with error 0x2A2 then
1541 // uses svcBreak. 1536 // uses svcBreak.
@@ -1548,7 +1543,7 @@ void IApplicationFunctions::SetTerminateResult(Kernel::HLERequestContext& ctx) {
1548 rb.Push(ResultSuccess); 1543 rb.Push(ResultSuccess);
1549} 1544}
1550 1545
1551void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) { 1546void IApplicationFunctions::GetDisplayVersion(HLERequestContext& ctx) {
1552 LOG_DEBUG(Service_AM, "called"); 1547 LOG_DEBUG(Service_AM, "called");
1553 1548
1554 std::array<u8, 0x10> version_string{}; 1549 std::array<u8, 0x10> version_string{};
@@ -1582,7 +1577,7 @@ void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) {
1582 rb.PushRaw(version_string); 1577 rb.PushRaw(version_string);
1583} 1578}
1584 1579
1585void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) { 1580void IApplicationFunctions::GetDesiredLanguage(HLERequestContext& ctx) {
1586 // TODO(bunnei): This should be configurable 1581 // TODO(bunnei): This should be configurable
1587 LOG_DEBUG(Service_AM, "called"); 1582 LOG_DEBUG(Service_AM, "called");
1588 1583
@@ -1638,7 +1633,7 @@ void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) {
1638 rb.Push(*res_code); 1633 rb.Push(*res_code);
1639} 1634}
1640 1635
1641void IApplicationFunctions::IsGamePlayRecordingSupported(Kernel::HLERequestContext& ctx) { 1636void IApplicationFunctions::IsGamePlayRecordingSupported(HLERequestContext& ctx) {
1642 LOG_WARNING(Service_AM, "(STUBBED) called"); 1637 LOG_WARNING(Service_AM, "(STUBBED) called");
1643 1638
1644 constexpr bool gameplay_recording_supported = false; 1639 constexpr bool gameplay_recording_supported = false;
@@ -1648,21 +1643,21 @@ void IApplicationFunctions::IsGamePlayRecordingSupported(Kernel::HLERequestConte
1648 rb.Push(gameplay_recording_supported); 1643 rb.Push(gameplay_recording_supported);
1649} 1644}
1650 1645
1651void IApplicationFunctions::InitializeGamePlayRecording(Kernel::HLERequestContext& ctx) { 1646void IApplicationFunctions::InitializeGamePlayRecording(HLERequestContext& ctx) {
1652 LOG_WARNING(Service_AM, "(STUBBED) called"); 1647 LOG_WARNING(Service_AM, "(STUBBED) called");
1653 1648
1654 IPC::ResponseBuilder rb{ctx, 2}; 1649 IPC::ResponseBuilder rb{ctx, 2};
1655 rb.Push(ResultSuccess); 1650 rb.Push(ResultSuccess);
1656} 1651}
1657 1652
1658void IApplicationFunctions::SetGamePlayRecordingState(Kernel::HLERequestContext& ctx) { 1653void IApplicationFunctions::SetGamePlayRecordingState(HLERequestContext& ctx) {
1659 LOG_WARNING(Service_AM, "(STUBBED) called"); 1654 LOG_WARNING(Service_AM, "(STUBBED) called");
1660 1655
1661 IPC::ResponseBuilder rb{ctx, 2}; 1656 IPC::ResponseBuilder rb{ctx, 2};
1662 rb.Push(ResultSuccess); 1657 rb.Push(ResultSuccess);
1663} 1658}
1664 1659
1665void IApplicationFunctions::NotifyRunning(Kernel::HLERequestContext& ctx) { 1660void IApplicationFunctions::NotifyRunning(HLERequestContext& ctx) {
1666 LOG_WARNING(Service_AM, "(STUBBED) called"); 1661 LOG_WARNING(Service_AM, "(STUBBED) called");
1667 1662
1668 IPC::ResponseBuilder rb{ctx, 3}; 1663 IPC::ResponseBuilder rb{ctx, 3};
@@ -1670,7 +1665,7 @@ void IApplicationFunctions::NotifyRunning(Kernel::HLERequestContext& ctx) {
1670 rb.Push<u8>(0); // Unknown, seems to be ignored by official processes 1665 rb.Push<u8>(0); // Unknown, seems to be ignored by official processes
1671} 1666}
1672 1667
1673void IApplicationFunctions::GetPseudoDeviceId(Kernel::HLERequestContext& ctx) { 1668void IApplicationFunctions::GetPseudoDeviceId(HLERequestContext& ctx) {
1674 LOG_WARNING(Service_AM, "(STUBBED) called"); 1669 LOG_WARNING(Service_AM, "(STUBBED) called");
1675 1670
1676 IPC::ResponseBuilder rb{ctx, 6}; 1671 IPC::ResponseBuilder rb{ctx, 6};
@@ -1681,7 +1676,7 @@ void IApplicationFunctions::GetPseudoDeviceId(Kernel::HLERequestContext& ctx) {
1681 rb.Push<u64>(0); 1676 rb.Push<u64>(0);
1682} 1677}
1683 1678
1684void IApplicationFunctions::ExtendSaveData(Kernel::HLERequestContext& ctx) { 1679void IApplicationFunctions::ExtendSaveData(HLERequestContext& ctx) {
1685 struct Parameters { 1680 struct Parameters {
1686 FileSys::SaveDataType type; 1681 FileSys::SaveDataType type;
1687 u128 user_id; 1682 u128 user_id;
@@ -1710,7 +1705,7 @@ void IApplicationFunctions::ExtendSaveData(Kernel::HLERequestContext& ctx) {
1710 rb.Push<u64>(0); 1705 rb.Push<u64>(0);
1711} 1706}
1712 1707
1713void IApplicationFunctions::GetSaveDataSize(Kernel::HLERequestContext& ctx) { 1708void IApplicationFunctions::GetSaveDataSize(HLERequestContext& ctx) {
1714 struct Parameters { 1709 struct Parameters {
1715 FileSys::SaveDataType type; 1710 FileSys::SaveDataType type;
1716 u128 user_id; 1711 u128 user_id;
@@ -1732,7 +1727,7 @@ void IApplicationFunctions::GetSaveDataSize(Kernel::HLERequestContext& ctx) {
1732 rb.Push(size.journal); 1727 rb.Push(size.journal);
1733} 1728}
1734 1729
1735void IApplicationFunctions::QueryApplicationPlayStatistics(Kernel::HLERequestContext& ctx) { 1730void IApplicationFunctions::QueryApplicationPlayStatistics(HLERequestContext& ctx) {
1736 LOG_WARNING(Service_AM, "(STUBBED) called"); 1731 LOG_WARNING(Service_AM, "(STUBBED) called");
1737 1732
1738 IPC::ResponseBuilder rb{ctx, 3}; 1733 IPC::ResponseBuilder rb{ctx, 3};
@@ -1740,7 +1735,7 @@ void IApplicationFunctions::QueryApplicationPlayStatistics(Kernel::HLERequestCon
1740 rb.Push<u32>(0); 1735 rb.Push<u32>(0);
1741} 1736}
1742 1737
1743void IApplicationFunctions::QueryApplicationPlayStatisticsByUid(Kernel::HLERequestContext& ctx) { 1738void IApplicationFunctions::QueryApplicationPlayStatisticsByUid(HLERequestContext& ctx) {
1744 LOG_WARNING(Service_AM, "(STUBBED) called"); 1739 LOG_WARNING(Service_AM, "(STUBBED) called");
1745 1740
1746 IPC::ResponseBuilder rb{ctx, 3}; 1741 IPC::ResponseBuilder rb{ctx, 3};
@@ -1748,7 +1743,7 @@ void IApplicationFunctions::QueryApplicationPlayStatisticsByUid(Kernel::HLEReque
1748 rb.Push<u32>(0); 1743 rb.Push<u32>(0);
1749} 1744}
1750 1745
1751void IApplicationFunctions::ExecuteProgram(Kernel::HLERequestContext& ctx) { 1746void IApplicationFunctions::ExecuteProgram(HLERequestContext& ctx) {
1752 LOG_WARNING(Service_AM, "(STUBBED) called"); 1747 LOG_WARNING(Service_AM, "(STUBBED) called");
1753 1748
1754 IPC::RequestParser rp{ctx}; 1749 IPC::RequestParser rp{ctx};
@@ -1762,21 +1757,21 @@ void IApplicationFunctions::ExecuteProgram(Kernel::HLERequestContext& ctx) {
1762 system.ExecuteProgram(program_index); 1757 system.ExecuteProgram(program_index);
1763} 1758}
1764 1759
1765void IApplicationFunctions::ClearUserChannel(Kernel::HLERequestContext& ctx) { 1760void IApplicationFunctions::ClearUserChannel(HLERequestContext& ctx) {
1766 LOG_WARNING(Service_AM, "(STUBBED) called"); 1761 LOG_WARNING(Service_AM, "(STUBBED) called");
1767 1762
1768 IPC::ResponseBuilder rb{ctx, 2}; 1763 IPC::ResponseBuilder rb{ctx, 2};
1769 rb.Push(ResultSuccess); 1764 rb.Push(ResultSuccess);
1770} 1765}
1771 1766
1772void IApplicationFunctions::UnpopToUserChannel(Kernel::HLERequestContext& ctx) { 1767void IApplicationFunctions::UnpopToUserChannel(HLERequestContext& ctx) {
1773 LOG_WARNING(Service_AM, "(STUBBED) called"); 1768 LOG_WARNING(Service_AM, "(STUBBED) called");
1774 1769
1775 IPC::ResponseBuilder rb{ctx, 2}; 1770 IPC::ResponseBuilder rb{ctx, 2};
1776 rb.Push(ResultSuccess); 1771 rb.Push(ResultSuccess);
1777} 1772}
1778 1773
1779void IApplicationFunctions::GetPreviousProgramIndex(Kernel::HLERequestContext& ctx) { 1774void IApplicationFunctions::GetPreviousProgramIndex(HLERequestContext& ctx) {
1780 LOG_WARNING(Service_AM, "(STUBBED) called"); 1775 LOG_WARNING(Service_AM, "(STUBBED) called");
1781 1776
1782 IPC::ResponseBuilder rb{ctx, 3}; 1777 IPC::ResponseBuilder rb{ctx, 3};
@@ -1784,7 +1779,7 @@ void IApplicationFunctions::GetPreviousProgramIndex(Kernel::HLERequestContext& c
1784 rb.Push<s32>(previous_program_index); 1779 rb.Push<s32>(previous_program_index);
1785} 1780}
1786 1781
1787void IApplicationFunctions::GetGpuErrorDetectedSystemEvent(Kernel::HLERequestContext& ctx) { 1782void IApplicationFunctions::GetGpuErrorDetectedSystemEvent(HLERequestContext& ctx) {
1788 LOG_WARNING(Service_AM, "(STUBBED) called"); 1783 LOG_WARNING(Service_AM, "(STUBBED) called");
1789 1784
1790 IPC::ResponseBuilder rb{ctx, 2, 1}; 1785 IPC::ResponseBuilder rb{ctx, 2, 1};
@@ -1792,7 +1787,7 @@ void IApplicationFunctions::GetGpuErrorDetectedSystemEvent(Kernel::HLERequestCon
1792 rb.PushCopyObjects(gpu_error_detected_event->GetReadableEvent()); 1787 rb.PushCopyObjects(gpu_error_detected_event->GetReadableEvent());
1793} 1788}
1794 1789
1795void IApplicationFunctions::GetFriendInvitationStorageChannelEvent(Kernel::HLERequestContext& ctx) { 1790void IApplicationFunctions::GetFriendInvitationStorageChannelEvent(HLERequestContext& ctx) {
1796 LOG_DEBUG(Service_AM, "called"); 1791 LOG_DEBUG(Service_AM, "called");
1797 1792
1798 IPC::ResponseBuilder rb{ctx, 2, 1}; 1793 IPC::ResponseBuilder rb{ctx, 2, 1};
@@ -1800,15 +1795,14 @@ void IApplicationFunctions::GetFriendInvitationStorageChannelEvent(Kernel::HLERe
1800 rb.PushCopyObjects(friend_invitation_storage_channel_event->GetReadableEvent()); 1795 rb.PushCopyObjects(friend_invitation_storage_channel_event->GetReadableEvent());
1801} 1796}
1802 1797
1803void IApplicationFunctions::TryPopFromFriendInvitationStorageChannel( 1798void IApplicationFunctions::TryPopFromFriendInvitationStorageChannel(HLERequestContext& ctx) {
1804 Kernel::HLERequestContext& ctx) {
1805 LOG_WARNING(Service_AM, "(STUBBED) called"); 1799 LOG_WARNING(Service_AM, "(STUBBED) called");
1806 1800
1807 IPC::ResponseBuilder rb{ctx, 2}; 1801 IPC::ResponseBuilder rb{ctx, 2};
1808 rb.Push(ERR_NO_DATA_IN_CHANNEL); 1802 rb.Push(ERR_NO_DATA_IN_CHANNEL);
1809} 1803}
1810 1804
1811void IApplicationFunctions::GetNotificationStorageChannelEvent(Kernel::HLERequestContext& ctx) { 1805void IApplicationFunctions::GetNotificationStorageChannelEvent(HLERequestContext& ctx) {
1812 LOG_DEBUG(Service_AM, "called"); 1806 LOG_DEBUG(Service_AM, "called");
1813 1807
1814 IPC::ResponseBuilder rb{ctx, 2, 1}; 1808 IPC::ResponseBuilder rb{ctx, 2, 1};
@@ -1816,7 +1810,7 @@ void IApplicationFunctions::GetNotificationStorageChannelEvent(Kernel::HLEReques
1816 rb.PushCopyObjects(notification_storage_channel_event->GetReadableEvent()); 1810 rb.PushCopyObjects(notification_storage_channel_event->GetReadableEvent());
1817} 1811}
1818 1812
1819void IApplicationFunctions::GetHealthWarningDisappearedSystemEvent(Kernel::HLERequestContext& ctx) { 1813void IApplicationFunctions::GetHealthWarningDisappearedSystemEvent(HLERequestContext& ctx) {
1820 LOG_DEBUG(Service_AM, "called"); 1814 LOG_DEBUG(Service_AM, "called");
1821 1815
1822 IPC::ResponseBuilder rb{ctx, 2, 1}; 1816 IPC::ResponseBuilder rb{ctx, 2, 1};
@@ -1824,14 +1818,14 @@ void IApplicationFunctions::GetHealthWarningDisappearedSystemEvent(Kernel::HLERe
1824 rb.PushCopyObjects(health_warning_disappeared_system_event->GetReadableEvent()); 1818 rb.PushCopyObjects(health_warning_disappeared_system_event->GetReadableEvent());
1825} 1819}
1826 1820
1827void IApplicationFunctions::PrepareForJit(Kernel::HLERequestContext& ctx) { 1821void IApplicationFunctions::PrepareForJit(HLERequestContext& ctx) {
1828 LOG_WARNING(Service_AM, "(STUBBED) called"); 1822 LOG_WARNING(Service_AM, "(STUBBED) called");
1829 1823
1830 IPC::ResponseBuilder rb{ctx, 2}; 1824 IPC::ResponseBuilder rb{ctx, 2};
1831 rb.Push(ResultSuccess); 1825 rb.Push(ResultSuccess);
1832} 1826}
1833 1827
1834void LoopProcess(NVFlinger::NVFlinger& nvflinger, Core::System& system) { 1828void LoopProcess(Nvnflinger::Nvnflinger& nvnflinger, Core::System& system) {
1835 auto message_queue = std::make_shared<AppletMessageQueue>(system); 1829 auto message_queue = std::make_shared<AppletMessageQueue>(system);
1836 // Needed on game boot 1830 // Needed on game boot
1837 message_queue->PushMessage(AppletMessageQueue::AppletMessage::FocusStateChanged); 1831 message_queue->PushMessage(AppletMessageQueue::AppletMessage::FocusStateChanged);
@@ -1839,9 +1833,9 @@ void LoopProcess(NVFlinger::NVFlinger& nvflinger, Core::System& system) {
1839 auto server_manager = std::make_unique<ServerManager>(system); 1833 auto server_manager = std::make_unique<ServerManager>(system);
1840 1834
1841 server_manager->RegisterNamedService( 1835 server_manager->RegisterNamedService(
1842 "appletAE", std::make_shared<AppletAE>(nvflinger, message_queue, system)); 1836 "appletAE", std::make_shared<AppletAE>(nvnflinger, message_queue, system));
1843 server_manager->RegisterNamedService( 1837 server_manager->RegisterNamedService(
1844 "appletOE", std::make_shared<AppletOE>(nvflinger, message_queue, system)); 1838 "appletOE", std::make_shared<AppletOE>(nvnflinger, message_queue, system));
1845 server_manager->RegisterNamedService("idle:sys", std::make_shared<IdleSys>(system)); 1839 server_manager->RegisterNamedService("idle:sys", std::make_shared<IdleSys>(system));
1846 server_manager->RegisterNamedService("omm", std::make_shared<OMM>(system)); 1840 server_manager->RegisterNamedService("omm", std::make_shared<OMM>(system));
1847 server_manager->RegisterNamedService("spsm", std::make_shared<SPSM>(system)); 1841 server_manager->RegisterNamedService("spsm", std::make_shared<SPSM>(system));
@@ -1881,14 +1875,14 @@ IHomeMenuFunctions::~IHomeMenuFunctions() {
1881 service_context.CloseEvent(pop_from_general_channel_event); 1875 service_context.CloseEvent(pop_from_general_channel_event);
1882} 1876}
1883 1877
1884void IHomeMenuFunctions::RequestToGetForeground(Kernel::HLERequestContext& ctx) { 1878void IHomeMenuFunctions::RequestToGetForeground(HLERequestContext& ctx) {
1885 LOG_WARNING(Service_AM, "(STUBBED) called"); 1879 LOG_WARNING(Service_AM, "(STUBBED) called");
1886 1880
1887 IPC::ResponseBuilder rb{ctx, 2}; 1881 IPC::ResponseBuilder rb{ctx, 2};
1888 rb.Push(ResultSuccess); 1882 rb.Push(ResultSuccess);
1889} 1883}
1890 1884
1891void IHomeMenuFunctions::GetPopFromGeneralChannelEvent(Kernel::HLERequestContext& ctx) { 1885void IHomeMenuFunctions::GetPopFromGeneralChannelEvent(HLERequestContext& ctx) {
1892 LOG_WARNING(Service_AM, "(STUBBED) called"); 1886 LOG_WARNING(Service_AM, "(STUBBED) called");
1893 1887
1894 IPC::ResponseBuilder rb{ctx, 2, 1}; 1888 IPC::ResponseBuilder rb{ctx, 2, 1};
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h
index 79e2263d7..0dbc6485e 100644
--- a/src/core/hle/service/am/am.h
+++ b/src/core/hle/service/am/am.h
@@ -12,11 +12,12 @@
12 12
13namespace Kernel { 13namespace Kernel {
14class KernelCore; 14class KernelCore;
15class KReadableEvent;
15class KTransferMemory; 16class KTransferMemory;
16} // namespace Kernel 17} // namespace Kernel
17 18
18namespace Service::NVFlinger { 19namespace Service::Nvnflinger {
19class NVFlinger; 20class Nvnflinger;
20} 21}
21 22
22namespace Service::AM { 23namespace Service::AM {
@@ -109,8 +110,8 @@ public:
109 ~IWindowController() override; 110 ~IWindowController() override;
110 111
111private: 112private:
112 void GetAppletResourceUserId(Kernel::HLERequestContext& ctx); 113 void GetAppletResourceUserId(HLERequestContext& ctx);
113 void AcquireForegroundRights(Kernel::HLERequestContext& ctx); 114 void AcquireForegroundRights(HLERequestContext& ctx);
114}; 115};
115 116
116class IAudioController final : public ServiceFramework<IAudioController> { 117class IAudioController final : public ServiceFramework<IAudioController> {
@@ -119,11 +120,11 @@ public:
119 ~IAudioController() override; 120 ~IAudioController() override;
120 121
121private: 122private:
122 void SetExpectedMasterVolume(Kernel::HLERequestContext& ctx); 123 void SetExpectedMasterVolume(HLERequestContext& ctx);
123 void GetMainAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx); 124 void GetMainAppletExpectedMasterVolume(HLERequestContext& ctx);
124 void GetLibraryAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx); 125 void GetLibraryAppletExpectedMasterVolume(HLERequestContext& ctx);
125 void ChangeMainAppletMasterVolume(Kernel::HLERequestContext& ctx); 126 void ChangeMainAppletMasterVolume(HLERequestContext& ctx);
126 void SetTransparentAudioRate(Kernel::HLERequestContext& ctx); 127 void SetTransparentAudioRate(HLERequestContext& ctx);
127 128
128 static constexpr float min_allowed_volume = 0.0f; 129 static constexpr float min_allowed_volume = 0.0f;
129 static constexpr float max_allowed_volume = 1.0f; 130 static constexpr float max_allowed_volume = 1.0f;
@@ -153,36 +154,36 @@ public:
153 154
154class ISelfController final : public ServiceFramework<ISelfController> { 155class ISelfController final : public ServiceFramework<ISelfController> {
155public: 156public:
156 explicit ISelfController(Core::System& system_, NVFlinger::NVFlinger& nvflinger_); 157 explicit ISelfController(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger_);
157 ~ISelfController() override; 158 ~ISelfController() override;
158 159
159private: 160private:
160 void Exit(Kernel::HLERequestContext& ctx); 161 void Exit(HLERequestContext& ctx);
161 void LockExit(Kernel::HLERequestContext& ctx); 162 void LockExit(HLERequestContext& ctx);
162 void UnlockExit(Kernel::HLERequestContext& ctx); 163 void UnlockExit(HLERequestContext& ctx);
163 void EnterFatalSection(Kernel::HLERequestContext& ctx); 164 void EnterFatalSection(HLERequestContext& ctx);
164 void LeaveFatalSection(Kernel::HLERequestContext& ctx); 165 void LeaveFatalSection(HLERequestContext& ctx);
165 void GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& ctx); 166 void GetLibraryAppletLaunchableEvent(HLERequestContext& ctx);
166 void SetScreenShotPermission(Kernel::HLERequestContext& ctx); 167 void SetScreenShotPermission(HLERequestContext& ctx);
167 void SetOperationModeChangedNotification(Kernel::HLERequestContext& ctx); 168 void SetOperationModeChangedNotification(HLERequestContext& ctx);
168 void SetPerformanceModeChangedNotification(Kernel::HLERequestContext& ctx); 169 void SetPerformanceModeChangedNotification(HLERequestContext& ctx);
169 void SetFocusHandlingMode(Kernel::HLERequestContext& ctx); 170 void SetFocusHandlingMode(HLERequestContext& ctx);
170 void SetRestartMessageEnabled(Kernel::HLERequestContext& ctx); 171 void SetRestartMessageEnabled(HLERequestContext& ctx);
171 void SetOutOfFocusSuspendingEnabled(Kernel::HLERequestContext& ctx); 172 void SetOutOfFocusSuspendingEnabled(HLERequestContext& ctx);
172 void SetAlbumImageOrientation(Kernel::HLERequestContext& ctx); 173 void SetAlbumImageOrientation(HLERequestContext& ctx);
173 void CreateManagedDisplayLayer(Kernel::HLERequestContext& ctx); 174 void CreateManagedDisplayLayer(HLERequestContext& ctx);
174 void CreateManagedDisplaySeparableLayer(Kernel::HLERequestContext& ctx); 175 void CreateManagedDisplaySeparableLayer(HLERequestContext& ctx);
175 void SetHandlesRequestToDisplay(Kernel::HLERequestContext& ctx); 176 void SetHandlesRequestToDisplay(HLERequestContext& ctx);
176 void SetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx); 177 void SetIdleTimeDetectionExtension(HLERequestContext& ctx);
177 void GetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx); 178 void GetIdleTimeDetectionExtension(HLERequestContext& ctx);
178 void ReportUserIsActive(Kernel::HLERequestContext& ctx); 179 void ReportUserIsActive(HLERequestContext& ctx);
179 void SetAutoSleepDisabled(Kernel::HLERequestContext& ctx); 180 void SetAutoSleepDisabled(HLERequestContext& ctx);
180 void IsAutoSleepDisabled(Kernel::HLERequestContext& ctx); 181 void IsAutoSleepDisabled(HLERequestContext& ctx);
181 void GetAccumulatedSuspendedTickValue(Kernel::HLERequestContext& ctx); 182 void GetAccumulatedSuspendedTickValue(HLERequestContext& ctx);
182 void GetAccumulatedSuspendedTickChangedEvent(Kernel::HLERequestContext& ctx); 183 void GetAccumulatedSuspendedTickChangedEvent(HLERequestContext& ctx);
183 void SetAlbumImageTakenNotificationEnabled(Kernel::HLERequestContext& ctx); 184 void SetAlbumImageTakenNotificationEnabled(HLERequestContext& ctx);
184 void SaveCurrentScreenshot(Kernel::HLERequestContext& ctx); 185 void SaveCurrentScreenshot(HLERequestContext& ctx);
185 void SetRecordVolumeMuted(Kernel::HLERequestContext& ctx); 186 void SetRecordVolumeMuted(HLERequestContext& ctx);
186 187
187 enum class ScreenshotPermission : u32 { 188 enum class ScreenshotPermission : u32 {
188 Inherit = 0, 189 Inherit = 0,
@@ -190,7 +191,7 @@ private:
190 Disable = 2, 191 Disable = 2,
191 }; 192 };
192 193
193 NVFlinger::NVFlinger& nvflinger; 194 Nvnflinger::Nvnflinger& nvnflinger;
194 195
195 KernelHelpers::ServiceContext service_context; 196 KernelHelpers::ServiceContext service_context;
196 197
@@ -235,22 +236,22 @@ private:
235 CaptureButtonLongPressing, 236 CaptureButtonLongPressing,
236 }; 237 };
237 238
238 void GetEventHandle(Kernel::HLERequestContext& ctx); 239 void GetEventHandle(HLERequestContext& ctx);
239 void ReceiveMessage(Kernel::HLERequestContext& ctx); 240 void ReceiveMessage(HLERequestContext& ctx);
240 void GetCurrentFocusState(Kernel::HLERequestContext& ctx); 241 void GetCurrentFocusState(HLERequestContext& ctx);
241 void GetDefaultDisplayResolutionChangeEvent(Kernel::HLERequestContext& ctx); 242 void GetDefaultDisplayResolutionChangeEvent(HLERequestContext& ctx);
242 void GetOperationMode(Kernel::HLERequestContext& ctx); 243 void GetOperationMode(HLERequestContext& ctx);
243 void GetPerformanceMode(Kernel::HLERequestContext& ctx); 244 void GetPerformanceMode(HLERequestContext& ctx);
244 void GetBootMode(Kernel::HLERequestContext& ctx); 245 void GetBootMode(HLERequestContext& ctx);
245 void IsVrModeEnabled(Kernel::HLERequestContext& ctx); 246 void IsVrModeEnabled(HLERequestContext& ctx);
246 void SetVrModeEnabled(Kernel::HLERequestContext& ctx); 247 void SetVrModeEnabled(HLERequestContext& ctx);
247 void SetLcdBacklighOffEnabled(Kernel::HLERequestContext& ctx); 248 void SetLcdBacklighOffEnabled(HLERequestContext& ctx);
248 void BeginVrModeEx(Kernel::HLERequestContext& ctx); 249 void BeginVrModeEx(HLERequestContext& ctx);
249 void EndVrModeEx(Kernel::HLERequestContext& ctx); 250 void EndVrModeEx(HLERequestContext& ctx);
250 void GetDefaultDisplayResolution(Kernel::HLERequestContext& ctx); 251 void GetDefaultDisplayResolution(HLERequestContext& ctx);
251 void SetCpuBoostMode(Kernel::HLERequestContext& ctx); 252 void SetCpuBoostMode(HLERequestContext& ctx);
252 void PerformSystemButtonPressingIfInFocus(Kernel::HLERequestContext& ctx); 253 void PerformSystemButtonPressingIfInFocus(HLERequestContext& ctx);
253 void SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled(Kernel::HLERequestContext& ctx); 254 void SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled(HLERequestContext& ctx);
254 255
255 std::shared_ptr<AppletMessageQueue> msg_queue; 256 std::shared_ptr<AppletMessageQueue> msg_queue;
256 bool vr_mode_state{}; 257 bool vr_mode_state{};
@@ -283,7 +284,7 @@ public:
283 284
284private: 285private:
285 void Register(); 286 void Register();
286 void Open(Kernel::HLERequestContext& ctx); 287 void Open(HLERequestContext& ctx);
287 288
288 std::shared_ptr<IStorageImpl> impl; 289 std::shared_ptr<IStorageImpl> impl;
289}; 290};
@@ -294,9 +295,9 @@ public:
294 ~IStorageAccessor() override; 295 ~IStorageAccessor() override;
295 296
296private: 297private:
297 void GetSize(Kernel::HLERequestContext& ctx); 298 void GetSize(HLERequestContext& ctx);
298 void Write(Kernel::HLERequestContext& ctx); 299 void Write(HLERequestContext& ctx);
299 void Read(Kernel::HLERequestContext& ctx); 300 void Read(HLERequestContext& ctx);
300 301
301 IStorage& backing; 302 IStorage& backing;
302}; 303};
@@ -307,10 +308,10 @@ public:
307 ~ILibraryAppletCreator() override; 308 ~ILibraryAppletCreator() override;
308 309
309private: 310private:
310 void CreateLibraryApplet(Kernel::HLERequestContext& ctx); 311 void CreateLibraryApplet(HLERequestContext& ctx);
311 void CreateStorage(Kernel::HLERequestContext& ctx); 312 void CreateStorage(HLERequestContext& ctx);
312 void CreateTransferMemoryStorage(Kernel::HLERequestContext& ctx); 313 void CreateTransferMemoryStorage(HLERequestContext& ctx);
313 void CreateHandleStorage(Kernel::HLERequestContext& ctx); 314 void CreateHandleStorage(HLERequestContext& ctx);
314}; 315};
315 316
316class IApplicationFunctions final : public ServiceFramework<IApplicationFunctions> { 317class IApplicationFunctions final : public ServiceFramework<IApplicationFunctions> {
@@ -319,39 +320,39 @@ public:
319 ~IApplicationFunctions() override; 320 ~IApplicationFunctions() override;
320 321
321private: 322private:
322 void PopLaunchParameter(Kernel::HLERequestContext& ctx); 323 void PopLaunchParameter(HLERequestContext& ctx);
323 void CreateApplicationAndRequestToStartForQuest(Kernel::HLERequestContext& ctx); 324 void CreateApplicationAndRequestToStartForQuest(HLERequestContext& ctx);
324 void EnsureSaveData(Kernel::HLERequestContext& ctx); 325 void EnsureSaveData(HLERequestContext& ctx);
325 void SetTerminateResult(Kernel::HLERequestContext& ctx); 326 void SetTerminateResult(HLERequestContext& ctx);
326 void GetDisplayVersion(Kernel::HLERequestContext& ctx); 327 void GetDisplayVersion(HLERequestContext& ctx);
327 void GetDesiredLanguage(Kernel::HLERequestContext& ctx); 328 void GetDesiredLanguage(HLERequestContext& ctx);
328 void IsGamePlayRecordingSupported(Kernel::HLERequestContext& ctx); 329 void IsGamePlayRecordingSupported(HLERequestContext& ctx);
329 void InitializeGamePlayRecording(Kernel::HLERequestContext& ctx); 330 void InitializeGamePlayRecording(HLERequestContext& ctx);
330 void SetGamePlayRecordingState(Kernel::HLERequestContext& ctx); 331 void SetGamePlayRecordingState(HLERequestContext& ctx);
331 void NotifyRunning(Kernel::HLERequestContext& ctx); 332 void NotifyRunning(HLERequestContext& ctx);
332 void GetPseudoDeviceId(Kernel::HLERequestContext& ctx); 333 void GetPseudoDeviceId(HLERequestContext& ctx);
333 void ExtendSaveData(Kernel::HLERequestContext& ctx); 334 void ExtendSaveData(HLERequestContext& ctx);
334 void GetSaveDataSize(Kernel::HLERequestContext& ctx); 335 void GetSaveDataSize(HLERequestContext& ctx);
335 void BeginBlockingHomeButtonShortAndLongPressed(Kernel::HLERequestContext& ctx); 336 void BeginBlockingHomeButtonShortAndLongPressed(HLERequestContext& ctx);
336 void EndBlockingHomeButtonShortAndLongPressed(Kernel::HLERequestContext& ctx); 337 void EndBlockingHomeButtonShortAndLongPressed(HLERequestContext& ctx);
337 void BeginBlockingHomeButton(Kernel::HLERequestContext& ctx); 338 void BeginBlockingHomeButton(HLERequestContext& ctx);
338 void EndBlockingHomeButton(Kernel::HLERequestContext& ctx); 339 void EndBlockingHomeButton(HLERequestContext& ctx);
339 void EnableApplicationCrashReport(Kernel::HLERequestContext& ctx); 340 void EnableApplicationCrashReport(HLERequestContext& ctx);
340 void InitializeApplicationCopyrightFrameBuffer(Kernel::HLERequestContext& ctx); 341 void InitializeApplicationCopyrightFrameBuffer(HLERequestContext& ctx);
341 void SetApplicationCopyrightImage(Kernel::HLERequestContext& ctx); 342 void SetApplicationCopyrightImage(HLERequestContext& ctx);
342 void SetApplicationCopyrightVisibility(Kernel::HLERequestContext& ctx); 343 void SetApplicationCopyrightVisibility(HLERequestContext& ctx);
343 void QueryApplicationPlayStatistics(Kernel::HLERequestContext& ctx); 344 void QueryApplicationPlayStatistics(HLERequestContext& ctx);
344 void QueryApplicationPlayStatisticsByUid(Kernel::HLERequestContext& ctx); 345 void QueryApplicationPlayStatisticsByUid(HLERequestContext& ctx);
345 void ExecuteProgram(Kernel::HLERequestContext& ctx); 346 void ExecuteProgram(HLERequestContext& ctx);
346 void ClearUserChannel(Kernel::HLERequestContext& ctx); 347 void ClearUserChannel(HLERequestContext& ctx);
347 void UnpopToUserChannel(Kernel::HLERequestContext& ctx); 348 void UnpopToUserChannel(HLERequestContext& ctx);
348 void GetPreviousProgramIndex(Kernel::HLERequestContext& ctx); 349 void GetPreviousProgramIndex(HLERequestContext& ctx);
349 void GetGpuErrorDetectedSystemEvent(Kernel::HLERequestContext& ctx); 350 void GetGpuErrorDetectedSystemEvent(HLERequestContext& ctx);
350 void GetFriendInvitationStorageChannelEvent(Kernel::HLERequestContext& ctx); 351 void GetFriendInvitationStorageChannelEvent(HLERequestContext& ctx);
351 void TryPopFromFriendInvitationStorageChannel(Kernel::HLERequestContext& ctx); 352 void TryPopFromFriendInvitationStorageChannel(HLERequestContext& ctx);
352 void GetNotificationStorageChannelEvent(Kernel::HLERequestContext& ctx); 353 void GetNotificationStorageChannelEvent(HLERequestContext& ctx);
353 void GetHealthWarningDisappearedSystemEvent(Kernel::HLERequestContext& ctx); 354 void GetHealthWarningDisappearedSystemEvent(HLERequestContext& ctx);
354 void PrepareForJit(Kernel::HLERequestContext& ctx); 355 void PrepareForJit(HLERequestContext& ctx);
355 356
356 KernelHelpers::ServiceContext service_context; 357 KernelHelpers::ServiceContext service_context;
357 358
@@ -370,8 +371,8 @@ public:
370 ~IHomeMenuFunctions() override; 371 ~IHomeMenuFunctions() override;
371 372
372private: 373private:
373 void RequestToGetForeground(Kernel::HLERequestContext& ctx); 374 void RequestToGetForeground(HLERequestContext& ctx);
374 void GetPopFromGeneralChannelEvent(Kernel::HLERequestContext& ctx); 375 void GetPopFromGeneralChannelEvent(HLERequestContext& ctx);
375 376
376 KernelHelpers::ServiceContext service_context; 377 KernelHelpers::ServiceContext service_context;
377 378
@@ -396,6 +397,6 @@ public:
396 ~IProcessWindingController() override; 397 ~IProcessWindingController() override;
397}; 398};
398 399
399void LoopProcess(NVFlinger::NVFlinger& nvflinger, Core::System& system); 400void LoopProcess(Nvnflinger::Nvnflinger& nvnflinger, Core::System& system);
400 401
401} // namespace Service::AM 402} // namespace Service::AM
diff --git a/src/core/hle/service/am/applet_ae.cpp b/src/core/hle/service/am/applet_ae.cpp
index d7719da35..2764f7ceb 100644
--- a/src/core/hle/service/am/applet_ae.cpp
+++ b/src/core/hle/service/am/applet_ae.cpp
@@ -3,20 +3,20 @@
3 3
4#include "common/logging/log.h" 4#include "common/logging/log.h"
5#include "core/core.h" 5#include "core/core.h"
6#include "core/hle/ipc_helpers.h"
7#include "core/hle/service/am/am.h" 6#include "core/hle/service/am/am.h"
8#include "core/hle/service/am/applet_ae.h" 7#include "core/hle/service/am/applet_ae.h"
9#include "core/hle/service/nvflinger/nvflinger.h" 8#include "core/hle/service/ipc_helpers.h"
9#include "core/hle/service/nvnflinger/nvnflinger.h"
10 10
11namespace Service::AM { 11namespace Service::AM {
12 12
13class ILibraryAppletProxy final : public ServiceFramework<ILibraryAppletProxy> { 13class ILibraryAppletProxy final : public ServiceFramework<ILibraryAppletProxy> {
14public: 14public:
15 explicit ILibraryAppletProxy(NVFlinger::NVFlinger& nvflinger_, 15 explicit ILibraryAppletProxy(Nvnflinger::Nvnflinger& nvnflinger_,
16 std::shared_ptr<AppletMessageQueue> msg_queue_, 16 std::shared_ptr<AppletMessageQueue> msg_queue_,
17 Core::System& system_) 17 Core::System& system_)
18 : ServiceFramework{system_, "ILibraryAppletProxy"}, nvflinger{nvflinger_}, 18 : ServiceFramework{system_, "ILibraryAppletProxy"},
19 msg_queue{std::move(msg_queue_)} { 19 nvnflinger{nvnflinger_}, msg_queue{std::move(msg_queue_)} {
20 // clang-format off 20 // clang-format off
21 static const FunctionInfo functions[] = { 21 static const FunctionInfo functions[] = {
22 {0, &ILibraryAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"}, 22 {0, &ILibraryAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"},
@@ -36,7 +36,7 @@ public:
36 } 36 }
37 37
38private: 38private:
39 void GetCommonStateGetter(Kernel::HLERequestContext& ctx) { 39 void GetCommonStateGetter(HLERequestContext& ctx) {
40 LOG_DEBUG(Service_AM, "called"); 40 LOG_DEBUG(Service_AM, "called");
41 41
42 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 42 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -44,15 +44,15 @@ private:
44 rb.PushIpcInterface<ICommonStateGetter>(system, msg_queue); 44 rb.PushIpcInterface<ICommonStateGetter>(system, msg_queue);
45 } 45 }
46 46
47 void GetSelfController(Kernel::HLERequestContext& ctx) { 47 void GetSelfController(HLERequestContext& ctx) {
48 LOG_DEBUG(Service_AM, "called"); 48 LOG_DEBUG(Service_AM, "called");
49 49
50 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 50 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
51 rb.Push(ResultSuccess); 51 rb.Push(ResultSuccess);
52 rb.PushIpcInterface<ISelfController>(system, nvflinger); 52 rb.PushIpcInterface<ISelfController>(system, nvnflinger);
53 } 53 }
54 54
55 void GetWindowController(Kernel::HLERequestContext& ctx) { 55 void GetWindowController(HLERequestContext& ctx) {
56 LOG_DEBUG(Service_AM, "called"); 56 LOG_DEBUG(Service_AM, "called");
57 57
58 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 58 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -60,7 +60,7 @@ private:
60 rb.PushIpcInterface<IWindowController>(system); 60 rb.PushIpcInterface<IWindowController>(system);
61 } 61 }
62 62
63 void GetAudioController(Kernel::HLERequestContext& ctx) { 63 void GetAudioController(HLERequestContext& ctx) {
64 LOG_DEBUG(Service_AM, "called"); 64 LOG_DEBUG(Service_AM, "called");
65 65
66 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 66 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -68,7 +68,7 @@ private:
68 rb.PushIpcInterface<IAudioController>(system); 68 rb.PushIpcInterface<IAudioController>(system);
69 } 69 }
70 70
71 void GetDisplayController(Kernel::HLERequestContext& ctx) { 71 void GetDisplayController(HLERequestContext& ctx) {
72 LOG_DEBUG(Service_AM, "called"); 72 LOG_DEBUG(Service_AM, "called");
73 73
74 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 74 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -76,7 +76,7 @@ private:
76 rb.PushIpcInterface<IDisplayController>(system); 76 rb.PushIpcInterface<IDisplayController>(system);
77 } 77 }
78 78
79 void GetProcessWindingController(Kernel::HLERequestContext& ctx) { 79 void GetProcessWindingController(HLERequestContext& ctx) {
80 LOG_DEBUG(Service_AM, "called"); 80 LOG_DEBUG(Service_AM, "called");
81 81
82 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 82 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -84,7 +84,7 @@ private:
84 rb.PushIpcInterface<IProcessWindingController>(system); 84 rb.PushIpcInterface<IProcessWindingController>(system);
85 } 85 }
86 86
87 void GetDebugFunctions(Kernel::HLERequestContext& ctx) { 87 void GetDebugFunctions(HLERequestContext& ctx) {
88 LOG_DEBUG(Service_AM, "called"); 88 LOG_DEBUG(Service_AM, "called");
89 89
90 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 90 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -92,7 +92,7 @@ private:
92 rb.PushIpcInterface<IDebugFunctions>(system); 92 rb.PushIpcInterface<IDebugFunctions>(system);
93 } 93 }
94 94
95 void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) { 95 void GetLibraryAppletCreator(HLERequestContext& ctx) {
96 LOG_DEBUG(Service_AM, "called"); 96 LOG_DEBUG(Service_AM, "called");
97 97
98 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 98 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -100,7 +100,7 @@ private:
100 rb.PushIpcInterface<ILibraryAppletCreator>(system); 100 rb.PushIpcInterface<ILibraryAppletCreator>(system);
101 } 101 }
102 102
103 void GetApplicationFunctions(Kernel::HLERequestContext& ctx) { 103 void GetApplicationFunctions(HLERequestContext& ctx) {
104 LOG_DEBUG(Service_AM, "called"); 104 LOG_DEBUG(Service_AM, "called");
105 105
106 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 106 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -108,17 +108,17 @@ private:
108 rb.PushIpcInterface<IApplicationFunctions>(system); 108 rb.PushIpcInterface<IApplicationFunctions>(system);
109 } 109 }
110 110
111 NVFlinger::NVFlinger& nvflinger; 111 Nvnflinger::Nvnflinger& nvnflinger;
112 std::shared_ptr<AppletMessageQueue> msg_queue; 112 std::shared_ptr<AppletMessageQueue> msg_queue;
113}; 113};
114 114
115class ISystemAppletProxy final : public ServiceFramework<ISystemAppletProxy> { 115class ISystemAppletProxy final : public ServiceFramework<ISystemAppletProxy> {
116public: 116public:
117 explicit ISystemAppletProxy(NVFlinger::NVFlinger& nvflinger_, 117 explicit ISystemAppletProxy(Nvnflinger::Nvnflinger& nvnflinger_,
118 std::shared_ptr<AppletMessageQueue> msg_queue_, 118 std::shared_ptr<AppletMessageQueue> msg_queue_,
119 Core::System& system_) 119 Core::System& system_)
120 : ServiceFramework{system_, "ISystemAppletProxy"}, nvflinger{nvflinger_}, 120 : ServiceFramework{system_, "ISystemAppletProxy"},
121 msg_queue{std::move(msg_queue_)} { 121 nvnflinger{nvnflinger_}, msg_queue{std::move(msg_queue_)} {
122 // clang-format off 122 // clang-format off
123 static const FunctionInfo functions[] = { 123 static const FunctionInfo functions[] = {
124 {0, &ISystemAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"}, 124 {0, &ISystemAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"},
@@ -140,7 +140,7 @@ public:
140 } 140 }
141 141
142private: 142private:
143 void GetCommonStateGetter(Kernel::HLERequestContext& ctx) { 143 void GetCommonStateGetter(HLERequestContext& ctx) {
144 LOG_DEBUG(Service_AM, "called"); 144 LOG_DEBUG(Service_AM, "called");
145 145
146 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 146 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -148,15 +148,15 @@ private:
148 rb.PushIpcInterface<ICommonStateGetter>(system, msg_queue); 148 rb.PushIpcInterface<ICommonStateGetter>(system, msg_queue);
149 } 149 }
150 150
151 void GetSelfController(Kernel::HLERequestContext& ctx) { 151 void GetSelfController(HLERequestContext& ctx) {
152 LOG_DEBUG(Service_AM, "called"); 152 LOG_DEBUG(Service_AM, "called");
153 153
154 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 154 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
155 rb.Push(ResultSuccess); 155 rb.Push(ResultSuccess);
156 rb.PushIpcInterface<ISelfController>(system, nvflinger); 156 rb.PushIpcInterface<ISelfController>(system, nvnflinger);
157 } 157 }
158 158
159 void GetWindowController(Kernel::HLERequestContext& ctx) { 159 void GetWindowController(HLERequestContext& ctx) {
160 LOG_DEBUG(Service_AM, "called"); 160 LOG_DEBUG(Service_AM, "called");
161 161
162 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 162 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -164,7 +164,7 @@ private:
164 rb.PushIpcInterface<IWindowController>(system); 164 rb.PushIpcInterface<IWindowController>(system);
165 } 165 }
166 166
167 void GetAudioController(Kernel::HLERequestContext& ctx) { 167 void GetAudioController(HLERequestContext& ctx) {
168 LOG_DEBUG(Service_AM, "called"); 168 LOG_DEBUG(Service_AM, "called");
169 169
170 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 170 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -172,7 +172,7 @@ private:
172 rb.PushIpcInterface<IAudioController>(system); 172 rb.PushIpcInterface<IAudioController>(system);
173 } 173 }
174 174
175 void GetDisplayController(Kernel::HLERequestContext& ctx) { 175 void GetDisplayController(HLERequestContext& ctx) {
176 LOG_DEBUG(Service_AM, "called"); 176 LOG_DEBUG(Service_AM, "called");
177 177
178 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 178 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -180,7 +180,7 @@ private:
180 rb.PushIpcInterface<IDisplayController>(system); 180 rb.PushIpcInterface<IDisplayController>(system);
181 } 181 }
182 182
183 void GetDebugFunctions(Kernel::HLERequestContext& ctx) { 183 void GetDebugFunctions(HLERequestContext& ctx) {
184 LOG_DEBUG(Service_AM, "called"); 184 LOG_DEBUG(Service_AM, "called");
185 185
186 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 186 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -188,7 +188,7 @@ private:
188 rb.PushIpcInterface<IDebugFunctions>(system); 188 rb.PushIpcInterface<IDebugFunctions>(system);
189 } 189 }
190 190
191 void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) { 191 void GetLibraryAppletCreator(HLERequestContext& ctx) {
192 LOG_DEBUG(Service_AM, "called"); 192 LOG_DEBUG(Service_AM, "called");
193 193
194 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 194 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -196,7 +196,7 @@ private:
196 rb.PushIpcInterface<ILibraryAppletCreator>(system); 196 rb.PushIpcInterface<ILibraryAppletCreator>(system);
197 } 197 }
198 198
199 void GetHomeMenuFunctions(Kernel::HLERequestContext& ctx) { 199 void GetHomeMenuFunctions(HLERequestContext& ctx) {
200 LOG_DEBUG(Service_AM, "called"); 200 LOG_DEBUG(Service_AM, "called");
201 201
202 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 202 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -204,7 +204,7 @@ private:
204 rb.PushIpcInterface<IHomeMenuFunctions>(system); 204 rb.PushIpcInterface<IHomeMenuFunctions>(system);
205 } 205 }
206 206
207 void GetGlobalStateController(Kernel::HLERequestContext& ctx) { 207 void GetGlobalStateController(HLERequestContext& ctx) {
208 LOG_DEBUG(Service_AM, "called"); 208 LOG_DEBUG(Service_AM, "called");
209 209
210 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 210 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -212,7 +212,7 @@ private:
212 rb.PushIpcInterface<IGlobalStateController>(system); 212 rb.PushIpcInterface<IGlobalStateController>(system);
213 } 213 }
214 214
215 void GetApplicationCreator(Kernel::HLERequestContext& ctx) { 215 void GetApplicationCreator(HLERequestContext& ctx) {
216 LOG_DEBUG(Service_AM, "called"); 216 LOG_DEBUG(Service_AM, "called");
217 217
218 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 218 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -220,38 +220,38 @@ private:
220 rb.PushIpcInterface<IApplicationCreator>(system); 220 rb.PushIpcInterface<IApplicationCreator>(system);
221 } 221 }
222 222
223 NVFlinger::NVFlinger& nvflinger; 223 Nvnflinger::Nvnflinger& nvnflinger;
224 std::shared_ptr<AppletMessageQueue> msg_queue; 224 std::shared_ptr<AppletMessageQueue> msg_queue;
225}; 225};
226 226
227void AppletAE::OpenSystemAppletProxy(Kernel::HLERequestContext& ctx) { 227void AppletAE::OpenSystemAppletProxy(HLERequestContext& ctx) {
228 LOG_DEBUG(Service_AM, "called"); 228 LOG_DEBUG(Service_AM, "called");
229 229
230 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 230 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
231 rb.Push(ResultSuccess); 231 rb.Push(ResultSuccess);
232 rb.PushIpcInterface<ISystemAppletProxy>(nvflinger, msg_queue, system); 232 rb.PushIpcInterface<ISystemAppletProxy>(nvnflinger, msg_queue, system);
233} 233}
234 234
235void AppletAE::OpenLibraryAppletProxy(Kernel::HLERequestContext& ctx) { 235void AppletAE::OpenLibraryAppletProxy(HLERequestContext& ctx) {
236 LOG_DEBUG(Service_AM, "called"); 236 LOG_DEBUG(Service_AM, "called");
237 237
238 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 238 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
239 rb.Push(ResultSuccess); 239 rb.Push(ResultSuccess);
240 rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger, msg_queue, system); 240 rb.PushIpcInterface<ILibraryAppletProxy>(nvnflinger, msg_queue, system);
241} 241}
242 242
243void AppletAE::OpenLibraryAppletProxyOld(Kernel::HLERequestContext& ctx) { 243void AppletAE::OpenLibraryAppletProxyOld(HLERequestContext& ctx) {
244 LOG_DEBUG(Service_AM, "called"); 244 LOG_DEBUG(Service_AM, "called");
245 245
246 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 246 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
247 rb.Push(ResultSuccess); 247 rb.Push(ResultSuccess);
248 rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger, msg_queue, system); 248 rb.PushIpcInterface<ILibraryAppletProxy>(nvnflinger, msg_queue, system);
249} 249}
250 250
251AppletAE::AppletAE(NVFlinger::NVFlinger& nvflinger_, std::shared_ptr<AppletMessageQueue> msg_queue_, 251AppletAE::AppletAE(Nvnflinger::Nvnflinger& nvnflinger_,
252 Core::System& system_) 252 std::shared_ptr<AppletMessageQueue> msg_queue_, Core::System& system_)
253 : ServiceFramework{system_, "appletAE"}, nvflinger{nvflinger_}, msg_queue{ 253 : ServiceFramework{system_, "appletAE"}, nvnflinger{nvnflinger_}, msg_queue{
254 std::move(msg_queue_)} { 254 std::move(msg_queue_)} {
255 // clang-format off 255 // clang-format off
256 static const FunctionInfo functions[] = { 256 static const FunctionInfo functions[] = {
257 {100, &AppletAE::OpenSystemAppletProxy, "OpenSystemAppletProxy"}, 257 {100, &AppletAE::OpenSystemAppletProxy, "OpenSystemAppletProxy"},
diff --git a/src/core/hle/service/am/applet_ae.h b/src/core/hle/service/am/applet_ae.h
index 2147976a6..538ce2903 100644
--- a/src/core/hle/service/am/applet_ae.h
+++ b/src/core/hle/service/am/applet_ae.h
@@ -12,8 +12,8 @@ namespace FileSystem {
12class FileSystemController; 12class FileSystemController;
13} 13}
14 14
15namespace NVFlinger { 15namespace Nvnflinger {
16class NVFlinger; 16class Nvnflinger;
17} 17}
18 18
19namespace AM { 19namespace AM {
@@ -22,18 +22,18 @@ class AppletMessageQueue;
22 22
23class AppletAE final : public ServiceFramework<AppletAE> { 23class AppletAE final : public ServiceFramework<AppletAE> {
24public: 24public:
25 explicit AppletAE(NVFlinger::NVFlinger& nvflinger_, 25 explicit AppletAE(Nvnflinger::Nvnflinger& nvnflinger_,
26 std::shared_ptr<AppletMessageQueue> msg_queue_, Core::System& system_); 26 std::shared_ptr<AppletMessageQueue> msg_queue_, Core::System& system_);
27 ~AppletAE() override; 27 ~AppletAE() override;
28 28
29 const std::shared_ptr<AppletMessageQueue>& GetMessageQueue() const; 29 const std::shared_ptr<AppletMessageQueue>& GetMessageQueue() const;
30 30
31private: 31private:
32 void OpenSystemAppletProxy(Kernel::HLERequestContext& ctx); 32 void OpenSystemAppletProxy(HLERequestContext& ctx);
33 void OpenLibraryAppletProxy(Kernel::HLERequestContext& ctx); 33 void OpenLibraryAppletProxy(HLERequestContext& ctx);
34 void OpenLibraryAppletProxyOld(Kernel::HLERequestContext& ctx); 34 void OpenLibraryAppletProxyOld(HLERequestContext& ctx);
35 35
36 NVFlinger::NVFlinger& nvflinger; 36 Nvnflinger::Nvnflinger& nvnflinger;
37 std::shared_ptr<AppletMessageQueue> msg_queue; 37 std::shared_ptr<AppletMessageQueue> msg_queue;
38}; 38};
39 39
diff --git a/src/core/hle/service/am/applet_oe.cpp b/src/core/hle/service/am/applet_oe.cpp
index 00fc4202c..d6c565d85 100644
--- a/src/core/hle/service/am/applet_oe.cpp
+++ b/src/core/hle/service/am/applet_oe.cpp
@@ -2,20 +2,20 @@
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "common/logging/log.h" 4#include "common/logging/log.h"
5#include "core/hle/ipc_helpers.h"
6#include "core/hle/service/am/am.h" 5#include "core/hle/service/am/am.h"
7#include "core/hle/service/am/applet_oe.h" 6#include "core/hle/service/am/applet_oe.h"
8#include "core/hle/service/nvflinger/nvflinger.h" 7#include "core/hle/service/ipc_helpers.h"
8#include "core/hle/service/nvnflinger/nvnflinger.h"
9 9
10namespace Service::AM { 10namespace Service::AM {
11 11
12class IApplicationProxy final : public ServiceFramework<IApplicationProxy> { 12class IApplicationProxy final : public ServiceFramework<IApplicationProxy> {
13public: 13public:
14 explicit IApplicationProxy(NVFlinger::NVFlinger& nvflinger_, 14 explicit IApplicationProxy(Nvnflinger::Nvnflinger& nvnflinger_,
15 std::shared_ptr<AppletMessageQueue> msg_queue_, 15 std::shared_ptr<AppletMessageQueue> msg_queue_,
16 Core::System& system_) 16 Core::System& system_)
17 : ServiceFramework{system_, "IApplicationProxy"}, nvflinger{nvflinger_}, 17 : ServiceFramework{system_, "IApplicationProxy"},
18 msg_queue{std::move(msg_queue_)} { 18 nvnflinger{nvnflinger_}, msg_queue{std::move(msg_queue_)} {
19 // clang-format off 19 // clang-format off
20 static const FunctionInfo functions[] = { 20 static const FunctionInfo functions[] = {
21 {0, &IApplicationProxy::GetCommonStateGetter, "GetCommonStateGetter"}, 21 {0, &IApplicationProxy::GetCommonStateGetter, "GetCommonStateGetter"},
@@ -34,7 +34,7 @@ public:
34 } 34 }
35 35
36private: 36private:
37 void GetAudioController(Kernel::HLERequestContext& ctx) { 37 void GetAudioController(HLERequestContext& ctx) {
38 LOG_DEBUG(Service_AM, "called"); 38 LOG_DEBUG(Service_AM, "called");
39 39
40 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 40 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -42,7 +42,7 @@ private:
42 rb.PushIpcInterface<IAudioController>(system); 42 rb.PushIpcInterface<IAudioController>(system);
43 } 43 }
44 44
45 void GetDisplayController(Kernel::HLERequestContext& ctx) { 45 void GetDisplayController(HLERequestContext& ctx) {
46 LOG_DEBUG(Service_AM, "called"); 46 LOG_DEBUG(Service_AM, "called");
47 47
48 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 48 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -50,7 +50,7 @@ private:
50 rb.PushIpcInterface<IDisplayController>(system); 50 rb.PushIpcInterface<IDisplayController>(system);
51 } 51 }
52 52
53 void GetDebugFunctions(Kernel::HLERequestContext& ctx) { 53 void GetDebugFunctions(HLERequestContext& ctx) {
54 LOG_DEBUG(Service_AM, "called"); 54 LOG_DEBUG(Service_AM, "called");
55 55
56 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 56 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -58,7 +58,7 @@ private:
58 rb.PushIpcInterface<IDebugFunctions>(system); 58 rb.PushIpcInterface<IDebugFunctions>(system);
59 } 59 }
60 60
61 void GetWindowController(Kernel::HLERequestContext& ctx) { 61 void GetWindowController(HLERequestContext& ctx) {
62 LOG_DEBUG(Service_AM, "called"); 62 LOG_DEBUG(Service_AM, "called");
63 63
64 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 64 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -66,15 +66,15 @@ private:
66 rb.PushIpcInterface<IWindowController>(system); 66 rb.PushIpcInterface<IWindowController>(system);
67 } 67 }
68 68
69 void GetSelfController(Kernel::HLERequestContext& ctx) { 69 void GetSelfController(HLERequestContext& ctx) {
70 LOG_DEBUG(Service_AM, "called"); 70 LOG_DEBUG(Service_AM, "called");
71 71
72 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 72 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
73 rb.Push(ResultSuccess); 73 rb.Push(ResultSuccess);
74 rb.PushIpcInterface<ISelfController>(system, nvflinger); 74 rb.PushIpcInterface<ISelfController>(system, nvnflinger);
75 } 75 }
76 76
77 void GetCommonStateGetter(Kernel::HLERequestContext& ctx) { 77 void GetCommonStateGetter(HLERequestContext& ctx) {
78 LOG_DEBUG(Service_AM, "called"); 78 LOG_DEBUG(Service_AM, "called");
79 79
80 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 80 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -82,7 +82,7 @@ private:
82 rb.PushIpcInterface<ICommonStateGetter>(system, msg_queue); 82 rb.PushIpcInterface<ICommonStateGetter>(system, msg_queue);
83 } 83 }
84 84
85 void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) { 85 void GetLibraryAppletCreator(HLERequestContext& ctx) {
86 LOG_DEBUG(Service_AM, "called"); 86 LOG_DEBUG(Service_AM, "called");
87 87
88 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 88 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -90,7 +90,7 @@ private:
90 rb.PushIpcInterface<ILibraryAppletCreator>(system); 90 rb.PushIpcInterface<ILibraryAppletCreator>(system);
91 } 91 }
92 92
93 void GetApplicationFunctions(Kernel::HLERequestContext& ctx) { 93 void GetApplicationFunctions(HLERequestContext& ctx) {
94 LOG_DEBUG(Service_AM, "called"); 94 LOG_DEBUG(Service_AM, "called");
95 95
96 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 96 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -98,22 +98,22 @@ private:
98 rb.PushIpcInterface<IApplicationFunctions>(system); 98 rb.PushIpcInterface<IApplicationFunctions>(system);
99 } 99 }
100 100
101 NVFlinger::NVFlinger& nvflinger; 101 Nvnflinger::Nvnflinger& nvnflinger;
102 std::shared_ptr<AppletMessageQueue> msg_queue; 102 std::shared_ptr<AppletMessageQueue> msg_queue;
103}; 103};
104 104
105void AppletOE::OpenApplicationProxy(Kernel::HLERequestContext& ctx) { 105void AppletOE::OpenApplicationProxy(HLERequestContext& ctx) {
106 LOG_DEBUG(Service_AM, "called"); 106 LOG_DEBUG(Service_AM, "called");
107 107
108 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 108 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
109 rb.Push(ResultSuccess); 109 rb.Push(ResultSuccess);
110 rb.PushIpcInterface<IApplicationProxy>(nvflinger, msg_queue, system); 110 rb.PushIpcInterface<IApplicationProxy>(nvnflinger, msg_queue, system);
111} 111}
112 112
113AppletOE::AppletOE(NVFlinger::NVFlinger& nvflinger_, std::shared_ptr<AppletMessageQueue> msg_queue_, 113AppletOE::AppletOE(Nvnflinger::Nvnflinger& nvnflinger_,
114 Core::System& system_) 114 std::shared_ptr<AppletMessageQueue> msg_queue_, Core::System& system_)
115 : ServiceFramework{system_, "appletOE"}, nvflinger{nvflinger_}, msg_queue{ 115 : ServiceFramework{system_, "appletOE"}, nvnflinger{nvnflinger_}, msg_queue{
116 std::move(msg_queue_)} { 116 std::move(msg_queue_)} {
117 static const FunctionInfo functions[] = { 117 static const FunctionInfo functions[] = {
118 {0, &AppletOE::OpenApplicationProxy, "OpenApplicationProxy"}, 118 {0, &AppletOE::OpenApplicationProxy, "OpenApplicationProxy"},
119 }; 119 };
diff --git a/src/core/hle/service/am/applet_oe.h b/src/core/hle/service/am/applet_oe.h
index 8fea249f1..39eccc4ab 100644
--- a/src/core/hle/service/am/applet_oe.h
+++ b/src/core/hle/service/am/applet_oe.h
@@ -12,8 +12,8 @@ namespace FileSystem {
12class FileSystemController; 12class FileSystemController;
13} 13}
14 14
15namespace NVFlinger { 15namespace Nvnflinger {
16class NVFlinger; 16class Nvnflinger;
17} 17}
18 18
19namespace AM { 19namespace AM {
@@ -22,16 +22,16 @@ class AppletMessageQueue;
22 22
23class AppletOE final : public ServiceFramework<AppletOE> { 23class AppletOE final : public ServiceFramework<AppletOE> {
24public: 24public:
25 explicit AppletOE(NVFlinger::NVFlinger& nvflinger_, 25 explicit AppletOE(Nvnflinger::Nvnflinger& nvnflinger_,
26 std::shared_ptr<AppletMessageQueue> msg_queue_, Core::System& system_); 26 std::shared_ptr<AppletMessageQueue> msg_queue_, Core::System& system_);
27 ~AppletOE() override; 27 ~AppletOE() override;
28 28
29 const std::shared_ptr<AppletMessageQueue>& GetMessageQueue() const; 29 const std::shared_ptr<AppletMessageQueue>& GetMessageQueue() const;
30 30
31private: 31private:
32 void OpenApplicationProxy(Kernel::HLERequestContext& ctx); 32 void OpenApplicationProxy(HLERequestContext& ctx);
33 33
34 NVFlinger::NVFlinger& nvflinger; 34 Nvnflinger::Nvnflinger& nvnflinger;
35 std::shared_ptr<AppletMessageQueue> msg_queue; 35 std::shared_ptr<AppletMessageQueue> msg_queue;
36}; 36};
37 37
diff --git a/src/core/hle/service/aoc/aoc_u.cpp b/src/core/hle/service/aoc/aoc_u.cpp
index fed51cfd6..38c2138e8 100644
--- a/src/core/hle/service/aoc/aoc_u.cpp
+++ b/src/core/hle/service/aoc/aoc_u.cpp
@@ -14,9 +14,9 @@
14#include "core/file_sys/nca_metadata.h" 14#include "core/file_sys/nca_metadata.h"
15#include "core/file_sys/patch_manager.h" 15#include "core/file_sys/patch_manager.h"
16#include "core/file_sys/registered_cache.h" 16#include "core/file_sys/registered_cache.h"
17#include "core/hle/ipc_helpers.h"
18#include "core/hle/kernel/k_event.h" 17#include "core/hle/kernel/k_event.h"
19#include "core/hle/service/aoc/aoc_u.h" 18#include "core/hle/service/aoc/aoc_u.h"
19#include "core/hle/service/ipc_helpers.h"
20#include "core/hle/service/server_manager.h" 20#include "core/hle/service/server_manager.h"
21#include "core/loader/loader.h" 21#include "core/loader/loader.h"
22 22
@@ -69,7 +69,7 @@ public:
69 } 69 }
70 70
71private: 71private:
72 void SetDefaultDeliveryTarget(Kernel::HLERequestContext& ctx) { 72 void SetDefaultDeliveryTarget(HLERequestContext& ctx) {
73 IPC::RequestParser rp{ctx}; 73 IPC::RequestParser rp{ctx};
74 74
75 const auto unknown_1 = rp.Pop<u64>(); 75 const auto unknown_1 = rp.Pop<u64>();
@@ -81,7 +81,7 @@ private:
81 rb.Push(ResultSuccess); 81 rb.Push(ResultSuccess);
82 } 82 }
83 83
84 void SetDeliveryTarget(Kernel::HLERequestContext& ctx) { 84 void SetDeliveryTarget(HLERequestContext& ctx) {
85 IPC::RequestParser rp{ctx}; 85 IPC::RequestParser rp{ctx};
86 86
87 const auto unknown_1 = rp.Pop<u64>(); 87 const auto unknown_1 = rp.Pop<u64>();
@@ -93,7 +93,7 @@ private:
93 rb.Push(ResultSuccess); 93 rb.Push(ResultSuccess);
94 } 94 }
95 95
96 void GetPurchasedEventReadableHandle(Kernel::HLERequestContext& ctx) { 96 void GetPurchasedEventReadableHandle(HLERequestContext& ctx) {
97 LOG_WARNING(Service_AOC, "called"); 97 LOG_WARNING(Service_AOC, "called");
98 98
99 IPC::ResponseBuilder rb{ctx, 2, 1}; 99 IPC::ResponseBuilder rb{ctx, 2, 1};
@@ -145,7 +145,7 @@ AOC_U::~AOC_U() {
145 service_context.CloseEvent(aoc_change_event); 145 service_context.CloseEvent(aoc_change_event);
146} 146}
147 147
148void AOC_U::CountAddOnContent(Kernel::HLERequestContext& ctx) { 148void AOC_U::CountAddOnContent(HLERequestContext& ctx) {
149 struct Parameters { 149 struct Parameters {
150 u64 process_id; 150 u64 process_id;
151 }; 151 };
@@ -172,7 +172,7 @@ void AOC_U::CountAddOnContent(Kernel::HLERequestContext& ctx) {
172 [current](u64 tid) { return CheckAOCTitleIDMatchesBase(tid, current); }))); 172 [current](u64 tid) { return CheckAOCTitleIDMatchesBase(tid, current); })));
173} 173}
174 174
175void AOC_U::ListAddOnContent(Kernel::HLERequestContext& ctx) { 175void AOC_U::ListAddOnContent(HLERequestContext& ctx) {
176 struct Parameters { 176 struct Parameters {
177 u32 offset; 177 u32 offset;
178 u32 count; 178 u32 count;
@@ -218,7 +218,7 @@ void AOC_U::ListAddOnContent(Kernel::HLERequestContext& ctx) {
218 rb.Push(out_count); 218 rb.Push(out_count);
219} 219}
220 220
221void AOC_U::GetAddOnContentBaseId(Kernel::HLERequestContext& ctx) { 221void AOC_U::GetAddOnContentBaseId(HLERequestContext& ctx) {
222 struct Parameters { 222 struct Parameters {
223 u64 process_id; 223 u64 process_id;
224 }; 224 };
@@ -245,7 +245,7 @@ void AOC_U::GetAddOnContentBaseId(Kernel::HLERequestContext& ctx) {
245 rb.Push(res.first->GetDLCBaseTitleId()); 245 rb.Push(res.first->GetDLCBaseTitleId());
246} 246}
247 247
248void AOC_U::PrepareAddOnContent(Kernel::HLERequestContext& ctx) { 248void AOC_U::PrepareAddOnContent(HLERequestContext& ctx) {
249 struct Parameters { 249 struct Parameters {
250 s32 addon_index; 250 s32 addon_index;
251 u64 process_id; 251 u64 process_id;
@@ -262,7 +262,7 @@ void AOC_U::PrepareAddOnContent(Kernel::HLERequestContext& ctx) {
262 rb.Push(ResultSuccess); 262 rb.Push(ResultSuccess);
263} 263}
264 264
265void AOC_U::GetAddOnContentListChangedEvent(Kernel::HLERequestContext& ctx) { 265void AOC_U::GetAddOnContentListChangedEvent(HLERequestContext& ctx) {
266 LOG_WARNING(Service_AOC, "(STUBBED) called"); 266 LOG_WARNING(Service_AOC, "(STUBBED) called");
267 267
268 IPC::ResponseBuilder rb{ctx, 2, 1}; 268 IPC::ResponseBuilder rb{ctx, 2, 1};
@@ -270,7 +270,7 @@ void AOC_U::GetAddOnContentListChangedEvent(Kernel::HLERequestContext& ctx) {
270 rb.PushCopyObjects(aoc_change_event->GetReadableEvent()); 270 rb.PushCopyObjects(aoc_change_event->GetReadableEvent());
271} 271}
272 272
273void AOC_U::GetAddOnContentListChangedEventWithProcessId(Kernel::HLERequestContext& ctx) { 273void AOC_U::GetAddOnContentListChangedEventWithProcessId(HLERequestContext& ctx) {
274 LOG_WARNING(Service_AOC, "(STUBBED) called"); 274 LOG_WARNING(Service_AOC, "(STUBBED) called");
275 275
276 IPC::ResponseBuilder rb{ctx, 2, 1}; 276 IPC::ResponseBuilder rb{ctx, 2, 1};
@@ -278,28 +278,28 @@ void AOC_U::GetAddOnContentListChangedEventWithProcessId(Kernel::HLERequestConte
278 rb.PushCopyObjects(aoc_change_event->GetReadableEvent()); 278 rb.PushCopyObjects(aoc_change_event->GetReadableEvent());
279} 279}
280 280
281void AOC_U::NotifyMountAddOnContent(Kernel::HLERequestContext& ctx) { 281void AOC_U::NotifyMountAddOnContent(HLERequestContext& ctx) {
282 LOG_WARNING(Service_AOC, "(STUBBED) called"); 282 LOG_WARNING(Service_AOC, "(STUBBED) called");
283 283
284 IPC::ResponseBuilder rb{ctx, 2}; 284 IPC::ResponseBuilder rb{ctx, 2};
285 rb.Push(ResultSuccess); 285 rb.Push(ResultSuccess);
286} 286}
287 287
288void AOC_U::NotifyUnmountAddOnContent(Kernel::HLERequestContext& ctx) { 288void AOC_U::NotifyUnmountAddOnContent(HLERequestContext& ctx) {
289 LOG_WARNING(Service_AOC, "(STUBBED) called"); 289 LOG_WARNING(Service_AOC, "(STUBBED) called");
290 290
291 IPC::ResponseBuilder rb{ctx, 2}; 291 IPC::ResponseBuilder rb{ctx, 2};
292 rb.Push(ResultSuccess); 292 rb.Push(ResultSuccess);
293} 293}
294 294
295void AOC_U::CheckAddOnContentMountStatus(Kernel::HLERequestContext& ctx) { 295void AOC_U::CheckAddOnContentMountStatus(HLERequestContext& ctx) {
296 LOG_WARNING(Service_AOC, "(STUBBED) called"); 296 LOG_WARNING(Service_AOC, "(STUBBED) called");
297 297
298 IPC::ResponseBuilder rb{ctx, 2}; 298 IPC::ResponseBuilder rb{ctx, 2};
299 rb.Push(ResultSuccess); 299 rb.Push(ResultSuccess);
300} 300}
301 301
302void AOC_U::CreateEcPurchasedEventManager(Kernel::HLERequestContext& ctx) { 302void AOC_U::CreateEcPurchasedEventManager(HLERequestContext& ctx) {
303 LOG_WARNING(Service_AOC, "(STUBBED) called"); 303 LOG_WARNING(Service_AOC, "(STUBBED) called");
304 304
305 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 305 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -307,7 +307,7 @@ void AOC_U::CreateEcPurchasedEventManager(Kernel::HLERequestContext& ctx) {
307 rb.PushIpcInterface<IPurchaseEventManager>(system); 307 rb.PushIpcInterface<IPurchaseEventManager>(system);
308} 308}
309 309
310void AOC_U::CreatePermanentEcPurchasedEventManager(Kernel::HLERequestContext& ctx) { 310void AOC_U::CreatePermanentEcPurchasedEventManager(HLERequestContext& ctx) {
311 LOG_WARNING(Service_AOC, "(STUBBED) called"); 311 LOG_WARNING(Service_AOC, "(STUBBED) called");
312 312
313 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 313 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
diff --git a/src/core/hle/service/aoc/aoc_u.h b/src/core/hle/service/aoc/aoc_u.h
index 5e7087e50..12ccfeb6a 100644
--- a/src/core/hle/service/aoc/aoc_u.h
+++ b/src/core/hle/service/aoc/aoc_u.h
@@ -22,17 +22,17 @@ public:
22 ~AOC_U() override; 22 ~AOC_U() override;
23 23
24private: 24private:
25 void CountAddOnContent(Kernel::HLERequestContext& ctx); 25 void CountAddOnContent(HLERequestContext& ctx);
26 void ListAddOnContent(Kernel::HLERequestContext& ctx); 26 void ListAddOnContent(HLERequestContext& ctx);
27 void GetAddOnContentBaseId(Kernel::HLERequestContext& ctx); 27 void GetAddOnContentBaseId(HLERequestContext& ctx);
28 void PrepareAddOnContent(Kernel::HLERequestContext& ctx); 28 void PrepareAddOnContent(HLERequestContext& ctx);
29 void GetAddOnContentListChangedEvent(Kernel::HLERequestContext& ctx); 29 void GetAddOnContentListChangedEvent(HLERequestContext& ctx);
30 void GetAddOnContentListChangedEventWithProcessId(Kernel::HLERequestContext& ctx); 30 void GetAddOnContentListChangedEventWithProcessId(HLERequestContext& ctx);
31 void NotifyMountAddOnContent(Kernel::HLERequestContext& ctx); 31 void NotifyMountAddOnContent(HLERequestContext& ctx);
32 void NotifyUnmountAddOnContent(Kernel::HLERequestContext& ctx); 32 void NotifyUnmountAddOnContent(HLERequestContext& ctx);
33 void CheckAddOnContentMountStatus(Kernel::HLERequestContext& ctx); 33 void CheckAddOnContentMountStatus(HLERequestContext& ctx);
34 void CreateEcPurchasedEventManager(Kernel::HLERequestContext& ctx); 34 void CreateEcPurchasedEventManager(HLERequestContext& ctx);
35 void CreatePermanentEcPurchasedEventManager(Kernel::HLERequestContext& ctx); 35 void CreatePermanentEcPurchasedEventManager(HLERequestContext& ctx);
36 36
37 std::vector<u64> add_on_content; 37 std::vector<u64> add_on_content;
38 KernelHelpers::ServiceContext service_context; 38 KernelHelpers::ServiceContext service_context;
diff --git a/src/core/hle/service/apm/apm_interface.cpp b/src/core/hle/service/apm/apm_interface.cpp
index 041fc16bd..d29051ee7 100644
--- a/src/core/hle/service/apm/apm_interface.cpp
+++ b/src/core/hle/service/apm/apm_interface.cpp
@@ -2,10 +2,10 @@
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "common/logging/log.h" 4#include "common/logging/log.h"
5#include "core/hle/ipc_helpers.h"
6#include "core/hle/service/apm/apm.h" 5#include "core/hle/service/apm/apm.h"
7#include "core/hle/service/apm/apm_controller.h" 6#include "core/hle/service/apm/apm_controller.h"
8#include "core/hle/service/apm/apm_interface.h" 7#include "core/hle/service/apm/apm_interface.h"
8#include "core/hle/service/ipc_helpers.h"
9 9
10namespace Service::APM { 10namespace Service::APM {
11 11
@@ -22,7 +22,7 @@ public:
22 } 22 }
23 23
24private: 24private:
25 void SetPerformanceConfiguration(Kernel::HLERequestContext& ctx) { 25 void SetPerformanceConfiguration(HLERequestContext& ctx) {
26 IPC::RequestParser rp{ctx}; 26 IPC::RequestParser rp{ctx};
27 27
28 const auto mode = rp.PopEnum<PerformanceMode>(); 28 const auto mode = rp.PopEnum<PerformanceMode>();
@@ -35,7 +35,7 @@ private:
35 rb.Push(ResultSuccess); 35 rb.Push(ResultSuccess);
36 } 36 }
37 37
38 void GetPerformanceConfiguration(Kernel::HLERequestContext& ctx) { 38 void GetPerformanceConfiguration(HLERequestContext& ctx) {
39 IPC::RequestParser rp{ctx}; 39 IPC::RequestParser rp{ctx};
40 40
41 const auto mode = rp.PopEnum<PerformanceMode>(); 41 const auto mode = rp.PopEnum<PerformanceMode>();
@@ -46,7 +46,7 @@ private:
46 rb.PushEnum(controller.GetCurrentPerformanceConfiguration(mode)); 46 rb.PushEnum(controller.GetCurrentPerformanceConfiguration(mode));
47 } 47 }
48 48
49 void SetCpuOverclockEnabled(Kernel::HLERequestContext& ctx) { 49 void SetCpuOverclockEnabled(HLERequestContext& ctx) {
50 IPC::RequestParser rp{ctx}; 50 IPC::RequestParser rp{ctx};
51 51
52 const auto cpu_overclock_enabled = rp.Pop<bool>(); 52 const auto cpu_overclock_enabled = rp.Pop<bool>();
@@ -74,7 +74,7 @@ APM::APM(Core::System& system_, std::shared_ptr<Module> apm_, Controller& contro
74 74
75APM::~APM() = default; 75APM::~APM() = default;
76 76
77void APM::OpenSession(Kernel::HLERequestContext& ctx) { 77void APM::OpenSession(HLERequestContext& ctx) {
78 LOG_DEBUG(Service_APM, "called"); 78 LOG_DEBUG(Service_APM, "called");
79 79
80 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 80 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -82,14 +82,14 @@ void APM::OpenSession(Kernel::HLERequestContext& ctx) {
82 rb.PushIpcInterface<ISession>(system, controller); 82 rb.PushIpcInterface<ISession>(system, controller);
83} 83}
84 84
85void APM::GetPerformanceMode(Kernel::HLERequestContext& ctx) { 85void APM::GetPerformanceMode(HLERequestContext& ctx) {
86 LOG_DEBUG(Service_APM, "called"); 86 LOG_DEBUG(Service_APM, "called");
87 87
88 IPC::ResponseBuilder rb{ctx, 2}; 88 IPC::ResponseBuilder rb{ctx, 2};
89 rb.PushEnum(controller.GetCurrentPerformanceMode()); 89 rb.PushEnum(controller.GetCurrentPerformanceMode());
90} 90}
91 91
92void APM::IsCpuOverclockEnabled(Kernel::HLERequestContext& ctx) { 92void APM::IsCpuOverclockEnabled(HLERequestContext& ctx) {
93 LOG_WARNING(Service_APM, "(STUBBED) called"); 93 LOG_WARNING(Service_APM, "(STUBBED) called");
94 94
95 IPC::ResponseBuilder rb{ctx, 3}; 95 IPC::ResponseBuilder rb{ctx, 3};
@@ -117,7 +117,7 @@ APM_Sys::APM_Sys(Core::System& system_, Controller& controller_)
117 117
118APM_Sys::~APM_Sys() = default; 118APM_Sys::~APM_Sys() = default;
119 119
120void APM_Sys::GetPerformanceEvent(Kernel::HLERequestContext& ctx) { 120void APM_Sys::GetPerformanceEvent(HLERequestContext& ctx) {
121 LOG_DEBUG(Service_APM, "called"); 121 LOG_DEBUG(Service_APM, "called");
122 122
123 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 123 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -125,7 +125,7 @@ void APM_Sys::GetPerformanceEvent(Kernel::HLERequestContext& ctx) {
125 rb.PushIpcInterface<ISession>(system, controller); 125 rb.PushIpcInterface<ISession>(system, controller);
126} 126}
127 127
128void APM_Sys::SetCpuBoostMode(Kernel::HLERequestContext& ctx) { 128void APM_Sys::SetCpuBoostMode(HLERequestContext& ctx) {
129 IPC::RequestParser rp{ctx}; 129 IPC::RequestParser rp{ctx};
130 const auto mode = rp.PopEnum<CpuBoostMode>(); 130 const auto mode = rp.PopEnum<CpuBoostMode>();
131 131
@@ -137,7 +137,7 @@ void APM_Sys::SetCpuBoostMode(Kernel::HLERequestContext& ctx) {
137 rb.Push(ResultSuccess); 137 rb.Push(ResultSuccess);
138} 138}
139 139
140void APM_Sys::GetCurrentPerformanceConfiguration(Kernel::HLERequestContext& ctx) { 140void APM_Sys::GetCurrentPerformanceConfiguration(HLERequestContext& ctx) {
141 LOG_DEBUG(Service_APM, "called"); 141 LOG_DEBUG(Service_APM, "called");
142 142
143 IPC::ResponseBuilder rb{ctx, 3}; 143 IPC::ResponseBuilder rb{ctx, 3};
diff --git a/src/core/hle/service/apm/apm_interface.h b/src/core/hle/service/apm/apm_interface.h
index 0740fd4ba..58718453b 100644
--- a/src/core/hle/service/apm/apm_interface.h
+++ b/src/core/hle/service/apm/apm_interface.h
@@ -17,9 +17,9 @@ public:
17 ~APM() override; 17 ~APM() override;
18 18
19private: 19private:
20 void OpenSession(Kernel::HLERequestContext& ctx); 20 void OpenSession(HLERequestContext& ctx);
21 void GetPerformanceMode(Kernel::HLERequestContext& ctx); 21 void GetPerformanceMode(HLERequestContext& ctx);
22 void IsCpuOverclockEnabled(Kernel::HLERequestContext& ctx); 22 void IsCpuOverclockEnabled(HLERequestContext& ctx);
23 23
24 std::shared_ptr<Module> apm; 24 std::shared_ptr<Module> apm;
25 Controller& controller; 25 Controller& controller;
@@ -30,11 +30,11 @@ public:
30 explicit APM_Sys(Core::System& system_, Controller& controller); 30 explicit APM_Sys(Core::System& system_, Controller& controller);
31 ~APM_Sys() override; 31 ~APM_Sys() override;
32 32
33 void SetCpuBoostMode(Kernel::HLERequestContext& ctx); 33 void SetCpuBoostMode(HLERequestContext& ctx);
34 34
35private: 35private:
36 void GetPerformanceEvent(Kernel::HLERequestContext& ctx); 36 void GetPerformanceEvent(HLERequestContext& ctx);
37 void GetCurrentPerformanceConfiguration(Kernel::HLERequestContext& ctx); 37 void GetCurrentPerformanceConfiguration(HLERequestContext& ctx);
38 38
39 Controller& controller; 39 Controller& controller;
40}; 40};
diff --git a/src/core/hle/service/audio/audctl.cpp b/src/core/hle/service/audio/audctl.cpp
index 5abf22ba4..7ad93be6b 100644
--- a/src/core/hle/service/audio/audctl.cpp
+++ b/src/core/hle/service/audio/audctl.cpp
@@ -2,8 +2,8 @@
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "common/logging/log.h" 4#include "common/logging/log.h"
5#include "core/hle/ipc_helpers.h"
6#include "core/hle/service/audio/audctl.h" 5#include "core/hle/service/audio/audctl.h"
6#include "core/hle/service/ipc_helpers.h"
7 7
8namespace Service::Audio { 8namespace Service::Audio {
9 9
@@ -72,7 +72,7 @@ AudCtl::AudCtl(Core::System& system_) : ServiceFramework{system_, "audctl"} {
72 72
73AudCtl::~AudCtl() = default; 73AudCtl::~AudCtl() = default;
74 74
75void AudCtl::GetTargetVolumeMin(Kernel::HLERequestContext& ctx) { 75void AudCtl::GetTargetVolumeMin(HLERequestContext& ctx) {
76 LOG_DEBUG(Audio, "called."); 76 LOG_DEBUG(Audio, "called.");
77 77
78 // This service function is currently hardcoded on the 78 // This service function is currently hardcoded on the
@@ -84,7 +84,7 @@ void AudCtl::GetTargetVolumeMin(Kernel::HLERequestContext& ctx) {
84 rb.Push(target_min_volume); 84 rb.Push(target_min_volume);
85} 85}
86 86
87void AudCtl::GetTargetVolumeMax(Kernel::HLERequestContext& ctx) { 87void AudCtl::GetTargetVolumeMax(HLERequestContext& ctx) {
88 LOG_DEBUG(Audio, "called."); 88 LOG_DEBUG(Audio, "called.");
89 89
90 // This service function is currently hardcoded on the 90 // This service function is currently hardcoded on the
diff --git a/src/core/hle/service/audio/audctl.h b/src/core/hle/service/audio/audctl.h
index a27ff6cfe..8e31ac237 100644
--- a/src/core/hle/service/audio/audctl.h
+++ b/src/core/hle/service/audio/audctl.h
@@ -17,8 +17,8 @@ public:
17 ~AudCtl() override; 17 ~AudCtl() override;
18 18
19private: 19private:
20 void GetTargetVolumeMin(Kernel::HLERequestContext& ctx); 20 void GetTargetVolumeMin(HLERequestContext& ctx);
21 void GetTargetVolumeMax(Kernel::HLERequestContext& ctx); 21 void GetTargetVolumeMax(HLERequestContext& ctx);
22}; 22};
23 23
24} // namespace Service::Audio 24} // namespace Service::Audio
diff --git a/src/core/hle/service/audio/audin_u.cpp b/src/core/hle/service/audio/audin_u.cpp
index 26dec7147..f0640c64f 100644
--- a/src/core/hle/service/audio/audin_u.cpp
+++ b/src/core/hle/service/audio/audin_u.cpp
@@ -7,9 +7,9 @@
7#include "common/logging/log.h" 7#include "common/logging/log.h"
8#include "common/string_util.h" 8#include "common/string_util.h"
9#include "core/core.h" 9#include "core/core.h"
10#include "core/hle/ipc_helpers.h"
11#include "core/hle/kernel/k_event.h" 10#include "core/hle/kernel/k_event.h"
12#include "core/hle/service/audio/audin_u.h" 11#include "core/hle/service/audio/audin_u.h"
12#include "core/hle/service/ipc_helpers.h"
13 13
14namespace Service::Audio { 14namespace Service::Audio {
15using namespace AudioCore::AudioIn; 15using namespace AudioCore::AudioIn;
@@ -61,7 +61,7 @@ public:
61 } 61 }
62 62
63private: 63private:
64 void GetAudioInState(Kernel::HLERequestContext& ctx) { 64 void GetAudioInState(HLERequestContext& ctx) {
65 const auto state = static_cast<u32>(impl->GetState()); 65 const auto state = static_cast<u32>(impl->GetState());
66 66
67 LOG_DEBUG(Service_Audio, "called. State={}", state); 67 LOG_DEBUG(Service_Audio, "called. State={}", state);
@@ -71,7 +71,7 @@ private:
71 rb.Push(state); 71 rb.Push(state);
72 } 72 }
73 73
74 void Start(Kernel::HLERequestContext& ctx) { 74 void Start(HLERequestContext& ctx) {
75 LOG_DEBUG(Service_Audio, "called"); 75 LOG_DEBUG(Service_Audio, "called");
76 76
77 auto result = impl->StartSystem(); 77 auto result = impl->StartSystem();
@@ -80,7 +80,7 @@ private:
80 rb.Push(result); 80 rb.Push(result);
81 } 81 }
82 82
83 void Stop(Kernel::HLERequestContext& ctx) { 83 void Stop(HLERequestContext& ctx) {
84 LOG_DEBUG(Service_Audio, "called"); 84 LOG_DEBUG(Service_Audio, "called");
85 85
86 auto result = impl->StopSystem(); 86 auto result = impl->StopSystem();
@@ -89,7 +89,7 @@ private:
89 rb.Push(result); 89 rb.Push(result);
90 } 90 }
91 91
92 void AppendAudioInBuffer(Kernel::HLERequestContext& ctx) { 92 void AppendAudioInBuffer(HLERequestContext& ctx) {
93 IPC::RequestParser rp{ctx}; 93 IPC::RequestParser rp{ctx};
94 u64 tag = rp.PopRaw<u64>(); 94 u64 tag = rp.PopRaw<u64>();
95 95
@@ -111,7 +111,7 @@ private:
111 rb.Push(result); 111 rb.Push(result);
112 } 112 }
113 113
114 void RegisterBufferEvent(Kernel::HLERequestContext& ctx) { 114 void RegisterBufferEvent(HLERequestContext& ctx) {
115 LOG_DEBUG(Service_Audio, "called"); 115 LOG_DEBUG(Service_Audio, "called");
116 116
117 auto& buffer_event = impl->GetBufferEvent(); 117 auto& buffer_event = impl->GetBufferEvent();
@@ -121,7 +121,7 @@ private:
121 rb.PushCopyObjects(buffer_event); 121 rb.PushCopyObjects(buffer_event);
122 } 122 }
123 123
124 void GetReleasedAudioInBuffer(Kernel::HLERequestContext& ctx) { 124 void GetReleasedAudioInBuffer(HLERequestContext& ctx) {
125 const auto write_buffer_size = ctx.GetWriteBufferNumElements<u64>(); 125 const auto write_buffer_size = ctx.GetWriteBufferNumElements<u64>();
126 std::vector<u64> released_buffers(write_buffer_size); 126 std::vector<u64> released_buffers(write_buffer_size);
127 127
@@ -141,7 +141,7 @@ private:
141 rb.Push(count); 141 rb.Push(count);
142 } 142 }
143 143
144 void ContainsAudioInBuffer(Kernel::HLERequestContext& ctx) { 144 void ContainsAudioInBuffer(HLERequestContext& ctx) {
145 IPC::RequestParser rp{ctx}; 145 IPC::RequestParser rp{ctx};
146 146
147 const u64 tag{rp.Pop<u64>()}; 147 const u64 tag{rp.Pop<u64>()};
@@ -154,7 +154,7 @@ private:
154 rb.Push(buffer_queued); 154 rb.Push(buffer_queued);
155 } 155 }
156 156
157 void GetAudioInBufferCount(Kernel::HLERequestContext& ctx) { 157 void GetAudioInBufferCount(HLERequestContext& ctx) {
158 const auto buffer_count = impl->GetBufferCount(); 158 const auto buffer_count = impl->GetBufferCount();
159 159
160 LOG_DEBUG(Service_Audio, "called. Buffer count={}", buffer_count); 160 LOG_DEBUG(Service_Audio, "called. Buffer count={}", buffer_count);
@@ -165,7 +165,7 @@ private:
165 rb.Push(buffer_count); 165 rb.Push(buffer_count);
166 } 166 }
167 167
168 void SetDeviceGain(Kernel::HLERequestContext& ctx) { 168 void SetDeviceGain(HLERequestContext& ctx) {
169 IPC::RequestParser rp{ctx}; 169 IPC::RequestParser rp{ctx};
170 170
171 const auto volume{rp.Pop<f32>()}; 171 const auto volume{rp.Pop<f32>()};
@@ -177,7 +177,7 @@ private:
177 rb.Push(ResultSuccess); 177 rb.Push(ResultSuccess);
178 } 178 }
179 179
180 void GetDeviceGain(Kernel::HLERequestContext& ctx) { 180 void GetDeviceGain(HLERequestContext& ctx) {
181 auto volume{impl->GetVolume()}; 181 auto volume{impl->GetVolume()};
182 182
183 LOG_DEBUG(Service_Audio, "called. Gain {}", volume); 183 LOG_DEBUG(Service_Audio, "called. Gain {}", volume);
@@ -187,7 +187,7 @@ private:
187 rb.Push(volume); 187 rb.Push(volume);
188 } 188 }
189 189
190 void FlushAudioInBuffers(Kernel::HLERequestContext& ctx) { 190 void FlushAudioInBuffers(HLERequestContext& ctx) {
191 bool flushed{impl->FlushAudioInBuffers()}; 191 bool flushed{impl->FlushAudioInBuffers()};
192 192
193 LOG_DEBUG(Service_Audio, "called. Were any buffers flushed? {}", flushed); 193 LOG_DEBUG(Service_Audio, "called. Were any buffers flushed? {}", flushed);
@@ -221,7 +221,7 @@ AudInU::AudInU(Core::System& system_)
221 221
222AudInU::~AudInU() = default; 222AudInU::~AudInU() = default;
223 223
224void AudInU::ListAudioIns(Kernel::HLERequestContext& ctx) { 224void AudInU::ListAudioIns(HLERequestContext& ctx) {
225 using namespace AudioCore::AudioRenderer; 225 using namespace AudioCore::AudioRenderer;
226 226
227 LOG_DEBUG(Service_Audio, "called"); 227 LOG_DEBUG(Service_Audio, "called");
@@ -241,7 +241,7 @@ void AudInU::ListAudioIns(Kernel::HLERequestContext& ctx) {
241 rb.Push(out_count); 241 rb.Push(out_count);
242} 242}
243 243
244void AudInU::ListAudioInsAutoFiltered(Kernel::HLERequestContext& ctx) { 244void AudInU::ListAudioInsAutoFiltered(HLERequestContext& ctx) {
245 using namespace AudioCore::AudioRenderer; 245 using namespace AudioCore::AudioRenderer;
246 246
247 LOG_DEBUG(Service_Audio, "called"); 247 LOG_DEBUG(Service_Audio, "called");
@@ -261,7 +261,7 @@ void AudInU::ListAudioInsAutoFiltered(Kernel::HLERequestContext& ctx) {
261 rb.Push(out_count); 261 rb.Push(out_count);
262} 262}
263 263
264void AudInU::OpenAudioIn(Kernel::HLERequestContext& ctx) { 264void AudInU::OpenAudioIn(HLERequestContext& ctx) {
265 IPC::RequestParser rp{ctx}; 265 IPC::RequestParser rp{ctx};
266 auto in_params{rp.PopRaw<AudioInParameter>()}; 266 auto in_params{rp.PopRaw<AudioInParameter>()};
267 auto applet_resource_user_id{rp.PopRaw<u64>()}; 267 auto applet_resource_user_id{rp.PopRaw<u64>()};
@@ -311,7 +311,7 @@ void AudInU::OpenAudioIn(Kernel::HLERequestContext& ctx) {
311 rb.PushIpcInterface<IAudioIn>(audio_in); 311 rb.PushIpcInterface<IAudioIn>(audio_in);
312} 312}
313 313
314void AudInU::OpenAudioInProtocolSpecified(Kernel::HLERequestContext& ctx) { 314void AudInU::OpenAudioInProtocolSpecified(HLERequestContext& ctx) {
315 IPC::RequestParser rp{ctx}; 315 IPC::RequestParser rp{ctx};
316 auto protocol_specified{rp.PopRaw<u64>()}; 316 auto protocol_specified{rp.PopRaw<u64>()};
317 auto in_params{rp.PopRaw<AudioInParameter>()}; 317 auto in_params{rp.PopRaw<AudioInParameter>()};
diff --git a/src/core/hle/service/audio/audin_u.h b/src/core/hle/service/audio/audin_u.h
index b45fda78a..51e770ff9 100644
--- a/src/core/hle/service/audio/audin_u.h
+++ b/src/core/hle/service/audio/audin_u.h
@@ -12,10 +12,6 @@ namespace Core {
12class System; 12class System;
13} 13}
14 14
15namespace Kernel {
16class HLERequestContext;
17}
18
19namespace AudioCore::AudioOut { 15namespace AudioCore::AudioOut {
20class Manager; 16class Manager;
21class In; 17class In;
@@ -29,11 +25,11 @@ public:
29 ~AudInU() override; 25 ~AudInU() override;
30 26
31private: 27private:
32 void ListAudioIns(Kernel::HLERequestContext& ctx); 28 void ListAudioIns(HLERequestContext& ctx);
33 void ListAudioInsAutoFiltered(Kernel::HLERequestContext& ctx); 29 void ListAudioInsAutoFiltered(HLERequestContext& ctx);
34 void OpenInOutImpl(Kernel::HLERequestContext& ctx); 30 void OpenInOutImpl(HLERequestContext& ctx);
35 void OpenAudioIn(Kernel::HLERequestContext& ctx); 31 void OpenAudioIn(HLERequestContext& ctx);
36 void OpenAudioInProtocolSpecified(Kernel::HLERequestContext& ctx); 32 void OpenAudioInProtocolSpecified(HLERequestContext& ctx);
37 33
38 KernelHelpers::ServiceContext service_context; 34 KernelHelpers::ServiceContext service_context;
39 std::unique_ptr<AudioCore::AudioIn::Manager> impl; 35 std::unique_ptr<AudioCore::AudioIn::Manager> impl;
diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp
index 991e30ba1..23b8be993 100644
--- a/src/core/hle/service/audio/audout_u.cpp
+++ b/src/core/hle/service/audio/audout_u.cpp
@@ -12,10 +12,10 @@
12#include "common/string_util.h" 12#include "common/string_util.h"
13#include "common/swap.h" 13#include "common/swap.h"
14#include "core/core.h" 14#include "core/core.h"
15#include "core/hle/ipc_helpers.h"
16#include "core/hle/kernel/k_event.h" 15#include "core/hle/kernel/k_event.h"
17#include "core/hle/service/audio/audout_u.h" 16#include "core/hle/service/audio/audout_u.h"
18#include "core/hle/service/audio/errors.h" 17#include "core/hle/service/audio/errors.h"
18#include "core/hle/service/ipc_helpers.h"
19#include "core/memory.h" 19#include "core/memory.h"
20 20
21namespace Service::Audio { 21namespace Service::Audio {
@@ -67,7 +67,7 @@ public:
67 } 67 }
68 68
69private: 69private:
70 void GetAudioOutState(Kernel::HLERequestContext& ctx) { 70 void GetAudioOutState(HLERequestContext& ctx) {
71 const auto state = static_cast<u32>(impl->GetState()); 71 const auto state = static_cast<u32>(impl->GetState());
72 72
73 LOG_DEBUG(Service_Audio, "called. State={}", state); 73 LOG_DEBUG(Service_Audio, "called. State={}", state);
@@ -77,7 +77,7 @@ private:
77 rb.Push(state); 77 rb.Push(state);
78 } 78 }
79 79
80 void Start(Kernel::HLERequestContext& ctx) { 80 void Start(HLERequestContext& ctx) {
81 LOG_DEBUG(Service_Audio, "called"); 81 LOG_DEBUG(Service_Audio, "called");
82 82
83 auto result = impl->StartSystem(); 83 auto result = impl->StartSystem();
@@ -86,7 +86,7 @@ private:
86 rb.Push(result); 86 rb.Push(result);
87 } 87 }
88 88
89 void Stop(Kernel::HLERequestContext& ctx) { 89 void Stop(HLERequestContext& ctx) {
90 LOG_DEBUG(Service_Audio, "called"); 90 LOG_DEBUG(Service_Audio, "called");
91 91
92 auto result = impl->StopSystem(); 92 auto result = impl->StopSystem();
@@ -95,7 +95,7 @@ private:
95 rb.Push(result); 95 rb.Push(result);
96 } 96 }
97 97
98 void AppendAudioOutBuffer(Kernel::HLERequestContext& ctx) { 98 void AppendAudioOutBuffer(HLERequestContext& ctx) {
99 IPC::RequestParser rp{ctx}; 99 IPC::RequestParser rp{ctx};
100 u64 tag = rp.PopRaw<u64>(); 100 u64 tag = rp.PopRaw<u64>();
101 101
@@ -117,7 +117,7 @@ private:
117 rb.Push(result); 117 rb.Push(result);
118 } 118 }
119 119
120 void RegisterBufferEvent(Kernel::HLERequestContext& ctx) { 120 void RegisterBufferEvent(HLERequestContext& ctx) {
121 LOG_DEBUG(Service_Audio, "called"); 121 LOG_DEBUG(Service_Audio, "called");
122 122
123 auto& buffer_event = impl->GetBufferEvent(); 123 auto& buffer_event = impl->GetBufferEvent();
@@ -127,7 +127,7 @@ private:
127 rb.PushCopyObjects(buffer_event); 127 rb.PushCopyObjects(buffer_event);
128 } 128 }
129 129
130 void GetReleasedAudioOutBuffers(Kernel::HLERequestContext& ctx) { 130 void GetReleasedAudioOutBuffers(HLERequestContext& ctx) {
131 const auto write_buffer_size = ctx.GetWriteBufferNumElements<u64>(); 131 const auto write_buffer_size = ctx.GetWriteBufferNumElements<u64>();
132 std::vector<u64> released_buffers(write_buffer_size); 132 std::vector<u64> released_buffers(write_buffer_size);
133 133
@@ -147,7 +147,7 @@ private:
147 rb.Push(count); 147 rb.Push(count);
148 } 148 }
149 149
150 void ContainsAudioOutBuffer(Kernel::HLERequestContext& ctx) { 150 void ContainsAudioOutBuffer(HLERequestContext& ctx) {
151 IPC::RequestParser rp{ctx}; 151 IPC::RequestParser rp{ctx};
152 152
153 const u64 tag{rp.Pop<u64>()}; 153 const u64 tag{rp.Pop<u64>()};
@@ -160,7 +160,7 @@ private:
160 rb.Push(buffer_queued); 160 rb.Push(buffer_queued);
161 } 161 }
162 162
163 void GetAudioOutBufferCount(Kernel::HLERequestContext& ctx) { 163 void GetAudioOutBufferCount(HLERequestContext& ctx) {
164 const auto buffer_count = impl->GetBufferCount(); 164 const auto buffer_count = impl->GetBufferCount();
165 165
166 LOG_DEBUG(Service_Audio, "called. Buffer count={}", buffer_count); 166 LOG_DEBUG(Service_Audio, "called. Buffer count={}", buffer_count);
@@ -171,7 +171,7 @@ private:
171 rb.Push(buffer_count); 171 rb.Push(buffer_count);
172 } 172 }
173 173
174 void GetAudioOutPlayedSampleCount(Kernel::HLERequestContext& ctx) { 174 void GetAudioOutPlayedSampleCount(HLERequestContext& ctx) {
175 const auto samples_played = impl->GetPlayedSampleCount(); 175 const auto samples_played = impl->GetPlayedSampleCount();
176 176
177 LOG_DEBUG(Service_Audio, "called. Played samples={}", samples_played); 177 LOG_DEBUG(Service_Audio, "called. Played samples={}", samples_played);
@@ -182,7 +182,7 @@ private:
182 rb.Push(samples_played); 182 rb.Push(samples_played);
183 } 183 }
184 184
185 void FlushAudioOutBuffers(Kernel::HLERequestContext& ctx) { 185 void FlushAudioOutBuffers(HLERequestContext& ctx) {
186 bool flushed{impl->FlushAudioOutBuffers()}; 186 bool flushed{impl->FlushAudioOutBuffers()};
187 187
188 LOG_DEBUG(Service_Audio, "called. Were any buffers flushed? {}", flushed); 188 LOG_DEBUG(Service_Audio, "called. Were any buffers flushed? {}", flushed);
@@ -192,7 +192,7 @@ private:
192 rb.Push(flushed); 192 rb.Push(flushed);
193 } 193 }
194 194
195 void SetAudioOutVolume(Kernel::HLERequestContext& ctx) { 195 void SetAudioOutVolume(HLERequestContext& ctx) {
196 IPC::RequestParser rp{ctx}; 196 IPC::RequestParser rp{ctx};
197 const auto volume = rp.Pop<f32>(); 197 const auto volume = rp.Pop<f32>();
198 198
@@ -204,7 +204,7 @@ private:
204 rb.Push(ResultSuccess); 204 rb.Push(ResultSuccess);
205 } 205 }
206 206
207 void GetAudioOutVolume(Kernel::HLERequestContext& ctx) { 207 void GetAudioOutVolume(HLERequestContext& ctx) {
208 const auto volume = impl->GetVolume(); 208 const auto volume = impl->GetVolume();
209 209
210 LOG_DEBUG(Service_Audio, "called. Volume={}", volume); 210 LOG_DEBUG(Service_Audio, "called. Volume={}", volume);
@@ -236,7 +236,7 @@ AudOutU::AudOutU(Core::System& system_)
236 236
237AudOutU::~AudOutU() = default; 237AudOutU::~AudOutU() = default;
238 238
239void AudOutU::ListAudioOuts(Kernel::HLERequestContext& ctx) { 239void AudOutU::ListAudioOuts(HLERequestContext& ctx) {
240 using namespace AudioCore::AudioRenderer; 240 using namespace AudioCore::AudioRenderer;
241 241
242 std::scoped_lock l{impl->mutex}; 242 std::scoped_lock l{impl->mutex};
@@ -258,7 +258,7 @@ void AudOutU::ListAudioOuts(Kernel::HLERequestContext& ctx) {
258 rb.Push<u32>(static_cast<u32>(device_names.size())); 258 rb.Push<u32>(static_cast<u32>(device_names.size()));
259} 259}
260 260
261void AudOutU::OpenAudioOut(Kernel::HLERequestContext& ctx) { 261void AudOutU::OpenAudioOut(HLERequestContext& ctx) {
262 IPC::RequestParser rp{ctx}; 262 IPC::RequestParser rp{ctx};
263 auto in_params{rp.PopRaw<AudioOutParameter>()}; 263 auto in_params{rp.PopRaw<AudioOutParameter>()};
264 auto applet_resource_user_id{rp.PopRaw<u64>()}; 264 auto applet_resource_user_id{rp.PopRaw<u64>()};
diff --git a/src/core/hle/service/audio/audout_u.h b/src/core/hle/service/audio/audout_u.h
index fdc0ee754..8f288c6e0 100644
--- a/src/core/hle/service/audio/audout_u.h
+++ b/src/core/hle/service/audio/audout_u.h
@@ -12,10 +12,6 @@ namespace Core {
12class System; 12class System;
13} 13}
14 14
15namespace Kernel {
16class HLERequestContext;
17}
18
19namespace AudioCore::AudioOut { 15namespace AudioCore::AudioOut {
20class Manager; 16class Manager;
21class Out; 17class Out;
@@ -31,8 +27,8 @@ public:
31 ~AudOutU() override; 27 ~AudOutU() override;
32 28
33private: 29private:
34 void ListAudioOuts(Kernel::HLERequestContext& ctx); 30 void ListAudioOuts(HLERequestContext& ctx);
35 void OpenAudioOut(Kernel::HLERequestContext& ctx); 31 void OpenAudioOut(HLERequestContext& ctx);
36 32
37 KernelHelpers::ServiceContext service_context; 33 KernelHelpers::ServiceContext service_context;
38 std::unique_ptr<AudioCore::AudioOut::Manager> impl; 34 std::unique_ptr<AudioCore::AudioOut::Manager> impl;
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp
index 6c12f00a1..0a6830ffa 100644
--- a/src/core/hle/service/audio/audren_u.cpp
+++ b/src/core/hle/service/audio/audren_u.cpp
@@ -17,12 +17,12 @@
17#include "common/polyfill_ranges.h" 17#include "common/polyfill_ranges.h"
18#include "common/string_util.h" 18#include "common/string_util.h"
19#include "core/core.h" 19#include "core/core.h"
20#include "core/hle/ipc_helpers.h"
21#include "core/hle/kernel/k_event.h" 20#include "core/hle/kernel/k_event.h"
22#include "core/hle/kernel/k_process.h" 21#include "core/hle/kernel/k_process.h"
23#include "core/hle/kernel/k_transfer_memory.h" 22#include "core/hle/kernel/k_transfer_memory.h"
24#include "core/hle/service/audio/audren_u.h" 23#include "core/hle/service/audio/audren_u.h"
25#include "core/hle/service/audio/errors.h" 24#include "core/hle/service/audio/errors.h"
25#include "core/hle/service/ipc_helpers.h"
26#include "core/memory.h" 26#include "core/memory.h"
27 27
28using namespace AudioCore::AudioRenderer; 28using namespace AudioCore::AudioRenderer;
@@ -68,7 +68,7 @@ public:
68 } 68 }
69 69
70private: 70private:
71 void GetSampleRate(Kernel::HLERequestContext& ctx) { 71 void GetSampleRate(HLERequestContext& ctx) {
72 const auto sample_rate{impl->GetSystem().GetSampleRate()}; 72 const auto sample_rate{impl->GetSystem().GetSampleRate()};
73 73
74 LOG_DEBUG(Service_Audio, "called. Sample rate {}", sample_rate); 74 LOG_DEBUG(Service_Audio, "called. Sample rate {}", sample_rate);
@@ -78,7 +78,7 @@ private:
78 rb.Push(sample_rate); 78 rb.Push(sample_rate);
79 } 79 }
80 80
81 void GetSampleCount(Kernel::HLERequestContext& ctx) { 81 void GetSampleCount(HLERequestContext& ctx) {
82 const auto sample_count{impl->GetSystem().GetSampleCount()}; 82 const auto sample_count{impl->GetSystem().GetSampleCount()};
83 83
84 LOG_DEBUG(Service_Audio, "called. Sample count {}", sample_count); 84 LOG_DEBUG(Service_Audio, "called. Sample count {}", sample_count);
@@ -88,7 +88,7 @@ private:
88 rb.Push(sample_count); 88 rb.Push(sample_count);
89 } 89 }
90 90
91 void GetState(Kernel::HLERequestContext& ctx) { 91 void GetState(HLERequestContext& ctx) {
92 const u32 state{!impl->GetSystem().IsActive()}; 92 const u32 state{!impl->GetSystem().IsActive()};
93 93
94 LOG_DEBUG(Service_Audio, "called, state {}", state); 94 LOG_DEBUG(Service_Audio, "called, state {}", state);
@@ -98,7 +98,7 @@ private:
98 rb.Push(state); 98 rb.Push(state);
99 } 99 }
100 100
101 void GetMixBufferCount(Kernel::HLERequestContext& ctx) { 101 void GetMixBufferCount(HLERequestContext& ctx) {
102 LOG_DEBUG(Service_Audio, "called"); 102 LOG_DEBUG(Service_Audio, "called");
103 103
104 const auto buffer_count{impl->GetSystem().GetMixBufferCount()}; 104 const auto buffer_count{impl->GetSystem().GetMixBufferCount()};
@@ -108,7 +108,7 @@ private:
108 rb.Push(buffer_count); 108 rb.Push(buffer_count);
109 } 109 }
110 110
111 void RequestUpdate(Kernel::HLERequestContext& ctx) { 111 void RequestUpdate(HLERequestContext& ctx) {
112 LOG_TRACE(Service_Audio, "called"); 112 LOG_TRACE(Service_Audio, "called");
113 113
114 const auto input{ctx.ReadBuffer(0)}; 114 const auto input{ctx.ReadBuffer(0)};
@@ -147,7 +147,7 @@ private:
147 rb.Push(result); 147 rb.Push(result);
148 } 148 }
149 149
150 void Start(Kernel::HLERequestContext& ctx) { 150 void Start(HLERequestContext& ctx) {
151 LOG_DEBUG(Service_Audio, "called"); 151 LOG_DEBUG(Service_Audio, "called");
152 152
153 impl->Start(); 153 impl->Start();
@@ -156,7 +156,7 @@ private:
156 rb.Push(ResultSuccess); 156 rb.Push(ResultSuccess);
157 } 157 }
158 158
159 void Stop(Kernel::HLERequestContext& ctx) { 159 void Stop(HLERequestContext& ctx) {
160 LOG_DEBUG(Service_Audio, "called"); 160 LOG_DEBUG(Service_Audio, "called");
161 161
162 impl->Stop(); 162 impl->Stop();
@@ -165,7 +165,7 @@ private:
165 rb.Push(ResultSuccess); 165 rb.Push(ResultSuccess);
166 } 166 }
167 167
168 void QuerySystemEvent(Kernel::HLERequestContext& ctx) { 168 void QuerySystemEvent(HLERequestContext& ctx) {
169 LOG_DEBUG(Service_Audio, "called"); 169 LOG_DEBUG(Service_Audio, "called");
170 170
171 if (impl->GetSystem().GetExecutionMode() == AudioCore::ExecutionMode::Manual) { 171 if (impl->GetSystem().GetExecutionMode() == AudioCore::ExecutionMode::Manual) {
@@ -179,7 +179,7 @@ private:
179 rb.PushCopyObjects(rendered_event->GetReadableEvent()); 179 rb.PushCopyObjects(rendered_event->GetReadableEvent());
180 } 180 }
181 181
182 void SetRenderingTimeLimit(Kernel::HLERequestContext& ctx) { 182 void SetRenderingTimeLimit(HLERequestContext& ctx) {
183 LOG_DEBUG(Service_Audio, "called"); 183 LOG_DEBUG(Service_Audio, "called");
184 184
185 IPC::RequestParser rp{ctx}; 185 IPC::RequestParser rp{ctx};
@@ -192,7 +192,7 @@ private:
192 rb.Push(ResultSuccess); 192 rb.Push(ResultSuccess);
193 } 193 }
194 194
195 void GetRenderingTimeLimit(Kernel::HLERequestContext& ctx) { 195 void GetRenderingTimeLimit(HLERequestContext& ctx) {
196 LOG_DEBUG(Service_Audio, "called"); 196 LOG_DEBUG(Service_Audio, "called");
197 197
198 auto& system_ = impl->GetSystem(); 198 auto& system_ = impl->GetSystem();
@@ -203,11 +203,11 @@ private:
203 rb.Push(time); 203 rb.Push(time);
204 } 204 }
205 205
206 void ExecuteAudioRendererRendering(Kernel::HLERequestContext& ctx) { 206 void ExecuteAudioRendererRendering(HLERequestContext& ctx) {
207 LOG_DEBUG(Service_Audio, "called"); 207 LOG_DEBUG(Service_Audio, "called");
208 } 208 }
209 209
210 void SetVoiceDropParameter(Kernel::HLERequestContext& ctx) { 210 void SetVoiceDropParameter(HLERequestContext& ctx) {
211 LOG_DEBUG(Service_Audio, "called"); 211 LOG_DEBUG(Service_Audio, "called");
212 212
213 IPC::RequestParser rp{ctx}; 213 IPC::RequestParser rp{ctx};
@@ -220,7 +220,7 @@ private:
220 rb.Push(ResultSuccess); 220 rb.Push(ResultSuccess);
221 } 221 }
222 222
223 void GetVoiceDropParameter(Kernel::HLERequestContext& ctx) { 223 void GetVoiceDropParameter(HLERequestContext& ctx) {
224 LOG_DEBUG(Service_Audio, "called"); 224 LOG_DEBUG(Service_Audio, "called");
225 225
226 auto& system_ = impl->GetSystem(); 226 auto& system_ = impl->GetSystem();
@@ -271,7 +271,7 @@ public:
271 } 271 }
272 272
273private: 273private:
274 void ListAudioDeviceName(Kernel::HLERequestContext& ctx) { 274 void ListAudioDeviceName(HLERequestContext& ctx) {
275 const size_t in_count = ctx.GetWriteBufferNumElements<AudioDevice::AudioDeviceName>(); 275 const size_t in_count = ctx.GetWriteBufferNumElements<AudioDevice::AudioDeviceName>();
276 276
277 std::vector<AudioDevice::AudioDeviceName> out_names{}; 277 std::vector<AudioDevice::AudioDeviceName> out_names{};
@@ -299,7 +299,7 @@ private:
299 rb.Push(out_count); 299 rb.Push(out_count);
300 } 300 }
301 301
302 void SetAudioDeviceOutputVolume(Kernel::HLERequestContext& ctx) { 302 void SetAudioDeviceOutputVolume(HLERequestContext& ctx) {
303 IPC::RequestParser rp{ctx}; 303 IPC::RequestParser rp{ctx};
304 const f32 volume = rp.Pop<f32>(); 304 const f32 volume = rp.Pop<f32>();
305 305
@@ -316,7 +316,7 @@ private:
316 rb.Push(ResultSuccess); 316 rb.Push(ResultSuccess);
317 } 317 }
318 318
319 void GetAudioDeviceOutputVolume(Kernel::HLERequestContext& ctx) { 319 void GetAudioDeviceOutputVolume(HLERequestContext& ctx) {
320 const auto device_name_buffer = ctx.ReadBuffer(); 320 const auto device_name_buffer = ctx.ReadBuffer();
321 const std::string name = Common::StringFromBuffer(device_name_buffer); 321 const std::string name = Common::StringFromBuffer(device_name_buffer);
322 322
@@ -332,7 +332,7 @@ private:
332 rb.Push(volume); 332 rb.Push(volume);
333 } 333 }
334 334
335 void GetActiveAudioDeviceName(Kernel::HLERequestContext& ctx) { 335 void GetActiveAudioDeviceName(HLERequestContext& ctx) {
336 const auto write_size = ctx.GetWriteBufferSize(); 336 const auto write_size = ctx.GetWriteBufferSize();
337 std::string out_name{"AudioTvOutput"}; 337 std::string out_name{"AudioTvOutput"};
338 338
@@ -346,7 +346,7 @@ private:
346 rb.Push(ResultSuccess); 346 rb.Push(ResultSuccess);
347 } 347 }
348 348
349 void QueryAudioDeviceSystemEvent(Kernel::HLERequestContext& ctx) { 349 void QueryAudioDeviceSystemEvent(HLERequestContext& ctx) {
350 LOG_DEBUG(Service_Audio, "(STUBBED) called"); 350 LOG_DEBUG(Service_Audio, "(STUBBED) called");
351 351
352 event->Signal(); 352 event->Signal();
@@ -356,7 +356,7 @@ private:
356 rb.PushCopyObjects(event->GetReadableEvent()); 356 rb.PushCopyObjects(event->GetReadableEvent());
357 } 357 }
358 358
359 void GetActiveChannelCount(Kernel::HLERequestContext& ctx) { 359 void GetActiveChannelCount(HLERequestContext& ctx) {
360 const auto& sink{system.AudioCore().GetOutputSink()}; 360 const auto& sink{system.AudioCore().GetOutputSink()};
361 u32 channel_count{sink.GetDeviceChannels()}; 361 u32 channel_count{sink.GetDeviceChannels()};
362 362
@@ -368,7 +368,7 @@ private:
368 rb.Push<u32>(channel_count); 368 rb.Push<u32>(channel_count);
369 } 369 }
370 370
371 void QueryAudioDeviceInputEvent(Kernel::HLERequestContext& ctx) { 371 void QueryAudioDeviceInputEvent(HLERequestContext& ctx) {
372 LOG_DEBUG(Service_Audio, "(STUBBED) called"); 372 LOG_DEBUG(Service_Audio, "(STUBBED) called");
373 373
374 IPC::ResponseBuilder rb{ctx, 2, 1}; 374 IPC::ResponseBuilder rb{ctx, 2, 1};
@@ -376,7 +376,7 @@ private:
376 rb.PushCopyObjects(event->GetReadableEvent()); 376 rb.PushCopyObjects(event->GetReadableEvent());
377 } 377 }
378 378
379 void QueryAudioDeviceOutputEvent(Kernel::HLERequestContext& ctx) { 379 void QueryAudioDeviceOutputEvent(HLERequestContext& ctx) {
380 LOG_DEBUG(Service_Audio, "called"); 380 LOG_DEBUG(Service_Audio, "called");
381 381
382 IPC::ResponseBuilder rb{ctx, 2, 1}; 382 IPC::ResponseBuilder rb{ctx, 2, 1};
@@ -384,7 +384,7 @@ private:
384 rb.PushCopyObjects(event->GetReadableEvent()); 384 rb.PushCopyObjects(event->GetReadableEvent());
385 } 385 }
386 386
387 void ListAudioOutputDeviceName(Kernel::HLERequestContext& ctx) { 387 void ListAudioOutputDeviceName(HLERequestContext& ctx) {
388 const size_t in_count = ctx.GetWriteBufferNumElements<AudioDevice::AudioDeviceName>(); 388 const size_t in_count = ctx.GetWriteBufferNumElements<AudioDevice::AudioDeviceName>();
389 389
390 std::vector<AudioDevice::AudioDeviceName> out_names{}; 390 std::vector<AudioDevice::AudioDeviceName> out_names{};
@@ -435,7 +435,7 @@ AudRenU::AudRenU(Core::System& system_)
435 435
436AudRenU::~AudRenU() = default; 436AudRenU::~AudRenU() = default;
437 437
438void AudRenU::OpenAudioRenderer(Kernel::HLERequestContext& ctx) { 438void AudRenU::OpenAudioRenderer(HLERequestContext& ctx) {
439 IPC::RequestParser rp{ctx}; 439 IPC::RequestParser rp{ctx};
440 440
441 AudioCore::AudioRendererParameterInternal params; 441 AudioCore::AudioRendererParameterInternal params;
@@ -475,7 +475,7 @@ void AudRenU::OpenAudioRenderer(Kernel::HLERequestContext& ctx) {
475 applet_resource_user_id, session_id); 475 applet_resource_user_id, session_id);
476} 476}
477 477
478void AudRenU::GetWorkBufferSize(Kernel::HLERequestContext& ctx) { 478void AudRenU::GetWorkBufferSize(HLERequestContext& ctx) {
479 AudioCore::AudioRendererParameterInternal params; 479 AudioCore::AudioRendererParameterInternal params;
480 480
481 IPC::RequestParser rp{ctx}; 481 IPC::RequestParser rp{ctx};
@@ -506,7 +506,7 @@ void AudRenU::GetWorkBufferSize(Kernel::HLERequestContext& ctx) {
506 rb.Push<u64>(size); 506 rb.Push<u64>(size);
507} 507}
508 508
509void AudRenU::GetAudioDeviceService(Kernel::HLERequestContext& ctx) { 509void AudRenU::GetAudioDeviceService(HLERequestContext& ctx) {
510 IPC::RequestParser rp{ctx}; 510 IPC::RequestParser rp{ctx};
511 511
512 const auto applet_resource_user_id = rp.Pop<u64>(); 512 const auto applet_resource_user_id = rp.Pop<u64>();
@@ -520,11 +520,11 @@ void AudRenU::GetAudioDeviceService(Kernel::HLERequestContext& ctx) {
520 ::Common::MakeMagic('R', 'E', 'V', '1'), num_audio_devices++); 520 ::Common::MakeMagic('R', 'E', 'V', '1'), num_audio_devices++);
521} 521}
522 522
523void AudRenU::OpenAudioRendererForManualExecution(Kernel::HLERequestContext& ctx) { 523void AudRenU::OpenAudioRendererForManualExecution(HLERequestContext& ctx) {
524 LOG_DEBUG(Service_Audio, "called"); 524 LOG_DEBUG(Service_Audio, "called");
525} 525}
526 526
527void AudRenU::GetAudioDeviceServiceWithRevisionInfo(Kernel::HLERequestContext& ctx) { 527void AudRenU::GetAudioDeviceServiceWithRevisionInfo(HLERequestContext& ctx) {
528 struct Parameters { 528 struct Parameters {
529 u32 revision; 529 u32 revision;
530 u64 applet_resource_user_id; 530 u64 applet_resource_user_id;
diff --git a/src/core/hle/service/audio/audren_u.h b/src/core/hle/service/audio/audren_u.h
index 4384a9b3c..24ce37e87 100644
--- a/src/core/hle/service/audio/audren_u.h
+++ b/src/core/hle/service/audio/audren_u.h
@@ -11,10 +11,6 @@ namespace Core {
11class System; 11class System;
12} 12}
13 13
14namespace Kernel {
15class HLERequestContext;
16}
17
18namespace Service::Audio { 14namespace Service::Audio {
19class IAudioRenderer; 15class IAudioRenderer;
20 16
@@ -24,11 +20,11 @@ public:
24 ~AudRenU() override; 20 ~AudRenU() override;
25 21
26private: 22private:
27 void OpenAudioRenderer(Kernel::HLERequestContext& ctx); 23 void OpenAudioRenderer(HLERequestContext& ctx);
28 void GetWorkBufferSize(Kernel::HLERequestContext& ctx); 24 void GetWorkBufferSize(HLERequestContext& ctx);
29 void GetAudioDeviceService(Kernel::HLERequestContext& ctx); 25 void GetAudioDeviceService(HLERequestContext& ctx);
30 void OpenAudioRendererForManualExecution(Kernel::HLERequestContext& ctx); 26 void OpenAudioRendererForManualExecution(HLERequestContext& ctx);
31 void GetAudioDeviceServiceWithRevisionInfo(Kernel::HLERequestContext& ctx); 27 void GetAudioDeviceServiceWithRevisionInfo(HLERequestContext& ctx);
32 28
33 KernelHelpers::ServiceContext service_context; 29 KernelHelpers::ServiceContext service_context;
34 std::unique_ptr<AudioCore::AudioRenderer::Manager> impl; 30 std::unique_ptr<AudioCore::AudioRenderer::Manager> impl;
diff --git a/src/core/hle/service/audio/hwopus.cpp b/src/core/hle/service/audio/hwopus.cpp
index 3db3fe188..451ac224a 100644
--- a/src/core/hle/service/audio/hwopus.cpp
+++ b/src/core/hle/service/audio/hwopus.cpp
@@ -11,8 +11,8 @@
11 11
12#include "common/assert.h" 12#include "common/assert.h"
13#include "common/logging/log.h" 13#include "common/logging/log.h"
14#include "core/hle/ipc_helpers.h"
15#include "core/hle/service/audio/hwopus.h" 14#include "core/hle/service/audio/hwopus.h"
15#include "core/hle/service/ipc_helpers.h"
16 16
17namespace Service::Audio { 17namespace Service::Audio {
18namespace { 18namespace {
@@ -53,7 +53,7 @@ public:
53 53
54 // Decodes interleaved Opus packets. Optionally allows reporting time taken to 54 // Decodes interleaved Opus packets. Optionally allows reporting time taken to
55 // perform the decoding, as well as any relevant extra behavior. 55 // perform the decoding, as well as any relevant extra behavior.
56 void DecodeInterleaved(Kernel::HLERequestContext& ctx, PerfTime perf_time, 56 void DecodeInterleaved(HLERequestContext& ctx, PerfTime perf_time,
57 ExtraBehavior extra_behavior) { 57 ExtraBehavior extra_behavior) {
58 if (perf_time == PerfTime::Disabled) { 58 if (perf_time == PerfTime::Disabled) {
59 DecodeInterleavedHelper(ctx, nullptr, extra_behavior); 59 DecodeInterleavedHelper(ctx, nullptr, extra_behavior);
@@ -64,7 +64,7 @@ public:
64 } 64 }
65 65
66private: 66private:
67 void DecodeInterleavedHelper(Kernel::HLERequestContext& ctx, u64* performance, 67 void DecodeInterleavedHelper(HLERequestContext& ctx, u64* performance,
68 ExtraBehavior extra_behavior) { 68 ExtraBehavior extra_behavior) {
69 u32 consumed = 0; 69 u32 consumed = 0;
70 u32 sample_count = 0; 70 u32 sample_count = 0;
@@ -180,21 +180,21 @@ public:
180 } 180 }
181 181
182private: 182private:
183 void DecodeInterleavedOld(Kernel::HLERequestContext& ctx) { 183 void DecodeInterleavedOld(HLERequestContext& ctx) {
184 LOG_DEBUG(Audio, "called"); 184 LOG_DEBUG(Audio, "called");
185 185
186 decoder_state.DecodeInterleaved(ctx, OpusDecoderState::PerfTime::Disabled, 186 decoder_state.DecodeInterleaved(ctx, OpusDecoderState::PerfTime::Disabled,
187 OpusDecoderState::ExtraBehavior::None); 187 OpusDecoderState::ExtraBehavior::None);
188 } 188 }
189 189
190 void DecodeInterleavedWithPerfOld(Kernel::HLERequestContext& ctx) { 190 void DecodeInterleavedWithPerfOld(HLERequestContext& ctx) {
191 LOG_DEBUG(Audio, "called"); 191 LOG_DEBUG(Audio, "called");
192 192
193 decoder_state.DecodeInterleaved(ctx, OpusDecoderState::PerfTime::Enabled, 193 decoder_state.DecodeInterleaved(ctx, OpusDecoderState::PerfTime::Enabled,
194 OpusDecoderState::ExtraBehavior::None); 194 OpusDecoderState::ExtraBehavior::None);
195 } 195 }
196 196
197 void DecodeInterleaved(Kernel::HLERequestContext& ctx) { 197 void DecodeInterleaved(HLERequestContext& ctx) {
198 LOG_DEBUG(Audio, "called"); 198 LOG_DEBUG(Audio, "called");
199 199
200 IPC::RequestParser rp{ctx}; 200 IPC::RequestParser rp{ctx};
@@ -231,7 +231,7 @@ std::array<u8, 2> CreateMappingTable(u32 channel_count) {
231} 231}
232} // Anonymous namespace 232} // Anonymous namespace
233 233
234void HwOpus::GetWorkBufferSize(Kernel::HLERequestContext& ctx) { 234void HwOpus::GetWorkBufferSize(HLERequestContext& ctx) {
235 IPC::RequestParser rp{ctx}; 235 IPC::RequestParser rp{ctx};
236 const auto sample_rate = rp.Pop<u32>(); 236 const auto sample_rate = rp.Pop<u32>();
237 const auto channel_count = rp.Pop<u32>(); 237 const auto channel_count = rp.Pop<u32>();
@@ -251,11 +251,11 @@ void HwOpus::GetWorkBufferSize(Kernel::HLERequestContext& ctx) {
251 rb.Push<u32>(worker_buffer_sz); 251 rb.Push<u32>(worker_buffer_sz);
252} 252}
253 253
254void HwOpus::GetWorkBufferSizeEx(Kernel::HLERequestContext& ctx) { 254void HwOpus::GetWorkBufferSizeEx(HLERequestContext& ctx) {
255 GetWorkBufferSize(ctx); 255 GetWorkBufferSize(ctx);
256} 256}
257 257
258void HwOpus::GetWorkBufferSizeForMultiStreamEx(Kernel::HLERequestContext& ctx) { 258void HwOpus::GetWorkBufferSizeForMultiStreamEx(HLERequestContext& ctx) {
259 OpusMultiStreamParametersEx param; 259 OpusMultiStreamParametersEx param;
260 std::memcpy(&param, ctx.ReadBuffer().data(), ctx.GetReadBufferSize()); 260 std::memcpy(&param, ctx.ReadBuffer().data(), ctx.GetReadBufferSize());
261 261
@@ -281,7 +281,7 @@ void HwOpus::GetWorkBufferSizeForMultiStreamEx(Kernel::HLERequestContext& ctx) {
281 rb.Push<u32>(worker_buffer_sz); 281 rb.Push<u32>(worker_buffer_sz);
282} 282}
283 283
284void HwOpus::OpenHardwareOpusDecoder(Kernel::HLERequestContext& ctx) { 284void HwOpus::OpenHardwareOpusDecoder(HLERequestContext& ctx) {
285 IPC::RequestParser rp{ctx}; 285 IPC::RequestParser rp{ctx};
286 const auto sample_rate = rp.Pop<u32>(); 286 const auto sample_rate = rp.Pop<u32>();
287 const auto channel_count = rp.Pop<u32>(); 287 const auto channel_count = rp.Pop<u32>();
@@ -319,7 +319,7 @@ void HwOpus::OpenHardwareOpusDecoder(Kernel::HLERequestContext& ctx) {
319 system, OpusDecoderState{std::move(decoder), sample_rate, channel_count}); 319 system, OpusDecoderState{std::move(decoder), sample_rate, channel_count});
320} 320}
321 321
322void HwOpus::OpenHardwareOpusDecoderEx(Kernel::HLERequestContext& ctx) { 322void HwOpus::OpenHardwareOpusDecoderEx(HLERequestContext& ctx) {
323 IPC::RequestParser rp{ctx}; 323 IPC::RequestParser rp{ctx};
324 const auto sample_rate = rp.Pop<u32>(); 324 const auto sample_rate = rp.Pop<u32>();
325 const auto channel_count = rp.Pop<u32>(); 325 const auto channel_count = rp.Pop<u32>();
diff --git a/src/core/hle/service/audio/hwopus.h b/src/core/hle/service/audio/hwopus.h
index e6092e290..ece65c02c 100644
--- a/src/core/hle/service/audio/hwopus.h
+++ b/src/core/hle/service/audio/hwopus.h
@@ -27,11 +27,11 @@ public:
27 ~HwOpus() override; 27 ~HwOpus() override;
28 28
29private: 29private:
30 void OpenHardwareOpusDecoder(Kernel::HLERequestContext& ctx); 30 void OpenHardwareOpusDecoder(HLERequestContext& ctx);
31 void OpenHardwareOpusDecoderEx(Kernel::HLERequestContext& ctx); 31 void OpenHardwareOpusDecoderEx(HLERequestContext& ctx);
32 void GetWorkBufferSize(Kernel::HLERequestContext& ctx); 32 void GetWorkBufferSize(HLERequestContext& ctx);
33 void GetWorkBufferSizeEx(Kernel::HLERequestContext& ctx); 33 void GetWorkBufferSizeEx(HLERequestContext& ctx);
34 void GetWorkBufferSizeForMultiStreamEx(Kernel::HLERequestContext& ctx); 34 void GetWorkBufferSizeForMultiStreamEx(HLERequestContext& ctx);
35}; 35};
36 36
37} // namespace Service::Audio 37} // namespace Service::Audio
diff --git a/src/core/hle/service/bcat/bcat_module.cpp b/src/core/hle/service/bcat/bcat_module.cpp
index 1db3f026b..a6281913a 100644
--- a/src/core/hle/service/bcat/bcat_module.cpp
+++ b/src/core/hle/service/bcat/bcat_module.cpp
@@ -9,12 +9,12 @@
9#include "common/string_util.h" 9#include "common/string_util.h"
10#include "core/core.h" 10#include "core/core.h"
11#include "core/file_sys/vfs.h" 11#include "core/file_sys/vfs.h"
12#include "core/hle/ipc_helpers.h"
13#include "core/hle/kernel/k_readable_event.h" 12#include "core/hle/kernel/k_readable_event.h"
14#include "core/hle/service/bcat/backend/backend.h" 13#include "core/hle/service/bcat/backend/backend.h"
15#include "core/hle/service/bcat/bcat.h" 14#include "core/hle/service/bcat/bcat.h"
16#include "core/hle/service/bcat/bcat_module.h" 15#include "core/hle/service/bcat/bcat_module.h"
17#include "core/hle/service/filesystem/filesystem.h" 16#include "core/hle/service/filesystem/filesystem.h"
17#include "core/hle/service/ipc_helpers.h"
18#include "core/hle/service/server_manager.h" 18#include "core/hle/service/server_manager.h"
19 19
20namespace Service::BCAT { 20namespace Service::BCAT {
@@ -51,8 +51,7 @@ BCATDigest DigestFile(const FileSys::VirtualFile& file) {
51// For a name to be valid it must be non-empty, must have a null terminating character as the final 51// For a name to be valid it must be non-empty, must have a null terminating character as the final
52// char, can only contain numbers, letters, underscores and a hyphen if directory and a period if 52// char, can only contain numbers, letters, underscores and a hyphen if directory and a period if
53// file. 53// file.
54bool VerifyNameValidInternal(Kernel::HLERequestContext& ctx, std::array<char, 0x20> name, 54bool VerifyNameValidInternal(HLERequestContext& ctx, std::array<char, 0x20> name, char match_char) {
55 char match_char) {
56 const auto null_chars = std::count(name.begin(), name.end(), 0); 55 const auto null_chars = std::count(name.begin(), name.end(), 0);
57 const auto bad_chars = std::count_if(name.begin(), name.end(), [match_char](char c) { 56 const auto bad_chars = std::count_if(name.begin(), name.end(), [match_char](char c) {
58 return !std::isalnum(static_cast<u8>(c)) && c != '_' && c != match_char && c != '\0'; 57 return !std::isalnum(static_cast<u8>(c)) && c != '_' && c != match_char && c != '\0';
@@ -67,11 +66,11 @@ bool VerifyNameValidInternal(Kernel::HLERequestContext& ctx, std::array<char, 0x
67 return true; 66 return true;
68} 67}
69 68
70bool VerifyNameValidDir(Kernel::HLERequestContext& ctx, DirectoryName name) { 69bool VerifyNameValidDir(HLERequestContext& ctx, DirectoryName name) {
71 return VerifyNameValidInternal(ctx, name, '-'); 70 return VerifyNameValidInternal(ctx, name, '-');
72} 71}
73 72
74bool VerifyNameValidFile(Kernel::HLERequestContext& ctx, FileName name) { 73bool VerifyNameValidFile(HLERequestContext& ctx, FileName name) {
75 return VerifyNameValidInternal(ctx, name, '.'); 74 return VerifyNameValidInternal(ctx, name, '.');
76} 75}
77 76
@@ -99,7 +98,7 @@ public:
99 } 98 }
100 99
101private: 100private:
102 void GetEvent(Kernel::HLERequestContext& ctx) { 101 void GetEvent(HLERequestContext& ctx) {
103 LOG_DEBUG(Service_BCAT, "called"); 102 LOG_DEBUG(Service_BCAT, "called");
104 103
105 IPC::ResponseBuilder rb{ctx, 2, 1}; 104 IPC::ResponseBuilder rb{ctx, 2, 1};
@@ -107,7 +106,7 @@ private:
107 rb.PushCopyObjects(event); 106 rb.PushCopyObjects(event);
108 } 107 }
109 108
110 void GetImpl(Kernel::HLERequestContext& ctx) { 109 void GetImpl(HLERequestContext& ctx) {
111 LOG_DEBUG(Service_BCAT, "called"); 110 LOG_DEBUG(Service_BCAT, "called");
112 111
113 ctx.WriteBuffer(impl); 112 ctx.WriteBuffer(impl);
@@ -174,7 +173,7 @@ private:
174 progress_backend.GetImpl()); 173 progress_backend.GetImpl());
175 } 174 }
176 175
177 void RequestSyncDeliveryCache(Kernel::HLERequestContext& ctx) { 176 void RequestSyncDeliveryCache(HLERequestContext& ctx) {
178 LOG_DEBUG(Service_BCAT, "called"); 177 LOG_DEBUG(Service_BCAT, "called");
179 178
180 backend.Synchronize({system.GetApplicationProcessProgramID(), 179 backend.Synchronize({system.GetApplicationProcessProgramID(),
@@ -186,7 +185,7 @@ private:
186 rb.PushIpcInterface(CreateProgressService(SyncType::Normal)); 185 rb.PushIpcInterface(CreateProgressService(SyncType::Normal));
187 } 186 }
188 187
189 void RequestSyncDeliveryCacheWithDirectoryName(Kernel::HLERequestContext& ctx) { 188 void RequestSyncDeliveryCacheWithDirectoryName(HLERequestContext& ctx) {
190 IPC::RequestParser rp{ctx}; 189 IPC::RequestParser rp{ctx};
191 const auto name_raw = rp.PopRaw<DirectoryName>(); 190 const auto name_raw = rp.PopRaw<DirectoryName>();
192 const auto name = 191 const auto name =
@@ -203,7 +202,7 @@ private:
203 rb.PushIpcInterface(CreateProgressService(SyncType::Directory)); 202 rb.PushIpcInterface(CreateProgressService(SyncType::Directory));
204 } 203 }
205 204
206 void SetPassphrase(Kernel::HLERequestContext& ctx) { 205 void SetPassphrase(HLERequestContext& ctx) {
207 IPC::RequestParser rp{ctx}; 206 IPC::RequestParser rp{ctx};
208 const auto title_id = rp.PopRaw<u64>(); 207 const auto title_id = rp.PopRaw<u64>();
209 208
@@ -235,7 +234,7 @@ private:
235 rb.Push(ResultSuccess); 234 rb.Push(ResultSuccess);
236 } 235 }
237 236
238 void ClearDeliveryCacheStorage(Kernel::HLERequestContext& ctx) { 237 void ClearDeliveryCacheStorage(HLERequestContext& ctx) {
239 IPC::RequestParser rp{ctx}; 238 IPC::RequestParser rp{ctx};
240 const auto title_id = rp.PopRaw<u64>(); 239 const auto title_id = rp.PopRaw<u64>();
241 240
@@ -271,7 +270,7 @@ private:
271 std::array<ProgressServiceBackend, static_cast<size_t>(SyncType::Count)> progress; 270 std::array<ProgressServiceBackend, static_cast<size_t>(SyncType::Count)> progress;
272}; 271};
273 272
274void Module::Interface::CreateBcatService(Kernel::HLERequestContext& ctx) { 273void Module::Interface::CreateBcatService(HLERequestContext& ctx) {
275 LOG_DEBUG(Service_BCAT, "called"); 274 LOG_DEBUG(Service_BCAT, "called");
276 275
277 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 276 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -296,7 +295,7 @@ public:
296 } 295 }
297 296
298private: 297private:
299 void Open(Kernel::HLERequestContext& ctx) { 298 void Open(HLERequestContext& ctx) {
300 IPC::RequestParser rp{ctx}; 299 IPC::RequestParser rp{ctx};
301 const auto dir_name_raw = rp.PopRaw<DirectoryName>(); 300 const auto dir_name_raw = rp.PopRaw<DirectoryName>();
302 const auto file_name_raw = rp.PopRaw<FileName>(); 301 const auto file_name_raw = rp.PopRaw<FileName>();
@@ -340,7 +339,7 @@ private:
340 rb.Push(ResultSuccess); 339 rb.Push(ResultSuccess);
341 } 340 }
342 341
343 void Read(Kernel::HLERequestContext& ctx) { 342 void Read(HLERequestContext& ctx) {
344 IPC::RequestParser rp{ctx}; 343 IPC::RequestParser rp{ctx};
345 const auto offset{rp.PopRaw<u64>()}; 344 const auto offset{rp.PopRaw<u64>()};
346 345
@@ -363,7 +362,7 @@ private:
363 rb.Push<u64>(buffer.size()); 362 rb.Push<u64>(buffer.size());
364 } 363 }
365 364
366 void GetSize(Kernel::HLERequestContext& ctx) { 365 void GetSize(HLERequestContext& ctx) {
367 LOG_DEBUG(Service_BCAT, "called"); 366 LOG_DEBUG(Service_BCAT, "called");
368 367
369 if (current_file == nullptr) { 368 if (current_file == nullptr) {
@@ -377,7 +376,7 @@ private:
377 rb.Push<u64>(current_file->GetSize()); 376 rb.Push<u64>(current_file->GetSize());
378 } 377 }
379 378
380 void GetDigest(Kernel::HLERequestContext& ctx) { 379 void GetDigest(HLERequestContext& ctx) {
381 LOG_DEBUG(Service_BCAT, "called"); 380 LOG_DEBUG(Service_BCAT, "called");
382 381
383 if (current_file == nullptr) { 382 if (current_file == nullptr) {
@@ -412,7 +411,7 @@ public:
412 } 411 }
413 412
414private: 413private:
415 void Open(Kernel::HLERequestContext& ctx) { 414 void Open(HLERequestContext& ctx) {
416 IPC::RequestParser rp{ctx}; 415 IPC::RequestParser rp{ctx};
417 const auto name_raw = rp.PopRaw<DirectoryName>(); 416 const auto name_raw = rp.PopRaw<DirectoryName>();
418 const auto name = 417 const auto name =
@@ -443,7 +442,7 @@ private:
443 rb.Push(ResultSuccess); 442 rb.Push(ResultSuccess);
444 } 443 }
445 444
446 void Read(Kernel::HLERequestContext& ctx) { 445 void Read(HLERequestContext& ctx) {
447 auto write_size = ctx.GetWriteBufferNumElements<DeliveryCacheDirectoryEntry>(); 446 auto write_size = ctx.GetWriteBufferNumElements<DeliveryCacheDirectoryEntry>();
448 447
449 LOG_DEBUG(Service_BCAT, "called, write_size={:016X}", write_size); 448 LOG_DEBUG(Service_BCAT, "called, write_size={:016X}", write_size);
@@ -473,7 +472,7 @@ private:
473 rb.Push(static_cast<u32>(write_size * sizeof(DeliveryCacheDirectoryEntry))); 472 rb.Push(static_cast<u32>(write_size * sizeof(DeliveryCacheDirectoryEntry)));
474 } 473 }
475 474
476 void GetCount(Kernel::HLERequestContext& ctx) { 475 void GetCount(HLERequestContext& ctx) {
477 LOG_DEBUG(Service_BCAT, "called"); 476 LOG_DEBUG(Service_BCAT, "called");
478 477
479 if (current_dir == nullptr) { 478 if (current_dir == nullptr) {
@@ -517,7 +516,7 @@ public:
517 } 516 }
518 517
519private: 518private:
520 void CreateFileService(Kernel::HLERequestContext& ctx) { 519 void CreateFileService(HLERequestContext& ctx) {
521 LOG_DEBUG(Service_BCAT, "called"); 520 LOG_DEBUG(Service_BCAT, "called");
522 521
523 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 522 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -525,7 +524,7 @@ private:
525 rb.PushIpcInterface<IDeliveryCacheFileService>(system, root); 524 rb.PushIpcInterface<IDeliveryCacheFileService>(system, root);
526 } 525 }
527 526
528 void CreateDirectoryService(Kernel::HLERequestContext& ctx) { 527 void CreateDirectoryService(HLERequestContext& ctx) {
529 LOG_DEBUG(Service_BCAT, "called"); 528 LOG_DEBUG(Service_BCAT, "called");
530 529
531 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 530 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -533,7 +532,7 @@ private:
533 rb.PushIpcInterface<IDeliveryCacheDirectoryService>(system, root); 532 rb.PushIpcInterface<IDeliveryCacheDirectoryService>(system, root);
534 } 533 }
535 534
536 void EnumerateDeliveryCacheDirectory(Kernel::HLERequestContext& ctx) { 535 void EnumerateDeliveryCacheDirectory(HLERequestContext& ctx) {
537 auto size = ctx.GetWriteBufferNumElements<DirectoryName>(); 536 auto size = ctx.GetWriteBufferNumElements<DirectoryName>();
538 537
539 LOG_DEBUG(Service_BCAT, "called, size={:016X}", size); 538 LOG_DEBUG(Service_BCAT, "called, size={:016X}", size);
@@ -552,7 +551,7 @@ private:
552 u64 next_read_index = 0; 551 u64 next_read_index = 0;
553}; 552};
554 553
555void Module::Interface::CreateDeliveryCacheStorageService(Kernel::HLERequestContext& ctx) { 554void Module::Interface::CreateDeliveryCacheStorageService(HLERequestContext& ctx) {
556 LOG_DEBUG(Service_BCAT, "called"); 555 LOG_DEBUG(Service_BCAT, "called");
557 556
558 const auto title_id = system.GetApplicationProcessProgramID(); 557 const auto title_id = system.GetApplicationProcessProgramID();
@@ -561,8 +560,7 @@ void Module::Interface::CreateDeliveryCacheStorageService(Kernel::HLERequestCont
561 rb.PushIpcInterface<IDeliveryCacheStorageService>(system, fsc.GetBCATDirectory(title_id)); 560 rb.PushIpcInterface<IDeliveryCacheStorageService>(system, fsc.GetBCATDirectory(title_id));
562} 561}
563 562
564void Module::Interface::CreateDeliveryCacheStorageServiceWithApplicationId( 563void Module::Interface::CreateDeliveryCacheStorageServiceWithApplicationId(HLERequestContext& ctx) {
565 Kernel::HLERequestContext& ctx) {
566 IPC::RequestParser rp{ctx}; 564 IPC::RequestParser rp{ctx};
567 const auto title_id = rp.PopRaw<u64>(); 565 const auto title_id = rp.PopRaw<u64>();
568 566
diff --git a/src/core/hle/service/bcat/bcat_module.h b/src/core/hle/service/bcat/bcat_module.h
index 0c134d1ff..87576288b 100644
--- a/src/core/hle/service/bcat/bcat_module.h
+++ b/src/core/hle/service/bcat/bcat_module.h
@@ -27,9 +27,9 @@ public:
27 FileSystem::FileSystemController& fsc_, const char* name); 27 FileSystem::FileSystemController& fsc_, const char* name);
28 ~Interface() override; 28 ~Interface() override;
29 29
30 void CreateBcatService(Kernel::HLERequestContext& ctx); 30 void CreateBcatService(HLERequestContext& ctx);
31 void CreateDeliveryCacheStorageService(Kernel::HLERequestContext& ctx); 31 void CreateDeliveryCacheStorageService(HLERequestContext& ctx);
32 void CreateDeliveryCacheStorageServiceWithApplicationId(Kernel::HLERequestContext& ctx); 32 void CreateDeliveryCacheStorageServiceWithApplicationId(HLERequestContext& ctx);
33 33
34 protected: 34 protected:
35 FileSystem::FileSystemController& fsc; 35 FileSystem::FileSystemController& fsc;
diff --git a/src/core/hle/service/btdrv/btdrv.cpp b/src/core/hle/service/btdrv/btdrv.cpp
index ed020d03f..38cdd57ad 100644
--- a/src/core/hle/service/btdrv/btdrv.cpp
+++ b/src/core/hle/service/btdrv/btdrv.cpp
@@ -3,9 +3,9 @@
3 3
4#include "common/logging/log.h" 4#include "common/logging/log.h"
5#include "core/core.h" 5#include "core/core.h"
6#include "core/hle/ipc_helpers.h"
7#include "core/hle/kernel/k_event.h" 6#include "core/hle/kernel/k_event.h"
8#include "core/hle/service/btdrv/btdrv.h" 7#include "core/hle/service/btdrv/btdrv.h"
8#include "core/hle/service/ipc_helpers.h"
9#include "core/hle/service/kernel_helpers.h" 9#include "core/hle/service/kernel_helpers.h"
10#include "core/hle/service/server_manager.h" 10#include "core/hle/service/server_manager.h"
11#include "core/hle/service/service.h" 11#include "core/hle/service/service.h"
@@ -41,7 +41,7 @@ public:
41 } 41 }
42 42
43private: 43private:
44 void RegisterBleEvent(Kernel::HLERequestContext& ctx) { 44 void RegisterBleEvent(HLERequestContext& ctx) {
45 LOG_WARNING(Service_BTM, "(STUBBED) called"); 45 LOG_WARNING(Service_BTM, "(STUBBED) called");
46 46
47 IPC::ResponseBuilder rb{ctx, 2, 1}; 47 IPC::ResponseBuilder rb{ctx, 2, 1};
diff --git a/src/core/hle/service/btm/btm.cpp b/src/core/hle/service/btm/btm.cpp
index dbd9d6a88..8069f75b7 100644
--- a/src/core/hle/service/btm/btm.cpp
+++ b/src/core/hle/service/btm/btm.cpp
@@ -5,9 +5,9 @@
5 5
6#include "common/logging/log.h" 6#include "common/logging/log.h"
7#include "core/core.h" 7#include "core/core.h"
8#include "core/hle/ipc_helpers.h"
9#include "core/hle/kernel/k_event.h" 8#include "core/hle/kernel/k_event.h"
10#include "core/hle/service/btm/btm.h" 9#include "core/hle/service/btm/btm.h"
10#include "core/hle/service/ipc_helpers.h"
11#include "core/hle/service/kernel_helpers.h" 11#include "core/hle/service/kernel_helpers.h"
12#include "core/hle/service/server_manager.h" 12#include "core/hle/service/server_manager.h"
13#include "core/hle/service/service.h" 13#include "core/hle/service/service.h"
@@ -70,7 +70,7 @@ public:
70 } 70 }
71 71
72private: 72private:
73 void AcquireBleScanEvent(Kernel::HLERequestContext& ctx) { 73 void AcquireBleScanEvent(HLERequestContext& ctx) {
74 LOG_WARNING(Service_BTM, "(STUBBED) called"); 74 LOG_WARNING(Service_BTM, "(STUBBED) called");
75 75
76 IPC::ResponseBuilder rb{ctx, 3, 1}; 76 IPC::ResponseBuilder rb{ctx, 3, 1};
@@ -79,7 +79,7 @@ private:
79 rb.PushCopyObjects(scan_event->GetReadableEvent()); 79 rb.PushCopyObjects(scan_event->GetReadableEvent());
80 } 80 }
81 81
82 void AcquireBleConnectionEvent(Kernel::HLERequestContext& ctx) { 82 void AcquireBleConnectionEvent(HLERequestContext& ctx) {
83 LOG_WARNING(Service_BTM, "(STUBBED) called"); 83 LOG_WARNING(Service_BTM, "(STUBBED) called");
84 84
85 IPC::ResponseBuilder rb{ctx, 3, 1}; 85 IPC::ResponseBuilder rb{ctx, 3, 1};
@@ -88,7 +88,7 @@ private:
88 rb.PushCopyObjects(connection_event->GetReadableEvent()); 88 rb.PushCopyObjects(connection_event->GetReadableEvent());
89 } 89 }
90 90
91 void AcquireBleServiceDiscoveryEvent(Kernel::HLERequestContext& ctx) { 91 void AcquireBleServiceDiscoveryEvent(HLERequestContext& ctx) {
92 LOG_WARNING(Service_BTM, "(STUBBED) called"); 92 LOG_WARNING(Service_BTM, "(STUBBED) called");
93 93
94 IPC::ResponseBuilder rb{ctx, 3, 1}; 94 IPC::ResponseBuilder rb{ctx, 3, 1};
@@ -97,7 +97,7 @@ private:
97 rb.PushCopyObjects(service_discovery_event->GetReadableEvent()); 97 rb.PushCopyObjects(service_discovery_event->GetReadableEvent());
98 } 98 }
99 99
100 void AcquireBleMtuConfigEvent(Kernel::HLERequestContext& ctx) { 100 void AcquireBleMtuConfigEvent(HLERequestContext& ctx) {
101 LOG_WARNING(Service_BTM, "(STUBBED) called"); 101 LOG_WARNING(Service_BTM, "(STUBBED) called");
102 102
103 IPC::ResponseBuilder rb{ctx, 3, 1}; 103 IPC::ResponseBuilder rb{ctx, 3, 1};
@@ -126,7 +126,7 @@ public:
126 } 126 }
127 127
128private: 128private:
129 void GetCore(Kernel::HLERequestContext& ctx) { 129 void GetCore(HLERequestContext& ctx) {
130 LOG_DEBUG(Service_BTM, "called"); 130 LOG_DEBUG(Service_BTM, "called");
131 131
132 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 132 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -307,7 +307,7 @@ public:
307 } 307 }
308 308
309private: 309private:
310 void GetCore(Kernel::HLERequestContext& ctx) { 310 void GetCore(HLERequestContext& ctx) {
311 LOG_DEBUG(Service_BTM, "called"); 311 LOG_DEBUG(Service_BTM, "called");
312 312
313 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 313 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
diff --git a/src/core/hle/service/caps/caps_a.h b/src/core/hle/service/caps/caps_a.h
index 319c173d8..98a21a5ad 100644
--- a/src/core/hle/service/caps/caps_a.h
+++ b/src/core/hle/service/caps/caps_a.h
@@ -9,10 +9,6 @@ namespace Core {
9class System; 9class System;
10} 10}
11 11
12namespace Kernel {
13class HLERequestContext;
14}
15
16namespace Service::Capture { 12namespace Service::Capture {
17 13
18class CAPS_A final : public ServiceFramework<CAPS_A> { 14class CAPS_A final : public ServiceFramework<CAPS_A> {
diff --git a/src/core/hle/service/caps/caps_c.cpp b/src/core/hle/service/caps/caps_c.cpp
index 725a2e3a7..fc77e35cd 100644
--- a/src/core/hle/service/caps/caps_c.cpp
+++ b/src/core/hle/service/caps/caps_c.cpp
@@ -2,8 +2,8 @@
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "common/logging/log.h" 4#include "common/logging/log.h"
5#include "core/hle/ipc_helpers.h"
6#include "core/hle/service/caps/caps_c.h" 5#include "core/hle/service/caps/caps_c.h"
6#include "core/hle/service/ipc_helpers.h"
7 7
8namespace Service::Capture { 8namespace Service::Capture {
9 9
@@ -74,7 +74,7 @@ CAPS_C::CAPS_C(Core::System& system_) : ServiceFramework{system_, "caps:c"} {
74 74
75CAPS_C::~CAPS_C() = default; 75CAPS_C::~CAPS_C() = default;
76 76
77void CAPS_C::SetShimLibraryVersion(Kernel::HLERequestContext& ctx) { 77void CAPS_C::SetShimLibraryVersion(HLERequestContext& ctx) {
78 IPC::RequestParser rp{ctx}; 78 IPC::RequestParser rp{ctx};
79 const auto library_version{rp.Pop<u64>()}; 79 const auto library_version{rp.Pop<u64>()};
80 const auto applet_resource_user_id{rp.Pop<u64>()}; 80 const auto applet_resource_user_id{rp.Pop<u64>()};
diff --git a/src/core/hle/service/caps/caps_c.h b/src/core/hle/service/caps/caps_c.h
index 983a4212d..537b3a2e3 100644
--- a/src/core/hle/service/caps/caps_c.h
+++ b/src/core/hle/service/caps/caps_c.h
@@ -9,10 +9,6 @@ namespace Core {
9class System; 9class System;
10} 10}
11 11
12namespace Kernel {
13class HLERequestContext;
14}
15
16namespace Service::Capture { 12namespace Service::Capture {
17 13
18class CAPS_C final : public ServiceFramework<CAPS_C> { 14class CAPS_C final : public ServiceFramework<CAPS_C> {
@@ -21,7 +17,7 @@ public:
21 ~CAPS_C() override; 17 ~CAPS_C() override;
22 18
23private: 19private:
24 void SetShimLibraryVersion(Kernel::HLERequestContext& ctx); 20 void SetShimLibraryVersion(HLERequestContext& ctx);
25}; 21};
26 22
27} // namespace Service::Capture 23} // namespace Service::Capture
diff --git a/src/core/hle/service/caps/caps_su.cpp b/src/core/hle/service/caps/caps_su.cpp
index fcb496756..3b11cc95c 100644
--- a/src/core/hle/service/caps/caps_su.cpp
+++ b/src/core/hle/service/caps/caps_su.cpp
@@ -2,8 +2,8 @@
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "common/logging/log.h" 4#include "common/logging/log.h"
5#include "core/hle/ipc_helpers.h"
6#include "core/hle/service/caps/caps_su.h" 5#include "core/hle/service/caps/caps_su.h"
6#include "core/hle/service/ipc_helpers.h"
7 7
8namespace Service::Capture { 8namespace Service::Capture {
9 9
@@ -23,7 +23,7 @@ CAPS_SU::CAPS_SU(Core::System& system_) : ServiceFramework{system_, "caps:su"} {
23 23
24CAPS_SU::~CAPS_SU() = default; 24CAPS_SU::~CAPS_SU() = default;
25 25
26void CAPS_SU::SetShimLibraryVersion(Kernel::HLERequestContext& ctx) { 26void CAPS_SU::SetShimLibraryVersion(HLERequestContext& ctx) {
27 IPC::RequestParser rp{ctx}; 27 IPC::RequestParser rp{ctx};
28 const auto library_version{rp.Pop<u64>()}; 28 const auto library_version{rp.Pop<u64>()};
29 const auto applet_resource_user_id{rp.Pop<u64>()}; 29 const auto applet_resource_user_id{rp.Pop<u64>()};
diff --git a/src/core/hle/service/caps/caps_su.h b/src/core/hle/service/caps/caps_su.h
index c9a1d507b..c6398858d 100644
--- a/src/core/hle/service/caps/caps_su.h
+++ b/src/core/hle/service/caps/caps_su.h
@@ -9,10 +9,6 @@ namespace Core {
9class System; 9class System;
10} 10}
11 11
12namespace Kernel {
13class HLERequestContext;
14}
15
16namespace Service::Capture { 12namespace Service::Capture {
17 13
18class CAPS_SU final : public ServiceFramework<CAPS_SU> { 14class CAPS_SU final : public ServiceFramework<CAPS_SU> {
@@ -21,7 +17,7 @@ public:
21 ~CAPS_SU() override; 17 ~CAPS_SU() override;
22 18
23private: 19private:
24 void SetShimLibraryVersion(Kernel::HLERequestContext& ctx); 20 void SetShimLibraryVersion(HLERequestContext& ctx);
25}; 21};
26 22
27} // namespace Service::Capture 23} // namespace Service::Capture
diff --git a/src/core/hle/service/caps/caps_u.cpp b/src/core/hle/service/caps/caps_u.cpp
index 5fbba8673..bffe0f8d0 100644
--- a/src/core/hle/service/caps/caps_u.cpp
+++ b/src/core/hle/service/caps/caps_u.cpp
@@ -2,9 +2,9 @@
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "common/logging/log.h" 4#include "common/logging/log.h"
5#include "core/hle/ipc_helpers.h"
6#include "core/hle/service/caps/caps.h" 5#include "core/hle/service/caps/caps.h"
7#include "core/hle/service/caps/caps_u.h" 6#include "core/hle/service/caps/caps_u.h"
7#include "core/hle/service/ipc_helpers.h"
8 8
9namespace Service::Capture { 9namespace Service::Capture {
10 10
@@ -52,7 +52,7 @@ CAPS_U::CAPS_U(Core::System& system_) : ServiceFramework{system_, "caps:u"} {
52 52
53CAPS_U::~CAPS_U() = default; 53CAPS_U::~CAPS_U() = default;
54 54
55void CAPS_U::SetShimLibraryVersion(Kernel::HLERequestContext& ctx) { 55void CAPS_U::SetShimLibraryVersion(HLERequestContext& ctx) {
56 IPC::RequestParser rp{ctx}; 56 IPC::RequestParser rp{ctx};
57 const auto library_version{rp.Pop<u64>()}; 57 const auto library_version{rp.Pop<u64>()};
58 const auto applet_resource_user_id{rp.Pop<u64>()}; 58 const auto applet_resource_user_id{rp.Pop<u64>()};
@@ -64,7 +64,7 @@ void CAPS_U::SetShimLibraryVersion(Kernel::HLERequestContext& ctx) {
64 rb.Push(ResultSuccess); 64 rb.Push(ResultSuccess);
65} 65}
66 66
67void CAPS_U::GetAlbumContentsFileListForApplication(Kernel::HLERequestContext& ctx) { 67void CAPS_U::GetAlbumContentsFileListForApplication(HLERequestContext& ctx) {
68 // Takes a type-0x6 output buffer containing an array of ApplicationAlbumFileEntry, a PID, an 68 // Takes a type-0x6 output buffer containing an array of ApplicationAlbumFileEntry, a PID, an
69 // u8 ContentType, two s64s, and an u64 AppletResourceUserId. Returns an output u64 for total 69 // u8 ContentType, two s64s, and an u64 AppletResourceUserId. Returns an output u64 for total
70 // output entries (which is copied to a s32 by official SW). 70 // output entries (which is copied to a s32 by official SW).
@@ -93,7 +93,7 @@ void CAPS_U::GetAlbumContentsFileListForApplication(Kernel::HLERequestContext& c
93 rb.Push(total_entries_2); 93 rb.Push(total_entries_2);
94} 94}
95 95
96void CAPS_U::GetAlbumFileList3AaeAruid(Kernel::HLERequestContext& ctx) { 96void CAPS_U::GetAlbumFileList3AaeAruid(HLERequestContext& ctx) {
97 GetAlbumContentsFileListForApplication(ctx); 97 GetAlbumContentsFileListForApplication(ctx);
98} 98}
99 99
diff --git a/src/core/hle/service/caps/caps_u.h b/src/core/hle/service/caps/caps_u.h
index c3d4b9cea..e8dd037d7 100644
--- a/src/core/hle/service/caps/caps_u.h
+++ b/src/core/hle/service/caps/caps_u.h
@@ -9,10 +9,6 @@ namespace Core {
9class System; 9class System;
10} 10}
11 11
12namespace Kernel {
13class HLERequestContext;
14}
15
16namespace Service::Capture { 12namespace Service::Capture {
17 13
18class CAPS_U final : public ServiceFramework<CAPS_U> { 14class CAPS_U final : public ServiceFramework<CAPS_U> {
@@ -21,9 +17,9 @@ public:
21 ~CAPS_U() override; 17 ~CAPS_U() override;
22 18
23private: 19private:
24 void SetShimLibraryVersion(Kernel::HLERequestContext& ctx); 20 void SetShimLibraryVersion(HLERequestContext& ctx);
25 void GetAlbumContentsFileListForApplication(Kernel::HLERequestContext& ctx); 21 void GetAlbumContentsFileListForApplication(HLERequestContext& ctx);
26 void GetAlbumFileList3AaeAruid(Kernel::HLERequestContext& ctx); 22 void GetAlbumFileList3AaeAruid(HLERequestContext& ctx);
27}; 23};
28 24
29} // namespace Service::Capture 25} // namespace Service::Capture
diff --git a/src/core/hle/service/es/es.cpp b/src/core/hle/service/es/es.cpp
index d9736af4e..446f46b3c 100644
--- a/src/core/hle/service/es/es.cpp
+++ b/src/core/hle/service/es/es.cpp
@@ -2,8 +2,8 @@
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "core/crypto/key_manager.h" 4#include "core/crypto/key_manager.h"
5#include "core/hle/ipc_helpers.h"
6#include "core/hle/service/es/es.h" 5#include "core/hle/service/es/es.h"
6#include "core/hle/service/ipc_helpers.h"
7#include "core/hle/service/server_manager.h" 7#include "core/hle/service/server_manager.h"
8#include "core/hle/service/service.h" 8#include "core/hle/service/service.h"
9 9
@@ -110,7 +110,7 @@ public:
110 } 110 }
111 111
112private: 112private:
113 bool CheckRightsId(Kernel::HLERequestContext& ctx, const u128& rights_id) { 113 bool CheckRightsId(HLERequestContext& ctx, const u128& rights_id) {
114 if (rights_id == u128{}) { 114 if (rights_id == u128{}) {
115 LOG_ERROR(Service_ETicket, "The rights ID was invalid!"); 115 LOG_ERROR(Service_ETicket, "The rights ID was invalid!");
116 IPC::ResponseBuilder rb{ctx, 2}; 116 IPC::ResponseBuilder rb{ctx, 2};
@@ -121,7 +121,7 @@ private:
121 return true; 121 return true;
122 } 122 }
123 123
124 void ImportTicket(Kernel::HLERequestContext& ctx) { 124 void ImportTicket(HLERequestContext& ctx) {
125 const auto ticket = ctx.ReadBuffer(); 125 const auto ticket = ctx.ReadBuffer();
126 [[maybe_unused]] const auto cert = ctx.ReadBuffer(1); 126 [[maybe_unused]] const auto cert = ctx.ReadBuffer(1);
127 127
@@ -146,7 +146,7 @@ private:
146 rb.Push(ResultSuccess); 146 rb.Push(ResultSuccess);
147 } 147 }
148 148
149 void GetTitleKey(Kernel::HLERequestContext& ctx) { 149 void GetTitleKey(HLERequestContext& ctx) {
150 IPC::RequestParser rp{ctx}; 150 IPC::RequestParser rp{ctx};
151 const auto rights_id = rp.PopRaw<u128>(); 151 const auto rights_id = rp.PopRaw<u128>();
152 152
@@ -172,7 +172,7 @@ private:
172 rb.Push(ResultSuccess); 172 rb.Push(ResultSuccess);
173 } 173 }
174 174
175 void CountCommonTicket(Kernel::HLERequestContext& ctx) { 175 void CountCommonTicket(HLERequestContext& ctx) {
176 LOG_DEBUG(Service_ETicket, "called"); 176 LOG_DEBUG(Service_ETicket, "called");
177 177
178 const u32 count = static_cast<u32>(keys.GetCommonTickets().size()); 178 const u32 count = static_cast<u32>(keys.GetCommonTickets().size());
@@ -182,7 +182,7 @@ private:
182 rb.Push<u32>(count); 182 rb.Push<u32>(count);
183 } 183 }
184 184
185 void CountPersonalizedTicket(Kernel::HLERequestContext& ctx) { 185 void CountPersonalizedTicket(HLERequestContext& ctx) {
186 LOG_DEBUG(Service_ETicket, "called"); 186 LOG_DEBUG(Service_ETicket, "called");
187 187
188 const u32 count = static_cast<u32>(keys.GetPersonalizedTickets().size()); 188 const u32 count = static_cast<u32>(keys.GetPersonalizedTickets().size());
@@ -192,7 +192,7 @@ private:
192 rb.Push<u32>(count); 192 rb.Push<u32>(count);
193 } 193 }
194 194
195 void ListCommonTicketRightsIds(Kernel::HLERequestContext& ctx) { 195 void ListCommonTicketRightsIds(HLERequestContext& ctx) {
196 size_t out_entries = 0; 196 size_t out_entries = 0;
197 if (!keys.GetCommonTickets().empty()) { 197 if (!keys.GetCommonTickets().empty()) {
198 out_entries = ctx.GetWriteBufferNumElements<u128>(); 198 out_entries = ctx.GetWriteBufferNumElements<u128>();
@@ -213,7 +213,7 @@ private:
213 rb.Push<u32>(static_cast<u32>(out_entries)); 213 rb.Push<u32>(static_cast<u32>(out_entries));
214 } 214 }
215 215
216 void ListPersonalizedTicketRightsIds(Kernel::HLERequestContext& ctx) { 216 void ListPersonalizedTicketRightsIds(HLERequestContext& ctx) {
217 size_t out_entries = 0; 217 size_t out_entries = 0;
218 if (!keys.GetPersonalizedTickets().empty()) { 218 if (!keys.GetPersonalizedTickets().empty()) {
219 out_entries = ctx.GetWriteBufferNumElements<u128>(); 219 out_entries = ctx.GetWriteBufferNumElements<u128>();
@@ -235,7 +235,7 @@ private:
235 rb.Push<u32>(static_cast<u32>(out_entries)); 235 rb.Push<u32>(static_cast<u32>(out_entries));
236 } 236 }
237 237
238 void GetCommonTicketSize(Kernel::HLERequestContext& ctx) { 238 void GetCommonTicketSize(HLERequestContext& ctx) {
239 IPC::RequestParser rp{ctx}; 239 IPC::RequestParser rp{ctx};
240 const auto rights_id = rp.PopRaw<u128>(); 240 const auto rights_id = rp.PopRaw<u128>();
241 241
@@ -251,7 +251,7 @@ private:
251 rb.Push<u64>(ticket.GetSize()); 251 rb.Push<u64>(ticket.GetSize());
252 } 252 }
253 253
254 void GetPersonalizedTicketSize(Kernel::HLERequestContext& ctx) { 254 void GetPersonalizedTicketSize(HLERequestContext& ctx) {
255 IPC::RequestParser rp{ctx}; 255 IPC::RequestParser rp{ctx};
256 const auto rights_id = rp.PopRaw<u128>(); 256 const auto rights_id = rp.PopRaw<u128>();
257 257
@@ -267,7 +267,7 @@ private:
267 rb.Push<u64>(ticket.GetSize()); 267 rb.Push<u64>(ticket.GetSize());
268 } 268 }
269 269
270 void GetCommonTicketData(Kernel::HLERequestContext& ctx) { 270 void GetCommonTicketData(HLERequestContext& ctx) {
271 IPC::RequestParser rp{ctx}; 271 IPC::RequestParser rp{ctx};
272 const auto rights_id = rp.PopRaw<u128>(); 272 const auto rights_id = rp.PopRaw<u128>();
273 273
@@ -286,7 +286,7 @@ private:
286 rb.Push<u64>(write_size); 286 rb.Push<u64>(write_size);
287 } 287 }
288 288
289 void GetPersonalizedTicketData(Kernel::HLERequestContext& ctx) { 289 void GetPersonalizedTicketData(HLERequestContext& ctx) {
290 IPC::RequestParser rp{ctx}; 290 IPC::RequestParser rp{ctx};
291 const auto rights_id = rp.PopRaw<u128>(); 291 const auto rights_id = rp.PopRaw<u128>();
292 292
diff --git a/src/core/hle/service/fatal/fatal.cpp b/src/core/hle/service/fatal/fatal.cpp
index 3b7b636f3..fe2ed8df8 100644
--- a/src/core/hle/service/fatal/fatal.cpp
+++ b/src/core/hle/service/fatal/fatal.cpp
@@ -9,10 +9,10 @@
9#include "common/scm_rev.h" 9#include "common/scm_rev.h"
10#include "common/swap.h" 10#include "common/swap.h"
11#include "core/core.h" 11#include "core/core.h"
12#include "core/hle/ipc_helpers.h"
13#include "core/hle/service/fatal/fatal.h" 12#include "core/hle/service/fatal/fatal.h"
14#include "core/hle/service/fatal/fatal_p.h" 13#include "core/hle/service/fatal/fatal_p.h"
15#include "core/hle/service/fatal/fatal_u.h" 14#include "core/hle/service/fatal/fatal_u.h"
15#include "core/hle/service/ipc_helpers.h"
16#include "core/hle/service/server_manager.h" 16#include "core/hle/service/server_manager.h"
17#include "core/reporter.h" 17#include "core/reporter.h"
18 18
@@ -126,7 +126,7 @@ static void ThrowFatalError(Core::System& system, Result error_code, FatalType f
126 } 126 }
127} 127}
128 128
129void Module::Interface::ThrowFatal(Kernel::HLERequestContext& ctx) { 129void Module::Interface::ThrowFatal(HLERequestContext& ctx) {
130 LOG_ERROR(Service_Fatal, "called"); 130 LOG_ERROR(Service_Fatal, "called");
131 IPC::RequestParser rp{ctx}; 131 IPC::RequestParser rp{ctx};
132 const auto error_code = rp.Pop<Result>(); 132 const auto error_code = rp.Pop<Result>();
@@ -136,7 +136,7 @@ void Module::Interface::ThrowFatal(Kernel::HLERequestContext& ctx) {
136 rb.Push(ResultSuccess); 136 rb.Push(ResultSuccess);
137} 137}
138 138
139void Module::Interface::ThrowFatalWithPolicy(Kernel::HLERequestContext& ctx) { 139void Module::Interface::ThrowFatalWithPolicy(HLERequestContext& ctx) {
140 LOG_ERROR(Service_Fatal, "called"); 140 LOG_ERROR(Service_Fatal, "called");
141 IPC::RequestParser rp(ctx); 141 IPC::RequestParser rp(ctx);
142 const auto error_code = rp.Pop<Result>(); 142 const auto error_code = rp.Pop<Result>();
@@ -148,7 +148,7 @@ void Module::Interface::ThrowFatalWithPolicy(Kernel::HLERequestContext& ctx) {
148 rb.Push(ResultSuccess); 148 rb.Push(ResultSuccess);
149} 149}
150 150
151void Module::Interface::ThrowFatalWithCpuContext(Kernel::HLERequestContext& ctx) { 151void Module::Interface::ThrowFatalWithCpuContext(HLERequestContext& ctx) {
152 LOG_ERROR(Service_Fatal, "called"); 152 LOG_ERROR(Service_Fatal, "called");
153 IPC::RequestParser rp(ctx); 153 IPC::RequestParser rp(ctx);
154 const auto error_code = rp.Pop<Result>(); 154 const auto error_code = rp.Pop<Result>();
diff --git a/src/core/hle/service/fatal/fatal.h b/src/core/hle/service/fatal/fatal.h
index 2e4e4c2f6..f1c110406 100644
--- a/src/core/hle/service/fatal/fatal.h
+++ b/src/core/hle/service/fatal/fatal.h
@@ -19,9 +19,9 @@ public:
19 const char* name); 19 const char* name);
20 ~Interface() override; 20 ~Interface() override;
21 21
22 void ThrowFatal(Kernel::HLERequestContext& ctx); 22 void ThrowFatal(HLERequestContext& ctx);
23 void ThrowFatalWithPolicy(Kernel::HLERequestContext& ctx); 23 void ThrowFatalWithPolicy(HLERequestContext& ctx);
24 void ThrowFatalWithCpuContext(Kernel::HLERequestContext& ctx); 24 void ThrowFatalWithCpuContext(HLERequestContext& ctx);
25 25
26 protected: 26 protected:
27 std::shared_ptr<Module> module; 27 std::shared_ptr<Module> module;
diff --git a/src/core/hle/service/fgm/fgm.cpp b/src/core/hle/service/fgm/fgm.cpp
index 612491270..6b3f77be2 100644
--- a/src/core/hle/service/fgm/fgm.cpp
+++ b/src/core/hle/service/fgm/fgm.cpp
@@ -3,8 +3,8 @@
3 3
4#include <memory> 4#include <memory>
5 5
6#include "core/hle/ipc_helpers.h"
7#include "core/hle/service/fgm/fgm.h" 6#include "core/hle/service/fgm/fgm.h"
7#include "core/hle/service/ipc_helpers.h"
8#include "core/hle/service/server_manager.h" 8#include "core/hle/service/server_manager.h"
9#include "core/hle/service/service.h" 9#include "core/hle/service/service.h"
10#include "core/hle/service/sm/sm.h" 10#include "core/hle/service/sm/sm.h"
@@ -40,7 +40,7 @@ public:
40 } 40 }
41 41
42private: 42private:
43 void Initialize(Kernel::HLERequestContext& ctx) { 43 void Initialize(HLERequestContext& ctx) {
44 LOG_DEBUG(Service_FGM, "called"); 44 LOG_DEBUG(Service_FGM, "called");
45 45
46 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 46 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp
index 89eddb510..9e559d97e 100644
--- a/src/core/hle/service/filesystem/fsp_srv.cpp
+++ b/src/core/hle/service/filesystem/fsp_srv.cpp
@@ -24,9 +24,9 @@
24#include "core/file_sys/savedata_factory.h" 24#include "core/file_sys/savedata_factory.h"
25#include "core/file_sys/system_archive/system_archive.h" 25#include "core/file_sys/system_archive/system_archive.h"
26#include "core/file_sys/vfs.h" 26#include "core/file_sys/vfs.h"
27#include "core/hle/ipc_helpers.h"
28#include "core/hle/service/filesystem/filesystem.h" 27#include "core/hle/service/filesystem/filesystem.h"
29#include "core/hle/service/filesystem/fsp_srv.h" 28#include "core/hle/service/filesystem/fsp_srv.h"
29#include "core/hle/service/ipc_helpers.h"
30#include "core/reporter.h" 30#include "core/reporter.h"
31 31
32namespace Service::FileSystem { 32namespace Service::FileSystem {
@@ -72,7 +72,7 @@ public:
72private: 72private:
73 FileSys::VirtualFile backend; 73 FileSys::VirtualFile backend;
74 74
75 void Read(Kernel::HLERequestContext& ctx) { 75 void Read(HLERequestContext& ctx) {
76 IPC::RequestParser rp{ctx}; 76 IPC::RequestParser rp{ctx};
77 const s64 offset = rp.Pop<s64>(); 77 const s64 offset = rp.Pop<s64>();
78 const s64 length = rp.Pop<s64>(); 78 const s64 length = rp.Pop<s64>();
@@ -102,7 +102,7 @@ private:
102 rb.Push(ResultSuccess); 102 rb.Push(ResultSuccess);
103 } 103 }
104 104
105 void GetSize(Kernel::HLERequestContext& ctx) { 105 void GetSize(HLERequestContext& ctx) {
106 const u64 size = backend->GetSize(); 106 const u64 size = backend->GetSize();
107 LOG_DEBUG(Service_FS, "called, size={}", size); 107 LOG_DEBUG(Service_FS, "called, size={}", size);
108 108
@@ -131,7 +131,7 @@ public:
131private: 131private:
132 FileSys::VirtualFile backend; 132 FileSys::VirtualFile backend;
133 133
134 void Read(Kernel::HLERequestContext& ctx) { 134 void Read(HLERequestContext& ctx) {
135 IPC::RequestParser rp{ctx}; 135 IPC::RequestParser rp{ctx};
136 const u64 option = rp.Pop<u64>(); 136 const u64 option = rp.Pop<u64>();
137 const s64 offset = rp.Pop<s64>(); 137 const s64 offset = rp.Pop<s64>();
@@ -165,7 +165,7 @@ private:
165 rb.Push(static_cast<u64>(output.size())); 165 rb.Push(static_cast<u64>(output.size()));
166 } 166 }
167 167
168 void Write(Kernel::HLERequestContext& ctx) { 168 void Write(HLERequestContext& ctx) {
169 IPC::RequestParser rp{ctx}; 169 IPC::RequestParser rp{ctx};
170 const u64 option = rp.Pop<u64>(); 170 const u64 option = rp.Pop<u64>();
171 const s64 offset = rp.Pop<s64>(); 171 const s64 offset = rp.Pop<s64>();
@@ -208,7 +208,7 @@ private:
208 rb.Push(ResultSuccess); 208 rb.Push(ResultSuccess);
209 } 209 }
210 210
211 void Flush(Kernel::HLERequestContext& ctx) { 211 void Flush(HLERequestContext& ctx) {
212 LOG_DEBUG(Service_FS, "called"); 212 LOG_DEBUG(Service_FS, "called");
213 213
214 // Exists for SDK compatibiltity -- No need to flush file. 214 // Exists for SDK compatibiltity -- No need to flush file.
@@ -217,7 +217,7 @@ private:
217 rb.Push(ResultSuccess); 217 rb.Push(ResultSuccess);
218 } 218 }
219 219
220 void SetSize(Kernel::HLERequestContext& ctx) { 220 void SetSize(HLERequestContext& ctx) {
221 IPC::RequestParser rp{ctx}; 221 IPC::RequestParser rp{ctx};
222 const u64 size = rp.Pop<u64>(); 222 const u64 size = rp.Pop<u64>();
223 LOG_DEBUG(Service_FS, "called, size={}", size); 223 LOG_DEBUG(Service_FS, "called, size={}", size);
@@ -228,7 +228,7 @@ private:
228 rb.Push(ResultSuccess); 228 rb.Push(ResultSuccess);
229 } 229 }
230 230
231 void GetSize(Kernel::HLERequestContext& ctx) { 231 void GetSize(HLERequestContext& ctx) {
232 const u64 size = backend->GetSize(); 232 const u64 size = backend->GetSize();
233 LOG_DEBUG(Service_FS, "called, size={}", size); 233 LOG_DEBUG(Service_FS, "called, size={}", size);
234 234
@@ -270,7 +270,7 @@ private:
270 std::vector<FileSys::Entry> entries; 270 std::vector<FileSys::Entry> entries;
271 u64 next_entry_index = 0; 271 u64 next_entry_index = 0;
272 272
273 void Read(Kernel::HLERequestContext& ctx) { 273 void Read(HLERequestContext& ctx) {
274 LOG_DEBUG(Service_FS, "called."); 274 LOG_DEBUG(Service_FS, "called.");
275 275
276 // Calculate how many entries we can fit in the output buffer 276 // Calculate how many entries we can fit in the output buffer
@@ -294,7 +294,7 @@ private:
294 rb.Push(actual_entries); 294 rb.Push(actual_entries);
295 } 295 }
296 296
297 void GetEntryCount(Kernel::HLERequestContext& ctx) { 297 void GetEntryCount(HLERequestContext& ctx) {
298 LOG_DEBUG(Service_FS, "called"); 298 LOG_DEBUG(Service_FS, "called");
299 299
300 u64 count = entries.size() - next_entry_index; 300 u64 count = entries.size() - next_entry_index;
@@ -331,7 +331,7 @@ public:
331 RegisterHandlers(functions); 331 RegisterHandlers(functions);
332 } 332 }
333 333
334 void CreateFile(Kernel::HLERequestContext& ctx) { 334 void CreateFile(HLERequestContext& ctx) {
335 IPC::RequestParser rp{ctx}; 335 IPC::RequestParser rp{ctx};
336 336
337 const auto file_buffer = ctx.ReadBuffer(); 337 const auto file_buffer = ctx.ReadBuffer();
@@ -347,7 +347,7 @@ public:
347 rb.Push(backend.CreateFile(name, file_size)); 347 rb.Push(backend.CreateFile(name, file_size));
348 } 348 }
349 349
350 void DeleteFile(Kernel::HLERequestContext& ctx) { 350 void DeleteFile(HLERequestContext& ctx) {
351 const auto file_buffer = ctx.ReadBuffer(); 351 const auto file_buffer = ctx.ReadBuffer();
352 const std::string name = Common::StringFromBuffer(file_buffer); 352 const std::string name = Common::StringFromBuffer(file_buffer);
353 353
@@ -357,7 +357,7 @@ public:
357 rb.Push(backend.DeleteFile(name)); 357 rb.Push(backend.DeleteFile(name));
358 } 358 }
359 359
360 void CreateDirectory(Kernel::HLERequestContext& ctx) { 360 void CreateDirectory(HLERequestContext& ctx) {
361 const auto file_buffer = ctx.ReadBuffer(); 361 const auto file_buffer = ctx.ReadBuffer();
362 const std::string name = Common::StringFromBuffer(file_buffer); 362 const std::string name = Common::StringFromBuffer(file_buffer);
363 363
@@ -367,7 +367,7 @@ public:
367 rb.Push(backend.CreateDirectory(name)); 367 rb.Push(backend.CreateDirectory(name));
368 } 368 }
369 369
370 void DeleteDirectory(Kernel::HLERequestContext& ctx) { 370 void DeleteDirectory(HLERequestContext& ctx) {
371 const auto file_buffer = ctx.ReadBuffer(); 371 const auto file_buffer = ctx.ReadBuffer();
372 const std::string name = Common::StringFromBuffer(file_buffer); 372 const std::string name = Common::StringFromBuffer(file_buffer);
373 373
@@ -377,7 +377,7 @@ public:
377 rb.Push(backend.DeleteDirectory(name)); 377 rb.Push(backend.DeleteDirectory(name));
378 } 378 }
379 379
380 void DeleteDirectoryRecursively(Kernel::HLERequestContext& ctx) { 380 void DeleteDirectoryRecursively(HLERequestContext& ctx) {
381 const auto file_buffer = ctx.ReadBuffer(); 381 const auto file_buffer = ctx.ReadBuffer();
382 const std::string name = Common::StringFromBuffer(file_buffer); 382 const std::string name = Common::StringFromBuffer(file_buffer);
383 383
@@ -387,7 +387,7 @@ public:
387 rb.Push(backend.DeleteDirectoryRecursively(name)); 387 rb.Push(backend.DeleteDirectoryRecursively(name));
388 } 388 }
389 389
390 void CleanDirectoryRecursively(Kernel::HLERequestContext& ctx) { 390 void CleanDirectoryRecursively(HLERequestContext& ctx) {
391 const auto file_buffer = ctx.ReadBuffer(); 391 const auto file_buffer = ctx.ReadBuffer();
392 const std::string name = Common::StringFromBuffer(file_buffer); 392 const std::string name = Common::StringFromBuffer(file_buffer);
393 393
@@ -397,7 +397,7 @@ public:
397 rb.Push(backend.CleanDirectoryRecursively(name)); 397 rb.Push(backend.CleanDirectoryRecursively(name));
398 } 398 }
399 399
400 void RenameFile(Kernel::HLERequestContext& ctx) { 400 void RenameFile(HLERequestContext& ctx) {
401 const std::string src_name = Common::StringFromBuffer(ctx.ReadBuffer(0)); 401 const std::string src_name = Common::StringFromBuffer(ctx.ReadBuffer(0));
402 const std::string dst_name = Common::StringFromBuffer(ctx.ReadBuffer(1)); 402 const std::string dst_name = Common::StringFromBuffer(ctx.ReadBuffer(1));
403 403
@@ -407,7 +407,7 @@ public:
407 rb.Push(backend.RenameFile(src_name, dst_name)); 407 rb.Push(backend.RenameFile(src_name, dst_name));
408 } 408 }
409 409
410 void OpenFile(Kernel::HLERequestContext& ctx) { 410 void OpenFile(HLERequestContext& ctx) {
411 IPC::RequestParser rp{ctx}; 411 IPC::RequestParser rp{ctx};
412 412
413 const auto file_buffer = ctx.ReadBuffer(); 413 const auto file_buffer = ctx.ReadBuffer();
@@ -431,7 +431,7 @@ public:
431 rb.PushIpcInterface<IFile>(std::move(file)); 431 rb.PushIpcInterface<IFile>(std::move(file));
432 } 432 }
433 433
434 void OpenDirectory(Kernel::HLERequestContext& ctx) { 434 void OpenDirectory(HLERequestContext& ctx) {
435 IPC::RequestParser rp{ctx}; 435 IPC::RequestParser rp{ctx};
436 436
437 const auto file_buffer = ctx.ReadBuffer(); 437 const auto file_buffer = ctx.ReadBuffer();
@@ -456,7 +456,7 @@ public:
456 rb.PushIpcInterface<IDirectory>(std::move(directory)); 456 rb.PushIpcInterface<IDirectory>(std::move(directory));
457 } 457 }
458 458
459 void GetEntryType(Kernel::HLERequestContext& ctx) { 459 void GetEntryType(HLERequestContext& ctx) {
460 const auto file_buffer = ctx.ReadBuffer(); 460 const auto file_buffer = ctx.ReadBuffer();
461 const std::string name = Common::StringFromBuffer(file_buffer); 461 const std::string name = Common::StringFromBuffer(file_buffer);
462 462
@@ -474,14 +474,14 @@ public:
474 rb.Push<u32>(static_cast<u32>(*result)); 474 rb.Push<u32>(static_cast<u32>(*result));
475 } 475 }
476 476
477 void Commit(Kernel::HLERequestContext& ctx) { 477 void Commit(HLERequestContext& ctx) {
478 LOG_WARNING(Service_FS, "(STUBBED) called"); 478 LOG_WARNING(Service_FS, "(STUBBED) called");
479 479
480 IPC::ResponseBuilder rb{ctx, 2}; 480 IPC::ResponseBuilder rb{ctx, 2};
481 rb.Push(ResultSuccess); 481 rb.Push(ResultSuccess);
482 } 482 }
483 483
484 void GetFreeSpaceSize(Kernel::HLERequestContext& ctx) { 484 void GetFreeSpaceSize(HLERequestContext& ctx) {
485 LOG_DEBUG(Service_FS, "called"); 485 LOG_DEBUG(Service_FS, "called");
486 486
487 IPC::ResponseBuilder rb{ctx, 4}; 487 IPC::ResponseBuilder rb{ctx, 4};
@@ -489,7 +489,7 @@ public:
489 rb.Push(size.get_free_size()); 489 rb.Push(size.get_free_size());
490 } 490 }
491 491
492 void GetTotalSpaceSize(Kernel::HLERequestContext& ctx) { 492 void GetTotalSpaceSize(HLERequestContext& ctx) {
493 LOG_DEBUG(Service_FS, "called"); 493 LOG_DEBUG(Service_FS, "called");
494 494
495 IPC::ResponseBuilder rb{ctx, 4}; 495 IPC::ResponseBuilder rb{ctx, 4};
@@ -497,7 +497,7 @@ public:
497 rb.Push(size.get_total_size()); 497 rb.Push(size.get_total_size());
498 } 498 }
499 499
500 void GetFileTimeStampRaw(Kernel::HLERequestContext& ctx) { 500 void GetFileTimeStampRaw(HLERequestContext& ctx) {
501 const auto file_buffer = ctx.ReadBuffer(); 501 const auto file_buffer = ctx.ReadBuffer();
502 const std::string name = Common::StringFromBuffer(file_buffer); 502 const std::string name = Common::StringFromBuffer(file_buffer);
503 503
@@ -533,7 +533,7 @@ public:
533 FindAllSaves(space); 533 FindAllSaves(space);
534 } 534 }
535 535
536 void ReadSaveDataInfo(Kernel::HLERequestContext& ctx) { 536 void ReadSaveDataInfo(HLERequestContext& ctx) {
537 LOG_DEBUG(Service_FS, "called"); 537 LOG_DEBUG(Service_FS, "called");
538 538
539 // Calculate how many entries we can fit in the output buffer 539 // Calculate how many entries we can fit in the output buffer
@@ -811,7 +811,7 @@ FSP_SRV::FSP_SRV(Core::System& system_)
811 811
812FSP_SRV::~FSP_SRV() = default; 812FSP_SRV::~FSP_SRV() = default;
813 813
814void FSP_SRV::SetCurrentProcess(Kernel::HLERequestContext& ctx) { 814void FSP_SRV::SetCurrentProcess(HLERequestContext& ctx) {
815 IPC::RequestParser rp{ctx}; 815 IPC::RequestParser rp{ctx};
816 current_process_id = rp.Pop<u64>(); 816 current_process_id = rp.Pop<u64>();
817 817
@@ -821,7 +821,7 @@ void FSP_SRV::SetCurrentProcess(Kernel::HLERequestContext& ctx) {
821 rb.Push(ResultSuccess); 821 rb.Push(ResultSuccess);
822} 822}
823 823
824void FSP_SRV::OpenFileSystemWithPatch(Kernel::HLERequestContext& ctx) { 824void FSP_SRV::OpenFileSystemWithPatch(HLERequestContext& ctx) {
825 IPC::RequestParser rp{ctx}; 825 IPC::RequestParser rp{ctx};
826 826
827 const auto type = rp.PopRaw<FileSystemType>(); 827 const auto type = rp.PopRaw<FileSystemType>();
@@ -832,7 +832,7 @@ void FSP_SRV::OpenFileSystemWithPatch(Kernel::HLERequestContext& ctx) {
832 rb.Push(ResultUnknown); 832 rb.Push(ResultUnknown);
833} 833}
834 834
835void FSP_SRV::OpenSdCardFileSystem(Kernel::HLERequestContext& ctx) { 835void FSP_SRV::OpenSdCardFileSystem(HLERequestContext& ctx) {
836 LOG_DEBUG(Service_FS, "called"); 836 LOG_DEBUG(Service_FS, "called");
837 837
838 auto filesystem = 838 auto filesystem =
@@ -844,7 +844,7 @@ void FSP_SRV::OpenSdCardFileSystem(Kernel::HLERequestContext& ctx) {
844 rb.PushIpcInterface<IFileSystem>(std::move(filesystem)); 844 rb.PushIpcInterface<IFileSystem>(std::move(filesystem));
845} 845}
846 846
847void FSP_SRV::CreateSaveDataFileSystem(Kernel::HLERequestContext& ctx) { 847void FSP_SRV::CreateSaveDataFileSystem(HLERequestContext& ctx) {
848 IPC::RequestParser rp{ctx}; 848 IPC::RequestParser rp{ctx};
849 849
850 auto save_struct = rp.PopRaw<FileSys::SaveDataAttribute>(); 850 auto save_struct = rp.PopRaw<FileSys::SaveDataAttribute>();
@@ -860,7 +860,7 @@ void FSP_SRV::CreateSaveDataFileSystem(Kernel::HLERequestContext& ctx) {
860 rb.Push(ResultSuccess); 860 rb.Push(ResultSuccess);
861} 861}
862 862
863void FSP_SRV::OpenSaveDataFileSystem(Kernel::HLERequestContext& ctx) { 863void FSP_SRV::OpenSaveDataFileSystem(HLERequestContext& ctx) {
864 IPC::RequestParser rp{ctx}; 864 IPC::RequestParser rp{ctx};
865 865
866 struct Parameters { 866 struct Parameters {
@@ -905,12 +905,12 @@ void FSP_SRV::OpenSaveDataFileSystem(Kernel::HLERequestContext& ctx) {
905 rb.PushIpcInterface<IFileSystem>(std::move(filesystem)); 905 rb.PushIpcInterface<IFileSystem>(std::move(filesystem));
906} 906}
907 907
908void FSP_SRV::OpenReadOnlySaveDataFileSystem(Kernel::HLERequestContext& ctx) { 908void FSP_SRV::OpenReadOnlySaveDataFileSystem(HLERequestContext& ctx) {
909 LOG_WARNING(Service_FS, "(STUBBED) called, delegating to 51 OpenSaveDataFilesystem"); 909 LOG_WARNING(Service_FS, "(STUBBED) called, delegating to 51 OpenSaveDataFilesystem");
910 OpenSaveDataFileSystem(ctx); 910 OpenSaveDataFileSystem(ctx);
911} 911}
912 912
913void FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId(Kernel::HLERequestContext& ctx) { 913void FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId(HLERequestContext& ctx) {
914 IPC::RequestParser rp{ctx}; 914 IPC::RequestParser rp{ctx};
915 const auto space = rp.PopRaw<FileSys::SaveDataSpaceId>(); 915 const auto space = rp.PopRaw<FileSys::SaveDataSpaceId>();
916 LOG_INFO(Service_FS, "called, space={}", space); 916 LOG_INFO(Service_FS, "called, space={}", space);
@@ -921,15 +921,14 @@ void FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId(Kernel::HLERequestContext&
921 std::make_shared<ISaveDataInfoReader>(system, space, fsc)); 921 std::make_shared<ISaveDataInfoReader>(system, space, fsc));
922} 922}
923 923
924void FSP_SRV::WriteSaveDataFileSystemExtraDataBySaveDataAttribute(Kernel::HLERequestContext& ctx) { 924void FSP_SRV::WriteSaveDataFileSystemExtraDataBySaveDataAttribute(HLERequestContext& ctx) {
925 LOG_WARNING(Service_FS, "(STUBBED) called."); 925 LOG_WARNING(Service_FS, "(STUBBED) called.");
926 926
927 IPC::ResponseBuilder rb{ctx, 2}; 927 IPC::ResponseBuilder rb{ctx, 2};
928 rb.Push(ResultSuccess); 928 rb.Push(ResultSuccess);
929} 929}
930 930
931void FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute( 931void FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute(HLERequestContext& ctx) {
932 Kernel::HLERequestContext& ctx) {
933 IPC::RequestParser rp{ctx}; 932 IPC::RequestParser rp{ctx};
934 933
935 struct Parameters { 934 struct Parameters {
@@ -955,7 +954,7 @@ void FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute(
955 rb.Push(flags); 954 rb.Push(flags);
956} 955}
957 956
958void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) { 957void FSP_SRV::OpenDataStorageByCurrentProcess(HLERequestContext& ctx) {
959 LOG_DEBUG(Service_FS, "called"); 958 LOG_DEBUG(Service_FS, "called");
960 959
961 auto current_romfs = fsc.OpenRomFSCurrentProcess(); 960 auto current_romfs = fsc.OpenRomFSCurrentProcess();
@@ -974,7 +973,7 @@ void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) {
974 rb.PushIpcInterface<IStorage>(std::move(storage)); 973 rb.PushIpcInterface<IStorage>(std::move(storage));
975} 974}
976 975
977void FSP_SRV::OpenDataStorageByDataId(Kernel::HLERequestContext& ctx) { 976void FSP_SRV::OpenDataStorageByDataId(HLERequestContext& ctx) {
978 IPC::RequestParser rp{ctx}; 977 IPC::RequestParser rp{ctx};
979 const auto storage_id = rp.PopRaw<FileSys::StorageId>(); 978 const auto storage_id = rp.PopRaw<FileSys::StorageId>();
980 const auto unknown = rp.PopRaw<u32>(); 979 const auto unknown = rp.PopRaw<u32>();
@@ -1014,7 +1013,7 @@ void FSP_SRV::OpenDataStorageByDataId(Kernel::HLERequestContext& ctx) {
1014 rb.PushIpcInterface<IStorage>(std::move(storage)); 1013 rb.PushIpcInterface<IStorage>(std::move(storage));
1015} 1014}
1016 1015
1017void FSP_SRV::OpenPatchDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) { 1016void FSP_SRV::OpenPatchDataStorageByCurrentProcess(HLERequestContext& ctx) {
1018 IPC::RequestParser rp{ctx}; 1017 IPC::RequestParser rp{ctx};
1019 1018
1020 const auto storage_id = rp.PopRaw<FileSys::StorageId>(); 1019 const auto storage_id = rp.PopRaw<FileSys::StorageId>();
@@ -1026,7 +1025,7 @@ void FSP_SRV::OpenPatchDataStorageByCurrentProcess(Kernel::HLERequestContext& ct
1026 rb.Push(FileSys::ERROR_ENTITY_NOT_FOUND); 1025 rb.Push(FileSys::ERROR_ENTITY_NOT_FOUND);
1027} 1026}
1028 1027
1029void FSP_SRV::OpenDataStorageWithProgramIndex(Kernel::HLERequestContext& ctx) { 1028void FSP_SRV::OpenDataStorageWithProgramIndex(HLERequestContext& ctx) {
1030 IPC::RequestParser rp{ctx}; 1029 IPC::RequestParser rp{ctx};
1031 1030
1032 const auto program_index = rp.PopRaw<u8>(); 1031 const auto program_index = rp.PopRaw<u8>();
@@ -1053,7 +1052,7 @@ void FSP_SRV::OpenDataStorageWithProgramIndex(Kernel::HLERequestContext& ctx) {
1053 rb.PushIpcInterface<IStorage>(std::move(storage)); 1052 rb.PushIpcInterface<IStorage>(std::move(storage));
1054} 1053}
1055 1054
1056void FSP_SRV::DisableAutoSaveDataCreation(Kernel::HLERequestContext& ctx) { 1055void FSP_SRV::DisableAutoSaveDataCreation(HLERequestContext& ctx) {
1057 LOG_DEBUG(Service_FS, "called"); 1056 LOG_DEBUG(Service_FS, "called");
1058 1057
1059 fsc.SetAutoSaveDataCreation(false); 1058 fsc.SetAutoSaveDataCreation(false);
@@ -1062,7 +1061,7 @@ void FSP_SRV::DisableAutoSaveDataCreation(Kernel::HLERequestContext& ctx) {
1062 rb.Push(ResultSuccess); 1061 rb.Push(ResultSuccess);
1063} 1062}
1064 1063
1065void FSP_SRV::SetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) { 1064void FSP_SRV::SetGlobalAccessLogMode(HLERequestContext& ctx) {
1066 IPC::RequestParser rp{ctx}; 1065 IPC::RequestParser rp{ctx};
1067 access_log_mode = rp.PopEnum<AccessLogMode>(); 1066 access_log_mode = rp.PopEnum<AccessLogMode>();
1068 1067
@@ -1072,7 +1071,7 @@ void FSP_SRV::SetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) {
1072 rb.Push(ResultSuccess); 1071 rb.Push(ResultSuccess);
1073} 1072}
1074 1073
1075void FSP_SRV::GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) { 1074void FSP_SRV::GetGlobalAccessLogMode(HLERequestContext& ctx) {
1076 LOG_DEBUG(Service_FS, "called"); 1075 LOG_DEBUG(Service_FS, "called");
1077 1076
1078 IPC::ResponseBuilder rb{ctx, 3}; 1077 IPC::ResponseBuilder rb{ctx, 3};
@@ -1080,7 +1079,7 @@ void FSP_SRV::GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) {
1080 rb.PushEnum(access_log_mode); 1079 rb.PushEnum(access_log_mode);
1081} 1080}
1082 1081
1083void FSP_SRV::OutputAccessLogToSdCard(Kernel::HLERequestContext& ctx) { 1082void FSP_SRV::OutputAccessLogToSdCard(HLERequestContext& ctx) {
1084 const auto raw = ctx.ReadBufferCopy(); 1083 const auto raw = ctx.ReadBufferCopy();
1085 auto log = Common::StringFromFixedZeroTerminatedBuffer( 1084 auto log = Common::StringFromFixedZeroTerminatedBuffer(
1086 reinterpret_cast<const char*>(raw.data()), raw.size()); 1085 reinterpret_cast<const char*>(raw.data()), raw.size());
@@ -1093,7 +1092,7 @@ void FSP_SRV::OutputAccessLogToSdCard(Kernel::HLERequestContext& ctx) {
1093 rb.Push(ResultSuccess); 1092 rb.Push(ResultSuccess);
1094} 1093}
1095 1094
1096void FSP_SRV::GetProgramIndexForAccessLog(Kernel::HLERequestContext& ctx) { 1095void FSP_SRV::GetProgramIndexForAccessLog(HLERequestContext& ctx) {
1097 LOG_DEBUG(Service_FS, "called"); 1096 LOG_DEBUG(Service_FS, "called");
1098 1097
1099 IPC::ResponseBuilder rb{ctx, 4}; 1098 IPC::ResponseBuilder rb{ctx, 4};
@@ -1102,7 +1101,7 @@ void FSP_SRV::GetProgramIndexForAccessLog(Kernel::HLERequestContext& ctx) {
1102 rb.Push(access_log_program_index); 1101 rb.Push(access_log_program_index);
1103} 1102}
1104 1103
1105void FSP_SRV::GetCacheStorageSize(Kernel::HLERequestContext& ctx) { 1104void FSP_SRV::GetCacheStorageSize(HLERequestContext& ctx) {
1106 IPC::RequestParser rp{ctx}; 1105 IPC::RequestParser rp{ctx};
1107 const auto index{rp.Pop<s32>()}; 1106 const auto index{rp.Pop<s32>()};
1108 1107
@@ -1128,14 +1127,14 @@ public:
1128private: 1127private:
1129 FileSys::VirtualFile backend; 1128 FileSys::VirtualFile backend;
1130 1129
1131 void Add(Kernel::HLERequestContext& ctx) { 1130 void Add(HLERequestContext& ctx) {
1132 LOG_WARNING(Service_FS, "(STUBBED) called"); 1131 LOG_WARNING(Service_FS, "(STUBBED) called");
1133 1132
1134 IPC::ResponseBuilder rb{ctx, 2}; 1133 IPC::ResponseBuilder rb{ctx, 2};
1135 rb.Push(ResultSuccess); 1134 rb.Push(ResultSuccess);
1136 } 1135 }
1137 1136
1138 void Commit(Kernel::HLERequestContext& ctx) { 1137 void Commit(HLERequestContext& ctx) {
1139 LOG_WARNING(Service_FS, "(STUBBED) called"); 1138 LOG_WARNING(Service_FS, "(STUBBED) called");
1140 1139
1141 IPC::ResponseBuilder rb{ctx, 2}; 1140 IPC::ResponseBuilder rb{ctx, 2};
@@ -1143,7 +1142,7 @@ private:
1143 } 1142 }
1144}; 1143};
1145 1144
1146void FSP_SRV::OpenMultiCommitManager(Kernel::HLERequestContext& ctx) { 1145void FSP_SRV::OpenMultiCommitManager(HLERequestContext& ctx) {
1147 LOG_DEBUG(Service_FS, "called"); 1146 LOG_DEBUG(Service_FS, "called");
1148 1147
1149 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 1148 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
diff --git a/src/core/hle/service/filesystem/fsp_srv.h b/src/core/hle/service/filesystem/fsp_srv.h
index 3d88b97f9..49f17c7c3 100644
--- a/src/core/hle/service/filesystem/fsp_srv.h
+++ b/src/core/hle/service/filesystem/fsp_srv.h
@@ -35,26 +35,26 @@ public:
35 ~FSP_SRV() override; 35 ~FSP_SRV() override;
36 36
37private: 37private:
38 void SetCurrentProcess(Kernel::HLERequestContext& ctx); 38 void SetCurrentProcess(HLERequestContext& ctx);
39 void OpenFileSystemWithPatch(Kernel::HLERequestContext& ctx); 39 void OpenFileSystemWithPatch(HLERequestContext& ctx);
40 void OpenSdCardFileSystem(Kernel::HLERequestContext& ctx); 40 void OpenSdCardFileSystem(HLERequestContext& ctx);
41 void CreateSaveDataFileSystem(Kernel::HLERequestContext& ctx); 41 void CreateSaveDataFileSystem(HLERequestContext& ctx);
42 void OpenSaveDataFileSystem(Kernel::HLERequestContext& ctx); 42 void OpenSaveDataFileSystem(HLERequestContext& ctx);
43 void OpenReadOnlySaveDataFileSystem(Kernel::HLERequestContext& ctx); 43 void OpenReadOnlySaveDataFileSystem(HLERequestContext& ctx);
44 void OpenSaveDataInfoReaderBySaveDataSpaceId(Kernel::HLERequestContext& ctx); 44 void OpenSaveDataInfoReaderBySaveDataSpaceId(HLERequestContext& ctx);
45 void WriteSaveDataFileSystemExtraDataBySaveDataAttribute(Kernel::HLERequestContext& ctx); 45 void WriteSaveDataFileSystemExtraDataBySaveDataAttribute(HLERequestContext& ctx);
46 void ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute(Kernel::HLERequestContext& ctx); 46 void ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute(HLERequestContext& ctx);
47 void OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx); 47 void OpenDataStorageByCurrentProcess(HLERequestContext& ctx);
48 void OpenDataStorageByDataId(Kernel::HLERequestContext& ctx); 48 void OpenDataStorageByDataId(HLERequestContext& ctx);
49 void OpenPatchDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx); 49 void OpenPatchDataStorageByCurrentProcess(HLERequestContext& ctx);
50 void OpenDataStorageWithProgramIndex(Kernel::HLERequestContext& ctx); 50 void OpenDataStorageWithProgramIndex(HLERequestContext& ctx);
51 void DisableAutoSaveDataCreation(Kernel::HLERequestContext& ctx); 51 void DisableAutoSaveDataCreation(HLERequestContext& ctx);
52 void SetGlobalAccessLogMode(Kernel::HLERequestContext& ctx); 52 void SetGlobalAccessLogMode(HLERequestContext& ctx);
53 void GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx); 53 void GetGlobalAccessLogMode(HLERequestContext& ctx);
54 void OutputAccessLogToSdCard(Kernel::HLERequestContext& ctx); 54 void OutputAccessLogToSdCard(HLERequestContext& ctx);
55 void GetProgramIndexForAccessLog(Kernel::HLERequestContext& ctx); 55 void GetProgramIndexForAccessLog(HLERequestContext& ctx);
56 void OpenMultiCommitManager(Kernel::HLERequestContext& ctx); 56 void OpenMultiCommitManager(HLERequestContext& ctx);
57 void GetCacheStorageSize(Kernel::HLERequestContext& ctx); 57 void GetCacheStorageSize(HLERequestContext& ctx);
58 58
59 FileSystemController& fsc; 59 FileSystemController& fsc;
60 const FileSys::ContentProvider& content_provider; 60 const FileSys::ContentProvider& content_provider;
diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp
index fcf10bfeb..447deab8b 100644
--- a/src/core/hle/service/friend/friend.cpp
+++ b/src/core/hle/service/friend/friend.cpp
@@ -5,11 +5,11 @@
5#include "common/logging/log.h" 5#include "common/logging/log.h"
6#include "common/uuid.h" 6#include "common/uuid.h"
7#include "core/core.h" 7#include "core/core.h"
8#include "core/hle/ipc_helpers.h"
9#include "core/hle/kernel/k_event.h" 8#include "core/hle/kernel/k_event.h"
10#include "core/hle/service/friend/errors.h" 9#include "core/hle/service/friend/errors.h"
11#include "core/hle/service/friend/friend.h" 10#include "core/hle/service/friend/friend.h"
12#include "core/hle/service/friend/friend_interface.h" 11#include "core/hle/service/friend/friend_interface.h"
12#include "core/hle/service/ipc_helpers.h"
13#include "core/hle/service/kernel_helpers.h" 13#include "core/hle/service/kernel_helpers.h"
14#include "core/hle/service/server_manager.h" 14#include "core/hle/service/server_manager.h"
15 15
@@ -136,7 +136,7 @@ private:
136 }; 136 };
137 static_assert(sizeof(SizedFriendFilter) == 0x10, "SizedFriendFilter is an invalid size"); 137 static_assert(sizeof(SizedFriendFilter) == 0x10, "SizedFriendFilter is an invalid size");
138 138
139 void GetCompletionEvent(Kernel::HLERequestContext& ctx) { 139 void GetCompletionEvent(HLERequestContext& ctx) {
140 LOG_DEBUG(Service_Friend, "called"); 140 LOG_DEBUG(Service_Friend, "called");
141 141
142 IPC::ResponseBuilder rb{ctx, 2, 1}; 142 IPC::ResponseBuilder rb{ctx, 2, 1};
@@ -144,7 +144,7 @@ private:
144 rb.PushCopyObjects(completion_event->GetReadableEvent()); 144 rb.PushCopyObjects(completion_event->GetReadableEvent());
145 } 145 }
146 146
147 void GetBlockedUserListIds(Kernel::HLERequestContext& ctx) { 147 void GetBlockedUserListIds(HLERequestContext& ctx) {
148 // This is safe to stub, as there should be no adverse consequences from reporting no 148 // This is safe to stub, as there should be no adverse consequences from reporting no
149 // blocked users. 149 // blocked users.
150 LOG_WARNING(Service_Friend, "(STUBBED) called"); 150 LOG_WARNING(Service_Friend, "(STUBBED) called");
@@ -153,21 +153,21 @@ private:
153 rb.Push<u32>(0); // Indicates there are no blocked users 153 rb.Push<u32>(0); // Indicates there are no blocked users
154 } 154 }
155 155
156 void DeclareCloseOnlinePlaySession(Kernel::HLERequestContext& ctx) { 156 void DeclareCloseOnlinePlaySession(HLERequestContext& ctx) {
157 // Stub used by Splatoon 2 157 // Stub used by Splatoon 2
158 LOG_WARNING(Service_Friend, "(STUBBED) called"); 158 LOG_WARNING(Service_Friend, "(STUBBED) called");
159 IPC::ResponseBuilder rb{ctx, 2}; 159 IPC::ResponseBuilder rb{ctx, 2};
160 rb.Push(ResultSuccess); 160 rb.Push(ResultSuccess);
161 } 161 }
162 162
163 void UpdateUserPresence(Kernel::HLERequestContext& ctx) { 163 void UpdateUserPresence(HLERequestContext& ctx) {
164 // Stub used by Retro City Rampage 164 // Stub used by Retro City Rampage
165 LOG_WARNING(Service_Friend, "(STUBBED) called"); 165 LOG_WARNING(Service_Friend, "(STUBBED) called");
166 IPC::ResponseBuilder rb{ctx, 2}; 166 IPC::ResponseBuilder rb{ctx, 2};
167 rb.Push(ResultSuccess); 167 rb.Push(ResultSuccess);
168 } 168 }
169 169
170 void GetPlayHistoryRegistrationKey(Kernel::HLERequestContext& ctx) { 170 void GetPlayHistoryRegistrationKey(HLERequestContext& ctx) {
171 IPC::RequestParser rp{ctx}; 171 IPC::RequestParser rp{ctx};
172 const auto local_play = rp.Pop<bool>(); 172 const auto local_play = rp.Pop<bool>();
173 const auto uuid = rp.PopRaw<Common::UUID>(); 173 const auto uuid = rp.PopRaw<Common::UUID>();
@@ -179,7 +179,7 @@ private:
179 rb.Push(ResultSuccess); 179 rb.Push(ResultSuccess);
180 } 180 }
181 181
182 void GetFriendList(Kernel::HLERequestContext& ctx) { 182 void GetFriendList(HLERequestContext& ctx) {
183 IPC::RequestParser rp{ctx}; 183 IPC::RequestParser rp{ctx};
184 const auto friend_offset = rp.Pop<u32>(); 184 const auto friend_offset = rp.Pop<u32>();
185 const auto uuid = rp.PopRaw<Common::UUID>(); 185 const auto uuid = rp.PopRaw<Common::UUID>();
@@ -195,7 +195,7 @@ private:
195 // TODO(ogniK): Return a buffer of u64s which are the "NetworkServiceAccountId" 195 // TODO(ogniK): Return a buffer of u64s which are the "NetworkServiceAccountId"
196 } 196 }
197 197
198 void CheckFriendListAvailability(Kernel::HLERequestContext& ctx) { 198 void CheckFriendListAvailability(HLERequestContext& ctx) {
199 IPC::RequestParser rp{ctx}; 199 IPC::RequestParser rp{ctx};
200 const auto uuid{rp.PopRaw<Common::UUID>()}; 200 const auto uuid{rp.PopRaw<Common::UUID>()};
201 201
@@ -234,7 +234,7 @@ public:
234 } 234 }
235 235
236private: 236private:
237 void GetEvent(Kernel::HLERequestContext& ctx) { 237 void GetEvent(HLERequestContext& ctx) {
238 LOG_DEBUG(Service_Friend, "called"); 238 LOG_DEBUG(Service_Friend, "called");
239 239
240 IPC::ResponseBuilder rb{ctx, 2, 1}; 240 IPC::ResponseBuilder rb{ctx, 2, 1};
@@ -242,7 +242,7 @@ private:
242 rb.PushCopyObjects(notification_event->GetReadableEvent()); 242 rb.PushCopyObjects(notification_event->GetReadableEvent());
243 } 243 }
244 244
245 void Clear(Kernel::HLERequestContext& ctx) { 245 void Clear(HLERequestContext& ctx) {
246 LOG_DEBUG(Service_Friend, "called"); 246 LOG_DEBUG(Service_Friend, "called");
247 while (!notifications.empty()) { 247 while (!notifications.empty()) {
248 notifications.pop(); 248 notifications.pop();
@@ -253,7 +253,7 @@ private:
253 rb.Push(ResultSuccess); 253 rb.Push(ResultSuccess);
254 } 254 }
255 255
256 void Pop(Kernel::HLERequestContext& ctx) { 256 void Pop(HLERequestContext& ctx) {
257 LOG_DEBUG(Service_Friend, "called"); 257 LOG_DEBUG(Service_Friend, "called");
258 258
259 if (notifications.empty()) { 259 if (notifications.empty()) {
@@ -312,14 +312,14 @@ private:
312 States states{}; 312 States states{};
313}; 313};
314 314
315void Module::Interface::CreateFriendService(Kernel::HLERequestContext& ctx) { 315void Module::Interface::CreateFriendService(HLERequestContext& ctx) {
316 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 316 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
317 rb.Push(ResultSuccess); 317 rb.Push(ResultSuccess);
318 rb.PushIpcInterface<IFriendService>(system); 318 rb.PushIpcInterface<IFriendService>(system);
319 LOG_DEBUG(Service_Friend, "called"); 319 LOG_DEBUG(Service_Friend, "called");
320} 320}
321 321
322void Module::Interface::CreateNotificationService(Kernel::HLERequestContext& ctx) { 322void Module::Interface::CreateNotificationService(HLERequestContext& ctx) {
323 IPC::RequestParser rp{ctx}; 323 IPC::RequestParser rp{ctx};
324 auto uuid = rp.PopRaw<Common::UUID>(); 324 auto uuid = rp.PopRaw<Common::UUID>();
325 325
diff --git a/src/core/hle/service/friend/friend.h b/src/core/hle/service/friend/friend.h
index 41be06a4f..2824dc786 100644
--- a/src/core/hle/service/friend/friend.h
+++ b/src/core/hle/service/friend/friend.h
@@ -19,8 +19,8 @@ public:
19 const char* name); 19 const char* name);
20 ~Interface() override; 20 ~Interface() override;
21 21
22 void CreateFriendService(Kernel::HLERequestContext& ctx); 22 void CreateFriendService(HLERequestContext& ctx);
23 void CreateNotificationService(Kernel::HLERequestContext& ctx); 23 void CreateNotificationService(HLERequestContext& ctx);
24 24
25 protected: 25 protected:
26 std::shared_ptr<Module> module; 26 std::shared_ptr<Module> module;
diff --git a/src/core/hle/service/glue/arp.cpp b/src/core/hle/service/glue/arp.cpp
index ce21b69e3..9db136bac 100644
--- a/src/core/hle/service/glue/arp.cpp
+++ b/src/core/hle/service/glue/arp.cpp
@@ -5,12 +5,12 @@
5 5
6#include "common/logging/log.h" 6#include "common/logging/log.h"
7#include "core/core.h" 7#include "core/core.h"
8#include "core/hle/ipc_helpers.h"
9#include "core/hle/kernel/k_process.h" 8#include "core/hle/kernel/k_process.h"
10#include "core/hle/kernel/kernel.h" 9#include "core/hle/kernel/kernel.h"
11#include "core/hle/service/glue/arp.h" 10#include "core/hle/service/glue/arp.h"
12#include "core/hle/service/glue/errors.h" 11#include "core/hle/service/glue/errors.h"
13#include "core/hle/service/glue/glue_manager.h" 12#include "core/hle/service/glue/glue_manager.h"
13#include "core/hle/service/ipc_helpers.h"
14 14
15namespace Service::Glue { 15namespace Service::Glue {
16 16
@@ -51,7 +51,7 @@ ARP_R::ARP_R(Core::System& system_, const ARPManager& manager_)
51 51
52ARP_R::~ARP_R() = default; 52ARP_R::~ARP_R() = default;
53 53
54void ARP_R::GetApplicationLaunchProperty(Kernel::HLERequestContext& ctx) { 54void ARP_R::GetApplicationLaunchProperty(HLERequestContext& ctx) {
55 IPC::RequestParser rp{ctx}; 55 IPC::RequestParser rp{ctx};
56 const auto process_id = rp.PopRaw<u64>(); 56 const auto process_id = rp.PopRaw<u64>();
57 57
@@ -79,7 +79,7 @@ void ARP_R::GetApplicationLaunchProperty(Kernel::HLERequestContext& ctx) {
79 rb.PushRaw(*res); 79 rb.PushRaw(*res);
80} 80}
81 81
82void ARP_R::GetApplicationLaunchPropertyWithApplicationId(Kernel::HLERequestContext& ctx) { 82void ARP_R::GetApplicationLaunchPropertyWithApplicationId(HLERequestContext& ctx) {
83 IPC::RequestParser rp{ctx}; 83 IPC::RequestParser rp{ctx};
84 const auto title_id = rp.PopRaw<u64>(); 84 const auto title_id = rp.PopRaw<u64>();
85 85
@@ -99,7 +99,7 @@ void ARP_R::GetApplicationLaunchPropertyWithApplicationId(Kernel::HLERequestCont
99 rb.PushRaw(*res); 99 rb.PushRaw(*res);
100} 100}
101 101
102void ARP_R::GetApplicationControlProperty(Kernel::HLERequestContext& ctx) { 102void ARP_R::GetApplicationControlProperty(HLERequestContext& ctx) {
103 IPC::RequestParser rp{ctx}; 103 IPC::RequestParser rp{ctx};
104 const auto process_id = rp.PopRaw<u64>(); 104 const auto process_id = rp.PopRaw<u64>();
105 105
@@ -128,7 +128,7 @@ void ARP_R::GetApplicationControlProperty(Kernel::HLERequestContext& ctx) {
128 rb.Push(ResultSuccess); 128 rb.Push(ResultSuccess);
129} 129}
130 130
131void ARP_R::GetApplicationControlPropertyWithApplicationId(Kernel::HLERequestContext& ctx) { 131void ARP_R::GetApplicationControlPropertyWithApplicationId(HLERequestContext& ctx) {
132 IPC::RequestParser rp{ctx}; 132 IPC::RequestParser rp{ctx};
133 const auto title_id = rp.PopRaw<u64>(); 133 const auto title_id = rp.PopRaw<u64>();
134 134
@@ -169,7 +169,7 @@ public:
169 } 169 }
170 170
171private: 171private:
172 void Issue(Kernel::HLERequestContext& ctx) { 172 void Issue(HLERequestContext& ctx) {
173 IPC::RequestParser rp{ctx}; 173 IPC::RequestParser rp{ctx};
174 const auto process_id = rp.PopRaw<u64>(); 174 const auto process_id = rp.PopRaw<u64>();
175 175
@@ -197,7 +197,7 @@ private:
197 rb.Push(ResultSuccess); 197 rb.Push(ResultSuccess);
198 } 198 }
199 199
200 void SetApplicationLaunchProperty(Kernel::HLERequestContext& ctx) { 200 void SetApplicationLaunchProperty(HLERequestContext& ctx) {
201 LOG_DEBUG(Service_ARP, "called"); 201 LOG_DEBUG(Service_ARP, "called");
202 202
203 if (issued) { 203 if (issued) {
@@ -216,7 +216,7 @@ private:
216 rb.Push(ResultSuccess); 216 rb.Push(ResultSuccess);
217 } 217 }
218 218
219 void SetApplicationControlProperty(Kernel::HLERequestContext& ctx) { 219 void SetApplicationControlProperty(HLERequestContext& ctx) {
220 LOG_DEBUG(Service_ARP, "called"); 220 LOG_DEBUG(Service_ARP, "called");
221 221
222 if (issued) { 222 if (issued) {
@@ -256,7 +256,7 @@ ARP_W::ARP_W(Core::System& system_, ARPManager& manager_)
256 256
257ARP_W::~ARP_W() = default; 257ARP_W::~ARP_W() = default;
258 258
259void ARP_W::AcquireRegistrar(Kernel::HLERequestContext& ctx) { 259void ARP_W::AcquireRegistrar(HLERequestContext& ctx) {
260 LOG_DEBUG(Service_ARP, "called"); 260 LOG_DEBUG(Service_ARP, "called");
261 261
262 registrar = std::make_shared<IRegistrar>( 262 registrar = std::make_shared<IRegistrar>(
@@ -274,7 +274,7 @@ void ARP_W::AcquireRegistrar(Kernel::HLERequestContext& ctx) {
274 rb.PushIpcInterface(registrar); 274 rb.PushIpcInterface(registrar);
275} 275}
276 276
277void ARP_W::UnregisterApplicationInstance(Kernel::HLERequestContext& ctx) { 277void ARP_W::UnregisterApplicationInstance(HLERequestContext& ctx) {
278 IPC::RequestParser rp{ctx}; 278 IPC::RequestParser rp{ctx};
279 const auto process_id = rp.PopRaw<u64>(); 279 const auto process_id = rp.PopRaw<u64>();
280 280
diff --git a/src/core/hle/service/glue/arp.h b/src/core/hle/service/glue/arp.h
index 06c992e88..5bce80175 100644
--- a/src/core/hle/service/glue/arp.h
+++ b/src/core/hle/service/glue/arp.h
@@ -16,10 +16,10 @@ public:
16 ~ARP_R() override; 16 ~ARP_R() override;
17 17
18private: 18private:
19 void GetApplicationLaunchProperty(Kernel::HLERequestContext& ctx); 19 void GetApplicationLaunchProperty(HLERequestContext& ctx);
20 void GetApplicationLaunchPropertyWithApplicationId(Kernel::HLERequestContext& ctx); 20 void GetApplicationLaunchPropertyWithApplicationId(HLERequestContext& ctx);
21 void GetApplicationControlProperty(Kernel::HLERequestContext& ctx); 21 void GetApplicationControlProperty(HLERequestContext& ctx);
22 void GetApplicationControlPropertyWithApplicationId(Kernel::HLERequestContext& ctx); 22 void GetApplicationControlPropertyWithApplicationId(HLERequestContext& ctx);
23 23
24 const ARPManager& manager; 24 const ARPManager& manager;
25}; 25};
@@ -30,8 +30,8 @@ public:
30 ~ARP_W() override; 30 ~ARP_W() override;
31 31
32private: 32private:
33 void AcquireRegistrar(Kernel::HLERequestContext& ctx); 33 void AcquireRegistrar(HLERequestContext& ctx);
34 void UnregisterApplicationInstance(Kernel::HLERequestContext& ctx); 34 void UnregisterApplicationInstance(HLERequestContext& ctx);
35 35
36 ARPManager& manager; 36 ARPManager& manager;
37 std::shared_ptr<IRegistrar> registrar; 37 std::shared_ptr<IRegistrar> registrar;
diff --git a/src/core/hle/service/glue/bgtc.cpp b/src/core/hle/service/glue/bgtc.cpp
index 3248091c3..ae22ac4f7 100644
--- a/src/core/hle/service/glue/bgtc.cpp
+++ b/src/core/hle/service/glue/bgtc.cpp
@@ -3,8 +3,8 @@
3 3
4#include "common/logging/log.h" 4#include "common/logging/log.h"
5#include "core/core.h" 5#include "core/core.h"
6#include "core/hle/ipc_helpers.h"
7#include "core/hle/service/glue/bgtc.h" 6#include "core/hle/service/glue/bgtc.h"
7#include "core/hle/service/ipc_helpers.h"
8 8
9namespace Service::Glue { 9namespace Service::Glue {
10 10
@@ -20,7 +20,7 @@ BGTC_T::BGTC_T(Core::System& system_) : ServiceFramework{system_, "bgtc:t"} {
20 20
21BGTC_T::~BGTC_T() = default; 21BGTC_T::~BGTC_T() = default;
22 22
23void BGTC_T::OpenTaskService(Kernel::HLERequestContext& ctx) { 23void BGTC_T::OpenTaskService(HLERequestContext& ctx) {
24 LOG_DEBUG(Service_BGTC, "called"); 24 LOG_DEBUG(Service_BGTC, "called");
25 25
26 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 26 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
diff --git a/src/core/hle/service/glue/bgtc.h b/src/core/hle/service/glue/bgtc.h
index d6e2baec1..5a5d9c9a7 100644
--- a/src/core/hle/service/glue/bgtc.h
+++ b/src/core/hle/service/glue/bgtc.h
@@ -16,7 +16,7 @@ public:
16 explicit BGTC_T(Core::System& system_); 16 explicit BGTC_T(Core::System& system_);
17 ~BGTC_T() override; 17 ~BGTC_T() override;
18 18
19 void OpenTaskService(Kernel::HLERequestContext& ctx); 19 void OpenTaskService(HLERequestContext& ctx);
20}; 20};
21 21
22class ITaskService final : public ServiceFramework<ITaskService> { 22class ITaskService final : public ServiceFramework<ITaskService> {
diff --git a/src/core/hle/service/glue/notif.cpp b/src/core/hle/service/glue/notif.cpp
index 3ace2dabd..fec4ad86c 100644
--- a/src/core/hle/service/glue/notif.cpp
+++ b/src/core/hle/service/glue/notif.cpp
@@ -6,8 +6,8 @@
6 6
7#include "common/assert.h" 7#include "common/assert.h"
8#include "common/logging/log.h" 8#include "common/logging/log.h"
9#include "core/hle/ipc_helpers.h"
10#include "core/hle/service/glue/notif.h" 9#include "core/hle/service/glue/notif.h"
10#include "core/hle/service/ipc_helpers.h"
11 11
12namespace Service::Glue { 12namespace Service::Glue {
13 13
@@ -28,7 +28,7 @@ NOTIF_A::NOTIF_A(Core::System& system_) : ServiceFramework{system_, "notif:a"} {
28 28
29NOTIF_A::~NOTIF_A() = default; 29NOTIF_A::~NOTIF_A() = default;
30 30
31void NOTIF_A::RegisterAlarmSetting(Kernel::HLERequestContext& ctx) { 31void NOTIF_A::RegisterAlarmSetting(HLERequestContext& ctx) {
32 const auto alarm_setting_buffer_size = ctx.GetReadBufferSize(0); 32 const auto alarm_setting_buffer_size = ctx.GetReadBufferSize(0);
33 const auto application_parameter_size = ctx.GetReadBufferSize(1); 33 const auto application_parameter_size = ctx.GetReadBufferSize(1);
34 34
@@ -63,7 +63,7 @@ void NOTIF_A::RegisterAlarmSetting(Kernel::HLERequestContext& ctx) {
63 rb.Push(new_alarm.alarm_setting_id); 63 rb.Push(new_alarm.alarm_setting_id);
64} 64}
65 65
66void NOTIF_A::UpdateAlarmSetting(Kernel::HLERequestContext& ctx) { 66void NOTIF_A::UpdateAlarmSetting(HLERequestContext& ctx) {
67 const auto alarm_setting_buffer_size = ctx.GetReadBufferSize(0); 67 const auto alarm_setting_buffer_size = ctx.GetReadBufferSize(0);
68 const auto application_parameter_size = ctx.GetReadBufferSize(1); 68 const auto application_parameter_size = ctx.GetReadBufferSize(1);
69 69
@@ -91,7 +91,7 @@ void NOTIF_A::UpdateAlarmSetting(Kernel::HLERequestContext& ctx) {
91 rb.Push(ResultSuccess); 91 rb.Push(ResultSuccess);
92} 92}
93 93
94void NOTIF_A::ListAlarmSettings(Kernel::HLERequestContext& ctx) { 94void NOTIF_A::ListAlarmSettings(HLERequestContext& ctx) {
95 LOG_INFO(Service_NOTIF, "called, alarm_count={}", alarms.size()); 95 LOG_INFO(Service_NOTIF, "called, alarm_count={}", alarms.size());
96 96
97 // TODO: Only return alarms of this game id 97 // TODO: Only return alarms of this game id
@@ -102,7 +102,7 @@ void NOTIF_A::ListAlarmSettings(Kernel::HLERequestContext& ctx) {
102 rb.Push(static_cast<u32>(alarms.size())); 102 rb.Push(static_cast<u32>(alarms.size()));
103} 103}
104 104
105void NOTIF_A::LoadApplicationParameter(Kernel::HLERequestContext& ctx) { 105void NOTIF_A::LoadApplicationParameter(HLERequestContext& ctx) {
106 IPC::RequestParser rp{ctx}; 106 IPC::RequestParser rp{ctx};
107 const auto alarm_setting_id{rp.Pop<AlarmSettingId>()}; 107 const auto alarm_setting_id{rp.Pop<AlarmSettingId>()};
108 108
@@ -126,7 +126,7 @@ void NOTIF_A::LoadApplicationParameter(Kernel::HLERequestContext& ctx) {
126 rb.Push(static_cast<u32>(application_parameter.size())); 126 rb.Push(static_cast<u32>(application_parameter.size()));
127} 127}
128 128
129void NOTIF_A::DeleteAlarmSetting(Kernel::HLERequestContext& ctx) { 129void NOTIF_A::DeleteAlarmSetting(HLERequestContext& ctx) {
130 IPC::RequestParser rp{ctx}; 130 IPC::RequestParser rp{ctx};
131 const auto alarm_setting_id{rp.Pop<AlarmSettingId>()}; 131 const auto alarm_setting_id{rp.Pop<AlarmSettingId>()};
132 132
@@ -140,7 +140,7 @@ void NOTIF_A::DeleteAlarmSetting(Kernel::HLERequestContext& ctx) {
140 rb.Push(ResultSuccess); 140 rb.Push(ResultSuccess);
141} 141}
142 142
143void NOTIF_A::Initialize(Kernel::HLERequestContext& ctx) { 143void NOTIF_A::Initialize(HLERequestContext& ctx) {
144 // TODO: Load previous alarms from config 144 // TODO: Load previous alarms from config
145 145
146 LOG_WARNING(Service_NOTIF, "(STUBBED) called"); 146 LOG_WARNING(Service_NOTIF, "(STUBBED) called");
diff --git a/src/core/hle/service/glue/notif.h b/src/core/hle/service/glue/notif.h
index 4467e1f35..b1187f3a3 100644
--- a/src/core/hle/service/glue/notif.h
+++ b/src/core/hle/service/glue/notif.h
@@ -56,12 +56,12 @@ private:
56 }; 56 };
57 static_assert(sizeof(AlarmSetting) == 0x40, "AlarmSetting is an invalid size"); 57 static_assert(sizeof(AlarmSetting) == 0x40, "AlarmSetting is an invalid size");
58 58
59 void RegisterAlarmSetting(Kernel::HLERequestContext& ctx); 59 void RegisterAlarmSetting(HLERequestContext& ctx);
60 void UpdateAlarmSetting(Kernel::HLERequestContext& ctx); 60 void UpdateAlarmSetting(HLERequestContext& ctx);
61 void ListAlarmSettings(Kernel::HLERequestContext& ctx); 61 void ListAlarmSettings(HLERequestContext& ctx);
62 void LoadApplicationParameter(Kernel::HLERequestContext& ctx); 62 void LoadApplicationParameter(HLERequestContext& ctx);
63 void DeleteAlarmSetting(Kernel::HLERequestContext& ctx); 63 void DeleteAlarmSetting(HLERequestContext& ctx);
64 void Initialize(Kernel::HLERequestContext& ctx); 64 void Initialize(HLERequestContext& ctx);
65 65
66 std::vector<AlarmSetting>::iterator GetAlarmFromId(AlarmSettingId alarm_setting_id); 66 std::vector<AlarmSetting>::iterator GetAlarmFromId(AlarmSettingId alarm_setting_id);
67 67
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index 4b5130469..56c7275df 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -8,7 +8,6 @@
8#include "core/core.h" 8#include "core/core.h"
9#include "core/core_timing.h" 9#include "core/core_timing.h"
10#include "core/hid/hid_core.h" 10#include "core/hid/hid_core.h"
11#include "core/hle/ipc_helpers.h"
12#include "core/hle/kernel/k_readable_event.h" 11#include "core/hle/kernel/k_readable_event.h"
13#include "core/hle/kernel/k_shared_memory.h" 12#include "core/hle/kernel/k_shared_memory.h"
14#include "core/hle/kernel/k_transfer_memory.h" 13#include "core/hle/kernel/k_transfer_memory.h"
@@ -18,6 +17,7 @@
18#include "core/hle/service/hid/hidbus.h" 17#include "core/hle/service/hid/hidbus.h"
19#include "core/hle/service/hid/irs.h" 18#include "core/hle/service/hid/irs.h"
20#include "core/hle/service/hid/xcd.h" 19#include "core/hle/service/hid/xcd.h"
20#include "core/hle/service/ipc_helpers.h"
21#include "core/hle/service/server_manager.h" 21#include "core/hle/service/server_manager.h"
22#include "core/memory.h" 22#include "core/memory.h"
23 23
@@ -138,7 +138,7 @@ IAppletResource::~IAppletResource() {
138 system.CoreTiming().UnscheduleEvent(motion_update_event, 0); 138 system.CoreTiming().UnscheduleEvent(motion_update_event, 0);
139} 139}
140 140
141void IAppletResource::GetSharedMemoryHandle(Kernel::HLERequestContext& ctx) { 141void IAppletResource::GetSharedMemoryHandle(HLERequestContext& ctx) {
142 LOG_DEBUG(Service_HID, "called"); 142 LOG_DEBUG(Service_HID, "called");
143 143
144 IPC::ResponseBuilder rb{ctx, 2, 1}; 144 IPC::ResponseBuilder rb{ctx, 2, 1};
@@ -203,7 +203,7 @@ public:
203 } 203 }
204 204
205private: 205private:
206 void InitializeVibrationDevice(Kernel::HLERequestContext& ctx) { 206 void InitializeVibrationDevice(HLERequestContext& ctx) {
207 IPC::RequestParser rp{ctx}; 207 IPC::RequestParser rp{ctx};
208 const auto vibration_device_handle{rp.PopRaw<Core::HID::VibrationDeviceHandle>()}; 208 const auto vibration_device_handle{rp.PopRaw<Core::HID::VibrationDeviceHandle>()};
209 209
@@ -382,7 +382,7 @@ Hid::Hid(Core::System& system_)
382 382
383Hid::~Hid() = default; 383Hid::~Hid() = default;
384 384
385void Hid::CreateAppletResource(Kernel::HLERequestContext& ctx) { 385void Hid::CreateAppletResource(HLERequestContext& ctx) {
386 IPC::RequestParser rp{ctx}; 386 IPC::RequestParser rp{ctx};
387 const auto applet_resource_user_id{rp.Pop<u64>()}; 387 const auto applet_resource_user_id{rp.Pop<u64>()};
388 388
@@ -397,7 +397,7 @@ void Hid::CreateAppletResource(Kernel::HLERequestContext& ctx) {
397 rb.PushIpcInterface<IAppletResource>(applet_resource); 397 rb.PushIpcInterface<IAppletResource>(applet_resource);
398} 398}
399 399
400void Hid::ActivateDebugPad(Kernel::HLERequestContext& ctx) { 400void Hid::ActivateDebugPad(HLERequestContext& ctx) {
401 IPC::RequestParser rp{ctx}; 401 IPC::RequestParser rp{ctx};
402 const auto applet_resource_user_id{rp.Pop<u64>()}; 402 const auto applet_resource_user_id{rp.Pop<u64>()};
403 403
@@ -409,7 +409,7 @@ void Hid::ActivateDebugPad(Kernel::HLERequestContext& ctx) {
409 rb.Push(ResultSuccess); 409 rb.Push(ResultSuccess);
410} 410}
411 411
412void Hid::ActivateTouchScreen(Kernel::HLERequestContext& ctx) { 412void Hid::ActivateTouchScreen(HLERequestContext& ctx) {
413 IPC::RequestParser rp{ctx}; 413 IPC::RequestParser rp{ctx};
414 const auto applet_resource_user_id{rp.Pop<u64>()}; 414 const auto applet_resource_user_id{rp.Pop<u64>()};
415 415
@@ -421,7 +421,7 @@ void Hid::ActivateTouchScreen(Kernel::HLERequestContext& ctx) {
421 rb.Push(ResultSuccess); 421 rb.Push(ResultSuccess);
422} 422}
423 423
424void Hid::ActivateMouse(Kernel::HLERequestContext& ctx) { 424void Hid::ActivateMouse(HLERequestContext& ctx) {
425 IPC::RequestParser rp{ctx}; 425 IPC::RequestParser rp{ctx};
426 const auto applet_resource_user_id{rp.Pop<u64>()}; 426 const auto applet_resource_user_id{rp.Pop<u64>()};
427 427
@@ -433,7 +433,7 @@ void Hid::ActivateMouse(Kernel::HLERequestContext& ctx) {
433 rb.Push(ResultSuccess); 433 rb.Push(ResultSuccess);
434} 434}
435 435
436void Hid::ActivateKeyboard(Kernel::HLERequestContext& ctx) { 436void Hid::ActivateKeyboard(HLERequestContext& ctx) {
437 IPC::RequestParser rp{ctx}; 437 IPC::RequestParser rp{ctx};
438 const auto applet_resource_user_id{rp.Pop<u64>()}; 438 const auto applet_resource_user_id{rp.Pop<u64>()};
439 439
@@ -445,7 +445,7 @@ void Hid::ActivateKeyboard(Kernel::HLERequestContext& ctx) {
445 rb.Push(ResultSuccess); 445 rb.Push(ResultSuccess);
446} 446}
447 447
448void Hid::SendKeyboardLockKeyEvent(Kernel::HLERequestContext& ctx) { 448void Hid::SendKeyboardLockKeyEvent(HLERequestContext& ctx) {
449 IPC::RequestParser rp{ctx}; 449 IPC::RequestParser rp{ctx};
450 const auto flags{rp.Pop<u32>()}; 450 const auto flags{rp.Pop<u32>()};
451 451
@@ -455,7 +455,7 @@ void Hid::SendKeyboardLockKeyEvent(Kernel::HLERequestContext& ctx) {
455 rb.Push(ResultSuccess); 455 rb.Push(ResultSuccess);
456} 456}
457 457
458void Hid::ActivateXpad(Kernel::HLERequestContext& ctx) { 458void Hid::ActivateXpad(HLERequestContext& ctx) {
459 IPC::RequestParser rp{ctx}; 459 IPC::RequestParser rp{ctx};
460 struct Parameters { 460 struct Parameters {
461 u32 basic_xpad_id; 461 u32 basic_xpad_id;
@@ -475,7 +475,7 @@ void Hid::ActivateXpad(Kernel::HLERequestContext& ctx) {
475 rb.Push(ResultSuccess); 475 rb.Push(ResultSuccess);
476} 476}
477 477
478void Hid::GetXpadIDs(Kernel::HLERequestContext& ctx) { 478void Hid::GetXpadIDs(HLERequestContext& ctx) {
479 IPC::RequestParser rp{ctx}; 479 IPC::RequestParser rp{ctx};
480 const auto applet_resource_user_id{rp.Pop<u64>()}; 480 const auto applet_resource_user_id{rp.Pop<u64>()};
481 481
@@ -486,7 +486,7 @@ void Hid::GetXpadIDs(Kernel::HLERequestContext& ctx) {
486 rb.Push(0); 486 rb.Push(0);
487} 487}
488 488
489void Hid::ActivateSixAxisSensor(Kernel::HLERequestContext& ctx) { 489void Hid::ActivateSixAxisSensor(HLERequestContext& ctx) {
490 IPC::RequestParser rp{ctx}; 490 IPC::RequestParser rp{ctx};
491 struct Parameters { 491 struct Parameters {
492 u32 basic_xpad_id; 492 u32 basic_xpad_id;
@@ -506,7 +506,7 @@ void Hid::ActivateSixAxisSensor(Kernel::HLERequestContext& ctx) {
506 rb.Push(ResultSuccess); 506 rb.Push(ResultSuccess);
507} 507}
508 508
509void Hid::DeactivateSixAxisSensor(Kernel::HLERequestContext& ctx) { 509void Hid::DeactivateSixAxisSensor(HLERequestContext& ctx) {
510 IPC::RequestParser rp{ctx}; 510 IPC::RequestParser rp{ctx};
511 struct Parameters { 511 struct Parameters {
512 u32 basic_xpad_id; 512 u32 basic_xpad_id;
@@ -526,7 +526,7 @@ void Hid::DeactivateSixAxisSensor(Kernel::HLERequestContext& ctx) {
526 rb.Push(ResultSuccess); 526 rb.Push(ResultSuccess);
527} 527}
528 528
529void Hid::StartSixAxisSensor(Kernel::HLERequestContext& ctx) { 529void Hid::StartSixAxisSensor(HLERequestContext& ctx) {
530 IPC::RequestParser rp{ctx}; 530 IPC::RequestParser rp{ctx};
531 struct Parameters { 531 struct Parameters {
532 Core::HID::SixAxisSensorHandle sixaxis_handle; 532 Core::HID::SixAxisSensorHandle sixaxis_handle;
@@ -549,7 +549,7 @@ void Hid::StartSixAxisSensor(Kernel::HLERequestContext& ctx) {
549 rb.Push(result); 549 rb.Push(result);
550} 550}
551 551
552void Hid::StopSixAxisSensor(Kernel::HLERequestContext& ctx) { 552void Hid::StopSixAxisSensor(HLERequestContext& ctx) {
553 IPC::RequestParser rp{ctx}; 553 IPC::RequestParser rp{ctx};
554 struct Parameters { 554 struct Parameters {
555 Core::HID::SixAxisSensorHandle sixaxis_handle; 555 Core::HID::SixAxisSensorHandle sixaxis_handle;
@@ -572,7 +572,7 @@ void Hid::StopSixAxisSensor(Kernel::HLERequestContext& ctx) {
572 rb.Push(result); 572 rb.Push(result);
573} 573}
574 574
575void Hid::IsSixAxisSensorFusionEnabled(Kernel::HLERequestContext& ctx) { 575void Hid::IsSixAxisSensorFusionEnabled(HLERequestContext& ctx) {
576 IPC::RequestParser rp{ctx}; 576 IPC::RequestParser rp{ctx};
577 struct Parameters { 577 struct Parameters {
578 Core::HID::SixAxisSensorHandle sixaxis_handle; 578 Core::HID::SixAxisSensorHandle sixaxis_handle;
@@ -598,7 +598,7 @@ void Hid::IsSixAxisSensorFusionEnabled(Kernel::HLERequestContext& ctx) {
598 rb.Push(is_enabled); 598 rb.Push(is_enabled);
599} 599}
600 600
601void Hid::EnableSixAxisSensorFusion(Kernel::HLERequestContext& ctx) { 601void Hid::EnableSixAxisSensorFusion(HLERequestContext& ctx) {
602 IPC::RequestParser rp{ctx}; 602 IPC::RequestParser rp{ctx};
603 struct Parameters { 603 struct Parameters {
604 bool enable_sixaxis_sensor_fusion; 604 bool enable_sixaxis_sensor_fusion;
@@ -625,7 +625,7 @@ void Hid::EnableSixAxisSensorFusion(Kernel::HLERequestContext& ctx) {
625 rb.Push(result); 625 rb.Push(result);
626} 626}
627 627
628void Hid::SetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) { 628void Hid::SetSixAxisSensorFusionParameters(HLERequestContext& ctx) {
629 IPC::RequestParser rp{ctx}; 629 IPC::RequestParser rp{ctx};
630 struct Parameters { 630 struct Parameters {
631 Core::HID::SixAxisSensorHandle sixaxis_handle; 631 Core::HID::SixAxisSensorHandle sixaxis_handle;
@@ -652,7 +652,7 @@ void Hid::SetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) {
652 rb.Push(result); 652 rb.Push(result);
653} 653}
654 654
655void Hid::GetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) { 655void Hid::GetSixAxisSensorFusionParameters(HLERequestContext& ctx) {
656 IPC::RequestParser rp{ctx}; 656 IPC::RequestParser rp{ctx};
657 struct Parameters { 657 struct Parameters {
658 Core::HID::SixAxisSensorHandle sixaxis_handle; 658 Core::HID::SixAxisSensorHandle sixaxis_handle;
@@ -679,7 +679,7 @@ void Hid::GetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) {
679 rb.PushRaw(fusion_parameters); 679 rb.PushRaw(fusion_parameters);
680} 680}
681 681
682void Hid::ResetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) { 682void Hid::ResetSixAxisSensorFusionParameters(HLERequestContext& ctx) {
683 IPC::RequestParser rp{ctx}; 683 IPC::RequestParser rp{ctx};
684 struct Parameters { 684 struct Parameters {
685 Core::HID::SixAxisSensorHandle sixaxis_handle; 685 Core::HID::SixAxisSensorHandle sixaxis_handle;
@@ -713,7 +713,7 @@ void Hid::ResetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) {
713 rb.Push(result2); 713 rb.Push(result2);
714} 714}
715 715
716void Hid::SetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx) { 716void Hid::SetGyroscopeZeroDriftMode(HLERequestContext& ctx) {
717 IPC::RequestParser rp{ctx}; 717 IPC::RequestParser rp{ctx};
718 const auto sixaxis_handle{rp.PopRaw<Core::HID::SixAxisSensorHandle>()}; 718 const auto sixaxis_handle{rp.PopRaw<Core::HID::SixAxisSensorHandle>()};
719 const auto drift_mode{rp.PopEnum<Core::HID::GyroscopeZeroDriftMode>()}; 719 const auto drift_mode{rp.PopEnum<Core::HID::GyroscopeZeroDriftMode>()};
@@ -732,7 +732,7 @@ void Hid::SetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx) {
732 rb.Push(result); 732 rb.Push(result);
733} 733}
734 734
735void Hid::GetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx) { 735void Hid::GetGyroscopeZeroDriftMode(HLERequestContext& ctx) {
736 IPC::RequestParser rp{ctx}; 736 IPC::RequestParser rp{ctx};
737 struct Parameters { 737 struct Parameters {
738 Core::HID::SixAxisSensorHandle sixaxis_handle; 738 Core::HID::SixAxisSensorHandle sixaxis_handle;
@@ -757,7 +757,7 @@ void Hid::GetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx) {
757 rb.PushEnum(drift_mode); 757 rb.PushEnum(drift_mode);
758} 758}
759 759
760void Hid::ResetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx) { 760void Hid::ResetGyroscopeZeroDriftMode(HLERequestContext& ctx) {
761 IPC::RequestParser rp{ctx}; 761 IPC::RequestParser rp{ctx};
762 struct Parameters { 762 struct Parameters {
763 Core::HID::SixAxisSensorHandle sixaxis_handle; 763 Core::HID::SixAxisSensorHandle sixaxis_handle;
@@ -781,7 +781,7 @@ void Hid::ResetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx) {
781 rb.Push(result); 781 rb.Push(result);
782} 782}
783 783
784void Hid::IsSixAxisSensorAtRest(Kernel::HLERequestContext& ctx) { 784void Hid::IsSixAxisSensorAtRest(HLERequestContext& ctx) {
785 IPC::RequestParser rp{ctx}; 785 IPC::RequestParser rp{ctx};
786 struct Parameters { 786 struct Parameters {
787 Core::HID::SixAxisSensorHandle sixaxis_handle; 787 Core::HID::SixAxisSensorHandle sixaxis_handle;
@@ -806,7 +806,7 @@ void Hid::IsSixAxisSensorAtRest(Kernel::HLERequestContext& ctx) {
806 rb.Push(is_at_rest); 806 rb.Push(is_at_rest);
807} 807}
808 808
809void Hid::IsFirmwareUpdateAvailableForSixAxisSensor(Kernel::HLERequestContext& ctx) { 809void Hid::IsFirmwareUpdateAvailableForSixAxisSensor(HLERequestContext& ctx) {
810 IPC::RequestParser rp{ctx}; 810 IPC::RequestParser rp{ctx};
811 struct Parameters { 811 struct Parameters {
812 Core::HID::SixAxisSensorHandle sixaxis_handle; 812 Core::HID::SixAxisSensorHandle sixaxis_handle;
@@ -833,7 +833,7 @@ void Hid::IsFirmwareUpdateAvailableForSixAxisSensor(Kernel::HLERequestContext& c
833 rb.Push(is_firmware_available); 833 rb.Push(is_firmware_available);
834} 834}
835 835
836void Hid::EnableSixAxisSensorUnalteredPassthrough(Kernel::HLERequestContext& ctx) { 836void Hid::EnableSixAxisSensorUnalteredPassthrough(HLERequestContext& ctx) {
837 IPC::RequestParser rp{ctx}; 837 IPC::RequestParser rp{ctx};
838 struct Parameters { 838 struct Parameters {
839 bool enabled; 839 bool enabled;
@@ -859,7 +859,7 @@ void Hid::EnableSixAxisSensorUnalteredPassthrough(Kernel::HLERequestContext& ctx
859 rb.Push(result); 859 rb.Push(result);
860} 860}
861 861
862void Hid::IsSixAxisSensorUnalteredPassthroughEnabled(Kernel::HLERequestContext& ctx) { 862void Hid::IsSixAxisSensorUnalteredPassthroughEnabled(HLERequestContext& ctx) {
863 IPC::RequestParser rp{ctx}; 863 IPC::RequestParser rp{ctx};
864 struct Parameters { 864 struct Parameters {
865 Core::HID::SixAxisSensorHandle sixaxis_handle; 865 Core::HID::SixAxisSensorHandle sixaxis_handle;
@@ -886,7 +886,7 @@ void Hid::IsSixAxisSensorUnalteredPassthroughEnabled(Kernel::HLERequestContext&
886 rb.Push(is_unaltered_sisxaxis_enabled); 886 rb.Push(is_unaltered_sisxaxis_enabled);
887} 887}
888 888
889void Hid::LoadSixAxisSensorCalibrationParameter(Kernel::HLERequestContext& ctx) { 889void Hid::LoadSixAxisSensorCalibrationParameter(HLERequestContext& ctx) {
890 IPC::RequestParser rp{ctx}; 890 IPC::RequestParser rp{ctx};
891 struct Parameters { 891 struct Parameters {
892 Core::HID::SixAxisSensorHandle sixaxis_handle; 892 Core::HID::SixAxisSensorHandle sixaxis_handle;
@@ -916,7 +916,7 @@ void Hid::LoadSixAxisSensorCalibrationParameter(Kernel::HLERequestContext& ctx)
916 rb.Push(result); 916 rb.Push(result);
917} 917}
918 918
919void Hid::GetSixAxisSensorIcInformation(Kernel::HLERequestContext& ctx) { 919void Hid::GetSixAxisSensorIcInformation(HLERequestContext& ctx) {
920 IPC::RequestParser rp{ctx}; 920 IPC::RequestParser rp{ctx};
921 struct Parameters { 921 struct Parameters {
922 Core::HID::SixAxisSensorHandle sixaxis_handle; 922 Core::HID::SixAxisSensorHandle sixaxis_handle;
@@ -946,7 +946,7 @@ void Hid::GetSixAxisSensorIcInformation(Kernel::HLERequestContext& ctx) {
946 rb.Push(result); 946 rb.Push(result);
947} 947}
948 948
949void Hid::ResetIsSixAxisSensorDeviceNewlyAssigned(Kernel::HLERequestContext& ctx) { 949void Hid::ResetIsSixAxisSensorDeviceNewlyAssigned(HLERequestContext& ctx) {
950 IPC::RequestParser rp{ctx}; 950 IPC::RequestParser rp{ctx};
951 struct Parameters { 951 struct Parameters {
952 Core::HID::SixAxisSensorHandle sixaxis_handle; 952 Core::HID::SixAxisSensorHandle sixaxis_handle;
@@ -971,7 +971,7 @@ void Hid::ResetIsSixAxisSensorDeviceNewlyAssigned(Kernel::HLERequestContext& ctx
971 rb.Push(result); 971 rb.Push(result);
972} 972}
973 973
974void Hid::ActivateGesture(Kernel::HLERequestContext& ctx) { 974void Hid::ActivateGesture(HLERequestContext& ctx) {
975 IPC::RequestParser rp{ctx}; 975 IPC::RequestParser rp{ctx};
976 struct Parameters { 976 struct Parameters {
977 u32 unknown; 977 u32 unknown;
@@ -991,7 +991,7 @@ void Hid::ActivateGesture(Kernel::HLERequestContext& ctx) {
991 rb.Push(ResultSuccess); 991 rb.Push(ResultSuccess);
992} 992}
993 993
994void Hid::SetSupportedNpadStyleSet(Kernel::HLERequestContext& ctx) { 994void Hid::SetSupportedNpadStyleSet(HLERequestContext& ctx) {
995 IPC::RequestParser rp{ctx}; 995 IPC::RequestParser rp{ctx};
996 struct Parameters { 996 struct Parameters {
997 Core::HID::NpadStyleSet supported_styleset; 997 Core::HID::NpadStyleSet supported_styleset;
@@ -1012,7 +1012,7 @@ void Hid::SetSupportedNpadStyleSet(Kernel::HLERequestContext& ctx) {
1012 rb.Push(ResultSuccess); 1012 rb.Push(ResultSuccess);
1013} 1013}
1014 1014
1015void Hid::GetSupportedNpadStyleSet(Kernel::HLERequestContext& ctx) { 1015void Hid::GetSupportedNpadStyleSet(HLERequestContext& ctx) {
1016 IPC::RequestParser rp{ctx}; 1016 IPC::RequestParser rp{ctx};
1017 const auto applet_resource_user_id{rp.Pop<u64>()}; 1017 const auto applet_resource_user_id{rp.Pop<u64>()};
1018 1018
@@ -1025,7 +1025,7 @@ void Hid::GetSupportedNpadStyleSet(Kernel::HLERequestContext& ctx) {
1025 .raw); 1025 .raw);
1026} 1026}
1027 1027
1028void Hid::SetSupportedNpadIdType(Kernel::HLERequestContext& ctx) { 1028void Hid::SetSupportedNpadIdType(HLERequestContext& ctx) {
1029 IPC::RequestParser rp{ctx}; 1029 IPC::RequestParser rp{ctx};
1030 const auto applet_resource_user_id{rp.Pop<u64>()}; 1030 const auto applet_resource_user_id{rp.Pop<u64>()};
1031 1031
@@ -1038,7 +1038,7 @@ void Hid::SetSupportedNpadIdType(Kernel::HLERequestContext& ctx) {
1038 rb.Push(result); 1038 rb.Push(result);
1039} 1039}
1040 1040
1041void Hid::ActivateNpad(Kernel::HLERequestContext& ctx) { 1041void Hid::ActivateNpad(HLERequestContext& ctx) {
1042 IPC::RequestParser rp{ctx}; 1042 IPC::RequestParser rp{ctx};
1043 const auto applet_resource_user_id{rp.Pop<u64>()}; 1043 const auto applet_resource_user_id{rp.Pop<u64>()};
1044 1044
@@ -1050,7 +1050,7 @@ void Hid::ActivateNpad(Kernel::HLERequestContext& ctx) {
1050 rb.Push(ResultSuccess); 1050 rb.Push(ResultSuccess);
1051} 1051}
1052 1052
1053void Hid::DeactivateNpad(Kernel::HLERequestContext& ctx) { 1053void Hid::DeactivateNpad(HLERequestContext& ctx) {
1054 IPC::RequestParser rp{ctx}; 1054 IPC::RequestParser rp{ctx};
1055 const auto applet_resource_user_id{rp.Pop<u64>()}; 1055 const auto applet_resource_user_id{rp.Pop<u64>()};
1056 1056
@@ -1062,7 +1062,7 @@ void Hid::DeactivateNpad(Kernel::HLERequestContext& ctx) {
1062 rb.Push(ResultSuccess); 1062 rb.Push(ResultSuccess);
1063} 1063}
1064 1064
1065void Hid::AcquireNpadStyleSetUpdateEventHandle(Kernel::HLERequestContext& ctx) { 1065void Hid::AcquireNpadStyleSetUpdateEventHandle(HLERequestContext& ctx) {
1066 IPC::RequestParser rp{ctx}; 1066 IPC::RequestParser rp{ctx};
1067 struct Parameters { 1067 struct Parameters {
1068 Core::HID::NpadIdType npad_id; 1068 Core::HID::NpadIdType npad_id;
@@ -1087,7 +1087,7 @@ void Hid::AcquireNpadStyleSetUpdateEventHandle(Kernel::HLERequestContext& ctx) {
1087 .GetStyleSetChangedEvent(parameters.npad_id)); 1087 .GetStyleSetChangedEvent(parameters.npad_id));
1088} 1088}
1089 1089
1090void Hid::DisconnectNpad(Kernel::HLERequestContext& ctx) { 1090void Hid::DisconnectNpad(HLERequestContext& ctx) {
1091 IPC::RequestParser rp{ctx}; 1091 IPC::RequestParser rp{ctx};
1092 struct Parameters { 1092 struct Parameters {
1093 Core::HID::NpadIdType npad_id; 1093 Core::HID::NpadIdType npad_id;
@@ -1108,7 +1108,7 @@ void Hid::DisconnectNpad(Kernel::HLERequestContext& ctx) {
1108 rb.Push(ResultSuccess); 1108 rb.Push(ResultSuccess);
1109} 1109}
1110 1110
1111void Hid::GetPlayerLedPattern(Kernel::HLERequestContext& ctx) { 1111void Hid::GetPlayerLedPattern(HLERequestContext& ctx) {
1112 IPC::RequestParser rp{ctx}; 1112 IPC::RequestParser rp{ctx};
1113 const auto npad_id{rp.PopEnum<Core::HID::NpadIdType>()}; 1113 const auto npad_id{rp.PopEnum<Core::HID::NpadIdType>()};
1114 1114
@@ -1123,7 +1123,7 @@ void Hid::GetPlayerLedPattern(Kernel::HLERequestContext& ctx) {
1123 rb.Push(pattern.raw); 1123 rb.Push(pattern.raw);
1124} 1124}
1125 1125
1126void Hid::ActivateNpadWithRevision(Kernel::HLERequestContext& ctx) { 1126void Hid::ActivateNpadWithRevision(HLERequestContext& ctx) {
1127 // Should have no effect with how our npad sets up the data 1127 // Should have no effect with how our npad sets up the data
1128 IPC::RequestParser rp{ctx}; 1128 IPC::RequestParser rp{ctx};
1129 struct Parameters { 1129 struct Parameters {
@@ -1144,7 +1144,7 @@ void Hid::ActivateNpadWithRevision(Kernel::HLERequestContext& ctx) {
1144 rb.Push(ResultSuccess); 1144 rb.Push(ResultSuccess);
1145} 1145}
1146 1146
1147void Hid::SetNpadJoyHoldType(Kernel::HLERequestContext& ctx) { 1147void Hid::SetNpadJoyHoldType(HLERequestContext& ctx) {
1148 IPC::RequestParser rp{ctx}; 1148 IPC::RequestParser rp{ctx};
1149 const auto applet_resource_user_id{rp.Pop<u64>()}; 1149 const auto applet_resource_user_id{rp.Pop<u64>()};
1150 const auto hold_type{rp.PopEnum<Controller_NPad::NpadJoyHoldType>()}; 1150 const auto hold_type{rp.PopEnum<Controller_NPad::NpadJoyHoldType>()};
@@ -1158,7 +1158,7 @@ void Hid::SetNpadJoyHoldType(Kernel::HLERequestContext& ctx) {
1158 rb.Push(ResultSuccess); 1158 rb.Push(ResultSuccess);
1159} 1159}
1160 1160
1161void Hid::GetNpadJoyHoldType(Kernel::HLERequestContext& ctx) { 1161void Hid::GetNpadJoyHoldType(HLERequestContext& ctx) {
1162 IPC::RequestParser rp{ctx}; 1162 IPC::RequestParser rp{ctx};
1163 const auto applet_resource_user_id{rp.Pop<u64>()}; 1163 const auto applet_resource_user_id{rp.Pop<u64>()};
1164 1164
@@ -1169,7 +1169,7 @@ void Hid::GetNpadJoyHoldType(Kernel::HLERequestContext& ctx) {
1169 rb.PushEnum(applet_resource->GetController<Controller_NPad>(HidController::NPad).GetHoldType()); 1169 rb.PushEnum(applet_resource->GetController<Controller_NPad>(HidController::NPad).GetHoldType());
1170} 1170}
1171 1171
1172void Hid::SetNpadJoyAssignmentModeSingleByDefault(Kernel::HLERequestContext& ctx) { 1172void Hid::SetNpadJoyAssignmentModeSingleByDefault(HLERequestContext& ctx) {
1173 IPC::RequestParser rp{ctx}; 1173 IPC::RequestParser rp{ctx};
1174 struct Parameters { 1174 struct Parameters {
1175 Core::HID::NpadIdType npad_id; 1175 Core::HID::NpadIdType npad_id;
@@ -1191,7 +1191,7 @@ void Hid::SetNpadJoyAssignmentModeSingleByDefault(Kernel::HLERequestContext& ctx
1191 rb.Push(ResultSuccess); 1191 rb.Push(ResultSuccess);
1192} 1192}
1193 1193
1194void Hid::SetNpadJoyAssignmentModeSingle(Kernel::HLERequestContext& ctx) { 1194void Hid::SetNpadJoyAssignmentModeSingle(HLERequestContext& ctx) {
1195 IPC::RequestParser rp{ctx}; 1195 IPC::RequestParser rp{ctx};
1196 struct Parameters { 1196 struct Parameters {
1197 Core::HID::NpadIdType npad_id; 1197 Core::HID::NpadIdType npad_id;
@@ -1215,7 +1215,7 @@ void Hid::SetNpadJoyAssignmentModeSingle(Kernel::HLERequestContext& ctx) {
1215 rb.Push(ResultSuccess); 1215 rb.Push(ResultSuccess);
1216} 1216}
1217 1217
1218void Hid::SetNpadJoyAssignmentModeDual(Kernel::HLERequestContext& ctx) { 1218void Hid::SetNpadJoyAssignmentModeDual(HLERequestContext& ctx) {
1219 IPC::RequestParser rp{ctx}; 1219 IPC::RequestParser rp{ctx};
1220 struct Parameters { 1220 struct Parameters {
1221 Core::HID::NpadIdType npad_id; 1221 Core::HID::NpadIdType npad_id;
@@ -1236,7 +1236,7 @@ void Hid::SetNpadJoyAssignmentModeDual(Kernel::HLERequestContext& ctx) {
1236 rb.Push(ResultSuccess); 1236 rb.Push(ResultSuccess);
1237} 1237}
1238 1238
1239void Hid::MergeSingleJoyAsDualJoy(Kernel::HLERequestContext& ctx) { 1239void Hid::MergeSingleJoyAsDualJoy(HLERequestContext& ctx) {
1240 IPC::RequestParser rp{ctx}; 1240 IPC::RequestParser rp{ctx};
1241 const auto npad_id_1{rp.PopEnum<Core::HID::NpadIdType>()}; 1241 const auto npad_id_1{rp.PopEnum<Core::HID::NpadIdType>()};
1242 const auto npad_id_2{rp.PopEnum<Core::HID::NpadIdType>()}; 1242 const auto npad_id_2{rp.PopEnum<Core::HID::NpadIdType>()};
@@ -1252,7 +1252,7 @@ void Hid::MergeSingleJoyAsDualJoy(Kernel::HLERequestContext& ctx) {
1252 rb.Push(result); 1252 rb.Push(result);
1253} 1253}
1254 1254
1255void Hid::StartLrAssignmentMode(Kernel::HLERequestContext& ctx) { 1255void Hid::StartLrAssignmentMode(HLERequestContext& ctx) {
1256 IPC::RequestParser rp{ctx}; 1256 IPC::RequestParser rp{ctx};
1257 const auto applet_resource_user_id{rp.Pop<u64>()}; 1257 const auto applet_resource_user_id{rp.Pop<u64>()};
1258 1258
@@ -1264,7 +1264,7 @@ void Hid::StartLrAssignmentMode(Kernel::HLERequestContext& ctx) {
1264 rb.Push(ResultSuccess); 1264 rb.Push(ResultSuccess);
1265} 1265}
1266 1266
1267void Hid::StopLrAssignmentMode(Kernel::HLERequestContext& ctx) { 1267void Hid::StopLrAssignmentMode(HLERequestContext& ctx) {
1268 IPC::RequestParser rp{ctx}; 1268 IPC::RequestParser rp{ctx};
1269 const auto applet_resource_user_id{rp.Pop<u64>()}; 1269 const auto applet_resource_user_id{rp.Pop<u64>()};
1270 1270
@@ -1276,7 +1276,7 @@ void Hid::StopLrAssignmentMode(Kernel::HLERequestContext& ctx) {
1276 rb.Push(ResultSuccess); 1276 rb.Push(ResultSuccess);
1277} 1277}
1278 1278
1279void Hid::SetNpadHandheldActivationMode(Kernel::HLERequestContext& ctx) { 1279void Hid::SetNpadHandheldActivationMode(HLERequestContext& ctx) {
1280 IPC::RequestParser rp{ctx}; 1280 IPC::RequestParser rp{ctx};
1281 const auto applet_resource_user_id{rp.Pop<u64>()}; 1281 const auto applet_resource_user_id{rp.Pop<u64>()};
1282 const auto activation_mode{rp.PopEnum<Controller_NPad::NpadHandheldActivationMode>()}; 1282 const auto activation_mode{rp.PopEnum<Controller_NPad::NpadHandheldActivationMode>()};
@@ -1291,7 +1291,7 @@ void Hid::SetNpadHandheldActivationMode(Kernel::HLERequestContext& ctx) {
1291 rb.Push(ResultSuccess); 1291 rb.Push(ResultSuccess);
1292} 1292}
1293 1293
1294void Hid::GetNpadHandheldActivationMode(Kernel::HLERequestContext& ctx) { 1294void Hid::GetNpadHandheldActivationMode(HLERequestContext& ctx) {
1295 IPC::RequestParser rp{ctx}; 1295 IPC::RequestParser rp{ctx};
1296 const auto applet_resource_user_id{rp.Pop<u64>()}; 1296 const auto applet_resource_user_id{rp.Pop<u64>()};
1297 1297
@@ -1303,7 +1303,7 @@ void Hid::GetNpadHandheldActivationMode(Kernel::HLERequestContext& ctx) {
1303 .GetNpadHandheldActivationMode()); 1303 .GetNpadHandheldActivationMode());
1304} 1304}
1305 1305
1306void Hid::SwapNpadAssignment(Kernel::HLERequestContext& ctx) { 1306void Hid::SwapNpadAssignment(HLERequestContext& ctx) {
1307 IPC::RequestParser rp{ctx}; 1307 IPC::RequestParser rp{ctx};
1308 const auto npad_id_1{rp.PopEnum<Core::HID::NpadIdType>()}; 1308 const auto npad_id_1{rp.PopEnum<Core::HID::NpadIdType>()};
1309 const auto npad_id_2{rp.PopEnum<Core::HID::NpadIdType>()}; 1309 const auto npad_id_2{rp.PopEnum<Core::HID::NpadIdType>()};
@@ -1319,7 +1319,7 @@ void Hid::SwapNpadAssignment(Kernel::HLERequestContext& ctx) {
1319 rb.Push(result); 1319 rb.Push(result);
1320} 1320}
1321 1321
1322void Hid::IsUnintendedHomeButtonInputProtectionEnabled(Kernel::HLERequestContext& ctx) { 1322void Hid::IsUnintendedHomeButtonInputProtectionEnabled(HLERequestContext& ctx) {
1323 IPC::RequestParser rp{ctx}; 1323 IPC::RequestParser rp{ctx};
1324 struct Parameters { 1324 struct Parameters {
1325 Core::HID::NpadIdType npad_id; 1325 Core::HID::NpadIdType npad_id;
@@ -1343,7 +1343,7 @@ void Hid::IsUnintendedHomeButtonInputProtectionEnabled(Kernel::HLERequestContext
1343 rb.Push(is_enabled); 1343 rb.Push(is_enabled);
1344} 1344}
1345 1345
1346void Hid::EnableUnintendedHomeButtonInputProtection(Kernel::HLERequestContext& ctx) { 1346void Hid::EnableUnintendedHomeButtonInputProtection(HLERequestContext& ctx) {
1347 IPC::RequestParser rp{ctx}; 1347 IPC::RequestParser rp{ctx};
1348 struct Parameters { 1348 struct Parameters {
1349 bool unintended_home_button_input_protection; 1349 bool unintended_home_button_input_protection;
@@ -1369,7 +1369,7 @@ void Hid::EnableUnintendedHomeButtonInputProtection(Kernel::HLERequestContext& c
1369 rb.Push(result); 1369 rb.Push(result);
1370} 1370}
1371 1371
1372void Hid::SetNpadAnalogStickUseCenterClamp(Kernel::HLERequestContext& ctx) { 1372void Hid::SetNpadAnalogStickUseCenterClamp(HLERequestContext& ctx) {
1373 IPC::RequestParser rp{ctx}; 1373 IPC::RequestParser rp{ctx};
1374 struct Parameters { 1374 struct Parameters {
1375 bool analog_stick_use_center_clamp; 1375 bool analog_stick_use_center_clamp;
@@ -1392,7 +1392,7 @@ void Hid::SetNpadAnalogStickUseCenterClamp(Kernel::HLERequestContext& ctx) {
1392 rb.Push(ResultSuccess); 1392 rb.Push(ResultSuccess);
1393} 1393}
1394 1394
1395void Hid::SetNpadCaptureButtonAssignment(Kernel::HLERequestContext& ctx) { 1395void Hid::SetNpadCaptureButtonAssignment(HLERequestContext& ctx) {
1396 IPC::RequestParser rp{ctx}; 1396 IPC::RequestParser rp{ctx};
1397 struct Parameters { 1397 struct Parameters {
1398 Core::HID::NpadStyleSet npad_styleset; 1398 Core::HID::NpadStyleSet npad_styleset;
@@ -1412,7 +1412,7 @@ void Hid::SetNpadCaptureButtonAssignment(Kernel::HLERequestContext& ctx) {
1412 rb.Push(ResultSuccess); 1412 rb.Push(ResultSuccess);
1413} 1413}
1414 1414
1415void Hid::ClearNpadCaptureButtonAssignment(Kernel::HLERequestContext& ctx) { 1415void Hid::ClearNpadCaptureButtonAssignment(HLERequestContext& ctx) {
1416 IPC::RequestParser rp{ctx}; 1416 IPC::RequestParser rp{ctx};
1417 const auto applet_resource_user_id{rp.Pop<u64>()}; 1417 const auto applet_resource_user_id{rp.Pop<u64>()};
1418 1418
@@ -1423,7 +1423,7 @@ void Hid::ClearNpadCaptureButtonAssignment(Kernel::HLERequestContext& ctx) {
1423 rb.Push(ResultSuccess); 1423 rb.Push(ResultSuccess);
1424} 1424}
1425 1425
1426void Hid::GetVibrationDeviceInfo(Kernel::HLERequestContext& ctx) { 1426void Hid::GetVibrationDeviceInfo(HLERequestContext& ctx) {
1427 IPC::RequestParser rp{ctx}; 1427 IPC::RequestParser rp{ctx};
1428 const auto vibration_device_handle{rp.PopRaw<Core::HID::VibrationDeviceHandle>()}; 1428 const auto vibration_device_handle{rp.PopRaw<Core::HID::VibrationDeviceHandle>()};
1429 const auto& controller = 1429 const auto& controller =
@@ -1483,7 +1483,7 @@ void Hid::GetVibrationDeviceInfo(Kernel::HLERequestContext& ctx) {
1483 rb.PushRaw(vibration_device_info); 1483 rb.PushRaw(vibration_device_info);
1484} 1484}
1485 1485
1486void Hid::SendVibrationValue(Kernel::HLERequestContext& ctx) { 1486void Hid::SendVibrationValue(HLERequestContext& ctx) {
1487 IPC::RequestParser rp{ctx}; 1487 IPC::RequestParser rp{ctx};
1488 struct Parameters { 1488 struct Parameters {
1489 Core::HID::VibrationDeviceHandle vibration_device_handle; 1489 Core::HID::VibrationDeviceHandle vibration_device_handle;
@@ -1508,7 +1508,7 @@ void Hid::SendVibrationValue(Kernel::HLERequestContext& ctx) {
1508 rb.Push(ResultSuccess); 1508 rb.Push(ResultSuccess);
1509} 1509}
1510 1510
1511void Hid::GetActualVibrationValue(Kernel::HLERequestContext& ctx) { 1511void Hid::GetActualVibrationValue(HLERequestContext& ctx) {
1512 IPC::RequestParser rp{ctx}; 1512 IPC::RequestParser rp{ctx};
1513 struct Parameters { 1513 struct Parameters {
1514 Core::HID::VibrationDeviceHandle vibration_device_handle; 1514 Core::HID::VibrationDeviceHandle vibration_device_handle;
@@ -1531,7 +1531,7 @@ void Hid::GetActualVibrationValue(Kernel::HLERequestContext& ctx) {
1531 .GetLastVibration(parameters.vibration_device_handle)); 1531 .GetLastVibration(parameters.vibration_device_handle));
1532} 1532}
1533 1533
1534void Hid::CreateActiveVibrationDeviceList(Kernel::HLERequestContext& ctx) { 1534void Hid::CreateActiveVibrationDeviceList(HLERequestContext& ctx) {
1535 LOG_DEBUG(Service_HID, "called"); 1535 LOG_DEBUG(Service_HID, "called");
1536 1536
1537 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 1537 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -1539,7 +1539,7 @@ void Hid::CreateActiveVibrationDeviceList(Kernel::HLERequestContext& ctx) {
1539 rb.PushIpcInterface<IActiveVibrationDeviceList>(system, applet_resource); 1539 rb.PushIpcInterface<IActiveVibrationDeviceList>(system, applet_resource);
1540} 1540}
1541 1541
1542void Hid::PermitVibration(Kernel::HLERequestContext& ctx) { 1542void Hid::PermitVibration(HLERequestContext& ctx) {
1543 IPC::RequestParser rp{ctx}; 1543 IPC::RequestParser rp{ctx};
1544 const auto can_vibrate{rp.Pop<bool>()}; 1544 const auto can_vibrate{rp.Pop<bool>()};
1545 1545
@@ -1553,7 +1553,7 @@ void Hid::PermitVibration(Kernel::HLERequestContext& ctx) {
1553 rb.Push(ResultSuccess); 1553 rb.Push(ResultSuccess);
1554} 1554}
1555 1555
1556void Hid::IsVibrationPermitted(Kernel::HLERequestContext& ctx) { 1556void Hid::IsVibrationPermitted(HLERequestContext& ctx) {
1557 LOG_DEBUG(Service_HID, "called"); 1557 LOG_DEBUG(Service_HID, "called");
1558 1558
1559 // nnSDK checks if a float is greater than zero. We return the bool we stored earlier 1559 // nnSDK checks if a float is greater than zero. We return the bool we stored earlier
@@ -1564,7 +1564,7 @@ void Hid::IsVibrationPermitted(Kernel::HLERequestContext& ctx) {
1564 rb.Push(is_enabled); 1564 rb.Push(is_enabled);
1565} 1565}
1566 1566
1567void Hid::SendVibrationValues(Kernel::HLERequestContext& ctx) { 1567void Hid::SendVibrationValues(HLERequestContext& ctx) {
1568 IPC::RequestParser rp{ctx}; 1568 IPC::RequestParser rp{ctx};
1569 const auto applet_resource_user_id{rp.Pop<u64>()}; 1569 const auto applet_resource_user_id{rp.Pop<u64>()};
1570 1570
@@ -1588,7 +1588,7 @@ void Hid::SendVibrationValues(Kernel::HLERequestContext& ctx) {
1588 rb.Push(ResultSuccess); 1588 rb.Push(ResultSuccess);
1589} 1589}
1590 1590
1591void Hid::SendVibrationGcErmCommand(Kernel::HLERequestContext& ctx) { 1591void Hid::SendVibrationGcErmCommand(HLERequestContext& ctx) {
1592 IPC::RequestParser rp{ctx}; 1592 IPC::RequestParser rp{ctx};
1593 struct Parameters { 1593 struct Parameters {
1594 Core::HID::VibrationDeviceHandle vibration_device_handle; 1594 Core::HID::VibrationDeviceHandle vibration_device_handle;
@@ -1649,7 +1649,7 @@ void Hid::SendVibrationGcErmCommand(Kernel::HLERequestContext& ctx) {
1649 rb.Push(ResultSuccess); 1649 rb.Push(ResultSuccess);
1650} 1650}
1651 1651
1652void Hid::GetActualVibrationGcErmCommand(Kernel::HLERequestContext& ctx) { 1652void Hid::GetActualVibrationGcErmCommand(HLERequestContext& ctx) {
1653 IPC::RequestParser rp{ctx}; 1653 IPC::RequestParser rp{ctx};
1654 struct Parameters { 1654 struct Parameters {
1655 Core::HID::VibrationDeviceHandle vibration_device_handle; 1655 Core::HID::VibrationDeviceHandle vibration_device_handle;
@@ -1691,7 +1691,7 @@ void Hid::GetActualVibrationGcErmCommand(Kernel::HLERequestContext& ctx) {
1691 rb.PushEnum(gc_erm_command); 1691 rb.PushEnum(gc_erm_command);
1692} 1692}
1693 1693
1694void Hid::BeginPermitVibrationSession(Kernel::HLERequestContext& ctx) { 1694void Hid::BeginPermitVibrationSession(HLERequestContext& ctx) {
1695 IPC::RequestParser rp{ctx}; 1695 IPC::RequestParser rp{ctx};
1696 const auto applet_resource_user_id{rp.Pop<u64>()}; 1696 const auto applet_resource_user_id{rp.Pop<u64>()};
1697 1697
@@ -1704,7 +1704,7 @@ void Hid::BeginPermitVibrationSession(Kernel::HLERequestContext& ctx) {
1704 rb.Push(ResultSuccess); 1704 rb.Push(ResultSuccess);
1705} 1705}
1706 1706
1707void Hid::EndPermitVibrationSession(Kernel::HLERequestContext& ctx) { 1707void Hid::EndPermitVibrationSession(HLERequestContext& ctx) {
1708 applet_resource->GetController<Controller_NPad>(HidController::NPad) 1708 applet_resource->GetController<Controller_NPad>(HidController::NPad)
1709 .SetPermitVibrationSession(false); 1709 .SetPermitVibrationSession(false);
1710 1710
@@ -1714,7 +1714,7 @@ void Hid::EndPermitVibrationSession(Kernel::HLERequestContext& ctx) {
1714 rb.Push(ResultSuccess); 1714 rb.Push(ResultSuccess);
1715} 1715}
1716 1716
1717void Hid::IsVibrationDeviceMounted(Kernel::HLERequestContext& ctx) { 1717void Hid::IsVibrationDeviceMounted(HLERequestContext& ctx) {
1718 IPC::RequestParser rp{ctx}; 1718 IPC::RequestParser rp{ctx};
1719 struct Parameters { 1719 struct Parameters {
1720 Core::HID::VibrationDeviceHandle vibration_device_handle; 1720 Core::HID::VibrationDeviceHandle vibration_device_handle;
@@ -1737,7 +1737,7 @@ void Hid::IsVibrationDeviceMounted(Kernel::HLERequestContext& ctx) {
1737 .IsVibrationDeviceMounted(parameters.vibration_device_handle)); 1737 .IsVibrationDeviceMounted(parameters.vibration_device_handle));
1738} 1738}
1739 1739
1740void Hid::ActivateConsoleSixAxisSensor(Kernel::HLERequestContext& ctx) { 1740void Hid::ActivateConsoleSixAxisSensor(HLERequestContext& ctx) {
1741 IPC::RequestParser rp{ctx}; 1741 IPC::RequestParser rp{ctx};
1742 const auto applet_resource_user_id{rp.Pop<u64>()}; 1742 const auto applet_resource_user_id{rp.Pop<u64>()};
1743 1743
@@ -1749,7 +1749,7 @@ void Hid::ActivateConsoleSixAxisSensor(Kernel::HLERequestContext& ctx) {
1749 rb.Push(ResultSuccess); 1749 rb.Push(ResultSuccess);
1750} 1750}
1751 1751
1752void Hid::StartConsoleSixAxisSensor(Kernel::HLERequestContext& ctx) { 1752void Hid::StartConsoleSixAxisSensor(HLERequestContext& ctx) {
1753 IPC::RequestParser rp{ctx}; 1753 IPC::RequestParser rp{ctx};
1754 struct Parameters { 1754 struct Parameters {
1755 Core::HID::ConsoleSixAxisSensorHandle console_sixaxis_handle; 1755 Core::HID::ConsoleSixAxisSensorHandle console_sixaxis_handle;
@@ -1769,7 +1769,7 @@ void Hid::StartConsoleSixAxisSensor(Kernel::HLERequestContext& ctx) {
1769 rb.Push(ResultSuccess); 1769 rb.Push(ResultSuccess);
1770} 1770}
1771 1771
1772void Hid::StopConsoleSixAxisSensor(Kernel::HLERequestContext& ctx) { 1772void Hid::StopConsoleSixAxisSensor(HLERequestContext& ctx) {
1773 IPC::RequestParser rp{ctx}; 1773 IPC::RequestParser rp{ctx};
1774 struct Parameters { 1774 struct Parameters {
1775 Core::HID::ConsoleSixAxisSensorHandle console_sixaxis_handle; 1775 Core::HID::ConsoleSixAxisSensorHandle console_sixaxis_handle;
@@ -1789,7 +1789,7 @@ void Hid::StopConsoleSixAxisSensor(Kernel::HLERequestContext& ctx) {
1789 rb.Push(ResultSuccess); 1789 rb.Push(ResultSuccess);
1790} 1790}
1791 1791
1792void Hid::ActivateSevenSixAxisSensor(Kernel::HLERequestContext& ctx) { 1792void Hid::ActivateSevenSixAxisSensor(HLERequestContext& ctx) {
1793 IPC::RequestParser rp{ctx}; 1793 IPC::RequestParser rp{ctx};
1794 const auto applet_resource_user_id{rp.Pop<u64>()}; 1794 const auto applet_resource_user_id{rp.Pop<u64>()};
1795 1795
@@ -1801,7 +1801,7 @@ void Hid::ActivateSevenSixAxisSensor(Kernel::HLERequestContext& ctx) {
1801 rb.Push(ResultSuccess); 1801 rb.Push(ResultSuccess);
1802} 1802}
1803 1803
1804void Hid::StartSevenSixAxisSensor(Kernel::HLERequestContext& ctx) { 1804void Hid::StartSevenSixAxisSensor(HLERequestContext& ctx) {
1805 IPC::RequestParser rp{ctx}; 1805 IPC::RequestParser rp{ctx};
1806 const auto applet_resource_user_id{rp.Pop<u64>()}; 1806 const auto applet_resource_user_id{rp.Pop<u64>()};
1807 1807
@@ -1812,7 +1812,7 @@ void Hid::StartSevenSixAxisSensor(Kernel::HLERequestContext& ctx) {
1812 rb.Push(ResultSuccess); 1812 rb.Push(ResultSuccess);
1813} 1813}
1814 1814
1815void Hid::StopSevenSixAxisSensor(Kernel::HLERequestContext& ctx) { 1815void Hid::StopSevenSixAxisSensor(HLERequestContext& ctx) {
1816 IPC::RequestParser rp{ctx}; 1816 IPC::RequestParser rp{ctx};
1817 const auto applet_resource_user_id{rp.Pop<u64>()}; 1817 const auto applet_resource_user_id{rp.Pop<u64>()};
1818 1818
@@ -1823,7 +1823,7 @@ void Hid::StopSevenSixAxisSensor(Kernel::HLERequestContext& ctx) {
1823 rb.Push(ResultSuccess); 1823 rb.Push(ResultSuccess);
1824} 1824}
1825 1825
1826void Hid::InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) { 1826void Hid::InitializeSevenSixAxisSensor(HLERequestContext& ctx) {
1827 IPC::RequestParser rp{ctx}; 1827 IPC::RequestParser rp{ctx};
1828 const auto applet_resource_user_id{rp.Pop<u64>()}; 1828 const auto applet_resource_user_id{rp.Pop<u64>()};
1829 const auto t_mem_1_size{rp.Pop<u64>()}; 1829 const auto t_mem_1_size{rp.Pop<u64>()};
@@ -1873,7 +1873,7 @@ void Hid::InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) {
1873 rb.Push(ResultSuccess); 1873 rb.Push(ResultSuccess);
1874} 1874}
1875 1875
1876void Hid::FinalizeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) { 1876void Hid::FinalizeSevenSixAxisSensor(HLERequestContext& ctx) {
1877 IPC::RequestParser rp{ctx}; 1877 IPC::RequestParser rp{ctx};
1878 const auto applet_resource_user_id{rp.Pop<u64>()}; 1878 const auto applet_resource_user_id{rp.Pop<u64>()};
1879 1879
@@ -1884,7 +1884,7 @@ void Hid::FinalizeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) {
1884 rb.Push(ResultSuccess); 1884 rb.Push(ResultSuccess);
1885} 1885}
1886 1886
1887void Hid::ResetSevenSixAxisSensorTimestamp(Kernel::HLERequestContext& ctx) { 1887void Hid::ResetSevenSixAxisSensorTimestamp(HLERequestContext& ctx) {
1888 IPC::RequestParser rp{ctx}; 1888 IPC::RequestParser rp{ctx};
1889 const auto applet_resource_user_id{rp.Pop<u64>()}; 1889 const auto applet_resource_user_id{rp.Pop<u64>()};
1890 1890
@@ -1897,7 +1897,7 @@ void Hid::ResetSevenSixAxisSensorTimestamp(Kernel::HLERequestContext& ctx) {
1897 rb.Push(ResultSuccess); 1897 rb.Push(ResultSuccess);
1898} 1898}
1899 1899
1900void Hid::IsUsbFullKeyControllerEnabled(Kernel::HLERequestContext& ctx) { 1900void Hid::IsUsbFullKeyControllerEnabled(HLERequestContext& ctx) {
1901 IPC::RequestParser rp{ctx}; 1901 IPC::RequestParser rp{ctx};
1902 1902
1903 LOG_WARNING(Service_HID, "(STUBBED) called"); 1903 LOG_WARNING(Service_HID, "(STUBBED) called");
@@ -1907,7 +1907,7 @@ void Hid::IsUsbFullKeyControllerEnabled(Kernel::HLERequestContext& ctx) {
1907 rb.Push(false); 1907 rb.Push(false);
1908} 1908}
1909 1909
1910void Hid::GetPalmaConnectionHandle(Kernel::HLERequestContext& ctx) { 1910void Hid::GetPalmaConnectionHandle(HLERequestContext& ctx) {
1911 IPC::RequestParser rp{ctx}; 1911 IPC::RequestParser rp{ctx};
1912 struct Parameters { 1912 struct Parameters {
1913 Core::HID::NpadIdType npad_id; 1913 Core::HID::NpadIdType npad_id;
@@ -1930,7 +1930,7 @@ void Hid::GetPalmaConnectionHandle(Kernel::HLERequestContext& ctx) {
1930 rb.PushRaw(handle); 1930 rb.PushRaw(handle);
1931} 1931}
1932 1932
1933void Hid::InitializePalma(Kernel::HLERequestContext& ctx) { 1933void Hid::InitializePalma(HLERequestContext& ctx) {
1934 IPC::RequestParser rp{ctx}; 1934 IPC::RequestParser rp{ctx};
1935 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()}; 1935 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()};
1936 1936
@@ -1943,7 +1943,7 @@ void Hid::InitializePalma(Kernel::HLERequestContext& ctx) {
1943 rb.Push(result); 1943 rb.Push(result);
1944} 1944}
1945 1945
1946void Hid::AcquirePalmaOperationCompleteEvent(Kernel::HLERequestContext& ctx) { 1946void Hid::AcquirePalmaOperationCompleteEvent(HLERequestContext& ctx) {
1947 IPC::RequestParser rp{ctx}; 1947 IPC::RequestParser rp{ctx};
1948 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()}; 1948 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()};
1949 1949
@@ -1956,7 +1956,7 @@ void Hid::AcquirePalmaOperationCompleteEvent(Kernel::HLERequestContext& ctx) {
1956 rb.PushCopyObjects(controller.AcquirePalmaOperationCompleteEvent(connection_handle)); 1956 rb.PushCopyObjects(controller.AcquirePalmaOperationCompleteEvent(connection_handle));
1957} 1957}
1958 1958
1959void Hid::GetPalmaOperationInfo(Kernel::HLERequestContext& ctx) { 1959void Hid::GetPalmaOperationInfo(HLERequestContext& ctx) {
1960 IPC::RequestParser rp{ctx}; 1960 IPC::RequestParser rp{ctx};
1961 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()}; 1961 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()};
1962 1962
@@ -1978,7 +1978,7 @@ void Hid::GetPalmaOperationInfo(Kernel::HLERequestContext& ctx) {
1978 rb.Push(static_cast<u64>(operation_type)); 1978 rb.Push(static_cast<u64>(operation_type));
1979} 1979}
1980 1980
1981void Hid::PlayPalmaActivity(Kernel::HLERequestContext& ctx) { 1981void Hid::PlayPalmaActivity(HLERequestContext& ctx) {
1982 IPC::RequestParser rp{ctx}; 1982 IPC::RequestParser rp{ctx};
1983 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()}; 1983 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()};
1984 const auto palma_activity{rp.Pop<u64>()}; 1984 const auto palma_activity{rp.Pop<u64>()};
@@ -1993,7 +1993,7 @@ void Hid::PlayPalmaActivity(Kernel::HLERequestContext& ctx) {
1993 rb.Push(result); 1993 rb.Push(result);
1994} 1994}
1995 1995
1996void Hid::SetPalmaFrModeType(Kernel::HLERequestContext& ctx) { 1996void Hid::SetPalmaFrModeType(HLERequestContext& ctx) {
1997 IPC::RequestParser rp{ctx}; 1997 IPC::RequestParser rp{ctx};
1998 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()}; 1998 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()};
1999 const auto fr_mode{rp.PopEnum<Controller_Palma::PalmaFrModeType>()}; 1999 const auto fr_mode{rp.PopEnum<Controller_Palma::PalmaFrModeType>()};
@@ -2008,7 +2008,7 @@ void Hid::SetPalmaFrModeType(Kernel::HLERequestContext& ctx) {
2008 rb.Push(result); 2008 rb.Push(result);
2009} 2009}
2010 2010
2011void Hid::ReadPalmaStep(Kernel::HLERequestContext& ctx) { 2011void Hid::ReadPalmaStep(HLERequestContext& ctx) {
2012 IPC::RequestParser rp{ctx}; 2012 IPC::RequestParser rp{ctx};
2013 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()}; 2013 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()};
2014 2014
@@ -2021,7 +2021,7 @@ void Hid::ReadPalmaStep(Kernel::HLERequestContext& ctx) {
2021 rb.Push(result); 2021 rb.Push(result);
2022} 2022}
2023 2023
2024void Hid::EnablePalmaStep(Kernel::HLERequestContext& ctx) { 2024void Hid::EnablePalmaStep(HLERequestContext& ctx) {
2025 IPC::RequestParser rp{ctx}; 2025 IPC::RequestParser rp{ctx};
2026 struct Parameters { 2026 struct Parameters {
2027 bool is_enabled; 2027 bool is_enabled;
@@ -2043,7 +2043,7 @@ void Hid::EnablePalmaStep(Kernel::HLERequestContext& ctx) {
2043 rb.Push(result); 2043 rb.Push(result);
2044} 2044}
2045 2045
2046void Hid::ResetPalmaStep(Kernel::HLERequestContext& ctx) { 2046void Hid::ResetPalmaStep(HLERequestContext& ctx) {
2047 IPC::RequestParser rp{ctx}; 2047 IPC::RequestParser rp{ctx};
2048 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()}; 2048 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()};
2049 2049
@@ -2056,21 +2056,21 @@ void Hid::ResetPalmaStep(Kernel::HLERequestContext& ctx) {
2056 rb.Push(result); 2056 rb.Push(result);
2057} 2057}
2058 2058
2059void Hid::ReadPalmaApplicationSection(Kernel::HLERequestContext& ctx) { 2059void Hid::ReadPalmaApplicationSection(HLERequestContext& ctx) {
2060 LOG_WARNING(Service_HID, "(STUBBED) called"); 2060 LOG_WARNING(Service_HID, "(STUBBED) called");
2061 2061
2062 IPC::ResponseBuilder rb{ctx, 2}; 2062 IPC::ResponseBuilder rb{ctx, 2};
2063 rb.Push(ResultSuccess); 2063 rb.Push(ResultSuccess);
2064} 2064}
2065 2065
2066void Hid::WritePalmaApplicationSection(Kernel::HLERequestContext& ctx) { 2066void Hid::WritePalmaApplicationSection(HLERequestContext& ctx) {
2067 LOG_WARNING(Service_HID, "(STUBBED) called"); 2067 LOG_WARNING(Service_HID, "(STUBBED) called");
2068 2068
2069 IPC::ResponseBuilder rb{ctx, 2}; 2069 IPC::ResponseBuilder rb{ctx, 2};
2070 rb.Push(ResultSuccess); 2070 rb.Push(ResultSuccess);
2071} 2071}
2072 2072
2073void Hid::ReadPalmaUniqueCode(Kernel::HLERequestContext& ctx) { 2073void Hid::ReadPalmaUniqueCode(HLERequestContext& ctx) {
2074 IPC::RequestParser rp{ctx}; 2074 IPC::RequestParser rp{ctx};
2075 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()}; 2075 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()};
2076 2076
@@ -2083,7 +2083,7 @@ void Hid::ReadPalmaUniqueCode(Kernel::HLERequestContext& ctx) {
2083 rb.Push(ResultSuccess); 2083 rb.Push(ResultSuccess);
2084} 2084}
2085 2085
2086void Hid::SetPalmaUniqueCodeInvalid(Kernel::HLERequestContext& ctx) { 2086void Hid::SetPalmaUniqueCodeInvalid(HLERequestContext& ctx) {
2087 IPC::RequestParser rp{ctx}; 2087 IPC::RequestParser rp{ctx};
2088 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()}; 2088 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()};
2089 2089
@@ -2096,14 +2096,14 @@ void Hid::SetPalmaUniqueCodeInvalid(Kernel::HLERequestContext& ctx) {
2096 rb.Push(ResultSuccess); 2096 rb.Push(ResultSuccess);
2097} 2097}
2098 2098
2099void Hid::WritePalmaActivityEntry(Kernel::HLERequestContext& ctx) { 2099void Hid::WritePalmaActivityEntry(HLERequestContext& ctx) {
2100 LOG_CRITICAL(Service_HID, "(STUBBED) called"); 2100 LOG_CRITICAL(Service_HID, "(STUBBED) called");
2101 2101
2102 IPC::ResponseBuilder rb{ctx, 2}; 2102 IPC::ResponseBuilder rb{ctx, 2};
2103 rb.Push(ResultSuccess); 2103 rb.Push(ResultSuccess);
2104} 2104}
2105 2105
2106void Hid::WritePalmaRgbLedPatternEntry(Kernel::HLERequestContext& ctx) { 2106void Hid::WritePalmaRgbLedPatternEntry(HLERequestContext& ctx) {
2107 IPC::RequestParser rp{ctx}; 2107 IPC::RequestParser rp{ctx};
2108 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()}; 2108 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()};
2109 const auto unknown{rp.Pop<u64>()}; 2109 const auto unknown{rp.Pop<u64>()};
@@ -2120,7 +2120,7 @@ void Hid::WritePalmaRgbLedPatternEntry(Kernel::HLERequestContext& ctx) {
2120 rb.Push(ResultSuccess); 2120 rb.Push(ResultSuccess);
2121} 2121}
2122 2122
2123void Hid::WritePalmaWaveEntry(Kernel::HLERequestContext& ctx) { 2123void Hid::WritePalmaWaveEntry(HLERequestContext& ctx) {
2124 IPC::RequestParser rp{ctx}; 2124 IPC::RequestParser rp{ctx};
2125 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()}; 2125 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()};
2126 const auto wave_set{rp.PopEnum<Controller_Palma::PalmaWaveSet>()}; 2126 const auto wave_set{rp.PopEnum<Controller_Palma::PalmaWaveSet>()};
@@ -2155,7 +2155,7 @@ void Hid::WritePalmaWaveEntry(Kernel::HLERequestContext& ctx) {
2155 rb.Push(ResultSuccess); 2155 rb.Push(ResultSuccess);
2156} 2156}
2157 2157
2158void Hid::SetPalmaDataBaseIdentificationVersion(Kernel::HLERequestContext& ctx) { 2158void Hid::SetPalmaDataBaseIdentificationVersion(HLERequestContext& ctx) {
2159 IPC::RequestParser rp{ctx}; 2159 IPC::RequestParser rp{ctx};
2160 struct Parameters { 2160 struct Parameters {
2161 s32 database_id_version; 2161 s32 database_id_version;
@@ -2177,7 +2177,7 @@ void Hid::SetPalmaDataBaseIdentificationVersion(Kernel::HLERequestContext& ctx)
2177 rb.Push(ResultSuccess); 2177 rb.Push(ResultSuccess);
2178} 2178}
2179 2179
2180void Hid::GetPalmaDataBaseIdentificationVersion(Kernel::HLERequestContext& ctx) { 2180void Hid::GetPalmaDataBaseIdentificationVersion(HLERequestContext& ctx) {
2181 IPC::RequestParser rp{ctx}; 2181 IPC::RequestParser rp{ctx};
2182 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()}; 2182 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()};
2183 2183
@@ -2190,14 +2190,14 @@ void Hid::GetPalmaDataBaseIdentificationVersion(Kernel::HLERequestContext& ctx)
2190 rb.Push(ResultSuccess); 2190 rb.Push(ResultSuccess);
2191} 2191}
2192 2192
2193void Hid::SuspendPalmaFeature(Kernel::HLERequestContext& ctx) { 2193void Hid::SuspendPalmaFeature(HLERequestContext& ctx) {
2194 LOG_WARNING(Service_HID, "(STUBBED) called"); 2194 LOG_WARNING(Service_HID, "(STUBBED) called");
2195 2195
2196 IPC::ResponseBuilder rb{ctx, 2}; 2196 IPC::ResponseBuilder rb{ctx, 2};
2197 rb.Push(ResultSuccess); 2197 rb.Push(ResultSuccess);
2198} 2198}
2199 2199
2200void Hid::GetPalmaOperationResult(Kernel::HLERequestContext& ctx) { 2200void Hid::GetPalmaOperationResult(HLERequestContext& ctx) {
2201 IPC::RequestParser rp{ctx}; 2201 IPC::RequestParser rp{ctx};
2202 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()}; 2202 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()};
2203 2203
@@ -2210,21 +2210,21 @@ void Hid::GetPalmaOperationResult(Kernel::HLERequestContext& ctx) {
2210 rb.Push(result); 2210 rb.Push(result);
2211} 2211}
2212 2212
2213void Hid::ReadPalmaPlayLog(Kernel::HLERequestContext& ctx) { 2213void Hid::ReadPalmaPlayLog(HLERequestContext& ctx) {
2214 LOG_WARNING(Service_HID, "(STUBBED) called"); 2214 LOG_WARNING(Service_HID, "(STUBBED) called");
2215 2215
2216 IPC::ResponseBuilder rb{ctx, 2}; 2216 IPC::ResponseBuilder rb{ctx, 2};
2217 rb.Push(ResultSuccess); 2217 rb.Push(ResultSuccess);
2218} 2218}
2219 2219
2220void Hid::ResetPalmaPlayLog(Kernel::HLERequestContext& ctx) { 2220void Hid::ResetPalmaPlayLog(HLERequestContext& ctx) {
2221 LOG_WARNING(Service_HID, "(STUBBED) called"); 2221 LOG_WARNING(Service_HID, "(STUBBED) called");
2222 2222
2223 IPC::ResponseBuilder rb{ctx, 2}; 2223 IPC::ResponseBuilder rb{ctx, 2};
2224 rb.Push(ResultSuccess); 2224 rb.Push(ResultSuccess);
2225} 2225}
2226 2226
2227void Hid::SetIsPalmaAllConnectable(Kernel::HLERequestContext& ctx) { 2227void Hid::SetIsPalmaAllConnectable(HLERequestContext& ctx) {
2228 IPC::RequestParser rp{ctx}; 2228 IPC::RequestParser rp{ctx};
2229 struct Parameters { 2229 struct Parameters {
2230 bool is_palma_all_connectable; 2230 bool is_palma_all_connectable;
@@ -2246,14 +2246,14 @@ void Hid::SetIsPalmaAllConnectable(Kernel::HLERequestContext& ctx) {
2246 rb.Push(ResultSuccess); 2246 rb.Push(ResultSuccess);
2247} 2247}
2248 2248
2249void Hid::SetIsPalmaPairedConnectable(Kernel::HLERequestContext& ctx) { 2249void Hid::SetIsPalmaPairedConnectable(HLERequestContext& ctx) {
2250 LOG_WARNING(Service_HID, "(STUBBED) called"); 2250 LOG_WARNING(Service_HID, "(STUBBED) called");
2251 2251
2252 IPC::ResponseBuilder rb{ctx, 2}; 2252 IPC::ResponseBuilder rb{ctx, 2};
2253 rb.Push(ResultSuccess); 2253 rb.Push(ResultSuccess);
2254} 2254}
2255 2255
2256void Hid::PairPalma(Kernel::HLERequestContext& ctx) { 2256void Hid::PairPalma(HLERequestContext& ctx) {
2257 IPC::RequestParser rp{ctx}; 2257 IPC::RequestParser rp{ctx};
2258 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()}; 2258 const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()};
2259 2259
@@ -2266,7 +2266,7 @@ void Hid::PairPalma(Kernel::HLERequestContext& ctx) {
2266 rb.Push(ResultSuccess); 2266 rb.Push(ResultSuccess);
2267} 2267}
2268 2268
2269void Hid::SetPalmaBoostMode(Kernel::HLERequestContext& ctx) { 2269void Hid::SetPalmaBoostMode(HLERequestContext& ctx) {
2270 IPC::RequestParser rp{ctx}; 2270 IPC::RequestParser rp{ctx};
2271 const auto palma_boost_mode{rp.Pop<bool>()}; 2271 const auto palma_boost_mode{rp.Pop<bool>()};
2272 2272
@@ -2279,35 +2279,35 @@ void Hid::SetPalmaBoostMode(Kernel::HLERequestContext& ctx) {
2279 rb.Push(ResultSuccess); 2279 rb.Push(ResultSuccess);
2280} 2280}
2281 2281
2282void Hid::CancelWritePalmaWaveEntry(Kernel::HLERequestContext& ctx) { 2282void Hid::CancelWritePalmaWaveEntry(HLERequestContext& ctx) {
2283 LOG_WARNING(Service_HID, "(STUBBED) called"); 2283 LOG_WARNING(Service_HID, "(STUBBED) called");
2284 2284
2285 IPC::ResponseBuilder rb{ctx, 2}; 2285 IPC::ResponseBuilder rb{ctx, 2};
2286 rb.Push(ResultSuccess); 2286 rb.Push(ResultSuccess);
2287} 2287}
2288 2288
2289void Hid::EnablePalmaBoostMode(Kernel::HLERequestContext& ctx) { 2289void Hid::EnablePalmaBoostMode(HLERequestContext& ctx) {
2290 LOG_WARNING(Service_HID, "(STUBBED) called"); 2290 LOG_WARNING(Service_HID, "(STUBBED) called");
2291 2291
2292 IPC::ResponseBuilder rb{ctx, 2}; 2292 IPC::ResponseBuilder rb{ctx, 2};
2293 rb.Push(ResultSuccess); 2293 rb.Push(ResultSuccess);
2294} 2294}
2295 2295
2296void Hid::GetPalmaBluetoothAddress(Kernel::HLERequestContext& ctx) { 2296void Hid::GetPalmaBluetoothAddress(HLERequestContext& ctx) {
2297 LOG_WARNING(Service_HID, "(STUBBED) called"); 2297 LOG_WARNING(Service_HID, "(STUBBED) called");
2298 2298
2299 IPC::ResponseBuilder rb{ctx, 2}; 2299 IPC::ResponseBuilder rb{ctx, 2};
2300 rb.Push(ResultSuccess); 2300 rb.Push(ResultSuccess);
2301} 2301}
2302 2302
2303void Hid::SetDisallowedPalmaConnection(Kernel::HLERequestContext& ctx) { 2303void Hid::SetDisallowedPalmaConnection(HLERequestContext& ctx) {
2304 LOG_WARNING(Service_HID, "(STUBBED) called"); 2304 LOG_WARNING(Service_HID, "(STUBBED) called");
2305 2305
2306 IPC::ResponseBuilder rb{ctx, 2}; 2306 IPC::ResponseBuilder rb{ctx, 2};
2307 rb.Push(ResultSuccess); 2307 rb.Push(ResultSuccess);
2308} 2308}
2309 2309
2310void Hid::SetNpadCommunicationMode(Kernel::HLERequestContext& ctx) { 2310void Hid::SetNpadCommunicationMode(HLERequestContext& ctx) {
2311 IPC::RequestParser rp{ctx}; 2311 IPC::RequestParser rp{ctx};
2312 const auto applet_resource_user_id{rp.Pop<u64>()}; 2312 const auto applet_resource_user_id{rp.Pop<u64>()};
2313 const auto communication_mode{rp.PopEnum<Controller_NPad::NpadCommunicationMode>()}; 2313 const auto communication_mode{rp.PopEnum<Controller_NPad::NpadCommunicationMode>()};
@@ -2322,7 +2322,7 @@ void Hid::SetNpadCommunicationMode(Kernel::HLERequestContext& ctx) {
2322 rb.Push(ResultSuccess); 2322 rb.Push(ResultSuccess);
2323} 2323}
2324 2324
2325void Hid::GetNpadCommunicationMode(Kernel::HLERequestContext& ctx) { 2325void Hid::GetNpadCommunicationMode(HLERequestContext& ctx) {
2326 IPC::RequestParser rp{ctx}; 2326 IPC::RequestParser rp{ctx};
2327 2327
2328 LOG_WARNING(Service_HID, "(STUBBED) called"); 2328 LOG_WARNING(Service_HID, "(STUBBED) called");
@@ -2333,7 +2333,7 @@ void Hid::GetNpadCommunicationMode(Kernel::HLERequestContext& ctx) {
2333 .GetNpadCommunicationMode()); 2333 .GetNpadCommunicationMode());
2334} 2334}
2335 2335
2336void Hid::SetTouchScreenConfiguration(Kernel::HLERequestContext& ctx) { 2336void Hid::SetTouchScreenConfiguration(HLERequestContext& ctx) {
2337 IPC::RequestParser rp{ctx}; 2337 IPC::RequestParser rp{ctx};
2338 const auto touchscreen_mode{rp.PopRaw<Controller_Touchscreen::TouchScreenConfigurationForNx>()}; 2338 const auto touchscreen_mode{rp.PopRaw<Controller_Touchscreen::TouchScreenConfigurationForNx>()};
2339 const auto applet_resource_user_id{rp.Pop<u64>()}; 2339 const auto applet_resource_user_id{rp.Pop<u64>()};
@@ -2345,7 +2345,7 @@ void Hid::SetTouchScreenConfiguration(Kernel::HLERequestContext& ctx) {
2345 rb.Push(ResultSuccess); 2345 rb.Push(ResultSuccess);
2346} 2346}
2347 2347
2348void Hid::IsFirmwareUpdateNeededForNotification(Kernel::HLERequestContext& ctx) { 2348void Hid::IsFirmwareUpdateNeededForNotification(HLERequestContext& ctx) {
2349 IPC::RequestParser rp{ctx}; 2349 IPC::RequestParser rp{ctx};
2350 struct Parameters { 2350 struct Parameters {
2351 s32 unknown; 2351 s32 unknown;
@@ -2719,7 +2719,7 @@ public:
2719 } 2719 }
2720 2720
2721private: 2721private:
2722 void ApplyNpadSystemCommonPolicy(Kernel::HLERequestContext& ctx) { 2722 void ApplyNpadSystemCommonPolicy(HLERequestContext& ctx) {
2723 // We already do this for homebrew so we can just stub it out 2723 // We already do this for homebrew so we can just stub it out
2724 LOG_WARNING(Service_HID, "called"); 2724 LOG_WARNING(Service_HID, "called");
2725 2725
@@ -2727,7 +2727,7 @@ private:
2727 rb.Push(ResultSuccess); 2727 rb.Push(ResultSuccess);
2728 } 2728 }
2729 2729
2730 void GetUniquePadsFromNpad(Kernel::HLERequestContext& ctx) { 2730 void GetUniquePadsFromNpad(HLERequestContext& ctx) {
2731 IPC::RequestParser rp{ctx}; 2731 IPC::RequestParser rp{ctx};
2732 const auto npad_id_type{rp.PopEnum<Core::HID::NpadIdType>()}; 2732 const auto npad_id_type{rp.PopEnum<Core::HID::NpadIdType>()};
2733 2733
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h
index 9563654b6..c69e5f3fb 100644
--- a/src/core/hle/service/hid/hid.h
+++ b/src/core/hle/service/hid/hid.h
@@ -76,7 +76,7 @@ private:
76 std::make_unique<T>(system.HIDCore(), shared_memory, service_context); 76 std::make_unique<T>(system.HIDCore(), shared_memory, service_context);
77 } 77 }
78 78
79 void GetSharedMemoryHandle(Kernel::HLERequestContext& ctx); 79 void GetSharedMemoryHandle(HLERequestContext& ctx);
80 void UpdateControllers(std::uintptr_t user_data, std::chrono::nanoseconds ns_late); 80 void UpdateControllers(std::uintptr_t user_data, std::chrono::nanoseconds ns_late);
81 void UpdateNpad(std::uintptr_t user_data, std::chrono::nanoseconds ns_late); 81 void UpdateNpad(std::uintptr_t user_data, std::chrono::nanoseconds ns_late);
82 void UpdateMouseKeyboard(std::uintptr_t user_data, std::chrono::nanoseconds ns_late); 82 void UpdateMouseKeyboard(std::uintptr_t user_data, std::chrono::nanoseconds ns_late);
@@ -101,115 +101,115 @@ public:
101 std::shared_ptr<IAppletResource> GetAppletResource(); 101 std::shared_ptr<IAppletResource> GetAppletResource();
102 102
103private: 103private:
104 void CreateAppletResource(Kernel::HLERequestContext& ctx); 104 void CreateAppletResource(HLERequestContext& ctx);
105 void ActivateDebugPad(Kernel::HLERequestContext& ctx); 105 void ActivateDebugPad(HLERequestContext& ctx);
106 void ActivateTouchScreen(Kernel::HLERequestContext& ctx); 106 void ActivateTouchScreen(HLERequestContext& ctx);
107 void ActivateMouse(Kernel::HLERequestContext& ctx); 107 void ActivateMouse(HLERequestContext& ctx);
108 void ActivateKeyboard(Kernel::HLERequestContext& ctx); 108 void ActivateKeyboard(HLERequestContext& ctx);
109 void SendKeyboardLockKeyEvent(Kernel::HLERequestContext& ctx); 109 void SendKeyboardLockKeyEvent(HLERequestContext& ctx);
110 void ActivateXpad(Kernel::HLERequestContext& ctx); 110 void ActivateXpad(HLERequestContext& ctx);
111 void GetXpadIDs(Kernel::HLERequestContext& ctx); 111 void GetXpadIDs(HLERequestContext& ctx);
112 void ActivateSixAxisSensor(Kernel::HLERequestContext& ctx); 112 void ActivateSixAxisSensor(HLERequestContext& ctx);
113 void DeactivateSixAxisSensor(Kernel::HLERequestContext& ctx); 113 void DeactivateSixAxisSensor(HLERequestContext& ctx);
114 void StartSixAxisSensor(Kernel::HLERequestContext& ctx); 114 void StartSixAxisSensor(HLERequestContext& ctx);
115 void StopSixAxisSensor(Kernel::HLERequestContext& ctx); 115 void StopSixAxisSensor(HLERequestContext& ctx);
116 void IsSixAxisSensorFusionEnabled(Kernel::HLERequestContext& ctx); 116 void IsSixAxisSensorFusionEnabled(HLERequestContext& ctx);
117 void EnableSixAxisSensorFusion(Kernel::HLERequestContext& ctx); 117 void EnableSixAxisSensorFusion(HLERequestContext& ctx);
118 void SetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx); 118 void SetSixAxisSensorFusionParameters(HLERequestContext& ctx);
119 void GetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx); 119 void GetSixAxisSensorFusionParameters(HLERequestContext& ctx);
120 void ResetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx); 120 void ResetSixAxisSensorFusionParameters(HLERequestContext& ctx);
121 void SetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx); 121 void SetGyroscopeZeroDriftMode(HLERequestContext& ctx);
122 void GetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx); 122 void GetGyroscopeZeroDriftMode(HLERequestContext& ctx);
123 void ResetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx); 123 void ResetGyroscopeZeroDriftMode(HLERequestContext& ctx);
124 void IsSixAxisSensorAtRest(Kernel::HLERequestContext& ctx); 124 void IsSixAxisSensorAtRest(HLERequestContext& ctx);
125 void IsFirmwareUpdateAvailableForSixAxisSensor(Kernel::HLERequestContext& ctx); 125 void IsFirmwareUpdateAvailableForSixAxisSensor(HLERequestContext& ctx);
126 void EnableSixAxisSensorUnalteredPassthrough(Kernel::HLERequestContext& ctx); 126 void EnableSixAxisSensorUnalteredPassthrough(HLERequestContext& ctx);
127 void IsSixAxisSensorUnalteredPassthroughEnabled(Kernel::HLERequestContext& ctx); 127 void IsSixAxisSensorUnalteredPassthroughEnabled(HLERequestContext& ctx);
128 void LoadSixAxisSensorCalibrationParameter(Kernel::HLERequestContext& ctx); 128 void LoadSixAxisSensorCalibrationParameter(HLERequestContext& ctx);
129 void GetSixAxisSensorIcInformation(Kernel::HLERequestContext& ctx); 129 void GetSixAxisSensorIcInformation(HLERequestContext& ctx);
130 void ResetIsSixAxisSensorDeviceNewlyAssigned(Kernel::HLERequestContext& ctx); 130 void ResetIsSixAxisSensorDeviceNewlyAssigned(HLERequestContext& ctx);
131 void ActivateGesture(Kernel::HLERequestContext& ctx); 131 void ActivateGesture(HLERequestContext& ctx);
132 void SetSupportedNpadStyleSet(Kernel::HLERequestContext& ctx); 132 void SetSupportedNpadStyleSet(HLERequestContext& ctx);
133 void GetSupportedNpadStyleSet(Kernel::HLERequestContext& ctx); 133 void GetSupportedNpadStyleSet(HLERequestContext& ctx);
134 void SetSupportedNpadIdType(Kernel::HLERequestContext& ctx); 134 void SetSupportedNpadIdType(HLERequestContext& ctx);
135 void ActivateNpad(Kernel::HLERequestContext& ctx); 135 void ActivateNpad(HLERequestContext& ctx);
136 void DeactivateNpad(Kernel::HLERequestContext& ctx); 136 void DeactivateNpad(HLERequestContext& ctx);
137 void AcquireNpadStyleSetUpdateEventHandle(Kernel::HLERequestContext& ctx); 137 void AcquireNpadStyleSetUpdateEventHandle(HLERequestContext& ctx);
138 void DisconnectNpad(Kernel::HLERequestContext& ctx); 138 void DisconnectNpad(HLERequestContext& ctx);
139 void GetPlayerLedPattern(Kernel::HLERequestContext& ctx); 139 void GetPlayerLedPattern(HLERequestContext& ctx);
140 void ActivateNpadWithRevision(Kernel::HLERequestContext& ctx); 140 void ActivateNpadWithRevision(HLERequestContext& ctx);
141 void SetNpadJoyHoldType(Kernel::HLERequestContext& ctx); 141 void SetNpadJoyHoldType(HLERequestContext& ctx);
142 void GetNpadJoyHoldType(Kernel::HLERequestContext& ctx); 142 void GetNpadJoyHoldType(HLERequestContext& ctx);
143 void SetNpadJoyAssignmentModeSingleByDefault(Kernel::HLERequestContext& ctx); 143 void SetNpadJoyAssignmentModeSingleByDefault(HLERequestContext& ctx);
144 void SetNpadJoyAssignmentModeSingle(Kernel::HLERequestContext& ctx); 144 void SetNpadJoyAssignmentModeSingle(HLERequestContext& ctx);
145 void SetNpadJoyAssignmentModeDual(Kernel::HLERequestContext& ctx); 145 void SetNpadJoyAssignmentModeDual(HLERequestContext& ctx);
146 void MergeSingleJoyAsDualJoy(Kernel::HLERequestContext& ctx); 146 void MergeSingleJoyAsDualJoy(HLERequestContext& ctx);
147 void StartLrAssignmentMode(Kernel::HLERequestContext& ctx); 147 void StartLrAssignmentMode(HLERequestContext& ctx);
148 void StopLrAssignmentMode(Kernel::HLERequestContext& ctx); 148 void StopLrAssignmentMode(HLERequestContext& ctx);
149 void SetNpadHandheldActivationMode(Kernel::HLERequestContext& ctx); 149 void SetNpadHandheldActivationMode(HLERequestContext& ctx);
150 void GetNpadHandheldActivationMode(Kernel::HLERequestContext& ctx); 150 void GetNpadHandheldActivationMode(HLERequestContext& ctx);
151 void SwapNpadAssignment(Kernel::HLERequestContext& ctx); 151 void SwapNpadAssignment(HLERequestContext& ctx);
152 void IsUnintendedHomeButtonInputProtectionEnabled(Kernel::HLERequestContext& ctx); 152 void IsUnintendedHomeButtonInputProtectionEnabled(HLERequestContext& ctx);
153 void EnableUnintendedHomeButtonInputProtection(Kernel::HLERequestContext& ctx); 153 void EnableUnintendedHomeButtonInputProtection(HLERequestContext& ctx);
154 void SetNpadAnalogStickUseCenterClamp(Kernel::HLERequestContext& ctx); 154 void SetNpadAnalogStickUseCenterClamp(HLERequestContext& ctx);
155 void SetNpadCaptureButtonAssignment(Kernel::HLERequestContext& ctx); 155 void SetNpadCaptureButtonAssignment(HLERequestContext& ctx);
156 void ClearNpadCaptureButtonAssignment(Kernel::HLERequestContext& ctx); 156 void ClearNpadCaptureButtonAssignment(HLERequestContext& ctx);
157 void GetVibrationDeviceInfo(Kernel::HLERequestContext& ctx); 157 void GetVibrationDeviceInfo(HLERequestContext& ctx);
158 void SendVibrationValue(Kernel::HLERequestContext& ctx); 158 void SendVibrationValue(HLERequestContext& ctx);
159 void GetActualVibrationValue(Kernel::HLERequestContext& ctx); 159 void GetActualVibrationValue(HLERequestContext& ctx);
160 void CreateActiveVibrationDeviceList(Kernel::HLERequestContext& ctx); 160 void CreateActiveVibrationDeviceList(HLERequestContext& ctx);
161 void PermitVibration(Kernel::HLERequestContext& ctx); 161 void PermitVibration(HLERequestContext& ctx);
162 void IsVibrationPermitted(Kernel::HLERequestContext& ctx); 162 void IsVibrationPermitted(HLERequestContext& ctx);
163 void SendVibrationValues(Kernel::HLERequestContext& ctx); 163 void SendVibrationValues(HLERequestContext& ctx);
164 void SendVibrationGcErmCommand(Kernel::HLERequestContext& ctx); 164 void SendVibrationGcErmCommand(HLERequestContext& ctx);
165 void GetActualVibrationGcErmCommand(Kernel::HLERequestContext& ctx); 165 void GetActualVibrationGcErmCommand(HLERequestContext& ctx);
166 void BeginPermitVibrationSession(Kernel::HLERequestContext& ctx); 166 void BeginPermitVibrationSession(HLERequestContext& ctx);
167 void EndPermitVibrationSession(Kernel::HLERequestContext& ctx); 167 void EndPermitVibrationSession(HLERequestContext& ctx);
168 void IsVibrationDeviceMounted(Kernel::HLERequestContext& ctx); 168 void IsVibrationDeviceMounted(HLERequestContext& ctx);
169 void ActivateConsoleSixAxisSensor(Kernel::HLERequestContext& ctx); 169 void ActivateConsoleSixAxisSensor(HLERequestContext& ctx);
170 void StartConsoleSixAxisSensor(Kernel::HLERequestContext& ctx); 170 void StartConsoleSixAxisSensor(HLERequestContext& ctx);
171 void StopConsoleSixAxisSensor(Kernel::HLERequestContext& ctx); 171 void StopConsoleSixAxisSensor(HLERequestContext& ctx);
172 void ActivateSevenSixAxisSensor(Kernel::HLERequestContext& ctx); 172 void ActivateSevenSixAxisSensor(HLERequestContext& ctx);
173 void StartSevenSixAxisSensor(Kernel::HLERequestContext& ctx); 173 void StartSevenSixAxisSensor(HLERequestContext& ctx);
174 void StopSevenSixAxisSensor(Kernel::HLERequestContext& ctx); 174 void StopSevenSixAxisSensor(HLERequestContext& ctx);
175 void InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx); 175 void InitializeSevenSixAxisSensor(HLERequestContext& ctx);
176 void FinalizeSevenSixAxisSensor(Kernel::HLERequestContext& ctx); 176 void FinalizeSevenSixAxisSensor(HLERequestContext& ctx);
177 void ResetSevenSixAxisSensorTimestamp(Kernel::HLERequestContext& ctx); 177 void ResetSevenSixAxisSensorTimestamp(HLERequestContext& ctx);
178 void IsUsbFullKeyControllerEnabled(Kernel::HLERequestContext& ctx); 178 void IsUsbFullKeyControllerEnabled(HLERequestContext& ctx);
179 void GetPalmaConnectionHandle(Kernel::HLERequestContext& ctx); 179 void GetPalmaConnectionHandle(HLERequestContext& ctx);
180 void InitializePalma(Kernel::HLERequestContext& ctx); 180 void InitializePalma(HLERequestContext& ctx);
181 void AcquirePalmaOperationCompleteEvent(Kernel::HLERequestContext& ctx); 181 void AcquirePalmaOperationCompleteEvent(HLERequestContext& ctx);
182 void GetPalmaOperationInfo(Kernel::HLERequestContext& ctx); 182 void GetPalmaOperationInfo(HLERequestContext& ctx);
183 void PlayPalmaActivity(Kernel::HLERequestContext& ctx); 183 void PlayPalmaActivity(HLERequestContext& ctx);
184 void SetPalmaFrModeType(Kernel::HLERequestContext& ctx); 184 void SetPalmaFrModeType(HLERequestContext& ctx);
185 void ReadPalmaStep(Kernel::HLERequestContext& ctx); 185 void ReadPalmaStep(HLERequestContext& ctx);
186 void EnablePalmaStep(Kernel::HLERequestContext& ctx); 186 void EnablePalmaStep(HLERequestContext& ctx);
187 void ResetPalmaStep(Kernel::HLERequestContext& ctx); 187 void ResetPalmaStep(HLERequestContext& ctx);
188 void ReadPalmaApplicationSection(Kernel::HLERequestContext& ctx); 188 void ReadPalmaApplicationSection(HLERequestContext& ctx);
189 void WritePalmaApplicationSection(Kernel::HLERequestContext& ctx); 189 void WritePalmaApplicationSection(HLERequestContext& ctx);
190 void ReadPalmaUniqueCode(Kernel::HLERequestContext& ctx); 190 void ReadPalmaUniqueCode(HLERequestContext& ctx);
191 void SetPalmaUniqueCodeInvalid(Kernel::HLERequestContext& ctx); 191 void SetPalmaUniqueCodeInvalid(HLERequestContext& ctx);
192 void WritePalmaActivityEntry(Kernel::HLERequestContext& ctx); 192 void WritePalmaActivityEntry(HLERequestContext& ctx);
193 void WritePalmaRgbLedPatternEntry(Kernel::HLERequestContext& ctx); 193 void WritePalmaRgbLedPatternEntry(HLERequestContext& ctx);
194 void WritePalmaWaveEntry(Kernel::HLERequestContext& ctx); 194 void WritePalmaWaveEntry(HLERequestContext& ctx);
195 void SetPalmaDataBaseIdentificationVersion(Kernel::HLERequestContext& ctx); 195 void SetPalmaDataBaseIdentificationVersion(HLERequestContext& ctx);
196 void GetPalmaDataBaseIdentificationVersion(Kernel::HLERequestContext& ctx); 196 void GetPalmaDataBaseIdentificationVersion(HLERequestContext& ctx);
197 void SuspendPalmaFeature(Kernel::HLERequestContext& ctx); 197 void SuspendPalmaFeature(HLERequestContext& ctx);
198 void GetPalmaOperationResult(Kernel::HLERequestContext& ctx); 198 void GetPalmaOperationResult(HLERequestContext& ctx);
199 void ReadPalmaPlayLog(Kernel::HLERequestContext& ctx); 199 void ReadPalmaPlayLog(HLERequestContext& ctx);
200 void ResetPalmaPlayLog(Kernel::HLERequestContext& ctx); 200 void ResetPalmaPlayLog(HLERequestContext& ctx);
201 void SetIsPalmaAllConnectable(Kernel::HLERequestContext& ctx); 201 void SetIsPalmaAllConnectable(HLERequestContext& ctx);
202 void SetIsPalmaPairedConnectable(Kernel::HLERequestContext& ctx); 202 void SetIsPalmaPairedConnectable(HLERequestContext& ctx);
203 void PairPalma(Kernel::HLERequestContext& ctx); 203 void PairPalma(HLERequestContext& ctx);
204 void SetPalmaBoostMode(Kernel::HLERequestContext& ctx); 204 void SetPalmaBoostMode(HLERequestContext& ctx);
205 void CancelWritePalmaWaveEntry(Kernel::HLERequestContext& ctx); 205 void CancelWritePalmaWaveEntry(HLERequestContext& ctx);
206 void EnablePalmaBoostMode(Kernel::HLERequestContext& ctx); 206 void EnablePalmaBoostMode(HLERequestContext& ctx);
207 void GetPalmaBluetoothAddress(Kernel::HLERequestContext& ctx); 207 void GetPalmaBluetoothAddress(HLERequestContext& ctx);
208 void SetDisallowedPalmaConnection(Kernel::HLERequestContext& ctx); 208 void SetDisallowedPalmaConnection(HLERequestContext& ctx);
209 void SetNpadCommunicationMode(Kernel::HLERequestContext& ctx); 209 void SetNpadCommunicationMode(HLERequestContext& ctx);
210 void GetNpadCommunicationMode(Kernel::HLERequestContext& ctx); 210 void GetNpadCommunicationMode(HLERequestContext& ctx);
211 void SetTouchScreenConfiguration(Kernel::HLERequestContext& ctx); 211 void SetTouchScreenConfiguration(HLERequestContext& ctx);
212 void IsFirmwareUpdateNeededForNotification(Kernel::HLERequestContext& ctx); 212 void IsFirmwareUpdateNeededForNotification(HLERequestContext& ctx);
213 213
214 std::shared_ptr<IAppletResource> applet_resource; 214 std::shared_ptr<IAppletResource> applet_resource;
215 215
diff --git a/src/core/hle/service/hid/hidbus.cpp b/src/core/hle/service/hid/hidbus.cpp
index 07199d5d5..5604a6fda 100644
--- a/src/core/hle/service/hid/hidbus.cpp
+++ b/src/core/hle/service/hid/hidbus.cpp
@@ -7,7 +7,6 @@
7#include "core/core_timing.h" 7#include "core/core_timing.h"
8#include "core/core_timing_util.h" 8#include "core/core_timing_util.h"
9#include "core/hid/hid_types.h" 9#include "core/hid/hid_types.h"
10#include "core/hle/ipc_helpers.h"
11#include "core/hle/kernel/k_event.h" 10#include "core/hle/kernel/k_event.h"
12#include "core/hle/kernel/k_readable_event.h" 11#include "core/hle/kernel/k_readable_event.h"
13#include "core/hle/kernel/k_shared_memory.h" 12#include "core/hle/kernel/k_shared_memory.h"
@@ -16,6 +15,7 @@
16#include "core/hle/service/hid/hidbus/ringcon.h" 15#include "core/hle/service/hid/hidbus/ringcon.h"
17#include "core/hle/service/hid/hidbus/starlink.h" 16#include "core/hle/service/hid/hidbus/starlink.h"
18#include "core/hle/service/hid/hidbus/stubbed.h" 17#include "core/hle/service/hid/hidbus/stubbed.h"
18#include "core/hle/service/ipc_helpers.h"
19#include "core/hle/service/service.h" 19#include "core/hle/service/service.h"
20#include "core/memory.h" 20#include "core/memory.h"
21 21
@@ -99,7 +99,7 @@ std::optional<std::size_t> HidBus::GetDeviceIndexFromHandle(BusHandle handle) co
99 return std::nullopt; 99 return std::nullopt;
100} 100}
101 101
102void HidBus::GetBusHandle(Kernel::HLERequestContext& ctx) { 102void HidBus::GetBusHandle(HLERequestContext& ctx) {
103 IPC::RequestParser rp{ctx}; 103 IPC::RequestParser rp{ctx};
104 struct Parameters { 104 struct Parameters {
105 Core::HID::NpadIdType npad_id; 105 Core::HID::NpadIdType npad_id;
@@ -165,7 +165,7 @@ void HidBus::GetBusHandle(Kernel::HLERequestContext& ctx) {
165 rb.PushRaw(out_data); 165 rb.PushRaw(out_data);
166} 166}
167 167
168void HidBus::IsExternalDeviceConnected(Kernel::HLERequestContext& ctx) { 168void HidBus::IsExternalDeviceConnected(HLERequestContext& ctx) {
169 IPC::RequestParser rp{ctx}; 169 IPC::RequestParser rp{ctx};
170 const auto bus_handle_{rp.PopRaw<BusHandle>()}; 170 const auto bus_handle_{rp.PopRaw<BusHandle>()};
171 171
@@ -193,7 +193,7 @@ void HidBus::IsExternalDeviceConnected(Kernel::HLERequestContext& ctx) {
193 return; 193 return;
194} 194}
195 195
196void HidBus::Initialize(Kernel::HLERequestContext& ctx) { 196void HidBus::Initialize(HLERequestContext& ctx) {
197 IPC::RequestParser rp{ctx}; 197 IPC::RequestParser rp{ctx};
198 const auto bus_handle_{rp.PopRaw<BusHandle>()}; 198 const auto bus_handle_{rp.PopRaw<BusHandle>()};
199 const auto applet_resource_user_id{rp.Pop<u64>()}; 199 const auto applet_resource_user_id{rp.Pop<u64>()};
@@ -245,7 +245,7 @@ void HidBus::Initialize(Kernel::HLERequestContext& ctx) {
245 return; 245 return;
246} 246}
247 247
248void HidBus::Finalize(Kernel::HLERequestContext& ctx) { 248void HidBus::Finalize(HLERequestContext& ctx) {
249 IPC::RequestParser rp{ctx}; 249 IPC::RequestParser rp{ctx};
250 const auto bus_handle_{rp.PopRaw<BusHandle>()}; 250 const auto bus_handle_{rp.PopRaw<BusHandle>()};
251 const auto applet_resource_user_id{rp.Pop<u64>()}; 251 const auto applet_resource_user_id{rp.Pop<u64>()};
@@ -284,7 +284,7 @@ void HidBus::Finalize(Kernel::HLERequestContext& ctx) {
284 return; 284 return;
285} 285}
286 286
287void HidBus::EnableExternalDevice(Kernel::HLERequestContext& ctx) { 287void HidBus::EnableExternalDevice(HLERequestContext& ctx) {
288 IPC::RequestParser rp{ctx}; 288 IPC::RequestParser rp{ctx};
289 struct Parameters { 289 struct Parameters {
290 bool enable; 290 bool enable;
@@ -322,7 +322,7 @@ void HidBus::EnableExternalDevice(Kernel::HLERequestContext& ctx) {
322 return; 322 return;
323} 323}
324 324
325void HidBus::GetExternalDeviceId(Kernel::HLERequestContext& ctx) { 325void HidBus::GetExternalDeviceId(HLERequestContext& ctx) {
326 IPC::RequestParser rp{ctx}; 326 IPC::RequestParser rp{ctx};
327 const auto bus_handle_{rp.PopRaw<BusHandle>()}; 327 const auto bus_handle_{rp.PopRaw<BusHandle>()};
328 328
@@ -349,7 +349,7 @@ void HidBus::GetExternalDeviceId(Kernel::HLERequestContext& ctx) {
349 return; 349 return;
350} 350}
351 351
352void HidBus::SendCommandAsync(Kernel::HLERequestContext& ctx) { 352void HidBus::SendCommandAsync(HLERequestContext& ctx) {
353 IPC::RequestParser rp{ctx}; 353 IPC::RequestParser rp{ctx};
354 const auto data = ctx.ReadBuffer(); 354 const auto data = ctx.ReadBuffer();
355 const auto bus_handle_{rp.PopRaw<BusHandle>()}; 355 const auto bus_handle_{rp.PopRaw<BusHandle>()};
@@ -377,7 +377,7 @@ void HidBus::SendCommandAsync(Kernel::HLERequestContext& ctx) {
377 return; 377 return;
378}; 378};
379 379
380void HidBus::GetSendCommandAsynceResult(Kernel::HLERequestContext& ctx) { 380void HidBus::GetSendCommandAsynceResult(HLERequestContext& ctx) {
381 IPC::RequestParser rp{ctx}; 381 IPC::RequestParser rp{ctx};
382 const auto bus_handle_{rp.PopRaw<BusHandle>()}; 382 const auto bus_handle_{rp.PopRaw<BusHandle>()};
383 383
@@ -406,7 +406,7 @@ void HidBus::GetSendCommandAsynceResult(Kernel::HLERequestContext& ctx) {
406 return; 406 return;
407}; 407};
408 408
409void HidBus::SetEventForSendCommandAsycResult(Kernel::HLERequestContext& ctx) { 409void HidBus::SetEventForSendCommandAsycResult(HLERequestContext& ctx) {
410 IPC::RequestParser rp{ctx}; 410 IPC::RequestParser rp{ctx};
411 const auto bus_handle_{rp.PopRaw<BusHandle>()}; 411 const auto bus_handle_{rp.PopRaw<BusHandle>()};
412 412
@@ -432,7 +432,7 @@ void HidBus::SetEventForSendCommandAsycResult(Kernel::HLERequestContext& ctx) {
432 return; 432 return;
433}; 433};
434 434
435void HidBus::GetSharedMemoryHandle(Kernel::HLERequestContext& ctx) { 435void HidBus::GetSharedMemoryHandle(HLERequestContext& ctx) {
436 LOG_DEBUG(Service_HID, "called"); 436 LOG_DEBUG(Service_HID, "called");
437 437
438 IPC::ResponseBuilder rb{ctx, 2, 1}; 438 IPC::ResponseBuilder rb{ctx, 2, 1};
@@ -440,7 +440,7 @@ void HidBus::GetSharedMemoryHandle(Kernel::HLERequestContext& ctx) {
440 rb.PushCopyObjects(&system.Kernel().GetHidBusSharedMem()); 440 rb.PushCopyObjects(&system.Kernel().GetHidBusSharedMem());
441} 441}
442 442
443void HidBus::EnableJoyPollingReceiveMode(Kernel::HLERequestContext& ctx) { 443void HidBus::EnableJoyPollingReceiveMode(HLERequestContext& ctx) {
444 IPC::RequestParser rp{ctx}; 444 IPC::RequestParser rp{ctx};
445 const auto t_mem_size{rp.Pop<u32>()}; 445 const auto t_mem_size{rp.Pop<u32>()};
446 const auto t_mem_handle{ctx.GetCopyHandle(0)}; 446 const auto t_mem_handle{ctx.GetCopyHandle(0)};
@@ -485,7 +485,7 @@ void HidBus::EnableJoyPollingReceiveMode(Kernel::HLERequestContext& ctx) {
485 return; 485 return;
486} 486}
487 487
488void HidBus::DisableJoyPollingReceiveMode(Kernel::HLERequestContext& ctx) { 488void HidBus::DisableJoyPollingReceiveMode(HLERequestContext& ctx) {
489 IPC::RequestParser rp{ctx}; 489 IPC::RequestParser rp{ctx};
490 const auto bus_handle_{rp.PopRaw<BusHandle>()}; 490 const auto bus_handle_{rp.PopRaw<BusHandle>()};
491 491
@@ -512,7 +512,7 @@ void HidBus::DisableJoyPollingReceiveMode(Kernel::HLERequestContext& ctx) {
512 return; 512 return;
513} 513}
514 514
515void HidBus::SetStatusManagerType(Kernel::HLERequestContext& ctx) { 515void HidBus::SetStatusManagerType(HLERequestContext& ctx) {
516 IPC::RequestParser rp{ctx}; 516 IPC::RequestParser rp{ctx};
517 const auto manager_type{rp.PopEnum<StatusManagerType>()}; 517 const auto manager_type{rp.PopEnum<StatusManagerType>()};
518 518
diff --git a/src/core/hle/service/hid/hidbus.h b/src/core/hle/service/hid/hidbus.h
index 85ed96e2e..c29b5e882 100644
--- a/src/core/hle/service/hid/hidbus.h
+++ b/src/core/hle/service/hid/hidbus.h
@@ -94,19 +94,19 @@ private:
94 std::unique_ptr<HidbusBase> device{nullptr}; 94 std::unique_ptr<HidbusBase> device{nullptr};
95 }; 95 };
96 96
97 void GetBusHandle(Kernel::HLERequestContext& ctx); 97 void GetBusHandle(HLERequestContext& ctx);
98 void IsExternalDeviceConnected(Kernel::HLERequestContext& ctx); 98 void IsExternalDeviceConnected(HLERequestContext& ctx);
99 void Initialize(Kernel::HLERequestContext& ctx); 99 void Initialize(HLERequestContext& ctx);
100 void Finalize(Kernel::HLERequestContext& ctx); 100 void Finalize(HLERequestContext& ctx);
101 void EnableExternalDevice(Kernel::HLERequestContext& ctx); 101 void EnableExternalDevice(HLERequestContext& ctx);
102 void GetExternalDeviceId(Kernel::HLERequestContext& ctx); 102 void GetExternalDeviceId(HLERequestContext& ctx);
103 void SendCommandAsync(Kernel::HLERequestContext& ctx); 103 void SendCommandAsync(HLERequestContext& ctx);
104 void GetSendCommandAsynceResult(Kernel::HLERequestContext& ctx); 104 void GetSendCommandAsynceResult(HLERequestContext& ctx);
105 void SetEventForSendCommandAsycResult(Kernel::HLERequestContext& ctx); 105 void SetEventForSendCommandAsycResult(HLERequestContext& ctx);
106 void GetSharedMemoryHandle(Kernel::HLERequestContext& ctx); 106 void GetSharedMemoryHandle(HLERequestContext& ctx);
107 void EnableJoyPollingReceiveMode(Kernel::HLERequestContext& ctx); 107 void EnableJoyPollingReceiveMode(HLERequestContext& ctx);
108 void DisableJoyPollingReceiveMode(Kernel::HLERequestContext& ctx); 108 void DisableJoyPollingReceiveMode(HLERequestContext& ctx);
109 void SetStatusManagerType(Kernel::HLERequestContext& ctx); 109 void SetStatusManagerType(HLERequestContext& ctx);
110 110
111 void UpdateHidbus(std::uintptr_t user_data, std::chrono::nanoseconds ns_late); 111 void UpdateHidbus(std::uintptr_t user_data, std::chrono::nanoseconds ns_late);
112 std::optional<std::size_t> GetDeviceIndexFromHandle(BusHandle handle) const; 112 std::optional<std::size_t> GetDeviceIndexFromHandle(BusHandle handle) const;
diff --git a/src/core/hle/service/hid/irs.cpp b/src/core/hle/service/hid/irs.cpp
index a40f61fde..221c33b86 100644
--- a/src/core/hle/service/hid/irs.cpp
+++ b/src/core/hle/service/hid/irs.cpp
@@ -8,7 +8,6 @@
8#include "core/core_timing.h" 8#include "core/core_timing.h"
9#include "core/hid/emulated_controller.h" 9#include "core/hid/emulated_controller.h"
10#include "core/hid/hid_core.h" 10#include "core/hid/hid_core.h"
11#include "core/hle/ipc_helpers.h"
12#include "core/hle/kernel/k_shared_memory.h" 11#include "core/hle/kernel/k_shared_memory.h"
13#include "core/hle/kernel/k_transfer_memory.h" 12#include "core/hle/kernel/k_transfer_memory.h"
14#include "core/hle/kernel/kernel.h" 13#include "core/hle/kernel/kernel.h"
@@ -20,6 +19,7 @@
20#include "core/hle/service/hid/irsensor/moment_processor.h" 19#include "core/hle/service/hid/irsensor/moment_processor.h"
21#include "core/hle/service/hid/irsensor/pointing_processor.h" 20#include "core/hle/service/hid/irsensor/pointing_processor.h"
22#include "core/hle/service/hid/irsensor/tera_plugin_processor.h" 21#include "core/hle/service/hid/irsensor/tera_plugin_processor.h"
22#include "core/hle/service/ipc_helpers.h"
23#include "core/memory.h" 23#include "core/memory.h"
24 24
25namespace Service::IRS { 25namespace Service::IRS {
@@ -56,7 +56,7 @@ IRS::IRS(Core::System& system_) : ServiceFramework{system_, "irs"} {
56} 56}
57IRS::~IRS() = default; 57IRS::~IRS() = default;
58 58
59void IRS::ActivateIrsensor(Kernel::HLERequestContext& ctx) { 59void IRS::ActivateIrsensor(HLERequestContext& ctx) {
60 IPC::RequestParser rp{ctx}; 60 IPC::RequestParser rp{ctx};
61 const auto applet_resource_user_id{rp.Pop<u64>()}; 61 const auto applet_resource_user_id{rp.Pop<u64>()};
62 62
@@ -67,7 +67,7 @@ void IRS::ActivateIrsensor(Kernel::HLERequestContext& ctx) {
67 rb.Push(ResultSuccess); 67 rb.Push(ResultSuccess);
68} 68}
69 69
70void IRS::DeactivateIrsensor(Kernel::HLERequestContext& ctx) { 70void IRS::DeactivateIrsensor(HLERequestContext& ctx) {
71 IPC::RequestParser rp{ctx}; 71 IPC::RequestParser rp{ctx};
72 const auto applet_resource_user_id{rp.Pop<u64>()}; 72 const auto applet_resource_user_id{rp.Pop<u64>()};
73 73
@@ -78,7 +78,7 @@ void IRS::DeactivateIrsensor(Kernel::HLERequestContext& ctx) {
78 rb.Push(ResultSuccess); 78 rb.Push(ResultSuccess);
79} 79}
80 80
81void IRS::GetIrsensorSharedMemoryHandle(Kernel::HLERequestContext& ctx) { 81void IRS::GetIrsensorSharedMemoryHandle(HLERequestContext& ctx) {
82 IPC::RequestParser rp{ctx}; 82 IPC::RequestParser rp{ctx};
83 const auto applet_resource_user_id{rp.Pop<u64>()}; 83 const auto applet_resource_user_id{rp.Pop<u64>()};
84 84
@@ -89,7 +89,7 @@ void IRS::GetIrsensorSharedMemoryHandle(Kernel::HLERequestContext& ctx) {
89 rb.PushCopyObjects(&system.Kernel().GetIrsSharedMem()); 89 rb.PushCopyObjects(&system.Kernel().GetIrsSharedMem());
90} 90}
91 91
92void IRS::StopImageProcessor(Kernel::HLERequestContext& ctx) { 92void IRS::StopImageProcessor(HLERequestContext& ctx) {
93 IPC::RequestParser rp{ctx}; 93 IPC::RequestParser rp{ctx};
94 struct Parameters { 94 struct Parameters {
95 Core::IrSensor::IrCameraHandle camera_handle; 95 Core::IrSensor::IrCameraHandle camera_handle;
@@ -117,7 +117,7 @@ void IRS::StopImageProcessor(Kernel::HLERequestContext& ctx) {
117 rb.Push(result); 117 rb.Push(result);
118} 118}
119 119
120void IRS::RunMomentProcessor(Kernel::HLERequestContext& ctx) { 120void IRS::RunMomentProcessor(HLERequestContext& ctx) {
121 IPC::RequestParser rp{ctx}; 121 IPC::RequestParser rp{ctx};
122 struct Parameters { 122 struct Parameters {
123 Core::IrSensor::IrCameraHandle camera_handle; 123 Core::IrSensor::IrCameraHandle camera_handle;
@@ -149,7 +149,7 @@ void IRS::RunMomentProcessor(Kernel::HLERequestContext& ctx) {
149 rb.Push(result); 149 rb.Push(result);
150} 150}
151 151
152void IRS::RunClusteringProcessor(Kernel::HLERequestContext& ctx) { 152void IRS::RunClusteringProcessor(HLERequestContext& ctx) {
153 IPC::RequestParser rp{ctx}; 153 IPC::RequestParser rp{ctx};
154 struct Parameters { 154 struct Parameters {
155 Core::IrSensor::IrCameraHandle camera_handle; 155 Core::IrSensor::IrCameraHandle camera_handle;
@@ -182,7 +182,7 @@ void IRS::RunClusteringProcessor(Kernel::HLERequestContext& ctx) {
182 rb.Push(result); 182 rb.Push(result);
183} 183}
184 184
185void IRS::RunImageTransferProcessor(Kernel::HLERequestContext& ctx) { 185void IRS::RunImageTransferProcessor(HLERequestContext& ctx) {
186 IPC::RequestParser rp{ctx}; 186 IPC::RequestParser rp{ctx};
187 struct Parameters { 187 struct Parameters {
188 Core::IrSensor::IrCameraHandle camera_handle; 188 Core::IrSensor::IrCameraHandle camera_handle;
@@ -231,7 +231,7 @@ void IRS::RunImageTransferProcessor(Kernel::HLERequestContext& ctx) {
231 rb.Push(result); 231 rb.Push(result);
232} 232}
233 233
234void IRS::GetImageTransferProcessorState(Kernel::HLERequestContext& ctx) { 234void IRS::GetImageTransferProcessorState(HLERequestContext& ctx) {
235 IPC::RequestParser rp{ctx}; 235 IPC::RequestParser rp{ctx};
236 struct Parameters { 236 struct Parameters {
237 Core::IrSensor::IrCameraHandle camera_handle; 237 Core::IrSensor::IrCameraHandle camera_handle;
@@ -272,7 +272,7 @@ void IRS::GetImageTransferProcessorState(Kernel::HLERequestContext& ctx) {
272 rb.PushRaw(state); 272 rb.PushRaw(state);
273} 273}
274 274
275void IRS::RunTeraPluginProcessor(Kernel::HLERequestContext& ctx) { 275void IRS::RunTeraPluginProcessor(HLERequestContext& ctx) {
276 IPC::RequestParser rp{ctx}; 276 IPC::RequestParser rp{ctx};
277 struct Parameters { 277 struct Parameters {
278 Core::IrSensor::IrCameraHandle camera_handle; 278 Core::IrSensor::IrCameraHandle camera_handle;
@@ -308,7 +308,7 @@ void IRS::RunTeraPluginProcessor(Kernel::HLERequestContext& ctx) {
308 rb.Push(result); 308 rb.Push(result);
309} 309}
310 310
311void IRS::GetNpadIrCameraHandle(Kernel::HLERequestContext& ctx) { 311void IRS::GetNpadIrCameraHandle(HLERequestContext& ctx) {
312 IPC::RequestParser rp{ctx}; 312 IPC::RequestParser rp{ctx};
313 const auto npad_id{rp.PopEnum<Core::HID::NpadIdType>()}; 313 const auto npad_id{rp.PopEnum<Core::HID::NpadIdType>()};
314 314
@@ -332,7 +332,7 @@ void IRS::GetNpadIrCameraHandle(Kernel::HLERequestContext& ctx) {
332 rb.PushRaw(camera_handle); 332 rb.PushRaw(camera_handle);
333} 333}
334 334
335void IRS::RunPointingProcessor(Kernel::HLERequestContext& ctx) { 335void IRS::RunPointingProcessor(HLERequestContext& ctx) {
336 IPC::RequestParser rp{ctx}; 336 IPC::RequestParser rp{ctx};
337 const auto camera_handle{rp.PopRaw<Core::IrSensor::IrCameraHandle>()}; 337 const auto camera_handle{rp.PopRaw<Core::IrSensor::IrCameraHandle>()};
338 const auto processor_config{rp.PopRaw<Core::IrSensor::PackedPointingProcessorConfig>()}; 338 const auto processor_config{rp.PopRaw<Core::IrSensor::PackedPointingProcessorConfig>()};
@@ -359,7 +359,7 @@ void IRS::RunPointingProcessor(Kernel::HLERequestContext& ctx) {
359 rb.Push(result); 359 rb.Push(result);
360} 360}
361 361
362void IRS::SuspendImageProcessor(Kernel::HLERequestContext& ctx) { 362void IRS::SuspendImageProcessor(HLERequestContext& ctx) {
363 IPC::RequestParser rp{ctx}; 363 IPC::RequestParser rp{ctx};
364 struct Parameters { 364 struct Parameters {
365 Core::IrSensor::IrCameraHandle camera_handle; 365 Core::IrSensor::IrCameraHandle camera_handle;
@@ -385,7 +385,7 @@ void IRS::SuspendImageProcessor(Kernel::HLERequestContext& ctx) {
385 rb.Push(result); 385 rb.Push(result);
386} 386}
387 387
388void IRS::CheckFirmwareVersion(Kernel::HLERequestContext& ctx) { 388void IRS::CheckFirmwareVersion(HLERequestContext& ctx) {
389 IPC::RequestParser rp{ctx}; 389 IPC::RequestParser rp{ctx};
390 const auto camera_handle{rp.PopRaw<Core::IrSensor::IrCameraHandle>()}; 390 const auto camera_handle{rp.PopRaw<Core::IrSensor::IrCameraHandle>()};
391 const auto mcu_version{rp.PopRaw<Core::IrSensor::PackedMcuVersion>()}; 391 const auto mcu_version{rp.PopRaw<Core::IrSensor::PackedMcuVersion>()};
@@ -407,7 +407,7 @@ void IRS::CheckFirmwareVersion(Kernel::HLERequestContext& ctx) {
407 rb.Push(result); 407 rb.Push(result);
408} 408}
409 409
410void IRS::SetFunctionLevel(Kernel::HLERequestContext& ctx) { 410void IRS::SetFunctionLevel(HLERequestContext& ctx) {
411 IPC::RequestParser rp{ctx}; 411 IPC::RequestParser rp{ctx};
412 const auto camera_handle{rp.PopRaw<Core::IrSensor::IrCameraHandle>()}; 412 const auto camera_handle{rp.PopRaw<Core::IrSensor::IrCameraHandle>()};
413 const auto function_level{rp.PopRaw<Core::IrSensor::PackedFunctionLevel>()}; 413 const auto function_level{rp.PopRaw<Core::IrSensor::PackedFunctionLevel>()};
@@ -429,7 +429,7 @@ void IRS::SetFunctionLevel(Kernel::HLERequestContext& ctx) {
429 rb.Push(result); 429 rb.Push(result);
430} 430}
431 431
432void IRS::RunImageTransferExProcessor(Kernel::HLERequestContext& ctx) { 432void IRS::RunImageTransferExProcessor(HLERequestContext& ctx) {
433 IPC::RequestParser rp{ctx}; 433 IPC::RequestParser rp{ctx};
434 struct Parameters { 434 struct Parameters {
435 Core::IrSensor::IrCameraHandle camera_handle; 435 Core::IrSensor::IrCameraHandle camera_handle;
@@ -469,7 +469,7 @@ void IRS::RunImageTransferExProcessor(Kernel::HLERequestContext& ctx) {
469 rb.Push(result); 469 rb.Push(result);
470} 470}
471 471
472void IRS::RunIrLedProcessor(Kernel::HLERequestContext& ctx) { 472void IRS::RunIrLedProcessor(HLERequestContext& ctx) {
473 IPC::RequestParser rp{ctx}; 473 IPC::RequestParser rp{ctx};
474 const auto camera_handle{rp.PopRaw<Core::IrSensor::IrCameraHandle>()}; 474 const auto camera_handle{rp.PopRaw<Core::IrSensor::IrCameraHandle>()};
475 const auto processor_config{rp.PopRaw<Core::IrSensor::PackedIrLedProcessorConfig>()}; 475 const auto processor_config{rp.PopRaw<Core::IrSensor::PackedIrLedProcessorConfig>()};
@@ -497,7 +497,7 @@ void IRS::RunIrLedProcessor(Kernel::HLERequestContext& ctx) {
497 rb.Push(result); 497 rb.Push(result);
498} 498}
499 499
500void IRS::StopImageProcessorAsync(Kernel::HLERequestContext& ctx) { 500void IRS::StopImageProcessorAsync(HLERequestContext& ctx) {
501 IPC::RequestParser rp{ctx}; 501 IPC::RequestParser rp{ctx};
502 struct Parameters { 502 struct Parameters {
503 Core::IrSensor::IrCameraHandle camera_handle; 503 Core::IrSensor::IrCameraHandle camera_handle;
@@ -525,7 +525,7 @@ void IRS::StopImageProcessorAsync(Kernel::HLERequestContext& ctx) {
525 rb.Push(result); 525 rb.Push(result);
526} 526}
527 527
528void IRS::ActivateIrsensorWithFunctionLevel(Kernel::HLERequestContext& ctx) { 528void IRS::ActivateIrsensorWithFunctionLevel(HLERequestContext& ctx) {
529 IPC::RequestParser rp{ctx}; 529 IPC::RequestParser rp{ctx};
530 struct Parameters { 530 struct Parameters {
531 Core::IrSensor::PackedFunctionLevel function_level; 531 Core::IrSensor::PackedFunctionLevel function_level;
diff --git a/src/core/hle/service/hid/irs.h b/src/core/hle/service/hid/irs.h
index b76ad7854..a8fa19025 100644
--- a/src/core/hle/service/hid/irs.h
+++ b/src/core/hle/service/hid/irs.h
@@ -38,24 +38,24 @@ private:
38 }; 38 };
39 static_assert(sizeof(StatusManager) == 0x8000, "StatusManager is an invalid size"); 39 static_assert(sizeof(StatusManager) == 0x8000, "StatusManager is an invalid size");
40 40
41 void ActivateIrsensor(Kernel::HLERequestContext& ctx); 41 void ActivateIrsensor(HLERequestContext& ctx);
42 void DeactivateIrsensor(Kernel::HLERequestContext& ctx); 42 void DeactivateIrsensor(HLERequestContext& ctx);
43 void GetIrsensorSharedMemoryHandle(Kernel::HLERequestContext& ctx); 43 void GetIrsensorSharedMemoryHandle(HLERequestContext& ctx);
44 void StopImageProcessor(Kernel::HLERequestContext& ctx); 44 void StopImageProcessor(HLERequestContext& ctx);
45 void RunMomentProcessor(Kernel::HLERequestContext& ctx); 45 void RunMomentProcessor(HLERequestContext& ctx);
46 void RunClusteringProcessor(Kernel::HLERequestContext& ctx); 46 void RunClusteringProcessor(HLERequestContext& ctx);
47 void RunImageTransferProcessor(Kernel::HLERequestContext& ctx); 47 void RunImageTransferProcessor(HLERequestContext& ctx);
48 void GetImageTransferProcessorState(Kernel::HLERequestContext& ctx); 48 void GetImageTransferProcessorState(HLERequestContext& ctx);
49 void RunTeraPluginProcessor(Kernel::HLERequestContext& ctx); 49 void RunTeraPluginProcessor(HLERequestContext& ctx);
50 void GetNpadIrCameraHandle(Kernel::HLERequestContext& ctx); 50 void GetNpadIrCameraHandle(HLERequestContext& ctx);
51 void RunPointingProcessor(Kernel::HLERequestContext& ctx); 51 void RunPointingProcessor(HLERequestContext& ctx);
52 void SuspendImageProcessor(Kernel::HLERequestContext& ctx); 52 void SuspendImageProcessor(HLERequestContext& ctx);
53 void CheckFirmwareVersion(Kernel::HLERequestContext& ctx); 53 void CheckFirmwareVersion(HLERequestContext& ctx);
54 void SetFunctionLevel(Kernel::HLERequestContext& ctx); 54 void SetFunctionLevel(HLERequestContext& ctx);
55 void RunImageTransferExProcessor(Kernel::HLERequestContext& ctx); 55 void RunImageTransferExProcessor(HLERequestContext& ctx);
56 void RunIrLedProcessor(Kernel::HLERequestContext& ctx); 56 void RunIrLedProcessor(HLERequestContext& ctx);
57 void StopImageProcessorAsync(Kernel::HLERequestContext& ctx); 57 void StopImageProcessorAsync(HLERequestContext& ctx);
58 void ActivateIrsensorWithFunctionLevel(Kernel::HLERequestContext& ctx); 58 void ActivateIrsensorWithFunctionLevel(HLERequestContext& ctx);
59 59
60 Result IsIrCameraHandleValid(const Core::IrSensor::IrCameraHandle& camera_handle) const; 60 Result IsIrCameraHandleValid(const Core::IrSensor::IrCameraHandle& camera_handle) const;
61 Core::IrSensor::DeviceFormat& GetIrCameraSharedMemoryDeviceEntry( 61 Core::IrSensor::DeviceFormat& GetIrCameraSharedMemoryDeviceEntry(
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/service/hle_ipc.cpp
index 876fbbe53..c221ffe11 100644
--- a/src/core/hle/kernel/hle_ipc.cpp
+++ b/src/core/hle/service/hle_ipc.cpp
@@ -12,8 +12,6 @@
12#include "common/common_types.h" 12#include "common/common_types.h"
13#include "common/logging/log.h" 13#include "common/logging/log.h"
14#include "common/scratch_buffer.h" 14#include "common/scratch_buffer.h"
15#include "core/hle/ipc_helpers.h"
16#include "core/hle/kernel/hle_ipc.h"
17#include "core/hle/kernel/k_auto_object.h" 15#include "core/hle/kernel/k_auto_object.h"
18#include "core/hle/kernel/k_handle_table.h" 16#include "core/hle/kernel/k_handle_table.h"
19#include "core/hle/kernel/k_process.h" 17#include "core/hle/kernel/k_process.h"
@@ -21,17 +19,19 @@
21#include "core/hle/kernel/k_server_session.h" 19#include "core/hle/kernel/k_server_session.h"
22#include "core/hle/kernel/k_thread.h" 20#include "core/hle/kernel/k_thread.h"
23#include "core/hle/kernel/kernel.h" 21#include "core/hle/kernel/kernel.h"
22#include "core/hle/service/hle_ipc.h"
23#include "core/hle/service/ipc_helpers.h"
24#include "core/memory.h" 24#include "core/memory.h"
25 25
26namespace Kernel { 26namespace Service {
27 27
28SessionRequestHandler::SessionRequestHandler(KernelCore& kernel_, const char* service_name_) 28SessionRequestHandler::SessionRequestHandler(Kernel::KernelCore& kernel_, const char* service_name_)
29 : kernel{kernel_} {} 29 : kernel{kernel_} {}
30 30
31SessionRequestHandler::~SessionRequestHandler() = default; 31SessionRequestHandler::~SessionRequestHandler() = default;
32 32
33SessionRequestManager::SessionRequestManager(KernelCore& kernel_, 33SessionRequestManager::SessionRequestManager(Kernel::KernelCore& kernel_,
34 Service::ServerManager& server_manager_) 34 ServerManager& server_manager_)
35 : kernel{kernel_}, server_manager{server_manager_} {} 35 : kernel{kernel_}, server_manager{server_manager_} {}
36 36
37SessionRequestManager::~SessionRequestManager() = default; 37SessionRequestManager::~SessionRequestManager() = default;
@@ -51,7 +51,7 @@ bool SessionRequestManager::HasSessionRequestHandler(const HLERequestContext& co
51 } 51 }
52} 52}
53 53
54Result SessionRequestManager::CompleteSyncRequest(KServerSession* server_session, 54Result SessionRequestManager::CompleteSyncRequest(Kernel::KServerSession* server_session,
55 HLERequestContext& context) { 55 HLERequestContext& context) {
56 Result result = ResultSuccess; 56 Result result = ResultSuccess;
57 57
@@ -79,7 +79,7 @@ Result SessionRequestManager::CompleteSyncRequest(KServerSession* server_session
79 return result; 79 return result;
80} 80}
81 81
82Result SessionRequestManager::HandleDomainSyncRequest(KServerSession* server_session, 82Result SessionRequestManager::HandleDomainSyncRequest(Kernel::KServerSession* server_session,
83 HLERequestContext& context) { 83 HLERequestContext& context) {
84 if (!context.HasDomainMessageHeader()) { 84 if (!context.HasDomainMessageHeader()) {
85 return ResultSuccess; 85 return ResultSuccess;
@@ -124,16 +124,17 @@ Result SessionRequestManager::HandleDomainSyncRequest(KServerSession* server_ses
124 return ResultSuccess; 124 return ResultSuccess;
125} 125}
126 126
127HLERequestContext::HLERequestContext(KernelCore& kernel_, Core::Memory::Memory& memory_, 127HLERequestContext::HLERequestContext(Kernel::KernelCore& kernel_, Core::Memory::Memory& memory_,
128 KServerSession* server_session_, KThread* thread_) 128 Kernel::KServerSession* server_session_,
129 Kernel::KThread* thread_)
129 : server_session(server_session_), thread(thread_), kernel{kernel_}, memory{memory_} { 130 : server_session(server_session_), thread(thread_), kernel{kernel_}, memory{memory_} {
130 cmd_buf[0] = 0; 131 cmd_buf[0] = 0;
131} 132}
132 133
133HLERequestContext::~HLERequestContext() = default; 134HLERequestContext::~HLERequestContext() = default;
134 135
135void HLERequestContext::ParseCommandBuffer(const KHandleTable& handle_table, u32_le* src_cmdbuf, 136void HLERequestContext::ParseCommandBuffer(const Kernel::KHandleTable& handle_table,
136 bool incoming) { 137 u32_le* src_cmdbuf, bool incoming) {
137 IPC::RequestParser rp(src_cmdbuf); 138 IPC::RequestParser rp(src_cmdbuf);
138 command_header = rp.PopRaw<IPC::CommandHeader>(); 139 command_header = rp.PopRaw<IPC::CommandHeader>();
139 140
@@ -253,8 +254,8 @@ void HLERequestContext::ParseCommandBuffer(const KHandleTable& handle_table, u32
253 rp.Skip(1, false); // The command is actually an u64, but we don't use the high part. 254 rp.Skip(1, false); // The command is actually an u64, but we don't use the high part.
254} 255}
255 256
256Result HLERequestContext::PopulateFromIncomingCommandBuffer(const KHandleTable& handle_table, 257Result HLERequestContext::PopulateFromIncomingCommandBuffer(
257 u32_le* src_cmdbuf) { 258 const Kernel::KHandleTable& handle_table, u32_le* src_cmdbuf) {
258 ParseCommandBuffer(handle_table, src_cmdbuf, true); 259 ParseCommandBuffer(handle_table, src_cmdbuf, true);
259 260
260 if (command_header->IsCloseCommand()) { 261 if (command_header->IsCloseCommand()) {
@@ -267,7 +268,7 @@ Result HLERequestContext::PopulateFromIncomingCommandBuffer(const KHandleTable&
267 return ResultSuccess; 268 return ResultSuccess;
268} 269}
269 270
270Result HLERequestContext::WriteToOutgoingCommandBuffer(KThread& requesting_thread) { 271Result HLERequestContext::WriteToOutgoingCommandBuffer(Kernel::KThread& requesting_thread) {
271 auto current_offset = handles_offset; 272 auto current_offset = handles_offset;
272 auto& owner_process = *requesting_thread.GetOwnerProcess(); 273 auto& owner_process = *requesting_thread.GetOwnerProcess();
273 auto& handle_table = owner_process.GetHandleTable(); 274 auto& handle_table = owner_process.GetHandleTable();
@@ -528,4 +529,4 @@ std::string HLERequestContext::Description() const {
528 return s.str(); 529 return s.str();
529} 530}
530 531
531} // namespace Kernel 532} // namespace Service
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/service/hle_ipc.h
index b4364f984..4bd24c899 100644
--- a/src/core/hle/kernel/hle_ipc.h
+++ b/src/core/hle/service/hle_ipc.h
@@ -35,20 +35,18 @@ class ServerManager;
35} // namespace Service 35} // namespace Service
36 36
37namespace Kernel { 37namespace Kernel {
38
39class Domain;
40class HLERequestContext;
41class KAutoObject; 38class KAutoObject;
42class KernelCore; 39class KernelCore;
43class KEvent;
44class KHandleTable; 40class KHandleTable;
45class KServerPort;
46class KProcess;
47class KServerSession; 41class KServerSession;
48class KThread; 42class KThread;
49class KReadableEvent; 43} // namespace Kernel
50class KSession; 44
51class SessionRequestManager; 45namespace Service {
46
47using Handle = Kernel::Handle;
48
49class HLERequestContext;
52 50
53/** 51/**
54 * Interface implemented by HLE Session handlers. 52 * Interface implemented by HLE Session handlers.
@@ -57,7 +55,7 @@ class SessionRequestManager;
57 */ 55 */
58class SessionRequestHandler : public std::enable_shared_from_this<SessionRequestHandler> { 56class SessionRequestHandler : public std::enable_shared_from_this<SessionRequestHandler> {
59public: 57public:
60 SessionRequestHandler(KernelCore& kernel_, const char* service_name_); 58 SessionRequestHandler(Kernel::KernelCore& kernel_, const char* service_name_);
61 virtual ~SessionRequestHandler(); 59 virtual ~SessionRequestHandler();
62 60
63 /** 61 /**
@@ -69,10 +67,10 @@ public:
69 * @returns Result the result code of the translate operation. 67 * @returns Result the result code of the translate operation.
70 */ 68 */
71 virtual Result HandleSyncRequest(Kernel::KServerSession& session, 69 virtual Result HandleSyncRequest(Kernel::KServerSession& session,
72 Kernel::HLERequestContext& context) = 0; 70 HLERequestContext& context) = 0;
73 71
74protected: 72protected:
75 KernelCore& kernel; 73 Kernel::KernelCore& kernel;
76}; 74};
77 75
78using SessionRequestHandlerWeakPtr = std::weak_ptr<SessionRequestHandler>; 76using SessionRequestHandlerWeakPtr = std::weak_ptr<SessionRequestHandler>;
@@ -85,7 +83,8 @@ using SessionRequestHandlerPtr = std::shared_ptr<SessionRequestHandler>;
85 */ 83 */
86class SessionRequestManager final { 84class SessionRequestManager final {
87public: 85public:
88 explicit SessionRequestManager(KernelCore& kernel, Service::ServerManager& server_manager); 86 explicit SessionRequestManager(Kernel::KernelCore& kernel,
87 Service::ServerManager& server_manager);
89 ~SessionRequestManager(); 88 ~SessionRequestManager();
90 89
91 bool IsDomain() const { 90 bool IsDomain() const {
@@ -140,8 +139,9 @@ public:
140 139
141 bool HasSessionRequestHandler(const HLERequestContext& context) const; 140 bool HasSessionRequestHandler(const HLERequestContext& context) const;
142 141
143 Result HandleDomainSyncRequest(KServerSession* server_session, HLERequestContext& context); 142 Result HandleDomainSyncRequest(Kernel::KServerSession* server_session,
144 Result CompleteSyncRequest(KServerSession* server_session, HLERequestContext& context); 143 HLERequestContext& context);
144 Result CompleteSyncRequest(Kernel::KServerSession* server_session, HLERequestContext& context);
145 145
146 Service::ServerManager& GetServerManager() { 146 Service::ServerManager& GetServerManager() {
147 return server_manager; 147 return server_manager;
@@ -166,33 +166,18 @@ private:
166 std::vector<SessionRequestHandlerPtr> domain_handlers; 166 std::vector<SessionRequestHandlerPtr> domain_handlers;
167 167
168private: 168private:
169 KernelCore& kernel; 169 Kernel::KernelCore& kernel;
170 Service::ServerManager& server_manager; 170 Service::ServerManager& server_manager;
171}; 171};
172 172
173/** 173/**
174 * Class containing information about an in-flight IPC request being handled by an HLE service 174 * Class containing information about an in-flight IPC request being handled by an HLE service
175 * implementation. Services should avoid using old global APIs (e.g. Kernel::GetCommandBuffer()) and 175 * implementation.
176 * when possible use the APIs in this class to service the request.
177 *
178 * HLE handle protocol
179 * ===================
180 *
181 * To avoid needing HLE services to keep a separate handle table, or having to directly modify the
182 * requester's table, a tweaked protocol is used to receive and send handles in requests. The kernel
183 * will decode the incoming handles into object pointers and insert a id in the buffer where the
184 * handle would normally be. The service then calls GetIncomingHandle() with that id to get the
185 * pointer to the object. Similarly, instead of inserting a handle into the command buffer, the
186 * service calls AddOutgoingHandle() and stores the returned id where the handle would normally go.
187 *
188 * The end result is similar to just giving services their own real handle tables, but since these
189 * ids are local to a specific context, it avoids requiring services to manage handles for objects
190 * across multiple calls and ensuring that unneeded handles are cleaned up.
191 */ 176 */
192class HLERequestContext { 177class HLERequestContext {
193public: 178public:
194 explicit HLERequestContext(KernelCore& kernel, Core::Memory::Memory& memory, 179 explicit HLERequestContext(Kernel::KernelCore& kernel, Core::Memory::Memory& memory,
195 KServerSession* session, KThread* thread); 180 Kernel::KServerSession* session, Kernel::KThread* thread);
196 ~HLERequestContext(); 181 ~HLERequestContext();
197 182
198 /// Returns a pointer to the IPC command buffer for this request. 183 /// Returns a pointer to the IPC command buffer for this request.
@@ -209,10 +194,11 @@ public:
209 } 194 }
210 195
211 /// Populates this context with data from the requesting process/thread. 196 /// Populates this context with data from the requesting process/thread.
212 Result PopulateFromIncomingCommandBuffer(const KHandleTable& handle_table, u32_le* src_cmdbuf); 197 Result PopulateFromIncomingCommandBuffer(const Kernel::KHandleTable& handle_table,
198 u32_le* src_cmdbuf);
213 199
214 /// Writes data from this context back to the requesting process/thread. 200 /// Writes data from this context back to the requesting process/thread.
215 Result WriteToOutgoingCommandBuffer(KThread& requesting_thread); 201 Result WriteToOutgoingCommandBuffer(Kernel::KThread& requesting_thread);
216 202
217 [[nodiscard]] u32_le GetHipcCommand() const { 203 [[nodiscard]] u32_le GetHipcCommand() const {
218 return command; 204 return command;
@@ -339,11 +325,11 @@ public:
339 return incoming_move_handles.at(index); 325 return incoming_move_handles.at(index);
340 } 326 }
341 327
342 void AddMoveObject(KAutoObject* object) { 328 void AddMoveObject(Kernel::KAutoObject* object) {
343 outgoing_move_objects.emplace_back(object); 329 outgoing_move_objects.emplace_back(object);
344 } 330 }
345 331
346 void AddCopyObject(KAutoObject* object) { 332 void AddCopyObject(Kernel::KAutoObject* object) {
347 outgoing_copy_objects.emplace_back(object); 333 outgoing_copy_objects.emplace_back(object);
348 } 334 }
349 335
@@ -362,7 +348,7 @@ public:
362 348
363 [[nodiscard]] std::string Description() const; 349 [[nodiscard]] std::string Description() const;
364 350
365 [[nodiscard]] KThread& GetThread() { 351 [[nodiscard]] Kernel::KThread& GetThread() {
366 return *thread; 352 return *thread;
367 } 353 }
368 354
@@ -381,17 +367,18 @@ public:
381private: 367private:
382 friend class IPC::ResponseBuilder; 368 friend class IPC::ResponseBuilder;
383 369
384 void ParseCommandBuffer(const KHandleTable& handle_table, u32_le* src_cmdbuf, bool incoming); 370 void ParseCommandBuffer(const Kernel::KHandleTable& handle_table, u32_le* src_cmdbuf,
371 bool incoming);
385 372
386 std::array<u32, IPC::COMMAND_BUFFER_LENGTH> cmd_buf; 373 std::array<u32, IPC::COMMAND_BUFFER_LENGTH> cmd_buf;
387 Kernel::KServerSession* server_session{}; 374 Kernel::KServerSession* server_session{};
388 KThread* thread; 375 Kernel::KThread* thread;
389 376
390 std::vector<Handle> incoming_move_handles; 377 std::vector<Handle> incoming_move_handles;
391 std::vector<Handle> incoming_copy_handles; 378 std::vector<Handle> incoming_copy_handles;
392 379
393 std::vector<KAutoObject*> outgoing_move_objects; 380 std::vector<Kernel::KAutoObject*> outgoing_move_objects;
394 std::vector<KAutoObject*> outgoing_copy_objects; 381 std::vector<Kernel::KAutoObject*> outgoing_copy_objects;
395 std::vector<SessionRequestHandlerPtr> outgoing_domain_objects; 382 std::vector<SessionRequestHandlerPtr> outgoing_domain_objects;
396 383
397 std::optional<IPC::CommandHeader> command_header; 384 std::optional<IPC::CommandHeader> command_header;
@@ -414,8 +401,8 @@ private:
414 std::weak_ptr<SessionRequestManager> manager{}; 401 std::weak_ptr<SessionRequestManager> manager{};
415 bool is_deferred{false}; 402 bool is_deferred{false};
416 403
417 KernelCore& kernel; 404 Kernel::KernelCore& kernel;
418 Core::Memory::Memory& memory; 405 Core::Memory::Memory& memory;
419}; 406};
420 407
421} // namespace Kernel 408} // namespace Service
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/service/ipc_helpers.h
index f8ab55d83..3e67123c7 100644
--- a/src/core/hle/ipc_helpers.h
+++ b/src/core/hle/service/ipc_helpers.h
@@ -10,11 +10,11 @@
10#include "common/assert.h" 10#include "common/assert.h"
11#include "common/common_types.h" 11#include "common/common_types.h"
12#include "core/hle/ipc.h" 12#include "core/hle/ipc.h"
13#include "core/hle/kernel/hle_ipc.h"
14#include "core/hle/kernel/k_process.h" 13#include "core/hle/kernel/k_process.h"
15#include "core/hle/kernel/k_resource_limit.h" 14#include "core/hle/kernel/k_resource_limit.h"
16#include "core/hle/kernel/k_session.h" 15#include "core/hle/kernel/k_session.h"
17#include "core/hle/result.h" 16#include "core/hle/result.h"
17#include "core/hle/service/hle_ipc.h"
18#include "core/hle/service/server_manager.h" 18#include "core/hle/service/server_manager.h"
19 19
20namespace IPC { 20namespace IPC {
@@ -23,14 +23,14 @@ constexpr Result ERR_REMOTE_PROCESS_DEAD{ErrorModule::HIPC, 301};
23 23
24class RequestHelperBase { 24class RequestHelperBase {
25protected: 25protected:
26 Kernel::HLERequestContext* context = nullptr; 26 Service::HLERequestContext* context = nullptr;
27 u32* cmdbuf; 27 u32* cmdbuf;
28 u32 index = 0; 28 u32 index = 0;
29 29
30public: 30public:
31 explicit RequestHelperBase(u32* command_buffer) : cmdbuf(command_buffer) {} 31 explicit RequestHelperBase(u32* command_buffer) : cmdbuf(command_buffer) {}
32 32
33 explicit RequestHelperBase(Kernel::HLERequestContext& ctx) 33 explicit RequestHelperBase(Service::HLERequestContext& ctx)
34 : context(&ctx), cmdbuf(ctx.CommandBuffer()) {} 34 : context(&ctx), cmdbuf(ctx.CommandBuffer()) {}
35 35
36 void Skip(u32 size_in_words, bool set_to_null) { 36 void Skip(u32 size_in_words, bool set_to_null) {
@@ -68,7 +68,7 @@ public:
68 AlwaysMoveHandles = 1, 68 AlwaysMoveHandles = 1,
69 }; 69 };
70 70
71 explicit ResponseBuilder(Kernel::HLERequestContext& ctx, u32 normal_params_size_, 71 explicit ResponseBuilder(Service::HLERequestContext& ctx, u32 normal_params_size_,
72 u32 num_handles_to_copy_ = 0, u32 num_objects_to_move_ = 0, 72 u32 num_handles_to_copy_ = 0, u32 num_objects_to_move_ = 0,
73 Flags flags = Flags::None) 73 Flags flags = Flags::None)
74 : RequestHelperBase(ctx), normal_params_size(normal_params_size_), 74 : RequestHelperBase(ctx), normal_params_size(normal_params_size_),
@@ -157,7 +157,7 @@ public:
157 auto* session = Kernel::KSession::Create(kernel); 157 auto* session = Kernel::KSession::Create(kernel);
158 session->Initialize(nullptr, iface->GetServiceName()); 158 session->Initialize(nullptr, iface->GetServiceName());
159 159
160 auto next_manager = std::make_shared<Kernel::SessionRequestManager>( 160 auto next_manager = std::make_shared<Service::SessionRequestManager>(
161 kernel, manager->GetServerManager()); 161 kernel, manager->GetServerManager());
162 next_manager->SetSessionHandler(iface); 162 next_manager->SetSessionHandler(iface);
163 manager->GetServerManager().RegisterSession(&session->GetServerSession(), next_manager); 163 manager->GetServerManager().RegisterSession(&session->GetServerSession(), next_manager);
@@ -347,7 +347,7 @@ class RequestParser : public RequestHelperBase {
347public: 347public:
348 explicit RequestParser(u32* command_buffer) : RequestHelperBase(command_buffer) {} 348 explicit RequestParser(u32* command_buffer) : RequestHelperBase(command_buffer) {}
349 349
350 explicit RequestParser(Kernel::HLERequestContext& ctx) : RequestHelperBase(ctx) { 350 explicit RequestParser(Service::HLERequestContext& ctx) : RequestHelperBase(ctx) {
351 // TIPC does not have data payload offset 351 // TIPC does not have data payload offset
352 if (!ctx.IsTipc()) { 352 if (!ctx.IsTipc()) {
353 ASSERT_MSG(ctx.GetDataPayloadOffset(), "context is incomplete"); 353 ASSERT_MSG(ctx.GetDataPayloadOffset(), "context is incomplete");
diff --git a/src/core/hle/service/jit/jit.cpp b/src/core/hle/service/jit/jit.cpp
index 005c212dc..46bcfd695 100644
--- a/src/core/hle/service/jit/jit.cpp
+++ b/src/core/hle/service/jit/jit.cpp
@@ -3,10 +3,10 @@
3 3
4#include "core/arm/symbols.h" 4#include "core/arm/symbols.h"
5#include "core/core.h" 5#include "core/core.h"
6#include "core/hle/ipc_helpers.h"
7#include "core/hle/kernel/k_code_memory.h" 6#include "core/hle/kernel/k_code_memory.h"
8#include "core/hle/kernel/k_transfer_memory.h" 7#include "core/hle/kernel/k_transfer_memory.h"
9#include "core/hle/result.h" 8#include "core/hle/result.h"
9#include "core/hle/service/ipc_helpers.h"
10#include "core/hle/service/jit/jit.h" 10#include "core/hle/service/jit/jit.h"
11#include "core/hle/service/jit/jit_context.h" 11#include "core/hle/service/jit/jit_context.h"
12#include "core/hle/service/server_manager.h" 12#include "core/hle/service/server_manager.h"
@@ -44,7 +44,7 @@ public:
44 configuration.sys_rx_memory = user_rx; 44 configuration.sys_rx_memory = user_rx;
45 } 45 }
46 46
47 void GenerateCode(Kernel::HLERequestContext& ctx) { 47 void GenerateCode(HLERequestContext& ctx) {
48 LOG_DEBUG(Service_JIT, "called"); 48 LOG_DEBUG(Service_JIT, "called");
49 49
50 struct InputParameters { 50 struct InputParameters {
@@ -126,7 +126,7 @@ public:
126 } 126 }
127 }; 127 };
128 128
129 void Control(Kernel::HLERequestContext& ctx) { 129 void Control(HLERequestContext& ctx) {
130 LOG_DEBUG(Service_JIT, "called"); 130 LOG_DEBUG(Service_JIT, "called");
131 131
132 IPC::RequestParser rp{ctx}; 132 IPC::RequestParser rp{ctx};
@@ -171,7 +171,7 @@ public:
171 } 171 }
172 } 172 }
173 173
174 void LoadPlugin(Kernel::HLERequestContext& ctx) { 174 void LoadPlugin(HLERequestContext& ctx) {
175 LOG_DEBUG(Service_JIT, "called"); 175 LOG_DEBUG(Service_JIT, "called");
176 176
177 IPC::RequestParser rp{ctx}; 177 IPC::RequestParser rp{ctx};
@@ -277,7 +277,7 @@ public:
277 rb.Push(ResultSuccess); 277 rb.Push(ResultSuccess);
278 } 278 }
279 279
280 void GetCodeAddress(Kernel::HLERequestContext& ctx) { 280 void GetCodeAddress(HLERequestContext& ctx) {
281 LOG_DEBUG(Service_JIT, "called"); 281 LOG_DEBUG(Service_JIT, "called");
282 282
283 IPC::ResponseBuilder rb{ctx, 6}; 283 IPC::ResponseBuilder rb{ctx, 6};
@@ -333,7 +333,7 @@ public:
333 RegisterHandlers(functions); 333 RegisterHandlers(functions);
334 } 334 }
335 335
336 void CreateJitEnvironment(Kernel::HLERequestContext& ctx) { 336 void CreateJitEnvironment(HLERequestContext& ctx) {
337 LOG_DEBUG(Service_JIT, "called"); 337 LOG_DEBUG(Service_JIT, "called");
338 338
339 struct Parameters { 339 struct Parameters {
diff --git a/src/core/hle/service/lbl/lbl.cpp b/src/core/hle/service/lbl/lbl.cpp
index 3f3c68d80..98a79365d 100644
--- a/src/core/hle/service/lbl/lbl.cpp
+++ b/src/core/hle/service/lbl/lbl.cpp
@@ -5,7 +5,7 @@
5#include <memory> 5#include <memory>
6 6
7#include "common/logging/log.h" 7#include "common/logging/log.h"
8#include "core/hle/ipc_helpers.h" 8#include "core/hle/service/ipc_helpers.h"
9#include "core/hle/service/lbl/lbl.h" 9#include "core/hle/service/lbl/lbl.h"
10#include "core/hle/service/server_manager.h" 10#include "core/hle/service/server_manager.h"
11#include "core/hle/service/service.h" 11#include "core/hle/service/service.h"
@@ -60,7 +60,7 @@ private:
60 On = 1, 60 On = 1,
61 }; 61 };
62 62
63 void SetCurrentBrightnessSetting(Kernel::HLERequestContext& ctx) { 63 void SetCurrentBrightnessSetting(HLERequestContext& ctx) {
64 IPC::RequestParser rp{ctx}; 64 IPC::RequestParser rp{ctx};
65 auto brightness = rp.Pop<float>(); 65 auto brightness = rp.Pop<float>();
66 66
@@ -78,7 +78,7 @@ private:
78 rb.Push(ResultSuccess); 78 rb.Push(ResultSuccess);
79 } 79 }
80 80
81 void GetCurrentBrightnessSetting(Kernel::HLERequestContext& ctx) { 81 void GetCurrentBrightnessSetting(HLERequestContext& ctx) {
82 auto brightness = current_brightness; 82 auto brightness = current_brightness;
83 if (!std::isfinite(brightness)) { 83 if (!std::isfinite(brightness)) {
84 LOG_ERROR(Service_LBL, "Brightness is infinite!"); 84 LOG_ERROR(Service_LBL, "Brightness is infinite!");
@@ -92,7 +92,7 @@ private:
92 rb.Push(brightness); 92 rb.Push(brightness);
93 } 93 }
94 94
95 void SwitchBacklightOn(Kernel::HLERequestContext& ctx) { 95 void SwitchBacklightOn(HLERequestContext& ctx) {
96 IPC::RequestParser rp{ctx}; 96 IPC::RequestParser rp{ctx};
97 const auto fade_time = rp.Pop<u64_le>(); 97 const auto fade_time = rp.Pop<u64_le>();
98 LOG_WARNING(Service_LBL, "(STUBBED) called, fade_time={}", fade_time); 98 LOG_WARNING(Service_LBL, "(STUBBED) called, fade_time={}", fade_time);
@@ -103,7 +103,7 @@ private:
103 rb.Push(ResultSuccess); 103 rb.Push(ResultSuccess);
104 } 104 }
105 105
106 void SwitchBacklightOff(Kernel::HLERequestContext& ctx) { 106 void SwitchBacklightOff(HLERequestContext& ctx) {
107 IPC::RequestParser rp{ctx}; 107 IPC::RequestParser rp{ctx};
108 const auto fade_time = rp.Pop<u64_le>(); 108 const auto fade_time = rp.Pop<u64_le>();
109 LOG_WARNING(Service_LBL, "(STUBBED) called, fade_time={}", fade_time); 109 LOG_WARNING(Service_LBL, "(STUBBED) called, fade_time={}", fade_time);
@@ -114,7 +114,7 @@ private:
114 rb.Push(ResultSuccess); 114 rb.Push(ResultSuccess);
115 } 115 }
116 116
117 void GetBacklightSwitchStatus(Kernel::HLERequestContext& ctx) { 117 void GetBacklightSwitchStatus(HLERequestContext& ctx) {
118 LOG_DEBUG(Service_LBL, "called"); 118 LOG_DEBUG(Service_LBL, "called");
119 119
120 IPC::ResponseBuilder rb{ctx, 3}; 120 IPC::ResponseBuilder rb{ctx, 3};
@@ -123,7 +123,7 @@ private:
123 : BacklightSwitchStatus::Off); 123 : BacklightSwitchStatus::Off);
124 } 124 }
125 125
126 void EnableDimming(Kernel::HLERequestContext& ctx) { 126 void EnableDimming(HLERequestContext& ctx) {
127 LOG_DEBUG(Service_LBL, "called"); 127 LOG_DEBUG(Service_LBL, "called");
128 128
129 dimming = true; 129 dimming = true;
@@ -132,7 +132,7 @@ private:
132 rb.Push(ResultSuccess); 132 rb.Push(ResultSuccess);
133 } 133 }
134 134
135 void DisableDimming(Kernel::HLERequestContext& ctx) { 135 void DisableDimming(HLERequestContext& ctx) {
136 LOG_DEBUG(Service_LBL, "called"); 136 LOG_DEBUG(Service_LBL, "called");
137 137
138 dimming = false; 138 dimming = false;
@@ -141,7 +141,7 @@ private:
141 rb.Push(ResultSuccess); 141 rb.Push(ResultSuccess);
142 } 142 }
143 143
144 void IsDimmingEnabled(Kernel::HLERequestContext& ctx) { 144 void IsDimmingEnabled(HLERequestContext& ctx) {
145 LOG_DEBUG(Service_LBL, "called"); 145 LOG_DEBUG(Service_LBL, "called");
146 146
147 IPC::ResponseBuilder rb{ctx, 3}; 147 IPC::ResponseBuilder rb{ctx, 3};
@@ -149,7 +149,7 @@ private:
149 rb.Push(dimming); 149 rb.Push(dimming);
150 } 150 }
151 151
152 void EnableAutoBrightnessControl(Kernel::HLERequestContext& ctx) { 152 void EnableAutoBrightnessControl(HLERequestContext& ctx) {
153 LOG_DEBUG(Service_LBL, "called"); 153 LOG_DEBUG(Service_LBL, "called");
154 auto_brightness = true; 154 auto_brightness = true;
155 update_instantly = true; 155 update_instantly = true;
@@ -158,7 +158,7 @@ private:
158 rb.Push(ResultSuccess); 158 rb.Push(ResultSuccess);
159 } 159 }
160 160
161 void DisableAutoBrightnessControl(Kernel::HLERequestContext& ctx) { 161 void DisableAutoBrightnessControl(HLERequestContext& ctx) {
162 LOG_DEBUG(Service_LBL, "called"); 162 LOG_DEBUG(Service_LBL, "called");
163 auto_brightness = false; 163 auto_brightness = false;
164 164
@@ -166,7 +166,7 @@ private:
166 rb.Push(ResultSuccess); 166 rb.Push(ResultSuccess);
167 } 167 }
168 168
169 void IsAutoBrightnessControlEnabled(Kernel::HLERequestContext& ctx) { 169 void IsAutoBrightnessControlEnabled(HLERequestContext& ctx) {
170 LOG_DEBUG(Service_LBL, "called"); 170 LOG_DEBUG(Service_LBL, "called");
171 171
172 IPC::ResponseBuilder rb{ctx, 3}; 172 IPC::ResponseBuilder rb{ctx, 3};
@@ -174,7 +174,7 @@ private:
174 rb.Push(auto_brightness); 174 rb.Push(auto_brightness);
175 } 175 }
176 176
177 void SetAmbientLightSensorValue(Kernel::HLERequestContext& ctx) { 177 void SetAmbientLightSensorValue(HLERequestContext& ctx) {
178 IPC::RequestParser rp{ctx}; 178 IPC::RequestParser rp{ctx};
179 const auto light_value = rp.Pop<float>(); 179 const auto light_value = rp.Pop<float>();
180 180
@@ -186,7 +186,7 @@ private:
186 rb.Push(ResultSuccess); 186 rb.Push(ResultSuccess);
187 } 187 }
188 188
189 void GetAmbientLightSensorValue(Kernel::HLERequestContext& ctx) { 189 void GetAmbientLightSensorValue(HLERequestContext& ctx) {
190 LOG_DEBUG(Service_LBL, "called"); 190 LOG_DEBUG(Service_LBL, "called");
191 191
192 IPC::ResponseBuilder rb{ctx, 3}; 192 IPC::ResponseBuilder rb{ctx, 3};
@@ -194,7 +194,7 @@ private:
194 rb.Push(ambient_light_value); 194 rb.Push(ambient_light_value);
195 } 195 }
196 196
197 void SetBrightnessReflectionDelayLevel(Kernel::HLERequestContext& ctx) { 197 void SetBrightnessReflectionDelayLevel(HLERequestContext& ctx) {
198 // This is Intentional, this function does absolutely nothing 198 // This is Intentional, this function does absolutely nothing
199 LOG_DEBUG(Service_LBL, "called"); 199 LOG_DEBUG(Service_LBL, "called");
200 200
@@ -202,7 +202,7 @@ private:
202 rb.Push(ResultSuccess); 202 rb.Push(ResultSuccess);
203 } 203 }
204 204
205 void GetBrightnessReflectionDelayLevel(Kernel::HLERequestContext& ctx) { 205 void GetBrightnessReflectionDelayLevel(HLERequestContext& ctx) {
206 // This is intentional, the function is hard coded to return 0.0f on hardware 206 // This is intentional, the function is hard coded to return 0.0f on hardware
207 LOG_DEBUG(Service_LBL, "called"); 207 LOG_DEBUG(Service_LBL, "called");
208 208
@@ -211,7 +211,7 @@ private:
211 rb.Push(0.0f); 211 rb.Push(0.0f);
212 } 212 }
213 213
214 void SetCurrentBrightnessMapping(Kernel::HLERequestContext& ctx) { 214 void SetCurrentBrightnessMapping(HLERequestContext& ctx) {
215 // This is Intentional, this function does absolutely nothing 215 // This is Intentional, this function does absolutely nothing
216 LOG_DEBUG(Service_LBL, "called"); 216 LOG_DEBUG(Service_LBL, "called");
217 217
@@ -219,7 +219,7 @@ private:
219 rb.Push(ResultSuccess); 219 rb.Push(ResultSuccess);
220 } 220 }
221 221
222 void GetCurrentBrightnessMapping(Kernel::HLERequestContext& ctx) { 222 void GetCurrentBrightnessMapping(HLERequestContext& ctx) {
223 // This is Intentional, this function does absolutely nothing 223 // This is Intentional, this function does absolutely nothing
224 LOG_DEBUG(Service_LBL, "called"); 224 LOG_DEBUG(Service_LBL, "called");
225 225
@@ -228,7 +228,7 @@ private:
228 // This function is suppose to return something but it seems like it doesn't 228 // This function is suppose to return something but it seems like it doesn't
229 } 229 }
230 230
231 void SetCurrentAmbientLightSensorMapping(Kernel::HLERequestContext& ctx) { 231 void SetCurrentAmbientLightSensorMapping(HLERequestContext& ctx) {
232 // This is Intentional, this function does absolutely nothing 232 // This is Intentional, this function does absolutely nothing
233 LOG_DEBUG(Service_LBL, "called"); 233 LOG_DEBUG(Service_LBL, "called");
234 234
@@ -236,7 +236,7 @@ private:
236 rb.Push(ResultSuccess); 236 rb.Push(ResultSuccess);
237 } 237 }
238 238
239 void GetCurrentAmbientLightSensorMapping(Kernel::HLERequestContext& ctx) { 239 void GetCurrentAmbientLightSensorMapping(HLERequestContext& ctx) {
240 // This is Intentional, this function does absolutely nothing 240 // This is Intentional, this function does absolutely nothing
241 LOG_DEBUG(Service_LBL, "called"); 241 LOG_DEBUG(Service_LBL, "called");
242 242
@@ -245,7 +245,7 @@ private:
245 // This function is suppose to return something but it seems like it doesn't 245 // This function is suppose to return something but it seems like it doesn't
246 } 246 }
247 247
248 void IsAmbientLightSensorAvailable(Kernel::HLERequestContext& ctx) { 248 void IsAmbientLightSensorAvailable(HLERequestContext& ctx) {
249 LOG_WARNING(Service_LBL, "(STUBBED) called"); 249 LOG_WARNING(Service_LBL, "(STUBBED) called");
250 IPC::ResponseBuilder rb{ctx, 3}; 250 IPC::ResponseBuilder rb{ctx, 3};
251 rb.Push(ResultSuccess); 251 rb.Push(ResultSuccess);
@@ -253,7 +253,7 @@ private:
253 rb.Push(true); 253 rb.Push(true);
254 } 254 }
255 255
256 void SetCurrentBrightnessSettingForVrMode(Kernel::HLERequestContext& ctx) { 256 void SetCurrentBrightnessSettingForVrMode(HLERequestContext& ctx) {
257 IPC::RequestParser rp{ctx}; 257 IPC::RequestParser rp{ctx};
258 auto brightness = rp.Pop<float>(); 258 auto brightness = rp.Pop<float>();
259 259
@@ -270,7 +270,7 @@ private:
270 rb.Push(ResultSuccess); 270 rb.Push(ResultSuccess);
271 } 271 }
272 272
273 void GetCurrentBrightnessSettingForVrMode(Kernel::HLERequestContext& ctx) { 273 void GetCurrentBrightnessSettingForVrMode(HLERequestContext& ctx) {
274 auto brightness = current_vr_brightness; 274 auto brightness = current_vr_brightness;
275 if (!std::isfinite(brightness)) { 275 if (!std::isfinite(brightness)) {
276 LOG_ERROR(Service_LBL, "Brightness is infinite!"); 276 LOG_ERROR(Service_LBL, "Brightness is infinite!");
@@ -284,7 +284,7 @@ private:
284 rb.Push(brightness); 284 rb.Push(brightness);
285 } 285 }
286 286
287 void EnableVrMode(Kernel::HLERequestContext& ctx) { 287 void EnableVrMode(HLERequestContext& ctx) {
288 LOG_DEBUG(Service_LBL, "called"); 288 LOG_DEBUG(Service_LBL, "called");
289 289
290 IPC::ResponseBuilder rb{ctx, 2}; 290 IPC::ResponseBuilder rb{ctx, 2};
@@ -293,7 +293,7 @@ private:
293 vr_mode_enabled = true; 293 vr_mode_enabled = true;
294 } 294 }
295 295
296 void DisableVrMode(Kernel::HLERequestContext& ctx) { 296 void DisableVrMode(HLERequestContext& ctx) {
297 LOG_DEBUG(Service_LBL, "called"); 297 LOG_DEBUG(Service_LBL, "called");
298 298
299 IPC::ResponseBuilder rb{ctx, 2}; 299 IPC::ResponseBuilder rb{ctx, 2};
@@ -302,7 +302,7 @@ private:
302 vr_mode_enabled = false; 302 vr_mode_enabled = false;
303 } 303 }
304 304
305 void IsVrModeEnabled(Kernel::HLERequestContext& ctx) { 305 void IsVrModeEnabled(HLERequestContext& ctx) {
306 LOG_DEBUG(Service_LBL, "called"); 306 LOG_DEBUG(Service_LBL, "called");
307 307
308 IPC::ResponseBuilder rb{ctx, 3}; 308 IPC::ResponseBuilder rb{ctx, 3};
diff --git a/src/core/hle/service/ldn/ldn.cpp b/src/core/hle/service/ldn/ldn.cpp
index 4c2abe7d3..9d149a7cd 100644
--- a/src/core/hle/service/ldn/ldn.cpp
+++ b/src/core/hle/service/ldn/ldn.cpp
@@ -50,7 +50,7 @@ public:
50 RegisterHandlers(functions); 50 RegisterHandlers(functions);
51 } 51 }
52 52
53 void CreateMonitorService(Kernel::HLERequestContext& ctx) { 53 void CreateMonitorService(HLERequestContext& ctx) {
54 LOG_DEBUG(Service_LDN, "called"); 54 LOG_DEBUG(Service_LDN, "called");
55 55
56 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 56 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -169,7 +169,7 @@ public:
169 state_change_event->Signal(); 169 state_change_event->Signal();
170 } 170 }
171 171
172 void GetState(Kernel::HLERequestContext& ctx) { 172 void GetState(HLERequestContext& ctx) {
173 State state = State::Error; 173 State state = State::Error;
174 174
175 if (is_initialized) { 175 if (is_initialized) {
@@ -181,7 +181,7 @@ public:
181 rb.PushEnum(state); 181 rb.PushEnum(state);
182 } 182 }
183 183
184 void GetNetworkInfo(Kernel::HLERequestContext& ctx) { 184 void GetNetworkInfo(HLERequestContext& ctx) {
185 const auto write_buffer_size = ctx.GetWriteBufferSize(); 185 const auto write_buffer_size = ctx.GetWriteBufferSize();
186 186
187 if (write_buffer_size != sizeof(NetworkInfo)) { 187 if (write_buffer_size != sizeof(NetworkInfo)) {
@@ -205,7 +205,7 @@ public:
205 rb.Push(ResultSuccess); 205 rb.Push(ResultSuccess);
206 } 206 }
207 207
208 void GetIpv4Address(Kernel::HLERequestContext& ctx) { 208 void GetIpv4Address(HLERequestContext& ctx) {
209 const auto network_interface = Network::GetSelectedNetworkInterface(); 209 const auto network_interface = Network::GetSelectedNetworkInterface();
210 210
211 if (!network_interface) { 211 if (!network_interface) {
@@ -234,13 +234,13 @@ public:
234 rb.PushRaw(subnet_mask); 234 rb.PushRaw(subnet_mask);
235 } 235 }
236 236
237 void GetDisconnectReason(Kernel::HLERequestContext& ctx) { 237 void GetDisconnectReason(HLERequestContext& ctx) {
238 IPC::ResponseBuilder rb{ctx, 3}; 238 IPC::ResponseBuilder rb{ctx, 3};
239 rb.Push(ResultSuccess); 239 rb.Push(ResultSuccess);
240 rb.PushEnum(lan_discovery.GetDisconnectReason()); 240 rb.PushEnum(lan_discovery.GetDisconnectReason());
241 } 241 }
242 242
243 void GetSecurityParameter(Kernel::HLERequestContext& ctx) { 243 void GetSecurityParameter(HLERequestContext& ctx) {
244 SecurityParameter security_parameter{}; 244 SecurityParameter security_parameter{};
245 NetworkInfo info{}; 245 NetworkInfo info{};
246 const Result rc = lan_discovery.GetNetworkInfo(info); 246 const Result rc = lan_discovery.GetNetworkInfo(info);
@@ -261,7 +261,7 @@ public:
261 rb.PushRaw<SecurityParameter>(security_parameter); 261 rb.PushRaw<SecurityParameter>(security_parameter);
262 } 262 }
263 263
264 void GetNetworkConfig(Kernel::HLERequestContext& ctx) { 264 void GetNetworkConfig(HLERequestContext& ctx) {
265 NetworkConfig config{}; 265 NetworkConfig config{};
266 NetworkInfo info{}; 266 NetworkInfo info{};
267 const Result rc = lan_discovery.GetNetworkInfo(info); 267 const Result rc = lan_discovery.GetNetworkInfo(info);
@@ -283,7 +283,7 @@ public:
283 rb.PushRaw<NetworkConfig>(config); 283 rb.PushRaw<NetworkConfig>(config);
284 } 284 }
285 285
286 void AttachStateChangeEvent(Kernel::HLERequestContext& ctx) { 286 void AttachStateChangeEvent(HLERequestContext& ctx) {
287 LOG_INFO(Service_LDN, "called"); 287 LOG_INFO(Service_LDN, "called");
288 288
289 IPC::ResponseBuilder rb{ctx, 2, 1}; 289 IPC::ResponseBuilder rb{ctx, 2, 1};
@@ -291,7 +291,7 @@ public:
291 rb.PushCopyObjects(state_change_event->GetReadableEvent()); 291 rb.PushCopyObjects(state_change_event->GetReadableEvent());
292 } 292 }
293 293
294 void GetNetworkInfoLatestUpdate(Kernel::HLERequestContext& ctx) { 294 void GetNetworkInfoLatestUpdate(HLERequestContext& ctx) {
295 const std::size_t network_buffer_size = ctx.GetWriteBufferSize(0); 295 const std::size_t network_buffer_size = ctx.GetWriteBufferSize(0);
296 const std::size_t node_buffer_count = ctx.GetWriteBufferNumElements<NodeLatestUpdate>(1); 296 const std::size_t node_buffer_count = ctx.GetWriteBufferNumElements<NodeLatestUpdate>(1);
297 297
@@ -321,15 +321,15 @@ public:
321 rb.Push(ResultSuccess); 321 rb.Push(ResultSuccess);
322 } 322 }
323 323
324 void Scan(Kernel::HLERequestContext& ctx) { 324 void Scan(HLERequestContext& ctx) {
325 ScanImpl(ctx); 325 ScanImpl(ctx);
326 } 326 }
327 327
328 void ScanPrivate(Kernel::HLERequestContext& ctx) { 328 void ScanPrivate(HLERequestContext& ctx) {
329 ScanImpl(ctx, true); 329 ScanImpl(ctx, true);
330 } 330 }
331 331
332 void ScanImpl(Kernel::HLERequestContext& ctx, bool is_private = false) { 332 void ScanImpl(HLERequestContext& ctx, bool is_private = false) {
333 IPC::RequestParser rp{ctx}; 333 IPC::RequestParser rp{ctx};
334 const auto channel{rp.PopEnum<WifiChannel>()}; 334 const auto channel{rp.PopEnum<WifiChannel>()};
335 const auto scan_filter{rp.PopRaw<ScanFilter>()}; 335 const auto scan_filter{rp.PopRaw<ScanFilter>()};
@@ -358,40 +358,40 @@ public:
358 rb.Push<u32>(count); 358 rb.Push<u32>(count);
359 } 359 }
360 360
361 void SetWirelessControllerRestriction(Kernel::HLERequestContext& ctx) { 361 void SetWirelessControllerRestriction(HLERequestContext& ctx) {
362 LOG_WARNING(Service_LDN, "(STUBBED) called"); 362 LOG_WARNING(Service_LDN, "(STUBBED) called");
363 363
364 IPC::ResponseBuilder rb{ctx, 2}; 364 IPC::ResponseBuilder rb{ctx, 2};
365 rb.Push(ResultSuccess); 365 rb.Push(ResultSuccess);
366 } 366 }
367 367
368 void OpenAccessPoint(Kernel::HLERequestContext& ctx) { 368 void OpenAccessPoint(HLERequestContext& ctx) {
369 LOG_INFO(Service_LDN, "called"); 369 LOG_INFO(Service_LDN, "called");
370 370
371 IPC::ResponseBuilder rb{ctx, 2}; 371 IPC::ResponseBuilder rb{ctx, 2};
372 rb.Push(lan_discovery.OpenAccessPoint()); 372 rb.Push(lan_discovery.OpenAccessPoint());
373 } 373 }
374 374
375 void CloseAccessPoint(Kernel::HLERequestContext& ctx) { 375 void CloseAccessPoint(HLERequestContext& ctx) {
376 LOG_INFO(Service_LDN, "called"); 376 LOG_INFO(Service_LDN, "called");
377 377
378 IPC::ResponseBuilder rb{ctx, 2}; 378 IPC::ResponseBuilder rb{ctx, 2};
379 rb.Push(lan_discovery.CloseAccessPoint()); 379 rb.Push(lan_discovery.CloseAccessPoint());
380 } 380 }
381 381
382 void CreateNetwork(Kernel::HLERequestContext& ctx) { 382 void CreateNetwork(HLERequestContext& ctx) {
383 LOG_INFO(Service_LDN, "called"); 383 LOG_INFO(Service_LDN, "called");
384 384
385 CreateNetworkImpl(ctx); 385 CreateNetworkImpl(ctx);
386 } 386 }
387 387
388 void CreateNetworkPrivate(Kernel::HLERequestContext& ctx) { 388 void CreateNetworkPrivate(HLERequestContext& ctx) {
389 LOG_INFO(Service_LDN, "called"); 389 LOG_INFO(Service_LDN, "called");
390 390
391 CreateNetworkImpl(ctx, true); 391 CreateNetworkImpl(ctx, true);
392 } 392 }
393 393
394 void CreateNetworkImpl(Kernel::HLERequestContext& ctx, bool is_private = false) { 394 void CreateNetworkImpl(HLERequestContext& ctx, bool is_private = false) {
395 IPC::RequestParser rp{ctx}; 395 IPC::RequestParser rp{ctx};
396 396
397 const auto security_config{rp.PopRaw<SecurityConfig>()}; 397 const auto security_config{rp.PopRaw<SecurityConfig>()};
@@ -405,49 +405,49 @@ public:
405 rb.Push(lan_discovery.CreateNetwork(security_config, user_config, network_Config)); 405 rb.Push(lan_discovery.CreateNetwork(security_config, user_config, network_Config));
406 } 406 }
407 407
408 void DestroyNetwork(Kernel::HLERequestContext& ctx) { 408 void DestroyNetwork(HLERequestContext& ctx) {
409 LOG_INFO(Service_LDN, "called"); 409 LOG_INFO(Service_LDN, "called");
410 410
411 IPC::ResponseBuilder rb{ctx, 2}; 411 IPC::ResponseBuilder rb{ctx, 2};
412 rb.Push(lan_discovery.DestroyNetwork()); 412 rb.Push(lan_discovery.DestroyNetwork());
413 } 413 }
414 414
415 void SetAdvertiseData(Kernel::HLERequestContext& ctx) { 415 void SetAdvertiseData(HLERequestContext& ctx) {
416 const auto read_buffer = ctx.ReadBuffer(); 416 const auto read_buffer = ctx.ReadBuffer();
417 417
418 IPC::ResponseBuilder rb{ctx, 2}; 418 IPC::ResponseBuilder rb{ctx, 2};
419 rb.Push(lan_discovery.SetAdvertiseData(read_buffer)); 419 rb.Push(lan_discovery.SetAdvertiseData(read_buffer));
420 } 420 }
421 421
422 void SetStationAcceptPolicy(Kernel::HLERequestContext& ctx) { 422 void SetStationAcceptPolicy(HLERequestContext& ctx) {
423 LOG_WARNING(Service_LDN, "(STUBBED) called"); 423 LOG_WARNING(Service_LDN, "(STUBBED) called");
424 424
425 IPC::ResponseBuilder rb{ctx, 2}; 425 IPC::ResponseBuilder rb{ctx, 2};
426 rb.Push(ResultSuccess); 426 rb.Push(ResultSuccess);
427 } 427 }
428 428
429 void AddAcceptFilterEntry(Kernel::HLERequestContext& ctx) { 429 void AddAcceptFilterEntry(HLERequestContext& ctx) {
430 LOG_WARNING(Service_LDN, "(STUBBED) called"); 430 LOG_WARNING(Service_LDN, "(STUBBED) called");
431 431
432 IPC::ResponseBuilder rb{ctx, 2}; 432 IPC::ResponseBuilder rb{ctx, 2};
433 rb.Push(ResultSuccess); 433 rb.Push(ResultSuccess);
434 } 434 }
435 435
436 void OpenStation(Kernel::HLERequestContext& ctx) { 436 void OpenStation(HLERequestContext& ctx) {
437 LOG_INFO(Service_LDN, "called"); 437 LOG_INFO(Service_LDN, "called");
438 438
439 IPC::ResponseBuilder rb{ctx, 2}; 439 IPC::ResponseBuilder rb{ctx, 2};
440 rb.Push(lan_discovery.OpenStation()); 440 rb.Push(lan_discovery.OpenStation());
441 } 441 }
442 442
443 void CloseStation(Kernel::HLERequestContext& ctx) { 443 void CloseStation(HLERequestContext& ctx) {
444 LOG_INFO(Service_LDN, "called"); 444 LOG_INFO(Service_LDN, "called");
445 445
446 IPC::ResponseBuilder rb{ctx, 2}; 446 IPC::ResponseBuilder rb{ctx, 2};
447 rb.Push(lan_discovery.CloseStation()); 447 rb.Push(lan_discovery.CloseStation());
448 } 448 }
449 449
450 void Connect(Kernel::HLERequestContext& ctx) { 450 void Connect(HLERequestContext& ctx) {
451 IPC::RequestParser rp{ctx}; 451 IPC::RequestParser rp{ctx};
452 struct Parameters { 452 struct Parameters {
453 SecurityConfig security_config; 453 SecurityConfig security_config;
@@ -481,14 +481,14 @@ public:
481 static_cast<u16>(parameters.local_communication_version))); 481 static_cast<u16>(parameters.local_communication_version)));
482 } 482 }
483 483
484 void Disconnect(Kernel::HLERequestContext& ctx) { 484 void Disconnect(HLERequestContext& ctx) {
485 LOG_INFO(Service_LDN, "called"); 485 LOG_INFO(Service_LDN, "called");
486 486
487 IPC::ResponseBuilder rb{ctx, 2}; 487 IPC::ResponseBuilder rb{ctx, 2};
488 rb.Push(lan_discovery.Disconnect()); 488 rb.Push(lan_discovery.Disconnect());
489 } 489 }
490 490
491 void Initialize(Kernel::HLERequestContext& ctx) { 491 void Initialize(HLERequestContext& ctx) {
492 const auto rc = InitializeImpl(ctx); 492 const auto rc = InitializeImpl(ctx);
493 if (rc.IsError()) { 493 if (rc.IsError()) {
494 LOG_ERROR(Service_LDN, "Network isn't initialized, rc={}", rc.raw); 494 LOG_ERROR(Service_LDN, "Network isn't initialized, rc={}", rc.raw);
@@ -498,7 +498,7 @@ public:
498 rb.Push(rc); 498 rb.Push(rc);
499 } 499 }
500 500
501 void Finalize(Kernel::HLERequestContext& ctx) { 501 void Finalize(HLERequestContext& ctx) {
502 if (auto room_member = room_network.GetRoomMember().lock()) { 502 if (auto room_member = room_network.GetRoomMember().lock()) {
503 room_member->Unbind(ldn_packet_received); 503 room_member->Unbind(ldn_packet_received);
504 } 504 }
@@ -509,7 +509,7 @@ public:
509 rb.Push(lan_discovery.Finalize()); 509 rb.Push(lan_discovery.Finalize());
510 } 510 }
511 511
512 void Initialize2(Kernel::HLERequestContext& ctx) { 512 void Initialize2(HLERequestContext& ctx) {
513 const auto rc = InitializeImpl(ctx); 513 const auto rc = InitializeImpl(ctx);
514 if (rc.IsError()) { 514 if (rc.IsError()) {
515 LOG_ERROR(Service_LDN, "Network isn't initialized, rc={}", rc.raw); 515 LOG_ERROR(Service_LDN, "Network isn't initialized, rc={}", rc.raw);
@@ -519,7 +519,7 @@ public:
519 rb.Push(rc); 519 rb.Push(rc);
520 } 520 }
521 521
522 Result InitializeImpl(Kernel::HLERequestContext& ctx) { 522 Result InitializeImpl(HLERequestContext& ctx) {
523 const auto network_interface = Network::GetSelectedNetworkInterface(); 523 const auto network_interface = Network::GetSelectedNetworkInterface();
524 if (!network_interface) { 524 if (!network_interface) {
525 LOG_ERROR(Service_LDN, "No network interface is set"); 525 LOG_ERROR(Service_LDN, "No network interface is set");
@@ -562,7 +562,7 @@ public:
562 RegisterHandlers(functions); 562 RegisterHandlers(functions);
563 } 563 }
564 564
565 void CreateSystemLocalCommunicationService(Kernel::HLERequestContext& ctx) { 565 void CreateSystemLocalCommunicationService(HLERequestContext& ctx) {
566 LOG_DEBUG(Service_LDN, "called"); 566 LOG_DEBUG(Service_LDN, "called");
567 567
568 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 568 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -583,7 +583,7 @@ public:
583 RegisterHandlers(functions); 583 RegisterHandlers(functions);
584 } 584 }
585 585
586 void CreateUserLocalCommunicationService(Kernel::HLERequestContext& ctx) { 586 void CreateUserLocalCommunicationService(HLERequestContext& ctx) {
587 LOG_DEBUG(Service_LDN, "called"); 587 LOG_DEBUG(Service_LDN, "called");
588 588
589 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 589 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -647,7 +647,7 @@ public:
647 RegisterHandlers(functions); 647 RegisterHandlers(functions);
648 } 648 }
649 649
650 void Initialize(Kernel::HLERequestContext& ctx) { 650 void Initialize(HLERequestContext& ctx) {
651 LOG_WARNING(Service_LDN, "(STUBBED) called"); 651 LOG_WARNING(Service_LDN, "(STUBBED) called");
652 652
653 IPC::ResponseBuilder rb{ctx, 2}; 653 IPC::ResponseBuilder rb{ctx, 2};
@@ -668,7 +668,7 @@ public:
668 RegisterHandlers(functions); 668 RegisterHandlers(functions);
669 } 669 }
670 670
671 void CreateNetworkervice(Kernel::HLERequestContext& ctx) { 671 void CreateNetworkervice(HLERequestContext& ctx) {
672 IPC::RequestParser rp{ctx}; 672 IPC::RequestParser rp{ctx};
673 const u64 reserved_input = rp.Pop<u64>(); 673 const u64 reserved_input = rp.Pop<u64>();
674 const u32 input = rp.Pop<u32>(); 674 const u32 input = rp.Pop<u32>();
@@ -681,7 +681,7 @@ public:
681 rb.PushIpcInterface<INetworkService>(system); 681 rb.PushIpcInterface<INetworkService>(system);
682 } 682 }
683 683
684 void CreateMonitorService(Kernel::HLERequestContext& ctx) { 684 void CreateMonitorService(HLERequestContext& ctx) {
685 IPC::RequestParser rp{ctx}; 685 IPC::RequestParser rp{ctx};
686 const u64 reserved_input = rp.Pop<u64>(); 686 const u64 reserved_input = rp.Pop<u64>();
687 687
@@ -706,7 +706,7 @@ public:
706 RegisterHandlers(functions); 706 RegisterHandlers(functions);
707 } 707 }
708 708
709 void CreateNetworkervice(Kernel::HLERequestContext& ctx) { 709 void CreateNetworkervice(HLERequestContext& ctx) {
710 IPC::RequestParser rp{ctx}; 710 IPC::RequestParser rp{ctx};
711 const u64 reserved_input = rp.Pop<u64>(); 711 const u64 reserved_input = rp.Pop<u64>();
712 const u32 input = rp.Pop<u32>(); 712 const u32 input = rp.Pop<u32>();
@@ -719,7 +719,7 @@ public:
719 rb.PushIpcInterface<INetworkService>(system); 719 rb.PushIpcInterface<INetworkService>(system);
720 } 720 }
721 721
722 void CreateMonitorService(Kernel::HLERequestContext& ctx) { 722 void CreateMonitorService(HLERequestContext& ctx) {
723 IPC::RequestParser rp{ctx}; 723 IPC::RequestParser rp{ctx};
724 const u64 reserved_input = rp.Pop<u64>(); 724 const u64 reserved_input = rp.Pop<u64>();
725 725
diff --git a/src/core/hle/service/ldn/ldn.h b/src/core/hle/service/ldn/ldn.h
index fa869fa89..f4a319168 100644
--- a/src/core/hle/service/ldn/ldn.h
+++ b/src/core/hle/service/ldn/ldn.h
@@ -3,9 +3,9 @@
3 3
4#pragma once 4#pragma once
5 5
6#include "core/hle/ipc_helpers.h"
7#include "core/hle/kernel/k_event.h" 6#include "core/hle/kernel/k_event.h"
8#include "core/hle/result.h" 7#include "core/hle/result.h"
8#include "core/hle/service/ipc_helpers.h"
9#include "core/hle/service/kernel_helpers.h" 9#include "core/hle/service/kernel_helpers.h"
10#include "core/hle/service/sm/sm.h" 10#include "core/hle/service/sm/sm.h"
11 11
diff --git a/src/core/hle/service/ldr/ldr.cpp b/src/core/hle/service/ldr/ldr.cpp
index c82e189f4..6de96ed5b 100644
--- a/src/core/hle/service/ldr/ldr.cpp
+++ b/src/core/hle/service/ldr/ldr.cpp
@@ -9,10 +9,10 @@
9#include "common/hex_util.h" 9#include "common/hex_util.h"
10#include "common/scope_exit.h" 10#include "common/scope_exit.h"
11#include "core/core.h" 11#include "core/core.h"
12#include "core/hle/ipc_helpers.h"
13#include "core/hle/kernel/k_page_table.h" 12#include "core/hle/kernel/k_page_table.h"
14#include "core/hle/kernel/svc_results.h" 13#include "core/hle/kernel/svc_results.h"
15#include "core/hle/kernel/svc_types.h" 14#include "core/hle/kernel/svc_types.h"
15#include "core/hle/service/ipc_helpers.h"
16#include "core/hle/service/ldr/ldr.h" 16#include "core/hle/service/ldr/ldr.h"
17#include "core/hle/service/server_manager.h" 17#include "core/hle/service/server_manager.h"
18#include "core/hle/service/service.h" 18#include "core/hle/service/service.h"
@@ -175,7 +175,7 @@ public:
175 RegisterHandlers(functions); 175 RegisterHandlers(functions);
176 } 176 }
177 177
178 void RegisterModuleInfo(Kernel::HLERequestContext& ctx) { 178 void RegisterModuleInfo(HLERequestContext& ctx) {
179 struct Parameters { 179 struct Parameters {
180 u64_le process_id; 180 u64_le process_id;
181 u64_le nrr_address; 181 u64_le nrr_address;
@@ -272,7 +272,7 @@ public:
272 rb.Push(ResultSuccess); 272 rb.Push(ResultSuccess);
273 } 273 }
274 274
275 void UnregisterModuleInfo(Kernel::HLERequestContext& ctx) { 275 void UnregisterModuleInfo(HLERequestContext& ctx) {
276 IPC::RequestParser rp{ctx}; 276 IPC::RequestParser rp{ctx};
277 const auto pid = rp.Pop<u64>(); 277 const auto pid = rp.Pop<u64>();
278 const auto nrr_address = rp.Pop<VAddr>(); 278 const auto nrr_address = rp.Pop<VAddr>();
@@ -446,7 +446,7 @@ public:
446 data_start, bss_end_addr - data_start, Kernel::Svc::MemoryPermission::ReadWrite); 446 data_start, bss_end_addr - data_start, Kernel::Svc::MemoryPermission::ReadWrite);
447 } 447 }
448 448
449 void LoadModule(Kernel::HLERequestContext& ctx) { 449 void LoadModule(HLERequestContext& ctx) {
450 struct Parameters { 450 struct Parameters {
451 u64_le process_id; 451 u64_le process_id;
452 u64_le image_address; 452 u64_le image_address;
@@ -592,7 +592,7 @@ public:
592 return ResultSuccess; 592 return ResultSuccess;
593 } 593 }
594 594
595 void UnloadModule(Kernel::HLERequestContext& ctx) { 595 void UnloadModule(HLERequestContext& ctx) {
596 if (!initialized) { 596 if (!initialized) {
597 LOG_ERROR(Service_LDR, "LDR:RO not initialized before use!"); 597 LOG_ERROR(Service_LDR, "LDR:RO not initialized before use!");
598 IPC::ResponseBuilder rb{ctx, 2}; 598 IPC::ResponseBuilder rb{ctx, 2};
@@ -638,7 +638,7 @@ public:
638 rb.Push(result); 638 rb.Push(result);
639 } 639 }
640 640
641 void Initialize(Kernel::HLERequestContext& ctx) { 641 void Initialize(HLERequestContext& ctx) {
642 LOG_WARNING(Service_LDR, "(STUBBED) called"); 642 LOG_WARNING(Service_LDR, "(STUBBED) called");
643 643
644 initialized = true; 644 initialized = true;
diff --git a/src/core/hle/service/lm/lm.cpp b/src/core/hle/service/lm/lm.cpp
index 7efd8e0ab..20df00233 100644
--- a/src/core/hle/service/lm/lm.cpp
+++ b/src/core/hle/service/lm/lm.cpp
@@ -8,7 +8,7 @@
8#include <boost/container_hash/hash.hpp> 8#include <boost/container_hash/hash.hpp>
9#include "common/logging/log.h" 9#include "common/logging/log.h"
10#include "core/core.h" 10#include "core/core.h"
11#include "core/hle/ipc_helpers.h" 11#include "core/hle/service/ipc_helpers.h"
12#include "core/hle/service/lm/lm.h" 12#include "core/hle/service/lm/lm.h"
13#include "core/hle/service/server_manager.h" 13#include "core/hle/service/server_manager.h"
14#include "core/hle/service/service.h" 14#include "core/hle/service/service.h"
@@ -93,7 +93,7 @@ public:
93 } 93 }
94 94
95private: 95private:
96 void Log(Kernel::HLERequestContext& ctx) { 96 void Log(HLERequestContext& ctx) {
97 std::size_t offset{}; 97 std::size_t offset{};
98 const auto data = ctx.ReadBuffer(); 98 const auto data = ctx.ReadBuffer();
99 99
@@ -148,7 +148,7 @@ private:
148 } 148 }
149 } 149 }
150 150
151 void SetDestination(Kernel::HLERequestContext& ctx) { 151 void SetDestination(HLERequestContext& ctx) {
152 IPC::RequestParser rp{ctx}; 152 IPC::RequestParser rp{ctx};
153 const auto log_destination = rp.PopEnum<LogDestination>(); 153 const auto log_destination = rp.PopEnum<LogDestination>();
154 154
@@ -343,7 +343,7 @@ public:
343 } 343 }
344 344
345private: 345private:
346 void OpenLogger(Kernel::HLERequestContext& ctx) { 346 void OpenLogger(HLERequestContext& ctx) {
347 LOG_DEBUG(Service_LM, "called"); 347 LOG_DEBUG(Service_LM, "called");
348 348
349 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 349 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
diff --git a/src/core/hle/service/mii/mii.cpp b/src/core/hle/service/mii/mii.cpp
index 50dc0ac64..5c7adf97d 100644
--- a/src/core/hle/service/mii/mii.cpp
+++ b/src/core/hle/service/mii/mii.cpp
@@ -4,7 +4,7 @@
4#include <memory> 4#include <memory>
5 5
6#include "common/logging/log.h" 6#include "common/logging/log.h"
7#include "core/hle/ipc_helpers.h" 7#include "core/hle/service/ipc_helpers.h"
8#include "core/hle/service/mii/mii.h" 8#include "core/hle/service/mii/mii.h"
9#include "core/hle/service/mii/mii_manager.h" 9#include "core/hle/service/mii/mii_manager.h"
10#include "core/hle/service/server_manager.h" 10#include "core/hle/service/server_manager.h"
@@ -65,7 +65,7 @@ private:
65 return out; 65 return out;
66 } 66 }
67 67
68 void IsUpdated(Kernel::HLERequestContext& ctx) { 68 void IsUpdated(HLERequestContext& ctx) {
69 IPC::RequestParser rp{ctx}; 69 IPC::RequestParser rp{ctx};
70 const auto source_flag{rp.PopRaw<SourceFlag>()}; 70 const auto source_flag{rp.PopRaw<SourceFlag>()};
71 71
@@ -76,7 +76,7 @@ private:
76 rb.Push(manager.CheckAndResetUpdateCounter(source_flag, current_update_counter)); 76 rb.Push(manager.CheckAndResetUpdateCounter(source_flag, current_update_counter));
77 } 77 }
78 78
79 void IsFullDatabase(Kernel::HLERequestContext& ctx) { 79 void IsFullDatabase(HLERequestContext& ctx) {
80 LOG_DEBUG(Service_Mii, "called"); 80 LOG_DEBUG(Service_Mii, "called");
81 81
82 IPC::ResponseBuilder rb{ctx, 3}; 82 IPC::ResponseBuilder rb{ctx, 3};
@@ -84,7 +84,7 @@ private:
84 rb.Push(manager.IsFullDatabase()); 84 rb.Push(manager.IsFullDatabase());
85 } 85 }
86 86
87 void GetCount(Kernel::HLERequestContext& ctx) { 87 void GetCount(HLERequestContext& ctx) {
88 IPC::RequestParser rp{ctx}; 88 IPC::RequestParser rp{ctx};
89 const auto source_flag{rp.PopRaw<SourceFlag>()}; 89 const auto source_flag{rp.PopRaw<SourceFlag>()};
90 90
@@ -95,7 +95,7 @@ private:
95 rb.Push<u32>(manager.GetCount(source_flag)); 95 rb.Push<u32>(manager.GetCount(source_flag));
96 } 96 }
97 97
98 void Get(Kernel::HLERequestContext& ctx) { 98 void Get(HLERequestContext& ctx) {
99 IPC::RequestParser rp{ctx}; 99 IPC::RequestParser rp{ctx};
100 const auto source_flag{rp.PopRaw<SourceFlag>()}; 100 const auto source_flag{rp.PopRaw<SourceFlag>()};
101 101
@@ -117,7 +117,7 @@ private:
117 rb.Push<u32>(static_cast<u32>(result->size())); 117 rb.Push<u32>(static_cast<u32>(result->size()));
118 } 118 }
119 119
120 void Get1(Kernel::HLERequestContext& ctx) { 120 void Get1(HLERequestContext& ctx) {
121 IPC::RequestParser rp{ctx}; 121 IPC::RequestParser rp{ctx};
122 const auto source_flag{rp.PopRaw<SourceFlag>()}; 122 const auto source_flag{rp.PopRaw<SourceFlag>()};
123 123
@@ -142,7 +142,7 @@ private:
142 rb.Push<u32>(static_cast<u32>(result->size())); 142 rb.Push<u32>(static_cast<u32>(result->size()));
143 } 143 }
144 144
145 void UpdateLatest(Kernel::HLERequestContext& ctx) { 145 void UpdateLatest(HLERequestContext& ctx) {
146 IPC::RequestParser rp{ctx}; 146 IPC::RequestParser rp{ctx};
147 const auto info{rp.PopRaw<CharInfo>()}; 147 const auto info{rp.PopRaw<CharInfo>()};
148 const auto source_flag{rp.PopRaw<SourceFlag>()}; 148 const auto source_flag{rp.PopRaw<SourceFlag>()};
@@ -161,7 +161,7 @@ private:
161 rb.PushRaw<CharInfo>(*result); 161 rb.PushRaw<CharInfo>(*result);
162 } 162 }
163 163
164 void BuildRandom(Kernel::HLERequestContext& ctx) { 164 void BuildRandom(HLERequestContext& ctx) {
165 IPC::RequestParser rp{ctx}; 165 IPC::RequestParser rp{ctx};
166 166
167 const auto age{rp.PopRaw<Age>()}; 167 const auto age{rp.PopRaw<Age>()};
@@ -196,7 +196,7 @@ private:
196 rb.PushRaw<CharInfo>(manager.BuildRandom(age, gender, race)); 196 rb.PushRaw<CharInfo>(manager.BuildRandom(age, gender, race));
197 } 197 }
198 198
199 void BuildDefault(Kernel::HLERequestContext& ctx) { 199 void BuildDefault(HLERequestContext& ctx) {
200 IPC::RequestParser rp{ctx}; 200 IPC::RequestParser rp{ctx};
201 const auto index{rp.Pop<u32>()}; 201 const auto index{rp.Pop<u32>()};
202 202
@@ -215,7 +215,7 @@ private:
215 rb.PushRaw<CharInfo>(manager.BuildDefault(index)); 215 rb.PushRaw<CharInfo>(manager.BuildDefault(index));
216 } 216 }
217 217
218 void GetIndex(Kernel::HLERequestContext& ctx) { 218 void GetIndex(HLERequestContext& ctx) {
219 IPC::RequestParser rp{ctx}; 219 IPC::RequestParser rp{ctx};
220 const auto info{rp.PopRaw<CharInfo>()}; 220 const auto info{rp.PopRaw<CharInfo>()};
221 221
@@ -227,7 +227,7 @@ private:
227 rb.Push(index); 227 rb.Push(index);
228 } 228 }
229 229
230 void SetInterfaceVersion(Kernel::HLERequestContext& ctx) { 230 void SetInterfaceVersion(HLERequestContext& ctx) {
231 IPC::RequestParser rp{ctx}; 231 IPC::RequestParser rp{ctx};
232 current_interface_version = rp.PopRaw<u32>(); 232 current_interface_version = rp.PopRaw<u32>();
233 233
@@ -239,7 +239,7 @@ private:
239 rb.Push(ResultSuccess); 239 rb.Push(ResultSuccess);
240 } 240 }
241 241
242 void Convert(Kernel::HLERequestContext& ctx) { 242 void Convert(HLERequestContext& ctx) {
243 IPC::RequestParser rp{ctx}; 243 IPC::RequestParser rp{ctx};
244 244
245 const auto mii_v3{rp.PopRaw<Ver3StoreData>()}; 245 const auto mii_v3{rp.PopRaw<Ver3StoreData>()};
@@ -275,7 +275,7 @@ public:
275 } 275 }
276 276
277private: 277private:
278 void GetDatabaseService(Kernel::HLERequestContext& ctx) { 278 void GetDatabaseService(HLERequestContext& ctx) {
279 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 279 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
280 rb.Push(ResultSuccess); 280 rb.Push(ResultSuccess);
281 rb.PushIpcInterface<IDatabaseService>(system); 281 rb.PushIpcInterface<IDatabaseService>(system);
diff --git a/src/core/hle/service/mm/mm_u.cpp b/src/core/hle/service/mm/mm_u.cpp
index bee72fa1b..6f43b1968 100644
--- a/src/core/hle/service/mm/mm_u.cpp
+++ b/src/core/hle/service/mm/mm_u.cpp
@@ -2,7 +2,7 @@
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "common/logging/log.h" 4#include "common/logging/log.h"
5#include "core/hle/ipc_helpers.h" 5#include "core/hle/service/ipc_helpers.h"
6#include "core/hle/service/mm/mm_u.h" 6#include "core/hle/service/mm/mm_u.h"
7#include "core/hle/service/server_manager.h" 7#include "core/hle/service/server_manager.h"
8#include "core/hle/service/sm/sm.h" 8#include "core/hle/service/sm/sm.h"
@@ -29,21 +29,21 @@ public:
29 } 29 }
30 30
31private: 31private:
32 void InitializeOld(Kernel::HLERequestContext& ctx) { 32 void InitializeOld(HLERequestContext& ctx) {
33 LOG_WARNING(Service_MM, "(STUBBED) called"); 33 LOG_WARNING(Service_MM, "(STUBBED) called");
34 34
35 IPC::ResponseBuilder rb{ctx, 2}; 35 IPC::ResponseBuilder rb{ctx, 2};
36 rb.Push(ResultSuccess); 36 rb.Push(ResultSuccess);
37 } 37 }
38 38
39 void FinalizeOld(Kernel::HLERequestContext& ctx) { 39 void FinalizeOld(HLERequestContext& ctx) {
40 LOG_WARNING(Service_MM, "(STUBBED) called"); 40 LOG_WARNING(Service_MM, "(STUBBED) called");
41 41
42 IPC::ResponseBuilder rb{ctx, 2}; 42 IPC::ResponseBuilder rb{ctx, 2};
43 rb.Push(ResultSuccess); 43 rb.Push(ResultSuccess);
44 } 44 }
45 45
46 void SetAndWaitOld(Kernel::HLERequestContext& ctx) { 46 void SetAndWaitOld(HLERequestContext& ctx) {
47 IPC::RequestParser rp{ctx}; 47 IPC::RequestParser rp{ctx};
48 min = rp.Pop<u32>(); 48 min = rp.Pop<u32>();
49 max = rp.Pop<u32>(); 49 max = rp.Pop<u32>();
@@ -54,7 +54,7 @@ private:
54 rb.Push(ResultSuccess); 54 rb.Push(ResultSuccess);
55 } 55 }
56 56
57 void GetOld(Kernel::HLERequestContext& ctx) { 57 void GetOld(HLERequestContext& ctx) {
58 LOG_DEBUG(Service_MM, "(STUBBED) called"); 58 LOG_DEBUG(Service_MM, "(STUBBED) called");
59 59
60 IPC::ResponseBuilder rb{ctx, 3}; 60 IPC::ResponseBuilder rb{ctx, 3};
@@ -62,7 +62,7 @@ private:
62 rb.Push(current); 62 rb.Push(current);
63 } 63 }
64 64
65 void Initialize(Kernel::HLERequestContext& ctx) { 65 void Initialize(HLERequestContext& ctx) {
66 LOG_WARNING(Service_MM, "(STUBBED) called"); 66 LOG_WARNING(Service_MM, "(STUBBED) called");
67 67
68 IPC::ResponseBuilder rb{ctx, 3}; 68 IPC::ResponseBuilder rb{ctx, 3};
@@ -70,14 +70,14 @@ private:
70 rb.Push<u32>(id); // Any non zero value 70 rb.Push<u32>(id); // Any non zero value
71 } 71 }
72 72
73 void Finalize(Kernel::HLERequestContext& ctx) { 73 void Finalize(HLERequestContext& ctx) {
74 LOG_WARNING(Service_MM, "(STUBBED) called"); 74 LOG_WARNING(Service_MM, "(STUBBED) called");
75 75
76 IPC::ResponseBuilder rb{ctx, 2}; 76 IPC::ResponseBuilder rb{ctx, 2};
77 rb.Push(ResultSuccess); 77 rb.Push(ResultSuccess);
78 } 78 }
79 79
80 void SetAndWait(Kernel::HLERequestContext& ctx) { 80 void SetAndWait(HLERequestContext& ctx) {
81 IPC::RequestParser rp{ctx}; 81 IPC::RequestParser rp{ctx};
82 u32 input_id = rp.Pop<u32>(); 82 u32 input_id = rp.Pop<u32>();
83 min = rp.Pop<u32>(); 83 min = rp.Pop<u32>();
@@ -90,7 +90,7 @@ private:
90 rb.Push(ResultSuccess); 90 rb.Push(ResultSuccess);
91 } 91 }
92 92
93 void Get(Kernel::HLERequestContext& ctx) { 93 void Get(HLERequestContext& ctx) {
94 LOG_DEBUG(Service_MM, "(STUBBED) called"); 94 LOG_DEBUG(Service_MM, "(STUBBED) called");
95 95
96 IPC::ResponseBuilder rb{ctx, 3}; 96 IPC::ResponseBuilder rb{ctx, 3};
diff --git a/src/core/hle/service/mnpp/mnpp_app.cpp b/src/core/hle/service/mnpp/mnpp_app.cpp
index 4ce4672b7..b11a92056 100644
--- a/src/core/hle/service/mnpp/mnpp_app.cpp
+++ b/src/core/hle/service/mnpp/mnpp_app.cpp
@@ -2,7 +2,7 @@
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "common/logging/log.h" 4#include "common/logging/log.h"
5#include "core/hle/ipc_helpers.h" 5#include "core/hle/service/ipc_helpers.h"
6#include "core/hle/service/mnpp/mnpp_app.h" 6#include "core/hle/service/mnpp/mnpp_app.h"
7#include "core/hle/service/server_manager.h" 7#include "core/hle/service/server_manager.h"
8#include "core/hle/service/service.h" 8#include "core/hle/service/service.h"
@@ -23,14 +23,14 @@ public:
23 } 23 }
24 24
25private: 25private:
26 void Unknown0(Kernel::HLERequestContext& ctx) { 26 void Unknown0(HLERequestContext& ctx) {
27 LOG_WARNING(Service_MNPP, "(STUBBED) called"); 27 LOG_WARNING(Service_MNPP, "(STUBBED) called");
28 28
29 IPC::ResponseBuilder rb{ctx, 2}; 29 IPC::ResponseBuilder rb{ctx, 2};
30 rb.Push(ResultSuccess); 30 rb.Push(ResultSuccess);
31 } 31 }
32 32
33 void Unknown1(Kernel::HLERequestContext& ctx) { 33 void Unknown1(HLERequestContext& ctx) {
34 LOG_WARNING(Service_MNPP, "(STUBBED) called"); 34 LOG_WARNING(Service_MNPP, "(STUBBED) called");
35 35
36 IPC::ResponseBuilder rb{ctx, 2}; 36 IPC::ResponseBuilder rb{ctx, 2};
diff --git a/src/core/hle/service/ncm/ncm.cpp b/src/core/hle/service/ncm/ncm.cpp
index 5ab24dc34..650666d6b 100644
--- a/src/core/hle/service/ncm/ncm.cpp
+++ b/src/core/hle/service/ncm/ncm.cpp
@@ -4,7 +4,7 @@
4#include <memory> 4#include <memory>
5 5
6#include "core/file_sys/romfs_factory.h" 6#include "core/file_sys/romfs_factory.h"
7#include "core/hle/ipc_helpers.h" 7#include "core/hle/service/ipc_helpers.h"
8#include "core/hle/service/ncm/ncm.h" 8#include "core/hle/service/ncm/ncm.h"
9#include "core/hle/service/server_manager.h" 9#include "core/hle/service/server_manager.h"
10#include "core/hle/service/service.h" 10#include "core/hle/service/service.h"
diff --git a/src/core/hle/service/nfc/mifare_user.cpp b/src/core/hle/service/nfc/mifare_user.cpp
index 51523a3ae..e0bbd46e1 100644
--- a/src/core/hle/service/nfc/mifare_user.cpp
+++ b/src/core/hle/service/nfc/mifare_user.cpp
@@ -4,8 +4,8 @@
4#include "common/logging/log.h" 4#include "common/logging/log.h"
5#include "core/core.h" 5#include "core/core.h"
6#include "core/hid/hid_types.h" 6#include "core/hid/hid_types.h"
7#include "core/hle/ipc_helpers.h"
8#include "core/hle/kernel/k_event.h" 7#include "core/hle/kernel/k_event.h"
8#include "core/hle/service/ipc_helpers.h"
9#include "core/hle/service/nfc/mifare_user.h" 9#include "core/hle/service/nfc/mifare_user.h"
10#include "core/hle/service/nfc/nfc_device.h" 10#include "core/hle/service/nfc/nfc_device.h"
11#include "core/hle/service/nfc/nfc_result.h" 11#include "core/hle/service/nfc/nfc_result.h"
@@ -45,7 +45,7 @@ MFIUser ::~MFIUser() {
45 availability_change_event->Close(); 45 availability_change_event->Close();
46} 46}
47 47
48void MFIUser::Initialize(Kernel::HLERequestContext& ctx) { 48void MFIUser::Initialize(HLERequestContext& ctx) {
49 LOG_INFO(Service_NFC, "called"); 49 LOG_INFO(Service_NFC, "called");
50 50
51 state = State::Initialized; 51 state = State::Initialized;
@@ -58,7 +58,7 @@ void MFIUser::Initialize(Kernel::HLERequestContext& ctx) {
58 rb.Push(ResultSuccess); 58 rb.Push(ResultSuccess);
59} 59}
60 60
61void MFIUser::Finalize(Kernel::HLERequestContext& ctx) { 61void MFIUser::Finalize(HLERequestContext& ctx) {
62 LOG_INFO(Service_NFC, "called"); 62 LOG_INFO(Service_NFC, "called");
63 63
64 state = State::NonInitialized; 64 state = State::NonInitialized;
@@ -71,7 +71,7 @@ void MFIUser::Finalize(Kernel::HLERequestContext& ctx) {
71 rb.Push(ResultSuccess); 71 rb.Push(ResultSuccess);
72} 72}
73 73
74void MFIUser::ListDevices(Kernel::HLERequestContext& ctx) { 74void MFIUser::ListDevices(HLERequestContext& ctx) {
75 LOG_DEBUG(Service_NFC, "called"); 75 LOG_DEBUG(Service_NFC, "called");
76 76
77 if (state == State::NonInitialized) { 77 if (state == State::NonInitialized) {
@@ -117,7 +117,7 @@ void MFIUser::ListDevices(Kernel::HLERequestContext& ctx) {
117 rb.Push(static_cast<s32>(nfp_devices.size())); 117 rb.Push(static_cast<s32>(nfp_devices.size()));
118} 118}
119 119
120void MFIUser::StartDetection(Kernel::HLERequestContext& ctx) { 120void MFIUser::StartDetection(HLERequestContext& ctx) {
121 IPC::RequestParser rp{ctx}; 121 IPC::RequestParser rp{ctx};
122 const auto device_handle{rp.Pop<u64>()}; 122 const auto device_handle{rp.Pop<u64>()};
123 LOG_INFO(Service_NFC, "called, device_handle={}", device_handle); 123 LOG_INFO(Service_NFC, "called, device_handle={}", device_handle);
@@ -141,7 +141,7 @@ void MFIUser::StartDetection(Kernel::HLERequestContext& ctx) {
141 rb.Push(result); 141 rb.Push(result);
142} 142}
143 143
144void MFIUser::StopDetection(Kernel::HLERequestContext& ctx) { 144void MFIUser::StopDetection(HLERequestContext& ctx) {
145 IPC::RequestParser rp{ctx}; 145 IPC::RequestParser rp{ctx};
146 const auto device_handle{rp.Pop<u64>()}; 146 const auto device_handle{rp.Pop<u64>()};
147 LOG_INFO(Service_NFC, "called, device_handle={}", device_handle); 147 LOG_INFO(Service_NFC, "called, device_handle={}", device_handle);
@@ -165,7 +165,7 @@ void MFIUser::StopDetection(Kernel::HLERequestContext& ctx) {
165 rb.Push(result); 165 rb.Push(result);
166} 166}
167 167
168void MFIUser::Read(Kernel::HLERequestContext& ctx) { 168void MFIUser::Read(HLERequestContext& ctx) {
169 IPC::RequestParser rp{ctx}; 169 IPC::RequestParser rp{ctx};
170 const auto device_handle{rp.Pop<u64>()}; 170 const auto device_handle{rp.Pop<u64>()};
171 const auto buffer{ctx.ReadBuffer()}; 171 const auto buffer{ctx.ReadBuffer()};
@@ -206,7 +206,7 @@ void MFIUser::Read(Kernel::HLERequestContext& ctx) {
206 rb.Push(result); 206 rb.Push(result);
207} 207}
208 208
209void MFIUser::Write(Kernel::HLERequestContext& ctx) { 209void MFIUser::Write(HLERequestContext& ctx) {
210 IPC::RequestParser rp{ctx}; 210 IPC::RequestParser rp{ctx};
211 const auto device_handle{rp.Pop<u64>()}; 211 const auto device_handle{rp.Pop<u64>()};
212 const auto buffer{ctx.ReadBuffer()}; 212 const auto buffer{ctx.ReadBuffer()};
@@ -250,7 +250,7 @@ void MFIUser::Write(Kernel::HLERequestContext& ctx) {
250 rb.Push(result); 250 rb.Push(result);
251} 251}
252 252
253void MFIUser::GetTagInfo(Kernel::HLERequestContext& ctx) { 253void MFIUser::GetTagInfo(HLERequestContext& ctx) {
254 IPC::RequestParser rp{ctx}; 254 IPC::RequestParser rp{ctx};
255 const auto device_handle{rp.Pop<u64>()}; 255 const auto device_handle{rp.Pop<u64>()};
256 LOG_INFO(Service_NFC, "called, device_handle={}", device_handle); 256 LOG_INFO(Service_NFC, "called, device_handle={}", device_handle);
@@ -276,7 +276,7 @@ void MFIUser::GetTagInfo(Kernel::HLERequestContext& ctx) {
276 rb.Push(result); 276 rb.Push(result);
277} 277}
278 278
279void MFIUser::GetActivateEventHandle(Kernel::HLERequestContext& ctx) { 279void MFIUser::GetActivateEventHandle(HLERequestContext& ctx) {
280 IPC::RequestParser rp{ctx}; 280 IPC::RequestParser rp{ctx};
281 const auto device_handle{rp.Pop<u64>()}; 281 const auto device_handle{rp.Pop<u64>()};
282 LOG_DEBUG(Service_NFC, "called, device_handle={}", device_handle); 282 LOG_DEBUG(Service_NFC, "called, device_handle={}", device_handle);
@@ -300,7 +300,7 @@ void MFIUser::GetActivateEventHandle(Kernel::HLERequestContext& ctx) {
300 rb.PushCopyObjects(device.value()->GetActivateEvent()); 300 rb.PushCopyObjects(device.value()->GetActivateEvent());
301} 301}
302 302
303void MFIUser::GetDeactivateEventHandle(Kernel::HLERequestContext& ctx) { 303void MFIUser::GetDeactivateEventHandle(HLERequestContext& ctx) {
304 IPC::RequestParser rp{ctx}; 304 IPC::RequestParser rp{ctx};
305 const auto device_handle{rp.Pop<u64>()}; 305 const auto device_handle{rp.Pop<u64>()};
306 LOG_DEBUG(Service_NFC, "called, device_handle={}", device_handle); 306 LOG_DEBUG(Service_NFC, "called, device_handle={}", device_handle);
@@ -324,7 +324,7 @@ void MFIUser::GetDeactivateEventHandle(Kernel::HLERequestContext& ctx) {
324 rb.PushCopyObjects(device.value()->GetDeactivateEvent()); 324 rb.PushCopyObjects(device.value()->GetDeactivateEvent());
325} 325}
326 326
327void MFIUser::GetState(Kernel::HLERequestContext& ctx) { 327void MFIUser::GetState(HLERequestContext& ctx) {
328 LOG_DEBUG(Service_NFC, "called"); 328 LOG_DEBUG(Service_NFC, "called");
329 329
330 IPC::ResponseBuilder rb{ctx, 3}; 330 IPC::ResponseBuilder rb{ctx, 3};
@@ -332,7 +332,7 @@ void MFIUser::GetState(Kernel::HLERequestContext& ctx) {
332 rb.PushEnum(state); 332 rb.PushEnum(state);
333} 333}
334 334
335void MFIUser::GetDeviceState(Kernel::HLERequestContext& ctx) { 335void MFIUser::GetDeviceState(HLERequestContext& ctx) {
336 IPC::RequestParser rp{ctx}; 336 IPC::RequestParser rp{ctx};
337 const auto device_handle{rp.Pop<u64>()}; 337 const auto device_handle{rp.Pop<u64>()};
338 LOG_DEBUG(Service_NFC, "called, device_handle={}", device_handle); 338 LOG_DEBUG(Service_NFC, "called, device_handle={}", device_handle);
@@ -350,7 +350,7 @@ void MFIUser::GetDeviceState(Kernel::HLERequestContext& ctx) {
350 rb.PushEnum(device.value()->GetCurrentState()); 350 rb.PushEnum(device.value()->GetCurrentState());
351} 351}
352 352
353void MFIUser::GetNpadId(Kernel::HLERequestContext& ctx) { 353void MFIUser::GetNpadId(HLERequestContext& ctx) {
354 IPC::RequestParser rp{ctx}; 354 IPC::RequestParser rp{ctx};
355 const auto device_handle{rp.Pop<u64>()}; 355 const auto device_handle{rp.Pop<u64>()};
356 LOG_DEBUG(Service_NFC, "called, device_handle={}", device_handle); 356 LOG_DEBUG(Service_NFC, "called, device_handle={}", device_handle);
@@ -374,7 +374,7 @@ void MFIUser::GetNpadId(Kernel::HLERequestContext& ctx) {
374 rb.PushEnum(device.value()->GetNpadId()); 374 rb.PushEnum(device.value()->GetNpadId());
375} 375}
376 376
377void MFIUser::GetAvailabilityChangeEventHandle(Kernel::HLERequestContext& ctx) { 377void MFIUser::GetAvailabilityChangeEventHandle(HLERequestContext& ctx) {
378 LOG_INFO(Service_NFC, "called"); 378 LOG_INFO(Service_NFC, "called");
379 379
380 if (state == State::NonInitialized) { 380 if (state == State::NonInitialized) {
diff --git a/src/core/hle/service/nfc/mifare_user.h b/src/core/hle/service/nfc/mifare_user.h
index 0e0638cb6..9701f1d7f 100644
--- a/src/core/hle/service/nfc/mifare_user.h
+++ b/src/core/hle/service/nfc/mifare_user.h
@@ -24,20 +24,20 @@ private:
24 Initialized, 24 Initialized,
25 }; 25 };
26 26
27 void Initialize(Kernel::HLERequestContext& ctx); 27 void Initialize(HLERequestContext& ctx);
28 void Finalize(Kernel::HLERequestContext& ctx); 28 void Finalize(HLERequestContext& ctx);
29 void ListDevices(Kernel::HLERequestContext& ctx); 29 void ListDevices(HLERequestContext& ctx);
30 void StartDetection(Kernel::HLERequestContext& ctx); 30 void StartDetection(HLERequestContext& ctx);
31 void StopDetection(Kernel::HLERequestContext& ctx); 31 void StopDetection(HLERequestContext& ctx);
32 void Read(Kernel::HLERequestContext& ctx); 32 void Read(HLERequestContext& ctx);
33 void Write(Kernel::HLERequestContext& ctx); 33 void Write(HLERequestContext& ctx);
34 void GetTagInfo(Kernel::HLERequestContext& ctx); 34 void GetTagInfo(HLERequestContext& ctx);
35 void GetActivateEventHandle(Kernel::HLERequestContext& ctx); 35 void GetActivateEventHandle(HLERequestContext& ctx);
36 void GetDeactivateEventHandle(Kernel::HLERequestContext& ctx); 36 void GetDeactivateEventHandle(HLERequestContext& ctx);
37 void GetState(Kernel::HLERequestContext& ctx); 37 void GetState(HLERequestContext& ctx);
38 void GetDeviceState(Kernel::HLERequestContext& ctx); 38 void GetDeviceState(HLERequestContext& ctx);
39 void GetNpadId(Kernel::HLERequestContext& ctx); 39 void GetNpadId(HLERequestContext& ctx);
40 void GetAvailabilityChangeEventHandle(Kernel::HLERequestContext& ctx); 40 void GetAvailabilityChangeEventHandle(HLERequestContext& ctx);
41 41
42 std::optional<std::shared_ptr<NfcDevice>> GetNfcDevice(u64 handle); 42 std::optional<std::shared_ptr<NfcDevice>> GetNfcDevice(u64 handle);
43 43
diff --git a/src/core/hle/service/nfc/nfc.cpp b/src/core/hle/service/nfc/nfc.cpp
index 34612b9df..6595e34ed 100644
--- a/src/core/hle/service/nfc/nfc.cpp
+++ b/src/core/hle/service/nfc/nfc.cpp
@@ -5,7 +5,7 @@
5 5
6#include "common/logging/log.h" 6#include "common/logging/log.h"
7#include "common/settings.h" 7#include "common/settings.h"
8#include "core/hle/ipc_helpers.h" 8#include "core/hle/service/ipc_helpers.h"
9#include "core/hle/service/nfc/mifare_user.h" 9#include "core/hle/service/nfc/mifare_user.h"
10#include "core/hle/service/nfc/nfc.h" 10#include "core/hle/service/nfc/nfc.h"
11#include "core/hle/service/nfc/nfc_user.h" 11#include "core/hle/service/nfc/nfc_user.h"
@@ -42,7 +42,7 @@ public:
42 } 42 }
43 43
44private: 44private:
45 void CreateAmInterface(Kernel::HLERequestContext& ctx) { 45 void CreateAmInterface(HLERequestContext& ctx) {
46 LOG_DEBUG(Service_NFC, "called"); 46 LOG_DEBUG(Service_NFC, "called");
47 47
48 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 48 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -64,7 +64,7 @@ public:
64 } 64 }
65 65
66private: 66private:
67 void CreateUserInterface(Kernel::HLERequestContext& ctx) { 67 void CreateUserInterface(HLERequestContext& ctx) {
68 LOG_DEBUG(Service_NFC, "called"); 68 LOG_DEBUG(Service_NFC, "called");
69 69
70 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 70 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -86,7 +86,7 @@ public:
86 } 86 }
87 87
88private: 88private:
89 void CreateUserInterface(Kernel::HLERequestContext& ctx) { 89 void CreateUserInterface(HLERequestContext& ctx) {
90 LOG_DEBUG(Service_NFC, "called"); 90 LOG_DEBUG(Service_NFC, "called");
91 91
92 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 92 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -145,7 +145,7 @@ public:
145 } 145 }
146 146
147private: 147private:
148 void CreateSystemInterface(Kernel::HLERequestContext& ctx) { 148 void CreateSystemInterface(HLERequestContext& ctx) {
149 LOG_DEBUG(Service_NFC, "called"); 149 LOG_DEBUG(Service_NFC, "called");
150 150
151 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 151 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
diff --git a/src/core/hle/service/nfc/nfc_device.cpp b/src/core/hle/service/nfc/nfc_device.cpp
index 9a3234e8c..3f17d0c7a 100644
--- a/src/core/hle/service/nfc/nfc_device.cpp
+++ b/src/core/hle/service/nfc/nfc_device.cpp
@@ -7,8 +7,8 @@
7#include "core/hid/emulated_controller.h" 7#include "core/hid/emulated_controller.h"
8#include "core/hid/hid_core.h" 8#include "core/hid/hid_core.h"
9#include "core/hid/hid_types.h" 9#include "core/hid/hid_types.h"
10#include "core/hle/ipc_helpers.h"
11#include "core/hle/kernel/k_event.h" 10#include "core/hle/kernel/k_event.h"
11#include "core/hle/service/ipc_helpers.h"
12#include "core/hle/service/nfc/nfc_device.h" 12#include "core/hle/service/nfc/nfc_device.h"
13#include "core/hle/service/nfc/nfc_result.h" 13#include "core/hle/service/nfc/nfc_result.h"
14#include "core/hle/service/nfc/nfc_user.h" 14#include "core/hle/service/nfc/nfc_user.h"
diff --git a/src/core/hle/service/nfc/nfc_user.cpp b/src/core/hle/service/nfc/nfc_user.cpp
index 89aa6b3f5..7c162a4f3 100644
--- a/src/core/hle/service/nfc/nfc_user.cpp
+++ b/src/core/hle/service/nfc/nfc_user.cpp
@@ -4,8 +4,8 @@
4#include "common/logging/log.h" 4#include "common/logging/log.h"
5#include "core/core.h" 5#include "core/core.h"
6#include "core/hid/hid_types.h" 6#include "core/hid/hid_types.h"
7#include "core/hle/ipc_helpers.h"
8#include "core/hle/kernel/k_event.h" 7#include "core/hle/kernel/k_event.h"
8#include "core/hle/service/ipc_helpers.h"
9#include "core/hle/service/nfc/nfc_device.h" 9#include "core/hle/service/nfc/nfc_device.h"
10#include "core/hle/service/nfc/nfc_result.h" 10#include "core/hle/service/nfc/nfc_result.h"
11#include "core/hle/service/nfc/nfc_user.h" 11#include "core/hle/service/nfc/nfc_user.h"
@@ -54,7 +54,7 @@ IUser ::~IUser() {
54 availability_change_event->Close(); 54 availability_change_event->Close();
55} 55}
56 56
57void IUser::Initialize(Kernel::HLERequestContext& ctx) { 57void IUser::Initialize(HLERequestContext& ctx) {
58 LOG_INFO(Service_NFC, "called"); 58 LOG_INFO(Service_NFC, "called");
59 59
60 state = State::Initialized; 60 state = State::Initialized;
@@ -67,7 +67,7 @@ void IUser::Initialize(Kernel::HLERequestContext& ctx) {
67 rb.Push(ResultSuccess); 67 rb.Push(ResultSuccess);
68} 68}
69 69
70void IUser::Finalize(Kernel::HLERequestContext& ctx) { 70void IUser::Finalize(HLERequestContext& ctx) {
71 LOG_INFO(Service_NFC, "called"); 71 LOG_INFO(Service_NFC, "called");
72 72
73 state = State::NonInitialized; 73 state = State::NonInitialized;
@@ -80,7 +80,7 @@ void IUser::Finalize(Kernel::HLERequestContext& ctx) {
80 rb.Push(ResultSuccess); 80 rb.Push(ResultSuccess);
81} 81}
82 82
83void IUser::GetState(Kernel::HLERequestContext& ctx) { 83void IUser::GetState(HLERequestContext& ctx) {
84 LOG_DEBUG(Service_NFC, "called"); 84 LOG_DEBUG(Service_NFC, "called");
85 85
86 IPC::ResponseBuilder rb{ctx, 3}; 86 IPC::ResponseBuilder rb{ctx, 3};
@@ -88,7 +88,7 @@ void IUser::GetState(Kernel::HLERequestContext& ctx) {
88 rb.PushEnum(state); 88 rb.PushEnum(state);
89} 89}
90 90
91void IUser::IsNfcEnabled(Kernel::HLERequestContext& ctx) { 91void IUser::IsNfcEnabled(HLERequestContext& ctx) {
92 LOG_DEBUG(Service_NFC, "called"); 92 LOG_DEBUG(Service_NFC, "called");
93 93
94 IPC::ResponseBuilder rb{ctx, 3}; 94 IPC::ResponseBuilder rb{ctx, 3};
@@ -96,7 +96,7 @@ void IUser::IsNfcEnabled(Kernel::HLERequestContext& ctx) {
96 rb.Push(state != State::NonInitialized); 96 rb.Push(state != State::NonInitialized);
97} 97}
98 98
99void IUser::ListDevices(Kernel::HLERequestContext& ctx) { 99void IUser::ListDevices(HLERequestContext& ctx) {
100 LOG_DEBUG(Service_NFC, "called"); 100 LOG_DEBUG(Service_NFC, "called");
101 101
102 if (state == State::NonInitialized) { 102 if (state == State::NonInitialized) {
@@ -142,7 +142,7 @@ void IUser::ListDevices(Kernel::HLERequestContext& ctx) {
142 rb.Push(static_cast<s32>(nfp_devices.size())); 142 rb.Push(static_cast<s32>(nfp_devices.size()));
143} 143}
144 144
145void IUser::GetDeviceState(Kernel::HLERequestContext& ctx) { 145void IUser::GetDeviceState(HLERequestContext& ctx) {
146 IPC::RequestParser rp{ctx}; 146 IPC::RequestParser rp{ctx};
147 const auto device_handle{rp.Pop<u64>()}; 147 const auto device_handle{rp.Pop<u64>()};
148 LOG_DEBUG(Service_NFC, "called, device_handle={}", device_handle); 148 LOG_DEBUG(Service_NFC, "called, device_handle={}", device_handle);
@@ -160,7 +160,7 @@ void IUser::GetDeviceState(Kernel::HLERequestContext& ctx) {
160 rb.PushEnum(device.value()->GetCurrentState()); 160 rb.PushEnum(device.value()->GetCurrentState());
161} 161}
162 162
163void IUser::GetNpadId(Kernel::HLERequestContext& ctx) { 163void IUser::GetNpadId(HLERequestContext& ctx) {
164 IPC::RequestParser rp{ctx}; 164 IPC::RequestParser rp{ctx};
165 const auto device_handle{rp.Pop<u64>()}; 165 const auto device_handle{rp.Pop<u64>()};
166 LOG_DEBUG(Service_NFC, "called, device_handle={}", device_handle); 166 LOG_DEBUG(Service_NFC, "called, device_handle={}", device_handle);
@@ -184,7 +184,7 @@ void IUser::GetNpadId(Kernel::HLERequestContext& ctx) {
184 rb.PushEnum(device.value()->GetNpadId()); 184 rb.PushEnum(device.value()->GetNpadId());
185} 185}
186 186
187void IUser::AttachAvailabilityChangeEvent(Kernel::HLERequestContext& ctx) { 187void IUser::AttachAvailabilityChangeEvent(HLERequestContext& ctx) {
188 LOG_INFO(Service_NFC, "called"); 188 LOG_INFO(Service_NFC, "called");
189 189
190 if (state == State::NonInitialized) { 190 if (state == State::NonInitialized) {
@@ -198,7 +198,7 @@ void IUser::AttachAvailabilityChangeEvent(Kernel::HLERequestContext& ctx) {
198 rb.PushCopyObjects(availability_change_event->GetReadableEvent()); 198 rb.PushCopyObjects(availability_change_event->GetReadableEvent());
199} 199}
200 200
201void IUser::StartDetection(Kernel::HLERequestContext& ctx) { 201void IUser::StartDetection(HLERequestContext& ctx) {
202 IPC::RequestParser rp{ctx}; 202 IPC::RequestParser rp{ctx};
203 const auto device_handle{rp.Pop<u64>()}; 203 const auto device_handle{rp.Pop<u64>()};
204 const auto nfp_protocol{rp.PopEnum<NFP::TagProtocol>()}; 204 const auto nfp_protocol{rp.PopEnum<NFP::TagProtocol>()};
@@ -223,7 +223,7 @@ void IUser::StartDetection(Kernel::HLERequestContext& ctx) {
223 rb.Push(result); 223 rb.Push(result);
224} 224}
225 225
226void IUser::StopDetection(Kernel::HLERequestContext& ctx) { 226void IUser::StopDetection(HLERequestContext& ctx) {
227 IPC::RequestParser rp{ctx}; 227 IPC::RequestParser rp{ctx};
228 const auto device_handle{rp.Pop<u64>()}; 228 const auto device_handle{rp.Pop<u64>()};
229 LOG_INFO(Service_NFC, "called, device_handle={}", device_handle); 229 LOG_INFO(Service_NFC, "called, device_handle={}", device_handle);
@@ -247,7 +247,7 @@ void IUser::StopDetection(Kernel::HLERequestContext& ctx) {
247 rb.Push(result); 247 rb.Push(result);
248} 248}
249 249
250void IUser::GetTagInfo(Kernel::HLERequestContext& ctx) { 250void IUser::GetTagInfo(HLERequestContext& ctx) {
251 IPC::RequestParser rp{ctx}; 251 IPC::RequestParser rp{ctx};
252 const auto device_handle{rp.Pop<u64>()}; 252 const auto device_handle{rp.Pop<u64>()};
253 LOG_INFO(Service_NFC, "called, device_handle={}", device_handle); 253 LOG_INFO(Service_NFC, "called, device_handle={}", device_handle);
@@ -273,7 +273,7 @@ void IUser::GetTagInfo(Kernel::HLERequestContext& ctx) {
273 rb.Push(result); 273 rb.Push(result);
274} 274}
275 275
276void IUser::AttachActivateEvent(Kernel::HLERequestContext& ctx) { 276void IUser::AttachActivateEvent(HLERequestContext& ctx) {
277 IPC::RequestParser rp{ctx}; 277 IPC::RequestParser rp{ctx};
278 const auto device_handle{rp.Pop<u64>()}; 278 const auto device_handle{rp.Pop<u64>()};
279 LOG_DEBUG(Service_NFC, "called, device_handle={}", device_handle); 279 LOG_DEBUG(Service_NFC, "called, device_handle={}", device_handle);
@@ -297,7 +297,7 @@ void IUser::AttachActivateEvent(Kernel::HLERequestContext& ctx) {
297 rb.PushCopyObjects(device.value()->GetActivateEvent()); 297 rb.PushCopyObjects(device.value()->GetActivateEvent());
298} 298}
299 299
300void IUser::AttachDeactivateEvent(Kernel::HLERequestContext& ctx) { 300void IUser::AttachDeactivateEvent(HLERequestContext& ctx) {
301 IPC::RequestParser rp{ctx}; 301 IPC::RequestParser rp{ctx};
302 const auto device_handle{rp.Pop<u64>()}; 302 const auto device_handle{rp.Pop<u64>()};
303 LOG_DEBUG(Service_NFC, "called, device_handle={}", device_handle); 303 LOG_DEBUG(Service_NFC, "called, device_handle={}", device_handle);
@@ -321,7 +321,7 @@ void IUser::AttachDeactivateEvent(Kernel::HLERequestContext& ctx) {
321 rb.PushCopyObjects(device.value()->GetDeactivateEvent()); 321 rb.PushCopyObjects(device.value()->GetDeactivateEvent());
322} 322}
323 323
324void IUser::SendCommandByPassThrough(Kernel::HLERequestContext& ctx) { 324void IUser::SendCommandByPassThrough(HLERequestContext& ctx) {
325 IPC::RequestParser rp{ctx}; 325 IPC::RequestParser rp{ctx};
326 const auto device_handle{rp.Pop<u64>()}; 326 const auto device_handle{rp.Pop<u64>()};
327 const auto timeout{rp.PopRaw<Time::Clock::TimeSpanType>()}; 327 const auto timeout{rp.PopRaw<Time::Clock::TimeSpanType>()};
diff --git a/src/core/hle/service/nfc/nfc_user.h b/src/core/hle/service/nfc/nfc_user.h
index a5a4f12f9..aee046ae8 100644
--- a/src/core/hle/service/nfc/nfc_user.h
+++ b/src/core/hle/service/nfc/nfc_user.h
@@ -24,20 +24,20 @@ private:
24 Initialized, 24 Initialized,
25 }; 25 };
26 26
27 void Initialize(Kernel::HLERequestContext& ctx); 27 void Initialize(HLERequestContext& ctx);
28 void Finalize(Kernel::HLERequestContext& ctx); 28 void Finalize(HLERequestContext& ctx);
29 void GetState(Kernel::HLERequestContext& ctx); 29 void GetState(HLERequestContext& ctx);
30 void IsNfcEnabled(Kernel::HLERequestContext& ctx); 30 void IsNfcEnabled(HLERequestContext& ctx);
31 void ListDevices(Kernel::HLERequestContext& ctx); 31 void ListDevices(HLERequestContext& ctx);
32 void GetDeviceState(Kernel::HLERequestContext& ctx); 32 void GetDeviceState(HLERequestContext& ctx);
33 void GetNpadId(Kernel::HLERequestContext& ctx); 33 void GetNpadId(HLERequestContext& ctx);
34 void AttachAvailabilityChangeEvent(Kernel::HLERequestContext& ctx); 34 void AttachAvailabilityChangeEvent(HLERequestContext& ctx);
35 void StartDetection(Kernel::HLERequestContext& ctx); 35 void StartDetection(HLERequestContext& ctx);
36 void StopDetection(Kernel::HLERequestContext& ctx); 36 void StopDetection(HLERequestContext& ctx);
37 void GetTagInfo(Kernel::HLERequestContext& ctx); 37 void GetTagInfo(HLERequestContext& ctx);
38 void AttachActivateEvent(Kernel::HLERequestContext& ctx); 38 void AttachActivateEvent(HLERequestContext& ctx);
39 void AttachDeactivateEvent(Kernel::HLERequestContext& ctx); 39 void AttachDeactivateEvent(HLERequestContext& ctx);
40 void SendCommandByPassThrough(Kernel::HLERequestContext& ctx); 40 void SendCommandByPassThrough(HLERequestContext& ctx);
41 41
42 std::optional<std::shared_ptr<NfcDevice>> GetNfcDevice(u64 handle); 42 std::optional<std::shared_ptr<NfcDevice>> GetNfcDevice(u64 handle);
43 43
diff --git a/src/core/hle/service/nfp/nfp.cpp b/src/core/hle/service/nfp/nfp.cpp
index 1b59aba8e..e262dc2f2 100644
--- a/src/core/hle/service/nfp/nfp.cpp
+++ b/src/core/hle/service/nfp/nfp.cpp
@@ -2,7 +2,7 @@
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "common/logging/log.h" 4#include "common/logging/log.h"
5#include "core/hle/ipc_helpers.h" 5#include "core/hle/service/ipc_helpers.h"
6#include "core/hle/service/nfp/nfp.h" 6#include "core/hle/service/nfp/nfp.h"
7#include "core/hle/service/nfp/nfp_user.h" 7#include "core/hle/service/nfp/nfp_user.h"
8#include "core/hle/service/server_manager.h" 8#include "core/hle/service/server_manager.h"
@@ -22,7 +22,7 @@ public:
22 } 22 }
23 23
24private: 24private:
25 void CreateUserInterface(Kernel::HLERequestContext& ctx) { 25 void CreateUserInterface(HLERequestContext& ctx) {
26 LOG_DEBUG(Service_NFP, "called"); 26 LOG_DEBUG(Service_NFP, "called");
27 27
28 if (user_interface == nullptr) { 28 if (user_interface == nullptr) {
diff --git a/src/core/hle/service/nfp/nfp_device.cpp b/src/core/hle/service/nfp/nfp_device.cpp
index 7a6bbbba7..1bdc42741 100644
--- a/src/core/hle/service/nfp/nfp_device.cpp
+++ b/src/core/hle/service/nfp/nfp_device.cpp
@@ -11,8 +11,8 @@
11#include "core/hid/emulated_controller.h" 11#include "core/hid/emulated_controller.h"
12#include "core/hid/hid_core.h" 12#include "core/hid/hid_core.h"
13#include "core/hid/hid_types.h" 13#include "core/hid/hid_types.h"
14#include "core/hle/ipc_helpers.h"
15#include "core/hle/kernel/k_event.h" 14#include "core/hle/kernel/k_event.h"
15#include "core/hle/service/ipc_helpers.h"
16#include "core/hle/service/mii/mii_manager.h" 16#include "core/hle/service/mii/mii_manager.h"
17#include "core/hle/service/mii/types.h" 17#include "core/hle/service/mii/types.h"
18#include "core/hle/service/nfp/amiibo_crypto.h" 18#include "core/hle/service/nfp/amiibo_crypto.h"
diff --git a/src/core/hle/service/nfp/nfp_user.cpp b/src/core/hle/service/nfp/nfp_user.cpp
index a4d3d1bc7..4e8534113 100644
--- a/src/core/hle/service/nfp/nfp_user.cpp
+++ b/src/core/hle/service/nfp/nfp_user.cpp
@@ -4,8 +4,8 @@
4#include "common/logging/log.h" 4#include "common/logging/log.h"
5#include "core/core.h" 5#include "core/core.h"
6#include "core/hid/hid_types.h" 6#include "core/hid/hid_types.h"
7#include "core/hle/ipc_helpers.h"
8#include "core/hle/kernel/k_event.h" 7#include "core/hle/kernel/k_event.h"
8#include "core/hle/service/ipc_helpers.h"
9#include "core/hle/service/nfp/nfp_device.h" 9#include "core/hle/service/nfp/nfp_device.h"
10#include "core/hle/service/nfp/nfp_result.h" 10#include "core/hle/service/nfp/nfp_result.h"
11#include "core/hle/service/nfp/nfp_user.h" 11#include "core/hle/service/nfp/nfp_user.h"
@@ -56,7 +56,7 @@ IUser ::~IUser() {
56 availability_change_event->Close(); 56 availability_change_event->Close();
57} 57}
58 58
59void IUser::Initialize(Kernel::HLERequestContext& ctx) { 59void IUser::Initialize(HLERequestContext& ctx) {
60 LOG_INFO(Service_NFP, "called"); 60 LOG_INFO(Service_NFP, "called");
61 61
62 state = State::Initialized; 62 state = State::Initialized;
@@ -69,7 +69,7 @@ void IUser::Initialize(Kernel::HLERequestContext& ctx) {
69 rb.Push(ResultSuccess); 69 rb.Push(ResultSuccess);
70} 70}
71 71
72void IUser::Finalize(Kernel::HLERequestContext& ctx) { 72void IUser::Finalize(HLERequestContext& ctx) {
73 LOG_INFO(Service_NFP, "called"); 73 LOG_INFO(Service_NFP, "called");
74 74
75 state = State::NonInitialized; 75 state = State::NonInitialized;
@@ -82,7 +82,7 @@ void IUser::Finalize(Kernel::HLERequestContext& ctx) {
82 rb.Push(ResultSuccess); 82 rb.Push(ResultSuccess);
83} 83}
84 84
85void IUser::ListDevices(Kernel::HLERequestContext& ctx) { 85void IUser::ListDevices(HLERequestContext& ctx) {
86 LOG_DEBUG(Service_NFP, "called"); 86 LOG_DEBUG(Service_NFP, "called");
87 87
88 if (state == State::NonInitialized) { 88 if (state == State::NonInitialized) {
@@ -128,7 +128,7 @@ void IUser::ListDevices(Kernel::HLERequestContext& ctx) {
128 rb.Push(static_cast<s32>(nfp_devices.size())); 128 rb.Push(static_cast<s32>(nfp_devices.size()));
129} 129}
130 130
131void IUser::StartDetection(Kernel::HLERequestContext& ctx) { 131void IUser::StartDetection(HLERequestContext& ctx) {
132 IPC::RequestParser rp{ctx}; 132 IPC::RequestParser rp{ctx};
133 const auto device_handle{rp.Pop<u64>()}; 133 const auto device_handle{rp.Pop<u64>()};
134 const auto nfp_protocol{rp.PopEnum<TagProtocol>()}; 134 const auto nfp_protocol{rp.PopEnum<TagProtocol>()};
@@ -153,7 +153,7 @@ void IUser::StartDetection(Kernel::HLERequestContext& ctx) {
153 rb.Push(result); 153 rb.Push(result);
154} 154}
155 155
156void IUser::StopDetection(Kernel::HLERequestContext& ctx) { 156void IUser::StopDetection(HLERequestContext& ctx) {
157 IPC::RequestParser rp{ctx}; 157 IPC::RequestParser rp{ctx};
158 const auto device_handle{rp.Pop<u64>()}; 158 const auto device_handle{rp.Pop<u64>()};
159 LOG_INFO(Service_NFP, "called, device_handle={}", device_handle); 159 LOG_INFO(Service_NFP, "called, device_handle={}", device_handle);
@@ -177,7 +177,7 @@ void IUser::StopDetection(Kernel::HLERequestContext& ctx) {
177 rb.Push(result); 177 rb.Push(result);
178} 178}
179 179
180void IUser::Mount(Kernel::HLERequestContext& ctx) { 180void IUser::Mount(HLERequestContext& ctx) {
181 IPC::RequestParser rp{ctx}; 181 IPC::RequestParser rp{ctx};
182 const auto device_handle{rp.Pop<u64>()}; 182 const auto device_handle{rp.Pop<u64>()};
183 const auto model_type{rp.PopEnum<ModelType>()}; 183 const auto model_type{rp.PopEnum<ModelType>()};
@@ -204,7 +204,7 @@ void IUser::Mount(Kernel::HLERequestContext& ctx) {
204 rb.Push(result); 204 rb.Push(result);
205} 205}
206 206
207void IUser::Unmount(Kernel::HLERequestContext& ctx) { 207void IUser::Unmount(HLERequestContext& ctx) {
208 IPC::RequestParser rp{ctx}; 208 IPC::RequestParser rp{ctx};
209 const auto device_handle{rp.Pop<u64>()}; 209 const auto device_handle{rp.Pop<u64>()};
210 LOG_INFO(Service_NFP, "called, device_handle={}", device_handle); 210 LOG_INFO(Service_NFP, "called, device_handle={}", device_handle);
@@ -228,7 +228,7 @@ void IUser::Unmount(Kernel::HLERequestContext& ctx) {
228 rb.Push(result); 228 rb.Push(result);
229} 229}
230 230
231void IUser::OpenApplicationArea(Kernel::HLERequestContext& ctx) { 231void IUser::OpenApplicationArea(HLERequestContext& ctx) {
232 IPC::RequestParser rp{ctx}; 232 IPC::RequestParser rp{ctx};
233 const auto device_handle{rp.Pop<u64>()}; 233 const auto device_handle{rp.Pop<u64>()};
234 const auto access_id{rp.Pop<u32>()}; 234 const auto access_id{rp.Pop<u32>()};
@@ -253,7 +253,7 @@ void IUser::OpenApplicationArea(Kernel::HLERequestContext& ctx) {
253 rb.Push(result); 253 rb.Push(result);
254} 254}
255 255
256void IUser::GetApplicationArea(Kernel::HLERequestContext& ctx) { 256void IUser::GetApplicationArea(HLERequestContext& ctx) {
257 IPC::RequestParser rp{ctx}; 257 IPC::RequestParser rp{ctx};
258 const auto device_handle{rp.Pop<u64>()}; 258 const auto device_handle{rp.Pop<u64>()};
259 const auto data_size = ctx.GetWriteBufferSize(); 259 const auto data_size = ctx.GetWriteBufferSize();
@@ -287,7 +287,7 @@ void IUser::GetApplicationArea(Kernel::HLERequestContext& ctx) {
287 rb.Push(static_cast<u32>(data_size)); 287 rb.Push(static_cast<u32>(data_size));
288} 288}
289 289
290void IUser::SetApplicationArea(Kernel::HLERequestContext& ctx) { 290void IUser::SetApplicationArea(HLERequestContext& ctx) {
291 IPC::RequestParser rp{ctx}; 291 IPC::RequestParser rp{ctx};
292 const auto device_handle{rp.Pop<u64>()}; 292 const auto device_handle{rp.Pop<u64>()};
293 const auto data{ctx.ReadBuffer()}; 293 const auto data{ctx.ReadBuffer()};
@@ -318,7 +318,7 @@ void IUser::SetApplicationArea(Kernel::HLERequestContext& ctx) {
318 rb.Push(result); 318 rb.Push(result);
319} 319}
320 320
321void IUser::Flush(Kernel::HLERequestContext& ctx) { 321void IUser::Flush(HLERequestContext& ctx) {
322 IPC::RequestParser rp{ctx}; 322 IPC::RequestParser rp{ctx};
323 const auto device_handle{rp.Pop<u64>()}; 323 const auto device_handle{rp.Pop<u64>()};
324 LOG_INFO(Service_NFP, "called, device_handle={}", device_handle); 324 LOG_INFO(Service_NFP, "called, device_handle={}", device_handle);
@@ -342,7 +342,7 @@ void IUser::Flush(Kernel::HLERequestContext& ctx) {
342 rb.Push(result); 342 rb.Push(result);
343} 343}
344 344
345void IUser::Restore(Kernel::HLERequestContext& ctx) { 345void IUser::Restore(HLERequestContext& ctx) {
346 IPC::RequestParser rp{ctx}; 346 IPC::RequestParser rp{ctx};
347 const auto device_handle{rp.Pop<u64>()}; 347 const auto device_handle{rp.Pop<u64>()};
348 LOG_WARNING(Service_NFP, "(STUBBED) called, device_handle={}", device_handle); 348 LOG_WARNING(Service_NFP, "(STUBBED) called, device_handle={}", device_handle);
@@ -366,7 +366,7 @@ void IUser::Restore(Kernel::HLERequestContext& ctx) {
366 rb.Push(result); 366 rb.Push(result);
367} 367}
368 368
369void IUser::CreateApplicationArea(Kernel::HLERequestContext& ctx) { 369void IUser::CreateApplicationArea(HLERequestContext& ctx) {
370 IPC::RequestParser rp{ctx}; 370 IPC::RequestParser rp{ctx};
371 const auto device_handle{rp.Pop<u64>()}; 371 const auto device_handle{rp.Pop<u64>()};
372 const auto access_id{rp.Pop<u32>()}; 372 const auto access_id{rp.Pop<u32>()};
@@ -399,7 +399,7 @@ void IUser::CreateApplicationArea(Kernel::HLERequestContext& ctx) {
399 rb.Push(result); 399 rb.Push(result);
400} 400}
401 401
402void IUser::GetTagInfo(Kernel::HLERequestContext& ctx) { 402void IUser::GetTagInfo(HLERequestContext& ctx) {
403 IPC::RequestParser rp{ctx}; 403 IPC::RequestParser rp{ctx};
404 const auto device_handle{rp.Pop<u64>()}; 404 const auto device_handle{rp.Pop<u64>()};
405 LOG_INFO(Service_NFP, "called, device_handle={}", device_handle); 405 LOG_INFO(Service_NFP, "called, device_handle={}", device_handle);
@@ -425,7 +425,7 @@ void IUser::GetTagInfo(Kernel::HLERequestContext& ctx) {
425 rb.Push(result); 425 rb.Push(result);
426} 426}
427 427
428void IUser::GetRegisterInfo(Kernel::HLERequestContext& ctx) { 428void IUser::GetRegisterInfo(HLERequestContext& ctx) {
429 IPC::RequestParser rp{ctx}; 429 IPC::RequestParser rp{ctx};
430 const auto device_handle{rp.Pop<u64>()}; 430 const auto device_handle{rp.Pop<u64>()};
431 LOG_INFO(Service_NFP, "called, device_handle={}", device_handle); 431 LOG_INFO(Service_NFP, "called, device_handle={}", device_handle);
@@ -451,7 +451,7 @@ void IUser::GetRegisterInfo(Kernel::HLERequestContext& ctx) {
451 rb.Push(result); 451 rb.Push(result);
452} 452}
453 453
454void IUser::GetCommonInfo(Kernel::HLERequestContext& ctx) { 454void IUser::GetCommonInfo(HLERequestContext& ctx) {
455 IPC::RequestParser rp{ctx}; 455 IPC::RequestParser rp{ctx};
456 const auto device_handle{rp.Pop<u64>()}; 456 const auto device_handle{rp.Pop<u64>()};
457 LOG_INFO(Service_NFP, "called, device_handle={}", device_handle); 457 LOG_INFO(Service_NFP, "called, device_handle={}", device_handle);
@@ -477,7 +477,7 @@ void IUser::GetCommonInfo(Kernel::HLERequestContext& ctx) {
477 rb.Push(result); 477 rb.Push(result);
478} 478}
479 479
480void IUser::GetModelInfo(Kernel::HLERequestContext& ctx) { 480void IUser::GetModelInfo(HLERequestContext& ctx) {
481 IPC::RequestParser rp{ctx}; 481 IPC::RequestParser rp{ctx};
482 const auto device_handle{rp.Pop<u64>()}; 482 const auto device_handle{rp.Pop<u64>()};
483 LOG_INFO(Service_NFP, "called, device_handle={}", device_handle); 483 LOG_INFO(Service_NFP, "called, device_handle={}", device_handle);
@@ -503,7 +503,7 @@ void IUser::GetModelInfo(Kernel::HLERequestContext& ctx) {
503 rb.Push(result); 503 rb.Push(result);
504} 504}
505 505
506void IUser::AttachActivateEvent(Kernel::HLERequestContext& ctx) { 506void IUser::AttachActivateEvent(HLERequestContext& ctx) {
507 IPC::RequestParser rp{ctx}; 507 IPC::RequestParser rp{ctx};
508 const auto device_handle{rp.Pop<u64>()}; 508 const auto device_handle{rp.Pop<u64>()};
509 LOG_DEBUG(Service_NFP, "called, device_handle={}", device_handle); 509 LOG_DEBUG(Service_NFP, "called, device_handle={}", device_handle);
@@ -527,7 +527,7 @@ void IUser::AttachActivateEvent(Kernel::HLERequestContext& ctx) {
527 rb.PushCopyObjects(device.value()->GetActivateEvent()); 527 rb.PushCopyObjects(device.value()->GetActivateEvent());
528} 528}
529 529
530void IUser::AttachDeactivateEvent(Kernel::HLERequestContext& ctx) { 530void IUser::AttachDeactivateEvent(HLERequestContext& ctx) {
531 IPC::RequestParser rp{ctx}; 531 IPC::RequestParser rp{ctx};
532 const auto device_handle{rp.Pop<u64>()}; 532 const auto device_handle{rp.Pop<u64>()};
533 LOG_DEBUG(Service_NFP, "called, device_handle={}", device_handle); 533 LOG_DEBUG(Service_NFP, "called, device_handle={}", device_handle);
@@ -551,7 +551,7 @@ void IUser::AttachDeactivateEvent(Kernel::HLERequestContext& ctx) {
551 rb.PushCopyObjects(device.value()->GetDeactivateEvent()); 551 rb.PushCopyObjects(device.value()->GetDeactivateEvent());
552} 552}
553 553
554void IUser::GetState(Kernel::HLERequestContext& ctx) { 554void IUser::GetState(HLERequestContext& ctx) {
555 LOG_DEBUG(Service_NFP, "called"); 555 LOG_DEBUG(Service_NFP, "called");
556 556
557 IPC::ResponseBuilder rb{ctx, 3}; 557 IPC::ResponseBuilder rb{ctx, 3};
@@ -559,7 +559,7 @@ void IUser::GetState(Kernel::HLERequestContext& ctx) {
559 rb.PushEnum(state); 559 rb.PushEnum(state);
560} 560}
561 561
562void IUser::GetDeviceState(Kernel::HLERequestContext& ctx) { 562void IUser::GetDeviceState(HLERequestContext& ctx) {
563 IPC::RequestParser rp{ctx}; 563 IPC::RequestParser rp{ctx};
564 const auto device_handle{rp.Pop<u64>()}; 564 const auto device_handle{rp.Pop<u64>()};
565 LOG_DEBUG(Service_NFP, "called, device_handle={}", device_handle); 565 LOG_DEBUG(Service_NFP, "called, device_handle={}", device_handle);
@@ -577,7 +577,7 @@ void IUser::GetDeviceState(Kernel::HLERequestContext& ctx) {
577 rb.PushEnum(device.value()->GetCurrentState()); 577 rb.PushEnum(device.value()->GetCurrentState());
578} 578}
579 579
580void IUser::GetNpadId(Kernel::HLERequestContext& ctx) { 580void IUser::GetNpadId(HLERequestContext& ctx) {
581 IPC::RequestParser rp{ctx}; 581 IPC::RequestParser rp{ctx};
582 const auto device_handle{rp.Pop<u64>()}; 582 const auto device_handle{rp.Pop<u64>()};
583 LOG_DEBUG(Service_NFP, "called, device_handle={}", device_handle); 583 LOG_DEBUG(Service_NFP, "called, device_handle={}", device_handle);
@@ -601,7 +601,7 @@ void IUser::GetNpadId(Kernel::HLERequestContext& ctx) {
601 rb.PushEnum(device.value()->GetNpadId()); 601 rb.PushEnum(device.value()->GetNpadId());
602} 602}
603 603
604void IUser::GetApplicationAreaSize(Kernel::HLERequestContext& ctx) { 604void IUser::GetApplicationAreaSize(HLERequestContext& ctx) {
605 IPC::RequestParser rp{ctx}; 605 IPC::RequestParser rp{ctx};
606 const auto device_handle{rp.Pop<u64>()}; 606 const auto device_handle{rp.Pop<u64>()};
607 LOG_DEBUG(Service_NFP, "called, device_handle={}", device_handle); 607 LOG_DEBUG(Service_NFP, "called, device_handle={}", device_handle);
@@ -619,7 +619,7 @@ void IUser::GetApplicationAreaSize(Kernel::HLERequestContext& ctx) {
619 rb.Push(device.value()->GetApplicationAreaSize()); 619 rb.Push(device.value()->GetApplicationAreaSize());
620} 620}
621 621
622void IUser::AttachAvailabilityChangeEvent(Kernel::HLERequestContext& ctx) { 622void IUser::AttachAvailabilityChangeEvent(HLERequestContext& ctx) {
623 LOG_INFO(Service_NFP, "called"); 623 LOG_INFO(Service_NFP, "called");
624 624
625 if (state == State::NonInitialized) { 625 if (state == State::NonInitialized) {
@@ -633,7 +633,7 @@ void IUser::AttachAvailabilityChangeEvent(Kernel::HLERequestContext& ctx) {
633 rb.PushCopyObjects(availability_change_event->GetReadableEvent()); 633 rb.PushCopyObjects(availability_change_event->GetReadableEvent());
634} 634}
635 635
636void IUser::RecreateApplicationArea(Kernel::HLERequestContext& ctx) { 636void IUser::RecreateApplicationArea(HLERequestContext& ctx) {
637 IPC::RequestParser rp{ctx}; 637 IPC::RequestParser rp{ctx};
638 const auto device_handle{rp.Pop<u64>()}; 638 const auto device_handle{rp.Pop<u64>()};
639 const auto access_id{rp.Pop<u32>()}; 639 const auto access_id{rp.Pop<u32>()};
diff --git a/src/core/hle/service/nfp/nfp_user.h b/src/core/hle/service/nfp/nfp_user.h
index 7e9a90af8..1f3ff2ea8 100644
--- a/src/core/hle/service/nfp/nfp_user.h
+++ b/src/core/hle/service/nfp/nfp_user.h
@@ -24,31 +24,31 @@ private:
24 Initialized, 24 Initialized,
25 }; 25 };
26 26
27 void Initialize(Kernel::HLERequestContext& ctx); 27 void Initialize(HLERequestContext& ctx);
28 void Finalize(Kernel::HLERequestContext& ctx); 28 void Finalize(HLERequestContext& ctx);
29 void ListDevices(Kernel::HLERequestContext& ctx); 29 void ListDevices(HLERequestContext& ctx);
30 void StartDetection(Kernel::HLERequestContext& ctx); 30 void StartDetection(HLERequestContext& ctx);
31 void StopDetection(Kernel::HLERequestContext& ctx); 31 void StopDetection(HLERequestContext& ctx);
32 void Mount(Kernel::HLERequestContext& ctx); 32 void Mount(HLERequestContext& ctx);
33 void Unmount(Kernel::HLERequestContext& ctx); 33 void Unmount(HLERequestContext& ctx);
34 void OpenApplicationArea(Kernel::HLERequestContext& ctx); 34 void OpenApplicationArea(HLERequestContext& ctx);
35 void GetApplicationArea(Kernel::HLERequestContext& ctx); 35 void GetApplicationArea(HLERequestContext& ctx);
36 void SetApplicationArea(Kernel::HLERequestContext& ctx); 36 void SetApplicationArea(HLERequestContext& ctx);
37 void Flush(Kernel::HLERequestContext& ctx); 37 void Flush(HLERequestContext& ctx);
38 void Restore(Kernel::HLERequestContext& ctx); 38 void Restore(HLERequestContext& ctx);
39 void CreateApplicationArea(Kernel::HLERequestContext& ctx); 39 void CreateApplicationArea(HLERequestContext& ctx);
40 void GetTagInfo(Kernel::HLERequestContext& ctx); 40 void GetTagInfo(HLERequestContext& ctx);
41 void GetRegisterInfo(Kernel::HLERequestContext& ctx); 41 void GetRegisterInfo(HLERequestContext& ctx);
42 void GetCommonInfo(Kernel::HLERequestContext& ctx); 42 void GetCommonInfo(HLERequestContext& ctx);
43 void GetModelInfo(Kernel::HLERequestContext& ctx); 43 void GetModelInfo(HLERequestContext& ctx);
44 void AttachActivateEvent(Kernel::HLERequestContext& ctx); 44 void AttachActivateEvent(HLERequestContext& ctx);
45 void AttachDeactivateEvent(Kernel::HLERequestContext& ctx); 45 void AttachDeactivateEvent(HLERequestContext& ctx);
46 void GetState(Kernel::HLERequestContext& ctx); 46 void GetState(HLERequestContext& ctx);
47 void GetDeviceState(Kernel::HLERequestContext& ctx); 47 void GetDeviceState(HLERequestContext& ctx);
48 void GetNpadId(Kernel::HLERequestContext& ctx); 48 void GetNpadId(HLERequestContext& ctx);
49 void GetApplicationAreaSize(Kernel::HLERequestContext& ctx); 49 void GetApplicationAreaSize(HLERequestContext& ctx);
50 void AttachAvailabilityChangeEvent(Kernel::HLERequestContext& ctx); 50 void AttachAvailabilityChangeEvent(HLERequestContext& ctx);
51 void RecreateApplicationArea(Kernel::HLERequestContext& ctx); 51 void RecreateApplicationArea(HLERequestContext& ctx);
52 52
53 std::optional<std::shared_ptr<NfpDevice>> GetNfpDevice(u64 handle); 53 std::optional<std::shared_ptr<NfpDevice>> GetNfpDevice(u64 handle);
54 54
diff --git a/src/core/hle/service/ngct/ngct.cpp b/src/core/hle/service/ngct/ngct.cpp
index 76897d05c..493c80ed2 100644
--- a/src/core/hle/service/ngct/ngct.cpp
+++ b/src/core/hle/service/ngct/ngct.cpp
@@ -3,7 +3,7 @@
3 3
4#include "common/string_util.h" 4#include "common/string_util.h"
5#include "core/core.h" 5#include "core/core.h"
6#include "core/hle/ipc_helpers.h" 6#include "core/hle/service/ipc_helpers.h"
7#include "core/hle/service/ngct/ngct.h" 7#include "core/hle/service/ngct/ngct.h"
8#include "core/hle/service/server_manager.h" 8#include "core/hle/service/server_manager.h"
9#include "core/hle/service/service.h" 9#include "core/hle/service/service.h"
@@ -24,7 +24,7 @@ public:
24 } 24 }
25 25
26private: 26private:
27 void Match(Kernel::HLERequestContext& ctx) { 27 void Match(HLERequestContext& ctx) {
28 const auto buffer = ctx.ReadBuffer(); 28 const auto buffer = ctx.ReadBuffer();
29 const auto text = Common::StringFromFixedZeroTerminatedBuffer( 29 const auto text = Common::StringFromFixedZeroTerminatedBuffer(
30 reinterpret_cast<const char*>(buffer.data()), buffer.size()); 30 reinterpret_cast<const char*>(buffer.data()), buffer.size());
@@ -37,7 +37,7 @@ private:
37 rb.Push(false); 37 rb.Push(false);
38 } 38 }
39 39
40 void Filter(Kernel::HLERequestContext& ctx) { 40 void Filter(HLERequestContext& ctx) {
41 const auto buffer = ctx.ReadBuffer(); 41 const auto buffer = ctx.ReadBuffer();
42 const auto text = Common::StringFromFixedZeroTerminatedBuffer( 42 const auto text = Common::StringFromFixedZeroTerminatedBuffer(
43 reinterpret_cast<const char*>(buffer.data()), buffer.size()); 43 reinterpret_cast<const char*>(buffer.data()), buffer.size());
diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp
index 3d176b3c2..0c042f412 100644
--- a/src/core/hle/service/nifm/nifm.cpp
+++ b/src/core/hle/service/nifm/nifm.cpp
@@ -2,8 +2,8 @@
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "core/core.h" 4#include "core/core.h"
5#include "core/hle/ipc_helpers.h"
6#include "core/hle/kernel/k_event.h" 5#include "core/hle/kernel/k_event.h"
6#include "core/hle/service/ipc_helpers.h"
7#include "core/hle/service/kernel_helpers.h" 7#include "core/hle/service/kernel_helpers.h"
8#include "core/hle/service/nifm/nifm.h" 8#include "core/hle/service/nifm/nifm.h"
9#include "core/hle/service/server_manager.h" 9#include "core/hle/service/server_manager.h"
@@ -217,7 +217,7 @@ public:
217 } 217 }
218 218
219private: 219private:
220 void Submit(Kernel::HLERequestContext& ctx) { 220 void Submit(HLERequestContext& ctx) {
221 LOG_WARNING(Service_NIFM, "(STUBBED) called"); 221 LOG_WARNING(Service_NIFM, "(STUBBED) called");
222 222
223 if (state == RequestState::NotSubmitted) { 223 if (state == RequestState::NotSubmitted) {
@@ -228,7 +228,7 @@ private:
228 rb.Push(ResultSuccess); 228 rb.Push(ResultSuccess);
229 } 229 }
230 230
231 void GetRequestState(Kernel::HLERequestContext& ctx) { 231 void GetRequestState(HLERequestContext& ctx) {
232 LOG_WARNING(Service_NIFM, "(STUBBED) called"); 232 LOG_WARNING(Service_NIFM, "(STUBBED) called");
233 233
234 IPC::ResponseBuilder rb{ctx, 3}; 234 IPC::ResponseBuilder rb{ctx, 3};
@@ -236,7 +236,7 @@ private:
236 rb.PushEnum(state); 236 rb.PushEnum(state);
237 } 237 }
238 238
239 void GetResult(Kernel::HLERequestContext& ctx) { 239 void GetResult(HLERequestContext& ctx) {
240 LOG_WARNING(Service_NIFM, "(STUBBED) called"); 240 LOG_WARNING(Service_NIFM, "(STUBBED) called");
241 241
242 const auto result = [this] { 242 const auto result = [this] {
@@ -261,7 +261,7 @@ private:
261 rb.Push(result); 261 rb.Push(result);
262 } 262 }
263 263
264 void GetSystemEventReadableHandles(Kernel::HLERequestContext& ctx) { 264 void GetSystemEventReadableHandles(HLERequestContext& ctx) {
265 LOG_WARNING(Service_NIFM, "(STUBBED) called"); 265 LOG_WARNING(Service_NIFM, "(STUBBED) called");
266 266
267 IPC::ResponseBuilder rb{ctx, 2, 2}; 267 IPC::ResponseBuilder rb{ctx, 2, 2};
@@ -269,21 +269,21 @@ private:
269 rb.PushCopyObjects(event1->GetReadableEvent(), event2->GetReadableEvent()); 269 rb.PushCopyObjects(event1->GetReadableEvent(), event2->GetReadableEvent());
270 } 270 }
271 271
272 void Cancel(Kernel::HLERequestContext& ctx) { 272 void Cancel(HLERequestContext& ctx) {
273 LOG_WARNING(Service_NIFM, "(STUBBED) called"); 273 LOG_WARNING(Service_NIFM, "(STUBBED) called");
274 274
275 IPC::ResponseBuilder rb{ctx, 2}; 275 IPC::ResponseBuilder rb{ctx, 2};
276 rb.Push(ResultSuccess); 276 rb.Push(ResultSuccess);
277 } 277 }
278 278
279 void SetConnectionConfirmationOption(Kernel::HLERequestContext& ctx) { 279 void SetConnectionConfirmationOption(HLERequestContext& ctx) {
280 LOG_WARNING(Service_NIFM, "(STUBBED) called"); 280 LOG_WARNING(Service_NIFM, "(STUBBED) called");
281 281
282 IPC::ResponseBuilder rb{ctx, 2}; 282 IPC::ResponseBuilder rb{ctx, 2};
283 rb.Push(ResultSuccess); 283 rb.Push(ResultSuccess);
284 } 284 }
285 285
286 void GetAppletInfo(Kernel::HLERequestContext& ctx) { 286 void GetAppletInfo(HLERequestContext& ctx) {
287 LOG_WARNING(Service_NIFM, "(STUBBED) called"); 287 LOG_WARNING(Service_NIFM, "(STUBBED) called");
288 288
289 std::vector<u8> out_buffer(ctx.GetWriteBufferSize()); 289 std::vector<u8> out_buffer(ctx.GetWriteBufferSize());
@@ -322,7 +322,7 @@ public:
322 } 322 }
323}; 323};
324 324
325void IGeneralService::GetClientId(Kernel::HLERequestContext& ctx) { 325void IGeneralService::GetClientId(HLERequestContext& ctx) {
326 static constexpr u32 client_id = 1; 326 static constexpr u32 client_id = 1;
327 LOG_WARNING(Service_NIFM, "(STUBBED) called"); 327 LOG_WARNING(Service_NIFM, "(STUBBED) called");
328 328
@@ -331,7 +331,7 @@ void IGeneralService::GetClientId(Kernel::HLERequestContext& ctx) {
331 rb.Push<u64>(client_id); // Client ID needs to be non zero otherwise it's considered invalid 331 rb.Push<u64>(client_id); // Client ID needs to be non zero otherwise it's considered invalid
332} 332}
333 333
334void IGeneralService::CreateScanRequest(Kernel::HLERequestContext& ctx) { 334void IGeneralService::CreateScanRequest(HLERequestContext& ctx) {
335 LOG_DEBUG(Service_NIFM, "called"); 335 LOG_DEBUG(Service_NIFM, "called");
336 336
337 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 337 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -340,7 +340,7 @@ void IGeneralService::CreateScanRequest(Kernel::HLERequestContext& ctx) {
340 rb.PushIpcInterface<IScanRequest>(system); 340 rb.PushIpcInterface<IScanRequest>(system);
341} 341}
342 342
343void IGeneralService::CreateRequest(Kernel::HLERequestContext& ctx) { 343void IGeneralService::CreateRequest(HLERequestContext& ctx) {
344 LOG_DEBUG(Service_NIFM, "called"); 344 LOG_DEBUG(Service_NIFM, "called");
345 345
346 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 346 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -349,7 +349,7 @@ void IGeneralService::CreateRequest(Kernel::HLERequestContext& ctx) {
349 rb.PushIpcInterface<IRequest>(system); 349 rb.PushIpcInterface<IRequest>(system);
350} 350}
351 351
352void IGeneralService::GetCurrentNetworkProfile(Kernel::HLERequestContext& ctx) { 352void IGeneralService::GetCurrentNetworkProfile(HLERequestContext& ctx) {
353 LOG_WARNING(Service_NIFM, "(STUBBED) called"); 353 LOG_WARNING(Service_NIFM, "(STUBBED) called");
354 354
355 const auto net_iface = Network::GetSelectedNetworkInterface(); 355 const auto net_iface = Network::GetSelectedNetworkInterface();
@@ -408,14 +408,14 @@ void IGeneralService::GetCurrentNetworkProfile(Kernel::HLERequestContext& ctx) {
408 rb.Push(ResultSuccess); 408 rb.Push(ResultSuccess);
409} 409}
410 410
411void IGeneralService::RemoveNetworkProfile(Kernel::HLERequestContext& ctx) { 411void IGeneralService::RemoveNetworkProfile(HLERequestContext& ctx) {
412 LOG_WARNING(Service_NIFM, "(STUBBED) called"); 412 LOG_WARNING(Service_NIFM, "(STUBBED) called");
413 413
414 IPC::ResponseBuilder rb{ctx, 2}; 414 IPC::ResponseBuilder rb{ctx, 2};
415 rb.Push(ResultSuccess); 415 rb.Push(ResultSuccess);
416} 416}
417 417
418void IGeneralService::GetCurrentIpAddress(Kernel::HLERequestContext& ctx) { 418void IGeneralService::GetCurrentIpAddress(HLERequestContext& ctx) {
419 LOG_WARNING(Service_NIFM, "(STUBBED) called"); 419 LOG_WARNING(Service_NIFM, "(STUBBED) called");
420 420
421 auto ipv4 = Network::GetHostIPv4Address(); 421 auto ipv4 = Network::GetHostIPv4Address();
@@ -436,7 +436,7 @@ void IGeneralService::GetCurrentIpAddress(Kernel::HLERequestContext& ctx) {
436 rb.PushRaw(*ipv4); 436 rb.PushRaw(*ipv4);
437} 437}
438 438
439void IGeneralService::CreateTemporaryNetworkProfile(Kernel::HLERequestContext& ctx) { 439void IGeneralService::CreateTemporaryNetworkProfile(HLERequestContext& ctx) {
440 LOG_DEBUG(Service_NIFM, "called"); 440 LOG_DEBUG(Service_NIFM, "called");
441 441
442 ASSERT_MSG(ctx.GetReadBufferSize() == 0x17c, "SfNetworkProfileData is not the correct size"); 442 ASSERT_MSG(ctx.GetReadBufferSize() == 0x17c, "SfNetworkProfileData is not the correct size");
@@ -451,7 +451,7 @@ void IGeneralService::CreateTemporaryNetworkProfile(Kernel::HLERequestContext& c
451 rb.PushRaw<u128>(uuid); 451 rb.PushRaw<u128>(uuid);
452} 452}
453 453
454void IGeneralService::GetCurrentIpConfigInfo(Kernel::HLERequestContext& ctx) { 454void IGeneralService::GetCurrentIpConfigInfo(HLERequestContext& ctx) {
455 LOG_WARNING(Service_NIFM, "(STUBBED) called"); 455 LOG_WARNING(Service_NIFM, "(STUBBED) called");
456 456
457 struct IpConfigInfo { 457 struct IpConfigInfo {
@@ -495,7 +495,7 @@ void IGeneralService::GetCurrentIpConfigInfo(Kernel::HLERequestContext& ctx) {
495 rb.PushRaw<IpConfigInfo>(ip_config_info); 495 rb.PushRaw<IpConfigInfo>(ip_config_info);
496} 496}
497 497
498void IGeneralService::IsWirelessCommunicationEnabled(Kernel::HLERequestContext& ctx) { 498void IGeneralService::IsWirelessCommunicationEnabled(HLERequestContext& ctx) {
499 LOG_WARNING(Service_NIFM, "(STUBBED) called"); 499 LOG_WARNING(Service_NIFM, "(STUBBED) called");
500 500
501 IPC::ResponseBuilder rb{ctx, 3}; 501 IPC::ResponseBuilder rb{ctx, 3};
@@ -503,7 +503,7 @@ void IGeneralService::IsWirelessCommunicationEnabled(Kernel::HLERequestContext&
503 rb.Push<u8>(1); 503 rb.Push<u8>(1);
504} 504}
505 505
506void IGeneralService::GetInternetConnectionStatus(Kernel::HLERequestContext& ctx) { 506void IGeneralService::GetInternetConnectionStatus(HLERequestContext& ctx) {
507 LOG_WARNING(Service_NIFM, "(STUBBED) called"); 507 LOG_WARNING(Service_NIFM, "(STUBBED) called");
508 508
509 struct Output { 509 struct Output {
@@ -520,7 +520,7 @@ void IGeneralService::GetInternetConnectionStatus(Kernel::HLERequestContext& ctx
520 rb.PushRaw(out); 520 rb.PushRaw(out);
521} 521}
522 522
523void IGeneralService::IsEthernetCommunicationEnabled(Kernel::HLERequestContext& ctx) { 523void IGeneralService::IsEthernetCommunicationEnabled(HLERequestContext& ctx) {
524 LOG_WARNING(Service_NIFM, "(STUBBED) called"); 524 LOG_WARNING(Service_NIFM, "(STUBBED) called");
525 525
526 IPC::ResponseBuilder rb{ctx, 3}; 526 IPC::ResponseBuilder rb{ctx, 3};
@@ -532,7 +532,7 @@ void IGeneralService::IsEthernetCommunicationEnabled(Kernel::HLERequestContext&
532 } 532 }
533} 533}
534 534
535void IGeneralService::IsAnyInternetRequestAccepted(Kernel::HLERequestContext& ctx) { 535void IGeneralService::IsAnyInternetRequestAccepted(HLERequestContext& ctx) {
536 LOG_ERROR(Service_NIFM, "(STUBBED) called"); 536 LOG_ERROR(Service_NIFM, "(STUBBED) called");
537 537
538 IPC::ResponseBuilder rb{ctx, 3}; 538 IPC::ResponseBuilder rb{ctx, 3};
@@ -610,7 +610,7 @@ public:
610 } 610 }
611 611
612private: 612private:
613 void CreateGeneralServiceOld(Kernel::HLERequestContext& ctx) { 613 void CreateGeneralServiceOld(HLERequestContext& ctx) {
614 LOG_DEBUG(Service_NIFM, "called"); 614 LOG_DEBUG(Service_NIFM, "called");
615 615
616 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 616 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -618,7 +618,7 @@ private:
618 rb.PushIpcInterface<IGeneralService>(system); 618 rb.PushIpcInterface<IGeneralService>(system);
619 } 619 }
620 620
621 void CreateGeneralService(Kernel::HLERequestContext& ctx) { 621 void CreateGeneralService(HLERequestContext& ctx) {
622 LOG_DEBUG(Service_NIFM, "called"); 622 LOG_DEBUG(Service_NIFM, "called");
623 623
624 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 624 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
diff --git a/src/core/hle/service/nifm/nifm.h b/src/core/hle/service/nifm/nifm.h
index b5da7ae12..9b20e6823 100644
--- a/src/core/hle/service/nifm/nifm.h
+++ b/src/core/hle/service/nifm/nifm.h
@@ -22,18 +22,18 @@ public:
22 ~IGeneralService() override; 22 ~IGeneralService() override;
23 23
24private: 24private:
25 void GetClientId(Kernel::HLERequestContext& ctx); 25 void GetClientId(HLERequestContext& ctx);
26 void CreateScanRequest(Kernel::HLERequestContext& ctx); 26 void CreateScanRequest(HLERequestContext& ctx);
27 void CreateRequest(Kernel::HLERequestContext& ctx); 27 void CreateRequest(HLERequestContext& ctx);
28 void GetCurrentNetworkProfile(Kernel::HLERequestContext& ctx); 28 void GetCurrentNetworkProfile(HLERequestContext& ctx);
29 void RemoveNetworkProfile(Kernel::HLERequestContext& ctx); 29 void RemoveNetworkProfile(HLERequestContext& ctx);
30 void GetCurrentIpAddress(Kernel::HLERequestContext& ctx); 30 void GetCurrentIpAddress(HLERequestContext& ctx);
31 void CreateTemporaryNetworkProfile(Kernel::HLERequestContext& ctx); 31 void CreateTemporaryNetworkProfile(HLERequestContext& ctx);
32 void GetCurrentIpConfigInfo(Kernel::HLERequestContext& ctx); 32 void GetCurrentIpConfigInfo(HLERequestContext& ctx);
33 void IsWirelessCommunicationEnabled(Kernel::HLERequestContext& ctx); 33 void IsWirelessCommunicationEnabled(HLERequestContext& ctx);
34 void GetInternetConnectionStatus(Kernel::HLERequestContext& ctx); 34 void GetInternetConnectionStatus(HLERequestContext& ctx);
35 void IsEthernetCommunicationEnabled(Kernel::HLERequestContext& ctx); 35 void IsEthernetCommunicationEnabled(HLERequestContext& ctx);
36 void IsAnyInternetRequestAccepted(Kernel::HLERequestContext& ctx); 36 void IsAnyInternetRequestAccepted(HLERequestContext& ctx);
37 37
38 Network::RoomNetwork& network; 38 Network::RoomNetwork& network;
39}; 39};
diff --git a/src/core/hle/service/nim/nim.cpp b/src/core/hle/service/nim/nim.cpp
index aff7cc5bd..42de87f9a 100644
--- a/src/core/hle/service/nim/nim.cpp
+++ b/src/core/hle/service/nim/nim.cpp
@@ -4,8 +4,8 @@
4#include <chrono> 4#include <chrono>
5#include <ctime> 5#include <ctime>
6#include "core/core.h" 6#include "core/core.h"
7#include "core/hle/ipc_helpers.h"
8#include "core/hle/kernel/k_event.h" 7#include "core/hle/kernel/k_event.h"
8#include "core/hle/service/ipc_helpers.h"
9#include "core/hle/service/kernel_helpers.h" 9#include "core/hle/service/kernel_helpers.h"
10#include "core/hle/service/nim/nim.h" 10#include "core/hle/service/nim/nim.h"
11#include "core/hle/service/server_manager.h" 11#include "core/hle/service/server_manager.h"
@@ -46,7 +46,7 @@ public:
46 } 46 }
47 47
48private: 48private:
49 void CreateAsyncInterface(Kernel::HLERequestContext& ctx) { 49 void CreateAsyncInterface(HLERequestContext& ctx) {
50 LOG_WARNING(Service_NIM, "(STUBBED) called"); 50 LOG_WARNING(Service_NIM, "(STUBBED) called");
51 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 51 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
52 rb.Push(ResultSuccess); 52 rb.Push(ResultSuccess);
@@ -68,7 +68,7 @@ public:
68 } 68 }
69 69
70private: 70private:
71 void CreateAccessorInterface(Kernel::HLERequestContext& ctx) { 71 void CreateAccessorInterface(HLERequestContext& ctx) {
72 LOG_WARNING(Service_NIM, "(STUBBED) called"); 72 LOG_WARNING(Service_NIM, "(STUBBED) called");
73 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 73 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
74 rb.Push(ResultSuccess); 74 rb.Push(ResultSuccess);
@@ -239,14 +239,14 @@ public:
239 } 239 }
240 240
241private: 241private:
242 void CreateServerInterface(Kernel::HLERequestContext& ctx) { 242 void CreateServerInterface(HLERequestContext& ctx) {
243 LOG_WARNING(Service_NIM, "(STUBBED) called"); 243 LOG_WARNING(Service_NIM, "(STUBBED) called");
244 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 244 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
245 rb.Push(ResultSuccess); 245 rb.Push(ResultSuccess);
246 rb.PushIpcInterface<IShopServiceAccessServer>(system); 246 rb.PushIpcInterface<IShopServiceAccessServer>(system);
247 } 247 }
248 248
249 void IsLargeResourceAvailable(Kernel::HLERequestContext& ctx) { 249 void IsLargeResourceAvailable(HLERequestContext& ctx) {
250 IPC::RequestParser rp{ctx}; 250 IPC::RequestParser rp{ctx};
251 251
252 const auto unknown{rp.Pop<u64>()}; 252 const auto unknown{rp.Pop<u64>()};
@@ -325,7 +325,7 @@ public:
325 } 325 }
326 326
327private: 327private:
328 void StartTask(Kernel::HLERequestContext& ctx) { 328 void StartTask(HLERequestContext& ctx) {
329 // No need to connect to the internet, just finish the task straight away. 329 // No need to connect to the internet, just finish the task straight away.
330 LOG_DEBUG(Service_NIM, "called"); 330 LOG_DEBUG(Service_NIM, "called");
331 finished_event->Signal(); 331 finished_event->Signal();
@@ -333,7 +333,7 @@ private:
333 rb.Push(ResultSuccess); 333 rb.Push(ResultSuccess);
334 } 334 }
335 335
336 void GetFinishNotificationEvent(Kernel::HLERequestContext& ctx) { 336 void GetFinishNotificationEvent(HLERequestContext& ctx) {
337 LOG_DEBUG(Service_NIM, "called"); 337 LOG_DEBUG(Service_NIM, "called");
338 338
339 IPC::ResponseBuilder rb{ctx, 2, 1}; 339 IPC::ResponseBuilder rb{ctx, 2, 1};
@@ -341,21 +341,21 @@ private:
341 rb.PushCopyObjects(finished_event->GetReadableEvent()); 341 rb.PushCopyObjects(finished_event->GetReadableEvent());
342 } 342 }
343 343
344 void GetResult(Kernel::HLERequestContext& ctx) { 344 void GetResult(HLERequestContext& ctx) {
345 LOG_DEBUG(Service_NIM, "called"); 345 LOG_DEBUG(Service_NIM, "called");
346 346
347 IPC::ResponseBuilder rb{ctx, 2}; 347 IPC::ResponseBuilder rb{ctx, 2};
348 rb.Push(ResultSuccess); 348 rb.Push(ResultSuccess);
349 } 349 }
350 350
351 void Cancel(Kernel::HLERequestContext& ctx) { 351 void Cancel(HLERequestContext& ctx) {
352 LOG_DEBUG(Service_NIM, "called"); 352 LOG_DEBUG(Service_NIM, "called");
353 finished_event->Clear(); 353 finished_event->Clear();
354 IPC::ResponseBuilder rb{ctx, 2}; 354 IPC::ResponseBuilder rb{ctx, 2};
355 rb.Push(ResultSuccess); 355 rb.Push(ResultSuccess);
356 } 356 }
357 357
358 void IsProcessing(Kernel::HLERequestContext& ctx) { 358 void IsProcessing(HLERequestContext& ctx) {
359 LOG_DEBUG(Service_NIM, "called"); 359 LOG_DEBUG(Service_NIM, "called");
360 360
361 IPC::ResponseBuilder rb{ctx, 3}; 361 IPC::ResponseBuilder rb{ctx, 3};
@@ -363,7 +363,7 @@ private:
363 rb.PushRaw<u32>(0); // We instantly process the request 363 rb.PushRaw<u32>(0); // We instantly process the request
364 } 364 }
365 365
366 void GetServerTime(Kernel::HLERequestContext& ctx) { 366 void GetServerTime(HLERequestContext& ctx) {
367 LOG_DEBUG(Service_NIM, "called"); 367 LOG_DEBUG(Service_NIM, "called");
368 368
369 const s64 server_time{std::chrono::duration_cast<std::chrono::seconds>( 369 const s64 server_time{std::chrono::duration_cast<std::chrono::seconds>(
@@ -394,7 +394,7 @@ public:
394 } 394 }
395 395
396private: 396private:
397 void OpenEnsureNetworkClockAvailabilityService(Kernel::HLERequestContext& ctx) { 397 void OpenEnsureNetworkClockAvailabilityService(HLERequestContext& ctx) {
398 LOG_DEBUG(Service_NIM, "called"); 398 LOG_DEBUG(Service_NIM, "called");
399 399
400 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 400 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -403,14 +403,14 @@ private:
403 } 403 }
404 404
405 // TODO(ogniK): Do we need these? 405 // TODO(ogniK): Do we need these?
406 void SuspendAutonomicTimeCorrection(Kernel::HLERequestContext& ctx) { 406 void SuspendAutonomicTimeCorrection(HLERequestContext& ctx) {
407 LOG_WARNING(Service_NIM, "(STUBBED) called"); 407 LOG_WARNING(Service_NIM, "(STUBBED) called");
408 408
409 IPC::ResponseBuilder rb{ctx, 2}; 409 IPC::ResponseBuilder rb{ctx, 2};
410 rb.Push(ResultSuccess); 410 rb.Push(ResultSuccess);
411 } 411 }
412 412
413 void ResumeAutonomicTimeCorrection(Kernel::HLERequestContext& ctx) { 413 void ResumeAutonomicTimeCorrection(HLERequestContext& ctx) {
414 LOG_WARNING(Service_NIM, "(STUBBED) called"); 414 LOG_WARNING(Service_NIM, "(STUBBED) called");
415 415
416 IPC::ResponseBuilder rb{ctx, 2}; 416 IPC::ResponseBuilder rb{ctx, 2};
diff --git a/src/core/hle/service/ns/iplatform_service_manager.cpp b/src/core/hle/service/ns/iplatform_service_manager.cpp
index 1fab2f0dd..cd2705881 100644
--- a/src/core/hle/service/ns/iplatform_service_manager.cpp
+++ b/src/core/hle/service/ns/iplatform_service_manager.cpp
@@ -15,11 +15,11 @@
15#include "core/file_sys/registered_cache.h" 15#include "core/file_sys/registered_cache.h"
16#include "core/file_sys/romfs.h" 16#include "core/file_sys/romfs.h"
17#include "core/file_sys/system_archive/system_archive.h" 17#include "core/file_sys/system_archive/system_archive.h"
18#include "core/hle/ipc_helpers.h"
19#include "core/hle/kernel/k_shared_memory.h" 18#include "core/hle/kernel/k_shared_memory.h"
20#include "core/hle/kernel/kernel.h" 19#include "core/hle/kernel/kernel.h"
21#include "core/hle/kernel/physical_memory.h" 20#include "core/hle/kernel/physical_memory.h"
22#include "core/hle/service/filesystem/filesystem.h" 21#include "core/hle/service/filesystem/filesystem.h"
22#include "core/hle/service/ipc_helpers.h"
23#include "core/hle/service/ns/iplatform_service_manager.h" 23#include "core/hle/service/ns/iplatform_service_manager.h"
24 24
25namespace Service::NS { 25namespace Service::NS {
@@ -208,7 +208,7 @@ IPlatformServiceManager::IPlatformServiceManager(Core::System& system_, const ch
208 208
209IPlatformServiceManager::~IPlatformServiceManager() = default; 209IPlatformServiceManager::~IPlatformServiceManager() = default;
210 210
211void IPlatformServiceManager::RequestLoad(Kernel::HLERequestContext& ctx) { 211void IPlatformServiceManager::RequestLoad(HLERequestContext& ctx) {
212 IPC::RequestParser rp{ctx}; 212 IPC::RequestParser rp{ctx};
213 const u32 shared_font_type{rp.Pop<u32>()}; 213 const u32 shared_font_type{rp.Pop<u32>()};
214 // Games don't call this so all fonts should be loaded 214 // Games don't call this so all fonts should be loaded
@@ -218,7 +218,7 @@ void IPlatformServiceManager::RequestLoad(Kernel::HLERequestContext& ctx) {
218 rb.Push(ResultSuccess); 218 rb.Push(ResultSuccess);
219} 219}
220 220
221void IPlatformServiceManager::GetLoadState(Kernel::HLERequestContext& ctx) { 221void IPlatformServiceManager::GetLoadState(HLERequestContext& ctx) {
222 IPC::RequestParser rp{ctx}; 222 IPC::RequestParser rp{ctx};
223 const u32 font_id{rp.Pop<u32>()}; 223 const u32 font_id{rp.Pop<u32>()};
224 LOG_DEBUG(Service_NS, "called, font_id={}", font_id); 224 LOG_DEBUG(Service_NS, "called, font_id={}", font_id);
@@ -228,7 +228,7 @@ void IPlatformServiceManager::GetLoadState(Kernel::HLERequestContext& ctx) {
228 rb.Push<u32>(static_cast<u32>(LoadState::Done)); 228 rb.Push<u32>(static_cast<u32>(LoadState::Done));
229} 229}
230 230
231void IPlatformServiceManager::GetSize(Kernel::HLERequestContext& ctx) { 231void IPlatformServiceManager::GetSize(HLERequestContext& ctx) {
232 IPC::RequestParser rp{ctx}; 232 IPC::RequestParser rp{ctx};
233 const u32 font_id{rp.Pop<u32>()}; 233 const u32 font_id{rp.Pop<u32>()};
234 LOG_DEBUG(Service_NS, "called, font_id={}", font_id); 234 LOG_DEBUG(Service_NS, "called, font_id={}", font_id);
@@ -238,7 +238,7 @@ void IPlatformServiceManager::GetSize(Kernel::HLERequestContext& ctx) {
238 rb.Push<u32>(impl->GetSharedFontRegion(font_id).size); 238 rb.Push<u32>(impl->GetSharedFontRegion(font_id).size);
239} 239}
240 240
241void IPlatformServiceManager::GetSharedMemoryAddressOffset(Kernel::HLERequestContext& ctx) { 241void IPlatformServiceManager::GetSharedMemoryAddressOffset(HLERequestContext& ctx) {
242 IPC::RequestParser rp{ctx}; 242 IPC::RequestParser rp{ctx};
243 const u32 font_id{rp.Pop<u32>()}; 243 const u32 font_id{rp.Pop<u32>()};
244 LOG_DEBUG(Service_NS, "called, font_id={}", font_id); 244 LOG_DEBUG(Service_NS, "called, font_id={}", font_id);
@@ -248,7 +248,7 @@ void IPlatformServiceManager::GetSharedMemoryAddressOffset(Kernel::HLERequestCon
248 rb.Push<u32>(impl->GetSharedFontRegion(font_id).offset); 248 rb.Push<u32>(impl->GetSharedFontRegion(font_id).offset);
249} 249}
250 250
251void IPlatformServiceManager::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) { 251void IPlatformServiceManager::GetSharedMemoryNativeHandle(HLERequestContext& ctx) {
252 // Map backing memory for the font data 252 // Map backing memory for the font data
253 LOG_DEBUG(Service_NS, "called"); 253 LOG_DEBUG(Service_NS, "called");
254 254
@@ -261,7 +261,7 @@ void IPlatformServiceManager::GetSharedMemoryNativeHandle(Kernel::HLERequestCont
261 rb.PushCopyObjects(&kernel.GetFontSharedMem()); 261 rb.PushCopyObjects(&kernel.GetFontSharedMem());
262} 262}
263 263
264void IPlatformServiceManager::GetSharedFontInOrderOfPriority(Kernel::HLERequestContext& ctx) { 264void IPlatformServiceManager::GetSharedFontInOrderOfPriority(HLERequestContext& ctx) {
265 IPC::RequestParser rp{ctx}; 265 IPC::RequestParser rp{ctx};
266 const u64 language_code{rp.Pop<u64>()}; // TODO(ogniK): Find out what this is used for 266 const u64 language_code{rp.Pop<u64>()}; // TODO(ogniK): Find out what this is used for
267 LOG_DEBUG(Service_NS, "called, language_code={:X}", language_code); 267 LOG_DEBUG(Service_NS, "called, language_code={:X}", language_code);
diff --git a/src/core/hle/service/ns/iplatform_service_manager.h b/src/core/hle/service/ns/iplatform_service_manager.h
index ed6eda89f..03071e02b 100644
--- a/src/core/hle/service/ns/iplatform_service_manager.h
+++ b/src/core/hle/service/ns/iplatform_service_manager.h
@@ -42,12 +42,12 @@ public:
42 ~IPlatformServiceManager() override; 42 ~IPlatformServiceManager() override;
43 43
44private: 44private:
45 void RequestLoad(Kernel::HLERequestContext& ctx); 45 void RequestLoad(HLERequestContext& ctx);
46 void GetLoadState(Kernel::HLERequestContext& ctx); 46 void GetLoadState(HLERequestContext& ctx);
47 void GetSize(Kernel::HLERequestContext& ctx); 47 void GetSize(HLERequestContext& ctx);
48 void GetSharedMemoryAddressOffset(Kernel::HLERequestContext& ctx); 48 void GetSharedMemoryAddressOffset(HLERequestContext& ctx);
49 void GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx); 49 void GetSharedMemoryNativeHandle(HLERequestContext& ctx);
50 void GetSharedFontInOrderOfPriority(Kernel::HLERequestContext& ctx); 50 void GetSharedFontInOrderOfPriority(HLERequestContext& ctx);
51 51
52 struct Impl; 52 struct Impl;
53 std::unique_ptr<Impl> impl; 53 std::unique_ptr<Impl> impl;
diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp
index 062e96ef9..d6f0faea2 100644
--- a/src/core/hle/service/ns/ns.cpp
+++ b/src/core/hle/service/ns/ns.cpp
@@ -7,8 +7,8 @@
7#include "core/file_sys/control_metadata.h" 7#include "core/file_sys/control_metadata.h"
8#include "core/file_sys/patch_manager.h" 8#include "core/file_sys/patch_manager.h"
9#include "core/file_sys/vfs.h" 9#include "core/file_sys/vfs.h"
10#include "core/hle/ipc_helpers.h"
11#include "core/hle/service/glue/glue_manager.h" 10#include "core/hle/service/glue/glue_manager.h"
11#include "core/hle/service/ipc_helpers.h"
12#include "core/hle/service/ns/errors.h" 12#include "core/hle/service/ns/errors.h"
13#include "core/hle/service/ns/iplatform_service_manager.h" 13#include "core/hle/service/ns/iplatform_service_manager.h"
14#include "core/hle/service/ns/language.h" 14#include "core/hle/service/ns/language.h"
@@ -329,7 +329,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
329 329
330IApplicationManagerInterface::~IApplicationManagerInterface() = default; 330IApplicationManagerInterface::~IApplicationManagerInterface() = default;
331 331
332void IApplicationManagerInterface::GetApplicationControlData(Kernel::HLERequestContext& ctx) { 332void IApplicationManagerInterface::GetApplicationControlData(HLERequestContext& ctx) {
333 IPC::RequestParser rp{ctx}; 333 IPC::RequestParser rp{ctx};
334 const auto flag = rp.PopRaw<u64>(); 334 const auto flag = rp.PopRaw<u64>();
335 LOG_DEBUG(Service_NS, "called with flag={:016X}", flag); 335 LOG_DEBUG(Service_NS, "called with flag={:016X}", flag);
@@ -388,7 +388,7 @@ void IApplicationManagerInterface::GetApplicationControlData(Kernel::HLERequestC
388 rb.Push<u32>(static_cast<u32>(out.size())); 388 rb.Push<u32>(static_cast<u32>(out.size()));
389} 389}
390 390
391void IApplicationManagerInterface::GetApplicationDesiredLanguage(Kernel::HLERequestContext& ctx) { 391void IApplicationManagerInterface::GetApplicationDesiredLanguage(HLERequestContext& ctx) {
392 IPC::RequestParser rp{ctx}; 392 IPC::RequestParser rp{ctx};
393 const auto supported_languages = rp.Pop<u32>(); 393 const auto supported_languages = rp.Pop<u32>();
394 394
@@ -440,7 +440,7 @@ ResultVal<u8> IApplicationManagerInterface::GetApplicationDesiredLanguage(
440} 440}
441 441
442void IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode( 442void IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode(
443 Kernel::HLERequestContext& ctx) { 443 HLERequestContext& ctx) {
444 IPC::RequestParser rp{ctx}; 444 IPC::RequestParser rp{ctx};
445 const auto application_language = rp.Pop<u8>(); 445 const auto application_language = rp.Pop<u8>();
446 446
@@ -604,8 +604,7 @@ IReadOnlyApplicationControlDataInterface::IReadOnlyApplicationControlDataInterfa
604 604
605IReadOnlyApplicationControlDataInterface::~IReadOnlyApplicationControlDataInterface() = default; 605IReadOnlyApplicationControlDataInterface::~IReadOnlyApplicationControlDataInterface() = default;
606 606
607void IReadOnlyApplicationControlDataInterface::GetApplicationControlData( 607void IReadOnlyApplicationControlDataInterface::GetApplicationControlData(HLERequestContext& ctx) {
608 Kernel::HLERequestContext& ctx) {
609 enum class ApplicationControlSource : u8 { 608 enum class ApplicationControlSource : u8 {
610 CacheOnly, 609 CacheOnly,
611 Storage, 610 Storage,
@@ -753,7 +752,7 @@ public:
753 } 752 }
754 753
755private: 754private:
756 void OpenSystemUpdateControl(Kernel::HLERequestContext& ctx) { 755 void OpenSystemUpdateControl(HLERequestContext& ctx) {
757 LOG_DEBUG(Service_NS, "called"); 756 LOG_DEBUG(Service_NS, "called");
758 757
759 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 758 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -777,7 +776,7 @@ public:
777 } 776 }
778 777
779private: 778private:
780 void NeedsUpdateVulnerability(Kernel::HLERequestContext& ctx) { 779 void NeedsUpdateVulnerability(HLERequestContext& ctx) {
781 LOG_WARNING(Service_NS, "(STUBBED) called"); 780 LOG_WARNING(Service_NS, "(STUBBED) called");
782 781
783 IPC::ResponseBuilder rb{ctx, 3}; 782 IPC::ResponseBuilder rb{ctx, 3};
diff --git a/src/core/hle/service/ns/ns.h b/src/core/hle/service/ns/ns.h
index 797e69a13..203388e1f 100644
--- a/src/core/hle/service/ns/ns.h
+++ b/src/core/hle/service/ns/ns.h
@@ -32,9 +32,9 @@ public:
32 ResultVal<u64> ConvertApplicationLanguageToLanguageCode(u8 application_language); 32 ResultVal<u64> ConvertApplicationLanguageToLanguageCode(u8 application_language);
33 33
34private: 34private:
35 void GetApplicationControlData(Kernel::HLERequestContext& ctx); 35 void GetApplicationControlData(HLERequestContext& ctx);
36 void GetApplicationDesiredLanguage(Kernel::HLERequestContext& ctx); 36 void GetApplicationDesiredLanguage(HLERequestContext& ctx);
37 void ConvertApplicationLanguageToLanguageCode(Kernel::HLERequestContext& ctx); 37 void ConvertApplicationLanguageToLanguageCode(HLERequestContext& ctx);
38}; 38};
39 39
40class IApplicationVersionInterface final : public ServiceFramework<IApplicationVersionInterface> { 40class IApplicationVersionInterface final : public ServiceFramework<IApplicationVersionInterface> {
@@ -80,7 +80,7 @@ public:
80 ~IReadOnlyApplicationControlDataInterface() override; 80 ~IReadOnlyApplicationControlDataInterface() override;
81 81
82private: 82private:
83 void GetApplicationControlData(Kernel::HLERequestContext& ctx); 83 void GetApplicationControlData(HLERequestContext& ctx);
84}; 84};
85 85
86class NS final : public ServiceFramework<NS> { 86class NS final : public ServiceFramework<NS> {
@@ -92,7 +92,7 @@ public:
92 92
93private: 93private:
94 template <typename T, typename... Args> 94 template <typename T, typename... Args>
95 void PushInterface(Kernel::HLERequestContext& ctx) { 95 void PushInterface(HLERequestContext& ctx) {
96 LOG_DEBUG(Service_NS, "called"); 96 LOG_DEBUG(Service_NS, "called");
97 97
98 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 98 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -100,7 +100,7 @@ private:
100 rb.PushIpcInterface<T>(system); 100 rb.PushIpcInterface<T>(system);
101 } 101 }
102 102
103 void PushIApplicationManagerInterface(Kernel::HLERequestContext& ctx) { 103 void PushIApplicationManagerInterface(HLERequestContext& ctx) {
104 LOG_DEBUG(Service_NS, "called"); 104 LOG_DEBUG(Service_NS, "called");
105 105
106 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 106 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -110,7 +110,7 @@ private:
110 110
111 template <typename T, typename... Args> 111 template <typename T, typename... Args>
112 std::shared_ptr<T> GetInterface(Args&&... args) const { 112 std::shared_ptr<T> GetInterface(Args&&... args) const {
113 static_assert(std::is_base_of_v<Kernel::SessionRequestHandler, T>, 113 static_assert(std::is_base_of_v<SessionRequestHandler, T>,
114 "Not a base of ServiceFrameworkBase"); 114 "Not a base of ServiceFrameworkBase");
115 115
116 return std::make_shared<T>(std::forward<Args>(args)...); 116 return std::make_shared<T>(std::forward<Args>(args)...);
diff --git a/src/core/hle/service/ns/pdm_qry.cpp b/src/core/hle/service/ns/pdm_qry.cpp
index aac8f573f..ce0ee30e0 100644
--- a/src/core/hle/service/ns/pdm_qry.cpp
+++ b/src/core/hle/service/ns/pdm_qry.cpp
@@ -5,7 +5,7 @@
5 5
6#include "common/logging/log.h" 6#include "common/logging/log.h"
7#include "common/uuid.h" 7#include "common/uuid.h"
8#include "core/hle/ipc_helpers.h" 8#include "core/hle/service/ipc_helpers.h"
9#include "core/hle/service/ns/pdm_qry.h" 9#include "core/hle/service/ns/pdm_qry.h"
10#include "core/hle/service/service.h" 10#include "core/hle/service/service.h"
11 11
@@ -42,7 +42,7 @@ PDM_QRY::PDM_QRY(Core::System& system_) : ServiceFramework{system_, "pdm:qry"} {
42 42
43PDM_QRY::~PDM_QRY() = default; 43PDM_QRY::~PDM_QRY() = default;
44 44
45void PDM_QRY::QueryPlayStatisticsByApplicationIdAndUserAccountId(Kernel::HLERequestContext& ctx) { 45void PDM_QRY::QueryPlayStatisticsByApplicationIdAndUserAccountId(HLERequestContext& ctx) {
46 IPC::RequestParser rp{ctx}; 46 IPC::RequestParser rp{ctx};
47 const auto unknown = rp.Pop<bool>(); 47 const auto unknown = rp.Pop<bool>();
48 rp.Pop<u8>(); // Padding 48 rp.Pop<u8>(); // Padding
diff --git a/src/core/hle/service/ns/pdm_qry.h b/src/core/hle/service/ns/pdm_qry.h
index abcc3bef3..c98e01660 100644
--- a/src/core/hle/service/ns/pdm_qry.h
+++ b/src/core/hle/service/ns/pdm_qry.h
@@ -26,7 +26,7 @@ public:
26 ~PDM_QRY() override; 26 ~PDM_QRY() override;
27 27
28private: 28private:
29 void QueryPlayStatisticsByApplicationIdAndUserAccountId(Kernel::HLERequestContext& ctx); 29 void QueryPlayStatisticsByApplicationIdAndUserAccountId(HLERequestContext& ctx);
30}; 30};
31 31
32} // namespace Service::NS 32} // namespace Service::NS
diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h
index 81bd7960a..bcd0e3ed5 100644
--- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h
+++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h
@@ -8,8 +8,8 @@
8#include "common/common_types.h" 8#include "common/common_types.h"
9#include "common/math_util.h" 9#include "common/math_util.h"
10#include "core/hle/service/nvdrv/devices/nvdevice.h" 10#include "core/hle/service/nvdrv/devices/nvdevice.h"
11#include "core/hle/service/nvflinger/buffer_transform_flags.h" 11#include "core/hle/service/nvnflinger/buffer_transform_flags.h"
12#include "core/hle/service/nvflinger/pixel_format.h" 12#include "core/hle/service/nvnflinger/pixel_format.h"
13 13
14namespace Service::Nvidia::NvCore { 14namespace Service::Nvidia::NvCore {
15class Container; 15class Container;
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp
index a70ea9385..3d774eec4 100644
--- a/src/core/hle/service/nvdrv/nvdrv.cpp
+++ b/src/core/hle/service/nvdrv/nvdrv.cpp
@@ -6,8 +6,8 @@
6 6
7#include <fmt/format.h> 7#include <fmt/format.h>
8#include "core/core.h" 8#include "core/core.h"
9#include "core/hle/ipc_helpers.h"
10#include "core/hle/kernel/k_event.h" 9#include "core/hle/kernel/k_event.h"
10#include "core/hle/service/ipc_helpers.h"
11#include "core/hle/service/nvdrv/core/container.h" 11#include "core/hle/service/nvdrv/core/container.h"
12#include "core/hle/service/nvdrv/devices/nvdevice.h" 12#include "core/hle/service/nvdrv/devices/nvdevice.h"
13#include "core/hle/service/nvdrv/devices/nvdisp_disp0.h" 13#include "core/hle/service/nvdrv/devices/nvdisp_disp0.h"
@@ -23,7 +23,7 @@
23#include "core/hle/service/nvdrv/nvdrv.h" 23#include "core/hle/service/nvdrv/nvdrv.h"
24#include "core/hle/service/nvdrv/nvdrv_interface.h" 24#include "core/hle/service/nvdrv/nvdrv_interface.h"
25#include "core/hle/service/nvdrv/nvmemp.h" 25#include "core/hle/service/nvdrv/nvmemp.h"
26#include "core/hle/service/nvflinger/nvflinger.h" 26#include "core/hle/service/nvnflinger/nvnflinger.h"
27#include "core/hle/service/server_manager.h" 27#include "core/hle/service/server_manager.h"
28#include "video_core/gpu.h" 28#include "video_core/gpu.h"
29 29
@@ -42,7 +42,7 @@ void EventInterface::FreeEvent(Kernel::KEvent* event) {
42 module.service_context.CloseEvent(event); 42 module.service_context.CloseEvent(event);
43} 43}
44 44
45void LoopProcess(NVFlinger::NVFlinger& nvflinger, Core::System& system) { 45void LoopProcess(Nvnflinger::Nvnflinger& nvnflinger, Core::System& system) {
46 auto server_manager = std::make_unique<ServerManager>(system); 46 auto server_manager = std::make_unique<ServerManager>(system);
47 auto module = std::make_shared<Module>(system); 47 auto module = std::make_shared<Module>(system);
48 server_manager->RegisterNamedService("nvdrv", std::make_shared<NVDRV>(system, module, "nvdrv")); 48 server_manager->RegisterNamedService("nvdrv", std::make_shared<NVDRV>(system, module, "nvdrv"));
@@ -53,7 +53,7 @@ void LoopProcess(NVFlinger::NVFlinger& nvflinger, Core::System& system) {
53 server_manager->RegisterNamedService("nvdrv:t", 53 server_manager->RegisterNamedService("nvdrv:t",
54 std::make_shared<NVDRV>(system, module, "nvdrv:t")); 54 std::make_shared<NVDRV>(system, module, "nvdrv:t"));
55 server_manager->RegisterNamedService("nvmemp", std::make_shared<NVMEMP>(system)); 55 server_manager->RegisterNamedService("nvmemp", std::make_shared<NVMEMP>(system));
56 nvflinger.SetNVDrvInstance(module); 56 nvnflinger.SetNVDrvInstance(module);
57 ServerManager::RunServer(std::move(server_manager)); 57 ServerManager::RunServer(std::move(server_manager));
58} 58}
59 59
diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h
index b2270cf76..668be742b 100644
--- a/src/core/hle/service/nvdrv/nvdrv.h
+++ b/src/core/hle/service/nvdrv/nvdrv.h
@@ -16,7 +16,7 @@
16#include "core/hle/service/kernel_helpers.h" 16#include "core/hle/service/kernel_helpers.h"
17#include "core/hle/service/nvdrv/core/container.h" 17#include "core/hle/service/nvdrv/core/container.h"
18#include "core/hle/service/nvdrv/nvdata.h" 18#include "core/hle/service/nvdrv/nvdata.h"
19#include "core/hle/service/nvflinger/ui/fence.h" 19#include "core/hle/service/nvnflinger/ui/fence.h"
20#include "core/hle/service/service.h" 20#include "core/hle/service/service.h"
21 21
22namespace Core { 22namespace Core {
@@ -27,8 +27,8 @@ namespace Kernel {
27class KEvent; 27class KEvent;
28} 28}
29 29
30namespace Service::NVFlinger { 30namespace Service::Nvnflinger {
31class NVFlinger; 31class Nvnflinger;
32} 32}
33 33
34namespace Service::Nvidia { 34namespace Service::Nvidia {
@@ -95,7 +95,7 @@ public:
95 95
96private: 96private:
97 friend class EventInterface; 97 friend class EventInterface;
98 friend class Service::NVFlinger::NVFlinger; 98 friend class Service::Nvnflinger::Nvnflinger;
99 99
100 /// Manages syncpoints on the host 100 /// Manages syncpoints on the host
101 NvCore::Container container; 101 NvCore::Container container;
@@ -114,6 +114,6 @@ private:
114 std::unordered_map<std::string, std::function<FilesContainerType::iterator(DeviceFD)>> builders; 114 std::unordered_map<std::string, std::function<FilesContainerType::iterator(DeviceFD)>> builders;
115}; 115};
116 116
117void LoopProcess(NVFlinger::NVFlinger& nvflinger, Core::System& system); 117void LoopProcess(Nvnflinger::Nvnflinger& nvnflinger, Core::System& system);
118 118
119} // namespace Service::Nvidia 119} // namespace Service::Nvidia
diff --git a/src/core/hle/service/nvdrv/nvdrv_interface.cpp b/src/core/hle/service/nvdrv/nvdrv_interface.cpp
index 396fa7ed5..d010a1e03 100644
--- a/src/core/hle/service/nvdrv/nvdrv_interface.cpp
+++ b/src/core/hle/service/nvdrv/nvdrv_interface.cpp
@@ -5,16 +5,16 @@
5#include <cinttypes> 5#include <cinttypes>
6#include "common/logging/log.h" 6#include "common/logging/log.h"
7#include "core/core.h" 7#include "core/core.h"
8#include "core/hle/ipc_helpers.h"
9#include "core/hle/kernel/k_event.h" 8#include "core/hle/kernel/k_event.h"
10#include "core/hle/kernel/k_readable_event.h" 9#include "core/hle/kernel/k_readable_event.h"
10#include "core/hle/service/ipc_helpers.h"
11#include "core/hle/service/nvdrv/nvdata.h" 11#include "core/hle/service/nvdrv/nvdata.h"
12#include "core/hle/service/nvdrv/nvdrv.h" 12#include "core/hle/service/nvdrv/nvdrv.h"
13#include "core/hle/service/nvdrv/nvdrv_interface.h" 13#include "core/hle/service/nvdrv/nvdrv_interface.h"
14 14
15namespace Service::Nvidia { 15namespace Service::Nvidia {
16 16
17void NVDRV::Open(Kernel::HLERequestContext& ctx) { 17void NVDRV::Open(HLERequestContext& ctx) {
18 LOG_DEBUG(Service_NVDRV, "called"); 18 LOG_DEBUG(Service_NVDRV, "called");
19 IPC::ResponseBuilder rb{ctx, 4}; 19 IPC::ResponseBuilder rb{ctx, 4};
20 rb.Push(ResultSuccess); 20 rb.Push(ResultSuccess);
@@ -44,13 +44,13 @@ void NVDRV::Open(Kernel::HLERequestContext& ctx) {
44 rb.PushEnum(fd != INVALID_NVDRV_FD ? NvResult::Success : NvResult::FileOperationFailed); 44 rb.PushEnum(fd != INVALID_NVDRV_FD ? NvResult::Success : NvResult::FileOperationFailed);
45} 45}
46 46
47void NVDRV::ServiceError(Kernel::HLERequestContext& ctx, NvResult result) { 47void NVDRV::ServiceError(HLERequestContext& ctx, NvResult result) {
48 IPC::ResponseBuilder rb{ctx, 3}; 48 IPC::ResponseBuilder rb{ctx, 3};
49 rb.Push(ResultSuccess); 49 rb.Push(ResultSuccess);
50 rb.PushEnum(result); 50 rb.PushEnum(result);
51} 51}
52 52
53void NVDRV::Ioctl1(Kernel::HLERequestContext& ctx) { 53void NVDRV::Ioctl1(HLERequestContext& ctx) {
54 IPC::RequestParser rp{ctx}; 54 IPC::RequestParser rp{ctx};
55 const auto fd = rp.Pop<DeviceFD>(); 55 const auto fd = rp.Pop<DeviceFD>();
56 const auto command = rp.PopRaw<Ioctl>(); 56 const auto command = rp.PopRaw<Ioctl>();
@@ -76,7 +76,7 @@ void NVDRV::Ioctl1(Kernel::HLERequestContext& ctx) {
76 rb.PushEnum(nv_result); 76 rb.PushEnum(nv_result);
77} 77}
78 78
79void NVDRV::Ioctl2(Kernel::HLERequestContext& ctx) { 79void NVDRV::Ioctl2(HLERequestContext& ctx) {
80 IPC::RequestParser rp{ctx}; 80 IPC::RequestParser rp{ctx};
81 const auto fd = rp.Pop<DeviceFD>(); 81 const auto fd = rp.Pop<DeviceFD>();
82 const auto command = rp.PopRaw<Ioctl>(); 82 const auto command = rp.PopRaw<Ioctl>();
@@ -103,7 +103,7 @@ void NVDRV::Ioctl2(Kernel::HLERequestContext& ctx) {
103 rb.PushEnum(nv_result); 103 rb.PushEnum(nv_result);
104} 104}
105 105
106void NVDRV::Ioctl3(Kernel::HLERequestContext& ctx) { 106void NVDRV::Ioctl3(HLERequestContext& ctx) {
107 IPC::RequestParser rp{ctx}; 107 IPC::RequestParser rp{ctx};
108 const auto fd = rp.Pop<DeviceFD>(); 108 const auto fd = rp.Pop<DeviceFD>();
109 const auto command = rp.PopRaw<Ioctl>(); 109 const auto command = rp.PopRaw<Ioctl>();
@@ -131,7 +131,7 @@ void NVDRV::Ioctl3(Kernel::HLERequestContext& ctx) {
131 rb.PushEnum(nv_result); 131 rb.PushEnum(nv_result);
132} 132}
133 133
134void NVDRV::Close(Kernel::HLERequestContext& ctx) { 134void NVDRV::Close(HLERequestContext& ctx) {
135 LOG_DEBUG(Service_NVDRV, "called"); 135 LOG_DEBUG(Service_NVDRV, "called");
136 136
137 if (!is_initialized) { 137 if (!is_initialized) {
@@ -149,7 +149,7 @@ void NVDRV::Close(Kernel::HLERequestContext& ctx) {
149 rb.PushEnum(result); 149 rb.PushEnum(result);
150} 150}
151 151
152void NVDRV::Initialize(Kernel::HLERequestContext& ctx) { 152void NVDRV::Initialize(HLERequestContext& ctx) {
153 LOG_WARNING(Service_NVDRV, "(STUBBED) called"); 153 LOG_WARNING(Service_NVDRV, "(STUBBED) called");
154 154
155 is_initialized = true; 155 is_initialized = true;
@@ -159,7 +159,7 @@ void NVDRV::Initialize(Kernel::HLERequestContext& ctx) {
159 rb.PushEnum(NvResult::Success); 159 rb.PushEnum(NvResult::Success);
160} 160}
161 161
162void NVDRV::QueryEvent(Kernel::HLERequestContext& ctx) { 162void NVDRV::QueryEvent(HLERequestContext& ctx) {
163 IPC::RequestParser rp{ctx}; 163 IPC::RequestParser rp{ctx};
164 const auto fd = rp.Pop<DeviceFD>(); 164 const auto fd = rp.Pop<DeviceFD>();
165 const auto event_id = rp.Pop<u32>(); 165 const auto event_id = rp.Pop<u32>();
@@ -187,7 +187,7 @@ void NVDRV::QueryEvent(Kernel::HLERequestContext& ctx) {
187 } 187 }
188} 188}
189 189
190void NVDRV::SetAruid(Kernel::HLERequestContext& ctx) { 190void NVDRV::SetAruid(HLERequestContext& ctx) {
191 IPC::RequestParser rp{ctx}; 191 IPC::RequestParser rp{ctx};
192 pid = rp.Pop<u64>(); 192 pid = rp.Pop<u64>();
193 LOG_WARNING(Service_NVDRV, "(STUBBED) called, pid=0x{:X}", pid); 193 LOG_WARNING(Service_NVDRV, "(STUBBED) called, pid=0x{:X}", pid);
@@ -197,14 +197,14 @@ void NVDRV::SetAruid(Kernel::HLERequestContext& ctx) {
197 rb.PushEnum(NvResult::Success); 197 rb.PushEnum(NvResult::Success);
198} 198}
199 199
200void NVDRV::SetGraphicsFirmwareMemoryMarginEnabled(Kernel::HLERequestContext& ctx) { 200void NVDRV::SetGraphicsFirmwareMemoryMarginEnabled(HLERequestContext& ctx) {
201 LOG_WARNING(Service_NVDRV, "(STUBBED) called"); 201 LOG_WARNING(Service_NVDRV, "(STUBBED) called");
202 202
203 IPC::ResponseBuilder rb{ctx, 2}; 203 IPC::ResponseBuilder rb{ctx, 2};
204 rb.Push(ResultSuccess); 204 rb.Push(ResultSuccess);
205} 205}
206 206
207void NVDRV::GetStatus(Kernel::HLERequestContext& ctx) { 207void NVDRV::GetStatus(HLERequestContext& ctx) {
208 LOG_WARNING(Service_NVDRV, "(STUBBED) called"); 208 LOG_WARNING(Service_NVDRV, "(STUBBED) called");
209 209
210 IPC::ResponseBuilder rb{ctx, 3}; 210 IPC::ResponseBuilder rb{ctx, 3};
@@ -212,7 +212,7 @@ void NVDRV::GetStatus(Kernel::HLERequestContext& ctx) {
212 rb.PushEnum(NvResult::Success); 212 rb.PushEnum(NvResult::Success);
213} 213}
214 214
215void NVDRV::DumpGraphicsMemoryInfo(Kernel::HLERequestContext& ctx) { 215void NVDRV::DumpGraphicsMemoryInfo(HLERequestContext& ctx) {
216 // According to SwitchBrew, this has no inputs and no outputs, so effectively does nothing on 216 // According to SwitchBrew, this has no inputs and no outputs, so effectively does nothing on
217 // retail hardware. 217 // retail hardware.
218 LOG_DEBUG(Service_NVDRV, "called"); 218 LOG_DEBUG(Service_NVDRV, "called");
diff --git a/src/core/hle/service/nvdrv/nvdrv_interface.h b/src/core/hle/service/nvdrv/nvdrv_interface.h
index 5ac06ee30..881ea1a6b 100644
--- a/src/core/hle/service/nvdrv/nvdrv_interface.h
+++ b/src/core/hle/service/nvdrv/nvdrv_interface.h
@@ -15,19 +15,19 @@ public:
15 ~NVDRV() override; 15 ~NVDRV() override;
16 16
17private: 17private:
18 void Open(Kernel::HLERequestContext& ctx); 18 void Open(HLERequestContext& ctx);
19 void Ioctl1(Kernel::HLERequestContext& ctx); 19 void Ioctl1(HLERequestContext& ctx);
20 void Ioctl2(Kernel::HLERequestContext& ctx); 20 void Ioctl2(HLERequestContext& ctx);
21 void Ioctl3(Kernel::HLERequestContext& ctx); 21 void Ioctl3(HLERequestContext& ctx);
22 void Close(Kernel::HLERequestContext& ctx); 22 void Close(HLERequestContext& ctx);
23 void Initialize(Kernel::HLERequestContext& ctx); 23 void Initialize(HLERequestContext& ctx);
24 void QueryEvent(Kernel::HLERequestContext& ctx); 24 void QueryEvent(HLERequestContext& ctx);
25 void SetAruid(Kernel::HLERequestContext& ctx); 25 void SetAruid(HLERequestContext& ctx);
26 void SetGraphicsFirmwareMemoryMarginEnabled(Kernel::HLERequestContext& ctx); 26 void SetGraphicsFirmwareMemoryMarginEnabled(HLERequestContext& ctx);
27 void GetStatus(Kernel::HLERequestContext& ctx); 27 void GetStatus(HLERequestContext& ctx);
28 void DumpGraphicsMemoryInfo(Kernel::HLERequestContext& ctx); 28 void DumpGraphicsMemoryInfo(HLERequestContext& ctx);
29 29
30 void ServiceError(Kernel::HLERequestContext& ctx, NvResult result); 30 void ServiceError(HLERequestContext& ctx, NvResult result);
31 31
32 std::shared_ptr<Module> nvdrv; 32 std::shared_ptr<Module> nvdrv;
33 33
diff --git a/src/core/hle/service/nvdrv/nvmemp.cpp b/src/core/hle/service/nvdrv/nvmemp.cpp
index e433580b1..fc10f6406 100644
--- a/src/core/hle/service/nvdrv/nvmemp.cpp
+++ b/src/core/hle/service/nvdrv/nvmemp.cpp
@@ -17,11 +17,11 @@ NVMEMP::NVMEMP(Core::System& system_) : ServiceFramework{system_, "nvmemp"} {
17 17
18NVMEMP::~NVMEMP() = default; 18NVMEMP::~NVMEMP() = default;
19 19
20void NVMEMP::Open(Kernel::HLERequestContext& ctx) { 20void NVMEMP::Open(HLERequestContext& ctx) {
21 UNIMPLEMENTED(); 21 UNIMPLEMENTED();
22} 22}
23 23
24void NVMEMP::GetAruid(Kernel::HLERequestContext& ctx) { 24void NVMEMP::GetAruid(HLERequestContext& ctx) {
25 UNIMPLEMENTED(); 25 UNIMPLEMENTED();
26} 26}
27 27
diff --git a/src/core/hle/service/nvdrv/nvmemp.h b/src/core/hle/service/nvdrv/nvmemp.h
index 3d4276327..85e3053a8 100644
--- a/src/core/hle/service/nvdrv/nvmemp.h
+++ b/src/core/hle/service/nvdrv/nvmemp.h
@@ -17,8 +17,8 @@ public:
17 ~NVMEMP() override; 17 ~NVMEMP() override;
18 18
19private: 19private:
20 void Open(Kernel::HLERequestContext& ctx); 20 void Open(HLERequestContext& ctx);
21 void GetAruid(Kernel::HLERequestContext& ctx); 21 void GetAruid(HLERequestContext& ctx);
22}; 22};
23 23
24} // namespace Service::Nvidia 24} // namespace Service::Nvidia
diff --git a/src/core/hle/service/nvflinger/binder.h b/src/core/hle/service/nvnflinger/binder.h
index 157333ff8..aef1477e3 100644
--- a/src/core/hle/service/nvflinger/binder.h
+++ b/src/core/hle/service/nvnflinger/binder.h
@@ -9,10 +9,13 @@
9#include "common/common_types.h" 9#include "common/common_types.h"
10 10
11namespace Kernel { 11namespace Kernel {
12class HLERequestContext;
13class KReadableEvent; 12class KReadableEvent;
14} // namespace Kernel 13} // namespace Kernel
15 14
15namespace Service {
16class HLERequestContext;
17}
18
16namespace Service::android { 19namespace Service::android {
17 20
18enum class TransactionId { 21enum class TransactionId {
@@ -35,8 +38,7 @@ enum class TransactionId {
35class IBinder { 38class IBinder {
36public: 39public:
37 virtual ~IBinder() = default; 40 virtual ~IBinder() = default;
38 virtual void Transact(Kernel::HLERequestContext& ctx, android::TransactionId code, 41 virtual void Transact(HLERequestContext& ctx, android::TransactionId code, u32 flags) = 0;
39 u32 flags) = 0;
40 virtual Kernel::KReadableEvent& GetNativeHandle() = 0; 42 virtual Kernel::KReadableEvent& GetNativeHandle() = 0;
41}; 43};
42 44
diff --git a/src/core/hle/service/nvflinger/buffer_item.h b/src/core/hle/service/nvnflinger/buffer_item.h
index f73dec4f1..7fd808f54 100644
--- a/src/core/hle/service/nvflinger/buffer_item.h
+++ b/src/core/hle/service/nvnflinger/buffer_item.h
@@ -10,8 +10,8 @@
10 10
11#include "common/common_types.h" 11#include "common/common_types.h"
12#include "common/math_util.h" 12#include "common/math_util.h"
13#include "core/hle/service/nvflinger/ui/fence.h" 13#include "core/hle/service/nvnflinger/ui/fence.h"
14#include "core/hle/service/nvflinger/window.h" 14#include "core/hle/service/nvnflinger/window.h"
15 15
16namespace Service::android { 16namespace Service::android {
17 17
diff --git a/src/core/hle/service/nvflinger/buffer_item_consumer.cpp b/src/core/hle/service/nvnflinger/buffer_item_consumer.cpp
index 152bb5bdf..cf151ea3a 100644
--- a/src/core/hle/service/nvflinger/buffer_item_consumer.cpp
+++ b/src/core/hle/service/nvnflinger/buffer_item_consumer.cpp
@@ -6,9 +6,9 @@
6 6
7#include "common/assert.h" 7#include "common/assert.h"
8#include "common/logging/log.h" 8#include "common/logging/log.h"
9#include "core/hle/service/nvflinger/buffer_item.h" 9#include "core/hle/service/nvnflinger/buffer_item.h"
10#include "core/hle/service/nvflinger/buffer_item_consumer.h" 10#include "core/hle/service/nvnflinger/buffer_item_consumer.h"
11#include "core/hle/service/nvflinger/buffer_queue_consumer.h" 11#include "core/hle/service/nvnflinger/buffer_queue_consumer.h"
12 12
13namespace Service::android { 13namespace Service::android {
14 14
@@ -25,7 +25,7 @@ Status BufferItemConsumer::AcquireBuffer(BufferItem* item, std::chrono::nanoseco
25 25
26 if (const auto status = AcquireBufferLocked(item, present_when); status != Status::NoError) { 26 if (const auto status = AcquireBufferLocked(item, present_when); status != Status::NoError) {
27 if (status != Status::NoBufferAvailable) { 27 if (status != Status::NoBufferAvailable) {
28 LOG_ERROR(Service_NVFlinger, "Failed to acquire buffer: {}", status); 28 LOG_ERROR(Service_Nvnflinger, "Failed to acquire buffer: {}", status);
29 } 29 }
30 return status; 30 return status;
31 } 31 }
@@ -44,12 +44,12 @@ Status BufferItemConsumer::ReleaseBuffer(const BufferItem& item, const Fence& re
44 44
45 if (const auto status = AddReleaseFenceLocked(item.buf, item.graphic_buffer, release_fence); 45 if (const auto status = AddReleaseFenceLocked(item.buf, item.graphic_buffer, release_fence);
46 status != Status::NoError) { 46 status != Status::NoError) {
47 LOG_ERROR(Service_NVFlinger, "Failed to add fence: {}", status); 47 LOG_ERROR(Service_Nvnflinger, "Failed to add fence: {}", status);
48 } 48 }
49 49
50 if (const auto status = ReleaseBufferLocked(item.buf, item.graphic_buffer); 50 if (const auto status = ReleaseBufferLocked(item.buf, item.graphic_buffer);
51 status != Status::NoError) { 51 status != Status::NoError) {
52 LOG_WARNING(Service_NVFlinger, "Failed to release buffer: {}", status); 52 LOG_WARNING(Service_Nvnflinger, "Failed to release buffer: {}", status);
53 return status; 53 return status;
54 } 54 }
55 55
diff --git a/src/core/hle/service/nvflinger/buffer_item_consumer.h b/src/core/hle/service/nvnflinger/buffer_item_consumer.h
index a5c655d9e..e0c6b3604 100644
--- a/src/core/hle/service/nvflinger/buffer_item_consumer.h
+++ b/src/core/hle/service/nvnflinger/buffer_item_consumer.h
@@ -10,8 +10,8 @@
10#include <memory> 10#include <memory>
11 11
12#include "common/common_types.h" 12#include "common/common_types.h"
13#include "core/hle/service/nvflinger/consumer_base.h" 13#include "core/hle/service/nvnflinger/consumer_base.h"
14#include "core/hle/service/nvflinger/status.h" 14#include "core/hle/service/nvnflinger/status.h"
15 15
16namespace Service::android { 16namespace Service::android {
17 17
diff --git a/src/core/hle/service/nvflinger/buffer_queue_consumer.cpp b/src/core/hle/service/nvnflinger/buffer_queue_consumer.cpp
index 0767e548d..51291539d 100644
--- a/src/core/hle/service/nvflinger/buffer_queue_consumer.cpp
+++ b/src/core/hle/service/nvnflinger/buffer_queue_consumer.cpp
@@ -6,11 +6,11 @@
6 6
7#include "common/logging/log.h" 7#include "common/logging/log.h"
8#include "core/hle/service/nvdrv/core/nvmap.h" 8#include "core/hle/service/nvdrv/core/nvmap.h"
9#include "core/hle/service/nvflinger/buffer_item.h" 9#include "core/hle/service/nvnflinger/buffer_item.h"
10#include "core/hle/service/nvflinger/buffer_queue_consumer.h" 10#include "core/hle/service/nvnflinger/buffer_queue_consumer.h"
11#include "core/hle/service/nvflinger/buffer_queue_core.h" 11#include "core/hle/service/nvnflinger/buffer_queue_core.h"
12#include "core/hle/service/nvflinger/producer_listener.h" 12#include "core/hle/service/nvnflinger/producer_listener.h"
13#include "core/hle/service/nvflinger/ui/graphic_buffer.h" 13#include "core/hle/service/nvnflinger/ui/graphic_buffer.h"
14 14
15namespace Service::android { 15namespace Service::android {
16 16
@@ -31,7 +31,7 @@ Status BufferQueueConsumer::AcquireBuffer(BufferItem* out_buffer,
31 }))}; 31 }))};
32 32
33 if (num_acquired_buffers >= core->max_acquired_buffer_count + 1) { 33 if (num_acquired_buffers >= core->max_acquired_buffer_count + 1) {
34 LOG_ERROR(Service_NVFlinger, "max acquired buffer count reached: {} (max {})", 34 LOG_ERROR(Service_Nvnflinger, "max acquired buffer count reached: {} (max {})",
35 num_acquired_buffers, core->max_acquired_buffer_count); 35 num_acquired_buffers, core->max_acquired_buffer_count);
36 return Status::InvalidOperation; 36 return Status::InvalidOperation;
37 } 37 }
@@ -57,12 +57,12 @@ Status BufferQueueConsumer::AcquireBuffer(BufferItem* out_buffer,
57 if (desired_present < expected_present.count() - MAX_REASONABLE_NSEC || 57 if (desired_present < expected_present.count() - MAX_REASONABLE_NSEC ||
58 desired_present > expected_present.count()) { 58 desired_present > expected_present.count()) {
59 // This buffer is set to display in the near future, or desired_present is garbage. 59 // This buffer is set to display in the near future, or desired_present is garbage.
60 LOG_DEBUG(Service_NVFlinger, "nodrop desire={} expect={}", desired_present, 60 LOG_DEBUG(Service_Nvnflinger, "nodrop desire={} expect={}", desired_present,
61 expected_present.count()); 61 expected_present.count());
62 break; 62 break;
63 } 63 }
64 64
65 LOG_DEBUG(Service_NVFlinger, "drop desire={} expect={} size={}", desired_present, 65 LOG_DEBUG(Service_Nvnflinger, "drop desire={} expect={} size={}", desired_present,
66 expected_present.count(), core->queue.size()); 66 expected_present.count(), core->queue.size());
67 67
68 if (core->StillTracking(*front)) { 68 if (core->StillTracking(*front)) {
@@ -78,19 +78,19 @@ Status BufferQueueConsumer::AcquireBuffer(BufferItem* out_buffer,
78 const auto desired_present = front->timestamp; 78 const auto desired_present = front->timestamp;
79 if (desired_present > expected_present.count() && 79 if (desired_present > expected_present.count() &&
80 desired_present < expected_present.count() + MAX_REASONABLE_NSEC) { 80 desired_present < expected_present.count() + MAX_REASONABLE_NSEC) {
81 LOG_DEBUG(Service_NVFlinger, "defer desire={} expect={}", desired_present, 81 LOG_DEBUG(Service_Nvnflinger, "defer desire={} expect={}", desired_present,
82 expected_present.count()); 82 expected_present.count());
83 return Status::PresentLater; 83 return Status::PresentLater;
84 } 84 }
85 85
86 LOG_DEBUG(Service_NVFlinger, "accept desire={} expect={}", desired_present, 86 LOG_DEBUG(Service_Nvnflinger, "accept desire={} expect={}", desired_present,
87 expected_present.count()); 87 expected_present.count());
88 } 88 }
89 89
90 const auto slot = front->slot; 90 const auto slot = front->slot;
91 *out_buffer = *front; 91 *out_buffer = *front;
92 92
93 LOG_DEBUG(Service_NVFlinger, "acquiring slot={}", slot); 93 LOG_DEBUG(Service_Nvnflinger, "acquiring slot={}", slot);
94 94
95 // If the buffer has previously been acquired by the consumer, set graphic_buffer to nullptr to 95 // If the buffer has previously been acquired by the consumer, set graphic_buffer to nullptr to
96 // avoid unnecessarily remapping this buffer on the consumer side. 96 // avoid unnecessarily remapping this buffer on the consumer side.
@@ -109,7 +109,7 @@ Status BufferQueueConsumer::AcquireBuffer(BufferItem* out_buffer,
109 109
110Status BufferQueueConsumer::ReleaseBuffer(s32 slot, u64 frame_number, const Fence& release_fence) { 110Status BufferQueueConsumer::ReleaseBuffer(s32 slot, u64 frame_number, const Fence& release_fence) {
111 if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS) { 111 if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS) {
112 LOG_ERROR(Service_NVFlinger, "slot {} out of range", slot); 112 LOG_ERROR(Service_Nvnflinger, "slot {} out of range", slot);
113 return Status::BadValue; 113 return Status::BadValue;
114 } 114 }
115 115
@@ -127,7 +127,7 @@ Status BufferQueueConsumer::ReleaseBuffer(s32 slot, u64 frame_number, const Fenc
127 auto current(core->queue.begin()); 127 auto current(core->queue.begin());
128 while (current != core->queue.end()) { 128 while (current != core->queue.end()) {
129 if (current->slot == slot) { 129 if (current->slot == slot) {
130 LOG_ERROR(Service_NVFlinger, "buffer slot {} pending release is currently queued", 130 LOG_ERROR(Service_Nvnflinger, "buffer slot {} pending release is currently queued",
131 slot); 131 slot);
132 return Status::BadValue; 132 return Status::BadValue;
133 } 133 }
@@ -140,7 +140,7 @@ Status BufferQueueConsumer::ReleaseBuffer(s32 slot, u64 frame_number, const Fenc
140 140
141 listener = core->connected_producer_listener; 141 listener = core->connected_producer_listener;
142 142
143 LOG_DEBUG(Service_NVFlinger, "releasing slot {}", slot); 143 LOG_DEBUG(Service_Nvnflinger, "releasing slot {}", slot);
144 144
145 core->SignalDequeueCondition(); 145 core->SignalDequeueCondition();
146 } 146 }
@@ -156,16 +156,16 @@ Status BufferQueueConsumer::ReleaseBuffer(s32 slot, u64 frame_number, const Fenc
156Status BufferQueueConsumer::Connect(std::shared_ptr<IConsumerListener> consumer_listener, 156Status BufferQueueConsumer::Connect(std::shared_ptr<IConsumerListener> consumer_listener,
157 bool controlled_by_app) { 157 bool controlled_by_app) {
158 if (consumer_listener == nullptr) { 158 if (consumer_listener == nullptr) {
159 LOG_ERROR(Service_NVFlinger, "consumer_listener may not be nullptr"); 159 LOG_ERROR(Service_Nvnflinger, "consumer_listener may not be nullptr");
160 return Status::BadValue; 160 return Status::BadValue;
161 } 161 }
162 162
163 LOG_DEBUG(Service_NVFlinger, "controlled_by_app={}", controlled_by_app); 163 LOG_DEBUG(Service_Nvnflinger, "controlled_by_app={}", controlled_by_app);
164 164
165 std::scoped_lock lock{core->mutex}; 165 std::scoped_lock lock{core->mutex};
166 166
167 if (core->is_abandoned) { 167 if (core->is_abandoned) {
168 LOG_ERROR(Service_NVFlinger, "BufferQueue has been abandoned"); 168 LOG_ERROR(Service_Nvnflinger, "BufferQueue has been abandoned");
169 return Status::NoInit; 169 return Status::NoInit;
170 } 170 }
171 171
@@ -177,14 +177,14 @@ Status BufferQueueConsumer::Connect(std::shared_ptr<IConsumerListener> consumer_
177 177
178Status BufferQueueConsumer::GetReleasedBuffers(u64* out_slot_mask) { 178Status BufferQueueConsumer::GetReleasedBuffers(u64* out_slot_mask) {
179 if (out_slot_mask == nullptr) { 179 if (out_slot_mask == nullptr) {
180 LOG_ERROR(Service_NVFlinger, "out_slot_mask may not be nullptr"); 180 LOG_ERROR(Service_Nvnflinger, "out_slot_mask may not be nullptr");
181 return Status::BadValue; 181 return Status::BadValue;
182 } 182 }
183 183
184 std::scoped_lock lock{core->mutex}; 184 std::scoped_lock lock{core->mutex};
185 185
186 if (core->is_abandoned) { 186 if (core->is_abandoned) {
187 LOG_ERROR(Service_NVFlinger, "BufferQueue has been abandoned"); 187 LOG_ERROR(Service_Nvnflinger, "BufferQueue has been abandoned");
188 return Status::NoInit; 188 return Status::NoInit;
189 } 189 }
190 190
@@ -205,7 +205,7 @@ Status BufferQueueConsumer::GetReleasedBuffers(u64* out_slot_mask) {
205 ++current; 205 ++current;
206 } 206 }
207 207
208 LOG_DEBUG(Service_NVFlinger, "returning mask {}", mask); 208 LOG_DEBUG(Service_Nvnflinger, "returning mask {}", mask);
209 *out_slot_mask = mask; 209 *out_slot_mask = mask;
210 return Status::NoError; 210 return Status::NoError;
211} 211}
diff --git a/src/core/hle/service/nvflinger/buffer_queue_consumer.h b/src/core/hle/service/nvnflinger/buffer_queue_consumer.h
index 4ec06ca13..50ed0bb5f 100644
--- a/src/core/hle/service/nvflinger/buffer_queue_consumer.h
+++ b/src/core/hle/service/nvnflinger/buffer_queue_consumer.h
@@ -10,8 +10,8 @@
10#include <memory> 10#include <memory>
11 11
12#include "common/common_types.h" 12#include "common/common_types.h"
13#include "core/hle/service/nvflinger/buffer_queue_defs.h" 13#include "core/hle/service/nvnflinger/buffer_queue_defs.h"
14#include "core/hle/service/nvflinger/status.h" 14#include "core/hle/service/nvnflinger/status.h"
15 15
16namespace Service::Nvidia::NvCore { 16namespace Service::Nvidia::NvCore {
17class NvMap; 17class NvMap;
diff --git a/src/core/hle/service/nvflinger/buffer_queue_core.cpp b/src/core/hle/service/nvnflinger/buffer_queue_core.cpp
index 3d1338e66..2dbe29616 100644
--- a/src/core/hle/service/nvflinger/buffer_queue_core.cpp
+++ b/src/core/hle/service/nvnflinger/buffer_queue_core.cpp
@@ -6,7 +6,7 @@
6 6
7#include "common/assert.h" 7#include "common/assert.h"
8 8
9#include "core/hle/service/nvflinger/buffer_queue_core.h" 9#include "core/hle/service/nvnflinger/buffer_queue_core.h"
10 10
11namespace Service::android { 11namespace Service::android {
12 12
@@ -82,7 +82,7 @@ s32 BufferQueueCore::GetPreallocatedBufferCountLocked() const {
82} 82}
83 83
84void BufferQueueCore::FreeBufferLocked(s32 slot) { 84void BufferQueueCore::FreeBufferLocked(s32 slot) {
85 LOG_DEBUG(Service_NVFlinger, "slot {}", slot); 85 LOG_DEBUG(Service_Nvnflinger, "slot {}", slot);
86 86
87 slots[slot].graphic_buffer.reset(); 87 slots[slot].graphic_buffer.reset();
88 88
diff --git a/src/core/hle/service/nvflinger/buffer_queue_core.h b/src/core/hle/service/nvnflinger/buffer_queue_core.h
index 85b3bc4c1..9164f08a0 100644
--- a/src/core/hle/service/nvflinger/buffer_queue_core.h
+++ b/src/core/hle/service/nvnflinger/buffer_queue_core.h
@@ -13,11 +13,11 @@
13#include <set> 13#include <set>
14#include <vector> 14#include <vector>
15 15
16#include "core/hle/service/nvflinger/buffer_item.h" 16#include "core/hle/service/nvnflinger/buffer_item.h"
17#include "core/hle/service/nvflinger/buffer_queue_defs.h" 17#include "core/hle/service/nvnflinger/buffer_queue_defs.h"
18#include "core/hle/service/nvflinger/pixel_format.h" 18#include "core/hle/service/nvnflinger/pixel_format.h"
19#include "core/hle/service/nvflinger/status.h" 19#include "core/hle/service/nvnflinger/status.h"
20#include "core/hle/service/nvflinger/window.h" 20#include "core/hle/service/nvnflinger/window.h"
21 21
22namespace Service::android { 22namespace Service::android {
23 23
diff --git a/src/core/hle/service/nvflinger/buffer_queue_defs.h b/src/core/hle/service/nvnflinger/buffer_queue_defs.h
index 334445213..6fd3156f4 100644
--- a/src/core/hle/service/nvflinger/buffer_queue_defs.h
+++ b/src/core/hle/service/nvnflinger/buffer_queue_defs.h
@@ -9,7 +9,7 @@
9#include <array> 9#include <array>
10 10
11#include "common/common_types.h" 11#include "common/common_types.h"
12#include "core/hle/service/nvflinger/buffer_slot.h" 12#include "core/hle/service/nvnflinger/buffer_slot.h"
13 13
14namespace Service::android::BufferQueueDefs { 14namespace Service::android::BufferQueueDefs {
15 15
diff --git a/src/core/hle/service/nvflinger/buffer_queue_producer.cpp b/src/core/hle/service/nvnflinger/buffer_queue_producer.cpp
index bcbe05b0d..cd0a13094 100644
--- a/src/core/hle/service/nvflinger/buffer_queue_producer.cpp
+++ b/src/core/hle/service/nvnflinger/buffer_queue_producer.cpp
@@ -8,18 +8,18 @@
8#include "common/logging/log.h" 8#include "common/logging/log.h"
9#include "common/settings.h" 9#include "common/settings.h"
10#include "core/core.h" 10#include "core/core.h"
11#include "core/hle/kernel/hle_ipc.h"
12#include "core/hle/kernel/k_event.h" 11#include "core/hle/kernel/k_event.h"
13#include "core/hle/kernel/k_readable_event.h" 12#include "core/hle/kernel/k_readable_event.h"
14#include "core/hle/kernel/kernel.h" 13#include "core/hle/kernel/kernel.h"
14#include "core/hle/service/hle_ipc.h"
15#include "core/hle/service/kernel_helpers.h" 15#include "core/hle/service/kernel_helpers.h"
16#include "core/hle/service/nvdrv/core/nvmap.h" 16#include "core/hle/service/nvdrv/core/nvmap.h"
17#include "core/hle/service/nvflinger/buffer_queue_core.h" 17#include "core/hle/service/nvnflinger/buffer_queue_core.h"
18#include "core/hle/service/nvflinger/buffer_queue_producer.h" 18#include "core/hle/service/nvnflinger/buffer_queue_producer.h"
19#include "core/hle/service/nvflinger/consumer_listener.h" 19#include "core/hle/service/nvnflinger/consumer_listener.h"
20#include "core/hle/service/nvflinger/parcel.h" 20#include "core/hle/service/nvnflinger/parcel.h"
21#include "core/hle/service/nvflinger/ui/graphic_buffer.h" 21#include "core/hle/service/nvnflinger/ui/graphic_buffer.h"
22#include "core/hle/service/nvflinger/window.h" 22#include "core/hle/service/nvnflinger/window.h"
23#include "core/hle/service/vi/vi.h" 23#include "core/hle/service/vi/vi.h"
24 24
25namespace Service::android { 25namespace Service::android {
@@ -37,20 +37,20 @@ BufferQueueProducer::~BufferQueueProducer() {
37} 37}
38 38
39Status BufferQueueProducer::RequestBuffer(s32 slot, std::shared_ptr<GraphicBuffer>* buf) { 39Status BufferQueueProducer::RequestBuffer(s32 slot, std::shared_ptr<GraphicBuffer>* buf) {
40 LOG_DEBUG(Service_NVFlinger, "slot {}", slot); 40 LOG_DEBUG(Service_Nvnflinger, "slot {}", slot);
41 41
42 std::scoped_lock lock{core->mutex}; 42 std::scoped_lock lock{core->mutex};
43 43
44 if (core->is_abandoned) { 44 if (core->is_abandoned) {
45 LOG_ERROR(Service_NVFlinger, "BufferQueue has been abandoned"); 45 LOG_ERROR(Service_Nvnflinger, "BufferQueue has been abandoned");
46 return Status::NoInit; 46 return Status::NoInit;
47 } 47 }
48 if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS) { 48 if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS) {
49 LOG_ERROR(Service_NVFlinger, "slot index {} out of range [0, {})", slot, 49 LOG_ERROR(Service_Nvnflinger, "slot index {} out of range [0, {})", slot,
50 BufferQueueDefs::NUM_BUFFER_SLOTS); 50 BufferQueueDefs::NUM_BUFFER_SLOTS);
51 return Status::BadValue; 51 return Status::BadValue;
52 } else if (slots[slot].buffer_state != BufferState::Dequeued) { 52 } else if (slots[slot].buffer_state != BufferState::Dequeued) {
53 LOG_ERROR(Service_NVFlinger, "slot {} is not owned by the producer (state = {})", slot, 53 LOG_ERROR(Service_Nvnflinger, "slot {} is not owned by the producer (state = {})", slot,
54 slots[slot].buffer_state); 54 slots[slot].buffer_state);
55 return Status::BadValue; 55 return Status::BadValue;
56 } 56 }
@@ -62,7 +62,7 @@ Status BufferQueueProducer::RequestBuffer(s32 slot, std::shared_ptr<GraphicBuffe
62} 62}
63 63
64Status BufferQueueProducer::SetBufferCount(s32 buffer_count) { 64Status BufferQueueProducer::SetBufferCount(s32 buffer_count) {
65 LOG_DEBUG(Service_NVFlinger, "count = {}", buffer_count); 65 LOG_DEBUG(Service_Nvnflinger, "count = {}", buffer_count);
66 66
67 std::shared_ptr<IConsumerListener> listener; 67 std::shared_ptr<IConsumerListener> listener;
68 { 68 {
@@ -70,12 +70,12 @@ Status BufferQueueProducer::SetBufferCount(s32 buffer_count) {
70 core->WaitWhileAllocatingLocked(); 70 core->WaitWhileAllocatingLocked();
71 71
72 if (core->is_abandoned) { 72 if (core->is_abandoned) {
73 LOG_ERROR(Service_NVFlinger, "BufferQueue has been abandoned"); 73 LOG_ERROR(Service_Nvnflinger, "BufferQueue has been abandoned");
74 return Status::NoInit; 74 return Status::NoInit;
75 } 75 }
76 76
77 if (buffer_count > BufferQueueDefs::NUM_BUFFER_SLOTS) { 77 if (buffer_count > BufferQueueDefs::NUM_BUFFER_SLOTS) {
78 LOG_ERROR(Service_NVFlinger, "buffer_count {} too large (max {})", buffer_count, 78 LOG_ERROR(Service_Nvnflinger, "buffer_count {} too large (max {})", buffer_count,
79 BufferQueueDefs::NUM_BUFFER_SLOTS); 79 BufferQueueDefs::NUM_BUFFER_SLOTS);
80 return Status::BadValue; 80 return Status::BadValue;
81 } 81 }
@@ -83,7 +83,7 @@ Status BufferQueueProducer::SetBufferCount(s32 buffer_count) {
83 // There must be no dequeued buffers when changing the buffer count. 83 // There must be no dequeued buffers when changing the buffer count.
84 for (s32 s{}; s < BufferQueueDefs::NUM_BUFFER_SLOTS; ++s) { 84 for (s32 s{}; s < BufferQueueDefs::NUM_BUFFER_SLOTS; ++s) {
85 if (slots[s].buffer_state == BufferState::Dequeued) { 85 if (slots[s].buffer_state == BufferState::Dequeued) {
86 LOG_ERROR(Service_NVFlinger, "buffer owned by producer"); 86 LOG_ERROR(Service_Nvnflinger, "buffer owned by producer");
87 return Status::BadValue; 87 return Status::BadValue;
88 } 88 }
89 } 89 }
@@ -96,7 +96,7 @@ Status BufferQueueProducer::SetBufferCount(s32 buffer_count) {
96 96
97 const s32 min_buffer_slots = core->GetMinMaxBufferCountLocked(false); 97 const s32 min_buffer_slots = core->GetMinMaxBufferCountLocked(false);
98 if (buffer_count < min_buffer_slots) { 98 if (buffer_count < min_buffer_slots) {
99 LOG_ERROR(Service_NVFlinger, "requested buffer count {} is less than minimum {}", 99 LOG_ERROR(Service_Nvnflinger, "requested buffer count {} is less than minimum {}",
100 buffer_count, min_buffer_slots); 100 buffer_count, min_buffer_slots);
101 return Status::BadValue; 101 return Status::BadValue;
102 } 102 }
@@ -127,14 +127,14 @@ Status BufferQueueProducer::WaitForFreeSlotThenRelock(bool async, s32* found, St
127 127
128 while (try_again) { 128 while (try_again) {
129 if (core->is_abandoned) { 129 if (core->is_abandoned) {
130 LOG_ERROR(Service_NVFlinger, "BufferQueue has been abandoned"); 130 LOG_ERROR(Service_Nvnflinger, "BufferQueue has been abandoned");
131 return Status::NoInit; 131 return Status::NoInit;
132 } 132 }
133 133
134 const s32 max_buffer_count = core->GetMaxBufferCountLocked(async); 134 const s32 max_buffer_count = core->GetMaxBufferCountLocked(async);
135 if (async && core->override_max_buffer_count) { 135 if (async && core->override_max_buffer_count) {
136 if (core->override_max_buffer_count < max_buffer_count) { 136 if (core->override_max_buffer_count < max_buffer_count) {
137 LOG_ERROR(Service_NVFlinger, "async mode is invalid with buffer count override"); 137 LOG_ERROR(Service_Nvnflinger, "async mode is invalid with buffer count override");
138 return Status::BadValue; 138 return Status::BadValue;
139 } 139 }
140 } 140 }
@@ -176,7 +176,7 @@ Status BufferQueueProducer::WaitForFreeSlotThenRelock(bool async, s32* found, St
176 // Producers are not allowed to dequeue more than one buffer if they did not set a buffer 176 // Producers are not allowed to dequeue more than one buffer if they did not set a buffer
177 // count 177 // count
178 if (!core->override_max_buffer_count && dequeued_count) { 178 if (!core->override_max_buffer_count && dequeued_count) {
179 LOG_ERROR(Service_NVFlinger, 179 LOG_ERROR(Service_Nvnflinger,
180 "can't dequeue multiple buffers without setting the buffer count"); 180 "can't dequeue multiple buffers without setting the buffer count");
181 return Status::InvalidOperation; 181 return Status::InvalidOperation;
182 } 182 }
@@ -188,7 +188,7 @@ Status BufferQueueProducer::WaitForFreeSlotThenRelock(bool async, s32* found, St
188 const s32 new_undequeued_count = max_buffer_count - (dequeued_count + 1); 188 const s32 new_undequeued_count = max_buffer_count - (dequeued_count + 1);
189 const s32 min_undequeued_count = core->GetMinUndequeuedBufferCountLocked(async); 189 const s32 min_undequeued_count = core->GetMinUndequeuedBufferCountLocked(async);
190 if (new_undequeued_count < min_undequeued_count) { 190 if (new_undequeued_count < min_undequeued_count) {
191 LOG_ERROR(Service_NVFlinger, 191 LOG_ERROR(Service_Nvnflinger,
192 "min undequeued buffer count({}) exceeded (dequeued={} undequeued={})", 192 "min undequeued buffer count({}) exceeded (dequeued={} undequeued={})",
193 min_undequeued_count, dequeued_count, new_undequeued_count); 193 min_undequeued_count, dequeued_count, new_undequeued_count);
194 return Status::InvalidOperation; 194 return Status::InvalidOperation;
@@ -200,7 +200,7 @@ Status BufferQueueProducer::WaitForFreeSlotThenRelock(bool async, s32* found, St
200 // outrun the consumer. Wait here if it looks like we have too many buffers queued up. 200 // outrun the consumer. Wait here if it looks like we have too many buffers queued up.
201 const bool too_many_buffers = core->queue.size() > static_cast<size_t>(max_buffer_count); 201 const bool too_many_buffers = core->queue.size() > static_cast<size_t>(max_buffer_count);
202 if (too_many_buffers) { 202 if (too_many_buffers) {
203 LOG_ERROR(Service_NVFlinger, "queue size is {}, waiting", core->queue.size()); 203 LOG_ERROR(Service_Nvnflinger, "queue size is {}, waiting", core->queue.size());
204 } 204 }
205 205
206 // If no buffer is found, or if the queue has too many buffers outstanding, wait for a 206 // If no buffer is found, or if the queue has too many buffers outstanding, wait for a
@@ -226,11 +226,11 @@ Status BufferQueueProducer::WaitForFreeSlotThenRelock(bool async, s32* found, St
226 226
227Status BufferQueueProducer::DequeueBuffer(s32* out_slot, Fence* out_fence, bool async, u32 width, 227Status BufferQueueProducer::DequeueBuffer(s32* out_slot, Fence* out_fence, bool async, u32 width,
228 u32 height, PixelFormat format, u32 usage) { 228 u32 height, PixelFormat format, u32 usage) {
229 LOG_DEBUG(Service_NVFlinger, "async={} w={} h={} format={}, usage={}", async ? "true" : "false", 229 LOG_DEBUG(Service_Nvnflinger, "async={} w={} h={} format={}, usage={}",
230 width, height, format, usage); 230 async ? "true" : "false", width, height, format, usage);
231 231
232 if ((width != 0 && height == 0) || (width == 0 && height != 0)) { 232 if ((width != 0 && height == 0) || (width == 0 && height != 0)) {
233 LOG_ERROR(Service_NVFlinger, "invalid size: w={} h={}", width, height); 233 LOG_ERROR(Service_Nvnflinger, "invalid size: w={} h={}", width, height);
234 return Status::BadValue; 234 return Status::BadValue;
235 } 235 }
236 236
@@ -255,7 +255,7 @@ Status BufferQueueProducer::DequeueBuffer(s32* out_slot, Fence* out_fence, bool
255 255
256 // This should not happen 256 // This should not happen
257 if (found == BufferQueueCore::INVALID_BUFFER_SLOT) { 257 if (found == BufferQueueCore::INVALID_BUFFER_SLOT) {
258 LOG_ERROR(Service_NVFlinger, "no available buffer slots"); 258 LOG_ERROR(Service_Nvnflinger, "no available buffer slots");
259 return Status::Busy; 259 return Status::Busy;
260 } 260 }
261 261
@@ -287,11 +287,11 @@ Status BufferQueueProducer::DequeueBuffer(s32* out_slot, Fence* out_fence, bool
287 } 287 }
288 288
289 if ((return_flags & Status::BufferNeedsReallocation) != Status::None) { 289 if ((return_flags & Status::BufferNeedsReallocation) != Status::None) {
290 LOG_DEBUG(Service_NVFlinger, "allocating a new buffer for slot {}", *out_slot); 290 LOG_DEBUG(Service_Nvnflinger, "allocating a new buffer for slot {}", *out_slot);
291 291
292 auto graphic_buffer = std::make_shared<GraphicBuffer>(width, height, format, usage); 292 auto graphic_buffer = std::make_shared<GraphicBuffer>(width, height, format, usage);
293 if (graphic_buffer == nullptr) { 293 if (graphic_buffer == nullptr) {
294 LOG_ERROR(Service_NVFlinger, "creating GraphicBuffer failed"); 294 LOG_ERROR(Service_Nvnflinger, "creating GraphicBuffer failed");
295 return Status::NoMemory; 295 return Status::NoMemory;
296 } 296 }
297 297
@@ -299,7 +299,7 @@ Status BufferQueueProducer::DequeueBuffer(s32* out_slot, Fence* out_fence, bool
299 std::scoped_lock lock{core->mutex}; 299 std::scoped_lock lock{core->mutex};
300 300
301 if (core->is_abandoned) { 301 if (core->is_abandoned) {
302 LOG_ERROR(Service_NVFlinger, "BufferQueue has been abandoned"); 302 LOG_ERROR(Service_Nvnflinger, "BufferQueue has been abandoned");
303 return Status::NoInit; 303 return Status::NoInit;
304 } 304 }
305 305
@@ -312,32 +312,32 @@ Status BufferQueueProducer::DequeueBuffer(s32* out_slot, Fence* out_fence, bool
312 return_flags |= Status::BufferNeedsReallocation; 312 return_flags |= Status::BufferNeedsReallocation;
313 } 313 }
314 314
315 LOG_DEBUG(Service_NVFlinger, "returning slot={} frame={}, flags={}", *out_slot, 315 LOG_DEBUG(Service_Nvnflinger, "returning slot={} frame={}, flags={}", *out_slot,
316 slots[*out_slot].frame_number, return_flags); 316 slots[*out_slot].frame_number, return_flags);
317 317
318 return return_flags; 318 return return_flags;
319} 319}
320 320
321Status BufferQueueProducer::DetachBuffer(s32 slot) { 321Status BufferQueueProducer::DetachBuffer(s32 slot) {
322 LOG_DEBUG(Service_NVFlinger, "slot {}", slot); 322 LOG_DEBUG(Service_Nvnflinger, "slot {}", slot);
323 323
324 std::scoped_lock lock{core->mutex}; 324 std::scoped_lock lock{core->mutex};
325 325
326 if (core->is_abandoned) { 326 if (core->is_abandoned) {
327 LOG_ERROR(Service_NVFlinger, "BufferQueue has been abandoned"); 327 LOG_ERROR(Service_Nvnflinger, "BufferQueue has been abandoned");
328 return Status::NoInit; 328 return Status::NoInit;
329 } 329 }
330 330
331 if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS) { 331 if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS) {
332 LOG_ERROR(Service_NVFlinger, "slot {} out of range [0, {})", slot, 332 LOG_ERROR(Service_Nvnflinger, "slot {} out of range [0, {})", slot,
333 BufferQueueDefs::NUM_BUFFER_SLOTS); 333 BufferQueueDefs::NUM_BUFFER_SLOTS);
334 return Status::BadValue; 334 return Status::BadValue;
335 } else if (slots[slot].buffer_state != BufferState::Dequeued) { 335 } else if (slots[slot].buffer_state != BufferState::Dequeued) {
336 LOG_ERROR(Service_NVFlinger, "slot {} is not owned by the producer (state = {})", slot, 336 LOG_ERROR(Service_Nvnflinger, "slot {} is not owned by the producer (state = {})", slot,
337 slots[slot].buffer_state); 337 slots[slot].buffer_state);
338 return Status::BadValue; 338 return Status::BadValue;
339 } else if (!slots[slot].request_buffer_called) { 339 } else if (!slots[slot].request_buffer_called) {
340 LOG_ERROR(Service_NVFlinger, "buffer in slot {} has not been requested", slot); 340 LOG_ERROR(Service_Nvnflinger, "buffer in slot {} has not been requested", slot);
341 return Status::BadValue; 341 return Status::BadValue;
342 } 342 }
343 343
@@ -350,10 +350,10 @@ Status BufferQueueProducer::DetachBuffer(s32 slot) {
350Status BufferQueueProducer::DetachNextBuffer(std::shared_ptr<GraphicBuffer>* out_buffer, 350Status BufferQueueProducer::DetachNextBuffer(std::shared_ptr<GraphicBuffer>* out_buffer,
351 Fence* out_fence) { 351 Fence* out_fence) {
352 if (out_buffer == nullptr) { 352 if (out_buffer == nullptr) {
353 LOG_ERROR(Service_NVFlinger, "out_buffer must not be nullptr"); 353 LOG_ERROR(Service_Nvnflinger, "out_buffer must not be nullptr");
354 return Status::BadValue; 354 return Status::BadValue;
355 } else if (out_fence == nullptr) { 355 } else if (out_fence == nullptr) {
356 LOG_ERROR(Service_NVFlinger, "out_fence must not be nullptr"); 356 LOG_ERROR(Service_Nvnflinger, "out_fence must not be nullptr");
357 return Status::BadValue; 357 return Status::BadValue;
358 } 358 }
359 359
@@ -361,7 +361,7 @@ Status BufferQueueProducer::DetachNextBuffer(std::shared_ptr<GraphicBuffer>* out
361 core->WaitWhileAllocatingLocked(); 361 core->WaitWhileAllocatingLocked();
362 362
363 if (core->is_abandoned) { 363 if (core->is_abandoned) {
364 LOG_ERROR(Service_NVFlinger, "BufferQueue has been abandoned"); 364 LOG_ERROR(Service_Nvnflinger, "BufferQueue has been abandoned");
365 return Status::NoInit; 365 return Status::NoInit;
366 } 366 }
367 367
@@ -380,7 +380,7 @@ Status BufferQueueProducer::DetachNextBuffer(std::shared_ptr<GraphicBuffer>* out
380 return Status::NoMemory; 380 return Status::NoMemory;
381 } 381 }
382 382
383 LOG_DEBUG(Service_NVFlinger, "Detached slot {}", found); 383 LOG_DEBUG(Service_Nvnflinger, "Detached slot {}", found);
384 384
385 *out_buffer = slots[found].graphic_buffer; 385 *out_buffer = slots[found].graphic_buffer;
386 *out_fence = slots[found].fence; 386 *out_fence = slots[found].fence;
@@ -393,10 +393,10 @@ Status BufferQueueProducer::DetachNextBuffer(std::shared_ptr<GraphicBuffer>* out
393Status BufferQueueProducer::AttachBuffer(s32* out_slot, 393Status BufferQueueProducer::AttachBuffer(s32* out_slot,
394 const std::shared_ptr<GraphicBuffer>& buffer) { 394 const std::shared_ptr<GraphicBuffer>& buffer) {
395 if (out_slot == nullptr) { 395 if (out_slot == nullptr) {
396 LOG_ERROR(Service_NVFlinger, "out_slot must not be nullptr"); 396 LOG_ERROR(Service_Nvnflinger, "out_slot must not be nullptr");
397 return Status::BadValue; 397 return Status::BadValue;
398 } else if (buffer == nullptr) { 398 } else if (buffer == nullptr) {
399 LOG_ERROR(Service_NVFlinger, "Cannot attach nullptr buffer"); 399 LOG_ERROR(Service_Nvnflinger, "Cannot attach nullptr buffer");
400 return Status::BadValue; 400 return Status::BadValue;
401 } 401 }
402 402
@@ -413,13 +413,13 @@ Status BufferQueueProducer::AttachBuffer(s32* out_slot,
413 413
414 // This should not happen 414 // This should not happen
415 if (found == BufferQueueCore::INVALID_BUFFER_SLOT) { 415 if (found == BufferQueueCore::INVALID_BUFFER_SLOT) {
416 LOG_ERROR(Service_NVFlinger, "No available buffer slots"); 416 LOG_ERROR(Service_Nvnflinger, "No available buffer slots");
417 return Status::Busy; 417 return Status::Busy;
418 } 418 }
419 419
420 *out_slot = found; 420 *out_slot = found;
421 421
422 LOG_DEBUG(Service_NVFlinger, "Returning slot {} flags={}", *out_slot, return_flags); 422 LOG_DEBUG(Service_Nvnflinger, "Returning slot {} flags={}", *out_slot, return_flags);
423 423
424 slots[*out_slot].graphic_buffer = buffer; 424 slots[*out_slot].graphic_buffer = buffer;
425 slots[*out_slot].buffer_state = BufferState::Dequeued; 425 slots[*out_slot].buffer_state = BufferState::Dequeued;
@@ -451,7 +451,7 @@ Status BufferQueueProducer::QueueBuffer(s32 slot, const QueueBufferInput& input,
451 case NativeWindowScalingMode::NoScaleCrop: 451 case NativeWindowScalingMode::NoScaleCrop:
452 break; 452 break;
453 default: 453 default:
454 LOG_ERROR(Service_NVFlinger, "unknown scaling mode {}", scaling_mode); 454 LOG_ERROR(Service_Nvnflinger, "unknown scaling mode {}", scaling_mode);
455 return Status::BadValue; 455 return Status::BadValue;
456 } 456 }
457 457
@@ -464,38 +464,38 @@ Status BufferQueueProducer::QueueBuffer(s32 slot, const QueueBufferInput& input,
464 std::scoped_lock lock{core->mutex}; 464 std::scoped_lock lock{core->mutex};
465 465
466 if (core->is_abandoned) { 466 if (core->is_abandoned) {
467 LOG_ERROR(Service_NVFlinger, "BufferQueue has been abandoned"); 467 LOG_ERROR(Service_Nvnflinger, "BufferQueue has been abandoned");
468 return Status::NoInit; 468 return Status::NoInit;
469 } 469 }
470 470
471 const s32 max_buffer_count = core->GetMaxBufferCountLocked(async); 471 const s32 max_buffer_count = core->GetMaxBufferCountLocked(async);
472 if (async && core->override_max_buffer_count) { 472 if (async && core->override_max_buffer_count) {
473 if (core->override_max_buffer_count < max_buffer_count) { 473 if (core->override_max_buffer_count < max_buffer_count) {
474 LOG_ERROR(Service_NVFlinger, "async mode is invalid with " 474 LOG_ERROR(Service_Nvnflinger, "async mode is invalid with "
475 "buffer count override"); 475 "buffer count override");
476 return Status::BadValue; 476 return Status::BadValue;
477 } 477 }
478 } 478 }
479 479
480 if (slot < 0 || slot >= max_buffer_count) { 480 if (slot < 0 || slot >= max_buffer_count) {
481 LOG_ERROR(Service_NVFlinger, "slot index {} out of range [0, {})", slot, 481 LOG_ERROR(Service_Nvnflinger, "slot index {} out of range [0, {})", slot,
482 max_buffer_count); 482 max_buffer_count);
483 return Status::BadValue; 483 return Status::BadValue;
484 } else if (slots[slot].buffer_state != BufferState::Dequeued) { 484 } else if (slots[slot].buffer_state != BufferState::Dequeued) {
485 LOG_ERROR(Service_NVFlinger, 485 LOG_ERROR(Service_Nvnflinger,
486 "slot {} is not owned by the producer " 486 "slot {} is not owned by the producer "
487 "(state = {})", 487 "(state = {})",
488 slot, slots[slot].buffer_state); 488 slot, slots[slot].buffer_state);
489 return Status::BadValue; 489 return Status::BadValue;
490 } else if (!slots[slot].request_buffer_called) { 490 } else if (!slots[slot].request_buffer_called) {
491 LOG_ERROR(Service_NVFlinger, 491 LOG_ERROR(Service_Nvnflinger,
492 "slot {} was queued without requesting " 492 "slot {} was queued without requesting "
493 "a buffer", 493 "a buffer",
494 slot); 494 slot);
495 return Status::BadValue; 495 return Status::BadValue;
496 } 496 }
497 497
498 LOG_DEBUG(Service_NVFlinger, 498 LOG_DEBUG(Service_Nvnflinger,
499 "slot={} frame={} time={} crop=[{},{},{},{}] transform={} scale={}", slot, 499 "slot={} frame={} time={} crop=[{},{},{},{}] transform={} scale={}", slot,
500 core->frame_counter + 1, timestamp, crop.Left(), crop.Top(), crop.Right(), 500 core->frame_counter + 1, timestamp, crop.Left(), crop.Top(), crop.Right(),
501 crop.Bottom(), transform, scaling_mode); 501 crop.Bottom(), transform, scaling_mode);
@@ -506,7 +506,7 @@ Status BufferQueueProducer::QueueBuffer(s32 slot, const QueueBufferInput& input,
506 [[maybe_unused]] const bool unused = crop.Intersect(buffer_rect, &cropped_rect); 506 [[maybe_unused]] const bool unused = crop.Intersect(buffer_rect, &cropped_rect);
507 507
508 if (cropped_rect != crop) { 508 if (cropped_rect != crop) {
509 LOG_ERROR(Service_NVFlinger, "crop rect is not contained within the buffer in slot {}", 509 LOG_ERROR(Service_Nvnflinger, "crop rect is not contained within the buffer in slot {}",
510 slot); 510 slot);
511 return Status::BadValue; 511 return Status::BadValue;
512 } 512 }
@@ -598,21 +598,21 @@ Status BufferQueueProducer::QueueBuffer(s32 slot, const QueueBufferInput& input,
598} 598}
599 599
600void BufferQueueProducer::CancelBuffer(s32 slot, const Fence& fence) { 600void BufferQueueProducer::CancelBuffer(s32 slot, const Fence& fence) {
601 LOG_DEBUG(Service_NVFlinger, "slot {}", slot); 601 LOG_DEBUG(Service_Nvnflinger, "slot {}", slot);
602 602
603 std::scoped_lock lock{core->mutex}; 603 std::scoped_lock lock{core->mutex};
604 604
605 if (core->is_abandoned) { 605 if (core->is_abandoned) {
606 LOG_ERROR(Service_NVFlinger, "BufferQueue has been abandoned"); 606 LOG_ERROR(Service_Nvnflinger, "BufferQueue has been abandoned");
607 return; 607 return;
608 } 608 }
609 609
610 if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS) { 610 if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS) {
611 LOG_ERROR(Service_NVFlinger, "slot index {} out of range [0, {})", slot, 611 LOG_ERROR(Service_Nvnflinger, "slot index {} out of range [0, {})", slot,
612 BufferQueueDefs::NUM_BUFFER_SLOTS); 612 BufferQueueDefs::NUM_BUFFER_SLOTS);
613 return; 613 return;
614 } else if (slots[slot].buffer_state != BufferState::Dequeued) { 614 } else if (slots[slot].buffer_state != BufferState::Dequeued) {
615 LOG_ERROR(Service_NVFlinger, "slot {} is not owned by the producer (state = {})", slot, 615 LOG_ERROR(Service_Nvnflinger, "slot {} is not owned by the producer (state = {})", slot,
616 slots[slot].buffer_state); 616 slots[slot].buffer_state);
617 return; 617 return;
618 } 618 }
@@ -629,12 +629,12 @@ Status BufferQueueProducer::Query(NativeWindow what, s32* out_value) {
629 std::scoped_lock lock{core->mutex}; 629 std::scoped_lock lock{core->mutex};
630 630
631 if (out_value == nullptr) { 631 if (out_value == nullptr) {
632 LOG_ERROR(Service_NVFlinger, "outValue was nullptr"); 632 LOG_ERROR(Service_Nvnflinger, "outValue was nullptr");
633 return Status::BadValue; 633 return Status::BadValue;
634 } 634 }
635 635
636 if (core->is_abandoned) { 636 if (core->is_abandoned) {
637 LOG_ERROR(Service_NVFlinger, "BufferQueue has been abandoned"); 637 LOG_ERROR(Service_Nvnflinger, "BufferQueue has been abandoned");
638 return Status::NoInit; 638 return Status::NoInit;
639 } 639 }
640 640
@@ -666,7 +666,7 @@ Status BufferQueueProducer::Query(NativeWindow what, s32* out_value) {
666 return Status::BadValue; 666 return Status::BadValue;
667 } 667 }
668 668
669 LOG_DEBUG(Service_NVFlinger, "what = {}, value = {}", what, value); 669 LOG_DEBUG(Service_Nvnflinger, "what = {}, value = {}", what, value);
670 670
671 *out_value = static_cast<s32>(value); 671 *out_value = static_cast<s32>(value);
672 672
@@ -678,26 +678,26 @@ Status BufferQueueProducer::Connect(const std::shared_ptr<IProducerListener>& li
678 QueueBufferOutput* output) { 678 QueueBufferOutput* output) {
679 std::scoped_lock lock{core->mutex}; 679 std::scoped_lock lock{core->mutex};
680 680
681 LOG_DEBUG(Service_NVFlinger, "api = {} producer_controlled_by_app = {}", api, 681 LOG_DEBUG(Service_Nvnflinger, "api = {} producer_controlled_by_app = {}", api,
682 producer_controlled_by_app); 682 producer_controlled_by_app);
683 683
684 if (core->is_abandoned) { 684 if (core->is_abandoned) {
685 LOG_ERROR(Service_NVFlinger, "BufferQueue has been abandoned"); 685 LOG_ERROR(Service_Nvnflinger, "BufferQueue has been abandoned");
686 return Status::NoInit; 686 return Status::NoInit;
687 } 687 }
688 688
689 if (core->consumer_listener == nullptr) { 689 if (core->consumer_listener == nullptr) {
690 LOG_ERROR(Service_NVFlinger, "BufferQueue has no consumer"); 690 LOG_ERROR(Service_Nvnflinger, "BufferQueue has no consumer");
691 return Status::NoInit; 691 return Status::NoInit;
692 } 692 }
693 693
694 if (output == nullptr) { 694 if (output == nullptr) {
695 LOG_ERROR(Service_NVFlinger, "output was nullptr"); 695 LOG_ERROR(Service_Nvnflinger, "output was nullptr");
696 return Status::BadValue; 696 return Status::BadValue;
697 } 697 }
698 698
699 if (core->connected_api != NativeWindowApi::NoConnectedApi) { 699 if (core->connected_api != NativeWindowApi::NoConnectedApi) {
700 LOG_ERROR(Service_NVFlinger, "already connected (cur = {} req = {})", core->connected_api, 700 LOG_ERROR(Service_Nvnflinger, "already connected (cur = {} req = {})", core->connected_api,
701 api); 701 api);
702 return Status::BadValue; 702 return Status::BadValue;
703 } 703 }
@@ -714,7 +714,7 @@ Status BufferQueueProducer::Connect(const std::shared_ptr<IProducerListener>& li
714 core->connected_producer_listener = listener; 714 core->connected_producer_listener = listener;
715 break; 715 break;
716 default: 716 default:
717 LOG_ERROR(Service_NVFlinger, "unknown api = {}", api); 717 LOG_ERROR(Service_Nvnflinger, "unknown api = {}", api);
718 status = Status::BadValue; 718 status = Status::BadValue;
719 break; 719 break;
720 } 720 }
@@ -727,7 +727,7 @@ Status BufferQueueProducer::Connect(const std::shared_ptr<IProducerListener>& li
727} 727}
728 728
729Status BufferQueueProducer::Disconnect(NativeWindowApi api) { 729Status BufferQueueProducer::Disconnect(NativeWindowApi api) {
730 LOG_DEBUG(Service_NVFlinger, "api = {}", api); 730 LOG_DEBUG(Service_Nvnflinger, "api = {}", api);
731 731
732 Status status = Status::NoError; 732 Status status = Status::NoError;
733 std::shared_ptr<IConsumerListener> listener; 733 std::shared_ptr<IConsumerListener> listener;
@@ -762,13 +762,13 @@ Status BufferQueueProducer::Disconnect(NativeWindowApi api) {
762 buffer_wait_event->Signal(); 762 buffer_wait_event->Signal();
763 listener = core->consumer_listener; 763 listener = core->consumer_listener;
764 } else { 764 } else {
765 LOG_ERROR(Service_NVFlinger, "still connected to another api (cur = {} req = {})", 765 LOG_ERROR(Service_Nvnflinger, "still connected to another api (cur = {} req = {})",
766 core->connected_api, api); 766 core->connected_api, api);
767 status = Status::BadValue; 767 status = Status::BadValue;
768 } 768 }
769 break; 769 break;
770 default: 770 default:
771 LOG_ERROR(Service_NVFlinger, "unknown api = {}", api); 771 LOG_ERROR(Service_Nvnflinger, "unknown api = {}", api);
772 status = Status::BadValue; 772 status = Status::BadValue;
773 break; 773 break;
774 } 774 }
@@ -784,7 +784,7 @@ Status BufferQueueProducer::Disconnect(NativeWindowApi api) {
784 784
785Status BufferQueueProducer::SetPreallocatedBuffer(s32 slot, 785Status BufferQueueProducer::SetPreallocatedBuffer(s32 slot,
786 const std::shared_ptr<GraphicBuffer>& buffer) { 786 const std::shared_ptr<GraphicBuffer>& buffer) {
787 LOG_DEBUG(Service_NVFlinger, "slot {}", slot); 787 LOG_DEBUG(Service_Nvnflinger, "slot {}", slot);
788 788
789 if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS) { 789 if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS) {
790 return Status::BadValue; 790 return Status::BadValue;
@@ -813,7 +813,7 @@ Status BufferQueueProducer::SetPreallocatedBuffer(s32 slot,
813 return Status::NoError; 813 return Status::NoError;
814} 814}
815 815
816void BufferQueueProducer::Transact(Kernel::HLERequestContext& ctx, TransactionId code, u32 flags) { 816void BufferQueueProducer::Transact(HLERequestContext& ctx, TransactionId code, u32 flags) {
817 Status status{Status::NoError}; 817 Status status{Status::NoError};
818 InputParcel parcel_in{ctx.ReadBuffer()}; 818 InputParcel parcel_in{ctx.ReadBuffer()};
819 OutputParcel parcel_out{}; 819 OutputParcel parcel_out{};
@@ -914,7 +914,7 @@ void BufferQueueProducer::Transact(Kernel::HLERequestContext& ctx, TransactionId
914 break; 914 break;
915 } 915 }
916 case TransactionId::GetBufferHistory: 916 case TransactionId::GetBufferHistory:
917 LOG_WARNING(Service_NVFlinger, "(STUBBED) called, transaction=GetBufferHistory"); 917 LOG_WARNING(Service_Nvnflinger, "(STUBBED) called, transaction=GetBufferHistory");
918 break; 918 break;
919 default: 919 default:
920 ASSERT_MSG(false, "Unimplemented TransactionId {}", code); 920 ASSERT_MSG(false, "Unimplemented TransactionId {}", code);
diff --git a/src/core/hle/service/nvflinger/buffer_queue_producer.h b/src/core/hle/service/nvnflinger/buffer_queue_producer.h
index 1d380480f..d4201c104 100644
--- a/src/core/hle/service/nvflinger/buffer_queue_producer.h
+++ b/src/core/hle/service/nvnflinger/buffer_queue_producer.h
@@ -12,13 +12,13 @@
12 12
13#include "common/common_funcs.h" 13#include "common/common_funcs.h"
14#include "core/hle/service/nvdrv/nvdata.h" 14#include "core/hle/service/nvdrv/nvdata.h"
15#include "core/hle/service/nvflinger/binder.h" 15#include "core/hle/service/nvnflinger/binder.h"
16#include "core/hle/service/nvflinger/buffer_queue_defs.h" 16#include "core/hle/service/nvnflinger/buffer_queue_defs.h"
17#include "core/hle/service/nvflinger/buffer_slot.h" 17#include "core/hle/service/nvnflinger/buffer_slot.h"
18#include "core/hle/service/nvflinger/graphic_buffer_producer.h" 18#include "core/hle/service/nvnflinger/graphic_buffer_producer.h"
19#include "core/hle/service/nvflinger/pixel_format.h" 19#include "core/hle/service/nvnflinger/pixel_format.h"
20#include "core/hle/service/nvflinger/status.h" 20#include "core/hle/service/nvnflinger/status.h"
21#include "core/hle/service/nvflinger/window.h" 21#include "core/hle/service/nvnflinger/window.h"
22 22
23namespace Kernel { 23namespace Kernel {
24class KernelCore; 24class KernelCore;
@@ -46,7 +46,7 @@ public:
46 Service::Nvidia::NvCore::NvMap& nvmap_); 46 Service::Nvidia::NvCore::NvMap& nvmap_);
47 ~BufferQueueProducer(); 47 ~BufferQueueProducer();
48 48
49 void Transact(Kernel::HLERequestContext& ctx, android::TransactionId code, u32 flags) override; 49 void Transact(HLERequestContext& ctx, android::TransactionId code, u32 flags) override;
50 50
51 Kernel::KReadableEvent& GetNativeHandle() override; 51 Kernel::KReadableEvent& GetNativeHandle() override;
52 52
diff --git a/src/core/hle/service/nvflinger/buffer_slot.h b/src/core/hle/service/nvnflinger/buffer_slot.h
index 0cd0e9964..d25bca049 100644
--- a/src/core/hle/service/nvflinger/buffer_slot.h
+++ b/src/core/hle/service/nvnflinger/buffer_slot.h
@@ -9,7 +9,7 @@
9#include <memory> 9#include <memory>
10 10
11#include "common/common_types.h" 11#include "common/common_types.h"
12#include "core/hle/service/nvflinger/ui/fence.h" 12#include "core/hle/service/nvnflinger/ui/fence.h"
13 13
14namespace Service::android { 14namespace Service::android {
15 15
diff --git a/src/core/hle/service/nvflinger/buffer_transform_flags.h b/src/core/hle/service/nvnflinger/buffer_transform_flags.h
index 67aa5dad6..67aa5dad6 100644
--- a/src/core/hle/service/nvflinger/buffer_transform_flags.h
+++ b/src/core/hle/service/nvnflinger/buffer_transform_flags.h
diff --git a/src/core/hle/service/nvflinger/consumer_base.cpp b/src/core/hle/service/nvnflinger/consumer_base.cpp
index 982531e2d..4dcda8dac 100644
--- a/src/core/hle/service/nvflinger/consumer_base.cpp
+++ b/src/core/hle/service/nvnflinger/consumer_base.cpp
@@ -6,11 +6,11 @@
6 6
7#include "common/assert.h" 7#include "common/assert.h"
8#include "common/logging/log.h" 8#include "common/logging/log.h"
9#include "core/hle/service/nvflinger/buffer_item.h" 9#include "core/hle/service/nvnflinger/buffer_item.h"
10#include "core/hle/service/nvflinger/buffer_queue_consumer.h" 10#include "core/hle/service/nvnflinger/buffer_queue_consumer.h"
11#include "core/hle/service/nvflinger/buffer_queue_core.h" 11#include "core/hle/service/nvnflinger/buffer_queue_core.h"
12#include "core/hle/service/nvflinger/consumer_base.h" 12#include "core/hle/service/nvnflinger/consumer_base.h"
13#include "core/hle/service/nvflinger/ui/graphic_buffer.h" 13#include "core/hle/service/nvnflinger/ui/graphic_buffer.h"
14 14
15namespace Service::android { 15namespace Service::android {
16 16
@@ -28,7 +28,7 @@ void ConsumerBase::Connect(bool controlled_by_app) {
28} 28}
29 29
30void ConsumerBase::FreeBufferLocked(s32 slot_index) { 30void ConsumerBase::FreeBufferLocked(s32 slot_index) {
31 LOG_DEBUG(Service_NVFlinger, "slot_index={}", slot_index); 31 LOG_DEBUG(Service_Nvnflinger, "slot_index={}", slot_index);
32 32
33 slots[slot_index].graphic_buffer = nullptr; 33 slots[slot_index].graphic_buffer = nullptr;
34 slots[slot_index].fence = Fence::NoFence(); 34 slots[slot_index].fence = Fence::NoFence();
@@ -36,17 +36,17 @@ void ConsumerBase::FreeBufferLocked(s32 slot_index) {
36} 36}
37 37
38void ConsumerBase::OnFrameAvailable(const BufferItem& item) { 38void ConsumerBase::OnFrameAvailable(const BufferItem& item) {
39 LOG_DEBUG(Service_NVFlinger, "called"); 39 LOG_DEBUG(Service_Nvnflinger, "called");
40} 40}
41 41
42void ConsumerBase::OnFrameReplaced(const BufferItem& item) { 42void ConsumerBase::OnFrameReplaced(const BufferItem& item) {
43 LOG_DEBUG(Service_NVFlinger, "called"); 43 LOG_DEBUG(Service_Nvnflinger, "called");
44} 44}
45 45
46void ConsumerBase::OnBuffersReleased() { 46void ConsumerBase::OnBuffersReleased() {
47 std::scoped_lock lock{mutex}; 47 std::scoped_lock lock{mutex};
48 48
49 LOG_DEBUG(Service_NVFlinger, "called"); 49 LOG_DEBUG(Service_Nvnflinger, "called");
50 50
51 if (is_abandoned) { 51 if (is_abandoned) {
52 // Nothing to do if we're already abandoned. 52 // Nothing to do if we're already abandoned.
@@ -77,7 +77,7 @@ Status ConsumerBase::AcquireBufferLocked(BufferItem* item, std::chrono::nanoseco
77 slots[item->slot].frame_number = item->frame_number; 77 slots[item->slot].frame_number = item->frame_number;
78 slots[item->slot].fence = item->fence; 78 slots[item->slot].fence = item->fence;
79 79
80 LOG_DEBUG(Service_NVFlinger, "slot={}", item->slot); 80 LOG_DEBUG(Service_Nvnflinger, "slot={}", item->slot);
81 81
82 return Status::NoError; 82 return Status::NoError;
83} 83}
@@ -85,7 +85,7 @@ Status ConsumerBase::AcquireBufferLocked(BufferItem* item, std::chrono::nanoseco
85Status ConsumerBase::AddReleaseFenceLocked(s32 slot, 85Status ConsumerBase::AddReleaseFenceLocked(s32 slot,
86 const std::shared_ptr<GraphicBuffer>& graphic_buffer, 86 const std::shared_ptr<GraphicBuffer>& graphic_buffer,
87 const Fence& fence) { 87 const Fence& fence) {
88 LOG_DEBUG(Service_NVFlinger, "slot={}", slot); 88 LOG_DEBUG(Service_Nvnflinger, "slot={}", slot);
89 89
90 // If consumer no longer tracks this graphic_buffer, we can safely 90 // If consumer no longer tracks this graphic_buffer, we can safely
91 // drop this fence, as it will never be received by the producer. 91 // drop this fence, as it will never be received by the producer.
@@ -109,7 +109,7 @@ Status ConsumerBase::ReleaseBufferLocked(s32 slot,
109 return Status::NoError; 109 return Status::NoError;
110 } 110 }
111 111
112 LOG_DEBUG(Service_NVFlinger, "slot={}", slot); 112 LOG_DEBUG(Service_Nvnflinger, "slot={}", slot);
113 Status err = consumer->ReleaseBuffer(slot, slots[slot].frame_number, slots[slot].fence); 113 Status err = consumer->ReleaseBuffer(slot, slots[slot].frame_number, slots[slot].fence);
114 if (err == Status::StaleBufferSlot) { 114 if (err == Status::StaleBufferSlot) {
115 FreeBufferLocked(slot); 115 FreeBufferLocked(slot);
diff --git a/src/core/hle/service/nvflinger/consumer_base.h b/src/core/hle/service/nvnflinger/consumer_base.h
index 9a8a5f6bb..264829414 100644
--- a/src/core/hle/service/nvflinger/consumer_base.h
+++ b/src/core/hle/service/nvnflinger/consumer_base.h
@@ -12,9 +12,9 @@
12#include <mutex> 12#include <mutex>
13 13
14#include "common/common_types.h" 14#include "common/common_types.h"
15#include "core/hle/service/nvflinger/buffer_queue_defs.h" 15#include "core/hle/service/nvnflinger/buffer_queue_defs.h"
16#include "core/hle/service/nvflinger/consumer_listener.h" 16#include "core/hle/service/nvnflinger/consumer_listener.h"
17#include "core/hle/service/nvflinger/status.h" 17#include "core/hle/service/nvnflinger/status.h"
18 18
19namespace Service::android { 19namespace Service::android {
20 20
diff --git a/src/core/hle/service/nvflinger/consumer_listener.h b/src/core/hle/service/nvnflinger/consumer_listener.h
index 74a193988..74a193988 100644
--- a/src/core/hle/service/nvflinger/consumer_listener.h
+++ b/src/core/hle/service/nvnflinger/consumer_listener.h
diff --git a/src/core/hle/service/nvflinger/graphic_buffer_producer.cpp b/src/core/hle/service/nvnflinger/graphic_buffer_producer.cpp
index 769e8c0a3..d72b49a8e 100644
--- a/src/core/hle/service/nvflinger/graphic_buffer_producer.cpp
+++ b/src/core/hle/service/nvnflinger/graphic_buffer_producer.cpp
@@ -4,8 +4,8 @@
4// Parts of this implementation were based on: 4// Parts of this implementation were based on:
5// https://cs.android.com/android/platform/superproject/+/android-5.1.1_r38:frameworks/native/libs/gui/IGraphicBufferProducer.cpp 5// https://cs.android.com/android/platform/superproject/+/android-5.1.1_r38:frameworks/native/libs/gui/IGraphicBufferProducer.cpp
6 6
7#include "core/hle/service/nvflinger/graphic_buffer_producer.h" 7#include "core/hle/service/nvnflinger/graphic_buffer_producer.h"
8#include "core/hle/service/nvflinger/parcel.h" 8#include "core/hle/service/nvnflinger/parcel.h"
9 9
10namespace Service::android { 10namespace Service::android {
11 11
diff --git a/src/core/hle/service/nvflinger/graphic_buffer_producer.h b/src/core/hle/service/nvnflinger/graphic_buffer_producer.h
index 2969f0fd5..21d7b31f3 100644
--- a/src/core/hle/service/nvflinger/graphic_buffer_producer.h
+++ b/src/core/hle/service/nvnflinger/graphic_buffer_producer.h
@@ -9,8 +9,8 @@
9#include "common/common_funcs.h" 9#include "common/common_funcs.h"
10#include "common/common_types.h" 10#include "common/common_types.h"
11#include "common/math_util.h" 11#include "common/math_util.h"
12#include "core/hle/service/nvflinger/ui/fence.h" 12#include "core/hle/service/nvnflinger/ui/fence.h"
13#include "core/hle/service/nvflinger/window.h" 13#include "core/hle/service/nvnflinger/window.h"
14 14
15namespace Service::android { 15namespace Service::android {
16 16
diff --git a/src/core/hle/service/nvflinger/hos_binder_driver_server.cpp b/src/core/hle/service/nvnflinger/hos_binder_driver_server.cpp
index dc9b2a9ec..b86a79ec9 100644
--- a/src/core/hle/service/nvflinger/hos_binder_driver_server.cpp
+++ b/src/core/hle/service/nvnflinger/hos_binder_driver_server.cpp
@@ -4,9 +4,9 @@
4#include <mutex> 4#include <mutex>
5 5
6#include "common/common_types.h" 6#include "common/common_types.h"
7#include "core/hle/service/nvflinger/hos_binder_driver_server.h" 7#include "core/hle/service/nvnflinger/hos_binder_driver_server.h"
8 8
9namespace Service::NVFlinger { 9namespace Service::Nvnflinger {
10 10
11HosBinderDriverServer::HosBinderDriverServer(Core::System& system_) 11HosBinderDriverServer::HosBinderDriverServer(Core::System& system_)
12 : service_context(system_, "HosBinderDriverServer") {} 12 : service_context(system_, "HosBinderDriverServer") {}
@@ -33,4 +33,4 @@ android::IBinder* HosBinderDriverServer::TryGetProducer(u64 id) {
33 return {}; 33 return {};
34} 34}
35 35
36} // namespace Service::NVFlinger 36} // namespace Service::Nvnflinger
diff --git a/src/core/hle/service/nvflinger/hos_binder_driver_server.h b/src/core/hle/service/nvnflinger/hos_binder_driver_server.h
index 8fddc1206..58bb9469a 100644
--- a/src/core/hle/service/nvflinger/hos_binder_driver_server.h
+++ b/src/core/hle/service/nvnflinger/hos_binder_driver_server.h
@@ -9,13 +9,13 @@
9 9
10#include "common/common_types.h" 10#include "common/common_types.h"
11#include "core/hle/service/kernel_helpers.h" 11#include "core/hle/service/kernel_helpers.h"
12#include "core/hle/service/nvflinger/binder.h" 12#include "core/hle/service/nvnflinger/binder.h"
13 13
14namespace Core { 14namespace Core {
15class System; 15class System;
16} 16}
17 17
18namespace Service::NVFlinger { 18namespace Service::Nvnflinger {
19 19
20class HosBinderDriverServer final { 20class HosBinderDriverServer final {
21public: 21public:
@@ -34,4 +34,4 @@ private:
34 u64 last_id{}; 34 u64 last_id{};
35}; 35};
36 36
37} // namespace Service::NVFlinger 37} // namespace Service::Nvnflinger
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvnflinger/nvnflinger.cpp
index f4416f5b2..4988e6e17 100644
--- a/src/core/hle/service/nvflinger/nvflinger.cpp
+++ b/src/core/hle/service/nvnflinger/nvnflinger.cpp
@@ -15,11 +15,11 @@
15#include "core/hle/kernel/k_readable_event.h" 15#include "core/hle/kernel/k_readable_event.h"
16#include "core/hle/service/nvdrv/devices/nvdisp_disp0.h" 16#include "core/hle/service/nvdrv/devices/nvdisp_disp0.h"
17#include "core/hle/service/nvdrv/nvdrv.h" 17#include "core/hle/service/nvdrv/nvdrv.h"
18#include "core/hle/service/nvflinger/buffer_item_consumer.h" 18#include "core/hle/service/nvnflinger/buffer_item_consumer.h"
19#include "core/hle/service/nvflinger/buffer_queue_core.h" 19#include "core/hle/service/nvnflinger/buffer_queue_core.h"
20#include "core/hle/service/nvflinger/hos_binder_driver_server.h" 20#include "core/hle/service/nvnflinger/hos_binder_driver_server.h"
21#include "core/hle/service/nvflinger/nvflinger.h" 21#include "core/hle/service/nvnflinger/nvnflinger.h"
22#include "core/hle/service/nvflinger/ui/graphic_buffer.h" 22#include "core/hle/service/nvnflinger/ui/graphic_buffer.h"
23#include "core/hle/service/vi/display/vi_display.h" 23#include "core/hle/service/vi/display/vi_display.h"
24#include "core/hle/service/vi/layer/vi_layer.h" 24#include "core/hle/service/vi/layer/vi_layer.h"
25#include "core/hle/service/vi/vi_results.h" 25#include "core/hle/service/vi/vi_results.h"
@@ -27,11 +27,11 @@
27#include "video_core/host1x/host1x.h" 27#include "video_core/host1x/host1x.h"
28#include "video_core/host1x/syncpoint_manager.h" 28#include "video_core/host1x/syncpoint_manager.h"
29 29
30namespace Service::NVFlinger { 30namespace Service::Nvnflinger {
31 31
32constexpr auto frame_ns = std::chrono::nanoseconds{1000000000 / 60}; 32constexpr auto frame_ns = std::chrono::nanoseconds{1000000000 / 60};
33 33
34void NVFlinger::SplitVSync(std::stop_token stop_token) { 34void Nvnflinger::SplitVSync(std::stop_token stop_token) {
35 system.RegisterHostThread(); 35 system.RegisterHostThread();
36 std::string name = "VSyncThread"; 36 std::string name = "VSyncThread";
37 MicroProfileOnThreadCreate(name.c_str()); 37 MicroProfileOnThreadCreate(name.c_str());
@@ -54,8 +54,8 @@ void NVFlinger::SplitVSync(std::stop_token stop_token) {
54 } 54 }
55} 55}
56 56
57NVFlinger::NVFlinger(Core::System& system_, HosBinderDriverServer& hos_binder_driver_server_) 57Nvnflinger::Nvnflinger(Core::System& system_, HosBinderDriverServer& hos_binder_driver_server_)
58 : system(system_), service_context(system_, "nvflinger"), 58 : system(system_), service_context(system_, "nvnflinger"),
59 hos_binder_driver_server(hos_binder_driver_server_) { 59 hos_binder_driver_server(hos_binder_driver_server_) {
60 displays.emplace_back(0, "Default", hos_binder_driver_server, service_context, system); 60 displays.emplace_back(0, "Default", hos_binder_driver_server, service_context, system);
61 displays.emplace_back(1, "External", hos_binder_driver_server, service_context, system); 61 displays.emplace_back(1, "External", hos_binder_driver_server, service_context, system);
@@ -92,7 +92,7 @@ NVFlinger::NVFlinger(Core::System& system_, HosBinderDriverServer& hos_binder_dr
92 } 92 }
93} 93}
94 94
95NVFlinger::~NVFlinger() { 95Nvnflinger::~Nvnflinger() {
96 if (system.IsMulticore()) { 96 if (system.IsMulticore()) {
97 system.CoreTiming().UnscheduleEvent(multi_composition_event, {}); 97 system.CoreTiming().UnscheduleEvent(multi_composition_event, {});
98 vsync_thread.request_stop(); 98 vsync_thread.request_stop();
@@ -109,7 +109,7 @@ NVFlinger::~NVFlinger() {
109 } 109 }
110} 110}
111 111
112void NVFlinger::ShutdownLayers() { 112void Nvnflinger::ShutdownLayers() {
113 for (auto& display : displays) { 113 for (auto& display : displays) {
114 for (size_t layer = 0; layer < display.GetNumLayers(); ++layer) { 114 for (size_t layer = 0; layer < display.GetNumLayers(); ++layer) {
115 display.GetLayer(layer).Core().NotifyShutdown(); 115 display.GetLayer(layer).Core().NotifyShutdown();
@@ -117,15 +117,15 @@ void NVFlinger::ShutdownLayers() {
117 } 117 }
118} 118}
119 119
120void NVFlinger::SetNVDrvInstance(std::shared_ptr<Nvidia::Module> instance) { 120void Nvnflinger::SetNVDrvInstance(std::shared_ptr<Nvidia::Module> instance) {
121 nvdrv = std::move(instance); 121 nvdrv = std::move(instance);
122 disp_fd = nvdrv->Open("/dev/nvdisp_disp0"); 122 disp_fd = nvdrv->Open("/dev/nvdisp_disp0");
123} 123}
124 124
125std::optional<u64> NVFlinger::OpenDisplay(std::string_view name) { 125std::optional<u64> Nvnflinger::OpenDisplay(std::string_view name) {
126 const auto lock_guard = Lock(); 126 const auto lock_guard = Lock();
127 127
128 LOG_DEBUG(Service_NVFlinger, "Opening \"{}\" display", name); 128 LOG_DEBUG(Service_Nvnflinger, "Opening \"{}\" display", name);
129 129
130 const auto itr = 130 const auto itr =
131 std::find_if(displays.begin(), displays.end(), 131 std::find_if(displays.begin(), displays.end(),
@@ -138,7 +138,7 @@ std::optional<u64> NVFlinger::OpenDisplay(std::string_view name) {
138 return itr->GetID(); 138 return itr->GetID();
139} 139}
140 140
141bool NVFlinger::CloseDisplay(u64 display_id) { 141bool Nvnflinger::CloseDisplay(u64 display_id) {
142 const auto lock_guard = Lock(); 142 const auto lock_guard = Lock();
143 auto* const display = FindDisplay(display_id); 143 auto* const display = FindDisplay(display_id);
144 144
@@ -151,7 +151,7 @@ bool NVFlinger::CloseDisplay(u64 display_id) {
151 return true; 151 return true;
152} 152}
153 153
154std::optional<u64> NVFlinger::CreateLayer(u64 display_id) { 154std::optional<u64> Nvnflinger::CreateLayer(u64 display_id) {
155 const auto lock_guard = Lock(); 155 const auto lock_guard = Lock();
156 auto* const display = FindDisplay(display_id); 156 auto* const display = FindDisplay(display_id);
157 157
@@ -164,12 +164,12 @@ std::optional<u64> NVFlinger::CreateLayer(u64 display_id) {
164 return layer_id; 164 return layer_id;
165} 165}
166 166
167void NVFlinger::CreateLayerAtId(VI::Display& display, u64 layer_id) { 167void Nvnflinger::CreateLayerAtId(VI::Display& display, u64 layer_id) {
168 const auto buffer_id = next_buffer_queue_id++; 168 const auto buffer_id = next_buffer_queue_id++;
169 display.CreateLayer(layer_id, buffer_id, nvdrv->container); 169 display.CreateLayer(layer_id, buffer_id, nvdrv->container);
170} 170}
171 171
172void NVFlinger::CloseLayer(u64 layer_id) { 172void Nvnflinger::CloseLayer(u64 layer_id) {
173 const auto lock_guard = Lock(); 173 const auto lock_guard = Lock();
174 174
175 for (auto& display : displays) { 175 for (auto& display : displays) {
@@ -177,7 +177,7 @@ void NVFlinger::CloseLayer(u64 layer_id) {
177 } 177 }
178} 178}
179 179
180std::optional<u32> NVFlinger::FindBufferQueueId(u64 display_id, u64 layer_id) { 180std::optional<u32> Nvnflinger::FindBufferQueueId(u64 display_id, u64 layer_id) {
181 const auto lock_guard = Lock(); 181 const auto lock_guard = Lock();
182 const auto* const layer = FindOrCreateLayer(display_id, layer_id); 182 const auto* const layer = FindOrCreateLayer(display_id, layer_id);
183 183
@@ -188,7 +188,7 @@ std::optional<u32> NVFlinger::FindBufferQueueId(u64 display_id, u64 layer_id) {
188 return layer->GetBinderId(); 188 return layer->GetBinderId();
189} 189}
190 190
191ResultVal<Kernel::KReadableEvent*> NVFlinger::FindVsyncEvent(u64 display_id) { 191ResultVal<Kernel::KReadableEvent*> Nvnflinger::FindVsyncEvent(u64 display_id) {
192 const auto lock_guard = Lock(); 192 const auto lock_guard = Lock();
193 auto* const display = FindDisplay(display_id); 193 auto* const display = FindDisplay(display_id);
194 194
@@ -199,7 +199,7 @@ ResultVal<Kernel::KReadableEvent*> NVFlinger::FindVsyncEvent(u64 display_id) {
199 return display->GetVSyncEvent(); 199 return display->GetVSyncEvent();
200} 200}
201 201
202VI::Display* NVFlinger::FindDisplay(u64 display_id) { 202VI::Display* Nvnflinger::FindDisplay(u64 display_id) {
203 const auto itr = 203 const auto itr =
204 std::find_if(displays.begin(), displays.end(), 204 std::find_if(displays.begin(), displays.end(),
205 [&](const VI::Display& display) { return display.GetID() == display_id; }); 205 [&](const VI::Display& display) { return display.GetID() == display_id; });
@@ -211,7 +211,7 @@ VI::Display* NVFlinger::FindDisplay(u64 display_id) {
211 return &*itr; 211 return &*itr;
212} 212}
213 213
214const VI::Display* NVFlinger::FindDisplay(u64 display_id) const { 214const VI::Display* Nvnflinger::FindDisplay(u64 display_id) const {
215 const auto itr = 215 const auto itr =
216 std::find_if(displays.begin(), displays.end(), 216 std::find_if(displays.begin(), displays.end(),
217 [&](const VI::Display& display) { return display.GetID() == display_id; }); 217 [&](const VI::Display& display) { return display.GetID() == display_id; });
@@ -223,7 +223,7 @@ const VI::Display* NVFlinger::FindDisplay(u64 display_id) const {
223 return &*itr; 223 return &*itr;
224} 224}
225 225
226VI::Layer* NVFlinger::FindLayer(u64 display_id, u64 layer_id) { 226VI::Layer* Nvnflinger::FindLayer(u64 display_id, u64 layer_id) {
227 auto* const display = FindDisplay(display_id); 227 auto* const display = FindDisplay(display_id);
228 228
229 if (display == nullptr) { 229 if (display == nullptr) {
@@ -233,7 +233,7 @@ VI::Layer* NVFlinger::FindLayer(u64 display_id, u64 layer_id) {
233 return display->FindLayer(layer_id); 233 return display->FindLayer(layer_id);
234} 234}
235 235
236const VI::Layer* NVFlinger::FindLayer(u64 display_id, u64 layer_id) const { 236const VI::Layer* Nvnflinger::FindLayer(u64 display_id, u64 layer_id) const {
237 const auto* const display = FindDisplay(display_id); 237 const auto* const display = FindDisplay(display_id);
238 238
239 if (display == nullptr) { 239 if (display == nullptr) {
@@ -243,7 +243,7 @@ const VI::Layer* NVFlinger::FindLayer(u64 display_id, u64 layer_id) const {
243 return display->FindLayer(layer_id); 243 return display->FindLayer(layer_id);
244} 244}
245 245
246VI::Layer* NVFlinger::FindOrCreateLayer(u64 display_id, u64 layer_id) { 246VI::Layer* Nvnflinger::FindOrCreateLayer(u64 display_id, u64 layer_id) {
247 auto* const display = FindDisplay(display_id); 247 auto* const display = FindDisplay(display_id);
248 248
249 if (display == nullptr) { 249 if (display == nullptr) {
@@ -253,7 +253,7 @@ VI::Layer* NVFlinger::FindOrCreateLayer(u64 display_id, u64 layer_id) {
253 auto* layer = display->FindLayer(layer_id); 253 auto* layer = display->FindLayer(layer_id);
254 254
255 if (layer == nullptr) { 255 if (layer == nullptr) {
256 LOG_DEBUG(Service_NVFlinger, "Layer at id {} not found. Trying to create it.", layer_id); 256 LOG_DEBUG(Service_Nvnflinger, "Layer at id {} not found. Trying to create it.", layer_id);
257 CreateLayerAtId(*display, layer_id); 257 CreateLayerAtId(*display, layer_id);
258 return display->FindLayer(layer_id); 258 return display->FindLayer(layer_id);
259 } 259 }
@@ -261,7 +261,7 @@ VI::Layer* NVFlinger::FindOrCreateLayer(u64 display_id, u64 layer_id) {
261 return layer; 261 return layer;
262} 262}
263 263
264void NVFlinger::Compose() { 264void Nvnflinger::Compose() {
265 for (auto& display : displays) { 265 for (auto& display : displays) {
266 // Trigger vsync for this display at the end of drawing 266 // Trigger vsync for this display at the end of drawing
267 SCOPE_EXIT({ display.SignalVSyncEvent(); }); 267 SCOPE_EXIT({ display.SignalVSyncEvent(); });
@@ -311,7 +311,7 @@ void NVFlinger::Compose() {
311 } 311 }
312} 312}
313 313
314s64 NVFlinger::GetNextTicks() const { 314s64 Nvnflinger::GetNextTicks() const {
315 const auto& settings = Settings::values; 315 const auto& settings = Settings::values;
316 auto speed_scale = 1.f; 316 auto speed_scale = 1.f;
317 if (settings.use_multi_core.GetValue()) { 317 if (settings.use_multi_core.GetValue()) {
@@ -332,4 +332,4 @@ s64 NVFlinger::GetNextTicks() const {
332 return static_cast<s64>(speed_scale * (1000000000.f / effective_fps)); 332 return static_cast<s64>(speed_scale * (1000000000.f / effective_fps));
333} 333}
334 334
335} // namespace Service::NVFlinger 335} // namespace Service::Nvnflinger
diff --git a/src/core/hle/service/nvflinger/nvflinger.h b/src/core/hle/service/nvnflinger/nvnflinger.h
index 3828cf272..a043cceb2 100644
--- a/src/core/hle/service/nvflinger/nvflinger.h
+++ b/src/core/hle/service/nvnflinger/nvnflinger.h
@@ -42,12 +42,12 @@ class BufferQueueCore;
42class BufferQueueProducer; 42class BufferQueueProducer;
43} // namespace Service::android 43} // namespace Service::android
44 44
45namespace Service::NVFlinger { 45namespace Service::Nvnflinger {
46 46
47class NVFlinger final { 47class Nvnflinger final {
48public: 48public:
49 explicit NVFlinger(Core::System& system_, HosBinderDriverServer& hos_binder_driver_server_); 49 explicit Nvnflinger(Core::System& system_, HosBinderDriverServer& hos_binder_driver_server_);
50 ~NVFlinger(); 50 ~Nvnflinger();
51 51
52 void ShutdownLayers(); 52 void ShutdownLayers();
53 53
@@ -152,4 +152,4 @@ private:
152 HosBinderDriverServer& hos_binder_driver_server; 152 HosBinderDriverServer& hos_binder_driver_server;
153}; 153};
154 154
155} // namespace Service::NVFlinger 155} // namespace Service::Nvnflinger
diff --git a/src/core/hle/service/nvflinger/parcel.h b/src/core/hle/service/nvnflinger/parcel.h
index d1b6201e0..d1b6201e0 100644
--- a/src/core/hle/service/nvflinger/parcel.h
+++ b/src/core/hle/service/nvnflinger/parcel.h
diff --git a/src/core/hle/service/nvflinger/pixel_format.h b/src/core/hle/service/nvnflinger/pixel_format.h
index f77d0acfb..f77d0acfb 100644
--- a/src/core/hle/service/nvflinger/pixel_format.h
+++ b/src/core/hle/service/nvnflinger/pixel_format.h
diff --git a/src/core/hle/service/nvflinger/producer_listener.h b/src/core/hle/service/nvnflinger/producer_listener.h
index 6bf8aaf1e..6bf8aaf1e 100644
--- a/src/core/hle/service/nvflinger/producer_listener.h
+++ b/src/core/hle/service/nvnflinger/producer_listener.h
diff --git a/src/core/hle/service/nvflinger/status.h b/src/core/hle/service/nvnflinger/status.h
index 7af166c40..7af166c40 100644
--- a/src/core/hle/service/nvflinger/status.h
+++ b/src/core/hle/service/nvnflinger/status.h
diff --git a/src/core/hle/service/nvflinger/ui/fence.h b/src/core/hle/service/nvnflinger/ui/fence.h
index 536e8156d..536e8156d 100644
--- a/src/core/hle/service/nvflinger/ui/fence.h
+++ b/src/core/hle/service/nvnflinger/ui/fence.h
diff --git a/src/core/hle/service/nvflinger/ui/graphic_buffer.h b/src/core/hle/service/nvnflinger/ui/graphic_buffer.h
index 9a27f8f02..75d1705a8 100644
--- a/src/core/hle/service/nvflinger/ui/graphic_buffer.h
+++ b/src/core/hle/service/nvnflinger/ui/graphic_buffer.h
@@ -8,7 +8,7 @@
8 8
9#include "common/common_funcs.h" 9#include "common/common_funcs.h"
10#include "common/common_types.h" 10#include "common/common_types.h"
11#include "core/hle/service/nvflinger/pixel_format.h" 11#include "core/hle/service/nvnflinger/pixel_format.h"
12 12
13namespace Service::android { 13namespace Service::android {
14 14
diff --git a/src/core/hle/service/nvflinger/window.h b/src/core/hle/service/nvnflinger/window.h
index 61cca5b01..61cca5b01 100644
--- a/src/core/hle/service/nvflinger/window.h
+++ b/src/core/hle/service/nvnflinger/window.h
diff --git a/src/core/hle/service/olsc/olsc.cpp b/src/core/hle/service/olsc/olsc.cpp
index 3493f8272..14ba67b4c 100644
--- a/src/core/hle/service/olsc/olsc.cpp
+++ b/src/core/hle/service/olsc/olsc.cpp
@@ -1,7 +1,7 @@
1// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project 1// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "core/hle/ipc_helpers.h" 4#include "core/hle/service/ipc_helpers.h"
5#include "core/hle/service/olsc/olsc.h" 5#include "core/hle/service/olsc/olsc.h"
6#include "core/hle/service/server_manager.h" 6#include "core/hle/service/server_manager.h"
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
@@ -42,7 +42,7 @@ public:
42 } 42 }
43 43
44private: 44private:
45 void Initialize(Kernel::HLERequestContext& ctx) { 45 void Initialize(HLERequestContext& ctx) {
46 LOG_WARNING(Service_OLSC, "(STUBBED) called"); 46 LOG_WARNING(Service_OLSC, "(STUBBED) called");
47 47
48 initialized = true; 48 initialized = true;
@@ -51,7 +51,7 @@ private:
51 rb.Push(ResultSuccess); 51 rb.Push(ResultSuccess);
52 } 52 }
53 53
54 void GetSaveDataBackupSetting(Kernel::HLERequestContext& ctx) { 54 void GetSaveDataBackupSetting(HLERequestContext& ctx) {
55 LOG_WARNING(Service_OLSC, "(STUBBED) called"); 55 LOG_WARNING(Service_OLSC, "(STUBBED) called");
56 56
57 // backup_setting is set to 0 since real value is unknown 57 // backup_setting is set to 0 since real value is unknown
@@ -62,7 +62,7 @@ private:
62 rb.Push(backup_setting); 62 rb.Push(backup_setting);
63 } 63 }
64 64
65 void SetSaveDataBackupSettingEnabled(Kernel::HLERequestContext& ctx) { 65 void SetSaveDataBackupSettingEnabled(HLERequestContext& ctx) {
66 LOG_WARNING(Service_OLSC, "(STUBBED) called"); 66 LOG_WARNING(Service_OLSC, "(STUBBED) called");
67 67
68 IPC::ResponseBuilder rb{ctx, 2}; 68 IPC::ResponseBuilder rb{ctx, 2};
diff --git a/src/core/hle/service/pctl/pctl_module.cpp b/src/core/hle/service/pctl/pctl_module.cpp
index a4a12a78c..f966c5c8b 100644
--- a/src/core/hle/service/pctl/pctl_module.cpp
+++ b/src/core/hle/service/pctl/pctl_module.cpp
@@ -5,7 +5,7 @@
5#include "core/core.h" 5#include "core/core.h"
6#include "core/file_sys/control_metadata.h" 6#include "core/file_sys/control_metadata.h"
7#include "core/file_sys/patch_manager.h" 7#include "core/file_sys/patch_manager.h"
8#include "core/hle/ipc_helpers.h" 8#include "core/hle/service/ipc_helpers.h"
9#include "core/hle/service/pctl/pctl.h" 9#include "core/hle/service/pctl/pctl.h"
10#include "core/hle/service/pctl/pctl_module.h" 10#include "core/hle/service/pctl/pctl_module.h"
11#include "core/hle/service/server_manager.h" 11#include "core/hle/service/server_manager.h"
@@ -177,7 +177,7 @@ private:
177 settings.is_stero_vision_restricted = is_restricted; 177 settings.is_stero_vision_restricted = is_restricted;
178 } 178 }
179 179
180 void Initialize(Kernel::HLERequestContext& ctx) { 180 void Initialize(HLERequestContext& ctx) {
181 LOG_DEBUG(Service_PCTL, "called"); 181 LOG_DEBUG(Service_PCTL, "called");
182 IPC::ResponseBuilder rb{ctx, 2}; 182 IPC::ResponseBuilder rb{ctx, 2};
183 183
@@ -215,7 +215,7 @@ private:
215 rb.Push(ResultSuccess); 215 rb.Push(ResultSuccess);
216 } 216 }
217 217
218 void CheckFreeCommunicationPermission(Kernel::HLERequestContext& ctx) { 218 void CheckFreeCommunicationPermission(HLERequestContext& ctx) {
219 LOG_DEBUG(Service_PCTL, "called"); 219 LOG_DEBUG(Service_PCTL, "called");
220 220
221 IPC::ResponseBuilder rb{ctx, 2}; 221 IPC::ResponseBuilder rb{ctx, 2};
@@ -228,7 +228,7 @@ private:
228 states.free_communication = true; 228 states.free_communication = true;
229 } 229 }
230 230
231 void ConfirmStereoVisionPermission(Kernel::HLERequestContext& ctx) { 231 void ConfirmStereoVisionPermission(HLERequestContext& ctx) {
232 LOG_DEBUG(Service_PCTL, "called"); 232 LOG_DEBUG(Service_PCTL, "called");
233 states.stereo_vision = true; 233 states.stereo_vision = true;
234 234
@@ -236,14 +236,14 @@ private:
236 rb.Push(ResultSuccess); 236 rb.Push(ResultSuccess);
237 } 237 }
238 238
239 void EndFreeCommunication(Kernel::HLERequestContext& ctx) { 239 void EndFreeCommunication(HLERequestContext& ctx) {
240 LOG_WARNING(Service_PCTL, "(STUBBED) called"); 240 LOG_WARNING(Service_PCTL, "(STUBBED) called");
241 241
242 IPC::ResponseBuilder rb{ctx, 2}; 242 IPC::ResponseBuilder rb{ctx, 2};
243 rb.Push(ResultSuccess); 243 rb.Push(ResultSuccess);
244 } 244 }
245 245
246 void IsFreeCommunicationAvailable(Kernel::HLERequestContext& ctx) { 246 void IsFreeCommunicationAvailable(HLERequestContext& ctx) {
247 LOG_WARNING(Service_PCTL, "(STUBBED) called"); 247 LOG_WARNING(Service_PCTL, "(STUBBED) called");
248 248
249 IPC::ResponseBuilder rb{ctx, 2}; 249 IPC::ResponseBuilder rb{ctx, 2};
@@ -254,7 +254,7 @@ private:
254 } 254 }
255 } 255 }
256 256
257 void IsRestrictionEnabled(Kernel::HLERequestContext& ctx) { 257 void IsRestrictionEnabled(HLERequestContext& ctx) {
258 LOG_DEBUG(Service_PCTL, "called"); 258 LOG_DEBUG(Service_PCTL, "called");
259 259
260 IPC::ResponseBuilder rb{ctx, 3}; 260 IPC::ResponseBuilder rb{ctx, 3};
@@ -268,7 +268,7 @@ private:
268 rb.Push(pin_code[0] != '\0'); 268 rb.Push(pin_code[0] != '\0');
269 } 269 }
270 270
271 void ConfirmStereoVisionRestrictionConfigurable(Kernel::HLERequestContext& ctx) { 271 void ConfirmStereoVisionRestrictionConfigurable(HLERequestContext& ctx) {
272 LOG_DEBUG(Service_PCTL, "called"); 272 LOG_DEBUG(Service_PCTL, "called");
273 273
274 IPC::ResponseBuilder rb{ctx, 2}; 274 IPC::ResponseBuilder rb{ctx, 2};
@@ -287,7 +287,7 @@ private:
287 rb.Push(ResultSuccess); 287 rb.Push(ResultSuccess);
288 } 288 }
289 289
290 void IsStereoVisionPermitted(Kernel::HLERequestContext& ctx) { 290 void IsStereoVisionPermitted(HLERequestContext& ctx) {
291 LOG_DEBUG(Service_PCTL, "called"); 291 LOG_DEBUG(Service_PCTL, "called");
292 292
293 IPC::ResponseBuilder rb{ctx, 3}; 293 IPC::ResponseBuilder rb{ctx, 3};
@@ -300,7 +300,7 @@ private:
300 } 300 }
301 } 301 }
302 302
303 void SetStereoVisionRestriction(Kernel::HLERequestContext& ctx) { 303 void SetStereoVisionRestriction(HLERequestContext& ctx) {
304 IPC::RequestParser rp{ctx}; 304 IPC::RequestParser rp{ctx};
305 const auto can_use = rp.Pop<bool>(); 305 const auto can_use = rp.Pop<bool>();
306 LOG_DEBUG(Service_PCTL, "called, can_use={}", can_use); 306 LOG_DEBUG(Service_PCTL, "called, can_use={}", can_use);
@@ -316,7 +316,7 @@ private:
316 rb.Push(ResultSuccess); 316 rb.Push(ResultSuccess);
317 } 317 }
318 318
319 void GetStereoVisionRestriction(Kernel::HLERequestContext& ctx) { 319 void GetStereoVisionRestriction(HLERequestContext& ctx) {
320 LOG_DEBUG(Service_PCTL, "called"); 320 LOG_DEBUG(Service_PCTL, "called");
321 321
322 IPC::ResponseBuilder rb{ctx, 3}; 322 IPC::ResponseBuilder rb{ctx, 3};
@@ -331,7 +331,7 @@ private:
331 rb.Push(settings.is_stero_vision_restricted); 331 rb.Push(settings.is_stero_vision_restricted);
332 } 332 }
333 333
334 void ResetConfirmedStereoVisionPermission(Kernel::HLERequestContext& ctx) { 334 void ResetConfirmedStereoVisionPermission(HLERequestContext& ctx) {
335 LOG_DEBUG(Service_PCTL, "called"); 335 LOG_DEBUG(Service_PCTL, "called");
336 336
337 states.stereo_vision = false; 337 states.stereo_vision = false;
@@ -370,7 +370,7 @@ private:
370 Capability capability{}; 370 Capability capability{};
371}; 371};
372 372
373void Module::Interface::CreateService(Kernel::HLERequestContext& ctx) { 373void Module::Interface::CreateService(HLERequestContext& ctx) {
374 LOG_DEBUG(Service_PCTL, "called"); 374 LOG_DEBUG(Service_PCTL, "called");
375 375
376 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 376 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -380,7 +380,7 @@ void Module::Interface::CreateService(Kernel::HLERequestContext& ctx) {
380 rb.PushIpcInterface<IParentalControlService>(system, capability); 380 rb.PushIpcInterface<IParentalControlService>(system, capability);
381} 381}
382 382
383void Module::Interface::CreateServiceWithoutInitialize(Kernel::HLERequestContext& ctx) { 383void Module::Interface::CreateServiceWithoutInitialize(HLERequestContext& ctx) {
384 LOG_DEBUG(Service_PCTL, "called"); 384 LOG_DEBUG(Service_PCTL, "called");
385 385
386 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 386 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
diff --git a/src/core/hle/service/pctl/pctl_module.h b/src/core/hle/service/pctl/pctl_module.h
index 4ea77ab21..dff0d3f08 100644
--- a/src/core/hle/service/pctl/pctl_module.h
+++ b/src/core/hle/service/pctl/pctl_module.h
@@ -31,8 +31,8 @@ public:
31 const char* name_, Capability capability_); 31 const char* name_, Capability capability_);
32 ~Interface() override; 32 ~Interface() override;
33 33
34 void CreateService(Kernel::HLERequestContext& ctx); 34 void CreateService(HLERequestContext& ctx);
35 void CreateServiceWithoutInitialize(Kernel::HLERequestContext& ctx); 35 void CreateServiceWithoutInitialize(HLERequestContext& ctx);
36 36
37 protected: 37 protected:
38 std::shared_ptr<Module> module; 38 std::shared_ptr<Module> module;
diff --git a/src/core/hle/service/pcv/pcv.cpp b/src/core/hle/service/pcv/pcv.cpp
index be64b94ea..c13ffa6f6 100644
--- a/src/core/hle/service/pcv/pcv.cpp
+++ b/src/core/hle/service/pcv/pcv.cpp
@@ -3,7 +3,7 @@
3 3
4#include <memory> 4#include <memory>
5 5
6#include "core/hle/ipc_helpers.h" 6#include "core/hle/service/ipc_helpers.h"
7#include "core/hle/service/pcv/pcv.h" 7#include "core/hle/service/pcv/pcv.h"
8#include "core/hle/service/server_manager.h" 8#include "core/hle/service/server_manager.h"
9#include "core/hle/service/service.h" 9#include "core/hle/service/service.h"
@@ -76,7 +76,7 @@ public:
76 } 76 }
77 77
78private: 78private:
79 void SetClockRate(Kernel::HLERequestContext& ctx) { 79 void SetClockRate(HLERequestContext& ctx) {
80 IPC::RequestParser rp{ctx}; 80 IPC::RequestParser rp{ctx};
81 clock_rate = rp.Pop<u32>(); 81 clock_rate = rp.Pop<u32>();
82 LOG_DEBUG(Service_PCV, "(STUBBED) called, clock_rate={}", clock_rate); 82 LOG_DEBUG(Service_PCV, "(STUBBED) called, clock_rate={}", clock_rate);
@@ -85,7 +85,7 @@ private:
85 rb.Push(ResultSuccess); 85 rb.Push(ResultSuccess);
86 } 86 }
87 87
88 void GetClockRate(Kernel::HLERequestContext& ctx) { 88 void GetClockRate(HLERequestContext& ctx) {
89 LOG_DEBUG(Service_PCV, "(STUBBED) called"); 89 LOG_DEBUG(Service_PCV, "(STUBBED) called");
90 90
91 IPC::ResponseBuilder rb{ctx, 3}; 91 IPC::ResponseBuilder rb{ctx, 3};
@@ -115,7 +115,7 @@ public:
115 } 115 }
116 116
117private: 117private:
118 void OpenSession(Kernel::HLERequestContext& ctx) { 118 void OpenSession(HLERequestContext& ctx) {
119 IPC::RequestParser rp{ctx}; 119 IPC::RequestParser rp{ctx};
120 const auto device_code = static_cast<DeviceCode>(rp.Pop<u32>()); 120 const auto device_code = static_cast<DeviceCode>(rp.Pop<u32>());
121 const auto unkonwn_input = rp.Pop<u32>(); 121 const auto unkonwn_input = rp.Pop<u32>();
diff --git a/src/core/hle/service/pm/pm.cpp b/src/core/hle/service/pm/pm.cpp
index 02a4ca13b..ea249c26f 100644
--- a/src/core/hle/service/pm/pm.cpp
+++ b/src/core/hle/service/pm/pm.cpp
@@ -2,9 +2,9 @@
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "core/core.h" 4#include "core/core.h"
5#include "core/hle/ipc_helpers.h"
6#include "core/hle/kernel/k_process.h" 5#include "core/hle/kernel/k_process.h"
7#include "core/hle/kernel/kernel.h" 6#include "core/hle/kernel/kernel.h"
7#include "core/hle/service/ipc_helpers.h"
8#include "core/hle/service/pm/pm.h" 8#include "core/hle/service/pm/pm.h"
9#include "core/hle/service/server_manager.h" 9#include "core/hle/service/server_manager.h"
10#include "core/hle/service/service.h" 10#include "core/hle/service/service.h"
@@ -34,7 +34,7 @@ std::optional<Kernel::KProcess*> SearchProcessList(
34 return *iter; 34 return *iter;
35} 35}
36 36
37void GetApplicationPidGeneric(Kernel::HLERequestContext& ctx, 37void GetApplicationPidGeneric(HLERequestContext& ctx,
38 const std::vector<Kernel::KProcess*>& process_list) { 38 const std::vector<Kernel::KProcess*>& process_list) {
39 const auto process = SearchProcessList(process_list, [](const auto& proc) { 39 const auto process = SearchProcessList(process_list, [](const auto& proc) {
40 return proc->GetProcessID() == Kernel::KProcess::ProcessIDMin; 40 return proc->GetProcessID() == Kernel::KProcess::ProcessIDMin;
@@ -58,7 +58,7 @@ public:
58 } 58 }
59 59
60private: 60private:
61 void GetBootMode(Kernel::HLERequestContext& ctx) { 61 void GetBootMode(HLERequestContext& ctx) {
62 LOG_DEBUG(Service_PM, "called"); 62 LOG_DEBUG(Service_PM, "called");
63 63
64 IPC::ResponseBuilder rb{ctx, 3}; 64 IPC::ResponseBuilder rb{ctx, 3};
@@ -66,7 +66,7 @@ private:
66 rb.PushEnum(boot_mode); 66 rb.PushEnum(boot_mode);
67 } 67 }
68 68
69 void SetMaintenanceBoot(Kernel::HLERequestContext& ctx) { 69 void SetMaintenanceBoot(HLERequestContext& ctx) {
70 LOG_DEBUG(Service_PM, "called"); 70 LOG_DEBUG(Service_PM, "called");
71 71
72 boot_mode = SystemBootMode::Maintenance; 72 boot_mode = SystemBootMode::Maintenance;
@@ -100,7 +100,7 @@ public:
100 } 100 }
101 101
102private: 102private:
103 void GetProcessId(Kernel::HLERequestContext& ctx) { 103 void GetProcessId(HLERequestContext& ctx) {
104 IPC::RequestParser rp{ctx}; 104 IPC::RequestParser rp{ctx};
105 const auto program_id = rp.PopRaw<u64>(); 105 const auto program_id = rp.PopRaw<u64>();
106 106
@@ -122,12 +122,12 @@ private:
122 rb.Push((*process)->GetProcessID()); 122 rb.Push((*process)->GetProcessID());
123 } 123 }
124 124
125 void GetApplicationProcessId(Kernel::HLERequestContext& ctx) { 125 void GetApplicationProcessId(HLERequestContext& ctx) {
126 LOG_DEBUG(Service_PM, "called"); 126 LOG_DEBUG(Service_PM, "called");
127 GetApplicationPidGeneric(ctx, kernel.GetProcessList()); 127 GetApplicationPidGeneric(ctx, kernel.GetProcessList());
128 } 128 }
129 129
130 void AtmosphereGetProcessInfo(Kernel::HLERequestContext& ctx) { 130 void AtmosphereGetProcessInfo(HLERequestContext& ctx) {
131 // https://github.com/Atmosphere-NX/Atmosphere/blob/master/stratosphere/pm/source/impl/pm_process_manager.cpp#L614 131 // https://github.com/Atmosphere-NX/Atmosphere/blob/master/stratosphere/pm/source/impl/pm_process_manager.cpp#L614
132 // This implementation is incomplete; only a handle to the process is returned. 132 // This implementation is incomplete; only a handle to the process is returned.
133 IPC::RequestParser rp{ctx}; 133 IPC::RequestParser rp{ctx};
@@ -187,7 +187,7 @@ public:
187 } 187 }
188 188
189private: 189private:
190 void GetProgramId(Kernel::HLERequestContext& ctx) { 190 void GetProgramId(HLERequestContext& ctx) {
191 IPC::RequestParser rp{ctx}; 191 IPC::RequestParser rp{ctx};
192 const auto process_id = rp.PopRaw<u64>(); 192 const auto process_id = rp.PopRaw<u64>();
193 193
@@ -208,7 +208,7 @@ private:
208 rb.Push((*process)->GetProgramID()); 208 rb.Push((*process)->GetProgramID());
209 } 209 }
210 210
211 void AtmosphereGetProcessId(Kernel::HLERequestContext& ctx) { 211 void AtmosphereGetProcessId(HLERequestContext& ctx) {
212 IPC::RequestParser rp{ctx}; 212 IPC::RequestParser rp{ctx};
213 const auto program_id = rp.PopRaw<u64>(); 213 const auto program_id = rp.PopRaw<u64>();
214 214
@@ -255,7 +255,7 @@ public:
255 } 255 }
256 256
257private: 257private:
258 void GetApplicationProcessIdForShell(Kernel::HLERequestContext& ctx) { 258 void GetApplicationProcessIdForShell(HLERequestContext& ctx) {
259 LOG_DEBUG(Service_PM, "called"); 259 LOG_DEBUG(Service_PM, "called");
260 GetApplicationPidGeneric(ctx, kernel.GetProcessList()); 260 GetApplicationPidGeneric(ctx, kernel.GetProcessList());
261 } 261 }
diff --git a/src/core/hle/service/prepo/prepo.cpp b/src/core/hle/service/prepo/prepo.cpp
index 02af311e8..ec4a84989 100644
--- a/src/core/hle/service/prepo/prepo.cpp
+++ b/src/core/hle/service/prepo/prepo.cpp
@@ -4,8 +4,8 @@
4#include "common/hex_util.h" 4#include "common/hex_util.h"
5#include "common/logging/log.h" 5#include "common/logging/log.h"
6#include "core/core.h" 6#include "core/core.h"
7#include "core/hle/ipc_helpers.h"
8#include "core/hle/service/acc/profile_manager.h" 7#include "core/hle/service/acc/profile_manager.h"
8#include "core/hle/service/ipc_helpers.h"
9#include "core/hle/service/prepo/prepo.h" 9#include "core/hle/service/prepo/prepo.h"
10#include "core/hle/service/server_manager.h" 10#include "core/hle/service/server_manager.h"
11#include "core/hle/service/service.h" 11#include "core/hle/service/service.h"
@@ -54,7 +54,7 @@ public:
54 54
55private: 55private:
56 template <Core::Reporter::PlayReportType Type> 56 template <Core::Reporter::PlayReportType Type>
57 void SaveReport(Kernel::HLERequestContext& ctx) { 57 void SaveReport(HLERequestContext& ctx) {
58 IPC::RequestParser rp{ctx}; 58 IPC::RequestParser rp{ctx};
59 const auto process_id = rp.PopRaw<u64>(); 59 const auto process_id = rp.PopRaw<u64>();
60 60
@@ -80,7 +80,7 @@ private:
80 } 80 }
81 81
82 template <Core::Reporter::PlayReportType Type> 82 template <Core::Reporter::PlayReportType Type>
83 void SaveReportWithUser(Kernel::HLERequestContext& ctx) { 83 void SaveReportWithUser(HLERequestContext& ctx) {
84 IPC::RequestParser rp{ctx}; 84 IPC::RequestParser rp{ctx};
85 const auto user_id = rp.PopRaw<u128>(); 85 const auto user_id = rp.PopRaw<u128>();
86 const auto process_id = rp.PopRaw<u64>(); 86 const auto process_id = rp.PopRaw<u64>();
@@ -107,14 +107,14 @@ private:
107 rb.Push(ResultSuccess); 107 rb.Push(ResultSuccess);
108 } 108 }
109 109
110 void RequestImmediateTransmission(Kernel::HLERequestContext& ctx) { 110 void RequestImmediateTransmission(HLERequestContext& ctx) {
111 LOG_WARNING(Service_PREPO, "(STUBBED) called"); 111 LOG_WARNING(Service_PREPO, "(STUBBED) called");
112 112
113 IPC::ResponseBuilder rb{ctx, 2}; 113 IPC::ResponseBuilder rb{ctx, 2};
114 rb.Push(ResultSuccess); 114 rb.Push(ResultSuccess);
115 } 115 }
116 116
117 void GetTransmissionStatus(Kernel::HLERequestContext& ctx) { 117 void GetTransmissionStatus(HLERequestContext& ctx) {
118 LOG_WARNING(Service_PREPO, "(STUBBED) called"); 118 LOG_WARNING(Service_PREPO, "(STUBBED) called");
119 119
120 constexpr s32 status = 0; 120 constexpr s32 status = 0;
@@ -124,7 +124,7 @@ private:
124 rb.Push(status); 124 rb.Push(status);
125 } 125 }
126 126
127 void GetSystemSessionId(Kernel::HLERequestContext& ctx) { 127 void GetSystemSessionId(HLERequestContext& ctx) {
128 LOG_WARNING(Service_PREPO, "(STUBBED) called"); 128 LOG_WARNING(Service_PREPO, "(STUBBED) called");
129 129
130 constexpr u64 system_session_id = 0; 130 constexpr u64 system_session_id = 0;
@@ -133,7 +133,7 @@ private:
133 rb.Push(system_session_id); 133 rb.Push(system_session_id);
134 } 134 }
135 135
136 void SaveSystemReport(Kernel::HLERequestContext& ctx) { 136 void SaveSystemReport(HLERequestContext& ctx) {
137 IPC::RequestParser rp{ctx}; 137 IPC::RequestParser rp{ctx};
138 const auto title_id = rp.PopRaw<u64>(); 138 const auto title_id = rp.PopRaw<u64>();
139 139
@@ -156,7 +156,7 @@ private:
156 rb.Push(ResultSuccess); 156 rb.Push(ResultSuccess);
157 } 157 }
158 158
159 void SaveSystemReportWithUser(Kernel::HLERequestContext& ctx) { 159 void SaveSystemReportWithUser(HLERequestContext& ctx) {
160 IPC::RequestParser rp{ctx}; 160 IPC::RequestParser rp{ctx};
161 const auto user_id = rp.PopRaw<u128>(); 161 const auto user_id = rp.PopRaw<u128>();
162 const auto title_id = rp.PopRaw<u64>(); 162 const auto title_id = rp.PopRaw<u64>();
diff --git a/src/core/hle/service/psc/psc.cpp b/src/core/hle/service/psc/psc.cpp
index 1650d2f39..cd0cc9287 100644
--- a/src/core/hle/service/psc/psc.cpp
+++ b/src/core/hle/service/psc/psc.cpp
@@ -4,16 +4,16 @@
4#include <memory> 4#include <memory>
5 5
6#include "common/logging/log.h" 6#include "common/logging/log.h"
7#include "core/hle/ipc_helpers.h" 7#include "core/hle/service/ipc_helpers.h"
8#include "core/hle/service/psc/psc.h" 8#include "core/hle/service/psc/psc.h"
9#include "core/hle/service/server_manager.h" 9#include "core/hle/service/server_manager.h"
10#include "core/hle/service/service.h" 10#include "core/hle/service/service.h"
11 11
12namespace Service::PSC { 12namespace Service::PSC {
13 13
14class PSC_C final : public ServiceFramework<PSC_C> { 14class IPmControl final : public ServiceFramework<IPmControl> {
15public: 15public:
16 explicit PSC_C(Core::System& system_) : ServiceFramework{system_, "psc:c"} { 16 explicit IPmControl(Core::System& system_) : ServiceFramework{system_, "psc:c"} {
17 // clang-format off 17 // clang-format off
18 static const FunctionInfo functions[] = { 18 static const FunctionInfo functions[] = {
19 {0, nullptr, "Initialize"}, 19 {0, nullptr, "Initialize"},
@@ -23,8 +23,8 @@ public:
23 {4, nullptr, "Cancel"}, 23 {4, nullptr, "Cancel"},
24 {5, nullptr, "PrintModuleInformation"}, 24 {5, nullptr, "PrintModuleInformation"},
25 {6, nullptr, "GetModuleInformation"}, 25 {6, nullptr, "GetModuleInformation"},
26 {10, nullptr, "Unknown10"}, 26 {10, nullptr, "AcquireStateLock"},
27 {11, nullptr, "Unknown11"}, 27 {11, nullptr, "HasStateLock"},
28 }; 28 };
29 // clang-format on 29 // clang-format on
30 30
@@ -49,12 +49,12 @@ public:
49 } 49 }
50}; 50};
51 51
52class PSC_M final : public ServiceFramework<PSC_M> { 52class IPmService final : public ServiceFramework<IPmService> {
53public: 53public:
54 explicit PSC_M(Core::System& system_) : ServiceFramework{system_, "psc:m"} { 54 explicit IPmService(Core::System& system_) : ServiceFramework{system_, "psc:m"} {
55 // clang-format off 55 // clang-format off
56 static const FunctionInfo functions[] = { 56 static const FunctionInfo functions[] = {
57 {0, &PSC_M::GetPmModule, "GetPmModule"}, 57 {0, &IPmService::GetPmModule, "GetPmModule"},
58 }; 58 };
59 // clang-format on 59 // clang-format on
60 60
@@ -62,7 +62,7 @@ public:
62 } 62 }
63 63
64private: 64private:
65 void GetPmModule(Kernel::HLERequestContext& ctx) { 65 void GetPmModule(HLERequestContext& ctx) {
66 LOG_DEBUG(Service_PSC, "called"); 66 LOG_DEBUG(Service_PSC, "called");
67 67
68 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 68 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -74,8 +74,8 @@ private:
74void LoopProcess(Core::System& system) { 74void LoopProcess(Core::System& system) {
75 auto server_manager = std::make_unique<ServerManager>(system); 75 auto server_manager = std::make_unique<ServerManager>(system);
76 76
77 server_manager->RegisterNamedService("psc:c", std::make_shared<PSC_C>(system)); 77 server_manager->RegisterNamedService("psc:c", std::make_shared<IPmControl>(system));
78 server_manager->RegisterNamedService("psc:m", std::make_shared<PSC_M>(system)); 78 server_manager->RegisterNamedService("psc:m", std::make_shared<IPmService>(system));
79 ServerManager::RunServer(std::move(server_manager)); 79 ServerManager::RunServer(std::move(server_manager));
80} 80}
81 81
diff --git a/src/core/hle/service/ptm/psm.cpp b/src/core/hle/service/ptm/psm.cpp
index 1ac97fe31..136313d7b 100644
--- a/src/core/hle/service/ptm/psm.cpp
+++ b/src/core/hle/service/ptm/psm.cpp
@@ -5,8 +5,8 @@
5 5
6#include "common/logging/log.h" 6#include "common/logging/log.h"
7#include "core/core.h" 7#include "core/core.h"
8#include "core/hle/ipc_helpers.h"
9#include "core/hle/kernel/k_event.h" 8#include "core/hle/kernel/k_event.h"
9#include "core/hle/service/ipc_helpers.h"
10#include "core/hle/service/kernel_helpers.h" 10#include "core/hle/service/kernel_helpers.h"
11#include "core/hle/service/ptm/psm.h" 11#include "core/hle/service/ptm/psm.h"
12 12
@@ -54,7 +54,7 @@ public:
54 } 54 }
55 55
56private: 56private:
57 void BindStateChangeEvent(Kernel::HLERequestContext& ctx) { 57 void BindStateChangeEvent(HLERequestContext& ctx) {
58 LOG_DEBUG(Service_PTM, "called"); 58 LOG_DEBUG(Service_PTM, "called");
59 59
60 should_signal = true; 60 should_signal = true;
@@ -64,7 +64,7 @@ private:
64 rb.PushCopyObjects(state_change_event->GetReadableEvent()); 64 rb.PushCopyObjects(state_change_event->GetReadableEvent());
65 } 65 }
66 66
67 void UnbindStateChangeEvent(Kernel::HLERequestContext& ctx) { 67 void UnbindStateChangeEvent(HLERequestContext& ctx) {
68 LOG_DEBUG(Service_PTM, "called"); 68 LOG_DEBUG(Service_PTM, "called");
69 69
70 should_signal = false; 70 should_signal = false;
@@ -73,7 +73,7 @@ private:
73 rb.Push(ResultSuccess); 73 rb.Push(ResultSuccess);
74 } 74 }
75 75
76 void SetChargerTypeChangeEventEnabled(Kernel::HLERequestContext& ctx) { 76 void SetChargerTypeChangeEventEnabled(HLERequestContext& ctx) {
77 IPC::RequestParser rp{ctx}; 77 IPC::RequestParser rp{ctx};
78 const auto state = rp.Pop<bool>(); 78 const auto state = rp.Pop<bool>();
79 LOG_DEBUG(Service_PTM, "called, state={}", state); 79 LOG_DEBUG(Service_PTM, "called, state={}", state);
@@ -84,7 +84,7 @@ private:
84 rb.Push(ResultSuccess); 84 rb.Push(ResultSuccess);
85 } 85 }
86 86
87 void SetPowerSupplyChangeEventEnabled(Kernel::HLERequestContext& ctx) { 87 void SetPowerSupplyChangeEventEnabled(HLERequestContext& ctx) {
88 IPC::RequestParser rp{ctx}; 88 IPC::RequestParser rp{ctx};
89 const auto state = rp.Pop<bool>(); 89 const auto state = rp.Pop<bool>();
90 LOG_DEBUG(Service_PTM, "called, state={}", state); 90 LOG_DEBUG(Service_PTM, "called, state={}", state);
@@ -95,7 +95,7 @@ private:
95 rb.Push(ResultSuccess); 95 rb.Push(ResultSuccess);
96 } 96 }
97 97
98 void SetBatteryVoltageStateChangeEventEnabled(Kernel::HLERequestContext& ctx) { 98 void SetBatteryVoltageStateChangeEventEnabled(HLERequestContext& ctx) {
99 IPC::RequestParser rp{ctx}; 99 IPC::RequestParser rp{ctx};
100 const auto state = rp.Pop<bool>(); 100 const auto state = rp.Pop<bool>();
101 LOG_DEBUG(Service_PTM, "called, state={}", state); 101 LOG_DEBUG(Service_PTM, "called, state={}", state);
@@ -145,7 +145,7 @@ PSM::PSM(Core::System& system_) : ServiceFramework{system_, "psm"} {
145 145
146PSM::~PSM() = default; 146PSM::~PSM() = default;
147 147
148void PSM::GetBatteryChargePercentage(Kernel::HLERequestContext& ctx) { 148void PSM::GetBatteryChargePercentage(HLERequestContext& ctx) {
149 LOG_DEBUG(Service_PTM, "called"); 149 LOG_DEBUG(Service_PTM, "called");
150 150
151 IPC::ResponseBuilder rb{ctx, 3}; 151 IPC::ResponseBuilder rb{ctx, 3};
@@ -153,7 +153,7 @@ void PSM::GetBatteryChargePercentage(Kernel::HLERequestContext& ctx) {
153 rb.Push<u32>(battery_charge_percentage); 153 rb.Push<u32>(battery_charge_percentage);
154} 154}
155 155
156void PSM::GetChargerType(Kernel::HLERequestContext& ctx) { 156void PSM::GetChargerType(HLERequestContext& ctx) {
157 LOG_DEBUG(Service_PTM, "called"); 157 LOG_DEBUG(Service_PTM, "called");
158 158
159 IPC::ResponseBuilder rb{ctx, 3}; 159 IPC::ResponseBuilder rb{ctx, 3};
@@ -161,7 +161,7 @@ void PSM::GetChargerType(Kernel::HLERequestContext& ctx) {
161 rb.PushEnum(charger_type); 161 rb.PushEnum(charger_type);
162} 162}
163 163
164void PSM::OpenSession(Kernel::HLERequestContext& ctx) { 164void PSM::OpenSession(HLERequestContext& ctx) {
165 LOG_DEBUG(Service_PTM, "called"); 165 LOG_DEBUG(Service_PTM, "called");
166 166
167 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 167 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
diff --git a/src/core/hle/service/ptm/psm.h b/src/core/hle/service/ptm/psm.h
index f674ba8bc..fa47919e5 100644
--- a/src/core/hle/service/ptm/psm.h
+++ b/src/core/hle/service/ptm/psm.h
@@ -20,9 +20,9 @@ private:
20 Unknown = 3, 20 Unknown = 3,
21 }; 21 };
22 22
23 void GetBatteryChargePercentage(Kernel::HLERequestContext& ctx); 23 void GetBatteryChargePercentage(HLERequestContext& ctx);
24 void GetChargerType(Kernel::HLERequestContext& ctx); 24 void GetChargerType(HLERequestContext& ctx);
25 void OpenSession(Kernel::HLERequestContext& ctx); 25 void OpenSession(HLERequestContext& ctx);
26 26
27 u32 battery_charge_percentage{100}; 27 u32 battery_charge_percentage{100};
28 ChargerType charger_type{ChargerType::RegularCharger}; 28 ChargerType charger_type{ChargerType::RegularCharger};
diff --git a/src/core/hle/service/ptm/ts.cpp b/src/core/hle/service/ptm/ts.cpp
index b1a0a5544..ca064dd90 100644
--- a/src/core/hle/service/ptm/ts.cpp
+++ b/src/core/hle/service/ptm/ts.cpp
@@ -4,7 +4,7 @@
4#include <memory> 4#include <memory>
5 5
6#include "core/core.h" 6#include "core/core.h"
7#include "core/hle/ipc_helpers.h" 7#include "core/hle/service/ipc_helpers.h"
8#include "core/hle/service/ptm/ts.h" 8#include "core/hle/service/ptm/ts.h"
9 9
10namespace Service::PTM { 10namespace Service::PTM {
@@ -25,7 +25,7 @@ TS::TS(Core::System& system_) : ServiceFramework{system_, "ts"} {
25 25
26TS::~TS() = default; 26TS::~TS() = default;
27 27
28void TS::GetTemperature(Kernel::HLERequestContext& ctx) { 28void TS::GetTemperature(HLERequestContext& ctx) {
29 IPC::RequestParser rp{ctx}; 29 IPC::RequestParser rp{ctx};
30 const auto location{rp.PopEnum<Location>()}; 30 const auto location{rp.PopEnum<Location>()};
31 31
@@ -36,7 +36,7 @@ void TS::GetTemperature(Kernel::HLERequestContext& ctx) {
36 rb.Push(temperature); 36 rb.Push(temperature);
37} 37}
38 38
39void TS::GetTemperatureMilliC(Kernel::HLERequestContext& ctx) { 39void TS::GetTemperatureMilliC(HLERequestContext& ctx) {
40 IPC::RequestParser rp{ctx}; 40 IPC::RequestParser rp{ctx};
41 const auto location{rp.PopEnum<Location>()}; 41 const auto location{rp.PopEnum<Location>()};
42 42
diff --git a/src/core/hle/service/ptm/ts.h b/src/core/hle/service/ptm/ts.h
index 39d51847e..c3f43d5a3 100644
--- a/src/core/hle/service/ptm/ts.h
+++ b/src/core/hle/service/ptm/ts.h
@@ -19,8 +19,8 @@ private:
19 External, 19 External,
20 }; 20 };
21 21
22 void GetTemperature(Kernel::HLERequestContext& ctx); 22 void GetTemperature(HLERequestContext& ctx);
23 void GetTemperatureMilliC(Kernel::HLERequestContext& ctx); 23 void GetTemperatureMilliC(HLERequestContext& ctx);
24}; 24};
25 25
26} // namespace Service::PTM 26} // namespace Service::PTM
diff --git a/src/core/hle/service/server_manager.cpp b/src/core/hle/service/server_manager.cpp
index 1b3db3caf..c91f6d880 100644
--- a/src/core/hle/service/server_manager.cpp
+++ b/src/core/hle/service/server_manager.cpp
@@ -4,8 +4,6 @@
4#include "common/scope_exit.h" 4#include "common/scope_exit.h"
5 5
6#include "core/core.h" 6#include "core/core.h"
7#include "core/hle/ipc_helpers.h"
8#include "core/hle/kernel/hle_ipc.h"
9#include "core/hle/kernel/k_client_port.h" 7#include "core/hle/kernel/k_client_port.h"
10#include "core/hle/kernel/k_client_session.h" 8#include "core/hle/kernel/k_client_session.h"
11#include "core/hle/kernel/k_event.h" 9#include "core/hle/kernel/k_event.h"
@@ -15,6 +13,8 @@
15#include "core/hle/kernel/k_server_session.h" 13#include "core/hle/kernel/k_server_session.h"
16#include "core/hle/kernel/k_synchronization_object.h" 14#include "core/hle/kernel/k_synchronization_object.h"
17#include "core/hle/kernel/svc_results.h" 15#include "core/hle/kernel/svc_results.h"
16#include "core/hle/service/hle_ipc.h"
17#include "core/hle/service/ipc_helpers.h"
18#include "core/hle/service/server_manager.h" 18#include "core/hle/service/server_manager.h"
19#include "core/hle/service/sm/sm.h" 19#include "core/hle/service/sm/sm.h"
20 20
@@ -73,7 +73,7 @@ void ServerManager::RunServer(std::unique_ptr<ServerManager>&& server_manager) {
73} 73}
74 74
75Result ServerManager::RegisterSession(Kernel::KServerSession* session, 75Result ServerManager::RegisterSession(Kernel::KServerSession* session,
76 std::shared_ptr<Kernel::SessionRequestManager> manager) { 76 std::shared_ptr<SessionRequestManager> manager) {
77 ASSERT(m_sessions.size() + m_ports.size() < MaximumWaitObjects); 77 ASSERT(m_sessions.size() + m_ports.size() < MaximumWaitObjects);
78 78
79 // We are taking ownership of the server session, so don't open it. 79 // We are taking ownership of the server session, so don't open it.
@@ -90,7 +90,7 @@ Result ServerManager::RegisterSession(Kernel::KServerSession* session,
90} 90}
91 91
92Result ServerManager::RegisterNamedService(const std::string& service_name, 92Result ServerManager::RegisterNamedService(const std::string& service_name,
93 std::shared_ptr<Kernel::SessionRequestHandler>&& handler, 93 std::shared_ptr<SessionRequestHandler>&& handler,
94 u32 max_sessions) { 94 u32 max_sessions) {
95 ASSERT(m_sessions.size() + m_ports.size() < MaximumWaitObjects); 95 ASSERT(m_sessions.size() + m_ports.size() < MaximumWaitObjects);
96 96
@@ -118,7 +118,7 @@ Result ServerManager::RegisterNamedService(const std::string& service_name,
118} 118}
119 119
120Result ServerManager::ManageNamedPort(const std::string& service_name, 120Result ServerManager::ManageNamedPort(const std::string& service_name,
121 std::shared_ptr<Kernel::SessionRequestHandler>&& handler, 121 std::shared_ptr<SessionRequestHandler>&& handler,
122 u32 max_sessions) { 122 u32 max_sessions) {
123 ASSERT(m_sessions.size() + m_ports.size() < MaximumWaitObjects); 123 ASSERT(m_sessions.size() + m_ports.size() < MaximumWaitObjects);
124 124
@@ -265,7 +265,7 @@ Result ServerManager::WaitAndProcessImpl() {
265 case HandleType::Port: { 265 case HandleType::Port: {
266 // Port signaled. 266 // Port signaled.
267 auto* port = wait_obj->DynamicCast<Kernel::KServerPort*>(); 267 auto* port = wait_obj->DynamicCast<Kernel::KServerPort*>();
268 std::shared_ptr<Kernel::SessionRequestHandler> handler; 268 std::shared_ptr<SessionRequestHandler> handler;
269 269
270 // Remove from tracking. 270 // Remove from tracking.
271 { 271 {
@@ -284,7 +284,7 @@ Result ServerManager::WaitAndProcessImpl() {
284 case HandleType::Session: { 284 case HandleType::Session: {
285 // Session signaled. 285 // Session signaled.
286 auto* session = wait_obj->DynamicCast<Kernel::KServerSession*>(); 286 auto* session = wait_obj->DynamicCast<Kernel::KServerSession*>();
287 std::shared_ptr<Kernel::SessionRequestManager> manager; 287 std::shared_ptr<SessionRequestManager> manager;
288 288
289 // Remove from tracking. 289 // Remove from tracking.
290 { 290 {
@@ -329,13 +329,13 @@ Result ServerManager::WaitAndProcessImpl() {
329} 329}
330 330
331Result ServerManager::OnPortEvent(Kernel::KServerPort* port, 331Result ServerManager::OnPortEvent(Kernel::KServerPort* port,
332 std::shared_ptr<Kernel::SessionRequestHandler>&& handler) { 332 std::shared_ptr<SessionRequestHandler>&& handler) {
333 // Accept a new server session. 333 // Accept a new server session.
334 Kernel::KServerSession* session = port->AcceptSession(); 334 Kernel::KServerSession* session = port->AcceptSession();
335 ASSERT(session != nullptr); 335 ASSERT(session != nullptr);
336 336
337 // Create the session manager and install the handler. 337 // Create the session manager and install the handler.
338 auto manager = std::make_shared<Kernel::SessionRequestManager>(m_system.Kernel(), *this); 338 auto manager = std::make_shared<SessionRequestManager>(m_system.Kernel(), *this);
339 manager->SetSessionHandler(std::shared_ptr(handler)); 339 manager->SetSessionHandler(std::shared_ptr(handler));
340 340
341 // Track the server session. 341 // Track the server session.
@@ -353,11 +353,11 @@ Result ServerManager::OnPortEvent(Kernel::KServerPort* port,
353} 353}
354 354
355Result ServerManager::OnSessionEvent(Kernel::KServerSession* session, 355Result ServerManager::OnSessionEvent(Kernel::KServerSession* session,
356 std::shared_ptr<Kernel::SessionRequestManager>&& manager) { 356 std::shared_ptr<SessionRequestManager>&& manager) {
357 Result rc{ResultSuccess}; 357 Result rc{ResultSuccess};
358 358
359 // Try to receive a message. 359 // Try to receive a message.
360 std::shared_ptr<Kernel::HLERequestContext> context; 360 std::shared_ptr<HLERequestContext> context;
361 rc = session->ReceiveRequest(&context, manager); 361 rc = session->ReceiveRequest(&context, manager);
362 362
363 // If the session has been closed, we're done. 363 // If the session has been closed, we're done.
diff --git a/src/core/hle/service/server_manager.h b/src/core/hle/service/server_manager.h
index 57b954ae8..fdb8af2ff 100644
--- a/src/core/hle/service/server_manager.h
+++ b/src/core/hle/service/server_manager.h
@@ -20,30 +20,30 @@ class System;
20} 20}
21 21
22namespace Kernel { 22namespace Kernel {
23class HLERequestContext;
24class KEvent; 23class KEvent;
25class KServerPort; 24class KServerPort;
26class KServerSession; 25class KServerSession;
27class KSynchronizationObject; 26class KSynchronizationObject;
28class SessionRequestHandler;
29class SessionRequestManager;
30} // namespace Kernel 27} // namespace Kernel
31 28
32namespace Service { 29namespace Service {
33 30
31class HLERequestContext;
32class SessionRequestHandler;
33class SessionRequestManager;
34
34class ServerManager { 35class ServerManager {
35public: 36public:
36 explicit ServerManager(Core::System& system); 37 explicit ServerManager(Core::System& system);
37 ~ServerManager(); 38 ~ServerManager();
38 39
39 Result RegisterSession(Kernel::KServerSession* session, 40 Result RegisterSession(Kernel::KServerSession* session,
40 std::shared_ptr<Kernel::SessionRequestManager> manager); 41 std::shared_ptr<SessionRequestManager> manager);
41 Result RegisterNamedService(const std::string& service_name, 42 Result RegisterNamedService(const std::string& service_name,
42 std::shared_ptr<Kernel::SessionRequestHandler>&& handler, 43 std::shared_ptr<SessionRequestHandler>&& handler,
43 u32 max_sessions = 64); 44 u32 max_sessions = 64);
44 Result ManageNamedPort(const std::string& service_name, 45 Result ManageNamedPort(const std::string& service_name,
45 std::shared_ptr<Kernel::SessionRequestHandler>&& handler, 46 std::shared_ptr<SessionRequestHandler>&& handler, u32 max_sessions = 64);
46 u32 max_sessions = 64);
47 Result ManageDeferral(Kernel::KEvent** out_event); 47 Result ManageDeferral(Kernel::KEvent** out_event);
48 48
49 Result LoopProcess(); 49 Result LoopProcess();
@@ -56,10 +56,9 @@ private:
56 56
57 Result LoopProcessImpl(); 57 Result LoopProcessImpl();
58 Result WaitAndProcessImpl(); 58 Result WaitAndProcessImpl();
59 Result OnPortEvent(Kernel::KServerPort* port, 59 Result OnPortEvent(Kernel::KServerPort* port, std::shared_ptr<SessionRequestHandler>&& handler);
60 std::shared_ptr<Kernel::SessionRequestHandler>&& handler);
61 Result OnSessionEvent(Kernel::KServerSession* session, 60 Result OnSessionEvent(Kernel::KServerSession* session,
62 std::shared_ptr<Kernel::SessionRequestManager>&& manager); 61 std::shared_ptr<SessionRequestManager>&& manager);
63 Result OnDeferralEvent(std::list<RequestState>&& deferrals); 62 Result OnDeferralEvent(std::list<RequestState>&& deferrals);
64 Result CompleteSyncRequest(RequestState&& state); 63 Result CompleteSyncRequest(RequestState&& state);
65 64
@@ -69,16 +68,16 @@ private:
69 std::mutex m_list_mutex; 68 std::mutex m_list_mutex;
70 69
71 // Guest state tracking 70 // Guest state tracking
72 std::map<Kernel::KServerPort*, std::shared_ptr<Kernel::SessionRequestHandler>> m_ports{}; 71 std::map<Kernel::KServerPort*, std::shared_ptr<SessionRequestHandler>> m_ports{};
73 std::map<Kernel::KServerSession*, std::shared_ptr<Kernel::SessionRequestManager>> m_sessions{}; 72 std::map<Kernel::KServerSession*, std::shared_ptr<SessionRequestManager>> m_sessions{};
74 Kernel::KEvent* m_event{}; 73 Kernel::KEvent* m_event{};
75 Kernel::KEvent* m_deferral_event{}; 74 Kernel::KEvent* m_deferral_event{};
76 75
77 // Deferral tracking 76 // Deferral tracking
78 struct RequestState { 77 struct RequestState {
79 Kernel::KServerSession* session; 78 Kernel::KServerSession* session;
80 std::shared_ptr<Kernel::HLERequestContext> context; 79 std::shared_ptr<HLERequestContext> context;
81 std::shared_ptr<Kernel::SessionRequestManager> manager; 80 std::shared_ptr<SessionRequestManager> manager;
82 }; 81 };
83 std::list<RequestState> m_deferrals{}; 82 std::list<RequestState> m_deferrals{};
84 83
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 31021ea03..eed615377 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -7,7 +7,6 @@
7#include "common/settings.h" 7#include "common/settings.h"
8#include "core/core.h" 8#include "core/core.h"
9#include "core/hle/ipc.h" 9#include "core/hle/ipc.h"
10#include "core/hle/ipc_helpers.h"
11#include "core/hle/kernel/k_process.h" 10#include "core/hle/kernel/k_process.h"
12#include "core/hle/kernel/k_server_port.h" 11#include "core/hle/kernel/k_server_port.h"
13#include "core/hle/kernel/kernel.h" 12#include "core/hle/kernel/kernel.h"
@@ -31,6 +30,7 @@
31#include "core/hle/service/glue/glue.h" 30#include "core/hle/service/glue/glue.h"
32#include "core/hle/service/grc/grc.h" 31#include "core/hle/service/grc/grc.h"
33#include "core/hle/service/hid/hid.h" 32#include "core/hle/service/hid/hid.h"
33#include "core/hle/service/ipc_helpers.h"
34#include "core/hle/service/jit/jit.h" 34#include "core/hle/service/jit/jit.h"
35#include "core/hle/service/lbl/lbl.h" 35#include "core/hle/service/lbl/lbl.h"
36#include "core/hle/service/ldn/ldn.h" 36#include "core/hle/service/ldn/ldn.h"
@@ -49,8 +49,8 @@
49#include "core/hle/service/npns/npns.h" 49#include "core/hle/service/npns/npns.h"
50#include "core/hle/service/ns/ns.h" 50#include "core/hle/service/ns/ns.h"
51#include "core/hle/service/nvdrv/nvdrv.h" 51#include "core/hle/service/nvdrv/nvdrv.h"
52#include "core/hle/service/nvflinger/hos_binder_driver_server.h" 52#include "core/hle/service/nvnflinger/hos_binder_driver_server.h"
53#include "core/hle/service/nvflinger/nvflinger.h" 53#include "core/hle/service/nvnflinger/nvnflinger.h"
54#include "core/hle/service/olsc/olsc.h" 54#include "core/hle/service/olsc/olsc.h"
55#include "core/hle/service/pcie/pcie.h" 55#include "core/hle/service/pcie/pcie.h"
56#include "core/hle/service/pctl/pctl_module.h" 56#include "core/hle/service/pctl/pctl_module.h"
@@ -117,7 +117,7 @@ void ServiceFrameworkBase::RegisterHandlersBaseTipc(const FunctionInfoBase* func
117 } 117 }
118} 118}
119 119
120void ServiceFrameworkBase::ReportUnimplementedFunction(Kernel::HLERequestContext& ctx, 120void ServiceFrameworkBase::ReportUnimplementedFunction(HLERequestContext& ctx,
121 const FunctionInfoBase* info) { 121 const FunctionInfoBase* info) {
122 auto cmd_buf = ctx.CommandBuffer(); 122 auto cmd_buf = ctx.CommandBuffer();
123 std::string function_name = info == nullptr ? fmt::format("{}", ctx.GetCommand()) : info->name; 123 std::string function_name = info == nullptr ? fmt::format("{}", ctx.GetCommand()) : info->name;
@@ -140,7 +140,7 @@ void ServiceFrameworkBase::ReportUnimplementedFunction(Kernel::HLERequestContext
140 } 140 }
141} 141}
142 142
143void ServiceFrameworkBase::InvokeRequest(Kernel::HLERequestContext& ctx) { 143void ServiceFrameworkBase::InvokeRequest(HLERequestContext& ctx) {
144 auto itr = handlers.find(ctx.GetCommand()); 144 auto itr = handlers.find(ctx.GetCommand());
145 const FunctionInfoBase* info = itr == handlers.end() ? nullptr : &itr->second; 145 const FunctionInfoBase* info = itr == handlers.end() ? nullptr : &itr->second;
146 if (info == nullptr || info->handler_callback == nullptr) { 146 if (info == nullptr || info->handler_callback == nullptr) {
@@ -151,7 +151,7 @@ void ServiceFrameworkBase::InvokeRequest(Kernel::HLERequestContext& ctx) {
151 handler_invoker(this, info->handler_callback, ctx); 151 handler_invoker(this, info->handler_callback, ctx);
152} 152}
153 153
154void ServiceFrameworkBase::InvokeRequestTipc(Kernel::HLERequestContext& ctx) { 154void ServiceFrameworkBase::InvokeRequestTipc(HLERequestContext& ctx) {
155 boost::container::flat_map<u32, FunctionInfoBase>::iterator itr; 155 boost::container::flat_map<u32, FunctionInfoBase>::iterator itr;
156 156
157 itr = handlers_tipc.find(ctx.GetCommand()); 157 itr = handlers_tipc.find(ctx.GetCommand());
@@ -166,7 +166,7 @@ void ServiceFrameworkBase::InvokeRequestTipc(Kernel::HLERequestContext& ctx) {
166} 166}
167 167
168Result ServiceFrameworkBase::HandleSyncRequest(Kernel::KServerSession& session, 168Result ServiceFrameworkBase::HandleSyncRequest(Kernel::KServerSession& session,
169 Kernel::HLERequestContext& ctx) { 169 HLERequestContext& ctx) {
170 const auto guard = LockService(); 170 const auto guard = LockService();
171 171
172 Result result = ResultSuccess; 172 Result result = ResultSuccess;
@@ -210,12 +210,12 @@ Result ServiceFrameworkBase::HandleSyncRequest(Kernel::KServerSession& session,
210 210
211/// Initialize Services 211/// Initialize Services
212Services::Services(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system) 212Services::Services(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system)
213 : hos_binder_driver_server{std::make_unique<NVFlinger::HosBinderDriverServer>(system)}, 213 : hos_binder_driver_server{std::make_unique<Nvnflinger::HosBinderDriverServer>(system)},
214 nv_flinger{std::make_unique<NVFlinger::NVFlinger>(system, *hos_binder_driver_server)} { 214 nv_flinger{std::make_unique<Nvnflinger::Nvnflinger>(system, *hos_binder_driver_server)} {
215 215
216 auto& kernel = system.Kernel(); 216 auto& kernel = system.Kernel();
217 217
218 // NVFlinger needs to be accessed by several services like Vi and AppletOE so we instantiate it 218 // Nvnflinger needs to be accessed by several services like Vi and AppletOE so we instantiate it
219 // here and pass it into the respective InstallInterfaces functions. 219 // here and pass it into the respective InstallInterfaces functions.
220 system.GetFileSystemController().CreateFactories(*system.GetFilesystem(), false); 220 system.GetFileSystemController().CreateFactories(*system.GetFilesystem(), false);
221 221
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index db3b31378..0f79a1b7e 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -8,7 +8,7 @@
8#include <string> 8#include <string>
9#include <boost/container/flat_map.hpp> 9#include <boost/container/flat_map.hpp>
10#include "common/common_types.h" 10#include "common/common_types.h"
11#include "core/hle/kernel/hle_ipc.h" 11#include "core/hle/service/hle_ipc.h"
12 12
13//////////////////////////////////////////////////////////////////////////////////////////////////// 13////////////////////////////////////////////////////////////////////////////////////////////////////
14// Namespace Service 14// Namespace Service
@@ -18,7 +18,6 @@ class System;
18} 18}
19 19
20namespace Kernel { 20namespace Kernel {
21class HLERequestContext;
22class KServerSession; 21class KServerSession;
23class ServiceThread; 22class ServiceThread;
24} // namespace Kernel 23} // namespace Kernel
@@ -29,10 +28,10 @@ namespace FileSystem {
29class FileSystemController; 28class FileSystemController;
30} 29}
31 30
32namespace NVFlinger { 31namespace Nvnflinger {
33class HosBinderDriverServer; 32class HosBinderDriverServer;
34class NVFlinger; 33class Nvnflinger;
35} // namespace NVFlinger 34} // namespace Nvnflinger
36 35
37namespace SM { 36namespace SM {
38class ServiceManager; 37class ServiceManager;
@@ -50,7 +49,7 @@ static_assert(ServerSessionCountMax == 0x40,
50 * 49 *
51 * @see ServiceFramework 50 * @see ServiceFramework
52 */ 51 */
53class ServiceFrameworkBase : public Kernel::SessionRequestHandler { 52class ServiceFrameworkBase : public SessionRequestHandler {
54public: 53public:
55 /// Returns the string identifier used to connect to the service. 54 /// Returns the string identifier used to connect to the service.
56 std::string GetServiceName() const { 55 std::string GetServiceName() const {
@@ -66,19 +65,18 @@ public:
66 } 65 }
67 66
68 /// Invokes a service request routine using the HIPC protocol. 67 /// Invokes a service request routine using the HIPC protocol.
69 void InvokeRequest(Kernel::HLERequestContext& ctx); 68 void InvokeRequest(HLERequestContext& ctx);
70 69
71 /// Invokes a service request routine using the HIPC protocol. 70 /// Invokes a service request routine using the HIPC protocol.
72 void InvokeRequestTipc(Kernel::HLERequestContext& ctx); 71 void InvokeRequestTipc(HLERequestContext& ctx);
73 72
74 /// Handles a synchronization request for the service. 73 /// Handles a synchronization request for the service.
75 Result HandleSyncRequest(Kernel::KServerSession& session, 74 Result HandleSyncRequest(Kernel::KServerSession& session, HLERequestContext& context) override;
76 Kernel::HLERequestContext& context) override;
77 75
78protected: 76protected:
79 /// Member-function pointer type of SyncRequest handlers. 77 /// Member-function pointer type of SyncRequest handlers.
80 template <typename Self> 78 template <typename Self>
81 using HandlerFnP = void (Self::*)(Kernel::HLERequestContext&); 79 using HandlerFnP = void (Self::*)(HLERequestContext&);
82 80
83 /// Used to gain exclusive access to the service members, e.g. from CoreTiming thread. 81 /// Used to gain exclusive access to the service members, e.g. from CoreTiming thread.
84 [[nodiscard]] std::scoped_lock<std::mutex> LockService() { 82 [[nodiscard]] std::scoped_lock<std::mutex> LockService() {
@@ -102,7 +100,7 @@ private:
102 }; 100 };
103 101
104 using InvokerFn = void(ServiceFrameworkBase* object, HandlerFnP<ServiceFrameworkBase> member, 102 using InvokerFn = void(ServiceFrameworkBase* object, HandlerFnP<ServiceFrameworkBase> member,
105 Kernel::HLERequestContext& ctx); 103 HLERequestContext& ctx);
106 104
107 explicit ServiceFrameworkBase(Core::System& system_, const char* service_name_, 105 explicit ServiceFrameworkBase(Core::System& system_, const char* service_name_,
108 u32 max_sessions_, InvokerFn* handler_invoker_); 106 u32 max_sessions_, InvokerFn* handler_invoker_);
@@ -110,7 +108,7 @@ private:
110 108
111 void RegisterHandlersBase(const FunctionInfoBase* functions, std::size_t n); 109 void RegisterHandlersBase(const FunctionInfoBase* functions, std::size_t n);
112 void RegisterHandlersBaseTipc(const FunctionInfoBase* functions, std::size_t n); 110 void RegisterHandlersBaseTipc(const FunctionInfoBase* functions, std::size_t n);
113 void ReportUnimplementedFunction(Kernel::HLERequestContext& ctx, const FunctionInfoBase* info); 111 void ReportUnimplementedFunction(HLERequestContext& ctx, const FunctionInfoBase* info);
114 112
115 /// Maximum number of concurrent sessions that this service can handle. 113 /// Maximum number of concurrent sessions that this service can handle.
116 u32 max_sessions; 114 u32 max_sessions;
@@ -212,7 +210,7 @@ private:
212 * of the derived class in order to invoke one of it's functions through a pointer. 210 * of the derived class in order to invoke one of it's functions through a pointer.
213 */ 211 */
214 static void Invoker(ServiceFrameworkBase* object, HandlerFnP<ServiceFrameworkBase> member, 212 static void Invoker(ServiceFrameworkBase* object, HandlerFnP<ServiceFrameworkBase> member,
215 Kernel::HLERequestContext& ctx) { 213 HLERequestContext& ctx) {
216 // Cast back up to our original types and call the member function 214 // Cast back up to our original types and call the member function
217 (static_cast<Self*>(object)->*static_cast<HandlerFnP<Self>>(member))(ctx); 215 (static_cast<Self*>(object)->*static_cast<HandlerFnP<Self>>(member))(ctx);
218 } 216 }
@@ -230,8 +228,8 @@ public:
230 void KillNVNFlinger(); 228 void KillNVNFlinger();
231 229
232private: 230private:
233 std::unique_ptr<NVFlinger::HosBinderDriverServer> hos_binder_driver_server; 231 std::unique_ptr<Nvnflinger::HosBinderDriverServer> hos_binder_driver_server;
234 std::unique_ptr<NVFlinger::NVFlinger> nv_flinger; 232 std::unique_ptr<Nvnflinger::Nvnflinger> nv_flinger;
235}; 233};
236 234
237} // namespace Service 235} // namespace Service
diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/set.cpp
index 16c5eaf75..88df52331 100644
--- a/src/core/hle/service/set/set.cpp
+++ b/src/core/hle/service/set/set.cpp
@@ -6,7 +6,7 @@
6#include <chrono> 6#include <chrono>
7#include "common/logging/log.h" 7#include "common/logging/log.h"
8#include "common/settings.h" 8#include "common/settings.h"
9#include "core/hle/ipc_helpers.h" 9#include "core/hle/service/ipc_helpers.h"
10#include "core/hle/service/set/set.h" 10#include "core/hle/service/set/set.h"
11 11
12namespace Service::Set { 12namespace Service::Set {
@@ -76,13 +76,13 @@ constexpr std::size_t POST_4_0_0_MAX_ENTRIES = 0x40;
76 76
77constexpr Result ERR_INVALID_LANGUAGE{ErrorModule::Settings, 625}; 77constexpr Result ERR_INVALID_LANGUAGE{ErrorModule::Settings, 625};
78 78
79void PushResponseLanguageCode(Kernel::HLERequestContext& ctx, std::size_t num_language_codes) { 79void PushResponseLanguageCode(HLERequestContext& ctx, std::size_t num_language_codes) {
80 IPC::ResponseBuilder rb{ctx, 3}; 80 IPC::ResponseBuilder rb{ctx, 3};
81 rb.Push(ResultSuccess); 81 rb.Push(ResultSuccess);
82 rb.Push(static_cast<u32>(num_language_codes)); 82 rb.Push(static_cast<u32>(num_language_codes));
83} 83}
84 84
85void GetAvailableLanguageCodesImpl(Kernel::HLERequestContext& ctx, std::size_t max_entries) { 85void GetAvailableLanguageCodesImpl(HLERequestContext& ctx, std::size_t max_entries) {
86 const std::size_t requested_amount = ctx.GetWriteBufferNumElements<LanguageCode>(); 86 const std::size_t requested_amount = ctx.GetWriteBufferNumElements<LanguageCode>();
87 const std::size_t max_amount = std::min(requested_amount, max_entries); 87 const std::size_t max_amount = std::min(requested_amount, max_entries);
88 const std::size_t copy_amount = std::min(available_language_codes.size(), max_amount); 88 const std::size_t copy_amount = std::min(available_language_codes.size(), max_amount);
@@ -92,7 +92,7 @@ void GetAvailableLanguageCodesImpl(Kernel::HLERequestContext& ctx, std::size_t m
92 PushResponseLanguageCode(ctx, copy_amount); 92 PushResponseLanguageCode(ctx, copy_amount);
93} 93}
94 94
95void GetKeyCodeMapImpl(Kernel::HLERequestContext& ctx) { 95void GetKeyCodeMapImpl(HLERequestContext& ctx) {
96 const auto language_code = available_language_codes[Settings::values.language_index.GetValue()]; 96 const auto language_code = available_language_codes[Settings::values.language_index.GetValue()];
97 const auto key_code = 97 const auto key_code =
98 std::find_if(language_to_layout.cbegin(), language_to_layout.cend(), 98 std::find_if(language_to_layout.cbegin(), language_to_layout.cend(),
@@ -117,13 +117,13 @@ LanguageCode GetLanguageCodeFromIndex(std::size_t index) {
117 return available_language_codes.at(index); 117 return available_language_codes.at(index);
118} 118}
119 119
120void SET::GetAvailableLanguageCodes(Kernel::HLERequestContext& ctx) { 120void SET::GetAvailableLanguageCodes(HLERequestContext& ctx) {
121 LOG_DEBUG(Service_SET, "called"); 121 LOG_DEBUG(Service_SET, "called");
122 122
123 GetAvailableLanguageCodesImpl(ctx, PRE_4_0_0_MAX_ENTRIES); 123 GetAvailableLanguageCodesImpl(ctx, PRE_4_0_0_MAX_ENTRIES);
124} 124}
125 125
126void SET::MakeLanguageCode(Kernel::HLERequestContext& ctx) { 126void SET::MakeLanguageCode(HLERequestContext& ctx) {
127 IPC::RequestParser rp{ctx}; 127 IPC::RequestParser rp{ctx};
128 const auto index = rp.Pop<u32>(); 128 const auto index = rp.Pop<u32>();
129 129
@@ -139,25 +139,25 @@ void SET::MakeLanguageCode(Kernel::HLERequestContext& ctx) {
139 rb.PushEnum(available_language_codes[index]); 139 rb.PushEnum(available_language_codes[index]);
140} 140}
141 141
142void SET::GetAvailableLanguageCodes2(Kernel::HLERequestContext& ctx) { 142void SET::GetAvailableLanguageCodes2(HLERequestContext& ctx) {
143 LOG_DEBUG(Service_SET, "called"); 143 LOG_DEBUG(Service_SET, "called");
144 144
145 GetAvailableLanguageCodesImpl(ctx, POST_4_0_0_MAX_ENTRIES); 145 GetAvailableLanguageCodesImpl(ctx, POST_4_0_0_MAX_ENTRIES);
146} 146}
147 147
148void SET::GetAvailableLanguageCodeCount(Kernel::HLERequestContext& ctx) { 148void SET::GetAvailableLanguageCodeCount(HLERequestContext& ctx) {
149 LOG_DEBUG(Service_SET, "called"); 149 LOG_DEBUG(Service_SET, "called");
150 150
151 PushResponseLanguageCode(ctx, PRE_4_0_0_MAX_ENTRIES); 151 PushResponseLanguageCode(ctx, PRE_4_0_0_MAX_ENTRIES);
152} 152}
153 153
154void SET::GetAvailableLanguageCodeCount2(Kernel::HLERequestContext& ctx) { 154void SET::GetAvailableLanguageCodeCount2(HLERequestContext& ctx) {
155 LOG_DEBUG(Service_SET, "called"); 155 LOG_DEBUG(Service_SET, "called");
156 156
157 PushResponseLanguageCode(ctx, POST_4_0_0_MAX_ENTRIES); 157 PushResponseLanguageCode(ctx, POST_4_0_0_MAX_ENTRIES);
158} 158}
159 159
160void SET::GetQuestFlag(Kernel::HLERequestContext& ctx) { 160void SET::GetQuestFlag(HLERequestContext& ctx) {
161 LOG_DEBUG(Service_SET, "called"); 161 LOG_DEBUG(Service_SET, "called");
162 162
163 IPC::ResponseBuilder rb{ctx, 3}; 163 IPC::ResponseBuilder rb{ctx, 3};
@@ -165,7 +165,7 @@ void SET::GetQuestFlag(Kernel::HLERequestContext& ctx) {
165 rb.Push(static_cast<u32>(Settings::values.quest_flag.GetValue())); 165 rb.Push(static_cast<u32>(Settings::values.quest_flag.GetValue()));
166} 166}
167 167
168void SET::GetLanguageCode(Kernel::HLERequestContext& ctx) { 168void SET::GetLanguageCode(HLERequestContext& ctx) {
169 LOG_DEBUG(Service_SET, "called {}", Settings::values.language_index.GetValue()); 169 LOG_DEBUG(Service_SET, "called {}", Settings::values.language_index.GetValue());
170 170
171 IPC::ResponseBuilder rb{ctx, 4}; 171 IPC::ResponseBuilder rb{ctx, 4};
@@ -173,7 +173,7 @@ void SET::GetLanguageCode(Kernel::HLERequestContext& ctx) {
173 rb.PushEnum(available_language_codes[Settings::values.language_index.GetValue()]); 173 rb.PushEnum(available_language_codes[Settings::values.language_index.GetValue()]);
174} 174}
175 175
176void SET::GetRegionCode(Kernel::HLERequestContext& ctx) { 176void SET::GetRegionCode(HLERequestContext& ctx) {
177 LOG_DEBUG(Service_SET, "called"); 177 LOG_DEBUG(Service_SET, "called");
178 178
179 IPC::ResponseBuilder rb{ctx, 3}; 179 IPC::ResponseBuilder rb{ctx, 3};
@@ -181,17 +181,17 @@ void SET::GetRegionCode(Kernel::HLERequestContext& ctx) {
181 rb.Push(Settings::values.region_index.GetValue()); 181 rb.Push(Settings::values.region_index.GetValue());
182} 182}
183 183
184void SET::GetKeyCodeMap(Kernel::HLERequestContext& ctx) { 184void SET::GetKeyCodeMap(HLERequestContext& ctx) {
185 LOG_DEBUG(Service_SET, "Called {}", ctx.Description()); 185 LOG_DEBUG(Service_SET, "Called {}", ctx.Description());
186 GetKeyCodeMapImpl(ctx); 186 GetKeyCodeMapImpl(ctx);
187} 187}
188 188
189void SET::GetKeyCodeMap2(Kernel::HLERequestContext& ctx) { 189void SET::GetKeyCodeMap2(HLERequestContext& ctx) {
190 LOG_DEBUG(Service_SET, "Called {}", ctx.Description()); 190 LOG_DEBUG(Service_SET, "Called {}", ctx.Description());
191 GetKeyCodeMapImpl(ctx); 191 GetKeyCodeMapImpl(ctx);
192} 192}
193 193
194void SET::GetDeviceNickName(Kernel::HLERequestContext& ctx) { 194void SET::GetDeviceNickName(HLERequestContext& ctx) {
195 LOG_DEBUG(Service_SET, "called"); 195 LOG_DEBUG(Service_SET, "called");
196 IPC::ResponseBuilder rb{ctx, 2}; 196 IPC::ResponseBuilder rb{ctx, 2};
197 rb.Push(ResultSuccess); 197 rb.Push(ResultSuccess);
diff --git a/src/core/hle/service/set/set.h b/src/core/hle/service/set/set.h
index 375975711..7fd3a7654 100644
--- a/src/core/hle/service/set/set.h
+++ b/src/core/hle/service/set/set.h
@@ -40,17 +40,17 @@ public:
40 ~SET() override; 40 ~SET() override;
41 41
42private: 42private:
43 void GetLanguageCode(Kernel::HLERequestContext& ctx); 43 void GetLanguageCode(HLERequestContext& ctx);
44 void GetAvailableLanguageCodes(Kernel::HLERequestContext& ctx); 44 void GetAvailableLanguageCodes(HLERequestContext& ctx);
45 void MakeLanguageCode(Kernel::HLERequestContext& ctx); 45 void MakeLanguageCode(HLERequestContext& ctx);
46 void GetAvailableLanguageCodes2(Kernel::HLERequestContext& ctx); 46 void GetAvailableLanguageCodes2(HLERequestContext& ctx);
47 void GetAvailableLanguageCodeCount(Kernel::HLERequestContext& ctx); 47 void GetAvailableLanguageCodeCount(HLERequestContext& ctx);
48 void GetAvailableLanguageCodeCount2(Kernel::HLERequestContext& ctx); 48 void GetAvailableLanguageCodeCount2(HLERequestContext& ctx);
49 void GetQuestFlag(Kernel::HLERequestContext& ctx); 49 void GetQuestFlag(HLERequestContext& ctx);
50 void GetRegionCode(Kernel::HLERequestContext& ctx); 50 void GetRegionCode(HLERequestContext& ctx);
51 void GetKeyCodeMap(Kernel::HLERequestContext& ctx); 51 void GetKeyCodeMap(HLERequestContext& ctx);
52 void GetKeyCodeMap2(Kernel::HLERequestContext& ctx); 52 void GetKeyCodeMap2(HLERequestContext& ctx);
53 void GetDeviceNickName(Kernel::HLERequestContext& ctx); 53 void GetDeviceNickName(HLERequestContext& ctx);
54}; 54};
55 55
56} // namespace Service::Set 56} // namespace Service::Set
diff --git a/src/core/hle/service/set/set_sys.cpp b/src/core/hle/service/set/set_sys.cpp
index 94c20edda..2e38d1cfc 100644
--- a/src/core/hle/service/set/set_sys.cpp
+++ b/src/core/hle/service/set/set_sys.cpp
@@ -6,8 +6,8 @@
6#include "common/settings.h" 6#include "common/settings.h"
7#include "core/file_sys/errors.h" 7#include "core/file_sys/errors.h"
8#include "core/file_sys/system_archive/system_version.h" 8#include "core/file_sys/system_archive/system_version.h"
9#include "core/hle/ipc_helpers.h"
10#include "core/hle/service/filesystem/filesystem.h" 9#include "core/hle/service/filesystem/filesystem.h"
10#include "core/hle/service/ipc_helpers.h"
11#include "core/hle/service/set/set_sys.h" 11#include "core/hle/service/set/set_sys.h"
12 12
13namespace Service::Set { 13namespace Service::Set {
@@ -20,7 +20,7 @@ enum class GetFirmwareVersionType {
20 Version2, 20 Version2,
21}; 21};
22 22
23void GetFirmwareVersionImpl(Kernel::HLERequestContext& ctx, GetFirmwareVersionType type) { 23void GetFirmwareVersionImpl(HLERequestContext& ctx, GetFirmwareVersionType type) {
24 LOG_WARNING(Service_SET, "called - Using hardcoded firmware version '{}'", 24 LOG_WARNING(Service_SET, "called - Using hardcoded firmware version '{}'",
25 FileSys::SystemArchive::GetLongDisplayVersion()); 25 FileSys::SystemArchive::GetLongDisplayVersion());
26 26
@@ -73,17 +73,17 @@ void GetFirmwareVersionImpl(Kernel::HLERequestContext& ctx, GetFirmwareVersionTy
73} 73}
74} // Anonymous namespace 74} // Anonymous namespace
75 75
76void SET_SYS::GetFirmwareVersion(Kernel::HLERequestContext& ctx) { 76void SET_SYS::GetFirmwareVersion(HLERequestContext& ctx) {
77 LOG_DEBUG(Service_SET, "called"); 77 LOG_DEBUG(Service_SET, "called");
78 GetFirmwareVersionImpl(ctx, GetFirmwareVersionType::Version1); 78 GetFirmwareVersionImpl(ctx, GetFirmwareVersionType::Version1);
79} 79}
80 80
81void SET_SYS::GetFirmwareVersion2(Kernel::HLERequestContext& ctx) { 81void SET_SYS::GetFirmwareVersion2(HLERequestContext& ctx) {
82 LOG_DEBUG(Service_SET, "called"); 82 LOG_DEBUG(Service_SET, "called");
83 GetFirmwareVersionImpl(ctx, GetFirmwareVersionType::Version2); 83 GetFirmwareVersionImpl(ctx, GetFirmwareVersionType::Version2);
84} 84}
85 85
86void SET_SYS::GetColorSetId(Kernel::HLERequestContext& ctx) { 86void SET_SYS::GetColorSetId(HLERequestContext& ctx) {
87 LOG_DEBUG(Service_SET, "called"); 87 LOG_DEBUG(Service_SET, "called");
88 88
89 IPC::ResponseBuilder rb{ctx, 3}; 89 IPC::ResponseBuilder rb{ctx, 3};
@@ -92,7 +92,7 @@ void SET_SYS::GetColorSetId(Kernel::HLERequestContext& ctx) {
92 rb.PushEnum(color_set); 92 rb.PushEnum(color_set);
93} 93}
94 94
95void SET_SYS::SetColorSetId(Kernel::HLERequestContext& ctx) { 95void SET_SYS::SetColorSetId(HLERequestContext& ctx) {
96 LOG_DEBUG(Service_SET, "called"); 96 LOG_DEBUG(Service_SET, "called");
97 97
98 IPC::RequestParser rp{ctx}; 98 IPC::RequestParser rp{ctx};
@@ -126,7 +126,7 @@ static Settings GetSettings() {
126 return ret; 126 return ret;
127} 127}
128 128
129void SET_SYS::GetSettingsItemValueSize(Kernel::HLERequestContext& ctx) { 129void SET_SYS::GetSettingsItemValueSize(HLERequestContext& ctx) {
130 LOG_DEBUG(Service_SET, "called"); 130 LOG_DEBUG(Service_SET, "called");
131 131
132 // The category of the setting. This corresponds to the top-level keys of 132 // The category of the setting. This corresponds to the top-level keys of
@@ -151,7 +151,7 @@ void SET_SYS::GetSettingsItemValueSize(Kernel::HLERequestContext& ctx) {
151 rb.Push(response_size); 151 rb.Push(response_size);
152} 152}
153 153
154void SET_SYS::GetSettingsItemValue(Kernel::HLERequestContext& ctx) { 154void SET_SYS::GetSettingsItemValue(HLERequestContext& ctx) {
155 LOG_DEBUG(Service_SET, "called"); 155 LOG_DEBUG(Service_SET, "called");
156 156
157 // The category of the setting. This corresponds to the top-level keys of 157 // The category of the setting. This corresponds to the top-level keys of
@@ -177,7 +177,7 @@ void SET_SYS::GetSettingsItemValue(Kernel::HLERequestContext& ctx) {
177 rb.Push(response); 177 rb.Push(response);
178} 178}
179 179
180void SET_SYS::GetDeviceNickName(Kernel::HLERequestContext& ctx) { 180void SET_SYS::GetDeviceNickName(HLERequestContext& ctx) {
181 LOG_DEBUG(Service_SET, "called"); 181 LOG_DEBUG(Service_SET, "called");
182 IPC::ResponseBuilder rb{ctx, 2}; 182 IPC::ResponseBuilder rb{ctx, 2};
183 rb.Push(ResultSuccess); 183 rb.Push(ResultSuccess);
diff --git a/src/core/hle/service/set/set_sys.h b/src/core/hle/service/set/set_sys.h
index 464ac3da1..1efbcc97a 100644
--- a/src/core/hle/service/set/set_sys.h
+++ b/src/core/hle/service/set/set_sys.h
@@ -23,13 +23,13 @@ private:
23 BasicBlack = 1, 23 BasicBlack = 1,
24 }; 24 };
25 25
26 void GetSettingsItemValueSize(Kernel::HLERequestContext& ctx); 26 void GetSettingsItemValueSize(HLERequestContext& ctx);
27 void GetSettingsItemValue(Kernel::HLERequestContext& ctx); 27 void GetSettingsItemValue(HLERequestContext& ctx);
28 void GetFirmwareVersion(Kernel::HLERequestContext& ctx); 28 void GetFirmwareVersion(HLERequestContext& ctx);
29 void GetFirmwareVersion2(Kernel::HLERequestContext& ctx); 29 void GetFirmwareVersion2(HLERequestContext& ctx);
30 void GetColorSetId(Kernel::HLERequestContext& ctx); 30 void GetColorSetId(HLERequestContext& ctx);
31 void SetColorSetId(Kernel::HLERequestContext& ctx); 31 void SetColorSetId(HLERequestContext& ctx);
32 void GetDeviceNickName(Kernel::HLERequestContext& ctx); 32 void GetDeviceNickName(HLERequestContext& ctx);
33 33
34 ColorSet color_set = ColorSet::BasicWhite; 34 ColorSet color_set = ColorSet::BasicWhite;
35}; 35};
diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp
index 53c877836..a46f47d3e 100644
--- a/src/core/hle/service/sm/sm.cpp
+++ b/src/core/hle/service/sm/sm.cpp
@@ -5,13 +5,13 @@
5#include "common/assert.h" 5#include "common/assert.h"
6#include "common/scope_exit.h" 6#include "common/scope_exit.h"
7#include "core/core.h" 7#include "core/core.h"
8#include "core/hle/ipc_helpers.h"
9#include "core/hle/kernel/k_client_port.h" 8#include "core/hle/kernel/k_client_port.h"
10#include "core/hle/kernel/k_client_session.h" 9#include "core/hle/kernel/k_client_session.h"
11#include "core/hle/kernel/k_port.h" 10#include "core/hle/kernel/k_port.h"
12#include "core/hle/kernel/k_scoped_resource_reservation.h" 11#include "core/hle/kernel/k_scoped_resource_reservation.h"
13#include "core/hle/kernel/k_server_port.h" 12#include "core/hle/kernel/k_server_port.h"
14#include "core/hle/result.h" 13#include "core/hle/result.h"
14#include "core/hle/service/ipc_helpers.h"
15#include "core/hle/service/server_manager.h" 15#include "core/hle/service/server_manager.h"
16#include "core/hle/service/sm/sm.h" 16#include "core/hle/service/sm/sm.h"
17#include "core/hle/service/sm/sm_controller.h" 17#include "core/hle/service/sm/sm_controller.h"
@@ -38,7 +38,7 @@ ServiceManager::~ServiceManager() {
38 } 38 }
39} 39}
40 40
41void ServiceManager::InvokeControlRequest(Kernel::HLERequestContext& context) { 41void ServiceManager::InvokeControlRequest(HLERequestContext& context) {
42 controller_interface->InvokeRequest(context); 42 controller_interface->InvokeRequest(context);
43} 43}
44 44
@@ -51,7 +51,7 @@ static Result ValidateServiceName(const std::string& name) {
51} 51}
52 52
53Result ServiceManager::RegisterService(std::string name, u32 max_sessions, 53Result ServiceManager::RegisterService(std::string name, u32 max_sessions,
54 Kernel::SessionRequestHandlerPtr handler) { 54 SessionRequestHandlerPtr handler) {
55 55
56 CASCADE_CODE(ValidateServiceName(name)); 56 CASCADE_CODE(ValidateServiceName(name));
57 57
@@ -109,7 +109,7 @@ ResultVal<Kernel::KPort*> ServiceManager::GetServicePort(const std::string& name
109 * Outputs: 109 * Outputs:
110 * 0: Result 110 * 0: Result
111 */ 111 */
112void SM::Initialize(Kernel::HLERequestContext& ctx) { 112void SM::Initialize(HLERequestContext& ctx) {
113 LOG_DEBUG(Service_SM, "called"); 113 LOG_DEBUG(Service_SM, "called");
114 114
115 ctx.GetManager()->SetIsInitializedForSm(); 115 ctx.GetManager()->SetIsInitializedForSm();
@@ -118,7 +118,7 @@ void SM::Initialize(Kernel::HLERequestContext& ctx) {
118 rb.Push(ResultSuccess); 118 rb.Push(ResultSuccess);
119} 119}
120 120
121void SM::GetService(Kernel::HLERequestContext& ctx) { 121void SM::GetService(HLERequestContext& ctx) {
122 auto result = GetServiceImpl(ctx); 122 auto result = GetServiceImpl(ctx);
123 if (ctx.GetIsDeferred()) { 123 if (ctx.GetIsDeferred()) {
124 // Don't overwrite the command buffer. 124 // Don't overwrite the command buffer.
@@ -135,7 +135,7 @@ void SM::GetService(Kernel::HLERequestContext& ctx) {
135 } 135 }
136} 136}
137 137
138void SM::GetServiceTipc(Kernel::HLERequestContext& ctx) { 138void SM::GetServiceTipc(HLERequestContext& ctx) {
139 auto result = GetServiceImpl(ctx); 139 auto result = GetServiceImpl(ctx);
140 if (ctx.GetIsDeferred()) { 140 if (ctx.GetIsDeferred()) {
141 // Don't overwrite the command buffer. 141 // Don't overwrite the command buffer.
@@ -158,7 +158,7 @@ static std::string PopServiceName(IPC::RequestParser& rp) {
158 return result; 158 return result;
159} 159}
160 160
161ResultVal<Kernel::KClientSession*> SM::GetServiceImpl(Kernel::HLERequestContext& ctx) { 161ResultVal<Kernel::KClientSession*> SM::GetServiceImpl(HLERequestContext& ctx) {
162 if (!ctx.GetManager()->GetIsInitializedForSm()) { 162 if (!ctx.GetManager()->GetIsInitializedForSm()) {
163 return ERR_NOT_INITIALIZED; 163 return ERR_NOT_INITIALIZED;
164 } 164 }
@@ -192,7 +192,7 @@ ResultVal<Kernel::KClientSession*> SM::GetServiceImpl(Kernel::HLERequestContext&
192 return session; 192 return session;
193} 193}
194 194
195void SM::RegisterService(Kernel::HLERequestContext& ctx) { 195void SM::RegisterService(HLERequestContext& ctx) {
196 IPC::RequestParser rp{ctx}; 196 IPC::RequestParser rp{ctx};
197 std::string name(PopServiceName(rp)); 197 std::string name(PopServiceName(rp));
198 198
@@ -219,7 +219,7 @@ void SM::RegisterService(Kernel::HLERequestContext& ctx) {
219 rb.PushMoveObjects(port->GetServerPort()); 219 rb.PushMoveObjects(port->GetServerPort());
220} 220}
221 221
222void SM::UnregisterService(Kernel::HLERequestContext& ctx) { 222void SM::UnregisterService(HLERequestContext& ctx) {
223 IPC::RequestParser rp{ctx}; 223 IPC::RequestParser rp{ctx};
224 std::string name(PopServiceName(rp)); 224 std::string name(PopServiceName(rp));
225 225
diff --git a/src/core/hle/service/sm/sm.h b/src/core/hle/service/sm/sm.h
index b7eeafdd6..6697f4007 100644
--- a/src/core/hle/service/sm/sm.h
+++ b/src/core/hle/service/sm/sm.h
@@ -36,16 +36,15 @@ public:
36 ~SM() override; 36 ~SM() override;
37 37
38private: 38private:
39 void Initialize(Kernel::HLERequestContext& ctx); 39 void Initialize(HLERequestContext& ctx);
40 void GetService(Kernel::HLERequestContext& ctx); 40 void GetService(HLERequestContext& ctx);
41 void GetServiceTipc(Kernel::HLERequestContext& ctx); 41 void GetServiceTipc(HLERequestContext& ctx);
42 void RegisterService(Kernel::HLERequestContext& ctx); 42 void RegisterService(HLERequestContext& ctx);
43 void UnregisterService(Kernel::HLERequestContext& ctx); 43 void UnregisterService(HLERequestContext& ctx);
44 44
45 ResultVal<Kernel::KClientSession*> GetServiceImpl(Kernel::HLERequestContext& ctx); 45 ResultVal<Kernel::KClientSession*> GetServiceImpl(HLERequestContext& ctx);
46 46
47 ServiceManager& service_manager; 47 ServiceManager& service_manager;
48 bool is_initialized{};
49 Kernel::KernelCore& kernel; 48 Kernel::KernelCore& kernel;
50}; 49};
51 50
@@ -54,12 +53,11 @@ public:
54 explicit ServiceManager(Kernel::KernelCore& kernel_); 53 explicit ServiceManager(Kernel::KernelCore& kernel_);
55 ~ServiceManager(); 54 ~ServiceManager();
56 55
57 Result RegisterService(std::string name, u32 max_sessions, 56 Result RegisterService(std::string name, u32 max_sessions, SessionRequestHandlerPtr handler);
58 Kernel::SessionRequestHandlerPtr handler);
59 Result UnregisterService(const std::string& name); 57 Result UnregisterService(const std::string& name);
60 ResultVal<Kernel::KPort*> GetServicePort(const std::string& name); 58 ResultVal<Kernel::KPort*> GetServicePort(const std::string& name);
61 59
62 template <Common::DerivedFrom<Kernel::SessionRequestHandler> T> 60 template <Common::DerivedFrom<SessionRequestHandler> T>
63 std::shared_ptr<T> GetService(const std::string& service_name) const { 61 std::shared_ptr<T> GetService(const std::string& service_name) const {
64 auto service = registered_services.find(service_name); 62 auto service = registered_services.find(service_name);
65 if (service == registered_services.end()) { 63 if (service == registered_services.end()) {
@@ -69,7 +67,7 @@ public:
69 return std::static_pointer_cast<T>(service->second); 67 return std::static_pointer_cast<T>(service->second);
70 } 68 }
71 69
72 void InvokeControlRequest(Kernel::HLERequestContext& context); 70 void InvokeControlRequest(HLERequestContext& context);
73 71
74 void SetDeferralEvent(Kernel::KEvent* deferral_event_) { 72 void SetDeferralEvent(Kernel::KEvent* deferral_event_) {
75 deferral_event = deferral_event_; 73 deferral_event = deferral_event_;
@@ -81,7 +79,7 @@ private:
81 79
82 /// Map of registered services, retrieved using GetServicePort. 80 /// Map of registered services, retrieved using GetServicePort.
83 std::mutex lock; 81 std::mutex lock;
84 std::unordered_map<std::string, Kernel::SessionRequestHandlerPtr> registered_services; 82 std::unordered_map<std::string, SessionRequestHandlerPtr> registered_services;
85 std::unordered_map<std::string, Kernel::KPort*> service_ports; 83 std::unordered_map<std::string, Kernel::KPort*> service_ports;
86 84
87 /// Kernel context 85 /// Kernel context
diff --git a/src/core/hle/service/sm/sm_controller.cpp b/src/core/hle/service/sm/sm_controller.cpp
index f52522d1d..0111c8d7f 100644
--- a/src/core/hle/service/sm/sm_controller.cpp
+++ b/src/core/hle/service/sm/sm_controller.cpp
@@ -4,18 +4,18 @@
4#include "common/assert.h" 4#include "common/assert.h"
5#include "common/logging/log.h" 5#include "common/logging/log.h"
6#include "core/core.h" 6#include "core/core.h"
7#include "core/hle/ipc_helpers.h"
8#include "core/hle/kernel/k_client_port.h" 7#include "core/hle/kernel/k_client_port.h"
9#include "core/hle/kernel/k_port.h" 8#include "core/hle/kernel/k_port.h"
10#include "core/hle/kernel/k_scoped_resource_reservation.h" 9#include "core/hle/kernel/k_scoped_resource_reservation.h"
11#include "core/hle/kernel/k_server_session.h" 10#include "core/hle/kernel/k_server_session.h"
12#include "core/hle/kernel/k_session.h" 11#include "core/hle/kernel/k_session.h"
12#include "core/hle/service/ipc_helpers.h"
13#include "core/hle/service/server_manager.h" 13#include "core/hle/service/server_manager.h"
14#include "core/hle/service/sm/sm_controller.h" 14#include "core/hle/service/sm/sm_controller.h"
15 15
16namespace Service::SM { 16namespace Service::SM {
17 17
18void Controller::ConvertCurrentObjectToDomain(Kernel::HLERequestContext& ctx) { 18void Controller::ConvertCurrentObjectToDomain(HLERequestContext& ctx) {
19 ASSERT_MSG(!ctx.GetManager()->IsDomain(), "Session is already a domain"); 19 ASSERT_MSG(!ctx.GetManager()->IsDomain(), "Session is already a domain");
20 LOG_DEBUG(Service, "called, server_session={}", ctx.Session()->GetId()); 20 LOG_DEBUG(Service, "called, server_session={}", ctx.Session()->GetId());
21 ctx.GetManager()->ConvertToDomainOnRequestEnd(); 21 ctx.GetManager()->ConvertToDomainOnRequestEnd();
@@ -25,7 +25,7 @@ void Controller::ConvertCurrentObjectToDomain(Kernel::HLERequestContext& ctx) {
25 rb.Push<u32>(1); // Converted sessions start with 1 request handler 25 rb.Push<u32>(1); // Converted sessions start with 1 request handler
26} 26}
27 27
28void Controller::CloneCurrentObject(Kernel::HLERequestContext& ctx) { 28void Controller::CloneCurrentObject(HLERequestContext& ctx) {
29 LOG_DEBUG(Service, "called"); 29 LOG_DEBUG(Service, "called");
30 30
31 auto& process = *ctx.GetThread().GetOwnerProcess(); 31 auto& process = *ctx.GetThread().GetOwnerProcess();
@@ -59,13 +59,13 @@ void Controller::CloneCurrentObject(Kernel::HLERequestContext& ctx) {
59 rb.PushMoveObjects(session->GetClientSession()); 59 rb.PushMoveObjects(session->GetClientSession());
60} 60}
61 61
62void Controller::CloneCurrentObjectEx(Kernel::HLERequestContext& ctx) { 62void Controller::CloneCurrentObjectEx(HLERequestContext& ctx) {
63 LOG_DEBUG(Service, "called"); 63 LOG_DEBUG(Service, "called");
64 64
65 CloneCurrentObject(ctx); 65 CloneCurrentObject(ctx);
66} 66}
67 67
68void Controller::QueryPointerBufferSize(Kernel::HLERequestContext& ctx) { 68void Controller::QueryPointerBufferSize(HLERequestContext& ctx) {
69 LOG_WARNING(Service, "(STUBBED) called"); 69 LOG_WARNING(Service, "(STUBBED) called");
70 70
71 IPC::ResponseBuilder rb{ctx, 3}; 71 IPC::ResponseBuilder rb{ctx, 3};
diff --git a/src/core/hle/service/sm/sm_controller.h b/src/core/hle/service/sm/sm_controller.h
index ed386f660..4e748b36d 100644
--- a/src/core/hle/service/sm/sm_controller.h
+++ b/src/core/hle/service/sm/sm_controller.h
@@ -17,10 +17,10 @@ public:
17 ~Controller() override; 17 ~Controller() override;
18 18
19private: 19private:
20 void ConvertCurrentObjectToDomain(Kernel::HLERequestContext& ctx); 20 void ConvertCurrentObjectToDomain(HLERequestContext& ctx);
21 void CloneCurrentObject(Kernel::HLERequestContext& ctx); 21 void CloneCurrentObject(HLERequestContext& ctx);
22 void CloneCurrentObjectEx(Kernel::HLERequestContext& ctx); 22 void CloneCurrentObjectEx(HLERequestContext& ctx);
23 void QueryPointerBufferSize(Kernel::HLERequestContext& ctx); 23 void QueryPointerBufferSize(HLERequestContext& ctx);
24}; 24};
25 25
26} // namespace Service::SM 26} // namespace Service::SM
diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cpp
index 2789fa1ed..bce45d321 100644
--- a/src/core/hle/service/sockets/bsd.cpp
+++ b/src/core/hle/service/sockets/bsd.cpp
@@ -11,8 +11,8 @@
11#include "common/microprofile.h" 11#include "common/microprofile.h"
12#include "common/socket_types.h" 12#include "common/socket_types.h"
13#include "core/core.h" 13#include "core/core.h"
14#include "core/hle/ipc_helpers.h"
15#include "core/hle/kernel/k_thread.h" 14#include "core/hle/kernel/k_thread.h"
15#include "core/hle/service/ipc_helpers.h"
16#include "core/hle/service/sockets/bsd.h" 16#include "core/hle/service/sockets/bsd.h"
17#include "core/hle/service/sockets/sockets_translate.h" 17#include "core/hle/service/sockets/sockets_translate.h"
18#include "core/internal_network/network.h" 18#include "core/internal_network/network.h"
@@ -42,7 +42,7 @@ void BSD::PollWork::Execute(BSD* bsd) {
42 std::tie(ret, bsd_errno) = bsd->PollImpl(write_buffer, read_buffer, nfds, timeout); 42 std::tie(ret, bsd_errno) = bsd->PollImpl(write_buffer, read_buffer, nfds, timeout);
43} 43}
44 44
45void BSD::PollWork::Response(Kernel::HLERequestContext& ctx) { 45void BSD::PollWork::Response(HLERequestContext& ctx) {
46 if (write_buffer.size() > 0) { 46 if (write_buffer.size() > 0) {
47 ctx.WriteBuffer(write_buffer); 47 ctx.WriteBuffer(write_buffer);
48 } 48 }
@@ -57,7 +57,7 @@ void BSD::AcceptWork::Execute(BSD* bsd) {
57 std::tie(ret, bsd_errno) = bsd->AcceptImpl(fd, write_buffer); 57 std::tie(ret, bsd_errno) = bsd->AcceptImpl(fd, write_buffer);
58} 58}
59 59
60void BSD::AcceptWork::Response(Kernel::HLERequestContext& ctx) { 60void BSD::AcceptWork::Response(HLERequestContext& ctx) {
61 if (write_buffer.size() > 0) { 61 if (write_buffer.size() > 0) {
62 ctx.WriteBuffer(write_buffer); 62 ctx.WriteBuffer(write_buffer);
63 } 63 }
@@ -73,7 +73,7 @@ void BSD::ConnectWork::Execute(BSD* bsd) {
73 bsd_errno = bsd->ConnectImpl(fd, addr); 73 bsd_errno = bsd->ConnectImpl(fd, addr);
74} 74}
75 75
76void BSD::ConnectWork::Response(Kernel::HLERequestContext& ctx) { 76void BSD::ConnectWork::Response(HLERequestContext& ctx) {
77 IPC::ResponseBuilder rb{ctx, 4}; 77 IPC::ResponseBuilder rb{ctx, 4};
78 rb.Push(ResultSuccess); 78 rb.Push(ResultSuccess);
79 rb.Push<s32>(bsd_errno == Errno::SUCCESS ? 0 : -1); 79 rb.Push<s32>(bsd_errno == Errno::SUCCESS ? 0 : -1);
@@ -84,7 +84,7 @@ void BSD::RecvWork::Execute(BSD* bsd) {
84 std::tie(ret, bsd_errno) = bsd->RecvImpl(fd, flags, message); 84 std::tie(ret, bsd_errno) = bsd->RecvImpl(fd, flags, message);
85} 85}
86 86
87void BSD::RecvWork::Response(Kernel::HLERequestContext& ctx) { 87void BSD::RecvWork::Response(HLERequestContext& ctx) {
88 ctx.WriteBuffer(message); 88 ctx.WriteBuffer(message);
89 89
90 IPC::ResponseBuilder rb{ctx, 4}; 90 IPC::ResponseBuilder rb{ctx, 4};
@@ -97,7 +97,7 @@ void BSD::RecvFromWork::Execute(BSD* bsd) {
97 std::tie(ret, bsd_errno) = bsd->RecvFromImpl(fd, flags, message, addr); 97 std::tie(ret, bsd_errno) = bsd->RecvFromImpl(fd, flags, message, addr);
98} 98}
99 99
100void BSD::RecvFromWork::Response(Kernel::HLERequestContext& ctx) { 100void BSD::RecvFromWork::Response(HLERequestContext& ctx) {
101 ctx.WriteBuffer(message, 0); 101 ctx.WriteBuffer(message, 0);
102 if (!addr.empty()) { 102 if (!addr.empty()) {
103 ctx.WriteBuffer(addr, 1); 103 ctx.WriteBuffer(addr, 1);
@@ -114,7 +114,7 @@ void BSD::SendWork::Execute(BSD* bsd) {
114 std::tie(ret, bsd_errno) = bsd->SendImpl(fd, flags, message); 114 std::tie(ret, bsd_errno) = bsd->SendImpl(fd, flags, message);
115} 115}
116 116
117void BSD::SendWork::Response(Kernel::HLERequestContext& ctx) { 117void BSD::SendWork::Response(HLERequestContext& ctx) {
118 IPC::ResponseBuilder rb{ctx, 4}; 118 IPC::ResponseBuilder rb{ctx, 4};
119 rb.Push(ResultSuccess); 119 rb.Push(ResultSuccess);
120 rb.Push<s32>(ret); 120 rb.Push<s32>(ret);
@@ -125,14 +125,14 @@ void BSD::SendToWork::Execute(BSD* bsd) {
125 std::tie(ret, bsd_errno) = bsd->SendToImpl(fd, flags, message, addr); 125 std::tie(ret, bsd_errno) = bsd->SendToImpl(fd, flags, message, addr);
126} 126}
127 127
128void BSD::SendToWork::Response(Kernel::HLERequestContext& ctx) { 128void BSD::SendToWork::Response(HLERequestContext& ctx) {
129 IPC::ResponseBuilder rb{ctx, 4}; 129 IPC::ResponseBuilder rb{ctx, 4};
130 rb.Push(ResultSuccess); 130 rb.Push(ResultSuccess);
131 rb.Push<s32>(ret); 131 rb.Push<s32>(ret);
132 rb.PushEnum(bsd_errno); 132 rb.PushEnum(bsd_errno);
133} 133}
134 134
135void BSD::RegisterClient(Kernel::HLERequestContext& ctx) { 135void BSD::RegisterClient(HLERequestContext& ctx) {
136 LOG_WARNING(Service, "(STUBBED) called"); 136 LOG_WARNING(Service, "(STUBBED) called");
137 137
138 IPC::ResponseBuilder rb{ctx, 3}; 138 IPC::ResponseBuilder rb{ctx, 3};
@@ -141,7 +141,7 @@ void BSD::RegisterClient(Kernel::HLERequestContext& ctx) {
141 rb.Push<s32>(0); // bsd errno 141 rb.Push<s32>(0); // bsd errno
142} 142}
143 143
144void BSD::StartMonitoring(Kernel::HLERequestContext& ctx) { 144void BSD::StartMonitoring(HLERequestContext& ctx) {
145 LOG_WARNING(Service, "(STUBBED) called"); 145 LOG_WARNING(Service, "(STUBBED) called");
146 146
147 IPC::ResponseBuilder rb{ctx, 2}; 147 IPC::ResponseBuilder rb{ctx, 2};
@@ -149,7 +149,7 @@ void BSD::StartMonitoring(Kernel::HLERequestContext& ctx) {
149 rb.Push(ResultSuccess); 149 rb.Push(ResultSuccess);
150} 150}
151 151
152void BSD::Socket(Kernel::HLERequestContext& ctx) { 152void BSD::Socket(HLERequestContext& ctx) {
153 IPC::RequestParser rp{ctx}; 153 IPC::RequestParser rp{ctx};
154 const u32 domain = rp.Pop<u32>(); 154 const u32 domain = rp.Pop<u32>();
155 const u32 type = rp.Pop<u32>(); 155 const u32 type = rp.Pop<u32>();
@@ -166,7 +166,7 @@ void BSD::Socket(Kernel::HLERequestContext& ctx) {
166 rb.PushEnum(bsd_errno); 166 rb.PushEnum(bsd_errno);
167} 167}
168 168
169void BSD::Select(Kernel::HLERequestContext& ctx) { 169void BSD::Select(HLERequestContext& ctx) {
170 LOG_WARNING(Service, "(STUBBED) called"); 170 LOG_WARNING(Service, "(STUBBED) called");
171 171
172 IPC::ResponseBuilder rb{ctx, 4}; 172 IPC::ResponseBuilder rb{ctx, 4};
@@ -176,7 +176,7 @@ void BSD::Select(Kernel::HLERequestContext& ctx) {
176 rb.Push<u32>(0); // bsd errno 176 rb.Push<u32>(0); // bsd errno
177} 177}
178 178
179void BSD::Poll(Kernel::HLERequestContext& ctx) { 179void BSD::Poll(HLERequestContext& ctx) {
180 IPC::RequestParser rp{ctx}; 180 IPC::RequestParser rp{ctx};
181 const s32 nfds = rp.Pop<s32>(); 181 const s32 nfds = rp.Pop<s32>();
182 const s32 timeout = rp.Pop<s32>(); 182 const s32 timeout = rp.Pop<s32>();
@@ -191,7 +191,7 @@ void BSD::Poll(Kernel::HLERequestContext& ctx) {
191 }); 191 });
192} 192}
193 193
194void BSD::Accept(Kernel::HLERequestContext& ctx) { 194void BSD::Accept(HLERequestContext& ctx) {
195 IPC::RequestParser rp{ctx}; 195 IPC::RequestParser rp{ctx};
196 const s32 fd = rp.Pop<s32>(); 196 const s32 fd = rp.Pop<s32>();
197 197
@@ -203,7 +203,7 @@ void BSD::Accept(Kernel::HLERequestContext& ctx) {
203 }); 203 });
204} 204}
205 205
206void BSD::Bind(Kernel::HLERequestContext& ctx) { 206void BSD::Bind(HLERequestContext& ctx) {
207 IPC::RequestParser rp{ctx}; 207 IPC::RequestParser rp{ctx};
208 const s32 fd = rp.Pop<s32>(); 208 const s32 fd = rp.Pop<s32>();
209 209
@@ -211,7 +211,7 @@ void BSD::Bind(Kernel::HLERequestContext& ctx) {
211 BuildErrnoResponse(ctx, BindImpl(fd, ctx.ReadBuffer())); 211 BuildErrnoResponse(ctx, BindImpl(fd, ctx.ReadBuffer()));
212} 212}
213 213
214void BSD::Connect(Kernel::HLERequestContext& ctx) { 214void BSD::Connect(HLERequestContext& ctx) {
215 IPC::RequestParser rp{ctx}; 215 IPC::RequestParser rp{ctx};
216 const s32 fd = rp.Pop<s32>(); 216 const s32 fd = rp.Pop<s32>();
217 217
@@ -223,7 +223,7 @@ void BSD::Connect(Kernel::HLERequestContext& ctx) {
223 }); 223 });
224} 224}
225 225
226void BSD::GetPeerName(Kernel::HLERequestContext& ctx) { 226void BSD::GetPeerName(HLERequestContext& ctx) {
227 IPC::RequestParser rp{ctx}; 227 IPC::RequestParser rp{ctx};
228 const s32 fd = rp.Pop<s32>(); 228 const s32 fd = rp.Pop<s32>();
229 229
@@ -241,7 +241,7 @@ void BSD::GetPeerName(Kernel::HLERequestContext& ctx) {
241 rb.Push<u32>(static_cast<u32>(write_buffer.size())); 241 rb.Push<u32>(static_cast<u32>(write_buffer.size()));
242} 242}
243 243
244void BSD::GetSockName(Kernel::HLERequestContext& ctx) { 244void BSD::GetSockName(HLERequestContext& ctx) {
245 IPC::RequestParser rp{ctx}; 245 IPC::RequestParser rp{ctx};
246 const s32 fd = rp.Pop<s32>(); 246 const s32 fd = rp.Pop<s32>();
247 247
@@ -259,7 +259,7 @@ void BSD::GetSockName(Kernel::HLERequestContext& ctx) {
259 rb.Push<u32>(static_cast<u32>(write_buffer.size())); 259 rb.Push<u32>(static_cast<u32>(write_buffer.size()));
260} 260}
261 261
262void BSD::GetSockOpt(Kernel::HLERequestContext& ctx) { 262void BSD::GetSockOpt(HLERequestContext& ctx) {
263 IPC::RequestParser rp{ctx}; 263 IPC::RequestParser rp{ctx};
264 const s32 fd = rp.Pop<s32>(); 264 const s32 fd = rp.Pop<s32>();
265 const u32 level = rp.Pop<u32>(); 265 const u32 level = rp.Pop<u32>();
@@ -278,7 +278,7 @@ void BSD::GetSockOpt(Kernel::HLERequestContext& ctx) {
278 rb.Push<u32>(static_cast<u32>(optval.size())); 278 rb.Push<u32>(static_cast<u32>(optval.size()));
279} 279}
280 280
281void BSD::Listen(Kernel::HLERequestContext& ctx) { 281void BSD::Listen(HLERequestContext& ctx) {
282 IPC::RequestParser rp{ctx}; 282 IPC::RequestParser rp{ctx};
283 const s32 fd = rp.Pop<s32>(); 283 const s32 fd = rp.Pop<s32>();
284 const s32 backlog = rp.Pop<s32>(); 284 const s32 backlog = rp.Pop<s32>();
@@ -288,7 +288,7 @@ void BSD::Listen(Kernel::HLERequestContext& ctx) {
288 BuildErrnoResponse(ctx, ListenImpl(fd, backlog)); 288 BuildErrnoResponse(ctx, ListenImpl(fd, backlog));
289} 289}
290 290
291void BSD::Fcntl(Kernel::HLERequestContext& ctx) { 291void BSD::Fcntl(HLERequestContext& ctx) {
292 IPC::RequestParser rp{ctx}; 292 IPC::RequestParser rp{ctx};
293 const s32 fd = rp.Pop<s32>(); 293 const s32 fd = rp.Pop<s32>();
294 const s32 cmd = rp.Pop<s32>(); 294 const s32 cmd = rp.Pop<s32>();
@@ -304,7 +304,7 @@ void BSD::Fcntl(Kernel::HLERequestContext& ctx) {
304 rb.PushEnum(bsd_errno); 304 rb.PushEnum(bsd_errno);
305} 305}
306 306
307void BSD::SetSockOpt(Kernel::HLERequestContext& ctx) { 307void BSD::SetSockOpt(HLERequestContext& ctx) {
308 IPC::RequestParser rp{ctx}; 308 IPC::RequestParser rp{ctx};
309 309
310 const s32 fd = rp.Pop<s32>(); 310 const s32 fd = rp.Pop<s32>();
@@ -328,7 +328,7 @@ void BSD::SetSockOpt(Kernel::HLERequestContext& ctx) {
328 BuildErrnoResponse(ctx, SetSockOptImpl(fd, level, optname, optlen, optval)); 328 BuildErrnoResponse(ctx, SetSockOptImpl(fd, level, optname, optlen, optval));
329} 329}
330 330
331void BSD::Shutdown(Kernel::HLERequestContext& ctx) { 331void BSD::Shutdown(HLERequestContext& ctx) {
332 IPC::RequestParser rp{ctx}; 332 IPC::RequestParser rp{ctx};
333 333
334 const s32 fd = rp.Pop<s32>(); 334 const s32 fd = rp.Pop<s32>();
@@ -339,7 +339,7 @@ void BSD::Shutdown(Kernel::HLERequestContext& ctx) {
339 BuildErrnoResponse(ctx, ShutdownImpl(fd, how)); 339 BuildErrnoResponse(ctx, ShutdownImpl(fd, how));
340} 340}
341 341
342void BSD::Recv(Kernel::HLERequestContext& ctx) { 342void BSD::Recv(HLERequestContext& ctx) {
343 IPC::RequestParser rp{ctx}; 343 IPC::RequestParser rp{ctx};
344 344
345 const s32 fd = rp.Pop<s32>(); 345 const s32 fd = rp.Pop<s32>();
@@ -354,7 +354,7 @@ void BSD::Recv(Kernel::HLERequestContext& ctx) {
354 }); 354 });
355} 355}
356 356
357void BSD::RecvFrom(Kernel::HLERequestContext& ctx) { 357void BSD::RecvFrom(HLERequestContext& ctx) {
358 IPC::RequestParser rp{ctx}; 358 IPC::RequestParser rp{ctx};
359 359
360 const s32 fd = rp.Pop<s32>(); 360 const s32 fd = rp.Pop<s32>();
@@ -371,7 +371,7 @@ void BSD::RecvFrom(Kernel::HLERequestContext& ctx) {
371 }); 371 });
372} 372}
373 373
374void BSD::Send(Kernel::HLERequestContext& ctx) { 374void BSD::Send(HLERequestContext& ctx) {
375 IPC::RequestParser rp{ctx}; 375 IPC::RequestParser rp{ctx};
376 376
377 const s32 fd = rp.Pop<s32>(); 377 const s32 fd = rp.Pop<s32>();
@@ -386,7 +386,7 @@ void BSD::Send(Kernel::HLERequestContext& ctx) {
386 }); 386 });
387} 387}
388 388
389void BSD::SendTo(Kernel::HLERequestContext& ctx) { 389void BSD::SendTo(HLERequestContext& ctx) {
390 IPC::RequestParser rp{ctx}; 390 IPC::RequestParser rp{ctx};
391 const s32 fd = rp.Pop<s32>(); 391 const s32 fd = rp.Pop<s32>();
392 const u32 flags = rp.Pop<u32>(); 392 const u32 flags = rp.Pop<u32>();
@@ -402,7 +402,7 @@ void BSD::SendTo(Kernel::HLERequestContext& ctx) {
402 }); 402 });
403} 403}
404 404
405void BSD::Write(Kernel::HLERequestContext& ctx) { 405void BSD::Write(HLERequestContext& ctx) {
406 IPC::RequestParser rp{ctx}; 406 IPC::RequestParser rp{ctx};
407 const s32 fd = rp.Pop<s32>(); 407 const s32 fd = rp.Pop<s32>();
408 408
@@ -415,7 +415,7 @@ void BSD::Write(Kernel::HLERequestContext& ctx) {
415 }); 415 });
416} 416}
417 417
418void BSD::Read(Kernel::HLERequestContext& ctx) { 418void BSD::Read(HLERequestContext& ctx) {
419 IPC::RequestParser rp{ctx}; 419 IPC::RequestParser rp{ctx};
420 const s32 fd = rp.Pop<s32>(); 420 const s32 fd = rp.Pop<s32>();
421 421
@@ -427,7 +427,7 @@ void BSD::Read(Kernel::HLERequestContext& ctx) {
427 rb.Push<u32>(0); // bsd errno 427 rb.Push<u32>(0); // bsd errno
428} 428}
429 429
430void BSD::Close(Kernel::HLERequestContext& ctx) { 430void BSD::Close(HLERequestContext& ctx) {
431 IPC::RequestParser rp{ctx}; 431 IPC::RequestParser rp{ctx};
432 const s32 fd = rp.Pop<s32>(); 432 const s32 fd = rp.Pop<s32>();
433 433
@@ -436,7 +436,7 @@ void BSD::Close(Kernel::HLERequestContext& ctx) {
436 BuildErrnoResponse(ctx, CloseImpl(fd)); 436 BuildErrnoResponse(ctx, CloseImpl(fd));
437} 437}
438 438
439void BSD::EventFd(Kernel::HLERequestContext& ctx) { 439void BSD::EventFd(HLERequestContext& ctx) {
440 IPC::RequestParser rp{ctx}; 440 IPC::RequestParser rp{ctx};
441 const u64 initval = rp.Pop<u64>(); 441 const u64 initval = rp.Pop<u64>();
442 const u32 flags = rp.Pop<u32>(); 442 const u32 flags = rp.Pop<u32>();
@@ -447,7 +447,7 @@ void BSD::EventFd(Kernel::HLERequestContext& ctx) {
447} 447}
448 448
449template <typename Work> 449template <typename Work>
450void BSD::ExecuteWork(Kernel::HLERequestContext& ctx, Work work) { 450void BSD::ExecuteWork(HLERequestContext& ctx, Work work) {
451 work.Execute(this); 451 work.Execute(this);
452 work.Response(ctx); 452 work.Response(ctx);
453} 453}
@@ -862,7 +862,7 @@ bool BSD::IsFileDescriptorValid(s32 fd) const noexcept {
862 return true; 862 return true;
863} 863}
864 864
865void BSD::BuildErrnoResponse(Kernel::HLERequestContext& ctx, Errno bsd_errno) const noexcept { 865void BSD::BuildErrnoResponse(HLERequestContext& ctx, Errno bsd_errno) const noexcept {
866 IPC::ResponseBuilder rb{ctx, 4}; 866 IPC::ResponseBuilder rb{ctx, 4};
867 867
868 rb.Push(ResultSuccess); 868 rb.Push(ResultSuccess);
diff --git a/src/core/hle/service/sockets/bsd.h b/src/core/hle/service/sockets/bsd.h
index 56bb3f8b1..30ae9c140 100644
--- a/src/core/hle/service/sockets/bsd.h
+++ b/src/core/hle/service/sockets/bsd.h
@@ -41,7 +41,7 @@ private:
41 41
42 struct PollWork { 42 struct PollWork {
43 void Execute(BSD* bsd); 43 void Execute(BSD* bsd);
44 void Response(Kernel::HLERequestContext& ctx); 44 void Response(HLERequestContext& ctx);
45 45
46 s32 nfds; 46 s32 nfds;
47 s32 timeout; 47 s32 timeout;
@@ -53,7 +53,7 @@ private:
53 53
54 struct AcceptWork { 54 struct AcceptWork {
55 void Execute(BSD* bsd); 55 void Execute(BSD* bsd);
56 void Response(Kernel::HLERequestContext& ctx); 56 void Response(HLERequestContext& ctx);
57 57
58 s32 fd; 58 s32 fd;
59 std::vector<u8> write_buffer; 59 std::vector<u8> write_buffer;
@@ -63,7 +63,7 @@ private:
63 63
64 struct ConnectWork { 64 struct ConnectWork {
65 void Execute(BSD* bsd); 65 void Execute(BSD* bsd);
66 void Response(Kernel::HLERequestContext& ctx); 66 void Response(HLERequestContext& ctx);
67 67
68 s32 fd; 68 s32 fd;
69 std::span<const u8> addr; 69 std::span<const u8> addr;
@@ -72,7 +72,7 @@ private:
72 72
73 struct RecvWork { 73 struct RecvWork {
74 void Execute(BSD* bsd); 74 void Execute(BSD* bsd);
75 void Response(Kernel::HLERequestContext& ctx); 75 void Response(HLERequestContext& ctx);
76 76
77 s32 fd; 77 s32 fd;
78 u32 flags; 78 u32 flags;
@@ -83,7 +83,7 @@ private:
83 83
84 struct RecvFromWork { 84 struct RecvFromWork {
85 void Execute(BSD* bsd); 85 void Execute(BSD* bsd);
86 void Response(Kernel::HLERequestContext& ctx); 86 void Response(HLERequestContext& ctx);
87 87
88 s32 fd; 88 s32 fd;
89 u32 flags; 89 u32 flags;
@@ -95,7 +95,7 @@ private:
95 95
96 struct SendWork { 96 struct SendWork {
97 void Execute(BSD* bsd); 97 void Execute(BSD* bsd);
98 void Response(Kernel::HLERequestContext& ctx); 98 void Response(HLERequestContext& ctx);
99 99
100 s32 fd; 100 s32 fd;
101 u32 flags; 101 u32 flags;
@@ -106,7 +106,7 @@ private:
106 106
107 struct SendToWork { 107 struct SendToWork {
108 void Execute(BSD* bsd); 108 void Execute(BSD* bsd);
109 void Response(Kernel::HLERequestContext& ctx); 109 void Response(HLERequestContext& ctx);
110 110
111 s32 fd; 111 s32 fd;
112 u32 flags; 112 u32 flags;
@@ -116,32 +116,32 @@ private:
116 Errno bsd_errno{}; 116 Errno bsd_errno{};
117 }; 117 };
118 118
119 void RegisterClient(Kernel::HLERequestContext& ctx); 119 void RegisterClient(HLERequestContext& ctx);
120 void StartMonitoring(Kernel::HLERequestContext& ctx); 120 void StartMonitoring(HLERequestContext& ctx);
121 void Socket(Kernel::HLERequestContext& ctx); 121 void Socket(HLERequestContext& ctx);
122 void Select(Kernel::HLERequestContext& ctx); 122 void Select(HLERequestContext& ctx);
123 void Poll(Kernel::HLERequestContext& ctx); 123 void Poll(HLERequestContext& ctx);
124 void Accept(Kernel::HLERequestContext& ctx); 124 void Accept(HLERequestContext& ctx);
125 void Bind(Kernel::HLERequestContext& ctx); 125 void Bind(HLERequestContext& ctx);
126 void Connect(Kernel::HLERequestContext& ctx); 126 void Connect(HLERequestContext& ctx);
127 void GetPeerName(Kernel::HLERequestContext& ctx); 127 void GetPeerName(HLERequestContext& ctx);
128 void GetSockName(Kernel::HLERequestContext& ctx); 128 void GetSockName(HLERequestContext& ctx);
129 void GetSockOpt(Kernel::HLERequestContext& ctx); 129 void GetSockOpt(HLERequestContext& ctx);
130 void Listen(Kernel::HLERequestContext& ctx); 130 void Listen(HLERequestContext& ctx);
131 void Fcntl(Kernel::HLERequestContext& ctx); 131 void Fcntl(HLERequestContext& ctx);
132 void SetSockOpt(Kernel::HLERequestContext& ctx); 132 void SetSockOpt(HLERequestContext& ctx);
133 void Shutdown(Kernel::HLERequestContext& ctx); 133 void Shutdown(HLERequestContext& ctx);
134 void Recv(Kernel::HLERequestContext& ctx); 134 void Recv(HLERequestContext& ctx);
135 void RecvFrom(Kernel::HLERequestContext& ctx); 135 void RecvFrom(HLERequestContext& ctx);
136 void Send(Kernel::HLERequestContext& ctx); 136 void Send(HLERequestContext& ctx);
137 void SendTo(Kernel::HLERequestContext& ctx); 137 void SendTo(HLERequestContext& ctx);
138 void Write(Kernel::HLERequestContext& ctx); 138 void Write(HLERequestContext& ctx);
139 void Read(Kernel::HLERequestContext& ctx); 139 void Read(HLERequestContext& ctx);
140 void Close(Kernel::HLERequestContext& ctx); 140 void Close(HLERequestContext& ctx);
141 void EventFd(Kernel::HLERequestContext& ctx); 141 void EventFd(HLERequestContext& ctx);
142 142
143 template <typename Work> 143 template <typename Work>
144 void ExecuteWork(Kernel::HLERequestContext& ctx, Work work); 144 void ExecuteWork(HLERequestContext& ctx, Work work);
145 145
146 std::pair<s32, Errno> SocketImpl(Domain domain, Type type, Protocol protocol); 146 std::pair<s32, Errno> SocketImpl(Domain domain, Type type, Protocol protocol);
147 std::pair<s32, Errno> PollImpl(std::vector<u8>& write_buffer, std::span<const u8> read_buffer, 147 std::pair<s32, Errno> PollImpl(std::vector<u8>& write_buffer, std::span<const u8> read_buffer,
@@ -166,7 +166,7 @@ private:
166 s32 FindFreeFileDescriptorHandle() noexcept; 166 s32 FindFreeFileDescriptorHandle() noexcept;
167 bool IsFileDescriptorValid(s32 fd) const noexcept; 167 bool IsFileDescriptorValid(s32 fd) const noexcept;
168 168
169 void BuildErrnoResponse(Kernel::HLERequestContext& ctx, Errno bsd_errno) const noexcept; 169 void BuildErrnoResponse(HLERequestContext& ctx, Errno bsd_errno) const noexcept;
170 170
171 std::array<std::optional<FileDescriptor>, MAX_FD> file_descriptors; 171 std::array<std::optional<FileDescriptor>, MAX_FD> file_descriptors;
172 172
diff --git a/src/core/hle/service/sockets/sfdnsres.cpp b/src/core/hle/service/sockets/sfdnsres.cpp
index e96eda7f3..132dd5797 100644
--- a/src/core/hle/service/sockets/sfdnsres.cpp
+++ b/src/core/hle/service/sockets/sfdnsres.cpp
@@ -8,7 +8,7 @@
8#include "common/string_util.h" 8#include "common/string_util.h"
9#include "common/swap.h" 9#include "common/swap.h"
10#include "core/core.h" 10#include "core/core.h"
11#include "core/hle/ipc_helpers.h" 11#include "core/hle/service/ipc_helpers.h"
12#include "core/hle/service/sockets/sfdnsres.h" 12#include "core/hle/service/sockets/sfdnsres.h"
13#include "core/memory.h" 13#include "core/memory.h"
14 14
@@ -185,7 +185,7 @@ static std::vector<u8> SerializeAddrInfo(const addrinfo* addrinfo, s32 result_co
185 return data; 185 return data;
186} 186}
187 187
188static std::pair<u32, s32> GetAddrInfoRequestImpl(Kernel::HLERequestContext& ctx) { 188static std::pair<u32, s32> GetAddrInfoRequestImpl(HLERequestContext& ctx) {
189 struct Parameters { 189 struct Parameters {
190 u8 use_nsd_resolve; 190 u8 use_nsd_resolve;
191 u32 unknown; 191 u32 unknown;
@@ -221,7 +221,7 @@ static std::pair<u32, s32> GetAddrInfoRequestImpl(Kernel::HLERequestContext& ctx
221 return std::make_pair(data_size, result_code); 221 return std::make_pair(data_size, result_code);
222} 222}
223 223
224void SFDNSRES::GetAddrInfoRequest(Kernel::HLERequestContext& ctx) { 224void SFDNSRES::GetAddrInfoRequest(HLERequestContext& ctx) {
225 auto [data_size, result_code] = GetAddrInfoRequestImpl(ctx); 225 auto [data_size, result_code] = GetAddrInfoRequestImpl(ctx);
226 226
227 IPC::ResponseBuilder rb{ctx, 4}; 227 IPC::ResponseBuilder rb{ctx, 4};
@@ -231,7 +231,7 @@ void SFDNSRES::GetAddrInfoRequest(Kernel::HLERequestContext& ctx) {
231 rb.Push(data_size); // serialized size 231 rb.Push(data_size); // serialized size
232} 232}
233 233
234void SFDNSRES::GetAddrInfoRequestWithOptions(Kernel::HLERequestContext& ctx) { 234void SFDNSRES::GetAddrInfoRequestWithOptions(HLERequestContext& ctx) {
235 // Additional options are ignored 235 // Additional options are ignored
236 auto [data_size, result_code] = GetAddrInfoRequestImpl(ctx); 236 auto [data_size, result_code] = GetAddrInfoRequestImpl(ctx);
237 237
diff --git a/src/core/hle/service/sockets/sfdnsres.h b/src/core/hle/service/sockets/sfdnsres.h
index 96018ea77..18e3cd60c 100644
--- a/src/core/hle/service/sockets/sfdnsres.h
+++ b/src/core/hle/service/sockets/sfdnsres.h
@@ -17,8 +17,8 @@ public:
17 ~SFDNSRES() override; 17 ~SFDNSRES() override;
18 18
19private: 19private:
20 void GetAddrInfoRequest(Kernel::HLERequestContext& ctx); 20 void GetAddrInfoRequest(HLERequestContext& ctx);
21 void GetAddrInfoRequestWithOptions(Kernel::HLERequestContext& ctx); 21 void GetAddrInfoRequestWithOptions(HLERequestContext& ctx);
22}; 22};
23 23
24} // namespace Service::Sockets 24} // namespace Service::Sockets
diff --git a/src/core/hle/service/spl/spl_module.cpp b/src/core/hle/service/spl/spl_module.cpp
index 31679e1bb..0227d4393 100644
--- a/src/core/hle/service/spl/spl_module.cpp
+++ b/src/core/hle/service/spl/spl_module.cpp
@@ -8,7 +8,7 @@
8#include "common/logging/log.h" 8#include "common/logging/log.h"
9#include "common/settings.h" 9#include "common/settings.h"
10#include "core/hle/api_version.h" 10#include "core/hle/api_version.h"
11#include "core/hle/ipc_helpers.h" 11#include "core/hle/service/ipc_helpers.h"
12#include "core/hle/service/server_manager.h" 12#include "core/hle/service/server_manager.h"
13#include "core/hle/service/spl/csrng.h" 13#include "core/hle/service/spl/csrng.h"
14#include "core/hle/service/spl/spl.h" 14#include "core/hle/service/spl/spl.h"
@@ -23,7 +23,7 @@ Module::Interface::Interface(Core::System& system_, std::shared_ptr<Module> modu
23 23
24Module::Interface::~Interface() = default; 24Module::Interface::~Interface() = default;
25 25
26void Module::Interface::GetConfig(Kernel::HLERequestContext& ctx) { 26void Module::Interface::GetConfig(HLERequestContext& ctx) {
27 IPC::RequestParser rp{ctx}; 27 IPC::RequestParser rp{ctx};
28 const auto config_item = rp.PopEnum<ConfigItem>(); 28 const auto config_item = rp.PopEnum<ConfigItem>();
29 29
@@ -48,21 +48,21 @@ void Module::Interface::GetConfig(Kernel::HLERequestContext& ctx) {
48 rb.Push(*smc_result); 48 rb.Push(*smc_result);
49} 49}
50 50
51void Module::Interface::ModularExponentiate(Kernel::HLERequestContext& ctx) { 51void Module::Interface::ModularExponentiate(HLERequestContext& ctx) {
52 UNIMPLEMENTED_MSG("ModularExponentiate is not implemented!"); 52 UNIMPLEMENTED_MSG("ModularExponentiate is not implemented!");
53 53
54 IPC::ResponseBuilder rb{ctx, 2}; 54 IPC::ResponseBuilder rb{ctx, 2};
55 rb.Push(ResultSecureMonitorNotImplemented); 55 rb.Push(ResultSecureMonitorNotImplemented);
56} 56}
57 57
58void Module::Interface::SetConfig(Kernel::HLERequestContext& ctx) { 58void Module::Interface::SetConfig(HLERequestContext& ctx) {
59 UNIMPLEMENTED_MSG("SetConfig is not implemented!"); 59 UNIMPLEMENTED_MSG("SetConfig is not implemented!");
60 60
61 IPC::ResponseBuilder rb{ctx, 2}; 61 IPC::ResponseBuilder rb{ctx, 2};
62 rb.Push(ResultSecureMonitorNotImplemented); 62 rb.Push(ResultSecureMonitorNotImplemented);
63} 63}
64 64
65void Module::Interface::GenerateRandomBytes(Kernel::HLERequestContext& ctx) { 65void Module::Interface::GenerateRandomBytes(HLERequestContext& ctx) {
66 LOG_DEBUG(Service_SPL, "called"); 66 LOG_DEBUG(Service_SPL, "called");
67 67
68 const std::size_t size = ctx.GetWriteBufferSize(); 68 const std::size_t size = ctx.GetWriteBufferSize();
@@ -77,21 +77,21 @@ void Module::Interface::GenerateRandomBytes(Kernel::HLERequestContext& ctx) {
77 rb.Push(ResultSuccess); 77 rb.Push(ResultSuccess);
78} 78}
79 79
80void Module::Interface::IsDevelopment(Kernel::HLERequestContext& ctx) { 80void Module::Interface::IsDevelopment(HLERequestContext& ctx) {
81 UNIMPLEMENTED_MSG("IsDevelopment is not implemented!"); 81 UNIMPLEMENTED_MSG("IsDevelopment is not implemented!");
82 82
83 IPC::ResponseBuilder rb{ctx, 2}; 83 IPC::ResponseBuilder rb{ctx, 2};
84 rb.Push(ResultSecureMonitorNotImplemented); 84 rb.Push(ResultSecureMonitorNotImplemented);
85} 85}
86 86
87void Module::Interface::SetBootReason(Kernel::HLERequestContext& ctx) { 87void Module::Interface::SetBootReason(HLERequestContext& ctx) {
88 UNIMPLEMENTED_MSG("SetBootReason is not implemented!"); 88 UNIMPLEMENTED_MSG("SetBootReason is not implemented!");
89 89
90 IPC::ResponseBuilder rb{ctx, 2}; 90 IPC::ResponseBuilder rb{ctx, 2};
91 rb.Push(ResultSecureMonitorNotImplemented); 91 rb.Push(ResultSecureMonitorNotImplemented);
92} 92}
93 93
94void Module::Interface::GetBootReason(Kernel::HLERequestContext& ctx) { 94void Module::Interface::GetBootReason(HLERequestContext& ctx) {
95 UNIMPLEMENTED_MSG("GetBootReason is not implemented!"); 95 UNIMPLEMENTED_MSG("GetBootReason is not implemented!");
96 96
97 IPC::ResponseBuilder rb{ctx, 2}; 97 IPC::ResponseBuilder rb{ctx, 2};
diff --git a/src/core/hle/service/spl/spl_module.h b/src/core/hle/service/spl/spl_module.h
index baed9efd7..e074e115d 100644
--- a/src/core/hle/service/spl/spl_module.h
+++ b/src/core/hle/service/spl/spl_module.h
@@ -23,13 +23,13 @@ public:
23 ~Interface() override; 23 ~Interface() override;
24 24
25 // General 25 // General
26 void GetConfig(Kernel::HLERequestContext& ctx); 26 void GetConfig(HLERequestContext& ctx);
27 void ModularExponentiate(Kernel::HLERequestContext& ctx); 27 void ModularExponentiate(HLERequestContext& ctx);
28 void SetConfig(Kernel::HLERequestContext& ctx); 28 void SetConfig(HLERequestContext& ctx);
29 void GenerateRandomBytes(Kernel::HLERequestContext& ctx); 29 void GenerateRandomBytes(HLERequestContext& ctx);
30 void IsDevelopment(Kernel::HLERequestContext& ctx); 30 void IsDevelopment(HLERequestContext& ctx);
31 void SetBootReason(Kernel::HLERequestContext& ctx); 31 void SetBootReason(HLERequestContext& ctx);
32 void GetBootReason(Kernel::HLERequestContext& ctx); 32 void GetBootReason(HLERequestContext& ctx);
33 33
34 protected: 34 protected:
35 std::shared_ptr<Module> module; 35 std::shared_ptr<Module> module;
diff --git a/src/core/hle/service/ssl/ssl.cpp b/src/core/hle/service/ssl/ssl.cpp
index c1fd1a59b..2b99dd7ac 100644
--- a/src/core/hle/service/ssl/ssl.cpp
+++ b/src/core/hle/service/ssl/ssl.cpp
@@ -1,21 +1,43 @@
1// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project 1// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "core/hle/ipc_helpers.h" 4#include "core/hle/service/ipc_helpers.h"
5#include "core/hle/service/server_manager.h" 5#include "core/hle/service/server_manager.h"
6#include "core/hle/service/service.h" 6#include "core/hle/service/service.h"
7#include "core/hle/service/ssl/ssl.h" 7#include "core/hle/service/ssl/ssl.h"
8 8
9namespace Service::SSL { 9namespace Service::SSL {
10 10
11// This is nn::ssl::sf::CertificateFormat
11enum class CertificateFormat : u32 { 12enum class CertificateFormat : u32 {
12 Pem = 1, 13 Pem = 1,
13 Der = 2, 14 Der = 2,
14}; 15};
15 16
17// This is nn::ssl::sf::ContextOption
18enum class ContextOption : u32 {
19 None = 0,
20 CrlImportDateCheckEnable = 1,
21};
22
23// This is nn::ssl::sf::SslVersion
24struct SslVersion {
25 union {
26 u32 raw{};
27
28 BitField<0, 1, u32> tls_auto;
29 BitField<3, 1, u32> tls_v10;
30 BitField<4, 1, u32> tls_v11;
31 BitField<5, 1, u32> tls_v12;
32 BitField<6, 1, u32> tls_v13;
33 BitField<24, 7, u32> api_version;
34 };
35};
36
16class ISslConnection final : public ServiceFramework<ISslConnection> { 37class ISslConnection final : public ServiceFramework<ISslConnection> {
17public: 38public:
18 explicit ISslConnection(Core::System& system_) : ServiceFramework{system_, "ISslConnection"} { 39 explicit ISslConnection(Core::System& system_, SslVersion version)
40 : ServiceFramework{system_, "ISslConnection"}, ssl_version{version} {
19 // clang-format off 41 // clang-format off
20 static const FunctionInfo functions[] = { 42 static const FunctionInfo functions[] = {
21 {0, nullptr, "SetSocketDescriptor"}, 43 {0, nullptr, "SetSocketDescriptor"},
@@ -59,11 +81,15 @@ public:
59 81
60 RegisterHandlers(functions); 82 RegisterHandlers(functions);
61 } 83 }
84
85private:
86 SslVersion ssl_version;
62}; 87};
63 88
64class ISslContext final : public ServiceFramework<ISslContext> { 89class ISslContext final : public ServiceFramework<ISslContext> {
65public: 90public:
66 explicit ISslContext(Core::System& system_) : ServiceFramework{system_, "ISslContext"} { 91 explicit ISslContext(Core::System& system_, SslVersion version)
92 : ServiceFramework{system_, "ISslContext"}, ssl_version{version} {
67 static const FunctionInfo functions[] = { 93 static const FunctionInfo functions[] = {
68 {0, &ISslContext::SetOption, "SetOption"}, 94 {0, &ISslContext::SetOption, "SetOption"},
69 {1, nullptr, "GetOption"}, 95 {1, nullptr, "GetOption"},
@@ -84,31 +110,34 @@ public:
84 } 110 }
85 111
86private: 112private:
87 void SetOption(Kernel::HLERequestContext& ctx) { 113 SslVersion ssl_version;
114
115 void SetOption(HLERequestContext& ctx) {
88 struct Parameters { 116 struct Parameters {
89 u8 enable; 117 ContextOption option;
90 u32 option; 118 s32 value;
91 }; 119 };
120 static_assert(sizeof(Parameters) == 0x8, "Parameters is an invalid size");
92 121
93 IPC::RequestParser rp{ctx}; 122 IPC::RequestParser rp{ctx};
94 const auto parameters = rp.PopRaw<Parameters>(); 123 const auto parameters = rp.PopRaw<Parameters>();
95 124
96 LOG_WARNING(Service_SSL, "(STUBBED) called. enable={}, option={}", parameters.enable, 125 LOG_WARNING(Service_SSL, "(STUBBED) called. option={}, value={}", parameters.option,
97 parameters.option); 126 parameters.value);
98 127
99 IPC::ResponseBuilder rb{ctx, 2}; 128 IPC::ResponseBuilder rb{ctx, 2};
100 rb.Push(ResultSuccess); 129 rb.Push(ResultSuccess);
101 } 130 }
102 131
103 void CreateConnection(Kernel::HLERequestContext& ctx) { 132 void CreateConnection(HLERequestContext& ctx) {
104 LOG_WARNING(Service_SSL, "(STUBBED) called"); 133 LOG_WARNING(Service_SSL, "(STUBBED) called");
105 134
106 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 135 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
107 rb.Push(ResultSuccess); 136 rb.Push(ResultSuccess);
108 rb.PushIpcInterface<ISslConnection>(system); 137 rb.PushIpcInterface<ISslConnection>(system, ssl_version);
109 } 138 }
110 139
111 void ImportServerPki(Kernel::HLERequestContext& ctx) { 140 void ImportServerPki(HLERequestContext& ctx) {
112 IPC::RequestParser rp{ctx}; 141 IPC::RequestParser rp{ctx};
113 const auto certificate_format = rp.PopEnum<CertificateFormat>(); 142 const auto certificate_format = rp.PopEnum<CertificateFormat>();
114 [[maybe_unused]] const auto pkcs_12_certificates = ctx.ReadBuffer(0); 143 [[maybe_unused]] const auto pkcs_12_certificates = ctx.ReadBuffer(0);
@@ -122,7 +151,7 @@ private:
122 rb.Push(server_id); 151 rb.Push(server_id);
123 } 152 }
124 153
125 void ImportClientPki(Kernel::HLERequestContext& ctx) { 154 void ImportClientPki(HLERequestContext& ctx) {
126 [[maybe_unused]] const auto pkcs_12_certificate = ctx.ReadBuffer(0); 155 [[maybe_unused]] const auto pkcs_12_certificate = ctx.ReadBuffer(0);
127 [[maybe_unused]] const auto ascii_password = [&ctx] { 156 [[maybe_unused]] const auto ascii_password = [&ctx] {
128 if (ctx.CanReadBuffer(1)) { 157 if (ctx.CanReadBuffer(1)) {
@@ -142,20 +171,21 @@ private:
142 } 171 }
143}; 172};
144 173
145class SSL final : public ServiceFramework<SSL> { 174class ISslService final : public ServiceFramework<ISslService> {
146public: 175public:
147 explicit SSL(Core::System& system_) : ServiceFramework{system_, "ssl"} { 176 explicit ISslService(Core::System& system_) : ServiceFramework{system_, "ssl"} {
148 // clang-format off 177 // clang-format off
149 static const FunctionInfo functions[] = { 178 static const FunctionInfo functions[] = {
150 {0, &SSL::CreateContext, "CreateContext"}, 179 {0, &ISslService::CreateContext, "CreateContext"},
151 {1, nullptr, "GetContextCount"}, 180 {1, nullptr, "GetContextCount"},
152 {2, nullptr, "GetCertificates"}, 181 {2, nullptr, "GetCertificates"},
153 {3, nullptr, "GetCertificateBufSize"}, 182 {3, nullptr, "GetCertificateBufSize"},
154 {4, nullptr, "DebugIoctl"}, 183 {4, nullptr, "DebugIoctl"},
155 {5, &SSL::SetInterfaceVersion, "SetInterfaceVersion"}, 184 {5, &ISslService::SetInterfaceVersion, "SetInterfaceVersion"},
156 {6, nullptr, "FlushSessionCache"}, 185 {6, nullptr, "FlushSessionCache"},
157 {7, nullptr, "SetDebugOption"}, 186 {7, nullptr, "SetDebugOption"},
158 {8, nullptr, "GetDebugOption"}, 187 {8, nullptr, "GetDebugOption"},
188 {8, nullptr, "ClearTls12FallbackFlag"},
159 }; 189 };
160 // clang-format on 190 // clang-format on
161 191
@@ -163,20 +193,30 @@ public:
163 } 193 }
164 194
165private: 195private:
166 u32 ssl_version{}; 196 void CreateContext(HLERequestContext& ctx) {
167 void CreateContext(Kernel::HLERequestContext& ctx) { 197 struct Parameters {
168 LOG_WARNING(Service_SSL, "(STUBBED) called"); 198 SslVersion ssl_version;
199 INSERT_PADDING_BYTES(0x4);
200 u64 pid_placeholder;
201 };
202 static_assert(sizeof(Parameters) == 0x10, "Parameters is an invalid size");
203
204 IPC::RequestParser rp{ctx};
205 const auto parameters = rp.PopRaw<Parameters>();
206
207 LOG_WARNING(Service_SSL, "(STUBBED) called, api_version={}, pid_placeholder={}",
208 parameters.ssl_version.api_version, parameters.pid_placeholder);
169 209
170 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 210 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
171 rb.Push(ResultSuccess); 211 rb.Push(ResultSuccess);
172 rb.PushIpcInterface<ISslContext>(system); 212 rb.PushIpcInterface<ISslContext>(system, parameters.ssl_version);
173 } 213 }
174 214
175 void SetInterfaceVersion(Kernel::HLERequestContext& ctx) { 215 void SetInterfaceVersion(HLERequestContext& ctx) {
176 LOG_DEBUG(Service_SSL, "called");
177
178 IPC::RequestParser rp{ctx}; 216 IPC::RequestParser rp{ctx};
179 ssl_version = rp.Pop<u32>(); 217 u32 ssl_version = rp.Pop<u32>();
218
219 LOG_DEBUG(Service_SSL, "called, ssl_version={}", ssl_version);
180 220
181 IPC::ResponseBuilder rb{ctx, 2}; 221 IPC::ResponseBuilder rb{ctx, 2};
182 rb.Push(ResultSuccess); 222 rb.Push(ResultSuccess);
@@ -186,7 +226,7 @@ private:
186void LoopProcess(Core::System& system) { 226void LoopProcess(Core::System& system) {
187 auto server_manager = std::make_unique<ServerManager>(system); 227 auto server_manager = std::make_unique<ServerManager>(system);
188 228
189 server_manager->RegisterNamedService("ssl", std::make_shared<SSL>(system)); 229 server_manager->RegisterNamedService("ssl", std::make_shared<ISslService>(system));
190 ServerManager::RunServer(std::move(server_manager)); 230 ServerManager::RunServer(std::move(server_manager));
191} 231}
192 232
diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp
index 8020e407c..868be60c5 100644
--- a/src/core/hle/service/time/time.cpp
+++ b/src/core/hle/service/time/time.cpp
@@ -5,8 +5,8 @@
5#include "core/core.h" 5#include "core/core.h"
6#include "core/core_timing.h" 6#include "core/core_timing.h"
7#include "core/hardware_properties.h" 7#include "core/hardware_properties.h"
8#include "core/hle/ipc_helpers.h"
9#include "core/hle/kernel/kernel.h" 8#include "core/hle/kernel/kernel.h"
9#include "core/hle/service/ipc_helpers.h"
10#include "core/hle/service/server_manager.h" 10#include "core/hle/service/server_manager.h"
11#include "core/hle/service/time/time.h" 11#include "core/hle/service/time/time.h"
12#include "core/hle/service/time/time_interface.h" 12#include "core/hle/service/time/time_interface.h"
@@ -34,7 +34,7 @@ public:
34 } 34 }
35 35
36private: 36private:
37 void GetCurrentTime(Kernel::HLERequestContext& ctx) { 37 void GetCurrentTime(HLERequestContext& ctx) {
38 LOG_DEBUG(Service_Time, "called"); 38 LOG_DEBUG(Service_Time, "called");
39 39
40 if (!clock_core.IsInitialized()) { 40 if (!clock_core.IsInitialized()) {
@@ -55,7 +55,7 @@ private:
55 rb.Push<s64>(posix_time); 55 rb.Push<s64>(posix_time);
56 } 56 }
57 57
58 void GetSystemClockContext(Kernel::HLERequestContext& ctx) { 58 void GetSystemClockContext(HLERequestContext& ctx) {
59 LOG_DEBUG(Service_Time, "called"); 59 LOG_DEBUG(Service_Time, "called");
60 60
61 if (!clock_core.IsInitialized()) { 61 if (!clock_core.IsInitialized()) {
@@ -98,7 +98,7 @@ public:
98 } 98 }
99 99
100private: 100private:
101 void GetCurrentTimePoint(Kernel::HLERequestContext& ctx) { 101 void GetCurrentTimePoint(HLERequestContext& ctx) {
102 LOG_DEBUG(Service_Time, "called"); 102 LOG_DEBUG(Service_Time, "called");
103 103
104 if (!clock_core.IsInitialized()) { 104 if (!clock_core.IsInitialized()) {
@@ -178,7 +178,7 @@ Result Module::Interface::GetClockSnapshotFromSystemClockContextInternal(
178 return ResultSuccess; 178 return ResultSuccess;
179} 179}
180 180
181void Module::Interface::GetStandardUserSystemClock(Kernel::HLERequestContext& ctx) { 181void Module::Interface::GetStandardUserSystemClock(HLERequestContext& ctx) {
182 LOG_DEBUG(Service_Time, "called"); 182 LOG_DEBUG(Service_Time, "called");
183 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 183 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
184 rb.Push(ResultSuccess); 184 rb.Push(ResultSuccess);
@@ -186,7 +186,7 @@ void Module::Interface::GetStandardUserSystemClock(Kernel::HLERequestContext& ct
186 system); 186 system);
187} 187}
188 188
189void Module::Interface::GetStandardNetworkSystemClock(Kernel::HLERequestContext& ctx) { 189void Module::Interface::GetStandardNetworkSystemClock(HLERequestContext& ctx) {
190 LOG_DEBUG(Service_Time, "called"); 190 LOG_DEBUG(Service_Time, "called");
191 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 191 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
192 rb.Push(ResultSuccess); 192 rb.Push(ResultSuccess);
@@ -194,14 +194,14 @@ void Module::Interface::GetStandardNetworkSystemClock(Kernel::HLERequestContext&
194 system); 194 system);
195} 195}
196 196
197void Module::Interface::GetStandardSteadyClock(Kernel::HLERequestContext& ctx) { 197void Module::Interface::GetStandardSteadyClock(HLERequestContext& ctx) {
198 LOG_DEBUG(Service_Time, "called"); 198 LOG_DEBUG(Service_Time, "called");
199 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 199 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
200 rb.Push(ResultSuccess); 200 rb.Push(ResultSuccess);
201 rb.PushIpcInterface<ISteadyClock>(system.GetTimeManager().GetStandardSteadyClockCore(), system); 201 rb.PushIpcInterface<ISteadyClock>(system.GetTimeManager().GetStandardSteadyClockCore(), system);
202} 202}
203 203
204void Module::Interface::GetTimeZoneService(Kernel::HLERequestContext& ctx) { 204void Module::Interface::GetTimeZoneService(HLERequestContext& ctx) {
205 LOG_DEBUG(Service_Time, "called"); 205 LOG_DEBUG(Service_Time, "called");
206 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 206 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
207 rb.Push(ResultSuccess); 207 rb.Push(ResultSuccess);
@@ -209,7 +209,7 @@ void Module::Interface::GetTimeZoneService(Kernel::HLERequestContext& ctx) {
209 system.GetTimeManager().GetTimeZoneContentManager()); 209 system.GetTimeManager().GetTimeZoneContentManager());
210} 210}
211 211
212void Module::Interface::GetStandardLocalSystemClock(Kernel::HLERequestContext& ctx) { 212void Module::Interface::GetStandardLocalSystemClock(HLERequestContext& ctx) {
213 LOG_DEBUG(Service_Time, "called"); 213 LOG_DEBUG(Service_Time, "called");
214 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 214 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
215 rb.Push(ResultSuccess); 215 rb.Push(ResultSuccess);
@@ -217,8 +217,7 @@ void Module::Interface::GetStandardLocalSystemClock(Kernel::HLERequestContext& c
217 system); 217 system);
218} 218}
219 219
220void Module::Interface::IsStandardNetworkSystemClockAccuracySufficient( 220void Module::Interface::IsStandardNetworkSystemClockAccuracySufficient(HLERequestContext& ctx) {
221 Kernel::HLERequestContext& ctx) {
222 LOG_DEBUG(Service_Time, "called"); 221 LOG_DEBUG(Service_Time, "called");
223 auto& clock_core{system.GetTimeManager().GetStandardNetworkSystemClockCore()}; 222 auto& clock_core{system.GetTimeManager().GetStandardNetworkSystemClockCore()};
224 IPC::ResponseBuilder rb{ctx, 3}; 223 IPC::ResponseBuilder rb{ctx, 3};
@@ -226,7 +225,7 @@ void Module::Interface::IsStandardNetworkSystemClockAccuracySufficient(
226 rb.Push<u32>(clock_core.IsStandardNetworkSystemClockAccuracySufficient(system)); 225 rb.Push<u32>(clock_core.IsStandardNetworkSystemClockAccuracySufficient(system));
227} 226}
228 227
229void Module::Interface::CalculateMonotonicSystemClockBaseTimePoint(Kernel::HLERequestContext& ctx) { 228void Module::Interface::CalculateMonotonicSystemClockBaseTimePoint(HLERequestContext& ctx) {
230 LOG_DEBUG(Service_Time, "called"); 229 LOG_DEBUG(Service_Time, "called");
231 230
232 auto& steady_clock_core{system.GetTimeManager().GetStandardSteadyClockCore()}; 231 auto& steady_clock_core{system.GetTimeManager().GetStandardSteadyClockCore()};
@@ -255,7 +254,7 @@ void Module::Interface::CalculateMonotonicSystemClockBaseTimePoint(Kernel::HLERe
255 rb.Push(ERROR_TIME_MISMATCH); 254 rb.Push(ERROR_TIME_MISMATCH);
256} 255}
257 256
258void Module::Interface::GetClockSnapshot(Kernel::HLERequestContext& ctx) { 257void Module::Interface::GetClockSnapshot(HLERequestContext& ctx) {
259 IPC::RequestParser rp{ctx}; 258 IPC::RequestParser rp{ctx};
260 const auto type{rp.PopEnum<Clock::TimeType>()}; 259 const auto type{rp.PopEnum<Clock::TimeType>()};
261 260
@@ -296,7 +295,7 @@ void Module::Interface::GetClockSnapshot(Kernel::HLERequestContext& ctx) {
296 rb.Push(ResultSuccess); 295 rb.Push(ResultSuccess);
297} 296}
298 297
299void Module::Interface::GetClockSnapshotFromSystemClockContext(Kernel::HLERequestContext& ctx) { 298void Module::Interface::GetClockSnapshotFromSystemClockContext(HLERequestContext& ctx) {
300 IPC::RequestParser rp{ctx}; 299 IPC::RequestParser rp{ctx};
301 const auto type{rp.PopEnum<Clock::TimeType>()}; 300 const auto type{rp.PopEnum<Clock::TimeType>()};
302 301
@@ -322,8 +321,7 @@ void Module::Interface::GetClockSnapshotFromSystemClockContext(Kernel::HLEReques
322 rb.Push(ResultSuccess); 321 rb.Push(ResultSuccess);
323} 322}
324 323
325void Module::Interface::CalculateStandardUserSystemClockDifferenceByUser( 324void Module::Interface::CalculateStandardUserSystemClockDifferenceByUser(HLERequestContext& ctx) {
326 Kernel::HLERequestContext& ctx) {
327 LOG_DEBUG(Service_Time, "called"); 325 LOG_DEBUG(Service_Time, "called");
328 326
329 Clock::ClockSnapshot snapshot_a; 327 Clock::ClockSnapshot snapshot_a;
@@ -350,7 +348,7 @@ void Module::Interface::CalculateStandardUserSystemClockDifferenceByUser(
350 rb.PushRaw(time_span_type.nanoseconds); 348 rb.PushRaw(time_span_type.nanoseconds);
351} 349}
352 350
353void Module::Interface::CalculateSpanBetween(Kernel::HLERequestContext& ctx) { 351void Module::Interface::CalculateSpanBetween(HLERequestContext& ctx) {
354 LOG_DEBUG(Service_Time, "called"); 352 LOG_DEBUG(Service_Time, "called");
355 353
356 Clock::ClockSnapshot snapshot_a; 354 Clock::ClockSnapshot snapshot_a;
@@ -385,7 +383,7 @@ void Module::Interface::CalculateSpanBetween(Kernel::HLERequestContext& ctx) {
385 rb.PushRaw(time_span_type.nanoseconds); 383 rb.PushRaw(time_span_type.nanoseconds);
386} 384}
387 385
388void Module::Interface::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) { 386void Module::Interface::GetSharedMemoryNativeHandle(HLERequestContext& ctx) {
389 LOG_DEBUG(Service_Time, "called"); 387 LOG_DEBUG(Service_Time, "called");
390 IPC::ResponseBuilder rb{ctx, 2, 1}; 388 IPC::ResponseBuilder rb{ctx, 2, 1};
391 rb.Push(ResultSuccess); 389 rb.Push(ResultSuccess);
diff --git a/src/core/hle/service/time/time.h b/src/core/hle/service/time/time.h
index c9936c645..b2d754ef3 100644
--- a/src/core/hle/service/time/time.h
+++ b/src/core/hle/service/time/time.h
@@ -22,18 +22,18 @@ public:
22 const char* name); 22 const char* name);
23 ~Interface() override; 23 ~Interface() override;
24 24
25 void GetStandardUserSystemClock(Kernel::HLERequestContext& ctx); 25 void GetStandardUserSystemClock(HLERequestContext& ctx);
26 void GetStandardNetworkSystemClock(Kernel::HLERequestContext& ctx); 26 void GetStandardNetworkSystemClock(HLERequestContext& ctx);
27 void GetStandardSteadyClock(Kernel::HLERequestContext& ctx); 27 void GetStandardSteadyClock(HLERequestContext& ctx);
28 void GetTimeZoneService(Kernel::HLERequestContext& ctx); 28 void GetTimeZoneService(HLERequestContext& ctx);
29 void GetStandardLocalSystemClock(Kernel::HLERequestContext& ctx); 29 void GetStandardLocalSystemClock(HLERequestContext& ctx);
30 void IsStandardNetworkSystemClockAccuracySufficient(Kernel::HLERequestContext& ctx); 30 void IsStandardNetworkSystemClockAccuracySufficient(HLERequestContext& ctx);
31 void CalculateMonotonicSystemClockBaseTimePoint(Kernel::HLERequestContext& ctx); 31 void CalculateMonotonicSystemClockBaseTimePoint(HLERequestContext& ctx);
32 void GetClockSnapshot(Kernel::HLERequestContext& ctx); 32 void GetClockSnapshot(HLERequestContext& ctx);
33 void GetClockSnapshotFromSystemClockContext(Kernel::HLERequestContext& ctx); 33 void GetClockSnapshotFromSystemClockContext(HLERequestContext& ctx);
34 void CalculateStandardUserSystemClockDifferenceByUser(Kernel::HLERequestContext& ctx); 34 void CalculateStandardUserSystemClockDifferenceByUser(HLERequestContext& ctx);
35 void CalculateSpanBetween(Kernel::HLERequestContext& ctx); 35 void CalculateSpanBetween(HLERequestContext& ctx);
36 void GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx); 36 void GetSharedMemoryNativeHandle(HLERequestContext& ctx);
37 37
38 private: 38 private:
39 Result GetClockSnapshotFromSystemClockContextInternal( 39 Result GetClockSnapshotFromSystemClockContextInternal(
diff --git a/src/core/hle/service/time/time_zone_service.cpp b/src/core/hle/service/time/time_zone_service.cpp
index 961040bfc..cda8d8343 100644
--- a/src/core/hle/service/time/time_zone_service.cpp
+++ b/src/core/hle/service/time/time_zone_service.cpp
@@ -2,7 +2,7 @@
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "common/logging/log.h" 4#include "common/logging/log.h"
5#include "core/hle/ipc_helpers.h" 5#include "core/hle/service/ipc_helpers.h"
6#include "core/hle/service/time/time_zone_content_manager.h" 6#include "core/hle/service/time/time_zone_content_manager.h"
7#include "core/hle/service/time/time_zone_service.h" 7#include "core/hle/service/time/time_zone_service.h"
8#include "core/hle/service/time/time_zone_types.h" 8#include "core/hle/service/time/time_zone_types.h"
@@ -28,7 +28,7 @@ ITimeZoneService::ITimeZoneService(Core::System& system_,
28 RegisterHandlers(functions); 28 RegisterHandlers(functions);
29} 29}
30 30
31void ITimeZoneService::GetDeviceLocationName(Kernel::HLERequestContext& ctx) { 31void ITimeZoneService::GetDeviceLocationName(HLERequestContext& ctx) {
32 LOG_DEBUG(Service_Time, "called"); 32 LOG_DEBUG(Service_Time, "called");
33 33
34 TimeZone::LocationName location_name{}; 34 TimeZone::LocationName location_name{};
@@ -45,7 +45,7 @@ void ITimeZoneService::GetDeviceLocationName(Kernel::HLERequestContext& ctx) {
45 rb.PushRaw(location_name); 45 rb.PushRaw(location_name);
46} 46}
47 47
48void ITimeZoneService::LoadTimeZoneRule(Kernel::HLERequestContext& ctx) { 48void ITimeZoneService::LoadTimeZoneRule(HLERequestContext& ctx) {
49 IPC::RequestParser rp{ctx}; 49 IPC::RequestParser rp{ctx};
50 const auto raw_location_name{rp.PopRaw<std::array<u8, 0x24>>()}; 50 const auto raw_location_name{rp.PopRaw<std::array<u8, 0x24>>()};
51 51
@@ -77,7 +77,7 @@ void ITimeZoneService::LoadTimeZoneRule(Kernel::HLERequestContext& ctx) {
77 rb.Push(ResultSuccess); 77 rb.Push(ResultSuccess);
78} 78}
79 79
80void ITimeZoneService::ToCalendarTime(Kernel::HLERequestContext& ctx) { 80void ITimeZoneService::ToCalendarTime(HLERequestContext& ctx) {
81 IPC::RequestParser rp{ctx}; 81 IPC::RequestParser rp{ctx};
82 const auto posix_time{rp.Pop<s64>()}; 82 const auto posix_time{rp.Pop<s64>()};
83 83
@@ -101,7 +101,7 @@ void ITimeZoneService::ToCalendarTime(Kernel::HLERequestContext& ctx) {
101 rb.PushRaw(calendar_info); 101 rb.PushRaw(calendar_info);
102} 102}
103 103
104void ITimeZoneService::ToCalendarTimeWithMyRule(Kernel::HLERequestContext& ctx) { 104void ITimeZoneService::ToCalendarTimeWithMyRule(HLERequestContext& ctx) {
105 IPC::RequestParser rp{ctx}; 105 IPC::RequestParser rp{ctx};
106 const auto posix_time{rp.Pop<s64>()}; 106 const auto posix_time{rp.Pop<s64>()};
107 107
@@ -122,7 +122,7 @@ void ITimeZoneService::ToCalendarTimeWithMyRule(Kernel::HLERequestContext& ctx)
122 rb.PushRaw(calendar_info); 122 rb.PushRaw(calendar_info);
123} 123}
124 124
125void ITimeZoneService::ToPosixTime(Kernel::HLERequestContext& ctx) { 125void ITimeZoneService::ToPosixTime(HLERequestContext& ctx) {
126 LOG_DEBUG(Service_Time, "called"); 126 LOG_DEBUG(Service_Time, "called");
127 127
128 IPC::RequestParser rp{ctx}; 128 IPC::RequestParser rp{ctx};
@@ -147,7 +147,7 @@ void ITimeZoneService::ToPosixTime(Kernel::HLERequestContext& ctx) {
147 rb.PushRaw<u32>(1); // Number of times we're returning 147 rb.PushRaw<u32>(1); // Number of times we're returning
148} 148}
149 149
150void ITimeZoneService::ToPosixTimeWithMyRule(Kernel::HLERequestContext& ctx) { 150void ITimeZoneService::ToPosixTimeWithMyRule(HLERequestContext& ctx) {
151 LOG_DEBUG(Service_Time, "called"); 151 LOG_DEBUG(Service_Time, "called");
152 152
153 IPC::RequestParser rp{ctx}; 153 IPC::RequestParser rp{ctx};
diff --git a/src/core/hle/service/time/time_zone_service.h b/src/core/hle/service/time/time_zone_service.h
index f151f4b56..ea83b5714 100644
--- a/src/core/hle/service/time/time_zone_service.h
+++ b/src/core/hle/service/time/time_zone_service.h
@@ -21,12 +21,12 @@ public:
21 TimeZone::TimeZoneContentManager& time_zone_manager_); 21 TimeZone::TimeZoneContentManager& time_zone_manager_);
22 22
23private: 23private:
24 void GetDeviceLocationName(Kernel::HLERequestContext& ctx); 24 void GetDeviceLocationName(HLERequestContext& ctx);
25 void LoadTimeZoneRule(Kernel::HLERequestContext& ctx); 25 void LoadTimeZoneRule(HLERequestContext& ctx);
26 void ToCalendarTime(Kernel::HLERequestContext& ctx); 26 void ToCalendarTime(HLERequestContext& ctx);
27 void ToCalendarTimeWithMyRule(Kernel::HLERequestContext& ctx); 27 void ToCalendarTimeWithMyRule(HLERequestContext& ctx);
28 void ToPosixTime(Kernel::HLERequestContext& ctx); 28 void ToPosixTime(HLERequestContext& ctx);
29 void ToPosixTimeWithMyRule(Kernel::HLERequestContext& ctx); 29 void ToPosixTimeWithMyRule(HLERequestContext& ctx);
30 30
31private: 31private:
32 TimeZone::TimeZoneContentManager& time_zone_content_manager; 32 TimeZone::TimeZoneContentManager& time_zone_content_manager;
diff --git a/src/core/hle/service/usb/usb.cpp b/src/core/hle/service/usb/usb.cpp
index ddb73f394..f29fff1dd 100644
--- a/src/core/hle/service/usb/usb.cpp
+++ b/src/core/hle/service/usb/usb.cpp
@@ -4,7 +4,7 @@
4#include <memory> 4#include <memory>
5 5
6#include "common/logging/log.h" 6#include "common/logging/log.h"
7#include "core/hle/ipc_helpers.h" 7#include "core/hle/service/ipc_helpers.h"
8#include "core/hle/service/server_manager.h" 8#include "core/hle/service/server_manager.h"
9#include "core/hle/service/service.h" 9#include "core/hle/service/service.h"
10#include "core/hle/service/usb/usb.h" 10#include "core/hle/service/usb/usb.h"
@@ -16,19 +16,19 @@ public:
16 explicit IDsInterface(Core::System& system_) : ServiceFramework{system_, "IDsInterface"} { 16 explicit IDsInterface(Core::System& system_) : ServiceFramework{system_, "IDsInterface"} {
17 // clang-format off 17 // clang-format off
18 static const FunctionInfo functions[] = { 18 static const FunctionInfo functions[] = {
19 {0, nullptr, "BindDevice"}, 19 {0, nullptr, "AddEndpoint"},
20 {1, nullptr, "BindClientProcess"}, 20 {1, nullptr, "GetSetupEvent"},
21 {2, nullptr, "AddInterface"}, 21 {2, nullptr, "GetSetupPacket"},
22 {3, nullptr, "GetStateChangeEvent"}, 22 {3, nullptr, "Enable"},
23 {4, nullptr, "GetState"}, 23 {4, nullptr, "Disable"},
24 {5, nullptr, "ClearDeviceData"}, 24 {5, nullptr, "CtrlIn"},
25 {6, nullptr, "AddUsbStringDescriptor"}, 25 {6, nullptr, "CtrlOut"},
26 {7, nullptr, "DeleteUsbStringDescriptor"}, 26 {7, nullptr, "GetCtrlInCompletionEvent"},
27 {8, nullptr, "SetUsbDeviceDescriptor"}, 27 {8, nullptr, "GetCtrlInUrbReport"},
28 {9, nullptr, "SetBinaryObjectStore"}, 28 {9, nullptr, "GetCtrlOutCompletionEvent"},
29 {10, nullptr, "Enable"}, 29 {10, nullptr, "GetCtrlOutUrbReport"},
30 {11, nullptr, "Disable"}, 30 {11, nullptr, "CtrlStall"},
31 {12, nullptr, "Unknown12"}, 31 {12, nullptr, "AppendConfigurationData"},
32 }; 32 };
33 // clang-format on 33 // clang-format on
34 34
@@ -36,9 +36,9 @@ public:
36 } 36 }
37}; 37};
38 38
39class USB_DS final : public ServiceFramework<USB_DS> { 39class IDsRootSession final : public ServiceFramework<IDsRootSession> {
40public: 40public:
41 explicit USB_DS(Core::System& system_) : ServiceFramework{system_, "usb:ds"} { 41 explicit IDsRootSession(Core::System& system_) : ServiceFramework{system_, "usb:ds"} {
42 // clang-format off 42 // clang-format off
43 static const FunctionInfo functions[] = { 43 static const FunctionInfo functions[] = {
44 {0, nullptr, "OpenDsService"}, 44 {0, nullptr, "OpenDsService"},
@@ -94,9 +94,9 @@ public:
94 } 94 }
95}; 95};
96 96
97class USB_HS final : public ServiceFramework<USB_HS> { 97class IClientRootSession final : public ServiceFramework<IClientRootSession> {
98public: 98public:
99 explicit USB_HS(Core::System& system_) : ServiceFramework{system_, "usb:hs"} { 99 explicit IClientRootSession(Core::System& system_) : ServiceFramework{system_, "usb:hs"} {
100 // clang-format off 100 // clang-format off
101 static const FunctionInfo functions[] = { 101 static const FunctionInfo functions[] = {
102 {0, nullptr, "BindClientProcess"}, 102 {0, nullptr, "BindClientProcess"},
@@ -107,7 +107,7 @@ public:
107 {5, nullptr, "DestroyInterfaceAvailableEvent"}, 107 {5, nullptr, "DestroyInterfaceAvailableEvent"},
108 {6, nullptr, "GetInterfaceStateChangeEvent"}, 108 {6, nullptr, "GetInterfaceStateChangeEvent"},
109 {7, nullptr, "AcquireUsbIf"}, 109 {7, nullptr, "AcquireUsbIf"},
110 {8, nullptr, "ResetDevice"}, 110 {8, nullptr, "SetTestMode"},
111 }; 111 };
112 // clang-format on 112 // clang-format on
113 113
@@ -134,12 +134,12 @@ public:
134 } 134 }
135}; 135};
136 136
137class USB_PD final : public ServiceFramework<USB_PD> { 137class IPdManager final : public ServiceFramework<IPdManager> {
138public: 138public:
139 explicit USB_PD(Core::System& system_) : ServiceFramework{system_, "usb:pd"} { 139 explicit IPdManager(Core::System& system_) : ServiceFramework{system_, "usb:pd"} {
140 // clang-format off 140 // clang-format off
141 static const FunctionInfo functions[] = { 141 static const FunctionInfo functions[] = {
142 {0, &USB_PD::GetPdSession, "GetPdSession"}, 142 {0, &IPdManager::OpenSession, "OpenSession"},
143 }; 143 };
144 // clang-format on 144 // clang-format on
145 145
@@ -147,7 +147,7 @@ public:
147 } 147 }
148 148
149private: 149private:
150 void GetPdSession(Kernel::HLERequestContext& ctx) { 150 void OpenSession(HLERequestContext& ctx) {
151 LOG_DEBUG(Service_USB, "called"); 151 LOG_DEBUG(Service_USB, "called");
152 152
153 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 153 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -178,12 +178,12 @@ public:
178 } 178 }
179}; 179};
180 180
181class USB_PD_C final : public ServiceFramework<USB_PD_C> { 181class IPdCradleManager final : public ServiceFramework<IPdCradleManager> {
182public: 182public:
183 explicit USB_PD_C(Core::System& system_) : ServiceFramework{system_, "usb:pd:c"} { 183 explicit IPdCradleManager(Core::System& system_) : ServiceFramework{system_, "usb:pd:c"} {
184 // clang-format off 184 // clang-format off
185 static const FunctionInfo functions[] = { 185 static const FunctionInfo functions[] = {
186 {0, &USB_PD_C::GetPdCradleSession, "GetPdCradleSession"}, 186 {0, &IPdCradleManager::OpenCradleSession, "OpenCradleSession"},
187 }; 187 };
188 // clang-format on 188 // clang-format on
189 189
@@ -191,18 +191,18 @@ public:
191 } 191 }
192 192
193private: 193private:
194 void GetPdCradleSession(Kernel::HLERequestContext& ctx) { 194 void OpenCradleSession(HLERequestContext& ctx) {
195 LOG_DEBUG(Service_USB, "called");
196
195 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 197 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
196 rb.Push(ResultSuccess); 198 rb.Push(ResultSuccess);
197 rb.PushIpcInterface<IPdCradleSession>(system); 199 rb.PushIpcInterface<IPdCradleSession>(system);
198
199 LOG_DEBUG(Service_USB, "called");
200 } 200 }
201}; 201};
202 202
203class USB_PM final : public ServiceFramework<USB_PM> { 203class IPmMainService final : public ServiceFramework<IPmMainService> {
204public: 204public:
205 explicit USB_PM(Core::System& system_) : ServiceFramework{system_, "usb:pm"} { 205 explicit IPmMainService(Core::System& system_) : ServiceFramework{system_, "usb:pm"} {
206 // clang-format off 206 // clang-format off
207 static const FunctionInfo functions[] = { 207 static const FunctionInfo functions[] = {
208 {0, nullptr, "GetPowerEvent"}, 208 {0, nullptr, "GetPowerEvent"},
@@ -221,11 +221,11 @@ public:
221void LoopProcess(Core::System& system) { 221void LoopProcess(Core::System& system) {
222 auto server_manager = std::make_unique<ServerManager>(system); 222 auto server_manager = std::make_unique<ServerManager>(system);
223 223
224 server_manager->RegisterNamedService("usb:ds", std::make_shared<USB_DS>(system)); 224 server_manager->RegisterNamedService("usb:ds", std::make_shared<IDsRootSession>(system));
225 server_manager->RegisterNamedService("usb:hs", std::make_shared<USB_HS>(system)); 225 server_manager->RegisterNamedService("usb:hs", std::make_shared<IClientRootSession>(system));
226 server_manager->RegisterNamedService("usb:pd", std::make_shared<USB_PD>(system)); 226 server_manager->RegisterNamedService("usb:pd", std::make_shared<IPdManager>(system));
227 server_manager->RegisterNamedService("usb:pd:c", std::make_shared<USB_PD_C>(system)); 227 server_manager->RegisterNamedService("usb:pd:c", std::make_shared<IPdCradleManager>(system));
228 server_manager->RegisterNamedService("usb:pm", std::make_shared<USB_PM>(system)); 228 server_manager->RegisterNamedService("usb:pm", std::make_shared<IPmMainService>(system));
229 ServerManager::RunServer(std::move(server_manager)); 229 ServerManager::RunServer(std::move(server_manager));
230} 230}
231 231
diff --git a/src/core/hle/service/vi/display/vi_display.cpp b/src/core/hle/service/vi/display/vi_display.cpp
index 8ef74f1f0..69af2868a 100644
--- a/src/core/hle/service/vi/display/vi_display.cpp
+++ b/src/core/hle/service/vi/display/vi_display.cpp
@@ -12,11 +12,11 @@
12#include "core/hle/kernel/k_readable_event.h" 12#include "core/hle/kernel/k_readable_event.h"
13#include "core/hle/service/kernel_helpers.h" 13#include "core/hle/service/kernel_helpers.h"
14#include "core/hle/service/nvdrv/core/container.h" 14#include "core/hle/service/nvdrv/core/container.h"
15#include "core/hle/service/nvflinger/buffer_item_consumer.h" 15#include "core/hle/service/nvnflinger/buffer_item_consumer.h"
16#include "core/hle/service/nvflinger/buffer_queue_consumer.h" 16#include "core/hle/service/nvnflinger/buffer_queue_consumer.h"
17#include "core/hle/service/nvflinger/buffer_queue_core.h" 17#include "core/hle/service/nvnflinger/buffer_queue_core.h"
18#include "core/hle/service/nvflinger/buffer_queue_producer.h" 18#include "core/hle/service/nvnflinger/buffer_queue_producer.h"
19#include "core/hle/service/nvflinger/hos_binder_driver_server.h" 19#include "core/hle/service/nvnflinger/hos_binder_driver_server.h"
20#include "core/hle/service/vi/display/vi_display.h" 20#include "core/hle/service/vi/display/vi_display.h"
21#include "core/hle/service/vi/layer/vi_layer.h" 21#include "core/hle/service/vi/layer/vi_layer.h"
22#include "core/hle/service/vi/vi_results.h" 22#include "core/hle/service/vi/vi_results.h"
@@ -39,7 +39,7 @@ static BufferQueue CreateBufferQueue(KernelHelpers::ServiceContext& service_cont
39} 39}
40 40
41Display::Display(u64 id, std::string name_, 41Display::Display(u64 id, std::string name_,
42 NVFlinger::HosBinderDriverServer& hos_binder_driver_server_, 42 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_,
43 KernelHelpers::ServiceContext& service_context_, Core::System& system_) 43 KernelHelpers::ServiceContext& service_context_, Core::System& system_)
44 : display_id{id}, name{std::move(name_)}, hos_binder_driver_server{hos_binder_driver_server_}, 44 : display_id{id}, name{std::move(name_)}, hos_binder_driver_server{hos_binder_driver_server_},
45 service_context{service_context_} { 45 service_context{service_context_} {
diff --git a/src/core/hle/service/vi/display/vi_display.h b/src/core/hle/service/vi/display/vi_display.h
index 0b65a65da..3f31d1f32 100644
--- a/src/core/hle/service/vi/display/vi_display.h
+++ b/src/core/hle/service/vi/display/vi_display.h
@@ -23,7 +23,7 @@ namespace Service::KernelHelpers {
23class ServiceContext; 23class ServiceContext;
24} 24}
25 25
26namespace Service::NVFlinger { 26namespace Service::Nvnflinger {
27class HosBinderDriverServer; 27class HosBinderDriverServer;
28} 28}
29 29
@@ -45,12 +45,12 @@ public:
45 /// Constructs a display with a given unique ID and name. 45 /// Constructs a display with a given unique ID and name.
46 /// 46 ///
47 /// @param id The unique ID for this display. 47 /// @param id The unique ID for this display.
48 /// @param hos_binder_driver_server_ NVFlinger HOSBinderDriver server instance. 48 /// @param hos_binder_driver_server_ Nvnflinger HOSBinderDriver server instance.
49 /// @param service_context_ The ServiceContext for the owning service. 49 /// @param service_context_ The ServiceContext for the owning service.
50 /// @param name_ The name for this display. 50 /// @param name_ The name for this display.
51 /// @param system_ The global system instance. 51 /// @param system_ The global system instance.
52 /// 52 ///
53 Display(u64 id, std::string name_, NVFlinger::HosBinderDriverServer& hos_binder_driver_server_, 53 Display(u64 id, std::string name_, Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_,
54 KernelHelpers::ServiceContext& service_context_, Core::System& system_); 54 KernelHelpers::ServiceContext& service_context_, Core::System& system_);
55 ~Display(); 55 ~Display();
56 56
@@ -133,7 +133,7 @@ public:
133private: 133private:
134 u64 display_id; 134 u64 display_id;
135 std::string name; 135 std::string name;
136 NVFlinger::HosBinderDriverServer& hos_binder_driver_server; 136 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server;
137 KernelHelpers::ServiceContext& service_context; 137 KernelHelpers::ServiceContext& service_context;
138 138
139 std::vector<std::unique_ptr<Layer>> layers; 139 std::vector<std::unique_ptr<Layer>> layers;
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index d9cfebd70..68eab5133 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -17,15 +17,15 @@
17#include "common/settings.h" 17#include "common/settings.h"
18#include "common/swap.h" 18#include "common/swap.h"
19#include "core/core_timing.h" 19#include "core/core_timing.h"
20#include "core/hle/ipc_helpers.h"
21#include "core/hle/kernel/k_readable_event.h" 20#include "core/hle/kernel/k_readable_event.h"
22#include "core/hle/kernel/k_thread.h" 21#include "core/hle/kernel/k_thread.h"
22#include "core/hle/service/ipc_helpers.h"
23#include "core/hle/service/nvdrv/nvdata.h" 23#include "core/hle/service/nvdrv/nvdata.h"
24#include "core/hle/service/nvflinger/binder.h" 24#include "core/hle/service/nvnflinger/binder.h"
25#include "core/hle/service/nvflinger/buffer_queue_producer.h" 25#include "core/hle/service/nvnflinger/buffer_queue_producer.h"
26#include "core/hle/service/nvflinger/hos_binder_driver_server.h" 26#include "core/hle/service/nvnflinger/hos_binder_driver_server.h"
27#include "core/hle/service/nvflinger/nvflinger.h" 27#include "core/hle/service/nvnflinger/nvnflinger.h"
28#include "core/hle/service/nvflinger/parcel.h" 28#include "core/hle/service/nvnflinger/parcel.h"
29#include "core/hle/service/server_manager.h" 29#include "core/hle/service/server_manager.h"
30#include "core/hle/service/service.h" 30#include "core/hle/service/service.h"
31#include "core/hle/service/vi/vi.h" 31#include "core/hle/service/vi/vi.h"
@@ -73,7 +73,7 @@ static_assert(sizeof(NativeWindow) == 0x28, "NativeWindow has wrong size");
73 73
74class IHOSBinderDriver final : public ServiceFramework<IHOSBinderDriver> { 74class IHOSBinderDriver final : public ServiceFramework<IHOSBinderDriver> {
75public: 75public:
76 explicit IHOSBinderDriver(Core::System& system_, NVFlinger::HosBinderDriverServer& server_) 76 explicit IHOSBinderDriver(Core::System& system_, Nvnflinger::HosBinderDriverServer& server_)
77 : ServiceFramework{system_, "IHOSBinderDriver"}, server(server_) { 77 : ServiceFramework{system_, "IHOSBinderDriver"}, server(server_) {
78 static const FunctionInfo functions[] = { 78 static const FunctionInfo functions[] = {
79 {0, &IHOSBinderDriver::TransactParcel, "TransactParcel"}, 79 {0, &IHOSBinderDriver::TransactParcel, "TransactParcel"},
@@ -85,7 +85,7 @@ public:
85 } 85 }
86 86
87private: 87private:
88 void TransactParcel(Kernel::HLERequestContext& ctx) { 88 void TransactParcel(HLERequestContext& ctx) {
89 IPC::RequestParser rp{ctx}; 89 IPC::RequestParser rp{ctx};
90 const u32 id = rp.Pop<u32>(); 90 const u32 id = rp.Pop<u32>();
91 const auto transaction = static_cast<android::TransactionId>(rp.Pop<u32>()); 91 const auto transaction = static_cast<android::TransactionId>(rp.Pop<u32>());
@@ -100,7 +100,7 @@ private:
100 rb.Push(ResultSuccess); 100 rb.Push(ResultSuccess);
101 } 101 }
102 102
103 void AdjustRefcount(Kernel::HLERequestContext& ctx) { 103 void AdjustRefcount(HLERequestContext& ctx) {
104 IPC::RequestParser rp{ctx}; 104 IPC::RequestParser rp{ctx};
105 const u32 id = rp.Pop<u32>(); 105 const u32 id = rp.Pop<u32>();
106 const s32 addval = rp.PopRaw<s32>(); 106 const s32 addval = rp.PopRaw<s32>();
@@ -113,7 +113,7 @@ private:
113 rb.Push(ResultSuccess); 113 rb.Push(ResultSuccess);
114 } 114 }
115 115
116 void GetNativeHandle(Kernel::HLERequestContext& ctx) { 116 void GetNativeHandle(HLERequestContext& ctx) {
117 IPC::RequestParser rp{ctx}; 117 IPC::RequestParser rp{ctx};
118 const u32 id = rp.Pop<u32>(); 118 const u32 id = rp.Pop<u32>();
119 const u32 unknown = rp.Pop<u32>(); 119 const u32 unknown = rp.Pop<u32>();
@@ -126,7 +126,7 @@ private:
126 } 126 }
127 127
128private: 128private:
129 NVFlinger::HosBinderDriverServer& server; 129 Nvnflinger::HosBinderDriverServer& server;
130}; 130};
131 131
132class ISystemDisplayService final : public ServiceFramework<ISystemDisplayService> { 132class ISystemDisplayService final : public ServiceFramework<ISystemDisplayService> {
@@ -186,7 +186,7 @@ public:
186 } 186 }
187 187
188private: 188private:
189 void SetLayerZ(Kernel::HLERequestContext& ctx) { 189 void SetLayerZ(HLERequestContext& ctx) {
190 IPC::RequestParser rp{ctx}; 190 IPC::RequestParser rp{ctx};
191 const u64 layer_id = rp.Pop<u64>(); 191 const u64 layer_id = rp.Pop<u64>();
192 const u64 z_value = rp.Pop<u64>(); 192 const u64 z_value = rp.Pop<u64>();
@@ -200,7 +200,7 @@ private:
200 200
201 // This function currently does nothing but return a success error code in 201 // This function currently does nothing but return a success error code in
202 // the vi library itself, so do the same thing, but log out the passed in values. 202 // the vi library itself, so do the same thing, but log out the passed in values.
203 void SetLayerVisibility(Kernel::HLERequestContext& ctx) { 203 void SetLayerVisibility(HLERequestContext& ctx) {
204 IPC::RequestParser rp{ctx}; 204 IPC::RequestParser rp{ctx};
205 const u64 layer_id = rp.Pop<u64>(); 205 const u64 layer_id = rp.Pop<u64>();
206 const bool visibility = rp.Pop<bool>(); 206 const bool visibility = rp.Pop<bool>();
@@ -211,7 +211,7 @@ private:
211 rb.Push(ResultSuccess); 211 rb.Push(ResultSuccess);
212 } 212 }
213 213
214 void GetDisplayMode(Kernel::HLERequestContext& ctx) { 214 void GetDisplayMode(HLERequestContext& ctx) {
215 LOG_WARNING(Service_VI, "(STUBBED) called"); 215 LOG_WARNING(Service_VI, "(STUBBED) called");
216 216
217 IPC::ResponseBuilder rb{ctx, 6}; 217 IPC::ResponseBuilder rb{ctx, 6};
@@ -232,7 +232,7 @@ private:
232 232
233class IManagerDisplayService final : public ServiceFramework<IManagerDisplayService> { 233class IManagerDisplayService final : public ServiceFramework<IManagerDisplayService> {
234public: 234public:
235 explicit IManagerDisplayService(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_) 235 explicit IManagerDisplayService(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_)
236 : ServiceFramework{system_, "IManagerDisplayService"}, nv_flinger{nv_flinger_} { 236 : ServiceFramework{system_, "IManagerDisplayService"}, nv_flinger{nv_flinger_} {
237 // clang-format off 237 // clang-format off
238 static const FunctionInfo functions[] = { 238 static const FunctionInfo functions[] = {
@@ -325,7 +325,7 @@ public:
325 } 325 }
326 326
327private: 327private:
328 void CloseDisplay(Kernel::HLERequestContext& ctx) { 328 void CloseDisplay(HLERequestContext& ctx) {
329 IPC::RequestParser rp{ctx}; 329 IPC::RequestParser rp{ctx};
330 const u64 display = rp.Pop<u64>(); 330 const u64 display = rp.Pop<u64>();
331 331
@@ -335,7 +335,7 @@ private:
335 rb.Push(rc); 335 rb.Push(rc);
336 } 336 }
337 337
338 void CreateManagedLayer(Kernel::HLERequestContext& ctx) { 338 void CreateManagedLayer(HLERequestContext& ctx) {
339 IPC::RequestParser rp{ctx}; 339 IPC::RequestParser rp{ctx};
340 const u32 unknown = rp.Pop<u32>(); 340 const u32 unknown = rp.Pop<u32>();
341 rp.Skip(1, false); 341 rp.Skip(1, false);
@@ -359,7 +359,7 @@ private:
359 rb.Push(*layer_id); 359 rb.Push(*layer_id);
360 } 360 }
361 361
362 void AddToLayerStack(Kernel::HLERequestContext& ctx) { 362 void AddToLayerStack(HLERequestContext& ctx) {
363 IPC::RequestParser rp{ctx}; 363 IPC::RequestParser rp{ctx};
364 const u32 stack = rp.Pop<u32>(); 364 const u32 stack = rp.Pop<u32>();
365 const u64 layer_id = rp.Pop<u64>(); 365 const u64 layer_id = rp.Pop<u64>();
@@ -371,7 +371,7 @@ private:
371 rb.Push(ResultSuccess); 371 rb.Push(ResultSuccess);
372 } 372 }
373 373
374 void SetLayerVisibility(Kernel::HLERequestContext& ctx) { 374 void SetLayerVisibility(HLERequestContext& ctx) {
375 IPC::RequestParser rp{ctx}; 375 IPC::RequestParser rp{ctx};
376 const u64 layer_id = rp.Pop<u64>(); 376 const u64 layer_id = rp.Pop<u64>();
377 const bool visibility = rp.Pop<bool>(); 377 const bool visibility = rp.Pop<bool>();
@@ -383,13 +383,13 @@ private:
383 rb.Push(ResultSuccess); 383 rb.Push(ResultSuccess);
384 } 384 }
385 385
386 NVFlinger::NVFlinger& nv_flinger; 386 Nvnflinger::Nvnflinger& nv_flinger;
387}; 387};
388 388
389class IApplicationDisplayService final : public ServiceFramework<IApplicationDisplayService> { 389class IApplicationDisplayService final : public ServiceFramework<IApplicationDisplayService> {
390public: 390public:
391 IApplicationDisplayService(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_, 391 IApplicationDisplayService(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_,
392 NVFlinger::HosBinderDriverServer& hos_binder_driver_server_) 392 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_)
393 : ServiceFramework{system_, "IApplicationDisplayService"}, nv_flinger{nv_flinger_}, 393 : ServiceFramework{system_, "IApplicationDisplayService"}, nv_flinger{nv_flinger_},
394 hos_binder_driver_server{hos_binder_driver_server_} { 394 hos_binder_driver_server{hos_binder_driver_server_} {
395 395
@@ -440,7 +440,7 @@ private:
440 PreserveAspectRatio = 4, 440 PreserveAspectRatio = 4,
441 }; 441 };
442 442
443 void GetRelayService(Kernel::HLERequestContext& ctx) { 443 void GetRelayService(HLERequestContext& ctx) {
444 LOG_WARNING(Service_VI, "(STUBBED) called"); 444 LOG_WARNING(Service_VI, "(STUBBED) called");
445 445
446 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 446 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -448,7 +448,7 @@ private:
448 rb.PushIpcInterface<IHOSBinderDriver>(system, hos_binder_driver_server); 448 rb.PushIpcInterface<IHOSBinderDriver>(system, hos_binder_driver_server);
449 } 449 }
450 450
451 void GetSystemDisplayService(Kernel::HLERequestContext& ctx) { 451 void GetSystemDisplayService(HLERequestContext& ctx) {
452 LOG_WARNING(Service_VI, "(STUBBED) called"); 452 LOG_WARNING(Service_VI, "(STUBBED) called");
453 453
454 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 454 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -456,7 +456,7 @@ private:
456 rb.PushIpcInterface<ISystemDisplayService>(system); 456 rb.PushIpcInterface<ISystemDisplayService>(system);
457 } 457 }
458 458
459 void GetManagerDisplayService(Kernel::HLERequestContext& ctx) { 459 void GetManagerDisplayService(HLERequestContext& ctx) {
460 LOG_WARNING(Service_VI, "(STUBBED) called"); 460 LOG_WARNING(Service_VI, "(STUBBED) called");
461 461
462 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 462 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -464,7 +464,7 @@ private:
464 rb.PushIpcInterface<IManagerDisplayService>(system, nv_flinger); 464 rb.PushIpcInterface<IManagerDisplayService>(system, nv_flinger);
465 } 465 }
466 466
467 void GetIndirectDisplayTransactionService(Kernel::HLERequestContext& ctx) { 467 void GetIndirectDisplayTransactionService(HLERequestContext& ctx) {
468 LOG_WARNING(Service_VI, "(STUBBED) called"); 468 LOG_WARNING(Service_VI, "(STUBBED) called");
469 469
470 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 470 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -472,7 +472,7 @@ private:
472 rb.PushIpcInterface<IHOSBinderDriver>(system, hos_binder_driver_server); 472 rb.PushIpcInterface<IHOSBinderDriver>(system, hos_binder_driver_server);
473 } 473 }
474 474
475 void OpenDisplay(Kernel::HLERequestContext& ctx) { 475 void OpenDisplay(HLERequestContext& ctx) {
476 LOG_WARNING(Service_VI, "(STUBBED) called"); 476 LOG_WARNING(Service_VI, "(STUBBED) called");
477 477
478 IPC::RequestParser rp{ctx}; 478 IPC::RequestParser rp{ctx};
@@ -481,13 +481,13 @@ private:
481 OpenDisplayImpl(ctx, std::string_view{name_buf.data(), name_buf.size()}); 481 OpenDisplayImpl(ctx, std::string_view{name_buf.data(), name_buf.size()});
482 } 482 }
483 483
484 void OpenDefaultDisplay(Kernel::HLERequestContext& ctx) { 484 void OpenDefaultDisplay(HLERequestContext& ctx) {
485 LOG_DEBUG(Service_VI, "called"); 485 LOG_DEBUG(Service_VI, "called");
486 486
487 OpenDisplayImpl(ctx, "Default"); 487 OpenDisplayImpl(ctx, "Default");
488 } 488 }
489 489
490 void OpenDisplayImpl(Kernel::HLERequestContext& ctx, std::string_view name) { 490 void OpenDisplayImpl(HLERequestContext& ctx, std::string_view name) {
491 const auto trim_pos = name.find('\0'); 491 const auto trim_pos = name.find('\0');
492 492
493 if (trim_pos != std::string_view::npos) { 493 if (trim_pos != std::string_view::npos) {
@@ -509,7 +509,7 @@ private:
509 rb.Push<u64>(*display_id); 509 rb.Push<u64>(*display_id);
510 } 510 }
511 511
512 void CloseDisplay(Kernel::HLERequestContext& ctx) { 512 void CloseDisplay(HLERequestContext& ctx) {
513 IPC::RequestParser rp{ctx}; 513 IPC::RequestParser rp{ctx};
514 const u64 display_id = rp.Pop<u64>(); 514 const u64 display_id = rp.Pop<u64>();
515 515
@@ -521,14 +521,14 @@ private:
521 521
522 // This literally does nothing internally in the actual service itself, 522 // This literally does nothing internally in the actual service itself,
523 // and just returns a successful result code regardless of the input. 523 // and just returns a successful result code regardless of the input.
524 void SetDisplayEnabled(Kernel::HLERequestContext& ctx) { 524 void SetDisplayEnabled(HLERequestContext& ctx) {
525 LOG_DEBUG(Service_VI, "called."); 525 LOG_DEBUG(Service_VI, "called.");
526 526
527 IPC::ResponseBuilder rb{ctx, 2}; 527 IPC::ResponseBuilder rb{ctx, 2};
528 rb.Push(ResultSuccess); 528 rb.Push(ResultSuccess);
529 } 529 }
530 530
531 void GetDisplayResolution(Kernel::HLERequestContext& ctx) { 531 void GetDisplayResolution(HLERequestContext& ctx) {
532 IPC::RequestParser rp{ctx}; 532 IPC::RequestParser rp{ctx};
533 const u64 display_id = rp.Pop<u64>(); 533 const u64 display_id = rp.Pop<u64>();
534 534
@@ -544,7 +544,7 @@ private:
544 rb.Push(static_cast<u64>(DisplayResolution::UndockedHeight)); 544 rb.Push(static_cast<u64>(DisplayResolution::UndockedHeight));
545 } 545 }
546 546
547 void SetLayerScalingMode(Kernel::HLERequestContext& ctx) { 547 void SetLayerScalingMode(HLERequestContext& ctx) {
548 IPC::RequestParser rp{ctx}; 548 IPC::RequestParser rp{ctx};
549 const auto scaling_mode = rp.PopEnum<NintendoScaleMode>(); 549 const auto scaling_mode = rp.PopEnum<NintendoScaleMode>();
550 const u64 unknown = rp.Pop<u64>(); 550 const u64 unknown = rp.Pop<u64>();
@@ -570,7 +570,7 @@ private:
570 rb.Push(ResultSuccess); 570 rb.Push(ResultSuccess);
571 } 571 }
572 572
573 void ListDisplays(Kernel::HLERequestContext& ctx) { 573 void ListDisplays(HLERequestContext& ctx) {
574 LOG_WARNING(Service_VI, "(STUBBED) called"); 574 LOG_WARNING(Service_VI, "(STUBBED) called");
575 575
576 const DisplayInfo display_info; 576 const DisplayInfo display_info;
@@ -580,7 +580,7 @@ private:
580 rb.Push<u64>(1); 580 rb.Push<u64>(1);
581 } 581 }
582 582
583 void OpenLayer(Kernel::HLERequestContext& ctx) { 583 void OpenLayer(HLERequestContext& ctx) {
584 IPC::RequestParser rp{ctx}; 584 IPC::RequestParser rp{ctx};
585 const auto name_buf = rp.PopRaw<std::array<u8, 0x40>>(); 585 const auto name_buf = rp.PopRaw<std::array<u8, 0x40>>();
586 const auto end = std::find(name_buf.begin(), name_buf.end(), '\0'); 586 const auto end = std::find(name_buf.begin(), name_buf.end(), '\0');
@@ -616,7 +616,7 @@ private:
616 rb.Push<u64>(buffer_size); 616 rb.Push<u64>(buffer_size);
617 } 617 }
618 618
619 void CloseLayer(Kernel::HLERequestContext& ctx) { 619 void CloseLayer(HLERequestContext& ctx) {
620 IPC::RequestParser rp{ctx}; 620 IPC::RequestParser rp{ctx};
621 const auto layer_id{rp.Pop<u64>()}; 621 const auto layer_id{rp.Pop<u64>()};
622 622
@@ -628,7 +628,7 @@ private:
628 rb.Push(ResultSuccess); 628 rb.Push(ResultSuccess);
629 } 629 }
630 630
631 void CreateStrayLayer(Kernel::HLERequestContext& ctx) { 631 void CreateStrayLayer(HLERequestContext& ctx) {
632 IPC::RequestParser rp{ctx}; 632 IPC::RequestParser rp{ctx};
633 const u32 flags = rp.Pop<u32>(); 633 const u32 flags = rp.Pop<u32>();
634 rp.Pop<u32>(); // padding 634 rp.Pop<u32>(); // padding
@@ -663,7 +663,7 @@ private:
663 rb.Push<u64>(buffer_size); 663 rb.Push<u64>(buffer_size);
664 } 664 }
665 665
666 void DestroyStrayLayer(Kernel::HLERequestContext& ctx) { 666 void DestroyStrayLayer(HLERequestContext& ctx) {
667 IPC::RequestParser rp{ctx}; 667 IPC::RequestParser rp{ctx};
668 const u64 layer_id = rp.Pop<u64>(); 668 const u64 layer_id = rp.Pop<u64>();
669 669
@@ -673,7 +673,7 @@ private:
673 rb.Push(ResultSuccess); 673 rb.Push(ResultSuccess);
674 } 674 }
675 675
676 void GetDisplayVsyncEvent(Kernel::HLERequestContext& ctx) { 676 void GetDisplayVsyncEvent(HLERequestContext& ctx) {
677 IPC::RequestParser rp{ctx}; 677 IPC::RequestParser rp{ctx};
678 const u64 display_id = rp.Pop<u64>(); 678 const u64 display_id = rp.Pop<u64>();
679 679
@@ -696,7 +696,7 @@ private:
696 rb.PushCopyObjects(*vsync_event); 696 rb.PushCopyObjects(*vsync_event);
697 } 697 }
698 698
699 void ConvertScalingMode(Kernel::HLERequestContext& ctx) { 699 void ConvertScalingMode(HLERequestContext& ctx) {
700 IPC::RequestParser rp{ctx}; 700 IPC::RequestParser rp{ctx};
701 const auto mode = rp.PopEnum<NintendoScaleMode>(); 701 const auto mode = rp.PopEnum<NintendoScaleMode>();
702 LOG_DEBUG(Service_VI, "called mode={}", mode); 702 LOG_DEBUG(Service_VI, "called mode={}", mode);
@@ -713,7 +713,7 @@ private:
713 } 713 }
714 } 714 }
715 715
716 void GetIndirectLayerImageMap(Kernel::HLERequestContext& ctx) { 716 void GetIndirectLayerImageMap(HLERequestContext& ctx) {
717 IPC::RequestParser rp{ctx}; 717 IPC::RequestParser rp{ctx};
718 const auto width = rp.Pop<s64>(); 718 const auto width = rp.Pop<s64>();
719 const auto height = rp.Pop<s64>(); 719 const auto height = rp.Pop<s64>();
@@ -739,7 +739,7 @@ private:
739 rb.Push(ResultSuccess); 739 rb.Push(ResultSuccess);
740 } 740 }
741 741
742 void GetIndirectLayerImageRequiredMemoryInfo(Kernel::HLERequestContext& ctx) { 742 void GetIndirectLayerImageRequiredMemoryInfo(HLERequestContext& ctx) {
743 IPC::RequestParser rp{ctx}; 743 IPC::RequestParser rp{ctx};
744 const auto width = rp.Pop<u64>(); 744 const auto width = rp.Pop<u64>();
745 const auto height = rp.Pop<u64>(); 745 const auto height = rp.Pop<u64>();
@@ -774,8 +774,8 @@ private:
774 } 774 }
775 } 775 }
776 776
777 NVFlinger::NVFlinger& nv_flinger; 777 Nvnflinger::Nvnflinger& nv_flinger;
778 NVFlinger::HosBinderDriverServer& hos_binder_driver_server; 778 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server;
779}; 779};
780 780
781static bool IsValidServiceAccess(Permission permission, Policy policy) { 781static bool IsValidServiceAccess(Permission permission, Policy policy) {
@@ -790,9 +790,9 @@ static bool IsValidServiceAccess(Permission permission, Policy policy) {
790 return false; 790 return false;
791} 791}
792 792
793void detail::GetDisplayServiceImpl(Kernel::HLERequestContext& ctx, Core::System& system, 793void detail::GetDisplayServiceImpl(HLERequestContext& ctx, Core::System& system,
794 NVFlinger::NVFlinger& nv_flinger, 794 Nvnflinger::Nvnflinger& nv_flinger,
795 NVFlinger::HosBinderDriverServer& hos_binder_driver_server, 795 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server,
796 Permission permission) { 796 Permission permission) {
797 IPC::RequestParser rp{ctx}; 797 IPC::RequestParser rp{ctx};
798 const auto policy = rp.PopEnum<Policy>(); 798 const auto policy = rp.PopEnum<Policy>();
@@ -809,8 +809,8 @@ void detail::GetDisplayServiceImpl(Kernel::HLERequestContext& ctx, Core::System&
809 rb.PushIpcInterface<IApplicationDisplayService>(system, nv_flinger, hos_binder_driver_server); 809 rb.PushIpcInterface<IApplicationDisplayService>(system, nv_flinger, hos_binder_driver_server);
810} 810}
811 811
812void LoopProcess(Core::System& system, NVFlinger::NVFlinger& nv_flinger, 812void LoopProcess(Core::System& system, Nvnflinger::Nvnflinger& nv_flinger,
813 NVFlinger::HosBinderDriverServer& hos_binder_driver_server) { 813 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server) {
814 auto server_manager = std::make_unique<ServerManager>(system); 814 auto server_manager = std::make_unique<ServerManager>(system);
815 815
816 server_manager->RegisterNamedService( 816 server_manager->RegisterNamedService(
diff --git a/src/core/hle/service/vi/vi.h b/src/core/hle/service/vi/vi.h
index 4ed7aaf2b..a35b62f97 100644
--- a/src/core/hle/service/vi/vi.h
+++ b/src/core/hle/service/vi/vi.h
@@ -9,14 +9,14 @@ namespace Core {
9class System; 9class System;
10} 10}
11 11
12namespace Kernel { 12namespace Service {
13class HLERequestContext; 13class HLERequestContext;
14} 14}
15 15
16namespace Service::NVFlinger { 16namespace Service::Nvnflinger {
17class HosBinderDriverServer; 17class HosBinderDriverServer;
18class NVFlinger; 18class Nvnflinger;
19} // namespace Service::NVFlinger 19} // namespace Service::Nvnflinger
20 20
21namespace Service::VI { 21namespace Service::VI {
22 22
@@ -42,13 +42,13 @@ enum class Policy {
42}; 42};
43 43
44namespace detail { 44namespace detail {
45void GetDisplayServiceImpl(Kernel::HLERequestContext& ctx, Core::System& system, 45void GetDisplayServiceImpl(HLERequestContext& ctx, Core::System& system,
46 NVFlinger::NVFlinger& nv_flinger, 46 Nvnflinger::Nvnflinger& nv_flinger,
47 NVFlinger::HosBinderDriverServer& hos_binder_driver_server, 47 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server,
48 Permission permission); 48 Permission permission);
49} // namespace detail 49} // namespace detail
50 50
51void LoopProcess(Core::System& system, NVFlinger::NVFlinger& nv_flinger, 51void LoopProcess(Core::System& system, Nvnflinger::Nvnflinger& nv_flinger,
52 NVFlinger::HosBinderDriverServer& hos_binder_driver_server); 52 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server);
53 53
54} // namespace Service::VI 54} // namespace Service::VI
diff --git a/src/core/hle/service/vi/vi_m.cpp b/src/core/hle/service/vi/vi_m.cpp
index 7ca44354b..0f06dc2f3 100644
--- a/src/core/hle/service/vi/vi_m.cpp
+++ b/src/core/hle/service/vi/vi_m.cpp
@@ -7,8 +7,8 @@
7 7
8namespace Service::VI { 8namespace Service::VI {
9 9
10VI_M::VI_M(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_, 10VI_M::VI_M(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_,
11 NVFlinger::HosBinderDriverServer& hos_binder_driver_server_) 11 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_)
12 : ServiceFramework{system_, "vi:m"}, nv_flinger{nv_flinger_}, hos_binder_driver_server{ 12 : ServiceFramework{system_, "vi:m"}, nv_flinger{nv_flinger_}, hos_binder_driver_server{
13 hos_binder_driver_server_} { 13 hos_binder_driver_server_} {
14 static const FunctionInfo functions[] = { 14 static const FunctionInfo functions[] = {
@@ -24,7 +24,7 @@ VI_M::VI_M(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_,
24 24
25VI_M::~VI_M() = default; 25VI_M::~VI_M() = default;
26 26
27void VI_M::GetDisplayService(Kernel::HLERequestContext& ctx) { 27void VI_M::GetDisplayService(HLERequestContext& ctx) {
28 LOG_DEBUG(Service_VI, "called"); 28 LOG_DEBUG(Service_VI, "called");
29 29
30 detail::GetDisplayServiceImpl(ctx, system, nv_flinger, hos_binder_driver_server, 30 detail::GetDisplayServiceImpl(ctx, system, nv_flinger, hos_binder_driver_server,
diff --git a/src/core/hle/service/vi/vi_m.h b/src/core/hle/service/vi/vi_m.h
index 3bf76d439..9ca6f3905 100644
--- a/src/core/hle/service/vi/vi_m.h
+++ b/src/core/hle/service/vi/vi_m.h
@@ -9,28 +9,24 @@ namespace Core {
9class System; 9class System;
10} 10}
11 11
12namespace Kernel { 12namespace Service::Nvnflinger {
13class HLERequestContext;
14}
15
16namespace Service::NVFlinger {
17class HosBinderDriverServer; 13class HosBinderDriverServer;
18class NVFlinger; 14class Nvnflinger;
19} // namespace Service::NVFlinger 15} // namespace Service::Nvnflinger
20 16
21namespace Service::VI { 17namespace Service::VI {
22 18
23class VI_M final : public ServiceFramework<VI_M> { 19class VI_M final : public ServiceFramework<VI_M> {
24public: 20public:
25 explicit VI_M(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_, 21 explicit VI_M(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_,
26 NVFlinger::HosBinderDriverServer& hos_binder_driver_server_); 22 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_);
27 ~VI_M() override; 23 ~VI_M() override;
28 24
29private: 25private:
30 void GetDisplayService(Kernel::HLERequestContext& ctx); 26 void GetDisplayService(HLERequestContext& ctx);
31 27
32 NVFlinger::NVFlinger& nv_flinger; 28 Nvnflinger::Nvnflinger& nv_flinger;
33 NVFlinger::HosBinderDriverServer& hos_binder_driver_server; 29 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server;
34}; 30};
35 31
36} // namespace Service::VI 32} // namespace Service::VI
diff --git a/src/core/hle/service/vi/vi_s.cpp b/src/core/hle/service/vi/vi_s.cpp
index fd799dac1..77f7a88ff 100644
--- a/src/core/hle/service/vi/vi_s.cpp
+++ b/src/core/hle/service/vi/vi_s.cpp
@@ -7,8 +7,8 @@
7 7
8namespace Service::VI { 8namespace Service::VI {
9 9
10VI_S::VI_S(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_, 10VI_S::VI_S(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_,
11 NVFlinger::HosBinderDriverServer& hos_binder_driver_server_) 11 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_)
12 : ServiceFramework{system_, "vi:s"}, nv_flinger{nv_flinger_}, hos_binder_driver_server{ 12 : ServiceFramework{system_, "vi:s"}, nv_flinger{nv_flinger_}, hos_binder_driver_server{
13 hos_binder_driver_server_} { 13 hos_binder_driver_server_} {
14 static const FunctionInfo functions[] = { 14 static const FunctionInfo functions[] = {
@@ -20,7 +20,7 @@ VI_S::VI_S(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_,
20 20
21VI_S::~VI_S() = default; 21VI_S::~VI_S() = default;
22 22
23void VI_S::GetDisplayService(Kernel::HLERequestContext& ctx) { 23void VI_S::GetDisplayService(HLERequestContext& ctx) {
24 LOG_DEBUG(Service_VI, "called"); 24 LOG_DEBUG(Service_VI, "called");
25 25
26 detail::GetDisplayServiceImpl(ctx, system, nv_flinger, hos_binder_driver_server, 26 detail::GetDisplayServiceImpl(ctx, system, nv_flinger, hos_binder_driver_server,
diff --git a/src/core/hle/service/vi/vi_s.h b/src/core/hle/service/vi/vi_s.h
index 97503ac7f..157839c91 100644
--- a/src/core/hle/service/vi/vi_s.h
+++ b/src/core/hle/service/vi/vi_s.h
@@ -9,28 +9,24 @@ namespace Core {
9class System; 9class System;
10} 10}
11 11
12namespace Kernel { 12namespace Service::Nvnflinger {
13class HLERequestContext;
14}
15
16namespace Service::NVFlinger {
17class HosBinderDriverServer; 13class HosBinderDriverServer;
18class NVFlinger; 14class Nvnflinger;
19} // namespace Service::NVFlinger 15} // namespace Service::Nvnflinger
20 16
21namespace Service::VI { 17namespace Service::VI {
22 18
23class VI_S final : public ServiceFramework<VI_S> { 19class VI_S final : public ServiceFramework<VI_S> {
24public: 20public:
25 explicit VI_S(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_, 21 explicit VI_S(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_,
26 NVFlinger::HosBinderDriverServer& hos_binder_driver_server_); 22 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_);
27 ~VI_S() override; 23 ~VI_S() override;
28 24
29private: 25private:
30 void GetDisplayService(Kernel::HLERequestContext& ctx); 26 void GetDisplayService(HLERequestContext& ctx);
31 27
32 NVFlinger::NVFlinger& nv_flinger; 28 Nvnflinger::Nvnflinger& nv_flinger;
33 NVFlinger::HosBinderDriverServer& hos_binder_driver_server; 29 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server;
34}; 30};
35 31
36} // namespace Service::VI 32} // namespace Service::VI
diff --git a/src/core/hle/service/vi/vi_u.cpp b/src/core/hle/service/vi/vi_u.cpp
index 6cc54bd13..59e13c86b 100644
--- a/src/core/hle/service/vi/vi_u.cpp
+++ b/src/core/hle/service/vi/vi_u.cpp
@@ -7,8 +7,8 @@
7 7
8namespace Service::VI { 8namespace Service::VI {
9 9
10VI_U::VI_U(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_, 10VI_U::VI_U(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_,
11 NVFlinger::HosBinderDriverServer& hos_binder_driver_server_) 11 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_)
12 : ServiceFramework{system_, "vi:u"}, nv_flinger{nv_flinger_}, hos_binder_driver_server{ 12 : ServiceFramework{system_, "vi:u"}, nv_flinger{nv_flinger_}, hos_binder_driver_server{
13 hos_binder_driver_server_} { 13 hos_binder_driver_server_} {
14 static const FunctionInfo functions[] = { 14 static const FunctionInfo functions[] = {
@@ -20,7 +20,7 @@ VI_U::VI_U(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_,
20 20
21VI_U::~VI_U() = default; 21VI_U::~VI_U() = default;
22 22
23void VI_U::GetDisplayService(Kernel::HLERequestContext& ctx) { 23void VI_U::GetDisplayService(HLERequestContext& ctx) {
24 LOG_DEBUG(Service_VI, "called"); 24 LOG_DEBUG(Service_VI, "called");
25 25
26 detail::GetDisplayServiceImpl(ctx, system, nv_flinger, hos_binder_driver_server, 26 detail::GetDisplayServiceImpl(ctx, system, nv_flinger, hos_binder_driver_server,
diff --git a/src/core/hle/service/vi/vi_u.h b/src/core/hle/service/vi/vi_u.h
index 797941bd7..5d9ca54c6 100644
--- a/src/core/hle/service/vi/vi_u.h
+++ b/src/core/hle/service/vi/vi_u.h
@@ -9,28 +9,24 @@ namespace Core {
9class System; 9class System;
10} 10}
11 11
12namespace Kernel { 12namespace Service::Nvnflinger {
13class HLERequestContext;
14}
15
16namespace Service::NVFlinger {
17class HosBinderDriverServer; 13class HosBinderDriverServer;
18class NVFlinger; 14class Nvnflinger;
19} // namespace Service::NVFlinger 15} // namespace Service::Nvnflinger
20 16
21namespace Service::VI { 17namespace Service::VI {
22 18
23class VI_U final : public ServiceFramework<VI_U> { 19class VI_U final : public ServiceFramework<VI_U> {
24public: 20public:
25 explicit VI_U(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_, 21 explicit VI_U(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_,
26 NVFlinger::HosBinderDriverServer& hos_binder_driver_server_); 22 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_);
27 ~VI_U() override; 23 ~VI_U() override;
28 24
29private: 25private:
30 void GetDisplayService(Kernel::HLERequestContext& ctx); 26 void GetDisplayService(HLERequestContext& ctx);
31 27
32 NVFlinger::NVFlinger& nv_flinger; 28 Nvnflinger::Nvnflinger& nv_flinger;
33 NVFlinger::HosBinderDriverServer& hos_binder_driver_server; 29 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server;
34}; 30};
35 31
36} // namespace Service::VI 32} // namespace Service::VI
diff --git a/src/core/reporter.cpp b/src/core/reporter.cpp
index 708ae17aa..004f2e57a 100644
--- a/src/core/reporter.cpp
+++ b/src/core/reporter.cpp
@@ -17,10 +17,10 @@
17#include "common/settings.h" 17#include "common/settings.h"
18#include "core/arm/arm_interface.h" 18#include "core/arm/arm_interface.h"
19#include "core/core.h" 19#include "core/core.h"
20#include "core/hle/kernel/hle_ipc.h"
21#include "core/hle/kernel/k_page_table.h" 20#include "core/hle/kernel/k_page_table.h"
22#include "core/hle/kernel/k_process.h" 21#include "core/hle/kernel/k_process.h"
23#include "core/hle/result.h" 22#include "core/hle/result.h"
23#include "core/hle/service/hle_ipc.h"
24#include "core/memory.h" 24#include "core/memory.h"
25#include "core/reporter.h" 25#include "core/reporter.h"
26 26
@@ -170,7 +170,7 @@ json GetHLEBufferDescriptorData(const std::vector<DescriptorType>& buffer,
170 return buffer_out; 170 return buffer_out;
171} 171}
172 172
173json GetHLERequestContextData(Kernel::HLERequestContext& ctx, Core::Memory::Memory& memory) { 173json GetHLERequestContextData(Service::HLERequestContext& ctx, Core::Memory::Memory& memory) {
174 json out; 174 json out;
175 175
176 auto cmd_buf = json::array(); 176 auto cmd_buf = json::array();
@@ -253,7 +253,7 @@ void Reporter::SaveSvcBreakReport(u32 type, bool signal_debugger, u64 info1, u64
253 SaveToFile(out, GetPath("svc_break_report", title_id, timestamp)); 253 SaveToFile(out, GetPath("svc_break_report", title_id, timestamp));
254} 254}
255 255
256void Reporter::SaveUnimplementedFunctionReport(Kernel::HLERequestContext& ctx, u32 command_id, 256void Reporter::SaveUnimplementedFunctionReport(Service::HLERequestContext& ctx, u32 command_id,
257 const std::string& name, 257 const std::string& name,
258 const std::string& service_name) const { 258 const std::string& service_name) const {
259 if (!IsReportingEnabled()) { 259 if (!IsReportingEnabled()) {
diff --git a/src/core/reporter.h b/src/core/reporter.h
index bb11f8e7c..db1ca3ba0 100644
--- a/src/core/reporter.h
+++ b/src/core/reporter.h
@@ -12,9 +12,9 @@
12 12
13union Result; 13union Result;
14 14
15namespace Kernel { 15namespace Service {
16class HLERequestContext; 16class HLERequestContext;
17} // namespace Kernel 17} // namespace Service
18 18
19namespace Service::LM { 19namespace Service::LM {
20struct LogMessage; 20struct LogMessage;
@@ -40,7 +40,7 @@ public:
40 const std::optional<std::vector<u8>>& resolved_buffer = {}) const; 40 const std::optional<std::vector<u8>>& resolved_buffer = {}) const;
41 41
42 // Used by HLE service handler 42 // Used by HLE service handler
43 void SaveUnimplementedFunctionReport(Kernel::HLERequestContext& ctx, u32 command_id, 43 void SaveUnimplementedFunctionReport(Service::HLERequestContext& ctx, u32 command_id,
44 const std::string& name, 44 const std::string& name,
45 const std::string& service_name) const; 45 const std::string& service_name) const;
46 46
diff --git a/src/input_common/helpers/joycon_protocol/joycon_types.h b/src/input_common/helpers/joycon_protocol/joycon_types.h
index b91934990..2e50a99a8 100644
--- a/src/input_common/helpers/joycon_protocol/joycon_types.h
+++ b/src/input_common/helpers/joycon_protocol/joycon_types.h
@@ -95,6 +95,18 @@ enum class PasivePadButton : u32 {
95 ZL_ZR = 0x8000, 95 ZL_ZR = 0x8000,
96}; 96};
97 97
98enum class PasivePadStick : u8 {
99 Right = 0x00,
100 RightDown = 0x01,
101 Down = 0x02,
102 DownLeft = 0x03,
103 Left = 0x04,
104 LeftUp = 0x05,
105 Up = 0x06,
106 UpRight = 0x07,
107 Neutral = 0x08,
108};
109
98enum class OutputReport : u8 { 110enum class OutputReport : u8 {
99 RUMBLE_AND_SUBCMD = 0x01, 111 RUMBLE_AND_SUBCMD = 0x01,
100 FW_UPDATE_PKT = 0x03, 112 FW_UPDATE_PKT = 0x03,
diff --git a/src/input_common/helpers/joycon_protocol/poller.cpp b/src/input_common/helpers/joycon_protocol/poller.cpp
index 9bb15e935..ab48352b8 100644
--- a/src/input_common/helpers/joycon_protocol/poller.cpp
+++ b/src/input_common/helpers/joycon_protocol/poller.cpp
@@ -12,7 +12,7 @@ JoyconPoller::JoyconPoller(ControllerType device_type_, JoyStickCalibration left
12 : device_type{device_type_}, left_stick_calibration{left_stick_calibration_}, 12 : device_type{device_type_}, left_stick_calibration{left_stick_calibration_},
13 right_stick_calibration{right_stick_calibration_}, motion_calibration{motion_calibration_} {} 13 right_stick_calibration{right_stick_calibration_}, motion_calibration{motion_calibration_} {}
14 14
15void JoyconPoller::SetCallbacks(const Joycon::JoyconCallbacks& callbacks_) { 15void JoyconPoller::SetCallbacks(const JoyconCallbacks& callbacks_) {
16 callbacks = std::move(callbacks_); 16 callbacks = std::move(callbacks_);
17} 17}
18 18
@@ -22,13 +22,13 @@ void JoyconPoller::ReadActiveMode(std::span<u8> buffer, const MotionStatus& moti
22 memcpy(&data, buffer.data(), sizeof(InputReportActive)); 22 memcpy(&data, buffer.data(), sizeof(InputReportActive));
23 23
24 switch (device_type) { 24 switch (device_type) {
25 case Joycon::ControllerType::Left: 25 case ControllerType::Left:
26 UpdateActiveLeftPadInput(data, motion_status); 26 UpdateActiveLeftPadInput(data, motion_status);
27 break; 27 break;
28 case Joycon::ControllerType::Right: 28 case ControllerType::Right:
29 UpdateActiveRightPadInput(data, motion_status); 29 UpdateActiveRightPadInput(data, motion_status);
30 break; 30 break;
31 case Joycon::ControllerType::Pro: 31 case ControllerType::Pro:
32 UpdateActiveProPadInput(data, motion_status); 32 UpdateActiveProPadInput(data, motion_status);
33 break; 33 break;
34 default: 34 default:
@@ -47,13 +47,13 @@ void JoyconPoller::ReadPassiveMode(std::span<u8> buffer) {
47 memcpy(&data, buffer.data(), sizeof(InputReportPassive)); 47 memcpy(&data, buffer.data(), sizeof(InputReportPassive));
48 48
49 switch (device_type) { 49 switch (device_type) {
50 case Joycon::ControllerType::Left: 50 case ControllerType::Left:
51 UpdatePasiveLeftPadInput(data); 51 UpdatePasiveLeftPadInput(data);
52 break; 52 break;
53 case Joycon::ControllerType::Right: 53 case ControllerType::Right:
54 UpdatePasiveRightPadInput(data); 54 UpdatePasiveRightPadInput(data);
55 break; 55 break;
56 case Joycon::ControllerType::Pro: 56 case ControllerType::Pro:
57 UpdatePasiveProPadInput(data); 57 UpdatePasiveProPadInput(data);
58 break; 58 break;
59 default: 59 default:
@@ -211,13 +211,11 @@ void JoyconPoller::UpdateActiveProPadInput(const InputReportActive& input,
211} 211}
212 212
213void JoyconPoller::UpdatePasiveLeftPadInput(const InputReportPassive& input) { 213void JoyconPoller::UpdatePasiveLeftPadInput(const InputReportPassive& input) {
214 static constexpr std::array<Joycon::PasivePadButton, 11> left_buttons{ 214 static constexpr std::array<PasivePadButton, 11> left_buttons{
215 Joycon::PasivePadButton::Down_A, Joycon::PasivePadButton::Right_X, 215 PasivePadButton::Down_A, PasivePadButton::Right_X, PasivePadButton::Left_B,
216 Joycon::PasivePadButton::Left_B, Joycon::PasivePadButton::Up_Y, 216 PasivePadButton::Up_Y, PasivePadButton::SL, PasivePadButton::SR,
217 Joycon::PasivePadButton::SL, Joycon::PasivePadButton::SR, 217 PasivePadButton::L_R, PasivePadButton::ZL_ZR, PasivePadButton::Minus,
218 Joycon::PasivePadButton::L_R, Joycon::PasivePadButton::ZL_ZR, 218 PasivePadButton::Capture, PasivePadButton::StickL,
219 Joycon::PasivePadButton::Minus, Joycon::PasivePadButton::Capture,
220 Joycon::PasivePadButton::StickL,
221 }; 219 };
222 220
223 for (auto left_button : left_buttons) { 221 for (auto left_button : left_buttons) {
@@ -225,16 +223,19 @@ void JoyconPoller::UpdatePasiveLeftPadInput(const InputReportPassive& input) {
225 const int button = static_cast<int>(left_button); 223 const int button = static_cast<int>(left_button);
226 callbacks.on_button_data(button, button_status); 224 callbacks.on_button_data(button, button_status);
227 } 225 }
226
227 const auto [left_axis_x, left_axis_y] =
228 GetPassiveAxisValue(static_cast<PasivePadStick>(input.stick_state));
229 callbacks.on_stick_data(static_cast<int>(PadAxes::LeftStickX), left_axis_x);
230 callbacks.on_stick_data(static_cast<int>(PadAxes::LeftStickY), left_axis_y);
228} 231}
229 232
230void JoyconPoller::UpdatePasiveRightPadInput(const InputReportPassive& input) { 233void JoyconPoller::UpdatePasiveRightPadInput(const InputReportPassive& input) {
231 static constexpr std::array<Joycon::PasivePadButton, 11> right_buttons{ 234 static constexpr std::array<PasivePadButton, 11> right_buttons{
232 Joycon::PasivePadButton::Down_A, Joycon::PasivePadButton::Right_X, 235 PasivePadButton::Down_A, PasivePadButton::Right_X, PasivePadButton::Left_B,
233 Joycon::PasivePadButton::Left_B, Joycon::PasivePadButton::Up_Y, 236 PasivePadButton::Up_Y, PasivePadButton::SL, PasivePadButton::SR,
234 Joycon::PasivePadButton::SL, Joycon::PasivePadButton::SR, 237 PasivePadButton::L_R, PasivePadButton::ZL_ZR, PasivePadButton::Plus,
235 Joycon::PasivePadButton::L_R, Joycon::PasivePadButton::ZL_ZR, 238 PasivePadButton::Home, PasivePadButton::StickR,
236 Joycon::PasivePadButton::Plus, Joycon::PasivePadButton::Home,
237 Joycon::PasivePadButton::StickR,
238 }; 239 };
239 240
240 for (auto right_button : right_buttons) { 241 for (auto right_button : right_buttons) {
@@ -242,17 +243,20 @@ void JoyconPoller::UpdatePasiveRightPadInput(const InputReportPassive& input) {
242 const int button = static_cast<int>(right_button); 243 const int button = static_cast<int>(right_button);
243 callbacks.on_button_data(button, button_status); 244 callbacks.on_button_data(button, button_status);
244 } 245 }
246
247 const auto [right_axis_x, right_axis_y] =
248 GetPassiveAxisValue(static_cast<PasivePadStick>(input.stick_state));
249 callbacks.on_stick_data(static_cast<int>(PadAxes::RightStickX), right_axis_x);
250 callbacks.on_stick_data(static_cast<int>(PadAxes::RightStickY), right_axis_y);
245} 251}
246 252
247void JoyconPoller::UpdatePasiveProPadInput(const InputReportPassive& input) { 253void JoyconPoller::UpdatePasiveProPadInput(const InputReportPassive& input) {
248 static constexpr std::array<Joycon::PasivePadButton, 14> pro_buttons{ 254 static constexpr std::array<PasivePadButton, 14> pro_buttons{
249 Joycon::PasivePadButton::Down_A, Joycon::PasivePadButton::Right_X, 255 PasivePadButton::Down_A, PasivePadButton::Right_X, PasivePadButton::Left_B,
250 Joycon::PasivePadButton::Left_B, Joycon::PasivePadButton::Up_Y, 256 PasivePadButton::Up_Y, PasivePadButton::SL, PasivePadButton::SR,
251 Joycon::PasivePadButton::SL, Joycon::PasivePadButton::SR, 257 PasivePadButton::L_R, PasivePadButton::ZL_ZR, PasivePadButton::Minus,
252 Joycon::PasivePadButton::L_R, Joycon::PasivePadButton::ZL_ZR, 258 PasivePadButton::Plus, PasivePadButton::Capture, PasivePadButton::Home,
253 Joycon::PasivePadButton::Minus, Joycon::PasivePadButton::Plus, 259 PasivePadButton::StickL, PasivePadButton::StickR,
254 Joycon::PasivePadButton::Capture, Joycon::PasivePadButton::Home,
255 Joycon::PasivePadButton::StickL, Joycon::PasivePadButton::StickR,
256 }; 260 };
257 261
258 for (auto pro_button : pro_buttons) { 262 for (auto pro_button : pro_buttons) {
@@ -260,6 +264,15 @@ void JoyconPoller::UpdatePasiveProPadInput(const InputReportPassive& input) {
260 const int button = static_cast<int>(pro_button); 264 const int button = static_cast<int>(pro_button);
261 callbacks.on_button_data(button, button_status); 265 callbacks.on_button_data(button, button_status);
262 } 266 }
267
268 const auto [left_axis_x, left_axis_y] =
269 GetPassiveAxisValue(static_cast<PasivePadStick>(input.stick_state && 0xf));
270 const auto [right_axis_x, right_axis_y] =
271 GetPassiveAxisValue(static_cast<PasivePadStick>(input.stick_state >> 4));
272 callbacks.on_stick_data(static_cast<int>(PadAxes::LeftStickX), left_axis_x);
273 callbacks.on_stick_data(static_cast<int>(PadAxes::LeftStickY), left_axis_y);
274 callbacks.on_stick_data(static_cast<int>(PadAxes::RightStickX), right_axis_x);
275 callbacks.on_stick_data(static_cast<int>(PadAxes::RightStickY), right_axis_y);
263} 276}
264 277
265f32 JoyconPoller::GetAxisValue(u16 raw_value, Joycon::JoyStickAxisCalibration calibration) const { 278f32 JoyconPoller::GetAxisValue(u16 raw_value, Joycon::JoyStickAxisCalibration calibration) const {
@@ -270,6 +283,30 @@ f32 JoyconPoller::GetAxisValue(u16 raw_value, Joycon::JoyStickAxisCalibration ca
270 return value / calibration.min; 283 return value / calibration.min;
271} 284}
272 285
286std::pair<f32, f32> JoyconPoller::GetPassiveAxisValue(PasivePadStick raw_value) const {
287 switch (raw_value) {
288 case PasivePadStick::Right:
289 return {1.0f, 0.0f};
290 case PasivePadStick::RightDown:
291 return {1.0f, -1.0f};
292 case PasivePadStick::Down:
293 return {0.0f, -1.0f};
294 case PasivePadStick::DownLeft:
295 return {-1.0f, -1.0f};
296 case PasivePadStick::Left:
297 return {-1.0f, 0.0f};
298 case PasivePadStick::LeftUp:
299 return {-1.0f, 1.0f};
300 case PasivePadStick::Up:
301 return {0.0f, 1.0f};
302 case PasivePadStick::UpRight:
303 return {1.0f, 1.0f};
304 case PasivePadStick::Neutral:
305 default:
306 return {0.0f, 0.0f};
307 }
308}
309
273f32 JoyconPoller::GetAccelerometerValue(s16 raw, const MotionSensorCalibration& cal, 310f32 JoyconPoller::GetAccelerometerValue(s16 raw, const MotionSensorCalibration& cal,
274 AccelerometerSensitivity sensitivity) const { 311 AccelerometerSensitivity sensitivity) const {
275 const f32 value = raw * (1.0f / (cal.scale - cal.offset)) * 4; 312 const f32 value = raw * (1.0f / (cal.scale - cal.offset)) * 4;
diff --git a/src/input_common/helpers/joycon_protocol/poller.h b/src/input_common/helpers/joycon_protocol/poller.h
index 354d41dad..5c897f070 100644
--- a/src/input_common/helpers/joycon_protocol/poller.h
+++ b/src/input_common/helpers/joycon_protocol/poller.h
@@ -22,7 +22,7 @@ public:
22 JoyStickCalibration right_stick_calibration_, 22 JoyStickCalibration right_stick_calibration_,
23 MotionCalibration motion_calibration_); 23 MotionCalibration motion_calibration_);
24 24
25 void SetCallbacks(const Joycon::JoyconCallbacks& callbacks_); 25 void SetCallbacks(const JoyconCallbacks& callbacks_);
26 26
27 /// Handles data from passive packages 27 /// Handles data from passive packages
28 void ReadPassiveMode(std::span<u8> buffer); 28 void ReadPassiveMode(std::span<u8> buffer);
@@ -51,7 +51,10 @@ private:
51 void UpdatePasiveProPadInput(const InputReportPassive& buffer); 51 void UpdatePasiveProPadInput(const InputReportPassive& buffer);
52 52
53 /// Returns a calibrated joystick axis from raw axis data 53 /// Returns a calibrated joystick axis from raw axis data
54 f32 GetAxisValue(u16 raw_value, Joycon::JoyStickAxisCalibration calibration) const; 54 f32 GetAxisValue(u16 raw_value, JoyStickAxisCalibration calibration) const;
55
56 /// Returns a digital joystick axis from passive axis data
57 std::pair<f32, f32> GetPassiveAxisValue(PasivePadStick raw_value) const;
55 58
56 /// Returns a calibrated accelerometer axis from raw motion data 59 /// Returns a calibrated accelerometer axis from raw motion data
57 f32 GetAccelerometerValue(s16 raw, const MotionSensorCalibration& cal, 60 f32 GetAccelerometerValue(s16 raw, const MotionSensorCalibration& cal,
@@ -75,7 +78,7 @@ private:
75 JoyStickCalibration right_stick_calibration{}; 78 JoyStickCalibration right_stick_calibration{};
76 MotionCalibration motion_calibration{}; 79 MotionCalibration motion_calibration{};
77 80
78 Joycon::JoyconCallbacks callbacks{}; 81 JoyconCallbacks callbacks{};
79}; 82};
80 83
81} // namespace InputCommon::Joycon 84} // namespace InputCommon::Joycon
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h
index 06fd40851..2a150ccdc 100644
--- a/src/video_core/buffer_cache/buffer_cache.h
+++ b/src/video_core/buffer_cache/buffer_cache.h
@@ -55,6 +55,19 @@ constexpr u32 NUM_STORAGE_BUFFERS = 16;
55constexpr u32 NUM_TEXTURE_BUFFERS = 16; 55constexpr u32 NUM_TEXTURE_BUFFERS = 16;
56constexpr u32 NUM_STAGES = 5; 56constexpr u32 NUM_STAGES = 5;
57 57
58enum class ObtainBufferSynchronize : u32 {
59 NoSynchronize = 0,
60 FullSynchronize = 1,
61 SynchronizeNoDirty = 2,
62};
63
64enum class ObtainBufferOperation : u32 {
65 DoNothing = 0,
66 MarkAsWritten = 1,
67 DiscardWrite = 2,
68 MarkQuery = 3,
69};
70
58using UniformBufferSizes = std::array<std::array<u32, NUM_GRAPHICS_UNIFORM_BUFFERS>, NUM_STAGES>; 71using UniformBufferSizes = std::array<std::array<u32, NUM_GRAPHICS_UNIFORM_BUFFERS>, NUM_STAGES>;
59using ComputeUniformBufferSizes = std::array<u32, NUM_COMPUTE_UNIFORM_BUFFERS>; 72using ComputeUniformBufferSizes = std::array<u32, NUM_COMPUTE_UNIFORM_BUFFERS>;
60 73
@@ -191,6 +204,10 @@ public:
191 204
192 bool DMAClear(GPUVAddr src_address, u64 amount, u32 value); 205 bool DMAClear(GPUVAddr src_address, u64 amount, u32 value);
193 206
207 [[nodiscard]] std::pair<Buffer*, u32> ObtainBuffer(GPUVAddr gpu_addr, u32 size,
208 ObtainBufferSynchronize sync_info,
209 ObtainBufferOperation post_op);
210
194 /// Return true when a CPU region is modified from the GPU 211 /// Return true when a CPU region is modified from the GPU
195 [[nodiscard]] bool IsRegionGpuModified(VAddr addr, size_t size); 212 [[nodiscard]] bool IsRegionGpuModified(VAddr addr, size_t size);
196 213
@@ -642,6 +659,42 @@ bool BufferCache<P>::DMAClear(GPUVAddr dst_address, u64 amount, u32 value) {
642} 659}
643 660
644template <class P> 661template <class P>
662std::pair<typename P::Buffer*, u32> BufferCache<P>::ObtainBuffer(GPUVAddr gpu_addr, u32 size,
663 ObtainBufferSynchronize sync_info,
664 ObtainBufferOperation post_op) {
665 const std::optional<VAddr> cpu_addr = gpu_memory->GpuToCpuAddress(gpu_addr);
666 if (!cpu_addr) {
667 return {&slot_buffers[NULL_BUFFER_ID], 0};
668 }
669 const BufferId buffer_id = FindBuffer(*cpu_addr, size);
670 Buffer& buffer = slot_buffers[buffer_id];
671
672 // synchronize op
673 switch (sync_info) {
674 case ObtainBufferSynchronize::FullSynchronize:
675 SynchronizeBuffer(buffer, *cpu_addr, size);
676 break;
677 default:
678 break;
679 }
680
681 switch (post_op) {
682 case ObtainBufferOperation::MarkAsWritten:
683 MarkWrittenBuffer(buffer_id, *cpu_addr, size);
684 break;
685 case ObtainBufferOperation::DiscardWrite: {
686 IntervalType interval{*cpu_addr, size};
687 ClearDownload(interval);
688 break;
689 }
690 default:
691 break;
692 }
693
694 return {&buffer, buffer.Offset(*cpu_addr)};
695}
696
697template <class P>
645void BufferCache<P>::BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr, 698void BufferCache<P>::BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr,
646 u32 size) { 699 u32 size) {
647 const std::optional<VAddr> cpu_addr = gpu_memory->GpuToCpuAddress(gpu_addr); 700 const std::optional<VAddr> cpu_addr = gpu_memory->GpuToCpuAddress(gpu_addr);
diff --git a/src/video_core/engines/maxwell_dma.cpp b/src/video_core/engines/maxwell_dma.cpp
index 7762c7d96..e68850dc5 100644
--- a/src/video_core/engines/maxwell_dma.cpp
+++ b/src/video_core/engines/maxwell_dma.cpp
@@ -14,7 +14,13 @@
14#include "video_core/textures/decoders.h" 14#include "video_core/textures/decoders.h"
15 15
16MICROPROFILE_DECLARE(GPU_DMAEngine); 16MICROPROFILE_DECLARE(GPU_DMAEngine);
17MICROPROFILE_DECLARE(GPU_DMAEngineBL);
18MICROPROFILE_DECLARE(GPU_DMAEngineLB);
19MICROPROFILE_DECLARE(GPU_DMAEngineBB);
17MICROPROFILE_DEFINE(GPU_DMAEngine, "GPU", "DMA Engine", MP_RGB(224, 224, 128)); 20MICROPROFILE_DEFINE(GPU_DMAEngine, "GPU", "DMA Engine", MP_RGB(224, 224, 128));
21MICROPROFILE_DEFINE(GPU_DMAEngineBL, "GPU", "DMA Engine Block - Linear", MP_RGB(224, 224, 128));
22MICROPROFILE_DEFINE(GPU_DMAEngineLB, "GPU", "DMA Engine Linear - Block", MP_RGB(224, 224, 128));
23MICROPROFILE_DEFINE(GPU_DMAEngineBB, "GPU", "DMA Engine Block - Block", MP_RGB(224, 224, 128));
18 24
19namespace Tegra::Engines { 25namespace Tegra::Engines {
20 26
@@ -72,6 +78,7 @@ void MaxwellDMA::Launch() {
72 memory_manager.FlushCaching(); 78 memory_manager.FlushCaching();
73 if (!is_src_pitch && !is_dst_pitch) { 79 if (!is_src_pitch && !is_dst_pitch) {
74 // If both the source and the destination are in block layout, assert. 80 // If both the source and the destination are in block layout, assert.
81 MICROPROFILE_SCOPE(GPU_DMAEngineBB);
75 CopyBlockLinearToBlockLinear(); 82 CopyBlockLinearToBlockLinear();
76 ReleaseSemaphore(); 83 ReleaseSemaphore();
77 return; 84 return;
@@ -87,8 +94,10 @@ void MaxwellDMA::Launch() {
87 } 94 }
88 } else { 95 } else {
89 if (!is_src_pitch && is_dst_pitch) { 96 if (!is_src_pitch && is_dst_pitch) {
97 MICROPROFILE_SCOPE(GPU_DMAEngineBL);
90 CopyBlockLinearToPitch(); 98 CopyBlockLinearToPitch();
91 } else { 99 } else {
100 MICROPROFILE_SCOPE(GPU_DMAEngineLB);
92 CopyPitchToBlockLinear(); 101 CopyPitchToBlockLinear();
93 } 102 }
94 } 103 }
@@ -153,21 +162,35 @@ void MaxwellDMA::Launch() {
153} 162}
154 163
155void MaxwellDMA::CopyBlockLinearToPitch() { 164void MaxwellDMA::CopyBlockLinearToPitch() {
156 UNIMPLEMENTED_IF(regs.src_params.block_size.width != 0); 165 UNIMPLEMENTED_IF(regs.launch_dma.remap_enable != 0);
157 UNIMPLEMENTED_IF(regs.src_params.layer != 0); 166
158 167 u32 bytes_per_pixel = 1;
159 const bool is_remapping = regs.launch_dma.remap_enable != 0; 168 DMA::ImageOperand src_operand;
160 169 src_operand.bytes_per_pixel = bytes_per_pixel;
161 // Optimized path for micro copies. 170 src_operand.params = regs.src_params;
162 const size_t dst_size = static_cast<size_t>(regs.pitch_out) * regs.line_count; 171 src_operand.address = regs.offset_in;
163 if (!is_remapping && dst_size < GOB_SIZE && regs.pitch_out <= GOB_SIZE_X && 172
164 regs.src_params.height > GOB_SIZE_Y) { 173 DMA::BufferOperand dst_operand;
165 FastCopyBlockLinearToPitch(); 174 dst_operand.pitch = regs.pitch_out;
175 dst_operand.width = regs.line_length_in;
176 dst_operand.height = regs.line_count;
177 dst_operand.address = regs.offset_out;
178 DMA::ImageCopy copy_info{};
179 copy_info.length_x = regs.line_length_in;
180 copy_info.length_y = regs.line_count;
181 auto& accelerate = rasterizer->AccessAccelerateDMA();
182 if (accelerate.ImageToBuffer(copy_info, src_operand, dst_operand)) {
166 return; 183 return;
167 } 184 }
168 185
186 UNIMPLEMENTED_IF(regs.src_params.block_size.width != 0);
187 UNIMPLEMENTED_IF(regs.src_params.block_size.depth != 0);
188 UNIMPLEMENTED_IF(regs.src_params.block_size.depth == 0 && regs.src_params.depth != 1);
189
169 // Deswizzle the input and copy it over. 190 // Deswizzle the input and copy it over.
170 const Parameters& src_params = regs.src_params; 191 const DMA::Parameters& src_params = regs.src_params;
192
193 const bool is_remapping = regs.launch_dma.remap_enable != 0;
171 194
172 const u32 num_remap_components = regs.remap_const.num_dst_components_minus_one + 1; 195 const u32 num_remap_components = regs.remap_const.num_dst_components_minus_one + 1;
173 const u32 remap_components_size = regs.remap_const.component_size_minus_one + 1; 196 const u32 remap_components_size = regs.remap_const.component_size_minus_one + 1;
@@ -187,7 +210,7 @@ void MaxwellDMA::CopyBlockLinearToPitch() {
187 x_offset >>= bpp_shift; 210 x_offset >>= bpp_shift;
188 } 211 }
189 212
190 const u32 bytes_per_pixel = base_bpp << bpp_shift; 213 bytes_per_pixel = base_bpp << bpp_shift;
191 const u32 height = src_params.height; 214 const u32 height = src_params.height;
192 const u32 depth = src_params.depth; 215 const u32 depth = src_params.depth;
193 const u32 block_height = src_params.block_size.height; 216 const u32 block_height = src_params.block_size.height;
@@ -195,11 +218,12 @@ void MaxwellDMA::CopyBlockLinearToPitch() {
195 const size_t src_size = 218 const size_t src_size =
196 CalculateSize(true, bytes_per_pixel, width, height, depth, block_height, block_depth); 219 CalculateSize(true, bytes_per_pixel, width, height, depth, block_height, block_depth);
197 220
221 const size_t dst_size = static_cast<size_t>(regs.pitch_out) * regs.line_count;
198 read_buffer.resize_destructive(src_size); 222 read_buffer.resize_destructive(src_size);
199 write_buffer.resize_destructive(dst_size); 223 write_buffer.resize_destructive(dst_size);
200 224
201 memory_manager.ReadBlock(regs.offset_in, read_buffer.data(), src_size); 225 memory_manager.ReadBlock(src_operand.address, read_buffer.data(), src_size);
202 memory_manager.ReadBlock(regs.offset_out, write_buffer.data(), dst_size); 226 memory_manager.ReadBlockUnsafe(dst_operand.address, write_buffer.data(), dst_size);
203 227
204 UnswizzleSubrect(write_buffer, read_buffer, bytes_per_pixel, width, height, depth, x_offset, 228 UnswizzleSubrect(write_buffer, read_buffer, bytes_per_pixel, width, height, depth, x_offset,
205 src_params.origin.y, x_elements, regs.line_count, block_height, block_depth, 229 src_params.origin.y, x_elements, regs.line_count, block_height, block_depth,
@@ -216,6 +240,24 @@ void MaxwellDMA::CopyPitchToBlockLinear() {
216 const u32 num_remap_components = regs.remap_const.num_dst_components_minus_one + 1; 240 const u32 num_remap_components = regs.remap_const.num_dst_components_minus_one + 1;
217 const u32 remap_components_size = regs.remap_const.component_size_minus_one + 1; 241 const u32 remap_components_size = regs.remap_const.component_size_minus_one + 1;
218 242
243 u32 bytes_per_pixel = 1;
244 DMA::ImageOperand dst_operand;
245 dst_operand.bytes_per_pixel = bytes_per_pixel;
246 dst_operand.params = regs.dst_params;
247 dst_operand.address = regs.offset_out;
248 DMA::BufferOperand src_operand;
249 src_operand.pitch = regs.pitch_in;
250 src_operand.width = regs.line_length_in;
251 src_operand.height = regs.line_count;
252 src_operand.address = regs.offset_in;
253 DMA::ImageCopy copy_info{};
254 copy_info.length_x = regs.line_length_in;
255 copy_info.length_y = regs.line_count;
256 auto& accelerate = rasterizer->AccessAccelerateDMA();
257 if (accelerate.BufferToImage(copy_info, src_operand, dst_operand)) {
258 return;
259 }
260
219 const auto& dst_params = regs.dst_params; 261 const auto& dst_params = regs.dst_params;
220 262
221 const u32 base_bpp = !is_remapping ? 1U : num_remap_components * remap_components_size; 263 const u32 base_bpp = !is_remapping ? 1U : num_remap_components * remap_components_size;
@@ -233,7 +275,7 @@ void MaxwellDMA::CopyPitchToBlockLinear() {
233 x_offset >>= bpp_shift; 275 x_offset >>= bpp_shift;
234 } 276 }
235 277
236 const u32 bytes_per_pixel = base_bpp << bpp_shift; 278 bytes_per_pixel = base_bpp << bpp_shift;
237 const u32 height = dst_params.height; 279 const u32 height = dst_params.height;
238 const u32 depth = dst_params.depth; 280 const u32 depth = dst_params.depth;
239 const u32 block_height = dst_params.block_size.height; 281 const u32 block_height = dst_params.block_size.height;
@@ -260,45 +302,14 @@ void MaxwellDMA::CopyPitchToBlockLinear() {
260 memory_manager.WriteBlockCached(regs.offset_out, write_buffer.data(), dst_size); 302 memory_manager.WriteBlockCached(regs.offset_out, write_buffer.data(), dst_size);
261} 303}
262 304
263void MaxwellDMA::FastCopyBlockLinearToPitch() {
264 const u32 bytes_per_pixel = 1U;
265 const size_t src_size = GOB_SIZE;
266 const size_t dst_size = static_cast<size_t>(regs.pitch_out) * regs.line_count;
267 u32 pos_x = regs.src_params.origin.x;
268 u32 pos_y = regs.src_params.origin.y;
269 const u64 offset = GetGOBOffset(regs.src_params.width, regs.src_params.height, pos_x, pos_y,
270 regs.src_params.block_size.height, bytes_per_pixel);
271 const u32 x_in_gob = 64 / bytes_per_pixel;
272 pos_x = pos_x % x_in_gob;
273 pos_y = pos_y % 8;
274
275 read_buffer.resize_destructive(src_size);
276 write_buffer.resize_destructive(dst_size);
277
278 if (Settings::IsGPULevelExtreme()) {
279 memory_manager.ReadBlock(regs.offset_in + offset, read_buffer.data(), src_size);
280 memory_manager.ReadBlock(regs.offset_out, write_buffer.data(), dst_size);
281 } else {
282 memory_manager.ReadBlockUnsafe(regs.offset_in + offset, read_buffer.data(), src_size);
283 memory_manager.ReadBlockUnsafe(regs.offset_out, write_buffer.data(), dst_size);
284 }
285
286 UnswizzleSubrect(write_buffer, read_buffer, bytes_per_pixel, regs.src_params.width,
287 regs.src_params.height, 1, pos_x, pos_y, regs.line_length_in, regs.line_count,
288 regs.src_params.block_size.height, regs.src_params.block_size.depth,
289 regs.pitch_out);
290
291 memory_manager.WriteBlockCached(regs.offset_out, write_buffer.data(), dst_size);
292}
293
294void MaxwellDMA::CopyBlockLinearToBlockLinear() { 305void MaxwellDMA::CopyBlockLinearToBlockLinear() {
295 UNIMPLEMENTED_IF(regs.src_params.block_size.width != 0); 306 UNIMPLEMENTED_IF(regs.src_params.block_size.width != 0);
296 307
297 const bool is_remapping = regs.launch_dma.remap_enable != 0; 308 const bool is_remapping = regs.launch_dma.remap_enable != 0;
298 309
299 // Deswizzle the input and copy it over. 310 // Deswizzle the input and copy it over.
300 const Parameters& src = regs.src_params; 311 const DMA::Parameters& src = regs.src_params;
301 const Parameters& dst = regs.dst_params; 312 const DMA::Parameters& dst = regs.dst_params;
302 313
303 const u32 num_remap_components = regs.remap_const.num_dst_components_minus_one + 1; 314 const u32 num_remap_components = regs.remap_const.num_dst_components_minus_one + 1;
304 const u32 remap_components_size = regs.remap_const.component_size_minus_one + 1; 315 const u32 remap_components_size = regs.remap_const.component_size_minus_one + 1;
diff --git a/src/video_core/engines/maxwell_dma.h b/src/video_core/engines/maxwell_dma.h
index 0e594fa74..69e26cb32 100644
--- a/src/video_core/engines/maxwell_dma.h
+++ b/src/video_core/engines/maxwell_dma.h
@@ -24,6 +24,54 @@ namespace VideoCore {
24class RasterizerInterface; 24class RasterizerInterface;
25} 25}
26 26
27namespace Tegra {
28namespace DMA {
29
30union Origin {
31 BitField<0, 16, u32> x;
32 BitField<16, 16, u32> y;
33};
34static_assert(sizeof(Origin) == 4);
35
36struct ImageCopy {
37 u32 length_x{};
38 u32 length_y{};
39};
40
41union BlockSize {
42 BitField<0, 4, u32> width;
43 BitField<4, 4, u32> height;
44 BitField<8, 4, u32> depth;
45 BitField<12, 4, u32> gob_height;
46};
47static_assert(sizeof(BlockSize) == 4);
48
49struct Parameters {
50 BlockSize block_size;
51 u32 width;
52 u32 height;
53 u32 depth;
54 u32 layer;
55 Origin origin;
56};
57static_assert(sizeof(Parameters) == 24);
58
59struct ImageOperand {
60 u32 bytes_per_pixel;
61 Parameters params;
62 GPUVAddr address;
63};
64
65struct BufferOperand {
66 u32 pitch;
67 u32 width;
68 u32 height;
69 GPUVAddr address;
70};
71
72} // namespace DMA
73} // namespace Tegra
74
27namespace Tegra::Engines { 75namespace Tegra::Engines {
28 76
29class AccelerateDMAInterface { 77class AccelerateDMAInterface {
@@ -32,6 +80,12 @@ public:
32 virtual bool BufferCopy(GPUVAddr src_address, GPUVAddr dest_address, u64 amount) = 0; 80 virtual bool BufferCopy(GPUVAddr src_address, GPUVAddr dest_address, u64 amount) = 0;
33 81
34 virtual bool BufferClear(GPUVAddr src_address, u64 amount, u32 value) = 0; 82 virtual bool BufferClear(GPUVAddr src_address, u64 amount, u32 value) = 0;
83
84 virtual bool ImageToBuffer(const DMA::ImageCopy& copy_info, const DMA::ImageOperand& src,
85 const DMA::BufferOperand& dst) = 0;
86
87 virtual bool BufferToImage(const DMA::ImageCopy& copy_info, const DMA::BufferOperand& src,
88 const DMA::ImageOperand& dst) = 0;
35}; 89};
36 90
37/** 91/**
@@ -51,30 +105,6 @@ public:
51 } 105 }
52 }; 106 };
53 107
54 union BlockSize {
55 BitField<0, 4, u32> width;
56 BitField<4, 4, u32> height;
57 BitField<8, 4, u32> depth;
58 BitField<12, 4, u32> gob_height;
59 };
60 static_assert(sizeof(BlockSize) == 4);
61
62 union Origin {
63 BitField<0, 16, u32> x;
64 BitField<16, 16, u32> y;
65 };
66 static_assert(sizeof(Origin) == 4);
67
68 struct Parameters {
69 BlockSize block_size;
70 u32 width;
71 u32 height;
72 u32 depth;
73 u32 layer;
74 Origin origin;
75 };
76 static_assert(sizeof(Parameters) == 24);
77
78 struct Semaphore { 108 struct Semaphore {
79 PackedGPUVAddr address; 109 PackedGPUVAddr address;
80 u32 payload; 110 u32 payload;
@@ -227,8 +257,6 @@ private:
227 257
228 void CopyBlockLinearToBlockLinear(); 258 void CopyBlockLinearToBlockLinear();
229 259
230 void FastCopyBlockLinearToPitch();
231
232 void ReleaseSemaphore(); 260 void ReleaseSemaphore();
233 261
234 void ConsumeSinkImpl() override; 262 void ConsumeSinkImpl() override;
@@ -261,17 +289,17 @@ private:
261 u32 reserved05[0x3f]; 289 u32 reserved05[0x3f];
262 PackedGPUVAddr offset_in; 290 PackedGPUVAddr offset_in;
263 PackedGPUVAddr offset_out; 291 PackedGPUVAddr offset_out;
264 u32 pitch_in; 292 s32 pitch_in;
265 u32 pitch_out; 293 s32 pitch_out;
266 u32 line_length_in; 294 u32 line_length_in;
267 u32 line_count; 295 u32 line_count;
268 u32 reserved06[0xb6]; 296 u32 reserved06[0xb6];
269 u32 remap_consta_value; 297 u32 remap_consta_value;
270 u32 remap_constb_value; 298 u32 remap_constb_value;
271 RemapConst remap_const; 299 RemapConst remap_const;
272 Parameters dst_params; 300 DMA::Parameters dst_params;
273 u32 reserved07[0x1]; 301 u32 reserved07[0x1];
274 Parameters src_params; 302 DMA::Parameters src_params;
275 u32 reserved08[0x275]; 303 u32 reserved08[0x275];
276 u32 pm_trigger_end; 304 u32 pm_trigger_end;
277 u32 reserved09[0x3ba]; 305 u32 reserved09[0x3ba];
diff --git a/src/video_core/framebuffer_config.h b/src/video_core/framebuffer_config.h
index d93f5a37f..5f3bffcab 100644
--- a/src/video_core/framebuffer_config.h
+++ b/src/video_core/framebuffer_config.h
@@ -5,8 +5,8 @@
5 5
6#include "common/common_types.h" 6#include "common/common_types.h"
7#include "common/math_util.h" 7#include "common/math_util.h"
8#include "core/hle/service/nvflinger/buffer_transform_flags.h" 8#include "core/hle/service/nvnflinger/buffer_transform_flags.h"
9#include "core/hle/service/nvflinger/pixel_format.h" 9#include "core/hle/service/nvnflinger/pixel_format.h"
10 10
11namespace Tegra { 11namespace Tegra {
12 12
diff --git a/src/video_core/renderer_null/null_rasterizer.h b/src/video_core/renderer_null/null_rasterizer.h
index 51f896e43..0c59e6a1f 100644
--- a/src/video_core/renderer_null/null_rasterizer.h
+++ b/src/video_core/renderer_null/null_rasterizer.h
@@ -22,6 +22,14 @@ public:
22 explicit AccelerateDMA(); 22 explicit AccelerateDMA();
23 bool BufferCopy(GPUVAddr start_address, GPUVAddr end_address, u64 amount) override; 23 bool BufferCopy(GPUVAddr start_address, GPUVAddr end_address, u64 amount) override;
24 bool BufferClear(GPUVAddr src_address, u64 amount, u32 value) override; 24 bool BufferClear(GPUVAddr src_address, u64 amount, u32 value) override;
25 bool ImageToBuffer(const Tegra::DMA::ImageCopy& copy_info, const Tegra::DMA::ImageOperand& src,
26 const Tegra::DMA::BufferOperand& dst) override {
27 return false;
28 }
29 bool BufferToImage(const Tegra::DMA::ImageCopy& copy_info, const Tegra::DMA::BufferOperand& src,
30 const Tegra::DMA::ImageOperand& dst) override {
31 return false;
32 }
25}; 33};
26 34
27class RasterizerNull final : public VideoCore::RasterizerAccelerated, 35class RasterizerNull final : public VideoCore::RasterizerAccelerated,
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h
index 0c45832ae..7e21fc43d 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -56,6 +56,16 @@ public:
56 56
57 bool BufferClear(GPUVAddr src_address, u64 amount, u32 value) override; 57 bool BufferClear(GPUVAddr src_address, u64 amount, u32 value) override;
58 58
59 bool ImageToBuffer(const Tegra::DMA::ImageCopy& copy_info, const Tegra::DMA::ImageOperand& src,
60 const Tegra::DMA::BufferOperand& dst) override {
61 return false;
62 }
63
64 bool BufferToImage(const Tegra::DMA::ImageCopy& copy_info, const Tegra::DMA::BufferOperand& src,
65 const Tegra::DMA::ImageOperand& dst) override {
66 return false;
67 }
68
59private: 69private:
60 BufferCache& buffer_cache; 70 BufferCache& buffer_cache;
61}; 71};
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
index 719edbcfb..f085d53a1 100644
--- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp
+++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
@@ -172,7 +172,7 @@ RasterizerVulkan::RasterizerVulkan(Core::Frontend::EmuWindow& emu_window_, Tegra
172 buffer_cache(*this, cpu_memory_, buffer_cache_runtime), 172 buffer_cache(*this, cpu_memory_, buffer_cache_runtime),
173 pipeline_cache(*this, device, scheduler, descriptor_pool, update_descriptor_queue, 173 pipeline_cache(*this, device, scheduler, descriptor_pool, update_descriptor_queue,
174 render_pass_cache, buffer_cache, texture_cache, gpu.ShaderNotify()), 174 render_pass_cache, buffer_cache, texture_cache, gpu.ShaderNotify()),
175 query_cache{*this, device, scheduler}, accelerate_dma{buffer_cache}, 175 query_cache{*this, device, scheduler}, accelerate_dma(buffer_cache, texture_cache, scheduler),
176 fence_manager(*this, gpu, texture_cache, buffer_cache, query_cache, device, scheduler), 176 fence_manager(*this, gpu, texture_cache, buffer_cache, query_cache, device, scheduler),
177 wfi_event(device.GetLogical().CreateEvent()) { 177 wfi_event(device.GetLogical().CreateEvent()) {
178 scheduler.SetQueryCache(query_cache); 178 scheduler.SetQueryCache(query_cache);
@@ -756,7 +756,9 @@ void RasterizerVulkan::FlushWork() {
756 draw_counter = 0; 756 draw_counter = 0;
757} 757}
758 758
759AccelerateDMA::AccelerateDMA(BufferCache& buffer_cache_) : buffer_cache{buffer_cache_} {} 759AccelerateDMA::AccelerateDMA(BufferCache& buffer_cache_, TextureCache& texture_cache_,
760 Scheduler& scheduler_)
761 : buffer_cache{buffer_cache_}, texture_cache{texture_cache_}, scheduler{scheduler_} {}
760 762
761bool AccelerateDMA::BufferClear(GPUVAddr src_address, u64 amount, u32 value) { 763bool AccelerateDMA::BufferClear(GPUVAddr src_address, u64 amount, u32 value) {
762 std::scoped_lock lock{buffer_cache.mutex}; 764 std::scoped_lock lock{buffer_cache.mutex};
@@ -768,6 +770,234 @@ bool AccelerateDMA::BufferCopy(GPUVAddr src_address, GPUVAddr dest_address, u64
768 return buffer_cache.DMACopy(src_address, dest_address, amount); 770 return buffer_cache.DMACopy(src_address, dest_address, amount);
769} 771}
770 772
773bool AccelerateDMA::ImageToBuffer(const Tegra::DMA::ImageCopy& copy_info,
774 const Tegra::DMA::ImageOperand& src,
775 const Tegra::DMA::BufferOperand& dst) {
776 std::scoped_lock lock{buffer_cache.mutex, texture_cache.mutex};
777 auto query_image = texture_cache.ObtainImage(src, false);
778 if (!query_image) {
779 return false;
780 }
781 auto* image = query_image->first;
782 auto [level, base] = query_image->second;
783 const u32 buffer_size = static_cast<u32>(dst.pitch * dst.height);
784 const auto [buffer, offset] = buffer_cache.ObtainBuffer(
785 dst.address, buffer_size, VideoCommon::ObtainBufferSynchronize::FullSynchronize,
786 VideoCommon::ObtainBufferOperation::MarkAsWritten);
787
788 const bool is_rescaled = image->IsRescaled();
789 if (is_rescaled) {
790 image->ScaleDown();
791 }
792 VkImageSubresourceLayers subresources{
793 .aspectMask = image->AspectMask(),
794 .mipLevel = level,
795 .baseArrayLayer = base,
796 .layerCount = 1,
797 };
798 const u32 bpp = VideoCore::Surface::BytesPerBlock(image->info.format);
799 const auto convert = [old_bpp = src.bytes_per_pixel, bpp](u32 value) {
800 return (old_bpp * value) / bpp;
801 };
802 const u32 base_x = convert(src.params.origin.x.Value());
803 const u32 base_y = src.params.origin.y.Value();
804 const u32 length_x = convert(copy_info.length_x);
805 const u32 length_y = copy_info.length_y;
806 VkOffset3D image_offset{
807 .x = static_cast<s32>(base_x),
808 .y = static_cast<s32>(base_y),
809 .z = 0,
810 };
811 VkExtent3D image_extent{
812 .width = length_x,
813 .height = length_y,
814 .depth = 1,
815 };
816 auto buff_info(dst);
817 buff_info.pitch = convert(dst.pitch);
818 scheduler.RequestOutsideRenderPassOperationContext();
819 scheduler.Record([src_image = image->Handle(), dst_buffer = buffer->Handle(),
820 buffer_offset = offset, subresources, image_offset, image_extent,
821 buff_info](vk::CommandBuffer cmdbuf) {
822 const std::array buffer_copy_info{
823 VkBufferImageCopy{
824 .bufferOffset = buffer_offset,
825 .bufferRowLength = buff_info.pitch,
826 .bufferImageHeight = buff_info.height,
827 .imageSubresource = subresources,
828 .imageOffset = image_offset,
829 .imageExtent = image_extent,
830 },
831 };
832 const VkImageSubresourceRange range{
833 .aspectMask = subresources.aspectMask,
834 .baseMipLevel = subresources.mipLevel,
835 .levelCount = 1,
836 .baseArrayLayer = subresources.baseArrayLayer,
837 .layerCount = 1,
838 };
839 static constexpr VkMemoryBarrier WRITE_BARRIER{
840 .sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER,
841 .pNext = nullptr,
842 .srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT,
843 .dstAccessMask = VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT,
844 };
845 const std::array pre_barriers{
846 VkImageMemoryBarrier{
847 .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
848 .pNext = nullptr,
849 .srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT |
850 VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT |
851 VK_ACCESS_TRANSFER_WRITE_BIT,
852 .dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT,
853 .oldLayout = VK_IMAGE_LAYOUT_GENERAL,
854 .newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
855 .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
856 .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
857 .image = src_image,
858 .subresourceRange = range,
859 },
860 };
861 const std::array post_barriers{
862 VkImageMemoryBarrier{
863 .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
864 .pNext = nullptr,
865 .srcAccessMask = 0,
866 .dstAccessMask = 0,
867 .oldLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
868 .newLayout = VK_IMAGE_LAYOUT_GENERAL,
869 .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
870 .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
871 .image = src_image,
872 .subresourceRange = range,
873 },
874 };
875 cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
876 0, {}, {}, pre_barriers);
877 cmdbuf.CopyImageToBuffer(src_image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, dst_buffer,
878 buffer_copy_info);
879 cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
880 0, WRITE_BARRIER, nullptr, post_barriers);
881 });
882 if (is_rescaled) {
883 image->ScaleUp(true);
884 }
885 return true;
886}
887
888bool AccelerateDMA::BufferToImage(const Tegra::DMA::ImageCopy& copy_info,
889 const Tegra::DMA::BufferOperand& src,
890 const Tegra::DMA::ImageOperand& dst) {
891 std::scoped_lock lock{buffer_cache.mutex, texture_cache.mutex};
892 auto query_image = texture_cache.ObtainImage(dst, true);
893 if (!query_image) {
894 return false;
895 }
896 auto* image = query_image->first;
897 auto [level, base] = query_image->second;
898 const u32 buffer_size = static_cast<u32>(src.pitch * src.height);
899 const auto [buffer, offset] = buffer_cache.ObtainBuffer(
900 src.address, buffer_size, VideoCommon::ObtainBufferSynchronize::FullSynchronize,
901 VideoCommon::ObtainBufferOperation::DoNothing);
902 const bool is_rescaled = image->IsRescaled();
903 if (is_rescaled) {
904 image->ScaleDown(true);
905 }
906 VkImageSubresourceLayers subresources{
907 .aspectMask = image->AspectMask(),
908 .mipLevel = level,
909 .baseArrayLayer = base,
910 .layerCount = 1,
911 };
912 const u32 bpp = VideoCore::Surface::BytesPerBlock(image->info.format);
913 const auto convert = [old_bpp = dst.bytes_per_pixel, bpp](u32 value) {
914 return (old_bpp * value) / bpp;
915 };
916 const u32 base_x = convert(dst.params.origin.x.Value());
917 const u32 base_y = dst.params.origin.y.Value();
918 const u32 length_x = convert(copy_info.length_x);
919 const u32 length_y = copy_info.length_y;
920 VkOffset3D image_offset{
921 .x = static_cast<s32>(base_x),
922 .y = static_cast<s32>(base_y),
923 .z = 0,
924 };
925 VkExtent3D image_extent{
926 .width = length_x,
927 .height = length_y,
928 .depth = 1,
929 };
930 auto buff_info(src);
931 buff_info.pitch = convert(src.pitch);
932 scheduler.RequestOutsideRenderPassOperationContext();
933 scheduler.Record([dst_image = image->Handle(), src_buffer = buffer->Handle(),
934 buffer_offset = offset, subresources, image_offset, image_extent,
935 buff_info](vk::CommandBuffer cmdbuf) {
936 const std::array buffer_copy_info{
937 VkBufferImageCopy{
938 .bufferOffset = buffer_offset,
939 .bufferRowLength = buff_info.pitch,
940 .bufferImageHeight = buff_info.height,
941 .imageSubresource = subresources,
942 .imageOffset = image_offset,
943 .imageExtent = image_extent,
944 },
945 };
946 const VkImageSubresourceRange range{
947 .aspectMask = subresources.aspectMask,
948 .baseMipLevel = subresources.mipLevel,
949 .levelCount = 1,
950 .baseArrayLayer = subresources.baseArrayLayer,
951 .layerCount = 1,
952 };
953 static constexpr VkMemoryBarrier READ_BARRIER{
954 .sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER,
955 .pNext = nullptr,
956 .srcAccessMask = VK_ACCESS_MEMORY_WRITE_BIT,
957 .dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT | VK_ACCESS_TRANSFER_WRITE_BIT,
958 };
959 const std::array pre_barriers{
960 VkImageMemoryBarrier{
961 .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
962 .pNext = nullptr,
963 .srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT |
964 VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT |
965 VK_ACCESS_TRANSFER_WRITE_BIT,
966 .dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT,
967 .oldLayout = VK_IMAGE_LAYOUT_GENERAL,
968 .newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
969 .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
970 .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
971 .image = dst_image,
972 .subresourceRange = range,
973 },
974 };
975 const std::array post_barriers{
976 VkImageMemoryBarrier{
977 .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
978 .pNext = nullptr,
979 .srcAccessMask = 0,
980 .dstAccessMask = 0,
981 .oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
982 .newLayout = VK_IMAGE_LAYOUT_GENERAL,
983 .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
984 .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
985 .image = dst_image,
986 .subresourceRange = range,
987 },
988 };
989 cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
990 0, READ_BARRIER, {}, pre_barriers);
991 cmdbuf.CopyBufferToImage(src_buffer, dst_image, VK_IMAGE_LAYOUT_GENERAL, buffer_copy_info);
992 cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
993 0, nullptr, nullptr, post_barriers);
994 });
995 if (is_rescaled) {
996 image->ScaleUp();
997 }
998 return true;
999}
1000
771void RasterizerVulkan::UpdateDynamicStates() { 1001void RasterizerVulkan::UpdateDynamicStates() {
772 auto& regs = maxwell3d->regs; 1002 auto& regs = maxwell3d->regs;
773 UpdateViewportsState(regs); 1003 UpdateViewportsState(regs);
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.h b/src/video_core/renderer_vulkan/vk_rasterizer.h
index a0508b57c..7746c5434 100644
--- a/src/video_core/renderer_vulkan/vk_rasterizer.h
+++ b/src/video_core/renderer_vulkan/vk_rasterizer.h
@@ -45,14 +45,23 @@ class StateTracker;
45 45
46class AccelerateDMA : public Tegra::Engines::AccelerateDMAInterface { 46class AccelerateDMA : public Tegra::Engines::AccelerateDMAInterface {
47public: 47public:
48 explicit AccelerateDMA(BufferCache& buffer_cache); 48 explicit AccelerateDMA(BufferCache& buffer_cache, TextureCache& texture_cache,
49 Scheduler& scheduler);
49 50
50 bool BufferCopy(GPUVAddr start_address, GPUVAddr end_address, u64 amount) override; 51 bool BufferCopy(GPUVAddr start_address, GPUVAddr end_address, u64 amount) override;
51 52
52 bool BufferClear(GPUVAddr src_address, u64 amount, u32 value) override; 53 bool BufferClear(GPUVAddr src_address, u64 amount, u32 value) override;
53 54
55 bool ImageToBuffer(const Tegra::DMA::ImageCopy& copy_info, const Tegra::DMA::ImageOperand& src,
56 const Tegra::DMA::BufferOperand& dst) override;
57
58 bool BufferToImage(const Tegra::DMA::ImageCopy& copy_info, const Tegra::DMA::BufferOperand& src,
59 const Tegra::DMA::ImageOperand& dst) override;
60
54private: 61private:
55 BufferCache& buffer_cache; 62 BufferCache& buffer_cache;
63 TextureCache& texture_cache;
64 Scheduler& scheduler;
56}; 65};
57 66
58class RasterizerVulkan final : public VideoCore::RasterizerAccelerated, 67class RasterizerVulkan final : public VideoCore::RasterizerAccelerated,
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp
index 80adb70eb..8a204f93f 100644
--- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp
@@ -864,13 +864,19 @@ void TextureCacheRuntime::ReinterpretImage(Image& dst, Image& src,
864 const VkImageAspectFlags src_aspect_mask = src.AspectMask(); 864 const VkImageAspectFlags src_aspect_mask = src.AspectMask();
865 const VkImageAspectFlags dst_aspect_mask = dst.AspectMask(); 865 const VkImageAspectFlags dst_aspect_mask = dst.AspectMask();
866 866
867 std::ranges::transform(copies, vk_in_copies.begin(), [src_aspect_mask](const auto& copy) { 867 const auto bpp_in = BytesPerBlock(src.info.format) / DefaultBlockWidth(src.info.format);
868 return MakeBufferImageCopy(copy, true, src_aspect_mask); 868 const auto bpp_out = BytesPerBlock(dst.info.format) / DefaultBlockWidth(dst.info.format);
869 }); 869 std::ranges::transform(copies, vk_in_copies.begin(),
870 [src_aspect_mask, bpp_in, bpp_out](const auto& copy) {
871 auto copy2 = copy;
872 copy2.src_offset.x = (bpp_out * copy.src_offset.x) / bpp_in;
873 copy2.extent.width = (bpp_out * copy.extent.width) / bpp_in;
874 return MakeBufferImageCopy(copy2, true, src_aspect_mask);
875 });
870 std::ranges::transform(copies, vk_out_copies.begin(), [dst_aspect_mask](const auto& copy) { 876 std::ranges::transform(copies, vk_out_copies.begin(), [dst_aspect_mask](const auto& copy) {
871 return MakeBufferImageCopy(copy, false, dst_aspect_mask); 877 return MakeBufferImageCopy(copy, false, dst_aspect_mask);
872 }); 878 });
873 const u32 img_bpp = BytesPerBlock(src.info.format); 879 const u32 img_bpp = BytesPerBlock(dst.info.format);
874 size_t total_size = 0; 880 size_t total_size = 0;
875 for (const auto& copy : copies) { 881 for (const auto& copy : copies) {
876 total_size += copy.extent.width * copy.extent.height * copy.extent.depth * img_bpp; 882 total_size += copy.extent.width * copy.extent.height * copy.extent.depth * img_bpp;
diff --git a/src/video_core/texture_cache/image_info.cpp b/src/video_core/texture_cache/image_info.cpp
index e9100091e..a1296b574 100644
--- a/src/video_core/texture_cache/image_info.cpp
+++ b/src/video_core/texture_cache/image_info.cpp
@@ -216,10 +216,51 @@ ImageInfo::ImageInfo(const Tegra::Engines::Fermi2D::Surface& config) noexcept {
216 .height = config.height, 216 .height = config.height,
217 .depth = 1, 217 .depth = 1,
218 }; 218 };
219 rescaleable = block.depth == 0; 219 rescaleable = block.depth == 0 && size.height > 256;
220 rescaleable &= size.height > 256;
221 downscaleable = size.height > 512; 220 downscaleable = size.height > 512;
222 } 221 }
223} 222}
224 223
224static PixelFormat ByteSizeToFormat(u32 bytes_per_pixel) {
225 switch (bytes_per_pixel) {
226 case 1:
227 return PixelFormat::R8_UINT;
228 case 2:
229 return PixelFormat::R8G8_UINT;
230 case 4:
231 return PixelFormat::A8B8G8R8_UINT;
232 case 8:
233 return PixelFormat::R16G16B16A16_UINT;
234 case 16:
235 return PixelFormat::R32G32B32A32_UINT;
236 default:
237 UNIMPLEMENTED();
238 return PixelFormat::Invalid;
239 }
240}
241
242ImageInfo::ImageInfo(const Tegra::DMA::ImageOperand& config) noexcept {
243 const u32 bytes_per_pixel = config.bytes_per_pixel;
244 format = ByteSizeToFormat(bytes_per_pixel);
245 type = config.params.block_size.depth > 0 ? ImageType::e3D : ImageType::e2D;
246 num_samples = 1;
247 block = Extent3D{
248 .width = config.params.block_size.width,
249 .height = config.params.block_size.height,
250 .depth = config.params.block_size.depth,
251 };
252 size = Extent3D{
253 .width = config.params.width,
254 .height = config.params.height,
255 .depth = config.params.depth,
256 };
257 tile_width_spacing = 0;
258 resources.levels = 1;
259 resources.layers = 1;
260 layer_stride = CalculateLayerStride(*this);
261 maybe_unaligned_layer_stride = CalculateLayerSize(*this);
262 rescaleable = block.depth == 0 && size.height > 256;
263 downscaleable = size.height > 512;
264}
265
225} // namespace VideoCommon 266} // namespace VideoCommon
diff --git a/src/video_core/texture_cache/image_info.h b/src/video_core/texture_cache/image_info.h
index 93755e15e..a12f5b44f 100644
--- a/src/video_core/texture_cache/image_info.h
+++ b/src/video_core/texture_cache/image_info.h
@@ -5,6 +5,7 @@
5 5
6#include "video_core/engines/fermi_2d.h" 6#include "video_core/engines/fermi_2d.h"
7#include "video_core/engines/maxwell_3d.h" 7#include "video_core/engines/maxwell_3d.h"
8#include "video_core/engines/maxwell_dma.h"
8#include "video_core/surface.h" 9#include "video_core/surface.h"
9#include "video_core/texture_cache/types.h" 10#include "video_core/texture_cache/types.h"
10 11
@@ -19,6 +20,7 @@ struct ImageInfo {
19 explicit ImageInfo(const Tegra::Engines::Maxwell3D::Regs& regs, size_t index) noexcept; 20 explicit ImageInfo(const Tegra::Engines::Maxwell3D::Regs& regs, size_t index) noexcept;
20 explicit ImageInfo(const Tegra::Engines::Maxwell3D::Regs& regs) noexcept; 21 explicit ImageInfo(const Tegra::Engines::Maxwell3D::Regs& regs) noexcept;
21 explicit ImageInfo(const Tegra::Engines::Fermi2D::Surface& config) noexcept; 22 explicit ImageInfo(const Tegra::Engines::Fermi2D::Surface& config) noexcept;
23 explicit ImageInfo(const Tegra::DMA::ImageOperand& config) noexcept;
22 24
23 PixelFormat format = PixelFormat::Invalid; 25 PixelFormat format = PixelFormat::Invalid;
24 ImageType type = ImageType::e1D; 26 ImageType type = ImageType::e1D;
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h
index 9dd152fbe..335338434 100644
--- a/src/video_core/texture_cache/texture_cache.h
+++ b/src/video_core/texture_cache/texture_cache.h
@@ -1359,6 +1359,75 @@ std::optional<typename TextureCache<P>::BlitImages> TextureCache<P>::GetBlitImag
1359} 1359}
1360 1360
1361template <class P> 1361template <class P>
1362ImageId TextureCache<P>::FindDMAImage(const ImageInfo& info, GPUVAddr gpu_addr) {
1363 std::optional<VAddr> cpu_addr = gpu_memory->GpuToCpuAddress(gpu_addr);
1364 if (!cpu_addr) {
1365 cpu_addr = gpu_memory->GpuToCpuAddress(gpu_addr, CalculateGuestSizeInBytes(info));
1366 if (!cpu_addr) {
1367 return ImageId{};
1368 }
1369 }
1370 ImageId image_id{};
1371 boost::container::small_vector<ImageId, 1> image_ids;
1372 const auto lambda = [&](ImageId existing_image_id, ImageBase& existing_image) {
1373 if (True(existing_image.flags & ImageFlagBits::Remapped)) {
1374 return false;
1375 }
1376 if (info.type == ImageType::Linear || existing_image.info.type == ImageType::Linear)
1377 [[unlikely]] {
1378 const bool strict_size = True(existing_image.flags & ImageFlagBits::Strong);
1379 const ImageInfo& existing = existing_image.info;
1380 if (existing_image.gpu_addr == gpu_addr && existing.type == info.type &&
1381 existing.pitch == info.pitch &&
1382 IsPitchLinearSameSize(existing, info, strict_size) &&
1383 IsViewCompatible(existing.format, info.format, false, true)) {
1384 image_id = existing_image_id;
1385 image_ids.push_back(existing_image_id);
1386 return true;
1387 }
1388 } else if (IsSubCopy(info, existing_image, gpu_addr)) {
1389 image_id = existing_image_id;
1390 image_ids.push_back(existing_image_id);
1391 return true;
1392 }
1393 return false;
1394 };
1395 ForEachImageInRegion(*cpu_addr, CalculateGuestSizeInBytes(info), lambda);
1396 if (image_ids.size() <= 1) [[likely]] {
1397 return image_id;
1398 }
1399 auto image_ids_compare = [this](ImageId a, ImageId b) {
1400 auto& image_a = slot_images[a];
1401 auto& image_b = slot_images[b];
1402 return image_a.modification_tick < image_b.modification_tick;
1403 };
1404 return *std::ranges::max_element(image_ids, image_ids_compare);
1405}
1406
1407template <class P>
1408std::optional<std::pair<typename TextureCache<P>::Image*, std::pair<u32, u32>>>
1409TextureCache<P>::ObtainImage(const Tegra::DMA::ImageOperand& operand, bool mark_as_modified) {
1410 ImageInfo dst_info(operand);
1411 ImageId dst_id = FindDMAImage(dst_info, operand.address);
1412 if (!dst_id) {
1413 return std::nullopt;
1414 }
1415 auto& image = slot_images[dst_id];
1416 auto base = image.TryFindBase(operand.address);
1417 if (!base) {
1418 return std::nullopt;
1419 }
1420 if (False(image.flags & ImageFlagBits::GpuModified)) {
1421 // No need to waste time on an image that's synced with guest
1422 return std::nullopt;
1423 }
1424 PrepareImage(dst_id, mark_as_modified, false);
1425 auto& new_image = slot_images[dst_id];
1426 lru_cache.Touch(new_image.lru_index, frame_tick);
1427 return std::make_pair(&new_image, std::make_pair(base->level, base->layer));
1428}
1429
1430template <class P>
1362SamplerId TextureCache<P>::FindSampler(const TSCEntry& config) { 1431SamplerId TextureCache<P>::FindSampler(const TSCEntry& config) {
1363 if (std::ranges::all_of(config.raw, [](u64 value) { return value == 0; })) { 1432 if (std::ranges::all_of(config.raw, [](u64 value) { return value == 0; })) {
1364 return NULL_SAMPLER_ID; 1433 return NULL_SAMPLER_ID;
diff --git a/src/video_core/texture_cache/texture_cache_base.h b/src/video_core/texture_cache/texture_cache_base.h
index 013836933..848a5d9ea 100644
--- a/src/video_core/texture_cache/texture_cache_base.h
+++ b/src/video_core/texture_cache/texture_cache_base.h
@@ -209,6 +209,9 @@ public:
209 /// Pop asynchronous downloads 209 /// Pop asynchronous downloads
210 void PopAsyncFlushes(); 210 void PopAsyncFlushes();
211 211
212 [[nodiscard]] std::optional<std::pair<Image*, std::pair<u32, u32>>> ObtainImage(
213 const Tegra::DMA::ImageOperand& operand, bool mark_as_modified);
214
212 /// Return true when a CPU region is modified from the GPU 215 /// Return true when a CPU region is modified from the GPU
213 [[nodiscard]] bool IsRegionGpuModified(VAddr addr, size_t size); 216 [[nodiscard]] bool IsRegionGpuModified(VAddr addr, size_t size);
214 217
@@ -300,6 +303,8 @@ private:
300 /// Remove joined images from the cache 303 /// Remove joined images from the cache
301 [[nodiscard]] ImageId JoinImages(const ImageInfo& info, GPUVAddr gpu_addr, VAddr cpu_addr); 304 [[nodiscard]] ImageId JoinImages(const ImageInfo& info, GPUVAddr gpu_addr, VAddr cpu_addr);
302 305
306 [[nodiscard]] ImageId FindDMAImage(const ImageInfo& info, GPUVAddr gpu_addr);
307
303 /// Return a blit image pair from the given guest blit parameters 308 /// Return a blit image pair from the given guest blit parameters
304 [[nodiscard]] std::optional<BlitImages> GetBlitImages( 309 [[nodiscard]] std::optional<BlitImages> GetBlitImages(
305 const Tegra::Engines::Fermi2D::Surface& dst, const Tegra::Engines::Fermi2D::Surface& src, 310 const Tegra::Engines::Fermi2D::Surface& dst, const Tegra::Engines::Fermi2D::Surface& src,
diff --git a/src/video_core/texture_cache/types.h b/src/video_core/texture_cache/types.h
index 0453456b4..a0e10643f 100644
--- a/src/video_core/texture_cache/types.h
+++ b/src/video_core/texture_cache/types.h
@@ -54,6 +54,7 @@ enum class RelaxedOptions : u32 {
54 Format = 1 << 1, 54 Format = 1 << 1,
55 Samples = 1 << 2, 55 Samples = 1 << 2,
56 ForceBrokenViews = 1 << 3, 56 ForceBrokenViews = 1 << 3,
57 FormatBpp = 1 << 4,
57}; 58};
58DECLARE_ENUM_FLAG_OPERATORS(RelaxedOptions) 59DECLARE_ENUM_FLAG_OPERATORS(RelaxedOptions)
59 60
diff --git a/src/video_core/texture_cache/util.cpp b/src/video_core/texture_cache/util.cpp
index 697f86641..de37db684 100644
--- a/src/video_core/texture_cache/util.cpp
+++ b/src/video_core/texture_cache/util.cpp
@@ -743,6 +743,44 @@ std::vector<ImageCopy> MakeShrinkImageCopies(const ImageInfo& dst, const ImageIn
743 return copies; 743 return copies;
744} 744}
745 745
746std::vector<ImageCopy> MakeReinterpretImageCopies(const ImageInfo& src, u32 up_scale,
747 u32 down_shift) {
748 std::vector<ImageCopy> copies;
749 copies.reserve(src.resources.levels);
750 const bool is_3d = src.type == ImageType::e3D;
751 for (s32 level = 0; level < src.resources.levels; ++level) {
752 ImageCopy& copy = copies.emplace_back();
753 copy.src_subresource = SubresourceLayers{
754 .base_level = level,
755 .base_layer = 0,
756 .num_layers = src.resources.layers,
757 };
758 copy.dst_subresource = SubresourceLayers{
759 .base_level = level,
760 .base_layer = 0,
761 .num_layers = src.resources.layers,
762 };
763 copy.src_offset = Offset3D{
764 .x = 0,
765 .y = 0,
766 .z = 0,
767 };
768 copy.dst_offset = Offset3D{
769 .x = 0,
770 .y = 0,
771 .z = 0,
772 };
773 const Extent3D mip_size = AdjustMipSize(src.size, level);
774 copy.extent = AdjustSamplesSize(mip_size, src.num_samples);
775 if (is_3d) {
776 copy.extent.depth = src.size.depth;
777 }
778 copy.extent.width = std::max<u32>((copy.extent.width * up_scale) >> down_shift, 1);
779 copy.extent.height = std::max<u32>((copy.extent.height * up_scale) >> down_shift, 1);
780 }
781 return copies;
782}
783
746bool IsValidEntry(const Tegra::MemoryManager& gpu_memory, const TICEntry& config) { 784bool IsValidEntry(const Tegra::MemoryManager& gpu_memory, const TICEntry& config) {
747 const GPUVAddr address = config.Address(); 785 const GPUVAddr address = config.Address();
748 if (address == 0) { 786 if (address == 0) {
@@ -999,6 +1037,20 @@ bool IsBlockLinearSizeCompatible(const ImageInfo& lhs, const ImageInfo& rhs, u32
999 } 1037 }
1000} 1038}
1001 1039
1040bool IsBlockLinearSizeCompatibleBPPRelaxed(const ImageInfo& lhs, const ImageInfo& rhs,
1041 u32 lhs_level, u32 rhs_level) noexcept {
1042 ASSERT(lhs.type != ImageType::Linear);
1043 ASSERT(rhs.type != ImageType::Linear);
1044 const auto lhs_bpp = BytesPerBlock(lhs.format);
1045 const auto rhs_bpp = BytesPerBlock(rhs.format);
1046 const Extent3D lhs_size = AdjustMipSize(lhs.size, lhs_level);
1047 const Extent3D rhs_size = AdjustMipSize(rhs.size, rhs_level);
1048 return Common::AlignUpLog2(lhs_size.width * lhs_bpp, GOB_SIZE_X_SHIFT) ==
1049 Common::AlignUpLog2(rhs_size.width * rhs_bpp, GOB_SIZE_X_SHIFT) &&
1050 Common::AlignUpLog2(lhs_size.height, GOB_SIZE_Y_SHIFT) ==
1051 Common::AlignUpLog2(rhs_size.height, GOB_SIZE_Y_SHIFT);
1052}
1053
1002bool IsPitchLinearSameSize(const ImageInfo& lhs, const ImageInfo& rhs, bool strict_size) noexcept { 1054bool IsPitchLinearSameSize(const ImageInfo& lhs, const ImageInfo& rhs, bool strict_size) noexcept {
1003 ASSERT(lhs.type == ImageType::Linear); 1055 ASSERT(lhs.type == ImageType::Linear);
1004 ASSERT(rhs.type == ImageType::Linear); 1056 ASSERT(rhs.type == ImageType::Linear);
@@ -1073,7 +1125,8 @@ std::optional<SubresourceBase> FindSubresource(const ImageInfo& candidate, const
1073 // Format checking is relaxed, but we still have to check for matching bytes per block. 1125 // Format checking is relaxed, but we still have to check for matching bytes per block.
1074 // This avoids creating a view for blits on UE4 titles where formats with different bytes 1126 // This avoids creating a view for blits on UE4 titles where formats with different bytes
1075 // per block are aliased. 1127 // per block are aliased.
1076 if (BytesPerBlock(existing.format) != BytesPerBlock(candidate.format)) { 1128 if (BytesPerBlock(existing.format) != BytesPerBlock(candidate.format) &&
1129 False(options & RelaxedOptions::FormatBpp)) {
1077 return std::nullopt; 1130 return std::nullopt;
1078 } 1131 }
1079 } else { 1132 } else {
@@ -1088,10 +1141,8 @@ std::optional<SubresourceBase> FindSubresource(const ImageInfo& candidate, const
1088 if (existing.type != candidate.type) { 1141 if (existing.type != candidate.type) {
1089 return std::nullopt; 1142 return std::nullopt;
1090 } 1143 }
1091 if (False(options & RelaxedOptions::Samples)) { 1144 if (False(options & RelaxedOptions::Samples) && existing.num_samples != candidate.num_samples) {
1092 if (existing.num_samples != candidate.num_samples) { 1145 return std::nullopt;
1093 return std::nullopt;
1094 }
1095 } 1146 }
1096 if (existing.resources.levels < candidate.resources.levels + base->level) { 1147 if (existing.resources.levels < candidate.resources.levels + base->level) {
1097 return std::nullopt; 1148 return std::nullopt;
@@ -1101,14 +1152,16 @@ std::optional<SubresourceBase> FindSubresource(const ImageInfo& candidate, const
1101 if (mip_depth < candidate.size.depth + base->layer) { 1152 if (mip_depth < candidate.size.depth + base->layer) {
1102 return std::nullopt; 1153 return std::nullopt;
1103 } 1154 }
1104 } else { 1155 } else if (existing.resources.layers < candidate.resources.layers + base->layer) {
1105 if (existing.resources.layers < candidate.resources.layers + base->layer) { 1156 return std::nullopt;
1106 return std::nullopt;
1107 }
1108 } 1157 }
1109 const bool strict_size = False(options & RelaxedOptions::Size); 1158 const bool strict_size = False(options & RelaxedOptions::Size);
1110 if (!IsBlockLinearSizeCompatible(existing, candidate, base->level, 0, strict_size)) { 1159 if (!IsBlockLinearSizeCompatible(existing, candidate, base->level, 0, strict_size)) {
1111 return std::nullopt; 1160 if (False(options & RelaxedOptions::FormatBpp)) {
1161 return std::nullopt;
1162 } else if (!IsBlockLinearSizeCompatibleBPPRelaxed(existing, candidate, base->level, 0)) {
1163 return std::nullopt;
1164 }
1112 } 1165 }
1113 // TODO: compare block sizes 1166 // TODO: compare block sizes
1114 return base; 1167 return base;
@@ -1120,6 +1173,31 @@ bool IsSubresource(const ImageInfo& candidate, const ImageBase& image, GPUVAddr
1120 .has_value(); 1173 .has_value();
1121} 1174}
1122 1175
1176bool IsSubCopy(const ImageInfo& candidate, const ImageBase& image, GPUVAddr candidate_addr) {
1177 const std::optional<SubresourceBase> base = image.TryFindBase(candidate_addr);
1178 if (!base) {
1179 return false;
1180 }
1181 const ImageInfo& existing = image.info;
1182 if (existing.resources.levels < candidate.resources.levels + base->level) {
1183 return false;
1184 }
1185 if (existing.type == ImageType::e3D) {
1186 const u32 mip_depth = std::max(1U, existing.size.depth << base->level);
1187 if (mip_depth < candidate.size.depth + base->layer) {
1188 return false;
1189 }
1190 } else {
1191 if (existing.resources.layers < candidate.resources.layers + base->layer) {
1192 return false;
1193 }
1194 }
1195 if (!IsBlockLinearSizeCompatibleBPPRelaxed(existing, candidate, base->level, 0)) {
1196 return false;
1197 }
1198 return true;
1199}
1200
1123void DeduceBlitImages(ImageInfo& dst_info, ImageInfo& src_info, const ImageBase* dst, 1201void DeduceBlitImages(ImageInfo& dst_info, ImageInfo& src_info, const ImageBase* dst,
1124 const ImageBase* src) { 1202 const ImageBase* src) {
1125 const auto original_dst_format = dst_info.format; 1203 const auto original_dst_format = dst_info.format;
diff --git a/src/video_core/texture_cache/util.h b/src/video_core/texture_cache/util.h
index d103db8ae..84aa6880d 100644
--- a/src/video_core/texture_cache/util.h
+++ b/src/video_core/texture_cache/util.h
@@ -56,6 +56,10 @@ struct OverlapResult {
56 SubresourceBase base, u32 up_scale = 1, 56 SubresourceBase base, u32 up_scale = 1,
57 u32 down_shift = 0); 57 u32 down_shift = 0);
58 58
59[[nodiscard]] std::vector<ImageCopy> MakeReinterpretImageCopies(const ImageInfo& src,
60 u32 up_scale = 1,
61 u32 down_shift = 0);
62
59[[nodiscard]] bool IsValidEntry(const Tegra::MemoryManager& gpu_memory, const TICEntry& config); 63[[nodiscard]] bool IsValidEntry(const Tegra::MemoryManager& gpu_memory, const TICEntry& config);
60 64
61[[nodiscard]] std::vector<BufferImageCopy> UnswizzleImage(Tegra::MemoryManager& gpu_memory, 65[[nodiscard]] std::vector<BufferImageCopy> UnswizzleImage(Tegra::MemoryManager& gpu_memory,
@@ -88,6 +92,9 @@ void SwizzleImage(Tegra::MemoryManager& gpu_memory, GPUVAddr gpu_addr, const Ima
88[[nodiscard]] bool IsPitchLinearSameSize(const ImageInfo& lhs, const ImageInfo& rhs, 92[[nodiscard]] bool IsPitchLinearSameSize(const ImageInfo& lhs, const ImageInfo& rhs,
89 bool strict_size) noexcept; 93 bool strict_size) noexcept;
90 94
95[[nodiscard]] bool IsBlockLinearSizeCompatibleBPPRelaxed(const ImageInfo& lhs, const ImageInfo& rhs,
96 u32 lhs_level, u32 rhs_level) noexcept;
97
91[[nodiscard]] std::optional<OverlapResult> ResolveOverlap(const ImageInfo& new_info, 98[[nodiscard]] std::optional<OverlapResult> ResolveOverlap(const ImageInfo& new_info,
92 GPUVAddr gpu_addr, VAddr cpu_addr, 99 GPUVAddr gpu_addr, VAddr cpu_addr,
93 const ImageBase& overlap, 100 const ImageBase& overlap,
@@ -106,6 +113,9 @@ void SwizzleImage(Tegra::MemoryManager& gpu_memory, GPUVAddr gpu_addr, const Ima
106 GPUVAddr candidate_addr, RelaxedOptions options, bool broken_views, 113 GPUVAddr candidate_addr, RelaxedOptions options, bool broken_views,
107 bool native_bgr); 114 bool native_bgr);
108 115
116[[nodiscard]] bool IsSubCopy(const ImageInfo& candidate, const ImageBase& image,
117 GPUVAddr candidate_addr);
118
109void DeduceBlitImages(ImageInfo& dst_info, ImageInfo& src_info, const ImageBase* dst, 119void DeduceBlitImages(ImageInfo& dst_info, ImageInfo& src_info, const ImageBase* dst,
110 const ImageBase* src); 120 const ImageBase* src);
111 121
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp
index 23d922e5d..48f1a3d14 100644
--- a/src/video_core/vulkan_common/vulkan_device.cpp
+++ b/src/video_core/vulkan_common/vulkan_device.cpp
@@ -409,6 +409,7 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
409 if (is_rdna2) { 409 if (is_rdna2) {
410 LOG_WARNING(Render_Vulkan, 410 LOG_WARNING(Render_Vulkan,
411 "RADV has broken VK_EXT_vertex_input_dynamic_state on RDNA2 hardware"); 411 "RADV has broken VK_EXT_vertex_input_dynamic_state on RDNA2 hardware");
412 features.vertex_input_dynamic_state.vertexInputDynamicState = false;
412 extensions.vertex_input_dynamic_state = false; 413 extensions.vertex_input_dynamic_state = false;
413 loaded_extensions.erase(VK_EXT_VERTEX_INPUT_DYNAMIC_STATE_EXTENSION_NAME); 414 loaded_extensions.erase(VK_EXT_VERTEX_INPUT_DYNAMIC_STATE_EXTENSION_NAME);
414 } 415 }