Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04ff3b7656 | ||
|
|
f7d20dad9e | ||
|
|
d661ec5eb0 | ||
|
|
048f617395 |
No files matched your search
@@ -62,4 +62,4 @@ jobs:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
RELEASE_TAG: ${{ github.ref_name }}
|
||||
run: |
|
||||
gh release create "$RELEASE_TAG" dist/*.zip dist/SHA256SUMS dist/QA-REPORT.json --draft --verify-tag --title "OpenBMH $RELEASE_TAG" --notes-file docs/release/1.0.4/RELEASE_NOTES.md
|
||||
gh release create "$RELEASE_TAG" dist/*.zip dist/SHA256SUMS dist/QA-REPORT.json --draft --verify-tag --title "OpenBMH $RELEASE_TAG" --notes-file docs/release/1.0.5/RELEASE_NOTES.md
|
||||
+5
-1
@@ -1,6 +1,6 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
cmake_minimum_required(VERSION 3.24)
|
||||
project(OpenBMH VERSION 1.0.4 LANGUAGES CXX C)
|
||||
project(OpenBMH VERSION 1.0.5 LANGUAGES CXX C)
|
||||
if(APPLE)
|
||||
# Enable native languages before dependencies/subdirectories inherit rules.
|
||||
enable_language(OBJC OBJCXX)
|
||||
@@ -964,6 +964,7 @@ bmh_add_data_test(NAME league_views_data_tests COMMAND league_views_data_tests "
|
||||
# FLTD is translated by launch_check/the launcher first. Do not point these
|
||||
# tests at the raw DOS directory: the shared UI consumes the prepared image.
|
||||
set(BMH_ENGLISH_DATA "" CACHE PATH "Prepared Football Limited game-data directory")
|
||||
bmh_add_data_test(NAME english_environment_controller_tests DATA_DIR "${BMH_ENGLISH_DATA}" COMMAND app_controller_tests "${BMH_ENGLISH_DATA}" --environment-only)
|
||||
bmh_add_data_test(NAME english_edition_startup_app_tests DATA_DIR "${BMH_ENGLISH_DATA}" COMMAND edition_startup_app_tests "${BMH_ENGLISH_DATA}")
|
||||
bmh_add_data_test(NAME english_pairings_data_tests DATA_DIR "${BMH_ENGLISH_DATA}" COMMAND league_pairings_data_tests "${BMH_ENGLISH_DATA}")
|
||||
bmh_add_data_test(NAME english_desktop_data_tests DATA_DIR "${BMH_ENGLISH_DATA}" COMMAND desktop_data_tests "${BMH_ENGLISH_DATA}" --english)
|
||||
@@ -1149,6 +1150,9 @@ foreach(dependency IN ITEMS SDL2 miniz lzma_sdk nfd)
|
||||
endforeach()
|
||||
file(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/package-dependencies.json" CONTENT "${package_dependencies}\n")
|
||||
|
||||
add_executable(environment_profile_tests tests/environment_profile_tests.cpp)
|
||||
target_link_libraries(environment_profile_tests PRIVATE bmhcore)
|
||||
add_test(NAME environment_profile_tests COMMAND environment_profile_tests)
|
||||
add_executable(classic_rules_unit_tests tests/classic_rules_unit_tests.cpp)
|
||||
target_link_libraries(classic_rules_unit_tests PRIVATE bmhcore)
|
||||
add_test(NAME classic_rules_unit_tests COMMAND classic_rules_unit_tests)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# OpenBMH
|
||||
|
||||
**Classic-Version: 1.0.4.** Die originalgetreue Linie bleibt in diesem Repository.
|
||||
**Classic-Version: 1.0.5.** Die originalgetreue Linie bleibt in diesem Repository.
|
||||
Erweiterte Ligen, die gemeinsame deutsche/englische Karriere und der Dateneditor
|
||||
werden separat als **[OpenBMH-Extended 1.0 Beta](https://github.com/Weyoune/OpenBMH-extended)** entwickelt.
|
||||
|
||||
@@ -28,7 +28,7 @@ From a terminal in the extracted package on Linux or macOS:
|
||||
|
||||
In Windows PowerShell, use `.\OpenBMH.exe` and `.\openbmh_cli.exe` instead.
|
||||
|
||||
Use a writable save directory and keep backups of existing games. German editions are the primary compatibility target. **Football Limited / English data support is experimental**; original V2.20 save import and some edition-specific behaviour remain limited. See the [release notes](docs/release/1.0.4/RELEASE_NOTES.md).
|
||||
Use a writable save directory and keep backups of existing games. German editions are the primary compatibility target. **Football Limited / English data support is experimental**; original V2.20 save import and some edition-specific behaviour remain limited. See the [release notes](docs/release/1.0.5/RELEASE_NOTES.md).
|
||||
|
||||
## Features and direction
|
||||
|
||||
|
||||
+10
-3
@@ -2,7 +2,7 @@
|
||||
|
||||
OpenBMH aims to preserve the familiar game while handling malformed input and unsafe edge cases explicitly. A reconstruction can remain faithful without reproducing a crash or pretending to implement an unknown path.
|
||||
|
||||
- Content such as names, text, graphics and edition-specific tables is loaded from the user's installation. The loaded program retains its own rule-table values; loading no longer applies the former shared replacement profile.
|
||||
- Names, text, graphics and compatible data tables come from the user's installation. The common gameplay implementation follows the documented Diamond 3.7 engine policy; original programme instructions are not executed or selected as separate engines.
|
||||
- Safety checks reject transactions that would exhaust required return capacity, use stale identities or lose a valid state. Unsupported operations report their limitation rather than inventing an outcome.
|
||||
- Calendar progression handles boundary days and seasonal transitions without relying on unsafe fixed-day assumptions.
|
||||
- Saves are written from the committed session state. Saving does not deliberately replay unrelated game actions.
|
||||
@@ -23,11 +23,18 @@ An unavailable native message box also cancels the request. This applies to
|
||||
voluntary application exits, including quit events received during animations;
|
||||
normal completed-career handling remains separate.
|
||||
|
||||
## Original edition rules in 1.0
|
||||
## Common engine and source data
|
||||
|
||||
Loaded executable images retain their own rule tables. Career strength ranges are read from all nine pairs of the supplied original table.
|
||||
|
||||
The six-budget monthly environment implementation has been checked against the provided CD and Diamond 3.6/3.7 program code. Its budget increments are read from that program's own table. Capability recognition uses verified code fingerprints, never directory names. Unrecognized environment implementations cannot be edited or simulated through a guessed model; they require separate compatibility verification. Older Diamond academy patches are not silently treated as the monthly model. The old floppy executable remains unsupported, and Football Limited remains experimental.
|
||||
The common engine uses the Diamond 3.7 six-budget monthly environment model for every supported source-data edition, including Diamond 3.6 and Football Limited. Original programme instruction fingerprints do not select another engine or block compatible data. The six numeric budget increments are read from the supplied table and installed together only when all are present and nonzero; malformed layouts remain rejected. Existing saved lump-sum academy contracts retain their established accounting until edited. English translation supplies the actual English geometry, steps and suffixes for this common model. The old floppy executable remains unsupported, and Football Limited remains experimental.
|
||||
|
||||
Football Limited's data distinguishes five internal domestic slots from four
|
||||
player-visible levels. Fresh manager selection cycles those four levels and
|
||||
hides the internal fifth picker group; confirmation rejects hidden targets and
|
||||
clubs before changing options or consuming RNG. Additional club pages remain
|
||||
separate. Internal sizes, squads, rankings and fixtures are retained, and saved
|
||||
internal league values do not cause a general load rejection.
|
||||
|
||||
Release acceptance of individual editions is recorded separately from their recognition. Source compatibility and automated tests do not establish full original-game or platform validation.
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ describe deliberate changes; they are not a list of every known compatibility li
|
||||
- [src/game/desk_actions.cpp](../src/game/desk_actions.cpp): uses the supported transfer-fee arithmetic and designated set-piece fields.
|
||||
- [src/game/desk_actions.hpp](../src/game/desk_actions.hpp): supports designated set-piece records and the supported transfer-editor rules.
|
||||
- [src/game/desk_actions.hpp](../src/game/desk_actions.hpp): a seller may accept an existing bid before expiry.
|
||||
- [src/game/environment.cpp](../src/game/environment.cpp): the common Diamond 3.7 monthly environment model applies to every supported source-data edition.
|
||||
- [src/game/highscore.cpp](../src/game/highscore.cpp): reads the supported edition-specific high-score format from the loaded image.
|
||||
- [src/game/lineup.hpp](../src/game/lineup.hpp): supports owner-bound designated set-piece selection.
|
||||
- [src/game/match.hpp](../src/game/match.hpp): uses the enhanced injury selection and suspension rules.
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
# OpenBMH Classic 1.0.5
|
||||
|
||||
This patch fixes environment access with compatible older DIAMOND data and
|
||||
English contract labels. It requires the player's own game installation.
|
||||
Extended development remains separate in
|
||||
[OpenBMH-Extended](https://github.com/Weyoune/OpenBMH-extended).
|
||||
|
||||
## Changes since 1.0.4
|
||||
|
||||
- Environment management uses the common Diamond 3.7 monthly model for supported
|
||||
source-data editions. Different original programme instructions no longer
|
||||
block compatible numeric data. Six budget steps are validated and installed
|
||||
together; malformed layouts and artwork bounds remain guarded. Existing
|
||||
saved lump-sum academy budgets retain their accounting until edited.
|
||||
- Football Limited translation supplies its actual environment geometry,
|
||||
numeric steps and suffixes. Selecting the original English installation
|
||||
rebuilds older translated caches automatically.
|
||||
- Contract tabs use the installation's original text and font path, including
|
||||
English data, salary and team-bonus captions.
|
||||
- English manager selection exposes the Original four starting levels. The
|
||||
fifth internal data league remains in the model, squads, rankings and fixture
|
||||
data. Hidden targets/clubs are rejected before fresh-manager mutation or RNG;
|
||||
existing saved league values are not generally rejected.
|
||||
|
||||
## Validation and human QA
|
||||
|
||||
Release publication requires successful Windows x64, macOS ARM64 and Linux x64
|
||||
builds, configured tests, product-version checks and package/source verification
|
||||
for the exact tagged revision. Downloads include checksums, a platform test
|
||||
report and corresponding source with pinned open-source dependencies.
|
||||
|
||||
Local checks use an older primary DIAMOND installation, separately identified
|
||||
Diamond 3.6 and 3.7 data, German CD data and translated Football Limited data.
|
||||
They cover all six environment controls, transaction ownership and unchanged RNG,
|
||||
source-language contract glyphs, valid manager selection and hidden-level refusal.
|
||||
Native Linux before/after checks reproduce the older DIAMOND menu block and
|
||||
verify the corrected environment screen and English contract captions. The older
|
||||
package's precise edition name remains unconfirmed; the separately supplied
|
||||
3.6 installation also passed the original controller check.
|
||||
|
||||
Issues [#55](https://github.com/Weyoune/openbmh/issues/55) and
|
||||
[#56](https://github.com/Weyoune/openbmh/issues/56) remain open for human QA.
|
||||
Native Windows/macOS gameplay acceptance is not established by CI builds.
|
||||
|
||||
## Known limits
|
||||
|
||||
The compatibility and long-career limits documented for
|
||||
[1.0.3](../1.0.3/RELEASE_NOTES.md) remain. Football Limited is experimental;
|
||||
its original V2.20 save layout remains unsupported. Keep backups of saves.
|
||||
macOS packages are unsigned terminal executables, not notarised app bundles.
|
||||
|
||||
No original executables, databases, saves, graphics or audio are included.
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "game/calendar.hpp"
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "app/career_session.hpp"
|
||||
#include "formats/league_visibility.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
#include <system_error>
|
||||
@@ -728,6 +729,9 @@ bool CareerSession::confirm_manager_join(const ui::ManagerChoice& choice, std::s
|
||||
selected.name = choice.name; selected.team = runtime_club(draft.state, choice.master_club);
|
||||
selected.league = choice.start_league; selected.strength = choice.strength; selected.portrait = choice.portrait;
|
||||
if (selected.team < 0) throw FormatError("join: club not found");
|
||||
const auto visible=player_league_count(exe_);
|
||||
const auto club_league=team_league(selected.team);
|
||||
if(selected.league>=visible||(club_league>=visible&&club_league<5))throw FormatError("join: league is not available for human management");
|
||||
MinuteReport report;
|
||||
if (!career_add_manager(draft.state, exe_, choice.slot, selected, true, draft.game, draft.rand, report))
|
||||
throw FormatError(report.reason);
|
||||
@@ -807,6 +811,12 @@ void CareerSession::apply_options(const ui::SetupOptions& o) {
|
||||
bool CareerSession::confirm_manager(const ui::SetupOptions& options, const ui::ManagerChoice& choice, std::string& error) {
|
||||
if (balance_draft_ || balance_dispatch_active_ || strengths_owner_ || strengths_dispatch_active_ ||
|
||||
top_scorers_owner_ || top_scorers_dispatch_active_ || stadium_.block_expansion || other_games_owner_ || other_games_dispatch_active_) { error = "strengths_active"; return false; }
|
||||
const auto visible=player_league_count(exe_);
|
||||
const auto selected_team=runtime_club(choice.master_club);
|
||||
const auto selected_league=selected_team>=0?team_league(selected_team):-1;
|
||||
if(choice.start_league<0||choice.start_league>=visible||(selected_league>=visible&&selected_league<5)) {
|
||||
error="league is not available for human management";return false;
|
||||
}
|
||||
if (!options_applied_) apply_options(options);
|
||||
const int m = int(managers_.size());
|
||||
if (m >= options.managers) {
|
||||
|
||||
@@ -874,6 +874,13 @@ inline constexpr auto EnglishLayoutTranslation255 = 0x6f0ec;
|
||||
inline constexpr auto EnglishLayoutTranslation256 = 0x6f2ae;
|
||||
inline constexpr auto EnglishLayoutTranslation257 = 0x6f2d4;
|
||||
inline constexpr auto EnglishLayoutTranslation258 = 0x6f2e0;
|
||||
// English six-budget environment data used by the common monthly model.
|
||||
inline constexpr auto EnglishEnvironmentTileX = 0x6d230;
|
||||
inline constexpr auto EnglishEnvironmentTileY = 0x6d238;
|
||||
inline constexpr auto EnglishEnvironmentYouthColors = 0x6d240;
|
||||
inline constexpr auto EnglishEnvironmentBudgetSteps = 0x6d244;
|
||||
inline constexpr auto EnglishEnvironmentYouthPositionSuffix = 0x6d24a;
|
||||
inline constexpr auto EnglishEnvironmentCostSuffix = 0x6d24f;
|
||||
inline constexpr auto EnglishLayoutTranslation259 = 0x6f2fc;
|
||||
inline constexpr auto EnglishLayoutTranslation26 = 0x6bf2c;
|
||||
inline constexpr auto EnglishLayoutTranslation260 = 0x6f300;
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#pragma once
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "formats/le.hpp"
|
||||
#include <stdexcept>
|
||||
namespace bmh {
|
||||
// Original data separates internal domestic slots from player-visible levels.
|
||||
inline int player_league_count(const LeImage& image) {
|
||||
const auto address=layout::LeaguePairings_LeaguePairingsConstants_RuntimeField;
|
||||
if(!image.contains(address+1)||image.u8(address)!=5||image.u8(address+1)<1||image.u8(address+1)>5)
|
||||
throw std::invalid_argument("invalid player-facing league count");
|
||||
return image.u8(address+1);
|
||||
}
|
||||
}
|
||||
+10
-12
@@ -33,18 +33,16 @@ uint32_t academy_paid(const GameState& g, int manager) {
|
||||
}
|
||||
}
|
||||
void install_environment_rules(const LeImage& exe) {
|
||||
for (size_t i=0;i<kEnvironmentStep.size();++i) {
|
||||
const uint32_t at=layout::EnvironmentBudgetSteps+uint32_t(i);
|
||||
if (!exe.contains(at) || exe.u8(at)==0) { supported_environment=false; return; }
|
||||
kEnvironmentStep[i]=int32_t(exe.u8(at))*1000;
|
||||
// OpenBMH deviates from the original: the common Diamond 3.7 monthly
|
||||
// environment model applies to every supported source-data edition.
|
||||
// Numeric steps are data; an edition's original instructions are not run.
|
||||
auto steps=kEnvironmentStep;
|
||||
for(size_t i=0;i<steps.size();++i) {
|
||||
const auto at=layout::EnvironmentBudgetSteps+uint32_t(i);
|
||||
if(!exe.contains(at)||exe.u8(at)==0){supported_environment=false;return;}
|
||||
steps[i]=int32_t(exe.u8(at))*1000;
|
||||
}
|
||||
uint64_t fingerprint = 14695981039346656037ull;
|
||||
for (const auto [first,last] : {std::pair{layout::EnvironmentVerifiedCodeBegin,layout::EnvironmentVerifiedCodeEnd},std::pair{layout::EnvironmentVerifiedHookBegin,layout::EnvironmentVerifiedHookEnd}}) {
|
||||
if (!exe.contains(first) || !exe.contains(last-1)) { supported_environment=false; return; }
|
||||
for (uint32_t at=first;at<last;++at) fingerprint=(fingerprint ^ exe.u8(at))*1099511628211ull;
|
||||
}
|
||||
// Fingerprints identify verified behaviour, not filenames, dates or artwork.
|
||||
supported_environment = fingerprint==0xc2488a656f340e99ull || fingerprint==0x19adba7ef3eda507ull;
|
||||
kEnvironmentStep=steps;supported_environment=true;
|
||||
}
|
||||
bool environment_rules_supported() { return supported_environment; }
|
||||
int32_t environment_monthly_cost(const GameState& g, int manager, int item) {
|
||||
@@ -57,7 +55,7 @@ bool environment_academy_active(const GameState& g, int manager) {
|
||||
return value != 0 && (!legacy_academy(g, manager) || academy_paid(g, manager) >= value);
|
||||
}
|
||||
EnvironmentState environment_state(const GameState& g, int manager) {
|
||||
if (!supported_environment) throw FormatError("environment: this original program variant is not verified");
|
||||
if (!supported_environment) throw FormatError("environment: monthly budget steps are missing or invalid");
|
||||
validate_manager(g, manager);
|
||||
EnvironmentState result;
|
||||
for (int i = 0; i < kEnvironmentItems; ++i) {
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
#include "game/state.hpp"
|
||||
|
||||
namespace bmh {
|
||||
// Verified original-program capability; unknown environment variants are not guessed.
|
||||
// Install validated numeric steps for the common Diamond 3.7 monthly model.
|
||||
void install_environment_rules(const LeImage&);
|
||||
bool environment_rules_supported();
|
||||
constexpr int kEnvironmentItems = 6;
|
||||
enum EnvironmentItem : int { kYouthYoungest = 0, kYouthAcademy = 1, kYouthOldest = 2,
|
||||
kCoTrainer = 3, kDoctor = 4, kPhysio = 5 };
|
||||
// Monthly environment model verified in the supported CD and Diamond 3.6/3.7 programs.
|
||||
// Canonical monthly environment model; source editions supply compatible data.
|
||||
inline std::array<int32_t, kEnvironmentItems> kEnvironmentStep = {2000, 4000, 5000, 5000, 5000, 5000};
|
||||
struct EnvironmentState {
|
||||
std::array<int32_t, kEnvironmentItems> monthly{};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "launch/fltd.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <stdexcept>
|
||||
@@ -129,6 +130,12 @@ LeImage translate_fltd(const fs::path& fltd_exe) {
|
||||
for (uint32_t i = 0; i < 11 * 11; ++i)
|
||||
put(::bmh::layout::OriginalPointerPixels + i,
|
||||
en(::bmh::layout::EnglishOriginalPointerPixels + i));
|
||||
// Copy the actual English six-budget geometry, numeric steps and suffixes
|
||||
// for the common monthly environment model.
|
||||
for(const auto [to,from,count]:{std::array<uint32_t,3>{layout::Environment_FormatError_RuntimeField,layout::EnglishEnvironmentTileX,6},
|
||||
{layout::Environment_FormatError_RuntimeField2,layout::EnglishEnvironmentTileY,6},{layout::EnvironmentYouthColors,layout::EnglishEnvironmentYouthColors,3},
|
||||
{layout::EnvironmentBudgetSteps,layout::EnglishEnvironmentBudgetSteps,6},{layout::EnvironmentYouthPositionSuffix,layout::EnglishEnvironmentYouthPositionSuffix,5},
|
||||
{layout::EnvironmentCostSuffix,layout::EnglishEnvironmentCostSuffix,2}})for(uint32_t i=0;i<count;++i)put(to+i,en(from+i));
|
||||
LeImage out = LeImage::from_bytes(kDeBase, std::move(image));
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -379,7 +379,7 @@ ResolvedGame resolve_game(const fs::path& input, const fs::path& cache) {
|
||||
const fs::path marker = prepared / ".openbmh-english";
|
||||
// the version of the translation (launch/fltd.cpp, fltd_map.inc): a cache built
|
||||
// by another version is built again
|
||||
constexpr const char* kTranslation = "english translation 16"; // 16: overwrite question pointer (15: original pitch affinity tables and pointer bitmap)
|
||||
constexpr const char* kTranslation = "english translation 17"; // 17: English monthly environment tables (16: overwrite question)
|
||||
std::string built;
|
||||
{
|
||||
std::ifstream in(marker);
|
||||
|
||||
@@ -396,7 +396,7 @@ Image ContractsScreen::render() const {
|
||||
}
|
||||
const auto selected = std::find_if(state_.players.begin(), state_.players.end(),
|
||||
[&](const auto& p) { return p.row == state_.selected_row; });
|
||||
static constexpr std::array<std::string_view, 4> tabs{"DATEN-A", "DATEN-B", "GEHALT", "TEAM-PRÄMIEN"};
|
||||
const std::array<std::string,4> tabs{original_to_utf8(texts_[117]),original_to_utf8(texts_[118]),original_to_utf8(texts_[119]),original_to_utf8(texts_[120])};
|
||||
for (int i = 0; i < (state_.mode_three?4:3); ++i) {
|
||||
const int x = i * 60 + 2, w = i == 3 ? 71 : 51;
|
||||
if(i!=tab_) {fill(out,x+2,225,w,2,0x40);fill(out,x+w,217,2,10,0x40);}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#include "ui/contracts.hpp"
|
||||
#include "ui/source_notice_test_helpers.hpp"
|
||||
#include "ui/manager.hpp"
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "formats/textd.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
@@ -23,6 +26,20 @@ int main(int argc, char** argv) {
|
||||
state.club_name = "UNIT FOOTBALL CLUB";
|
||||
state.players.push_back({0, 150, "TORWART", 25, 0, 8, 180000});
|
||||
state.players.push_back({1, 151, "STÜRMER", 21, 3, 14, 90000});
|
||||
{
|
||||
auto language_state=state;language_state.mode_three=true;
|
||||
ContractsScreen language(argv[1],language_state);const auto frame=language.render();
|
||||
const auto data=std::filesystem::path(argv[1]);const auto exe=bmh::load_le(asset_path(data,"BMH.exe"));
|
||||
const auto texts=bmh::load_textd(asset_path(data,"TEXTD.BLK"));SpriteFont source_font(data);
|
||||
for(int tab=0;tab<4;++tab) {
|
||||
const auto caption=original_to_utf8(texts[size_t(117+tab)]);const int width=tab==3?71:51;
|
||||
const int x=tab*60+2+(tab==2?2:0),y=215+(tab==2?2:0);
|
||||
bmh::Image expected(320,240,0xfd);
|
||||
source_font.draw(expected,x+width/2-source_font.text_width(caption)/2,y+7,caption,exe.u8(bmh::layout::Advertising_Button_RuntimeField+(tab==2)));
|
||||
size_t ink=0;for(size_t pixel=0;pixel<expected.pixels.size();++pixel)if(expected.pixels[pixel]!=0xfd){check(frame.pixels[pixel]==expected.pixels[pixel],"contract tab does not render its authoritative source-language caption");++ink;}
|
||||
check(ink>10,"source-language contract tab oracle contains no glyphs");
|
||||
}
|
||||
}
|
||||
auto blocked_state = state;
|
||||
blocked_state.players[0].offer_blocked = true;
|
||||
ContractsScreen blocked(argv[1], blocked_state);
|
||||
|
||||
@@ -157,6 +157,8 @@ EnvironmentScreen::EnvironmentScreen(const std::filesystem::path& data, Environm
|
||||
background_.height != 240 || tiles_.width != 306 || tiles_.height != 111 ||
|
||||
panel_.width <= 0 || texts_.strings.size() != TEXT_COUNT)
|
||||
throw FormatError("environment: unsupported owner or Original assets");
|
||||
for(int item=0;item<kEnvironmentItems;++item){const int x=exe_.u8(layout::Environment_FormatError_RuntimeField+item),y=exe_.u8(layout::Environment_FormatError_RuntimeField2+item);
|
||||
if(x<9||x+0x36>=320||y<10||y+0x31+(item<3?6:0)>=240)throw FormatError("environment: tile geometry outside Original screen");}
|
||||
}
|
||||
|
||||
void EnvironmentScreen::text(Image& out, int x, int baseline, std::string_view value,
|
||||
|
||||
+7
-2
@@ -2,6 +2,7 @@
|
||||
#include "formats/badge_policy.hpp"
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "ui/manager.hpp"
|
||||
#include "formats/league_visibility.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iomanip>
|
||||
@@ -151,6 +152,7 @@ ManagerScreen::ManagerScreen(const std::filesystem::path& data, int slot, const
|
||||
if (exe_.u8(::bmh::layout::Manager_FormatError_RuntimeField + i * 2) < 'B') ++text_id;
|
||||
if (last_[i] - first_[i] >= 20) throw FormatError("manager: league exceeds picker grid");
|
||||
}
|
||||
for(int i=player_league_count(exe_);i<5;++i){last_[i]=first_[i]-1;leagues_[i].clear();}
|
||||
first_[5] = exe_.u16(::bmh::layout::CareerSession_DispatchLineup_RuntimeField); last_[5] = first_[5] + 19;
|
||||
first_[6] = first_[5] + 20; last_[6] = first_[5] + exe_.u16(::bmh::layout::CareerSession_InstallLeagueSizes_RuntimeField6) - 1;
|
||||
leagues_[5] = texts_[(::bmh::layout::Manager_FormatError_TextPointer - ::bmh::layout::TextPointerTable) / 4]; leagues_[6] = leagues_[5];
|
||||
@@ -160,6 +162,8 @@ ManagerScreen::ManagerScreen(const std::filesystem::path& data, int slot, const
|
||||
throw FormatError("manager: unsupported extra-team table");
|
||||
}
|
||||
|
||||
int ManagerScreen::visible_league_count() const {return player_league_count(exe_);}
|
||||
|
||||
int ManagerScreen::master_id(int selection_id) const {
|
||||
return context_.club_order.at(size_t(selection_id));
|
||||
}
|
||||
@@ -206,6 +210,7 @@ bool ManagerScreen::click(int x, int y, bool right) {
|
||||
for (int i = 0; i < 7; ++i) {
|
||||
int bx = i < 4 ? 64 : 161, by = 175 + (i < 4 ? i : i - 4) * 11;
|
||||
if (x >= bx && x <= bx + 94 && y >= by && y <= by + 10) {
|
||||
if(i<5&&i>=visible_league_count())return false;
|
||||
bool changed = group_ != i; group_ = i; hover_ = hovered_club(x, y); return changed;
|
||||
}
|
||||
}
|
||||
@@ -227,7 +232,7 @@ bool ManagerScreen::click(int x, int y, bool right) {
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (x < field_x_[i] || x > field_x_[i] + field_width_[i] || y < baseline_[i] - 26 || y > baseline_[i] + 3) continue;
|
||||
if (i == 0) { choice_.name.clear(); view_ = ManagerView::name_edit; return true; }
|
||||
if (i == 1) { choice_.start_league = (choice_.start_league + 1) % 5; return true; }
|
||||
if (i == 1) { choice_.start_league = (choice_.start_league + 1) % visible_league_count(); return true; }
|
||||
if (i == 2) open_clubs = true;
|
||||
if (i == 3) { choice_.strength = (choice_.strength + 1) % 3; return true; }
|
||||
}
|
||||
@@ -369,7 +374,7 @@ Image ManagerScreen::render() const {
|
||||
if (choice_.selection_club == id) copy(out, faces_, 228, 0, x + 24, y + 23, 11, 13, true);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 7; ++i)
|
||||
for (int i = 0; i < 7; ++i)if(i>=5||i<visible_league_count())
|
||||
button(out, i < 4 ? 64 : 161, 175 + (i < 4 ? i : i - 4) * 11, 94, leagues_[i], group_ == i);
|
||||
// Hover clear uses a new local pattern origin, even when no club is hovered.
|
||||
pattern(out, 81, 222, 151, 8);
|
||||
|
||||
@@ -56,6 +56,7 @@ public:
|
||||
// builds them from the executable's tables: label (original encoding) and the inclusive
|
||||
// range of selection indices. Used by the console (openbmh_cli) for ListTeams.
|
||||
static constexpr int group_count = 7;
|
||||
int visible_league_count() const;
|
||||
const std::string& group_label(int group) const { return leagues_.at(size_t(group)); }
|
||||
int group_first(int group) const { return first_.at(size_t(group)); }
|
||||
int group_last(int group) const { return last_.at(size_t(group)); }
|
||||
|
||||
@@ -18,7 +18,12 @@ int main(int argc, char** argv) {
|
||||
check(s.choice().master_club == 0 && s.choice().portrait == 0, "default available identity");
|
||||
check(s.render().pixels.size() == 320 * 240, "original manager framebuffer");
|
||||
check(!s.click(320, 10, true) && !s.text("ignored"), "invalid point and inactive text input");
|
||||
for (int i = 0; i < 5; ++i) s.click(30, 140);
|
||||
for (int i = 0; i < s.visible_league_count(); ++i) s.click(30, 140);
|
||||
if(s.visible_league_count()==4) {
|
||||
check(s.group_label(4).empty()&&s.group_last(4)<s.group_first(4),"hidden English domestic group remains selectable");
|
||||
check(s.click(200,95),"English club picker opens");const auto unchanged=s.choice();
|
||||
check(!s.click(180,180)&&s.choice()==unchanged,"hidden English group accepted a click");s.click(5,225,true);
|
||||
}
|
||||
for (int i = 0; i < 3; ++i) s.click(220, 140);
|
||||
check(s.choice().start_league == 0 && s.choice().strength == 1, "league and strength wrap");
|
||||
check(s.click(30, 65) && s.choice().name.empty(), "starting edit clears name like original");
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "test_inputs.hpp"
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "formats/league_visibility.hpp"
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <cstdio>
|
||||
@@ -1646,6 +1647,20 @@ void check_advertising_controller(const std::filesystem::path& data) {
|
||||
"replayed accepted advertisement cannot consume a second revision or another offer");
|
||||
}
|
||||
|
||||
void check_player_league_visibility_controller(const std::filesystem::path& data) {
|
||||
const auto exe=load_le(asset_path(data,"BMH.exe"));const auto visible=player_league_count(exe);
|
||||
if(visible==5)return;
|
||||
app::CareerSession session(data,0x1789abcd);const auto before=save_stream(session.state());
|
||||
const auto game=session.game();const auto random=session.rand();SetupOptions options;options.world=false;options.league=true;options.managers=1;
|
||||
const auto context=session.selection_context(0);ManagerChoice choice;choice.master_club=context.club_order[0];choice.name="Visibility";choice.start_league=visible;
|
||||
std::string error;
|
||||
check(!session.confirm_manager(options,choice,error)&&!error.empty()&&save_stream(session.state())==before&&session.game().calls()==game.calls()&&session.rand().calls()==random.calls(),"hidden target league changed initial options/state/RNG");
|
||||
int first=0;for(int league=0;league<visible;++league)first+=exe.u8(::bmh::layout::LeagueSizes+uint32_t(league));
|
||||
choice.start_league=0;choice.master_club=context.club_order.at(size_t(first));error.clear();
|
||||
check(!session.confirm_manager(options,choice,error)&&!error.empty()&&save_stream(session.state())==before&&session.game().seed()==game.seed()&&session.rand().seed()==random.seed(),"hidden club entered fresh human management");
|
||||
choice.master_club=context.club_order[0];error.clear();check(session.confirm_manager(options,choice,error),"valid visible league failed after rejected hidden choices");
|
||||
}
|
||||
|
||||
void check_environment_controller(const std::filesystem::path& data) {
|
||||
StartupFlow flow(data);
|
||||
flow.click(150, 215); flow.click(5, 225, true); flow.click(5, 225, true);
|
||||
@@ -7120,6 +7135,9 @@ int main(int argc, char** argv) {
|
||||
if(argc==3 && std::string_view(argv[2])=="--desktop-input-only") {
|
||||
check_date_widget_controller(data); check_menu_layout_session_io(data); check_desk_widgets(data); return 0;
|
||||
}
|
||||
if(argc==3 && std::string_view(argv[2])=="--selection-visibility-only") {
|
||||
check_player_league_visibility_controller(data);return 0;
|
||||
}
|
||||
if(argc==3 && std::string_view(argv[2])=="--environment-only") {
|
||||
check_environment_controller(data);return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "game/environment.hpp"
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
|
||||
using namespace bmh;
|
||||
namespace {void check(bool value,const char* message){if(!value)throw std::runtime_error(message);}}
|
||||
int main()try {
|
||||
const std::array<uint8_t,6> source{2,4,5,5,5,5};
|
||||
auto image=LeImage::from_bytes(layout::EnvironmentBudgetSteps,Bytes(source.begin(),source.end()));
|
||||
install_environment_rules(image);
|
||||
check(environment_rules_supported()&&kEnvironmentStep==std::array<int32_t,6>{2000,4000,5000,5000,5000,5000},
|
||||
"valid source steps require the common model without original instructions");
|
||||
const auto previous=kEnvironmentStep;
|
||||
auto missing=LeImage::from_bytes(layout::EnvironmentBudgetSteps,Bytes(source.begin(),source.end()-1));
|
||||
install_environment_rules(missing);check(!environment_rules_supported()&&kEnvironmentStep==previous,"missing final step partially installed");
|
||||
auto malformed=image;const uint8_t changed=9;malformed.patch(layout::EnvironmentBudgetSteps,&changed,1);const uint8_t zero=0;malformed.patch(layout::EnvironmentBudgetSteps+3,&zero,1);
|
||||
install_environment_rules(malformed);check(!environment_rules_supported()&&kEnvironmentStep==previous,"zero step partially installed");
|
||||
install_environment_rules(image);check(environment_rules_supported()&&kEnvironmentStep==previous,"valid profile could not recover after rejected input");
|
||||
GameState state;state.memory.add_block(layout::Spending,4*0x24);
|
||||
state.memory.set32(layout::Spending,12000);state.memory.set32(layout::Spending+4,24000);
|
||||
check(environment_monthly_cost(state,0,0)==12000&&environment_monthly_cost(state,0,1)==24000,"common profile changed owned monthly budgets");
|
||||
std::cout<<"Common Diamond3.7 monthly model accepts valid data without instruction provenance and rejects malformed numeric steps atomically\n";
|
||||
return 0;
|
||||
}catch(const std::exception& e){std::cerr<<e.what()<<'\n';return 1;}
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "fixture_tables.hpp"
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "formats/le.hpp"
|
||||
#include "formats/league_visibility.hpp"
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
#include <stdexcept>
|
||||
@@ -19,6 +20,11 @@ void same(const std::vector<Fixture>& a, const std::vector<Fixture>& b) {
|
||||
check(a[i].home == b[i].home && a[i].away == b[i].away, "fixture ownership changed");
|
||||
}
|
||||
void unit() {
|
||||
const auto address=layout::LeaguePairings_LeaguePairingsConstants_RuntimeField;
|
||||
check(player_league_count(LeImage::from_bytes(address,Bytes{5,4,9}))==4&&player_league_count(LeImage::from_bytes(address,Bytes{5,5,9}))==5,"player-visible leagues replaced internal catalogue counts");
|
||||
invalid([&]{player_league_count(LeImage::from_bytes(address,Bytes{5,0,9}));});
|
||||
invalid([&]{player_league_count(LeImage::from_bytes(address,Bytes{5,6,9}));});
|
||||
invalid([&]{player_league_count(LeImage::from_bytes(address,Bytes{5}));});
|
||||
const auto authored = bmh::test::authored_fixture_tables();
|
||||
set_fixture_tables(authored);
|
||||
for (const auto& [teams, rows] : authored) {
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "launch/fltd.hpp"
|
||||
#include "game/environment.hpp"
|
||||
#include "formats/league_visibility.hpp"
|
||||
|
||||
#include <chrono>
|
||||
#include <array>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
@@ -40,6 +43,7 @@ int main() {
|
||||
analytics_labels[i] = uint8_t(0x31 + i * 3);
|
||||
put(layout::EnglishLayoutTranslation50 + i, analytics_labels[i]);
|
||||
}
|
||||
put(layout::EnglishLayoutTranslation259,5);put(layout::EnglishLayoutTranslation259+1,4);put(layout::EnglishLayoutTranslation259+2,9);
|
||||
const uint8_t toggle_rows[] = {3, 7, 11, 13, 17, 19};
|
||||
put(layout::EnglishLayoutTranslation16 - 1, 99); // alignment padding is not a toggle row
|
||||
for (uint32_t i = 0; i < 6; ++i) put(layout::EnglishLayoutTranslation16 + i, toggle_rows[i]);
|
||||
@@ -50,6 +54,12 @@ int main() {
|
||||
put(layout::EnglishDesktopBinSourceY + i, uint8_t(20 + i));
|
||||
put(layout::EnglishDesktopSocketSourceX + i, uint8_t(30 + i));
|
||||
}
|
||||
const std::array<uint8_t,6> environment_x{20,80,140,200,250,20},environment_y{40,40,40,80,80,140},environment_steps{2,4,5,5,5,5};
|
||||
for(uint32_t i=0;i<6;++i){put(layout::EnglishEnvironmentTileX+i,environment_x[i]);put(layout::EnglishEnvironmentTileY+i,environment_y[i]);put(layout::EnglishEnvironmentBudgetSteps+i,environment_steps[i]);}
|
||||
const std::array<uint8_t,3> youth_colors{0x41,0x42,0x43};for(uint32_t i=0;i<3;++i)put(layout::EnglishEnvironmentYouthColors+i,youth_colors[i]);
|
||||
const std::string position_suffix=". / ",cost_suffix=".";
|
||||
for(uint32_t i=0;i<=position_suffix.size();++i)put(layout::EnglishEnvironmentYouthPositionSuffix+i,i<position_suffix.size()?uint8_t(position_suffix[i]):0);
|
||||
for(uint32_t i=0;i<=cost_suffix.size();++i)put(layout::EnglishEnvironmentCostSuffix+i,i<cost_suffix.size()?uint8_t(cost_suffix[i]):0);
|
||||
const auto path = root / "FLTD.EXE";
|
||||
{ std::ofstream out(path, std::ios::binary); out.write(reinterpret_cast<const char*>(source.data()), std::streamsize(source.size())); }
|
||||
const auto image = launch::translate_fltd(path);
|
||||
@@ -75,6 +85,11 @@ int main() {
|
||||
check(image.u8(layout::Desktop_Render_RuntimeField2 + i) == 20 + i, "bin source y");
|
||||
check(image.u8(layout::Desktop_Render_RuntimeField3 + i) == 30 + i, "socket source x");
|
||||
}
|
||||
for(uint32_t i=0;i<6;++i)check(image.u8(layout::Environment_FormatError_RuntimeField+i)==environment_x[i]&&image.u8(layout::Environment_FormatError_RuntimeField2+i)==environment_y[i]&&image.u8(layout::EnvironmentBudgetSteps+i)==environment_steps[i],"English environment geometry/steps lost source table alignment");
|
||||
for(uint32_t i=0;i<3;++i)check(image.u8(layout::EnvironmentYouthColors+i)==youth_colors[i],"English youth colours lost source alignment");
|
||||
check(image.cstring(layout::EnvironmentYouthPositionSuffix)==position_suffix&&image.cstring(layout::EnvironmentCostSuffix)==cost_suffix,"English environment suffix mapping is incomplete");
|
||||
install_environment_rules(image);check(environment_rules_supported(),"authored English numeric profile depends on source instructions");
|
||||
check(player_league_count(image)==4&&image.u8(layout::LeaguePairings_LeaguePairingsConstants_RuntimeField)==5,"English visible league count overwrote internal leagues");
|
||||
std::filesystem::remove_all(root);
|
||||
std::cout << "FLTD setup, colour, desktop-control and overwrite-question mappings passed\n";
|
||||
return 0;
|
||||
|
||||
Reference in new issue
Block a user