This commit is contained in:
robojumper
2025-03-15 22:14:01 +01:00
parent 9b7889f034
commit 8759f710e5
19 changed files with 511 additions and 46 deletions
+6
View File
@@ -2179,9 +2179,14 @@ egg/gfx/eggUnk1.cpp:
egg/gfx/eggCapTexture.cpp:
.text start:0x8049D7C0 end:0x8049D9D0
.rodata start:0x804FBA30 end:0x804FBA60
.data start:0x8056ED70 end:0x8056ED80
.sdata2 start:0x8057F410 end:0x8057F418
.sbss2 start:0x8057FFC0 end:0x8057FFC8
egg/gfx/eggCpuTexture.cpp:
.text start:0x8049DA30 end:0x8049EC94
.data start:0x8056ED80 end:0x8056EDA0
egg/gfx/eggDrawGX.cpp:
.text start:0x8049ECA0 end:0x804A0C24
@@ -2189,6 +2194,7 @@ egg/gfx/eggDrawGX.cpp:
egg/gfx/eggDrawPathBase.cpp:
.text start:0x804A0C30 end:0x804A0E98
.data start:0x8056EE60 end:0x8056EEB0
egg/gfx/eggDrawPathUnk1.cpp:
.text start:0x804A0EA0 end:0x804A29B8
+19 -21
View File
@@ -610,7 +610,7 @@ fn_80019780 = .text:0x80019780; // type:function size:0x6C
fn_800197F0 = .text:0x800197F0; // type:function size:0x5C
fn_80019850 = .text:0x80019850; // type:function size:0x58
drawXlu__Q23d3d7XluProcFv = .text:0x800198B0; // type:function size:0x17C
EGG__CapTexture____dt = .text:0x80019A30; // type:function size:0x58
__dt__Q23EGG10CapTextureFv = .text:0x80019A30; // type:function size:0x58
fn_80019A90 = .text:0x80019A90; // type:function size:0x4C
fn_80019AE0 = .text:0x80019AE0; // type:function size:0x98
fn_80019B80 = .text:0x80019B80; // type:function size:0x8
@@ -720,7 +720,7 @@ fn_8001F570 = .text:0x8001F570; // type:function size:0x70
fn_8001F5E0 = .text:0x8001F5E0; // type:function size:0x5C
fn_8001F640 = .text:0x8001F640; // type:function size:0x40
fn_8001F680 = .text:0x8001F680; // type:function size:0x70
fn_8001F6F0 = .text:0x8001F6F0; // type:function size:0x4
ExecCallback_CALC_MAT__Q34nw4r3g3d15IScnObjCallbackFQ44nw4r3g3d6ScnObj6TimingPQ34nw4r3g3d6ScnObjUlPv = .text:0x8001F6F0; // type:function size:0x4
fn_8001F700 = .text:0x8001F700; // type:function size:0xA8
fn_8001F7B0 = .text:0x8001F7B0; // type:function size:0x64
sprintf__15SizedString<32>FPCce = .text:0x8001F820; // type:function size:0xD0
@@ -9780,7 +9780,7 @@ fn_80171B70 = .text:0x80171B70; // type:function size:0x5C
fn_80171BD0 = .text:0x80171BD0; // type:function size:0xA90
fn_80172660 = .text:0x80172660; // type:function size:0x4C
fn_801726B0 = .text:0x801726B0; // type:function size:0x218
EGG__DrawPathBase____dt = .text:0x801728D0; // type:function size:0x5C
__dt__Q23EGG12DrawPathBaseFv = .text:0x801728D0; // type:function size:0x5C
__dt__Q23EGG16ScreenEffectBaseFv = .text:0x80172930; // type:function size:0x40
fn_80172970 = .text:0x80172970; // type:function size:0xB4
fn_80172A30 = .text:0x80172A30; // type:function size:0x40
@@ -9790,14 +9790,14 @@ fn_80173FA0 = .text:0x80173FA0; // type:function size:0x128
fn_801740D0 = .text:0x801740D0; // type:function size:0x60
fn_80174130 = .text:0x80174130; // type:function size:0x1D8
fn_80174310 = .text:0x80174310; // type:function size:0x5F0
fn_80174900 = .text:0x80174900; // type:function size:0x4
internalResetForDraw__Q23EGG12DrawPathBaseFv = .text:0x80174900; // type:function size:0x4
fn_80174910 = .text:0x80174910; // type:function size:0x8
fn_80174920 = .text:0x80174920; // type:function size:0x4
fn_80174930 = .text:0x80174930; // type:function size:0x8
fn_80174940 = .text:0x80174940; // type:function size:0x14
fn_80174960 = .text:0x80174960; // type:function size:0x8
fn_80174970 = .text:0x80174970; // type:function size:0x8
fn_80174980 = .text:0x80174980; // type:function size:0x8
@8@scnProcDraw__Q23EGG12DrawPathBaseFUs = .text:0x80174970; // type:function size:0x8
@20@ExecCallback_CALC_VIEW__Q23EGG12DrawPathBaseFQ44nw4r3g3d6ScnObj6TimingPQ34nw4r3g3d6ScnObjUlPv = .text:0x80174980; // type:function size:0x8
fn_80174990 = .text:0x80174990; // type:function size:0x8
fn_801749A0 = .text:0x801749A0; // type:function size:0x8
fn_801749B0 = .text:0x801749B0; // type:function size:0x8
@@ -26435,14 +26435,14 @@ calcColorGradient_EGG_CpuTexture_8049da30 = .text:0x8049DA30; // type:function s
makeGradient_EGG_CpuTexture_8049dbc0 = .text:0x8049DBC0; // type:function size:0x450
__ct__Q23EGG10CpuTextureFv = .text:0x8049E010; // type:function size:0x44
__ct__Q23EGG10CpuTextureFUsUs9_GXTexFmt = .text:0x8049E060; // type:function size:0x40
__ct__Q23EGG10CpuTextureFP9_GXTexObj = .text:0x8049E0A0; // type:function size:0xB0
__ct__Q23EGG10CpuTextureFPC9_GXTexObj = .text:0x8049E0A0; // type:function size:0xB0
__dt__Q23EGG10CpuTextureFv = .text:0x8049E150; // type:function size:0x70
configure__Q23EGG10CpuTextureFv = .text:0x8049E1C0; // type:function size:0xC
setBuffer__Q23EGG10CpuTextureFPv = .text:0x8049E1D0; // type:function size:0x1C
load__Q23EGG10CpuTextureCF11_GXTexMapID = .text:0x8049E1F0; // type:function size:0x3C
getTexObj__Q23EGG10CpuTextureCFP9_GXTexObj = .text:0x8049E230; // type:function size:0x80
flush__Q23EGG10CpuTextureCFv = .text:0x8049E2B0; // type:function size:0x4C
buildHeader_EGG_CpuTexture_8049e300 = .text:0x8049E300; // type:function size:0x84
buildHeader__Q23EGG10CpuTextureCFv = .text:0x8049E300; // type:function size:0x84
fillNormalMapSphere__EGG_CpuTexture_8049e390 = .text:0x8049E390; // type:function size:0x1BC
fillGradient_EGG_CpuTexture_8049e550 = .text:0x8049E550; // type:function size:0x3A8
alloc__Q23EGG10CpuTextureFPQ23EGG4Heap = .text:0x8049E900; // type:function size:0x84
@@ -26779,11 +26779,11 @@ resetPE__Q23EGG7StateGXFv = .text:0x804B4EF0; // type:function size:0xB0
resetGXCache__Q23EGG7StateGXFv = .text:0x804B4FA0; // type:function size:0x40
EGG__StateGX__GXSetPixelFmt_ = .text:0x804B4FE0; // type:function size:0xAC
invalidateTexAllGX__Q23EGG7StateGXFv = .text:0x804B5090; // type:function size:0x4
GXSetColorUpdate___Q23EGG7StateGXFb = .text:0x804B50A0; // type:function size:0x4C
GXSetAlphaUpdate___Q23EGG7StateGXFb = .text:0x804B50F0; // type:function size:0x4C
GXSetDither___Q23EGG7StateGXFb = .text:0x804B5140; // type:function size:0x4C
FUN_804b5190 = .text:0x804B5190; // type:function size:0x8
GXSetDstAlpha___Q23EGG7StateGXFbUc = .text:0x804B51A0; // type:function size:0x4C
GXSetColorUpdate___Q23EGG7StateGXFUc = .text:0x804B50A0; // type:function size:0x4C
GXSetAlphaUpdate___Q23EGG7StateGXFUc = .text:0x804B50F0; // type:function size:0x4C
GXSetDither___Q23EGG7StateGXFUc = .text:0x804B5140; // type:function size:0x4C
GXCopyTex__Q23EGG7StateGXFPvb = .text:0x804B5190; // type:function size:0x8
GXSetDstAlpha___Q23EGG7StateGXFUcUc = .text:0x804B51A0; // type:function size:0x4C
FUN_804b51f0 = .text:0x804B51F0; // type:function size:0x108
FUN_804b5300 = .text:0x804B5300; // type:function size:0x2C
GXSetProjectionv___Q23EGG7StateGXFPCf = .text:0x804B5330; // type:function size:0x2C
@@ -29159,7 +29159,7 @@ gRMO_Ntsc_640x456Prog_4x3__22@unnamed@eggVideo_cpp@ = .rodata:0x804FB980; // typ
gRMO_Ntsc_640x456IntDf_4x3__22@unnamed@eggVideo_cpp@ = .rodata:0x804FB9BC; // type:object size:0x3C scope:local
renderModes__3EGG = .rodata:0x804FB9F8; // type:object size:0x28 scope:local
@4804 = .rodata:0x804FBA20; // type:object size:0x10 scope:local data:4byte
lbl_804FBA30 = .rodata:0x804FBA30; // type:object size:0x30
copyArg2__3EGG = .rodata:0x804FBA30; // type:object size:0x30
lbl_804FBA60 = .rodata:0x804FBA60; // type:object size:0xD8
lbl_804FBB38 = .rodata:0x804FBB38; // type:object size:0x30
lbl_804FBB68 = .rodata:0x804FBB68; // type:object size:0xF0
@@ -37355,12 +37355,12 @@ __vt__Q23EGG14CoreController = .data:0x8056EC50; // type:object size:0x38
EGG____OrthoCamera__vtable = .data:0x8056ED00; // type:object size:0x30
EGG__LookAtCamera__vtable = .data:0x8056ED30; // type:object size:0x30
lbl_8056ED60 = .data:0x8056ED60; // type:object size:0x10
EGG__CapTexture__vtable = .data:0x8056ED70; // type:object size:0x10
EGG__CpuTexture__vtable = .data:0x8056ED80; // type:object size:0x20
__vt__Q23EGG10CapTexture = .data:0x8056ED70; // type:object size:0x10
__vt__Q23EGG10CpuTexture = .data:0x8056ED80; // type:object size:0x20
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
lbl_8056EE60 = .data:0x8056EE60; // type:object size:0x50
__vt__Q23EGG12DrawPathBase = .data:0x8056EE60; // type:object size:0x50
lbl_8056EEB0 = .data:0x8056EEB0; // type:object size:0x78
lbl_8056EF28 = .data:0x8056EF28; // type:object size:0x78
lbl_8056EFA0 = .data:0x8056EFA0; // type:object size:0x50
@@ -48011,9 +48011,7 @@ lbl_8057F3FC = .sdata2:0x8057F3FC; // type:object size:0xC
lbl_8057F408 = .sdata2:0x8057F408; // type:object size:0x4 data:4byte
lbl_8057F40C = .sdata2:0x8057F40C; // type:object size:0x2 data:2byte
lbl_8057F40E = .sdata2:0x8057F40E; // type:object size:0x1 data:byte
lbl_8057F410 = .sdata2:0x8057F410; // type:object size:0x4 data:4byte
lbl_8057F414 = .sdata2:0x8057F414; // type:object size:0x2 data:2byte
lbl_8057F416 = .sdata2:0x8057F416; // type:object size:0x1 data:byte
defaultFilter__3EGG = .sdata2:0x8057F410; // type:object size:0x7 data:byte
lbl_8057F418 = .sdata2:0x8057F418; // type:object size:0x4 data:float
lbl_8057F41C = .sdata2:0x8057F41C; // type:object size:0x4 data:float
lbl_8057F420 = .sdata2:0x8057F420; // type:object size:0x8 data:double
@@ -48447,7 +48445,7 @@ lbl_8057FFA0 = .sbss2:0x8057FFA0; // type:object size:0x8 data:4byte
lbl_8057FFA8 = .sbss2:0x8057FFA8; // type:object size:0x8
lbl_8057FFB0 = .sbss2:0x8057FFB0; // type:object size:0x8
DefaultBlackColor = .sbss2:0x8057FFB8; // type:object size:0x8 scope:local data:2byte
lbl_8057FFC0 = .sbss2:0x8057FFC0; // type:object size:0x8 data:byte
sBlack__3EGG = .sbss2:0x8057FFC0; // type:object size:0x8 data:byte
lbl_8057FFC8 = .sbss2:0x8057FFC8; // type:object size:0x4
lbl_80580000 = .bss:0x80580000; // type:object size:0x14 data:4byte
lbl_80580014 = .bss:0x80580014; // type:object size:0xC
+1 -1
View File
@@ -872,7 +872,7 @@ config.libs = [
Object(NonMatching, "egg/gfx/eggCapTexture.cpp"),
Object(NonMatching, "egg/gfx/eggCpuTexture.cpp"),
Object(NonMatching, "egg/gfx/eggDrawGX.cpp"),
Object(NonMatching, "egg/gfx/eggDrawPathBase.cpp"),
Object(Matching, "egg/gfx/eggDrawPathBase.cpp"),
Object(NonMatching, "egg/gfx/eggDrawPathUnk1.cpp"),
Object(NonMatching, "egg/gfx/eggDrawPathDOF.cpp"),
Object(NonMatching, "egg/gfx/eggDrawPathUnk2.cpp"),
+21 -1
View File
@@ -1,6 +1,26 @@
#ifndef EGG_CAP_TEXTURE_H
#define EGG_CAP_TEXTURE_H
namespace EGG {} // namespace EGG
#include "egg/gfx/eggCpuTexture.h"
#include "rvl/GX/GXTypes.h"
namespace EGG {
struct CopyFilter {
u8 values[7];
};
class CapTexture : public CpuTexture {
virtual void configure() override; // at 0xC
void capture(u16 x, u16 y, bool upscale, int format);
private:
/* 0x18 */ u8 mCapFlags;
/* 0x19 */ GXColor mClearColor;
/* 0x20 */ u32 field_0x20;
/* 0x24 */ CopyFilter mCopyFilterArg;
};
} // namespace EGG
#endif
+130 -1
View File
@@ -1,13 +1,142 @@
#ifndef EGG_CPU_TEXTURE_H
#define EGG_CPU_TEXTURE_H
#include "common.h"
#include "egg/core/eggHeap.h"
#include "rvl/GX/GXTexture.h"
#include "rvl/GX/GXTypes.h"
namespace EGG {
class CpuTexture {
void makeGradient(UNKTYPE);
public:
void GetTexObj(GXTexObj *) const;
struct Header {
u8 mTexFormat;
u8 BYTE_0x1;
u16 mWidth;
u16 mHeight;
u8 mWrapS;
u8 mWrapT;
u8 BYTE_0x8;
u8 BYTE_0x9;
u16 SHORT_0xA;
u32 WORD_0xC;
u8 BYTE_0xD;
u8 BYTE_0xE;
u8 BYTE_0xF;
u8 BYTE_0x10;
u8 mMinFilt;
u8 mMagFilt;
u8 BYTE_0x13;
u8 BYTE_0x14;
u8 BYTE_0x15;
u16 SHORT_0x16;
u32 WORD_0x18;
};
enum TexFlag {
CONFIGURED = 0x1,
HAS_HEADER = 0x2,
NEEDS_BUFFER_FREE = 0x4,
};
virtual ~CpuTexture(); // at 0x8
virtual void configure(); // at 0xC
void getTexObj(GXTexObj *) const; // at 0x10
void load(GXTexMapID) const; // at 0x14
CpuTexture();
CpuTexture(u16 width, u16 height, GXTexFmt texFmt);
CpuTexture(const GXTexObj *pObj);
void checkTexBuffer() const;
void invalidate() const;
void flush() const;
void alloc(Heap *heap);
void allocWithHeaderDebug(Heap *heap);
void allocate(Heap *heap);
u32 getTexBufferSize() const;
void buildHeader() const;
Header *initHeader();
void fillNormalMapSphere();
UNKTYPE func_80086C8C(UNKTYPE);
void allocTexBuffer();
void allocTexBufferAndHeader();
void setColor(u16, u16, GXColor);
bool checkIsConfigure() const {
return mFlags & CONFIGURED;
}
bool checkHasHeader() const {
return mFlags & HAS_HEADER;
}
void setFlag(u8 flag) {
mFlags |= flag;
}
void clearFlag(u8 flag) {
mFlags &= ~flag;
}
u16 getWidth() const {
return mWidth;
}
void setWidth(u16 w) {
mWidth = w;
}
u16 getHeight() const {
return mHeight;
}
void setHeight(u16 h) {
mHeight = h;
}
GXTexFmt getFormat() const {
return (GXTexFmt)mTexFormat;
}
void setFormat(GXTexFmt fmt) {
mTexFormat = fmt;
}
void setWrapS(GXTexWrapMode wrap) {
mWrapS = wrap;
}
void setWrapT(GXTexWrapMode wrap) {
mWrapT = wrap;
}
void setMinFilt(GXTexFilter filt) {
mMinFilt = filt;
}
void setMagFilt(GXTexFilter filt) {
mMagFilt = filt;
}
Header *getHeader() const {
return (Header *)((u8 *)dataPtr - sizeof(Header));
}
char *getBuffer() const {
return mpBuffer;
}
void setBuffer(void *pBuffer);
protected:
u16 mWidth; // at 0x4
u16 mHeight; // at 0x6
u8 mFlags; // at 0x8
u8 mTexFormat; // at 0x9
u8 mWrapS; // at 0xA
u8 mWrapT; // at 0xB
u8 mMinFilt; // at 0xC
u8 mMagFilt; // at 0xD
u8 UNK_0xE[2];
void *dataPtr; // at 0x10
char *mpBuffer; // at 0x14
};
} // namespace EGG
+25 -1
View File
@@ -1,6 +1,30 @@
#ifndef EGG_DRAW_PATH_BASE_H
#define EGG_DRAW_PATH_BASE_H
namespace EGG {} // namespace EGG
#include "egg/egg_types.h"
#include "egg/gfx/eggIScnProc.h"
#include "egg/gfx/eggScreenEffectBase.h"
#include "nw4r/g3d/g3d_scnobj.h"
namespace EGG {
class DrawPathBase : public ScreenEffectBase, public IScnProc, public nw4r::g3d::IScnObjCallback {
public:
DrawPathBase();
void createScnProc(MEMAllocator *allocator);
protected:
virtual u16 getNumStep() const = 0; // at 0x3C
virtual void internalResetForDraw() {} // at 0x40
virtual void internalDraw() = 0; // at 0x44
virtual void ExecCallback_CALC_VIEW(
nw4r::g3d::ScnObj::Timing /* timing */, nw4r::g3d::ScnObj * /* pObj */, u32 /* param */, void * /* pInfo */
) override; // also at 0x48
virtual void scnProcDraw(u16) override; // also at 0x4C
};
} // namespace EGG
#endif
+5 -2
View File
@@ -8,7 +8,7 @@
namespace EGG {
class IScnProc {
private:
protected:
// Unofficial name
struct ProcData {
IScnProc *mpThis; // at 0x0
@@ -22,7 +22,7 @@ private:
public:
IScnProc() : mpDataSet(nullptr), mNumScnProc(0) {}
virtual void doDraw(u16) = 0; // at 0x8
virtual void scnProcDraw(u16) = 0; // at 0x8
virtual ~IScnProc(); // at 0xC
void createScnProc(u16 procNum, MEMAllocator *allocator);
@@ -38,6 +38,9 @@ public:
ProcData *getData(u16 procIndex) {
return &mpDataSet[procIndex];
}
nw4r::g3d::ScnProc *getProc(u16 procIndex) {
return mpDataSet[procIndex].mpScnProc;
}
};
} // namespace EGG
+31 -1
View File
@@ -1,6 +1,36 @@
#ifndef EGG_POST_EFFECT_BASE_H
#define EGG_POST_EFFECT_BASE_H
namespace EGG {} // namespace EGG
#include "common.h"
#include "egg/egg_types.h"
#include "egg/gfx/eggCapTexture.h"
#include "rvl/GX/GXTypes.h"
namespace EGG {
class PostEffectBase {
protected:
u32 field_0x00; // at 0x0
CapTexture *mpCapTexture; // at 0x4
GXTexMapID mTexMapId; // at 0x8
CapTexture *mpCapTexture2; // at 0xC
GXTexMapID mTexMapId2; // at 0x10
f32 mOffsetX; // at 0x14
f32 mOffsetY; // at 0x18
f32 mScaleX; // at 0x1C
f32 mScaleY; // at 0x20
f32 field_0x24; // at 0x24
PostEffectBase();
virtual ~PostEffectBase() {} // at 0x8
protected:
virtual void draw(f32, f32); // at 0xC
virtual void setMaterialInternal(); // at 0x10
virtual void loadTextureInternal(); // at 0x14
virtual void drawScreenInternal(f32, f32, f32, f32); // at 0x18
};
} // namespace EGG
#endif
+1 -1
View File
@@ -7,7 +7,7 @@
namespace EGG {
class ScreenEffectBase {
private:
protected:
u8 mFlag;
public:
+5 -5
View File
@@ -27,15 +27,15 @@ public:
static void invalidateTexAllGX();
static bool GXSetColorUpdate_(bool);
static bool GXSetAlphaUpdate_(bool);
static bool GXSetDither_(bool);
static bool GXSetDstAlpha_(bool, u8);
static GXBool GXSetColorUpdate_(GXBool);
static GXBool GXSetAlphaUpdate_(GXBool);
static GXBool GXSetDither_(GXBool);
static GXBool GXSetDstAlpha_(GXBool, u8);
static bool GXSetColorUpdate(bool);
static bool GXSetAlphaUpdate(bool);
static bool GXSetDither();
static void GXCopyTex();
static void GXCopyTex(void *data, bool);
static bool GXSetDstAlpha();
// Unk func here
static void GXSetProjection(Mtx44, int);
+1
View File
@@ -29,6 +29,7 @@ u16 GXGetNumXfbLines(u16 height, f32 scale);
void GXSetDispCopyDst(u16 width, u16 height);
u32 GXSetDispCopyYScale(f32 scale);
void GXCopyDisp(void *data, GXBool bUpdate);
void GXSetCopyClamp(int val); // TODO
void GXSetTexCopySrc(u16 left, u16 top, u16 width, u16 height);
void GXSetTexCopyDst(u16 left, u16 top, GXTexFmt fmt, u8 mipmap);
+6 -3
View File
@@ -48,9 +48,12 @@ u16 GXGetTexObjWidth(const GXTexObj *obj);
u16 GXGetTexObjHeight(const GXTexObj *obj);
GXTexFmt GXGetTexObjFormat(const GXTexObj *obj);
GXBool GXGetTexObjMipMap(const GXTexObj *obj);
GXTexWrapMode GXGetTexObjWrapS(GXTexObj *obj);
u32 GXGetTexObjTlut(GXTexObj *);
GXTexWrapMode GXGetTexObjWrapT(GXTexObj *obj);
GXTexWrapMode GXGetTexObjWrapS(const GXTexObj *obj);
u32 GXGetTexObjTlut(const GXTexObj *);
GXTexWrapMode GXGetTexObjWrapT(const GXTexObj *);
GXTexFilter GXGetTexObjMinFilt(const GXTexObj *);
GXTexFilter GXGetTexObjMagFilt(const GXTexObj *);
void *GXGetTexObjData(const GXTexObj *);
u32 GXGetTexBufferSize(u16 width, u16 height, u32 format, GXBool arg3, u8 arg4);
void GXInvalidateTexAll();
+57 -1
View File
@@ -1,3 +1,59 @@
#include "egg/gfx/eggCapTexture.h"
namespace EGG {} // namespace EGG
#include "egg/gfx/eggCpuTexture.h"
#include "egg/gfx/eggStateGX.h"
#include "rvl/GX/GXFrameBuf.h"
#include "rvl/GX/GXPixel.h"
#include "rvl/GX/GXTypes.h"
namespace EGG {
static const GXColor sBlack = {0, 0, 0, 0};
static const CopyFilter defaultFilter = {
{0, 0, 1, 0x3F, 0, 0, 0}
};
static const u8 copyArg2[12][2] = {};
void CapTexture::configure() {
CpuTexture::configure();
mCapFlags = 0;
mClearColor = sBlack;
field_0x20 = 0xFFFFFF;
mCopyFilterArg = defaultFilter;
}
void CapTexture::capture(u16 x, u16 y, bool upscale, int format) {
GXTexFmt fmt = format == -1 ? getFormat() : static_cast<GXTexFmt>(format);
u16 width = upscale ? getWidth() * 2 : getWidth();
u16 height = upscale ? getHeight() * 2 : getHeight();
GXSetTexCopySrc(x, y, width, height);
GXSetTexCopyDst(mWidth, mHeight, fmt, upscale);
GXSetCopyFilter(
0, copyArg2, (mCapFlags & 8) ? true : false, (mCapFlags & 8) ? mCopyFilterArg.values : defaultFilter.values
);
// Regswap, grr
GXBool prevColorUpdate = StateGX::GXSetColorUpdate_((mCapFlags & 1) != 0);
GXBool prevAlphaUpdate = StateGX::GXSetAlphaUpdate_((mCapFlags & 2) != 0);
GXSetZMode(true, GX_ALWAYS, (mCapFlags & 4) != 0);
GXSetCopyClear(mClearColor, field_0x20);
GXSetCopyClamp(3);
StateGX::GXCopyTex(dataPtr, true);
GXSetCopyFilter(0, copyArg2, 0, defaultFilter.values);
if ((mCapFlags & 0x10) != 0) {
GXPixModeSync();
}
if ((mCapFlags & 0x20) != 0) {
StateGX::invalidateTexAllGX();
}
StateGX::GXSetAlphaUpdate_(prevAlphaUpdate);
StateGX::GXSetColorUpdate_(prevColorUpdate);
}
} // namespace EGG
+133 -1
View File
@@ -1,3 +1,135 @@
#include "egg/gfx/eggCpuTexture.h"
namespace EGG {} // namespace EGG
#include "common.h"
#include "egg/core/eggHeap.h"
#include "rvl/GX/GXTexture.h"
#include "rvl/GX/GXTypes.h"
#include "rvl/OS/OSCache.h"
namespace EGG {
CpuTexture::CpuTexture() {
mWidth = 0;
mHeight = 0;
mFlags = 0;
mTexFormat = GX_TF_RGBA8;
mWrapS = 0;
mWrapT = 0;
mMinFilt = 1;
mMagFilt = 1;
dataPtr = nullptr;
mpBuffer = nullptr;
}
CpuTexture::CpuTexture(u16 width, u16 height, GXTexFmt texFmt) {
mWidth = width;
mHeight = height;
mFlags = 0;
mTexFormat = texFmt;
mWrapS = 0;
mWrapT = 0;
mMinFilt = 1;
mMagFilt = 1;
dataPtr = nullptr;
mpBuffer = nullptr;
}
CpuTexture::CpuTexture(const GXTexObj *pObj) {
mWidth = GXGetTexObjWidth(pObj);
mHeight = GXGetTexObjHeight(pObj);
mTexFormat = GXGetTexObjFormat(pObj);
mWrapS = GXGetTexObjWrapS(pObj);
mWrapT = GXGetTexObjWrapT(pObj);
mMinFilt = GXGetTexObjMinFilt(pObj);
mMagFilt = GXGetTexObjMagFilt(pObj);
// why?
dataPtr = (char *)GXGetTexObjData(pObj) - 0x80000000;
mpBuffer = nullptr;
}
CpuTexture::~CpuTexture() {
if ((mFlags & NEEDS_BUFFER_FREE) != 0) {
delete[] mpBuffer;
}
}
void CpuTexture::configure() {
mFlags = CONFIGURED;
}
void CpuTexture::setBuffer(void *buf) {
if (buf != nullptr) {
dataPtr = buf;
}
mFlags &= ~HAS_HEADER;
}
void CpuTexture::load(GXTexMapID id) const {
GXTexObj obj;
getTexObj(&obj);
GXLoadTexObj(&obj, id);
}
void CpuTexture::getTexObj(GXTexObj *pObj) const {
GXInitTexObj(pObj, dataPtr, mWidth, mHeight, getFormat(), (GXTexWrapMode)mWrapS, (GXTexWrapMode)mWrapT, false);
GXInitTexObjLOD(pObj, (GXTexFilter)mMinFilt, (GXTexFilter)mMagFilt, 0.0f, 0.0f, 0.0f, false, false, GX_ANISO_1);
}
void CpuTexture::flush() const {
u32 size = GXGetTexBufferSize(mWidth, mHeight, getFormat(), false, true);
DCFlushRange(dataPtr, size);
}
void CpuTexture::buildHeader() const {
Header *pHdr = getHeader();
pHdr->mTexFormat = mTexFormat;
pHdr->BYTE_0x1 = 1;
pHdr->mWidth = mWidth;
pHdr->mHeight = mHeight;
pHdr->mWrapS = mWrapS;
pHdr->mWrapT = mWrapT;
pHdr->BYTE_0x8 = 0;
pHdr->BYTE_0x9 = 0;
pHdr->SHORT_0xA = 0;
pHdr->WORD_0xC = 0;
pHdr->BYTE_0xD = 0;
pHdr->BYTE_0xE = 0;
pHdr->BYTE_0xF = 0;
pHdr->BYTE_0x10 = 0;
pHdr->mMinFilt = mMinFilt;
pHdr->mMagFilt = mMagFilt;
pHdr->BYTE_0x13 = 0;
pHdr->BYTE_0x14 = 0;
pHdr->BYTE_0x15 = 1;
pHdr->SHORT_0x16 = 0;
pHdr->WORD_0x18 = 32;
}
void CpuTexture::alloc(Heap *pHeap) {
Heap *heap = pHeap == nullptr ? Heap::getCurrentHeap() : pHeap;
u32 size = GXGetTexBufferSize(mWidth, mHeight, getFormat(), false, true);
mpBuffer = new (heap, 0x20) char[size];
setBuffer(mpBuffer);
mFlags |= NEEDS_BUFFER_FREE;
}
void CpuTexture::allocWithHeaderDebug(Heap *pHeap) {
Heap *heap = pHeap == nullptr ? Heap::getCurrentHeap() : pHeap;
u32 size = GXGetTexBufferSize(mWidth, mHeight, getFormat(), false, true);
mpBuffer = new (heap, 0x20) char[size + 0x20];
char *actualBuf = mpBuffer + 0x20;
setBuffer(mpBuffer + 0x20);
if (actualBuf != nullptr) {
mFlags |= HAS_HEADER;
}
mFlags |= NEEDS_BUFFER_FREE;
buildHeader();
}
void CpuTexture::allocate(Heap *pHeap) {
alloc(pHeap);
}
} // namespace EGG
+42 -1
View File
@@ -1,3 +1,44 @@
#include "egg/gfx/eggDrawPathBase.h"
namespace EGG {} // namespace EGG
#include "common.h"
#include "egg/gfx/eggIScnProc.h"
#include "nw4r/g3d/g3d_scnobj.h"
#include "nw4r/g3d/g3d_scnproc.h"
namespace EGG {
DrawPathBase::DrawPathBase() {}
void DrawPathBase::createScnProc(MEMAllocator *allocator) {
IScnProc::createScnProc(getNumStep(), allocator);
for (u16 i = 0; i < getNumStep(); i++) {
getProc(i)->SetScnObjOption(nw4r::g3d::ScnObj::OPTION_DISABLE_UPDATEFRAME, true);
getProc(i)->SetScnObjOption(nw4r::g3d::ScnObj::OPTION_DISABLE_CALC_WORLD, true);
getProc(i)->SetScnObjOption(nw4r::g3d::ScnObj::OPTION_DISABLE_CALC_MAT, true);
getProc(i)->SetScnObjOption(nw4r::g3d::ScnObj::OPTION_DISABLE_CALC_VTX, true);
getProc(i)->SetScnObjOption(nw4r::g3d::ScnObj::OPTION_DISABLE_CALC_VIEW, true);
}
nw4r::g3d::ScnProc *p = getProc(0);
p->SetScnObjOption(nw4r::g3d::ScnObj::OPTION_DISABLE_CALC_VIEW, false);
p->EnableScnObjCallbackExecOp(nw4r::g3d::ScnObj::EXECOP_CALC_VIEW);
p->EnableScnObjCallbackTiming(nw4r::g3d::ScnObj::CALLBACK_TIMING_A);
p->DisableScnObjCallbackTiming(nw4r::g3d::ScnObj::CALLBACK_TIMING_B);
p->DisableScnObjCallbackTiming(nw4r::g3d::ScnObj::CALLBACK_TIMING_C);
p->SetCallback(this);
}
void DrawPathBase::ExecCallback_CALC_VIEW(
nw4r::g3d::ScnObj::Timing timing, nw4r::g3d::ScnObj *pObj, u32 param, void *pInfo
) {
if (mFlag & 1) {
internalResetForDraw();
}
}
void DrawPathBase::scnProcDraw(u16) {
if (mFlag & 1) {
internalDraw();
}
}
} // namespace EGG
+3 -3
View File
@@ -24,9 +24,9 @@ void GlobalDrawState::beginDrawView(u16 cameraId, const nw4r::math::MTX34 &mtx,
}
void GlobalDrawState::setDrawSettingGX(bool b1, bool b2) {
StateGX::GXSetColorUpdate_(sDrawFlag & 1);
StateGX::GXSetAlphaUpdate_(sDrawFlag & 2);
StateGX::GXSetDither_(sDrawFlag & 4);
StateGX::GXSetColorUpdate_((sDrawFlag & 1) != 0);
StateGX::GXSetAlphaUpdate_((sDrawFlag & 2) != 0);
StateGX::GXSetDither_((sDrawFlag & 4) != 0);
StateGX::GXSetDstAlpha_(false, 0);
if (b2 && spScreen != nullptr) {
spScreen->SetProjectionGX();
+1 -1
View File
@@ -82,7 +82,7 @@ void IScnProc::drawProcFunc(nw4r::g3d::ScnProc *pScnProc, bool b) {
void IScnProc::drawProcFuncNoGlobalState(nw4r::g3d::ScnProc *pScnProc, bool b) {
ProcData *dat = static_cast<ProcData *>(pScnProc->GetUserData());
dat->mpThis->doDraw(dat->mIndex);
dat->mpThis->scnProcDraw(dat->mIndex);
}
} // namespace EGG
+23 -1
View File
@@ -1,3 +1,25 @@
#include "egg/gfx/eggPostEffectBase.h"
namespace EGG {} // namespace EGG
#include "common.h"
#include "rvl/GX/GXTypes.h"
namespace EGG {
PostEffectBase::PostEffectBase() {
field_0x00 = 0;
mpCapTexture = nullptr;
mTexMapId = GX_TEXMAP0;
mpCapTexture2 = nullptr;
mTexMapId2 = GX_TEXMAP0;
mOffsetX = 0.0f;
mOffsetY = 0.0f;
mScaleX = 1.0f;
mScaleY = 1.0f;
field_0x24 = 0.0f;
}
void PostEffectBase::loadTextureInternal() {
mpCapTexture;
}
} // namespace EGG
+1 -1
View File
@@ -327,7 +327,7 @@ void setRoomTevColors(nw4r::g3d::ResMdl mdl, int b1, bool bUnk) {
void UnkWithWater::calc(EGG::CpuTexture *tex) {
GXTexObj obj;
if (tex != nullptr) {
tex->GetTexObj(&obj);
tex->getTexObj(&obj);
}
for (NodeList::Iterator it = mList.GetBeginIter(); it != mList.GetEndIter(); ++it) {