Skip to content

Commit e348c8f

Browse files
committed
Fix up logging for better details
1 parent 343145c commit e348c8f

File tree

4 files changed

+15
-19
lines changed

4 files changed

+15
-19
lines changed

BeatSaberOnline/Data/Steam/LobbyInfo.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ public override int GetHashCode()
134134
{
135135
return unchecked(this.LobbyID.m_SteamID.GetHashCode() * 17 + this.HostName.GetHashCode());
136136
}
137+
public string ToString()
138+
{
139+
return $"lobbyId={LobbyID},hostname={HostName},status={Status},joinable={Joinable},UsedSlots={UsedSlots},TotalSlots={TotalSlots},MaxSlots={MaxSlots},CurrentSongId={CurrentSongId},CurrentSongDifficulty={CurrentSongDifficulty},CurretnSongName={CurrentSongName},Screen={Screen},gameplayModifiers={_gameplayModifiers}";
140+
}
137141

138142
public string Serialize()
139143
{

BeatSaberOnline/Data/Steam/SteamAPI.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ public static void FinishSong()
245245
private static void SendLobbyInfo(bool reqHost = false)
246246
{
247247
if (reqHost && !IsHost()) return;
248+
Logger.Debug($"Sending {_lobbyInfo.ToString()}");
248249
SteamMatchmaking.SetLobbyData(_lobbyInfo.LobbyID, "LOBBY_INFO", _lobbyInfo.Serialize());
249250
}
250251
public static void IncreaseSlots()

BeatSaberOnline/Data/Steam/SteamCallbacks.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,25 @@ public void OnLobbyDataUpdate(LobbyDataUpdate_t pCallback)
4949
LobbyInfo info = new LobbyInfo(SteamMatchmaking.GetLobbyData(new CSteamID(pCallback.m_ulSteamIDLobby), "LOBBY_INFO"));
5050

5151
if (pCallback.m_ulSteamIDLobby == 0) return;
52-
52+
Logger.Debug($"Received: {info.ToString()}");
5353
if (pCallback.m_ulSteamIDLobby == SteamAPI.getLobbyID().m_SteamID)
5454
{
55+
SteamAPI.UpdateLobbyInfo(info);
5556
if (DidScreenChange(info.Screen, LobbyInfo.SCREEN_TYPE.WAITING))
5657
{
58+
currentScreen = info.Screen;
5759
Logger.Debug($"Song has been selected, going to the waiting screen");
5860
WaitingMenu.Instance.Present();
5961
}
6062
else if (DidScreenChange(info.Screen, LobbyInfo.SCREEN_TYPE.MENU))
6163
{
64+
currentScreen = info.Screen;
6265
Logger.Debug($"Song has finished, updating state to menu");
6366
GameController.Instance.SongFinished(null, null, null, null);
6467
}
6568
else if (DidScreenChange(info.Screen, LobbyInfo.SCREEN_TYPE.PLAY_SONG))
6669
{
70+
currentScreen = info.Screen;
6771
Logger.Debug($"Host requested to play the current song {info.CurrentSongId}");
6872

6973
LevelSO song = SongListUtils.GetInstalledSong();
@@ -75,9 +79,6 @@ public void OnLobbyDataUpdate(LobbyDataUpdate_t pCallback)
7579
SteamAPI.ClearPlayerReady(new CSteamID(SteamAPI.GetUserID()), true);
7680
SongListUtils.StartSong(song, SteamAPI.GetSongDifficulty(), info.GameplayModifiers);
7781
}
78-
79-
SteamAPI.UpdateLobbyInfo(info);
80-
currentScreen = info.Screen;
8182
} else
8283
{
8384
SteamAPI.SetOtherLobbyData(pCallback.m_ulSteamIDLobby, info);

BeatSaberOnline/Views/Menus/WaitingMenu.cs

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,21 +82,12 @@ public static void Init()
8282

8383
private static void ReadyUp(LevelSO song)
8484
{
85-
try
86-
{
87-
Data.Logger.Info("RU queued song " + (queuedSong == null ? "is null" : "is not null"));
88-
Data.Logger.Info("RU song " + (queuedSong == null ? "is null" : "is not null"));
89-
90-
if (queuedSong != null || (queuedSong == null && song == null)) { return; }
91-
if (queuedSong == null && song != null)
92-
{
93-
queuedSong = song;
94-
SteamAPI.SetReady();
95-
PreviewPlayer.CrossfadeTo(song.audioClip, song.previewStartTime, song.previewDuration);
96-
}
97-
} catch (Exception e)
85+
if (queuedSong != null || (queuedSong == null && song == null)) { return; }
86+
if (queuedSong == null && song != null)
9887
{
99-
Data.Logger.Error(e);
88+
queuedSong = song;
89+
SteamAPI.SetReady();
90+
PreviewPlayer.CrossfadeTo(song.audioClip, song.previewStartTime, song.previewDuration);
10091
}
10192
}
10293
public static void RefreshData(LevelSO song = null)
@@ -164,7 +155,6 @@ public static void LevelDownloaded(string hash)
164155
{
165156
Logger.Error(e);
166157
}
167-
168158
}
169159
}
170160
}

0 commit comments

Comments
 (0)