Jimmie1717 icon

BizHawk: Majora's Mask Warp Script

Jimmie1717 | PRO | 12/26/15 11:24:06 PM UTC | 0 ⭐ | 1559 👁️ | Never ⏰ | []
Lua |

11.67 KB

|

None

|

0 👍

/

0 👎

-- Majora's Mask Warp Script
-- BizHawk 1.11.1
 
-- This displays some simple information on the screen.
-- This allows you to warp to set locations.
--  Press Page Up/Down to scroll through the list.
--  Press Home to Warp.
 
-- This script works for the following versions so far:
--  english
--  english (kiosk)
--  english (gamecube)
--  japanese 1.0
--  japanese 1.1
--  european 1.0
--  european 1.1
 
-- Game Hash:
-- english              D6133ACE5AFAA0882CF214CF88DABA39E266C078
-- english kiosk        2F0744F2422B0421697A74B305CB1EF27041AB11
-- english gamecube     9743AA026E9269B339EB0E3044CD5830A440C1FD
-- japanese 1.0         5FB2301AACBF85278AF30DCA3E4194AD48599E36
-- japanese 1.1         41FDB879AB422EC158B4EAFEA69087F255EA8589
-- japanese gamecube    ????????????????????????????????????????
-- european 1.0         C04599CDAFEE1C84A7AF9A71DF68F139179ADA84
-- european 1.1         BB4E4757D10727C7584C59C1F2E5F44196E9C293
-- european gamecube    ????????????????????????????????????????
-- european debug       B38B71D2961DFFB523020A67F4807A4B704E347A
 
-- Version Detection
local version       = ""
if (gameinfo.getromhash() == "D6133ACE5AFAA0882CF214CF88DABA39E266C078") then
    version = "english"
elseif (gameinfo.getromhash() == "2F0744F2422B0421697A74B305CB1EF27041AB11") then
    version = "englishK"
elseif (gameinfo.getromhash() == "9743AA026E9269B339EB0E3044CD5830A440C1FD") then
    version = "englishGCN"
elseif (gameinfo.getromhash() == "5FB2301AACBF85278AF30DCA3E4194AD48599E36") then
    version = "japanese"
elseif (gameinfo.getromhash() == "41FDB879AB422EC158B4EAFEA69087F255EA8589") then
    version = "japaneseA"
elseif (gameinfo.getromhash() == "C04599CDAFEE1C84A7AF9A71DF68F139179ADA84") then
    version = "european"
elseif (gameinfo.getromhash() == "BB4E4757D10727C7584C59C1F2E5F44196E9C293") then
    version = "europeanA"
end
 
