forked from zeldaret/oot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathz64.h
1723 lines (1582 loc) · 55.7 KB
/
z64.h
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 <ultra64.h>
#include <ultra64/gbi.h>
#include <ultra64/gs2dex.h>
#include <ultra64/controller.h>
#include <z64light.h>
#include <z64actor.h>
#include <z64audio.h>
#include <z64object.h>
#include <z64cutscene.h>
#include <z64collision_check.h>
#include <z64scene.h>
#include <z64effect.h>
#include <z64item.h>
#include <z64animation.h>
#include <z64dma.h>
#include <z64math.h>
#include <z64transition.h>
#include <bgm.h>
#include <sfx.h>
#include <color.h>
#include <ichain.h>
#include <stdarg.h>
#include <regs.h>
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
#define REGION_NULL 0
#define REGION_US 1
#define REGION_JP 2
#define REGION_EU 3
// NOTE: Once we start supporting other builds, this can be changed with an ifdef
#define REGION_NATIVE REGION_EU
// Game Info aka. Static Context (dbg ram start: 80210A10)
// Data normally accessed through REG macros (see regs.h)
typedef struct {
/* 0x00 */ s32 regPage; // 1 is first page
/* 0x04 */ s32 regGroup; // "register" group (R, RS, RO, RP etc.)
/* 0x08 */ s32 regCur; // selected register within page
/* 0x0C */ s32 dpadLast;
/* 0x10 */ s32 repeat;
/* 0x14 */ s16 data[REG_GROUPS * REG_PER_GROUP]; // 0xAE0 entries
} GameInfo; // size = 0x15D4
typedef struct {
/* 0x00 */ u8 buttonItems[4];
/* 0x04 */ u8 cButtonSlots[3];
/* 0x08 */ u16 equipment;
} ItemEquips; // size = 0x0A
typedef struct {
/* 0x00 */ u32 chest;
/* 0x04 */ u32 swch;
/* 0x08 */ u32 clear;
/* 0x0C */ u32 collect;
/* 0x10 */ u32 unk;
/* 0x14 */ u32 rooms;
/* 0x18 */ u32 floors;
} SaveSceneFlags; // size = 0x1C
typedef struct {
/* 0x00 */ s16 scene;
/* 0x02 */ Vec3s pos;
/* 0x08 */ s16 angle;
} HorseData; // size = 0x0A
typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ s16 yaw;
/* 0x0E */ s16 playerParams;
/* 0x10 */ s16 entranceIndex;
/* 0x12 */ u8 roomIndex;
/* 0x13 */ s8 data;
/* 0x14 */ u32 tempSwchFlags;
/* 0x18 */ u32 tempCollectFlags;
} RespawnData; // size = 0x1C
typedef enum {
/* 0x00 */ RESPAWN_MODE_DOWN, /* Normal Void Outs */
/* 0x01 */ RESPAWN_MODE_RETURN, /* Grotto Returnpoints */
/* 0x02 */ RESPAWN_MODE_TOP /* Farore's Wind */
} RespawnMode;
typedef enum {
/* 0x00 */ BTN_ENABLED,
/* 0xFF */ BTN_DISABLED = 0xFF
} ButtonStatus;
// Save Context (dbg ram start: 8015E660)
typedef struct {
/* 0x0000 */ s32 entranceIndex;
/* 0x0004 */ s32 linkAge; // 0: Adult; 1: Child
/* 0x0008 */ s32 cutsceneIndex;
/* 0x000C */ u16 dayTime; // "zelda_time"
/* 0x0010 */ s32 nightFlag;
/* 0x0014 */ s32 unk_14;
/* 0x0018 */ s32 unk_18;
/* 0x001C */ char newf[6]; // string "ZELDAZ"
/* 0x0022 */ s16 deaths;
/* 0x0024 */ char playerName[8];
/* 0x002C */ s16 n64ddFlag;
/* 0x002E */ s16 healthCapacity; // "max_life"
/* 0x0030 */ s16 health; // "now_life"
/* 0x0032 */ s8 magicLevel;
/* 0x0033 */ s8 magic;
/* 0x0034 */ s16 rupees;
/* 0x0036 */ u16 bgsHitsLeft;
/* 0x0038 */ u16 naviTimer;
/* 0x003A */ u8 magicAcquired;
/* 0x003B */ char unk_3B[0x0001];
/* 0x003C */ u8 doubleMagic;
/* 0x003D */ u8 doubleDefense;
/* 0x003E */ s8 bgsFlag;
/* 0x0040 */ ItemEquips childEquips;
/* 0x004A */ ItemEquips adultEquips;
/* 0x0054 */ char unk_54[0x0014];
/* 0x0068 */ ItemEquips equips;
/* 0x0072 */ char unk_72[0x0002];
/* 0x0074 */ u8 items[24];
/* 0x008C */ s8 ammo[16];
/* 0x009C */ u16 equipment;
/* 0x00A0 */ u32 upgrades;
/* 0x00A4 */ u32 questItems;
/* 0x00A8 */ u8 dungeonItems[20];
/* 0x00BC */ s8 dungeonKeys[19];
/* 0x00CF */ s8 defenseHearts;
/* 0x00D0 */ s16 gsTokens;
/* 0x00D4 */ SaveSceneFlags sceneFlags[124];
struct {
/* 0x0E64 */ Vec3i pos;
/* 0x0E70 */ s32 yaw;
/* 0x0E74 */ s32 playerParams;
/* 0x0E78 */ s32 entranceIndex;
/* 0x0E7C */ s32 roomIndex;
/* 0x0E80 */ s32 set;
/* 0x0E84 */ s32 tempSwchFlags;
/* 0x0E88 */ s32 tempCollectFlags;
} fw;
/* 0x0E8C */ char unk_E8C[0x0010];
/* 0x0E9C */ u8 gsFlags[24];
/* 0x0EB4 */ char unk_EB4[0x0010];
/* 0x0EC4 */ s32 unk_EC4;
/* 0x0EC8 */ char unk_EC8[0x000C];
/* 0x0ED4 */ u16 eventChkInf[14]; // "event_chk_inf"
/* 0x0EF0 */ u16 itemGetInf[4]; // "item_get_inf"
/* 0x0EF8 */ u16 infTable[30]; // "inf_table"
/* 0x0F34 */ char unk_F34[0x0004];
/* 0x0F38 */ u32 worldMapAreaData; // "area_arrival"
/* 0x0F3C */ char unk_F3C[0x040C];
/* 0x1348 */ HorseData horseData;
/* 0x1352 */ u16 checksum; // "check_sum"
/* 0x1354 */ s32 fileNum; // "file_no"
/* 0x1358 */ char unk_1358[0x0004];
/* 0x135C */ s32 gameMode;
/* 0x1360 */ s32 sceneSetupIndex;
/* 0x1364 */ s32 respawnFlag; // "restart_flag"
/* 0x1368 */ RespawnData respawn[3]; // "restart_data"
/* 0x13BC */ char unk_13BC[0x0008];
/* 0x13C4 */ s16 dogParams;
/* 0x13C6 */ char unk_13C6[0x0001];
/* 0x13C7 */ u8 unk_13C7;
/* 0x13C8 */ s16 nayrusLoveTimer;
/* 0x13CA */ char unk_13CA[0x0002];
/* 0x13CC */ s16 rupeeAccumulator;
/* 0x13CE */ s16 timer1State;
/* 0x13D0 */ s16 timer1Value;
/* 0x13D2 */ s16 timer2State;
/* 0x13D4 */ s16 timer2Value;
/* 0x13D6 */ s16 timerX[2];
/* 0x13DA */ s16 timerY[2];
/* 0x13DE */ char unk_13DE[0x0002];
/* 0x13E0 */ u8 seqIndex;
/* 0x13E1 */ u8 nightSeqIndex;
/* 0x13E2 */ u8 buttonStatus[5];
/* 0x13E7 */ u8 unk_13E7;
/* 0x13E8 */ u16 unk_13E8; // alpha type?
/* 0x13EA */ u16 unk_13EA; // also alpha type?
/* 0x13EC */ u16 unk_13EC; // alpha type counter?
/* 0x13EE */ u16 unk_13EE; // previous alpha type?
/* 0x13F0 */ s16 unk_13F0;
/* 0x13F2 */ s16 unk_13F2;
/* 0x13F4 */ s16 unk_13F4;
/* 0x13F6 */ s16 unk_13F6;
/* 0x13F8 */ s16 unk_13F8;
/* 0x13FA */ u16 eventInf[4]; // "event_inf"
/* 0x1402 */ u16 mapIndex; // intended for maps/minimaps but commonly used as the dungeon index
/* 0x1404 */ u16 minigameState;
/* 0x1406 */ u16 minigameScore; // "yabusame_total"
/* 0x1408 */ char unk_1408[0x0001];
/* 0x1409 */ u8 language;
/* 0x140A */ u8 audioSetting;
/* 0x140B */ char unk_140B[0x0001];
/* 0x140C */ u8 zTargetingSetting; // 0: Switch; 1: Hold
/* 0x140E */ u16 unk_140E; // bgm related
/* 0x1410 */ u8 unk_1410;
/* 0x1411 */ u8 unk_1411;
/* 0x1412 */ u16 nextCutsceneIndex;
/* 0x1414 */ u8 cutsceneTrigger;
/* 0x1415 */ u8 chamberCutsceneNum;
/* 0x1416 */ u16 nextDayTime; // "next_zelda_time"
/* 0x1418 */ u8 fadeDuration;
/* 0x1419 */ u8 unk_1419; // transition related
/* 0x141A */ u16 environmentTime;
/* 0x141C */ u8 dogIsLost;
/* 0x141D */ u8 nextTransition;
/* 0x141E */ char unk_141E[0x0002];
/* 0x1420 */ s16 worldMapArea;
/* 0x1422 */ s16 unk_1422; // day time related
/* 0x1424 */ s16 healthAccumulator;
} SaveContext; // size = 0x1428
typedef struct {
/* 0x00000 */ u16 headMagic; // 1234
/* 0x00008 */ Gfx polyOpaBuffer[0x17E0];
/* 0x0BF08 */ Gfx polyXluBuffer[0x800];
/* 0x0FF08 */ Gfx overlayBuffer[0x400];
/* 0x11F08 */ Gfx workBuffer[0x80];
/* 0x11308 */ Gfx unusedBuffer[0x20];
/* 0x12408 */ u16 tailMagic; // 5678
} GfxPool; // size = 0x12410
typedef struct {
/* 0x0000 */ u32 size;
/* 0x0004 */ u8* bufp;
/* 0x0008 */ u8* head;
/* 0x000C */ u8* tail;
} TwoHeadArena; // size = 0x10
typedef struct {
/* 0x0000 */ u32 size;
/* 0x0004 */ Gfx* bufp;
/* 0x0008 */ Gfx* p;
/* 0x000C */ Gfx* d;
} TwoHeadGfxArena; // size = 0x10
typedef struct OSScTask {
/* 0x00 */ struct OSScTask* next;
/* 0x04 */ u32 state;
/* 0x08 */ u32 flags;
/* 0x0C */ void* framebuffer;
/* 0x10 */ OSTask list;
/* 0x50 */ OSMesgQueue* msgQ;
/* 0x54 */ OSMesg msg;
} OSScTask;
typedef struct GraphicsContext {
/* 0x0000 */ Gfx* polyOpaBuffer;
/* 0x0004 */ Gfx* polyXluBuffer;
/* 0x0008 */ char unk_008[0x08];
/* 0x0010 */ Gfx* overlayBuffer;
/* 0x0014 */ u32 unk_014;
/* 0x0018 */ char unk_018[0x20];
/* 0x0038 */ OSMesg msgBuff[0x08];
/* 0x0058 */ OSMesgQueue* schedMsgQ;
/* 0x005C */ OSMesgQueue queue;
/* 0x0074 */ char unk_074[0x04];
/* 0x0078 */ OSScTask task; // size of OSScTask might be wrong
/* 0x00D0 */ char unk_0D0[0xE0];
/* 0x01B0 */ Gfx* workBuffer;
/* 0x01B4 */ TwoHeadGfxArena work;
/* 0x01C4 */ char unk_01C4[0xC0];
/* 0x0284 */ OSViMode* viMode;
/* 0x0288 */ char unk_0288[0x20];
/* 0x02A8 */ TwoHeadGfxArena overlay;
/* 0x02B8 */ TwoHeadGfxArena polyOpa;
/* 0x02C8 */ TwoHeadGfxArena polyXlu;
/* 0x02D8 */ u32 gfxPoolIdx;
/* 0x02DC */ u16* curFrameBuffer;
/* 0x02E0 */ char unk_2E0[0x04];
/* 0x02E4 */ u32 viFeatures;
/* 0x02E8 */ s32 fbIdx;
/* 0x02EC */ void (*callback)(struct GraphicsContext*, u32);
/* 0x02F0 */ u32 callbackParam;
/* 0x02F4 */ f32 xScale;
/* 0x02F8 */ f32 yScale;
/* 0x02FC */ char unk_2FC[0x04];
} GraphicsContext; // size = 0x300
typedef struct {
PadInput in;
union {
u16 status;
struct {
u8 errno;
u8 statusLo;
};
};
} PadState;
typedef struct
{
/* 0x00 */ PadState cur;
/* 0x06 */ PadState prev;
/* 0x0C */ PadState press; // X/Y store delta from last frame
/* 0x12 */ PadState rel; // X/Y store adjusted
/* The old version of this struct is:
RawInput raw;
u16 status;
RawInput rawPrev;
u16 statusPrev;
u16 padPressed;
s8 xDiff;
s8 yDiff;
char unk_10[0x02];
u16 padReleased;
s8 xAdjusted;
s8 yAdjusted;
char unk_16[0x02];
*/
} Input; // size = 0x18
typedef struct {
/* 0x0000 */ OSContStatus pad_status[4];
/* 0x0010 */ OSMesg msgbuf1[1];
/* 0x0014 */ OSMesg msgbuf2[1];
/* 0x0018 */ OSMesg msgbuf3[4];
/* 0x0028 */ OSMesgQueue queue1;
/* 0x0040 */ OSMesgQueue queue2;
/* 0x0058 */ OSMesgQueue queue3;
/* 0x0070 */ UNK_TYPE unk_70;
/* 0x0074 */ UNK_TYPE unk_74;
/* 0x0078 */ UNK_TYPE unk_78;
/* 0x007C */ UNK_TYPE unk_7C;
/* 0x0080 */ OSThread thread;
/* 0x0230 */ Input inputs[4]; // 0x18 each = 0x60 total
/* 0x0290 */ PadState pads[4]; // 0x6 each = 0x18 total
/* 0x02A8 */ volatile u8 validCtrlrsMask;
/* 0x02A9 */ s8 ncontrollers;
/* 0x02AA */ u8 ctrlrIsConnected[4]; // "Key_switch" originally
/* 0x02AE */ u8 pakType[4]; // 1 if rumble pack, 2 if mempak?
/* 0x02B2 */ volatile u8 rumbleEnable[4];
/* 0x02B6 */ u8 rumbleCounter[4]; // not clear exact meaning
/* 0x02BC */ unk_controller_t unk_controller[4];
/* 0x045C */ volatile u8 rumbleOffFrames;
/* 0x045D */ volatile u8 rumbleOnFrames;
/* 0x045E */ u8 preNMIShutdown;
/* 0x0460 */ void (*retraceCallback)(void* padmgr, u32 unk464);
/* 0x0464 */ u32 retraceCallbackValue;
} PadMgr; // size = 0x468
typedef struct {
/* 0x0000 */ s32 topY; // uly (upper left y)
/* 0x0004 */ s32 bottomY; // lry (lower right y)
/* 0x0008 */ s32 leftX; // ulx (upper left x)
/* 0x000C */ s32 rightX; // lrx (lower right x)
} Viewport; // size = 0x10
typedef struct {
/* 0x0000 */ s32 magic; // string literal "VIEW" / 0x56494557
/* 0x0004 */ GraphicsContext* gfxCtx;
/* 0x0008 */ Viewport viewport;
/* 0x0018 */ f32 fovy; // vertical field of view in degrees
/* 0x001C */ f32 zNear; // distance to near clipping plane
/* 0x0020 */ f32 zFar; // distance to far clipping plane
/* 0x0024 */ f32 scale; // scale for matrix elements
/* 0x0028 */ Vec3f eye;
/* 0x0034 */ Vec3f unk_34;
/* 0x0040 */ Vec3f unk_40;
/* 0x0050 */ Vp vp;
/* 0x0060 */ Mtx projection;
/* 0x00A0 */ Mtx viewing;
/* 0x00E0 */ Mtx* projectionPtr;
/* 0x00E4 */ Mtx* viewingPtr;
/* 0x00E8 */ Vec3f unk_E8;
/* 0x00F4 */ Vec3f unk_F4;
/* 0x0100 */ f32 unk_100;
/* 0x0104 */ Vec3f unk_104;
/* 0x0110 */ Vec3f unk_110;
/* 0x011C */ u16 normal; // used to normalize the projection matrix
/* 0x0120 */ u32 flags;
/* 0x0124 */ s32 unk_124;
} View; // size = 0x128
typedef struct {
/* 0x0000 */ s32 unk_00;
/* 0x0004 */ s16 unk_04;
/* 0x0006 */ s16 unk_06;
/* 0x0008 */ s16 unk_08;
/* 0x000A */ s16 unk_0A;
/* 0x000C */ char unk_0C[0x16];
/* 0x0022 */ s16 unk_22;
/* 0x0024 */ char unk_24[0x2C];
/* 0x0050 */ Vec3f at;
/* 0x005C */ Vec3f eye;
/* 0x0068 */ Vec3f unk_68;
/* 0x0074 */ Vec3f unk_74;
/* 0x0080 */ Vec3f unk_80;
/* 0x008C */ struct GlobalContext* globalCtx;
/* 0x0090 */ Player* player;
/* 0x0094 */ PosRot unk_94;
/* 0x00A8 */ Vec3f* unk_A8;
/* 0x00AC */ Vec3f unk_AC;
/* 0x00B8 */ char unk_B8[8];
/* 0x00C0 */ Vec3f unk_C0;
/* 0x00CC */ Vec3f unk_CC;
/* 0x00D8 */ f32 unk_D8;
/* 0x00DC */ f32 unk_DC; // possibly a Vec3f
/* 0x00E0 */ f32 unk_E0;
/* 0x00E4 */ Vec3f unk_E4;
/* 0x00F0 */ char unk_F0[0x0C];
/* 0x00FC */ f32 unk_FC;
/* 0x0100 */ f32 unk_100;
/* 0x0104 */ f32 unk_104;
/* 0x0108 */ Vec3f unk_108;
/* 0x0114 */ char unk_114[0x10];
/* 0x0124 */ s32 unk_124;
/* 0x0128 */ s32 unk_128;
/* 0x012C */ s16 unk_12C;
/* 0x012E */ s16 unk_12E;
/* 0x0130 */ s16 uid; // Unique identifier of the camera.
/* 0x0132 */ char unk_132[0x02];
/* 0x0134 */ Vec3s unk_134;
/* 0x013A */ Vec3s unk_13A;
/* 0x0140 */ s16 status;
/* 0x0142 */ s16 unk_142; // related to door camera (see func_8005AD40)
/* 0x0144 */ s16 unk_144;
/* 0x0146 */ s16 unk_146; // unknown if used
/* 0x0148 */ s16 unk_148; // ID for door camera? (see func_8005AD40)
/* 0x014A */ s16 unk_14A; // unknown if used
/* 0x014C */ s16 unk_14C;
/* 0x014E */ s16 unk_14E;
/* 0x0150 */ s16 unk_150; // unknown if used
/* 0x0152 */ s16 unk_152;
/* 0x0154 */ u16 unk_154;
/* 0x0156 */ s16 unk_156;
/* 0x0158 */ s16 unk_158; // unknown if used
/* 0x015E */ s16 unk_15A;
/* 0x015E */ s16 unk_15C; // unknown if used
/* 0x015E */ u16 unk_15E;
/* 0x0160 */ s16 unk_160;
/* 0x0162 */ s16 unk_162;
/* 0x0164 */ s16 unk_164;
/* 0x0166 */ s16 unk_166; // unknown if used
/* 0x0168 */ s16 unk_168;
/* 0x016A */ s16 unk_16A; // unknown if used
} Camera; // size = 0x16C
typedef struct {
/* 0x00 */ u8 musicSeq;
/* 0x01 */ u8 nighttimeSFX;
/* 0x02 */ char unk_02[0x2];
} SoundContext; // size = 0x4
typedef struct {
/* 0x00 */ s32 unk_0;
/* 0x04 */ char unk_4[0x4];
} SubGlobalContext7B8; // size = 0x8
typedef struct {
/* 0x00 */ char unk_00[0x2];
/* 0x02 */ s16 unk_02;
/* 0x04 */ char unk_04[0xC];
} WaterBox; // size = 0x10
typedef struct {
/* 0x00 */ Vec3s colAbsMin;
/* 0x06 */ Vec3s colAbsMax;
/* 0x0C */ s16 nbVertices;
/* 0x10 */ void* vertexArray;
/* 0x14 */ s16 nbPolygons;
/* 0x18 */ void* polygonArray;
/* 0x1C */ void* polygonTypes;
/* 0x20 */ void* cameraData;
/* 0x24 */ s16 nbWaterBoxes;
/* 0x28 */ WaterBox* waterBoxes;
} CollisionHeader;
typedef struct {
/* 0x00 */ CollisionHeader* colHeader;
/* 0x04 */ char unk_04[0x4C];
} StaticCollisionContext; // size = 0x50
typedef struct {
/* 0x0000 */ ActorMesh actorMeshArr[50];
/* 0x1388 */ char unk_1388[0x04];
/* 0x138C */ u16 flags[50];
/* 0x13F0 */ char unk_13F0[0x24];
} DynaCollisionContext; // size = 0x1414
typedef struct {
/* 0x0000 */ StaticCollisionContext stat;
/* 0x0050 */ DynaCollisionContext dyna;
} CollisionContext; // size = 0x1464
typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ f32 unk_0C; // radius?
/* 0x10 */ Color_RGB8 color;
} TargetContextEntry; // size = 0x14
typedef struct {
/* 0x00 */ Vec3f naviRefPos; // possibly wrong
/* 0x0C */ Vec3f targetCenterPos;
/* 0x18 */ Color_RGBAf naviInner;
/* 0x28 */ Color_RGBAf naviOuter;
/* 0x38 */ Actor* arrowPointedActor;
/* 0x3C */ Actor* targetedActor;
/* 0x40 */ f32 unk_40;
/* 0x44 */ f32 unk_44;
/* 0x48 */ s16 unk_48;
/* 0x4A */ u8 activeType;
/* 0x4B */ u8 unk_4B;
/* 0x4C */ s8 unk_4C;
/* 0x4D */ char unk_4D[0x03];
/* 0x50 */ TargetContextEntry arr_50[3];
/* 0x8C */ Actor* unk_8C;
/* 0x90 */ Actor* unk_90;
/* 0x94 */ Actor* unk_94;
} TargetContext; // size = 0x98
typedef struct {
/* 0x00 */ u32 texture;
/* 0x04 */ s16 unk_4;
/* 0x06 */ s16 unk_6;
/* 0x08 */ u8 unk_8;
/* 0x09 */ u8 unk_9;
/* 0x0A */ u8 delayA;
/* 0x0B */ u8 delayB;
/* 0x0C */ s16 unk_C;
/* 0x0E */ s16 unk_E;
} TitleCardContext; // size = 0x10
typedef struct {
/* 0x00 */ u32 length; // number of actors loaded of this type
/* 0x04 */ Actor* first; // pointer to first actor of this type
} ActorListEntry; // size = 0x08
typedef struct {
/* 0x0000 */ u8 unk_00;
/* 0x0001 */ char unk_01[0x01];
/* 0x0002 */ u8 unk_02;
/* 0x0003 */ u8 unk_03;
/* 0x0004 */ char unk_04[0x04];
/* 0x0008 */ u8 total; // total number of actors loaded
/* 0x0009 */ char unk_09[0x03];
/* 0x000C */ ActorListEntry actorList[12];
/* 0x006C */ TargetContext targetCtx;
struct {
/* 0x0104 */ u32 swch;
/* 0x0108 */ u32 tempSwch;
/* 0x010C */ u32 unk0;
/* 0x0110 */ u32 unk1;
/* 0x0114 */ u32 chest;
/* 0x0118 */ u32 clear;
/* 0x011C */ u32 tempClear;
/* 0x0120 */ u32 collect;
/* 0x0124 */ u32 tempCollect;
} flags;
/* 0x0128 */ TitleCardContext titleCtx;
/* 0x0138 */ char unk_138[0x04];
/* 0x013C */ void* absoluteSpace; // Space used to allocate actor overlays of alloc type 1
} ActorContext; // size = 0x140
typedef struct {
/* 0x00 */ char unk_00[0x4];
/* 0x04 */ void* segment;
/* 0x08 */ u8 state;
/* 0x0C */ f32 unk_0C;
/* 0x10 */ u16 frames;
/* 0x12 */ u16 unk_12;
/* 0x14 */ s32 unk_14;
/* 0x18 */ u16 unk_18;
/* 0x1A */ u8 unk_1A;
/* 0x1B */ u8 unk_1B;
/* 0x1C */ CutsceneCameraPoint* cameraFocus;
/* 0x20 */ CutsceneCameraPoint* cameraPosition;
/* 0x24 */ CsCmdActorAction* linkAction;
/* 0x28 */ CsCmdActorAction* actorActions[10]; // "npcdemopnt"
} CutsceneContext; // size = 0x50
typedef struct {
/* 0x00 */ u16 countdown;
/* 0x04 */ Vec3f originPos;
/* 0x10 */ Vec3f relativePos;
} SoundSource; // size = 0x1C
typedef struct {
/* 0x00 */ char unk_0[0x4];
} SubGlobalContext1F74; // size = 0x4
typedef struct {
/* 0x000 */ char unk_00[0x140];
/* 0x140 */ s16 unk_140;
/* 0x142 */ char unk_142[0x0E];
} SkyboxContext; // size = 0x150
typedef struct {
/* 0x0000 */ View view;
/* 0x0128 */ char unk_128[0xE188];
/* 0xE2B0 */ void* textboxSegment; // "fukidashiSegment"
/* 0xE2B4 */ char unk_E2B4[0x44];
/* 0xE2FA */ u16 unk_E2F8;
/* 0xE2FA */ u16 unk_E2FA;
/* 0xE2FC */ char unk_E2FC[0x04];
/* 0xE300 */ s32 unk_E300;
/* 0xE304 */ u8 msgMode;
/* 0xE305 */ char unk_E305[0xD1];
/* 0xE3D6 */ u16 unk_E3D6;
/* 0xE3D8 */ char unk_E3D8[0x0A];
/* 0xE3E2 */ u16 unk_E3E2;
/* 0xE3E4 */ u8 unk_E3E4;
/* 0xE3E5 */ u8 choiceIndex;
/* 0xE3E6 */ char unk_E3E6[0x01];
/* 0xE3E7 */ u8 unk_E3E7;
/* 0xE3E8 */ char unk_E3E8[0x6];
/* 0xE3EE */ u16 unk_E3EE;
/* 0xE3F0 */ u16 unk_E3F0;
/* 0xE3F2 */ char unk_E3F2[0x02];
/* 0xE3F4 */ u16 unk_E3F4;
/* 0xE3F6 */ char unk_E3F6[0x16];
/* 0xE40C */ u16 unk_E40C;
/* 0xE40E */ s16 unk_E40E;
/* 0xE410 */ char unk_E410[0x08];
} MessageContext; // size = 0xE418
typedef struct {
/* 0x0000 */ View view;
/* 0x0128 */ Vtx* vtx_128;
/* 0x012C */ Vtx* vtx_12C;
/* 0x0130 */ void* parameterSegment;
/* 0x0134 */ void* do_actionSegment;
/* 0x0138 */ void* icon_itemSegment;
/* 0x013C */ void* mapSegment;
/* 0x0140 */ u8 unk_140[32];
/* 0x0160 */ DmaRequest dmaRequest_160;
/* 0x0180 */ DmaRequest dmaRequest_180;
/* 0x01A0 */ char unk_1A0[0x20];
/* 0x01C0 */ OSMesgQueue loadQueue;
/* 0x01D8 */ OSMesg loadMsg;
/* 0x01DC */ Viewport viewport;
/* 0x01EC */ s16 unk_1EC;
/* 0x01EE */ u16 unk_1EE;
/* 0x01F0 */ u16 unk_1F0;
/* 0x01F4 */ f32 unk_1F4;
/* 0x01F8 */ s16 naviCalling;
/* 0x01FA */ s16 unk_1FA;
/* 0x01FC */ s16 unk_1FC;
/* 0x01FE */ s16 unk_1FE;
/* 0x0200 */ s16 unk_200;
/* 0x0202 */ s16 unk_202[3];
/* 0x0208 */ s16 unk_208[3];
/* 0x020E */ s16 unk_20E[6];
/* 0x021A */ s16 unk_21A[6];
/* 0x0226 */ s16 unk_226;
/* 0x0228 */ s16 unk_228;
/* 0x022A */ s16 unk_22A;
/* 0x022C */ s16 unk_22C;
/* 0x022E */ s16 unk_22E;
/* 0x0230 */ s16 unk_230;
/* 0x0232 */ s16 counterDigits[4]; // used for key and rupee counters
/* 0x023A */ u8 unk_23A;
/* 0x023C */ u16 unk_23C;
/* 0x023E */ u16 hbaAmmo; // ammo while playing the horseback archery minigame
/* 0x0240 */ u16 unk_240;
/* 0x0242 */ u16 unk_242;
/* 0x0224 */ u16 unk_244; // screen fill alpha?
/* 0x0246 */ u16 aAlpha; // also carrots alpha
/* 0x0248 */ u16 bAlpha; // also HBA score alpha
/* 0x024A */ u16 cLeftAlpha;
/* 0x024C */ u16 cDownAlpha;
/* 0x024E */ u16 cRightAlpha;
/* 0x0250 */ u16 healthAlpha; // also max C-Up alpha
/* 0x0252 */ u16 magicAlpha; // also Rupee and Key counters alpha
/* 0x0254 */ u16 minimapAlpha;
/* 0x0256 */ s16 startAlpha;
/* 0x0258 */ s16 unk_258;
/* 0x025A */ s16 unk_25A;
/* 0x025C */ s16 mapRoomNum;
/* 0x025E */ s16 mapPaletteNum; // "map_palete_no"
/* 0x0260 */ u8 unk_260;
/* 0x0261 */ u8 unk_261;
struct {
/* 0x0262 */ u8 hGauge; // "h_gage"; unknown?
/* 0x0263 */ u8 bButton; // "b_button"
/* 0x0264 */ u8 aButton; // "a_button"
/* 0x0265 */ u8 bottles; // "c_bottle"
/* 0x0266 */ u8 tradeItems; // "c_warasibe"
/* 0x0267 */ u8 hookshot; // "c_hook"
/* 0x0268 */ u8 ocarina; // "c_ocarina"
/* 0x0269 */ u8 warpSongs; // "c_warp"
/* 0x026A */ u8 sunsSong; // "m_sunmoon"
/* 0x026B */ u8 farores; // "m_wind"
/* 0x026C */ u8 dinsNayrus; // "m_magic"; din's fire and nayru's love
/* 0x026D */ u8 all; // "another"; enables all item restrictions
} restrictions;
} InterfaceContext; // size = 0x270
typedef struct {
/* 0x0000 */ View view;
/* 0x0128 */ void* unk_128;
/* 0x012C */ char unk_12C[0x03C];
/* 0x0168 */ Vtx* vtx_168;
/* 0x016C */ char unk_16C[0x068];
/* 0x01D4 */ u16 state;
/* 0x01D6 */ u16 flag;
/* 0x01D8 */ char unk_1D8[0x00C];
/* 0x01E4 */ u16 unk_1E4;
/* 0x01E6 */ char unk_1E6[0x006];
/* 0x01EC */ u16 unk_1EC;
/* 0x01EE */ char unk_1EE[0x04A];
/* 0x0238 */ u16 unk_238;
/* 0x023A */ char unk_23A[0x004];
/* 0x023E */ u16 unk_23E;
/* 0x0240 */ char unk_240[0x00E];
/* 0x024E */ u16 unk_24E;
/* 0x0250 */ char unk_250[0x004];
/* 0x0254 */ s16 unk_254;
/* 0x0256 */ s16 unk_256;
/* 0x0258 */ s16 unk_258;
/* 0x025A */ char unk_25A[0x066];
} PauseContext; // size = 0x2C0
typedef struct {
/* 0x00 */ char unk_00[0x02];
/* 0x02 */ u16 unk_02;
/* 0x04 */ Vec3f unk_04;
/* 0x10 */ char unk_10[0x03];
/* 0x13 */ u8 unk_13;
/* 0x14 */ char unk_14[0x01];
/* 0x15 */ u8 skyDisabled;
/* 0x16 */ u8 sunMoonDisabled;
/* 0x17 */ u8 gloomySky;
/* 0x18 */ u8 unk_18;
/* 0x19 */ u8 unk_19;
/* 0x1A */ u16 unk_1A;
/* 0x1C */ char unk_1C[0x02];
/* 0x1E */ u8 unk_1E;
/* 0x1F */ u8 unk_1F;
/* 0x20 */ u8 unk_20;
/* 0x21 */ u8 unk_21;
/* 0x22 */ u16 unk_22;
/* 0x24 */ u16 unk_24;
/* 0x26 */ char unk_26[0x04];
/* 0x2A */ s8 unk_2A;
/* 0x2B */ s8 unk_2B;
/* 0x2C */ s8 unk_2C;
/* 0x2D */ char unk_2D[0x5E];
/* 0x8C */ s16 unk_8C[6];
/* 0x98 */ char unk_98[0x08];
/* 0xA0 */ s16 unk_A0;
/* 0xA2 */ char unk_A2[0x06];
/* 0xA8 */ s16 unk_A8;
/* 0xAA */ s16 unk_AA;
/* 0xAC */ s16 unk_AC;
/* 0xB0 */ f32 unk_B0;
/* 0xB4 */ u8 nbLightSettings;
/* 0xB8 */ UNK_PTR lightSettingsList;
/* 0xBC */ char unk_BC[0x03];
/* 0xBF */ u8 unk_BF;
/* 0xC0 */ char unk_C0[0x18];
/* 0xD8 */ f32 unk_D8;
/* 0xDC */ u8 unk_DC;
/* 0xDD */ u8 gloomySkyEvent;
/* 0xDE */ u8 unk_DE;
/* 0xDF */ u8 lightning;
/* 0xE0 */ u8 unk_E0;
/* 0xE1 */ u8 unk_E1;
/* 0xE2 */ u8 unk_E2[4];
/* 0xE6 */ u8 unk_E6;
/* 0xE7 */ u8 unk_E7;
/* 0xE8 */ u8 unk_E8;
/* 0xE9 */ char unk_E9[0x05];
/* 0xEE */ u8 unk_EE[4];
/* 0xF2 */ u8 unk_F2[4];
/* 0xF6 */ char unk_F6[0x06];
} EnvironmentContext; // size = 0xFC
typedef struct {
/* 0x00 */ s16 id;
/* 0x04 */ void* segment;
/* 0x08 */ DmaRequest dmaRequest;
/* 0x28 */ OSMesgQueue loadQueue;
/* 0x40 */ OSMesg loadMsg;
} ObjectStatus; // size = 0x44
typedef struct {
/* 0x0000 */ void* spaceStart;
/* 0x0004 */ void* spaceEnd; // original name: "endSegment"
/* 0x0008 */ u8 num; // number of objects in bank
/* 0x0009 */ u8 unk_09;
/* 0x000A */ u8 mainKeepIndex; // "gameplay_keep" index in bank
/* 0x000B */ u8 subKeepIndex; // "gameplay_field_keep" or "gameplay_dangeon_keep" index in bank
/* 0x000C */ ObjectStatus status[OBJECT_EXCHANGE_BANK_MAX];
} ObjectContext; // size = 0x514
typedef struct {
/* 0x00 */ Gfx* opa;
/* 0x04 */ Gfx* xlu;
} PolygonDlist; // size = 0x8
typedef struct {
/* 0x00 */ u8 type;
/* 0x01 */ u8 num; // number of dlist entries
/* 0x04 */ void* start;
/* 0x08 */ void* end;
} Polygon; // size = 0xC
typedef struct {
/* 0x00 */ u8 type;
/* 0x01 */ u8 num; // number of dlist entries
/* 0x04 */ void* start;
/* 0x08 */ void* end;
} PolygonType0; // size = 0xC
typedef struct {
/* 0x00 */ u16 unk_00;
/* 0x02 */ u8 id;
/* 0x04 */ u32 source;
/* 0x08 */ u32 unk_0C;
/* 0x0C */ u32 tlut;
/* 0x10 */ u16 width;
/* 0x12 */ u16 height;
/* 0x14 */ u8 fmt;
/* 0x15 */ u8 siz;
/* 0x16 */ u16 mode0;
/* 0x18 */ u16 tlutCount;
} BgImage; // size = 0x1C
typedef struct {
/* 0x00 */ u8 type;
/* 0x01 */ u8 format; // 1 = single, 2 = multi
/* 0x04 */ void* dlist;
union {
struct {
/* 0x08 */ u32 source;
/* 0x0C */ u32 unk_0C;
/* 0x10 */ u32 tlut;
/* 0x14 */ u16 width;
/* 0x16 */ u16 height;
/* 0x18 */ u8 fmt;
/* 0x19 */ u8 siz;
/* 0x1A */ u16 mode0;
/* 0x1C */ u16 tlutCount;
} single;
struct {
/* 0x08 */ u8 count;
/* 0x0C */ BgImage* list;
} multi;
};
} PolygonType1;
typedef struct {
/* 0x00 */ Vec3s pos;
/* 0x06 */ s16 unk_06;
/* 0x08 */ Gfx* opa;
/* 0x0C */ Gfx* xlu;
} PolygonDlist2; // size = 0x8
typedef struct {
/* 0x00 */ u8 type;
/* 0x01 */ u8 num; // number of dlist entries
/* 0x04 */ void* start;
/* 0x08 */ void* end;
} PolygonType2; // size = 0xC
typedef union {
Polygon polygon;
PolygonType0 polygon0;
PolygonType1 polygon1;
PolygonType2 polygon2;
} Mesh; // "Ground Shape"
typedef struct {
/* 0x00 */ s8 num;
/* 0x01 */ u8 unk_01;
/* 0x02 */ u8 unk_02;
/* 0x03 */ u8 unk_03;
/* 0x04 */ s8 echo;
/* 0x05 */ u8 showInvisActors;
/* 0x08 */ Mesh* mesh; // original name: "ground_shape"
/* 0x0C */ void* segment;
/* 0x10 */ char unk_10[0x4];
} Room; // size = 0x14
typedef struct {
/* 0x00 */ Room curRoom;
/* 0x14 */ Room prevRoom;
/* 0x28 */ void* bufPtrs[2];
/* 0x30 */ u8 unk_30;
/* 0x31 */ s8 status;
/* 0x34 */ void* unk_34;
/* 0x38 */ DmaRequest dmaRequest;
/* 0x58 */ OSMesgQueue loadQueue;
/* 0x70 */ OSMesg loadMsg;
} RoomContext; // size = 0x74
typedef struct {
/* 0x000 */ s16 colAtCount;
/* 0x002 */ u16 sacFlags;
/* 0x004 */ Collider* colAt[COLLISION_CHECK_AT_MAX];
/* 0x0CC */ s32 colAcCount;
/* 0x0D0 */ Collider* colAc[COLLISION_CHECK_AC_MAX];
/* 0x1C0 */ s32 colOcCount;
/* 0x1C4 */ Collider* colOc[COLLISION_CHECK_OC_MAX];
/* 0x28C */ s32 colOcLineCount;
/* 0x290 */ OcLine* colOcLine[COLLISION_CHECK_OC_LINE_MAX];
} CollisionCheckContext; // size = 0x29C SubGlobalContext11E60
typedef struct {
/* 0x00 */ char unk_00[0x10];
/* 0x10 */ u16* unk_10;
/* 0x14 */ u16* unk_14;
/* 0x18 */ u16* unk_18;
/* 0x1C */ char unk_1C[0x87];
/* 0xA3 */ s8 unk_A3;
} PreRenderContext; // size = 0xA4
typedef struct {
union {
TransitionFade fade;
TransitionCircle circle;
TransitionTriforce triforce;
TransitionWipe wipe;
char data[0x228];
};
/* 0x228 */ s32 transitionType;
/* 0x22C */ void* (*init)(void* transition);
/* 0x230 */ void (*destroy)(void* transition);
/* 0x234 */ void (*update)(void* transition, s32 updateRate);
/* 0x238 */ void (*draw)(void* transition, Gfx** gfxP);
/* 0x23C */ void (*start)(void* transition);
/* 0x240 */ void (*setType)(void* transition, s32 type);
/* 0x244 */ void (*setColor)(void* transition, u32 color);
/* 0x248 */ void (*setEnvColor)(void* transition, u32 color);
/* 0x24C */ s32 (*isDone)(void* transition);
} TransitionContext; // size = 0x250
typedef struct {
/* 0x00 */ s16 id;
/* 0x02 */ Vec3s pos;
/* 0x08 */ Vec3s rot;
/* 0x0E */ s16 params;
} ActorEntry; // size = 0x10
typedef struct {
/* 0x00 */ s8 frontRoom; // Room to switch to when triggered from the front of the object
/* 0x01 */ s8 frontEffects; // How the camera reacts during the front transition
/* 0x02 */ s8 backRoom; // Room to switch to when triggered from the back of the object
/* 0x03 */ s8 backEffects; // How the camera reacts during the back transition
/* 0x04 */ s16 id;
/* 0x06 */ Vec3s pos;
/* 0x0C */ s16 rotY;
/* 0x0E */ s16 params;
} TransitionActorEntry; // size = 0x10
typedef struct {
/* 0x00 */ u8 spawn;
/* 0x01 */ u8 room;
} EntranceEntry;
typedef struct {
/* 0x00 */ void* read_buff;
} Sram; // size = 0x4
typedef struct GameAllocEntry {
/* 0x00 */ struct GameAllocEntry* next;
/* 0x04 */ struct GameAllocEntry* prev;
/* 0x08 */ u32 size;
/* 0x0C */ u32 unk_0C;
} GameAllocEntry; // size = 0x10
typedef struct {
/* 0x00 */ GameAllocEntry base;
/* 0x10 */ GameAllocEntry* head;
} GameAlloc; // size = 0x14
typedef struct GameState {
/* 0x00 */ GraphicsContext* gfxCtx;
/* 0x04 */ void (*main)(struct GameState*);
/* 0x08 */ void (*destroy)(struct GameState*); // "cleanup"
/* 0x0C */ void (*init)(struct GameState*);
/* 0x10 */ u32 size;
/* 0x14 */ Input input[4];
/* 0x74 */ TwoHeadArena tha;
/* 0x84 */ GameAlloc alloc;
/* 0x98 */ u32 running;
/* 0x9C */ u32 frames;
/* 0xA0 */ u32 unk_A0;
} GameState; // size = 0xA4
typedef struct {
/* 0x0000 */ GameState state;
/* 0x00A4 */ void* staticSegment;
/* 0x00A8 */ View view;
/* 0x01D0 */ Sram sram;
/* 0x01D4 */ u16 unk_1D4; // not used in mq dbg (some sort of timer that doesn't seem to affect anything)
/* 0x01D6 */ s16 coverAlpha;
/* 0x01D8 */ s16 addAlpha; // not used in mq dbg
/* 0x01DA */ u16 visibleDuration; // not used in mq dbg
/* 0x01DC */ s16 ult;
/* 0x01DE */ s16 uls;
/* 0x01E0 */ char unk_1E0[0x01];
/* 0x01E1 */ u8 exit;