From 5e14f86ec1ca1d095c4ffcac61a8f47d91d52bfa Mon Sep 17 00:00:00 2001 From: rcelyte Date: Fri, 23 Sep 2022 02:46:05 +0000 Subject: [PATCH] Fix beatmap v3 ordering Addresses #3 --- makefile | 2 +- qpm.json | 2 +- src/main.cpp | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/makefile b/makefile index 104df57..e1a682b 100644 --- a/makefile +++ b/makefile @@ -30,7 +30,7 @@ $(OBJDIR)/%.cpp.o: %.cpp extern makefile | ndk .obj/mod.json: extern @echo "[printf $(notdir $@)]" @mkdir -p "$(@D)" - printf "{\n\t\"\$$schema\":\"https://raw.githubusercontent.com/Lauriethefish/QuestPatcher.QMod/main/QuestPatcher.QMod/Resources/qmod.schema.json\",\n\t\"_QPVersion\": \"0.1.1\",\n\t\"name\": \"Mapping Extensions\",\n\t\"id\": \"MappingExtensions\",\n\t\"author\": \"StackDoubleFlow, rxzz0, rcelyte\",\n\t\"version\": \"0.21.3\",\n\t\"coverImage\": \"cover.png\",\n\t\"packageId\": \"com.beatgames.beatsaber\",\n\t\"packageVersion\": \"1.24.0\",\n\t\"description\": \"This adds a host of new things you can do with your maps as a mapper, and allows you to play said maps as a player. An update of the port of the PC original mod by Kyle 1413. Previously maintained by zoller27osu.\",\n\t\"modFiles\": [\n\t\t\"libmappingextensions.so\"\n\t],\n\t\"libraryFiles\": [\n\t\t\"$(notdir $(wildcard extern/libs/libbeatsaber-hook*.so))\"\n\t]\n}" > .obj/mod.json + printf "{\n\t\"\$$schema\":\"https://raw.githubusercontent.com/Lauriethefish/QuestPatcher.QMod/main/QuestPatcher.QMod/Resources/qmod.schema.json\",\n\t\"_QPVersion\": \"0.1.1\",\n\t\"name\": \"Mapping Extensions\",\n\t\"id\": \"MappingExtensions\",\n\t\"author\": \"StackDoubleFlow, rxzz0, rcelyte\",\n\t\"version\": \"0.21.4\",\n\t\"coverImage\": \"cover.png\",\n\t\"packageId\": \"com.beatgames.beatsaber\",\n\t\"packageVersion\": \"1.24.0\",\n\t\"description\": \"This adds a host of new things you can do with your maps as a mapper, and allows you to play said maps as a player. An update of the port of the PC original mod by Kyle 1413. Previously maintained by zoller27osu.\",\n\t\"modFiles\": [\n\t\t\"libmappingextensions.so\"\n\t],\n\t\"libraryFiles\": [\n\t\t\"$(notdir $(wildcard extern/libs/libbeatsaber-hook*.so))\"\n\t]\n}" > .obj/mod.json MappingExtensions.qmod: libmappingextensions.so .obj/mod.json @echo "[zip $@]" diff --git a/qpm.json b/qpm.json index 2454d13..5ff1769 100644 --- a/qpm.json +++ b/qpm.json @@ -4,7 +4,7 @@ "info": { "name": "MappingExtensions", "id": "MappingExtensions", - "version": "0.21.3", + "version": "0.21.4", "url": null, "additionalData": {} }, diff --git a/src/main.cpp b/src/main.cpp index fbb7871..a2c0936 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -136,10 +136,10 @@ MAKE_HOOK_MATCH(BeatmapDataLoader_GetBeatmapDataFromBeatmapSaveData, &BeatmapDat System::Collections::Generic::List_1<::BeatmapSaveDataVersion3::BeatmapSaveData::SliderData*> *sliders = beatmapSaveData->sliders; System::Collections::Generic::List_1<::BeatmapSaveDataVersion3::BeatmapSaveData::BurstSliderData*> *bursts = beatmapSaveData->burstSliders; System::Collections::Generic::List_1 *waypoints = beatmapSaveData->waypoints; + notes->Sort(); bombs->Sort(); obstacles->Sort(); sliders->Sort(); bursts->Sort(); waypoints->Sort(); + BeatmapData *result = BeatmapDataLoader_GetBeatmapDataFromBeatmapSaveData(beatmapSaveData, beatmapDifficulty, startBpm, loadingForDesignatedEnvironment, environmentKeywords, environmentLightGroups, defaultEnvironmentEvents, playerSpecificSettings); uint32_t noteIndex = 0, bombIndex = 0, obstacleIndex = 0, sliderIndex = 0, burstIndex = 0, waypointIndex = 0; - - BeatmapData *result = BeatmapDataLoader_GetBeatmapDataFromBeatmapSaveData(beatmapSaveData, beatmapDifficulty, startBpm, loadingForDesignatedEnvironment, environmentKeywords, environmentLightGroups, defaultEnvironmentEvents, playerSpecificSettings); logger->info("Restoring %u notes, %u bombs, %u obstacles, %u sliders, %u burst sliders, and %u waypoints", notes->get_Count(), bombs->get_Count(), obstacles->get_Count(), sliders->get_Count(), bursts->get_Count(), waypoints->get_Count()); for(System::Collections::Generic::LinkedListNode_1 *iter = result->get_allBeatmapDataItems()->head, *end = iter ? iter->prev : NULL; iter; iter = iter->next) { BeatmapDataItem *item = iter->item; @@ -181,7 +181,7 @@ MAKE_HOOK_MATCH(BeatmapDataLoader_GetBeatmapDataFromBeatmapSaveData, &BeatmapDat uint32_t *sourceIndex = &sliderIndex; if(data->sliderType == SliderData::Type::Burst) source = (System::Collections::Generic::IReadOnlyList_1*)bursts, sourceIndex = &burstIndex; - if(sliderIndex >= ((System::Collections::Generic::IReadOnlyCollection_1*)source)->get_Count()) { + if(*sourceIndex >= ((System::Collections::Generic::IReadOnlyCollection_1*)source)->get_Count()) { logger->warning("Failed to restore line layers for SliderData (%s)", ((void*)source == (void*)sliders) ? "Normal" : "Burst"); goto next; } @@ -567,7 +567,7 @@ MAKE_HOOK_MATCH(StaticBeatmapObjectSpawnMovementData_LineYPosForLineLayer, &Stat extern "C" DL_EXPORT void setup(ModInfo& info) { info.id = "MappingExtensions"; - info.version = "0.21.3"; + info.version = "0.21.4"; modInfo = info; logger = new Logger(modInfo, LoggerOptions(false, true)); logger->info("Leaving setup!");