local scene             = {
    ["english"]         = 0x3E6BC4,
    ["englishK"]        = 0x3E6454,
    ["englishGCN"]      = 0x381304,
    ["japanese"]        = 0x3E6D94,
    ["japaneseA"]       = 0x3E7054,
    ["japaneseGCN"]     = 0x000000,
    ["european"]        = 0x3DE064,
    ["europeanA"]       = 0x3DE404,
    ["europeanGCN"]     = 0x000000,
    ["europeanD"]       = 0x000000
}
local entranceLast      = {
    ["english"]         = 0x1EF670,
    ["englishK"]        = 0x1EEE80,
    ["englishGCN"]      = 0x1ED830,
    ["japanese"]        = 0x1EF460,
    ["japaneseA"]       = 0x1EF710,
    ["japaneseGCN"]     = 0x000000,
    ["european"]        = 0x1E6B50,
    ["europeanA"]       = 0x1E6EF0,
    ["europeanGCN"]     = 0x000000,
    ["europeanD"]       = 0x000000
}
local entranceSetter    = {
    ["english"]         = 0x3FF398,
    ["englishK"]        = 0x3FEC28,
    ["englishGCN"]      = 0x399AD8,
    ["japanese"]        = 0x3FF548,
    ["japaneseA"]       = 0x3FF808,
    ["japaneseGCN"]     = 0x000000,
    ["european"]        = 0x3F6838,
    ["europeanA"]       = 0x3F6BD8,
    ["europeanGCN"]     = 0x000000,
    ["europeanD"]       = 0x000000
}
local loadFlag          = {
    ["english"]         = 0x3FF395,
    ["englishK"]        = 0x3FEC25,
    ["englishGCN"]      = 0x399AD5,
    ["japanese"]        = 0x3FF545,
    ["japaneseA"]       = 0x3FF805,
    ["japaneseGCN"]     = 0x000000,
    ["european"]        = 0x3F6835,
    ["europeanA"]       = 0x3F6BD5,
    ["europeanGCN"]     = 0x000000,
    ["europeanD"]       = 0x000000
}
local facingAngle       = {
    ["english"]         = 0x3FFE6E,
    ["englishK"]        = 0x3FF73E,
    ["englishGCN"]      = 0x39A5AE,
    ["japanese"]        = 0x40005E,
    ["japaneseA"]       = 0x40031E,
    ["japaneseGCN"]     = 0x000000,
    ["european"]        = 0x3F730E,
    ["europeanA"]       = 0x3F76AE,
    ["europeanGCN"]     = 0x000000,
    ["europeanD"]       = 0x000000
}
local xCoordinate       = {
    ["english"]         = 0x3FFDD4,
    ["englishK"]        = 0x3FF6A4,
    ["englishGCN"]      = 0x39A514,
    ["japanese"]        = 0x3FFFC4,
    ["japaneseA"]       = 0x400284,
    ["japaneseGCN"]     = 0x000000,
    ["european"]        = 0x3F7274,
    ["europeanA"]       = 0x3F7614,
    ["europeanGCN"]     = 0x000000,
    ["europeanD"]       = 0x000000
}
local yCoordinate       = {
    ["english"]         = 0x3FFDD8,
    ["englishK"]        = 0x3FF6A8,
    ["englishGCN"]      = 0x39A518,
    ["japanese"]        = 0x3FFFC8,
    ["japaneseA"]       = 0x400288,
    ["japaneseGCN"]     = 0x000000,
    ["european"]        = 0x3F7278,
    ["europeanA"]       = 0x3F7618,
    ["europeanGCN"]     = 0x000000,
    ["europeanD"]       = 0x000000
}
local zCoordinate       = {
    ["english"]         = 0x3FFDDC,
    ["englishK"]        = 0x3FF6AC,
    ["englishGCN"]      = 0x39A51C,
    ["japanese"]        = 0x3FFFCC,
    ["japaneseA"]       = 0x40028C,
    ["japaneseGCN"]     = 0x000000,
    ["european"]        = 0x3F727C,
    ["europeanA"]       = 0x3F761C,
    ["europeanGCN"]     = 0x000000,
    ["europeanD"]       = 0x000000
}
local xVelocity         = {
    ["english"]         = 0x400880,
    ["englishK"]        = 0x400150,
    ["englishGCN"]      = 0x39AFC0,
    ["japanese"]        = 0x400A70,
    ["japaneseA"]       = 0x400D30,
    ["japaneseGCN"]     = 0x000000,
    ["european"]        = 0x3F7D20,
    ["europeanA"]       = 0x3F80C0,
    ["europeanGCN"]     = 0x000000,
    ["europeanD"]       = 0x000000
}
local yVelocity         = {
    ["english"]         = 0x3FFE18,
    ["englishK"]        = 0x3FF6E8,
    ["englishGCN"]      = 0x39A558,
    ["japanese"]        = 0x400008,
    ["japaneseA"]       = 0x4002C8,
    ["japaneseGCN"]     = 0x000000,
    ["european"]        = 0x3F72B8,
    ["europeanA"]       = 0x3F7658,
    ["europeanGCN"]     = 0x000000,
    ["europeanD"]       = 0x000000
}
 
