CMoviePlayer progress

This commit is contained in:
Phillip Stephens 2024-10-24 14:58:22 -07:00
parent a425ca9b42
commit 62035f1dba
11 changed files with 396 additions and 19 deletions

View File

@ -6574,7 +6574,7 @@ DisintegrateDraw__10CModelDataFRC13CStateManagerRC12CTransform4fRC8CTextureRC6CC
DisintegrateDraw__10CModelDataF11EWhichModelRC12CTransform4fRC8CTextureRC6CColor = .text:0x8011615C; // type:function size:0x144 scope:global DisintegrateDraw__10CModelDataF11EWhichModelRC12CTransform4fRC8CTextureRC6CColor = .text:0x8011615C; // type:function size:0x144 scope:global
RenderThermal__10CModelDataCFRC12CTransform4fRC6CColorRC6CColorRC11CModelFlags = .text:0x801162A0; // type:function size:0x114 scope:global RenderThermal__10CModelDataCFRC12CTransform4fRC6CColorRC6CColorRC11CModelFlags = .text:0x801162A0; // type:function size:0x114 scope:global
RenderThermal__10CModelDataCFPCfPCfRC6CColorRC6CColorRC11CModelFlags = .text:0x801163B4; // type:function size:0x50 scope:global RenderThermal__10CModelDataCFPCfPCfRC6CColorRC6CColorRC11CModelFlags = .text:0x801163B4; // type:function size:0x50 scope:global
ThermalDraw__10CModelDataRC6CColorRC6CColorRC11CModelFlags = .text:0x80116404; // type:function size:0x44 scope:global ThermalDraw__10CModelDataFRC6CColorRC6CColorRC11CModelFlags = .text:0x80116404; // type:function size:0x44 scope:global
MultipassDrawCallback__10CModelDataFPCfPCfPC21SMultipassDrawContext = .text:0x80116448; // type:function size:0x70 scope:global MultipassDrawCallback__10CModelDataFPCfPCfPC21SMultipassDrawContext = .text:0x80116448; // type:function size:0x70 scope:global
MultiLightingDrawCallback__10CModelDataFPCfPCfPC25SMultiLightingDrawContext = .text:0x801164B8; // type:function size:0x188 scope:global MultiLightingDrawCallback__10CModelDataFPCfPCfPC25SMultiLightingDrawContext = .text:0x801164B8; // type:function size:0x188 scope:global
FlatDrawCallback__10CModelDataFPCfPCfPC16SFlatDrawContext = .text:0x80116640; // type:function size:0x4C scope:global FlatDrawCallback__10CModelDataFPCfPCfPC16SFlatDrawContext = .text:0x80116640; // type:function size:0x4C scope:global
@ -15043,7 +15043,7 @@ __dt__Q24rstl56vector<Q24rstl12auto_ptr<Uc>,Q24rstl17rmemory_allocator>Fv = .tex
PumpIndexLoad__12CMoviePlayerFv = .text:0x8035CA80; // type:function size:0x49C scope:global PumpIndexLoad__12CMoviePlayerFv = .text:0x8035CA80; // type:function size:0x49C scope:global
__ct__12CMoviePlayerFPCcfb = .text:0x8035CF1C; // type:function size:0x204 scope:global __ct__12CMoviePlayerFPCcfb = .text:0x8035CF1C; // type:function size:0x204 scope:global
MyTHPYuv2RgbTextureSetup__FPvPvPvUsUs = .text:0x8035D120; // type:function size:0x174 scope:global MyTHPYuv2RgbTextureSetup__FPvPvPvUsUs = .text:0x8035D120; // type:function size:0x174 scope:global
MyTHPGXYuv2RgbSetup__Fb = .text:0x8035D294; // type:function size:0x51C scope:global MyTHPGXYuv2RgbSetup__Fbb = .text:0x8035D294; // type:function size:0x51C scope:global
MyTHPGXRestore__Fv = .text:0x8035D7B0; // type:function size:0x84 scope:global MyTHPGXRestore__Fv = .text:0x8035D7B0; // type:function size:0x84 scope:global
reserve__Q24rstl67vector<Q212CMoviePlayer14CTHPTextureSet,Q24rstl17rmemory_allocator>Fi = .text:0x8035D834; // type:function size:0x144 scope:global reserve__Q24rstl67vector<Q212CMoviePlayer14CTHPTextureSet,Q24rstl17rmemory_allocator>Fi = .text:0x8035D834; // type:function size:0x144 scope:global
construct<Q212CMoviePlayer14CTHPTextureSet>__4rstlFPvRCQ212CMoviePlayer14CTHPTextureSet = .text:0x8035D978; // type:function size:0x90 scope:global construct<Q212CMoviePlayer14CTHPTextureSet>__4rstlFPvRCQ212CMoviePlayer14CTHPTextureSet = .text:0x8035D978; // type:function size:0x90 scope:global

