diff options
| author | 2018-06-03 14:21:45 -0400 | |
|---|---|---|
| committer | 2018-06-03 22:10:06 -0400 | |
| commit | 2dcb98226b6e8222d073d9ee1e247bb116ac1d2c (patch) | |
| tree | 76c2347deb92fab7c2b8c573f6275713369c9bc6 /src | |
| parent | am: Cleanup IStorageAccessor::Read. (diff) | |
| download | yuzu-2dcb98226b6e8222d073d9ee1e247bb116ac1d2c.tar.gz yuzu-2dcb98226b6e8222d073d9ee1e247bb116ac1d2c.tar.xz yuzu-2dcb98226b6e8222d073d9ee1e247bb116ac1d2c.zip | |
am: Implement IStorageAccessor::Write.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/am/am.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 26fd8c933..c47228935 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -397,7 +397,7 @@ public: | |||
| 397 | : ServiceFramework("IStorageAccessor"), buffer(std::move(buffer)) { | 397 | : ServiceFramework("IStorageAccessor"), buffer(std::move(buffer)) { |
| 398 | static const FunctionInfo functions[] = { | 398 | static const FunctionInfo functions[] = { |
| 399 | {0, &IStorageAccessor::GetSize, "GetSize"}, | 399 | {0, &IStorageAccessor::GetSize, "GetSize"}, |
| 400 | {10, nullptr, "Write"}, | 400 | {10, &IStorageAccessor::Write, "Write"}, |
| 401 | {11, &IStorageAccessor::Read, "Read"}, | 401 | {11, &IStorageAccessor::Read, "Read"}, |
| 402 | }; | 402 | }; |
| 403 | RegisterHandlers(functions); | 403 | RegisterHandlers(functions); |
| @@ -415,6 +415,22 @@ private: | |||
| 415 | NGLOG_DEBUG(Service_AM, "called"); | 415 | NGLOG_DEBUG(Service_AM, "called"); |
| 416 | } | 416 | } |
| 417 | 417 | ||
| 418 | void Write(Kernel::HLERequestContext& ctx) { | ||
| 419 | IPC::RequestParser rp{ctx}; | ||
| 420 | |||
| 421 | const u64 offset{rp.Pop<u64>()}; | ||
| 422 | const std::vector<u8> data{ctx.ReadBuffer()}; | ||
| 423 | |||
| 424 | ASSERT(offset + data.size() <= buffer.size()); | ||
| 425 | |||
| 426 | std::memcpy(&buffer[offset], data.data(), data.size()); | ||
| 427 | |||
| 428 | IPC::ResponseBuilder rb{rp.MakeBuilder(2, 0, 0)}; | ||
| 429 | rb.Push(RESULT_SUCCESS); | ||
| 430 | |||
| 431 | NGLOG_DEBUG(Service_AM, "called, offset={}", offset); | ||
| 432 | } | ||
| 433 | |||
| 418 | void Read(Kernel::HLERequestContext& ctx) { | 434 | void Read(Kernel::HLERequestContext& ctx) { |
| 419 | IPC::RequestParser rp{ctx}; | 435 | IPC::RequestParser rp{ctx}; |
| 420 | 436 | ||