User File #20045914721864875

Upload All User Files

#20045914721864875 - Punch Hopping Macros

GBARaymanHoodlumsRevengeMacros.lua
1103 downloads
Uploaded 1/11/2015 6:07 PM by DaJaWi (see all 16)
BizHawk Macros for the Punch Hopping trick in Rayman: Hoodlums' Revenge for the GBA.
Hold J, K or L and your desired direction and press the frame advance key. Can work around all lag except on the first frame (wait one frame first in those cases).
  • J: Hop and punch next frame (gives speed and height)
  • K: Just punch (best for speed but loses height)
  • L: Hop, wait, and then punch (loses speed, but allows for sharp turning)
Even if you don't care about carefully optimising this game, it's a lot of fun to run this script, hold J and the frame advance key, and fly haphazardly around the level. Try it!
-- GBA Rayman: Hoodlums' Revenge
--
-- Macros for the actions used while punch hopping.
-- Hold J, K or L and your desired direction and press the frame advance key.
-- Can work around all lag except on the first frame (wait one frame first in those cases).
--
-- J: Hop and punch next frame (gives speed and height)
-- K: Just punch (best for speed but loses height)
-- L: Hop, wait, and then punch (loses speed, but allows for sharp turning)
--
-- Author: DaJaWi
-- 11th Jan 2015

local function punchhop(hop, wait)
  client.unpause()
  
  -- Get current direction
  local inp = input.get()
  local pad = {Left = inp.Left, Right = inp.Right, Up = inp.Up, Down = inp.Down}
  
  -- Keep track of lag frames
  memory.usememorydomain("EWRAM")
  local startframe = memory.read_u32_le(0x000770)
  local framecount = 0
  
  -- Hop (if J or L)
  if hop then
    pad["A"] = true
    repeat
      joypad.set(pad)
      emu.frameadvance()
      local currentframe = memory.read_u32_le(0x000770)
    until currentframe >= startframe + 1 or currentframe < startframe
    pad["A"] = false
    framecount = framecount + 1
  end
  
  -- Wait (if L)
  if wait then
    repeat
      joypad.set(pad)
      emu.frameadvance()
      local currentframe = memory.read_u32_le(0x000770)
    until currentframe >= startframe + framecount + wait or currentframe < startframe
    framecount = framecount + wait
  end
  
  -- Punch
  pad["B"] = true
  repeat
    joypad.set(pad)
    emu.frameadvance()
    local currentframe = memory.read_u32_le(0x000770)
  until currentframe >= startframe + framecount + 1 or currentframe < startframe
  pad["B"] = false
  framecount = framecount + 1
  
  -- Continue until next critical frame
  repeat
    joypad.set(pad)
    emu.frameadvance()
    local currentframe = memory.read_u32_le(0x000770)
  until currentframe >= startframe + framecount + 16 or currentframe < startframe
  
  client.pause()
end

local function checkinput()
  local inp = input.get()
  if inp.J then
    -- Hop and punch next frame (gives speed and height)
    punchhop(true)
  end
  if inp.K then
    -- Just punch (best for speed but loses height)
    punchhop(false)
  end
  if inp.L then
    -- Hop, wait, and then punch (loses speed, but allows for sharp turning)
    punchhop(true, 10)
  end
end

while true do
  checkinput()
  emu.frameadvance()
end