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

Method writeMemoryToRAM

Source/MemoryWatch/MemWatchEntry.cpp:345–388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

343}
344
345Common::MemOperationReturnCode MemWatchEntry::writeMemoryToRAM(const char* memory,
346 const size_t size)
347{
348 u32 realConsoleAddress = m_consoleAddress;
349 if (m_boundToPointer)
350 {
351 std::array<char, sizeof(u32)> realConsoleAddressBuffer{};
352 for (int offset : m_pointerOffsets)
353 {
354 if (DolphinComm::DolphinAccessor::readFromRAM(
355 Common::dolphinAddrToOffset(realConsoleAddress,
356 DolphinComm::DolphinAccessor::isARAMAccessible()),
357 realConsoleAddressBuffer.data(), sizeof(u32), true))
358 {
359 std::memcpy(&realConsoleAddress, realConsoleAddressBuffer.data(), sizeof(u32));
360 if (DolphinComm::DolphinAccessor::isValidConsoleAddress(realConsoleAddress))
361 {
362 realConsoleAddress += offset;
363 }
364 else
365 {
366 m_isValidPointer = false;
367 return Common::MemOperationReturnCode::invalidPointer;
368 }
369 }
370 else
371 {
372 return Common::MemOperationReturnCode::operationFailed;
373 }
374 }
375 // Resolve sucessful
376 m_isValidPointer = true;
377 }
378
379 if (!DolphinComm::DolphinAccessor::isValidConsoleAddress(realConsoleAddress))
380 return Common::MemOperationReturnCode::OK;
381
382 if (DolphinComm::DolphinAccessor::writeToRAM(
383 Common::dolphinAddrToOffset(realConsoleAddress,
384 DolphinComm::DolphinAccessor::isARAMAccessible()),
385 memory, size, shouldBeBSwappedForType(m_type)))
386 return Common::MemOperationReturnCode::OK;
387 return Common::MemOperationReturnCode::operationFailed;
388}
389
390std::string MemWatchEntry::getStringFromMemory() const
391{

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected