From 27996210895ed87fc843855448dcf3ce30ebfe62 Mon Sep 17 00:00:00 2001 From: lizzie Date: Sat, 15 Aug 2026 18:29:13 +0000 Subject: [PATCH] fix crashes on NGC --- src/core/hle/service/ngc/ngc.cpp | 10 ++++++---- src/core/hle/service/olsc/olsc.cpp | 27 +++++++++++++++------------ src/core/hle/service/ro/ro.cpp | 28 ++++++++++++++++------------ 3 files changed, 37 insertions(+), 28 deletions(-) diff --git a/src/core/hle/service/ngc/ngc.cpp b/src/core/hle/service/ngc/ngc.cpp index 0275ec52e5..719811cebc 100644 --- a/src/core/hle/service/ngc/ngc.cpp +++ b/src/core/hle/service/ngc/ngc.cpp @@ -29,8 +29,9 @@ public: private: void Match(HLERequestContext& ctx) { const auto buffer = ctx.ReadBuffer(); - const auto text = Common::StringFromFixedZeroTerminatedBuffer( - reinterpret_cast(buffer.data()), buffer.size()); + const auto text = !buffer.empty() + ? Common::StringFromFixedZeroTerminatedBuffer(reinterpret_cast(buffer.data()), buffer.size()) + : std::string{}; LOG_WARNING(Service_NGC, "(STUBBED) called, text={}", text); @@ -42,8 +43,9 @@ private: void Filter(HLERequestContext& ctx) { const auto buffer = ctx.ReadBuffer(); - const auto text = Common::StringFromFixedZeroTerminatedBuffer( - reinterpret_cast(buffer.data()), buffer.size()); + const auto text = !buffer.empty() + ? Common::StringFromFixedZeroTerminatedBuffer(reinterpret_cast(buffer.data()), buffer.size()) + : std::string{}; LOG_WARNING(Service_NGC, "(STUBBED) called, text={}", text); diff --git a/src/core/hle/service/olsc/olsc.cpp b/src/core/hle/service/olsc/olsc.cpp index 18e5ad43f8..dbf48fe0fc 100644 --- a/src/core/hle/service/olsc/olsc.cpp +++ b/src/core/hle/service/olsc/olsc.cpp @@ -9,20 +9,23 @@ namespace Service::OLSC { +class ISProfileBgAgentForSystemProcess final : public ServiceFramework { +public: + explicit ISProfileBgAgentForSystemProcess(Core::System& system_) + : ServiceFramework{system_, "spbg:sp"} + { + static const FunctionInfo functions[] = { + { 100, nullptr, "OpenBgAgentController" }, + }; + RegisterHandlers(functions); + } +}; + void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); - - const auto OlscFactoryForApplication = [&] { - return std::make_shared(system); - }; - - const auto OlscFactoryForSystemService = [&] { - return std::make_shared(system); - }; - - server_manager->RegisterNamedService("olsc:u", OlscFactoryForApplication); - server_manager->RegisterNamedService("olsc:s", OlscFactoryForSystemService); - + server_manager->RegisterNamedService("olsc:u", std::make_shared(system)); + server_manager->RegisterNamedService("olsc:s", std::make_shared(system)); + server_manager->RegisterNamedService("spbg:sp", std::make_shared(system)); ServerManager::RunServer(std::move(server_manager)); } diff --git a/src/core/hle/service/ro/ro.cpp b/src/core/hle/service/ro/ro.cpp index 879e51c65e..f0561b19cc 100644 --- a/src/core/hle/service/ro/ro.cpp +++ b/src/core/hle/service/ro/ro.cpp @@ -571,22 +571,26 @@ private: } // namespace + +class IDebugMonitorInterface final : public ServiceFramework { +public: + explicit IDebugMonitorInterface(Core::System& system_) + : ServiceFramework{system_, "ro:dmnt"} + { + static const FunctionInfo functions[] = { + { 0, nullptr, "GetProcessModuleInfo" }, + }; + RegisterHandlers(functions); + } +}; + void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); auto ro = std::make_shared(); - - const auto RoInterfaceFactoryForUser = [&, ro] { - return std::make_shared(system, "ldr:ro", ro, NrrKind::User); - }; - - const auto RoInterfaceFactoryForJitPlugin = [&, ro] { - return std::make_shared(system, "ro:1", ro, NrrKind::JitPlugin); - }; - - server_manager->RegisterNamedService("ldr:ro", std::move(RoInterfaceFactoryForUser)); - server_manager->RegisterNamedService("ro:1", std::move(RoInterfaceFactoryForJitPlugin)); - + server_manager->RegisterNamedService("ldr:ro", std::make_shared(system, "ldr:ro", ro, NrrKind::User)); + server_manager->RegisterNamedService("ro:1", std::make_shared(system, "ro:1", ro, NrrKind::JitPlugin)); + server_manager->RegisterNamedService("ro:dmnt", std::make_shared(system)); ServerManager::RunServer(std::move(server_manager)); }