Conflicts:
	src/core/hle/function_wrappers.h
	src/core/hle/service/gsp.cpp
This commit is contained in:
bunnei
2014-06-14 12:13:16 -04:00
41 changed files with 1279 additions and 1235 deletions

View File

@ -6,6 +6,7 @@
#include "common/common.h"
#include "core/hle/hle.h"
#include "core/hle/kernel/event.h"
#include "core/hle/kernel/mutex.h"
#include "core/hle/service/apt.h"
@ -15,96 +16,120 @@
namespace APT_U {
void Initialize(Service::Interface* self) {
NOTICE_LOG(OSHLE, "APT_U::Sync - Initialize");
u32* cmd_buff = Service::GetCommandBuffer();
DEBUG_LOG(KERNEL, "called");
cmd_buff[3] = Kernel::CreateEvent(RESETTYPE_ONESHOT, "APT_U:Menu"); // APT menu event handle
cmd_buff[4] = Kernel::CreateEvent(RESETTYPE_ONESHOT, "APT_U:Pause"); // APT pause event handle
Kernel::SetEventLocked(cmd_buff[3], true);
Kernel::SetEventLocked(cmd_buff[4], false); // Fire start event
cmd_buff[1] = 0; // No error
}
void GetLockHandle(Service::Interface* self) {
u32* cmd_buff = Service::GetCommandBuffer();
u32 flags = cmd_buff[1]; // TODO(bunnei): Figure out the purpose of the flag field
cmd_buff[1] = 0; // No error
cmd_buff[5] = Kernel::CreateMutex(false);
DEBUG_LOG(KERNEL, "APT_U::GetLockHandle called : created handle 0x%08X", cmd_buff[5]);
cmd_buff[5] = Kernel::CreateMutex(false, "APT_U:Lock");
DEBUG_LOG(KERNEL, "called handle=0x%08X", cmd_buff[5]);
}
void Enable(Service::Interface* self) {
u32* cmd_buff = Service::GetCommandBuffer();
u32 unk = cmd_buff[1]; // TODO(bunnei): What is this field used for?
cmd_buff[1] = 0; // No error
ERROR_LOG(KERNEL, "(UNIMPEMENTED) called unk=0x%08X", unk);
}
void InquireNotification(Service::Interface* self) {
u32* cmd_buff = Service::GetCommandBuffer();
u32 app_id = cmd_buff[2];
cmd_buff[1] = 0; // No error
cmd_buff[3] = 0; // Signal type
ERROR_LOG(KERNEL, "(UNIMPEMENTED) called app_id=0x%08X", app_id);
}
const Interface::FunctionInfo FunctionTable[] = {
{0x00010040, GetLockHandle, "GetLockHandle"},
{0x00020080, Initialize, "Initialize"},
{0x00030040, NULL, "Enable"},
{0x00040040, NULL, "Finalize"},
{0x00050040, NULL, "GetAppletManInfo"},
{0x00060040, NULL, "GetAppletInfo"},
{0x00070000, NULL, "GetLastSignaledAppletId"},
{0x00080000, NULL, "CountRegisteredApplet"},
{0x00090040, NULL, "IsRegistered"},
{0x000A0040, NULL, "GetAttribute"},
{0x000B0040, NULL, "InquireNotification"},
{0x000C0104, NULL, "SendParameter"},
{0x000D0080, NULL, "ReceiveParameter"},
{0x000E0080, NULL, "GlanceParameter"},
{0x000F0100, NULL, "CancelParameter"},
{0x001000C2, NULL, "DebugFunc"},
{0x001100C0, NULL, "MapProgramIdForDebug"},
{0x00120040, NULL, "SetHomeMenuAppletIdForDebug"},
{0x00130000, NULL, "GetPreparationState"},
{0x00140040, NULL, "SetPreparationState"},
{0x00150140, NULL, "PrepareToStartApplication"},
{0x00160040, NULL, "PreloadLibraryApplet"},
{0x00170040, NULL, "FinishPreloadingLibraryApplet"},
{0x00180040, NULL, "PrepareToStartLibraryApplet"},
{0x00190040, NULL, "PrepareToStartSystemApplet"},
{0x001A0000, NULL, "PrepareToStartNewestHomeMenu"},
{0x001B00C4, NULL, "StartApplication"},
{0x001C0000, NULL, "WakeupApplication"},
{0x001D0000, NULL, "CancelApplication"},
{0x001E0084, NULL, "StartLibraryApplet"},
{0x001F0084, NULL, "StartSystemApplet"},
{0x00200044, NULL, "StartNewestHomeMenu"},
{0x00210000, NULL, "OrderToCloseApplication"},
{0x00220040, NULL, "PrepareToCloseApplication"},
{0x00230040, NULL, "PrepareToJumpToApplication"},
{0x00240044, NULL, "JumpToApplication"},
{0x002500C0, NULL, "PrepareToCloseLibraryApplet"},
{0x00260000, NULL, "PrepareToCloseSystemApplet"},
{0x00270044, NULL, "CloseApplication"},
{0x00280044, NULL, "CloseLibraryApplet"},
{0x00290044, NULL, "CloseSystemApplet"},
{0x002A0000, NULL, "OrderToCloseSystemApplet"},
{0x002B0000, NULL, "PrepareToJumpToHomeMenu"},
{0x002C0044, NULL, "JumpToHomeMenu"},
{0x002D0000, NULL, "PrepareToLeaveHomeMenu"},
{0x002E0044, NULL, "LeaveHomeMenu"},
{0x002F0040, NULL, "PrepareToLeaveResidentApplet"},
{0x00300044, NULL, "LeaveResidentApplet"},
{0x00310100, NULL, "PrepareToDoApplicationJump"},
{0x00320084, NULL, "DoApplicationJump"},
{0x00330000, NULL, "GetProgramIdOnApplicationJump"},
{0x00340084, NULL, "SendDeliverArg"},
{0x00350080, NULL, "ReceiveDeliverArg"},
{0x00360040, NULL, "LoadSysMenuArg"},
{0x00370042, NULL, "StoreSysMenuArg"},
{0x00380040, NULL, "PreloadResidentApplet"},
{0x00390040, NULL, "PrepareToStartResidentApplet"},
{0x003A0044, NULL, "StartResidentApplet"},
{0x003B0040, NULL, "CancelLibraryApplet"},
{0x003C0042, NULL, "SendDspSleep"},
{0x003D0042, NULL, "SendDspWakeUp"},
{0x003E0080, NULL, "ReplySleepQuery"},
{0x003F0040, NULL, "ReplySleepNotificationComplete"},
{0x00400042, NULL, "SendCaptureBufferInfo"},
{0x00410040, NULL, "ReceiveCaptureBufferInfo"},
{0x00420080, NULL, "SleepSystem"},
{0x00430040, NULL, "NotifyToWait"},
{0x00440000, NULL, "GetSharedFont"},
{0x00450040, NULL, "GetWirelessRebootInfo"},
{0x00460104, NULL, "Wrap"},
{0x00470104, NULL, "Unwrap"},
{0x00480100, NULL, "GetProgramInfo"},
{0x00490180, NULL, "Reboot"},
{0x004A0040, NULL, "GetCaptureInfo"},
{0x004B00C2, NULL, "AppletUtility"},
{0x004C0000, NULL, "SetFatalErrDispMode"},
{0x004D0080, NULL, "GetAppletProgramInfo"},
{0x004E0000, NULL, "HardwareResetAsync"},
{0x00010040, GetLockHandle, "GetLockHandle"},
{0x00020080, Initialize, "Initialize"},
{0x00030040, Enable, "Enable"},
{0x00040040, nullptr, "Finalize"},
{0x00050040, nullptr, "GetAppletManInfo"},
{0x00060040, nullptr, "GetAppletInfo"},
{0x00070000, nullptr, "GetLastSignaledAppletId"},
{0x00080000, nullptr, "CountRegisteredApplet"},
{0x00090040, nullptr, "IsRegistered"},
{0x000A0040, nullptr, "GetAttribute"},
{0x000B0040, InquireNotification, "InquireNotification"},
{0x000C0104, nullptr, "SendParameter"},
{0x000D0080, nullptr, "ReceiveParameter"},
{0x000E0080, nullptr, "GlanceParameter"},
{0x000F0100, nullptr, "CancelParameter"},
{0x001000C2, nullptr, "DebugFunc"},
{0x001100C0, nullptr, "MapProgramIdForDebug"},
{0x00120040, nullptr, "SetHomeMenuAppletIdForDebug"},
{0x00130000, nullptr, "GetPreparationState"},
{0x00140040, nullptr, "SetPreparationState"},
{0x00150140, nullptr, "PrepareToStartApplication"},
{0x00160040, nullptr, "PreloadLibraryApplet"},
{0x00170040, nullptr, "FinishPreloadingLibraryApplet"},
{0x00180040, nullptr, "PrepareToStartLibraryApplet"},
{0x00190040, nullptr, "PrepareToStartSystemApplet"},
{0x001A0000, nullptr, "PrepareToStartNewestHomeMenu"},
{0x001B00C4, nullptr, "StartApplication"},
{0x001C0000, nullptr, "WakeupApplication"},
{0x001D0000, nullptr, "CancelApplication"},
{0x001E0084, nullptr, "StartLibraryApplet"},
{0x001F0084, nullptr, "StartSystemApplet"},
{0x00200044, nullptr, "StartNewestHomeMenu"},
{0x00210000, nullptr, "OrderToCloseApplication"},
{0x00220040, nullptr, "PrepareToCloseApplication"},
{0x00230040, nullptr, "PrepareToJumpToApplication"},
{0x00240044, nullptr, "JumpToApplication"},
{0x002500C0, nullptr, "PrepareToCloseLibraryApplet"},
{0x00260000, nullptr, "PrepareToCloseSystemApplet"},
{0x00270044, nullptr, "CloseApplication"},
{0x00280044, nullptr, "CloseLibraryApplet"},
{0x00290044, nullptr, "CloseSystemApplet"},
{0x002A0000, nullptr, "OrderToCloseSystemApplet"},
{0x002B0000, nullptr, "PrepareToJumpToHomeMenu"},
{0x002C0044, nullptr, "JumpToHomeMenu"},
{0x002D0000, nullptr, "PrepareToLeaveHomeMenu"},
{0x002E0044, nullptr, "LeaveHomeMenu"},
{0x002F0040, nullptr, "PrepareToLeaveResidentApplet"},
{0x00300044, nullptr, "LeaveResidentApplet"},
{0x00310100, nullptr, "PrepareToDoApplicationJump"},
{0x00320084, nullptr, "DoApplicationJump"},
{0x00330000, nullptr, "GetProgramIdOnApplicationJump"},
{0x00340084, nullptr, "SendDeliverArg"},
{0x00350080, nullptr, "ReceiveDeliverArg"},
{0x00360040, nullptr, "LoadSysMenuArg"},
{0x00370042, nullptr, "StoreSysMenuArg"},
{0x00380040, nullptr, "PreloadResidentApplet"},
{0x00390040, nullptr, "PrepareToStartResidentApplet"},
{0x003A0044, nullptr, "StartResidentApplet"},
{0x003B0040, nullptr, "CancelLibraryApplet"},
{0x003C0042, nullptr, "SendDspSleep"},
{0x003D0042, nullptr, "SendDspWakeUp"},
{0x003E0080, nullptr, "ReplySleepQuery"},
{0x003F0040, nullptr, "ReplySleepNotificationComplete"},
{0x00400042, nullptr, "SendCaptureBufferInfo"},
{0x00410040, nullptr, "ReceiveCaptureBufferInfo"},
{0x00420080, nullptr, "SleepSystem"},
{0x00430040, nullptr, "NotifyToWait"},
{0x00440000, nullptr, "GetSharedFont"},
{0x00450040, nullptr, "GetWirelessRebootInfo"},
{0x00460104, nullptr, "Wrap"},
{0x00470104, nullptr, "Unwrap"},
{0x00480100, nullptr, "GetProgramInfo"},
{0x00490180, nullptr, "Reboot"},
{0x004A0040, nullptr, "GetCaptureInfo"},
{0x004B00C2, nullptr, "AppletUtility"},
{0x004C0000, nullptr, "SetFatalErrDispMode"},
{0x004D0080, nullptr, "GetAppletProgramInfo"},
{0x004E0000, nullptr, "HardwareResetAsync"},
};
////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -8,6 +8,7 @@
#include "core/mem_map.h"
#include "core/hle/hle.h"
#include "core/hle/kernel/event.h"
#include "core/hle/service/gsp.h"
#include "core/hw/gpu.h"
@ -60,6 +61,7 @@ void GX_FinishCommand(u32 thread_id) {
namespace GSP_GPU {
Handle g_event_handle = 0;
u32 g_thread_id = 0;
enum {
@ -96,7 +98,7 @@ void ReadHWRegs(Service::Interface* self) {
break;
default:
ERROR_LOG(GSP, "ReadHWRegs unknown register read at address %08X", reg_addr);
ERROR_LOG(GSP, "unknown register read at address %08X", reg_addr);
}
}
@ -104,7 +106,19 @@ void ReadHWRegs(Service::Interface* self) {
void RegisterInterruptRelayQueue(Service::Interface* self) {
u32* cmd_buff = Service::GetCommandBuffer();
u32 flags = cmd_buff[1];
u32 event_handle = cmd_buff[3]; // TODO(bunnei): Implement event handling
u32 event_handle = cmd_buff[3];
_assert_msg_(GSP, (event_handle != 0), "called, but event is nullptr!");
g_event_handle = event_handle;
Kernel::SetEventLocked(event_handle, false);
// Hack - This function will permanently set the state of the GSP event such that GPU command
// synchronization barriers always passthrough. Correct solution would be to set this after the
// GPU as processed all queued up commands, but due to the emulator being single-threaded they
// will always be ready.
Kernel::SetPermanentLock(event_handle, true);
cmd_buff[2] = g_thread_id; // ThreadID
}
@ -150,43 +164,43 @@ void TriggerCmdReqQueue(Service::Interface* self) {
}
default:
ERROR_LOG(GSP, "TriggerCmdReqQueue unknown command 0x%08X", cmd_buff[0]);
ERROR_LOG(GSP, "unknown command 0x%08X", cmd_buff[0]);
}
GX_FinishCommand(g_thread_id);
}
const Interface::FunctionInfo FunctionTable[] = {
{0x00010082, NULL, "WriteHWRegs"},
{0x00020084, NULL, "WriteHWRegsWithMask"},
{0x00030082, NULL, "WriteHWRegRepeat"},
{0x00010082, nullptr, "WriteHWRegs"},
{0x00020084, nullptr, "WriteHWRegsWithMask"},
{0x00030082, nullptr, "WriteHWRegRepeat"},
{0x00040080, ReadHWRegs, "ReadHWRegs"},
{0x00050200, NULL, "SetBufferSwap"},
{0x00060082, NULL, "SetCommandList"},
{0x000700C2, NULL, "RequestDma"},
{0x00080082, NULL, "FlushDataCache"},
{0x00090082, NULL, "InvalidateDataCache"},
{0x000A0044, NULL, "RegisterInterruptEvents"},
{0x000B0040, NULL, "SetLcdForceBlack"},
{0x00050200, nullptr, "SetBufferSwap"},
{0x00060082, nullptr, "SetCommandList"},
{0x000700C2, nullptr, "RequestDma"},
{0x00080082, nullptr, "FlushDataCache"},
{0x00090082, nullptr, "InvalidateDataCache"},
{0x000A0044, nullptr, "RegisterInterruptEvents"},
{0x000B0040, nullptr, "SetLcdForceBlack"},
{0x000C0000, TriggerCmdReqQueue, "TriggerCmdReqQueue"},
{0x000D0140, NULL, "SetDisplayTransfer"},
{0x000E0180, NULL, "SetTextureCopy"},
{0x000F0200, NULL, "SetMemoryFill"},
{0x00100040, NULL, "SetAxiConfigQoSMode"},
{0x00110040, NULL, "SetPerfLogMode"},
{0x00120000, NULL, "GetPerfLog"},
{0x000D0140, nullptr, "SetDisplayTransfer"},
{0x000E0180, nullptr, "SetTextureCopy"},
{0x000F0200, nullptr, "SetMemoryFill"},
{0x00100040, nullptr, "SetAxiConfigQoSMode"},
{0x00110040, nullptr, "SetPerfLogMode"},
{0x00120000, nullptr, "GetPerfLog"},
{0x00130042, RegisterInterruptRelayQueue, "RegisterInterruptRelayQueue"},
{0x00140000, NULL, "UnregisterInterruptRelayQueue"},
{0x00150002, NULL, "TryAcquireRight"},
{0x00160042, NULL, "AcquireRight"},
{0x00170000, NULL, "ReleaseRight"},
{0x00180000, NULL, "ImportDisplayCaptureInfo"},
{0x00190000, NULL, "SaveVramSysArea"},
{0x001A0000, NULL, "RestoreVramSysArea"},
{0x001B0000, NULL, "ResetGpuCore"},
{0x001C0040, NULL, "SetLedForceOff"},
{0x001D0040, NULL, "SetTestCommand"},
{0x001E0080, NULL, "SetInternalPriorities"},
{0x00140000, nullptr, "UnregisterInterruptRelayQueue"},
{0x00150002, nullptr, "TryAcquireRight"},
{0x00160042, nullptr, "AcquireRight"},
{0x00170000, nullptr, "ReleaseRight"},
{0x00180000, nullptr, "ImportDisplayCaptureInfo"},
{0x00190000, nullptr, "SaveVramSysArea"},
{0x001A0000, nullptr, "RestoreVramSysArea"},
{0x001B0000, nullptr, "ResetGpuCore"},
{0x001C0040, nullptr, "SetLedForceOff"},
{0x001D0040, nullptr, "SetTestCommand"},
{0x001E0080, nullptr, "SetInternalPriorities"},
};
////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -13,11 +13,11 @@
namespace HID_User {
const Interface::FunctionInfo FunctionTable[] = {
{0x000A0000, NULL, "GetIPCHandles"},
{0x00110000, NULL, "EnableAccelerometer"},
{0x00130000, NULL, "EnableGyroscopeLow"},
{0x00150000, NULL, "GetGyroscopeLowRawToDpsCoefficient"},
{0x00160000, NULL, "GetGyroscopeLowCalibrateParam"},
{0x000A0000, nullptr, "GetIPCHandles"},
{0x00110000, nullptr, "EnableAccelerometer"},
{0x00130000, nullptr, "EnableGyroscopeLow"},
{0x00150000, nullptr, "GetGyroscopeLowRawToDpsCoefficient"},
{0x00160000, nullptr, "GetGyroscopeLowCalibrateParam"},
};
////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,32 @@
// Copyright 2014 Citra Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/ndm.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
// Namespace NDM_U
namespace NDM_U {
const Interface::FunctionInfo FunctionTable[] = {
{0x00060040, nullptr, "SuspendDaemons"},
{0x00080040, nullptr, "DisableWifiUsage"},
{0x00090000, nullptr, "EnableWifiUsage"},
{0x00140040, nullptr, "OverrideDefaultDaemons"},
};
////////////////////////////////////////////////////////////////////////////////////////////////////
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
}
Interface::~Interface() {
}
} // namespace

View File

@ -0,0 +1,33 @@
// Copyright 2014 Citra Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#pragma once
#include "core/hle/service/service.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
// Namespace NDM
// No idea what this is
namespace NDM_U {
class Interface : public Service::Interface {
public:
Interface();
~Interface();
/**
* Gets the string port name used by CTROS for the service
* @return Port name of service
*/
const char *GetPortName() const {
return "ndm:u";
}
};
} // namespace

View File

@ -12,13 +12,14 @@
#include "core/hle/service/apt.h"
#include "core/hle/service/gsp.h"
#include "core/hle/service/hid.h"
#include "core/hle/service/ndm.h"
#include "core/hle/service/srv.h"
#include "core/hle/kernel/kernel.h"
namespace Service {
Manager* g_manager = NULL; ///< Service manager
Manager* g_manager = nullptr; ///< Service manager
////////////////////////////////////////////////////////////////////////////////////////////////////
// Service Manager class
@ -55,7 +56,7 @@ Interface* Manager::FetchFromHandle(Handle handle) {
Interface* Manager::FetchFromPortName(std::string port_name) {
auto itr = m_port_map.find(port_name);
if (itr == m_port_map.end()) {
return NULL;
return nullptr;
}
return FetchFromHandle(itr->second);
}
@ -72,14 +73,15 @@ void Init() {
g_manager->AddService(new APT_U::Interface);
g_manager->AddService(new GSP_GPU::Interface);
g_manager->AddService(new HID_User::Interface);
g_manager->AddService(new NDM_U::Interface);
NOTICE_LOG(HLE, "Services initialized OK");
NOTICE_LOG(HLE, "initialized OK");
}
/// Shutdown ServiceManager
void Shutdown() {
delete g_manager;
NOTICE_LOG(HLE, "Services shutdown OK");
NOTICE_LOG(HLE, "shutdown OK");
}

View File

@ -39,8 +39,8 @@ class Interface : public Kernel::Object {
friend class Manager;
public:
const char *GetName() { return GetPortName(); }
const char *GetTypeName() { return GetPortName(); }
const char *GetName() const { return GetPortName(); }
const char *GetTypeName() const { return GetPortName(); }
static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Service; }
Kernel::HandleType GetHandleType() const { return Kernel::HandleType::Service; }
@ -76,22 +76,31 @@ public:
}
/**
* Called when svcSendSyncRequest is called, loads command buffer and executes comand
* @return Return result of svcSendSyncRequest passed back to user app
* Synchronize kernel object
* @param wait Boolean wait set if current thread should wait as a result of sync operation
* @return Result of operation, 0 on success, otherwise error code
*/
Result Sync() {
Result SyncRequest(bool* wait) {
u32* cmd_buff = GetCommandBuffer();
auto itr = m_functions.find(cmd_buff[0]);
if (itr == m_functions.end()) {
ERROR_LOG(OSHLE, "Unknown/unimplemented function: port = %s, command = 0x%08X!",
ERROR_LOG(OSHLE, "unknown/unimplemented function: port=%s, command=0x%08X",
GetPortName(), cmd_buff[0]);
return -1;
// TODO(bunnei): Hack - ignore error
u32* cmd_buff = Service::GetCommandBuffer();
cmd_buff[1] = 0;
return 0;
}
if (itr->second.func == NULL) {
ERROR_LOG(OSHLE, "Unimplemented function: port = %s, name = %s!",
if (itr->second.func == nullptr) {
ERROR_LOG(OSHLE, "unimplemented function: port=%s, name=%s",
GetPortName(), itr->second.name.c_str());
return -1;
// TODO(bunnei): Hack - ignore error
u32* cmd_buff = Service::GetCommandBuffer();
cmd_buff[1] = 0;
return 0;
}
itr->second.func(this);
@ -99,6 +108,17 @@ public:
return 0; // TODO: Implement return from actual function
}
/**
* Wait for kernel object to synchronize
* @param wait Boolean wait set if current thread should wait as a result of sync operation
* @return Result of operation, 0 on success, otherwise error code
*/
Result WaitSynchronization(bool* wait) {
// TODO(bunnei): ImplementMe
ERROR_LOG(OSHLE, "unimplemented function");
return 0;
}
protected:
/**

View File

@ -5,21 +5,28 @@
#include "core/hle/hle.h"
#include "core/hle/service/srv.h"
#include "core/hle/service/service.h"
#include "core/hle/kernel/mutex.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
// Namespace SRV
namespace SRV {
Handle g_mutex = 0;
void Initialize(Service::Interface* self) {
NOTICE_LOG(OSHLE, "SRV::Sync - Initialize");
DEBUG_LOG(OSHLE, "called");
if (!g_mutex) {
g_mutex = Kernel::CreateMutex(true, "SRV:Lock");
}
}
void GetProcSemaphore(Service::Interface* self) {
DEBUG_LOG(OSHLE, "called");
// Get process semaphore?
u32* cmd_buff = Service::GetCommandBuffer();
cmd_buff[3] = 0xDEADBEEF; // Return something... 0 == NULL, raises an exception
cmd_buff[1] = 0; // No error
cmd_buff[3] = g_mutex; // Return something... 0 == nullptr, raises an exception
}
void GetServiceHandle(Service::Interface* self) {
@ -29,25 +36,21 @@ void GetServiceHandle(Service::Interface* self) {
std::string port_name = std::string((const char*)&cmd_buff[1], 0, Service::kMaxPortSize);
Service::Interface* service = Service::g_manager->FetchFromPortName(port_name);
NOTICE_LOG(OSHLE, "SRV::Sync - GetHandle - port: %s, handle: 0x%08X", port_name.c_str(),
service->GetHandle());
if (NULL != service) {
if (nullptr != service) {
cmd_buff[3] = service->GetHandle();
DEBUG_LOG(OSHLE, "called port=%s, handle=0x%08X", port_name.c_str(), cmd_buff[3]);
} else {
ERROR_LOG(OSHLE, "Service %s does not exist", port_name.c_str());
ERROR_LOG(OSHLE, "(UNIMPLEMENTED) called port=%s", port_name.c_str());
res = -1;
}
cmd_buff[1] = res;
//return res;
}
const Interface::FunctionInfo FunctionTable[] = {
{0x00010002, Initialize, "Initialize"},
{0x00020000, GetProcSemaphore, "GetProcSemaphore"},
{0x00030100, NULL, "RegisterService"},
{0x000400C0, NULL, "UnregisterService"},
{0x00030100, nullptr, "RegisterService"},
{0x000400C0, nullptr, "UnregisterService"},
{0x00050100, GetServiceHandle, "GetServiceHandle"},
};

View File

@ -26,12 +26,6 @@ public:
return "srv:";
}
/**
* Called when svcSendSyncRequest is called, loads command buffer and executes comand
* @return Return result of svcSendSyncRequest passed back to user app
*/
Result Sync();
};
} // namespace