Skip to content

Add DevTools image for Chapter 2.5 of handbook #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
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
Binary file added assets/handbook/vol2/DevToolsLayerInfo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion handbook/vol2/chap2_5.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ Let's say we're looking for whatever function it is that shows this popup: level

![Level statistics popup for Zenith by HJfod](/assets/handbook/vol2/LevelStats.png)

As a start, thanks to DevTools, we know this layer's name is `LevelInfoLayer` (todo: add picture), so we're looking for some callback in it.
![The name of the current layer shown in DevTools](/assets/handbook/vol2/DevToolsLayerInfo.png)

As a start, thanks to DevTools, we know this layer's name is `LevelInfoLayer`, so we're looking for some callback in it.

Now, we know that the button that shows this has an info button sprite, whose sprite name is `GJ_infoIcon_001.png` (thanks, Geode VS Code extension).

Expand Down
195 changes: 94 additions & 101 deletions misc/ios.md
Original file line number Diff line number Diff line change
@@ -1,102 +1,95 @@
---
title: iOS Development Setup
---

# iOS Development Setup

Something something preamble

You will have to edit your `CMakeLists.txt` on your exiting mods. Newer created mods will already have this change
```cmake
# At the beginning of your CMakeLists.txt, change this:
# set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
# into:
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "iOS" OR IOS)
set(CMAKE_OSX_ARCHITECTURES "arm64")
else()
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
endif()
```

## Build

To build mods for iOS, you must have Mac OS with the iPhone SDK installed from Xcode.

You must also get the Geode binaries for iOS, you can do this using the CLI:
```bash
geode sdk update nightly
geode sdk install-binaries --platform ios
```

Nightly is required, as iOS is currently not on the stable release for Geode.

Now you can build your mod for iOS via:
```bash
geode build -p ios
```
Or if you want to build manually:
```bash
cmake -B build -DCMAKE_SYSTEM_NAME=iOS -DGEODE_TARGET_PLATFORM=iOS -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build
```

## Github Actions
To build your mod for iOS using `geode-sdk/build-geode-mod`, you have to add iOS to the build matrix, like so:
```yml
- name: iOS
os: macos-latest
target: iOS
```

As of writing this, iOS support is only available on nightly Geode, so make sure to add this to the options of the `build-geode-mod` step
```yml
sdk: nightly
```

## Web Server

If your iOS device is not jailbroken, it is generally recommended to follow this section to enable the web server.

> :warning: The web server for the TrollStore version of the launcher will not work properly. It is recommended to use `scp` to upload your mods instead.

The web server is a feature bundled into the **Geode Launcher** that allows you to easily upload mods without needing to use iTunes. This eliminates the need to manually drag your geode mod into the mods directory, making the mod testing process more simpler.

To activate the web server:
1. Open the launcher and navigate to settings
2. Scroll down until you reach the **About** section
3. Hold on the **iOS Launcher** text for at least 3 seconds until a popup appears prompting you to enable **Developer Mode**
4. Tap **Yes**, then scroll all the way down to find **Web Server**
5. Enable the setting and restart the launcher
![Image showing the steps above but a visualization of it](/assets/Misc_iOS_webserver-steps.png)

### Using the Web Server

After restarting the launcher, navigate to `http://[Your Device IP]:8080` in your browser on your computer, replacing `[Your Device IP]` with the local IP address of your iOS device.

Now you should see a web interface for the launcher in your browser!
![Image showcasing the web interface on browser](/assets/Misc_iOS_webserver-ui1.png)

Through this web interface, you can:
- Upload your mods
- Launch the game
- View in-game logs if the game has been launched

As an example, this is what the web interface would look like when the game is launched:
![Image showcasing the web interface on browser but with game logs](/assets/Misc_iOS_webserver-ui2.png)

### Other Upload Method

If you prefer not to upload your mods through your browser, you can use a script to upload your mod to your device, and launch the game immediately after you compile and upload your mod:
```bash
# Build commands here...

# Replace the Example ID with your Mod ID, or the path to your compiled geode file. This is assuming the CWD is the project.
GEODE_MOD="./build-ios/my.example-mod.geode"

# Replace the device URL with your device's local IP address
DEVICE_URL="http://192.168.0.25:8080"
curl -X POST -F "file=@${GEODE_MOD}" "${DEVICE_URL}/upload"

# Including this curl request is optional.
curl -X POST "${DEVICE_URL}/launch"
---
title: iOS Development Setup
---

# iOS Development Setup

Something something preamble

You will have to edit your `CMakeLists.txt` on your exiting mods. Newer created mods will already have this change
```cmake
# At the beginning of your CMakeLists.txt, change this:
# set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
# into:
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "iOS" OR IOS)
set(CMAKE_OSX_ARCHITECTURES "arm64")
else()
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
endif()
```

## Build

To build mods for iOS, you must have Mac OS with the iPhone SDK installed from Xcode.

You must also get the Geode binaries for iOS, you can do this using the CLI:
```bash
geode sdk update
geode sdk install-binaries --platform ios
```

Now you can build your mod for iOS via:
```bash
geode build -p ios
```
Or if you want to build manually:
```bash
cmake -B build -DCMAKE_SYSTEM_NAME=iOS -DGEODE_TARGET_PLATFORM=iOS -DCMAKE_BUILD_TYPE=RelWithDebInfo -G Ninja
cmake --build build
```

## Github Actions
To build your mod for iOS using `geode-sdk/build-geode-mod`, you have to add iOS to the build matrix, like so:
```yml
- name: iOS
os: macos-latest
target: iOS
```

## Web Server

If your iOS device is not jailbroken, it is generally recommended to follow this section to enable the web server.

> :warning: The web server for the TrollStore version of the launcher will not work properly. It is recommended to use `scp` to upload your mods instead.

The web server is a feature bundled into the **Geode Launcher** that allows you to easily upload mods without needing to use iTunes. This eliminates the need to manually drag your geode mod into the mods directory, making the mod testing process more simpler.

To activate the web server:
1. Open the launcher and navigate to settings
2. Scroll down until you reach the **About** section
3. Hold on the **iOS Launcher** text for at least 3 seconds until a popup appears prompting you to enable **Developer Mode**
4. Tap **Yes**, then scroll all the way down to find **Web Server**
5. Enable the setting and restart the launcher
![Image showing the steps above but a visualization of it](/assets/Misc_iOS_webserver-steps.png)

### Using the Web Server

After restarting the launcher, navigate to `http://[Your Device IP]:8080` in your browser on your computer, replacing `[Your Device IP]` with the local IP address of your iOS device.

Now you should see a web interface for the launcher in your browser!
![Image showcasing the web interface on browser](/assets/Misc_iOS_webserver-ui1.png)

Through this web interface, you can:
- Upload your mods
- Launch the game
- View in-game logs if the game has been launched

As an example, this is what the web interface would look like when the game is launched:
![Image showcasing the web interface on browser but with game logs](/assets/Misc_iOS_webserver-ui2.png)

### Other Upload Method

If you prefer not to upload your mods through your browser, you can use a script to upload your mod to your device, and launch the game immediately after you compile and upload your mod:
```bash
# Build commands here...

# Replace the Example ID with your Mod ID, or the path to your compiled geode file. This is assuming the CWD is the project.
GEODE_MOD="./build-ios/my.example-mod.geode"

# Replace the device URL with your device's local IP address
DEVICE_URL="http://192.168.0.25:8080"
curl -X POST -F "file=@${GEODE_MOD}" "${DEVICE_URL}/upload"

# Including this curl request is optional.
curl -X POST "${DEVICE_URL}/launch"
```