diff --git a/.github/actions/canary-ndk/action.yml b/.github/actions/canary-ndk/action.yml deleted file mode 100644 index 6454ad5..0000000 --- a/.github/actions/canary-ndk/action.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: "Setup canary ndk" -description: "Sets up canary ndk" -outputs: - ndk-path: - value: ${{ steps.path.outputs.path }} - description: "Output path of the ndk" - cache-hit: - value: ${{ steps.cache.outputs.cache-hit }} - description: "Whether a cache hit occurred for the ndk" -runs: - using: "composite" - steps: - - name: NDK cache - id: cache - uses: actions/cache@v3 - with: - path: ${HOME}/android-ndk-r27-canary/ - key: ${{ runner.os }}-ndk-r27-canary - - - name: Download canary ndk - if: ${{ !steps.cache.outputs.cache-hit }} - env: - CANARY_URL: https://github.com/QuestPackageManager/ndk-canary-archive/releases/download/27.0.1/android-ndk-10883340-linux-x86_64.zip - run: wget ${CANARY_URL} -O ${HOME}/ndk.zip - shell: bash - - - name: Unzip ndk - if: ${{ !steps.cache.outputs.cache-hit }} - run: 7z x "${HOME}/ndk.zip" -o"${HOME}/" - shell: bash - - - name: Set output - id: path - shell: bash - run: echo "path=${HOME}/android-ndk-r27-canary" >> ${GITHUB_OUTPUT} \ No newline at end of file diff --git a/.github/workflows/build-ndk.yml b/.github/workflows/build-ndk.yml index a0323d6..86e79a0 100644 --- a/.github/workflows/build-ndk.yml +++ b/.github/workflows/build-ndk.yml @@ -5,6 +5,7 @@ on: push: branches: - 'master' + - 'dev' paths-ignore: - '**.yml' - '!.github/workflows/build-ndk.yml' @@ -38,14 +39,9 @@ jobs: - uses: seanmiddleditch/gha-setup-ninja@v3 - # Use canary NDK to avoid lesser known compile bugs - - name: Setup canary NDK - id: setup-ndk - uses: ./.github/actions/canary-ndk - - name: Create ndkpath.txt run: | - echo ${{ steps.setup-ndk.outputs.ndk-path }} > ${GITHUB_WORKSPACE}/ndkpath.txt + echo $ANDROID_NDK_HOME > ${GITHUB_WORKSPACE}/ndkpath.txt cat ${GITHUB_WORKSPACE}/ndkpath.txt # get version from pushed tag @@ -79,21 +75,21 @@ jobs: echo "NAME=${files[0]}" >> $GITHUB_OUTPUT - name: Upload non-debug artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: ${{ steps.libname.outputs.NAME }} path: ./build/${{ steps.libname.outputs.NAME }} if-no-files-found: error - name: Upload debug artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: debug_${{ steps.libname.outputs.NAME }} path: ./build/debug/${{ steps.libname.outputs.NAME }} if-no-files-found: error - name: Upload qmod artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: ${{env.qmodName}}.qmod path: ./${{ env.qmodName }}.qmod diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 37b1150..ae90cb1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -22,14 +22,9 @@ jobs: - uses: seanmiddleditch/gha-setup-ninja@v3 - # Use canary NDK to avoid lesser known compile bugs - - name: Setup canary NDK - id: setup-ndk - uses: ./.github/actions/canary-ndk - - name: Create ndkpath.txt run: | - echo ${{ steps.setup-ndk.outputs.ndk-path }} > ${GITHUB_WORKSPACE}/ndkpath.txt + echo $ANDROID_NDK_HOME > ${GITHUB_WORKSPACE}/ndkpath.txt cat ${GITHUB_WORKSPACE}/ndkpath.txt # get version from pushed tag diff --git a/.gitignore b/.gitignore index 2e76105..9d7352d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .vs/ +.cache/ # Prerequisites *.d diff --git a/CMakeLists.txt b/CMakeLists.txt index e07a967..25c265a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,12 +1,12 @@ # include some defines automatically made by qpm include(qpm_defines.cmake) -include(${EXTERN_DIR}/includes/kaleb/shared/cmake/assets.cmake) -add_definitions(-DPAPER_DISABLE_SOURCE_LOC) -add_definitions(-DCP_SDK_BMBF) +cmake_minimum_required(VERSION 3.22) +project(${COMPILE_ID}) -# override mod id -set(MOD_ID "QBeatSaberPlus-NoteTweaker") +# c++ standard +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED 20) # Enable link time optimization # In my experience, this can be highly unstable but it nets a huge size optimization and likely performance @@ -14,25 +14,18 @@ set(MOD_ID "QBeatSaberPlus-NoteTweaker") # As always, test thoroughly # - Fern # set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) - -cmake_minimum_required(VERSION 3.21) -project(${COMPILE_ID}) - # export compile commands for significantly better intellisense set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -# c++ standard -set(CMAKE_CXX_STANDARD 20) -set(CMAKE_CXX_STANDARD_REQUIRED 20) - # define that stores the actual source directory set(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src) set(INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include) set(SHARED_DIR ${CMAKE_CURRENT_SOURCE_DIR}/shared) +# stop symbol leaking +#add_link_options(-Wl,--exclude-libs,ALL) # compile options used -add_compile_options(-frtti -fexceptions) -add_compile_options(-O3) +add_compile_options(-frtti -fPIE -fPIC -fexceptions -fdeclspec -fvisibility=hidden -Wno-extra-qualification -O3) # get git info execute_process(COMMAND git config user.name OUTPUT_VARIABLE GIT_USER) @@ -50,69 +43,72 @@ message(STATUS "GIT_BRANCH: ${GIT_BRANCH}") message(STATUS "GIT_COMMIT: 0x${GIT_COMMIT}") message(STATUS "GIT_MODIFIED: ${GIT_MODIFIED}") -# set git defines -add_compile_definitions(GIT_USER=\"${GIT_USER}\") -add_compile_definitions(GIT_BRANCH=\"${GIT_BRANCH}\") -add_compile_definitions(GIT_COMMIT=0x${GIT_COMMIT}) -add_compile_definitions(GIT_MODIFIED=${GIT_MODIFIED}) + +# Check for file presence and read current contents +set(GIT_INFO_H_PATH "${CMAKE_CURRENT_SOURCE_DIR}/include/git_info.h") +if(EXISTS "${GIT_INFO_H_PATH}") + file(READ "${GIT_INFO_H_PATH}" GIT_INFO_H_CURRENT) +else() + set(GIT_INFO_H_CURRENT "") +endif() + +# Define new git info content +set(GIT_INFO_H "#pragma once +#define GIT_USER \"${GIT_USER}\" +#define GIT_BRANCH \"${GIT_BRANCH}\" +#define GIT_COMMIT 0x${GIT_COMMIT} +#define GIT_MODIFIED ${GIT_MODIFIED} +") + +# Write git info to file if the contents have changed +if(NOT "${GIT_INFO_H}" STREQUAL "${GIT_INFO_H_CURRENT}") + file(WRITE "${GIT_INFO_H_PATH}" "${GIT_INFO_H}") +endif() + # compile definitions used add_compile_definitions(VERSION=\"${MOD_VERSION}\") add_compile_definitions(MOD_ID=\"${MOD_ID}\") +add_compile_definitions(UNITY_2021) +add_compile_definitions(CORDL_RUNTIME_FIELD_NULL_CHECKS) +add_compile_definitions(__USE_LARGEFILE64) + +# compile options used +add_compile_definitions(CP_SDK_BMBF) + +string(LENGTH "${CMAKE_CURRENT_LIST_DIR}/" FOLDER_LENGTH) +add_compile_definitions("PAPER_ROOT_FOLDER_LENGTH=${FOLDER_LENGTH}") # recursively get all src files -RECURSE_FILES(h_file_lista ${INCLUDE_DIR}/*.hpp) -RECURSE_FILES(h_file_listb ${SHARED_DIR}/*.hpp) -RECURSE_FILES(hpp_file_lista ${INCLUDE_DIR}/*.hpp) -RECURSE_FILES(hpp_file_listb ${SHARED_DIR}/*.hpp) -RECURSE_FILES(cpp_file_list ${SOURCE_DIR}/*.cpp) -RECURSE_FILES(c_file_list ${SOURCE_DIR}/*.c) +recurse_files(cpp_file_list ${SOURCE_DIR}/*.cpp) +recurse_files(c_file_list ${SOURCE_DIR}/*.c) + +recurse_files(inline_hook_c ${EXTERN_DIR}/includes/beatsaber-hook/shared/inline-hook/*.c) +recurse_files(inline_hook_cpp ${EXTERN_DIR}/includes/beatsaber-hook/shared/inline-hook/*.cpp) # add all src files to compile add_library( - ${COMPILE_ID} - SHARED - ${h_file_lista} - ${h_file_listb} - ${hpp_file_lista} - ${hpp_file_listb} - ${cpp_file_list} - ${c_file_list} + ${COMPILE_ID} SHARED ${cpp_file_list} ${c_file_list} ${inline_hook_c} ${inline_hook_cpp} ) -# Add any assets -#add_assets(assets_${COMPILE_ID} STATIC ${CMAKE_CURRENT_LIST_DIR}/assets ${INCLUDE_DIR}/assets.hpp) - -# get the vcpkg dir from env variables -if(EXISTS $ENV{VCPKG_ROOT}) - set(VCPKG_ROOT $ENV{VCPKG_ROOT}) -else() - MESSAGE(ERROR "Please define the environment variable VCPKG_ROOT with the root to your vcpkg install!") -endif() - -target_include_directories(${COMPILE_ID} PRIVATE .) - # add src dir as include dir target_include_directories(${COMPILE_ID} PRIVATE ${SOURCE_DIR}) # add include dir as include dir target_include_directories(${COMPILE_ID} PRIVATE ${INCLUDE_DIR}) # add shared dir as include dir target_include_directories(${COMPILE_ID} PUBLIC ${SHARED_DIR}) -# codegen includes -target_include_directories(${COMPILE_ID} PRIVATE ${EXTERN_DIR}/includes/${CODEGEN_ID}/include) # chatplex-sdk-bs includes target_include_directories(${COMPILE_ID} PRIVATE ${EXTERN_DIR}/includes/chatplex-sdk-bs/shared) -target_link_libraries(${COMPILE_ID} PRIVATE -llog) -#target_link_libraries(${COMPILE_ID} PRIVATE assets_${COMPILE_ID}) +target_link_libraries(${COMPILE_ID} PRIVATE -llog -lz) # add extern stuff like libs and other includes include(extern.cmake) add_custom_command(TARGET ${COMPILE_ID} POST_BUILD - COMMAND ${CMAKE_STRIP} -d --strip-all - "lib${COMPILE_ID}.so" -o "stripped_lib${COMPILE_ID}.so" - COMMENT "Strip debug symbols done on final binary.") + COMMAND ${CMAKE_STRIP} -g -S -d --strip-all + "lib${COMPILE_ID}.so" -o "stripped_lib${COMPILE_ID}.so" + COMMENT "Strip debug symbols done on final binary.") add_custom_command(TARGET ${COMPILE_ID} POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory debug @@ -120,32 +116,32 @@ add_custom_command(TARGET ${COMPILE_ID} POST_BUILD ) add_custom_command(TARGET ${COMPILE_ID} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E rename lib${COMPILE_ID}.so debug/lib${COMPILE_ID}.so - COMMENT "Rename the lib to debug_ since it has debug symbols" - ) + COMMAND ${CMAKE_COMMAND} -E rename lib${COMPILE_ID}.so debug/lib${COMPILE_ID}.so + COMMENT "Rename the lib to debug_ since it has debug symbols" + ) -# strip debug symbols from the .so and all dependencies add_custom_command(TARGET ${COMPILE_ID} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E rename stripped_lib${COMPILE_ID}.so lib${COMPILE_ID}.so - COMMENT "Rename the stripped lib to regular" - ) - foreach(so_file ${so_list}) - cmake_path(GET so_file FILENAME file) + COMMAND ${CMAKE_COMMAND} -E rename stripped_lib${COMPILE_ID}.so lib${COMPILE_ID}.so + COMMENT "Rename the stripped lib to regular" + ) - add_custom_command(TARGET ${COMPILE_ID} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${so_file} debug/${file} - COMMENT "Copy so files for ndk stack" - ) +foreach(so_file ${so_list}) + cmake_path(GET so_file FILENAME file) + + add_custom_command(TARGET ${COMPILE_ID} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${so_file} debug/${file} + COMMENT "Copy so files for ndk stack" + ) - add_custom_command(TARGET ${COMPILE_ID} POST_BUILD - COMMAND ${CMAKE_STRIP} -g -S -d --strip-all ${so_file} -o ${file} - COMMENT "Strip debug symbols from the dependencies") - endforeach() + add_custom_command(TARGET ${COMPILE_ID} POST_BUILD + COMMAND ${CMAKE_STRIP} -g -S -d --strip-all ${so_file} -o ${file} + COMMENT "Strip debug symbols from the dependencies") +endforeach() - foreach(a_file ${a_list}) - cmake_path(GET a_file FILENAME file) +foreach(a_file ${a_list}) +cmake_path(GET a_file FILENAME file) - add_custom_command(TARGET ${COMPILE_ID} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${a_file} debug/${file} - COMMENT "Copy a files for ndk stack") - endforeach() \ No newline at end of file +add_custom_command(TARGET ${COMPILE_ID} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${a_file} debug/${file} + COMMENT "Copy a files for ndk stack") +endforeach() diff --git a/include/git_info.h b/include/git_info.h new file mode 100644 index 0000000..c0e9730 --- /dev/null +++ b/include/git_info.h @@ -0,0 +1,5 @@ +#pragma once +#define GIT_USER "HardCPP" +#define GIT_BRANCH "dev" +#define GIT_COMMIT 0x136cce8 +#define GIT_MODIFIED 1 diff --git a/mod.json b/mod.json index ee51fec..89fbd2b 100644 --- a/mod.json +++ b/mod.json @@ -1,38 +1,42 @@ { + "$schema": "https://raw.githubusercontent.com/Lauriethefish/QuestPatcher.QMod/refs/heads/main/QuestPatcher.QMod/Resources/qmod.schema.json", "_QPVersion": "0.1.1", "name": "QBeatSaberPlus-NoteTweaker", "id": "qbeatsaberplus-notetweaker", "modloader": "Scotland2", "author": "HardCPP", - "version": "6.3.2", + "version": "6.4.0", "packageId": "com.beatgames.beatsaber", - "packageVersion": "1.37.0_9064817954", + "packageVersion": "1.40.4_5283", "description": "Feel good!", "coverImage": "cover.png", "dependencies": [ { - "version": "^0.17.8", + "version": "^6.4.1", + "id": "beatsaber-hook", + "downloadIfMissing": "https://github.com/QuestPackageManager/beatsaber-hook/releases/download/v6.4.1/beatsaber-hook.qmod" + }, + { + "version": "^0.18.2", "id": "custom-types", - "downloadIfMissing": "https://github.com/QuestPackageManager/Il2CppQuestTypePatching/releases/download/v0.17.10/CustomTypes.qmod" + "downloadIfMissing": "https://github.com/QuestPackageManager/Il2CppQuestTypePatching/releases/download/v0.18.2/CustomTypes.qmod" }, { - "version": "^3.6.3", - "id": "paper", - "downloadIfMissing": "https://github.com/Fernthedev/paperlog/releases/download/v3.6.4/paperlog.qmod" + "version": "^4.6.1", + "id": "paper2_scotland2", + "downloadIfMissing": "https://github.com/Fernthedev/paperlog/releases/download/v4.6.3/paper2_scotland2.qmod" }, { - "version": "^6.3.2", + "version": "^6.4.0", "id": "chatplex-sdk-bs", - "downloadIfMissing": "https://github.com/hardcpp/QuestChatPlexSDK-BS/releases/download/v6.3.2/ChatPlexSDK-BS.qmod" + "downloadIfMissing": "https://github.com/hardcpp/QuestChatPlexSDK-BS/releases/download/v6.4.0/ChatPlexSDK-BS.qmod" } ], - "modFiles": [], - "lateModFiles": [ + "modFiles": [ "libqbeatsaberplus-notetweaker.so" ], - "libraryFiles": [ - "libbeatsaber-hook_5_1_9.so" - ], + "lateModFiles": [], + "libraryFiles": [], "fileCopies": [], "copyExtensions": [] } \ No newline at end of file diff --git a/mod.template.json b/mod.template.json index 2547f03..5af37ad 100644 --- a/mod.template.json +++ b/mod.template.json @@ -7,11 +7,11 @@ "author": "HardCPP", "version": "${version}", "packageId": "com.beatgames.beatsaber", - "packageVersion": "1.37.0_9064817954", + "packageVersion": "1.40.4_5283", "description": "Feel good!", "coverImage": "cover.png", "dependencies": [], - "modFiles": [], + "modFiles": ["${binary}"], "libraryFiles": [], "fileCopies": [], "copyExtensions": [] diff --git a/qpm.json b/qpm.json index f47bcd6..fb58a24 100644 --- a/qpm.json +++ b/qpm.json @@ -1,11 +1,11 @@ { - "version": "0.1.0", + "version": "0.4.0", "sharedDir": "shared", "dependenciesDir": "extern", "info": { "name": "QBeatSaberPlus-NoteTweaker", "id": "qbeatsaberplus-notetweaker", - "version": "6.3.2", + "version": "6.4.0", "url": "https://github.com/hardcpp/QBeatSaberPlus-NoteTweaker", "additionalData": { "overrideSoName": "libqbeatsaberplus-notetweaker.so", @@ -35,27 +35,34 @@ "qpm qmod build", "pwsh ./createqmod.ps1 -clean" ] - } + }, + "ndk": "^27.2.12479018", + "qmodIncludeDirs": [ + "build", + "extern/libs" + ], + "qmodIncludeFiles": [], + "qmodOutput": "./QBeatSaberPlus-MenuMusic.qmod" }, "dependencies": [ { "id": "beatsaber-hook", - "versionRange": "^5.1.9", + "versionRange": "^6.4.1", "additionalData": {} }, { "id": "bs-cordl", - "versionRange": "^3700.*", + "versionRange": "^4004.0.0", "additionalData": {} }, { "id": "custom-types", - "versionRange": "^0.17.8", + "versionRange": "^0.18.2", "additionalData": {} }, { "id": "scotland2", - "versionRange": "^0.1.4", + "versionRange": "^0.1.6", "additionalData": { "includeQmod": false, "private": true @@ -63,7 +70,7 @@ }, { "id": "libil2cpp", - "versionRange": "^0.3.1", + "versionRange": "^0.4.0", "additionalData": {} }, { @@ -74,8 +81,8 @@ } }, { - "id": "paper", - "versionRange": "^3.6.3", + "id": "paper2_scotland2", + "versionRange": "^4.6.1", "additionalData": {} }, { @@ -85,7 +92,7 @@ }, { "id": "chatplex-sdk-bs", - "versionRange": "^6.3.2", + "versionRange": "^6.4.0", "additionalData": { "private": true } diff --git a/qpm.shared.json b/qpm.shared.json index 2cc18d8..9f26980 100644 --- a/qpm.shared.json +++ b/qpm.shared.json @@ -1,4 +1,5 @@ { + "$schema": "https://raw.githubusercontent.com/QuestPackageManager/QPM.Package/refs/heads/main/qpm.shared.schema.json", "config": { "version": "0.1.0", "sharedDir": "shared", @@ -6,7 +7,7 @@ "info": { "name": "QBeatSaberPlus-NoteTweaker", "id": "qbeatsaberplus-notetweaker", - "version": "6.3.2", + "version": "6.4.0", "url": "https://github.com/hardcpp/QBeatSaberPlus-NoteTweaker", "additionalData": { "overrideSoName": "libqbeatsaberplus-notetweaker.so", @@ -44,22 +45,22 @@ "dependencies": [ { "id": "beatsaber-hook", - "versionRange": "^5.1.9", + "versionRange": "^6.4.1", "additionalData": {} }, { "id": "bs-cordl", - "versionRange": "3700.*", + "versionRange": "^4004.0.0", "additionalData": {} }, { "id": "custom-types", - "versionRange": "^0.17.8", + "versionRange": "^0.18.2", "additionalData": {} }, { "id": "scotland2", - "versionRange": "^0.1.4", + "versionRange": "^0.1.6", "additionalData": { "includeQmod": false, "private": true @@ -67,7 +68,7 @@ }, { "id": "libil2cpp", - "versionRange": "^0.3.1", + "versionRange": "^0.4.0", "additionalData": {} }, { @@ -78,8 +79,8 @@ } }, { - "id": "paper", - "versionRange": "^3.6.3", + "id": "paper2_scotland2", + "versionRange": "^4.6.1", "additionalData": {} }, { @@ -89,7 +90,7 @@ }, { "id": "chatplex-sdk-bs", - "versionRange": "^6.3.2", + "versionRange": "^6.4.0", "additionalData": { "private": true } @@ -99,14 +100,13 @@ "restoredDependencies": [ { "dependency": { - "id": "paper", - "versionRange": "=3.6.4", + "id": "paper2_scotland2", + "versionRange": "=4.6.3", "additionalData": { - "soLink": "https://github.com/Fernthedev/paperlog/releases/download/v3.6.4/libpaperlog.so", - "debugSoLink": "https://github.com/Fernthedev/paperlog/releases/download/v3.6.4/debug_libpaperlog.so", - "overrideSoName": "libpaperlog.so", - "modLink": "https://github.com/Fernthedev/paperlog/releases/download/v3.6.4/paperlog.qmod", - "branchName": "version/v3_6_4", + "soLink": "https://github.com/Fernthedev/paperlog/releases/download/v4.6.3/libpaper2_scotland2.so", + "overrideSoName": "libpaper2_scotland2.so", + "modLink": "https://github.com/Fernthedev/paperlog/releases/download/v4.6.3/paper2_scotland2.qmod", + "branchName": "version/v4_6_3", "compileOptions": { "systemIncludes": [ "shared/utfcpp/source" @@ -115,44 +115,49 @@ "cmake": false } }, - "version": "3.6.4" + "version": "4.6.3" }, { "dependency": { "id": "libil2cpp", - "versionRange": "=0.3.2", + "versionRange": "=0.4.0", "additionalData": { "headersOnly": true, - "cmake": false + "compileOptions": { + "systemIncludes": [ + "il2cpp/external/baselib/Include", + "il2cpp/external/baselib/Platforms/Android/Include" + ] + } } }, - "version": "0.3.2" + "version": "0.4.0" }, { "dependency": { "id": "chatplex-sdk-bs", - "versionRange": "=6.3.2", + "versionRange": "=6.4.0", "additionalData": { - "soLink": "https://github.com/hardcpp/QuestChatPlexSDK-BS/releases/download/v6.3.2/libchatplex-sdk-bs.so", - "debugSoLink": "https://github.com/hardcpp/QuestChatPlexSDK-BS/releases/download/v6.3.2/debug_libchatplex-sdk-bs.so", + "soLink": "https://github.com/hardcpp/QuestChatPlexSDK-BS/releases/download/v6.4.0/libchatplex-sdk-bs.so", + "debugSoLink": "https://github.com/hardcpp/QuestChatPlexSDK-BS/releases/download/v6.4.0/debug_libchatplex-sdk-bs.so", "overrideSoName": "libchatplex-sdk-bs.so", - "modLink": "https://github.com/hardcpp/QuestChatPlexSDK-BS/releases/download/v6.3.2/ChatPlexSDK-BS.qmod", - "branchName": "version/v6_3_2", + "modLink": "https://github.com/hardcpp/QuestChatPlexSDK-BS/releases/download/v6.4.0/ChatPlexSDK-BS.qmod", + "branchName": "version/v6_4_0", "cmake": true } }, - "version": "6.3.2" + "version": "6.4.0" }, { "dependency": { "id": "custom-types", - "versionRange": "=0.17.10", + "versionRange": "=0.18.2", "additionalData": { - "soLink": "https://github.com/QuestPackageManager/Il2CppQuestTypePatching/releases/download/v0.17.10/libcustom-types.so", - "debugSoLink": "https://github.com/QuestPackageManager/Il2CppQuestTypePatching/releases/download/v0.17.10/debug_libcustom-types.so", + "soLink": "https://github.com/QuestPackageManager/Il2CppQuestTypePatching/releases/download/v0.18.2/libcustom-types.so", + "debugSoLink": "https://github.com/QuestPackageManager/Il2CppQuestTypePatching/releases/download/v0.18.2/debug_libcustom-types.so", "overrideSoName": "libcustom-types.so", - "modLink": "https://github.com/QuestPackageManager/Il2CppQuestTypePatching/releases/download/v0.17.10/CustomTypes.qmod", - "branchName": "version/v0_17_10", + "modLink": "https://github.com/QuestPackageManager/Il2CppQuestTypePatching/releases/download/v0.18.2/CustomTypes.qmod", + "branchName": "version/v0_18_2", "compileOptions": { "cppFlags": [ "-Wno-invalid-offsetof" @@ -161,15 +166,15 @@ "cmake": true } }, - "version": "0.17.10" + "version": "0.18.2" }, { "dependency": { "id": "bs-cordl", - "versionRange": "=3700.0.0", + "versionRange": "=4004.0.0", "additionalData": { "headersOnly": true, - "branchName": "version/v3700_0_0", + "branchName": "version/v4004_0_0", "compileOptions": { "includePaths": [ "include" @@ -179,12 +184,13 @@ "-DNEED_UNSAFE_CSHARP", "-fdeclspec", "-DUNITY_2021", - "-DHAS_CODEGEN" + "-DHAS_CODEGEN", + "-Wno-invalid-offsetof" ] } } }, - "version": "3700.0.0" + "version": "4004.0.0" }, { "dependency": { @@ -201,36 +207,38 @@ { "dependency": { "id": "beatsaber-hook", - "versionRange": "=5.1.9", + "versionRange": "=6.4.1", "additionalData": { - "soLink": "https://github.com/QuestPackageManager/beatsaber-hook/releases/download/v5.1.9/libbeatsaber-hook_5_1_9.so", - "debugSoLink": "https://github.com/QuestPackageManager/beatsaber-hook/releases/download/v5.1.9/debug_libbeatsaber-hook_5_1_9.so", - "branchName": "version/v5_1_9", + "soLink": "https://github.com/QuestPackageManager/beatsaber-hook/releases/download/v6.4.1/libbeatsaber-hook.so", + "debugSoLink": "https://github.com/QuestPackageManager/beatsaber-hook/releases/download/v6.4.1/debug_libbeatsaber-hook.so", + "overrideSoName": "libbeatsaber-hook.so", + "modLink": "https://github.com/QuestPackageManager/beatsaber-hook/releases/download/v6.4.1/beatsaber-hook.qmod", + "branchName": "version/v6_4_1", "cmake": true } }, - "version": "5.1.9" + "version": "6.4.1" }, { "dependency": { "id": "scotland2", - "versionRange": "=0.1.4", + "versionRange": "=0.1.6", "additionalData": { - "soLink": "https://github.com/sc2ad/scotland2/releases/download/v0.1.4/libsl2.so", - "debugSoLink": "https://github.com/sc2ad/scotland2/releases/download/v0.1.4/debug_libsl2.so", + "soLink": "https://github.com/sc2ad/scotland2/releases/download/v0.1.6/libsl2.so", + "debugSoLink": "https://github.com/sc2ad/scotland2/releases/download/v0.1.6/debug_libsl2.so", "overrideSoName": "libsl2.so", - "branchName": "version/v0_1_4" + "branchName": "version/v0_1_6" } }, - "version": "0.1.4" + "version": "0.1.6" }, { "dependency": { "id": "fmt", - "versionRange": "=10.0.0", + "versionRange": "=11.0.2", "additionalData": { "headersOnly": true, - "branchName": "version/v10_0_0", + "branchName": "version/v11_0_2", "compileOptions": { "systemIncludes": [ "fmt/include/" @@ -241,7 +249,7 @@ } } }, - "version": "10.0.0" + "version": "11.0.2" }, { "dependency": { diff --git a/src/Patches/PBombNoteController.cpp b/src/Patches/PBombNoteController.cpp index fee9546..bf7b08b 100644 --- a/src/Patches/PBombNoteController.cpp +++ b/src/Patches/PBombNoteController.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -149,10 +150,9 @@ namespace QBeatSaberPlus_NoteTweaker::Patches { BombNoteController_Init, &BombNoteController::Init, void, BombNoteController* __Instance, - NoteData* __a, float __b, Vector3 __c, Vector3 __d, - Vector3 __e, float __f, float __g, float __h) + NoteData* __a, ByRef __b) { - BombNoteController_Init(__Instance, __a, __b, __c, __d, __e, __f, __g, __h); + BombNoteController_Init(__Instance, __a, __b); auto l_Cache = (PBombNoteControllerCache*)nullptr; auto l_CacheCount = PBombNoteController_Cache.size(); @@ -183,4 +183,4 @@ namespace QBeatSaberPlus_NoteTweaker::Patches { l_Cache->transform->set_localScale(PBombNoteController_TempEnabled ? PBombNoteController_TempScale : PBombNoteController_Scale); } -} ///< namespace QBeatSaberPlus_NoteTweaker::Patches \ No newline at end of file +} ///< namespace QBeatSaberPlus_NoteTweaker::Patches diff --git a/src/Patches/PBurstSliderGameNoteController.cpp b/src/Patches/PBurstSliderGameNoteController.cpp index 4bbb69a..9041327 100644 --- a/src/Patches/PBurstSliderGameNoteController.cpp +++ b/src/Patches/PBurstSliderGameNoteController.cpp @@ -102,11 +102,9 @@ namespace QBeatSaberPlus_NoteTweaker::Patches { BurstSliderGameNoteController_Init, &BurstSliderGameNoteController::Init, void, BurstSliderGameNoteController* __Instance, - NoteData* __a, float __b, Vector3 __c, Vector3 __d, - Vector3 __e, float __f, float __g, float __h, - NoteVisualModifierType __i, float __j) + NoteData* __a, ByRef __b, NoteVisualModifierType __c, float __d) { - BurstSliderGameNoteController_Init(__Instance, __a, __b, __c, __d, __e, __f, __g, __h, __i, __j); + BurstSliderGameNoteController_Init(__Instance, __a, __b, __c, __d); if (!PBurstSliderGameNoteController_Enabled && !PBurstSliderGameNoteController_TempEnabled) return; diff --git a/src/Patches/PColorNoteVisuals.cpp b/src/Patches/PColorNoteVisuals.cpp index 18788f9..a2c75d9 100644 --- a/src/Patches/PColorNoteVisuals.cpp +++ b/src/Patches/PColorNoteVisuals.cpp @@ -1,4 +1,5 @@ #include "Patches/PColorNoteVisuals.hpp" +#include "CP_SDK/Utils/Il2cpp.hpp" #include "NTConfig.hpp" #include "Logger.hpp" @@ -23,6 +24,7 @@ #include #include #include +#include #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wreturn-type-c-linkage" @@ -51,6 +53,7 @@ namespace QBeatSaberPlus_NoteTweaker::Patches { Transform* noteArrows[PColorNoteVisualsCache_MaxSubArray]; Transform* noteArrowGlows[PColorNoteVisualsCache_MaxSubArray]; MaterialPropertyBlockController* noteArrowGlowsMaterialPropertyBlockControllers[PColorNoteVisualsCache_MaxSubArray]; + MaterialPropertyBlockController* noteCircleMeshRenderersMaterialPropertyBlockControllers[PColorNoteVisualsCache_MaxSubArray]; }; //////////////////////////////////////////////////////////////////////////// @@ -151,7 +154,7 @@ namespace QBeatSaberPlus_NoteTweaker::Patches { PColorNoteVisuals_ComponentsCache = List_1::New_ctor(10); if (PColorNoteVisuals_ColorID == 0) - PColorNoteVisuals_ColorID = Shader::PropertyToID("_SimpleColor"); + PColorNoteVisuals_ColorID = Shader::PropertyToID("_Color"); if (!PColorNoteVisuals_WasInit) { @@ -179,8 +182,8 @@ namespace QBeatSaberPlus_NoteTweaker::Patches { { ColorNoteVisuals_HandleNoteControllerDidInit(__Instance, __a); - auto l_Cache = (PColorNoteVisualsCache*)nullptr; - auto l_CacheCount = PColorNoteVisuals_Cache.size(); + auto l_Cache = (PColorNoteVisualsCache*)nullptr; + auto l_CacheCount = PColorNoteVisuals_Cache.size(); for (auto l_I = 0; l_I < l_CacheCount; ++l_I) { l_Cache = &PColorNoteVisuals_Cache[l_I]; @@ -202,10 +205,11 @@ namespace QBeatSaberPlus_NoteTweaker::Patches { }); l_Cache = &PColorNoteVisuals_Cache.back(); - auto l_MaterialPropertyBlockControllersIt = 0; - auto l_NoteArrowsIt = 0; - auto l_NoteArrowGlowsIt = 0; - auto l_NoteArrowGlowsMaterialPropertyBlockControllersIt = 0; + auto l_MaterialPropertyBlockControllersIt = 0; + auto l_NoteArrowsIt = 0; + auto l_NoteArrowGlowsIt = 0; + auto l_NoteArrowGlowsMaterialPropertyBlockControllersIt = 0; + auto l_NoteCircleMeshRenderersMaterialPropertyBlockControllersIt= 0; for (auto l_CurrentBlock : __Instance->____materialPropertyBlockControllers) { @@ -251,10 +255,31 @@ namespace QBeatSaberPlus_NoteTweaker::Patches { } } - l_Cache->materialPropertyBlockControllers [l_MaterialPropertyBlockControllersIt++ ] = nullptr; - l_Cache->noteArrows [l_NoteArrowsIt++ ] = nullptr; - l_Cache->noteArrowGlows [l_NoteArrowGlowsIt++ ] = nullptr; - l_Cache->noteArrowGlowsMaterialPropertyBlockControllers[l_NoteArrowGlowsMaterialPropertyBlockControllersIt++] = nullptr; + for (auto l_CurrentCircle : __Instance->____circleMeshRenderers) + { + PColorNoteVisuals_ComponentsCache->Clear(); + l_CurrentCircle->GetComponentsForListInternal(reinterpret_cast(csTypeOf(MaterialPropertyBlockController*).convert()), PColorNoteVisuals_ComponentsCache.Ptr()); + + auto l_Count = PColorNoteVisuals_ComponentsCache->get_Count(); + auto l_Items = PColorNoteVisuals_ComponentsCache->____items->_values; + for (auto l_I = 0; l_I < l_Count; ++l_I) + { + auto l_CurrentBlock = reinterpret_cast(l_Items[l_I]); + if (!l_CurrentBlock->____materialPropertyBlock) + l_CurrentBlock->____materialPropertyBlock = MaterialPropertyBlock::New_ctor(); + + l_Cache->noteCircleMeshRenderersMaterialPropertyBlockControllers[l_NoteCircleMeshRenderersMaterialPropertyBlockControllersIt++] = l_CurrentBlock; + + if (l_NoteCircleMeshRenderersMaterialPropertyBlockControllersIt >= PColorNoteVisualsCache_MaxSubArray) + Logger::Instance->Error(u"[Patches][ColorNoteVisuals_HandleNoteControllerDidInit] Limit reached for l_NoteCircleMeshRenderersMaterialPropertyBlockControllersIt"); + } + } + + l_Cache->materialPropertyBlockControllers [l_MaterialPropertyBlockControllersIt++ ] = nullptr; + l_Cache->noteArrows [l_NoteArrowsIt++ ] = nullptr; + l_Cache->noteArrowGlows [l_NoteArrowGlowsIt++ ] = nullptr; + l_Cache->noteArrowGlowsMaterialPropertyBlockControllers [l_NoteArrowGlowsMaterialPropertyBlockControllersIt++ ] = nullptr; + l_Cache->noteCircleMeshRenderersMaterialPropertyBlockControllers[l_NoteCircleMeshRenderersMaterialPropertyBlockControllersIt++] = nullptr; } //////////////////////////////////////////////////////////////////////////// @@ -317,14 +342,20 @@ namespace QBeatSaberPlus_NoteTweaker::Patches { auto l_IsBurstNote = l_Cache->burstSliderGameNoteController != nullptr; auto l_CircleScale = l_IsBurstNote ? PColorNoteVisuals_BurstCircleScale : (l_CutDirection == NoteCutDirection::Any ? PColorNoteVisuals_CircleScale : PColorNoteVisuals_PrecisionCircleScale); - auto l_DotEnabled = l_CutDirection == NoteCutDirection::Any ? PColorNoteVisuals_CircleEnabled : (PColorNoteVisuals_CircleEnabled && PColorNoteVisuals_CircleForceEnabled); + auto l_DotEnabled = l_CutDirection == NoteCutDirection::Any ? PColorNoteVisuals_CircleEnabled : (PColorNoteVisuals_CircleEnabled && PColorNoteVisuals_CircleForceEnabled); auto l_DotColor = ColorU::WithAlpha(PColorNoteVisuals_OverrideDotColors ? (l_ColorType == ColorType::ColorB ? PColorNoteVisuals_RightCircleColor : PColorNoteVisuals_LeftCircleColor) : l_BaseColor, PColorNoteVisuals_DotAlpha); for (auto l_CurrentRenderer : __Instance->____circleMeshRenderers) { l_CurrentRenderer->set_enabled (l_DotEnabled); l_CurrentRenderer->get_transform()->set_localScale(l_CircleScale); - l_CurrentRenderer->get_material()->set_color (l_DotColor); + } + + for (auto l_Current : l_Cache->noteCircleMeshRenderersMaterialPropertyBlockControllers) + { + if (!l_Current) break; + l_Current->____materialPropertyBlock->SetColor(PColorNoteVisuals_ColorID, l_DotColor); + l_Current->ApplyChanges(); } } diff --git a/src/Patches/PGameNoteController.cpp b/src/Patches/PGameNoteController.cpp index 570e4dd..0f8643d 100644 --- a/src/Patches/PGameNoteController.cpp +++ b/src/Patches/PGameNoteController.cpp @@ -102,11 +102,9 @@ namespace QBeatSaberPlus_NoteTweaker::Patches { GameNoteController_Init, &GameNoteController::Init, void, GameNoteController* __Instance, - NoteData* __a, float __b, Vector3 __c, Vector3 __d, - Vector3 __e, float __f, float __g, float __h, - NoteVisualModifierType __i, float __j, float __k) + NoteData * __a, ByRef __b, NoteVisualModifierType __c , float __d, float __e) { - GameNoteController_Init(__Instance, __a, __b, __c, __d, __e, __f, __g, __h, __i, __j, __k); + GameNoteController_Init(__Instance, __a, __b, __c, __d, __e); if (!PGameNoteController_Enabled && !PGameNoteController_TempEnabled) return; diff --git a/src/Patches/PSliderController.cpp b/src/Patches/PSliderController.cpp index 5b21319..d0ed32a 100644 --- a/src/Patches/PSliderController.cpp +++ b/src/Patches/PSliderController.cpp @@ -36,11 +36,9 @@ namespace QBeatSaberPlus_NoteTweaker::Patches { SliderController_Init, &SliderController::Init, void, SliderController* __Instance, - SliderController::LengthType __a, SliderData* __b, float __c, Vector3 __d, - Vector3 __e, Vector3 __f, Vector3 __g, float __h, - float __i, float __j, float __k) + SliderController_LengthType __a, SliderData* __b, ByRef __c, float __d, float __e) { - SliderController_Init(__Instance, __a, __b, __c, __d, __e, __f, __g, __h, __i, __j, __k); + SliderController_Init(__Instance, __a, __b, __c, __d, __e); if (PSliderController_Enabled) __Instance->____initColor = ColorU::WithAlpha(__Instance->____initColor, PSliderController_Opacity); diff --git a/src/UI/SettingsRightView.cpp b/src/UI/SettingsRightView.cpp index 9dde1ca..c0ff2c2 100644 --- a/src/UI/SettingsRightView.cpp +++ b/src/UI/SettingsRightView.cpp @@ -246,7 +246,7 @@ namespace QBeatSaberPlus_NoteTweaker::UI { { auto& l_Profile = NTConfig::Instance()->GetActiveProfile(); auto l_PlayerData = Resources::FindObjectsOfTypeAll()->First()->get_playerData(); - auto l_ColorScheme = l_PlayerData->get_colorSchemesSettings()->___overrideDefaultColors ? l_PlayerData->get_colorSchemesSettings()->GetSelectedColorScheme() : nullptr; + auto l_ColorScheme = l_PlayerData->get_colorSchemesSettings()->____overrideDefaultColors ? l_PlayerData->get_colorSchemesSettings()->GetSelectedColorScheme() : nullptr; auto l_LeftColor = l_ColorScheme != nullptr ? l_ColorScheme->get_saberAColor() : Color(0.658823549747467f, 0.125490203499794f, 0.125490203499794f, 1.0f); auto l_RightColor = l_ColorScheme != nullptr ? l_ColorScheme->get_saberBColor() : Color(0.125490203499794f, 0.3921568691730499f, 0.658823549747467f, 1.0f); diff --git a/src/main.cpp b/src/main.cpp index 8390815..588b98a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,3 +1,4 @@ +#include "git_info.h" #include "Logger.hpp" #include "NoteTweaker.hpp" @@ -10,7 +11,7 @@ static modloader::ModInfo s_ModInfo{"QBeatSaberPlus-NoteTweaker", VERSION, GIT_COMMIT}; // Called at the early stages of game loading -extern "C" void setup(CModInfo* p_ModInfo) +extern "C" __attribute__((visibility("default"))) void setup(CModInfo* p_ModInfo) { p_ModInfo->id = s_ModInfo.id.c_str(); p_ModInfo->version = s_ModInfo.version.c_str(); @@ -30,7 +31,7 @@ extern "C" void setup(CModInfo* p_ModInfo) //////////////////////////////////////////////////////////////////////////// // Called later on in the game loading - a good time to install function hooks -extern "C" void late_load() +extern "C" __attribute__((visibility("default"))) void late_load() { il2cpp_functions::Init();