do local RedPotionBottle = { __tag = "RedPotionBottle" } local DinsFire = { __tag = "DinsFire" } local EyeballFrog = { __tag = "EyeballFrog" } local SkullMask = { __tag = "SkullMask" } local NoItem = { __tag = "NoItem" } local HylianShield = { __tag = "HylianShield" } local EmptyBottle = { __tag = "EmptyBottle" } local FireArrow = { __tag = "FireArrow" } local Prescription = { __tag = "Prescription" } local KeatonMask = { __tag = "KeatonMask" } local function UnknownItem(a) return { __tag = "UnknownItem", a } end local function UnknownBoots(a) return { __tag = "UnknownBoots", a } end local function P(a) return function(b) return { __tag = "P", a, b } end end local DekuShield = { __tag = "DekuShield" } local NayrusLove = { __tag = "NayrusLove" } local FairyBow = { __tag = "FairyBow" } local BrokenGoronsSword = { __tag = "BrokenGoronsSword" } local ZeldasLetter = { __tag = "ZeldasLetter" } local HoverBoots = { __tag = "HoverBoots" } local function S(a) return function(b) return { __tag = "S", a, b } end end local NoShield = { __tag = "NoShield" } local function MkSome(a) return function(b) return { __tag = "MkSome", a, b } end end local LightArrow = { __tag = "LightArrow" } local Bomb = { __tag = "Bomb" } local PoachersSaw = { __tag = "PoachersSaw" } local Chicken = { __tag = "Chicken" } local IronBoots = { __tag = "IronBoots" } local Proxy = { __tag = "Proxy" } local FishBottle = { __tag = "FishBottle" } local Bombchu_10 = { __tag = "Bombchu_10" } local FairyBowAndIceArrow = { __tag = "FairyBowAndIceArrow" } local ZoraMask = { __tag = "ZoraMask" } local function Some(a) return { __tag = "Some", a } end local KokiriTunic = { __tag = "KokiriTunic" } local FairyBottle = { __tag = "FairyBottle" } local OcarinaOfTime = { __tag = "OcarinaOfTime" } local FairyBowAndFireArrow = { __tag = "FairyBowAndFireArrow" } local GoronMask = { __tag = "GoronMask" } local BluePotionBottle = { __tag = "BluePotionBottle" } local FairyOcarina = { __tag = "FairyOcarina" } local ClaimCheck = { __tag = "ClaimCheck" } local BunnyHood = { __tag = "BunnyHood" } local GreenPotionBottle = { __tag = "GreenPotionBottle" } local FairySlingshot = { __tag = "FairySlingshot" } local EyeDrops = { __tag = "EyeDrops" } local SpookyMask = { __tag = "SpookyMask" } local MirrorShield = { __tag = "MirrorShield" } local BugBottle = { __tag = "BugBottle" } local FaroresWind = { __tag = "FaroresWind" } local GoronsSword = { __tag = "GoronsSword" } local Nil = { __tag = "Nil" } local PocketEgg = { __tag = "PocketEgg" } local NoSword = { __tag = "NoSword" } local BlueFireBottle = { __tag = "BlueFireBottle" } local IceArrow = { __tag = "IceArrow" } local MasterSword0 = { __tag = "MasterSword0" } local SoldOut = { __tag = "SoldOut" } local function UnknownTunic(a) return { __tag = "UnknownTunic", a } end local RutosLetterBottle = { __tag = "RutosLetterBottle" } local Longshot = { __tag = "Longshot" } local KokiriSword0 = { __tag = "KokiriSword0" } local MaskOfTruth = { __tag = "MaskOfTruth" } local ZoraTunic = { __tag = "ZoraTunic" } local FullMilkBottle = { __tag = "FullMilkBottle" } local Hookshot = { __tag = "Hookshot" } local FairyBowAndLightArrow = { __tag = "FairyBowAndLightArrow" } local GerudoMask = { __tag = "GerudoMask" } local None = { __tag = "None" } local GoronTunic = { __tag = "GoronTunic" } local WeirdEgg = { __tag = "WeirdEgg" } local MegatonHammer = { __tag = "MegatonHammer" } local OddPotion = { __tag = "OddPotion" } local DekuNut = { __tag = "DekuNut" } local KokiriBoots = { __tag = "KokiriBoots" } local PoeBottle = { __tag = "PoeBottle" } local function _TypeRep(x) return { { name = x.name .. "#" .. x.fingerprint }, __tag = "TypeRep" } end local MagicBean = { __tag = "MagicBean" } local OddMushroom = { __tag = "OddMushroom" } local DekuStick = { __tag = "DekuStick" } local BiggoronsSword = { __tag = "BiggoronsSword" } local HalfMilkBottle = { __tag = "HalfMilkBottle" } local function __eq_type_rep(tr_a, tr_b, keq, kne) if tr_a[1].name == tr_b[1].name then return keq()() else return kne() end end local LensOfTruth = { __tag = "LensOfTruth" } local Cojiro = { __tag = "Cojiro" } local function Array(a) return { __tag = "Array", a } end local MasterSword = { __tag = "MasterSword" } local BigPoeBottle = { __tag = "BigPoeBottle" } local function _Typeable_app(pair) local ta, tb = pair._1[1], pair._2[1] return { { name = "(" .. ta.name .. ") :$ (" .. tb.name .. ")" }, __tag = "TypeRep" } end local Boomerang = { __tag = "Boomerang" } local PocketCucco = { __tag = "PocketCucco" } local KokiriSword = { __tag = "KokiriSword" } local string_of_int = tostring local function _dollarshow(htw) local function loop(acc, x) if x.__tag ~= "Cons" then return acc .. "]" end local tmp = x[1] local x0, xs = tmp._1, tmp._2 if acc == "" then return loop(htw(x0), xs) end return loop(acc .. ", " .. htw(x0), xs) end return function(x) return "[" .. loop("", x) end end local function _colon_colon(x) return function(xs) return { { _1 = x, _2 = xs }, __tag = "Cons" } end end local function _dollardExceptionlxh(tmp) return { from_exception = function(x) return Some(x) end, ["Exception$lmq"] = _Typeable_app({ _1 = (function(tmp0) return _TypeRep({ fingerprint = 271, name = "some" }) end)(), _2 = (function(tmp0) return _TypeRep({ fingerprint = 276, name = "exception" }) end)() }), describe_exception = function(tmp0) return tmp0[1].describe_exception(tmp0[2]) end, into_exception = function(x) return x end } end local function from_exception(mqy, mtr) local tmp = (function(tmp) return _TypeRep({ fingerprint = 304, name = "user_error" }) end)() local x = mtr[2] return __eq_type_rep((function() return mtr[1]["Exception$lmq"] end)(Proxy), (function() return tmp end)(Proxy), function(tmp0) return function(tmp1) return Some(x) end end, function(tmp0) return None end) end local function from_exception0(mqy) return function(mtr) return from_exception(mqy, mtr) end end local function _dollardExceptionmqb(tmp) return { describe_exception = function(tmp0) return "User error: " .. tmp0 end, ["Exception$lmq"] = (function(tmp0) return _TypeRep({ fingerprint = 304, name = "user_error" }) end)(), into_exception = function(muh) return MkSome(_dollardExceptionmqb(nil))(muh) end, from_exception = from_exception0(tmp) } end local function from_exception1(npl, nse) local x = nse[2] local tmp = (function(tmp) return _TypeRep({ fingerprint = 314, name = "invalid_arg" }) end)() return __eq_type_rep((function() return nse[1]["Exception$lmq"] end)(Proxy), (function() return tmp end)(Proxy), function(tmp0) return function(tmp1) return Some(x) end end, function(tmp0) return None end) end local function from_exception2(npl) return function(nse) return from_exception1(npl, nse) end end local function _dollardExceptionnoo(tmp) return { into_exception = function(nsu) return MkSome(_dollardExceptionnoo(nil))(nsu) end, from_exception = from_exception2(tmp), describe_exception = function(tmp0) return "Invalid argument to function " .. tmp0 end, ["Exception$lmq"] = (function(tmp0) return _TypeRep({ fingerprint = 314, name = "invalid_arg" }) end)() } end local function _dollarfoldr(uxs) return function(f) return function(z) local function loop(k, x) if x.__tag ~= "Cons" then return k(z) end local tmp = x[1] local x0 = tmp._1 return loop(function(r) return k(f(x0)(r)) end, tmp._2) end return function(x) return loop(function(x0) return x0 end, x) end end end end local _dollardFoldableuws, foldl1, foldl10 _dollardFoldableuws = function(tmp) return { foldl1 = foldl1(tmp), foldr = _dollarfoldr(tmp), ["Foldable$ueq"] = function(f) return function(xs) local function biu(xss) if xss.__tag ~= "Cons" then return Nil end local tmp0 = xss[1] return { { _1 = f(tmp0._1), _2 = biu(tmp0._2) }, __tag = "Cons" } end return biu(xs) end end, foldl = function(f) local function loop(z) return function(x) if x.__tag ~= "Cons" then return z end local tmp0 = x[1] return loop(f(z)(tmp0._1))(tmp0._2) end end return loop end } end foldl1 = function(uxs) return function(vji) return function(vjj) return foldl10(uxs, vji, vjj) end end end foldl10 = function(uxs, vji, vjj) local tmp = _dollardFoldableuws(nil).foldl(function(m) return function(y) if m.__tag == "None" then return Some(y) end return Some(vji(m[1])(y)) end end)(None)(vjj) if tmp.__tag == "None" then return error(setmetatable(_dollardExceptionmqb(nil).into_exception("foldl1: empty structure"), { __tostring = _dollardExceptionlxh(nil).describe_exception })) end return tmp[1] end local io_stdout = io.stdout local io_stderr = io.stderr local io_stdin = io.stdin local read_value_8 = ReadValue8 local read_value_16 = ReadValue16 local read_value_32 = ReadValue32 local set_screen_text = SetScreenText local tabulate = function(index, cont) local r = {} for i = 1 , index , 1 do r[i] = cont(i) end return r end local geti = rawget local function init(len, gen) if not (len < 0) then return Array({ length = len, backing = tabulate(len, function(i) return gen(i - 1) end) }) end error(setmetatable(_dollardExceptionnoo(nil).into_exception("init: can't initialise array of size " .. string_of_int(len)), { __tostring = _dollardExceptionlxh(nil).describe_exception })) return Array({ length = len, backing = tabulate(len, function(i) return gen(i - 1) end) }) end local function _dollarfoldl(aptq) return function(func) return function(acc) return function(tmp) local tmp0 = tmp[1] local backing, length = tmp0.backing, tmp0.length local function loop(acc0, i) if i > length then return acc0 end return loop(func(acc0)(geti(backing, i)), i + 1) end return loop(acc, 1) end end end end local function _dollarfoldr0(aptq) return function(func) return function(acc) return function(tmp) local tmp0 = tmp[1] local backing = tmp0.backing local function loop(acc0, i) if i < 1 then return acc0 end return loop(func(geti(backing, i))(acc0), i - 1) end return loop(acc, tmp0.length) end end end end local _dollardFoldableapsn, foldl11, foldl12 _dollardFoldableapsn = function(tmp) return { foldl1 = foldl11(tmp), foldr = _dollarfoldr0(tmp), foldl = _dollarfoldl(tmp), ["Foldable$ueq"] = function(f) return function(tmp0) local tmp1 = tmp0[1] local backing, length = tmp1.backing, tmp1.length return Array({ length = length, backing = tabulate(length, function(i) return f(geti(backing, i)) end) }) end end } end foldl11 = function(aptq) return function(aqhu) return function(aqhv) return foldl12(aptq, aqhu, aqhv) end end end foldl12 = function(aptq, aqhu, aqhv) local tmp = _dollardFoldableapsn(nil).foldl(function(m) return function(y) if m.__tag == "None" then return Some(y) end return Some(aqhu(m[1])(y)) end end)(None)(aqhv) if tmp.__tag == "None" then return error(setmetatable(_dollardExceptionmqb(nil).into_exception("foldl1: empty structure"), { __tostring = _dollardExceptionlxh(nil).describe_exception })) end return tmp[1] end local function pretty_from_record(ahma, a, w) local function smul(s, n) if n <= 0 then return "" end return s .. smul(s, n - 1) end local prep = smul(" ", w) local rf = ahma.fields(a) local x = w + 2 return ahma.name(a) .. " {\n" .. _dollardFoldableuws(nil).foldl(function(acc) return function(f) local name = f._1 local field = f._2 if field.__tag == "S" then return acc .. prep .. " " .. (name .. " = " .. field[1](field[2])) .. ",\n" end return acc .. prep .. " " .. (name .. " = " .. field[1](field[2])(x)) .. ",\n" end end)("")(rf) .. prep .. "}" end local function pretty_from_record0(ahma) return function(a) return function(w) return pretty_from_record(ahma, a, w) end end end local function _dollardecode(asjd, addr) local tmp2 = init(24, function(i) return read_value_8(addr + i) end) local tmp4 = init(16, function(i) local u8 = read_value_8(addr + 24 + i) if u8 > 255 then return 0 - (256 - u8) end return u8 end) local tmp3 = read_value_16(addr + 40) local tmp = read_value_32(addr + 44) local tmp5 = read_value_32(addr + 48) local tmp0 = init(20, function(i) return read_value_8(addr + 52 + i) end) local tmp1 = init(19, function(i) local u8 = read_value_8(addr + 72 + i) if u8 > 255 then return 0 - (256 - u8) end return u8 end) local u8 = read_value_8(addr + 91) local function tmp6(tmp6) local u16 = read_value_16(addr + 92) if u16 > 65535 then return { items = tmp2, ammo = tmp4, equipment = tmp3, upgrades = tmp, quest_items = tmp5, dungeon_items = tmp0, dungeon_keys = tmp1, defense_hearts = tmp6, gs_tokens = 0 - (65536 - u16) } end return { items = tmp2, ammo = tmp4, equipment = tmp3, upgrades = tmp, quest_items = tmp5, dungeon_items = tmp0, dungeon_keys = tmp1, defense_hearts = tmp6, gs_tokens = u16 } end if u8 > 255 then return tmp6(0 - (256 - u8)) end return tmp6(u8) end local function _dollarfields(assv, tmp) local function tmp0(tmp0) return string_of_int(tmp0) .. "_u8" end local function tmp2(tmp2) return string_of_int(tmp2) .. "_u8" end local function tmp3(tmp3) return string_of_int(tmp3) .. "_s8" end local function tmp1(tmp1) return string_of_int(tmp1) .. "_s8" end return { { _1 = { _1 = "items", _2 = S(function(arr) return "to_list " .. _dollarshow(tmp0)(_dollardFoldableapsn(nil).foldr(_colon_colon)(Nil)(arr)) end)(tmp.items) }, _2 = { { _2 = { { _1 = { _1 = "equipment", _2 = S(function(tmp2) return string_of_int(tmp2) .. "_u16" end)(tmp.equipment) }, _2 = { { _2 = { { _2 = { { _1 = { _1 = "dungeon_items", _2 = S(function(arr) return "to_list " .. _dollarshow(tmp2)(_dollardFoldableapsn(nil).foldr(_colon_colon)(Nil)(arr)) end)(tmp.dungeon_items) }, _2 = { { _1 = { _1 = "dungeon_keys", _2 = S(function(arr) return "to_list " .. _dollarshow(tmp3)(_dollardFoldableapsn(nil).foldr(_colon_colon)(Nil)(arr)) end)(tmp.dungeon_keys) }, _2 = { { _2 = { { _1 = { _1 = "gs_tokens", _2 = S(function(tmp4) return string_of_int(tmp4) .. "_s16" end)(tmp.gs_tokens) }, _2 = Nil }, __tag = "Cons" }, _1 = { _1 = "defense_hearts", _2 = S(function(tmp4) return string_of_int(tmp4) .. "_s8" end)(tmp.defense_hearts) } }, __tag = "Cons" } }, __tag = "Cons" } }, __tag = "Cons" }, _1 = { _1 = "quest_items", _2 = S(function(tmp2) return string_of_int(tmp2) .. "_u32" end)(tmp.quest_items) } }, __tag = "Cons" }, _1 = { _1 = "upgrades", _2 = S(function(tmp2) return string_of_int(tmp2) .. "_u32" end)(tmp.upgrades) } }, __tag = "Cons" } }, __tag = "Cons" }, _1 = { _1 = "ammo", _2 = S(function(arr) return "to_list " .. _dollarshow(tmp1)(_dollardFoldableapsn(nil).foldr(_colon_colon)(Nil)(arr)) end)(tmp.ammo) } }, __tag = "Cons" } }, __tag = "Cons" } end local _dot_greater_greater_dot = function(a, b) return a >> b end local _dot_amp_dot = function(a, b) return a & b end local function _dollardecode0(allb, addr) local code = read_value_16(addr) local sword_index = _dot_amp_dot(_dot_greater_greater_dot(code, 0), 15) local shield_index = _dot_amp_dot(_dot_greater_greater_dot(code, 4), 15) local tunic_index = _dot_amp_dot(_dot_greater_greater_dot(code, 8), 15) local boots_index = _dot_amp_dot(_dot_greater_greater_dot(code, 12), 15) local function tmp(tmp) local function tmp0(tmp0) if tunic_index == 1 then if boots_index == 1 then return { sword = tmp, shield = tmp0, tunic = KokiriTunic, boots = KokiriBoots } elseif boots_index == 2 then return { sword = tmp, shield = tmp0, tunic = KokiriTunic, boots = IronBoots } elseif boots_index == 3 then return { sword = tmp, shield = tmp0, tunic = KokiriTunic, boots = HoverBoots } else return { sword = tmp, shield = tmp0, tunic = KokiriTunic, boots = UnknownBoots(boots_index) } end elseif tunic_index == 2 then if boots_index == 1 then return { sword = tmp, shield = tmp0, tunic = GoronTunic, boots = KokiriBoots } elseif boots_index == 2 then return { sword = tmp, shield = tmp0, tunic = GoronTunic, boots = IronBoots } elseif boots_index == 3 then return { sword = tmp, shield = tmp0, tunic = GoronTunic, boots = HoverBoots } else return { sword = tmp, shield = tmp0, tunic = GoronTunic, boots = UnknownBoots(boots_index) } end elseif tunic_index == 3 then if boots_index == 1 then return { sword = tmp, shield = tmp0, tunic = ZoraTunic, boots = KokiriBoots } elseif boots_index == 2 then return { sword = tmp, shield = tmp0, tunic = ZoraTunic, boots = IronBoots } elseif boots_index == 3 then return { sword = tmp, shield = tmp0, tunic = ZoraTunic, boots = HoverBoots } else return { sword = tmp, shield = tmp0, tunic = ZoraTunic, boots = UnknownBoots(boots_index) } end else local tmp1 = UnknownTunic(tunic_index) if boots_index == 1 then return { sword = tmp, shield = tmp0, tunic = tmp1, boots = KokiriBoots } elseif boots_index == 2 then return { sword = tmp, shield = tmp0, tunic = tmp1, boots = IronBoots } elseif boots_index == 3 then return { sword = tmp, shield = tmp0, tunic = tmp1, boots = HoverBoots } else return { sword = tmp, shield = tmp0, tunic = tmp1, boots = UnknownBoots(boots_index) } end end end if shield_index == 0 then return tmp0(NoShield) elseif shield_index == 1 then return tmp0(DekuShield) elseif shield_index == 2 then return tmp0(HylianShield) elseif shield_index == 3 then return tmp0(MirrorShield) else return error("Pattern matching failure in match expression at oot\\equipment.ml[41:25 ..45:19]") end end if sword_index == 0 then return tmp(NoSword) elseif sword_index == 1 then return tmp(KokiriSword) elseif sword_index == 2 then return tmp(MasterSword) elseif sword_index == 3 then return tmp(BiggoronsSword) else return error("Pattern matching failure in match expression at oot\\equipment.ml[21:24 ..25:21]") end end local function _dollarfields0(alrp, tmp) return { { _2 = { { _2 = { { _2 = { { _2 = Nil, _1 = { _1 = "boots", _2 = S(function(x) if x.__tag == "KokiriBoots" then return "Kokiri Boots" elseif x.__tag == "IronBoots" then return "Iron Boots" elseif x.__tag == "HoverBoots" then return "Hover Boots" elseif x.__tag == "UnknownBoots" then return "Unknown Boots " .. string_of_int(x[1]) end end)(tmp.boots) } }, __tag = "Cons" }, _1 = { _1 = "tunic", _2 = S(function(x) if x.__tag == "GoronTunic" then return "Goron Tunic" elseif x.__tag == "ZoraTunic" then return "Zora Tunic" elseif x.__tag == "UnknownTunic" then return "Unknown Tunic " .. string_of_int(x[1]) elseif x.__tag == "KokiriTunic" then return "Kokiri Tunic" end end)(tmp.tunic) } }, __tag = "Cons" }, _1 = { _1 = "shield", _2 = S(function(x) if x.__tag == "MirrorShield" then return "Mirror Shield" elseif x.__tag == "NoShield" then return "No Shield" elseif x.__tag == "DekuShield" then return "Deku Shield" elseif x.__tag == "HylianShield" then return "Hylian Shield" end end)(tmp.shield) } }, __tag = "Cons" }, _1 = { _1 = "sword", _2 = S(function(x) if x.__tag == "KokiriSword" then return "Kokiri Sword" elseif x.__tag == "MasterSword" then return "Master Sword" elseif x.__tag == "BiggoronsSword" then return "Biggoron's Sword" elseif x.__tag == "NoSword" then return "No Sword" end end)(tmp.sword) } }, __tag = "Cons" } end local function _dollardShowakjw(tmp) return function(x) if x.__tag == "PocketCucco" then return "Pocket Cucco" elseif x.__tag == "Boomerang" then return "Boomerang" elseif x.__tag == "BigPoeBottle" then return "Big Poe" elseif x.__tag == "Cojiro" then return "Cojiro" elseif x.__tag == "LensOfTruth" then return "Lens of Truth" elseif x.__tag == "HalfMilkBottle" then return "Half Lon Lon Milk" elseif x.__tag == "DekuStick" then return "Deku Stick" elseif x.__tag == "OddMushroom" then return "Odd Mushroom" elseif x.__tag == "MagicBean" then return "Magic Bean" elseif x.__tag == "PoeBottle" then return "Poe" elseif x.__tag == "DekuNut" then return "Deku Nut" elseif x.__tag == "OddPotion" then return "Odd Potion" elseif x.__tag == "MegatonHammer" then return "Megaton Hammer" elseif x.__tag == "WeirdEgg" then return "Weird Egg" elseif x.__tag == "GerudoMask" then return "Gerudo Mask" elseif x.__tag == "FairyBowAndLightArrow" then return "Fairy Bow & Light Arrow" elseif x.__tag == "Hookshot" then return "Hookshot" elseif x.__tag == "FullMilkBottle" then return "Lon Lon Milk" elseif x.__tag == "MaskOfTruth" then return "Mask of Truth" elseif x.__tag == "KokiriSword0" then return "Kokiri Sword" elseif x.__tag == "Longshot" then return "Longshot" elseif x.__tag == "RutosLetterBottle" then return "Ruto's Letter" elseif x.__tag == "SoldOut" then return "SOLD OUT" elseif x.__tag == "MasterSword0" then return "Master Sword" elseif x.__tag == "IceArrow" then return "Ice Arrow" elseif x.__tag == "BlueFireBottle" then return "Blue Fire" elseif x.__tag == "PocketEgg" then return "Pocket Egg" elseif x.__tag == "GoronsSword" then return "Giant's Knife & Biggoron's Sword" elseif x.__tag == "FaroresWind" then return "Farore's Wind" elseif x.__tag == "BugBottle" then return "Bug" elseif x.__tag == "SpookyMask" then return "Spooky Mask" elseif x.__tag == "EyeDrops" then return "Eye Drops" elseif x.__tag == "FairySlingshot" then return "Fairy Slingshot" elseif x.__tag == "GreenPotionBottle" then return "Green Potion" elseif x.__tag == "BunnyHood" then return "Bunny Hood" elseif x.__tag == "ClaimCheck" then return "Claim Check" elseif x.__tag == "FairyOcarina" then return "Fairy Ocarina" elseif x.__tag == "BluePotionBottle" then return "Blue Potion" elseif x.__tag == "GoronMask" then return "Goron Mask" elseif x.__tag == "FairyBowAndFireArrow" then return "Fairy Bow & Fire Arrow" elseif x.__tag == "OcarinaOfTime" then return "Ocarina of Time" elseif x.__tag == "FairyBottle" then return "Bottled Fairy" elseif x.__tag == "ZoraMask" then return "Zora Mask" elseif x.__tag == "FairyBowAndIceArrow" then return "Fairy Bow & Ice Arrow" elseif x.__tag == "Bombchu_10" then return "Bombchu (10)" elseif x.__tag == "FishBottle" then return "Fish" elseif x.__tag == "Chicken" then return "Chicken" elseif x.__tag == "PoachersSaw" then return "Poacher's Saw" elseif x.__tag == "Bomb" then return "Bomb" elseif x.__tag == "LightArrow" then return "Light Arrow" elseif x.__tag == "ZeldasLetter" then return "Zelda's Letter" elseif x.__tag == "BrokenGoronsSword" then return "Broken Giant's Knife" elseif x.__tag == "FairyBow" then return "Fairy Bow" elseif x.__tag == "NayrusLove" then return "Nayru's Love" elseif x.__tag == "UnknownItem" then return "Unknown Item " .. string_of_int(x[1]) elseif x.__tag == "KeatonMask" then return "Keaton Mask" elseif x.__tag == "Prescription" then return "Prescription" elseif x.__tag == "FireArrow" then return "Fire Arrow" elseif x.__tag == "EmptyBottle" then return "Empty Bottle" elseif x.__tag == "NoItem" then return "No Item" elseif x.__tag == "SkullMask" then return "Skull Mask" elseif x.__tag == "EyeballFrog" then return "Eyeball Frog" elseif x.__tag == "DinsFire" then return "Din's Fire" elseif x.__tag == "RedPotionBottle" then return "Red Potion" else return error("Pattern matching failure in match expression at oot\\item.ml[232:14 ..296:53]") end end end local function _dollardecode1(alyz, addr) local code = read_value_8(addr) local function tmp(tmp) local code = read_value_8(addr + 1) local function tmp0(tmp0) local code = read_value_8(addr + 2) local function tmp1(tmp1) local code = read_value_8(addr + 3) if code == 0 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = DekuStick } elseif code == 1 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = DekuNut } elseif code == 2 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = Bomb } elseif code == 3 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = FairyBow } elseif code == 4 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = FireArrow } elseif code == 5 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = DinsFire } elseif code == 6 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = FairySlingshot } elseif code == 7 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = FairyOcarina } elseif code == 8 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = OcarinaOfTime } elseif code == 9 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = Bombchu_10 } elseif code == 10 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = Hookshot } elseif code == 11 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = Longshot } elseif code == 12 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = IceArrow } elseif code == 13 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = FaroresWind } elseif code == 14 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = Boomerang } elseif code == 15 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = LensOfTruth } elseif code == 16 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = MagicBean } elseif code == 17 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = MegatonHammer } elseif code == 18 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = LightArrow } elseif code == 19 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = NayrusLove } elseif code == 20 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = EmptyBottle } elseif code == 21 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = RedPotionBottle } elseif code == 22 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = GreenPotionBottle } elseif code == 23 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = BluePotionBottle } elseif code == 24 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = FairyBottle } elseif code == 25 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = FishBottle } elseif code == 26 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = FullMilkBottle } elseif code == 27 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = RutosLetterBottle } elseif code == 28 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = BlueFireBottle } elseif code == 29 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = BugBottle } elseif code == 30 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = BigPoeBottle } elseif code == 31 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = HalfMilkBottle } elseif code == 32 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = PoeBottle } elseif code == 33 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = WeirdEgg } elseif code == 34 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = Chicken } elseif code == 35 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = ZeldasLetter } elseif code == 36 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = KeatonMask } elseif code == 37 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = SkullMask } elseif code == 38 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = SpookyMask } elseif code == 39 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = BunnyHood } elseif code == 40 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = GoronMask } elseif code == 41 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = ZoraMask } elseif code == 42 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = GerudoMask } elseif code == 43 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = MaskOfTruth } elseif code == 44 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = SoldOut } elseif code == 45 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = PocketEgg } elseif code == 46 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = PocketCucco } elseif code == 47 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = Cojiro } elseif code == 48 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = OddMushroom } elseif code == 49 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = OddPotion } elseif code == 50 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = PoachersSaw } elseif code == 51 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = BrokenGoronsSword } elseif code == 52 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = Prescription } elseif code == 53 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = EyeballFrog } elseif code == 54 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = EyeDrops } elseif code == 55 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = ClaimCheck } elseif code == 56 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = FairyBowAndFireArrow } elseif code == 57 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = FairyBowAndIceArrow } elseif code == 58 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = FairyBowAndLightArrow } elseif code == 59 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = KokiriSword0 } elseif code == 60 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = MasterSword0 } elseif code == 61 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = GoronsSword } elseif code == 255 then return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1, button_item_c_right = NoItem } else return { button_slot_c_left = read_value_8(addr + 4), button_slot_c_down = read_value_8(addr + 5), button_slot_c_right = read_value_8(addr + 6), equipment = _dollardecode0(nil, addr + 8), button_item_c_right = UnknownItem(code), button_item_b = tmp, button_item_c_left = tmp0, button_item_c_down = tmp1 } end end if code == 0 then return tmp1(DekuStick) elseif code == 1 then return tmp1(DekuNut) elseif code == 2 then return tmp1(Bomb) elseif code == 3 then return tmp1(FairyBow) elseif code == 4 then return tmp1(FireArrow) elseif code == 5 then return tmp1(DinsFire) elseif code == 6 then return tmp1(FairySlingshot) elseif code == 7 then return tmp1(FairyOcarina) elseif code == 8 then return tmp1(OcarinaOfTime) elseif code == 9 then return tmp1(Bombchu_10) elseif code == 10 then return tmp1(Hookshot) elseif code == 11 then return tmp1(Longshot) elseif code == 12 then return tmp1(IceArrow) elseif code == 13 then return tmp1(FaroresWind) elseif code == 14 then return tmp1(Boomerang) elseif code == 15 then return tmp1(LensOfTruth) elseif code == 16 then return tmp1(MagicBean) elseif code == 17 then return tmp1(MegatonHammer) elseif code == 18 then return tmp1(LightArrow) elseif code == 19 then return tmp1(NayrusLove) elseif code == 20 then return tmp1(EmptyBottle) elseif code == 21 then return tmp1(RedPotionBottle) elseif code == 22 then return tmp1(GreenPotionBottle) elseif code == 23 then return tmp1(BluePotionBottle) elseif code == 24 then return tmp1(FairyBottle) elseif code == 25 then return tmp1(FishBottle) elseif code == 26 then return tmp1(FullMilkBottle) elseif code == 27 then return tmp1(RutosLetterBottle) elseif code == 28 then return tmp1(BlueFireBottle) elseif code == 29 then return tmp1(BugBottle) elseif code == 30 then return tmp1(BigPoeBottle) elseif code == 31 then return tmp1(HalfMilkBottle) elseif code == 32 then return tmp1(PoeBottle) elseif code == 33 then return tmp1(WeirdEgg) elseif code == 34 then return tmp1(Chicken) elseif code == 35 then return tmp1(ZeldasLetter) elseif code == 36 then return tmp1(KeatonMask) elseif code == 37 then return tmp1(SkullMask) elseif code == 38 then return tmp1(SpookyMask) elseif code == 39 then return tmp1(BunnyHood) elseif code == 40 then return tmp1(GoronMask) elseif code == 41 then return tmp1(ZoraMask) elseif code == 42 then return tmp1(GerudoMask) elseif code == 43 then return tmp1(MaskOfTruth) elseif code == 44 then return tmp1(SoldOut) elseif code == 45 then return tmp1(PocketEgg) elseif code == 46 then return tmp1(PocketCucco) elseif code == 47 then return tmp1(Cojiro) elseif code == 48 then return tmp1(OddMushroom) elseif code == 49 then return tmp1(OddPotion) elseif code == 50 then return tmp1(PoachersSaw) elseif code == 51 then return tmp1(BrokenGoronsSword) elseif code == 52 then return tmp1(Prescription) elseif code == 53 then return tmp1(EyeballFrog) elseif code == 54 then return tmp1(EyeDrops) elseif code == 55 then return tmp1(ClaimCheck) elseif code == 56 then return tmp1(FairyBowAndFireArrow) elseif code == 57 then return tmp1(FairyBowAndIceArrow) elseif code == 58 then return tmp1(FairyBowAndLightArrow) elseif code == 59 then return tmp1(KokiriSword0) elseif code == 60 then return tmp1(MasterSword0) elseif code == 61 then return tmp1(GoronsSword) elseif code == 255 then return tmp1(NoItem) else return tmp1(UnknownItem(code)) end end if code == 0 then return tmp0(DekuStick) elseif code == 1 then return tmp0(DekuNut) elseif code == 2 then return tmp0(Bomb) elseif code == 3 then return tmp0(FairyBow) elseif code == 4 then return tmp0(FireArrow) elseif code == 5 then return tmp0(DinsFire) elseif code == 6 then return tmp0(FairySlingshot) elseif code == 7 then return tmp0(FairyOcarina) elseif code == 8 then return tmp0(OcarinaOfTime) elseif code == 9 then return tmp0(Bombchu_10) elseif code == 10 then return tmp0(Hookshot) elseif code == 11 then return tmp0(Longshot) elseif code == 12 then return tmp0(IceArrow) elseif code == 13 then return tmp0(FaroresWind) elseif code == 14 then return tmp0(Boomerang) elseif code == 15 then return tmp0(LensOfTruth) elseif code == 16 then return tmp0(MagicBean) elseif code == 17 then return tmp0(MegatonHammer) elseif code == 18 then return tmp0(LightArrow) elseif code == 19 then return tmp0(NayrusLove) elseif code == 20 then return tmp0(EmptyBottle) elseif code == 21 then return tmp0(RedPotionBottle) elseif code == 22 then return tmp0(GreenPotionBottle) elseif code == 23 then return tmp0(BluePotionBottle) elseif code == 24 then return tmp0(FairyBottle) elseif code == 25 then return tmp0(FishBottle) elseif code == 26 then return tmp0(FullMilkBottle) elseif code == 27 then return tmp0(RutosLetterBottle) elseif code == 28 then return tmp0(BlueFireBottle) elseif code == 29 then return tmp0(BugBottle) elseif code == 30 then return tmp0(BigPoeBottle) elseif code == 31 then return tmp0(HalfMilkBottle) elseif code == 32 then return tmp0(PoeBottle) elseif code == 33 then return tmp0(WeirdEgg) elseif code == 34 then return tmp0(Chicken) elseif code == 35 then return tmp0(ZeldasLetter) elseif code == 36 then return tmp0(KeatonMask) elseif code == 37 then return tmp0(SkullMask) elseif code == 38 then return tmp0(SpookyMask) elseif code == 39 then return tmp0(BunnyHood) elseif code == 40 then return tmp0(GoronMask) elseif code == 41 then return tmp0(ZoraMask) elseif code == 42 then return tmp0(GerudoMask) elseif code == 43 then return tmp0(MaskOfTruth) elseif code == 44 then return tmp0(SoldOut) elseif code == 45 then return tmp0(PocketEgg) elseif code == 46 then return tmp0(PocketCucco) elseif code == 47 then return tmp0(Cojiro) elseif code == 48 then return tmp0(OddMushroom) elseif code == 49 then return tmp0(OddPotion) elseif code == 50 then return tmp0(PoachersSaw) elseif code == 51 then return tmp0(BrokenGoronsSword) elseif code == 52 then return tmp0(Prescription) elseif code == 53 then return tmp0(EyeballFrog) elseif code == 54 then return tmp0(EyeDrops) elseif code == 55 then return tmp0(ClaimCheck) elseif code == 56 then return tmp0(FairyBowAndFireArrow) elseif code == 57 then return tmp0(FairyBowAndIceArrow) elseif code == 58 then return tmp0(FairyBowAndLightArrow) elseif code == 59 then return tmp0(KokiriSword0) elseif code == 60 then return tmp0(MasterSword0) elseif code == 61 then return tmp0(GoronsSword) elseif code == 255 then return tmp0(NoItem) else return tmp0(UnknownItem(code)) end end if code == 0 then return tmp(DekuStick) elseif code == 1 then return tmp(DekuNut) elseif code == 2 then return tmp(Bomb) elseif code == 3 then return tmp(FairyBow) elseif code == 4 then return tmp(FireArrow) elseif code == 5 then return tmp(DinsFire) elseif code == 6 then return tmp(FairySlingshot) elseif code == 7 then return tmp(FairyOcarina) elseif code == 8 then return tmp(OcarinaOfTime) elseif code == 9 then return tmp(Bombchu_10) elseif code == 10 then return tmp(Hookshot) elseif code == 11 then return tmp(Longshot) elseif code == 12 then return tmp(IceArrow) elseif code == 13 then return tmp(FaroresWind) elseif code == 14 then return tmp(Boomerang) elseif code == 15 then return tmp(LensOfTruth) elseif code == 16 then return tmp(MagicBean) elseif code == 17 then return tmp(MegatonHammer) elseif code == 18 then return tmp(LightArrow) elseif code == 19 then return tmp(NayrusLove) elseif code == 20 then return tmp(EmptyBottle) elseif code == 21 then return tmp(RedPotionBottle) elseif code == 22 then return tmp(GreenPotionBottle) elseif code == 23 then return tmp(BluePotionBottle) elseif code == 24 then return tmp(FairyBottle) elseif code == 25 then return tmp(FishBottle) elseif code == 26 then return tmp(FullMilkBottle) elseif code == 27 then return tmp(RutosLetterBottle) elseif code == 28 then return tmp(BlueFireBottle) elseif code == 29 then return tmp(BugBottle) elseif code == 30 then return tmp(BigPoeBottle) elseif code == 31 then return tmp(HalfMilkBottle) elseif code == 32 then return tmp(PoeBottle) elseif code == 33 then return tmp(WeirdEgg) elseif code == 34 then return tmp(Chicken) elseif code == 35 then return tmp(ZeldasLetter) elseif code == 36 then return tmp(KeatonMask) elseif code == 37 then return tmp(SkullMask) elseif code == 38 then return tmp(SpookyMask) elseif code == 39 then return tmp(BunnyHood) elseif code == 40 then return tmp(GoronMask) elseif code == 41 then return tmp(ZoraMask) elseif code == 42 then return tmp(GerudoMask) elseif code == 43 then return tmp(MaskOfTruth) elseif code == 44 then return tmp(SoldOut) elseif code == 45 then return tmp(PocketEgg) elseif code == 46 then return tmp(PocketCucco) elseif code == 47 then return tmp(Cojiro) elseif code == 48 then return tmp(OddMushroom) elseif code == 49 then return tmp(OddPotion) elseif code == 50 then return tmp(PoachersSaw) elseif code == 51 then return tmp(BrokenGoronsSword) elseif code == 52 then return tmp(Prescription) elseif code == 53 then return tmp(EyeballFrog) elseif code == 54 then return tmp(EyeDrops) elseif code == 55 then return tmp(ClaimCheck) elseif code == 56 then return tmp(FairyBowAndFireArrow) elseif code == 57 then return tmp(FairyBowAndIceArrow) elseif code == 58 then return tmp(FairyBowAndLightArrow) elseif code == 59 then return tmp(KokiriSword0) elseif code == 60 then return tmp(MasterSword0) elseif code == 61 then return tmp(GoronsSword) elseif code == 255 then return tmp(NoItem) else return tmp(UnknownItem(code)) end end local function _dollarfields1(amex, tmp) local tmp0 = { fields = function(tmp0) return _dollarfields0(nil, tmp0) end, name = function(tmp0) return "Equipment" end } return { { _1 = { _1 = "button_item_b", _2 = S(_dollardShowakjw(nil))(tmp.button_item_b) }, _2 = { { _1 = { _1 = "button_item_c_left", _2 = S(_dollardShowakjw(nil))(tmp.button_item_c_left) }, _2 = { { _1 = { _1 = "button_item_c_down", _2 = S(_dollardShowakjw(nil))(tmp.button_item_c_down) }, _2 = { { _1 = { _1 = "button_item_c_right", _2 = S(_dollardShowakjw(nil))(tmp.button_item_c_right) }, _2 = { { _2 = { { _2 = { { _2 = { { _2 = Nil, _1 = { _1 = "equipment", _2 = P(function(a) return function(w) return pretty_from_record(tmp0, a, w) end end)(tmp.equipment) } }, __tag = "Cons" }, _1 = { _1 = "button_slot_c_right", _2 = S(function(tmp0) return string_of_int(tmp0) .. "_u8" end)(tmp.button_slot_c_right) } }, __tag = "Cons" }, _1 = { _1 = "button_slot_c_down", _2 = S(function(tmp0) return string_of_int(tmp0) .. "_u8" end)(tmp.button_slot_c_down) } }, __tag = "Cons" }, _1 = { _1 = "button_slot_c_left", _2 = S(function(tmp0) return string_of_int(tmp0) .. "_u8" end)(tmp.button_slot_c_left) } }, __tag = "Cons" } }, __tag = "Cons" } }, __tag = "Cons" } }, __tag = "Cons" } }, __tag = "Cons" } end local function _dollardecode2(atfa, addr) local function tmp(tmp) local u320 = read_value_32(addr + 4) local function tmp0(tmp0) local u321 = read_value_32(addr + 8) local function tmp1(tmp1) local tmp2 = read_value_16(addr + 12) local u322 = read_value_32(addr + 16) local function tmp3(tmp3) local u323 = read_value_32(addr + 20) local function tmp4(tmp4) local function tmp5(tmp5) local u16 = read_value_16(addr + 34) local function tmp6(tmp6) local u160 = read_value_16(addr + 44) local function tmp7(tmp7) local u161 = read_value_16(addr + 46) local function tmp8(tmp8) local function tmp9(tmp9) local function tmp10(tmp10) local u80 = read_value_8(addr + 51) local function tmp11(tmp11) local u163 = read_value_16(addr + 52) local function tmp12(tmp12) local tmp16 = read_value_16(addr + 54) local tmp20 = read_value_16(addr + 56) local tmp19 = read_value_8(addr + 58) local tmp13 = read_value_8(addr + 60) local tmp21 = read_value_8(addr + 61) local tmp15 = read_value_8(addr + 62) local tmp14 = read_value_8(addr + 63) local tmp18 = _dollardecode1(nil, addr + 64) local tmp17 = _dollardecode1(nil, addr + 74) local u164 = read_value_16(addr + 102) local function tmp22(tmp22) return { equips = _dollardecode1(nil, addr + 104), inventory = _dollardecode(nil, addr + 116), entrance_index = tmp, link_age = tmp0, cutscene_index = tmp1, day_time = tmp2, night_flag = tmp3, num_days = tmp4, claim_days = tmp5, deaths = tmp6, n64dd_flag = tmp7, health_capacity = tmp8, health = tmp9, magic_level = tmp10, magic = tmp11, rupees = tmp12, sword_health = tmp16, navi_timer = tmp20, magic_acquired = tmp19, double_magic = tmp13, double_defense = tmp21, bgs_flag = tmp15, ocarina_game_reward = tmp14, child_equips = tmp18, adult_equips = tmp17, saved_scene_num = tmp22 } end if u164 > 65535 then return tmp22(0 - (65536 - u164)) end return tmp22(u164) end if u163 > 65535 then return tmp12(0 - (65536 - u163)) end return tmp12(u163) end if u80 > 255 then return tmp11(0 - (256 - u80)) end return tmp11(u80) end local u8 = read_value_8(addr + 50) if u8 > 255 then return tmp10(0 - (256 - u8)) end return tmp10(u8) end local u162 = read_value_16(addr + 48) if u162 > 65535 then return tmp9(0 - (65536 - u162)) end return tmp9(u162) end if u161 > 65535 then return tmp8(0 - (65536 - u161)) end return tmp8(u161) end if u160 > 65535 then return tmp7(0 - (65536 - u160)) end return tmp7(u160) end if u16 > 65535 then return tmp6(0 - (65536 - u16)) end return tmp6(u16) end local u324 = read_value_32(addr + 24) if u324 > 4294967295 then return tmp5(0 - (4294967296 - u324)) end return tmp5(u324) end if u323 > 4294967295 then return tmp4(0 - (4294967296 - u323)) end return tmp4(u323) end if u322 > 4294967295 then return tmp3(0 - (4294967296 - u322)) end return tmp3(u322) end if u321 > 4294967295 then return tmp1(0 - (4294967296 - u321)) end return tmp1(u321) end if u320 > 4294967295 then return tmp0(0 - (4294967296 - u320)) end return tmp0(u320) end local u32 = read_value_32(addr) if u32 > 4294967295 then return tmp(0 - (4294967296 - u32)) end return tmp(u32) end local function _dollarfields2(atuq, tmp) local function tmp0(tmp0) return _dollarfields1(nil, tmp0) end local tmp1 = { fields = function(tmp1) return _dollarfields(nil, tmp1) end, name = function(tmp1) return "Inventory" end } return { { _2 = { { _2 = { { _2 = { { _1 = { _1 = "day_time", _2 = S(function(tmp0) return string_of_int(tmp0) .. "_u16" end)(tmp.day_time) }, _2 = { { _1 = { _1 = "night_flag", _2 = S(function(tmp0) return string_of_int(tmp0) .. "_s32" end)(tmp.night_flag) }, _2 = { { _1 = { _1 = "num_days", _2 = S(function(tmp0) return string_of_int(tmp0) .. "_s32" end)(tmp.num_days) }, _2 = { { _1 = { _1 = "claim_days", _2 = S(function(tmp0) return string_of_int(tmp0) .. "_s32" end)(tmp.claim_days) }, _2 = { { _2 = { { _1 = { _1 = "n64dd_flag", _2 = S(function(tmp0) return string_of_int(tmp0) .. "_s16" end)(tmp.n64dd_flag) }, _2 = { { _2 = { { _2 = { { _1 = { _1 = "magic_level", _2 = S(function(tmp0) return string_of_int(tmp0) .. "_s8" end)(tmp.magic_level) }, _2 = { { _1 = { _1 = "magic", _2 = S(function(tmp0) return string_of_int(tmp0) .. "_s8" end)(tmp.magic) }, _2 = { { _2 = { { _2 = { { _2 = { { _2 = { { _2 = { { _2 = { { _1 = { _1 = "bgs_flag", _2 = S(function(tmp0) return string_of_int(tmp0) .. "_u8" end)(tmp.bgs_flag) }, _2 = { { _1 = { _1 = "ocarina_game_reward", _2 = S(function(tmp0) return string_of_int(tmp0) .. "_u8" end)(tmp.ocarina_game_reward) }, _2 = { { _1 = { _1 = "child_equips", _2 = P(pretty_from_record0({ fields = tmp0, name = function(tmp0) return "ItemEquips" end }))(tmp.child_equips) }, _2 = { { _1 = { _1 = "adult_equips", _2 = P(pretty_from_record0({ fields = tmp0, name = function(tmp1) return "ItemEquips" end }))(tmp.adult_equips) }, _2 = { { _2 = { { _1 = { _1 = "equips", _2 = P(pretty_from_record0({ fields = tmp0, name = function(tmp1) return "ItemEquips" end }))(tmp.equips) }, _2 = { { _2 = Nil, _1 = { _1 = "inventory", _2 = P(function(a) return function(w) return pretty_from_record(tmp1, a, w) end end)(tmp.inventory) } }, __tag = "Cons" } }, __tag = "Cons" }, _1 = { _1 = "saved_scene_num", _2 = S(function(tmp1) return string_of_int(tmp1) .. "_s16" end)(tmp.saved_scene_num) } }, __tag = "Cons" } }, __tag = "Cons" } }, __tag = "Cons" } }, __tag = "Cons" } }, __tag = "Cons" }, _1 = { _1 = "double_defense", _2 = S(function(tmp0) return string_of_int(tmp0) .. "_u8" end)(tmp.double_defense) } }, __tag = "Cons" }, _1 = { _1 = "double_magic", _2 = S(function(tmp0) return string_of_int(tmp0) .. "_u8" end)(tmp.double_magic) } }, __tag = "Cons" }, _1 = { _1 = "magic_acquired", _2 = S(function(tmp0) return string_of_int(tmp0) .. "_u8" end)(tmp.magic_acquired) } }, __tag = "Cons" }, _1 = { _1 = "navi_timer", _2 = S(function(tmp0) return string_of_int(tmp0) .. "_u16" end)(tmp.navi_timer) } }, __tag = "Cons" }, _1 = { _1 = "sword_health", _2 = S(function(tmp0) return string_of_int(tmp0) .. "_u16" end)(tmp.sword_health) } }, __tag = "Cons" }, _1 = { _1 = "rupees", _2 = S(function(tmp0) return string_of_int(tmp0) .. "_s16" end)(tmp.rupees) } }, __tag = "Cons" } }, __tag = "Cons" } }, __tag = "Cons" }, _1 = { _1 = "health", _2 = S(function(tmp0) return string_of_int(tmp0) .. "_s16" end)(tmp.health) } }, __tag = "Cons" }, _1 = { _1 = "health_capacity", _2 = S(function(tmp0) return string_of_int(tmp0) .. "_s16" end)(tmp.health_capacity) } }, __tag = "Cons" } }, __tag = "Cons" }, _1 = { _1 = "deaths", _2 = S(function(tmp0) return string_of_int(tmp0) .. "_s16" end)(tmp.deaths) } }, __tag = "Cons" } }, __tag = "Cons" } }, __tag = "Cons" } }, __tag = "Cons" } }, __tag = "Cons" }, _1 = { _1 = "cutscene_index", _2 = S(function(tmp0) return string_of_int(tmp0) .. "_s32" end)(tmp.cutscene_index) } }, __tag = "Cons" }, _1 = { _1 = "link_age", _2 = S(function(tmp0) return string_of_int(tmp0) .. "_s32" end)(tmp.link_age) } }, __tag = "Cons" }, _1 = { _1 = "entrance_index", _2 = S(function(tmp0) return string_of_int(tmp0) .. "_s32" end)(tmp.entrance_index) } }, __tag = "Cons" } end local function onScriptStart(tmp) return nil end local function onScriptCancel(tmp) return nil end local function onScriptUpdate(tmp) return set_screen_text(pretty_from_record({ fields = function(tmp0) return _dollarfields2(nil, tmp0) end, name = function(tmp0) return "SaveContext" end }, _dollardecode2(nil, 17295088), 0)) end local function onStateLoaded(tmp) return nil end local function onStateSaved(tmp) return nil end return { base_address = 16138528, g_save_ctx_address = 1156560, onScriptCancel = onScriptCancel, onScriptStart = onScriptStart, onScriptUpdate = onScriptUpdate, onStateLoaded = onStateLoaded, onStateSaved = onStateSaved } end