[pr-feature][startup] Launcher window before the game, with F1's settings page #302
Loading…
Reference in a new issue
No description provided.
Delete branch "starrockanonigtavi/Darner:launcher"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Contributor role (optional)
What it changes
darner playgoes straight from the console to the game. The settings can only be changed in game (F1) or indarner-settings.txt, and most changes then need a restart of the game.darner playnow shows a window before the settings become switches (crates/darner-gpu/src/host/launcher.rs, called fromplay::prepare):menu.rs'srender_hits,hit_test,handle_hover,handle_left_click,scroll), with mouse, keyboard and pads. It has a back arrow (a Save / Don't Save question when something changed) and an X;darner playruns its existing preload window (preload_ui);https://git.gtahub.st/api/v1/repos/TrustNo1/Darner/releases/latestwith curl.exe (5 s limit), only when clicked. It shares the code of the start's own update check;DARNER_MENU_LAUNCHER=0todarner-settings.txt. The same row is in F1 (TOOLS > LAUNCHER AT START), anddarner play --launchershows the window anyway;launcher-banner.*in%LOCALAPPDATA%\darnerorDARNER_HOME) and decoded with WIC. Edit image moves it (drag) and zooms it (wheel), and the framing is kept beside it.docs/darner-logo.png, the owner's picture already listed indocs/asset-policy.md, built in withinclude_bytes!and drawn with its transparency), with the build's version left of it. The PLAY letters are outline polygons (launcher_shapes.rs).Nothing restarts in the launcher: the game has not started yet. F1's page in the window says so:
launcher.menu.*keys, each replacing themenu.*key of the same name while the window is open (said_whereinmenu.rs). A catalog that translates the menu line but not the launcher's shows the menu line in its own language, not English in the middle of it.launcher.menu.*keys. A test checks that each one replaces an existing menu key.play::clear_shaders_in, throughLauncherSetup::clear_shaders) and stays.i18n::select), for the window and for the game started from it in the same process. Going back without saving puts the saved language back.DARNER_MENU_*row and every row the file already holds, changed or not (Menu::pinned). So what the window showed is what starts, and later defaults (auto-detect, a newer build's play defaults) do not override it.The console window (new F1 row TOOLS > CONSOLE WINDOW,
DARNER_SHOW_CONSOLE):restore_console).DARNER_OWN_CONSOLE=1lets a batch file say its console is only for this start. The README row says to end such a file without a plainpause, or the hidden window waits.conhost.exe, hidden. Its Read-Host after a failed start shows, because the failing start restores the window.Pads in the window: XInput, and PlayStation pads over HID (
gameinput::launcher_pad_buttons, from the same reader the game uses) unless F1's DUALSENSE is off.Mouse picking in a long list: F1's lists centre on the row picked, so in the window, as in game, the list moves under the mouse. #297 fixes that for every F1 list; the window draws F1's page, so it gets the fix with it. It is not in this PR.
How it fits the code:
Then::switchnow setsDARNER_MENU_RESTARTED=1), on F1's preload or clear-cache restarts, with--preload, or when standard input is not a terminal (an unattended run such asscripts/bench.ps1;--launcherstill shows it).LauncherChoice(Play, Quit, Preload). Quit returnsNonefromprepare, and nothing starts.play::settingsover the file, read again after RESET ALL), not from this process's environment. It saves to the same file withmerged_settings.apply_livedoes nothing there.Menu::frame's per-key body moved unchanged intoMenu::press, so the game and the launcher use the same key handling. Most ofmenu.rs's diff is that move (reindented).SetThreadDpiAwarenessContext), so the process-wide call indarner-hle'slifecycle.rsstill decides the game window's awareness.windowsfeatures in darner-gpu:Win32_Graphics_Imaging,Win32_System_Com,Win32_UI_Controls_Dialogs. New windows-sys feature:Win32_UI_Input_XboxController.Cargo.lockis unchanged.locales/en.jsononly. Other catalogs fall back as described above. The Spanish lines are ready for #196 once both are in.Ported from the launcher I wrote for the VIctory fork (
victory launcher, a separate process started byplay-nvidia.ps1), with that fork's later fixes: no restart wording, the launcher's values win, the console hidden with a menu row, PlayStation pads, CLEAR staying in the window. It is redrawn withfont.rs's canvas and the F1 theme (PINK to CYAN).How it was tested
2ebf9b3(branchlauncher, based on mainf3840d7) for the commands below;e7f4787in game.e7f4787merged with #196's branch plus Spanish lines for the new keys (a local test branch, not part of this PR), so the window was seen in Spanish. That build still had the mouse fix now left to #297.3e93749(the launcher skipped when standard input is not a terminal, from review): clippy fordarnerclean,playtests 61 passed.0eba370(Darner's logo in place of "PC"): clippy fordarner-gpuclean,launchertests 7 passed, the preview drawn and looked at.e7f4787and on2ebf9b3where a count is given for it):cargo clippy --locked -p darner-core -p darner-gpu -p darner-hle -p darner --all-targets -- -D warnings: clean.cargo test --locked -p darner-gpu --lib host::menu: 57 passed, 0 failed, 2 ignored on2ebf9b3(59 one7f4787, with the mouse fix). This includes the new test that eachlauncher.menu.*key replaces a menu key.cargo test --locked -p darner-gpu --lib launcher: 7 passed, 0 failed (after the splash was removed with its test). They cover framing read back and clamping, the show box writing only its row, actions ending the window, and changes held until a save.cargo test --locked -p darner-gpu --lib host::: 468 passed, 0 failed, 35 ignored. In two earlier runs, onerefresh_teststest failed each time (chunked_nothing_new_with_matches_individual, thenrefresh_front_zero_arc_matches_and_runs_due). Each passed when run alone and again in the full run; neither touches this change. #224 is about these tests sharing state.cargo test --locked -p darner --bin darner play: 61 passed, 0 failed.cargo test --locked -p darner-core: 31 passed, 0 failed.cargo build --release --locked -p darner: built (5 min 04 s), with onelinker_messageswarning that main's build gives too.DARNER_LAUNCHER_PREVIEW=<path> cargo test -p darner-gpu --lib launcher::tests::preview: the first page, the settings page and the question were drawn to BMP and looked at.darner playnow shows a window first, so starting the game takes one extra click (or Enter) until "Show at start" is unticked.darner playfrom a batch file withDARNER_OWN_CONSOLE=1, on Windows 11. Overall, everything worked: the launcher, its settings page and the game start from it, plus the points fixed in the last round (no restart wording in Spanish, the console hidden, and the list still under the mouse, a fix now left to #297). These were not each checked and written down one by one.console_windowhides Terminal's window then; not tried).Checklist
main.docs/asset-policy.md.Checked for overlap
menu.rs, so one may need a small rebase after the other.check_for_updateafter the settings file is read. This PR splits its request intolatest_release, so the two will conflict inplay.rs.play.rs; this PR addsrestore_console()before each question.gameinput's PlayStation code; this PR addslauncher_pad_buttonsthere.launcher.*keys are English only here.menu.rs.rename-build-darnertouchesplay.rs/main.rsand may conflict.🤖 Generated with Claude Code
scripts/bench.ps1runsdarner playwith standard input redirected. With the launcher preference unset, the current gate requests a window in that unattended run.The follow-up commit requires terminal input for the automatic launcher.
--launcherstill explicitly opens it with redirected input. In the Windows fixture, the default redirected invocation changed from opening the launcher to skipping it, while explicit--launcher,--preload, and the saved opt-out retained their behavior. The focused CLI check and asset policy passed.If you cherry-pick or rebase the contribution, please keep the Git author. If you fold it into your own commit, please add this trailer.
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>Thanks, good catch. Your commit
3e93749is now on the branch as is (fast-forward, your authorship kept). On it:cargo clippy --locked -p darner --all-targets -- -D warningsclean,cargo test --locked -p darner --bin darner play61 passed, 0 failed. Not run in game: a double-clicked darner.exe or a batch file still has a terminal for input, so the launcher shows there as before.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.