Skip to content
Closed
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
51 changes: 51 additions & 0 deletions .github/actions/embedded-engine/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build embedded Blockwork engine
description: Build the pinned Rust FFI library and expose its library/header paths.
outputs:
ffi-lib:
description: Static library for the host platform (universal on macOS).
value: ${{ steps.build.outputs.ffi-lib }}
ffi-include:
description: Generated C header directory.
value: ${{ steps.build.outputs.ffi-include }}
runs:
using: composite
steps:
- uses: actions/checkout@v4
with:
repository: Blockworked/Blockwork
ref: 65207fed4487cfb3568a3fc019025a17f66d3bbf
path: .blockwork-engine
persist-credentials: false
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ runner.os == 'macOS' && 'aarch64-apple-darwin,x86_64-apple-darwin' || 'x86_64-pc-windows-msvc' }}
- uses: Swatinem/rust-cache@v2
with:
workspaces: .blockwork-engine -> target
key: geode-ffi-${{ runner.os }}
- name: Build static FFI library
id: build
shell: bash
run: |
engine_root="$GITHUB_WORKSPACE/.blockwork-engine"
if [ "$RUNNER_OS" = macOS ]; then
export MACOSX_DEPLOYMENT_TARGET=11.0
for target in aarch64-apple-darwin x86_64-apple-darwin; do
cargo build --manifest-path "$engine_root/Cargo.toml" -p blockwork-ffi --release --locked --target "$target"
done
mkdir -p "$engine_root/target/universal-macos"
ffi_lib="$engine_root/target/universal-macos/libblockwork_ffi.a"
lipo -create -output "$ffi_lib" \
"$engine_root/target/aarch64-apple-darwin/release/libblockwork_ffi.a" \
"$engine_root/target/x86_64-apple-darwin/release/libblockwork_ffi.a"
for arch in arm64 x86_64; do
lipo "$ffi_lib" -verify_arch "$arch"
done
ffi_include="$engine_root/blockwork-ffi/include"
else
cargo build --manifest-path "$engine_root/Cargo.toml" -p blockwork-ffi --release --locked --target x86_64-pc-windows-msvc
ffi_lib="$(cygpath -m "$engine_root/target/x86_64-pc-windows-msvc/release/blockwork_ffi.lib")"
ffi_include="$(cygpath -m "$engine_root/blockwork-ffi/include")"
fi
echo "ffi-lib=$ffi_lib" >> "$GITHUB_OUTPUT"
echo "ffi-include=$ffi_include" >> "$GITHUB_OUTPUT"
36 changes: 36 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build checks
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
build:
name: ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- name: Windows
os: windows-latest
target: Win64
- name: macOS universal
os: macos-latest
target: MacOS
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Build embedded engine
id: engine
uses: ./.github/actions/embedded-engine
- name: Build mod
uses: geode-sdk/build-geode-mod@a0f7676e6fcd1a584f6d0c1c800239008412defc
with:
sdk: given
bindings-ref: 1605f500d053f8de122bf5c7dc6d17c24866e02e
target: ${{ matrix.target }}
combine: true
configure-args: >-
-DBLOCKWORK_FFI_LIB="${{ steps.engine.outputs.ffi-lib }}"
-DBLOCKWORK_FFI_INCLUDE_DIR="${{ steps.engine.outputs.ffi-include }}"
11 changes: 10 additions & 1 deletion .github/workflows/multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,20 @@ jobs:
with:
ref: ${{ github.ref_name }}

- name: Build embedded engine
id: engine
uses: ./.github/actions/embedded-engine

- name: Build the mod
uses: geode-sdk/build-geode-mod@main
uses: geode-sdk/build-geode-mod@a0f7676e6fcd1a584f6d0c1c800239008412defc
with:
combine: true
sdk: given
bindings-ref: 1605f500d053f8de122bf5c7dc6d17c24866e02e
target: ${{ matrix.config.target }}
configure-args: >-
-DBLOCKWORK_FFI_LIB="${{ steps.engine.outputs.ffi-lib }}"
-DBLOCKWORK_FFI_INCLUDE_DIR="${{ steps.engine.outputs.ffi-include }}"

