summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2014-04-16 00:03:41 -0400
committerGravatar bunnei2014-04-16 00:03:41 -0400
commit32c3462047d814eada8f3b80ee5ea2cd03936ae0 (patch)
tree9df4dd16c09f2b94e02e77b4818dc199e3323cc0 /src
parentremoved no longer used function header (diff)
downloadyuzu-32c3462047d814eada8f3b80ee5ea2cd03936ae0.tar.gz
yuzu-32c3462047d814eada8f3b80ee5ea2cd03936ae0.tar.xz
yuzu-32c3462047d814eada8f3b80ee5ea2cd03936ae0.zip
- added stubbed out GSP::Gpu service interface
- various cleanups/refactors to HLE services
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 @@
154 <ClCompile Include="file_sys\meta_file_system.cpp" /> 154 <ClCompile Include="file_sys\meta_file_system.cpp" />
155 <ClCompile Include="hle\hle.cpp" /> 155 <ClCompile Include="hle\hle.cpp" />
156 <ClCompile Include="hle\service\apt.cpp" /> 156 <ClCompile Include="hle\service\apt.cpp" />
157 <ClCompile Include="hle\service\gsp.cpp" />
157 <ClCompile Include="hle\service\service.cpp" /> 158 <ClCompile Include="hle\service\service.cpp" />
158 <ClCompile Include="hle\service\srv.cpp" /> 159 <ClCompile Include="hle\service\srv.cpp" />
159 <ClCompile Include="hle\syscall.cpp" /> 160 <ClCompile Include="hle\syscall.cpp" />
@@ -190,6 +191,7 @@
190 <ClInclude Include="hle\function_wrappers.h" /> 191 <ClInclude Include="hle\function_wrappers.h" />
191 <ClInclude Include="hle\hle.h" /> 192 <ClInclude Include="hle\hle.h" />
192 <ClInclude Include="hle\service\apt.h" /> 193 <ClInclude Include="hle\service\apt.h" />
194 <ClInclude Include="hle\service\gsp.h" />
193 <ClInclude Include="hle\service\service.h" /> 195 <ClInclude Include="hle\service\service.h" />
194 <ClInclude Include="hle\service\srv.h" /> 196 <ClInclude Include="hle\service\srv.h" />
195 <ClInclude Include="hle\syscall.h" /> 197 <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 @@
96 <ClCompile Include="hle\service\srv.cpp"> 96 <ClCompile Include="hle\service\srv.cpp">
97 <Filter>hle\service</Filter> 97 <Filter>hle\service</Filter>
98 </ClCompile> 98 </ClCompile>
99 <ClCompile Include="hle\service\gsp.cpp">
100 <Filter>hle\service</Filter>
101 </ClCompile>
99 </ItemGroup> 102 </ItemGroup>
100 <ItemGroup> 103 <ItemGroup>
101 <ClInclude Include="arm\disassembler\arm_disasm.h"> 104 <ClInclude Include="arm\disassembler\arm_disasm.h">
@@ -187,6 +190,9 @@
187 <ClInclude Include="hle\service\srv.h"> 190 <ClInclude Include="hle\service\srv.h">
188 <Filter>hle\service</Filter> 191 <Filter>hle\service</Filter>
189 </ClInclude> 192 </ClInclude>
193 <ClInclude Include="hle\service\gsp.h">
194 <Filter>hle\service</Filter>
195 </ClInclude>
190 </ItemGroup> 196 </ItemGroup>
191 <ItemGroup> 197 <ItemGroup>
192 <Text Include="CMakeLists.txt" /> 198 <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:
25 ~Interface(); 25 ~Interface();
26 26
27 /** 27 /**
28 * Gets the string port name used by CTROS for the APT service 28 * Gets the string port name used by CTROS for the service
29 * @return Port name of service 29 * @return Port name of service
30 */ 30 */
31 std::string GetPortName() const { 31 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 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2
3// Refer to the license.txt file included.
4
5
6#include "common/log.h"
7
8#include "core/hle/hle.h"
9#include "core/hle/service/gsp.h"
10
11namespace GSP_GPU {
12
13const HLE::FunctionDef FunctionTable[] = {
14 {0x00010082, NULL, "WriteHWRegs"},
15 {0x00020084, NULL, "WriteHWRegsWithMask"},
16 {0x00030082, NULL, "WriteHWRegRepeat"},
17 {0x00040080, NULL, "ReadHWRegs"},
18 {0x00050200, NULL, "SetBufferSwap"},
19 {0x00060082, NULL, "SetCommandList"},
20 {0x000700C2, NULL, "RequestDma"},
21 {0x00080082, NULL, "FlushDataCache"},
22 {0x00090082, NULL, "InvalidateDataCache"},
23 {0x000A0044, NULL, "RegisterInterruptEvents"},
24 {0x000B0040, NULL, "SetLcdForceBlack"},
25 {0x000C0000, NULL, "TriggerCmdReqQueue"},
26 {0x000D0140, NULL, "SetDisplayTransfer"},
27 {0x000E0180, NULL, "SetTextureCopy"},
28 {0x000F0200, NULL, "SetMemoryFill"},
29 {0x00100040, NULL, "SetAxiConfigQoSMode"},
30 {0x00110040, NULL, "SetPerfLogMode"},
31 {0x00120000, NULL, "GetPerfLog"},
32 {0x00130042, NULL, "RegisterInterruptRelayQueue"},
33 {0x00140000, NULL, "UnregisterInterruptRelayQueue"},
34 {0x00150002, NULL, "TryAcquireRight"},
35 {0x00160042, NULL, "AcquireRight"},
36 {0x00170000, NULL, "ReleaseRight"},
37 {0x00180000, NULL, "ImportDisplayCaptureInfo"},
38 {0x00190000, NULL, "SaveVramSysArea"},
39 {0x001A0000, NULL, "RestoreVramSysArea"},
40 {0x001B0000, NULL, "ResetGpuCore"},
41 {0x001C0040, NULL, "SetLedForceOff"},
42 {0x001D0040, NULL, "SetTestCommand"},
43 {0x001E0080, NULL, "SetInternalPriorities"},
44};
45
46////////////////////////////////////////////////////////////////////////////////////////////////////
47// Interface class
48
49Interface::Interface() {
50 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
51}
52
53Interface::~Interface() {
54}
55
56} // 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 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include "core/hle/service/service.h"
8
9////////////////////////////////////////////////////////////////////////////////////////////////////
10// Namespace Service
11
12namespace GSP_GPU {
13
14class Interface : public Service::Interface {
15public:
16
17 Interface();
18
19 ~Interface();
20
21 /**
22 * Gets the string port name used by CTROS for the service
23 * @return Port name of service
24 */
25 std::string GetPortName() const {
26 return "gsp::Gpu";
27 }
28
29private:
30
31 DISALLOW_COPY_AND_ASSIGN(Interface);
32};
33
34} // 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 @@
9#include "core/hle/hle.h" 9#include "core/hle/hle.h"
10#include "core/hle/service/service.h" 10#include "core/hle/service/service.h"
11#include "core/hle/service/apt.h" 11#include "core/hle/service/apt.h"
12#include "core/hle/service/gsp.h"
12#include "core/hle/service/srv.h" 13#include "core/hle/service/srv.h"
13 14
14namespace Service { 15namespace Service {
@@ -73,8 +74,11 @@ Interface* Manager::FetchFromPortName(std::string port_name) {
73/// Initialize ServiceManager 74/// Initialize ServiceManager
74void Init() { 75void Init() {
75 g_manager = new Manager; 76 g_manager = new Manager;
77
76 g_manager->AddService(new SRV::Interface); 78 g_manager->AddService(new SRV::Interface);
77 g_manager->AddService(new APT_U::Interface); 79 g_manager->AddService(new APT_U::Interface);
80 g_manager->AddService(new GSP_GPU::Interface);
81
78 NOTICE_LOG(HLE, "Services initialized OK"); 82 NOTICE_LOG(HLE, "Services initialized OK");
79} 83}
80 84
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 {
19 19
20typedef s32 NativeUID; ///< Native handle for a service 20typedef s32 NativeUID; ///< Native handle for a service
21 21
22static const int kCommandHeaderOffset = 0x80; ///< Offset into command buffer of header 22static const int kMaxPortSize = 0x08; ///< Maximum size of a port name (8 characters)
23static const int kCommandHeaderOffset = 0x80; ///< Offset into command buffer of header
23 24
24class Manager; 25class Manager;
25 26
@@ -59,14 +60,15 @@ public:
59 auto itr = m_functions.find(cmd_buff[0]); 60 auto itr = m_functions.find(cmd_buff[0]);
60 61
61 if (itr == m_functions.end()) { 62 if (itr == m_functions.end()) {
62 ERROR_LOG(OSHLE, "Unknown/unimplemented function: port=%s, command=0x%08X!", 63 ERROR_LOG(OSHLE, "Unknown/unimplemented function: port = %s, command = 0x%08X!",
63 GetPortName().c_str(), cmd_buff[0]); 64 GetPortName().c_str(), cmd_buff[0]);
64 return -1; 65 return -1;
65 } 66 }
66 if (itr->second.func == NULL) { 67 if (itr->second.func == NULL) {
67 ERROR_LOG(OSHLE, "Unimplemented function: port=%s, name=%s!", 68 ERROR_LOG(OSHLE, "Unimplemented function: port = %s, name = %s!",
68 GetPortName().c_str(), itr->second.name.c_str()); 69 GetPortName().c_str(), itr->second.name.c_str());
69 } 70 return -1;
71 }
70 72
71 itr->second.func(); 73 itr->second.func();
72 74
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() {
17 Syscall::Result res = 0; 17 Syscall::Result res = 0;
18 u32* cmd_buff = (u32*)HLE::GetPointer(HLE::CMD_BUFFER_ADDR + Service::kCommandHeaderOffset); 18 u32* cmd_buff = (u32*)HLE::GetPointer(HLE::CMD_BUFFER_ADDR + Service::kCommandHeaderOffset);
19 19
20 const char* port_name = (const char*)&cmd_buff[1]; 20 std::string port_name = std::string((const char*)&cmd_buff[1], 0, Service::kMaxPortSize);
21 Service::Interface* service = Service::g_manager->FetchFromPortName(port_name); 21 Service::Interface* service = Service::g_manager->FetchFromPortName(port_name);
22 22
23 NOTICE_LOG(OSHLE, "SRV::Sync - GetHandle - port: %s, handle: 0x%08X", port_name, 23 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:
18 ~Interface(); 18 ~Interface();
19 19
20 /** 20 /**
21 * Gets the string name used by CTROS for a service 21 * Gets the string name used by CTROS for the service
22 * @return Port name of service 22 * @return Port name of service
23 */ 23 */
24 std::string GetPortName() const { 24 std::string GetPortName() const {