Skip to content
Open
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
76 changes: 76 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: NDK build

env:
module_id: fingersaber
qmodName: FingerSaber
cache-name: FS_cache

on:
workflow_dispatch:
push:
branches: [ main, dev ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
name: Checkout
with:
submodules: true
lfs: true

- uses: seanmiddleditch/gha-setup-ninja@v5



- name: Get QPM
uses: Fernthedev/qpm-action@v1
with:
resolve_ndk: true
#required
workflow_token: ${{secrets.GITHUB_TOKEN}}
restore: true # will run restore on download
cache: true #will cache dependencies

- name: Build
run: |
cd ${GITHUB_WORKSPACE}
pwsh -Command ./scripts/build.ps1
qpm qmod build

- name: Create Qmod
run: |
pwsh -Command ./scripts/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 non-debug artifact
uses: actions/upload-artifact@v4
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@v4
with:
name: ${{env.qmodName}}.qmod
path: ./${{ env.qmodName }}.qmod
if-no-files-found: error

- name: Upload debug artifact
uses: actions/upload-artifact@v4
with:
name: debug_${{ steps.libname.outputs.NAME }}
path: ./build/debug/${{ steps.libname.outputs.NAME }}
if-no-files-found: error
95 changes: 95 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Publish release artifacts

env:
module_id: fingersaber
qmodName: FingerSaber
cache-name: FS_release_cache

on:
push:
tags:
- "v*.*.*"

permissions:
contents: write

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Get Mod version from tag name
id: modversion
run: |
echo "VERSION_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
TEMP=$(echo "$GITHUB_REF_NAME" | grep -Po "(?<=v)\d+.\d+.\d+")
echo "VERSION=$TEMP" >> $GITHUB_ENV

- uses: actions/checkout@v4
name: Checkout
with:
submodules: true
lfs: true

- uses: seanmiddleditch/gha-setup-ninja@v5

- name: Get QPM
uses: Fernthedev/qpm-action@v1
with:
resolve_ndk: true
#required
workflow_token: ${{secrets.GITHUB_TOKEN}}
restore: true # will run restore on download
cache: true #will cache dependencies

- name: QPM Edit Version
run: |
qpm package edit --version "${{ env.VERSION }}"

- name: Build
run: |
cd ${GITHUB_WORKSPACE}
pwsh -Command ./scripts/build.ps1
qpm qmod build

- name: Create Qmod
run: |
pwsh -Command ./scripts/createqmod.ps1 ${{env.qmodName}}

- name: Get Library Name and Build ID
id: libname
run: |
cd ./build/
pattern="lib${module_id}*.so"
files=( $pattern )
echo "LIBNAME=${files[0]}" >> $GITHUB_ENV
echo "BUILD_ID=$(readelf -n ${files[0]} | grep -Po "(?<=Build ID: )[0-9a-f]+")" >> $GITHUB_ENV

- name: Rename debug file
run: mv "./build/debug/${{ env.LIBNAME }}" "./build/debug/debug_${{ env.LIBNAME }}"

- name: Calculate SHA-256 of the qmod file
id: qmodsha
run: |
echo "QMOD_SHA=$(sha256sum ./${{ env.qmodName }}.qmod | grep -Po "^[0-9a-f]+")" >> $GITHUB_ENV

- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
tag_name: ${{ env.VERSION_TAG }}
name: FingerSaber ${{ env.VERSION }}
generate_release_notes: true
body: |
---

### Build info

SHA-256: ${{ env.QMOD_SHA }}
Build ID: ${{ env.BUILD_ID }}
files: |
./${{ env.qmodName }}.qmod
./build/${{ env.LIBNAME }}
./build/debug/debug_${{ env.LIBNAME }}
draft: true
prerelease: false
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,5 @@ extern.cmake
mod.json.schema

# Ndk path
ndkpath.txt
ndkpath.txt
.cache
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,17 @@ add_compile_definitions(VERSION_LONG=0)
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
${cpp_file_list}
${c_file_list}
${inline_hook_c}
${inline_hook_cpp}
)

target_include_directories(${COMPILE_ID} PRIVATE .)
Expand Down
5 changes: 2 additions & 3 deletions include/ModConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

#include "config-utils/shared/config-utils.hpp"