release:
name: Combine and release
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,9 @@ winsdk_vfs_overlay.yaml
# Python bytecode caches
__pycache__/
*.py[cod]
# Local Geode SDK and CMake user configuration
.tools/
CMakeUserPresets.json

# Embedded engine checkout used by CI
/.blockwork-engine/
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "iOS" OR IOS)
set(CMAKE_OSX_ARCHITECTURES "arm64")
else()
elseif (NOT DEFINED CMAKE_OSX_ARCHITECTURES)
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
endif()
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
Expand Down Expand Up @@ -57,9 +57,17 @@ endif()
if (APPLE AND NOT IOS)
find_library(CORE_FOUNDATION_LIB CoreFoundation REQUIRED)
find_library(APPLICATION_SERVICES_LIB ApplicationServices REQUIRED)
find_library(SECURITY_LIB Security REQUIRED)
find_library(IOKIT_LIB IOKit REQUIRED)
find_library(APPKIT_LIB AppKit REQUIRED)
find_library(CORE_GRAPHICS_LIB CoreGraphics REQUIRED)
target_link_libraries(${PROJECT_NAME}
${BLOCKWORK_FFI_LIB}
${CORE_FOUNDATION_LIB}
${APPLICATION_SERVICES_LIB}
${SECURITY_LIB}
${IOKIT_LIB}
${APPKIT_LIB}
${CORE_GRAPHICS_LIB}
)
endif()
37 changes: 37 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 25,
"patch": 0
},
"configurePresets": [
{
"name": "mac-dev",
"displayName": "Geode macOS development (Apple Silicon)",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/mac-dev",
"environment": {
"PATH": "$penv{HOME}/.local/bin:$penv{PATH}",
"GEODE_SDK": "${sourceDir}/.tools/geode-sdk",
"CPM_SOURCE_CACHE": "${sourceDir}/.tools/cpm-cache",
"GEODE_BINDINGS_REPO_PATH": "${sourceDir}/.tools/bindings"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"CMAKE_OSX_ARCHITECTURES": "arm64",
"CMAKE_EXPORT_COMPILE_COMMANDS": true,
"SKIP_BUILDING_CODEGEN": false,
"BLOCKWORK_FFI_LIB": "${sourceDir}/../Blockwork/target/aarch64-apple-darwin/release/libblockwork_ffi.a",
"BLOCKWORK_FFI_INCLUDE_DIR": "${sourceDir}/../Blockwork/blockwork-ffi/include"
}
}
],
"buildPresets": [
{
"name": "mac-dev",
"configurePreset": "mac-dev",
"jobs": 4
}
]
}
82 changes: 82 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,58 @@ This is where she makes a mod.
We recommend heading over to [the getting started section on our docs](https://docs.geode-sdk.org/getting-started/) for useful info on what to do next.

## Build instructions
### Local macOS development

The local environment uses Geode SDK **v5.11.2**, bindings commit
`1605f500` (matching that release), and Geometry Dash **2.2081**.
The SDK, bindings, and dependency cache live in the ignored `.tools/` directory.
The Geode CLI is installed in `~/.local/bin`.

```sh
source scripts/dev-env.sh
MACOSX_DEPLOYMENT_TARGET=13.0 cargo build -p blockwork-ffi --release --target aarch64-apple-darwin --manifest-path ../Blockwork/Cargo.toml
cmake --preset mac-dev
cmake --build --preset mac-dev
```

The `mac-dev` preset links the Rust engine from the sibling `../Blockwork`
checkout, including its macOS backend fixes. Rebuild that library when the engine changes.
The older `.tools/blockwork-engine` checkout is retained but is no longer the preset’s source. The preset builds
for Apple Silicon with debug symbols and generates
`build/mac-dev/compile_commands.json` for editor code completion. Open this
directory as a CMake project in CLion and select the `mac-dev` preset.
The build packages the mod and installs it into the CLI's active GD profile.
Restart Geometry Dash to load a rebuilt mod.

```sh
geode profile list
geode run
```

The official `geode.devtools` mod is also installed in the local game; restart
the game to load it. Its tools can be opened with **F10** (or **Fn+F10**, depending
on your keyboard settings).

To recreate the SDK checkout on another Mac:

```sh
mkdir -p .tools
git clone --branch v5.11.2 --depth 1 https://github.com/geode-sdk/geode .tools/geode-sdk
git clone https://github.com/geode-sdk/bindings .tools/bindings
git -C .tools/bindings checkout 1605f500
git clone https://github.com/Blockworked/Blockwork ../Blockwork
git -C ../Blockwork checkout 65207fed4487cfb3568a3fc019025a17f66d3bbf
source scripts/dev-env.sh
geode sdk install-binaries
geode profile add "$HOME/Library/Application Support/Steam/steamapps/common/Geometry Dash/Geometry Dash.app" --name gd-2.2081 mac
```

Keep this SDK pinned while using the downgraded game. The existing `build.sh`
is an older Windows cross-compilation script with machine-specific paths;
use the presets above for local macOS work.

### Other platforms

For more info, see [our docs](https://docs.geode-sdk.org/getting-started/create-mod#build)
```sh
# Assuming you have the Geode CLI set up already
Expand All @@ -21,3 +73,33 @@ geode build
* [Geode CLI](https://github.com/geode-sdk/cli)
* [Bindings](https://github.com/geode-sdk/bindings/)
* [Dev Tools](https://github.com/geode-sdk/DevTools)

### Native macOS integration tests

Build and install the mod first, close Geometry Dash and the Blockwork daemon,
then run:

```sh
python3 scripts/autotest-macos.py --level 'Bloodbath Infinity 2' --runs 1 --speed 1 --output /tmp/blockwork-gd-normal
python3 scripts/autotest-macos.py --level 'Bloodbath Infinity 2' --runs 10 --speed 10 --output /tmp/blockwork-gd-10x
```

Each attempt freshly imports `~/Downloads/ChesszDC-Bloodbath-Infinity-zBot.gdr`
inside the game, links that new macro to the requested local level, and verifies
its identity in the terminal result. The runner launches through Steam: direct
Geode CLI launches exited before the menu on this installation. It temporarily
enables QOL safe mode, disables noclip and unrelated mods, sets the requested QOL
speed, and restores configuration files after stopping its game process. Existing
game saves are backed up. The output directory must be new; it contains replay
hashes, fresh macro copies, configuration backups, logs and result manifests.
A failed attempt stops the batch. Passing a finite batch is evidence for that
batch, not a guarantee about all future hardware and mod configurations.

On macOS, the game inlines `processCommands` into its update loop. Playback and
step recording therefore use `processQueuedButtons`, the called physics-step
boundary. Other platforms retain the existing `processCommands` hook.

CI builds the pinned Blockwork FFI library before building the mod. macOS uses a
universal arm64/x86_64 archive; Windows uses the MSVC static library. Both the
non-publishing checks and the release workflow pass the generated library and
header paths to CMake. The release workflow remains manually dispatched.
43 changes: 43 additions & 0 deletions docs/macos-parity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# macOS integration verification

The live acceptance fixture is the local **Bloodbath Infinity 2** level and fresh imports of `~/Downloads/ChesszDC-Bloodbath-Infinity-zBot.gdr`. The existing user replay is not used as the acceptance macro.

## Platform fix

The macOS game inlines `GJBaseGameLayer::processCommands` into `update`. Its standalone function is hookable but is not called by normal play. Before the fix, a fresh import succeeded, playback remained at step zero, and the player died at 1.36%.

macOS now advances host-clock playback and recording at the called `processQueuedButtons` boundary, before the game consumes input. Zero-delta cleanup calls do not advance the clock. Windows retains its original `processCommands` boundary. The Mac build links the current sibling Blockwork engine and the AppKit/CoreGraphics frameworks required by its native backend.

The native test runner launches through Steam, imports the GDR anew for every attempt, links the exact new macro to the requested local level, and records a result carrying a unique run identifier, macro identifier, selected identifier, level, step, completion/death state and elapsed time. The runner rejects results for another run or an existing macro. It keeps each imported macro and the logs in the evidence directory. QOL safe mode is on and noclip is off; unrelated mods are disabled. Configuration and game saves are backed up and restored after the owned game process stops.

Queued playback also needed an ownership fix: the input-blocking hook was rejecting the mod’s own clicks when the game consumed them after the enqueue callback returned. Playback now retains the exact queued-command identities, filters foreign entries, and marks its own consumption scope. A stray queued press injected before the first recorded jump was rejected while the full 10x replay completed. Its 724 input events and all positions through the input phase match direct playback. The user’s queue + click-between-steps options completed 20/20 fresh-import 10x attempts; each injected foreign press was rejected, with no host-clock timeout warnings. The final queued implementation also completed a fresh normal-speed run at 100% (114.22 seconds). Evidence: `/tmp/blockwork-gd-macos-10x-queued-batch-20/manifest.json` and `/tmp/blockwork-gd-macos-normal-queued-final/manifest.json`.

## Observed results

Environment: macOS 27.0.1, Apple Silicon, Geometry Dash 2.2081, Geode 5.11.2, bindings `1605f500`, QOL Mod 2.8.6. GDR SHA-256: `5700a2eb9213f2cc8e4303ec1966c169145804770048f9f12f733fe4d3b94efe`.

| Gate | Evidence |
|---|---|
| Normal-speed completion | Fresh import completed the local level at 100%, step 27,081, 114.18 seconds from PlayLayer initialization. `/tmp/blockwork-gd-macos-physics-hook-1/manifest.json` |
| QOL 10x completion | Another fresh import completed at 100%, approximately 11.68 seconds. `/tmp/blockwork-gd-macos-10x-trace-1/manifest.json` |
| Input accuracy | All 724 emitted input events had identical names, directions and step numbers at normal speed and 10x. Position traces matched through step 26,840; the final input was step 26,741. Differences began during the finish sequence. `/tmp/blockwork-gd-macos-normal-vs-10x-trace.json` |
| Repeated 10x acceptance | 20/20 completed successfully using 20 distinct fresh imports, with no host-clock timeout warnings. Level time ranged from 11.67–11.74 seconds. `/tmp/blockwork-gd-macos-10x-batch-20/manifest.json`. |

`getCurrentPercent()` may still be slightly below 100 at the game's `levelComplete` callback because it derives progress from position. The authoritative success event is the game completing the level with the player alive; the raw percentage is retained in the result, not rounded to manufacture success.

## Reproduce

Follow the macOS build steps in the README, close GD and the Blockwork daemon, then run:

```sh
python3 scripts/autotest-macos.py --runs 1 --speed 1 --trace --output /tmp/blockwork-gd-normal-new
python3 scripts/autotest-macos.py --runs 20 --speed 10 --output /tmp/blockwork-gd-10x-new
```

The output directory must not already exist. `--queue`, `--cbs`, `--offset` and `--trace` explicitly select developer options. The successful reference runs use offset -1, queue off and click-between-steps off. Finite successful runs establish those observations; they do not prove success under every future machine load or unrelated mod configuration.

Computer-use access to Geometry Dash was rejected by that tool’s approval review. No computer-use controls were used for the game; execution and evidence came from the mod’s own test harness and the official Steam launcher. Visual/keybind interaction coverage is therefore not claimed.

The private-repository CI jobs were rejected before startup by GitHub billing/spending limits. This is an external execution block, not a compiler result. The local universal mod compiles and links both architectures with a macOS 11.0 floor and no mixed-target warnings. Its final 3/3 fresh-import 10x acceptance batch passed on Apple Silicon; Windows compilation and Intel game runtime are not claimed.

A separate universal smoke batch was interrupted on focus loss during its second attempt. That batch is recorded separately and is not counted among completed batches. The harness now reports paused/unfocused interruptions explicitly. Final evidence is also preserved in `build/macos-verification/summary.json`.
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"geode": "5.7.1",
"geode": "5.11.2",
"gd": {
"win": "2.2081",
"mac": "*"
Expand Down
Loading
Loading