Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/actions/canary-ndk/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
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}
15 changes: 14 additions & 1 deletion .github/workflows/build-ndk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,24 @@ 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 "$ANDROID_NDK_LATEST_HOME" > ${GITHUB_WORKSPACE}/ndkpath.txt
echo ${{ steps.setup-ndk.outputs.ndk-path }} > ${GITHUB_WORKSPACE}/ndkpath.txt
cat ${GITHUB_WORKSPACE}/ndkpath.txt

# get version from pushed tag
- name: Extract version
if: startsWith(github.ref, 'refs/tags/v')
id: version
run: |
echo "TAG=${GITHUB_REF#refs/tags/}" >> ${GITHUB_OUTPUT}
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> ${GITHUB_OUTPUT}

- name: Setup qpm
uses: Fernthedev/qpm-action@main
with:
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,24 @@ 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 "$ANDROID_NDK_LATEST_HOME" > ${GITHUB_WORKSPACE}/ndkpath.txt
echo ${{ steps.setup-ndk.outputs.ndk-path }} > ${GITHUB_WORKSPACE}/ndkpath.txt
cat ${GITHUB_WORKSPACE}/ndkpath.txt

# get version from pushed tag
- name: Extract version
if: startsWith(github.ref, 'refs/tags/v')
id: version
run: |
echo "TAG=${GITHUB_REF#refs/tags/}" >> ${GITHUB_OUTPUT}
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> ${GITHUB_OUTPUT}

- name: Get Tag Version
id: get_tag_version
run: |
Expand Down
4 changes: 2 additions & 2 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"env": {
"ndkPath": "D:/User/Repositories/GitHubQuestModding/android-ndk-r24"
"ndkPath": "D:/User/Repositories/GitHubQuestModding/android-ndk-r27-canary"
},
"configurations": [
{
Expand All @@ -13,7 +13,7 @@
],
"includePath": [
"${workspaceFolder}/extern/includes/libil2cpp/il2cpp/libil2cpp",
"${workspaceFolder}/extern/includes/codegen/include",
"${workspaceFolder}/extern/includes/bs-cordl/include",
"${workspaceFolder}/extern/includes/chatplex-sdk-bs/shared",
"${workspaceFolder}/extern/includes",
"${workspaceFolder}/include",
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@
"stop_token": "cpp",
"__std_stream": "cpp",
"memory_resource": "cpp",
"ranges": "cpp"
"ranges": "cpp",
"__verbose_abort": "cpp"
},
"editor.formatOnSave": false,
"editor.trimAutoWhitespace": true,
Expand Down
35 changes: 30 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# include some defines automatically made by qpm
include(qpm_defines.cmake)
include(${EXTERN_DIR}/includes/kaleb/shared/cmake/assets.cmake)

add_definitions(-DCP_SDK_UNITY)
add_definitions(-DPAPER_DISABLE_SOURCE_LOC)
add_definitions(-DCP_SDK_BMBF)

# override mod id
Expand Down Expand Up @@ -32,6 +33,29 @@ set(SHARED_DIR ${CMAKE_CURRENT_SOURCE_DIR}/shared)
# compile options used
add_compile_options(-frtti -fexceptions)
add_compile_options(-O3)

# get git info
execute_process(COMMAND git config user.name OUTPUT_VARIABLE GIT_USER)
execute_process(COMMAND git branch --show-current OUTPUT_VARIABLE GIT_BRANCH)
execute_process(COMMAND git rev-parse --short HEAD OUTPUT_VARIABLE GIT_COMMIT)
execute_process(COMMAND git diff-index --quiet HEAD RESULT_VARIABLE GIT_MODIFIED)

string(STRIP "${GIT_USER}" GIT_USER)
string(STRIP "${GIT_BRANCH}" GIT_BRANCH)
string(STRIP "${GIT_COMMIT}" GIT_COMMIT)
string(STRIP "${GIT_MODIFIED}" GIT_MODIFIED)

message(STATUS "GIT_USER: ${GIT_USER}")
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})

# compile definitions used
add_compile_definitions(VERSION=\"${MOD_VERSION}\")
add_compile_definitions(MOD_ID=\"${MOD_ID}\")
Expand All @@ -56,6 +80,9 @@ add_library(
${c_file_list}
)

# 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})
Expand All @@ -77,6 +104,7 @@ target_include_directories(${COMPILE_ID} PRIVATE ${EXTERN_DIR}/includes/${CODEGE
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})

# add extern stuff like libs and other includes
include(extern.cmake)
Expand Down Expand Up @@ -120,7 +148,4 @@ add_custom_command(TARGET ${COMPILE_ID} POST_BUILD
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()


include(assets_include.cmake)
endforeach()
116 changes: 0 additions & 116 deletions assets_include.cmake

This file was deleted.

13 changes: 11 additions & 2 deletions copy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,18 @@ $modFiles = $modJson.modFiles

foreach ($fileName in $modFiles) {
if ($useDebug -eq $true) {
& adb push build/debug/$fileName /sdcard/Android/data/com.beatgames.beatsaber/files/mods/$fileName
& adb push build/debug/$fileName /sdcard/ModData/com.beatgames.beatsaber/Modloader/mods/$fileName
} else {
& adb push build/$fileName /sdcard/Android/data/com.beatgames.beatsaber/files/mods/$fileName
& adb push build/$fileName /sdcard/ModData/com.beatgames.beatsaber/Modloader/mods/$fileName
}
}

$modFiles = $modJson.lateModFiles
foreach ($fileName in $modFiles) {
if ($useDebug -eq $true) {
& adb push build/debug/$fileName /sdcard/ModData/com.beatgames.beatsaber/Modloader/mods/$fileName
} else {
& adb push build/$fileName /sdcard/ModData/com.beatgames.beatsaber/Modloader/mods/$fileName
}
}

Expand Down
16 changes: 11 additions & 5 deletions createqmod.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,19 @@ foreach ($mod in $modJson.modFiles) {
}
$filelist += $path
}
foreach ($mod in $modJson.lateModFiles) {
$path = "./build/" + $mod
if (-not (Test-Path $path)) {
$path = "./extern/libs/" + $mod
}
if (-not (Test-Path $path)) {
Write-Output "Error: could not find dependency: $path"
exit 1
}
$filelist += $path
}

foreach ($lib in $modJson.libraryFiles) {
#if ($lib -eq "libchatplex-sdk-bs.so") {
# Continue
#}


$path = "./build/" + $lib
if (-not (Test-Path $path)) {
$path = "./extern/libs/" + $lib
Expand Down
Loading