diff options
| author | cirakg <cirakg@cirakg.xyz> | 2026-11-02 16:23:40 +0100 |
|---|---|---|
| committer | cirakg <cirakg@cirakg.xyz> | 2026-11-02 16:34:08 +0100 |
| commit | ff234849d6a41d2c2d29cf09408ac66e202d68e7 (patch) | |
| tree | a090ae9e2532741bb67ada2d518c8b4b8bf6bda4 /src/yuzu_cmd/yuzu.cpp | |
| parent | caed5a34484942d3ecf9b9a84c83f31d1a6e3020 (diff) | |
ldn: wait for the host's reply when joining a network
Connect slept for a second while holding packet_mutex, so the host's
SyncNetwork reply could not be handled until Connect had already
returned success in StationOpened. Players could see each other's
group and enter it, but never actually met.
Wait on a condition variable instead, accept the reply only from the
selected host and session, and fail after five seconds. Check packet
sizes and senders, stop duplicate joins from taking another station,
and seed session IDs so separate networks don't share one.
The SDL frontend never called Network::Init, so its multiplayer
option could not join a room. Initialize and shut down networking
around the core.
Assisted-by: Sol (implementation)
Assisted-by: Claude Opus 5.5 (code review)
Diffstat (limited to 'src/yuzu_cmd/yuzu.cpp')
| -rw-r--r-- | src/yuzu_cmd/yuzu.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index bc4002d8af..6342c5d353 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp @@ -249,6 +249,7 @@ struct SdlState { // Must outlive emu_window, which keeps a pointer to it. InputCommon::InputSubsystem input_subsystem{}; std::unique_ptr<EmuWindow_SDL3> emu_window; + bool network_initialized{}; }; static std::atomic_bool pack_nup_cancel{false}; @@ -353,6 +354,12 @@ extern "C" SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) { return SDL_APP_FAILURE; } + state->network_initialized = Network::Init(); + if (!state->network_initialized) { + LOG_CRITICAL(Network, "Failed to initialize room networking"); + return SDL_APP_FAILURE; + } + state->system.Initialize(); @@ -555,7 +562,11 @@ extern "C" void SDL_AppQuit(void *appstate, SDL_AppResult result) { void(state->system.Pause()); state->system.ShutdownMainProcess(); } + const bool network_initialized = state->network_initialized; delete state; + if (network_initialized) { + Network::Shutdown(); + } } #define VMA_IMPLEMENTATION |