View File

@ -22,7 +22,7 @@ MetroidPrime/main.cpp:
.data start:0x803D8F40 end:0x803D9088 .data start:0x803D8F40 end:0x803D9088
.bss start:0x803F7740 end:0x80457AD8 .bss start:0x803F7740 end:0x80457AD8
.sdata start:0x805A6DA0 end:0x805A6DB0 .sdata start:0x805A6DA0 end:0x805A6DB0
.sbss start:0x805A8E00 end:0x805A8E38 .sbss start:0x805A8E00 end:0x805A8E58
.sdata2 start:0x805A9F00 end:0x805A9F68 .sdata2 start:0x805A9F00 end:0x805A9F68
MetroidPrime/Cameras/CCameraManager.cpp: MetroidPrime/Cameras/CCameraManager.cpp:
@ -4298,7 +4298,7 @@ musyx/runtime/hw_aramdma.c:
musyx/runtime/hw_dolphin.c: musyx/runtime/hw_dolphin.c:
.text start:0x803B4E18 end:0x803B5310 .text start:0x803B4E18 end:0x803B5310
.bss start:0x80567A80 end:0x80569AE8 .bss start:0x80567A80 end:0x80569AE0
.sbss start:0x805A9D50 end:0x805A9D78 .sbss start:0x805A9D50 end:0x805A9D78
musyx/runtime/hw_memory.c: musyx/runtime/hw_memory.c:

View File

