mirror of
https://github.com/switchbrew/libnx.git
synced 2025-08-05 07:59:24 +02:00
Added support for using appletSetTerminateResult via IAppletCommonFunctions, and for using appletGetLaunchStorageInfoForDebug/appletGetGpuErrorDetectedSystemEvent with AppletType_LibraryApplet, on [9.0.0+]. Moved these to a new section in the .h/.c.
This commit is contained in:
parent
689430e578
commit
8fc57a4795
@ -1282,9 +1282,6 @@ Result appletRequestLaunchApplicationForQuest(u64 application_id, AppletStorage*
|
||||
*/
|
||||
Result appletGetDesiredLanguage(u64 *LanguageCode);
|
||||
|
||||
/// Only available with AppletType_*Application.
|
||||
Result appletSetTerminateResult(Result res);
|
||||
|
||||
/**
|
||||
* @brief Gets the DisplayVersion for the current host application control.nacp.
|
||||
* @note Only available with AppletType_*Application.
|
||||
@ -1292,14 +1289,6 @@ Result appletSetTerminateResult(Result res);
|
||||
*/
|
||||
Result appletGetDisplayVersion(char *displayVersion);
|
||||
|
||||
/**
|
||||
* @brief Gets the LaunchStorageInfo.
|
||||
* @note Only available with AppletType_*Application on [2.0.0+].
|
||||
* @param[out] app_storageId Same as AppletApplicationLaunchProperty::app_storageId.
|
||||
* @param[out] update_storageId Same as AppletApplicationLaunchProperty::update_storageId.
|
||||
*/
|
||||
Result appletGetLaunchStorageInfoForDebug(NcmStorageId *app_storageId, NcmStorageId *update_storageId);
|
||||
|
||||
/**
|
||||
* @brief Blocks the usage of the home button, for short (Home Menu) and long (Overlay) presses.
|
||||
* @note Only available with AppletType_*Application.
|
||||
@ -1468,15 +1457,6 @@ Result appletRestartProgram(const void* buffer, size_t size);
|
||||
*/
|
||||
Result appletGetPreviousProgramIndex(s32 *programIndex);
|
||||
|
||||
/**
|
||||
* @brief Gets an Event which is signaled for GpuErrorDetected.
|
||||
* @note Only available with AppletType_*Application on [8.0.0+].
|
||||
* @note The Event must be closed by the user once finished with it.
|
||||
* @note Official sw waits on this Event from a seperate thread, triggering an abort when it's signaled.
|
||||
* @param[out] out_event Output Event with autoclear=false.
|
||||
*/
|
||||
Result appletGetGpuErrorDetectedSystemEvent(Event *out_event);
|
||||
|
||||
/**
|
||||
* @brief CreateMovieMaker. Do not use this directly, use \ref grcCreateMovieMaker instead.
|
||||
* @note Only available with AppletType_*Application on [5.0.0+].
|
||||
@ -2227,6 +2207,35 @@ Result appletGetAppletResourceUsageInfo(AppletResourceUsageInfo *info);
|
||||
|
||||
///@}
|
||||
|
||||
///@name Common cmds
|
||||
///@{
|
||||
|
||||
/**
|
||||
* @brief SetTerminateResult
|
||||
* @note Only available with AppletType_*Application. Or with AppletType_SystemApplet, AppletType_LibraryApplet, or AppletType_OverlayApplet, on [9.0.0+].
|
||||
* @param[in] res Result
|
||||
*/
|
||||
Result appletSetTerminateResult(Result res);
|
||||
|
||||
/**
|
||||
* @brief Gets the LaunchStorageInfo.
|
||||
* @note Only available with AppletType_*Application on [2.0.0+], or with AppletType_LibraryApplet on [9.0.0+].
|
||||
* @param[out] app_storageId Same as AppletApplicationLaunchProperty::app_storageId.
|
||||
* @param[out] update_storageId Same as AppletApplicationLaunchProperty::update_storageId.
|
||||
*/
|
||||
Result appletGetLaunchStorageInfoForDebug(NcmStorageId *app_storageId, NcmStorageId *update_storageId);
|
||||
|
||||
/**
|
||||
* @brief Gets an Event which is signaled for GpuErrorDetected.
|
||||
* @note Only available with AppletType_*Application on [8.0.0+], or with AppletType_LibraryApplet on [9.0.0+].
|
||||
* @note The Event must be closed by the user once finished with it.
|
||||
* @note Official sw waits on this Event from a seperate thread, triggering an abort when it's signaled.
|
||||
* @param[out] out_event Output Event with autoclear=false.
|
||||
*/
|
||||
Result appletGetGpuErrorDetectedSystemEvent(Event *out_event);
|
||||
|
||||
///@}
|
||||
|
||||
///@name State / other
|
||||
///@{
|
||||
|
||||
|
@ -1926,7 +1926,6 @@ Result appletRequestLaunchApplicationForQuest(u64 application_id, AppletStorage*
|
||||
}
|
||||
|
||||
IPC_MAKE_CMD_IMPL_INITEXPR(Result appletGetDesiredLanguage(u64 *LanguageCode), &g_appletIFunctions, 21, _appletCmdNoInOutU64, !_appletIsApplication(), LanguageCode)
|
||||
IPC_MAKE_CMD_IMPL_INITEXPR(Result appletSetTerminateResult(Result res), &g_appletIFunctions, 22, _appletCmdInU32NoOut, !_appletIsApplication(), res)
|
||||
|
||||
Result appletGetDisplayVersion(char *displayVersion) {
|
||||
char out[0x10]={0};
|
||||
@ -1945,24 +1944,6 @@ Result appletGetDisplayVersion(char *displayVersion) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result appletGetLaunchStorageInfoForDebug(NcmStorageId *app_storageId, NcmStorageId *update_storageId) {
|
||||
if (!serviceIsActive(&g_appletSrv) || !_appletIsApplication())
|
||||
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
if (hosversionBefore(2,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
struct {
|
||||
u8 app_storageId;
|
||||
u8 update_storageId;
|
||||
} out;
|
||||
|
||||
serviceAssumeDomain(&g_appletIFunctions);
|
||||
Result rc = serviceDispatchOut(&g_appletIFunctions, 24, out);
|
||||
if (R_SUCCEEDED(rc) && app_storageId) *app_storageId = out.app_storageId;
|
||||
if (R_SUCCEEDED(rc) && update_storageId) *update_storageId = out.update_storageId;
|
||||
return rc;
|
||||
}
|
||||
|
||||
IPC_MAKE_CMD_IMPL_INITEXPR(Result appletBeginBlockingHomeButtonShortAndLongPressed(s64 val), &g_appletIFunctions, 30, _appletCmdInU64NoOut, !_appletIsApplication(), val)
|
||||
IPC_MAKE_CMD_IMPL_INITEXPR(Result appletEndBlockingHomeButtonShortAndLongPressed(void), &g_appletIFunctions, 31, _appletCmdNoIO, !_appletIsApplication())
|
||||
IPC_MAKE_CMD_IMPL_INITEXPR(Result appletBeginBlockingHomeButton(s64 val), &g_appletIFunctions, 32, _appletCmdInU64NoOut, !_appletIsApplication(), val)
|
||||
@ -2238,7 +2219,6 @@ Result appletRestartProgram(const void* buffer, size_t size) {
|
||||
}
|
||||
|
||||
IPC_MAKE_CMD_IMPL_INITEXPR_HOSVER(Result appletGetPreviousProgramIndex(s32 *programIndex), &g_appletIFunctions, 123, _appletCmdNoInOutU32, !_appletIsApplication(), (5,0,0), (u32*)programIndex)
|
||||
IPC_MAKE_CMD_IMPL_INITEXPR_HOSVER(Result appletGetGpuErrorDetectedSystemEvent(Event *out_event), &g_appletIFunctions, 130, _appletCmdGetEvent, !_appletIsApplication(), (8,0,0), out_event, false)
|
||||
IPC_MAKE_CMD_IMPL_INITEXPR_HOSVER(Result appletCreateMovieMaker(Service* srv_out, TransferMemory *tmem), &g_appletIFunctions, 1000, _appletCmdInTmemOutSession, !_appletIsApplication(), (5,0,0), srv_out, tmem)
|
||||
IPC_MAKE_CMD_IMPL_INITEXPR_HOSVER(Result appletPrepareForJit(void), &g_appletIFunctions, 1001, _appletCmdNoIO, !_appletIsApplication(), (5,0,0))
|
||||
|
||||
@ -2677,6 +2657,65 @@ Result appletGetAppletResourceUsageInfo(AppletResourceUsageInfo *info) {
|
||||
return serviceDispatchOut(&g_appletIDebugFunctions, 40, *info);
|
||||
}
|
||||
|
||||
// Common cmds
|
||||
Result appletSetTerminateResult(Result res) {
|
||||
if (!serviceIsActive(&g_appletSrv) || (!_appletIsApplication() && !serviceIsActive(&g_appletIAppletCommonFunctions)))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
if (serviceIsActive(&g_appletIAppletCommonFunctions) && hosversionBefore(9,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
Service *srv = &g_appletIFunctions;
|
||||
u32 cmd_id = 22;
|
||||
if (serviceIsActive(&g_appletIAppletCommonFunctions)) {
|
||||
srv = &g_appletIAppletCommonFunctions;
|
||||
cmd_id = 0;
|
||||
}
|
||||
|
||||
return _appletCmdInU32NoOut(srv, res, cmd_id);
|
||||
}
|
||||
|
||||
Result appletGetLaunchStorageInfoForDebug(NcmStorageId *app_storageId, NcmStorageId *update_storageId) {
|
||||
if (!serviceIsActive(&g_appletSrv) || (!_appletIsApplication() && __nx_applet_type != AppletType_LibraryApplet))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
if (_appletIsApplication() && hosversionBefore(2,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
if (__nx_applet_type == AppletType_LibraryApplet && hosversionBefore(9,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
Service *srv = &g_appletIFunctions;
|
||||
u32 cmd_id = 24;
|
||||
if (__nx_applet_type == AppletType_LibraryApplet) {
|
||||
srv = &g_appletILibraryAppletSelfAccessor;
|
||||
cmd_id = 120;
|
||||
}
|
||||
|
||||
struct {
|
||||
u8 app_storageId;
|
||||
u8 update_storageId;
|
||||
} out;
|
||||
|
||||
serviceAssumeDomain(srv);
|
||||
Result rc = serviceDispatchOut(srv, cmd_id, out);
|
||||
if (R_SUCCEEDED(rc) && app_storageId) *app_storageId = out.app_storageId;
|
||||
if (R_SUCCEEDED(rc) && update_storageId) *update_storageId = out.update_storageId;
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result appletGetGpuErrorDetectedSystemEvent(Event *out_event) {
|
||||
if (!serviceIsActive(&g_appletSrv) || (!_appletIsApplication() && __nx_applet_type != AppletType_LibraryApplet))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
if (_appletIsApplication() && hosversionBefore(8,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
if (__nx_applet_type == AppletType_LibraryApplet && hosversionBefore(9,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
Service *srv = &g_appletIFunctions;
|
||||
if (__nx_applet_type == AppletType_LibraryApplet)
|
||||
srv = &g_appletILibraryAppletSelfAccessor;
|
||||
|
||||
return _appletCmdGetEvent(srv, out_event, false, 130);
|
||||
}
|
||||
|
||||
// State / other
|
||||
|
||||
AppletOperationMode appletGetOperationMode(void) {
|
||||
|
Loading…
Reference in New Issue
Block a user