Fix hacked GTK3/GLFW crash by vendoring a patched sqweek/dialog

The built hacked binary segfaults on Linux the moment a native GTK3
dialog (file/folder browse) opens while a GLFW/OpenGL context is live:
sqweek/dialog's Linux backend never calls XInitThreads() before
gtk_init(), and GLFW's own X11 backend installs a process-wide Xlib
error handler that collides with GTK's.

Vendor a pinned copy of github.com/sqweek/dialog (New BSD) into
modding/sqweek-dialog/ so it can be patched like every other vendored
source here: sqweek-dialog-patches/01-xinitthreads.patch adds the
missing XInitThreads() call, and hacked-patches/01-use-patched-dialog.patch
adds a go.mod replace directive pointing hacked's own sqweek/dialog
dependency at that local copy. build-hacked.sh now stages both hacked/
and sqweek-dialog/ into a scratch modding/build/ directory and applies
their patch series before compiling, rather than building hacked/ in
place; .gitignore picks up that new scratch directory.

Also expand modding/README.md: number its existing sections and add a
worked "Example: Editing a message" walkthrough covering Static World
Data, the Messages window's clipboard-only text editing, saving the
Mod Location, and the absolute-path requirement for run.sh's mod-folder
argument.
This commit is contained in:
ml
2026-09-26 10:37:01 +02:00
parent c91080aba7
commit e410d82680
20 changed files with 994 additions and 5 deletions
+32 -3
View File
@@ -8,7 +8,7 @@ Both pieces here come from the [InkyBlackness](https://inkyblackness.github.io)
project and are vendored unmodified, each under its own upstream license (see
below) - neither is relicensed by this repository's own MIT license.
## Layout
## 1. Layout
- `hacked/` - [InkyBlackness HackEd](https://github.com/inkyblackness/hacked),
the graphical mod editor. A vendored source snapshot (New BSD License),
@@ -38,7 +38,7 @@ support (level/resource files, `res/data/`); this folder is about the
external tools that create and inspect that content, not about changing the
engine itself.
## Building `hacked`
## 2. Building `hacked`
Packages `dist/<version>.linux64.tgz` and `dist/<version>.win64.zip` (native
Linux build, Windows amd64 cross-compiled via mingw-w64 - both from the same
@@ -67,7 +67,7 @@ Run the result: `dist/linux/hacked/hacked` on Linux,
`dist\win\hacked\hacked.exe` on Windows. Needs OpenGL 3.2; usage is documented
on [hacked's own wiki](https://github.com/inkyblackness/hacked/wiki).
### Publishing the build-image
### 2.1. Publishing the build-image
Same registry as the root project's own build-image (see the repository
root's `registry.env.example`), under a separate image name so the two don't
@@ -82,3 +82,32 @@ Reads `REGISTRY`/`REGISTRY_USER`/`REGISTRY_PASSWORD` and (optionally)
Don't bump `hacked-build-image/VERSION` just because the Dockerfile changed -
only once a build with the current version has actually succeeded, same
policy as the root project's own `build-image/VERSION`.
## 3. Example: Editing a message
`hacked` has no inline text editor - every text field is edited by right-click
-> **Copy to Clipboard**, editing the text in an external editor, then
right-click -> **Copy from Clipboard** back into the field. Example: changing
Rebecca Lansing's first email.
1. Run `dist/linux/hacked/hacked` (or the Windows build).
2. **Window -> Project.** Under **Static World Data**, **Add...** and browse to
the game's whole `res/assets/ss_ee/data/` directory (see the root
[README.md](../README.md) section 3 for where that comes from), so every
`.res`/`.dat` file is available.
3. **Window -> Messages** (F5). **Message Type**: `Mails`. **Index**: `26`
(Rebecca's first mail). Edit **Sender**/**Subject**/**Title**/the message
text via the clipboard round-trip above.
4. Back in the **Project** window, under **Mod Location**, click **Save**
(first time: **Browse...** to an empty folder, for example
`./modding/mymod`).
5. Test it from the root project's desktop build:
```sh
./dist/run.sh "$(pwd)/modding/mymod"
```
The mod-folder argument **must be an absolute path**: `run.sh` `cd`s into
`dist/` before launching the engine, so a relative path resolves against
the wrong directory and the mod silently fails to load (the engine's
`ProcessModDirectory()` reports nothing on a bad path). When the path is
right, the terminal shows `ProcessModDirectory ...` / `Found resource
file: ...` / `Loading mod file ...` for confirmation.