Skip to content

Commit

Permalink
m3d matching + some EGG declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
elijah-thomas774 committed Sep 12, 2024
1 parent 37da66e commit 6fed118
Show file tree
Hide file tree
Showing 19 changed files with 523 additions and 51 deletions.
3 changes: 2 additions & 1 deletion config/SOUE01/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@ f/f_manager.cpp:

m/m3d/m3d.cpp:
.text start:0x802E3E50 end:0x802E4714
.sbss start:0x80575BD0 end:0x80575BE8
.sbss start:0x80575BD0 end:0x80575BEC
.sdata2 start:0x8057CCB8 end:0x8057CCBC

m/m3d/m_proc.cpp:
.text start:0x802E4720 end:0x802E48D4
Expand Down
28 changes: 14 additions & 14 deletions config/SOUE01/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2859,7 +2859,7 @@ fn_80065050 = .text:0x80065050; // type:function size:0x164
fn_800651C0 = .text:0x800651C0; // type:function size:0x204
fn_800653D0 = .text:0x800653D0; // type:function size:0x194
fn_80065570 = .text:0x80065570; // type:function size:0x20
fn_80065590 = .text:0x80065590; // type:function size:0x54
create__6mVideoFv = .text:0x80065590; // type:function size:0x54
fn_800655F0 = .text:0x800655F0; // type:function size:0x4
fn_80065600 = .text:0x80065600; // type:function size:0x3C
fn_80065640 = .text:0x80065640; // type:function size:0x164
Expand Down Expand Up @@ -24784,7 +24784,7 @@ fn_80454B40 = .text:0x80454B40; // type:function size:0x9C
fn_80454BE0 = .text:0x80454BE0; // type:function size:0x18
fn_80454C00 = .text:0x80454C00; // type:function size:0x70
fn_80454C70 = .text:0x80454C70; // type:function size:0x1DC
fn_80454E50 = .text:0x80454E50; // type:function size:0x60
GetCameraMtx__Q34nw4r3g3d6CameraCFPQ34nw4r4math5MTX34 = .text:0x80454E50; // type:function size:0x60
fn_80454EB0 = .text:0x80454EB0; // type:function size:0xDC
fn_80454F90 = .text:0x80454F90; // type:function size:0xD0
fn_80455060 = .text:0x80455060; // type:function size:0x80
Expand Down Expand Up @@ -24894,11 +24894,11 @@ SetCurrentCamera__Q34nw4r3g3d7ScnRootFi = .text:0x80459AA0; // type:function siz
fn_80459AB0 = .text:0x80459AB0; // type:function size:0x5C
fn_80459B10 = .text:0x80459B10; // type:function size:0x234
fn_80459D50 = .text:0x80459D50; // type:function size:0x188
fn_80459EE0 = .text:0x80459EE0; // type:function size:0x4C
CalcWorld__Q34nw4r3g3d7ScnRootFv = .text:0x80459EE0; // type:function size:0x4C
CalcMaterial__Q34nw4r3g3d7ScnRootFv = .text:0x80459F30; // type:function size:0x1C
fn_80459F50 = .text:0x80459F50; // type:function size:0x78
fn_80459FD0 = .text:0x80459FD0; // type:function size:0xEC
fn_8045A0C0 = .text:0x8045A0C0; // type:function size:0x60
CalcView__Q34nw4r3g3d7ScnRootFv = .text:0x80459F50; // type:function size:0x78
GatherDrawScnObj__Q34nw4r3g3d7ScnRootFv = .text:0x80459FD0; // type:function size:0xEC
ZSort__Q34nw4r3g3d7ScnRootFv = .text:0x8045A0C0; // type:function size:0x60
DrawOpa__Q34nw4r3g3d7ScnRootFv = .text:0x8045A120; // type:function size:0x74
DrawXlu__Q34nw4r3g3d7ScnRootFv = .text:0x8045A1A0; // type:function size:0x74
fn_8045A220 = .text:0x8045A220; // type:function size:0xFC
Expand Down Expand Up @@ -39811,7 +39811,7 @@ lbl_80575210 = .sbss:0x80575210; // type:object size:0x4 data:4byte
lbl_80575214 = .sbss:0x80575214; // type:object size:0x4 data:4byte
lbl_80575218 = .sbss:0x80575218; // type:object size:0x8 data:4byte
lbl_80575220 = .sbss:0x80575220; // type:object size:0x8 data:4byte
lbl_80575228 = .sbss:0x80575228; // type:object size:0x4 data:4byte
ms_configuration_p__6dSys_c = .sbss:0x80575228; // type:object size:0x4 data:4byte
lbl_8057522C = .sbss:0x8057522C; // type:object size:0x4 data:4byte
lbl_80575230 = .sbss:0x80575230; // type:object size:0x4 data:4byte
lbl_80575234 = .sbss:0x80575234; // type:object size:0x4 data:4byte
Expand Down Expand Up @@ -40298,11 +40298,11 @@ lbl_80575BC8 = .sbss:0x80575BC8; // type:object size:0x4 data:4byte
lbl_80575BCC = .sbss:0x80575BCC; // type:object size:0x1 data:byte
l_allocator_p__Q23m3d8internal = .sbss:0x80575BD0; // type:object size:0x4 data:4byte
l_scnRoot_p__Q23m3d8internal = .sbss:0x80575BD4; // type:object size:0x4 data:4byte
lbl_80575BD8 = .sbss:0x80575BD8; // type:object size:0x4 data:4byte
lbl_80575BDC = .sbss:0x80575BDC; // type:object size:0x4 data:4byte
lbl_80575BE0 = .sbss:0x80575BE0; // type:object size:0x4 data:4byte
lbl_80575BE4 = .sbss:0x80575BE4; // type:object size:0x4 data:4byte
lbl_80575BE8 = .sbss:0x80575BE8; // type:object size:0x8 data:4byte
l_numLightMgr__Q23m3d8internal = .sbss:0x80575BD8; // type:object size:0x4 data:4byte
l_lightMgr_pp__Q23m3d8internal = .sbss:0x80575BDC; // type:object size:0x4 data:4byte
l_numFogMgr__Q23m3d8internal = .sbss:0x80575BE0; // type:object size:0x4 data:4byte
l_fogMgr_pp__Q23m3d8internal = .sbss:0x80575BE4; // type:object size:0x4 data:4byte
l_alignment__Q23m3d8internal = .sbss:0x80575BE8; // type:object size:0x4 data:4byte
lbl_80575BF0 = .sbss:0x80575BF0; // type:object size:0x4 data:4byte
lbl_80575BF4 = .sbss:0x80575BF4; // type:object size:0x4 data:4byte
lbl_80575BF8 = .sbss:0x80575BF8; // type:object size:0x4 data:4byte
Expand Down Expand Up @@ -40336,7 +40336,7 @@ s_GetWPADInfoCount__4mPad = .sbss:0x80575C6C; // type:object size:0x4 data:4byte
lbl_80575C70 = .sbss:0x80575C70; // type:object size:0x8 data:float
lbl_80575C78 = .sbss:0x80575C78; // type:object size:0x8 data:float
lbl_80575C80 = .sbss:0x80575C80; // type:object size:0x8 data:float
lbl_80575C88 = .sbss:0x80575C88; // type:object size:0x8 data:4byte
m_video__6mVideo = .sbss:0x80575C88; // type:object size:0x8 data:4byte
lbl_80575C90 = .sbss:0x80575C90; // type:object size:0x4 data:4byte
lbl_80575C94 = .sbss:0x80575C94; // type:object size:0x4 data:4byte
lbl_80575C98 = .sbss:0x80575C98; // type:object size:0x8 data:4byte
Expand Down Expand Up @@ -45834,7 +45834,7 @@ lbl_8057CC9C = .sdata2:0x8057CC9C; // type:object size:0x4 data:float
lbl_8057CCA0 = .sdata2:0x8057CCA0; // type:object size:0x4 data:float
lbl_8057CCA8 = .sdata2:0x8057CCA8; // type:object size:0x8 data:double
lbl_8057CCB0 = .sdata2:0x8057CCB0; // type:object size:0x8 data:float
lbl_8057CCB8 = .sdata2:0x8057CCB8; // type:object size:0x8 data:float
lbl_8057CCB8 = .sdata2:0x8057CCB8; // type:object size:0x4 data:float
lbl_8057CCC0 = .sdata2:0x8057CCC0; // type:object size:0x4 data:float
lbl_8057CCC4 = .sdata2:0x8057CCC4; // type:object size:0x4 data:float
lbl_8057CCC8 = .sdata2:0x8057CCC8; // type:object size:0x8 data:double
Expand Down
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def nw4rLib(lib_name, objects, extra_cflags=[]):
"cflags": cflags_framework,
"host": False,
"objects": [
Object(NonMatching, "m/m3d/m3d.cpp"),
Object(Matching, "m/m3d/m3d.cpp"),
Object(Matching, "m/m3d/m_proc.cpp"),
Object(Matching, "m/m3d/m_anmchr.cpp"),
Object(Matching, "m/m3d/m_anmchrblend.cpp"),
Expand Down
3 changes: 3 additions & 0 deletions include/egg/core/eggSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ class BaseSystem {
}
};

