From d73d782ba7ea6f3f2dd9c4f70d34c1004397dacb Mon Sep 17 00:00:00 2001 From: bunnei Date: Mon, 26 May 2014 21:01:27 -0400 Subject: kernel: add a SyncRequest method to KernelObject for use with svcSendSyncRequest --- src/core/hle/service/srv.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/service/srv.h b/src/core/hle/service/srv.h index 1e35032b..81109a2a 100644 --- a/src/core/hle/service/srv.h +++ b/src/core/hle/service/srv.h @@ -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 -- cgit v1.2.3 From 96b21055249ade8a36f8117e4e22ea2a8a10707b Mon Sep 17 00:00:00 2001 From: bunnei Date: Mon, 26 May 2014 21:55:55 -0400 Subject: srv: added a real mutex for GetProcSemaphore (instead of stubbed) --- src/core/hle/service/srv.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp index ff6da8f1..7bbc03bf 100644 --- a/src/core/hle/service/srv.cpp +++ b/src/core/hle/service/srv.cpp @@ -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, "SRV::Initialize called"); + if (!g_mutex) { + g_mutex = Kernel::CreateMutex(false); + } } void GetProcSemaphore(Service::Interface* self) { + DEBUG_LOG(OSHLE, "SRV::GetProcSemaphore 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 == NULL, raises an exception } void GetServiceHandle(Service::Interface* self) { -- cgit v1.2.3 From 16fea415d09e3c1e55667a6affab495e03117f96 Mon Sep 17 00:00:00 2001 From: bunnei Date: Mon, 26 May 2014 21:56:51 -0400 Subject: service: Renamed Sync to SyncRequest --- src/core/hle/service/service.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 716669be..c970ace4 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -79,7 +79,7 @@ public: * Called when svcSendSyncRequest is called, loads command buffer and executes comand * @return Return result of svcSendSyncRequest passed back to user app */ - Result Sync() { + Result SyncRequest() { u32* cmd_buff = GetCommandBuffer(); auto itr = m_functions.find(cmd_buff[0]); -- cgit v1.2.3 From 58a3adcdd2eed9d31cd441186af872a0a8924e73 Mon Sep 17 00:00:00 2001 From: bunnei Date: Mon, 26 May 2014 22:12:46 -0400 Subject: kernel: updated SyncRequest to take boolean thread wait result as a parameter --- src/core/hle/kernel/kernel.h | 9 ++++++++- src/core/hle/kernel/mutex.cpp | 8 ++++++-- src/core/hle/kernel/thread.cpp | 8 ++++++-- src/core/hle/service/service.h | 7 ++++--- src/core/hle/svc.cpp | 11 +++++++++-- 5 files changed, 33 insertions(+), 10 deletions(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index 786d3abf..4acc9f22 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h @@ -47,7 +47,14 @@ public: virtual const char *GetTypeName() { return "[BAD KERNEL OBJECT TYPE]"; } virtual const char *GetName() { return "[UNKNOWN KERNEL OBJECT]"; } virtual Kernel::HandleType GetHandleType() const = 0; - virtual Result SyncRequest() = 0; + + /** + * 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 + */ + virtual Result SyncRequest(bool* wait) = 0; + }; class ObjectPool : NonCopyable { diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index fa924404..5465b7a3 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp @@ -24,8 +24,12 @@ public: Handle lock_thread; ///< Handle to thread that currently has mutex std::vector waiting_threads; ///< Threads that are waiting for the mutex - /// Synchronize kernel object - Result SyncRequest() { + /** + * 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 SyncRequest(bool* wait) { return 0; } }; diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index b9dd9fac..56c7755c 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -36,8 +36,12 @@ public: inline bool IsWaiting() const { return (status & THREADSTATUS_WAIT) != 0; } inline bool IsSuspended() const { return (status & THREADSTATUS_SUSPEND) != 0; } - /// Synchronize kernel object - Result SyncRequest() { + /** + * 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 SyncRequest(bool* wait) { return 0; } diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index c970ace4..12ef51b9 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -76,10 +76,11 @@ 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 SyncRequest() { + Result SyncRequest(bool* wait) { u32* cmd_buff = GetCommandBuffer(); auto itr = m_functions.find(cmd_buff[0]); diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index 6f72a6eb..e566036e 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp @@ -92,11 +92,18 @@ Result ConnectToPort(void* out, const char* port_name) { /// Synchronize to an OS service Result SendSyncRequest(Handle handle) { + bool wait = false; Kernel::Object* object = Kernel::g_object_pool.GetFast(handle); + DEBUG_LOG(SVC, "SendSyncRequest called handle=0x%08X"); _assert_msg_(KERNEL, object, "SendSyncRequest called, but kernel object is NULL!"); - object->SyncRequest(); - return 0; + + Result res = object->SyncRequest(&wait); + if (wait) { + Kernel::WaitCurrentThread(WAITTYPE_SYNCH); // TODO(bunnei): Is this correct? + } + + return res; } /// Close a handle -- cgit v1.2.3 From a432dc8f39a866b7b523235d6d94531f93bb4aa1 Mon Sep 17 00:00:00 2001 From: bunnei Date: Mon, 26 May 2014 22:17:49 -0400 Subject: kernel: added WaitSynchronization method to Kernel::Object --- src/core/hle/kernel/kernel.h | 7 +++++++ src/core/hle/kernel/mutex.cpp | 11 +++++++++++ src/core/hle/kernel/thread.cpp | 11 +++++++++++ src/core/hle/service/service.h | 10 ++++++++++ 4 files changed, 39 insertions(+) (limited to 'src/core/hle/service') diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index 4acc9f22..620cd2d7 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h @@ -55,6 +55,13 @@ public: */ virtual Result SyncRequest(bool* wait) = 0; + /** + * 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 + */ + virtual Result WaitSynchronization(bool* wait) = 0; + }; class ObjectPool : NonCopyable { diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index 5465b7a3..17fd40ac 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp @@ -30,6 +30,17 @@ public: * @return Result of operation, 0 on success, otherwise error code */ Result SyncRequest(bool* wait) { + // TODO(bunnei): ImplementMe + return 0; + } + + /** + * 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 return 0; } }; diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 56c7755c..6e8b53eb 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -42,6 +42,17 @@ public: * @return Result of operation, 0 on success, otherwise error code */ Result SyncRequest(bool* wait) { + // TODO(bunnei): ImplementMe + return 0; + } + + /** + * 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 return 0; } diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 12ef51b9..4671d452 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -100,6 +100,16 @@ 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 + return 0; + } + protected: /** -- cgit v1.2.3 From 94b30e8a3875346888fb7d0d36b9145cbed34836 Mon Sep 17 00:00:00 2001 From: bunnei Date: Tue, 27 May 2014 22:29:11 -0400 Subject: APT_U: added event creation to Initialize method --- src/core/hle/service/apt.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/service/apt.cpp b/src/core/hle/service/apt.cpp index 32759a08..67c53529 100644 --- a/src/core/hle/service/apt.cpp +++ b/src/core/hle/service/apt.cpp @@ -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,7 +16,16 @@ namespace APT_U { void Initialize(Service::Interface* self) { - NOTICE_LOG(OSHLE, "APT_U::Sync - Initialize"); + u32* cmd_buff = Service::GetCommandBuffer(); + DEBUG_LOG(KERNEL, "APT_U::Sync - Initialize"); + + cmd_buff[3] = Kernel::CreateEvent(RESETTYPE_ONESHOT); // APT menu event handle + cmd_buff[4] = Kernel::CreateEvent(RESETTYPE_ONESHOT); // 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) { -- cgit v1.2.3 From 3972d4ca8ba82a1e344e1255b0c113751d4b9f59 Mon Sep 17 00:00:00 2001 From: bunnei Date: Tue, 27 May 2014 23:56:08 -0400 Subject: APT_U: added stubbed function for APT_U::Enable, fixed some log messages to be more consistent --- src/core/hle/service/apt.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/service/apt.cpp b/src/core/hle/service/apt.cpp index 67c53529..ae040562 100644 --- a/src/core/hle/service/apt.cpp +++ b/src/core/hle/service/apt.cpp @@ -17,7 +17,7 @@ namespace APT_U { void Initialize(Service::Interface* self) { u32* cmd_buff = Service::GetCommandBuffer(); - DEBUG_LOG(KERNEL, "APT_U::Sync - Initialize"); + DEBUG_LOG(KERNEL, "APT_U::Initialize called"); cmd_buff[3] = Kernel::CreateEvent(RESETTYPE_ONESHOT); // APT menu event handle cmd_buff[4] = Kernel::CreateEvent(RESETTYPE_ONESHOT); // APT pause event handle @@ -33,13 +33,20 @@ void GetLockHandle(Service::Interface* self) { 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]); + DEBUG_LOG(KERNEL, "APT_U::GetLockHandle 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) APT_U::Enable called unk=0x%08X", unk); } const Interface::FunctionInfo FunctionTable[] = { {0x00010040, GetLockHandle, "GetLockHandle"}, {0x00020080, Initialize, "Initialize"}, - {0x00030040, NULL, "Enable"}, + {0x00030040, Enable, "Enable"}, {0x00040040, NULL, "Finalize"}, {0x00050040, NULL, "GetAppletManInfo"}, {0x00060040, NULL, "GetAppletInfo"}, -- cgit v1.2.3 From 70af9d620b8c1ebbc203c3601aad7c746fddff76 Mon Sep 17 00:00:00 2001 From: bunnei Date: Wed, 28 May 2014 18:39:28 -0400 Subject: service: changed interface to return 0 (no error) when a service method is unimplemented - hack to make apps boot further --- src/core/hle/service/service.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 4671d452..4a3d4c68 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -87,12 +87,12 @@ public: if (itr == m_functions.end()) { ERROR_LOG(OSHLE, "Unknown/unimplemented function: port = %s, command = 0x%08X!", GetPortName(), cmd_buff[0]); - return -1; + return 0; // TODO(bunnei): Hack - ignore error } if (itr->second.func == NULL) { ERROR_LOG(OSHLE, "Unimplemented function: port = %s, name = %s!", GetPortName(), itr->second.name.c_str()); - return -1; + return 0; // TODO(bunnei): Hack - ignore error } itr->second.func(this); -- cgit v1.2.3 From 4b4a6de1d810c9e274eb1f9978f5fb006c9346f9 Mon Sep 17 00:00:00 2001 From: bunnei Date: Wed, 28 May 2014 23:33:24 -0400 Subject: apt: added stubbed function for InquireNotification --- src/core/hle/service/apt.cpp | 164 +++++++++++++++++++++++-------------------- 1 file changed, 86 insertions(+), 78 deletions(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/service/apt.cpp b/src/core/hle/service/apt.cpp index ae040562..f2118ba0 100644 --- a/src/core/hle/service/apt.cpp +++ b/src/core/hle/service/apt.cpp @@ -43,85 +43,93 @@ void Enable(Service::Interface* self) { ERROR_LOG(KERNEL, "(UNIMPEMENTED) APT_U::Enable 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) APT_U::InquireNotification called app_id=0x%08X", app_id); +} + const Interface::FunctionInfo FunctionTable[] = { - {0x00010040, GetLockHandle, "GetLockHandle"}, - {0x00020080, Initialize, "Initialize"}, - {0x00030040, Enable, "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, NULL, "Finalize"}, + {0x00050040, NULL, "GetAppletManInfo"}, + {0x00060040, NULL, "GetAppletInfo"}, + {0x00070000, NULL, "GetLastSignaledAppletId"}, + {0x00080000, NULL, "CountRegisteredApplet"}, + {0x00090040, NULL, "IsRegistered"}, + {0x000A0040, NULL, "GetAttribute"}, + {0x000B0040, InquireNotification, "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"}, }; //////////////////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3 From b08b3c154fd5c2cdb12ab88597863f736c156123 Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 29 May 2014 18:53:45 -0400 Subject: srv: changed a NOTICE_LOG to DEBUG_LOG --- src/core/hle/service/srv.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp index 7bbc03bf..97e7fc8f 100644 --- a/src/core/hle/service/srv.cpp +++ b/src/core/hle/service/srv.cpp @@ -36,7 +36,7 @@ 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(), + DEBUG_LOG(OSHLE, "SRV::Sync - GetHandle - port: %s, handle: 0x%08X", port_name.c_str(), service->GetHandle()); if (NULL != service) { -- cgit v1.2.3 From 545e6919ce33a815761aef0f32e8e052858a60b3 Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 29 May 2014 18:54:59 -0400 Subject: service: added additional hack to return success on unimplemented service calls --- src/core/hle/service/service.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 4a3d4c68..8f8d4d55 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -87,12 +87,20 @@ public: if (itr == m_functions.end()) { ERROR_LOG(OSHLE, "Unknown/unimplemented function: port = %s, command = 0x%08X!", GetPortName(), cmd_buff[0]); - return 0; // TODO(bunnei): Hack - ignore error + + // 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!", GetPortName(), itr->second.name.c_str()); - return 0; // TODO(bunnei): Hack - ignore error + + // TODO(bunnei): Hack - ignore error + u32* cmd_buff = Service::GetCommandBuffer(); + cmd_buff[1] = 0; + return 0; } itr->second.func(this); -- cgit v1.2.3 From c404d22036e16d20d91fca0cf29d56785656c0f5 Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 29 May 2014 23:26:58 -0400 Subject: hle: cleaned up log messages --- src/core/hle/config_mem.cpp | 2 +- src/core/hle/hle.cpp | 6 ++--- src/core/hle/service/apt.cpp | 8 +++--- src/core/hle/service/gsp.cpp | 4 +-- src/core/hle/service/service.cpp | 8 ++++-- src/core/hle/service/srv.cpp | 6 ++--- src/core/hle/svc.cpp | 55 ++++++++++++++++++++-------------------- src/core/mem_map_funcs.cpp | 5 ++-- 8 files changed, 49 insertions(+), 45 deletions(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/config_mem.cpp b/src/core/hle/config_mem.cpp index 48aa878c..8c898b26 100644 --- a/src/core/hle/config_mem.cpp +++ b/src/core/hle/config_mem.cpp @@ -55,7 +55,7 @@ inline void Read(T &var, const u32 addr) { break; default: - ERROR_LOG(HLE, "unknown ConfigMem::Read%d @ 0x%08X", sizeof(var) * 8, addr); + ERROR_LOG(HLE, "unknown addr=0x%08X", addr); } } diff --git a/src/core/hle/hle.cpp b/src/core/hle/hle.cpp index 080c36ab..f703da44 100644 --- a/src/core/hle/hle.cpp +++ b/src/core/hle/hle.cpp @@ -18,7 +18,7 @@ static std::vector g_module_db; const FunctionDef* GetSVCInfo(u32 opcode) { u32 func_num = opcode & 0xFFFFFF; // 8 bits if (func_num > 0xFF) { - ERROR_LOG(HLE,"Unknown SVC: 0x%02X", func_num); + ERROR_LOG(HLE,"unknown svc=0x%02X", func_num); return NULL; } return &g_module_db[0].func_table[func_num]; @@ -33,7 +33,7 @@ void CallSVC(u32 opcode) { if (info->func) { info->func(); } else { - ERROR_LOG(HLE, "Unimplemented SVC function %s(..)", info->name.c_str()); + ERROR_LOG(HLE, "unimplemented SVC function %s(..)", info->name.c_str()); } } @@ -43,7 +43,7 @@ void EatCycles(u32 cycles) { void ReSchedule(const char *reason) { #ifdef _DEBUG - _dbg_assert_msg_(HLE, reason != 0 && strlen(reason) < 256, "ReSchedule: Invalid or too long reason."); + _dbg_assert_msg_(HLE, reason != 0 && strlen(reason) < 256, "Reschedule: Invalid or too long reason."); #endif // TODO: ImplementMe } diff --git a/src/core/hle/service/apt.cpp b/src/core/hle/service/apt.cpp index f2118ba0..10d9a94b 100644 --- a/src/core/hle/service/apt.cpp +++ b/src/core/hle/service/apt.cpp @@ -17,7 +17,7 @@ namespace APT_U { void Initialize(Service::Interface* self) { u32* cmd_buff = Service::GetCommandBuffer(); - DEBUG_LOG(KERNEL, "APT_U::Initialize called"); + DEBUG_LOG(KERNEL, "called"); cmd_buff[3] = Kernel::CreateEvent(RESETTYPE_ONESHOT); // APT menu event handle cmd_buff[4] = Kernel::CreateEvent(RESETTYPE_ONESHOT); // APT pause event handle @@ -33,14 +33,14 @@ void GetLockHandle(Service::Interface* self) { 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 handle=0x%08X", cmd_buff[5]); + 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) APT_U::Enable called unk=0x%08X", unk); + ERROR_LOG(KERNEL, "(UNIMPEMENTED) called unk=0x%08X", unk); } void InquireNotification(Service::Interface* self) { @@ -48,7 +48,7 @@ void InquireNotification(Service::Interface* self) { u32 app_id = cmd_buff[2]; cmd_buff[1] = 0; // No error cmd_buff[3] = 0; // Signal type - ERROR_LOG(KERNEL, "(UNIMPEMENTED) APT_U::InquireNotification called app_id=0x%08X", app_id); + ERROR_LOG(KERNEL, "(UNIMPEMENTED) called app_id=0x%08X", app_id); } const Interface::FunctionInfo FunctionTable[] = { diff --git a/src/core/hle/service/gsp.cpp b/src/core/hle/service/gsp.cpp index 50cee2c4..575db86c 100644 --- a/src/core/hle/service/gsp.cpp +++ b/src/core/hle/service/gsp.cpp @@ -92,7 +92,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); } } @@ -117,7 +117,7 @@ void TriggerCmdReqQueue(Service::Interface* self) { break; 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); diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 08d0c43f..904670e6 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -12,6 +12,8 @@ #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/pt.h" #include "core/hle/service/srv.h" #include "core/hle/kernel/kernel.h" @@ -72,14 +74,16 @@ 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); + g_manager->AddService(new PT_A::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"); } diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp index 97e7fc8f..ac8f398f 100644 --- a/src/core/hle/service/srv.cpp +++ b/src/core/hle/service/srv.cpp @@ -15,14 +15,14 @@ namespace SRV { Handle g_mutex = 0; void Initialize(Service::Interface* self) { - DEBUG_LOG(OSHLE, "SRV::Initialize called"); + DEBUG_LOG(OSHLE, "called"); if (!g_mutex) { g_mutex = Kernel::CreateMutex(false); } } void GetProcSemaphore(Service::Interface* self) { - DEBUG_LOG(OSHLE, "SRV::GetProcSemaphore called"); + DEBUG_LOG(OSHLE, "called"); // Get process semaphore? u32* cmd_buff = Service::GetCommandBuffer(); cmd_buff[1] = 0; // No error @@ -36,7 +36,7 @@ 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); - DEBUG_LOG(OSHLE, "SRV::Sync - GetHandle - port: %s, handle: 0x%08X", port_name.c_str(), + DEBUG_LOG(OSHLE, "called port=%s, handle=0x%08X", port_name.c_str(), service->GetHandle()); if (NULL != service) { diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index 27f2b231..01fb647e 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp @@ -37,7 +37,7 @@ enum MapMemoryPermission { Result ControlMemory(void* _outaddr, u32 operation, u32 addr0, u32 addr1, u32 size, u32 permissions) { u32 virtual_address = 0x00000000; - DEBUG_LOG(SVC, "ControlMemory called operation=0x%08X, addr0=0x%08X, addr1=0x%08X, size=%08X, permissions=0x%08X", + DEBUG_LOG(SVC,"called operation=0x%08X, addr0=0x%08X, addr1=0x%08X, size=%08X, permissions=0x%08X", operation, addr0, addr1, size, permissions); switch (operation) { @@ -54,7 +54,7 @@ Result ControlMemory(void* _outaddr, u32 operation, u32 addr0, u32 addr1, u32 si // Unknown ControlMemory operation default: - ERROR_LOG(SVC, "ControlMemory unknown operation=0x%08X", operation); + ERROR_LOG(SVC, "unknown operation=0x%08X", operation); } Core::g_app_core->SetReg(1, virtual_address); @@ -64,7 +64,7 @@ Result ControlMemory(void* _outaddr, u32 operation, u32 addr0, u32 addr1, u32 si /// Maps a memory block to specified address Result MapMemoryBlock(Handle memblock, u32 addr, u32 mypermissions, u32 otherpermission) { - DEBUG_LOG(SVC, "MapMemoryBlock called memblock=0x08X, addr=0x%08X, mypermissions=0x%08X, otherpermission=%d", + DEBUG_LOG(SVC, "called memblock=0x08X, addr=0x%08X, mypermissions=0x%08X, otherpermission=%d", memblock, addr, mypermissions, otherpermission); switch (mypermissions) { case MEMORY_PERMISSION_NORMAL: @@ -73,7 +73,7 @@ Result MapMemoryBlock(Handle memblock, u32 addr, u32 mypermissions, u32 otherper Memory::MapBlock_Shared(memblock, addr, mypermissions); break; default: - ERROR_LOG(OSHLE, "MapMemoryBlock unknown permissions=0x%08X", mypermissions); + ERROR_LOG(OSHLE, "unknown permissions=0x%08X", mypermissions); } return 0; } @@ -81,8 +81,8 @@ Result MapMemoryBlock(Handle memblock, u32 addr, u32 mypermissions, u32 otherper /// Connect to an OS service given the port name, returns the handle to the port to out Result ConnectToPort(void* _out, const char* port_name) { Service::Interface* service = Service::g_manager->FetchFromPortName(port_name); - DEBUG_LOG(SVC, "ConnectToPort called port_name=%s", port_name); - _assert_msg_(KERNEL, service, "ConnectToPort called, but service is not implemented!"); + DEBUG_LOG(SVC, "called port_name=%s", port_name); + _assert_msg_(KERNEL, service, "called, but service is not implemented!"); Core::g_app_core->SetReg(1, service->GetHandle()); return 0; } @@ -92,8 +92,8 @@ Result SendSyncRequest(Handle handle) { bool wait = false; Kernel::Object* object = Kernel::g_object_pool.GetFast(handle); - DEBUG_LOG(SVC, "SendSyncRequest called handle=0x%08X", handle); - _assert_msg_(KERNEL, object, "SendSyncRequest called, but kernel object is NULL!"); + DEBUG_LOG(SVC, "called handle=0x%08X", handle); + _assert_msg_(KERNEL, object, "called, but kernel object is NULL!"); Result res = object->SyncRequest(&wait); if (wait) { @@ -106,7 +106,7 @@ Result SendSyncRequest(Handle handle) { /// Close a handle Result CloseHandle(Handle handle) { // ImplementMe - ERROR_LOG(SVC, "(UNIMPLEMENTED) CloseHandle called handle=0x%08X", handle); + ERROR_LOG(SVC, "(UNIMPLEMENTED) called handle=0x%08X", handle); return 0; } @@ -117,9 +117,9 @@ Result WaitSynchronization1(Handle handle, s64 nano_seconds) { Kernel::Object* object = Kernel::g_object_pool.GetFast(handle); - DEBUG_LOG(SVC, "WaitSynchronization1 called handle=0x%08X, nanoseconds=%d", handle, + DEBUG_LOG(SVC, "called handle=0x%08X, nanoseconds=%d", handle, nano_seconds); - _assert_msg_(KERNEL, object, "WaitSynchronization1 called, but kernel object is NULL!"); + _assert_msg_(KERNEL, object, "called, but kernel object is NULL!"); Result res = object->WaitSynchronization(&wait); @@ -139,7 +139,7 @@ Result WaitSynchronizationN(void* _out, void* _handles, u32 handle_count, u32 wa Handle* handles = (Handle*)_handles; bool unlock_all = true; - DEBUG_LOG(SVC, "WaitSynchronizationN called handle_count=%d, wait_all=%s, nanoseconds=%d", + DEBUG_LOG(SVC, "called handle_count=%d, wait_all=%s, nanoseconds=%d", handle_count, (wait_all ? "true" : "false"), nano_seconds); // Iterate through each handle, synchronize kernel object @@ -147,7 +147,7 @@ Result WaitSynchronizationN(void* _out, void* _handles, u32 handle_count, u32 wa bool wait = false; Kernel::Object* object = Kernel::g_object_pool.GetFast(handles[i]); // 0 handle - _assert_msg_(KERNEL, object, "WaitSynchronizationN called handle=0x%08X, but kernel object " + _assert_msg_(KERNEL, object, "called handle=0x%08X, but kernel object " "is NULL!", handles[i]); DEBUG_LOG(SVC, "\thandle[%d] = 0x%08X", i, handles[i]); @@ -176,14 +176,14 @@ Result WaitSynchronizationN(void* _out, void* _handles, u32 handle_count, u32 wa /// Create an address arbiter (to allocate access to shared resources) Result CreateAddressArbiter(void* arbiter) { - ERROR_LOG(SVC, "(UNIMPLEMENTED) CreateAddressArbiter called"); + ERROR_LOG(SVC, "(UNIMPLEMENTED) called"); Core::g_app_core->SetReg(1, 0xFABBDADD); return 0; } /// Arbitrate address Result ArbitrateAddress(Handle arbiter, u32 addr, u32 _type, u32 value, s64 nanoseconds) { - ERROR_LOG(SVC, "(UNIMPLEMENTED) ArbitrateAddress called"); + ERROR_LOG(SVC, "(UNIMPLEMENTED) called"); ArbitrationType type = (ArbitrationType)_type; Memory::Write32(addr, type); return 0; @@ -199,14 +199,15 @@ Result GetResourceLimit(void* resource_limit, Handle process) { // With regards to proceess values: // 0xFFFF8001 is a handle alias for the current KProcess, and 0xFFFF8000 is a handle alias for // the current KThread. - ERROR_LOG(SVC, "(UNIMPLEMENTED) GetResourceLimit called process=0x%08X", process); + ERROR_LOG(SVC, "(UNIMPLEMENTED) called process=0x%08X", process); Core::g_app_core->SetReg(1, 0xDEADBEEF); return 0; } /// Get resource limit current values -Result GetResourceLimitCurrentValues(void* _values, Handle resource_limit, void* names, s32 name_count) { - ERROR_LOG(SVC, "(UNIMPLEMENTED) GetResourceLimitCurrentValues called resource_limit=%08X, names=%s, name_count=%d", +Result GetResourceLimitCurrentValues(void* _values, Handle resource_limit, void* names, + s32 name_count) { + ERROR_LOG(SVC, "(UNIMPLEMENTED) called resource_limit=%08X, names=%s, name_count=%d", resource_limit, names, name_count); Memory::Write32(Core::g_app_core->GetReg(0), 0); // Normmatt: Set used memory to 0 for now return 0; @@ -229,7 +230,7 @@ Result CreateThread(u32 priority, u32 entry_point, u32 arg, u32 stack_top, u32 p Core::g_app_core->SetReg(1, thread); - DEBUG_LOG(SVC, "CreateThread called entrypoint=0x%08X (%s), arg=0x%08X, stacktop=0x%08X, " + DEBUG_LOG(SVC, "called entrypoint=0x%08X (%s), arg=0x%08X, stacktop=0x%08X, " "threadpriority=0x%08X, processorid=0x%08X : created handle=0x%08X", entry_point, name.c_str(), arg, stack_top, priority, processor_id, thread); @@ -240,28 +241,28 @@ Result CreateThread(u32 priority, u32 entry_point, u32 arg, u32 stack_top, u32 p Result CreateMutex(void* _mutex, u32 initial_locked) { Handle mutex = Kernel::CreateMutex((initial_locked != 0)); Core::g_app_core->SetReg(1, mutex); - DEBUG_LOG(SVC, "CreateMutex called initial_locked=%s : created handle=0x%08X", + DEBUG_LOG(SVC, "called initial_locked=%s : created handle=0x%08X", initial_locked ? "true" : "false", mutex); return 0; } /// Release a mutex Result ReleaseMutex(Handle handle) { - DEBUG_LOG(SVC, "ReleaseMutex called handle=0x%08X", handle); - _assert_msg_(KERNEL, handle, "ReleaseMutex called, but handle is NULL!"); + DEBUG_LOG(SVC, "called handle=0x%08X", handle); + _assert_msg_(KERNEL, handle, "called, but handle is NULL!"); Kernel::ReleaseMutex(handle); return 0; } /// Get current thread ID Result GetThreadId(void* thread_id, u32 thread) { - ERROR_LOG(SVC, "(UNIMPLEMENTED) GetThreadId called thread=0x%08X", thread); + ERROR_LOG(SVC, "(UNIMPLEMENTED) called thread=0x%08X", thread); return 0; } /// Query memory Result QueryMemory(void *_info, void *_out, u32 addr) { - ERROR_LOG(SVC, "(UNIMPLEMENTED) QueryMemory called addr=0x%08X", addr); + ERROR_LOG(SVC, "(UNIMPLEMENTED) called addr=0x%08X", addr); return 0; } @@ -269,7 +270,7 @@ Result QueryMemory(void *_info, void *_out, u32 addr) { Result CreateEvent(void* _event, u32 reset_type) { Handle evt = Kernel::CreateEvent((ResetType)reset_type); Core::g_app_core->SetReg(1, evt); - DEBUG_LOG(SVC, "CreateEvent called reset_type=0x%08X : created handle=0x%08X", + DEBUG_LOG(SVC, "called reset_type=0x%08X : created handle=0x%08X", reset_type, evt); return 0; } @@ -277,14 +278,14 @@ Result CreateEvent(void* _event, u32 reset_type) { /// Duplicates a kernel handle Result DuplicateHandle(void* _out, Handle handle) { Handle* out = (Handle*)_out; - ERROR_LOG(SVC, "(UNIMPLEMENTED) DuplicateHandle called handle=0x%08X", handle); + ERROR_LOG(SVC, "(UNIMPLEMENTED) called handle=0x%08X", handle); return 0; } /// Clears an event Result ClearEvent(Handle evt) { Result res = Kernel::ClearEvent(evt); - DEBUG_LOG(SVC, "ClearEvent called event=0x%08X", evt); + DEBUG_LOG(SVC, "called event=0x%08X", evt); return res; } diff --git a/src/core/mem_map_funcs.cpp b/src/core/mem_map_funcs.cpp index 86e9eaa2..ab014a59 100644 --- a/src/core/mem_map_funcs.cpp +++ b/src/core/mem_map_funcs.cpp @@ -86,7 +86,7 @@ inline void _Read(T &var, const u32 addr) { var = *((const T*)&g_vram[vaddr & VRAM_MASK]); } else { - //_assert_msg_(MEMMAP, false, "unknown Read%d @ 0x%08X", sizeof(var) * 8, vaddr); + ERROR_LOG(MEMMAP, "unknown Read%d @ 0x%08X", sizeof(var) * 8, vaddr); } } @@ -136,8 +136,7 @@ inline void _Write(u32 addr, const T data) { // Error out... } else { - _assert_msg_(MEMMAP, false, "unknown Write%d 0x%08X @ 0x%08X", sizeof(data) * 8, - data, vaddr); + ERROR_LOG(MEMMAP, "unknown Write%d 0x%08X @ 0x%08X", sizeof(data) * 8, data, vaddr); } } -- cgit v1.2.3 From 007b7edada86bf97e1499625c3c8fda25132bbac Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 29 May 2014 23:54:09 -0400 Subject: srv: fix to log unimplemented service (instead of crash) --- src/core/hle/service/srv.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp index ac8f398f..f1940e6f 100644 --- a/src/core/hle/service/srv.cpp +++ b/src/core/hle/service/srv.cpp @@ -36,18 +36,14 @@ 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); - DEBUG_LOG(OSHLE, "called port=%s, handle=0x%08X", port_name.c_str(), - service->GetHandle()); - if (NULL != 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[] = { -- cgit v1.2.3 From 2482be13df81eaae17b721e080249bd6c4de759e Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 30 May 2014 00:22:25 -0400 Subject: service: removed PT_A from, as this was just an alias for APT_U --- src/core/hle/service/service.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 904670e6..781b41fb 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -13,7 +13,6 @@ #include "core/hle/service/gsp.h" #include "core/hle/service/hid.h" #include "core/hle/service/ndm.h" -#include "core/hle/service/pt.h" #include "core/hle/service/srv.h" #include "core/hle/kernel/kernel.h" @@ -75,7 +74,6 @@ void Init() { g_manager->AddService(new GSP_GPU::Interface); g_manager->AddService(new HID_User::Interface); g_manager->AddService(new NDM_U::Interface); - g_manager->AddService(new PT_A::Interface); NOTICE_LOG(HLE, "initialized OK"); } -- cgit v1.2.3 From c451ad28355b48f9d55a9b1a939e913fbf875953 Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 30 May 2014 00:22:39 -0400 Subject: service: cleaned up log messages --- src/core/hle/service/service.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 8f8d4d55..c3e9dd31 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -85,7 +85,7 @@ public: 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]); // TODO(bunnei): Hack - ignore error @@ -94,7 +94,7 @@ public: return 0; } if (itr->second.func == NULL) { - ERROR_LOG(OSHLE, "Unimplemented function: port = %s, name = %s!", + ERROR_LOG(OSHLE, "unimplemented function: port=%s, name=%s", GetPortName(), itr->second.name.c_str()); // TODO(bunnei): Hack - ignore error -- cgit v1.2.3 From 55325dea4c85e1a91c6d37282322b466ef40ffac Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 30 May 2014 00:24:04 -0400 Subject: hle: added stubbed service for ndm_u --- src/core/CMakeLists.txt | 1 + src/core/core.vcxproj | 2 ++ src/core/core.vcxproj.filters | 6 ++++++ src/core/hle/service/ndm.cpp | 32 ++++++++++++++++++++++++++++++++ src/core/hle/service/ndm.h | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 74 insertions(+) create mode 100644 src/core/hle/service/ndm.cpp create mode 100644 src/core/hle/service/ndm.h (limited to 'src/core/hle/service') diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 468e6a63..7236033c 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -41,6 +41,7 @@ set(SRCS core.cpp hle/service/apt.cpp hle/service/gsp.cpp hle/service/hid.cpp + hle/service/ndm.cpp hle/service/service.cpp hle/service/srv.cpp hw/hw.cpp diff --git a/src/core/core.vcxproj b/src/core/core.vcxproj index efcd30d7..6fec75d7 100644 --- a/src/core/core.vcxproj +++ b/src/core/core.vcxproj @@ -175,6 +175,7 @@ + @@ -225,6 +226,7 @@ + diff --git a/src/core/core.vcxproj.filters b/src/core/core.vcxproj.filters index 135e4c89..8e5966d7 100644 --- a/src/core/core.vcxproj.filters +++ b/src/core/core.vcxproj.filters @@ -168,6 +168,9 @@ hle\kernel + + hle\service + @@ -301,6 +304,9 @@ hle\kernel + + hle\service + diff --git a/src/core/hle/service/ndm.cpp b/src/core/hle/service/ndm.cpp new file mode 100644 index 00000000..671e9d4b --- /dev/null +++ b/src/core/hle/service/ndm.cpp @@ -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, NULL, "SuspendDaemons"}, + {0x00080040, NULL, "DisableWifiUsage"}, + {0x00090000, NULL, "EnableWifiUsage"}, + {0x00140040, NULL, "OverrideDefaultDaemons"}, +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Interface class + +Interface::Interface() { + Register(FunctionTable, ARRAY_SIZE(FunctionTable)); +} + +Interface::~Interface() { +} + +} // namespace diff --git a/src/core/hle/service/ndm.h b/src/core/hle/service/ndm.h new file mode 100644 index 00000000..fbe88fb8 --- /dev/null +++ b/src/core/hle/service/ndm.h @@ -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 -- cgit v1.2.3 From 7dd18a8df97f7497447ff121d8ad07c5a708a5c5 Mon Sep 17 00:00:00 2001 From: bunnei Date: Sun, 1 Jun 2014 10:41:23 -0400 Subject: gsp: always pass through synchronization barrier for commands --- src/core/hle/service/gsp.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/service/gsp.cpp b/src/core/hle/service/gsp.cpp index 575db86c..2635a2eb 100644 --- a/src/core/hle/service/gsp.cpp +++ b/src/core/hle/service/gsp.cpp @@ -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/lcd.h" @@ -52,6 +53,7 @@ void GX_FinishCommand(u32 thread_id) { namespace GSP_GPU { +Handle g_event_handle = 0; u32 g_thread_id = 0; enum { @@ -100,7 +102,20 @@ 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, "called, but event is NULL!"); + + 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 } -- cgit v1.2.3 From b78aff85857a3a356fdf11e1dbc4e5f52490676e Mon Sep 17 00:00:00 2001 From: bunnei Date: Mon, 2 Jun 2014 20:38:34 -0400 Subject: svc: added optional name field to Event and Mutex (used for debugging) --- src/core/hle/kernel/event.cpp | 11 ++++++++--- src/core/hle/kernel/event.h | 3 ++- src/core/hle/kernel/mutex.cpp | 12 +++++++++--- src/core/hle/kernel/mutex.h | 3 ++- src/core/hle/service/apt.cpp | 6 +++--- src/core/hle/service/srv.cpp | 2 +- 6 files changed, 25 insertions(+), 12 deletions(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/kernel/event.cpp b/src/core/hle/kernel/event.cpp index e84d0b49..70e50115 100644 --- a/src/core/hle/kernel/event.cpp +++ b/src/core/hle/kernel/event.cpp @@ -15,6 +15,7 @@ namespace Kernel { class Event : public Object { public: const char* GetTypeName() { return "Event"; } + const char* GetName() { return name.c_str(); } static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Event; } Kernel::HandleType GetHandleType() const { return Kernel::HandleType::Event; } @@ -24,6 +25,7 @@ public: bool locked; ///< Current locked state bool permanent_locked; ///< Hack - to set event permanent state (for easy passthrough) + std::string name; ///< Name of event (optional) /** * Synchronize kernel object @@ -98,9 +100,10 @@ Result ClearEvent(Handle handle) { * Creates an event * @param handle Reference to handle for the newly created mutex * @param reset_type ResetType describing how to create event + * @param name Optional name of event * @return Newly created Event object */ -Event* CreateEvent(Handle& handle, const ResetType reset_type) { +Event* CreateEvent(Handle& handle, const ResetType reset_type, const std::string name) { Event* evt = new Event; handle = Kernel::g_object_pool.Create(evt); @@ -108,6 +111,7 @@ Event* CreateEvent(Handle& handle, const ResetType reset_type) { evt->locked = true; evt->permanent_locked = false; evt->reset_type = evt->intitial_reset_type = reset_type; + evt->name = name; return evt; } @@ -115,11 +119,12 @@ Event* CreateEvent(Handle& handle, const ResetType reset_type) { /** * Creates an event * @param reset_type ResetType describing how to create event + * @param name Optional name of event * @return Handle to newly created Event object */ -Handle CreateEvent(const ResetType reset_type) { +Handle CreateEvent(const ResetType reset_type, const std::string name) { Handle handle; - Event* evt = CreateEvent(handle, reset_type); + Event* evt = CreateEvent(handle, reset_type, name); return handle; } diff --git a/src/core/hle/kernel/event.h b/src/core/hle/kernel/event.h index f91a72c1..eed09f0e 100644 --- a/src/core/hle/kernel/event.h +++ b/src/core/hle/kernel/event.h @@ -37,8 +37,9 @@ Result ClearEvent(Handle handle); /** * Creates an event * @param reset_type ResetType describing how to create event + * @param name Optional name of event * @return Handle to newly created Event object */ -Handle CreateEvent(const ResetType reset_type); +Handle CreateEvent(const ResetType reset_type, const std::string name="Unknown"); } // namespace diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index 5ac88cd8..7e60fbfe 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp @@ -16,6 +16,7 @@ namespace Kernel { class Mutex : public Object { public: const char* GetTypeName() { return "Mutex"; } + const char* GetName() { return name.c_str(); } static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Mutex; } Kernel::HandleType GetHandleType() const { return Kernel::HandleType::Mutex; } @@ -24,6 +25,7 @@ public: bool locked; ///< Current locked state Handle lock_thread; ///< Handle to thread that currently has mutex std::vector waiting_threads; ///< Threads that are waiting for the mutex + std::string name; ///< Name of mutex (optional) /** * Synchronize kernel object @@ -128,13 +130,15 @@ Result ReleaseMutex(Handle handle) { * Creates a mutex * @param handle Reference to handle for the newly created mutex * @param initial_locked Specifies if the mutex should be locked initially + * @param name Optional name of mutex * @return Pointer to new Mutex object */ -Mutex* CreateMutex(Handle& handle, bool initial_locked) { +Mutex* CreateMutex(Handle& handle, bool initial_locked, const std::string name) { Mutex* mutex = new Mutex; handle = Kernel::g_object_pool.Create(mutex); mutex->locked = mutex->initial_locked = initial_locked; + mutex->name = name; // Acquire mutex with current thread if initialized as locked... if (mutex->locked) { @@ -150,10 +154,12 @@ Mutex* CreateMutex(Handle& handle, bool initial_locked) { /** * Creates a mutex * @param initial_locked Specifies if the mutex should be locked initially + * @param name Optional name of mutex + * @return Handle to newly created object */ -Handle CreateMutex(bool initial_locked) { +Handle CreateMutex(bool initial_locked, std::string name) { Handle handle; - Mutex* mutex = CreateMutex(handle, initial_locked); + Mutex* mutex = CreateMutex(handle, initial_locked, name); return handle; } diff --git a/src/core/hle/kernel/mutex.h b/src/core/hle/kernel/mutex.h index 4cd26672..fde5549f 100644 --- a/src/core/hle/kernel/mutex.h +++ b/src/core/hle/kernel/mutex.h @@ -20,8 +20,9 @@ Result ReleaseMutex(Handle handle); /** * Creates a mutex * @param initial_locked Specifies if the mutex should be locked initially + * @param name Optional name of mutex * @return Handle to newly created object */ -Handle CreateMutex(bool initial_locked); +Handle CreateMutex(bool initial_locked, const std::string name="Unknown"); } // namespace diff --git a/src/core/hle/service/apt.cpp b/src/core/hle/service/apt.cpp index 10d9a94b..33ee1ec8 100644 --- a/src/core/hle/service/apt.cpp +++ b/src/core/hle/service/apt.cpp @@ -19,8 +19,8 @@ void Initialize(Service::Interface* self) { u32* cmd_buff = Service::GetCommandBuffer(); DEBUG_LOG(KERNEL, "called"); - cmd_buff[3] = Kernel::CreateEvent(RESETTYPE_ONESHOT); // APT menu event handle - cmd_buff[4] = Kernel::CreateEvent(RESETTYPE_ONESHOT); // APT pause event handle + 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 @@ -32,7 +32,7 @@ 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); + cmd_buff[5] = Kernel::CreateMutex(false, "APT_U:Lock"); DEBUG_LOG(KERNEL, "called handle=0x%08X", cmd_buff[5]); } diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp index f1940e6f..07e2009a 100644 --- a/src/core/hle/service/srv.cpp +++ b/src/core/hle/service/srv.cpp @@ -17,7 +17,7 @@ Handle g_mutex = 0; void Initialize(Service::Interface* self) { DEBUG_LOG(OSHLE, "called"); if (!g_mutex) { - g_mutex = Kernel::CreateMutex(false); + g_mutex = Kernel::CreateMutex(true, "SRV:Lock"); } } -- cgit v1.2.3 From 870c6146e727e3537536f162e76ee8e20d56622f Mon Sep 17 00:00:00 2001 From: bunnei Date: Wed, 4 Jun 2014 18:50:50 -0400 Subject: service: added a error log messages for unimplemented WaitSynchronization --- src/core/hle/service/service.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/core/hle/service') diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index c3e9dd31..8699ad30 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -115,6 +115,7 @@ public: */ Result WaitSynchronization(bool* wait) { // TODO(bunnei): ImplementMe + ERROR_LOG(OSHLE, "unimplemented function"); return 0; } -- cgit v1.2.3 From 8cac527c943253a9471849d17b1520f4762fbb5c Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 6 Jun 2014 00:10:50 -0400 Subject: Kernel: Updated several member functions to be const --- src/core/hle/kernel/event.cpp | 6 +++--- src/core/hle/kernel/kernel.h | 4 ++-- src/core/hle/kernel/mutex.cpp | 6 +++--- src/core/hle/kernel/thread.cpp | 6 +++--- src/core/hle/service/service.h | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/kernel/event.cpp b/src/core/hle/kernel/event.cpp index 36c7dcbc..72a190f8 100644 --- a/src/core/hle/kernel/event.cpp +++ b/src/core/hle/kernel/event.cpp @@ -16,10 +16,10 @@ namespace Kernel { class Event : public Object { public: - const char* GetTypeName() { return "Event"; } - const char* GetName() { return name.c_str(); } + const char* GetTypeName() const { return "Event"; } + const char* GetName() const { return name.c_str(); } - static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Event; } + static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Event; } Kernel::HandleType GetHandleType() const { return Kernel::HandleType::Event; } ResetType intitial_reset_type; ///< ResetType specified at Event initialization diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index f1bb7880..d2d624f6 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h @@ -44,8 +44,8 @@ class Object : NonCopyable { public: virtual ~Object() {} Handle GetHandle() const { return handle; } - virtual const char* GetTypeName() { return "[BAD KERNEL OBJECT TYPE]"; } - virtual const char* GetName() { return "[UNKNOWN KERNEL OBJECT]"; } + virtual const char* GetTypeName() const { return "[BAD KERNEL OBJECT TYPE]"; } + virtual const char* GetName() const { return "[UNKNOWN KERNEL OBJECT]"; } virtual Kernel::HandleType GetHandleType() const = 0; /** diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index 133c4307..9d909ea0 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp @@ -15,10 +15,10 @@ namespace Kernel { class Mutex : public Object { public: - const char* GetTypeName() { return "Mutex"; } - const char* GetName() { return name.c_str(); } + const char* GetTypeName() const { return "Mutex"; } + const char* GetName() const { return name.c_str(); } - static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Mutex; } + static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Mutex; } Kernel::HandleType GetHandleType() const { return Kernel::HandleType::Mutex; } bool initial_locked; ///< Initial lock state when mutex was created diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 6196c352..da93e006 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -25,10 +25,10 @@ namespace Kernel { class Thread : public Kernel::Object { public: - const char* GetName() { return name; } - const char* GetTypeName() { return "Thread"; } + const char* GetName() const { return name; } + const char* GetTypeName() const { return "Thread"; } - static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Thread; } + static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Thread; } Kernel::HandleType GetHandleType() const { return Kernel::HandleType::Thread; } inline bool IsRunning() const { return (status & THREADSTATUS_RUNNING) != 0; } diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 8699ad30..4b5c5b3c 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -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; } -- cgit v1.2.3 From d7363322c79d6e7598e0d80cf1af9c05b652cecb Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 6 Jun 2014 00:19:40 -0400 Subject: HLE: Updated various handle debug assertions to be more clear. --- src/core/hle/kernel/mutex.cpp | 2 +- src/core/hle/kernel/thread.cpp | 4 ++-- src/core/hle/service/gsp.cpp | 2 +- src/core/hle/svc.cpp | 12 ++++++------ 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index eee7c493..ee7507ed 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp @@ -122,7 +122,7 @@ bool ReleaseMutex(Mutex* mutex) { Result ReleaseMutex(Handle handle) { Mutex* mutex = Kernel::g_object_pool.GetFast(handle); - _assert_msg_(KERNEL, mutex, "ReleaseMutex tried to release a NULL mutex!"); + _assert_msg_(KERNEL, (mutex != NULL), "ReleaseMutex tried to release a NULL mutex!"); if (!ReleaseMutex(mutex)) { return -1; diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index da93e006..5fdb4fbe 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -353,7 +353,7 @@ Handle CreateThread(const char* name, u32 entry_point, s32 priority, u32 arg, s3 /// Get the priority of the thread specified by handle u32 GetThreadPriority(const Handle handle) { Thread* thread = g_object_pool.GetFast(handle); - _assert_msg_(KERNEL, thread, "called, but thread is NULL!"); + _assert_msg_(KERNEL, (thread != NULL), "called, but thread is NULL!"); return thread->current_priority; } @@ -365,7 +365,7 @@ Result SetThreadPriority(Handle handle, s32 priority) { } else { thread = g_object_pool.GetFast(handle); } - _assert_msg_(KERNEL, thread, "called, but thread is NULL!"); + _assert_msg_(KERNEL, (thread != NULL), "called, but thread is NULL!"); // If priority is invalid, clamp to valid range if (priority < THREADPRIO_HIGHEST || priority > THREADPRIO_LOWEST) { diff --git a/src/core/hle/service/gsp.cpp b/src/core/hle/service/gsp.cpp index 2635a2eb..c181e296 100644 --- a/src/core/hle/service/gsp.cpp +++ b/src/core/hle/service/gsp.cpp @@ -104,7 +104,7 @@ void RegisterInterruptRelayQueue(Service::Interface* self) { u32 flags = cmd_buff[1]; u32 event_handle = cmd_buff[3]; - _assert_msg_(GSP, event_handle, "called, but event is NULL!"); + _assert_msg_(GSP, (event_handle != 0), "called, but event is NULL!"); g_event_handle = event_handle; diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index 0ce83110..c389bbaa 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp @@ -81,7 +81,7 @@ Result ConnectToPort(void* _out, const char* port_name) { Service::Interface* service = Service::g_manager->FetchFromPortName(port_name); DEBUG_LOG(SVC, "called port_name=%s", port_name); - _assert_msg_(KERNEL, service, "called, but service is not implemented!"); + _assert_msg_(KERNEL, (service != NULL), "called, but service is not implemented!"); *out = service->GetHandle(); @@ -93,7 +93,7 @@ Result SendSyncRequest(Handle handle) { bool wait = false; Kernel::Object* object = Kernel::g_object_pool.GetFast(handle); - _assert_msg_(KERNEL, object, "called, but kernel object is NULL!"); + _assert_msg_(KERNEL, (object != NULL), "called, but kernel object is NULL!"); DEBUG_LOG(SVC, "called handle=0x%08X(%s)", handle, object->GetTypeName()); Result res = object->SyncRequest(&wait); @@ -122,7 +122,7 @@ Result WaitSynchronization1(Handle handle, s64 nano_seconds) { DEBUG_LOG(SVC, "called handle=0x%08X(%s:%s), nanoseconds=%d", handle, object->GetTypeName(), object->GetName(), nano_seconds); - _assert_msg_(KERNEL, object, "called, but kernel object is NULL!"); + _assert_msg_(KERNEL, (object != NULL), "called, but kernel object is NULL!"); Result res = object->WaitSynchronization(&wait); @@ -150,9 +150,9 @@ Result WaitSynchronizationN(void* _out, void* _handles, u32 handle_count, u32 wa // Iterate through each handle, synchronize kernel object for (u32 i = 0; i < handle_count; i++) { bool wait = false; - Kernel::Object* object = Kernel::g_object_pool.GetFast(handles[i]); // 0 handle + Kernel::Object* object = Kernel::g_object_pool.GetFast(handles[i]); - _assert_msg_(KERNEL, object, "called handle=0x%08X, but kernel object " + _assert_msg_(KERNEL, (object != NULL), "called handle=0x%08X, but kernel object " "is NULL!", handles[i]); DEBUG_LOG(SVC, "\thandle[%d] = 0x%08X(%s:%s)", i, handles[i], object->GetTypeName(), @@ -278,7 +278,7 @@ Result CreateMutex(void* _mutex, u32 initial_locked) { /// Release a mutex Result ReleaseMutex(Handle handle) { DEBUG_LOG(SVC, "called handle=0x%08X", handle); - _assert_msg_(KERNEL, handle, "called, but handle is NULL!"); + _assert_msg_(KERNEL, (handle != 0), "called, but handle is NULL!"); Kernel::ReleaseMutex(handle); return 0; } -- cgit v1.2.3 From c95972275e276abe3afcac79d956ea29a0879c8e Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 6 Jun 2014 00:35:49 -0400 Subject: HLE: Updated all uses of NULL to nullptr (to be C++11 compliant) --- src/core/core.cpp | 8 +- src/core/hle/hle.cpp | 2 +- src/core/hle/kernel/kernel.cpp | 2 +- src/core/hle/kernel/mutex.cpp | 2 +- src/core/hle/kernel/thread.cpp | 14 +-- src/core/hle/service/apt.cpp | 148 +++++++++++++-------------- src/core/hle/service/gsp.cpp | 56 +++++----- src/core/hle/service/hid.cpp | 10 +- src/core/hle/service/ndm.cpp | 8 +- src/core/hle/service/service.cpp | 4 +- src/core/hle/service/service.h | 2 +- src/core/hle/service/srv.cpp | 8 +- src/core/hle/svc.cpp | 214 +++++++++++++++++++-------------------- 13 files changed, 239 insertions(+), 239 deletions(-) (limited to 'src/core/hle/service') diff --git a/src/core/core.cpp b/src/core/core.cpp index 26d52f7b..d366498a 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -18,10 +18,10 @@ namespace Core { -u64 g_last_ticks = 0; ///< Last CPU ticks -ARM_Disasm* g_disasm = NULL; ///< ARM disassembler -ARM_Interface* g_app_core = NULL; ///< ARM11 application core -ARM_Interface* g_sys_core = NULL; ///< ARM11 system (OS) core +u64 g_last_ticks = 0; ///< Last CPU ticks +ARM_Disasm* g_disasm = nullptr; ///< ARM disassembler +ARM_Interface* g_app_core = nullptr; ///< ARM11 application core +ARM_Interface* g_sys_core = nullptr; ///< ARM11 system (OS) core /// Run the core CPU loop void RunLoop() { diff --git a/src/core/hle/hle.cpp b/src/core/hle/hle.cpp index e49395f5..dde6d0f4 100644 --- a/src/core/hle/hle.cpp +++ b/src/core/hle/hle.cpp @@ -22,7 +22,7 @@ const FunctionDef* GetSVCInfo(u32 opcode) { u32 func_num = opcode & 0xFFFFFF; // 8 bits if (func_num > 0xFF) { ERROR_LOG(HLE,"unknown svc=0x%02X", func_num); - return NULL; + return nullptr; } return &g_module_db[0].func_table[func_num]; } diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 9d5991c3..e51a9d45 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -128,7 +128,7 @@ Object* ObjectPool::CreateByIDType(int type) { default: ERROR_LOG(COMMON, "Unable to load state: could not find object type %d.", type); - return NULL; + return nullptr; } } diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index a76c8de0..1ccf1eb7 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp @@ -122,7 +122,7 @@ bool ReleaseMutex(Mutex* mutex) { Result ReleaseMutex(Handle handle) { Mutex* mutex = Kernel::g_object_pool.GetFast(handle); - _assert_msg_(KERNEL, (mutex != NULL), "ReleaseMutex tried to release a NULL mutex!"); + _assert_msg_(KERNEL, (mutex != nullptr), "ReleaseMutex tried to release a nullptr mutex!"); if (!ReleaseMutex(mutex)) { return -1; diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 5fdb4fbe..700f4ea7 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -223,7 +223,7 @@ void SwitchContext(Thread* t) { t->wait_type = WAITTYPE_NONE; LoadContext(t->context); } else { - SetCurrentThread(NULL); + SetCurrentThread(nullptr); } } @@ -238,7 +238,7 @@ Thread* NextThread() { next = g_thread_ready_queue.pop_first(); } if (next == 0) { - return NULL; + return nullptr; } return Kernel::g_object_pool.GetFast(next); } @@ -312,8 +312,8 @@ Thread* CreateThread(Handle& handle, const char* name, u32 entry_point, s32 prio Handle CreateThread(const char* name, u32 entry_point, s32 priority, u32 arg, s32 processor_id, u32 stack_top, int stack_size) { - if (name == NULL) { - ERROR_LOG(KERNEL, "CreateThread(): NULL name"); + if (name == nullptr) { + ERROR_LOG(KERNEL, "CreateThread(): nullptr name"); return -1; } if ((u32)stack_size < 0x200) { @@ -353,19 +353,19 @@ Handle CreateThread(const char* name, u32 entry_point, s32 priority, u32 arg, s3 /// Get the priority of the thread specified by handle u32 GetThreadPriority(const Handle handle) { Thread* thread = g_object_pool.GetFast(handle); - _assert_msg_(KERNEL, (thread != NULL), "called, but thread is NULL!"); + _assert_msg_(KERNEL, (thread != nullptr), "called, but thread is nullptr!"); return thread->current_priority; } /// Set the priority of the thread specified by handle Result SetThreadPriority(Handle handle, s32 priority) { - Thread* thread = NULL; + Thread* thread = nullptr; if (!handle) { thread = GetCurrentThread(); // TODO(bunnei): Is this correct behavior? } else { thread = g_object_pool.GetFast(handle); } - _assert_msg_(KERNEL, (thread != NULL), "called, but thread is NULL!"); + _assert_msg_(KERNEL, (thread != nullptr), "called, but thread is nullptr!"); // If priority is invalid, clamp to valid range if (priority < THREADPRIO_HIGHEST || priority > THREADPRIO_LOWEST) { diff --git a/src/core/hle/service/apt.cpp b/src/core/hle/service/apt.cpp index 33ee1ec8..a0012b5d 100644 --- a/src/core/hle/service/apt.cpp +++ b/src/core/hle/service/apt.cpp @@ -55,81 +55,81 @@ const Interface::FunctionInfo FunctionTable[] = { {0x00010040, GetLockHandle, "GetLockHandle"}, {0x00020080, Initialize, "Initialize"}, {0x00030040, Enable, "Enable"}, - {0x00040040, NULL, "Finalize"}, - {0x00050040, NULL, "GetAppletManInfo"}, - {0x00060040, NULL, "GetAppletInfo"}, - {0x00070000, NULL, "GetLastSignaledAppletId"}, - {0x00080000, NULL, "CountRegisteredApplet"}, - {0x00090040, NULL, "IsRegistered"}, - {0x000A0040, NULL, "GetAttribute"}, + {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, 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"}, + {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"}, }; //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/hle/service/gsp.cpp b/src/core/hle/service/gsp.cpp index c181e296..f31e7d86 100644 --- a/src/core/hle/service/gsp.cpp +++ b/src/core/hle/service/gsp.cpp @@ -104,7 +104,7 @@ void RegisterInterruptRelayQueue(Service::Interface* self) { u32 flags = cmd_buff[1]; u32 event_handle = cmd_buff[3]; - _assert_msg_(GSP, (event_handle != 0), "called, but event is NULL!"); + _assert_msg_(GSP, (event_handle != 0), "called, but event is nullptr!"); g_event_handle = event_handle; @@ -139,36 +139,36 @@ void TriggerCmdReqQueue(Service::Interface* self) { } 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"}, }; //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/hle/service/hid.cpp b/src/core/hle/service/hid.cpp index 5542e5bf..ab78f47d 100644 --- a/src/core/hle/service/hid.cpp +++ b/src/core/hle/service/hid.cpp @@ -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"}, }; //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/hle/service/ndm.cpp b/src/core/hle/service/ndm.cpp index 671e9d4b..48755b6a 100644 --- a/src/core/hle/service/ndm.cpp +++ b/src/core/hle/service/ndm.cpp @@ -13,10 +13,10 @@ namespace NDM_U { const Interface::FunctionInfo FunctionTable[] = { - {0x00060040, NULL, "SuspendDaemons"}, - {0x00080040, NULL, "DisableWifiUsage"}, - {0x00090000, NULL, "EnableWifiUsage"}, - {0x00140040, NULL, "OverrideDefaultDaemons"}, + {0x00060040, nullptr, "SuspendDaemons"}, + {0x00080040, nullptr, "DisableWifiUsage"}, + {0x00090000, nullptr, "EnableWifiUsage"}, + {0x00140040, nullptr, "OverrideDefaultDaemons"}, }; //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 781b41fb..4a1ac857 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -19,7 +19,7 @@ namespace Service { -Manager* g_manager = NULL; ///< Service manager +Manager* g_manager = nullptr; ///< Service manager //////////////////////////////////////////////////////////////////////////////////////////////////// // Service Manager class @@ -56,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); } diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 4b5c5b3c..166d1303 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -93,7 +93,7 @@ public: cmd_buff[1] = 0; return 0; } - if (itr->second.func == NULL) { + if (itr->second.func == nullptr) { ERROR_LOG(OSHLE, "unimplemented function: port=%s, name=%s", GetPortName(), itr->second.name.c_str()); diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp index 07e2009a..f45c0efc 100644 --- a/src/core/hle/service/srv.cpp +++ b/src/core/hle/service/srv.cpp @@ -26,7 +26,7 @@ void GetProcSemaphore(Service::Interface* self) { // Get process semaphore? u32* cmd_buff = Service::GetCommandBuffer(); cmd_buff[1] = 0; // No error - cmd_buff[3] = g_mutex; // Return something... 0 == NULL, raises an exception + cmd_buff[3] = g_mutex; // Return something... 0 == nullptr, raises an exception } void GetServiceHandle(Service::Interface* self) { @@ -36,7 +36,7 @@ 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); - 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 { @@ -49,8 +49,8 @@ void GetServiceHandle(Service::Interface* self) { 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"}, }; diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index c389bbaa..01fc056a 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp @@ -81,7 +81,7 @@ Result ConnectToPort(void* _out, const char* port_name) { Service::Interface* service = Service::g_manager->FetchFromPortName(port_name); DEBUG_LOG(SVC, "called port_name=%s", port_name); - _assert_msg_(KERNEL, (service != NULL), "called, but service is not implemented!"); + _assert_msg_(KERNEL, (service != nullptr), "called, but service is not implemented!"); *out = service->GetHandle(); @@ -93,7 +93,7 @@ Result SendSyncRequest(Handle handle) { bool wait = false; Kernel::Object* object = Kernel::g_object_pool.GetFast(handle); - _assert_msg_(KERNEL, (object != NULL), "called, but kernel object is NULL!"); + _assert_msg_(KERNEL, (object != nullptr), "called, but kernel object is nullptr!"); DEBUG_LOG(SVC, "called handle=0x%08X(%s)", handle, object->GetTypeName()); Result res = object->SyncRequest(&wait); @@ -122,7 +122,7 @@ Result WaitSynchronization1(Handle handle, s64 nano_seconds) { DEBUG_LOG(SVC, "called handle=0x%08X(%s:%s), nanoseconds=%d", handle, object->GetTypeName(), object->GetName(), nano_seconds); - _assert_msg_(KERNEL, (object != NULL), "called, but kernel object is NULL!"); + _assert_msg_(KERNEL, (object != nullptr), "called, but kernel object is nullptr!"); Result res = object->WaitSynchronization(&wait); @@ -152,8 +152,8 @@ Result WaitSynchronizationN(void* _out, void* _handles, u32 handle_count, u32 wa bool wait = false; Kernel::Object* object = Kernel::g_object_pool.GetFast(handles[i]); - _assert_msg_(KERNEL, (object != NULL), "called handle=0x%08X, but kernel object " - "is NULL!", handles[i]); + _assert_msg_(KERNEL, (object != nullptr), "called handle=0x%08X, but kernel object " + "is nullptr!", handles[i]); DEBUG_LOG(SVC, "\thandle[%d] = 0x%08X(%s:%s)", i, handles[i], object->GetTypeName(), object->GetName()); @@ -278,7 +278,7 @@ Result CreateMutex(void* _mutex, u32 initial_locked) { /// Release a mutex Result ReleaseMutex(Handle handle) { DEBUG_LOG(SVC, "called handle=0x%08X", handle); - _assert_msg_(KERNEL, (handle != 0), "called, but handle is NULL!"); + _assert_msg_(KERNEL, (handle != 0), "called, but handle is nullptr!"); Kernel::ReleaseMutex(handle); return 0; } @@ -342,132 +342,132 @@ void SleepThread(s64 nanoseconds) { } const HLE::FunctionDef SVC_Table[] = { - {0x00, NULL, "Unknown"}, + {0x00, nullptr, "Unknown"}, {0x01, WrapI_VUUUUU, "ControlMemory"}, {0x02, WrapI_VVU, "QueryMemory"}, - {0x03, NULL, "ExitProcess"}, - {0x04, NULL, "GetProcessAffinityMask"}, - {0x05, NULL, "SetProcessAffinityMask"}, - {0x06, NULL, "GetProcessIdealProcessor"}, - {0x07, NULL, "SetProcessIdealProcessor"}, + {0x03, nullptr, "ExitProcess"}, + {0x04, nullptr, "GetProcessAffinityMask"}, + {0x05, nullptr, "SetProcessAffinityMask"}, + {0x06, nullptr, "GetProcessIdealProcessor"}, + {0x07, nullptr, "SetProcessIdealProcessor"}, {0x08, WrapI_UUUUU, "CreateThread"}, {0x09, WrapU_V, "ExitThread"}, {0x0A, WrapV_S64, "SleepThread"}, {0x0B, WrapI_VU, "GetThreadPriority"}, {0x0C, WrapI_UI, "SetThreadPriority"}, - {0x0D, NULL, "GetThreadAffinityMask"}, - {0x0E, NULL, "SetThreadAffinityMask"}, - {0x0F, NULL, "GetThreadIdealProcessor"}, - {0x10, NULL, "SetThreadIdealProcessor"}, - {0x11, NULL, "GetCurrentProcessorNumber"}, - {0x12, NULL, "Run"}, + {0x0D, nullptr, "GetThreadAffinityMask"}, + {0x0E, nullptr, "SetThreadAffinityMask"}, + {0x0F, nullptr, "GetThreadIdealProcessor"}, + {0x10, nullptr, "SetThreadIdealProcessor"}, + {0x11, nullptr, "GetCurrentProcessorNumber"}, + {0x12, nullptr, "Run"}, {0x13, WrapI_VU, "CreateMutex"}, {0x14, WrapI_U, "ReleaseMutex"}, - {0x15, NULL, "CreateSemaphore"}, - {0x16, NULL, "ReleaseSemaphore"}, + {0x15, nullptr, "CreateSemaphore"}, + {0x16, nullptr, "ReleaseSemaphore"}, {0x17, WrapI_VU, "CreateEvent"}, {0x18, WrapI_U, "SignalEvent"}, {0x19, WrapI_U, "ClearEvent"}, - {0x1A, NULL, "CreateTimer"}, - {0x1B, NULL, "SetTimer"}, - {0x1C, NULL, "CancelTimer"}, - {0x1D, NULL, "ClearTimer"}, - {0x1E, NULL, "CreateMemoryBlock"}, + {0x1A, nullptr, "CreateTimer"}, + {0x1B, nullptr, "SetTimer"}, + {0x1C, nullptr, "CancelTimer"}, + {0x1D, nullptr, "ClearTimer"}, + {0x1E, nullptr, "CreateMemoryBlock"}, {0x1F, WrapI_UUUU, "MapMemoryBlock"}, - {0x20, NULL, "UnmapMemoryBlock"}, + {0x20, nullptr, "UnmapMemoryBlock"}, {0x21, WrapI_V, "CreateAddressArbiter"}, {0x22, WrapI_UUUUS64, "ArbitrateAddress"}, {0x23, WrapI_U, "CloseHandle"}, {0x24, WrapI_US64, "WaitSynchronization1"}, {0x25, WrapI_VVUUS64, "WaitSynchronizationN"}, - {0x26, NULL, "SignalAndWait"}, + {0x26, nullptr, "SignalAndWait"}, {0x27, WrapI_VU, "DuplicateHandle"}, - {0x28, NULL, "GetSystemTick"}, - {0x29, NULL, "GetHandleInfo"}, - {0x2A, NULL, "GetSystemInfo"}, - {0x2B, NULL, "GetProcessInfo"}, - {0x2C, NULL, "GetThreadInfo"}, + {0x28, nullptr, "GetSystemTick"}, + {0x29, nullptr, "GetHandleInfo"}, + {0x2A, nullptr, "GetSystemInfo"}, + {0x2B, nullptr, "GetProcessInfo"}, + {0x2C, nullptr, "GetThreadInfo"}, {0x2D, WrapI_VC, "ConnectToPort"}, - {0x2E, NULL, "SendSyncRequest1"}, - {0x2F, NULL, "SendSyncRequest2"}, - {0x30, NULL, "SendSyncRequest3"}, - {0x31, NULL, "SendSyncRequest4"}, + {0x2E, nullptr, "SendSyncRequest1"}, + {0x2F, nullptr, "SendSyncRequest2"}, + {0x30, nullptr, "SendSyncRequest3"}, + {0x31, nullptr, "SendSyncRequest4"}, {0x32, WrapI_U, "SendSyncRequest"}, - {0x33, NULL, "OpenProcess"}, - {0x34, NULL, "OpenThread"}, - {0x35, NULL, "GetProcessId"}, - {0x36, NULL, "GetProcessIdOfThread"}, + {0x33, nullptr, "OpenProcess"}, + {0x34, nullptr, "OpenThread"}, + {0x35, nullptr, "GetProcessId"}, + {0x36, nullptr, "GetProcessIdOfThread"}, {0x37, WrapI_VU, "GetThreadId"}, {0x38, WrapI_VU, "GetResourceLimit"}, - {0x39, NULL, "GetResourceLimitLimitValues"}, + {0x39, nullptr, "GetResourceLimitLimitValues"}, {0x3A, WrapI_VUVI, "GetResourceLimitCurrentValues"}, - {0x3B, NULL, "GetThreadContext"}, - {0x3C, NULL, "Break"}, + {0x3B, nullptr, "GetThreadContext"}, + {0x3C, nullptr, "Break"}, {0x3D, WrapV_C, "OutputDebugString"}, - {0x3E, NULL, "ControlPerformanceCounter"}, - {0x3F, NULL, "Unknown"}, - {0x40, NULL, "Unknown"}, - {0x41, NULL, "Unknown"}, - {0x42, NULL, "Unknown"}, - {0x43, NULL, "Unknown"}, - {0x44, NULL, "Unknown"}, - {0x45, NULL, "Unknown"}, - {0x46, NULL, "Unknown"}, - {0x47, NULL, "CreatePort"}, - {0x48, NULL, "CreateSessionToPort"}, - {0x49, NULL, "CreateSession"}, - {0x4A, NULL, "AcceptSession"}, - {0x4B, NULL, "ReplyAndReceive1"}, - {0x4C, NULL, "ReplyAndReceive2"}, - {0x4D, NULL, "ReplyAndReceive3"}, - {0x4E, NULL, "ReplyAndReceive4"}, - {0x4F, NULL, "ReplyAndReceive"}, - {0x50, NULL, "BindInterrupt"}, - {0x51, NULL, "UnbindInterrupt"}, - {0x52, NULL, "InvalidateProcessDataCache"}, - {0x53, NULL, "StoreProcessDataCache"}, - {0x54, NULL, "FlushProcessDataCache"}, - {0x55, NULL, "StartInterProcessDma"}, - {0x56, NULL, "StopDma"}, - {0x57, NULL, "GetDmaState"}, - {0x58, NULL, "RestartDma"}, - {0x59, NULL, "Unknown"}, - {0x5A, NULL, "Unknown"}, - {0x5B, NULL, "Unknown"}, - {0x5C, NULL, "Unknown"}, - {0x5D, NULL, "Unknown"}, - {0x5E, NULL, "Unknown"}, - {0x5F, NULL, "Unknown"}, - {0x60, NULL, "DebugActiveProcess"}, - {0x61, NULL, "BreakDebugProcess"}, - {0x62, NULL, "TerminateDebugProcess"}, - {0x63, NULL, "GetProcessDebugEvent"}, - {0x64, NULL, "ContinueDebugEvent"}, - {0x65, NULL, "GetProcessList"}, - {0x66, NULL, "GetThreadList"}, - {0x67, NULL, "GetDebugThreadContext"}, - {0x68, NULL, "SetDebugThreadContext"}, - {0x69, NULL, "QueryDebugProcessMemory"}, - {0x6A, NULL, "ReadProcessMemory"}, - {0x6B, NULL, "WriteProcessMemory"}, - {0x6C, NULL, "SetHardwareBreakPoint"}, - {0x6D, NULL, "GetDebugThreadParam"}, - {0x6E, NULL, "Unknown"}, - {0x6F, NULL, "Unknown"}, - {0x70, NULL, "ControlProcessMemory"}, - {0x71, NULL, "MapProcessMemory"}, - {0x72, NULL, "UnmapProcessMemory"}, - {0x73, NULL, "Unknown"}, - {0x74, NULL, "Unknown"}, - {0x75, NULL, "Unknown"}, - {0x76, NULL, "TerminateProcess"}, - {0x77, NULL, "Unknown"}, - {0x78, NULL, "CreateResourceLimit"}, - {0x79, NULL, "Unknown"}, - {0x7A, NULL, "Unknown"}, - {0x7B, NULL, "Unknown"}, - {0x7C, NULL, "KernelSetState"}, - {0x7D, NULL, "QueryProcessMemory"}, + {0x3E, nullptr, "ControlPerformanceCounter"}, + {0x3F, nullptr, "Unknown"}, + {0x40, nullptr, "Unknown"}, + {0x41, nullptr, "Unknown"}, + {0x42, nullptr, "Unknown"}, + {0x43, nullptr, "Unknown"}, + {0x44, nullptr, "Unknown"}, + {0x45, nullptr, "Unknown"}, + {0x46, nullptr, "Unknown"}, + {0x47, nullptr, "CreatePort"}, + {0x48, nullptr, "CreateSessionToPort"}, + {0x49, nullptr, "CreateSession"}, + {0x4A, nullptr, "AcceptSession"}, + {0x4B, nullptr, "ReplyAndReceive1"}, + {0x4C, nullptr, "ReplyAndReceive2"}, + {0x4D, nullptr, "ReplyAndReceive3"}, + {0x4E, nullptr, "ReplyAndReceive4"}, + {0x4F, nullptr, "ReplyAndReceive"}, + {0x50, nullptr, "BindInterrupt"}, + {0x51, nullptr, "UnbindInterrupt"}, + {0x52, nullptr, "InvalidateProcessDataCache"}, + {0x53, nullptr, "StoreProcessDataCache"}, + {0x54, nullptr, "FlushProcessDataCache"}, + {0x55, nullptr, "StartInterProcessDma"}, + {0x56, nullptr, "StopDma"}, + {0x57, nullptr, "GetDmaState"}, + {0x58, nullptr, "RestartDma"}, + {0x59, nullptr, "Unknown"}, + {0x5A, nullptr, "Unknown"}, + {0x5B, nullptr, "Unknown"}, + {0x5C, nullptr, "Unknown"}, + {0x5D, nullptr, "Unknown"}, + {0x5E, nullptr, "Unknown"}, + {0x5F, nullptr, "Unknown"}, + {0x60, nullptr, "DebugActiveProcess"}, + {0x61, nullptr, "BreakDebugProcess"}, + {0x62, nullptr, "TerminateDebugProcess"}, + {0x63, nullptr, "GetProcessDebugEvent"}, + {0x64, nullptr, "ContinueDebugEvent"}, + {0x65, nullptr, "GetProcessList"}, + {0x66, nullptr, "GetThreadList"}, + {0x67, nullptr, "GetDebugThreadContext"}, + {0x68, nullptr, "SetDebugThreadContext"}, + {0x69, nullptr, "QueryDebugProcessMemory"}, + {0x6A, nullptr, "ReadProcessMemory"}, + {0x6B, nullptr, "WriteProcessMemory"}, + {0x6C, nullptr, "SetHardwareBreakPoint"}, + {0x6D, nullptr, "GetDebugThreadParam"}, + {0x6E, nullptr, "Unknown"}, + {0x6F, nullptr, "Unknown"}, + {0x70, nullptr, "ControlProcessMemory"}, + {0x71, nullptr, "MapProcessMemory"}, + {0x72, nullptr, "UnmapProcessMemory"}, + {0x73, nullptr, "Unknown"}, + {0x74, nullptr, "Unknown"}, + {0x75, nullptr, "Unknown"}, + {0x76, nullptr, "TerminateProcess"}, + {0x77, nullptr, "Unknown"}, + {0x78, nullptr, "CreateResourceLimit"}, + {0x79, nullptr, "Unknown"}, + {0x7A, nullptr, "Unknown"}, + {0x7B, nullptr, "Unknown"}, + {0x7C, nullptr, "KernelSetState"}, + {0x7D, nullptr, "QueryProcessMemory"}, }; void Register() { -- cgit v1.2.3