Created
December 12, 2021 21:42
-
-
Save Nisto/1c95042eca01df5af7b620ab35f0a09d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- [!] assumes following version of pcsx2-dev is used: | |
-- https://github.com/PCSX2/pcsx2/tree/c16db05e0c3a5806fad1fd571141284facc7b421 | |
-- [!] assumes breakpoint exists at: | |
-- pcsx2-dev.dmaSIF1+603 | |
outputfile = assert(io.open("X:/output.file", "wb")) | |
outputsize = 0 | |
outputwant = 0x35A000 -- from header @ 0x14 | |
function DumpMemToFile(file, addr, size) | |
local data_table = readBytes(addr, size, true) | |
local data_string = byteTableToString(data_table) | |
file:write(data_string) | |
return string.len(data_string) | |
end | |
MEMCPY_ADDR = getAddress("VCRUNTIME140.memcpy") | |
function debugger_onBreakpoint() | |
if EIP == MEMCPY_ADDR then | |
local dest = readInteger(ESP+0x4) | |
-- 24xxxxxx is the base for IOP RAM in PCSX2 process | |
-- 0x10BD00-0x1A7D00 (size 0x9C000) contains "PK3" data | |
if (dest >= 0x2410BD00) and (dest < 0x241A7D00) then | |
local src = readInteger(ESP+0x8) | |
local count = readInteger(ESP+0xC) | |
outputsize = outputsize + DumpMemToFile(outputfile, src, count) | |
if (outputsize >= outputwant) then | |
if (outputfile ~= nil) then | |
outputfile.close() | |
outputfile = nil | |
return 0 -- stop | |
end | |
end | |
end | |
end | |
return 1 -- continue | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment