Advertisement
Jimmie1717

BizHawk: Majora's Mask Warp Script

Dec 26th, 2015
407
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.67 KB | None | 0 0
  1. -- Majora's Mask Warp Script
  2. -- BizHawk 1.11.1
  3.  
  4. -- This displays some simple information on the screen.
  5. -- This allows you to warp to set locations.
  6. --  Press Page Up/Down to scroll through the list.
  7. --  Press Home to Warp.
  8.  
  9. -- This script works for the following versions so far:
  10. --  english
  11. --  english (kiosk)
  12. --  english (gamecube)
  13. --  japanese 1.0
  14. --  japanese 1.1
  15. --  european 1.0
  16. --  european 1.1
  17.  
  18. -- Game Hash:
  19. -- english              D6133ACE5AFAA0882CF214CF88DABA39E266C078
  20. -- english kiosk        2F0744F2422B0421697A74B305CB1EF27041AB11
  21. -- english gamecube     9743AA026E9269B339EB0E3044CD5830A440C1FD
  22. -- japanese 1.0         5FB2301AACBF85278AF30DCA3E4194AD48599E36
  23. -- japanese 1.1         41FDB879AB422EC158B4EAFEA69087F255EA8589
  24. -- japanese gamecube    ????????????????????????????????????????
  25. -- european 1.0         C04599CDAFEE1C84A7AF9A71DF68F139179ADA84
  26. -- european 1.1         BB4E4757D10727C7584C59C1F2E5F44196E9C293
  27. -- european gamecube    ????????????????????????????????????????
  28. -- european debug       B38B71D2961DFFB523020A67F4807A4B704E347A
  29.  
  30. -- Version Detection
  31. local version       = ""
  32. if (gameinfo.getromhash() == "D6133ACE5AFAA0882CF214CF88DABA39E266C078") then
  33.     version = "english"
  34. elseif (gameinfo.getromhash() == "2F0744F2422B0421697A74B305CB1EF27041AB11") then
  35.     version = "englishK"
  36. elseif (gameinfo.getromhash() == "9743AA026E9269B339EB0E3044CD5830A440C1FD") then
  37.     version = "englishGCN"
  38. elseif (gameinfo.getromhash() == "5FB2301AACBF85278AF30DCA3E4194AD48599E36") then
  39.     version = "japanese"
  40. elseif (gameinfo.getromhash() == "41FDB879AB422EC158B4EAFEA69087F255EA8589") then
  41.     version = "japaneseA"
  42. elseif (gameinfo.getromhash() == "C04599CDAFEE1C84A7AF9A71DF68F139179ADA84") then
  43.     version = "european"
  44. elseif (gameinfo.getromhash() == "BB4E4757D10727C7584C59C1F2E5F44196E9C293") then
  45.     version = "europeanA"
  46. end
  47.  
  48. local scene             = {
  49.     ["english"]         = 0x3E6BC4,
  50.     ["englishK"]        = 0x3E6454,
  51.     ["englishGCN"]      = 0x381304,
  52.     ["japanese"]        = 0x3E6D94,
  53.     ["japaneseA"]       = 0x3E7054,
  54.     ["japaneseGCN"]     = 0x000000,
  55.     ["european"]        = 0x3DE064,
  56.     ["europeanA"]       = 0x3DE404,
  57.     ["europeanGCN"]     = 0x000000,
  58.     ["europeanD"]       = 0x000000
  59. }
  60. local entranceLast      = {
  61.     ["english"]         = 0x1EF670,
  62.     ["englishK"]        = 0x1EEE80,
  63.     ["englishGCN"]      = 0x1ED830,
  64.     ["japanese"]        = 0x1EF460,
  65.     ["japaneseA"]       = 0x1EF710,
  66.     ["japaneseGCN"]     = 0x000000,
  67.     ["european"]        = 0x1E6B50,
  68.     ["europeanA"]       = 0x1E6EF0,
  69.     ["europeanGCN"]     = 0x000000,
  70.     ["europeanD"]       = 0x000000
  71. }
  72. local entranceSetter    = {
  73.     ["english"]         = 0x3FF398,
  74.     ["englishK"]        = 0x3FEC28,
  75.     ["englishGCN"]      = 0x399AD8,
  76.     ["japanese"]        = 0x3FF548,
  77.     ["japaneseA"]       = 0x3FF808,
  78.     ["japaneseGCN"]     = 0x000000,
  79.     ["european"]        = 0x3F6838,
  80.     ["europeanA"]       = 0x3F6BD8,
  81.     ["europeanGCN"]     = 0x000000,
  82.     ["europeanD"]       = 0x000000
  83. }
  84. local loadFlag          = {
  85.     ["english"]         = 0x3FF395,
  86.     ["englishK"]        = 0x3FEC25,
  87.     ["englishGCN"]      = 0x399AD5,
  88.     ["japanese"]        = 0x3FF545,
  89.     ["japaneseA"]       = 0x3FF805,
  90.     ["japaneseGCN"]     = 0x000000,
  91.     ["european"]        = 0x3F6835,
  92.     ["europeanA"]       = 0x3F6BD5,
  93.     ["europeanGCN"]     = 0x000000,
  94.     ["europeanD"]       = 0x000000
  95. }
  96. local facingAngle       = {
  97.     ["english"]         = 0x3FFE6E,
  98.     ["englishK"]        = 0x3FF73E,
  99.     ["englishGCN"]      = 0x39A5AE,
  100.     ["japanese"]        = 0x40005E,
  101.     ["japaneseA"]       = 0x40031E,
  102.     ["japaneseGCN"]     = 0x000000,
  103.     ["european"]        = 0x3F730E,
  104.     ["europeanA"]       = 0x3F76AE,
  105.     ["europeanGCN"]     = 0x000000,
  106.     ["europeanD"]       = 0x000000
  107. }
  108. local xCoordinate       = {
  109.     ["english"]         = 0x3FFDD4,
  110.     ["englishK"]        = 0x3FF6A4,
  111.     ["englishGCN"]      = 0x39A514,
  112.     ["japanese"]        = 0x3FFFC4,
  113.     ["japaneseA"]       = 0x400284,
  114.     ["japaneseGCN"]     = 0x000000,
  115.     ["european"]        = 0x3F7274,
  116.     ["europeanA"]       = 0x3F7614,
  117.     ["europeanGCN"]     = 0x000000,
  118.     ["europeanD"]       = 0x000000
  119. }
  120. local yCoordinate       = {
  121.     ["english"]         = 0x3FFDD8,
  122.     ["englishK"]        = 0x3FF6A8,
  123.     ["englishGCN"]      = 0x39A518,
  124.     ["japanese"]        = 0x3FFFC8,
  125.     ["japaneseA"]       = 0x400288,
  126.     ["japaneseGCN"]     = 0x000000,
  127.     ["european"]        = 0x3F7278,
  128.     ["europeanA"]       = 0x3F7618,
  129.     ["europeanGCN"]     = 0x000000,
  130.     ["europeanD"]       = 0x000000
  131. }
  132. local zCoordinate       = {
  133.     ["english"]         = 0x3FFDDC,
  134.     ["englishK"]        = 0x3FF6AC,
  135.     ["englishGCN"]      = 0x39A51C,
  136.     ["japanese"]        = 0x3FFFCC,
  137.     ["japaneseA"]       = 0x40028C,
  138.     ["japaneseGCN"]     = 0x000000,
  139.     ["european"]        = 0x3F727C,
  140.     ["europeanA"]       = 0x3F761C,
  141.     ["europeanGCN"]     = 0x000000,
  142.     ["europeanD"]       = 0x000000
  143. }
  144. local xVelocity         = {
  145.     ["english"]         = 0x400880,
  146.     ["englishK"]        = 0x400150,
  147.     ["englishGCN"]      = 0x39AFC0,
  148.     ["japanese"]        = 0x400A70,
  149.     ["japaneseA"]       = 0x400D30,
  150.     ["japaneseGCN"]     = 0x000000,
  151.     ["european"]        = 0x3F7D20,
  152.     ["europeanA"]       = 0x3F80C0,
  153.     ["europeanGCN"]     = 0x000000,
  154.     ["europeanD"]       = 0x000000
  155. }
  156. local yVelocity         = {
  157.     ["english"]         = 0x3FFE18,
  158.     ["englishK"]        = 0x3FF6E8,
  159.     ["englishGCN"]      = 0x39A558,
  160.     ["japanese"]        = 0x400008,
  161.     ["japaneseA"]       = 0x4002C8,
  162.     ["japaneseGCN"]     = 0x000000,
  163.     ["european"]        = 0x3F72B8,
  164.     ["europeanA"]       = 0x3F7658,
  165.     ["europeanGCN"]     = 0x000000,
  166.     ["europeanD"]       = 0x000000
  167. }
  168.  
  169. local isPressed         = false
  170. local location          = 1
  171. local scenes            = {
  172.     [1]                 = 54816,
  173.     ["1"]               = "North Clock Town",
  174.     [2]                 = 55296,
  175.     ["2"]               = "South Clock Town",
  176.     [3]                 = 53808,
  177.     ["3"]               = "East Clock Town",
  178.     [4]                 = 54304,
  179.     ["4"]               = "West Clock Town",
  180.     [5]                 = 33792,
  181.     ["5"]               = "Southern Swamp",
  182.     [6]                 = 49664,
  183.     ["6"]               = "Woods of Mystery",
  184.     [7]                 = 20480,
  185.     ["7"]               = "Deku Palace (Swamp)",
  186.     [8]                 = 20592,
  187.     ["8"]               = "Deku Palace (Grotto)",
  188.     [9]                 = 39520,
  189.     ["9"]               = "Mountain Village",
  190.     [10]                = 37888,
  191.     ["10"]              = "Goron Village",
  192.     [11]                = 15872,
  193.     ["11"]              = "Milk Road",
  194.     [12]                = 25600,
  195.     ["12"]              = "Romani Ranch",
  196.     [13]                = 26624,
  197.     ["13"]              = "Great Bay Coast",
  198.     [14]                = 22528,
  199.     ["14"]              = "Marine Research Lab",
  200.     [15]                = 28672,
  201.     ["15"]              = "Pirate's Fortress (Exterior)",
  202.     [16]                = 16528,
  203.     ["16"]              = "Pirate's Fortress (Sewers)",
  204.     [17]                = 8704,
  205.     ["17"]              = "Pirate's Fortress (Interior)",
  206.     [18]                = 16384,
  207.     ["18"]              = "Pirate's Fortress (Hookshot)",
  208.     [19]                = 17408,
  209.     ["19"]              = "Pinnacle Rock",
  210.     [20]                = 27136,
  211.     ["20"]              = "Zora Cape",
  212.     [21]                = 27168,
  213.     ["21"]              = "Zora Cape (Turtle)",
  214.     [22]                = 24576,
  215.     ["22"]              = "Zora Hall",
  216.     [23]                = 36352,
  217.     ["23"]              = "Waterfall Rapids",
  218.     [24]                = 32768,
  219.     ["24"]              = "Ikana Graveyard",
  220.     [25]                = 2576,
  221.     ["25"]              = "Grave (Day 1)",
  222.     [26]                = 2560,
  223.     ["26"]              = "Grave (Day 2)",
  224.     [27]                = 23056,
  225.     ["27"]              = "Dampe's House",
  226.     [28]                = 8256,
  227.     ["28"]              = "Ikana Canyon",
  228.     [29]                = 36864,
  229.     ["29"]              = "Beneath the Well",
  230.     [30]                = 38912,
  231.     ["30"]              = "Sakon's Hideout",
  232.     [31]                = 47616,
  233.     ["31"]              = "Secret Shrine",
  234.     [32]                = 43568,
  235.     ["32"]              = "Stone Tower",
  236.     [33]                = 13328,
  237.     ["33"]              = "Ancient Castle of Ikana",
  238.     [34]                = 12288,
  239.     ["34"]              = "Woodfall Temple",
  240.     [35]                = 15360,
  241.     ["35"]              = "Snowhead Temple",
  242.     [36]                = 35840,
  243.     ["36"]              = "Great Bay Temple",
  244.     [37]                = 9728,
  245.     ["37"]              = "Stone Tower Temple",
  246.     [38]                = 10752,
  247.     ["38"]              = "Inverted Stone Tower Temple",
  248.     [39]                = 14336,
  249.     ["39"]              = "Odolwa's Room",
  250.     [40]                = 33280,
  251.     ["40"]              = "Goht's Room",
  252.     [41]                = 47104,
  253.     ["41"]              = "Gyorg's Room",
  254.     [42]                = 26112,
  255.     ["42"]              = "Twinmold's Room",
  256.     [43]                = 42496,
  257.     ["43"]              = "Igo's Du Ikana Room",
  258.     [44]                = 512,
  259.     ["44"]              = "Majora's Room",
  260.     [45]                = 18432,
  261.     ["45"]              = "Swamp Spider House",
  262.     [46]                = 18944,
  263.     ["46"]              = "Ocean Spider House",
  264.     [47]                = 51200,
  265.     ["47"]              = "Moon",
  266.     [48]                = 19968,
  267.     ["48"]              = "Woodfall Trial",
  268.     [49]                = 30720,
  269.     ["49"]              = "Snowhead Trial",
  270.     [50]                = 34816,
  271.     ["50"]              = "Great Bay Trial",
  272.     [51]                = 50688,
  273.     ["51"]              = "Stone Tower Trial",
  274. }
  275.  
  276. -- Anchor for Text Display
  277. local x                 = 1
  278. local y                 = 65
  279.  
  280. function setLocation(i)
  281.  
  282.     isPressed = true
  283.     location = location + i
  284.    
  285.     if (location < 1) then
  286.         location = table.getn(scenes)
  287.     elseif (location > table.getn(scenes)) then
  288.         location = 1
  289.     end
  290.  
  291. end
  292.  
  293. function warp(i)
  294.  
  295.     memory.write_u32_be(entranceSetter[version], scenes[i])
  296.     memory.write_u8(loadFlag[version], 20)
  297.  
  298. end
  299.  
  300. function textDisplay()
  301.  
  302.     -- Text Display
  303.     gui.drawText(x + 1, y + 1, string.format("Scene:"), "BLACK")
  304.     gui.drawText(x, y, string.format("Scene:"))
  305.     gui.drawText(x + 101, y + 1, string.format("%04s", bizstring.hex(memory.read_u16_be(scene[version]))), "BLACK")
  306.     gui.drawText(x + 100, y, string.format("%04s", bizstring.hex(memory.read_u16_be(scene[version]))))
  307.    
  308.     gui.drawText(x + 1, y + 13, string.format("Entrance:"), "BLACK")
  309.     gui.drawText(x, y + 12, string.format("Entrance:"))
  310.     gui.drawText(x + 101, y + 13, string.format("%04s", bizstring.hex(memory.read_u32_be(entranceLast[version]))), "BLACK")
  311.     gui.drawText(x + 100, y + 12, string.format("%04s", bizstring.hex(memory.read_u32_be(entranceLast[version]))))
  312.    
  313.     gui.drawText(x + 1, y + 25, string.format("Setter:"), "BLACK")
  314.     gui.drawText(x, y + 24, string.format("Setter:"))
  315.     gui.drawText(x + 101, y + 25, string.format("%04s", bizstring.hex(memory.read_u32_be(entranceSetter[version]))), "BLACK")
  316.     gui.drawText(x + 100, y + 24, string.format("%04s", bizstring.hex(memory.read_u32_be(entranceSetter[version]))))
  317.    
  318.     gui.drawText(x + 1, y + 43, string.format("X:"), "BLACK")
  319.     gui.drawText(x, y + 42, string.format("X:"))
  320.     gui.drawText(x + 78, y + 43, string.format("% 7.1f", memory.readfloat(xCoordinate[version], true)), "BLACK")
  321.     gui.drawText(x + 77, y + 42, string.format("% 7.1f", memory.readfloat(xCoordinate[version], true)))
  322.    
  323.     gui.drawText(x + 1, y + 55, string.format("Y:"), "BLACK")
  324.     gui.drawText(x, y + 54, string.format("Y:"))
  325.     gui.drawText(x + 78, y + 55, string.format("% 7.1f", memory.readfloat(yCoordinate[version], true)), "BLACK")
  326.     gui.drawText(x + 77, y + 54, string.format("% 7.1f", memory.readfloat(yCoordinate[version], true)))
  327.    
  328.     gui.drawText(x + 1, y + 67, string.format("Z:"), "BLACK")
  329.     gui.drawText(x, y + 66, string.format("Z:"))
  330.     gui.drawText(x + 78, y + 67, string.format("% 7.1f", memory.readfloat(zCoordinate[version], true)), "BLACK")
  331.     gui.drawText(x + 77, y + 66, string.format("% 7.1f", memory.readfloat(zCoordinate[version], true)))
  332.    
  333.     gui.drawText(x + 1, y + 79, string.format("V (X):"), "BLACK")
  334.     gui.drawText(x, y + 78, string.format("V (X):"))
  335.     gui.drawText(x + 93, y + 79, string.format("% 5.1f", memory.readfloat(xVelocity[version], true)), "BLACK")
  336.     gui.drawText(x + 92, y + 78, string.format("% 5.1f", memory.readfloat(xVelocity[version], true)))
  337.    
  338.     gui.drawText(x + 1, y + 91, string.format("V (Y):"), "BLACK")
  339.     gui.drawText(x, y + 90, string.format("V (Y):"))
  340.     gui.drawText(x + 93, y + 91, string.format("% 5.1f", memory.readfloat(yVelocity[version], true)), "BLACK")
  341.     gui.drawText(x + 92, y + 90, string.format("% 5.1f", memory.readfloat(yVelocity[version], true)))
  342.    
  343.     gui.drawText(x + 1, y + 109, string.format("Angle:"), "BLACK")
  344.     gui.drawText(x, y + 108, string.format("Angle:"))
  345.     gui.drawText(x + 93, y + 109, string.format("%05d", memory.read_u16_be(facingAngle[version])), "BLACK")
  346.     gui.drawText(x + 92, y + 108, string.format("%05d", memory.read_u16_be(facingAngle[version])))
  347.    
  348.     gui.drawText(x + 1, y + 127, string.format("Warp Destination:"), "BLACK")
  349.     gui.drawText(x, y + 126, string.format("Warp Destination:"))
  350.     gui.drawText(x + 1, y + 139, string.format("%s", scenes["" .. location]), "BLACK")
  351.     gui.drawText(x, y + 138, string.format("%s", scenes["" .. location]))
  352.  
  353. end
  354.  
  355. while true do
  356.    
  357.     -- Warping
  358.     if input.get().PageUp == true and isPressed == false then
  359.         setLocation(-1)
  360.     elseif input.get().PageDown == true and isPressed == false then
  361.         setLocation(1)
  362.     elseif input.get().Home == true and isPressed == false then
  363.         warp(location)
  364.     elseif input.get().PageUp == null and input.get().PageDown == null and input.get().Home == null then   
  365.         isPressed = false
  366.     end
  367.    
  368.     textDisplay()
  369.    
  370.     emu.frameadvance()
  371.        
  372. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement