#!/usr/bin/env python3

import os
import argparse

# all occurrences of keys will be replaced by associated value
simpleReplace = {
    "PLAYER_AP_": "PLAYER_IA_",
    "PLAYER_CSMODE_": "PLAYER_CSACTION_",
}

# all occurrences of keys will be replaced by associated value,
# if the occurrence is the whole word
# for example, if there is a space before and an open parenthesis after,
# like for a function call: ` func_8002E4B4(`
#
# Custom behaviour can be enabled by using a tuple as the value (see
# explanation in replace_single below)
wordReplace = {
    # Functions
    "SystemArena_Malloc": "malloc",
    "SystemArena_MallocR": "malloc_r",
    "SystemArena_Realloc": "realloc",
    "SystemArena_Free": "free",
    "SystemArena_Calloc": "calloc",
    "SystemArena_GetSizes": "GetFreeArena",
    "SystemArena_CheckArena": "CheckArena",
    "SystemArena_Init": "MallocInit",
    "SystemArena_Cleanup": "MallocCleanup",
    "SystemArena_IsInitialized": "MallocIsInitialized",

    "proutSprintf": "proutPrintf",

    "PrintUtils_VPrintf": "vaprintf",
    "PrintUtils_Printf": "aprintf",

    "Sleep_Cycles": "csleep",
    "Sleep_Nsec": "nsleep",
    "Sleep_Usec": "usleep",
    "Sleep_Msec": "msleep",
    "Sleep_Sec": "sleep",

    "Actor_GetSwitchFlag": "Flags_GetSwitch",
    "Math_Acot2F": "Math_Atan2F_XY",
    "atan_flip": "Math_Atan2F_XY",
    "atans": "Math_Atan2S",
    "sin_rad": "Math_SinF",
    "cos_rad": "Math_CosF",
    "randPlusMinusPoint5Scaled": "Rand_CenteredFloat",
    # "Math_FAtan2F": "Math_Atan2S_XY", // Old Math_FAtan2F was renamed
    "func_80086B30": "Math_FAtan2F",
    "func_80086760": "Math_FTanF",
    "func_80086C48": "Math_FAcosF",

    # "SysMatrix_StateAlloc":                         "Matrix_StateAlloc",
    # "SysMatrix_StatePush":                          "Matrix_StatePush",
    # "SysMatrix_StatePop":                           "Matrix_StatePop",
    # "SysMatrix_GetCurrentState":                    "Matrix_GetCurrentState",
    # "SysMatrix_CopyCurrentState":                   "Matrix_CopyCurrentState",
    # "SysMatrix_SetCurrentState":                    "Matrix_SetCurrentState",
    # "SysMatrix_InsertTranslation":                  "Matrix_InsertTranslation",
    # "SysMatrix_InsertMatrix":                       "Matrix_InsertMatrix",
    # "SysMatrix_Scale":                              "Matrix_Scale",
    # "SysMatrix_InsertXRotation_s":                  "Matrix_InsertXRotation_s",
    # "SysMatrix_InsertXRotation_f":                  "Matrix_InsertXRotation_f",
    # "SysMatrix_RotateStateAroundXAxis":             "Matrix_RotateStateAroundXAxis",
    # "SysMatrix_SetStateXRotation":                  "Matrix_SetStateXRotation",
    # "SysMatrix_RotateY":                            "Matrix_RotateY",
    # "SysMatrix_InsertYRotation_f":                  "Matrix_InsertYRotation_f",
    # "SysMatrix_InsertZRotation_s":                  "Matrix_InsertZRotation_s",
    # "SysMatrix_InsertZRotation_f":                  "Matrix_InsertZRotation_f",
    # "SysMatrix_InsertRotation":                     "Matrix_InsertRotation",
    # "SysMatrix_JointPosition":                      "Matrix_JointPosition",
    # "SysMatrix_SetStateRotationAndTranslation":     "Matrix_SetStateRotationAndTranslation",
    # "SysMatrix_ToRSPMatrix":                        "Matrix_ToRSPMatrix",
    # "SysMatrix_ToMtx":                              "Matrix_ToMtx",
    # "SysMatrix_NewMtx":                             "Matrix_Finalize",
    # "SysMatrix_AppendToPolyOpaDisp":                "Matrix_AppendToPolyOpaDisp",
    # "SysMatrix_MultiplyVector3fByState":            "Matrix_MultiplyVector3fByState",
    # "SysMatrix_GetStateTranslation":                "Matrix_GetStateTranslation",
    # "SysMatrix_GetStateTranslationAndScaledX":      "Matrix_GetStateTranslationAndScaledX",
    # "SysMatrix_GetStateTranslationAndScaledY":      "Matrix_GetStateTranslationAndScaledY",
    # "SysMatrix_GetStateTranslationAndScaledZ":      "Matrix_GetStateTranslationAndScaledZ",
    # "SysMatrix_MultiplyVector3fXZByCurrentState":   "Matrix_MultiplyVector3fXZByCurrentState",
    # "SysMatrix_MtxFCopy":                           "Matrix_MtxFCopy",
    # "SysMatrix_FromRSPMatrix":                      "Matrix_FromRSPMatrix",
    # "SysMatrix_MultiplyVector3fByMatrix":           "Matrix_MultiplyVector3fByMatrix",
    # "SysMatrix_TransposeXYZ":                       "Matrix_TransposeXYZ",
    # "SysMatrix_NormalizeXYZ":                       "Matrix_NormalizeXYZ",
    # "SysMatrix_InsertRotationAroundUnitVector_f":   "Matrix_InsertRotationAroundUnitVector_f",
    # "SysMatrix_InsertRotationAroundUnitVector_s":   "Matrix_InsertRotationAroundUnitVector_s",
    # "SysMatrix_GetStateAsRSPMatrix":                "Matrix_GetStateAsRSPMatrix",

    "Matrix_StateAlloc":                       "Matrix_Init",
    "Matrix_StatePush":                        "Matrix_Push",
    "Matrix_StatePop":                         "Matrix_Pop",
    "Matrix_CopyCurrentState":                 "Matrix_Get",
    "Matrix_SetCurrentState":                  "Matrix_Put",
    "Matrix_GetCurrentState":                  "Matrix_GetCurrent",
    "Matrix_InsertMatrix":                     "Matrix_Mult",
    "Matrix_InsertTranslation":                "Matrix_Translate",
    "Matrix_InsertXRotation_s":                "Matrix_RotateXS",
    "Matrix_InsertXRotation_f":                "Matrix_RotateXF",
    "Matrix_RotateStateAroundXAxis":           "Matrix_RotateXFApply",
    "Matrix_SetStateXRotation":                "Matrix_RotateXFNew",
    # "Matrix_RotateY":                          "Matrix_RotateYS",
    "Matrix_InsertYRotation_f":                "Matrix_RotateYF",
    "Matrix_InsertZRotation_s":                "Matrix_RotateZS",
    "Matrix_InsertZRotation_f":                "Matrix_RotateZF",
    "Matrix_InsertRotation":                   "Matrix_RotateZYX",
    "Matrix_JointPosition":                    "Matrix_TranslateRotateZYX",
    "Matrix_SetStateRotationAndTranslation":   "Matrix_SetTranslateRotateYXZ",
    "Matrix_ToRSPMatrix":                      "Matrix_MtxFToMtx",
    "Matrix_MultiplyVector3fByState":          "Matrix_MultVec3f",
    "Matrix_GetStateTranslation":              "Matrix_MultZero",
    "Matrix_GetStateTranslationAndScaledX":    "Matrix_MultVecX",
    "Matrix_GetStateTranslationAndScaledY":    "Matrix_MultVecY",
    "Matrix_GetStateTranslationAndScaledZ":    "Matrix_MultVecZ",
    "Matrix_MultiplyVector3fXZByCurrentState": "Matrix_MultVec3fXZ",
    "Matrix_FromRSPMatrix":                    "Matrix_MtxToMtxF",
    "Matrix_TransposeXYZ":                     "Matrix_Transpose",
    "Matrix_NormalizeXYZ":                     "Matrix_ReplaceRotation",
    "func_8018219C":                           "Matrix_MtxFToYXZRot",
    "func_801822C4":                           "Matrix_MtxFToZYXRot",
    "Matrix_InsertRotationAroundUnitVector_f": "Matrix_RotateAxisF",
    "Matrix_InsertRotationAroundUnitVector_s": "Matrix_RotateAxisS",

    "func_800B78B8": "Actor_UpdateBgCheckInfo",
    "func_80123D50": "Player_UpdateBottleHeld",
    "func_80123DA4": "Player_ReleaseLockOn",
    "func_8012403C": "Player_GetMask",
    "func_8012404c": "Player_RemoveMask",
    "func_80123AA4": "Player_SetModels",
    "func_80123BD4": "Player_SetModelGroup",
    "func_80123F48": "Player_IsBurningStickInRange",
    "func_8012405C": "Player_HasMirrorShieldEquipped",
    "func_80124088": "Player_IsHoldingMirrorShield",
    "func_8012697C": "Player_DrawGetItem",
    "func_800B724C": "Player_SetCsAction",
    "func_800B7298": "Player_SetCsActionWithHaltedActors",
    "Actor_SpawnWithParentAndCutscene": "Actor_SpawnAsChildAndCutscene",
    "Actor_SpawnWithParent": "Actor_SpawnAsChild",
    "Actor_IsLinkFacingActor": "Player_IsFacingActor",
    "Actor_IsActorFacingLink": "Actor_IsFacingPlayer",
    "Actor_IsActorFacingLinkAndWithinRange": "Actor_IsFacingAndNearPlayer",
    "Actor_IsActorFacingActorAndWithinRange": "Actor_ActorAIsFacingAndNearActorB",
    "Actor_IsActorFacingActor": "Actor_ActorAIsFacingActorB",
    "Actor_IsActorFacedByActor": "Actor_ActorBIsFacingActorA",
    "Actor_MarkForDeath": "Actor_Kill",
    "func_800B84D0": "Actor_TalkOfferAccepted",
    "Actor_ProcessTalkRequest": "Actor_TalkOfferAccepted",
    "func_800BC154": "Actor_ChangeCategory",
    "func_8017D668": "Math3D_PointDistToLine2D",

    "THGA_GetSize": "THGA_GetRemaining",
    "THGA_AllocStartArray8": "THGA_AllocDisplayList",
    "THGA_AllocStart8": "THGA_AllocGfx",
    "THGA_AllocStart8Wrapper": "THGA_AllocGfx2",
    "THGA_AllocEnd": "THGA_AllocTail",
    "THGA_AllocEndArray64": "THGA_AllocMtxArray",
    "THGA_AllocEnd64": "THGA_AllocMtx",
    "THGA_AllocEndArray16": "THGA_AllocVtxArray",
    "THGA_AllocEnd16": "THGA_AllocVtx",
    "THA_AllocStart": "THA_AllocHead",
    "THA_AllocStart1": "THA_AllocHeadByte",
    "THA_AllocEnd": "THA_AllocTail",
    "THA_AllocEndAlign16": "THA_AllocTailAlign16",
    "THA_AllocEndAlign": "THA_AllocTailAlign",
    "THA_GetSize": "THA_GetRemaining",

    "func_800BDFC0": "Gfx_DrawDListOpa",
    "func_800BE03C": "Gfx_DrawDListXlu",
    "func_800B6FC8": "Player_GetHeight",
    "Actor_InitCurrPosition": "Actor_SetWorldToHome",
    "Actor_SetHeight": "Actor_SetFocus",
    "Actor_SetRotationFromDrawRotation": "Actor_SetWorldRotToShape",
    "Actor_InitDrawRotation": "Actor_SetShapeRotToWorld",
    "Actor_CalcOffsetOrientedToDrawRotation": "Actor_WorldToActorCoords",
    "Actor_OffsetOfPointInActorCoords": "Actor_WorldToActorCoords",
    "Actor_ApplyMovement": "Actor_UpdatePos",
    "Actor_SetVelocityYRotationAndGravity": "Actor_UpdateVelocityWithGravity",
    "Actor_SetVelocityAndMoveYRotationAndGravity": "Actor_MoveWithGravity",
    "Actor_SetVelocityXYRotation": "Actor_UpdateVelocityWithoutGravity",
    "Actor_SetVelocityAndMoveXYRotation": "Actor_MoveWithoutGravity",
    "Actor_SetVelocityXYRotationReverse": "Actor_UpdateVelocityWithoutGravityReverse",
    "Actor_SetVelocityAndMoveXYRotationReverse": "Actor_MoveWithoutGravityReverse",
    "func_800B6C04": "Actor_SetSpeeds",
    "func_800B81E0": "Actor_GetFocus",
    "func_800B8214": "Actor_GetWorld",
    "func_800B8248": "Actor_GetWorldPosShapeRot",
    "func_800BE22C": "Actor_ApplyDamage",
    "Actor_YawBetweenActors": "Actor_WorldYawTowardActor",
    "Actor_YawBetweenActorsTop": "Actor_FocusYawTowardActor",
    "Actor_YawToPoint": "Actor_WorldYawTowardPoint",
    "Actor_PitchBetweenActors": "Actor_WorldPitchTowardActor",
    "Actor_PitchBetweenActorsTop": "Actor_FocusPitchTowardActor",
    "Actor_PitchToPoint": "Actor_WorldPitchTowardPoint",
    "Actor_DistanceBetweenActors": "Actor_WorldDistXYZToActor",
    "Actor_DistanceToPoint": "Actor_WorldDistXYZToPoint",
    "Actor_XZDistanceBetweenActors": "Actor_WorldDistXZToActor",
    "Actor_XZDistanceToPoint": "Actor_WorldDistXZToPoint",
    "func_800B6468": "Actor_InitPlayerImpact",
    "func_800B6474": "Actor_UpdatePlayerImpact",
    "func_800B648C": "Actor_SetPlayerImpact",
    "func_800B64FC": "Actor_GetPlayerImpact",
    "func_800B8500": "Actor_OfferTalkExchange",
    "func_800B85E0": "Actor_OfferTalkExchangeEquiCylinder",
    "func_800B8614": "Actor_OfferTalk",
    "func_800B863C": "Actor_OfferTalkNearColChkInfoCylinder",
    "Audio_PlaySoundAtPosition": "SoundSource_PlaySfxAtFixedWorldPos",
    "func_800F0590": "SoundSource_PlaySfxEachFrameAtFixedWorldPos",
    "func_8016970C": "Play_SetCameraAtEye",
    "Play_CameraSetAtEye": "Play_SetCameraAtEye",
    "func_800BBA88": "Enemy_StartFinishingBlow",
    "ShrinkWindow_Step": "ShrinkWindow_Update",
    "ShrinkWindow_Fini": "ShrinkWindow_Destroy",
    "func_801A89A8": "AudioSeq_QueueSeqCmd",
    "Audio_QueueSeqCmd": "AudioSeq_QueueSeqCmd",
    "func_801A0238": "Audio_SetMainBgmVolume",
    "func_801A2C20": "Audio_StopSubBgm",
    "func_801A2BB8": "Audio_PlaySubBgm",
    "func_8019F1C0": "Audio_PlaySfx_AtPos",
    "func_801A5BD0": "AudioSfx_MuteBanks",
    "func_801A72CC": "AudioSfx_StopByPos",
    "Audio_StopSfxByPos": "AudioSfx_StopByPos",
    "Audio_StopSfxById": "AudioSfx_StopById",
    "func_801A3098": "Audio_PlayFanfare",
    "func_801A8A50": "AudioSeq_GetActiveSeqId",
    "Audio_GetActiveSequence": "AudioSeq_GetActiveSeqId",
    "func_801A2E54": "Audio_PlayBgm_StorePrevBgm",
    "func_801A2ED8": "Audio_RestorePrevBgm",
    "func_801A2544": "Audio_PlayMorningSceneSequence",
    "func_801A25E4": "Audio_PlaySceneSequence",
    "func_801A3238": "Audio_PlaySequenceWithSeqPlayerIO",
    "func_801A32CC": "Audio_SetSequenceMode",
    "func_801A3590": "Audio_UpdateEnemyBgmVolume",
    "func_801A47DC": "Audio_SetAmbienceChannelIO",
    "func_801A4A28": "Audio_PlayAmbience",
    "func_801A7328": "AudioSfx_StopByPosAndId",
    "func_801A75E8": "AudioSfx_StopById",
    "SkelAnime_LodDraw": "SkelAnime_DrawLod",
    "SkelAnime_LodDrawSV": "SkelAnime_DrawFlexLod",
    # "SkelAnime_Draw": "SkelAnime_DrawOpa", # A different function is called this now
    "SkelAnime_DrawLimbSV": "SkelAnime_DrawFlexLimbOpa",
    "SkelAnime_DrawSV": "SkelAnime_DrawFlexOpa",
    # "SkelAnime_AnimateFrame": "SkelAnime_GetFrameData", # A different function is called this now
    "SkelAnime_GetFrameCount": "Animation_GetLastFrame",
    "SkelAnime_Draw2": "SkelAnime_Draw",
    "SkelAnime_DrawSV2": "SkelAnime_DrawFlex",
    "SkelAnime_AnimationCtxReset": "AnimTaskQueue_Reset",
    "func_801358D4": "AnimTaskQueue_SetNextGroup",
    "func_801358F4": "AnimTaskQueue_DisableTransformTasksForGroup",
    "SkelAnime_LoadLinkAnimetion": "AnimTaskQueue_AddLoadPlayerFrame",
    "play_sound": "Audio_PlaySfx",
    "func_8019F128": "Audio_PlaySfx_2",
    "func_8019F170": "Audio_PlaySfx_AtPosWithPresetLowFreqAndHighReverb",
    "Audio_PlaySfxAtPos": "Audio_PlaySfx_AtPos",
    "func_8019F208": "Audio_PlaySfx_MessageDecide",
    "func_8019F230": "Audio_PlaySfx_MessageCancel",
    "func_8019F420": "Audio_PlaySfx_Underwater",
    "func_8019F4AC": "Audio_PlaySfx_WithSfxSettingsReverb",
    "func_8019F638": "Audio_PlaySfx_AtPosForMetalEffectsWithSyncedFreqAndVolume",
    "func_8019F780": "Audio_PlaySfx_AtPosWithSyncedFreqAndVolume",
    "func_8019F830": "Audio_PlaySfx_GiantsMask",
    "func_8019F88C": "Audio_PlaySfx_Randomized",
    "func_8019F900": "Audio_PlaySfx_SwordCharge",
    "func_8019FAD8": "Audio_PlaySfx_AtPosWithFreq",
    "func_8019FB0C": "Audio_PlaySfx_AtPosWithFreqAndChannelIO",
    "func_8019FC20": "Audio_PlaySfx_WaterWheel",
    "func_8019FCB8": "Audio_PlaySfx_AtPosWithTimer",
    "func_8019FDC8": "Audio_PlaySfx_AtPosWithReverb",
    "func_8019FE1C": "Audio_PlaySfx_AtPosWithVolume",
    "func_8019FF9C": "Audio_PlaySfx_River",
    "func_801A0124": "Audio_PlaySfx_BigBells",
    "func_801A0810": "Audio_PlaySfx_AtPosWithAllChannelsIO",
    "func_801A0868": "Audio_PlaySfx_AtPosWithChannelIO",
    "func_801A3AEC": "Audio_PlaySfx_PauseMenuOpenOrClose",
    "func_801A3FB4": "Audio_PlaySfx_IfNotInCutscene",
    "func_801A4748": "Audio_PlaySfx_AtFixedPos",
    "func_801A479C": "Audio_PlaySfx_AtPosWithVolumeTransition",
    "func_8019F540": "Audio_SetSfxUnderwaterReverb",
    "func_8019FD90": "Audio_SetSfxTimerLerpInterval",
    "func_8019FE74": "Audio_SetSfxVolumeTransition",
    "func_801A4428": "Audio_SetSfxReverbIndexExceptOcarinaBank",
    "func_800B8EF4": "Actor_PlaySfx_SurfaceBomb",
    "func_800B8F98": "Actor_PlaySfx_Flagged2",
    "func_800B8FC0": "Actor_PlaySfx_FlaggedCentered1",
    "func_800B8FE8": "Actor_PlaySfx_FlaggedCentered2",
    "Actor_PlaySfx_FlaggedCentered3": "Actor_PlaySfx_FlaggedCentered2",
    "func_800B9010": "Actor_PlaySfx_Flagged",
    "func_800B9038": "Actor_PlaySfx_FlaggedTimer",
    "func_800B9084": "Actor_PlaySeq_FlaggedKamaroDance",
    "func_800B9098": "Actor_PlaySeq_FlaggedMusicBoxHouse",
    "func_801000A4": "Lib_PlaySfx",
    "func_801000CC": "Lib_PlaySfx_2",
    "Lib_PlaySfxAtPos": "Lib_PlaySfx_AtPos",

    "SkelAnime_AnimationType1Loaded": "AnimTask_Copy",
    "SkelAnime_AnimationType2Loaded": "AnimTask_Interp",
    "SkelAnime_AnimationType3Loaded": "AnimTask_CopyUsingMap",
    "SkelAnime_AnimationType4Loaded": "AnimTask_CopyUsingMapInverted",
    "SkelAnime_AnimationType5Loaded": "AnimTask_ActorMovement",
    "func_80135EE8": "AnimTaskQueue_Update",
    "SkelAnime_InitLink": "SkelAnime_InitPlayer",
    "LinkAnimation_SetUpdateFunction": "PlayerAnimation_SetUpdateFunction",
    "LinkAnimation_Update": "PlayerAnimation_Update",
    "LinkAnimation_AnimateFrame": "PlayerAnimation_AnimateFrame",
    "SkelAnime_SetTransition": "Animation_SetMorph",
    "LinkAnimation_Change": "PlayerAnimation_Change",
    "LinkAnimation_PlayOnce": "PlayerAnimation_PlayOnce",
    "LinkAnimation_PlayOnceSetSpeed": "PlayerAnimation_PlayOnceSetSpeed",
    "LinkAnimation_PlayLoop": "PlayerAnimation_PlayLoop",
    "LinkAnimation_PlayLoopSetSpeed": "PlayerAnimation_PlayLoopSetSpeed",
    "LinkAnimation_CopyJointToMorph": "PlayerAnimation_CopyJointToMorph",
    "LinkAnimation_CopyMorphToJoint": "PlayerAnimation_CopyMorphToJoint",
    "LinkAnimation_LoadToMorph": "PlayerAnimation_LoadToMorph",
    "LinkAnimation_LoadToJoint": "PlayerAnimation_LoadToJoint",
    "LinkAnimation_InterpJointMorph": "PlayerAnimation_InterpJointMorph",
    "LinkAnimation_BlendToJoint": "PlayerAnimation_BlendToJoint",
    "LinkAnimation_BlendToMorph": "PlayerAnimation_BlendToMorph",
    "LinkAnimation_EndLoop": "PlayerAnimation_EndLoop",
    "LinkAnimation_OnFrame": "PlayerAnimation_OnFrame",

    "SkelAnime_InitSV": "SkelAnime_InitFlex",
    "SkelAnime_FrameUpdateMatrix": "SkelAnime_Update",
    "func_80136CF4": "SkelAnime_Morph",
    "func_80136D98": "SkelAnime_MorphTaper",

    "func_8013702C": "SkelAnime_LoopFull",
    "func_801370B0": "SkelAnime_LoopPartial",
    "func_8013713C": "SkelAnime_Once",
    "SkelAnime_ChangeAnimImpl": "Animation_ChangeImpl",
    "SkelAnime_ChangeAnim": "Animation_Change",
    "SkelAnime_ChangeAnimDefaultStop": "Animation_PlayOnce",
    "SkelAnime_ChangeAnimTransitionStop": "Animation_MorphToPlayOnce",
    "SkelAnime_ChangeAnimPlaybackStop": "Animation_PlayOnceSetSpeed",
    "SkelAnime_ChangeAnimDefaultRepeat": "Animation_PlayLoop",
    "SkelAnime_ChangeAnimTransitionRepeat": "Animation_MorphToLoop",
    "SkelAnime_ChangeAnimPlaybackRepeat": "Animation_PlayLoopSetSpeed",
    "SkelAnime_AnimSetStop": "Animation_EndLoop",
    "SkelAnime_AnimReverse": "Animation_Reverse",
    "func_80137674": "SkelAnime_CopyFrameTableTrue",
    "func_801376DC": "SkelAnime_CopyFrameTableFalse",
    "func_80137748": "SkelAnime_UpdateTranslation",
    "func_801378B8": "Animation_OnFrame",

    "Actor_SetObjectSegment": "Actor_SetObjectDependency",
    "func_800B3FC0": "ActorShadow_DrawCircle",
    "func_800B4024": "ActorShadow_DrawSquare",
    "func_800B4088": "ActorShadow_DrawWhiteCircle",
    "func_800B40B8": "ActorShadow_DrawHorse",
    "func_800B40E0": "ActorShadow_DrawFoot",
    "func_800B42F8": "ActorShadow_DrawFeet",
    "func_800B4A98": "Actor_SetFeetPos",
    "Actor_SetSwitchFlag": "Flags_SetSwitch",
    "Actor_UnsetSwitchFlag": "Flags_UnsetSwitch",
    "Actor_GetChestFlag": "Flags_GetTreasure",
    "Actor_SetChestFlag": "Flags_SetTreasure",
    "Actor_SetAllChestFlag": "Flags_SetAllTreasure",
    "Actor_GetAllChestFlag": "Flags_GetAllTreasure",
    "Actor_GetRoomCleared": "Flags_GetClear",
    "Actor_SetRoomCleared": "Flags_SetClear",
    "Actor_UnsetRoomCleared": "Flags_UnsetClear",
    "Actor_GetRoomClearedTemp": "Flags_GetClearTemp",
    "Actor_SetRoomClearedTemp": "Flags_SetClearTemp",
    "Actor_UnsetRoomClearedTemp": "Flags_UnsetTempClear",
    "Actor_GetCollectibleFlag": "Flags_GetCollectible",
    "Actor_SetCollectibleFlag": "Flags_SetCollectible",
    "func_800B8A1C": "Actor_OfferGetItem",
    "Actor_PickUp": "Actor_OfferGetItem",
    "func_800B8B84": "Actor_OfferGetItemNearby",
    "Actor_PickUpNearby": "Actor_OfferGetItemNearby",
    "func_800B8BB0": "Actor_OfferCarry",
    "Actor_LiftActor": "Actor_OfferCarry",
    "func_800B8BD0": "Actor_OfferGetItemFar",
    "Actor_PickUpFar": "Actor_OfferGetItemFar",
    "func_801A5CFC": "AudioSfx_PlaySfx",
    "Audio_PlaySfxGeneral": "AudioSfx_PlaySfx",
    "func_800B8C50": "Actor_SetClosestSecretDistance",
    "func_800BBDAC": "Actor_SpawnFloorDustRing",
    "func_800B8708": "Player_GetExchangeItemAction",
    "Player_GetExchangeItemId": "Player_GetExchangeItemAction",
    "func_801233E4": "Player_InCsMode",
    "func_800BC4EC": "Actor_TestFloorInDirection",
    "func_800BC5B8": "Actor_IsTargeted",
    "func_800BC5EC": "Actor_OtherIsTargeted",
    "func_800BCB70": "Actor_SetColorFilter",
    "func_800BE0B8": "Actor_FindNearby",
    "func_800BE258": "Actor_SetDropFlag",
    "func_800BE2B8": "Actor_SetDropFlagJntSph",
    "Actor_TitleCardCreate": "TitleCard_InitBossName",
    "func_800B867C": "Actor_TextboxIsClosing",
    "func_800BDC5C": "Actor_ChangeAnimationByInfo",
    "Actor_ChangeAnimation": "Actor_ChangeAnimationByInfo",
    "func_801477B4": "Message_CloseTextbox",
    "func_80151938": "Message_ContinueTextbox",
    "func_80152498": "Message_GetState",
    "func_800B8898": "Actor_GetScreenPos",
    "Audio_PlayActorSound2": "Actor_PlaySfx",
    "Actor_PlaySfxAtPos": "Actor_PlaySfx",
    "func_800B8E58": "Player_PlaySfx",
    "func_800BF7CC": "Actor_SpawnIceEffects",
    "Actor_IsFacingPlayerAndWithinRange": "Actor_IsFacingAndNearPlayer",
    "func_800BC8B8": "Actor_DrawDoorLock",
    "func_800B86C8": "Actor_ChangeFocus",
    "func_800DF840": "Camera_ChangeMode",
    "func_800B90F4": "Actor_DeactivateLens",
    "Actor_AddQuake": "Actor_RequestQuake",
    "func_800BC770": "Actor_RequestQuake",
    "Actor_AddQuakeWithSpeed": "Actor_RequestQuakeWithSpeed",
    "func_800BC848": "Actor_RequestQuakeAndRumble",
    "func_800DF840": "Camera_ChangeMode",
    "Camera_SetToTrackActor": "Camera_SetFocalActor",
    "zelda_malloc": "ZeldaArena_Malloc",
    "zelda_mallocR": "ZeldaArena_MallocR",
    "zelda_realloc": "ZeldaArena_Realloc",
    "zelda_free": "ZeldaArena_Free",
    "zelda_calloc": "ZeldaArena_Calloc",
    "MainHeap_AnalyzeArena": "ZeldaArena_GetSizes",
    "MainHeap_Check": "ZeldaArena_Check",
    "MainHeap_Init": "ZeldaArena_Init",
    "MainHeap_Cleanup": "ZeldaArena_Cleanup",
    "MainHeap_IsInitialized": "ZeldaArena_IsInitialized",
    "func_80138300": "Skin_GetLimbPos",
    "func_8013835C": "Skin_GetVertexPos",
    "BgCheck_RelocateMeshHeader": "CollisionHeader_GetVirtual",
    "BgCheck_AddActorMesh": "DynaPoly_SetBgActor",
    "BgCheck_RemoveActorMesh": "DynaPoly_DeleteBgActor",
    "BgCheck_PolygonLinkedListNodeInit": "SSNode_SetValue",
    "BgCheck_PolygonLinkedListResetHead": "SSList_SetNull",
    "BgCheck_ScenePolygonListsNodeInsert": "SSNodeList_SetSSListHead",
    "BgCheck_PolygonLinkedListNodeInsert": "DynaSSNodeList_SetSSListHead",
    "BgCheck_PolygonLinkedListInit": "DynaSSNodeList_Init",
    "BgCheck_PolygonLinkedListAlloc": "DynaSSNodeList_Alloc",
    "BgCheck_PolygonLinkedListReset": "DynaSSNodeList_ResetCount",
    "BgCheck_AllocPolygonLinkedListNode": "DynaSSNodeList_GetNextNodeIdx",
    "BgCheck_CreateVec3fFromVertex": "BgCheck_Vec3sToVec3f",
    "BgCheck_CreateVertexFromVec3f": "BgCheck_Vec3fToVec3s",
    "BgCheck_PolygonGetMinY": "CollisionPoly_GetMinY",
    "BgCheck_PolygonGetNormal": "CollisionPoly_GetNormalF",
    "BcCheck3_BgActorInit": "DynaPolyActor_Init",
    "BgCheck3_LoadMesh": "DynaPolyActor_LoadMesh",
    "func_800C01B8": "CollisionPoly_GetPointDistanceFromPlane",
    "BgCheck_CreateTriNormFromPolygon": "CollisionPoly_GetVertices",
    "func_800C02C0": "CollisionPoly_GetVerticesByBgId",
    "BgCheck_PolygonCollidesWithSphere": "CollisionPoly_SphVsPoly",
    "BgCheck_ScenePolygonListsInsertSorted": "StaticLookup_AddPolyToSSList",
    "BgCheck_ScenePolygonListsInsert": "StaticLookup_AddPoly",
    "BgCheck_GetPolyMinSubdivisions": "BgCheck_GetSubdivisionMinBounds",
    "BgCheck_GetPolyMaxSubdivisions": "BgCheck_GetSubdivisionMaxBounds",
    "BgCheck_GetPolyMinMaxSubdivisions": "BgCheck_GetPolySubdivisionBounds",
    "func_800C2BE0": "BgCheck_PolyIntersectsSubdivision",
    "BgCheck_SplitScenePolygonsIntoSubdivisions": "BgCheck_InitStaticLookup",
    "BgCheck_GetIsDefaultSpecialScene": "BgCheck_IsSmallMemScene",
    "BgCheck_GetSpecialSceneMaxMemory": "BgCheck_TryGetCustomMemsize",
    "BgCheck_CalcSubdivisionSize": "BgCheck_SetSubdivisionDimension",
    "BgCheck_Init": "BgCheck_Allocate",
    "func_800C3C00": "BgCheck_SetContextFlags",
    "func_800C3C14": "BgCheck_UnsetContextFlags",
    "BgCheck_GetActorMeshHeader": "BgCheck_GetCollisionHeader",
    "func_800C3D50": "BgCheck_RaycastFloorImpl",
    "func_800C3F40": "BgCheck_CameraRaycastFloor1",
    "func_800C3FA0": "BgCheck_EntityRaycastFloor1",
    "func_800C4000": "BgCheck_EntityRaycastFloor2",
    "func_800C4058": "BgCheck_EntityRaycastFloor2_1",
    "func_800C40B4": "BgCheck_EntityRaycastFloor3",
    "func_800C411C": "BgCheck_EntityRaycastFloor5",
    "func_800C4188": "BgCheck_EntityRaycastFloor5_2",
    "func_800C41E4": "BgCheck_EntityRaycastFloor5_3",
    "func_800C4240": "BgCheck_EntityRaycastFloor6",
    "func_800C42A8": "BgCheck_EntityRaycastFloor7",
    "func_800C4314": "BgCheck_AnyRaycastFloor1",
    "func_800C43CC": "BgCheck_AnyRaycastFloor2",
    "func_800C4488": "BgCheck_CameraRaycastFloor2",
    "func_800C44F0": "BgCheck_EntityRaycastFloor8",
    "func_800C455C": "BgCheck_EntityRaycastFloor9",
    "func_800C45C4": "BgCheck_CheckWallImpl",
    "func_800C4C74": "BgCheck_EntitySphVsWall1",
    "func_800C4CD8": "BgCheck_EntitySphVsWall2",
    "func_800C4D3C": "BgCheck_EntitySphVsWall3",
    "func_800C4DA4": "BgCheck_EntitySphVsWall4",
    "func_800C4E10": "BgCheck_CheckCeilingImpl",
    "func_800C4F38": "BgCheck_AnyCheckCeiling",
    "func_800C4F84": "BgCheck_EntityCheckCeiling",
    "func_800C54AC": "BgCheck_CameraLineTest1",
    "func_800C5538": "BgCheck_CameraLineTest2",
    "func_800C55C4": "BgCheck_EntityLineTest1",
    "func_800C5650": "BgCheck_EntityLineTest2",
    "func_800C56E0": "BgCheck_EntityLineTest3",
    "func_800C576C": "BgCheck_ProjectileLineTest",
    "func_800C57F8": "BgCheck_AnyLineTest1",
    "func_800C583C": "BgCheck_AnyLineTest2",
    "func_800C58C8": "BgCheck_AnyLineTest3",
    "func_800C5954": "BgCheck_SphVsFirstPolyImpl",
    "func_800C5A20": "BgCheck_SphVsFirstPoly",
    "func_800C5A64": "BgCheck_SphVsFirstWall",
    "BgCheck_ScenePolygonListsInit": "SSNodeList_Init",
    "BgCheck_ScenePolygonListsAlloc": "SSNodeList_Alloc",
    "func_800C5B80": "SSNodeList_GetNextNode",
    "BgCheck_ScenePolygonListsReserveNode": "SSNodeList_GetNextNodeIdx",
    "BgCheck_ActorMeshParamsInit": "ScaleRotPos_Init",
    "BgCheck_SetActorMeshParams": "ScaleRotPos_SetValue",
    "BgCheck_ActorMeshPolyListsHeadsInit": "DynaLookup_ResetLists",
    "BgCheck_ActorMeshPolyListsInit": "DynaLookup_Reset",
    "BgCheck_ActorMeshVerticesIndexInit": "DynaLookup_ResetVtxStartIndex",
    "BgCheck_ActorMeshWaterboxesIndexInit": "DynaLookup_ResetWaterBoxStartIndex",
    "BgCheck_ActorMeshInit": "BgActor_Init",
    "BgCheck_ActorMeshInitFromActor": "BgActor_SetActor",
    "BgCheck_HasActorMeshChanged": "BgActor_IsTransformUnchanged",
    "BgCheck_PolygonsInit": "DynaPoly_NullPolyList",
    "BgCheck_PolygonsAlloc": "DynaPoly_AllocPolyList",
    "BgCheck_VerticesInit": "DynaPoly_NullVtxList",
    "BgCheck_VerticesListAlloc": "DynaPoly_AllocVtxList",
    "BgCheck_WaterboxListInit": "DynaPoly_InitWaterBoxList",
    "BgCheck_WaterboxListAlloc": "DynaPoly_AllocWaterBoxList",
    "BgCheck_ActorMeshUpdateParams": "DynaPoly_SetBgActorPrevTransform",
    "BgCheck_IsActorMeshIndexValid": "DynaPoly_IsBgIdBgActor",
    "BgCheck_DynaInit": "DynaPoly_Init",
    "BgCheck_DynaAlloc": "DynaPoly_Alloc",
    "BgCheck_AddActorMesh": "DynaPoly_SetBgActor",
    "BgCheck_GetActorOfMesh": "DynaPoly_GetActor",
    "BgCheck_RemoveActorMesh": "DynaPoly_DeleteBgActor",
    "BgCheck_AddActorMeshToLists": "DynaPoly_AddBgActorToLookup",
    "BgCheck_Update": "DynaPoly_UpdateContext",
    "BgCheck_UpdateAllActorMeshes": "DynaPoly_UpdateBgActorTransforms",
    "BgCheck_RelocateMeshHeaderPointers": "CollisionHeader_SegmentedToVirtual",
    "BgCheck_RelocateMeshHeader": "CollisionHeader_GetVirtual",
    "BgCheck_RelocateAllMeshHeaders": "BgCheck_InitCollisionHeaders",
    "BgCheck_GetPolygonAttributes": "SurfaceType_GetData",
    "DynaPolyActor_ResetState": "DynaPolyActor_UnsetAllInteractFlags",
    "DynaPolyActor_SetRidingFallingState": "DynaPolyActor_SetActorOnTop",
    "DynaPolyActor_SetRidingMovingState": "DynaPolyActor_SetPlayerOnTop",
    "DynaPolyActor_SetRidingMovingStateByIndex": "DynaPoly_SetPlayerOnTop",
    "DynaPolyActor_SetRidingRotatingState": "DynaPolyActor_SetPlayerAbove",
    "DynaPolyActor_SetRidingRotatingStateByIndex": "DynaPoly_SetPlayerAbove",
    "DynaPolyActor_SetSwitchPressedState": "DynaPolyActor_SetSwitchPressed",
    "DynaPolyActor_SetHeavySwitchPressedState": "DynaPolyActor_SetHeavySwitchPressed",
    "DynaPolyActor_IsInRidingFallingState": "DynaPolyActor_IsActorOnTop",
    "DynaPolyActor_IsInRidingMovingState": "DynaPolyActor_IsPlayerOnTop",
    "DynaPolyActor_IsInRidingRotatingState": "DynaPolyActor_IsPlayerAbove",
    "DynaPolyActor_IsInSwitchPressedState": "DynaPolyActor_IsSwitchPressed",
    "DynaPolyActor_IsInHeavySwitchPressedState": "DynaPolyActor_IsHeavySwitchPressed",
    "func_800C62BC": "DynaPoly_DisableCollision",
    "func_800C6314": "DynaPoly_EnableCollision",
    "func_800C636C": "DynaPoly_DisableCeilingCollision",
    "func_800C63C4": "DynaPoly_EnableCeilingCollision",
    "func_800C641C": "DynaPoly_DisableFloorCollision",
    "func_800C6474": "DynaPoly_EnableFloorCollision",
    "SurfaceType_GetConveyorType": "SurfaceType_IsFloorConveyor",
    "func_800C9704": "SurfaceType_GetBgCamIndex",
    "func_800C9924": "BgCheck_GetBgCamFuncData",
    "func_800C99AC": "SurfaceType_GetSceneExitIndex",
    "func_800C99D4": "SurfaceType_GetFloorType",
    "func_800C9A24": "SurfaceType_GetWallType",
    "func_800C9A4C": "SurfaceType_GetWallFlags",
    "func_800C9A7C": "SurfaceType_CheckWallFlag0",
    "func_800C9AB0": "SurfaceType_CheckWallFlag1",
    "func_800C9AE4": "SurfaceType_CheckWallFlag2",
    "func_800C9B18": "SurfaceType_GetFloorProperty2",
    "func_800C9B40": "SurfaceType_GetFloorProperty",
    "func_800C9BB8": "SurfaceType_GetMaterial",
    "func_800C9B90": "SurfaceType_IsHorseBlocked",
    "func_800C9BDC": "SurfaceType_GetSfxOffset",
    "SurfaceType_GetSfx": "SurfaceType_GetSfxOffset",
    "func_800C9C74": "SurfaceType_GetFloorEffect",
    "func_800C9C9C": "SurfaceType_GetLightSettingIndex",
    "func_800C9CC4": "SurfaceType_GetEcho",
    "func_800C9CEC": "SurfaceType_IsHookshotSurface",
    "func_800C9D14": "SurfaceType_IsIgnoredByEntities",
    "func_800C9D50": "SurfaceType_IsIgnoredByProjectiles",
    "func_800C9D8C": "SurfaceType_IsFloorConveyor",
    "func_800C9E18": "SurfaceType_GetConveyorSpeed",
    "func_800C9E40": "SurfaceType_GetConveyorDirection",
    "func_800C9E88": "SurfaceType_IsWallDamage",
    "func_800C9EBC": "BgCheck_GetWaterSurface",
    "func_800CA1AC": "BgCheck_GetWaterSurfaceNoBgIdAlt",
    "func_800CA1E8": "BgCheck_GetWaterSurfaceNoBgId",
    "func_800CA22C": "BgCheck_FindWaterBox",
    "func_800CA6D8": "WaterBox_GetLightSettingIndex",

    "func_8017D668": "Math3D_PointDistSqToLine2DImpl",
    "func_80179678": "Math3D_PlaneVsLineSegClosestPoint",
    "Math3D_DistanceSquared": "Math3D_Vec3fDistSq",
    "Math3D_NormalVector": "Math3D_SurfaceNorm",
    "func_8017A954": "Math3D_PointRelativeToCubeFaces",
    "func_8017AA0C": "Math3D_PointRelativeToCubeEdges",
    "func_8017ABBC": "Math3D_PointRelativeToCubeVertices",
    "func_8017AD38": "Math3D_LineVsCube",
    "Math3D_NormalizedDistanceFromPlane": "Math3D_UDistPlaneToPos",
    "Math3D_NormalizedSignedDistanceFromPlane": "Math3D_DistPlaneToPos",
    "func_8017BAD0": "Math3D_TriChkPointParaYImpl",
    # "Math3D_TriChkPointParaYDist": "Math3D_TriChkPointParaYImpl",
    "func_8017BE30": "Math3D_TriChkPointParaYIntersectDist",
    "func_8017BEE0": "Math3D_TriChkPointParaYIntersectInsideTri",
    "func_8017C008": "Math3D_TriChkLineSegParaYIntersect",
    "func_8017C494": "Math3D_TriChkPointParaYNoRangeCheckIntersectInsideTri",
    "func_8017C540": "Math3D_TriChkPointParaXImpl",
    "func_8017C850": "Math3D_TriChkPointParaXIntersect",
    "func_8017C980": "Math3D_TriChkLineSegParaXIntersect",
    "func_8017CB7C": "Math3D_TriChkPointParaZImpl",
    "func_8017CEF0": "Math3D_TriChkPointParaZIntersect",
    "func_8017D020": "Math3D_TriChkLineSegParaZIntersect",
    "Math3D_ColSphereLineSeg": "Math3D_LineVsSph",
    "Math3D_ColSphereSphere": "Math3D_SphVsSph",
    "Math3D_CrossProduct": "Math3D_Vec3f_Cross",
    "Math3D_Parallel": "Math3D_Cos",
    "Math3D_AngleBetweenVectors": "Math3D_CosOut",
    "func_80179A44": "Math3D_LineClosestToPoint",
    "func_8017A438": "Math3D_SphCubeVsTriCube",
    "Math3D_XZLengthSquared": "Math3D_Dist1DSq",
    "Math3D_XZLength": "Math3D_Dist1D",
    "Math3D_XZDistanceSquared": "Math3D_Dist2DSq",
    "Math3D_XZDistance": "Math3D_Dist2D",
    "Math3D_LengthSquared": "Math3D_Vec3fMagnitudeSq",
    "Math3D_Distance": "Math3D_Vec3f_DistXYZ",
    "Math3D_DistanceS": "Math3D_DistXYZ16toF",
    "func_80179798": "Math3D_LineSegMakePerpLineSeg",
    "Math3D_LineVsLineClosestTwoPoints": "Math3D_LineSegMakePerpLineSeg",
    "func_80179B34": "Math3D_FindPointOnPlaneIntersect",
    "func_80179B94": "Math3D_PlaneVsPlaneNewLine",
    "func_8017B9D8": "Math3D_Plane",
    "func_8017D404": "Math3D_TriLineIntersect",
    "Math3D_ColCylinderCylinderAmountAndDistance": "Math3D_CylVsCylOverlapCenterDist",
    "Math3D_ColCylinderCylinderAmount": "Math3D_CylVsCylOverlap",
    "Math3D_ColSphereCylinderDistanceAndAmount": "Math3D_SphVsCylOverlapCenterDist",
    "Math3D_ColCylinderTri": "Math3D_CylTriVsIntersect",
    "func_8017F1A0": "Math3D_CylVsTri",
    "Math3D_ColSphereSphereIntersect": "Math3D_SphVsSphOverlap",
    "Math3D_ColSphereSphereIntersectAndDistance": "Math3D_SphVsSphOverlapCenterDist",
    "Math3D_ColSphereCylinderDistance": "Math3D_SphVsCylOverlap",
    "func_8017E350": "Math3D_CylVsLineSeg",
    "Math3D_ColSphereTri": "Math3D_TriVsSphIntersect",
    "Math3D_ScaleAndAdd": "Math3D_PointOnDirectedLine",
    "Math3D_Lerp": "Math3D_LineSplitRatio",
    "func_80179D74": "Math3D_PlaneVsPlaneVsLineClosestPoint",
    "func_8017E294": "Math3D_PointInCyl",
    "func_80179F64": "Math3D_Vec3fReflect",
    "Math3D_XZBoundCheck": "Math3D_PointInSquare2D",
    "func_8017B7F8": "Math3D_RotateXZPlane",
    "Math3D_UnitNormalVector": "Math3D_DefPlane",
    "Math3D_SignedDistanceFromPlane": "Math3D_PlaneF",
    "func_8017BD98": "Math3D_TriChkPointParaYDeterminate",
    "func_8017BDE0": "Math3D_TriChkPointParaYSlopedY",
    "func_8017BF8C": "Math3D_TriChkPointParaY",
    # "func_8017C17C": "Math3D_TriChkPointParaYDist",
    "func_8017C1F0": "Math3D_TriChkPointParaYImplNoCheckRange",
    "Math3D_TriChkPointParaYIntersectInsideTri2": "Math3D_TriChkPointParaYNoRangeCheckIntersectInsideTri",
    "Math3D_TriChkPointParaXDist": "Math3D_TriChkPointParaXImpl",
    "func_8017C808": "Math3D_TriChkPointParaXDeterminate",
    "func_8017C904": "Math3D_TriChkPointParaX",
    "func_8017CB08": "Math3D_TriChkLineSegParaXDist",
    # "Math3D_TriChkLineSegParaZDist": "Math3D_TriChkPointParaZImpl",
    "func_8017CEA8": "Math3D_TriChkPointParaZDeterminate",
    "func_8017CFA4": "Math3D_TriChkPointParaZ",
    # "func_8017D1AC": "Math3D_TriChkLineSegParaZDist",
    "func_8017D220": "Math3D_LineSegFindPlaneIntersect",
    "Math3D_TriSetCoords": "Math3D_TriNorm",
    "Math3D_IsPointInSphere": "Math3D_PointInSph",
    "Math3d_ColTriTri": "Math3D_TriVsTriIntersect",
    "func_8017DD34": "Math3D_GetSphVsTriIntersectPoint",
    "func_8017F9C0": "Math3D_XZInSphere",
    "func_8017FA34": "Math3D_XYInSphere",
    "func_8017FAA8": "Math3D_YZInSphere",

    "func_800DFB14": "Camera_ChangeActorCsCamIndex",
    "func_800DFC68": "Camera_GetInputDirYaw",
    "func_800DFCB4": "Camera_GetCamDirPitch",
    "func_800DFCDC": "Camera_GetCamDirYaw",
    "func_800E0308": "Camera_SetTargetActor",
    "func_800E031C": "Camera_GetWaterYPos",
    "func_800E02AC": "Camera_SetFocalActor",
    "func_800DFAC8": "Camera_ChangeSetting",
    "func_800DFC90": "Camera_GetCamDir",
    "func_800DFD04": "Camera_AddQuake",
    "func_800DFFAC": "Camera_ChangeDoorCam",
    "func_80169FFC": "Play_CamIsNotFixed",
    "func_801694DC": "Play_CreateSubCamera",
    "Play_GetActiveCameraIndex": "Play_GetActiveCamId",
    "func_80169590": "Play_ChangeCameraStatus",
    "Play_CameraChangeStatus": "Play_ChangeCameraStatus",
    "func_80169600": "Play_ClearCamera",
    "func_80169668": "Play_ClearAllSubCameras",
    "func_8016981C": "Play_SetCameraAtEyeUp",
    "func_80169940": "Play_SetCameraFov",
    "func_80169988": "Play_SetCameraRoll",
    "Play_CameraSetAtEyeUp": "Play_SetCameraAtEyeUp",
    "Play_CameraSetFov": "Play_SetCameraFov",
    "Play_CameraSetRoll": "Play_SetCameraRoll",
    "func_801699D4": "Play_CopyCamera",
    "func_80169AC0": "Play_ChangeCameraSetting",
    "Play_CameraChangeSetting": "Play_ChangeCameraSetting",
    "func_80169BC4": "Play_GetCameraUID",
    "Play_CameraGetUID": "Play_GetCameraUID",
    "func_80169C64": "Play_GetActorCsCamSetting",
    "Play_GetCsCamDataSetting": "Play_GetActorCsCamSetting",
    "func_80169C84": "Play_GetActorCsCamFuncData",
    "Play_GetCsCamDataVec3s": "Play_GetActorCsCamFuncData",
    "convert_scene_number_among_shared_scenes": "Play_GetOriginalSceneNumber",
    "func_80169D40": "Play_SaveCycleSceneFlags",
    "func_80169DCC": "Play_SetRespawnData",
    "func_80169E6C": "Play_SetupRespawnPoint",
    "func_8016A0AC": "Play_IsUnderwater",
    "func_801690CC": "Play_InCsMode",
    "func_80165658": "Play_SetMotionBlurAlpha",
    "func_8016566C": "Play_EnableMotionBlur",
    "func_80165690": "Play_DisableMotionBlur",
    "func_801660B8": "Play_SetFog",

    "func_801129E4": "Interface_SetSceneRestrictions",
    "func_8011B4E0": "Interface_SetPerfectLetters",
    "func_80112AFC": "Interface_InitMinigame",
    "func_8010E9F0": "Interface_StartTimer",
    "func_8010EA9C": "Interface_StartPostmanTimer",
    "func_80121F94": "Interface_Destroy",
    "Interface_ChangeAlpha": "Interface_SetHudVisibility",
    "func_80112B40": "Interface_LoadItemIconImpl",
    "func_80112BE4": "Interface_LoadItemIcon",
    "func_80114978": "Item_CheckObtainability",
    "func_801149A0": "Inventory_DeleteItem",
    "func_80114A9C": "Inventory_UnequipItem",
    "func_80114B84": "Inventory_ReplaceItem",
    "func_80114CA0": "Inventory_UpdateDeitySwordEquip",
    "Interface_HasEmptyBottle": "Inventory_HasEmptyBottle",
    "Interface_HasItemInBottle": "Inventory_HasItemInBottle",
    "func_80114FD0": "Inventory_UpdateBottleItem",
    "func_80115130": "Inventory_ConsumeFairy",
    "func_801152B8": "Inventory_UpdateItem",
    "func_80115908": "Health_ChangeBy",
    "func_801159C0": "Health_GiveHearts",
    "func_801159EC": "Rupees_ChangeBy",
    "func_80115A14": "Inventory_ChangeAmmo",
    "Parameter_AddMagic": "Magic_Add",
    "func_80115D5C": "Magic_Reset",
    "func_80115DB4": "Magic_Consume",
    "func_8013EC44": "Rumble_Override",
    "func_8013ECE0": "Rumble_Request",
    "func_8017D2FC": "Math3D_LineSegVsPlane",
    "func_800A81F0": "EffectBlure_AddVertex",
    "func_800A8514": "EffectBlure_AddSpace",
    "Effect_GetParams": "Effect_GetByIndex",

    "func_800FE484": "Environment_StopTime",
    "func_800FE498": "Environment_StartTime",
    "func_800FE4A8": "Environment_IsTimeStopped",
    "func_800F5A8C": "Environment_LerpWeight",
    "func_800FD2B4": "Environment_AdjustLights",
    "func_800FAAB4": "Environment_ChangeLightSetting",
    "func_800FD78C": "Environment_PlayStormNatureAmbience",
    "func_800FD858": "Environment_StopStormNatureAmbience",
    "func_800F6834": "Environment_EnableUnderwaterLights",
    "func_800F9824": "Environment_DrawLensFlare",
    "func_800FE658": "Environment_SetTimeJump",
    "func_800FE620": "Environment_GetTimeSpeed",
    "func_800FD750": "Environment_ForcePlaySequence",
    "func_800FE7A8": "Environment_LerpSandstormColors",
    "func_800FB758": "Environment_PlaySceneSequence",
    "func_800FE4B8": "Environment_GetStormState",
    "Kankyo_FadeInGameOverLights": "Environment_FadeInGameOverLights",
    "Kankyo_InitGameOverLights": "Environment_InitGameOverLights",
    "Kankyo_FadeOutGameOverLights": "Environment_FadeOutGameOverLights",
    "func_800F5090": "Environment_GraphCallback",
    "func_800F5954": "Environment_SmoothStepToU8",
    "func_800F5B10": "Environment_LerpWeightAccelDecel",
    "func_800F694C": "Environment_DisableUnderwaterLights",
    "func_800F6A40": "Environment_UpdateSkyboxRotY",
    "func_800F6AB8": "Environment_UpdateNextDayTime",
    "func_800F6B44": "Environment_UpdateTime",
    "Kankyo_IsSceneUpsideDown": "Environment_IsSceneUpsideDown",
    "func_800F6FF8": "Environment_UpdateLights",
    "func_800F8554": "Environment_UpdateSun",
    "func_800F8A9C": "Environment_UpdatePostmanEvents",
    "func_800F8D84": "Environment_DrawSun",
    "func_800FA39C": "Environment_RandCentered",
    "func_800FA3C4": "Environment_DrawRainImpl",
    "func_800FAC20": "Environment_DrawSkyboxFilters",
    "func_800FAF74": "Environment_DrawLightningFlash",
    "func_800FB010": "Environment_UpdateLightningStrike",
    "func_800FB388": "Environment_DrawLightning",
    "func_800FB9B4": "Environment_UpdateTimeBasedSequence",
    "func_800FC3DC": "Environment_UpdateRain",
    "func_800FD538": "Environment_LerpRGB8",
    "get_days_elapsed": "Environment_GetEventDayCount",
    "reset_days_elapsed": "Environment_ClearEventDayCount",
    "get_current_day": "Environment_GetTotalDays",
    "func_800FD768": "Environment_IsForcedSequenceDisabled",
    "func_800FD928": "Environment_WarpSongLeave",
    "func_800FD980": "Environment_SetupSkyboxStars",
    "func_800FDAF8": "Environment_DrawSkyboxStar",
    "func_800FDC94": "Environment_DrawSkyboxStarsImpl",
    "func_800FE390": "Environment_Draw",
    "func_800FE3E0": "Environment_DrawSkyboxStars",
    "func_800FE590": "Environment_IsFinalHours",
    "func_800FE778": "Environment_GetSandstormColorIndex",
    "func_800FE788": "Environment_GetNextSandstormColorIndex",
    "func_800FE798": "Environment_GetSandstormLerpScale",
    "func_800FE7A8": "Environment_LerpSandstormColors",
    "func_800FEAC0": "Environment_JumpForwardInTime",


    "func_801A3F54": "Audio_SetCutsceneFlag",
    "func_800EA0D4": "Cutscene_StartManual",
    "Cutscene_Start": "Cutscene_StartManual",
    "func_800EA0EC": "Cutscene_StopManual",
    "Cutscene_End": "Cutscene_StopManual",
    "func_800EDE34": "Cutscene_ActorTranslate",
    "func_800EDF24": "Cutscene_ActorTranslateAndYaw",
    "func_800EDF78": "Cutscene_ActorTranslateAndYawSmooth",
    "func_800EE0CC": "Cutscene_ActorTranslateXZAndYawSmooth",
    "func_800EE1D8": "Cutscene_GetSceneLayer",
    "func_800EE200": "Cutscene_GetCueChannel",
    "Cutscene_GetActorActionIndex": "Cutscene_GetCueChannel",
    "func_800EE29C": "Cutscene_IsCueInChannel",
    "Cutscene_CheckActorAction": "Cutscene_IsCueInChannel",
    "func_800EE2F4": "Cutscene_IsPlaying",
    "Cutscene_GetSceneSetupIndex": "Cutscene_GetSceneLayer",

    "func_800F15D8": "CutsceneManager_StoreCamera",
    "ActorCutscene_SetIntentToPlay": "CutsceneManager_Queue",
    "ActorCutscene_GetCanPlayNext": "CutsceneManager_IsNext",
    "ActorCutscene_StartAndSetUnkLinkFields": "CutsceneManager_StartWithPlayerCs",
    "ActorCutscene_StartAndSetFlag": "CutsceneManager_StartWithPlayerCsAndSetFlag",
    "ActorCutscene_Start": "CutsceneManager_Start",
    "ActorCutscene_Stop": "CutsceneManager_Stop",
    "ActorCutscene_GetCurrentIndex": "CutsceneManager_GetCurrentCsId",
    "ActorCutscene_GetCutscene": "CutsceneManager_GetCutsceneEntry",
    "ActorCutscene_GetAdditionalCutscene": "CutsceneManager_GetAdditionalCsId",
    "ActorCutscene_GetLength": "CutsceneManager_GetLength",
    "ActorCutscene_GetCurrentSubCamId": "CutsceneManager_GetCurrentSubCamId",
    "ActorCutscene_GetCurrentCamera": "CutsceneManager_GetCurrentSubCamId",

    "EnvFlags_UnsetAll": "CutsceneFlags_UnsetAll",
    "EnvFlags_Set": "CutsceneFlags_Set",
    "EnvFlags_Unset": "CutsceneFlags_Unset",
    "EnvFlags_Get": "CutsceneFlags_Get",

    "func_801343C0": "SkelAnime_DrawTransformFlexOpa",
    "func_80114E90": "Inventory_HasEmptyBottle",
    "func_80114F2C": "Inventory_HasItemInBottle",
    "func_80123C90": "Player_SetEquipmentData",
    "Quake2_SetType": "Distortion_Request",
    "Distortion_SetType": "Distortion_Request",
    "Quake2_SetCountdown": "Distortion_SetDuration",
    "Distortion_SetCountdown": "Distortion_SetDuration",
    "Distortion_GetCountdown": "Distortion_GetTimeLeft",
    "Quake2_ClearType": "Distortion_RemoveRequest",
    "Distortion_ClearType": "Distortion_RemoveRequest",
    "func_800BE680": "Actor_DrawDamageEffects",
    "func_8012F22C": "Inventory_GetSkullTokenCount",
    "Quake_Add": "Quake_Request",
    "Quake_SetQuakeValues": "Quake_SetPerturbations",
    "Quake_SetCountdown": "Quake_SetDuration",
    "Quake_GetCountdown": "Quake_GetTimeLeft",
    "Quake_NumActiveQuakes": "Quake_GetNumActiveQuakes",
    "Quake_RemoveFromIdx": "Quake_RemoveRequest",
    "OLib_DbCameraVec3fSum":"OLib_Vec3fAdd",

    "func_8013AB00": "SubS_DrawTransformFlex",
    "func_8013A860": "SubS_DrawTransformFlexLimb",
    "func_8013BC6C": "SubS_ChangeAnimationByInfoS",
    "func_8013E1C8": "SubS_ChangeAnimationBySpeedInfo",
    "func_8013D9C8": "SubS_UpdateFidgetTables",
    "SubS_FillLimbRotTables": "SubS_UpdateFidgetTables",
    "func_8013A7C0": "SubS_FindScheduleDoor",
    "SubS_FindDoor": "SubS_FindScheduleDoor",
    "func_8013E640": "SubS_FindActorCustom",
    "func_ActorCategoryIterateById": "SubS_FindActor",
    "func_8013BB7C": "SubS_FindNearestActor",
    "func_8013E2D4": "SubS_StartCutscene",
    "SubS_StartActorCutscene": "SubS_StartCutscene",
    "func_8013E3B8": "SubS_FillCutscenesList",
    "func_8013AED4": "SubS_SetOfferMode",
    "SubS_UpdateFlags": "SubS_SetOfferMode",
    "func_8013D8DC": "SubS_IsObjectLoaded",
    "func_8013D924": "SubS_GetObjectSlot",
    "SubS_GetObjectIndex": "SubS_GetObjectSlot",
    "func_8013D5E8": "SubS_AngleDiffLessEqual",
    "func_8013DCE0": "SubS_ActorPathing_Init",
    "func_8013DE04": "SubS_ActorPathing_Update",
    "func_8013DF3C": "SubS_ActorPathing_ComputePointInfo",
    "func_8013E054": "SubS_ActorPathing_MoveWithGravity",
    "func_8013E07C": "SubS_ActorPathing_MoveWithoutGravityReverse",
    "func_8013E0A4": "SubS_ActorPathing_SetNextPoint",
    "func_8013BB34": "SubS_GetAdditionalPath",
    "func_8013BD40": "SubS_HasReachedPoint",
    "func_8013BEDC": "SubS_GetDayDependentPath",
    "func_8013C8B8": "SubS_CopyPointFromPathCheckBounds",
    "func_8013D648": "SubS_GetPathByIndex",
    "func_8013D68C": "SubS_CopyPointFromPath",
    "func_8013D720": "SubS_GetDistSqAndOrientPoints",
    "func_8013D768": "SubS_MoveActorToPoint",
    "func_8013D83C": "SubS_GetDistSqAndOrientPath",
    "func_8013DB90": "SubS_IsFloorAbove",
    "func_8013DC40": "SubS_CopyPointFromPathList",
    "func_8013DCCC": "SubS_GetPathCount",
    "func_8013AD9C": "SubS_UpdateLimb",
    "func_8013D2E0": "SubS_TurnToPoint",
    "func_8013C964": "SubS_Offer",
    "func_8013E748": "SubS_OfferTalkExchangeCustom",
    "func_8013E8F8": "SubS_OfferTalkExchangeFacing",

    "func_80147624": "Message_ShouldAdvance",
    "func_80147734": "Message_ShouldAdvanceSilent",
    "func_80149EBC": "Message_FindMessage",
    "func_8014CC14": "Message_LoadChar",
    "func_801518B0": "Message_StartTextbox",
    "func_801588D0": "Message_FindMessageNES",
    "func_80158988": "Message_LoadCharNES",
    "func_80158A24": "Message_LoadPluralRupeesNES",
    "func_80158C04": "Message_LoadLocalizedRupeesNES",
    "func_80158D98": "Message_LoadRupeesNES",
    "func_80158FB0": "Message_LoadTimeNES",
    "func_8015926C": "Message_LoadOwlWarpTextNES",
    "func_8015E750": "Message_FindCreditsMessage",
    "func_80151BB4": "Message_BombersNotebookQueueEvent",
    "func_8014995C": "Message_DrawTextChar",
    "func_8014AAD0": "Message_HandleOcarina",
    "func_8014C70C": "Message_LoadItemIcon",
    "func_8015E7EC": "Message_DrawTextCredits",

    "func_80133038": "Schedule_RunScript",

    "Object_GetIndex": "Object_GetSlot",
    "Object_Spawn": "Object_SpawnPersistent",

    "EffectSsKiraKira_SpawnSmallYellow": "EffectSsKirakira_SpawnSmallYellow",
    "EffectSsKiraKira_SpawnSmall": "EffectSsKirakira_SpawnSmall",
    "EffectSsKiraKira_SpawnDispersed": "EffectSsKirakira_SpawnDispersed",
    "EffectSsKiraKira_SpawnFocused": "EffectSsKirakira_SpawnFocused",
    "Effect_Getplay": "Effect_GetPlayState",
    "Effect_GetGlobalCtx": "Effect_GetPlayState",
    "EffectSsHitMark_Spawn": "EffectSsHitmark_Spawn",
    "EffectSsHitMark_SpawnFixedScale": "EffectSsHitmark_SpawnFixedScale",
    "EffectSsHitMark_SpawnCustomScale": "EffectSsHitmark_SpawnCustomScale",

    "func_800E8F08": "Actor_TrackNone",
    "func_800E8FA4": "Actor_TrackPoint",
    "func_800E9250": "Actor_TrackPlayer",
    "func_800E8EA0": "Actor_ContinueText",
    "func_800B90F4": "Actor_DeactivateLens",

    "func_8010A000": "Map_GetDungeonSceneIndex",
    "func_8010A074": "Map_IsInDungeonOrBossScene",
    "func_8010A0F0": "Map_GetDungeonSceneIndexForDungeon",
    "func_8010A164": "Map_IsInDungeonScene",
    "Map_IsInDungeonArea": "Map_IsInDungeonScene",
    "func_8010A194": "Map_GetDungeonSceneIndexForBoss",
    "func_8010A208": "Map_IsInBossScene",
    "Map_IsInBossArea": "Map_IsInBossScene",
    "func_8010A2DC": "Minimap_SavePlayerRoomInitInfo",
    "func_8010A33C": "Map_InitRoomData",
    "func_8010A410": "Map_Destroy",
    "func_8010A430": "Map_Init",
    "func_8010A54C": "Map_DrawMinimap",
    "Minimap_Draw": "Map_DrawMinimap",
    "func_8010A580": "Map_Update",

    "Entrance_CreateIndex": "Entrance_Create",
    "Entrance_CreateIndexFromSpawn": "Entrance_CreateFromSpawn",

    "func_80102544": "LightContext_SetFog",

    "func_800F3A64": "Horse_IsValidSpawn",
    "func_800F3B2C": "Horse_ResetHorseData",
    "func_800F40A0": "Horse_Spawn",
    "func_800F415C": "Horse_RotateToPoint",
    "func_800F41E4": "Horse_IsActive",

    "Padmgr_GetControllerBitmask": "PadMgr_GetValidControllersMask",
    "func_80174F24": "PadMgr_SetRumbleRetraceCallback",
    "func_80174F44": "PadMgr_UnsetRumbleRetraceCallback",
    "func_80174F7C": "PadMgr_SetInputRetraceCallback",
    "func_80174F9C": "PadMgr_UnsetInputRetraceCallback",
    "Padmgr_GetEventCallback": "PadMgr_AcquireSerialEventQueue",
    "func_80175008": "PadMgr_VoiceAcquireSerialEventQueue",
    "Padmgr_SetEventCallback": "PadMgr_ReleaseSerialEventQueue",
    "func_8017506C": "PadMgr_VoiceReleaseSerialEventQueue",
    "Padmgr_Lock": "PadMgr_LockPadData",
    "Padmgr_Unlock": "PadMgr_UnlockPadData",
    "func_801750FC": "PadMgr_UpdateRumble",
    "func_80175364": "PadMgr_RumbleStop",
    "func_80175434": "PadMgr_RumblePause",
    "func_8017544C": "PadMgr_RumbleSetSingle",
    "Padmgr_ParseState": "PadMgr_UpdateInputs",
    "func_801759BC": "PadMgr_InitVoice",
    "func_80175AE0": "PadMgr_UpdateConnections",
    "Padmgr_Update": "PadMgr_HandleRetrace",
    "Padmgr_Stop": "PadMgr_HandlePreNMI",
    "func_80175E68": "PadMgr_GetInputNoLock",

    "Gfx_CallSetupDL": "Gfx_SetupDL",
    "func_8012BFC4": "Gfx_SetupDL57",
    "func_8012BFEC": "Gfx_SetupDL57_b",
    "func_8012C014": "Gfx_SetupDL52_NoCD",
    "func_8012C058": "Gfx_SetupDL58_Opa",
    "func_8012C080": "Gfx_SetupDL57_Opa",
    "func_8012C0A8": "Gfx_SetupDL50_Opa",
    "func_8012C0D0": "Gfx_SetupDL51_Opa",
    "func_8012C0F8": "Gfx_SetupDL52_Xlu",
    "func_8012C120": "Gfx_SetupDL53_Opa",
    "func_8012C148": "Gfx_SetupDL54_Opa",
    "func_8012C170": "Gfx_SetupDL55_Xlu",
    "func_8012C198": "Gfx_SetupDL26",
    "func_8012C1C0": "Gfx_SetupDL26_Opa",
    "func_8012C1EC": "Gfx_SetupDL23",
    "func_8012C214": "Gfx_SetupDL23_Opa",
    "func_8012C240": "Gfx_SetupDL25_Xlu2",
    "func_8012C28C": "Gfx_SetupDL25_Opa",
    "func_8012C2B4": "Gfx_SetupDL71",
    "func_8012C2DC": "Gfx_SetupDL25_Xlu",
    "func_8012C304": "Gfx_SetupDL72",
    "func_8012C32C": "Gfx_SetupDL31_Opa",
    "func_8012C354": "Gfx_SetupDL32_Opa",
    "func_8012C37C": "Gfx_SetupDL33_Opa",
    "func_8012C3A4": "Gfx_SetupDL64",
    "func_8012C3CC": "Gfx_SetupDL34",
    "func_8012C3F4": "Gfx_SetupDL34_Opa",
    "func_8012C420": "Gfx_SetupDL35_Opa",
    "func_8012C448": "Gfx_SetupDL44_Xlu",
    "func_8012C470": "Gfx_SetupDL36_Opa",
    "func_8012C498": "Gfx_SetupDL28",
    "func_8012C4C0": "Gfx_SetupDL28_Opa",
    "func_8012C4E8": "Gfx_SetupDL43_Opa",
    "func_8012C510": "Gfx_SetupDL45_Opa",
    "func_8012C538": "Gfx_SetupDL46_Overlay",
    "func_8012C560": "Gfx_SetupDL38_Xlu",
    "func_8012C588": "Gfx_SetupDL4_Xlu",
    "func_8012C5B0": "Gfx_SetupDL37_Opa",
    "func_8012C5D8": "Gfx_SetupDL2_Opa",
    "func_8012C600": "Gfx_SetupDL39",
    "func_8012C628": "Gfx_SetupDL39_Opa",
    "func_8012C654": "Gfx_SetupDL39_Overlay",
    "func_8012C680": "Gfx_SetupDL39_Ptr",
    "func_8012C6AC": "Gfx_SetupDL40_Opa",
    "func_8012C6D4": "Gfx_SetupDL41_Opa",
    "func_8012C6FC": "Gfx_SetupDL47_Xlu",
    "func_8012C724": "Gfx_SetupDL66",
    "func_8012C74C": "Gfx_SetupDL67",
    "func_8012C774": "Gfx_SetupDL68_NoCD",
    "func_8012C7B8": "Gfx_SetupDL69_NoCD",
    "func_8012C7FC": "Gfx_SetupDL65_NoCD",
    "func_8012C840": "Gfx_SetupDL70",
    "func_8012C868": "Gfx_SetupDL20_NoCD",
    "func_8012C8AC": "Gfx_SetupDL42_Opa",
    "func_8012C8D4": "Gfx_SetupDL42_Overlay",
    "func_8012C8FC": "Gfx_SetupDL48_Opa",
    "func_8012C924": "Gfx_SetupDL49_Xlu",
    "func_8012C94C": "Gfx_SetupDL27_Xlu",
    "func_8012C974": "Gfx_SetupDL60_XluNoCD",
    "func_8012C9BC": "Gfx_SetupDL61_Xlu",
    "func_8012C9E4": "Gfx_SetupDL56_Opa",
    "func_8012CA0C": "Gfx_SetupDL56_Ptr",
    "func_8012CA38": "Gfx_SetupDL59_Opa",

    "Game_SetFramerateDivisor": "GameState_SetFramerateDivisor",

    "DmaMgr_SendRequestImpl": "DmaMgr_RequestAsync",
    "DmaMgr_SendRequest0": "DmaMgr_RequestSync",

    # Structs
    "ActorAnimationEntry": "AnimationInfo",
    "ActorAnimationEntryS": "AnimationInfoS",
    "struct_80B8E1A8": "AnimationSpeedInfo",
    "GlobalContext": "PlayState",
    "globalCtx": "play",
    "globalCtx2": "play2",
    "ScheduleResult": "ScheduleOutput",
    "LinkAnimationHeader": "PlayerAnimationHeader",

    # Struct members
    "skelAnime.unk03": "skelAnime.taper",
    "skelAnime.animCurrentSeg": "skelAnime.animation",
    "skelAnime.initialFrame": "skelAnime.startFrame",
    "skelAnime.animFrameCount": "skelAnime.endFrame",
    "skelAnime.totalFrames": "skelAnime.animLength",
    "skelAnime.animCurrentFrame": "skelAnime.curFrame",
    "skelAnime.animPlaybackSpeed": "skelAnime.playSpeed",
    "skelAnime.limbDrawTbl": "skelAnime.jointTable",
    "skelAnime.transitionDrawTbl": "skelAnime.morphTable",
    "skelAnime.transCurrentFrame": "skelAnime.morphWeight",
    "skelAnime.transitionStep": "skelAnime.morphRate",
    "skelAnime.animUpdate": "skelAnime.update",
    "skelAnime.flags": "skelAnime.moveFlags",
    "skelAnime.prevFrameRot": "skelAnime.prevYaw",
    "skelAnime.prevFramePos": "skelAnime.prevTransl",
    "skelAnime.unk3E": "skelAnime.baseTransl",
    "actor.unk20": "actor.halfDaysBits",
    "actor.minVelocityY": "actor.terminalVelocity",
    "actor.yDistToWater": "actor.depthInWater",
    "actor.yDistToPlayer": "actor.playerHeightRel",
    "actor.cutscene": "actor.csId",
    "actor.speedXZ": "actor.speed",
    "actor.isTargeted": "actor.isLockedOn",
    "actor->isTargeted": "actor->isLockedOn",
    "thisx->speedXZ": "thisx->speed",

    "gSaveContext.unk_3F1E": "gSaveContext.hudVisibilityForceButtonAlphasByStatus",
    "gSaveContext.unk_3F20": "gSaveContext.nextHudVisibility",
    "gSaveContext.unk_3F22": "gSaveContext.hudVisibility",
    "gSaveContext.unk_3F24": "gSaveContext.hudVisibilityTimer",
    "gSaveContext.unk_3F26": "gSaveContext.prevHudVisibility",
    "gSaveContext.weekEventReg": "gSaveContext.save.saveInfo.weekEventReg",
    "gSaveContext.playerForm": "gSaveContext.save.playerForm",
    "gSaveContext.day": "gSaveContext.save.day",
    "gSaveContext.isNight": "gSaveContext.save.isNight",
    "gSaveContext.environmentTime": "gSaveContext.skyboxTime",
    "gSaveContext.naviTimer": "gSaveContext.save.saveInfo.playerData.tatlTimer",
    "gSaveContext.tatlTimer": "gSaveContext.save.saveInfo.playerData.tatlTimer",
    "gSaveContext.rupees": "gSaveContext.save.saveInfo.playerData.rupees",
    "gSaveContext.magicAcquired": "gSaveContext.save.saveInfo.playerData.isMagicAcquired",
    "gSaveContext.doubleMagic": "gSaveContext.save.saveInfo.playerData.isDoubleMagicAcquired",
    "gSaveContext.doubleDefense": "gSaveContext.save.saveInfo.playerData.doubleDefense",
    "gSaveContext.playerName": "gSaveContext.save.saveInfo.playerData.playerName",
    "gSaveContext.inventory": "gSaveContext.save.saveInfo.inventory",
    "gSaveContext.equippedMask": "gSaveContext.save.equippedMask",
    "gSaveContext.entranceIndex": "gSaveContext.save.entrance",
    "gSaveContext.time": "gSaveContext.save.time",
    "gSaveContext.save.daySpeed": "gSaveContext.save.timeSpeedOffset",
    "gSaveContext.unk_14": "gSaveContext.save.timeSpeedOffset",
    "gSaveContext.unk_FE6": "gSaveContext.save.saveInfo.bombersCaughtNum",
    "gSaveContext.unk_FE7": "gSaveContext.save.saveInfo.bombersCaughtOrder",
    "gSaveContext.linkAge": "gSaveContext.save.linkAge",
    "gSaveContext.dekuPlaygroundHighScores": "gSaveContext.save.saveInfo.dekuPlaygroundHighScores",
    "gSaveContext.lotteryCodeGuess": "gSaveContext.save.saveInfo.lotteryCodeGuess",
    "gSaveContext.permanentSceneFlags": "gSaveContext.save.saveInfo.permanentSceneFlags",
    "gSaveContext.bomberCode": "gSaveContext.save.saveInfo.bomberCode",
    "gSaveContext.skullTokenCount": "gSaveContext.save.saveInfo.skullTokenCount",
    "gSaveContext.cutscene": "gSaveContext.save.cutsceneIndex",
    "gSaveContext.save.cutscene": "gSaveContext.save.cutsceneIndex",
    "gSaveContext.health": "gSaveContext.save.saveInfo.playerData.health",
    "gSaveContext.equips": "gSaveContext.save.saveInfo.equips",
    "gSaveContext.unk_1016": "gSaveContext.jinxTimer",
    "gSaveContext.unk_3F58": "gSaveContext.sunsSongState",
    "gSaveContext.equips.buttonItems": "gSaveContext.save.equips.buttonItems",
    "gSaveContext.unk_48C8": "gSaveContext.dungeonIndex",
    "gSaveContext.save.saveInfo.playerData.magicAcquired": "gSaveContext.save.saveInfo.playerData.isMagicAcquired",
    "gSaveContext.save.playerData.doubleMagic": "gSaveContext.save.saveInfo.playerData.isDoubleMagicAcquired",
    "gSaveContext.unk_3F28": "gSaveContext.magicState",
    "gSaveContext.unk_3F30": "gSaveContext.magicFillTarget",
    "gSaveContext.unk_3F2C": "gSaveContext.magicFlag",
    "gSaveContext.save.entranceIndex": "gSaveContext.save.entrance",
    "gSaveContext.sceneSetupIndex": "gSaveContext.sceneLayer",
    "gSaveContext.seqIndex": "gSaveContext.seqId",
    "gSaveContext.nightSeqIndex": "gSaveContext.ambienceId",
    "gSaveContext.minigameState": "gSaveContext.minigameStatus",
    "gSaveContext.unk_3F3C": "gSaveContext.minigameHiddenScore",
    "gSaveContext.save.playerData": "gSaveContext.save.saveInfo.playerData",
    "gSaveContext.save.equips": "gSaveContext.save.saveInfo.equips",
    "gSaveContext.save.inventory": "gSaveContext.save.saveInfo.inventory",
    "gSaveContext.save.permanentSceneFlags": "gSaveContext.save.saveInfo.permanentSceneFlags",

    "gSaveContext.save.unk_E18": "gSaveContext.save.saveInfo.unk_E5C",
    "gSaveContext.save.dekuPlaygroundHighScores": "gSaveContext.save.saveInfo.dekuPlaygroundHighScores",
    "gSaveContext.save.pictoFlags0": "gSaveContext.save.saveInfo.pictoFlags0",
    "gSaveContext.save.pictoFlags1": "gSaveContext.save.saveInfo.pictoFlags1",
    "gSaveContext.save.unk_E84": "gSaveContext.save.saveInfo.unk_E60",
    "gSaveContext.save.unk_E88": "gSaveContext.save.saveInfo.unk_E64",
    "gSaveContext.save.unk_E64": "gSaveContext.save.saveInfo.alienInfo",
    "gSaveContext.save.scenesVisible": "gSaveContext.save.saveInfo.scenesVisible",
    "gSaveContext.save.skullTokenCount": "gSaveContext.save.saveInfo.skullTokenCount",
    "gSaveContext.save.unk_EC4": "gSaveContext.save.saveInfo.unk_EA0",
    "gSaveContext.save.unk_EC8": "gSaveContext.save.saveInfo.unk_EA4",
    "gSaveContext.save.unk_ECC": "gSaveContext.save.saveInfo.unk_EA8",
    "gSaveContext.save.stolenItems": "gSaveContext.save.saveInfo.stolenItems",
    "gSaveContext.save.unk_DD8": "gSaveContext.save.saveInfo.unk_EB4",
    "gSaveContext.save.bankRupees": "gSaveContext.save.saveInfo.bankRupees",
    "gSaveContext.save.unk_EE0": "gSaveContext.save.saveInfo.unk_EBC",
    "gSaveContext.save.unk_EE4": "gSaveContext.save.saveInfo.unk_EC0",
    "gSaveContext.save.unk_EE8": "gSaveContext.save.saveInfo.unk_EC4",
    "gSaveContext.save.horseBackBalloonHighScore": "gSaveContext.save.saveInfo.horseBackBalloonHighScore",
    "gSaveContext.save.lotteryCodeGuess": "gSaveContext.save.saveInfo.lotteryCodeGuess",
    "gSaveContext.save.shootingGalleryHighScores": "gSaveContext.save.saveInfo.shootingGalleryHighScores",
    "gSaveContext.save.weekEventReg": "gSaveContext.save.saveInfo.weekEventReg",
    "gSaveContext.save.regionsVisited": "gSaveContext.save.saveInfo.regionsVisited",
    "gSaveContext.save.worldMapCloudVisibility": "gSaveContext.save.saveInfo.worldMapCloudVisibility",
    "gSaveContext.save.unk_F64": "gSaveContext.save.saveInfo.unk_F40",
    "gSaveContext.save.unk_F65": "gSaveContext.save.saveInfo.unk_F41",
    "gSaveContext.save.scarecrowSpawnSong": "gSaveContext.save.saveInfo.scarecrowSpawnSong",
    "gSaveContext.save.bombersCaughtNum": "gSaveContext.save.saveInfo.bombersCaughtNum",
    "gSaveContext.save.bombersCaughtOrder": "gSaveContext.save.saveInfo.bombersCaughtOrder",
    "gSaveContext.save.lotteryCodes": "gSaveContext.save.saveInfo.lotteryCodes",
    "gSaveContext.save.spiderHouseMaskOrder": "gSaveContext.save.saveInfo.spiderHouseMaskOrder",
    "gSaveContext.save.bomberCode": "gSaveContext.save.saveInfo.bomberCode",
    "gSaveContext.save.horseData": "gSaveContext.save.saveInfo.horseData",
    "gSaveContext.save.checksum": "gSaveContext.save.saveInfo.checksum",

    "gSaveContext.save.daysElapsed": "gSaveContext.save.eventDayCount",

    "player->unk_A87": "player->exchangeItemAction",
    "player->exchangeItemId": "player->exchangeItemAction",
    "player->leftHandActor": "player->heldActor",
    "player->unk_384": "player->getItemId",
    "player->unk_386": "player->getItemDirection",
    "player->unk_388": "player->interactRangeActor",
    "player->unk_38C": "player->mountSide",
    "player->csMode": "player->csAction",
    "player->unk_394": "player->csAction",
    "player->swordQuads": "player->meleeWeaponQuads",
    "player->blureEffectIndex": "player->meleeWeaponEffectIndex",
    "player->unk_AD8": "player->underwaterTimer",
    "player->swordAnimation": "player->meleeWeaponAnimation",
    "player->swordState": "player->meleeWeaponState",
    "player->swordInfo": "player->meleeWeaponInfo",
    "player->itemActionParam": "player->heldItemAction",
    "player->heldItemActionParam": "player->itemAction",
    "player->unk_A86": "player->currentActorCsIndex",
    "player->unk_A9C": "player->secretRumbleCharge",
    "player->unk_AA0": "player->closestSecretDistSq",
    "player->unk_AAC": "player->headLimbRot",
    "player->unk_AB2": "player->upperLimbRot",
    "player->unk_AE7": "player->av1.actionVar1",
    "player->unk_AE8": "player->av2.actionVar2",
    "player->actionVar1": "player->av1.actionVar1",
    "player->actionVar2": "player->av2.actionVar2",
    "player->unk_B2A": "player->getItemDrawIdPlusOne",
    "player->getItemDrawId": "player->getItemDrawIdPlusOne",
    "player->unk_B68": "player->fallStartHeight",
    "player->unk_B6A": "player->fallDistance",
    "player->unk_B80": "player->pushedSpeed",
    "player->unk_B84": "player->pushedYaw",
    "player->targetActor": "player->talkActor",
    "player->targetActorDistance": "player->talkActorDistance",
    "player->unk_730": "player->focusActor",
    "player->targetedActor": "player->focusActor",

    "ageProperties->unk_04": "ageProperties->shadowScale",
    "ageProperties->unk_92": "ageProperties->voiceSfxOffset",
    "ageProperties->unk_94": "ageProperties->surfaceSfxOffset",
    "player->unk_A86": "player->csId",

    "csCtx.npcActions": "csCtx.actorCues",
    "csCtx->npcActions": "csCtx->actorCues",
    "csCtx.actorActions": "csCtx.actorCues",
    "csCtx->actorActions": "csCtx->actorCues",
    "csCtx.playerAction": "csCtx.playerCue",
    "csCtx->playerAction": "csCtx->playerCue",
    "csCtx.unk_12": "csCtx.scriptIndex",
    "csCtx.currentCsIndex": "csCtx.scriptIndex",
    "csCtx->currentCsIndex": "csCtx->scriptIndex",
    "csCtx.frames": "csCtx.curFrame",
    "csCtx->frames": "csCtx->curFrame",

    "globalCtx->mf_187FC": "play->billboardMtxF",
    "globalCtx->projectionMatrix": "play->viewProjectionMtxF",
    "globalCtx->actorCtx.actorList[": "play->actorCtx.actorLists[",
    "globalCtx->envCtx.unk_8C": "play->envCtx.adjLightSettings",
    "globalCtx->envCtx.unk_E5": "play->envCtx.fillScreen",
    "globalCtx->envCtx.unk_E6": "play->envCtx.screenFillColor",
    "globalCtx->envCtx.unk_C3": "play->envCtx.lightSettingOverride",
    "globalCtx->envCtx.unk_DC": "play->envCtx.lightBlend",
    "globalCtx->interfaceCtx.unk_21E": "play->interfaceCtx.bButtonPlayerDoAction",
    "globalCtx->interfaceCtx.bButtonDoAction": "play->interfaceCtx.bButtonPlayerDoAction",
    "play->interfaceCtx.unk_31A": "play->interfaceCtx.storyState",
    "play->interfaceCtx.unk_31B": "play->interfaceCtx.storyType",
    "play->interfaceCtx.unk_25C": "play->interfaceCtx.minigamePoints",
    "play->interfaceCtx.unk_25E": "play->interfaceCtx.minigameHiddenPoints",
    "play->interfaceCtx.unk_280": "play->interfaceCtx.minigameState",
    "play->interfaceCtx.unk_286": "play->interfaceCtx.perfectLettersOn",
    "play->interfaceCtx.hbaAmmo": "play->interfaceCtx.minigameAmmo",

    # "play->actorCtx.flags": "play->actorCtx.sceneFlags",
    # "play->actorCtx.unk5": "play->actorCtx.flags",
    "play->msgCtx.unk11F04": "play->msgCtx.currentTextId",
    "play->msgCtx.unk11F10": "play->msgCtx.msgLength",
    "play->msgCtx.unk11F22": "play->msgCtx.msgMode",
    "play->msgCtx.unk12023": "play->msgCtx.stateTimer",
    "play->msgCtx.unk1202A": "play->msgCtx.ocarinaMode",
    "play->msgCtx.unk1202C": "play->msgCtx.ocarinaAction",
    "play->msgCtx.unk12048": "play->msgCtx.ocarinaButtonIndex",
    "play->msgCtx.unk120B0": "play->msgCtx.ocarinaSongEffectActive",
    "play->msgCtx.unk12046": "play->msgCtx.blockSunsSong",
    "play->msgCtx.unk12090": "play->msgCtx.textIsCredits",
    "play->msgCtx.unk_120BC": "play->msgCtx.hudVisibility",

    "msgCtx->unk11EF8": "msgCtx->textboxSegment",
    "msgCtx->unk11F14": "msgCtx->nextTextId",
    "msgCtx->unk11FF2": "msgCtx->textUnskippable",
    "msgCtx->unk11FF4": "msgCtx->textPosX",
    "msgCtx->unk11FF6": "msgCtx->textPosY",
    "msgCtx->unk12004": "msgCtx->textboxXTarget",
    "msgCtx->unk12006": "msgCtx->textboxYTarget",
    "msgCtx->unk1201E": "msgCtx->textColorAlpha",
    "msgCtx->unk12020": "msgCtx->textboxEndType",
    "msgCtx->unk12024": "msgCtx->textDelayTimer",
    "msgCtx->unk1203A": "msgCtx->textboxColorAlphaTarget",
    "msgCtx->unk1203C": "msgCtx->textboxColorAlphaCurrent",
    "msgCtx->unk1204A": "msgCtx->ocarinaButtonsPosY",
    "msgCtx->unk12068": "msgCtx->textboxX",
    "msgCtx->unk1206A": "msgCtx->textboxY",
    "msgCtx->unk12090": "msgCtx->textIsCredits",
    "msgCtx->unk12092": "msgCtx->messageHasSetSfx",
    "msgCtx->unk12094": "msgCtx->textboxSkipped",
    "msgCtx->unk12098": "msgCtx->textCharScale",
    "msgCtx->unk1209C": "msgCtx->textFade",
    "msgCtx->unk120A0": "msgCtx->ocarinaAvailableSongs",
    "msgCtx->unk120B0": "msgCtx->ocarinaSongEffectActive",
    "msgCtx->unkActor": "msgCtx->talkActor",

    "play->actorCtx.unk3": "play->actorCtx.lensActive",
    "play->actorCtx.unk4": "play->actorCtx.lensMaskSize",
    "play->actorCtx.targetContext": "play->actorCtx.attention",
    "play->actorCtx.attention.unk0": "play->actorCtx.attention.tatlHoverPos",
    "play->actorCtx.attention.unk40": "play->actorCtx.attention.tatlMoveProgressFactor",
    "play->actorCtx.attention.unk44": "play->actorCtx.attention.lockOnRadius",
    "play->actorCtx.attention.unk48": "play->actorCtx.attention.lockOnAlpha",
    "play->actorCtx.attention.unk4B": "play->actorCtx.attention.rotation",
    "play->actorCtx.attention.unk4C": "play->actorCtx.attention.lockOnIndex",
    "play->actorCtx.attention.unk50": "play->actorCtx.attention.lockOnTriangleSets",
    "play->actorCtx.attention.unk8C": "play->actorCtx.attention.nextTarget",
    "play->actorCtx.titleCtxt": "play->actorCtx.titleCtx",
    "play->doorCtx.transitionActorList": "play->transitionActors.list",
    "play->nextEntranceIndex": "play->nextEntrance",
    "play->sceneNum": "play->sceneId",
    "play->pauseCtx.unk_1F0": "play->pauseCtx.bombersNotebookOpen",
    "play->sceneLoadFlag": "play->transitionTrigger",
    "play->unk_18B4A": "play->transitionMode",
    "play->unk_1887F": "play->transitionType",
    "play->playerActorCsIds": "play->playerCsIds",
    "play->envFlags": "play->cutsceneFlags",
    "play->roomCtx.curRoom.unk3": "play->roomCtx.curRoom.behaviorType1",
    "play->roomCtx.curRoom.unk2": "play->roomCtx.curRoom.behaviorType2",
    "play->roomCtx.unk31": "play->roomCtx.status",
    "play->objectCtx.status": "play->objectCtx.slots",

    "play->envCtx.unk_E0": "play->envCtx.lightBlendOverride",
    "play->envCtx.unk_E1": "play->envCtx.stormRequest",
    "play->envCtx.unk_E2": "play->envCtx.stormState",
    "play->envCtx.unk_E3": "play->envCtx.lightningState",
    "play->envCtx.unk_E4": "play->envCtx.timeSeqState",
    "play->envCtx.unk_F2": "play->envCtx.precipitation",
    "play->envCtx.windDir": "play->envCtx.windDirection",
    "play->envCtx.sunMoonDisabled": "play->envCtx.sunDisabled",

    "actorCtx.unkC": "actorCtx.halfDaysBit",
    "actorCtx.unk1F4": "actorCtx.playerImpact.type",
    "actorCtx.unk1F5": "actorCtx.playerImpact.timer",
    "actorCtx.unk1F8": "actorCtx.playerImpact.dist",
    "actorCtx.unk1FC": "actorCtx.playerImpact.pos",
    "actorCtx.unk_1F4.unk_00": "actorCtx.playerImpact.type",
    "actorCtx.unk_1F4.timer": "actorCtx.playerImpact.timer",
    "actorCtx.unk_1F4.unk_04": "actorCtx.playerImpact.dist",
    "actorCtx.unk_1F4.unk_08": "actorCtx.playerImpact.pos",
    "actorCtx->titleCtxt": "actorCtx->titleCtx",

    "gSaveContext.unk_3DC8": "gSaveContext.timerOsTime",
    "gSaveContext.unk_3DD0": "gSaveContext.timerStates",
    "gSaveContext.unk_3DD7": "gSaveContext.timerDirections",
    "gSaveContext.unk_3DE0": "gSaveContext.timerCurTimes",
    "gSaveContext.unk_3E18": "gSaveContext.timerTimeLimits",
    "gSaveContext.unk_3E50": "gSaveContext.timerStartOsTimes",
    "gSaveContext.unk_3E88": "gSaveContext.timerStopTimes",
    "gSaveContext.unk_3EC0": "gSaveContext.timerPausedOsTimes",
    "gSaveContext.nextTransition": "gSaveContext.nextTransitionType",
    "gSaveContext.unk_3F48": "gSaveContext.cutsceneTransitionControl",
    "gSaveContext.fadeDuration": "gSaveContext.transFadeDuration",
    "gSaveContext.fadeSpeed": "gSaveContext.transWipeSpeed",

    "path->unk1": "path->additionalPathIndex",
    "path->unk2": "path->customValue",

    "D_801D15B0": "gZeroVec3f",
    "D_801D15BC": "gZeroVec3s",
    "D_801D1DE0": "gIdentityMtx",
    "D_801D1E20": "gIdentityMtxF",
    "sSetupDL": "gSetupDLs",
    "D_801AEFA0": "gActorSetupOpaDL",
    "D_801AEF88": "gActorSetupXluDL",

    "gFaultStruct": "gFaultMgr",

    "D_801BDA9C": "gHorseIsMounted",
    "D_801BDAA4": "gHorsePlayedEponasSong",

    "D_801BDBC8": "gSceneSeqState",
    "D_801F4E32": "gCustomLensFlare1On",
    "D_801F4E38": "gCustomLensFlare1Pos",
    "D_801F4E4E": "gCustomLensFlare2On",
    "D_801F4E50": "gCustomLensFlare2Pos",
    "D_801F4E7A": "gSkyboxNumStars",
    "D_801BDBB8": "gInterruptSongOfStorms",
    "D_801BDBB4": "gLightConfigAfterUnderwater",
    "D_801F4E68": "gLightningStrike",

    # Macros
    "CUR_EQUIP_VALUE_VOID": "GET_CUR_EQUIP_VALUE",
    "CUR_UPG_VALUE_VOID": "GET_CUR_UPG_VALUE",
    "ICHAIN_F32_DIV1000(minVelocityY,": "ICHAIN_F32_DIV1000(terminalVelocity,",
    "ICHAIN_F32(minVelocityY,": "ICHAIN_F32(terminalVelocity,",

    "RADF_TO_BINANG": "RAD_TO_BINANG",
    "RADF_TO_DEGF": "RAD_TO_DEG",
    "DEGF_TO_RADF": "DEG_TO_RAD",

    "ACTORCTX_FLAG_1": "ACTORCTX_FLAG_TELESCOPE_ON",
    "ACTORCTX_FLAG_2": "ACTORCTX_FLAG_PICTO_BOX_ON",

    "ACTOR_FLAG_1": "ACTOR_FLAG_ATTENTION_ENABLED",
    "ACTOR_FLAG_4": "ACTOR_FLAG_HOSTILE",
    "ACTOR_FLAG_8": "ACTOR_FLAG_FRIENDLY",
    "ACTOR_FLAG_100": "ACTOR_FLAG_TALK",
    "ACTOR_FLAG_TALK_REQUESTED": "ACTOR_FLAG_TALK",
    "ACTOR_FLAG_8000000": "ACTOR_FLAG_LOCK_ON_DISABLED",

    "EXCH_ITEM_MINUS1": "PLAYER_IA_MINUS1",
    "EXCH_ITEM_NONE": "PLAYER_IA_NONE",
    "EXCH_ITEM_PICTO_BOX": "PLAYER_IA_PICTOGRAPH_BOX",
    "EXCH_ITEM_1E": "PLAYER_IA_BOTTLE_MUSHROOM",
    "EXCH_ITEM_MOON_TEAR": "PLAYER_IA_MOONS_TEAR",
    "EXCH_ITEM_DEED_LAND": "PLAYER_IA_DEED_LAND",
    "EXCH_ITEM_ROOM_KEY": "PLAYER_IA_ROOM_KEY",
    "EXCH_ITEM_LETTER_TO_KAFEI": "PLAYER_IA_LETTER_TO_KAFEI",
    "EXCH_ITEM_2E": "PLAYER_IA_MAGIC_BEANS",
    "EXCH_ITEM_DEED_SWAMP": "PLAYER_IA_DEED_SWAMP",
    "EXCH_ITEM_DEED_MOUNTAIN": "PLAYER_IA_DEED_MOUNTAIN",
    "EXCH_ITEM_DEED_OCEAN": "PLAYER_IA_DEED_OCEAN",
    "EXCH_ITEM_LETTER_MAMA": "PLAYER_IA_LETTER_MAMA",
    "ITEM_FISHING_POLE": "ITEM_FISHING_ROD",
    "ITEM_OCARINA": "ITEM_OCARINA_OF_TIME",
    "ITEM_STICK": "ITEM_DEKU_STICK",
    "ITEM_NUT": "ITEM_DEKU_NUT",
    "ITEM_PICTO_BOX": "ITEM_PICTOGRAPH_BOX",
    "ITEM_LENS": "ITEM_LENS_OF_TRUTH",
    "ITEM_MAGIC_SMALL": "ITEM_MAGIC_JAR_SMALL",
    "ITEM_MAGIC_LARGE": "ITEM_MAGIC_JAR_BIG",
    "ITEM_MOON_TEAR": "ITEM_MOONS_TEAR",
    "PLAYER_AP_FISHING_POLE": "PLAYER_IA_FISHING_ROD",
    "PLAYER_IA_BOTTLE": "PLAYER_IA_BOTTLE_EMPTY",

    "WEEKEVENTREG_20_02": "WEEKEVENTREG_CLEARED_WOODFALL_TEMPLE",
    "WEEKEVENTREG_33_80": "WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE",
    "WEEKEVENTREG_52_20": "WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE",
    "WEEKEVENTREG_55_80": "WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE",

    "VIRTUAL_TO_PHYSICAL": "OS_K0_TO_PHYSICAL",
    "SEGMENTED_TO_VIRTUAL": "SEGMENTED_TO_K0",

    # Enums
    "TRANS_TYPE_00": "TRANS_TYPE_WIPE",
    "TRANS_TYPE_01": "TRANS_TYPE_TRIFORCE",
    "TRANS_TYPE_02": "TRANS_TYPE_FADE_BLACK",
    "TRANS_TYPE_03": "TRANS_TYPE_FADE_WHITE",
    "TRANS_TYPE_04": "TRANS_TYPE_FADE_BLACK_FAST",
    "TRANS_TYPE_05": "TRANS_TYPE_FADE_WHITE_FAST",
    "TRANS_TYPE_06": "TRANS_TYPE_FADE_BLACK_SLOW",
    "TRANS_TYPE_07": "TRANS_TYPE_FADE_WHITE_SLOW",
    "TRANS_TYPE_08": "TRANS_TYPE_WIPE_FAST",
    "TRANS_TYPE_09": "TRANS_TYPE_FILL_WHITE_FAST",
    "TRANS_TYPE_10": "TRANS_TYPE_FILL_WHITE",
    "TRANS_TYPE_11": "TRANS_TYPE_INSTANT",
    "TRANS_TYPE_12": "TRANS_TYPE_FILL_BROWN",
    "TRANS_TYPE_13": "TRANS_TYPE_FADE_WHITE_CS_DELAYED",
    "TRANS_TYPE_14": "TRANS_TYPE_SANDSTORM_PERSIST",
    "TRANS_TYPE_15": "TRANS_TYPE_SANDSTORM_END",
    "TRANS_TYPE_16": "TRANS_TYPE_CS_BLACK_FILL",
    "TRANS_TYPE_17": "TRANS_TYPE_FADE_WHITE_INSTANT",
    "TRANS_TYPE_18": "TRANS_TYPE_FADE_GREEN",
    "TRANS_TYPE_19": "TRANS_TYPE_FADE_BLUE",
    "TRANS_TYPE_20": "TRANS_TYPE_FADE_DYNAMIC",
    "TRANS_TYPE_21": "TRANS_TYPE_CIRCLE",
    "TRANS_TYPE_22": "TRANS_TYPE_WIPE5",
    "SUBS_CUTSCENE_SET_UNK_LINK_FIELDS": "SUBS_CUTSCENE_WITH_PLAYER",
    "SUBS_CUTSCENE_SET_FLAG": "SUBS_CUTSCENE_WITH_PLAYER_SET_FLAG",

    "COLPOLY_SURFACE_GROUND": "SURFACE_MATERIAL_DIRT",
    "COLPOLY_SURFACE_SAND": "SURFACE_MATERIAL_SAND",
    "COLPOLY_SURFACE_SNOW": "SURFACE_MATERIAL_SNOW",
    "CS_STATE_0": "CS_STATE_IDLE",

    "TEXT_STATE_1": "TEXT_STATE_NEXT",
    "TEXT_STATE_3": "TEXT_STATE_FADING",
    "TEXT_STATE_5": "TEXT_STATE_EVENT",
    "TEXT_STATE_7": "TEXT_STATE_SONG_DEMO_DONE",
    "TEXT_STATE_10": "TEXT_STATE_AWAITING_NEXT",
    "TEXT_STATE_14": "TEXT_STATE_INPUT_RUPEES",
    "TEXT_STATE_15": "TEXT_STATE_INPUT_BOMBER_CODE",
    "TEXT_STATE_16": "TEXT_STATE_PAUSE_MENU",
    "TEXT_STATE_17": "TEXT_STATE_INPUT_LOTTERY_CODE",

    # Example of custom behaviour:
    # "PLAYER": ("GET_PLAYER(play)", {"ignore": (-1, '"PLAYER"')}), # ignore "PLAYER" in sSoundBankNames
}

