JPAResourceManager OK

This commit is contained in:
robojumper
2025-04-27 07:59:03 +02:00
parent 6468fc663c
commit 73ebfb9fae
6 changed files with 10 additions and 124 deletions
+1 -1
View File
@@ -18416,7 +18416,7 @@ fn_80316A10 = .text:0x80316A10; // type:function size:0x8
fn_80316A20 = .text:0x80316A20; // type:function size:0x8
__ct__18JPAResourceManagerFPCvPQ23EGG4Heap = .text:0x80316A30; // type:function size:0x58
getResource__18JPAResourceManagerCFUs = .text:0x80316A90; // type:function size:0x48
swapTexture__18JPAResourceManagerFPC7ResTIMGPCc = .text:0x80316AE0; // type:function size:0xA0
swapTexture__18JPAResourceManagerFPCQ23EGG7ResTIMGPCc = .text:0x80316AE0; // type:function size:0xA0
registRes__18JPAResourceManagerFP11JPAResource = .text:0x80316B80; // type:function size:0x20
registTex__18JPAResourceManagerFP10JPATexture = .text:0x80316BA0; // type:function size:0x20
getResUserWork__18JPAResourceManagerCFUs = .text:0x80316BC0; // type:function size:0x44
+1 -1
View File
@@ -1208,7 +1208,7 @@ config.libs = [
JSystemLib(
"JParticle",
[
Object(NonMatching, "JSystem/JParticle/JPAResourceManager.cpp"),
Object(Matching, "JSystem/JParticle/JPAResourceManager.cpp"),
Object(NonMatching, "JSystem/JParticle/JPAResource.cpp"),
Object(NonMatching, "JSystem/JParticle/JPABaseShape.cpp"),
Object(NonMatching, "JSystem/JParticle/JPAExtraShape.cpp"),
@@ -7,7 +7,6 @@
#include "JSystem/JParticle/JPATexture.h"
class JPAResource;
struct ResTIMG;
/**
* @ingroup jsystem-jparticle
@@ -18,7 +17,7 @@ public:
/* 80273E10 */ JPAResourceManager(void const*, EGG::Heap*);
/* 80273E68 */ JPAResource* getResource(u16) const;
/* 80273EA8 */ bool checkUserIndexDuplication(u16) const;
/* 80273EEC */ const ResTIMG* swapTexture(ResTIMG const*, char const*);
/* 80273EEC */ const EGG::ResTIMG* swapTexture(EGG::ResTIMG const*, char const*);
/* 80273F8C */ void registRes(JPAResource*);
/* 80273FAC */ void registTex(JPATexture*);
/* 80273FCC */ u32 getResUserWork(u16) const;
+4 -4
View File
@@ -3,7 +3,7 @@
#include "common.h"
#include "rvl/GX.h"
#include "JSystem/JUtility/JUTTexture.h"
#include "egg/gfx/eggTexture.h"
/**
* @ingroup jsystem-jparticle
@@ -13,7 +13,7 @@ struct JPATextureData {
// Probably magic / size / flags up top here, but they're unused.
/* 0x00 */ char field_0x00[0x0C];
/* 0x0C */ char mName[0x14];
/* 0x20 */ ResTIMG mResTIMG;
/* 0x20 */ EGG::ResTIMG mResTIMG;
};
/**
@@ -27,11 +27,11 @@ public:
void load(GXTexMapID texMapID) { mTexture.load(texMapID); }
JUTTexture* getJUTTexture() { return &mTexture; }
EGG::Texture* getJUTTexture() { return &mTexture; }
const char* getName() const { return mpData->mName; }
public:
JUTTexture mTexture;
EGG::Texture mTexture;
const JPATextureData* mpData;
};
-113
View File
@@ -1,113 +0,0 @@
#ifndef JUTTEXTURE_H
#define JUTTEXTURE_H
#include "rvl/GX.h"
class JUTPalette;
/**
* @ingroup jsystem-jutility
* @brief Image data header.
*
* Acts as the header to image data. Usually texture data immediately follows it,
* so any pointer arithmetic to go past the end of this structure is so that a
* variable sized allocated buffer can be accessed.
*
*/
struct ResTIMG {
/* 0x00 */ u8 format;
/* 0x01 */ u8 alphaEnabled;
/* 0x02 */ u16 width;
/* 0x04 */ u16 height;
/* 0x06 */ u8 wrapS;
/* 0x07 */ u8 wrapT;
/* 0x08 */ u8 indexTexture;
/* 0x09 */ u8 colorFormat;
/* 0x0A */ u16 numColors;
/* 0x0C */ u32 paletteOffset;
/* 0x10 */ u8 mipmapEnabled;
/* 0x11 */ u8 doEdgeLOD;
/* 0x12 */ u8 biasClamp;
/* 0x13 */ u8 maxAnisotropy;
/* 0x14 */ u8 minFilter;
/* 0x15 */ u8 magFilter;
/* 0x16 */ s8 minLOD;
/* 0x17 */ s8 maxLOD;
/* 0x18 */ u8 mipmapCount;
/* 0x19 */ u8 unknown;
/* 0x1A */ s16 LODBias;
/* 0x1C */ u32 imageOffset;
}; // Size: 0x20
/**
* @ingroup jsystem-jutility
*
*/
class JUTTexture {
public:
JUTTexture() {
setCaptureFlag(false);
mEmbPalette = NULL;
mTexInfo = NULL;
}
JUTTexture(const ResTIMG* p_timg, u8 param_1) {
mEmbPalette = NULL;
storeTIMG(p_timg, param_1);
setCaptureFlag(false);
}
~JUTTexture();
void storeTIMG(ResTIMG const*, JUTPalette*, _GXTlut);
void storeTIMG(ResTIMG const*, u8);
void storeTIMG(ResTIMG const*, JUTPalette*);
void attachPalette(JUTPalette*);
void init();
void initTexObj(_GXTlut);
void initTexObj();
void load(_GXTexMapID);
const ResTIMG* getTexInfo() const { return mTexInfo; }
s32 getFormat() const { return mTexInfo->format; }
s32 getTransparency() { return mTexInfo->alphaEnabled; }
s32 getWidth() const { return mTexInfo->width; }
s32 getHeight() const { return mTexInfo->height; }
void setCaptureFlag(bool flag) { mFlags &= 2 | flag; }
u8 getCaptureFlag() const { return mFlags & 1; }
u8 getEmbPaletteDelFlag() const { return mFlags & 2; }
void setEmbPaletteDelFlag(bool flag) { mFlags = (mFlags & 1) | (flag << 1);}
u8 getTlutName() const { return mTlutName; }
bool operator==(const JUTTexture& other) {
return mTexInfo == other.mTexInfo
&& field_0x2c == other.field_0x2c
&& mWrapS == other.mWrapS
&& mWrapT == other.mWrapT
&& mMinFilter == other.mMinFilter
&& mMagFilter == other.mMagFilter
&& mMinLOD == other.mMinLOD
&& mMinLOD == other.mMinLOD
&& mLODBias == other.mLODBias;
}
bool operator!=(const JUTTexture& other) {
return !operator==(other);
}
private:
/* 0x00 */ GXTexObj mTexObj;
/* 0x20 */ const ResTIMG* mTexInfo;
/* 0x24 */ void* mTexData;
/* 0x28 */ JUTPalette* mEmbPalette;
/* 0x2C */ JUTPalette* field_0x2c;
/* 0x30 */ u8 mWrapS;
/* 0x31 */ u8 mWrapT;
/* 0x32 */ u8 mMinFilter;
/* 0x33 */ u8 mMagFilter;
/* 0x34 */ u16 mMinLOD;
/* 0x36 */ u16 mMaxLOD;
/* 0x38 */ s16 mLODBias;
/* 0x3A */ u8 mTlutName;
/* 0x3B */ u8 mFlags;
/* 0x3C */ void* field_0x3c;
};
#endif /* JUTTEXTURE_H */
+3 -3
View File
@@ -43,12 +43,12 @@ bool JPAResourceManager::checkUserIndexDuplication(u16 usrIdx) const {
/* 80273EEC-80273F8C 26E82C 00A0+00 0/0 2/2 0/0 .text
* swapTexture__18JPAResourceManagerFPC7ResTIMGPCc */
const ResTIMG* JPAResourceManager::swapTexture(ResTIMG const* img, char const* swapName) {
const ResTIMG* ret = NULL;
const EGG::ResTIMG* JPAResourceManager::swapTexture(EGG::ResTIMG const* img, char const* swapName) {
const EGG::ResTIMG* ret = NULL;
for (s32 i = 0; i < mTexNum; i++) {
if (strcmp(swapName, mpTexArr[i]->getName()) == 0) {
JUTTexture* tex = mpTexArr[i]->getJUTTexture();
EGG::Texture* tex = mpTexArr[i]->getJUTTexture();
ret = tex->getTexInfo();
tex->storeTIMG(img, (u8)0);
break;