Skip to content

Commit

Permalink
Bug Fixes
Browse files Browse the repository at this point in the history
Fixed BeatLeader null ref (mods that change the characteristics UI)
Fixed Song Colours being 0 alpha on first load
  • Loading branch information
ModdingPink committed Aug 8, 2023
1 parent 919c09a commit 26e9d43
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
5 changes: 4 additions & 1 deletion source/SongCore/Data/SongData.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -121,8 +122,10 @@ public class MapColor
public float r;
public float g;
public float b;
public float a;

[DefaultValue(1)]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
public float a = 1f;

public MapColor(float r, float g, float b, float a = 1f)
{
Expand Down
24 changes: 13 additions & 11 deletions source/SongCore/HarmonyPatches/CosmeticCharacteristicsPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,22 @@ internal class CosmeticCharacteristicsPatch
// public static OverrideClasses.CustomLevel previouslySelectedSong = null;
private static void Postfix(IReadOnlyList<IDifficultyBeatmapSet> difficultyBeatmapSets, BeatmapCharacteristicSO selectedBeatmapCharacteristic, ref List<BeatmapCharacteristicSO> ____beatmapCharacteristics, ref IconSegmentedControl ____segmentedControl)
{
if (!Plugin.Configuration.DisplayCustomCharacteristics)
return;
var diffBeatmapLevel = difficultyBeatmapSets.FirstOrDefault().difficultyBeatmaps.FirstOrDefault().level;
var level = diffBeatmapLevel is CustomBeatmapLevel ? diffBeatmapLevel as CustomPreviewBeatmapLevel : null;
if (!Plugin.Configuration.DisplayCustomCharacteristics) return;

if (level == null)
return;
var diffBeatmapSetsBeatmaps = difficultyBeatmapSets.FirstOrDefault().difficultyBeatmaps;
if (diffBeatmapSetsBeatmaps == null) return;
var diffBeatmapItem = diffBeatmapSetsBeatmaps.FirstOrDefault();
if (diffBeatmapItem == null) return;
var diffBeatmapLevel = diffBeatmapItem.level;

var level = diffBeatmapLevel is CustomBeatmapLevel ? diffBeatmapLevel as CustomPreviewBeatmapLevel : null;

if (level == null) return;
var songData = Collections.RetrieveExtraSongData(Hashing.GetCustomLevelHash(level));
if (songData == null)
return;
if (songData._characteristicDetails == null)
return;

if (songData == null) return;
if (songData._characteristicDetails == null) return;
if (____segmentedControl == null) return;

if (songData._characteristicDetails.Length > 0)
{
Expand Down Expand Up @@ -137,7 +139,7 @@ private static void Postfix(IReadOnlyList<IDifficultyBeatmapSet> difficultyBeatm
}

if (characteristic == selectedBeatmapCharacteristic)
{
{
cell = i;
}
i++;
Expand Down
2 changes: 1 addition & 1 deletion source/SongCore/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"gameVersion": "1.31.0",
"id": "SongCore",
"name": "SongCore",
"version": "3.11.1",
"version": "3.11.2",
"dependsOn": {
"BSIPA": "^4.3.0",
"BeatSaberMarkupLanguage": "^1.7.6",
Expand Down

0 comments on commit 26e9d43

Please sign in to comment.