Skip to content

Commit 201d5c7

Browse files
Merge pull request #4 from EnderdracheLP/dev
Adding Toggle for Battery Percentage and Option to set Font Size, Tweaked Clock Position, changed MultiplayerLobby clock position
2 parents 10df1f8 + 9f2f6e0 commit 201d5c7

File tree

12 files changed

+163
-39
lines changed

12 files changed

+163
-39
lines changed

.github/workflows/buildMod.yml

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ name: NDK build
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [ main, dev ]
66
pull_request:
7-
branches: [ main ]
7+
branches: [ main, dev ]
88

99
jobs:
1010
build:
11+
env:
12+
module_id: clockmod
1113
runs-on: ubuntu-latest
1214

1315
steps:
@@ -18,15 +20,32 @@ jobs:
1820
lfs: true
1921
- name: Install Powershell
2022
run: sudo apt-get install -y powershell
21-
22-
- name: Setup NDK
23-
id: setup-ndk
24-
uses: nttld/[email protected]
23+
24+
- name: Cache Android NDK
25+
id: cache-ndk
26+
uses: actions/cache@v2
27+
env:
28+
cache-name: cache-ndk
29+
ndkname: android-ndk-r21
2530
with:
26-
ndk-version: r21
31+
path: ndk
32+
key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.ndkname }}
33+
restore-keys: |
34+
${{ runner.os }}-${{ env.cache-name }}-${{ env.ndkname }}
35+
36+
- name: Install Android NDK
37+
if: steps.cache-ndk.outputs.cache-hit != 'true'
38+
env:
39+
ndkname: android-ndk-r21
40+
run: |
41+
wget -q -O ndk.zip https://dl.google.com/android/repository/${ndkname}-linux-x86_64.zip
42+
unzip -q ndk.zip
43+
mv ${ndkname} ndk
2744
2845
- name: Create ndkpath.txt
29-
run: echo ${{ steps.setup-ndk.outputs.ndk-path }} > ${GITHUB_WORKSPACE}/ndkpath.txt
46+
run: |
47+
cd ndk
48+
pwd > ${GITHUB_WORKSPACE}/ndkpath.txt
3049
3150
# - name: Cache QPM
3251
# id: cache-qpm
@@ -76,7 +95,7 @@ jobs:
7695
id: libname
7796
run: |
7897
cd ./libs/arm64-v8a/
79-
pattern="libclockmod.so"
98+
pattern="lib${module_id}*.so"
8099
files=( $pattern )
81100
echo ::set-output name=NAME::"${files[0]}"
82101
- name: Upload non-debug artifact

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
!.vscode/c_cpp_properties.json
3636
!.vscode/tasks.json
3737

38+
# Visual Stuido Stuff
39+
.vs/
40+
3841
# NDK stuff
3942
out/
4043
[Ll]ib/

Android.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ LOCAL_MODULE := codegen_0_6_2
3535
LOCAL_EXPORT_C_INCLUDES := extern/codegen
3636
LOCAL_SRC_FILES := extern/libcodegen_0_6_2.so
3737
include $(PREBUILT_SHARED_LIBRARY)
38-
# Creating prebuilt for dependency: questui - version: 0.4.3
38+
# Creating prebuilt for dependency: questui - version: 0.4.4
3939
include $(CLEAR_VARS)
4040
LOCAL_MODULE := questui
4141
LOCAL_EXPORT_C_INCLUDES := extern/questui
@@ -65,7 +65,7 @@ LOCAL_SHARED_LIBRARIES += codegen_0_6_2
6565
LOCAL_SHARED_LIBRARIES += questui
6666
LOCAL_SHARED_LIBRARIES += custom-types
6767
LOCAL_LDLIBS += -llog
68-
LOCAL_CFLAGS += -I'extern/libil2cpp/il2cpp/libil2cpp' -DID='"clockmod"' -DVERSION='"0.1.2"' -I'./shared' -I'./extern' -isystem'extern/codegen/include'
68+
LOCAL_CFLAGS += -I'extern/libil2cpp/il2cpp/libil2cpp' -DID='"clockmod"' -DVERSION='"0.1.3"' -I'./shared' -I'./extern' -isystem'extern/codegen/include'
6969
LOCAL_CPPFLAGS += -std=c++2a
7070
LOCAL_C_INCLUDES += ./include ./src
7171
include $(BUILD_SHARED_LIBRARY)

