From 199c3d3d2bce019f09d4a5a81ff283a0f7bdae31 Mon Sep 17 00:00:00 2001 From: shweet Date: Thu, 19 Nov 2026 21:14:59 -0500 Subject: [PATCH] external/: SDL3 (release-3.4.20) and Lua 5.3.6 as static submodules, wired into CMake SDL3 replaces GLFW, Win32 and OpenAL (window, OpenGL context, input, gamepads, audio), trimmed to those pieces as in smack-a-brother. Lua 5.3 keeps the mod API. Online features become offline stubs. Co-Authored-By: Claude Opus 5.5 --- .gitmodules | 8 ++++++++ CMakeLists.txt | 28 +++++++++++++++++++++++++++- README.md | 5 ++++- external/lua | 1 + external/sdl | 1 + 5 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 .gitmodules create mode 160000 external/lua create mode 160000 external/sdl diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..cd63014 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,8 @@ +[submodule "external/sdl"] + path = external/sdl + url = https://github.com/libsdl-org/SDL.git + shallow = true +[submodule "external/lua"] + path = external/lua + url = https://github.com/lua/lua.git + shallow = true diff --git a/CMakeLists.txt b/CMakeLists.txt index 168faee..7a5b34d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,39 @@ cmake_minimum_required(VERSION 3.24) -project(isaac LANGUAGES CXX) +project(isaac LANGUAGES C CXX) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + set(CMAKE_BUILD_TYPE Release) +endif() + +# SDL: static, with only the window, OpenGL context, audio, events and gamepad pieces the game uses. +set(SDL_SHARED OFF CACHE BOOL "" FORCE) +set(SDL_STATIC ON CACHE BOOL "" FORCE) +set(SDL_OPENGL ON CACHE BOOL "" FORCE) +set(SDL_JOYSTICK ON CACHE BOOL "" FORCE) +set(SDL_HIDAPI ON CACHE BOOL "" FORCE) +set(SDL_TEST_LIBRARY OFF CACHE BOOL "" FORCE) +set(SDL_EXAMPLES OFF CACHE BOOL "" FORCE) +foreach(OPTION RENDER GPU VULKAN CAMERA HAPTIC HIDAPI_LIBUSB POWER SENSOR DIALOG TRAY OPENGLES OFFSCREEN + DUMMYVIDEO DISKAUDIO DUMMYAUDIO OSS JACK SNDIO KMSDRM IBUS LIBURING) + set(SDL_${OPTION} OFF CACHE BOOL "" FORCE) +endforeach() +add_subdirectory(external/sdl EXCLUDE_FROM_ALL) + +# Lua 5.3, which mods are written against: static, POSIX, no native modules. +file(GLOB LUA_SOURCES CONFIGURE_DEPENDS external/lua/l*.c) +list(REMOVE_ITEM LUA_SOURCES ${CMAKE_SOURCE_DIR}/external/lua/lua.c ${CMAKE_SOURCE_DIR}/external/lua/ltests.c) +add_library(lua STATIC ${LUA_SOURCES}) +target_include_directories(lua SYSTEM PUBLIC external/lua) +target_compile_definitions(lua PRIVATE LUA_USE_POSIX) + # The curated game: src/*.cpp, written on top of the declarations generated-src/classes.h holds for every class. # generated-src/'s own bodies stay out until they compile (scripts/source_tree.py --check reports how many do). file(GLOB SOURCES CONFIGURE_DEPENDS src/*.cpp) add_library(isaac STATIC ${SOURCES}) target_include_directories(isaac PRIVATE src) target_include_directories(isaac SYSTEM PRIVATE generated-src) +target_link_libraries(isaac PRIVATE SDL3::SDL3-static lua) diff --git a/README.md b/README.md index 58079dc..da9ed15 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,10 @@ jdk/ ghidra_12.2_PUBLIC/ Temurin 21 (system java is 8, too old) and Ghidra ## Reconstruction -The goal is a C++ source tree that builds a native 64-bit Linux game: `cmake -B build && cmake --build build`. +The goal is a C++ source tree that builds a native 64-bit Linux game: `git submodule update --init --recursive`, then +`cmake -B build && cmake --build build`. SDL3 (window, OpenGL context, input, audio) and Lua 5.3 (mods) are submodules +in `external/`, built statically. Online features (Steam, EOS, curl) are offline stubs. The game's resources are read +from the player's own install at runtime; nothing from the game ships here. `generated-src/` is the whole decompiled game as C++, regenerated every build and never edited. `src/` is the readable game, written by hand on top of it one function at a time: diff --git a/external/lua b/external/lua new file mode 160000 index 0000000..75ea9cc --- /dev/null +++ b/external/lua @@ -0,0 +1 @@ +Subproject commit 75ea9ccbea7c4886f30da147fb67b693b2624c26 diff --git a/external/sdl b/external/sdl new file mode 160000 index 0000000..f00dc91 --- /dev/null +++ b/external/sdl @@ -0,0 +1 @@ +Subproject commit f00dc919ca35b9756316e86c4777392de442f9b2