Skip to content

Commit

Permalink
m2d
Browse files Browse the repository at this point in the history
  • Loading branch information
robojumper committed Sep 12, 2024
1 parent 3d0adbc commit f93161f
Show file tree
Hide file tree
Showing 9 changed files with 668 additions and 64 deletions.
7 changes: 7 additions & 0 deletions config/SOUE01/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,13 @@ f/f_manager.cpp:
.sbss start:0x80575BB8 end:0x80575BC0
.bss start:0x805B84D8 end:0x805B8588

m/m2d.cpp:
.text start:0x802E2D80 end:0x802E3E50
.data start:0x805423E8 end:0x805424A0
.sbss start:0x80575BC8 end:0x80575BD0
.sdata2 start:0x8057CC98 end:0x8057CCB8
.bss start:0x805B8588 end:0x805B85C0

m/m3d/m3d.cpp:
.text start:0x802E3E50 end:0x802E4714
.sbss start:0x80575BD0 end:0x80575BEC
Expand Down
118 changes: 59 additions & 59 deletions config/SOUE01/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17366,50 +17366,50 @@ __arraydtor = .text:0x802E2BF0; // type:function size:0x1C scope:local
walkPack__11fTrMgPTMF_cFv = .text:0x802E2C10; // type:function size:0x84
searchNodeByProfName__9fTrMgBa_cCFUsPC9fTrNdBa_c = .text:0x802E2CA0; // type:function size:0x68
searchNodeByGroupType__9fTrMgBa_cCFUcPC9fTrNdBa_c = .text:0x802E2D10; // type:function size:0x68
fn_802E2D80 = .text:0x802E2D80; // type:function size:0x10
fn_802E2D90 = .text:0x802E2D90; // type:function size:0x3C
fn_802E2DD0 = .text:0x802E2DD0; // type:function size:0x94
fn_802E2E70 = .text:0x802E2E70; // type:function size:0x58
fn_802E2ED0 = .text:0x802E2ED0; // type:function size:0x88
fn_802E2F60 = .text:0x802E2F60; // type:function size:0x88
fn_802E2FF0 = .text:0x802E2FF0; // type:function size:0xC
fn_802E3000 = .text:0x802E3000; // type:function size:0x50
fn_802E3050 = .text:0x802E3050; // type:function size:0x40
fn_802E3090 = .text:0x802E3090; // type:function size:0x88
fn_802E3120 = .text:0x802E3120; // type:function size:0x8
fn_802E3130 = .text:0x802E3130; // type:function size:0x4
fn_802E3140 = .text:0x802E3140; // type:function size:0x8
fn_802E3150 = .text:0x802E3150; // type:function size:0x8
fn_802E3160 = .text:0x802E3160; // type:function size:0x40
fn_802E31A0 = .text:0x802E31A0; // type:function size:0x94
fn_802E3240 = .text:0x802E3240; // type:function size:0x64
fn_802E32B0 = .text:0x802E32B0; // type:function size:0xC
fn_802E32C0 = .text:0x802E32C0; // type:function size:0x8
fn_802E32D0 = .text:0x802E32D0; // type:function size:0x60
fn_802E3330 = .text:0x802E3330; // type:function size:0x34
fn_802E3370 = .text:0x802E3370; // type:function size:0x34
fn_802E33B0 = .text:0x802E33B0; // type:function size:0x70
fn_802E3420 = .text:0x802E3420; // type:function size:0x6C
fn_802E3490 = .text:0x802E3490; // type:function size:0x118
fn_802E35B0 = .text:0x802E35B0; // type:function size:0x58
fn_802E3610 = .text:0x802E3610; // type:function size:0x84
fn_802E36A0 = .text:0x802E36A0; // type:function size:0x60
fn_802E3700 = .text:0x802E3700; // type:function size:0x38
fn_802E3740 = .text:0x802E3740; // type:function size:0x38
fn_802E3780 = .text:0x802E3780; // type:function size:0x10
fn_802E3790 = .text:0x802E3790; // type:function size:0x38
fn_802E37D0 = .text:0x802E37D0; // type:function size:0x40
fn_802E3810 = .text:0x802E3810; // type:function size:0x4
fn_802E3820 = .text:0x802E3820; // type:function size:0x90
fn_802E38B0 = .text:0x802E38B0; // type:function size:0x78
fn_802E3930 = .text:0x802E3930; // type:function size:0xF8
fn_802E3A30 = .text:0x802E3A30; // type:function size:0xC0
fn_802E3AF0 = .text:0x802E3AF0; // type:function size:0x24
fn_802E3B20 = .text:0x802E3B20; // type:function size:0x6C
fn_802E3B90 = .text:0x802E3B90; // type:function size:0x170
fn_802E3D00 = .text:0x802E3D00; // type:function size:0x108
fn_802E3E10 = .text:0x802E3E10; // type:function size:0x20
fn_802E3E30 = .text:0x802E3E30; // type:function size:0x20
reset__3m2dFv = .text:0x802E2D80; // type:function size:0x10
init__3m2dFP12mAllocator_c = .text:0x802E2D90; // type:function size:0x3C
create__3m2dFPQ23EGG4HeapUl = .text:0x802E2DD0; // type:function size:0x94
defaultSet__3m2dFv = .text:0x802E2E70; // type:function size:0x58
draw__3m2dFUc = .text:0x802E2ED0; // type:function size:0x88
drawBefore__3m2dFUc = .text:0x802E2F60; // type:function size:0x88
getAllocator__3m2dFv = .text:0x802E2FF0; // type:function size:0xC
CreateAnimTransform__Q23m2d8Layout_cFPCvPQ34nw4r3lyt16ResourceAccessor = .text:0x802E3000; // type:function size:0x50
__dt__Q23m2d14ResAccIfBase_cFv = .text:0x802E3050; // type:function size:0x40
__dt__Q23m2d10ResAccIf_cFv = .text:0x802E3090; // type:function size:0x88
getAccessor__Q23m2d10ResAccIf_cFv = .text:0x802E3120; // type:function size:0x8
noop__Q23m2d10ResAccIf_cFv = .text:0x802E3130; // type:function size:0x4
attach__Q23m2d10ResAccIf_cFPvPCc = .text:0x802E3140; // type:function size:0x8
detach__Q23m2d10ResAccIf_cFv = .text:0x802E3150; // type:function size:0x8
__dt__Q23m2d11FrameCtrl_cFv = .text:0x802E3160; // type:function size:0x40
play__Q23m2d11FrameCtrl_cFv = .text:0x802E31A0; // type:function size:0x94
set__Q23m2d11FrameCtrl_cFfUcff = .text:0x802E3240; // type:function size:0x64
setFrame__Q23m2d11FrameCtrl_cFf = .text:0x802E32B0; // type:function size:0xC
setRate__Q23m2d11FrameCtrl_cFf = .text:0x802E32C0; // type:function size:0x8
isStop__Q23m2d11FrameCtrl_cCFv = .text:0x802E32D0; // type:function size:0x60
getEndFrame__Q23m2d11FrameCtrl_cCFv = .text:0x802E3330; // type:function size:0x34
getEndFrame2__Q23m2d11FrameCtrl_cCFv = .text:0x802E3370; // type:function size:0x34
isStop2__Q23m2d11FrameCtrl_cCFv = .text:0x802E33B0; // type:function size:0x70
__dt__Q23m2d5Anm_cFv = .text:0x802E3420; // type:function size:0x6C
doSomething__Q23m2d5Anm_cFPCcPQ23m2d10ResAccIf_c = .text:0x802E3490; // type:function size:0x118
__dt__Q23m2d8Layout_cFv = .text:0x802E35B0; // type:function size:0x58
setTransform__Q23m2d5Anm_cFPQ34nw4r3lyt13AnimTransform = .text:0x802E3610; // type:function size:0x84
destroySomething__Q23m2d5Anm_cFv = .text:0x802E36A0; // type:function size:0x60
set__Q23m2d5Anm_cFfUcff = .text:0x802E3700; // type:function size:0x38
setFrame__Q23m2d5Anm_cFf = .text:0x802E3740; // type:function size:0x38
updateFrame__Q23m2d5Anm_cFv = .text:0x802E3780; // type:function size:0x10
play__Q23m2d5Anm_cFv = .text:0x802E3790; // type:function size:0x38
__dt__Q23m2d6Base_cFv = .text:0x802E37D0; // type:function size:0x40
draw__Q23m2d6Base_cFv = .text:0x802E3810; // type:function size:0x4
addToDrawList__Q23m2d6Base_cFv = .text:0x802E3820; // type:function size:0x90
__dt__Q23m2d8Simple_cFv = .text:0x802E38B0; // type:function size:0x78
__ct__Q23m2d8Simple_cFv = .text:0x802E3930; // type:function size:0xF8
calc__Q23m2d8Simple_cFv = .text:0x802E3A30; // type:function size:0xC0
calcBefore__Q23m2d8Simple_cFv = .text:0x802E3AF0; // type:function size:0x24
calcAfter__Q23m2d8Simple_cFv = .text:0x802E3B20; // type:function size:0x6C
draw__Q23m2d8Simple_cFv = .text:0x802E3B90; // type:function size:0x170
build__Q23m2d8Simple_cFPCcPQ23m2d10ResAccIf_c = .text:0x802E3D00; // type:function size:0x108
bind__Q23m2d8Simple_cFPQ23m2d5Anm_c = .text:0x802E3E10; // type:function size:0x20
unbind__Q23m2d8Simple_cFPQ23m2d5Anm_c = .text:0x802E3E30; // type:function size:0x20
create__3m3dFPQ23EGG4HeapUlUlUlUl = .text:0x802E3E50; // type:function size:0xEC
create__3m3dFPQ23EGG4Heap11_GXPixelFmt8_GXColorUlUlUlUlUlUl = .text:0x802E3F40; // type:function size:0x17C
createLightMgr__3m3dFPQ23EGG4HeapUsUsUcbi = .text:0x802E40C0; // type:function size:0x134
Expand Down Expand Up @@ -22197,7 +22197,7 @@ fn_803B8510 = .text:0x803B8510; // type:function size:0x12C
fn_803B8640 = .text:0x803B8640; // type:function size:0xB0
fn_803B86F0 = .text:0x803B86F0; // type:function size:0x7C
PSMTXTrans = .text:0x803B8770; // type:function size:0x34
fn_803B87B0 = .text:0x803B87B0; // type:function size:0x4C
PSMTXTransApply = .text:0x803B87B0; // type:function size:0x4C
PSMTXScale = .text:0x803B8800; // type:function size:0x28
fn_803B8830 = .text:0x803B8830; // type:function size:0x58
PSMTXQuat = .text:0x803B8890; // type:function size:0xA4
Expand Down Expand Up @@ -35678,13 +35678,13 @@ lbl_805423B4 = .data:0x805423B4; // type:object size:0xC data:4byte
lbl_805423C0 = .data:0x805423C0; // type:object size:0xC data:4byte
lbl_805423CC = .data:0x805423CC; // type:object size:0xC data:4byte
lbl_805423D8 = .data:0x805423D8; // type:object size:0xC data:4byte
lbl_805423E8 = .data:0x805423E8; // type:object size:0x20
lbl_80542408 = .data:0x80542408; // type:object size:0x18
lbl_80542420 = .data:0x80542420; // type:object size:0x10
lbl_80542430 = .data:0x80542430; // type:object size:0xC
lbl_8054243C = .data:0x8054243C; // type:object size:0xC
lbl_80542448 = .data:0x80542448; // type:object size:0x18
lbl_80542460 = .data:0x80542460; // type:object size:0x40
lbl_805423E8 = .data:0x805423E8; // type:object size:0x1C
__vt__Q23m2d8Simple_c = .data:0x80542408; // type:object size:0x18
__vt__Q23m2d6Base_c = .data:0x80542420; // type:object size:0x10
__vt__Q23m2d5Anm_c = .data:0x80542430; // type:object size:0xC
__vt__Q23m2d11FrameCtrl_c = .data:0x8054243C; // type:object size:0xC
__vt__Q23m2d10ResAccIf_c = .data:0x80542448; // type:object size:0x14
__vt__Q23m2d8Layout_c = .data:0x80542460; // type:object size:0x40
__vt__Q23m3d6proc_c = .data:0x805424A0; // type:object size:0x2C
__vt__Q23m3d8anmChr_c = .data:0x805424D0; // type:object size:0x18
__vt__Q23m3d13anmChrBlend_c = .data:0x805424E8; // type:object size:0x18
Expand Down Expand Up @@ -37207,7 +37207,7 @@ lbl_8056F1B0 = .data:0x8056F1B0; // type:object size:0x20
lbl_8056F1D0 = .data:0x8056F1D0; // type:object size:0x20
lbl_8056F1F0 = .data:0x8056F1F0; // type:object size:0x20
lbl_8056F210 = .data:0x8056F210; // type:object size:0x20
lbl_8056F230 = .data:0x8056F230; // type:object size:0x24 data:2byte
sTVModeInfo__Q23EGG6Screen = .data:0x8056F230; // type:object size:0x24 data:2byte
lbl_8056F254 = .data:0x8056F254; // type:object size:0x14
lbl_8056F268 = .data:0x8056F268; // type:object size:0x10
lbl_8056F278 = .data:0x8056F278; // type:object size:0x38
Expand Down Expand Up @@ -40294,8 +40294,8 @@ sLoadAsyncCallback__7fBase_c = .sbss:0x80575BB0; // type:object size:0x4 data:4b
sUnloadCallback__7fBase_c = .sbss:0x80575BB4; // type:object size:0x4 data:4byte
m_StopProcInf__10fManager_c = .sbss:0x80575BB8; // type:object size:0x4 data:4byte
sProfileList__8fProfile = .sbss:0x80575BC0; // type:object size:0x8 data:4byte
lbl_80575BC8 = .sbss:0x80575BC8; // type:object size:0x4 data:4byte
lbl_80575BCC = .sbss:0x80575BCC; // type:object size:0x1 data:byte
l_allocator__3m2d = .sbss:0x80575BC8; // type:object size:0x4 data:4byte
@GUARD@doSomething__Q23m2d5Anm_cFPCcPQ23m2d10ResAccIf_c@l_layout = .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
l_numLightMgr__Q23m3d8internal = .sbss:0x80575BD8; // type:object size:0x4 data:4byte
Expand Down Expand Up @@ -40997,7 +40997,7 @@ lbl_8057685C = .sbss:0x8057685C; // type:object size:0x1 data:byte
lbl_80576860 = .sbss:0x80576860; // type:object size:0x1 data:byte
lbl_80576861 = .sbss:0x80576861; // type:object size:0x7 data:byte
lbl_80576868 = .sbss:0x80576868; // type:object size:0x8 data:float
lbl_80576870 = .sbss:0x80576870; // type:object size:0x4 data:4byte
sTVMode__Q23EGG6Screen = .sbss:0x80576870; // type:object size:0x4 data:4byte
lbl_80576874 = .sbss:0x80576874; // type:object size:0x4 data:4byte
lbl_80576878 = .sbss:0x80576878; // type:object size:0x4 data:4byte
lbl_8057687C = .sbss:0x8057687C; // type:object size:0x4 data:4byte
Expand Down Expand Up @@ -45833,7 +45833,7 @@ lbl_8057CC98 = .sdata2:0x8057CC98; // type:object size:0x4 data:float
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_8057CCB0 = .sdata2:0x8057CCB0; // type:object size:0x4 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
Expand Down Expand Up @@ -49114,9 +49114,9 @@ m_executeManage__10fManager_c = .bss:0x805B84FC; // type:object size:0x14 data:4
m_drawManage__10fManager_c = .bss:0x805B8510; // type:object size:0x14 data:4byte
m_deleteManage__10fManager_c = .bss:0x805B8524; // type:object size:0x14 data:4byte
m_searchManage__10fManager_c = .bss:0x805B8548; // type:object size:0x40
lbl_805B8588 = .bss:0x805B8588; // type:object size:0xC
l_list__3m2d = .bss:0x805B8588; // type:object size:0xC
lbl_805B8594 = .bss:0x805B8594; // type:object size:0xC
lbl_805B85A0 = .bss:0x805B85A0; // type:object size:0x20 data:4byte
@LOCAL@doSomething__Q23m2d5Anm_cFPCcPQ23m2d10ResAccIf_c@l_layout = .bss:0x805B85A0; // type:object size:0x20 data:4byte
s_UncompressInfoSZS__4mDvd = .bss:0x805B85C0; // type:object size:0xC data:4byte
s_UncompressInfoLZ__4mDvd = .bss:0x805B85CC; // type:object size:0xC data:4byte
s_UncompressInfoLH__4mDvd = .bss:0x805B85D8; // type:object size:0xC data:4byte
Expand Down
1 change: 1 addition & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ def nw4rLib(lib_name, objects, extra_cflags=[]):
Object(Matching, "m/m3d/m_mdl.cpp"),
Object(Matching, "m/m3d/m_scnleaf.cpp"),
Object(Matching, "m/m3d/m_smdl.cpp"),
Object(Matching, "m/m2d.cpp"),
Object(Matching, "m/m_allocator.cpp"),
Object(Matching, "m/m_angle.cpp"),
Object(Matching, "m/m_color_fader.cpp"),
Expand Down
34 changes: 31 additions & 3 deletions include/egg/gfx/eggFrustum.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,41 @@ namespace EGG {
class Frustum {
public:
enum CanvasMode {};
enum ProjectionType {};
enum ProjectionType { PROJ_ORTHO, PROJ_PERSP };

u8 TODO_0x00[0x38];
private:
/* 0x00 */ ProjectionType mProjType;
/* 0x04 */ CanvasMode mCanvasMode;
/* 0x08 */ nw4r::math::VEC2 mSize;
/* 0x10 */ f32 mFovY;
/* 0x14 */ f32 mTanFovY;
/* 0x18 */ f32 mNearZ;
/* 0x1C */ f32 mFarZ;
/* 0x20 */ nw4r::math::VEC2 mOffset;
/* 0x28 */ nw4r::math::VEC3 mScale;
/* 0x34 */ mutable u16 mFlags;

public:
// vt at 0x38
virtual ~Frustum();
virtual ~Frustum() {}
virtual void SetProjectionGX() const;
virtual void CopyToG3D(nw4r::g3d::Camera) const;

ProjectionType GetProjectionType() const {
return mProjType;
}
void SetProjectionType(ProjectionType type) {
mProjType = type;
}

void ResetOrthographic(f32, f32, f32, f32, f32, f32);

void SetScale(const nw4r::math::VEC3 &scale) {
mScale = scale;
}
void SetOffset(const nw4r::math::VEC2 &offset) {
mOffset = offset;
}
};

} // namespace EGG
Expand Down
60 changes: 59 additions & 1 deletion include/egg/gfx/eggScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,72 @@ class Screen : public Frustum {
Screen();
Screen(f32, f32, f32, f32, Screen *, CanvasMode);

virtual ~Screen();
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];

