summaryrefslogtreecommitdiff
path: root/src/core/hle/service/service.cpp
diff options
context:
space:
mode:
authorGravatar Subv2016-12-05 12:05:00 -0500
committerGravatar Subv2016-12-05 12:05:00 -0500
commit00f0c775702af4145a4a81ec5d357c3586a5c6c3 (patch)
tree58f7dbfddba5de2c2f4a7fac420ab5ac8a8a3de1 /src/core/hle/service/service.cpp
parentKernel: Remove the Redirection handle type. (diff)
downloadyuzu-00f0c775702af4145a4a81ec5d357c3586a5c6c3.tar.gz
yuzu-00f0c775702af4145a4a81ec5d357c3586a5c6c3.tar.xz
yuzu-00f0c775702af4145a4a81ec5d357c3586a5c6c3.zip
Split SessionRequestHandler::HandleSyncRequest into HandleSyncRequest, TranslateRequest and HandleSyncRequestImpl.
HandleSyncRequest now takes care of calling the command buffer translate function before actually invoking the command handler for HLE services.
Diffstat (limited to 'src/core/hle/service/service.cpp')
-rw-r--r--src/core/hle/service/service.cpp27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 3462af8ce..3d5e3058c 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -64,7 +64,27 @@ static std::string MakeFunctionString(const char* name, const char* port_name,
64 return function_string; 64 return function_string;
65} 65}
66 66
67ResultCode Interface::HandleSyncRequest(Kernel::SharedPtr<Kernel::ServerSession> server_session) { 67ResultCode SessionRequestHandler::HandleSyncRequest(Kernel::SharedPtr<Kernel::ServerSession> server_session) {
68 // Attempt to translate the incoming request's command buffer.
69 ResultCode result = TranslateRequest(server_session);
70
71 if (result.IsError())
72 return result;
73
74 // Actually handle the request
75 HandleSyncRequestImpl(server_session);
76
77 // TODO(Subv): Translate the response command buffer.
78
79 return RESULT_SUCCESS;
80}
81
82ResultCode SessionRequestHandler::TranslateRequest(Kernel::SharedPtr<Kernel::ServerSession> server_session) {
83 // TODO(Subv): Implement this function once multiple concurrent processes are supported.
84 return RESULT_SUCCESS;
85}
86
87void Interface::HandleSyncRequestImpl(Kernel::SharedPtr<Kernel::ServerSession> server_session) {
68 // TODO(Subv): Make use of the server_session in the HLE service handlers to distinguish which session triggered each command. 88 // TODO(Subv): Make use of the server_session in the HLE service handlers to distinguish which session triggered each command.
69 89
70 u32* cmd_buff = Kernel::GetCommandBuffer(); 90 u32* cmd_buff = Kernel::GetCommandBuffer();
@@ -80,14 +100,12 @@ ResultCode Interface::HandleSyncRequest(Kernel::SharedPtr<Kernel::ServerSession>
80 100
81 // TODO(bunnei): Hack - ignore error 101 // TODO(bunnei): Hack - ignore error
82 cmd_buff[1] = 0; 102 cmd_buff[1] = 0;
83 return RESULT_SUCCESS; 103 return;
84 } 104 }
85 LOG_TRACE(Service, "%s", 105 LOG_TRACE(Service, "%s",
86 MakeFunctionString(itr->second.name, GetPortName().c_str(), cmd_buff).c_str()); 106 MakeFunctionString(itr->second.name, GetPortName().c_str(), cmd_buff).c_str());
87 107
88 itr->second.func(this); 108 itr->second.func(this);
89
90 return RESULT_SUCCESS; // TODO: Implement return from actual function, it should fail if the parameter translation fails
91} 109}
92 110
93void Interface::Register(const FunctionInfo* functions, size_t n) { 111void Interface::Register(const FunctionInfo* functions, size_t n) {
@@ -179,4 +197,5 @@ void Shutdown() {
179 g_kernel_named_ports.clear(); 197 g_kernel_named_ports.clear();
180 LOG_DEBUG(Service, "shutdown OK"); 198 LOG_DEBUG(Service, "shutdown OK");
181} 199}
200
182} 201}