Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions AdvancedCoop/CoopAdvancedHardening.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void IOnAdvancedModuleInitializing.OnAdvancedModuleInitializing(ModEntry entry)

void IOnFrameUpdate.OnFrameUpdate(double dt)
{
var net = GameMenu.NetRef;
var net = LobbySession.NetRef;
if (net == null || !net.IsAlive)
{
_wasConnected = false;
Expand All @@ -77,7 +77,7 @@ void IOnFrameUpdate.OnFrameUpdate(double dt)
{
_nextLobbyHeartbeatTicks = now + SecondsToTicks(LobbyHeartbeatSeconds);
SendLobbyHeartbeat(net);
GameMenu.RefreshRoomStatusMenuIfVisible();
LobbySession.RefreshRoomStatusMenuIfVisible();
}

if (_nextProgressSyncTicks == 0 || now >= _nextProgressSyncTicks)
Expand Down Expand Up @@ -106,8 +106,8 @@ private static void SendLobbyHeartbeat(NetNode net)
try
{
var level = ModEntry.me?._level?.map?.id?.ToString() ?? ModEntry.Instance?.levelId ?? string.Empty;
var seed = GameMenu.TryGetKnownSeed(out var knownSeed) ? knownSeed : 0;
net.SendLobbyState(GameMenu.Username, level, seed, GetLocalPermanentProgressSignature());
var seed = LobbySession.TryGetKnownSeed(out var knownSeed) ? knownSeed : 0;
net.SendLobbyState(LobbySession.Username, level, seed, GetLocalPermanentProgressSignature());
}
catch (Exception ex)
{
Expand Down Expand Up @@ -194,8 +194,8 @@ private static void PushConnectionHudStatus(NetNode net)
if (!_connectedHudMessageShown || (net.IsHost && remoteCount > System.Math.Max(0, previousRemoteCount)))
{
var status = net.IsHost
? string.Format(CultureInfo.CurrentCulture, GameMenu.Localize("Co-op: {0} friend(s) connected"), remoteCount)
: GameMenu.Localize("Co-op: connected to host");
? string.Format(CultureInfo.CurrentCulture, LobbySession.Localize("Co-op: {0} friend(s) connected"), remoteCount)
: LobbySession.Localize("Co-op: connected to host");
MultiplayerUI.PushSystemMessage(status, 4.0, 1.0);
_connectedHudMessageShown = true;
}
Expand All @@ -222,7 +222,7 @@ public static void ReceiveLobbyState(string payload)
var name = parts[nameIndex].Trim();
if (name.Length > 64)
name = name[..64];
GameMenu.ReceiveRemoteUsername(name);
LobbySession.ReceiveRemoteUsername(name);
}
}
catch (Exception ex)
Expand Down Expand Up @@ -259,7 +259,7 @@ public static void ReceiveRuneProgress(string payload)
// mobility/rune state is visible, recreating the old "same seed but only same save works"
// race. The coalesced action is also safe when no User exists yet; the normal frame/hero
// retry keeps the pending items until one becomes available.
GameMenu.EnqueueCriticalMainThreadCoalesced(
MainThreadPump.EnqueueCriticalMainThreadCoalesced(
"coop:apply-host-progress",
ApplyPendingPermanentProgress);
}
Expand Down Expand Up @@ -307,7 +307,7 @@ private static void ApplyPendingPermanentProgress()
{
_lastAppliedProgress = sig;
MultiplayerUI.PushSystemMessage(
string.Format(CultureInfo.CurrentCulture, GameMenu.Localize("Co-op progression synced: +{0} unlock(s)"), added),
string.Format(CultureInfo.CurrentCulture, LobbySession.Localize("Co-op progression synced: +{0} unlock(s)"), added),
6.0,
1.5);
_log?.Information("[CoopAdvanced] Applied {Count} synced permanent unlocks", added);
Expand Down
4 changes: 2 additions & 2 deletions FakeDeath/FakeDeath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ private void ProcessReviveHold(NetNode net)
return;
}

var isHoldPressed = GameMenu.IsReviveHoldInputDown(me);
var isHoldPressed = ReviveInput.IsReviveHoldInputDown(me);

if (!isHoldPressed)
{
Expand Down Expand Up @@ -1304,7 +1304,7 @@ private void HandleAllPlayersDowned(NetNode net)
return;

_allDownedRestartQueued = true;
GameMenu.QueueHostRestartFromDeath("all_players_downed");
LobbySession.QueueHostRestartFromDeath("all_players_downed");
}

private void ShowAllDownedGameOverLogo()
Expand Down
4 changes: 2 additions & 2 deletions GameDataSync/GameDataSync.LevelGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public static void ReceiveLevelGraph(string payload)

// Lobby auto-start waits on HasPendingRemoteLevelGraph; re-arm if seed/exec
// already arrived before this LGRAPH.
GameMenu.NotifyClientLaunchPrerequisiteProgress();
LobbySession.NotifyClientLaunchPrerequisiteProgress();

var reason = LevelReloadReason.GraphUpdated;
// Graph and boss-rune packets can arrive in either order. Fold a pending boss-rune
Expand Down Expand Up @@ -403,7 +403,7 @@ private static bool TryWaitGetRemoteLevelGraph(string levelId, int timeoutMs, ou
// committing a locally generated layout.
if (now >= nextRequestAt)
{
try { GameMenu.NetRef?.RequestLevelGraph(levelId); } catch { }
try { LobbySession.NetRef?.RequestLevelGraph(levelId); } catch { }
nextRequestAt = now + 1000;
}

Expand Down
47 changes: 38 additions & 9 deletions GameDataSync/GameDataSync.LevelGraphCapture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,25 @@ internal partial class GameDataSync

private static void TryCaptureLevelGraphNode(object? candidate, LevelGraphSync sync, HashSet<string> seenUids)
{
if (candidate is not RoomNode node)
return;
// One unsupported node property (e.g. a generated proxy method missing in this game
// build) must never abort the whole graph capture. Skip the node, keep the topology.
try
{
if (candidate is not RoomNode node)
return;

var nodeSync = CaptureLevelGraphNode(node);
if (nodeSync == null || string.IsNullOrWhiteSpace(nodeSync.Uid))
return;
var nodeSync = CaptureLevelGraphNode(node);
if (nodeSync == null || string.IsNullOrWhiteSpace(nodeSync.Uid))
return;

if (!seenUids.Add(nodeSync.Uid))
return;
if (!seenUids.Add(nodeSync.Uid))
return;

sync.Nodes.Add(nodeSync);
sync.Nodes.Add(nodeSync);
}
catch
{
}
}

private static LevelGraphNodeSync? CaptureLevelGraphNode(RoomNode node)
Expand Down Expand Up @@ -113,7 +121,7 @@ private static void TryCaptureLevelGraphNode(object? candidate, LevelGraphSync s
ZChildrenUids = CaptureRoomNodeUids(node.zChildren),
Npcs = CaptureNpcIds(node.npcs),
ZLinks = CaptureZLinks(node.zLinks),
GenData = CaptureLevelGraphGenData(node.genData)
GenData = TryCaptureLevelGraphGenData(node)
};
}

Expand Down Expand Up @@ -290,6 +298,27 @@ private static List<LevelGraphZLinkSync> CaptureZLinks(ArrayObj? zLinks)
return hasAny ? result : null;
}

