diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..435e168 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,100 @@ +# Credit to darknight1050 https://github.com/darknight1050/CrashReporter/blob/master/.github/workflows/build-ndk.yml + +name: NDK build + +env: + module_id: practiceaddons + qmodName: PracticeAddons + +on: + workflow_dispatch: + push: + branches-ignore: + - 'version-v*' + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + name: Checkout + with: + submodules: true + lfs: true + + - uses: seanmiddleditch/gha-setup-ninja@v3 + + - name: Create ndkpath.txt + run: | + echo "$ANDROID_NDK_LATEST_HOME" > ${GITHUB_WORKSPACE}/ndkpath.txt + cat ${GITHUB_WORKSPACE}/ndkpath.txt + - name: Get QPM + if: steps.cache-qpm.outputs.cache-hit != 'true' + uses: dawidd6/action-download-artifact@v2 + with: + github_token: ${{secrets.GITHUB_TOKEN}} + workflow: cargo-build.yml + name: linux-qpm-rust + path: QPM + repo: QuestPackageManager/QPM.CLI + + - name: QPM Collapse + run: | + chmod +x ./QPM/qpm-rust + ./QPM/qpm-rust collapse + + - name: QPM Dependencies Cache + id: cache-qpm-deps + uses: actions/cache@v2 + env: + cache-name: cache-qpm-deps + with: + path: /home/runner/.local/share/QPM-Rust/cache + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('qpm.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: QPM Restore + run: | + ./QPM/qpm-rust restore + - name: List Post Restore + run: | + echo includes: + ls -la ${GITHUB_WORKSPACE}/extern/includes + echo libs: + ls -la ${GITHUB_WORKSPACE}/extern/libs + echo cache: + ls -la $HOME/.local/share/QPM-Rust/cache + + - name: Build + run: | + cd ${GITHUB_WORKSPACE} + ./QPM/qpm-rust qmod build + pwsh -Command ./build.ps1 + - name: Create Qmod + run: | + pwsh -Command ./createqmod.ps1 ${{env.qmodName}} + - name: Get Library Name + id: libname + run: | + cd ./build/ + pattern="lib${module_id}*.so" + files=( $pattern ) + echo ::set-output name=NAME::"${files[0]}" + + - name: Upload so artifact + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.libname.outputs.NAME }} + path: ./build/${{ steps.libname.outputs.NAME }} + if-no-files-found: error + + - name: Upload qmod artifact + uses: actions/upload-artifact@v2 + with: + name: ${{env.qmodName}}.qmod + path: ./${{ env.qmodName }}.qmod + if-no-files-found: error \ No newline at end of file diff --git a/src/Config.cpp b/src/Config.cpp index b80c18a..cb89a64 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -7,7 +7,6 @@ const std::string configPath = "/sdcard/moddata/com.beatgames.beatsaber/mods/Pra PracticeAddons::Config::Levels levels; PracticeAddons::Config::Difficulty* currentDifficulty; -std::string currentLevelId; namespace PracticeAddons::Config { @@ -25,7 +24,6 @@ namespace PracticeAddons::Config { Difficulty GetLevelInfo(std::string levelId, std::string characteristic, std::string difficulty) { - currentLevelId = levelId; bool exists = levels.levels[levelId].characteristics[characteristic].difficulties.contains(difficulty); currentDifficulty = &levels.levels[levelId].characteristics[characteristic].difficulties[difficulty]; diff --git a/src/Hooks/RestartHooks.cpp b/src/Hooks/RestartHooks.cpp index dbe75d0..4803f5c 100644 --- a/src/Hooks/RestartHooks.cpp +++ b/src/Hooks/RestartHooks.cpp @@ -6,6 +6,7 @@ #include "GlobalNamespace/PauseController.hpp" #include "GlobalNamespace/ILevelRestartController.hpp" #include "GlobalNamespace/SinglePlayerLevelSelectionFlowCoordinator.hpp" +#include "GlobalNamespace/MultiplayerLevelScenesTransitionSetupDataSO.hpp" #include "UnityEngine/Resources.hpp" @@ -25,23 +26,24 @@ MAKE_HOOK_MATCH(AudioTimeSyncController_Update, &GlobalNamespace::AudioTimeSyncC } } -MAKE_HOOK_MATCH(AudioTimeSyncController_Start, &GlobalNamespace::AudioTimeSyncController::Start, void, GlobalNamespace::AudioTimeSyncController* self) +MAKE_HOOK_MATCH(SinglePlayerLevelSelectionFlowCoordinator_StartLevel, &GlobalNamespace::SinglePlayerLevelSelectionFlowCoordinator::StartLevel, void, GlobalNamespace::SinglePlayerLevelSelectionFlowCoordinator* self, System::Action* beforeSceneSwitchCallback, bool practice) { - AudioTimeSyncController_Start(self); + SinglePlayerLevelSelectionFlowCoordinator_StartLevel(self, beforeSceneSwitchCallback, practice); + isPractice = practice; shouldReset = true; } -MAKE_HOOK_MATCH(SinglePlayerLevelSelectionFlowCoordinator_StartLevel, &GlobalNamespace::SinglePlayerLevelSelectionFlowCoordinator::StartLevel, void, GlobalNamespace::SinglePlayerLevelSelectionFlowCoordinator* self, System::Action* beforeSceneSwitchCallback, bool practice) +MAKE_HOOK_MATCH(MultiplayerLevelScenesTransitionSetupDataSO_Init, &GlobalNamespace::MultiplayerLevelScenesTransitionSetupDataSO::Init, void, GlobalNamespace::MultiplayerLevelScenesTransitionSetupDataSO* self, StringW gameMode, GlobalNamespace::IPreviewBeatmapLevel* previewBeatmapLevel, GlobalNamespace::BeatmapDifficulty beatmapDifficulty, GlobalNamespace::BeatmapCharacteristicSO* beatmapCharacteristic, GlobalNamespace::IDifficultyBeatmap* difficultyBeatmap, GlobalNamespace::ColorScheme* overrideColorScheme, GlobalNamespace::GameplayModifiers* gameplayModifiers, GlobalNamespace::PlayerSpecificSettings* playerSpecificSettings, GlobalNamespace::PracticeSettings* practiceSettings, bool useTestNoteCutSoundEffects) { - SinglePlayerLevelSelectionFlowCoordinator_StartLevel(self, beforeSceneSwitchCallback, practice); - isPractice = practice; + MultiplayerLevelScenesTransitionSetupDataSO_Init(self, gameMode, previewBeatmapLevel, beatmapDifficulty, beatmapCharacteristic, difficultyBeatmap, overrideColorScheme, gameplayModifiers, playerSpecificSettings, practiceSettings, useTestNoteCutSoundEffects); + isPractice = false; } namespace PracticeAddons::Hooks { void InstallRestartHooks() { + INSTALL_HOOK(getLogger(), MultiplayerLevelScenesTransitionSetupDataSO_Init); INSTALL_HOOK(getLogger(), AudioTimeSyncController_Update); - INSTALL_HOOK(getLogger(), AudioTimeSyncController_Start); INSTALL_HOOK(getLogger(), SinglePlayerLevelSelectionFlowCoordinator_StartLevel); } } \ No newline at end of file diff --git a/src/SliderManager.cpp b/src/SliderManager.cpp index d855b36..c76db9c 100644 --- a/src/SliderManager.cpp +++ b/src/SliderManager.cpp @@ -57,6 +57,7 @@ namespace PracticeAddons::SliderManager { resetTrans->set_anchoredPosition({-25, -57}); restartSlider->valueDidChangeEvent = custom_types::MakeDelegate*>(std::function(PlayPreview)); + QuestUI::BeatSaberUI::CreateText(parent, "Song Restart", {21, -16}); } void HandleSliderValues(HMUI::PercentSlider* speedSlider, HMUI::TimeSlider* startSlider)