diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e102c3..dbbca81 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -512,6 +512,10 @@ add_executable(national_friendly_actions_tests tests/national_friendly_actions_t target_link_libraries(national_friendly_actions_tests PRIVATE bmhcore) add_test(NAME national_friendly_actions_tests COMMAND national_friendly_actions_tests) +add_executable(edition_startup_app_tests tests/edition_startup_app_tests.cpp ${BMH_APP_CONTROLLER_SOURCE} ${BMH_APP_SESSION_SDL_SOURCE}) +target_link_libraries(edition_startup_app_tests PRIVATE bmhui openbmh_audio ${BMH_SDL_TARGET}) +bmh_add_data_test(NAME edition_startup_app_tests COMMAND edition_startup_app_tests "${BMH_DATA}") + add_executable(manager_join_app_tests tests/manager_join_app_tests.cpp ${BMH_APP_CONTROLLER_SOURCE} ${BMH_APP_SESSION_SDL_SOURCE}) target_link_libraries(manager_join_app_tests PRIVATE bmhui openbmh_audio ${BMH_SDL_TARGET}) if(MSVC) @@ -936,6 +940,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_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) bmh_add_data_test(NAME english_league_views_data_tests DATA_DIR "${BMH_ENGLISH_DATA}" COMMAND league_views_data_tests "${BMH_ENGLISH_DATA}") diff --git a/docs/COMPATIBILITY.md b/docs/COMPATIBILITY.md index 0ea0275..7cab596 100644 --- a/docs/COMPATIBILITY.md +++ b/docs/COMPATIBILITY.md @@ -31,6 +31,18 @@ The six-budget monthly environment implementation has been checked against the p 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. +The graphical startup presents the supplied publisher, credits and title images +before the game options. The first two original waits are three and one seconds. +OpenBMH deviates from the original: the title remains visible for 1.5 seconds +instead of depending on DOS database initialization time. A key or mouse release +skips the opening sequence without also changing a setup option. + +Setup restores ordinary scene-backed manager dialogs before a career is created +or loaded. The executable's boot-only black dialog mode is process state and is +not restored from native save files. Football Limited's translated data includes +its own verified calendar year and weekday operands; German epochs are not used +as a substitute for the English edition. + ## Diamond 3.7 foreign crests The supplied edition controls whether foreign league clubs use individual diff --git a/src/app/career_session.cpp b/src/app/career_session.cpp index a6ed18e..006ece8 100644 --- a/src/app/career_session.cpp +++ b/src/app/career_session.cpp @@ -549,9 +549,9 @@ static void install_league_sizes(const LeImage& exe) { } CareerSession::CareerSession(const std::filesystem::path& data, uint32_t watcom_seed) - : data_directory_(data), exe_(load_le(data / "BMH.exe")), - db_(load_database(data / "M3D.MAN")), - texts_(load_textd(data / "TEXTD.BLK")), + : data_directory_(data), exe_(load_le(ui::asset_path(data, "BMH.exe"))), + db_(load_database(ui::asset_path(data, "M3D.MAN"))), + texts_(load_textd(ui::asset_path(data, "TEXTD.BLK"))), rand_(watcom_seed) { install_league_sizes(exe_); turn_driver_.alternate_match_event_roll = exe_.u8(::bmh::layout::AlternateEventRoll) != 0; @@ -560,7 +560,7 @@ CareerSession::CareerSession(const std::filesystem::path& data, uint32_t watcom_ ? TransferAllocatorContext::zero : TransferAllocatorContext::blocked; session_id_ = next_session_id.fetch_add(1, std::memory_order_relaxed); initialize_club_modal_runtime(); - g_ = startup_state(exe_, db_, read_file(data / "M3.MEN"), read_file(data / "M3.DAT")); + g_ = startup_state(exe_, db_, read_file(ui::asset_path(data, "M3.MEN")), read_file(ui::asset_path(data, "M3.DAT"))); g_.texts = &texts_; g_.currency_suffix = exe_.cstring(::bmh::layout::CurrencySuffixText); // CurrencySuffixText configure_training_camp_data(g_, exe_); @@ -576,8 +576,8 @@ CareerSession::CareerSession(const std::filesystem::path& data, uint32_t watcom_ CareerSession::CareerSession(const std::filesystem::path& data, uint32_t watcom_seed, const std::filesystem::path& save_path) - : data_directory_(data), exe_(load_le(data / "BMH.exe")), db_(load_database(data / "M3D.MAN")), - texts_(load_textd(data / "TEXTD.BLK")), rand_(watcom_seed) { + : data_directory_(data), exe_(load_le(ui::asset_path(data, "BMH.exe"))), db_(load_database(ui::asset_path(data, "M3D.MAN"))), + texts_(load_textd(ui::asset_path(data, "TEXTD.BLK"))), rand_(watcom_seed) { install_league_sizes(exe_); turn_driver_.alternate_match_event_roll = exe_.u8(::bmh::layout::AlternateEventRoll) != 0; turn_driver_.disable_match_events = exe_.u8(::bmh::layout::MatchEventsDisabled) != 0; @@ -926,6 +926,9 @@ std::optional CareerSession::dispatch_club_player_pending_of } void CareerSession::initialize_club_modal_runtime() { + // Setup clears the boot-only dialog mode before either creating or loading + // a career. This process flag is deliberately absent from native saves. + club_modal_runtime_.emplace(layout::CompactDialogFrame, 0); // LE object4 has bb cdd/de/e1 in its zero-initialized virtual tail; // CareerSession_InitializeClubModalRuntime_ExecutableField is file-backed zero. These are explicit process-start values, // carried by this runtime owner across modal entry/return, not FBM bytes. diff --git a/src/app/main.cpp b/src/app/main.cpp index e76d7c4..105178e 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -3599,6 +3599,32 @@ int main(int argc, char** argv) { if (expired.request != ui::FlowRequest::none || expired.changed) handle(expired); } }; + // Original boot order: publisher, credits, then the game's title. Keep + // these in the graphical frontend; creating a session starts at options. + // OpenBMH deviates from the original: keep the title visible for 1.5s + // instead of relying on the duration of DOS database initialization. + bool skip_opening = false; + for (const auto [picture, milliseconds] : + std::array, 3>{{{138, 3000}, {139, 1000}, {137, 1500}}}) { + if (!running || skip_opening) break; + present_season(load_vga(ui::asset_path(data / "KB", std::to_string(picture) + ".VGA")), + window_title.c_str()); + const auto until = SDL_GetTicks64() + milliseconds; + while (running && !skip_opening && SDL_GetTicks64() < until) { + SDL_Event opening_event; + while (SDL_PollEvent(&opening_event)) { + if (opening_event.type == SDL_QUIT) running = false; + if (opening_event.type == SDL_KEYDOWN || opening_event.type == SDL_MOUSEBUTTONUP) + skip_opening = true; + } + SDL_Delay(10); + } + } + // Opening input must not also change an option on the first setup frame. + SDL_FlushEvents(SDL_KEYDOWN, SDL_KEYUP); + SDL_FlushEvents(SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP); + season_backdrop.reset(); + dirty = true; SDL_StartTextInput(); bool filename_input_active = false; std::array setup_button_down{}; diff --git a/src/game/calendar.cpp b/src/game/calendar.cpp index 56f3f70..b49dabf 100644 --- a/src/game/calendar.cpp +++ b/src/game/calendar.cpp @@ -10,6 +10,18 @@ CalendarEpoch calendar_epoch_from_executable(const LeImage& exe) { constexpr uint8_t month_and_year_prefix[] = {0xc6,0x44,0x24,0x0c,0x07,0xc7,0x04,0x24}; if (!exe.contains(setup) || !exe.contains(setup + 16)) throw FormatError("calendar: missing original date setup"); + constexpr uint8_t english_prefix[] = {0xc6,0x45,0xf6}; + constexpr uint8_t english_month_and_year[] = {0xc6,0x45,0xf7,0x07,0x66,0xc7,0x45,0xf8}; + bool english = true; + for (uint32_t i=0;i9999||weekday>6)throw FormatError("calendar: invalid original English epoch"); + return {int(year),weekday}; + } for (uint32_t i=0;i +#include +#include + +using namespace bmh; +using namespace bmh::ui; +namespace { void check(bool ok,const char* message){if(!ok)throw std::runtime_error(message);} } +int main(int argc,char** argv)try { + if(argc<2||!*argv[1])return 77; + const std::filesystem::path data=argv[1]; + StartupFlow flow(data); + std::unique_ptr session; + uint64_t revision=0; + openbmh::audio::Playback playback; + std::optional audio; + const auto serve=[&](const FlowResult& result) { + check(app::serve_flow_request(flow,result,session,data,data,0x12345678, + revision,playback,audio,false).empty(),"production startup/navigation failed"); + }; + flow.click(150,215);flow.click(5,225,true);flow.click(5,225,true); + serve(flow.click(90,169)); + check(session&&flow.screen_name()=="desktop","edition did not reach an actual career desk"); + check(session->state().memory.has(layout::CompactDialogFrame)&& + session->state().memory.u8(layout::CompactDialogFrame)==0, + "setup retained the boot-only black dialog mode"); + const auto native=save_stream(session->state()); + const auto game=session->game();const auto random=session->rand(); + const auto before_revision=revision; + for(int kind:{8,7}) { + const auto& items=flow.desktop()->state().items; + const auto it=std::find_if(items.begin(),items.end(),[&](const auto& item){return item.kind==kind&&!item.disabled;}); + check(it!=items.end(),"edition lacks the enabled original calendar menu"); + serve(flow.click(it->x+it->width/2,it->y+it->height/2)); + check(flow.calendar()&&flow.screen_name()==(kind==8?"calendar":"reschedule_calendar"), + "original calendar menu did not open"); + check(flow.render().pixels.size()==320*240,"calendar did not render a complete original frame"); + serve(flow.send_key("ESC")); + check(flow.screen_name()=="desktop"&&!flow.desktop()->pending(),"calendar did not return its desk owner"); + } + check(save_stream(session->state())==native&&revision==before_revision&& + session->game().seed()==game.seed()&&session->game().calls()==game.calls()&& + session->rand().seed()==random.seed()&&session->rand().calls()==random.calls(), + "opening calendars changed the career or random streams"); + std::cout<<"Edition career startup, original calendar/rescheduling navigation and dialog mode passed\n"; + return 0; +}catch(const std::exception& e){std::cerr<