Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
249bdca1a8 | ||
|
|
b8904db92d | ||
|
|
9ec136a09f | ||
|
|
a275ffa1a9 | ||
|
|
fcb6ac14bb | ||
|
|
acdc7d5c14 | ||
|
|
0faad16148 | ||
|
|
f44de65e22 | ||
|
|
bea5478433 | ||
|
|
2d744e380c | ||
|
|
9140fb4b03 | ||
|
|
02f47f7972 | ||
|
|
564af00d8d | ||
|
|
e8ba78e135 | ||
|
|
fcbe1ebc13 | ||
|
|
8b1dc16233 | ||
|
|
9c10a2bfeb | ||
|
|
6f33f9c155 | ||
|
|
9c82cb16b5 |
No files matched your search
@@ -62,4 +62,4 @@ jobs:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
RELEASE_TAG: ${{ github.ref_name }}
|
||||
run: |
|
||||
gh release create "$RELEASE_TAG" dist/*.zip dist/SHA256SUMS dist/QA-REPORT.json --draft --verify-tag --title "OpenBMH $RELEASE_TAG" --notes-file docs/release/1.0.3/RELEASE_NOTES.md
|
||||
gh release create "$RELEASE_TAG" dist/*.zip dist/SHA256SUMS dist/QA-REPORT.json --draft --verify-tag --title "OpenBMH $RELEASE_TAG" --notes-file docs/release/1.0.4/RELEASE_NOTES.md
|
||||
+20
-1
@@ -1,6 +1,6 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
cmake_minimum_required(VERSION 3.24)
|
||||
project(OpenBMH VERSION 1.0.3 LANGUAGES CXX C)
|
||||
project(OpenBMH VERSION 1.0.4 LANGUAGES CXX C)
|
||||
if(APPLE)
|
||||
# Enable native languages before dependencies/subdirectories inherit rules.
|
||||
enable_language(OBJC OBJCXX)
|
||||
@@ -449,12 +449,29 @@ target_link_libraries(desk_check PRIVATE bmhcore)
|
||||
add_executable(init_check tests/init_check.cpp)
|
||||
target_link_libraries(init_check PRIVATE bmhcore)
|
||||
|
||||
# The approved compressed title is embedded: no install-time sidecar dependency.
|
||||
set(BMH_START_SCREEN_DATA "${CMAKE_BINARY_DIR}/generated/start_screen_data.cpp")
|
||||
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/generated")
|
||||
add_custom_command(OUTPUT "${BMH_START_SCREEN_DATA}"
|
||||
COMMAND "${CMAKE_COMMAND}" "-DINPUT=${CMAKE_SOURCE_DIR}/assets/start-screen.jpg"
|
||||
"-DOUTPUT=${BMH_START_SCREEN_DATA}" -P "${CMAKE_SOURCE_DIR}/cmake/EmbedStartScreen.cmake"
|
||||
DEPENDS assets/start-screen.jpg cmake/EmbedStartScreen.cmake
|
||||
VERBATIM)
|
||||
add_library(openbmh_start_screen STATIC src/app/start_screen.cpp "${BMH_START_SCREEN_DATA}")
|
||||
target_include_directories(openbmh_start_screen PRIVATE "${CMAKE_SOURCE_DIR}/src")
|
||||
target_link_libraries(openbmh_start_screen PUBLIC ${BMH_SDL_TARGET})
|
||||
add_executable(start_screen_tests tests/start_screen_tests.cpp)
|
||||
target_include_directories(start_screen_tests PRIVATE "${CMAKE_SOURCE_DIR}/src")
|
||||
target_link_libraries(start_screen_tests PRIVATE openbmh_start_screen)
|
||||
add_test(NAME start_screen_tests COMMAND start_screen_tests)
|
||||
|
||||
# The playable program: the shared UI library connected to the engine by src/app.
|
||||
add_executable(openbmh_play
|
||||
src/app/main.cpp
|
||||
${BMH_APP_CONTROLLER_SOURCE}
|
||||
${BMH_APP_SESSION_SDL_SOURCE})
|
||||
target_link_libraries(openbmh_play PRIVATE bmhui bmhlaunch_dialog openbmh_audio ${BMH_SDL_TARGET})
|
||||
target_link_libraries(openbmh_play PRIVATE openbmh_start_screen)
|
||||
# a game without a console window on double-click (SDL2main provides WinMain); started from a
|
||||
# console it attaches to that one for --version, --help and start errors (src/app/main.cpp)
|
||||
set_target_properties(openbmh_play PROPERTIES WIN32_EXECUTABLE TRUE OUTPUT_NAME OpenBMH)
|
||||
@@ -497,6 +514,8 @@ if(MSVC)
|
||||
endif()
|
||||
bmh_add_data_test(NAME app_controller_tests COMMAND app_controller_tests "${BMH_DATA}")
|
||||
set(BMH_TEST_APP_DELAY_SETTINGS_TESTS_INPUT_1 "" CACHE PATH "External input 1 for app_delay_settings_tests; not distributed")
|
||||
bmh_add_data_test(NAME app_desktop_input_tests COMMAND app_controller_tests "${BMH_DATA}" --desktop-input-only)
|
||||
bmh_add_data_test(NAME app_advertising_input_tests COMMAND app_controller_tests "${BMH_DATA}" --advertising-input-only)
|
||||
bmh_add_data_test(NAME app_environment_tests COMMAND app_controller_tests "${BMH_DATA}" --environment-only)
|
||||
bmh_add_data_test(NAME app_delay_settings_tests REQUIRED_OPTIONS BMH_TEST_APP_DELAY_SETTINGS_TESTS_INPUT_1 COMMAND app_controller_tests "${BMH_DATA}"
|
||||
--delay-settings-only "${BMH_TEST_APP_DELAY_SETTINGS_TESTS_INPUT_1}")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# OpenBMH
|
||||
|
||||
**Classic-Version: 1.0.3.** Die originalgetreue Linie bleibt in diesem Repository.
|
||||
**Classic-Version: 1.0.4.** Die originalgetreue Linie bleibt in diesem Repository.
|
||||
Erweiterte Ligen, die gemeinsame deutsche/englische Karriere und der Dateneditor
|
||||
werden separat als **[OpenBMH-Extended 1.0 Beta](https://github.com/Weyoune/OpenBMH-extended)** entwickelt.
|
||||
|
||||
@@ -28,7 +28,7 @@ From a terminal in the extracted package on Linux or macOS:
|
||||
|
||||
In Windows PowerShell, use `.\OpenBMH.exe` and `.\openbmh_cli.exe` instead.
|
||||
|
||||
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.3/RELEASE_NOTES.md).
|
||||
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.4/RELEASE_NOTES.md).
|
||||
|
||||
## Features and direction
|
||||
|
||||
@@ -111,3 +111,5 @@ OpenBMH's own code and documentation are licensed under **GNU GPL version 3 only
|
||||
Every published binary release identifies its matching source tag and provides a corresponding source archive. Binary releases must accompany or offer the corresponding source and build/relinking materials required by the applicable licenses. The tag identifies application source; it does not replace required materials for linked third-party components.
|
||||
|
||||
Bundled components retain their own licenses, including Nuked OPL3 under LGPL-2.1-or-later. See [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md) and [ACKNOWLEDGEMENTS.md](ACKNOWLEDGEMENTS.md).
|
||||
|
||||
The supplied project start artwork is embedded at native resolution; see [start-screen artwork](docs/START_SCREEN.md). It replaces the original title image while the game continues to use your own original data and assets.
|
||||
@@ -4,6 +4,7 @@ OpenBMH's own code and documentation use GPL-3.0-only. This does not replace the
|
||||
|
||||
| Component | Version used by the build | License | Included notice |
|
||||
|---|---|---|---|
|
||||
| [stb_image](https://github.com/nothings/stb/blob/013ac3beddff3dbffafd5177e7972067cd2b5083/stb_image.h) | 2.30, vendored header; JPEG decoder only | MIT or public-domain alternative | [stb_image.txt](docs/licenses/stb_image.txt) |
|
||||
| [SDL2](https://github.com/libsdl-org/SDL/tree/release-2.32.10) | 2.32.10, or an explicitly selected system SDL2 | zlib license | [SDL2.txt](docs/licenses/SDL2.txt) |
|
||||
| SDL2 HIDAPI code | Included with SDL2 | BSD-3-Clause option; upstream also offers GPL-3.0 and its original license | [license options](docs/licenses/SDL2-HIDAPI-options.txt), [BSD text](docs/licenses/SDL2-HIDAPI-BSD.txt), [original text](docs/licenses/SDL2-HIDAPI-original.txt) |
|
||||
| SDL2 yuv2rgb code | Included with SDL2 | BSD-3-Clause | [SDL2-yuv2rgb.txt](docs/licenses/SDL2-yuv2rgb.txt) |
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# OpenBMH Classic start artwork
|
||||
|
||||
The project maintainer supplied this new start-screen artwork for use and
|
||||
repository distribution with this application. It is not extracted game content.
|
||||
The repository license applies to project artwork; original game assets remain
|
||||
external. The unmodified upstream decoder has its separate documented license.
|
||||
|
||||
`start-screen.jpg` retains the supplied image's native **1448 × 1086** pixels.
|
||||
It is an optimized progressive JPEG at quality 92 with 4:4:4 chroma sampling,
|
||||
without EXIF or other input metadata. It occupies 587,410 bytes.
|
||||
The application embeds it at build time and decodes it once at startup, so
|
||||
installed applications need no image sidecar or original title-screen VGA.
|
||||
|
||||
The SDL renderer uses the actual image dimensions while showing the title,
|
||||
including high-DPI output and aspect-preserving side bars, then restores the
|
||||
320 × 240 game/input canvas. A complete left or right mouse click continues;
|
||||
there is no loading-ball animation. Changing the artwork also requires an
|
||||
explicit review/update of its SHA256 in the public-source guard.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 574 KiB |
@@ -0,0 +1,4 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
file(READ "${INPUT}" artwork HEX)
|
||||
string(REGEX REPLACE "(..)" "0x\\1," artwork "${artwork}")
|
||||
file(WRITE "${OUTPUT}" "// Generated from the repository-owned compressed start screen.\n#include \"app/start_screen_data.hpp\"\nnamespace bmh::app {\nconst unsigned char start_screen_jpeg[] = {${artwork}};\nconst std::size_t start_screen_jpeg_size=sizeof(start_screen_jpeg);\n}\n")
|
||||
@@ -160,3 +160,10 @@ Release-driven incoming-transfer presenters require a matching press observed
|
||||
inside that modal. An orphan or repeated release from the preceding result table
|
||||
cannot decline an offer or dismiss its confirmation. Repeated presses while a
|
||||
button is held still form one gesture; fresh left/right clicks keep their actions.
|
||||
|
||||
## Host file overwrite confirmation
|
||||
|
||||
The file picker reuses the Original overwrite question and Ja/Nein button
|
||||
layout. A separate Yes click or Enter confirms; repeated double-clicks do not.
|
||||
OpenBMH deviates from the original: host file operations use the shared dialog's
|
||||
system identity because the picker does not own a live manager portrait projection.
|
||||
+2
-1
@@ -6,7 +6,7 @@ See [Compatibility decisions](COMPATIBILITY.md) for the overall policy. These en
|
||||
describe deliberate changes; they are not a list of every known compatibility limit.
|
||||
|
||||
- [src/app/career_session.cpp](../src/app/career_session.cpp): supports designated set-piece record initialization and validation.
|
||||
- [src/app/main.cpp](../src/app/main.cpp): show only the static title until a complete left or right click, without the DOS loading animation.
|
||||
- [src/app/main.cpp](../src/app/main.cpp): display the repository-owned title at its native resolution until a complete left/right click, without loading balls.
|
||||
- [src/app/quit_confirmation.hpp](../src/app/quit_confirmation.hpp): confirms application exit with a localized native dialog, with cancellation selected by default.
|
||||
- [src/game/career.cpp](../src/game/career.cpp): skips reserved calendar positions when assigning a joining manager to a club.
|
||||
- [src/game/career.hpp](../src/game/career.hpp): uses the supported player-generation ranges and excludes reserved calendar positions when assigning managers.
|
||||
@@ -37,4 +37,5 @@ describe deliberate changes; they are not a list of every known compatibility li
|
||||
- [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.
|
||||
@@ -0,0 +1,18 @@
|
||||
# OpenBMH Classic start artwork
|
||||
|
||||
The project maintainer supplied this new start-screen artwork for use and
|
||||
repository distribution with this application. It is not extracted game content.
|
||||
The repository license applies to project artwork; original game assets remain
|
||||
external. The unmodified upstream decoder has its separate documented license.
|
||||
|
||||
`start-screen.jpg` retains the supplied image's native **1448 × 1086** pixels.
|
||||
It is an optimized progressive JPEG at quality 92 with 4:4:4 chroma sampling,
|
||||
without EXIF or other input metadata. It occupies 587,410 bytes.
|
||||
The application embeds it at build time and decodes it once at startup, so
|
||||
installed applications need no image sidecar or original title-screen VGA.
|
||||
|
||||
The SDL renderer uses the actual image dimensions while showing the title,
|
||||
including high-DPI output and aspect-preserving side bars, then restores the
|
||||
320 × 240 game/input canvas. A complete left or right mouse click continues;
|
||||
there is no loading-ball animation. Changing the artwork also requires an
|
||||
explicit review/update of its SHA256 in the public-source guard.
|
||||
@@ -0,0 +1,51 @@
|
||||
# Desktop and advertising mouse input fixes
|
||||
|
||||
The optional desktop frame bit controls decoration, not whether the visible
|
||||
widget contents accept input. The corrections reuse the Original renderer,
|
||||
coordinates, layout records and action dispatchers.
|
||||
|
||||
- The date widget activates the same owned advance action as Anstoß, with or
|
||||
without a frame. In a multiplayer turn this first hands control to the next
|
||||
manager. The separate calendar/rescheduling menu keeps its own behavior.
|
||||
- Stored icons remain clickable and draggable from unframed folders. Extraction
|
||||
restores the actual icon record to the visible chain; the folder stays put.
|
||||
Hidden or unlinked owners remain invalid. Removal corners keep their separate
|
||||
transaction and mouse-release barrier. The same frame-origin correction also
|
||||
covers the existing admission scale and five automation controls.
|
||||
- A true double-click on an existing save opens the shared Original-style
|
||||
overwrite question. A separate single click on Ja confirms, Nein returns to
|
||||
the picker, and repeated double-click releases cannot write. Enter and cancel
|
||||
paths remain. FBM, EIN and MEN use the same confirmation boundary.
|
||||
- Advertising follows all nineteen original hit rectangles with palette0x27
|
||||
outlines and the installed edition's detail/help text. Motion alone does not
|
||||
change the career, revision or either random stream. Offers/calculators retain
|
||||
their input owner; returning from them reevaluates the actual pointer, avoiding
|
||||
a stale highlight without requiring another mouse movement.
|
||||
|
||||
## Validation
|
||||
|
||||
The focused configured-data tests are `app_desktop_input_tests`,
|
||||
`app_advertising_input_tests`, `ui_desktop_input_tests`, `ui_save_load_tests` and
|
||||
`ui_advertising_tests`. They cover frame variants, exact field boundaries,
|
||||
canonical actions, stale/hidden-owner refusal, cancellation, input release,
|
||||
overwrite confirmation and unchanged game/random state for presentation-only
|
||||
input. The desktop input test isolates these checks from unrelated private
|
||||
text/badge inventories; the existing full test retains its additional checks.
|
||||
|
||||
Private Linux SDL before/after captures and actual saved games are maintained in
|
||||
`bmh_4k_ui/docs/qa/classic-extended-ui-input`. The fixtures use actual club/player
|
||||
data with a controlled desktop layout. No results are fabricated. A successful
|
||||
compile or CI run alone is not native Windows/macOS UI verification.
|
||||
|
||||
Tracked reports: [#51](https://github.com/Weyoune/openbmh/issues/51), [#52](https://github.com/Weyoune/openbmh/issues/52), [#53](https://github.com/Weyoune/openbmh/issues/53), [#54](https://github.com/Weyoune/openbmh/issues/54).
|
||||
|
||||
The primary regression run uses the supplied Diamond 3.7 installation. Unrelated
|
||||
historical rendering fixtures retain their declared reference requirements.
|
||||
Two existing Classic test fixtures were aligned with the already implemented
|
||||
stadium-capacity policy and verified edition-specific crest gate; product
|
||||
validation was not relaxed to satisfy those tests.
|
||||
|
||||
The overwrite prompt also maps the actual Football Limited English pointer.
|
||||
The translation copies exactly that four-byte pointer and preserves adjacent
|
||||
empty slots. The launcher translation-cache revision is advanced, so an existing
|
||||
cached English installation receives the newly supported prompt as well.
|
||||
@@ -783,7 +783,7 @@ declarations change. Game text, resort, image and audio fallbacks belong outside
|
||||
| `EnglishLayoutTranslation157` | `0x6e094` | English image adapter |
|
||||
| `EnglishLayoutTranslation158` | `0x6e0b8` | English image adapter |
|
||||
| `EnglishLayoutTranslation159` | `0x6e0bb` | English image adapter |
|
||||
| `EnglishLayoutTranslation16` | `0x6be4f` | English image adapter |
|
||||
| `EnglishLayoutTranslation16` | `0x6be50` | English image adapter |
|
||||
| `EnglishLayoutTranslation160` | `0x6e0d8` | English image adapter |
|
||||
| `EnglishLayoutTranslation161` | `0x6e110` | English image adapter |
|
||||
| `EnglishLayoutTranslation162` | `0x6e11c` | English image adapter |
|
||||
@@ -1005,7 +1005,7 @@ declarations change. Game text, resort, image and audio fallbacks belong outside
|
||||
| `EnglishLayoutTranslation70` | `0x6d270` | English image adapter |
|
||||
| `EnglishLayoutTranslation71` | `0x6d272` | English image adapter |
|
||||
| `EnglishLayoutTranslation72` | `0x6d274` | English image adapter |
|
||||
| `EnglishLayoutTranslation73` | `0x6d29c` | English image adapter |
|
||||
| `EnglishLayoutTranslation73` | `0x6d29d` | English image adapter |
|
||||
| `EnglishLayoutTranslation74` | `0x6d3b4` | English image adapter |
|
||||
| `EnglishLayoutTranslation75` | `0x6d404` | English image adapter |
|
||||
| `EnglishLayoutTranslation76` | `0x6d408` | English image adapter |
|
||||
@@ -1490,19 +1490,19 @@ declarations change. Game text, resort, image and audio fallbacks belong outside
|
||||
| `Pitch_FormatError_TextPointer2` | `0xaf178` | German-compatible image / runtime field |
|
||||
| `Pitch_FormatError_TextPointer3` | `0xaf17c` | German-compatible image / runtime field |
|
||||
| `Pitch_Render_RuntimeField` | `0xa3cbc` | German-compatible image / runtime field |
|
||||
| `PitchPreferenceDepthBases` | `0xa3cc3` | Four position-depth bases for native pitch feedback |
|
||||
| `PitchPreferenceRed` | `0xa3cc7` | Ten native pointer red components |
|
||||
| `PitchPreferenceGreen` | `0xa3cd1` | Ten native pointer green components |
|
||||
| `OriginalPointerPixels` | `0xa45b4` | Native 11 by 11 indexed pointer bitmap |
|
||||
| `EnglishPitchPreferenceDepthBases` | `0x6e230` | English position-depth bases |
|
||||
| `EnglishPitchPreferenceRed` | `0x6e234` | English pointer red components |
|
||||
| `EnglishPitchPreferenceGreen` | `0x6e240` | English pointer green components |
|
||||
| `EnglishOriginalPointerPixels` | `0x70554` | English 11 by 11 indexed pointer bitmap |
|
||||
| `Pitch_Render_TextPointer` | `0xae0e4` | German-compatible image / runtime field |
|
||||
| `Pitch_Render_TextPointer2` | `0xae0ec` | German-compatible image / runtime field |
|
||||
| `Pitch_Render_TextPointer3` | `0xae0f0` | German-compatible image / runtime field |
|
||||
| `Pitch_Render_TextPointer4` | `0xae0f4` | German-compatible image / runtime field |
|
||||
| `Pitch_Render_TextPointer5` | `0xae0f8` | German-compatible image / runtime field |
|
||||
| `PitchPreferenceDepthBases` | `0xa3cc3` | German-compatible image / runtime field |
|
||||
| `PitchPreferenceRed` | `0xa3cc7` | German-compatible image / runtime field |
|
||||
| `PitchPreferenceGreen` | `0xa3cd1` | German-compatible image / runtime field |
|
||||
| `OriginalPointerPixels` | `0xa45b4` | German-compatible image / runtime field |
|
||||
| `EnglishPitchPreferenceDepthBases` | `0x6e230` | English image adapter |
|
||||
| `EnglishPitchPreferenceRed` | `0x6e234` | English image adapter |
|
||||
| `EnglishPitchPreferenceGreen` | `0x6e240` | English image adapter |
|
||||
| `EnglishOriginalPointerPixels` | `0x70554` | English image adapter |
|
||||
| `PitchOrderPositionPointers` | `0xa2a37` | German-compatible image / runtime field |
|
||||
| `PitchOrderZoneMasks` | `0xa2a4b` | German-compatible image / runtime field |
|
||||
| `PitchOrderZoneTextPointers` | `0xae818` | German-compatible image / runtime field |
|
||||
@@ -1578,6 +1578,7 @@ declarations change. Game text, resort, image and audio fallbacks belong outside
|
||||
| `SaveLoad_Render_RuntimeField` | `0xa2334` | German-compatible image / runtime field |
|
||||
| `SaveLoad_Render_RuntimeField2` | `0xa233f` | German-compatible image / runtime field |
|
||||
| `SaveLoad_Render_RuntimeField3` | `0xa234a` | German-compatible image / runtime field |
|
||||
| `SaveLoad_OverwriteQuestionPointer` | `0xa21c4` | German-compatible image / runtime field |
|
||||
| `SaveLoad_Render_TextPointer` | `0xa1512` | German-compatible image / runtime field |
|
||||
| `SaveLoad_Render_TextPointer2` | `0xae5f0` | German-compatible image / runtime field |
|
||||
| `SaveLoad_Render_TextPointer3` | `0xae620` | German-compatible image / runtime field |
|
||||
@@ -1999,13 +2000,11 @@ declarations change. Game text, resort, image and audio fallbacks belong outside
|
||||
| `EnglishSixTeamFixtureTable` | `0x6eed4` | English image adapter |
|
||||
| `EnglishTwelveTeamFixtureTable` | `0x6f0bc` | English image adapter |
|
||||
| `EnglishTwentyTeamFixtureTable` | `0x6ee40` | English image adapter |
|
||||
|
||||
## Verified edition-dependent parameters
|
||||
|
||||
| Field | Address | Use |
|
||||
|---|---|---|
|
||||
| `CalendarDateSetup` | `0x21270` | Verified date setup: weekday byte at +4, initial year dword at +13. Original CD uses 1995/Saturday; checked Diamond editions use 2026/Wednesday. |
|
||||
| `ForeignBadgeGateInstruction` | `0x10070` | Verified original drawing gate; operand at +3 selects neutral foreign crests or individual W-sheet selectors. |
|
||||
| `EnvironmentBudgetSteps` | `0xa50ff` | Six budget increments in the verified monthly environment implementation. |
|
||||
|
||||
Calendar presentation, engine weekday processing and save-list headers share the supplied installation's epoch. The original four-year date arithmetic is preserved; this reader does not substitute a different calendar system or rewrite the installation. Unknown date setup instructions and invalid values are rejected.
|
||||
| `EnglishDesktopBinSourceX` | `0x6e180` | English image adapter |
|
||||
| `EnglishDesktopBinSourceY` | `0x6e182` | English image adapter |
|
||||
| `EnglishDesktopSocketSourceX` | `0x6e184` | English image adapter |
|
||||
| `EnvironmentBudgetSteps` | `0xa50ff` | German-compatible image / runtime field |
|
||||
| `EnvironmentVerifiedCodeBegin` | `0x6c000` | English image adapter |
|
||||
| `EnvironmentVerifiedCodeEnd` | `0x6cb40` | English image adapter |
|
||||
| `EnvironmentVerifiedHookBegin` | `0x7af65` | English image adapter |
|
||||
| `EnvironmentVerifiedHookEnd` | `0x7b020` | English image adapter |
|
||||
@@ -12,3 +12,5 @@ These files preserve upstream license and attribution wording. They are not a gr
|
||||
- [LGPL version 2.1](LGPL-2.1.txt): full license supplied with Nuked OPL3. Its source notices permit version 2.1 or any later version.
|
||||
|
||||
[THIRD_PARTY_NOTICES.md](../../THIRD_PARTY_NOTICES.md) identifies the upstream versions and distribution requirements. Include this directory, that notice file and the root LICENSE with release packages. Preserve upstream attribution within these verbatim texts.
|
||||
|
||||
- [stb_image](stb_image.txt): complete upstream dual-license text from the vendored 2.30 header. JPEG-only decoding is used for the supplied project start screen.
|
||||
@@ -0,0 +1,38 @@
|
||||
This software is available under 2 licenses -- choose whichever you prefer.
|
||||
------------------------------------------------------------------------------
|
||||
ALTERNATIVE A - MIT License
|
||||
Copyright (c) 2017 Sean Barrett
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
------------------------------------------------------------------------------
|
||||
ALTERNATIVE B - Public Domain (www.unlicense.org)
|
||||
This is free and unencumbered software released into the public domain.
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
|
||||
software, either in source code form or as a compiled binary, for any purpose,
|
||||
commercial or non-commercial, and by any means.
|
||||
In jurisdictions that recognize copyright laws, the author or authors of this
|
||||
software dedicate any and all copyright interest in the software to the public
|
||||
domain. We make this dedication for the benefit of the public at large and to
|
||||
the detriment of our heirs and successors. We intend this dedication to be an
|
||||
overt act of relinquishment in perpetuity of all present and future rights to
|
||||
this software under copyright law.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
------------------------------------------------------------------------------
|
||||
@@ -0,0 +1,57 @@
|
||||
# OpenBMH Classic 1.0.4
|
||||
|
||||
This Classic patch release includes the desktop, save and advertising fixes
|
||||
added after 1.0.3. It requires the player's own supported game installation.
|
||||
Extended development remains separate in
|
||||
[OpenBMH-Extended](https://github.com/Weyoune/OpenBMH-extended).
|
||||
|
||||
## Changes since 1.0.3
|
||||
|
||||
- The supplied Classic start artwork is embedded at its native resolution and
|
||||
displayed with correct proportions, including high-DPI output. A complete
|
||||
left or right mouse click continues into the game.
|
||||
- An unframed desktop calendar/date control now starts the next turn correctly.
|
||||
Unframed admission-price and automation controls use their correct origins;
|
||||
hidden controls and national-team restrictions remain enforced.
|
||||
- Dragging an icon out of a stored desktop folder moves the selected icon while
|
||||
keeping the folder in place. Folder-corner removal uses the original input
|
||||
geometry.
|
||||
- Double-clicking an occupied save slot opens the original overwrite question.
|
||||
Its Yes/No buttons work entirely with the mouse. No preserves the existing
|
||||
file; Yes writes the selected slot.
|
||||
- Advertising choices use the original hover outlines and help areas. Returning
|
||||
from a dialog refreshes the pointer state and removes stale highlighting.
|
||||
- Malformed saved formation automation is rejected before desktop projection,
|
||||
without changing the career state or random streams.
|
||||
- Football Limited retains its original overwrite question during English-data
|
||||
translation. The launcher rebuilds older translated caches automatically.
|
||||
|
||||
## Validation
|
||||
|
||||
The release workflow requires successful builds, configured tests, version and
|
||||
package checks for Windows x64, macOS ARM64 and Linux x64 at the exact tagged
|
||||
revision. Downloads include checksums, a platform test report and corresponding
|
||||
source with pinned open-source dependencies.
|
||||
|
||||
Additional private Linux validation of the fixes used Diamond 3.7 data and real
|
||||
mouse input. The 211-test configured suite executed 116 passing tests, skipped
|
||||
95 checks needing other private fixtures, and reported no failures. Focused
|
||||
save, desktop and advertising input checks executed. Native before/after checks
|
||||
verified mouse-only overwrite refusal/acceptance, folder extraction and a real
|
||||
two-manager calendar handoff, with saved-state verification. An original
|
||||
Football Limited data probe verified the translated overwrite question.
|
||||
|
||||
These checks do not establish manual gameplay acceptance on Windows or macOS.
|
||||
Issues [#51](https://github.com/Weyoune/openbmh/issues/51),
|
||||
[#52](https://github.com/Weyoune/openbmh/issues/52),
|
||||
[#53](https://github.com/Weyoune/openbmh/issues/53) and
|
||||
[#54](https://github.com/Weyoune/openbmh/issues/54) remain open for human QA.
|
||||
|
||||
## Known limits
|
||||
|
||||
The compatibility and long-career limits documented for
|
||||
[1.0.3](../1.0.3/RELEASE_NOTES.md) remain. Football Limited is experimental;
|
||||
its original V2.20 save layout remains unsupported. Keep backups of saves.
|
||||
macOS packages are unsigned terminal executables, not notarised app bundles.
|
||||
|
||||
No original executables, databases, saves, graphics or audio are included.
|
||||
+19
-12
@@ -5626,15 +5626,20 @@ bool CareerSession::dispatch_desk_widget(const ui::DeskRequest& request, uint64_
|
||||
identity.stable_club_identity = int(g_.club_ids[size_t(identity.runtime_club)]);
|
||||
}
|
||||
if (!validate_desk_setting_owner(identity, revision, error, false)) return false;
|
||||
// Refuse malformed saved formation state before projecting widget ownership.
|
||||
// The desktop renderer cannot project indices outside the stored 0..8 range.
|
||||
if (g_.manager_options[size_t(active) * 5] > 8) {
|
||||
error = "invalid_saved_formation_automation"; return false;
|
||||
}
|
||||
const bool price = request.kind == ui::DeskRequestKind::change_ticket_price;
|
||||
if (!price && request.kind != ui::DeskRequestKind::change_option) {
|
||||
error = "unsupported_desk_widget"; return false;
|
||||
}
|
||||
// Keep SDL requests bound to a visible, open and enabled MEN drawer/item.
|
||||
// Keep SDL requests bound to a visible and enabled MEN drawer/item; the frame bit is optional.
|
||||
const auto desk = desktop_projection(revision);
|
||||
const int expected_kind = price ? 55 : 64;
|
||||
const auto item = std::find_if(desk.items.begin(), desk.items.end(), [&](const ui::DeskItem& item) {
|
||||
return item.id == request.item_id && item.kind == expected_kind && item.open && !item.disabled;
|
||||
return item.id == request.item_id && item.kind == expected_kind && !item.disabled;
|
||||
});
|
||||
if (request.menu_kind != expected_kind || item == desk.items.end()) {
|
||||
error = "stale_or_closed_desk_widget"; return false;
|
||||
@@ -5744,19 +5749,20 @@ bool CareerSession::dispatch_desktop_layout(const ui::DeskRequest& request, uint
|
||||
(expected[at+13]&0x7f)!=folder||expected[at+12]>=50) {
|
||||
error="invalid_desk_folder_child_return"; return false;
|
||||
}
|
||||
bool owner_open=false;
|
||||
bool owner_visible=false;
|
||||
for(size_t item=1;item<kItems;++item) {
|
||||
if(expected[item*kStride+12]!=50+folder||(expected[item*kStride+13]&0x80)==0) continue;
|
||||
// The frame bit does not hide folder contents; require a visible linked owner.
|
||||
if(expected[item*kStride+12]!=50+folder||(expected[item*kStride+1]&0x10)!=0) continue;
|
||||
int cursor=0;size_t visited=0;
|
||||
while(++visited<kItems) {
|
||||
const int next=expected[size_t(cursor)*kStride+5];
|
||||
if(next==int(item)) { owner_open=true;break; }
|
||||
if(next==int(item)) { owner_visible=true;break; }
|
||||
if(next<=0||next>=int(kItems)) break;
|
||||
cursor=next;
|
||||
}
|
||||
if(owner_open) break;
|
||||
if(owner_visible) break;
|
||||
}
|
||||
if(!owner_open) { error="desk_folder_child_owner_closed"; return false; }
|
||||
if(!owner_visible) { error="desk_folder_child_owner_hidden"; return false; }
|
||||
const int max_x=std::max(1,319-int(expected[at+3])),max_y=std::max(1,239-int(expected[at+4]));
|
||||
const int source_x=int(moved_x&0xefff);
|
||||
const bool snap=g_.memory.has(::bmh::layout::CareerSession_DispatchDesktopLayout_RuntimeField2)&&g_.memory.u8(::bmh::layout::CareerSession_DispatchDesktopLayout_RuntimeField2)==0;
|
||||
@@ -5797,19 +5803,20 @@ bool CareerSession::dispatch_desktop_layout(const ui::DeskRequest& request, uint
|
||||
(expected[at+13]&0x7f)!=folder||expected[at+12]>=50) {
|
||||
error="invalid_desk_bin_restore";return false;
|
||||
}
|
||||
bool owner_open=false;
|
||||
bool owner_visible=false;
|
||||
for(size_t item=1;item<kItems;++item) {
|
||||
if(expected[item*kStride+12]!=50+folder||(expected[item*kStride+13]&0x80)==0) continue;
|
||||
// The frame bit does not hide folder contents; require a visible linked owner.
|
||||
if(expected[item*kStride+12]!=50+folder||(expected[item*kStride+1]&0x10)!=0) continue;
|
||||
int cursor=0;size_t visited=0;
|
||||
while(++visited<kItems) {
|
||||
const int next=expected[size_t(cursor)*kStride+5];
|
||||
if(next==int(item)) { owner_open=true;break; }
|
||||
if(next==int(item)) { owner_visible=true;break; }
|
||||
if(next<=0||next>=int(kItems)) break;
|
||||
cursor=next;
|
||||
}
|
||||
if(owner_open)break;
|
||||
if(owner_visible)break;
|
||||
}
|
||||
if(!owner_open) { error="desk_bin_restore_folder_closed";return false; }
|
||||
if(!owner_visible) { error="desk_bin_restore_folder_hidden";return false; }
|
||||
int tail=0;size_t guard=0;
|
||||
while(expected[size_t(tail)*kStride+5]!=0) {
|
||||
if(++guard>=kItems) { error="invalid_desk_layout_chain";return false; }
|
||||
|
||||
+35
-35
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#include "formats/badge_policy.hpp"
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "app/start_screen.hpp"
|
||||
#include "ui/live_timing.hpp"
|
||||
// openbmh_play - the UI of src/ui connected to the engine: options, manager dialogs, a new
|
||||
// career initialised by the engine (app/career_session.hpp) and its desk.
|
||||
@@ -208,7 +209,7 @@ int main(int argc, char** argv) {
|
||||
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0");
|
||||
const std::string window_title = std::string("OpenBMH ") + bmh::kOpenBmhVersion +
|
||||
(english_game ? " - Football Limited (experimental)" : "");
|
||||
SDL_Window* window = SDL_CreateWindow(window_title.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 960, 720, SDL_WINDOW_RESIZABLE);
|
||||
SDL_Window* window = SDL_CreateWindow(window_title.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 960, 720, SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
|
||||
if (!window) throw FormatError(SDL_GetError());
|
||||
SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_PRESENTVSYNC);
|
||||
if (!renderer) renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_SOFTWARE);
|
||||
@@ -2669,7 +2670,8 @@ int main(int argc, char** argv) {
|
||||
file_input.button.button == SDL_BUTTON_RIGHT)) {
|
||||
file_changed |= file_screen.click(file_input.button.x,
|
||||
file_input.button.y,
|
||||
file_input.button.button == SDL_BUTTON_RIGHT);
|
||||
file_input.button.button == SDL_BUTTON_RIGHT,
|
||||
file_input.button.clicks >= 2);
|
||||
} else if (file_input.type == SDL_KEYDOWN && !file_input.key.repeat) {
|
||||
std::string_view key;
|
||||
switch (file_input.key.keysym.sym) {
|
||||
@@ -3619,42 +3621,40 @@ int main(int argc, char** argv) {
|
||||
if (expired.request != ui::FlowRequest::none || expired.changed) handle(expired);
|
||||
}
|
||||
};
|
||||
// OpenBMH deviates from the original: show only the static title until
|
||||
// a complete left or right click, without the DOS loading animation.
|
||||
const auto title_path = ui::asset_path(data / "KB", "137.VGA");
|
||||
const auto title_palette = load_optional_embedded_palette(title_path);
|
||||
const auto title_image = load_vga(title_path);
|
||||
present_season(title_image, window_title.c_str(),
|
||||
title_palette ? &*title_palette : nullptr);
|
||||
bool opening_confirmed = false;
|
||||
std::optional<Uint8> opening_press;
|
||||
while (running && !opening_confirmed) {
|
||||
SDL_Event opening_event;
|
||||
while (quit_confirmation.poll(&opening_event)) {
|
||||
if (opening_event.type == SDL_QUIT) running = false;
|
||||
if (opening_event.type == SDL_KEYDOWN && opening_event.key.keysym.sym == SDLK_ESCAPE &&
|
||||
quit_confirmation.confirm()) running = false;
|
||||
if (opening_event.type == SDL_WINDOWEVENT &&
|
||||
(opening_event.window.event == SDL_WINDOWEVENT_EXPOSED ||
|
||||
opening_event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED))
|
||||
present_season(title_image, window_title.c_str(),
|
||||
title_palette ? &*title_palette : nullptr);
|
||||
if (opening_event.type == SDL_WINDOWEVENT &&
|
||||
opening_event.window.event == SDL_WINDOWEVENT_FOCUS_LOST)
|
||||
opening_press.reset();
|
||||
if (opening_event.type == SDL_MOUSEBUTTONDOWN &&
|
||||
(opening_event.button.button == SDL_BUTTON_LEFT ||
|
||||
opening_event.button.button == SDL_BUTTON_RIGHT))
|
||||
opening_press = opening_event.button.button;
|
||||
if (opening_event.type == SDL_MOUSEBUTTONUP && opening_press &&
|
||||
opening_event.button.button == *opening_press)
|
||||
opening_confirmed = true;
|
||||
// OpenBMH deviates from the original: display the repository-owned title
|
||||
// at its native resolution until a complete left/right click, without loading balls.
|
||||
{
|
||||
app::StartScreen title_screen(renderer);
|
||||
title_screen.present();
|
||||
bool opening_confirmed = false;
|
||||
std::optional<Uint8> opening_press;
|
||||
while (running && !opening_confirmed) {
|
||||
SDL_Event opening_event;
|
||||
while (quit_confirmation.poll(&opening_event)) {
|
||||
if (opening_event.type == SDL_QUIT) running = false;
|
||||
if (opening_event.type == SDL_KEYDOWN && opening_event.key.keysym.sym == SDLK_ESCAPE &&
|
||||
quit_confirmation.confirm()) running = false;
|
||||
if (opening_event.type == SDL_WINDOWEVENT &&
|
||||
(opening_event.window.event == SDL_WINDOWEVENT_EXPOSED ||
|
||||
opening_event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED))
|
||||
title_screen.present();
|
||||
if (opening_event.type == SDL_WINDOWEVENT &&
|
||||
opening_event.window.event == SDL_WINDOWEVENT_FOCUS_LOST)
|
||||
opening_press.reset();
|
||||
if (opening_event.type == SDL_MOUSEBUTTONDOWN &&
|
||||
(opening_event.button.button == SDL_BUTTON_LEFT ||
|
||||
opening_event.button.button == SDL_BUTTON_RIGHT))
|
||||
opening_press = opening_event.button.button;
|
||||
if (opening_event.type == SDL_MOUSEBUTTONUP && opening_press &&
|
||||
opening_event.button.button == *opening_press)
|
||||
opening_confirmed = true;
|
||||
}
|
||||
SDL_Delay(10);
|
||||
}
|
||||
SDL_Delay(10);
|
||||
}
|
||||
} // Restore the indexed game canvas and its logical input mapping.
|
||||
// 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);
|
||||
SDL_FlushEvents(SDL_MOUSEMOTION, SDL_MOUSEBUTTONUP);
|
||||
season_backdrop.reset();
|
||||
dirty = true;
|
||||
SDL_StartTextInput();
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#include "app/start_screen.hpp"
|
||||
#include "app/start_screen_data.hpp"
|
||||
#include <SDL.h>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#define STBI_ONLY_JPEG
|
||||
#define STBI_NO_STDIO
|
||||
#define STBI_NO_HDR
|
||||
#define STBI_NO_LINEAR
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#include "app/third_party/stb_image.h"
|
||||
namespace bmh::app {
|
||||
StartScreen::StartScreen(SDL_Renderer* renderer):renderer_(renderer) {
|
||||
if(!renderer_)throw std::runtime_error("Start screen: missing renderer");
|
||||
SDL_RenderGetLogicalSize(renderer_,&previous_width_,&previous_height_);
|
||||
int channels=0;
|
||||
const std::unique_ptr<unsigned char,decltype(&stbi_image_free)> pixels(
|
||||
stbi_load_from_memory(start_screen_jpeg,int(start_screen_jpeg_size),&width_,&height_,&channels,3),stbi_image_free);
|
||||
if(!pixels)throw std::runtime_error("Start screen: embedded artwork could not be decoded");
|
||||
texture_=SDL_CreateTexture(renderer_,SDL_PIXELFORMAT_RGB24,SDL_TEXTUREACCESS_STATIC,width_,height_);
|
||||
if(!texture_)throw std::runtime_error(SDL_GetError());
|
||||
if(SDL_UpdateTexture(texture_,nullptr,pixels.get(),width_*3)!=0||SDL_SetTextureScaleMode(texture_,SDL_ScaleModeLinear)!=0) {
|
||||
const std::string error=SDL_GetError();SDL_DestroyTexture(texture_);texture_=nullptr;throw std::runtime_error(error);
|
||||
}
|
||||
}
|
||||
StartScreen::~StartScreen() {
|
||||
SDL_DestroyTexture(texture_);
|
||||
SDL_RenderSetLogicalSize(renderer_,previous_width_,previous_height_);
|
||||
}
|
||||
void StartScreen::present() {
|
||||
if(SDL_RenderSetLogicalSize(renderer_,width_,height_)!=0)throw std::runtime_error(SDL_GetError());
|
||||
Uint8 r=0,g=0,b=0,a=0;SDL_GetRenderDrawColor(renderer_,&r,&g,&b,&a);
|
||||
SDL_SetRenderDrawColor(renderer_,0,0,0,255);
|
||||
const int cleared=SDL_RenderClear(renderer_);SDL_SetRenderDrawColor(renderer_,r,g,b,a);
|
||||
if(cleared!=0||SDL_RenderCopy(renderer_,texture_,nullptr,nullptr)!=0)throw std::runtime_error(SDL_GetError());
|
||||
SDL_RenderPresent(renderer_);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#pragma once
|
||||
struct SDL_Renderer;
|
||||
struct SDL_Texture;
|
||||
namespace bmh::app {
|
||||
// Owned, embedded artwork, rendered independently of the indexed game canvas.
|
||||
// Destruction restores the caller's logical size and therefore its input mapping.
|
||||
class StartScreen {
|
||||
public:
|
||||
explicit StartScreen(SDL_Renderer*);
|
||||
~StartScreen();
|
||||
StartScreen(const StartScreen&)=delete;
|
||||
StartScreen& operator=(const StartScreen&)=delete;
|
||||
void present();
|
||||
int width()const{return width_;}
|
||||
int height()const{return height_;}
|
||||
private:
|
||||
SDL_Renderer* renderer_;
|
||||
SDL_Texture* texture_=nullptr;
|
||||
int width_=0,height_=0,previous_width_=0,previous_height_=0;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#pragma once
|
||||
#include <cstddef>
|
||||
namespace bmh::app {
|
||||
extern const unsigned char start_screen_jpeg[];
|
||||
extern const std::size_t start_screen_jpeg_size;
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
# stb_image
|
||||
|
||||
Unmodified upstream stb_image 2.30 header, commit `013ac3beddff3dbffafd5177e7972067cd2b5083`.
|
||||
Source: [013ac3beddff3dbffafd5177e7972067cd2b5083](https://github.com/nothings/stb/blob/013ac3beddff3dbffafd5177e7972067cd2b5083/stb_image.h).
|
||||
SHA256: `594c2fe35d49488b4382dbfaec8f98366defca819d916ac95becf3e75f4200b3`.
|
||||
|
||||
Only JPEG decoding is compiled. The complete dual MIT/public-domain license
|
||||
is retained in the header and in `docs/licenses/stb_image.txt`.
|
||||
Vendored
+7988
File diff suppressed because it is too large.
Load diff
@@ -1559,6 +1559,7 @@ inline constexpr auto SaveLoad_Render_ExecutableField = 0xa148f;
|
||||
inline constexpr auto SaveLoad_Render_RuntimeField = 0xa2334;
|
||||
inline constexpr auto SaveLoad_Render_RuntimeField2 = 0xa233f;
|
||||
inline constexpr auto SaveLoad_Render_RuntimeField3 = 0xa234a;
|
||||
inline constexpr auto SaveLoad_OverwriteQuestionPointer = 0xa21c4;
|
||||
inline constexpr auto SaveLoad_Render_TextPointer = 0xa1512;
|
||||
inline constexpr auto SaveLoad_Render_TextPointer2 = 0xae5f0;
|
||||
inline constexpr auto SaveLoad_Render_TextPointer3 = 0xae620;
|
||||
|
||||
@@ -26,6 +26,7 @@ constexpr uint32_t kEnFileOffset = 0x496d;
|
||||
constexpr uint32_t kEnDataStart = ::bmh::layout::EnDataStart, kEnDataEnd = ::bmh::layout::Career_CompetitionPointersEnglish_RuntimeField;
|
||||
constexpr uint32_t kFltdSize = 507925;
|
||||
constexpr uint32_t kEnglishCalendarDateSetup = 0x684;
|
||||
constexpr uint32_t kEnglishOverwriteQuestionPointer = 0x6c43c;
|
||||
// The German image the engine expects: LE objects from layout field, data object GermanDataSegmentBegin-layout field.
|
||||
constexpr uint32_t kDeBase = 0x10000, kDeEnd = ::bmh::layout::GermanImageEnd;
|
||||
// A zero byte in the German BSS: the empty string of empty_pointers entries.
|
||||
|
||||
@@ -122,7 +122,15 @@
|
||||
{::bmh::layout::TransferMarket_Click_RuntimeField, 2, Kind::copy, ::bmh::layout::EnglishLayoutTranslation246, {}},
|
||||
{::bmh::layout::TransferMarket_Click_RuntimeField2, 2, Kind::copy, ::bmh::layout::EnglishLayoutTranslation246, {}},
|
||||
{::bmh::layout::TransferMarket_Click_RuntimeField3, 74, Kind::copy, ::bmh::layout::EnglishLayoutTranslation247, {}},
|
||||
{::bmh::layout::Bank_OriginalToUtf8_RuntimeField, 144, Kind::empty_pointers, 0, {}},
|
||||
// Keep the overwrite pointer's next entry exactly four bytes away: copy
|
||||
// entries extend to their following destination, while other slots stay empty.
|
||||
{::bmh::layout::Bank_OriginalToUtf8_RuntimeField,
|
||||
::bmh::layout::SaveLoad_OverwriteQuestionPointer - ::bmh::layout::Bank_OriginalToUtf8_RuntimeField,
|
||||
Kind::empty_pointers, 0, {}},
|
||||
{::bmh::layout::SaveLoad_OverwriteQuestionPointer, 4, Kind::copy, kEnglishOverwriteQuestionPointer, {}},
|
||||
{::bmh::layout::SaveLoad_OverwriteQuestionPointer + 4,
|
||||
::bmh::layout::Bank_OriginalToUtf8_RuntimeField + 144 - (::bmh::layout::SaveLoad_OverwriteQuestionPointer + 4),
|
||||
Kind::empty_pointers, 0, {}},
|
||||
{::bmh::layout::Analytics_FormatError_ExecutableField, 72, Kind::copy, ::bmh::layout::EnglishLayoutTranslation50, {}}, // EN196f1: graph labels, distinct from fund-name suffixes
|
||||
{::bmh::layout::AdGroupId, 1, Kind::copy, ::bmh::layout::EnglishLayoutTranslation51, {}},
|
||||
{::bmh::layout::GameEnd_SourceHyphenator_ExecutableField, 18, Kind::copy, ::bmh::layout::EnglishLayoutTranslation52, {}},
|
||||
|
||||
@@ -379,7 +379,7 @@ ResolvedGame resolve_game(const fs::path& input, const fs::path& cache) {
|
||||
const fs::path marker = prepared / ".openbmh-english";
|
||||
// the version of the translation (launch/fltd.cpp, fltd_map.inc): a cache built
|
||||
// by another version is built again
|
||||
constexpr const char* kTranslation = "english translation 15"; // 15: original pitch affinity tables and pointer bitmap (14: calendar epoch)
|
||||
constexpr const char* kTranslation = "english translation 16"; // 16: overwrite question pointer (15: original pitch affinity tables and pointer bitmap)
|
||||
std::string built;
|
||||
{
|
||||
std::ifstream in(marker);
|
||||
|
||||
@@ -94,6 +94,7 @@ set(BMH_UI_REFERENCE_SAVE "" CACHE FILEPATH "Optional original LABA0012 desktop
|
||||
add_executable(ui_desktop_tests desktop_tests.cpp)
|
||||
target_link_libraries(ui_desktop_tests PRIVATE bmhui)
|
||||
set(BMH_TEST_UI_DESKTOP_TESTS_INPUT_1 "" CACHE PATH "External input 1 for ui_desktop_tests; not distributed")
|
||||
bmh_add_data_test(NAME ui_desktop_input_tests COMMAND ui_desktop_tests "${BMH_DATA}" --input-only)
|
||||
bmh_add_data_test(NAME ui_desktop_tests REQUIRED_OPTIONS BMH_TEST_UI_DESKTOP_TESTS_INPUT_1 COMMAND ui_desktop_tests "${BMH_DATA}" "${BMH_UI_REFERENCE_SAVE}"
|
||||
"${BMH_TEST_UI_DESKTOP_TESTS_INPUT_1}")
|
||||
set(BMH_UI_PREPARATION_SAVE "" CACHE FILEPATH "Optional original LABA0020 reference after observed menu entry effects; never bundled")
|
||||
|
||||
+58
-16
@@ -679,16 +679,14 @@ Image AdvertisingScreen::render() const {
|
||||
draw_finance(state_.finance_preview.expenses_text, 198, 222);
|
||||
text(image, 254, 218, state_.finance_preview.balance_text, 0x6b, 64);
|
||||
|
||||
if (selected_contract_ >= 0) {
|
||||
const auto& contract = selected_contract_ < kBoardCount
|
||||
? state_.boards[size_t(selected_contract_)]
|
||||
: selected_contract_ == 14 ? state_.shirt : state_.television;
|
||||
if (selected_contract_ < 16) {
|
||||
const int i = selected_contract_;
|
||||
rectangle(image, exe.u16(::bmh::layout::Advertising_Click_RuntimeField3 + uint32_t(i) * 2), exe.u16(::bmh::layout::Advertising_Click_RuntimeField4 + uint32_t(i) * 2),
|
||||
exe.u16(::bmh::layout::Advertising_Click_RuntimeField5 + uint32_t(i) * 2), exe.u16(::bmh::layout::Advertising_Click_RuntimeField6 + uint32_t(i) * 2), 0x27);
|
||||
}
|
||||
const auto& offer_list = state_.offers[size_t(selected_contract_)];
|
||||
// The original details panel follows the pointer until the offer browser owns it.
|
||||
const int details_target = offer_open_ ? selected_contract_ :
|
||||
hovered_target_ >= 0 && hovered_target_ < 16 ? hovered_target_ : -1;
|
||||
if (details_target >= 0) {
|
||||
const auto& contract = details_target < kBoardCount
|
||||
? state_.boards[size_t(details_target)]
|
||||
: details_target == 14 ? state_.shirt : state_.television;
|
||||
const auto& offer_list = state_.offers[size_t(details_target)];
|
||||
const bmh::AdvertisingOfferCandidate* offer = nullptr;
|
||||
if (offer_open_ && selected_offer_ >= 0)
|
||||
for (const auto& candidate : offer_list.offers)
|
||||
@@ -732,7 +730,7 @@ Image AdvertisingScreen::render() const {
|
||||
}
|
||||
text(image, 156, 185, show_offer ? state_.offer_label : state_.bonus_label, 0x6c, 34);
|
||||
text(image, 191, 185, original_to_utf8(exe_.cstring(::bmh::layout::Advertising_FormatError_ExecutableField)) + (show_offer
|
||||
? state_.offer_amount_text[size_t(selected_contract_)][size_t(selected_offer_)]
|
||||
? state_.offer_amount_text[size_t(details_target)][size_t(selected_offer_)]
|
||||
: contract.amount_text), 0x6c, 100);
|
||||
if (!offer_open_ && contract.active && contract.months_remaining == 0 &&
|
||||
contract.extension_months != 0)
|
||||
@@ -761,10 +759,12 @@ Image AdvertisingScreen::render() const {
|
||||
button(image, 164, 191, 66, state_.accept_label);
|
||||
}
|
||||
}
|
||||
if (selected_spending_slot_ >= 16 && selected_spending_slot_ <= 18) {
|
||||
const uint32_t i = uint32_t(selected_spending_slot_);
|
||||
rectangle(image, exe_.u16(::bmh::layout::Advertising_Click_RuntimeField3 + i * 2), exe_.u16(::bmh::layout::Advertising_Click_RuntimeField4 + i * 2),
|
||||
exe_.u16(::bmh::layout::Advertising_Click_RuntimeField5 + i * 2), exe_.u16(::bmh::layout::Advertising_Click_RuntimeField6 + i * 2), 0x27);
|
||||
if (hovered_target_ >= 0) {
|
||||
const uint32_t at = uint32_t(hovered_target_) * 2;
|
||||
rectangle(image, exe.u16(::bmh::layout::Advertising_Click_RuntimeField3 + at),
|
||||
exe.u16(::bmh::layout::Advertising_Click_RuntimeField4 + at),
|
||||
exe.u16(::bmh::layout::Advertising_Click_RuntimeField5 + at),
|
||||
exe.u16(::bmh::layout::Advertising_Click_RuntimeField6 + at), 0x27);
|
||||
}
|
||||
if (spending_calculator_open_ && spending_backdrop_) image = *spending_backdrop_;
|
||||
if (notification_open()) draw_notification(image);
|
||||
@@ -858,6 +858,7 @@ void AdvertisingScreen::draw_notification(Image& out) const {
|
||||
bool AdvertisingScreen::dismiss_notification() {
|
||||
if (!notification_open()) return false;
|
||||
notification_dismissed_ = true;
|
||||
refresh_hover();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -894,6 +895,7 @@ void AdvertisingScreen::open_spending_calculator(int display_slot) {
|
||||
void AdvertisingScreen::close_spending_calculator() {
|
||||
spending_calculator_open_ = false;
|
||||
spending_backdrop_.reset();
|
||||
refresh_hover();
|
||||
}
|
||||
|
||||
bool AdvertisingScreen::accept_spending_calculator() {
|
||||
@@ -941,6 +943,7 @@ bool AdvertisingScreen::text(std::string_view input) {
|
||||
|
||||
void AdvertisingScreen::begin_offer_browser(int display_slot) {
|
||||
selected_contract_ = display_slot;
|
||||
hovered_target_ = display_slot;
|
||||
offer_open_ = true;
|
||||
selected_offer_ = -1;
|
||||
const auto& offers = state_.offers[size_t(display_slot)].offers;
|
||||
@@ -1000,11 +1003,41 @@ bool AdvertisingScreen::reject_action(std::string reason) {
|
||||
(void)utf8_to_original(reason);
|
||||
if (pending_->kind == AdvertisingActionKind::set_spending) close_spending_calculator();
|
||||
pending_.reset();
|
||||
refresh_hover();
|
||||
feedback_ = std::move(reason);
|
||||
return true;
|
||||
}
|
||||
|
||||
void AdvertisingScreen::refresh_hover() {
|
||||
if (pointer_position_) (void)move((*pointer_position_)[0], (*pointer_position_)[1]);
|
||||
else hovered_target_ = -1;
|
||||
}
|
||||
|
||||
bool AdvertisingScreen::move(int x, int y) {
|
||||
// Modal input freezes the parent view, but its last physical position must
|
||||
// be sampled again as soon as that modal returns.
|
||||
pointer_position_ = std::array<int, 2>{x, y};
|
||||
if (close_requested_ || pending_ || notification_open() || spending_calculator_open_ || offer_open_)
|
||||
return false;
|
||||
int target = -1;
|
||||
for (int i = 0; i < 19; ++i) {
|
||||
const uint32_t at = uint32_t(i) * 2;
|
||||
const int left = exe_.u16(::bmh::layout::Advertising_Click_RuntimeField3 + at);
|
||||
const int top = exe_.u16(::bmh::layout::Advertising_Click_RuntimeField4 + at);
|
||||
const int width = exe_.u16(::bmh::layout::Advertising_Click_RuntimeField5 + at);
|
||||
const int height = exe_.u16(::bmh::layout::Advertising_Click_RuntimeField6 + at);
|
||||
if (x >= left && x < left + width && y >= top && y < top + height) {
|
||||
target = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (target == hovered_target_) return false;
|
||||
hovered_target_ = target;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AdvertisingScreen::click(int x, int y) {
|
||||
pointer_position_ = std::array<int, 2>{x, y};
|
||||
if (close_requested_ || pending_ || x < 0 || y < 0 || x >= 320 || y >= 240) return false;
|
||||
if (notification_open()) return dismiss_notification();
|
||||
if (spending_calculator_open_) {
|
||||
@@ -1035,6 +1068,7 @@ bool AdvertisingScreen::click(int x, int y) {
|
||||
offer_open_ = false;
|
||||
selected_offer_ = -1;
|
||||
feedback_.clear();
|
||||
refresh_hover();
|
||||
return true;
|
||||
}
|
||||
if (x >= 164 && x <= 229 && y >= 191 && y <= 200) {
|
||||
@@ -1056,6 +1090,7 @@ bool AdvertisingScreen::click(int x, int y) {
|
||||
const int right = left + exe_.u16(::bmh::layout::Advertising_Click_RuntimeField5 + uint32_t(i) * 2);
|
||||
const int bottom = top + exe_.u16(::bmh::layout::Advertising_Click_RuntimeField6 + uint32_t(i) * 2);
|
||||
if (x >= left && x < right && y >= top && y < bottom) {
|
||||
(void)move(x, y);
|
||||
const auto& projected = state_.offers[size_t(i)];
|
||||
const bool renewal_due = projected.contract_slot >= 0 && projected.contract_slot < 16 &&
|
||||
(projected.contract_bytes[6] & 0x7f) != 0 && projected.contract_bytes[5] == 0;
|
||||
@@ -1086,6 +1121,7 @@ bool AdvertisingScreen::click(int x, int y) {
|
||||
const int right = left + exe_.u16(::bmh::layout::Advertising_Click_RuntimeField5 + uint32_t(i) * 2);
|
||||
const int bottom = top + exe_.u16(::bmh::layout::Advertising_Click_RuntimeField6 + uint32_t(i) * 2);
|
||||
if (x >= left && x < right && y >= top && y < bottom) {
|
||||
(void)move(x, y);
|
||||
selected_contract_ = -1;
|
||||
selected_spending_slot_ = i;
|
||||
open_spending_calculator(i);
|
||||
@@ -1110,7 +1146,12 @@ bool AdvertisingScreen::key(std::string_view value) {
|
||||
return text(value);
|
||||
}
|
||||
if (value == "ESC") {
|
||||
if (offer_open_) { offer_open_ = false; selected_offer_ = -1; return true; }
|
||||
if (offer_open_) {
|
||||
offer_open_ = false;
|
||||
selected_offer_ = -1;
|
||||
refresh_hover();
|
||||
return true;
|
||||
}
|
||||
close_requested_ = true;
|
||||
return true;
|
||||
}
|
||||
@@ -1122,6 +1163,7 @@ std::string AdvertisingScreen::state_json() const {
|
||||
if (!result.empty() && result.back() == '}') result.pop_back();
|
||||
result += ",\"spending_calculator_open\":" +
|
||||
std::string(spending_calculator_open_ ? "true" : "false") +
|
||||
",\"hovered_target\":" + std::to_string(hovered_target_) +
|
||||
",\"selected_spending_slot\":" + std::to_string(selected_spending_slot_) +
|
||||
",\"spending_input\":" + std::to_string(spending_input_) +
|
||||
",\"notification_open\":" + std::string(notification_open() ? "true" : "false");
|
||||
|
||||
@@ -105,6 +105,7 @@ public:
|
||||
AdvertisingScreen(const std::filesystem::path& data, AdvertisingState state,
|
||||
uint64_t request_id_seed = 1);
|
||||
Image render() const;
|
||||
bool move(int x, int y);
|
||||
bool click(int x, int y);
|
||||
bool key(std::string_view key);
|
||||
bool open_offers(int display_slot);
|
||||
@@ -112,6 +113,8 @@ public:
|
||||
const std::optional<AdvertisingRequest>& pending() const { return pending_; }
|
||||
bool reject_action(std::string reason);
|
||||
int selected_contract() const { return selected_contract_; }
|
||||
int hovered_target() const { return hovered_target_; }
|
||||
std::optional<std::array<int, 2>> pointer_position() const { return pointer_position_; }
|
||||
int selected_offer() const { return selected_offer_; }
|
||||
bool offer_open() const { return offer_open_; }
|
||||
bool spending_calculator_open() const { return spending_calculator_open_; }
|
||||
@@ -136,6 +139,8 @@ private:
|
||||
std::optional<Image> badge_atlas_;
|
||||
std::optional<Image> spending_backdrop_;
|
||||
int selected_contract_ = -1;
|
||||
int hovered_target_ = -1;
|
||||
std::optional<std::array<int, 2>> pointer_position_;
|
||||
int selected_spending_slot_ = -1;
|
||||
int selected_offer_ = -1;
|
||||
uint64_t next_request_id_ = 1;
|
||||
@@ -157,6 +162,7 @@ private:
|
||||
bool accept_spending_calculator();
|
||||
void close_spending_calculator();
|
||||
bool dismiss_notification();
|
||||
void refresh_hover();
|
||||
void draw_spending_calculator(Image&) const;
|
||||
void draw_notification(Image&) const;
|
||||
void pattern_rect(Image&, int x, int y, int width, int height) const;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "ui/advertising.hpp"
|
||||
#include "ui/source_notice_test_helpers.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <filesystem>
|
||||
#include <functional>
|
||||
@@ -281,6 +282,54 @@ int main(int argc, char** argv) {
|
||||
check(pixel(first, exe.u16(::bmh::layout::Advertising_Click_RuntimeField3) + x, exe.u16(::bmh::layout::Advertising_Click_RuntimeField4) + y) ==
|
||||
pixel(logos, x, y),
|
||||
"active board logos use the original KB/34 partner sprite and hitbox coordinates");
|
||||
// Motion alone must display the original rectangle and details; it must
|
||||
// never open negotiations, spending, or emit an engine action.
|
||||
AdvertisingScreen hover(data, state);
|
||||
for (int target = 0; target < 19; ++target) {
|
||||
const uint32_t at = uint32_t(target) * 2;
|
||||
const int x = exe.u16(::bmh::layout::Advertising_Click_RuntimeField3 + at);
|
||||
const int y = exe.u16(::bmh::layout::Advertising_Click_RuntimeField4 + at);
|
||||
const int width = exe.u16(::bmh::layout::Advertising_Click_RuntimeField5 + at);
|
||||
const int height = exe.u16(::bmh::layout::Advertising_Click_RuntimeField6 + at);
|
||||
check(hover.move(x + 1, y + 1) && hover.hovered_target() == target &&
|
||||
!hover.move(x + 2, y + 2) && !hover.pending() && !hover.offer_open() &&
|
||||
!hover.spending_calculator_open() && hover.selected_contract() == -1,
|
||||
"pointer motion follows every original advertising target without an action");
|
||||
const auto highlighted = hover.render();
|
||||
for (int dx = 0; dx < width; ++dx)
|
||||
check(pixel(highlighted, x + dx, y) == 0x27 &&
|
||||
pixel(highlighted, x + dx, y + height - 1) == 0x27,
|
||||
"hover paints the original yellow top and bottom rectangle edges");
|
||||
for (int dy = 0; dy < height; ++dy)
|
||||
check(pixel(highlighted, x, y + dy) == 0x27 &&
|
||||
pixel(highlighted, x + width - 1, y + dy) == 0x27,
|
||||
"hover paints the original yellow left and right rectangle edges");
|
||||
check(hover.move(-1, -1) && hover.hovered_target() == -1 &&
|
||||
hover.render().pixels == first.pixels && !hover.move(-1, -1),
|
||||
"leaving a target restores both the outline and details without sticky selection");
|
||||
}
|
||||
const int empty_slot = int(std::find_if(state.boards.begin(), state.boards.end(),
|
||||
[](const auto& contract) { return !contract.active; }) - state.boards.begin());
|
||||
check(empty_slot < 14 && !state.space_available_text.empty(),
|
||||
"fixture provides an empty advertising surface and edition-specific help");
|
||||
auto no_help_state = state;
|
||||
no_help_state.space_available_text.clear();
|
||||
AdvertisingScreen no_help(data, no_help_state);
|
||||
const int empty_x = exe.u16(::bmh::layout::Advertising_Click_RuntimeField3 + empty_slot * 2) + 1;
|
||||
const int empty_y = exe.u16(::bmh::layout::Advertising_Click_RuntimeField4 + empty_slot * 2) + 1;
|
||||
check(hover.move(empty_x, empty_y) && no_help.move(empty_x, empty_y) &&
|
||||
hover.render().pixels != no_help.render().pixels &&
|
||||
state.space_available_text == original_to_utf8(message_text(game,
|
||||
::bmh::layout::Advertising_FormatError_TextPointer7)),
|
||||
"empty-surface hover renders help from the installation's actual TEXTD pointer");
|
||||
AdvertisingScreen spending_hover(data, state);
|
||||
const int spending_x = exe.u16(::bmh::layout::Advertising_Click_RuntimeField3 + 17 * 2) + 1;
|
||||
const int spending_y = exe.u16(::bmh::layout::Advertising_Click_RuntimeField4 + 17 * 2) + 1;
|
||||
check(spending_hover.move(spending_x, spending_y) && hover.move(spending_x, spending_y) &&
|
||||
hover.render().pixels == spending_hover.render().pixels,
|
||||
"moving directly from empty-surface help to spending clears the contract detail panel");
|
||||
check(game.manager_records == records_before,
|
||||
"all hover targets and help rendering leave the manager records unchanged");
|
||||
check(screen.click(exe.u16(::bmh::layout::Advertising_Click_RuntimeField3) + 1, exe.u16(::bmh::layout::Advertising_Click_RuntimeField4) + 1) &&
|
||||
screen.selected_contract() == 0,
|
||||
"a board click selects a local read-only details panel");
|
||||
@@ -295,6 +344,9 @@ int main(int argc, char** argv) {
|
||||
screen.key("ESC") && screen.close_requested() && !screen.key("LEFT"),
|
||||
"ESC closes an existing offer browser before the screen");
|
||||
} else {
|
||||
check(screen.move(-1, -1) && screen.render().pixels == first.pixels &&
|
||||
screen.selected_contract() == 0,
|
||||
"a clicked contract without offers does not leave a sticky outline or details");
|
||||
check(screen.key("ESC") && screen.close_requested() && !screen.key("LEFT"),
|
||||
"without a saved offer, ESC closes the contract details directly");
|
||||
}
|
||||
@@ -318,6 +370,10 @@ int main(int argc, char** argv) {
|
||||
const bool opened = offers.open_offers(0);
|
||||
check(opened && offers.offer_open() && offers.selected_offer() == 5,
|
||||
"opening the source offer browser selects the highest saved raw offer");
|
||||
const auto offer_pixels = offers.render().pixels;
|
||||
check(!offers.move(empty_x, empty_y) && offers.render().pixels == offer_pixels &&
|
||||
offers.selected_offer() == 5 && !offers.pending(),
|
||||
"offer browser keeps its input and details when the pointer crosses the parent targets");
|
||||
check(offers.click(140, 164) && offers.selected_offer() == 4 &&
|
||||
!offers.click(190, 195) && !offers.pending(),
|
||||
"an empty raw slot cannot create an acceptance request");
|
||||
@@ -351,6 +407,17 @@ int main(int argc, char** argv) {
|
||||
offers.close_requested(),
|
||||
"cancel closes the offer browser first; a second ESC closes the screen");
|
||||
|
||||
AdvertisingScreen resumed_offers(data, offer_state);
|
||||
const auto closed_offer_pixels = resumed_offers.render().pixels;
|
||||
check(resumed_offers.open_offers(0) && !resumed_offers.move(-1, -1) &&
|
||||
resumed_offers.key("ESC") && resumed_offers.hovered_target() == -1 &&
|
||||
resumed_offers.render().pixels == closed_offer_pixels,
|
||||
"offer ESC rechecks the pointer moved during the modal without another motion event");
|
||||
check(resumed_offers.open_offers(0) && resumed_offers.click(110, 195) &&
|
||||
resumed_offers.hovered_target() == -1 &&
|
||||
resumed_offers.render().pixels == closed_offer_pixels,
|
||||
"offer cancel rechecks its own click position and removes the old target outline");
|
||||
|
||||
// The three source spending controls open the original calculator. All
|
||||
// editing remains local; only J/Enter on a changed value creates a
|
||||
// manager/revision-bound request for the app controller.
|
||||
@@ -377,6 +444,9 @@ int main(int argc, char** argv) {
|
||||
"the original merchandise hitbox opens its calculator with the saved value");
|
||||
const auto calculator_art = load_vga(asset_path(data / "KB", "6.VGA"));
|
||||
const auto calculator_image = merchandise.render();
|
||||
check(!merchandise.move(empty_x, empty_y) &&
|
||||
merchandise.render().pixels == calculator_image.pixels && !merchandise.pending(),
|
||||
"spending calculator retains its captured parent and does not hover through it");
|
||||
check(calculator_image.pixels[size_t(55) * 320 + 103] == calculator_art.pixels[0],
|
||||
"the calculator opens over the original advertising screen using KB/6 at source coordinates");
|
||||
check(merchandise.text("200000") && merchandise.spending_input() == 200000 &&
|
||||
@@ -411,6 +481,20 @@ int main(int argc, char** argv) {
|
||||
unchanged_budget.spending_input() == 10000 && unchanged_budget.key("J") &&
|
||||
!unchanged_budget.pending() && !unchanged_budget.spending_calculator_open(),
|
||||
"accepting an unchanged monthly budget closes locally without an engine request");
|
||||
AdvertisingScreen resumed_budget(data, spending_state);
|
||||
const auto closed_budget_pixels = resumed_budget.render().pixels;
|
||||
check(resumed_budget.click(budget_x, budget_y) && !resumed_budget.move(-1, -1) &&
|
||||
resumed_budget.key("ESC") && resumed_budget.hovered_target() == -1 &&
|
||||
resumed_budget.render().pixels == closed_budget_pixels,
|
||||
"calculator ESC restores the current off-target pointer without another motion event");
|
||||
AdvertisingScreen expected_parent(data, spending_state);
|
||||
check(expected_parent.move(empty_x, empty_y) &&
|
||||
resumed_budget.click(budget_x, budget_y) && !resumed_budget.move(empty_x, empty_y) &&
|
||||
resumed_budget.key("J") && !resumed_budget.pending() &&
|
||||
resumed_budget.hovered_target() == empty_slot &&
|
||||
resumed_budget.render().pixels == expected_parent.render().pixels,
|
||||
"unchanged calculator acceptance resumes hover over the current parent target");
|
||||
|
||||
|
||||
AdvertisingScreen preset_budget(data, spending_state, 0x300000018ULL);
|
||||
const int preset0_x = 103 + exe.u16(::bmh::layout::Advertising_Click_RuntimeField + 15 * 2);
|
||||
|
||||
+15
-9
@@ -309,8 +309,12 @@ std::optional<DeskItem> DesktopScreen::folder_child_at(int x,int y) const {
|
||||
const int inset = folder.kind >= 50 && !folder.open ? 8 : 0;
|
||||
if (x < folder.x || y < folder.y || x >= folder.x + folder.width - inset ||
|
||||
y >= folder.y + folder.height - inset) continue;
|
||||
if(folder.disabled||folder.kind<50||folder.kind>52||!folder.open) return std::nullopt;
|
||||
const int folder_id=folder.kind-50,left=folder.x+9,top=folder.y+8,right=folder.x+folder.width-4,bottom=folder.y+folder.height-4;
|
||||
if(folder.disabled||folder.kind<50||folder.kind>52) return std::nullopt;
|
||||
// The open bit adds a frame; unframed folders still draw usable tiles.
|
||||
// Match DeskDrawerRenderer's content origin and wrapping bounds.
|
||||
const int frame = folder.open ? 4 : 0;
|
||||
const int folder_id=folder.kind-50,left=folder.x+frame+5,top=folder.y+frame+4;
|
||||
const int right=folder.x+frame+folder.width-4,bottom=folder.y+frame+folder.height-4;
|
||||
int child_x=left,child_y=top;
|
||||
for(uint8_t id:state_.folder_icon_slots[size_t(folder_id)]) {
|
||||
if(child_x+32>right) child_x=left,child_y+=27;
|
||||
@@ -396,9 +400,9 @@ DeskRequest DesktopScreen::pointer_down(int x, int y, bool right) {
|
||||
}
|
||||
if (right && !state_.drawer_handles) return {};
|
||||
if (right && bin_mode_ && item.kind!=12) return {};
|
||||
if (!right && item.kind==55 && item.open && !state_.national_team &&
|
||||
x-item.x-4>34 && x-item.x-4<87) return {}; // Original ticket-price scale.
|
||||
if (!right && item.kind==64 && item.open) return {}; // Source automation controls remain clicks.
|
||||
if (!right && item.kind==55 && !state_.national_team &&
|
||||
x-item.x-(item.open?4:0)>34 && x-item.x-(item.open?4:0)<87) return {}; // Original ticket-price scale.
|
||||
if (!right && item.kind==64) return {}; // Source automation controls remain clicks.
|
||||
const bool drawer_handle=item.kind>=50&&state_.drawer_handles&&x<=item.x+3&&y<=item.y+3;
|
||||
if (!right) return {}; // LMB closes/activates; RMB alone starts a drag.
|
||||
layout_drag_ = LayoutDrag{item.id, x - item.x, y - item.y, item.x, item.y, -1, false, false, drawer_handle, right};
|
||||
@@ -653,10 +657,12 @@ DeskRequest DesktopScreen::click(int x, int y, bool right) {
|
||||
// The corner closes through the same transaction as the quickbar.
|
||||
if (item.open && state_.drawer_handles && x <= item.x + 3 && y <= item.y + 3)
|
||||
return close_drawer(item);
|
||||
if (item.kind == 58 && item.open) return request(DeskRequestKind::advance_turn, item);
|
||||
if (item.kind == 55 && item.open && !state_.national_team && x - item.x - 4 > 34 && x - item.x - 4 < 87)
|
||||
return request(DeskRequestKind::change_ticket_price, item, (x - item.x - 4 - 35) / 3 + 8);
|
||||
if (item.kind == 64 && item.open) return request(DeskRequestKind::change_option, item, std::clamp((x - item.x - 4) / 33, 0, 4));
|
||||
// The date remains an advance control with or without its optional frame.
|
||||
if (item.kind == 58) return request(DeskRequestKind::advance_turn, item);
|
||||
const int content_x = item.x + (item.open ? 4 : 0);
|
||||
if (item.kind == 55 && !state_.national_team && x - content_x > 34 && x - content_x < 87)
|
||||
return request(DeskRequestKind::change_ticket_price, item, (x - content_x - 35) / 3 + 8);
|
||||
if (item.kind == 64) return request(DeskRequestKind::change_option, item, std::clamp((x - content_x) / 33, 0, 4));
|
||||
return {}; // Noninteractive status fields must not invent layout/game changes.
|
||||
}
|
||||
return {};
|
||||
|
||||
+345
-251
@@ -592,13 +592,354 @@ void set_preparation_revision_source(PreparationState& state, uint64_t revision,
|
||||
if(state.pitch){state.pitch->revision=revision;state.pitch->source=source;}
|
||||
for(auto& card:state.player_cards){card.lineup.revision=revision;card.lineup.source=source;}
|
||||
}
|
||||
// Pointer regressions share synthetic desktop records across supported editions.
|
||||
void folder_pointer_input_tests(const std::filesystem::path& data,const LeImage& exe) {
|
||||
auto menu_game = fixture();
|
||||
menu_game.memory.set8(::bmh::layout::Desktops + 44 * 16 + 12, 63); // mailbox occurs before the menu shortcut in this scan
|
||||
menu_game.memory.set8(::bmh::layout::Desktops + 53 * 16 + 12, 72); // final compact-bar cell dispatches MEN
|
||||
auto menu_desk = desk_from_game(menu_game, exe, 6);
|
||||
check(menu_desk.mailbox_shortcut && menu_desk.menu_layout_shortcut &&
|
||||
menu_desk.menu_layout_shortcut->id == 53,
|
||||
"Source final compact-bar cell resolves record 53/kind 72 independently of linked drawers");
|
||||
menu_desk.shortcut_bar_always = false;
|
||||
DesktopScreen edge_bar(data, menu_desk);
|
||||
const auto edge_hidden = edge_bar.render();
|
||||
check(!edge_bar.pointer_move(160, 238), "Source quickbar edge requires exactly y239");
|
||||
check(edge_bar.pointer_move(160, 239) && edge_bar.render().pixels != edge_hidden.pixels &&
|
||||
!edge_bar.pending() && edge_bar.state().layout_records == menu_desk.layout_records,
|
||||
"lower-edge motion shows quickbar without an action or Native layout edits");
|
||||
const auto edge_shown = edge_bar.render();
|
||||
const auto quickbar_art = load_vga(asset_path(data / "KB", "3.VGA"));
|
||||
for (int y = 0; y < 20; ++y) for (int x = 0; x < 20; ++x)
|
||||
check(edge_shown.pixels[size_t(207 + y) * 320 + 299 + x] ==
|
||||
quickbar_art.pixels[size_t(75 + y) * quickbar_art.width + exe.u8(::bmh::layout::Desktop_Render_RuntimeField3) + x],
|
||||
"visible Source quickbar copies the complete normal socket sprite before any press");
|
||||
check(!edge_bar.pointer_move(250, 239) && edge_bar.click(250, 239).kind == DeskRequestKind::none &&
|
||||
edge_bar.render().pixels == edge_shown.pixels,
|
||||
"motion along edge and click at the same edge do not toggle the Source y latch twice");
|
||||
check(edge_bar.pointer_move(292, 221), "MEN quickbar cell motion selects its Source hover label");
|
||||
const auto hover_frame = edge_bar.render();
|
||||
int hover_pixels = 0;
|
||||
for (int y = 0; y < 240; ++y) for (int x = 0; x < 320; ++x)
|
||||
if (hover_frame.pixels[size_t(y) * 320 + x] != edge_shown.pixels[size_t(y) * 320 + x]) {
|
||||
check(y >= 230 && y <= 235, "Source quickbar label changes only the footer Font3 rows");
|
||||
++hover_pixels;
|
||||
}
|
||||
check(hover_pixels > 0 && !edge_bar.pointer_move(291, 221),
|
||||
"Source hover title renders once and stays stable inside the same cell");
|
||||
check(edge_bar.pointer_move(160, 238) && edge_bar.render().pixels == edge_shown.pixels,
|
||||
"leaving the cell restores the footer without hiding the quickbar");
|
||||
check(edge_bar.pointer_move(160, 239) && edge_bar.render().pixels == edge_hidden.pixels,
|
||||
"re-entering the lower edge toggles the quickbar off without a click");
|
||||
auto always_desk = menu_desk; always_desk.shortcut_bar_always = true;
|
||||
DesktopScreen always_bar(data, always_desk);
|
||||
const auto always_frame = always_bar.render();
|
||||
always_bar.pointer_move(160, 239); always_bar.pointer_move(160, 238); always_bar.pointer_move(160, 239);
|
||||
check(always_bar.render().pixels == always_frame.pixels && !always_bar.pending(),
|
||||
"format field bit1 keeps Always quickbar visible through both bit0 edge transitions");
|
||||
DesktopScreen menu_bar(data, menu_desk);
|
||||
check(menu_bar.click(292,221).kind == DeskRequestKind::none,
|
||||
"MEN shortcut is unavailable before the original compact bar is shown");
|
||||
menu_bar.pointer_move(64,239);
|
||||
auto menu_save = menu_bar.click(292,221);
|
||||
check(menu_save.kind == DeskRequestKind::open_menu && menu_save.menu_kind == 53 &&
|
||||
menu_save.item_id == 53 && menu_save.value == 1,
|
||||
"compact last-cell left click opens the Original menu-layout save path from record 53");
|
||||
menu_bar.resolve_local_menu();
|
||||
auto menu_load = menu_bar.click(292,221,true);
|
||||
check(menu_load.kind == DeskRequestKind::open_menu && menu_load.menu_kind == 53 &&
|
||||
menu_load.item_id == 53 && menu_load.value == 0,
|
||||
"compact last-cell right click opens the Original menu-layout load path from record 53");
|
||||
auto quickbar_drawer = menu_desk;
|
||||
quickbar_drawer.layout_records[50][5]=0xff;
|
||||
quickbar_drawer.layout_records[50][6]=0xff;
|
||||
quickbar_drawer.layout_records[50][12]=50;
|
||||
DesktopScreen quickbar_open(data,quickbar_drawer);
|
||||
quickbar_open.pointer_move(64,239);
|
||||
const auto append_drawer=quickbar_open.click(22,221);
|
||||
check(quickbar_open.take_sound_ids()==std::vector<uint8_t>{15} && quickbar_open.take_sound_ids().empty(),
|
||||
"Source drawer append emits ID15 exactly once through the application boundary");
|
||||
quickbar_open.render(); quickbar_open.pointer_move(23,221); quickbar_open.click(22,221);
|
||||
check(quickbar_open.take_sound_ids().empty(),"render/hover/pending input never replay a drawer sound");
|
||||
check(append_drawer.kind==DeskRequestKind::change_layout&&
|
||||
append_drawer.layout_operation==DeskLayoutOperation::toggle_quickbar_drawer&&
|
||||
append_drawer.layout_after[50*16+5]==0&&append_drawer.layout_after[50*16+13]&0x80,
|
||||
"Original quickbar LMB appends a hidden drawer record and sets its open bit");
|
||||
auto quickbar_close_state=menu_desk;
|
||||
quickbar_close_state.layout_records[0][5]=50;
|
||||
quickbar_close_state.layout_records[50][5]=0;
|
||||
quickbar_close_state.layout_records[50][6]=0;
|
||||
quickbar_close_state.layout_records[50][12]=50;
|
||||
DesktopScreen quickbar_close(data,quickbar_close_state);
|
||||
quickbar_close.pointer_move(64,239);
|
||||
const auto unlink_drawer=quickbar_close.click(22,221,true);
|
||||
check(quickbar_close.take_sound_ids()==std::vector<uint8_t>{12},"Source drawer unlink emits ID12");
|
||||
check(unlink_drawer.kind==DeskRequestKind::change_layout&&
|
||||
unlink_drawer.layout_operation==DeskLayoutOperation::toggle_quickbar_drawer&&
|
||||
unlink_drawer.layout_after[0*16+5]==0&&unlink_drawer.layout_after[50*16+5]==0xff&&
|
||||
unlink_drawer.layout_after[50*16+6]==0xff,
|
||||
"Original quickbar RMB unlinks a visible drawer record with cleared links");
|
||||
auto child_desk=menu_desk;
|
||||
child_desk.layout_records[3][5]=child_desk.layout_records[3][6]=0xff;
|
||||
child_desk.layout_records[3][12]=2;
|
||||
child_desk.layout_records[3][13]=0;
|
||||
child_desk.layout_records[49][12]=50;
|
||||
child_desk.layout_records[49][13]=0x80;
|
||||
child_desk.layout_records[0][5]=49;
|
||||
child_desk.layout_records[49][5]=child_desk.layout_records[49][6]=0;
|
||||
child_desk.folder_icon_slots[0]={3};
|
||||
child_desk.drawer_handles=true;
|
||||
child_desk.items.push_back(DeskItem{49,40,40,100,65,50,0,0,true,false});
|
||||
DesktopScreen folder_click(data,child_desk);
|
||||
const auto child_action=folder_click.click(50,49);
|
||||
check(child_action.kind==DeskRequestKind::open_menu&&child_action.item_id==3&&child_action.menu_kind==2,
|
||||
"Source folder child uses its native record/kind on ordinary LMB activation");
|
||||
DesktopScreen folder_drag(data,child_desk);
|
||||
folder_drag.pointer_down(50,49,true);
|
||||
check(folder_drag.take_sound_ids()==std::vector<uint8_t>({15,12,15}),
|
||||
"folder-child RMB start preserves Source restore/unlink/append ordering");
|
||||
folder_drag.pointer_move(176,100);
|
||||
const auto child_return=folder_drag.pointer_up(176,100,true);
|
||||
check(child_return.kind==DeskRequestKind::change_layout&&
|
||||
child_return.layout_operation==DeskLayoutOperation::return_folder_child&&
|
||||
child_return.layout_before[3*16+5]==0xff&&child_return.layout_after[0*16+5]==49&&
|
||||
child_return.layout_after[49*16+5]==3&&child_return.layout_after[3*16+5]==0&&
|
||||
child_return.layout_after[3*16+6]==49,
|
||||
"RMB drag from the rendered 32×25 folder tile returns it to the visible chain");
|
||||
check(folder_drag.take_sound_ids().empty(),"folder-child release cannot replay its down-event append");
|
||||
// Unframed folders render the same tiles four pixels nearer the origin.
|
||||
auto unframed_child_desk=child_desk;
|
||||
unframed_child_desk.layout_snap=true;
|
||||
unframed_child_desk.items.back().open=false;
|
||||
unframed_child_desk.items.back().width=50;
|
||||
unframed_child_desk.items.back().height=41;
|
||||
unframed_child_desk.layout_records[49][13]=0;
|
||||
unframed_child_desk.layout_records[13]=unframed_child_desk.layout_records[3];
|
||||
unframed_child_desk.layout_records[13][12]=12;
|
||||
unframed_child_desk.folder_icon_slots[0]={13};
|
||||
DesktopScreen unframed_child(data,unframed_child_desk);
|
||||
check(unframed_child.pointer_down(46,45).kind==DeskRequestKind::none &&
|
||||
unframed_child.pointer_up(46,45).kind==DeskRequestKind::advance_turn,
|
||||
"LMB on an unframed folder tile activates its native kickoff action");
|
||||
DesktopScreen unframed_drag(data,unframed_child_desk);
|
||||
unframed_drag.pointer_down(46,45,true);
|
||||
check(unframed_drag.take_sound_ids()==std::vector<uint8_t>({15,12,15}),
|
||||
"unframed child starts extraction rather than dragging the folder body");
|
||||
unframed_drag.pointer_move(176,100);
|
||||
const auto unframed_return=unframed_drag.pointer_up(176,100,true);
|
||||
check(unframed_return.item_id==13 && unframed_return.menu_kind==12 &&
|
||||
unframed_return.layout_operation==DeskLayoutOperation::return_folder_child &&
|
||||
unframed_return.layout_after[13*16]==175 && unframed_return.layout_after[13*16+2]==95 &&
|
||||
unframed_return.layout_after[49*16+5]==13,
|
||||
"RMB extraction uses the rendered unframed tile origin and returns the kickoff icon");
|
||||
DesktopScreen folder_drop(data,child_desk);
|
||||
folder_drop.pointer_down(50,49,true); folder_drop.take_sound_ids();
|
||||
folder_drop.pointer_move(55,52);
|
||||
const auto dropped_child=folder_drop.pointer_up(55,52,true);
|
||||
check(dropped_child.layout_operation==DeskLayoutOperation::set_folder &&
|
||||
folder_drop.take_sound_ids()==std::vector<uint8_t>{12},
|
||||
"Source fully enclosed drop unlinks the dragged child exactly once");
|
||||
DesktopScreen folder_corner(data,child_desk);
|
||||
const auto corner_close=folder_corner.pointer_down(41,41);
|
||||
check(corner_close.kind==DeskRequestKind::change_layout &&
|
||||
corner_close.layout_operation==DeskLayoutOperation::toggle_quickbar_drawer &&
|
||||
corner_close.item_id==49 && corner_close.layout_target_item==49 &&
|
||||
corner_close.layout_after[5]==0 && corner_close.layout_after[49*16+5]==0xff &&
|
||||
corner_close.layout_after[49*16+6]==0xff &&
|
||||
folder_corner.take_sound_ids()==std::vector<uint8_t>{12},
|
||||
"framed folder LMB corner unlinks its native record and emits the Source removal sound");
|
||||
auto without_folder=child_desk; ++without_folder.revision;
|
||||
without_folder.items.pop_back();
|
||||
for(size_t i=0;i<54;++i)
|
||||
std::copy_n(corner_close.layout_after.begin()+i*16,16,without_folder.layout_records[i].begin());
|
||||
folder_corner.acknowledge(without_folder);
|
||||
check(folder_corner.pointer_up(41,41).kind==DeskRequestKind::none &&
|
||||
!folder_corner.pending() && folder_corner.take_sound_ids().empty(),
|
||||
"folder removal owns its release after ACK without activating the underlying date");
|
||||
check(folder_corner.pointer_up(41,41).kind==DeskRequestKind::advance_turn,
|
||||
"folder removal release barrier leaves a subsequent independent date click available");
|
||||
auto covered_child=child_desk;
|
||||
covered_child.items.push_back(DeskItem{6,60,48,32,25,21,0,0,false,false});
|
||||
covered_child.layout_records[49][5]=6;
|
||||
covered_child.layout_records[6][5]=0;
|
||||
covered_child.layout_records[6][6]=49;
|
||||
covered_child.layout_records[6][12]=21;
|
||||
DesktopScreen stacked_icon(data,covered_child);
|
||||
const auto exposed_folder_frame=folder_click.render();
|
||||
const auto covered_folder_frame=stacked_icon.render();
|
||||
const auto desktop_atlas=load_vga(asset_path(data/"KB","3.VGA"));
|
||||
for(int y=0;y<25;++y) for(int x=0;x<32;++x)
|
||||
check(covered_folder_frame.pixels[size_t(48+y)*320+60+x]==
|
||||
desktop_atlas.pixels[size_t(50+y)*desktop_atlas.width+160+x],
|
||||
"top icon renders over the folder child using its own native KB3 tile");
|
||||
check(covered_folder_frame.pixels[size_t(49)*320+50]==exposed_folder_frame.pixels[size_t(49)*320+50],
|
||||
"the uncovered part of a folder child remains visible below the stacked icon");
|
||||
const auto covering_icon_action=stacked_icon.click(65,49);
|
||||
check(covering_icon_action.kind==DeskRequestKind::open_menu&&covering_icon_action.item_id==6&&
|
||||
covering_icon_action.menu_kind==21&&stacked_icon.state().layout_records==covered_child.layout_records,
|
||||
"LMB activates the rendered top icon rather than the covered folder child without layout edits");
|
||||
DesktopScreen stacked_drag(data,covered_child);
|
||||
stacked_drag.pointer_down(65,49,true);
|
||||
check(stacked_drag.take_sound_ids()==std::vector<uint8_t>({12,15}),
|
||||
"visible RMB drag starts with the Source unlink/append pair");
|
||||
stacked_drag.pointer_move(200,120);
|
||||
const auto covering_icon_drag=stacked_drag.pointer_up(200,120,true);
|
||||
check(covering_icon_drag.kind==DeskRequestKind::change_layout&&covering_icon_drag.item_id==6&&
|
||||
covering_icon_drag.layout_operation==DeskLayoutOperation::move_item&&
|
||||
covering_icon_drag.layout_after[3*16+5]==0xff&&covering_icon_drag.layout_after[3*16+6]==0xff,
|
||||
"RMB drags the rendered top icon and leaves the covered child outside the visible link chain");
|
||||
check(stacked_drag.take_sound_ids().empty(),"ordinary move release adds no structural sound");
|
||||
DesktopScreen still_drag(data,covered_child);
|
||||
still_drag.pointer_down(65,49,true); still_drag.pointer_up(65,49,true);
|
||||
check(still_drag.take_sound_ids()==std::vector<uint8_t>({12,15}),
|
||||
"Source RMB reordering sounds happen even without pointer motion");
|
||||
DesktopScreen exposed_child(data,covered_child);
|
||||
check(exposed_child.click(50,49).item_id==3,"an exposed folder tile still opens its native child action");
|
||||
auto status_cover=child_desk;
|
||||
status_cover.items.push_back(DeskItem{48,48,48,42,35,56,0,0,true,false});
|
||||
DesktopScreen stacked_status(data,status_cover);
|
||||
check(stacked_status.render().pixels!=exposed_folder_frame.pixels&&
|
||||
stacked_status.pointer_down(50,49).kind==DeskRequestKind::none&&
|
||||
stacked_status.pointer_up(50,49).kind==DeskRequestKind::none&&!stacked_status.pending(),
|
||||
"an open status drawer covers a folder child and its inert body cannot activate that child");
|
||||
auto empty_folder_cover=child_desk;
|
||||
empty_folder_cover.items.push_back(DeskItem{48,48,48,45,35,51,0,1,true,false});
|
||||
DesktopScreen stacked_empty_folder(data,empty_folder_cover);
|
||||
check(stacked_empty_folder.click(50,49).kind==DeskRequestKind::none&&!stacked_empty_folder.pending(),
|
||||
"an empty part of the top folder blocks a lower folder child");
|
||||
DesktopScreen covered_bin_restore(data,empty_folder_cover);
|
||||
covered_bin_restore.pointer_move(160,239);
|
||||
covered_bin_restore.click(10,215);
|
||||
check(covered_bin_restore.pointer_down(50,49,true).kind==DeskRequestKind::none&&
|
||||
covered_bin_restore.pointer_up(50,49,true).kind==DeskRequestKind::none&&
|
||||
!covered_bin_restore.pending()&&covered_bin_restore.state().layout_records==empty_folder_cover.layout_records,
|
||||
"bin-mode RMB on a covering empty folder cannot restore the lower child or change links");
|
||||
check(covered_bin_restore.take_sound_ids().empty(),"covered bin child cannot emit a restore sound");
|
||||
DesktopScreen exposed_bin_restore(data,covered_child);
|
||||
exposed_bin_restore.pointer_move(160,239);
|
||||
exposed_bin_restore.click(10,215);
|
||||
const auto exposed_restore=exposed_bin_restore.click(50,49,true);
|
||||
check(exposed_bin_restore.take_sound_ids()==std::vector<uint8_t>{15},"bin-mode restore emits only append ID15");
|
||||
check(exposed_restore.layout_operation==DeskLayoutOperation::restore_folder_child&&exposed_restore.item_id==3,
|
||||
"bin-mode RMB still restores an exposed folder child using its native owner");
|
||||
DesktopScreen bin_send(data,covered_child);
|
||||
bin_send.pointer_move(160,239); bin_send.click(10,215);
|
||||
const auto sent_icon=bin_send.click(65,49,true);
|
||||
check(sent_icon.layout_operation==DeskLayoutOperation::send_to_folder &&
|
||||
bin_send.take_sound_ids()==std::vector<uint8_t>{12},"bin-mode send emits only unlink ID12");
|
||||
auto closed_cover=child_desk;
|
||||
closed_cover.items.push_back(DeskItem{48,48,48,14,14,63,0,0,false,false});
|
||||
DesktopScreen stacked_closed_drawer(data,closed_cover);
|
||||
check(stacked_closed_drawer.click(50,49).kind==DeskRequestKind::none&&!stacked_closed_drawer.pending(),
|
||||
"a closed drawer blocks hits inside its Source dimensions minus eight");
|
||||
DesktopScreen outside_closed_drawer(data,closed_cover);
|
||||
check(outside_closed_drawer.click(55,49).item_id==3,
|
||||
"the eight-pixel closed drawer inset allows hits on the exposed lower folder child");
|
||||
const auto menu_test_dir = std::filesystem::temp_directory_path() /
|
||||
("openbmh-menu-layout-picker-" + std::to_string(std::chrono::steady_clock::now().time_since_epoch().count()));
|
||||
std::filesystem::create_directories(menu_test_dir / "load");
|
||||
std::filesystem::create_directories(menu_test_dir / "save");
|
||||
{ std::ofstream(menu_test_dir / "load" / "LAYOUT.MEN") << "fixture";
|
||||
std::ofstream(menu_test_dir / "load" / "NOTGAME.FBM") << "fixture"; }
|
||||
SaveLoadScreen menu_load_picker(data, menu_test_dir / "load", SaveLoadMode::load, 0, 6,
|
||||
menu_bar.render(), true, SaveLoadFileKind::menu_layout, 52);
|
||||
check(menu_load_picker.entries().size() == 1 &&
|
||||
menu_load_picker.entries()[0].path.extension() == ".MEN" &&
|
||||
!menu_load_picker.info_press(60,45),
|
||||
"menu-layout picker filters to MEN and never interprets a layout as an FBM information header");
|
||||
menu_load_picker.click(60,45); menu_load_picker.click(60,45);
|
||||
check(menu_load_picker.pending() && menu_load_picker.pending()->file_kind == SaveLoadFileKind::menu_layout &&
|
||||
menu_load_picker.pending()->origin_item_id == 52 &&
|
||||
menu_load_picker.pending()->path.extension() == ".MEN",
|
||||
"MEN load request retains its typed file kind and source drawer identity");
|
||||
SaveLoadScreen menu_save_picker(data, menu_test_dir / "save", SaveLoadMode::save, 0, 6,
|
||||
menu_bar.render(), true, SaveLoadFileKind::menu_layout, 52);
|
||||
menu_save_picker.click(120,214); menu_save_picker.text("LAYOUT"); menu_save_picker.key("ENTER");
|
||||
check(menu_save_picker.pending() && menu_save_picker.pending()->file_kind == SaveLoadFileKind::menu_layout &&
|
||||
menu_save_picker.pending()->path.filename() == "LAYOUT.MEN" &&
|
||||
save_load_request_json(*menu_save_picker.pending()).find("\"file_kind\":\"menu_layout\"") != std::string::npos,
|
||||
"MEN save request uses the native extension and an explicit JSON file-kind discriminator");
|
||||
std::filesystem::remove_all(menu_test_dir);
|
||||
}
|
||||
|
||||
void desktop_control_input_tests(const std::filesystem::path& data,DeskState& d) {
|
||||
DesktopScreen desk(data,d);
|
||||
const auto pixels = desk.render().pixels;
|
||||
check(desk.render().pixels == pixels,"repeat render is deterministic");
|
||||
check(desk.click(5,23).kind == DeskRequestKind::none,"calendar handle must not advance a turn");
|
||||
auto action = desk.click(50,125);
|
||||
check(action.kind == DeskRequestKind::open_menu && action.menu_kind == 3 && action.manager_slot == 0 && action.revision == 10,"lineup request");
|
||||
check(desk.click(20,40).kind == DeskRequestKind::none,"pending command blocks another turn");
|
||||
rejected([&]{ desk.acknowledge(d); });
|
||||
++d.revision; desk.acknowledge(d);
|
||||
check(desk.click(20,40).kind == DeskRequestKind::advance_turn,"open calendar advances");
|
||||
check(desk.click(20,40).kind == DeskRequestKind::none,"no duplicate advance request");
|
||||
++d.revision; desk.acknowledge(d);
|
||||
check(desk.click(165,125).kind == DeskRequestKind::advance_turn,"kickoff icon advances");
|
||||
auto unframed_date=d;
|
||||
unframed_date.items.front().open=false;
|
||||
unframed_date.layout_records[1][13]&=0x7f;
|
||||
DesktopScreen date_click(data,unframed_date);
|
||||
check(date_click.pointer_down(20,40).kind==DeskRequestKind::none,
|
||||
"date press waits for its release without entering layout drag");
|
||||
const auto date_turn=date_click.pointer_up(20,40);
|
||||
check(date_turn.kind==DeskRequestKind::advance_turn && date_turn.menu_kind==58 &&
|
||||
date_turn.manager_slot==d.manager_slot && date_turn.revision==d.revision &&
|
||||
date_click.pointer_up(20,40).kind==DeskRequestKind::none,
|
||||
"unframed date body emits exactly one authenticated advance action");
|
||||
DesktopScreen date_drag(data,unframed_date);
|
||||
date_drag.pointer_down(20,40,true); date_drag.pointer_move(40,60);
|
||||
check(date_drag.pointer_up(40,60,true).layout_operation==DeskLayoutOperation::move_item,
|
||||
"unframed date retains right-button movement");
|
||||
check(desk.render().pixels == pixels,"commands cannot mutate the saved game view");
|
||||
for(bool framed : {true,false}) {
|
||||
auto controls=d;
|
||||
controls.items={{1,20,80,98,36,55,0,0,framed,false},
|
||||
{2,20,130,173,38,64,0,0,framed,false}};
|
||||
const int origin=20+(framed?4:0);
|
||||
for(int offset : {34,35,86,87}) {
|
||||
DesktopScreen price_control(data,controls);
|
||||
price_control.pointer_down(origin+offset,90);
|
||||
const auto price_action=price_control.pointer_up(origin+offset,90);
|
||||
check(price_action.kind==((offset==35||offset==86)?
|
||||
DeskRequestKind::change_ticket_price:DeskRequestKind::none),
|
||||
"framed and unframed admission controls use the rendered Source endpoints");
|
||||
if(offset==35||offset==86)
|
||||
check(price_action.value==(offset==35?8:25),"admission endpoint preserves its exact value");
|
||||
}
|
||||
for(int offset : {32,33,65,66,98,99,131,132}) {
|
||||
DesktopScreen automation_control(data,controls);
|
||||
automation_control.pointer_down(origin+offset,140);
|
||||
const auto option_action=automation_control.pointer_up(origin+offset,140);
|
||||
check(option_action.kind==DeskRequestKind::change_option && option_action.value==offset/33,
|
||||
"automation cell boundaries follow the optional frame offset");
|
||||
}
|
||||
}
|
||||
desk.reject_action("unsupported_menu");
|
||||
check(!desk.pending() && desk.render().pixels == pixels,"rejected command preserves state");
|
||||
check(desk.key("A").menu_kind == 3,"original A hotkey opens lineup");
|
||||
desk.reject_action("not_implemented");
|
||||
check(desk.key("D").menu_kind == 18,"original D hotkey opens tactics");
|
||||
desk.reject_action("not_implemented");
|
||||
check(desk.key("I").menu_kind == 16 && desk_menu_name(16)=="training" && desk_menu_name(15)=="training_camp",
|
||||
"original I and dispatch distinguish training from training camp");
|
||||
|
||||
}
|
||||
} // namespace
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
try {
|
||||
paired_closing_selection();
|
||||
if (argc < 2) throw std::runtime_error("data directory required");
|
||||
const bool input_only=argc>2 && std::string_view(argv[2])=="--input-only";
|
||||
const std::filesystem::path data = argv[1]; const auto exe = bmh::test::load_executable(asset_path(data,"BMH.exe"));
|
||||
if(input_only) {
|
||||
folder_pointer_input_tests(data,exe);
|
||||
auto input_desk=desk_from_game(fixture(),exe,10);
|
||||
desktop_control_input_tests(data,input_desk);
|
||||
std::cout << "Desktop pointer, folders, removal corners and framed/unframed controls passed.\n";
|
||||
return 0;
|
||||
}
|
||||
paired_closing_selection();
|
||||
paired_selection_matrix(exe);
|
||||
if(argc>3)paired_saved_projection(argv[3],exe);
|
||||
// The date arithmetic is checked against a controlled epoch aligned with
|
||||
@@ -667,234 +1008,7 @@ int main(int argc, char** argv) {
|
||||
check(ranked_high_frame.pixels[size_t(50)*size_t(ranked_high_frame.width)+150]==
|
||||
source_ranked_art.pixels[size_t(25)*size_t(source_ranked_art.width)+50],
|
||||
"ranked menu-26 copies Source decimal asset 51 (legacy routine argument 0x33)");
|
||||
auto menu_game = fixture();
|
||||
menu_game.memory.set8(::bmh::layout::Desktops + 44 * 16 + 12, 63); // mailbox occurs before the menu shortcut in this scan
|
||||
menu_game.memory.set8(::bmh::layout::Desktops + 53 * 16 + 12, 72); // final compact-bar cell dispatches MEN
|
||||
auto menu_desk = desk_from_game(menu_game, exe, 6);
|
||||
check(menu_desk.mailbox_shortcut && menu_desk.menu_layout_shortcut &&
|
||||
menu_desk.menu_layout_shortcut->id == 53,
|
||||
"Source final compact-bar cell resolves record 53/kind 72 independently of linked drawers");
|
||||
menu_desk.shortcut_bar_always = false;
|
||||
DesktopScreen edge_bar(data, menu_desk);
|
||||
const auto edge_hidden = edge_bar.render();
|
||||
check(!edge_bar.pointer_move(160, 238), "Source quickbar edge requires exactly y239");
|
||||
check(edge_bar.pointer_move(160, 239) && edge_bar.render().pixels != edge_hidden.pixels &&
|
||||
!edge_bar.pending() && edge_bar.state().layout_records == menu_desk.layout_records,
|
||||
"lower-edge motion shows quickbar without an action or Native layout edits");
|
||||
const auto edge_shown = edge_bar.render();
|
||||
const auto quickbar_art = load_vga(asset_path(data / "KB", "3.VGA"));
|
||||
for (int y = 0; y < 20; ++y) for (int x = 0; x < 20; ++x)
|
||||
check(edge_shown.pixels[size_t(207 + y) * 320 + 299 + x] ==
|
||||
quickbar_art.pixels[size_t(75 + y) * quickbar_art.width + exe.u8(::bmh::layout::Desktop_Render_RuntimeField3) + x],
|
||||
"visible Source quickbar copies the complete normal socket sprite before any press");
|
||||
check(!edge_bar.pointer_move(250, 239) && edge_bar.click(250, 239).kind == DeskRequestKind::none &&
|
||||
edge_bar.render().pixels == edge_shown.pixels,
|
||||
"motion along edge and click at the same edge do not toggle the Source y latch twice");
|
||||
check(edge_bar.pointer_move(292, 221), "MEN quickbar cell motion selects its Source hover label");
|
||||
const auto hover_frame = edge_bar.render();
|
||||
int hover_pixels = 0;
|
||||
for (int y = 0; y < 240; ++y) for (int x = 0; x < 320; ++x)
|
||||
if (hover_frame.pixels[size_t(y) * 320 + x] != edge_shown.pixels[size_t(y) * 320 + x]) {
|
||||
check(y >= 230 && y <= 235, "Source quickbar label changes only the footer Font3 rows");
|
||||
++hover_pixels;
|
||||
}
|
||||
check(hover_pixels > 0 && !edge_bar.pointer_move(291, 221),
|
||||
"Source hover title renders once and stays stable inside the same cell");
|
||||
check(edge_bar.pointer_move(160, 238) && edge_bar.render().pixels == edge_shown.pixels,
|
||||
"leaving the cell restores the footer without hiding the quickbar");
|
||||
check(edge_bar.pointer_move(160, 239) && edge_bar.render().pixels == edge_hidden.pixels,
|
||||
"re-entering the lower edge toggles the quickbar off without a click");
|
||||
auto always_desk = menu_desk; always_desk.shortcut_bar_always = true;
|
||||
DesktopScreen always_bar(data, always_desk);
|
||||
const auto always_frame = always_bar.render();
|
||||
always_bar.pointer_move(160, 239); always_bar.pointer_move(160, 238); always_bar.pointer_move(160, 239);
|
||||
check(always_bar.render().pixels == always_frame.pixels && !always_bar.pending(),
|
||||
"format field bit1 keeps Always quickbar visible through both bit0 edge transitions");
|
||||
DesktopScreen menu_bar(data, menu_desk);
|
||||
check(menu_bar.click(292,221).kind == DeskRequestKind::none,
|
||||
"MEN shortcut is unavailable before the original compact bar is shown");
|
||||
menu_bar.pointer_move(64,239);
|
||||
auto menu_save = menu_bar.click(292,221);
|
||||
check(menu_save.kind == DeskRequestKind::open_menu && menu_save.menu_kind == 53 &&
|
||||
menu_save.item_id == 53 && menu_save.value == 1,
|
||||
"compact last-cell left click opens the Original menu-layout save path from record 53");
|
||||
menu_bar.resolve_local_menu();
|
||||
auto menu_load = menu_bar.click(292,221,true);
|
||||
check(menu_load.kind == DeskRequestKind::open_menu && menu_load.menu_kind == 53 &&
|
||||
menu_load.item_id == 53 && menu_load.value == 0,
|
||||
"compact last-cell right click opens the Original menu-layout load path from record 53");
|
||||
auto quickbar_drawer = menu_desk;
|
||||
quickbar_drawer.layout_records[50][5]=0xff;
|
||||
quickbar_drawer.layout_records[50][6]=0xff;
|
||||
quickbar_drawer.layout_records[50][12]=50;
|
||||
DesktopScreen quickbar_open(data,quickbar_drawer);
|
||||
quickbar_open.pointer_move(64,239);
|
||||
const auto append_drawer=quickbar_open.click(22,221);
|
||||
check(quickbar_open.take_sound_ids()==std::vector<uint8_t>{15} && quickbar_open.take_sound_ids().empty(),
|
||||
"Source drawer append emits ID15 exactly once through the application boundary");
|
||||
quickbar_open.render(); quickbar_open.pointer_move(23,221); quickbar_open.click(22,221);
|
||||
check(quickbar_open.take_sound_ids().empty(),"render/hover/pending input never replay a drawer sound");
|
||||
check(append_drawer.kind==DeskRequestKind::change_layout&&
|
||||
append_drawer.layout_operation==DeskLayoutOperation::toggle_quickbar_drawer&&
|
||||
append_drawer.layout_after[50*16+5]==0&&append_drawer.layout_after[50*16+13]&0x80,
|
||||
"Original quickbar LMB appends a hidden drawer record and sets its open bit");
|
||||
auto quickbar_close_state=menu_desk;
|
||||
quickbar_close_state.layout_records[0][5]=50;
|
||||
quickbar_close_state.layout_records[50][5]=0;
|
||||
quickbar_close_state.layout_records[50][6]=0;
|
||||
quickbar_close_state.layout_records[50][12]=50;
|
||||
DesktopScreen quickbar_close(data,quickbar_close_state);
|
||||
quickbar_close.pointer_move(64,239);
|
||||
const auto unlink_drawer=quickbar_close.click(22,221,true);
|
||||
check(quickbar_close.take_sound_ids()==std::vector<uint8_t>{12},"Source drawer unlink emits ID12");
|
||||
check(unlink_drawer.kind==DeskRequestKind::change_layout&&
|
||||
unlink_drawer.layout_operation==DeskLayoutOperation::toggle_quickbar_drawer&&
|
||||
unlink_drawer.layout_after[0*16+5]==0&&unlink_drawer.layout_after[50*16+5]==0xff&&
|
||||
unlink_drawer.layout_after[50*16+6]==0xff,
|
||||
"Original quickbar RMB unlinks a visible drawer record with cleared links");
|
||||
auto child_desk=menu_desk;
|
||||
child_desk.layout_records[3][5]=child_desk.layout_records[3][6]=0xff;
|
||||
child_desk.layout_records[3][12]=2;
|
||||
child_desk.layout_records[3][13]=0;
|
||||
child_desk.layout_records[49][12]=50;
|
||||
child_desk.layout_records[49][13]=0x80;
|
||||
child_desk.layout_records[0][5]=49;
|
||||
child_desk.layout_records[49][5]=child_desk.layout_records[49][6]=0;
|
||||
child_desk.folder_icon_slots[0]={3};
|
||||
child_desk.drawer_handles=true;
|
||||
child_desk.items.push_back(DeskItem{49,40,40,100,65,50,0,0,true,false});
|
||||
DesktopScreen folder_click(data,child_desk);
|
||||
const auto child_action=folder_click.click(50,49);
|
||||
check(child_action.kind==DeskRequestKind::open_menu&&child_action.item_id==3&&child_action.menu_kind==2,
|
||||
"Source folder child uses its native record/kind on ordinary LMB activation");
|
||||
DesktopScreen folder_drag(data,child_desk);
|
||||
folder_drag.pointer_down(50,49,true);
|
||||
check(folder_drag.take_sound_ids()==std::vector<uint8_t>({15,12,15}),
|
||||
"folder-child RMB start preserves Source restore/unlink/append ordering");
|
||||
folder_drag.pointer_move(176,100);
|
||||
const auto child_return=folder_drag.pointer_up(176,100,true);
|
||||
check(child_return.kind==DeskRequestKind::change_layout&&
|
||||
child_return.layout_operation==DeskLayoutOperation::return_folder_child&&
|
||||
child_return.layout_before[3*16+5]==0xff&&child_return.layout_after[0*16+5]==49&&
|
||||
child_return.layout_after[49*16+5]==3&&child_return.layout_after[3*16+5]==0&&
|
||||
child_return.layout_after[3*16+6]==49,
|
||||
"RMB drag from the rendered 32×25 folder tile returns it to the visible chain");
|
||||
check(folder_drag.take_sound_ids().empty(),"folder-child release cannot replay its down-event append");
|
||||
DesktopScreen folder_drop(data,child_desk);
|
||||
folder_drop.pointer_down(50,49,true); folder_drop.take_sound_ids();
|
||||
folder_drop.pointer_move(55,52);
|
||||
const auto dropped_child=folder_drop.pointer_up(55,52,true);
|
||||
check(dropped_child.layout_operation==DeskLayoutOperation::set_folder &&
|
||||
folder_drop.take_sound_ids()==std::vector<uint8_t>{12},
|
||||
"Source fully enclosed drop unlinks the dragged child exactly once");
|
||||
DesktopScreen unchanged_handle(data,child_desk);
|
||||
unchanged_handle.pointer_down(41,41);
|
||||
check(!unchanged_handle.pending() && unchanged_handle.take_sound_ids().empty(),
|
||||
"existing LMB handle gesture has no invented RMB sound mapping");
|
||||
unchanged_handle.pointer_up(41,41);
|
||||
check(unchanged_handle.take_sound_ids().empty(),"handle release remains silent at this Source boundary");
|
||||
auto covered_child=child_desk;
|
||||
covered_child.items.push_back(DeskItem{6,60,48,32,25,21,0,0,false,false});
|
||||
covered_child.layout_records[49][5]=6;
|
||||
covered_child.layout_records[6][5]=0;
|
||||
covered_child.layout_records[6][6]=49;
|
||||
covered_child.layout_records[6][12]=21;
|
||||
DesktopScreen stacked_icon(data,covered_child);
|
||||
const auto exposed_folder_frame=folder_click.render();
|
||||
const auto covered_folder_frame=stacked_icon.render();
|
||||
const auto desktop_atlas=load_vga(asset_path(data/"KB","3.VGA"));
|
||||
for(int y=0;y<25;++y) for(int x=0;x<32;++x)
|
||||
check(covered_folder_frame.pixels[size_t(48+y)*320+60+x]==
|
||||
desktop_atlas.pixels[size_t(50+y)*desktop_atlas.width+160+x],
|
||||
"top icon renders over the folder child using its own native KB3 tile");
|
||||
check(covered_folder_frame.pixels[size_t(49)*320+50]==exposed_folder_frame.pixels[size_t(49)*320+50],
|
||||
"the uncovered part of a folder child remains visible below the stacked icon");
|
||||
const auto covering_icon_action=stacked_icon.click(65,49);
|
||||
check(covering_icon_action.kind==DeskRequestKind::open_menu&&covering_icon_action.item_id==6&&
|
||||
covering_icon_action.menu_kind==21&&stacked_icon.state().layout_records==covered_child.layout_records,
|
||||
"LMB activates the rendered top icon rather than the covered folder child without layout edits");
|
||||
DesktopScreen stacked_drag(data,covered_child);
|
||||
stacked_drag.pointer_down(65,49,true);
|
||||
check(stacked_drag.take_sound_ids()==std::vector<uint8_t>({12,15}),
|
||||
"visible RMB drag starts with the Source unlink/append pair");
|
||||
stacked_drag.pointer_move(200,120);
|
||||
const auto covering_icon_drag=stacked_drag.pointer_up(200,120,true);
|
||||
check(covering_icon_drag.kind==DeskRequestKind::change_layout&&covering_icon_drag.item_id==6&&
|
||||
covering_icon_drag.layout_operation==DeskLayoutOperation::move_item&&
|
||||
covering_icon_drag.layout_after[3*16+5]==0xff&&covering_icon_drag.layout_after[3*16+6]==0xff,
|
||||
"RMB drags the rendered top icon and leaves the covered child outside the visible link chain");
|
||||
check(stacked_drag.take_sound_ids().empty(),"ordinary move release adds no structural sound");
|
||||
DesktopScreen still_drag(data,covered_child);
|
||||
still_drag.pointer_down(65,49,true); still_drag.pointer_up(65,49,true);
|
||||
check(still_drag.take_sound_ids()==std::vector<uint8_t>({12,15}),
|
||||
"Source RMB reordering sounds happen even without pointer motion");
|
||||
DesktopScreen exposed_child(data,covered_child);
|
||||
check(exposed_child.click(50,49).item_id==3,"an exposed folder tile still opens its native child action");
|
||||
auto status_cover=child_desk;
|
||||
status_cover.items.push_back(DeskItem{48,48,48,42,35,56,0,0,true,false});
|
||||
DesktopScreen stacked_status(data,status_cover);
|
||||
check(stacked_status.render().pixels!=exposed_folder_frame.pixels&&
|
||||
stacked_status.pointer_down(50,49).kind==DeskRequestKind::none&&
|
||||
stacked_status.pointer_up(50,49).kind==DeskRequestKind::none&&!stacked_status.pending(),
|
||||
"an open status drawer covers a folder child and its inert body cannot activate that child");
|
||||
auto empty_folder_cover=child_desk;
|
||||
empty_folder_cover.items.push_back(DeskItem{48,48,48,45,35,51,0,1,true,false});
|
||||
DesktopScreen stacked_empty_folder(data,empty_folder_cover);
|
||||
check(stacked_empty_folder.click(50,49).kind==DeskRequestKind::none&&!stacked_empty_folder.pending(),
|
||||
"an empty part of the top folder blocks a lower folder child");
|
||||
DesktopScreen covered_bin_restore(data,empty_folder_cover);
|
||||
covered_bin_restore.pointer_move(160,239);
|
||||
covered_bin_restore.click(10,215);
|
||||
check(covered_bin_restore.pointer_down(50,49,true).kind==DeskRequestKind::none&&
|
||||
covered_bin_restore.pointer_up(50,49,true).kind==DeskRequestKind::none&&
|
||||
!covered_bin_restore.pending()&&covered_bin_restore.state().layout_records==empty_folder_cover.layout_records,
|
||||
"bin-mode RMB on a covering empty folder cannot restore the lower child or change links");
|
||||
check(covered_bin_restore.take_sound_ids().empty(),"covered bin child cannot emit a restore sound");
|
||||
DesktopScreen exposed_bin_restore(data,covered_child);
|
||||
exposed_bin_restore.pointer_move(160,239);
|
||||
exposed_bin_restore.click(10,215);
|
||||
const auto exposed_restore=exposed_bin_restore.click(50,49,true);
|
||||
check(exposed_bin_restore.take_sound_ids()==std::vector<uint8_t>{15},"bin-mode restore emits only append ID15");
|
||||
check(exposed_restore.layout_operation==DeskLayoutOperation::restore_folder_child&&exposed_restore.item_id==3,
|
||||
"bin-mode RMB still restores an exposed folder child using its native owner");
|
||||
DesktopScreen bin_send(data,covered_child);
|
||||
bin_send.pointer_move(160,239); bin_send.click(10,215);
|
||||
const auto sent_icon=bin_send.click(65,49,true);
|
||||
check(sent_icon.layout_operation==DeskLayoutOperation::send_to_folder &&
|
||||
bin_send.take_sound_ids()==std::vector<uint8_t>{12},"bin-mode send emits only unlink ID12");
|
||||
auto closed_cover=child_desk;
|
||||
closed_cover.items.push_back(DeskItem{48,48,48,14,14,63,0,0,false,false});
|
||||
DesktopScreen stacked_closed_drawer(data,closed_cover);
|
||||
check(stacked_closed_drawer.click(50,49).kind==DeskRequestKind::none&&!stacked_closed_drawer.pending(),
|
||||
"a closed drawer blocks hits inside its Source dimensions minus eight");
|
||||
DesktopScreen outside_closed_drawer(data,closed_cover);
|
||||
check(outside_closed_drawer.click(55,49).item_id==3,
|
||||
"the eight-pixel closed drawer inset allows hits on the exposed lower folder child");
|
||||
const auto menu_test_dir = std::filesystem::temp_directory_path() /
|
||||
("openbmh-menu-layout-picker-" + std::to_string(std::chrono::steady_clock::now().time_since_epoch().count()));
|
||||
std::filesystem::create_directories(menu_test_dir / "load");
|
||||
std::filesystem::create_directories(menu_test_dir / "save");
|
||||
{ std::ofstream(menu_test_dir / "load" / "LAYOUT.MEN") << "fixture";
|
||||
std::ofstream(menu_test_dir / "load" / "NOTGAME.FBM") << "fixture"; }
|
||||
SaveLoadScreen menu_load_picker(data, menu_test_dir / "load", SaveLoadMode::load, 0, 6,
|
||||
menu_bar.render(), true, SaveLoadFileKind::menu_layout, 52);
|
||||
check(menu_load_picker.entries().size() == 1 &&
|
||||
menu_load_picker.entries()[0].path.extension() == ".MEN" &&
|
||||
!menu_load_picker.info_press(60,45),
|
||||
"menu-layout picker filters to MEN and never interprets a layout as an FBM information header");
|
||||
menu_load_picker.click(60,45); menu_load_picker.click(60,45);
|
||||
check(menu_load_picker.pending() && menu_load_picker.pending()->file_kind == SaveLoadFileKind::menu_layout &&
|
||||
menu_load_picker.pending()->origin_item_id == 52 &&
|
||||
menu_load_picker.pending()->path.extension() == ".MEN",
|
||||
"MEN load request retains its typed file kind and source drawer identity");
|
||||
SaveLoadScreen menu_save_picker(data, menu_test_dir / "save", SaveLoadMode::save, 0, 6,
|
||||
menu_bar.render(), true, SaveLoadFileKind::menu_layout, 52);
|
||||
menu_save_picker.click(120,214); menu_save_picker.text("LAYOUT"); menu_save_picker.key("ENTER");
|
||||
check(menu_save_picker.pending() && menu_save_picker.pending()->file_kind == SaveLoadFileKind::menu_layout &&
|
||||
menu_save_picker.pending()->path.filename() == "LAYOUT.MEN" &&
|
||||
save_load_request_json(*menu_save_picker.pending()).find("\"file_kind\":\"menu_layout\"") != std::string::npos,
|
||||
"MEN save request uses the native extension and an explicit JSON file-kind discriminator");
|
||||
std::filesystem::remove_all(menu_test_dir);
|
||||
folder_pointer_input_tests(data,exe);
|
||||
TextDb desk_texts = load_textd(asset_path(data,"TEXTD.BLK"));
|
||||
auto match_game = g; match_game.texts = &desk_texts;
|
||||
match_game.club_names.assign(32,0);
|
||||
@@ -1106,28 +1220,8 @@ int main(int argc, char** argv) {
|
||||
auto wrong = d.options; wrong.managers = 5; rejected([&]{ validate_desk_profile(wrong); });
|
||||
wrong = d.options; wrong.world = false; wrong.league = false; rejected([&]{ validate_desk_profile(wrong); });
|
||||
|
||||
d = desk_from_game(g,exe,10); DesktopScreen desk(data,d);
|
||||
const auto pixels = desk.render().pixels;
|
||||
check(desk.render().pixels == pixels,"repeat render is deterministic");
|
||||
check(desk.click(5,23).kind == DeskRequestKind::none,"calendar handle must not advance a turn");
|
||||
auto action = desk.click(50,125);
|
||||
check(action.kind == DeskRequestKind::open_menu && action.menu_kind == 3 && action.manager_slot == 0 && action.revision == 10,"lineup request");
|
||||
check(desk.click(20,40).kind == DeskRequestKind::none,"pending command blocks another turn");
|
||||
rejected([&]{ desk.acknowledge(d); });
|
||||
++d.revision; desk.acknowledge(d);
|
||||
check(desk.click(20,40).kind == DeskRequestKind::advance_turn,"open calendar advances");
|
||||
check(desk.click(20,40).kind == DeskRequestKind::none,"no duplicate advance request");
|
||||
++d.revision; desk.acknowledge(d);
|
||||
check(desk.click(165,125).kind == DeskRequestKind::advance_turn,"kickoff icon advances");
|
||||
check(desk.render().pixels == pixels,"commands cannot mutate the saved game view");
|
||||
desk.reject_action("unsupported_menu");
|
||||
check(!desk.pending() && desk.render().pixels == pixels,"rejected command preserves state");
|
||||
check(desk.key("A").menu_kind == 3,"original A hotkey opens lineup");
|
||||
desk.reject_action("not_implemented");
|
||||
check(desk.key("D").menu_kind == 18,"original D hotkey opens tactics");
|
||||
desk.reject_action("not_implemented");
|
||||
check(desk.key("I").menu_kind == 16 && desk_menu_name(16)=="training" && desk_menu_name(15)=="training_camp",
|
||||
"original I and dispatch distinguish training from training camp");
|
||||
d = desk_from_game(g,exe,10);
|
||||
desktop_control_input_tests(data,d);
|
||||
|
||||
StartupFlow flow(data); begin(flow);
|
||||
auto result = CareerInitializationResult{d,{{0,0,12}}};
|
||||
|
||||
+2
-1
@@ -30,6 +30,7 @@ FlowResult StartupFlow::move_action(int x, int y) {
|
||||
if (friendly_match_) return {friendly_match_->move(x,y)};
|
||||
if(league_pairings_)return {league_pairings_->move(x,y)};
|
||||
if(stadium_)return {stadium_->pointer_move(x,y)};
|
||||
if(advertising_)return {advertising_->move(x,y)};
|
||||
if(environment_)return {};
|
||||
if (outgoing_transfer_) return {};
|
||||
if (transfer_market_ && !player_card_) {
|
||||
@@ -446,7 +447,7 @@ FlowResult StartupFlow::click(int x, int y, bool right, bool double_click) {
|
||||
}
|
||||
if (save_load_) {
|
||||
const auto before = state_json();
|
||||
const bool changed = save_load_->click(x, y, right);
|
||||
const bool changed = save_load_->click(x, y, right, double_click);
|
||||
return finish_file_input(changed || before != state_json());
|
||||
}
|
||||
if (in_preparation_menu()) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "ui/incoming_transfer.hpp"
|
||||
#include "ui/source_notice_test_helpers.hpp"
|
||||
#include "ui/setup.hpp"
|
||||
|
||||
#include <cstdio>
|
||||
#include <vector>
|
||||
@@ -173,20 +174,42 @@ int main(int argc, char** argv) {
|
||||
check(monitor_ink, "KB0 monitor crop has visible pixels");
|
||||
check(pool_tile_exact, "pool TV crop matches KB0 with Source transparency");
|
||||
check(frame_exact, "pool TV fallback has Source legacy routine border colors and bounds");
|
||||
auto neutral_badge_state = state;
|
||||
neutral_badge_state.seller = 100;
|
||||
neutral_badge_state.seller_team_token = 100;
|
||||
neutral_badge_state.seller_badge_sprite = 0; // The raw Source fallback precedes selector lookup.
|
||||
IncomingTransferScreen neutral_badge(argv[1], neutral_badge_state);
|
||||
const auto neutral_frame = neutral_badge.render();
|
||||
check(neutral_frame.pixels[size_t(50) * 320 + 101] == 0x46 &&
|
||||
neutral_frame.pixels[size_t(89) * 320 + 140] == 0x40,
|
||||
"Source seller tokens 90..137 use legacy routine's framed neutral fallback before badge lookup");
|
||||
auto unused_selector_state = neutral_badge_state;
|
||||
unused_selector_state.seller_badge_sprite = 511;
|
||||
IncomingTransferScreen unused_selector(argv[1], unused_selector_state);
|
||||
check(unused_selector.render().pixels == neutral_frame.pixels,
|
||||
"neutral raw seller fallback does not consult or load its unused ba378 selector");
|
||||
// The supplied executable decides whether tokens 90..137 use individual
|
||||
// crests. Read its verified instruction rather than the UI's policy.
|
||||
const auto source_exe = bmh::load_le(asset_path(argv[1], "BMH.exe"));
|
||||
constexpr auto gate = ::bmh::layout::ForeignBadgeGateInstruction;
|
||||
check(source_exe.u8(gate) == 0x66 && source_exe.u8(gate + 1) == 0x81 &&
|
||||
source_exe.u8(gate + 2) == 0xfb && source_exe.u8(gate + 5) == 0x7c &&
|
||||
source_exe.u8(gate + 6) == 7 &&
|
||||
(source_exe.u16(gate + 3) == 90 || source_exe.u16(gate + 3) == 138),
|
||||
"foreign crest fixture uses a verified Original executable drawing gate");
|
||||
auto profile_badge_state = state;
|
||||
profile_badge_state.seller = 100;
|
||||
profile_badge_state.seller_team_token = 100;
|
||||
profile_badge_state.seller_badge_sprite = 0;
|
||||
IncomingTransferScreen profile_badge(argv[1], profile_badge_state);
|
||||
const auto profile_frame = profile_badge.render();
|
||||
if (source_exe.u16(gate + 3) == 138) {
|
||||
check(profile_frame.pixels[size_t(50) * 320 + 101] == 0x46 &&
|
||||
profile_frame.pixels[size_t(89) * 320 + 140] == 0x40,
|
||||
"CD foreign seller uses the framed neutral fallback before badge lookup");
|
||||
auto unused_selector_state = profile_badge_state;
|
||||
unused_selector_state.seller_badge_sprite = 511;
|
||||
IncomingTransferScreen unused_selector(argv[1], unused_selector_state);
|
||||
check(unused_selector.render().pixels == profile_frame.pixels,
|
||||
"neutral raw seller fallback does not consult or load its unused ba378 selector");
|
||||
} else {
|
||||
const auto foreign_atlas = bmh::load_vga(asset_path(std::filesystem::path(argv[1]) / "W", "0.VGA"));
|
||||
bool foreign_pixels_match = true;
|
||||
size_t foreign_ink = 0;
|
||||
for (int y = 0; y < 38; ++y) for (int x = 0; x < 38; ++x) {
|
||||
const auto pixel = foreign_atlas.pixels.at(size_t(y) * foreign_atlas.width + size_t(x));
|
||||
foreign_ink += pixel != 0;
|
||||
foreign_pixels_match &= profile_frame.pixels[size_t(y + 51) * 320 + size_t(x + 102)] == pixel;
|
||||
}
|
||||
check(foreign_ink > 0 && foreign_pixels_match,
|
||||
"individual foreign crest profile draws seller100's valid W0 selector instead of a neutral tile");
|
||||
}
|
||||
auto selector_state = state;
|
||||
selector_state.seller = 20;
|
||||
selector_state.seller_team_token = 20;
|
||||
|
||||
+2
-1
@@ -185,7 +185,8 @@ int main(int argc, char** argv) {
|
||||
const bool held=event.button.button==SDL_BUTTON_LEFT&&left_press&&
|
||||
event.button.x==left_press->x&&event.button.y==left_press->y&&left_press->screen==screen.screen_name()&&SDL_GetTicks()-left_press->time>=2000;
|
||||
auto result = held ? screen.hold(event.button.x,event.button.y,2000) :
|
||||
screen.click(event.button.x, event.button.y, event.button.button == SDL_BUTTON_RIGHT);
|
||||
screen.click(event.button.x, event.button.y, event.button.button == SDL_BUTTON_RIGHT,
|
||||
event.button.clicks >= 2);
|
||||
auto input=pointer_input(held ? "hold" : event.button.button == SDL_BUTTON_RIGHT ? "right" : "left",event.button.x,event.button.y);
|
||||
if(held){input.pop_back();input+=",\"milliseconds\":"+std::to_string(SDL_GetTicks()-left_press->time)+"}";}
|
||||
left_press.reset();report(screen, result, input);dirty |= result.changed;
|
||||
|
||||
@@ -1144,6 +1144,7 @@ FlowResult StartupFlow::pointer_down(int x,int y,bool right) {
|
||||
return {changed};
|
||||
}
|
||||
if (environment_) return {environment_->pointer_down(x,y,right)};
|
||||
if (advertising_) return {advertising_->move(x,y)};
|
||||
if(pitch_){
|
||||
const std::string before=pitch_->state_json();
|
||||
const auto request=pitch_->pointer_down(x,y,right);
|
||||
@@ -2293,6 +2294,8 @@ void StartupFlow::acknowledge_advertising(AdvertisingState state, DeskState desk
|
||||
// Only contract acceptance resumes the next offer. Spending closes its calculator.
|
||||
if (request.kind == AdvertisingActionKind::accept_offer)
|
||||
(void)next_advertising->open_offers(request.offer.display_slot);
|
||||
if (const auto pointer = advertising_->pointer_position())
|
||||
(void)next_advertising->move((*pointer)[0], (*pointer)[1]);
|
||||
desktop_ = std::move(next_desktop);
|
||||
preparation_ = std::move(next_preparation);
|
||||
advertising_ = std::move(next_advertising);
|
||||
|
||||
+59
-6
@@ -9,6 +9,7 @@
|
||||
#include <system_error>
|
||||
|
||||
#include "ui/manager.hpp"
|
||||
#include "ui/game_end.hpp"
|
||||
#include "ui/host_path.hpp"
|
||||
#include "ui/setup.hpp"
|
||||
#include "formats/fbm.hpp"
|
||||
@@ -177,11 +178,24 @@ Image SaveLoadScreen::render() const {
|
||||
text(out, 212, y, row.league, 0x6b, -1, footer_font_, true);
|
||||
}
|
||||
}
|
||||
if (overwrite_confirmation_open_) {
|
||||
TaxDialogProjection question;
|
||||
question.kind = TaxDialogKind::question;
|
||||
question.source_flags = 0x101; // Original overwrite prompt's Ja/Nein selectors.
|
||||
question.source_system_identity = true;
|
||||
question.badge_fallback = true;
|
||||
question.portrait = 14;
|
||||
question.body = exe_.string_at_pointer(::bmh::layout::SaveLoad_OverwriteQuestionPointer);
|
||||
// OpenBMH deviates from the original: the host file picker uses the
|
||||
// shared dialog's system identity without a live manager portrait projection.
|
||||
draw_source_dialog(out, {widgets_, widgets_, nullptr, footer_font_, font_, exe_, sprite_font_, texts_},
|
||||
question, gradient_text_);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
bool SaveLoadScreen::info_press(int x, int y) {
|
||||
if (file_kind_ != SaveLoadFileKind::game || pending_ || info_ || x <= 52 || x >= 200 || y <= 40 ||
|
||||
if (file_kind_ != SaveLoadFileKind::game || pending_ || info_ || overwrite_confirmation_open_ || x <= 52 || x >= 200 || y <= 40 ||
|
||||
y >= 192 || !select_row(y)) return false;
|
||||
try {
|
||||
const auto saved = load_savegame(entries_.at(size_t(selected_)).path);
|
||||
@@ -316,14 +330,40 @@ void SaveLoadScreen::request_action() {
|
||||
std::error_code ec;
|
||||
const bool exists = std::filesystem::exists(path, ec);
|
||||
if (ec) { feedback_ = "DATEI NICHT PRUEFBAR"; return; }
|
||||
if (exists && !overwrite_armed_) { overwrite_armed_ = true; feedback_ = "EXISTIERT: ENTER ZUM ERSETZEN"; return; }
|
||||
if (exists && !overwrite_armed_) {
|
||||
overwrite_armed_ = true;
|
||||
overwrite_confirmation_open_ = true;
|
||||
feedback_.clear();
|
||||
return;
|
||||
}
|
||||
overwrite_confirmation_open_ = false;
|
||||
pending_ = SaveLoadRequest{SaveLoadAction::save, manager_slot_, revision_, path, exists,
|
||||
file_kind_, origin_item_id_};
|
||||
}
|
||||
|
||||
bool SaveLoadScreen::click(int x, int y, bool right) {
|
||||
bool SaveLoadScreen::click(int x, int y, bool right, bool double_click) {
|
||||
if (info_) { info_.reset(); return true; }
|
||||
if (pending_) return false;
|
||||
if (overwrite_confirmation_open_) {
|
||||
if (right) {
|
||||
overwrite_confirmation_open_ = overwrite_armed_ = false;
|
||||
close_requested_ = true;
|
||||
return true;
|
||||
}
|
||||
// Only a separate click on the question's buttons can decide. Further
|
||||
// releases from a double/triple click in the file list cannot accept it.
|
||||
if (double_click || y < 166 || y > 176) return false;
|
||||
if (x >= 62 && x <= 137) {
|
||||
overwrite_confirmation_open_ = false;
|
||||
request_action();
|
||||
return true;
|
||||
}
|
||||
if (x >= 175 && x <= 250) {
|
||||
overwrite_confirmation_open_ = overwrite_armed_ = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// OpenBMH deviates from the original: permits cancelling host file dialogs with the right mouse button.
|
||||
if (right) { close_requested_ = true; return true; }
|
||||
if (x >= 206 && y >= 60 && y <= 169)
|
||||
@@ -337,7 +377,11 @@ bool SaveLoadScreen::click(int x, int y, bool right) {
|
||||
}
|
||||
if (x >= 53 && x <= 199 && select_row(y)) {
|
||||
const int row = scroll_ + (y - 40) / 10;
|
||||
if (mode_ == SaveLoadMode::load && row == last_clicked_row_) { request_action(); return true; }
|
||||
// Row selection clears overwrite confirmation before activation. Even a
|
||||
// repeated double-click cannot confirm replacement.
|
||||
if (double_click || (mode_ == SaveLoadMode::load && row == last_clicked_row_)) {
|
||||
request_action(); return true;
|
||||
}
|
||||
last_clicked_row_ = row;
|
||||
return true;
|
||||
}
|
||||
@@ -351,7 +395,15 @@ bool SaveLoadScreen::click(int x, int y, bool right) {
|
||||
bool SaveLoadScreen::key(std::string_view value) {
|
||||
if (info_) return false; // Centered waits for mouse release, not keyboard.
|
||||
if (pending_) return false;
|
||||
if (value == "ESC") { close_requested_ = true; return true; }
|
||||
if (value == "ESC") {
|
||||
overwrite_confirmation_open_ = overwrite_armed_ = false;
|
||||
close_requested_ = true;
|
||||
return true;
|
||||
}
|
||||
if (overwrite_confirmation_open_) {
|
||||
if (value == "ENTER") { request_action(); return true; }
|
||||
return false;
|
||||
}
|
||||
if (mode_ == SaveLoadMode::load && !entries_.empty()) {
|
||||
if (value == "UP") { if (selected_ > 0) --selected_; if (selected_ < scroll_) scroll_ = selected_; return true; }
|
||||
if (value == "DOWN") { if (selected_ + 1 < int(entries_.size())) ++selected_; if (selected_ >= scroll_ + 15) scroll_ = selected_ - 14; return true; }
|
||||
@@ -380,7 +432,7 @@ bool SaveLoadScreen::key(std::string_view value) {
|
||||
}
|
||||
|
||||
bool SaveLoadScreen::text(std::string_view value) {
|
||||
if (info_ || mode_ != SaveLoadMode::save || !filename_focus_ || pending_ || value.empty()) return false;
|
||||
if (info_ || overwrite_confirmation_open_ || mode_ != SaveLoadMode::save || !filename_focus_ || pending_ || value.empty()) return false;
|
||||
const std::string next = (filename_selected_ ? std::string{} : filename_) + std::string(value);
|
||||
if (!valid_filename(next)) return false;
|
||||
filename_ = next; filename_selected_ = false;
|
||||
@@ -418,6 +470,7 @@ std::string SaveLoadScreen::state_json() const {
|
||||
<< ",\"filename\":" << json_quote(filename_) << ",\"entries\":[";
|
||||
for (size_t i = 0; i < entries_.size(); ++i) { if (i) out << ','; out << json_quote(path_to_utf8(entries_[i].path.filename())); }
|
||||
out << "],\"info_open\":" << (info_ ? "true" : "false")
|
||||
<< ",\"overwrite_confirmation_open\":" << (overwrite_confirmation_open_ ? "true" : "false")
|
||||
<< ",\"pending_action\":" << (pending_ ? save_load_request_json(*pending_) : "null")
|
||||
<< ",\"feedback\":" << (feedback_.empty() ? "null" : json_quote(feedback_));
|
||||
if (file_kind_ == SaveLoadFileKind::menu_layout || file_kind_ == SaveLoadFileKind::settings)
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
// InfoPress opens5870f on right DOWN; its popup restores on mouse UP.
|
||||
bool info_press(int x, int y);
|
||||
bool info_open() const { return bool(info_); }
|
||||
bool click(int x, int y, bool right = false);
|
||||
bool click(int x, int y, bool right = false, bool double_click = false);
|
||||
bool key(std::string_view key);
|
||||
bool text(std::string_view value);
|
||||
const std::optional<SaveLoadRequest>& pending() const { return pending_; }
|
||||
@@ -72,7 +72,7 @@ private:
|
||||
int selected_ = 0, scroll_ = 0;
|
||||
std::string filename_, feedback_;
|
||||
bool filename_focus_ = false, filename_selected_ = false;
|
||||
bool overwrite_armed_ = false, close_requested_ = false;
|
||||
bool overwrite_armed_ = false, overwrite_confirmation_open_ = false, close_requested_ = false;
|
||||
int last_clicked_row_ = -1;
|
||||
std::optional<SaveLoadRequest> pending_;
|
||||
struct InfoRow { std::string manager, club, league; };
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#include "ui/save_load.hpp"
|
||||
#include "ui/flow.hpp"
|
||||
|
||||
#include <chrono>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <stdexcept>
|
||||
|
||||
using namespace bmh;
|
||||
@@ -30,7 +32,90 @@ int main(int argc, char** argv) {
|
||||
std::pair{SaveLoadFileKind::game, ".FBM"},
|
||||
std::pair{SaveLoadFileKind::settings, ".EIN"},
|
||||
std::pair{SaveLoadFileKind::menu_layout, ".MEN"}}) {
|
||||
std::ofstream(root / (std::string("Existing") + extension)) << "authored filename fixture";
|
||||
const auto existing = root / (std::string("Existing") + extension);
|
||||
const std::string fixture = "authored filename fixture";
|
||||
std::ofstream(existing) << fixture;
|
||||
const auto unchanged = [&] {
|
||||
std::ifstream input(existing);
|
||||
check(std::string(std::istreambuf_iterator<char>(input), {}) == fixture,
|
||||
"picker interactions never write the selected file");
|
||||
};
|
||||
SaveLoadScreen overwrite(argv[1], root, SaveLoadMode::save, 2, 17, backdrop, true, kind, 9);
|
||||
check(overwrite.click(70, 45) && overwrite.click(70, 45) && !overwrite.pending() &&
|
||||
overwrite.state_json().find("\"overwrite_confirmation_open\":false") != std::string::npos,
|
||||
"separate single clicks only select an existing save");
|
||||
check(overwrite.click(70, 45, false, true) && !overwrite.pending() &&
|
||||
overwrite.state_json().find("\"overwrite_confirmation_open\":true") != std::string::npos,
|
||||
"a true double-click asks for overwrite confirmation without submitting a write");
|
||||
check(!overwrite.click(70, 45, false, true) && !overwrite.pending(),
|
||||
"repeated double-clicks cannot confirm an overwrite");
|
||||
unchanged();
|
||||
check(overwrite.key("ENTER") && overwrite.pending() && overwrite.pending()->overwrite &&
|
||||
overwrite.pending()->path == existing && overwrite.pending()->manager_slot == 2 &&
|
||||
overwrite.pending()->revision == 17 && overwrite.pending()->file_kind == kind &&
|
||||
overwrite.pending()->origin_item_id == 9,
|
||||
"Enter confirms the exact selected file with its manager, revision and file kind");
|
||||
const auto request = *overwrite.pending();
|
||||
check(!overwrite.click(70, 45, false, true) && !overwrite.key("ENTER") &&
|
||||
*overwrite.pending() == request,
|
||||
"queued mouse releases and Enter cannot submit a second pending overwrite");
|
||||
overwrite.acknowledge();
|
||||
check(overwrite.close_requested() && !overwrite.pending(),
|
||||
"acknowledgement closes the picker and clears its one request");
|
||||
unchanged();
|
||||
SaveLoadScreen mouse(argv[1], root, SaveLoadMode::save, 0, 7, backdrop, true, kind);
|
||||
const auto list = mouse.render();
|
||||
mouse.click(70, 45, false, true);
|
||||
check(mouse.render().pixels != list.pixels && !mouse.text("IGNORED") &&
|
||||
!mouse.key("BACKSPACE") && !mouse.info_press(70, 45),
|
||||
"the original overwrite question owns input and renders over the file list");
|
||||
check(!mouse.click(100, 171, false, true) && !mouse.pending(),
|
||||
"double-click releases cannot accept even over the question's Yes button");
|
||||
check(mouse.click(210, 171) && !mouse.pending() && !mouse.close_requested() &&
|
||||
mouse.render().pixels == list.pixels,
|
||||
"No dismisses the question and restores the unchanged picker");
|
||||
mouse.click(70, 45, false, true);
|
||||
check(mouse.click(100, 171) && mouse.pending() && mouse.pending()->overwrite &&
|
||||
mouse.pending()->path == existing,
|
||||
"double-click followed by a separate Yes click submits an entirely mouse-operated overwrite");
|
||||
const auto mouse_request = *mouse.pending();
|
||||
check(!mouse.click(100, 171) && *mouse.pending() == mouse_request,
|
||||
"additional Yes releases preserve one pending write");
|
||||
unchanged();
|
||||
for (bool right : {false, true}) {
|
||||
SaveLoadScreen cancel(argv[1], root, SaveLoadMode::save, 0, 7, backdrop, true, kind);
|
||||
cancel.click(70, 45, false, true);
|
||||
check((right ? cancel.click(70, 45, true, true) : cancel.key("ESC")) &&
|
||||
cancel.close_requested() && !cancel.pending(),
|
||||
"right-click and Escape cancel an armed overwrite without a write");
|
||||
}
|
||||
const auto second = root / (std::string("Second") + extension);
|
||||
std::ofstream(second) << fixture;
|
||||
SaveLoadScreen change_row(argv[1], root, SaveLoadMode::save, 0, 7, backdrop, true, kind);
|
||||
change_row.click(70, 45, false, true);
|
||||
check(!change_row.click(70, 55) && change_row.selected() == 0,
|
||||
"the question prevents the file list from changing its target");
|
||||
change_row.click(210, 171); // Decline before selecting another file.
|
||||
check(change_row.click(70, 55) && change_row.key("ENTER") && !change_row.pending() &&
|
||||
change_row.key("ENTER") && change_row.pending() && change_row.pending()->path == second,
|
||||
"selecting another row cannot reuse the first file's overwrite confirmation");
|
||||
SaveLoadScreen reset(argv[1], root, SaveLoadMode::save, 0, 7, backdrop, true, kind);
|
||||
reset.click(70, 45, false, true);
|
||||
reset.click(210, 171);
|
||||
reset.click(70, 45);
|
||||
check(reset.key("ENTER") && !reset.pending() && reset.key("ENTER") && reset.pending(),
|
||||
"declining and selecting again preserves the existing two-Enter save path");
|
||||
SaveLoadScreen rename(argv[1], root, SaveLoadMode::save, 0, 7, backdrop, true, kind);
|
||||
rename.click(70, 45, false, true);
|
||||
rename.click(210, 171);
|
||||
check(rename.text("Other") && rename.key("ENTER") && rename.pending() &&
|
||||
!rename.pending()->overwrite && rename.pending()->path.filename() == std::string("Other") + extension,
|
||||
"editing an armed overwrite starts an independent new-file save");
|
||||
SaveLoadScreen activate_load(argv[1], root, SaveLoadMode::load, 0, 7, backdrop, true, kind);
|
||||
check(activate_load.click(70, 45, false, true) && activate_load.pending() &&
|
||||
activate_load.pending()->action == SaveLoadAction::load && activate_load.pending()->path == existing,
|
||||
"an explicit double-click also activates an existing load entry");
|
||||
unchanged();
|
||||
SaveLoadScreen load(argv[1], root, SaveLoadMode::load, 0, 7, backdrop, true, kind);
|
||||
check(load.click(0, 0, true) && load.close_requested() && !load.pending(),
|
||||
"right-click closes every file picker without submitting a load");
|
||||
@@ -54,6 +139,13 @@ int main(int argc, char** argv) {
|
||||
check(edit.pending() && edit.pending()->path.filename() == std::string("Short") + extension,
|
||||
"editing and UTF-8 deletion preserve the resulting host filename");
|
||||
}
|
||||
StartupFlow flow(argv[1], root);
|
||||
flow.click(214, 215);
|
||||
check(flow.screen_name() == "save_load", "setup opens its save-list picker");
|
||||
const auto load = flow.click(70, 45, false, true);
|
||||
check(load.request == FlowRequest::file_action && load.file_action.action == SaveLoadAction::load &&
|
||||
load.file_action.path.filename() == "Existing.FBM",
|
||||
"startup flow forwards a real double-click to its active file picker");
|
||||
std::cout << "save/load input checks passed\n";
|
||||
return 0;
|
||||
} catch (const std::exception& error) {
|
||||
|
||||
+216
-82
@@ -4,6 +4,7 @@
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
@@ -1523,6 +1524,18 @@ void check_advertising_controller(const std::filesystem::path& data) {
|
||||
};
|
||||
serve(flow.send_key("W"));
|
||||
check(flow.screen_name() == "advertising", "Original W opens advertising through the controller");
|
||||
const auto unhovered_pixels = flow.render().pixels;
|
||||
const auto moved = flow.move_action(40, 30);
|
||||
check(moved.changed && moved.request == FlowRequest::none &&
|
||||
flow.state_json().find("\"hovered_target\":") != std::string::npos &&
|
||||
flow.render().pixels != unhovered_pixels && !flow.pending_advertising_action(),
|
||||
"production flow routes advertising motion into the original hover and help view");
|
||||
check(!flow.pointer_down(40, 30).changed && !flow.pending_advertising_action(),
|
||||
"advertising DOWN does not duplicate the release-owned offer action");
|
||||
unchanged();
|
||||
check(flow.move_action(-1, -1).changed && flow.render().pixels == unhovered_pixels,
|
||||
"production flow restores the advertising view when the pointer leaves");
|
||||
unchanged();
|
||||
serve(flow.click(40, 30));
|
||||
(void)flow.render();
|
||||
unchanged();
|
||||
@@ -1606,7 +1619,14 @@ void check_advertising_controller(const std::filesystem::path& data) {
|
||||
"independent source commit accepts the two-board offer");
|
||||
const auto expected_bytes = save_stream(expected);
|
||||
const int32_t cash_before = signed_u32(game.manager_records, record + 0x314);
|
||||
const auto advertising_exe = load_le(asset_path(data, "BMH.exe"));
|
||||
check(!flow.move_action(
|
||||
advertising_exe.u16(::bmh::layout::Advertising_Click_RuntimeField3 + 18 * 2) + 2,
|
||||
advertising_exe.u16(::bmh::layout::Advertising_Click_RuntimeField4 + 18 * 2) + 2).changed,
|
||||
"accepted offer remembers a moved pointer while its pending browser stays frozen");
|
||||
serve(action);
|
||||
check(flow.state_json().find("\"hovered_target\":18") != std::string::npos,
|
||||
"accepted final offer resumes current hover outside its original contract target");
|
||||
check(save_stream(game) == expected_bytes && revision == original_revision + 1 &&
|
||||
!flow.pending_advertising_action() && flow.screen_name() == "advertising" &&
|
||||
flow.desktop()->state().revision == revision &&
|
||||
@@ -1810,7 +1830,11 @@ void check_advertising_spending_controller(const std::filesystem::path& data) {
|
||||
const auto before = save_stream(g);
|
||||
const auto w = session->rand(); const auto gr = session->game();
|
||||
open(17); flow.text("5000"); (void)flow.render();
|
||||
serve(flow.send_key("ESC"));
|
||||
check(!flow.pointer_down(0, 0, true).changed,
|
||||
"right DOWN records its position while the calculator still owns input");
|
||||
serve(flow.click(0, 0, true));
|
||||
check(flow.state_json().find("\"hovered_target\":-1") != std::string::npos,
|
||||
"calculator right release removes its old outline without a motion event");
|
||||
check(save_stream(g) == before && session->rand().calls() == w.calls() &&
|
||||
session->game().calls() == gr.calls(), "calculator input and cancel are read-only");
|
||||
open(17); flow.text("5000");
|
||||
@@ -1820,7 +1844,14 @@ void check_advertising_spending_controller(const std::filesystem::path& data) {
|
||||
check(save_stream(g) == before && !flow.pending_advertising_action(),
|
||||
"forged monthly request cannot mutate state");
|
||||
open(17); flow.text("5000"); monthly = submit();
|
||||
const int resumed_x = exe.u16(::bmh::layout::Advertising_Click_RuntimeField3 + 18 * 2) + 2;
|
||||
const int resumed_y = exe.u16(::bmh::layout::Advertising_Click_RuntimeField4 + 18 * 2) + 2;
|
||||
check(!flow.move_action(resumed_x, resumed_y).changed,
|
||||
"pending calculator keeps its parent frozen while remembering the latest pointer");
|
||||
serve(monthly);
|
||||
check(flow.state_json().find("\"hovered_target\":18") != std::string::npos &&
|
||||
!flow.move_action(resumed_x, resumed_y).changed,
|
||||
"spending acknowledgement resumes the last pointer over its refreshed parent without new motion");
|
||||
check(signed_u32(g.manager_records, record + 0x854) == 5000 &&
|
||||
signed_u32(g.manager_records, record + 0x314) == 500000 &&
|
||||
session->rand().calls() == w.calls() && session->game().calls() == gr.calls(),
|
||||
@@ -2371,33 +2402,33 @@ void check_semantic_desk_settings(const std::filesystem::path& data) {
|
||||
check(session.finish(init,error),"semantic setting fixture reaches a real desk");
|
||||
revision=init.desktop.revision;
|
||||
const int manager=game.memory.u8(::bmh::layout::ActiveManager); const size_t rec=size_t(manager)*0xb0c;
|
||||
const auto default_desk=session.desktop_projection(revision);
|
||||
check(std::none_of(default_desk.items.begin(),default_desk.items.end(),[](const auto& item) {
|
||||
return item.kind==64&&item.open&&!item.disabled;
|
||||
}),"parent failure uses the actual default closed automation drawer");
|
||||
// Typed settings remain independent of hidden desktop presentation records.
|
||||
int automation_item=-1,price_item=-1;
|
||||
for(int i=0;i<54;++i) {
|
||||
const auto at=::bmh::layout::DesktopsUnsigned+uint32_t(manager)*0x360+uint32_t(i)*16;
|
||||
const auto kind=game.memory.u8(at+12);
|
||||
if(kind==64)automation_item=i;
|
||||
if(kind==64) {
|
||||
automation_item=i;
|
||||
game.memory.set16(at,uint16_t(game.memory.u16(at)|0x1000));
|
||||
}
|
||||
if(kind==55) {
|
||||
price_item=i;
|
||||
game.memory.set8(at+13,uint8_t(game.memory.u8(at+13)&~0x80));
|
||||
game.memory.set16(at,uint16_t(game.memory.u16(at)|0x1000));
|
||||
}
|
||||
}
|
||||
check(automation_item>=0&&price_item>=0,"Original MEN contains both setting drawers");
|
||||
DeskRequest legacy{DeskRequestKind::change_option,manager,automation_item,64,1,revision};
|
||||
reject([&]{return session.dispatch_desk_widget(legacy,revision,error);},
|
||||
"original SDL dispatcher still rejects default closed automation");
|
||||
check(error=="stale_or_closed_desk_widget","closed widget fails at the retained SDL item guard");
|
||||
"SDL dispatcher rejects a hidden automation item");
|
||||
check(error=="stale_or_closed_desk_widget","hidden widget fails at the retained SDL item guard");
|
||||
for(int value:{8,25,17}) {
|
||||
price={identity(),value}; auto expected=game; expected.manager_records[rec+0x26e]=uint8_t(value);
|
||||
accept([&]{return session.dispatch_ticket_price(price,revision,error);},expected,
|
||||
"typed price works with a closed drawer and changes only admission, never cash or credit");
|
||||
"typed price works with a hidden drawer and changes only admission, never cash or credit");
|
||||
}
|
||||
reject([&]{return session.dispatch_ticket_price(price,revision,error);},"stale price replay is wholly neutral");
|
||||
legacy={DeskRequestKind::change_ticket_price,manager,price_item,55,12,revision};
|
||||
reject([&]{return session.dispatch_desk_widget(legacy,revision,error);},"typed price does not unlock the SDL drawer");
|
||||
reject([&]{return session.dispatch_desk_widget(legacy,revision,error);},"typed price does not unhide the SDL drawer");
|
||||
for(int value:{7,26}) {
|
||||
price={identity(),value};
|
||||
reject([&]{return session.dispatch_ticket_price(price,revision,error);},"typed price rejects outside Original endpoints");
|
||||
@@ -2550,7 +2581,8 @@ void check_semantic_desk_settings(const std::filesystem::path& data) {
|
||||
std::filesystem::remove_all(directory);
|
||||
}
|
||||
|
||||
void check_desk_widgets(const std::filesystem::path& data) {
|
||||
void check_desk_widgets_for_frame(const std::filesystem::path& data, bool framed) {
|
||||
const int content_x=20+(framed?4:0);
|
||||
StartupFlow flow(data);
|
||||
flow.click(150, 215); flow.click(5, 225, true); flow.click(5, 225, true);
|
||||
flow.click(90, 169);
|
||||
@@ -2573,7 +2605,7 @@ void check_desk_widgets(const std::filesystem::path& data) {
|
||||
game.memory.set8(at + 4, uint8_t(i == 1 ? 36 : 38));
|
||||
game.memory.set8(at + 5, uint8_t(i == 1 ? 2 : 0));
|
||||
game.memory.set8(at + 12, uint8_t(i == 1 ? 55 : 64));
|
||||
game.memory.set8(at + 13, 0x80);
|
||||
game.memory.set8(at + 13, framed?0x80:0);
|
||||
}
|
||||
init.desktop = session->desktop_projection(revision);
|
||||
init.preparation = session->preparation_projection(revision);
|
||||
@@ -2598,22 +2630,22 @@ void check_desk_widgets(const std::filesystem::path& data) {
|
||||
const auto ws = session->rand().seed();
|
||||
const auto gc = session->game().calls(), wc = session->rand().calls();
|
||||
const auto rev = revision;
|
||||
const auto price = flow.click(20 + 4 + 86, 90);
|
||||
const auto price = flow.click(content_x + 86, 90);
|
||||
check(price.desk_action.value == 25, "rightmost original price hitbox maps to 25");
|
||||
check(flow.click(20 + 4 + 35, 90).request == FlowRequest::none, "pending widget blocks a duplicate");
|
||||
check(flow.click(content_x + 35, 90).request == FlowRequest::none, "pending widget blocks a duplicate");
|
||||
execute(price);
|
||||
auto changed_records = records;
|
||||
changed_records[0x26e] = 25;
|
||||
check(game.manager_records == changed_records && game.manager_options == options && revision == rev + 1,
|
||||
"price changes only the active manager's admission byte");
|
||||
execute(flow.click(20 + 4 + 35, 90));
|
||||
execute(flow.click(content_x + 35, 90));
|
||||
check(game.manager_records[0x26e] == 8, "leftmost original price hitbox maps to 8");
|
||||
check(flow.click(20 + 4 + 34, 90).request == FlowRequest::none &&
|
||||
flow.click(20 + 4 + 87, 90).request == FlowRequest::none,
|
||||
check(flow.click(content_x + 34, 90).request == FlowRequest::none &&
|
||||
flow.click(content_x + 87, 90).request == FlowRequest::none,
|
||||
"outside price endpoints remain read-only");
|
||||
for (int index : {1, 2, 3, 4}) {
|
||||
const auto before = game.manager_options;
|
||||
execute(flow.click(20 + 4 + index * 33 + 10, 140));
|
||||
execute(flow.click(content_x + index * 33 + 10, 140));
|
||||
auto expected = before;
|
||||
expected[size_t(index)] ^= 1;
|
||||
check(game.manager_options == expected, "automation toggles only its Original bit including training high flags");
|
||||
@@ -2623,12 +2655,12 @@ void check_desk_widgets(const std::filesystem::path& data) {
|
||||
game.manager_records[0x219] = 0x02; // Indoor: only formation 2.
|
||||
game.manager_options[0] = 0;
|
||||
for (int value : {3, 8, 0}) {
|
||||
execute(flow.click(20 + 4 + 10, 140));
|
||||
execute(flow.click(content_x + 10, 140));
|
||||
check(game.manager_options[0] == value, "outdoor automation skips unavailable stored formations and wraps to off");
|
||||
}
|
||||
game.indoor = true;
|
||||
for (int value : {2, 0}) {
|
||||
execute(flow.click(20 + 4 + 10, 140));
|
||||
execute(flow.click(content_x + 10, 140));
|
||||
check(game.manager_options[0] == value, "indoor automation uses the separate saved formation mask");
|
||||
}
|
||||
game.indoor = false;
|
||||
@@ -2638,9 +2670,14 @@ void check_desk_widgets(const std::filesystem::path& data) {
|
||||
const auto before_records = game.manager_records;
|
||||
const auto before_options = game.manager_options;
|
||||
const auto before_revision = revision;
|
||||
const auto before_native = save_stream(game);
|
||||
const auto before_game = session->game(); const auto before_rand = session->rand();
|
||||
check(!session->dispatch_desk_widget(request, revision, error) &&
|
||||
game.manager_records == before_records && game.manager_options == before_options &&
|
||||
revision == before_revision, "invalid desk widget rejects before all state mutation");
|
||||
save_stream(game) == before_native && revision == before_revision &&
|
||||
session->game().seed() == before_game.seed() && session->game().calls() == before_game.calls() &&
|
||||
session->rand().seed() == before_rand.seed() && session->rand().calls() == before_rand.calls(),
|
||||
"invalid desk widget rejects before native, revision or RNG mutation");
|
||||
};
|
||||
DeskRequest request{DeskRequestKind::change_option, 0, 2, 64, 1, revision};
|
||||
for (int variant = 0; variant < 7; ++variant) {
|
||||
@@ -2655,14 +2692,20 @@ void check_desk_widgets(const std::filesystem::path& data) {
|
||||
unchanged(invalid);
|
||||
}
|
||||
for (int value : {7, 26}) unchanged(DeskRequest{DeskRequestKind::change_ticket_price, 0, 1, 55, value, revision});
|
||||
game.memory.set8(::bmh::layout::Desktops + 2 * 16 + 13, 0);
|
||||
unchanged(request);
|
||||
game.memory.set8(::bmh::layout::Desktops + 2 * 16 + 13, 0x80);
|
||||
game.memory.set16(::bmh::layout::Desktops + 2 * 16, 20 | 0x1000);
|
||||
unchanged(request);
|
||||
game.memory.set16(::bmh::layout::Desktops + 2 * 16, 20);
|
||||
game.manager_options[0] = 9;
|
||||
request.value = 0; unchanged(request);
|
||||
for(uint8_t invalid_formation : {uint8_t(9),uint8_t(255)}) {
|
||||
game.manager_options[0] = invalid_formation;
|
||||
for(int index : {0,1}) {
|
||||
request.value = index; unchanged(request);
|
||||
check(error == "invalid_saved_formation_automation",
|
||||
"malformed formation returns an explicit refusal before desktop projection");
|
||||
}
|
||||
unchanged(DeskRequest{DeskRequestKind::change_ticket_price,0,1,55,10,revision});
|
||||
check(error == "invalid_saved_formation_automation",
|
||||
"admission dispatch also refuses an unprojectable saved formation atomically");
|
||||
}
|
||||
game.manager_options[0] = 0;
|
||||
// National coaches keep lineup/attitude/marking automation, while admission
|
||||
// and training controls are unavailable in legacy routine/legacy routine.
|
||||
@@ -2675,7 +2718,7 @@ void check_desk_widgets(const std::filesystem::path& data) {
|
||||
const auto national = session->desktop_projection(revision);
|
||||
check(national.national_team, "widget fixture projects a national coach");
|
||||
DesktopScreen national_screen(data, national);
|
||||
check(national_screen.click(20 + 4 + 35, 90).kind == DeskRequestKind::none,
|
||||
check(national_screen.click(content_x + 35, 90).kind == DeskRequestKind::none,
|
||||
"national admission control does not emit a price request");
|
||||
unchanged(DeskRequest{DeskRequestKind::change_ticket_price, 0, 1, 55, 10, revision});
|
||||
request.value = 4;
|
||||
@@ -2691,6 +2734,10 @@ void check_desk_widgets(const std::filesystem::path& data) {
|
||||
"every drawer action preserves both RNG streams, date, board and squad");
|
||||
}
|
||||
|
||||
void check_desk_widgets(const std::filesystem::path& data) {
|
||||
for(bool framed : {true,false}) check_desk_widgets_for_frame(data,framed);
|
||||
}
|
||||
|
||||
void check_league_only_national_coach_handoff(const std::filesystem::path& data) {
|
||||
StartupFlow flow(data);
|
||||
flow.click(150, 215); // League-only setup; world competition remains disabled.
|
||||
@@ -6804,6 +6851,64 @@ void check_stadium_investment_controller(const std::filesystem::path& data) {
|
||||
std::filesystem::remove_all(saves);
|
||||
}
|
||||
|
||||
void check_date_widget_controller(const std::filesystem::path& data) {
|
||||
for(bool framed : {true,false}) {
|
||||
StartupFlow flow(data);
|
||||
flow.click(150,215); flow.click(5,225,true); flow.click(5,225,true);
|
||||
flow.click(90,169);
|
||||
check(flow.pending_career()!=nullptr,"date fixture requests a new career");
|
||||
std::unique_ptr<app::CareerSession> session=std::make_unique<app::CareerSession>(data,0x44415445);
|
||||
std::string error;
|
||||
const auto request=*flow.pending_career();
|
||||
for(const auto& manager : request.managers)
|
||||
check(session->confirm_manager(request.options,manager,error),"date fixture confirms its manager");
|
||||
CareerInitializationResult initialized;
|
||||
check(session->finish(initialized,error),"date fixture reaches an actual turn-driver desk");
|
||||
uint64_t revision=initialized.desktop.revision;
|
||||
const auto date=std::find_if(initialized.desktop.items.begin(),initialized.desktop.items.end(),
|
||||
[](const DeskItem& item){return item.kind==58;});
|
||||
check(date!=initialized.desktop.items.end(),"date fixture exposes the desktop date widget");
|
||||
const auto at=layout::DesktopsUnsigned+uint32_t(initialized.desktop.manager_slot)*0x360u+uint32_t(date->id)*16u+13u;
|
||||
auto& memory=session->state().memory;
|
||||
memory.set8(at,uint8_t((memory.u8(at)&0x7f)|(framed?0x80:0)));
|
||||
const int x=date->x+20,y=date->y+20;
|
||||
initialized.desktop=session->desktop_projection(revision);
|
||||
initialized.preparation=session->preparation_projection(revision);
|
||||
auto preparation=initialized.preparation;
|
||||
flow.attach_initialized_career(std::move(initialized));
|
||||
flow.attach_preparation_context(std::move(preparation));
|
||||
check(flow.pointer_down(x,y).request==FlowRequest::none,"date press waits for its release");
|
||||
const auto advance=flow.click(x,y);
|
||||
check(advance.request==FlowRequest::kickoff && advance.desk_action.menu_kind==58,
|
||||
"framed and unframed date releases route through the shared kickoff action");
|
||||
openbmh::audio::Playback playback;
|
||||
std::optional<uint64_t> audio_session;
|
||||
const auto serve=[&](const FlowResult& action) {
|
||||
const auto failure=app::serve_flow_request(flow,action,session,data,data,0x44415445,
|
||||
revision,playback,audio_session,false);
|
||||
if(!failure.empty()) throw std::runtime_error("date widget dispatch failed: "+failure);
|
||||
};
|
||||
const auto before=save_stream(session->state());
|
||||
const auto before_revision=revision;
|
||||
const auto before_game=session->game(); const auto before_rand=session->rand();
|
||||
auto stale=advance; ++stale.desk_action.revision;
|
||||
serve(stale);
|
||||
check(save_stream(session->state())==before && revision==before_revision &&
|
||||
session->game().seed()==before_game.seed() && session->game().calls()==before_game.calls() &&
|
||||
session->rand().seed()==before_rand.seed() && session->rand().calls()==before_rand.calls(),
|
||||
"stale date request leaves the pending owner, native state and both RNG streams unchanged");
|
||||
const auto before_date=session->state().date;
|
||||
serve(advance);
|
||||
check(session->state().date>before_date && revision>before_revision &&
|
||||
flow.screen_name()=="desktop" && !flow.desktop()->pending(),
|
||||
"date widget completes a real calendar event and acknowledges the next desk");
|
||||
const auto after=save_stream(session->state()); const auto after_revision=revision;
|
||||
serve(advance);
|
||||
check(save_stream(session->state())==after && revision==after_revision,
|
||||
"consumed date action cannot advance the calendar twice");
|
||||
}
|
||||
}
|
||||
|
||||
void check_menu_layout_session_io(const std::filesystem::path& data) {
|
||||
StartupFlow flow(data);
|
||||
flow.click(150, 215); flow.click(5, 225, true); flow.click(5, 225, true);
|
||||
@@ -6930,70 +7035,91 @@ void check_menu_layout_session_io(const std::filesystem::path& data) {
|
||||
session->rand().seed()==move_rand.seed()&&session->rand().calls()==move_rand.calls(),
|
||||
"desktop layout movement preserves both RNG streams");
|
||||
|
||||
// Exercise the newly source-backed folder-child return and bin-mode
|
||||
// Exercise framed and unframed folder-child return and bin-mode
|
||||
// transfer through the authenticated CareerSession boundary, not only the
|
||||
// DesktopScreen request projection.
|
||||
constexpr uint32_t native_layout=::bmh::layout::Desktops;
|
||||
const uint32_t native_base=native_layout+uint32_t(manager)*0x360u;
|
||||
for(size_t i=0;i<bytes_count;++i)game.memory.set8(native_base+uint32_t(i),0xff);
|
||||
auto put=[&](size_t item,size_t offset,uint8_t value){game.memory.set8(native_base+uint32_t(item*16+offset),value);};
|
||||
put(0,5,49);put(0,6,0);
|
||||
put(49,0,40);put(49,1,0);put(49,2,40);put(49,3,100);put(49,4,65);
|
||||
put(49,5,0);put(49,6,0);put(49,12,50);put(49,13,0x80);
|
||||
put(3,0,0);put(3,1,0);put(3,2,0);put(3,3,32);put(3,4,25);
|
||||
put(3,5,0xff);put(3,6,0xff);put(3,12,2);put(3,13,0);
|
||||
auto folder_desk=session->desktop_projection(revision);
|
||||
DesktopScreen child_return_screen(data,folder_desk);
|
||||
child_return_screen.pointer_down(50,49,true);
|
||||
child_return_screen.pointer_move(175,100);
|
||||
const auto return_request=child_return_screen.pointer_up(175,100,true);
|
||||
const auto before_return_rng=session->game();const auto before_return_rand=session->rand();
|
||||
check(return_request.layout_operation==ui::DeskLayoutOperation::return_folder_child&&
|
||||
session->dispatch_desktop_layout(return_request,revision,error)&&error.empty()&&
|
||||
game.memory.u8(native_base+3*16+5)==0&&game.memory.u8(native_base+3*16+6)==49&&
|
||||
game.memory.u8(native_base+49*16+5)==3,
|
||||
"authenticated folder child return appends to the visible chain");
|
||||
check(session->game().seed()==before_return_rng.seed()&&session->game().calls()==before_return_rng.calls()&&
|
||||
session->rand().seed()==before_return_rand.seed()&&session->rand().calls()==before_return_rand.calls(),
|
||||
"folder child return consumes no RNG");
|
||||
const auto returned_desk=session->desktop_projection(revision);
|
||||
const auto returned_child=std::find_if(returned_desk.items.begin(),returned_desk.items.end(),
|
||||
[](const ui::DeskItem& item){return item.id==3;});
|
||||
check(returned_child!=returned_desk.items.end(),"returned child is projected as a desk item");
|
||||
const auto saved_child_x=game.memory.u16(native_base+3*16);
|
||||
const auto saved_child_y=game.memory.u8(native_base+3*16+2);
|
||||
auto bin_desk=returned_desk;bin_desk.shortcut_bar_always=true;
|
||||
DesktopScreen bin_screen(data,bin_desk);
|
||||
bin_screen.click(2,215); // Source local_50 bin mode toggle.
|
||||
const auto bin_request=bin_screen.click(returned_child->x+1,returned_child->y+1,true);
|
||||
const auto before_bin_rng=session->game();const auto before_bin_rand=session->rand();
|
||||
check(bin_request.layout_operation==ui::DeskLayoutOperation::send_to_folder&&
|
||||
session->dispatch_desktop_layout(bin_request,revision,error)&&error.empty()&&
|
||||
game.memory.u8(native_base+3*16+5)==0xff&&game.memory.u8(native_base+3*16+6)==0xff&&
|
||||
game.memory.u8(native_base+3*16+13)==0,
|
||||
"bin mode moves the item into its original associated folder without clearing its coordinates");
|
||||
check(session->game().seed()==before_bin_rng.seed()&&session->game().calls()==before_bin_rng.calls()&&
|
||||
session->rand().seed()==before_bin_rand.seed()&&session->rand().calls()==before_bin_rand.calls(),
|
||||
"folder bin transfer consumes no RNG");
|
||||
auto binned_desk=session->desktop_projection(revision);binned_desk.shortcut_bar_always=true;
|
||||
DesktopScreen restore_screen(data,binned_desk);
|
||||
restore_screen.click(2,215);
|
||||
const int folder_x=std::find_if(binned_desk.items.begin(),binned_desk.items.end(),
|
||||
[](const ui::DeskItem& item){return item.id==49;})->x;
|
||||
const int folder_y=std::find_if(binned_desk.items.begin(),binned_desk.items.end(),
|
||||
[](const ui::DeskItem& item){return item.id==49;})->y;
|
||||
const auto restore_request=restore_screen.click(folder_x+10,folder_y+9,true);
|
||||
check(restore_request.layout_operation==ui::DeskLayoutOperation::restore_folder_child&&
|
||||
session->dispatch_desktop_layout(restore_request,revision,error)&&error.empty()&&
|
||||
game.memory.u8(native_base+3*16+5)==0&&game.memory.u8(native_base+49*16+5)==3&&
|
||||
game.memory.u16(native_base+3*16)==saved_child_x&&game.memory.u8(native_base+3*16+2)==saved_child_y,
|
||||
"right-clicking a folder child in bin mode restores its saved original position");
|
||||
for(int child_id : {3,13}) for(bool framed : {true,false}) {
|
||||
for(size_t i=0;i<bytes_count;++i)game.memory.set8(native_base+uint32_t(i),0xff);
|
||||
auto put=[&](size_t item,size_t offset,uint8_t value){game.memory.set8(native_base+uint32_t(item*16+offset),value);};
|
||||
put(0,5,49);put(0,6,0);
|
||||
put(49,0,40);put(49,1,0);put(49,2,40);put(49,3,100);put(49,4,65);
|
||||
put(49,5,0);put(49,6,0);put(49,12,50);put(49,13,framed?0x80:0);
|
||||
put(size_t(child_id),0,0);put(size_t(child_id),1,0);put(size_t(child_id),2,0);put(size_t(child_id),3,32);put(size_t(child_id),4,25);
|
||||
put(size_t(child_id),5,0xff);put(size_t(child_id),6,0xff);put(size_t(child_id),12,uint8_t(child_id-1));put(size_t(child_id),13,0);
|
||||
auto folder_desk=session->desktop_projection(revision);
|
||||
DesktopScreen child_return_screen(data,folder_desk);
|
||||
child_return_screen.pointer_down(50,49,true);
|
||||
child_return_screen.pointer_move(175,100);
|
||||
const auto return_request=child_return_screen.pointer_up(175,100,true);
|
||||
const auto before_return_rng=session->game();const auto before_return_rand=session->rand();
|
||||
const auto return_revision=revision;
|
||||
const auto before_return=capture_slot();
|
||||
auto stale_return=return_request; ++stale_return.revision;
|
||||
check(!session->dispatch_desktop_layout(stale_return,revision,error) &&
|
||||
revision==return_revision && capture_slot()==before_return,
|
||||
"folder extraction rejects a stale revision atomically");
|
||||
// A linked folder with the native hidden flag owns no visible child input.
|
||||
put(49,1,0x10);
|
||||
auto hidden_return=return_request;
|
||||
hidden_return.layout_before[49*16+1]=hidden_return.layout_after[49*16+1]=0x10;
|
||||
const auto hidden_before=capture_slot();
|
||||
check(!session->dispatch_desktop_layout(hidden_return,revision,error) &&
|
||||
revision==return_revision && capture_slot()==hidden_before,
|
||||
"folder extraction rejects a hidden owner without modifying its chain");
|
||||
put(49,1,0);
|
||||
check(return_request.layout_operation==ui::DeskLayoutOperation::return_folder_child&&
|
||||
session->dispatch_desktop_layout(return_request,revision,error)&&error.empty()&&
|
||||
game.memory.u8(native_base+uint32_t(child_id)*16+5)==0&&game.memory.u8(native_base+uint32_t(child_id)*16+6)==49&&
|
||||
game.memory.u8(native_base+49*16+5)==child_id,
|
||||
"authenticated folder child return appends to the visible chain");
|
||||
check(session->game().seed()==before_return_rng.seed()&&session->game().calls()==before_return_rng.calls()&&
|
||||
session->rand().seed()==before_return_rand.seed()&&session->rand().calls()==before_return_rand.calls(),
|
||||
"folder child return consumes no RNG");
|
||||
const auto returned_desk=session->desktop_projection(revision);
|
||||
const auto returned_child=std::find_if(returned_desk.items.begin(),returned_desk.items.end(),
|
||||
[&](const ui::DeskItem& item){return item.id==child_id;});
|
||||
check(returned_child!=returned_desk.items.end(),"returned child is projected as a desk item");
|
||||
if(child_id==13) continue; // Source excludes the kickoff icon from bin-mode removal.
|
||||
const auto saved_child_x=game.memory.u16(native_base+uint32_t(child_id)*16);
|
||||
const auto saved_child_y=game.memory.u8(native_base+uint32_t(child_id)*16+2);
|
||||
auto bin_desk=returned_desk;bin_desk.shortcut_bar_always=true;
|
||||
DesktopScreen bin_screen(data,bin_desk);
|
||||
bin_screen.click(2,215); // Source local_50 bin mode toggle.
|
||||
const auto bin_request=bin_screen.click(returned_child->x+1,returned_child->y+1,true);
|
||||
const auto before_bin_rng=session->game();const auto before_bin_rand=session->rand();
|
||||
check(bin_request.layout_operation==ui::DeskLayoutOperation::send_to_folder&&
|
||||
session->dispatch_desktop_layout(bin_request,revision,error)&&error.empty()&&
|
||||
game.memory.u8(native_base+uint32_t(child_id)*16+5)==0xff&&game.memory.u8(native_base+uint32_t(child_id)*16+6)==0xff&&
|
||||
game.memory.u8(native_base+uint32_t(child_id)*16+13)==0,
|
||||
"bin mode moves the item into its original associated folder without clearing its coordinates");
|
||||
check(session->game().seed()==before_bin_rng.seed()&&session->game().calls()==before_bin_rng.calls()&&
|
||||
session->rand().seed()==before_bin_rand.seed()&&session->rand().calls()==before_bin_rand.calls(),
|
||||
"folder bin transfer consumes no RNG");
|
||||
auto binned_desk=session->desktop_projection(revision);binned_desk.shortcut_bar_always=true;
|
||||
DesktopScreen restore_screen(data,binned_desk);
|
||||
restore_screen.click(2,215);
|
||||
const int folder_x=std::find_if(binned_desk.items.begin(),binned_desk.items.end(),
|
||||
[](const ui::DeskItem& item){return item.id==49;})->x;
|
||||
const int folder_y=std::find_if(binned_desk.items.begin(),binned_desk.items.end(),
|
||||
[](const ui::DeskItem& item){return item.id==49;})->y;
|
||||
const auto restore_request=restore_screen.click(folder_x+10,folder_y+9,true);
|
||||
check(restore_request.layout_operation==ui::DeskLayoutOperation::restore_folder_child&&
|
||||
session->dispatch_desktop_layout(restore_request,revision,error)&&error.empty()&&
|
||||
game.memory.u8(native_base+uint32_t(child_id)*16+5)==0&&game.memory.u8(native_base+49*16+5)==3&&
|
||||
game.memory.u16(native_base+uint32_t(child_id)*16)==saved_child_x&&game.memory.u8(native_base+uint32_t(child_id)*16+2)==saved_child_y,
|
||||
"right-clicking a folder child in bin mode restores its saved original position");
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
try {
|
||||
if (argc != 2 && argc != 3 && argc != 4) throw std::runtime_error("app_controller_tests requires data directory [optional Original save]");
|
||||
const std::filesystem::path data = argv[1];
|
||||
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])=="--environment-only") {
|
||||
check_environment_controller(data);return 0;
|
||||
}
|
||||
@@ -7013,6 +7139,13 @@ int main(int argc, char** argv) {
|
||||
if(argc==3 && std::string_view(argv[2])=="--poach-only") {
|
||||
check_poach_ui_components(data);return 0;
|
||||
}
|
||||
if(argc==3 && std::string_view(argv[2])=="--advertising-input-only") {
|
||||
check_advertising_controller(data);
|
||||
check_advertising_renewal_controller(data);
|
||||
check_advertising_spending_controller(data);
|
||||
std::cout << "Advertising hover, modal return and controller actions passed.\n";
|
||||
return 0;
|
||||
}
|
||||
check_poach_ui_components(data);
|
||||
check_stadium_investment_controller(data);
|
||||
check_pairings_timer_controller(data);
|
||||
@@ -7023,6 +7156,7 @@ int main(int argc, char** argv) {
|
||||
check_readonly_views(data);
|
||||
check_desk_records_controller(data);
|
||||
check_menu_layout_session_io(data);
|
||||
check_date_widget_controller(data);
|
||||
check_calendar_readonly_controller(data);
|
||||
check_indoor_standings_controller(data);
|
||||
check_strengths_semantic_and_controller(data);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
int main() {
|
||||
using namespace bmh;
|
||||
@@ -19,6 +20,26 @@ int main() {
|
||||
source[0] = 'M'; source[1] = 'Z';
|
||||
const auto put = [&](uint32_t address, uint8_t value) { source.at(address + 0x496d) = value; };
|
||||
const auto check = [](bool value, const char* message) { if (!value) throw std::runtime_error(message); };
|
||||
const auto put_pointer = [&](uint32_t address, uint32_t value) {
|
||||
for (uint32_t i = 0; i < 4; ++i) put(address + i, uint8_t(value >> (i * 8)));
|
||||
};
|
||||
constexpr uint32_t english_overwrite_pointer = 0x6c43c;
|
||||
constexpr uint32_t authored_question_address = layout::EnDataStart + 0x100;
|
||||
const std::string authored_question = "Authored overwrite question?";
|
||||
put_pointer(english_overwrite_pointer, authored_question_address);
|
||||
for (uint32_t i = 0; i <= authored_question.size(); ++i)
|
||||
put(authored_question_address + i, i < authored_question.size() ? uint8_t(authored_question[i]) : 0);
|
||||
// Adjacent English pointers are intentionally distinct from the retained
|
||||
// empty German slots. An over-wide copy must not import either one.
|
||||
put_pointer(english_overwrite_pointer - 4, authored_question_address + 1);
|
||||
put_pointer(english_overwrite_pointer + 4, authored_question_address + 2);
|
||||
// The analytics label mapping intentionally replaces the final 72 bytes
|
||||
// of the old empty-pointer range. Give that independent source its own data.
|
||||
Bytes analytics_labels(72);
|
||||
for (uint32_t i = 0; i < analytics_labels.size(); ++i) {
|
||||
analytics_labels[i] = uint8_t(0x31 + i * 3);
|
||||
put(layout::EnglishLayoutTranslation50 + i, analytics_labels[i]);
|
||||
}
|
||||
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]);
|
||||
@@ -32,6 +53,19 @@ int main() {
|
||||
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);
|
||||
check(image.u32(layout::SaveLoad_OverwriteQuestionPointer) == authored_question_address,
|
||||
"overwrite question pointer must select the original English source slot");
|
||||
check(image.string_at_pointer(layout::SaveLoad_OverwriteQuestionPointer) == authored_question,
|
||||
"overwrite question must retain its complete source text");
|
||||
for (uint32_t address = layout::Bank_OriginalToUtf8_RuntimeField;
|
||||
address < layout::Analytics_FormatError_ExecutableField; address += 4) {
|
||||
if (address == layout::SaveLoad_OverwriteQuestionPointer) continue;
|
||||
check(image.u32(address) == layout::EmptyString,
|
||||
"mapping the overwrite question must preserve all seventeen other empty pointers before analytics");
|
||||
}
|
||||
for (uint32_t i = 0; i < analytics_labels.size(); ++i)
|
||||
check(image.u8(layout::Analytics_FormatError_ExecutableField + i) == analytics_labels[i],
|
||||
"mapping the overwrite question must preserve the complete independent analytics mapping");
|
||||
for (uint32_t i = 0; i < 6; ++i)
|
||||
check(image.u8(layout::Setup_FormatError_RuntimeField8 + i) == toggle_rows[i], "toggle mapping includes alignment padding");
|
||||
check(image.u8(layout::Desktop_Copy_TextPointer) == 0xfb, "negative balance colour");
|
||||
@@ -42,7 +76,7 @@ int main() {
|
||||
check(image.u8(layout::Desktop_Render_RuntimeField3 + i) == 30 + i, "socket source x");
|
||||
}
|
||||
std::filesystem::remove_all(root);
|
||||
std::cout << "FLTD setup, colour and desktop-control mappings passed\n";
|
||||
std::cout << "FLTD setup, colour, desktop-control and overwrite-question mappings passed\n";
|
||||
return 0;
|
||||
} catch (const std::exception& error) {
|
||||
if (!root.empty()) { std::error_code ec; std::filesystem::remove_all(root, ec); }
|
||||
|
||||
@@ -139,9 +139,10 @@ void assert_key_source_cell(const StadiumScreen& screen, const std::filesystem::
|
||||
|
||||
constexpr std::array<uint32_t, 8> kPrices{300000, 375000, 300000, 350000,
|
||||
300000, 375000, 300000, 350000};
|
||||
constexpr std::array<uint32_t, 8> kMaxima{8000, 18000, 8000, 14000,
|
||||
8000, 18000, 8000, 14000};
|
||||
constexpr std::array<uint8_t, 8> kWeeks{30, 37, 30, 25, 30, 37, 30, 25};
|
||||
// Match the retained 144k expansion policy and size-aware construction periods.
|
||||
constexpr std::array<uint32_t, 8> kMaxima{14000, 24000, 14000, 20000,
|
||||
14000, 24000, 14000, 20000};
|
||||
constexpr std::array<uint8_t, 8> kWeeks{30, 48, 30, 40, 30, 48, 30, 40};
|
||||
|
||||
StadiumBlockExpansionEditor editor_for(uint8_t slot = 1, uint32_t total = 8000,
|
||||
uint8_t features = 0, uint8_t raw_flags = 0) {
|
||||
@@ -418,7 +419,7 @@ void source_textd_stadium_caption_tests(const std::filesystem::path& data) {
|
||||
assert_text_pixels(editor_image, font, 5, 130, text(::bmh::layout::Stadium_RenderBlockExpansion_TextPointer9), 0x6a,
|
||||
"block editor paints the Original TEXTD total-cost label");
|
||||
|
||||
const std::string duration = format_number(GameState{}, 37, 0x82) + text(::bmh::layout::Stadium_FormatError_RuntimeField) +
|
||||
const std::string duration = format_number(GameState{}, 48, 0x82) + text(::bmh::layout::Stadium_FormatError_RuntimeField) +
|
||||
exe.cstring(::bmh::layout::Stadium_FormatError_ExecutableField) + exe.cstring(::bmh::layout::CareerSession_FormatNumber_ExecutableField);
|
||||
const int duration_x = 148 - font.text_width(duration);
|
||||
assert_text_pixels(editor_image, font, duration_x, 54, duration, 0x6c,
|
||||
@@ -432,7 +433,7 @@ void source_textd_stadium_caption_tests(const std::filesystem::path& data) {
|
||||
assert_text_pixels(current_image, font, 221, 29, "Block A", 0x6b,
|
||||
"A-H overview uses its Source TEXTD block prefix");
|
||||
assert_text_pixels(current_image, font, 221, 22 + 21, text(::bmh::layout::Stadium_Out_TextPointer5) +
|
||||
format_number(GameState{}, int32_t(exe.u8(::bmh::layout::CareerSession_Invalid_RuntimeField) * 1000), 5) +
|
||||
format_number(GameState{}, int32_t(kMaxima[0]), 5) +
|
||||
exe.cstring(::bmh::layout::Stadium_Out_ExecutableField), 0x51,
|
||||
"current overview uses the Original TEXTD maximum-capacity label");
|
||||
|
||||
@@ -689,7 +690,7 @@ void calculator_tests(const std::filesystem::path& data) {
|
||||
check(screen.calculator_open(), "host can query calculator visibility without reading or mutating Native");
|
||||
assert_readout_source_text(screen, data, format_number(GameState{}, 0, 7),
|
||||
"initial calculator readout matches Original width-seven FNT3 glyphs");
|
||||
assert_preset_source_cell(screen, data, exe, 7, 18000);
|
||||
assert_preset_source_cell(screen, data, exe, 7, 24000);
|
||||
const Image before = screen.render();
|
||||
check(screen.pointer_down(116, 36), "the calculator header starts a Source drag");
|
||||
screen.pointer_move(1000, 1000);
|
||||
@@ -759,7 +760,7 @@ void calculator_tests(const std::filesystem::path& data) {
|
||||
"preset selection changes the value without the keypad's invented pressed phase");
|
||||
const auto preset_accept = keyboard_return_after_source_phase(preset);
|
||||
check(preset_accept.kind == StadiumRequestKind::expansion_set_total &&
|
||||
preset_accept.block_total_places == 18000,
|
||||
preset_accept.block_total_places == 24000,
|
||||
"a preset value remains usable through the timed Source J action");
|
||||
|
||||
StadiumScreen low_total(data, detail_state());
|
||||
@@ -774,7 +775,7 @@ void calculator_tests(const std::filesystem::path& data) {
|
||||
high_total.click(50, 80);
|
||||
check(high_total.text("999999"), "large typed input is accepted and clamped to Source maximum");
|
||||
const auto maximum = keyboard_return_after_source_phase(high_total);
|
||||
check(maximum.kind == StadiumRequestKind::expansion_set_total && maximum.block_total_places == 18000,
|
||||
check(maximum.kind == StadiumRequestKind::expansion_set_total && maximum.block_total_places == 24000,
|
||||
"calculator input never exceeds the slot-B maximum");
|
||||
|
||||
StadiumScreen reopened(data, detail_state(1, 15333, 1));
|
||||
@@ -782,7 +783,7 @@ void calculator_tests(const std::filesystem::path& data) {
|
||||
check(reopened.text("1"), "reopened calculator accepts another appended digit");
|
||||
const auto appended = keyboard_return_after_source_phase(reopened);
|
||||
check(appended.kind == StadiumRequestKind::expansion_set_total &&
|
||||
appended.block_total_places == 18000,
|
||||
appended.block_total_places == 24000,
|
||||
"reopening starts from D=7333 and appends instead of replacing it with the first digit");
|
||||
|
||||
StadiumScreen zeroes(data, detail_state());
|
||||
@@ -903,12 +904,12 @@ void offer_ack_tests(const std::filesystem::path& data) {
|
||||
auto no_build = no_screen.state(); next_identity(no_build);
|
||||
const auto no_quote = no_build.block_expansion->quote;
|
||||
no_build.block_expansion.reset(); no_build.construction_tip_dialog.reset();
|
||||
no_build.blocks[1].construction_weeks = 37;
|
||||
no_build.blocks[1].construction_weeks = 48;
|
||||
no_build.blocks[1].flags = uint8_t(no_build.blocks[1].flags | 0x10);
|
||||
no_build.blocks[1].capacity = 15;
|
||||
no_build.balance -= int32_t(no_quote.base_price);
|
||||
no_screen.acknowledge(no_build);
|
||||
check(!no_screen.pending() && no_screen.state().blocks[1].construction_weeks == 37,
|
||||
check(!no_screen.pending() && no_screen.state().blocks[1].construction_weeks == 48,
|
||||
"a valid NO decision constructs at the original base price and full duration");
|
||||
|
||||
auto poor = initial;
|
||||
@@ -1034,7 +1035,7 @@ void source_compensation_ack_tests(const std::filesystem::path& data) {
|
||||
"negative-week compensation path can take the ordinary NO construction");
|
||||
const auto no_offer = *negative_weeks.state().block_expansion->offer;
|
||||
const int32_t negative_compensation = -66000; // 11,000 * (17-20) * rate 2.
|
||||
negative_weeks.acknowledge(completed_build_state(negative_weeks, 37,
|
||||
negative_weeks.acknowledge(completed_build_state(negative_weeks, 48,
|
||||
late.balance - int32_t(no_offer.base_price) - negative_compensation, 14000));
|
||||
check(negative_weeks.state().balance == late.balance - int32_t(no_offer.base_price) + 66000,
|
||||
"negative Source weeks credit the account while the ticket cap still applies");
|
||||
@@ -1046,7 +1047,7 @@ void source_compensation_ack_tests(const std::filesystem::path& data) {
|
||||
check(!no_account_booking.click(210, 171).accept_tip,
|
||||
"level-zero Source path can accept a normal NO construction");
|
||||
const auto level_zero_offer = *no_account_booking.state().block_expansion->offer;
|
||||
no_account_booking.acknowledge(completed_build_state(no_account_booking, 37,
|
||||
no_account_booking.acknowledge(completed_build_state(no_account_booking, 48,
|
||||
level_zero.balance, 14000));
|
||||
check(no_account_booking.state().balance == level_zero.balance &&
|
||||
no_account_booking.state().season_tickets == 14000 &&
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#include "app/start_screen.hpp"
|
||||
#include <SDL.h>
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
namespace {
|
||||
void check(bool value,const char* message){if(!value)throw std::runtime_error(message);}
|
||||
void frame(int width,int height,const std::filesystem::path& output) {
|
||||
const std::unique_ptr<SDL_Surface,decltype(&SDL_FreeSurface)> surface(
|
||||
SDL_CreateRGBSurfaceWithFormat(0,width,height,32,SDL_PIXELFORMAT_RGBA32),SDL_FreeSurface);
|
||||
check(bool(surface),SDL_GetError());
|
||||
const std::unique_ptr<SDL_Renderer,decltype(&SDL_DestroyRenderer)> renderer(SDL_CreateSoftwareRenderer(surface.get()),SDL_DestroyRenderer);
|
||||
check(bool(renderer),SDL_GetError());SDL_RenderSetLogicalSize(renderer.get(),320,240);SDL_SetRenderDrawColor(renderer.get(),12,34,56,255);
|
||||
{
|
||||
bmh::app::StartScreen title(renderer.get());
|
||||
check(title.width()==1448&&title.height()==1086,"start artwork was reduced to the game canvas");title.present();
|
||||
int logical_width=0,logical_height=0;SDL_RenderGetLogicalSize(renderer.get(),&logical_width,&logical_height);
|
||||
check(logical_width==1448&&logical_height==1086,"start screen uses the low-resolution logical size");
|
||||
float sx=0,sy=0;SDL_RenderGetScale(renderer.get(),&sx,&sy);
|
||||
check(sx>0&&sy>0&&std::abs(sx-sy)<0.001f,"start artwork aspect ratio was stretched");
|
||||
std::vector<unsigned char> pixels(size_t(width)*height*4);
|
||||
check(SDL_LockSurface(surface.get())==0,SDL_GetError());
|
||||
for(int y=0;y<height;++y)std::memcpy(pixels.data()+size_t(y)*width*4,
|
||||
static_cast<const unsigned char*>(surface->pixels)+size_t(y)*surface->pitch,size_t(width)*4);
|
||||
SDL_UnlockSurface(surface.get());
|
||||
const auto center=(size_t(height/2)*width+width/2)*4;
|
||||
check(pixels[center]+pixels[center+1]+pixels[center+2]>20,"embedded start artwork was not painted");
|
||||
if(width*3>height*4){const auto side=size_t(height/2)*width*4;check(pixels[side]==0&&pixels[side+1]==0&&pixels[side+2]==0,"wide display has no clean side bars");}
|
||||
Uint8 r=0,g=0,b=0,a=0;SDL_GetRenderDrawColor(renderer.get(),&r,&g,&b,&a);
|
||||
check(r==12&&g==34&&b==56&&a==255,"start screen leaked its draw color into the game");
|
||||
if(!output.empty()) {
|
||||
std::filesystem::create_directories(output);std::ofstream file(output/(std::to_string(width)+"x"+std::to_string(height)+".ppm"),std::ios::binary);
|
||||
file<<"P6\n"<<width<<' '<<height<<"\n255\n";for(size_t i=0;i<pixels.size();i+=4)file.write(reinterpret_cast<const char*>(pixels.data()+i),3);
|
||||
}
|
||||
title.present(); // Expose/resize redraw retains the same decoded texture.
|
||||
}
|
||||
int w=0,h=0;SDL_RenderGetLogicalSize(renderer.get(),&w,&h);
|
||||
check(w==320&&h==240,"start screen did not restore the game and input coordinate system");
|
||||
}
|
||||
}
|
||||
int main(int argc,char** argv)try {
|
||||
SDL_setenv("SDL_VIDEODRIVER","dummy",0);check(SDL_Init(SDL_INIT_VIDEO)==0,SDL_GetError());
|
||||
const std::filesystem::path output=argc>1?argv[1]:"";
|
||||
for(const auto size:std::array<std::array<int,2>,4>{{{1448,1086},{1920,1080},{3840,2160},{3440,1440}}})frame(size[0],size[1],output);
|
||||
SDL_Quit();std::cout<<"Embedded native artwork, 1080p/4K/ultrawide aspect fit, redraw and game/input restoration passed\n";
|
||||
}catch(const std::exception& error){std::cerr<<error.what()<<'\n';SDL_Quit();return 1;}
|
||||
@@ -14,7 +14,7 @@ def validate(directory, windows):
|
||||
documents = {'README.md', 'LICENSE', 'THIRD_PARTY_NOTICES.md', 'ACKNOWLEDGEMENTS.md', 'CONTRIBUTING.md'}
|
||||
licenses = {'README.md', 'LGPL-2.1.txt', 'Nuked-OPL3-notices.txt', 'LZMA-SDK.txt', 'SDL2-HIDAPI-BSD.txt',
|
||||
'SDL2-HIDAPI-options.txt', 'SDL2-HIDAPI-original.txt', 'SDL2-yuv2rgb.txt',
|
||||
'SDL2.txt', 'miniz-source-notices.txt', 'miniz.txt', 'nativefiledialog-extended.txt'}
|
||||
'SDL2.txt', 'miniz-source-notices.txt', 'miniz.txt', 'nativefiledialog-extended.txt', 'stb_image.txt'}
|
||||
present = set()
|
||||
for file in directory.rglob('*'):
|
||||
if not file.is_file():
|
||||
|
||||
@@ -8,6 +8,7 @@ from __future__ import annotations
|
||||
import argparse
|
||||
import dataclasses
|
||||
import json
|
||||
import hashlib
|
||||
from pathlib import Path, PurePosixPath
|
||||
import re
|
||||
import shutil
|
||||
@@ -28,6 +29,10 @@ ASSET_SUFFIXES = {
|
||||
".avi", ".mov", ".mp4", ".png", ".jpg", ".jpeg", ".bmp", ".gif",
|
||||
".bin", ".zip", ".7z", ".dmg", ".tar", ".gz", ".pdf",
|
||||
}
|
||||
# Newly supplied project artwork and an unchanged MIT/public-domain decoder.
|
||||
# Exact hashes keep this exception from admitting original-game asset dumps.
|
||||
REVIEWED_BINARY_FILES = {"assets/start-screen.jpg": "28df5a72cd7b6951c9eebf30532ea9557007a46f0a73614ba22401c403e379dc"}
|
||||
REVIEWED_UPSTREAM_FILES = {"src/app/third_party/stb_image.h": "594c2fe35d49488b4382dbfaec8f98366defca819d916ac95becf3e75f4200b3"}
|
||||
PRIVATE_PREFIXES = (
|
||||
("data", "original"), ("docs", "manuals"), ("docs", "analyses"),
|
||||
("docs", "agents"), ("src", "ui", "validation"),
|
||||
@@ -166,6 +171,11 @@ def path_findings(name: str) -> list[Finding]:
|
||||
|
||||
|
||||
def scan_blob(name: str, blob: bytes) -> list[Finding]:
|
||||
reviewed = REVIEWED_BINARY_FILES | REVIEWED_UPSTREAM_FILES
|
||||
if name in reviewed:
|
||||
if hashlib.sha256(blob).hexdigest() == reviewed[name]:
|
||||
return []
|
||||
return [Finding(name, 0, "modified-reviewed-project-file")]
|
||||
result = path_findings(name)
|
||||
if len(blob) > 2_000_000:
|
||||
result.append(Finding(name, 0, "oversized-source-file"))
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import contextlib
|
||||
import io
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
@@ -17,6 +18,16 @@ import check_public_tree as guard
|
||||
|
||||
|
||||
class BlobChecks(unittest.TestCase):
|
||||
def test_only_exact_reviewed_artwork_and_decoder_are_admitted(self):
|
||||
for name, table in (("assets/start-screen.jpg",guard.REVIEWED_BINARY_FILES),
|
||||
("src/app/third_party/stb_image.h",guard.REVIEWED_UPSTREAM_FILES)):
|
||||
content=b"synthetic reviewed input\0"
|
||||
with mock.patch.dict(table,{name:hashlib.sha256(content).hexdigest()}):
|
||||
self.assertEqual(guard.scan_blob(name,content),[])
|
||||
self.assertEqual({finding.rule for finding in guard.scan_blob(name,content+b"changed")},
|
||||
{"modified-reviewed-project-file"})
|
||||
self.assertIn("binary-or-game-asset",{finding.rule for finding in guard.scan_blob("assets/other.jpg",b"synthetic\0")})
|
||||
|
||||
def rules(self, name, text):
|
||||
return {finding.rule for finding in guard.scan_blob(name, text.encode())}
|
||||
|
||||
|
||||
Reference in new issue
Block a user