template <class TVideo, class TDisplay, class TXfbManager, class TAudioManager, class TSceneManager, class TPerfView>
class TSystem : ConfigurationData {};

} // namespace EGG

#endif
34 changes: 34 additions & 0 deletions include/egg/gfx/eggDrawGX.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#ifndef EGG_DRAWGX_H
#define EGG_DRAWGX_H

#include <common.h>
#include <egg/core/eggHeap.h>
#include <egg/math/eggMatrix.h>
#include <rvl/GX.h>

namespace EGG {

class DrawGX {
public:
static void Initialize(Heap *);

static GXTexMapID GetTexMapDefault();

// TODO MORE

/* static ?? s_DL */

static Matrix34f s_cameraMtx;

/* static ?? s_flag */

static GXColor BLACK;
static GXColor WHITE;
static GXColor GREEN;
static GXColor RED;
static GXColor BLUE;
};

} // namespace EGG

#endif
28 changes: 28 additions & 0 deletions include/egg/gfx/eggFog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef EGG_FOG_H
#define EGG_FOG_H

#include <egg/prim/eggBinary.h>
#include <nw4r/types_nw4r.h>

namespace EGG {

// TODO: Add members
class FogManager : IBinary<FogManager> {
public:
FogManager(u16);
virtual ~FogManager();
virtual void SetBinaryInner(Bin &) override;
virtual void GetBinaryInner(Bin *) const override;
virtual size_t GetBinarySize() override;
virtual void SetBinaryInner(const Bin &, const Bin &, f32) override;

void Calc();
void CopyToG3D(nw4r::g3d::ScnRoot *) const;

/* 0x04 */ u8 mFlag;
/* 0x05 */ u8 TODO[0x10 - 0x05];
};

} // namespace EGG

