Gens version of this.
local addr_drift = 0xFF6FFA
local bad_drift = 0xA0
local addr_distance = 0xFF6FDC
local target_distance = 0x09E340
local addr_score_timer = 0xFF7139
local driving = true
local press_start = false
local function is_drift_bad()
if memory.readbyte(addr_drift) > bad_drift then
return true
end
return false
end
local function reached_target()
if memory.readdwordunsigned(addr_distance) == target_distance then
driving = false
end
end
local function start_next_trip()
if memory.readbyte(addr_score_timer) == 1 then
joypad.set({start=true})
press_start = true
end
if press_start and memory.readbyte(addr_score_timer) == 0 then
joypad.set({start=true})
driving = true
press_start = false
end
end
while true do
if driving then
if is_drift_bad() then
joypad.set({A=true, left=true})
else
joypad.set({A=true, left=false})
end
reached_target()
else
start_next_trip()
end
gens.frameadvance()
end