Skip to content

Commit 5ecef03

Browse files
committed
Clock Mod
Adds a clock to the menus of Beat Saber.
1 parent 2435464 commit 5ecef03

19 files changed

+703
-0
lines changed

.gitignore

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Prerequisites
2+
*.d
3+
4+
# Compiled Object files
5+
*.slo
6+
*.lo
7+
*.o
8+
*.obj
9+
10+
# Precompiled Headers
11+
*.gch
12+
*.pch
13+
14+
# Compiled Dynamic libraries
15+
*.so
16+
*.dylib
17+
*.dll
18+
19+
# Fortran module files
20+
*.mod
21+
*.smod
22+
23+
# Compiled Static libraries
24+
*.lai
25+
*.la
26+
*.a
27+
*.lib
28+
29+
# Executables
30+
*.exe
31+
*.out
32+
*.app
33+
34+
# VSCode config stuff
35+
!.vscode/c_cpp_properties.json
36+
!.vscode/tasks.json
37+
38+
# NDK stuff
39+
out/
40+
[Ll]ib/
41+
[Ll]ibs/
42+
[Oo]bj/
43+
[Oo]bjs/
44+
ndkpath.txt
45+
*.zip
46+
*.txt
47+
extern/
48+
Android.mk.backup
49+
qpm.shared.json

.vscode/c_cpp_properties.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"configurations": [
3+
{
4+
"defines": [
5+
"VERSION=\"0.1.0\"",
6+
"__GNUC__",
7+
"__aarch64__"
8+
],
9+
"includePath": [
10+
"${workspaceFolder}/**",
11+
"${workspaceFolder}/shared",
12+
"${workspaceFolder}/include",
13+
"${workspaceFolder}/extern/**",
14+
"${workspaceFolder}/extern/libil2cpp/il2cpp/libil2cpp",
15+
"C:/androidndk/android-ndk-r21d-windows-x86_64/android-ndk-r21d/**"
16+
],
17+
"name": "Quest",
18+
"cStandard": "c11",
19+
"cppStandard": "c++20",
20+
"intelliSenseMode": "clang-x64"
21+
}
22+
],
23+
"version": 4
24+
}

.vscode/settings.json

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
{
2+
"files.associations": {
3+
"iosfwd": "cpp",
4+
"__config": "cpp",
5+
"__nullptr": "cpp",
6+
"thread": "cpp",
7+
"any": "cpp",
8+
"deque": "cpp",
9+
"list": "cpp",
10+
"map": "cpp",
11+
"optional": "cpp",
12+
"queue": "cpp",
13+
"set": "cpp",
14+
"stack": "cpp",
15+
"unordered_map": "cpp",
16+
"unordered_set": "cpp",
17+
"variant": "cpp",
18+
"vector": "cpp",
19+
"__bit_reference": "cpp",
20+
"__debug": "cpp",
21+
"__errc": "cpp",
22+
"__functional_base": "cpp",
23+
"__hash_table": "cpp",
24+
"__locale": "cpp",
25+
"__mutex_base": "cpp",
26+
"__node_handle": "cpp",
27+
"__split_buffer": "cpp",
28+
"__string": "cpp",
29+
"__threading_support": "cpp",
30+
"__tree": "cpp",
31+
"__tuple": "cpp",
32+
"algorithm": "cpp",
33+
"array": "cpp",
34+
"atomic": "cpp",
35+
"bit": "cpp",
36+
"bitset": "cpp",
37+
"cctype": "cpp",
38+
"cfenv": "cpp",
39+
"charconv": "cpp",
40+
"chrono": "cpp",
41+
"cinttypes": "cpp",
42+
"clocale": "cpp",
43+
"cmath": "cpp",
44+
"codecvt": "cpp",
45+
"compare": "cpp",
46+
"complex": "cpp",
47+
"condition_variable": "cpp",
48+
"csetjmp": "cpp",
49+
"csignal": "cpp",
50+
"cstdarg": "cpp",
51+
"cstddef": "cpp",
52+
"cstdint": "cpp",
53+
"cstdio": "cpp",
54+
"cstdlib": "cpp",
55+
"cstring": "cpp",
56+
"ctime": "cpp",
57+
"cwchar": "cpp",
58+
"cwctype": "cpp",
59+
"exception": "cpp",
60+
"coroutine": "cpp",
61+
"propagate_const": "cpp",
62+
"forward_list": "cpp",
63+
"fstream": "cpp",
64+
"functional": "cpp",
65+
"future": "cpp",
66+
"initializer_list": "cpp",
67+
"iomanip": "cpp",
68+
"ios": "cpp",
69+
"iostream": "cpp",
70+
"istream": "cpp",
71+
"iterator": "cpp",
72+
"limits": "cpp",
73+
"locale": "cpp",
74+
"memory": "cpp",
75+
"mutex": "cpp",
76+
"new": "cpp",
77+
"numeric": "cpp",
78+
"ostream": "cpp",
79+
"random": "cpp",
80+
"ratio": "cpp",
81+
"regex": "cpp",
82+
"scoped_allocator": "cpp",
83+
"span": "cpp",
84+
"sstream": "cpp",
85+
"stdexcept": "cpp",
86+
"streambuf": "cpp",
87+
"string": "cpp",
88+
"string_view": "cpp",
89+
"strstream": "cpp",
90+
"system_error": "cpp",
91+
"tuple": "cpp",
92+
"type_traits": "cpp",
93+
"typeindex": "cpp",
94+
"typeinfo": "cpp",
95+
"utility": "cpp",
96+
"valarray": "cpp",
97+
"xstring": "cpp",
98+
"xlocale": "cpp",
99+
"xlocbuf": "cpp",
100+
"concepts": "cpp",
101+
"filesystem": "cpp",
102+
"shared_mutex": "cpp",
103+
"xfacet": "cpp",
104+
"xhash": "cpp",
105+
"xiosbase": "cpp",
106+
"xlocinfo": "cpp",
107+
"xlocmes": "cpp",
108+
"xlocmon": "cpp",
109+
"xlocnum": "cpp",
110+
"xloctime": "cpp",
111+
"xmemory": "cpp",
112+
"xstddef": "cpp",
113+
"xtr1common": "cpp",
114+
"xtree": "cpp",
115+
"xutility": "cpp"
116+
},
117+
"C_Cpp.errorSquiggles": "Enabled"
118+
}