DECLARE_CONFIG(ModConfig,

DECLARE_CONFIG(ModConfig) {
CONFIG_VALUE(PlatformHeightOffsetMeters, float, "platformHeightOffsetMeters", -0.34);
CONFIG_VALUE(PlatformDistanceOffsetMeters, float, "platformDistanceOffsetMeters", -0.25);

Expand All @@ -16,4 +15,4 @@ DECLARE_CONFIG(ModConfig,
CONFIG_VALUE(SmoothedMenuHands, bool, "SmoothedMenuHands", true);
CONFIG_VALUE(LeftHandTargetIdx, int, "LeftHandTargetIdx", 1);
CONFIG_VALUE(RightHandTargetIdx, int, "RightHandTargetIdx", 1);
)
};
4 changes: 2 additions & 2 deletions include/ModGameplaySetupMenu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
#include "custom-types/shared/macros.hpp"
#include "bsml/shared/BSML/Components/Settings/ToggleSetting.hpp"

DECLARE_CLASS_CODEGEN(FingerSaberSettings, ModGameplaySetupMenu, UnityEngine::MonoBehaviour,
DECLARE_CLASS_CODEGEN(FingerSaberSettings, ModGameplaySetupMenu, UnityEngine::MonoBehaviour) {
DECLARE_INSTANCE_FIELD(UnityW<BSML::ToggleSetting>, modEnabledToggle);
DECLARE_INSTANCE_FIELD(UnityW<BSML::ToggleSetting>, handsOnlyToggle);
DECLARE_INSTANCE_FIELD(UnityW<BSML::ToggleSetting>, handRenderingToggle);

DECLARE_INSTANCE_METHOD(void, DidActivate, bool firstActivation);
)
};
4 changes: 2 additions & 2 deletions include/ModSettingsViewController.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

#include "custom-types/shared/macros.hpp"

DECLARE_CLASS_CODEGEN(FingerSaberSettings, ModSettingsViewController, HMUI::ViewController,
DECLARE_CLASS_CODEGEN(FingerSaberSettings, ModSettingsViewController, HMUI::ViewController) {
DECLARE_INSTANCE_FIELD(UnityW<BSML::ToggleSetting>, modEnabledToggle);
DECLARE_INSTANCE_FIELD(UnityW<BSML::ToggleSetting>, handsOnlyToggle);
DECLARE_INSTANCE_FIELD(UnityW<BSML::ToggleSetting>, handRenderingToggle);

DECLARE_OVERRIDE_METHOD(void, DidActivate, il2cpp_utils::FindMethodUnsafe("HMUI", "ViewController", "DidActivate", 3), bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling);
DECLARE_OVERRIDE_METHOD(void, DidDeactivate, il2cpp_utils::FindMethodUnsafe("HMUI", "ViewController", "DidDeactivate", 2), bool removedFromHierarchy, bool screenSystemDisabling);
)
};
2 changes: 1 addition & 1 deletion include/logging.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include "beatsaber-hook/shared/utils/utils.h"
#include "paper/shared/logger.hpp"
#include "paper2_scotland2/shared/logger.hpp"

static constexpr auto Logger = Paper::ConstLoggerContext(MOD_ID);

Expand Down
2 changes: 1 addition & 1 deletion mod.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"author": "Henri",
"version": "0.2.1",
"packageId": "com.beatgames.beatsaber",
"packageVersion": "1.37.0_9064817954",
"packageVersion": "1.40.6_6407",
"description": "Beat Saber At Your Finger Tips. Discord @drumtool",
"coverImage": "cover.jpg",
"dependencies": [],
Expand Down
26 changes: 13 additions & 13 deletions qpm.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://raw.githubusercontent.com/QuestPackageManager/QPM.Package/refs/heads/main/qpm.schema.json",
"version": "0.1.0",
"sharedDir": "shared",
"dependenciesDir": "extern",
Expand Down Expand Up @@ -37,54 +38,53 @@
"pwsh ./scripts/pull-tombstone.ps1"
]
},
"ndk": "^27.2.12479018",
"qmodIncludeDirs": [],
"qmodIncludeFiles": [],
"qmodOutput": null
},
"dependencies": [
{
"id": "beatsaber-hook",
"versionRange": "^5.1.9",
"versionRange": "^6.4.2",
"additionalData": {}
},
{
"id": "scotland2",
"versionRange": "^0.1.3",
"versionRange": "^0.1.6",
"additionalData": {
"includeQmod": false,
"private": true
}
},
{
"id": "bsml",
"versionRange": "^0.4.43",
"versionRange": "^0.4.53",
"additionalData": {}
},
{
"id": "bs-cordl",
"versionRange": "^3700.0.0",
"versionRange": "4006.*",
"additionalData": {}
},
{
"id": "config-utils",
"versionRange": "^1.4.0",
"versionRange": "^2.0.3",
"additionalData": {}
},
{
"id": "custom-types",
"versionRange": "^0.17.6",
"versionRange": "^0.18.3",
"additionalData": {}
},
{
"id": "paper",
"versionRange": "^3.6.3",
"additionalData": {
"private": true
}
"id": "paper2_scotland2",
"versionRange": "^4.6.4",
"additionalData": {}
},
{
"id": "bs-utils",
"versionRange": "^0.8.4",
"id": "metacore",
"versionRange": "^1.0.0",
"additionalData": {}
}
]
Expand Down
Loading
Loading