mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +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);
|
||||
|
||||
/**
|
||||
* @brief Check whether SM is initialized.
|
||||
* @return true if initialized.
|
||||
*/
|
||||
bool smHasInitialized(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the Service session used to communicate with SM.
|
||||
* @return Pointer to service session used to communicate with SM.
|
||||
|
@ -17,29 +17,27 @@ static void _fatalImpl(u32 cmd_id, Result err, FatalType type, FatalContext *ctx
|
||||
svcBreak(0x80000000, err, 0);
|
||||
}
|
||||
|
||||
if (!smHasInitialized()) {
|
||||
rc = smInitialize();
|
||||
Handle session;
|
||||
rc = smInitialize();
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
rc = smGetServiceOriginal(&session, smEncodeName("fatal:u"));
|
||||
smExit();
|
||||
}
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
Handle srv;
|
||||
rc = smGetServiceOriginal(&srv, smEncodeName("fatal:u"));
|
||||
const struct {
|
||||
u32 result;
|
||||
u32 type;
|
||||
u64 pid_placeholder;
|
||||
} in = { err, type };
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
const struct {
|
||||
u32 result;
|
||||
u32 type;
|
||||
u64 pid_placeholder;
|
||||
} in = { err, type };
|
||||
|
||||
Service s;
|
||||
serviceCreate(&s, srv);
|
||||
serviceDispatchIn(&s, cmd_id, in,
|
||||
.buffer_attrs = { ctx ? (SfBufferAttr_In | SfBufferAttr_HipcMapAlias) : 0U },
|
||||
.buffers = { { ctx, sizeof(*ctx) } },
|
||||
.in_send_pid = true,
|
||||
);
|
||||
}
|
||||
Service s;
|
||||
serviceCreate(&s, session);
|
||||
serviceDispatchIn(&s, cmd_id, in,
|
||||
.buffer_attrs = { ctx ? (SfBufferAttr_In | SfBufferAttr_HipcMapAlias) : 0U },
|
||||
.buffers = { { ctx, sizeof(*ctx) } },
|
||||
.in_send_pid = true,
|
||||
);
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
|
@ -44,9 +44,6 @@ Handle smGetServiceOverride(u64 name)
|
||||
return INVALID_HANDLE;
|
||||
}
|
||||
|
||||
bool smHasInitialized(void) {
|
||||
return serviceIsActive(&g_smSrv);
|
||||
}
|
||||
|
||||
Result smInitialize(void)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user