From 128ea33073cb7345636dd181c2f7ad43c52eb187 Mon Sep 17 00:00:00 2001 From: PixelyIon Date: Sun, 23 Oct 2022 20:18:12 +0530 Subject: [PATCH] Print NPDM + NACP metadata for title determination We determined that printing NPDM + NACP metadata is a significantly better way to determine what title is running rather than printing the filename. --- app/src/main/cpp/emu_jni.cpp | 2 +- app/src/main/cpp/skyline/os.cpp | 14 +++++++++++++- app/src/main/cpp/skyline/vfs/npdm.cpp | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/src/main/cpp/emu_jni.cpp b/app/src/main/cpp/emu_jni.cpp index 0522db98..beb67b40 100644 --- a/app/src/main/cpp/emu_jni.cpp +++ b/app/src/main/cpp/emu_jni.cpp @@ -118,7 +118,7 @@ extern "C" JNIEXPORT void Java_emu_skyline_EmulationActivity_executeApplication( SettingsWeak = settings; jvmManager->InitializeControllers(); - skyline::Logger::InfoNoPrefix("Launching ROM {}", skyline::JniString(env, romUriJstring)); + skyline::Logger::DebugNoPrefix("Launching ROM {}", skyline::JniString(env, romUriJstring)); os->Execute(romFd, static_cast(romType)); } catch (std::exception &e) { diff --git a/app/src/main/cpp/skyline/os.cpp b/app/src/main/cpp/skyline/os.cpp index 3c85d766..f366dcf3 100644 --- a/app/src/main/cpp/skyline/os.cpp +++ b/app/src/main/cpp/skyline/os.cpp @@ -52,11 +52,23 @@ namespace skyline::kernel { auto &process{state.process}; process = std::make_shared(state); + auto entry{state.loader->LoadProcessData(process, state)}; + auto &nacp{state.loader->nacp}; + if (nacp) { + std::string name{nacp->GetApplicationName(language::ApplicationLanguage::AmericanEnglish)}, publisher{nacp->GetApplicationPublisher(language::ApplicationLanguage::AmericanEnglish)}; + if (name.empty()) + name = nacp->GetApplicationName(nacp->GetFirstSupportedTitleLanguage()); + if (publisher.empty()) + publisher = nacp->GetApplicationPublisher(nacp->GetFirstSupportedTitleLanguage()); + Logger::InfoNoPrefix(R"(Starting "{}" v{} by "{}")", name, nacp->GetApplicationVersion(), publisher); + } + process->InitializeHeapTls(); auto thread{process->CreateThread(entry)}; if (thread) { - Logger::Debug("Starting main HOS thread"); + Logger::Info("Starting main HOS thread"); + Logger::EmulationContext.Flush(); thread->Start(true); process->Kill(true, true, true); } diff --git a/app/src/main/cpp/skyline/vfs/npdm.cpp b/app/src/main/cpp/skyline/vfs/npdm.cpp index b24195ca..984250e3 100644 --- a/app/src/main/cpp/skyline/vfs/npdm.cpp +++ b/app/src/main/cpp/skyline/vfs/npdm.cpp @@ -77,6 +77,6 @@ namespace skyline::vfs { if (!threadInfo.coreMask.test(meta.idealCore)) throw exception("NPDM Ideal Core isn't valid: {} ({})", meta.idealCore, threadInfo.coreMask); - Logger::Debug("NPDM Metadata:\nTitle: ID: {:X}, Version: {}\nMain Thread: Priority: {}, Stack Size: 0x{:X}\nScheduler: Ideal Core: {}, Core Mask: {}, Priority: {} - {}\nKernel Version: v{}.{}", aci0.programId, meta.version, meta.mainThreadPriority, meta.mainThreadStackSize, meta.idealCore, threadInfo.coreMask, threadInfo.priority.min, threadInfo.priority.max, kernelVersion.majorVersion, kernelVersion.minorVersion); + Logger::InfoNoPrefix("NPDM Metadata:\nTitle: ID: {:X}, Version: {}\nMain Thread: Priority: {}, Stack Size: 0x{:X}\nScheduler: Ideal Core: {}, Core Mask: {}, Priority: {} - {}\nKernel Version: v{}.{}", aci0.programId, meta.version, meta.mainThreadPriority, meta.mainThreadStackSize, meta.idealCore, threadInfo.coreMask, threadInfo.priority.min, threadInfo.priority.max, kernelVersion.majorVersion, kernelVersion.minorVersion); } }