forked from Zelda64Recomp/Zelda64Recomp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.c
1141 lines (894 loc) · 49.4 KB
/
options.c
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
#include "patches.h"
#include "misc_funcs.h"
#include "z64shrink_window.h"
#include "overlays/gamestates/ovl_file_choose/z_file_select.h"
#define FS_BTN_CONFIRM_REWIND 2
INCBIN(rewind_button_texture, "rewind.ia16.bin");
extern u64 gFileSelFileNameBoxTex[];
extern u64 gFileSelConnectorTex[];
extern u64 gFileSelBlankButtonTex[];
extern u64 gFileSelBigButtonHighlightTex[];
extern u64 gFileSelFileInfoBox0Tex[];
extern u64 gFileSelFileInfoBox1Tex[];
extern u64 gFileSelFileInfoBox2Tex[];
extern u64 gFileSelFileInfoBox3Tex[];
extern u64 gFileSelFileInfoBox4Tex[];
extern u64 gFileSelFileExtraInfoBox0Tex[];
extern u64 gFileSelFileExtraInfoBox1Tex[];
extern u64 gFileSelOptionsButtonENGTex[];
extern u64 gFileSelPleaseSelectAFileENGTex[];
extern u64 gFileSelOpenThisFileENGTex[];
extern u64 gFileSelCopyWhichFileENGTex[];
extern u64 gFileSelCopyToWhichFileENGTex[];
extern u64 gFileSelAreYouSureCopyENGTex[];
extern u64 gFileSelFileCopiedENGTex[];
extern u64 gFileSelEraseWhichFileENGTex[];
extern u64 gFileSelAreYouSureEraseENGTex[];
extern u64 gFileSelFileErasedENGTex[];
extern u64 gFileSelNoFileToCopyENGTex[];
extern u64 gFileSelNoFileToEraseENGTex[];
extern u64 gFileSelNoEmptyFileENGTex[];
extern u64 gFileSelFileEmptyENGTex[];
extern u64 gFileSelFileInUseENGTex[];
extern u64 gFileSelFile1ButtonENGTex[];
extern u64 gFileSelFile2ButtonENGTex[];
extern u64 gFileSelFile3ButtonENGTex[];
extern u64 gFileSelCopyButtonENGTex[];
extern u64 gFileSelEraseButtonENGTex[];
extern u64 gFileSelYesButtonENGTex[];
extern u64 gFileSelQuitButtonENGTex[];
// TODO extern these when the recompiler handles relocations automatically.
s16 D_80814280[] = {
2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 0, 1, 1, 2, 1, 1, 4, 2, 2, 2, 1, 1, 0, 2, 0, 1, 1, 1, 1, 1, 0,
1, 1, 1, 2, 2, 2, 2, 2, 3, 2, 2, 4, 3, 2, 4, 1, 2, 2, 1, 1, 2, 2, 3, 2, 2, 0, 2, 2, 2, 0, 3, 1, 0,
};
s16 sWindowContentColors[] = { 100, 150, 255 };
TexturePtr sFileInfoBoxTextures[] = {
gFileSelFileInfoBox0Tex, gFileSelFileInfoBox1Tex, gFileSelFileInfoBox2Tex, gFileSelFileInfoBox3Tex,
gFileSelFileInfoBox4Tex, gFileSelFileExtraInfoBox0Tex, gFileSelFileExtraInfoBox1Tex,
};
TexturePtr sTitleLabels[] = {
gFileSelPleaseSelectAFileENGTex, gFileSelOpenThisFileENGTex, gFileSelCopyWhichFileENGTex,
gFileSelCopyToWhichFileENGTex, gFileSelAreYouSureCopyENGTex, gFileSelFileCopiedENGTex,
gFileSelEraseWhichFileENGTex, gFileSelAreYouSureEraseENGTex, gFileSelFileErasedENGTex,
};
TexturePtr sWarningLabels[] = {
gFileSelNoFileToCopyENGTex, gFileSelNoFileToEraseENGTex, gFileSelNoEmptyFileENGTex,
gFileSelFileEmptyENGTex, gFileSelFileInUseENGTex,
};
TexturePtr sFileButtonTextures[] = {
gFileSelFile1ButtonENGTex,
gFileSelFile2ButtonENGTex,
gFileSelFile3ButtonENGTex,
};
TexturePtr sActionButtonTextures[] = {
gFileSelCopyButtonENGTex,
gFileSelEraseButtonENGTex,
gFileSelYesButtonENGTex,
gFileSelQuitButtonENGTex,
};
s16 sFileInfoBoxPartWidths[] = {
36, 36, 36, 36, 24, 28, 28,
};
s16 sWalletFirstDigit[] = {
1, // tens (Default Wallet)
0, // hundreds (Adult Wallet)
0, // hundreds (Giant Wallet)
};
s16 D_80814620[] = { 8, 8, 8, 0 };
s16 D_80814628[] = { 12, 12, 12, 0 };
s16 D_80814630[] = { 12, 12, 12, 0 };
s16 D_80814638[] = {
88, 104, 120, 940, 944, 948,
};
s16 D_80814644[] = { 88, 104, 120, 944 };
s16 D_8081464C[] = { 940, 944 };
s16 D_80814650[] = { 940, 944, 948 };
void FileSelect_Main(GameState* thisx);
void FileSelect_InitContext(GameState* thisx);
void FileSelect_DrawFileInfo(GameState *thisx, s16 fileIndex);
void FileSelect_SplitNumber(u16 value, u16 *hundreds, u16 *tens, u16 *ones);
// @recomp The options button is now the quit button, so close recomp instead of opening the options.
void FileSelect_RotateToOptions(GameState* thisx) {
recomp_exit();
}
void FileSelect_Init(GameState* thisx) {
s32 pad;
FileSelectState* this = (FileSelectState*)thisx;
size_t size;
GameState_SetFramerateDivisor(&this->state, 1);
Matrix_Init(&this->state);
ShrinkWindow_Init();
View_Init(&this->view, this->state.gfxCtx);
// @recomp manually relocate these symbols as the recompiler doesn't do this automatically for patches yet.
GameStateOverlay* ovl = &gGameStateOverlayTable[GAMESTATE_FILE_SELECT];
this->state.main = (void*)((u32)FileSelect_Main - (u32)ovl->vramStart + (u32)ovl->loadedRamAddr);
this->state.destroy = (void*)((u32)FileSelect_Destroy - (u32)ovl->vramStart + (u32)ovl->loadedRamAddr);
FileSelect_InitContext(&this->state);
Font_LoadOrderedFont(&this->font);
size = SEGMENT_ROM_SIZE(title_static);
this->staticSegment = THA_AllocTailAlign16(&this->state.tha, size);
DmaMgr_SendRequest0(this->staticSegment, SEGMENT_ROM_START(title_static), size);
size = SEGMENT_ROM_SIZE(parameter_static);
this->parameterSegment = THA_AllocTailAlign16(&this->state.tha, size);
DmaMgr_SendRequest0(this->parameterSegment, SEGMENT_ROM_START(parameter_static), size);
size = gObjectTable[OBJECT_MAG].vromEnd - gObjectTable[OBJECT_MAG].vromStart;
this->titleSegment = THA_AllocTailAlign16(&this->state.tha, size);
DmaMgr_SendRequest0(this->titleSegment, gObjectTable[OBJECT_MAG].vromStart, size);
Audio_SetSpec(0xA);
// Setting ioData to 1 and writing it to ioPort 7 will skip the harp intro
Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_MAIN, NA_BGM_FILE_SELECT, 0, 7, 1);
// @recomp Replace the contents of the options button's texture with the quit button texture.
// Lower impact than replacing the entire `FileSelect_DrawWindowContents` function.
void* options_button_texture = (void*)(this->staticSegment + (u32)gFileSelOptionsButtonENGTex - 0x01000000);
void* quit_button_texture = (void*)(this->staticSegment + (u32)gFileSelQuitButtonENGTex - 0x01000000);
Lib_MemCpy(options_button_texture, quit_button_texture, 64 * 16 * sizeof(u16));
}
void FileSelect_SetWindowContentVtx(GameState *thisx) {
FileSelectState *this = (FileSelectState *)thisx;
u16 vtxId;
s16 j;
s16 i;
s16 spAC;
u16 spA4[3];
u16 *ptr;
s32 posY;
s32 relPosY;
s32 tempPosY;
s32 posX;
s32 index;
this->windowContentVtx = GRAPH_ALLOC(this->state.gfxCtx, 960 * sizeof(Vtx));
// Initialize all windowContentVtx
for (vtxId = 0; vtxId < 960; vtxId += 4) {
// x-coord (left)
this->windowContentVtx[vtxId + 0].v.ob[0] = this->windowContentVtx[vtxId + 2].v.ob[0] = 0x12C;
// x-coord (right)
this->windowContentVtx[vtxId + 1].v.ob[0] = this->windowContentVtx[vtxId + 3].v.ob[0] =
this->windowContentVtx[vtxId + 0].v.ob[0] + 16;
// y-coord (top)
this->windowContentVtx[vtxId + 0].v.ob[1] = this->windowContentVtx[vtxId + 1].v.ob[1] = 0;
// y-coord (bottom)
this->windowContentVtx[vtxId + 2].v.ob[1] = this->windowContentVtx[vtxId + 3].v.ob[1] =
this->windowContentVtx[vtxId + 0].v.ob[1] - 16;
// z-coordinate
this->windowContentVtx[vtxId + 0].v.ob[2] = this->windowContentVtx[vtxId + 1].v.ob[2] =
this->windowContentVtx[vtxId + 2].v.ob[2] = this->windowContentVtx[vtxId + 3].v.ob[2] = 0;
// flag
this->windowContentVtx[vtxId + 0].v.flag = this->windowContentVtx[vtxId + 1].v.flag =
this->windowContentVtx[vtxId + 2].v.flag = this->windowContentVtx[vtxId + 3].v.flag = 0;
// texture coordinates
this->windowContentVtx[vtxId + 0].v.tc[0] = this->windowContentVtx[vtxId + 0].v.tc[1] =
this->windowContentVtx[vtxId + 1].v.tc[1] = this->windowContentVtx[vtxId + 2].v.tc[0] = 0;
this->windowContentVtx[vtxId + 1].v.tc[0] = this->windowContentVtx[vtxId + 2].v.tc[1] =
this->windowContentVtx[vtxId + 3].v.tc[0] = this->windowContentVtx[vtxId + 3].v.tc[1] = 0x200;
// alpha
this->windowContentVtx[vtxId + 0].v.cn[0] = this->windowContentVtx[vtxId + 1].v.cn[0] =
this->windowContentVtx[vtxId + 2].v.cn[0] = this->windowContentVtx[vtxId + 3].v.cn[0] =
this->windowContentVtx[vtxId + 0].v.cn[1] = this->windowContentVtx[vtxId + 1].v.cn[1] =
this->windowContentVtx[vtxId + 2].v.cn[1] = this->windowContentVtx[vtxId + 3].v.cn[1] =
this->windowContentVtx[vtxId + 0].v.cn[2] = this->windowContentVtx[vtxId + 1].v.cn[2] =
this->windowContentVtx[vtxId + 2].v.cn[2] = this->windowContentVtx[vtxId + 3].v.cn[2] =
this->windowContentVtx[vtxId + 0].v.cn[3] = this->windowContentVtx[vtxId + 1].v.cn[3] =
this->windowContentVtx[vtxId + 2].v.cn[3] =
this->windowContentVtx[vtxId + 3].v.cn[3] = 255;
}
/** Title Label **/
// x-coord (left)
this->windowContentVtx[0].v.ob[0] = this->windowContentVtx[2].v.ob[0] = this->windowPosX;
// x-coord (right)
this->windowContentVtx[1].v.ob[0] = this->windowContentVtx[3].v.ob[0] = this->windowContentVtx[0].v.ob[0] + 0x80;
// y-coord (top)
this->windowContentVtx[0].v.ob[1] = this->windowContentVtx[1].v.ob[1] = 0x48;
// y-coord (bottom)
this->windowContentVtx[2].v.ob[1] = this->windowContentVtx[3].v.ob[1] = this->windowContentVtx[0].v.ob[1] - 0x10;
// texture coordinates
this->windowContentVtx[1].v.tc[0] = this->windowContentVtx[3].v.tc[0] = 0x1000;
/** File InfoBox **/
// Loop through 3 files
for (vtxId = 4, i = 0; i < 3; i++) {
posX = this->windowPosX - 6;
// Loop through 7 textures
for (j = 0; j < 7; j++, vtxId += 4) {
// x-coord (left)
this->windowContentVtx[vtxId + 0].v.ob[0] = this->windowContentVtx[vtxId + 2].v.ob[0] = posX;
// x-coord (right)
this->windowContentVtx[vtxId + 1].v.ob[0] = this->windowContentVtx[vtxId + 3].v.ob[0] =
this->windowContentVtx[vtxId + 0].v.ob[0] + sFileInfoBoxPartWidths[j];
// y-coord(top)
this->windowContentVtx[vtxId + 0].v.ob[1] = this->windowContentVtx[vtxId + 1].v.ob[1] =
this->fileNamesY[i] + 0x2C;
// y-coord (bottom)
this->windowContentVtx[vtxId + 2].v.ob[1] = this->windowContentVtx[vtxId + 3].v.ob[1] =
this->windowContentVtx[vtxId + 0].v.ob[1] - 0x38;
// texture coordinates
this->windowContentVtx[vtxId + 1].v.tc[0] = this->windowContentVtx[vtxId + 3].v.tc[0] =
sFileInfoBoxPartWidths[j] << 5;
this->windowContentVtx[vtxId + 2].v.tc[1] = this->windowContentVtx[vtxId + 3].v.tc[1] = 0x700;
// Update X position
posX += sFileInfoBoxPartWidths[j];
}
}
// File Buttons
posX = this->windowPosX - 6;
posY = 44;
// Loop through 3 files
for (j = 0; j < 3; j++, vtxId += 16, posY -= 0x10) {
/* File Button */
// x-coord (left)
this->windowContentVtx[vtxId + 0].v.ob[0] = this->windowContentVtx[vtxId + 2].v.ob[0] = posX;
// x-coord (right)
this->windowContentVtx[vtxId + 1].v.ob[0] = this->windowContentVtx[vtxId + 3].v.ob[0] =
this->windowContentVtx[vtxId + 0].v.ob[0] + 0x40;
// y-coord(top)
this->windowContentVtx[vtxId + 0].v.ob[1] = this->windowContentVtx[vtxId + 1].v.ob[1] =
this->buttonYOffsets[j] + posY;
// y-coord (bottom)
this->windowContentVtx[vtxId + 2].v.ob[1] = this->windowContentVtx[vtxId + 3].v.ob[1] =
this->windowContentVtx[vtxId + 0].v.ob[1] - 0x10;
// texture coordinates
this->windowContentVtx[vtxId + 1].v.tc[0] = this->windowContentVtx[vtxId + 3].v.tc[0] = 0x800;
/* File Name Box */
// x-coord (left)
this->windowContentVtx[vtxId + 4].v.ob[0] = this->windowContentVtx[vtxId + 6].v.ob[0] = posX + 0x40;
// x-coord (right)
this->windowContentVtx[vtxId + 5].v.ob[0] = this->windowContentVtx[vtxId + 7].v.ob[0] =
this->windowContentVtx[vtxId + 4].v.ob[0] + 0x6C;
// y-coord(top)
this->windowContentVtx[vtxId + 4].v.ob[1] = this->windowContentVtx[vtxId + 5].v.ob[1] =
this->buttonYOffsets[j] + posY;
// y-coord (bottom)
this->windowContentVtx[vtxId + 6].v.ob[1] = this->windowContentVtx[vtxId + 7].v.ob[1] =
this->windowContentVtx[vtxId + 4].v.ob[1] - 0x10;
// texture coordinates
this->windowContentVtx[vtxId + 5].v.tc[0] = this->windowContentVtx[vtxId + 7].v.tc[0] = 0xD80;
/* Connectors */
// x-coord (left)
this->windowContentVtx[vtxId + 8].v.ob[0] = this->windowContentVtx[vtxId + 10].v.ob[0] = posX + 0x34;
// x-coord (right)
this->windowContentVtx[vtxId + 9].v.ob[0] = this->windowContentVtx[vtxId + 11].v.ob[0] =
this->windowContentVtx[vtxId + 8].v.ob[0] + 0x18;
// y-coord(top)
this->windowContentVtx[vtxId + 8].v.ob[1] = this->windowContentVtx[vtxId + 9].v.ob[1] =
this->buttonYOffsets[j] + posY;
// y-coord (bottom)
this->windowContentVtx[vtxId + 10].v.ob[1] = this->windowContentVtx[vtxId + 11].v.ob[1] =
this->windowContentVtx[vtxId + 8].v.ob[1] - 0x10;
// texture coordinates
this->windowContentVtx[vtxId + 9].v.tc[0] = this->windowContentVtx[vtxId + 11].v.tc[0] = 0x300;
/* Blank Button (Owl Save) */
// x-coord (left)
this->windowContentVtx[vtxId + 12].v.ob[0] = this->windowContentVtx[vtxId + 14].v.ob[0] = posX + 0xA9;
// x-coord (right)
this->windowContentVtx[vtxId + 13].v.ob[0] = this->windowContentVtx[vtxId + 15].v.ob[0] =
this->windowContentVtx[vtxId + 12].v.ob[0] + 0x34;
// y-coord(top)
this->windowContentVtx[vtxId + 12].v.ob[1] = this->windowContentVtx[vtxId + 13].v.ob[1] =
this->buttonYOffsets[j] + posY;
// y-coord (bottom)
this->windowContentVtx[vtxId + 14].v.ob[1] = this->windowContentVtx[vtxId + 15].v.ob[1] =
this->windowContentVtx[vtxId + 12].v.ob[1] - 0x10;
// texture coordinates
this->windowContentVtx[vtxId + 13].v.tc[0] = this->windowContentVtx[vtxId + 15].v.tc[0] = 0x680;
}
posY = 44;
// Loop through 3 files
for (j = 0; j < 3; j++, posY -= 16) {
if (!gSaveContext.flashSaveAvailable) {
// Should skip vtxId
// vtxId += 268;
continue;
}
// Account for owl-save offset
spAC = j;
if (this->isOwlSave[j + 2]) {
spAC = j + 2;
}
/* File name */
posX = this->windowPosX - 6;
if ((this->configMode == 0x10) && (j == this->copyDestFileIndex)) {
relPosY = this->fileNamesY[j] + 0x2C;
}
else if (((this->configMode == 0x11) || (this->configMode == 0x12)) && (j == this->copyDestFileIndex)) {
relPosY = this->buttonYOffsets[j] + posY;
}
else {
relPosY = posY + this->buttonYOffsets[j] + this->fileNamesY[j];
}
tempPosY = relPosY - 2;
// Loop through 8 characters of file name
for (i = 0; i < 8; i++, vtxId += 4) {
index = this->fileNames[j][i];
/* File Name */
// x-coord (left)
this->windowContentVtx[vtxId + 0].v.ob[0] = this->windowContentVtx[vtxId + 2].v.ob[0] =
D_80814280[index] + posX + 0x4E;
// x-coord (right)
this->windowContentVtx[vtxId + 1].v.ob[0] = this->windowContentVtx[vtxId + 3].v.ob[0] =
this->windowContentVtx[vtxId + 0].v.ob[0] + 0xB;
// y-coord(top)
this->windowContentVtx[vtxId + 0].v.ob[1] = this->windowContentVtx[vtxId + 1].v.ob[1] = tempPosY;
// y-coord (bottom)
this->windowContentVtx[vtxId + 2].v.ob[1] = this->windowContentVtx[vtxId + 3].v.ob[1] =
this->windowContentVtx[vtxId + 0].v.ob[1] - 0xC;
/* File Name Shadow */
// x-coord (left)
this->windowContentVtx[vtxId + 32].v.ob[0] = this->windowContentVtx[vtxId + 34].v.ob[0] =
D_80814280[index] + posX + 0x4F;
// x-coord (right)
this->windowContentVtx[vtxId + 33].v.ob[0] = this->windowContentVtx[vtxId + 35].v.ob[0] =
this->windowContentVtx[vtxId + 32].v.ob[0] + 0xB;
// y-coord(top)
this->windowContentVtx[vtxId + 32].v.ob[1] = this->windowContentVtx[vtxId + 33].v.ob[1] = tempPosY - 1;
// y-coord (bottom)
this->windowContentVtx[vtxId + 34].v.ob[1] = this->windowContentVtx[vtxId + 35].v.ob[1] =
this->windowContentVtx[vtxId + 32].v.ob[1] - 0xC;
// Update X position
posX += 10;
}
// Account for the shadow
vtxId += 32;
/* Rupee Digits */
posX = this->windowPosX + 14;
tempPosY = relPosY - 0x18;
FileSelect_SplitNumber(this->rupees[spAC], &spA4[0], &spA4[1], &spA4[2]);
index = sWalletFirstDigit[this->walletUpgrades[spAC]];
ptr = &spA4[index];
for (i = 0; i < 3; i++, vtxId += 4, ptr++) {
/* Rupee Digits */
// x-coord (left)
this->windowContentVtx[vtxId + 0].v.ob[0] = this->windowContentVtx[vtxId + 2].v.ob[0] =
D_80814280[*ptr] + posX;
// x-coord (right)
this->windowContentVtx[vtxId + 1].v.ob[0] = this->windowContentVtx[vtxId + 3].v.ob[0] =
this->windowContentVtx[vtxId + 0].v.ob[0] + D_80814628[i];
// y-coord(top)
this->windowContentVtx[vtxId + 0].v.ob[1] = this->windowContentVtx[vtxId + 1].v.ob[1] = tempPosY;
// y-coord (bottom)
this->windowContentVtx[vtxId + 2].v.ob[1] = this->windowContentVtx[vtxId + 3].v.ob[1] =
this->windowContentVtx[vtxId + 0].v.ob[1] - D_80814630[i];
/* Rupee Digits Shadow */
// x-coord (left)
this->windowContentVtx[vtxId + 12].v.ob[0] = this->windowContentVtx[vtxId + 14].v.ob[0] =
this->windowContentVtx[vtxId + 0].v.ob[0] + 1;
// x-coord (right)
this->windowContentVtx[vtxId + 13].v.ob[0] = this->windowContentVtx[vtxId + 15].v.ob[0] =
this->windowContentVtx[vtxId + 12].v.ob[0] + D_80814628[i];
// y-coord(top)
this->windowContentVtx[vtxId + 12].v.ob[1] = this->windowContentVtx[vtxId + 13].v.ob[1] = tempPosY - 1;
// y-coord (bottom)
this->windowContentVtx[vtxId + 14].v.ob[1] = this->windowContentVtx[vtxId + 15].v.ob[1] =
this->windowContentVtx[vtxId + 12].v.ob[1] - D_80814630[i];
// Update X position
posX += D_80814620[i];
}
// Account for the shadow
vtxId += 12;
/* Mask Count */
posX = this->windowPosX + 42;
tempPosY = relPosY - 0x2A;
FileSelect_SplitNumber(this->maskCount[spAC], &spA4[0], &spA4[1], &spA4[2]);
for (i = 1; i < 3; i++, vtxId += 4) {
/* Mask Count */
// x-coord (left)
this->windowContentVtx[vtxId + 0].v.ob[0] = this->windowContentVtx[vtxId + 2].v.ob[0] =
D_80814280[spA4[i]] + posX;
// x-coord (right)
this->windowContentVtx[vtxId + 1].v.ob[0] = this->windowContentVtx[vtxId + 3].v.ob[0] =
this->windowContentVtx[vtxId + 0].v.ob[0] + D_80814628[i];
// y-coord(top)
this->windowContentVtx[vtxId + 0].v.ob[1] = this->windowContentVtx[vtxId + 1].v.ob[1] = tempPosY;
// y-coord (bottom)
this->windowContentVtx[vtxId + 2].v.ob[1] = this->windowContentVtx[vtxId + 3].v.ob[1] =
this->windowContentVtx[vtxId + 0].v.ob[1] - D_80814630[i];
/* Mask Count Shadow */
// x-coord (left)
this->windowContentVtx[vtxId + 8].v.ob[0] = this->windowContentVtx[vtxId + 10].v.ob[0] =
this->windowContentVtx[vtxId + 0].v.ob[0] + 1;
// x-coord (right)
this->windowContentVtx[vtxId + 9].v.ob[0] = this->windowContentVtx[vtxId + 11].v.ob[0] =
this->windowContentVtx[vtxId + 8].v.ob[0] + D_80814628[i];
// y-coord(top)
this->windowContentVtx[vtxId + 8].v.ob[1] = this->windowContentVtx[vtxId + 9].v.ob[1] = tempPosY - 1;
// y-coord (bottom)
this->windowContentVtx[vtxId + 10].v.ob[1] = this->windowContentVtx[vtxId + 11].v.ob[1] =
this->windowContentVtx[vtxId + 8].v.ob[1] - D_80814630[i];
// Update X position
posX += D_80814620[i];
}
// Account for the shadow
vtxId += 8;
/* Hearts */
posX = this->windowPosX + 63;
tempPosY = relPosY - 0x10;
// Loop through 20 hearts
for (i = 0; i < 20; i++, vtxId += 4, posX += 9) {
// x-coord (left)
this->windowContentVtx[vtxId + 0].v.ob[0] = this->windowContentVtx[vtxId + 2].v.ob[0] = posX;
// x-coord (right)
this->windowContentVtx[vtxId + 1].v.ob[0] = this->windowContentVtx[vtxId + 3].v.ob[0] =
this->windowContentVtx[vtxId + 0].v.ob[0] + 0xA;
// y-coord(top)
this->windowContentVtx[vtxId + 0].v.ob[1] = this->windowContentVtx[vtxId + 1].v.ob[1] = tempPosY;
// y-coord (bottom)
this->windowContentVtx[vtxId + 2].v.ob[1] = this->windowContentVtx[vtxId + 3].v.ob[1] =
this->windowContentVtx[vtxId + 0].v.ob[1] - 0xA;
// New row of hearts next iteration
if (i == 9) {
posX = this->windowPosX + (63 - 9);
tempPosY -= 8;
}
}
/* Quest Remains */
posX = this->windowPosX + 64;
tempPosY = relPosY - 0x20;
// Loop through 4 Remains
for (i = 0; i < 4; i++, vtxId += 4, posX += 0x18) {
// x-coord (left)
this->windowContentVtx[vtxId + 0].v.ob[0] = this->windowContentVtx[vtxId + 2].v.ob[0] = posX;
// x-coord (right)
this->windowContentVtx[vtxId + 1].v.ob[0] = this->windowContentVtx[vtxId + 3].v.ob[0] =
this->windowContentVtx[vtxId + 0].v.ob[0] + 0x14;
// y-coord(top)
this->windowContentVtx[vtxId + 0].v.ob[1] = this->windowContentVtx[vtxId + 1].v.ob[1] = tempPosY;
// y-coord (bottom)
this->windowContentVtx[vtxId + 2].v.ob[1] = this->windowContentVtx[vtxId + 3].v.ob[1] =
this->windowContentVtx[vtxId + 0].v.ob[1] - 0x14;
// texture coordinates
this->windowContentVtx[vtxId + 1].v.tc[0] = this->windowContentVtx[vtxId + 2].v.tc[1] =
this->windowContentVtx[vtxId + 3].v.tc[0] = this->windowContentVtx[vtxId + 3].v.tc[1] = 0x400;
}
/* Rupee Icon */
// posX = this->windowPosX - 1;
tempPosY = relPosY - 0x15;
// x-coord (left)
this->windowContentVtx[vtxId + 0].v.ob[0] = this->windowContentVtx[vtxId + 2].v.ob[0] = this->windowPosX - 1;
// x-coord (right)
this->windowContentVtx[vtxId + 1].v.ob[0] = this->windowContentVtx[vtxId + 3].v.ob[0] =
this->windowContentVtx[vtxId + 0].v.ob[0] + 0x10;
// y-coord(top)
this->windowContentVtx[vtxId + 0].v.ob[1] = this->windowContentVtx[vtxId + 1].v.ob[1] = tempPosY;
// y-coord (bottom)
this->windowContentVtx[vtxId + 2].v.ob[1] = this->windowContentVtx[vtxId + 3].v.ob[1] =
this->windowContentVtx[vtxId + 0].v.ob[1] - 0x10;
// texture coordinates
this->windowContentVtx[vtxId + 1].v.tc[0] = this->windowContentVtx[vtxId + 3].v.tc[0] = 0x200;
this->windowContentVtx[vtxId + 2].v.tc[1] = this->windowContentVtx[vtxId + 3].v.tc[1] = 0x200;
vtxId += 4;
/* Heart Piece Count */
// posX = this->windowPosX + 0x27;
tempPosY = relPosY - 0x15;
// x-coord (left)
this->windowContentVtx[vtxId + 0].v.ob[0] = this->windowContentVtx[vtxId + 2].v.ob[0] = this->windowPosX + 0x27;
// x-coord (right)
this->windowContentVtx[vtxId + 1].v.ob[0] = this->windowContentVtx[vtxId + 3].v.ob[0] =
this->windowContentVtx[vtxId + 0].v.ob[0] + 0x18;
// y-coord(top)
this->windowContentVtx[vtxId + 0].v.ob[1] = this->windowContentVtx[vtxId + 1].v.ob[1] = tempPosY;
// y-coord (bottom)
this->windowContentVtx[vtxId + 2].v.ob[1] = this->windowContentVtx[vtxId + 3].v.ob[1] =
this->windowContentVtx[vtxId + 0].v.ob[1] - 0x10;
// texture coordinates
this->windowContentVtx[vtxId + 1].v.tc[0] = this->windowContentVtx[vtxId + 3].v.tc[0] = 0x300;
this->windowContentVtx[vtxId + 2].v.tc[1] = this->windowContentVtx[vtxId + 3].v.tc[1] = 0x200;
vtxId += 4;
/* Mask Text */
// posX = this->windowPosX - 10;
tempPosY = relPosY - 0x27;
this->windowContentVtx[vtxId + 0].v.ob[0] = this->windowContentVtx[vtxId + 2].v.ob[0] = this->windowPosX - 10;
this->windowContentVtx[vtxId + 1].v.ob[0] = this->windowContentVtx[vtxId + 3].v.ob[0] =
this->windowContentVtx[vtxId + 0].v.ob[0] + 0x40;
this->windowContentVtx[vtxId + 0].v.ob[1] = this->windowContentVtx[vtxId + 1].v.ob[1] = tempPosY;
this->windowContentVtx[vtxId + 2].v.ob[1] = this->windowContentVtx[vtxId + 3].v.ob[1] =
this->windowContentVtx[vtxId + 0].v.ob[1] - 0x10;
this->windowContentVtx[vtxId + 1].v.tc[0] = this->windowContentVtx[vtxId + 3].v.tc[0] = 0x800;
this->windowContentVtx[vtxId + 2].v.tc[1] = this->windowContentVtx[vtxId + 3].v.tc[1] = 0x200;
this->windowContentVtx[vtxId + 4].v.ob[0] = this->windowContentVtx[vtxId + 6].v.ob[0] =
this->windowContentVtx[vtxId + 0].v.ob[0] + 1;
this->windowContentVtx[vtxId + 5].v.ob[0] = this->windowContentVtx[vtxId + 7].v.ob[0] =
this->windowContentVtx[vtxId + 4].v.ob[0] + 0x40;
this->windowContentVtx[vtxId + 4].v.ob[1] = this->windowContentVtx[vtxId + 5].v.ob[1] = tempPosY - 1;
this->windowContentVtx[vtxId + 6].v.ob[1] = this->windowContentVtx[vtxId + 7].v.ob[1] =
this->windowContentVtx[vtxId + 4].v.ob[1] - 0x10;
this->windowContentVtx[vtxId + 5].v.tc[0] = this->windowContentVtx[vtxId + 7].v.tc[0] = 0x800;
this->windowContentVtx[vtxId + 6].v.tc[1] = this->windowContentVtx[vtxId + 7].v.tc[1] = 0x200;
vtxId += 8;
/* Owl Save Icon */
posX = this->windowPosX + 0xA3;
if ((this->configMode == 0x10) && (j == this->copyDestFileIndex)) {
tempPosY = this->fileNamesY[j] + 0x2C;
}
else if (((this->configMode == 0x11) || (this->configMode == 0x12)) && (j == this->copyDestFileIndex)) {
tempPosY = this->buttonYOffsets[j] + posY;
}
else {
tempPosY = posY + this->buttonYOffsets[j] + this->fileNamesY[j];
}
this->windowContentVtx[vtxId + 0].v.ob[0] = this->windowContentVtx[vtxId + 2].v.ob[0] = posX + 0xE;
this->windowContentVtx[vtxId + 1].v.ob[0] = this->windowContentVtx[vtxId + 3].v.ob[0] =
this->windowContentVtx[vtxId + 0].v.ob[0] + 0x18;
this->windowContentVtx[vtxId + 0].v.ob[1] = this->windowContentVtx[vtxId + 1].v.ob[1] = tempPosY - 2;
this->windowContentVtx[vtxId + 2].v.ob[1] = this->windowContentVtx[vtxId + 3].v.ob[1] =
this->windowContentVtx[vtxId + 0].v.ob[1] - 0xC;
this->windowContentVtx[vtxId + 1].v.tc[0] = this->windowContentVtx[vtxId + 3].v.tc[0] = 0x300;
this->windowContentVtx[vtxId + 2].v.tc[1] = this->windowContentVtx[vtxId + 3].v.tc[1] = 0x180;
vtxId += 4;
/* Day Text */
for (i = 0; i < 2; i++, vtxId += 4) {
this->windowContentVtx[vtxId + 0].v.ob[0] = this->windowContentVtx[vtxId + 2].v.ob[0] = 2 + posX + i;
this->windowContentVtx[vtxId + 1].v.ob[0] = this->windowContentVtx[vtxId + 3].v.ob[0] =
this->windowContentVtx[vtxId + 0].v.ob[0] + 0x30;
this->windowContentVtx[vtxId + 0].v.ob[1] = this->windowContentVtx[vtxId + 1].v.ob[1] = tempPosY - i - 0x12;
this->windowContentVtx[vtxId + 2].v.ob[1] = this->windowContentVtx[vtxId + 3].v.ob[1] =
this->windowContentVtx[vtxId + 0].v.ob[1] - 0x18;
this->windowContentVtx[vtxId + 1].v.tc[0] = this->windowContentVtx[vtxId + 3].v.tc[0] = 0x600;
this->windowContentVtx[vtxId + 2].v.tc[1] = this->windowContentVtx[vtxId + 3].v.tc[1] = 0x300;
}
/* Time Digits */
posX += 6;
index = vtxId;
for (i = 0; i < 5; i++, vtxId += 4, posX += 8) {
this->windowContentVtx[vtxId + 0].v.ob[0] = this->windowContentVtx[vtxId + 2].v.ob[0] = posX;
this->windowContentVtx[vtxId + 1].v.ob[0] = this->windowContentVtx[vtxId + 3].v.ob[0] =
this->windowContentVtx[vtxId + 0].v.ob[0] + 0xC;
this->windowContentVtx[vtxId + 0].v.ob[1] = this->windowContentVtx[vtxId + 1].v.ob[1] = tempPosY - 0x2A;
this->windowContentVtx[vtxId + 2].v.ob[1] = this->windowContentVtx[vtxId + 3].v.ob[1] =
this->windowContentVtx[vtxId + 0].v.ob[1] - 0xC;
this->windowContentVtx[vtxId + 0x14].v.ob[0] = this->windowContentVtx[vtxId + 0x16].v.ob[0] = posX + 1;
this->windowContentVtx[vtxId + 0x15].v.ob[0] = this->windowContentVtx[vtxId + 0x17].v.ob[0] =
this->windowContentVtx[vtxId + 0x14].v.ob[0] + 0xC;
this->windowContentVtx[vtxId + 0x14].v.ob[1] = this->windowContentVtx[vtxId + 0x15].v.ob[1] =
tempPosY - 0x2B;
this->windowContentVtx[vtxId + 0x16].v.ob[1] = this->windowContentVtx[vtxId + 0x17].v.ob[1] =
this->windowContentVtx[vtxId + 0x14].v.ob[1] - 0xC;
}
// Adjust the colon to the right
this->windowContentVtx[index + 8].v.ob[0] = this->windowContentVtx[index + 10].v.ob[0] =
this->windowContentVtx[index + 8].v.ob[0] + 3;
this->windowContentVtx[index + 9].v.ob[0] = this->windowContentVtx[index + 11].v.ob[0] =
this->windowContentVtx[index + 8].v.ob[0] + 0xC;
this->windowContentVtx[index + 0x1C].v.ob[0] = this->windowContentVtx[index + 0x1E].v.ob[0] =
this->windowContentVtx[index + 8].v.ob[0] + 1;
this->windowContentVtx[index + 0x1D].v.ob[0] = this->windowContentVtx[index + 0x1F].v.ob[0] =
this->windowContentVtx[index + 0x1C].v.ob[0] + 0xC;
vtxId += 20;
}
posX = this->windowPosX - 6;
posY = -0xC;
// @recomp Check if the rewind button is visible based on whether there's an owl save for the current slot and what mode the file select is currently in.
bool rewind_visible = this->menuMode == FS_MENU_MODE_SELECT && this->isOwlSave[this->buttonIndex + 2] && (this->selectMode == SM_FADE_IN_FILE_INFO || this->selectMode == SM_CONFIRM_FILE || this->selectMode == SM_FADE_OUT_FILE_INFO || this->selectMode == SM_FADE_OUT);
for (j = 0; j < 2; j++, vtxId += 4, posY -= 0x10) {
this->windowContentVtx[vtxId + 0].v.ob[0] = this->windowContentVtx[vtxId + 2].v.ob[0] = posX;
this->windowContentVtx[vtxId + 1].v.ob[0] = this->windowContentVtx[vtxId + 3].v.ob[0] =
this->windowContentVtx[vtxId + 0].v.ob[0] + 0x40;
this->windowContentVtx[vtxId + 0].v.ob[1] = this->windowContentVtx[vtxId + 1].v.ob[1] =
this->buttonYOffsets[j + 3] + posY;
this->windowContentVtx[vtxId + 2].v.ob[1] = this->windowContentVtx[vtxId + 3].v.ob[1] =
this->windowContentVtx[vtxId + 0].v.ob[1] - 0x10;
this->windowContentVtx[vtxId + 1].v.tc[0] = this->windowContentVtx[vtxId + 3].v.tc[0] = 0x800;
// @recomp Move the Yes and Quit buttons up by one if the Rewind button is visible.
if (rewind_visible) {
this->windowContentVtx[vtxId + 0].v.ob[1] += 16;
this->windowContentVtx[vtxId + 1].v.ob[1] += 16;
this->windowContentVtx[vtxId + 2].v.ob[1] += 16;
this->windowContentVtx[vtxId + 3].v.ob[1] += 16;
}
}
this->windowContentVtx[vtxId + 0].v.ob[0] = this->windowContentVtx[vtxId + 2].v.ob[0] = posX;
this->windowContentVtx[vtxId + 1].v.ob[0] = this->windowContentVtx[vtxId + 3].v.ob[0] =
this->windowContentVtx[vtxId + 0].v.ob[0] + 0x40;
this->windowContentVtx[vtxId + 0].v.ob[1] = this->windowContentVtx[vtxId + 1].v.ob[1] =
this->buttonYOffsets[5] - 0x34;
this->windowContentVtx[vtxId + 2].v.ob[1] = this->windowContentVtx[vtxId + 3].v.ob[1] =
this->windowContentVtx[vtxId + 0].v.ob[1] - 0x10;
this->windowContentVtx[vtxId + 1].v.tc[0] = this->windowContentVtx[vtxId + 3].v.tc[0] = 0x800;
vtxId += 4;
if (((this->menuMode == FS_MENU_MODE_CONFIG) && (this->configMode >= 2)) ||
((this->menuMode == FS_MENU_MODE_SELECT) && (this->selectMode == 3))) {
if (this->menuMode == FS_MENU_MODE_CONFIG) {
if ((this->configMode == 4) || (this->configMode == 7) || (this->configMode == 0x16)) {
j = D_80814644[this->buttonIndex];
}
else if ((this->configMode == 0x19) || (this->configMode == 0xC)) {
j = D_8081464C[this->buttonIndex];
}
else {
j = D_80814638[this->buttonIndex];
}
}
else {
j = D_80814650[this->confirmButtonIndex];
}
this->windowContentVtx[vtxId + 0].v.ob[0] = this->windowContentVtx[vtxId + 2].v.ob[0] = this->windowPosX - 0xA;
this->windowContentVtx[vtxId + 1].v.ob[0] = this->windowContentVtx[vtxId + 3].v.ob[0] =
this->windowContentVtx[vtxId + 0].v.ob[0] + 0x48;
this->windowContentVtx[vtxId + 0].v.ob[1] = this->windowContentVtx[vtxId + 1].v.ob[1] =
this->windowContentVtx[j].v.ob[1] + 4;
this->windowContentVtx[vtxId + 2].v.ob[1] = this->windowContentVtx[vtxId + 3].v.ob[1] =
this->windowContentVtx[vtxId + 0].v.ob[1] - 0x18;
this->windowContentVtx[vtxId + 1].v.tc[0] = this->windowContentVtx[vtxId + 3].v.tc[0] = 0x900;
this->windowContentVtx[vtxId + 2].v.tc[1] = this->windowContentVtx[vtxId + 3].v.tc[1] = 0x300;
}
this->windowContentVtx[vtxId + 4].v.ob[0] = this->windowContentVtx[vtxId + 6].v.ob[0] = this->windowPosX + 0x3A;
this->windowContentVtx[vtxId + 5].v.ob[0] = this->windowContentVtx[vtxId + 7].v.ob[0] =
this->windowContentVtx[vtxId + 4].v.ob[0] + 0x80;
this->windowContentVtx[vtxId + 4].v.ob[1] = this->windowContentVtx[vtxId + 5].v.ob[1] =
this->windowContentVtx[D_80814638[this->warningButtonIndex]].v.ob[1];
this->windowContentVtx[vtxId + 6].v.ob[1] = this->windowContentVtx[vtxId + 7].v.ob[1] =
this->windowContentVtx[vtxId + 4].v.ob[1] - 0x10;
this->windowContentVtx[vtxId + 5].v.tc[0] = this->windowContentVtx[vtxId + 7].v.tc[0] = 0x1000;
// @recomp Copy the vertices for the Rewind button from the Yes button and move it down 2 buttons.
if (rewind_visible) {
for (u16 j = 0; j < 4; j++) {
this->windowContentVtx[vtxId + 4 + j] = this->windowContentVtx[0x3AC + j];
this->windowContentVtx[vtxId + 4 + j].v.ob[1] -= 32;
}
}
}
/**
* Draw most window contents including buttons, labels, and icons.
* Does not include anything from the keyboard and settings windows.
*/
void FileSelect_DrawWindowContents(GameState *thisx) {
FileSelectState *this = (FileSelectState *)thisx;
s16 fileIndex;
s16 temp;
s16 i;
s16 quadVtxIndex;
if (1) {}
OPEN_DISPS(this->state.gfxCtx);
// draw title label
gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE,
ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, this->titleAlpha[FS_TITLE_CUR]);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0);
gSPVertex(POLY_OPA_DISP++, &this->windowContentVtx[0], 4, 0);
gDPLoadTextureBlock(POLY_OPA_DISP++, sTitleLabels[this->titleLabel], G_IM_FMT_IA, G_IM_SIZ_8b, 128, 16, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0);
// draw next title label
gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, this->titleAlpha[FS_TITLE_NEXT]);
gDPLoadTextureBlock(POLY_OPA_DISP++, sTitleLabels[this->nextTitleLabel], G_IM_FMT_IA, G_IM_SIZ_8b, 128, 16, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0);
temp = 4;
gDPPipeSync(POLY_OPA_DISP++);
// @recomp Check if the Rewind button is currently selected to know whether to display the regular save instead of the owl save.
u8 hide_owl_save = (this->menuMode == FS_MENU_MODE_SELECT) && (this->confirmButtonIndex == FS_BTN_CONFIRM_REWIND);
// draw file info box (large box when a file is selected)
for (fileIndex = 0; fileIndex < 3; fileIndex++, temp += 28) {
if (fileIndex < 2) {
gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
this->fileInfoAlpha[fileIndex]);
gSPVertex(POLY_OPA_DISP++, &this->windowContentVtx[temp], 28, 0);
for (quadVtxIndex = 0, i = 0; i < 7; i++, quadVtxIndex += 4) {
// @recomp Don't draw the box on the right that displays owl save information if the Rewind button is selected.
if ((i < 5) || (this->isOwlSave[fileIndex + 2] && (i >= 5) && !hide_owl_save)) {
gDPLoadTextureBlock(POLY_OPA_DISP++, sFileInfoBoxTextures[i], G_IM_FMT_IA, G_IM_SIZ_16b,
sFileInfoBoxPartWidths[i], 56, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, quadVtxIndex, quadVtxIndex + 2, quadVtxIndex + 3, quadVtxIndex + 1,
0);
}
}
}
}
gDPPipeSync(POLY_OPA_DISP++);
for (i = 0; i < 3; i++, temp += 16) {
if (i < 2) {
// draw file button
gSPVertex(POLY_OPA_DISP++, &this->windowContentVtx[temp], 16, 0);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[0], sWindowContentColors[1],
sWindowContentColors[2], this->fileButtonAlpha[i]);
gDPLoadTextureBlock(POLY_OPA_DISP++, sFileButtonTextures[i], G_IM_FMT_IA, G_IM_SIZ_16b, 64, 16, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0);
// draw file name box
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[0], sWindowContentColors[1],
sWindowContentColors[2], this->nameBoxAlpha[i]);
gDPLoadTextureBlock(POLY_OPA_DISP++, gFileSelFileNameBoxTex, G_IM_FMT_IA, G_IM_SIZ_16b, 108, 16, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 4, 6, 7, 5, 0);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[0], sWindowContentColors[1],
sWindowContentColors[2], this->connectorAlpha[i]);
gDPLoadTextureBlock(POLY_OPA_DISP++, gFileSelConnectorTex, G_IM_FMT_IA, G_IM_SIZ_8b, 24, 16, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 8, 10, 11, 9, 0);
// @recomp Skip drawing the box to hold the owl save icon if the Rewind button is currently selected.
if (this->isOwlSave[i + 2] && !hide_owl_save) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[0], sWindowContentColors[1],
sWindowContentColors[2], this->nameBoxAlpha[i]);
gDPLoadTextureBlock(POLY_OPA_DISP++, gFileSelBlankButtonTex, G_IM_FMT_IA, G_IM_SIZ_16b, 52, 16, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 12, 14, 15, 13, 0);
}
}
}
// draw file info
for (fileIndex = 0; fileIndex < 2; fileIndex++) {
// @recomp Record the save's owl save status and clear it if the rewind button is currently selected.
u8 *this_owl_save = &this->isOwlSave[fileIndex + 2];
u8 owl_save_old = *this_owl_save;
if (hide_owl_save) {
*this_owl_save = false;
}
FileSelect_DrawFileInfo(&this->state, fileIndex);
// @recomp Reset the save's owl save status.
*this_owl_save = owl_save_old;
}
gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE,
ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0);
// @recomp Load an extra 4 vertices for the rewind button.
gSPVertex(POLY_OPA_DISP++, &this->windowContentVtx[0x3AC], 24, 0);
// draw primary action buttons (copy/erase)
for (quadVtxIndex = 0, i = 0; i < 2; i++, quadVtxIndex += 4) {
gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
this->actionButtonAlpha[i]);
gDPLoadTextureBlock(POLY_OPA_DISP++, sActionButtonTextures[i], G_IM_FMT_IA, G_IM_SIZ_16b, 64, 16, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, quadVtxIndex, quadVtxIndex + 2, quadVtxIndex + 3, quadVtxIndex + 1, 0);
}
gDPPipeSync(POLY_OPA_DISP++);
// draw confirm buttons (yes/quit)
for (quadVtxIndex = 0, i = FS_BTN_CONFIRM_YES; i <= FS_BTN_CONFIRM_QUIT; i++, quadVtxIndex += 4) {
temp = this->confirmButtonTexIndices[i];
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
this->confirmButtonAlpha[i]);
gDPLoadTextureBlock(POLY_OPA_DISP++, sActionButtonTextures[temp], G_IM_FMT_IA, G_IM_SIZ_16b, 64, 16, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, quadVtxIndex, quadVtxIndex + 2, quadVtxIndex + 3, quadVtxIndex + 1, 0);
}
// @recomp Draw the Rewind button.
if (this->menuMode == FS_MENU_MODE_SELECT && this->isOwlSave[this->buttonIndex + 2]) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
this->confirmButtonAlpha[FS_BTN_CONFIRM_YES]);
gDPLoadTextureBlock(POLY_OPA_DISP++, rewind_button_texture, G_IM_FMT_IA, G_IM_SIZ_16b, 64, 16, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 16, 18, 19, 17, 0);
}
// draw options button
gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
this->optionButtonAlpha);
gDPLoadTextureBlock(POLY_OPA_DISP++, gFileSelOptionsButtonENGTex, G_IM_FMT_IA, G_IM_SIZ_16b, 64, 16, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 8, 10, 11, 9, 0);
// draw highlight over currently selected button
if (((this->menuMode == FS_MENU_MODE_CONFIG) &&
((this->configMode == CM_MAIN_MENU) || (this->configMode == CM_SELECT_COPY_SOURCE) ||
(this->configMode == CM_SELECT_COPY_DEST) || (this->configMode == CM_COPY_CONFIRM) ||
(this->configMode == CM_ERASE_SELECT) || (this->configMode == CM_ERASE_CONFIRM))) ||