ams: revamp assertion system

This commit is contained in:
Michael Scire
2020-02-22 23:05:14 -08:00
parent 9572fb2ce3
commit 40400aee1f
168 changed files with 1014 additions and 696 deletions

View File

@@ -63,22 +63,22 @@ void __appInit(void) {
hos::SetVersionForLibnx();
sm::DoWithSession([&]() {
R_ASSERT(pmdmntInitialize());
R_ASSERT(pminfoInitialize());
R_ASSERT(ldrDmntInitialize());
R_ABORT_UNLESS(pmdmntInitialize());
R_ABORT_UNLESS(pminfoInitialize());
R_ABORT_UNLESS(ldrDmntInitialize());
/* TODO: We provide this on every sysver via ro. Do we need a shim? */
if (hos::GetVersion() >= hos::Version_300) {
R_ASSERT(roDmntInitialize());
R_ABORT_UNLESS(roDmntInitialize());
}
R_ASSERT(nsdevInitialize());
R_ASSERT(lrInitialize());
R_ASSERT(setInitialize());
R_ASSERT(setsysInitialize());
R_ASSERT(hidInitialize());
R_ASSERT(fsInitialize());
R_ABORT_UNLESS(nsdevInitialize());
R_ABORT_UNLESS(lrInitialize());
R_ABORT_UNLESS(setInitialize());
R_ABORT_UNLESS(setsysInitialize());
R_ABORT_UNLESS(hidInitialize());
R_ABORT_UNLESS(fsInitialize());
});
R_ASSERT(fsdevMountSdmc());
R_ABORT_UNLESS(fsdevMountSdmc());
ams::CheckApiVersion();
}
@@ -132,8 +132,8 @@ int main(int argc, char **argv)
{
/* Create services. */
/* TODO: Implement rest of dmnt:- in ams.tma development branch. */
/* R_ASSERT((g_server_manager.RegisterServer<dmnt::cheat::CheatService>(DebugMonitorServiceName, DebugMonitorMaxSessions))); */
R_ASSERT((g_server_manager.RegisterServer<dmnt::cheat::CheatService>(CheatServiceName, CheatMaxSessions)));
/* R_ABORT_UNLESS((g_server_manager.RegisterServer<dmnt::cheat::CheatService>(DebugMonitorServiceName, DebugMonitorMaxSessions))); */
R_ABORT_UNLESS((g_server_manager.RegisterServer<dmnt::cheat::CheatService>(CheatServiceName, CheatMaxSessions)));
/* Loop forever, servicing our services. */
/* Nintendo loops four threads processing on the manager -- we'll loop an extra fifth for our cheat service. */
@@ -143,14 +143,14 @@ int main(int argc, char **argv)
if constexpr (NumExtraThreads > 0) {
const u32 priority = os::GetCurrentThreadPriority();
for (size_t i = 0; i < NumExtraThreads; i++) {
R_ASSERT(g_extra_threads[i].Initialize(LoopServerThread, nullptr, g_extra_thread_stacks[i], ThreadStackSize, priority));
R_ABORT_UNLESS(g_extra_threads[i].Initialize(LoopServerThread, nullptr, g_extra_thread_stacks[i], ThreadStackSize, priority));
}
}
/* Start extra threads. */
if constexpr (NumExtraThreads > 0) {
for (size_t i = 0; i < NumExtraThreads; i++) {
R_ASSERT(g_extra_threads[i].Start());
R_ABORT_UNLESS(g_extra_threads[i].Start());
}
}
@@ -160,7 +160,7 @@ int main(int argc, char **argv)
/* Wait for extra threads to finish. */
if constexpr (NumExtraThreads > 0) {
for (size_t i = 0; i < NumExtraThreads; i++) {
R_ASSERT(g_extra_threads[i].Join());
R_ABORT_UNLESS(g_extra_threads[i].Join());
}
}
}