mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-04 11:45:18 +02:00
Every memory.read*/write*/search endpoint used to call LockMemoryAndCPU(), which - unless the CPU was already stepping - busy-waited for coreState to settle, force-paused a running game with Core_Break(), and blocked on Core_WaitInactive() before touching memory, just to get exclusive access from the WebSocket handler thread. It also took MIPSComp::jitLock around saving/restoring emuhack ops for the same reason. Now the whole body of each handler runs inside Core_RunOnCPUThread(), so none of that is needed for CPU-thread exclusivity: reads/writes happen inline on the CPU thread itself, whether the game is running or stepping, without ever pausing it. Confirmed live that memory reads/search now complete while coreState stays CORE_RUNNING_CPU throughout - no more stepping flicker on every debugger memory poll. Kept Memory::MemoryInitedLock (guards against Memory::Shutdown() racing in from a different thread, e.g. the UI thread stopping the game - unrelated to the WebSocket-thread-vs-CPU-thread problem) and MIPSComp::jitLock around the emuhack save/restore (guards against a UI-triggered CPU core switch, also a different thread than the one Core_RunOnCPUThread targets). Same caveats as previous conversions: memory.read for a very large 'size' now base64-encodes on the CPU thread itself, and memory.search still has no size cap - both will now block the CPU thread's own frame pump for their duration on a large enough request. Noted inline, not fixed here. Replaced remaining `auto` locals with concrete types. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hqm11k99viLfbJm2MkH4BH