From 727c74e6aad300e36f99a37e4f1ae41bf8e5bfff Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Wed, 22 Jul 2015 23:00:27 -0700 Subject: [PATCH] rough exit calculator, scene/entrance names --- Lua/data/entrance names.lua | 906 ++++++++++++++++++++++++++++++++++++ Lua/data/scene names.lua | 131 ++++++ Lua/exit calculator.lua | 79 ++++ 3 files changed, 1116 insertions(+) create mode 100644 Lua/data/entrance names.lua create mode 100644 Lua/data/scene names.lua create mode 100644 Lua/exit calculator.lua diff --git a/Lua/data/entrance names.lua b/Lua/data/entrance names.lua new file mode 100644 index 0000000..162cf4e --- /dev/null +++ b/Lua/data/entrance names.lua @@ -0,0 +1,906 @@ +-- same order as scene names.lua +return { + [0]= + {[0]= + "from road", + "from tourists'", + "from woodfall", + "from deku palace", + "from deku palace (above)", + "from hags'", + "boat cruise", + "from woods of mystery", + "from spider house", + "from ikana", + "from owl", + "from road (no cutscene)", + }, + + {}, + + {}, + + {}, + + {}, + + {}, + + {}, + + {[0]= + "gossip stones", + "gossip stones (skultula)", + "gossip stones (more)", + "friggen gossip stones man", + "generic grotto (5 rupees)", + "hot spring water", + "JP grotto (straight) (A)", + "dodongo", + "JP grotto (vines) A", + "box grotto?", + "cows", + "bio deku baba", + "bean seller", + "pea hat", + "JP grotto (straight) (B)", + "JP grotto (vines) (B)", + "lens of truth", + "more damn gossips", + }, + + {[0]= + "from start file", + "skull kid cutscene", + "(crash?)", + "(crash?)", + "(crash?)", + "(crash?)", + "(crash?)", + "(crash?)", + "(crash?)", + "(crash?)", + }, + + {}, + + {[0]= + "main door", + }, + + {[0]= + "from moon", + "[same]", + }, + + {[0]= + "rupees", + "to song of storms", + }, + + {[0]= + "main door", + "kafei's room", + "peeking into shop", + "after peeking", + }, + + {}, + + {}, + + {[0]= + "barn", + "mama's house", + }, + + {[0]= + "main door", + "[same]", + }, + + {[0]= + "main door", + "mayor's room", + "(crash)", + }, + + {[0]= + "from road", + "from spirit house", + "from house", + "from stone tower", + "from owl", + "from beneath the well", + "from sakon's hideout", + "after beating temple", + "from castle", + "gibdo cutscene", + "sharp's cave (cutscene)", + "from fairy's fountain", + "from secret shrine", + "from sharp's cave", + "sharp's cave", + "from road?", + }, + + {[0]= + "main door", + "from hookshot room", + "from above hookshot room", + "from 100 rupee room", + "egg room 1", + "from cannon(?) room", + "from egg room 3", + "from tall walls(?) room", + "from egg room 2", + "from nowhere (unused?)", + "through telescope", + "from nowhere (press start screen?)", + "from far outside", + "from main door (no cutscene)", + "(crash)", + }, + + {[0]= + "main door", + "[same]", + }, + + {[0]= + "main door", + "main door (no cutscene)", + }, + + {[0]= + "main door", + "after beating minigame", + }, + + {[0]= + "main door", + "to boss room", + "(crash)", + }, + + {[0]= + "main door", + "from ocarina cutscene", + "(crash?)", + }, + + {[0]= + "main door", + "from clock tower (unused)", + "after being turned into deku", + "after voiding out?", + "part of SoT cutscene", + "main door (no cutscene) (unused)", + }, + + {[0]= + "main door", + "deku princess after odolwa", + "deku princess room", + "main door with wrong room loaded (unused?)", + }, + + {[0]= + "from termina field", + "from mountain village", + }, + + {[0]= + "from beneath the well", + "from ikana canyon", + "from castle main door", + "inside castle main door", + "from above, inbetween redeads", + "from above, floormaster", + "from boss room", + "from beneath the well (again)", + }, + + {[0]= + "from clock town", + "after beating minigame", + "(crash)", + "from clock town (again)", + }, + + {[0]= + "main door", + "[same]", + }, + + {[0]= + "main door", + "[same]", + }, + + {[0]= + "main door", + "[same]", + }, + + {[0]= + "from termina field", + "from romani's ranch", + "from gorman track behind fence", + "from gorman track", + "from owl", + "from romani's ranch facing the wrong way", + "from gorman track facing the wrong way", + "from termina field (again)", + }, + + {[0]= + "hookshot room", + "hookshot room from above", + "100 rupee room", + "egg room 1?", + "cannon(?) room", + "egg room 2?", + "tall walls(?) room", + "egg room 3?", + "after telescope", + "from outside, underwater", + "from outside, near telescope", + "??? with wrong room loaded", + "(crash)", + "(crash)", + "(crash)", + "(crash)", + }, + + {[0]= + "main door", + "[same]", + }, + + {[0]= + "from great bay", + "[same]", + }, + + {[0]= + "from clock town", + "from woodfall", + "from snowhead", + "from great bay", + "from ikana canyon", + "learning magic", + "learning spin attack", + "learning double magic", + "getting double defense", + "getting great fairy's sword", + }, + + {[0]= + "main door", + "[same]", + }, + + {[0]= + "main door", + "[same]", + }, + + {[0]= + "from clock town", + "from termina field", + "after telescope", + "from clock town (again?)", + }, + + {[0]= + "from moon", + "from moon?", + }, + + {[0]= + "from swamp", + "being kicked out", + "from deku king's chamber", + "from monkey", + "from what's-it-called", + "from swamp (above)", + "from JP grotto 1", + "from JP grotto 2", + "from JP grotto 3", + "from bean seller's grotto", + "from JP grotto 4", + "from swamp (no cutscene)", + }, + + {[0]= + "main door", + "[same]", + "(crash)", + "[same]", + }, + + {[0]= + "from west clock town", + "from road to swamp", + "from great bay", + "from snowhead passage", + "from road to ikana", + "from milk road", + "from south clock town", + "from east clock town", + "from north clock town", + "from observatory", + "telescope", + "near ikana (unused?)", + "moon crashing", + "near east clock town (unused?)", + "after skull kid cutscene", + "from west clock town (no cutscene)", + }, + + {[0]= + "main door", + "[same]", + }, + + {[0]= + "main door", + "[same]", + "(crash)", + "[same]", + }, + + {[0]= + "from grave", + "from graveyard door", + }, + + {}, + + {[0]= + "main door", + "from shop", + "after lullaby", + "main door (no cutscene)", + }, + + {[0]= + "from center", + "from turtle", + "from shop", + "from mikau's room", + "from evan's room", + "from japa's room", + "from tijo's room", + "after something?", + "after concert?", + "main door (no cutscene)", + }, + + {[0]= + "main door", + "[same]", + "(crash)", + "[same]", + }, + + {[0]= + "from milk road", + "after minigame", + "from barn", + "from mama's house", + "from cucco shack", + "from doggy racetrack", + "in front of barn", + "in front of barn (again?)", + "in front of house", + "in front of barn (again??)", + "in front of romani", + "in front of barn, facing other way", + "[crash]", + "in front of barn (again!)", + "in front of barn (again!!)", + }, + + {[0]= + "main door", + "[same]", + "(crash)", + "(crash)", + "(crash)", + }, + + {[0]= + "from termina field", + "from zora area", + "from swimming too far", + "from pinnacle rock", + "from fisherman's hut", + "from pirates' fortress", + "from swimming too far (near pinnacle?)", + "from lab", + "from spider house", + "getting zora mask", + "in front of mikau's grave", + "from owl", + "getting kicked out of pirates'", + "after beating minigame", + }, + + {[0]= + "from lab area", + "from zora hall", + "from zora hall (turtle)", + "from swimming too far", + "from waterfall rapids", + "from great fairy's fountain", + "from owl", + "from great bay temple", + "after beating great bay temple?", + "really high up?", + }, + + {[0]= + "main door", + "[same]", + "(crash)", + "[same]", + }, + + {}, + + {[0]= + "from great bay", + "from outside pirates'", + "from underwater passage", + "from one-way underwater", + "being kicked out", + "from hookshot platform", + "from passage door", + "from great bay (no cutscene)", + }, + + {[0]= + "main door", + "[same]", + "(crash)", + "[same]", + }, + + {[0]= + "main door", + "[same]", + "(crash)", + "[same]", + }, + + {[0]= + "from main door", + "to monkey", + "princess thanks monkey cutscene", + "in front of king", + }, + + {[0]= + "from moon", + "from moon?", + "[crash]", + "from moon??", + }, + + {[0]= + "from termina field", + "from swamp", + "from shooting gallery", + "from termina field (again)", + }, + + {[0]= + "from ranch", + "after beating minigame", + "[crash]", + "from ranch (again)", + }, + + {[0]= + "from ranch", + "getting bunny hood", + }, + + {[0]= + "from road", + "from grave 1", + "from grave 2", + "from grave 3", + "from dampe's door", + "getting captain's hat", + }, + + {[0]= + "main door", + "[same]", + }, + + {[0]= + "from road", + "from tourists'", + "from woodfall", + "from deku palace", + "from deku palace (above)", + "from hags'", + "boat cruise", + "from woods of mystery", + "from spider house", + "from ikana", + "from owl", + "from road (again?)", + }, + + {[0]= + "from swamp", + "from temple", + "from great fairy's fountain", + "from deku princess", + "from owl", + "from swamp (no cutscene)", + }, + + {[0]= + "from moon", + "from moon?", + }, + + {[0]= + "from road", + "from… above?", + "from shrine", + "from lens of truth cave", + "from voiding out", + "from road (again)", + }, + + {[0]= + "from turtle", + "from turtle (first time)", + }, + + {[0]= + "from great bay", + "minigame", + "minigame 2?", + "after beating minigame?", + "from great bay (no cutscene)", + }, + + {[0]= + "from ikana canyon", + "from ikana castle", + }, + + {[0]= + "drummer's room", + "bassist's room", + "from mikau's room", + "from keyboardist's room", + "after playing song to bassist", + "zora shop", + "after playing song to keyboardist", + "drummer's room (again)", + }, + + {[0]= + "from road", + "from flower?", + "from shrine", + "from lens of truth cave", + "from voiding out", + "from road (again)", + }, + + {[0]= + "main door", + "getting goron mask", + "(crash)", + "[same]", + }, + + {[0]= + "main door", + "[same]", + "(crash)", + "[same]", + }, + + {[0]= + "after beating snowhead", + "from smithy's", + "from road to village", + "from graveyard", + "from road to snowhead", + "on ice?", + "from snowhead passage", + "from…?", + "from owl", + "after being snowhead (again)", + }, + + {[0]= + "from ikana canyon", + "from minigame", + "after beating minigame", + "from ikana canyon (again)", + }, + + {[0]= + "main door", + "[same]", + }, + + {[0]= + "from termina field", + "from ikana canyon", + "from ikana graveyard", + "from termina field (again)", + }, + + {[0]= + "main door", + "[same]", + "(crash)", + "[same]", + }, + + {[0]= + "main door", + "[same]", + "(crash)", + "[same]", + }, + + {[0]= + "main door", + "[same]", + "(crash)", + "[same]", + }, + + {[0]= + "main door", + "from boat ride", + "in front of desk (unused?)", + "main door (again)", + }, + + {[0]= + "from ikana canyon", + "from inverting", + "from temple", + "from owl", + }, + + {[0]= + "from inverting", + "from stone tower", + "(crash)", + "from inverting (no cutscene)", + }, + + {[0]= + "after beating snowhead", + "from smithy's", + "from road to village", + "from graveyard", + "from road to snowhead", + "from behind waterfall (unused?)", + "from snowhead passage", + "after beating snowhead (with cutscene)", + "from owl", + "after being snowhead (again)", + }, + + {[0]= + "from smithy area", + "from snowhead", + }, + + {[0]= + "from road", + "from snowhead temple", + "from great fairy's fountain", + "from owl", + }, + + {[0]= + "from smithy area", + "from goron village", + "from goron racetrack", + "from smithy area (again)", + }, + + {[0]= + "from smithy area", + "from goron village", + "from goron racetrack", + "from smithy area (again)", + }, + + {[0]= + "main door", + "immediately falling", + }, + + {[0]= + "main door", + "[same]", + "(crash)", + "[same]", + }, + + {[0]= + "main door", + "upstairs door", + "grandma", + "after talking", + "listening to conversation cutscene", + "after listening", + }, + + {[0]= + "default", + "no cutscene", + }, + + {[0]= + "twisty hallway", + "from clock town", + "getting deku mask", + "after cutscene?", + "first SoT cutscene", + "from twisty hallway (unused?)", + "salesman talking about mask", + "twisty hallway (no cutscene)", + }, + + {[0]= + "from swamp", + "from grotto?", + }, + + {[0]= + "kicked off horse", + "first SoT cutscene", + "(crash)", + "gain control (no cutscene)", + }, + + {[0]= + "from moon", + "[same]", + "(crash)", + "[same]", + }, + + {[0]= + "moon", + "[same]", + }, + + {[0]= + "main door", + "[same]", + "(crash)", + "[same]", + }, + + {[0]= + "giants", + "no cutscene", + }, + + {[0]= + "from milk road", + "?", + "after beating minigame", + "from milk road (behind fence)", + "from milk road (behind fence) (CS?)", + "", + "beginning minigame", + }, + + {[0]= + "from road", + "beginning minigame", + "after beating minigame", + "from road (again)", + }, + + {[0]= + "from termina field", + "from south clock town (south)", + "from bomber's hideout", + "from south clock town (north)", + "from treasure chest shop", + "from north clock town", + "from honey & darling's", + "from mayor's", + "from shooting gallery", + "from stock pot inn", + "from stock pot inn (above)", + "from milk bar", + }, + + {[0]= + "from termina field", + "from south clock town (south)", + "from south clock town (north)", + "from swordsman's school", + "from curiosity shop", + "from trading post", + "from bomb shop", + "from post office", + "from lottery shop", + "from termina field (again)", + }, + + {[0]= + "from termina field", + "from east clock town", + "from south clock town", + "from great fairy's fountain", + "from deku minigame", + "after bomber minigame", + "in the middle (unused?)", + "after sakon attacks", + }, + + {[0]= + "from clock tower", + "from termina field", + "from east clock town (north)", + "from west clock town (north)", + "from north clock town", + "from west clock town (south)", + "from laundry pool", + "from east clock town (south)", + "from atop clock tower (unused)", + "from owl", + "from SoT cutscene", + "from clock tower (no cutscene)", + }, + + {[0]= + "from south clock town", + "from kafei's room", + }, + + {}, + + {}, + + {}, + + {}, + + {}, + + {}, + + {}, + + {}, + + {}, + + {}, + + {}, + + {}, + + {}, + + {}, + + {}, +} diff --git a/Lua/data/scene names.lua b/Lua/data/scene names.lua new file mode 100644 index 0000000..bbc3463 --- /dev/null +++ b/Lua/data/scene names.lua @@ -0,0 +1,131 @@ +-- entrance order, not scene order. i know it's confusing. +return { + [0]="Southern Swamp (Clean)", + "(crash)", + "(crash)", + "(crash)", + "(crash)", + "(crash)", + "(crash)", + "Grottos", + "Intro Map", + "(crash)", + "Magic Hags' Potion Shop", + "Majora", + "Beneath the Graveyard", + "Curiosity Shop", + "(crash)", + "(crash)", + "Mama's House / Barn", + "Honey & Darling's Shop", + "Mayor's Residence", + "Ikana Canyon", + "Pirates' Fortress (Outside)", + "Milk Bar", + "Stone Tower Temple", + "Treasure Chest Shop", + "Inverted Stone Tower Temple", + "Atop Clock Tower", + "(Deku Intro Area before Clock Tower)", + "Woodfall Temple", + "Snowhead Passage", + "Ikana Castle", + "Deku Flower Minigame", + "Woodfall Temple - Odolwa", + "Town Shooting Gallery", + "Snowhead Temple", + "Milk Road", + "Pirates' Fortress (Inside)", + "Swamp Shooting Gallery", + "Pinnacle Rock", + "Fairy's Fountain", + "Swamp Spider House", + "Oceanside Spider House", + "Astral Observatory (Bomber's Hideout)", + "Woodfall Trial", + "Deku Palace", + "Mountain Smithy", + "Termina Field", + "Post Office", + "Marine Research Lab", + "Beneath the Graveyard (Dampe)", + "(crash)", + "Goron Shrine", + "Zora Hall", + "Trading Post", + "Romani Ranch", + "Stone Tower Temple - Twinmold", + "Great Bay Coast (Lab Area)", + "Great Bay Coast (Zora Area)", + "Lottery Shop", + "(crash)", + "Pirates' Fortress (Outside)", + "Fisherman's Hut", + "Goron Shop", + "Deku King's Chamber", + "Snowhead Trial", + "(Road to Swamp)", + "Doggy Racetrack", + "Cucco Shack", + "Ikana Graveyard", + "Snowhead Temple - Goht", + "Southern Swamp (Poisoned)", + "Woodfall Temple (Outside)", + "Great Bay Trial", + "Goron Village (Thawed)", + "Great Bay Temple", + "Waterfall Rapids", + "Beneath the Well", + "(Zora Band Member Rooms)", + "Goron Village (Frozen)", + "Goron Graveyard", + "Sakon's Hideout", + "Mountain Village (Frozen)", + "Ghost Hut", + "Deku Shrine", + "(Road to Ikana)", + "Swordsman's School", + "Music Box House", + "Ikana Castle Boss Room", + "Tourist Information", + "Stone Tower", + "Inverted Stone Tower", + "Mountain Village (Thawed)", + "(Road to Snowhead Temple)", + "Snowhead", + "(Road to Goron Village) (Frozen)", + "(Road to Goron Village) (Thawed)", + "Great Bay Temple - Gyorg", + "Secret Shrine", + "Stone Pot Inn", + "(Cutscene before Great Bay Temple)", + "Clock Tower (Inside)", + "Woods of Mystery", + "Lost Woods (Gain Control)", + "Ikana Trial", + "Moon", + "Bomb Shop", + "Giants' Chamber", + "Gorman Track", + "Goron Racetrack", + "East Clock Town", + "West Clock Town", + "North Clock Town", + "South Clock Town", + "Laundry Pool", + "(crash)", + "(crash)", + "(crash)", + "(crash)", + "(crash)", + "(crash)", + "(crash)", + "(crash)", + "(crash)", + "(crash)", + "(crash)", + "(crash)", + "(crash)", + "(crash)", + "(crash)", +} diff --git a/Lua/exit calculator.lua b/Lua/exit calculator.lua new file mode 100644 index 0000000..978f23c --- /dev/null +++ b/Lua/exit calculator.lua @@ -0,0 +1,79 @@ +require = require "depend" +require "boilerplate" +require "addrs.init" + +local scene_names = require "data.scene names" +local entrance_names = require "data.entrance names" + +function sdata(i) + local a = addrs.scene_table.addr + i*4*3 + -- entrance count, entrance table (ptr), name (ptr) + return {R4(a), R4(a + 4), R4(a + 8)} +end + +function mirror(scene_id) + if scene_id > 0x80 then + return 0x100 - scene_id + end + return scene_id +end + +function calc_dump(a) + if type(a) ~= "number" then + print('[crash]') + return + end + if is_ptr(R4(a)) then + a = deref(R4(a)) + end + local scene_id = mirror(R1(a)) + local entrance = R1(a + 1) + local t = entrance_names[scene_id] + if t == nil then + print("err") + return + end + print(scene_names[scene_id]) + print(t[entrance]) +end + +function calc(exit) + console.clear() + local scene = bit.rshift(exit, 9) + local entrance = bit.band(bit.rshift(exit, 4), 0x1F) + local offset = bit.band(exit, 0xF) + printf("%i, %i, %i", scene, entrance, offset) + + local sd = sdata(scene) + local first_entrance = deref(sd[2]) + print("# Scene:") + calc_dump(first_entrance) + + if not first_entrance then return end + + local orig_entrance = first_entrance + entrance*4 + local entr_before_offset = deref(R4(orig_entrance)) + print("# Scene + Entrance:") + calc_dump(entr_before_offset) + + if not entr_before_offset then return end + + local final_entrance = entr_before_offset + offset*4 + print("# Scene + Entrance + Offset:") + calc_dump(final_entrance) + + -- TODO: read until \x00 + --print('internal name:') + --print(asciize(mainmemory.readbyterange(deref(sd[3]), 8))) +end + +local old_value = -1 +while true do + local exit_value = addrs.exit_value() + if exit_value and exit_value ~= old_value then + console.clear() + calc(exit_value) + end + old_value = exit_value + emu.frameadvance() +end