improve pcsx force overlay script to load playable stages

This commit is contained in:
fatalis 2023-10-01 14:32:56 -05:00
parent 1cabff5c93
commit e6d53f2826

View File

@ -1,27 +1,36 @@
jit.off()
-- local overlay = 's19br'
-- local overlay = 'abst'
-- local overlay = 'brf'
-- local overlay = 'camera'
local overlay = 'change'
-- local overlay = 'd00a'
-- local overlay = 'd01a'
-- local overlay = 'd03a'
-- local overlay = 'd11c'
-- local overlay = 'd16e'
-- local overlay = 'd18a'
-- local overlay = 'd18ar'
-- local overlay = 'demosel'
-- local overlay = 'abst' -- load save from memcard
-- local overlay = 'brf' -- briefing
-- local overlay = 'camera' -- load jpeg from memcard
-- local overlay = 'change' -- disc change
-- local overlay = 'demosel' -- demo theater
-- local overlay = 'ending'
-- local overlay = 'endingr'
-- local overlay = 'opening'
-- local overlay = 'option'
-- local overlay = 'preope'
-- local overlay = 'rank'
-- local overlay = 'roll'
-- local overlay = 's00a'
-- local overlay = 's01a'
-- local overlay = 'opening' -- intro 'fmv'
-- local overlay = 'option' -- options
-- local overlay = 'preope' -- previous operations
-- local overlay = 'rank' -- end game rank
-- local overlay = 'roll' -- credits
-- local overlay = 'select' -- debug menu
-- local overlay = 'select1' -- debug menu stage select
-- local overlay = 'select2' -- debug menu stage select S05A-S09A
-- local overlay = 'select3' -- debug menu stage select S10A-S14E1
-- local overlay = 'select4' -- debug menu stage select S15A-S20A
-- local overlay = 'selectd' -- debug menu demo select
-- local overlay = 'sound' -- debug menu sound test
-- local overlay = 'title' -- konami logo and title screen
-- local overlay = 'd00a' -- docks cutscene
-- local overlay = 'd01a' -- helipad cutscene
-- local overlay = 'd03a' -- "s003c0.dmo"
-- local overlay = 'd11c' -- elevator cutscene
-- local overlay = 'd16e' -- rex cutscene
-- local overlay = 'd18a' -- end tunnel cutscene?
-- local overlay = 'd18ar' -- same as above? otacon/meryl versions?
-- local overlay = 's00a' -- docks
-- local overlay = 's01a' -- heliport
-- local overlay = 's02a'
-- local overlay = 's02b'
-- local overlay = 's02c'
@ -72,7 +81,7 @@ local overlay = 'change'
-- local overlay = 's15b'
-- local overlay = 's15c'
-- local overlay = 's16a'
-- local overlay = 's16b'
local overlay = 's16b' -- smallest playable stage
-- local overlay = 's16c'
-- local overlay = 's16d'
-- local overlay = 's17a'
@ -85,27 +94,45 @@ local overlay = 'change'
-- local overlay = 's19br'
-- local overlay = 's20a'
-- local overlay = 's20ar'
-- local overlay = 'select'
-- local overlay = 'select1'
-- local overlay = 'select2'
-- local overlay = 'select3'
-- local overlay = 'select4'
-- local overlay = 'selectd'
-- local overlay = 'sound'
-- local overlay = 'title'
local mem = PCSX.getMemPtr()
local function u8(addr)
addr = bit.band(addr, 0x1fffff)
local ptr = ffi.cast('uint8_t*', mem + addr)
return ptr[0]
end
local function c_str(addr)
local str = ''
if str_ptr ~= 0 then
local i = 0
repeat
local byte = u8(addr + i)
if byte ~= 0 then
str = str .. string.char(byte)
end
i = i + 1
until byte == 0
end
return str
end
if loader_bp == nil then
loader_bp = PCSX.addBreakpoint(0x800236E0, 'Exec', 4, 'loader', function()
loader_bp = PCSX.addBreakpoint(0x8002E460, 'Exec', 4, 'loader', function()
local regs = PCSX.getRegisters()
local addr = bit.band(regs.GPR.n.a0, 0x1fffff)
local mem = PCSX.getMemPtr()
local ptr = ffi.cast('uint8_t*', mem + addr)
local i = 0
for c in overlay:gmatch('.') do
ptr[i] = string.byte(c)
i = i + 1
local name = c_str(regs.GPR.n.a0)
if name == 'title' then
local ptr = ffi.cast('uint8_t*', mem + addr)
local i = 0
for c in overlay:gmatch('.') do
ptr[i] = string.byte(c)
i = i + 1
end
ptr[i] = 0
print('forcing load of overlay:', overlay)
end
ptr[i] = 0
print('forcing load of overlay:', overlay)
end)
end