set up the build, the viewer window and the vsmv cli

The generator must reproduce .NET arithmetic bit for bit, so every unit
builds with -ffp-contract=off and -fwrapv. Nuklear goes through the
SDL3_Renderer backend, keeping the viewer off macOS's deprecated GL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 17:39:10 +03:00
commit d72ae437ae
10 changed files with 32800 additions and 0 deletions

43
src/vsmv.sex Normal file
View File

@@ -0,0 +1,43 @@
;;; vsmv: the command-line side of the viewer. It checks the generator
;;; against a saved world and dumps what either side produced.
(include stdio.h string.h sqlite3.h)
(var save-tables [(* const char) 4] #("gamedata" "mapregion" "mapchunk" "chunk"))
(fn usage () int
(fputs "usage: vsmv info SAVE.vcdbs\n" stderr)
(return 2))
(fn count-rows ((db (* sqlite3)) (table (* const char))) i64
(var sql [char 64])
(snprintf sql (sizeof sql) "select count(*) from %s" table)
(var stmt (* sqlite3-stmt) NULL)
(if (!= (sqlite3-prepare-v2 db sql -1 (& stmt) NULL) SQLITE-OK)
(return -1))
(var n i64 -1)
(if (== (sqlite3-step stmt) SQLITE-ROW)
(= n (sqlite3-column-int64 stmt 0)))
(sqlite3-finalize stmt)
(return n))
;;; vsmv info world.vcdbs
;;; gamedata 1
;;; mapregion 118
;;; ...
(fn info ((path (* const char))) int
(var db (* sqlite3) NULL)
(if (!= (sqlite3-open-v2 path (& db) SQLITE-OPEN-READONLY NULL) SQLITE-OK)
(do
(fprintf stderr "%s: %s\n" path (sqlite3-errmsg db))
(sqlite3-close db)
(return 1)))
(for (var i int 0) (< i 4) (++ i)
(printf "%-10s %8lld\n" [save-tables i] (count-rows db [save-tables i])))
(sqlite3-close db)
(return 0))
(pub fn main ((argc int) (argv [* char])) int
(if (&& (== argc 3) (== (strcmp [argv 1] "info") 0))
(return (info [argv 2])))
(return (usage)))