enum TVMode { TV_MODE_1, TV_MODE_2, TV_MODE_3, TV_MODE_4, TV_MODE_MAX };

struct TVModeInfo {
TVModeInfo() {}
u16 width;
u16 height;
f32 w_ratio;
f32 h_ratio;
};

struct DataEfb {
// Required for struct copy
struct Viewport {
f32 x1; // at 0x0
f32 y1; // at 0x4
f32 x2; // at 0x8
f32 y2; // at 0xC
f32 z1; // at 0x10
f32 z2; // at 0x14
} vp;

s32 sc_ox; // at 0x18
s32 sc_oy; // at 0x1C
};

static u16 GetSizeXMax(TVMode mode) {
return sTVModeInfo[mode].width;
}
static u16 GetSizeYMax(TVMode mode) {
return sTVModeInfo[mode].height;
}
static u16 GetSizeXMax() {
return sTVModeInfo[sTVMode].width;
}
static u16 GetSizeYMax() {
return sTVModeInfo[sTVMode].height;
}

static inline f32 GetAdjustScale() {
return (f32)sTVModeInfo[0].width / sTVModeInfo[Screen::sTVMode].width;
}

static TVMode GetTVMode() {
return sTVMode;
}

static TVMode sTVMode;

static Screen *spRoot;

typedef void (*ChangeTVModeFunc)(void *);
static ChangeTVModeFunc sChangeTVModeFunc;
static void *spChangeTVModeFuncInfo;
static TVModeInfo sTVModeInfo[Screen::TV_MODE_MAX];

static nw4r::math::VEC2 sCanvasScale;
static nw4r::math::VEC2 sCanvasOffset;
};

} // namespace EGG
Expand Down
Loading

0 comments on commit f93161f

Please sign in to comment.