1
0
Fork 0
mirror of https://github.com/notwa/mm synced 2024-11-05 05:39:02 -08:00
mm/Lua/README.md

218 lines
6.1 KiB
Markdown
Raw Normal View History

2015-12-16 02:53:31 -08:00
# Zelda 64 Lua Scripts
These are written for
[the latest revision of Bizhawk,][biz]
but some compatiblity is provided for
[a fork of mupen64plus with Lua support.][m64p-lua]
[biz]: https://github.com/TASVideos/bizhawk/
[m64p-lua]: https://github.com/notwa/mupen64plus-core
Note that some scripts lack full support for Ocarina of Time.
2015-12-16 03:19:34 -08:00
## Scripts
2015-12-16 02:53:31 -08:00
2015-12-28 22:04:39 -08:00
#### actor lister.lua
2015-12-16 02:53:31 -08:00
Lists actor data onscreen,
and focuses the camera on them.
Actors may be selected using the D-Pad.
2015-12-16 03:19:34 -08:00
#### cheat menu.lua
2015-12-16 02:53:31 -08:00
Provides an onscreen UI for many features.
Has four different input methods;
refer to the comment near the start of the script.
Generally, it's opened with L and navigated with the D-Pad.
2015-12-16 03:19:34 -08:00
#### count flags.lua
2015-12-16 02:53:31 -08:00
Simply counts the number of scene flags globally set.
2015-12-16 03:19:34 -08:00
#### exit calculator.lua
2015-12-16 02:53:31 -08:00
Dumps information on the current exit value;
scene name, entrance, entrance with unused offset;
using human-readable English names.
Provides the function `dump_all_exits(fn)`
which produces [a large csv file.][csv]
[csv]: https://eaguru.guru/t/_exits.csv
2015-12-16 03:19:34 -08:00
#### movement tests.lua
2015-12-16 02:53:31 -08:00
Tests the fastest form of basic movement in Majora's Mask.
Run it in the Clock Town Great Fairy's Fountain.
#### inject.lua
Assembles and injects an assembly subroutine into the game.
2015-12-16 03:19:34 -08:00
#### oneshot.lua
2015-12-16 02:53:31 -08:00
Instantly gives you all the items in the game, etc.
Does not set scene/event flags,
except the one required for the Great Spin Attack.
2015-12-16 03:19:34 -08:00
#### race.lua
2015-12-16 02:53:31 -08:00
Sets up a race file.
A race file is a save in which the first cycle has been completed,
the Deku Mask has been acquired,
and some other details.
2015-12-16 03:19:34 -08:00
#### room debug.lua
2015-12-16 02:53:31 -08:00
Parses and dumps the currently loaded room headers.
2015-12-17 16:08:33 -08:00
#### m64p entry.lua
Ignore this for now.
This is a rough interfacing script for passing to mupen64plus,
and serves no purpose on Bizhawk.
2015-12-16 03:19:34 -08:00
### Monitors
2015-12-16 02:53:31 -08:00
These scripts look for changes in RAM regions and print them in detail.
These are mostly used for documenation.
2015-12-28 22:04:39 -08:00
#### epona monitor.lua
used to investigate [this glitch with unloading Epona.][eponaglitch]
[eponaglitch]: https://www.youtube.com/watch?v=kX0ZcIS8P84
2015-12-16 03:19:34 -08:00
#### event flag monitor.lua
2015-12-16 02:53:31 -08:00
Monitors event flags,
and announces which bits are being changed,
and if they have ever been seen changing before.
2015-12-16 03:19:34 -08:00
#### scene flag monitor.lua
2015-12-16 02:53:31 -08:00
Monitors the current scene's flags,
and announces which bits are being changed,
and if they have ever been seen changing before.
2015-12-16 03:19:34 -08:00
#### misc monitor.lua
2015-12-16 02:53:31 -08:00
Monitors unknown regions of memory.
Currently, this region is a chunk of save data, ignoring known addresses.
2015-12-16 03:19:34 -08:00
#### oot memory editor monitor.lua
2015-12-16 02:53:31 -08:00
(Ocarina of Time) Used for determining which values
listed by the in-game debug memory editor are constant.
2015-12-16 03:19:34 -08:00
#### watch animations.lua
2015-12-16 02:53:31 -08:00
Monitors Link's used animations.
## Libraries
Or rather, scripts that have no functionality on their own.
2015-12-16 03:19:34 -08:00
#### depend.lua
2015-12-16 02:53:31 -08:00
Meant to override Lua's native `require` function,
to force reloading of the given script.
This is useless outside of development.
In fact, this could cause bugs in code that depends on
`require` yielding the same tables twice.
2015-12-16 03:19:34 -08:00
#### boilerplate.lua
2015-12-16 02:53:31 -08:00
Provides common functions used in the majority of scripts.
This should generally be imported before any other scripts, besides depend.lua.
2015-12-16 03:19:34 -08:00
#### addrs/init.lua
2015-12-16 02:53:31 -08:00
Using boilerplate.lua's functions,
this provides the bulk of the interface to the games.
Note that this particular initialization script populates the global namespace
with `version`, `oot`, `mm`, and most importantly `addrs`.
2015-12-16 03:19:34 -08:00
#### addrs/basics.lua
2015-12-16 02:53:31 -08:00
Returns a table of tables of offsetable common addresses
between every known version of OoT and MM.
**table keys:**
* **link:** the bulk of the player's state in the game;
not to be confused with Link's actor.
most of this is saved to SRAM.
* **global:** global context.
this is passed as an argument to many functions in the game's code
and contains a wealth of miscellaneous game state information.
this is actually allocated on heap, but its address never changes
— except on the file select screen?
* **actor:** Link's actor.
this includes position, rotation, animation status, etc.
Link's actor is the only actor that
has the same address consistently,
as it's always the first one loaded.
2015-12-16 03:19:34 -08:00
#### addrs/versions.lua
2015-12-16 02:53:31 -08:00
Returns a dictionary of md5 and sha1 hashes
of every known version of OoT and MM.
The format of version strings is
`(O|M) (US|JP|EU)(1[0-9]|GC|DE|DB)( MQ)?`,
where:
* O: Ocarina of Time
* M: Majora's Mask
* US: American NTSC (United States)
* JP: Japanese NTSC
* EU: European PAL
* [two digits]: version number of a release build for the N64
* GC: Gamecube
* DE: Demo (includes Debug features)
* DE: Debug
* MQ: Master Quest
2015-12-16 03:19:34 -08:00
#### pt.lua
2015-12-16 02:53:31 -08:00
Dumps Lua tables as pseudo-yaml,
complete with references to prevent recursion.
Invaluable for debugging.
[Its repository is on gist][pt] — look there for basic usage.
[pt]: https://gist.github.com/notwa/13fbddf05f654ba48321
2015-12-16 03:19:34 -08:00
#### extra.lua
2015-12-16 02:53:31 -08:00
Implements the `opairs` iterator function
and its helper functions,
providing iteration by sorted keys in alphabetical order.
2015-12-16 03:19:34 -08:00
#### serialize.lua
2015-12-16 02:53:31 -08:00
Serializes (saves, dumps) Lua tables for later deserialization (loading).
unlike `pt`, this dumps as Lua and cannot handle complicated (recursive) tables.
2015-12-16 03:19:34 -08:00
#### messages.lua
2015-12-16 02:53:31 -08:00
Provides functions for printing onscreen,
such as printing for a given number of game frames.
Also provides deferred printing,
to print to console all at once at the end of a frame,
which works around printing being otherwise slow on Bizhawk.
2015-12-16 03:19:34 -08:00
#### flag manager.lua
2015-12-16 02:53:31 -08:00
Provides basic functions for poking at event flags and scene flags.
2015-12-16 03:19:34 -08:00
#### classes.lua
2015-12-16 02:53:31 -08:00
For lazy people.
Populate the global namespace with all available classes,
excluding menu/interface classes.
2015-12-16 03:19:34 -08:00
#### menu classes.lua
2015-12-16 02:53:31 -08:00
Provides various classes for implementing onscreen menus.
2015-12-16 03:19:34 -08:00
#### menu input handlers.lua
2015-12-16 02:53:31 -08:00
Provides classes for interfacing user inputs with menus.
2015-12-16 03:19:34 -08:00
#### menus/\*
2015-12-16 02:53:31 -08:00
Contains various submenus for `cheat menu.lua`.
2015-12-16 03:19:34 -08:00
#### classes/\*
2015-12-16 02:53:31 -08:00
Contains various classes.
Note that the base `Class` function is defined in `boilerplate.lua`.
## Data
Any data (that isn't provided by the games themselves)
is located in the data directory.
Much of this should be self-explanitory. However,
files beginning with an underscores contain serialized tables
(generally from monitor scripts)
and usually won't make sense out of context.