NSO load NPDM and retrofit to use -ulaunch

This commit is contained in:
lizzie 2026-05-20 02:10:43 +00:00
parent 610c757592
commit 2f90bd6de8
4 changed files with 73 additions and 22 deletions

View file

@ -515,6 +515,7 @@ MainWindow::MainWindow(bool has_broken_vulkan)
QString game_path;
bool should_launch_qlaunch = false;
bool should_launch_hlaunch = false;
bool should_launch_ulaunch = false;
bool should_launch_setup = false;
bool has_gamepath = false;
bool is_fullscreen = false;
@ -558,6 +559,8 @@ MainWindow::MainWindow(bool has_broken_vulkan)
should_launch_qlaunch = true;
} else if (args[i] == QStringLiteral("-hlaunch")) {
should_launch_hlaunch = true;
} else if (args[i] == QStringLiteral("-ulaunch")) {
should_launch_ulaunch = true;
} else if (args[i] == QStringLiteral("-setup")) {
should_launch_setup = true;
} else {
@ -580,8 +583,31 @@ MainWindow::MainWindow(bool has_broken_vulkan)
LaunchFirmwareApplet(u64(Service::AM::AppletProgramId::QLaunch), std::nullopt);
} else if (should_launch_hlaunch) {
std::filesystem::path const sd_dir = Common::FS::GetEdenPathString(Common::FS::EdenPath::SDMCDir);
auto const hbl_path = (sd_dir / "atmosphere" / "hbl.nsp").string();
BootGame(QString::fromStdString(hbl_path), ApplicationAppletParameters());
auto const path = (sd_dir / "atmosphere" / "hbl.nsp").string();
BootGame(QString::fromStdString(path), ApplicationAppletParameters());
} else if (should_launch_ulaunch) {
constexpr size_t NroPathSize = 512;
constexpr size_t NroArgvSize = 2048;
constexpr size_t MenuCaptionSize = 1024;
struct UlauncherTargetInput {
u32 magic;
bool target_once;
bool is_auto_game_recording;
std::array<u8, 2> unused;
std::array<char, NroPathSize> nro_path;
std::array<char, NroArgvSize> nro_argv;
std::array<char, MenuCaptionSize> menu_caption;
} target_ipt = {};
target_ipt.magic = 0x49444C55; // "ULDI"
QtCommon::system->GetUserChannel().resize(sizeof(target_ipt));
std::memcpy(QtCommon::system->GetUserChannel().data(), &target_ipt, sizeof(target_ipt));
std::filesystem::path const sd_dir = Common::FS::GetEdenPathString(Common::FS::EdenPath::SDMCDir);
auto const path = (sd_dir / "ulaunch" / "bin" / "uLoader" / "application" / "main").string();
auto params = ApplicationAppletParameters();
params.launch_type = Service::AM::LaunchType::ApplicationInitiated;
BootGame(QString::fromStdString(path), params);
}
}
}