local isPressed         = false
local location          = 1
local scenes            = {
    [1]                 = 54816,
    ["1"]               = "North Clock Town",
    [2]                 = 55296,
    ["2"]               = "South Clock Town",
    [3]                 = 53808,
    ["3"]               = "East Clock Town",
    [4]                 = 54304,
    ["4"]               = "West Clock Town",
    [5]                 = 33792,
    ["5"]               = "Southern Swamp",
    [6]                 = 49664,
    ["6"]               = "Woods of Mystery",
    [7]                 = 20480,
    ["7"]               = "Deku Palace (Swamp)",
    [8]                 = 20592,
    ["8"]               = "Deku Palace (Grotto)",
    [9]                 = 39520,
    ["9"]               = "Mountain Village",
    [10]                = 37888,
    ["10"]              = "Goron Village",
    [11]                = 15872,
    ["11"]              = "Milk Road",
    [12]                = 25600,
    ["12"]              = "Romani Ranch",
    [13]                = 26624,
    ["13"]              = "Great Bay Coast",
    [14]                = 22528,
    ["14"]              = "Marine Research Lab",
    [15]                = 28672,
    ["15"]              = "Pirate's Fortress (Exterior)",
    [16]                = 16528,
    ["16"]              = "Pirate's Fortress (Sewers)",
    [17]                = 8704,
    ["17"]              = "Pirate's Fortress (Interior)",
    [18]                = 16384,
    ["18"]              = "Pirate's Fortress (Hookshot)",
    [19]                = 17408,
    ["19"]              = "Pinnacle Rock",
    [20]                = 27136,
    ["20"]              = "Zora Cape",
    [21]                = 27168,
    ["21"]              = "Zora Cape (Turtle)",
    [22]                = 24576,
    ["22"]              = "Zora Hall",
    [23]                = 36352,
    ["23"]              = "Waterfall Rapids",
    [24]                = 32768,
    ["24"]              = "Ikana Graveyard",
    [25]                = 2576,
    ["25"]              = "Grave (Day 1)",
    [26]                = 2560,
    ["26"]              = "Grave (Day 2)",
    [27]                = 23056,
    ["27"]              = "Dampe's House",
    [28]                = 8256,
    ["28"]              = "Ikana Canyon",
    [29]                = 36864,
    ["29"]              = "Beneath the Well",
    [30]                = 38912,
    ["30"]              = "Sakon's Hideout",
    [31]                = 47616,
    ["31"]              = "Secret Shrine",
    [32]                = 43568,
    ["32"]              = "Stone Tower",
    [33]                = 13328,
    ["33"]              = "Ancient Castle of Ikana",
    [34]                = 12288,
    ["34"]              = "Woodfall Temple",
    [35]                = 15360,
    ["35"]              = "Snowhead Temple",
    [36]                = 35840,
    ["36"]              = "Great Bay Temple",
    [37]                = 9728,
    ["37"]              = "Stone Tower Temple",
    [38]                = 10752,
    ["38"]              = "Inverted Stone Tower Temple",
    [39]                = 14336,
    ["39"]              = "Odolwa's Room",
    [40]                = 33280,
    ["40"]              = "Goht's Room",
    [41]                = 47104,
    ["41"]              = "Gyorg's Room",
    [42]                = 26112,
    ["42"]              = "Twinmold's Room",
    [43]                = 42496,
    ["43"]              = "Igo's Du Ikana Room",
    [44]                = 512,
    ["44"]              = "Majora's Room",
    [45]                = 18432,
    ["45"]              = "Swamp Spider House",
    [46]                = 18944,
    ["46"]              = "Ocean Spider House",
    [47]                = 51200,
    ["47"]              = "Moon",
    [48]                = 19968,
    ["48"]              = "Woodfall Trial",
    [49]                = 30720,
    ["49"]              = "Snowhead Trial",
    [50]                = 34816,
    ["50"]              = "Great Bay Trial",
    [51]                = 50688,
    ["51"]              = "Stone Tower Trial",
}
 
-- Anchor for Text Display
local x                 = 1
local y                 = 65
 
function setLocation(i)
 
    isPressed = true
    location = location + i
    
    if (location < 1) then
        location = table.getn(scenes)
    elseif (location > table.getn(scenes)) then
        location = 1
    end
 
end
 
function warp(i)
 
    memory.write_u32_be(entranceSetter[version], scenes[i])
    memory.write_u8(loadFlag[version], 20)
 
end
 
