-
-
Notifications
You must be signed in to change notification settings - Fork 18
The Everything Update (UI Overhaul + Bug Fixes) #30
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
base: main
Are you sure you want to change the base?
Changes from all commits
0d16bca
f59914c
b4caac8
b5c2569
fbcc9d4
7722966
1479e6b
ef71707
0805e41
9ad13ed
82bf098
2c4c5a2
9e37d6a
d53b9ae
7f41d33
c25e39c
130bc29
d92b5d2
e78761b
3a1fdf2
60c3dde
fc4d7ca
2e7f7d6
80242d5
46e6902
d8c058f
5dc64aa
90ed814
70a4d95
602d70e
a2cbeb8
4b44641
3795421
50a2374
9604a51
ee1e2db
0c15aec
5244203
4eca372
bd4806d
6149138
890479e
dddb5a3
32a94f6
1f4fedb
fdd30f9
0c6dd88
2e9a016
c988bb7
2c9a812
90b4e81
6b5dbe7
b98bc2f
367c845
cb18a0b
b0fad27
5c616cb
0ae231b
4e25796
01f5b59
0c9bfdf
14548c0
dfc0c17
16dcb3b
875fd86
cd62533
40ae61a
256182e
56968cd
8711994
3f7ab10
17bf7f4
020100a
448f951
61d0f05
15dba32
1c21390
7a69e2b
7624715
2198fa7
b17d21f
c4d28d3
5c675d6
0f2253e
c0fbc49
7f3c88f
f6315b8
b1f680c
c712618
ec6c12d
430123f
b93a63b
43b34f7
05e3311
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,12 @@ | ||
| # ScoreSaber-Plugin | ||
| Clone, and goodluck. The open source release of ScoreSaber was done hastily and quite a lot needs to be changed and plenty of "security through obscurity" practices covered by obfuscation can finally be removed, cleaning up the project. | ||
| ScoreSaber is Beat Saber's largest leaderboard system for custom songs, hosting 60 million scores across 170,000+ leaderboards, with more than 1 million users worldwide | ||
|
|
||
| Everything here is licensed under MIT and we'll be accepting contributors immediately, so if you're looking to help us out, that'd be greatly appreciated, we're going to need it. | ||
|  | ||
|
|
||
| Scores can also be viewed on [the website](https://scoresaber.com) | ||
|
|
||
| # Installation | ||
| ## Method 1 | ||
| - Install from your preferred mod manager | ||
| ## Method 2 | ||
| - Download from the [releases](https://github.com/ScoreSaber/scoresaber-plugin/releases/latest) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| using HarmonyLib; | ||
| using ScoreSaber.Core.Data.Models; | ||
| using ScoreSaber.Core.Services; | ||
| using ScoreSaber.Core.Utils; | ||
| using SiraUtil.Affinity; | ||
| using SiraUtil.Logging; | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
| using System.Text; | ||
| using System.Threading.Tasks; | ||
| using Zenject; | ||
|
|
||
| namespace ScoreSaber.Core.AffinityPatches { | ||
| public class MenuPresencePatches : IAffinity { | ||
|
|
||
| [Inject] private readonly RichPresenceService _richPresenceService = null; | ||
|
|
||
| [AffinityPatch(typeof(SinglePlayerLevelSelectionFlowCoordinator), "HandleStandardLevelDidFinish")] | ||
| [AffinityPostfix] | ||
| public void HandleStopStandardLevelPostfix() { | ||
| var jsonObject = new SceneChangeEvent() { | ||
| Timestamp = _richPresenceService.TimeRightNow, | ||
| Scene = Scene.menu | ||
| }; | ||
|
|
||
| _richPresenceService.SendUserProfileChannel("scene_change", jsonObject); | ||
| } | ||
|
|
||
| [AffinityPatch(typeof(SinglePlayerLevelSelectionFlowCoordinator), nameof(SinglePlayerLevelSelectionFlowCoordinator.StartLevel))] | ||
| [AffinityPostfix] | ||
| public void HandleStartLevelPostfix(SinglePlayerLevelSelectionFlowCoordinator __instance, Action beforeSceneSwitchCallback, bool practice) { | ||
|
|
||
| bool isPractice = practice; | ||
| GameMode gameMode = GameMode.solo; | ||
|
|
||
| if (isPractice) { | ||
| gameMode = GameMode.practice; | ||
|
|
||
| // this is to privatise the practice mode song, as it would be exposed in the rich presence, still not shown in UI though. | ||
| var songEventPrivate = new SongRichPresenceInfo(_richPresenceService.TimeRightNow, gameMode, | ||
| "PRACTICE", | ||
| string.Empty, | ||
| "PRACTICE AUTHOR", | ||
| "PRACTICE MAPPER", | ||
| "Standard", | ||
| "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE", | ||
| (int)2000000000, | ||
| 1, | ||
| 0, | ||
| 1); | ||
|
|
||
| _richPresenceService.SendUserProfileChannel("start_song", songEventPrivate); | ||
| return; | ||
| } | ||
|
|
||
| GameplayModifiers gameplayModifiers = __instance.gameplayModifiers; | ||
| int startTime = 0; | ||
| if (__instance.isInPracticeView) { | ||
| startTime = (int)__instance._practiceViewController._practiceSettings.startSongTime; | ||
| } | ||
|
|
||
| var songEvent = CreateSongStartEvent(__instance.selectedBeatmapLevel, __instance.selectedBeatmapKey, gameplayModifiers, startTime, gameMode); | ||
|
|
||
| _richPresenceService.SendUserProfileChannel("start_song", songEvent); | ||
| } | ||
|
|
||
| [AffinityPatch(typeof(MultiplayerLevelSelectionFlowCoordinator), nameof(MultiplayerLevelSelectionFlowCoordinator.HandleLobbyGameStateControllerGameStarted))] | ||
| [AffinityPostfix] | ||
| public void HandleMultiplayerGameStartPostfix(MultiplayerLevelSelectionFlowCoordinator __instance, ILevelGameplaySetupData levelGameplaySetupData) { | ||
|
Umbranoxio marked this conversation as resolved.
|
||
|
|
||
| // i dont like this, but i have to do it, just in case the users selected level doesnt match what the game started with | ||
| BeatmapLevel beatmapLevel = SongCore.Loader.GetLevelById(levelGameplaySetupData.beatmapKey.levelId); | ||
|
|
||
| GameplayModifiers gameplayModifiers = levelGameplaySetupData.gameplayModifiers; | ||
| int startTime = 0; | ||
|
|
||
| var songEvent = CreateSongStartEvent(beatmapLevel, levelGameplaySetupData.beatmapKey, gameplayModifiers, startTime, GameMode.multiplayer); | ||
|
|
||
| _richPresenceService.SendUserProfileChannel("start_song", songEvent); | ||
| } | ||
|
|
||
| private SongRichPresenceInfo CreateSongStartEvent(BeatmapLevel beatmapLevel, BeatmapKey beatmapKey, GameplayModifiers gameplayModifiers, int startTime, GameMode gameMode) { | ||
|
|
||
| string hash = BeatmapUtils.GetHashFromLevelID(beatmapLevel, out bool isOst); | ||
|
|
||
| var songEvent = new SongRichPresenceInfo(_richPresenceService.TimeRightNow, gameMode, | ||
| beatmapLevel.songName, | ||
| beatmapLevel.songSubName, | ||
| BeatmapUtils.FriendlyLevelAuthorName(beatmapLevel.allMappers, beatmapLevel.allLighters), | ||
| beatmapLevel.songAuthorName, | ||
| beatmapKey.beatmapCharacteristic.SerializedName(), | ||
| hash, | ||
| (int)beatmapLevel.songDuration, | ||
| ((int)beatmapKey.difficulty * 2) + 1, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we still going with the (by the game long removed) numeric difficulty instead of string difficulty? (Sorry if this was already sufficiently resolved, but this big review is starting to get a bit out of hand and confusing.)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Numeric would be easier overall, but im fine with changing it if the backend changes it.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In what sense would numeric be easier? Don't you have to keep converting it everywhere? |
||
| startTime, | ||
| gameplayModifiers.songSpeedMul); | ||
|
|
||
| return songEvent; | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| using Newtonsoft.Json; | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
| using System.Text; | ||
| using System.Threading.Tasks; | ||
|
|
||
| namespace ScoreSaber.Core.Data.Models { | ||
| public enum GameMode { | ||
| [JsonProperty("solo")] | ||
| solo, | ||
| [JsonProperty("multi")] | ||
| multiplayer, | ||
| [JsonProperty("practice")] | ||
| practice | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.