From edfb93440c55ebc7c8a90592858da891e89812b2 Mon Sep 17 00:00:00 2001 From: jdflyer Date: Tue, 18 Aug 2026 21:04:41 -0700 Subject: [PATCH] Prelaunch UI Fixes. Create Prelaunch after mod init. --- res/rml/prelaunch.rcss | 30 ++++++++ src/dusk/ui/preset.cpp | 1 + src/dusk/ui/reporting.cpp | 1 + src/m_Do/m_Do_main.cpp | 150 +++++++++++++++++++++----------------- 4 files changed, 117 insertions(+), 65 deletions(-) diff --git a/res/rml/prelaunch.rcss b/res/rml/prelaunch.rcss index 054b6e0183..206d118976 100644 --- a/res/rml/prelaunch.rcss +++ b/res/rml/prelaunch.rcss @@ -366,6 +366,34 @@ body.animate-in .intro-item { transition: opacity transform 0.3s 0.7s cubic-in-out; } +/* Locks the menu element to not go below the disc status element */ +@media (max-height: 900dp) { + menu { + top: auto; + bottom: 150dp; + transform: none; + gap: 24dp; + } + + hero { + gap: 2dp; + max-height: 220dp; + } + + hero img { + width: 80%; + max-height: 180dp; + } +} + +@media (max-height: 750dp) { + #menu-list button { + font-size: 26dp; + height: 45dp; + text-align: right; + } +} + /* Mobile layout */ @media (max-height: 640dp) { .gradient { @@ -419,6 +447,8 @@ body.animate-in .intro-item { #menu-list button { width: 100%; max-width: 100%; + font-size: 23dp; + height: 40dp; text-align: right; } diff --git a/src/dusk/ui/preset.cpp b/src/dusk/ui/preset.cpp index 7fc7d956b4..cfcc692d1c 100644 --- a/src/dusk/ui/preset.cpp +++ b/src/dusk/ui/preset.cpp @@ -108,6 +108,7 @@ PresetWindow::PresetWindow() : WindowSmall("modal", "modal-dialog") { getSettings().backend.wasPresetChosen.setValue(true); config::save(); hide(true); + mDoAud_seStartMenu(kSoundClick); return true; } return false; diff --git a/src/dusk/ui/reporting.cpp b/src/dusk/ui/reporting.cpp index 05a531e8e5..a38914608b 100644 --- a/src/dusk/ui/reporting.cpp +++ b/src/dusk/ui/reporting.cpp @@ -61,6 +61,7 @@ CrashReportWindow::CrashReportWindow() : WindowSmall("modal", "modal-dialog") { if (cmd == NavCommand::Confirm) { apply(); hide(true); + mDoAud_seStartMenu(kSoundClick); return true; } return false; diff --git a/src/m_Do/m_Do_main.cpp b/src/m_Do/m_Do_main.cpp index 3a1168c866..d295f73ebd 100644 --- a/src/m_Do/m_Do_main.cpp +++ b/src/m_Do/m_Do_main.cpp @@ -502,6 +502,56 @@ static void log_build_info() { DuskLog.info("Platform: {}", BOREALIS_PLATFORM_NAME); } +static void mods_init(const std::string& mods_dir) { + // Mod search directories, highest priority first: user dir (--mods replaces it), then + // mods/ next to the app, then install-bundled mods inside the app bundle. + { + std::vector modDirs; + modDirs.push_back({.path = mods_dir}); +#if TARGET_ANDROID + // APK-bundled mods are extracted to internal storage + // by DuskActivity before SDL_main runs. + modDirs.push_back({ + .path = dusk::CachePath / "bundled_mods", + }); +#elif defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV) + modDirs.push_back({ + .path = dusk::data::base_path_relative("mods"), + .inPlaceNative = true, + .nativeLibDir = dusk::data::base_path_relative("Frameworks"), + }); +#else +#if defined(__APPLE__) + // Base path is Contents/Resources; search up for dev mods + // TODO: scope to non-CI builds + modDirs.push_back({ + .path = dusk::data::base_path_relative("../../../mods").lexically_normal(), + .inPlaceNative = true, + }); + // Contents/Resources/mods + modDirs.push_back({ + .path = dusk::data::base_path_relative("mods"), + .inPlaceNative = true, + }); +#else + modDirs.push_back({ + .path = dusk::data::base_path_relative("mods"), + .inPlaceNative = true, + }); +#endif +#endif + dusk::mods::ModLoader::instance().set_search_dirs(std::move(modDirs)); + } +#if TARGET_ANDROID + // A user-relocated data dir can live on external storage, which is mounted noexec. + // Native mod libraries must be extracted to internal storage. + dusk::mods::ModLoader::instance().set_cache_dir(dusk::CachePath / "mod_cache"); +#endif + + DuskLog.info("Initializing mods..."); + dusk::mods::ModLoader::instance().init(); +} + // ========================================================================= // PC ENTRY POINT // ========================================================================= @@ -791,6 +841,16 @@ int game_main(int argc, char* argv[]) { dusk::getSettings().backend.isoPath.getValue(), dusk::getSettings().backend.isoVerification.getValue()); + bool showPrelaunchAfterInit = true; + if (!dvd_opened && (dusk::getSettings().backend.isoPath.getValue().empty() || (forcePreLaunchUI && skipPreLaunchUI))) { + showPrelaunchAfterInit = false; + } + + if (showPrelaunchAfterInit) { + // Force launchUILoop to not run, we know that the ISO will be loaded. + dusk::IsGameLaunched = true; + } + if (!dvd_opened) { if (dusk::getSettings().backend.isoPath.getValue().empty()) { forcePreLaunchUI = true; @@ -805,7 +865,9 @@ int game_main(int argc, char* argv[]) { } if (!skipPreLaunchUI) { - dusk::ui::push_document(std::make_unique(), true); + if (!showPrelaunchAfterInit) { + dusk::ui::push_document(std::make_unique(), true); + } // pre game launch ui main loop if (!launchUILoop()) { @@ -839,16 +901,6 @@ int game_main(int argc, char* argv[]) { dusk::IsGameLaunched = true; } -#if BOREALIS_HAS_SENTRY - if (borealis::sentry::get_consent() == borealis::sentry::Consent::Unknown) { - dusk::ui::push_document(std::make_unique()); - } -#endif - - if (!dusk::getSettings().backend.wasPresetChosen) { - dusk::ui::push_document(std::make_unique()); - } - dusk::version::init(); LanguageInit(); @@ -867,66 +919,24 @@ int game_main(int argc, char* argv[]) { mDoDvdThd::SyncWidthSound = false; - // Mod search directories, highest priority first: user dir (--mods replaces it), then - // mods/ next to the app, then install-bundled mods inside the app bundle. - { - std::vector modDirs; - if (parsed_arg_options.contains("mods") && - !parsed_arg_options["mods"].as().empty()) - { - modDirs.push_back({.path = parsed_arg_options["mods"].as()}); - } else { - modDirs.push_back({.path = dusk::ConfigPath / "mods"}); - } -#if TARGET_ANDROID - // APK-bundled mods are extracted to internal storage - // by DuskActivity before SDL_main runs. - modDirs.push_back({ - .path = dusk::CachePath / "bundled_mods", - }); -#elif defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV) - modDirs.push_back({ - .path = dusk::data::base_path_relative("mods"), - .inPlaceNative = true, - .nativeLibDir = dusk::data::base_path_relative("Frameworks"), - }); -#else -#if defined(__APPLE__) - // Base path is Contents/Resources; search up for dev mods - // TODO: scope to non-CI builds - modDirs.push_back({ - .path = dusk::data::base_path_relative("../../../mods").lexically_normal(), - .inPlaceNative = true, - }); - // Contents/Resources/mods - modDirs.push_back({ - .path = dusk::data::base_path_relative("mods"), - .inPlaceNative = true, - }); -#else - modDirs.push_back({ - .path = dusk::data::base_path_relative("mods"), - .inPlaceNative = true, - }); -#endif -#endif - dusk::mods::ModLoader::instance().set_search_dirs(std::move(modDirs)); - } -#if TARGET_ANDROID - // A user-relocated data dir can live on external storage, which is mounted noexec. - // Native mod libraries must be extracted to internal storage. - dusk::mods::ModLoader::instance().set_cache_dir(dusk::CachePath / "mod_cache"); -#endif - - DuskLog.info("Initializing mods..."); - dusk::mods::ModLoader::instance().init(); - // Apply after aurora_initialize: speedrun mode mutates cvars whose change callbacks push // values into aurora. if (dusk::getSettings().game.speedrunMode) { dusk::speedrun::registerSpeedrunGamemode(); } + if (parsed_arg_options.contains("mods") && + !parsed_arg_options["mods"].as().empty()) + { + mods_init(parsed_arg_options["mods"].as()); + } else { + mods_init(dusk::ConfigPath / "mods"); + } + + if (!skipPreLaunchUI && showPrelaunchAfterInit) { + dusk::ui::push_document(std::make_unique(), true); + } + if (skipPreLaunchUI == true) { if (dusk::gamemode::getGamemodeManager().getRegisteredGamemodes().size() > 1 && dusk::getSettings().backend.skipPreLaunchUI.getValue()) { // Force pre-launch if we have registered gamemodes that we need to choose from @@ -937,6 +947,16 @@ int game_main(int argc, char* argv[]) { } } +#if BOREALIS_HAS_SENTRY + if (borealis::sentry::get_consent() == borealis::sentry::Consent::Unknown) { + dusk::ui::push_document(std::make_unique()); + } +#endif + + if (!dusk::getSettings().backend.wasPresetChosen) { + dusk::ui::push_document(std::make_unique()); + } + OSReport("Starting main01 (Game Loop)...\n"); main01();