.vscode/tasks.json

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "NDK Build",
6+
"detail": "Builds the library using ndk-build.cmd",
7+
"type": "shell",
8+
"command": "ndk-build",
9+
"windows": {
10+
"command": "ndk-build.cmd"
11+
},
12+
"args": ["NDK_PROJECT_PATH=.", "APP_BUILD_SCRIPT=./Android.mk", "NDK_APPLICATION_MK=./Application.mk"],
13+
"group": "build",
14+
"options": {
15+
"env": {}
16+
}
17+
},
18+
{
19+
"label": "Powershell Build",
20+
"detail": "Builds the library using Powershell (recommended)",
21+
"type": "shell",
22+
"command": "./build.ps1",
23+
"windows": {
24+
"command": "./build.ps1"
25+
},
26+
"group": {
27+
"kind": "build",
28+
"isDefault": true
29+
},
30+
"options": {
31+
"env": {}
32+
}
33+
},
34+
{
35+
"label": "Powershell Build and Copy",
36+
"detail": "Builds and copies the library to the Quest using adb and force-quits Beat Saber",
37+
"type": "shell",
38+
"command": "./copy.ps1",
39+
"windows": {
40+
"command": "./copy.ps1"
41+
},
42+
"group": "build",
43+
"options": {
44+
"env": {}
45+
}
46+
},
47+
{
48+
"label": "BMBF Build",
49+
"detail": "Builds a .zip to be uploaded into BMBF",
50+
"type": "shell",
51+
"command": "./buildBMBF.ps1",
52+
"windows": {
53+
"command": "./buildBMBF.ps1"
54+
},
55+
"args": [],
56+
"group": "build",
57+
"options": {
58+
"env": {}
59+
}
60+
},
61+
{
62+
"label": "Start logging",
63+
"detail": "Records a log to log.txt using adb logcat",
64+
"type": "shell",
65+
"command": "./startlogging.bat"
66+
}
67+
]
68+
}

