1
0
Fork 0
forked from suyu/suyu

HLE: Updated all uses of NULL to nullptr (to be C++11 compliant)

This commit is contained in:
bunnei 2014-06-06 00:35:49 -04:00
parent 5365ca157d
commit c95972275e
13 changed files with 239 additions and 239 deletions

View file

@ -18,10 +18,10 @@
namespace Core { namespace Core {
u64 g_last_ticks = 0; ///< Last CPU ticks u64 g_last_ticks = 0; ///< Last CPU ticks
ARM_Disasm* g_disasm = NULL; ///< ARM disassembler ARM_Disasm* g_disasm = nullptr; ///< ARM disassembler
ARM_Interface* g_app_core = NULL; ///< ARM11 application core ARM_Interface* g_app_core = nullptr; ///< ARM11 application core
ARM_Interface* g_sys_core = NULL; ///< ARM11 system (OS) core ARM_Interface* g_sys_core = nullptr; ///< ARM11 system (OS) core
/// Run the core CPU loop /// Run the core CPU loop
void RunLoop() { void RunLoop() {

View file

@ -22,7 +22,7 @@ const FunctionDef* GetSVCInfo(u32 opcode) {
u32 func_num = opcode & 0xFFFFFF; // 8 bits u32 func_num = opcode & 0xFFFFFF; // 8 bits
if (func_num > 0xFF) { 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 nullptr;
} }
return &g_module_db[0].func_table[func_num]; return &g_module_db[0].func_table[func_num];
} }

View file

@ -128,7 +128,7 @@ Object* ObjectPool::CreateByIDType(int type) {
default: default:
ERROR_LOG(COMMON, "Unable to load state: could not find object type %d.", type); ERROR_LOG(COMMON, "Unable to load state: could not find object type %d.", type);
return NULL; return nullptr;
} }
} }

View file

