diff --git a/CMakeLists.txt b/CMakeLists.txt index f66f7d9..1d370b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -308,8 +308,19 @@ target_compile_options(bt410_l4 PRIVATE ${BT_OPTS}) #===========================================================================# # Executable: btl4.exe (WinMain launcher + game lib + engine lib + D3D9/audio) #===========================================================================# +# Version stamp: 4.11. ([+]) regenerated every +# build into ${CMAKE_BINARY_DIR}/btversion.h (see tools/btversion.cmake). +add_custom_target(btversion + COMMAND ${CMAKE_COMMAND} + -DOUT=${CMAKE_BINARY_DIR}/btversion.h + -DSRC=${CMAKE_SOURCE_DIR} + -P ${CMAKE_SOURCE_DIR}/tools/btversion.cmake + BYPRODUCTS ${CMAKE_BINARY_DIR}/btversion.h + COMMENT "Stamping btversion.h") add_executable(btl4 WIN32 "${CMAKE_SOURCE_DIR}/game/btl4main.cpp") +add_dependencies(btl4 btversion) target_include_directories(btl4 BEFORE PRIVATE + "${CMAKE_BINARY_DIR}" "${CMAKE_SOURCE_DIR}/engine/shim" "${CMAKE_SOURCE_DIR}/game/reconstructed" "${CMAKE_SOURCE_DIR}/game/original/BT" diff --git a/README.md b/README.md index b6fc055..041d62e 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,16 @@ the raw archive dumps. It builds and runs out of the box. > **License:** the game content (`content/`) and the original binary are proprietary to Virtual > World / the pod owner. This repository is **private**; do not redistribute. +## Versioning + +`4.10` = the 1995 arcade release. `4.11` = this win32 reconstruction. Dev builds are +**`4.11.` where `` is the git commit count** — monotonic and zero-maintenance — +plus the short commit hash (`4.11.311 (980c9cd)`); a trailing `+` on the hash means the exe was +built from an uncommitted working tree. The stamp regenerates every build +(`tools/btversion.cmake` → `build/btversion.h`) and shows in the boot banner (`btl4.log` line 2) +and the window title. To identify any player's build, ask for the title bar or the top of their +`btl4.log`. + --- ## Layout diff --git a/context/build-and-run.md b/context/build-and-run.md index e242ba4..f641661 100644 --- a/context/build-and-run.md +++ b/context/build-and-run.md @@ -64,6 +64,13 @@ to a frozen abort dialog: `cdb -p -c ".lines;~*kp 30;q"`. [T2] - **`docs/`** — the detailed ledgers (incl. `PROGRESS_LOG.md`, the full pre-restructure CLAUDE.md). - **`tools/`** — btconsole.py, disas2.py, map/res scanners. **`context/`** — this knowledge base. +## Versioning (2026-07-18) +`4.10` = the 1995 arcade release; `4.11` = this win32 reconstruction; dev builds = +**`4.11.` + short hash**, `+` suffix = built from an uncommitted tree +(e.g. `4.11.311 (980c9cd+)`). Stamped every build by `tools/btversion.cmake` → +`build/btversion.h` (`BT_VERSION_*` macros); shown in the boot banner (btl4.log head) and +the window title. Ask a tester for their title bar / btl4.log head to identify a build. + ## Key Relationships - Base: [[wintesla-port]] (the engine build recipe). - Verify loop: [[reconstruction-method]]; env gates: [[decomp-reference]] §6. diff --git a/game/btl4main.cpp b/game/btl4main.cpp index dd923cf..3c727c7 100644 --- a/game/btl4main.cpp +++ b/game/btl4main.cpp @@ -18,6 +18,7 @@ // #define BT_HEAPCHECK // enable to validate the heap on every alloc (heap-corruption hunt) #include #include // CommandLineToArgvW +#include // generated: 4.11. () #include // _CrtSetDbgFlag (heap validation, gated by BT_HEAPCHECK) #include #include @@ -326,7 +327,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine fclose(file); } - std::cout << "BattleTech v4.10 (reconstructed port)" << std::endl << std::flush; + // Version scheme: 4.10 = the 1995 arcade release; 4.11 = this win32 + // reconstruction; build = git commit count, hash pins exact source + // ('+' = built from an uncommitted tree). Stamped by tools/btversion.cmake. + std::cout << "BattleTech " << BT_VERSION_FULL + << " (win32 reconstruction of Tesla 4.10)" << std::endl << std::flush; // CPU pin (timing stability). BT_AFFINITY overrides the mask; =0 disables -- // required for multi-instance runs (two instances pinned to core 0 starve @@ -428,9 +433,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine if (np != 0) sscanf(np + 4, " %d", &netPort); if (netPort > 0) - swprintf(winTitle, 64, L"BattleTech \x2014 node %d", netPort); + swprintf(winTitle, 64, L"BattleTech %S \x2014 node %d", + BT_VERSION_STRING, netPort); else - wcscpy(winTitle, L"BattleTech"); + swprintf(winTitle, 64, L"BattleTech %S", BT_VERSION_STRING); } hWnd = CreateWindowEx(0, L"MainWndClass", winTitle, WS_OVERLAPPEDWINDOW, 0, 0, wr.right - wr.left, wr.bottom - wr.top, diff --git a/tools/btversion.cmake b/tools/btversion.cmake new file mode 100644 index 0000000..18c7047 --- /dev/null +++ b/tools/btversion.cmake @@ -0,0 +1,52 @@ +# btversion.cmake -- generate btversion.h from git at BUILD time. +# +# Version scheme (2026-07-18): the arcade release is 4.10; the win32 +# reconstruction is 4.11; the BUILD number is the git commit count -- +# monotonic, zero-maintenance, and any build pins to exact source via the +# hash. A '+' suffix marks an uncommitted working tree. +# +# Invoked: cmake -DOUT=
-DSRC= -P btversion.cmake + +execute_process(COMMAND git rev-list --count HEAD + WORKING_DIRECTORY "${SRC}" + OUTPUT_VARIABLE BT_BUILD OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET) +execute_process(COMMAND git rev-parse --short HEAD + WORKING_DIRECTORY "${SRC}" + OUTPUT_VARIABLE BT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET) +execute_process(COMMAND git status --porcelain --untracked-files=no + WORKING_DIRECTORY "${SRC}" + OUTPUT_VARIABLE BT_DIRTY_RAW + ERROR_QUIET) + +if(NOT BT_BUILD) + set(BT_BUILD 0) +endif() +if(NOT BT_HASH) + set(BT_HASH "nogit") +endif() +if(BT_DIRTY_RAW STREQUAL "") + set(BT_DIRTY "") +else() + set(BT_DIRTY "+") +endif() + +set(CONTENT "// generated by tools/btversion.cmake -- do not edit, not in git +#define BT_VERSION_MAJOR 4 +#define BT_VERSION_MINOR 11 +#define BT_VERSION_BUILD ${BT_BUILD} +#define BT_VERSION_STRING \"4.11.${BT_BUILD}\" +#define BT_VERSION_HASH \"${BT_HASH}${BT_DIRTY}\" +#define BT_VERSION_FULL \"4.11.${BT_BUILD} (${BT_HASH}${BT_DIRTY})\" +") + +# write only when changed so incremental builds don't churn +if(EXISTS "${OUT}") + file(READ "${OUT}" OLD) +else() + set(OLD "") +endif() +if(NOT OLD STREQUAL CONTENT) + file(WRITE "${OUT}" "${CONTENT}") +endif()