Skip to content

Commit

Permalink
CMoviePlayer progress
Browse files Browse the repository at this point in the history
  • Loading branch information
Antidote committed Oct 24, 2024
1 parent a425ca9 commit 62035f1
Show file tree
Hide file tree
Showing 11 changed files with 396 additions and 19 deletions.
4 changes: 2 additions & 2 deletions config/GM8E01_00/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6574,7 +6574,7 @@ DisintegrateDraw__10CModelDataFRC13CStateManagerRC12CTransform4fRC8CTextureRC6CC
DisintegrateDraw__10CModelDataF11EWhichModelRC12CTransform4fRC8CTextureRC6CColor = .text:0x8011615C; // type:function size:0x144 scope:global
RenderThermal__10CModelDataCFRC12CTransform4fRC6CColorRC6CColorRC11CModelFlags = .text:0x801162A0; // type:function size:0x114 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
MultiLightingDrawCallback__10CModelDataFPCfPCfPC25SMultiLightingDrawContext = .text:0x801164B8; // type:function size:0x188 scope:global
FlatDrawCallback__10CModelDataFPCfPCfPC16SFlatDrawContext = .text:0x80116640; // type:function size:0x4C scope:global
Expand Down Expand Up @@ -15043,7 +15043,7 @@ __dt__Q24rstl56vector<Q24rstl12auto_ptr<Uc>,Q24rstl17rmemory_allocator>Fv = .tex
PumpIndexLoad__12CMoviePlayerFv = .text:0x8035CA80; // type:function size:0x49C scope:global
__ct__12CMoviePlayerFPCcfb = .text:0x8035CF1C; // type:function size:0x204 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
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
Expand Down
4 changes: 2 additions & 2 deletions config/GM8E01_01/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ MetroidPrime/main.cpp:
.data start:0x803D8F40 end:0x803D9088
.bss start:0x803F7740 end:0x80457AD8
.sdata start:0x805A6DA0 end:0x805A6DB0
.sbss start:0x805A8E00 end:0x805A8E38
.sbss start:0x805A8E00 end:0x805A8E58
.sdata2 start:0x805A9F00 end:0x805A9F68

MetroidPrime/Cameras/CCameraManager.cpp:
Expand Down Expand Up @@ -4298,7 +4298,7 @@ musyx/runtime/hw_aramdma.c:

musyx/runtime/hw_dolphin.c:
.text start:0x803B4E18 end:0x803B5310
.bss start:0x80567A80 end:0x80569AE8
.bss start:0x80567A80 end:0x80569AE0
.sbss start:0x805A9D50 end:0x805A9D78

musyx/runtime/hw_memory.c:
Expand Down
11 changes: 6 additions & 5 deletions config/GM8E01_01/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6576,7 +6576,7 @@ DisintegrateDraw__10CModelDataFRC13CStateManagerRC12CTransform4fRC8CTextureRC6CC
DisintegrateDraw__10CModelDataF11EWhichModelRC12CTransform4fRC8CTextureRC6CColor = .text:0x801161D8; // type:function size:0x144 scope:global
RenderThermal__10CModelDataCFRC12CTransform4fRC6CColorRC6CColorRC11CModelFlags = .text:0x8011631C; // type:function size:0x114 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
MultiLightingDrawCallback__10CModelDataFPCfPCfPC25SMultiLightingDrawContext = .text:0x80116534; // type:function size:0x188 scope:global
FlatDrawCallback__10CModelDataFPCfPCfPC16SFlatDrawContext = .text:0x801166BC; // type:function size:0x4C scope:global
Expand Down Expand Up @@ -15058,7 +15058,7 @@ __dt__Q24rstl56vector<Q24rstl12auto_ptr<Uc>,Q24rstl17rmemory_allocator>Fv = .tex
PumpIndexLoad__12CMoviePlayerFv = .text:0x8035CC5C; // type:function size:0x49C scope:global
__ct__12CMoviePlayerFPCcfb = .text:0x8035D0F8; // type:function size:0x204 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
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
Expand Down Expand Up @@ -19388,7 +19388,8 @@ aramQueueLo = .bss:0x80567170; // 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
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_prep_callback = .bss:0x80569B18; // type:object size:0x30 scope:local
__block_for_stream_status = .bss:0x80569B48; // type:object size:0x30 scope:local
Expand Down Expand Up @@ -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_805A8C70 = .sbss:0x805A8E50; // type:object size:0x4 scope:global data:4byte
lbl_805A8C74 = .sbss:0x805A8E54; // type:object size:0x1 scope:global data:byte
lbl_805A8C78 = .sbss:0x805A8E58; // type:object size:0x1 scope:global data:byte
lbl_805A8C7C = .sbss:0x805A8E5C; // type:object size:0x4 scope:global data:4byte
gUseSurfaceHack = .sbss:0x805A8E58; // type:object size:0x1 scope:global data:byte
gSR_Hack = .sbss:0x805A8E5C; // type:object size:0x4 scope:global data:4byte
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_805A8C84 = .sbss:0x805A8E64; // type:object size:0x4 scope:global data:float
Expand Down
26 changes: 19 additions & 7 deletions include/Kyoto/Graphics/CMoviePlayer.hpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
#ifndef _CMOVIEPLAYER
#define _CMOVIEPLAYER

#include "Kyoto/CDvdFile.hpp"
#include "types.h"

class CMoviePlayer {
public:
static void SetSfxVolume(uchar);
static void SetSfxVolume(uchar);

CMoviePlayer(const char*, float, bool, bool);
~CMoviePlayer();
CMoviePlayer(const char*, float, bool, bool);
~CMoviePlayer();

void Update(float);
bool DrawVideo() const;
void Update(float);
bool DrawVideo() const;

private:
char x0_pad[0x100];
private:
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
1 change: 1 addition & 0 deletions include/Kyoto/Math/CQuaternion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class CNUQuaternion;

class CQuaternion {
public:
CQuaternion(CInputStream& in);
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) {}

Expand Down
2 changes: 1 addition & 1 deletion include/Kyoto/Math/CRelAngle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

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

private:
CRelAngle(float rad) : x0_angle(rad) {}

float x0_angle;
};
Expand Down
2 changes: 1 addition & 1 deletion include/MetroidPrime/CModelData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class CModelData {
CModelData();
CModelData(const CAnimRes&);
CModelData(const CStaticRes&);
// CModelData(const CModelData& other);
CModelData(const CModelData& other);
~CModelData();

CAdvancementDeltas AdvanceAnimation(float dt, CStateManager& mgr, TAreaId aid, bool advTree);
Expand Down
116 changes: 116 additions & 0 deletions src/Kyoto/Graphics/CCubeMoviePlayer.cpp
Original file line number Diff line number Diff line change
@@ -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) {

}
86 changes: 86 additions & 0 deletions src/Kyoto/Graphics/DolphinCModel.cpp
Original file line number Diff line number Diff line change
@@ -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);
}
Loading

0 comments on commit 62035f1

Please sign in to comment.