-
Notifications
You must be signed in to change notification settings - Fork 614
/
Copy pathz_file_choose.c
2350 lines (1965 loc) · 98 KB
/
z_file_choose.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 "file_select.h"
#include "terminal.h"
#include "versions.h"
#if OOT_PAL_N64
#include "assets/objects/object_mag/object_mag.h"
#endif
#include "assets/textures/title_static/title_static.h"
#include "assets/textures/parameter_static/parameter_static.h"
#if PLATFORM_N64
#include "n64dd.h"
#endif
#if OOT_PAL_N64
static s32 sInitialLanguageAlphaAsInt = 100;
static f32 sInitialLanguageAlphaStep = 8.0f;
static f32 sInitialLanguageAlpha = 100.0f;
static s16 sInitialLanguageStickAdjX;
static s16 sInitialLanguageStickXDir;
static s16 sInitialLanguageInputTimerX;
typedef struct InitialLanguageTextureInfo {
/* 0x00 */ void* texture;
/* 0x04 */ u16 width;
/* 0x06 */ u16 height;
/* 0x08 */ u32 x1;
/* 0x0C */ u32 y1;
/* 0x10 */ u32 x2;
/* 0x14 */ u32 y2;
} InitialLanguageTextureInfo; // size = 0x18
static InitialLanguageTextureInfo sInitialLanguageTextures[] = {
{ gFileSelInitialLanguageChoiceENGTex, 80, 32, 40, 70, 120, 102 },
{ gFileSelInitialLanguageChoiceGERTex, 80, 32, 120, 70, 200, 102 },
{ gFileSelInitialLanguageChoiceFRATex, 80, 32, 200, 70, 280, 102 },
};
typedef struct InitialLanguageCursorInfo {
/* 0x00 */ u32 x1;
/* 0x04 */ u32 y1;
/* 0x08 */ u32 x2;
/* 0x0C */ u32 y2;
} InitialLanguageCursorInfo; // size = 0x10
static InitialLanguageCursorInfo sInitialLanguageCursors[] = {
{ 48, 52, 120, 124 },
{ 128, 52, 200, 124 },
{ 208, 52, 280, 124 },
};
#endif
static s16 sUnused = 106;
static s16 sScreenFillAlpha = 255;
static Gfx sScreenFillSetupDL[] = {
gsDPPipeSync(),
gsSPClearGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN |
G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH),
gsDPSetOtherMode(G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE |
G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_1PRIMITIVE,
G_AC_NONE | G_ZS_PIXEL | G_RM_CLD_SURF | G_RM_CLD_SURF2),
gsDPSetCombineMode(G_CC_PRIMITIVE, G_CC_PRIMITIVE),
gsSPEndDisplayList(),
};
static s16 sFileInfoBoxPartWidths[] = { 36, 36, 36, 36, 24 };
static s16 sWindowContentColors[2][3] = {
{ 100, 150, 255 }, // blue
{ 100, 100, 100 }, // gray
};
#if OOT_PAL_N64
void FileSelect_UpdateInitialLanguageMenu(FileSelectState* this) {
SramContext* sramCtx = &this->sramCtx;
Input* input = &this->state.input[0];
if (gSaveContext.language >= LANGUAGE_MAX) {
gSaveContext.language = 0;
}
sInitialLanguageAlpha += sInitialLanguageAlphaStep;
if (sInitialLanguageAlphaStep < 0.0f) {
if (sInitialLanguageAlpha < 100.0f) {
sInitialLanguageAlpha = 100.0f;
sInitialLanguageAlphaStep *= -1.0f;
}
} else if (sInitialLanguageAlphaStep > 0.0f) {
if (sInitialLanguageAlpha > 255.0f) {
sInitialLanguageAlpha = 255.0f;
sInitialLanguageAlphaStep *= -1.0f;
}
}
sInitialLanguageAlphaAsInt = (s32)sInitialLanguageAlpha;
sInitialLanguageStickAdjX = (s16)input->rel.stick_x;
if (sInitialLanguageStickAdjX < -30) {
if (sInitialLanguageStickXDir == -1) {
sInitialLanguageInputTimerX -= 1;
if (sInitialLanguageInputTimerX < 0) {
sInitialLanguageInputTimerX = 2;
} else {
sInitialLanguageStickAdjX = 0;
}
} else {
sInitialLanguageInputTimerX = 10;
sInitialLanguageStickXDir = -1;
}
} else if (sInitialLanguageStickAdjX > 30) {
if (sInitialLanguageStickXDir == 1) {
sInitialLanguageInputTimerX -= 1;
if (sInitialLanguageInputTimerX < 0) {
sInitialLanguageInputTimerX = 2;
} else {
sInitialLanguageStickAdjX = 0;
}
} else {
sInitialLanguageInputTimerX = 10;
sInitialLanguageStickXDir = 1;
}
} else {
sInitialLanguageStickXDir = 0;
}
if (CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_B) ||
CHECK_BTN_ALL(input->press.button, BTN_START)) {
Audio_PlaySfxGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
Audio_PlaySfxGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
sramCtx->readBuff[2] = gSaveContext.language;
Sram_WriteSramHeader(sramCtx);
this->configMode++;
return;
}
if (sInitialLanguageStickAdjX < -30) {
Audio_PlaySfxGeneral(NA_SE_SY_FSEL_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
gSaveContext.language--;
if (gSaveContext.language >= LANGUAGE_MAX) {
gSaveContext.language = LANGUAGE_MAX - 1;
}
} else if (sInitialLanguageStickAdjX > 30) {
Audio_PlaySfxGeneral(NA_SE_SY_FSEL_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
gSaveContext.language++;
if (gSaveContext.language >= LANGUAGE_MAX) {
gSaveContext.language = 0;
}
}
}
void FileSelect_DrawImageRGBA32(GraphicsContext* gfxCtx, s16 centerX, s16 centerY, u8* source, u32 width, u32 height) {
u8* curTexture;
s32 textureCount;
s32 rectLeft;
s32 rectTop;
u32 textureHeight;
s32 remainingSize;
s32 textureSize;
s32 pad;
s32 i;
OPEN_DISPS(gfxCtx, "../z_file_choose.c", UNK_LINE);
Gfx_SetupDL_56Opa(gfxCtx);
curTexture = source;
rectLeft = centerX - (width / 2);
rectTop = centerY - (height / 2);
remainingSize = (width * height) << 2;
textureHeight = 4096 / (width << 2);
textureSize = (width * textureHeight) << 2;
textureCount = remainingSize / textureSize;
if ((remainingSize % textureSize) != 0) {
textureCount++;
}
gDPSetTileCustom(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 0, 0, width - 1, textureHeight - 1, 0,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
remainingSize -= textureSize;
for (i = 0; i < textureCount; i++) {
gDPSetTextureImage(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_32b, width, curTexture);
gDPLoadSync(POLY_OPA_DISP++);
gDPLoadTile(POLY_OPA_DISP++, G_TX_LOADTILE, 0, 0, (width - 1) << 2, (textureHeight - 1) << 2);
gSPTextureRectangle(POLY_OPA_DISP++, rectLeft << 2, rectTop << 2, (rectLeft + (s32)width) << 2,
(rectTop + textureHeight) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
curTexture += textureSize;
rectTop += textureHeight;
if ((remainingSize - textureSize) < 0) {
if (remainingSize > 0) {
textureHeight = remainingSize / (s32)(width << 2);
remainingSize -= textureSize;
gDPSetTileCustom(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 0, 0, width - 1, textureHeight - 1, 0,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD);
}
} else {
remainingSize -= textureSize;
}
}
CLOSE_DISPS(gfxCtx, "../z_file_choose.c", UNK_LINE);
}
void FileSelect_DrawInitialLanguageMenu(FileSelectState* this) {
u8* source;
s32 i;
s32 y1;
s32 y2;
OPEN_DISPS(this->state.gfxCtx, "../z_file_choose.c", UNK_LINE);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 70 + WREG(0));
FileSelect_DrawImageRGBA32(this->state.gfxCtx, 160, 85 + WREG(1), (u8*)gTitleZeldaShieldLogoTex, 160, 160);
Gfx_SetupDL_39Opa(this->state.gfxCtx);
gDPSetAlphaCompare(POLY_OPA_DISP++, G_AC_NONE);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255);
gDPLoadTextureBlock(POLY_OPA_DISP++, gTitleCopyright1998Tex, G_IM_FMT_IA, G_IM_SIZ_8b, 128, 16, 0,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
gSPTextureRectangle(POLY_OPA_DISP++, 94 << 2, 198 << 2, 222 << 2, 214 << 2, G_TX_RENDERTILE, 0, 0, 1 << 10,
1 << 10);
Gfx_SetupDL_39Opa(this->state.gfxCtx);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 100, 100, 255, sInitialLanguageAlphaAsInt);
gDPLoadTextureBlock_4b(POLY_OPA_DISP++, gFileSelInitialLanguageCursorTex, G_IM_FMT_I, 48, 48, 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);
gSPTextureRectangle(POLY_OPA_DISP++, (sInitialLanguageCursors[gSaveContext.language].x1 + GREG(1)) << 2,
(sInitialLanguageCursors[gSaveContext.language].y1 + GREG(2)) << 2,
(sInitialLanguageCursors[gSaveContext.language].x2 + GREG(1)) << 2,
(sInitialLanguageCursors[gSaveContext.language].y2 + GREG(2)) << 2, G_TX_RENDERTILE, 0, 0,
3 << 8, 3 << 8);
gDPPipeSync(POLY_OPA_DISP++);
gDPSetRenderMode(POLY_OPA_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_BLENDPEDECALA, G_CC_BLENDPEDECALA);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 50, 255);
for (i = 0; i < LANGUAGE_MAX; i++) {
gDPPipeSync(POLY_OPA_DISP++);
if (i == gSaveContext.language) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255);
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 50, 50, 100, 255);
}
gDPLoadTextureBlock(POLY_OPA_DISP++, sInitialLanguageTextures[i].texture, G_IM_FMT_IA, G_IM_SIZ_8b,
sInitialLanguageTextures[i].width, sInitialLanguageTextures[i].height, 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);
gSPTextureRectangle(POLY_OPA_DISP++, (sInitialLanguageTextures[i].x1 + GREG(1)) << 2,
(sInitialLanguageTextures[i].y1 + GREG(2)) << 2,
(sInitialLanguageTextures[i].x2 + GREG(1)) << 2,
(sInitialLanguageTextures[i].y2 + GREG(2)) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
}
gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 220, 180, 30, 255);
gDPSetEnvColor(POLY_OPA_DISP++, 60, 20, 0, 255);
source = (u8*)gFileSelSelectYourLanguageTex;
y1 = 120 + GREG(3);
for (i = 0; i < 8; i++, source += 0x500) {
y2 = y1 + 8;
gDPLoadTextureBlock(POLY_OPA_DISP++, source, G_IM_FMT_IA, G_IM_SIZ_8b, 160, 8, 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);
gSPTextureRectangle(POLY_OPA_DISP++, (80 + GREG(4)) << 2, y1 << 2, (240 + GREG(4)) << 2, y2 << 2,
G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
y1 = y2;
}
CLOSE_DISPS(this->state.gfxCtx, "../z_file_choose.c", UNK_LINE);
}
#endif
void FileSelect_SetView(FileSelectState* this, f32 eyeX, f32 eyeY, f32 eyeZ) {
Vec3f eye;
Vec3f lookAt;
Vec3f up;
eye.x = eyeX;
eye.y = eyeY;
eye.z = eyeZ;
lookAt.x = lookAt.y = lookAt.z = 0.0f;
up.x = up.z = 0.0f;
up.y = 1.0f;
View_LookAt(&this->view, &eye, &lookAt, &up);
View_Apply(&this->view, VIEW_ALL | VIEW_FORCE_VIEWING | VIEW_FORCE_VIEWPORT | VIEW_FORCE_PROJECTION_PERSPECTIVE);
}
Gfx* FileSelect_QuadTextureIA8(Gfx* gfx, void* texture, s16 width, s16 height, s16 point) {
gDPLoadTextureBlock(gfx++, texture, G_IM_FMT_IA, G_IM_SIZ_8b, width, height, 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(gfx++, point, point + 2, point + 3, point + 1, 0);
return gfx;
}
void FileSelect_InitModeUpdate(GameState* thisx) {
FileSelectState* this = (FileSelectState*)thisx;
SramContext* sramCtx = &this->sramCtx;
#if !OOT_PAL_N64
if (this->menuMode == FS_MENU_MODE_INIT) {
this->menuMode = FS_MENU_MODE_CONFIG;
this->configMode = CM_FADE_IN_START;
this->nextTitleLabel = FS_TITLE_OPEN_FILE;
PRINTF("Sram Start─Load 》》》》》 ");
Sram_VerifyAndLoadAllSaves(this, sramCtx);
PRINTF("終了!!!\n");
}
#else
if (this->configMode == CM_FADE_IN_START) {
Sram_VerifyAndLoadAllSaves(this, sramCtx);
if (!SLOT_OCCUPIED(sramCtx, 0) && !SLOT_OCCUPIED(sramCtx, 1) && !SLOT_OCCUPIED(sramCtx, 2)) {
this->configMode++; // = CM_FADE_IN_END
} else {
this->menuMode = FS_MENU_MODE_CONFIG;
this->configMode = CM_FADE_IN_START;
this->nextTitleLabel = FS_TITLE_OPEN_FILE;
}
}
if (this->configMode == CM_FADE_IN_END) {
sScreenFillAlpha -= 40;
if (sScreenFillAlpha <= 0) {
sScreenFillAlpha = 0;
this->configMode++; // = CM_MAIN_MENU
}
} else if (this->configMode == CM_MAIN_MENU) {
FileSelect_UpdateInitialLanguageMenu(this);
} else {
sScreenFillAlpha += 40;
if (sScreenFillAlpha >= 255) {
sScreenFillAlpha = 255;
this->menuMode = FS_MENU_MODE_CONFIG;
this->configMode = CM_FADE_IN_START;
this->nextTitleLabel = FS_TITLE_OPEN_FILE;
}
}
#endif
}
void FileSelect_InitModeDraw(GameState* thisx) {
#if OOT_PAL_N64
FileSelectState* this = (FileSelectState*)thisx;
Gfx_SetupDL_39Opa(this->state.gfxCtx);
FileSelect_DrawInitialLanguageMenu(this);
#endif
}
/**
* Fade in the menu window and title label.
* If a file is occupied fade in the name, name box, and connector.
* Fade in the copy erase and options button according to the window alpha.
*/
void FileSelect_FadeInMenuElements(GameState* thisx) {
FileSelectState* this = (FileSelectState*)thisx;
SramContext* sramCtx = &this->sramCtx;
s16 i;
this->titleAlpha[0] += VREG(1);
this->windowAlpha += VREG(2);
for (i = 0; i < 3; i++) {
this->fileButtonAlpha[i] = this->windowAlpha;
if (SLOT_OCCUPIED(sramCtx, i)) {
this->nameBoxAlpha[i] = this->nameAlpha[i] = this->windowAlpha;
this->connectorAlpha[i] += VREG(1);
if (this->connectorAlpha[i] >= 255) {
this->connectorAlpha[i] = 255;
}
}
}
this->actionButtonAlpha[FS_BTN_ACTION_COPY] = this->actionButtonAlpha[FS_BTN_ACTION_ERASE] =
this->optionButtonAlpha = this->windowAlpha;
}
/**
* Converts a numerical value to ones-tens-hundreds digits
*/
void FileSelect_SplitNumber(u16 value, s16* hundreds, s16* tens, s16* ones) {
*hundreds = 0;
*tens = 0;
*ones = value;
while (true) {
if ((*ones - 100) < 0) {
break;
}
(*hundreds)++;
*ones -= 100;
}
while (true) {
if ((*ones - 10) < 0) {
break;
}
(*tens)++;
*ones -= 10;
}
}
/**
* Reduce the alpha of the black screen fill to create a fade in effect.
* Additionally, slide the window from the right to the center of the screen.
* Update function for `CM_FADE_IN_START`
*/
void FileSelect_StartFadeIn(GameState* thisx) {
FileSelectState* this = (FileSelectState*)thisx;
FileSelect_FadeInMenuElements(&this->state);
sScreenFillAlpha -= 40;
this->windowPosX -= 20;
if (this->windowPosX <= -94) {
this->windowPosX = -94;
this->configMode = CM_FADE_IN_END;
sScreenFillAlpha = 0;
}
}
/**
* Finish fading in the remaining menu elements.
* Fade in the controls text at the bottom of the screen.
* Update function for `CM_FADE_IN_END`
*/
void FileSelect_FinishFadeIn(GameState* thisx) {
FileSelectState* this = (FileSelectState*)thisx;
this->controlsAlpha += VREG(1);
FileSelect_FadeInMenuElements(&this->state);
if (this->titleAlpha[0] >= 255) {
this->titleAlpha[0] = 255;
this->controlsAlpha = 255;
this->windowAlpha = 200;
this->configMode = CM_MAIN_MENU;
}
}
/**
* Update the cursor and wait for the player to select a button to change menus accordingly.
* If an empty file is selected, enter the name entry config mode.
* If an occupied file is selected, enter the `Select` menu mode.
* If copy, erase, or options is selected, set config mode accordingly.
* Lastly, set any warning labels if appropriate.
* Update function for `CM_MAIN_MENU`
*/
void FileSelect_UpdateMainMenu(GameState* thisx) {
static u8 emptyName[] = {
FILENAME_SPACE, FILENAME_SPACE, FILENAME_SPACE, FILENAME_SPACE,
FILENAME_SPACE, FILENAME_SPACE, FILENAME_SPACE, FILENAME_SPACE,
};
FileSelectState* this = (FileSelectState*)thisx;
SramContext* sramCtx = &this->sramCtx;
Input* input = &this->state.input[0];
if (CHECK_BTN_ALL(input->press.button, BTN_START) || CHECK_BTN_ALL(input->press.button, BTN_A)) {
if (this->buttonIndex <= FS_BTN_MAIN_FILE_3) {
PRINTF("REGCK_ALL[%x]=%x,%x,%x,%x,%x,%x\n", this->buttonIndex, GET_NEWF(sramCtx, this->buttonIndex, 0),
GET_NEWF(sramCtx, this->buttonIndex, 1), GET_NEWF(sramCtx, this->buttonIndex, 2),
GET_NEWF(sramCtx, this->buttonIndex, 3), GET_NEWF(sramCtx, this->buttonIndex, 4),
GET_NEWF(sramCtx, this->buttonIndex, 5));
if (!SLOT_OCCUPIED(sramCtx, this->buttonIndex)) {
Audio_PlaySfxGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
this->configMode = CM_ROTATE_TO_NAME_ENTRY;
this->kbdButton = FS_KBD_BTN_NONE;
#if OOT_NTSC
this->charPage = FS_CHAR_PAGE_HIRA;
if (gSaveContext.language != LANGUAGE_JPN) {
this->charPage = FS_CHAR_PAGE_ENG;
}
#else
this->charPage = FS_CHAR_PAGE_ENG;
#endif
this->kbdX = 0;
this->kbdY = 0;
this->charIndex = 0;
this->charBgAlpha = 0;
this->newFileNameCharCount = 0;
this->nameEntryBoxPosX = 120;
this->nameEntryBoxAlpha = 0;
MemCpy(&this->fileNames[this->buttonIndex][0], &emptyName, sizeof(emptyName));
} else if (this->n64ddFlags[this->buttonIndex] == this->n64ddFlag) {
Audio_PlaySfxGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
this->actionTimer = 8;
this->selectMode = SM_FADE_MAIN_TO_SELECT;
this->selectedFileIndex = this->buttonIndex;
this->menuMode = FS_MENU_MODE_SELECT;
this->nextTitleLabel = FS_TITLE_OPEN_FILE;
} else if (!this->n64ddFlags[this->buttonIndex]) {
Audio_PlaySfxGeneral(NA_SE_SY_FSEL_ERROR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
} else {
#if PLATFORM_N64
if (D_80121212 != 0) {
func_801C7268();
// 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);
}
#endif
}
} else {
if (this->warningLabel == FS_WARNING_NONE) {
Audio_PlaySfxGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
this->prevConfigMode = this->configMode;
if (this->buttonIndex == FS_BTN_MAIN_COPY) {
this->configMode = CM_SETUP_COPY_SOURCE;
this->nextTitleLabel = FS_TITLE_COPY_FROM;
} else if (this->buttonIndex == FS_BTN_MAIN_ERASE) {
this->configMode = CM_SETUP_ERASE_SELECT;
this->nextTitleLabel = FS_TITLE_ERASE_FILE;
} else {
this->configMode = CM_MAIN_TO_OPTIONS;
this->kbdButton = FS_KBD_BTN_HIRA;
this->kbdX = 0;
this->kbdY = 0;
this->charBgAlpha = 0;
this->newFileNameCharCount = 0;
this->nameEntryBoxPosX = 120;
}
this->actionTimer = 8;
} else {
Audio_PlaySfxGeneral(NA_SE_SY_FSEL_ERROR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
}
}
} else {
if (ABS(this->stickAdjY) > 30) {
Audio_PlaySfxGeneral(NA_SE_SY_FSEL_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
if (this->stickAdjY > 30) {
this->buttonIndex--;
if (this->buttonIndex < FS_BTN_MAIN_FILE_1) {
this->buttonIndex = FS_BTN_MAIN_OPTIONS;
}
} else {
this->buttonIndex++;
if (this->buttonIndex > FS_BTN_MAIN_OPTIONS) {
this->buttonIndex = FS_BTN_MAIN_FILE_1;
}
}
}
if (this->buttonIndex == FS_BTN_MAIN_COPY) {
if (!SLOT_OCCUPIED(sramCtx, 0) && !SLOT_OCCUPIED(sramCtx, 1) && !SLOT_OCCUPIED(sramCtx, 2)) {
this->warningButtonIndex = this->buttonIndex;
this->warningLabel = FS_WARNING_NO_FILE_COPY;
this->emptyFileTextAlpha = 255;
} else if (SLOT_OCCUPIED(sramCtx, 0) && SLOT_OCCUPIED(sramCtx, 1) && SLOT_OCCUPIED(sramCtx, 2)) {
this->warningButtonIndex = this->buttonIndex;
this->warningLabel = FS_WARNING_NO_EMPTY_FILES;
this->emptyFileTextAlpha = 255;
} else {
this->warningLabel = FS_WARNING_NONE;
}
} else if (this->buttonIndex == FS_BTN_MAIN_ERASE) {
if (!SLOT_OCCUPIED(sramCtx, 0) && !SLOT_OCCUPIED(sramCtx, 1) && !SLOT_OCCUPIED(sramCtx, 2)) {
this->warningButtonIndex = this->buttonIndex;
this->warningLabel = FS_WARNING_NO_FILE_ERASE;
this->emptyFileTextAlpha = 255;
} else {
this->warningLabel = FS_WARNING_NONE;
}
} else {
this->warningLabel = FS_WARNING_NONE;
}
}
}
/**
* Update function for `CM_UNUSED_31`
*/
void FileSelect_UnusedCM31(GameState* thisx) {
}
/**
* Delay the next config mode from running until `XREG(73)` reaches 254.
* Because the timer increments by 2, the delay is 127 frames (assuming the value was not changed by reg editor).
* Unused in the final game, was possibly used for debugging.
* Update function for `CM_UNUSED_DELAY`
*/
void FileSelect_UnusedCMDelay(GameState* thisx) {
FileSelectState* this = (FileSelectState*)thisx;
XREG(73) += 2;
if (XREG(73) == 254) {
this->configMode = this->nextConfigMode;
XREG(73) = 0;
}
}
/**
* Rotate the window from the main menu to the name entry menu.
* Update function for `CM_ROTATE_TO_NAME_ENTRY`
*/
void FileSelect_RotateToNameEntry(GameState* thisx) {
FileSelectState* this = (FileSelectState*)thisx;
this->windowRot += VREG(16);
if (this->windowRot >= 314.0f) {
this->windowRot = 314.0f;
this->configMode = CM_START_NAME_ENTRY;
}
}
/**
* Rotate the window from the main menu to the options menu.
* Update function for `CM_MAIN_TO_OPTIONS`
*/
void FileSelect_RotateToOptions(GameState* thisx) {
FileSelectState* this = (FileSelectState*)thisx;
this->windowRot += VREG(16);
if (this->windowRot >= 314.0f) {
this->windowRot = 314.0f;
this->configMode = CM_START_OPTIONS;
}
}
/**
* Rotate the window from the options menu to the main menu.
* Update function for `CM_NAME_ENTRY_TO_MAIN` and `CM_OPTIONS_TO_MAIN`
*/
void FileSelect_RotateToMain(GameState* thisx) {
FileSelectState* this = (FileSelectState*)thisx;
this->windowRot += VREG(16);
if (this->windowRot >= 628.0f) {
this->windowRot = 0.0f;
this->configMode = CM_MAIN_MENU;
}
}
static void (*sConfigModeUpdateFuncs[])(GameState*) = {
FileSelect_StartFadeIn, FileSelect_FinishFadeIn,
FileSelect_UpdateMainMenu, FileSelect_SetupCopySource,
FileSelect_SelectCopySource, FileSelect_SetupCopyDest1,
FileSelect_SetupCopyDest2, FileSelect_SelectCopyDest,
FileSelect_ExitToCopySource1, FileSelect_ExitToCopySource2,
FileSelect_SetupCopyConfirm1, FileSelect_SetupCopyConfirm2,
FileSelect_CopyConfirm, FileSelect_ReturnToCopyDest,
FileSelect_CopyAnim1, FileSelect_CopyAnim2,
FileSelect_CopyAnim3, FileSelect_CopyAnim4,
FileSelect_CopyAnim5, FileSelect_ExitCopyToMain,
FileSelect_SetupEraseSelect, FileSelect_EraseSelect,
FileSelect_SetupEraseConfirm1, FileSelect_SetupEraseConfirm2,
FileSelect_EraseConfirm, FileSelect_ExitToEraseSelect1,
FileSelect_ExitToEraseSelect2, FileSelect_EraseAnim1,
FileSelect_EraseAnim2, FileSelect_EraseAnim3,
FileSelect_ExitEraseToMain, FileSelect_UnusedCM31,
FileSelect_RotateToNameEntry, FileSelect_UpdateKeyboardCursor,
FileSelect_StartNameEntry, FileSelect_RotateToMain,
FileSelect_RotateToOptions, FileSelect_UpdateOptionsMenu,
FileSelect_StartOptions, FileSelect_RotateToMain,
FileSelect_UnusedCMDelay,
};
/**
* Updates the alpha of the cursor to make it pulsate.
* On the debug rom, this function also handles switching languages with controller 3.
*/
void FileSelect_PulsateCursor(GameState* thisx) {
static s16 cursorAlphaTargets[] = { 70, 200 };
FileSelectState* this = (FileSelectState*)thisx;
s16 alphaStep;
SramContext* sramCtx = &this->sramCtx;
Input* debugInput = &this->state.input[2];
#if OOT_PAL && DEBUG_FEATURES
if (CHECK_BTN_ALL(debugInput->press.button, BTN_DLEFT)) {
sramCtx->readBuff[SRAM_HEADER_LANGUAGE] = gSaveContext.language = LANGUAGE_ENG;
*((u8*)0x80000002) = LANGUAGE_ENG;
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, 3, OS_WRITE);
PRINTF("1:read_buff[]=%x, %x, %x, %x\n", sramCtx->readBuff[SRAM_HEADER_SOUND],
sramCtx->readBuff[SRAM_HEADER_ZTARGET], sramCtx->readBuff[SRAM_HEADER_LANGUAGE],
sramCtx->readBuff[SRAM_HEADER_MAGIC]);
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_READ);
PRINTF("read_buff[]=%x, %x, %x, %x\n", sramCtx->readBuff[SRAM_HEADER_SOUND],
sramCtx->readBuff[SRAM_HEADER_ZTARGET], sramCtx->readBuff[SRAM_HEADER_LANGUAGE],
sramCtx->readBuff[SRAM_HEADER_MAGIC]);
} else if (CHECK_BTN_ALL(debugInput->press.button, BTN_DUP)) {
sramCtx->readBuff[SRAM_HEADER_LANGUAGE] = gSaveContext.language = LANGUAGE_GER;
*((u8*)0x80000002) = LANGUAGE_GER;
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, 3, OS_WRITE);
PRINTF("1:read_buff[]=%x, %x, %x, %x\n", sramCtx->readBuff[SRAM_HEADER_SOUND],
sramCtx->readBuff[SRAM_HEADER_ZTARGET], sramCtx->readBuff[SRAM_HEADER_LANGUAGE],
sramCtx->readBuff[SRAM_HEADER_MAGIC]);
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_READ);
PRINTF("read_buff[]=%x, %x, %x, %x\n", sramCtx->readBuff[SRAM_HEADER_SOUND],
sramCtx->readBuff[SRAM_HEADER_ZTARGET], sramCtx->readBuff[SRAM_HEADER_LANGUAGE],
sramCtx->readBuff[SRAM_HEADER_MAGIC]);
} else if (CHECK_BTN_ALL(debugInput->press.button, BTN_DRIGHT)) {
sramCtx->readBuff[SRAM_HEADER_LANGUAGE] = gSaveContext.language = LANGUAGE_FRA;
*((u8*)0x80000002) = LANGUAGE_FRA;
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, 3, OS_WRITE);
PRINTF("1:read_buff[]=%x, %x, %x, %x\n", sramCtx->readBuff[SRAM_HEADER_SOUND],
sramCtx->readBuff[SRAM_HEADER_ZTARGET], sramCtx->readBuff[SRAM_HEADER_LANGUAGE],
sramCtx->readBuff[SRAM_HEADER_MAGIC]);
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_READ);
PRINTF("read_buff[]=%x, %x, %x, %x\n", sramCtx->readBuff[SRAM_HEADER_SOUND],
sramCtx->readBuff[SRAM_HEADER_ZTARGET], sramCtx->readBuff[SRAM_HEADER_LANGUAGE],
sramCtx->readBuff[SRAM_HEADER_MAGIC]);
}
#endif
alphaStep = ABS(this->highlightColor[3] - cursorAlphaTargets[this->highlightPulseDir]) / XREG(35);
if (this->highlightColor[3] >= cursorAlphaTargets[this->highlightPulseDir]) {
this->highlightColor[3] -= alphaStep;
} else {
this->highlightColor[3] += alphaStep;
}
XREG(35)--;
if (XREG(35) == 0) {
this->highlightColor[3] = cursorAlphaTargets[this->highlightPulseDir];
XREG(35) = XREG(36 + this->highlightPulseDir);
this->highlightPulseDir ^= 1;
}
}
void FileSelect_ConfigModeUpdate(GameState* thisx) {
FileSelectState* this = (FileSelectState*)thisx;
sConfigModeUpdateFuncs[this->configMode](&this->state);
}
void FileSelect_SetWindowVtx(GameState* thisx) {
FileSelectState* this = (FileSelectState*)thisx;
s16 i;
s16 j;
s16 x;
s16 tmp;
s16 tmp2;
s16 tmp3;
this->windowVtx = GRAPH_ALLOC(this->state.gfxCtx, sizeof(Vtx) * 80);
tmp = this->windowPosX - 90;
for (x = 0, i = 0; i < 4; i++) {
tmp += 0x40;
tmp2 = (i == 3) ? 0x30 : 0x40;
for (j = 0, tmp3 = 0x50; j < 5; j++, x += 4, tmp3 -= 0x20) {
this->windowVtx[x].v.ob[0] = this->windowVtx[x + 2].v.ob[0] = tmp;
this->windowVtx[x + 1].v.ob[0] = this->windowVtx[x + 3].v.ob[0] = tmp + tmp2;
this->windowVtx[x].v.ob[1] = this->windowVtx[x + 1].v.ob[1] = tmp3;
this->windowVtx[x + 2].v.ob[1] = this->windowVtx[x + 3].v.ob[1] = tmp3 - 0x20;
this->windowVtx[x].v.ob[2] = this->windowVtx[x + 1].v.ob[2] = this->windowVtx[x + 2].v.ob[2] =
this->windowVtx[x + 3].v.ob[2] = 0;
this->windowVtx[x].v.flag = this->windowVtx[x + 1].v.flag = this->windowVtx[x + 2].v.flag =
this->windowVtx[x + 3].v.flag = 0;
this->windowVtx[x].v.tc[0] = this->windowVtx[x].v.tc[1] = this->windowVtx[x + 1].v.tc[1] =
this->windowVtx[x + 2].v.tc[0] = 0;
this->windowVtx[x + 1].v.tc[0] = this->windowVtx[x + 3].v.tc[0] = tmp2 * 0x20;
this->windowVtx[x + 2].v.tc[1] = this->windowVtx[x + 3].v.tc[1] = 0x400;
this->windowVtx[x].v.cn[0] = this->windowVtx[x + 2].v.cn[0] = this->windowVtx[x].v.cn[1] =
this->windowVtx[x + 2].v.cn[1] = this->windowVtx[x].v.cn[2] = this->windowVtx[x + 2].v.cn[2] =
this->windowVtx[x + 1].v.cn[0] = this->windowVtx[x + 3].v.cn[0] = this->windowVtx[x + 1].v.cn[1] =
this->windowVtx[x + 3].v.cn[1] = this->windowVtx[x + 1].v.cn[2] =
this->windowVtx[x + 3].v.cn[2] = this->windowVtx[x].v.cn[3] =
this->windowVtx[x + 2].v.cn[3] = this->windowVtx[x + 1].v.cn[3] =
this->windowVtx[x + 3].v.cn[3] = 255;
}
}
}
static s16 D_80812818[] = { 0x001A, 0x000A, 0x000A, 0x000A };
static s16 D_80812820[] = { 0x0020, 0x000C, 0x000C, 0x000C };
static s16 D_80812828[] = { 0x0010, 0x000C, 0x000C, 0x000C };
static s16 D_80812830[] = { 0x0040, 0x0054, 0x0068, 0x0274, 0x0278, 0x027C };
static s16 D_8081283C[] = { 0x0040, 0x0054, 0x0068, 0x0278 };
static s16 D_80812844[] = { 0x0274, 0x0278 };
static s16 D_80812848[] = { 0x0274, 0x0278 };
void FileSelect_SetWindowContentVtx(GameState* thisx) {
FileSelectState* this = (FileSelectState*)thisx;
SramContext* sramCtx = &this->sramCtx;
s16 phi_t2;
s16 phi_t0;
s16 phi_t5;
s16 phi_a1;
s16 phi_ra;
s16 temp_t1;
#if OOT_PAL_N64
u8 fileNameChar;
#endif
this->windowContentVtx = GRAPH_ALLOC(this->state.gfxCtx, 0x288 * sizeof(Vtx));
for (phi_t2 = 0; phi_t2 < 0x288; phi_t2 += 4) {
this->windowContentVtx[phi_t2].v.ob[0] = this->windowContentVtx[phi_t2 + 2].v.ob[0] = 0x12C;
this->windowContentVtx[phi_t2 + 1].v.ob[0] = this->windowContentVtx[phi_t2 + 3].v.ob[0] =
this->windowContentVtx[phi_t2].v.ob[0] + 0x10;
this->windowContentVtx[phi_t2].v.ob[1] = this->windowContentVtx[phi_t2 + 1].v.ob[1] = 0;
this->windowContentVtx[phi_t2 + 2].v.ob[1] = this->windowContentVtx[phi_t2 + 3].v.ob[1] =
this->windowContentVtx[phi_t2].v.ob[1] - 0x10;
this->windowContentVtx[phi_t2].v.ob[2] = this->windowContentVtx[phi_t2 + 1].v.ob[2] =
this->windowContentVtx[phi_t2 + 2].v.ob[2] = this->windowContentVtx[phi_t2 + 3].v.ob[2] = 0;
this->windowContentVtx[phi_t2].v.flag = this->windowContentVtx[phi_t2 + 1].v.flag =
this->windowContentVtx[phi_t2 + 2].v.flag = this->windowContentVtx[phi_t2 + 3].v.flag = 0;
this->windowContentVtx[phi_t2].v.tc[0] = this->windowContentVtx[phi_t2].v.tc[1] =
this->windowContentVtx[phi_t2 + 1].v.tc[1] = this->windowContentVtx[phi_t2 + 2].v.tc[0] = 0;
this->windowContentVtx[phi_t2 + 1].v.tc[0] = this->windowContentVtx[phi_t2 + 2].v.tc[1] =
this->windowContentVtx[phi_t2 + 3].v.tc[0] = this->windowContentVtx[phi_t2 + 3].v.tc[1] = 0x200;
this->windowContentVtx[phi_t2].v.cn[0] = this->windowContentVtx[phi_t2 + 1].v.cn[0] =
this->windowContentVtx[phi_t2 + 2].v.cn[0] = this->windowContentVtx[phi_t2 + 3].v.cn[0] =
this->windowContentVtx[phi_t2].v.cn[1] = this->windowContentVtx[phi_t2 + 1].v.cn[1] =
this->windowContentVtx[phi_t2 + 2].v.cn[1] = this->windowContentVtx[phi_t2 + 3].v.cn[1] =
this->windowContentVtx[phi_t2].v.cn[2] = this->windowContentVtx[phi_t2 + 1].v.cn[2] =
this->windowContentVtx[phi_t2 + 2].v.cn[2] = this->windowContentVtx[phi_t2 + 3].v.cn[2] =
this->windowContentVtx[phi_t2].v.cn[3] = this->windowContentVtx[phi_t2 + 1].v.cn[3] =
this->windowContentVtx[phi_t2 + 2].v.cn[3] =
this->windowContentVtx[phi_t2 + 3].v.cn[3] = 0xFF;
}
this->windowContentVtx[0].v.ob[0] = this->windowContentVtx[2].v.ob[0] = this->windowPosX;
this->windowContentVtx[1].v.ob[0] = this->windowContentVtx[3].v.ob[0] = this->windowContentVtx[0].v.ob[0] + 0x80;
this->windowContentVtx[0].v.ob[1] = this->windowContentVtx[1].v.ob[1] = 0x48;
this->windowContentVtx[2].v.ob[1] = this->windowContentVtx[3].v.ob[1] = this->windowContentVtx[0].v.ob[1] - 0x10;
this->windowContentVtx[1].v.tc[0] = this->windowContentVtx[3].v.tc[0] = 0x1000;
for (phi_a1 = 0, phi_t2 = 4; phi_a1 < 3; phi_a1++) {
phi_t0 = this->windowPosX - 6;
for (phi_t5 = 0; phi_t5 < 5; phi_t5++, phi_t2 += 4) {
this->windowContentVtx[phi_t2].v.ob[0] = this->windowContentVtx[phi_t2 + 2].v.ob[0] = phi_t0;
this->windowContentVtx[phi_t2 + 1].v.ob[0] = this->windowContentVtx[phi_t2 + 3].v.ob[0] =
this->windowContentVtx[phi_t2].v.ob[0] + sFileInfoBoxPartWidths[phi_t5];
this->windowContentVtx[phi_t2].v.ob[1] = this->windowContentVtx[phi_t2 + 1].v.ob[1] =
this->fileNamesY[phi_a1] + 0x2C;
this->windowContentVtx[phi_t2 + 2].v.ob[1] = this->windowContentVtx[phi_t2 + 3].v.ob[1] =
this->windowContentVtx[phi_t2].v.ob[1] - 0x38;
this->windowContentVtx[phi_t2 + 1].v.tc[0] = this->windowContentVtx[phi_t2 + 3].v.tc[0] =
sFileInfoBoxPartWidths[phi_t5] << 5;
this->windowContentVtx[phi_t2 + 2].v.tc[1] = this->windowContentVtx[phi_t2 + 3].v.tc[1] = 0x700;
phi_t0 += sFileInfoBoxPartWidths[phi_t5];
}
}
phi_t0 = this->windowPosX - 6;
phi_ra = 0x2C;
for (phi_t5 = 0; phi_t5 < 3; phi_t5++, phi_t2 += 20, phi_ra -= 0x10) {
this->windowContentVtx[phi_t2].v.ob[0] = this->windowContentVtx[phi_t2 + 2].v.ob[0] = phi_t0;
this->windowContentVtx[phi_t2 + 1].v.ob[0] = this->windowContentVtx[phi_t2 + 3].v.ob[0] =
this->windowContentVtx[phi_t2].v.ob[0] + 0x40;
this->windowContentVtx[phi_t2].v.ob[1] = this->windowContentVtx[phi_t2 + 1].v.ob[1] =
this->buttonYOffsets[phi_t5] + phi_ra;
this->windowContentVtx[phi_t2 + 2].v.ob[1] = this->windowContentVtx[phi_t2 + 3].v.ob[1] =
this->windowContentVtx[phi_t2].v.ob[1] - 0x10;
this->windowContentVtx[phi_t2 + 1].v.tc[0] = this->windowContentVtx[phi_t2 + 3].v.tc[0] = 0x800;
this->windowContentVtx[phi_t2 + 4].v.ob[0] = this->windowContentVtx[phi_t2 + 6].v.ob[0] = phi_t0 + 0x40;
this->windowContentVtx[phi_t2 + 5].v.ob[0] = this->windowContentVtx[phi_t2 + 7].v.ob[0] =
this->windowContentVtx[phi_t2 + 4].v.ob[0] + 0x6C;
this->windowContentVtx[phi_t2 + 4].v.ob[1] = this->windowContentVtx[phi_t2 + 5].v.ob[1] =
this->buttonYOffsets[phi_t5] + phi_ra;
this->windowContentVtx[phi_t2 + 6].v.ob[1] = this->windowContentVtx[phi_t2 + 7].v.ob[1] =
this->windowContentVtx[phi_t2 + 4].v.ob[1] - 0x10;
this->windowContentVtx[phi_t2 + 5].v.tc[0] = this->windowContentVtx[phi_t2 + 7].v.tc[0] = 0xD80;
if ((this->configMode == CM_COPY_ANIM_2) && (phi_t5 == this->copyDestFileIndex)) {
temp_t1 = this->fileNamesY[phi_t5] + 0x2C;
} else if (((this->configMode == CM_COPY_ANIM_3) || (this->configMode == CM_COPY_ANIM_4)) &&
(phi_t5 == this->copyDestFileIndex)) {
temp_t1 = this->buttonYOffsets[phi_t5] + phi_ra;
} else {
temp_t1 = phi_ra + this->buttonYOffsets[phi_t5] + this->fileNamesY[phi_t5];
}
this->windowContentVtx[phi_t2 + 8].v.ob[0] = this->windowContentVtx[phi_t2 + 10].v.ob[0] = phi_t0 + 0xA8;
this->windowContentVtx[phi_t2 + 9].v.ob[0] = this->windowContentVtx[phi_t2 + 11].v.ob[0] =
this->windowContentVtx[phi_t2 + 8].v.ob[0] + 0x2C;
this->windowContentVtx[phi_t2 + 8].v.ob[1] = this->windowContentVtx[phi_t2 + 9].v.ob[1] = temp_t1;
this->windowContentVtx[phi_t2 + 10].v.ob[1] = this->windowContentVtx[phi_t2 + 11].v.ob[1] =
this->windowContentVtx[phi_t2 + 8].v.ob[1] - 0x10;
this->windowContentVtx[phi_t2 + 9].v.tc[0] = this->windowContentVtx[phi_t2 + 11].v.tc[0] = 0x580;
this->windowContentVtx[phi_t2 + 12].v.ob[0] = this->windowContentVtx[phi_t2 + 14].v.ob[0] = phi_t0 + 0x34;
this->windowContentVtx[phi_t2 + 13].v.ob[0] = this->windowContentVtx[phi_t2 + 15].v.ob[0] =
this->windowContentVtx[phi_t2 + 12].v.ob[0] + 0x18;
this->windowContentVtx[phi_t2 + 12].v.ob[1] = this->windowContentVtx[phi_t2 + 13].v.ob[1] =
this->buttonYOffsets[phi_t5] + phi_ra;
this->windowContentVtx[phi_t2 + 14].v.ob[1] = this->windowContentVtx[phi_t2 + 15].v.ob[1] =
this->windowContentVtx[phi_t2 + 12].v.ob[1] - 0x10;
this->windowContentVtx[phi_t2 + 13].v.tc[0] = this->windowContentVtx[phi_t2 + 15].v.tc[0] = 0x300;
this->windowContentVtx[phi_t2 + 16].v.ob[0] = this->windowContentVtx[phi_t2 + 18].v.ob[0] = phi_t0 + 0x9C;
this->windowContentVtx[phi_t2 + 17].v.ob[0] = this->windowContentVtx[phi_t2 + 19].v.ob[0] =
this->windowContentVtx[phi_t2 + 16].v.ob[0] + 0x18;
this->windowContentVtx[phi_t2 + 16].v.ob[1] = this->windowContentVtx[phi_t2 + 17].v.ob[1] =
this->buttonYOffsets[phi_t5] + phi_ra;
this->windowContentVtx[phi_t2 + 18].v.ob[1] = this->windowContentVtx[phi_t2 + 19].v.ob[1] =
this->windowContentVtx[phi_t2 + 16].v.ob[1] - 0x10;
this->windowContentVtx[phi_t2 + 17].v.tc[0] = this->windowContentVtx[phi_t2 + 19].v.tc[0] = 0x300;
}
phi_ra = 0x2C;
for (phi_t5 = 0; phi_t5 < 3; phi_t5++, phi_ra -= WREG(38)) {
if (SLOT_OCCUPIED(sramCtx, phi_t5)) {
phi_t0 = this->windowPosX - WREG(39);
if ((this->configMode == 0xF) && (phi_t5 == this->copyDestFileIndex)) {
temp_t1 = this->fileNamesY[phi_t5] + 0x2C;
} else if (((this->configMode == CM_COPY_ANIM_3) || (this->configMode == CM_COPY_ANIM_4)) &&
(phi_t5 == this->copyDestFileIndex)) {
temp_t1 = this->buttonYOffsets[phi_t5] + phi_ra;
} else {
temp_t1 = phi_ra + this->buttonYOffsets[phi_t5] + this->fileNamesY[phi_t5];
}
temp_t1 += 2;