From 5212f07e785607f6b6a3028a869dca2c3ef1ed0b Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 7 Sep 2026 17:07:54 -0400 Subject: [PATCH] init commit --- .gitignore | 7 +++++++ CONTRIBUTING.md | 14 ++++++++++++++ LICENSE | 21 +++++++++++++++++++++ README.md | 23 +++++++++++++++++++++++ tools/clean_room_check.sh | 11 +++++++++++ 5 files changed, 76 insertions(+) create mode 100644 .gitignore create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 README.md create mode 100755 tools/clean_room_check.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8aec3b2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +build/ +build-*/ +*.dll +*.exe +*.log +__pycache__/ +.cache/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..8101fd0 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,14 @@ +# Contributing — clean-room rules + +This tree must stay publishable as engine code only. Never commit: +- game data in any form: `.gob` contents, extracted catalogs, saves, textures, strings dumps; +- the original binaries, or anything derived from them by a decompiler/disassembler + (no decompiler output, no disassembly excerpts, no pasted pseudo-code — not even in comments); +- copied fixture files from the game. Test fixtures are hand-written minimal samples. + +Facts *about* the binary (addresses, calling conventions, prototypes, struct layouts) enter this +repo only through `include/generated/sots_addresses.h`, which is generated from the RE repo with a +provenance header. Everything else is written from understanding, in our own words and code. + +Real-data tests read `$SOTS_DATA_DIR` (the owner's installed copy) and must skip cleanly when unset. +Run `tools/clean_room_check.sh` before committing. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6d992aa --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Alex Camilo + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..453b290 --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +# sots-engine + +A from-scratch, functional reimplementation of the engine behind **Sword of the Stars (2006)**. +Not a byte-for-byte decompilation: behavior-equivalent code, built up one verified piece at a time +(OpenRCT2-style) until the tree can build the whole application on its own. + +**Bring your own game.** This repository contains engine code only. Game data, assets, saves, and +the original binaries are never included; tests and tools read an owner-supplied copy via +`$SOTS_DATA_DIR`. See `CONTRIBUTING.md` for the clean-room rules. + +## Status +Phase 2 / M0 — the shim frontend (`src/shim/`): a proxy DLL the original game loads, used to +verify each reimplemented function against the original before it displaces it. Engine code +accrues under `src/mars/` (engine) and `src/game/` (game logic) as milestones land. + +## Layout (grows with the work) +- `src/shim/` — binkw32 proxy + hooks + old-vs-new compare harness (frontend #1) +- `src/mars/`, `src/game/` — the engine and game reimplementation (accruing) +- `include/generated/sots_addresses.h` — binary facts (RVAs/prototypes), generated from the RE repo +- `tests/` — host tests; real-data tests skip unless `$SOTS_DATA_DIR` is set +- `tools/` — build (MinGW i686 cross) and deploy scripts + +Planning, findings, and verification evidence are tracked in the private RE repo (`sots-re`). diff --git a/tools/clean_room_check.sh b/tools/clean_room_check.sh new file mode 100755 index 0000000..3cc0db2 --- /dev/null +++ b/tools/clean_room_check.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +# Refuse forbidden artifacts: game data, saves, binaries, decompiler output markers. +set -e; cd "$(dirname "$0")/.." +bad=0 +while IFS= read -r f; do + case "$f" in *.gob|*.sav|*.tga|*.dds|*.X|*.wav) echo "forbidden asset: $f"; bad=1;; esac +done < <(git ls-files) +if git grep -nE 'FUN_[0-9a-f]{8}|undefined[0-9]? \*|\bDAT_[0-9a-f]{8}\b|__thiscall +FUN_' -- ':!include/generated/*' ':!tools/clean_room_check.sh' >/dev/null 2>&1; then + echo "decompiler-style identifiers found outside include/generated/:"; git grep -nE 'FUN_[0-9a-f]{8}|\bDAT_[0-9a-f]{8}\b' -- ':!include/generated/*' ':!tools/clean_room_check.sh' | head; bad=1 +fi +[ $bad -eq 0 ] && echo "clean-room check: OK"; exit $bad