1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-12 23:16:40 +00:00

ro: only hold sm session open when needed

This commit is contained in:
Michael Scire 2019-04-22 13:17:57 -07:00
parent 30485f1df9
commit 13c825a8bb
2 changed files with 31 additions and 33 deletions

View file

@ -69,11 +69,7 @@ void __appInit(void) {
SetFirmwareVersionForLibnx(); SetFirmwareVersionForLibnx();
rc = smInitialize(); DoWithSmSession([&]() {
if (R_FAILED(rc)) {
std::abort();
}
rc = setsysInitialize(); rc = setsysInitialize();
if (R_FAILED(rc)) { if (R_FAILED(rc)) {
std::abort(); std::abort();
@ -95,6 +91,7 @@ void __appInit(void) {
if (R_FAILED(rc)) { if (R_FAILED(rc)) {
std::abort(); std::abort();
} }
});
CheckAtmosphereVersion(CURRENT_ATMOSPHERE_VERSION); CheckAtmosphereVersion(CURRENT_ATMOSPHERE_VERSION);
} }
@ -106,7 +103,6 @@ void __appExit(void) {
pminfoExit(); pminfoExit();
} }
setsysExit(); setsysExit();
smExit();
} }
/* Helpers to create RO objects. */ /* Helpers to create RO objects. */

View file

@ -30,9 +30,11 @@ static Registration::RoProcessContext g_process_contexts[Registration::MaxSessio
static bool g_is_development_hardware, g_is_development_function_enabled; static bool g_is_development_hardware, g_is_development_function_enabled;
void Registration::Initialize() { void Registration::Initialize() {
DoWithSmSession([&]() {
if (R_FAILED(splInitialize())) { if (R_FAILED(splInitialize())) {
std::abort(); std::abort();
} }
});
ON_SCOPE_EXIT { splExit(); }; ON_SCOPE_EXIT { splExit(); };
if (R_FAILED(splIsDevelopment(&g_is_development_hardware))) { if (R_FAILED(splIsDevelopment(&g_is_development_hardware))) {