diff --git a/README.md b/README.md index a4baa91..ba109b5 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,8 @@ From a terminal in the extracted package on Linux or macOS: In Windows PowerShell, use `.\OpenBMH.exe` and `.\openbmh_cli.exe` instead. +To report a problem, start the game with `-debug`. It then writes `openbmh-debug.log` (timestamped events, errors and refused actions) and `openbmh-stderr.log` into the `debug` sub folder of the save directory, and saves the game there after every match day (`DBG00001.FBM`, `DBG00002.FBM`, ...). Attach the log and the last save to the report. + Use a writable save directory and keep backups of existing games. German editions are the primary compatibility target. **Football Limited / English data support is experimental**; original V2.20 save import and some edition-specific behaviour remain limited. See the [release notes](docs/release/1.0.5/RELEASE_NOTES.md). ## Features and direction diff --git a/docs/DIFFERENCES.md b/docs/DIFFERENCES.md index afa46f4..dd05bf2 100644 --- a/docs/DIFFERENCES.md +++ b/docs/DIFFERENCES.md @@ -34,9 +34,11 @@ describe deliberate changes; they are not a list of every known compatibility li - [src/game/weekly.cpp](../src/game/weekly.cpp): uses the supported weekly-event configuration, with its rule switch disabled. - [src/game/weekly.hpp](../src/game/weekly.hpp): uses the supported weekly processing and transfer rule profile. - [src/ui/bank.cpp](../src/ui/bank.cpp): read-only totals use wide arithmetic; individual saved account, price, holding and paid fields are unchanged. +- [src/ui/desk_state.cpp](../src/ui/desk_state.cpp): the desk shows the opponent's badge whenever the data has one. - [src/ui/league_table.hpp](../src/ui/league_table.hpp): uses three points for a win in the supported rule profile. - [src/ui/pitch.cpp](../src/ui/pitch.cpp): supports owner-bound designated set-piece selection in the extended manager record. - [src/ui/save_load.cpp](../src/ui/save_load.cpp): focuses the host save filename on entry and selects an existing name for replacement. - [src/ui/save_load.cpp](../src/ui/save_load.cpp): omits DOS drive and delete buttons in the directory-confined save/load view. - [src/ui/save_load.cpp](../src/ui/save_load.cpp): the host file picker uses the shared dialog's system identity without a live manager portrait projection. - [src/ui/save_load.cpp](../src/ui/save_load.cpp): permits cancelling host file dialogs with the right mouse button. +- [src/ui/settings.cpp](../src/ui/settings.cpp): the settings page names the product and its build version instead of the original's version text. diff --git a/src/app/career_session.cpp b/src/app/career_session.cpp index 9e0a66e..6bbd7e4 100644 --- a/src/app/career_session.cpp +++ b/src/app/career_session.cpp @@ -374,8 +374,15 @@ void restore_saved_turn_cursor(TurnDriver& driver, GameState& state, const Datab const int manager_count = int(state.manager_teams.size()); if (manager_count > 4 || !state.memory.has(::bmh::layout::ActiveManager) || !state.memory.has(::bmh::layout::DeskPosition)) throw std::runtime_error("saved turn cursor: manager continuation fields are missing"); - const int position = int(state.memory.u8(::bmh::layout::DeskPosition)); + int position = int(state.memory.u8(::bmh::layout::DeskPosition)); const int active = int(state.memory.u8(::bmh::layout::ActiveManager)); + // A completed manager loop leaves DeskPosition == ManagerCount (the day's desks are done). A desk + // that was saved in that state is the first desk again for a single manager: nothing else can + // follow it. Reading the byte as 0 lets the day go on instead of refusing the whole save. + if (manager_count == 1 && position == 1 && active == 0) { + position = 0; + state.memory.set8(::bmh::layout::DeskPosition, 0); + } if (position < 0 || position >= manager_count) throw std::runtime_error("saved turn cursor: manager position is outside the saved roster"); if (manager_count == 1) { diff --git a/src/app/controller.cpp b/src/app/controller.cpp index 1eed9e2..1028e9f 100644 --- a/src/app/controller.cpp +++ b/src/app/controller.cpp @@ -2,6 +2,7 @@ #include "formats/badge_policy.hpp" #include "formats/executable_layout.hpp" #include "app/controller.hpp" +#include "app/debug_log.hpp" #include "app/window_actions.hpp" #include "app/desktop_actions.hpp" #include "app/audio.hpp" @@ -1866,6 +1867,20 @@ std::string serve_flow_request(ui::StartupFlow& flow, const ui::FlowResult& resu }); const auto advanced = session->dispatch_kickoff(result.desk_action, revision, error); start_original_desk_audio(playback, session->state(), music_enabled); + if (app::debug::enabled()) { + // -debug: one savegame after every match day, in the debug folder (DBG00001.FBM, ...). + app::debug::log("kickoff handled: " + std::string(advanced.kind == TurnDeskKind::Failed ? "failed" : "ok") + + ", date counter " + std::to_string(session->state().date) + ", revision " + std::to_string(revision) + + (error.empty() ? std::string() : ", error " + error)); + if (advanced.kind != TurnDeskKind::Failed) { + const auto path = app::debug::next_save_path(); + std::string save_error; + const int slot = int(session->state().memory.u8(::bmh::layout::ActiveManager)); + const bool saved = session->save_game(path, slot, true, save_error); + app::debug::log(saved ? "debug savegame " + path.filename().string() + : "debug savegame failed: " + save_error); + } + } if (advanced.kind == TurnDeskKind::Failed || advanced.kind == TurnDeskKind::WaitingAtDesk) { flow.reject_desk_action(error.empty() ? advanced.reason : error); return {}; diff --git a/src/app/debug_log.hpp b/src/app/debug_log.hpp new file mode 100644 index 0000000..7c71ec9 --- /dev/null +++ b/src/app/debug_log.hpp @@ -0,0 +1,77 @@ +// SPDX-License-Identifier: GPL-3.0-only +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace bmh::app::debug { + +// The debug mode (command line -debug): a log with timestamps next to everything the game prints +// to stderr, and a savegame after every played match day, both in one sub folder of the save +// directory. Off by default; every function is a no-op until init() has run. +struct State { + bool enabled = false; + std::filesystem::path directory; + unsigned saves = 0; + std::mutex mutex; +}; +inline State& state() { static State s; return s; } + +inline bool enabled() { return state().enabled; } +inline const std::filesystem::path& directory() { return state().directory; } + +inline std::string timestamp() { + const auto now = std::chrono::system_clock::now(); + const std::time_t t = std::chrono::system_clock::to_time_t(now); + std::tm parts{}; +#ifdef _WIN32 + localtime_s(&parts, &t); +#else + localtime_r(&t, &parts); +#endif + const auto ms = std::chrono::duration_cast(now.time_since_epoch()).count() % 1000; + char text[40]; + std::snprintf(text, sizeof text, "%04d-%02d-%02d %02d:%02d:%02d.%03d", parts.tm_year + 1900, parts.tm_mon + 1, + parts.tm_mday, parts.tm_hour, parts.tm_min, parts.tm_sec, int(ms)); + return text; +} + +// One line, flushed at once so that a crash or a hang loses nothing. +inline void log(const std::string& line) { + auto& s = state(); + if (!s.enabled) return; + std::lock_guard lock(s.mutex); + std::ofstream out(s.directory / "openbmh-debug.log", std::ios::app); + if (out) out << timestamp() << " " << line << '\n'; +} + +// Creates the folder and redirects stderr into the same folder, so the messages the game +// prints on its own (for example the live overview errors) are kept as well. +inline bool init(const std::filesystem::path& directory) { + std::error_code ec; + std::filesystem::create_directories(directory, ec); + if (ec || !std::filesystem::is_directory(directory)) return false; + auto& s = state(); + s.directory = directory; + s.enabled = true; + const auto errors = (directory / "openbmh-stderr.log").string(); + if (std::FILE* redirected = std::freopen(errors.c_str(), "a", stderr)) std::setvbuf(redirected, nullptr, _IONBF, 0); + log("debug mode on, folder " + directory.string()); + return true; +} + +// The file name of the next automatic savegame: DBG00001.FBM, DBG00002.FBM, ... (8.3 like the original). +inline std::filesystem::path next_save_path() { + auto& s = state(); + char name[16]; + std::snprintf(name, sizeof name, "DBG%05u.FBM", ++s.saves); + return s.directory / name; +} + +} // namespace bmh::app::debug diff --git a/src/app/main.cpp b/src/app/main.cpp index 29a4977..5840136 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -34,6 +34,7 @@ #include "version.hpp" #include "app/video_session.hpp" #include "app/live_matchday_events.hpp" +#include "app/debug_log.hpp" #include "app/pitch_pointer.hpp" #include "audio/playback.hpp" #include "app/audio.hpp" @@ -115,7 +116,7 @@ int main(int argc, char** argv) { const std::vector args = launch::utf8_arguments(argc, argv); // (file names beyond the code page) fs::path data, save_directory; uint32_t seed = uint32_t(std::chrono::system_clock::now().time_since_epoch().count()); - bool muted = false, music_enabled = true; + bool muted = false, music_enabled = true, debug_mode = false; int live_frame_ms = 0; bool live_frame_ms_explicit = false; if (const char* configured = std::getenv("BMH_LIVE_FRAME_MS")) { @@ -139,6 +140,8 @@ int main(int argc, char** argv) { data = launch::path_from_utf8(args[++i]); } else if (is("--seed") && value) { seed = uint32_t(std::strtoul(args[++i].c_str(), nullptr, 0)); + } else if (is("-debug") || is("--debug")) { + debug_mode = true; } else if (is("--save-directory") && value) { save_directory = launch::path_from_utf8(args[++i]); } else if (is("--volume") && value) { @@ -148,7 +151,7 @@ int main(int argc, char** argv) { return 0; } else if (is("--help") || is("-h")) { std::printf("usage: OpenBMH [] [--seed ] " - "[--save-directory ] [--mute] [--volume <0..1>] [--no-music] [--live-frame-ms <0..1000>]\n"); + "[--save-directory ] [--mute] [--volume <0..1>] [--no-music] [--live-frame-ms <0..1000>] [-debug]\n"); return 0; } else if (args[i].rfind("--", 0) != 0 && data.empty()) { data = launch::path_from_utf8(args[i]); @@ -195,6 +198,13 @@ int main(int argc, char** argv) { data = game.check.directory; } if (save_directory.empty()) save_directory = data; + if (debug_mode) { + // -debug: log in /debug, with a savegame after every match day (app/debug_log.hpp). + if (!app::debug::init(save_directory / "debug")) std::fprintf(stderr, "debug folder cannot be created\n"); + app::debug::log(std::string("OpenBMH ") + bmh::kOpenBmhVersion + ", data " + data.string() + ", saves " + save_directory.string() + ", seed " + std::to_string(seed)); + SDL_version linked; SDL_GetVersion(&linked); + app::debug::log("SDL " + std::to_string(linked.major) + "." + std::to_string(linked.minor) + "." + std::to_string(linked.patch) + ", platform " + SDL_GetPlatform()); + } try { const Palette palette = load_palette(ui::asset_path(data, "M3PC.COL")); ui::StartupFlow flow(data, save_directory); @@ -226,6 +236,7 @@ int main(int argc, char** argv) { ui::SportschauEleven sportschau_eleven(data); ui::SportschauTeamInfo sportschau_team_info(data); ui::CompetitionWinnerScreen competition_winner(data); + ui::set_settings_product_version(bmh::kOpenBmhVersion); const auto season_exe = load_le(ui::asset_path(data, "BMH.exe")); english_game = english_game || season_exe.u8(layout::LeagueSizes) == 20; { @@ -3238,6 +3249,7 @@ int main(int argc, char** argv) { }, &request); if (!closed) throw FormatError("phase results: viewer stopped before Source ACK"); }, true); + if (app::debug::enabled()) app::debug::log("request " + std::to_string(int(r.request)) + (message.empty() ? std::string(" ok") : " -> " + message)); if (message == "career_complete") { running = false; return; } if (!message.empty()) std::fprintf(stderr, "engine: %s\n", message.c_str()); if (session) { diff --git a/src/app/pitch_pointer.hpp b/src/app/pitch_pointer.hpp index ab426e0..0e5d4c1 100644 --- a/src/app/pitch_pointer.hpp +++ b/src/app/pitch_pointer.hpp @@ -28,8 +28,12 @@ public: void show(const std::optional>& requested, SDL_Renderer* renderer) { const auto& pixels = requested ? requested : default_; if (!pixels) { SDL_SetCursor(SDL_GetDefaultCursor()); return; } + // Cursor bitmaps are sized in window points, not in pixels: on a high-DPI display (macOS + // Retina) the renderer's output is larger than the window, and a bitmap scaled to it would + // show twice as large. SDL_GetWindowSize gives the points. int width = 320, height = 240; - SDL_GetRendererOutputSize(renderer, &width, &height); + if (SDL_Window* window = SDL_RenderGetWindow(renderer)) SDL_GetWindowSize(window, &width, &height); + else SDL_GetRendererOutputSize(renderer, &width, &height); const int scale = std::max(1, std::min(width / 320, height / 240)); if (!cursor_ || pixels != pixels_ || scale != scale_) { std::vector enlarged(size_t(11 * scale) * size_t(11 * scale)); diff --git a/src/ui/calendar.cpp b/src/ui/calendar.cpp index 074d392..9cce4d5 100644 --- a/src/ui/calendar.cpp +++ b/src/ui/calendar.cpp @@ -77,9 +77,30 @@ CalendarScreen::CalendarScreen(const std::filesystem::path& data, CalendarState void CalendarScreen::text(Image& out, int x, int baseline, std::string_view bytes, uint8_t color) const { // TextWidth3 refuses text outside the original screen; no UTF-8 enters BMH3. const int top = baseline - font_.baseline; - if (x >= 0 && top >= 0 && top + font_.height <= out.height && - x + font_.text_width(bytes) <= out.width) + if (!(x >= 0 && top >= 0 && top + font_.height <= out.height && + x + font_.text_width(bytes) <= out.width)) return; + // With the gradient on, every set pixel of a glyph takes the colour its row has in the original's + // table for this palette token (six rows per token); a token the table does not know stays flat. + unsigned slot = 0; + while (slot < 32 && exe_.u8(::bmh::layout::Advertising_Text_RuntimeField2 + slot) != color) ++slot; + if (!state_.gradient_text || slot == 32) { font_.draw(out, x, top, bytes, color); + return; + } + int pen_x = x; + for (unsigned char ch : bytes) { + const auto& glyph = font_.glyph(ch); + for (int row = 0; row < font_.height; ++row) { + const uint8_t row_color = exe_.u8(::bmh::layout::Advertising_Text_RuntimeField + slot * 6 + std::min(row, 5)); + if (row_color == 0) continue; + for (int col = 0; col < glyph.bit_width; ++col) { + const int bit = glyph.bit_offset + col; + if (!(font_.bitmap[size_t(row) * font_.modulo + bit / 8] & (0x80 >> (bit % 8)))) continue; + out.at(pen_x + col, top + row) = row_color; + } + } + pen_x += glyph.advance; + } } std::string CalendarScreen::information(const CalendarDayProjection& day) const { diff --git a/src/ui/calendar_state.cpp b/src/ui/calendar_state.cpp index b9e3cb4..7c59a78 100644 --- a/src/ui/calendar_state.cpp +++ b/src/ui/calendar_state.cpp @@ -105,6 +105,10 @@ CalendarState calendar_from_game(const GameState& game, const LeImage& executabl if (current_display >= int(state.days.size())) throw FormatError("calendar: current date is outside the season calendar"); state.current_day = current_display; + // TextGradientDisabled (a settings switch) clear and the edition's gradient mode 2: the text + // takes the original's six-row colour table, as on every other page. + state.gradient_text = !game.memory.has(::bmh::layout::TextGradientDisabled) || + (game.memory.u8(::bmh::layout::TextGradientDisabled) == 0 && executable.u8(::bmh::layout::TextGradientMode) == 2); return state; } diff --git a/src/ui/calendar_state.hpp b/src/ui/calendar_state.hpp index 2f179b3..ace416e 100644 --- a/src/ui/calendar_state.hpp +++ b/src/ui/calendar_state.hpp @@ -47,6 +47,7 @@ struct CalendarState { bool friendly_selection = false; std::vector reschedule_options; std::vector moved_matches; + bool gradient_text = true; // six-row colour table of the original instead of flat colours }; // Projects the current saved season without preparing fixtures, advancing the date, diff --git a/src/ui/desk_state.cpp b/src/ui/desk_state.cpp index 3ac6295..01b8775 100644 --- a/src/ui/desk_state.cpp +++ b/src/ui/desk_state.cpp @@ -621,7 +621,10 @@ DeskState desk_from_game(const GameState& g, const LeImage& exe, uint64_t revisi *d.next_opponent < int(g.club_ids.size())) { const int opponent = *d.next_opponent; d.next_opponent_name = g.club_name(opponent); - const bool fallback = original_badge_fallback(opponent,&exe); + // OpenBMH deviates from the original: the desk shows the opponent's badge whenever the data has one. + // The original draws a computer icon for the clubs between its two gate values (the foreign league + // clubs); only the cup-only teams and the empty selector keep the icon. + const bool fallback = (opponent & 0xfff) == 0xfff || (opponent >= 168 && opponent < 357); d.next_opponent_badge_fallback = fallback; if (!fallback) { const size_t badge_at = size_t(opponent) * 2; diff --git a/src/ui/desktop_tests.cpp b/src/ui/desktop_tests.cpp index 12aeb15..a10f251 100644 --- a/src/ui/desktop_tests.cpp +++ b/src/ui/desktop_tests.cpp @@ -1123,12 +1123,19 @@ int main(int argc, char** argv) { auto special=desk_from_game(special_game,exe,10,&prepared,34); check(special.next_competition_label==desk_texts[(::bmh::layout::DeskState_FormatError_RuntimeField4-::bmh::layout::TextPointerTable)/4], "Source calendar entry 4006 selects the special competition title"); - MatchGroup fallback_badge_group=cup_fixture;fallback_badge_group.fixtures={12,100}; + // OpenBMH shows a club badge for every league club; only the cup-only teams keep the computer portrait. + MatchGroup fallback_badge_group=cup_fixture;fallback_badge_group.fixtures={12,200}; std::vector fallback_badge_groups{fallback_badge_group}; auto fallback_badge=desk_from_game(match_game,exe,10,&fallback_badge_groups,34); - check(fallback_badge.next_opponent==100&&fallback_badge.next_opponent_badge_fallback&& + check(fallback_badge.next_opponent==200&&fallback_badge.next_opponent_badge_fallback&& !fallback_badge.next_opponent_badge, - "legacy routine special team range uses its computer-portrait fallback"); + "a cup-only team uses its computer-portrait fallback"); + fallback_badge_group.fixtures={12,100}; + fallback_badge_groups={fallback_badge_group}; + auto foreign_badge=desk_from_game(match_game,exe,10,&fallback_badge_groups,34); + check(foreign_badge.next_opponent==100&&!foreign_badge.next_opponent_badge_fallback&& + foreign_badge.next_opponent_badge, + "a foreign league club shows its badge"); prepared.clear(); auto other_fixture = league_fixture; other_fixture.fixtures={13,14}; prepared.push_back(other_fixture); auto unmatched = desk_from_game(match_game,exe,10,&prepared,34); diff --git a/src/ui/settings.cpp b/src/ui/settings.cpp index 459b99e..d658811 100644 --- a/src/ui/settings.cpp +++ b/src/ui/settings.cpp @@ -51,6 +51,11 @@ std::string number(int value) { } } +namespace { +std::string& product_version() { static std::string version; return version; } +} +void set_settings_product_version(std::string version) { product_version() = std::move(version); } + std::array project_settings_availability( const std::array& raw_cells, const SettingsAvailabilityInputs& in, const LeImage& exe) { @@ -210,7 +215,13 @@ Image SettingsScreen::render() const { } sprite_font_.draw(out, SpriteFont::centered_title_x(sprite_font_.text_width(state_.title)), 13, state_.title); sprite_font_.draw(out, 5, 235, state_.footer); - text(out, 2, 41, utf8_to_original(state_.version), 0x5f, 58); + // OpenBMH deviates from the original: the settings page names the product and its build version instead of the original's version text. + if (product_version().empty()) { + text(out, 2, 41, utf8_to_original(state_.version), 0x5f, 58); + } else { + text(out, 2, 41, "OpenBMH", 0x5f, 58); + text(out, 2, 49, utf8_to_original(product_version()), 0x5f, 58); + } for (int col = 0; col < 9; ++col) { const auto label = std::to_string(col + 1); // DrawnFirstBy uses x directly when right=-1 and shadow=0x40. diff --git a/src/ui/settings.hpp b/src/ui/settings.hpp index 3d9adae..b0e5c6b 100644 --- a/src/ui/settings.hpp +++ b/src/ui/settings.hpp @@ -64,6 +64,10 @@ SettingsState settings_from_game(const GameState&, int manager, uint64_t revisio std::optional settings_source_refusal(const GameState& state, const SettingsWriteRequest& request, uint64_t revision); +// The product line of the settings page: "OpenBMH" and, below it, this build's version. Set once by the +// application (the UI library does not include the generated version); empty keeps the original text. +void set_settings_product_version(std::string version); + class SettingsScreen { public: SettingsScreen(const std::filesystem::path& data, SettingsState state, int origin_item_id = -1); diff --git a/tests/app_controller_tests.cpp b/tests/app_controller_tests.cpp index df69417..b477594 100644 --- a/tests/app_controller_tests.cpp +++ b/tests/app_controller_tests.cpp @@ -4222,7 +4222,7 @@ void check_loaded_lineup(const std::filesystem::path& data, const std::filesyste check(session.game().calls() == game_calls && session.rand().calls() == random_calls, "pre-kickoff swap consumes no RNG"); - bool saw_fixture = false, order_preserved = false, live_overview_roundtrip = false; + bool saw_fixture = false, order_preserved = false, live_overview_roundtrip = false, pairings_first_roundtrip = false; session.set_live_minute([&](int minute, MatchEngine& engine, std::vector& groups, GameState& state) { if (!live_overview_roundtrip && minute >= 3 && !groups.empty() && groups[0].desc.size() > 0xcf && groups[0].desc[0] == 0 && std::any_of(groups.begin(),groups.end(),[&](const MatchGroup& group) { @@ -4237,8 +4237,24 @@ void check_loaded_lineup(const std::filesystem::path& data, const std::filesyste if(!opened)throw std::runtime_error("actual WEEK196 live G key failed to open: "+error); check(opened->kind==app::CareerSession::LiveOverviewKind::league_table && opened->table.has_value(), "real kickoff observer opens the Source G table for the first league descriptor"); + // The family's children as the buttons reach them: Tabelle -> Stärken -> Tabelle -> + // Spiele -> Tabelle, each handoff accepted while the minute is held. + const auto hop=[&](ui::StrengthsIdentity from,int from_child,int target_child,const char* what) { + ui::LeagueFamilyRequest nav; + nav.identity=from; nav.kind=ui::LeagueFamilyRequestKind::navigate; + nav.from_child=from_child; nav.target_child=target_child; + auto page=session.dispatch_live_overview(app::CareerSession::LiveOverviewAction{nav},engine,revision,error); + if(!page)throw std::runtime_error(std::string("live overview ")+what+" failed: "+error); + return *page; + }; + auto strengths=hop(opened->family_identity,1,3,"Tabelle -> Stärken"); + check(strengths.kind==app::CareerSession::LiveOverviewKind::league_strengths,"the live family opens Stärken"); + auto table_again=hop(strengths.family_identity,3,1,"Stärken -> Tabelle"); + auto pairings=hop(table_again.family_identity,1,2,"Tabelle -> Spiele"); + check(pairings.kind==app::CareerSession::LiveOverviewKind::league_pairings,"the live family opens Spiele"); + auto table_last=hop(pairings.family_identity,2,1,"Spiele -> Tabelle"); ui::LeagueFamilyRequest close; - close.identity=opened->family_identity; close.kind=ui::LeagueFamilyRequestKind::close; + close.identity=table_last.family_identity; close.kind=ui::LeagueFamilyRequestKind::close; close.from_child=1; close.target_child=0; auto closed=session.dispatch_live_overview(app::CareerSession::LiveOverviewAction{close},engine,revision,error); if(!closed)throw std::runtime_error("actual WEEK196 live G key failed to close: "+error); @@ -4246,6 +4262,41 @@ void check_loaded_lineup(const std::filesystem::path& data, const std::filesyste "real kickoff observer closes the Source G family and resumes the same minute"); live_overview_roundtrip=true; } + // The Spiele page opened first (key slot 1, as at the end of a phase): its Tabelle and + // Stärken buttons hand over to the other children and back. + if (live_overview_roundtrip && !pairings_first_roundtrip && minute >= 5 && !groups.empty() && + groups[0].desc.size() > 0xcf && groups[0].desc[0] == 0) { + pairings_first_roundtrip = true; + app::CareerSession::LiveOverviewRequest live; + live.key_slot=1; live.minute=minute; live.group_index=0; + live.manager_slot=manager; live.runtime_team=team; live.revision=revision; + live.sequence=0xfeee; + auto opened=session.open_live_overview(live,engine,revision,Image{},error); + if(!opened)throw std::runtime_error("live Spiele page failed to open: "+error); + check(opened->kind==app::CareerSession::LiveOverviewKind::league_pairings,"key slot 1 opens the Spiele page"); + const auto hop2=[&](ui::StrengthsIdentity from,int from_child,int target_child,const char* what) { + ui::LeagueFamilyRequest nav; + nav.identity=from; nav.kind=ui::LeagueFamilyRequestKind::navigate; + nav.from_child=from_child; nav.target_child=target_child; + auto page=session.dispatch_live_overview(app::CareerSession::LiveOverviewAction{nav},engine,revision,error); + if(!page)throw std::runtime_error(std::string("live overview ")+what+" failed: "+error); + return *page; + }; + // the buttons of the Spiele page itself: Stärken directly, and back + auto direct=hop2(opened->family_identity,2,3,"Spiele -> Stärken"); + check(direct.kind==app::CareerSession::LiveOverviewKind::league_strengths,"Spiele hands over to Stärken"); + auto again=hop2(direct.family_identity,3,2,"Stärken -> Spiele"); + auto table=hop2(again.family_identity,2,1,"Spiele -> Tabelle"); + check(table.kind==app::CareerSession::LiveOverviewKind::league_table,"Spiele hands over to Tabelle"); + auto strengths=hop2(table.family_identity,1,3,"Tabelle -> Stärken"); + auto pairings=hop2(strengths.family_identity,3,2,"Stärken -> Spiele"); + ui::LeagueFamilyRequest close; + close.identity=pairings.family_identity; close.kind=ui::LeagueFamilyRequestKind::close; + close.from_child=2; close.target_child=0; + auto closed=session.dispatch_live_overview(app::CareerSession::LiveOverviewAction{close},engine,revision,error); + if(!closed)throw std::runtime_error("live Spiele page failed to close: "+error); + check(closed->closed,"the Spiele page closes and resumes the minute"); + } if (saw_fixture) return; for (const auto& group : groups) { if (std::find(group.fixtures.begin(), group.fixtures.end(), team) == group.fixtures.end()) continue;