sm: Remove smHasInitialized (use Initialize+GetService+Exit instead)

This commit is contained in:
fincs 2019-09-19 23:47:37 +02:00
parent 43ad77e8d2
commit dedd29b431
No known key found for this signature in database
GPG Key ID: 62C7609ADA219C60
3 changed files with 17 additions and 28 deletions

View File

@ -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.

View File

@ -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:

View File

@ -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)
{ {