MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / iopMemSafeReadBytes

Function iopMemSafeReadBytes

pcsx2/IopMem.cpp:491–509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

489}
490
491bool iopMemSafeReadBytes(u32 mem, void* dst, u32 size)
492{
493 // can memcpy so long as pages aren't crossed
494 u8* dptr = static_cast<u8*>(dst);
495 u8* const dptr_end = dptr + size;
496 while (dptr != dptr_end)
497 {
498 const u8* src = iopVirtMemR<u8>(mem);
499 if (!src)
500 return false;
501
502 const u32 remaining_in_page = std::min(0x1000 - (mem & 0xfff), static_cast<u32>(dptr_end - dptr));
503 std::memcpy(dptr, src, remaining_in_page);
504 dptr += remaining_in_page;
505 mem += remaining_in_page;
506 }
507
508 return true;
509}
510
511bool iopMemSafeWriteBytes(u32 mem, const void* src, u32 size)
512{

Callers 3

ReadBytesMethod · 0.85
write_HLEFunction · 0.85
ReadBytesMethod · 0.85

Calls 1

minFunction · 0.50

Tested by

no test coverage detected