diff --git a/docs/COMPATIBILITY.md b/docs/COMPATIBILITY.md index bb31068..ebada74 100644 --- a/docs/COMPATIBILITY.md +++ b/docs/COMPATIBILITY.md @@ -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 diff --git a/src/app/career_session.cpp b/src/app/career_session.cpp index eab38da..0864761 100644 --- a/src/app/career_session.cpp +++ b/src/app/career_session.cpp @@ -4,6 +4,7 @@ #include "game/calendar.hpp" #include "formats/executable_layout.hpp" #include "app/career_session.hpp" +#include "formats/league_visibility.hpp" #include #include @@ -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) { diff --git a/src/formats/league_visibility.hpp b/src/formats/league_visibility.hpp new file mode 100644 index 0000000..fd3c88c --- /dev/null +++ b/src/formats/league_visibility.hpp @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-3.0-only +#pragma once +#include "formats/executable_layout.hpp" +#include "formats/le.hpp" +#include +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); +} +} diff --git a/src/ui/manager.cpp b/src/ui/manager.cpp index 7c8797f..7c61246 100644 --- a/src/ui/manager.cpp +++ b/src/ui/manager.cpp @@ -2,6 +2,7 @@ #include "formats/badge_policy.hpp" #include "formats/executable_layout.hpp" #include "ui/manager.hpp" +#include "formats/league_visibility.hpp" #include #include @@ -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 #include #include @@ -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