Honor Original visible league counts for fresh Classic managers (by Codex)
This commit is contained in:
1 parent
048f617395
commit
d661ec5eb0
9 files changed
+86
-5
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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(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;
|
||||
|
||||
Reference in new issue
Block a user