@ -6576,7 +6576,7 @@ DisintegrateDraw__10CModelDataFRC13CStateManagerRC12CTransform4fRC8CTextureRC6CC
DisintegrateDraw__10CModelDataF11EWhichModelRC12CTransform4fRC8CTextureRC6CColor = .text:0x801161D8; // type:function size:0x144 scope:global DisintegrateDraw__10CModelDataF11EWhichModelRC12CTransform4fRC8CTextureRC6CColor = .text:0x801161D8; // type:function size:0x144 scope:global
RenderThermal__10CModelDataCFRC12CTransform4fRC6CColorRC6CColorRC11CModelFlags = .text:0x8011631C; // type:function size:0x114 scope:global RenderThermal__10CModelDataCFRC12CTransform4fRC6CColorRC6CColorRC11CModelFlags = .text:0x8011631C; // type:function size:0x114 scope:global
RenderThermal__10CModelDataCFPCfPCfRC6CColorRC6CColorRC11CModelFlags = .text:0x80116430; // type:function size:0x50 scope:global RenderThermal__10CModelDataCFPCfPCfRC6CColorRC6CColorRC11CModelFlags = .text:0x80116430; // type:function size:0x50 scope:global
ThermalDraw__10CModelDataRC6CColorRC6CColorRC11CModelFlags = .text:0x80116480; // type:function size:0x44 scope:global ThermalDraw__10CModelDataFRC6CColorRC6CColorRC11CModelFlags = .text:0x80116480; // type:function size:0x44 scope:global
MultipassDrawCallback__10CModelDataFPCfPCfPC21SMultipassDrawContext = .text:0x801164C4; // type:function size:0x70 scope:global MultipassDrawCallback__10CModelDataFPCfPCfPC21SMultipassDrawContext = .text:0x801164C4; // type:function size:0x70 scope:global
MultiLightingDrawCallback__10CModelDataFPCfPCfPC25SMultiLightingDrawContext = .text:0x80116534; // type:function size:0x188 scope:global MultiLightingDrawCallback__10CModelDataFPCfPCfPC25SMultiLightingDrawContext = .text:0x80116534; // type:function size:0x188 scope:global
FlatDrawCallback__10CModelDataFPCfPCfPC16SFlatDrawContext = .text:0x801166BC; // type:function size:0x4C scope:global FlatDrawCallback__10CModelDataFPCfPCfPC16SFlatDrawContext = .text:0x801166BC; // type:function size:0x4C scope:global
@ -15058,7 +15058,7 @@ __dt__Q24rstl56vector<Q24rstl12auto_ptr<Uc>,Q24rstl17rmemory_allocator>Fv = .tex
PumpIndexLoad__12CMoviePlayerFv = .text:0x8035CC5C; // type:function size:0x49C scope:global PumpIndexLoad__12CMoviePlayerFv = .text:0x8035CC5C; // type:function size:0x49C scope:global
__ct__12CMoviePlayerFPCcfb = .text:0x8035D0F8; // type:function size:0x204 scope:global __ct__12CMoviePlayerFPCcfb = .text:0x8035D0F8; // type:function size:0x204 scope:global
MyTHPYuv2RgbTextureSetup__FPvPvPvUsUs = .text:0x8035D2FC; // type:function size:0x174 scope:global MyTHPYuv2RgbTextureSetup__FPvPvPvUsUs = .text:0x8035D2FC; // type:function size:0x174 scope:global
MyTHPGXYuv2RgbSetup__Fb = .text:0x8035D470; // type:function size:0x51C scope:global MyTHPGXYuv2RgbSetup__Fbb = .text:0x8035D470; // type:function size:0x51C scope:global
MyTHPGXRestore__Fv = .text:0x8035D98C; // type:function size:0x84 scope:global MyTHPGXRestore__Fv = .text:0x8035D98C; // type:function size:0x84 scope:global
reserve__Q24rstl67vector<Q212CMoviePlayer14CTHPTextureSet,Q24rstl17rmemory_allocator>Fi = .text:0x8035DA10; // type:function size:0x144 scope:global reserve__Q24rstl67vector<Q212CMoviePlayer14CTHPTextureSet,Q24rstl17rmemory_allocator>Fi = .text:0x8035DA10; // type:function size:0x144 scope:global
construct<Q212CMoviePlayer14CTHPTextureSet>__4rstlFPvRCQ212CMoviePlayer14CTHPTextureSet = .text:0x8035DB54; // type:function size:0x90 scope:global construct<Q212CMoviePlayer14CTHPTextureSet>__4rstlFPvRCQ212CMoviePlayer14CTHPTextureSet = .text:0x8035DB54; // type:function size:0x90 scope:global
@ -19388,7 +19388,8 @@ aramQueueLo = .bss:0x80567170; // type:object size:0x284 scope:local
aramQueueHi = .bss:0x805673F4; // type:object size:0x284 scope:local aramQueueHi = .bss:0x805673F4; // type:object size:0x284 scope:local
aramStreamBuffers = .bss:0x80567678; // type:object size:0x400 scope:local data:4byte aramStreamBuffers = .bss:0x80567678; // type:object size:0x400 scope:local data:4byte
dsp_task = .bss:0x80567A80; // type:object size:0x50 scope:local dsp_task = .bss:0x80567A80; // type:object size:0x50 scope:local
dram_image = .bss:0x80567AE0; // type:object size:0x2008 scope:local dram_image = .bss:0x80567AE0; // type:object size:0x2000 scope:local
dummy = .bss:0x80569AE0; // type:object size:0x8 scope:global
__block_for_run_callback = .bss:0x80569AE8; // type:object size:0x30 scope:local __block_for_run_callback = .bss:0x80569AE8; // type:object size:0x30 scope:local
__block_for_prep_callback = .bss:0x80569B18; // type:object size:0x30 scope:local __block_for_prep_callback = .bss:0x80569B18; // type:object size:0x30 scope:local
__block_for_stream_status = .bss:0x80569B48; // type:object size:0x30 scope:local __block_for_stream_status = .bss:0x80569B48; // type:object size:0x30 scope:local
@ -21532,8 +21533,8 @@ lbl_805A8C68 = .sbss:0x805A8E48; // type:object size:0x4 scope:global data:4byte
lbl_805A8C6C = .sbss:0x805A8E4C; // type:object size:0x1 scope:global data:byte lbl_805A8C6C = .sbss:0x805A8E4C; // type:object size:0x1 scope:global data:byte
lbl_805A8C70 = .sbss:0x805A8E50; // type:object size:0x4 scope:global data:4byte lbl_805A8C70 = .sbss:0x805A8E50; // type:object size:0x4 scope:global data:4byte
lbl_805A8C74 = .sbss:0x805A8E54; // type:object size:0x1 scope:global data:byte lbl_805A8C74 = .sbss:0x805A8E54; // type:object size:0x1 scope:global data:byte
lbl_805A8C78 = .sbss:0x805A8E58; // type:object size:0x1 scope:global data:byte gUseSurfaceHack = .sbss:0x805A8E58; // type:object size:0x1 scope:global data:byte
lbl_805A8C7C = .sbss:0x805A8E5C; // type:object size:0x4 scope:global data:4byte gSR_Hack = .sbss:0x805A8E5C; // type:object size:0x4 scope:global data:4byte
init$1101 = .sbss:0x805A8E60; // type:object size:0x1 scope:global data:byte init$1101 = .sbss:0x805A8E60; // type:object size:0x1 scope:global data:byte
lbl_805A8C81 = .sbss:0x805A8E61; // type:object size:0x1 scope:global data:byte lbl_805A8C81 = .sbss:0x805A8E61; // type:object size:0x1 scope:global data:byte
lbl_805A8C84 = .sbss:0x805A8E64; // type:object size:0x4 scope:global data:float lbl_805A8C84 = .sbss:0x805A8E64; // type:object size:0x4 scope:global data:float

View File

