Enable expanded international careers and private Classic-format preparation (by Codex)

This commit is contained in:
Codex committed 2026-10-31 10:20:09 +01:00
1 parent aae6556708
commit b5d60ef8a7
78 files changed
+816 -269

No files matched your search

+35
View File
@@ -1,6 +1,8 @@
// SPDX-License-Identifier: GPL-3.0-only
#include "formats/data_profile.hpp"
#include "formats/savestate.hpp"
#include "formats/le.hpp"
#include "formats/badge_policy.hpp"
#include "game/profile_runtime.hpp"
#include "game/state.hpp"
#include "game/weekly.hpp"
@@ -28,6 +30,17 @@ int main()try {
bmh::SaveState decoded(stream, profile.counts);
check(decoded.block(bmh::layout::SquadSlots).size == profile.total_slots() * 2,
"squad block ignored configured profile counts");
check(decoded.block(bmh::layout::ManagerMatchHistory).size == profile.counts.n42 * 50,
"opponent history truncated in extended saves");
check(decoded.block(bmh::layout::ClubKitSelectors).size == profile.counts.clubs &&
decoded.block(bmh::layout::ClubShortNameOffsets).size == profile.counts.n42,
"extended visual tables truncated");
check(decoded.block(bmh::layout::DeskRecords_Teams_RuntimeField).size == profile.counts.league_teams * 2,
"last international club has no fair-play counter");
bmh::StaticMemory memory(decoded);
const auto last = bmh::layout::DeskRecords_Teams_RuntimeField + (profile.counts.league_teams - 1) * 2;
memory.set16(last, 0x0102);
check(memory.u16(last) == 0x0102, "last club card counters are not addressable");
check(decoded.block(bmh::layout::PlayerConditionTechniqueForm).size == profile.counts.players * 4,
"player block ignored configured profile counts");
}
@@ -54,6 +67,28 @@ int main()try {
check(!bmh::load_data_profile(dir).extended(),"Original installation did not select Classic");
{std::ofstream f(dir/"OBMHPROF.INI");f<<"[OpenBMH]\nprofile=classic-plus-1\n";}
check(bmh::load_data_profile(dir).counts.n66==4104,"Profile marker not recognized");
bmh::Bytes image_bytes(0x20000, 0);
const auto at = [&](uint32_t address) -> uint8_t& { return image_bytes.at(address - bmh::layout::GermanDataSegmentBegin); };
for (int league = 0; league < 9; ++league) at(bmh::layout::LeagueSizes + uint32_t(league)) = classic.leagues[size_t(league)];
for (int day = 24; day < 24 + 34 * 8; day += 8) at(bmh::layout::CompetitionCalendar + uint32_t(day * 2)) = 1;
bmh::save_image(bmh::LeImage::from_bytes(bmh::layout::GermanDataSegmentBegin, image_bytes), dir / "BMH.exe");
const auto before = bmh::read_file(dir / "BMH.exe");
const auto image = bmh::load_le(dir / "BMH.exe");
check(image.expanded_profile() && image.u16(bmh::layout::NoTeamSquadStart) == 194,
"national name base confused with absolute national squad slot");
check(image.u32(bmh::layout::ProfileNationalSlotsFirst) == 4080 && image.u32(bmh::layout::ProfilePoolFirst) == 3936,
"verified scalar overlay disagrees with runtime profile");
check(image.u8(bmh::layout::LeagueSizes + 6) == 20 && image.u16(bmh::layout::TeamsWithSquads) == 164,
"UI executable view has stale league/roster dimensions");
int domestic_days=0,foreign_days=0;
for(int day=0;day<365;++day) {
const auto flags=image.u16(bmh::layout::CompetitionCalendar+uint32_t(day*2));
domestic_days += (flags & 1) != 0;
foreign_days += (flags & 16) != 0;
}
check(domestic_days==34 && foreign_days==38,"extended calendar changed domestic dates or omitted English fixtures");
check(!bmh::original_badge_fallback(300, &image),"foreign cup clubs still use the computer badge");
check(bmh::read_file(dir / "BMH.exe") == before,"loading modified the supplied executable");
{std::ofstream f(dir/"OBMHPROF.INI");f<<"[OpenBMH]\nprofile=unknown\n";}
rejected=false;try{bmh::load_data_profile(dir);}catch(const bmh::FormatError&){rejected=true;}
std::filesystem::remove_all(dir);check(rejected,"Unknown profile silently became Classic");