Android.mk

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Copyright (C) 2009 The Android Open Source Project
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
16+
LOCAL_PATH := $(call my-dir)
17+
TARGET_ARCH_ABI := $(APP_ABI)
18+
19+
rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2))
20+
21+
# Build the modloader shared library
22+
include $(CLEAR_VARS)
23+
# Creating prebuilt for dependency: modloader - version: 1.0.4
24+
include $(CLEAR_VARS)
25+
LOCAL_MODULE := modloader
26+
LOCAL_EXPORT_C_INCLUDES := extern/modloader
27+
LOCAL_SRC_FILES := extern/libmodloader.so
28+
include $(PREBUILT_SHARED_LIBRARY)
29+
# Creating prebuilt for dependency: beatsaber-hook - version: 0.8.4
30+
include $(CLEAR_VARS)
31+
LOCAL_MODULE := beatsaber-hook_0_8_4
32+
LOCAL_EXPORT_C_INCLUDES := extern/beatsaber-hook
33+
LOCAL_SRC_FILES := extern/libbeatsaber-hook_0_8_4.so
34+
LOCAL_CPP_FEATURES += exceptions
35+
include $(PREBUILT_SHARED_LIBRARY)
36+
# Creating prebuilt for dependency: codegen - version: 0.4.0
37+
include $(CLEAR_VARS)
38+
LOCAL_MODULE := codegen_0_4_0
39+
LOCAL_EXPORT_C_INCLUDES := extern/codegen
40+
LOCAL_SRC_FILES := extern/libcodegen_0_4_0.so
41+
include $(PREBUILT_SHARED_LIBRARY)
42+
# Creating prebuilt for dependency: questui - version: 0.2.8
43+
include $(CLEAR_VARS)
44+
LOCAL_MODULE := questui
45+
LOCAL_EXPORT_C_INCLUDES := extern/questui
46+
LOCAL_SRC_FILES := extern/libquestui.so
47+
include $(PREBUILT_SHARED_LIBRARY)
48+
# Creating prebuilt for dependency: custom-types - version: 0.2.14
49+
include $(CLEAR_VARS)
50+
LOCAL_MODULE := custom-types
51+
LOCAL_EXPORT_C_INCLUDES := extern/custom-types
52+
LOCAL_SRC_FILES := extern/libcustom-types.so
53+
include $(PREBUILT_SHARED_LIBRARY)
54+
55+
include $(CLEAR_VARS)
56+
LOCAL_MODULE := clockmod
57+
LOCAL_SRC_FILES += $(call rwildcard,src/,*.cpp)
58+
LOCAL_SRC_FILES += $(call rwildcard,extern/beatsaber-hook/src/inline-hook,*.cpp)
59+
LOCAL_SRC_FILES += $(call rwildcard,extern/beatsaber-hook/src/inline-hook,*.c)
60+
LOCAL_SHARED_LIBRARIES += modloader
61+
LOCAL_SHARED_LIBRARIES += beatsaber-hook_0_8_4
62+
LOCAL_SHARED_LIBRARIES += codegen_0_4_0
63+
LOCAL_SHARED_LIBRARIES += questui
64+
LOCAL_SHARED_LIBRARIES += custom-types
65+
LOCAL_LDLIBS += -llog
66+
LOCAL_CFLAGS += -I'extern/libil2cpp/il2cpp/libil2cpp' -DID='"clockmod"' -DVERSION='"0.1.0"' -I'./shared' -I'./extern' -isystem'extern/codegen/include'
67+
LOCAL_CPPFLAGS += -std=c++2a
68+
LOCAL_C_INCLUDES += ./include ./src
69+
include $(BUILD_SHARED_LIBRARY)

Application.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
APP_ABI := arm64-v8a
2+
APP_PLATFORM := 25
3+
APP_PIE:= true
4+
APP_STL := c++_static
5+
APP_CPPFLAGS := -std=gnu++2a

bmbfmod.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"id": "clockmod",
3+
"name": "Clock Mod",
4+
"version": "0.1.0",
5+
"author": "BoopetyDoopety",
6+
"description": [
7+
"Displays the time in game. \n\nDoes not currently work with Hitscore Visualiser"
8+
],
9+
"category": "Gameplay",
10+
"gameVersion": "1.13.0",
11+
"platform": "Quest",
12+
"components": [
13+
{
14+
"type": "HookMod",
15+
"installAction": {
16+
"installLibraryFile": "libclockmod.so"
17+
},
18+
"uninstallAction": {
19+
"removeLibraryFile": "libclockmod.so"
20+
}
21+
},
22+
{
23+
"type": "HookModLibrary",
24+
"installAction": {
25+
"installLibraryFile": "libbeatsaber-hook_0_8_4.so"
26+
}
27+
}
28+
]
29+
}

build.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
$NDKPath = Get-Content $PSScriptRoot/ndkpath.txt
2+
3+
$buildScript = "$NDKPath/build/ndk-build"
4+
if (-not ($PSVersionTable.PSEdition -eq "Core")) {
5+
$buildScript += ".cmd"
6+
}
7+
8+
& $buildScript NDK_PROJECT_PATH=$PSScriptRoot APP_BUILD_SCRIPT=$PSScriptRoot/Android.mk NDK_APPLICATION_MK=$PSScriptRoot/Application.mk

buildBMBF.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Builds a .zip file for loading with BMBF
2+
& $PSScriptRoot/build.ps1
3+
4+
if ($?) {
5+
Compress-Archive -Path "./libs/arm64-v8a/libclockmod.so", "./libs/arm64-v8a/libbeatsaber-hook_0_8_4.so", "./bmbfmod.json" -DestinationPath "./clockmod_v0.1.0.zip" -Update
6+
}

copy.ps1

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
& $PSScriptRoot/build.ps1
2+
if ($?) {
3+
adb push libs/arm64-v8a/libclockmod.so /sdcard/Android/data/com.beatgames.beatsaber/files/mods/libclockmod.so
4+
if ($?) {
5+
adb shell am force-stop com.beatgames.beatsaber
6+
adb shell am start com.beatgames.beatsaber/com.unity3d.player.UnityPlayerActivity
7+
if ($args[0] -eq "--log") {
8+
$timestamp = Get-Date -Format "MM-dd HH:mm:ss.fff"
9+
adb logcat -T "$timestamp" main-modloader:W QuestHook[clockmod`|v0.1.0]:* AndroidRuntime:E *:S
10+
}
11+
}
12+
}

0 commit comments

Comments
 (0)