Prelaunch UI Fixes. Create Prelaunch after mod init.

This commit is contained in:
jdflyer
2026-08-18 21:04:41 -07:00
parent c0d44d4a21
commit edfb93440c
4 changed files with 117 additions and 65 deletions
+30
View File
@@ -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;
}
+1
View File
@@ -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;
+1
View File
@@ -61,6 +61,7 @@ CrashReportWindow::CrashReportWindow() : WindowSmall("modal", "modal-dialog") {
if (cmd == NavCommand::Confirm) {
apply();
hide(true);
mDoAud_seStartMenu(kSoundClick);
return true;
}
return false;
+85 -65
View File
@@ -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<dusk::mods::ModSearchDir> 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<dusk::ui::Prelaunch>(), true);
if (!showPrelaunchAfterInit) {
dusk::ui::push_document(std::make_unique<dusk::ui::Prelaunch>(), 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<dusk::ui::CrashReportWindow>());
}
#endif
if (!dusk::getSettings().backend.wasPresetChosen) {
dusk::ui::push_document(std::make_unique<dusk::ui::PresetWindow>());
}
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<dusk::mods::ModSearchDir> modDirs;
if (parsed_arg_options.contains("mods") &&
!parsed_arg_options["mods"].as<std::string>().empty())
{
modDirs.push_back({.path = parsed_arg_options["mods"].as<std::string>()});
} 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<std::string>().empty())
{
mods_init(parsed_arg_options["mods"].as<std::string>());
} else {
mods_init(dusk::ConfigPath / "mods");
}
if (!skipPreLaunchUI && showPrelaunchAfterInit) {
dusk::ui::push_document(std::make_unique<dusk::ui::Prelaunch>(), 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<dusk::ui::CrashReportWindow>());
}
#endif
if (!dusk::getSettings().backend.wasPresetChosen) {
dusk::ui::push_document(std::make_unique<dusk::ui::PresetWindow>());
}
OSReport("Starting main01 (Game Loop)...\n");
main01();