Pretend to have given all files an honest attempt

This commit is contained in:
robojumper
2025-03-29 21:19:37 +01:00
parent 69ce14b38c
commit 38deda681b
17 changed files with 491 additions and 40 deletions
+5 -1
View File
@@ -2183,7 +2183,7 @@ egg/gfx/eggAnalizeDL.cpp:
.sdata2 start:0x8057F3E0 end:0x8057F408
egg/gfx/eggCapTexture.cpp:
.text start:0x8049D7C0 end:0x8049D9C4
.text start:0x8049D7C0 end:0x8049DA28
.rodata start:0x804FBA30 end:0x804FBA48
.data start:0x8056ED70 end:0x8056ED80
.sdata2 start:0x8057F410 end:0x8057F418
@@ -2210,10 +2210,14 @@ egg/gfx/eggDrawPathBase.cpp:
egg/gfx/eggDrawPathBloom.cpp:
.text start:0x804A0EA0 end:0x804A29B8
.data start:0x8056EEB0 end:0x8056EF28
.sdata2 start:0x8057F538 end:0x8057F580
egg/gfx/eggDrawPathDOF.cpp:
.text start:0x804A29C0 end:0x804A4BE8
.rodata start:0x804FBC70 end:0x804FBC88
.data start:0x8056EF28 end:0x8056EFA0
.sdata2 start:0x8057F580 end:0x8057F5F8
egg/gfx/eggDrawPathLightMap.cpp:
.text start:0x804A4BF0 end:0x804A54E8
+24 -24
View File
@@ -10654,7 +10654,7 @@ fn_8019C250 = .text:0x8019C250; // type:function size:0x4
fn_8019C260 = .text:0x8019C260; // type:function size:0x4
fn_8019C270 = .text:0x8019C270; // type:function size:0x4
fn_8019C280 = .text:0x8019C280; // type:function size:0x4
fn_8019C290 = .text:0x8019C290; // type:function size:0x8
getNumStep__Q23EGG13DrawPathBloomCFv = .text:0x8019C290; // type:function size:0x8
getNumStep__Q23EGG11DrawPathDOFCFv = .text:0x8019C2A0; // type:function size:0x8
build__27sFStateFct_c<11dStageMgr_c>FRC12sStateIDIf_c = .text:0x8019C2B0; // type:function size:0x60
dispose__27sFStateFct_c<11dStageMgr_c>FRP10sStateIf_c = .text:0x8019C310; // type:function size:0xC
@@ -10676,7 +10676,7 @@ fn_8019C470 = .text:0x8019C470; // type:function size:0x10
SetBinary__Q23EGG19IBinary<Q23EGG3Fog>FPCv = .text:0x8019C480; // type:function size:0x10
GetBinarySize__Q23EGG28IBinary<Q23EGG11DrawPathDOF>CFv = .text:0x8019C490; // type:function size:0x8
fn_8019C4A0 = .text:0x8019C4A0; // type:function size:0x10
fn_8019C4B0 = .text:0x8019C4B0; // type:function size:0x8
GetBinarySize__Q23EGG30IBinary<Q23EGG13DrawPathBloom>CFv = .text:0x8019C4B0; // type:function size:0x8
fn_8019C4C0 = .text:0x8019C4C0; // type:function size:0x10
finalizeState__26sFStateID_c<11dStageMgr_c>CFR11dStageMgr_c = .text:0x8019C4D0; // type:function size:0x30
executeState__26sFStateID_c<11dStageMgr_c>CFR11dStageMgr_c = .text:0x8019C500; // type:function size:0x30
@@ -10692,9 +10692,9 @@ fn_8019CEE0 = .text:0x8019CEE0; // type:function size:0x8
fn_8019CF20 = .text:0x8019CF20; // type:function size:0x8
fn_8019CF30 = .text:0x8019CF30; // type:function size:0x8
fn_8019CF40 = .text:0x8019CF40; // type:function size:0x8
fn_8019CF50 = .text:0x8019CF50; // type:function size:0x8
fn_8019CF60 = .text:0x8019CF60; // type:function size:0x8
fn_8019CF70 = .text:0x8019CF70; // type:function size:0x8
@24@SetBinaryInner__Q23EGG13DrawPathBloomFRCQ33EGG30IBinary<Q23EGG13DrawPathBloom>3Bin = .text:0x8019CF50; // type:function size:0x8
@24@SetBinaryInner__Q23EGG13DrawPathBloomFRCQ33EGG30IBinary<Q23EGG13DrawPathBloom>3BinRCQ33EGG30IBinary<Q23EGG13DrawPathBloom>3Binf = .text:0x8019CF60; // type:function size:0x8
@24@GetBinaryInner__Q23EGG13DrawPathBloomCFPQ33EGG30IBinary<Q23EGG13DrawPathBloom>3Bin = .text:0x8019CF70; // type:function size:0x8
fn_8019CF80 = .text:0x8019CF80; // type:function size:0x8
fn_8019CF90 = .text:0x8019CF90; // type:function size:0x8
fn_8019CFA0 = .text:0x8019CFA0; // type:function size:0x8
@@ -11262,8 +11262,8 @@ getNewStateID__86sStateMgr_c<17dLytCursorStick_c,20sStateMethodUsr_FI_c,12sFStat
getStateID__86sStateMgr_c<17dLytCursorStick_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x801BD230; // type:function size:0x10
getOldStateID__86sStateMgr_c<17dLytCursorStick_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x801BD240; // type:function size:0x10
dCsGame_c_classInit__Fv = .text:0x801BD250; // type:function size:0x30
fn_801BD280 = .text:0x801BD280; // type:function size:0x8C
fn_801BD310 = .text:0x801BD310; // type:function size:0x40
__ct__17CsGameConfigMaybeFv = .text:0x801BD280; // type:function size:0x8C
__dt__17CsGameConfigMaybeFv = .text:0x801BD310; // type:function size:0x40
__ct__9dCsGame_cFv = .text:0x801BD350; // type:function size:0x4CC
fn_801BD820 = .text:0x801BD820; // type:function size:0x40
fn_801BD860 = .text:0x801BD860; // type:function size:0x40
@@ -26430,7 +26430,7 @@ getVtxResult__Q23EGG9AnalizeDLCFv = .text:0x8049D770; // type:function size:0x8
__dt__Q23EGG9AnalizeDLFv = .text:0x8049D780; // type:function size:0x40
configure__Q23EGG10CapTextureFv = .text:0x8049D7C0; // type:function size:0x7C
capture__Q23EGG10CapTextureFUsUsbi = .text:0x8049D840; // type:function size:0x184
FUN_8049d9d0 = .text:0x8049D9D0; // type:function size:0x58
fn_8049D9D0__Q23EGG10CapTextureFUc = .text:0x8049D9D0; // type:function size:0x58
calcColorGradient__Q23EGG27@unnamed@eggCpuTexture_cpp@FR8_GXColorRC8_GXColorRC8_GXColorf = .text:0x8049DA30; // type:function size:0x188
makeGradient__Q23EGG27@unnamed@eggCpuTexture_cpp@FiP8_GXColoriiiRC8_GXColorRC8_GXColor = .text:0x8049DBC0; // type:function size:0x450
__ct__Q23EGG10CpuTextureFv = .text:0x8049E010; // type:function size:0x44
@@ -26484,28 +26484,28 @@ ExecCallback_CALC_VIEW__Q23EGG12DrawPathBaseFQ44nw4r3g3d6ScnObj6TimingPQ34nw4r3g
scnProcDraw__Q23EGG12DrawPathBaseFUs = .text:0x804A0E60; // type:function size:0x20
@8@__dt__Q23EGG12DrawPathBaseFv = .text:0x804A0E80; // type:function size:0x8 scope:weak
@20@__dt__Q23EGG12DrawPathBaseFv = .text:0x804A0E90; // type:function size:0x8 scope:weak
FUN_804a0ea0 = .text:0x804A0EA0; // type:function size:0x188
__ct__Q23EGG13DrawPathBloomFv = .text:0x804A0EA0; // type:function size:0x188
__dt__Q23EGG14PostEffectMaskFv = .text:0x804A1030; // type:function size:0x40
__dt__Q23EGG20PostEffectBlurGatherFv = .text:0x804A1070; // type:function size:0x40
__dt__Q23EGG16PostEffectSimpleFv = .text:0x804A10B0; // type:function size:0x40
FUN_804a10f0 = .text:0x804A10F0; // type:function size:0x60
FUN_804a1150 = .text:0x804A1150; // type:function size:0x21C
FUN_804a1370 = .text:0x804A1370; // type:function size:0x7A4
FUN_804a1b20 = .text:0x804A1B20; // type:function size:0x53C
FUN_804a2060 = .text:0x804A2060; // type:function size:0x1D4
FUN_804a2240 = .text:0x804A2240; // type:function size:0x714
__dt__Q23EGG13DrawPathBloomFv = .text:0x804A10F0; // type:function size:0x60
internalResetForDraw__Q23EGG13DrawPathBloomFv = .text:0x804A1150; // type:function size:0x21C
internalDraw__Q23EGG13DrawPathBloomFUs = .text:0x804A1370; // type:function size:0x7A4
SetBinaryInner__Q23EGG13DrawPathBloomFRCQ33EGG30IBinary<Q23EGG13DrawPathBloom>3Bin = .text:0x804A1B20; // type:function size:0x53C
GetBinaryInner__Q23EGG13DrawPathBloomCFPQ33EGG30IBinary<Q23EGG13DrawPathBloom>3Bin = .text:0x804A2060; // type:function size:0x1D4
SetBinaryInner__Q23EGG13DrawPathBloomFRCQ33EGG30IBinary<Q23EGG13DrawPathBloom>3BinRCQ33EGG30IBinary<Q23EGG13DrawPathBloom>3Binf = .text:0x804A2240; // type:function size:0x714
FUN_804a2960 = .text:0x804A2960; // type:function size:0x28
fn_804A2990 = .text:0x804A2990; // type:function size:0x8
fn_804A29A0 = .text:0x804A29A0; // type:function size:0x8
fn_804A29B0 = .text:0x804A29B0; // type:function size:0x8
@8@__dt__Q23EGG13DrawPathBloomFv = .text:0x804A2990; // type:function size:0x8
@20@__dt__Q23EGG13DrawPathBloomFv = .text:0x804A29A0; // type:function size:0x8
@24@__dt__Q23EGG13DrawPathBloomFv = .text:0x804A29B0; // type:function size:0x8
__ct__Q23EGG11DrawPathDOFFv = .text:0x804A29C0; // type:function size:0x164
__dt__Q23EGG11DrawPathDOFFv = .text:0x804A2B30; // type:function size:0x104
fn_804A2C40 = .text:0x804A2C40; // type:function size:0x40
fn_804A2C80 = .text:0x804A2C80; // type:function size:0x9C
__dt__Q23EGG17PostEffectMaskDOFFv = .text:0x804A2C40; // type:function size:0x40
execute__Q23EGG11DrawPathDOFFv = .text:0x804A2C80; // type:function size:0x9C
internalResetForDraw__Q23EGG11DrawPathDOFFv = .text:0x804A2D20; // type:function size:0x324
internalDraw__Q23EGG11DrawPathDOFFv = .text:0x804A3050; // type:function size:0xCC
FUN_804a3120 = .text:0x804A3120; // type:function size:0x9A4
EGG__DrawPathDOF__internalDraw = .text:0x804A3AD0; // type:function size:0x648
internalDraw__Q23EGG11DrawPathDOFFUs = .text:0x804A3050; // type:function size:0xCC
internalDrawVariant01__Q23EGG11DrawPathDOFFUs = .text:0x804A3120; // type:function size:0x9A4
internalDrawVariant2__Q23EGG11DrawPathDOFFUs = .text:0x804A3AD0; // type:function size:0x648
FUN_804a4120 = .text:0x804A4120; // type:function size:0x224
FUN_804a4350 = .text:0x804A4350; // type:function size:0xDC
SetBinaryInner__Q23EGG11DrawPathDOFFRCQ33EGG28IBinary<Q23EGG11DrawPathDOF>3Bin = .text:0x804A4430; // type:function size:0x238
@@ -37361,7 +37361,7 @@ DummyTexureData = .data:0x8056EDA0; // type:object size:0x40
jumptable_8056EDE0 = .data:0x8056EDE0; // type:object size:0x38 scope:local
jumptable_8056EE18 = .data:0x8056EE18; // type:object size:0x48 scope:local
__vt__Q23EGG12DrawPathBase = .data:0x8056EE60; // type:object size:0x50
lbl_8056EEB0 = .data:0x8056EEB0; // type:object size:0x78
__vt__Q23EGG13DrawPathBloom = .data:0x8056EEB0; // type:object size:0x78
__vt__Q23EGG11DrawPathDOF = .data:0x8056EF28; // type:object size:0x78
__vt__Q23EGG16DrawPathLightMap = .data:0x8056EFA0; // type:object size:0x50
__vt__Q23EGG3Fog = .data:0x8056EFF0; // type:object size:0x20
+2
View File
@@ -36,6 +36,8 @@ class PostEffectBase;
class PostEffectBlur;
class PostEffectBlurGather;
class PostEffectHDR;
class PostEffectMask;
class PostEffectMaskDOF;
class PostEffectSimple;
class PostEffectUnk2;
class ResTIMG;
+1
View File
@@ -18,6 +18,7 @@ public:
virtual void configure() override; // at 0xC
void capture(u16 x, u16 y, bool upscale, int format);
void fn_8049D9D0(u8 arg);
void setPixModeSync(bool enable) {
if (enable) {
+56 -1
View File
@@ -2,17 +2,72 @@
#define EGG_DRAW_PATH_BLOOM_H
#include "egg/gfx/eggDrawPathBase.h"
#include "egg/gfx/eggPostEffectBlur.h"
#include "egg/gfx/eggPostEffectBlurGather.h"
#include "egg/gfx/eggPostEffectMask.h"
#include "egg/gfx/eggPostEffectSimple.h"
#include "egg/prim/eggBinary.h"
#include "rvl/GX/GXTypes.h"
namespace EGG {
class DrawPathBloom : public DrawPathBase {
class DrawPathBloom : public DrawPathBase, public IBinary<DrawPathBloom> {
struct BinData {};
// Size 0x20?
struct SubData {
/* 0x00 */ f32 field_0x00;
/* 0x04 */ f32 field_0x04;
/* 0x08 */ u8 field_0x08;
/* 0x09 */ u8 _0x09[0x20 - 0x09];
};
// Not sure about this union thing but need to prevent compiler
// from trying fancy struct copying
struct Data {
union {
struct {
/* 0x00 */ f32 field_0x00;
/* 0x04 */ GXColor field_0x04;
/* 0x08 */ GXColor field_0x08;
/* 0x0C */ u16 field_0x0C;
/* 0x10 */ SubData field_0x10[3];
/* 0x50 */ u8 field_0x50;
/* 0x51 */ u8 field_0x51;
/* 0x52 */ u8 field_0x52;
/* 0x53 */ u8 _0x53[0x6C - 0x53];
/* 0x6C */ f32 field_0x6C;
/* 0x70 */ f32 field_0x70;
};
};
};
public:
DrawPathBloom();
virtual ~DrawPathBloom();
virtual u16 getNumStep() const override {
return 3;
}
virtual void internalResetForDraw() override;
virtual void internalDraw(u16) override;
virtual void SetBinaryInner(const Bin &) override;
virtual void GetBinaryInner(Bin *) const override;
virtual void SetBinaryInner(const Bin &, const Bin &, f32) override;
private:
/* 0x01C */ u8 field_0x01C;
/* 0x01D */ u8 field_0x01D;
/* 0x020 */ PostEffectMask mMask;
/* 0x1E0 */ PostEffectBlur mBlur1;
/* 0x258 */ PostEffectBlur mBlur2;
/* 0x2D0 */ PostEffectBlurGather mBlurGather;
/* 0x340 */ PostEffectSimple mSimple;
/* 0x37C */ u32 field_0x37C;
/* 0x380 */ Data field_0x380;
};
} // namespace EGG
+37 -1
View File
@@ -2,7 +2,9 @@
#define EGG_DRAW_PATH_DOF_H
#include "egg/gfx/eggDrawPathBase.h"
#include "egg/gfx/eggTextureBuffer.h"
#include "egg/prim/eggBinary.h"
#include "egg/egg_types.h"
namespace EGG {
@@ -24,8 +26,42 @@ public:
virtual void GetBinaryInner(Bin *) const override;
virtual void SetBinaryInner(const Bin &, const Bin &, f32) override;
void execute();
private:
void *IHaveMembers;
void internalDrawVariant01(u16);
void internalDrawVariant2(u16);
void afterDraw(u16 x, u16 y, u16 width, u16 height);
/* 0x1C */ u16 field_0x1C;
/* 0x1E */ u8 field_0x1E;
/* 0x1F */ u8 field_0x1F;
/* 0x20 */ s32 field_0x20;
/* 0x24 */ f32 field_0x24;
/* 0x28 */ f32 field_0x28;
/* 0x2C */ f32 field_0x2C;
/* 0x30 */ f32 field_0x30;
/* 0x34 */ s32 field_0x34;
/* 0x38 */ s32 field_0x38;
/* 0x3C */ u8 _0x3C[0x5C - 0x3C];
/* 0x5C */ f32 field_0x5C;
/* 0x60 */ f32 field_0x60;
/* 0x64 */ f32 field_0x64;
/* 0x68 */ f32 field_0x68;
/* 0x6C */ f32 field_0x6C;
/* 0x70 */ f32 field_0x70;
/* 0x74 */ f32 field_0x74;
/* 0x78 */ f32 field_0x78;
/* 0x7C */ f32 field_0x7C;
/* 0x80 */ u8 field_0x80;
/* 0x84 */ PostEffectBlur *mpBlur;
/* 0x88 */ PostEffectMaskDOF *mpMaskDof;
/* 0x8C */ TextureBuffer *mpTextureBuffer;
/* 0x90 */ PostEffectMask *mpMask;
};
} // namespace EGG
+24 -2
View File
@@ -24,8 +24,8 @@ public:
CANVASMODE_0,
CANVASMODE_1,
};
protected:
protected:
ProjectionType mProjType; // at 0x0
CanvasMode mCanvasMode; // at 0x4
nw4r::math::VEC2 mSize; // at 0x8
@@ -140,6 +140,28 @@ public:
mFlags |= flag;
}
f32 TranslateDepthToViewSpace(f32 depth) const {
depth = -depth;
f32 bound = -1e-6f;
f32 val = depth >= bound ? bound : depth;
ProjectionType proj = GetProjectionType();
f32 near = mNearZ;
f32 far = mFarZ;
f32 diff = far - near;
f32 viewDepth;
if (proj == PROJ_PERSP) {
viewDepth = ((val * -near) / diff - (far * near) / diff) / -val + 1.0f;
} else {
viewDepth = (-val - near) / diff;
}
if (viewDepth < 0.0f) {
return 0.0f;
} else if (viewDepth > 1.0f) {
return 1.0f;
}
return viewDepth;
}
private:
void SetProjectionPerspectiveGX_() const;
void SetProjectionOrthographicGX_() const;
+14 -1
View File
@@ -27,6 +27,18 @@ public:
return mRotation;
}
void setRot(f32 rot) {
mRotation = rot;
}
void setCapTexture(CapTexture *tex) {
mTex1.mpTex = tex;
}
void setCapTexMapId(GXTexMapID id) {
mTex1.mTexMapID = id;
}
public:
u32 field_0x00; // at 0x0
CapTextureWrapper mTex1; // at 0x4
@@ -51,8 +63,9 @@ public:
static void lerpColor(GXColor &, const GXColor &, const GXColor &, f32);
void getBaseTexMtx(nw4r::math::MTX34 *mtx) const;
protected:
public:
virtual void draw(f32 width, f32 height); // at 0xC
protected:
virtual void setMaterialInternal() {} // at 0x10
virtual void loadTextureInternal(); // at 0x14
virtual void drawScreenInternal(f32 offsetX, f32 offsetY, f32 width, f32 height); // at 0x18
+11
View File
@@ -33,6 +33,10 @@ public:
field_0x30 = val;
}
void setField0x2C(int i) {
field_0x2C = i;
}
void setStage0Field0(u8 u1) {
field_0x38[0].field_0x00 = u1;
}
@@ -45,6 +49,13 @@ public:
field_0x38[0].field_0x0C = f;
}
void setStage0ColorThing(u8 i) {
f32 color = (255.0f / field_0x38[0].field_0x00) + 0.5f;
f32 f = (i * 1.75f) / field_0x38[0].field_0x00;
f32 alpha = f <= 255.0f ? f : 255.0f;
field_0x38[0].field_0x01 = (GXColor){color, color, color, alpha};
}
private:
void drawInternal(u8, u8, f32, f32);
+8
View File
@@ -16,6 +16,14 @@ public:
return static_cast<GXTevScale>(field_0x1BC);
}
void setField_0x2C(int i) {
field_0x2C = i;
}
void setField_0x34(f32 f) {
field_0x34 = f;
}
private:
/* 0x2C */ int field_0x2C;
/* 0x30 */ GXColor mColor;
+16
View File
@@ -20,6 +20,22 @@ public:
static const GXColor &getFarColor();
static const GXColor &getCenterColor();
void setParam0x44(f32 f) {
field_0x44 = f;
}
void setParam0x48(f32 f) {
field_0x48 = f;
}
void setParam0x4C(f32 f) {
field_0x4C = f;
}
void setCpuTexArrIdx(int i){
mCpuTexArrIdx = i;
}
private:
/* 0x2C */ u8 field_0x2C;
/* 0x30 */ CpuTexture *mpCpuTexArr[3];
+4
View File
@@ -10,6 +10,10 @@ public:
PostEffectSimple();
virtual void setMaterialInternal() override;
void setField0x38(s32 v) {
field_0x38 = v;
}
private:
/* 0x2C */ GXColor field_0x2C;
/* 0x30 */ f32 field_0x30;
+8
View File
@@ -111,10 +111,18 @@ public:
return val * StateGX::s_widthEfb / GetSizeXMax(GetComputedTVMode());
}
f32 UnscaleByX(f32 val) const {
return val * GetSizeXMax(GetComputedTVMode()) / StateGX::s_widthEfb;
}
f32 ScaleByY(f32 val) const {
return val * StateGX::s_heightEfb / GetSizeYMax(GetComputedTVMode());
}
f32 UnscaleByY(f32 val) const {
return val * GetSizeYMax(GetComputedTVMode()) / StateGX::s_heightEfb;
}
private:
const Screen *mParent; // at 0x3C
nw4r::math::VEC2 mPosition; // at 0x40
+10 -5
View File
@@ -7,6 +7,7 @@
namespace EGG {
class StateEfb {
public:
enum BufferType {
BUFFER_0,
BUFFER_1,
@@ -21,7 +22,7 @@ class StateEfb {
u32 userData;
u32 field_0x08;
};
private:
static Buffer spBufferSet[BUFFER_MAX];
static f32 sWorkSpaceV[6];
static f32 sWorkSpaceHideV[6];
@@ -30,18 +31,22 @@ class StateEfb {
static s32 sPushCount;
static u32 sFlag;
static f32 *fn_804B4550();
static bool GetShouldCapture();
static bool GetUseTfRgb565();
public:
public:
static bool CheckFlag0x2() {
return (sFlag & 2) != 0;
}
static void Clean();
static TextureBuffer *captureEfb(BufferType type, bool, u32 userData);
static bool releaseEfb(BufferType type, u32 userData);
// Unknown names
static void fn_804B4270(BufferType type, u32 userData);
static void fn_804B4310(BufferType type, u32 userData);
static f32 *fn_804B4550();
};
} // namespace EGG
+14
View File
@@ -52,4 +52,18 @@ void CapTexture::capture(u16 x, u16 y, bool upscale, int format) {
}
}
void CapTexture::fn_8049D9D0(u8 arg) {
onCapFlag(0x8);
CopyFilter v;
v.values[0] = arg;
v.values[1] = 0;
v.values[2] = 1;
v.values[3] = 64 - (2 * arg) - 1;
v.values[4] = 0;
v.values[5] = arg;
v.values[6] = 0;
setCopyFilter(v);
}
} // namespace EGG
+47 -1
View File
@@ -1,3 +1,49 @@
#include "egg/gfx/eggDrawPathBloom.h"
#include "egg/gfx/eggDrawGX.h"
namespace EGG {} // namespace EGG
namespace EGG {
DrawPathBloom::DrawPathBloom(): field_0x01C(1), field_0x01D(8), field_0x37C(0) {
Data nullDat = {0};
field_0x380 = nullDat;
mSimple.setField0x38(0);
field_0x380.field_0x00 = 0.5f;
field_0x380.field_0x04 = DrawGX::WHITE;
field_0x380.field_0x08 = DrawGX::WHITE;
field_0x380.field_0x0C = 0x21;
field_0x380.field_0x10[0].field_0x00 = 1.0f;
field_0x380.field_0x10[0].field_0x04 = 0.3f;
field_0x380.field_0x10[0].field_0x08 = 0x15;
field_0x380.field_0x10[1].field_0x00 = 2.0f;
field_0x380.field_0x10[1].field_0x04 = 0.08f;
field_0x380.field_0x10[1].field_0x08 = 0x15;
field_0x380.field_0x10[2].field_0x00 = 4.0f;
field_0x380.field_0x10[2].field_0x04 = 0.04f;
field_0x380.field_0x10[2].field_0x08 = 0x15;
field_0x380.field_0x51 = 2;
field_0x380.field_0x50 = 1;
field_0x380.field_0x70 = 0.0f;
field_0x380.field_0x6C = 0.0f;
field_0x380.field_0x52 = 0x15;
}
DrawPathBloom::~DrawPathBloom() {}
void DrawPathBloom::internalResetForDraw() {}
void DrawPathBloom::internalDraw(u16 idx) {}
void DrawPathBloom::SetBinaryInner(const Bin &bin) {}
void DrawPathBloom::GetBinaryInner(Bin *pBin) const {}
void DrawPathBloom::SetBinaryInner(const Bin &, const Bin &, f32) {}
} // namespace EGG
+210 -4
View File
@@ -1,14 +1,220 @@
#include "egg/gfx/eggDrawPathDOF.h"
#include "common.h"
#include "egg/gfx/eggDrawGX.h"
#include "egg/gfx/eggGlobalDrawState.h"
#include "egg/gfx/eggPostEffectBase.h"
#include "egg/gfx/eggPostEffectBlur.h"
#include "egg/gfx/eggPostEffectMask.h"
#include "egg/gfx/eggPostEffectMaskDOF.h"
#include "egg/gfx/eggPostEffectSimple.h"
#include "egg/gfx/eggScreen.h"
#include "egg/gfx/eggStateEfb.h"
#include "egg/gfx/eggStateGX.h"
#include "egg/gfx/eggTextureBuffer.h"
#include "nw4r/math/math_types.h"
#include "rvl/GX/GXTypes.h"
namespace EGG {
DrawPathDOF::DrawPathDOF() {}
DrawPathDOF::DrawPathDOF()
: field_0x1C(1),
field_0x20(1),
field_0x24(30.0f),
field_0x28(20.0f),
field_0x2C(20.0f),
field_0x30(1.6f),
field_0x34(0),
field_0x38(2),
field_0x5C(0.0f),
field_0x60(0.0f),
field_0x64(0.4f),
field_0x68(0.2f),
field_0x6C(-0.0075f),
field_0x70(-0.0075f),
field_0x74(10.0f),
field_0x78(15.0f),
field_0x7C(1.0f),
field_0x80(21),
mpBlur(nullptr),
mpMask(nullptr),
mpTextureBuffer(nullptr),
mpMaskDof(nullptr) {
mpMaskDof = new PostEffectMaskDOF();
mpBlur = new PostEffectBlur();
mpBlur->setField0x2C(1);
mpMask = new PostEffectMask();
DrawPathDOF::~DrawPathDOF() {}
mpMask->setField_0x00(0);
mpMask->setField_0x34(0.0f);
mpMask->setField_0x2C(0);
field_0x1E = 0xFF;
field_0x1F = 0xFF;
}
void DrawPathDOF::internalDraw(u16) {}
DrawPathDOF::~DrawPathDOF() {
delete mpMaskDof;
mpMaskDof = nullptr;
delete mpBlur;
mpBlur = nullptr;
delete mpMask;
mpMask = nullptr;
}
void DrawPathDOF::internalResetForDraw() {}
void DrawPathDOF::execute() {
field_0x5C += field_0x6C * field_0x7C;
field_0x60 += field_0x70 * field_0x7C;
if (field_0x5C < -1.0f) {
field_0x5C += 2.0f;
} else if (field_0x5C > 1.0f) {
// @bug typo?
field_0x5C -= -2.0f;
}
if (field_0x60 < -1.0f) {
field_0x60 += 2.0f;
} else if (field_0x60 > 1.0f) {
field_0x60 -= 2.0f;
}
}
static int sMaskDofArray[] = {0, 1, 2};
static u8 sBlurArray[] = {4, 2, 1, 0};
void DrawPathDOF::internalResetForDraw() {
// Tons of regswaps...
f32 a = GlobalDrawState::getScreen().TranslateDepthToViewSpace(field_0x24);
f32 b = GlobalDrawState::getScreen().TranslateDepthToViewSpace(field_0x24 - field_0x28 / 2.0f);
f32 c = GlobalDrawState::getScreen().TranslateDepthToViewSpace(field_0x24 + field_0x28 / 2.0f);
// TODO
if (c < b + 1e-6f) {
c = b + 1e-6f;
if (b < 1.0f) {
c = 1.0f;
b -= 1e-6f;
}
}
mpMaskDof->setParam0x48(b);
mpMaskDof->setParam0x44(a);
mpMaskDof->setParam0x4C(c);
if (field_0x38 >= 3) {
field_0x38 = 2;
}
mpMaskDof->setCpuTexArrIdx(sMaskDofArray[field_0x38]);
mpBlur->setStage0Field0(sBlurArray[field_0x34]);
mpBlur->setStage0F(field_0x34 != 2 ? field_0x30 : 0.0f);
// HELP
mpBlur->setStage0ColorThing(field_0x1E);
}
void DrawPathDOF::internalDraw(u16 idx) {
if (idx == 0) {
if (StateEfb::CheckFlag0x2() == 0) {
StateEfb::fn_804B4270(
static_cast<StateEfb::BufferType>((field_0x1C >> 2) & 1), reinterpret_cast<u32>(this)
);
}
StateGX::invalidateTexAllGX();
}
if (field_0x20 == 2) {
internalDrawVariant2(idx);
} else {
internalDrawVariant01(idx);
}
switch (idx) {
case 1:
StateEfb::fn_804B4310(StateEfb::BUFFER_0, reinterpret_cast<u32>(this));
StateEfb::releaseEfb(StateEfb::BUFFER_3, reinterpret_cast<u32>(this));
break;
case 2:
if (mpTextureBuffer != nullptr) {
mpTextureBuffer->free();
mpTextureBuffer = nullptr;
}
}
}
void DrawPathDOF::internalDrawVariant01(u16 idx) {}
void DrawPathDOF::internalDrawVariant2(u16 idx) {
const Screen &screen = GlobalDrawState::getScreen();
const Screen::DataEfb &efb = screen.GetDataEfb();
switch (idx) {
case 0: {
TextureBuffer *capturedBuf = StateEfb::captureEfb(StateEfb::BUFFER_3, false, reinterpret_cast<u32>(this));
StateGX::GXSetPixelFmt_(GX_PF_RGB8_Z24, GX_ZC_LINEAR);
StateGX::ScopedColor colorGuard(true);
StateGX::ScopedAlpha alphaGuard(false);
StateGX::ScopedDither ditherGuard(false);
PostEffectBase::setProjection(screen);
f32 *floats = StateEfb::fn_804B4550();
f32 scale = (field_0x1C & 4) != 0 ? 0.25f : 0.5f;
f32 width1 = screen.GetWidth() * scale;
f32 height1 = screen.GetHeight() * scale;
f32 rot = 0.5f;
u16 width = efb.vp.x2 * scale;
u16 height = efb.vp.y2 * scale;
PostEffectSimple effect;
effect.setCapTexMapId(GX_TEXMAP0);
effect.setField0x38(0);
effect.setField_0x00(0);
effect.setRot(rot);
effect.setCapTexture(capturedBuf);
// TODO tons of problems in these UnscaleByX inlines that probably exist
effect.draw(screen.UnscaleByX(height), screen.UnscaleByY(width));
TextureBuffer *pTex2 = TextureBuffer::alloc(height, width, GX_TF_RGBA8);
pTex2->fn_8049D9D0(field_0x80);
pTex2->capture(floats[0], floats[1], false, -1);
mpBlur->setCapTexture(pTex2);
mpBlur->setCapTexMapId(GX_TEXMAP0);
mpBlur->setRot(-rot);
mpBlur->draw(width1, height1);
if (pTex2 != nullptr) {
pTex2->free();
}
afterDraw(floats[0], floats[1], width, height);
StateGX::GXSetPixelFmt_(StateGX::s_pixFormat, StateGX::s_zFmt16);
break;
}
case 2: {
StateGX::ScopedColor colorGuard(true);
StateGX::ScopedAlpha alphaGuard(false);
StateGX::ScopedDither ditherGuard(true);
Screen screenCpy(screen);
screenCpy.SetOffset(nw4r::math::VEC2(0.0f, 0.0f));
screenCpy.SetScale(nw4r::math::VEC3(1.0f, 1.0f, 1.0f));
screenCpy.SetFlag(Screen::FLAG_0x40);
screenCpy.SetProjectionGX();
DrawGX::SetMat_ColorChannel(DrawGX::COLORCHAN_1);
DrawGX::SetMat_TexGen(DrawGX::TEXGEN_1);
DrawGX::SetMat_Ind();
DrawGX::SetMat_Tev(GX_TEVSTAGE0, DrawGX::TEV_2);
GXSetTevAlphaIn(GX_TEVSTAGE0,GX_CA_ZERO,GX_CA_ZERO,GX_CA_ZERO,GX_CA_RASA);
DrawGX::SetMat_PE(DrawGX::ZMODE_2, DrawGX::BLEND_0);
DrawGX::SetVtxState(DrawGX::VTX_TYPE_7);
mpTextureBuffer->load(GX_TEXMAP0);
for (int i = 0; i < 2; i++) {
// TODO
}
break;
}
}
}
void DrawPathDOF::SetBinaryInner(const Bin &bin) {}