summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service
diff options
context:
space:
mode:
authorWeiyi Wang <wwylele@gmail.com>2017-02-05 09:22:13 +0100
committerGitHub <noreply@github.com>2017-02-05 09:22:13 +0100
commita1393dc70c74c3ca414c2360acaa5042bce84c91 (patch)
treea0938f34e95cf06bc8ca79eed424db44332d8f48 /src/core/hle/service
parentFix Microprofile in MinGW (#2530) (diff)
parentfix wwylele's comment and use typename in templates (diff)
downloadyuzu-a1393dc70c74c3ca414c2360acaa5042bce84c91.tar
yuzu-a1393dc70c74c3ca414c2360acaa5042bce84c91.tar.gz
yuzu-a1393dc70c74c3ca414c2360acaa5042bce84c91.tar.bz2
yuzu-a1393dc70c74c3ca414c2360acaa5042bce84c91.tar.lz
yuzu-a1393dc70c74c3ca414c2360acaa5042bce84c91.tar.xz
yuzu-a1393dc70c74c3ca414c2360acaa5042bce84c91.tar.zst
yuzu-a1393dc70c74c3ca414c2360acaa5042bce84c91.zip
Diffstat (limited to 'src/core/hle/service')
-rw-r--r--src/core/hle/service/fs/fs_user.cpp27
-rw-r--r--src/core/hle/service/service.h1
-rw-r--r--src/core/hle/service/y2r_u.cpp47
3 files changed, 40 insertions, 35 deletions
diff --git a/src/core/hle/service/fs/fs_user.cpp b/src/core/hle/service/fs/fs_user.cpp
index 337da1387..33b290699 100644
--- a/src/core/hle/service/fs/fs_user.cpp
+++ b/src/core/hle/service/fs/fs_user.cpp
@@ -54,15 +54,17 @@ static void Initialize(Service::Interface* self) {
* 3 : File handle
*/
static void OpenFile(Service::Interface* self) {
- u32* cmd_buff = Kernel::GetCommandBuffer();
+ // The helper should be passed by argument to the function
+ IPC::RequestParser rp(Kernel::GetCommandBuffer(), {0x080201C2});
+ rp.Pop<u32>(); // Always 0 ?
- ArchiveHandle archive_handle = MakeArchiveHandle(cmd_buff[2], cmd_buff[3]);
- auto filename_type = static_cast<FileSys::LowPathType>(cmd_buff[4]);
- u32 filename_size = cmd_buff[5];
+ ArchiveHandle archive_handle = rp.Pop<u64>();
+ auto filename_type = static_cast<FileSys::LowPathType>(rp.Pop<u32>());
+ u32 filename_size = rp.Pop<u32>();
FileSys::Mode mode;
- mode.hex = cmd_buff[6];
- u32 attributes = cmd_buff[7]; // TODO(Link Mauve): do something with those attributes.
- u32 filename_ptr = cmd_buff[9];
+ mode.hex = rp.Pop<u32>();
+ u32 attributes = rp.Pop<u32>(); // TODO(Link Mauve): do something with those attributes.
+ VAddr filename_ptr = rp.PopStaticBuffer();
FileSys::Path file_path(filename_type, filename_size, filename_ptr);
LOG_DEBUG(Service_FS, "path=%s, mode=%u attrs=%u", file_path.DebugStr().c_str(), mode.hex,
@@ -70,16 +72,17 @@ static void OpenFile(Service::Interface* self) {
ResultVal<std::shared_ptr<File>> file_res =
OpenFileFromArchive(archive_handle, file_path, mode);
- cmd_buff[1] = file_res.Code().raw;
+ IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
+ rb.Push(file_res.Code());
if (file_res.Succeeded()) {
std::shared_ptr<File> file = *file_res;
auto sessions = ServerSession::CreateSessionPair(file->GetName(), file);
file->ClientConnected(std::get<Kernel::SharedPtr<Kernel::ServerSession>>(sessions));
- cmd_buff[3] = Kernel::g_handle_table
- .Create(std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions))
- .MoveFrom();
+ rb.PushMoveHandles(Kernel::g_handle_table
+ .Create(std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions))
+ .MoveFrom());
} else {
- cmd_buff[3] = 0;
+ rb.PushMoveHandles(0);
LOG_ERROR(Service_FS, "failed to get a handle for file %s", file_path.DebugStr().c_str());
}
}
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index a7ba7688f..e6a5f1417 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -10,6 +10,7 @@
#include <boost/container/flat_map.hpp>
#include "common/common_types.h"
#include "core/hle/ipc.h"
+#include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/client_port.h"
#include "core/hle/kernel/thread.h"
#include "core/hle/result.h"
diff --git a/src/core/hle/service/y2r_u.cpp b/src/core/hle/service/y2r_u.cpp
index 31bb466fc..907d9c8fa 100644
--- a/src/core/hle/service/y2r_u.cpp
+++ b/src/core/hle/service/y2r_u.cpp
@@ -281,37 +281,39 @@ static void GetTransferEndEvent(Interface* self) {
}
static void SetSendingY(Interface* self) {
- u32* cmd_buff = Kernel::GetCommandBuffer();
-
- conversion.src_Y.address = cmd_buff[1];
- conversion.src_Y.image_size = cmd_buff[2];
- conversion.src_Y.transfer_unit = cmd_buff[3];
- conversion.src_Y.gap = cmd_buff[4];
+ // The helper should be passed by argument to the function
+ IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x00100102);
+ conversion.src_Y.address = rp.Pop<u32>();
+ conversion.src_Y.image_size = rp.Pop<u32>();
+ conversion.src_Y.transfer_unit = rp.Pop<u32>();
+ conversion.src_Y.gap = rp.Pop<u32>();
+ Kernel::Handle src_process_handle = rp.PopHandle();
- cmd_buff[0] = IPC::MakeHeader(0x10, 1, 0);
- cmd_buff[1] = RESULT_SUCCESS.raw;
+ IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
+ rb.Push(RESULT_SUCCESS);
LOG_DEBUG(Service_Y2R, "called image_size=0x%08X, transfer_unit=%hu, transfer_stride=%hu, "
"src_process_handle=0x%08X",
conversion.src_Y.image_size, conversion.src_Y.transfer_unit, conversion.src_Y.gap,
- cmd_buff[6]);
+ src_process_handle);
}
static void SetSendingU(Interface* self) {
- u32* cmd_buff = Kernel::GetCommandBuffer();
+ // The helper should be passed by argument to the function
+ IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x00110102);
+ conversion.src_U.address = rp.Pop<u32>();
+ conversion.src_U.image_size = rp.Pop<u32>();
+ conversion.src_U.transfer_unit = rp.Pop<u32>();
+ conversion.src_U.gap = rp.Pop<u32>();
+ Kernel::Handle src_process_handle = rp.PopHandle();
- conversion.src_U.address = cmd_buff[1];
- conversion.src_U.image_size = cmd_buff[2];
- conversion.src_U.transfer_unit = cmd_buff[3];
- conversion.src_U.gap = cmd_buff[4];
-
- cmd_buff[0] = IPC::MakeHeader(0x11, 1, 0);
- cmd_buff[1] = RESULT_SUCCESS.raw;
+ IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
+ rb.Push(RESULT_SUCCESS);
LOG_DEBUG(Service_Y2R, "called image_size=0x%08X, transfer_unit=%hu, transfer_stride=%hu, "
"src_process_handle=0x%08X",
conversion.src_U.image_size, conversion.src_U.transfer_unit, conversion.src_U.gap,
- cmd_buff[6]);
+ src_process_handle);
}
static void SetSendingV(Interface* self) {
@@ -561,11 +563,10 @@ static void GetAlpha(Interface* self) {
}
static void SetDitheringWeightParams(Interface* self) {
- u32* cmd_buff = Kernel::GetCommandBuffer();
- std::memcpy(&dithering_weight_params, &cmd_buff[1], sizeof(DitheringWeightParams));
-
- cmd_buff[0] = IPC::MakeHeader(0x24, 1, 0);
- cmd_buff[1] = RESULT_SUCCESS.raw;
+ IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x24, 8, 0); // 0x240200
+ rp.PopRaw(dithering_weight_params);
+ IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
+ rb.Push(RESULT_SUCCESS);
LOG_DEBUG(Service_Y2R, "called");
}