VERY experimental Nintendo Switch 2 emulator
C++
hle: cleaned up log messages
bunneic404d22036e1
diff --git a/src/core/hle/config_mem.cpp b/src/core/hle/config_mem.cppindex 48aa878cc1..8c898b2653 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.cppindex 080c36abf4..f703da44e5 100644--- a/src/core/hle/hle.cpp+++ b/src/core/hle/hle.cpp@@ -18,7 +18,7 @@ static std::vector<ModuleDef> g_module_db;const FunctionDef* GetSVCInfo(u32 opcode) {u32 func_num = opcode & 0xFFFFFF; // 8 bitsif (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.cppindex f2118ba032..10d9a94bde 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 handlecmd_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 fieldcmd_buff[1] = 0; // No errorcmd_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 errorcmd_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.cppindex 50cee2c41b..575db86c1d 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.cppindex 08d0c43ff5..904670e629 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 ServiceManagervoid 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.cppindex 97e7fc8fa8..ac8f398fcc 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.cppindex 27f2b2315e..01fb647e76 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 operationdefault:- 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 addressResult 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 otherperMemory::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 outResult 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<Kernel::Object>(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 handleResult 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<Kernel::Object>(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 waHandle* 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 wabool wait = false;Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(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 addressResult 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 nowreturn 0;@@ -229,7 +230,7 @@ Result CreateThread(u32 priority, u32 entry_point, u32 arg, u32 stack_top, u32 pCore::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 pResult 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 mutexResult 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 IDResult 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 memoryResult 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 handleResult 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 eventResult 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.cppindex 86e9eaa203..ab014a5965 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);}}