strat: no longer materially constrained by sm session limit

This commit is contained in:
Michael Scire
2021-04-13 23:58:10 -07:00
parent 997e4dd665
commit 2e1a93f1d1
37 changed files with 215 additions and 333 deletions

View File

@@ -41,8 +41,12 @@ namespace ams::creport {
/* Try to get the current time. */
{
sm::ScopedServiceHolder<timeInitialize, timeExit> time_holder;
return time_holder && R_SUCCEEDED(timeGetCurrentTime(TimeType_LocalSystemClock, out));
if (R_FAILED(::timeInitialize())) {
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. */
AMS_UNUSED(enable_screenshot);
if (hos::GetVersion() >= hos::Version_9_0_0 && this->IsApplication()) {
sm::ScopedServiceHolder<capsrv::InitializeScreenShotControl, capsrv::FinalizeScreenShotControl> capssc_holder;
if (capssc_holder) {
if (R_SUCCEEDED(capsrv::InitializeScreenShotControl())) {
ON_SCOPE_EXIT { capsrv::FinalizeScreenShotControl(); };
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)))) {
util::SNPrintf(file_path, sizeof(file_path), "sdmc:/atmosphere/crash_reports/%011lu_%016lx.jpg", timestamp, this->process_info.program_id);

View File

@@ -92,9 +92,9 @@ void __appInit(void) {
InitializeFsHeap();
fs::SetAllocator(AllocateForFs, DeallocateForFs);
sm::DoWithSession([&]() {
R_ABORT_UNLESS(fsInitialize());
});
R_ABORT_UNLESS(sm::Initialize());
R_ABORT_UNLESS(fsInitialize());
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_10_0_0) {
/* On 10.0.0+, use pgl to terminate. */
sm::ScopedServiceHolder<pgl::Initialize, pgl::Finalize> pgl_holder;
if (pgl_holder) {
if (R_SUCCEEDED(pgl::Initialize())) {
ON_SCOPE_EXIT { pgl::Finalize(); };
pgl::TerminateProcess(crashed_pid);
}
} else {
/* On < 10.0.0, use ns:dev to terminate. */
sm::ScopedServiceHolder<nsdevInitialize, nsdevExit> ns_holder;
if (ns_holder) {
if (R_SUCCEEDED(::nsdevInitialize())) {
ON_SCOPE_EXIT { ::nsdevExit(); };
nsdevTerminateProcess(static_cast<u64>(crashed_pid));
}
}