VERY experimental Nintendo Switch 2 emulator
C++
- added stubbed out GSP::Gpu service interface
bunnei32c3462047d8
diff --git a/src/core/core.vcxproj b/src/core/core.vcxprojindex da3cc7a266..931345441f 100644--- a/src/core/core.vcxproj+++ b/src/core/core.vcxproj@@ -154,6 +154,7 @@<ClCompile Include="file_sys\meta_file_system.cpp" /><ClCompile Include="hle\hle.cpp" /><ClCompile Include="hle\service\apt.cpp" />+ <ClCompile Include="hle\service\gsp.cpp" /><ClCompile Include="hle\service\service.cpp" /><ClCompile Include="hle\service\srv.cpp" /><ClCompile Include="hle\syscall.cpp" />@@ -190,6 +191,7 @@<ClInclude Include="hle\function_wrappers.h" /><ClInclude Include="hle\hle.h" /><ClInclude Include="hle\service\apt.h" />+ <ClInclude Include="hle\service\gsp.h" /><ClInclude Include="hle\service\service.h" /><ClInclude Include="hle\service\srv.h" /><ClInclude Include="hle\syscall.h" />diff --git a/src/core/core.vcxproj.filters b/src/core/core.vcxproj.filtersindex fa20ab6867..e022785ad0 100644--- a/src/core/core.vcxproj.filters+++ b/src/core/core.vcxproj.filters@@ -96,6 +96,9 @@<ClCompile Include="hle\service\srv.cpp"><Filter>hle\service</Filter></ClCompile>+ <ClCompile Include="hle\service\gsp.cpp">+ <Filter>hle\service</Filter>+ </ClCompile></ItemGroup><ItemGroup><ClInclude Include="arm\disassembler\arm_disasm.h">@@ -187,6 +190,9 @@<ClInclude Include="hle\service\srv.h"><Filter>hle\service</Filter></ClInclude>+ <ClInclude Include="hle\service\gsp.h">+ <Filter>hle\service</Filter>+ </ClInclude></ItemGroup><ItemGroup><Text Include="CMakeLists.txt" />diff --git a/src/core/hle/service/apt.h b/src/core/hle/service/apt.hindex 889b127119..9345eabc3e 100644--- a/src/core/hle/service/apt.h+++ b/src/core/hle/service/apt.h@@ -25,7 +25,7 @@ public:~Interface();/**- * Gets the string port name used by CTROS for the APT service+ * Gets the string port name used by CTROS for the service* @return Port name of service*/std::string GetPortName() const {diff --git a/src/core/hle/service/gsp.cpp b/src/core/hle/service/gsp.cppnew file mode 100644index 0000000000..6dfd76de3e--- /dev/null+++ b/src/core/hle/service/gsp.cpp@@ -0,0 +1,56 @@+// 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/gsp.h"++namespace GSP_GPU {++const HLE::FunctionDef FunctionTable[] = {+ {0x00010082, NULL, "WriteHWRegs"},+ {0x00020084, NULL, "WriteHWRegsWithMask"},+ {0x00030082, NULL, "WriteHWRegRepeat"},+ {0x00040080, NULL, "ReadHWRegs"},+ {0x00050200, NULL, "SetBufferSwap"},+ {0x00060082, NULL, "SetCommandList"},+ {0x000700C2, NULL, "RequestDma"},+ {0x00080082, NULL, "FlushDataCache"},+ {0x00090082, NULL, "InvalidateDataCache"},+ {0x000A0044, NULL, "RegisterInterruptEvents"},+ {0x000B0040, NULL, "SetLcdForceBlack"},+ {0x000C0000, NULL, "TriggerCmdReqQueue"},+ {0x000D0140, NULL, "SetDisplayTransfer"},+ {0x000E0180, NULL, "SetTextureCopy"},+ {0x000F0200, NULL, "SetMemoryFill"},+ {0x00100040, NULL, "SetAxiConfigQoSMode"},+ {0x00110040, NULL, "SetPerfLogMode"},+ {0x00120000, NULL, "GetPerfLog"},+ {0x00130042, NULL, "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"},+};++////////////////////////////////////////////////////////////////////////////////////////////////////+// Interface class++Interface::Interface() {+ Register(FunctionTable, ARRAY_SIZE(FunctionTable));+}++Interface::~Interface() {+}++} // namespacediff --git a/src/core/hle/service/gsp.h b/src/core/hle/service/gsp.hnew file mode 100644index 0000000000..0a9d452f62--- /dev/null+++ b/src/core/hle/service/gsp.h@@ -0,0 +1,34 @@+// Copyright 2014 Citra Emulator Project+// Licensed under GPLv2+// Refer to the license.txt file included.++#pragma once++#include "core/hle/service/service.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace Service++namespace GSP_GPU {++class Interface : public Service::Interface {+public:++ Interface();++ ~Interface();++ /**+ * Gets the string port name used by CTROS for the service+ * @return Port name of service+ */+ std::string GetPortName() const {+ return "gsp::Gpu";+ }++private:++ DISALLOW_COPY_AND_ASSIGN(Interface);+};++} // namespacediff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cppindex 81a34ed061..f612ff8300 100644--- a/src/core/hle/service/service.cpp+++ b/src/core/hle/service/service.cpp@@ -9,6 +9,7 @@#include "core/hle/hle.h"#include "core/hle/service/service.h"#include "core/hle/service/apt.h"+#include "core/hle/service/gsp.h"#include "core/hle/service/srv.h"namespace Service {@@ -73,8 +74,11 @@ Interface* Manager::FetchFromPortName(std::string port_name) {/// Initialize ServiceManagervoid Init() {g_manager = new Manager;+g_manager->AddService(new SRV::Interface);g_manager->AddService(new APT_U::Interface);+ g_manager->AddService(new GSP_GPU::Interface);+NOTICE_LOG(HLE, "Services initialized OK");}diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.hindex 3b256aa3e8..9cbf8b6fa9 100644--- a/src/core/hle/service/service.h+++ b/src/core/hle/service/service.h@@ -19,7 +19,8 @@ namespace Service {typedef s32 NativeUID; ///< Native handle for a service-static const int kCommandHeaderOffset = 0x80; ///< Offset into command buffer of header+static const int kMaxPortSize = 0x08; ///< Maximum size of a port name (8 characters)+static const int kCommandHeaderOffset = 0x80; ///< Offset into command buffer of headerclass Manager;@@ -59,14 +60,15 @@ 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().c_str(), cmd_buff[0]);return -1;}if (itr->second.func == NULL) {- ERROR_LOG(OSHLE, "Unimplemented function: port=%s, name=%s!",+ ERROR_LOG(OSHLE, "Unimplemented function: port = %s, name = %s!",GetPortName().c_str(), itr->second.name.c_str());- }+ return -1;+ }itr->second.func();diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cppindex bb6c08b78f..ad74484617 100644--- a/src/core/hle/service/srv.cpp+++ b/src/core/hle/service/srv.cpp@@ -17,7 +17,7 @@ void GetServiceHandle() {Syscall::Result res = 0;u32* cmd_buff = (u32*)HLE::GetPointer(HLE::CMD_BUFFER_ADDR + Service::kCommandHeaderOffset);- const char* port_name = (const char*)&cmd_buff[1];+ 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,diff --git a/src/core/hle/service/srv.h b/src/core/hle/service/srv.hindex b4c5a0c171..a1d26a34d8 100644--- a/src/core/hle/service/srv.h+++ b/src/core/hle/service/srv.h@@ -18,7 +18,7 @@ public:~Interface();/**- * Gets the string name used by CTROS for a service+ * Gets the string name used by CTROS for the service* @return Port name of service*/std::string GetPortName() const {