mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-23 17:00:57 +01:00
am: Implement IStorageAccessor::Write.
This commit is contained in:
parent
9fedfbe141
commit
2dcb98226b
1 changed files with 17 additions and 1 deletions
|
@ -397,7 +397,7 @@ public:
|
||||||
: ServiceFramework("IStorageAccessor"), buffer(std::move(buffer)) {
|
: ServiceFramework("IStorageAccessor"), buffer(std::move(buffer)) {
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &IStorageAccessor::GetSize, "GetSize"},
|
{0, &IStorageAccessor::GetSize, "GetSize"},
|
||||||
{10, nullptr, "Write"},
|
{10, &IStorageAccessor::Write, "Write"},
|
||||||
{11, &IStorageAccessor::Read, "Read"},
|
{11, &IStorageAccessor::Read, "Read"},
|
||||||
};
|
};
|
||||||
RegisterHandlers(functions);
|
RegisterHandlers(functions);
|
||||||
|
@ -415,6 +415,22 @@ private:
|
||||||
NGLOG_DEBUG(Service_AM, "called");
|
NGLOG_DEBUG(Service_AM, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Write(Kernel::HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
|
||||||
|
const u64 offset{rp.Pop<u64>()};
|
||||||
|
const std::vector<u8> data{ctx.ReadBuffer()};
|
||||||
|
|
||||||
|
ASSERT(offset + data.size() <= buffer.size());
|
||||||
|
|
||||||
|
std::memcpy(&buffer[offset], data.data(), data.size());
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{rp.MakeBuilder(2, 0, 0)};
|
||||||
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
|
NGLOG_DEBUG(Service_AM, "called, offset={}", offset);
|
||||||
|
}
|
||||||
|
|
||||||
void Read(Kernel::HLERequestContext& ctx) {
|
void Read(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue