mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-22 04:52:39 +02:00
sm: Remove smHasInitialized (use Initialize+GetService+Exit instead)
This commit is contained in:
parent
43ad77e8d2
commit
dedd29b431
@ -151,12 +151,6 @@ Result smRegisterService(Handle* handle_out, const char* name, bool is_light, in
|
|||||||
*/
|
*/
|
||||||
Result smUnregisterService(const char* name);
|
Result smUnregisterService(const char* name);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Check whether SM is initialized.
|
|
||||||
* @return true if initialized.
|
|
||||||
*/
|
|
||||||
bool smHasInitialized(void);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets the Service session used to communicate with SM.
|
* @brief Gets the Service session used to communicate with SM.
|
||||||
* @return Pointer to service session used to communicate with SM.
|
* @return Pointer to service session used to communicate with SM.
|
||||||
|
@ -17,13 +17,12 @@ static void _fatalImpl(u32 cmd_id, Result err, FatalType type, FatalContext *ctx
|
|||||||
svcBreak(0x80000000, err, 0);
|
svcBreak(0x80000000, err, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!smHasInitialized()) {
|
Handle session;
|
||||||
rc = smInitialize();
|
rc = smInitialize();
|
||||||
}
|
|
||||||
|
|
||||||
if (R_SUCCEEDED(rc)) {
|
if (R_SUCCEEDED(rc)) {
|
||||||
Handle srv;
|
rc = smGetServiceOriginal(&session, smEncodeName("fatal:u"));
|
||||||
rc = smGetServiceOriginal(&srv, smEncodeName("fatal:u"));
|
smExit();
|
||||||
|
}
|
||||||
|
|
||||||
if (R_SUCCEEDED(rc)) {
|
if (R_SUCCEEDED(rc)) {
|
||||||
const struct {
|
const struct {
|
||||||
@ -33,14 +32,13 @@ static void _fatalImpl(u32 cmd_id, Result err, FatalType type, FatalContext *ctx
|
|||||||
} in = { err, type };
|
} in = { err, type };
|
||||||
|
|
||||||
Service s;
|
Service s;
|
||||||
serviceCreate(&s, srv);
|
serviceCreate(&s, session);
|
||||||
serviceDispatchIn(&s, cmd_id, in,
|
serviceDispatchIn(&s, cmd_id, in,
|
||||||
.buffer_attrs = { ctx ? (SfBufferAttr_In | SfBufferAttr_HipcMapAlias) : 0U },
|
.buffer_attrs = { ctx ? (SfBufferAttr_In | SfBufferAttr_HipcMapAlias) : 0U },
|
||||||
.buffers = { { ctx, sizeof(*ctx) } },
|
.buffers = { { ctx, sizeof(*ctx) } },
|
||||||
.in_send_pid = true,
|
.in_send_pid = true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case FatalType_ErrorReport:
|
case FatalType_ErrorReport:
|
||||||
|
@ -44,9 +44,6 @@ Handle smGetServiceOverride(u64 name)
|
|||||||
return INVALID_HANDLE;
|
return INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool smHasInitialized(void) {
|
|
||||||
return serviceIsActive(&g_smSrv);
|
|
||||||
}
|
|
||||||
|
|
||||||
Result smInitialize(void)
|
Result smInitialize(void)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user