Start StateEfb

This commit is contained in:
robojumper
2025-03-24 23:40:14 +01:00
parent 922f048314
commit 3e7dd3283a
6 changed files with 77 additions and 8 deletions
+1
View File
@@ -2347,6 +2347,7 @@ egg/gfx/eggStateEfb.cpp:
.text start:0x804B3DA0 end:0x804B460C
.sdata start:0x80574F60 end:0x80574F68
.sbss start:0x80576898 end:0x805768A0
.sdata2 start:0x8057F868 end:0x8057F890
.bss start:0x80675010 end:0x806750A0
egg/gfx/eggStateGX.cpp:
+4 -5
View File
@@ -49806,11 +49806,10 @@ sMtx__3EGG = .bss:0x80674EC0; // type:object size:0x30 data:float
lbl_80674EF0 = .bss:0x80674EF0; // type:object size:0xC data:float
@LOCAL@Initialize__Q23EGG6ScreenFPCUsPCUsPQ23EGG6Screen@defaultRoot = .bss:0x80674F00; // type:object size:0x88 data:4byte
sScreen__Q23EGG16ScreenEffectBase = .bss:0x80674F88; // type:object size:0x88
lbl_80675010 = .bss:0x80675010; // type:object size:0x30
lbl_80675040 = .bss:0x80675040; // type:object size:0x14 data:float
lbl_80675054 = .bss:0x80675054; // type:object size:0x4 data:float
lbl_80675058 = .bss:0x80675058; // type:object size:0x18 data:float
lbl_80675070 = .bss:0x80675070; // type:object size:0x30 data:float
spBufferSet__Q23EGG8StateEfb = .bss:0x80675010; // type:object size:0x30
sWorkSpaceV__Q23EGG8StateEfb = .bss:0x80675040; // type:object size:0x18 data:float
sWorkSpaceHideV__Q23EGG8StateEfb = .bss:0x80675058; // type:object size:0x18 data:float
sUnkBuffer__Q23EGG8StateEfb = .bss:0x80675070; // type:object size:0x18 data:float
sDefaultTexObj__Q23EGG7StateGX = .bss:0x806750A0; // type:object size:0x20
s_tmem_layout__Q23EGG7StateGX = .bss:0x806750C0; // type:object size:0xA8 data:4byte
s_cacheGX__Q23EGG7StateGX = .bss:0x80675168; // type:object size:0x18
+27
View File
@@ -1,11 +1,38 @@
#ifndef EGG_STATE_EFB_H
#define EGG_STATE_EFB_H
#include "common.h"
#include "egg/egg_types.h"
namespace EGG {
class StateEfb {
enum BufferType {
BUFFER_0,
BUFFER_1,
BUFFER_2,
BUFFER_3,
BUFFER_MAX,
};
struct Buffer {
TextureBuffer *buf;
u32 userData;
u32 field_0x08;
};
static Buffer spBufferSet[BUFFER_MAX];
static f32 sWorkSpaceV[6];
static f32 sWorkSpaceHideV[6];
static f32 sUnkBuffer[6]; // unk name
static s32 sWorkBuffer;
static s32 sPushCount;
static u32 sFlag;
public:
static void Clean();
static bool releaseEfb(BufferType type, u32 userData);
};
} // namespace EGG
+1 -1
View File
@@ -89,7 +89,7 @@ public:
static CacheGX &GXSetDstAlpha_(bool, u8);
static void GXSetProjection_(Mtx44, GXProjectionType);
static void GXSetProjectionv_(const f32 *);
static void GXSetViewport_(f32, f32, f32, f32, f32, f32);
static void GXSetViewport_(f32 ox, f32 oy, f32 sx, f32 sy, f32 near, f32 far);
static void GXSetScissor_(u32, u32, u32, u32);
static void GXSetScissorBoxOffset_(s32, s32);
+43 -1
View File
@@ -1,3 +1,45 @@
#include "egg/gfx/eggStateEfb.h"
namespace EGG {} // namespace EGG
#include "common.h"
#include "egg/gfx/eggTextureBuffer.h"
namespace EGG {
StateEfb::Buffer StateEfb::spBufferSet[BUFFER_MAX];
f32 StateEfb::sWorkSpaceV[6];
f32 StateEfb::sWorkSpaceHideV[6];
f32 StateEfb::sUnkBuffer[6];
u32 StateEfb::sFlag = 4;
s32 StateEfb::sWorkBuffer = -1;
s32 StateEfb::sPushCount;
void StateEfb::Clean() {
sFlag &= ~(1 | 2);
sWorkBuffer = -1;
sPushCount = 0;
for (u32 i = 0; i < ARRAY_LENGTH(spBufferSet); i++) {
spBufferSet[i].field_0x08 = 0;
}
for (u32 i = 0; i < ARRAY_LENGTH(sWorkSpaceV); i++) {
sWorkSpaceV[i] = 0.0f;
sWorkSpaceHideV[i] = 0.0f;
}
}
bool StateEfb::releaseEfb(BufferType type, u32 userData) {
if (spBufferSet[type].buf != nullptr && spBufferSet[type].userData == userData) {
spBufferSet[type].buf->free();
spBufferSet[type].buf = nullptr;
spBufferSet[type].userData = 0;
spBufferSet[type].field_0x08 = 0;
return true;
} else {
return false;
}
}
} // namespace EGG
+1 -1
View File
@@ -34,7 +34,7 @@ static const f32 identity[3][4] = {
namespace EGG {
GXTexObj StateGX::sDefaultTexObj;
GXTexObj ALIGN_DECL(32) StateGX::sDefaultTexObj;
StateGX::MemLayout StateGX::s_tmem_layout;
StateGX::CacheGX StateGX::s_cacheGX;