diff options
| author | lizzie <lizzie@eden-emu.dev> | 2026-08-18 18:11:33 +0200 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2026-08-18 18:11:33 +0200 |
| commit | a41a98028a541e8e44d6220d0b58e45017e25c85 (patch) | |
| tree | a7b42d3220c89a1b555ea24dd2c2684ae083014a /src/hid_core | |
| parent | 265c27f3911e427719231a324b30daaba6f10f9f (diff) | |
[hle/service] stub missing homebrew services, fix NPad/caps crashes (#4264)
Signed-off-by: lizzie <lizzie@eden-emu.dev>
- [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions).
- [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md)
- [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability.
-------------------
this PR adds various missing services (acc:e, acc:e:u1)
to expand homebrew compatibility
notably this also fixes NPad related crashes due to nullref
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4264
Reviewed-by: Maufeat <sahyno1996@gmail.com>
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Diffstat (limited to 'src/hid_core')
| -rw-r--r-- | src/hid_core/resources/abstracted_pad/abstract_battery_handler.cpp | 5 | ||||
| -rw-r--r-- | src/hid_core/resources/npad/npad.cpp | 13 | ||||
| -rw-r--r-- | src/hid_core/resources/npad/npad_resource.cpp | 3 |
3 files changed, 15 insertions, 6 deletions
diff --git a/src/hid_core/resources/abstracted_pad/abstract_battery_handler.cpp b/src/hid_core/resources/abstracted_pad/abstract_battery_handler.cpp index a80f8271f9..e84f38f2e9 100644 --- a/src/hid_core/resources/abstracted_pad/abstract_battery_handler.cpp +++ b/src/hid_core/resources/abstracted_pad/abstract_battery_handler.cpp @@ -53,12 +53,11 @@ Result NpadAbstractBatteryHandler::DecrementRefCounter() { Result NpadAbstractBatteryHandler::UpdateBatteryState(u64 aruid) { const auto npad_index = NpadIdTypeToIndex(properties_handler->GetNpadId()); AruidData* aruid_data = applet_resource_holder->applet_resource->GetAruidData(aruid); - if (aruid_data == nullptr) { + if (aruid_data == nullptr || aruid_data->shared_memory_format == nullptr) { return ResultSuccess; } - auto& npad_internal_state = - aruid_data->shared_memory_format->npad.npad_entry[npad_index].internal_state; + auto& npad_internal_state = aruid_data->shared_memory_format->npad.npad_entry[npad_index].internal_state; auto& system_properties = npad_internal_state.system_properties; system_properties.is_charging_joy_dual.Assign(dual_battery.is_charging); diff --git a/src/hid_core/resources/npad/npad.cpp b/src/hid_core/resources/npad/npad.cpp index a2fd23b534..e7a1ee2bf3 100644 --- a/src/hid_core/resources/npad/npad.cpp +++ b/src/hid_core/resources/npad/npad.cpp @@ -80,7 +80,11 @@ Result NPad::Activate(u64 aruid) { std::scoped_lock shared_lock{*applet_resource_holder.shared_mutex}; auto* data = applet_resource_holder.applet_resource->GetAruidData(aruid); - const auto aruid_index = applet_resource_holder.applet_resource->GetIndexFromAruid(aruid); + auto aruid_index = applet_resource_holder.applet_resource->GetIndexFromAruid(aruid); + if (aruid_index >= AruidIndexMax) { + LOG_ERROR(Service_HID, "Invalid aruid:{:016X}", aruid); + aruid_index = 0; + } if (data == nullptr || !data->flag.is_assigned) { return ResultSuccess; @@ -1099,13 +1103,16 @@ Result NPad::RegisterAppletResourceUserId(u64 aruid) { void NPad::UnregisterAppletResourceUserId(u64 aruid) { // TODO: Remove this once abstract pad is emulated properly - const auto aruid_index = npad_resource.GetIndexFromAruid(aruid); + auto aruid_index = npad_resource.GetIndexFromAruid(aruid); + if (aruid_index >= AruidIndexMax) { + LOG_ERROR(Service_HID, "Invalid aruid:{:016X}", aruid); + aruid_index = 0; + } for (auto& controller : controller_data[aruid_index]) { controller.is_active = false; controller.is_connected = false; controller.shared_memory = nullptr; } - npad_resource.UnregisterAppletResourceUserId(aruid); } diff --git a/src/hid_core/resources/npad/npad_resource.cpp b/src/hid_core/resources/npad/npad_resource.cpp index 54f7acab12..a1b483d7b8 100644 --- a/src/hid_core/resources/npad/npad_resource.cpp +++ b/src/hid_core/resources/npad/npad_resource.cpp @@ -71,6 +71,9 @@ Result NPadResource::RegisterAppletResourceUserId(u64 aruid) { void NPadResource::UnregisterAppletResourceUserId(u64 aruid) { const u64 aruid_index = GetIndexFromAruid(aruid); + if (aruid_index >= AruidIndexMax) { + return; + } FreeAppletResourceId(aruid); if (aruid_index < AruidIndexMax) { |
