Honor Original visible league counts for fresh Classic managers (by Codex)

This commit is contained in:
Codex committed 2026-11-02 23:28:05 +01:00
1 parent 048f617395
commit d661ec5eb0
9 files changed
+86 -5

No files matched your search

+9 -2
View File
@@ -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,12 +23,19 @@ 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 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.
OpenBMH deviates from the original: graphical startup shows the supplied static
+10
View File
@@ -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) {
+14
View File
@@ -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);
}
}
+7 -2
View File
@@ -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);
+1
View File
@@ -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)); }
+6 -1
View File
@@ -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");
+18
View File
@@ -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;
}
+6
View File
@@ -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) {
+15
View File
@@ -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(0x6d230+i,environment_x[i]);put(0x6d238+i,environment_y[i]);put(0x6d244+i,environment_steps[i]);}
const std::array<uint8_t,3> youth_colors{0x41,0x42,0x43};for(uint32_t i=0;i<3;++i)put(0x6d240+i,youth_colors[i]);
const std::string position_suffix=". / ",cost_suffix=".";
for(uint32_t i=0;i<=position_suffix.size();++i)put(0x6d24a+i,i<position_suffix.size()?uint8_t(position_suffix[i]):0);
for(uint32_t i=0;i<=cost_suffix.size();++i)put(0x6d24f+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;