function textDisplay()
 
    -- Text Display
    gui.drawText(x + 1, y + 1, string.format("Scene:"), "BLACK")
    gui.drawText(x, y, string.format("Scene:"))
    gui.drawText(x + 101, y + 1, string.format("%04s", bizstring.hex(memory.read_u16_be(scene[version]))), "BLACK")
    gui.drawText(x + 100, y, string.format("%04s", bizstring.hex(memory.read_u16_be(scene[version]))))
    
    gui.drawText(x + 1, y + 13, string.format("Entrance:"), "BLACK")
    gui.drawText(x, y + 12, string.format("Entrance:"))
    gui.drawText(x + 101, y + 13, string.format("%04s", bizstring.hex(memory.read_u32_be(entranceLast[version]))), "BLACK")
    gui.drawText(x + 100, y + 12, string.format("%04s", bizstring.hex(memory.read_u32_be(entranceLast[version]))))
    
    gui.drawText(x + 1, y + 25, string.format("Setter:"), "BLACK")
    gui.drawText(x, y + 24, string.format("Setter:"))
    gui.drawText(x + 101, y + 25, string.format("%04s", bizstring.hex(memory.read_u32_be(entranceSetter[version]))), "BLACK")
    gui.drawText(x + 100, y + 24, string.format("%04s", bizstring.hex(memory.read_u32_be(entranceSetter[version]))))
    
    gui.drawText(x + 1, y + 43, string.format("X:"), "BLACK")
    gui.drawText(x, y + 42, string.format("X:"))
    gui.drawText(x + 78, y + 43, string.format("% 7.1f", memory.readfloat(xCoordinate[version], true)), "BLACK")
    gui.drawText(x + 77, y + 42, string.format("% 7.1f", memory.readfloat(xCoordinate[version], true)))
    
    gui.drawText(x + 1, y + 55, string.format("Y:"), "BLACK")
    gui.drawText(x, y + 54, string.format("Y:"))
    gui.drawText(x + 78, y + 55, string.format("% 7.1f", memory.readfloat(yCoordinate[version], true)), "BLACK")
    gui.drawText(x + 77, y + 54, string.format("% 7.1f", memory.readfloat(yCoordinate[version], true)))
    
    gui.drawText(x + 1, y + 67, string.format("Z:"), "BLACK")
    gui.drawText(x, y + 66, string.format("Z:"))
    gui.drawText(x + 78, y + 67, string.format("% 7.1f", memory.readfloat(zCoordinate[version], true)), "BLACK")
    gui.drawText(x + 77, y + 66, string.format("% 7.1f", memory.readfloat(zCoordinate[version], true)))
    
    gui.drawText(x + 1, y + 79, string.format("V (X):"), "BLACK")
    gui.drawText(x, y + 78, string.format("V (X):"))
    gui.drawText(x + 93, y + 79, string.format("% 5.1f", memory.readfloat(xVelocity[version], true)), "BLACK")
    gui.drawText(x + 92, y + 78, string.format("% 5.1f", memory.readfloat(xVelocity[version], true)))
    
    gui.drawText(x + 1, y + 91, string.format("V (Y):"), "BLACK")
    gui.drawText(x, y + 90, string.format("V (Y):"))
    gui.drawText(x + 93, y + 91, string.format("% 5.1f", memory.readfloat(yVelocity[version], true)), "BLACK")
    gui.drawText(x + 92, y + 90, string.format("% 5.1f", memory.readfloat(yVelocity[version], true)))
    
    gui.drawText(x + 1, y + 109, string.format("Angle:"), "BLACK")
    gui.drawText(x, y + 108, string.format("Angle:"))
    gui.drawText(x + 93, y + 109, string.format("%05d", memory.read_u16_be(facingAngle[version])), "BLACK")
    gui.drawText(x + 92, y + 108, string.format("%05d", memory.read_u16_be(facingAngle[version])))
    
    gui.drawText(x + 1, y + 127, string.format("Warp Destination:"), "BLACK")
    gui.drawText(x, y + 126, string.format("Warp Destination:"))
    gui.drawText(x + 1, y + 139, string.format("%s", scenes["" .. location]), "BLACK")
    gui.drawText(x, y + 138, string.format("%s", scenes["" .. location]))
 
end
 
while true do
    
    -- Warping
    if input.get().PageUp == true and isPressed == false then
        setLocation(-1)
    elseif input.get().PageDown == true and isPressed == false then
        setLocation(1)
    elseif input.get().Home == true and isPressed == false then
        warp(location)
    elseif input.get().PageUp == null and input.get().PageDown == null and input.get().Home == null then    
        isPressed = false
    end
    
    textDisplay()
    
    emu.frameadvance()
        
end

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