caitsith2
He/Him
Player (47)
Joined: 3/26/2004
Posts: 194
Just did up a TAS for the first D-Pad Hero game. There definitely seems to be unanticipated bugs in this game, that allowed the brute forcing script to run faster than expected, without the game counting button press errors. http://caitsith2.com/tas/dpadhero.zip The following code was run, only during the song. Once the song was completed, the script was stopped. It only had to be run four times.
-- D-Pad Hero game play lua bot
-- created by CaitSith2.

-- Just a simple bruteforce every input possible.  A & B are never pushed at the same time
-- in the music chart,  so, we alternate between Just A,  A + directionals, 
-- Just B, B + directionals, and nothing.
-- If button pressed increments the error count, then we reload, otherwise we keep it.
-- I was expecting this TAS to take much longer to complete, but because of 
-- game programming errors, it went a little faster, as it accepted more input. :)


local buttons = {  }
local temp = savestate.create(5)
savestate.save(temp)



local health=0
local loop=0

--start movie recording to random filename, set speed to maximum
FCEU.speedmode("nothrottle")

while true do
    health = memory.readbyte(0x005D) + memory.readbyte(0x0059)
    if health ~= 0 then
        savestate.load(temp)
    else
        savestate.save(temp)
    end
    
    loop = loop + 1
    if loop > 10 then loop = 0 end
    if (joypad.read(2).up) then loop = 0 end
    if loop == 0 then
        buttons.A = nil
        buttons.B = nil
        buttons.left = nil
        buttons.right = nil
        buttons.up = nil
        buttons.down = nil
    elseif loop == 1 then
        buttons.A = 1
    elseif loop == 2 then
        buttons.left = 1
    elseif loop == 3 then
        buttons.left = nil
        buttons.right = 1
    elseif loop == 4 then
        buttons.right = nil
        buttons.up = 1
    elseif loop == 5 then
        buttons.up = nil
        buttons.down = 1
    elseif loop == 6 then
        buttons.A = nil
        buttons.down = nil
        buttons.B = 1
    elseif loop == 7 then
        buttons.left = 1
    elseif loop == 8 then
        buttons.left = nil
        buttons.right = 1
    elseif loop == 9 then
        buttons.right = nil
        buttons.up = 1
    elseif loop == 10 then
        buttons.up = nil
        buttons.down = 1
    end

    joypad.set(1, buttons)
    FCEU.frameadvance()
end
Skilled player (1886)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
I made a script here that doesn't brute force anything, but instead uses RAM addresses to know when to press a button. This means that no savestating is required. You might want to take a look at it.