mirror of
https://github.com/yuzu-mirror/yuzu
synced 2024-11-27 15:01:24 +00:00
FS/Archive: Remove use of Memory::GetPointer
This commit is contained in:
parent
64068583fb
commit
896e5009ae
1 changed files with 14 additions and 7 deletions
|
@ -108,11 +108,13 @@ ResultVal<bool> File::SyncRequest() {
|
||||||
offset, length, backend->GetSize());
|
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()) {
|
if (read.Failed()) {
|
||||||
cmd_buff[1] = read.Code().raw;
|
cmd_buff[1] = read.Code().raw;
|
||||||
return read.Code();
|
return read.Code();
|
||||||
}
|
}
|
||||||
|
Memory::WriteBlock(address, data.data(), *read);
|
||||||
cmd_buff[2] = static_cast<u32>(*read);
|
cmd_buff[2] = static_cast<u32>(*read);
|
||||||
Memory::RasterizerFlushAndInvalidateRegion(Memory::VirtualToPhysicalAddress(address), length);
|
Memory::RasterizerFlushAndInvalidateRegion(Memory::VirtualToPhysicalAddress(address), length);
|
||||||
break;
|
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",
|
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);
|
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()) {
|
if (written.Failed()) {
|
||||||
cmd_buff[1] = written.Code().raw;
|
cmd_buff[1] = written.Code().raw;
|
||||||
return written.Code();
|
return written.Code();
|
||||||
|
@ -216,12 +220,14 @@ ResultVal<bool> Directory::SyncRequest() {
|
||||||
{
|
{
|
||||||
u32 count = cmd_buff[1];
|
u32 count = cmd_buff[1];
|
||||||
u32 address = cmd_buff[3];
|
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",
|
LOG_TRACE(Service_FS, "Read %s %s: count=%d",
|
||||||
GetTypeName().c_str(), GetName().c_str(), count);
|
GetTypeName().c_str(), GetName().c_str(), count);
|
||||||
|
|
||||||
// Number of entries actually read
|
// 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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,11 +462,12 @@ ResultCode CreateExtSaveData(MediaType media_type, u32 high, u32 low, VAddr icon
|
||||||
if (result.IsError())
|
if (result.IsError())
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
u8* smdh_icon = Memory::GetPointer(icon_buffer);
|
if (!Memory::IsValidVirtualAddress(icon_buffer))
|
||||||
if (!smdh_icon)
|
|
||||||
return ResultCode(-1); // TODO(Subv): Find the right error code
|
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;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue