diff options
Diffstat (limited to '')
50 files changed, 249 insertions, 150 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 1072da8cc..a0bfd6bbc 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -82,7 +82,7 @@ static_assert(sizeof(uint64_t) == 8); static void SvcWrap_SetHeapSize64From32(Core::System& system) { Result ret{}; - uintptr_t out_address{}; + uint64_t out_address{}; uint32_t size{}; size = Convert<uint32_t>(GetReg32(system, 1)); @@ -729,7 +729,7 @@ static void SvcWrap_GetLastThreadInfo64From32(Core::System& system) { Result ret{}; ilp32::LastThreadContext out_context{}; - uintptr_t out_tls_address{}; + uint64_t out_tls_address{}; uint32_t out_flags{}; ret = GetLastThreadInfo64From32(system, &out_context, &out_tls_address, &out_flags); @@ -1278,8 +1278,8 @@ static void SvcWrap_QueryPhysicalAddress64From32(Core::System& system) { static void SvcWrap_QueryIoMapping64From32(Core::System& system) { Result ret{}; - uintptr_t out_address{}; - uintptr_t out_size{}; + uint64_t out_address{}; + uint64_t out_size{}; uint64_t physical_address{}; uint32_t size{}; @@ -2088,7 +2088,7 @@ static void SvcWrap_UnmapInsecureMemory64From32(Core::System& system) { static void SvcWrap_SetHeapSize64(Core::System& system) { Result ret{}; - uintptr_t out_address{}; + uint64_t out_address{}; uint64_t size{}; size = Convert<uint64_t>(GetReg64(system, 1)); @@ -2705,7 +2705,7 @@ static void SvcWrap_GetLastThreadInfo64(Core::System& system) { Result ret{}; lp64::LastThreadContext out_context{}; - uintptr_t out_tls_address{}; + uint64_t out_tls_address{}; uint32_t out_flags{}; ret = GetLastThreadInfo64(system, &out_context, &out_tls_address, &out_flags); @@ -3217,8 +3217,8 @@ static void SvcWrap_QueryPhysicalAddress64(Core::System& system) { static void SvcWrap_QueryIoMapping64(Core::System& system) { Result ret{}; - uintptr_t out_address{}; - uintptr_t out_size{}; + uint64_t out_address{}; + uint64_t out_size{}; uint64_t physical_address{}; uint64_t size{}; diff --git a/src/core/hle/kernel/svc.h b/src/core/hle/kernel/svc.h index 36e619959..ac4696008 100644 --- a/src/core/hle/kernel/svc.h +++ b/src/core/hle/kernel/svc.h @@ -16,7 +16,7 @@ class System; namespace Kernel::Svc { // clang-format off -Result SetHeapSize(Core::System& system, uintptr_t* out_address, uint64_t size); +Result SetHeapSize(Core::System& system, uint64_t* out_address, uint64_t size); Result SetMemoryPermission(Core::System& system, uint64_t address, uint64_t size, MemoryPermission perm); Result SetMemoryAttribute(Core::System& system, uint64_t address, uint64_t size, uint32_t mask, uint32_t attr); Result MapMemory(Core::System& system, uint64_t dst_address, uint64_t src_address, uint64_t size); @@ -61,7 +61,7 @@ Result FlushDataCache(Core::System& system, uint64_t address, uint64_t size); Result MapPhysicalMemory(Core::System& system, uint64_t address, uint64_t size); Result UnmapPhysicalMemory(Core::System& system, uint64_t address, uint64_t size); Result GetDebugFutureThreadInfo(Core::System& system, lp64::LastThreadContext* out_context, uint64_t* out_thread_id, Handle debug_handle, int64_t ns); -Result GetLastThreadInfo(Core::System& system, lp64::LastThreadContext* out_context, uintptr_t* out_tls_address, uint32_t* out_flags); +Result GetLastThreadInfo(Core::System& system, lp64::LastThreadContext* out_context, uint64_t* out_tls_address, uint32_t* out_flags); Result GetResourceLimitLimitValue(Core::System& system, int64_t* out_limit_value, Handle resource_limit_handle, LimitableResource which); Result GetResourceLimitCurrentValue(Core::System& system, int64_t* out_current_value, Handle resource_limit_handle, LimitableResource which); Result SetThreadActivity(Core::System& system, Handle thread_handle, ThreadActivity thread_activity); @@ -94,7 +94,7 @@ Result MapTransferMemory(Core::System& system, Handle trmem_handle, uint64_t add Result UnmapTransferMemory(Core::System& system, Handle trmem_handle, uint64_t address, uint64_t size); Result CreateInterruptEvent(Core::System& system, Handle* out_read_handle, int32_t interrupt_id, InterruptType interrupt_type); Result QueryPhysicalAddress(Core::System& system, lp64::PhysicalMemoryInfo* out_info, uint64_t address); -Result QueryIoMapping(Core::System& system, uintptr_t* out_address, uintptr_t* out_size, uint64_t physical_address, uint64_t size); +Result QueryIoMapping(Core::System& system, uint64_t* out_address, uint64_t* out_size, uint64_t physical_address, uint64_t size); Result CreateDeviceAddressSpace(Core::System& system, Handle* out_handle, uint64_t das_address, uint64_t das_size); Result AttachDeviceAddressSpace(Core::System& system, DeviceName device_name, Handle das_handle); Result DetachDeviceAddressSpace(Core::System& system, DeviceName device_name, Handle das_handle); @@ -137,7 +137,7 @@ Result SetResourceLimitLimitValue(Core::System& system, Handle resource_limit_ha Result MapInsecureMemory(Core::System& system, uint64_t address, uint64_t size); Result UnmapInsecureMemory(Core::System& system, uint64_t address, uint64_t size); -Result SetHeapSize64From32(Core::System& system, uintptr_t* out_address, uint32_t size); +Result SetHeapSize64From32(Core::System& system, uint64_t* out_address, uint32_t size); Result SetMemoryPermission64From32(Core::System& system, uint32_t address, uint32_t size, MemoryPermission perm); Result SetMemoryAttribute64From32(Core::System& system, uint32_t address, uint32_t size, uint32_t mask, uint32_t attr); Result MapMemory64From32(Core::System& system, uint32_t dst_address, uint32_t src_address, uint32_t size); @@ -182,7 +182,7 @@ Result FlushDataCache64From32(Core::System& system, uint32_t address, uint32_t s Result MapPhysicalMemory64From32(Core::System& system, uint32_t address, uint32_t size); Result UnmapPhysicalMemory64From32(Core::System& system, uint32_t address, uint32_t size); Result GetDebugFutureThreadInfo64From32(Core::System& system, ilp32::LastThreadContext* out_context, uint64_t* out_thread_id, Handle debug_handle, int64_t ns); -Result GetLastThreadInfo64From32(Core::System& system, ilp32::LastThreadContext* out_context, uintptr_t* out_tls_address, uint32_t* out_flags); +Result GetLastThreadInfo64From32(Core::System& system, ilp32::LastThreadContext* out_context, uint64_t* out_tls_address, uint32_t* out_flags); Result GetResourceLimitLimitValue64From32(Core::System& system, int64_t* out_limit_value, Handle resource_limit_handle, LimitableResource which); Result GetResourceLimitCurrentValue64From32(Core::System& system, int64_t* out_current_value, Handle resource_limit_handle, LimitableResource which); Result SetThreadActivity64From32(Core::System& system, Handle thread_handle, ThreadActivity thread_activity); @@ -215,7 +215,7 @@ Result MapTransferMemory64From32(Core::System& system, Handle trmem_handle, uint Result UnmapTransferMemory64From32(Core::System& system, Handle trmem_handle, uint32_t address, uint32_t size); Result CreateInterruptEvent64From32(Core::System& system, Handle* out_read_handle, int32_t interrupt_id, InterruptType interrupt_type); Result QueryPhysicalAddress64From32(Core::System& system, ilp32::PhysicalMemoryInfo* out_info, uint32_t address); -Result QueryIoMapping64From32(Core::System& system, uintptr_t* out_address, uintptr_t* out_size, uint64_t physical_address, uint32_t size); +Result QueryIoMapping64From32(Core::System& system, uint64_t* out_address, uint64_t* out_size, uint64_t physical_address, uint32_t size); Result CreateDeviceAddressSpace64From32(Core::System& system, Handle* out_handle, uint64_t das_address, uint64_t das_size); Result AttachDeviceAddressSpace64From32(Core::System& system, DeviceName device_name, Handle das_handle); Result DetachDeviceAddressSpace64From32(Core::System& system, DeviceName device_name, Handle das_handle); @@ -258,7 +258,7 @@ Result SetResourceLimitLimitValue64From32(Core::System& system, Handle resource_ Result MapInsecureMemory64From32(Core::System& system, uint32_t address, uint32_t size); Result UnmapInsecureMemory64From32(Core::System& system, uint32_t address, uint32_t size); -Result SetHeapSize64(Core::System& system, uintptr_t* out_address, uint64_t size); +Result SetHeapSize64(Core::System& system, uint64_t* out_address, uint64_t size); Result SetMemoryPermission64(Core::System& system, uint64_t address, uint64_t size, MemoryPermission perm); Result SetMemoryAttribute64(Core::System& system, uint64_t address, uint64_t size, uint32_t mask, uint32_t attr); Result MapMemory64(Core::System& system, uint64_t dst_address, uint64_t src_address, uint64_t size); @@ -303,7 +303,7 @@ Result FlushDataCache64(Core::System& system, uint64_t address, uint64_t size); Result MapPhysicalMemory64(Core::System& system, uint64_t address, uint64_t size); Result UnmapPhysicalMemory64(Core::System& system, uint64_t address, uint64_t size); Result GetDebugFutureThreadInfo64(Core::System& system, lp64::LastThreadContext* out_context, uint64_t* out_thread_id, Handle debug_handle, int64_t ns); -Result GetLastThreadInfo64(Core::System& system, lp64::LastThreadContext* out_context, uintptr_t* out_tls_address, uint32_t* out_flags); +Result GetLastThreadInfo64(Core::System& system, lp64::LastThreadContext* out_context, uint64_t* out_tls_address, uint32_t* out_flags); Result GetResourceLimitLimitValue64(Core::System& system, int64_t* out_limit_value, Handle resource_limit_handle, LimitableResource which); Result GetResourceLimitCurrentValue64(Core::System& system, int64_t* out_current_value, Handle resource_limit_handle, LimitableResource which); Result SetThreadActivity64(Core::System& system, Handle thread_handle, ThreadActivity thread_activity); @@ -336,7 +336,7 @@ Result MapTransferMemory64(Core::System& system, Handle trmem_handle, uint64_t a Result UnmapTransferMemory64(Core::System& system, Handle trmem_handle, uint64_t address, uint64_t size); Result CreateInterruptEvent64(Core::System& system, Handle* out_read_handle, int32_t interrupt_id, InterruptType interrupt_type); Result QueryPhysicalAddress64(Core::System& system, lp64::PhysicalMemoryInfo* out_info, uint64_t address); -Result QueryIoMapping64(Core::System& system, uintptr_t* out_address, uintptr_t* out_size, uint64_t physical_address, uint64_t size); +Result QueryIoMapping64(Core::System& system, uint64_t* out_address, uint64_t* out_size, uint64_t physical_address, uint64_t size); Result CreateDeviceAddressSpace64(Core::System& system, Handle* out_handle, uint64_t das_address, uint64_t das_size); Result AttachDeviceAddressSpace64(Core::System& system, DeviceName device_name, Handle das_handle); Result DetachDeviceAddressSpace64(Core::System& system, DeviceName device_name, Handle das_handle); diff --git a/src/core/hle/kernel/svc/svc_address_translation.cpp b/src/core/hle/kernel/svc/svc_address_translation.cpp index c25e144cd..e65a11cda 100644 --- a/src/core/hle/kernel/svc/svc_address_translation.cpp +++ b/src/core/hle/kernel/svc/svc_address_translation.cpp @@ -12,7 +12,7 @@ Result QueryPhysicalAddress(Core::System& system, lp64::PhysicalMemoryInfo* out_ R_THROW(ResultNotImplemented); } -Result QueryIoMapping(Core::System& system, uintptr_t* out_address, uintptr_t* out_size, +Result QueryIoMapping(Core::System& system, uint64_t* out_address, uint64_t* out_size, uint64_t physical_address, uint64_t size) { UNIMPLEMENTED(); R_THROW(ResultNotImplemented); @@ -23,7 +23,7 @@ Result QueryPhysicalAddress64(Core::System& system, lp64::PhysicalMemoryInfo* ou R_RETURN(QueryPhysicalAddress(system, out_info, address)); } -Result QueryIoMapping64(Core::System& system, uintptr_t* out_address, uintptr_t* out_size, +Result QueryIoMapping64(Core::System& system, uint64_t* out_address, uint64_t* out_size, uint64_t physical_address, uint64_t size) { R_RETURN(QueryIoMapping(system, out_address, out_size, physical_address, size)); } @@ -41,10 +41,10 @@ Result QueryPhysicalAddress64From32(Core::System& system, ilp32::PhysicalMemoryI R_SUCCEED(); } -Result QueryIoMapping64From32(Core::System& system, uintptr_t* out_address, uintptr_t* out_size, +Result QueryIoMapping64From32(Core::System& system, uint64_t* out_address, uint64_t* out_size, uint64_t physical_address, uint32_t size) { - R_RETURN(QueryIoMapping(system, reinterpret_cast<uintptr_t*>(out_address), - reinterpret_cast<uintptr_t*>(out_size), physical_address, size)); + R_RETURN(QueryIoMapping(system, reinterpret_cast<uint64_t*>(out_address), + reinterpret_cast<uint64_t*>(out_size), physical_address, size)); } } // namespace Kernel::Svc diff --git a/src/core/hle/kernel/svc/svc_cache.cpp b/src/core/hle/kernel/svc/svc_cache.cpp index 598b71da5..1779832d3 100644 --- a/src/core/hle/kernel/svc/svc_cache.cpp +++ b/src/core/hle/kernel/svc/svc_cache.cpp @@ -13,7 +13,7 @@ void FlushEntireDataCache(Core::System& system) { UNIMPLEMENTED(); } -Result FlushDataCache(Core::System& system, VAddr address, size_t size) { +Result FlushDataCache(Core::System& system, uint64_t address, uint64_t size) { UNIMPLEMENTED(); R_THROW(ResultNotImplemented); } @@ -33,8 +33,8 @@ Result StoreProcessDataCache(Core::System& system, Handle process_handle, uint64 Result FlushProcessDataCache(Core::System& system, Handle process_handle, u64 address, u64 size) { // Validate address/size. R_UNLESS(size > 0, ResultInvalidSize); - R_UNLESS(address == static_cast<uintptr_t>(address), ResultInvalidCurrentMemory); - R_UNLESS(size == static_cast<size_t>(size), ResultInvalidCurrentMemory); + R_UNLESS(address == static_cast<uint64_t>(address), ResultInvalidCurrentMemory); + R_UNLESS(size == static_cast<uint64_t>(size), ResultInvalidCurrentMemory); // Get the process from its handle. KScopedAutoObject process = @@ -53,7 +53,7 @@ void FlushEntireDataCache64(Core::System& system) { FlushEntireDataCache(system); } -Result FlushDataCache64(Core::System& system, VAddr address, size_t size) { +Result FlushDataCache64(Core::System& system, uint64_t address, uint64_t size) { R_RETURN(FlushDataCache(system, address, size)); } diff --git a/src/core/hle/kernel/svc/svc_code_memory.cpp b/src/core/hle/kernel/svc/svc_code_memory.cpp index 538ff1c71..8bed747af 100644 --- a/src/core/hle/kernel/svc/svc_code_memory.cpp +++ b/src/core/hle/kernel/svc/svc_code_memory.cpp @@ -28,7 +28,7 @@ constexpr bool IsValidUnmapFromOwnerCodeMemoryPermission(MemoryPermission perm) } // namespace -Result CreateCodeMemory(Core::System& system, Handle* out, VAddr address, size_t size) { +Result CreateCodeMemory(Core::System& system, Handle* out, VAddr address, uint64_t size) { LOG_TRACE(Kernel_SVC, "called, address=0x{:X}, size=0x{:X}", address, size); // Get kernel instance. @@ -64,7 +64,7 @@ Result CreateCodeMemory(Core::System& system, Handle* out, VAddr address, size_t } Result ControlCodeMemory(Core::System& system, Handle code_memory_handle, - CodeMemoryOperation operation, VAddr address, size_t size, + CodeMemoryOperation operation, VAddr address, uint64_t size, MemoryPermission perm) { LOG_TRACE(Kernel_SVC, diff --git a/src/core/hle/kernel/svc/svc_debug.cpp b/src/core/hle/kernel/svc/svc_debug.cpp index a14050fa7..a4d1f700e 100644 --- a/src/core/hle/kernel/svc/svc_debug.cpp +++ b/src/core/hle/kernel/svc/svc_debug.cpp @@ -45,19 +45,19 @@ Result SetDebugThreadContext(Core::System& system, Handle debug_handle, uint64_t } Result QueryDebugProcessMemory(Core::System& system, uint64_t out_memory_info, - PageInfo* out_page_info, Handle debug_handle, uintptr_t address) { + PageInfo* out_page_info, Handle process_handle, uint64_t address) { UNIMPLEMENTED(); R_THROW(ResultNotImplemented); } -Result ReadDebugProcessMemory(Core::System& system, uintptr_t buffer, Handle debug_handle, - uintptr_t address, size_t size) { +Result ReadDebugProcessMemory(Core::System& system, uint64_t buffer, Handle debug_handle, + uint64_t address, uint64_t size) { UNIMPLEMENTED(); R_THROW(ResultNotImplemented); } -Result WriteDebugProcessMemory(Core::System& system, Handle debug_handle, uintptr_t buffer, - uintptr_t address, size_t size) { +Result WriteDebugProcessMemory(Core::System& system, Handle debug_handle, uint64_t buffer, + uint64_t address, uint64_t size) { UNIMPLEMENTED(); R_THROW(ResultNotImplemented); } diff --git a/src/core/hle/kernel/svc/svc_device_address_space.cpp b/src/core/hle/kernel/svc/svc_device_address_space.cpp index f68c0e6a9..ec3143e67 100644 --- a/src/core/hle/kernel/svc/svc_device_address_space.cpp +++ b/src/core/hle/kernel/svc/svc_device_address_space.cpp @@ -76,8 +76,8 @@ constexpr bool IsValidDeviceMemoryPermission(MemoryPermission device_perm) { } Result MapDeviceAddressSpaceByForce(Core::System& system, Handle das_handle, Handle process_handle, - uint64_t process_address, size_t size, uint64_t device_address, - u32 option) { + uint64_t process_address, uint64_t size, + uint64_t device_address, u32 option) { // Decode the option. const MapDeviceAddressSpaceOption option_pack{option}; const auto device_perm = option_pack.permission; @@ -90,7 +90,7 @@ Result MapDeviceAddressSpaceByForce(Core::System& system, Handle das_handle, Han R_UNLESS(size > 0, ResultInvalidSize); R_UNLESS((process_address < process_address + size), ResultInvalidCurrentMemory); R_UNLESS((device_address < device_address + size), ResultInvalidMemoryRegion); - R_UNLESS((process_address == static_cast<uintptr_t>(process_address)), + R_UNLESS((process_address == static_cast<uint64_t>(process_address)), ResultInvalidCurrentMemory); R_UNLESS(IsValidDeviceMemoryPermission(device_perm), ResultInvalidNewMemoryPermission); R_UNLESS(reserved == 0, ResultInvalidEnumValue); @@ -116,8 +116,8 @@ Result MapDeviceAddressSpaceByForce(Core::System& system, Handle das_handle, Han } Result MapDeviceAddressSpaceAligned(Core::System& system, Handle das_handle, Handle process_handle, - uint64_t process_address, size_t size, uint64_t device_address, - u32 option) { + uint64_t process_address, uint64_t size, + uint64_t device_address, u32 option) { // Decode the option. const MapDeviceAddressSpaceOption option_pack{option}; const auto device_perm = option_pack.permission; @@ -131,7 +131,7 @@ Result MapDeviceAddressSpaceAligned(Core::System& system, Handle das_handle, Han R_UNLESS(size > 0, ResultInvalidSize); R_UNLESS((process_address < process_address + size), ResultInvalidCurrentMemory); R_UNLESS((device_address < device_address + size), ResultInvalidMemoryRegion); - R_UNLESS((process_address == static_cast<uintptr_t>(process_address)), + R_UNLESS((process_address == static_cast<uint64_t>(process_address)), ResultInvalidCurrentMemory); R_UNLESS(IsValidDeviceMemoryPermission(device_perm), ResultInvalidNewMemoryPermission); R_UNLESS(reserved == 0, ResultInvalidEnumValue); @@ -157,7 +157,7 @@ Result MapDeviceAddressSpaceAligned(Core::System& system, Handle das_handle, Han } Result UnmapDeviceAddressSpace(Core::System& system, Handle das_handle, Handle process_handle, - uint64_t process_address, size_t size, uint64_t device_address) { + uint64_t process_address, uint64_t size, uint64_t device_address) { // Validate input. R_UNLESS(Common::IsAligned(process_address, PageSize), ResultInvalidAddress); R_UNLESS(Common::IsAligned(device_address, PageSize), ResultInvalidAddress); @@ -165,7 +165,7 @@ Result UnmapDeviceAddressSpace(Core::System& system, Handle das_handle, Handle p R_UNLESS(size > 0, ResultInvalidSize); R_UNLESS((process_address < process_address + size), ResultInvalidCurrentMemory); R_UNLESS((device_address < device_address + size), ResultInvalidMemoryRegion); - R_UNLESS((process_address == static_cast<uintptr_t>(process_address)), + R_UNLESS((process_address == static_cast<uint64_t>(process_address)), ResultInvalidCurrentMemory); // Get the device address space. diff --git a/src/core/hle/kernel/svc/svc_insecure_memory.cpp b/src/core/hle/kernel/svc/svc_insecure_memory.cpp index 79882685d..00457c6bf 100644 --- a/src/core/hle/kernel/svc/svc_insecure_memory.cpp +++ b/src/core/hle/kernel/svc/svc_insecure_memory.cpp @@ -6,12 +6,12 @@ namespace Kernel::Svc { -Result MapInsecureMemory(Core::System& system, uintptr_t address, size_t size) { +Result MapInsecureMemory(Core::System& system, uint64_t address, uint64_t size) { UNIMPLEMENTED(); R_THROW(ResultNotImplemented); } -Result UnmapInsecureMemory(Core::System& system, uintptr_t address, size_t size) { +Result UnmapInsecureMemory(Core::System& system, uint64_t address, uint64_t size) { UNIMPLEMENTED(); R_THROW(ResultNotImplemented); } diff --git a/src/core/hle/kernel/svc/svc_io_pool.cpp b/src/core/hle/kernel/svc/svc_io_pool.cpp index 33f3d69bf..f01817e24 100644 --- a/src/core/hle/kernel/svc/svc_io_pool.cpp +++ b/src/core/hle/kernel/svc/svc_io_pool.cpp @@ -12,19 +12,19 @@ Result CreateIoPool(Core::System& system, Handle* out, IoPoolType pool_type) { } Result CreateIoRegion(Core::System& system, Handle* out, Handle io_pool_handle, uint64_t phys_addr, - size_t size, MemoryMapping mapping, MemoryPermission perm) { + uint64_t size, MemoryMapping mapping, MemoryPermission perm) { UNIMPLEMENTED(); R_THROW(ResultNotImplemented); } -Result MapIoRegion(Core::System& system, Handle io_region_handle, uintptr_t address, size_t size, +Result MapIoRegion(Core::System& system, Handle io_region_handle, uint64_t address, uint64_t size, MemoryPermission map_perm) { UNIMPLEMENTED(); R_THROW(ResultNotImplemented); } -Result UnmapIoRegion(Core::System& system, Handle io_region_handle, uintptr_t address, - size_t size) { +Result UnmapIoRegion(Core::System& system, Handle io_region_handle, uint64_t address, + uint64_t size) { UNIMPLEMENTED(); R_THROW(ResultNotImplemented); } diff --git a/src/core/hle/kernel/svc/svc_physical_memory.cpp b/src/core/hle/kernel/svc/svc_physical_memory.cpp index a1f534454..ed6a624ac 100644 --- a/src/core/hle/kernel/svc/svc_physical_memory.cpp +++ b/src/core/hle/kernel/svc/svc_physical_memory.cpp @@ -158,7 +158,7 @@ Result SetUnsafeLimit64(Core::System& system, uint64_t limit) { R_RETURN(SetUnsafeLimit(system, limit)); } -Result SetHeapSize64From32(Core::System& system, uintptr_t* out_address, uint32_t size) { +Result SetHeapSize64From32(Core::System& system, uint64_t* out_address, uint32_t size) { R_RETURN(SetHeapSize(system, out_address, size)); } diff --git a/src/core/hle/kernel/svc/svc_port.cpp b/src/core/hle/kernel/svc/svc_port.cpp index ac095b338..78c2a8d17 100644 --- a/src/core/hle/kernel/svc/svc_port.cpp +++ b/src/core/hle/kernel/svc/svc_port.cpp @@ -49,7 +49,7 @@ Result ConnectToNamedPort(Core::System& system, Handle* out, VAddr user_name) { } Result CreatePort(Core::System& system, Handle* out_server, Handle* out_client, - int32_t max_sessions, bool is_light, uintptr_t name) { + int32_t max_sessions, bool is_light, uint64_t name) { UNIMPLEMENTED(); R_THROW(ResultNotImplemented); } diff --git a/src/core/hle/kernel/svc/svc_process_memory.cpp b/src/core/hle/kernel/svc/svc_process_memory.cpp index 4dfd9e5bb..8e2fb4092 100644 --- a/src/core/hle/kernel/svc/svc_process_memory.cpp +++ b/src/core/hle/kernel/svc/svc_process_memory.cpp @@ -37,8 +37,8 @@ Result SetProcessMemoryPermission(Core::System& system, Handle process_handle, V R_UNLESS(Common::IsAligned(size, PageSize), ResultInvalidSize); R_UNLESS(size > 0, ResultInvalidSize); R_UNLESS((address < address + size), ResultInvalidCurrentMemory); - R_UNLESS(address == static_cast<uintptr_t>(address), ResultInvalidCurrentMemory); - R_UNLESS(size == static_cast<size_t>(size), ResultInvalidCurrentMemory); + R_UNLESS(address == static_cast<uint64_t>(address), ResultInvalidCurrentMemory); + R_UNLESS(size == static_cast<uint64_t>(size), ResultInvalidCurrentMemory); // Validate the memory permission. R_UNLESS(IsValidProcessMemoryPermission(perm), ResultInvalidNewMemoryPermission); diff --git a/src/core/hle/kernel/svc_generator.py b/src/core/hle/kernel/svc_generator.py index 34d2ac659..0cce69e85 100644 --- a/src/core/hle/kernel/svc_generator.py +++ b/src/core/hle/kernel/svc_generator.py @@ -443,7 +443,7 @@ def emit_wrapper(wrapped_fn, suffix, register_info, arguments, byte_size): lines.append("") for output_type, var_name, _, is_address in output_writes: - output_type = "uintptr_t" if is_address else output_type + output_type = "uint64_t" if is_address else output_type lines.append(f"{output_type} {var_name}{{}};") for input_type, var_name, _ in input_reads: lines.append(f"{input_type} {var_name}{{}};") @@ -630,7 +630,7 @@ def emit_call(bitness, names, suffix): def build_fn_declaration(return_type, name, arguments): arg_list = ["Core::System& system"] for arg in arguments: - type_name = "uintptr_t" if arg.is_address else arg.type_name + type_name = "uint64_t" if arg.is_address else arg.type_name pointer = "*" if arg.is_output and not arg.is_outptr else "" arg_list.append(f"{type_name}{pointer} {arg.var_name}") diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 5eefa2e82..c3e5c4462 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -77,6 +77,8 @@ public: {141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+ {142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+ {150, nullptr, "CreateAuthorizationRequest"}, + {160, nullptr, "RequiresUpdateNetworkServiceAccountIdTokenCache"}, + {161, nullptr, "RequireReauthenticationOfNetworkServiceAccount"}, }; // clang-format on @@ -137,7 +139,10 @@ public: {140, nullptr, "GetNetworkServiceLicenseCache"}, // 5.0.0+ {141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+ {142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+ + {143, nullptr, "GetNetworkServiceLicenseCacheEx"}, {150, nullptr, "CreateAuthorizationRequest"}, + {160, nullptr, "RequiresUpdateNetworkServiceAccountIdTokenCache"}, + {161, nullptr, "RequireReauthenticationOfNetworkServiceAccount"}, {200, nullptr, "IsRegistered"}, {201, nullptr, "RegisterAsync"}, {202, nullptr, "UnregisterAsync"}, @@ -243,6 +248,7 @@ public: {100, nullptr, "GetRequestWithTheme"}, {101, nullptr, "IsNetworkServiceAccountReplaced"}, {199, nullptr, "GetUrlForIntroductionOfExtraMembership"}, // 2.0.0 - 5.1.0 + {200, nullptr, "ApplyAsyncWithAuthorizedToken"}, }; // clang-format on @@ -648,9 +654,11 @@ public: {0, nullptr, "EnsureAuthenticationTokenCacheAsync"}, {1, nullptr, "LoadAuthenticationTokenCache"}, {2, nullptr, "InvalidateAuthenticationTokenCache"}, + {3, nullptr, "IsDeviceAuthenticationTokenCacheAvailable"}, {10, nullptr, "EnsureEdgeTokenCacheAsync"}, {11, nullptr, "LoadEdgeTokenCache"}, {12, nullptr, "InvalidateEdgeTokenCache"}, + {13, nullptr, "IsEdgeTokenCacheAvailable"}, {20, nullptr, "EnsureApplicationAuthenticationCacheAsync"}, {21, nullptr, "LoadApplicationAuthenticationTokenCache"}, {22, nullptr, "LoadApplicationNetworkServiceClientConfigCache"}, diff --git a/src/core/hle/service/acc/acc_su.cpp b/src/core/hle/service/acc/acc_su.cpp index b6bfd6155..d9882ecd3 100644 --- a/src/core/hle/service/acc/acc_su.cpp +++ b/src/core/hle/service/acc/acc_su.cpp @@ -55,6 +55,10 @@ ACC_SU::ACC_SU(std::shared_ptr<Module> module_, std::shared_ptr<ProfileManager> {290, nullptr, "ProxyProcedureForGuestLoginWithNintendoAccount"}, {291, nullptr, "ProxyProcedureForFloatingRegistrationWithNintendoAccount"}, {299, nullptr, "SuspendBackgroundDaemon"}, + {900, nullptr, "SetUserUnqualifiedForDebug"}, + {901, nullptr, "UnsetUserUnqualifiedForDebug"}, + {902, nullptr, "ListUsersUnqualifiedForDebug"}, + {910, nullptr, "RefreshFirmwareSettingsForDebug"}, {997, nullptr, "DebugInvalidateTokenCacheForUser"}, {998, nullptr, "DebugSetUserStateClose"}, {999, nullptr, "DebugSetUserStateOpen"}, diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 979881512..3cd772b83 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -227,6 +227,8 @@ IDebugFunctions::IDebugFunctions(Core::System& system_) {30, nullptr, "RequestLaunchApplicationWithUserAndArgumentForDebug"}, {31, nullptr, "RequestLaunchApplicationByApplicationLaunchInfoForDebug"}, {40, nullptr, "GetAppletResourceUsageInfo"}, + {50, nullptr, "AddSystemProgramIdAndAppletIdForDebug"}, + {51, nullptr, "AddOperationConfirmedLibraryAppletIdForDebug"}, {100, nullptr, "SetCpuBoostModeForApplet"}, {101, nullptr, "CancelCpuBoostModeForApplet"}, {110, nullptr, "PushToAppletBoundChannelForDebug"}, @@ -238,6 +240,8 @@ IDebugFunctions::IDebugFunctions(Core::System& system_) {131, nullptr, "FriendInvitationClearApplicationParameter"}, {132, nullptr, "FriendInvitationPushApplicationParameter"}, {140, nullptr, "RestrictPowerOperationForSecureLaunchModeForDebug"}, + {200, nullptr, "CreateFloatingLibraryAppletAccepterForDebug"}, + {300, nullptr, "TerminateAllRunningApplicationsForDebug"}, {900, nullptr, "GetGrcProcessLaunchedSystemEvent"}, }; // clang-format on @@ -1261,9 +1265,8 @@ void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContex return; } - const u8* const mem_begin = system.Memory().GetPointer(transfer_mem->GetSourceAddress()); - const u8* const mem_end = mem_begin + transfer_mem->GetSize(); - std::vector<u8> memory{mem_begin, mem_end}; + std::vector<u8> memory(transfer_mem->GetSize()); + system.Memory().ReadBlock(transfer_mem->GetSourceAddress(), memory.data(), memory.size()); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); @@ -1295,9 +1298,8 @@ void ILibraryAppletCreator::CreateHandleStorage(Kernel::HLERequestContext& ctx) return; } - const u8* const mem_begin = system.Memory().GetPointer(transfer_mem->GetSourceAddress()); - const u8* const mem_end = mem_begin + transfer_mem->GetSize(); - std::vector<u8> memory{mem_begin, mem_end}; + std::vector<u8> memory(transfer_mem->GetSize()); + system.Memory().ReadBlock(transfer_mem->GetSourceAddress(), memory.data(), memory.size()); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); @@ -1860,6 +1862,8 @@ IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_) {31, nullptr, "GetWriterLockAccessorEx"}, {40, nullptr, "IsSleepEnabled"}, {41, nullptr, "IsRebootEnabled"}, + {50, nullptr, "LaunchSystemApplet"}, + {51, nullptr, "LaunchStarter"}, {100, nullptr, "PopRequestLaunchApplicationForDebug"}, {110, nullptr, "IsForceTerminateApplicationDisabledForDebug"}, {200, nullptr, "LaunchDevMenu"}, diff --git a/src/core/hle/service/aoc/aoc_u.cpp b/src/core/hle/service/aoc/aoc_u.cpp index c4cd1d0d5..fed51cfd6 100644 --- a/src/core/hle/service/aoc/aoc_u.cpp +++ b/src/core/hle/service/aoc/aoc_u.cpp @@ -130,6 +130,9 @@ AOC_U::AOC_U(Core::System& system_) {101, &AOC_U::CreatePermanentEcPurchasedEventManager, "CreatePermanentEcPurchasedEventManager"}, {110, nullptr, "CreateContentsServiceManager"}, {200, nullptr, "SetRequiredAddOnContentsOnContentsAvailabilityTransition"}, + {300, nullptr, "SetupHostAddOnContent"}, + {301, nullptr, "GetRegisteredAddOnContentPath"}, + {302, nullptr, "UpdateCachedList"}, }; // clang-format on diff --git a/src/core/hle/service/audio/hwopus.cpp b/src/core/hle/service/audio/hwopus.cpp index e01f87356..3db3fe188 100644 --- a/src/core/hle/service/audio/hwopus.cpp +++ b/src/core/hle/service/audio/hwopus.cpp @@ -362,6 +362,8 @@ HwOpus::HwOpus(Core::System& system_) : ServiceFramework{system_, "hwopus"} { {5, &HwOpus::GetWorkBufferSizeEx, "GetWorkBufferSizeEx"}, {6, nullptr, "OpenHardwareOpusDecoderForMultiStreamEx"}, {7, &HwOpus::GetWorkBufferSizeForMultiStreamEx, "GetWorkBufferSizeForMultiStreamEx"}, + {8, nullptr, "GetWorkBufferSizeExEx"}, + {9, nullptr, "GetWorkBufferSizeForMultiStreamExEx"}, }; RegisterHandlers(functions); } diff --git a/src/core/hle/service/btm/btm.cpp b/src/core/hle/service/btm/btm.cpp index e068ea87f..dbd9d6a88 100644 --- a/src/core/hle/service/btm/btm.cpp +++ b/src/core/hle/service/btm/btm.cpp @@ -73,32 +73,36 @@ private: void AcquireBleScanEvent(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_BTM, "(STUBBED) called"); - IPC::ResponseBuilder rb{ctx, 2, 1}; + IPC::ResponseBuilder rb{ctx, 3, 1}; rb.Push(ResultSuccess); + rb.Push(true); rb.PushCopyObjects(scan_event->GetReadableEvent()); } void AcquireBleConnectionEvent(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_BTM, "(STUBBED) called"); - IPC::ResponseBuilder rb{ctx, 2, 1}; + IPC::ResponseBuilder rb{ctx, 3, 1}; rb.Push(ResultSuccess); + rb.Push(true); rb.PushCopyObjects(connection_event->GetReadableEvent()); } void AcquireBleServiceDiscoveryEvent(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_BTM, "(STUBBED) called"); - IPC::ResponseBuilder rb{ctx, 2, 1}; + IPC::ResponseBuilder rb{ctx, 3, 1}; rb.Push(ResultSuccess); + rb.Push(true); rb.PushCopyObjects(service_discovery_event->GetReadableEvent()); } void AcquireBleMtuConfigEvent(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_BTM, "(STUBBED) called"); - IPC::ResponseBuilder rb{ctx, 2, 1}; + IPC::ResponseBuilder rb{ctx, 3, 1}; rb.Push(ResultSuccess); + rb.Push(true); rb.PushCopyObjects(config_event->GetReadableEvent()); } diff --git a/src/core/hle/service/hid/controllers/console_sixaxis.cpp b/src/core/hle/service/hid/controllers/console_sixaxis.cpp index bb3cba910..478d38590 100644 --- a/src/core/hle/service/hid/controllers/console_sixaxis.cpp +++ b/src/core/hle/service/hid/controllers/console_sixaxis.cpp @@ -1,17 +1,18 @@ // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include "core/core.h" #include "core/core_timing.h" #include "core/hid/emulated_console.h" #include "core/hid/hid_core.h" #include "core/hle/service/hid/controllers/console_sixaxis.h" +#include "core/memory.h" namespace Service::HID { constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3C200; -Controller_ConsoleSixAxis::Controller_ConsoleSixAxis(Core::HID::HIDCore& hid_core_, - u8* raw_shared_memory_) - : ControllerBase{hid_core_} { +Controller_ConsoleSixAxis::Controller_ConsoleSixAxis(Core::System& system_, u8* raw_shared_memory_) + : ControllerBase{system_.HIDCore()}, system{system_} { console = hid_core.GetEmulatedConsole(); static_assert(SHARED_MEMORY_OFFSET + sizeof(ConsoleSharedMemory) < shared_memory_size, "ConsoleSharedMemory is bigger than the shared memory"); @@ -26,7 +27,7 @@ void Controller_ConsoleSixAxis::OnInit() {} void Controller_ConsoleSixAxis::OnRelease() {} void Controller_ConsoleSixAxis::OnUpdate(const Core::Timing::CoreTiming& core_timing) { - if (!IsControllerActivated() || !is_transfer_memory_set) { + if (!IsControllerActivated() || transfer_memory == 0) { seven_sixaxis_lifo.buffer_count = 0; seven_sixaxis_lifo.buffer_tail = 0; return; @@ -59,11 +60,10 @@ void Controller_ConsoleSixAxis::OnUpdate(const Core::Timing::CoreTiming& core_ti // Update seven six axis transfer memory seven_sixaxis_lifo.WriteNextEntry(next_seven_sixaxis_state); - std::memcpy(transfer_memory, &seven_sixaxis_lifo, sizeof(seven_sixaxis_lifo)); + system.Memory().WriteBlock(transfer_memory, &seven_sixaxis_lifo, sizeof(seven_sixaxis_lifo)); } -void Controller_ConsoleSixAxis::SetTransferMemoryPointer(u8* t_mem) { - is_transfer_memory_set = true; +void Controller_ConsoleSixAxis::SetTransferMemoryAddress(VAddr t_mem) { transfer_memory = t_mem; } diff --git a/src/core/hle/service/hid/controllers/console_sixaxis.h b/src/core/hle/service/hid/controllers/console_sixaxis.h index 2fd11538f..8d3e4081b 100644 --- a/src/core/hle/service/hid/controllers/console_sixaxis.h +++ b/src/core/hle/service/hid/controllers/console_sixaxis.h @@ -10,6 +10,10 @@ #include "core/hle/service/hid/controllers/controller_base.h" #include "core/hle/service/hid/ring_lifo.h" +namespace Core { +class System; +} // namespace Core + namespace Core::HID { class EmulatedConsole; } // namespace Core::HID @@ -17,7 +21,7 @@ class EmulatedConsole; namespace Service::HID { class Controller_ConsoleSixAxis final : public ControllerBase { public: - explicit Controller_ConsoleSixAxis(Core::HID::HIDCore& hid_core_, u8* raw_shared_memory_); + explicit Controller_ConsoleSixAxis(Core::System& system_, u8* raw_shared_memory_); ~Controller_ConsoleSixAxis() override; // Called when the controller is initialized @@ -30,7 +34,7 @@ public: void OnUpdate(const Core::Timing::CoreTiming& core_timing) override; // Called on InitializeSevenSixAxisSensor - void SetTransferMemoryPointer(u8* t_mem); + void SetTransferMemoryAddress(VAddr t_mem); // Called on ResetSevenSixAxisSensorTimestamp void ResetTimestamp(); @@ -62,12 +66,13 @@ private: static_assert(sizeof(seven_sixaxis_lifo) == 0xA70, "SevenSixAxisState is an invalid size"); SevenSixAxisState next_seven_sixaxis_state{}; - u8* transfer_memory = nullptr; + VAddr transfer_memory{}; ConsoleSharedMemory* shared_memory = nullptr; Core::HID::EmulatedConsole* console = nullptr; - bool is_transfer_memory_set = false; u64 last_saved_timestamp{}; u64 last_global_timestamp{}; + + Core::System& system; }; } // namespace Service::HID diff --git a/src/core/hle/service/hid/controllers/gesture.cpp b/src/core/hle/service/hid/controllers/gesture.cpp index 32e0708ba..de0090cc5 100644 --- a/src/core/hle/service/hid/controllers/gesture.cpp +++ b/src/core/hle/service/hid/controllers/gesture.cpp @@ -65,6 +65,11 @@ void Controller_Gesture::OnUpdate(const Core::Timing::CoreTiming& core_timing) { } void Controller_Gesture::ReadTouchInput() { + if (!Settings::values.touchscreen.enabled) { + fingers = {}; + return; + } + const auto touch_status = console->GetTouch(); for (std::size_t id = 0; id < fingers.size(); ++id) { fingers[id] = touch_status[id]; diff --git a/src/core/hle/service/hid/controllers/mouse.cpp b/src/core/hle/service/hid/controllers/mouse.cpp index b11cb438d..0afc66681 100644 --- a/src/core/hle/service/hid/controllers/mouse.cpp +++ b/src/core/hle/service/hid/controllers/mouse.cpp @@ -33,10 +33,11 @@ void Controller_Mouse::OnUpdate(const Core::Timing::CoreTiming& core_timing) { return; } + next_state = {}; + const auto& last_entry = shared_memory->mouse_lifo.ReadCurrentEntry().state; next_state.sampling_number = last_entry.sampling_number + 1; - next_state.attribute.raw = 0; if (Settings::values.mouse_enabled) { const auto& mouse_button_state = emulated_devices->GetMouseButtons(); const auto& mouse_position_state = emulated_devices->GetMousePosition(); diff --git a/src/core/hle/service/hid/controllers/palma.cpp b/src/core/hle/service/hid/controllers/palma.cpp index 4564ea1e2..bce51285c 100644 --- a/src/core/hle/service/hid/controllers/palma.cpp +++ b/src/core/hle/service/hid/controllers/palma.cpp @@ -152,7 +152,7 @@ Result Controller_Palma::WritePalmaRgbLedPatternEntry(const PalmaConnectionHandl } Result Controller_Palma::WritePalmaWaveEntry(const PalmaConnectionHandle& handle, PalmaWaveSet wave, - u8* t_mem, u64 size) { + VAddr t_mem, u64 size) { if (handle.npad_id != active_handle.npad_id) { return InvalidPalmaHandle; } diff --git a/src/core/hle/service/hid/controllers/palma.h b/src/core/hle/service/hid/controllers/palma.h index 1d7fc94e1..cf62f0dbc 100644 --- a/src/core/hle/service/hid/controllers/palma.h +++ b/src/core/hle/service/hid/controllers/palma.h @@ -125,7 +125,7 @@ public: Result ReadPalmaUniqueCode(const PalmaConnectionHandle& handle); Result SetPalmaUniqueCodeInvalid(const PalmaConnectionHandle& handle); Result WritePalmaRgbLedPatternEntry(const PalmaConnectionHandle& handle, u64 unknown); - Result WritePalmaWaveEntry(const PalmaConnectionHandle& handle, PalmaWaveSet wave, u8* t_mem, + Result WritePalmaWaveEntry(const PalmaConnectionHandle& handle, PalmaWaveSet wave, VAddr t_mem, u64 size); Result SetPalmaDataBaseIdentificationVersion(const PalmaConnectionHandle& handle, s32 database_id_version_); diff --git a/src/core/hle/service/hid/controllers/touchscreen.cpp b/src/core/hle/service/hid/controllers/touchscreen.cpp index 1da8d3eb0..d90a4e732 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.cpp +++ b/src/core/hle/service/hid/controllers/touchscreen.cpp @@ -58,6 +58,11 @@ void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timin } if (!finger.pressed && current_touch.pressed) { + // Ignore all touch fingers if disabled + if (!Settings::values.touchscreen.enabled) { + continue; + } + finger.attribute.start_touch.Assign(1); finger.pressed = true; finger.position = current_touch.position; diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 5ec31950a..4b5130469 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -64,6 +64,7 @@ IAppletResource::IAppletResource(Core::System& system_, MakeControllerWithServiceContext<Controller_NPad>(HidController::NPad, shared_memory); MakeController<Controller_Gesture>(HidController::Gesture, shared_memory); MakeController<Controller_ConsoleSixAxis>(HidController::ConsoleSixAxisSensor, shared_memory); + MakeController<Controller_Stubbed>(HidController::DebugMouse, shared_memory); MakeControllerWithServiceContext<Controller_Palma>(HidController::Palma, shared_memory); // Homebrew doesn't try to activate some controllers, so we activate them by default @@ -75,6 +76,7 @@ IAppletResource::IAppletResource(Core::System& system_, GetController<Controller_Stubbed>(HidController::CaptureButton).SetCommonHeaderOffset(0x5000); GetController<Controller_Stubbed>(HidController::InputDetector).SetCommonHeaderOffset(0x5200); GetController<Controller_Stubbed>(HidController::UniquePad).SetCommonHeaderOffset(0x5A00); + GetController<Controller_Stubbed>(HidController::DebugMouse).SetCommonHeaderOffset(0x3DC00); // Register update callbacks npad_update_event = Core::Timing::CreateEvent( @@ -237,6 +239,7 @@ Hid::Hid(Core::System& system_) {1, &Hid::ActivateDebugPad, "ActivateDebugPad"}, {11, &Hid::ActivateTouchScreen, "ActivateTouchScreen"}, {21, &Hid::ActivateMouse, "ActivateMouse"}, + {26, nullptr, "ActivateDebugMouse"}, {31, &Hid::ActivateKeyboard, "ActivateKeyboard"}, {32, &Hid::SendKeyboardLockKeyEvent, "SendKeyboardLockKeyEvent"}, {40, nullptr, "AcquireXpadIdEventHandle"}, @@ -1859,7 +1862,7 @@ void Hid::InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) { .ActivateController(); applet_resource->GetController<Controller_ConsoleSixAxis>(HidController::ConsoleSixAxisSensor) - .SetTransferMemoryPointer(system.Memory().GetPointer(t_mem_1->GetSourceAddress())); + .SetTransferMemoryAddress(t_mem_1->GetSourceAddress()); LOG_WARNING(Service_HID, "called, t_mem_1_handle=0x{:08X}, t_mem_2_handle=0x{:08X}, " @@ -2146,8 +2149,7 @@ void Hid::WritePalmaWaveEntry(Kernel::HLERequestContext& ctx) { connection_handle.npad_id, wave_set, unknown, t_mem_handle, t_mem_size, size); applet_resource->GetController<Controller_Palma>(HidController::Palma) - .WritePalmaWaveEntry(connection_handle, wave_set, - system.Memory().GetPointer(t_mem->GetSourceAddress()), t_mem_size); + .WritePalmaWaveEntry(connection_handle, wave_set, t_mem->GetSourceAddress(), t_mem_size); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); @@ -2381,6 +2383,8 @@ public: {20, nullptr, "DeactivateMouse"}, {21, nullptr, "SetMouseAutoPilotState"}, {22, nullptr, "UnsetMouseAutoPilotState"}, + {25, nullptr, "SetDebugMouseAutoPilotState"}, + {26, nullptr, "UnsetDebugMouseAutoPilotState"}, {30, nullptr, "DeactivateKeyboard"}, {31, nullptr, "SetKeyboardAutoPilotState"}, {32, nullptr, "UnsetKeyboardAutoPilotState"}, @@ -2496,6 +2500,7 @@ public: {2000, nullptr, "DeactivateDigitizer"}, {2001, nullptr, "SetDigitizerAutoPilotState"}, {2002, nullptr, "UnsetDigitizerAutoPilotState"}, + {2002, nullptr, "ReloadFirmwareDebugSettings"}, }; // clang-format on diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index dc3c45aba..9563654b6 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h @@ -33,6 +33,7 @@ enum class HidController : std::size_t { NPad, Gesture, ConsoleSixAxisSensor, + DebugMouse, Palma, MaxControllers, @@ -60,9 +61,15 @@ public: private: template <typename T> void MakeController(HidController controller, u8* shared_memory) { - controllers[static_cast<std::size_t>(controller)] = - std::make_unique<T>(system.HIDCore(), shared_memory); + if constexpr (std::is_constructible_v<T, Core::System&, u8*>) { + controllers[static_cast<std::size_t>(controller)] = + std::make_unique<T>(system, shared_memory); + } else { + controllers[static_cast<std::size_t>(controller)] = + std::make_unique<T>(system.HIDCore(), shared_memory); + } } + template <typename T> void MakeControllerWithServiceContext(HidController controller, u8* shared_memory) { controllers[static_cast<std::size_t>(controller)] = diff --git a/src/core/hle/service/hid/hidbus.cpp b/src/core/hle/service/hid/hidbus.cpp index bd94e8f3d..07199d5d5 100644 --- a/src/core/hle/service/hid/hidbus.cpp +++ b/src/core/hle/service/hid/hidbus.cpp @@ -91,7 +91,7 @@ std::optional<std::size_t> HidBus::GetDeviceIndexFromHandle(BusHandle handle) co if (handle.abstracted_pad_id == device_handle.abstracted_pad_id && handle.internal_index == device_handle.internal_index && handle.player_number == device_handle.player_number && - handle.bus_type == device_handle.bus_type && + handle.bus_type_id == device_handle.bus_type_id && handle.is_valid == device_handle.is_valid) { return i; } @@ -123,7 +123,7 @@ void HidBus::GetBusHandle(Kernel::HLERequestContext& ctx) { continue; } if (static_cast<Core::HID::NpadIdType>(handle.player_number) == parameters.npad_id && - handle.bus_type == parameters.bus_type) { + handle.bus_type_id == static_cast<u8>(parameters.bus_type)) { is_handle_found = true; handle_index = i; break; @@ -140,7 +140,7 @@ void HidBus::GetBusHandle(Kernel::HLERequestContext& ctx) { .abstracted_pad_id = static_cast<u8>(i), .internal_index = static_cast<u8>(i), .player_number = static_cast<u8>(parameters.npad_id), - .bus_type = parameters.bus_type, + .bus_type_id = static_cast<u8>(parameters.bus_type), .is_valid = true, }; handle_index = i; @@ -172,7 +172,7 @@ void HidBus::IsExternalDeviceConnected(Kernel::HLERequestContext& ctx) { LOG_INFO(Service_HID, "Called, abstracted_pad_id={}, bus_type={}, internal_index={}, " "player_number={}, is_valid={}", - bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, + bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid); const auto device_index = GetDeviceIndexFromHandle(bus_handle_); @@ -201,7 +201,7 @@ void HidBus::Initialize(Kernel::HLERequestContext& ctx) { LOG_INFO(Service_HID, "called, abstracted_pad_id={} bus_type={} internal_index={} " "player_number={} is_valid={}, applet_resource_user_id={}", - bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, + bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid, applet_resource_user_id); is_hidbus_enabled = true; @@ -253,7 +253,7 @@ void HidBus::Finalize(Kernel::HLERequestContext& ctx) { LOG_INFO(Service_HID, "called, abstracted_pad_id={}, bus_type={}, internal_index={}, " "player_number={}, is_valid={}, applet_resource_user_id={}", - bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, + bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid, applet_resource_user_id); const auto device_index = GetDeviceIndexFromHandle(bus_handle_); @@ -301,7 +301,7 @@ void HidBus::EnableExternalDevice(Kernel::HLERequestContext& ctx) { "called, enable={}, abstracted_pad_id={}, bus_type={}, internal_index={}, " "player_number={}, is_valid={}, inval={}, applet_resource_user_id{}", parameters.enable, parameters.bus_handle.abstracted_pad_id, - parameters.bus_handle.bus_type, parameters.bus_handle.internal_index, + parameters.bus_handle.bus_type_id, parameters.bus_handle.internal_index, parameters.bus_handle.player_number, parameters.bus_handle.is_valid, parameters.inval, parameters.applet_resource_user_id); @@ -329,7 +329,7 @@ void HidBus::GetExternalDeviceId(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, " "is_valid={}", - bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, + bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid); const auto device_index = GetDeviceIndexFromHandle(bus_handle_); @@ -357,7 +357,7 @@ void HidBus::SendCommandAsync(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "called, data_size={}, abstracted_pad_id={}, bus_type={}, internal_index={}, " "player_number={}, is_valid={}", - data.size(), bus_handle_.abstracted_pad_id, bus_handle_.bus_type, + data.size(), bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid); const auto device_index = GetDeviceIndexFromHandle(bus_handle_); @@ -384,7 +384,7 @@ void HidBus::GetSendCommandAsynceResult(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, " "is_valid={}", - bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, + bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid); const auto device_index = GetDeviceIndexFromHandle(bus_handle_); @@ -413,7 +413,7 @@ void HidBus::SetEventForSendCommandAsycResult(Kernel::HLERequestContext& ctx) { LOG_INFO(Service_HID, "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, " "is_valid={}", - bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, + bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid); const auto device_index = GetDeviceIndexFromHandle(bus_handle_); @@ -464,7 +464,7 @@ void HidBus::EnableJoyPollingReceiveMode(Kernel::HLERequestContext& ctx) { LOG_INFO(Service_HID, "called, t_mem_handle=0x{:08X}, polling_mode={}, abstracted_pad_id={}, bus_type={}, " "internal_index={}, player_number={}, is_valid={}", - t_mem_handle, polling_mode_, bus_handle_.abstracted_pad_id, bus_handle_.bus_type, + t_mem_handle, polling_mode_, bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid); const auto device_index = GetDeviceIndexFromHandle(bus_handle_); @@ -472,7 +472,7 @@ void HidBus::EnableJoyPollingReceiveMode(Kernel::HLERequestContext& ctx) { if (device_index) { auto& device = devices[device_index.value()].device; device->SetPollingMode(polling_mode_); - device->SetTransferMemoryPointer(system.Memory().GetPointer(t_mem->GetSourceAddress())); + device->SetTransferMemoryAddress(t_mem->GetSourceAddress()); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); @@ -492,7 +492,7 @@ void HidBus::DisableJoyPollingReceiveMode(Kernel::HLERequestContext& ctx) { LOG_INFO(Service_HID, "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, " "is_valid={}", - bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index, + bus_handle_.abstracted_pad_id, bus_handle_.bus_type_id, bus_handle_.internal_index, bus_handle_.player_number, bus_handle_.is_valid); const auto device_index = GetDeviceIndexFromHandle(bus_handle_); diff --git a/src/core/hle/service/hid/hidbus.h b/src/core/hle/service/hid/hidbus.h index 8c687f678..85ed96e2e 100644 --- a/src/core/hle/service/hid/hidbus.h +++ b/src/core/hle/service/hid/hidbus.h @@ -41,7 +41,7 @@ private: }; // This is nn::hidbus::BusType - enum class BusType : u8 { + enum class BusType : u32 { LeftJoyRail, RightJoyRail, InternalBus, // Lark microphone @@ -54,7 +54,7 @@ private: u32 abstracted_pad_id; u8 internal_index; u8 player_number; - BusType bus_type; + u8 bus_type_id; bool is_valid; }; static_assert(sizeof(BusHandle) == 0x8, "BusHandle is an invalid size"); @@ -115,8 +115,7 @@ private: void MakeDevice(BusHandle handle) { const auto device_index = GetDeviceIndexFromHandle(handle); if (device_index) { - devices[device_index.value()].device = - std::make_unique<T>(system.HIDCore(), service_context); + devices[device_index.value()].device = std::make_unique<T>(system, service_context); } } diff --git a/src/core/hle/service/hid/hidbus/hidbus_base.cpp b/src/core/hle/service/hid/hidbus/hidbus_base.cpp index b569b3c20..dfd23ec04 100644 --- a/src/core/hle/service/hid/hidbus/hidbus_base.cpp +++ b/src/core/hle/service/hid/hidbus/hidbus_base.cpp @@ -9,8 +9,8 @@ namespace Service::HID { -HidbusBase::HidbusBase(KernelHelpers::ServiceContext& service_context_) - : service_context(service_context_) { +HidbusBase::HidbusBase(Core::System& system_, KernelHelpers::ServiceContext& service_context_) + : system(system_), service_context(service_context_) { send_command_async_event = service_context.CreateEvent("hidbus:SendCommandAsyncEvent"); } HidbusBase::~HidbusBase() = default; @@ -59,8 +59,7 @@ void HidbusBase::DisablePollingMode() { polling_mode_enabled = false; } -void HidbusBase::SetTransferMemoryPointer(u8* t_mem) { - is_transfer_memory_set = true; +void HidbusBase::SetTransferMemoryAddress(VAddr t_mem) { transfer_memory = t_mem; } diff --git a/src/core/hle/service/hid/hidbus/hidbus_base.h b/src/core/hle/service/hid/hidbus/hidbus_base.h index 65e301137..26313264d 100644 --- a/src/core/hle/service/hid/hidbus/hidbus_base.h +++ b/src/core/hle/service/hid/hidbus/hidbus_base.h @@ -8,6 +8,10 @@ #include "common/common_types.h" #include "core/hle/result.h" +namespace Core { +class System; +} + namespace Kernel { class KEvent; class KReadableEvent; @@ -106,7 +110,7 @@ static_assert(sizeof(ButtonOnlyPollingDataAccessor) == 0x2F0, class HidbusBase { public: - explicit HidbusBase(KernelHelpers::ServiceContext& service_context_); + explicit HidbusBase(Core::System& system_, KernelHelpers::ServiceContext& service_context_); virtual ~HidbusBase(); void ActivateDevice(); @@ -134,7 +138,7 @@ public: void DisablePollingMode(); // Called on EnableJoyPollingReceiveMode - void SetTransferMemoryPointer(u8* t_mem); + void SetTransferMemoryAddress(VAddr t_mem); Kernel::KReadableEvent& GetSendCommandAsycEvent() const; @@ -170,9 +174,9 @@ protected: JoyEnableSixAxisDataAccessor enable_sixaxis_data{}; ButtonOnlyPollingDataAccessor button_only_data{}; - u8* transfer_memory{nullptr}; - bool is_transfer_memory_set{}; + VAddr transfer_memory{}; + Core::System& system; Kernel::KEvent* send_command_async_event; KernelHelpers::ServiceContext& service_context; }; diff --git a/src/core/hle/service/hid/hidbus/ringcon.cpp b/src/core/hle/service/hid/hidbus/ringcon.cpp index 35847cbdd..65a2dd521 100644 --- a/src/core/hle/service/hid/hidbus/ringcon.cpp +++ b/src/core/hle/service/hid/hidbus/ringcon.cpp @@ -1,18 +1,20 @@ // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include "core/core.h" #include "core/hid/emulated_controller.h" #include "core/hid/hid_core.h" #include "core/hle/kernel/k_event.h" #include "core/hle/kernel/k_readable_event.h" #include "core/hle/service/hid/hidbus/ringcon.h" +#include "core/memory.h" namespace Service::HID { -RingController::RingController(Core::HID::HIDCore& hid_core_, +RingController::RingController(Core::System& system_, KernelHelpers::ServiceContext& service_context_) - : HidbusBase(service_context_) { - input = hid_core_.GetEmulatedController(Core::HID::NpadIdType::Player1); + : HidbusBase(system_, service_context_) { + input = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1); } RingController::~RingController() = default; @@ -38,7 +40,7 @@ void RingController::OnUpdate() { return; } - if (!polling_mode_enabled || !is_transfer_memory_set) { + if (!polling_mode_enabled || transfer_memory == 0) { return; } @@ -62,7 +64,8 @@ void RingController::OnUpdate() { curr_entry.polling_data.out_size = sizeof(ringcon_value); std::memcpy(curr_entry.polling_data.data.data(), &ringcon_value, sizeof(ringcon_value)); - std::memcpy(transfer_memory, &enable_sixaxis_data, sizeof(enable_sixaxis_data)); + system.Memory().WriteBlock(transfer_memory, &enable_sixaxis_data, + sizeof(enable_sixaxis_data)); break; } default: diff --git a/src/core/hle/service/hid/hidbus/ringcon.h b/src/core/hle/service/hid/hidbus/ringcon.h index c2fb386b1..f42f3ea41 100644 --- a/src/core/hle/service/hid/hidbus/ringcon.h +++ b/src/core/hle/service/hid/hidbus/ringcon.h @@ -17,8 +17,7 @@ namespace Service::HID { class RingController final : public HidbusBase { public: - explicit RingController(Core::HID::HIDCore& hid_core_, - KernelHelpers::ServiceContext& service_context_); + explicit RingController(Core::System& system_, KernelHelpers::ServiceContext& service_context_); ~RingController() override; void OnInit() override; diff --git a/src/core/hle/service/hid/hidbus/starlink.cpp b/src/core/hle/service/hid/hidbus/starlink.cpp index d0e760314..36573274e 100644 --- a/src/core/hle/service/hid/hidbus/starlink.cpp +++ b/src/core/hle/service/hid/hidbus/starlink.cpp @@ -8,8 +8,8 @@ namespace Service::HID { constexpr u8 DEVICE_ID = 0x28; -Starlink::Starlink(Core::HID::HIDCore& hid_core_, KernelHelpers::ServiceContext& service_context_) - : HidbusBase(service_context_) {} +Starlink::Starlink(Core::System& system_, KernelHelpers::ServiceContext& service_context_) + : HidbusBase(system_, service_context_) {} Starlink::~Starlink() = default; void Starlink::OnInit() { @@ -27,7 +27,7 @@ void Starlink::OnUpdate() { if (!device_enabled) { return; } - if (!polling_mode_enabled || !is_transfer_memory_set) { + if (!polling_mode_enabled || transfer_memory == 0) { return; } diff --git a/src/core/hle/service/hid/hidbus/starlink.h b/src/core/hle/service/hid/hidbus/starlink.h index 07c800e6e..a276aa88f 100644 --- a/src/core/hle/service/hid/hidbus/starlink.h +++ b/src/core/hle/service/hid/hidbus/starlink.h @@ -14,8 +14,7 @@ namespace Service::HID { class Starlink final : public HidbusBase { public: - explicit Starlink(Core::HID::HIDCore& hid_core_, - KernelHelpers::ServiceContext& service_context_); + explicit Starlink(Core::System& system_, KernelHelpers::ServiceContext& service_context_); ~Starlink() override; void OnInit() override; diff --git a/src/core/hle/service/hid/hidbus/stubbed.cpp b/src/core/hle/service/hid/hidbus/stubbed.cpp index 07632c872..8160b7218 100644 --- a/src/core/hle/service/hid/hidbus/stubbed.cpp +++ b/src/core/hle/service/hid/hidbus/stubbed.cpp @@ -8,9 +8,8 @@ namespace Service::HID { constexpr u8 DEVICE_ID = 0xFF; -HidbusStubbed::HidbusStubbed(Core::HID::HIDCore& hid_core_, - KernelHelpers::ServiceContext& service_context_) - : HidbusBase(service_context_) {} +HidbusStubbed::HidbusStubbed(Core::System& system_, KernelHelpers::ServiceContext& service_context_) + : HidbusBase(system_, service_context_) {} HidbusStubbed::~HidbusStubbed() = default; void HidbusStubbed::OnInit() { @@ -28,7 +27,7 @@ void HidbusStubbed::OnUpdate() { if (!device_enabled) { return; } - if (!polling_mode_enabled || !is_transfer_memory_set) { + if (!polling_mode_enabled || transfer_memory == 0) { return; } diff --git a/src/core/hle/service/hid/hidbus/stubbed.h b/src/core/hle/service/hid/hidbus/stubbed.h index 38eaa0ecc..2e58d42fc 100644 --- a/src/core/hle/service/hid/hidbus/stubbed.h +++ b/src/core/hle/service/hid/hidbus/stubbed.h @@ -14,8 +14,7 @@ namespace Service::HID { class HidbusStubbed final : public HidbusBase { public: - explicit HidbusStubbed(Core::HID::HIDCore& hid_core_, - KernelHelpers::ServiceContext& service_context_); + explicit HidbusStubbed(Core::System& system_, KernelHelpers::ServiceContext& service_context_); ~HidbusStubbed() override; void OnInit() override; diff --git a/src/core/hle/service/hid/irs.cpp b/src/core/hle/service/hid/irs.cpp index 3bd418e92..a40f61fde 100644 --- a/src/core/hle/service/hid/irs.cpp +++ b/src/core/hle/service/hid/irs.cpp @@ -208,8 +208,6 @@ void IRS::RunImageTransferProcessor(Kernel::HLERequestContext& ctx) { ASSERT_MSG(t_mem->GetSize() == parameters.transfer_memory_size, "t_mem has incorrect size"); - u8* transfer_memory = system.Memory().GetPointer(t_mem->GetSourceAddress()); - LOG_INFO(Service_IRS, "called, npad_type={}, npad_id={}, transfer_memory_size={}, transfer_memory_size={}, " "applet_resource_user_id={}", @@ -224,7 +222,7 @@ void IRS::RunImageTransferProcessor(Kernel::HLERequestContext& ctx) { auto& image_transfer_processor = GetProcessor<ImageTransferProcessor>(parameters.camera_handle); image_transfer_processor.SetConfig(parameters.processor_config); - image_transfer_processor.SetTransferMemoryPointer(transfer_memory); + image_transfer_processor.SetTransferMemoryAddress(t_mem->GetSourceAddress()); npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex, Common::Input::PollingMode::IR); } @@ -448,8 +446,6 @@ void IRS::RunImageTransferExProcessor(Kernel::HLERequestContext& ctx) { auto t_mem = system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>( t_mem_handle); - u8* transfer_memory = system.Memory().GetPointer(t_mem->GetSourceAddress()); - LOG_INFO(Service_IRS, "called, npad_type={}, npad_id={}, transfer_memory_size={}, " "applet_resource_user_id={}", @@ -464,7 +460,7 @@ void IRS::RunImageTransferExProcessor(Kernel::HLERequestContext& ctx) { auto& image_transfer_processor = GetProcessor<ImageTransferProcessor>(parameters.camera_handle); image_transfer_processor.SetConfig(parameters.processor_config); - image_transfer_processor.SetTransferMemoryPointer(transfer_memory); + image_transfer_processor.SetTransferMemoryAddress(t_mem->GetSourceAddress()); npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex, Common::Input::PollingMode::IR); } diff --git a/src/core/hle/service/hid/irs.h b/src/core/hle/service/hid/irs.h index 2e6115c73..b76ad7854 100644 --- a/src/core/hle/service/hid/irs.h +++ b/src/core/hle/service/hid/irs.h @@ -80,7 +80,13 @@ private: LOG_CRITICAL(Service_IRS, "Invalid index {}", index); return; } - processors[index] = std::make_unique<T>(system.HIDCore(), device_state, index); + + if constexpr (std::is_constructible_v<T, Core::System&, Core::IrSensor::DeviceFormat&, + std::size_t>) { + processors[index] = std::make_unique<T>(system, device_state, index); + } else { + processors[index] = std::make_unique<T>(system.HIDCore(), device_state, index); + } } template <typename T> diff --git a/src/core/hle/service/hid/irsensor/image_transfer_processor.cpp b/src/core/hle/service/hid/irsensor/image_transfer_processor.cpp index 98f0c579d..bc896a1e3 100644 --- a/src/core/hle/service/hid/irsensor/image_transfer_processor.cpp +++ b/src/core/hle/service/hid/irsensor/image_transfer_processor.cpp @@ -1,16 +1,18 @@ // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later +#include "core/core.h" #include "core/hid/emulated_controller.h" #include "core/hid/hid_core.h" #include "core/hle/service/hid/irsensor/image_transfer_processor.h" +#include "core/memory.h" namespace Service::IRS { -ImageTransferProcessor::ImageTransferProcessor(Core::HID::HIDCore& hid_core_, +ImageTransferProcessor::ImageTransferProcessor(Core::System& system_, Core::IrSensor::DeviceFormat& device_format, std::size_t npad_index) - : device{device_format} { - npad_device = hid_core_.GetEmulatedControllerByIndex(npad_index); + : device{device_format}, system{system_} { + npad_device = system.HIDCore().GetEmulatedControllerByIndex(npad_index); Core::HID::ControllerUpdateCallback engine_callback{ .on_change = [this](Core::HID::ControllerTriggerType type) { OnControllerUpdate(type); }, @@ -43,7 +45,7 @@ void ImageTransferProcessor::OnControllerUpdate(Core::HID::ControllerTriggerType if (type != Core::HID::ControllerTriggerType::IrSensor) { return; } - if (!is_transfer_memory_set) { + if (transfer_memory == 0) { return; } @@ -56,14 +58,16 @@ void ImageTransferProcessor::OnControllerUpdate(Core::HID::ControllerTriggerType if (camera_data.format != current_config.origin_format) { LOG_WARNING(Service_IRS, "Wrong Input format {} expected {}", camera_data.format, current_config.origin_format); - memset(transfer_memory, 0, GetDataSize(current_config.trimming_format)); + system.Memory().ZeroBlock(*system.ApplicationProcess(), transfer_memory, + GetDataSize(current_config.trimming_format)); return; } if (current_config.origin_format > current_config.trimming_format) { LOG_WARNING(Service_IRS, "Origin format {} is smaller than trimming format {}", current_config.origin_format, current_config.trimming_format); - memset(transfer_memory, 0, GetDataSize(current_config.trimming_format)); + system.Memory().ZeroBlock(*system.ApplicationProcess(), transfer_memory, + GetDataSize(current_config.trimming_format)); return; } @@ -80,7 +84,8 @@ void ImageTransferProcessor::OnControllerUpdate(Core::HID::ControllerTriggerType "Trimming area ({}, {}, {}, {}) is outside of origin area ({}, {})", current_config.trimming_start_x, current_config.trimming_start_y, trimming_width, trimming_height, origin_width, origin_height); - memset(transfer_memory, 0, GetDataSize(current_config.trimming_format)); + system.Memory().ZeroBlock(*system.ApplicationProcess(), transfer_memory, + GetDataSize(current_config.trimming_format)); return; } @@ -94,7 +99,8 @@ void ImageTransferProcessor::OnControllerUpdate(Core::HID::ControllerTriggerType } } - memcpy(transfer_memory, window_data.data(), GetDataSize(current_config.trimming_format)); + system.Memory().WriteBlock(transfer_memory, window_data.data(), + GetDataSize(current_config.trimming_format)); if (!IsProcessorActive()) { StartProcessor(); @@ -134,8 +140,7 @@ void ImageTransferProcessor::SetConfig( npad_device->SetCameraFormat(current_config.origin_format); } -void ImageTransferProcessor::SetTransferMemoryPointer(u8* t_mem) { - is_transfer_memory_set = true; +void ImageTransferProcessor::SetTransferMemoryAddress(VAddr t_mem) { transfer_memory = t_mem; } @@ -143,7 +148,7 @@ Core::IrSensor::ImageTransferProcessorState ImageTransferProcessor::GetState( std::vector<u8>& data) const { const auto size = GetDataSize(current_config.trimming_format); data.resize(size); - memcpy(data.data(), transfer_memory, size); + system.Memory().ReadBlock(transfer_memory, data.data(), size); return processor_state; } diff --git a/src/core/hle/service/hid/irsensor/image_transfer_processor.h b/src/core/hle/service/hid/irsensor/image_transfer_processor.h index 393df492d..7cfe04c8c 100644 --- a/src/core/hle/service/hid/irsensor/image_transfer_processor.h +++ b/src/core/hle/service/hid/irsensor/image_transfer_processor.h @@ -7,6 +7,10 @@ #include "core/hid/irs_types.h" #include "core/hle/service/hid/irsensor/processor_base.h" +namespace Core { +class System; +} + namespace Core::HID { class EmulatedController; } // namespace Core::HID @@ -14,7 +18,7 @@ class EmulatedController; namespace Service::IRS { class ImageTransferProcessor final : public ProcessorBase { public: - explicit ImageTransferProcessor(Core::HID::HIDCore& hid_core_, + explicit ImageTransferProcessor(Core::System& system_, Core::IrSensor::DeviceFormat& device_format, std::size_t npad_index); ~ImageTransferProcessor() override; @@ -33,7 +37,7 @@ public: void SetConfig(Core::IrSensor::PackedImageTransferProcessorExConfig config); // Transfer memory where the image data will be stored - void SetTransferMemoryPointer(u8* t_mem); + void SetTransferMemoryAddress(VAddr t_mem); Core::IrSensor::ImageTransferProcessorState GetState(std::vector<u8>& data) const; @@ -67,7 +71,7 @@ private: Core::HID::EmulatedController* npad_device; int callback_key{}; - u8* transfer_memory = nullptr; - bool is_transfer_memory_set = false; + Core::System& system; + VAddr transfer_memory{}; }; } // namespace Service::IRS diff --git a/src/core/hle/service/ncm/ncm.cpp b/src/core/hle/service/ncm/ncm.cpp index e8cd762ad..5ab24dc34 100644 --- a/src/core/hle/service/ncm/ncm.cpp +++ b/src/core/hle/service/ncm/ncm.cpp @@ -124,6 +124,7 @@ public: {12, nullptr, "InactivateContentMetaDatabase"}, {13, nullptr, "InvalidateRightsIdCache"}, {14, nullptr, "GetMemoryReport"}, + {15, nullptr, "ActivateFsContentStorage"}, }; // clang-format on diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index a9291ed5d..062e96ef9 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp @@ -160,6 +160,8 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ {606, nullptr, "GetContentMetaStorage"}, {607, nullptr, "ListAvailableAddOnContent"}, {609, nullptr, "ListAvailabilityAssuredAddOnContent"}, + {610, nullptr, "GetInstalledContentMetaStorage"}, + {611, nullptr, "PrepareAddOnContent"}, {700, nullptr, "PushDownloadTaskList"}, {701, nullptr, "ClearTaskStatusList"}, {702, nullptr, "RequestDownloadTaskList"}, @@ -229,6 +231,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ {1900, nullptr, "IsActiveAccount"}, {1901, nullptr, "RequestDownloadApplicationPrepurchasedRights"}, {1902, nullptr, "GetApplicationTicketInfo"}, + {1903, nullptr, "RequestDownloadApplicationPrepurchasedRightsForAccount"}, {2000, nullptr, "GetSystemDeliveryInfo"}, {2001, nullptr, "SelectLatestSystemDeliveryInfo"}, {2002, nullptr, "VerifyDeliveryProtocolVersion"}, @@ -277,8 +280,11 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ {2352, nullptr, "RequestResolveNoDownloadRightsError"}, {2353, nullptr, "GetApplicationDownloadTaskInfo"}, {2354, nullptr, "PrioritizeApplicationBackgroundTask"}, - {2355, nullptr, "Unknown2355"}, - {2356, nullptr, "Unknown2356"}, + {2355, nullptr, "PreferStorageEfficientUpdate"}, + {2356, nullptr, "RequestStorageEfficientUpdatePreferable"}, + {2357, nullptr, "EnableMultiCoreDownload"}, + {2358, nullptr, "DisableMultiCoreDownload"}, + {2359, nullptr, "IsMultiCoreDownloadEnabled"}, {2400, nullptr, "GetPromotionInfo"}, {2401, nullptr, "CountPromotionInfo"}, {2402, nullptr, "ListPromotionInfo"}, @@ -296,6 +302,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ {2519, nullptr, "IsQualificationTransitionSupported"}, {2520, nullptr, "IsQualificationTransitionSupportedByProcessId"}, {2521, nullptr, "GetRightsUserChangedEvent"}, + {2522, nullptr, "IsRomRedirectionAvailable"}, {2800, nullptr, "GetApplicationIdOfPreomia"}, {3000, nullptr, "RegisterDeviceLockKey"}, {3001, nullptr, "UnregisterDeviceLockKey"}, @@ -312,6 +319,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ {3012, nullptr, "IsApplicationTitleHidden"}, {3013, nullptr, "IsGameCardEnabled"}, {3014, nullptr, "IsLocalContentShareEnabled"}, + {3050, nullptr, "ListAssignELicenseTaskResult"}, {9999, nullptr, "GetApplicationCertificate"}, }; // clang-format on diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cpp index 790e28504..2789fa1ed 100644 --- a/src/core/hle/service/sockets/bsd.cpp +++ b/src/core/hle/service/sockets/bsd.cpp @@ -953,6 +953,9 @@ BSDCFG::BSDCFG(Core::System& system_) : ServiceFramework{system_, "bsdcfg"} { {10, nullptr, "ClearArpEntries"}, {11, nullptr, "ClearArpEntries2"}, {12, nullptr, "PrintArpEntries"}, + {13, nullptr, "Unknown13"}, + {14, nullptr, "Unknown14"}, + {15, nullptr, "Unknown15"}, }; // clang-format on diff --git a/src/core/hle/service/sockets/sockets.h b/src/core/hle/service/sockets/sockets.h index c94e80ef6..acd2dae7b 100644 --- a/src/core/hle/service/sockets/sockets.h +++ b/src/core/hle/service/sockets/sockets.h @@ -19,6 +19,7 @@ enum class Errno : u32 { INVAL = 22, MFILE = 24, MSGSIZE = 90, + CONNRESET = 104, NOTCONN = 107, TIMEDOUT = 110, }; diff --git a/src/core/hle/service/sockets/sockets_translate.cpp b/src/core/hle/service/sockets/sockets_translate.cpp index 023aa0486..594e58f90 100644 --- a/src/core/hle/service/sockets/sockets_translate.cpp +++ b/src/core/hle/service/sockets/sockets_translate.cpp @@ -27,6 +27,8 @@ Errno Translate(Network::Errno value) { return Errno::NOTCONN; case Network::Errno::TIMEDOUT: return Errno::TIMEDOUT; + case Network::Errno::CONNRESET: + return Errno::CONNRESET; default: UNIMPLEMENTED_MSG("Unimplemented errno={}", value); return Errno::SUCCESS; diff --git a/src/core/hle/service/ssl/ssl.cpp b/src/core/hle/service/ssl/ssl.cpp index 57027bdf5..c1fd1a59b 100644 --- a/src/core/hle/service/ssl/ssl.cpp +++ b/src/core/hle/service/ssl/ssl.cpp @@ -46,6 +46,14 @@ public: {25, nullptr, "GetCipherInfo"}, {26, nullptr, "SetNextAlpnProto"}, {27, nullptr, "GetNextAlpnProto"}, + {28, nullptr, "SetDtlsSocketDescriptor"}, + {29, nullptr, "GetDtlsHandshakeTimeout"}, + {30, nullptr, "SetPrivateOption"}, + {31, nullptr, "SetSrtpCiphers"}, + {32, nullptr, "GetSrtpCipher"}, + {33, nullptr, "ExportKeyingMaterial"}, + {34, nullptr, "SetIoTimeout"}, + {35, nullptr, "GetIoTimeout"}, }; // clang-format on @@ -69,6 +77,8 @@ public: {9, nullptr, "AddPolicyOid"}, {10, nullptr, "ImportCrl"}, {11, nullptr, "RemoveCrl"}, + {12, nullptr, "ImportClientCertKeyPki"}, + {13, nullptr, "GeneratePrivateKeyAndCert"}, }; RegisterHandlers(functions); } diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index 6da8bea9e..d9cfebd70 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp @@ -249,6 +249,9 @@ public: {2053, nullptr, "DestroyIndirectProducerEndPoint"}, {2054, nullptr, "CreateIndirectConsumerEndPoint"}, {2055, nullptr, "DestroyIndirectConsumerEndPoint"}, + {2060, nullptr, "CreateWatermarkCompositor"}, + {2062, nullptr, "SetWatermarkText"}, + {2063, nullptr, "SetWatermarkLayerStacks"}, {2300, nullptr, "AcquireLayerTexturePresentingEvent"}, {2301, nullptr, "ReleaseLayerTexturePresentingEvent"}, {2302, nullptr, "GetDisplayHotplugEvent"}, @@ -279,6 +282,8 @@ public: {6011, nullptr, "EnableLayerAutoClearTransitionBuffer"}, {6012, nullptr, "DisableLayerAutoClearTransitionBuffer"}, {6013, nullptr, "SetLayerOpacity"}, + {6014, nullptr, "AttachLayerWatermarkCompositor"}, + {6015, nullptr, "DetachLayerWatermarkCompositor"}, {7000, nullptr, "SetContentVisibility"}, {8000, nullptr, "SetConductorLayer"}, {8001, nullptr, "SetTimestampTracking"}, diff --git a/src/core/hle/service/vi/vi_m.cpp b/src/core/hle/service/vi/vi_m.cpp index 1ab7fe4ab..7ca44354b 100644 --- a/src/core/hle/service/vi/vi_m.cpp +++ b/src/core/hle/service/vi/vi_m.cpp @@ -14,6 +14,10 @@ VI_M::VI_M(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_, static const FunctionInfo functions[] = { {2, &VI_M::GetDisplayService, "GetDisplayService"}, {3, nullptr, "GetDisplayServiceWithProxyNameExchange"}, + {100, nullptr, "PrepareFatal"}, + {101, nullptr, "ShowFatal"}, + {102, nullptr, "DrawFatalRectangle"}, + {103, nullptr, "DrawFatalText32"}, }; RegisterHandlers(functions); } |