@ -122,7 +122,7 @@ bool ReleaseMutex(Mutex* mutex) {
Result ReleaseMutex(Handle handle) { Result ReleaseMutex(Handle handle) {
Mutex* mutex = Kernel::g_object_pool.GetFast<Mutex>(handle); Mutex* mutex = Kernel::g_object_pool.GetFast<Mutex>(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)) { if (!ReleaseMutex(mutex)) {
return -1; return -1;

View file

@ -223,7 +223,7 @@ void SwitchContext(Thread* t) {
t->wait_type = WAITTYPE_NONE; t->wait_type = WAITTYPE_NONE;
LoadContext(t->context); LoadContext(t->context);
} else { } else {
SetCurrentThread(NULL); SetCurrentThread(nullptr);
} }
} }
@ -238,7 +238,7 @@ Thread* NextThread() {
next = g_thread_ready_queue.pop_first(); next = g_thread_ready_queue.pop_first();
} }
if (next == 0) { if (next == 0) {
return NULL; return nullptr;
} }
return Kernel::g_object_pool.GetFast<Thread>(next); return Kernel::g_object_pool.GetFast<Thread>(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, Handle CreateThread(const char* name, u32 entry_point, s32 priority, u32 arg, s32 processor_id,
u32 stack_top, int stack_size) { u32 stack_top, int stack_size) {
if (name == NULL) { if (name == nullptr) {
ERROR_LOG(KERNEL, "CreateThread(): NULL name"); ERROR_LOG(KERNEL, "CreateThread(): nullptr name");
return -1; return -1;
} }
if ((u32)stack_size < 0x200) { 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 /// Get the priority of the thread specified by handle
u32 GetThreadPriority(const Handle handle) { u32 GetThreadPriority(const Handle handle) {
Thread* thread = g_object_pool.GetFast<Thread>(handle); Thread* thread = g_object_pool.GetFast<Thread>(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; return thread->current_priority;
} }
/// Set the priority of the thread specified by handle /// Set the priority of the thread specified by handle
Result SetThreadPriority(Handle handle, s32 priority) { Result SetThreadPriority(Handle handle, s32 priority) {
Thread* thread = NULL; Thread* thread = nullptr;
if (!handle) { if (!handle) {
thread = GetCurrentThread(); // TODO(bunnei): Is this correct behavior? thread = GetCurrentThread(); // TODO(bunnei): Is this correct behavior?
} else { } else {
thread = g_object_pool.GetFast<Thread>(handle); thread = g_object_pool.GetFast<Thread>(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 is invalid, clamp to valid range
if (priority < THREADPRIO_HIGHEST || priority > THREADPRIO_LOWEST) { if (priority < THREADPRIO_HIGHEST || priority > THREADPRIO_LOWEST) {

View file

@ -55,81 +55,81 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x00010040, GetLockHandle, "GetLockHandle"}, {0x00010040, GetLockHandle, "GetLockHandle"},
{0x00020080, Initialize, "Initialize"}, {0x00020080, Initialize, "Initialize"},
{0x00030040, Enable, "Enable"}, {0x00030040, Enable, "Enable"},
{0x00040040, NULL, "Finalize"}, {0x00040040, nullptr, "Finalize"},
{0x00050040, NULL, "GetAppletManInfo"}, {0x00050040, nullptr, "GetAppletManInfo"},
{0x00060040, NULL, "GetAppletInfo"}, {0x00060040, nullptr, "GetAppletInfo"},
{0x00070000, NULL, "GetLastSignaledAppletId"}, {0x00070000, nullptr, "GetLastSignaledAppletId"},
{0x00080000, NULL, "CountRegisteredApplet"}, {0x00080000, nullptr, "CountRegisteredApplet"},
{0x00090040, NULL, "IsRegistered"}, {0x00090040, nullptr, "IsRegistered"},
{0x000A0040, NULL, "GetAttribute"}, {0x000A0040, nullptr, "GetAttribute"},
{0x000B0040, InquireNotification, "InquireNotification"}, {0x000B0040, InquireNotification, "InquireNotification"},
{0x000C0104, NULL, "SendParameter"}, {0x000C0104, nullptr, "SendParameter"},
{0x000D0080, NULL, "ReceiveParameter"}, {0x000D0080, nullptr, "ReceiveParameter"},
{0x000E0080, NULL, "GlanceParameter"}, {0x000E0080, nullptr, "GlanceParameter"},
{0x000F0100, NULL, "CancelParameter"}, {0x000F0100, nullptr, "CancelParameter"},
{0x001000C2, NULL, "DebugFunc"}, {0x001000C2, nullptr, "DebugFunc"},
{0x001100C0, NULL, "MapProgramIdForDebug"}, {0x001100C0, nullptr, "MapProgramIdForDebug"},
{0x00120040, NULL, "SetHomeMenuAppletIdForDebug"}, {0x00120040, nullptr, "SetHomeMenuAppletIdForDebug"},
{0x00130000, NULL, "GetPreparationState"}, {0x00130000, nullptr, "GetPreparationState"},
{0x00140040, NULL, "SetPreparationState"}, {0x00140040, nullptr, "SetPreparationState"},
{0x00150140, NULL, "PrepareToStartApplication"}, {0x00150140, nullptr, "PrepareToStartApplication"},
{0x00160040, NULL, "PreloadLibraryApplet"}, {0x00160040, nullptr, "PreloadLibraryApplet"},
{0x00170040, NULL, "FinishPreloadingLibraryApplet"}, {0x00170040, nullptr, "FinishPreloadingLibraryApplet"},
{0x00180040, NULL, "PrepareToStartLibraryApplet"}, {0x00180040, nullptr, "PrepareToStartLibraryApplet"},
{0x00190040, NULL, "PrepareToStartSystemApplet"}, {0x00190040, nullptr, "PrepareToStartSystemApplet"},
{0x001A0000, NULL, "PrepareToStartNewestHomeMenu"}, {0x001A0000, nullptr, "PrepareToStartNewestHomeMenu"},
{0x001B00C4, NULL, "StartApplication"}, {0x001B00C4, nullptr, "StartApplication"},
{0x001C0000, NULL, "WakeupApplication"}, {0x001C0000, nullptr, "WakeupApplication"},
{0x001D0000, NULL, "CancelApplication"}, {0x001D0000, nullptr, "CancelApplication"},
{0x001E0084, NULL, "StartLibraryApplet"}, {0x001E0084, nullptr, "StartLibraryApplet"},
{0x001F0084, NULL, "StartSystemApplet"}, {0x001F0084, nullptr, "StartSystemApplet"},
{0x00200044, NULL, "StartNewestHomeMenu"}, {0x00200044, nullptr, "StartNewestHomeMenu"},
{0x00210000, NULL, "OrderToCloseApplication"}, {0x00210000, nullptr, "OrderToCloseApplication"},
{0x00220040, NULL, "PrepareToCloseApplication"}, {0x00220040, nullptr, "PrepareToCloseApplication"},
{0x00230040, NULL, "PrepareToJumpToApplication"}, {0x00230040, nullptr, "PrepareToJumpToApplication"},
{0x00240044, NULL, "JumpToApplication"}, {0x00240044, nullptr, "JumpToApplication"},
{0x002500C0, NULL, "PrepareToCloseLibraryApplet"}, {0x002500C0, nullptr, "PrepareToCloseLibraryApplet"},
{0x00260000, NULL, "PrepareToCloseSystemApplet"}, {0x00260000, nullptr, "PrepareToCloseSystemApplet"},
{0x00270044, NULL, "CloseApplication"}, {0x00270044, nullptr, "CloseApplication"},
{0x00280044, NULL, "CloseLibraryApplet"}, {0x00280044, nullptr, "CloseLibraryApplet"},
{0x00290044, NULL, "CloseSystemApplet"}, {0x00290044, nullptr, "CloseSystemApplet"},
{0x002A0000, NULL, "OrderToCloseSystemApplet"}, {0x002A0000, nullptr, "OrderToCloseSystemApplet"},
{0x002B0000, NULL, "PrepareToJumpToHomeMenu"}, {0x002B0000, nullptr, "PrepareToJumpToHomeMenu"},
{0x002C0044, NULL, "JumpToHomeMenu"}, {0x002C0044, nullptr, "JumpToHomeMenu"},
{0x002D0000, NULL, "PrepareToLeaveHomeMenu"}, {0x002D0000, nullptr, "PrepareToLeaveHomeMenu"},
{0x002E0044, NULL, "LeaveHomeMenu"}, {0x002E0044, nullptr, "LeaveHomeMenu"},
{0x002F0040, NULL, "PrepareToLeaveResidentApplet"}, {0x002F0040, nullptr, "PrepareToLeaveResidentApplet"},
{0x00300044, NULL, "LeaveResidentApplet"}, {0x00300044, nullptr, "LeaveResidentApplet"},
{0x00310100, NULL, "PrepareToDoApplicationJump"}, {0x00310100, nullptr, "PrepareToDoApplicationJump"},
{0x00320084, NULL, "DoApplicationJump"}, {0x00320084, nullptr, "DoApplicationJump"},
{0x00330000, NULL, "GetProgramIdOnApplicationJump"}, {0x00330000, nullptr, "GetProgramIdOnApplicationJump"},
{0x00340084, NULL, "SendDeliverArg"}, {0x00340084, nullptr, "SendDeliverArg"},
{0x00350080, NULL, "ReceiveDeliverArg"}, {0x00350080, nullptr, "ReceiveDeliverArg"},
{0x00360040, NULL, "LoadSysMenuArg"}, {0x00360040, nullptr, "LoadSysMenuArg"},
{0x00370042, NULL, "StoreSysMenuArg"}, {0x00370042, nullptr, "StoreSysMenuArg"},
{0x00380040, NULL, "PreloadResidentApplet"}, {0x00380040, nullptr, "PreloadResidentApplet"},
{0x00390040, NULL, "PrepareToStartResidentApplet"}, {0x00390040, nullptr, "PrepareToStartResidentApplet"},
{0x003A0044, NULL, "StartResidentApplet"}, {0x003A0044, nullptr, "StartResidentApplet"},
{0x003B0040, NULL, "CancelLibraryApplet"}, {0x003B0040, nullptr, "CancelLibraryApplet"},
{0x003C0042, NULL, "SendDspSleep"}, {0x003C0042, nullptr, "SendDspSleep"},
{0x003D0042, NULL, "SendDspWakeUp"}, {0x003D0042, nullptr, "SendDspWakeUp"},
{0x003E0080, NULL, "ReplySleepQuery"}, {0x003E0080, nullptr, "ReplySleepQuery"},
{0x003F0040, NULL, "ReplySleepNotificationComplete"}, {0x003F0040, nullptr, "ReplySleepNotificationComplete"},
{0x00400042, NULL, "SendCaptureBufferInfo"}, {0x00400042, nullptr, "SendCaptureBufferInfo"},
{0x00410040, NULL, "ReceiveCaptureBufferInfo"}, {0x00410040, nullptr, "ReceiveCaptureBufferInfo"},
{0x00420080, NULL, "SleepSystem"}, {0x00420080, nullptr, "SleepSystem"},
{0x00430040, NULL, "NotifyToWait"}, {0x00430040, nullptr, "NotifyToWait"},
{0x00440000, NULL, "GetSharedFont"}, {0x00440000, nullptr, "GetSharedFont"},
{0x00450040, NULL, "GetWirelessRebootInfo"}, {0x00450040, nullptr, "GetWirelessRebootInfo"},
{0x00460104, NULL, "Wrap"}, {0x00460104, nullptr, "Wrap"},
{0x00470104, NULL, "Unwrap"}, {0x00470104, nullptr, "Unwrap"},
{0x00480100, NULL, "GetProgramInfo"}, {0x00480100, nullptr, "GetProgramInfo"},
{0x00490180, NULL, "Reboot"}, {0x00490180, nullptr, "Reboot"},
{0x004A0040, NULL, "GetCaptureInfo"}, {0x004A0040, nullptr, "GetCaptureInfo"},
{0x004B00C2, NULL, "AppletUtility"}, {0x004B00C2, nullptr, "AppletUtility"},
{0x004C0000, NULL, "SetFatalErrDispMode"}, {0x004C0000, nullptr, "SetFatalErrDispMode"},
{0x004D0080, NULL, "GetAppletProgramInfo"}, {0x004D0080, nullptr, "GetAppletProgramInfo"},
{0x004E0000, NULL, "HardwareResetAsync"}, {0x004E0000, nullptr, "HardwareResetAsync"},
}; };
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////

View file

@ -104,7 +104,7 @@ void RegisterInterruptRelayQueue(Service::Interface* self) {
u32 flags = cmd_buff[1]; u32 flags = cmd_buff[1];
u32 event_handle = cmd_buff[3]; 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; g_event_handle = event_handle;
@ -139,36 +139,36 @@ void TriggerCmdReqQueue(Service::Interface* self) {
} }
const Interface::FunctionInfo FunctionTable[] = { const Interface::FunctionInfo FunctionTable[] = {
{0x00010082, NULL, "WriteHWRegs"}, {0x00010082, nullptr, "WriteHWRegs"},
{0x00020084, NULL, "WriteHWRegsWithMask"}, {0x00020084, nullptr, "WriteHWRegsWithMask"},
{0x00030082, NULL, "WriteHWRegRepeat"}, {0x00030082, nullptr, "WriteHWRegRepeat"},
{0x00040080, ReadHWRegs, "ReadHWRegs"}, {0x00040080, ReadHWRegs, "ReadHWRegs"},
{0x00050200, NULL, "SetBufferSwap"}, {0x00050200, nullptr, "SetBufferSwap"},
{0x00060082, NULL, "SetCommandList"}, {0x00060082, nullptr, "SetCommandList"},
{0x000700C2, NULL, "RequestDma"}, {0x000700C2, nullptr, "RequestDma"},
{0x00080082, NULL, "FlushDataCache"}, {0x00080082, nullptr, "FlushDataCache"},
{0x00090082, NULL, "InvalidateDataCache"}, {0x00090082, nullptr, "InvalidateDataCache"},
{0x000A0044, NULL, "RegisterInterruptEvents"}, {0x000A0044, nullptr, "RegisterInterruptEvents"},
{0x000B0040, NULL, "SetLcdForceBlack"}, {0x000B0040, nullptr, "SetLcdForceBlack"},
{0x000C0000, TriggerCmdReqQueue, "TriggerCmdReqQueue"}, {0x000C0000, TriggerCmdReqQueue, "TriggerCmdReqQueue"},
{0x000D0140, NULL, "SetDisplayTransfer"}, {0x000D0140, nullptr, "SetDisplayTransfer"},
{0x000E0180, NULL, "SetTextureCopy"}, {0x000E0180, nullptr, "SetTextureCopy"},
{0x000F0200, NULL, "SetMemoryFill"}, {0x000F0200, nullptr, "SetMemoryFill"},
{0x00100040, NULL, "SetAxiConfigQoSMode"}, {0x00100040, nullptr, "SetAxiConfigQoSMode"},
{0x00110040, NULL, "SetPerfLogMode"}, {0x00110040, nullptr, "SetPerfLogMode"},
{0x00120000, NULL, "GetPerfLog"}, {0x00120000, nullptr, "GetPerfLog"},
{0x00130042, RegisterInterruptRelayQueue, "RegisterInterruptRelayQueue"}, {0x00130042, RegisterInterruptRelayQueue, "RegisterInterruptRelayQueue"},
{0x00140000, NULL, "UnregisterInterruptRelayQueue"}, {0x00140000, nullptr, "UnregisterInterruptRelayQueue"},
{0x00150002, NULL, "TryAcquireRight"}, {0x00150002, nullptr, "TryAcquireRight"},
{0x00160042, NULL, "AcquireRight"}, {0x00160042, nullptr, "AcquireRight"},
{0x00170000, NULL, "ReleaseRight"}, {0x00170000, nullptr, "ReleaseRight"},
{0x00180000, NULL, "ImportDisplayCaptureInfo"}, {0x00180000, nullptr, "ImportDisplayCaptureInfo"},
{0x00190000, NULL, "SaveVramSysArea"}, {0x00190000, nullptr, "SaveVramSysArea"},
{0x001A0000, NULL, "RestoreVramSysArea"}, {0x001A0000, nullptr, "RestoreVramSysArea"},
{0x001B0000, NULL, "ResetGpuCore"}, {0x001B0000, nullptr, "ResetGpuCore"},
{0x001C0040, NULL, "SetLedForceOff"}, {0x001C0040, nullptr, "SetLedForceOff"},
{0x001D0040, NULL, "SetTestCommand"}, {0x001D0040, nullptr, "SetTestCommand"},
{0x001E0080, NULL, "SetInternalPriorities"}, {0x001E0080, nullptr, "SetInternalPriorities"},
}; };
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////

View file

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

View file

@ -13,10 +13,10 @@
namespace NDM_U { namespace NDM_U {
const Interface::FunctionInfo FunctionTable[] = { const Interface::FunctionInfo FunctionTable[] = {
{0x00060040, NULL, "SuspendDaemons"}, {0x00060040, nullptr, "SuspendDaemons"},
{0x00080040, NULL, "DisableWifiUsage"}, {0x00080040, nullptr, "DisableWifiUsage"},
{0x00090000, NULL, "EnableWifiUsage"}, {0x00090000, nullptr, "EnableWifiUsage"},
{0x00140040, NULL, "OverrideDefaultDaemons"}, {0x00140040, nullptr, "OverrideDefaultDaemons"},
}; };
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////

View file

@ -19,7 +19,7 @@
namespace Service { namespace Service {
Manager* g_manager = NULL; ///< Service manager Manager* g_manager = nullptr; ///< Service manager
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
// Service Manager class // Service Manager class
@ -56,7 +56,7 @@ Interface* Manager::FetchFromHandle(Handle handle) {
Interface* Manager::FetchFromPortName(std::string port_name) { Interface* Manager::FetchFromPortName(std::string port_name) {
auto itr = m_port_map.find(port_name); auto itr = m_port_map.find(port_name);
if (itr == m_port_map.end()) { if (itr == m_port_map.end()) {
return NULL; return nullptr;
} }
return FetchFromHandle(itr->second); return FetchFromHandle(itr->second);
} }

View file

@ -93,7 +93,7 @@ public:
cmd_buff[1] = 0; cmd_buff[1] = 0;
return 0; return 0;
} }
if (itr->second.func == NULL) { if (itr->second.func == nullptr) {
ERROR_LOG(OSHLE, "unimplemented function: port=%s, name=%s", ERROR_LOG(OSHLE, "unimplemented function: port=%s, name=%s",
GetPortName(), itr->second.name.c_str()); GetPortName(), itr->second.name.c_str());

View file

@ -26,7 +26,7 @@ void GetProcSemaphore(Service::Interface* self) {
// Get process semaphore? // Get process semaphore?
u32* cmd_buff = Service::GetCommandBuffer(); u32* cmd_buff = Service::GetCommandBuffer();
cmd_buff[1] = 0; // No error 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) { 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); std::string port_name = std::string((const char*)&cmd_buff[1], 0, Service::kMaxPortSize);
Service::Interface* service = Service::g_manager->FetchFromPortName(port_name); Service::Interface* service = Service::g_manager->FetchFromPortName(port_name);
if (NULL != service) { if (nullptr != service) {
cmd_buff[3] = service->GetHandle(); cmd_buff[3] = service->GetHandle();
DEBUG_LOG(OSHLE, "called port=%s, handle=0x%08X", port_name.c_str(), cmd_buff[3]); DEBUG_LOG(OSHLE, "called port=%s, handle=0x%08X", port_name.c_str(), cmd_buff[3]);
} else { } else {
@ -49,8 +49,8 @@ void GetServiceHandle(Service::Interface* self) {
const Interface::FunctionInfo FunctionTable[] = { const Interface::FunctionInfo FunctionTable[] = {
{0x00010002, Initialize, "Initialize"}, {0x00010002, Initialize, "Initialize"},
{0x00020000, GetProcSemaphore, "GetProcSemaphore"}, {0x00020000, GetProcSemaphore, "GetProcSemaphore"},
{0x00030100, NULL, "RegisterService"}, {0x00030100, nullptr, "RegisterService"},
{0x000400C0, NULL, "UnregisterService"}, {0x000400C0, nullptr, "UnregisterService"},
{0x00050100, GetServiceHandle, "GetServiceHandle"}, {0x00050100, GetServiceHandle, "GetServiceHandle"},
}; };

View file

@ -81,7 +81,7 @@ Result ConnectToPort(void* _out, const char* port_name) {
Service::Interface* service = Service::g_manager->FetchFromPortName(port_name); Service::Interface* service = Service::g_manager->FetchFromPortName(port_name);
DEBUG_LOG(SVC, "called port_name=%s", 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(); *out = service->GetHandle();
@ -93,7 +93,7 @@ Result SendSyncRequest(Handle handle) {
bool wait = false; bool wait = false;
Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handle); Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(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()); DEBUG_LOG(SVC, "called handle=0x%08X(%s)", handle, object->GetTypeName());
Result res = object->SyncRequest(&wait); 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(), DEBUG_LOG(SVC, "called handle=0x%08X(%s:%s), nanoseconds=%d", handle, object->GetTypeName(),
object->GetName(), nano_seconds); 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); Result res = object->WaitSynchronization(&wait);
@ -152,8 +152,8 @@ Result WaitSynchronizationN(void* _out, void* _handles, u32 handle_count, u32 wa
bool wait = false; bool wait = false;
Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handles[i]); Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handles[i]);
_assert_msg_(KERNEL, (object != NULL), "called handle=0x%08X, but kernel object " _assert_msg_(KERNEL, (object != nullptr), "called handle=0x%08X, but kernel object "
"is NULL!", handles[i]); "is nullptr!", handles[i]);
DEBUG_LOG(SVC, "\thandle[%d] = 0x%08X(%s:%s)", i, handles[i], object->GetTypeName(), DEBUG_LOG(SVC, "\thandle[%d] = 0x%08X(%s:%s)", i, handles[i], object->GetTypeName(),
object->GetName()); object->GetName());
@ -278,7 +278,7 @@ Result CreateMutex(void* _mutex, u32 initial_locked) {
/// Release a mutex /// Release a mutex
Result ReleaseMutex(Handle handle) { Result ReleaseMutex(Handle handle) {
DEBUG_LOG(SVC, "called handle=0x%08X", 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); Kernel::ReleaseMutex(handle);
return 0; return 0;
} }
@ -342,132 +342,132 @@ void SleepThread(s64 nanoseconds) {
} }
const HLE::FunctionDef SVC_Table[] = { const HLE::FunctionDef SVC_Table[] = {
{0x00, NULL, "Unknown"}, {0x00, nullptr, "Unknown"},
{0x01, WrapI_VUUUUU<ControlMemory>, "ControlMemory"}, {0x01, WrapI_VUUUUU<ControlMemory>, "ControlMemory"},
{0x02, WrapI_VVU<QueryMemory>, "QueryMemory"}, {0x02, WrapI_VVU<QueryMemory>, "QueryMemory"},
{0x03, NULL, "ExitProcess"}, {0x03, nullptr, "ExitProcess"},
{0x04, NULL, "GetProcessAffinityMask"}, {0x04, nullptr, "GetProcessAffinityMask"},
{0x05, NULL, "SetProcessAffinityMask"}, {0x05, nullptr, "SetProcessAffinityMask"},
{0x06, NULL, "GetProcessIdealProcessor"}, {0x06, nullptr, "GetProcessIdealProcessor"},
{0x07, NULL, "SetProcessIdealProcessor"}, {0x07, nullptr, "SetProcessIdealProcessor"},
{0x08, WrapI_UUUUU<CreateThread>, "CreateThread"}, {0x08, WrapI_UUUUU<CreateThread>, "CreateThread"},
{0x09, WrapU_V<ExitThread>, "ExitThread"}, {0x09, WrapU_V<ExitThread>, "ExitThread"},
{0x0A, WrapV_S64<SleepThread>, "SleepThread"}, {0x0A, WrapV_S64<SleepThread>, "SleepThread"},
{0x0B, WrapI_VU<GetThreadPriority>, "GetThreadPriority"}, {0x0B, WrapI_VU<GetThreadPriority>, "GetThreadPriority"},
{0x0C, WrapI_UI<SetThreadPriority>, "SetThreadPriority"}, {0x0C, WrapI_UI<SetThreadPriority>, "SetThreadPriority"},
{0x0D, NULL, "GetThreadAffinityMask"}, {0x0D, nullptr, "GetThreadAffinityMask"},
{0x0E, NULL, "SetThreadAffinityMask"}, {0x0E, nullptr, "SetThreadAffinityMask"},
{0x0F, NULL, "GetThreadIdealProcessor"}, {0x0F, nullptr, "GetThreadIdealProcessor"},
{0x10, NULL, "SetThreadIdealProcessor"}, {0x10, nullptr, "SetThreadIdealProcessor"},
{0x11, NULL, "GetCurrentProcessorNumber"}, {0x11, nullptr, "GetCurrentProcessorNumber"},
{0x12, NULL, "Run"}, {0x12, nullptr, "Run"},
{0x13, WrapI_VU<CreateMutex>, "CreateMutex"}, {0x13, WrapI_VU<CreateMutex>, "CreateMutex"},
{0x14, WrapI_U<ReleaseMutex>, "ReleaseMutex"}, {0x14, WrapI_U<ReleaseMutex>, "ReleaseMutex"},
{0x15, NULL, "CreateSemaphore"}, {0x15, nullptr, "CreateSemaphore"},
{0x16, NULL, "ReleaseSemaphore"}, {0x16, nullptr, "ReleaseSemaphore"},
{0x17, WrapI_VU<CreateEvent>, "CreateEvent"}, {0x17, WrapI_VU<CreateEvent>, "CreateEvent"},
{0x18, WrapI_U<SignalEvent>, "SignalEvent"}, {0x18, WrapI_U<SignalEvent>, "SignalEvent"},
{0x19, WrapI_U<ClearEvent>, "ClearEvent"}, {0x19, WrapI_U<ClearEvent>, "ClearEvent"},
{0x1A, NULL, "CreateTimer"}, {0x1A, nullptr, "CreateTimer"},
{0x1B, NULL, "SetTimer"}, {0x1B, nullptr, "SetTimer"},
{0x1C, NULL, "CancelTimer"}, {0x1C, nullptr, "CancelTimer"},
{0x1D, NULL, "ClearTimer"}, {0x1D, nullptr, "ClearTimer"},
{0x1E, NULL, "CreateMemoryBlock"}, {0x1E, nullptr, "CreateMemoryBlock"},
{0x1F, WrapI_UUUU<MapMemoryBlock>, "MapMemoryBlock"}, {0x1F, WrapI_UUUU<MapMemoryBlock>, "MapMemoryBlock"},
{0x20, NULL, "UnmapMemoryBlock"}, {0x20, nullptr, "UnmapMemoryBlock"},
{0x21, WrapI_V<CreateAddressArbiter>, "CreateAddressArbiter"}, {0x21, WrapI_V<CreateAddressArbiter>, "CreateAddressArbiter"},
{0x22, WrapI_UUUUS64<ArbitrateAddress>, "ArbitrateAddress"}, {0x22, WrapI_UUUUS64<ArbitrateAddress>, "ArbitrateAddress"},
{0x23, WrapI_U<CloseHandle>, "CloseHandle"}, {0x23, WrapI_U<CloseHandle>, "CloseHandle"},
{0x24, WrapI_US64<WaitSynchronization1>, "WaitSynchronization1"}, {0x24, WrapI_US64<WaitSynchronization1>, "WaitSynchronization1"},
{0x25, WrapI_VVUUS64<WaitSynchronizationN>, "WaitSynchronizationN"}, {0x25, WrapI_VVUUS64<WaitSynchronizationN>, "WaitSynchronizationN"},
{0x26, NULL, "SignalAndWait"}, {0x26, nullptr, "SignalAndWait"},
{0x27, WrapI_VU<DuplicateHandle>, "DuplicateHandle"}, {0x27, WrapI_VU<DuplicateHandle>, "DuplicateHandle"},
{0x28, NULL, "GetSystemTick"}, {0x28, nullptr, "GetSystemTick"},
{0x29, NULL, "GetHandleInfo"}, {0x29, nullptr, "GetHandleInfo"},
{0x2A, NULL, "GetSystemInfo"}, {0x2A, nullptr, "GetSystemInfo"},
{0x2B, NULL, "GetProcessInfo"}, {0x2B, nullptr, "GetProcessInfo"},
{0x2C, NULL, "GetThreadInfo"}, {0x2C, nullptr, "GetThreadInfo"},
{0x2D, WrapI_VC<ConnectToPort>, "ConnectToPort"}, {0x2D, WrapI_VC<ConnectToPort>, "ConnectToPort"},
{0x2E, NULL, "SendSyncRequest1"}, {0x2E, nullptr, "SendSyncRequest1"},
{0x2F, NULL, "SendSyncRequest2"}, {0x2F, nullptr, "SendSyncRequest2"},
{0x30, NULL, "SendSyncRequest3"}, {0x30, nullptr, "SendSyncRequest3"},
{0x31, NULL, "SendSyncRequest4"}, {0x31, nullptr, "SendSyncRequest4"},
{0x32, WrapI_U<SendSyncRequest>, "SendSyncRequest"}, {0x32, WrapI_U<SendSyncRequest>, "SendSyncRequest"},
{0x33, NULL, "OpenProcess"}, {0x33, nullptr, "OpenProcess"},
{0x34, NULL, "OpenThread"}, {0x34, nullptr, "OpenThread"},
{0x35, NULL, "GetProcessId"}, {0x35, nullptr, "GetProcessId"},
{0x36, NULL, "GetProcessIdOfThread"}, {0x36, nullptr, "GetProcessIdOfThread"},
{0x37, WrapI_VU<GetThreadId>, "GetThreadId"}, {0x37, WrapI_VU<GetThreadId>, "GetThreadId"},
{0x38, WrapI_VU<GetResourceLimit>, "GetResourceLimit"}, {0x38, WrapI_VU<GetResourceLimit>, "GetResourceLimit"},
{0x39, NULL, "GetResourceLimitLimitValues"}, {0x39, nullptr, "GetResourceLimitLimitValues"},
{0x3A, WrapI_VUVI<GetResourceLimitCurrentValues>, "GetResourceLimitCurrentValues"}, {0x3A, WrapI_VUVI<GetResourceLimitCurrentValues>, "GetResourceLimitCurrentValues"},
{0x3B, NULL, "GetThreadContext"}, {0x3B, nullptr, "GetThreadContext"},
{0x3C, NULL, "Break"}, {0x3C, nullptr, "Break"},
{0x3D, WrapV_C<OutputDebugString>, "OutputDebugString"}, {0x3D, WrapV_C<OutputDebugString>, "OutputDebugString"},
{0x3E, NULL, "ControlPerformanceCounter"}, {0x3E, nullptr, "ControlPerformanceCounter"},
{0x3F, NULL, "Unknown"}, {0x3F, nullptr, "Unknown"},
{0x40, NULL, "Unknown"}, {0x40, nullptr, "Unknown"},
{0x41, NULL, "Unknown"}, {0x41, nullptr, "Unknown"},
{0x42, NULL, "Unknown"}, {0x42, nullptr, "Unknown"},
{0x43, NULL, "Unknown"}, {0x43, nullptr, "Unknown"},
{0x44, NULL, "Unknown"}, {0x44, nullptr, "Unknown"},
{0x45, NULL, "Unknown"}, {0x45, nullptr, "Unknown"},
{0x46, NULL, "Unknown"}, {0x46, nullptr, "Unknown"},
{0x47, NULL, "CreatePort"}, {0x47, nullptr, "CreatePort"},
{0x48, NULL, "CreateSessionToPort"}, {0x48, nullptr, "CreateSessionToPort"},
{0x49, NULL, "CreateSession"}, {0x49, nullptr, "CreateSession"},
{0x4A, NULL, "AcceptSession"}, {0x4A, nullptr, "AcceptSession"},
{0x4B, NULL, "ReplyAndReceive1"}, {0x4B, nullptr, "ReplyAndReceive1"},
{0x4C, NULL, "ReplyAndReceive2"}, {0x4C, nullptr, "ReplyAndReceive2"},
{0x4D, NULL, "ReplyAndReceive3"}, {0x4D, nullptr, "ReplyAndReceive3"},
{0x4E, NULL, "ReplyAndReceive4"}, {0x4E, nullptr, "ReplyAndReceive4"},
{0x4F, NULL, "ReplyAndReceive"}, {0x4F, nullptr, "ReplyAndReceive"},
{0x50, NULL, "BindInterrupt"}, {0x50, nullptr, "BindInterrupt"},
{0x51, NULL, "UnbindInterrupt"}, {0x51, nullptr, "UnbindInterrupt"},
{0x52, NULL, "InvalidateProcessDataCache"}, {0x52, nullptr, "InvalidateProcessDataCache"},
{0x53, NULL, "StoreProcessDataCache"}, {0x53, nullptr, "StoreProcessDataCache"},
{0x54, NULL, "FlushProcessDataCache"}, {0x54, nullptr, "FlushProcessDataCache"},
{0x55, NULL, "StartInterProcessDma"}, {0x55, nullptr, "StartInterProcessDma"},
{0x56, NULL, "StopDma"}, {0x56, nullptr, "StopDma"},
{0x57, NULL, "GetDmaState"}, {0x57, nullptr, "GetDmaState"},
{0x58, NULL, "RestartDma"}, {0x58, nullptr, "RestartDma"},
{0x59, NULL, "Unknown"}, {0x59, nullptr, "Unknown"},
{0x5A, NULL, "Unknown"}, {0x5A, nullptr, "Unknown"},
{0x5B, NULL, "Unknown"}, {0x5B, nullptr, "Unknown"},
{0x5C, NULL, "Unknown"}, {0x5C, nullptr, "Unknown"},
{0x5D, NULL, "Unknown"}, {0x5D, nullptr, "Unknown"},
{0x5E, NULL, "Unknown"}, {0x5E, nullptr, "Unknown"},
{0x5F, NULL, "Unknown"}, {0x5F, nullptr, "Unknown"},
{0x60, NULL, "DebugActiveProcess"}, {0x60, nullptr, "DebugActiveProcess"},
{0x61, NULL, "BreakDebugProcess"}, {0x61, nullptr, "BreakDebugProcess"},
{0x62, NULL, "TerminateDebugProcess"}, {0x62, nullptr, "TerminateDebugProcess"},
{0x63, NULL, "GetProcessDebugEvent"}, {0x63, nullptr, "GetProcessDebugEvent"},
{0x64, NULL, "ContinueDebugEvent"}, {0x64, nullptr, "ContinueDebugEvent"},
{0x65, NULL, "GetProcessList"}, {0x65, nullptr, "GetProcessList"},
{0x66, NULL, "GetThreadList"}, {0x66, nullptr, "GetThreadList"},
{0x67, NULL, "GetDebugThreadContext"}, {0x67, nullptr, "GetDebugThreadContext"},
{0x68, NULL, "SetDebugThreadContext"}, {0x68, nullptr, "SetDebugThreadContext"},
{0x69, NULL, "QueryDebugProcessMemory"}, {0x69, nullptr, "QueryDebugProcessMemory"},
{0x6A, NULL, "ReadProcessMemory"}, {0x6A, nullptr, "ReadProcessMemory"},
{0x6B, NULL, "WriteProcessMemory"}, {0x6B, nullptr, "WriteProcessMemory"},
{0x6C, NULL, "SetHardwareBreakPoint"}, {0x6C, nullptr, "SetHardwareBreakPoint"},
{0x6D, NULL, "GetDebugThreadParam"}, {0x6D, nullptr, "GetDebugThreadParam"},
{0x6E, NULL, "Unknown"}, {0x6E, nullptr, "Unknown"},
{0x6F, NULL, "Unknown"}, {0x6F, nullptr, "Unknown"},
{0x70, NULL, "ControlProcessMemory"}, {0x70, nullptr, "ControlProcessMemory"},
{0x71, NULL, "MapProcessMemory"}, {0x71, nullptr, "MapProcessMemory"},
{0x72, NULL, "UnmapProcessMemory"}, {0x72, nullptr, "UnmapProcessMemory"},
{0x73, NULL, "Unknown"}, {0x73, nullptr, "Unknown"},
{0x74, NULL, "Unknown"}, {0x74, nullptr, "Unknown"},
{0x75, NULL, "Unknown"}, {0x75, nullptr, "Unknown"},
{0x76, NULL, "TerminateProcess"}, {0x76, nullptr, "TerminateProcess"},
{0x77, NULL, "Unknown"}, {0x77, nullptr, "Unknown"},
{0x78, NULL, "CreateResourceLimit"}, {0x78, nullptr, "CreateResourceLimit"},
{0x79, NULL, "Unknown"}, {0x79, nullptr, "Unknown"},
{0x7A, NULL, "Unknown"}, {0x7A, nullptr, "Unknown"},
{0x7B, NULL, "Unknown"}, {0x7B, nullptr, "Unknown"},
{0x7C, NULL, "KernelSetState"}, {0x7C, nullptr, "KernelSetState"},
{0x7D, NULL, "QueryProcessMemory"}, {0x7D, nullptr, "QueryProcessMemory"},
}; };
void Register() { void Register() {