diff --git a/config/us/levels/data.tsv b/config/us/levels/data.tsv index 33aa30bfdc..3a59a1d075 100644 --- a/config/us/levels/data.tsv +++ b/config/us/levels/data.tsv @@ -3492,12 +3492,6 @@ D_L00_0015F6B8 4 D_L00_0015F6B8 4 D_L00_0015F6B8 4 D_L00_0015F6B8 4 -D_L00_0017BF20 60 -D_L00_0017BF60 96 -D_L00_0017DAC0 224 -D_L00_0017DBA0 112 -D_L00_0017DC10 28 -D_L00_0017DC30 28 D_L00_0015F924 2 D_L00_0015F928 2 D_L00_0015F92C 2 @@ -3819,6 +3813,12 @@ D_L00_0017AEBC 4 D_L00_0017AEBC 4 D_L00_0017AEBC 4 D_L00_0017AEBC 4 +D_L00_0017BF20 60 +D_L00_0017BF60 96 +D_L00_0017DAC0 224 +D_L00_0017DBA0 112 +D_L00_0017DC10 28 +D_L00_0017DC30 28 D_L00_0017E518 4 D_L00_0017E51C 4 D_L00_0017E520 4 @@ -4290,12 +4290,6 @@ D_L01_0015F728 4 D_L01_0015F72C 4 D_L01_0015F738 4 D_L01_0015F740 4 -D_L01_0017C3A0 60 -D_L01_0017C3E0 96 -D_L01_0017DF40 224 -D_L01_0017E020 112 -D_L01_0017E090 28 -D_L01_0017E0B0 28 D_L01_0015F750 4 D_L01_0015F754 4 D_L01_0015F758 4 @@ -4948,8 +4942,14 @@ D_L01_0017B174 4 D_L01_0017B80C 4 D_L01_0017C050 4 D_L01_0017C070 4 +D_L01_0017C3A0 60 +D_L01_0017C3E0 96 D_L01_0017CB00 1 D_L01_0017CF00 1 +D_L01_0017DF40 224 +D_L01_0017E020 112 +D_L01_0017E090 28 +D_L01_0017E0B0 28 D_L01_0017E958 28 D_L01_0017E974 4 D_L01_0017E984 4 @@ -5369,12 +5369,6 @@ D_L02_0015F728 4 D_L02_0015F72C 4 D_L02_0015F738 4 D_L02_0015F740 4 -D_L02_0017C520 60 -D_L02_0017C560 96 -D_L02_0017E0C0 224 -D_L02_0017E1A0 112 -D_L02_0017E210 28 -D_L02_0017E230 28 D_L02_0015F750 4 D_L02_0015F754 4 D_L02_0015F758 4 @@ -6115,11 +6109,17 @@ D_L02_0017B988 4 D_L02_0017B98C 4 D_L02_0017C1D0 4 D_L02_0017C1F0 4 +D_L02_0017C520 60 +D_L02_0017C560 96 D_L02_0017C940 44 D_L02_0017C960 4 D_L02_0017C964 4 D_L02_0017CC80 1 D_L02_0017D080 1 +D_L02_0017E0C0 224 +D_L02_0017E1A0 112 +D_L02_0017E210 28 +D_L02_0017E230 28 D_L02_0017EAD8 28 D_L02_0017EAF4 4 D_L02_0017EB04 4 @@ -6502,12 +6502,6 @@ D_L03_0015F728 4 D_L03_0015F72C 4 D_L03_0015F738 4 D_L03_0015F740 4 -D_L03_0017C020 60 -D_L03_0017C060 96 -D_L03_0017DBC0 224 -D_L03_0017DCA0 112 -D_L03_0017DD10 28 -D_L03_0017DD30 28 D_L03_0015F750 4 D_L03_0015F754 4 D_L03_0015F758 4 @@ -7150,11 +7144,17 @@ D_L03_0017ADF4 4 D_L03_0017B48C 4 D_L03_0017BCD0 4 D_L03_0017BCF0 4 +D_L03_0017C020 60 +D_L03_0017C060 96 D_L03_0017C440 44 D_L03_0017C460 4 D_L03_0017C464 4 D_L03_0017C780 1 D_L03_0017CB80 1 +D_L03_0017DBC0 224 +D_L03_0017DCA0 112 +D_L03_0017DD10 28 +D_L03_0017DD30 28 D_L03_0017E5D8 28 D_L03_0017E5F4 4 D_L03_0017E604 4 @@ -7557,12 +7557,6 @@ D_L04_0015F724 4 D_L04_0015F728 4 D_L04_0015F72C 4 D_L04_0015F738 4 -D_L04_0017C0A0 60 -D_L04_0017C0E0 96 -D_L04_0017DC40 224 -D_L04_0017DD20 112 -D_L04_0017DD90 28 -D_L04_0017DDB0 28 D_L04_0015F740 4 D_L04_0015F750 4 D_L04_0015F754 4 @@ -8250,6 +8244,8 @@ D_L04_0017BD50 4 D_L04_0017BD70 4 D_L04_0017BF38 4 D_L04_0017BF70 4 +D_L04_0017C0A0 60 +D_L04_0017C0E0 96 D_L04_0017C4C0 44 D_L04_0017C4E0 4 D_L04_0017C4E4 4 @@ -8258,6 +8254,10 @@ D_L04_0017C5E0 4 D_L04_0017C5E4 4 D_L04_0017C800 1 D_L04_0017CC00 1 +D_L04_0017DC40 224 +D_L04_0017DD20 112 +D_L04_0017DD90 28 +D_L04_0017DDB0 28 D_L04_0017E658 28 D_L04_0017E674 4 D_L04_0017E684 4 @@ -8625,12 +8625,6 @@ D_L05_0015F738 4 D_L05_0015F73C 4 D_L05_0015F748 4 D_L05_0015F750 4 -D_L05_0017C380 60 -D_L05_0017C3C0 96 -D_L05_0017DF40 224 -D_L05_0017E020 112 -D_L05_0017E090 28 -D_L05_0017E0B0 28 D_L05_0015F760 4 D_L05_0015F764 4 D_L05_0015F768 4 @@ -9425,11 +9419,17 @@ D_L05_0017B7E8 4 D_L05_0017B7EC 4 D_L05_0017C030 4 D_L05_0017C050 4 +D_L05_0017C380 60 +D_L05_0017C3C0 96 D_L05_0017C7A0 44 D_L05_0017C7C0 4 D_L05_0017C7C4 4 D_L05_0017CB00 1 D_L05_0017CF00 1 +D_L05_0017DF40 224 +D_L05_0017E020 112 +D_L05_0017E090 28 +D_L05_0017E0B0 28 D_L05_0017E918 60 D_L05_0017E918 60 D_L05_0017E918 60 @@ -9801,12 +9801,6 @@ D_L06_0015F724 4 D_L06_0015F728 4 D_L06_0015F72C 4 D_L06_0015F738 4 -D_L06_0017C6A0 60 -D_L06_0017C6E0 96 -D_L06_0017E240 224 -D_L06_0017E320 112 -D_L06_0017E390 28 -D_L06_0017E3B0 28 D_L06_0015F740 4 D_L06_0015F750 4 D_L06_0015F754 4 @@ -10605,6 +10599,8 @@ D_L06_0017BB0C 4 D_L06_0017BFDC 4 D_L06_0017C350 4 D_L06_0017C370 4 +D_L06_0017C6A0 60 +D_L06_0017C6E0 96 D_L06_0017CAC0 44 D_L06_0017CAE0 4 D_L06_0017CAE4 4 @@ -10613,6 +10609,10 @@ D_L06_0017CBE0 4 D_L06_0017CBE4 4 D_L06_0017CE00 1 D_L06_0017D200 1 +D_L06_0017E240 224 +D_L06_0017E320 112 +D_L06_0017E390 28 +D_L06_0017E3B0 28 D_L06_0017EC74 4 D_L06_0017EC84 4 D_L06_0017EC88 4 @@ -11063,12 +11063,6 @@ D_L07_0015F724 4 D_L07_0015F728 4 D_L07_0015F72C 4 D_L07_0015F738 4 -D_L07_0017BFA0 60 -D_L07_0017BFE0 96 -D_L07_0017DB40 224 -D_L07_0017DC20 112 -D_L07_0017DC90 28 -D_L07_0017DCB0 28 D_L07_0015F740 4 D_L07_0015F750 4 D_L07_0015F754 4 @@ -11723,12 +11717,18 @@ D_L07_0017BC50 4 D_L07_0017BC70 4 D_L07_0017BE38 4 D_L07_0017BE70 4 +D_L07_0017BFA0 60 +D_L07_0017BFE0 96 D_L07_0017C3C0 44 D_L07_0017C3E0 4 D_L07_0017C3E4 4 D_L07_0017C4C0 1 D_L07_0017C700 1 D_L07_0017CB00 1 +D_L07_0017DB40 224 +D_L07_0017DC20 112 +D_L07_0017DC90 28 +D_L07_0017DCB0 28 D_L07_0017E558 28 D_L07_0017E574 4 D_L07_0017E584 4 @@ -12142,12 +12142,6 @@ D_L08_0015F728 4 D_L08_0015F72C 4 D_L08_0015F738 4 D_L08_0015F740 4 -D_L08_0017C720 60 -D_L08_0017C760 96 -D_L08_0017E2C0 224 -D_L08_0017E3A0 112 -D_L08_0017E410 28 -D_L08_0017E430 28 D_L08_0015F750 4 D_L08_0015F754 4 D_L08_0015F758 4 @@ -12938,11 +12932,17 @@ D_L08_0017B4F4 4 D_L08_0017BB8C 4 D_L08_0017C3D0 4 D_L08_0017C3F0 4 +D_L08_0017C720 60 +D_L08_0017C760 96 D_L08_0017CB40 44 D_L08_0017CB60 4 D_L08_0017CB64 4 D_L08_0017CE80 1 D_L08_0017D280 1 +D_L08_0017E2C0 224 +D_L08_0017E3A0 112 +D_L08_0017E410 28 +D_L08_0017E430 28 D_L08_0017ECD8 28 D_L08_0017ECF4 4 D_L08_0017ED04 4 @@ -13523,12 +13523,6 @@ D_L09_0015F724 4 D_L09_0015F728 4 D_L09_0015F72C 4 D_L09_0015F738 4 -D_L09_0017C0A0 60 -D_L09_0017C0E0 96 -D_L09_0017DC40 224 -D_L09_0017DD20 112 -D_L09_0017DD90 28 -D_L09_0017DDB0 28 D_L09_0015F740 4 D_L09_0015F750 4 D_L09_0015F754 4 @@ -14223,12 +14217,18 @@ D_L09_0017BD50 4 D_L09_0017BD70 4 D_L09_0017BF38 4 D_L09_0017BF70 4 +D_L09_0017C0A0 60 +D_L09_0017C0E0 96 D_L09_0017C4C0 44 D_L09_0017C4E0 4 D_L09_0017C4E4 4 D_L09_0017C5C0 1 D_L09_0017C800 1 D_L09_0017CC00 1 +D_L09_0017DC40 224 +D_L09_0017DD20 112 +D_L09_0017DD90 28 +D_L09_0017DDB0 28 D_L09_0017E658 28 D_L09_0017E674 4 D_L09_0017E684 4 @@ -14842,12 +14842,6 @@ D_L10_0015F724 4 D_L10_0015F728 4 D_L10_0015F72C 4 D_L10_0015F738 4 -D_L10_0017C3A0 60 -D_L10_0017C3E0 96 -D_L10_0017DF40 224 -D_L10_0017E020 112 -D_L10_0017E090 28 -D_L10_0017E0B0 28 D_L10_0015F740 4 D_L10_0015F750 4 D_L10_0015F754 4 @@ -15611,12 +15605,18 @@ D_L10_0017C050 4 D_L10_0017C070 4 D_L10_0017C238 4 D_L10_0017C270 4 +D_L10_0017C3A0 60 +D_L10_0017C3E0 96 D_L10_0017C7C0 44 D_L10_0017C7E0 4 D_L10_0017C7E4 4 D_L10_0017C8C0 1 D_L10_0017CB00 1 D_L10_0017CF00 1 +D_L10_0017DF40 224 +D_L10_0017E020 112 +D_L10_0017E090 28 +D_L10_0017E0B0 28 D_L10_0017E958 48 D_L10_0017E974 4 D_L10_0017E984 4 @@ -15970,12 +15970,6 @@ D_L11_0015F728 4 D_L11_0015F72C 4 D_L11_0015F738 4 D_L11_0015F740 4 -D_L11_0017C920 60 -D_L11_0017C960 96 -D_L11_0017E4C0 224 -D_L11_0017E5A0 112 -D_L11_0017E610 28 -D_L11_0017E630 28 D_L11_0015F750 4 D_L11_0015F754 4 D_L11_0015F758 4 @@ -16748,10 +16742,16 @@ D_L11_0017BD88 4 D_L11_0017BD8C 4 D_L11_0017C5D0 4 D_L11_0017C5F0 4 +D_L11_0017C920 60 +D_L11_0017C960 96 D_L11_0017CD40 44 D_L11_0017CE40 1 D_L11_0017D080 1 D_L11_0017D480 1 +D_L11_0017E4C0 224 +D_L11_0017E5A0 112 +D_L11_0017E610 28 +D_L11_0017E630 28 D_L11_0017EED8 28 D_L11_0017EEF4 4 D_L11_0017EF04 4 @@ -17273,12 +17273,6 @@ D_L12_0015F728 4 D_L12_0015F72C 4 D_L12_0015F738 4 D_L12_0015F740 4 -D_L12_0017C3A0 60 -D_L12_0017C3E0 96 -D_L12_0017DF40 224 -D_L12_0017E020 112 -D_L12_0017E090 28 -D_L12_0017E0B0 28 D_L12_0015F750 4 D_L12_0015F754 4 D_L12_0015F758 4 @@ -18016,11 +18010,17 @@ D_L12_0017B174 4 D_L12_0017B80C 4 D_L12_0017C050 4 D_L12_0017C070 4 +D_L12_0017C3A0 60 +D_L12_0017C3E0 96 D_L12_0017C7C0 44 D_L12_0017C7E0 4 D_L12_0017C7E4 4 D_L12_0017CB00 1 D_L12_0017CF00 1 +D_L12_0017DF40 224 +D_L12_0017E020 112 +D_L12_0017E090 28 +D_L12_0017E0B0 28 D_L12_0017E958 28 D_L12_0017E974 4 D_L12_0017E984 4 @@ -18295,6 +18295,13 @@ D_L12_002058C0 288 D_L12_002059E0 40 D_L12_00205A08 40 D_L12_00205A58 40 +D_L12_00205A80 20 +D_L12_00208548 48 +D_L12_00208578 160 +D_L12_00208618 420 +D_L12_002087C0 592 +D_L12_00208A10 132 +D_L12_00208AE0 20 D_L12_00209AA0 4 D_L12_00209E00 24 D_L12_00209F30 24 @@ -18414,12 +18421,6 @@ D_L13_0015F724 4 D_L13_0015F728 4 D_L13_0015F72C 4 D_L13_0015F738 4 -D_L13_0017C220 60 -D_L13_0017C260 96 -D_L13_0017DDC0 224 -D_L13_0017DEA0 112 -D_L13_0017DF10 28 -D_L13_0017DF30 28 D_L13_0015F740 4 D_L13_0015F750 4 D_L13_0015F754 4 @@ -19132,12 +19133,18 @@ D_L13_0017BED0 4 D_L13_0017BEF0 4 D_L13_0017C0B8 4 D_L13_0017C0F0 4 +D_L13_0017C220 60 +D_L13_0017C260 96 D_L13_0017C640 44 D_L13_0017C660 4 D_L13_0017C664 4 D_L13_0017C740 1 D_L13_0017C980 1 D_L13_0017CD80 1 +D_L13_0017DDC0 224 +D_L13_0017DEA0 112 +D_L13_0017DF10 28 +D_L13_0017DF30 28 D_L13_0017E7D8 28 D_L13_0017E7F4 4 D_L13_0017E804 4 @@ -19497,12 +19504,6 @@ D_L14_0015F728 4 D_L14_0015F72C 4 D_L14_0015F738 4 D_L14_0015F740 4 -D_L14_0017C620 60 -D_L14_0017C660 96 -D_L14_0017E1C0 224 -D_L14_0017E2A0 112 -D_L14_0017E310 28 -D_L14_0017E330 28 D_L14_0015F750 4 D_L14_0015F754 4 D_L14_0015F758 4 @@ -20267,6 +20268,8 @@ D_L14_0017BA88 4 D_L14_0017BA8C 4 D_L14_0017C2D0 4 D_L14_0017C2F0 4 +D_L14_0017C620 60 +D_L14_0017C660 96 D_L14_0017CA40 44 D_L14_0017CA60 4 D_L14_0017CA64 4 @@ -20275,6 +20278,10 @@ D_L14_0017CB60 4 D_L14_0017CB64 4 D_L14_0017CD80 1 D_L14_0017D180 1 +D_L14_0017E1C0 224 +D_L14_0017E2A0 112 +D_L14_0017E310 28 +D_L14_0017E330 28 D_L14_0017EBD8 28 D_L14_0017EBF4 4 D_L14_0017EC04 4 @@ -20736,12 +20743,6 @@ D_L15_0015F728 4 D_L15_0015F72C 4 D_L15_0015F738 4 D_L15_0015F740 4 -D_L15_0017C520 60 -D_L15_0017C560 96 -D_L15_0017E0C0 224 -D_L15_0017E1A0 112 -D_L15_0017E210 28 -D_L15_0017E230 28 D_L15_0015F750 4 D_L15_0015F754 4 D_L15_0015F758 4 @@ -21492,6 +21493,8 @@ D_L15_0017B988 4 D_L15_0017B98C 4 D_L15_0017C1D0 4 D_L15_0017C1F0 4 +D_L15_0017C520 60 +D_L15_0017C560 96 D_L15_0017C940 44 D_L15_0017C960 4 D_L15_0017C964 4 @@ -21500,6 +21503,10 @@ D_L15_0017CA60 4 D_L15_0017CA64 4 D_L15_0017CC80 1 D_L15_0017D080 1 +D_L15_0017E0C0 224 +D_L15_0017E1A0 112 +D_L15_0017E210 28 +D_L15_0017E230 28 D_L15_0017EAD8 28 D_L15_0017EAF4 4 D_L15_0017EB04 4 @@ -21931,12 +21938,6 @@ D_L16_0015F738 4 D_L16_0015F73C 4 D_L16_0015F748 4 D_L16_0015F750 4 -D_L16_0017C380 60 -D_L16_0017C3C0 96 -D_L16_0017DF40 224 -D_L16_0017E020 112 -D_L16_0017E090 28 -D_L16_0017E0B0 28 D_L16_0015F760 4 D_L16_0015F764 4 D_L16_0015F768 4 @@ -22662,12 +22663,18 @@ D_L16_0017B7E8 4 D_L16_0017B7EC 4 D_L16_0017C030 4 D_L16_0017C050 4 +D_L16_0017C380 60 +D_L16_0017C3C0 96 D_L16_0017C7A0 44 D_L16_0017C7C0 4 D_L16_0017C7C4 4 D_L16_0017C8A0 1 D_L16_0017CB00 1 D_L16_0017CF00 1 +D_L16_0017DF40 224 +D_L16_0017E020 112 +D_L16_0017E090 28 +D_L16_0017E0B0 28 D_L16_0017E918 60 D_L16_0017E958 28 D_L16_0017E974 4 @@ -23081,12 +23088,6 @@ D_L17_0015F724 4 D_L17_0015F728 4 D_L17_0015F72C 4 D_L17_0015F738 4 -D_L17_0017C820 60 -D_L17_0017C860 96 -D_L17_0017E3C0 224 -D_L17_0017E4A0 112 -D_L17_0017E510 28 -D_L17_0017E530 28 D_L17_0015F740 4 D_L17_0015F750 4 D_L17_0015F754 4 @@ -23945,12 +23946,18 @@ D_L17_0017BC8C 4 D_L17_0017C15C 4 D_L17_0017C4D0 4 D_L17_0017C4F0 4 +D_L17_0017C820 60 +D_L17_0017C860 96 D_L17_0017CC40 44 D_L17_0017CC60 4 D_L17_0017CC64 4 D_L17_0017CD40 1 D_L17_0017CF80 1 D_L17_0017D380 1 +D_L17_0017E3C0 224 +D_L17_0017E4A0 112 +D_L17_0017E510 28 +D_L17_0017E530 28 D_L17_0017EDD8 28 D_L17_0017EDF4 4 D_L17_0017EE04 4 @@ -24420,12 +24427,6 @@ D_L18_0015F728 4 D_L18_0015F72C 4 D_L18_0015F738 4 D_L18_0015F740 4 -D_L18_0017C920 60 -D_L18_0017C960 96 -D_L18_0017E4C0 224 -D_L18_0017E5A0 112 -D_L18_0017E610 28 -D_L18_0017E630 28 D_L18_0015F750 4 D_L18_0015F754 4 D_L18_0015F758 4 @@ -25169,9 +25170,15 @@ D_L18_0017BD88 4 D_L18_0017BD8C 4 D_L18_0017C5D0 4 D_L18_0017C5F0 4 +D_L18_0017C920 60 +D_L18_0017C960 96 D_L18_0017CD40 44 D_L18_0017D080 1 D_L18_0017D480 1 +D_L18_0017E4C0 224 +D_L18_0017E5A0 112 +D_L18_0017E610 28 +D_L18_0017E630 28 D_L18_0017EED8 28 D_L18_0017EEF4 4 D_L18_0017EF04 4 diff --git a/include/rnc/mobys/animation/moby_anim.h b/include/rnc/mobys/animation/moby_anim.h index aab619bf88..e9f205352e 100644 --- a/include/rnc/mobys/animation/moby_anim.h +++ b/include/rnc/mobys/animation/moby_anim.h @@ -37,7 +37,8 @@ typedef struct { char _pad7D[0x28]; unsigned char saved_seq; /* 0xA5: seq before a blend parked the pose */ char _padA6[0x4A]; - char unkF0[0x10]; /* 0xF0: copied into the pose's D_001B2C00 slot */ + char bounding_sphere + [0x10]; /* 0xF0: animated bounding sphere, copied into the pose's D_001B2C00 slot */ } MobyAnim; #endif /* LOMBYTE_RNC_MOBYS_ANIMATION_MOBY_ANIM_H */ diff --git a/include/rnc/rendering/debug/debug_menu.h b/include/rnc/rendering/debug/debug_menu.h index c9c7defc86..18e5103873 100644 --- a/include/rnc/rendering/debug/debug_menu.h +++ b/include/rnc/rendering/debug/debug_menu.h @@ -45,7 +45,7 @@ typedef struct { s32 unknown_94; s32 unknown_98; s32 unknown_9c; - s32 unknown_a0; + s32 previous_step_held_buttons; /* single-step input (handle_pause_input) */ s32 unknown_a4; s32 unknown_a8; s32 unknown_ac; @@ -64,7 +64,7 @@ typedef struct { s32 unknown_e0; s32 unknown_e4; s32 unknown_e8; - s32 unknown_ec; + s32 single_step_mode_countdown; /* frames until single-step mode (update_flags 0x10) */ s32 battle_camera_enabled; s32 actuator_enabled; u8 start_capture_status; diff --git a/include/rnc/rendering/draw_config.h b/include/rnc/rendering/draw_config.h index dcac02da00..88be8a3d0b 100644 --- a/include/rnc/rendering/draw_config.h +++ b/include/rnc/rendering/draw_config.h @@ -15,13 +15,13 @@ struct DrawPass { */ struct DrawConfig { s32 unk0; - s32 unk4; + s32 sky_gif_paging; /* do_sky_gif_paging flushes the texture uploads */ s32 sky; - struct DrawPass tfrag; /* 0xC */ - struct DrawPass tie; /* 0x14 */ - struct DrawPass shrub; /* 0x1C */ - struct DrawPass moby; /* 0x24 */ - s32 unk2C; + struct DrawPass tfrag; /* 0xC */ + struct DrawPass tie; /* 0x14 */ + struct DrawPass shrub; /* 0x1C */ + struct DrawPass moby; /* 0x24 */ + s32 gif_paging; /* do_gif_paging flushes the texture uploads */ s32 effects_program; /* loads the effects VU1 program */ s32 effects; /* effect callbacks, lens flare, light quads */ s32 particles; diff --git a/include/rnc/rendering/texture_upload.h b/include/rnc/rendering/texture_upload.h index dcdeeba112..1ed6f33110 100644 --- a/include/rnc/rendering/texture_upload.h +++ b/include/rnc/rendering/texture_upload.h @@ -7,8 +7,8 @@ count in D_0015F458). Queued by register_8bit_texture, load_texture_file and get_frame_texture; the block fields are the TEX0 values they return. */ struct TextureUpload { - s32 clut_data; /* 0x00: EE address of the CLUT (load_texture_file: texture CLUT pointer) */ - s16 unk4; /* 0x04: every writer stores 0 */ + s32 clut_data; /* 0x00: EE address of the CLUT (load_texture_file: texture CLUT pointer) */ + s16 clut_psm; /* 0x04: BITBLTBUF.DPSM of the CLUT transfer (FUN_0020b4a8); writers store 0, PSMCT32 */ s16 cbp; /* 0x06: GS block of the CLUT, TEX0.CBP */ s32 image_data; /* 0x08: EE address of the pixels (load_texture_file: texture pixel pointer) */ u8 tw; /* 0x0C: log2 width, TEX0.TW */ diff --git a/include/rnc/sdk/libmpeg.h b/include/rnc/sdk/libmpeg.h index 9284dae84b..8dda6b109a 100644 --- a/include/rnc/sdk/libmpeg.h +++ b/include/rnc/sdk/libmpeg.h @@ -73,12 +73,12 @@ struct MpegMbBuffer { MpegMcFunc chroma_func[4]; /* D_00132E50[] copy routine per fetch */ struct MpegMcFetch luma[4]; struct MpegMcFetch chroma[4]; - s32 unk128; /* read by _doMC */ + u8 *output; /* _doMC writes the macroblock here */ s32 fetch_count; /* queued fetches; loop count in _doMC */ - s32 unk130; /* read by _doMC */ + s32 intra; /* "intra && skip MB" is an error in _doMC */ u8 pad_134[0x4]; - s32 unk138; /* _doMC skips the work when 0 */ - s32 unk13C; /* set 1 by _decMB0/_skipMB0, 0 by _slice0 */ + s32 unk138; /* _doMC skips the work when 0 */ + s32 no_coded_blocks; /* skipped, or neither intra nor pattern (_decMB0) */ }; struct MpegDecoder { @@ -88,7 +88,7 @@ struct MpegDecoder { u8 pad_C[0x40]; u8 ipu_dma_state; /* &ipu_dma_state passed to suspend_mpeg_decoder_ipu_dma */ u8 pad_4D[0x33]; - s32 unk80; + s32 displayed_pts; /* pts low word of the last output picture; -1 after a reset */ u8 pad_84[0x4]; u64 unk88; u8 pad_90[0x4]; @@ -99,7 +99,7 @@ struct MpegDecoder { s32 picture_count_p; s32 picture_count_b; s32 frame_base; /* sceMpeg.frameCount = frame_count - frame_base (_sceMpegFlush) */ - s32 unkB0; /* non-zero: _dispRefImage uses _csc_storeRefImage, else _cpr8 */ + s32 csc_output; /* non-zero: _dispRefImage converts colour (_csc_storeRefImage), else _cpr8 copies raw */ s32 unkB4; s32 unkB8; s32 unkBC; @@ -109,7 +109,7 @@ struct MpegDecoder { s32 unkCC; s32 unkD0; s32 first_field_structure; /* picture_structure of a frame's first picture; 0 in _sequenceHeader */ - s32 unkD8; /* output address (_cpr8 masks it to physical) */ + s32 image_buffer; /* sceMpegGetPicture output; 64-byte aligned (_getpic) */ /* Output size limits, checked by _isOutSizeOK against the picture. */ s32 out_max_width; /* >= picture width when out_max_height != 0 */ @@ -158,26 +158,29 @@ struct MpegDecoder { s32 repeat_first_field; s32 progressive_frame; - u8 pad_18C[0x20]; - s32 unk1AC; - s32 dc_reset; /* DCR bit of the IPU BDEC command (_decMB0); set by _skipMB0 */ + u8 pad_18C[0x20]; + s32 temporal_reference; /* picture_header temporal_reference plus temporal_reference_base, unwrapped */ + s32 dc_reset; /* DCR bit of the IPU BDEC command (_decMB0); set by _skipMB0 */ s32 quantiser_scale_code; /* 5 bits from the slice header (_sliceB); QSC of BDEC */ struct MpegRefImage *ref_images[12]; /* chosen by picture_structure / picture_coding_type in _outputFrame */ u8 pad_1E8[0x3A8]; struct MpegMbBuffer mb_buf[2]; s32 mb_buf_index; /* toggled per slice in _slice0 */ - u8 pad_814[0x8]; - u8 *mc_work; /* _getRef0: destination of the queued fetches */ - s32 picture_ready; /* _getpic returns once a picture is out */ - u8 pad_824[0x1C]; + u8 pad_814[0x4]; + s32 ipu_command_class; /* IpuCommandTable[] of the last IPU command */ + u8 *mc_work; /* _getRef0: destination of the queued fetches */ + s32 picture_ready; /* _getpic returns once a picture is out */ + u8 pad_824[0x14]; + s32 bit_window; /* IPU_TOP after the last command */ + s32 available_bit_count; /* valid bits in bit_window */ /* quant_matrix_extension / sequence_header */ s32 load_intra_quantiser_matrix; /* set -> IPU SETIQ intra (0x50000000) */ s32 load_non_intra_quantiser_matrix; /* set -> IPU SETIQ non-intra (0x58000000) */ s32 mpeg2; /* set by sequence_extension; 0: _sequenceHeader loads MPEG-1 defaults */ - s32 unk84C; - s32 unk850; + s32 temporal_reference_base; + s32 max_temporal_reference; s32 unk854; struct sceMpeg *mpeg; /* owning sceMpeg (_dispRefImage writes its pts/dts/flags) */ }; diff --git a/include/rnc/ui/menus/menu_screen.h b/include/rnc/ui/menus/menu_screen.h index 0b940d8675..2db05090b4 100644 --- a/include/rnc/ui/menus/menu_screen.h +++ b/include/rnc/ui/menus/menu_screen.h @@ -61,8 +61,8 @@ struct MenuMissionListData { }; /* Item grid screen (draw_menu_item_grid). Cell frames: +1 equipped, - +2 locked, +4 D_0013E520. Locked: flags 4 / 8 with menu_system.unk138 / - unk134 set. The up/down/left/right screens take the focus when the cursor + +2 locked, +4 D_0013E520. Locked: flags 4 / 8 with menu_system.pack_gadgets_hidden / + head_gadgets_hidden set. The up/down/left/right screens take the focus when the cursor leaves the grid on that side (update_menu_grid_selection). */ struct MenuGridCell { u16 icon; /* 0x0: get_icon_frame icon */ @@ -317,12 +317,14 @@ struct MenuLabelData { #define MENU_LIST_SHRINK_TO_FIT 0x20000 /* switches to the small font when too wide */ /* MenuItemGridData.flags (update_menu_grid_selection, draw_menu_item_grid). */ -#define MENU_GRID_NO_CONFIRM 0x1 -#define MENU_GRID_FIXED_ROW_STEP 0x2 -#define MENU_GRID_HIDDEN_WITH_UNK138 0x4 /* skipped, cells locked while menu_system.unk138 */ -#define MENU_GRID_HIDDEN_WITH_UNK134 0x8 /* skipped, cells locked while menu_system.unk134 */ -#define MENU_GRID_NO_EQUIPPED_FRAME 0x20 -#define MENU_GRID_NO_WRAP 0x8000 +#define MENU_GRID_NO_CONFIRM 0x1 +#define MENU_GRID_FIXED_ROW_STEP 0x2 +#define MENU_GRID_HIDDEN_WITH_PACK_GADGETS \ + 0x4 /* skipped, cells locked while menu_system.pack_gadgets_hidden */ +#define MENU_GRID_HIDDEN_WITH_HEAD_GADGETS \ + 0x8 /* skipped, cells locked while menu_system.head_gadgets_hidden */ +#define MENU_GRID_NO_EQUIPPED_FRAME 0x20 +#define MENU_GRID_NO_WRAP 0x8000 /* MenuStreamData.flags (update_menu_resource_stream, update_menu_stream_image). */ #define MENU_STREAM_FIXED_ENTRY 0x1 diff --git a/include/rnc/ui/menus/menu_system.h b/include/rnc/ui/menus/menu_system.h index 60276471ce..f1d3b3bd94 100644 --- a/include/rnc/ui/menus/menu_system.h +++ b/include/rnc/ui/menus/menu_system.h @@ -61,8 +61,9 @@ struct MenuPage { * toggle == 0), then stored negated (load_hand_gadget, update_item_preview_binding); * load_hand_gadget builds the preview moby once preview_loaded_class equals the * selected class. - * - unk134 / unk138: while set, pages with flags 8 / 4 are skipped - * (find_next_pause_page) and grid items with those flags draw frame +2. + * - head_gadgets_hidden / pack_gadgets_hidden: while set, the grids flagged 8 / 4 + * (pause_head_gadget_grid / pause_pack_gadget_grid) are skipped by + * find_next_pause_page and their cells draw frame +2. * - The buffer addresses (graphics_workspace, first_base..stream_buffer_base) are carved from * D_001940C0[1] / [2] by FUN_00218f98. */ @@ -124,12 +125,12 @@ struct MenuSystem { s32 preview_requested_class; /* 0x11C: an oclass, -1 none */ s32 preview_loaded_class; /* 0x120: an oclass, -1 none */ - s32 close_locked; /* 0x124: nonzero blocks start/back closing the menu */ - s32 card_op_pending; /* 0x128: card save/load started, waiting for the card */ - s32 card_op_text; /* 0x12C: text shown while pending (0x4FB5 save, 0x4FB6 load) */ - s32 saved_decode_mode; /* 0x130: decode_mode before a menu movie */ - s32 unk134; /* 0x134: hides pages / items with flags 8 */ - s32 unk138; /* 0x138: hides pages / items with flags 4 */ + s32 close_locked; /* 0x124: nonzero blocks start/back closing the menu */ + s32 card_op_pending; /* 0x128: card save/load started, waiting for the card */ + s32 card_op_text; /* 0x12C: text shown while pending (0x4FB5 save, 0x4FB6 load) */ + s32 saved_decode_mode; /* 0x130: decode_mode before a menu movie */ + s32 head_gadgets_hidden; /* 0x134: Oltanis Orbit or D_0014161B (pause_all_sounds) */ + s32 pack_gadgets_hidden; /* 0x138: Veldin 1 or Oltanis (pause_all_sounds) */ s32 card_icon_hidden; /* 0x13C: set by pause_all_sounds; the level loop skips the busy card icon while set */ s32 resource_table_class; /* 0x140: oclass at the last resource table select */ s32 last_resource_table_toggle; /* 0x144: resource_table_toggle at the last select */ diff --git a/src/audio/voices/pause_all_sounds.c b/src/audio/voices/pause_all_sounds.c index ff13ec6b16..3a20f271c3 100644 --- a/src/audio/voices/pause_all_sounds.c +++ b/src/audio/voices/pause_all_sounds.c @@ -54,11 +54,13 @@ void pause_all_sounds(s32 menu_state) { } { struct MenuSystem *g = &menu_system; - g->unk134 = *(volatile s32 *)¤t_level_index == LEVEL_OLTANIS_ORBIT || D_0014161B != 0; + g->head_gadgets_hidden = + *(volatile s32 *)¤t_level_index == LEVEL_OLTANIS_ORBIT || D_0014161B != 0; } { struct MenuSystem *g = &menu_system; - g->unk138 = current_level_index == LEVEL_VELDIN1 || current_level_index == LEVEL_OLTANIS; + g->pack_gadgets_hidden = + current_level_index == LEVEL_VELDIN1 || current_level_index == LEVEL_OLTANIS; } { struct MenuSystem *g = &menu_system; @@ -376,7 +378,7 @@ struct MenuGridScreen pause_hand_gadget_grid = { struct MenuGridScreen pause_pack_gadget_grid = { {update_menu_grid_selection, draw_menu_item_grid, find_next_pause_page}, - {MENU_GRID_HIDDEN_WITH_UNK138, + {MENU_GRID_HIDDEN_WITH_PACK_GADGETS, 0.1f, 0.1f, 0, 1, 3, pause_pack_gadget_cells, @@ -386,7 +388,7 @@ struct MenuGridScreen pause_pack_gadget_grid = { struct MenuGridScreen pause_head_gadget_grid = { {update_menu_grid_selection, draw_menu_item_grid, find_next_pause_page}, - {MENU_GRID_HIDDEN_WITH_UNK134, + {MENU_GRID_HIDDEN_WITH_HEAD_GADGETS, 0.1f, 0.1f, 0, 1, 3, pause_head_gadget_cells, diff --git a/src/check/menu_layout_check.c b/src/check/menu_layout_check.c index 8757b11a0d..bb9c83b3cd 100644 --- a/src/check/menu_layout_check.c +++ b/src/check/menu_layout_check.c @@ -45,7 +45,7 @@ CHECK(MenuSystem, resource_table_toggle, resource_table_toggle, 0x118); CHECK(MenuSystem, close_locked, close_locked, 0x124); CHECK(MenuSystem, card_op_pending, card_op_pending, 0x128); CHECK(MenuSystem, card_op_text, card_op_text, 0x12C); -CHECK(MenuSystem, unk138, unk138, 0x138); +CHECK(MenuSystem, pack_gadgets_hidden, pack_gadgets_hidden, 0x138); CHECK(MenuSystem, last_resource_table_toggle, last_resource_table_toggle, 0x144); SIZE_CHECK(MenuSystem, 0x148); diff --git a/src/check/mpeg_layout_check.c b/src/check/mpeg_layout_check.c index 9af2c8bd8f..0f24b12f69 100644 --- a/src/check/mpeg_layout_check.c +++ b/src/check/mpeg_layout_check.c @@ -15,16 +15,16 @@ OFFSET_CHECK(ref_status, struct MpegRefImage, status, 0x28); OFFSET_CHECK(ref_unk60, struct MpegRefImage, unk60, 0x60); OFFSET_CHECK(mb_ipu_out, struct MpegMbBuffer, ipu_out, 0x4); OFFSET_CHECK(mb_chroma, struct MpegMbBuffer, chroma, 0xB8); -OFFSET_CHECK(mb_unk128, struct MpegMbBuffer, unk128, 0x128); +OFFSET_CHECK(mb_output, struct MpegMbBuffer, output, 0x128); OFFSET_CHECK(mb_fetch_count, struct MpegMbBuffer, fetch_count, 0x12C); -OFFSET_CHECK(mb_unk13C, struct MpegMbBuffer, unk13C, 0x13C); +OFFSET_CHECK(mb_no_coded_blocks, struct MpegMbBuffer, no_coded_blocks, 0x13C); SIZE_CHECK(mb_buffer, struct MpegMbBuffer, 0x140); OFFSET_CHECK(ipu_dma_state, struct MpegDecoder, ipu_dma_state, 0x4C); -OFFSET_CHECK(unk80, struct MpegDecoder, unk80, 0x80); +OFFSET_CHECK(displayed_pts, struct MpegDecoder, displayed_pts, 0x80); OFFSET_CHECK(unk88, struct MpegDecoder, unk88, 0x88); OFFSET_CHECK(frame_base, struct MpegDecoder, frame_base, 0xAC); -OFFSET_CHECK(unkD8, struct MpegDecoder, unkD8, 0xD8); +OFFSET_CHECK(image_buffer, struct MpegDecoder, image_buffer, 0xD8); OFFSET_CHECK(out_max_width, struct MpegDecoder, out_max_width, 0xDC); OFFSET_CHECK(out_max_size, struct MpegDecoder, out_max_size, 0xE4); OFFSET_CHECK(unkF8, struct MpegDecoder, unkF8, 0xF8); @@ -39,7 +39,7 @@ OFFSET_CHECK(picture_coding_type, struct MpegDecoder, picture_coding_type, 0x150 OFFSET_CHECK(f_code_forward_h, struct MpegDecoder, f_code_forward_h, 0x164); OFFSET_CHECK(picture_structure, struct MpegDecoder, picture_structure, 0x174); OFFSET_CHECK(progressive_frame, struct MpegDecoder, progressive_frame, 0x188); -OFFSET_CHECK(unk1AC, struct MpegDecoder, unk1AC, 0x1AC); +OFFSET_CHECK(temporal_reference, struct MpegDecoder, temporal_reference, 0x1AC); OFFSET_CHECK(quantiser_scale_code, struct MpegDecoder, quantiser_scale_code, 0x1B4); OFFSET_CHECK(ref_images, struct MpegDecoder, ref_images, 0x1B8); OFFSET_CHECK(mb_buf, struct MpegDecoder, mb_buf, 0x590); diff --git a/src/mobys/animation/blend_moby_animation.c b/src/mobys/animation/blend_moby_animation.c index a19b4231f7..53ffae4f34 100644 --- a/src/mobys/animation/blend_moby_animation.c +++ b/src/mobys/animation/blend_moby_animation.c @@ -32,7 +32,7 @@ void blend_moby_animation(MobyAnim *moby, int new_seq, int frame_index, int blen slot = find_or_allocate_moby_render_slot((int)moby); if (slot >= 0) { FUN_0020ede8(moby, slot | 0x300); - qcopy(D_001B2C00 + slot * 0x10, moby->unkF0); + qcopy(D_001B2C00 + slot * 0x10, moby->bounding_sphere); oldSeq = moby->seq; if (oldSeq != 0xFF) { moby->saved_seq = oldSeq; diff --git a/src/mobys/animation/blend_moby_animation_ex.c b/src/mobys/animation/blend_moby_animation_ex.c index 4e0eccdefb..20536ac8f3 100644 --- a/src/mobys/animation/blend_moby_animation_ex.c +++ b/src/mobys/animation/blend_moby_animation_ex.c @@ -13,7 +13,7 @@ extern void FUN_0020ede8(void *, int); find_or_allocate_moby_render_slot) when it hasn't settled yet (anim_time > 0.025, or pose_layers/manips nonzero) or the caller forces it (arg4 & 4): builds a flags byte from arg4 bits 0/1 (0x100/0x200), hands it to FUN_0020ede8, snapshots this - moby's unkF0 vector into the matching D_001B2C00 slot, remembers the + moby's bounding_sphere into the matching D_001B2C00 slot, remembers the old seq in saved_seq (unless it was already 0xFF), then marks seq 0xFF and frame = slot. Either way it then sets nextFrame/prevSeq from arg2/arg1, refreshes frame pointers (update_moby_animation_state), arms the timer (anim_speed = 1), @@ -39,7 +39,7 @@ void blend_moby_animation_ex( if (slot >= 0) { pose_slot_and_flags = (options & 1) ? (slot | 0x100) : slot; FUN_0020ede8(moby, (options & 2) ? (pose_slot_and_flags | 0x200) : pose_slot_and_flags); - qcopy(D_001B2C00 + slot * 0x10, moby->unkF0); + qcopy(D_001B2C00 + slot * 0x10, moby->bounding_sphere); oldSeq = moby->seq; if (oldSeq != 0xFF) { moby->saved_seq = oldSeq; diff --git a/src/overlays/l12/mobys/scrolling_texture_layers.c b/src/overlays/l12/mobys/scrolling_texture_layers.c index e73cbfda21..b576f81d44 100644 --- a/src/overlays/l12/mobys/scrolling_texture_layers.c +++ b/src/overlays/l12/mobys/scrolling_texture_layers.c @@ -2557,8 +2557,79 @@ extern float hoven_scrolling_layer_phase_rates[1] __asm__("D_L12_001620E0") __at extern float hoven_scrolling_clipped_uv_scroll_rates[2] __asm__("D_L12_001620D8") __attribute__((sda)); extern float frame_delta_time __asm__("D_0015ED7C") MACRO_ADDR; -extern int *hoven_scrolling_color_tables[] __asm__("D_L12_00208AE0"); -extern int hoven_scrolling_color_table_entry_counts[] __asm__("D_L12_00205A80"); + +int hoven_scrolling_colors_0[12] __asm__("D_L12_00208548") = {0x7f7f7f7f, + 0x7f7f7f7f, + 0x7f7f7f7f, + 0x7f7f7f7f, + 0x7f7f7f7f, + 0x7f7f7f7f, + 0x7f7f7f7f, + 0x7f7f7f7f, + 0x7f7f7f7f, + 0x7f7f7f7f, + 0x7f7f7f7f, + 0x7f7f7f7f}; + +int hoven_scrolling_colors_1[40] __asm__("D_L12_00208578") = { + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f}; + +int hoven_scrolling_colors_2[105] __asm__("D_L12_00208618") = { + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f}; + +int hoven_scrolling_colors_3[148] __asm__("D_L12_002087C0") = { + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f}; + +int hoven_scrolling_colors_4[33] __asm__("D_L12_00208A10") = { + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, + 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f}; + +int *hoven_scrolling_color_tables[5] __asm__("D_L12_00208AE0") = {hoven_scrolling_colors_0, + hoven_scrolling_colors_1, + hoven_scrolling_colors_2, + hoven_scrolling_colors_3, + hoven_scrolling_colors_4}; + +int hoven_scrolling_color_table_entry_counts[5] __asm__("D_L12_00205A80") = {12, 40, 105, 148, 33}; + extern void scale_rgba_tables(void *, int, void *, float, float, float, float, int) __asm__("FUN_L08_002f0f68"); diff --git a/src/overlays/shared/camera/grindrail_camera.c b/src/overlays/shared/camera/grindrail_camera.c index 59c7bd4970..169d674f91 100644 --- a/src/overlays/shared/camera/grindrail_camera.c +++ b/src/overlays/shared/camera/grindrail_camera.c @@ -60,11 +60,11 @@ typedef struct { } CameraBlend; typedef struct { - Vec4 axis; /* 0x00 */ - f32 position_rate; /* 0x10: eased toward the path node speed */ - f32 unk14; /* 0x14 */ - s32 unk18; /* 0x18 */ - s16 mode; /* 0x1C */ + Vec4 axis; /* 0x00 */ + f32 position_rate; /* 0x10: eased toward the path node speed */ + f32 position_damping; /* 0x14: the update passes 0.175 with position_rate */ + s32 position_max_step; /* 0x18 */ + s16 mode; /* 0x1C */ u8 pad1E[2]; f32 unk20; /* 0x20 */ s32 unk24; /* 0x24 */ @@ -150,8 +150,8 @@ void reset_camera_state_and_prepare_preset_paths(Camera *destination_camera) { spring->height = 2.0f; orbit = destination_camera->orbit; orbit->position_rate = 0.01f; - orbit->unk14 = 0.175f; - orbit->unk18 = 0; + orbit->position_damping = 0.175f; + orbit->position_max_step = 0; orbit->mode = 0; orbit->unk20 = 0.0005f; orbit->unk24 = 0; diff --git a/src/rendering/effects/get_effect_texture.c b/src/rendering/effects/get_effect_texture.c index 3b8c26ecdf..c4e143b4df 100644 --- a/src/rendering/effects/get_effect_texture.c +++ b/src/rendering/effects/get_effect_texture.c @@ -56,7 +56,7 @@ u64 get_effect_texture(s32 index) { upload->clut_data = level_texture_payload_address + texture->palette_offset_quadwords * 0x10; upload->cbp = palette_block_offset; - upload->unk4 = 0; + upload->clut_psm = 0; *(s32 *)((u8 *)pending_texture_uploads + pending_texture_upload_count_snapshot * 0x10 + 8) = level_texture_payload_address + texture->texel_offset_quadwords * 0x10; upload->tw = (u8)texture->width_log2; diff --git a/src/rendering/sky/do_sky_gif_paging.c b/src/rendering/sky/do_sky_gif_paging.c index 4e1ad56cfc..9c43a55413 100644 --- a/src/rendering/sky/do_sky_gif_paging.c +++ b/src/rendering/sky/do_sky_gif_paging.c @@ -1,10 +1,10 @@ #include "types.h" #include "rnc/rendering/dma_tag.h" +#include "rnc/rendering/draw_config.h" extern struct TagPtr D_00160470; extern struct TagPtr sky_gif_paging_bypass_tag __asm__("D_00160474"); -extern s32 D_0018A2B4[]; #include "rnc/globals.h" @@ -24,7 +24,7 @@ void do_sky_gif_paging(void) { D_00160470.p->addr = (u32)render_packet_cursor.tag; D_00160470.p->vif0 = 0; D_00160470.p->vif1 = 0; - if (D_0018A2B4[0] != 0) { + if (draw_config.sky_gif_paging != 0) { FUN_0020b4a8(); vu1_tex_flush(); } diff --git a/src/rendering/texture/do_gif_paging.c b/src/rendering/texture/do_gif_paging.c index 1e7b31f413..591309d29e 100644 --- a/src/rendering/texture/do_gif_paging.c +++ b/src/rendering/texture/do_gif_paging.c @@ -1,13 +1,13 @@ #include "types.h" #include "rnc/rendering/dma_tag.h" +#include "rnc/rendering/draw_config.h" struct GifPaging { struct DmaTag *start; struct DmaTag *end; }; -extern s32 D_0018A2DC[]; extern void FUN_0020b4a8(void); extern void vu1_tex_flush(void) __asm__("func_00233B68"); @@ -26,7 +26,7 @@ void do_gif_paging(void) { gif_page_marker.start->addr = (u32)render_packet_cursor.tag; gif_page_marker.start->vif0 = 0; gif_page_marker.start->vif1 = 0; - if (D_0018A2DC[0] != 0) { + if (draw_config.gif_paging != 0) { FUN_0020b4a8(); vu1_tex_flush(); } diff --git a/src/rendering/texture/get_frame_texture.c b/src/rendering/texture/get_frame_texture.c index bb1defec2b..15e7de8670 100644 --- a/src/rendering/texture/get_frame_texture.c +++ b/src/rendering/texture/get_frame_texture.c @@ -70,7 +70,7 @@ u64 get_frame_texture(s32 frame_id) { palette_source_address = palette_page->source_address; initial_packet = pending_texture_uploads + pending_texture_upload_count; initial_packet->clut_data = palette_source_address; - initial_packet->unk4 = 0; + initial_packet->clut_psm = 0; initial_packet->cbp = 0x3FF0; *(s32 *)((u8 *)pending_texture_uploads + packet_offset + 8) = palette_page->source_address; initial_packet->tw = 5; @@ -85,7 +85,7 @@ u64 get_frame_texture(s32 frame_id) { queued_transfer = 1; palette_packet = pending_texture_uploads + pending_texture_upload_count; palette_packet->clut_data = palette_page->source_address; - palette_packet->unk4 = 0; + palette_packet->clut_psm = 0; palette_packet->cbp = palette_page->gs_block_offset; } } diff --git a/src/rendering/texture/load_texture_file.c b/src/rendering/texture/load_texture_file.c index 9caff6a468..6d478d59d0 100644 --- a/src/rendering/texture/load_texture_file.c +++ b/src/rendering/texture/load_texture_file.c @@ -60,7 +60,7 @@ long load_texture_file(char *texture_file_data) { pending_texture_uploads[pending_texture_upload_count_macro].clut_data = (int)texture_desc.clut; pending_texture_uploads[pending_texture_upload_count_macro].cbp = cbp; - pending_texture_uploads[pending_texture_upload_count_macro].unk4 = 0; + pending_texture_uploads[pending_texture_upload_count_macro].clut_psm = 0; pending_texture_uploads[pending_texture_upload_count_macro].image_data = (int)texture_desc.pix; pending_texture_uploads[pending_texture_upload_count_macro].tw = texture_desc.tw; diff --git a/src/rendering/texture/register_8bit_texture.c b/src/rendering/texture/register_8bit_texture.c index b4476a4651..6f90e082fd 100644 --- a/src/rendering/texture/register_8bit_texture.c +++ b/src/rendering/texture/register_8bit_texture.c @@ -26,7 +26,7 @@ long register_8bit_texture(s32 tw, s32 th, s32 clut_data, s32 image_data, s32 cb if (pending_texture_upload_count_macro < TEXTURE_UPLOAD_MAX) { pending_texture_uploads[pending_texture_upload_count_macro].clut_data = clut_data; pending_texture_uploads[pending_texture_upload_count_macro].cbp = cbp; - pending_texture_uploads[pending_texture_upload_count_macro].unk4 = 0; + pending_texture_uploads[pending_texture_upload_count_macro].clut_psm = 0; pending_texture_uploads[pending_texture_upload_count_macro].image_data = image_data; pending_texture_uploads[pending_texture_upload_count_macro].tw = tw; pending_texture_uploads[pending_texture_upload_count_macro].th = th; diff --git a/src/sdk/input/dbc/scedbcreceivedata.c b/src/sdk/input/dbc/scedbcreceivedata.c index 86e816f89b..a271b86073 100644 --- a/src/sdk/input/dbc/scedbcreceivedata.c +++ b/src/sdk/input/dbc/scedbcreceivedata.c @@ -6,9 +6,9 @@ struct DbCState { s32 unk0; s32 unk4; - s32 unk8; + s32 byte_count; u8 payload[0x80]; - s32 unk8C; + s32 result; }; const char dbc_receive_rpc_error_message[] __asm__("D_001536A0") = "sceDbcReceiveData: rpc error\n"; @@ -24,7 +24,7 @@ s32 sceDbcReceiveData(s32 rpc_request_word_0, rpc_transfer_buffer->unk0 = rpc_request_word_0; rpc_transfer_buffer->unk4 = rpc_request_word_1; - rpc_transfer_buffer->unk8 = *byte_count; + rpc_transfer_buffer->byte_count = *byte_count; if (sceSifCallRpc(&RpcQueueData, 0x8000091A, 0, @@ -37,17 +37,17 @@ s32 sceDbcReceiveData(s32 rpc_request_word_0, debug_print_stub(dbc_receive_rpc_error_message); return 0; } - if (rpc_transfer_buffer->unk8C < 0) { - return rpc_transfer_buffer->unk8C; + if (rpc_transfer_buffer->result < 0) { + return rpc_transfer_buffer->result; } - *byte_count = rpc_transfer_buffer->unk8; + *byte_count = rpc_transfer_buffer->byte_count; i = 0; - if (rpc_transfer_buffer->unk8 > 0) { + if (rpc_transfer_buffer->byte_count > 0) { do { destination[i] = rpc_transfer_buffer->payload[i]; i++; - } while (i < rpc_transfer_buffer->unk8); - return rpc_transfer_buffer->unk8C; + } while (i < rpc_transfer_buffer->byte_count); + return rpc_transfer_buffer->result; } - return *(volatile s32 *)&rpc_transfer_buffer->unk8C; + return *(volatile s32 *)&rpc_transfer_buffer->result; } diff --git a/src/sdk/input/sce_pad2_check_dma.c b/src/sdk/input/sce_pad2_check_dma.c index e8c50dce62..fca2c5dbcc 100644 --- a/src/sdk/input/sce_pad2_check_dma.c +++ b/src/sdk/input/sce_pad2_check_dma.c @@ -2,7 +2,7 @@ typedef struct PadPort { u8 pad[0xC]; - u8 *unkC; + u8 *dma_buffer; u8 pad2[816 - 0x10]; } PadPort; @@ -20,7 +20,7 @@ s32 scePad2CheckDma(s32 socket_index) { u32 dma_buffer_base; s32 bank_zero_sequence; - dma_buffer_base = (u32)D_0015B540[socket_index].unkC; + dma_buffer_base = (u32)D_0015B540[socket_index].dma_buffer; bank_zero_sequence = *(s32 *)(dma_buffer_base + 0x7C); sides[0] = dma_buffer_base; sides[1] = dma_buffer_base + 0x80; diff --git a/src/sdk/input/sce_pad2_get_side.c b/src/sdk/input/sce_pad2_get_side.c index 39f256237a..7dff642350 100644 --- a/src/sdk/input/sce_pad2_get_side.c +++ b/src/sdk/input/sce_pad2_get_side.c @@ -2,7 +2,7 @@ typedef struct PadPort { u8 pad[0xC]; - u8 *unkC; + u8 *dma_buffer; u8 pad2[816 - 0x10]; } PadPort; @@ -12,7 +12,7 @@ extern void SyncDCache(s32, s32) __asm__("func_00118F88"); void *scePad2GetSide(s32 port_index) { u8 *sides[2]; - sides[0] = D_0015B540[port_index].unkC; + sides[0] = D_0015B540[port_index].dma_buffer; sides[1] = sides[0] + 0x80; SyncDCache((s32)sides[0], (s32)(sides[0] + 0x100)); return sides[*(s32 *)(sides[0] + 0x7C) < *(s32 *)(sides[1] + 0x7C)]; diff --git a/src/sdk/input/sce_pad2_link_driver.c b/src/sdk/input/sce_pad2_link_driver.c index 52cfddb81b..7021b25a83 100644 --- a/src/sdk/input/sce_pad2_link_driver.c +++ b/src/sdk/input/sce_pad2_link_driver.c @@ -2,8 +2,8 @@ struct Pad { u8 pad[4]; - s32 unk4; - s32 unk8; + s32 linked; + s32 dep_number; u8 rest[0x324]; }; @@ -15,7 +15,7 @@ s32 scePad2LinkDriver(s32 socket_index) { dep = sceDbcGetDepNumber(); if (dep < 0) return dep; - D_0015B540[socket_index].unk8 = dep; - D_0015B540[socket_index].unk4 = 1; + D_0015B540[socket_index].dep_number = dep; + D_0015B540[socket_index].linked = 1; return dep; } diff --git a/src/sdk/input/sce_pad2_read.c b/src/sdk/input/sce_pad2_read.c index 2daf64d867..91b5fbf278 100644 --- a/src/sdk/input/sce_pad2_read.c +++ b/src/sdk/input/sce_pad2_read.c @@ -4,7 +4,7 @@ struct Pad2Data { u8 pad_0[0x2]; - u8 unk2; + u8 data_length; u8 pad_3[0x1]; s32 unk4; }; @@ -25,15 +25,16 @@ s32 scePad2Read(s32 port, u8 *pad_input_destination) { } } side = scePad2GetSide(port); - if (side->unk2 != 0) { + if (side->data_length != 0) { pad_input_payload = (u8 *)side + 0x1C; if (pad_input_payload != NULL) { - memcpy(pad_input_destination, pad_input_payload, side->unk2); - scePad2SetButtonOrder((u8 *)side + (side->unk2 + 0x1C), D_0015B550 + port * 0x330); + memcpy(pad_input_destination, pad_input_payload, side->data_length); + scePad2SetButtonOrder((u8 *)side + (side->data_length + 0x1C), + D_0015B550 + port * 0x330); } } if (side->unk4 == 0) { return -1; } - return side->unk2; + return side->data_length; } diff --git a/src/sdk/ipu/ipu_vdec.c b/src/sdk/ipu/ipu_vdec.c index 23e4c6960d..30a8a678f3 100644 --- a/src/sdk/ipu/ipu_vdec.c +++ b/src/sdk/ipu/ipu_vdec.c @@ -4,12 +4,12 @@ typedef struct { u8 pad0[0x11C]; - s32 unk11C; + s32 slice_error; u8 pad120[0x6F8]; - s32 unk818; + s32 ipu_command_class; u8 pad81C[0x1C]; - s32 unk838; - s32 unk83C; + s32 bit_window; + s32 available_bit_count; u8 pad840[0x18]; void *cbData; } MpegDec; @@ -37,7 +37,7 @@ s32 _ipuVdec(MpegDec *decoder, s32 vlc_table_selector) { } cmd = (vlc_table_selector << 26) | 0x30000000; *(volatile u32 *)IPU_CMD = cmd; - decoder->unk818 = IpuCommandTable[(s32)cmd >> 28]; + decoder->ipu_command_class = IpuCommandTable[(s32)cmd >> 28]; command_result = *IPU_CMD; while (command_result < 0) { if (i++ > 5000) { @@ -48,12 +48,12 @@ s32 _ipuVdec(MpegDec *decoder, s32 vlc_table_selector) { } bp = *IPU_BP; top = *IPU_TOP; - decoder->unk838 = top; + decoder->bit_window = top; if (top < 0) { - decoder->unk83C = -(bp & 0x1F) & 0x1F; + decoder->available_bit_count = -(bp & 0x1F) & 0x1F; } else { - decoder->unk83C = 32; + decoder->available_bit_count = 32; } - decoder->unk11C = (s32)command_result == 0; + decoder->slice_error = (s32)command_result == 0; return (s16)command_result; } diff --git a/src/sdk/ipu/wait_bdec_out.c b/src/sdk/ipu/wait_bdec_out.c index 18846cecd4..51be501809 100644 --- a/src/sdk/ipu/wait_bdec_out.c +++ b/src/sdk/ipu/wait_bdec_out.c @@ -6,8 +6,8 @@ typedef struct { u8 pad0[0x838]; - s32 unk838; - s32 unk83C; + s32 bit_window; + s32 available_bit_count; u8 pad840[0x18]; void *cbData; } MpegDec; @@ -46,12 +46,12 @@ s32 _waitBdecOut(MpegDec *decoder) { } bp = *IPU_BP; top = *IPU_TOP; - decoder->unk838 = top; + decoder->bit_window = top; if (top < 0) { rest = bp & 0x1F; - decoder->unk83C = rest ? 32 - rest : 0; + decoder->available_bit_count = rest ? 32 - rest : 0; } else { - decoder->unk83C = 32; + decoder->available_bit_count = 32; } if (*IPU_CTRL & 0x4000) { _Error(decoder, bdec_error_message); diff --git a/src/sdk/kernel/InitSystemCallTableAddress.c b/src/sdk/kernel/InitSystemCallTableAddress.c index 248e4fb18e..1f644961da 100644 --- a/src/sdk/kernel/InitSystemCallTableAddress.c +++ b/src/sdk/kernel/InitSystemCallTableAddress.c @@ -7,11 +7,12 @@ typedef unsigned int u32; typedef signed long long s64; typedef unsigned long long u64; +/* Two SetSyscall (syscall 116) bindings: syscall number, handler. */ struct SyscallMidTable { - s32 unk0; - s32 unk4; - s32 unk8; - s32 unkC; + s32 first_number; + s32 first_handler; + s32 second_number; + s32 second_handler; }; extern u32 D_00130308[]; @@ -27,10 +28,10 @@ void InitSystemCallTableAddress(void) { s32 found_before; u32 copy_addr; u32 find_addr; - Rfu116SetSyscallMid(syscall_table_address_init_bindings.unk0, - syscall_table_address_init_bindings.unk4); - Rfu116SetSyscallMid(syscall_table_address_init_bindings.unk8, - syscall_table_address_init_bindings.unkC); + Rfu116SetSyscallMid(syscall_table_address_init_bindings.first_number, + syscall_table_address_init_bindings.first_handler); + Rfu116SetSyscallMid(syscall_table_address_init_bindings.second_number, + syscall_table_address_init_bindings.second_handler); find_cursor = FindAddress(0x80000000, 0x80080000, &FindKernelAddress); find_addr = find_cursor - 0x20C; copy_cursor = FindAddress(0x80000000, 0x80080000, &KernelCopyRdata); diff --git a/src/sdk/mpeg/api/sce_mpeg_add_str_callback.c b/src/sdk/mpeg/api/sce_mpeg_add_str_callback.c index 0356a748b1..4217434317 100644 --- a/src/sdk/mpeg/api/sce_mpeg_add_str_callback.c +++ b/src/sdk/mpeg/api/sce_mpeg_add_str_callback.c @@ -20,7 +20,7 @@ typedef struct { } sceMpeg; typedef struct { - u64 unk0; + u64 id; u64 type; } StrTypeEntry; diff --git a/src/sdk/mpeg/api/sce_mpeg_reset.c b/src/sdk/mpeg/api/sce_mpeg_reset.c index fec602424f..9278a2256b 100644 --- a/src/sdk/mpeg/api/sce_mpeg_reset.c +++ b/src/sdk/mpeg/api/sce_mpeg_reset.c @@ -15,7 +15,7 @@ void sceMpegReset(struct sceMpeg *mpeg) { decoder->started = 0; mpeg->frameCount = 0; decoder->frame_base = 0; - decoder->unk80 = -1; + decoder->displayed_pts = -1; _clearEach(decoder); decoder->frame_count = 0; set_mpeg1_mode(decoder); diff --git a/src/sdk/mpeg/bitstream/_flushBuf.c b/src/sdk/mpeg/bitstream/_flushBuf.c index 1b68889276..a202550ca6 100644 --- a/src/sdk/mpeg/bitstream/_flushBuf.c +++ b/src/sdk/mpeg/bitstream/_flushBuf.c @@ -29,7 +29,7 @@ typedef struct FlushBufContext { s32 bit_window; s32 available_bit_count; u8 pad_840[0x18]; - s32 unk858; + s32 mpeg; } FlushBufContext; extern s32 _dispatchMpegCbNodata(); @@ -48,7 +48,7 @@ void _flushBuf(FlushBufContext *decoder_state, s32 bit_count) { if ((*(volatile u32 *)0x10002010 & 0x80004000) == 0x80000000) { do { if (counter++ >= 0x1389) { - _dispatchMpegCbNodata(decoder_state->unk858); + _dispatchMpegCbNodata(decoder_state->mpeg); counter = 0; } } while ((*(volatile u32 *)0x10002010 & 0x80004000) == 0x80000000); diff --git a/src/sdk/mpeg/bitstream/_peepBit.c b/src/sdk/mpeg/bitstream/_peepBit.c index f4c50f2a7b..5b3b787763 100644 --- a/src/sdk/mpeg/bitstream/_peepBit.c +++ b/src/sdk/mpeg/bitstream/_peepBit.c @@ -10,7 +10,7 @@ typedef struct PeepBitContext { s32 bit_window; s32 available_bit_count; u8 pad_840[0x18]; - s32 unk858; + s32 mpeg; } PeepBitContext; s32 _peepBit(PeepBitContext *ctx, s32 requested_bit_count) { @@ -21,7 +21,7 @@ s32 _peepBit(PeepBitContext *ctx, s32 requested_bit_count) { if ((*(volatile u32 *)0x10002010 & 0x80004000) == 0x80000000) { do { if (counter++ >= 0x1389) { - DispatchMpegCallbackNoData(ctx->unk858); + DispatchMpegCallbackNoData(ctx->mpeg); counter = 0; } } while ((*(volatile u32 *)0x10002010 & 0x80004000) == 0x80000000); diff --git a/src/sdk/mpeg/bitstream/nextbit.c b/src/sdk/mpeg/bitstream/nextbit.c index e33f344edc..defbcc50f5 100644 --- a/src/sdk/mpeg/bitstream/nextbit.c +++ b/src/sdk/mpeg/bitstream/nextbit.c @@ -10,7 +10,7 @@ typedef struct NextBitContext { s32 cached_bit_window; s32 available_bit_count; u8 pad_840[0x18]; - s32 unk858; + s32 mpeg; } NextBitContext; s32 _nextBit(NextBitContext *ctx, s32 bit_count) { @@ -21,7 +21,7 @@ s32 _nextBit(NextBitContext *ctx, s32 bit_count) { if ((*(volatile u32 *)0x10002010 & 0x80004000) == 0x80000000) { do { if (counter++ >= 0x1389) { - DispatchMpegCallbackNoData(ctx->unk858); + DispatchMpegCallbackNoData(ctx->mpeg); counter = 0; } } while ((*(volatile u32 *)0x10002010 & 0x80004000) == 0x80000000); diff --git a/src/sdk/mpeg/demux/_PES_packet.c b/src/sdk/mpeg/demux/_PES_packet.c index 95c25e5791..e5e3abd6df 100644 --- a/src/sdk/mpeg/demux/_PES_packet.c +++ b/src/sdk/mpeg/demux/_PES_packet.c @@ -23,14 +23,14 @@ struct PES_BS { }; struct PES_HDR { - s64 unk0; - s32 unk8; - s32 unkC; - s64 unk10; - s64 unk18; - s32 unk20; - s32 unk24; - s32 unk28; + s64 id; /* stream_id << 32; private streams add their first word */ + s32 len; /* PES_packet_length */ + s32 scrambling; /* PES_scrambling_control */ + s64 pts; /* -1 when absent */ + s64 dts; + s32 data; /* bit position of the payload */ + s32 datalen; /* payload bytes */ + s32 header; /* bit position of the packet start */ }; struct PES_TBL { @@ -49,19 +49,19 @@ s32 _PES_packet(s32 error_context, struct PES_BS *bs, struct PES_HDR *hdr) { s32 pes_extension_flag; /* PES_extension_flag */ ctx = error_context; - hdr->unk28 = (s32)bs->stamp; + hdr->header = (s32)bs->stamp; header_skip_bit_counts = *(struct PES_TBL *)pes_header_skip_bit_counts; _sysbitGet(bs, 0x18); - hdr->unk0 = (s64)_sysbitGet(bs, 8) << 0x20; - hdr->unk8 = _sysbitGet(bs, 0x10); - hdr->unk18 = -1; - hdr->unk10 = -1; - if (hdr->unk0 != ((u64)0xBC00 << 0x18) && hdr->unk0 != ((u64)0xBE00 << 0x18) && - hdr->unk0 != ((u64)0xBF00 << 0x18) && hdr->unk0 != ((u64)0xF000 << 0x18) && - hdr->unk0 != ((u64)0xF100 << 0x18) && hdr->unk0 != ((u64)0xFF00 << 0x18) && - hdr->unk0 != ((u64)0xF200 << 0x18) && hdr->unk0 != ((u64)0xF800 << 0x18)) { + hdr->id = (s64)_sysbitGet(bs, 8) << 0x20; + hdr->len = _sysbitGet(bs, 0x10); + hdr->dts = -1; + hdr->pts = -1; + if (hdr->id != ((u64)0xBC00 << 0x18) && hdr->id != ((u64)0xBE00 << 0x18) && + hdr->id != ((u64)0xBF00 << 0x18) && hdr->id != ((u64)0xF000 << 0x18) && + hdr->id != ((u64)0xF100 << 0x18) && hdr->id != ((u64)0xFF00 << 0x18) && + hdr->id != ((u64)0xF200 << 0x18) && hdr->id != ((u64)0xF800 << 0x18)) { _sysbitGet(bs, 2); - hdr->unkC = _sysbitGet(bs, 2); + hdr->scrambling = _sysbitGet(bs, 2); _sysbitGet(bs, 4); pts_dts_flags = _sysbitGet(bs, 2); flag1 = _sysbitGet(bs, 1); @@ -78,7 +78,7 @@ s32 _PES_packet(s32 error_context, struct PES_BS *bs, struct PES_HDR *hdr) { _sysbitMarker(bs); c = _sysbitGet(bs, 0xF); _sysbitMarker(bs); - hdr->unk10 = ((s64)((a >> 2) & 1) << 0x20) | (s64)(u32)(a << 30 | b << 15 | c); + hdr->pts = ((s64)((a >> 2) & 1) << 0x20) | (s64)(u32)(a << 30 | b << 15 | c); } if (pts_dts_flags == 3) { u32 a, b, c; @@ -89,7 +89,7 @@ s32 _PES_packet(s32 error_context, struct PES_BS *bs, struct PES_HDR *hdr) { _sysbitMarker(bs); c = _sysbitGet(bs, 0xF); _sysbitMarker(bs); - hdr->unk18 = ((s64)((a >> 2) & 1) << 0x20) | (s64)(u32)(a << 30 | b << 15 | c); + hdr->dts = ((s64)((a >> 2) & 1) << 0x20) | (s64)(u32)(a << 30 | b << 15 | c); } if (flag1 == 1) { _sysbitGet(bs, 0x30); @@ -142,12 +142,12 @@ s32 _PES_packet(s32 error_context, struct PES_BS *bs, struct PES_HDR *hdr) { } } { - s32 n = hdr->unk8 - pes_header_data_length; + s32 n = hdr->len - pes_header_data_length; s32 payload_bytes_to_skip; - hdr->unk24 = n - 3; - hdr->unk20 = (s32)bs->stamp; - if (hdr->unk0 == ((u64)0xBD00 << 0x18)) { - hdr->unk0 |= (u64)(u32)_sysbitGet(bs, 0x20); + hdr->datalen = n - 3; + hdr->data = (s32)bs->stamp; + if (hdr->id == ((u64)0xBD00 << 0x18)) { + hdr->id |= (u64)(u32)_sysbitGet(bs, 0x20); payload_bytes_to_skip = n - 7; } else { payload_bytes_to_skip = n - 3; @@ -156,21 +156,21 @@ s32 _PES_packet(s32 error_context, struct PES_BS *bs, struct PES_HDR *hdr) { _sysbitJump(bs, payload_bytes_to_skip); } } - } else if (hdr->unk0 == ((u64)0xBC00 << 0x18) || hdr->unk0 == ((u64)0xBF00 << 0x18) || - hdr->unk0 == ((u64)0xF000 << 0x18) || hdr->unk0 == ((u64)0xF100 << 0x18) || - hdr->unk0 == ((u64)0xFF00 << 0x18) || hdr->unk0 == ((u64)0xF200 << 0x18) || - hdr->unk0 == ((u64)0xF800 << 0x18)) { - s32 n = hdr->unk8; - if (hdr->unk0 == ((u64)0xBF00 << 0x18)) { + } else if (hdr->id == ((u64)0xBC00 << 0x18) || hdr->id == ((u64)0xBF00 << 0x18) || + hdr->id == ((u64)0xF000 << 0x18) || hdr->id == ((u64)0xF100 << 0x18) || + hdr->id == ((u64)0xFF00 << 0x18) || hdr->id == ((u64)0xF200 << 0x18) || + hdr->id == ((u64)0xF800 << 0x18)) { + s32 n = hdr->len; + if (hdr->id == ((u64)0xBF00 << 0x18)) { n -= 4; - hdr->unk0 |= (u64)(u32)_sysbitGet(bs, 0x20); + hdr->id |= (u64)(u32)_sysbitGet(bs, 0x20); } if (n != 0) { _sysbitJump(bs, n); } - } else if (hdr->unk0 == ((u64)0xBE00 << 0x18)) { - if (hdr->unk8 != 0) { - _sysbitJump(bs, hdr->unk8); + } else if (hdr->id == ((u64)0xBE00 << 0x18)) { + if (hdr->len != 0) { + _sysbitJump(bs, hdr->len); } } return 1; diff --git a/src/sdk/mpeg/demux/_pack_header.c b/src/sdk/mpeg/demux/_pack_header.c index 6aba06f5e0..5f77b78866 100644 --- a/src/sdk/mpeg/demux/_pack_header.c +++ b/src/sdk/mpeg/demux/_pack_header.c @@ -1,10 +1,10 @@ #include "types.h" struct PackHeaderInfo { - s32 unk0; - s32 unk4; - s32 unk8; - s32 unkC; + s32 scr_extension; /* system_clock_reference_extension (9 bits) */ + s32 scr_base; /* low 32 bits of system_clock_reference_base */ + s32 scr_base_high; /* bit 32 of system_clock_reference_base */ + s32 has_system_header; /* a system_header follows the pack header */ }; extern s32 peek_bits() __asm__("SignExtendPackedValue"); @@ -27,11 +27,11 @@ s32 _pack_header(s32 bitstream_context, struct PackHeaderInfo *pack_header_info) _sysbitMarker(bitstream_context); scr_low = _sysbitGet(bitstream_context, 0xF); _sysbitMarker(bitstream_context); - pack_header_info->unk0 = _sysbitGet(bitstream_context, 9); + pack_header_info->scr_extension = _sysbitGet(bitstream_context, 9); _sysbitGet(bitstream_context, 0x1E); stuffing_length = _sysbitGet(bitstream_context, 3); - pack_header_info->unk8 = (s32)((scr_high >> 2) & 1); - pack_header_info->unk4 = (s32)((scr_high << 0x1E) | (scr_mid << 0xF) | scr_low); + pack_header_info->scr_base_high = (s32)((scr_high >> 2) & 1); + pack_header_info->scr_base = (s32)((scr_high << 0x1E) | (scr_mid << 0xF) | scr_low); if (stuffing_length != 0) { do { do { @@ -41,10 +41,10 @@ s32 _pack_header(s32 bitstream_context, struct PackHeaderInfo *pack_header_info) } while (0); } if (peek_bits(bitstream_context, 0x20) == 0x1BB) { - pack_header_info->unkC = 1; + pack_header_info->has_system_header = 1; _system_header(bitstream_context, pack_header_info); } else { - pack_header_info->unkC = 0; + pack_header_info->has_system_header = 0; } return 1; } diff --git a/src/sdk/mpeg/headers/next_header.c b/src/sdk/mpeg/headers/next_header.c index 93da1c5857..80cad1ec1e 100644 --- a/src/sdk/mpeg/headers/next_header.c +++ b/src/sdk/mpeg/headers/next_header.c @@ -8,7 +8,7 @@ typedef struct { typedef struct { u8 pad0[0x150]; - s32 unk150; + s32 picture_coding_type; u8 pad154[0x6D4]; s64 pts; s64 dts; @@ -54,7 +54,7 @@ s32 _nextHeader(MpegDec *decoder) { _dispatchMpegCallback(decoder->cbData, &cb); decoder->dts = cb.dts; decoder->pts = cb.pts; - return decoder->unk150; + return decoder->picture_coding_type; case MPEG_SEQUENCE_END_CODE: return 0; } diff --git a/src/sdk/mpeg/macroblock/_decMB0.c b/src/sdk/mpeg/macroblock/_decMB0.c index d43e8935f3..d9d00fcc31 100644 --- a/src/sdk/mpeg/macroblock/_decMB0.c +++ b/src/sdk/mpeg/macroblock/_decMB0.c @@ -5,15 +5,17 @@ #include "rnc/sdk/mpeg/errors.h" #include "rnc/sdk/mpeg/macroblock.h" +/* PMV[r][s][t] of the MPEG-2 video standard: the motion vector predictors, + r first/second, s forward/backward, t horizontal/vertical. */ struct MpegMbState { - int unk0; - int unk4; - int unk8; - int unkC; - int unk10; - int unk14; - int unk18; - int unk1C; + int first_forward_x; + int first_forward_y; + int first_backward_x; + int first_backward_y; + int second_forward_x; + int second_forward_y; + int second_backward_x; + int second_backward_y; }; const char invalid_macroblock_type_error_message[] __asm__("D_00153898") = @@ -167,7 +169,7 @@ int _decMB0(struct MpegDecoder *decoder, (intra_quantiser_command_bits | dc_reset_command_base) | ((*dct_type_output) << 0x19)); } else { - decoder->mb_buf[decoder->mb_buf_index].unk13C = 1; + decoder->mb_buf[decoder->mb_buf_index].no_coded_blocks = 1; } decoder->dc_reset = 0; if (decoder->slice_error != 0) { @@ -178,23 +180,24 @@ int _decMB0(struct MpegDecoder *decoder, } if ((((*mb_type) & 1) || ((decoder->dc_reset = 1, ((*mb_type) & 1) != 0))) && (decoder->concealment_motion_vectors == 0)) { - motion_vector_state->unk14 = 0; - motion_vector_state->unk10 = 0; - motion_vector_state->unk4 = 0; - motion_vector_state->unk0 = 0; - motion_vector_state->unk1C = 0; - motion_vector_state->unk18 = 0; - motion_vector_state->unkC = 0; - motion_vector_state->unk8 = 0; + motion_vector_state->second_forward_y = 0; + motion_vector_state->second_forward_x = 0; + motion_vector_state->first_forward_y = 0; + motion_vector_state->first_forward_x = 0; + motion_vector_state->second_backward_y = 0; + motion_vector_state->second_backward_x = 0; + motion_vector_state->first_backward_y = 0; + motion_vector_state->first_backward_x = 0; } coding_type = decoder->picture_coding_type; decode_success = 1; if (coding_type == PICTURE_CODING_TYPE_PREDICTIVE) { decode_success = 1; if (!((*mb_type) & 9)) { - motion_vector_state->unk0 = - (motion_vector_state->unk4 = - (motion_vector_state->unk10 = (motion_vector_state->unk14 = 0))); + motion_vector_state->first_forward_x = + (motion_vector_state->first_forward_y = + (motion_vector_state->second_forward_x = + (motion_vector_state->second_forward_y = 0))); if (decoder->picture_structure == 3) { *motion_type = coding_type; } else { diff --git a/src/sdk/mpeg/macroblock/_slice0.c b/src/sdk/mpeg/macroblock/_slice0.c index 349953f941..ef8e7e5334 100644 --- a/src/sdk/mpeg/macroblock/_slice0.c +++ b/src/sdk/mpeg/macroblock/_slice0.c @@ -32,7 +32,7 @@ s32 _slice0(struct MpegDecoder *mp, s32 nmb) { if (mbx >= nmb) { return 0; } - mp->mb_buf[mp->mb_buf_index].unk13C = 0; + mp->mb_buf[mp->mb_buf_index].no_coded_blocks = 0; if (_waitBdecOut(mp) == 0) { return 2; } diff --git a/src/sdk/mpeg/macroblock/cpr8.c b/src/sdk/mpeg/macroblock/cpr8.c index 59d53f5493..cb345acedb 100644 --- a/src/sdk/mpeg/macroblock/cpr8.c +++ b/src/sdk/mpeg/macroblock/cpr8.c @@ -3,16 +3,16 @@ #include "rnc/sdk/interrupts.h" struct MpegCopyParams { - s32 unk0; + s32 data; u8 pad_4[0x8]; - s32 unkC; - s32 unk10; + s32 mb_width; + s32 mb_height; }; struct MpegDecoderFrame { u8 pad_0[0xE0]; - s32 unkE0; - s32 unkE4; + s32 out_max_height; + s32 out_max_size; u8 pad_E8[0x8C]; s32 transfer_layout_mode; }; @@ -39,21 +39,21 @@ void _cpr8(struct MpegDecoder *decoder, struct MpegCopyParams *copy_params) { s32 pass; decoder_transfer_layout = (struct MpegDecoderFrame *)decoder; - source_addr = copy_params->unk0 & 0x0FFFFFFF; - destination_pass_base = decoder->unkD8 & 0x0FFFFFFF; + source_addr = copy_params->data & 0x0FFFFFFF; + destination_pass_base = decoder->image_buffer & 0x0FFFFFFF; if (decoder_transfer_layout->transfer_layout_mode == MPEG_TRANSFER_LAYOUT_SINGLE_PASS) { goto block_3; } - layout_width = decoder_transfer_layout->unkE0; + layout_width = decoder_transfer_layout->out_max_height; dest_width = layout_width; if (layout_width != 0) { goto block_8; } goto block_4; block_3: - dest_width = decoder_transfer_layout->unkE0; + dest_width = decoder_transfer_layout->out_max_height; block_4: - source_stride = copy_params->unk10 * 0x180; + source_stride = copy_params->mb_height * 0x180; qword_count = source_stride >> 4; if (dest_width == 0) { goto block_6; @@ -67,14 +67,14 @@ void _cpr8(struct MpegDecoder *decoder, struct MpegCopyParams *copy_params) { goto block_9; block_8: dest_stride = (layout_width >> 4) * 0xC0; - source_stride = ((s32)copy_params->unk10 >> 1) * 0x180; + source_stride = ((s32)copy_params->mb_height >> 1) * 0x180; transfer_pass_count = 2; qword_count = source_stride >> 4; block_9: pass = 0; while (pass < transfer_pass_count) { dest_addr = destination_pass_base; - for (row = 0; row < copy_params->unkC; row++) { + for (row = 0; row < copy_params->mb_width; row++) { interrupts_on = DIntr(); *(volatile s32 *)0x1000D480 = 0; *(volatile s32 *)0x1000D410 = source_addr; @@ -105,7 +105,7 @@ void _cpr8(struct MpegDecoder *decoder, struct MpegCopyParams *copy_params) { source_addr += source_stride; } pass++; - destination_pass_base += decoder_transfer_layout->unkE4 * 0xC0; + destination_pass_base += decoder_transfer_layout->out_max_size * 0xC0; } return; } diff --git a/src/sdk/mpeg/macroblock/domc.c b/src/sdk/mpeg/macroblock/domc.c index 6e1419902d..881318ca52 100644 --- a/src/sdk/mpeg/macroblock/domc.c +++ b/src/sdk/mpeg/macroblock/domc.c @@ -17,15 +17,15 @@ void _doMC(struct MpegDecoder *decoder, s32 index) { &decoder->mb_buf[index].chroma[i]); } } - if (decoder->mb_buf[index].unk130 != 0 && decoder->mb_buf[index].unk13C != 0) { + if (decoder->mb_buf[index].intra != 0 && decoder->mb_buf[index].no_coded_blocks != 0) { _Error(decoder, intra_skip_mb_error_message); } - if (decoder->mb_buf[index].unk130 != 0) { - func_001271D8(decoder->mb_buf[index].unk128, decoder->mb_buf[index].ipu_out); - } else if (decoder->mb_buf[index].unk13C != 0) { - func_001271D8(decoder->mb_buf[index].unk128, decoder->mc_work); + if (decoder->mb_buf[index].intra != 0) { + func_001271D8(decoder->mb_buf[index].output, decoder->mb_buf[index].ipu_out); + } else if (decoder->mb_buf[index].no_coded_blocks != 0) { + func_001271D8(decoder->mb_buf[index].output, decoder->mc_work); } else { func_00127178( - decoder->mb_buf[index].unk128, decoder->mc_work, decoder->mb_buf[index].ipu_out); + decoder->mb_buf[index].output, decoder->mc_work, decoder->mb_buf[index].ipu_out); } } diff --git a/src/sdk/mpeg/macroblock/motion_vector.c b/src/sdk/mpeg/macroblock/motion_vector.c index b2a33ead24..ec26f25601 100644 --- a/src/sdk/mpeg/macroblock/motion_vector.c +++ b/src/sdk/mpeg/macroblock/motion_vector.c @@ -1,13 +1,14 @@ #include "types.h" struct MotionVector { - u8 pad_0[0x4]; - s32 unk4; + s32 x; + s32 y; }; +/* dmvector[2] of a dual-prime motion vector */ struct MotionVectorStore { - s32 unk0; - s32 unk4; + s32 x; + s32 y; }; extern s32 decode_dmvector() __asm__("InitializeMemoryCardDirectory"); @@ -17,10 +18,10 @@ extern s32 decode_motion_vector() __asm__("func_001280A8"); void _motionVector(s32 decoder_state, struct MotionVector *motion_vector, - struct MotionVectorStore *auxiliary_vlc_values, + struct MotionVectorStore *dmvector, s32 first_component_bit_count, s32 second_component_bit_count, - s32 decode_auxiliary_vlc, + s32 dual_prime, s32 halve_second_component_for_decode, s32 use_half_scale) { @@ -34,8 +35,8 @@ void _motionVector(s32 decoder_state, bits = 0; } decode_motion_vector(motion_vector, first_component_bit_count, code, bits, use_half_scale); - if (decode_auxiliary_vlc != 0) { - auxiliary_vlc_values->unk0 = decode_dmvector(decoder_state); + if (dual_prime != 0) { + dmvector->x = decode_dmvector(decoder_state); } code = _ipuVdec(decoder_state, 2); if (second_component_bit_count != 0 && code != 0) { @@ -44,14 +45,14 @@ void _motionVector(s32 decoder_state, bits = 0; } if (halve_second_component_for_decode != 0) { - motion_vector->unk4 >>= 1; + motion_vector->y >>= 1; } decode_motion_vector( (u8 *)motion_vector + 4, second_component_bit_count, code, bits, use_half_scale); if (halve_second_component_for_decode != 0) { - motion_vector->unk4 *= 2; + motion_vector->y *= 2; } - if (decode_auxiliary_vlc != 0) { - auxiliary_vlc_values->unk4 = decode_dmvector(decoder_state); + if (dual_prime != 0) { + dmvector->y = decode_dmvector(decoder_state); } } diff --git a/src/sdk/mpeg/macroblock/skip_mb0.c b/src/sdk/mpeg/macroblock/skip_mb0.c index 0d3200527e..a649f8ca00 100644 --- a/src/sdk/mpeg/macroblock/skip_mb0.c +++ b/src/sdk/mpeg/macroblock/skip_mb0.c @@ -2,17 +2,19 @@ #include "rnc/sdk/libmpeg.h" #include "rnc/sdk/mpeg/errors.h" +/* The forward motion vector predictors PMV[r][0][t] (see _decMB0). */ struct MpegSkipState { - s32 unk0; - s32 unk4; + s32 first_forward_x; + s32 first_forward_y; u8 pad_8[0x8]; - s32 unk10; - s32 unk14; + s32 second_forward_x; + s32 second_forward_y; }; +/* motion_vertical_field_select[0][s] */ struct MpegMotionRef { - s32 unk0; - s32 unk4; + s32 forward; + s32 backward; }; const char skipped_macroblock_in_i_picture_error_message[] __asm__("D_00153868") = @@ -40,18 +42,18 @@ s32 _skipMB0(struct MpegDecoder *decoder, *(s32 *)((u8 *)(((u8 *)decoder + (buf_offset))) + 0x6CC) = 1; decoder->dc_reset = 1; if (decoder->picture_coding_type == MPEG_PICTURE_CODING_TYPE_P) { - skip_state->unk14 = 0; - skip_state->unk10 = 0; - skip_state->unk4 = 0; - skip_state->unk0 = 0; + skip_state->second_forward_y = 0; + skip_state->second_forward_x = 0; + skip_state->first_forward_y = 0; + skip_state->first_forward_x = 0; } if (decoder->picture_structure == 3) { *picture_structure_mode = MPEG_MOTION_TYPE_FRAME; } else { *picture_structure_mode = MPEG_MOTION_TYPE_FIELD; bottom_field = decoder->picture_structure == 2; - motion_reference->unk4 = bottom_field; - motion_reference->unk0 = bottom_field; + motion_reference->backward = bottom_field; + motion_reference->forward = bottom_field; } if (decoder->picture_coding_type == MPEG_PICTURE_CODING_TYPE_I) { _Error(decoder, skipped_macroblock_in_i_picture_error_message); diff --git a/src/sdk/mpeg/picture/_getpic.c b/src/sdk/mpeg/picture/_getpic.c index 181c9ea441..a7e6ae3e7e 100644 --- a/src/sdk/mpeg/picture/_getpic.c +++ b/src/sdk/mpeg/picture/_getpic.c @@ -26,7 +26,7 @@ s32 _getpic(struct sceMpeg *mpeg) { start_code = 1; decode_or_skip_result = MPEG_DECODE_SCAN_NEXT_HEADER; decoder = mpeg->sys; - image_addr = decoder->unkD8; + image_addr = decoder->image_buffer; decoder->is_end = 0; if (image_addr & 0x3F) { _Error1(decoder, image_buffer_alignment_error_format, image_addr); diff --git a/src/sdk/mpeg/picture/_pictureData0.c b/src/sdk/mpeg/picture/_pictureData0.c index 641b9cb695..5058c30d10 100644 --- a/src/sdk/mpeg/picture/_pictureData0.c +++ b/src/sdk/mpeg/picture/_pictureData0.c @@ -10,7 +10,7 @@ typedef struct { u8 pad134[0x40]; s32 pictStruct; u8 pad178[0x698]; - s32 unk810; + s32 mb_buf_index; s32 unk814; } MpegDec; @@ -31,7 +31,7 @@ s32 _pictureData0(MpegDec *decoder) { s32 decode_status; s32 mbs; - decoder->unk810 = 0; + decoder->mb_buf_index = 0; decoder->unk814 = 0; mbs = decoder->mbWidth * decoder->mbHeight; if (decoder->pictStruct != 3) { @@ -48,7 +48,7 @@ s32 _pictureData0(MpegDec *decoder) { while ((*(volatile u32 *)0x1000D400 >> 8) & 1) { } if (decode_status == DECODE_STATUS_SUCCESS) { - _doMC(decoder, decoder->unk810 == 0); + _doMC(decoder, decoder->mb_buf_index == 0); } if (decode_status == DECODE_STATUS_SLICE_DECODE_ERROR || decode_status == DECODE_STATUS_ABORT_PICTURE) { diff --git a/src/sdk/mpeg/picture/update_temp_track_data.c b/src/sdk/mpeg/picture/update_temp_track_data.c index e47a325fa1..89e894bb92 100644 --- a/src/sdk/mpeg/picture/update_temp_track_data.c +++ b/src/sdk/mpeg/picture/update_temp_track_data.c @@ -18,11 +18,13 @@ void UpdateTempTrackData(struct MpegDecoder *decoder, s32 delta) { decoder->unk854 = 0; step = delta; } - reference = decoder->unk84C + delta; - decoder->unk1AC = reference; + reference = decoder->temporal_reference_base + delta; + decoder->temporal_reference = reference; if ((wrapped != 0) && (step >= delta)) { - decoder->unk1AC = (s32)(reference + 0x400); + decoder->temporal_reference = (s32)(reference + 0x400); }; - current = decoder->unk1AC; - decoder->unk850 = (s32)((decoder->unk850 < current) ? (current) : (decoder->unk850)); + current = decoder->temporal_reference; + decoder->max_temporal_reference = + (s32)((decoder->max_temporal_reference < current) ? (current) + : (decoder->max_temporal_reference)); } diff --git a/src/sdk/mpeg/ref_images/FinishMpegReferenceImage.c b/src/sdk/mpeg/ref_images/FinishMpegReferenceImage.c index c5174ff83e..d8937804e3 100644 --- a/src/sdk/mpeg/ref_images/FinishMpegReferenceImage.c +++ b/src/sdk/mpeg/ref_images/FinishMpegReferenceImage.c @@ -1,52 +1,20 @@ /* Ported from rac1-decomp (src/core/00125630.c, func_00129C78). */ -typedef struct Slot1B8 { - /* 0x00 */ void *unk00; - /* 0x04 */ void *unk04; - /* 0x08 */ int unk08; - /* 0x0C */ void *unk0C; -} Slot1B8; /* 0x10 */ +#include "types.h" +#include "rnc/sdk/libmpeg.h" -typedef struct Handler { - /* 0x00 */ void *fn; - /* 0x04 */ int data; -} Handler; /* 0x8 */ - -typedef struct Obj40 { - /* 0x000 */ char unk000[0x4]; - /* 0x004 */ int unk004; - /* 0x008 */ int unk008; - /* 0x00C */ Handler handlers[0x14]; - /* 0x0AC */ int unk0AC; - /* 0x0B0 */ char unk0B0[0x68]; - /* 0x118 */ int unk118; - /* 0x11C */ char unk11C[0x4]; - /* 0x120 */ int unk120; - /* 0x124 */ char unk124[0x2C]; - /* 0x150 */ int unk150; - /* 0x154 */ char unk154[0x20]; - /* 0x174 */ int unk174; - /* 0x178 */ char unk178[0x40]; - /* 0x1B8 */ Slot1B8 slots[3]; - /* 0x1E8 */ char unk1E8[0x638]; - /* 0x820 */ int picture_ready; -} Obj40; - -/* Does the request at arg1 fit the heap described by arg0? A sized - request (+0xE0 non-zero) has to fit both the byte budget at +0xDC and - the entry budget at +0xE0; an unsized one has to fit width * height - against +0xE4. On a refusal, format the two figures into the message - at D_00153A80 and report it. Returns whether it fits. */ +/* Marks a picture as output. The first one also restarts sceMpeg.frameCount + (frame_base = frame_count). */ int FinishMpegReferenceImage(void *object) __asm__("FUN_00129b38"); int FinishMpegReferenceImage(void *mpeg_reference_image) { - Obj40 *reference_image_object = (Obj40 *)mpeg_reference_image; - int return_value = 1; - if (reference_image_object->unk008 != 2) { - int saved_reference_image_value = reference_image_object->unk118; - reference_image_object->unk008 = 2; - reference_image_object->unk0AC = saved_reference_image_value; + struct MpegDecoder *decoder = (struct MpegDecoder *)mpeg_reference_image; + int return_value = 1; + if (decoder->started != 2) { + int frame_count = decoder->frame_count; + decoder->started = 2; + decoder->frame_base = frame_count; } - reference_image_object->picture_ready = return_value; + decoder->picture_ready = return_value; return return_value; } diff --git a/src/sdk/mpeg/ref_images/_dispRefImage.c b/src/sdk/mpeg/ref_images/_dispRefImage.c index 73f6845d66..9db3a0bef0 100644 --- a/src/sdk/mpeg/ref_images/_dispRefImage.c +++ b/src/sdk/mpeg/ref_images/_dispRefImage.c @@ -7,9 +7,9 @@ /* s32 view of the owning sceMpeg (pts low word at 0x10, flags at 0x20). */ struct MpegDisplayState { u8 pad_0[0x10]; - s32 unk10; + s32 pts_low; u8 pad_14[0xC]; - s64 unk20; + u64 flags; }; extern u32 display_values_by_picture_flags[] __asm__("D_00132E98"); @@ -29,8 +29,8 @@ void _dispRefImage(struct MpegDecoder *decoder, struct MpegRefImage *ref_image) (s32 *)((u8 *)mpeg_words + 0x18), (s32 *)((u8 *)mpeg_words + 0x20)); ref_info = (struct MpegDisplayState *)decoder->mpeg; - decoder->unk80 = (s32)ref_info->unk10; - display_value = display_values_by_picture_flags[(s32)(ref_info->unk20 >> 5) & 0xF]; + decoder->displayed_pts = (s32)ref_info->pts_low; + display_value = display_values_by_picture_flags[(s32)(ref_info->flags >> 5) & 0xF]; decoder->unkCC = (s32)ref_image->unk5C; decoder->unk88 = display_value; decoder->unkD0 = (s32)ref_image->unk60; @@ -42,7 +42,7 @@ void _dispRefImage(struct MpegDecoder *decoder, struct MpegRefImage *ref_image) decoder->unkC8 = (s32)ref_image->unk58; if (_isOutSizeOK(decoder, ref_image) != 0) { if (ref_image->status == MPEG_REF_IMAGE_STATUS_DISPLAYABLE) { - if (decoder->unkB0 != 0) { + if (decoder->csc_output != 0) { _csc_storeRefImage(decoder, ref_image); } else { _cpr8(decoder, ref_image); diff --git a/src/sdk/rpc/cmd/sce_sif_cmd_intr_hdlr.c b/src/sdk/rpc/cmd/sce_sif_cmd_intr_hdlr.c index 6b9fee583b..b10303fb46 100644 --- a/src/sdk/rpc/cmd/sce_sif_cmd_intr_hdlr.c +++ b/src/sdk/rpc/cmd/sce_sif_cmd_intr_hdlr.c @@ -22,8 +22,8 @@ typedef struct SifCmdHeader { /* The SIF command state (sceSifInitCmd fills it). */ typedef struct SifCmdData { SifCmdHeader *packet_buffer; - void *unk4; - s32 unk8; + void *send_buffer; + s32 iop_buffer; SifCmdHandlerEntry *system_handlers; s32 system_handler_count; SifCmdHandlerEntry *user_handlers; diff --git a/src/sdk/rpc/rpc/sce_sif_init_rpc.c b/src/sdk/rpc/rpc/sce_sif_init_rpc.c index ce06aa3d02..c50f22ddb1 100644 --- a/src/sdk/rpc/rpc/sce_sif_init_rpc.c +++ b/src/sdk/rpc/rpc/sce_sif_init_rpc.c @@ -8,8 +8,8 @@ typedef struct { s32 pid; void *pkt_table; s32 pkt_table_len; - s32 unk0C; - s32 unk10; + s32 unused1; + s32 unused2; void *rdata_table; s32 rdata_table_len; void *client_table; @@ -40,8 +40,8 @@ void sceSifInitRpc(u32 unused_mode) { DIntr(); D_00156800.pkt_table = (void *)((u32)sif_rpc_request_packets | 0x20000000); D_00156800.pkt_table_len = 32; - D_00156800.unk0C = 0; - D_00156800.unk10 = 0; + D_00156800.unused1 = 0; + D_00156800.unused2 = 0; D_00156800.rdata_table = (void *)((u32)sif_rpc_reply_packets | 0x20000000); D_00156800.rdata_table_len = 32; D_00156800.client_table = (void *)((u32)sif_rpc_client_table | 0x20000000); diff --git a/src/sdk/soft_float/dpsub.c b/src/sdk/soft_float/dpsub.c index 5fc4c834b7..5ef058432b 100644 --- a/src/sdk/soft_float/dpsub.c +++ b/src/sdk/soft_float/dpsub.c @@ -39,25 +39,26 @@ Boston, MA 02111-1307, USA. */ #include "types.h" +/* fp-bit sub(): fp_number_type a, b, tmp and the FLO_union_type au, bu. */ struct DpsubWork { - u8 pad_0[0x20]; - s32 unk20; - s32 unk24; - u8 pad_28[0x18]; - s32 unk40; - u8 pad_44[0x1C]; - s64 unk60; - s64 unk68; + u8 a[0x20]; + s32 b_class; + s32 b_sign; + u8 b_rest[0x18]; + s32 tmp; + u8 tmp_rest[0x1C]; + s64 au; + s64 bu; }; void dpsub(s64 minuend, s64 subtrahend) { struct DpsubWork subtraction_workspace; - subtraction_workspace.unk60 = minuend; - subtraction_workspace.unk68 = subtrahend; - __unpack_d(&subtraction_workspace.unk60, &subtraction_workspace); - __unpack_d(&subtraction_workspace.unk68, &subtraction_workspace.unk20); - subtraction_workspace.unk24 ^= 1; + subtraction_workspace.au = minuend; + subtraction_workspace.bu = subtrahend; + __unpack_d(&subtraction_workspace.au, &subtraction_workspace); + __unpack_d(&subtraction_workspace.bu, &subtraction_workspace.b_class); + subtraction_workspace.b_sign ^= 1; __pack_d(_fpadd_parts( - &subtraction_workspace, &subtraction_workspace.unk20, &subtraction_workspace.unk40)); + &subtraction_workspace, &subtraction_workspace.b_class, &subtraction_workspace.tmp)); } diff --git a/src/sdk/storage/memory_card/sce_mc_delete.c b/src/sdk/storage/memory_card/sce_mc_delete.c index 848d846b42..0be573642c 100644 --- a/src/sdk/storage/memory_card/sce_mc_delete.c +++ b/src/sdk/storage/memory_card/sce_mc_delete.c @@ -9,7 +9,7 @@ struct MemoryCardNameParam { s32 slot; s32 flags; s32 maxent; - s32 unk10; + s32 table; /* union { sceMcTblGetDir *table; char *curdir; } in mcNameParam */ char name[0x400]; }; diff --git a/src/sdk/storage/memory_card/sce_mc_open.c b/src/sdk/storage/memory_card/sce_mc_open.c index 30c3357ec5..b6cdfdd976 100644 --- a/src/sdk/storage/memory_card/sce_mc_open.c +++ b/src/sdk/storage/memory_card/sce_mc_open.c @@ -9,7 +9,7 @@ struct MemoryCardNameParam { s32 slot; s32 flags; s32 maxent; - s32 unk10; + s32 table; /* union { sceMcTblGetDir *table; char *curdir; } in mcNameParam */ char name[0x400]; }; diff --git a/src/ui/menus/pause/find_next_pause_page.c b/src/ui/menus/pause/find_next_pause_page.c index 9abeee0282..2aeab3e4be 100644 --- a/src/ui/menus/pause/find_next_pause_page.c +++ b/src/ui/menus/pause/find_next_pause_page.c @@ -4,7 +4,7 @@ #include "rnc/ui/menus/menu_screen.h" /* Each block reads menu_system through its own pointer local: the loop's - own copy is why GCSE leaves its unk138 load in the loop (only unk134, + own copy is why GCSE leaves its pack_gadgets_hidden load in the loop (only head_gadgets_hidden, read first in the body, is hoisted by loop.c), and the last block's copy is retail's kept %hi. */ int find_next_pause_page(struct MenuScreen *grid, int reverse) __asm__("FUN_0021b7a8"); @@ -18,10 +18,12 @@ int find_next_pause_page(struct MenuScreen *grid, int reverse) { } { struct MenuSystem *g = &menu_system; - if (g->unk134 != 0 && (grid->data.grid.flags & MENU_GRID_HIDDEN_WITH_UNK134)) { + if (g->head_gadgets_hidden != 0 && + (grid->data.grid.flags & MENU_GRID_HIDDEN_WITH_HEAD_GADGETS)) { skip = 1; } - if (g->unk138 != 0 && (grid->data.grid.flags & MENU_GRID_HIDDEN_WITH_UNK138)) { + if (g->pack_gadgets_hidden != 0 && + (grid->data.grid.flags & MENU_GRID_HIDDEN_WITH_PACK_GADGETS)) { skip = 1; } } @@ -30,10 +32,12 @@ int find_next_pause_page(struct MenuScreen *grid, int reverse) { moved = 1; grid = grid->data.grid.up; skip = 0; - if (g->unk134 != 0 && (grid->data.grid.flags & MENU_GRID_HIDDEN_WITH_UNK134)) { + if (g->head_gadgets_hidden != 0 && + (grid->data.grid.flags & MENU_GRID_HIDDEN_WITH_HEAD_GADGETS)) { skip = 1; } - if (g->unk138 != 0 && (grid->data.grid.flags & MENU_GRID_HIDDEN_WITH_UNK138)) { + if (g->pack_gadgets_hidden != 0 && + (grid->data.grid.flags & MENU_GRID_HIDDEN_WITH_PACK_GADGETS)) { skip = 1; } } diff --git a/src/ui/menus/selection/update_menu_grid_selection.c b/src/ui/menus/selection/update_menu_grid_selection.c index 57e5353bbb..8b5b1c8bca 100644 --- a/src/ui/menus/selection/update_menu_grid_selection.c +++ b/src/ui/menus/selection/update_menu_grid_selection.c @@ -62,10 +62,10 @@ s32 update_menu_grid_selection(struct MenuScreen *grid) { next_rows = next->data.grid.rows; next_columns = next->data.grid.cols; hidden = 0; - if (menu_system.unk134 != 0 && (next->data.grid.flags & 8)) { + if (menu_system.head_gadgets_hidden != 0 && (next->data.grid.flags & 8)) { hidden = 1; } - if (menu_system.unk138 != 0 && (next->data.grid.flags & 4)) { + if (menu_system.pack_gadgets_hidden != 0 && (next->data.grid.flags & 4)) { hidden = 1; } } while (hidden); @@ -97,10 +97,10 @@ s32 update_menu_grid_selection(struct MenuScreen *grid) { next = next->data.grid.down; next_column_count = next->data.grid.cols; hidden = 0; - if (menu_system.unk134 != 0 && (next->data.grid.flags & 8)) { + if (menu_system.head_gadgets_hidden != 0 && (next->data.grid.flags & 8)) { hidden = 1; } - if (menu_system.unk138 != 0 && (next->data.grid.flags & 4)) { + if (menu_system.pack_gadgets_hidden != 0 && (next->data.grid.flags & 4)) { hidden = 1; } } while (hidden); diff --git a/src/ui/menus/widgets/draw_menu_item_grid.c b/src/ui/menus/widgets/draw_menu_item_grid.c index 392e14ba0f..40d6c98e46 100644 --- a/src/ui/menus/widgets/draw_menu_item_grid.c +++ b/src/ui/menus/widgets/draw_menu_item_grid.c @@ -122,10 +122,10 @@ s32 draw_menu_item_grid(struct MenuScreen *grid) { if (frame_offset == 0) { frame_offset = item_text_variant[id] ? 4 : 0; } - if (menu_system.unk134 != 0 && (grid->data.grid.flags & 8)) { + if (menu_system.head_gadgets_hidden != 0 && (grid->data.grid.flags & 8)) { frame_offset = 2; } - if (menu_system.unk138 != 0 && (grid->data.grid.flags & 4)) { + if (menu_system.pack_gadgets_hidden != 0 && (grid->data.grid.flags & 4)) { frame_offset = 2; } }