@ -1,6 +1,7 @@
#ifndef _CMOVIEPLAYER #ifndef _CMOVIEPLAYER
#define _CMOVIEPLAYER #define _CMOVIEPLAYER
#include "Kyoto/CDvdFile.hpp"
#include "types.h" #include "types.h"
class CMoviePlayer { class CMoviePlayer {
@ -13,8 +14,19 @@ public:
void Update(float); void Update(float);
bool DrawVideo() const; bool DrawVideo() const;
private: private:
char x0_pad[0x100]; CDvdFile x0_movieFile;
uint x84_;
uint x88_;
uint x8c_;
uchar x90_;
uint x94_;
uint x98_;
uint x9c_;
uint xa0_;
uint xa4_;
uint xa8_;
// char x0_pad[0x100];
}; };
#endif // _CMOVIEPLAYER #endif // _CMOVIEPLAYER

View File

@ -12,6 +12,7 @@ class CNUQuaternion;
class CQuaternion { class CQuaternion {
public: public:
CQuaternion(CInputStream& in);
CQuaternion(float w, float x, float y, float z) : w(w), imaginary(x, y, z) {} CQuaternion(float w, float x, float y, float z) : w(w), imaginary(x, y, z) {}
CQuaternion(float w, const CVector3f& imaginary) : w(w), imaginary(imaginary) {} CQuaternion(float w, const CVector3f& imaginary) : w(w), imaginary(imaginary) {}

View File

@ -7,6 +7,7 @@
class CRelAngle { class CRelAngle {
public: public:
CRelAngle(float rad) : x0_angle(rad) {}
float AsDegrees() const { return x0_angle * (180.f / M_PIF); } float AsDegrees() const { return x0_angle * (180.f / M_PIF); }
float AsRadians() const { return x0_angle; } float AsRadians() const { return x0_angle; }
// ArcCosine__9CRelAngleFf weak // ArcCosine__9CRelAngleFf weak
@ -34,7 +35,6 @@ public:
static CRelAngle FromRadians(float rad) { return CRelAngle(rad); } static CRelAngle FromRadians(float rad) { return CRelAngle(rad); }
private: private:
CRelAngle(float rad) : x0_angle(rad) {}
float x0_angle; float x0_angle;
}; };

View File

@ -66,7 +66,7 @@ public:
CModelData(); CModelData();
CModelData(const CAnimRes&); CModelData(const CAnimRes&);
CModelData(const CStaticRes&); CModelData(const CStaticRes&);
// CModelData(const CModelData& other); CModelData(const CModelData& other);
~CModelData(); ~CModelData();
CAdvancementDeltas AdvanceAnimation(float dt, CStateManager& mgr, TAreaId aid, bool advTree); CAdvancementDeltas AdvanceAnimation(float dt, CStateManager& mgr, TAreaId aid, bool advTree);

View File

@ -0,0 +1,116 @@
#include <Kyoto/Graphics/CGX.hpp>
#include <Kyoto/Graphics/CMoviePlayer.hpp>
#include <Kyoto/Graphics/CTexture.hpp>
const char skInterlacePattern[32] = {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static void MyTHPGXRestore() {
CGX::SetZMode(TRUE, GX_ALWAYS, FALSE);
CGX::SetBlendMode(GX_BM_NONE, GX_BL_ONE, GX_BL_ZERO, GX_LO_SET);
CGX::SetNumTexGens(1);
CGX::SetNumChans(0);
CGX::SetNumTevStages(1);
CGX::SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL);
CGX::SetAlphaCompare(GX_ALWAYS, 0, GX_AOP_AND, GX_ALWAYS, 0);
}
static void MyTHPGXYuv2RgbSetup(bool r29, bool r30) {
GXVtxDescList attr[3] = {
{GX_VA_POS, GX_DIRECT},
{GX_VA_TEX0, GX_DIRECT},
{GX_VA_NULL, GX_NONE},
};
CGX::SetZMode(TRUE, GX_ALWAYS, FALSE);
CGX::SetBlendMode(GX_BM_NONE, GX_BL_ONE, GX_BL_ZERO, GX_LO_CLEAR);
CGX::SetNumChans(0);
CGX::SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY, FALSE, GX_PTIDENTITY);
CGX::SetTexCoordGen(GX_TEXCOORD1, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY, FALSE, GX_PTIDENTITY);
if (r30) {
CGX::SetNumTexGens(2);
CGX::SetNumTevStages(4);
} else {
CGX::SetNumTexGens(3);
CGX::SetTexCoordGen(GX_TEXCOORD2, GX_TG_MTX2x4, GX_TG_POS, GX_TEXMTX0, FALSE, GX_PTIDENTITY);
float n = r29 ? 0.25f : 0.f;
float mtx[8] = {0.125f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.25f, n};
GXLoadTexMtxImm((MtxPtr)mtx, GX_TEXMTX0, GX_MTX2x4);
GXTexObj obj;
GXInitTexObj(&obj, skInterlacePattern, 8, 4, GX_TF_I8, GX_REPEAT, GX_REPEAT, FALSE);
GXInitTexObjLOD(&obj, GX_NEAR, GX_NEAR, 0.f, 0.f, 0.f, FALSE, FALSE, GX_ANISO_1);
GXLoadTexObj(&obj, GX_TEXMAP3);
CTexture::InvalidateTexmap(GX_TEXMAP3);
CGX::SetTevOrder(GX_TEVSTAGE4, GX_TEXCOORD2, GX_TEXMAP3, GX_COLOR_NULL);
CGX::SetStandardTevColorAlphaOp(GX_TEVSTAGE4);
CGX::SetTevColorIn(GX_TEVSTAGE4, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_CPREV);
CGX::SetTevAlphaIn(GX_TEVSTAGE4, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_TEXA);
CGX::SetAlphaCompare(GX_LESS, 128, GX_AOP_AND, GX_ALWAYS, 0);
CGX::SetNumTevStages(5);
}
CGX::SetVtxDescv(attr);
GXSetColorUpdate(TRUE);
GXSetAlphaUpdate(FALSE);
GXInvalidateTexAll();
GXSetVtxAttrFmt(GX_VTXFMT7, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0);
GXSetVtxAttrFmt(GX_VTXFMT7, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBX8, 0);
CGX::SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD1, GX_TEXMAP1, GX_COLOR_NULL);
CGX::SetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_TEXC, GX_CC_KONST, GX_CC_C0);
CGX::SetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, false, GX_TEVPREV);
CGX::SetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_TEXA, GX_CA_KONST, GX_CA_A0);
CGX::SetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_SUB, GX_TB_ZERO, GX_CS_SCALE_1, false, GX_TEVPREV);
CGX::SetTevKColorSel(GX_TEVSTAGE0, GX_TEV_KCSEL_K0);
CGX::SetTevKAlphaSel(GX_TEVSTAGE0, GX_TEV_KASEL_K0_A);
CGX::SetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD1, GX_TEXMAP2, GX_COLOR_NULL);
CGX::SetTevColorIn(GX_TEVSTAGE1, GX_CC_ZERO, GX_CC_TEXC, GX_CC_KONST, GX_CC_CPREV);
CGX::SetTevColorOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_2, false, GX_TEVPREV);
CGX::SetTevAlphaIn(GX_TEVSTAGE1, GX_CA_ZERO, GX_CA_TEXA, GX_CA_KONST, GX_CA_APREV);
CGX::SetTevAlphaOp(GX_TEVSTAGE1, GX_TEV_SUB, GX_TB_ZERO, GX_CS_SCALE_1, false, GX_TEVPREV);
CGX::SetTevKColorSel(GX_TEVSTAGE1, GX_TEV_KCSEL_K1);
CGX::SetTevKAlphaSel(GX_TEVSTAGE1, GX_TEV_KASEL_K1_A);
CGX::SetTevOrder(GX_TEVSTAGE2, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL);
CGX::SetTevColorIn(GX_TEVSTAGE2, GX_CC_ZERO, GX_CC_TEXC, GX_CC_ONE, GX_CC_CPREV);
CGX::SetTevColorOp(GX_TEVSTAGE2, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
CGX::SetTevAlphaIn(GX_TEVSTAGE2, GX_CA_TEXA, GX_CA_ZERO, GX_CA_ZERO, GX_CA_APREV);
CGX::SetTevAlphaOp(GX_TEVSTAGE2, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
CGX::SetTevOrder(GX_TEVSTAGE3, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR_NULL);
CGX::SetTevColorIn(GX_TEVSTAGE3, GX_CC_APREV, GX_CC_CPREV, GX_CC_KONST, GX_CC_ZERO);
CGX::SetTevColorOp(GX_TEVSTAGE3, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
CGX::SetTevAlphaIn(GX_TEVSTAGE3, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
CGX::SetTevAlphaOp(GX_TEVSTAGE3, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
CGX::SetTevKColorSel(GX_TEVSTAGE3, GX_TEV_KCSEL_K2);
GXSetTevColorS10(GX_TEVREG0, (GXColorS10){-90, 0, -114, 135});
CGX::SetTevKColor(GX_KCOLOR0, (GXColor){0, 0, 226, 88});
CGX::SetTevKColor(GX_KCOLOR1, (GXColor){179, 0, 0, 182});
CGX::SetTevKColor(GX_KCOLOR2, (GXColor){255, 0, 255, 128});
}
static void MyTHPYuv2RgbTextureSetup(void* y, void* u, void* v, ushort width, ushort height) {
GXTexObj yTex;
GXInitTexObj(&yTex, y, width, height, GX_TF_I8, GX_CLAMP, GX_CLAMP, FALSE);
GXInitTexObjLOD(&yTex, GX_NEAR, GX_NEAR, 0.f, 0.f, 0.f, FALSE, FALSE, GX_ANISO_1);
GXLoadTexObj(&yTex, GX_TEXMAP0);
GXTexObj uTex;
GXInitTexObj(&uTex, u, width / 2, height / 2, GX_TF_I8, GX_CLAMP, GX_CLAMP, FALSE);
GXInitTexObjLOD(&uTex, GX_NEAR, GX_NEAR, 0.f, 0.f, 0.f, FALSE, FALSE, GX_ANISO_1);
GXLoadTexObj(&uTex, GX_TEXMAP1);
GXTexObj vTex;
GXInitTexObj(&vTex, v, (s16)(width / 2), height / 2, GX_TF_I8, GX_CLAMP, GX_CLAMP, FALSE);
GXInitTexObjLOD(&vTex, GX_NEAR, GX_NEAR, 0.f, 0.f, 0.f, FALSE, FALSE, GX_ANISO_1);
GXLoadTexObj(&vTex, GX_TEXMAP2);
CTexture::InvalidateTexmap(GX_TEXMAP0);
CTexture::InvalidateTexmap(GX_TEXMAP1);
CTexture::InvalidateTexmap(GX_TEXMAP2);
}
CMoviePlayer::CMoviePlayer(const char* filepath, float fps, bool a, bool b)
: x0_movieFile(filepath) {
}

View File

@ -0,0 +1,86 @@
#include "Kyoto/Alloc/CMemory.hpp"
#include "Kyoto/Graphics/CCubeModel.hpp"
#include "Kyoto/Graphics/CCubeSurface.hpp"
#include "Kyoto/Math/CAABox.hpp"
#include "Kyoto/Math/CVector2f.hpp"
#include "dolphin/os/OSCache.h"
#include "dolphin/types.h"
#include <Kyoto/Graphics/CModel.hpp>
#include <Kyoto/Graphics/CGraphics.hpp>
#include <Kyoto/IObjectStore.hpp>
uint CModel::sTotalMemory = 0;
CModel* CModel::sThisFrameList = nullptr;
CModel* CModel::sOneFrameList = nullptr;
CModel* CModel::sTwoFrameList = nullptr;
static uchar* MemoryFromPartData(uchar** dataCur, int** secSizeCur) {
uchar* ret = **secSizeCur != 0 ? *dataCur : nullptr;
(*dataCur) += **secSizeCur;
(*secSizeCur)++;
return ret;
}
CModel::CModel(const rstl::auto_ptr< uchar >& data, int length, IObjectStore& store)
: x0_data(data)
, x4_dataLen(length)
, x28_modelInstance(nullptr)
, x2c_currentMatxIdx(0)
, x2e_lastMaterialFrame(0)
, x30_prev(nullptr)
, x34_next(sThisFrameList)
, x38_lastFrame(CGraphics::GetFrameCounter() - 2) {
uint sectionSizeStart = 0x2c;
uchar* dataPtr = data.get();
uint flags = *(uint*)(dataPtr + 8);
if (*(uint*)(dataPtr + 4) == 1) {
sectionSizeStart = 0x28;
}
int* secSizeCur = (int*)(dataPtr + sectionSizeStart);
uint numMatSets = 1;
if (*(uint*)(dataPtr + 4) > 1) {
numMatSets = *(uint*)(dataPtr + 0x28);
}
uchar* dataCur = dataPtr + (((sectionSizeStart + *(uint*)(dataPtr + 0x24) * 4) + 31) & ~31);
x18_matSets.reserve(numMatSets);
for (uint i = 0; i < numMatSets; ++i) {
x18_matSets.push_back(SShader(MemoryFromPartData(&dataCur, &secSizeCur)));
SShader& shader = x18_matSets.back();
CCubeModel::MakeTexturesFromMats(shader.x10_data, shader.x0_textures, store, true);
x4_dataLen += shader.x0_textures.size() * 12;
}
CVector3f* positions = reinterpret_cast< CVector3f* >(MemoryFromPartData(&dataCur, &secSizeCur));
CVector3f* normals = reinterpret_cast< CVector3f* >(MemoryFromPartData(&dataCur, &secSizeCur));
uint* vtxColors = reinterpret_cast< uint* >(MemoryFromPartData(&dataCur, &secSizeCur));
CVector2f* floatUvs = reinterpret_cast< CVector2f* >(MemoryFromPartData(&dataCur, &secSizeCur));
ushort* shortUvs = nullptr;
if ((flags >> 2) & 1) {
shortUvs = reinterpret_cast< ushort* >(MemoryFromPartData(&dataCur, &secSizeCur));
}
uint* surfaceInfo = reinterpret_cast< uint* >(MemoryFromPartData(&dataCur, &secSizeCur));
uint surfaceCount = *surfaceInfo;
x8_surfaces.reserve(surfaceCount);
for (int i = 0; i < surfaceCount; ++i) {
x8_surfaces.push_back(
reinterpret_cast< CCubeSurface* >(MemoryFromPartData(&dataCur, &secSizeCur)));
}
SShader& shader = x18_matSets.front();
const CAABox* box = reinterpret_cast< const CAABox* >(dataPtr + 8);
x28_modelInstance =
rs_new CCubeModel(&x8_surfaces, &shader.x0_textures, shader.x10_data, positions, normals,
vtxColors, floatUvs, shortUvs, *box, (flags >> 1) & 1, true, -1);
sThisFrameList = this;
if (x34_next != nullptr) {
x34_next->x30_prev = this;
}
x4_dataLen += x8_surfaces.size() * 4;
sTotalMemory += x4_dataLen;
DCFlushRange(x0_data.get(), x4_dataLen);
}

View File

@ -0,0 +1,153 @@
#include "Kyoto/Math/CRelAngle.hpp"
#include "Kyoto/Math/CVector3f.hpp"
#include "Kyoto/Streams/CInputStream.hpp"
#include <Kyoto/Math/CMatrix3f.hpp>
const CMatrix3f CMatrix3f::sIdentity = CMatrix3f(1.f, 0.f, 0.f, 0.f, 1.f, 0.f, 0.f, 0.f, 1.f);
CMatrix3f::CMatrix3f(const CVector3f& _m0, const CVector3f& _m1, const CVector3f& _m2)
: m00(_m0.GetX())
, m01(_m0.GetY())
, m02(_m0.GetZ())
, m10(_m1.GetX())
, m11(_m1.GetY())
, m12(_m1.GetZ())
, m20(_m2.GetX())
, m21(_m2.GetY())
, m22(_m2.GetZ()) {}
CMatrix3f::CMatrix3f(const CMatrix3f& left, float leftScale, const CMatrix3f& right,
float rightScale) {
m00 = left.m00 * leftScale + right.m00 * rightScale;
m01 = left.m01 * leftScale + right.m01 * rightScale;
m02 = left.m02 * leftScale + right.m02 * rightScale;
m10 = left.m10 * leftScale + right.m10 * rightScale;
m11 = left.m11 * leftScale + right.m11 * rightScale;
m12 = left.m12 * leftScale + right.m12 * rightScale;
m20 = left.m20 * leftScale + right.m20 * rightScale;
m21 = left.m21 * leftScale + right.m21 * rightScale;
m22 = left.m22 * leftScale + right.m22 * rightScale;
}
CMatrix3f::CMatrix3f(CInputStream& in) {
m00 = in.ReadFloat();
m01 = in.ReadFloat();
m02 = in.ReadFloat();
m10 = in.ReadFloat();
m11 = in.ReadFloat();
m12 = in.ReadFloat();
m20 = in.ReadFloat();
m21 = in.ReadFloat();
m22 = in.ReadFloat();
}
void CMatrix3f::RotateY(const CRelAngle& angle) {
const float dVar1 = sin(angle.AsRadians());
const float dVar2 = cos(angle.AsRadians());
m00 = dVar2;
m01 = 0.f;
m02 = dVar1;
m10 = 0.f;
m11 = 1.f;
m12 = 0.f;
m20 = -dVar1;
m21 = 0.f;
m22 = dVar2;
}
void CMatrix3f::RotateZ(const CRelAngle& angle) {
const float dVar1 = sin(angle.AsRadians());
const float dVar2 = cos(angle.AsRadians());
m00 = dVar2;
m01 = -dVar1;
m02 = 0.f;
m10 = dVar1;
m11 = dVar2;
m12 = 0.f;
m20 = 0.f;
m21 = 0.f;
m22 = 1.f;
}
CMatrix3f CMatrix3f::Orthonormalized() const {
CVector3f local_20(m00, m10, m20);
local_20.Normalize();
CVector3f local_2c(m01, m11, m21);
local_2c.Normalize();
CVector3f local_38 = CVector3f::Cross(local_20, local_2c);
local_38.Normalize();
local_2c = CVector3f::Cross(local_38, local_20);
local_2c.Normalize();
return CMatrix3f(local_20, local_2c, local_38);
}
const CVector3f CMatrix3f::operator*(const CVector3f& vec) const {
const float x = vec.GetX() * Get00() + vec.GetY() * Get01() + vec.GetZ() * Get02();
const float y = vec.GetX() * Get10() + vec.GetY() * Get11() + vec.GetZ() * Get12();
const float z = vec.GetX() * Get20() + vec.GetY() * Get21() + vec.GetZ() * Get22();
return CVector3f(x, y, z);
}
const CMatrix3f CMatrix3f::operator*(const CMatrix3f& mat) const {
//(__return_storage_ptr__->x).x = m00 * otherm00 + m01 * otherm10 + m02 * otherm20;
const float _m00 = m00 * mat.m00 + m01 * mat.m10 + m02 * mat.m20;
//(__return_storage_ptr__->x).y = m00 * otherm01 + m01 * other.m11 + m02 * other.m21;
const float _m01 = m00 * mat.m01 + m01 * mat.m11 + m02 * mat.m21;
//(__return_storage_ptr__->x).z = m00 * otherm02 + m01 * otherm12 + m02 * otherm22;
const float _m02 = m00 * mat.m02 + m01 * mat.m12 + m02 * mat.m22;
//(__return_storage_ptr__->y).x = m10 * otherm00 + m11 * otherm10 + m12 * otherm20;
const float _m10 = m10 * mat.m02 + m11 * mat.m10 + m12 * mat.m20;
//(__return_storage_ptr__->y).y = m10 * otherm01 + m11 * otherm11 + m12 * otherm21;
const float _m11 = m10 * mat.m01 + m11 * mat.m11 + m12 * mat.m21;
//(__return_storage_ptr__->y).z = m10 * otherm02 + m11 * otherm12 + m12 * otherm22;
const float _m12 = m10 * mat.m02 + m11 * mat.m12 + m12 * mat.m22;
//(__return_storage_ptr__->z).x = m20 * otherm00 + m21 * otherm10 + m22 * otherm20;
const float _m20 = m20 * mat.m00 + m21 * mat.m10 + m22 * mat.m20;
//(__return_storage_ptr__->z).y = m20 * otherm01 + m21 * otherm11 + m22 * otherm21;
const float _m21 = m20 * mat.m01 + m21 * mat.m11 + m22 * mat.m21;
//(__return_storage_ptr__->z).z = m20 * otherm02 + m21 * otherm12 + m22 * otherm22;
const float _m22 = m20 * mat.m02 + m21 * mat.m12 + m22 * mat.m22;
return CMatrix3f(_m00, _m01, _m02, _m10, _m11, _m12, _m20, _m21, _m22);
}
float CMatrix3f::Determinant() const {
return m00 * (m11 * m22 - m12 * m21) + m01 * (m12 * m20 - m10 * m22) +
m02 * (m10 * m21 - m11 * m20);
}
void CMatrix3f::AddScaledMatrix(const CMatrix3f& mat, float scale) {
m00 = mat.m00 * scale + m00;
m01 = mat.m01 * scale + m01;
m02 = mat.m02 * scale + m02;
m10 = mat.m10 * scale + m10;
m11 = mat.m11 * scale + m11;
m12 = mat.m12 * scale + m12;
m20 = mat.m20 * scale + m20;
m21 = mat.m21 * scale + m21;
m22 = mat.m22 * scale + m22;
}
CMatrix3f::CMatrix3f(const CMatrix3f& other) {
m00 = other.m00;
m01 = other.m01;
m02 = other.m02;
m10 = other.m10;
m11 = other.m11;
m12 = other.m12;
m20 = other.m20;
m21 = other.m21;
m22 = other.m22;
}
const CMatrix3f& CMatrix3f::operator=(const CMatrix3f& other) {
m00 = other.m00;
m01 = other.m01;
m02 = other.m02;
m10 = other.m10;
m11 = other.m11;
m12 = other.m12;
m20 = other.m20;
m21 = other.m21;
m22 = other.m22;
}

View File

@ -2,9 +2,17 @@
#include "Kyoto/Math/CRelAngle.hpp" #include "Kyoto/Math/CRelAngle.hpp"
#include "Kyoto/Math/CUnitVector3f.hpp" #include "Kyoto/Math/CUnitVector3f.hpp"
#include "Kyoto/Streams/CInputStream.hpp"
const CQuaternion CQuaternion::sNoRotation = CQuaternion(1.f, CVector3f(0.f, 0.f, 0.f));
static const CVector3f XAxis(1.f, 0.f, 0.f);
static const CVector3f YAxis(0.f, 1.f, 0.f);
static const CVector3f ZAxis(0.f, 0.f, 1.f);
CQuaternion::CQuaternion(CInputStream& in) : w(in.ReadFloat()), imaginary(in) {}
CQuaternion CQuaternion::AxisAngle(const CUnitVector3f& axis, const CRelAngle& angle) { CQuaternion CQuaternion::AxisAngle(const CUnitVector3f& axis, const CRelAngle& angle) {
float w = cosine(angle / 2.f); double w = cos(angle.AsRadians() / 2.f);
CVector3f vec = axis * sine(angle / 2.f); CVector3f vec = axis * sine(angle / 2.f);
return CQuaternion(w, vec); return CQuaternion(w, vec);
} }