Commit Graph
29 Commits
Author SHA1 Message Date
libretroadmin b570567b88 Give the Vulkan allocator one owning thread
Readback buffers are allocated when the readback is recorded rather than on the render thread,
so only the thread that records frames touches VMA. The allocator is created externally
synchronized, and VMA is built with no-op mutexes and plain counters instead of std::mutex and
std::atomic.

Headless runs Vulkan offscreen in builds without SDL too, and CI runs the headless tests on
lavapipe, skipping the pixel tests a hardware backend doesn't match the software references on.
sleep_ms and sleep_us go, with the thread manager test waiting on an event instead, and so does
the unused portable-file-dialogs header.
2026-10-09 07:37:57 +02:00
libretroadmin f1208a7a5a Make threading lock-free
The core and the headless tools no longer use mutexes, condition variables,
spinlocks, std::atomic, std::thread or volatile flags. Threads hand off through
libretro-common's retro_atomic and rthreads plus a few small pieces on top of
them in Common/Thread: Thread, MpscQueue, EventCounter, ParkingLot waits and
ReaderGate. Every wait blocks until it's woken; nothing polls on a timer.

State that only one thread touches just loses its lock. The PSP filesystem,
sceIo and the savedata dialog now belong to the emulation thread: async reads
and writes run when they're queued and complete later in emulated time, and
the IO and savedata threads are gone. The friend finder only talks to the
adhoc server and hands what it gets to the emulation thread. GPU init always
runs on the thread that starts the game.

The Vulkan render and compile queues, pipeline and render pass caches, delete
list and SPIR-V cache, the GL render queue, the software renderer's jit caches,
the file loader caches, the web debugger, UPnP, input, savestates, logging and
the GE debugger all hand off through queues and atomics. The IR jit's spinning
profiler thread goes.

A CPU thread with nothing to run now sleeps until work is queued instead of
spinning. Headless with --debugger waits for a client while stopped, and ends
the run once every client that connected has left. Web server shutdown keeps
servicing the CPU queue until the server has finished.
2026-10-09 04:56:16 +02:00
libretroadmin 5f0f72bfda Remove sleeps and timed polling from networking
Socket waits now block in select() on the socket plus a wake or cancel
socket (Common/Net/Cancel), so a stop or cancel ends them at once.

- HTTP: cancel flags become net::CancelToken; Connect waits once on all
  addresses, receives wait instead of spinning, no DNS retry sleep.
- Adhoc: the friend finder and adhoc server block on their sockets with
  a wake socket and a deadline; matching runs on a CoreTiming tick
  instead of two threads (savestate section bumped).
- sceNetInet select/poll check without blocking and park the HLE thread,
  re-checked from a CoreTiming event until ready or the emulated
  timeout.
- Vendor the aemu_postoffice client (was a submodule) with no sleeps:
  waits on the socket, close via shutdown and an eventcount, cancelable
  connects, and lock-free session slot claims.
- PortManager waits without a timeout; PSP_InitWait replaces the
  headless boot poll.
- TimeUtil: sleep_us/sleep_ms only outside the core; sleep_precise,
  sleep_random, yield and the Windows timer period are gone.
- Unit test for the socket waits.
2026-10-08 17:58:46 +02:00
Acts1631 7de6a6ccfb Avoid overflow in matching packet length checks
Matching packet handlers added untrusted payload lengths to fixed header
sizes before comparing them with the datagram length. Large values could
overflow and permit out-of-bounds reads. Compare against the remaining
packet size instead, and reject negative ACCEPT sibling counts.
2026-10-03 21:55:32 -04:00
Henrik RydgårdandClaude Opus 5.5 639e57c2bd Savestate: Keep pending adhocctl requests, so a waiting Init survives a load
With WLAN on and no server reachable, sceNetAdhocctlInit keeps its thread
waiting for the login. The load dropped the request, and the wait ended in
BUSY, which Init can't retry. Splinter Cell then ran its failure path with
a deleted event flag. Also stop freeing matching event buffers into the
restored allocator, and take the event lock when clearing.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 09:34:06 -06:00
Henrik Rydgård c5e4d0d90d Rename the get-memory-pointer functions to make it clear where CPU exceptions can happen. 2026-08-12 14:06:16 +02:00
Henrik Rydgård 3bd41376da More memory cleanup 2026-08-11 20:12:10 +02:00
Henrik Rydgård 8cb1732564 Clean up the memory partition ID enum 2026-07-25 14:53:02 +02:00
Henrik Rydgård 040996f185 Use new/delete properly for SceNetAdhocMatchingContext. It contains non-POD C++ objects. 2026-07-23 11:17:44 +02:00
Henrik Rydgård 702e18bd2d Fix typo (thanks Nemo)
See #d0dd10c
2026-07-18 23:55:25 +02:00
Henrik Rydgård d0dd10ce6b Avoid memsetting a non-POD struct (fixes compiler warning) 2026-06-16 11:05:16 +02:00
Katharine Chui f218138f2e add missing null check during actOnDeathPacket
It is not impossible for deadkid to not be tracked, so we have to
null check that
2026-02-26 13:18:03 +01:00
Henrik Rydgård 3e2dce1e54 Move AdHoc error codes to the big enum, fix the naming convention to be consistent 2025-08-06 17:44:54 +02:00
Nemoumbra c7aafd4cbe Deduplicated a config variable 2025-07-02 01:30:21 +03:00
Nemoumbra 921fd32969 8 vars moved to NetAdhocCommon, 1 var moved to sceNetAdhocMatching 2025-07-01 19:56:09 +03:00
Henrik Rydgård 4e25f44eef Rename some module-related functions to include HLE where appropriate 2025-03-31 11:17:50 +02:00
Henrik Rydgård 0f840e6240 Move JPEG error codes to the big enum, some include cleanup 2025-03-21 20:44:46 +01:00
Henrik Rydgård e24317b20b A lot more logging fixes 2025-01-20 12:20:21 +01:00
Henrik Rydgård 7d2ad6980e Another batch of changes 2025-01-20 12:20:21 +01:00
Nemoumbra aae7b187d5 Hadouken fixes: SendData funcs + sceNetAdhocMatchingGetPoolStat 2025-01-05 01:07:10 +03:00
Nemoumbra 94f4ad200b Hadooken fixes: sceNetAdhocMatchingSelectTarget, NetAdhocMatching_CancelTargetWithOpt 2025-01-05 00:46:42 +03:00
Nemoumbra 3497ccacb5 Hadooken codestyle fix + cleaned up NetAdhocMatching_Start 2025-01-05 00:08:20 +03:00
Nemoumbra f7289ff22a Simplified 2 more matching funcs 2025-01-04 23:52:31 +03:00
Nemoumbra 4f623db57a Added early returns for actOn{X}Packet funcs 2025-01-04 23:42:39 +03:00
Nemoumbra 110799f09d Cleaned up broadcastHelloMessage and broadcastPingMessage 2025-01-04 21:08:31 +03:00
Nemoumbra 9f94e035a7 Added early returns for send{X}Packet funcs 2025-01-04 20:29:39 +03:00
Nemoumbra 9f4f0a4e6a Brace codestyle fix 2025-01-04 19:55:50 +03:00
Nemoumbra 96f9749e2e Split out the matching code from sceNetAdhoc.cpp 2025-01-03 04:59:26 +03:00
Nemoumbra b265b3b994 Added empty sceNetAdhocMatching files 2025-01-02 16:03:37 +03:00