Skip to content

Commit

Permalink
Merge Enemy Soul Shuffle, Ocarina Buttons Shuffle, Triforce Hunt, Fis…
Browse files Browse the repository at this point in the history
…hing Hints and Sold Out settings
  • Loading branch information
HylianFreddy committed Mar 2, 2024
6 parents 3d5291f + 0162158 + 18ba6b8 + 721be0e + 4dd5121 + 709e962 commit 43063df
Show file tree
Hide file tree
Showing 85 changed files with 3,573 additions and 907 deletions.
6 changes: 6 additions & 0 deletions code/include/hid.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,10 @@ typedef struct {
#define CPAD_UP (1 << 30)
#define CPAD_DOWN (1 << 31)

// Generic catch-all directions
#define PAD_RIGHT (BUTTON_RIGHT | CPAD_RIGHT)
#define PAD_LEFT (BUTTON_LEFT | CPAD_LEFT)
#define PAD_UP (BUTTON_UP | CPAD_UP)
#define PAD_DOWN (BUTTON_DOWN | CPAD_DOWN)

#endif // HID_H
46 changes: 41 additions & 5 deletions code/include/z3D/z3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ typedef struct {
typedef struct {
/* 0x0000 */ u8 unk_00;
/* 0x0001 */ char unk_01[0x01];
/* 0x0002 */ u8 unk_02;
/* 0x0002 */ u8 hammerQuakeFlag;
/* 0x0003 */ u8 unk_03;
/* 0x0004 */ char unk_04[0x04];
/* 0x0008 */ u8 total; // total number of actors loaded
Expand Down Expand Up @@ -522,13 +522,15 @@ typedef struct GameState {
/* 0x04 */ void (*main)(struct GameState*);
/* 0x08 */ void (*destroy)(struct GameState*); // "cleanup"
/* 0x0C */ void (*init)(struct GameState*);
// TODO
/* 0x10 */ u32 size;
/* 0x14 */ char unk_14[0xED];
/* 0x101*/ u8 running;
} GameState;
_Static_assert(sizeof(GameState) == 0x104, "GameState size");

// Global Context (ram start: 0871E840)
typedef struct GlobalContext {
// /* 0x0000 */ GameState state;
/* 0x0000 */ char unk_0[0x0104];
/* 0x0000 */ GameState state;
/* 0x0104 */ s16 sceneNum;
/* 0x0106 */ char unk_106[0x0012];
/* 0x0118 */ SubGlobalContext_118 sub118;
Expand Down Expand Up @@ -573,7 +575,8 @@ typedef struct GlobalContext {
/* 0x3A58 */ ObjectContext objectCtx;
/* 0x43DC */ char unk_43DC[0x0854];
/* 0x4C30 */ s8 roomNum;
/* 0x4C31 */ char unk_4C31[0x0FCF];
/* 0x4C31 */ char unk_4C31[0x0FCB];
/* 0x5BFC */ u32 gameplayFrames;
/* 0x5C00 */ u8 linkAgeOnLoad;
/* 0x5C01 */ u8 unk_5C01;
/* 0x5C02 */ u8 curSpawn;
Expand Down Expand Up @@ -655,6 +658,27 @@ typedef struct TargetContext {
// ... size unknown
} TargetContext;

typedef struct SAModelListEntry {
SkeletonAnimationModel* saModel;
u32 unk;
} SAModelListEntry;

typedef struct SubMainClass_180 {
/* 0x000 */ char unk_00[0x8];
/* 0x008 */ s32 saModelsCount1;
/* 0x00C */ s32 saModelsCount2;
/* 0x010 */ char unk_10[0x10];
/* 0x020 */ SAModelListEntry* saModelsList1; // 3D models
/* 0x024 */ SAModelListEntry* saModelsList2; // 2D billboards
/* ... size unknown*/
} SubMainClass_180;

typedef struct MainClass {
/* 0x000 */ char unk_00[0x180];
/* 0x180 */ SubMainClass_180 sub180;
/* ... size unknown*/
} MainClass;

extern GlobalContext* gGlobalContext;
extern const u32 ItemSlots[];
extern const char DungeonNames[][25];
Expand All @@ -672,6 +696,7 @@ extern const char DungeonNames[][25];
#define gDrawItemTable ((DrawItemTableEntry*)0x4D88C8)
#define gRestrictionFlags ((RestrictionFlags*)0x539DC4)
#define PLAYER ((Player*)gGlobalContext->actorCtx.actorList[ACTORTYPE_PLAYER].first)
#define gMainClass ((MainClass*)0x5BE5B8)

#define GearSlot(X) (X - ITEM_SWORD_KOKIRI)

Expand Down Expand Up @@ -863,4 +888,15 @@ typedef void (*Animation_Change_proc)(SkelAnime* anime, s32 animation_index, f32
#define Animation_Change_addr 0x375C08
#define Animation_Change ((Animation_Change_proc)Animation_Change_addr)

typedef void (*EffectSsDeadDb_Spawn_proc)(GlobalContext* globalCtx, Vec3f* position, Vec3f* velocity,
Vec3f* acceleration, s16 scale, s16 scale_step, s16 prim_r, s16 prim_g,
s16 prim_b, s16 prim_a, s16 env_r, s16 env_g, s16 env_b, s16 unused,
s32 frame_duration, s16 play_sound);
#define EffectSsDeadDb_Spawn_addr 0x3642F4
#define EffectSsDeadDb_Spawn ((EffectSsDeadDb_Spawn_proc)EffectSsDeadDb_Spawn_addr)

typedef void (*SaveGame_proc)(GlobalContext* globalCtx, u8 isSaveFileCreation);
#define SaveGame_addr 0x2FDAC8
#define SaveGame ((SaveGame_proc)SaveGame_addr)

#endif //_Z3D_H_
10 changes: 6 additions & 4 deletions code/include/z3D/z3Dactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ typedef struct {

typedef struct {
/* 0x00 */ Collider base;
/* 0x18 */ // ColliderInfo info;
/* 0x40 */ // Cylinderf dim;
} ColliderCylinder; // size = 0x58
/* 0x18 */ char unk_18[0x28]; // ColliderInfo info;
/* 0x40 */ char unk_40[0x18]; // Cylinderf dim;
} ColliderCylinder; // size = 0x58

typedef struct {
/* 0x00 */ Vec3s rot; // Current actor shape rotation
Expand Down Expand Up @@ -269,7 +269,9 @@ typedef struct {
/* 0x01C0 */ void* leftHandDLists;
/* 0x01C4 */ void* sheathDLists;
/* 0x01C8 */ void* waistDLists;
/* 0x01CC */ char unk_1CC[0x80];
/* 0x01CC */ char unk_1CC[0x78];
/* 0x0244 */ SkeletonAnimationModel* giModel1;
/* 0x0248 */ SkeletonAnimationModel* giModel2;
/* 0x024C */ void* giDrawSpace;
/* 0x0250 */ char unk_250[0x0004];
/* 0x0254 */ struct SkelAnime skelAnime;
Expand Down
56 changes: 55 additions & 1 deletion code/include/z3D/z3Ditem.h
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ typedef enum {
/* 0xC7 */ GI_TYCOON_WALLET,
/* 0xC8 */ GI_LETTER_RUTO_2,
/* 0xC9 */ GI_MAGIC_BEAN_PACK,
/* 0xCA */ GI_TRIFORCE_PIECE, // unused
/* 0xCA */ GI_TRIFORCE_PIECE,

/* 0xCB */ GI_KOKIRI_EMERALD,
/* 0xCC */ GI_GORON_RUBY,
Expand All @@ -435,6 +435,60 @@ typedef enum {
/* 0xDC */ GI_FORTRESS_KEY_RING,
/* 0xDD */ GI_GANON_KEY_RING,
/* 0xDE */ GI_CHEST_GAME_KEY,

/* 0xDF */ GI_SOUL_POE,
/* 0xE0 */ GI_SOUL_OCTOROK,
/* 0xE1 */ GI_SOUL_KEESE,
/* 0xE2 */ GI_SOUL_TEKTITE,
/* 0xE3 */ GI_SOUL_LEEVER,
/* 0xE4 */ GI_SOUL_PEAHAT,
/* 0xE5 */ GI_SOUL_LIZALFOS,
/* 0xE6 */ GI_SOUL_SHABOM,
/* 0xE7 */ GI_SOUL_BIRI_BARI,
/* 0xE8 */ GI_SOUL_TAILPASARAN,
/* 0xE9 */ GI_SOUL_SKULLTULA,
/* 0xEA */ GI_SOUL_TORCH_SLUG,
/* 0xEB */ GI_SOUL_STINGER,
/* 0xEC */ GI_SOUL_MOBLIN,
/* 0xED */ GI_SOUL_ARMOS,
/* 0xEE */ GI_SOUL_DEKU_BABA,
/* 0xEF */ GI_SOUL_BUBBLE,
/* 0xF0 */ GI_SOUL_FLYING_TRAP,
/* 0xF1 */ GI_SOUL_BEAMOS,
/* 0xF2 */ GI_SOUL_WALLMASTER,
/* 0xF3 */ GI_SOUL_REDEAD_GIBDO,
/* 0xF4 */ GI_SOUL_SHELL_BLADE,
/* 0xF5 */ GI_SOUL_LIKE_LIKE,
/* 0xF6 */ GI_SOUL_TENTACLE,
/* 0xF7 */ GI_SOUL_ANUBIS,
/* 0xF8 */ GI_SOUL_SPIKE,
/* 0xF9 */ GI_SOUL_SKULL_KID,
/* 0xFA */ GI_SOUL_FREEZARD,
/* 0xFB */ GI_SOUL_DEKU_SCRUB,
/* 0xFC */ GI_SOUL_WOLFOS,
/* 0xFD */ GI_SOUL_STALCHILD,
/* 0xFE */ GI_SOUL_GUAY,
/* 0xFF */ GI_SOUL_DOOR_MIMIC,
/* 0x100 */ GI_SOUL_STALFOS,
/* 0x101 */ GI_SOUL_DARK_LINK,
/* 0x102 */ GI_SOUL_FLARE_DANCER,
/* 0x103 */ GI_SOUL_DEAD_HAND,
/* 0x104 */ GI_SOUL_GERUDO,
/* 0x105 */ GI_SOUL_GOHMA,
/* 0x106 */ GI_SOUL_DODONGO,
/* 0x107 */ GI_SOUL_BARINADE,
/* 0x108 */ GI_SOUL_PHANTOM_GANON,
/* 0x109 */ GI_SOUL_VOLVAGIA,
/* 0x10A */ GI_SOUL_MORPHA,
/* 0x10B */ GI_SOUL_BONGO_BONGO,
/* 0x10C */ GI_SOUL_TWINROVA,
/* 0x10D */ GI_SOUL_GANON,

/* 0x10E */ GI_OCARINA_BUTTON_L,
/* 0x10F */ GI_OCARINA_BUTTON_R,
/* 0x110 */ GI_OCARINA_BUTTON_X,
/* 0x111 */ GI_OCARINA_BUTTON_Y,
/* 0x112 */ GI_OCARINA_BUTTON_A,
} GetItemID;

typedef enum {
Expand Down
10 changes: 10 additions & 0 deletions code/include/z3D/z3Dmath.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,14 @@ typedef f32 (*Math_SinS_proc)(s16 angle) __attribute__((pcs("aapcs-vfp")));
typedef f32 (*Math_CosS_proc)(s16 angle) __attribute__((pcs("aapcs-vfp")));
#define Math_CosS ((Math_CosS_proc)0x338F60)

typedef void (*Matrix_Multiply_proc)(nn_math_MTX34* dst, nn_math_MTX34* lhs, nn_math_MTX44* rhs)
__attribute__((pcs("aapcs-vfp")));
#define Matrix_Multiply_addr 0x36C174
#define Matrix_Multiply ((Matrix_Multiply_proc)Matrix_Multiply_addr)

typedef void (*Matrix_UpdatePosition_proc)(nn_math_MTX34* dst, nn_math_MTX34* src, Vec3f* vec)
__attribute__((pcs("aapcs-vfp")));
#define Matrix_UpdatePosition_addr 0x372070
#define Matrix_UpdatePosition ((Matrix_UpdatePosition_proc)Matrix_UpdatePosition_addr)

#endif
4 changes: 4 additions & 0 deletions code/object_and_gi_usage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ The following custom objectIds are currently being used:
126: GTG Small Key
127: Ganon Small Key
128: Boss Keys
228: Enemy Souls
291: Ocarina Note Buttons
366: Triforce Piece

To use a custom asset, currently:
- choose an unused objectId to be repurposed for the custom item
Expand All @@ -20,4 +23,5 @@ To use a custom asset, currently:
- if you need to apply a custom texture to the model:
- add a CMAB file with the new texture in the custom archive (romfs/zelda_gi_melody.zar)
- in CustomModels_ApplyItemCMAB, add a case for the objectId
- if you need to edit the scale or position of the model, add a case in Model_Create (for overworld models) and in CustomModels_UpdateMatrix (for shop and GetItem models)
- add the objectId to this txt file
64 changes: 48 additions & 16 deletions code/oot.ld
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ SECTIONS
*(.patch_ItemEtceteraModelDraw)
}

.patch_FlyingPotCollision 0x11DB34 : {
*(.patch_FlyingPotCollision)
}

.patch_DodongoAfterSwallowBomb 0x11E4B8 : {
*(.patch_DodongoAfterSwallowBomb)
}

.patch_SariasSongItemGive 0x12C84C : {
*(.patch_SariasSongItemGive)
}
Expand Down Expand Up @@ -396,6 +404,10 @@ SECTIONS
*(.patch_FishingSizeIgnoreAdult)
}

.patch_BabyDodongoAfterSwallowBomb 0x1C42DC : {
*(.patch_BabyDodongoAfterSwallowBomb)
}

.patch_BiggoronAfterGiveItem 0x1C4E4C : {
*(.patch_BiggoronAfterGiveItem)
}
Expand Down Expand Up @@ -596,6 +608,10 @@ SECTIONS
*(.patch_BoleroLocation)
}

.patch_FlyingTileCollision 0x26E730 : {
*(.patch_FlyingTileCollision)
}

.patch_RedBoulderExplode 0x26FE7C : {
*(.patch_RedBoulderExplode)
}
Expand Down Expand Up @@ -700,6 +716,10 @@ SECTIONS
*(.patch_GetCustomMessageTextOne)
}

.patch_ActorDraw 0x2D6310 : {
*(.patch_ActorDraw)
}

.patch_CamUpdate 0x2D84C8 : {
* (.patch_CamUpdate)
}
Expand All @@ -708,20 +728,12 @@ SECTIONS
*(.patch_CamRoll)
}

.patch_InstantTextFirstLine 0x2E049C : {
*(.patch_InstantTextFirstLine)
}

.patch_InstantTextBoxBreak 0x2E0664 : {
*(.patch_InstantTextBoxBreak)
.patch_CheckForTextControlCode 0x2E0490 : {
* (.patch_CheckForTextControlCode)
}

.patch_InstantTextRemoveOff 0x2E06C8 : {
*(.patch_InstantTextRemoveOff)
}

.patch_SkippableText 0x2E09BC : {
*(.patch_SkippableText)
.patch_HandleTextControlCode 0x2E057C : {
* (.patch_HandleTextControlCode)
}

.patch_SceneInitAfterCopyScenes 0x2EAFDC : {
Expand All @@ -744,6 +756,10 @@ SECTIONS
*(.patch_OverrideDrawItemOne)
}

.patch_OcarinaNoteButtonsDraw 0x2F9430 : {
* (.patch_OcarinaNoteButtonsDraw)
}

.patch_SaveGame 0x2FBFA8 : {
*(.patch_SaveGame)
}
Expand Down Expand Up @@ -1016,6 +1032,10 @@ SECTIONS
*(.patch_GerudoArcheryOne)
}

.patch_ShabomAfterDamagePlayer 0x3B5060 : {
*(.patch_ShabomAfterDamagePlayer)
}

.patch_RandomGsLoc_CustomTokenSpawnOffset 0x3B94C4 : {
*(.patch_RandomGsLoc_CustomTokenSpawnOffset)
}
Expand Down Expand Up @@ -1220,6 +1240,10 @@ SECTIONS
*(.patch_SleepQueryCallback)
}

.patch_OcarinaNoteButtonsPress 0x41AAAC : {
* (.patch_OcarinaNoteButtonsPress)
}

.patch_CurseTrapDizzyStick 0x41AB24 : {
*(.patch_CurseTrapDizzyStick)
}
Expand All @@ -1244,8 +1268,12 @@ SECTIONS
*(.patch_GearMenuEmptySlot)
}

.patch_LoadGame 0x447380 : {
*(.patch_LoadGame)
.patch_BeforeLoadGame 0x447380 : {
*(.patch_BeforeLoadGame)
}

.patch_AfterLoadGame 0x449F00 : {
*(.patch_AfterLoadGame)
}

.patch_DontSetMotionSetting 0x447410 : {
Expand Down Expand Up @@ -1440,8 +1468,8 @@ SECTIONS
*(.patch_AfterActorSetup_RoomChange)
}

.patch_HyperActors 0x461790 : {
*(.patch_HyperActors)
.patch_ActorUpdate 0x461790 : {
*(.patch_ActorUpdate)
}

.patch_TitleCardUpdate 0x4618B8 : {
Expand Down Expand Up @@ -1568,6 +1596,10 @@ SECTIONS
*(.patch_HookshotRotation)
}

.patch_EditDrawGetItemAfterMatrixUpdate 0x4C4D14 : {
*(.patch_EditDrawGetItemAfterMatrixUpdate)
}

.patch_EditDrawGetItemAfterModelSpawn 0x4C61A4 : {
*(.patch_EditDrawGetItemAfterModelSpawn)
}
Expand Down
Loading

0 comments on commit 43063df

Please sign in to comment.