diff --git a/Eval/Eval.csproj b/Eval/Eval.csproj index 1a84685..3be7384 100644 --- a/Eval/Eval.csproj +++ b/Eval/Eval.csproj @@ -10,7 +10,7 @@ Properties Eval Eval - v4.7.2 + v4.8 512 true portable @@ -20,6 +20,7 @@ prompt 4 + false @@ -57,6 +58,11 @@ False False + + $(BeatSaberDir)\Plugins\CustomJSONData.dll + False + False + $(BeatSaberDir)\Plugins\InfiniteBeatSaber.dll False diff --git a/InfiniteBeatSaber/BeatmapRemixer.cs b/InfiniteBeatSaber/BeatmapRemixer.cs index 88d6c42..61ac0ad 100644 --- a/InfiniteBeatSaber/BeatmapRemixer.cs +++ b/InfiniteBeatSaber/BeatmapRemixer.cs @@ -1,4 +1,7 @@ -using System; +using CustomJSONData.CustomBeatmap; +using InfiniteBeatSaber.Extensions; +using IPA.Utilities; +using System; using System.Collections.Generic; using System.Linq; using System.Reflection; @@ -18,6 +21,7 @@ public BeatmapRemixer(IReadonlyBeatmapData beatmap, BeatmapData remixedBeatmap) (_sortedBeatmapDataItems, _sortedObstacleDataItems) = FilterAndSortBeatmapDataItems(beatmap.allBeatmapDataItems); _remixedBeatmap = remixedBeatmap; + AddCustomJSONDataProcessors(_remixedBeatmap); AddBeatmapDataItemsInOrder(_remixedBeatmap, MapPrologue(_sortedBeatmapDataItems)); } @@ -31,6 +35,35 @@ public void AddRemix(Remix remix) } } + // Adds data processors for the `BeatmapDataItems` provided by CustomJSONData (https://github.com/Aeroluna/CustomJSONData). + // + // Without these, methods like `BeatmapData.AddBeatmapObjectDataInOrder` throw an exception when you attempt to add one of + // CustomJSONData's `BeatmapDataItems` (e.g. `CustomBPMChangeBeatmapEventData`). This is because Beat Saber only installs + // data processors for the `BeatmapDataItems` that it provides. + // + // Because each CustomJSONData `BeatmapDataItem` is a subclass of one provided by Beat Saber that just extends it to implement + // `ICustomData`, it seems sensible for each CustomJSONData `BeatmapDataItem` to reuse the relevant Beat Saber data processor + // (e.g. `CustomBPMChangeBeatmapEventData` reuses the data processor of `BPMChangeBeatmapEventData`). + // + // For the list of data processors that Beat Saber installs, see the initialization of + // `BeatmapDataSortedListForTypeAndIds._sortedListsDataProcessors`. + private static void AddCustomJSONDataProcessors(BeatmapData beatmapData) + { + var beatmapDataItemsPerTypeAndId = beatmapData.GetField, BeatmapData>("_beatmapDataItemsPerTypeAndId"); + var dataProcessors = beatmapDataItemsPerTypeAndId.GetField>, BeatmapDataSortedListForTypeAndIds>("_sortedListsDataProcessors"); + + dataProcessors.AddIfMissing(typeof(CustomBasicBeatmapEventData), dataProcessors[typeof(BasicBeatmapEventData)]); + dataProcessors.AddIfMissing(typeof(CustomBPMChangeBeatmapEventData), dataProcessors[typeof(BPMChangeBeatmapEventData)]); + dataProcessors.AddIfMissing(typeof(CustomColorBoostBeatmapEventData), dataProcessors[typeof(ColorBoostBeatmapEventData)]); + dataProcessors.AddIfMissing(typeof(CustomLightColorBeatmapEventData), dataProcessors[typeof(LightColorBeatmapEventData)]); + dataProcessors.AddIfMissing(typeof(CustomLightRotationBeatmapEventData), dataProcessors[typeof(LightRotationBeatmapEventData)]); + dataProcessors.AddIfMissing(typeof(CustomNoteData), dataProcessors[typeof(NoteData)]); + dataProcessors.AddIfMissing(typeof(CustomObstacleData), dataProcessors[typeof(ObstacleData)]); + dataProcessors.AddIfMissing(typeof(CustomSliderData), dataProcessors[typeof(SliderData)]); + dataProcessors.AddIfMissing(typeof(CustomSpawnRotationBeatmapEventdata), dataProcessors[typeof(SpawnRotationBeatmapEventData)]); + dataProcessors.AddIfMissing(typeof(CustomWaypointData), dataProcessors[typeof(WaypointData)]); + } + private static (IEnumerable, IEnumerable) FilterAndSortBeatmapDataItems(IEnumerable beatmapDataItems) { var omittedItemTypes = new SortedSet(); @@ -90,7 +123,6 @@ private static (IEnumerable, IEnumerable) FilterA return (keptBeatmapDataItems, obstacleDataItems); } - private static void SetTime(BeatmapDataItem item, float time) { var fieldInfo = typeof(BeatmapDataItem).GetField(" false @@ -50,6 +51,11 @@ False False + + $(BeatSaberDir)\Plugins\CustomJSONData.dll + False + False + False $(BeatSaberDir)\Libs\Newtonsoft.Json.dll @@ -147,6 +153,7 @@ + diff --git a/InfiniteBeatSaber/Properties/AssemblyInfo.cs b/InfiniteBeatSaber/Properties/AssemblyInfo.cs index e33ef24..b93ea25 100644 --- a/InfiniteBeatSaber/Properties/AssemblyInfo.cs +++ b/InfiniteBeatSaber/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0")] -[assembly: AssemblyFileVersion("1.0.0")] +[assembly: AssemblyVersion("1.0.1")] +[assembly: AssemblyFileVersion("1.0.1")] diff --git a/InfiniteBeatSaber/manifest.json b/InfiniteBeatSaber/manifest.json index cf1befb..d39706a 100644 --- a/InfiniteBeatSaber/manifest.json +++ b/InfiniteBeatSaber/manifest.json @@ -3,11 +3,12 @@ "id": "InfiniteBeatSaber", "name": "InfiniteBeatSaber", "author": "rigdern", - "version": "1.0.0", + "version": "1.0.1", "description": "Generates never-ending and ever changing levels. Inspired by the Infinite Jukebox.", "gameVersion": "1.31.1", "dependsOn": { "BSIPA": "^4.3.0", + "CustomJSONData": "^2.5.1", "SiraUtil": "^3.1.5" } } diff --git a/docs/manual-installation.md b/docs/manual-installation.md index d609792..22dd346 100644 --- a/docs/manual-installation.md +++ b/docs/manual-installation.md @@ -4,11 +4,14 @@ Here are the steps if you want to manually install the Infinite Beat Saber mod: 1. Download the latest version from the [releases page](https://github.com/rigdern/InfiniteBeatSaber/releases). 1. Unzip the release and drop `InfiniteBeatSaber.dll` into your Beat Saber's `Plugins/` folder. For example, mine is located at `C:\Program Files (x86)\Steam\steamapps\common\Beat Saber\Plugins`. -1. You'll also need to similarly manually install [SiraUtil](https://github.com/Auros/SiraUtil/releases) into your Beat Saber's `Plugins/` folder. Infinite Beat Saber relies on some functionality in `SiraUtil`. +1. You'll also need to similarly manually install these into your Beat Saber's `Plugins/` folder: + - [CustomJSONData](https://github.com/Aeroluna/CustomJSONData/releases) + - [SiraUtil](https://github.com/Auros/SiraUtil/releases) You'll need to make sure that you have compatible versions of all of these things: - Beat Saber - Infinite Beat Saber mod +- CustomJSONData - SiraUtil To determine this, you can check `manifest.json` for the version of Infinite Beat Saber you downloaded.