You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: wiki/modding/quest-mod-dev-intro.md
+52-48Lines changed: 52 additions & 48 deletions
Original file line number
Diff line number
Diff line change
@@ -51,8 +51,8 @@ and add it to your PATH variable.
51
51
52
52
### Android NDK
53
53
54
-
[Download the Android NDK](https://developer.android.com/ndk), unzip it, and add it to a new environment variable called
55
-
ANDROID_NDK_HOME.
54
+
[Download the Android NDK](https://github.com/QuestPackageManager/ndk-canary-archive/releases/tag/27.0.1), unzip it, and
55
+
add it to a new environment variable called ANDROID_NDK_HOME.
56
56
57
57
## Create a Project
58
58
@@ -69,26 +69,26 @@ Templatr will then ask a series of questions to create a mod project.
69
69
70
70
### Add and Update Dependencies
71
71
72
-
Once the project has been generated, you should now update the following two dependencies, [beatsaber-hook](https://github.com/sc2ad/beatsaber-hook)
73
-
and [codegen](https://github.com/sc2ad/BeatSaber-Quest-Codegen), to the version best suited for the game version you are
72
+
Once the project has been generated, you should now update the following two dependencies, [beatsaber-hook](https://github.com/QuestPackageManager/beatsaber-hook/)
73
+
and [bs-cordl](https://github.com/QuestPackageManager/bs-cordl), to the version best suited for the game version you are
74
74
developing for.
75
75
76
-
`beatsaber-hook` is a library that allows for modding il2cpp games. `codegen` is a library that allows modders to
76
+
`beatsaber-hook` is a library that allows for modding il2cpp games. `bs-cordl` is a library that allows modders to
77
77
interface with the game's code.
78
78
79
79
To update these, open a Powershell terminal in the project directory then run the following commands to add the latest versions:
80
80
81
81
```powershell
82
82
qpm dependency add beatsaber-hook
83
-
qpm dependency add codegen
83
+
qpm dependency add bs-cordl
84
84
```
85
85
86
86
If the latest versions do match those for the version you are developing for, add `-v ^x.x.x` after the command with the
87
-
correct version instead of running those commands. For example, for Beat Saber version 1.28.0, the correct codegen
88
-
version is 0.33.0:
87
+
correct version instead of running those commands. For example, for Beat Saber version 1.35.0, the correct codegen
88
+
version is 3500.0.0:
89
89
90
90
```powershell
91
-
qpm dependency add codegen -v ^0.33.0
91
+
qpm dependency add bs-cordl -v ^3500.0.0
92
92
```
93
93
94
94
### Restore Dependencies
@@ -108,33 +108,29 @@ Your project should contain the following structure:
108
108
109
109
```properties
110
110
// Files in .gitignore have been excluded
111
+
cmake/
112
+
└── ... project cmake files
111
113
extern/
112
114
└── ... dependencies should be here
113
115
include/
114
116
└── main.hpp
117
+
scripts/
118
+
└── ... utility scripts
115
119
shared
116
120
src/
117
121
└── main.cpp
118
122
.gitignore
119
-
build.ps1
120
-
copy.ps1
121
123
CMakeLists.txt
122
-
createqmod.ps1
123
124
mod.template.json
124
-
ndk-stack.ps1
125
-
pull-tombstone.ps1
126
125
qpm.json
127
126
README.md
128
-
start-logging.ps1
129
-
restart-game.ps1
130
-
validate-modjson.ps1
131
127
```
132
128
133
129
### Code Breakdown
134
130
135
131
#### src/main.cpp
136
132
137
-
`main.cpp` contains the `setup()` and `load()` methods. These methods can exist in any source file as long as they are
133
+
`main.cpp` contains the `setup()` and `late_load()` methods. These methods can exist in any source file as long as they are
138
134
accessible by the modloader. Take a look inside of `main.cpp` for more information as Laurie has thankfully commented
139
135
most of the code.
140
136
@@ -152,49 +148,50 @@ The extern folder should be ignored (and/or in some cases excluded). It contains
152
148
### Script Breakdown
153
149
154
150
It is recommended to run these scripts using Powershell Core (v7) - however, it is not required. All scripts can be run
155
-
with the `--help` argument for a description of arguments and functionality.
151
+
with the `--help` argument for a description of arguments and functionality. Scripts can be manually invoked from the
152
+
`scripts` folder or via qpm scripts inside `qpm.json`
156
153
157
154
#### build.ps1
158
155
159
-
Usage: `build.ps1`
156
+
Usage: `qpm s build`
160
157
161
158
Builds your mod. Does not produce a QMOD file.
162
159
163
160
#### copy.ps1
164
161
165
-
Usage: `copy.ps1`
162
+
Usage: `qpm s copy`
166
163
167
164
Builds your mod, then copies it to your quest and launches Beat Saber if your quest is connected with ADB.
Generates a QMOD file that can be parsed by BMBF and or QuestPatcher. Will use the most recently built version of your mod.
174
171
175
172
#### pull-tombstone.ps1
176
173
177
-
Usage: `pull-tombstone.ps1`
174
+
Usage: `qpm s tomb`
178
175
179
176
Finds the most recently modified Beat Saber crash tombstone and copies it to your device. If the build on your quest matches
180
177
what you have most recently built locally, the `-analyze` argument can be provided to generate the source file locations
181
178
of any lines mentioned in the backtrace.
182
179
183
180
#### restart-game.ps1
184
181
185
-
Usage: `restart-game.ps1`
182
+
Usage: `qpm s restart`
186
183
187
184
Closes and reopens Beat Saber on your quest if it is connected. Mostly used inside of `copy.ps1`. Does not have help text.
188
185
189
186
#### start-logging.ps1
190
187
191
-
Usage: `start-logging.ps1 -Self`
188
+
Usage: `qpm s logcat`
192
189
193
190
Prints logs from Beat Saber, just your mod, or also crashes. Usage of `-self` is recommended.
194
191
195
192
#### validate-modjson.ps1
196
193
197
-
Usage: `validate-modjson.ps1`
194
+
Usage: `qpm s validate`
198
195
199
196
Generates a `mod.json` from `mod.template.json` if not present and verifies it against the QMOD schema. Mostly used
200
197
inside of `createqmod.ps1`. Does not have help text.
@@ -211,28 +208,31 @@ like constructors.
211
208
212
209
To view a list of methods and classes you can hook, the most convenient option is to use a C# decompiler such as [IlSpy](https://github.com/icsharpcode/ILSpy)
213
210
if you own the game on PC, as it provides not only the classes and member names, but also the full contents of most methods.
214
-
If you only own the game on the Quest, then you can still view all the classes and methods on [Phaze's hook viewer](https://modtools.phazed.xyz/browser)
215
-
or in the `includes/codegen`directory in your `extern` folder.
211
+
If you only own the game on the Quest, then you can still view all the classes and methods in the `includes/codegen`
212
+
directory in your `extern` folder.
216
213
217
-
In this example, we will hook onto the initialization of the main menu and change the text on the solo button to
214
+
In this example, we will hook onto the initialization of the level screen and change the text on the play button to
218
215
something funny.
219
216
220
-
The main menu runs the event `DidActivate` when it is fully initialized. This is useful for us because we can hook
217
+
The level screen runs the event `DidActivate` when it is fully initialized. This is useful for us because we can hook
221
218
this event and add our own functionality.
222
219
223
220
Firstly, create your hook using the `MAKE_HOOK_MATCH` macro:
224
221
222
+
<!-- markdownlint-disable MD013 -->
223
+
225
224
```cpp
226
-
// You can think of these as C# - using MainMenuViewController, using HMUI.CurvedTextMeshPro, etc.
225
+
// You can think of these as C# - using HMUI, UnityEngine, etc, but with individual classes
227
226
// Classes without a namespace are assigned to the GlobalNamespace
228
227
// If you use a class and do not include it, you may get unclear compiler errors, so make sure to include what you use
Copy file name to clipboardExpand all lines: wiki/modding/quest-mod-dev-ui.md
+17-17Lines changed: 17 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -10,46 +10,46 @@ description: Learn how to create a UI for your Quest Mod!
10
10
This is a stub page, content is a work in progress! Ask in `#quest-mod-dev` if you want more info!
11
11
:::
12
12
13
-
UI is used by many mods to show configuration options. In this section, we'll show you how to use `questui` to create a
14
-
settings screen for your mod.
13
+
UI is used by many mods to show configuration options. In this section, we'll show you how to use `bsml` to create a
14
+
settings screen for your mod using code. `bsml` also supports creating UI with xml which can be found on the [BSML docs](https://redbrumbler.github.io/Quest-BSML-Docs/).
15
15
16
16
## Prerequisites
17
17
18
-
- Install `questui` by running `qpm dependency add questui` in your project directory.
18
+
- Install `bsml` by running `qpm dependency add bsml` in your project directory.
19
19
- You also need to install `custom-types` even if you don't use it in your mod: `qpm dependency add custom-types`
20
20
21
21
Make sure to restore after adding the dependencies.
22
22
23
23
## Creating a `DidActivate` method
24
24
25
-
`DidActivate` is a method you can register with `questui` that allows you to make a simple mod settings page.
25
+
`DidActivate` is a method you can register with `bsml` that allows you to make a simple mod settings page.
26
26
27
27
Take a look at this example:
28
28
29
29
- You should only create your components on first activation to prevent duplication.
30
30
- You can utilize containers (such as Scrollable, HorizontalLayout and VerticalLayout) to manipulate the locations of components.
0 commit comments