VERY experimental Nintendo Switch 2 emulator
C++
- added some function wrappers for HLE
bunnei4ee72869cce3
diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.hindex 4897d3f286..53bfafa78f 100644--- a/src/core/hle/function_wrappers.h+++ b/src/core/hle/function_wrappers.h@@ -158,8 +158,8 @@ template<int func(u32, u32, u32, u32, u32)> void WrapI_UUUUU() {RETURN(retval);}-template<int func()> void WrapI_V() {- int retval = func();+template<int func(void*)> void WrapI_V() {+ u32 retval = func(Memory::GetPointer(PARAM(0)));RETURN(retval);}@@ -638,6 +638,10 @@ template<u32 func(const char *, const char *)> void WrapU_CC() {RETURN(retval);}+template<void func(const char*)> void WrapV_C() {+ func(Memory::GetCharPointer(PARAM(0)));+}+template<void func(const char *, int)> void WrapV_CI() {func(Memory::GetCharPointer(PARAM(0)), PARAM(1));}@@ -716,18 +720,18 @@ template <int func(int, const char *, int)> void WrapI_ICI() {}template<int func(int, void *, void *, void *, void *, u32, int)> void WrapI_IVVVVUI(){- u32 retval = func(PARAM(0), Memory::GetPointer(PARAM(1)), Memory::GetPointer(PARAM(2)), Memory::GetPointer(PARAM(3)), Memory::GetPointer(PARAM(4)), PARAM(5), PARAM(6) );- RETURN(retval);+ u32 retval = func(PARAM(0), Memory::GetPointer(PARAM(1)), Memory::GetPointer(PARAM(2)), Memory::GetPointer(PARAM(3)), Memory::GetPointer(PARAM(4)), PARAM(5), PARAM(6) );+ RETURN(retval);}template<int func(int, const char *, u32, void *, int, int, int)> void WrapI_ICUVIII(){- u32 retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), Memory::GetPointer(PARAM(3)), PARAM(4), PARAM(5), PARAM(6));- RETURN(retval);+ u32 retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), Memory::GetPointer(PARAM(3)), PARAM(4), PARAM(5), PARAM(6));+ RETURN(retval);}template<int func(void *, u32, u32, u32, u32, u32)> void WrapI_VUUUUU(){- u32 retval = func(Memory::GetPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5));- RETURN(retval);+ u32 retval = func(Memory::GetPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5));+ RETURN(retval);}template<int func(u32, s64)> void WrapI_US64() {diff --git a/src/core/hle/syscall.cpp b/src/core/hle/syscall.cppindex df6412743a..cc5b561b5a 100644--- a/src/core/hle/syscall.cpp+++ b/src/core/hle/syscall.cpp@@ -82,15 +82,30 @@ Result SendSyncRequest(Handle session) {/// Close a handleResult CloseHandle(Handle handle) {// ImplementMe+ NOTICE_LOG(OSHLE, "stubbed function CloseHandle");return 0;}/// Wait for a handle to synchronize, timeout after the specified nanosecondsResult WaitSynchronization1(Handle handle, s64 nanoseconds) {// ImplementMe+ NOTICE_LOG(OSHLE, "stubbed function WaitSynchronization1");return 0;}+/// Create an address arbiter (to allocate access to shared resources)+Result CreateAddressArbiter(void* arbiter) {+ // ImplementMe+ NOTICE_LOG(OSHLE, "stubbed function CreateAddressArbiter");+ Core::g_app_core->SetReg(1, 0xDEADBEEF);+ return 0;+}++/// Used to output a message on a debug hardware unit - does nothing on a retail unit+void OutputDebugString(const char* string) {+ NOTICE_LOG(OSHLE, "## OSDEBUG: %s", string);+}+const HLE::FunctionDef Syscall_Table[] = {{0x00, NULL, "Unknown"},{0x01, WrapI_UUUUU<ControlMemory>, "ControlMemory"},@@ -125,7 +140,7 @@ const HLE::FunctionDef Syscall_Table[] = {{0x1E, NULL, "CreateMemoryBlock"},{0x1F, WrapI_UUUU<MapMemoryBlock>, "MapMemoryBlock"},{0x20, NULL, "UnmapMemoryBlock"},- {0x21, NULL, "CreateAddressArbiter"},+ {0x21, WrapI_V<CreateAddressArbiter>, "CreateAddressArbiter"},{0x22, NULL, "ArbitrateAddress"},{0x23, WrapI_U<CloseHandle>, "CloseHandle"},{0x24, WrapI_US64<WaitSynchronization1>, "WaitSynchronization1"},@@ -153,7 +168,7 @@ const HLE::FunctionDef Syscall_Table[] = {{0x3A, NULL, "GetResourceLimitCurrentValues"},{0x3B, NULL, "GetThreadContext"},{0x3C, NULL, "Break"},- {0x3D, NULL, "OutputDebugString"},+ {0x3D, WrapV_C<OutputDebugString>, "OutputDebugString"},{0x3E, NULL, "ControlPerformanceCounter"},{0x3F, NULL, "Unknown"},{0x40, NULL, "Unknown"},