From a7a61f808eb8cb228384a59340f0479ef8529c6c Mon Sep 17 00:00:00 2001 From: Schindler Date: Thu, 19 Nov 2026 01:29:57 -0500 Subject: [PATCH] Online fights no longer end after ~10 s above 30 fps With 30 Hz logic the network manager task (FUN_0890E794, the battle's pad exchange FUN_0890D664) ran on every displayed frame. On the drawn-only frames the other copy's pad for the next frame was not there yet, so the exchange counted a waiting frame each time, and after the game's 900 waiting frames it ended the session without a message. The task now runs on logic frames only, as on the PSP. PSPRECOMP_L30_NET_EVERY_FRAME=1 restores the old behaviour. Checked with two copies on one machine (LAN, Online Lobby 1-on-1, Lightning vs Lightning, 120 fps): before, both left the fight about 10 s in; after, still in the fight at 90 s, and both copies show the same Bravery and HP after hits. At 30 fps (no 30 Hz logic) fights were already fine. The 900-frame timeout comes from VCKing101's notes on the game's exchange (https://github.com/VCKing101/Dissidia012-pc, docs/port/communication-mode.md). Co-Authored-By: Claude Opus 5.5 --- psprecomp/games/dissidia/docs/multiplayer.md | 7 +++++++ psprecomp/games/dissidia/runtime/framerate.cpp | 14 ++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/psprecomp/games/dissidia/docs/multiplayer.md b/psprecomp/games/dissidia/docs/multiplayer.md index 7126ac6..9285fff 100644 --- a/psprecomp/games/dissidia/docs/multiplayer.md +++ b/psprecomp/games/dissidia/docs/multiplayer.md @@ -80,6 +80,13 @@ group with others, the game runs at the **lowest rate any of them asked for**, s both run at 30. It returns to the player's own setting when the group ends. A message at the top of the screen tells you the rate for five seconds ("Online: 30 fps (lowest player's setting)"), and again when the group ends. This logic is in `runtime/framerate.cpp` (`psp_adhoc_group_fps_cap()`). +Above 30 fps a fight runs on 30 Hz logic ([frame-rate.md](frame-rate.md)): the game advances on one displayed frame in two, three or +four. Its network manager task (`FUN_0890E794`, which runs the battle's per-frame pad exchange `FUN_0890D664`) only runs on those logic +frames. Until 19 November 2026 it ran on every displayed frame; on the in-between frames the other copy's pad for the next frame was +not there yet, the exchange counted a waiting frame, and after the game's 900 waiting frames it ended the session without a message: +about 10 s into every online fight at 120 fps (two copies on one machine, LAN; 30 fps was fine). `PSPRECOMP_L30_NET_EVERY_FRAME=1` +brings the old behaviour back for tests. + ## Options | Variable | Meaning | diff --git a/psprecomp/games/dissidia/runtime/framerate.cpp b/psprecomp/games/dissidia/runtime/framerate.cpp index 50edc4e..0428c2a 100644 --- a/psprecomp/games/dissidia/runtime/framerate.cpp +++ b/psprecomp/games/dissidia/runtime/framerate.cpp @@ -1721,6 +1721,19 @@ bool battle_scene_list(uint32_t list) { // the battle scene's task list: the o no = list; return false; } +// The network manager task (FUN_0890E794, called from the frame pump FUN_088EC010 once a displayed frame) runs a Communications +// battle's per-frame pad exchange (role 0 handler FUN_0890D664). With 30 Hz logic above 30 fps it ran on the drawn-only frames too: +// the battle frame had not advanced, the other copy's pad for the next frame was not there yet, so the handler counted a waiting +// frame each time, and after the game's 900 waiting frames (VCKing101's notes, docs/port/communication-mode.md 4.2) it ended the +// session without a message: about 10 s into every online fight at 120 fps (19 Nov 2026). It now runs on logic frames only, as on +// the PSP. PSPRECOMP_L30_NET_EVERY_FRAME=1 restores the old behaviour (tests). +FuncPtr g_orig_net_task = nullptr; +void net_task_hook(uint8_t* rdram, recomp_context* ctx) { + static const bool every = std::getenv("PSPRECOMP_L30_NET_EVERY_FRAME") != nullptr; + if (!every && l30_active() && !g_l30_logic_now) return; + g_orig_net_task(rdram, ctx); +} + void task_run_hook(uint8_t* rdram, recomp_context* ctx) { if (l30_active() && !g_l30_logic_now && ctx->r[5] == 1 && ctx->r[6] == 1 && battle_scene_list(static_cast(ctx->r[4]))) { ctx->r[5] = 4; ctx->r[6] = 4; // a drawn-only frame: the battle runs as if paused @@ -2577,6 +2590,7 @@ void dissidia_framerate_install(uint8_t* rdram) { if (const char* rl = std::getenv("PSPRECOMP_TASK_RUNLOG")) for (const char* q = rl; *q;) { g_runlog_ticks.push_back(std::strtoull(q, nullptr, 10)); const char* c = std::strchr(q, ','); if (!c) break; q = c + 1; } if ((g_logic30 || !g_runlog_ticks.empty()) && (g_orig_task_run = psp_dispatch_probe_lookup(0x0888245Cu))) psp_dispatch_register(0x0888245Cu, task_run_hook); + if (g_logic30 && (g_orig_net_task = psp_dispatch_probe_lookup(0x0890E794u))) psp_dispatch_register(0x0890E794u, net_task_hook); if (std::getenv("PSPRECOMP_TASK_TRACE")) { if ((g_orig_task_exec = psp_dispatch_probe_lookup(0x088413D0u))) psp_dispatch_register(0x088413D0u, task_exec_hook); if ((g_orig_task_draw = psp_dispatch_probe_lookup(0x088881BCu))) psp_dispatch_register(0x088881BCu, task_draw_hook);