diff --git a/config/RSPE01_01/splits.txt b/config/RSPE01_01/splits.txt index 3b5df0ef..6a4e79cb 100644 --- a/config/RSPE01_01/splits.txt +++ b/config/RSPE01_01/splits.txt @@ -3254,3 +3254,80 @@ Pack/RPAudio/RPSndStaticMgr.cpp: .text start:0x801B9548 end:0x801B9910 .data start:0x803BAB20 end:0x803C1720 .sdata2 start:0x804C1990 end:0x804C19A0 + +Pack/RPUtility/RPUtlDohMath.cpp: + .text start:0x801B9910 end:0x801B9EC0 + .ctors start:0x8035513C end:0x80355140 + .bss start:0x804A4690 end:0x804A4750 + .sbss start:0x804BF660 end:0x804BF668 + .sdata2 start:0x804C19A0 end:0x804C19B0 + +Pack/RPUtility_unsplit.o: + .text start:0x801B9EC0 end:0x801CCB70 + .ctors start:0x80355140 end:0x80355160 + .rodata start:0x803837E8 end:0x80383990 + .data start:0x803C1720 end:0x803C1BF0 + .bss start:0x804A4750 end:0x804A48A0 + .sdata start:0x804BDC18 end:0x804BDC38 + .sbss start:0x804BF668 end:0x804BF6F0 + .sdata2 start:0x804C19B0 end:0x804C1A20 + +Pack/RPSports/RPSportsCommon/RPSportsCommon_unsplit.o: + .text start:0x801CCB70 end:0x80214480 + .ctors start:0x80355160 end:0x8035516C + .rodata start:0x80383990 end:0x8038B1A8 + .data start:0x803C1BF0 end:0x803C3730 + .bss start:0x804A48A0 end:0x804A6000 + .sdata start:0x804BDC38 end:0x804BDDD0 + .sbss start:0x804BF6F0 end:0x804BF768 + .sdata2 start:0x804C1A20 end:0x804C2338 + +Pack/RPSports/RPTnsScene/RPTnsScene_unsplit.o: + .text start:0x80214480 end:0x8024E334 + .ctors start:0x8035516C end:0x803551A8 + .rodata start:0x8038B1A8 end:0x8038C8A0 + .data start:0x803C3730 end:0x803C4FC8 + .bss start:0x804A6000 end:0x804A6448 + .sdata start:0x804BDDD0 end:0x804BDE10 + .sbss start:0x804BF768 end:0x804BF778 + .sdata2 start:0x804C2338 end:0x804C32A8 + +Pack/RPSports/RPBsbScene/RPBsbScene_unsplit.o: + .text start:0x8024E334 end:0x8028DF74 + .ctors start:0x803551A8 end:0x803551F4 + .rodata start:0x8038C8A0 end:0x8038E250 + .data start:0x803C4FC8 end:0x803C7718 + .bss start:0x804A6448 end:0x804A8900 + .sdata start:0x804BDE10 end:0x804BE818 + .sbss start:0x804BF778 end:0x804BF850 + .sdata2 start:0x804C32A8 end:0x804C3E80 + +Pack/RPSports/RPGolScene/RPGolScene_unsplit.o: + .text start:0x8028DF74 end:0x802C7924 + .ctors start:0x803551F4 end:0x8035522C + .rodata start:0x8038E250 end:0x8038FB10 + .data start:0x803C7718 end:0x803C8958 + .bss start:0x804A8900 end:0x804A92D0 + .sdata start:0x804BE818 end:0x804BE8D0 + .sbss start:0x804BF850 end:0x804BF958 + .sdata2 start:0x804C3E80 end:0x804C4CB8 + +Pack/RPSports/RPBoxScene/RPBoxScene_unsplit.o: + .text start:0x802C7924 end:0x80313028 + .ctors start:0x8035522C end:0x8035524C + .rodata start:0x8038FB10 end:0x80392190 + .data start:0x803C8958 end:0x803CA1B8 + .bss start:0x804A92D0 end:0x804A9DE8 + .sdata start:0x804BE8D0 end:0x804BE968 + .sbss start:0x804BF958 end:0x804BF998 + .sdata2 start:0x804C4CB8 end:0x804C5AC0 + +Pack/RPSports/RPBowScene/RPBowScene_unsplit.o: + .text start:0x80313028 end:0x8035507C + .ctors start:0x8035524C end:0x8035525C + .rodata start:0x80392190 end:0x80393A70 + .data start:0x803CA1B8 end:0x803CAF00 + .bss start:0x804A9DE8 end:0x804BD36C + .sdata start:0x804BE968 end:0x804BE9D0 + .sbss start:0x804BF998 end:0x804BFA10 + .sdata2 start:0x804C5AC0 end:0x804C69D0 diff --git a/config/RSPE01_01/symbols.txt b/config/RSPE01_01/symbols.txt index 445d8956..4cccd634 100644 --- a/config/RSPE01_01/symbols.txt +++ b/config/RSPE01_01/symbols.txt @@ -7777,33 +7777,33 @@ fn_801A97B8 = .text:0x801A97B8; // type:function size:0x14 fn_801A97CC = .text:0x801A97CC; // type:function size:0x14 fn_801A97E0 = .text:0x801A97E0; // type:function size:0x80 RemoveGenList__10RPGrpModelFv = .text:0x801A9860; // type:function size:0x44 -fn_801A98A4 = .text:0x801A98A4; // type:function size:0x94 -fn_801A9938 = .text:0x801A9938; // type:function size:0xC4 -fn_801A99FC = .text:0x801A99FC; // type:function size:0x8 -fn_801A9A04 = .text:0x801A9A04; // type:function size:0x78 -fn_801A9A7C = .text:0x801A9A7C; // type:function size:0x2C -fn_801A9AA8 = .text:0x801A9AA8; // type:function size:0x68 -fn_801A9B10 = .text:0x801A9B10; // type:function size:0x74 -fn_801A9B84 = .text:0x801A9B84; // type:function size:0x64 -fn_801A9BE8 = .text:0x801A9BE8; // type:function size:0xC0 -fn_801A9CA8 = .text:0x801A9CA8; // type:function size:0x10 -fn_801A9CB8 = .text:0x801A9CB8; // type:function size:0xE0 -fn_801A9D98 = .text:0x801A9D98; // type:function size:0x40 -fn_801A9DD8 = .text:0x801A9DD8; // type:function size:0x80 -fn_801A9E58 = .text:0x801A9E58; // type:function size:0x94 -fn_801A9EEC = .text:0x801A9EEC; // type:function size:0x94 -fn_801A9F80 = .text:0x801A9F80; // type:function size:0xB4 -fn_801AA034 = .text:0x801AA034; // type:function size:0x28 -fn_801AA05C = .text:0x801AA05C; // type:function size:0xC -fn_801AA068 = .text:0x801AA068; // type:function size:0x28 -fn_801AA090 = .text:0x801AA090; // type:function size:0xC -fn_801AA09C = .text:0x801AA09C; // type:function size:0x8 -fn_801AA0A4 = .text:0x801AA0A4; // type:function size:0x8 -fn_801AA0AC = .text:0x801AA0AC; // type:function size:0x8 -fn_801AA0B4 = .text:0x801AA0B4; // type:function size:0x14 -fn_801AA0C8 = .text:0x801AA0C8; // type:function size:0x14 -fn_801AA0DC = .text:0x801AA0DC; // type:function size:0x40 -fn_801AA11C = .text:0x801AA11C; // type:function size:0xC +ReplaceTexture__10RPGrpModelFPCcRC12RPGrpTextureb = .text:0x801A98A4; // type:function size:0x94 +SetReverseCulling__10RPGrpModelFb = .text:0x801A9938; // type:function size:0xC4 +GetMaterialNum__10RPGrpModelCFv = .text:0x801A99FC; // type:function size:0x8 +CalcMaterial__10RPGrpModelFv = .text:0x801A9A04; // type:function size:0x78 +Entry__10RPGrpModelFv = .text:0x801A9A7C; // type:function size:0x2C +Calc__10RPGrpModelFv = .text:0x801A9AA8; // type:function size:0x68 +UpdateFrame__10RPGrpModelFv = .text:0x801A9B10; // type:function size:0x74 +CreateRecord__10RPGrpModelFUs = .text:0x801A9B84; // type:function size:0x64 +CreateBoundingInfo__10RPGrpModelFUl = .text:0x801A9BE8; // type:function size:0xC0 +SetCallback__10RPGrpModelFP19IRPGrpModelCallback = .text:0x801A9CA8; // type:function size:0x10 +Configure__10RPGrpModelFv = .text:0x801A9CB8; // type:function size:0xE0 +__dt__10RPGrpModelFv = .text:0x801A9D98; // type:function size:0x40 +__ct__10RPGrpModelFUc = .text:0x801A9DD8; // type:function size:0x80 +Construct__10RPGrpModelFUsPCcUcUlUl = .text:0x801A9E58; // type:function size:0x94 +Construct__10RPGrpModelFUsiUcUlUl = .text:0x801A9EEC; // type:function size:0x94 +Construct__10RPGrpModelFUsUcUlUl = .text:0x801A9F80; // type:function size:0xB4 +SetJointVisible__10RPGrpModelFUlb = .text:0x801AA034; // type:function size:0x28 +IsJointVisible__10RPGrpModelCFv = .text:0x801AA05C; // type:function size:0xC +SetShapeVisible__10RPGrpModelFUlb = .text:0x801AA068; // type:function size:0x28 +IsShapeVisible__10RPGrpModelCFv = .text:0x801AA090; // type:function size:0xC +GetJointNum__10RPGrpModelCFv = .text:0x801AA09C; // type:function size:0x8 +GetShapeNum__10RPGrpModelCFv = .text:0x801AA0A4; // type:function size:0x8 +GetViewMtxNum__10RPGrpModelCFv = .text:0x801AA0AC; // type:function size:0x8 +DrawDirect__10RPGrpModelFUlPQ23EGG9Matrix34f = .text:0x801AA0B4; // type:function size:0x14 +CalcBeforeDraw__10RPGrpModelFv = .text:0x801AA0C8; // type:function size:0x14 +CalcView__10RPGrpModelFRCQ23EGG9Matrix34fPQ23EGG9Matrix34f = .text:0x801AA0DC; // type:function size:0x40 +GetShapeMinMax__10RPGrpModelCFUsPQ23EGG8Vector3fPQ23EGG8Vector3f = .text:0x801AA11C; // type:function size:0xC fn_801AA128 = .text:0x801AA128; // type:function size:0x1C fn_801AA144 = .text:0x801AA144; // type:function size:0x7C fn_801AA1C0 = .text:0x801AA1C0; // type:function size:0x110 @@ -7852,59 +7852,59 @@ fn_801AC218 = .text:0x801AC218; // type:function size:0x50 fn_801AC268 = .text:0x801AC268; // type:function size:0x40 fn_801AC2A8 = .text:0x801AC2A8; // type:function size:0x44C fn_801AC6F4 = .text:0x801AC6F4; // type:function size:0x44C -fn_801ACB40 = .text:0x801ACB40; // type:function size:0x70 -fn_801ACBB0 = .text:0x801ACBB0; // type:function size:0x4 -fn_801ACBB4 = .text:0x801ACBB4; // type:function size:0x124 -fn_801ACCD8 = .text:0x801ACCD8; // type:function size:0x4 -fn_801ACCDC = .text:0x801ACCDC; // type:function size:0x104 -fn_801ACDE0 = .text:0x801ACDE0; // type:function size:0x4 -fn_801ACDE4 = .text:0x801ACDE4; // type:function size:0x8 -fn_801ACDEC = .text:0x801ACDEC; // type:function size:0x8 -fn_801ACDF4 = .text:0x801ACDF4; // type:function size:0x40 -fn_801ACE34 = .text:0x801ACE34; // type:function size:0x4 -fn_801ACE38 = .text:0x801ACE38; // type:function size:0xC4 -fn_801ACEFC = .text:0x801ACEFC; // type:function size:0xEC -fn_801ACFE8 = .text:0x801ACFE8; // type:function size:0xA8 -fn_801AD090 = .text:0x801AD090; // type:function size:0x4 -fn_801AD094 = .text:0x801AD094; // type:function size:0x134 -fn_801AD1C8 = .text:0x801AD1C8; // type:function size:0xB4 -fn_801AD27C = .text:0x801AD27C; // type:function size:0x30 -fn_801AD2AC = .text:0x801AD2AC; // type:function size:0x148 -fn_801AD3F4 = .text:0x801AD3F4; // type:function size:0xF8 -fn_801AD4EC = .text:0x801AD4EC; // type:function size:0xF8 -fn_801AD5E4 = .text:0x801AD5E4; // type:function size:0xE4 -fn_801AD6C8 = .text:0x801AD6C8; // type:function size:0x68 -fn_801AD730 = .text:0x801AD730; // type:function size:0x8 -fn_801AD738 = .text:0x801AD738; // type:function size:0x3C -fn_801AD774 = .text:0x801AD774; // type:function size:0x3C -fn_801AD7B0 = .text:0x801AD7B0; // type:function size:0x4 -fn_801AD7B4 = .text:0x801AD7B4; // type:function size:0x4 -fn_801AD7B8 = .text:0x801AD7B8; // type:function size:0x4 -fn_801AD7BC = .text:0x801AD7BC; // type:function size:0x44 -fn_801AD800 = .text:0x801AD800; // type:function size:0x80 -fn_801AD880 = .text:0x801AD880; // type:function size:0xC0 -fn_801AD940 = .text:0x801AD940; // type:function size:0x94 -fn_801AD9D4 = .text:0x801AD9D4; // type:function size:0x40 -fn_801ADA14 = .text:0x801ADA14; // type:function size:0x78 -fn_801ADA8C = .text:0x801ADA8C; // type:function size:0x78 -fn_801ADB04 = .text:0x801ADB04; // type:function size:0x78 -fn_801ADB7C = .text:0x801ADB7C; // type:function size:0x68 -fn_801ADBE4 = .text:0x801ADBE4; // type:function size:0x78 -fn_801ADC5C = .text:0x801ADC5C; // type:function size:0x68 -fn_801ADCC4 = .text:0x801ADCC4; // type:function size:0x90 -fn_801ADD54 = .text:0x801ADD54; // type:function size:0x70 -fn_801ADDC4 = .text:0x801ADDC4; // type:function size:0x4 -fn_801ADDC8 = .text:0x801ADDC8; // type:function size:0x58 -fn_801ADE20 = .text:0x801ADE20; // type:function size:0x8 -fn_801ADE28 = .text:0x801ADE28; // type:function size:0x8 -fn_801ADE30 = .text:0x801ADE30; // type:function size:0x8 -fn_801ADE38 = .text:0x801ADE38; // type:function size:0x8 -fn_801ADE40 = .text:0x801ADE40; // type:function size:0x8 -fn_801ADE48 = .text:0x801ADE48; // type:function size:0x8 -fn_801ADE50 = .text:0x801ADE50; // type:function size:0x8 -fn_801ADE58 = .text:0x801ADE58; // type:function size:0x8 -fn_801ADE60 = .text:0x801ADE60; // type:function size:0x8 -fn_801ADE68 = .text:0x801ADE68; // type:function size:0x8 +ExecCallbackC__13RPGrpModelG3DFPQ34nw4r4math5MTX34Q34nw4r3g3d6ResMdlPQ34nw4r3g3d16FuncObjCalcWorld = .text:0x801ACB40; // type:function size:0x70 +EditWorldMtx__19IRPGrpModelCallbackFP10RPGrpModel = .text:0x801ACBB0; // type:function size:0x4 +ExecCallbackB__13RPGrpModelG3DFPQ34nw4r3g3d13WorldMtxManipQ34nw4r3g3d6ResMdlPQ34nw4r3g3d16FuncObjCalcWorld = .text:0x801ACBB4; // type:function size:0x124 +EditJointWorldMtx__19IRPGrpModelCallbackFP10RPGrpModelUsPQ34nw4r4math5MTX34 = .text:0x801ACCD8; // type:function size:0x4 +ExecCallbackA__13RPGrpModelG3DFPQ34nw4r3g3d12ChrAnmResultQ34nw4r3g3d6ResMdlPQ34nw4r3g3d16FuncObjCalcWorld = .text:0x801ACCDC; // type:function size:0x104 +EditJointLocalMtx__19IRPGrpModelCallbackFP10RPGrpModelUsPQ34nw4r4math5MTX34PQ34nw4r4math4VEC3 = .text:0x801ACDE0; // type:function size:0x4 +ExecCallback_DRAW_XLU__13RPGrpModelG3DFQ44nw4r3g3d6ScnObj6TimingPQ34nw4r3g3d6ScnObjUlPv = .text:0x801ACDE4; // type:function size:0x8 +ExecCallback_DRAW_OPA__13RPGrpModelG3DFQ44nw4r3g3d6ScnObj6TimingPQ34nw4r3g3d6ScnObjUlPv = .text:0x801ACDEC; // type:function size:0x8 +ExecCallback_CALC_MAT__13RPGrpModelG3DFQ44nw4r3g3d6ScnObj6TimingPQ34nw4r3g3d6ScnObjUlPv = .text:0x801ACDF4; // type:function size:0x40 +ExecCallback_CALC_WORLD__13RPGrpModelG3DFQ44nw4r3g3d6ScnObj6TimingPQ34nw4r3g3d6ScnObjUlPv = .text:0x801ACE34; // type:function size:0x4 +IsJointVisible__13RPGrpModelG3DCFUl = .text:0x801ACE38; // type:function size:0xC4 +SetJointVisible__13RPGrpModelG3DFUlb = .text:0x801ACEFC; // type:function size:0xEC +CalcBeforeDraw__13RPGrpModelG3DFv = .text:0x801ACFE8; // type:function size:0xA8 +ReferViewMtx__19IRPGrpModelCallbackFP10RPGrpModel = .text:0x801AD090; // type:function size:0x4 +InternalCalc__13RPGrpModelG3DFv = .text:0x801AD094; // type:function size:0x134 +SetCallback__13RPGrpModelG3DFP19IRPGrpModelCallback = .text:0x801AD1C8; // type:function size:0xB4 +CreateAnm__13RPGrpModelG3DFv = .text:0x801AD27C; // type:function size:0x30 +Configure__13RPGrpModelG3DFv = .text:0x801AD2AC; // type:function size:0x148 +__ct__13RPGrpModelG3DFUsPCcUcUlUl = .text:0x801AD3F4; // type:function size:0xF8 +__ct__13RPGrpModelG3DFUsiUcUlUl = .text:0x801AD4EC; // type:function size:0xF8 +__ct__13RPGrpModelG3DFUsUcUlUl = .text:0x801AD5E4; // type:function size:0xE4 +Construct__25RPGrpModelAnmImplement<1>FP10RPGrpModel = .text:0x801AD6C8; // type:function size:0x68 +GetKind__13RPGrpModelG3DFv = .text:0x801AD730; // type:function size:0x8 +SetCallbackJointIndex__13RPGrpModelG3DFUs = .text:0x801AD738; // type:function size:0x3C +GetCallbackJointIndex__13RPGrpModelG3DCFv = .text:0x801AD774; // type:function size:0x3C +VF_0x8__13RPGrpModelG3DFv = .text:0x801AD7B0; // type:function size:0x4 +VF_0x10__13RPGrpModelG3DFv = .text:0x801AD7B4; // type:function size:0x4 +VF_0xC__13RPGrpModelG3DFv = .text:0x801AD7B8; // type:function size:0x4 +GetWorldMtx__13RPGrpModelG3DCFUsPQ34nw4r4math5MTX34 = .text:0x801AD7BC; // type:function size:0x44 +ReferWorldMtx__13RPGrpModelG3DCFUs = .text:0x801AD800; // type:function size:0x80 +GetWorldMtx__13RPGrpModelG3DCFUs = .text:0x801AD880; // type:function size:0xC0 +GetViewMtx__13RPGrpModelG3DCFUsPQ34nw4r4math5MTX34 = .text:0x801AD940; // type:function size:0x94 +GetViewMtx__13RPGrpModelG3DCFPQ34nw4r4math5MTX34 = .text:0x801AD9D4; // type:function size:0x40 +GetJointName__13RPGrpModelG3DCFUs = .text:0x801ADA14; // type:function size:0x78 +GetJointIndex__13RPGrpModelG3DCFPCc = .text:0x801ADA8C; // type:function size:0x78 +GetMaterialName__13RPGrpModelG3DCFUs = .text:0x801ADB04; // type:function size:0x78 +GetMaterialIndex__13RPGrpModelG3DCFPCc = .text:0x801ADB7C; // type:function size:0x68 +GetShapeName__13RPGrpModelG3DCFUs = .text:0x801ADBE4; // type:function size:0x78 +GetShapeIndex__13RPGrpModelG3DCFPCc = .text:0x801ADC5C; // type:function size:0x68 +SetShapeVisible__13RPGrpModelG3DFUlb = .text:0x801ADCC4; // type:function size:0x90 +IsShapeVisible__13RPGrpModelG3DCFUl = .text:0x801ADD54; // type:function size:0x70 +ExecCallback_CALC_VIEW__13RPGrpModelG3DFQ44nw4r3g3d6ScnObj6TimingPQ34nw4r3g3d6ScnObjUlPv = .text:0x801ADDC4; // type:function size:0x4 +__dt__13RPGrpModelG3DFv = .text:0x801ADDC8; // type:function size:0x58 +@72@ExecCallback_DRAW_XLU__13RPGrpModelG3DFQ44nw4r3g3d6ScnObj6TimingPQ34nw4r3g3d6ScnObjUlPv = .text:0x801ADE20; // type:function size:0x8 +@72@ExecCallback_DRAW_OPA__13RPGrpModelG3DFQ44nw4r3g3d6ScnObj6TimingPQ34nw4r3g3d6ScnObjUlPv = .text:0x801ADE28; // type:function size:0x8 +@72@ExecCallback_CALC_VIEW__13RPGrpModelG3DFQ44nw4r3g3d6ScnObj6TimingPQ34nw4r3g3d6ScnObjUlPv = .text:0x801ADE30; // type:function size:0x8 +@72@ExecCallback_CALC_MAT__13RPGrpModelG3DFQ44nw4r3g3d6ScnObj6TimingPQ34nw4r3g3d6ScnObjUlPv = .text:0x801ADE38; // type:function size:0x8 +@72@ExecCallback_CALC_WORLD__13RPGrpModelG3DFQ44nw4r3g3d6ScnObj6TimingPQ34nw4r3g3d6ScnObjUlPv = .text:0x801ADE40; // type:function size:0x8 +@72@__dt__13RPGrpModelG3DFv = .text:0x801ADE48; // type:function size:0x8 +@76@ExecCallbackC__13RPGrpModelG3DFPQ34nw4r4math5MTX34Q34nw4r3g3d6ResMdlPQ34nw4r3g3d16FuncObjCalcWorld = .text:0x801ADE50; // type:function size:0x8 +@76@ExecCallbackB__13RPGrpModelG3DFPQ34nw4r3g3d13WorldMtxManipQ34nw4r3g3d6ResMdlPQ34nw4r3g3d16FuncObjCalcWorld = .text:0x801ADE58; // type:function size:0x8 +@76@ExecCallbackA__13RPGrpModelG3DFPQ34nw4r3g3d12ChrAnmResultQ34nw4r3g3d6ResMdlPQ34nw4r3g3d16FuncObjCalcWorld = .text:0x801ADE60; // type:function size:0x8 +@76@__dt__13RPGrpModelG3DFv = .text:0x801ADE68; // type:function size:0x8 fn_801ADE70 = .text:0x801ADE70; // type:function size:0x10 fn_801ADE80 = .text:0x801ADE80; // type:function size:0x10 fn_801ADE90 = .text:0x801ADE90; // type:function size:0x10 @@ -7925,20 +7925,20 @@ fn_801AE344 = .text:0x801AE344; // type:function size:0x4 fn_801AE348 = .text:0x801AE348; // type:function size:0x4 fn_801AE34C = .text:0x801AE34C; // type:function size:0x8 fn_801AE354 = .text:0x801AE354; // type:function size:0x40 -fn_801AE394 = .text:0x801AE394; // type:function size:0xA8 -fn_801AE43C = .text:0x801AE43C; // type:function size:0xD0 -fn_801AE50C = .text:0x801AE50C; // type:function size:0x24C -fn_801AE758 = .text:0x801AE758; // type:function size:0x270 -fn_801AE9C8 = .text:0x801AE9C8; // type:function size:0x1D4 -fn_801AEB9C = .text:0x801AEB9C; // type:function size:0x1D4 -fn_801AED70 = .text:0x801AED70; // type:function size:0xA0 -fn_801AEE10 = .text:0x801AEE10; // type:function size:0x48 -fn_801AEE58 = .text:0x801AEE58; // type:function size:0xB0 +InternalGetResultTransform__20RPGrpModelResManagerFQ34nw4r3g3d9ResAnmChrUsfPQ23EGG9Matrix34fPQ23EGG8Vector3fPQ23EGG8Vector3fPQ23EGG8Vector3f = .text:0x801AE394; // type:function size:0xA8 +GetResultTransform__20RPGrpModelResManagerFUsUsfPQ23EGG9Matrix34fPQ23EGG8Vector3fPQ23EGG8Vector3fPQ23EGG8Vector3f = .text:0x801AE43C; // type:function size:0xD0 +HasFile__20RPGrpModelResManagerCFQ220RPGrpModelResManager4TypeUsPCc = .text:0x801AE50C; // type:function size:0x24C +InternalCreateData__20RPGrpModelResManagerFUsQ220RPGrpModelResManager4TypePvUl = .text:0x801AE758; // type:function size:0x270 +GetPtr__20RPGrpModelResManagerCFQ220RPGrpModelResManager4TypeUsi = .text:0x801AE9C8; // type:function size:0x1D4 +GetPtr__20RPGrpModelResManagerCFQ220RPGrpModelResManager4TypeUsPCc = .text:0x801AEB9C; // type:function size:0x1D4 +CreateData__20RPGrpModelResManagerFQ220RPGrpModelResManager4TypePvUl = .text:0x801AED70; // type:function size:0xA0 +SearchData__20RPGrpModelResManagerCFPv = .text:0x801AEE10; // type:function size:0x48 +TerminateAll__20RPGrpModelResManagerFv = .text:0x801AEE58; // type:function size:0xB0 Terminate__20RPGrpModelResManagerFUs = .text:0x801AEF08; // type:function size:0x84 -fn_801AEF8C = .text:0x801AEF8C; // type:function size:0x1E8 -fn_801AF174 = .text:0x801AF174; // type:function size:0x10 -fn_801AF184 = .text:0x801AF184; // type:function size:0x10 -fn_801AF194 = .text:0x801AF194; // type:function size:0x40 +CreateResourceList__20RPGrpModelResManagerFUs = .text:0x801AEF8C; // type:function size:0x1E8 +Configure__20RPGrpModelResManagerFv = .text:0x801AF174; // type:function size:0x10 +__ct__20RPGrpModelResManagerFv = .text:0x801AF184; // type:function size:0x10 +__dt__20RPGrpModelResManagerFv = .text:0x801AF194; // type:function size:0x40 fn_801AF1D4 = .text:0x801AF1D4; // type:function size:0x4 fn_801AF1D8 = .text:0x801AF1D8; // type:function size:0x230 fn_801AF408 = .text:0x801AF408; // type:function size:0x4 @@ -21857,12 +21857,12 @@ gap_11_804BF5BF_sbss = .sbss:0x804BF5BF; // type:object size:0x1 scope:global lbl_804BF5C0 = .sbss:0x804BF5C0; // type:object size:0x8 data:4byte lbl_804BF5C8 = .sbss:0x804BF5C8; // type:object size:0x8 data:byte spAllocator__10RPGrpModel = .sbss:0x804BF5D0; // type:object size:0x4 data:4byte -lbl_804BF5D4 = .sbss:0x804BF5D4; // type:object size:0x4 data:4byte -lbl_804BF5D8 = .sbss:0x804BF5D8; // type:object size:0x4 data:4byte -lbl_804BF5DC = .sbss:0x804BF5DC; // type:object size:0x4 data:4byte -lbl_804BF5E0 = .sbss:0x804BF5E0; // type:object size:0x4 data:4byte -lbl_804BF5E4 = .sbss:0x804BF5E4; // type:object size:0x4 data:4byte -lbl_804BF5E8 = .sbss:0x804BF5E8; // type:object size:0x8 data:4byte +spEntryHead__10RPGrpModel = .sbss:0x804BF5D4; // type:object size:0x4 data:4byte +spEntryTail__10RPGrpModel = .sbss:0x804BF5D8; // type:object size:0x4 data:4byte +spGenList__10RPGrpModel = .sbss:0x804BF5DC; // type:object size:0x4 data:4byte +spCalcModel__10RPGrpModel = .sbss:0x804BF5E0; // type:object size:0x4 data:4byte +spCalcWorldMtxArray__10RPGrpModel = .sbss:0x804BF5E4; // type:object size:0x4 data:4byte +spCalcViewMtxArray__10RPGrpModel = .sbss:0x804BF5E8; // type:object size:0x8 data:4byte lbl_804BF5F0 = .sbss:0x804BF5F0; // type:object size:0x8 data:byte lbl_804BF5F8 = .sbss:0x804BF5F8; // type:object size:0x8 data:4byte spCurrent__20RPGrpModelResManager = .sbss:0x804BF600; // type:object size:0x8 data:4byte diff --git a/configure.py b/configure.py index e5b4f445..de413985 100755 --- a/configure.py +++ b/configure.py @@ -1224,6 +1224,70 @@ def MatchingFor(*versions): Object(NonMatching, "Pack/RPAudio/RPSndStaticMgr.cpp"), ], }, + { + "lib": "RP", + "mw_version": config.linker_version, + "cflags": cflags_rp, + "progress_category": "utility", # str | List[str] + "objects": [ + Object(NonMatching, "Pack/RPUtility/RPUtlDohMath.cpp"), + Object(NonMatching, "Pack/RPUtility_unsplit.o"), + ], + }, + { + "lib": "RP", + "mw_version": config.linker_version, + "cflags": cflags_rp, + "progress_category": "sports", # str | List[str] + "objects": [ + Object(NonMatching, "Pack/RPSports/RPSportsCommon/RPSportsCommon_unsplit.o"), + ], + }, + { + "lib": "RP", + "mw_version": config.linker_version, + "cflags": cflags_rp, + "progress_category": "tennis", # str | List[str] + "objects": [ + Object(NonMatching, "Pack/RPSports/RPTnsScene/RPTnsScene_unsplit.o"), + ], + }, + { + "lib": "RP", + "mw_version": config.linker_version, + "cflags": cflags_rp, + "progress_category": "baseball", # str | List[str] + "objects": [ + Object(NonMatching, "Pack/RPSports/RPBsbScene/RPBsbScene_unsplit.o"), + ], + }, + { + "lib": "RP", + "mw_version": config.linker_version, + "cflags": cflags_rp, + "progress_category": "golf", # str | List[str] + "objects": [ + Object(NonMatching, "Pack/RPSports/RPGolScene/RPGolScene_unsplit.o"), + ], + }, + { + "lib": "RP", + "mw_version": config.linker_version, + "cflags": cflags_rp, + "progress_category": "boxing", # str | List[str] + "objects": [ + Object(NonMatching, "Pack/RPSports/RPBoxScene/RPBoxScene_unsplit.o"), + ], + }, + { + "lib": "RP", + "mw_version": config.linker_version, + "cflags": cflags_rp, + "progress_category": "bowling", # str | List[str] + "objects": [ + Object(NonMatching, "Pack/RPSports/RPBowScene/RPBowScene_unsplit.o"), + ], + }, ] @@ -1257,9 +1321,14 @@ def link_order_callback(module_id: int, objects: List[str]) -> List[str]: ProgressCategory("system", "RPSystem"), ProgressCategory("graphics", "RPGraphics"), ProgressCategory("audio", "RPAudio"), - # ProgressCategory("utility", "RPUtility"), + ProgressCategory("utility", "RPUtility"), - # ProgressCategory("sports", "RPSports"), + ProgressCategory("sports", "RPSportsCommon"), + ProgressCategory("tennis", "RPTnsScene"), + ProgressCategory("baseball", "RPBsbScene"), + ProgressCategory("golf", "RPGolScene"), + ProgressCategory("boxing", "RPBoxScene"), + ProgressCategory("bowling", "RPBowScene"), ] config.progress_all = False config.progress_each_module = args.verbose diff --git a/include/Pack/RPGraphics.h b/include/Pack/RPGraphics.h index b74cbc5f..254acbfa 100644 --- a/include/Pack/RPGraphics.h +++ b/include/Pack/RPGraphics.h @@ -1,9 +1,18 @@ #ifndef RP_PUBLIC_GRAPHICS_H #define RP_PUBLIC_GRAPHICS_H +#include #include +#include +#include +#include +#include +#include +#include #include +#include #include #include +#include #endif diff --git a/include/Pack/RPGraphics/IRPGrpModelCallback.h b/include/Pack/RPGraphics/IRPGrpModelCallback.h new file mode 100644 index 00000000..5383b57d --- /dev/null +++ b/include/Pack/RPGraphics/IRPGrpModelCallback.h @@ -0,0 +1,32 @@ +#ifndef RP_GRAPHICS_I_MODEL_CALLBACK_H +#define RP_GRAPHICS_I_MODEL_CALLBACK_H +#include + +#include + +//! @addtogroup rp_graphics +//! @{ + +// Forward declarations +class RPGrpModel; + +/** + * @brief Model callback interface + */ +class IRPGrpModelCallback { +public: + virtual ~IRPGrpModelCallback() = 0; // at 0x8 + + virtual void EditJointLocalMtx(RPGrpModel*, u16, nw4r::math::MTX34*, + nw4r::math::VEC3*) {} // at 0xC + + virtual void EditJointWorldMtx(RPGrpModel*, u16, nw4r::math::MTX34*) // + {} // at 0x10 + + virtual void EditWorldMtx(RPGrpModel*) {} // at 0x14 + virtual void ReferViewMtx(RPGrpModel*) {} // at 0x18 +}; + +//! @} + +#endif diff --git a/include/Pack/RPGraphics/RPGrpModel.h b/include/Pack/RPGraphics/RPGrpModel.h index 7a7b7548..b2bb37aa 100644 --- a/include/Pack/RPGraphics/RPGrpModel.h +++ b/include/Pack/RPGraphics/RPGrpModel.h @@ -2,14 +2,24 @@ #define RP_GRAPHICS_MODEL_H #include +#include + #include +#include + +#include +#include //! @addtogroup rp_graphics //! @{ // Forward declarations +class IRPGrpModelCallback; class RPGrpModelAnm; +class RPGrpModelBoundingInfo; class RPGrpModelMaterial; +class RPGrpModelRecord; +class RPGrpTexture; /** * @brief Base class for model implementations @@ -22,7 +32,24 @@ class RPGrpModel { enum Kind { Kind_None, //!< Dummy value Kind_G3D, //!< RPGrpModelG3D - Kind_Rfl, //!< RPGrpModelRfl + Kind_RFL, //!< RPGrpModelRfl + }; + + /** + * @brief Model creation type flags + */ + enum TypeOption { + TypeOption_NoSimple = 1 << 0, //!< Require ScnMdl even without buffers + }; + + /** + * @brief Bound creation type flags + */ + enum BoundOption { + BoundOption_Sphere = 1 << 0, + BoundOption_SphereSet = 1 << 1, + BoundOption_AABB = 1 << 2, + BoundOption_AABBSet = 1 << 3, }; protected: @@ -30,30 +57,159 @@ class RPGrpModel { u8 mDrawScene; // at 0x1 u8 mDrawGroup; // at 0x2 char unk3; - u16 mFlags; // at 0x4 - char unk6[0x2C - 0x6]; - RPGrpModelAnm* mpModelAnm; // at 0x2C - RPGrpModelMaterial** mppMaterials; // at 0x30 - char unk34[0x40 - 0x34]; - EGG::ModelEx* mpModelEx; // at 0x40 + char unk4; + char unk5[0x8 - 0x5]; + u16 mFlags; // at 0x8 + u16 unkA; + u32 unkC; + u32 unk10; + RPGrpModel* mpEntryNext; // at 0x14 + RPGrpModel* mpGenNext; // at 0x18 + IRPGrpModelCallback* mpCallback; // at 0x1C + nw4r::math::VEC3 mScale; // at 0x20 + RPGrpModelAnm* mpModelAnm; // at 0x2C + RPGrpModelMaterial** mppMaterials; // at 0x30 + RPGrpModelBoundingInfo* mpBoundingInfo; // at 0x34 + RPGrpModelRecord* mpRecord; // at 0x38 + BOOL mReverseCulling; // at 0x3C + EGG::ModelEx* mpModelEx; // at 0x40 public: - // TODO(kiwi) Probably in ghidra already - virtual UNKTYPE VF_0x8(UNKTYPE) = 0; // at 0x8 - virtual UNKTYPE VF_0xC(UNKTYPE) = 0; // at 0xC + static RPGrpModel* Construct(RPGrpHandle handle, u8 viewNo, u32 typeOption, + u32 bufferOption); + + static RPGrpModel* Construct(RPGrpHandle handle, int idx, u8 viewNo, + u32 typeOption, u32 bufferOption); + + static RPGrpModel* Construct(RPGrpHandle handle, const char* pName, + u8 viewNo, u32 typeOption, u32 bufferOption); + virtual UNKTYPE VF_0x8(UNKTYPE) = 0; // at 0x8 + virtual UNKTYPE VF_0xC(UNKTYPE) = 0; // at 0xC virtual UNKTYPE VF_0x10(UNKTYPE) = 0; // at 0x10 - virtual Kind GetKind() = 0; // at 0x14 - virtual UNKTYPE VF_0x18(UNKTYPE) = 0; // at 0x18 - virtual UNKTYPE VF_0x1C(UNKTYPE) = 0; // at 0x1C - virtual UNKTYPE VF_0x20(UNKTYPE) = 0; // at 0x20 - virtual UNKTYPE VF_0x24(UNKTYPE) = 0; // at 0x24 - virtual UNKTYPE VF_0x28(UNKTYPE) = 0; // at 0x28 - virtual void SetJointVisible(bool enable) = 0; // at 0x2C + virtual Kind GetKind() = 0; // at 0x14 + + virtual IRPGrpModelCallback* + SetCallback(IRPGrpModelCallback* pCallback); // at 0x18 + + virtual void SetReverseCulling(bool reverse); // at 0x1C + + virtual u16 ReplaceTexture(const char* pName, const RPGrpTexture& rTexture, + bool keepFilterWrap); // at 0x20 + + virtual void SetCallbackJointIndex(u16 idx) = 0; // at 0x24 + virtual u16 GetCallbackJointIndex() const = 0; // at 0x28 + + virtual void SetJointVisible(u32 /* idx */, bool enable) { // at 0x2C + if (enable) { + mFlags |= EFlag_Visible; + } else { + mFlags &= ~EFlag_Visible; + } + } + + virtual bool IsJointVisible(u32 /* idx */) const { // at 0x30 + return mFlags & EFlag_Visible; + } + + virtual void SetShapeVisible(u32 /* idx */, bool enable) { // at 0x34 + if (enable) { + mFlags |= EFlag_Visible; + } else { + mFlags &= ~EFlag_Visible; + } + } + + virtual bool IsShapeVisible(u32 /* idx */) const { // at 0x38 + return mFlags & EFlag_Visible; + } + + virtual void GetWorldMtx(u16 idx, + nw4r::math::MTX34* pMtx) const = 0; // at 0x3C + virtual const nw4r::math::MTX34* + GetWorldMtx(u16 nodeIdx) const = 0; // at 0x40 + virtual nw4r::math::MTX34* ReferWorldMtx(u16 nodeIdx) const = 0; // at 0x44 + + virtual void GetViewMtx(u16 idx, + nw4r::math::MTX34* pMtx) const = 0; // at 0x48 + virtual void GetViewMtx(nw4r::math::MTX34* pMtx) const = 0; // at 0x4C + + virtual u16 GetJointNum() const { // at 0x50 + return mpModelEx->getNumNode(); + } + + virtual const char* GetJointName(u16 idx) const = 0; // at 0x54 + virtual u16 GetJointIndex(const char* pName) const = 0; // at 0x58 + + virtual u16 GetMaterialNum() const; // at 0x5C + virtual const char* GetMaterialName(u16 idx) const = 0; // at 0x60 + virtual u16 GetMaterialIndex(const char* pName) const = 0; // at 0x64 + + virtual u16 GetShapeNum() const { // at 0x68 + return mpModelEx->getNumShape(); + } + + virtual const char* GetShapeName(u16 idx) const = 0; // at 0x6C + virtual u16 GetShapeIndex(const char* pName) const = 0; // at 0x70 + + virtual u16 GetViewMtxNum() const { // at 0x74 + return mpModelEx->getNumViewMtx(); + } + + virtual void DrawDirect(u32 drawFlag, + nw4r::math::MTX34* pViewMtx) { // at 0x78 + mpModelEx->drawShapeDirectly(drawFlag, true, true, pViewMtx); + } + + virtual void CalcMaterial(); // at 0x7C + + virtual void CalcBeforeDraw() { // at 0x80 + mpModelEx->setVisible(mFlags & EFlag_Visible); + } + + virtual void CalcView(const nw4r::math::MTX34& rViewMtx, + nw4r::math::MTX34* pViewMtxArray) { // at 0x84 + + if (pViewMtxArray != NULL) { + mpModelEx->calcView(rViewMtx, pViewMtxArray); + return; + } + + nw4r::g3d::ScnObj* pScnObj = GetScnObj(); + if (pScnObj != NULL) { + pScnObj->G3dProc(nw4r::g3d::G3dObj::G3DPROC_CALC_VIEW, 0, + const_cast(&rViewMtx)); + } + } + + void RemoveGenList(); + void CreateMaterial(u16 idx); + void CreateBoundingInfo(u32 flags); + void CreateRecord(u16 frames); + void UpdateFrame(); + void Calc(); + void Entry(); - virtual UNKTYPE VF_0x30(UNKTYPE) = 0; // at 0x30 - virtual void SetShapeVisible(bool enable) = 0; // at 0x34 + nw4r::g3d::ScnObj* GetScnObj() const { + return mpModelEx->getScnObj(); + } + + nw4r::g3d::ScnLeaf* GetScnLeaf() const { + return mpModelEx->getScnLeaf(); + } + + nw4r::g3d::ScnMdlSimple* GetScnMdlSimple() const { + return mpModelEx->getScnMdlSimple(); + } + + nw4r::g3d::ScnMdl* GetScnMdl() const { + return mpModelEx->getScnMdl(); + } + + nw4r::g3d::ScnRfl* GetScnRfl() const { + return mpModelEx->getScnRfl(); + } /** * @brief Gets the allocator used for model-related allocations @@ -70,14 +226,43 @@ class RPGrpModel { spAllocator = pAllocator; } - /** - * @brief Removes this model from the global list - */ - void RemoveGenList(); +protected: + RPGrpModel(u8 viewNo); + virtual ~RPGrpModel(); // at 0x88 + + virtual void Configure(); // at 0x8C + virtual void CreateAnm() = 0; // at 0x90 + virtual void InternalCalc() = 0; // at 0x94 + + virtual void GetShapeMinMax(u16 shapeIdx, nw4r::math::VEC3* pMin, + nw4r::math::VEC3* pMax) const { // at 0x98 + mpModelEx->getShapeMinMax(shapeIdx, pMin, pMax, false); + } -private: +protected: + enum { + EFlag_Visible = 1 << 0, + EFlag_Entered = 1 << 1, + EFlag_HasRecord = 1 << 2, + }; + +protected: //! Allocator used for model-related allocations static EGG::Allocator* spAllocator; + + //! First model in the draw ("entry") list + static RPGrpModel* spEntryHead; + //! Last model in the draw ("entry") list + static RPGrpModel* spEntryTail; + + //! List of all active models in generation order + static RPGrpModel* spGenList; + + //! Model currently running Calc + static RPGrpModel* spCalcModel; + + static nw4r::math::MTX34* spCalcWorldMtxArray; + static nw4r::math::MTX34* spCalcViewMtxArray; }; //! @} diff --git a/include/Pack/RPGraphics/RPGrpModelAnm.h b/include/Pack/RPGraphics/RPGrpModelAnm.h new file mode 100644 index 00000000..8157ec07 --- /dev/null +++ b/include/Pack/RPGraphics/RPGrpModelAnm.h @@ -0,0 +1,95 @@ +#ifndef RP_GRAPHICS_MODEL_ANM_H +#define RP_GRAPHICS_MODEL_ANM_H +#include + +#include + +//! @addtogroup rp_graphics +//! @{ + +// Forward declarations +class RPGrpModel; + +/** + * @brief Base class for model animation implementations + */ +class RPGrpModelAnm { +public: + enum Anm { + Anm_ResAnmChr, + Anm_ResAnmClr, + Anm_ResAnmTexPat, + Anm_ResAnmTexSrt, + Anm_4, + Anm_ResAnmShp, + Anm_6, + Anm_7, + }; + + enum AnmPlayPolicy { + AnmPlayPolicy_OneTime, + AnmPlayPolicy_Loop, + }; + +protected: + char _00[0x68]; + +public: + virtual void Configure() = 0; // at 0x8 + virtual void Construct(Anm anm, u16 idx, u16 rd) = 0; + + virtual void Regist(Anm anm, u16 idx, u16 rd, char const* pName, + u32 arg4 = 0) = 0; // at 0x10 + virtual void VF_0x14(UNKTYPE) = 0; + virtual void VF_0x18(UNKTYPE) = 0; + virtual void VF_0x1C(UNKTYPE) = 0; + + virtual void VF_0x20(UNKTYPE) = 0; + virtual void VF_0x24(UNKTYPE) = 0; + virtual void VF_0x28(UNKTYPE) = 0; + virtual void VF_0x2C(UNKTYPE) = 0; + + virtual void VF_0x30(UNKTYPE) = 0; + virtual void VF_0x34(UNKTYPE) = 0; + virtual void VF_0x38(UNKTYPE) = 0; + + virtual void Cancel(Anm anm, u16 idx) = 0; + virtual void Start(Anm anm, u16 idx, f32 frame = 1.0f) = 0; // at 0x40 + + virtual f32 VF_0x44(UNKTYPE) = 0; + virtual f32 VF_0x48(UNKTYPE) = 0; + + virtual u16 GetNumFrame(Anm anm, u16 idx) const = 0; // at 0x4C + virtual AnmPlayPolicy GetAnmPlayPolicy(Anm anm, + u16 idx) const = 0; // at 0x50 + + virtual void SetFrame(Anm anm, u16 idx, f32 frame) = 0; // at 0x54 + virtual f32 GetFrame(Anm anm, u16 idx) const = 0; // at 0x58 + + virtual void SetUpdateRate(Anm anm, u16 idx, f32 rate) = 0; // at 0x5C + virtual f32 GetUpdateRate(Anm anm, u16 idx) const = 0; // at 0x60 + + virtual void SetEnableQuaternionBlend(bool enable) = 0; // at 0x64 + + virtual void VF_0x68(UNKTYPE) = 0; // at 0x68 + virtual void UpdateFrame() = 0; // at 0x6C + virtual void VF_0x70(UNKTYPE) = 0; // at 0x70 + virtual void VF_0x74(UNKTYPE) = 0; // at 0x74 + + virtual nw4r::g3d::AnmObj* GetAnmObj(Anm anm, u16 idx) const = 0; // at 0x78 + + void CreateBuffer(Anm anm, u16 num); + + void Calc(); + +protected: + RPGrpModelAnm(RPGrpModel* pModel); + virtual ~RPGrpModelAnm(); // at 0x7C + + virtual void SetAnmObj(Anm anm, nw4r::g3d::AnmObj* pAnmObj) = 0; // at 0x80 + virtual void InternalCalc() = 0; // at 0x84 +}; + +//! @} + +#endif diff --git a/include/Pack/RPGraphics/RPGrpModelAnmImplement.h b/include/Pack/RPGraphics/RPGrpModelAnmImplement.h new file mode 100644 index 00000000..249e29cb --- /dev/null +++ b/include/Pack/RPGraphics/RPGrpModelAnmImplement.h @@ -0,0 +1,89 @@ +#ifndef RP_GRAPHICS_MODEL_ANM_IMPLEMENT_H +#define RP_GRAPHICS_MODEL_ANM_IMPLEMENT_H +#include + +#include +#include + +//! @addtogroup rp_graphics +//! @{ + +// Forward declarations +class RPGrpModel; + +/** + * @brief Model animation implementation + */ +template +class RPGrpModelAnmImplement : public RPGrpModelAnm { +protected: + char _6C[0xE8 - 0x6C]; + +public: + static RPGrpModelAnm* Construct(RPGrpModel* pModel) DECOMP_DONT_INLINE { + RPGrpModelAnm* pAnm = new RPGrpModelAnmImplement(pModel); + pAnm->Configure(); + return pAnm; + } + + virtual void Configure(); // at 0x8 + virtual void Construct(Anm anm, u16 idx, u16 rd); + + virtual void Regist(Anm anm, u16 idx, u16 rd, char const* pName, + u32 arg4); // at 0x10 + virtual void VF_0x14(UNKTYPE); + virtual void VF_0x18(UNKTYPE); + virtual void VF_0x1C(UNKTYPE); + + virtual void VF_0x20(UNKTYPE); + virtual void VF_0x24(UNKTYPE); + virtual void VF_0x28(UNKTYPE); + virtual void VF_0x2C(UNKTYPE); + + virtual void VF_0x30(UNKTYPE); + virtual void VF_0x34(UNKTYPE); + virtual void VF_0x38(UNKTYPE); + + virtual void Cancel(Anm anm, u16 idx); + virtual void Start(Anm anm, u16 idx, f32 frame = 1.0f); // at 0x40 + + virtual f32 VF_0x44(UNKTYPE); + virtual f32 VF_0x48(UNKTYPE); + + virtual u16 GetNumFrame(Anm anm, u16 idx) const; // at 0x4C + virtual AnmPlayPolicy GetAnmPlayPolicy(Anm anm, + u16 idx) const; // at 0x50 + + virtual void SetFrame(Anm anm, u16 idx, f32 frame); // at 0x54 + virtual f32 GetFrame(Anm anm, u16 idx) const; // at 0x58 + + virtual void SetUpdateRate(Anm anm, u16 idx, f32 rate); // at 0x5C + virtual f32 GetUpdateRate(Anm anm, u16 idx) const; // at 0x60 + + virtual void SetEnableQuaternionBlend(bool enable); // at 0x64 + + virtual void VF_0x68(UNKTYPE); // at 0x68 + virtual void UpdateFrame(); // at 0x6C + virtual void VF_0x70(UNKTYPE); // at 0x70 + virtual void VF_0x74(UNKTYPE); // at 0x74 + + virtual nw4r::g3d::AnmObj* GetAnmObj(Anm anm, u16 idx) const; // at 0x78 + + void CreateBuffer(Anm anm, u16 num); + + void Calc(); + +private: + RPGrpModelAnmImplement(RPGrpModel* pModel); + virtual ~RPGrpModelAnmImplement() {} // at 0x7C + + virtual void SetAnmObj(Anm anm, nw4r::g3d::AnmObj* pAnmObj); // at 0x80 + virtual void InternalCalc(); // at 0x84 +}; + +// Shorthand names for specializations +typedef RPGrpModelAnmImplement RPGrpModelAnmG3D; + +//! @} + +#endif diff --git a/include/Pack/RPGraphics/RPGrpModelBoundingInfo.h b/include/Pack/RPGraphics/RPGrpModelBoundingInfo.h new file mode 100644 index 00000000..a64ff0fa --- /dev/null +++ b/include/Pack/RPGraphics/RPGrpModelBoundingInfo.h @@ -0,0 +1,34 @@ +#ifndef RP_GRAPHICS_MODEL_BOUNDING_INFO_H +#define RP_GRAPHICS_MODEL_BOUNDING_INFO_H +#include + +#include + +//! @addtogroup rp_graphics +//! @{ + +// Forward declarations +class RPGrpModel; + +/** + * @brief AABB and spherical model bounds + */ +class RPGrpModelBoundingInfo : public EGG::ModelBoundingInfo { +public: + /** + * @brief Constructor + * + * @param flags Bound type flags + * @param pModel Owner model + */ + RPGrpModelBoundingInfo(u32 flags, RPGrpModel* pModel); + + /** + * @brief Destructor + */ + virtual ~RPGrpModelBoundingInfo() {} // at 0x8 +}; + +//! @} + +#endif diff --git a/include/Pack/RPGraphics/RPGrpModelG3D.h b/include/Pack/RPGraphics/RPGrpModelG3D.h new file mode 100644 index 00000000..aa2febc9 --- /dev/null +++ b/include/Pack/RPGraphics/RPGrpModelG3D.h @@ -0,0 +1,159 @@ +#ifndef RP_GRAPHICS_MODEL_G3D_H +#define RP_GRAPHICS_MODEL_G3D_H +#include + +#include + +#include +#include + +//! @addtogroup rp_graphics +//! @{ + +/** + * @brief Model implementation for nw4r::g3d + */ +class RPGrpModelG3D : public RPGrpModel, + public nw4r::g3d::IScnObjCallback, + public nw4r::g3d::ICalcWorldCallback { +public: + RPGrpModelG3D(RPGrpHandle handle, u8 viewNo, u32 typeOption, + u32 bufferOption); + + RPGrpModelG3D(RPGrpHandle handle, int idx, u8 viewNo, u32 typeOption, + u32 bufferOption); + + RPGrpModelG3D(RPGrpHandle handle, const char* pName, u8 viewNo, + u32 typeOption, u32 bufferOption); + + virtual ~RPGrpModelG3D() override {} // at 0x88 + + virtual UNKTYPE VF_0x8(UNKTYPE) override {} // at 0x8 + virtual UNKTYPE VF_0x10(UNKTYPE) override {} // at 0x10 + virtual UNKTYPE VF_0xC(UNKTYPE) override {} // at 0xC + + virtual Kind GetKind() override { // at 0x14 + return Kind_G3D; + } + + virtual IRPGrpModelCallback* + SetCallback(IRPGrpModelCallback* pCallback) override; // at 0x18 + + virtual void SetCallbackJointIndex(u16 idx) override { // at 0x24 + GetScnMdlSimple()->SetScnMdlCallbackNodeID(idx); + } + + virtual u16 GetCallbackJointIndex() const override { // at 0x28 + return GetScnMdlSimple()->GetScnMdlCallbackNodeID(); + } + + virtual void SetJointVisible(u32 idx, bool enable) override; // at 0x2C + virtual bool IsJointVisible(u32 idx) const override; // at 0x30 + + virtual void + GetWorldMtx(u16 idx, + nw4r::math::MTX34* pMtx) const override { // at 0x3C + + GetScnMdlSimple()->GetScnMtxPos(pMtx, nw4r::g3d::ScnObj::MTX_WORLD, + idx); + } + + virtual const nw4r::math::MTX34* + GetWorldMtx(u16 nodeIdx) const override { // at 0x40 + u32 idx = GetScnMdlSimple()->GetResMdl().GetResNode(nodeIdx).GetMtxID(); + return &GetScnMdlSimple()->GetWldMtxArray()[idx]; + } + + virtual nw4r::math::MTX34* + ReferWorldMtx(u16 nodeIdx) const override { // at 0x44 + u32 idx = GetScnMdlSimple()->GetResMdl().GetResNode(nodeIdx).GetMtxID(); + return &spCalcWorldMtxArray[idx]; + } + + virtual void GetViewMtx(nw4r::math::MTX34* pMtx) const override { // at 0x4C + GetScnMdlSimple()->GetMtx(nw4r::g3d::ScnObj::MTX_VIEW, pMtx); + } + + virtual void GetViewMtx(u16 nodeIdx, + nw4r::math::MTX34* pMtx) const override { // at 0x48 + u32 idx = GetScnMdlSimple()->GetResMdl().GetResNode(nodeIdx).GetMtxID(); + nw4r::math::MTX34Copy(pMtx, &spCalcViewMtxArray[idx]); + } + + virtual const char* GetJointName(u16 idx) const override { // at 0x54 + return GetScnMdlSimple()->GetResMdl().GetResNode(idx).GetName(); + } + virtual u16 GetJointIndex(const char* pName) const override { // at 0x58 + return GetScnMdlSimple()->GetResMdl().GetResNode(pName).GetID(); + } + + virtual const char* GetMaterialName(u16 idx) const override { // at 0x60 + return GetScnMdlSimple()->GetResMdl().GetResMat(idx).GetName(); + } + virtual u16 GetMaterialIndex(const char* pName) const override { // at 0x64 + return GetScnMdlSimple()->GetResMdl().GetResMat(pName).GetID(); + } + + virtual const char* GetShapeName(u16 idx) const override { // at 0x6C + return GetScnMdlSimple()->GetResMdl().GetResShp(idx).GetName(); + } + virtual u16 GetShapeIndex(const char* pName) const override { // at 0x70 + return GetScnMdlSimple()->GetResMdl().GetResShp(pName).GetID(); + } + + virtual void SetShapeVisible(u32 idx, bool enable) override { // at 0x34 + GetScnMdlSimple()->GetResMdl().GetResShp(idx).SetVisible(enable); + } + + virtual bool IsShapeVisible(u32 idx) const override { // at 0x38 + return GetScnMdlSimple()->GetResMdl().GetResShp(idx).IsVisible(); + } + + virtual void CalcBeforeDraw() override; // at 0x80 + + virtual void Configure() override; // at 0x8C + virtual void CreateAnm() override; // at 0x90 + virtual void InternalCalc() override; // at 0x94 + + virtual void ExecCallback_CALC_WORLD(nw4r::g3d::ScnObj::Timing timing, + nw4r::g3d::ScnObj* pObj, u32 param, + void* pInfo) override; // at 0xC + + virtual void ExecCallback_CALC_MAT(nw4r::g3d::ScnObj::Timing timing, + nw4r::g3d::ScnObj* pObj, u32 param, + void* pInfo) override; // at 0x10 + + virtual void ExecCallback_CALC_VIEW(nw4r::g3d::ScnObj::Timing /* timing */, + nw4r::g3d::ScnObj* /* pObj */, + u32 /* param */, + void* /* pInfo */) override { // at 0x14 + } + + virtual void ExecCallback_DRAW_OPA(nw4r::g3d::ScnObj::Timing timing, + nw4r::g3d::ScnObj* pObj, u32 param, + void* pInfo) override; // at 0x18 + + virtual void ExecCallback_DRAW_XLU(nw4r::g3d::ScnObj::Timing timing, + nw4r::g3d::ScnObj* pObj, u32 param, + void* pInfo) override; // at 0x1C + + virtual void + ExecCallbackA(nw4r::g3d::ChrAnmResult* pResult, nw4r::g3d::ResMdl mdl, + nw4r::g3d::FuncObjCalcWorld* pFuncObj) override; // at 0xC + + virtual void + ExecCallbackB(nw4r::g3d::WorldMtxManip* pManip, nw4r::g3d::ResMdl mdl, + nw4r::g3d::FuncObjCalcWorld* pFuncObj) override; // at 0x10 + + virtual void + ExecCallbackC(nw4r::math::MTX34* pMtxArray, nw4r::g3d::ResMdl mdl, + nw4r::g3d::FuncObjCalcWorld* pFuncObj) override; // at 0x14 + +private: + static s8 sJointWorldMtxInitialized; + static nw4r::math::MTX34 sJointWorldMtx; +}; + +//! @} + +#endif diff --git a/include/Pack/RPGraphics/RPGrpModelMaterial.h b/include/Pack/RPGraphics/RPGrpModelMaterial.h new file mode 100644 index 00000000..93e895f6 --- /dev/null +++ b/include/Pack/RPGraphics/RPGrpModelMaterial.h @@ -0,0 +1,60 @@ +#ifndef RP_GRAPHICS_MODEL_MATERIAL_H +#define RP_GRAPHICS_MODEL_MATERIAL_H +#include + +#include + +#include + +//! @addtogroup rp_graphics +//! @{ + +// Forward declarations +class RPGrpModel; + +/** + * @brief Model material setting + */ +class RPGrpModelMaterial { +public: + enum ESyncFlag { + ESyncFlag_ResGenMode = 1 << 0, + }; + +private: + u32 mSyncFlags; // at 0x0 + char unkB[0xB - 0x4]; + u8 mCullMode; // at 0xB + char _0C[0x20 - 0xC]; + GXColor mTevKColors[GX_MAX_KCOLOR]; // at 0x20 + GXColorS10 mTevColors[GX_MAX_TEVREG - GX_TEVREG0]; // at 0x30 + char unk48[0xD0 - 0x48]; + +public: + RPGrpModelMaterial(RPGrpModel* pModel, u16 idx); + virtual ~RPGrpModelMaterial(); // at 0x8 + + void Calc(); + + void SetSyncFlags(u32 flags) { + mSyncFlags |= flags; + } + + u8 GetCullMode() const { + return mCullMode; + } + void SetCullMode(GXCullMode cullMode) { + mCullMode = cullMode; + } + + void SetTevKColor(GXTevKColorID id, GXColor color) { + mTevKColors[id] = color; + } + void SetTevColor(GXTevRegID id, GXColorS10 color) { + mTevColors[id - GX_TEVREG0] = color; + } +}; + +//! @} + +#endif diff --git a/include/Pack/RPGraphics/RPGrpModelRecord.h b/include/Pack/RPGraphics/RPGrpModelRecord.h new file mode 100644 index 00000000..7c530812 --- /dev/null +++ b/include/Pack/RPGraphics/RPGrpModelRecord.h @@ -0,0 +1,47 @@ +#ifndef RP_GRAPHICS_MODEL_RECORD_H +#define RP_GRAPHICS_MODEL_RECORD_H +#include + +//! @addtogroup rp_graphics +//! @{ + +// Forward declarations +class RPGrpModel; + +/** + * @brief Model transformation recorder + */ +class RPGrpModelRecord { +public: + /** + * @brief Constructor + * + * @param flags Bound type flags + * @param pModel Owner model + */ + RPGrpModelRecord(u16 frames, RPGrpModel* pModel); + + /** + * @brief Destructor + */ + virtual ~RPGrpModelRecord() {} // at 0x8 + + /** + * @brief Clears the recorded data + */ + void Clear(); + + /** + * @brief Records the current frame + * + * @param pModel Model to record + */ + void Calc(RPGrpModel* pModel); + +private: + char unk4[0x48 - 0x4]; +}; + +//! @} + +#endif diff --git a/include/Pack/RPGraphics/RPGrpModelResManager.h b/include/Pack/RPGraphics/RPGrpModelResManager.h index fff3b6a2..a5ad62eb 100644 --- a/include/Pack/RPGraphics/RPGrpModelResManager.h +++ b/include/Pack/RPGraphics/RPGrpModelResManager.h @@ -2,13 +2,60 @@ #define RP_GRAPHICS_MODEL_RES_MANAGER_H #include +#include + +#include + //! @addtogroup rp_graphics //! @{ +//! Resource file handle +typedef u16 RPGrpHandle; + /** * @brief Model resource manager */ class RPGrpModelResManager { + //! Only the model manager can change the current instance + friend class RPGrpModelManager; + +public: + /** + * @brief Resource file type + */ + enum Type { + Type_None = 0, + Type_1, + + Type_Unknown = 11, + + Type_ResFile, + Type_ResMdl, + Type_ResPltt, + Type_ResTex, + Type_ResAnmChr, + Type_ResAnmVis, + Type_ResAnmClr, + Type_ResAnmTexPat, + Type_ResAnmTexSrt, + Type_ResAnmShp, + Type_ResAnmScn, + + Type_Max + }; + +private: + // Forward declarations + struct Resource; + template struct Int2Type; + template > struct ResType; + +private: + //! Resource file list + Resource* mpResList; // at 0x0 + //! Capacity of the resource list + u16 mResNum; // at 0x4 + public: /** * @brief Gets the currently active manager instance @@ -18,17 +65,421 @@ class RPGrpModelResManager { } /** - * @brief Releases the specified resource file + * @brief Initializes the manager state + */ + void Configure(); + + /** + * @brief Allocates memory to hold the specified amount of resources + * + * @param num Resource list capacity + */ + void CreateResourceList(u16 num); + + /** + * @brief Releases the specified resource + * + * @param handle Resource handle + */ + void Terminate(RPGrpHandle handle); + + /** + * @brief Releases all resources + */ + void TerminateAll(); + + /** + * @brief Searches the resource list for the specified data + * + * @param pBinary Binary resource data + * @return Resource handle, or -1 if not found + */ + int SearchData(void* pBinary) const; + + /** + * @brief Attempts to create a new resource from the specified data + * @details If the resource already exists, this function returns the + * existing handle. + * + * @param type Resource type + * @param pBinary Binary resource data + * @param arg2 + * @return New resource handle + */ + RPGrpHandle CreateData(Type type, void* pBinary, u32 arg2 = 0); + + /** + * @brief Gets the raw data of the specified resource subfile + * + * @param type Subfile type + * @param handle File resource handle + * @param pName Subfile name + */ + void* GetPtr(Type type, RPGrpHandle handle, const char* pName) const; + + /** + * @brief Gets the raw data of the specified resource subfile + * + * @param type Subfile type + * @param handle File resource handle + * @param index Subfile index + */ + void* GetPtr(Type type, RPGrpHandle handle, int index) const; + + /** + * @brief Tests whether the specified resource subfile exists + * + * @param type Subfile type + * @param handle File resource handle + * @param pName Subfile name + */ + bool HasFile(Type type, RPGrpHandle handle, const char* pName) const; + + /** + * @brief Gets an animation's transform result at the specified frame + * + * @param handle Animation resource handle + * @param idx Animation node index + * @param frame Animation frame + * @param[out] pRotTrans Transformation matrix + * @param[out] pTrans X/Y/Z translation + * @param[out] pRotate X/Y/Z rotation (in degrees) + * @param[out] pScale X/Y/Z scale + */ + void GetResultTransform(RPGrpHandle handle, u16 idx, f32 frame, + EGG::Matrix34f* pRotTrans, EGG::Vector3f* pTrans, + EGG::Vector3f* pRotate, EGG::Vector3f* pScale); + + /** + * @brief Gets an animation's transform result at the specified frame + * + * @param handle Animation resource handle + * @param pName Animation node name + * @param frame Animation frame + * @param[out] pRotTrans Transformation matrix + * @param[out] pTrans X/Y/Z translation + * @param[out] pRotate X/Y/Z rotation (in degrees) + * @param[out] pScale X/Y/Z scale + */ + inline void GetResultTransform(RPGrpHandle handle, const char* pName, + u16 idx, f32 frame, + EGG::Matrix34f* pRotTrans, + EGG::Vector3f* pTrans, + EGG::Vector3f* pRotate, + EGG::Vector3f* pScale); + + /** + * @brief Gets the type of the resource acquired through the handle + * + * @param handle Resource handle + */ + Type GetType(RPGrpHandle handle) const { + return mpResList[handle].type; + } + + /** + * @brief Gets the specified NW4R resource using the file handle + * @details This function accesses the resource at index zero. + * + * @tparam E Resource type + * @param handle File resource handle + */ + template // + inline typename ResType >::TRes // + GetData(RPGrpHandle handle) const; + + /** + * @brief Gets the specified NW4R resource using the file handle + * @details This function accesses the resource at the specified index. + * + * @tparam E Resource type + * @param handle File resource handle + * @param idx Resource index + */ + template // + inline typename ResType >::TRes // + GetData(RPGrpHandle handle, int idx) const; + + /** + * @brief Gets the specified NW4R resource using the file handle + * @details This function accesses the resource with the specified name. + * + * @tparam E Resource type + * @param handle File resource handle + * @param pName Resource name + */ + template // + inline typename ResType >::TRes // + GetData(RPGrpHandle handle, const char* pName) const; + + /** + * @brief Gets the specified NW4R resource using the file handle + * @details This function accesses the resource at index zero. + * + * @tparam E Resource type + * @param handle File resource handle + */ + template // + inline bool HasFile(RPGrpHandle handle) const { + return GetData(handle).IsValid(); + } + + /** + * @brief Gets the specified NW4R resource using the file handle + * @details This function accesses the resource at the specified index. + * + * @tparam E Resource type + * @param handle File resource handle + * @param idx Resource index + */ + template // + inline bool HasFile(RPGrpHandle handle, int idx) const { + return GetData(handle, idx).IsValid(); + } + + /** + * @brief Gets the specified NW4R resource using the file handle + * @details This function accesses the resource with the specified name. + * + * @tparam E Resource type + * @param handle File resource handle + * @param pName Resource name + */ + template // + inline bool HasFile(RPGrpHandle handle, const char* pName) const { + return GetData(handle, pName).IsValid(); + } + +private: + /** + * @brief Generic resource type + */ + struct Resource { + //! File type + Type type; // at 0x0 + //! Raw file data + void* pBinary; // at 0x4 + + //! Resource accessors + union { + ResType* pResFile; + ResType* pResMdl; + ResType* pResPltt; + ResType* pResTex; + ResType* pResAnmChr; + ResType* pResAnmVis; + ResType* pResAnmClr; + ResType* pResAnmTexPat; + ResType* pResAnmTexSrt; + ResType* pResAnmShp; + ResType* pResAnmScn; + ResType* pResUnknown; + }; // at 0x8 + + u32 unkC; + + /** + * @brief Clears the data of this resource + */ + void Reset() { + pBinary = NULL; + pResUnknown = NULL; + type = Type_None; + unkC = 0; + } + }; + +private: + /** + * @brief Constructor + */ + RPGrpModelResManager(); + + /** + * @brief Destructor + */ + virtual ~RPGrpModelResManager() {} // at 0x8 + + /** + * @brief Creates a new resource from the specified data + * + * @param handle Handle for the new resource + * @param type Resource type + * @param pBinary Binary resource data + * @param arg3 + */ + void InternalCreateData(RPGrpHandle handle, Type type, void* pBinary, + u32 arg3 = 0); + + /** + * @brief Gets an animation's transform result at the specified frame * - * @param rd Resource file descriptor + * @param chr Animation resource + * @param idx Animation node index + * @param frame Animation frame + * @param[out] pRotTrans Transformation matrix + * @param[out] pTrans X/Y/Z translation + * @param[out] pRotate X/Y/Z rotation (in degrees) + * @param[out] pScale X/Y/Z scale */ - void Terminate(u16 rd); + static void InternalGetResultTransform(const nw4r::g3d::ResAnmChr chr, + u16 idx, f32 frame, + EGG::Matrix34f* pRotTrans, + EGG::Vector3f* pTrans, + EGG::Vector3f* pRotate, + EGG::Vector3f* pScale); private: //! Allocator used for model-related allocations static RPGrpModelResManager* spCurrent; }; +/****************************************************************************** + * + * ResType specializations + * + ******************************************************************************/ + +template +struct RPGrpModelResManager::ResType { + typedef typename TInt2Type::TRes TRes; + typedef typename TInt2Type::TResData TResData; + + //! Raw resource data (like ResCommon) + TResData* pResData; // at 0x0 + + ResType() : pResData(NULL) {} + ResType(void* pResData_) : pResData(static_cast(pResData_)) {} + + TRes Get() const { + return TRes(pResData); + } +}; + +template <> +struct RPGrpModelResManager::ResType { + void* pResData; // at 0x0 +}; + +template <> +struct RPGrpModelResManager::ResType { + void* pResData; // at 0x0 +}; + +/****************************************************************************** + * + * Int2Type specializations + * + ******************************************************************************/ + +#define SUBFILE_NAME_LIST \ + X(ResMdl) \ + X(ResPltt) \ + X(ResTex) \ + X(ResAnmChr) \ + X(ResAnmVis) \ + X(ResAnmClr) \ + X(ResAnmTexPat) \ + X(ResAnmTexSrt) \ + X(ResAnmShp) \ + X(ResAnmScn) + +#define ALL_NAME_LIST \ + X(ResFile) \ + SUBFILE_NAME_LIST + +#define X(Y) \ + template <> \ + struct RPGrpModelResManager::Int2Type { \ + typedef const nw4r::g3d::Y TRes; \ + typedef nw4r::g3d::Y##Data TResData; \ + }; + +ALL_NAME_LIST; +#undef X + +/****************************************************************************** + * + * GetData specializations + * + ******************************************************************************/ + +template <> +inline RPGrpModelResManager::ResType::TRes +RPGrpModelResManager::GetData( + RPGrpHandle handle) const { + + return mpResList[handle].pResFile->Get(); +} + +#define X(Y) \ + template <> \ + inline RPGrpModelResManager::ResType::TRes \ + RPGrpModelResManager::GetData( \ + RPGrpHandle handle) const { \ + \ + return mpResList[handle].p##Y->Get(); \ + } + +SUBFILE_NAME_LIST; +#undef X + +#define X(Y) \ + template <> \ + inline RPGrpModelResManager::ResType::TRes \ + RPGrpModelResManager::GetData( \ + RPGrpHandle handle, int index) const { \ + \ + return mpResList[handle].pResFile->Get().Get##Y(index); \ + } + +SUBFILE_NAME_LIST; +#undef X + +#define X(Y) \ + template <> \ + inline RPGrpModelResManager::ResType::TRes \ + RPGrpModelResManager::GetData( \ + RPGrpHandle handle, const char* pName) const { \ + \ + return mpResList[handle].pResFile->Get().Get##Y(pName); \ + } + +SUBFILE_NAME_LIST; +#undef X + +#undef ALL_NAME_LIST +#undef SUBFILE_NAME_LIST + +/****************************************************************************** + * + * Inline functions + * + ******************************************************************************/ + +/** + * @brief Gets an animation's transform result at the specified frame + * + * @param handle Animation resource handle + * @param pName Animation node name + * @param frame Animation frame + * @param[out] pRotTrans Transformation matrix + * @param[out] pTrans X/Y/Z translation + * @param[out] pRotate X/Y/Z rotation (in degrees) + * @param[out] pScale X/Y/Z scale + */ +inline void RPGrpModelResManager::GetResultTransform( + RPGrpHandle handle, const char* pName, u16 idx, f32 frame, + EGG::Matrix34f* pRotTrans, EGG::Vector3f* pTrans, EGG::Vector3f* pRotate, + EGG::Vector3f* pScale) { + + const nw4r::g3d::ResAnmChr chr = + spCurrent->GetData(handle, pName); + + return InternalGetResultTransform(chr, idx, frame, pRotTrans, pTrans, + pRotate, pScale); +} + //! @} #endif diff --git a/include/Pack/RPGraphics/RPGrpModelRfl.h b/include/Pack/RPGraphics/RPGrpModelRfl.h new file mode 100644 index 00000000..abe08a61 --- /dev/null +++ b/include/Pack/RPGraphics/RPGrpModelRfl.h @@ -0,0 +1,153 @@ +#ifndef RP_GRAPHICS_MODEL_RFL_H +#define RP_GRAPHICS_MODEL_RFL_H +#include + +#include + +#include + +#include + +//! @addtogroup rp_graphics +//! @{ + +/** + * @brief Model implementation for RFL + */ +class RPGrpModelRfl : public RPGrpModel, public nw4r::g3d::IScnObjCallback { +public: + RPGrpModelRfl(); + virtual ~RPGrpModelRfl() override {} // at 0x88 + + virtual UNKTYPE VF_0x8(UNKTYPE) override {} // at 0x8 + virtual UNKTYPE VF_0x10(UNKTYPE) override {} // at 0x10 + virtual UNKTYPE VF_0xC(UNKTYPE) override {} // at 0xC + + virtual Kind GetKind() override { // at 0x14 + return Kind_RFL; + } + + virtual IRPGrpModelCallback* + SetCallback(IRPGrpModelCallback* pCallback) override; // at 0x18 + + virtual u16 ReplaceTexture(const char* pName, const RPGrpTexture& rTexture, + bool keepFilterWrap); // at 0x20 + + virtual void SetCallbackJointIndex(u16 /* idx */) override {} // at 0x24 + + virtual u16 GetCallbackJointIndex() const override { // at 0x28 + return 0; + } + + virtual void SetJointVisible(u32 idx, bool enable) override; // at 0x2C + virtual bool IsJointVisible(u32 idx) const override; // at 0x30 + + virtual void + GetWorldMtx(u16 /* idx */, + nw4r::math::MTX34* pMtx) const override { // at 0x3C + + nw4r::math::MTX34Copy( + pMtx, GetScnObj()->GetMtxPtr(nw4r::g3d::ScnObj::MTX_WORLD)); + } + + virtual const nw4r::math::MTX34* + GetWorldMtx(u16 /* nodeIdx */) const override { // at 0x40 + return GetScnObj()->GetMtxPtr(nw4r::g3d::ScnObj::MTX_WORLD); + } + + virtual nw4r::math::MTX34* + ReferWorldMtx(u16 /* nodeIdx */) const override { // at 0x44 + return &spCalcWorldMtxArray[0]; + } + + virtual void GetViewMtx(nw4r::math::MTX34* pMtx) const override { // at 0x4C + GetScnMdlSimple()->GetMtx(nw4r::g3d::ScnObj::MTX_VIEW, pMtx); + } + + virtual void GetViewMtx(u16 /* nodeIdx */, + nw4r::math::MTX34* pMtx) const override { // at 0x48 + GetViewMtx(pMtx); + } + + virtual const char* GetJointName(u16 idx) const override { // at 0x54 + return GetScnMdlSimple()->GetResMdl().GetResNode(idx).GetName(); + } + virtual u16 + GetJointIndex(const char* /* pName */) const override { // at 0x58 + return 0; + } + + virtual const char* GetMaterialName(u16 idx) const override { // at 0x60 + return GetScnMdlSimple()->GetResMdl().GetResMat(idx).GetName(); + } + virtual u16 + GetMaterialIndex(const char* /* pName */) const override { // at 0x64 + return 0; + } + + virtual const char* GetShapeName(u16 idx) const override { // at 0x6C + return GetScnMdlSimple()->GetResMdl().GetResShp(idx).GetName(); + } + virtual u16 + GetShapeIndex(const char* /* pName */) const override { // at 0x70 + return 0; + } + + virtual void SetShapeVisible(u32 idx, bool enable) override { // at 0x34 + GetScnMdlSimple()->GetResMdl().GetResShp(idx).SetVisible(enable); + } + + virtual bool IsShapeVisible(u32 idx) const override { // at 0x38 + return GetScnMdlSimple()->GetResMdl().GetResShp(idx).IsVisible(); + } + + virtual void CalcBeforeDraw() override; // at 0x80 + + virtual void Configure() override; // at 0x8C + virtual void CreateAnm() override; // at 0x90 + virtual void InternalCalc() override; // at 0x94 + + virtual void ExecCallback_CALC_WORLD(nw4r::g3d::ScnObj::Timing /* timing */, + nw4r::g3d::ScnObj* /* pObj */, + u32 /* param */, + void* /* pInfo */) override { // at 0xC + } + + virtual void ExecCallback_CALC_MAT(nw4r::g3d::ScnObj::Timing /* timing */, + nw4r::g3d::ScnObj* /* pObj */, + u32 /* param */, + void* /* pInfo */) override { // at 0x10 + } + + virtual void ExecCallback_CALC_VIEW(nw4r::g3d::ScnObj::Timing /* timing */, + nw4r::g3d::ScnObj* /* pObj */, + u32 /* param */, + void* /* pInfo */) override { // at 0x14 + } + + virtual void ExecCallback_DRAW_OPA(nw4r::g3d::ScnObj::Timing /* timing */, + nw4r::g3d::ScnObj* /* pObj */, + u32 /* param */, + void* /* pInfo */) override { // at 0x18 + } + + virtual void ExecCallback_DRAW_XLU(nw4r::g3d::ScnObj::Timing /* timing */, + nw4r::g3d::ScnObj* /* pObj */, + u32 /* param */, + void* /* pInfo */) override { // at 0x1C + } + +private: + GXTexObj mLightTexObj0; // at 0x4C + GXTexObj mLightTexObj1; // at 0x6C + u32 unk8C; + u16 unk90; + u8 unk92; + u32 unk94; + u32 unk98; + u32 unk9C; +}; + +//! @} + +#endif diff --git a/include/Pack/RPGraphics/RPGrpTexture.h b/include/Pack/RPGraphics/RPGrpTexture.h new file mode 100644 index 00000000..3aace568 --- /dev/null +++ b/include/Pack/RPGraphics/RPGrpTexture.h @@ -0,0 +1,25 @@ +#ifndef RP_GRAPHICS_MODEL_TEXTURE_H +#define RP_GRAPHICS_MODEL_TEXTURE_H +#include + +#include + +//! @addtogroup rp_graphics +//! @{ + +/** + * @brief Texture utility + */ +class RPGrpTexture { +public: + const GXTexObj& GetTexObj() const { + return mGXTexObj; + } + +private: + GXTexObj mGXTexObj; // at 0x0 +}; + +//! @} + +#endif diff --git a/include/Pack/RPKernel/RPSysKokeshiGenInfo.h b/include/Pack/RPKernel/RPSysKokeshiGenInfo.h index 17835757..e0508e2b 100644 --- a/include/Pack/RPKernel/RPSysKokeshiGenInfo.h +++ b/include/Pack/RPKernel/RPSysKokeshiGenInfo.h @@ -42,8 +42,8 @@ class RPSysKokeshiGenInfo { //! Facial expression to use RFLExpression mExpression; // at 0x34 - // TODO(kiwi) Doubles resolution of tex copy src - BOOL unk38; + // Use mipmapping to downscale the icon texture + BOOL mMipMap; //! Whether to use the favorite color as the icon clear color BOOL mUseFavoriteColor; // at 0x3C //! Display clear color for icons diff --git a/include/egg/gfxe/eggModelBoundingInfo.h b/include/egg/gfxe/eggModelBoundingInfo.h index 3726e647..e9d12c9b 100644 --- a/include/egg/gfxe/eggModelBoundingInfo.h +++ b/include/egg/gfxe/eggModelBoundingInfo.h @@ -6,9 +6,11 @@ namespace EGG { class ModelBoundingInfo { public: - enum ModelBoundType { - MODEL_HAS_AABB_0xC = (1 << 0), - MODEL_HAS_SPHERE = (1 << 2), + enum BoundFlag { + BoundFlag_AABB = 1 << 0, + BoundFlag_AABBSet = 1 << 1, + BoundFlag_Sphere = 1 << 2, + BoundFlag_SphereSet = 1 << 3, }; struct AABBData { @@ -48,6 +50,8 @@ class ModelBoundingInfo { ModelBoundingInfo(u32, ModelEx*); virtual ~ModelBoundingInfo(); + void Calc(); + SphereData* getSphere() const { #line 99 EGG_ASSERT(m_pSphere); diff --git a/include/egg/gfxe/eggModelEx.h b/include/egg/gfxe/eggModelEx.h index 90efb068..24ef59b1 100644 --- a/include/egg/gfxe/eggModelEx.h +++ b/include/egg/gfxe/eggModelEx.h @@ -64,8 +64,8 @@ class ModelEx { nw4r::math::MTX34* pViewMtxArray) const; void drawShapeDirectly(u32 drawFlag, bool opa, bool xlu, nw4r::math::MTX34* pViewMtx); - u16 replaceTexture(const char*, const int&, bool, TextureReplaceResult*, - u16, bool); + u16 replaceTexture(const char*, const GXTexObj&, bool, + TextureReplaceResult*, u16, bool); void attachBoundingInfo(ModelBoundingInfo* pBV); nw4r::g3d::ResShp getResShp(u16 shapeIndex) const; @@ -80,6 +80,14 @@ class ModelEx { return mpBV; } + nw4r::g3d::ScnObj* getScnObj() const { + return mScnObj; + } + + nw4r::g3d::ScnLeaf* getScnLeaf() const { + return static_cast(mScnObj); + } + nw4r::g3d::ScnMdl* getScnMdl() const { return mType == cType_ScnMdl ? static_cast(mScnObj) : NULL; diff --git a/include/nw4r/g3d/g3d_calcworld.h b/include/nw4r/g3d/g3d_calcworld.h index 8917fdde..c9e74bfb 100644 --- a/include/nw4r/g3d/g3d_calcworld.h +++ b/include/nw4r/g3d/g3d_calcworld.h @@ -4,7 +4,6 @@ #include #include - #include namespace nw4r { @@ -39,7 +38,7 @@ void CalcSkinning(math::MTX34* pModelMtxArray, u32* pModelMtxAttribArray, ******************************************************************************/ class ICalcWorldCallback { public: - virtual ~ICalcWorldCallback() = 0; // at 0x8 + virtual ~ICalcWorldCallback() {} // at 0x8 virtual void ExecCallbackA(ChrAnmResult* pResult, ResMdl mdl, FuncObjCalcWorld* pFuncObj) = 0; // at 0xC @@ -61,6 +60,20 @@ class WorldMtxManip { WorldMtxManip(math::MTX34* pM, math::VEC3* pS, u32* pWMAttr) : mpM(pM), mpS(pS), mpWMAttr(pWMAttr) {} + void GetMtx(math::MTX34* pMtx) const { + if (pMtx != NULL) { + math::MTX34Copy(pMtx, mpM); + } + } + + void SetMtx(const math::MTX34* pMtx) { + if (pMtx != NULL) { + math::MTX34Copy(mpM, pMtx); + } else { + math::MTX34Identity(mpM); + } + } + private: math::MTX34* mpM; // at 0x0 math::VEC3* mpS; // at 0x4 @@ -100,6 +113,13 @@ class FuncObjCalcWorld { } } + u16 GetCallbackNodeID() const { + return mNodeID; + } + void SetCallbackNodeID(u16 id) { + mNodeID = id; + } + private: ICalcWorldCallback* mpCallback; // at 0x0 u8 mTiming; // at 0x4 diff --git a/include/nw4r/g3d/g3d_scnobj.h b/include/nw4r/g3d/g3d_scnobj.h index 4c9f3e3c..4a92aa46 100644 --- a/include/nw4r/g3d/g3d_scnobj.h +++ b/include/nw4r/g3d/g3d_scnobj.h @@ -3,7 +3,6 @@ #include #include - #include namespace nw4r { @@ -73,7 +72,10 @@ class ScnObj : public G3dObj { enum Timing { CALLBACK_TIMING_A = (1 << 0), CALLBACK_TIMING_B = (1 << 1), - CALLBACK_TIMING_C = (1 << 2) + CALLBACK_TIMING_C = (1 << 2), + + CALLBACK_TIMING_ALL = + CALLBACK_TIMING_A | CALLBACK_TIMING_B | CALLBACK_TIMING_C }; enum ExecOp { @@ -120,6 +122,13 @@ class ScnObj : public G3dObj { return mPriorityDrawXlu; } + void SetScnObjCallback(IScnObjCallback* pCallback) { + mpFuncObjExec = pCallback; + } + IScnObjCallback* GetScnObjCallback() { + return mpFuncObjExec; + } + void EnableScnObjCallbackTiming(Timing timing); void EnableScnObjCallbackExecOp(ExecOp op); @@ -166,7 +175,9 @@ class ScnObj : public G3dObj { } bool IsG3dProcDisabled(u32 task) const { - if (task < __G3DPROC_OPTIONAL_END && ((1 << task - 1) & mScnObjFlags)) { + if (task < __G3DPROC_OPTIONAL_END && + ((1 << (task - 1)) & mScnObjFlags)) { + return true; } @@ -344,6 +355,16 @@ class ScnLeaf : public ScnObj { ScaleProperty GetScaleProperty() const; + void SetScale(f32 sx, f32 sy, f32 sz) { + mScale.x = sx; + mScale.y = sy; + mScale.z = sz; + } + + void SetScale(const math::VEC3& rScale) { + mScale = rScale; + } + protected: void DefG3dProcScnLeaf(u32 task, u32 param, void* pInfo); diff --git a/include/nw4r/g3d/res/g3d_resmat.h b/include/nw4r/g3d/res/g3d_resmat.h index 8e390f40..de50f385 100644 --- a/include/nw4r/g3d/res/g3d_resmat.h +++ b/include/nw4r/g3d/res/g3d_resmat.h @@ -7,7 +7,6 @@ #include #include #include - #include #include @@ -548,6 +547,16 @@ class ResMat : public ResCommon { ResMdl GetParent(); + const char* GetName() const { + const ResMatData& r = ref(); + + if (r.name != 0) { + return reinterpret_cast(&r) + r.name; + } + + return NULL; + } + u32 GetID() const { return ref().id; } diff --git a/include/nw4r/g3d/res/g3d_resnode.h b/include/nw4r/g3d/res/g3d_resnode.h index 86b64095..74703605 100644 --- a/include/nw4r/g3d/res/g3d_resnode.h +++ b/include/nw4r/g3d/res/g3d_resnode.h @@ -3,7 +3,6 @@ #include #include - #include namespace nw4r { @@ -85,6 +84,16 @@ class ResNode : public ResCommon, public ResNodeDataTypedef { void PatchChrAnmResult(ChrAnmResult* pResult) const; void CalcChrAnmResult(ChrAnmResult* pResult) const; + const char* GetName() const { + const ResNodeData& r = ref(); + + if (r.name != 0) { + return reinterpret_cast(&r) + r.name; + } + + return NULL; + } + ResName GetResName() const { const ResNodeData& r = ref(); diff --git a/include/nw4r/g3d/res/g3d_resshp.h b/include/nw4r/g3d/res/g3d_resshp.h index 650822cd..b9637848 100644 --- a/include/nw4r/g3d/res/g3d_resshp.h +++ b/include/nw4r/g3d/res/g3d_resshp.h @@ -107,6 +107,20 @@ class ResShp : public ResCommon { ResMdl GetParent() const; + const char* GetName() const { + const ResShpData& r = ref(); + + if (r.name != 0) { + return reinterpret_cast(&r) + r.name; + } + + return NULL; + } + + u32 GetID() const { + return ref().id; + } + bool GXGetVtxDescv(GXVtxDescList* pList) const; bool GXGetVtxAttrFmtv(GXVtxAttrFmtList* pList) const; void GXSetArray(GXAttr attr, const void* pBase, u8 stride); @@ -148,6 +162,14 @@ class ResShp : public ResCommon { bool IsVisible() const { return !(ref().flag & ResShpData::FLAG_INVISIBLE); } + + void SetVisible(bool visible) { + if (visible) { + ref().flag &= ~ResShpData::FLAG_INVISIBLE; + } else { + ref().flag |= ResShpData::FLAG_INVISIBLE; + } + } }; } // namespace g3d diff --git a/include/revolution/OS/OSHardware.h b/include/revolution/OS/OSHardware.h index f69e864a..c03b8ed2 100644 --- a/include/revolution/OS/OSHardware.h +++ b/include/revolution/OS/OSHardware.h @@ -120,7 +120,7 @@ OS_DEF_GLOBAL_VAR(void*, LAST_REL, 0x800030CC); OS_DEF_GLOBAL_VAR(void*, REL_NAME_TABLE, 0x800030D0); OS_DEF_GLOBAL_VAR(u32, DOL_TOTAL_TEXT_DATA, 0x800030D4); OS_DEF_GLOBAL_VAR(s64, SYSTEM_TIME, 0x800030D8); -OS_DEF_GLOBAL_VAR(u8, PAD_FLAGS, 0x800030E3); +OS_DEF_GLOBAL_VAR(s8, PAD_FLAGS, 0x800030E3); OS_DEF_GLOBAL_VAR(u16, GC_PAD_3_BTN, 0x800030E4); OS_DEF_GLOBAL_VAR(volatile u16, DVD_DEVICE_CODE, 0x800030E6); OS_DEF_GLOBAL_VAR(u8, BI2_DEBUG_FLAG, 0x800030E8); diff --git a/src/Pack/RPGraphics/RPGrpModel.cpp b/src/Pack/RPGraphics/RPGrpModel.cpp new file mode 100644 index 00000000..71bf24bd --- /dev/null +++ b/src/Pack/RPGraphics/RPGrpModel.cpp @@ -0,0 +1,233 @@ +#include + +#include + +#include + +EGG::Allocator* RPGrpModel::spAllocator = NULL; + +RPGrpModel* RPGrpModel::spEntryHead = NULL; +RPGrpModel* RPGrpModel::spEntryTail = NULL; +RPGrpModel* RPGrpModel::spGenList = NULL; + +RPGrpModel* RPGrpModel::spCalcModel = NULL; +nw4r::math::MTX34* RPGrpModel::spCalcWorldMtxArray = NULL; +nw4r::math::MTX34* RPGrpModel::spCalcViewMtxArray = NULL; + +RPGrpModel* RPGrpModel::Construct(RPGrpHandle handle, u8 viewNo, u32 typeOption, + u32 bufferOption) { + RPGrpModel* pModel = NULL; + + switch (RPGrpModelResManager::GetCurrent()->GetType(handle)) { + case RPGrpModelResManager::Type_ResMdl: { + pModel = new RPGrpModelG3D(handle, viewNo, typeOption, bufferOption); + break; + } + + case RPGrpModelResManager::Type_1: + default: { + break; + } + } + + pModel->Configure(); + pModel->CreateAnm(); + return pModel; +} + +RPGrpModel* RPGrpModel::Construct(RPGrpHandle handle, int idx, u8 viewNo, + u32 typeOption, u32 bufferOption) { + RPGrpModel* pModel = + new RPGrpModelG3D(handle, idx, viewNo, typeOption, bufferOption); + + pModel->Configure(); + pModel->CreateAnm(); + return pModel; +} + +RPGrpModel* RPGrpModel::Construct(RPGrpHandle handle, const char* pName, + u8 viewNo, u32 typeOption, u32 bufferOption) { + RPGrpModel* pModel = + new RPGrpModelG3D(handle, pName, viewNo, typeOption, bufferOption); + + pModel->Configure(); + pModel->CreateAnm(); + return pModel; +} + +RPGrpModel::RPGrpModel(u8 viewNo) + : mViewNo(viewNo), + mDrawScene(0), + mDrawGroup(0), + unk3(8), + unk4(8), + mFlags(EFlag_Visible), + unkA(0), + unkC(0), + unk10(0), + mpEntryNext(NULL), + mpGenNext(NULL), + mpCallback(NULL), + mScale(1.0f, 1.0f, 1.0f), + mpModelAnm(NULL), + mppMaterials(NULL), + mpBoundingInfo(NULL), + mpRecord(NULL), + mReverseCulling(false), + mpModelEx(NULL) { + + mpGenNext = spGenList; + spGenList = this; +} + +RPGrpModel::~RPGrpModel() {} + +void RPGrpModel::Configure() { + if (GetMaterialNum() <= 0) { + return; + } + + mppMaterials = new RPGrpModelMaterial*[GetMaterialNum()]; + + for (int i = 0; i < GetMaterialNum(); i++) { + mppMaterials[i] = NULL; + CreateMaterial(i); + } +} + +IRPGrpModelCallback* RPGrpModel::SetCallback(IRPGrpModelCallback* pCallback) { + IRPGrpModelCallback* pOldCallback = mpCallback; + mpCallback = pCallback; + return pOldCallback; +} + +void RPGrpModel::CreateMaterial(u16 idx) { + mppMaterials[idx] = new RPGrpModelMaterial(this, idx); +} + +void RPGrpModel::CreateBoundingInfo(u32 flags) { + u32 boundFlags = 0; + + if (flags & BoundOption_Sphere) { + boundFlags |= RPGrpModelBoundingInfo::BoundFlag_Sphere; + } + + if (flags & BoundOption_SphereSet) { + boundFlags |= RPGrpModelBoundingInfo::BoundFlag_Sphere | + RPGrpModelBoundingInfo::BoundFlag_SphereSet; + } + + if (flags & BoundOption_AABB) { + boundFlags |= RPGrpModelBoundingInfo::BoundFlag_AABB; + } + + if (flags & BoundOption_AABBSet) { + boundFlags |= RPGrpModelBoundingInfo::BoundFlag_AABB | + RPGrpModelBoundingInfo::BoundFlag_AABBSet; + } + + IRPGrpModelCallback* pCallback = SetCallback(NULL); + mpBoundingInfo = new RPGrpModelBoundingInfo(boundFlags, this); + SetCallback(pCallback); +} + +void RPGrpModel::CreateRecord(u16 frames) { + mpRecord = new RPGrpModelRecord(frames, this); + mpRecord->Clear(); + mFlags |= EFlag_HasRecord; +} + +void RPGrpModel::UpdateFrame() { + if (mpModelAnm != NULL) { + mpModelAnm->UpdateFrame(); + } + + nw4r::g3d::ScnObj* pScnObj = GetScnObj(); + if (pScnObj != NULL) { + pScnObj->G3dProc(nw4r::g3d::G3dObj::G3DPROC_UPDATEFRAME, 0, NULL); + } +} + +void RPGrpModel::Calc() { + spCalcModel = this; + + if (mpModelAnm != NULL) { + mpModelAnm->Calc(); + } + + InternalCalc(); + + if (mpBoundingInfo != NULL) { + mpBoundingInfo->Calc(); + } + + spCalcModel = NULL; +} + +void RPGrpModel::Entry() { + if (spEntryTail != NULL) { + spEntryTail->mpEntryNext = this; + } else { + spEntryHead = this; + } + + spEntryTail = this; + mFlags |= EFlag_Entered; +} + +void RPGrpModel::CalcMaterial() { + for (int i = 0; i < GetMaterialNum(); i++) { + mppMaterials[i]->Calc(); + } +} + +u16 RPGrpModel::GetMaterialNum() const { + return mpModelEx->getNumMaterial(); +} + +void RPGrpModel::SetReverseCulling(bool reverse) { + if (reverse == mReverseCulling) { + return; + } + + if (!mReverseCulling || !reverse) { + for (u16 i = 0; i < GetMaterialNum(); i++) { + if (mppMaterials[i]->GetCullMode() == GX_CULL_BACK) { + mppMaterials[i]->SetCullMode(GX_CULL_FRONT); + } else if (mppMaterials[i]->GetCullMode() == GX_CULL_FRONT) { + mppMaterials[i]->SetCullMode(GX_CULL_BACK); + } + + mppMaterials[i]->SetSyncFlags( + RPGrpModelMaterial::ESyncFlag_ResGenMode); + } + } + + mReverseCulling = reverse; +} + +u16 RPGrpModel::ReplaceTexture(const char* pName, const RPGrpTexture& rTexture, + bool keepFilterWrap) { + + GXTexObj texObj = rTexture.GetTexObj(); + return mpModelEx->replaceTexture(pName, texObj, keepFilterWrap, NULL, 0, + true); +} + +void RPGrpModel::RemoveGenList() { + RPGrpModel* pIt = spGenList; + RPGrpModel* pPrev = NULL; + + for (; pIt != NULL; pPrev = pIt, pIt = pIt->mpGenNext) { + if (pIt != this) { + continue; + } + + if (pPrev != NULL) { + pPrev->mpGenNext = mpGenNext; + break; + } + + spGenList = mpGenNext; + } +} diff --git a/src/Pack/RPGraphics/RPGrpModelImplement.cpp b/src/Pack/RPGraphics/RPGrpModelImplement.cpp new file mode 100644 index 00000000..e9e7ba8d --- /dev/null +++ b/src/Pack/RPGraphics/RPGrpModelImplement.cpp @@ -0,0 +1,254 @@ +#include + +#include + +RPGrpModelG3D::RPGrpModelG3D(RPGrpHandle handle, u8 viewNo, u32 typeOption, + u32 bufferOption) + : RPGrpModel(viewNo) { + + const nw4r::g3d::ResMdl mdl = + RPGrpModelResManager::GetCurrent() + ->GetData(handle); + + nw4r::g3d::ScnObj* pScnObj; + u32 size; + + if (bufferOption == 0 && !(typeOption & TypeOption_NoSimple)) { + pScnObj = + nw4r::g3d::ScnMdlSimple::Construct(spAllocator, &size, mdl, viewNo); + } else { + pScnObj = nw4r::g3d::ScnMdl::Construct(spAllocator, &size, mdl, + bufferOption, viewNo); + } + + mpModelEx = new EGG::ModelEx(pScnObj); +} + +RPGrpModelG3D::RPGrpModelG3D(RPGrpHandle handle, int idx, u8 viewNo, + u32 typeOption, u32 bufferOption) + : RPGrpModel(viewNo) { + + const nw4r::g3d::ResFile file = + RPGrpModelResManager::GetCurrent() + ->GetData(handle); + + const nw4r::g3d::ResMdl mdl = file.GetResMdl(idx); + + nw4r::g3d::ScnObj* pScnObj; + u32 size; + + if (bufferOption == 0 && !(typeOption & TypeOption_NoSimple)) { + pScnObj = + nw4r::g3d::ScnMdlSimple::Construct(spAllocator, &size, mdl, viewNo); + } else { + pScnObj = nw4r::g3d::ScnMdl::Construct(spAllocator, &size, mdl, + bufferOption, viewNo); + } + + mpModelEx = new EGG::ModelEx(pScnObj); +} + +RPGrpModelG3D::RPGrpModelG3D(RPGrpHandle handle, const char* pName, u8 viewNo, + u32 typeOption, u32 bufferOption) + : RPGrpModel(viewNo) { + + const nw4r::g3d::ResFile file = + RPGrpModelResManager::GetCurrent() + ->GetData(handle); + + const nw4r::g3d::ResMdl mdl = file.GetResMdl(pName); + + nw4r::g3d::ScnObj* pScnObj; + u32 size; + + if (bufferOption == 0 && !(typeOption & TypeOption_NoSimple)) { + pScnObj = + nw4r::g3d::ScnMdlSimple::Construct(spAllocator, &size, mdl, viewNo); + } else { + pScnObj = nw4r::g3d::ScnMdl::Construct(spAllocator, &size, mdl, + bufferOption, viewNo); + } + + mpModelEx = new EGG::ModelEx(pScnObj); +} + +void RPGrpModelG3D::Configure() { + RPGrpModel::Configure(); + + GetScnMdlSimple()->SetScnObjCallback(this); + GetScnMdlSimple()->SetScnMdlCallback(this); + + GetScnMdlSimple()->EnableScnObjCallbackTiming( + nw4r::g3d::ScnObj::CALLBACK_TIMING_A); + + GetScnMdlSimple()->EnableScnObjCallbackExecOp( + nw4r::g3d::ScnObj::EXECOP_CALC_MAT); + + InternalCalc(); +} + +void RPGrpModelG3D::CreateAnm() { + mpModelAnm = RPGrpModelAnmG3D::Construct(this); +} + +IRPGrpModelCallback* +RPGrpModelG3D::SetCallback(IRPGrpModelCallback* pCallback) { + IRPGrpModelCallback* pOldCallback = mpCallback; + mpCallback = pCallback; + + if (pCallback == NULL) { + GetScnMdlSimple()->DisableScnMdlCallbackTiming( + nw4r::g3d::ScnObj::CALLBACK_TIMING_ALL); + } else { + GetScnMdlSimple()->EnableScnMdlCallbackTiming( + nw4r::g3d::ScnObj::CALLBACK_TIMING_ALL); + } + + return pOldCallback; +} + +void RPGrpModelG3D::InternalCalc() { + static const Vec GEOMETRY_MAGNIFY[1] = { + {-1.0f, 1.0f, 1.0f}, + }; + + if (!mReverseCulling) { + if (GetScnLeaf() != NULL) { + GetScnLeaf()->SetScale(mScale); + } + } else { + const Vec& rMag = GEOMETRY_MAGNIFY[mReverseCulling - 1]; + + nw4r::math::VEC3 scale(mScale.x * rMag.x, mScale.y * rMag.y, + mScale.z * rMag.z); + + if (GetScnLeaf() != NULL) { + GetScnLeaf()->SetScale(scale); + } + } + + if (mpRecord != NULL) { + GetScnMdlSimple()->EnableScnMdlCallbackTiming( + nw4r::g3d::ScnMdl::CALLBACK_TIMING_C); + } + + if (GetScnObj() != NULL) { + GetScnObj()->G3dProc(nw4r::g3d::G3dObj::G3DPROC_CALC_WORLD, 0, NULL); + } +} + +void RPGrpModelG3D::CalcBeforeDraw() { + RPGrpModel::CalcBeforeDraw(); + + if (mpCallback != NULL) { + spCalcViewMtxArray = GetScnMdlSimple()->GetViewPosMtxArray(); + spCalcModel = this; + + mpCallback->ReferViewMtx(this); + + spCalcViewMtxArray = NULL; + spCalcModel = NULL; + } +} + +void RPGrpModelG3D::SetJointVisible(u32 idx, bool enable) { + if (GetScnMdl() != NULL) { + nw4r::g3d::ScnMdl::CopiedVisAccess access(GetScnMdl(), idx); + access.SetVisibilityEx(enable); + } else { + GetScnMdlSimple()->GetResMdl().GetResNode(idx).SetVisibility(enable); + } +} + +bool RPGrpModelG3D::IsJointVisible(u32 idx) const { + if (GetScnMdl() != NULL) { + nw4r::g3d::ScnMdl::CopiedVisAccess access(GetScnMdl(), idx); + return access.IsVisible(); + } else { + return GetScnMdlSimple()->GetResMdl().GetResNode(idx).IsVisible(); + } +} + +void RPGrpModelG3D::ExecCallback_CALC_WORLD( + nw4r::g3d::ScnObj::Timing /* timing */, nw4r::g3d::ScnObj* /* pObj */, + u32 /* param */, void* /* pInfo */) {} + +void RPGrpModelG3D::ExecCallback_CALC_MAT(nw4r::g3d::ScnObj::Timing timing, + nw4r::g3d::ScnObj* /* pObj */, + u32 /* param */, void* /* pInfo */) { + + if (!(unkC & 0x40)) { + if (timing & nw4r::g3d::ScnObj::CALLBACK_TIMING_A) { + CalcMaterial(); + } + } else if (timing & nw4r::g3d::ScnObj::CALLBACK_TIMING_C) { + CalcMaterial(); + } +} + +void RPGrpModelG3D::ExecCallback_DRAW_OPA( + nw4r::g3d::ScnObj::Timing /* timing */, nw4r::g3d::ScnObj* /* pObj */, + u32 /* param */, void* /* pInfo */) { + + nw4r::g3d::G3DState::Invalidate(nw4r::g3d::G3DState::INVALIDATE_TEV); +} + +void RPGrpModelG3D::ExecCallback_DRAW_XLU( + nw4r::g3d::ScnObj::Timing /* timing */, nw4r::g3d::ScnObj* /* pObj */, + u32 /* param */, void* /* pInfo */) { + + nw4r::g3d::G3DState::Invalidate(nw4r::g3d::G3DState::INVALIDATE_TEV); +} + +void RPGrpModelG3D::ExecCallbackA(nw4r::g3d::ChrAnmResult* pResult, + nw4r::g3d::ResMdl /* mdl */, + nw4r::g3d::FuncObjCalcWorld* pFuncObj) { + nw4r::math::MTX34 trans; + nw4r::math::VEC3 scale; + + pResult->GetRotTrans(&trans); + pResult->GetScale(&scale); + + mpCallback->EditJointLocalMtx( + this, GetScnMdlSimple()->GetScnMdlCallbackNodeID(), &trans, &scale); + + pResult->SetRotTrans(&trans); + pResult->SetScale(&scale); + + pFuncObj->SetCallbackNodeID(GetScnMdlSimple()->GetScnMdlCallbackNodeID()); +} + +void RPGrpModelG3D::ExecCallbackB(nw4r::g3d::WorldMtxManip* pManip, + nw4r::g3d::ResMdl /* mdl */, + nw4r::g3d::FuncObjCalcWorld* pFuncObj) { + if (!sJointWorldMtxInitialized) { + sJointWorldMtxInitialized = true; + } + + pManip->GetMtx(&sJointWorldMtx); + + mpCallback->EditJointWorldMtx( + this, GetScnMdlSimple()->GetScnMdlCallbackNodeID(), &sJointWorldMtx); + + pManip->SetMtx(&sJointWorldMtx); + + pFuncObj->SetCallbackNodeID(GetScnMdlSimple()->GetScnMdlCallbackNodeID()); +} + +void RPGrpModelG3D::ExecCallbackC(nw4r::math::MTX34* pMtxArray, + nw4r::g3d::ResMdl /* mdl */, + nw4r::g3d::FuncObjCalcWorld* /* pFuncObj */) { + spCalcWorldMtxArray = pMtxArray; + spCalcModel = this; + + if (mpCallback != NULL) { + mpCallback->EditWorldMtx(this); + } + + if (mpRecord != NULL) { + mpRecord->Calc(this); + } + + spCalcWorldMtxArray = NULL; + spCalcModel = NULL; +} diff --git a/src/Pack/RPGraphics/RPGrpModelResManager.cpp b/src/Pack/RPGraphics/RPGrpModelResManager.cpp new file mode 100644 index 00000000..e20fe86b --- /dev/null +++ b/src/Pack/RPGraphics/RPGrpModelResManager.cpp @@ -0,0 +1,478 @@ +#include + +#include + +#include + +/** + * @brief Allocator used for model-related allocations + */ +RPGrpModelResManager* RPGrpModelResManager::spCurrent = NULL; + +/** + * @brief Constructor + */ +RPGrpModelResManager::RPGrpModelResManager() {} + +/** + * @brief Initializes the manager state + */ +void RPGrpModelResManager::Configure() { + mResNum = 0; + mpResList = NULL; +} + +/** + * @brief Allocates memory to hold the specified amount of resources + * + * @param num Resource list capacity + */ +void RPGrpModelResManager::CreateResourceList(u16 num) { + if (mResNum > 0) { + return; + } + + if (num <= 0) { + return; + } + + mpResList = new Resource[num]; + mResNum = num; + + for (int i = 0; i < num; i++) { + RPGrpHandle handle = static_cast(i); + mpResList[handle].Reset(); + } +} + +/** + * @brief Releases the specified resource + * + * @param handle Resource handle + */ +void RPGrpModelResManager::Terminate(RPGrpHandle handle) { + switch (mpResList[handle].type) { + case Type_ResFile: { + nw4r::g3d::ResFile file = mpResList[handle].pResFile->Get(); + + file.Release(); + file.Terminate(); + break; + } + + default: { + break; + } + } + + mpResList[handle].Reset(); +} + +/** + * @brief Releases all resources + */ +void RPGrpModelResManager::TerminateAll() { + for (RPGrpHandle handle = 0; handle < mResNum; handle++) { + Terminate(handle); + } +} + +/** + * @brief Searches the resource list for the specified data + * + * @param pBinary Binary resource data + * @return Resource handle, or -1 if not found + */ +int RPGrpModelResManager::SearchData(void* pBinary) const { + for (int i = 0; i < mResNum; i++) { + if (mpResList[i].pBinary == pBinary) { + return i; + } + } + + return -1; +} + +/** + * @brief Creates a new resource from the specified data + * + * @param type Resource type + * @param pBinary Binary resource data + * @param arg2 + * @return New resource handle + */ +RPGrpHandle RPGrpModelResManager::CreateData(Type type, void* pBinary, + u32 arg2) { + for (int i = 0; i < mResNum; i++) { + if (mpResList[i].pBinary == pBinary) { + return static_cast(i); + } + } + + RPGrpHandle handle = static_cast(mResNum); + while (handle > 0) { + if (mpResList[--handle].pBinary == NULL) { + break; + } + } + + InternalCreateData(handle, type, pBinary, arg2); + return handle; +} + +/** + * @brief Gets the raw data of the specified resource subfile + * + * @param type Subfile type + * @param handle File resource handle + * @param pName Subfile name + */ +void* RPGrpModelResManager::GetPtr(Type type, RPGrpHandle handle, + const char* pName) const { + switch (type) { + case Type_ResMdl: { + return mpResList[handle].pResFile->Get().GetResMdl(pName).ptr(); + } + + case Type_ResPltt: { + return mpResList[handle].pResFile->Get().GetResPltt(pName).ptr(); + } + + case Type_ResTex: { + return mpResList[handle].pResFile->Get().GetResTex(pName).ptr(); + } + + case Type_ResAnmChr: { + return mpResList[handle].pResFile->Get().GetResAnmChr(pName).ptr(); + } + + case Type_ResAnmVis: { + return mpResList[handle].pResFile->Get().GetResAnmVis(pName).ptr(); + } + + case Type_ResAnmClr: { + return mpResList[handle].pResFile->Get().GetResAnmClr(pName).ptr(); + } + + case Type_ResAnmTexPat: { + return mpResList[handle].pResFile->Get().GetResAnmTexPat(pName).ptr(); + } + + case Type_ResAnmTexSrt: { + return mpResList[handle].pResFile->Get().GetResAnmTexSrt(pName).ptr(); + } + + case Type_ResAnmShp: { + return mpResList[handle].pResFile->Get().GetResAnmShp(pName).ptr(); + } + + case Type_ResAnmScn: { + return mpResList[handle].pResFile->Get().GetResAnmShp(pName).ptr(); + } + + default: { + return NULL; + } + } +} + +/** + * @brief Gets the raw data of the specified resource subfile + * + * @param type Subfile type + * @param handle File resource handle + * @param index Subfile index + */ +void* RPGrpModelResManager::GetPtr(Type type, RPGrpHandle handle, + int index) const { + switch (type) { + case Type_ResMdl: { + return mpResList[handle].pResFile->Get().GetResMdl(index).ptr(); + } + + case Type_ResPltt: { + return mpResList[handle].pResFile->Get().GetResPltt(index).ptr(); + } + + case Type_ResTex: { + return mpResList[handle].pResFile->Get().GetResTex(index).ptr(); + } + + case Type_ResAnmChr: { + return mpResList[handle].pResFile->Get().GetResAnmChr(index).ptr(); + } + + case Type_ResAnmVis: { + return mpResList[handle].pResFile->Get().GetResAnmVis(index).ptr(); + } + + case Type_ResAnmClr: { + return mpResList[handle].pResFile->Get().GetResAnmClr(index).ptr(); + } + + case Type_ResAnmTexPat: { + return mpResList[handle].pResFile->Get().GetResAnmTexPat(index).ptr(); + } + + case Type_ResAnmTexSrt: { + return mpResList[handle].pResFile->Get().GetResAnmTexSrt(index).ptr(); + } + + case Type_ResAnmShp: { + return mpResList[handle].pResFile->Get().GetResAnmShp(index).ptr(); + } + + case Type_ResAnmScn: { + return mpResList[handle].pResFile->Get().GetResAnmShp(index).ptr(); + } + + default: { + return NULL; + } + } +} + +void RPGrpModelResManager::InternalCreateData(RPGrpHandle handle, Type type, + void* pBinary, u32 arg3) { + Resource& rResource = mpResList[handle]; + rResource.pBinary = pBinary; + rResource.type = type; + rResource.unkC = arg3; + + switch (type) { + case Type_ResFile: { + nw4r::g3d::ResFile* pResFile = + new nw4r::g3d::ResFile(rResource.pBinary); + + pResFile->CheckRevision(); + pResFile->Init(); + pResFile->Bind(*pResFile); + + for (u32 i = 0; i < pResFile->GetResAnmScnNumEntries(); i++) { + nw4r::g3d::ResAnmScn scn = pResFile->GetResAnmScn(i); + scn.Bind(scn); + } + + // TODO(kiwi) Not sure how this wrapper works. + // Could ResType be ResCommon? But then you access private members... + rResource.pResFile = reinterpret_cast*>(pResFile); + break; + } + + case Type_ResMdl: { + rResource.pResMdl = new ResType(); + + rResource.pResMdl->pResData = + static_cast(pBinary); + break; + } + + case Type_ResPltt: { + rResource.pResPltt = new ResType(); + + rResource.pResPltt->pResData = + static_cast(pBinary); + break; + } + + case Type_ResTex: { + rResource.pResTex = new ResType(); + + rResource.pResTex->pResData = + static_cast(pBinary); + break; + } + + case Type_ResAnmChr: { + rResource.pResAnmChr = new ResType(); + + rResource.pResAnmChr->pResData = + static_cast(pBinary); + break; + } + + case Type_ResAnmVis: { + rResource.pResAnmVis = new ResType(); + + rResource.pResAnmVis->pResData = + static_cast(pBinary); + break; + } + + case Type_ResAnmClr: { + rResource.pResAnmClr = new ResType(); + + rResource.pResAnmClr->pResData = + static_cast(pBinary); + break; + } + + case Type_ResAnmTexPat: { + rResource.pResAnmTexPat = new ResType(); + + rResource.pResAnmTexPat->pResData = + static_cast(pBinary); + break; + } + + case Type_ResAnmTexSrt: { + rResource.pResAnmTexSrt = new ResType(); + + rResource.pResAnmTexSrt->pResData = + static_cast(pBinary); + break; + } + + case Type_ResAnmShp: { + rResource.pResAnmShp = new ResType(); + + rResource.pResAnmShp->pResData = + static_cast(pBinary); + break; + } + + case Type_ResAnmScn: { + rResource.pResAnmScn = new ResType(); + + rResource.pResAnmScn->pResData = + static_cast(pBinary); + break; + } + + case Type_Unknown: { + rResource.pResUnknown = new ResType(); + rResource.pResUnknown->pResData = pBinary; + break; + } + + default: { + break; + } + } +} + +/** + * @brief Tests whether the specified resource subfile exists + * + * @param type Subfile type + * @param handle File resource handle + * @param pName Subfile name + */ +bool RPGrpModelResManager::HasFile(Type type, RPGrpHandle handle, + const char* pName) const { + switch (type) { + case Type_ResMdl: { + return mpResList[handle].pResFile->Get().GetResMdl(pName).IsValid(); + } + + case Type_ResPltt: { + return mpResList[handle].pResFile->Get().GetResPltt(pName).IsValid(); + } + + case Type_ResTex: { + return mpResList[handle].pResFile->Get().GetResTex(pName).IsValid(); + } + + case Type_ResAnmChr: { + return mpResList[handle].pResFile->Get().GetResAnmChr(pName).IsValid(); + } + + case Type_ResAnmVis: { + return mpResList[handle].pResFile->Get().GetResAnmVis(pName).IsValid(); + } + + case Type_ResAnmClr: { + return mpResList[handle].pResFile->Get().GetResAnmClr(pName).IsValid(); + } + + case Type_ResAnmTexPat: { + return mpResList[handle] + .pResFile->Get() + .GetResAnmTexPat(pName) + .IsValid(); + } + + case Type_ResAnmTexSrt: { + return mpResList[handle] + .pResFile->Get() + .GetResAnmTexSrt(pName) + .IsValid(); + } + + case Type_ResAnmShp: { + return mpResList[handle].pResFile->Get().GetResAnmShp(pName).IsValid(); + } + + case Type_ResAnmScn: { + return mpResList[handle].pResFile->Get().GetResAnmShp(pName).IsValid(); + } + + default: { + return false; + } + } +} + +/** + * @brief Gets an animation's transform result at the specified frame + * + * @param handle Animation resource handle + * @param idx Animation node index + * @param frame Animation frame + * @param[out] pRotTrans Transformation matrix + * @param[out] pTrans X/Y/Z translation + * @param[out] pRotate X/Y/Z rotation (in degrees) + * @param[out] pScale X/Y/Z scale + */ +void RPGrpModelResManager::GetResultTransform( + RPGrpHandle handle, u16 idx, f32 frame, EGG::Matrix34f* pRotTrans, + EGG::Vector3f* pTrans, EGG::Vector3f* pRotate, EGG::Vector3f* pScale) { + + switch (mpResList[handle].type) { + case Type_ResAnmChr: { + InternalGetResultTransform(mpResList[handle].pResAnmChr->Get(), idx, + frame, pRotTrans, pTrans, pRotate, pScale); + break; + } + + default: { + break; + } + } +} + +/** + * @brief Gets an animation's transform result at the specified frame + * + * @param chr Animation resource + * @param idx Animation node index + * @param frame Animation frame + * @param[out] pRotTrans Transformation matrix + * @param[out] pTrans X/Y/Z translation + * @param[out] pRotate X/Y/Z rotation (in degrees) + * @param[out] pScale X/Y/Z scale + */ +void RPGrpModelResManager::InternalGetResultTransform( + const nw4r::g3d::ResAnmChr chr, u16 idx, f32 frame, + EGG::Matrix34f* pRotTrans, EGG::Vector3f* pTrans, EGG::Vector3f* pRotate, + EGG::Vector3f* pScale) { + + nw4r::g3d::ChrAnmResult result; + chr.GetAnmResult(&result, idx, frame); + + if (pRotTrans != NULL) { + result.GetRotTrans(pRotTrans); + } + + if (pScale != NULL) { + result.GetScale(pScale); + } + + if (pTrans != NULL) { + result.GetTranslate(pTrans); + } + + if (pRotate != NULL) { + result.GetRotateDeg(pRotate); + } +} diff --git a/src/Pack/RPKernel/RPSysKokeshi.cpp b/src/Pack/RPKernel/RPSysKokeshi.cpp index cae61670..c618b366 100644 --- a/src/Pack/RPKernel/RPSysKokeshi.cpp +++ b/src/Pack/RPKernel/RPSysKokeshi.cpp @@ -3,10 +3,10 @@ #include #include -#include - #include +#include + /** * @brief Constructor * @@ -113,7 +113,7 @@ void RPSysKokeshi::LoadResource(const RPSysKokeshiOverloadInfo* pOverloadInfo) { pKokeshiManager->SetMatColor(mpLeftHandModel, favColor, favColor); pKokeshiManager->SetMatColor(mpRightHandModel, favColor, favColor); - if (mpNigaoeModel->GetKind() == RPGrpModel::Kind_Rfl) { + if (mpNigaoeModel->GetKind() == RPGrpModel::Kind_RFL) { // static_cast(mpNigaoeModel)->unkA2 = ... } } diff --git a/src/Pack/RPKernel/RPSysKokeshiGenInfo.cpp b/src/Pack/RPKernel/RPSysKokeshiGenInfo.cpp index 7ceb1dce..4139f61e 100644 --- a/src/Pack/RPKernel/RPSysKokeshiGenInfo.cpp +++ b/src/Pack/RPKernel/RPSysKokeshiGenInfo.cpp @@ -17,12 +17,12 @@ RPSysKokeshiGenInfo::RPSysKokeshiGenInfo() { mTexHeight = 128; mResolution = RFLResolution_128; mExpression = RFLExp_Smile; - unk38 = false; + mMipMap = false; mUseFavoriteColor = false; mClearColor.r = mClearColor.g = mClearColor.b = mClearColor.a = 0; mIconView = RPSysKokeshiManager::IconView_Front; mIconExpression = RFLExp_Normal; - mMakeEdge = FALSE; + mMakeEdge = false; unk50.r = unk50.g = unk50.b = unk50.a = 0; unk54 = 0; } diff --git a/src/Pack/RPKernel/RPSysLayout.cpp b/src/Pack/RPKernel/RPSysLayout.cpp index 96a51daa..e17d2efb 100644 --- a/src/Pack/RPKernel/RPSysLayout.cpp +++ b/src/Pack/RPKernel/RPSysLayout.cpp @@ -9,7 +9,6 @@ #include #include - namespace { //! Length of the "ID" suffix in panes (N_Pane_XX) diff --git a/src/egg/gfxe/eggDrawGX.cpp b/src/egg/gfxe/eggDrawGX.cpp index 4e3448c9..00bf582c 100644 --- a/src/egg/gfxe/eggDrawGX.cpp +++ b/src/egg/gfxe/eggDrawGX.cpp @@ -247,12 +247,12 @@ void DrawGX::BeginDrawScreen(bool lu, bool texture, bool alpha) { SetMat_PE(ZMODE_ALWAYS, BLEND_NORMAL); - static const VtxType tbl[true + 1][true + 1] = { + static const VtxType SCREEN_VTX[true + 1][true + 1] = { {VTX_TYPE_SCREEN_TEXTURE, VTX_TYPE_SCREEN}, // CC {VTX_TYPE_SCREEN_TEXTURE_LU, VTX_TYPE_SCREEN_LU}, // LU }; - SetVtxState(tbl[lu ? 1 : 0][texture ? 0 : 1]); + SetVtxState(SCREEN_VTX[lu ? 1 : 0][texture ? 0 : 1]); } void DrawGX::BeginDrawShadowVolume(u8 alpha) { diff --git a/src/egg/gfxe/eggLightTextureManager.cpp b/src/egg/gfxe/eggLightTextureManager.cpp index 024815df..bcf72568 100644 --- a/src/egg/gfxe/eggLightTextureManager.cpp +++ b/src/egg/gfxe/eggLightTextureManager.cpp @@ -63,11 +63,10 @@ int LightTextureManager::replaceModelTexture(int index, ModelEx* pMdl) const { GXTexObj texObj; mppLightTextures[index]->getTexObj(&texObj); - int TODO; - int ret = pMdl->replaceTexture(mppLightTextures[index]->getName(), TODO, + int ret = pMdl->replaceTexture(mppLightTextures[index]->getName(), texObj, false, &result, 0xFF, false); - pMdl->replaceTexture(mppLightTextures[index]->getName(), TODO, false, NULL, - 0, true); + pMdl->replaceTexture(mppLightTextures[index]->getName(), texObj, false, + NULL, 0, true); for (int i = 0; i < (u16)ret; i++) { u16 matIndex = result.data[i].s;