From 5ea4679630d6776837114252476dd445f377322d Mon Sep 17 00:00:00 2001 From: bunnei Date: Sun, 13 Apr 2014 00:38:48 -0400 Subject: added some very initial command parsing for SRV Sync --- src/core/hle/service/service.cpp | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) (limited to 'src/core/hle') diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 3434b6dbf..556dfc8a2 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -5,15 +5,16 @@ #include "common/common.h" #include "common/log.h" +#include "core/hle/hle.h" #include "core/hle/service/service.h" -//////////////////////////////////////////////////////////////////////////////////////////////////// -// Namespace Service - namespace Service { Manager* g_manager = NULL; ///< Service manager +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Service Manager class + Manager::Manager() { } @@ -62,7 +63,11 @@ Interface* Manager::FetchFromPortName(std::string port_name) { return FetchFromUID(itr->second); } +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Interface to "SRV" service + class Interface_SRV : public Interface { + public: Interface_SRV() { @@ -71,6 +76,12 @@ public: ~Interface_SRV() { } + enum { + CMD_OFFSET = 0x80, + CMD_HEADER_INIT = 0x10002, ///< Command header to initialize SRV service + CMD_HEADER_GET_HANDLE = 0x50100, ///< Command header to get handle of other services + }; + /** * Gets the string name used by CTROS for a service * @return String name of service @@ -92,12 +103,27 @@ public: * @return Return result of svcSendSyncRequest passed back to user app */ Syscall::Result Sync() { - ERROR_LOG(HLE, "Unimplemented function Interface_SRV::Sync"); + u32 header = 0; + HLE::Read(header, (HLE::CMD_BUFFER_ADDR + CMD_OFFSET)); + + switch (header) { + case CMD_HEADER_INIT: + NOTICE_LOG(HLE, "Interface_SRV::Sync - Initialize"); + break; + + case CMD_HEADER_GET_HANDLE: + NOTICE_LOG(HLE, "Interface_SRV::Sync - GetHandle, port: %s", HLE::GetCharPointer(HLE::CMD_BUFFER_ADDR + CMD_OFFSET + 4)); + break; + } + return 0; } - + }; +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Module interface + /// Initialize ServiceManager void Init() { g_manager = new Manager; -- cgit v1.2.3