mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-22 22:27:03 +02:00
ulsf:p, proper launch of
This commit is contained in:
parent
daee174a87
commit
aa2875e1e9
5 changed files with 81 additions and 53 deletions
|
|
@ -94,7 +94,9 @@ enum class AppletId : u32 {
|
||||||
LoginShare = 0x18,
|
LoginShare = 0x18,
|
||||||
WebAuth = 0x19,
|
WebAuth = 0x19,
|
||||||
MyPage = 0x1A,
|
MyPage = 0x1A,
|
||||||
Lhub = 0x35
|
Lhub = 0x35,
|
||||||
|
// Homebrew -- uses same ProgramId as qlaunch
|
||||||
|
UlauncherUmenu = 0xF000'0000,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class AppletProgramId : u64 {
|
enum class AppletProgramId : u64 {
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,20 @@ namespace Service::AM {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
constexpr size_t NroPathSize = 512;
|
||||||
|
constexpr size_t NroArgvSize = 2048;
|
||||||
|
constexpr size_t MenuCaptionSize = 1024;
|
||||||
|
struct UloaderTargetInput {
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(UloaderTargetInput) == 3592);
|
||||||
|
|
||||||
constexpr u32 LaunchParameterAccountPreselectedUserMagic = 0xC79497CA;
|
constexpr u32 LaunchParameterAccountPreselectedUserMagic = 0xC79497CA;
|
||||||
|
|
||||||
struct LaunchParameterAccountPreselectedUser {
|
struct LaunchParameterAccountPreselectedUser {
|
||||||
|
|
@ -121,6 +135,44 @@ void PushInShowController(Core::System& system, AppletStorageChannel& channel) {
|
||||||
channel.Push(std::make_shared<IStorage>(system, std::move(user_args_data)));
|
channel.Push(std::make_shared<IStorage>(system, std::move(user_args_data)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PushInShowUlauncherUmenu(Core::System& system, AppletStorageChannel& channel) {
|
||||||
|
typedef std::array<u64, 2> AccountUid;
|
||||||
|
const CommonArguments common_args = {
|
||||||
|
.arguments_version = CommonArgumentVersion::Version3,
|
||||||
|
.size = CommonArgumentSize::Version3,
|
||||||
|
.library_version = 2,
|
||||||
|
.theme_color = ThemeColor::BasicBlack,
|
||||||
|
.play_startup_sound = true,
|
||||||
|
.system_tick = system.CoreTiming().GetClockTicks(),
|
||||||
|
};
|
||||||
|
struct UmenuInput {
|
||||||
|
AccountUid selected_user;
|
||||||
|
UloaderTargetInput suspended_hb_target_ipt; // Set if homebrew (launched as an application) is currently suspended
|
||||||
|
u64 suspended_app_id; // Set if any normal application is suspended
|
||||||
|
std::array<char, 0x301> last_menu_fs_path; //FS_MAX_PATH
|
||||||
|
std::array<char, 0x301> last_menu_path;
|
||||||
|
u32 last_menu_index;
|
||||||
|
bool reload_theme_cache;
|
||||||
|
bool warned_about_outdated_theme;
|
||||||
|
u32 last_added_app_count;
|
||||||
|
u32 last_deleted_app_count;
|
||||||
|
u32 in_verify_app_count;
|
||||||
|
} user_args = {};
|
||||||
|
static_assert(sizeof(UmenuInput) == 5176);
|
||||||
|
|
||||||
|
auto const user = system.GetProfileManager().GetUser(0);
|
||||||
|
user_args.selected_user[0] = user->uuid[0];
|
||||||
|
user_args.selected_user[1] = user->uuid[1];
|
||||||
|
user_args.warned_about_outdated_theme = true;
|
||||||
|
|
||||||
|
std::vector<u8> common_args_data(sizeof(common_args));
|
||||||
|
std::vector<u8> user_args_data(sizeof(user_args));
|
||||||
|
std::memcpy(common_args_data.data(), std::addressof(common_args), sizeof(common_args));
|
||||||
|
std::memcpy(user_args_data.data(), std::addressof(user_args), sizeof(user_args));
|
||||||
|
channel.Push(std::make_shared<IStorage>(system, std::move(common_args_data)));
|
||||||
|
channel.Push(std::make_shared<IStorage>(system, std::move(user_args_data)));
|
||||||
|
}
|
||||||
|
|
||||||
void PushInShowCabinetData(Core::System& system, AppletStorageChannel& channel) {
|
void PushInShowCabinetData(Core::System& system, AppletStorageChannel& channel) {
|
||||||
const CommonArguments arguments{
|
const CommonArguments arguments{
|
||||||
.arguments_version = CommonArgumentVersion::Version3,
|
.arguments_version = CommonArgumentVersion::Version3,
|
||||||
|
|
@ -295,55 +347,15 @@ void AppletManager::SetWindowSystem(WindowSystem* window_system) {
|
||||||
// Or ulaunch initialization where we push parameters willingly!
|
// Or ulaunch initialization where we push parameters willingly!
|
||||||
if (params.launch_type == LaunchType::ApplicationInitiated) {
|
if (params.launch_type == LaunchType::ApplicationInitiated) {
|
||||||
applet->user_channel_launch_parameter.swap(m_system.GetUserChannel());
|
applet->user_channel_launch_parameter.swap(m_system.GetUserChannel());
|
||||||
} else if (params.launch_type == LaunchType::FrontendUlaunchInitiated
|
} else if (params.launch_type == LaunchType::FrontendUlaunchInitiated) {
|
||||||
|| params.launch_type == LaunchType::FrontendUmenuInitiated) {
|
UloaderTargetInput target_ipt = {};
|
||||||
constexpr size_t NroPathSize = 512;
|
target_ipt.magic = 0x49444C55; // "ULDI"
|
||||||
constexpr size_t NroArgvSize = 2048;
|
target_ipt.nro_path = {"sdmc:/hbmenu.nro"};
|
||||||
constexpr size_t MenuCaptionSize = 1024;
|
target_ipt.menu_caption = {"Loaded by uLoader v1.2.4 - uLaunch's custom hbloader replacement ;)"};
|
||||||
struct UloaderTargetInput {
|
std::vector<u8> v(sizeof(target_ipt));
|
||||||
u32 magic;
|
std::memcpy(v.data(), std::addressof(target_ipt), sizeof(target_ipt));
|
||||||
bool target_once;
|
applet->user_channel_launch_parameter.clear();
|
||||||
bool is_auto_game_recording;
|
applet->user_channel_launch_parameter.push_back(std::move(v));
|
||||||
std::array<u8, 2> unused;
|
|
||||||
std::array<char, NroPathSize> nro_path;
|
|
||||||
std::array<char, NroArgvSize> nro_argv;
|
|
||||||
std::array<char, MenuCaptionSize> menu_caption;
|
|
||||||
};
|
|
||||||
static_assert(sizeof(UloaderTargetInput) == 3592);
|
|
||||||
|
|
||||||
if (params.launch_type == LaunchType::FrontendUlaunchInitiated) {
|
|
||||||
UloaderTargetInput target_ipt = {};
|
|
||||||
target_ipt.magic = 0x49444C55; // "ULDI"
|
|
||||||
target_ipt.nro_path = {"sdmc:/hbmenu.nro"};
|
|
||||||
target_ipt.menu_caption = {"Loaded by uLoader v1.2.4 - uLaunch's custom hbloader replacement ;)"};
|
|
||||||
|
|
||||||
std::vector<u8> v(sizeof(target_ipt));
|
|
||||||
std::memcpy(v.data(), std::addressof(target_ipt), sizeof(target_ipt));
|
|
||||||
applet->user_channel_launch_parameter.clear();
|
|
||||||
applet->user_channel_launch_parameter.push_back(std::move(v));
|
|
||||||
} else {
|
|
||||||
typedef u64 AccountUid;
|
|
||||||
struct UmenuInput {
|
|
||||||
AccountUid selected_user;
|
|
||||||
UloaderTargetInput suspended_hb_target_ipt; // Set if homebrew (launched as an application) is currently suspended
|
|
||||||
u64 suspended_app_id; // Set if any normal application is suspended
|
|
||||||
std::array<char, 0x301> last_menu_fs_path; //FS_MAX_PATH
|
|
||||||
std::array<char, 0x301> last_menu_path;
|
|
||||||
u32 last_menu_index;
|
|
||||||
bool reload_theme_cache;
|
|
||||||
bool warned_about_outdated_theme;
|
|
||||||
u32 last_added_app_count;
|
|
||||||
u32 last_deleted_app_count;
|
|
||||||
u32 in_verify_app_count;
|
|
||||||
};
|
|
||||||
|
|
||||||
UmenuInput target_umenu_ipt = {};
|
|
||||||
|
|
||||||
std::vector<u8> v(sizeof(target_umenu_ipt));
|
|
||||||
std::memcpy(v.data(), std::addressof(target_umenu_ipt), sizeof(target_umenu_ipt));
|
|
||||||
applet->user_channel_launch_parameter.clear();
|
|
||||||
applet->user_channel_launch_parameter.push_back(std::move(v));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Read whether we need a preselected user from NACP?
|
// TODO: Read whether we need a preselected user from NACP?
|
||||||
|
|
@ -385,6 +397,9 @@ void AppletManager::SetWindowSystem(WindowSystem* window_system) {
|
||||||
case AppletId::Controller:
|
case AppletId::Controller:
|
||||||
PushInShowController(m_system, InitializeFakeCallerApplet(m_system, applet));
|
PushInShowController(m_system, InitializeFakeCallerApplet(m_system, applet));
|
||||||
break;
|
break;
|
||||||
|
case AppletId::UlauncherUmenu:
|
||||||
|
PushInShowUlauncherUmenu(m_system, InitializeFakeCallerApplet(m_system, applet));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ AppletProgramId AppletIdToProgramId(AppletId applet_id) {
|
||||||
case AppletId::OverlayDisplay:
|
case AppletId::OverlayDisplay:
|
||||||
return AppletProgramId::OverlayDisplay;
|
return AppletProgramId::OverlayDisplay;
|
||||||
case AppletId::QLaunch:
|
case AppletId::QLaunch:
|
||||||
|
case AppletId::UlauncherUmenu: //reuses same id as Qlaunch
|
||||||
return AppletProgramId::QLaunch;
|
return AppletProgramId::QLaunch;
|
||||||
case AppletId::Starter:
|
case AppletId::Starter:
|
||||||
return AppletProgramId::Starter;
|
return AppletProgramId::Starter;
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@ void ULSF_U::GetVersion(HLERequestContext& ctx) {
|
||||||
void LoopProcess(Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
auto server_manager = std::make_unique<ServerManager>(system);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
server_manager->RegisterNamedService("ulsf:u", std::make_shared<ULSF_U>(system));
|
server_manager->RegisterNamedService("ulsf:u", std::make_shared<ULSF_U>(system));
|
||||||
|
server_manager->RegisterNamedService("ulsf:p", std::make_shared<ULSF_P>(system));
|
||||||
|
|
||||||
ServerManager::RunServer(std::move(server_manager));
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -516,6 +516,7 @@ MainWindow::MainWindow(bool has_broken_vulkan)
|
||||||
bool should_launch_qlaunch = false;
|
bool should_launch_qlaunch = false;
|
||||||
bool should_launch_hlaunch = false;
|
bool should_launch_hlaunch = false;
|
||||||
bool should_launch_hlaunch_uloader = false;
|
bool should_launch_hlaunch_uloader = false;
|
||||||
|
bool should_launch_umenu = false;
|
||||||
bool should_launch_ulaunch = false;
|
bool should_launch_ulaunch = false;
|
||||||
bool should_launch_setup = false;
|
bool should_launch_setup = false;
|
||||||
bool has_gamepath = false;
|
bool has_gamepath = false;
|
||||||
|
|
@ -563,7 +564,10 @@ MainWindow::MainWindow(bool has_broken_vulkan)
|
||||||
} else if (args[i] == QStringLiteral("-hlaunch-uloader")) {
|
} else if (args[i] == QStringLiteral("-hlaunch-uloader")) {
|
||||||
should_launch_hlaunch_uloader = true;
|
should_launch_hlaunch_uloader = true;
|
||||||
} else if (args[i] == QStringLiteral("-ulaunch")) {
|
} else if (args[i] == QStringLiteral("-ulaunch")) {
|
||||||
should_launch_ulaunch = true;
|
//should_launch_ulaunch = true;
|
||||||
|
should_launch_umenu = true;
|
||||||
|
} else if (args[i] == QStringLiteral("-umenu")) {
|
||||||
|
should_launch_umenu = true;
|
||||||
} else if (args[i] == QStringLiteral("-setup")) {
|
} else if (args[i] == QStringLiteral("-setup")) {
|
||||||
should_launch_setup = true;
|
should_launch_setup = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -595,10 +599,14 @@ MainWindow::MainWindow(bool has_broken_vulkan)
|
||||||
params.launch_type = Service::AM::LaunchType::FrontendUlaunchInitiated;
|
params.launch_type = Service::AM::LaunchType::FrontendUlaunchInitiated;
|
||||||
BootGame(QString::fromStdString(path), params);
|
BootGame(QString::fromStdString(path), params);
|
||||||
} else if (should_launch_ulaunch) {
|
} else if (should_launch_ulaunch) {
|
||||||
|
std::filesystem::path const sd_dir = Common::FS::GetEdenPathString(Common::FS::EdenPath::SDMCDir);
|
||||||
|
auto const path = (sd_dir / "ulaunch" / "bin" / "uSystem" / "exefs.nsp").string();
|
||||||
|
BootGame(QString::fromStdString(path), ApplicationAppletParameters());
|
||||||
|
} else if (should_launch_umenu) {
|
||||||
std::filesystem::path const sd_dir = Common::FS::GetEdenPathString(Common::FS::EdenPath::SDMCDir);
|
std::filesystem::path const sd_dir = Common::FS::GetEdenPathString(Common::FS::EdenPath::SDMCDir);
|
||||||
auto const path = (sd_dir / "ulaunch" / "bin" / "uMenu" / "main").string();
|
auto const path = (sd_dir / "ulaunch" / "bin" / "uMenu" / "main").string();
|
||||||
auto const program_id = 0x0100000000010000;
|
auto const program_id = 0x010000000000FFFF;
|
||||||
auto params = LibraryAppletParameters(u64(program_id), Service::AM::AppletId::Cabinet);
|
auto params = LibraryAppletParameters(program_id, Service::AM::AppletId::UlauncherUmenu);
|
||||||
params.launch_type = Service::AM::LaunchType::FrontendUmenuInitiated;
|
params.launch_type = Service::AM::LaunchType::FrontendUmenuInitiated;
|
||||||
BootGame(QString::fromStdString(path), params);
|
BootGame(QString::fromStdString(path), params);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue