Skip to content

Commit

Permalink
Fix beatmap v3 ordering
Browse files Browse the repository at this point in the history
Addresses #3
  • Loading branch information
rcelyte committed Sep 23, 2022
1 parent 3c89e3a commit 5e14f86
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 $@]"
Expand Down
2 changes: 1 addition & 1 deletion qpm.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"info": {
"name": "MappingExtensions",
"id": "MappingExtensions",
"version": "0.21.3",
"version": "0.21.4",
"url": null,
"additionalData": {}
},
Expand Down
8 changes: 4 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<BeatmapSaveDataVersion3::BeatmapSaveData::WaypointData*> *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<BeatmapDataItem*> *iter = result->get_allBeatmapDataItems()->head, *end = iter ? iter->prev : NULL; iter; iter = iter->next) {
BeatmapDataItem *item = iter->item;
Expand Down Expand Up @@ -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<BeatmapSaveDataVersion3::BeatmapSaveData::BaseSliderData*>*)bursts, sourceIndex = &burstIndex;
if(sliderIndex >= ((System::Collections::Generic::IReadOnlyCollection_1<BeatmapSaveDataVersion3::BeatmapSaveData::BaseSliderData*>*)source)->get_Count()) {
if(*sourceIndex >= ((System::Collections::Generic::IReadOnlyCollection_1<BeatmapSaveDataVersion3::BeatmapSaveData::BaseSliderData*>*)source)->get_Count()) {
logger->warning("Failed to restore line layers for SliderData (%s)", ((void*)source == (void*)sliders) ? "Normal" : "Burst");
goto next;
}
Expand Down Expand Up @@ -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!");
Expand Down

0 comments on commit 5e14f86

Please sign in to comment.