summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbunnei <ericbunnie@gmail.com>2014-04-16 06:03:41 +0200
committerbunnei <ericbunnie@gmail.com>2014-04-16 06:03:41 +0200
commit32c3462047d814eada8f3b80ee5ea2cd03936ae0 (patch)
tree9df4dd16c09f2b94e02e77b4818dc199e3323cc0 /src
parentremoved no longer used function header (diff)
downloadyuzu-32c3462047d814eada8f3b80ee5ea2cd03936ae0.tar
yuzu-32c3462047d814eada8f3b80ee5ea2cd03936ae0.tar.gz
yuzu-32c3462047d814eada8f3b80ee5ea2cd03936ae0.tar.bz2
yuzu-32c3462047d814eada8f3b80ee5ea2cd03936ae0.tar.lz
yuzu-32c3462047d814eada8f3b80ee5ea2cd03936ae0.tar.xz
yuzu-32c3462047d814eada8f3b80ee5ea2cd03936ae0.tar.zst
yuzu-32c3462047d814eada8f3b80ee5ea2cd03936ae0.zip
Diffstat (limited to 'src')
-rw-r--r--src/core/core.vcxproj2
-rw-r--r--src/core/core.vcxproj.filters6
-rw-r--r--src/core/hle/service/apt.h2
-rw-r--r--src/core/hle/service/gsp.cpp56
-rw-r--r--src/core/hle/service/gsp.h34
-rw-r--r--src/core/hle/service/service.cpp4
-rw-r--r--src/core/hle/service/service.h10
-rw-r--r--src/core/hle/service/srv.cpp2
-rw-r--r--src/core/hle/service/srv.h2
9 files changed, 111 insertions, 7 deletions
diff --git a/src/core/core.vcxproj b/src/core/core.vcxproj
index da3cc7a26..931345441 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.filters
index fa20ab686..e022785ad 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.h
index 889b12711..9345eabc3 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.cpp
new file mode 100644
index 000000000..6dfd76de3
--- /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() {
+}
+
+} // namespace
diff --git a/src/core/hle/service/gsp.h b/src/core/hle/service/gsp.h
new file mode 100644
index 000000000..0a9d452f6
--- /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);
+};
+
+} // namespace
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 81a34ed06..f612ff830 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 ServiceManager
void 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.h
index 3b256aa3e..9cbf8b6fa 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 header
class 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.cpp
index bb6c08b78..ad7448461 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.h
index b4c5a0c17..a1d26a34d 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 {