A game needs the executable or openbmh.dat, the executable wins

Assets with openbmh.dat are a complete game; without that file the launcher asks
for BMH.EXE (FLTD.EXE) as before. With both present the executable is used.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Sonnet 5.5 committed 2026-11-08 15:26:42 +01:00
1 parent 32b08e3799
commit f1f5fa523c
6 files changed
+62 -21

No files matched your search

+2
View File
@@ -8,6 +8,7 @@
#include <cstdlib>
#include <cstring>
#include <string>
#include <string_view>
#include <system_error>
#ifdef _WIN32
@@ -98,6 +99,7 @@ void add_texts(LeImage& image, int edition, const std::filesystem::path& game_di
std::filesystem::path find_texts_file(const std::filesystem::path& game_directory) {
if (const char* env = std::getenv("OPENBMH_DAT"); env && *env) {
if (std::string_view(env) == "-") return {}; // "no texts file at all" (tests of the launcher)
std::error_code ec;
if (std::filesystem::is_regular_file(env, ec)) return env;
}
+1 -1
View File
@@ -23,7 +23,7 @@ namespace bmh {
// times (u32 address, u32 length), then the bytes of all ranges. A range must be one of the edition's text ranges, so
// the file can never change a number of the image.
//
// The file is looked for in: the environment variable OPENBMH_DAT, the folder of the game data, the folder of the
// The file is looked for in: the environment variable OPENBMH_DAT ("-" = none at all), the folder of the game data, the folder of the
// running program, the current folder. Returns an empty path when there is none.
std::filesystem::path find_texts_file(const std::filesystem::path& game_directory);
+9 -5
View File
@@ -72,20 +72,24 @@ std::optional<Family> family_of_exe(const std::string& file_name) {
return std::nullopt;
}
// Whether `directory` holds the asset files of the English game (FLTD.EXE is not needed: its numbers and texts are built in).
// Whether `directory` holds the asset files of the English game and the built-in numbers have their texts (openbmh.dat):
// then FLTD.EXE is not needed. Without openbmh.dat the game needs the executable.
bool has_english_assets(const fs::path& directory) {
std::error_code ec;
if (!fs::is_directory(directory, ec)) return false;
const auto kb = find_file(directory, "KB");
return find_file(directory, "TEXTE.BLK") && find_file(directory, "M3E.MAN") && kb && fs::is_directory(*kb, ec);
return find_file(directory, "TEXTE.BLK") && find_file(directory, "M3E.MAN") && kb && fs::is_directory(*kb, ec) &&
!find_texts_file(directory).empty();
}
// Whether `directory` holds the asset files of the German game (the executable is not needed: its numbers are built in).
// Whether `directory` holds the asset files of the German game and the built-in numbers have their texts (openbmh.dat):
// then BMH.EXE is not needed. Without openbmh.dat the game needs the executable.
bool has_german_assets(const fs::path& directory) {
std::error_code ec;
if (!fs::is_directory(directory, ec)) return false;
const auto kb = find_file(directory, "KB");
return find_file(directory, "TEXTD.BLK") && find_file(directory, "M3D.MAN") && kb && fs::is_directory(*kb, ec);
return find_file(directory, "TEXTD.BLK") && find_file(directory, "M3D.MAN") && kb && fs::is_directory(*kb, ec) &&
!find_texts_file(directory).empty();
}
// Every game EXE directly in `directory`.
@@ -386,7 +390,7 @@ GameCheck check_game_directory(const fs::path& path) {
return c;
}
if (exes.empty()) {
c.problems.push_back("no BMH.EXE or FLTD.EXE in " + path_to_utf8(dir) + ", and no game asset files (TEXTD.BLK, M3D.MAN) or the English ones (TEXTE.BLK, M3E.MAN)");
c.problems.push_back("no BMH.EXE or FLTD.EXE in " + path_to_utf8(dir) + ". The game needs either BMH.EXE (FLTD.EXE for the English game) and the asset files, or openbmh.dat (from the release package) and the asset files.");
return c;
}
// a named EXE decides; otherwise the German game before the English one