#endif
24 changes: 24 additions & 0 deletions include/egg/gfx/eggFrustum.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#ifndef EGG_FRUSTUM_H
#define EGG_FRUSTUM_H

#include <common.h>
#include <nw4r/g3d/g3d_camera.h>

namespace EGG {

// TODO: Fill out more
class Frustum {
public:
enum CanvasMode {};
enum ProjectionType {};

u8 TODO_0x00[0x38];
// vt at 0x38
virtual ~Frustum();
virtual void SetProjectionGX() const;
virtual void CopyToG3D(nw4r::g3d::Camera) const;
};

} // namespace EGG

#endif
30 changes: 30 additions & 0 deletions include/egg/gfx/eggGfxEngine.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#ifndef EGG_GFXENGINE_H
#define EGG_GFXENGINE_H

#include <common.h>
#include <rvl/GX.h>

namespace EGG {

namespace GfxEngine {

struct Configuration {
/* 0x00 */ u16 efbWidth;
/* 0x02 */ u16 efbHeight;
/* 0x04 */ GXColor clearColor;
/* 0x08 */ u32 field_0x08;
/* 0x0C */ u16 field_0x0C;
/* 0x0E */ u16 field_0x0E;
/* 0x10 */ u32 bufferSize;
/* 0x14 */ u16 field_0x14;
/* 0x16 */ u16 field_0x16;
/* 0x18 */ u8 UNK_0x18[4];
Configuration();
virtual ~Configuration() {}
};

} // namespace GfxEngine

} // namespace EGG

#endif
53 changes: 53 additions & 0 deletions include/egg/gfx/eggLight.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#ifndef EGG_LIGHT_H
#define EGG_LIGHT_H

