mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-25 18:05:12 -04:00
netplay: take the scheduler, input history and hash-confirm from recomp-net
recomp-net now carries the peer-facing rollback modules that used to live in retcomm-rbengine (RetroPortingToolKit/recomp-net#14). Switch the MotK shims and psx_netplay_sched.c from rbe_sched_* / rbe_ih_* / rbe_hc_* / rbe_rb_peer_post_tip_ok to their rnet_* names and recomp_net/ headers, and bump lib/recomp-net to c2338c6. The netplay_* / np_sched_* surface the rest of the runtime calls is unchanged. The snap ring and rbe_mono_ms still come from retcomm-rbengine, which stays at a7b9850 for now; the three moved-module unit tests link recomp_net directly instead of reaching it through rbengine. RBE_RB_* env knobs keep their names. Checked with PSX_NETPLAY=ON: psx-runtime links and the netplay tests pass against both the current rbengine and the split one (rbengine refactor/launcher-core), and the binary's 33 scheduler / history / hash-confirm functions now resolve to rnet_* where they were rbe_*. lobby_chat_ring_test does not compile on master either (chat_push arity) and is untouched here. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+1
-1
Submodule lib/recomp-net updated: 859ba28b93...c2338c6387
@@ -570,8 +570,9 @@ if(BUILD_TESTING)
|
||||
add_test(NAME gpu_vk_upload_alignment_test
|
||||
COMMAND gpu_vk_upload_alignment_test)
|
||||
|
||||
# Portable rollback helpers (retcomm-rbengine) — required for MotK netplay
|
||||
# unit tests that use the netplay_* compatibility shims.
|
||||
# Portable rollback helpers — required for MotK netplay unit tests that use
|
||||
# the netplay_* compatibility shims. The peer-facing ones (hash_confirm,
|
||||
# input_hist, rb_post) live in recomp-net; the snap ring in retcomm-rbengine.
|
||||
set(_RBE_ROOT "${PSXRECOMP_ROOT}/lib/retcomm-rbengine")
|
||||
set(_RNET_ROOT "${PSXRECOMP_ROOT}/lib/recomp-net")
|
||||
if(EXISTS "${_RBE_ROOT}/CMakeLists.txt" AND EXISTS "${_RNET_ROOT}/CMakeLists.txt")
|
||||
@@ -597,7 +598,7 @@ if(BUILD_TESTING)
|
||||
add_executable(netplay_hash_confirm_test
|
||||
tests/test_netplay_hash_confirm.c)
|
||||
target_include_directories(netplay_hash_confirm_test PRIVATE include)
|
||||
target_link_libraries(netplay_hash_confirm_test PRIVATE retcomm_rbengine)
|
||||
target_link_libraries(netplay_hash_confirm_test PRIVATE recomp_net)
|
||||
add_test(NAME netplay_hash_confirm_test COMMAND netplay_hash_confirm_test)
|
||||
|
||||
# save/load glue #included from the test; ring ops come from rbengine.
|
||||
@@ -634,7 +635,7 @@ if(BUILD_TESTING)
|
||||
|
||||
add_executable(rb_post_tip_filter_test tests/test_rb_post_tip_filter.c)
|
||||
target_include_directories(rb_post_tip_filter_test PRIVATE include)
|
||||
target_link_libraries(rb_post_tip_filter_test PRIVATE retcomm_rbengine)
|
||||
target_link_libraries(rb_post_tip_filter_test PRIVATE recomp_net)
|
||||
add_test(NAME rb_post_tip_filter_test COMMAND rb_post_tip_filter_test)
|
||||
|
||||
add_executable(netplay_input_hist_test
|
||||
@@ -645,7 +646,7 @@ if(BUILD_TESTING)
|
||||
${_RNET_ROOT}/include)
|
||||
target_compile_definitions(netplay_input_hist_test PRIVATE
|
||||
PSX_HAS_RECOMP_NET=1)
|
||||
target_link_libraries(netplay_input_hist_test PRIVATE retcomm_rbengine)
|
||||
target_link_libraries(netplay_input_hist_test PRIVATE recomp_net)
|
||||
add_test(NAME netplay_input_hist_test COMMAND netplay_input_hist_test)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -2,29 +2,29 @@
|
||||
#define PSX_NETPLAY_HASH_CONFIRM_H
|
||||
|
||||
/*
|
||||
* MotK compatibility shim → retcomm-rbengine hash_confirm.
|
||||
* Prefer rbe_hc_* in new code.
|
||||
* MotK compatibility shim → recomp-net hash_confirm.
|
||||
* Prefer rnet_hc_* in new code.
|
||||
*/
|
||||
|
||||
#include "retcomm_rbengine/hash_confirm.h"
|
||||
#include "recomp_net/hash_confirm.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define NETPLAY_HC_RING RBE_HC_RING
|
||||
typedef RbeHashConfirm NetplayHashConfirm;
|
||||
#define NETPLAY_HC_RING RNET_HC_RING
|
||||
typedef RNetHashConfirm NetplayHashConfirm;
|
||||
|
||||
#define netplay_hc_reset rbe_hc_reset
|
||||
#define netplay_hc_prime_after rbe_hc_prime_after
|
||||
#define netplay_hc_note_local rbe_hc_note_local
|
||||
#define netplay_hc_note_peer rbe_hc_note_peer
|
||||
#define netplay_hc_resolved_through rbe_hc_resolved_through
|
||||
#define netplay_hc_confirm_through rbe_hc_confirm_through
|
||||
#define netplay_hc_local_digest rbe_hc_local_digest
|
||||
#define netplay_hc_peer_digest rbe_hc_peer_digest
|
||||
#define netplay_hc_peek_mismatch rbe_hc_peek_mismatch
|
||||
#define netplay_hc_heal_stale_gap rbe_hc_heal_stale_gap
|
||||
#define netplay_hc_reset rnet_hc_reset
|
||||
#define netplay_hc_prime_after rnet_hc_prime_after
|
||||
#define netplay_hc_note_local rnet_hc_note_local
|
||||
#define netplay_hc_note_peer rnet_hc_note_peer
|
||||
#define netplay_hc_resolved_through rnet_hc_resolved_through
|
||||
#define netplay_hc_confirm_through rnet_hc_confirm_through
|
||||
#define netplay_hc_local_digest rnet_hc_local_digest
|
||||
#define netplay_hc_peer_digest rnet_hc_peer_digest
|
||||
#define netplay_hc_peek_mismatch rnet_hc_peek_mismatch
|
||||
#define netplay_hc_heal_stale_gap rnet_hc_heal_stale_gap
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define PSX_NETPLAY_INPUT_HIST_H
|
||||
|
||||
/*
|
||||
* MotK input history: portable ring/invent in retcomm-rbengine; PSX pad
|
||||
* MotK input history: portable ring/invent in recomp-net; PSX pad
|
||||
* conversion stays in netplay_input_hist.c.
|
||||
*/
|
||||
|
||||
@@ -11,23 +11,23 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "psx_netplay.h"
|
||||
#include "retcomm_rbengine/input_hist.h"
|
||||
#include "recomp_net/input_hist.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define NETPLAY_INPUT_HIST_DEPTH RBE_INPUT_HIST_DEPTH
|
||||
#define NETPLAY_INPUT_HIST_MAX_SLOTS RBE_INPUT_HIST_MAX_SLOTS
|
||||
typedef RbeInputHist NetplayInputHist;
|
||||
#define NETPLAY_INPUT_HIST_DEPTH RNET_INPUT_HIST_DEPTH
|
||||
#define NETPLAY_INPUT_HIST_MAX_SLOTS RNET_INPUT_HIST_MAX_SLOTS
|
||||
typedef RNetInputHist NetplayInputHist;
|
||||
|
||||
#define netplay_ih_reset rbe_ih_reset
|
||||
#define netplay_ih_frame_to_contract rbe_ih_frame_to_contract
|
||||
#define netplay_ih_put rbe_ih_put
|
||||
#define netplay_ih_get rbe_ih_get
|
||||
#define netplay_ih_invent_hold_last rbe_ih_invent_hold_last
|
||||
#define netplay_ih_invent_idle rbe_ih_invent_idle
|
||||
#define netplay_ih_promote rbe_ih_promote
|
||||
#define netplay_ih_reset rnet_ih_reset
|
||||
#define netplay_ih_frame_to_contract rnet_ih_frame_to_contract
|
||||
#define netplay_ih_put rnet_ih_put
|
||||
#define netplay_ih_get rnet_ih_get
|
||||
#define netplay_ih_invent_hold_last rnet_ih_invent_hold_last
|
||||
#define netplay_ih_invent_idle rnet_ih_invent_idle
|
||||
#define netplay_ih_promote rnet_ih_promote
|
||||
|
||||
/* PsxNetPad ↔ RNetRbFrame (LX/LY only; RX/RY stay on the pad blob path). */
|
||||
void netplay_ih_pad_to_frame(const PsxNetPad *pad, uint32_t tick, uint8_t predicted,
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
#define PSX_NETPLAY_RB_POST_H
|
||||
|
||||
/*
|
||||
* MotK compatibility shim → retcomm-rbengine rb_post tip filter.
|
||||
* MotK compatibility shim → recomp-net rb_post tip filter.
|
||||
*/
|
||||
|
||||
#include "retcomm_rbengine/rb_post.h"
|
||||
#include "recomp_net/rb_post.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define netplay_rb_peer_post_tip_ok rbe_rb_peer_post_tip_ok
|
||||
#define netplay_rb_peer_post_tip_ok rnet_rb_peer_post_tip_ok
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -16,9 +16,9 @@ extern "C" {
|
||||
struct CPUState;
|
||||
struct RNetSession;
|
||||
/* Alias Rbe* — not `struct Netplay*`; that tag is a distinct incomplete type
|
||||
* from `typedef RbeHashConfirm NetplayHashConfirm` in the MotK shims. */
|
||||
typedef struct RbeInputHist NetplayInputHist;
|
||||
typedef struct RbeHashConfirm NetplayHashConfirm;
|
||||
* from `typedef RNetHashConfirm NetplayHashConfirm` in the MotK shims. */
|
||||
typedef struct RNetInputHist NetplayInputHist;
|
||||
typedef struct RNetHashConfirm NetplayHashConfirm;
|
||||
|
||||
typedef struct PsxNetplayRbBindings {
|
||||
struct RNetSession **session;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/* psx_netplay_sched.h — MotK facade over retcomm-rbengine (rbe_sched_*).
|
||||
/* psx_netplay_sched.h — MotK facade over recomp-net (rnet_sched_*).
|
||||
*
|
||||
* Policy lives in lib/retcomm-rbengine. This header keeps the historical
|
||||
* Policy lives in lib/recomp-net. This header keeps the historical
|
||||
* np_sched_* / PsxNpSchedBridge surface; MotK dig0/FMV/RTT enter through
|
||||
* gates in psx_netplay_sched.c.
|
||||
*
|
||||
* Env knobs: RBE_RB_* (preferred) with MotK PSX_RB_* fallback in rbengine.
|
||||
* Env knobs: RBE_RB_* (preferred) with MotK PSX_RB_* fallback in recomp-net.
|
||||
*
|
||||
* The scheduler's job (design contract, 2026-08-02):
|
||||
* - keep both peers at the same simulation time (mispredict-driven pacing,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* psx_netplay_sched.c — MotK thin glue over retcomm-rbengine.
|
||||
/* psx_netplay_sched.c — MotK thin glue over recomp-net.
|
||||
*
|
||||
* Policy lives in lib/retcomm-rbengine (rbe_sched_*). This TU binds MotK FMV /
|
||||
* Policy lives in lib/recomp-net (rnet_sched_*). This TU binds MotK FMV /
|
||||
* dig0 / RTT gates and keeps the historical np_sched_* call surface.
|
||||
*/
|
||||
|
||||
@@ -42,7 +42,7 @@ void np_sched_arm_absurd_invent_catchup(void) {}
|
||||
|
||||
#include "psx_netplay_rb.h"
|
||||
#include "retcomm_rbengine/mono_ms.h"
|
||||
#include "retcomm_rbengine/sched.h"
|
||||
#include "recomp_net/sched.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -132,10 +132,10 @@ static uint8_t np_gate_pre_admit_hold(void *ctx, uint32_t sim, uint32_t wire,
|
||||
|
||||
void np_sched_bind(const PsxNpSchedBridge *bridge)
|
||||
{
|
||||
RbeSchedBridge rb;
|
||||
RNetSchedBridge rb;
|
||||
memset(&rb, 0, sizeof(rb));
|
||||
if (!bridge) {
|
||||
rbe_sched_bind(NULL);
|
||||
rnet_sched_bind(NULL);
|
||||
return;
|
||||
}
|
||||
rb.session = bridge->session;
|
||||
@@ -154,74 +154,74 @@ void np_sched_bind(const PsxNpSchedBridge *bridge)
|
||||
rb.gates.pre_admit_hold = np_gate_pre_admit_hold;
|
||||
rb.gates.episode_count = np_gate_episode_count;
|
||||
rb.gates.replay_ticks_total = np_gate_replay_ticks_total;
|
||||
rbe_sched_bind(&rb);
|
||||
rnet_sched_bind(&rb);
|
||||
}
|
||||
|
||||
void np_sched_reset_session(void)
|
||||
{
|
||||
rbe_sched_reset_session();
|
||||
rnet_sched_reset_session();
|
||||
}
|
||||
|
||||
uint32_t np_sched_wire_for_sim(uint32_t sim_tick)
|
||||
{
|
||||
return rbe_sched_wire_for_sim(sim_tick);
|
||||
return rnet_sched_wire_for_sim(sim_tick);
|
||||
}
|
||||
|
||||
int np_sched_real_delay_enabled(void)
|
||||
{
|
||||
return rbe_sched_real_delay_enabled();
|
||||
return rnet_sched_real_delay_enabled();
|
||||
}
|
||||
|
||||
void np_sched_sync_delay_from_session(void)
|
||||
{
|
||||
rbe_sched_sync_delay_from_session();
|
||||
rnet_sched_sync_delay_from_session();
|
||||
}
|
||||
|
||||
int np_sched_pre_admit(uint32_t sim, uint32_t wire, const RNetSessionStats *st)
|
||||
{
|
||||
return rbe_sched_pre_admit(sim, wire, st);
|
||||
return rnet_sched_pre_admit(sim, wire, st);
|
||||
}
|
||||
|
||||
int np_sched_on_remote_miss(int slot, uint32_t sim, uint32_t wire,
|
||||
const RNetSessionStats *st, int pred,
|
||||
const char **reason_out)
|
||||
{
|
||||
return rbe_sched_on_remote_miss(slot, sim, wire, st, pred, reason_out);
|
||||
return rnet_sched_on_remote_miss(slot, sim, wire, st, pred, reason_out);
|
||||
}
|
||||
|
||||
void np_sched_note_remote_hit(void)
|
||||
{
|
||||
rbe_sched_note_remote_hit();
|
||||
rnet_sched_note_remote_hit();
|
||||
}
|
||||
|
||||
void np_sched_post_admit(int any_invent)
|
||||
{
|
||||
rbe_sched_post_admit(any_invent);
|
||||
rnet_sched_post_admit(any_invent);
|
||||
}
|
||||
|
||||
void np_sched_set_admit_stall(const char *tag)
|
||||
{
|
||||
rbe_sched_set_admit_stall(tag);
|
||||
rnet_sched_set_admit_stall(tag);
|
||||
}
|
||||
|
||||
void np_sched_clear_admit_stall(void)
|
||||
{
|
||||
rbe_sched_clear_admit_stall();
|
||||
rnet_sched_clear_admit_stall();
|
||||
}
|
||||
|
||||
const char *np_sched_admit_stall_tag(void)
|
||||
{
|
||||
return rbe_sched_admit_stall_tag();
|
||||
return rnet_sched_admit_stall_tag();
|
||||
}
|
||||
|
||||
void np_sched_note_mispredict(uint32_t age)
|
||||
{
|
||||
rbe_sched_note_mispredict(age);
|
||||
rnet_sched_note_mispredict(age);
|
||||
}
|
||||
|
||||
void np_sched_note_episode_boundary(void)
|
||||
{
|
||||
rbe_sched_note_episode_boundary();
|
||||
rnet_sched_note_episode_boundary();
|
||||
}
|
||||
|
||||
void psx_netplay_timesync_on_episode_boundary(void)
|
||||
@@ -231,7 +231,7 @@ void psx_netplay_timesync_on_episode_boundary(void)
|
||||
|
||||
void np_sched_arm_absurd_invent_catchup(void)
|
||||
{
|
||||
rbe_sched_arm_absurd_invent_catchup();
|
||||
rnet_sched_arm_absurd_invent_catchup();
|
||||
}
|
||||
|
||||
#endif /* PSX_HAS_RECOMP_NET */
|
||||
|
||||
Reference in New Issue
Block a user