diff --git a/config/eur/arm9/delinks.txt b/config/eur/arm9/delinks.txt index 3b906b15..c1d0335c 100644 --- a/config/eur/arm9/delinks.txt +++ b/config/eur/arm9/delinks.txt @@ -83,3 +83,9 @@ src/Main/DTCM/UnkStruct_027e05f8_2.cpp: .init start:0x02050cb4 end:0x02050ce0 .ctor start:0x02057260 end:0x02057264 .dtcm start:0x027e05f8 end:0x027e060c + +libs/nds/src/sbc.c: + complete + .text start:0x020198bc end:0x0201b1bc + .data start:0x02057354 end:0x02057434 + .bss start:0x0205ae08 end:0x0205db08 \ No newline at end of file diff --git a/config/eur/arm9/dtcm/symbols.txt b/config/eur/arm9/dtcm/symbols.txt index 64ded89b..418d169b 100644 --- a/config/eur/arm9/dtcm/symbols.txt +++ b/config/eur/arm9/dtcm/symbols.txt @@ -9,11 +9,11 @@ data_027e007c kind:data(any) addr:0x027e007c data_027e0080 kind:data(any) addr:0x027e0080 data_027e0084 kind:data(any) addr:0x027e0084 data_027e0088 kind:data(any) addr:0x027e0088 -data_027e008c kind:data(any) addr:0x027e008c -data_027e0098 kind:data(any) addr:0x027e0098 -data_027e00a4 kind:data(any) addr:0x027e00a4 +G3d_gSRTTransformHandlers kind:data(any) addr:0x027e008c +G3d_gScaleHandlers kind:data(any) addr:0x027e0098 +G3d_gTextureHandlers kind:data(any) addr:0x027e00a4 data_027e00b4 kind:data(any) addr:0x027e00b4 -data_027e00b8 kind:data(any) addr:0x027e00b8 +G3d_FuncSbcTable kind:data(any) addr:0x027e00b8 data_027e0138 kind:data(any) addr:0x027e0138 data_027e0148 kind:data(any) addr:0x027e0148 data_027e0158 kind:data(any) addr:0x027e0158 @@ -46,18 +46,18 @@ data_027e0374 kind:bss addr:0x027e0374 data_027e0378 kind:bss addr:0x027e0378 data_027e037c kind:bss addr:0x027e037c data_027e0384 kind:bss addr:0x027e0384 -data_027e03c8 kind:bss addr:0x027e03c8 data_027e03fc kind:bss addr:0x027e03fc data_027e0424 kind:bss addr:0x027e0424 gGeomMatrix kind:bss addr:0x027e0438 gGeomTranslation kind:bss addr:0x027e045c gGeomScale kind:bss addr:0x027e0468 +data_027e0478 kind:bss addr:0x027e0478 data_027e047c kind:bss addr:0x027e047c data_027e04ac kind:bss addr:0x027e04ac data_027e04dc kind:bss addr:0x027e04dc data_027e053c kind:bss addr:0x027e053c data_027e057c kind:bss addr:0x027e057c -data_027e05e0 kind:bss addr:0x027e05e0 +G3d_gRenderState kind:bss addr:0x027e05e0 data_027e05e4 kind:bss addr:0x027e05e4 data_027e05e8 kind:bss addr:0x027e05e8 data_027e05ec kind:bss addr:0x027e05ec diff --git a/config/eur/arm9/overlays/ov000/relocs.txt b/config/eur/arm9/overlays/ov000/relocs.txt index 971f6546..e00f7883 100644 --- a/config/eur/arm9/overlays/ov000/relocs.txt +++ b/config/eur/arm9/overlays/ov000/relocs.txt @@ -701,7 +701,7 @@ from:0x0207bbd0 kind:arm_call to:0x01ff892c module:itcm from:0x0207bc34 kind:load to:0x020d8860 module:overlay(0) from:0x0207bc38 kind:load to:0x027e0384 module:dtcm from:0x0207bc3c kind:load to:0x027e037c module:dtcm -from:0x0207bc40 kind:load to:0x027e03c8 module:dtcm +from:0x0207bc40 kind:load to:0x027e037c add:0x4c module:dtcm from:0x0207bc44 kind:load to:0x020d8798 module:overlay(0) from:0x0207bc8a kind:thumb_call_arm to:0x0215cb28 module:overlay(18) from:0x0207bc90 kind:thumb_call_arm to:0x0202ea0c module:main @@ -4835,7 +4835,7 @@ from:0x020a97b8 kind:arm_call to:0x01ffa9fc module:itcm from:0x020a97c0 kind:load to:0x027e045c module:dtcm from:0x020a97c4 kind:load to:0x027e0438 module:dtcm from:0x020a97c8 kind:load to:0x027e0468 module:dtcm -from:0x020a97cc kind:load to:0x027e03c8 module:dtcm +from:0x020a97cc kind:load to:0x027e037c add:0x4c module:dtcm from:0x020a97dc kind:load to:0x02019ae8 module:main from:0x020a97f4 kind:load to:0x020c0d70 module:overlay(0) from:0x020a9810 kind:arm_call to:0x02018c3c module:main @@ -6149,17 +6149,17 @@ from:0x020b3e9c kind:arm_call to:0x0203780c module:main from:0x020b3ec8 kind:arm_call to:0x020b3eac module:overlay(0) from:0x020b3ef8 kind:arm_call to:0x01ffa9fc module:itcm from:0x020b3f18 kind:arm_call to:0x01ffa9fc module:itcm -from:0x020b3f20 kind:load to:0x027e03c8 module:dtcm +from:0x020b3f20 kind:load to:0x027e037c add:0x4c module:dtcm from:0x020b3f3c kind:arm_call to:0x01ffa9fc module:itcm from:0x020b3f4c kind:arm_call to:0x01ffa9fc module:itcm from:0x020b3f6c kind:arm_call to:0x01ffa9fc module:itcm -from:0x020b3f74 kind:load to:0x027e03c8 module:dtcm +from:0x020b3f74 kind:load to:0x027e037c add:0x4c module:dtcm from:0x020b3f90 kind:arm_call to:0x01ffa9fc module:itcm from:0x020b3fa4 kind:arm_call to:0x01ffa9fc module:itcm from:0x020b3fb4 kind:arm_call to:0x01ffa9fc module:itcm from:0x020b3fcc kind:arm_call to:0x01ffa9fc module:itcm from:0x020b3fec kind:arm_call to:0x01ffa9fc module:itcm -from:0x020b3ff8 kind:load to:0x027e03c8 module:dtcm +from:0x020b3ff8 kind:load to:0x027e037c add:0x4c module:dtcm from:0x020b401c kind:arm_call to:0x01ffa9fc module:itcm from:0x020b402c kind:arm_call to:0x01ffa9fc module:itcm from:0x020b403c kind:arm_call to:0x01ffa9fc module:itcm @@ -6179,7 +6179,7 @@ from:0x020b41b8 kind:load to:0x027e0468 module:dtcm from:0x020b41bc kind:load to:0x027e0438 module:dtcm from:0x020b41c0 kind:load to:0x027e045c module:dtcm from:0x020b41e0 kind:arm_call to:0x01ffa9fc module:itcm -from:0x020b41e8 kind:load to:0x027e03c8 module:dtcm +from:0x020b41e8 kind:load to:0x027e037c add:0x4c module:dtcm from:0x020b4204 kind:arm_call to:0x02079eb4 module:overlay(0) from:0x020b4210 kind:arm_call to:0x020197bc module:main from:0x020b4218 kind:load to:0x020e9360 module:overlay(0) @@ -6459,7 +6459,7 @@ from:0x020b7f64 kind:arm_call to:0x01ffa9fc module:itcm from:0x020b7fa0 kind:arm_call_thumb to:0x01ff8230 module:itcm from:0x020b7fb0 kind:arm_call to:0x01ffa9fc module:itcm from:0x020b7fb8 kind:arm_call to:0x020bd63c module:overlay(0) -from:0x020b7fc4 kind:load to:0x027e03c8 module:dtcm +from:0x020b7fc4 kind:load to:0x027e037c add:0x4c module:dtcm from:0x020b7fc8 kind:load to:0x02050f54 module:main from:0x020b7fd4 kind:arm_call_thumb to:0x020b3ea8 module:overlay(0) from:0x020b7fdc kind:arm_call to:0x0202ea0c module:main @@ -7430,7 +7430,7 @@ from:0x020c0a5c kind:arm_call to:0x020b413c module:overlay(0) from:0x020c0a70 kind:load to:0x027e0fb4 module:dtcm from:0x020c0a74 kind:load to:0x02053f54 module:main from:0x020c0a78 kind:load to:0x020dd364 module:overlay(0) -from:0x020c0a7c kind:load to:0x027e03c8 module:dtcm +from:0x020c0a7c kind:load to:0x027e037c add:0x4c module:dtcm from:0x020c0a80 kind:load to:0x02050f54 module:main from:0x020c0a9c kind:arm_call to:0x020be99c module:overlay(0) from:0x020c0b5c kind:load to:0x02050f54 module:main diff --git a/config/eur/arm9/overlays/ov000/symbols.txt b/config/eur/arm9/overlays/ov000/symbols.txt index d2166e0c..2a9873f8 100644 --- a/config/eur/arm9/overlays/ov000/symbols.txt +++ b/config/eur/arm9/overlays/ov000/symbols.txt @@ -1992,7 +1992,7 @@ _ZN11ModelRenderD1Ev kind:function(thumb,size=0x20) addr:0x020a95a4 _ZN11ModelRenderD0Ev kind:function(thumb,size=0x28) addr:0x020a95c4 _ZN11ModelRenderD2Ev kind:function(thumb,size=0x20) addr:0x020a95ec _ZN11ModelRender14GetLcdcAddressEv kind:function(arm,size=0x8) addr:0x020a960c -_ZN11ModelRender28Init_ModelRender_UnkStruct_4EP9ItemModel kind:function(arm,size=0x10) addr:0x020a9614 +_ZN11ModelRender17Init_RenderObjectEP9ItemModel kind:function(arm,size=0x10) addr:0x020a9614 _ZN11ModelRender16UnkGetBoneMatrixEi kind:function(arm,size=0x2c) addr:0x020a9624 _ZN11ModelRender12SetTransformEP5Vec3pP5Mat3pS1_ kind:function(arm,size=0x84) addr:0x020a9650 _ZN11ModelRender22SetRotationTranslationEP5Mat3pP5Vec3p kind:function(arm,size=0x6c) addr:0x020a96d4 @@ -2007,7 +2007,7 @@ _ZN11ModelRender8vfunc_30Ev kind:function(arm,size=0x2c) addr:0x020a98bc _ZN11ModelRender14GetObjectIndexEPc kind:function(arm,size=0x24) addr:0x020a98e8 _ZN11ModelRender16GetMaterialIndexEPc kind:function(arm,size=0x2c) addr:0x020a990c _ZN11ModelRender20InitBoneMatrixArraysEj kind:function(thumb,size=0x28) addr:0x020a9938 -_ZN11ModelRender22SetUnkBoneMatrixArray1EP31ModelRender_UnkBoneMatrixStruct kind:function(arm,size=0x8) addr:0x020a9960 +_ZN11ModelRender22SetUnkBoneMatrixArray1EP17G3d_BoneMtxStruct kind:function(arm,size=0x8) addr:0x020a9960 _ZN11ModelRender8vfunc_38Ev kind:function(arm,size=0x2c) addr:0x020a9968 _ZN11ModelRender8vfunc_3cEP23ModelRenderCommandsData kind:function(arm,size=0x4) addr:0x020a9994 _ZN11ModelRender22UnkInit_Struct4_ParamsEhh kind:function(arm,size=0x28) addr:0x020a9998 diff --git a/config/eur/arm9/overlays/ov002/relocs.txt b/config/eur/arm9/overlays/ov002/relocs.txt index 09b44c2f..bc4d8dcf 100644 --- a/config/eur/arm9/overlays/ov002/relocs.txt +++ b/config/eur/arm9/overlays/ov002/relocs.txt @@ -654,7 +654,7 @@ from:0x020f35b8 kind:arm_call to:0x02005dcc module:main from:0x020f35d4 kind:load to:0x027e0384 module:dtcm from:0x020f35d8 kind:load to:0x02050f54 module:main from:0x020f35dc kind:load to:0x027e037c module:dtcm -from:0x020f35e0 kind:load to:0x027e03c8 module:dtcm +from:0x020f35e0 kind:load to:0x027e037c add:0x4c module:dtcm from:0x020f3640 kind:arm_call to:0x0202b66c module:main from:0x020f3660 kind:arm_call to:0x020f366c module:overlay(2) from:0x020f36bc kind:arm_call to:0x0202b66c module:main diff --git a/config/eur/arm9/overlays/ov005/relocs.txt b/config/eur/arm9/overlays/ov005/relocs.txt index 3c32e51f..7b5e474d 100644 --- a/config/eur/arm9/overlays/ov005/relocs.txt +++ b/config/eur/arm9/overlays/ov005/relocs.txt @@ -106,7 +106,7 @@ from:0x02101a70 kind:arm_call to:0x02005dcc module:main from:0x02101aa8 kind:load to:0x027e0384 module:dtcm from:0x02101aac kind:load to:0x02050f54 module:main from:0x02101ab0 kind:load to:0x027e037c module:dtcm -from:0x02101ab4 kind:load to:0x027e03c8 module:dtcm +from:0x02101ab4 kind:load to:0x027e037c add:0x4c module:dtcm from:0x02101af4 kind:load to:0x02112294 module:overlay(5) from:0x02101b04 kind:arm_call to:0x02101b14 module:overlay(5) from:0x02101b0c kind:arm_call to:0x02112234 module:overlay(5) diff --git a/config/eur/arm9/overlays/ov009/relocs.txt b/config/eur/arm9/overlays/ov009/relocs.txt index cc36b738..f970ca04 100644 --- a/config/eur/arm9/overlays/ov009/relocs.txt +++ b/config/eur/arm9/overlays/ov009/relocs.txt @@ -1772,7 +1772,7 @@ from:0x0211cddc kind:arm_call to:0x01ffa9fc module:itcm from:0x0211ce44 kind:arm_call to:0x02005dcc module:main from:0x0211ce60 kind:load to:0x02050f54 module:main from:0x0211ce68 kind:load to:0x027e037c module:dtcm -from:0x0211ce6c kind:load to:0x027e03c8 module:dtcm +from:0x0211ce6c kind:load to:0x027e037c add:0x4c module:dtcm from:0x0211ce88 kind:arm_call to:0x02087d34 module:overlay(0) from:0x0211ceb8 kind:load to:0x027e0f64 module:dtcm from:0x0211cf3c kind:thumb_call_arm to:0x01ff98e0 module:itcm diff --git a/config/eur/arm9/overlays/ov034/relocs.txt b/config/eur/arm9/overlays/ov034/relocs.txt index 59443feb..182d4a84 100644 --- a/config/eur/arm9/overlays/ov034/relocs.txt +++ b/config/eur/arm9/overlays/ov034/relocs.txt @@ -882,7 +882,7 @@ from:0x02184514 kind:arm_call to:0x0202de3c module:main from:0x02184524 kind:arm_call to:0x01ffa9fc module:itcm from:0x02184550 kind:arm_call to:0x02007908 module:main from:0x0218455c kind:load to:0x02185aa0 module:overlay(34) -from:0x02184560 kind:load to:0x027e03c8 module:dtcm +from:0x02184560 kind:load to:0x027e037c add:0x4c module:dtcm from:0x02184564 kind:load to:0x021861a0 module:overlay(34) from:0x0218457c kind:arm_call to:0x0201b1bc module:main from:0x02184590 kind:arm_call to:0x0202de3c module:main @@ -893,7 +893,7 @@ from:0x021845fc kind:arm_call to:0x02007908 module:main from:0x02184610 kind:arm_call to:0x01ff88b0 module:itcm from:0x02184624 kind:arm_call to:0x01ff88b0 module:itcm from:0x02184630 kind:load to:0x02185aa0 module:overlay(34) -from:0x02184634 kind:load to:0x027e03c8 module:dtcm +from:0x02184634 kind:load to:0x027e037c add:0x4c module:dtcm from:0x02184638 kind:load to:0x021861a0 module:overlay(34) from:0x0218463c kind:load to:0x02185764 module:overlay(34) from:0x02184640 kind:load to:0x02185770 module:overlay(34) diff --git a/config/eur/arm9/overlays/ov035/relocs.txt b/config/eur/arm9/overlays/ov035/relocs.txt index c7a51065..709ded71 100644 --- a/config/eur/arm9/overlays/ov035/relocs.txt +++ b/config/eur/arm9/overlays/ov035/relocs.txt @@ -312,7 +312,7 @@ from:0x0217e6a4 kind:load to:0x027e0438 module:dtcm from:0x0217e6a8 kind:load to:0x027e037c module:dtcm from:0x0217e6ac kind:load to:0x027e045c module:dtcm from:0x0217e6b0 kind:load to:0x027e0468 module:dtcm -from:0x0217e6b4 kind:load to:0x027e03c8 module:dtcm +from:0x0217e6b4 kind:load to:0x027e037c add:0x4c module:dtcm from:0x0217e6b8 kind:load to:0x027e0194 module:dtcm from:0x0217e6d0 kind:arm_call to:0x01ff80d4 module:itcm from:0x0217e700 kind:arm_call_thumb to:0x01ff8214 module:itcm diff --git a/config/eur/arm9/overlays/ov038/relocs.txt b/config/eur/arm9/overlays/ov038/relocs.txt index c65fd45b..f318b8d1 100644 --- a/config/eur/arm9/overlays/ov038/relocs.txt +++ b/config/eur/arm9/overlays/ov038/relocs.txt @@ -1074,7 +1074,7 @@ from:0x02185634 kind:arm_call to:0x01ffa9fc module:itcm from:0x02185644 kind:arm_call to:0x01ffa9fc module:itcm from:0x0218566c kind:arm_call to:0x01ffa9fc module:itcm from:0x0218567c kind:arm_call to:0x01ffa94c module:itcm -from:0x02185688 kind:load to:0x027e03c8 module:dtcm +from:0x02185688 kind:load to:0x027e037c add:0x4c module:dtcm from:0x0218568c kind:load to:0x021891e0 module:overlay(38) from:0x021856c4 kind:arm_call to:0x020c7508 module:overlay(0) from:0x021856e8 kind:arm_call to:0x0207c1b0 module:overlay(0) diff --git a/config/eur/arm9/overlays/ov057/relocs.txt b/config/eur/arm9/overlays/ov057/relocs.txt index 784a6fcd..efd188db 100644 --- a/config/eur/arm9/overlays/ov057/relocs.txt +++ b/config/eur/arm9/overlays/ov057/relocs.txt @@ -75,7 +75,7 @@ from:0x02199a9c kind:arm_call to:0x0207bb1c module:overlay(0) from:0x02199ab0 kind:arm_call to:0x0207bb1c module:overlay(0) from:0x02199abc kind:load to:0x0219a994 module:overlay(57) from:0x02199ac0 kind:load to:0x02050f54 module:main -from:0x02199ac4 kind:load to:0x027e03c8 module:dtcm +from:0x02199ac4 kind:load to:0x027e037c add:0x4c module:dtcm from:0x02199ac8 kind:load to:0x027e0f74 module:dtcm from:0x02199acc kind:load to:0x027e0de4 module:dtcm from:0x02199ad0 kind:load to:0x021990ec module:overlay(57) diff --git a/config/eur/arm9/relocs.txt b/config/eur/arm9/relocs.txt index 1c28854d..aefa6352 100644 --- a/config/eur/arm9/relocs.txt +++ b/config/eur/arm9/relocs.txt @@ -1629,7 +1629,7 @@ from:0x020182c2 kind:thumb_call_arm to:0x01ff91f8 module:itcm from:0x02018300 kind:thumb_call_arm to:0x01ff80d4 module:itcm from:0x02018334 kind:load to:0x027e037c module:dtcm from:0x02018340 kind:load to:0x027e03fc module:dtcm -from:0x0201834c kind:load to:0x027e03c8 module:dtcm +from:0x0201834c kind:load to:0x027e037c add:0x4c module:dtcm from:0x02018350 kind:load to:0x027e0384 module:dtcm from:0x02018380 kind:load to:0x027e0438 module:dtcm from:0x02018384 kind:load to:0x027e057c module:dtcm @@ -1642,7 +1642,7 @@ from:0x02018428 kind:load to:0x027e0424 module:dtcm from:0x0201844c kind:load to:0x027e037c module:dtcm from:0x0201846c kind:arm_call to:0x01ff8af8 module:itcm from:0x02018488 kind:load to:0x027e037c module:dtcm -from:0x0201848c kind:load to:0x027e03c8 module:dtcm +from:0x0201848c kind:load to:0x027e037c add:0x4c module:dtcm from:0x02018490 kind:load to:0x027e047c module:dtcm from:0x020184a4 kind:arm_call to:0x02007a18 module:main from:0x020184ac kind:arm_call to:0x01ff91f8 module:itcm @@ -1655,7 +1655,7 @@ from:0x020186f0 kind:arm_call to:0x01ff8e84 module:itcm from:0x02018710 kind:arm_call to:0x01ff8a4c module:itcm from:0x0201871c kind:arm_call to:0x01ff8af8 module:itcm from:0x02018724 kind:load to:0x027e0438 module:dtcm -from:0x02018728 kind:load to:0x027e03c8 module:dtcm +from:0x02018728 kind:load to:0x027e037c add:0x4c module:dtcm from:0x0201872c kind:load to:0x027e04ac module:dtcm from:0x02018730 kind:load to:0x027e037c module:dtcm from:0x02018734 kind:load to:0x027e04dc module:dtcm @@ -1754,12 +1754,12 @@ from:0x02019e44 kind:arm_call to:0x02007920 module:main from:0x02019e5c kind:arm_call to:0x02007920 module:main from:0x02019e6c kind:arm_call to:0x02007920 module:main from:0x02019ed8 kind:arm_call to:0x01ffa9fc module:itcm -from:0x02019ef0 kind:load to:0x02057384 module:main -from:0x02019ef4 kind:load to:0x02057390 module:main +from:0x02019ef0 kind:load to:0x02057354 add:0x30 module:main +from:0x02019ef4 kind:load to:0x02057354 add:0x3c module:main from:0x02019f00 kind:load to:0x027e037c module:dtcm -from:0x02019f04 kind:load to:0x027e03c8 module:dtcm -from:0x02019f0c kind:load to:0x02057358 module:main -from:0x02019f14 kind:load to:0x02057360 module:main +from:0x02019f04 kind:load to:0x027e037c add:0x4c module:dtcm +from:0x02019f0c kind:load to:0x02057354 add:4 module:main +from:0x02019f14 kind:load to:0x02057354 add:0xc module:main from:0x02019f18 kind:load to:0x02057354 module:main from:0x02019fb0 kind:arm_call to:0x01ffa9fc module:itcm from:0x0201a014 kind:arm_call to:0x01ffa8d4 module:itcm @@ -1784,12 +1784,12 @@ from:0x0201a1a8 kind:arm_call to:0x02007920 module:main from:0x0201a1c0 kind:arm_call to:0x02007920 module:main from:0x0201a1d0 kind:arm_call to:0x02007920 module:main from:0x0201a23c kind:arm_call to:0x01ffa9fc module:itcm -from:0x0201a254 kind:load to:0x020573cc module:main -from:0x0201a258 kind:load to:0x020573d8 module:main -from:0x0201a25c kind:load to:0x020573a8 module:main +from:0x0201a254 kind:load to:0x0205739c add:0x30 module:main +from:0x0201a258 kind:load to:0x0205739c add:0x3c module:main +from:0x0201a25c kind:load to:0x0205739c add:0xc module:main from:0x0201a268 kind:load to:0x027e037c module:dtcm -from:0x0201a26c kind:load to:0x027e03c8 module:dtcm -from:0x0201a274 kind:load to:0x020573a0 module:main +from:0x0201a26c kind:load to:0x027e037c add:0x4c module:dtcm +from:0x0201a274 kind:load to:0x0205739c add:4 module:main from:0x0201a27c kind:load to:0x0205739c module:main from:0x0201a2c4 kind:arm_call to:0x02007938 module:main from:0x0201a2c8 kind:arm_call to:0x01ffa8d4 module:itcm @@ -1799,8 +1799,8 @@ from:0x0201a5cc kind:arm_call to:0x02005698 module:main from:0x0201a74c kind:arm_call to:0x020059bc module:main from:0x0201a960 kind:arm_call to:0x02005644 module:main from:0x0201a974 kind:arm_call to:0x02005644 module:main -from:0x0201a9d0 kind:load to:0x0205c208 module:main -from:0x0201a9d8 kind:load to:0x0205c248 module:main +from:0x0201a9d0 kind:load to:0x0205ae08 add:0x1400 module:main +from:0x0201a9d8 kind:load to:0x0205ae08 add:0x1440 module:main from:0x0201aa84 kind:arm_call to:0x01ffa94c module:itcm from:0x0201ab10 kind:arm_call to:0x01ffa9fc module:itcm from:0x0201ab90 kind:arm_call to:0x01ffa9fc module:itcm @@ -1819,9 +1819,9 @@ from:0x0201adec kind:arm_call to:0x01ffa9fc module:itcm from:0x0201adf8 kind:arm_call to:0x01ffa9fc module:itcm from:0x0201ae10 kind:arm_call to:0x01ffa9fc module:itcm from:0x0201ae28 kind:load to:0x02057354 module:main -from:0x0201ae2c kind:load to:0x020573e8 module:main +from:0x0201ae2c kind:load to:0x020573e4 add:4 module:main from:0x0201ae30 kind:load to:0x027e037c module:dtcm -from:0x0201ae34 kind:load to:0x027e03c8 module:dtcm +from:0x0201ae34 kind:load to:0x027e037c add:0x4c module:dtcm from:0x0201ae38 kind:load to:0x027e0438 module:dtcm from:0x0201ae64 kind:arm_call to:0x0201b1bc module:main from:0x0201ae7c kind:arm_call to:0x01ffa9fc module:itcm @@ -1842,7 +1842,7 @@ from:0x0201b154 kind:arm_call to:0x01ffa9fc module:itcm from:0x0201b16c kind:arm_call to:0x01ffa9fc module:itcm from:0x0201b184 kind:arm_call to:0x01ffa9fc module:itcm from:0x0201b19c kind:load to:0x02057354 module:main -from:0x0201b1a0 kind:load to:0x020573f0 module:main +from:0x0201b1a0 kind:load to:0x020573ec add:4 module:main from:0x0201b1a4 kind:load to:0x020573f4 module:main from:0x0201b1a8 kind:load to:0x027e037c module:dtcm from:0x0201b1ac kind:load to:0x027e045c module:dtcm @@ -1880,7 +1880,7 @@ from:0x0201b638 kind:arm_call to:0x01ff9a50 module:itcm from:0x0201b698 kind:arm_call to:0x01ff99f4 module:itcm from:0x0201b714 kind:arm_call to:0x02018810 module:main from:0x0201b764 kind:load to:0x027e0384 module:dtcm -from:0x0201b768 kind:load to:0x027e03c8 module:dtcm +from:0x0201b768 kind:load to:0x027e037c add:0x4c module:dtcm from:0x0201b794 kind:arm_call to:0x02018810 module:main from:0x0201b7bc kind:arm_call to:0x01ff98e0 module:itcm from:0x0201b7dc kind:arm_call to:0x01ff98e0 module:itcm @@ -1981,9 +1981,9 @@ from:0x0201dad8 kind:arm_call to:0x01ffa9fc module:itcm from:0x0201daf4 kind:arm_call to:0x01ffa9fc module:itcm from:0x0201db10 kind:arm_call to:0x01ffa9fc module:itcm from:0x0201dc58 kind:load to:0x027e05e0 module:dtcm -from:0x0201dc5c kind:load to:0x0205bc14 module:main -from:0x0201dc60 kind:load to:0x0205bc18 module:main -from:0x0201dc64 kind:load to:0x0205bc1c module:main +from:0x0201dc5c kind:load to:0x0205ae08 add:0xe0c module:main +from:0x0201dc60 kind:load to:0x0205ae08 add:0xe10 module:main +from:0x0201dc64 kind:load to:0x0205ae08 add:0xe14 module:main from:0x0201dc8c kind:arm_call to:0x01ff9b24 module:itcm from:0x0201dcd8 kind:arm_call to:0x01ff9a18 module:itcm from:0x0201dcf4 kind:arm_call to:0x01ff9b24 module:itcm diff --git a/config/eur/arm9/symbols.txt b/config/eur/arm9/symbols.txt index b5cfcfa7..5c039d20 100644 --- a/config/eur/arm9/symbols.txt +++ b/config/eur/arm9/symbols.txt @@ -844,20 +844,20 @@ func_020197bc kind:function(arm,size=0x40) addr:0x020197bc func_020197fc kind:function(arm,size=0x40) addr:0x020197fc func_0201983c kind:function(arm,size=0x40) addr:0x0201983c func_0201987c kind:function(arm,size=0x40) addr:0x0201987c -func_020198bc kind:function(arm,size=0x48) addr:0x020198bc -func_02019904 kind:function(arm,size=0x17c) addr:0x02019904 -func_02019a80 kind:function(arm,size=0x68) addr:0x02019a80 -ExecModelRenderCommands kind:function(arm,size=0xdc) addr:0x02019ae8 -func_02019bc4 kind:function(arm,size=0x28) addr:0x02019bc4 -func_02019bec kind:function(arm,size=0x28) addr:0x02019bec -func_02019c14 kind:function(arm,size=0x308) addr:0x02019c14 -func_02019f1c kind:function(arm,size=0x364) addr:0x02019f1c -func_0201a280 kind:function(arm,size=0x75c) addr:0x0201a280 -func_0201a9dc kind:function(arm,size=0xdc) addr:0x0201a9dc -func_0201aab8 kind:function(arm,size=0x70) addr:0x0201aab8 -func_0201ab28 kind:function(arm,size=0x314) addr:0x0201ab28 -func_0201ae3c kind:function(arm,size=0x380) addr:0x0201ae3c -func_0201b1bc kind:function(arm,size=0x8c) addr:0x0201b1bc +G3d_RenderSBCCommands kind:function(arm,size=0x48) addr:0x020198bc +G3d_InitRenderState kind:function(arm,size=0x17c) addr:0x02019904 +G3d_SetRenderObjAnimationMap kind:function(arm,size=0x68) addr:0x02019a80 +G3d_Render kind:function(arm,size=0xdc) addr:0x02019ae8 +G3d_SBCRender_NOP kind:function(arm,size=0x28) addr:0x02019bc4 +G3d_SBCRender_END kind:function(arm,size=0x28) addr:0x02019bec +G3d_SBCRender_007 kind:function(arm,size=0x308) addr:0x02019c14 +G3d_SBCRender_008 kind:function(arm,size=0x364) addr:0x02019f1c +G3d_SBCRender_SKN kind:function(arm,size=0x75c) addr:0x0201a280 +G3d_SBCRender_00A kind:function(arm,size=0xdc) addr:0x0201a9dc +G3d_SBCRender_SCL kind:function(arm,size=0x70) addr:0x0201aab8 +G3d_SBCRender_00C kind:function(arm,size=0x314) addr:0x0201ab28 +G3d_SBCRender_00D kind:function(arm,size=0x380) addr:0x0201ae3c +G3d_GetCurrentMtx kind:function(arm,size=0x8c) addr:0x0201b1bc func_0201b248 kind:function(thumb,size=0x24) addr:0x0201b248 func_0201b26c kind:function(arm,size=0x44) addr:0x0201b26c func_0201b2b0 kind:function(arm,size=0x48) addr:0x0201b2b0 @@ -2634,19 +2634,11 @@ data_020572fc kind:data(any) addr:0x020572fc data_02057300 kind:data(any) addr:0x02057300 data_02057304 kind:data(any) addr:0x02057304 data_02057308 kind:data(any) addr:0x02057308 -data_02057354 kind:data(any) addr:0x02057354 -data_02057358 kind:data(any) addr:0x02057358 -data_02057360 kind:data(any) addr:0x02057360 -data_02057384 kind:data(any) addr:0x02057384 -data_02057390 kind:data(any) addr:0x02057390 -data_0205739c kind:data(any) addr:0x0205739c -data_020573a0 kind:data(any) addr:0x020573a0 -data_020573a8 kind:data(any) addr:0x020573a8 -data_020573cc kind:data(any) addr:0x020573cc -data_020573d8 kind:data(any) addr:0x020573d8 -data_020573e8 kind:data(any) addr:0x020573e8 -data_020573f0 kind:data(any) addr:0x020573f0 -data_020573f4 kind:data(any) addr:0x020573f4 +funcArgs$383 kind:data(any) addr:0x02057354 local +funcArgs$481 kind:data(any) addr:0x0205739c local +funcArgs$745 kind:data(any) addr:0x020573e4 local +cmd$841 kind:data(any) addr:0x020573ec local +mtx$855 kind:data(any) addr:0x020573f4 local data_02057434 kind:data(any) addr:0x02057434 data_02057454 kind:data(any) addr:0x02057454 data_02057458 kind:data(any) addr:0x02057458 @@ -3028,11 +3020,6 @@ data_0205ade4 kind:bss addr:0x0205ade4 data_0205ade8 kind:bss addr:0x0205ade8 data_0205adf4 kind:bss addr:0x0205adf4 data_0205ae08 kind:bss addr:0x0205ae08 -data_0205bc14 kind:bss addr:0x0205bc14 -data_0205bc18 kind:bss addr:0x0205bc18 -data_0205bc1c kind:bss addr:0x0205bc1c -data_0205c208 kind:bss addr:0x0205c208 -data_0205c248 kind:bss addr:0x0205c248 data_0205db08 kind:bss addr:0x0205db08 data_0205db0c kind:bss addr:0x0205db0c data_0205db10 kind:bss addr:0x0205db10 diff --git a/config/usa/arm9/delinks.txt b/config/usa/arm9/delinks.txt index 5f43dfcb..c0e04225 100644 --- a/config/usa/arm9/delinks.txt +++ b/config/usa/arm9/delinks.txt @@ -79,3 +79,9 @@ src/Main/DTCM/UnkStruct_027e05f8_2.cpp: .init start:0x02050c70 end:0x02050c9c .ctor start:0x02057218 end:0x0205721c .dtcm start:0x027e05f8 end:0x027e060c + +libs/nds/src/sbc.c: + complete + .text start:0x020198bc end:0x0201b1bc + .data start:0x020572f4 end:0x020573d4 + .bss start:0x0205ada8 end:0x0205daa8 \ No newline at end of file diff --git a/config/usa/arm9/dtcm/symbols.txt b/config/usa/arm9/dtcm/symbols.txt index d67b9691..0a0b8131 100644 --- a/config/usa/arm9/dtcm/symbols.txt +++ b/config/usa/arm9/dtcm/symbols.txt @@ -9,11 +9,11 @@ data_027e007c kind:data(any) addr:0x027e007c data_027e0080 kind:data(any) addr:0x027e0080 data_027e0084 kind:data(any) addr:0x027e0084 data_027e0088 kind:data(any) addr:0x027e0088 -data_027e008c kind:data(any) addr:0x027e008c -data_027e0098 kind:data(any) addr:0x027e0098 -data_027e00a4 kind:data(any) addr:0x027e00a4 +G3d_gSRTTransformHandlers kind:data(any) addr:0x027e008c +G3d_gScaleHandlers kind:data(any) addr:0x027e0098 +G3d_gTextureHandlers kind:data(any) addr:0x027e00a4 data_027e00b4 kind:data(any) addr:0x027e00b4 -data_027e00b8 kind:data(any) addr:0x027e00b8 +G3d_FuncSbcTable kind:data(any) addr:0x027e00b8 data_027e0138 kind:data(any) addr:0x027e0138 data_027e0148 kind:data(any) addr:0x027e0148 data_027e0158 kind:data(any) addr:0x027e0158 @@ -46,18 +46,18 @@ data_027e0374 kind:bss addr:0x027e0374 data_027e0378 kind:bss addr:0x027e0378 data_027e037c kind:bss addr:0x027e037c data_027e0384 kind:bss addr:0x027e0384 -data_027e03c8 kind:bss addr:0x027e03c8 data_027e03fc kind:bss addr:0x027e03fc data_027e0424 kind:bss addr:0x027e0424 gGeomMatrix kind:bss addr:0x027e0438 gGeomTranslation kind:bss addr:0x027e045c gGeomScale kind:bss addr:0x027e0468 +data_027e0478 kind:bss addr:0x027e0478 data_027e047c kind:bss addr:0x027e047c data_027e04ac kind:bss addr:0x027e04ac data_027e04dc kind:bss addr:0x027e04dc data_027e053c kind:bss addr:0x027e053c data_027e057c kind:bss addr:0x027e057c -data_027e05e0 kind:bss addr:0x027e05e0 +G3d_gRenderState kind:bss addr:0x027e05e0 data_027e05e4 kind:bss addr:0x027e05e4 data_027e05e8 kind:bss addr:0x027e05e8 data_027e05ec kind:bss addr:0x027e05ec diff --git a/config/usa/arm9/overlays/ov000/relocs.txt b/config/usa/arm9/overlays/ov000/relocs.txt index 82e14c8d..31084b2c 100644 --- a/config/usa/arm9/overlays/ov000/relocs.txt +++ b/config/usa/arm9/overlays/ov000/relocs.txt @@ -701,7 +701,7 @@ from:0x0207bb70 kind:arm_call to:0x01ff892c module:itcm from:0x0207bbd4 kind:load to:0x020d8800 module:overlay(0) from:0x0207bbd8 kind:load to:0x027e0384 module:dtcm from:0x0207bbdc kind:load to:0x027e037c module:dtcm -from:0x0207bbe0 kind:load to:0x027e03c8 module:dtcm +from:0x0207bbe0 kind:load to:0x027e037c add:0x4c module:dtcm from:0x0207bbe4 kind:load to:0x020d8738 module:overlay(0) from:0x0207bc2a kind:thumb_call_arm to:0x0215ca88 module:overlay(18) from:0x0207bc30 kind:thumb_call_arm to:0x0202ea08 module:main @@ -4835,7 +4835,7 @@ from:0x020a9758 kind:arm_call to:0x01ffa9fc module:itcm from:0x020a9760 kind:load to:0x027e045c module:dtcm from:0x020a9764 kind:load to:0x027e0438 module:dtcm from:0x020a9768 kind:load to:0x027e0468 module:dtcm -from:0x020a976c kind:load to:0x027e03c8 module:dtcm +from:0x020a976c kind:load to:0x027e037c add:0x4c module:dtcm from:0x020a977c kind:load to:0x02019ae8 module:main from:0x020a9794 kind:load to:0x020c0d10 module:overlay(0) from:0x020a97b0 kind:arm_call to:0x02018c3c module:main @@ -6149,17 +6149,17 @@ from:0x020b3e3c kind:arm_call to:0x020377c8 module:main from:0x020b3e68 kind:arm_call to:0x020b3e4c module:overlay(0) from:0x020b3e98 kind:arm_call to:0x01ffa9fc module:itcm from:0x020b3eb8 kind:arm_call to:0x01ffa9fc module:itcm -from:0x020b3ec0 kind:load to:0x027e03c8 module:dtcm +from:0x020b3ec0 kind:load to:0x027e037c add:0x4c module:dtcm from:0x020b3edc kind:arm_call to:0x01ffa9fc module:itcm from:0x020b3eec kind:arm_call to:0x01ffa9fc module:itcm from:0x020b3f0c kind:arm_call to:0x01ffa9fc module:itcm -from:0x020b3f14 kind:load to:0x027e03c8 module:dtcm +from:0x020b3f14 kind:load to:0x027e037c add:0x4c module:dtcm from:0x020b3f30 kind:arm_call to:0x01ffa9fc module:itcm from:0x020b3f44 kind:arm_call to:0x01ffa9fc module:itcm from:0x020b3f54 kind:arm_call to:0x01ffa9fc module:itcm from:0x020b3f6c kind:arm_call to:0x01ffa9fc module:itcm from:0x020b3f8c kind:arm_call to:0x01ffa9fc module:itcm -from:0x020b3f98 kind:load to:0x027e03c8 module:dtcm +from:0x020b3f98 kind:load to:0x027e037c add:0x4c module:dtcm from:0x020b3fbc kind:arm_call to:0x01ffa9fc module:itcm from:0x020b3fcc kind:arm_call to:0x01ffa9fc module:itcm from:0x020b3fdc kind:arm_call to:0x01ffa9fc module:itcm @@ -6179,7 +6179,7 @@ from:0x020b4158 kind:load to:0x027e0468 module:dtcm from:0x020b415c kind:load to:0x027e0438 module:dtcm from:0x020b4160 kind:load to:0x027e045c module:dtcm from:0x020b4180 kind:arm_call to:0x01ffa9fc module:itcm -from:0x020b4188 kind:load to:0x027e03c8 module:dtcm +from:0x020b4188 kind:load to:0x027e037c add:0x4c module:dtcm from:0x020b41a4 kind:arm_call to:0x02079e54 module:overlay(0) from:0x020b41b0 kind:arm_call to:0x020197bc module:main from:0x020b41b8 kind:load to:0x020e9300 module:overlay(0) @@ -6459,7 +6459,7 @@ from:0x020b7f04 kind:arm_call to:0x01ffa9fc module:itcm from:0x020b7f40 kind:arm_call_thumb to:0x01ff8230 module:itcm from:0x020b7f50 kind:arm_call to:0x01ffa9fc module:itcm from:0x020b7f58 kind:arm_call to:0x020bd5dc module:overlay(0) -from:0x020b7f64 kind:load to:0x027e03c8 module:dtcm +from:0x020b7f64 kind:load to:0x027e037c add:0x4c module:dtcm from:0x020b7f68 kind:load to:0x02050f10 module:main from:0x020b7f74 kind:arm_call_thumb to:0x020b3e48 module:overlay(0) from:0x020b7f7c kind:arm_call to:0x0202ea08 module:main @@ -7430,7 +7430,7 @@ from:0x020c09fc kind:arm_call to:0x020b40dc module:overlay(0) from:0x020c0a10 kind:load to:0x027e0fb4 module:dtcm from:0x020c0a14 kind:load to:0x02053f10 module:main from:0x020c0a18 kind:load to:0x020dd304 module:overlay(0) -from:0x020c0a1c kind:load to:0x027e03c8 module:dtcm +from:0x020c0a1c kind:load to:0x027e037c add:0x4c module:dtcm from:0x020c0a20 kind:load to:0x02050f10 module:main from:0x020c0a3c kind:arm_call to:0x020be93c module:overlay(0) from:0x020c0afc kind:load to:0x02050f10 module:main diff --git a/config/usa/arm9/overlays/ov000/symbols.txt b/config/usa/arm9/overlays/ov000/symbols.txt index 2b0059c3..3b5b344d 100644 --- a/config/usa/arm9/overlays/ov000/symbols.txt +++ b/config/usa/arm9/overlays/ov000/symbols.txt @@ -1992,7 +1992,7 @@ _ZN11ModelRenderD1Ev kind:function(thumb,size=0x20) addr:0x020a9544 _ZN11ModelRenderD0Ev kind:function(thumb,size=0x28) addr:0x020a9564 _ZN11ModelRenderD2Ev kind:function(thumb,size=0x20) addr:0x020a958c _ZN11ModelRender14GetLcdcAddressEv kind:function(arm,size=0x8) addr:0x020a95ac -_ZN11ModelRender28Init_ModelRender_UnkStruct_4EP9ItemModel kind:function(arm,size=0x10) addr:0x020a95b4 +_ZN11ModelRender17Init_RenderObjectEP9ItemModel kind:function(arm,size=0x10) addr:0x020a95b4 _ZN11ModelRender16UnkGetBoneMatrixEi kind:function(arm,size=0x2c) addr:0x020a95c4 _ZN11ModelRender12SetTransformEP5Vec3pP5Mat3pS1_ kind:function(arm,size=0x84) addr:0x020a95f0 _ZN11ModelRender22SetRotationTranslationEP5Mat3pP5Vec3p kind:function(arm,size=0x6c) addr:0x020a9674 @@ -2007,7 +2007,7 @@ _ZN11ModelRender8vfunc_30Ev kind:function(arm,size=0x2c) addr:0x020a985c _ZN11ModelRender14GetObjectIndexEPc kind:function(arm,size=0x24) addr:0x020a9888 _ZN11ModelRender16GetMaterialIndexEPc kind:function(arm,size=0x2c) addr:0x020a98ac _ZN11ModelRender20InitBoneMatrixArraysEj kind:function(thumb,size=0x28) addr:0x020a98d8 -_ZN11ModelRender22SetUnkBoneMatrixArray1EP31ModelRender_UnkBoneMatrixStruct kind:function(arm,size=0x8) addr:0x020a9900 +_ZN11ModelRender22SetUnkBoneMatrixArray1EP17G3d_BoneMtxStruct kind:function(arm,size=0x8) addr:0x020a9900 _ZN11ModelRender8vfunc_38Ev kind:function(arm,size=0x2c) addr:0x020a9908 _ZN11ModelRender8vfunc_3cEP23ModelRenderCommandsData kind:function(arm,size=0x4) addr:0x020a9934 _ZN11ModelRender22UnkInit_Struct4_ParamsEhh kind:function(arm,size=0x28) addr:0x020a9938 diff --git a/config/usa/arm9/overlays/ov002/relocs.txt b/config/usa/arm9/overlays/ov002/relocs.txt index d7b9487c..a64fb2c1 100644 --- a/config/usa/arm9/overlays/ov002/relocs.txt +++ b/config/usa/arm9/overlays/ov002/relocs.txt @@ -654,7 +654,7 @@ from:0x020f3558 kind:arm_call to:0x02005dcc module:main from:0x020f3574 kind:load to:0x027e0384 module:dtcm from:0x020f3578 kind:load to:0x02050f10 module:main from:0x020f357c kind:load to:0x027e037c module:dtcm -from:0x020f3580 kind:load to:0x027e03c8 module:dtcm +from:0x020f3580 kind:load to:0x027e037c add:0x4c module:dtcm from:0x020f35e0 kind:arm_call to:0x0202b654 module:main from:0x020f3600 kind:arm_call to:0x020f360c module:overlay(2) from:0x020f365c kind:arm_call to:0x0202b654 module:main diff --git a/config/usa/arm9/overlays/ov005/relocs.txt b/config/usa/arm9/overlays/ov005/relocs.txt index fe57d0e2..c21613e8 100644 --- a/config/usa/arm9/overlays/ov005/relocs.txt +++ b/config/usa/arm9/overlays/ov005/relocs.txt @@ -106,7 +106,7 @@ from:0x021019f0 kind:arm_call to:0x02005dcc module:main from:0x02101a28 kind:load to:0x027e0384 module:dtcm from:0x02101a2c kind:load to:0x02050f10 module:main from:0x02101a30 kind:load to:0x027e037c module:dtcm -from:0x02101a34 kind:load to:0x027e03c8 module:dtcm +from:0x02101a34 kind:load to:0x027e037c add:0x4c module:dtcm from:0x02101a74 kind:load to:0x02112214 module:overlay(5) from:0x02101a84 kind:arm_call to:0x02101a94 module:overlay(5) from:0x02101a8c kind:arm_call to:0x021121b4 module:overlay(5) diff --git a/config/usa/arm9/overlays/ov009/relocs.txt b/config/usa/arm9/overlays/ov009/relocs.txt index 750a6edd..fac38039 100644 --- a/config/usa/arm9/overlays/ov009/relocs.txt +++ b/config/usa/arm9/overlays/ov009/relocs.txt @@ -1772,7 +1772,7 @@ from:0x0211cd5c kind:arm_call to:0x01ffa9fc module:itcm from:0x0211cdc4 kind:arm_call to:0x02005dcc module:main from:0x0211cde0 kind:load to:0x02050f10 module:main from:0x0211cde8 kind:load to:0x027e037c module:dtcm -from:0x0211cdec kind:load to:0x027e03c8 module:dtcm +from:0x0211cdec kind:load to:0x027e037c add:0x4c module:dtcm from:0x0211ce08 kind:arm_call to:0x02087cd4 module:overlay(0) from:0x0211ce38 kind:load to:0x027e0f64 module:dtcm from:0x0211cebc kind:thumb_call_arm to:0x01ff98e0 module:itcm diff --git a/config/usa/arm9/overlays/ov034/relocs.txt b/config/usa/arm9/overlays/ov034/relocs.txt index 35fb0c70..e4e7ca8c 100644 --- a/config/usa/arm9/overlays/ov034/relocs.txt +++ b/config/usa/arm9/overlays/ov034/relocs.txt @@ -882,7 +882,7 @@ from:0x02184474 kind:arm_call to:0x0202de38 module:main from:0x02184484 kind:arm_call to:0x01ffa9fc module:itcm from:0x021844b0 kind:arm_call to:0x02007908 module:main from:0x021844bc kind:load to:0x02185a00 module:overlay(34) -from:0x021844c0 kind:load to:0x027e03c8 module:dtcm +from:0x021844c0 kind:load to:0x027e037c add:0x4c module:dtcm from:0x021844c4 kind:load to:0x02186100 module:overlay(34) from:0x021844dc kind:arm_call to:0x0201b1bc module:main from:0x021844f0 kind:arm_call to:0x0202de38 module:main @@ -893,7 +893,7 @@ from:0x0218455c kind:arm_call to:0x02007908 module:main from:0x02184570 kind:arm_call to:0x01ff88b0 module:itcm from:0x02184584 kind:arm_call to:0x01ff88b0 module:itcm from:0x02184590 kind:load to:0x02185a00 module:overlay(34) -from:0x02184594 kind:load to:0x027e03c8 module:dtcm +from:0x02184594 kind:load to:0x027e037c add:0x4c module:dtcm from:0x02184598 kind:load to:0x02186100 module:overlay(34) from:0x0218459c kind:load to:0x021856c4 module:overlay(34) from:0x021845a0 kind:load to:0x021856d0 module:overlay(34) diff --git a/config/usa/arm9/overlays/ov035/relocs.txt b/config/usa/arm9/overlays/ov035/relocs.txt index 86d1d605..bd717780 100644 --- a/config/usa/arm9/overlays/ov035/relocs.txt +++ b/config/usa/arm9/overlays/ov035/relocs.txt @@ -312,7 +312,7 @@ from:0x0217e604 kind:load to:0x027e0438 module:dtcm from:0x0217e608 kind:load to:0x027e037c module:dtcm from:0x0217e60c kind:load to:0x027e045c module:dtcm from:0x0217e610 kind:load to:0x027e0468 module:dtcm -from:0x0217e614 kind:load to:0x027e03c8 module:dtcm +from:0x0217e614 kind:load to:0x027e037c add:0x4c module:dtcm from:0x0217e618 kind:load to:0x027e0194 module:dtcm from:0x0217e630 kind:arm_call to:0x01ff80d4 module:itcm from:0x0217e660 kind:arm_call_thumb to:0x01ff8214 module:itcm diff --git a/config/usa/arm9/overlays/ov038/relocs.txt b/config/usa/arm9/overlays/ov038/relocs.txt index 7ee1e941..d9b408df 100644 --- a/config/usa/arm9/overlays/ov038/relocs.txt +++ b/config/usa/arm9/overlays/ov038/relocs.txt @@ -1074,7 +1074,7 @@ from:0x02185594 kind:arm_call to:0x01ffa9fc module:itcm from:0x021855a4 kind:arm_call to:0x01ffa9fc module:itcm from:0x021855cc kind:arm_call to:0x01ffa9fc module:itcm from:0x021855dc kind:arm_call to:0x01ffa94c module:itcm -from:0x021855e8 kind:load to:0x027e03c8 module:dtcm +from:0x021855e8 kind:load to:0x027e037c add:0x4c module:dtcm from:0x021855ec kind:load to:0x02189140 module:overlay(38) from:0x02185624 kind:arm_call to:0x020c74a8 module:overlay(0) from:0x02185648 kind:arm_call to:0x0207c150 module:overlay(0) diff --git a/config/usa/arm9/overlays/ov057/relocs.txt b/config/usa/arm9/overlays/ov057/relocs.txt index a2eedb1c..eca1254d 100644 --- a/config/usa/arm9/overlays/ov057/relocs.txt +++ b/config/usa/arm9/overlays/ov057/relocs.txt @@ -75,7 +75,7 @@ from:0x021999fc kind:arm_call to:0x0207babc module:overlay(0) from:0x02199a10 kind:arm_call to:0x0207babc module:overlay(0) from:0x02199a1c kind:load to:0x0219a8f4 module:overlay(57) from:0x02199a20 kind:load to:0x02050f10 module:main -from:0x02199a24 kind:load to:0x027e03c8 module:dtcm +from:0x02199a24 kind:load to:0x027e037c add:0x4c module:dtcm from:0x02199a28 kind:load to:0x027e0f74 module:dtcm from:0x02199a2c kind:load to:0x027e0de4 module:dtcm from:0x02199a30 kind:load to:0x0219904c module:overlay(57) diff --git a/config/usa/arm9/relocs.txt b/config/usa/arm9/relocs.txt index d00330f4..2128e4d1 100644 --- a/config/usa/arm9/relocs.txt +++ b/config/usa/arm9/relocs.txt @@ -1629,7 +1629,7 @@ from:0x020182c2 kind:thumb_call_arm to:0x01ff91f8 module:itcm from:0x02018300 kind:thumb_call_arm to:0x01ff80d4 module:itcm from:0x02018334 kind:load to:0x027e037c module:dtcm from:0x02018340 kind:load to:0x027e03fc module:dtcm -from:0x0201834c kind:load to:0x027e03c8 module:dtcm +from:0x0201834c kind:load to:0x027e037c add:0x4c module:dtcm from:0x02018350 kind:load to:0x027e0384 module:dtcm from:0x02018380 kind:load to:0x027e0438 module:dtcm from:0x02018384 kind:load to:0x027e057c module:dtcm @@ -1642,7 +1642,7 @@ from:0x02018428 kind:load to:0x027e0424 module:dtcm from:0x0201844c kind:load to:0x027e037c module:dtcm from:0x0201846c kind:arm_call to:0x01ff8af8 module:itcm from:0x02018488 kind:load to:0x027e037c module:dtcm -from:0x0201848c kind:load to:0x027e03c8 module:dtcm +from:0x0201848c kind:load to:0x027e037c add:0x4c module:dtcm from:0x02018490 kind:load to:0x027e047c module:dtcm from:0x020184a4 kind:arm_call to:0x02007a18 module:main from:0x020184ac kind:arm_call to:0x01ff91f8 module:itcm @@ -1655,7 +1655,7 @@ from:0x020186f0 kind:arm_call to:0x01ff8e84 module:itcm from:0x02018710 kind:arm_call to:0x01ff8a4c module:itcm from:0x0201871c kind:arm_call to:0x01ff8af8 module:itcm from:0x02018724 kind:load to:0x027e0438 module:dtcm -from:0x02018728 kind:load to:0x027e03c8 module:dtcm +from:0x02018728 kind:load to:0x027e037c add:0x4c module:dtcm from:0x0201872c kind:load to:0x027e04ac module:dtcm from:0x02018730 kind:load to:0x027e037c module:dtcm from:0x02018734 kind:load to:0x027e04dc module:dtcm @@ -1754,12 +1754,12 @@ from:0x02019e44 kind:arm_call to:0x02007920 module:main from:0x02019e5c kind:arm_call to:0x02007920 module:main from:0x02019e6c kind:arm_call to:0x02007920 module:main from:0x02019ed8 kind:arm_call to:0x01ffa9fc module:itcm -from:0x02019ef0 kind:load to:0x02057324 module:main -from:0x02019ef4 kind:load to:0x02057330 module:main +from:0x02019ef0 kind:load to:0x020572f4 add:0x30 module:main +from:0x02019ef4 kind:load to:0x020572f4 add:0x3c module:main from:0x02019f00 kind:load to:0x027e037c module:dtcm -from:0x02019f04 kind:load to:0x027e03c8 module:dtcm -from:0x02019f0c kind:load to:0x020572f8 module:main -from:0x02019f14 kind:load to:0x02057300 module:main +from:0x02019f04 kind:load to:0x027e037c add:0x4c module:dtcm +from:0x02019f0c kind:load to:0x020572f4 add:4 module:main +from:0x02019f14 kind:load to:0x020572f4 add:0xc module:main from:0x02019f18 kind:load to:0x020572f4 module:main from:0x02019fb0 kind:arm_call to:0x01ffa9fc module:itcm from:0x0201a014 kind:arm_call to:0x01ffa8d4 module:itcm @@ -1784,12 +1784,12 @@ from:0x0201a1a8 kind:arm_call to:0x02007920 module:main from:0x0201a1c0 kind:arm_call to:0x02007920 module:main from:0x0201a1d0 kind:arm_call to:0x02007920 module:main from:0x0201a23c kind:arm_call to:0x01ffa9fc module:itcm -from:0x0201a254 kind:load to:0x0205736c module:main -from:0x0201a258 kind:load to:0x02057378 module:main -from:0x0201a25c kind:load to:0x02057348 module:main +from:0x0201a254 kind:load to:0x0205733c add:0x30 module:main +from:0x0201a258 kind:load to:0x0205733c add:0x3c module:main +from:0x0201a25c kind:load to:0x0205733c add:0xc module:main from:0x0201a268 kind:load to:0x027e037c module:dtcm -from:0x0201a26c kind:load to:0x027e03c8 module:dtcm -from:0x0201a274 kind:load to:0x02057340 module:main +from:0x0201a26c kind:load to:0x027e037c add:0x4c module:dtcm +from:0x0201a274 kind:load to:0x0205733c add:4 module:main from:0x0201a27c kind:load to:0x0205733c module:main from:0x0201a2c4 kind:arm_call to:0x02007938 module:main from:0x0201a2c8 kind:arm_call to:0x01ffa8d4 module:itcm @@ -1799,8 +1799,8 @@ from:0x0201a5cc kind:arm_call to:0x02005698 module:main from:0x0201a74c kind:arm_call to:0x020059bc module:main from:0x0201a960 kind:arm_call to:0x02005644 module:main from:0x0201a974 kind:arm_call to:0x02005644 module:main -from:0x0201a9d0 kind:load to:0x0205c1a8 module:main -from:0x0201a9d8 kind:load to:0x0205c1e8 module:main +from:0x0201a9d0 kind:load to:0x0205ada8 add:0x1400 module:main +from:0x0201a9d8 kind:load to:0x0205ada8 add:0x1440 module:main from:0x0201aa84 kind:arm_call to:0x01ffa94c module:itcm from:0x0201ab10 kind:arm_call to:0x01ffa9fc module:itcm from:0x0201ab90 kind:arm_call to:0x01ffa9fc module:itcm @@ -1819,9 +1819,9 @@ from:0x0201adec kind:arm_call to:0x01ffa9fc module:itcm from:0x0201adf8 kind:arm_call to:0x01ffa9fc module:itcm from:0x0201ae10 kind:arm_call to:0x01ffa9fc module:itcm from:0x0201ae28 kind:load to:0x020572f4 module:main -from:0x0201ae2c kind:load to:0x02057388 module:main +from:0x0201ae2c kind:load to:0x02057384 add:4 module:main from:0x0201ae30 kind:load to:0x027e037c module:dtcm -from:0x0201ae34 kind:load to:0x027e03c8 module:dtcm +from:0x0201ae34 kind:load to:0x027e037c add:0x4c module:dtcm from:0x0201ae38 kind:load to:0x027e0438 module:dtcm from:0x0201ae64 kind:arm_call to:0x0201b1bc module:main from:0x0201ae7c kind:arm_call to:0x01ffa9fc module:itcm @@ -1842,7 +1842,7 @@ from:0x0201b154 kind:arm_call to:0x01ffa9fc module:itcm from:0x0201b16c kind:arm_call to:0x01ffa9fc module:itcm from:0x0201b184 kind:arm_call to:0x01ffa9fc module:itcm from:0x0201b19c kind:load to:0x020572f4 module:main -from:0x0201b1a0 kind:load to:0x02057390 module:main +from:0x0201b1a0 kind:load to:0x0205738c add:4 module:main from:0x0201b1a4 kind:load to:0x02057394 module:main from:0x0201b1a8 kind:load to:0x027e037c module:dtcm from:0x0201b1ac kind:load to:0x027e045c module:dtcm @@ -1880,7 +1880,7 @@ from:0x0201b638 kind:arm_call to:0x01ff9a50 module:itcm from:0x0201b698 kind:arm_call to:0x01ff99f4 module:itcm from:0x0201b714 kind:arm_call to:0x02018810 module:main from:0x0201b764 kind:load to:0x027e0384 module:dtcm -from:0x0201b768 kind:load to:0x027e03c8 module:dtcm +from:0x0201b768 kind:load to:0x027e037c add:0x4c module:dtcm from:0x0201b794 kind:arm_call to:0x02018810 module:main from:0x0201b7bc kind:arm_call to:0x01ff98e0 module:itcm from:0x0201b7dc kind:arm_call to:0x01ff98e0 module:itcm @@ -1981,9 +1981,9 @@ from:0x0201dad8 kind:arm_call to:0x01ffa9fc module:itcm from:0x0201daf4 kind:arm_call to:0x01ffa9fc module:itcm from:0x0201db10 kind:arm_call to:0x01ffa9fc module:itcm from:0x0201dc58 kind:load to:0x027e05e0 module:dtcm -from:0x0201dc5c kind:load to:0x0205bbb4 module:main -from:0x0201dc60 kind:load to:0x0205bbb8 module:main -from:0x0201dc64 kind:load to:0x0205bbbc module:main +from:0x0201dc5c kind:load to:0x0205ada8 add:0xe0c module:main +from:0x0201dc60 kind:load to:0x0205ada8 add:0xe10 module:main +from:0x0201dc64 kind:load to:0x0205ada8 add:0xe14 module:main from:0x0201dc8c kind:arm_call to:0x01ff9b24 module:itcm from:0x0201dcd8 kind:arm_call to:0x01ff9a18 module:itcm from:0x0201dcf4 kind:arm_call to:0x01ff9b24 module:itcm diff --git a/config/usa/arm9/symbols.txt b/config/usa/arm9/symbols.txt index f5117022..cbbffa70 100644 --- a/config/usa/arm9/symbols.txt +++ b/config/usa/arm9/symbols.txt @@ -844,20 +844,20 @@ func_020197bc kind:function(arm,size=0x40) addr:0x020197bc func_020197fc kind:function(arm,size=0x40) addr:0x020197fc func_0201983c kind:function(arm,size=0x40) addr:0x0201983c func_0201987c kind:function(arm,size=0x40) addr:0x0201987c -func_020198bc kind:function(arm,size=0x48) addr:0x020198bc -func_02019904 kind:function(arm,size=0x17c) addr:0x02019904 -func_02019a80 kind:function(arm,size=0x68) addr:0x02019a80 -ExecModelRenderCommands kind:function(arm,size=0xdc) addr:0x02019ae8 -func_02019bc4 kind:function(arm,size=0x28) addr:0x02019bc4 -func_02019bec kind:function(arm,size=0x28) addr:0x02019bec -func_02019c14 kind:function(arm,size=0x308) addr:0x02019c14 -func_02019f1c kind:function(arm,size=0x364) addr:0x02019f1c -func_0201a280 kind:function(arm,size=0x75c) addr:0x0201a280 -func_0201a9dc kind:function(arm,size=0xdc) addr:0x0201a9dc -func_0201aab8 kind:function(arm,size=0x70) addr:0x0201aab8 -func_0201ab28 kind:function(arm,size=0x314) addr:0x0201ab28 -func_0201ae3c kind:function(arm,size=0x380) addr:0x0201ae3c -func_0201b1bc kind:function(arm,size=0x8c) addr:0x0201b1bc +G3d_RenderSBCCommands kind:function(arm,size=0x48) addr:0x020198bc +G3d_InitRenderState kind:function(arm,size=0x17c) addr:0x02019904 +G3d_SetRenderObjAnimationMap kind:function(arm,size=0x68) addr:0x02019a80 +G3d_Render kind:function(arm,size=0xdc) addr:0x02019ae8 +G3d_SBCRender_NOP kind:function(arm,size=0x28) addr:0x02019bc4 +G3d_SBCRender_END kind:function(arm,size=0x28) addr:0x02019bec +G3d_SBCRender_007 kind:function(arm,size=0x308) addr:0x02019c14 +G3d_SBCRender_008 kind:function(arm,size=0x364) addr:0x02019f1c +G3d_SBCRender_SKN kind:function(arm,size=0x75c) addr:0x0201a280 +G3d_SBCRender_00A kind:function(arm,size=0xdc) addr:0x0201a9dc +G3d_SBCRender_SCL kind:function(arm,size=0x70) addr:0x0201aab8 +G3d_SBCRender_00C kind:function(arm,size=0x314) addr:0x0201ab28 +G3d_SBCRender_00D kind:function(arm,size=0x380) addr:0x0201ae3c +G3d_GetCurrentMtx kind:function(arm,size=0x8c) addr:0x0201b1bc func_0201b248 kind:function(thumb,size=0x24) addr:0x0201b248 func_0201b26c kind:function(arm,size=0x44) addr:0x0201b26c func_0201b2b0 kind:function(arm,size=0x48) addr:0x0201b2b0 @@ -2633,19 +2633,11 @@ data_020572fc kind:data(any) addr:0x0205729c data_02057300 kind:data(any) addr:0x020572a0 data_02057304 kind:data(any) addr:0x020572a4 data_02057308 kind:data(any) addr:0x020572a8 -data_02057354 kind:data(any) addr:0x020572f4 -data_02057358 kind:data(any) addr:0x020572f8 -data_02057360 kind:data(any) addr:0x02057300 -data_02057384 kind:data(any) addr:0x02057324 -data_02057390 kind:data(any) addr:0x02057330 -data_0205739c kind:data(any) addr:0x0205733c -data_020573a0 kind:data(any) addr:0x02057340 -data_020573a8 kind:data(any) addr:0x02057348 -data_020573cc kind:data(any) addr:0x0205736c -data_020573d8 kind:data(any) addr:0x02057378 -data_020573e8 kind:data(any) addr:0x02057388 -data_020573f0 kind:data(any) addr:0x02057390 -data_020573f4 kind:data(any) addr:0x02057394 +funcArgs$383 kind:data(any) addr:0x020572f4 local +funcArgs$481 kind:data(any) addr:0x0205733c local +funcArgs$745 kind:data(any) addr:0x02057384 local +cmd$841 kind:data(any) addr:0x0205738c local +mtx$855 kind:data(any) addr:0x02057394 local data_02057434 kind:data(any) addr:0x020573d4 data_02057454 kind:data(any) addr:0x020573f4 data_02057458 kind:data(any) addr:0x020573f8 @@ -3028,11 +3020,6 @@ data_0205ade4 kind:bss addr:0x0205ad84 data_0205ade8 kind:bss addr:0x0205ad88 data_0205adf4 kind:bss addr:0x0205ad94 data_0205ae08 kind:bss addr:0x0205ada8 -data_0205bc14 kind:bss addr:0x0205bbb4 -data_0205bc18 kind:bss addr:0x0205bbb8 -data_0205bc1c kind:bss addr:0x0205bbbc -data_0205c208 kind:bss addr:0x0205c1a8 -data_0205c248 kind:bss addr:0x0205c1e8 data_0205db08 kind:bss addr:0x0205daa8 data_0205db0c kind:bss addr:0x0205daac data_0205db10 kind:bss addr:0x0205dab0 diff --git a/include/Actor/Navi/ActorNavi.hpp b/include/Actor/Navi/ActorNavi.hpp index 841c91f1..c50ee23c 100644 --- a/include/Actor/Navi/ActorNavi.hpp +++ b/include/Actor/Navi/ActorNavi.hpp @@ -5,6 +5,7 @@ #include "Unknown/UnkStruct_02057200.hpp" #include "Unknown/UnkStruct_ov000_020beba8.hpp" #include "Unknown/UnkStruct_ov000_020c0c08.hpp" +#include "nds/g3d/sbc.h" class UnkStruct_ov000_020b8110 : public UnkStruct_ov000_020beba8 { public: @@ -45,7 +46,7 @@ public: /* 344 */ q20 mUnk_344; /* 348 */ unk32 mUnk_348; /* 34c */ ActorNaviBase_Unk1 mUnk_34c[4]; - /* 35c */ ModelRender_UnkBoneMatrixStruct unkBoneMatrixStruct; + /* 35c */ G3d_BoneMtxStruct unkBoneMatrixStruct; /* 3b4 */ EquipHammer *mHammer; /* 3b8 */ UnkStruct_02057200 mUnk_3b8; /* 3c0 */ u8 mUnk_3c0; diff --git a/include/DTCM/UnkStruct_027e037c.hpp b/include/DTCM/UnkStruct_027e037c.h similarity index 90% rename from include/DTCM/UnkStruct_027e037c.hpp rename to include/DTCM/UnkStruct_027e037c.h index 96359f03..81b20b1a 100644 --- a/include/DTCM/UnkStruct_027e037c.hpp +++ b/include/DTCM/UnkStruct_027e037c.h @@ -5,8 +5,7 @@ #include -struct UnkStruct_027e037c { -public: +typedef struct UnkStruct_027e037c_ { /* 000 */ unk32 mUnk_000; /* 004 */ unk32 mUnk_004; /* 008 */ Mat4p mUnk_008; @@ -38,6 +37,6 @@ public: /* 160 */ Mat4x3p mUnk_160; /* 190 */ Mat4x3p mUnk_190; /* 1c0 */ -}; +} UnkStruct_027e037c; -extern UnkStruct_027e037c data_027e037c; +extern UnkStruct_027e037c data_027e037c; \ No newline at end of file diff --git a/include/Render/ModelRender.hpp b/include/Render/ModelRender.hpp index d0fca92a..846ad1f0 100644 --- a/include/Render/ModelRender.hpp +++ b/include/Render/ModelRender.hpp @@ -3,6 +3,7 @@ #include "global.h" #include "types.h" +#include "nds/g3d/sbc.h" #include #include "System/SysNew.hpp" @@ -10,39 +11,9 @@ class ModelRender; -struct ModelRender_UnkBoneMatrixStruct { - /* 00 */ unk8 mUnk_00[0x28]; - /* 28 */ Mat3p mUnk_28; - /* 4c */ unk8 mUnk_4c[0xC]; - /* 58 */ -}; - -struct ModelRender_UnkStruct_4 { - /* 00 */ unk32 flags; - /* 04 */ void *mLcdcAddr; - /* 08 */ void *mUnk_08; // this attribute is related to UnkStruct_ov000_020c0c08 - /* 0c */ void *mUnkTransformFunc; - /* 10 */ void *mUnk_10; // also related to UnkStruct_ov000_020c0c08 - /* 14 */ void *mUnkMaterialFunc; - /* 18 */ void *mUnk_18; // also related to UnkStruct_ov000_020c0c08 - /* 1c */ void *mUnkVisibilityFunc; - /* 20 */ void *mUnkFunc_20; - /* 24 */ unk8 mUnk_24; - /* 25 */ unk8 mUnk_25; - /* 26 */ unk8 mUnk_26[2]; - /* 28 */ void *mUnk_28; - /* 2c */ ModelRender *mUnk_2c; // pointer to self? - /* 30 */ unk32 mUnk_30; - /* 34 */ ModelRender_UnkBoneMatrixStruct *unkBoneMatrixArray1; - /* 38 */ unk32 mUnk_38[3]; - /* 44 */ unk32 mUnk_44[2]; - /* 4c */ unk32 mUnk_4c[2]; - /* 54 */ -}; - struct ModelRenderCommandsData { /* 00 */ u8 command; - /* 04 */ ModelRender_UnkStruct_4 *unkStruct4; + /* 04 */ G3d_RenderObject *unkStruct4; /* 08 */ }; @@ -51,13 +22,13 @@ class ItemModel; class ModelRender : public SysObject { public: /* 00 (vtable) */ - /* 04 */ ModelRender_UnkStruct_4 mUnk_04; - /* 58 */ ModelRender_UnkBoneMatrixStruct *unkBoneMatrixArray2; + /* 04 */ G3d_RenderObject renderObj; + /* 58 */ G3d_BoneMtxStruct *unkBoneMatrixArray2; /* 5c */ /* 00 */ virtual ~ModelRender(); /* 08 */ virtual void *GetLcdcAddress(); - /* 0c */ virtual void Init_ModelRender_UnkStruct_4(ItemModel *model); + /* 0c */ virtual void Init_RenderObject(ItemModel *model); /* 10 */ virtual void SetTransform(Vec3p *scale, Mat3p *rotation, Vec3p *translation); /* 14 */ virtual void SetRotationTranslation(Mat3p *rotation, Vec3p *translation); /* 18 */ virtual void SetTranslation(Vec3p *translation); @@ -73,11 +44,11 @@ public: /* 40 */ ModelRender(ItemModel *itemModel); - ModelRender_UnkBoneMatrixStruct *UnkGetBoneMatrix(s32 index); + G3d_BoneMtxStruct *UnkGetBoneMatrix(s32 index); s32 GetObjectIndex(char *objectName); s32 GetMaterialIndex(char *materialName); void InitBoneMatrixArrays(u32 idLength); - void SetUnkBoneMatrixArray1(ModelRender_UnkBoneMatrixStruct *boneMatrix); + void SetUnkBoneMatrixArray1(G3d_BoneMtxStruct *boneMatrix); void UnkInit_Struct4_Params(u8 param1, u8 param2); void func_ov000_020b413c(unk16 param1, Vec3p *param2); }; diff --git a/libs/nds/include/nds/g3d/g3d.h b/libs/nds/include/nds/g3d/g3d.h new file mode 100644 index 00000000..c4175327 --- /dev/null +++ b/libs/nds/include/nds/g3d/g3d.h @@ -0,0 +1,166 @@ +#include "nds/math.h" + +struct G3d_RenderState_; +typedef void (*G3d_CallbackFunction)(struct G3d_RenderState_ *); + +typedef struct G3d_NameList_ { + /* 00 */ u8 dummy; + /* 01 */ u8 numElmnts; // number of elements + /* 02 */ u16 size; // size of this NameList in bytes + /* 04 */ u16 dummy2; + /* 06 */ u16 ofsHeader; // offset to the G3d_NameList_Header + /* 08 */ void *entry[1]; // variable size + /* 0c */ +} G3d_NameList; + +typedef struct G3d_NameList_Header_ { + /* 00 */ u16 element_size; + /* 02 */ u16 data_section_size; + /* 04 */ u8 data[4]; + /* 08 */ +} G3d_NameList_Header; + +typedef struct G3d_InvBindMtx_ { + /* 00 */ Mat4x3p mtx; + /* 30 */ Mat3p unkMtx; + /* 54 */ +} G3d_InvBindMtx; + +typedef struct G3d_BoneMtxStruct_ { + /* 00 */ u32 flag; + /* 04 */ u8 mUnk_04[0x24]; + /* 28 */ Mat3p rot; + /* 58 */ u8 mUnk_58[0xc]; + /* 64 */ +} G3d_BoneMtxStruct; + +typedef enum { + G3D_ANIMBIND_UNK = 0xff, + G3D_ANIMBIND_EXISTS = 0x100, + G3D_ANIMBIND_OFF = 0x200 +} G3d_AnimationBinds; + +typedef struct G3d_Animation_ { + /* 00 */ u8 mUnk_00[0x10]; + /* 10 */ struct G3d_Animation_ *next; // next animation in the list + /* 14 */ u8 mUnk_14[0x5]; + /* 19 */ u8 numElmnts; // number of elements in the elementBinds array + /* 1a */ u16 elementBinds[1]; // each bit corresponds to a bone/material and determines whether an animation exists for it + /* 1c */ +} G3d_Animation; + +// Structure representing the NSBMD model file +typedef struct G3d_Model_ { + /* 00 */ u32 size; // size of the model in bytes + /* 04 */ u32 offSbc; // offset of the SBC commands list + /* 08 */ u32 offMat; // offset of the material list + /* 0c */ u32 offMesh; // offset of the mesh list + /* 10 */ u32 offInvBMtx; // offset of the InvBindMatrix list + /* 14 */ u8 dummy1; + /* 15 */ u8 scalingHandler; // Determines which of the G3d_gScaleHandlers to use for this model + /* 16 */ u8 textureHandler; // Determines which of the G3d_gTextureHandlers to use for this model + /* 17 */ u8 numBones; // number of nodes + /* 18 */ u8 numMat; // number of materials + /* 19 */ u8 numMesh; // number of meshes + /* 1a */ u8 dummy2[2]; + /* 1c */ q20 upScale; + /* 20 */ q20 downScale; + /* 24 */ u16 numVertex; // number of vertices + /* 26 */ u16 numPolygon; // number of polygons + /* 28 */ u16 numTriangle; // number of triangles + /* 2a */ u16 numQuad; // number of quads + /* 2c */ q4 boundingBoxMin[3]; // bounding box lower vertex + /* 32 */ q4 boundingBoxMax[3]; // bounding box upper vertex + /* 38 */ u8 dummy3[8]; + /* 40 */ G3d_NameList boneList; // bone list + /* 4c */ +} G3d_Model; + +static inline G3d_NameList *G3d_GetBoneList(const G3d_Model *mdl) { + return (G3d_NameList *) &mdl->boneList; +} + +static inline void *G3d_GetMat(const G3d_Model *mdl) { + + return (void *) ((u8 *) mdl + mdl->offMat); +} + +static inline G3d_NameList *G3d_GetMesh(const G3d_Model *mdl) { + return (G3d_NameList *) ((u8 *) mdl + mdl->offMesh); +} + +typedef enum { + G3D_RENDEROBJ_FLAG_STORE = 0x1, // stores results in local cache + G3D_RENDEROBJ_FLAG_SKIP_CMD = 0x2, // skips pushing geometry commands to the FIFO + G3D_RENDEROBJ_FLAG_SKIP_SBC_DRAW = 0x4, // skips the execution of rendering commands + G3D_RENDEROBJ_FLAG_SKIP_SBC_MTXCALC = 0x8, // skips the execution of matrix calculation commands + G3D_RENDEROBJ_FLAG_ANIMMAP_OUTDATED = 0x10 // set when the animation map arrays in the render object are outdated +} G3d_RenderObjFlag; + +// Structure that handles the parameters for drawing a model +typedef struct G3d_RenderObject_ { + /* 00 */ u32 flag; // G3d_RenderObjFlag + /* 04 */ G3d_Model *model; + /* 08 */ G3d_Animation *matAnim; // material animation + /* 0c */ void *mUnk_0c; + /* 10 */ G3d_Animation *jntAnim; // joint animation + /* 14 */ void *mUnk_14; + /* 18 */ G3d_Animation *mUnk_18; + /* 1c */ void *mUnk_1c; + /* 20 */ G3d_CallbackFunction callbackFunction; + /* 24 */ u8 callbackIdx; // index of the callbackFunction in the callback array of G3d_RenderState + /* 25 */ u8 mUnk_25; // related to callback + /* 26 */ u16 dummy_; + /* 28 */ G3d_CallbackFunction callbackInitFunc; // initializes the G3d_RenderState callback array + /* 2c */ void *modelRender; // pointer to the ModelRender that is rendering this model + /* 30 */ u8 *unkCommandsList; // if not null, this command list is used instead of the one in the model + /* 34 */ G3d_BoneMtxStruct *cacheJntAnm; + /* 38 */ void *cacheMatAnm; + /* 3c */ u32 matAnimBindMap[2]; + /* 44 */ u32 jntAnimBindMap[2]; + /* 4c */ u32 unkAnimBindMap[2]; + /* 54 */ +} G3d_RenderObject; + +typedef struct G3d_Material_List_ { + /* 00 */ u16 texture_pairings_off; + /* 02 */ u16 palette_pairings_off; + /* 04 */ G3d_NameList materials; + /* 10 */ +} G3d_Material_List; + +typedef struct G3d_Material_ { + /* 00 */ u32 mUnk_00; + /* 04 */ u32 dif_amb; + /* 08 */ u32 spe_emi; + /* 0c */ u32 polygon_attr; + /* 10 */ u32 mUnk_10; + /* 14 */ u32 teximage_params; + /* 18 */ u32 mUnk_18; + /* 1c */ u16 pltt_base; + /* 1e */ u16 flag; + /* 20 */ u16 width; + /* 22 */ u16 height; + /* 24 */ u8 mUnk_24[0x8]; + /* 2c */ +} G3d_Material; + +typedef struct G3d_MaterialAnimation_ { + /* 00 */ u32 flag; + /* 04 */ u32 dif_amb; + /* 08 */ u32 spe_emi; + /* 0c */ u32 polygon_attr; + /* 10 */ u32 teximage_params; + /* 14 */ u32 pltt_base; + /* 18 */ u8 mUnk_18[0x14]; + /* 2c */ u16 width; + /* 2e */ u16 height; + /* 30 */ u8 mUnk_30[0x8]; + /* 38 */ +} G3d_MaterialAnimation; + +#define G3D_TEXIMAGE_PARM_TEX_COORD_MODE 0xc0000000 + +extern void *G3d_gScaleHandlers[3]; +extern void *G3d_gSRTTransformHandlers[3]; +extern void *G3d_gTextureHandlers[4]; \ No newline at end of file diff --git a/libs/nds/include/nds/g3d/sbc.h b/libs/nds/include/nds/g3d/sbc.h new file mode 100644 index 00000000..6f0416c4 --- /dev/null +++ b/libs/nds/include/nds/g3d/sbc.h @@ -0,0 +1,110 @@ +#pragma once +#include "g3d.h" + +extern void PushGeometryCommand(u32 command, void *data, s32 length); + +typedef enum { + G3D_SBC_CMD_NOP = 0x0, + G3D_SBC_CMD_END = 0x1, + G3D_SBC_CMD_VIS = 0x2, + G3D_SBC_CMD_007 = 0x7, + G3D_SBC_CMD_008 = 0x8, + G3D_SBC_CMD_SKN = 0x9, + G3D_SBC_CMD_00A = 0xa, + G3D_SBC_CMD_SCL = 0xb, + G3D_SBC_CMD_00C = 0xc, + G3D_SBC_CMD_00D = 0xd +} G3d_SBC_Commands; + +typedef enum { + G3D_RENDERST_FLAG_BONE_VISIBLE = 0x1, + G3D_RENDERST_FLAG_MAT_TRANSPARENT = 0x2, + G3D_RENDERST_FLAG_VALID_NODE = 0x4, + G3D_RENDERST_FLAG_VALID_MAT = 0x8, + G3D_RENDERST_FLAG_VALID_BONEMTX = 0x10, + G3D_RENDERST_FLAG_END = 0x20, // set when the end of the SBC command list is reached + G3D_RENDERST_FLAG_SKIP_CALLBACK = 0x40, // skip callback + G3D_RENDERST_FLAG_STORE = 0x80, // stores results in G3d_RenderObject local cache + G3D_RENDERST_FLAG_SKIP_CMD = 0x100, // skips pushing geometry commands to the FIFO + G3D_RENDERST_FLAG_SKIP_SBC_RENDER = 0x200, // skips the execution of rendering commands + G3D_RENDERST_FLAG_SKIP_SBC_MTXCALC = 0x400 // skips the execution of matrix calculation commands +} G3d_RenderStateFlag; + +typedef struct G3d_RenderState_ { + /* 00 */ u8 *currentCmd; // current command being processed + /* 04 */ G3d_RenderObject *renderObj; // current render object being processed + /* 08 */ u32 flag; // G3d_RenderStateFlag + /* 0c */ G3d_CallbackFunction callbackFuncs[32]; // callback function for each SBC command + /* 8c */ u8 callbackSegment[32]; // determines at which segment of the SBC command to invoke the callback + /* ac */ u8 currentBoneId; + /* ad */ u8 currentMaterialId; + /* ae */ u8 currentBoneMtxId; + /* af */ u8 dummy; + /* b0 */ G3d_MaterialAnimation *matAnim; + /* b4 */ void *mUnk_19; + /* b8 */ u8 *visibilityPtr; // points to isVisible (0x187) + /* bc */ u32 mUnk_bc[2]; + /* c4 */ u32 mUnk_c4[2]; + /* cc */ u32 mUnk_cc[2]; + /* d4 */ G3d_NameList *boneList; + /* d8 */ const G3d_Material_List *materialList; + /* dc */ G3d_NameList *meshList; + /* e0 */ q20 upScale; + /* e4 */ q20 downScale; + /* e8 */ void *jntScalingHandler; // scaling handler + /* ec */ void *jntSRTHandler; // SRT transform handler + /* f0 */ void *textureHandler; // texture matrix handler + /* f4 */ u8 mUnk_f4[0x93]; + /* 187 */ u8 isVisible; + /* 188 */ +} G3d_RenderState; + +typedef struct UnkStruct_0205ae08_ { + /* 00 */ u8 mUnk_00[0x1400]; + /* 1400 */ struct { + Mat4p mtx1; + Mat3p mtx2; + } mUnk_1400[64]; +} UnkStruct_0205ae08; + +typedef void (*G3d_FuncSbc)(G3d_RenderState *, u32); +extern G3d_FuncSbc G3d_FuncSbcTable[32]; +extern G3d_RenderState *G3d_gRenderState; +extern UnkStruct_0205ae08 data_0205ae08; +void G3d_Render(G3d_RenderObject *renderObj); + +static inline u32 G3d_FindInBitArray(const u32 *arr, u32 idx) { + return (u32) (arr[idx >> 5] & (1 << (idx & 31))); +} + +static inline void G3d_SetBitArray(u32 *arr, u32 idx) { + arr[idx >> 5] |= 1 << (idx & 31); +} + +static inline void G3d_SetMtxMode_inline(u32 mode) { + PushGeometryCommand(0x10, &mode, 1); +} + +static inline void G3d_RestoreMtx_inline(u32 idx) { + PushGeometryCommand(0x14, &idx, 1); +} + +static inline void G3d_MtxMult33_inline(const Mat3p *m) { + PushGeometryCommand(0x1a, (u32 *) m, 9); +} + +static inline void G3d_MtxMult43_inline(const Mat4x3p *m) { + PushGeometryCommand(0x19, (u32 *) m, 12); +} + +static inline void G3d_MtxMult44_inline(const Mat4p *m) { + PushGeometryCommand(0x18, (u32 *) m, 0x10); +} + +static inline void G3d_Scale_inline(q20 x, q20 y, q20 z) { + Vec3p vec; + vec.x = x; + vec.y = y; + vec.z = z; + PushGeometryCommand(0x1b, (u32 *) &vec, 3); +} \ No newline at end of file diff --git a/libs/nds/include/nds/gfx.h b/libs/nds/include/nds/gfx.h index dea3eca5..2444ae2a 100644 --- a/libs/nds/include/nds/gfx.h +++ b/libs/nds/include/nds/gfx.h @@ -8,6 +8,13 @@ extern "C" { #endif +#define REG_GFX_FIFO (*(volatile u32 *) 0x04000400) +#define GFX_FIFO_MTX_MODE (*(volatile u32 *) 0x04000440) +#define GFX_FIFO_MTX_PUSH (*(volatile u32 *) 0x04000444) +#define GFX_FIFO_MTX_POP (*(volatile u32 *) 0x04000448) +#define GFX_FIFO_MTX_STORE (*(volatile u32 *) 0x0400044c) +#define GFX_FIFO_MTX_RESTORE (*(volatile u32 *) 0x04000450) +#define GFX_FIFO_MTX_IDENTITY (*(volatile u32 *) 0x04000454) #define GFX_FIFO_SWAP_BUFFERS (*(volatile u32 *) 0x04000540) #define GFX_FIFO_VIEWPORT (*(volatile u32 *) 0x04000580) #define REG_GFX_RAM_COUNT (*(volatile u16 *) 0x04000604) diff --git a/libs/nds/src/sbc.c b/libs/nds/src/sbc.c new file mode 100644 index 00000000..62071d4e --- /dev/null +++ b/libs/nds/src/sbc.c @@ -0,0 +1,855 @@ +#include "nds/g3d/sbc.h" +#include "DTCM/UnkStruct_027e037c.h" +#include "nds/gfx.h" + +#define G3D_SBC_CMD_MASK 0x1f +#define G3D_SBC_FLG_MASK 0xe0 +#define GX_ST(s, t) ((u32) ((u16) (s16) (s >> 8) | ((u16) (s16) (t >> 8) << 16))) +#define GX_PACK_TEXCOORD_PARAM(s, t) (GX_ST((s), (t))) + +extern void Fill256(unk32, unk16 *, unk32); +extern void Fill32(unk32, u32 *, unk32); +extern void FlushGfxQueue(); +extern s32 func_0200598c(Mat4p *matrix); +extern Mat4x3p *func_02018450(); +extern Mat4x3p *func_02018738(); +extern Mat4x3p *func_02018770(); +extern s32 func_020059bc(Mat3p *matrix); +extern void func_0200567c(unk32 param1); +extern void func_02005644(Mat4x3p *matrix); +extern void func_01ffa94c(const void *param1, u32 param2); +extern Mat3p gGeomMatrix; +extern Vec3p gGeomTranslation; +extern void G3d_GetCurrentMtx(Mat4x3p *mtx1, Mat3p *mtx2); + +UnkStruct_0205ae08 data_0205ae08; + +// Renders all SBC commands until the end of the list +void G3d_RenderSBCCommands(G3d_RenderState *renderState) { + do { + renderState->flag &= ~G3D_RENDERST_FLAG_SKIP_CALLBACK; + (*G3d_FuncSbcTable[(*renderState->currentCmd) & G3D_SBC_CMD_MASK])(renderState, (*renderState->currentCmd) & + (u32) G3D_SBC_FLG_MASK); + } while (!(renderState->flag & G3D_RENDERST_FLAG_END)); +} + +// Initializes the render state and starts rendering the SBC command list +void G3d_InitRenderState(G3d_RenderState *renderState, G3d_RenderObject *renderObj) { + Fill256(0, (short *) renderState, sizeof(*renderState)); + renderState->mUnk_c4[0] = 1; + renderState->flag = G3D_RENDERST_FLAG_BONE_VISIBLE; + + if (renderObj->unkCommandsList) { + renderState->currentCmd = renderObj->unkCommandsList; + } else { + renderState->currentCmd = (u8 *) renderObj->model + renderObj->model->offSbc; + } + + renderState->renderObj = renderObj; + renderState->boneList = G3d_GetBoneList(renderObj->model); + renderState->materialList = G3d_GetMat(renderObj->model); + renderState->meshList = G3d_GetMesh(renderObj->model); + renderState->jntScalingHandler = G3d_gScaleHandlers[renderObj->model->scalingHandler]; + renderState->jntSRTHandler = G3d_gSRTTransformHandlers[renderObj->model->scalingHandler]; + renderState->textureHandler = G3d_gTextureHandlers[renderObj->model->textureHandler]; + renderState->upScale = renderObj->model->upScale; + renderState->downScale = renderObj->model->downScale; + if (renderObj->callbackFunction && renderObj->callbackIdx < 32) { + renderState->callbackFuncs[renderObj->callbackIdx] = renderObj->callbackFunction; + renderState->callbackSegment[renderObj->callbackIdx] = renderObj->mUnk_25; + } + + if (renderObj->flag & G3D_RENDEROBJ_FLAG_STORE) { + renderState->flag |= G3D_RENDERST_FLAG_STORE; + } + + if (renderObj->flag & G3D_RENDEROBJ_FLAG_SKIP_CMD) { + renderState->flag |= G3D_RENDERST_FLAG_SKIP_CMD; + } + + if (renderObj->flag & G3D_RENDEROBJ_FLAG_SKIP_SBC_DRAW) { + renderState->flag |= G3D_RENDERST_FLAG_SKIP_SBC_RENDER; + } + + if (renderObj->flag & G3D_RENDEROBJ_FLAG_SKIP_SBC_MTXCALC) { + renderState->flag |= G3D_RENDERST_FLAG_SKIP_SBC_MTXCALC; + } + + if (renderObj->callbackInitFunc) { + (*renderObj->callbackInitFunc)(renderState); + } + + G3d_RenderSBCCommands(renderState); + + renderObj->flag &= ~G3D_RENDEROBJ_FLAG_STORE; +} + +// Sets the bits in the anim array according to the map data of the animation +void G3d_SetRenderObjAnimationMap(u32 *arr, const G3d_Animation *anim) { + while (anim) { + int i; + for (i = 0; i < anim->numElmnts; i++) { + if (anim->elementBinds[i] & G3D_ANIMBIND_EXISTS) { + arr[i >> 5] |= 1 << (i & 31); + } + } + anim = anim->next; + } +} + +// Renders a model by processing the SBC command list +void G3d_Render(G3d_RenderObject *renderObj) { + if ((renderObj->flag & G3D_RENDEROBJ_FLAG_ANIMMAP_OUTDATED) == G3D_RENDEROBJ_FLAG_ANIMMAP_OUTDATED) { + Fill32(0, &renderObj->matAnimBindMap[0], 8); + Fill32(0, &renderObj->jntAnimBindMap[0], 8); + Fill32(0, &renderObj->unkAnimBindMap[0], 8); + + if (renderObj->matAnim) { + G3d_SetRenderObjAnimationMap(&renderObj->matAnimBindMap[0], renderObj->matAnim); + } + if (renderObj->jntAnim) { + G3d_SetRenderObjAnimationMap(&renderObj->jntAnimBindMap[0], renderObj->jntAnim); + } + if (renderObj->mUnk_18) { + G3d_SetRenderObjAnimationMap(&renderObj->unkAnimBindMap[0], renderObj->mUnk_18); + } + renderObj->flag &= ~G3D_RENDEROBJ_FLAG_ANIMMAP_OUTDATED; + } + + if (G3d_gRenderState) { + G3d_InitRenderState(G3d_gRenderState, renderObj); + } else { + G3d_RenderState rs; + G3d_gRenderState = &rs; + G3d_InitRenderState(&rs, renderObj); + G3d_gRenderState = NULL; + } +} + +// Renders the NOP SBC command +void G3d_SBCRender_NOP(G3d_RenderState *renderState, u32) { + if (renderState->callbackFuncs[G3D_SBC_CMD_NOP]) { + (*renderState->callbackFuncs[G3D_SBC_CMD_NOP])(renderState); + } + renderState->currentCmd++; +} + +// Renders the END SBC command +void G3d_SBCRender_END(G3d_RenderState *renderState, u32) { + if (renderState->callbackFuncs[G3D_SBC_CMD_END]) { + (*renderState->callbackFuncs[G3D_SBC_CMD_END])(renderState); + } + renderState->flag |= G3D_RENDERST_FLAG_END; +} + +// Renders the SBC command 0x7 (unknown) +void G3d_SBCRender_007(G3d_RenderState *renderState, u32 opCode) { + + u32 totalArgs = 2; + + static u32 funcArgs[] = {0x1b171012, // MTX_POP | MTX_MODE | MTX_LOAD_4x3 | MTX_SCALE + 1, // MTX_MODE = Position + 2, 0x1000, 0, 0, 0, 0x1000, 0, 0, 0, 0x1000, // Identity MTX + 0, 0, 0, 0, 0, 0}; + + Vec3p *translationVec = (Vec3p *) &funcArgs[12]; + Vec3p *scaleVec = (Vec3p *) &funcArgs[15]; + Mat4p currentMtx; + u8 callbackSkip; + u32 callbackSegment; + + if (renderState->flag & G3D_RENDERST_FLAG_SKIP_SBC_RENDER) { + if (opCode == 0x40 || opCode == 0x60) { + totalArgs++; + } + if (opCode == 0x20 || opCode == 0x60) { + totalArgs++; + } + renderState->currentCmd += totalArgs; + return; + } + + if (opCode == 0x40 || opCode == 0x60) { + totalArgs++; + + if (!(renderState->flag & G3D_RENDERST_FLAG_SKIP_CMD)) { + u32 matrixIndex; + if (opCode == 0x40) { + matrixIndex = *(renderState->currentCmd + 2); + } else { + matrixIndex = *(renderState->currentCmd + 3); + } + PushGeometryCommand(0x14, &matrixIndex, 1); // MTX_RESTORE + } + } + + if (renderState->callbackFuncs[G3D_SBC_CMD_007]) { + callbackSegment = renderState->callbackSegment[G3D_SBC_CMD_007]; + } else { + callbackSegment = 0; + } + + if (callbackSegment == 1) { + renderState->flag &= ~G3D_RENDERST_FLAG_SKIP_CALLBACK; + (*renderState->callbackFuncs[G3D_SBC_CMD_007])(renderState); + if (renderState->callbackFuncs[G3D_SBC_CMD_007]) { + callbackSegment = renderState->callbackSegment[G3D_SBC_CMD_007]; + } else { + callbackSegment = 0; + } + callbackSkip = (renderState->flag & G3D_RENDERST_FLAG_SKIP_CALLBACK); + } else { + callbackSkip = 0; + } + + if (!(renderState->flag & G3D_RENDERST_FLAG_SKIP_CMD) && !callbackSkip) { + FlushGfxQueue(); + + REG_GFX_FIFO = 0x151110; // MTX_MODE | MTX_PUSH | MTX_IDENTITY + REG_GFX_FIFO = 0; // MTX_MODE = Projection + + REG_GFX_FIFO = 0; + + while (func_0200598c(¤tMtx)) + ; + + if (data_027e037c.flags & 1) { + const Mat4x3p *mtx1 = func_02018738(); + Mat4p mtx2; + + Mat4x3p_CopyToMat4p(mtx1, &mtx2); + Mat4p_Multiply(¤tMtx, &mtx2, ¤tMtx); + } else if (data_027e037c.flags & 2) { + const Mat4x3p *mtx1 = &data_027e037c.mUnk_04c; + Mat4p mtx2; + + Mat4x3p_CopyToMat4p(mtx1, &mtx2); + Mat4p_Multiply(¤tMtx, &mtx2, ¤tMtx); + } + + translationVec->x = currentMtx.wColumn.x; + translationVec->y = currentMtx.wColumn.y; + translationVec->z = currentMtx.wColumn.z; + + scaleVec->x = Vec3p_Length((Vec3p *) ¤tMtx.xColumn); + scaleVec->y = Vec3p_Length((Vec3p *) ¤tMtx.yColumn); + scaleVec->z = Vec3p_Length((Vec3p *) ¤tMtx.zColumn); + + if (data_027e037c.flags & 1) { + REG_GFX_FIFO = 0x171012; // MTX_POP | MTX_MODE | MTX_LOAD_4x3 + Stream32(&funcArgs[1], ®_GFX_FIFO, 8); // MTX_MODE = Position + Stream32(func_02018770(), ®_GFX_FIFO, 0x30); + + REG_GFX_FIFO = 0x1b19; // MTX_MULT_4x3 | MTX_SCALE + Stream32(&funcArgs[3], ®_GFX_FIFO, 0x3c); // Identity MTX + } else if (data_027e037c.flags & 2) { + REG_GFX_FIFO = 0x171012; // MTX_POP | MTX_MODE | MTX_LOAD_4x3 + Stream32(&funcArgs[1], ®_GFX_FIFO, 8); // MTX_MODE = Position + Stream32(func_02018450(), ®_GFX_FIFO, 0x30); + + REG_GFX_FIFO = 0x1b19; // MTX_MULT_4x3 | MTX_SCALE + Stream32(&funcArgs[3], ®_GFX_FIFO, 0x3c); // Identity MTX + } else { + Stream32(&funcArgs, ®_GFX_FIFO, 0x48); // MTX_POP | MTX_MODE | MTX_LOAD_4x3 | MTX_SCALE + } + } + + if (callbackSegment == 3) { + renderState->flag &= ~G3D_RENDERST_FLAG_SKIP_CALLBACK; + (*renderState->callbackFuncs[G3D_SBC_CMD_007])(renderState); + callbackSkip = renderState->flag & G3D_RENDERST_FLAG_SKIP_CALLBACK; + } else { + callbackSkip = 0; + } + + if (opCode == 0x20 || opCode == 0x60) { + totalArgs++; + + if (!callbackSkip) { + if (!(renderState->flag & G3D_RENDERST_FLAG_SKIP_CMD)) { + u32 matrixIndex = *(renderState->currentCmd + 2); + PushGeometryCommand(0x13, &matrixIndex, 1); // MTX_STORE + } + } + } + renderState->currentCmd += totalArgs; +} + +// Renders the SBC command 0x8 (unknown) +void G3d_SBCRender_008(G3d_RenderState *renderState, u32 opCode) { + u32 totalArgs = 2; + Mat4p currentMtx; + + static u32 funcArgs[] = {0x1b171012, // MTX_POP | MTX_MODE | MTX_LOAD_4x3 | MTX_SCALE + 1, // MTX_MODE = Position + 2, 0x1000, 0, 0, 0, 0x1000, 0, 0, 0, 0x1000, // Identity MTX + 0, 0, 0, 0, 0, 0}; + + Vec3p *translationVec = (Vec3p *) &funcArgs[12]; + Vec3p *scaleVec = (Vec3p *) &funcArgs[15]; + Mat4x3p *mtx = (Mat4x3p *) &funcArgs[3]; + u8 callbackSkip; + u32 callbackSegment; + + if (renderState->flag & G3D_RENDERST_FLAG_SKIP_SBC_RENDER) { + if (opCode == 0x40 || opCode == 0x60) { + totalArgs++; + } + if (opCode == 0x20 || opCode == 0x60) { + totalArgs++; + } + renderState->currentCmd += totalArgs; + return; + } + + if (opCode == 0x40 || opCode == 0x60) { + totalArgs++; + if (!(renderState->flag & G3D_RENDERST_FLAG_SKIP_CMD)) { + u32 matrixIndex; + if (opCode == 0x40) { + matrixIndex = *(renderState->currentCmd + 2); + } else { + matrixIndex = *(renderState->currentCmd + 3); + } + PushGeometryCommand(0x14, &matrixIndex, 1); + } + } + + if (renderState->callbackFuncs[G3D_SBC_CMD_008]) { + callbackSegment = renderState->callbackSegment[G3D_SBC_CMD_008]; + } else { + callbackSegment = 0; + } + + if (callbackSegment == 1) { + renderState->flag &= ~G3D_RENDERST_FLAG_SKIP_CALLBACK; + (*renderState->callbackFuncs[G3D_SBC_CMD_008])(renderState); + if (renderState->callbackFuncs[G3D_SBC_CMD_008]) { + callbackSegment = renderState->callbackSegment[G3D_SBC_CMD_008]; + } else { + callbackSegment = 0; + } + callbackSkip = (renderState->flag & G3D_RENDERST_FLAG_SKIP_CALLBACK); + } else { + callbackSkip = 0; + } + + if (!(renderState->flag & G3D_RENDERST_FLAG_SKIP_CMD) && !callbackSkip) { + FlushGfxQueue(); + + REG_GFX_FIFO = 0x151110; // MTX_MODE | MTX_PUSH | MTX_IDENTITY + REG_GFX_FIFO = 0; // MTX_MODE = Projection + + REG_GFX_FIFO = 0; + + while (func_0200598c(¤tMtx)) + ; + + if (data_027e037c.flags & 1) { + const Mat4x3p *mtx1 = func_02018738(); + Mat4p mtx2; + + Mat4x3p_CopyToMat4p(mtx1, &mtx2); + Mat4p_Multiply(¤tMtx, &mtx2, ¤tMtx); + } else if (data_027e037c.flags & 2) { + const Mat4x3p *mtx1 = &data_027e037c.mUnk_04c; + Mat4p mtx2; + + Mat4x3p_CopyToMat4p(mtx1, &mtx2); + Mat4p_Multiply(¤tMtx, &mtx2, ¤tMtx); + } + + translationVec->x = currentMtx.wColumn.x; + translationVec->y = currentMtx.wColumn.y; + translationVec->z = currentMtx.wColumn.z; + + scaleVec->x = Vec3p_Length((Vec3p *) ¤tMtx.xColumn); + scaleVec->y = Vec3p_Length((Vec3p *) ¤tMtx.yColumn); + scaleVec->z = Vec3p_Length((Vec3p *) ¤tMtx.zColumn); + + if (currentMtx.yColumn.y != 0 || currentMtx.yColumn.z != 0) { + Vec3p_Normalize((Vec3p *) ¤tMtx.yColumn, (Vec3p *) &mtx->yColumn); + + mtx->zColumn.y = -mtx->yColumn.z; + mtx->zColumn.z = mtx->yColumn.y; + } else { + Vec3p_Normalize((Vec3p *) ¤tMtx.zColumn, (Vec3p *) &mtx->zColumn); + + mtx->yColumn.z = -mtx->zColumn.y; + mtx->yColumn.y = mtx->zColumn.z; + } + + if (data_027e037c.flags & 1) { + REG_GFX_FIFO = 0x171012; // MTX_POP | MTX_MODE | MTX_LOAD_4x3 + Stream32(&funcArgs[1], ®_GFX_FIFO, 8); // MTX_MODE = Position + Stream32(func_02018770(), ®_GFX_FIFO, 0x30); + + REG_GFX_FIFO = 0x1b19; // MTX_MULT_4x3 | MTX_SCALE + Stream32(&funcArgs[3], ®_GFX_FIFO, 0x3c); // Identity MTX + } else if (data_027e037c.flags & 2) { + REG_GFX_FIFO = 0x171012; // MTX_POP | MTX_MODE | MTX_LOAD_4x3 + Stream32(&funcArgs[1], ®_GFX_FIFO, 8); // MTX_MODE = Position + Stream32(func_02018450(), ®_GFX_FIFO, 0x30); + + REG_GFX_FIFO = 0x1b19; // MTX_MULT_4x3 | MTX_SCALE + Stream32(&funcArgs[3], ®_GFX_FIFO, 0x3c); // Identity MTX + } else { + Stream32(&funcArgs, ®_GFX_FIFO, 0x48); // MTX_POP | MTX_MODE | MTX_LOAD_4x3 | MTX_SCALE + } + } + + if (callbackSegment == 3) { + renderState->flag &= ~G3D_RENDERST_FLAG_SKIP_CALLBACK; + (*renderState->callbackFuncs[G3D_SBC_CMD_008])(renderState); + callbackSkip = renderState->flag & G3D_RENDERST_FLAG_SKIP_CALLBACK; + } else { + callbackSkip = 0; + } + + if (opCode == 0x20 || opCode == 0x60) { + totalArgs++; + + if (!callbackSkip) { + if (!(renderState->flag & G3D_RENDERST_FLAG_SKIP_CMD)) { + u32 matrixIndex = *(renderState->currentCmd + 2); + PushGeometryCommand(0x13, &matrixIndex, 1); // MTX_STORE + } + } + } + + renderState->currentCmd += totalArgs; +} + +// Renders the Skinning Equation SBC command +void G3d_SBCRender_SKN(G3d_RenderState *renderState, u32) { + G3d_InvBindMtx *invBMtx = + (G3d_InvBindMtx *) ((u8 *) renderState->renderObj->model + renderState->renderObj->model->offInvBMtx); + u32 numTerms = *(renderState->currentCmd + 2); + s64 weight = 0; + u8 *termPtr = renderState->currentCmd + 3; + u32 i; + struct { + Mat4x3p mtx1; + Mat3p mtx2; + } mtxStruct; + Mat4p *mat4x; + Mat3p *mat3x; + + Fill256(0, (unk16 *) &mtxStruct, sizeof(mtxStruct)); + FlushGfxQueue(); + + GFX_FIFO_MTX_MODE = 0; // Projection + GFX_FIFO_MTX_STORE = 1; + GFX_FIFO_MTX_IDENTITY = 0; + GFX_FIFO_MTX_MODE = 2; // Position + Vector + + for (i = 0; i < numTerms; i++) { + u32 jntIndex = *(termPtr + 1); + u32 unk = G3d_FindInBitArray(&renderState->mUnk_cc[0], jntIndex); + + mat4x = &data_0205ae08.mUnk_1400[jntIndex].mtx1; + if (!unk) { + G3d_SetBitArray(&renderState->mUnk_cc[0], jntIndex); + + GFX_FIFO_MTX_RESTORE = (*termPtr); + GFX_FIFO_MTX_MODE = 1; // Position + func_0200567c(&invBMtx[jntIndex].mtx); + } + + if (i != 0) { + mtxStruct.mtx2.xColumn.x += (weight * mat3x->xColumn.x) >> 0xc; + mtxStruct.mtx2.xColumn.y += (weight * mat3x->xColumn.y) >> 0xc; + mtxStruct.mtx2.xColumn.z += (weight * mat3x->xColumn.z) >> 0xc; + + mtxStruct.mtx2.yColumn.x += (weight * mat3x->yColumn.x) >> 0xc; + mtxStruct.mtx2.yColumn.y += (weight * mat3x->yColumn.y) >> 0xc; + mtxStruct.mtx2.yColumn.z += (weight * mat3x->yColumn.z) >> 0xc; + + mtxStruct.mtx2.zColumn.x += (weight * mat3x->zColumn.x) >> 0xc; + mtxStruct.mtx2.zColumn.y += (weight * mat3x->zColumn.y) >> 0xc; + mtxStruct.mtx2.zColumn.z += (weight * mat3x->zColumn.z) >> 0xc; + } + + if (!unk) { + while (func_0200598c(mat4x)) + ; + GFX_FIFO_MTX_MODE = 2; // Position + Vector + func_02005698(&invBMtx[jntIndex].unkMtx); + } + + weight = *(termPtr + 2) << 4; + + mtxStruct.mtx1.xColumn.x += (weight * mat4x->xColumn.x) >> 0xc; + mtxStruct.mtx1.xColumn.y += (weight * mat4x->xColumn.y) >> 0xc; + mtxStruct.mtx1.xColumn.z += (weight * mat4x->xColumn.z) >> 0xc; + + mtxStruct.mtx1.yColumn.x += (weight * mat4x->yColumn.x) >> 0xc; + mtxStruct.mtx1.yColumn.y += (weight * mat4x->yColumn.y) >> 0xc; + mtxStruct.mtx1.yColumn.z += (weight * mat4x->yColumn.z) >> 0xc; + + mtxStruct.mtx1.zColumn.x += (weight * mat4x->zColumn.x) >> 0xc; + mtxStruct.mtx1.zColumn.y += (weight * mat4x->zColumn.y) >> 0xc; + mtxStruct.mtx1.zColumn.z += (weight * mat4x->zColumn.z) >> 0xc; + + mtxStruct.mtx1.wColumn.x += (weight * mat4x->wColumn.x) >> 0xc; + mtxStruct.mtx1.wColumn.y += (weight * mat4x->wColumn.y) >> 0xc; + mtxStruct.mtx1.wColumn.z += (weight * mat4x->wColumn.z) >> 0xc; + + termPtr += 3; + mat3x = &data_0205ae08.mUnk_1400[jntIndex].mtx2; + + if (!unk) { + while (func_020059bc(mat3x)) + ; + } + } + mtxStruct.mtx2.xColumn.x += (weight * mat3x->xColumn.x) >> 0xc; + mtxStruct.mtx2.xColumn.y += (weight * mat3x->xColumn.y) >> 0xc; + mtxStruct.mtx2.xColumn.z += (weight * mat3x->xColumn.z) >> 0xc; + + mtxStruct.mtx2.yColumn.x += (weight * mat3x->yColumn.x) >> 0xc; + mtxStruct.mtx2.yColumn.y += (weight * mat3x->yColumn.y) >> 0xc; + mtxStruct.mtx2.yColumn.z += (weight * mat3x->yColumn.z) >> 0xc; + + mtxStruct.mtx2.zColumn.x += (weight * mat3x->zColumn.x) >> 0xc; + mtxStruct.mtx2.zColumn.y += (weight * mat3x->zColumn.y) >> 0xc; + mtxStruct.mtx2.zColumn.z += (weight * mat3x->zColumn.z) >> 0xc; + + func_02005644((const Mat4x3p *) &mtxStruct.mtx2); + GFX_FIFO_MTX_MODE = 1; // Position + func_02005644(&mtxStruct.mtx1); + GFX_FIFO_MTX_MODE = 0; // Projection + GFX_FIFO_MTX_RESTORE = 1; + GFX_FIFO_MTX_MODE = 2; // Position + Vector + GFX_FIFO_MTX_STORE = (*(renderState->currentCmd + 1)); + renderState->currentCmd += 3 + *(renderState->currentCmd + 2) * 3; +} + +// Renders the SBC command 0xA (unknown) +void G3d_SBCRender_00A(G3d_RenderState *renderState, u32) { + u32 callbackSkip; + u32 callbackSegment; + + if (renderState->callbackFuncs[G3D_SBC_CMD_00A]) { + callbackSegment = renderState->callbackSegment[G3D_SBC_CMD_00A]; + } else { + callbackSegment = 0; + } + + if (callbackSegment == 1) { + renderState->flag &= ~G3D_RENDERST_FLAG_SKIP_CALLBACK; + (*renderState->callbackFuncs[G3D_SBC_CMD_00A])(renderState); + if (renderState->callbackFuncs[G3D_SBC_CMD_00A]) { + callbackSegment = renderState->callbackSegment[G3D_SBC_CMD_00A]; + } else { + callbackSegment = 0; + } + callbackSkip = (renderState->flag & G3D_RENDERST_FLAG_SKIP_CALLBACK); + } else { + callbackSkip = 0; + } + + if (!(renderState->flag & G3D_RENDERST_FLAG_SKIP_CMD) && !callbackSkip) { + u32 int1; + u32 int2; + int1 = (u32) ((*(renderState->currentCmd + 1)) | (*(renderState->currentCmd + 2) << 8) | + (*(renderState->currentCmd + 3) << 16) | (*(renderState->currentCmd + 4) << 24)); + + int2 = (u32) ((*(renderState->currentCmd + 5) << 0) | (*(renderState->currentCmd + 6) << 8) | + (*(renderState->currentCmd + 7) << 16) | (*(renderState->currentCmd + 8) << 24)); + + func_01ffa94c(renderState->currentCmd + int1, int2); + } + + if (callbackSegment == 3) { + renderState->flag &= ~G3D_RENDERST_FLAG_SKIP_CALLBACK; + (*renderState->callbackFuncs[G3D_SBC_CMD_00A])(renderState); + callbackSkip = renderState->flag & G3D_RENDERST_FLAG_SKIP_CALLBACK; + } else { + callbackSkip = 0; + } + + renderState->currentCmd += 1 + sizeof(u32) + sizeof(u32); +} + +// Renders the Scale SBC command +void G3d_SBCRender_SCL(G3d_RenderState *renderState, u32 opCode) { + Vec3p scaleVector; + + if (!(renderState->flag & G3D_RENDERST_FLAG_SKIP_CMD) && !(renderState->flag & G3D_RENDERST_FLAG_SKIP_SBC_RENDER)) { + if (opCode == 0) { + scaleVector.x = scaleVector.y = scaleVector.z = renderState->upScale; + } else { + scaleVector.x = scaleVector.y = scaleVector.z = renderState->downScale; + } + PushGeometryCommand(0x1b, &scaleVector.x, 3); // MTX_SCALE + } + renderState->currentCmd += 1; +} + +// Renders the SBC command 0xC (unknown) +void G3d_SBCRender_00C(G3d_RenderState *renderState, u32) { + if (!(renderState->flag & G3D_RENDERST_FLAG_SKIP_SBC_RENDER) && (renderState->flag & G3D_RENDERST_FLAG_BONE_VISIBLE)) { + u32 callbackSkip; + u32 callbackSegment; + u32 mtxModeTex; + + if ((renderState->matAnim->teximage_params & G3D_TEXIMAGE_PARM_TEX_COORD_MODE) != 0x80000000) { // Normal source + static u32 funcArgs[] = {0x2a, 0}; + renderState->matAnim->teximage_params &= ~G3D_TEXIMAGE_PARM_TEX_COORD_MODE; + renderState->matAnim->teximage_params |= 0x80000000; // Normal source + + funcArgs[1] = renderState->matAnim->teximage_params; + PushGeometryCommand(funcArgs[0], &funcArgs[1], 1); + } + + mtxModeTex = 3; + PushGeometryCommand(0x10, &mtxModeTex, 1); + + if (renderState->callbackFuncs[G3D_SBC_CMD_00C]) { + callbackSegment = renderState->callbackSegment[G3D_SBC_CMD_00C]; + } else { + callbackSegment = 0; + } + + if (callbackSegment == 1) { + renderState->flag &= ~G3D_RENDERST_FLAG_SKIP_CALLBACK; + (*renderState->callbackFuncs[G3D_SBC_CMD_00C])(renderState); + if (renderState->callbackFuncs[G3D_SBC_CMD_00C]) { + callbackSegment = renderState->callbackSegment[G3D_SBC_CMD_00C]; + } else { + callbackSegment = 0; + } + callbackSkip = (renderState->flag & G3D_RENDERST_FLAG_SKIP_CALLBACK); + } else { + callbackSkip = 0; + } + + if (!callbackSkip) { + s32 width = renderState->matAnim->width; + s32 height = renderState->matAnim->height; + Vec3p vec; + u32 tmp; + + G3d_Scale_inline(width << 15, -height << 15, INT_TO_Q20(1) << 4); + + tmp = GX_PACK_TEXCOORD_PARAM(width << 11, height << 11); + PushGeometryCommand(0x22, (u32 *) &tmp, 1); // TEXCOORD + } + + if (callbackSegment == 2) { + renderState->flag &= ~G3D_RENDERST_FLAG_SKIP_CALLBACK; + (*renderState->callbackFuncs[G3D_SBC_CMD_00C])(renderState); + if (renderState->callbackFuncs[G3D_SBC_CMD_00C]) { + callbackSegment = renderState->callbackSegment[G3D_SBC_CMD_00C]; + } else { + callbackSegment = 0; + } + callbackSkip = (u32) (renderState->flag & G3D_RENDERST_FLAG_SKIP_CALLBACK); + } else { + callbackSkip = 0; + } + + if (!callbackSkip) { + u32 matIndex = *(renderState->currentCmd + 1); + G3d_NameList_Header *h = (G3d_NameList_Header *) ((u8 *) &renderState->materialList->materials + + renderState->materialList->materials.ofsHeader); + u32 *materialOffset = (u32 *) (&h->data[0] + h->element_size * matIndex); + const G3d_Material *mat = (G3d_Material *) ((u8 *) renderState->materialList + *materialOffset); + + if (mat->flag & 0x2000) { + const u8 *p = (const u8 *) mat + sizeof(G3d_Material); + + if (!(mat->flag & 2)) { + p += 8; + } + + if (!(mat->flag & 4)) { + p += 4; + } + + if (!(mat->flag & 8)) { + p += 8; + } + + G3d_MtxMult44_inline((const Mat4p *) p); // MTX_MULT_4x4 + } + } + + if (callbackSegment == 3) { + renderState->flag &= ~G3D_RENDERST_FLAG_SKIP_CALLBACK; + (*renderState->callbackFuncs[G3D_SBC_CMD_00C])(renderState); + callbackSkip = renderState->flag & G3D_RENDERST_FLAG_SKIP_CALLBACK; + } else { + callbackSkip = 0; + } + + if (!callbackSkip) { + Mat3p m; + G3d_SetMtxMode_inline(2); // MTX_MODE = Position + Vector + G3d_GetCurrentMtx(0, &m); + G3d_SetMtxMode_inline(3); // MTX_MODE = Texture + + if (data_027e037c.flags & 1) { + G3d_MtxMult33_inline((const Mat3p *) &data_027e037c.mUnk_04c); // MTX_MULT_3x3 + G3d_MtxMult33_inline(&gGeomMatrix); // MTX_MULT_3x3 + G3d_MtxMult33_inline(&m); // MTX_MULT_3x3 + } else if (data_027e037c.flags & 2) { + G3d_MtxMult33_inline((const Mat3p *) &data_027e037c.mUnk_04c); // MTX_MULT_3x3 + G3d_MtxMult33_inline(&m); // MTX_MULT_3x3 + } else { + G3d_MtxMult33_inline(&m); // MTX_MULT_3x3 + } + } + + G3d_SetMtxMode_inline(2); // MTX_MODE = Position + Vector + } + renderState->currentCmd += 3; +} + +// Renders the SBC command 0xD (unknown) +void G3d_SBCRender_00D(G3d_RenderState *renderState, u32) { + if (!(renderState->flag & G3D_RENDERST_FLAG_SKIP_SBC_RENDER) && (renderState->flag & G3D_RENDERST_FLAG_BONE_VISIBLE)) { + u32 callbackSkip; + u32 callbackSegment; + u32 num; + Mat4x3p m; + + G3d_GetCurrentMtx(&m, 0); + num = 30; + PushGeometryCommand(0x13, &num, 1); // MTX_STORE + + if ((renderState->matAnim->teximage_params & 0xc0000000) != (3 << 30)) { + static u32 cmd[] = {0x2a, 0}; + renderState->matAnim->teximage_params &= ~0xc0000000; + renderState->matAnim->teximage_params |= 3 << 30; + + cmd[1] = renderState->matAnim->teximage_params; + PushGeometryCommand(cmd[0], &cmd[1], 1); + } + + if (renderState->callbackFuncs[G3D_SBC_CMD_00D]) { + callbackSegment = renderState->callbackSegment[G3D_SBC_CMD_00D]; + } else { + callbackSegment = 0; + } + + if (callbackSegment == 1) { + renderState->flag &= ~G3D_RENDERST_FLAG_SKIP_CALLBACK; + (*renderState->callbackFuncs[G3D_SBC_CMD_00D])(renderState); + if (renderState->callbackFuncs[G3D_SBC_CMD_00D]) { + callbackSegment = renderState->callbackSegment[G3D_SBC_CMD_00D]; + } else { + callbackSegment = 0; + } + callbackSkip = (renderState->flag & G3D_RENDERST_FLAG_SKIP_CALLBACK); + } else { + callbackSkip = 0; + } + + if (!callbackSkip) { + s32 w, h; + w = (s32) renderState->matAnim->width; + h = (s32) renderState->matAnim->height; + + { + static Mat4p mtx = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10000, 0, 0, 0, 0, 0x10000}; + + mtx.xColumn.x = w << 15; + mtx.yColumn.y = -h << 15; + mtx.wColumn.x = w << 15; + mtx.wColumn.y = h << 15; + + PushGeometryCommand(0x16, &mtx, 0x10); + } + } + + if (callbackSegment == 2) { + renderState->flag &= ~G3D_RENDERST_FLAG_SKIP_CALLBACK; + (*renderState->callbackFuncs[G3D_SBC_CMD_00D])(renderState); + if (renderState->callbackFuncs[G3D_SBC_CMD_00D]) { + callbackSegment = renderState->callbackSegment[G3D_SBC_CMD_00D]; + } else { + callbackSegment = 0; + } + callbackSkip = (u32) (renderState->flag & G3D_RENDERST_FLAG_SKIP_CALLBACK); + } else { + callbackSkip = 0; + } + + if (!callbackSkip) { + u32 idxMat = *(renderState->currentCmd + 1); + u32 matIndex = *(renderState->currentCmd + 1); + G3d_NameList_Header *h = (G3d_NameList_Header *) ((u8 *) &renderState->materialList->materials + + renderState->materialList->materials.ofsHeader); + u32 *materialOffset = (u32 *) (&h->data[0] + h->element_size * matIndex); + const G3d_Material *mat = (G3d_Material *) ((u8 *) renderState->materialList + *materialOffset); + + if (mat->flag & 0x2000) { + const Mat4p *effect_mtx; + const u8 *p = (const u8 *) mat + sizeof(G3d_Material); + + if (!(mat->flag & 2)) { + p += 8; + } + + if (!(mat->flag & 4)) { + p += 4; + } + + if (!(mat->flag & 8)) { + p += 8; + } + + G3d_MtxMult44_inline((const Mat4p *) p); // MTX_MULT_4x4 + } + } + + if (callbackSegment == 3) { + renderState->flag &= ~G3D_RENDERST_FLAG_SKIP_CALLBACK; + (*renderState->callbackFuncs[G3D_SBC_CMD_00D])(renderState); + callbackSkip = renderState->flag & G3D_RENDERST_FLAG_SKIP_CALLBACK; + } else { + callbackSkip = 0; + } + + if (!callbackSkip) { + Mat4p mtx; + u32 tmp; + + if (data_027e037c.flags & 1) { + PushGeometryCommand(0x1c, &gGeomTranslation, 3); // MTX_TRANS + G3d_MtxMult33_inline(&gGeomMatrix); // MTX_MULT_3x3 + G3d_MtxMult43_inline(&m); // MTX_MULT_4x3 + + } else if (data_027e037c.flags & 2) { + G3d_MtxMult43_inline(&m); + } else { + G3d_MtxMult43_inline(func_02018450()); + G3d_MtxMult43_inline(&m); + } + + { + FlushGfxQueue(); + + GFX_FIFO_MTX_MODE = 0; // Projection + GFX_FIFO_MTX_PUSH = 0; + GFX_FIFO_MTX_IDENTITY = 0; + + while (func_0200598c(&mtx)) + ; + + GFX_FIFO_MTX_POP = 1; + GFX_FIFO_MTX_MODE = 3; // Texture + } + + PushGeometryCommand(0x16, &mtx, 0x10); + tmp = GX_PACK_TEXCOORD_PARAM((q20) (mtx.wColumn.x >> 4), (q20) (mtx.wColumn.y >> 4)); + PushGeometryCommand(0x22, (u32 *) &tmp, 1); // TEXCOORD + } + + G3d_SetMtxMode_inline(2); // MTX_MODE = Position + Vector + G3d_RestoreMtx_inline(30); + } + renderState->currentCmd += 3; +} \ No newline at end of file diff --git a/src/00_Core/Item/ItemManager.cpp b/src/00_Core/Item/ItemManager.cpp index 2e1f3c01..396f42e2 100644 --- a/src/00_Core/Item/ItemManager.cpp +++ b/src/00_Core/Item/ItemManager.cpp @@ -556,7 +556,7 @@ THUMB void ItemManager::LoadFanfareItem(ItemId id) { strcat(textureName, sSpecialItemModelNames[6]); model = LoadNsbTexturedModel(mFanfareItemModel, modelName, textureName, 0, 0, 0, true); } - mUnk_114->Init_ModelRender_UnkStruct_4(model); + mUnk_114->Init_RenderObject(model); } THUMB bool ItemManager::GetFanfareItemScale(Vec3p *scale) const { diff --git a/src/00_Core/Render/ModelRender.cpp b/src/00_Core/Render/ModelRender.cpp index cd984739..37a4ce30 100644 --- a/src/00_Core/Render/ModelRender.cpp +++ b/src/00_Core/Render/ModelRender.cpp @@ -1,32 +1,30 @@ #include "Render/ModelRender.hpp" -#include "DTCM/UnkStruct_027e037c.hpp" +#include "DTCM/UnkStruct_027e037c.h" +#include "nds/g3d/sbc.h" -extern "C" void func_020189dc(ModelRender_UnkStruct_4 *unkStruct4, ItemModel *model); -extern "C" void func_02018c3c(ModelRender_UnkStruct_4 *unkStruct4, void *param2); -extern "C" void UnkInit_ModelRender_Struct4_Params(ModelRender_UnkStruct_4 *unkStruct4, - void (*func)(ModelRenderCommandsData *), unk32 param3, u8 param4, - u8 param5); -extern "C" void ExecModelRenderCommands(ModelRender_UnkStruct_4 *unkStruct4); +extern "C" void func_020189dc(G3d_RenderObject *unkStruct4, ItemModel *model); +extern "C" void func_02018c3c(G3d_RenderObject *unkStruct4, void *param2); +extern "C" void UnkInit_ModelRender_Struct4_Params(G3d_RenderObject *unkStruct4, void (*func)(ModelRenderCommandsData *), + unk32 param3, u8 param4, u8 param5); extern "C" void CopySingle288(Mat3p *src, Mat3p *dest); extern "C" void SetGeometryScale(Vec3p *scale); extern "C" void SetGeometryTranslation(Vec3p *translation); extern "C" void PushGeometryCommand(u32 command, void *data, s32 length); -extern "C" void func_ov000_020c0d70(UnkStruct_ov000_020c0c08 *param1, ModelRender_UnkStruct_4 *param2); +extern "C" void func_ov000_020c0d70(UnkStruct_ov000_020c0c08 *param1, G3d_RenderObject *param2); extern "C" void func_ov000_020b3ea8(void *param1); extern "C" unk32 func_0201e388(void *param1, const char *param2); extern "C" u8 *GetModelUnknownHeader(ModelRender *modelRender); extern "C" Mat3p gGeomMatrix; extern "C" Vec3p gGeomTranslation; extern "C" Vec3p gGeomScale; -extern "C" UnkStruct_027e037c data_027e037c; -extern "C" void *data_027e03c8; +extern "C" const Mat4x3p *data_027e03c8; extern "C" Vec3p gDefaultScale; extern "C" Mat3p gDefaultMatrix; extern "C" u32 *data_027e0ce0[]; THUMB ModelRender::ModelRender(ItemModel *itemModel) { this->unkBoneMatrixArray2 = NULL; - this->Init_ModelRender_UnkStruct_4(itemModel); + this->Init_RenderObject(itemModel); } THUMB ModelRender::~ModelRender() { @@ -37,19 +35,19 @@ THUMB ModelRender::~ModelRender() { } ARM void *ModelRender::GetLcdcAddress() { - return mUnk_04.mLcdcAddr; + return renderObj.model; } -void ModelRender::Init_ModelRender_UnkStruct_4(ItemModel *model) { - func_020189dc(&this->mUnk_04, model); +void ModelRender::Init_RenderObject(ItemModel *model) { + func_020189dc(&this->renderObj, model); } -ModelRender_UnkBoneMatrixStruct *ModelRender::UnkGetBoneMatrix(s32 index) { +G3d_BoneMtxStruct *ModelRender::UnkGetBoneMatrix(s32 index) { if (this->unkBoneMatrixArray2 != NULL) { return &this->unkBoneMatrixArray2[index]; } - if (this->mUnk_04.unkBoneMatrixArray1 != NULL) { - return &this->mUnk_04.unkBoneMatrixArray1[index]; + if (this->renderObj.cacheJntAnm != NULL) { + return &this->renderObj.cacheJntAnm[index]; } return NULL; } @@ -88,40 +86,40 @@ void ModelRender::PushGeometryCommands() { } void ModelRender::ExecRenderCommands() { - ExecModelRenderCommands(&this->mUnk_04); + G3d_Render(&this->renderObj); } void ModelRender::vfunc_24(UnkStruct_ov000_020c0c08 *param1) { - func_ov000_020c0d70(param1, &this->mUnk_04); + func_ov000_020c0d70(param1, &this->renderObj); } void ModelRender::vfunc_28() { - while (this->mUnk_04.mUnk_10 != NULL) { - func_02018c3c(&this->mUnk_04, this->mUnk_04.mUnk_10); + while (this->renderObj.jntAnim != NULL) { + func_02018c3c(&this->renderObj, this->renderObj.jntAnim); } - while (this->mUnk_04.mUnk_08 != NULL) { - func_02018c3c(&this->mUnk_04, this->mUnk_04.mUnk_08); + while (this->renderObj.matAnim != NULL) { + func_02018c3c(&this->renderObj, this->renderObj.matAnim); } - while (this->mUnk_04.mUnk_18 != NULL) { - func_02018c3c(&this->mUnk_04, this->mUnk_04.mUnk_18); + while (this->renderObj.mUnk_18 != NULL) { + func_02018c3c(&this->renderObj, this->renderObj.mUnk_18); } } void ModelRender::vfunc_2c() { - while (this->mUnk_04.mUnk_10 != NULL) { - func_02018c3c(&this->mUnk_04, this->mUnk_04.mUnk_10); + while (this->renderObj.jntAnim != NULL) { + func_02018c3c(&this->renderObj, this->renderObj.jntAnim); } } void ModelRender::vfunc_34() { - while (this->mUnk_04.mUnk_18 != NULL) { - func_02018c3c(&this->mUnk_04, this->mUnk_04.mUnk_18); + while (this->renderObj.mUnk_18 != NULL) { + func_02018c3c(&this->renderObj, this->renderObj.mUnk_18); } } void ModelRender::vfunc_30() { - while (this->mUnk_04.mUnk_08 != NULL) { - func_02018c3c(&this->mUnk_04, this->mUnk_04.mUnk_08); + while (this->renderObj.matAnim != NULL) { + func_02018c3c(&this->renderObj, this->renderObj.matAnim); } } @@ -146,29 +144,28 @@ THUMB void ModelRender::InitBoneMatrixArrays(u32 idLength) { u8 *unkPtr = GetModelUnknownHeader(this); u8 boneMatrixCount = *(unkPtr + 3); - ModelRender_UnkBoneMatrixStruct *boneMatrixArray = - (ModelRender_UnkBoneMatrixStruct *) SysObject::operator new[](boneMatrixCount * 0x58, id, idLength); - this->unkBoneMatrixArray2 = boneMatrixArray; - this->mUnk_04.unkBoneMatrixArray1 = boneMatrixArray; + G3d_BoneMtxStruct *boneMatrixArray = (G3d_BoneMtxStruct *) SysObject::operator new[](boneMatrixCount * 0x58, id, idLength); + this->unkBoneMatrixArray2 = boneMatrixArray; + this->renderObj.cacheJntAnm = boneMatrixArray; } -ARM void ModelRender::SetUnkBoneMatrixArray1(ModelRender_UnkBoneMatrixStruct *boneMatrix) { - this->mUnk_04.unkBoneMatrixArray1 = boneMatrix; +ARM void ModelRender::SetUnkBoneMatrixArray1(G3d_BoneMtxStruct *boneMatrix) { + this->renderObj.cacheJntAnm = boneMatrix; } void ModelRender::vfunc_38() { - this->mUnk_04.flags |= 3; - ExecModelRenderCommands(&this->mUnk_04); - this->mUnk_04.flags &= 0xfffffffd; + this->renderObj.flag |= 3; + G3d_Render(&this->renderObj); + this->renderObj.flag &= 0xfffffffd; } void ModelRender::vfunc_3c(ModelRenderCommandsData *renderData) {} void func_ov000_020a99c0(ModelRenderCommandsData *renderData) { - renderData->unkStruct4->mUnk_2c->vfunc_3c(renderData); + ((ModelRender *) renderData->unkStruct4->modelRender)->vfunc_3c(renderData); } void ModelRender::UnkInit_Struct4_Params(u8 param1, u8 param2) { - this->mUnk_04.mUnk_2c = this; - UnkInit_ModelRender_Struct4_Params(&this->mUnk_04, &func_ov000_020a99c0, 0, param1, param2); + this->renderObj.modelRender = this; + UnkInit_ModelRender_Struct4_Params(&this->renderObj, &func_ov000_020a99c0, 0, param1, param2); } \ No newline at end of file diff --git a/src/58_Bombchu/Player/EquipBombchu.cpp b/src/58_Bombchu/Player/EquipBombchu.cpp index d52dc6c7..3850cb61 100644 --- a/src/58_Bombchu/Player/EquipBombchu.cpp +++ b/src/58_Bombchu/Player/EquipBombchu.cpp @@ -87,8 +87,8 @@ static const ItemManager_Unk1 sEquipBombchu_Unk1 = { }; THUMB void EquipBombchu::vfunc_00() { - gModelRenderBombchu.Init_ModelRender_UnkStruct_4(gItemManager->GetItemModel(ItemModelId_Bombchu)); - gModelRenderBombchuPt.Init_ModelRender_UnkStruct_4(gItemManager->GetItemModel(ItemModelId_BombchuPt)); + gModelRenderBombchu.Init_RenderObject(gItemManager->GetItemModel(ItemModelId_Bombchu)); + gModelRenderBombchuPt.Init_RenderObject(gItemManager->GetItemModel(ItemModelId_BombchuPt)); data_ov058_0219b0a0.mUnk_08 = gItemManager->GetItemModel(ItemModelId_BombchuPt); data_ov058_0219b0a0.func_ov000_020c0c44(gItemManager->func_ov00_020ad538(&sEquipBombchu_Unk1)); data_ov058_0219b0a0.func_ov000_020c0e5c(0); diff --git a/src/59_Hammer/Actor/Navi/ActorNaviBase_59.cpp b/src/59_Hammer/Actor/Navi/ActorNaviBase_59.cpp index 9df98e3d..2e1ca4db 100644 --- a/src/59_Hammer/Actor/Navi/ActorNaviBase_59.cpp +++ b/src/59_Hammer/Actor/Navi/ActorNaviBase_59.cpp @@ -45,7 +45,7 @@ ARM void ActorNavi::func_ov059_0219aa08(bool param1) { this->mUnk_334.mUnk_00.x = ROUND_Q20(uVar4) | ((this->mUnk_344 >> 0x1F) * 0x666 + (lVar2 >> 0x20) + (~0x800 < uVar4)) * 0x100000; - Mat3p_MultiplyVec(&this->mUnk_334.mUnk_00, &this->unkBoneMatrixStruct.mUnk_28, &this->mUnk_334.mUnk_00); + Mat3p_MultiplyVec(&this->mUnk_334.mUnk_00, &this->unkBoneMatrixStruct.rot, &this->mUnk_334.mUnk_00); Vec3p_RotateY(uVar3, &this->mUnk_334.mUnk_00); Vec3p_Add(&this->mUnk_334.mUnk_00, &VStack_24, &this->mUnk_334.mUnk_00); VStack_60.z = this->mUnk_334.mUnk_00.z; diff --git a/src/Main/Game/Game.cpp b/src/Main/Game/Game.cpp index d702f191..65410b8d 100644 --- a/src/Main/Game/Game.cpp +++ b/src/Main/Game/Game.cpp @@ -3,7 +3,7 @@ #include #include -#include "DTCM/UnkStruct_027e037c.hpp" +#include "DTCM/UnkStruct_027e037c.h" #include "DTCM/UnkStruct_027e05f8.hpp" #include "DTCM/UnkStruct_027e077c.hpp" #include "DTCM/UnkStruct_027e080c.hpp"