#include <egg/prim/eggBinary.h>
#include <nw4r/types_nw4r.h>

namespace EGG {

// TODO: Fill out more
class LightTexture {
public:
static void initialize(u16 textureSize, Heap *pHeap);
};

// TODO: Fill out more
class LightTextureManager : public IBinary<LightTextureManager> {
public:
virtual ~LightTextureManager();
virtual void SetBinaryInner(Bin &) override;
virtual void GetBinaryInner(Bin *) const override;
virtual size_t GetBinarySize() override;
virtual void SetBinaryInner(const Bin &, const Bin &, f32) override;

void drawAndCaptureTexture(f32, f32, f32, f32);
};

// TODO: Fill out more
class LightManager : public IBinary<LightManager> {
public:
// vt at 0x00
LightManager(u32, u32, u8);
virtual ~LightManager();
virtual void SetBinaryInner(Bin &) override;
virtual void GetBinaryInner(Bin *) const override;
virtual size_t GetBinarySize() override;
virtual void SetBinaryInner(const Bin &, const Bin &, f32) override;
virtual void Reset();
virtual void Calc(nw4r::g3d::ScnRoot *);
virtual void CalcView(const nw4r::math::MTX34 &, u8, nw4r::g3d::ScnRoot *);
virtual void DoneDraw();

LightTextureManager *GetTextureMgr() const {
return mTextureMgr;
}

u8 TODO_0x04[0x14 - 0x04];
LightTextureManager *mTextureMgr;
u8 TODO_0x18[0x28 - 0x18];
};

} // namespace EGG

#endif
27 changes: 27 additions & 0 deletions include/egg/gfx/eggScreen.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ifndef EGG_SCREEN_H
#define EGG_SCREEN_H

#include <common.h>
#include <egg/gfx/eggFrustum.h>

namespace EGG {

// TODO: Fill out more
class Screen : public Frustum {
public:
Screen();
Screen(f32, f32, f32, f32, Screen *, CanvasMode);

virtual ~Screen();
virtual void SetProjectionGX() const override;
virtual void CopyToG3D(nw4r::g3d::Camera) const override;

static void Initialize(const u16 *, const u16 *, Screen *);
static void SetTVModeDefault();

u8 TODO_0x3C[0x88 - 0x3C];
};

} // namespace EGG

#endif
45 changes: 45 additions & 0 deletions include/egg/gfx/eggStateGX.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#ifndef EGG_STATE_GX_H
#define EGG_STATE_GX_H

#include <common.h>
#include <rvl/GX.h>

namespace EGG {

class StateGX {
public:
static void initialize(u16, u16, GXColor, GXPixelFmt);
static void frameInit();
static void textureInit(); // Guess for 804b4810

static void resetGX();
static void resetVtx();
static void resetColorChannel();
static void resetIndirect();
static void resetTexture();
static void resetTexGen();
static void resetTev();
static void resetPE();

static void resetGXCache();

static void GXSetPixelFmt(GXPixelFmt pixelFmt, GXZFmt16 zFmt);

static void invalidateTexAllGX();

static bool GXSetColorUpdate(bool);
static bool GXSetAlphaUpdate(bool);
static bool GXSetDither();
static void GXCopyTex();
static bool GXSetDstAlpha();
// Unk func here
static void GXSetProjection(Mtx44, int);
static void GXSetProjectionv(const f32 *);
static void GXSetViewport(f32, f32, f32, f32, f32, f32);
static void GZSetScissor(u32, u32, u32, u32);
static void GZSetScissorBoxOffset(s32, s32);
};

} // namespace EGG

#endif
23 changes: 23 additions & 0 deletions include/egg/prim/eggBinary.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#ifndef EGG_BINARY_H
#define EGG_BINARY_H

template <class T>
class IBinary {
public:
class Bin {};
virtual void SetBinaryInner(Bin &) = 0;
virtual void GetBinaryInner(Bin *) const = 0;
virtual size_t GetBinarySize() = 0;
virtual void SetBinaryInner(const Bin &, const Bin &, f32) = 0;

static const char *GetBinaryType();
int GetVersion();

void GetBinary(void *) const;

void SetBinary(const void *);

void SetBinaryBlend(const void *, const void *, f32);
};

#endif
Loading

0 comments on commit 6fed118

Please sign in to comment.