Goobwabber / MultiplayerCore

A Beat Saber mod that implements core custom multiplayer functionality.
MIT License
66 stars 36 forks source link

[BUG] Beat Saber 1.28.0 stalls after CustomSongColorsPatch #36

Closed InvoxiPlayGames closed 1 year ago

InvoxiPlayGames commented 1 year ago

MultiplayerCore Version and Download Source MultiplayerCore v1.1.2 from GitHub releases (the version built from source crashes with infinite NullReferenceException errors, so I haven't been able to narrow down any issues myself)

Your Platform Steam on PC, version 1.28.0 (using a self-compiled build of SongCore commit 7a7bb3e)

Describe the bug When attempting to play a song on official Beat Saber servers with MultiplayerCore installed, the game stalls after the 5 second countdown when starting a song. Uninstalling MultiplayerCore works as intended.

To Reproduce

  1. Launch the game and go on multiplayer
  2. Click on any song
  3. Start the song
  4. See error in the logs, the game will keep you stalled in the purple environment (still able to exit the UI, so not a softlock or a crash)

Expected behavior The song should be playing normally.

Log

[CRITICAL @ 21:56:06 | UnityEngine] NullReferenceException: Object reference not set to an instance of an object
[CRITICAL @ 21:56:06 | UnityEngine] MultiplayerCore.Patches.CustomSongColorsPatch.Prefix (IDifficultyBeatmap& difficultyBeatmap, ColorScheme& overrideColorScheme) (at <2af17fc095ca4d6aa38c7d9ef553c66c>:0)
[CRITICAL @ 21:56:06 | UnityEngine] (wrapper dynamic-method) MultiplayerLevelScenesTransitionSetupDataSO.DMD<MultiplayerLevelScenesTransitionSetupDataSO::Init>(MultiplayerLevelScenesTransitionSetupDataSO,string,IPreviewBeatmapLevel,BeatmapDifficulty,BeatmapCharacteristicSO,IDifficultyBeatmap,ColorScheme,GameplayModifiers,PlayerSpecificSettings,PracticeSettings,bool)
[CRITICAL @ 21:56:06 | UnityEngine] MenuTransitionsHelper.StartMultiplayerLevel (System.String gameMode, IPreviewBeatmapLevel previewBeatmapLevel, BeatmapDifficulty beatmapDifficulty, BeatmapCharacteristicSO beatmapCharacteristic, IDifficultyBeatmap difficultyBeatmap, ColorScheme overrideColorScheme, GameplayModifiers gameplayModifiers, PlayerSpecificSettings playerSpecificSettings, PracticeSettings practiceSettings, System.String backButtonText, System.Boolean useTestNoteCutSoundEffects, System.Action beforeSceneSwitchCallback, System.Action`1[T] afterSceneSwitchCallback, System.Action`2[T1,T2] levelFinishedCallback, System.Action`1[T] didDisconnectCallback) (at <c539348cd3264f5491de978be0c3642c>:0)
[CRITICAL @ 21:56:06 | UnityEngine] MenuTransitionsHelper.StartMultiplayerLevel (System.String gameMode, IPreviewBeatmapLevel previewBeatmapLevel, BeatmapDifficulty beatmapDifficulty, BeatmapCharacteristicSO beatmapCharacteristic, IDifficultyBeatmap difficultyBeatmap, ColorScheme overrideColorScheme, GameplayModifiers gameplayModifiers, PlayerSpecificSettings playerSpecificSettings, PracticeSettings practiceSettings, System.String backButtonText, System.Boolean useTestNoteCutSoundEffects, System.Action beforeSceneSwitchCallback, System.Action`2[T1,T2] levelFinishedCallback, System.Action`1[T] didDisconnectCallback) (at <c539348cd3264f5491de978be0c3642c>:0)
[CRITICAL @ 21:56:06 | UnityEngine] (wrapper dynamic-method) LobbyGameStateController.DMD<LobbyGameStateController::StartMultiplayerLevel>(LobbyGameStateController,ILevelGameplaySetupData,IDifficultyBeatmap,System.Action)
[CRITICAL @ 21:56:06 | UnityEngine] LobbyGameStateController.HandleMultiplayerLevelLoaderCountdownFinished (ILevelGameplaySetupData gameplaySetupData, IDifficultyBeatmap difficultyBeatmap) (at <c539348cd3264f5491de978be0c3642c>:0)
[CRITICAL @ 21:56:06 | UnityEngine] (wrapper dynamic-method) MultiplayerLevelLoader.DMD<MultiplayerLevelLoader::Tick>(MultiplayerLevelLoader)
[CRITICAL @ 21:56:06 | UnityEngine] MultiplayerCore.Objects.MpLevelLoader.Tick () (at <2af17fc095ca4d6aa38c7d9ef553c66c>:0)
[CRITICAL @ 21:56:06 | UnityEngine] Zenject.TickablesTaskUpdater.UpdateItem (Zenject.ITickable task) (at <ed5758d978ce4539b312e960e20e9230>:0)
[CRITICAL @ 21:56:06 | UnityEngine] Zenject.TaskUpdater`1[TTask].UpdateRange (System.Int32 minPriority, System.Int32 maxPriority) (at <ed5758d978ce4539b312e960e20e9230>:0)
[CRITICAL @ 21:56:06 | UnityEngine] Zenject.TaskUpdater`1[TTask].UpdateAll () (at <ed5758d978ce4539b312e960e20e9230>:0)
[CRITICAL @ 21:56:06 | UnityEngine] Zenject.TickableManager.Update () (at <ed5758d978ce4539b312e960e20e9230>:0)
[CRITICAL @ 21:56:06 | UnityEngine] Zenject.MonoKernel.Update () (at <ed5758d978ce4539b312e960e20e9230>:0)

Additional context I haven't been able to properly test this extensively with more than just a single player in the lobby. Patching out the CustomSongColorsPatch manually in dnSpy was able to resolve the issue as well.

roydejong commented 1 year ago

+1, I've seen this issue happening as well with the same set of mods.

On OST, DLC and custom songs. Effectively prevents multiplayer levels from starting altogether.

I've also tested this on a modded server, so this seems to be happening in any environment.

roydejong commented 1 year ago

Just to follow-up, found the root cause:

This is caused by SongCore changes. MultiplayerCore attempts to read a config value from SongCore that no longer exists: https://github.com/Goobwabber/MultiplayerCore/blob/74c6e95f9c088ecd6ea4c43f2c5673c50ebe7600/MultiplayerCore/Patches/CustomSongColorsPatch.cs#L13

However, I don't think this patch is needed at all in MultiplayerCore anymore. SongCore now handles custom song colors in multiplayer itself: https://github.com/Kylemc1413/SongCore/pull/48

I've verified the SongCore patch works, so I'll submit a PR for MultiplayerCore to remove it here.