Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for Beat Saber 1.37.0 #50

Merged
merged 76 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
14a499c
wip(1.35): initial refactor and cleanup
roydejong Mar 26, 2024
e4a37fc
feat: "required" flag for RequiredMod check
roydejong Apr 4, 2024
3a7e582
wip(1.35): new extended status fields
roydejong Apr 4, 2024
fcc35db
wip(1.35): updated / consistent custom MUR error messages
roydejong Apr 5, 2024
6d35862
wip(1.35): mark statusUrl as nullable in NetworkConfigPatcher
roydejong Apr 5, 2024
2fe2d61
wip(1.35): level loader - don't wait for non-players, quest consistency
roydejong Apr 6, 2024
0982fe6
wip(1.35): level loader - fix flipped countdown time logic
roydejong Apr 6, 2024
52a0417
Setup code to make the requirement UI work again with non-downloaded …
RedBrumbler Apr 12, 2024
cbf92ef
Fix null list
RedBrumbler Apr 15, 2024
7a44bb9
More fixes and workarounds for problems with song lists
RedBrumbler Apr 29, 2024
43b0364
Add additional logging to entitlement check
michael-r-elp May 1, 2024
7352410
Fix level load
michael-r-elp May 1, 2024
d816220
Fix entitlement not sent
michael-r-elp May 1, 2024
a86f495
Fix logging transpiler
michael-r-elp May 1, 2024
bc2fb13
Temp fix exception when selecting other players suggestion
michael-r-elp May 1, 2024
09ac950
Fix patch not working properly
michael-r-elp May 6, 2024
978eb7f
Fix entitlement spam during level load
michael-r-elp May 9, 2024
c5f50bb
Fix node pose sync state and added score sync controls
cubicgraphics May 14, 2024
134768e
Fix sync state values being multiplied
cubicgraphics May 14, 2024
ae29445
Change from Setup to SetupData on LevelBar, BS 1.37
michael-r-elp Jun 16, 2024
46e129a
Merge pull request #1 from cubicgraphics/dev-1.35.0
michael-r-elp Jun 16, 2024
c1671a0
Change check for requirements in packet
michael-r-elp Jun 16, 2024
0e299f3
Disable score validation when BeatmapBasicData notesCount is 0
michael-r-elp Jun 24, 2024
071eac3
Cleanup code
michael-r-elp Jun 24, 2024
84799b1
Fix MpBeatmapPacket ordering (#51)
rcelyte Jun 26, 2024
c5146a6
Add compat for 1.35, code cleanup
michael-r-elp Jun 26, 2024
7c4de89
Fix MpNodePoseSyncStatePacket should use VarLong
michael-r-elp Jul 12, 2024
9b34e3f
Code cleanup/optimization
michael-r-elp Jul 12, 2024
9ac17c5
No score validation for custom levels
michael-r-elp Jul 12, 2024
3c4ef81
Add POC UI for per player difficulty and placeholder VCs
michael-r-elp Jul 12, 2024
8bedef8
Adjust UI, move start/unready button down
michael-r-elp Jul 12, 2024
fe322aa
Rename packets
michael-r-elp Jul 13, 2024
a2a29c6
Add a RegisterType function to register a type without callback, most…
michael-r-elp Jul 14, 2024
66f8b4e
Working POC UI for ppd/ppm
michael-r-elp Jul 14, 2024
acf38ef
Add support for 1.37.1 with backwards compat
michael-r-elp Jul 14, 2024
1e6cde3
Fix potential null dereference
michael-r-elp Jul 14, 2024
e5224b2
Update difficulty selection when selecting suggestion, set alpha on d…
michael-r-elp Jul 16, 2024
9c3e55c
Debug logging attempt getting id of failed packet
michael-r-elp Jul 17, 2024
26b2f28
Allow changing difficulty during normal countdown
michael-r-elp Jul 17, 2024
c9be9bd
Fix send MpBeatmapPacket logic for non-local levels
michael-r-elp Jul 17, 2024
4d9d1e3
Add Temporay patch for compatiblity between 1.37.1 and 1.37.0
michael-r-elp Jul 27, 2024
f54c811
ForwardCompat use simpler method to patch
michael-r-elp Jul 27, 2024
08788f8
Move PerPlayerUI into new class MpPerPlayerUI
michael-r-elp Jul 27, 2024
fb10d8c
Align code and UI xml to better match the Quest port
michael-r-elp Aug 3, 2024
97a4719
Tweak show toggles disabled, when not party owner, fix toggles dissap…
michael-r-elp Aug 8, 2024
030ae5f
Ensure newly joined players receive map selection
michael-r-elp Aug 14, 2024
f55582b
Fix missing used function in MpPerPlayerUI
michael-r-elp Aug 14, 2024
764c7a5
Fix toggles not enabling when becoming lobby host
michael-r-elp Aug 14, 2024
503c108
Fix ScoreSyncState Packet
michael-r-elp Aug 14, 2024
c42ef3c
Don't reference types not available in older game versions
michael-r-elp Aug 14, 2024
4dcccad
Fallback to beatsaver data when MpBeatmapPacket is missing
michael-r-elp Aug 15, 2024
1ff6c84
Comment unused code, attempt move toggles when partyhost changes (not…
michael-r-elp Aug 15, 2024
246dd19
Use IPA WaitForTask instead of a WaitUntil, remove unused using state…
michael-r-elp Aug 16, 2024
547f49f
Cleanup and improve code
michael-r-elp Aug 16, 2024
e40b45d
Fix blackscreen when map can't be downloaded / download fails
michael-r-elp Aug 17, 2024
0e25cd2
Update NodePoseSTM to use long and avoid unnecessary type casts
michael-r-elp Aug 17, 2024
5091e48
Remove todo comment
michael-r-elp Aug 17, 2024
368cdab
Make entitlement checker public
michael-r-elp Aug 17, 2024
cd13e5e
Make LevelBar patch version dependand
michael-r-elp Aug 18, 2024
e7efbe3
Use Newtonsoft deserializer
michael-r-elp Aug 20, 2024
37df6c4
Check status and override before enablind toggles
michael-r-elp Aug 20, 2024
583a52a
LevelDownloader install to custom folder when version 1.37.3+
michael-r-elp Aug 24, 2024
5c7fc8d
Use Setup instead of SetupData
michael-r-elp Aug 24, 2024
a92270e
Bump up game version
michael-r-elp Aug 24, 2024
264f6d6
Per player modifiers, disable song speed modifiers
michael-r-elp Aug 24, 2024
ef81ba5
NoLevelSpectator, patch ResultView instead of LevelBar
michael-r-elp Aug 24, 2024
6a908ec
BeatSaver bm ignore Chroma, MpPerPlayerUI unregister status callback …
michael-r-elp Aug 25, 2024
a11f840
MpPlayerData default initialize GameVersion with current gameversion,…
michael-r-elp Aug 25, 2024
8739fec
Removed unused UI classes
michael-r-elp Aug 25, 2024
2a87538
add separate folder for mp songs (#39)
ehlor Aug 25, 2024
572c17b
Fix typo
michael-r-elp Aug 25, 2024
00ea0c0
Remove deleted reference
michael-r-elp Aug 25, 2024
e2905e5
Re-fix ordering from #51
michael-r-elp Aug 26, 2024
f4d8ce6
On player connected, check if selected map is valid
michael-r-elp Aug 26, 2024
082e08f
Fixes to map selection
michael-r-elp Aug 26, 2024
5cc7695
Disable sending MpPlayerData again, I forgot that it's sent from the …
michael-r-elp Aug 28, 2024
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
3 changes: 3 additions & 0 deletions MultiplayerCore.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=beatmap/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Beatmaps/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
112 changes: 0 additions & 112 deletions MultiplayerCore/Beatmaps/Abstractions/DifficultyColors.cs

This file was deleted.

36 changes: 36 additions & 0 deletions MultiplayerCore/Beatmaps/Abstractions/MpBeatmap.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MultiplayerCore.Beatmaps.Serializable;
using UnityEngine;
using static SongCore.Data.ExtraSongData;

namespace MultiplayerCore.Beatmaps.Abstractions
{
/// <summary>
/// Base class for Beatmap data that can be used in multiplayer.
/// </summary>
public abstract class MpBeatmap
{
/// <summary>
/// The hash of the level. Should be the same on all clients.
/// </summary>
public abstract string LevelHash { get; protected set; }
/// <summary>
/// The local ID of the level. Can vary between clients.
/// </summary>
public string LevelID => $"custom_level_{LevelHash}";
public abstract string SongName { get; }
public abstract string SongSubName { get; }
public abstract string SongAuthorName { get; }
public abstract string LevelAuthorName { get; }
public virtual float BeatsPerMinute { get; protected set; }
public virtual float SongDuration { get; protected set; }
public virtual Dictionary<string, Dictionary<BeatmapDifficulty, string[]>> Requirements { get; protected set; } = new();
public virtual Dictionary<string, Dictionary<BeatmapDifficulty, DifficultyColors>> DifficultyColors { get; protected set; } = new();
public virtual Contributor[]? Contributors { get; protected set; } = null!;

public virtual Task<Sprite> TryGetCoverSpriteAsync(CancellationToken cancellationToken)
=> Task.FromResult<Sprite>(null!);
}
}
49 changes: 0 additions & 49 deletions MultiplayerCore/Beatmaps/Abstractions/MpBeatmapLevel.cs

This file was deleted.

36 changes: 18 additions & 18 deletions MultiplayerCore/Beatmaps/BeatSaverBeatmapLevel.cs
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
using BeatSaverSharp.Models;
using MultiplayerCore.Beatmaps.Abstractions;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using BeatSaverSharp.Models;
using MultiplayerCore.Beatmaps.Abstractions;
using UnityEngine;
using static BeatSaverSharp.Models.BeatmapDifficulty;
using static SongCore.Data.ExtraSongData;

namespace MultiplayerCore.Beatmaps
{
/// <summary>
/// An <see cref="IPreviewBeatmapLevel"/> created from data from BeatSaver.
/// Beatmap level data that was loaded remotely from the BeatSaver API.
/// </summary>
public class BeatSaverBeatmapLevel : MpBeatmapLevel
public class BeatSaverBeatmapLevel : MpBeatmap
{
public override string levelHash { get; protected set; }
public override string LevelHash { get; protected set; }

public override string songName => _beatmap.Metadata.SongName;
public override string songSubName => _beatmap.Metadata.SongSubName;
public override string songAuthorName => _beatmap.Metadata.SongAuthorName;
public override string levelAuthorName => _beatmap.Metadata.LevelAuthorName;
public override float beatsPerMinute => _beatmap.Metadata.BPM;
public override float songDuration => _beatmap.Metadata.Duration;
public override string SongName => _beatmap.Metadata.SongName;
public override string SongSubName => _beatmap.Metadata.SongSubName;
public override string SongAuthorName => _beatmap.Metadata.SongAuthorName;
public override string LevelAuthorName => _beatmap.Metadata.LevelAuthorName;
public override float BeatsPerMinute => _beatmap.Metadata.BPM;
public override float SongDuration => _beatmap.Metadata.Duration;

public override Dictionary<string, Dictionary<BeatmapDifficulty, string[]>> requirements
public override Dictionary<string, Dictionary<BeatmapDifficulty, string[]>> Requirements
{
get
{
Expand All @@ -46,8 +46,8 @@ public override Dictionary<string, Dictionary<BeatmapDifficulty, string[]>> requ
if (!reqs.ContainsKey(characteristic))
reqs.Add(characteristic, new());
string[] diffReqs = new string[0];
if (difficulty.Chroma)
diffReqs.Append("Chroma");
//if (difficulty.Chroma)
// diffReqs.Append("Chroma");
if (difficulty.NoodleExtensions)
diffReqs.Append("Noodle Extensions");
if (difficulty.MappingExtensions)
Expand All @@ -58,7 +58,7 @@ public override Dictionary<string, Dictionary<BeatmapDifficulty, string[]>> requ
}
}

public override Contributor[] contributors => new Contributor[] { new Contributor
public override Contributor[] Contributors => new Contributor[] { new Contributor
{
_role = "Uploader",
_name = _beatmap.Uploader.Name,
Expand All @@ -69,11 +69,11 @@ public override Dictionary<string, Dictionary<BeatmapDifficulty, string[]>> requ

public BeatSaverBeatmapLevel(string hash, Beatmap beatmap)
{
levelHash = hash;
LevelHash = hash;
_beatmap = beatmap;
}

public override async Task<Sprite> GetCoverImageAsync(CancellationToken cancellationToken)
public override async Task<Sprite> TryGetCoverSpriteAsync(CancellationToken cancellationToken)
{
byte[]? coverBytes = await _beatmap.LatestVersion.DownloadCoverImage(cancellationToken);
if (coverBytes == null || coverBytes.Length == 0)
Expand Down
62 changes: 62 additions & 0 deletions MultiplayerCore/Beatmaps/BeatSaverPreviewMediaData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using System.Threading;
using System.Threading.Tasks;
using UnityEngine;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BeatSaverSharp;
using BeatSaverSharp.Models;

namespace MultiplayerCore.Beatmaps
{
public class BeatSaverPreviewMediaData : IPreviewMediaData
{

public string LevelHash { get; private set; }
public BeatSaver BeatSaverClient { get; private set; }
public Sprite? CoverImagesprite { get; private set; }

public BeatSaverPreviewMediaData(string levelHash) : this(Plugin._beatsaver, levelHash) {}

public BeatSaverPreviewMediaData(BeatSaver beatsaver, string levelHash)
{
BeatSaverClient = beatsaver;
LevelHash = levelHash;
}

private Beatmap? _beatmap = null;
private async Task<Beatmap> GetBeatsaverBeatmap()
{
if (_beatmap != null) return _beatmap;
_beatmap = await BeatSaverClient.BeatmapByHash(LevelHash);
return _beatmap;
}

public async Task<Sprite> GetCoverSpriteAsync(CancellationToken cancellationToken)
{
if (CoverImagesprite != null) return CoverImagesprite;

var bm = await GetBeatsaverBeatmap();
if (bm == null) return null!;

byte[]? coverBytes = await bm.LatestVersion.DownloadCoverImage(cancellationToken);
if (coverBytes == null || coverBytes.Length == 0) return null!;

Texture2D texture = new Texture2D(2, 2);
texture.LoadImage(coverBytes);
CoverImagesprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0, 0), 100.0f);
return CoverImagesprite;
}

public async Task<AudioClip> GetPreviewAudioClip(CancellationToken cancellationToken)
{
// TODO: something with preview url
// var bm = await GetBeatsaverBeatmap();
// bm.LatestVersion.PreviewURL
return null;
}

public void UnloadPreviewAudioClip() {}
}
}
Loading