Finish Classic 0.2 portability and release preparation (by Codex)

This commit is contained in:
Codex committed 2026-10-18 20:51:39 +02:00
1 parent 74ca973111
commit 6e5fa72ed5
13 files changed
+186 -25

No files matched your search

+16 -7
View File
@@ -27,14 +27,23 @@ jobs:
path: dist
merge-multiple: true
- name: Create draft for review
shell: python
env:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ github.ref_name }}
run: |
for package in dist/*.zip; do
case "$(basename "$package")" in
OpenBMH-${RELEASE_TAG#v}-*.zip) ;;
*) echo "Release tag and package version differ" >&2; exit 1 ;;
esac
done
gh release create "$RELEASE_TAG" dist/*.zip --draft --verify-tag --title "OpenBMH $RELEASE_TAG" --notes-file docs/release/0.1/RELEASE_NOTES.md
import os, pathlib, re, subprocess
tag = os.environ['RELEASE_TAG']
match = re.fullmatch(r'v([0-9]+)\.([0-9]+)\.[0-9]+(?:[-+][A-Za-z0-9.-]+)?', tag)
if not match:
raise SystemExit('Invalid release tag')
notes = pathlib.Path('docs/release') / (match[1] + '.' + match[2]) / 'RELEASE_NOTES.md'
packages = sorted(pathlib.Path('dist').glob('*.zip'))
expected = {'OpenBMH-' + tag[1:] + '-' + kind + '.zip'
for kind in ('windows-x64', 'linux-x64', 'macos-arm64', 'source')}
if {p.name for p in packages} != expected:
raise SystemExit('Missing, unexpected or mismatched release package')
if not notes.is_file():
raise SystemExit('Release notes missing for ' + tag)
subprocess.run(['gh', 'release', 'create', tag, *map(str, packages), '--draft',
'--verify-tag', '--title', 'OpenBMH ' + tag, '--notes-file', str(notes)], check=True)
+3 -3
View File
@@ -4,7 +4,7 @@ A modern and faithful open source rebuild of the *Bundesliga Manager Hattrick* e
OpenBMH is a standalone C++20 engine with an SDL2 interface for *Bundesliga Manager Hattrick* (1994/95) and its English edition, *Football Limited*. The project develops a playable reconstruction alongside a platform for new rules, content and interfaces. Keeping the familiar game enjoyable and making it easier to extend are equally important goals.
The 0.2 development branch imports a game installation supplied by the player into a portable Classic mod. The running game reads the converted OBW content. Game data, artwork, music, manuals and the original executable are not distributed with OpenBMH. Its aim is recognisable behaviour and plausible results; documented compatibility decisions and safety fixes take precedence over reproducing every original fault.
Version 0.2 imports a game installation supplied by the player into a portable Classic mod. The running game reads the converted OBW content. Game data, artwork, music, manuals and the original executable are not distributed with OpenBMH. Its aim is recognisable behaviour and plausible results; documented compatibility decisions and safety fixes take precedence over reproducing every original fault.
This is an independent community project, with no affiliation with or endorsement by the original rights holders, the DFL or the Bundesliga. It is an engine implementation, not an official source release or a remaster.
@@ -12,7 +12,7 @@ This is an independent community project, with no affiliation with or endorsemen
Check the [releases page](https://github.com/Weyoune/openbmh/releases) for available packages and their platform notes. A Windows package uses the name `OpenBMH-<version>-windows-x64.zip`. Availability and native validation are stated for each release; source build instructions do not establish platform support on their own.
These instructions describe the **0.2 development branch**, not the published 0.1.2 package.
These instructions describe **0.2**, whose release packages are prepared separately from 0.1.2. See the [0.2 release notes](docs/release/0.2/RELEASE_NOTES.md).
1. Extract OpenBMH into a writable directory.
2. Start `OpenBMH.exe` on Windows, or `OpenBMH` on Linux/macOS. Its RmlUI launcher initially has an empty **Name | Art** list. The night-stadium design uses a small version label in the lower-right corner.
@@ -43,7 +43,7 @@ The standalone [`openbmh_import` tool](docs/formats/obw/import.md) produces the
## Build from source
The following recipes target this 0.2 development branch. They require Git, CMake 3.24 or newer and a C++20 compiler. The first configure fetches pinned open-source dependencies. Native build and package results are documented for each release; these instructions do not claim an untested platform result.
The following recipes target version 0.2. They require Git, CMake 3.24 or newer and a C++20 compiler. The first configure fetches pinned open-source dependencies. Native build and package results are documented for each release; these instructions do not claim an untested platform result.
Clone the public repository, then run the commands for your system:
+11 -2
View File
@@ -10,9 +10,18 @@ Career management, matches, finances, transfers, original-style SDL2 screens, au
Complete edition-specific loading, presentation, competitions and sound support. Imported content determines names, text, clubs and league organisation; a shared engine rule base defines the simulation.
## 0.2: open data and typed state
## 0.2: portable Classic content and native saves
Introduce a documented import format and a native save format, retaining supported legacy import where practical. The format concept is [OBW](formats/OBW.md). Replace fixed-layout state gradually with typed clubs, players, contracts and competitions. Keep each intermediate stage usable and cover transitions with tests.
Import a supplied BMH or Football Limited installation through the launcher into a
sealed [OBW](formats/OBW.md) Classic mod. Run the original-style interface and
console exclusively from converted content, with native careers and preferences
stored separately. Legacy save migration is an import operation. See the
[0.2 release notes](release/0.2/RELEASE_NOTES.md) and
[runtime contract](formats/obw/runtime-0.2.md).
Modern game screens are deferred. The Modern UI POC remains separate from the
0.2 distribution. Replacing the remaining compatibility blocks with typed clubs,
players, contracts and competitions is subsequent work, not a completed 0.2 claim.
## 0.3: configurable rules
+62
View File
@@ -0,0 +1,62 @@
<!-- SPDX-License-Identifier: GPL-3.0-only -->
# OpenBMH v0.2.0
Version 0.2 makes the original-style game independent of the original installation
after import. It supports Bundesliga Manager Hattrick and Football Limited Classic
content. Modern game screens are deferred; the stadium-themed launcher is included.
## Start playing
1. Extract the package into a writable folder and start `OpenBMH.exe` on Windows
or `OpenBMH` on Linux/macOS. Keep the supplied `assets` folder beside it.
2. Choose **Add**, select an installation containing `BMH.EXE` or `FLTD.EXE`,
and choose a unique mod name. Defaults are `BMH-classic` and `FTDL-classic`.
3. Choose the displayed starting year. Optionally migrate original saved games,
settings and desktop layouts; another source folder can be selected.
4. Select the imported mod and choose **Start**. The game reads its converted
`content.obw`, so the original installation is no longer required for play.
The list is empty on the first launch. Rename changes the mod folder; Delete asks
for confirmation and retains personal files. Failed individual save conversions
appear in the import report. Keep the original files as backups.
## Content and saves
- Converted content lives in `mods/<name>/content.obw`. Classic content preserves
the original edition's tables, rules, artwork and competition structure. A seal
detects modified or damaged contents; reimport to repair a rejected package.
- New saved games use `.obs`, including the starting world, complete career state,
turn driver and both random streams. Settings, layouts and high scores use
`.obsettings`, `.oblayout` and `.obscore`.
- Personal files live in `userdata/<content-id>/`. Renaming or deleting a mod
retains them; reimporting identical content reconnects them.
- Use Add to migrate older `.FBM`, `.EIN` and `.MEN` files. Original Football
Limited V2.20 saves have an edition-specific translator. Unsupported or damaged
saves are reported rather than guessed. OpenBMH 0.1.2 cannot load native 0.2 saves.
- Original saves did not record every random seed. Migration establishes a
reproducible continuation; subsequent native saves preserve both streams exactly.
- Starting-year selection changes displayed years, retaining Classic scheduling
and weekday rules. Existing careers keep their saved year.
The GUI and console both run from native content. For direct startup:
```sh
./OpenBMH --mod "mods/BMH-classic/content.obw"
./openbmh_cli --console --mod "mods/BMH-classic/content.obw"
```
See the [runtime and migration contract](../../formats/obw/runtime-0.2.md).
## Platforms and distribution
The build pipeline produces Windows x64, Linux x64 and macOS ARM64 ZIPs and a
matching source ZIP with pinned dependency sources and build information.
Builds and automated tests do not replace native interactive acceptance.
The launcher requires OpenGL 3.3 (macOS: 4.1). Linux requires the platform libraries
described in [BUILDING](../../BUILDING.md), including GTK3 for its folder picker.
The macOS executable is unsigned and is not a notarised application bundle.
No original executables, graphics, sound, databases or saved games are distributed.
Supply a supported CD/later German or Football Limited installation; the original
German floppy edition is unsupported. OpenBMH is GPL-3.0-only; bundled components
retain their licenses. Keep all supplied notices and corresponding source material.
+5 -1
View File
@@ -33,7 +33,11 @@ Documents read_archive(const fs::path &file) {
if (fs::is_symlink(fs::symlink_status(file)) || !fs::is_regular_file(file) ||
fs::file_size(file) > 128ull * 1024 * 1024)
fail("invalid native archive");
const auto input = read_file(file);
// The archive itself remains a real file when its path is a mounted asset root.
std::ifstream stream(file, std::ios::binary);
std::string input(size_t(fs::file_size(file)), '\0');
if (!stream.read(input.data(), std::streamsize(input.size())))
fail("cannot read native archive");
mz_zip_archive zip{};
if (!mz_zip_reader_init_mem(&zip, input.data(), input.size(), 0))
fail("invalid ZIP archive");
+5
View File
@@ -34,8 +34,13 @@ include(../launch/rmlui.cmake)
target_sources(bmh_launcher PRIVATE ../launch/launcher_rmlui.cpp)
target_link_libraries(bmh_launcher PRIVATE bmh_rmlui nfd)
add_executable(launcher_document_tests ../../tests/launcher_document_tests.cpp)
target_include_directories(launcher_document_tests PRIVATE ..)
target_link_libraries(launcher_document_tests PRIVATE RmlUi::Core)
add_test(NAME launcher_document_tests COMMAND launcher_document_tests "${launcher_assets}")
add_test(NAME launcher_unicode_document_tests COMMAND launcher_document_tests "${launcher_assets}" unicode)
if(MSVC)
target_compile_options(launcher_document_tests PRIVATE /utf-8)
endif()
add_executable(native_content_tests ../../tests/native_content_tests.cpp)
target_link_libraries(native_content_tests PRIVATE bmh_launcher)
add_test(NAME native_content_tests COMMAND native_content_tests)
+6 -2
View File
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
#include "launch/launcher_ui.hpp"
#include "launch/rml_path.hpp"
#include "launch/archive.hpp"
#include "launch/process.hpp"
#include "version.hpp"
@@ -117,6 +118,7 @@ struct Video {
};
class RmlLauncher final : public LauncherUI, public Rml::EventListener {
Video video_;
rml::AssetFiles files_;
SystemInterface_SDL system_{video_.window};
RenderInterface_GL3 renderer_;
TextInputMethodEditor_SDL ime_;
@@ -215,6 +217,7 @@ class RmlLauncher final : public LauncherUI, public Rml::EventListener {
answered_ = accepted_ = false;
display("overlay", true);
modal_visible_ = true;
context_->Update();
if (auto *input = document_->GetElementById("mod-name"))
input->Focus(true);
else
@@ -391,6 +394,7 @@ class RmlLauncher final : public LauncherUI, public Rml::EventListener {
throw std::runtime_error("RmlUI could not create the OpenGL renderer");
try {
Rml::SetSystemInterface(&system_);
Rml::SetFileInterface(&files_);
Rml::SetRenderInterface(&renderer_);
Rml::SetTextInputHandler(&ime_);
initialized_ = Rml::Initialise();
@@ -398,12 +402,12 @@ class RmlLauncher final : public LauncherUI, public Rml::EventListener {
throw std::runtime_error("RmlUI initialization failed");
const auto assets = executable_path({}).parent_path() / "assets" / "launcher";
for (const char *weight : {"Regular", "Bold"})
if (!Rml::LoadFontFace(path_to_utf8(assets / (std::string("LatoLatin-") + weight + ".ttf"))))
if (!Rml::LoadFontFace(rml::asset_path(assets / (std::string("LatoLatin-") + weight + ".ttf"))))
throw std::runtime_error("Launcher font missing; extract the complete OpenBMH package");
context_ = Rml::CreateContext("launcher", {1100, 688});
if (!context_)
throw std::runtime_error("RmlUI launcher context failed");
document_ = context_->LoadDocument(path_to_utf8(assets / "launcher.rml"));
document_ = context_->LoadDocument(rml::asset_path(assets / "launcher.rml"));
if (!document_)
throw std::runtime_error("Launcher layout missing; extract the complete OpenBMH package");
document_->AddEventListener("click", this);
+35
View File
@@ -0,0 +1,35 @@
// SPDX-License-Identifier: GPL-3.0-only
#pragma once
#include <filesystem>
#include <string>
#include <cstdio>
#include <RmlUi/Core/FileInterface.h>
namespace bmh::rml {
// RmlUI parses document locations as URLs. Native Windows backslashes make
// URL::GetPath() empty, so relative image sources lose their asset directory.
inline std::string asset_path(const std::filesystem::path &path) {
const auto utf8 = path.generic_u8string();
return {utf8.begin(), utf8.end()};
}
// RmlUI paths are UTF-8. The Windows narrow fopen API uses the system code page.
class AssetFiles : public Rml::FileInterface {
public:
Rml::FileHandle Open(const Rml::String &path) override {
#ifdef _WIN32
const std::u8string utf8(path.begin(), path.end());
return reinterpret_cast<Rml::FileHandle>(_wfopen(std::filesystem::path(utf8).c_str(), L"rb"));
#else
return reinterpret_cast<Rml::FileHandle>(std::fopen(path.c_str(), "rb"));
#endif
}
void Close(Rml::FileHandle file) override { std::fclose(reinterpret_cast<FILE *>(file)); }
size_t Read(void *buffer, size_t size, Rml::FileHandle file) override {
return std::fread(buffer, 1, size, reinterpret_cast<FILE *>(file));
}
bool Seek(Rml::FileHandle file, long offset, int origin) override {
return std::fseek(reinterpret_cast<FILE *>(file), offset, origin) == 0;
}
size_t Tell(Rml::FileHandle file) override { return size_t(std::ftell(reinterpret_cast<FILE *>(file))); }
};
} // namespace bmh::rml
+34 -8
View File
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-only
#include <RmlUi/Core.h>
#include "launch/rml_path.hpp"
#include <chrono>
#include <filesystem>
#include <fstream>
#include <iostream>
@@ -27,11 +29,15 @@ struct Renderer : Rml::RenderInterface {
void EnableScissorRegion(bool) override {}
void SetScissorRegion(Rml::Rectanglei) override {}
Rml::TextureHandle LoadTexture(Rml::Vector2i &dimensions, const Rml::String &name) override {
std::ifstream input(name, std::ios::binary);
auto *files = Rml::GetFileInterface();
const auto input = files->Open(name);
if (!input)
throw std::runtime_error("Stadium asset unavailable: " + name);
unsigned char header[18]{};
input.read(reinterpret_cast<char *>(header), sizeof(header));
if (!input || header[2] != 2 || header[16] != 24)
throw std::runtime_error("Stadium asset unavailable");
const auto read = files->Read(header, sizeof(header), input);
files->Close(input);
if (read != sizeof(header) || header[2] != 2 || header[16] != 24)
throw std::runtime_error("Invalid stadium asset: " + name);
dimensions = {header[12] + 256 * header[13], header[14] + 256 * header[15]};
return 1;
}
@@ -44,21 +50,41 @@ void require(bool value, const std::string &error) {
}
} // namespace
int main(int argc, char **argv) try {
require(argc == 2, "launcher asset directory required");
require(argc == 2 || (argc == 3 && std::string(argv[2]) == "unicode"), "launcher asset directory required");
std::filesystem::path assets(argv[1]);
struct Cleanup {
std::filesystem::path path;
~Cleanup() {
if (!path.empty()) {
std::error_code error;
std::filesystem::remove_all(path, error);
}
}
} cleanup;
if (argc == 3) {
cleanup.path = std::filesystem::temp_directory_path() /
("openbmh-rml-" + std::to_string(std::chrono::steady_clock::now().time_since_epoch().count()));
std::filesystem::create_directory(cleanup.path);
const auto unicode = cleanup.path / std::filesystem::path(u8"Fußball 日本語") / "launcher";
std::filesystem::create_directories(unicode);
std::filesystem::copy(assets, unicode, std::filesystem::copy_options::recursive);
assets = unicode;
}
System system;
Renderer renderer;
bmh::rml::AssetFiles files;
Rml::SetSystemInterface(&system);
Rml::SetRenderInterface(&renderer);
Rml::SetFileInterface(&files);
require(Rml::Initialise(), "RmlUI initialization");
struct Shutdown {
~Shutdown() { Rml::Shutdown(); }
} shutdown;
const std::filesystem::path assets(argv[1]);
for (const auto *weight : {"Regular", "Bold"})
require(Rml::LoadFontFace((assets / (std::string("LatoLatin-") + weight + ".ttf")).string()),
require(Rml::LoadFontFace(bmh::rml::asset_path(assets / (std::string("LatoLatin-") + weight + ".ttf"))),
"font load");
auto *context = Rml::CreateContext("test", {1100, 688});
auto *document = context->LoadDocument((assets / "launcher.rml").string());
auto *document = context->LoadDocument(bmh::rml::asset_path(assets / "launcher.rml"));
require(document != nullptr, "launcher document load");
document->Show();
for (const auto size : {Rml::Vector2i(1100, 688), Rml::Vector2i(800, 540), Rml::Vector2i(2200, 1376)}) {
+5
View File
@@ -120,6 +120,11 @@ int main(int argc, char **argv) try {
const auto archive = root / "sample.obs";
content::write_archive(docs, archive);
check(content::read_archive(archive) == docs, "binary native archive round-trip");
{
content::Mount mount(archive, std::make_shared<content::Classic>());
check(content::read_archive(archive) == docs,
"archive reads bypass the mounted virtual resource namespace");
}
rejects([&] { content::write_archive({{"../outside", "x"}}, root / "unsafe.obs"); },
"archive traversal rejected");
rejects([&] { content::write_archive({}, archive); }, "existing saves require explicit overwrite");
+2
View File
@@ -41,6 +41,8 @@ int main(int argc, char **argv) try {
const auto package = result.mod.directory / "content.obw";
auto content = content::open(package);
content::Mount mount(package, content);
check(content::open(package)->content_id == content->content_id,
"mounted container can be reopened without resolving it as an asset");
openbmh::audio::OriginalAssets sound;
for (size_t i = 0; i < 4; ++i)
sound.containers[i] = read_file(mount.root() / "S" / std::to_string(2000 + i));
+1 -1
View File
@@ -25,7 +25,7 @@ class PackageAllowlistTests(unittest.TestCase):
for name in ['OpenBMH', 'openbmh_cli', 'openbmh_import', 'README.md', 'LICENSE',
'THIRD_PARTY_NOTICES.md', 'ACKNOWLEDGEMENTS.md', 'CONTRIBUTING.md']:
(root / name).write_text('synthetic')
notes = root / 'docs/release/0.1/RELEASE_NOTES.md'
notes = root / 'docs/release/0.2/RELEASE_NOTES.md'
notes.parent.mkdir(parents=True)
notes.write_text('synthetic release notes')
for name in ['launcher.rml', 'theme.rcss', 'stadium.tga', 'LatoLatin-Regular.ttf', 'LatoLatin-Bold.ttf']:
+1 -1
View File
@@ -41,7 +41,7 @@ def validate(directory, windows):
if not allowed:
raise RuntimeError('Unexpected package entry: ' + relative.as_posix())
required = products | documents | launcher_assets | {'docs/licenses/' + name for name in licenses}
required.add('docs/release/0.1/RELEASE_NOTES.md')
required.add('docs/release/0.2/RELEASE_NOTES.md')
if required - present:
raise RuntimeError('Missing package entries: ' + ', '.join(sorted(required - present)))
if windows and not {'vcruntime140.dll', 'msvcp140.dll'} <= present: