eden-miror/src/hid_core/resources
xbzk 07f40d5cac
[npad,hid,am] npad WriteEmptyEntry fix, hid function 551 stub, and applet PopOutData rework (#4442)
- [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 was intended to fix Dave the Diver issue, but we found a real silly hid bug, then a maybe broader applet issue:

By testing with John it was found out only the last controller connected worked, the others caused the game to freeze peacefully, no crashes, suggesting some loop or deadlock.

After seeking that lead, it was found that the freeze was caused by a malformed HID history entry when the controller applet removed P2.
Pressing P1 opens the controller applet, then Qt applet disconnects P2, which is expected.

Upon seeking callstack and hid sync path, it was found out that NPad::WriteEmptyEntry:
was using: ReadCurrentEntry().sampling_number + 1
instead of: ReadCurrentEntry().state.sampling_number + 1 (checked AtomicStorage in src\hid_core\resources\ring_lifo.h)
Fixing that fixed the freeze, but killed the sound!

Later handheld/docked was accidentally clicked and sound returned. Good lead.
Then i just had to corner which part of the toggle was causing the refresh and do something similar at the controller applet return routine (PopOutData in library_applet_accessor.cpp). This part seems harmless, but i'm not clearly sure about how proper it is, since it was like a transplant and test operation.

UPDATE:
To try Diablo 3 on my machine it was needed to stub HID function 551.

And to fix all abnormalies like multiple applet requests and crash the function PopOutData was reworked to ensurey idempotency among different applet focus conditions:

focus state changed: updates state and signals if needed
no state change, HLE application frontend: requests focus state changed notification
already pending change message: flag remains true and no duplicate pushed to queue entry

Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4442
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Reviewed-by: lizzie <lizzie@eden-emu.dev>
2026-09-18 23:49:17 +02:00
..
abstracted_pad [hle/service] stub missing homebrew services, fix NPad/caps crashes (#4264) 2026-08-18 18:11:33 +02:00
debug_pad hid_core: Move hid to it's own subproject 2024-01-05 11:41:15 -06:00
digitizer service: hid: Multiple fixes 2024-02-01 10:37:44 -06:00
keyboard hid_core: Move hid to it's own subproject 2024-01-05 11:41:15 -06:00
mouse hid_core: Move hid to it's own subproject 2024-01-05 11:41:15 -06:00
npad [npad,hid,am] npad WriteEmptyEntry fix, hid function 551 stub, and applet PopOutData rework (#4442) 2026-09-18 23:49:17 +02:00
palma [video_core, hle] remove redundant parent references in system structs (#3908) 2026-06-23 06:31:25 +02:00
six_axis [common] remove unused vector_math.h fluff (#4333) 2026-09-08 20:39:39 +02:00
system_buttons service: hid: Implement home, capture and sleep buttons 2024-01-28 19:28:37 -06:00
touch_screen [core, hle, video_core, memory] Improve multi-process, display layers, dynamic shader cache and rework overlay (#4238) 2026-08-29 01:04:02 +02:00
unique_pad service: hid: Multiple fixes 2024-02-01 10:37:44 -06:00
vibration service: hid: Don't try to vibrate if device isn't initialized 2024-01-25 23:46:46 -06:00
applet_resource.cpp [video_core, hle] remove redundant parent references in system structs (#3908) 2026-06-23 06:31:25 +02:00
applet_resource.h [tools, cmake] refactor: update/hash check scripts, use tags for some more deps, proper CPMUtil separation (#2666) 2025-10-05 03:04:53 +02:00
controller_base.cpp hid_core: Move hid to it's own subproject 2024-01-05 11:41:15 -06:00
controller_base.h hid_core: Move hid to it's own subproject 2024-01-05 11:41:15 -06:00
hid_firmware_settings.cpp service: set: Migrate ISystemSettingsServer to new IPC 2024-02-14 12:40:10 -06:00
hid_firmware_settings.h service: set: Implement more settings functions for Qlaunch 2024-01-25 17:14:18 -06:00
irs_ring_lifo.h hid_core: Move hid to it's own subproject 2024-01-05 11:41:15 -06:00
ring_lifo.h [audio_core/hid] Audio REV12+15 support + HID fixes (#2719) 2025-10-12 17:03:14 +02:00
shared_memory_format.h [common] remove unused vector_math.h fluff (#4333) 2026-09-08 20:39:39 +02:00
shared_memory_holder.cpp [video_core, hle] remove redundant parent references in system structs (#3908) 2026-06-23 06:31:25 +02:00
shared_memory_holder.h [video_core, hle] remove redundant parent references in system structs (#3908) 2026-06-23 06:31:25 +02:00