MCPcopy Create free account
hub / github.com/aldelaro5/dolphin-memory-engine / readMemoryFromRAM

Method readMemoryFromRAM

Source/MemoryWatch/MemWatchEntry.cpp:301–343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

299}
300
301Common::MemOperationReturnCode MemWatchEntry::readMemoryFromRAM()
302{
303 u32 realConsoleAddress = m_consoleAddress;
304 if (m_boundToPointer)
305 {
306 std::array<char, sizeof(u32)> realConsoleAddressBuffer{};
307 for (int offset : m_pointerOffsets)
308 {
309 if (DolphinComm::DolphinAccessor::readFromRAM(
310 Common::dolphinAddrToOffset(realConsoleAddress,
311 DolphinComm::DolphinAccessor::isARAMAccessible()),
312 realConsoleAddressBuffer.data(), sizeof(u32), true))
313 {
314 std::memcpy(&realConsoleAddress, realConsoleAddressBuffer.data(), sizeof(u32));
315 if (DolphinComm::DolphinAccessor::isValidConsoleAddress(realConsoleAddress))
316 {
317 realConsoleAddress += offset;
318 }
319 else
320 {
321 m_isValidPointer = false;
322 return Common::MemOperationReturnCode::invalidPointer;
323 }
324 }
325 else
326 {
327 return Common::MemOperationReturnCode::operationFailed;
328 }
329 }
330 // Resolve sucessful
331 m_isValidPointer = true;
332 }
333
334 if (!DolphinComm::DolphinAccessor::isValidConsoleAddress(realConsoleAddress))
335 return Common::MemOperationReturnCode::OK;
336
337 if (DolphinComm::DolphinAccessor::readFromRAM(
338 Common::dolphinAddrToOffset(realConsoleAddress,
339 DolphinComm::DolphinAccessor::isARAMAccessible()),
340 m_memory, getSizeForType(m_type, m_length), shouldBeBSwappedForType(m_type)))
341 return Common::MemOperationReturnCode::OK;
342 return Common::MemOperationReturnCode::operationFailed;
343}
344
345Common::MemOperationReturnCode MemWatchEntry::writeMemoryToRAM(const char* memory,
346 const size_t size)

Callers 2

updatePreviewMethod · 0.80

Calls 5

readFromRAMFunction · 0.85
dolphinAddrToOffsetFunction · 0.85
getSizeForTypeFunction · 0.85
shouldBeBSwappedForTypeFunction · 0.85
dataMethod · 0.45

Tested by

no test coverage detected