As observed in the above posts, emulating the DPCM glitch makes this series an extra hassle to TAS with NesHawk, but if for any reason somebody wanted to sync FCEUX input then the below script can help. Import .fm2, load TAStudio (remember to delete a frame before the first start press).
All it does is mark a "lag frame" in TAStudio when DMC interferes with input; desyncs can usually be dealt with by either adding extra button presses that don't change movement (e.g. add an L if holding R) one or more frames earlier or adjusting jumps or slashes by a frame or two.
Download NG_NEShawkFM2sync.luaLanguage: lua
local dpcmBool, dpcmed, whichNG = false, 0, memory.readbyte(0, "PRG ROM")
if whichNG == 40 then dpcmed = 0xF9DC
elseif whichNG == 16 then dpcmed = 0xD602
elseif whichNG == 53 then dpcmed = 0xC791
end
if dpcmed ~= 0 then
event.onmemoryexecute(function() dpcmBool = true end, dpcmed)
end
while true do
emu.frameadvance()
if dpcmBool then
dpcmBool = false
tastudio.setlag(emu.framecount(), true)
end
end
Here's another dumb thing, though I did actually use it to play back WIPs in Mesen and NesHawk for some audio/visual aesthetic judgements (to questionable utility).
Purpose: play fm2 and save a hacked ROM that will do nothing but play back the input.
Download NG2_TAStoDemoROM_FCEUX.luaLanguage: lua
local rb = memory.readbyte
local wb = rom.writebyte
local count, inps, cnts = 0, {}, {}
local nmihack = {198,116,208,25,162,0,160,9,169,7,141,0,128,140,1,128,32,197,251,133,18,69,20,37,18,133,19,132,20,
6,45,165,37,9,6,170,142,0,128,165,29,141,1,128,232,142,0,128,165,30,141,1,128,6,45,176,230}
local inihack = {160,133,118,169,176,133,120,230,116,169,4,32,0,192,76,63,226,161,117,133,116,161,119,168,230,
117,208,2,230,118,230,119,208,2,230,120,96}
local add1, add2, add3, add4 = 0x12010-1, 0x13010-1, 0x1D5E6-1, 0x1FBC4-1
local function WriteROM()
emu.pause()
movie.stop()
memory.registerexec(0xD5FE, nil)
print(string.format("0x%X",#cnts))
if #cnts < 0x1000 then
for i = 1, 0x1000-#cnts do
cnts[#cnts+1] = 0xff
inps[#inps+1] = 0x00
end
end
for i = 1, #cnts do wb(add1+i, cnts[i]) end
for i = 1, #inps do wb(add2+i, inps[i]) end
for i = 1, #nmihack do wb(add3+i, nmihack[i]) end
for i = 1, #inihack do wb(add4+i, inihack[i]) end
print"Debug-> Hex Editor...-> File-> Save Rom As..."
end
local function DumpInput()
local inp, inpre, full = rb(0x12), rb(0x14)
local function conc()
cnts[#cnts+1] = count
inps[#inps+1] = inpre
if #cnts == 0x1000 then print"space full"; full = true end
count = 1
end
if inp == inpre then
if count == 255 then conc()
else count = count + 1 end
else conc() end
if emu.framecount() == movie.length()+1 or full then WriteROM() end
end
memory.registerexec(0xD5FE, DumpInput)