Linux support, and an AppImage of the builder for x86_64 #66
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!66
Loading…
Reference in a new issue
No description provided.
Delete branch "linux-appimage"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Linux support for Hookshot (x86_64), and a CI workflow that builds an AppImage of the builder.
What it does
host/posix/: the Win32 calls the runtime and the Vulkan back end make, implemented on POSIX. Itswindows.his on the include path of Linux builds only, so most Windows code is untouched. Where a shared file needed a change, it's behind#ifdef _WIN32with the Windows branch as it was (vk_main.cpp,vk_memory.cpp,vk_draw.cpp,vk_replay.cpp,hos_main.c,hos_mem.c,hos_setjmp.c). The shared-file change that also affects Windows is a/fallback where the executable's folder is found (nn_applet.c,rx_backend.c). It covers SRW locks and condition variables (futex), threads, events, fibers (ucontext), files (\paths made/), virtual memory (the guest window is oneMAP_NORESERVEmapping, so committing is a no-op and decommitting ismadvise), modules (dlopen, withx.dll→x.so,SDL2.dll→libSDL2-2.0.so.0,vulkan-1.dll→libvulkan.so.1), and vectored exception handlers on SIGSEGV (crash reports).display_sdl.c, loaded at run time likepad_sdl.cloads it). SDL wants the window on the main thread, so on Linux the game runs on a thread of its own (64 MB stack) and the main thread owns the window. The Vulkan surface is made through SDL (X11 or Wayland). Sound:waveOuton SDL's audio. Insert menu text: the GDI callsvk_menu.cppmakes, rasterised with stb_truetype from the system's sans font.hos_setjmp.c: a System V version ofrecomp_sj_setjmp/recomp_sj_longjmp. It uses the same buffer layout and the same naked-function approach as the Win64 one, so setjmp still runs in the caller's frame.nx2/build.pybuilds an ELFhookshotandhookshot_vk.so.make_game.pyworks on Linux: a compiler check instead of the Windows SDK check, the work folder in~/.cache/hookshot-builder, and building without the play profile when the compiler is too old to read it.scripts/linux/deps.sh,scripts/linux/appimage.sh,.github/workflows/linux-appimage.yml): Hookshot Builder for Linux (a Tk window with the same steps as the WPF one, plus--cliformake_game.py), carrying LLVM 23 (clang, lld), a glibc 2.35 sysroot, Python with the tools' modules, static FFmpeg + dav1d, SDL2 and the prebuilt Vulkan back end. Players install nothing. It is built in Ubuntu 22.04, so the AppImage and the games it builds run on glibc 2.35 and newer. The workflow uploads it as an artifact, and on a tag also to the release.work/(the hot lists and the play profile) is taken from the repository when it's there, else from the latest release'sHookshotBuilder.zip.Fixes found while running it
vk_replay.cpp).$XDG_DATA_HOME/hookshot(~/.local/share/hookshot). Auserfolder beside the game from an earlier build is moved there once.--userstill wins.hookshot_env.txtbeside the game sets the same switches as on Windows (RX_VK_NOOPT=1and the rest), and it is read before the window soHOS_HEADLESSandHOS_WINDOW_SIZEapply.The timer wait that used to be listed here is in main now (pull request 55). This branch is merged through current main, including the lighting, exposure, VRAM and builder fixes.
Tested
On one PC: Arch Linux (Hyprland, Wayland), RTX 2060 Super, NVIDIA 615.78, with the supported dump (build
e0f3ccfa) from its.nup:.nupextraction, the lift and the full build on Linux, then the game started from its folder.HOS_INPUT_LIVE) through to gameplay. A real controller (8BitDo Ultimate 2C) was found through SDL. The keyboard on XWayland: E started the game, and Insert opened the menu and changed and saved an option (the back end reads the executable's key state).SDL_VIDEODRIVER=x11).b306c4d: the first-start shader preparation (14,179 programs), the new Fullscreen row of the Insert menu (on and off), and loading the autosave by keyboard and walking around Link's house.scripts/linux/deps.sh+scripts/linux/appimage.shin an Ubuntu 22.04 root filesystem, the same steps as the workflow. That AppImage (206 MB), run on the Arch machine, checked the dump's version, built the whole game from theromfsandexefsfolders with its own compiler and sysroot in 28 minutes (3 jobs), and wrote the shader list. The game it built prepared its shaders at the first start (14,179 programs in about 55 s), played the opening, and took the scripted controller. That game needs only libc and libm from the system (glibc 2.35 or newer): FFmpeg, dav1d and the C++ runtime are inside it, and SDL2 sits beside it.Not tested: AMD or Intel GPUs, other distributions, a long play session. The builder window was only seen to open (the screens were asleep during testing); the builds above ran through its
--cli, which runs the samemake_game.py. The workflow file itself hasn't run on GitHub's runners yet (my account can't run Actions at the moment), though its steps ran as above.Relation to #32
#32 also adds Linux support and arrived while this was in progress. A few differences, for comparison:
recomp_sj_setjmpwrapssigsetjmpin astaticfunction. Lifted code callsrecomp_sj_setjmpby name, so the game won't link, and a setjmp inside a function that has returned can't be longjmp'd back to (the reason for the naked assembly, as the file's comment explains). Here it's a System V naked version of the same.Happy to fold anything useful from #32 in here, or to rebase onto it if you'd rather take that one first.
Will look into this later.
Looks good to me, fix the merge error and I believe it's ready to merge
Conflicts resolved.