summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMerryMage <MerryMage@users.noreply.github.com>2016-04-16 13:49:35 +0200
committerSubv <subv2112@gmail.com>2016-05-28 20:44:44 +0200
commit896e5009aeec0603ee3dd77e34462a503253b75f (patch)
tree5f86ff47ae7088a9a8ef979f93d33443bda9ea8e
parentCFG: Remove use of Memory::GetPointer (diff)
downloadyuzu-896e5009aeec0603ee3dd77e34462a503253b75f.tar
yuzu-896e5009aeec0603ee3dd77e34462a503253b75f.tar.gz
yuzu-896e5009aeec0603ee3dd77e34462a503253b75f.tar.bz2
yuzu-896e5009aeec0603ee3dd77e34462a503253b75f.tar.lz
yuzu-896e5009aeec0603ee3dd77e34462a503253b75f.tar.xz
yuzu-896e5009aeec0603ee3dd77e34462a503253b75f.tar.zst
yuzu-896e5009aeec0603ee3dd77e34462a503253b75f.zip
-rw-r--r--src/core/hle/service/fs/archive.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp
index cc51ede0c..a7ebfde25 100644
--- a/src/core/hle/service/fs/archive.cpp
+++ b/src/core/hle/service/fs/archive.cpp
@@ -108,11 +108,13 @@ ResultVal<bool> File::SyncRequest() {
offset, length, backend->GetSize());
}
- ResultVal<size_t> read = backend->Read(offset, length, Memory::GetPointer(address));
+ std::vector<u8> data(length);
+ ResultVal<size_t> read = backend->Read(offset, data.size(), data.data());
if (read.Failed()) {
cmd_buff[1] = read.Code().raw;
return read.Code();
}
+ Memory::WriteBlock(address, data.data(), *read);
cmd_buff[2] = static_cast<u32>(*read);
Memory::RasterizerFlushAndInvalidateRegion(Memory::VirtualToPhysicalAddress(address), length);
break;
@@ -128,7 +130,9 @@ ResultVal<bool> File::SyncRequest() {
LOG_TRACE(Service_FS, "Write %s %s: offset=0x%llx length=%d address=0x%x, flush=0x%x",
GetTypeName().c_str(), GetName().c_str(), offset, length, address, flush);
- ResultVal<size_t> written = backend->Write(offset, length, flush != 0, Memory::GetPointer(address));
+ std::vector<u8> data(length);
+ Memory::ReadBlock(address, data.data(), data.size());
+ ResultVal<size_t> written = backend->Write(offset, data.size(), flush != 0, data.data());
if (written.Failed()) {
cmd_buff[1] = written.Code().raw;
return written.Code();
@@ -216,12 +220,14 @@ ResultVal<bool> Directory::SyncRequest() {
{
u32 count = cmd_buff[1];
u32 address = cmd_buff[3];
- auto entries = reinterpret_cast<FileSys::Entry*>(Memory::GetPointer(address));
+ std::vector<FileSys::Entry> entries(count);
LOG_TRACE(Service_FS, "Read %s %s: count=%d",
GetTypeName().c_str(), GetName().c_str(), count);
// Number of entries actually read
- cmd_buff[2] = backend->Read(count, entries);
+ u32 read = backend->Read(entries.size(), entries.data());
+ cmd_buff[2] = read;
+ Memory::WriteBlock(address, entries.data(), read * sizeof(FileSys::Entry));
break;
}
@@ -456,11 +462,12 @@ ResultCode CreateExtSaveData(MediaType media_type, u32 high, u32 low, VAddr icon
if (result.IsError())
return result;
- u8* smdh_icon = Memory::GetPointer(icon_buffer);
- if (!smdh_icon)
+ if (!Memory::IsValidVirtualAddress(icon_buffer))
return ResultCode(-1); // TODO(Subv): Find the right error code
- ext_savedata->WriteIcon(path, smdh_icon, icon_size);
+ std::vector<u8> smdh_icon(icon_size);
+ Memory::ReadBlock(icon_buffer, smdh_icon.data(), smdh_icon.size());
+ ext_savedata->WriteIcon(path, smdh_icon.data(), smdh_icon.size());
return RESULT_SUCCESS;
}