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:
1 parent
32b08e3799
commit
f1f5fa523c
6 files changed
+62
-21
No files matched your search
@@ -15,10 +15,9 @@ 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.
|
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.
|
||||||
|
|
||||||
1. Have your own supported game installation available. OpenBMH needs its asset files (texts, master database, pictures, fonts, sounds); neither `BMH.EXE` nor `FLTD.EXE` is required: the numbers of the Diamond 3.7 executable and of the English Football Limited are built in, and their game texts (live commentary, messages) are in `openbmh.dat`, which ships next to the programs in the release package (without that file those texts are empty).
|
1. Have your own supported game installation available. OpenBMH needs its asset files (texts, master database, pictures, fonts, sounds) and **either** `BMH.EXE` (`FLTD.EXE` for the English game) **or** `openbmh.dat`, which ships next to the programs in the release package and holds the game texts of the original executables; the numbers of those executables are built into OpenBMH. If both are there, the executable is used. If neither is there, OpenBMH asks for the game directory or for `BMH.EXE`.
|
||||||
2. Extract the OpenBMH package into a separate directory, or alongside the game files.
|
2. Extract the OpenBMH package into a separate directory, or alongside the game files.
|
||||||
3. Start `OpenBMH` (`OpenBMH.exe` on Windows). Select the game directory (or `BMH.EXE`) when prompted. A ZIP or 7z containing one game installation can also be selected.
|
3. Start `OpenBMH` (`OpenBMH.exe` on Windows). Select the game directory (or `BMH.EXE`) when prompted. A ZIP or 7z containing one game installation can also be selected.
|
||||||
4. A BMH.EXE (or FLTD.EXE) that stays in the game directory is used as before; it carries its own edition's numbers and texts.
|
|
||||||
|
|
||||||
From a terminal in the extracted package on Linux or macOS:
|
From a terminal in the extracted package on Linux or macOS:
|
||||||
|
|
||||||
|
|||||||
@@ -6,21 +6,23 @@ selling of a listed player, and corrects the asking price shown in the market.
|
|||||||
Extended development remains separate in
|
Extended development remains separate in
|
||||||
[OpenBMH-Extended](https://github.com/Weyoune/OpenBMH-extended).
|
[OpenBMH-Extended](https://github.com/Weyoune/OpenBMH-extended).
|
||||||
|
|
||||||
## No BMH.EXE or FLTD.EXE needed
|
## BMH.EXE or openbmh.dat
|
||||||
|
|
||||||
|
- A game needs its asset files and **either** the executable (`BMH.EXE`, or
|
||||||
|
`FLTD.EXE` for the English game) **or** the file **openbmh.dat**. If both are
|
||||||
|
there, the executable is used as before. If neither is there, OpenBMH asks for
|
||||||
|
a game directory or for `BMH.EXE`.
|
||||||
- The numbers of the Diamond 3.7 executable (tables, rates, positions, prices) and
|
- The numbers of the Diamond 3.7 executable (tables, rates, positions, prices) and
|
||||||
of the English Football Limited are built into the program. A game folder, ZIP
|
of the English Football Limited are built into the program. `openbmh.dat` holds
|
||||||
or 7z with only the asset files (`TEXTD.BLK` and `M3D.MAN`, or `TEXTE.BLK`
|
the game texts of those executables (live commentary, messages). It ships next
|
||||||
and `M3E.MAN`, plus the picture, font and sound folders) is a complete game.
|
to `OpenBMH` and `openbmh_cli` in the release package and is found in the
|
||||||
A `BMH.EXE` or `FLTD.EXE` that is there is used as before.
|
game folder, in the program folder and in the current folder (or where
|
||||||
- The game texts of the original executables (live commentary, some messages) are
|
`OPENBMH_DAT` points to). A folder, ZIP or 7z with only the asset files
|
||||||
in the file **openbmh.dat**, which ships next to `OpenBMH` and `openbmh_cli`
|
(`TEXTD.BLK` and `M3D.MAN`, or `TEXTE.BLK` and `M3E.MAN`, plus the
|
||||||
in the release package. The game looks for it in the game folder, in the
|
picture, font and sound folders) is a complete game when `openbmh.dat` is
|
||||||
program folder and in the current folder (or where `OPENBMH_DAT` points to).
|
found.
|
||||||
Without the file those texts are empty and the game still runs.
|
|
||||||
- The default manager name is "OpenBMH" instead of "Nobody".
|
- The default manager name is "OpenBMH" instead of "Nobody".
|
||||||
- A recorded session gives the same output as with the real `BMH.EXE`.
|
- A recorded session gives the same output as with the real `BMH.EXE`.
|
||||||
|
|
||||||
## Changes since 1.0.9 (1.0.10 was never published; its changes are part of this release)
|
## Changes since 1.0.9 (1.0.10 was never published; its changes are part of this release)
|
||||||
|
|
||||||
- **Suchen and Vorschlag in the transfer market.** Both buttons did nothing.
|
- **Suchen and Vorschlag in the transfer market.** Both buttons did nothing.
|
||||||
@@ -73,7 +75,7 @@ Extended development remains separate in
|
|||||||
the original and cannot be reproduced exactly (documented in the source).
|
the original and cannot be reproduced exactly (documented in the source).
|
||||||
- Only one matchday and the days after it were recorded from the real 3.7; the
|
- Only one matchday and the days after it were recorded from the real 3.7; the
|
||||||
weekly processing, month changes and transfers are not yet compared.
|
weekly processing, month changes and transfers are not yet compared.
|
||||||
- The graphical client has not yet been tried with asset files only.
|
- The graphical client has not yet been tried with `openbmh.dat` and asset files only.
|
||||||
- Earlier open points remain: "player card: original atlas bounds" (#77), sporadic
|
- Earlier open points remain: "player card: original atlas bounds" (#77), sporadic
|
||||||
double clicks (#58) and the macOS match scene speed (#70).
|
double clicks (#58) and the macOS match scene speed (#70).
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
#include <system_error>
|
#include <system_error>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#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) {
|
std::filesystem::path find_texts_file(const std::filesystem::path& game_directory) {
|
||||||
if (const char* env = std::getenv("OPENBMH_DAT"); env && *env) {
|
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;
|
std::error_code ec;
|
||||||
if (std::filesystem::is_regular_file(env, ec)) return env;
|
if (std::filesystem::is_regular_file(env, ec)) return env;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
// 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 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.
|
// 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);
|
std::filesystem::path find_texts_file(const std::filesystem::path& game_directory);
|
||||||
|
|
||||||
|
|||||||
@@ -72,20 +72,24 @@ std::optional<Family> family_of_exe(const std::string& file_name) {
|
|||||||
return std::nullopt;
|
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) {
|
bool has_english_assets(const fs::path& directory) {
|
||||||
std::error_code ec;
|
std::error_code ec;
|
||||||
if (!fs::is_directory(directory, ec)) return false;
|
if (!fs::is_directory(directory, ec)) return false;
|
||||||
const auto kb = find_file(directory, "KB");
|
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) {
|
bool has_german_assets(const fs::path& directory) {
|
||||||
std::error_code ec;
|
std::error_code ec;
|
||||||
if (!fs::is_directory(directory, ec)) return false;
|
if (!fs::is_directory(directory, ec)) return false;
|
||||||
const auto kb = find_file(directory, "KB");
|
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`.
|
// Every game EXE directly in `directory`.
|
||||||
@@ -386,7 +390,7 @@ GameCheck check_game_directory(const fs::path& path) {
|
|||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
if (exes.empty()) {
|
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;
|
return c;
|
||||||
}
|
}
|
||||||
// a named EXE decides; otherwise the German game before the English one
|
// a named EXE decides; otherwise the German game before the English one
|
||||||
|
|||||||
@@ -1,12 +1,25 @@
|
|||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
#include "launch/archive.hpp"
|
#include "launch/archive.hpp"
|
||||||
|
#include "launch/game_data.hpp"
|
||||||
#include "miniz.h"
|
#include "miniz.h"
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <cstdlib>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
using namespace bmh::launch;
|
using namespace bmh::launch;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
void set_environment(const char* name, const char* value) {
|
||||||
|
#ifdef _WIN32
|
||||||
|
_putenv_s(name, value);
|
||||||
|
#else
|
||||||
|
if (*value) setenv(name, value, 1); else unsetenv(name);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
} // namespace
|
||||||
|
|
||||||
int main() try {
|
int main() try {
|
||||||
const std::string unicode = "Unit-Ä-测试 folder/archive.zip";
|
const std::string unicode = "Unit-Ä-测试 folder/archive.zip";
|
||||||
if (path_to_utf8(path_from_utf8(unicode)) != unicode)
|
if (path_to_utf8(path_from_utf8(unicode)) != unicode)
|
||||||
@@ -36,7 +49,28 @@ int main() try {
|
|||||||
const auto read = archive.read(0);
|
const auto read = archive.read(0);
|
||||||
if (std::string(read.begin(), read.end()) != payload) throw std::runtime_error("ZIP payload mismatch");
|
if (std::string(read.begin(), read.end()) != payload) throw std::runtime_error("ZIP payload mismatch");
|
||||||
std::filesystem::remove(path);
|
std::filesystem::remove(path);
|
||||||
std::cout << "Synthetic ZIP and Unicode path checks passed\n";
|
|
||||||
|
// A game folder is either BMH.EXE + assets or openbmh.dat + assets; without both the launcher asks for an executable.
|
||||||
|
// (synthetic empty files: only the choice of the way is checked, not the game data)
|
||||||
|
const auto folder = std::filesystem::temp_directory_path() /
|
||||||
|
("openbmh-unit-game-" + std::to_string(std::chrono::steady_clock::now().time_since_epoch().count()));
|
||||||
|
std::filesystem::create_directories(folder / "KB");
|
||||||
|
for (const char* name : {"TEXTD.BLK", "M3D.MAN"}) std::ofstream(folder / name).put('x');
|
||||||
|
set_environment("OPENBMH_DAT", "-"); // no texts file anywhere (the program folder of the test may hold one)
|
||||||
|
const auto without_dat = check_game_directory(folder);
|
||||||
|
const auto mentions_dat = [](const GameCheck& c) {
|
||||||
|
for (const auto& problem : c.problems) if (problem.find("openbmh.dat") != std::string::npos) return true;
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
if (without_dat.playable || !mentions_dat(without_dat))
|
||||||
|
throw std::runtime_error("assets without BMH.EXE and without openbmh.dat must ask for an executable");
|
||||||
|
set_environment("OPENBMH_DAT", "");
|
||||||
|
std::ofstream(folder / "openbmh.dat").put('x');
|
||||||
|
const auto with_dat = check_game_directory(folder);
|
||||||
|
if (with_dat.family != GameFamily::german || mentions_dat(with_dat))
|
||||||
|
throw std::runtime_error("assets with openbmh.dat are a game without executable");
|
||||||
|
std::filesystem::remove_all(folder);
|
||||||
|
std::cout << "Synthetic ZIP, Unicode path and game folder checks passed\n";
|
||||||
return 0;
|
return 0;
|
||||||
} catch (const std::exception& error) {
|
} catch (const std::exception& error) {
|
||||||
std::cerr << error.what() << '\n';
|
std::cerr << error.what() << '\n';
|
||||||
|
|||||||
Reference in new issue
Block a user