# [a-zA-Z0-9_]
def is_word_char(c):
    return (c >= 'a' and c <= 'z') or (c >= 'A' and c <= 'Z') or (c >= '0' and c <= '9') or c == '_'

def replace_single(file):
    with open(file, 'r', encoding = 'utf-8') as infile:
        srcdata = infile.read()

    changesCount = 0

    for old, new in simpleReplace.items():
        # replace `old` with `new`
        if old in srcdata:
            changesCount += 1
            print(old, "->", new)
            srcdata = srcdata.replace(old, new)

    for old, new in wordReplace.items():
        # `new` can be a tuple where the first element is what to replace `old` with,
        # and the second element is a dict containing "custom behavior" properties.
        if isinstance(new, tuple):
            custom_behavior = True
            new, custom_behavior_data = new
            # The "ignore" data is a tuple where the first element is an offset relative to
            # where `old` was found, and the string from that index must differ from the
            # tuple's second element for the replacement to be done.
            custom_behavior_ignore_data = custom_behavior_data.get("ignore")
            custom_behavior_ignore = custom_behavior_ignore_data is not None
            if custom_behavior_ignore:
                custom_behavior_ignore_offset, custom_behavior_ignore_match = custom_behavior_ignore_data
        else:
            custom_behavior = False
        # replace `old` with `new` if the occurrence of `old` is the whole word
        oldStartIdx = srcdata.find(old)
        if oldStartIdx >= 0:
            old_start_as_word = is_word_char(old[0])
            old_end_as_word = is_word_char(old[-1])
            replaceCount = 0
            while oldStartIdx >= 0:
                replace = True
                if old_start_as_word:
                    if oldStartIdx == 0:
                        pass
                    elif is_word_char(srcdata[oldStartIdx-1]):
                        replace = False
                if old_end_as_word:
                    oldEndIdx = oldStartIdx + len(old)
                    if oldEndIdx >= len(srcdata):
                        pass
                    elif is_word_char(srcdata[oldEndIdx]):
                        replace = False
                if replace and custom_behavior and custom_behavior_ignore:
                    if srcdata[oldStartIdx + custom_behavior_ignore_offset:].startswith(custom_behavior_ignore_match):
                        replace = False
                if replace:
                    srcdata = srcdata[:oldStartIdx] + new + srcdata[oldEndIdx:]
                    replaceCount += 1
                oldStartIdx = srcdata.find(old, oldStartIdx + len(new))
            if replaceCount > 0:
                changesCount += 1
                print(old, "->", new)

    if changesCount > 0:
        print('Changed', changesCount, 'entry' if changesCount == 1 else 'entries', 'in', file)
        with open(file, 'w', encoding = 'utf-8', newline = '\n') as outfile:
            outfile.write(srcdata)

