Skip to content

Commit

Permalink
1.37.1 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rcelyte committed Jul 12, 2024
1 parent 2386009 commit aee288b
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 33 deletions.
2 changes: 1 addition & 1 deletion BeatUpClient/BeatUpClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<LocalRefsDir Condition="Exists('..\Refs')">..\Refs</LocalRefsDir>
<BeatSaberDir>$(LocalRefsDir)</BeatSaberDir>
<DebugType>full</DebugType>
<ModVersion>0.11.0</ModVersion>
<ModVersion>0.12.0</ModVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="Mono.Cecil">
Expand Down
2 changes: 2 additions & 0 deletions BeatUpClient/MakeThingsPublic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
("Libs", "Newtonsoft.Json.dll", null),
("Libs", "System.IO.Compression.dll", null),
("Plugins", "SongCore.dll", null),
(managed, "AdditionalContentModel.Interfaces.dll", null),
(managed, "BeatmapCore.dll", null),
(managed, "BeatSaber.GameSettings.dll", null),
(managed, "BeatSaber.Init.dll", null),
Expand Down Expand Up @@ -220,6 +221,7 @@
(managed, "DataModels.dll", new[] {
"BeatmapKey::beatmapCharacteristic",
"BeatmapLevelsModel::_allLoadedBeatmapLevelsRepository",
"BeatmapLevelsModel::_entitlements",
"BeatmapLevelsRepository::_idToBeatmapLevel",
"FileDifficultyBeatmap::_beatmapPath",
"FileDifficultyBeatmap::_lightshowPath",
Expand Down
3 changes: 2 additions & 1 deletion BeatUpClient/cs/Patches/7_Entitlement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ static partial class BeatUpClient {
Log.Debug($"AnnounceWrapper(task.Result={status})");
ShareInfo info = new ShareInfo(0, new ShareMeta(0), new ShareId {usage = ShareableType.BeatmapSet, mimeType = "application/json", name = levelId});
if(status == EntitlementsStatus.Ok) {
IBeatmapLevelData? beatmapLevelData = (await Resolve<BeatmapLevelsModel>()!.LoadBeatmapLevelDataAsync(levelId, System.Threading.CancellationToken.None)).beatmapLevelData;
BeatmapLevelDataVersion version = await Resolve<BeatmapLevelsModel>()!._entitlements.GetLevelDataVersionAsync(levelId, System.Threading.CancellationToken.None);
IBeatmapLevelData? beatmapLevelData = (await Resolve<BeatmapLevelsModel>()!.LoadBeatmapLevelDataAsync(levelId, version, System.Threading.CancellationToken.None)).beatmapLevelData;
if(beatmapLevelData == null) {
Log.Debug(" Announce: failed to load beatmap");
status = EntitlementsStatus.NotOwned;
Expand Down
4 changes: 2 additions & 2 deletions BeatUpClient/cs/Patches/8_Load.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ enum MultiplayerBeatmapLoaderState {
}

[Detour(typeof(BeatmapLevelLoader), nameof(BeatmapLevelLoader.LoadBeatmapLevelDataAsync))]
static System.Threading.Tasks.Task<LoadBeatmapLevelDataResult> BeatmapLevelLoader_LoadBeatmapLevelDataAsync(BeatmapLevelLoader self, BeatmapLevel beatmapLevel, System.Threading.CancellationToken cancellationToken) {
static System.Threading.Tasks.Task<LoadBeatmapLevelDataResult> BeatmapLevelLoader_LoadBeatmapLevelDataAsync(BeatmapLevelLoader self, BeatmapLevel beatmapLevel, BeatmapLevelDataVersion beatmapLevelDataVersion, System.Threading.CancellationToken cancellationToken) {
ShareTracker.DownloadPreview? preview = beatmapLevel as ShareTracker.DownloadPreview;
if(preview == null)
return (System.Threading.Tasks.Task<LoadBeatmapLevelDataResult>)Base(self, beatmapLevel, cancellationToken);
return (System.Threading.Tasks.Task<LoadBeatmapLevelDataResult>)Base(self, beatmapLevel, beatmapLevelDataVersion, cancellationToken);
System.Threading.CancellationTokenSource? loaderCTS = Resolve<MultiplayerLevelLoader>()?._getBeatmapCancellationTokenSource;
if(loaderCTS == null || cancellationToken != loaderCTS.Token)
return System.Threading.Tasks.Task.FromResult(LoadBeatmapLevelDataResult.Error);
Expand Down
6 changes: 3 additions & 3 deletions BeatUpClient/makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/make
VERSION := 0.11.0
VERSION := 0.12.0

.SILENT:

Expand Down Expand Up @@ -91,7 +91,7 @@ BeatUpClient.dll: $(CSFILES) .obj/MakeThingsPublic.exe thirdparty/ILRepack.exe t
\"\$$schema\": \"https://raw.githubusercontent.com/bsmg/BSIPA-MetadataFileSchema/master/Schema.json\",\n\
\"author\": \"rcelyte\",\n\
\"description\": \"Tweaks and enhancements for enabling modded multiplayer\",\n\
\"gameVersion\": \"1.37.0_9031708052\",\n\
\"gameVersion\": \"1.37.1_9767668645\",\n\
\"dependsOn\": {\"BSIPA\": \"^4.3.0\"},\n\
\"conflictsWith\": {\"BeatTogether\": \"*\"},\n\
\"loadBefore\": [\"MultiplayerCore\"],\n\
Expand All @@ -101,7 +101,7 @@ BeatUpClient.dll: $(CSFILES) .obj/MakeThingsPublic.exe thirdparty/ILRepack.exe t
\"links\": {\"project-source\": \"https://github.com/rcelyte/BeatUpRcelyte/BeatUpClient\"}\n\
}" > .obj/manifest.json
MONO_PATH=$(BSINSTALL)/Libs mono .obj/MakeThingsPublic.exe $(BSINSTALL)
csc -nologo -t:library -nostdlib -o+ -debug- -nullable+ -unsafe+ -w:4 -warnaserror+ -langversion:9 $(CSFILES) \
csc -nologo -t:library -nostdlib -o+ -debug- -nullable+ -unsafe+ -w:4 -nowarn:CS1702 -warnaserror+ -langversion:9 $(CSFILES) \
-res:.obj/manifest.json,.manifest.json -res:assets/cover.png,BeatUpClient.cover -res:assets/create.png,BeatUpClient.create -out:.obj/$@ \
`find .obj/Refs/ -name "*.dll" | sed -e 's/^/-r:/'`
mono thirdparty/ILRepack.exe /lib:.obj/Refs/Libs /lib:.obj/Refs/Managed /lib:.obj/Refs/Plugins /out:$@ .obj/$@ thirdparty/System.IO.Compression.dll
Expand Down
2 changes: 1 addition & 1 deletion BeatUpClient/qpm.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"info": {
"name": "BeatUpClient",
"id": "BeatUpClient",
"version": "0.11.0",
"version": "0.12.0",
"url": null,
"additionalData": {}
},
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
============
*"beat saber gettin violent these days" -some Discord user*

A lightweight server to enable modded multiplayer in Beat Saber 1.19.0 and newer (Cross-version lobbies supported for 1.20.0<->1.31.1 or 1.32.0<->1.37.0).
A lightweight server to enable modded multiplayer in Beat Saber 1.19.0 and newer (Cross-version lobbies supported for 1.20.0<->1.31.1 or 1.32.0<->1.37.1).

Ways to Join
------------
Expand Down
1 change: 1 addition & 0 deletions common/packets.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ u8 GameVersion
1_36_1
1_36_2
1_37_0
1_37_1
n PacketContext
u8 netVersion
u8 protocolVersion
Expand Down
6 changes: 6 additions & 0 deletions src/packets.gen.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,9 @@ static void _pkt_LevelCompletionResults_read(struct LevelCompletionResults *rest
_pkt_f32_read(&data->averageTimeDeviation, pkt, end, ctx);
}
_pkt_f32_read(&data->endSongTime, pkt, end, ctx);
if(ctx.gameVersion >= GameVersion_1_37_1) {
_pkt_b_read(&data->invalidated, pkt, end, ctx);
}
}
static void _pkt_LevelCompletionResults_write(const struct LevelCompletionResults *restrict data, uint8_t **pkt, const uint8_t *end, struct PacketContext ctx) {
_pkt_GameplayModifiers_write(&data->gameplayModifiers, pkt, end, ctx);
Expand Down Expand Up @@ -1207,6 +1210,9 @@ static void _pkt_LevelCompletionResults_write(const struct LevelCompletionResult
_pkt_f32_write(&data->averageTimeDeviation, pkt, end, ctx);
}
_pkt_f32_write(&data->endSongTime, pkt, end, ctx);
if(ctx.gameVersion >= GameVersion_1_37_1) {
_pkt_b_write(&data->invalidated, pkt, end, ctx);
}
}
static void _pkt_MultiplayerLevelCompletionResults_read(struct MultiplayerLevelCompletionResults *restrict data, const uint8_t **pkt, const uint8_t *end, struct PacketContext ctx) {
if(ctx.protocolVersion < 7) {
Expand Down
3 changes: 3 additions & 0 deletions src/packets.gen.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ enum {
GameVersion_1_36_1,
GameVersion_1_36_2,
GameVersion_1_37_0,
GameVersion_1_37_1,
};
[[maybe_unused]] static const char *_reflect_GameVersion(GameVersion value) {
switch(value) {
Expand Down Expand Up @@ -75,6 +76,7 @@ enum {
case GameVersion_1_36_1: return "1_36_1";
case GameVersion_1_36_2: return "1_36_2";
case GameVersion_1_37_0: return "1_37_0";
case GameVersion_1_37_1: return "1_37_1";
default: return "???";
}
}
Expand Down Expand Up @@ -1674,6 +1676,7 @@ struct LevelCompletionResults {
float maxTimeDeviation;
float averageTimeDeviation;
float endSongTime;
bool invalidated;
};
struct MultiplayerLevelCompletionResults {
MultiplayerLevelEndState levelEndState;
Expand Down
46 changes: 24 additions & 22 deletions src/packets.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ n BeatmapLevelSelectionMask
GameplayModifierMask modifiers
SongPackMask songPacks
n UTimestamp
if(ctx.protocolVersion < 9)
if($protocolVersion < 9)
f32 legacy
if(ctx.protocolVersion >= 9)
if($protocolVersion >= 9)
vu64 value
n STimestamp
if(ctx.protocolVersion < 9)
if($protocolVersion < 9)
f32 legacy
if(ctx.protocolVersion >= 9)
if($protocolVersion >= 9)
vi64 value
n RemoteProcedureCall
UTimestamp syncTime
Expand Down Expand Up @@ -389,7 +389,7 @@ n NoteCutInfoNetSerializable
Vector3Serializable notePosition
Vector3Serializable noteScale
QuaternionSerializable noteRotation
if(ctx.protocolVersion >= 8)
if($protocolVersion >= 8)
GameplayType gameplayType
ColorType colorType
NoteLineLayer lineLayer
Expand Down Expand Up @@ -465,7 +465,7 @@ n LevelCompletionResults
f32 rightSaberMovementDistance
f32 leftHandMovementDistance
f32 rightHandMovementDistance
if(ctx.protocolVersion < 8)
if($protocolVersion < 8)
f32 songDuration
LevelEndStateType levelEndStateType
LevelEndAction levelEndAction
Expand All @@ -475,32 +475,34 @@ n LevelCompletionResults
vi32 missedCount
vi32 notGoodCount
vi32 okCount
if(ctx.protocolVersion < 8)
if($protocolVersion < 8)
vi32 averageCutScore
vi32 maxCutScore
if(ctx.protocolVersion >= 8)
if($protocolVersion >= 8)
vi32 totalCutScore
vi32 goodCutsCountForNotesWithFullScoreScoringType
i32 averageCenterDistanceCutScoreForNotesWithFullScoreScoringType
i32 averageCutScoreForNotesWithFullScoreScoringType
if(ctx.protocolVersion < 8)
if($protocolVersion < 8)
f32 averageCutDistanceRawScore
vi32 maxCombo
if(ctx.protocolVersion < 8)
if($protocolVersion < 8)
f32 minDirDeviation
f32 maxDirDeviation
f32 averageDirDeviation
f32 minTimeDeviation
f32 maxTimeDeviation
f32 averageTimeDeviation
f32 endSongTime
if($gameVersion >= GameVersion_1_37_1)
b invalidated
n MultiplayerLevelCompletionResults
if(ctx.protocolVersion < 7)
if($protocolVersion < 7)
MultiplayerLevelEndState levelEndState
if(ctx.protocolVersion >= 7)
if($protocolVersion >= 7)
MultiplayerPlayerLevelEndState playerLevelEndState
MultiplayerPlayerLevelEndReason playerLevelEndReason
if((ctx.protocolVersion < 7 && .levelEndState < MultiplayerLevelEndState_GivenUp) || (ctx.protocolVersion >= 7 && .playerLevelEndState != MultiplayerPlayerLevelEndState_NotStarted))
if(($protocolVersion < 7 && .levelEndState < MultiplayerLevelEndState_GivenUp) || ($protocolVersion >= 7 && .playerLevelEndState != MultiplayerPlayerLevelEndState_NotStarted))
LevelCompletionResults levelCompletionResults
n LevelFinished
RemoteProcedureCall base
Expand Down Expand Up @@ -535,7 +537,7 @@ n NoteSpawnInfoNetSerializable
vi32 lineIndex
NoteLineLayer noteLineLayer
NoteLineLayer beforeJumpNoteLineLayer
if(ctx.protocolVersion >= 8)
if($protocolVersion >= 8)
GameplayType gameplayType
ScoringType scoringType
ColorType colorType
Expand All @@ -552,7 +554,7 @@ n NoteSpawnInfoNetSerializable
f32 jumpDuration
f32 rotation
f32 cutDirectionAngleOffset
if(ctx.protocolVersion >= 8)
if($protocolVersion >= 8)
f32 cutSfxVolumeMultiplier
n NoteSpawned
RemoteProcedureCall base
Expand All @@ -567,13 +569,13 @@ vi32 ObstacleType
n ObstacleSpawnInfoNetSerializable
f32 time
vi32 lineIndex
if(ctx.protocolVersion >= 8)
if($protocolVersion >= 8)
NoteLineLayer lineLayer
if(ctx.protocolVersion < 8)
if($protocolVersion < 8)
ObstacleType obstacleType
f32 duration
vi32 width
if(ctx.protocolVersion >= 8)
if($protocolVersion >= 8)
vi32 height
Vector3Serializable moveStartPos
Vector3Serializable moveEndPos
Expand Down Expand Up @@ -833,9 +835,9 @@ n OpaqueAvatarData
u16 length
u8 data[4096, .length]
n MultiplayerAvatarsData
if(ctx.protocolVersion < 9)
if($protocolVersion < 9)
LegacyAvatarData legacy
if(ctx.protocolVersion >= 9)
if($protocolVersion >= 9)
i32 count
OpaqueAvatarData avatars[6, .count]
BitMask128 supportedTypes
Expand Down Expand Up @@ -904,12 +906,12 @@ d RoutingHeader
u8 remoteConnectionId
u8 connectionId:7
b encrypted:1
if(ctx.protocolVersion >= 9)
if($protocolVersion >= 9)
u8 packetOptions
r BTRoutingHeader
u8 remoteConnectionId
u8 connectionId
if(ctx.protocolVersion >= 9)
if($protocolVersion >= 9)
u8 packetOptions
n BaseMasterServerReliableRequest
u32 requestId
Expand Down
5 changes: 3 additions & 2 deletions src/status/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ static void status_web_index(struct HttpContext *const http) {
[6] = "1.19.0",
[7] = "1.19.1",
[8] = "1.20.0 ⬌ 1.31.1",
[9] = "1.32.0 ⬌ 1.37.0",
[9] = "1.32.0 ⬌ 1.37.1",
};
char cover[(sizeof(entry.levelCover.data) * 4 + 3) / 3 + 53] = "\0style=background-image:url(data:image/jpeg;base64,";
if(entry.levelCover.length > 4 && memcmp(entry.levelCover.data, (const uint8_t[4]){0xff,0xd8,0xff,0xe0}, 4) == 0) {
Expand Down Expand Up @@ -229,7 +229,7 @@ static void status_status(struct HttpContext *http, bool isGame) {
char msg[65536], *msg_end = msg;
PUT("%s%s%s%u%c", "{"
"\"minimum_app_version\":\"1.19.0", isGame ? "b2147483647" : STATUS_APPVER_POSTFIX, "\","
"\"maximumAppVersion\":\"1.37.0_🅱️\","
"\"maximumAppVersion\":\"1.37.1_🅱️\","
"\"status\":", TEST_maintenanceStartTime != 0, ',');
if(TEST_maintenanceStartTime) {
PUT("%s%"PRIu64"%s%"PRIu64"%s%"PRIu64"%s%s%s",
Expand Down Expand Up @@ -322,6 +322,7 @@ static void status_graph(struct HttpContext *http, struct HttpRequest req, struc
case '36.1': connectInfo.gameVersion = GameVersion_1_36_1; break;
case '36.2': connectInfo.gameVersion = GameVersion_1_36_2; break;
case '37.0': connectInfo.gameVersion = GameVersion_1_37_0; break;
case '37.1': connectInfo.gameVersion = GameVersion_1_37_1; break;
default: {
connectInfo.gameVersion = GameVersion_Unknown;
uprintf("Unexpected game version: %.*s\n", version.length, version.data);
Expand Down

0 comments on commit aee288b

Please sign in to comment.