eden-miror/src/core
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
..
arm [msvc] fix build errors (#4451) 2026-09-17 08:16:18 +02:00
crypto [common] rework BitField and BitUtil, use concepts whenever possible (#4076) 2026-07-09 03:47:04 +02:00
debugger [cmake] Fix some macOS compilation errors (#4350) 2026-09-05 23:43:46 +02:00
file_sys [fs] share parent resources with bundled programs (#4319) 2026-09-18 23:48:35 +02:00
frontend [applet] ReconfigureControllers fallback unconditional disconnect fix (#4420) 2026-09-15 21:53:07 +02:00
hle [npad,hid,am] npad WriteEmptyEntry fix, hid function 551 stub, and applet PopOutData rework (#4442) 2026-09-18 23:49:17 +02:00
internal_network [internal_network] Fix WiFi scanner compilation on GCC 15.3.0 (#4279) 2026-08-21 23:29:24 +02:00
loader [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
memory [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
tools [*] basic in-house cpp linting (#4039) 2026-06-04 05:49:07 +02:00
CMakeLists.txt [ns] Rename i_async_result -> async_result (#4439) 2026-09-16 03:46:44 +02:00
constants.cpp [core] Use a eden profile picture instead of the default grey one. (#3350) 2026-01-20 18:32:08 +01:00
constants.h [core] Use a eden profile picture instead of the default grey one. (#3350) 2026-01-20 18:32:08 +01:00
core.cpp [fs] moved temp folder cleanup upstream (per-application level) to avoid per-program retrigger (#4375) 2026-09-10 22:30:07 +02:00
core.h [service, nvhost] added machinery to allow microsleep between nvdec read requests to avoid guest panic in some games (#4316) 2026-08-29 14:22:09 +02:00
core_timing.cpp [core, gpu, threads] Multithreading refactor (#4254) 2026-08-08 04:39:47 +02:00
core_timing.h [core/core_timing] better MWAITX and WAITPKG delays (#3984) 2026-05-30 21:59:10 +02:00
cpu_manager.cpp [core, gpu, threads] Multithreading refactor (#4254) 2026-08-08 04:39:47 +02:00
cpu_manager.h [video_core, hle] remove redundant parent references in system structs (#3908) 2026-06-23 06:31:25 +02:00
device_memory.cpp core: Define HAS_NCE macro 2023-11-25 00:47:36 -05:00
device_memory.h [common/core/dynarmic] Optimize page table allocations (#4219) 2026-09-09 21:35:49 +02:00
device_memory_manager.h [common/core/dynarmic] Optimize page table allocations (#4219) 2026-09-09 21:35:49 +02:00
device_memory_manager.inc [common/core/dynarmic] Optimize page table allocations (#4219) 2026-09-09 21:35:49 +02:00
game_settings.cpp [common/logging] Simplify logging logic and fix issues when logging before system is created (#3688) 2026-03-12 18:29:15 +01:00
game_settings.h [core] Add overridable game setting functionality (#2963) 2025-12-17 03:59:27 +01:00
gpu_dirty_memory_manager.h Core: Eliminate core/memory dependancies. 2024-01-18 21:12:30 -05:00
guest_memory.h Solves warning about GuestMemory having internal linkage. 2025-04-04 03:40:47 +02:00
hardware_properties.h [dynarmic] jit fix branch v2 (#203) 2025-08-27 06:49:50 +02:00
launch_timestamp_cache.cpp [common] Switch to boost::unordered_flat containers (#4326) 2026-08-31 02:58:09 +02:00
launch_timestamp_cache.h [tests] fix compile+linking issues with PlayTime (#3345) 2026-01-19 16:27:18 +01:00
memory.cpp [common/core/dynarmic] Optimize page table allocations (#4219) 2026-09-09 21:35:49 +02:00
memory.h Revert "[core/memory] Remove defered heap allocation on Linux." (#2974) 2025-11-09 22:42:09 +01:00
perf_stats.cpp [frontend] Slow and Turbo modes (#3525) 2026-02-12 01:31:55 +01:00
perf_stats.h
reporter.cpp [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
reporter.h [prepo] Add support for missing PlayReport commands (#3674) 2026-03-06 15:02:59 +01:00