mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-09-19 09:07:38 +00:00
07f40d5cac
- [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>