mirror of
https://github.com/zeldaret/ss
synced 2026-08-20 14:14:40 -04:00
Initial import of JParticle + JSUList from TP
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
#ifndef JUTASSERT_H
|
||||
#define JUTASSERT_H
|
||||
|
||||
#include "dolphin/os.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#define JUT_ASSERT(LINE, COND) \
|
||||
(COND) ? (void)0 : (JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, LINE, #COND), OSPanic(__FILE__, LINE, "Halt"));
|
||||
|
||||
#define JUT_ASSERT_MSG(LINE, COND, MSG) \
|
||||
(COND) ? (void)0 : (JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, LINE, MSG), OSPanic(__FILE__, LINE, "Halt"));
|
||||
|
||||
#define JUT_ASSERT_MSG_F(LINE, COND, MSG, ...) \
|
||||
(COND) ? (void)0 : (JUTAssertion::showAssert_f(JUTAssertion::getSDevice(), __FILE__, LINE, MSG, __VA_ARGS__), OSPanic(__FILE__, LINE, "Halt"));
|
||||
|
||||
#define J3D_ASSERT(LINE, COND, MSG) JUT_ASSERT_MSG(LINE, (COND) != 0, MSG)
|
||||
|
||||
#define JUT_PANIC(LINE, TEXT) \
|
||||
JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, LINE, TEXT); \
|
||||
OSPanic(__FILE__, LINE, "Halt");
|
||||
|
||||
#define JUT_WARN_DEVICE(LINE, DEVICE, ...) \
|
||||
JUTAssertion::setWarningMessage_f(DEVICE, __FILE__, LINE, __VA_ARGS__); \
|
||||
|
||||
#define JUT_WARN(LINE, ...) \
|
||||
JUT_WARN_DEVICE(LINE, JUTAssertion::getSDevice(), __VA_ARGS__)
|
||||
|
||||
#define JUT_LOG(LINE, ...) \
|
||||
JUTAssertion::setLogMessage_f(JUTAssertion::getSDevice(), __FILE__, LINE, __VA_ARGS__)
|
||||
|
||||
#define JUT_CONFIRM(LINE, COND) \
|
||||
JUTAssertion::setConfirmMessage(JUTAssertion::getSDevice(), __FILE__, LINE, COND, #COND)
|
||||
|
||||
#else
|
||||
#define JUT_ASSERT(...) (void)0;
|
||||
#define JUT_ASSERT_MSG(...) (void)0;
|
||||
#define JUT_ASSERT_MSG_F(...) (void)0;
|
||||
#define J3D_ASSERT(...) (void)0;
|
||||
#define JUT_PANIC(...)
|
||||
#define JUT_WARN(...)
|
||||
#define JUT_WARN_DEVICE(...)
|
||||
#define JUT_LOG(...)
|
||||
#define JUT_CONFIRM(...)
|
||||
#endif
|
||||
|
||||
namespace JUTAssertion {
|
||||
/* 802E495C */ void create();
|
||||
/* 802E4960 */ u32 flush_subroutine();
|
||||
/* 802E499C */ void flushMessage();
|
||||
/* 802E4A54 */ void flushMessage_dbPrint();
|
||||
/* 802E4C34 */ void setVisible(bool);
|
||||
/* 802E4C3C */ void setMessageCount(int);
|
||||
|
||||
u32 getSDevice();
|
||||
void showAssert(u32 device, const char * file, int line, const char * assertion);
|
||||
void showAssert_f(u32 device, const char* file, int line, const char* msg, ...);
|
||||
void setWarningMessage_f(u32 device, char * file, int line, const char * fmt, ...);
|
||||
void setLogMessage_f(u32 device, char* file, int line, const char* fmt, ...);
|
||||
void setConfirmMessage(u32 param_1, char* file, int line, bool param_4, const char* msg);
|
||||
};
|
||||
|
||||
extern bool sAssertVisible;
|
||||
|
||||
#endif /* JUTASSERT_H */
|
||||
@@ -0,0 +1,113 @@
|
||||
#ifndef JUTTEXTURE_H
|
||||
#define JUTTEXTURE_H
|
||||
|
||||
#include <dolphin/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 */
|
||||
Reference in New Issue
Block a user