/// <summary>
/// <see cref="RoomNode.genData"/> is a generated proxy virtual; a game build that renamed or
/// dropped <c>get_genData()</c> makes the plain property access throw "Method not found"
/// BEFORE <see cref="CaptureLevelGraphGenData"/>'s dynamic reads ever run, which aborted the
/// entire graph capture and silently starved the client of the authoritative layout (host
/// logged "Failed to send level graph", client logged WORLD DESYNC + abort). The captured
/// GenData is informational only (the apply path copies the client's own local genData), so
/// a failed read must degrade to null, never kill the capture.
/// </summary>
private static LevelGraphGenDataSync? TryCaptureLevelGraphGenData(RoomNode node)
{
try
{
return CaptureLevelGraphGenData(node.genData);
}
catch
{
return null;
}
}

private static LevelGraphZDoorTypeSync? CaptureZDoorType(ZDoorType? zDoorType)
{
if (zDoorType is null)
Expand Down
8 changes: 4 additions & 4 deletions GameDataSync/GameDataSync.LevelGraphReload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private static void ScheduleLevelReload(string levelId, LevelReloadReason reason
if (string.IsNullOrWhiteSpace(levelId) || reason == LevelReloadReason.None)
return;

var net = GameMenu.NetRef;
var net = LobbySession.NetRef;
if (net == null || !net.IsAlive || net.IsHost)
return;

Expand All @@ -118,7 +118,7 @@ private static void ScheduleLevelReload(string levelId, LevelReloadReason reason
_pendingLevelReloadPayloads[levelId] = null;
}

GameMenu.EnqueueMainThreadCoalesced("level:reload:" + levelId, () =>
MainThreadPump.EnqueueMainThreadCoalesced("level:reload:" + levelId, () =>
{
try
{
Expand All @@ -143,7 +143,7 @@ private static bool ShouldSuppressClientLevelReload()
{
if (ModEntry.IsLocalPlayerDowned())
return true;
if (GameMenu.IsClientRestartPending())
if (LobbySession.IsClientRestartPending())
return true;
}
catch
Expand Down Expand Up @@ -175,7 +175,7 @@ private static void TryTriggerLevelReload(string graphLevelId)
_pendingLevelReloadPayloads.Remove(graphLevelId);
}

var net = GameMenu.NetRef;
var net = LobbySession.NetRef;
if (net == null || !net.IsAlive || net.IsHost)
return;

Expand Down
Loading
Loading