forked from OoTRandomizer/OoT-Randomizer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathz64.h
More file actions
2482 lines (2357 loc) · 95.6 KB
/
Copy pathz64.h
File metadata and controls
2482 lines (2357 loc) · 95.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#ifndef Z64_H
#define Z64_H
#include <stdint.h>
#include <n64.h>
#include "z64_math.h"
#include "color.h"
#include "z64collision_check.h"
#include "save.h"
#define Z64_OOT10 0x00
#define Z64_OOT11 0x01
#define Z64_OOT12 0x02
#define Z64_SCREEN_WIDTH 320
#define Z64_SCREEN_HEIGHT 240
#define Z64_SEG_PHYS 0x00
#define Z64_SEG_TITLE 0x01
#define Z64_SEG_SCENE 0x02
#define Z64_SEG_ROOM 0x03
#define Z64_SEG_KEEP 0x04
#define Z64_SEG_SKEEP 0x05
#define Z64_SEG_OBJ 0x06
#define Z64_SEG_ZIMG 0x0E
#define Z64_SEG_CIMG 0x0F
#define Z64_ETAB_LENGTH 0x0614
#define NA_BGM_SMALL_ITEM_GET 0x39
#define NA_SE_SY_CORRECT_CHIME 0x4802
#define NA_SE_SY_GET_RUPY 0x4803
#define NA_SE_SY_GET_ITEM 0x4824
#define NA_SE_SY_ERROR 0x4806
#define NA_SE_SY_DECIDE 0x4808
#define NA_SE_SY_CURSOR 0x4809
#define NA_SE_SY_CANCEL 0x480A
#define NA_SE_SY_FSEL_CURSOR 0x4839
#define NA_SE_SY_FSEL_DECIDE_S 0x483A
#define NA_SE_SY_FSEL_DECIDE_L 0x483B
#define NA_SE_SY_FSEL_CLOSE 0x483C
#define NA_SE_SY_SET_FIRE_ARROW 0x483E
#define FONT_CHAR_TEX_SIZE ((16 * 16) / 2) // 16x16 I4 texture
#define OFFSETOF(structure, member) ((size_t)&(((structure*)0)->member))
#define REG_PAGES 6
#define REGS_PER_PAGE 16
#define REGS_PER_GROUP (REG_PAGES * REGS_PER_PAGE)
#define REG_EDITOR_DATA ((int16_t*)0x801C6EA4)
#define BASE_REG(n, r) REG_EDITOR_DATA[(n)*REGS_PER_GROUP + (r)]
#define REG(r) BASE_REG(0, (r))
#define SREG(r) BASE_REG(1, (r))
#define R_PAUSE_BG_PRERENDER_STATE SREG(94)
#define ITEM_ICON_WIDTH 32
#define ITEM_ICON_HEIGHT 32
#define ITEM_ICON_SIZE (ITEM_ICON_WIDTH * ITEM_ICON_HEIGHT * 4) // The size in bytes of an item icon
typedef struct {
/* index of z64_col_type in scene file */
uint16_t type;
/* vertex indices, a and b are bitmasked for some reason */
struct {
uint16_t unk_00_ : 3;
uint16_t va : 13;
};
struct {
uint16_t unk_01_ : 3;
uint16_t vb : 13;
};
uint16_t vc;
/* normal vector */
z64_xyz_t norm;
/* plane distance from origin */
int16_t dist;
} z64_col_poly_t;
typedef struct {
struct {
uint32_t unk_00_ : 1;
uint32_t drop : 1; /* link drops one unit into the floor */
uint32_t special : 4;
uint32_t interaction : 5;
uint32_t unk_01_ : 3;
uint32_t behavior : 5;
uint32_t exit : 5;
uint32_t camera : 8;
} flags_1; /* 0x0000 */
struct {
uint32_t pad_00_ : 4;
uint32_t wall_damage : 1;
uint32_t unk_00_ : 6;
uint32_t unk_01_ : 3;
uint32_t hookshot : 1;
uint32_t echo : 6;
uint32_t unk_02_ : 5;
uint32_t terrain : 2;
uint32_t material : 4;
} flags_2; /* 0x0004 */
} z64_col_type_t;
typedef struct {
z64_xyz_t pos;
z64_xyz_t rot;
int16_t fov;
int16_t unk_00_;
} z64_camera_params_t;
typedef struct {
uint16_t mode;
uint16_t unk_01_;
uint32_t seg_params; /* segment address of z64_camera_params_t */
} z64_camera_t;
typedef struct {
z64_xyz_t pos;
int16_t width;
int16_t depth;
struct {
uint32_t unk_00_ : 12;
uint32_t active : 1;
uint32_t group : 6; /* ? */
uint32_t unk_01_ : 5;
uint32_t camera : 8;
} flags;
} z64_col_water_t;
typedef struct {
z64_xyz_t min;
z64_xyz_t max;
uint16_t n_vtx;
z64_xyz_t *vtx;
uint16_t n_poly;
z64_col_poly_t *poly;
z64_col_type_t *type;
z64_camera_t *camera;
uint16_t n_water;
z64_col_water_t *water;
} z64_col_hdr_t;
typed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_EXCH_ITEM_BUG,
Z64_EXCH_ITEM_POE,
Z64_EXCH_ITEM_BIG_POE,
Z64_EXCH_ITEM_LETTER_RUTO,
Z64_EXCH_ITEM_MAX,
} z64_exchange_item_t;
typedef enum {
PLAYER_AP_NONE,
PLAYER_AP_LAST_USED,
PLAYER_AP_FISHING_POLE,
PLAYER_AP_SWORD_MASTER,
PLAYER_AP_SWORD_KOKIRI,
PLAYER_AP_SWORD_BGS,
PLAYER_AP_STICK,
PLAYER_AP_HAMMER,
PLAYER_AP_BOW,
PLAYER_AP_BOW_FIRE,
PLAYER_AP_BOW_ICE,
PLAYER_AP_BOW_LIGHT,
PLAYER_AP_BOW_0C,
PLAYER_AP_BOW_0D,
PLAYER_AP_BOW_0E,
PLAYER_AP_SLINGSHOT,
PLAYER_AP_HOOKSHOT,
PLAYER_AP_LONGSHOT,
PLAYER_AP_BOMB,
PLAYER_AP_BOMBCHU,
PLAYER_AP_BOOMERANG,
PLAYER_AP_MAGIC_SPELL_15,
PLAYER_AP_MAGIC_SPELL_16,
PLAYER_AP_MAGIC_SPELL_17,
PLAYER_AP_FARORES_WIND,
PLAYER_AP_NAYRUS_LOVE,
PLAYER_AP_DINS_FIRE,
PLAYER_AP_NUT,
PLAYER_AP_OCARINA_FAIRY,
PLAYER_AP_OCARINA_TIME,
PLAYER_AP_BOTTLE,
PLAYER_AP_BOTTLE_FISH,
PLAYER_AP_BOTTLE_FIRE,
PLAYER_AP_BOTTLE_BUG,
PLAYER_AP_BOTTLE_POE,
PLAYER_AP_BOTTLE_BIG_POE,
PLAYER_AP_BOTTLE_LETTER,
PLAYER_AP_BOTTLE_POTION_RED,
PLAYER_AP_BOTTLE_POTION_BLUE,
PLAYER_AP_BOTTLE_POTION_GREEN,
PLAYER_AP_BOTTLE_MILK,
PLAYER_AP_BOTTLE_MILK_HALF,
PLAYER_AP_BOTTLE_FAIRY,
PLAYER_AP_LETTER_ZELDA,
PLAYER_AP_WEIRD_EGG,
PLAYER_AP_CHICKEN,
PLAYER_AP_BEAN,
PLAYER_AP_POCKET_EGG,
PLAYER_AP_POCKET_CUCCO,
PLAYER_AP_COJIRO,
PLAYER_AP_ODD_MUSHROOM,
PLAYER_AP_ODD_POTION,
PLAYER_AP_SAW,
PLAYER_AP_SWORD_BROKEN,
PLAYER_AP_PRESCRIPTION,
PLAYER_AP_FROG,
PLAYER_AP_EYEDROPS,
PLAYER_AP_CLAIM_CHECK,
PLAYER_AP_MASK_KEATON,
PLAYER_AP_MASK_SKULL,
PLAYER_AP_MASK_SPOOKY,
PLAYER_AP_MASK_BUNNY,
PLAYER_AP_MASK_GORON,
PLAYER_AP_MASK_ZORA,
PLAYER_AP_MASK_GERUDO,
PLAYER_AP_MASK_TRUTH,
PLAYER_AP_LENS,
PLAYER_AP_MAX,
} z64_action_parameter_t;
typedef enum {
SI_DEKU_NUTS_5,
SI_ARROWS_30,
SI_ARROWS_50,
SI_BOMBS_5_R25,
SI_DEKU_NUTS_10,
SI_DEKU_STICK,
SI_BOMBS_10,
SI_FISH,
SI_RED_POTION_R30,
SI_GREEN_POTION,
SI_BLUE_POTION,
SI_LONGSWORD,
SI_HYLIAN_SHIELD,
SI_DEKU_SHIELD,
SI_GORON_TUNIC,
SI_ZORA_TUNIC,
SI_RECOVERY_HEART,
SI_MILK_BOTTLE,
SI_WEIRD_EGG,
SI_19,
SI_20,
SI_BOMBCHU_10_1,
SI_BOMBCHU_20_1,
SI_BOMBCHU_20_2,
SI_BOMBCHU_10_2,
SI_BOMBCHU_10_3,
SI_BOMBCHU_20_3,
SI_BOMBCHU_20_4,
SI_BOMBCHU_10_4,
SI_DEKU_SEEDS_30,
SI_KEATON_MASK,
SI_SPOOKY_MASK,
SI_SKULL_MASK,
SI_BUNNY_HOOD,
SI_MASK_OF_TRUTH,
SI_ZORA_MASK,
SI_GORON_MASK,
SI_GERUDO_MASK,
SI_SOLD_OUT,
SI_BLUE_FIRE,
SI_BUGS,
SI_BIG_POE,
SI_POE,
SI_FAIRY,
SI_ARROWS_10,
SI_BOMBS_20,
SI_BOMBS_30,
SI_BOMBS_5_R35,
SI_RED_POTION_R40,
SI_RED_POTION_R50,
SI_MAX,
} z64_shop_item_t;
typedef enum {
Z64_SLOT_STICK,
Z64_SLOT_NUT,
Z64_SLOT_BOMB,
Z64_SLOT_BOW,
Z64_SLOT_FIRE_ARROW,
Z64_SLOT_DINS_FIRE,
Z64_SLOT_SLINGSHOT,
Z64_SLOT_OCARINA,
Z64_SLOT_BOMBCHU,
Z64_SLOT_HOOKSHOT,
Z64_SLOT_ICE_ARROW,
Z64_SLOT_FARORES_WIND,
Z64_SLOT_BOOMERANG,
Z64_SLOT_LENS,
Z64_SLOT_BEANS,
Z64_SLOT_HAMMER,
Z64_SLOT_LIGHT_ARROW,
Z64_SLOT_NAYRUS_LOVE,
Z64_SLOT_BOTTLE_1,
Z64_SLOT_BOTTLE_2,
Z64_SLOT_BOTTLE_3,
Z64_SLOT_BOTTLE_4,
Z64_SLOT_ADULT_TRADE,
Z64_SLOT_CHILD_TRADE,
} z64_slot_t;
typedef enum {
Z64_ITEMBTN_B,
Z64_ITEMBTN_CL,
Z64_ITEMBTN_CD,
Z64_ITEMBTN_CR,
} z64_itembtn_t;
typedef enum {
/* 0x00 */ ACTORCAT_SWITCH,
/* 0x01 */ ACTORCAT_BG,
/* 0x02 */ ACTORCAT_PLAYER,
/* 0x03 */ ACTORCAT_EXPLOSIVE,
/* 0x04 */ ACTORCAT_NPC,
/* 0x05 */ ACTORCAT_ENEMY,
/* 0x06 */ ACTORCAT_PROP,
/* 0x07 */ ACTORCAT_ITEMACTION,
/* 0x08 */ ACTORCAT_MISC,
/* 0x09 */ ACTORCAT_BOSS,
/* 0x0A */ ACTORCAT_DOOR,
/* 0x0B */ ACTORCAT_CHEST,
/* 0x0C */ ACTORCAT_MAX,
} ActorCategory;
typedef struct {
char unk_00_[0x006E]; /* 0x0000 */
int16_t run_speed_limit; /* 0x006E */
char unk_01_[0x0004]; /* 0x0070 */
int16_t run_speed_max_anim; /* 0x0074 */
char unk_02_[0x0026]; /* 0x0076 */
int16_t gravity; /* 0x009C */
char unk_03_[0x0072]; /* 0x009E */
uint16_t update_rate; /* 0x0110 */
char unk_04_[0x0022]; /* 0x0112 */
int16_t override_aspect; /* 0x0134 */
uint16_t aspect_width; /* 0x0136 */
uint16_t aspect_height; /* 0x0138 */
char unk_05_[0x0050]; /* 0x013A */
int16_t game_playing; /* 0x018A */
char unk_06_[0x03B8]; /* 0x018C */
uint16_t c_up_icon_x; /* 0x0544 */
uint16_t c_up_icon_y; /* 0x0546 */
char unk_07_[0x021C]; /* 0x0548 */
uint16_t game_freeze; /* 0x0764 */
char unk_08_[0x002E]; /* 0x0766 */
uint16_t magic_fill_r; /* 0x0794 */
uint16_t magic_fill_g; /* 0x0796 */
uint16_t magic_fill_b; /* 0x0798 */
char unk_09_[0x004A]; /* 0x079A */
uint16_t c_button_r; /* 0x07E4 */
uint16_t c_button_g; /* 0x07E6 */
uint16_t c_button_b; /* 0x07E8 */
uint16_t b_button_r; /* 0x07EA */
uint16_t b_button_g; /* 0x07EC */
uint16_t b_button_b; /* 0x07EE */
char unk_0A_[0x0004]; /* 0x07F0 */
qs510_t start_icon_dd; /* 0x07F4 */
int16_t start_icon_scale; /* 0x07F6 */
char unk_0B_[0x0006]; /* 0x07F8 */
uint16_t start_icon_y; /* 0x07FE */
char unk_0C_[0x0002]; /* 0x0800 */
uint16_t start_icon_x; /* 0x0802 */
char unk_0D_[0x000C]; /* 0x0804 */
uint16_t c_up_button_x; /* 0x0810 */
uint16_t c_up_button_y; /* 0x0812 */
char unk_0E_[0x0008]; /* 0x0814 */
uint16_t start_button_x; /* 0x081C */
uint16_t start_button_y; /* 0x081E */
uint16_t item_button_x[4]; /* 0x0820 */
uint16_t item_button_y[4]; /* 0x0828 */
qs510_t item_button_dd[4]; /* 0x0830 */
uint16_t item_icon_x[4]; /* 0x0838 */
uint16_t item_icon_y[4]; /* 0x0840 */
qs510_t item_icon_dd[4]; /* 0x0848 */
char unk_0F_[0x0264]; /* 0x0850 */
uint16_t a_button_y; /* 0x0AB4 */
uint16_t a_button_x; /* 0x0AB6 */
char unk_10_[0x0002]; /* 0x0AB8 */
uint16_t a_button_icon_y; /* 0x0ABA */
uint16_t a_button_icon_x; /* 0x0ABC */
char unk_11_[0x0002]; /* 0x0ABE */
uint16_t a_button_r; /* 0x0AC0 */
uint16_t a_button_g; /* 0x0AC2 */
uint16_t a_button_b; /* 0x0AC4 */
char unk_12_[0x0030]; /* 0x0AC6 */
uint16_t magic_bar_x; /* 0x0AF6 */
uint16_t magic_bar_y; /* 0x0AF8 */
uint16_t magic_fill_x; /* 0x0AFA */
char unk_13_[0x02D6]; /* 0x0AFC */
int16_t minimap_disabled; /* 0x0DD2 */
char unk_14_[0x01C0]; /* 0x0DD4 */
uint16_t item_ammo_x[4]; /* 0x0F94 */
uint16_t item_ammo_y[4]; /* 0x0F9C */
char unk_15_[0x0008]; /* 0x0FA4 */
uint16_t item_icon_space[4]; /* 0x0FAC */
uint16_t item_button_space[4]; /* 0x0FB4 */
/* 0x0FBC */
} z64_gameinfo_t;
typedef struct {
/* data */
uint8_t unk_00_[0x1C9EE]; /* 0x0000 */
uint16_t deaths[3]; /* 0x1C9EE */
char fileNames[3][8]; /* 0x1C9F4 */
uint16_t healthCapacities[3]; /* 0x1CA0C */
uint32_t questItems[3]; /* 0x1CA14 */
int16_t n64ddFlags[3]; /* 0x1CA20 */
int8_t defense[3]; /* 0x1CA26 */
uint8_t unk_01_[0x0F]; /* 0x1CA29 */
int16_t selectedFileIndex; /* 0x1CA38 */
uint8_t unk_02_[0x16]; /* 0x1CA3A */
int16_t copyDestFileIndex; /* 0x1CA50 */
} z64_FileChooseContext_t;
/**
* The respawn mode names refer to the perceived player movement when respawning
* "down": being on ground
* "return": coming from the ground
* "top": coming from the air
*/
typedef enum {
/* 0x00 */ RESPAWN_MODE_DOWN, /* Normal Void Outs */
/* 0x01 */ RESPAWN_MODE_RETURN, /* Grotto Returnpoints */
/* 0x02 */ RESPAWN_MODE_TOP, /* Farore's Wind */
/* 0x03 */ RESPAWN_MODE_MAX
} RespawnMode;
typedef struct {
/* 0x00 */ z64_xyzf_t pos;
/* 0x0C */ int16_t yaw;
/* 0x0E */ int16_t playerParams;
/* 0x10 */ int16_t entranceIndex;
/* 0x12 */ uint8_t roomIndex;
/* 0x13 */ int8_t data;
/* 0x14 */ uint32_t tempSwchFlags;
/* 0x18 */ uint32_t tempCollectFlags;
} RespawnData; // size = 0x1C
typedef struct {
int32_t entrance_index; /* 0x0000 */
int32_t link_age; /* 0x0004 */
char unk_00_[0x0002]; /* 0x0008 */
uint16_t cutscene_index; /* 0x000A */
uint16_t day_time; /* 0x000C */
char unk_01_[0x0002]; /* 0x000E */
int32_t night_flag; /* 0x0010 */
int32_t total_days; /* 0x0014 */
int32_t bgs_day_count; /* 0x0018 */
char id[6]; /* 0x001C */
int16_t deaths; /* 0x0022 */
char file_name[0x08]; /* 0x0024 */
int16_t n64dd_flag; /* 0x002C */
int16_t energy_capacity; /* 0x002E */
int16_t energy; /* 0x0030 */
uint8_t magic_capacity_set; /* 0x0032 */
uint8_t magic; /* 0x0033 */
uint16_t rupees; /* 0x0034 */
uint16_t bgs_hits_left; /* 0x0036 */
uint16_t navi_timer; /* 0x0038 */
uint8_t magic_acquired; /* 0x003A */
char unk_03_; /* 0x003B */
uint8_t magic_capacity; /* 0x003C */
int8_t double_defense; /* 0x003D */
int8_t bgs_flag; /* 0x003E */
char unk_05_; /* 0x003F */
int8_t child_button_items[4]; /* 0x0040 */
int8_t child_c_button_slots[3]; /* 0x0044 */
union {
uint16_t child_equips; /* 0x0048 */
struct {
uint16_t child_equip_boots : 4;
uint16_t child_equip_tunic : 4;
uint16_t child_equip_shield : 4;
uint16_t child_equip_sword : 4;
};
};
int8_t adult_button_items[4]; /* 0x004A */
int8_t adult_c_button_slots[3]; /* 0x004E */
union {
uint16_t adult_equips; /* 0x0052 */
struct {
uint16_t adult_equip_boots : 4;
uint16_t adult_equip_tunic : 4;
uint16_t adult_equip_shield : 4;
uint16_t adult_equip_sword : 4;
};
};
char unk_06_[0x0012]; /* 0x0054 */
int16_t scene_index; /* 0x0066 */
uint8_t button_items[4]; /* 0x0068 */
uint8_t c_button_slots[3]; /* 0x006C */
union {
uint16_t equips; /* 0x0070 */
struct {
uint16_t equip_boots : 4;
uint16_t equip_tunic : 4;
uint16_t equip_shield : 4;
uint16_t equip_sword : 4;
};
};
char unk_07_[0x0002]; /* 0x0072 */
uint8_t items[24]; /* 0x0074 */
int8_t ammo[15]; /* 0x008C */
uint8_t magic_beans_sold; /* 0x009B */
union {
uint16_t equipment; /* 0x009C */
struct {
uint16_t : 1;
uint16_t hover_boots : 1;
uint16_t iron_boots : 1;
uint16_t kokiri_boots : 1;
uint16_t : 1;
uint16_t zora_tunic : 1;
uint16_t goron_tunic : 1;
uint16_t kokiri_tunic : 1;
uint16_t : 1;
uint16_t mirror_shield : 1;
uint16_t hylian_shield : 1;
uint16_t deku_shield : 1;
uint16_t broken_giants_knife : 1;
uint16_t giants_knife : 1;
uint16_t master_sword : 1;
uint16_t kokiri_sword : 1;
};
};
char unk_08_[0x0002]; /* 0x009E */
union {
uint32_t equipment_items; /* 0x00A0 */
struct {
uint32_t : 9;
uint32_t nut_upgrade : 3;
uint32_t stick_upgrade : 3;
uint32_t bullet_bag : 3;
uint32_t wallet : 2;
uint32_t diving_upgrade : 3;
uint32_t strength_upgrade : 3;
uint32_t bomb_bag : 3;
uint32_t quiver : 3;
};
};
union {
uint32_t quest_items; /* 0x00A4 */
struct {
uint32_t heart_pieces : 8;
uint32_t gold_skulltula : 1;
uint32_t gerudos_card : 1;
uint32_t stone_of_agony : 1;
uint32_t zoras_sapphire : 1;
uint32_t gorons_ruby : 1;
uint32_t kokiris_emerald : 1;
uint32_t song_of_storms : 1;
uint32_t song_of_time : 1;
uint32_t suns_song : 1;
uint32_t sarias_song : 1;
uint32_t eponas_song : 1;
uint32_t zeldas_lullaby : 1;
uint32_t prelude_of_light : 1;
uint32_t nocturne_of_shadow : 1;
uint32_t requiem_of_spirit : 1;
uint32_t serenade_of_water : 1;
uint32_t bolero_of_fire : 1;
uint32_t minuet_of_forest : 1;
uint32_t light_medallion : 1;
uint32_t shadow_medallion : 1;
uint32_t spirit_medallion : 1;
uint32_t water_medallion : 1;
uint32_t fire_medallion : 1;
uint32_t forest_medallion : 1;
};
};
union {
uint8_t items;
struct {
uint8_t : 5;
uint8_t map : 1;
uint8_t compass : 1;
uint8_t boss_key : 1;
};
} dungeon_items[20]; /* 0x00A8 */
int8_t dungeon_keys[19]; /* 0x00BC */
uint8_t defense_hearts; /* 0x00CF */
int16_t gs_tokens; /* 0x00D0 */
char unk_09_[0x0002]; /* 0x00D2 */
struct {
uint32_t chest;
uint32_t swch;
uint32_t clear;
uint32_t collect;
uint32_t unk_00_;
uint32_t rooms_1;
uint32_t rooms_2;
} scene_flags[101]; /* 0x00D4 */
char unk_0A_[0x0284]; /* 0x0BE0 */
z64_xyzf_t fw_pos; /* 0x0E64 */
z64_angle_t fw_yaw; /* 0x0E70 */
char unk_0B_[0x0008]; /* 0x0E72 */
uint16_t fw_scene_index; /* 0x0E7A */
uint32_t fw_room_index; /* 0x0E7C */
int32_t fw_set; /* 0x0E80 */
char unk_0C_[0x0018]; /* 0x0E84 */
uint8_t gs_flags[56]; /* 0x0E9C */
uint16_t event_chk_inf[14]; /* 0x0ED4 */
uint16_t item_get_inf[4]; /* 0x0EF0 */
uint16_t inf_table[30]; /* 0x0EF8 */
char unk_0D_[0x041E]; /* 0x0F34 */
uint16_t checksum; /* 0x1352 */
char unk_0E_[0x0003]; /* 0x1354 */
int8_t file_index; /* 0x1357 */
char unk_0F_[0x0004]; /* 0x1358 */
int32_t game_mode; /* 0x135C */
uint32_t scene_setup_index; /* 0x1360 */
int32_t respawn_flag; /* 0x1364 */
RespawnData respawn[RESPAWN_MODE_MAX];/* 0x1368 */
float entranceSpeed; /* 0x13BC */
uint16_t entranceSound; /* 0x13C0 */
char unk_10_[0x0001]; /* 0x13C2 */
uint8_t retainWeatherMode; /* 0x13C3 */
int16_t dogParams; /* 0x13C4 */
uint8_t envHazardTextTriggerFlags;/* 0x13C6 */
uint8_t showTitleCard; /* 0x13C7 */
uint16_t nayrus_love_timer; /* 0x13C8 */
char unk_13_[0x0004]; /* 0x13CA */
int16_t timer_1_state; /* 0x13CE */
int16_t timer_1_value; /* 0x13D0 */
int16_t timer_2_state; /* 0x13D2 */
int16_t timer_2_value; /* 0x13D4 */
char unk_14_[0x000A]; /* 0x13D6 */
int8_t seq_index; /* 0x13E0 */
int8_t night_sfx; /* 0x13E1 */
char unk_15_[0x0012]; /* 0x13E2 */
uint16_t magic_meter_size; /* 0x13F4 */
char unk_16_[0x0004]; /* 0x13F6 */
uint16_t event_inf[4]; /* 0x13FA */
char unk_17_[0x0001]; /* 0x1402 */
uint8_t minimap_index; /* 0x1403 */
int16_t minigame_state; /* 0x1404 */
char unk_18_[0x0003]; /* 0x1406 */
uint8_t language; /* 0x1409 */
char unk_19_[0x0002]; /* 0x140A */
uint8_t z_targeting; /* 0x140C */
char unk_1A_[0x0001]; /* 0x140D */
uint16_t disable_music_flag; /* 0x140E */
char unk_1B_[0x0002]; /* 0x1410 */
uint16_t cutscene_next; /* 0x1412 */
char unk_1C_[0x0006]; /* 0x1414 */
uint16_t skybox_time; /* 0x141A */
char unk_1D_[0x0008]; /* 0x141C */
uint16_t refill_hearts; /* 0x1424 */
char unk_1E_[0x000A]; /* 0x1426 */
z64_gameinfo_t* gameinfo; /* 0x1430 */
char unk_1F_[0x001C]; /* 0x1434 */
/* 0x1450 */
} z64_file_t;
typedef struct {
uint8_t* readBuff; /* 0x00 */
} SramContext; // size = 0x4
typedef struct {
union {
uint8_t data[0xBA8];
extended_savecontext_static_t extended;
};
} extended_save_data_t;
typedef struct {
z64_file_t original_save;
extended_save_data_t additional_save_data;
} extended_sram_file_t;
void Sram_WriteSave(SramContext* sramCtx, extended_sram_file_t* sramFile);
typedef struct {
uint8_t sound_options; /* 0x0000 */
uint8_t z_target_options; /* 0x0001 */
uint8_t language_options; /* 0x0002 */
char verification_string[9]; /* 0x0003 */
char unk_00_[0x0014]; /* 0x000C */
extended_sram_file_t primary_saves[2]; /* 0x0020 */
extended_sram_file_t backup_saves[2]; /* 0x3D10 */
/* 0x7A00 */
} z64_sram_data_t;
typedef struct {
uint32_t seg[16];
} z64_stab_t;
typedef struct {
uint8_t scene_index;
uint8_t entrance_index;
union {
uint16_t variable;
struct {
uint16_t transition_out : 7;
uint16_t transition_in : 7;
uint16_t unk_00_ : 1;
uint16_t continue_music : 1;
};
};
} z64_entrance_table_t;
typedef struct {
uint32_t scene_vrom_start;
uint32_t scene_vrom_end;
uint32_t title_vrom_start;
uint32_t title_vrom_end;
char unk_00_;
uint8_t scene_config;
char unk_01_;
char padding_00_;
} z64_scene_table_t;
typedef struct {
uint32_t size; /* 0x0000 */
Gfx *buf; /* 0x0004 */
Gfx *p; /* 0x0008 */
Gfx *d; /* 0x000C */
} z64_disp_buf_t;
typedef struct {
Gfx *poly_opa_w; /* 0x0000 */
Gfx *poly_xlu_w; /* 0x0004 */
char unk_00_[0x0008]; /* 0x0008 */
Gfx *overlay_w; /* 0x0010 */
char unk_01_[0x00A4]; /* 0x0014 */
Gfx *work_c; /* 0x00B8 */
uint32_t work_c_size; /* 0x00BC */
char unk_02_[0x00F0]; /* 0x00C0 */
Gfx *work_w; /* 0x01B0 */
z64_disp_buf_t work; /* 0x01B4 */
char unk_03_[0x00E4]; /* 0x01C4 */
z64_disp_buf_t overlay; /* 0x02A8 */
z64_disp_buf_t poly_opa; /* 0x02B8 */
z64_disp_buf_t poly_xlu; /* 0x02C8 */
uint32_t frame_count_1; /* 0x02D8 */
void *frame_buffer; /* 0x02DC */
char unk_04_[0x0008]; /* 0x02E0 */
uint32_t frame_count_2; /* 0x02E8 */
/* 0x02EC */
} z64_gfx_t;
typedef union {
struct {
uint16_t a : 1;
uint16_t b : 1;
uint16_t z : 1;
uint16_t s : 1;
uint16_t du : 1;
uint16_t dd : 1;
uint16_t dl : 1;
uint16_t dr : 1;
uint16_t : 2;
uint16_t l : 1;
uint16_t r : 1;
uint16_t cu : 1;
uint16_t cd : 1;
uint16_t cl : 1;
uint16_t cr : 1;
};
uint16_t pad;
} pad_t;
typedef struct {
pad_t pad;
int8_t x;
int8_t y;
} z64_controller_t;
typedef enum {
ACTORTYPE_SWITCH,
ACTORTYPE_BG,
ACTORTYPE_PLAYER,
ACTORTYPE_EXPLOSIVES,
ACTORTYPE_NPC,
ACTORTYPE_ENEMY,
ACTORTYPE_PROP,
ACTORTYPE_ITEMACTION,
ACTORTYPE_MISC,
ACTORTYPE_BOSS,
ACTORTYPE_DOOR,
ACTORTYPE_CHEST
} actor_type_t;
typedef struct z64_actor_s z64_actor_t;
struct z64_game_t;
typedef void (*ActorFunc)(z64_actor_t*, struct z64_game_t*);
typedef struct {
/* 0x00 */ int16_t id;
/* 0x02 */ uint8_t category; // Classifies actor and determines when it will update or draw
/* 0x04 */ uint32_t flags;
/* 0x08 */ int16_t objectId;
/* 0x0C */ uint32_t instanceSize;
/* 0x10 */ ActorFunc init; // Constructor
/* 0x14 */ ActorFunc destroy; // Destructor
/* 0x18 */ ActorFunc update; // Update Function
/* 0x1C */ ActorFunc draw; // Draw function
} ActorInit; // size = 0x20
typedef struct {
/* 0x00 */ uintptr_t vromStart;
/* 0x04 */ uintptr_t vromEnd;
/* 0x08 */ void* vramStart;
/* 0x0C */ void* vramEnd;
/* 0x10 */ void* loadedRamAddr; // original name: "allocp"
/* 0x14 */ ActorInit* initInfo;
/* 0x18 */ char* name;
/* 0x1C */ uint16_t allocType; // See `ACTOROVL_ALLOC_` defines
/* 0x1E */ int8_t numLoaded; // original name: "clients"
} ActorOverlay; // size = 0x20
struct z64_actor_s
{
int16_t actor_id; /* 0x0000 */
uint8_t actor_type; /* 0x0002 */
int8_t room_index; /* 0x0003 */
uint32_t flags; /* 0x0004 */
z64_xyzf_t pos_init; /* 0x0008 */
z64_rot_t rot_init; /* 0x0014 */
char unk_01_[0x0002]; /* 0x001A */
uint16_t variable; /* 0x001C */
uint8_t alloc_index; /* 0x001E */
char navi_tgt_dist; /* 0x001F */
uint16_t sound_effect; /* 0x0020 */
char unk_03_[0x0002]; /* 0x0022 */
z64_xyzf_t pos_world; /* 0x0024 */
z64_rot_t rot_world; /* 0x0030 */
char unk_04_[0x0002]; /* 0x0036 */
z64_xyzf_t pos_focus; /* 0x0038 */
z64_rot_t rot_focus; /* 0x0044 */
char unk_06_[0x0002]; /* 0x004A */
float unk_07_; /* 0x004C */
z64_xyzf_t scale; /* 0x0050 */
z64_xyzf_t vel_1; /* 0x005C */
float xz_speed; /* 0x0068 */
float gravity; /* 0x006C */
float min_vel_y; /* 0x0070 */
void *unk_08_; /* 0x0074 */
z64_col_poly_t* floor_poly; /* 0x0078 */
char unk_09_[0x000C]; /* 0x007C */
uint16_t unk_flags_00; /* 0x0088 */
int16_t unk_roty; /* 0x008A */
float distsq_from_link; /* 0x008C */
float xzdist_from_link; /* 0x0090 */
float ydist_from_link; /* 0x0094 */
void *damage_table; /* 0x0098 */
z64_xyzf_t vel_2; /* 0x009C */
char unk_0C_[0x0006]; /* 0x00A8 */