Cover.png

148 KB
Loading

bmbfmod.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"id": "clockmod",
33
"name": "Clock Mod",
4-
"version": "0.1.2",
4+
"version": "0.1.3",
55
"author": "BoopetyDoopety, EnderdracheLP",
66
"description": [
77
"Displays the time in game."
88
],
99
"coverImageFilename": "Cover.png",
1010
"icon": "Cover.png",
11-
"category": "Gameplay",
11+
"category": "Other",
1212
"gameVersion": "1.13.2",
1313
"platform": "Quest",
1414
"components": [

buildBMBF.ps1

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
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_1_0_12.so", "./bmbfmod.json","./Cover.png" -DestinationPath "./Clockmod.zip" -Update
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_1_0_12.so", "./bmbfmod.json","./Cover.png" -DestinationPath "./Clockmod.zip" -Update
6+
}
7+
echo "Task Completed"

buildBMBFDebug.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Builds a .zip file for loading with BMBF
2+
& $PSScriptRoot/build.ps1
3+
4+
if ($?) {
5+
Compress-Archive -Path "./obj/local/arm64-v8a/libclockmod.so", "./obj/local/arm64-v8a/libbeatsaber-hook_1_0_12.so", "./bmbfmod.json","./Cover.png" -DestinationPath "./ClockmodDebug.zip" -Update
6+
}
7+
echo "Task Completed"

include/main.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111

1212
// Define these functions here so that we can easily read configuration and log information from other files
1313
Configuration& getConfig();
14-
const Logger& getLogger();
14+
Logger& logger();

qpm.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"info": {
55
"name": "CLock Mod",
66
"id": "clockmod",
7-
"version": "0.1.2",
7+
"version": "0.1.3",
88
"url": null,
99
"additionalData": {}
1010
},

src/ClockUpdater.cpp

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "UnityEngine/GameObject.hpp"
66
#include "TMPro/TextMeshProUGUI.hpp"
77
#include <ctime>
8+
#include "GlobalNamespace/OVRPlugin_OVRP_1_1_0.hpp"
89
using namespace UnityEngine;
910
using namespace TMPro;
1011

@@ -29,14 +30,35 @@ void ClockMod::ClockUpdater::Update() {
2930
strftime(timestr, 20, "%H:%M", timeinfo);
3031
}
3132
}
32-
else { // If set to show 12 Hour Format
33+
else { // If set to show 24 Hour Format
3334
if (getConfig().config["SecToggle"].GetBool() == true) { //Check if seconds should be shown
3435
strftime(timestr, 20, "%l:%M:%S %p", timeinfo);
3536
}
3637
else {
3738
strftime(timestr, 20, "%l:%M %p", timeinfo);
3839
};
3940
}
41+
// Sets the fontsize
42+
float fontsize = getConfig().config["FontSize"].GetFloat();
4043
auto text = get_gameObject()->GetComponent<TextMeshProUGUI*>();
41-
text->set_text(il2cpp_utils::createcsstr(timestr));
42-
}
44+
text->set_fontSize(fontsize);
45+
// Sets position
46+
// text->get_transform()->set_position(UnityEngine::Vector3(0, 1, 2.6));
47+
// Get current Battery Level
48+
if (getConfig().config["BattToggle"].GetBool() == true) {
49+
float batterylvl = GlobalNamespace::OVRPlugin::OVRP_1_1_0::ovrp_GetSystemBatteryLevel();
50+
batterylvl = batterylvl * 100;
51+
std::string tandb = timestr;
52+
tandb += " - ";
53+
std::string batterylevel = std::to_string(batterylvl);
54+
batterylevel.erase(batterylevel.find_last_not_of('0') + 1, std::string::npos);
55+
batterylevel.erase(batterylevel.find_last_not_of('.') + 1, std::string::npos);
56+
tandb += batterylevel;
57+
tandb += "%";
58+
59+
text->set_text(il2cpp_utils::createcsstr(tandb));
60+
}
61+
else {
62+
text->set_text(il2cpp_utils::createcsstr(timestr));
63+
}
64+
}

0 commit comments

Comments
 (0)