def replace_all(repo):
    for subdir, dirs, files in os.walk(os.path.join(repo,'src')):
        for filename in files:
            if filename.endswith('.c') or filename.endswith('.h'):
                file = os.path.join(subdir,filename)
                replace_single(file)

    for subdir, dirs, files in os.walk(os.path.join(repo,'asm')):
        for filename in files:
            if filename.endswith('.s'):
                file = os.path.join(subdir,filename)
                replace_single(file)

    for subdir, dirs, files in os.walk(os.path.join(repo,'data')):
        for filename in files:
            if filename.endswith('.s'):
                file = os.path.join(subdir,filename)
                replace_single(file)

    for subdir, dirs, files in os.walk(os.path.join(repo,'docs')):
        for filename in files:
            if filename.endswith('.md'):
                file = os.path.join(subdir,filename)
                replace_single(file)


def dictSanityCheck():
    keys = wordReplace.keys()
    values = wordReplace.values()
    for k in keys:
        if k in values:
            print(f"Key '{k}' found in values")
            print(f"This would produce unintended renames")
            print(f"Fix this by removing said key from the dictionary")
            exit(-1)

    keys = simpleReplace.keys()
    values = {*wordReplace.values(), *simpleReplace.values()}
    for k in keys:
        for value in values:
            if k in value:
                print(f"Key '{k}' found in values")
                print(f"This would produce unintended renames")
                print(f"Fix this by removing said key from the dictionary")
                exit(-1)

def main():
    parser = argparse.ArgumentParser(description='Apply function renames to a file')
    parser.add_argument('file', help="source file to be processed. use . to process the whole repo")
    args = parser.parse_args()

    dictSanityCheck()

    if args.file == '.':
        replace_all(os.curdir)
    else:
        replace_single(args.file)

if __name__ == "__main__":
    main()
