From b4700444a23f662b442dbfd74da4370cd42db575 Mon Sep 17 00:00:00 2001 From: Kevin Hartman Date: Tue, 17 Feb 2015 01:10:11 -0800 Subject: [PATCH] Return a stub service in the event that a service interface is not implemented, instead of reporting to the caller that GetServiceHandle itself is unimplemented (which games seem to dislike). --- src/core/hle/service/service.cpp | 2 ++ src/core/hle/service/service.h | 2 ++ src/core/hle/service/srv.cpp | 8 +++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 5dce8068e..a999f5865 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -57,6 +57,8 @@ namespace Service { std::unordered_map> g_kernel_named_ports; std::unordered_map> g_srv_services; +Interface g_stub_service; + //////////////////////////////////////////////////////////////////////////////////////////////////// // Module interface diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 3370f9f9b..b6bada586 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -119,5 +119,7 @@ void Shutdown(); extern std::unordered_map> g_kernel_named_ports; /// Map of services registered with the "srv:" service, retrieved using GetServiceHandle. extern std::unordered_map> g_srv_services; +/// Returned to callers when the requested service is not yet implemented +extern Interface g_stub_service; } // namespace diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp index cc59a03ce..52e73a42e 100644 --- a/src/core/hle/service/srv.cpp +++ b/src/core/hle/service/srv.cpp @@ -42,8 +42,14 @@ static void GetServiceHandle(Service::Interface* self) { LOG_TRACE(Service_SRV, "called port=%s, handle=0x%08X", port_name.c_str(), cmd_buff[3]); } else { LOG_ERROR(Service_SRV, "(UNIMPLEMENTED) called port=%s", port_name.c_str()); - res = UnimplementedFunction(ErrorModule::SRV); + + // Note: developers should add the corresponding service interface implementation when this is hit + UNIMPLEMENTED(); + + // Return the stubbed (empty) service so that applications can continue + cmd_buff[3] = Kernel::g_handle_table.Create(&Service::g_stub_service).MoveFrom(); } + cmd_buff[1] = res.raw; }