diff --git a/README.md b/README.md
index 6bf8c47..4141cda 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-
+
> Custom, open-source replacement/reimplementation for Nintendo Switch's HOME menu (qlaunch), extending it with amazing, homebrew-oriented functionality!
diff --git a/TODO.md b/TODO.md
index 8723722..23157e3 100644
--- a/TODO.md
+++ b/TODO.md
@@ -1,6 +1,6 @@
# uLaunch's TODO list
-- Improve QDaemons's IPC with two services, one only for QMenu and the other one for any process to interact with uLaunch:
+- Improve Daemons's IPC with two services, one only for Daemon and the other one for any process to interact with uLaunch:
- Easy way to detect whether uLaunch is present
diff --git a/master-libnx b/master-libnx
index e5c501e..b83ddf8 160000
--- a/master-libnx
+++ b/master-libnx
@@ -1 +1 @@
-Subproject commit e5c501e5b66fbeeb57cbc03856582ad470084aca
+Subproject commit b83ddf8157e7aef37159aaff9e0b40b137339504
diff --git a/uDaemon/include/ecs/ecs_ExternalContent.hpp b/uDaemon/include/ecs/ecs_ExternalContent.hpp
index ee89f22..ee08994 100644
--- a/uDaemon/include/ecs/ecs_ExternalContent.hpp
+++ b/uDaemon/include/ecs/ecs_ExternalContent.hpp
@@ -2,57 +2,15 @@
#pragma once
#include
#include
+#include
#include
namespace ecs
{
- NX_CONSTEXPR AppletId DetectAppletIdByProgramId(u64 program_id)
- {
- switch(program_id)
- {
- case 0x0100000000001001:
- return AppletId_auth;
- case 0x0100000000001002:
- return AppletId_cabinet;
- case 0x0100000000001003:
- return AppletId_controller;
- case 0x0100000000001004:
- return AppletId_dataErase;
- case 0x0100000000001005:
- return AppletId_error;
- case 0x0100000000001006:
- return AppletId_netConnect;
- case 0x0100000000001007:
- return AppletId_playerSelect;
- case 0x0100000000001008:
- return AppletId_swkbd;
- case 0x0100000000001009:
- return AppletId_miiEdit;
- case 0x010000000000100A:
- return AppletId_web;
- case 0x010000000000100B:
- return AppletId_shop;
- case 0x010000000000100D:
- return AppletId_photoViewer;
- case 0x010000000000100E:
- return AppletId_set;
- case 0x010000000000100F:
- return AppletId_offlineWeb;
- case 0x0100000000001010:
- return AppletId_loginShare;
- case 0x0100000000001011:
- return AppletId_wifiWebAuth;
- case 0x0100000000001013:
- return AppletId_myPage;
- }
- return (AppletId)0;
- }
-
Result Initialize();
void Exit();
Result RegisterExternalContent(u64 program_id, std::string exefs_path);
Result LaunchApplet(u64 program_id, u32 la_version, void *args, size_t args_size);
- Result LaunchApplication(u64 program_id, void *args, size_t args_size, AccountUid uid);
Result LaunchSystemProcess(u64 program_id, std::string argv_str);
inline Result RegisterLaunchAsApplet(u64 program_id, u32 la_version, std::string exefs_path, void *args, size_t args_size)
@@ -65,7 +23,7 @@ namespace ecs
inline Result RegisterLaunchAsApplication(u64 program_id, std::string exefs_path, void *args, size_t args_size, AccountUid uid)
{
auto rc = RegisterExternalContent(program_id, exefs_path);
- if(R_SUCCEEDED(rc)) rc = LaunchApplication(program_id, args, args_size, uid);
+ if(R_SUCCEEDED(rc)) rc = am::ApplicationStart(program_id, false, uid, args, args_size);
return rc;
}
diff --git a/uDaemon/source/Main.cpp b/uDaemon/source/Main.cpp
index 4771ccd..7294d4b 100644
--- a/uDaemon/source/Main.cpp
+++ b/uDaemon/source/Main.cpp
@@ -9,13 +9,14 @@
#include
#include
#include
-#include
+#include
#include
#include
extern "C"
{
u32 __nx_applet_type = AppletType_SystemApplet;
+ TimeServiceType __nx_time_service_type = TimeServiceType_System;
#if UL_DEV
size_t __nx_heap_size = 0x3000000; // Dev builds use 48MB (still lower than official qlaunch) for debug console
#else
@@ -35,11 +36,12 @@ namespace ams
AccountUid selected_uid = {};
hb::HbTargetParams hblaunch_flag = {};
-hb::HbTargetParams hbapplaunch_copy = {};
hb::HbTargetParams hbapplaunch_flag = {};
+hb::HbTargetParams hbapplaunch_flag_temp = {};
u64 titlelaunch_flag = 0;
WebCommonConfig webapplet_flag = {};
bool album_flag = false;
+bool app_opened_hb = false;
u8 *usbbuf = nullptr;
cfg::Config config = {};
Thread ipc_thr;
@@ -49,22 +51,22 @@ Thread usb_thr;
bool debug_menu = false;
ams::os::Mutex latestqlock;
-am::QMenuMessage latestqmenumsg = am::QMenuMessage::Invalid;
+am::MenuMessage latestqmenumsg = am::MenuMessage::Invalid;
-am::QDaemonStatus CreateStatus()
+am::DaemonStatus CreateStatus()
{
- am::QDaemonStatus status = {};
+ am::DaemonStatus status = {};
memcpy(&status.selected_user, &selected_uid, sizeof(selected_uid));
cfg::TitleType tmptype = cfg::TitleType::Invalid;
if(am::ApplicationIsActive())
{
tmptype = cfg::TitleType::Installed;
- if(os::IsFlogTitle(am::ApplicationGetId())) tmptype = cfg::TitleType::Homebrew;
+ if(app_opened_hb) tmptype = cfg::TitleType::Homebrew;
}
if(tmptype == cfg::TitleType::Installed) status.app_id = am::ApplicationGetId();
- else if(tmptype == cfg::TitleType::Homebrew) status.params = hbapplaunch_copy;
+ else if(tmptype == cfg::TitleType::Homebrew) memcpy(&status.params, &hbapplaunch_flag_temp, sizeof(hbapplaunch_flag_temp));
return status;
}
@@ -74,20 +76,20 @@ void HandleSleep()
appletStartSleepSequence(true);
}
-Result LaunchMenu(am::QMenuStartMode stmode, am::QDaemonStatus status)
+Result LaunchMenu(am::MenuStartMode stmode, am::DaemonStatus status)
{
if(debug_menu) return 0;
- return ecs::RegisterLaunchAsApplet(0x010000000000100B, (u32)stmode, "/ulaunch/bin/uMenu/", &status, sizeof(status));
+ return ecs::RegisterLaunchAsApplet(config.menu_program_id, (u32)stmode, "/ulaunch/bin/uMenu/", &status, sizeof(status));
}
void HandleHomeButton()
{
bool used_to_reopen_menu = false;
- if(am::LibraryAppletIsActive() && !am::LibraryAppletIsQMenu())
+ if(am::LibraryAppletIsActive() && !am::LibraryAppletIsMenu())
{
am::LibraryAppletTerminate();
auto status = CreateStatus();
- UL_R_TRY(LaunchMenu(am::QMenuStartMode::Menu, status));
+ UL_R_TRY(LaunchMenu(am::MenuStartMode::Menu, status));
return;
}
if(am::ApplicationIsActive())
@@ -96,14 +98,14 @@ void HandleHomeButton()
{
am::HomeMenuSetForeground();
auto status = CreateStatus();
- UL_R_TRY(LaunchMenu(am::QMenuStartMode::MenuApplicationSuspended, status));
+ UL_R_TRY(LaunchMenu(am::MenuStartMode::MenuApplicationSuspended, status));
used_to_reopen_menu = true;
}
}
- if(am::LibraryAppletIsQMenu() && !used_to_reopen_menu)
+ if(am::LibraryAppletIsMenu() && !used_to_reopen_menu)
{
std::scoped_lock _lock(latestqlock);
- latestqmenumsg = am::QMenuMessage::HomeRequest;
+ latestqmenumsg = am::MenuMessage::HomeRequest;
}
}
@@ -185,162 +187,165 @@ void HandleAppletMessage()
void HandleMenuMessage()
{
- if(am::LibraryAppletIsQMenu())
+ if(am::LibraryAppletIsMenu())
{
- am::QDaemonCommandReader reader;
+ am::DaemonCommandReader reader;
if(reader)
{
switch(reader.GetMessage())
{
- case am::QDaemonMessage::SetSelectedUser:
+ case am::DaemonMessage::SetSelectedUser:
{
selected_uid = reader.Read();
reader.FinishRead();
break;
}
- case am::QDaemonMessage::LaunchApplication:
+ case am::DaemonMessage::LaunchApplication:
{
auto app_id = reader.Read();
reader.FinishRead();
if(am::ApplicationIsActive())
{
- am::QDaemonCommandResultWriter res(RES_VALUE(QDaemon, ApplicationActive));
+ am::DaemonCommandResultWriter res(RES_VALUE(Daemon, ApplicationActive));
res.FinishWrite();
}
else if(!accountUidIsValid(&selected_uid))
{
- am::QDaemonCommandResultWriter res(RES_VALUE(QDaemon, InvalidSelectedUser));
+ am::DaemonCommandResultWriter res(RES_VALUE(Daemon, InvalidSelectedUser));
res.FinishWrite();
}
else if(titlelaunch_flag > 0)
{
- am::QDaemonCommandResultWriter res(RES_VALUE(QDaemon, AlreadyQueued));
+ am::DaemonCommandResultWriter res(RES_VALUE(Daemon, AlreadyQueued));
res.FinishWrite();
}
else
{
titlelaunch_flag = app_id;
- am::QDaemonCommandResultWriter res(0);
+ am::DaemonCommandResultWriter res(0);
res.FinishWrite();
}
break;
}
- case am::QDaemonMessage::ResumeApplication:
+ case am::DaemonMessage::ResumeApplication:
{
reader.FinishRead();
if(!am::ApplicationIsActive())
{
- am::QDaemonCommandResultWriter res(RES_VALUE(QDaemon, ApplicationNotActive));
+ am::DaemonCommandResultWriter res(RES_VALUE(Daemon, ApplicationNotActive));
res.FinishWrite();
}
else
{
am::ApplicationSetForeground();
- am::QDaemonCommandResultWriter res(0);
+ am::DaemonCommandResultWriter res(0);
res.FinishWrite();
}
break;
}
- case am::QDaemonMessage::TerminateApplication:
+ case am::DaemonMessage::TerminateApplication:
{
reader.FinishRead();
am::ApplicationTerminate();
+ app_opened_hb = false;
break;
}
- case am::QDaemonMessage::LaunchHomebrewLibApplet:
+ case am::DaemonMessage::LaunchHomebrewLibraryApplet:
{
hblaunch_flag = reader.Read();
reader.FinishRead();
break;
}
- case am::QDaemonMessage::LaunchHomebrewApplication:
+ case am::DaemonMessage::LaunchHomebrewApplication:
{
+ auto app_id = reader.Read();
auto ipt = reader.Read();
reader.FinishRead();
if(am::ApplicationIsActive())
{
- am::QDaemonCommandResultWriter res(RES_VALUE(QDaemon, ApplicationActive));
+ am::DaemonCommandResultWriter res(RES_VALUE(Daemon, ApplicationActive));
res.FinishWrite();
}
else if(!accountUidIsValid(&selected_uid))
{
- am::QDaemonCommandResultWriter res(RES_VALUE(QDaemon, InvalidSelectedUser));
+ am::DaemonCommandResultWriter res(RES_VALUE(Daemon, InvalidSelectedUser));
res.FinishWrite();
}
else if(titlelaunch_flag > 0)
{
- am::QDaemonCommandResultWriter res(RES_VALUE(QDaemon, AlreadyQueued));
+ am::DaemonCommandResultWriter res(RES_VALUE(Daemon, AlreadyQueued));
res.FinishWrite();
}
else
{
- hbapplaunch_copy = ipt;
- hbapplaunch_flag = hbapplaunch_copy;
- am::QDaemonCommandResultWriter res(0);
+ memcpy(&hbapplaunch_flag, &ipt, sizeof(ipt));
+ memcpy(&hbapplaunch_flag_temp, &ipt, sizeof(ipt));
+ titlelaunch_flag = app_id;
+ am::DaemonCommandResultWriter res(0);
res.FinishWrite();
}
break;
}
- case am::QDaemonMessage::OpenWebPage:
+ case am::DaemonMessage::OpenWebPage:
{
webapplet_flag = reader.Read();
reader.FinishRead();
break;
}
- case am::QDaemonMessage::GetSelectedUser:
+ case am::DaemonMessage::GetSelectedUser:
{
reader.FinishRead();
- am::QDaemonCommandResultWriter res(0);
+ am::DaemonCommandResultWriter res(0);
res.Write(selected_uid);
res.FinishWrite();
break;
}
- case am::QDaemonMessage::UserHasPassword:
+ case am::DaemonMessage::UserHasPassword:
{
auto uid = reader.Read();
reader.FinishRead();
auto [rc, pass] = db::AccessPassword(uid);
- am::QDaemonCommandResultWriter res(rc);
+ am::DaemonCommandResultWriter res(rc);
res.FinishWrite();
break;
}
- case am::QDaemonMessage::TryLogUser:
+ case am::DaemonMessage::TryLogUser:
{
auto pass = reader.Read();
reader.FinishRead();
auto rc = db::TryLogUser(pass);
- am::QDaemonCommandResultWriter res(rc);
+ am::DaemonCommandResultWriter res(rc);
res.FinishWrite();
break;
}
- case am::QDaemonMessage::RegisterUserPassword:
+ case am::DaemonMessage::RegisterUserPassword:
{
auto pass = reader.Read();
reader.FinishRead();
auto rc = db::RegisterUserPassword(pass);
- am::QDaemonCommandResultWriter res(rc);
+ am::DaemonCommandResultWriter res(rc);
res.FinishWrite();
break;
}
- case am::QDaemonMessage::ChangeUserPassword:
+ case am::DaemonMessage::ChangeUserPassword:
{
auto pass = reader.Read();
auto newpass = reader.Read();
@@ -353,12 +358,12 @@ void HandleMenuMessage()
if(R_SUCCEEDED(rc)) rc = db::RegisterUserPassword(newpass);
}
- am::QDaemonCommandResultWriter res(rc);
+ am::DaemonCommandResultWriter res(rc);
res.FinishWrite();
break;
}
- case am::QDaemonMessage::RemoveUserPassword:
+ case am::DaemonMessage::RemoveUserPassword:
{
auto pass = reader.Read();
reader.FinishRead();
@@ -369,12 +374,12 @@ void HandleMenuMessage()
rc = db::RemoveUserPassword(pass.uid);
}
- am::QDaemonCommandResultWriter res(rc);
+ am::DaemonCommandResultWriter res(rc);
res.FinishWrite();
break;
}
- case am::QDaemonMessage::OpenAlbum:
+ case am::DaemonMessage::OpenAlbum:
{
reader.FinishRead();
album_flag = true;
@@ -400,15 +405,15 @@ namespace
constexpr size_t MaxServers = 2;
constexpr size_t MaxSessions = 2;
- constexpr ams::sm::ServiceName PrivateServiceName = ams::sm::ServiceName::Encode(AM_QDAEMON_SERVICE_NAME);
+ constexpr ams::sm::ServiceName PrivateServiceName = ams::sm::ServiceName::Encode(AM_DAEMON_PRIVATE_SERVICE_NAME);
ams::sf::hipc::ServerManager private_service_manager;
}
-namespace qdaemon
+namespace daemn
{
void IPCManagerThread(void *arg)
{
- private_service_manager.RegisterServer(PrivateServiceName, MaxSessions);
+ UL_R_TRY(private_service_manager.RegisterServer(PrivateServiceName, MaxSessions).GetValue());
private_service_manager.LoopProcess();
}
@@ -435,7 +440,7 @@ namespace qdaemon
{
if(!am::LibraryAppletIsActive())
{
- am::WebAppletStart(&webapplet_flag);
+ UL_R_TRY(am::WebAppletStart(&webapplet_flag));
sth_done = true;
memset(&webapplet_flag, 0, sizeof(webapplet_flag));
@@ -446,7 +451,7 @@ namespace qdaemon
if(!am::LibraryAppletIsActive())
{
u8 albumflag = 2;
- am::LibraryAppletStart(AppletId_photoViewer, 0x10000, &albumflag, sizeof(albumflag));
+ UL_R_TRY(am::LibraryAppletStart(AppletId_photoViewer, 0x10000, &albumflag, sizeof(albumflag)));
sth_done = true;
album_flag = false;
@@ -456,18 +461,21 @@ namespace qdaemon
{
if(!am::LibraryAppletIsActive())
{
- am::ApplicationStart(titlelaunch_flag, false, selected_uid);
- sth_done = true;
- titlelaunch_flag = 0;
- }
- }
- if(strlen(hbapplaunch_flag.nro_path))
- {
- if(!am::LibraryAppletIsActive())
- {
- am::ApplicationStart(OS_FLOG_APP_ID, true, selected_uid, &hbapplaunch_flag, sizeof(hbapplaunch_flag));
- sth_done = true;
- hbapplaunch_flag.nro_path[0] = '\0';
+ if(strlen(hbapplaunch_flag.nro_path))
+ {
+ auto params = hb::HbTargetParams::Create(hbapplaunch_flag.nro_path, hbapplaunch_flag.nro_argv, false);
+ UL_R_TRY(ecs::RegisterLaunchAsApplication(titlelaunch_flag, "/ulaunch/bin/uHbTarget/app/", ¶ms, sizeof(params), selected_uid));
+ sth_done = true;
+ app_opened_hb = true;
+ titlelaunch_flag = 0;
+ hbapplaunch_flag.nro_path[0] = '\0';
+ }
+ else
+ {
+ UL_R_TRY(am::ApplicationStart(titlelaunch_flag, false, selected_uid));
+ sth_done = true;
+ titlelaunch_flag = 0;
+ }
}
}
if(strlen(hblaunch_flag.nro_path))
@@ -475,36 +483,29 @@ namespace qdaemon
if(!am::LibraryAppletIsActive())
{
auto params = hb::HbTargetParams::Create(hblaunch_flag.nro_path, hblaunch_flag.nro_argv, false);
- auto rc = ecs::RegisterLaunchAsApplet(0x0100000000001003, 0, "/ulaunch/bin/uHbTarget/applet/", ¶ms, sizeof(params));
+ UL_R_TRY(ecs::RegisterLaunchAsApplet(config.homebrew_applet_program_id, 0, "/ulaunch/bin/uHbTarget/applet/", ¶ms, sizeof(params)));
sth_done = true;
hblaunch_flag.nro_path[0] = '\0';
}
}
if(!am::LibraryAppletIsActive())
{
- switch(am::LibraryAppletGetId())
+ auto cur_id = am::LibraryAppletGetId();
+ if((cur_id == AppletId_web) || (cur_id == AppletId_photoViewer) || (cur_id == config.homebrew_applet_program_id))
{
- case am::QHbTargetAppletId:
- case AppletId_web:
- case AppletId_photoViewer:
- {
- auto status = CreateStatus();
- UL_R_TRY(LaunchMenu(am::QMenuStartMode::Menu, status));
- sth_done = true;
- break;
- }
- default:
- break;
+ auto status = CreateStatus();
+ UL_R_TRY(LaunchMenu(am::MenuStartMode::Menu, status));
+ sth_done = true;
}
}
if(!sth_done && !debug_menu)
{
// If nothing was done, but nothing is active... An application or applet might have crashed, terminated, failed to launch...
- // No matter what is it, we reopen QMenu in launch-error mode.
+ // No matter what is it, we reopen Menu in launch-error mode.
if(!am::ApplicationIsActive() && !am::LibraryAppletIsActive())
{
auto status = CreateStatus();
- UL_R_TRY(LaunchMenu(am::QMenuStartMode::MenuLaunchFailure, status));
+ UL_R_TRY(LaunchMenu(am::MenuStartMode::MenuLaunchFailure, status));
}
}
}
@@ -547,6 +548,7 @@ namespace qdaemon
fs::CreateDirectory(UL_BASE_SD_DIR "/lang");
config = cfg::EnsureConfig();
+ am::LibraryAppletSetMenuAppletId(am::LibraryAppletGetAppletIdForProgramId(config.menu_program_id));
if(config.viewer_usb_enabled)
{
@@ -624,24 +626,24 @@ namespace qdaemon
}
}
-// QDaemon handles basic qlaunch functionality and serves as a back-end for uLaunch, communicating with QMenu front-end when neccessary.
+// Daemon handles basic qlaunch functionality and serves as a back-end for uLaunch, communicating with Menu front-end when neccessary.
int main()
{
- qdaemon::Initialize();
+ daemn::Initialize();
// Cache everything on startup
cfg::CacheEverything();
auto status = CreateStatus();
- UL_R_TRY(LaunchMenu(am::QMenuStartMode::StartupScreen, status))
+ UL_R_TRY(LaunchMenu(am::MenuStartMode::StartupScreen, status))
while(true)
{
- qdaemon::LoopUpdate();
+ daemn::LoopUpdate();
svcSleepThread(10'000'000);
}
- qdaemon::Exit();
+ daemn::Exit();
return 0;
}
\ No newline at end of file
diff --git a/uDaemon/source/ecs/ecs_ExternalContent.cpp b/uDaemon/source/ecs/ecs_ExternalContent.cpp
index 67abb47..bf6fa79 100644
--- a/uDaemon/source/ecs/ecs_ExternalContent.cpp
+++ b/uDaemon/source/ecs/ecs_ExternalContent.cpp
@@ -5,7 +5,7 @@
#include
#include
#include
-#include
+#include
namespace ecs
{
@@ -25,7 +25,7 @@ namespace ecs
ams::sf::hipc::ServerManager manager_instance;
}
- static void ManagerLoopHandler(void *arg)
+ static void ECSManagerThread(void *arg)
{
manager_instance.LoopProcess();
}
@@ -38,7 +38,7 @@ namespace ecs
initialized = R_SUCCEEDED(rc);
if(initialized)
{
- R_TRY(threadCreate(&manager_process_thread, &ManagerLoopHandler, nullptr, nullptr, 0x8000, 0x2b, -2));
+ R_TRY(threadCreate(&manager_process_thread, &ECSManagerThread, nullptr, nullptr, 0x8000, 0x2b, -2));
R_TRY(threadStart(&manager_process_thread));
}
return rc;
@@ -87,15 +87,10 @@ namespace ecs
Result LaunchApplet(u64 program_id, u32 la_version, void *args, size_t args_size)
{
Result rc = 0xdead;
- auto appletid = DetectAppletIdByProgramId(program_id);
+ auto appletid = am::LibraryAppletGetAppletIdForProgramId(program_id);
if(appletid != 0) rc = am::LibraryAppletStart(appletid, la_version, args, args_size);
return rc;
}
-
- Result LaunchApplication(u64 program_id, void *args, size_t args_size, AccountUid uid)
- {
- return am::ApplicationStart(program_id, false, uid, args, args_size);
- }
Result LaunchSystemProcess(u64 program_id, std::string argv_str)
{
diff --git a/uDaemon/source/ipc/ipc_IDaemonService.cpp b/uDaemon/source/ipc/ipc_IDaemonService.cpp
index 4844708..5649a8f 100644
--- a/uDaemon/source/ipc/ipc_IDaemonService.cpp
+++ b/uDaemon/source/ipc/ipc_IDaemonService.cpp
@@ -1,8 +1,8 @@
#include
-#include
+#include
extern ams::os::Mutex latestqlock;
-extern am::QMenuMessage latestqmenumsg;
+extern am::DaemonMessage latestqmenumsg;
namespace ipc
{
@@ -10,6 +10,6 @@ namespace ipc
{
std::scoped_lock _lock(latestqlock);
msg.SetValue((u32)latestqmenumsg);
- latestqmenumsg = am::QMenuMessage::Invalid;
+ latestqmenumsg = am::DaemonMessage::Invalid;
}
}
\ No newline at end of file
diff --git a/uLaunch/include/am/am_Application.hpp b/uLaunch/include/am/am_Application.hpp
index c1cf952..0457ffe 100644
--- a/uLaunch/include/am/am_Application.hpp
+++ b/uLaunch/include/am/am_Application.hpp
@@ -17,11 +17,10 @@ namespace am
static_assert(sizeof(ApplicationSelectedUserArgument) == 0x400, "ApplicationSelectedUserArgument must be 0x400!");
static constexpr u32 SelectedUserMagic = 0xC79497CA;
- static constexpr u64 QHbTargetSystemApplicationId = OS_FLOG_APP_ID;
bool ApplicationIsActive();
void ApplicationTerminate();
- Result ApplicationStart(u64 app_id, bool system, AccountUid user_id, void *data = NULL, size_t size = 0);
+ Result ApplicationStart(u64 app_id, bool system, AccountUid user_id, void *data = nullptr, size_t size = 0);
bool ApplicationHasForeground();
Result ApplicationSetForeground();
Result ApplicationSend(void *data, size_t size, AppletLaunchParameterKind kind = AppletLaunchParameterKind_UserChannel);
diff --git a/uLaunch/include/am/am_QCommunications.hpp b/uLaunch/include/am/am_DaemonMenuInteraction.hpp
similarity index 59%
rename from uLaunch/include/am/am_QCommunications.hpp
rename to uLaunch/include/am/am_DaemonMenuInteraction.hpp
index f208efe..1f82329 100644
--- a/uLaunch/include/am/am_QCommunications.hpp
+++ b/uLaunch/include/am/am_DaemonMenuInteraction.hpp
@@ -3,9 +3,12 @@
#include
#include
+#define AM_DAEMON_PRIVATE_SERVICE_NAME "qdmnsrv"
+#define AM_DAEMON_PUBLIC_SERVICE_NAME "ulaunch"
+
namespace am
{
- enum class QMenuStartMode
+ enum class MenuStartMode
{
Invalid,
StartupScreen,
@@ -14,20 +17,20 @@ namespace am
MenuLaunchFailure
};
- enum class QMenuMessage
+ enum class MenuMessage
{
Invalid,
HomeRequest
};
- enum class QDaemonMessage
+ enum class DaemonMessage
{
Invalid,
SetSelectedUser,
LaunchApplication,
ResumeApplication,
TerminateApplication,
- LaunchHomebrewLibApplet,
+ LaunchHomebrewLibraryApplet,
LaunchHomebrewApplication,
OpenWebPage,
GetSelectedUser,
@@ -39,36 +42,29 @@ namespace am
OpenAlbum,
};
- struct QDaemonStatus
+ struct DaemonStatus
{
AccountUid selected_user;
hb::HbTargetParams params; // Set if homebrew (via flog takeover) is suspended
u64 app_id; // Set if any title (other than flog) is suspended
};
- #define AM_QDAEMON_SERVICE_NAME "qdmnsrv"
+ ResultWith Menu_ProcessInput();
- Result QDaemon_LaunchQMenu(QMenuStartMode mode, QDaemonStatus status);
- // Result QDaemon_LaunchQHbTarget(hb::HbTargetParams input);
+ Result Menu_InitializeDaemonService();
+ ResultWith Menu_GetLatestMenuMessage();
+ bool MenuIsHomePressed();
+ void Menu_FinalizeDaemonService();
- Result QLibraryAppletReadStorage(void *data, size_t size);
- Result QApplicationReadStorage(void *data, size_t size);
- ResultWith QMenu_ProcessInput();
+ Result Daemon_MenuWriteImpl(void *data, size_t size, bool wait);
+ Result Daemon_MenuReadImpl(void *data, size_t size, bool wait);
- Result QMenu_InitializeDaemonService();
- ResultWith QMenu_GetLatestQMenuMessage();
- bool QMenuIsHomePressed();
- void QMenu_FinalizeDaemonService();
+ Result Menu_DaemonWriteImpl(void *data, size_t size, bool wait);
+ Result Menu_DaemonReadImpl(void *data, size_t size, bool wait);
- Result QDaemon_QMenuWriteImpl(void *data, size_t size, bool wait);
- Result QDaemon_QMenuReadImpl(void *data, size_t size, bool wait);
+ typedef Result(*DMCommandRWFunction)(void*, size_t, bool);
- Result QMenu_QDaemonWriteImpl(void *data, size_t size, bool wait);
- Result QMenu_QDaemonReadImpl(void *data, size_t size, bool wait);
-
- typedef Result(*QCommandRWFunction)(void*, size_t, bool);
-
- struct QCommandCommonHeader
+ struct DMCommandCommonHeader
{
u32 magic;
u32 val;
@@ -77,18 +73,18 @@ namespace am
static constexpr u32 Magic = 0x434D4151;
static constexpr size_t BlockSize = 0x4000;
- template
- class QCommandWriter
+ template
+ class DMCommandWriter
{
private:
- QCommandCommonHeader request;
+ DMCommandCommonHeader request;
u8 *data_block;
size_t data_pos;
Result inner_rc;
bool write_done;
public:
- QCommandWriter(u32 value)
+ DMCommandWriter(u32 value)
{
write_done = false;
request.magic = Magic;
@@ -98,7 +94,7 @@ namespace am
inner_rc = WriteFn(&request, sizeof(request), false);
}
- ~QCommandWriter()
+ ~DMCommandWriter()
{
FinishWrite();
}
@@ -131,11 +127,11 @@ namespace am
}
};
- template
- class QCommandReader
+ template
+ class DMCommandReader
{
private:
- QCommandCommonHeader response;
+ DMCommandCommonHeader response;
u8 *data_block;
size_t data_pos;
Result inner_rc;
@@ -143,17 +139,17 @@ namespace am
bool fn_wait;
public:
- QCommandReader(bool wait = false)
+ DMCommandReader(bool wait = false)
{
fn_wait = wait;
read_done = false;
data_pos = 0;
data_block = new u8[BlockSize]();
- inner_rc = ReadFn(&response, sizeof(QCommandCommonHeader), fn_wait);
+ inner_rc = ReadFn(&response, sizeof(DMCommandCommonHeader), fn_wait);
if(R_SUCCEEDED(inner_rc)) inner_rc = ReadFn(data_block, BlockSize, fn_wait);
}
- ~QCommandReader()
+ ~DMCommandReader()
{
FinishRead();
}
@@ -191,27 +187,27 @@ namespace am
}
};
- class QDaemonCommandReader : public QCommandReader
+ class DaemonCommandReader : public DMCommandReader
{
public:
- QDaemonMessage GetMessage()
+ DaemonMessage GetMessage()
{
- return (QDaemonMessage)GetValue();
+ return (DaemonMessage)GetValue();
}
};
- class QDaemonCommandWriter : public QCommandWriter
+ class DaemonCommandWriter : public DMCommandWriter
{
public:
- QDaemonCommandWriter(QMenuMessage msg) : QCommandWriter((u32)msg)
+ DaemonCommandWriter(MenuMessage msg) : DMCommandWriter((u32)msg)
{
}
};
- class QDaemonCommandResultReader : public QCommandReader
+ class DaemonCommandResultReader : public DMCommandReader
{
public:
- QDaemonCommandResultReader() : QCommandReader(true)
+ DaemonCommandResultReader() : DMCommandReader(true)
{
}
@@ -221,35 +217,35 @@ namespace am
}
};
- class QDaemonCommandResultWriter : public QCommandWriter
+ class DaemonCommandResultWriter : public DMCommandWriter
{
public:
- QDaemonCommandResultWriter(Result rc) : QCommandWriter(rc)
+ DaemonCommandResultWriter(Result rc) : DMCommandWriter(rc)
{
}
};
- class QMenuCommandReader : public QCommandReader
+ class MenuCommandReader : public DMCommandReader
{
public:
- QMenuMessage GetMessage()
+ MenuMessage GetMessage()
{
- return (QMenuMessage)GetValue();
+ return (MenuMessage)GetValue();
}
};
- class QMenuCommandWriter : public QCommandWriter
+ class MenuCommandWriter : public DMCommandWriter
{
public:
- QMenuCommandWriter(QDaemonMessage msg) : QCommandWriter((u32)msg)
+ MenuCommandWriter(DaemonMessage msg) : DMCommandWriter((u32)msg)
{
}
};
- class QMenuCommandResultReader : public QCommandReader
+ class MenuCommandResultReader : public DMCommandReader
{
public:
- QMenuCommandResultReader() : QCommandReader(true)
+ MenuCommandResultReader() : DMCommandReader(true)
{
}
@@ -259,10 +255,10 @@ namespace am
}
};
- class QMenuCommandResultWriter : public QCommandWriter
+ class MenuCommandResultWriter : public DMCommandWriter
{
public:
- QMenuCommandResultWriter(Result rc) : QCommandWriter(rc)
+ MenuCommandResultWriter(Result rc) : DMCommandWriter(rc)
{
}
};
diff --git a/uLaunch/include/am/am_LibraryApplet.hpp b/uLaunch/include/am/am_LibraryApplet.hpp
index d4548f7..051171e 100644
--- a/uLaunch/include/am/am_LibraryApplet.hpp
+++ b/uLaunch/include/am/am_LibraryApplet.hpp
@@ -1,6 +1,7 @@
#pragma once
#include
+#include