Skip to content

RainingChain/Z64LuaHooks

Repository files navigation

Z64 Lua Hooks

This project provides an environment to create hooks and mods for Ocarina of Time 1.0 and Majora's Mask US.

All you need is the Bizhawk emulator and the ROM.

No setup is required. It works right out of the box.

####Features:

  • Read/write address support by id. Ex: Addr.getById("Amount.Bomb").set(10)
  • Actor RAM map. Ex: Actor.new(pointerToBomb).x.set(10)
  • Actor Finder. Ex: Actor.getActorsByType(CST.ACTOR_TYPE.Bomb)[1].timer.set(11)
  • Enum. Ex: CST.ACTOR_TYPE.Bomb == 0x0010
  • Modular Mod support. Ex: See /Mods folder.
  • Event support. Ex: Utils.onButtonPress Utils.setTimeout

####How to use:

  • Open Bizhawk and load the ROM.
  • Open the Lua Console via Tools->Lua Console
  • Open the script main.lua
  • Click to checkbox to apply the mods you want.
  • NOTICE: Always close the Mod Window before closing the Lua Console.

####How to contribute:

  • Extend the Actor RAM map in Actor.lua.
  • Add Enums in Cst.lua.
  • Add new addresses in Addr.wch via Tools->RAM Watch
    • Dungeon map/key/compass/flags.
    • Permanent flags.
  • Create new mods following examples in /Mods.
  • Check TODO.txt

####Mods made so far:

More Mods Video

API

######Utils

static
	string charAt(number pos)		
	void onButtonPress(string id, CST.INPUT input, Function func)
	void onButtonRelease(string id, CST.INPUT input, Function func)
	void onButtonHold(string id, CST.INPUT input, Function func)		
	void clearOnButtonHold(string id, CST.INPUT input)
	void clearOnButtonPress(string id, CST.INPUT input)
	void clearOnButtonRelease(string id, CST.INPUT input)
	Function setTimeout(string id, Function func, number time)
		Call the function returned to prevent the function call
	string readFile(string path)
	string decToHex(number num,[number length)
		Add 0 left padding to match length if provided
	string decToBin(number num,[number length)
		Add 0 left padding to match length if provided
	void onLoop(string id, Function func,number interval)
	void clearOnLoop(string id)
	string getLuaDir()
		Return path to folder containing "main.lua"
	boolean contains(Object list, Any element)
	int	addUI(Form form,CST.UI type,Object prop)
		prop:{x,y,width,height,text,onclick,checked,multiline,fixedWidth}
	void setChecked(checkbox,val)

######Addr

On initialization, every address in `Addr.wch` will create its corresponding Addr accessible via `Addr.getById(id)`.

constructor(number address,Addr.SIZE size,Addr.TYPE type,string id)

instance
	void set(number value)
	number get()
	string toString()

static 
	Addr getById(string id)

######Mod

constructor(string id,string name,Function onActivate,[Function onDeactivate])

instance
	void activate()
	void deactivate()

static 
	Mod getById(string id)
	void activate(string id)
	void deactivate(string id)
	void openMainForm()

######Actor

constructor(number address)
	
static
	int* getActorByCategory(CST.ACTOR_CATEGORY cat)
	int*[] getActorsByCategory(CST.ACTOR_CATEGORY cat)
	int* getActorByType(CST.ACTOR_TYPE type)
	int*[] getActorsByType(CST.ACTOR_TYPE type)
	int* getActorById(number id)
	int*[] getActors()
	boolean isPointerActor(addr)
		return true if addr points to an actor
	Actor getLink()
	
instance
	CST.ACTOR_TYPE type
	string addressHex
	number address
	number id
	Addr x
	Addr y
	Addr z
	Addr next
	Addr prev
	Addr scaleX
	Addr scaleY
	Addr scaleZ
	Object custom
	boolean isLink

About

Lua Bizhawk OoT Zelda Modding

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages