mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-22 20:31:14 +00:00
strat: no longer materially constrained by sm session limit
This commit is contained in:
parent
997e4dd665
commit
2e1a93f1d1
37 changed files with 215 additions and 333 deletions
|
@ -19,7 +19,6 @@
|
||||||
#include <stratosphere/sm/sm_types.hpp>
|
#include <stratosphere/sm/sm_types.hpp>
|
||||||
#include <stratosphere/sm/sm_api.hpp>
|
#include <stratosphere/sm/sm_api.hpp>
|
||||||
#include <stratosphere/sm/sm_mitm_api.hpp>
|
#include <stratosphere/sm/sm_mitm_api.hpp>
|
||||||
#include <stratosphere/sm/sm_scoped_holder.hpp>
|
|
||||||
|
|
||||||
#include <stratosphere/sm/sm_manager_api.hpp>
|
#include <stratosphere/sm/sm_manager_api.hpp>
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,10 @@
|
||||||
|
|
||||||
namespace ams::sm {
|
namespace ams::sm {
|
||||||
|
|
||||||
|
/* Initialization. */
|
||||||
|
Result Initialize();
|
||||||
|
Result Finalize();
|
||||||
|
|
||||||
/* Ordinary SM API. */
|
/* Ordinary SM API. */
|
||||||
Result GetService(Service *out, ServiceName name);
|
Result GetService(Service *out, ServiceName name);
|
||||||
Result RegisterService(Handle *out, ServiceName name, size_t max_sessions, bool is_light);
|
Result RegisterService(Handle *out, ServiceName name, size_t max_sessions, bool is_light);
|
||||||
|
@ -29,17 +33,4 @@ namespace ams::sm {
|
||||||
Result HasService(bool *out, ServiceName name);
|
Result HasService(bool *out, ServiceName name);
|
||||||
Result WaitService(ServiceName name);
|
Result WaitService(ServiceName name);
|
||||||
|
|
||||||
/* Scoped session access. */
|
|
||||||
namespace impl {
|
|
||||||
|
|
||||||
void DoWithSessionImpl(void (*Invoker)(void *), void *Function);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename F>
|
|
||||||
NX_CONSTEXPR void DoWithSession(F f) {
|
|
||||||
auto invoker = +[](void *func) { (*(F *)func)(); };
|
|
||||||
impl::DoWithSessionImpl(invoker, &f);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,91 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU General Public License,
|
|
||||||
* version 2, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "sm_api.hpp"
|
|
||||||
|
|
||||||
namespace ams::sm {
|
|
||||||
|
|
||||||
/* Utility, for scoped access to libnx services. */
|
|
||||||
template<auto Initializer(), void Finalizer()>
|
|
||||||
class ScopedServiceHolder {
|
|
||||||
NON_COPYABLE(ScopedServiceHolder);
|
|
||||||
private:
|
|
||||||
Result result;
|
|
||||||
bool has_initialized;
|
|
||||||
public:
|
|
||||||
ScopedServiceHolder(bool initialize = true) : result(ResultSuccess()), has_initialized(false) {
|
|
||||||
if (initialize) {
|
|
||||||
this->Initialize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
~ScopedServiceHolder() {
|
|
||||||
if (this->has_initialized) {
|
|
||||||
this->Finalize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ScopedServiceHolder(ScopedServiceHolder&& rhs) {
|
|
||||||
this->result = rhs.result;
|
|
||||||
this->has_initialized = rhs.has_initialized;
|
|
||||||
rhs.result = ResultSuccess();
|
|
||||||
rhs.has_initialized = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ScopedServiceHolder &operator=(ScopedServiceHolder&& rhs) {
|
|
||||||
rhs.Swap(*this);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Swap(ScopedServiceHolder &rhs) {
|
|
||||||
std::swap(this->result, rhs.result);
|
|
||||||
std::swap(this->has_initialized, rhs.has_initialized);
|
|
||||||
}
|
|
||||||
|
|
||||||
explicit operator bool() const {
|
|
||||||
return this->has_initialized;
|
|
||||||
}
|
|
||||||
|
|
||||||
Result Initialize() {
|
|
||||||
AMS_ABORT_UNLESS(!this->has_initialized);
|
|
||||||
|
|
||||||
sm::DoWithSession([&]() {
|
|
||||||
if constexpr (std::is_same<decltype(Initializer()), void>::value) {
|
|
||||||
Initializer();
|
|
||||||
this->result = ResultSuccess();
|
|
||||||
} else {
|
|
||||||
this->result = Initializer();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this->has_initialized = R_SUCCEEDED(this->result);
|
|
||||||
return this->result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Finalize() {
|
|
||||||
AMS_ABORT_UNLESS(this->has_initialized);
|
|
||||||
Finalizer();
|
|
||||||
this->has_initialized = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Result GetResult() const {
|
|
||||||
return this->result;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
|
@ -387,8 +387,8 @@ namespace ams::boot2 {
|
||||||
/* NOTE: Here we work around a race condition in the boot process by ensuring that settings initializes its db. */
|
/* NOTE: Here we work around a race condition in the boot process by ensuring that settings initializes its db. */
|
||||||
{
|
{
|
||||||
/* Connect to set:sys. */
|
/* Connect to set:sys. */
|
||||||
sm::ScopedServiceHolder<::setsysInitialize, ::setsysExit> setsys_holder;
|
R_ABORT_UNLESS(::setsysInitialize());
|
||||||
AMS_ABORT_UNLESS(setsys_holder);
|
ON_SCOPE_EXIT { ::setsysExit(); };
|
||||||
|
|
||||||
/* Retrieve setting from the database. */
|
/* Retrieve setting from the database. */
|
||||||
u8 force_maintenance = 0;
|
u8 force_maintenance = 0;
|
||||||
|
@ -424,9 +424,7 @@ namespace ams::boot2 {
|
||||||
InitializeFsHeapForCleanup();
|
InitializeFsHeapForCleanup();
|
||||||
|
|
||||||
/* Temporarily initialize fs. */
|
/* Temporarily initialize fs. */
|
||||||
sm::DoWithSession([&] {
|
|
||||||
R_ABORT_UNLESS(fsInitialize());
|
R_ABORT_UNLESS(fsInitialize());
|
||||||
});
|
|
||||||
ON_SCOPE_EXIT { fsExit(); };
|
ON_SCOPE_EXIT { fsExit(); };
|
||||||
|
|
||||||
/* Wait for the sd card to be available. */
|
/* Wait for the sd card to be available. */
|
||||||
|
|
|
@ -19,29 +19,28 @@ namespace ams::crypto {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
bool g_initialized;
|
constinit bool g_initialized = false;
|
||||||
os::Mutex g_lock(false);
|
constinit os::SdkMutex g_lock;
|
||||||
|
|
||||||
void InitializeCsrng() {
|
void InitializeCsrng() {
|
||||||
AMS_ASSERT(!g_initialized);
|
AMS_ASSERT(!g_initialized);
|
||||||
sm::DoWithSession([&]() {
|
R_ABORT_UNLESS(sm::Initialize());
|
||||||
R_ABORT_UNLESS(::csrngInitialize());
|
R_ABORT_UNLESS(::csrngInitialize());
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenerateCryptographicallyRandomBytes(void *dst, size_t dst_size) {
|
void GenerateCryptographicallyRandomBytes(void *dst, size_t dst_size) {
|
||||||
{
|
if (AMS_UNLIKELY(!g_initialized)) {
|
||||||
std::scoped_lock lk(g_lock);
|
std::scoped_lock lk(g_lock);
|
||||||
|
|
||||||
if (AMS_UNLIKELY(!g_initialized)) {
|
if (AMS_LIKELY(!g_initialized)) {
|
||||||
InitializeCsrng();
|
InitializeCsrng();
|
||||||
g_initialized = true;
|
g_initialized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
R_ABORT_UNLESS(csrngGetRandomBytes(dst, dst_size));
|
R_ABORT_UNLESS(::csrngGetRandomBytes(dst, dst_size));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,8 @@ namespace ams::gpio::driver::board::nintendo::nx::impl {
|
||||||
|
|
||||||
spl::HardwareType GetHardwareType() {
|
spl::HardwareType GetHardwareType() {
|
||||||
/* Acquire access to spl: */
|
/* Acquire access to spl: */
|
||||||
sm::ScopedServiceHolder<spl::Initialize, spl::Finalize> spl_holder;
|
spl::Initialize();
|
||||||
AMS_ABORT_UNLESS(static_cast<bool>(spl_holder));
|
ON_SCOPE_EXIT { spl::Finalize(); };
|
||||||
|
|
||||||
/* Get config. */
|
/* Get config. */
|
||||||
return ::ams::spl::GetHardwareType();
|
return ::ams::spl::GetHardwareType();
|
||||||
|
|
|
@ -40,12 +40,11 @@ namespace ams::hid {
|
||||||
|
|
||||||
/* Helper. */
|
/* Helper. */
|
||||||
void InitializeHid() {
|
void InitializeHid() {
|
||||||
sm::DoWithSession([&]() {
|
R_ABORT_UNLESS(sm::Initialize());
|
||||||
R_ABORT_UNLESS(hidInitialize());
|
R_ABORT_UNLESS(hidInitialize());
|
||||||
hidInitializeNpad();
|
hidInitializeNpad();
|
||||||
R_ABORT_UNLESS(hidSetSupportedNpadIdType(NpadIdTypes, NumNpadIdTypes));
|
R_ABORT_UNLESS(hidSetSupportedNpadIdType(NpadIdTypes, NumNpadIdTypes));
|
||||||
R_ABORT_UNLESS(hidSetSupportedNpadStyleSet(HidNpadStyleSet_NpadStandard | HidNpadStyleTag_NpadSystemExt));
|
R_ABORT_UNLESS(hidSetSupportedNpadStyleSet(HidNpadStyleSet_NpadStandard | HidNpadStyleTag_NpadSystemExt));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Result EnsureHidInitialized() {
|
Result EnsureHidInitialized() {
|
||||||
|
|
|
@ -229,10 +229,11 @@ namespace ams::htcs::client {
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitializeSessionManager(tma::IHtcsManager **out_manager, tma::IHtcsManager **out_monitor, u32 num_sessions) {
|
void InitializeSessionManager(tma::IHtcsManager **out_manager, tma::IHtcsManager **out_monitor, u32 num_sessions) {
|
||||||
|
/* Ensure we can contact the libnx wrapper. */
|
||||||
|
R_ABORT_UNLESS(sm::Initialize());
|
||||||
|
|
||||||
/* Initialize the libnx wrapper. */
|
/* Initialize the libnx wrapper. */
|
||||||
sm::DoWithSession([&] {
|
|
||||||
R_ABORT_UNLESS(::htcsInitialize(num_sessions));
|
R_ABORT_UNLESS(::htcsInitialize(num_sessions));
|
||||||
});
|
|
||||||
|
|
||||||
/* Create the output objects. */
|
/* Create the output objects. */
|
||||||
*out_manager = ObjectFactory::CreateSharedEmplaced<tma::IHtcsManager, RemoteManager>().Detach();
|
*out_manager = ObjectFactory::CreateSharedEmplaced<tma::IHtcsManager, RemoteManager>().Detach();
|
||||||
|
|
|
@ -18,47 +18,52 @@
|
||||||
|
|
||||||
namespace ams::sm {
|
namespace ams::sm {
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
constinit int g_ref_count = 0;
|
||||||
|
constinit os::SdkMutex g_mutex;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialization. */
|
||||||
|
Result Initialize() {
|
||||||
|
std::scoped_lock lk(g_mutex);
|
||||||
|
|
||||||
|
if (g_ref_count > 0) {
|
||||||
|
++g_ref_count;
|
||||||
|
} else {
|
||||||
|
R_TRY(::smInitialize());
|
||||||
|
g_ref_count = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResultSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result Finalize() {
|
||||||
|
/* NOTE: Nintendo does nothing here. */
|
||||||
|
return ResultSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
/* Ordinary SM API. */
|
/* Ordinary SM API. */
|
||||||
Result GetService(Service *out, ServiceName name) {
|
Result GetService(Service *out, ServiceName name) {
|
||||||
return impl::DoWithUserSession([&]() {
|
|
||||||
return smGetServiceWrapper(out, impl::ConvertName(name));
|
return smGetServiceWrapper(out, impl::ConvertName(name));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RegisterService(Handle *out, ServiceName name, size_t max_sessions, bool is_light) {
|
Result RegisterService(Handle *out, ServiceName name, size_t max_sessions, bool is_light) {
|
||||||
return impl::DoWithUserSession([&]() {
|
|
||||||
return smRegisterService(out, impl::ConvertName(name), is_light, static_cast<int>(max_sessions));
|
return smRegisterService(out, impl::ConvertName(name), is_light, static_cast<int>(max_sessions));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Result UnregisterService(ServiceName name) {
|
Result UnregisterService(ServiceName name) {
|
||||||
return impl::DoWithUserSession([&]() {
|
|
||||||
return smUnregisterService(impl::ConvertName(name));
|
return smUnregisterService(impl::ConvertName(name));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Atmosphere extensions. */
|
/* Atmosphere extensions. */
|
||||||
Result HasService(bool *out, ServiceName name) {
|
Result HasService(bool *out, ServiceName name) {
|
||||||
return impl::DoWithUserSession([&]() {
|
|
||||||
return smAtmosphereHasService(out, impl::ConvertName(name));
|
return smAtmosphereHasService(out, impl::ConvertName(name));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Result WaitService(ServiceName name) {
|
Result WaitService(ServiceName name) {
|
||||||
return impl::DoWithUserSession([&]() {
|
|
||||||
return smAtmosphereWaitService(impl::ConvertName(name));
|
return smAtmosphereWaitService(impl::ConvertName(name));
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace impl {
|
|
||||||
|
|
||||||
void DoWithSessionImpl(void (*Invoker)(void *), void *Function) {
|
|
||||||
impl::DoWithUserSession([&]() {
|
|
||||||
Invoker(Function);
|
|
||||||
return ResultSuccess();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,21 +26,15 @@ namespace ams::sm::mitm {
|
||||||
}
|
}
|
||||||
|
|
||||||
Result UninstallMitm(ServiceName name) {
|
Result UninstallMitm(ServiceName name) {
|
||||||
return impl::DoWithUserSession([&]() {
|
|
||||||
return smAtmosphereMitmUninstall(impl::ConvertName(name));
|
return smAtmosphereMitmUninstall(impl::ConvertName(name));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Result DeclareFutureMitm(ServiceName name) {
|
Result DeclareFutureMitm(ServiceName name) {
|
||||||
return impl::DoWithUserSession([&]() {
|
|
||||||
return smAtmosphereMitmDeclareFuture(impl::ConvertName(name));
|
return smAtmosphereMitmDeclareFuture(impl::ConvertName(name));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ClearFutureMitm(ServiceName name) {
|
Result ClearFutureMitm(ServiceName name) {
|
||||||
return impl::DoWithUserSession([&]() {
|
|
||||||
return smAtmosphereMitmClearFuture(impl::ConvertName(name));
|
return smAtmosphereMitmClearFuture(impl::ConvertName(name));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Result AcknowledgeSession(Service *out_service, MitmProcessInfo *out_info, ServiceName name) {
|
Result AcknowledgeSession(Service *out_service, MitmProcessInfo *out_info, ServiceName name) {
|
||||||
|
@ -50,15 +44,11 @@ namespace ams::sm::mitm {
|
||||||
}
|
}
|
||||||
|
|
||||||
Result HasMitm(bool *out, ServiceName name) {
|
Result HasMitm(bool *out, ServiceName name) {
|
||||||
return impl::DoWithUserSession([&]() {
|
|
||||||
return smAtmosphereHasMitm(out, impl::ConvertName(name));
|
return smAtmosphereHasMitm(out, impl::ConvertName(name));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Result WaitMitm(ServiceName name) {
|
Result WaitMitm(ServiceName name) {
|
||||||
return impl::DoWithUserSession([&]() {
|
|
||||||
return smAtmosphereWaitMitm(impl::ConvertName(name));
|
return smAtmosphereWaitMitm(impl::ConvertName(name));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,17 +21,12 @@ namespace ams::sm::impl {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
/* Globals. */
|
/* Globals. */
|
||||||
os::Mutex g_user_session_mutex(true);
|
constinit os::Mutex g_mitm_ack_session_mutex(true);
|
||||||
os::Mutex g_mitm_ack_session_mutex(true);
|
constinit os::Mutex g_per_thread_session_mutex(true);
|
||||||
os::Mutex g_per_thread_session_mutex(true);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Utilities. */
|
/* Utilities. */
|
||||||
os::Mutex &GetUserSessionMutex() {
|
|
||||||
return g_user_session_mutex;
|
|
||||||
}
|
|
||||||
|
|
||||||
os::Mutex &GetMitmAcknowledgementSessionMutex() {
|
os::Mutex &GetMitmAcknowledgementSessionMutex() {
|
||||||
return g_mitm_ack_session_mutex;
|
return g_mitm_ack_session_mutex;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,24 +21,9 @@
|
||||||
namespace ams::sm::impl {
|
namespace ams::sm::impl {
|
||||||
|
|
||||||
/* Utilities. */
|
/* Utilities. */
|
||||||
os::Mutex &GetUserSessionMutex();
|
|
||||||
os::Mutex &GetMitmAcknowledgementSessionMutex();
|
os::Mutex &GetMitmAcknowledgementSessionMutex();
|
||||||
os::Mutex &GetPerThreadSessionMutex();
|
os::Mutex &GetPerThreadSessionMutex();
|
||||||
|
|
||||||
template<typename F>
|
|
||||||
Result DoWithUserSession(F f) {
|
|
||||||
std::scoped_lock lk(GetUserSessionMutex());
|
|
||||||
{
|
|
||||||
R_ABORT_UNLESS(smInitialize());
|
|
||||||
ON_SCOPE_EXIT {
|
|
||||||
R_ABORT_UNLESS(smDetachClient());
|
|
||||||
smExit();
|
|
||||||
};
|
|
||||||
|
|
||||||
return f();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename F>
|
template<typename F>
|
||||||
Result DoWithMitmAcknowledgementSession(F f) {
|
Result DoWithMitmAcknowledgementSession(F f) {
|
||||||
std::scoped_lock lk(GetMitmAcknowledgementSessionMutex());
|
std::scoped_lock lk(GetMitmAcknowledgementSessionMutex());
|
||||||
|
|
|
@ -197,9 +197,8 @@ namespace ams::socket::impl {
|
||||||
|
|
||||||
const auto service_type = config.IsSystemClient() ? (1 << 1) : (1 << 0);
|
const auto service_type = config.IsSystemClient() ? (1 << 1) : (1 << 0);
|
||||||
|
|
||||||
sm::DoWithSession([&] {
|
R_ABORT_UNLESS(sm::Initialize());
|
||||||
R_ABORT_UNLESS(::bsdInitialize(std::addressof(libnx_config), static_cast<u32>(config.GetConcurrencyCountMax()), service_type));
|
R_ABORT_UNLESS(::bsdInitialize(std::addressof(libnx_config), static_cast<u32>(config.GetConcurrencyCountMax()), service_type));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the heap generation. */
|
/* Set the heap generation. */
|
||||||
|
|
|
@ -549,8 +549,8 @@ namespace ams::updater {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get a session to ncm. */
|
/* Get a session to ncm. */
|
||||||
sm::ScopedServiceHolder<ncm::Initialize, ncm::Finalize> ncm_holder;
|
ncm::Initialize();
|
||||||
R_ABORT_UNLESS(ncm_holder.GetResult());
|
ON_SCOPE_EXIT { ncm::Finalize(); };
|
||||||
|
|
||||||
/* Verify normal, verify safe as needed. */
|
/* Verify normal, verify safe as needed. */
|
||||||
if (verification_state.needs_verify_normal) {
|
if (verification_state.needs_verify_normal) {
|
||||||
|
|
|
@ -58,7 +58,9 @@ namespace ams::sdmmc::impl {
|
||||||
|
|
||||||
void DeviceDetector::DetectorThread() {
|
void DeviceDetector::DetectorThread() {
|
||||||
/* Initialize the gpio session. */
|
/* Initialize the gpio session. */
|
||||||
sm::DoWithSession([] { gpio::Initialize(); });
|
gpio::Initialize();
|
||||||
|
|
||||||
|
/* Open and configure the pad session. */
|
||||||
gpio::OpenSession(std::addressof(this->gpio_pad_session), this->gpio_device_code);
|
gpio::OpenSession(std::addressof(this->gpio_pad_session), this->gpio_device_code);
|
||||||
gpio::SetDirection(std::addressof(this->gpio_pad_session), gpio::Direction_Input);
|
gpio::SetDirection(std::addressof(this->gpio_pad_session), gpio::Direction_Input);
|
||||||
gpio::SetDebounceTime(std::addressof(this->gpio_pad_session), this->gpio_debounce_ms);
|
gpio::SetDebounceTime(std::addressof(this->gpio_pad_session), this->gpio_debounce_ms);
|
||||||
|
|
|
@ -110,9 +110,9 @@ void __appInit(void) {
|
||||||
/* Disable FS auto-abort. */
|
/* Disable FS auto-abort. */
|
||||||
fs::SetEnabledAutoAbort(false);
|
fs::SetEnabledAutoAbort(false);
|
||||||
|
|
||||||
sm::DoWithSession([&]() {
|
R_ABORT_UNLESS(sm::Initialize());
|
||||||
|
|
||||||
R_ABORT_UNLESS(fsInitialize());
|
R_ABORT_UNLESS(fsInitialize());
|
||||||
});
|
|
||||||
|
|
||||||
ams::CheckApiVersion();
|
ams::CheckApiVersion();
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,10 +172,8 @@ namespace ams::mitm {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Connect to set:sys. */
|
/* Connect to set:sys. */
|
||||||
sm::DoWithSession([]() {
|
|
||||||
R_ABORT_UNLESS(setInitialize());
|
R_ABORT_UNLESS(setInitialize());
|
||||||
R_ABORT_UNLESS(setsysInitialize());
|
R_ABORT_UNLESS(setsysInitialize());
|
||||||
});
|
|
||||||
|
|
||||||
/* Load settings off the SD card. */
|
/* Load settings off the SD card. */
|
||||||
settings::fwdbg::InitializeSdCardKeyValueStore();
|
settings::fwdbg::InitializeSdCardKeyValueStore();
|
||||||
|
|
|
@ -76,13 +76,13 @@ void __libnx_initheap(void) {
|
||||||
void __appInit(void) {
|
void __appInit(void) {
|
||||||
hos::InitializeForStratosphere();
|
hos::InitializeForStratosphere();
|
||||||
|
|
||||||
sm::DoWithSession([&]() {
|
R_ABORT_UNLESS(sm::Initialize());
|
||||||
|
|
||||||
R_ABORT_UNLESS(fsInitialize());
|
R_ABORT_UNLESS(fsInitialize());
|
||||||
R_ABORT_UNLESS(pmdmntInitialize());
|
R_ABORT_UNLESS(pmdmntInitialize());
|
||||||
R_ABORT_UNLESS(pminfoInitialize());
|
R_ABORT_UNLESS(pminfoInitialize());
|
||||||
ncm::Initialize();
|
ncm::Initialize();
|
||||||
spl::InitializeForFs();
|
spl::InitializeForFs();
|
||||||
});
|
|
||||||
|
|
||||||
/* Disable auto-abort in fs operations. */
|
/* Disable auto-abort in fs operations. */
|
||||||
fs::SetEnabledAutoAbort(false);
|
fs::SetEnabledAutoAbort(false);
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace ams::mitm::sysupdater {
|
||||||
mitm::WaitInitialized();
|
mitm::WaitInitialized();
|
||||||
|
|
||||||
/* Connect to nim. */
|
/* Connect to nim. */
|
||||||
sm::DoWithSession([]() { nim::InitializeForNetworkInstallManager(); });
|
nim::InitializeForNetworkInstallManager();
|
||||||
ON_SCOPE_EXIT { nim::FinalizeForNetworkInstallManager(); };
|
ON_SCOPE_EXIT { nim::FinalizeForNetworkInstallManager(); };
|
||||||
|
|
||||||
/* Register ams:su. */
|
/* Register ams:su. */
|
||||||
|
|
|
@ -126,12 +126,12 @@ void __appInit(void) {
|
||||||
|
|
||||||
fs::SetAllocator(Allocate, Deallocate);
|
fs::SetAllocator(Allocate, Deallocate);
|
||||||
|
|
||||||
/* Initialize services we need (TODO: NCM) */
|
/* Initialize services we need. */
|
||||||
sm::DoWithSession([&]() {
|
R_ABORT_UNLESS(sm::Initialize());
|
||||||
|
|
||||||
R_ABORT_UNLESS(fsInitialize());
|
R_ABORT_UNLESS(fsInitialize());
|
||||||
spl::Initialize();
|
spl::Initialize();
|
||||||
R_ABORT_UNLESS(pmshellInitialize());
|
R_ABORT_UNLESS(pmshellInitialize());
|
||||||
});
|
|
||||||
|
|
||||||
ams::CheckApiVersion();
|
ams::CheckApiVersion();
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,14 +90,14 @@ void __appInit(void) {
|
||||||
fs::SetAllocator(AllocateForFs, DeallocateForFs);
|
fs::SetAllocator(AllocateForFs, DeallocateForFs);
|
||||||
|
|
||||||
/* Initialize services we need. */
|
/* Initialize services we need. */
|
||||||
sm::DoWithSession([&]() {
|
R_ABORT_UNLESS(sm::Initialize());
|
||||||
|
|
||||||
R_ABORT_UNLESS(fsInitialize());
|
R_ABORT_UNLESS(fsInitialize());
|
||||||
R_ABORT_UNLESS(pmbmInitialize());
|
R_ABORT_UNLESS(pmbmInitialize());
|
||||||
R_ABORT_UNLESS(pminfoInitialize());
|
R_ABORT_UNLESS(pminfoInitialize());
|
||||||
R_ABORT_UNLESS(pmshellInitialize());
|
R_ABORT_UNLESS(pmshellInitialize());
|
||||||
R_ABORT_UNLESS(setsysInitialize());
|
R_ABORT_UNLESS(setsysInitialize());
|
||||||
gpio::Initialize();
|
gpio::Initialize();
|
||||||
});
|
|
||||||
|
|
||||||
/* Mount the SD card. */
|
/* Mount the SD card. */
|
||||||
R_ABORT_UNLESS(fs::MountSdCard("sdmc"));
|
R_ABORT_UNLESS(fs::MountSdCard("sdmc"));
|
||||||
|
|
|
@ -41,8 +41,12 @@ namespace ams::creport {
|
||||||
|
|
||||||
/* Try to get the current time. */
|
/* Try to get the current time. */
|
||||||
{
|
{
|
||||||
sm::ScopedServiceHolder<timeInitialize, timeExit> time_holder;
|
if (R_FAILED(::timeInitialize())) {
|
||||||
return time_holder && R_SUCCEEDED(timeGetCurrentTime(TimeType_LocalSystemClock, out));
|
return false;
|
||||||
|
}
|
||||||
|
ON_SCOPE_EXIT { ::timeExit(); };
|
||||||
|
|
||||||
|
return R_SUCCEEDED(::timeGetCurrentTime(TimeType_LocalSystemClock, out));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,8 +341,9 @@ namespace ams::creport {
|
||||||
/* Since we save reports only locally and do not send them via telemetry, we will skip this. */
|
/* Since we save reports only locally and do not send them via telemetry, we will skip this. */
|
||||||
AMS_UNUSED(enable_screenshot);
|
AMS_UNUSED(enable_screenshot);
|
||||||
if (hos::GetVersion() >= hos::Version_9_0_0 && this->IsApplication()) {
|
if (hos::GetVersion() >= hos::Version_9_0_0 && this->IsApplication()) {
|
||||||
sm::ScopedServiceHolder<capsrv::InitializeScreenShotControl, capsrv::FinalizeScreenShotControl> capssc_holder;
|
if (R_SUCCEEDED(capsrv::InitializeScreenShotControl())) {
|
||||||
if (capssc_holder) {
|
ON_SCOPE_EXIT { capsrv::FinalizeScreenShotControl(); };
|
||||||
|
|
||||||
u64 jpeg_size;
|
u64 jpeg_size;
|
||||||
if (R_SUCCEEDED(capsrv::CaptureJpegScreenshot(std::addressof(jpeg_size), this->heap_storage, sizeof(this->heap_storage), vi::LayerStack_ApplicationForDebug, TimeSpan::FromSeconds(10)))) {
|
if (R_SUCCEEDED(capsrv::CaptureJpegScreenshot(std::addressof(jpeg_size), this->heap_storage, sizeof(this->heap_storage), vi::LayerStack_ApplicationForDebug, TimeSpan::FromSeconds(10)))) {
|
||||||
util::SNPrintf(file_path, sizeof(file_path), "sdmc:/atmosphere/crash_reports/%011lu_%016lx.jpg", timestamp, this->process_info.program_id);
|
util::SNPrintf(file_path, sizeof(file_path), "sdmc:/atmosphere/crash_reports/%011lu_%016lx.jpg", timestamp, this->process_info.program_id);
|
||||||
|
|
|
@ -92,9 +92,9 @@ void __appInit(void) {
|
||||||
InitializeFsHeap();
|
InitializeFsHeap();
|
||||||
fs::SetAllocator(AllocateForFs, DeallocateForFs);
|
fs::SetAllocator(AllocateForFs, DeallocateForFs);
|
||||||
|
|
||||||
sm::DoWithSession([&]() {
|
R_ABORT_UNLESS(sm::Initialize());
|
||||||
|
|
||||||
R_ABORT_UNLESS(fsInitialize());
|
R_ABORT_UNLESS(fsInitialize());
|
||||||
});
|
|
||||||
|
|
||||||
R_ABORT_UNLESS(fs::MountSdCard("sdmc"));
|
R_ABORT_UNLESS(fs::MountSdCard("sdmc"));
|
||||||
}
|
}
|
||||||
|
@ -179,14 +179,16 @@ int main(int argc, char **argv) {
|
||||||
if (hos::GetVersion() < hos::Version_11_0_0 || !enable_jit_debug) {
|
if (hos::GetVersion() < hos::Version_11_0_0 || !enable_jit_debug) {
|
||||||
if (hos::GetVersion() >= hos::Version_10_0_0) {
|
if (hos::GetVersion() >= hos::Version_10_0_0) {
|
||||||
/* On 10.0.0+, use pgl to terminate. */
|
/* On 10.0.0+, use pgl to terminate. */
|
||||||
sm::ScopedServiceHolder<pgl::Initialize, pgl::Finalize> pgl_holder;
|
if (R_SUCCEEDED(pgl::Initialize())) {
|
||||||
if (pgl_holder) {
|
ON_SCOPE_EXIT { pgl::Finalize(); };
|
||||||
|
|
||||||
pgl::TerminateProcess(crashed_pid);
|
pgl::TerminateProcess(crashed_pid);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* On < 10.0.0, use ns:dev to terminate. */
|
/* On < 10.0.0, use ns:dev to terminate. */
|
||||||
sm::ScopedServiceHolder<nsdevInitialize, nsdevExit> ns_holder;
|
if (R_SUCCEEDED(::nsdevInitialize())) {
|
||||||
if (ns_holder) {
|
ON_SCOPE_EXIT { ::nsdevExit(); };
|
||||||
|
|
||||||
nsdevTerminateProcess(static_cast<u64>(crashed_pid));
|
nsdevTerminateProcess(static_cast<u64>(crashed_pid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,13 +114,13 @@ void __appInit(void) {
|
||||||
|
|
||||||
fs::SetAllocator(cs::Allocate, cs::Deallocate);
|
fs::SetAllocator(cs::Allocate, cs::Deallocate);
|
||||||
|
|
||||||
sm::DoWithSession([&]() {
|
R_ABORT_UNLESS(sm::Initialize());
|
||||||
|
|
||||||
R_ABORT_UNLESS(fsInitialize());
|
R_ABORT_UNLESS(fsInitialize());
|
||||||
lr::Initialize();
|
lr::Initialize();
|
||||||
R_ABORT_UNLESS(ldr::InitializeForShell());
|
R_ABORT_UNLESS(ldr::InitializeForShell());
|
||||||
R_ABORT_UNLESS(pgl::Initialize());
|
R_ABORT_UNLESS(pgl::Initialize());
|
||||||
/* TODO: Other services? */
|
/* TODO: Other services? */
|
||||||
});
|
|
||||||
|
|
||||||
ams::CheckApiVersion();
|
ams::CheckApiVersion();
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,8 @@ void __appInit(void) {
|
||||||
InitializeFsHeap();
|
InitializeFsHeap();
|
||||||
fs::SetAllocator(AllocateForFs, DeallocateForFs);
|
fs::SetAllocator(AllocateForFs, DeallocateForFs);
|
||||||
|
|
||||||
sm::DoWithSession([&]() {
|
R_ABORT_UNLESS(sm::Initialize());
|
||||||
|
|
||||||
R_ABORT_UNLESS(pmdmntInitialize());
|
R_ABORT_UNLESS(pmdmntInitialize());
|
||||||
R_ABORT_UNLESS(pminfoInitialize());
|
R_ABORT_UNLESS(pminfoInitialize());
|
||||||
R_ABORT_UNLESS(ldrDmntInitialize());
|
R_ABORT_UNLESS(ldrDmntInitialize());
|
||||||
|
@ -94,7 +95,6 @@ void __appInit(void) {
|
||||||
R_ABORT_UNLESS(setsysInitialize());
|
R_ABORT_UNLESS(setsysInitialize());
|
||||||
R_ABORT_UNLESS(hidInitialize());
|
R_ABORT_UNLESS(hidInitialize());
|
||||||
R_ABORT_UNLESS(fsInitialize());
|
R_ABORT_UNLESS(fsInitialize());
|
||||||
});
|
|
||||||
|
|
||||||
R_ABORT_UNLESS(fs::MountSdCard("sdmc"));
|
R_ABORT_UNLESS(fs::MountSdCard("sdmc"));
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,8 @@ void __libnx_initheap(void) {
|
||||||
void __appInit(void) {
|
void __appInit(void) {
|
||||||
hos::InitializeForStratosphere();
|
hos::InitializeForStratosphere();
|
||||||
|
|
||||||
sm::DoWithSession([&]() {
|
R_ABORT_UNLESS(sm::Initialize());
|
||||||
|
|
||||||
R_ABORT_UNLESS(setInitialize());
|
R_ABORT_UNLESS(setInitialize());
|
||||||
R_ABORT_UNLESS(setsysInitialize());
|
R_ABORT_UNLESS(setsysInitialize());
|
||||||
R_ABORT_UNLESS(pscmInitialize());
|
R_ABORT_UNLESS(pscmInitialize());
|
||||||
|
@ -75,7 +76,6 @@ void __appInit(void) {
|
||||||
R_ABORT_UNLESS(ectxrInitialize());
|
R_ABORT_UNLESS(ectxrInitialize());
|
||||||
}
|
}
|
||||||
R_ABORT_UNLESS(fsInitialize());
|
R_ABORT_UNLESS(fsInitialize());
|
||||||
});
|
|
||||||
|
|
||||||
ams::CheckApiVersion();
|
ams::CheckApiVersion();
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,8 @@ void __appInit(void) {
|
||||||
fatal::InitializeFsHeap();
|
fatal::InitializeFsHeap();
|
||||||
fs::SetAllocator(fatal::AllocateForFs, fatal::DeallocateForFs);
|
fs::SetAllocator(fatal::AllocateForFs, fatal::DeallocateForFs);
|
||||||
|
|
||||||
sm::DoWithSession([&]() {
|
R_ABORT_UNLESS(sm::Initialize());
|
||||||
|
|
||||||
R_ABORT_UNLESS(setInitialize());
|
R_ABORT_UNLESS(setInitialize());
|
||||||
R_ABORT_UNLESS(setsysInitialize());
|
R_ABORT_UNLESS(setsysInitialize());
|
||||||
R_ABORT_UNLESS(pminfoInitialize());
|
R_ABORT_UNLESS(pminfoInitialize());
|
||||||
|
@ -118,7 +119,6 @@ void __appInit(void) {
|
||||||
R_ABORT_UNLESS(plInitialize(::PlServiceType_User));
|
R_ABORT_UNLESS(plInitialize(::PlServiceType_User));
|
||||||
gpio::Initialize();
|
gpio::Initialize();
|
||||||
R_ABORT_UNLESS(fsInitialize());
|
R_ABORT_UNLESS(fsInitialize());
|
||||||
});
|
|
||||||
|
|
||||||
R_ABORT_UNLESS(fs::MountSdCard("sdmc"));
|
R_ABORT_UNLESS(fs::MountSdCard("sdmc"));
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,12 @@ namespace ams::fatal::srv {
|
||||||
|
|
||||||
/* Try to get the current time. */
|
/* Try to get the current time. */
|
||||||
{
|
{
|
||||||
sm::ScopedServiceHolder<timeInitialize, timeExit> time_holder;
|
if (R_FAILED(::timeInitialize())) {
|
||||||
return time_holder && R_SUCCEEDED(timeGetCurrentTime(TimeType_LocalSystemClock, out));
|
return false;
|
||||||
|
}
|
||||||
|
ON_SCOPE_EXIT { ::timeExit(); };
|
||||||
|
|
||||||
|
return R_SUCCEEDED(::timeGetCurrentTime(TimeType_LocalSystemClock, out));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -484,9 +484,7 @@ namespace ams::fatal::srv {
|
||||||
PreRenderFrameBuffer();
|
PreRenderFrameBuffer();
|
||||||
|
|
||||||
/* Prepare screen for drawing. */
|
/* Prepare screen for drawing. */
|
||||||
sm::DoWithSession([&]() {
|
|
||||||
R_ABORT_UNLESS(PrepareScreenForDrawing());
|
R_ABORT_UNLESS(PrepareScreenForDrawing());
|
||||||
});
|
|
||||||
|
|
||||||
/* Display the pre-rendered frame. */
|
/* Display the pre-rendered frame. */
|
||||||
this->DisplayPreRenderedFrame();
|
this->DisplayPreRenderedFrame();
|
||||||
|
|
|
@ -104,12 +104,12 @@ void __appInit(void) {
|
||||||
|
|
||||||
fs::SetAllocator(htc::Allocate, htc::Deallocate);
|
fs::SetAllocator(htc::Allocate, htc::Deallocate);
|
||||||
|
|
||||||
sm::DoWithSession([&]() {
|
R_ABORT_UNLESS(sm::Initialize());
|
||||||
|
|
||||||
R_ABORT_UNLESS(setsysInitialize());
|
R_ABORT_UNLESS(setsysInitialize());
|
||||||
R_ABORT_UNLESS(setcalInitialize());
|
R_ABORT_UNLESS(setcalInitialize());
|
||||||
R_ABORT_UNLESS(pscmInitialize());
|
R_ABORT_UNLESS(pscmInitialize());
|
||||||
R_ABORT_UNLESS(fsInitialize());
|
R_ABORT_UNLESS(fsInitialize());
|
||||||
});
|
|
||||||
|
|
||||||
R_ABORT_UNLESS(fs::MountSdCard("sdmc"));
|
R_ABORT_UNLESS(fs::MountSdCard("sdmc"));
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,8 @@ void __libnx_initheap(void) {
|
||||||
void __appInit(void) {
|
void __appInit(void) {
|
||||||
hos::InitializeForStratosphere();
|
hos::InitializeForStratosphere();
|
||||||
ams::CheckApiVersion();
|
ams::CheckApiVersion();
|
||||||
|
|
||||||
|
R_ABORT_UNLESS(sm::Initialize());
|
||||||
}
|
}
|
||||||
|
|
||||||
void __appExit(void) {
|
void __appExit(void) {
|
||||||
|
|
|
@ -145,12 +145,12 @@ void __appInit(void) {
|
||||||
fs::SetAllocator(ldr::Allocate, ldr::Deallocate);
|
fs::SetAllocator(ldr::Allocate, ldr::Deallocate);
|
||||||
|
|
||||||
/* Initialize services we need. */
|
/* Initialize services we need. */
|
||||||
sm::DoWithSession([&]() {
|
R_ABORT_UNLESS(sm::Initialize());
|
||||||
|
|
||||||
R_ABORT_UNLESS(fsInitialize());
|
R_ABORT_UNLESS(fsInitialize());
|
||||||
lr::Initialize();
|
lr::Initialize();
|
||||||
R_ABORT_UNLESS(fsldrInitialize());
|
R_ABORT_UNLESS(fsldrInitialize());
|
||||||
spl::Initialize();
|
spl::Initialize();
|
||||||
});
|
|
||||||
|
|
||||||
ams::CheckApiVersion();
|
ams::CheckApiVersion();
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,10 +93,10 @@ void __appInit(void) {
|
||||||
|
|
||||||
fs::SetAllocator(Allocate, Deallocate);
|
fs::SetAllocator(Allocate, Deallocate);
|
||||||
|
|
||||||
sm::DoWithSession([&]() {
|
R_ABORT_UNLESS(sm::Initialize());
|
||||||
|
|
||||||
R_ABORT_UNLESS(fsInitialize());
|
R_ABORT_UNLESS(fsInitialize());
|
||||||
spl::Initialize();
|
spl::Initialize();
|
||||||
});
|
|
||||||
|
|
||||||
ams::CheckApiVersion();
|
ams::CheckApiVersion();
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,14 +70,14 @@ void __appInit(void) {
|
||||||
|
|
||||||
fs::SetAllocator(pgl::srv::Allocate, pgl::srv::Deallocate);
|
fs::SetAllocator(pgl::srv::Allocate, pgl::srv::Deallocate);
|
||||||
|
|
||||||
sm::DoWithSession([&]() {
|
R_ABORT_UNLESS(sm::Initialize());
|
||||||
|
|
||||||
R_ABORT_UNLESS(setInitialize());
|
R_ABORT_UNLESS(setInitialize());
|
||||||
R_ABORT_UNLESS(setsysInitialize());
|
R_ABORT_UNLESS(setsysInitialize());
|
||||||
R_ABORT_UNLESS(pmshellInitialize());
|
R_ABORT_UNLESS(pmshellInitialize());
|
||||||
R_ABORT_UNLESS(ldrShellInitialize());
|
R_ABORT_UNLESS(ldrShellInitialize());
|
||||||
R_ABORT_UNLESS(lrInitialize());
|
R_ABORT_UNLESS(lrInitialize());
|
||||||
R_ABORT_UNLESS(fsInitialize());
|
R_ABORT_UNLESS(fsInitialize());
|
||||||
});
|
|
||||||
|
|
||||||
ams::CheckApiVersion();
|
ams::CheckApiVersion();
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,8 @@ namespace {
|
||||||
void __appInit(void) {
|
void __appInit(void) {
|
||||||
hos::InitializeForStratosphere();
|
hos::InitializeForStratosphere();
|
||||||
|
|
||||||
sm::DoWithSession([&]() {
|
R_ABORT_UNLESS(sm::Initialize());
|
||||||
|
|
||||||
R_ABORT_UNLESS(fsprInitialize());
|
R_ABORT_UNLESS(fsprInitialize());
|
||||||
R_ABORT_UNLESS(smManagerInitialize());
|
R_ABORT_UNLESS(smManagerInitialize());
|
||||||
|
|
||||||
|
@ -142,7 +143,6 @@ void __appInit(void) {
|
||||||
|
|
||||||
R_ABORT_UNLESS(ldrPmInitialize());
|
R_ABORT_UNLESS(ldrPmInitialize());
|
||||||
spl::Initialize();
|
spl::Initialize();
|
||||||
});
|
|
||||||
|
|
||||||
ams::CheckApiVersion();
|
ams::CheckApiVersion();
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,14 +145,14 @@ void __appInit(void) {
|
||||||
|
|
||||||
fs::SetAllocator(ro::Allocate, ro::Deallocate);
|
fs::SetAllocator(ro::Allocate, ro::Deallocate);
|
||||||
|
|
||||||
sm::DoWithSession([&]() {
|
R_ABORT_UNLESS(sm::Initialize());
|
||||||
|
|
||||||
R_ABORT_UNLESS(setsysInitialize());
|
R_ABORT_UNLESS(setsysInitialize());
|
||||||
R_ABORT_UNLESS(fsInitialize());
|
R_ABORT_UNLESS(fsInitialize());
|
||||||
spl::Initialize();
|
spl::Initialize();
|
||||||
if (hos::GetVersion() < hos::Version_3_0_0) {
|
if (hos::GetVersion() < hos::Version_3_0_0) {
|
||||||
R_ABORT_UNLESS(pminfoInitialize());
|
R_ABORT_UNLESS(pminfoInitialize());
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
R_ABORT_UNLESS(fs::MountSdCard("sdmc"));
|
R_ABORT_UNLESS(fs::MountSdCard("sdmc"));
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,7 @@ void __appInit(void) {
|
||||||
hos::InitializeForStratosphere();
|
hos::InitializeForStratosphere();
|
||||||
|
|
||||||
/* SPL doesn't really access any services... */
|
/* SPL doesn't really access any services... */
|
||||||
|
R_ABORT_UNLESS(sm::Initialize());
|
||||||
|
|
||||||
ams::CheckApiVersion();
|
ams::CheckApiVersion();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue