mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-05-23 06:34:18 -04:00
Merge pull request #502 from SwareJonge/JSystem
Implement all of JSystem
This commit is contained in:
@@ -10,40 +10,45 @@
|
||||
* Everything is fabricated here except for the default ctor.
|
||||
* Copied from J3DGXColorS10.
|
||||
*/
|
||||
struct J2DGXColorS10 : public GXColorS10
|
||||
{
|
||||
J2DGXColorS10() {}
|
||||
struct J2DGXColorS10 : public GXColorS10 {
|
||||
J2DGXColorS10() {
|
||||
}
|
||||
|
||||
J2DGXColorS10(u16 _r, u16 _g, u16 _b, u16 _a)
|
||||
{
|
||||
J2DGXColorS10(u16 _r, u16 _g, u16 _b, u16 _a) {
|
||||
r = _r;
|
||||
g = _g;
|
||||
b = _b;
|
||||
a = _a;
|
||||
}
|
||||
|
||||
J2DGXColorS10(const J2DGXColorS10 &other)
|
||||
{
|
||||
J2DGXColorS10(const J2DGXColorS10& other) {
|
||||
r = other.r;
|
||||
g = other.g;
|
||||
b = other.b;
|
||||
a = other.a;
|
||||
}
|
||||
|
||||
J2DGXColorS10(const u64 &other)
|
||||
{
|
||||
GXColorS10 *otherBytes = (GXColorS10 *)&other;
|
||||
J2DGXColorS10(const u64& other) {
|
||||
GXColorS10* otherBytes = (GXColorS10*)&other;
|
||||
r = otherBytes->r;
|
||||
g = otherBytes->g;
|
||||
b = otherBytes->b;
|
||||
a = otherBytes->a;
|
||||
}
|
||||
|
||||
inline operator u64() const { return toUInt64(); }
|
||||
inline u32 toUInt64() const { return *(u64 *)&r; }
|
||||
inline operator u64() const {
|
||||
return toUInt64();
|
||||
}
|
||||
inline u32 toUInt64() const {
|
||||
return *(u64*)&r;
|
||||
}
|
||||
|
||||
inline operator JUtility::TColor() const { return toTColor(); }
|
||||
inline JUtility::TColor toTColor() const { return JUtility::TColor(r, g, b, a); }
|
||||
inline operator JUtility::TColor() const {
|
||||
return toTColor();
|
||||
}
|
||||
inline JUtility::TColor toTColor() const {
|
||||
return JUtility::TColor(r, g, b, a);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -11,115 +11,136 @@
|
||||
* @fabricated
|
||||
*/
|
||||
enum J2DGrafType {
|
||||
J2DGraf_Base = 0,
|
||||
J2DGraf_Ortho = 1,
|
||||
J2DGraf_Persp = 2,
|
||||
J2DGraf_Base = 0,
|
||||
J2DGraf_Ortho = 1,
|
||||
J2DGraf_Persp = 2,
|
||||
};
|
||||
|
||||
struct J2DGrafBlend {
|
||||
u8 mType; // _00
|
||||
u8 mSrcFactor; // _01
|
||||
u8 mDestFactor; // _02
|
||||
u8 mType; // _00
|
||||
u8 mSrcFactor; // _01
|
||||
u8 mDestFactor; // _02
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
struct J2DGrafContext {
|
||||
J2DGrafContext(f32, f32, f32, f32);
|
||||
J2DGrafContext(f32, f32, f32, f32);
|
||||
|
||||
virtual ~J2DGrafContext() { } // _08 (weak)
|
||||
virtual void place(const JGeometry::TBox2f&); // _0C
|
||||
virtual void place(f32 x, f32 y, f32 width, f32 height)
|
||||
{
|
||||
JGeometry::TBox2f box(x, y, x + width, y + height);
|
||||
place(box);
|
||||
} // _10 (weak)
|
||||
virtual void setPort(); // _14
|
||||
virtual void setup2D(); // _18
|
||||
virtual void setScissor(); // _1C
|
||||
virtual J2DGrafType getGrafType() const { return J2DGraf_Base; } // _20 (weak)
|
||||
virtual void setLookat() { } // _24 (weak)
|
||||
virtual ~J2DGrafContext() {
|
||||
} // _08 (weak)
|
||||
virtual void place(const JGeometry::TBox2f&); // _0C
|
||||
virtual void place(f32 x, f32 y, f32 width, f32 height) {
|
||||
JGeometry::TBox2f box(x, y, x + width, y + height);
|
||||
place(box);
|
||||
} // _10 (weak)
|
||||
virtual void setPort(); // _14
|
||||
virtual void setup2D(); // _18
|
||||
virtual void setScissor(); // _1C
|
||||
virtual J2DGrafType getGrafType() const {
|
||||
return J2DGraf_Base;
|
||||
} // _20 (weak)
|
||||
virtual void setLookat() {
|
||||
} // _24 (weak)
|
||||
|
||||
void drawFrame(const JGeometry::TBox2f&);
|
||||
void fillBox(const JGeometry::TBox2f&);
|
||||
void lineTo(JGeometry::TVec2f);
|
||||
void drawFrame(const JGeometry::TBox2f&);
|
||||
void fillBox(const JGeometry::TBox2f&);
|
||||
void lineTo(JGeometry::TVec2f);
|
||||
|
||||
void lineTo(f32 x, f32 y) { lineTo(JGeometry::TVec2f(x, y)); }
|
||||
void moveTo(f32 x, f32 y) { moveTo(JGeometry::TVec2f(x, y)); }
|
||||
void lineTo(f32 x, f32 y) {
|
||||
lineTo(JGeometry::TVec2f(x, y));
|
||||
}
|
||||
void moveTo(f32 x, f32 y) {
|
||||
moveTo(JGeometry::TVec2f(x, y));
|
||||
}
|
||||
|
||||
void moveTo(JGeometry::TVec2f pos) { mPrevPos = pos; }
|
||||
void moveTo(JGeometry::TVec2f pos) {
|
||||
mPrevPos = pos;
|
||||
}
|
||||
|
||||
void scissor(const JGeometry::TBox2f&);
|
||||
void setColor(JUtility::TColor c) { setColor(c, c, c, c); }
|
||||
void setColor(JUtility::TColor, JUtility::TColor, JUtility::TColor, JUtility::TColor);
|
||||
void setLineWidth(u8);
|
||||
void scissor(const JGeometry::TBox2f&);
|
||||
void setColor(JUtility::TColor c) {
|
||||
setColor(c, c, c, c);
|
||||
}
|
||||
void setColor(JUtility::TColor, JUtility::TColor, JUtility::TColor, JUtility::TColor);
|
||||
void setLineWidth(u8);
|
||||
|
||||
// inlined
|
||||
void line(JGeometry::TVec2f, JGeometry::TVec2f);
|
||||
// inlined
|
||||
void line(JGeometry::TVec2f, JGeometry::TVec2f);
|
||||
|
||||
// _00 VTBL
|
||||
JGeometry::TBox2f mBounds; // _04
|
||||
JGeometry::TBox2f mScissorBounds; // _14
|
||||
JUtility::TColor mColorTL; // _24, top left
|
||||
JUtility::TColor mColorTR; // _28, top right
|
||||
JUtility::TColor mColorBR; // _2C, bottom right
|
||||
JUtility::TColor mColorBL; // _30, bottom left
|
||||
u8 mLineWidth; // _34
|
||||
JGeometry::TVec2f mPrevPos; // _38
|
||||
Mtx44 mMtx44; // _40
|
||||
GC_Mtx mPosMtx; // _80
|
||||
J2DGrafBlend _B0; // _B0
|
||||
J2DGrafBlend mLinePart; // _B3
|
||||
J2DGrafBlend mBoxPart; // _B6
|
||||
// _00 VTBL
|
||||
JGeometry::TBox2f mBounds; // _04
|
||||
JGeometry::TBox2f mScissorBounds; // _14
|
||||
JUtility::TColor mColorTL; // _24, top left
|
||||
JUtility::TColor mColorTR; // _28, top right
|
||||
JUtility::TColor mColorBR; // _2C, bottom right
|
||||
JUtility::TColor mColorBL; // _30, bottom left
|
||||
u8 mLineWidth; // _34
|
||||
JGeometry::TVec2f mPrevPos; // _38
|
||||
Mtx44 mMtx44; // _40
|
||||
GC_Mtx mPosMtx; // _80
|
||||
J2DGrafBlend _B0; // _B0
|
||||
J2DGrafBlend mLinePart; // _B3
|
||||
J2DGrafBlend mBoxPart; // _B6
|
||||
};
|
||||
|
||||
struct J2DPerspGraph : public J2DGrafContext {
|
||||
J2DPerspGraph();
|
||||
J2DPerspGraph();
|
||||
|
||||
virtual ~J2DPerspGraph() { } // _08 (weak)
|
||||
virtual void setPort(); // _14
|
||||
virtual J2DGrafType getGrafType() const { return J2DGraf_Persp; } // _20 (weak)
|
||||
virtual void setLookat(); // _24
|
||||
virtual ~J2DPerspGraph() {
|
||||
} // _08 (weak)
|
||||
virtual void setPort(); // _14
|
||||
virtual J2DGrafType getGrafType() const {
|
||||
return J2DGraf_Persp;
|
||||
} // _20 (weak)
|
||||
virtual void setLookat(); // _24
|
||||
|
||||
void makeLookat();
|
||||
void set(f32, f32, f32);
|
||||
void setFovy(f32);
|
||||
void makeLookat();
|
||||
void set(f32, f32, f32);
|
||||
void setFovy(f32);
|
||||
|
||||
inline f32 getFovY() const { return mFovY; }
|
||||
inline f32 getFovY() const {
|
||||
return mFovY;
|
||||
}
|
||||
|
||||
// _00 = VTBL
|
||||
// _00-_BC = J2DGrafContext
|
||||
f32 mFovY; // _BC
|
||||
f32 _C0; // _C0
|
||||
f32 _C4; // _C4
|
||||
f32 _C8; // _C8
|
||||
// _00 = VTBL
|
||||
// _00-_BC = J2DGrafContext
|
||||
f32 mFovY; // _BC
|
||||
f32 _C0; // _C0
|
||||
f32 _C4; // _C4
|
||||
f32 _C8; // _C8
|
||||
};
|
||||
|
||||
struct J2DOrthoGraph : public J2DGrafContext {
|
||||
J2DOrthoGraph();
|
||||
J2DOrthoGraph(f32, f32, f32, f32, f32, f32);
|
||||
J2DOrthoGraph();
|
||||
J2DOrthoGraph(f32, f32, f32, f32, f32, f32);
|
||||
|
||||
virtual ~J2DOrthoGraph() {}; // _08 (weak)
|
||||
virtual void setPort(); // _14
|
||||
virtual J2DGrafType getGrafType() const { return J2DGraf_Ortho; }; // _20 (weak)
|
||||
virtual void setLookat(); // _24
|
||||
virtual ~J2DOrthoGraph() {}; // _08 (weak)
|
||||
virtual void setPort(); // _14
|
||||
virtual J2DGrafType getGrafType() const {
|
||||
return J2DGraf_Ortho;
|
||||
}; // _20 (weak)
|
||||
virtual void setLookat(); // _24
|
||||
|
||||
void setOrtho(JGeometry::TBox2f const&, f32, f32);
|
||||
void scissorBounds(JGeometry::TBox2f*, JGeometry::TBox2f const*);
|
||||
void setOrtho(JGeometry::TBox2f const&, f32, f32);
|
||||
void scissorBounds(JGeometry::TBox2f*, JGeometry::TBox2f const*);
|
||||
|
||||
f32 getWidthPower() const { return mBounds.getWidth() / mOrtho.getWidth(); }
|
||||
f32 getHeightPower() const { return mBounds.getHeight() / mOrtho.getHeight(); }
|
||||
f32 getWidthPower() const {
|
||||
return mBounds.getWidth() / mOrtho.getWidth();
|
||||
}
|
||||
f32 getHeightPower() const {
|
||||
return mBounds.getHeight() / mOrtho.getHeight();
|
||||
}
|
||||
|
||||
void setOrtho(f32 param_0, f32 param_1, f32 param_2, f32 param_3, f32 param_4, f32 param_5)
|
||||
{
|
||||
JGeometry::TBox2<f32> ortho(param_0, param_1, param_0 + param_2, param_1 + param_3);
|
||||
setOrtho(ortho, param_4, param_5);
|
||||
}
|
||||
void setOrtho(f32 param_0, f32 param_1, f32 param_2, f32 param_3, f32 param_4, f32 param_5) {
|
||||
JGeometry::TBox2<f32> ortho(param_0, param_1, param_0 + param_2, param_1 + param_3);
|
||||
setOrtho(ortho, param_4, param_5);
|
||||
}
|
||||
|
||||
// _00 = VTBL
|
||||
// _00-_BC = J2DGrafContext
|
||||
JGeometry::TBox2f mOrtho; // _BC
|
||||
f32 mNear; // _CC
|
||||
f32 mFar; // _D0
|
||||
// _00 = VTBL
|
||||
// _00-_BC = J2DGrafContext
|
||||
JGeometry::TBox2f mOrtho; // _BC
|
||||
f32 mNear; // _CC
|
||||
f32 mFar; // _D0
|
||||
};
|
||||
|
||||
void J2DFillBox(f32 param_0, f32 param_1, f32 param_2, f32 param_3, JUtility::TColor color);
|
||||
|
||||
@@ -8,11 +8,14 @@
|
||||
#ifdef __cplusplus
|
||||
typedef float Mtx23[2][3];
|
||||
|
||||
struct J2DIndTexCoordScaleInfo
|
||||
{
|
||||
struct J2DIndTexCoordScaleInfo {
|
||||
|
||||
GXIndTexScale getScaleS() const { return (GXIndTexScale)mScaleS; }
|
||||
GXIndTexScale getScaleT() const { return (GXIndTexScale)mScaleT; }
|
||||
GXIndTexScale getScaleS() const {
|
||||
return (GXIndTexScale)mScaleS;
|
||||
}
|
||||
GXIndTexScale getScaleT() const {
|
||||
return (GXIndTexScale)mScaleT;
|
||||
}
|
||||
|
||||
u8 mScaleS; // _00
|
||||
u8 mScaleT; // _01
|
||||
@@ -21,19 +24,18 @@ struct J2DIndTexCoordScaleInfo
|
||||
/**
|
||||
* @size{0x2}
|
||||
*/
|
||||
struct J2DIndTexCoordScale
|
||||
{
|
||||
struct J2DIndTexCoordScale {
|
||||
J2DIndTexCoordScale();
|
||||
|
||||
~J2DIndTexCoordScale() {}
|
||||
~J2DIndTexCoordScale() {
|
||||
}
|
||||
|
||||
void load(u8);
|
||||
|
||||
J2DIndTexCoordScaleInfo mScaleInfo; // _00
|
||||
};
|
||||
|
||||
struct J2DIndTexMtxInfo
|
||||
{
|
||||
struct J2DIndTexMtxInfo {
|
||||
Mtx23 mMtx; // _00
|
||||
s8 mScale; // _18
|
||||
};
|
||||
@@ -41,11 +43,11 @@ struct J2DIndTexMtxInfo
|
||||
/**
|
||||
* @size{0x1C}
|
||||
*/
|
||||
struct J2DIndTexMtx
|
||||
{
|
||||
struct J2DIndTexMtx {
|
||||
J2DIndTexMtx();
|
||||
|
||||
~J2DIndTexMtx() {}
|
||||
~J2DIndTexMtx() {
|
||||
}
|
||||
|
||||
void load(u8);
|
||||
|
||||
@@ -57,8 +59,7 @@ extern J2DIndTexMtxInfo j2dDefaultIndTexMtxInfo;
|
||||
/**
|
||||
* @size{0x2}
|
||||
*/
|
||||
struct J2DIndTexOrder
|
||||
{
|
||||
struct J2DIndTexOrder {
|
||||
J2DIndTexOrder();
|
||||
void load(u8);
|
||||
|
||||
@@ -66,29 +67,40 @@ struct J2DIndTexOrder
|
||||
u8 mMap; // _01
|
||||
};
|
||||
|
||||
struct J2DIndBlock
|
||||
{
|
||||
virtual void initialize() {} // _08 (weak)
|
||||
virtual void setGX() {} // _0C (weak)
|
||||
virtual u32 getType() = 0; // _10
|
||||
virtual void setIndTexStageNum(u8 texStageNum) {} // _14 (weak)
|
||||
virtual u8 getIndTexStageNum() const { return 0; } // _18 (weak)
|
||||
virtual void setIndTexOrder(unsigned long index, J2DIndTexOrder order) {} // _1C (weak)
|
||||
virtual J2DIndTexOrder *getIndTexOrder(unsigned long index) { return nullptr; } // _20 (weak)
|
||||
virtual void setIndTexMtx(unsigned long index, J2DIndTexMtx texMtx) {} // _24 (weak)
|
||||
virtual J2DIndTexMtx *getIndTexMtx(unsigned long index) { return nullptr; } // _28 (weak)
|
||||
virtual void setIndTexCoordScale(unsigned long index, J2DIndTexCoordScale scale) {} // _2C (weak)
|
||||
virtual J2DIndTexCoordScale *getIndTexCoordScale(unsigned long index) { return nullptr; } // _30 (weak)
|
||||
virtual ~J2DIndBlock() {} // _34 (weak)
|
||||
struct J2DIndBlock {
|
||||
virtual void initialize() {
|
||||
} // _08 (weak)
|
||||
virtual void setGX() {
|
||||
} // _0C (weak)
|
||||
virtual u32 getType() = 0; // _10
|
||||
virtual void setIndTexStageNum(u8 texStageNum) {
|
||||
} // _14 (weak)
|
||||
virtual u8 getIndTexStageNum() const {
|
||||
return 0;
|
||||
} // _18 (weak)
|
||||
virtual void setIndTexOrder(unsigned long index, J2DIndTexOrder order) {
|
||||
} // _1C (weak)
|
||||
virtual J2DIndTexOrder* getIndTexOrder(unsigned long index) {
|
||||
return nullptr;
|
||||
} // _20 (weak)
|
||||
virtual void setIndTexMtx(unsigned long index, J2DIndTexMtx texMtx) {
|
||||
} // _24 (weak)
|
||||
virtual J2DIndTexMtx* getIndTexMtx(unsigned long index) {
|
||||
return nullptr;
|
||||
} // _28 (weak)
|
||||
virtual void setIndTexCoordScale(unsigned long index, J2DIndTexCoordScale scale) {
|
||||
} // _2C (weak)
|
||||
virtual J2DIndTexCoordScale* getIndTexCoordScale(unsigned long index) {
|
||||
return nullptr;
|
||||
} // _30 (weak)
|
||||
virtual ~J2DIndBlock() {
|
||||
} // _34 (weak)
|
||||
|
||||
// _00 VTBL
|
||||
};
|
||||
|
||||
struct J2DIndBlockNull : public J2DIndBlock
|
||||
{
|
||||
inline J2DIndBlockNull()
|
||||
: J2DIndBlock()
|
||||
{
|
||||
struct J2DIndBlockNull : public J2DIndBlock {
|
||||
inline J2DIndBlockNull() : J2DIndBlock() {
|
||||
}
|
||||
|
||||
virtual void setGX(); // _0C (weak)
|
||||
@@ -96,26 +108,40 @@ struct J2DIndBlockNull : public J2DIndBlock
|
||||
virtual ~J2DIndBlockNull(); // _34 (weak)
|
||||
};
|
||||
|
||||
struct J2DIndBlockFull : public J2DIndBlock
|
||||
{
|
||||
inline J2DIndBlockFull()
|
||||
: J2DIndBlock(), mTexOrders(), mTexMtxes(), mTexCoordScales()
|
||||
{
|
||||
struct J2DIndBlockFull : public J2DIndBlock {
|
||||
inline J2DIndBlockFull() : J2DIndBlock(), mTexOrders(), mTexMtxes(), mTexCoordScales() {
|
||||
initialize();
|
||||
}
|
||||
|
||||
virtual void initialize(); // _08
|
||||
virtual void setGX(); // _0C
|
||||
virtual u32 getType() { return JBT_IndFull; } // _10 (weak)
|
||||
virtual void setIndTexStageNum(u8 texStageNum) { mTexStageNum = texStageNum; } // _14 (weak)
|
||||
virtual u8 getIndTexStageNum() const { return mTexStageNum; } // _18 (weak)
|
||||
virtual void setIndTexOrder(unsigned long index, J2DIndTexOrder order) { mTexOrders[index] = order; } // _1C (weak)
|
||||
virtual J2DIndTexOrder *getIndTexOrder(unsigned long index) { return mTexOrders + index; } // _20 (weak)
|
||||
virtual void setIndTexMtx(unsigned long, J2DIndTexMtx); // _24 (weak)
|
||||
virtual J2DIndTexMtx *getIndTexMtx(unsigned long index) { return mTexMtxes + index; } // _28 (weak)
|
||||
virtual void setIndTexCoordScale(unsigned long index, J2DIndTexCoordScale scale) { mTexCoordScales[index] = scale; } // _2C (weak)
|
||||
virtual J2DIndTexCoordScale *getIndTexCoordScale(unsigned long index) { return mTexCoordScales + index; } // _30 (weak)
|
||||
virtual ~J2DIndBlockFull() {} // _34 (weak)
|
||||
virtual void initialize(); // _08
|
||||
virtual void setGX(); // _0C
|
||||
virtual u32 getType() {
|
||||
return JBT_IndFull;
|
||||
} // _10 (weak)
|
||||
virtual void setIndTexStageNum(u8 texStageNum) {
|
||||
mTexStageNum = texStageNum;
|
||||
} // _14 (weak)
|
||||
virtual u8 getIndTexStageNum() const {
|
||||
return mTexStageNum;
|
||||
} // _18 (weak)
|
||||
virtual void setIndTexOrder(unsigned long index, J2DIndTexOrder order) {
|
||||
mTexOrders[index] = order;
|
||||
} // _1C (weak)
|
||||
virtual J2DIndTexOrder* getIndTexOrder(unsigned long index) {
|
||||
return mTexOrders + index;
|
||||
} // _20 (weak)
|
||||
virtual void setIndTexMtx(unsigned long, J2DIndTexMtx); // _24 (weak)
|
||||
virtual J2DIndTexMtx* getIndTexMtx(unsigned long index) {
|
||||
return mTexMtxes + index;
|
||||
} // _28 (weak)
|
||||
virtual void setIndTexCoordScale(unsigned long index, J2DIndTexCoordScale scale) {
|
||||
mTexCoordScales[index] = scale;
|
||||
} // _2C (weak)
|
||||
virtual J2DIndTexCoordScale* getIndTexCoordScale(unsigned long index) {
|
||||
return mTexCoordScales + index;
|
||||
} // _30 (weak)
|
||||
virtual ~J2DIndBlockFull() {
|
||||
} // _34 (weak)
|
||||
|
||||
u8 mTexStageNum; // _04
|
||||
J2DIndTexOrder mTexOrders[4]; // _05
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
#define J2DTYPES_H
|
||||
|
||||
/**
|
||||
* Header for J2D POD and nearly POD types, as well as defines, typedefs, and enums that aren't specific to a particular non-POD type.
|
||||
* Header for J2D POD and nearly POD types, as well as defines, typedefs, and enums that aren't specific to a particular
|
||||
* non-POD type.
|
||||
*/
|
||||
#include <dolphin/mtx.h>
|
||||
#include "JSystem/J2D/J2DGXColorS10.h"
|
||||
@@ -13,29 +14,23 @@
|
||||
#ifdef __cplusplus
|
||||
struct JUTTexture;
|
||||
|
||||
enum J2DBinding
|
||||
{
|
||||
enum J2DBinding {
|
||||
J2DBIND_Unk15 = 15,
|
||||
};
|
||||
|
||||
enum J2DMirror
|
||||
{
|
||||
enum J2DMirror {
|
||||
J2DMIRROR_Unk0 = 0,
|
||||
};
|
||||
|
||||
extern u16 j2dDefaultAlphaCmp;
|
||||
|
||||
struct J2DAlphaCompInfo
|
||||
{
|
||||
struct J2DAlphaCompInfo {
|
||||
// TODO: work out what goes in this
|
||||
};
|
||||
|
||||
struct J2DAlphaComp
|
||||
{
|
||||
struct J2DAlphaComp {
|
||||
/** @fabricated */
|
||||
J2DAlphaComp()
|
||||
: mAlphaComp(j2dDefaultAlphaCmp), mRef0(0), mRef1(0)
|
||||
{
|
||||
J2DAlphaComp() : mAlphaComp(j2dDefaultAlphaCmp), mRef0(0), mRef1(0) {
|
||||
}
|
||||
|
||||
u16 mAlphaComp; // _00
|
||||
@@ -43,19 +38,17 @@ struct J2DAlphaComp
|
||||
u8 mRef1; // _03
|
||||
};
|
||||
|
||||
struct J2DBlendInfo
|
||||
{
|
||||
J2DBlendInfo() {}
|
||||
struct J2DBlendInfo {
|
||||
J2DBlendInfo() {
|
||||
}
|
||||
|
||||
J2DBlendInfo(u8 type, u8 srcFactor, u8 destFactor)
|
||||
{
|
||||
J2DBlendInfo(u8 type, u8 srcFactor, u8 destFactor) {
|
||||
mType = type;
|
||||
mSrcFactor = srcFactor;
|
||||
mDestFactor = destFactor;
|
||||
}
|
||||
|
||||
void operator=(J2DBlendInfo const &other)
|
||||
{
|
||||
void operator=(J2DBlendInfo const& other) {
|
||||
mType = other.mType;
|
||||
mSrcFactor = other.mSrcFactor;
|
||||
mDestFactor = other.mDestFactor;
|
||||
@@ -68,23 +61,20 @@ struct J2DBlendInfo
|
||||
|
||||
extern J2DBlendInfo j2dDefaultBlendInfo;
|
||||
|
||||
struct J2DBlend
|
||||
{
|
||||
J2DBlend() { mBlendInfo = j2dDefaultBlendInfo; }
|
||||
|
||||
J2DBlend(u8 type, u8 srcFactor, u8 destFactor, u8 op)
|
||||
: mBlendInfo(type, srcFactor, destFactor), mOp(op)
|
||||
{
|
||||
struct J2DBlend {
|
||||
J2DBlend() {
|
||||
mBlendInfo = j2dDefaultBlendInfo;
|
||||
}
|
||||
|
||||
void operator=(J2DBlend const &other)
|
||||
{
|
||||
J2DBlend(u8 type, u8 srcFactor, u8 destFactor, u8 op) : mBlendInfo(type, srcFactor, destFactor), mOp(op) {
|
||||
}
|
||||
|
||||
void operator=(J2DBlend const& other) {
|
||||
mBlendInfo = other.mBlendInfo;
|
||||
mOp = other.mOp;
|
||||
}
|
||||
|
||||
inline void set(J2DBlend blend)
|
||||
{
|
||||
inline void set(J2DBlend blend) {
|
||||
mBlendInfo = blend.mBlendInfo;
|
||||
mOp = blend.mOp;
|
||||
}
|
||||
@@ -93,8 +83,7 @@ struct J2DBlend
|
||||
u8 mOp; // _03
|
||||
};
|
||||
|
||||
struct J2DColorChanInfo
|
||||
{
|
||||
struct J2DColorChanInfo {
|
||||
u8 _00; // _00, should these be one u16?
|
||||
u8 _01; // _01
|
||||
};
|
||||
@@ -104,17 +93,19 @@ extern J2DColorChanInfo j2dDefaultColorChanInfo;
|
||||
/**
|
||||
* @size{0x2}
|
||||
*/
|
||||
struct J2DColorChan
|
||||
{
|
||||
J2DColorChan() { mData = j2dDefaultColorChanInfo._01; }
|
||||
struct J2DColorChan {
|
||||
J2DColorChan() {
|
||||
mData = j2dDefaultColorChanInfo._01;
|
||||
}
|
||||
|
||||
u16 getMatSrc() const { return mData & 1; }
|
||||
u16 getMatSrc() const {
|
||||
return mData & 1;
|
||||
}
|
||||
|
||||
u16 mData; // _00, should this be J2DColorChanInfo?
|
||||
};
|
||||
|
||||
struct J2DTevOrderInfo
|
||||
{
|
||||
struct J2DTevOrderInfo {
|
||||
u8 mTexCoord; // _00
|
||||
u8 mTexMap; // _01
|
||||
u8 mColor; // _02
|
||||
@@ -122,42 +113,45 @@ struct J2DTevOrderInfo
|
||||
|
||||
extern J2DTevOrderInfo j2dDefaultTevOrderInfoNull;
|
||||
|
||||
struct J2DTevOrder
|
||||
{
|
||||
J2DTevOrder() { mTevOrderInfo = j2dDefaultTevOrderInfoNull; }
|
||||
struct J2DTevOrder {
|
||||
J2DTevOrder() {
|
||||
mTevOrderInfo = j2dDefaultTevOrderInfoNull;
|
||||
}
|
||||
|
||||
/** @fabricated */
|
||||
inline J2DTevOrder(u8 texCoord, u8 texMap, u8 color)
|
||||
{
|
||||
inline J2DTevOrder(u8 texCoord, u8 texMap, u8 color) {
|
||||
mTevOrderInfo.mTexCoord = texCoord;
|
||||
mTevOrderInfo.mTexMap = texMap;
|
||||
mTevOrderInfo.mColor = color;
|
||||
}
|
||||
|
||||
/** @fabricated */
|
||||
inline J2DTevOrder &operator=(const J2DTevOrderInfo &other)
|
||||
{
|
||||
inline J2DTevOrder& operator=(const J2DTevOrderInfo& other) {
|
||||
mTevOrderInfo = other;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** @fabricated */
|
||||
inline J2DTevOrder &operator=(const J2DTevOrder &other)
|
||||
{
|
||||
inline J2DTevOrder& operator=(const J2DTevOrder& other) {
|
||||
mTevOrderInfo = other.mTevOrderInfo;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline GXChannelID getColor() const { return (GXChannelID)mTevOrderInfo.mColor; }
|
||||
inline GXTexMapID getTexMap() const { return (GXTexMapID)mTevOrderInfo.mTexMap; }
|
||||
inline GXTexCoordID getTexCoord() const { return (GXTexCoordID)mTevOrderInfo.mTexCoord; }
|
||||
inline GXChannelID getColor() const {
|
||||
return (GXChannelID)mTevOrderInfo.mColor;
|
||||
}
|
||||
inline GXTexMapID getTexMap() const {
|
||||
return (GXTexMapID)mTevOrderInfo.mTexMap;
|
||||
}
|
||||
inline GXTexCoordID getTexCoord() const {
|
||||
return (GXTexCoordID)mTevOrderInfo.mTexCoord;
|
||||
}
|
||||
|
||||
J2DTevOrderInfo mTevOrderInfo; // _00
|
||||
u8 _03; // _03
|
||||
};
|
||||
|
||||
struct J2DTevStageInfo
|
||||
{
|
||||
struct J2DTevStageInfo {
|
||||
u8 _00; // _00
|
||||
bool _01; // _01
|
||||
u8 _02; // _02
|
||||
@@ -181,8 +175,7 @@ struct J2DTevStageInfo
|
||||
};
|
||||
|
||||
#pragma reverse_bitfields on
|
||||
struct J2DTevStage_0x1
|
||||
{
|
||||
struct J2DTevStage_0x1 {
|
||||
// LSB
|
||||
u8 _0 : 2;
|
||||
u8 _2 : 1;
|
||||
@@ -192,8 +185,7 @@ struct J2DTevStage_0x1
|
||||
// MSB
|
||||
};
|
||||
|
||||
struct J2DTevStage_0x4
|
||||
{
|
||||
struct J2DTevStage_0x4 {
|
||||
// LSB
|
||||
u8 _0 : 1;
|
||||
u8 _1 : 3;
|
||||
@@ -210,15 +202,13 @@ struct J2DTevStage_0x4
|
||||
// u8 _0 : 2;
|
||||
// MSB
|
||||
};
|
||||
struct J2DTevStage
|
||||
{
|
||||
struct J2DTevStage {
|
||||
J2DTevStage();
|
||||
|
||||
void setTevStageInfo(const J2DTevStageInfo &info);
|
||||
void setTevStageInfo(const J2DTevStageInfo& info);
|
||||
|
||||
/** @fabricated */
|
||||
inline J2DTevStage &operator=(const J2DTevStage &other)
|
||||
{
|
||||
inline J2DTevStage& operator=(const J2DTevStage& other) {
|
||||
_01 = other._01;
|
||||
_02 = other._02;
|
||||
_03 = other._03;
|
||||
@@ -233,8 +223,7 @@ struct J2DTevStage
|
||||
u8 _02; // _02
|
||||
u8 _03; // _03
|
||||
// u8 _04; // _04
|
||||
union
|
||||
{
|
||||
union {
|
||||
J2DTevStage_0x4 asStruct;
|
||||
u8 asBytes[4];
|
||||
} _04; // _04
|
||||
@@ -269,14 +258,12 @@ struct J2DTevStage
|
||||
// } _06; // _06
|
||||
};
|
||||
|
||||
struct J2DTevSwapModeInfo
|
||||
{
|
||||
struct J2DTevSwapModeInfo {
|
||||
u8 _00;
|
||||
u8 _01;
|
||||
};
|
||||
|
||||
struct J2DTevSwapModeTableInfo
|
||||
{
|
||||
struct J2DTevSwapModeTableInfo {
|
||||
// TODO: work out what goes in this
|
||||
};
|
||||
|
||||
@@ -284,13 +271,11 @@ struct J2DTevSwapModeTableInfo
|
||||
// u8 _00 : 2;
|
||||
// };
|
||||
|
||||
struct J2DTevSwapModeTable
|
||||
{
|
||||
struct J2DTevSwapModeTable {
|
||||
J2DTevSwapModeTable();
|
||||
|
||||
/** @fabricated */
|
||||
inline J2DTevSwapModeTable(u8 p1, u8 p2, u8 p3, u8 p4)
|
||||
{
|
||||
inline J2DTevSwapModeTable(u8 p1, u8 p2, u8 p3, u8 p4) {
|
||||
_0 = p1;
|
||||
_2 = p2;
|
||||
_4 = p3;
|
||||
@@ -310,27 +295,43 @@ struct J2DTevSwapModeTable
|
||||
};
|
||||
#pragma reverse_bitfields reset
|
||||
|
||||
struct J2DIndTevStage
|
||||
{
|
||||
struct J2DIndTevStage {
|
||||
J2DIndTevStage();
|
||||
|
||||
void load(u8);
|
||||
|
||||
GXIndTexStageID getIndStage() const { return (GXIndTexStageID)(mFlags & 0x03); }
|
||||
GXIndTexFormat getIndFormat() const { return (GXIndTexFormat)((mFlags >> 2) & 0x03); }
|
||||
GXIndTexBiasSel getBiasSel() const { return (GXIndTexBiasSel)((mFlags >> 4) & 0x07); }
|
||||
GXIndTexWrap getWrapS() const { return (GXIndTexWrap)((mFlags >> 8) & 0x07); }
|
||||
GXIndTexWrap getWrapT() const { return (GXIndTexWrap)((mFlags >> 11) & 0x07); }
|
||||
GXIndTexMtxID getMtxSel() const { return (GXIndTexMtxID)((mFlags >> 16) & 0x0F); }
|
||||
GXBool getPrev() const { return (GXBool)((mFlags >> 20) & 0x01); }
|
||||
GXBool getLod() const { return (GXBool)((mFlags >> 21) & 0x01); }
|
||||
GXIndTexAlphaSel getAlphaSel() const { return (GXIndTexAlphaSel)((mFlags >> 22) & 0x03); }
|
||||
GXIndTexStageID getIndStage() const {
|
||||
return (GXIndTexStageID)(mFlags & 0x03);
|
||||
}
|
||||
GXIndTexFormat getIndFormat() const {
|
||||
return (GXIndTexFormat)((mFlags >> 2) & 0x03);
|
||||
}
|
||||
GXIndTexBiasSel getBiasSel() const {
|
||||
return (GXIndTexBiasSel)((mFlags >> 4) & 0x07);
|
||||
}
|
||||
GXIndTexWrap getWrapS() const {
|
||||
return (GXIndTexWrap)((mFlags >> 8) & 0x07);
|
||||
}
|
||||
GXIndTexWrap getWrapT() const {
|
||||
return (GXIndTexWrap)((mFlags >> 11) & 0x07);
|
||||
}
|
||||
GXIndTexMtxID getMtxSel() const {
|
||||
return (GXIndTexMtxID)((mFlags >> 16) & 0x0F);
|
||||
}
|
||||
GXBool getPrev() const {
|
||||
return (GXBool)((mFlags >> 20) & 0x01);
|
||||
}
|
||||
GXBool getLod() const {
|
||||
return (GXBool)((mFlags >> 21) & 0x01);
|
||||
}
|
||||
GXIndTexAlphaSel getAlphaSel() const {
|
||||
return (GXIndTexAlphaSel)((mFlags >> 22) & 0x03);
|
||||
}
|
||||
|
||||
u32 mFlags; // _00
|
||||
};
|
||||
|
||||
struct J2DTexCoordInfo
|
||||
{
|
||||
struct J2DTexCoordInfo {
|
||||
u8 mTexGenType; // _00
|
||||
u8 mTexGenSrc; // _01
|
||||
u8 mTexGenMtx; // _02
|
||||
@@ -338,16 +339,14 @@ struct J2DTexCoordInfo
|
||||
u8 _03; // _03 - padding?
|
||||
};
|
||||
|
||||
struct J2DTexCoord
|
||||
{
|
||||
struct J2DTexCoord {
|
||||
J2DTexCoord();
|
||||
// J2DTexCoordInfo _00;
|
||||
|
||||
J2DTexCoordInfo mTexCoordInfo; // _00
|
||||
};
|
||||
|
||||
struct J2DTextureSRTInfo
|
||||
{
|
||||
struct J2DTextureSRTInfo {
|
||||
f32 _00; // _00
|
||||
f32 _04; // _04
|
||||
f32 _08; // _08
|
||||
@@ -371,15 +370,13 @@ extern const u8 j2dDefaultDither;
|
||||
extern u8 j2dDefaultTevSwapTable;
|
||||
// j2dDefaultAlphaCmp declared earlier in file.
|
||||
|
||||
enum J2DTextBoxHBinding
|
||||
{
|
||||
enum J2DTextBoxHBinding {
|
||||
J2DHBIND_Center = 0,
|
||||
J2DHBIND_Right = 1,
|
||||
J2DHBIND_Left = 2,
|
||||
};
|
||||
|
||||
enum J2DTextBoxVBinding
|
||||
{
|
||||
enum J2DTextBoxVBinding {
|
||||
J2DVBIND_Center = 0,
|
||||
J2DVBIND_Bottom = 1,
|
||||
J2DVBIND_Top = 2,
|
||||
|
||||
@@ -5,29 +5,29 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
enum JBlockType {
|
||||
JBT_ColorAmbientOn = 'CLAB',
|
||||
JBT_ColorNull = 'CLNL',
|
||||
JBT_ColorLightOff = 'CLOF',
|
||||
JBT_ColorLightOn = 'CLON',
|
||||
JBT_IndFull = 'IBLF',
|
||||
JBT_IndNull = 'IBLN',
|
||||
JBT_PETexEdge = 'PEED',
|
||||
JBT_PEFogOff = 'PEFG',
|
||||
JBT_PEFull = 'PEFL',
|
||||
JBT_PENull = 'PENL',
|
||||
JBT_PEOpa = 'PEOP',
|
||||
JBT_PEXlu = 'PEXL',
|
||||
JBT_TexGen4 = 'TGB4',
|
||||
JBT_TexGenBasic = 'TGBC',
|
||||
JBT_TexGenNull = 'TGNL',
|
||||
JBT_TexGenPatched = 'TGPT',
|
||||
JBT_Tev16 = 'TV16',
|
||||
JBT_Tev1 = 'TVB1',
|
||||
JBT_Tev2 = 'TVB2',
|
||||
JBT_Tev4 = 'TVB4',
|
||||
JBT_Tev8 = 'TVB8',
|
||||
JBT_TevNull = 'TVNL',
|
||||
JBT_TevPatched = 'TVPT'
|
||||
JBT_ColorAmbientOn = 'CLAB',
|
||||
JBT_ColorNull = 'CLNL',
|
||||
JBT_ColorLightOff = 'CLOF',
|
||||
JBT_ColorLightOn = 'CLON',
|
||||
JBT_IndFull = 'IBLF',
|
||||
JBT_IndNull = 'IBLN',
|
||||
JBT_PETexEdge = 'PEED',
|
||||
JBT_PEFogOff = 'PEFG',
|
||||
JBT_PEFull = 'PEFL',
|
||||
JBT_PENull = 'PENL',
|
||||
JBT_PEOpa = 'PEOP',
|
||||
JBT_PEXlu = 'PEXL',
|
||||
JBT_TexGen4 = 'TGB4',
|
||||
JBT_TexGenBasic = 'TGBC',
|
||||
JBT_TexGenNull = 'TGNL',
|
||||
JBT_TexGenPatched = 'TGPT',
|
||||
JBT_Tev16 = 'TV16',
|
||||
JBT_Tev1 = 'TVB1',
|
||||
JBT_Tev2 = 'TVB2',
|
||||
JBT_Tev4 = 'TVB4',
|
||||
JBT_Tev8 = 'TVB8',
|
||||
JBT_TevNull = 'TVNL',
|
||||
JBT_TevPatched = 'TVPT'
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
#ifndef _JSYSTEM_JFW_JFWDISPLAY_H
|
||||
#define _JSYSTEM_JFW_JFWDISPLAY_H
|
||||
|
||||
#include <dolphin/gx.h>
|
||||
#include <dolphin/mtx.h>
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JUtility/JUTDirectPrint.h"
|
||||
#include "JSystem/JUtility/JUTFader.h"
|
||||
#include "JSystem/JUtility/JUTProcBar.h"
|
||||
#include "JSystem/JUtility/JUTVideo.h"
|
||||
#include "JSystem/JUtility/JUTXfb.h"
|
||||
#include "JSystem/JUtility/TColor.h"
|
||||
#include "types.h"
|
||||
|
||||
typedef void (*JFWDisplayUnkFunc)(void);
|
||||
|
||||
extern GC_Mtx e_mtx;
|
||||
|
||||
class JFWAlarm : public OSAlarm { // everything here seems to be auto inlined or unused
|
||||
public:
|
||||
// Contructor and Destructor are both present in map but unused, not sure if it belongs here
|
||||
JFWAlarm() {
|
||||
}
|
||||
~JFWAlarm() {
|
||||
}
|
||||
void createAlarm() {
|
||||
OSCreateAlarm(this);
|
||||
}
|
||||
void cancelAlarm() {
|
||||
OSCancelAlarm(this);
|
||||
}
|
||||
|
||||
OSThread* getThread() const {
|
||||
return mThread;
|
||||
}
|
||||
void setThread(OSThread* thread) {
|
||||
mThread = thread;
|
||||
}
|
||||
|
||||
static JSUList<JFWAlarm> sList; //
|
||||
|
||||
public:
|
||||
/* 0x28 */ OSThread* mThread;
|
||||
};
|
||||
|
||||
class JFWDisplay {
|
||||
public:
|
||||
enum EDrawDone {
|
||||
/* 0x0 */ UNK_METHOD_0 = 0,
|
||||
/* 0x1 */ UNK_METHOD_1 = 1
|
||||
};
|
||||
|
||||
static JFWDisplay* createManager(const _GXRenderModeObj*, JKRHeap*, JUTXfb::EXfbNumber, bool); // 0x80015bfc
|
||||
void waitBlanking(int); // 0x8001684c
|
||||
void threadSleep(s64); // 0x800169fc
|
||||
void clearEfb_init(); // 0x80016ab8
|
||||
void clearEfb(); // 0x80016b2c
|
||||
void clearEfb(_GXColor); // 0x80016b58
|
||||
void clearEfb(int, int, int, int, _GXColor); // 0x80016b9c
|
||||
void calcCombinationRatio(); // 0x80016f0c
|
||||
|
||||
void ctor_subroutine(const GXRenderModeObj*, bool);
|
||||
JFWDisplay(const GXRenderModeObj*, JKRHeap*, JUTXfb::EXfbNumber, bool);
|
||||
|
||||
static void destroyManager();
|
||||
void prepareCopyDisp();
|
||||
void drawendXfb_single();
|
||||
void exchangeXfb_double();
|
||||
void exchangeXfb_triple();
|
||||
void copyXfb_triple();
|
||||
void preGX();
|
||||
void endGX();
|
||||
void* changeToSingleXfb(int);
|
||||
void* changeToDoubleXfb();
|
||||
|
||||
// UNUSED
|
||||
JFWDisplay(void*, bool);
|
||||
JFWDisplay(void*, void*, bool);
|
||||
JFWDisplay(void*, void*, void*, bool);
|
||||
void createManager(const _GXRenderModeObj*, void*, bool);
|
||||
void createManager(const _GXRenderModeObj*, void*, void*, bool);
|
||||
void createManager(const _GXRenderModeObj*, void*, void*, void*, bool);
|
||||
void deleteToSingleXfb(int);
|
||||
void deleteToSingleXfb(void*);
|
||||
void addToDoubleXfb(void*, bool);
|
||||
void addToDoubleXfb(JKRHeap*);
|
||||
void clearAllXfb();
|
||||
s32 frameToTick(float);
|
||||
static void setForOSResetSystem();
|
||||
|
||||
// Virtual functions
|
||||
virtual void beginRender(); // 0x80015e0c
|
||||
virtual void endRender(); // 0x8001633c
|
||||
virtual void endFrame(); // 0x8001669c
|
||||
virtual ~JFWDisplay(); // 0x80015b80
|
||||
|
||||
static JFWDisplay* getManager() {
|
||||
return sManager;
|
||||
}
|
||||
|
||||
int getEfbHeight() const {
|
||||
return JUTVideo::getManager()->getEfbHeight();
|
||||
}
|
||||
|
||||
int getEfbWidth() const {
|
||||
return JUTVideo::getManager()->getFbWidth();
|
||||
}
|
||||
|
||||
JUTFader* getFader() const {
|
||||
return mFader;
|
||||
}
|
||||
void setFader(JUTFader* fader) {
|
||||
mFader = fader;
|
||||
}
|
||||
|
||||
bool startFadeOut(int duration) {
|
||||
if (mFader != nullptr) {
|
||||
return mFader->startFadeOut(duration);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool startFadeIn(int duration) {
|
||||
if (mFader != nullptr) {
|
||||
return mFader->startFadeIn(duration);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void setTickRate(u32 rate) {
|
||||
mTickRate = rate;
|
||||
mFrameRate = 0;
|
||||
}
|
||||
JUtility::TColor getClearColor() const {
|
||||
return mClearColor;
|
||||
}
|
||||
|
||||
void setClearColor(u8 r, u8 g, u8 b, u8 a) {
|
||||
mClearColor.set(r, g, b, a);
|
||||
}
|
||||
|
||||
void setClearColor(JUtility::TColor color) {
|
||||
mClearColor = color;
|
||||
}
|
||||
|
||||
void setFBAlpha(bool enable) {
|
||||
mEnableAlpha = enable;
|
||||
}
|
||||
|
||||
bool getFBAlpha() {
|
||||
return mEnableAlpha;
|
||||
}
|
||||
|
||||
static JFWDisplay* sManager; // 0x80415718
|
||||
|
||||
private:
|
||||
JUTFader* mFader; // 04
|
||||
const GXRenderModeObj* mRMode; // 08
|
||||
JUtility::TColor mClearColor; // 0c
|
||||
u32 mZClear; // 10
|
||||
JUTXfb* mXfb; // 14
|
||||
u16 mGamma; // 18
|
||||
EDrawDone mDrawDoneMethod; // 1c
|
||||
u16 mFrameRate; // 20
|
||||
u32 mTickRate; // 24
|
||||
bool mEnableAlpha; // 28
|
||||
u16 mClamp; // 2a
|
||||
f32 mCombinationRatio; // 2c
|
||||
u32 mStartTick; // 30, tick of when the frame starts rendering
|
||||
u32 mFrameTime; // 34, time it took to render a frame/amount of ticks beginRender took
|
||||
u32 mVideoFrameTime; // 38, time between mStartTick and the last Video Tick
|
||||
s16 mDrawingXfbNo; // 3c
|
||||
bool mIsSingleXfb; // 3e
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,67 @@
|
||||
#ifndef _JSYSTEM_JFW_JFWSYSTEM_H
|
||||
#define _JSYSTEM_JFW_JFWSYSTEM_H
|
||||
|
||||
#include <dolphin/gx.h>
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JKernel/JKRThread.h"
|
||||
#include "JSystem/JUtility/JUTAssertion.h"
|
||||
#include "JSystem/JUtility/JUTConsole.h"
|
||||
#include "JSystem/JUtility/JUTDbPrint.h"
|
||||
#include "JSystem/JUtility/JUTFont.h"
|
||||
#include "types.h"
|
||||
|
||||
// Maybe these are namespaces?
|
||||
struct JFWSystem {
|
||||
struct CSetUpParam {
|
||||
static int maxStdHeaps;
|
||||
static u32 sysHeapSize;
|
||||
static u32 fifoBufSize;
|
||||
static u32 aramAudioBufSize;
|
||||
static u32 aramGraphBufSize;
|
||||
static s32 streamPriority;
|
||||
static s32 decompPriority;
|
||||
static s32 aPiecePriority;
|
||||
static const ResFONT* systemFontRes;
|
||||
static const _GXRenderModeObj* renderMode;
|
||||
static u32 exConsoleBufferSize;
|
||||
};
|
||||
|
||||
static void firstInit();
|
||||
static void init();
|
||||
|
||||
static JKRHeap* rootHeap;
|
||||
static JKRHeap* systemHeap;
|
||||
static JKRThread* mainThread;
|
||||
static JUTDbPrint* debugPrint;
|
||||
static JUTFont* systemFont;
|
||||
static JUTConsoleManager* systemConsoleManager;
|
||||
static JUTConsole* systemConsole;
|
||||
static bool sInitCalled;
|
||||
|
||||
static void setMaxStdHeap(int stdHeaps) {
|
||||
JUT_ASSERT(sInitCalled == 0);
|
||||
CSetUpParam::maxStdHeaps = stdHeaps;
|
||||
}
|
||||
static void setSysHeapSize(u32 heapSize) {
|
||||
JUT_ASSERT(sInitCalled == 0);
|
||||
CSetUpParam::sysHeapSize = heapSize;
|
||||
}
|
||||
static void setFifoBufSize(u32 bufSize) {
|
||||
JUT_ASSERT(sInitCalled == 0);
|
||||
CSetUpParam::fifoBufSize = bufSize;
|
||||
}
|
||||
static void setAramAudioBufSize(u32 bufSize) {
|
||||
JUT_ASSERT(sInitCalled == 0);
|
||||
CSetUpParam::aramAudioBufSize = bufSize;
|
||||
}
|
||||
static void setAramGraphBufSize(u32 bufSize) {
|
||||
JUT_ASSERT(sInitCalled == 0);
|
||||
CSetUpParam::aramGraphBufSize = bufSize;
|
||||
}
|
||||
static void setRenderMode(const _GXRenderModeObj* rmode) {
|
||||
JUT_ASSERT(sInitCalled == 0);
|
||||
CSetUpParam::renderMode = rmode;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -7,30 +7,31 @@
|
||||
extern "C" {
|
||||
|
||||
class JGadget_outMessage {
|
||||
public:
|
||||
typedef void (*MessageFunc)(const char*, int, const char*);
|
||||
public:
|
||||
typedef void (*MessageFunc)(const char*, int, const char*);
|
||||
|
||||
static void warning(const char*, int, const char*);
|
||||
static void warning(const char*, int, const char*);
|
||||
|
||||
JGadget_outMessage(MessageFunc fn, const char* file, int line);
|
||||
~JGadget_outMessage();
|
||||
JGadget_outMessage(MessageFunc fn, const char* file, int line);
|
||||
~JGadget_outMessage();
|
||||
|
||||
JGadget_outMessage& operator<<(const char* str);
|
||||
JGadget_outMessage& operator<<(const char* str);
|
||||
|
||||
private:
|
||||
MessageFunc mMsgFunc;
|
||||
char mBuffer[256];
|
||||
char* mWrite_p;
|
||||
char* mFile;
|
||||
int mLine;
|
||||
private:
|
||||
MessageFunc mMsgFunc;
|
||||
char mBuffer[256];
|
||||
char* mWrite_p;
|
||||
char* mFile;
|
||||
int mLine;
|
||||
};
|
||||
|
||||
#define JGADGET_ASSERTWARN(cond) \
|
||||
((cond) || (false))
|
||||
|
||||
#define JGADGET_EXITWARN(cond) \
|
||||
if (!(cond)) { false; return false; }
|
||||
#define JGADGET_ASSERTWARN(cond) ((cond) || (false))
|
||||
|
||||
#define JGADGET_EXITWARN(cond) \
|
||||
if (!(cond)) { \
|
||||
false; \
|
||||
return false; \
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
s32 size() const { return this->size_; }
|
||||
u32 size() const { return this->size_; }
|
||||
bool empty() const { return this->size() == 0; }
|
||||
void clear() { this->erase(this->begin(), this->end()); }
|
||||
iterator erase(iterator itStart, iterator itEnd);
|
||||
@@ -179,7 +179,7 @@ private:
|
||||
|
||||
bool Iterator_isEnd_(const_iterator it) const { return it.p_ == &this->oNode_; }
|
||||
|
||||
s32 size_;
|
||||
u32 size_;
|
||||
TLinkListNode oNode_;
|
||||
};
|
||||
|
||||
@@ -210,7 +210,6 @@ public:
|
||||
T* operator->() const { return TLinkList::Element_toValue(mIt.operator->()); }
|
||||
T& operator*() const {
|
||||
T* p = this->operator->();
|
||||
#line 541
|
||||
JUT_ASSERT(p!=0);
|
||||
return *p;
|
||||
}
|
||||
@@ -239,7 +238,6 @@ public:
|
||||
const T* operator->() const { return TLinkList::Element_toValue(mIt.operator->()); }
|
||||
const T& operator*() const {
|
||||
const T* p = this->operator->();
|
||||
#line 586
|
||||
JUT_ASSERT(p!=0);
|
||||
return *p;
|
||||
}
|
||||
@@ -262,37 +260,31 @@ public:
|
||||
void Push_back(T* p) { Insert(end(), p); }
|
||||
|
||||
T& front() {
|
||||
#line 642
|
||||
JUT_ASSERT(!empty());
|
||||
return *begin();
|
||||
}
|
||||
|
||||
T& back() {
|
||||
#line 652
|
||||
JUT_ASSERT(!empty());
|
||||
return *--end();
|
||||
}
|
||||
|
||||
static TLinkListNode* Element_toNode(T* p) {
|
||||
#line 753
|
||||
JUT_ASSERT(p!=0);
|
||||
return (TLinkListNode*)((char*)p - O);
|
||||
}
|
||||
|
||||
static const TLinkListNode* Element_toNode(const T* p) {
|
||||
#line 758
|
||||
JUT_ASSERT(p!=0);
|
||||
return (const TLinkListNode*)((const char*)p - O);
|
||||
}
|
||||
|
||||
static T* Element_toValue(TLinkListNode* p) {
|
||||
#line 763
|
||||
JUT_ASSERT(p!=0);
|
||||
return (T*)((char*)p + O);
|
||||
}
|
||||
|
||||
static const T* Element_toValue(const TLinkListNode* p) {
|
||||
#line 768
|
||||
JUT_ASSERT(p!=0);
|
||||
return (const T*)((const char*)p + O);
|
||||
}
|
||||
|
||||
+220
-225
@@ -1,235 +1,227 @@
|
||||
#ifndef _JSYSTEM_JGEOMETRY_H
|
||||
#define _JSYSTEM_JGEOMETRY_H
|
||||
|
||||
#include <dolphin/mtx.h>
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
inline f32 fsqrt_step(f32 mag)
|
||||
{
|
||||
f32 root = __frsqrte(mag);
|
||||
return 0.5f * root * (3.0f - mag * (root * root));
|
||||
inline f32 fsqrt_step(f32 mag) {
|
||||
f32 root = __frsqrte(mag);
|
||||
return 0.5f * root * (3.0f - mag * (root * root));
|
||||
}
|
||||
|
||||
namespace JGeometry {
|
||||
template <typename T>
|
||||
struct TVec2 {
|
||||
TVec2() { }
|
||||
TVec2(T v) { set(v); }
|
||||
TVec2(T x, T y) { set(x, y); }
|
||||
template <typename T> struct TVec2 {
|
||||
TVec2() {
|
||||
}
|
||||
TVec2(T v) {
|
||||
set(v);
|
||||
}
|
||||
TVec2(T x, T y) {
|
||||
set(x, y);
|
||||
}
|
||||
|
||||
void set(T v) { y = x = v; }
|
||||
void set(T v) {
|
||||
y = x = v;
|
||||
}
|
||||
|
||||
void set(T x, T y)
|
||||
{
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
}
|
||||
void set(T x, T y) {
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
}
|
||||
|
||||
void set(const TVec2& other)
|
||||
{
|
||||
x = other.x;
|
||||
y = other.y;
|
||||
}
|
||||
void set(const TVec2& other) {
|
||||
x = other.x;
|
||||
y = other.y;
|
||||
}
|
||||
|
||||
void setMin(const TVec2<f32>& min)
|
||||
{
|
||||
if (x >= min.x)
|
||||
x = min.x;
|
||||
if (y >= min.y)
|
||||
y = min.y;
|
||||
}
|
||||
void setMin(const TVec2<f32>& min) {
|
||||
if (x >= min.x)
|
||||
x = min.x;
|
||||
if (y >= min.y)
|
||||
y = min.y;
|
||||
}
|
||||
|
||||
void setMax(const TVec2<f32>& max)
|
||||
{
|
||||
if (x <= max.x)
|
||||
x = max.x;
|
||||
if (y <= max.y)
|
||||
y = max.y;
|
||||
}
|
||||
void setMax(const TVec2<f32>& max) {
|
||||
if (x <= max.x)
|
||||
x = max.x;
|
||||
if (y <= max.y)
|
||||
y = max.y;
|
||||
}
|
||||
|
||||
void add(const TVec2<T>& other)
|
||||
{
|
||||
x += other.x;
|
||||
y += other.y;
|
||||
}
|
||||
void add(const TVec2<T>& other) {
|
||||
x += other.x;
|
||||
y += other.y;
|
||||
}
|
||||
|
||||
/** @fabricated */
|
||||
// TVec2<T> adding(const TVec2<T>& other) { return TVec2<T>(x + other.x, y + other.y); }
|
||||
/** @fabricated */
|
||||
// TVec2<T> adding(const TVec2<T>& other) { return TVec2<T>(x + other.x, y + other.y); }
|
||||
|
||||
/** @fabricated */
|
||||
TVec2<T> adding(T xDelta, T yDelta) { return TVec2<T>(x + xDelta, y + yDelta); }
|
||||
/** @fabricated */
|
||||
TVec2<T> adding(T xDelta, T yDelta) {
|
||||
return TVec2<T>(x + xDelta, y + yDelta);
|
||||
}
|
||||
|
||||
/** @fabricated */
|
||||
void add(T xDelta, T yDelta)
|
||||
{
|
||||
x += xDelta;
|
||||
y += yDelta;
|
||||
}
|
||||
/** @fabricated */
|
||||
void add(T xDelta, T yDelta) {
|
||||
x += xDelta;
|
||||
y += yDelta;
|
||||
}
|
||||
|
||||
TVec2<T>& operator+=(const TVec2<T>& other)
|
||||
{
|
||||
x += other.x;
|
||||
y += other.y;
|
||||
return *this;
|
||||
}
|
||||
TVec2<T>& operator+=(const TVec2<T>& other) {
|
||||
x += other.x;
|
||||
y += other.y;
|
||||
return *this;
|
||||
}
|
||||
|
||||
TVec2<T>& operator*=(const TVec2<T>& other)
|
||||
{
|
||||
x *= other.x;
|
||||
y *= other.y;
|
||||
return *this;
|
||||
}
|
||||
TVec2<T>& operator*=(const TVec2<T>& other) {
|
||||
x *= other.x;
|
||||
y *= other.y;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool isAbove(const TVec2<T>& other) const { return (x >= other.x) && (y >= other.y) ? true : false; }
|
||||
bool isAbove(const TVec2<T>& other) const {
|
||||
return (x >= other.x) && (y >= other.y) ? true : false;
|
||||
}
|
||||
|
||||
T x;
|
||||
T y;
|
||||
T x;
|
||||
T y;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct TVec3 {
|
||||
// inline TVec3() { }
|
||||
// inline TVec3(T value)
|
||||
// : x(value)
|
||||
// , y(value)
|
||||
// , z(value)
|
||||
// {
|
||||
// }
|
||||
// inline TVec3(T inX, T inY, T inZ)
|
||||
// : x(inX)
|
||||
// , y(inY)
|
||||
// , z(inZ) {};
|
||||
template <typename T> struct TVec3 {
|
||||
// inline TVec3() { }
|
||||
// inline TVec3(T value)
|
||||
// : x(value)
|
||||
// , y(value)
|
||||
// , z(value)
|
||||
// {
|
||||
// }
|
||||
// inline TVec3(T inX, T inY, T inZ)
|
||||
// : x(inX)
|
||||
// , y(inY)
|
||||
// , z(inZ) {};
|
||||
|
||||
// // TODO: Determine if this could've actually existed, or if I'm just making it up.
|
||||
// inline TVec3(const TVec3<T>& other)
|
||||
// {
|
||||
// x = other.x;
|
||||
// y = other.y;
|
||||
// z = other.z;
|
||||
// }
|
||||
// // TODO: Determine if this could've actually existed, or if I'm just making it up.
|
||||
// inline TVec3(const TVec3<T>& other)
|
||||
// {
|
||||
// x = other.x;
|
||||
// y = other.y;
|
||||
// z = other.z;
|
||||
// }
|
||||
|
||||
// TODO: Determine if this could've actually existed, or if I'm just making
|
||||
// it up.
|
||||
inline TVec3& operator=(const TVec3& other)
|
||||
{
|
||||
x = other.x;
|
||||
y = other.y;
|
||||
z = other.z;
|
||||
return *this;
|
||||
}
|
||||
// TODO: Determine if this could've actually existed, or if I'm just making
|
||||
// it up.
|
||||
inline TVec3& operator=(const TVec3& other) {
|
||||
x = other.x;
|
||||
y = other.y;
|
||||
z = other.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void set(T x, T y, T z)
|
||||
{
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
this->z = z;
|
||||
}
|
||||
void set(T x, T y, T z) {
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
this->z = z;
|
||||
}
|
||||
|
||||
void set(const TVec3& other)
|
||||
{
|
||||
x = other.x;
|
||||
y = other.y;
|
||||
z = other.z;
|
||||
}
|
||||
void set(const TVec3& other) {
|
||||
x = other.x;
|
||||
y = other.y;
|
||||
z = other.z;
|
||||
}
|
||||
|
||||
void setMin(const TVec3<f32>& min)
|
||||
{
|
||||
if (x >= min.x)
|
||||
x = min.x;
|
||||
if (y >= min.y)
|
||||
y = min.y;
|
||||
if (z >= min.z)
|
||||
z = min.z;
|
||||
}
|
||||
void setMin(const TVec3<f32>& min) {
|
||||
if (x >= min.x)
|
||||
x = min.x;
|
||||
if (y >= min.y)
|
||||
y = min.y;
|
||||
if (z >= min.z)
|
||||
z = min.z;
|
||||
}
|
||||
|
||||
void setMax(const TVec3<f32>& max)
|
||||
{
|
||||
if (x <= max.x)
|
||||
x = max.x;
|
||||
if (y <= max.y)
|
||||
y = max.y;
|
||||
if (z >= max.z)
|
||||
z = max.z;
|
||||
}
|
||||
void setMax(const TVec3<f32>& max) {
|
||||
if (x <= max.x)
|
||||
x = max.x;
|
||||
if (y <= max.y)
|
||||
y = max.y;
|
||||
if (z >= max.z)
|
||||
z = max.z;
|
||||
}
|
||||
|
||||
// inline operator Vec() const { return *this; }
|
||||
inline operator Vec() const
|
||||
{
|
||||
Vec other;
|
||||
other.x = x;
|
||||
other.y = y;
|
||||
other.z = z;
|
||||
return other;
|
||||
}
|
||||
// inline operator Vec() const { return *this; }
|
||||
inline operator Vec() const {
|
||||
Vec other;
|
||||
other.x = x;
|
||||
other.y = y;
|
||||
other.z = z;
|
||||
return other;
|
||||
}
|
||||
|
||||
// inline TVec3(Vec& vec)
|
||||
// {
|
||||
// x = vec.x;
|
||||
// y = vec.y;
|
||||
// z = vec.z;
|
||||
// }
|
||||
// inline TVec3(Vec& vec)
|
||||
// {
|
||||
// x = vec.x;
|
||||
// y = vec.y;
|
||||
// z = vec.z;
|
||||
// }
|
||||
|
||||
void zero() { x = y = z = 0.0f; }
|
||||
void zero() {
|
||||
x = y = z = 0.0f;
|
||||
}
|
||||
|
||||
f32 squared() const { return x * x + y * y + z * z; }
|
||||
f32 squared() const {
|
||||
return x * x + y * y + z * z;
|
||||
}
|
||||
|
||||
void normalize()
|
||||
{
|
||||
f32 sq = squared();
|
||||
if (sq <= FLT_EPSILON * 32.0f) {
|
||||
return;
|
||||
}
|
||||
f32 norm;
|
||||
if (sq <= 0.0f) {
|
||||
norm = sq;
|
||||
} else {
|
||||
norm = fsqrt_step(sq);
|
||||
}
|
||||
x *= norm;
|
||||
y *= norm;
|
||||
z *= norm;
|
||||
}
|
||||
void normalize() {
|
||||
f32 sq = squared();
|
||||
if (sq <= FLT_EPSILON * 32.0f) {
|
||||
return;
|
||||
}
|
||||
f32 norm;
|
||||
if (sq <= 0.0f) {
|
||||
norm = sq;
|
||||
} else {
|
||||
norm = fsqrt_step(sq);
|
||||
}
|
||||
x *= norm;
|
||||
y *= norm;
|
||||
z *= norm;
|
||||
}
|
||||
|
||||
void normalize(const TVec3<f32>& other)
|
||||
{
|
||||
f32 sq = other.squared();
|
||||
if (sq <= FLT_EPSILON * 32.0f) {
|
||||
zero();
|
||||
return;
|
||||
}
|
||||
f32 norm;
|
||||
if (sq <= 0.0f) {
|
||||
norm = sq;
|
||||
} else {
|
||||
norm = fsqrt_step(sq);
|
||||
}
|
||||
x = other.x * norm;
|
||||
y = other.y * norm;
|
||||
z = other.z * norm;
|
||||
}
|
||||
void normalize(const TVec3<f32>& other) {
|
||||
f32 sq = other.squared();
|
||||
if (sq <= FLT_EPSILON * 32.0f) {
|
||||
zero();
|
||||
return;
|
||||
}
|
||||
f32 norm;
|
||||
if (sq <= 0.0f) {
|
||||
norm = sq;
|
||||
} else {
|
||||
norm = fsqrt_step(sq);
|
||||
}
|
||||
x = other.x * norm;
|
||||
y = other.y * norm;
|
||||
z = other.z * norm;
|
||||
}
|
||||
|
||||
bool isAbove(const TVec3<T>& other) const { return (x >= other.x) && (y >= other.y) && (z >= other.z); }
|
||||
bool isAbove(const TVec3<T>& other) const {
|
||||
return (x >= other.x) && (y >= other.y) && (z >= other.z);
|
||||
}
|
||||
|
||||
T x;
|
||||
T y;
|
||||
T z;
|
||||
T x;
|
||||
T y;
|
||||
T z;
|
||||
};
|
||||
|
||||
// Size: 0x10
|
||||
template <class T>
|
||||
struct TBox {
|
||||
TBox()
|
||||
: i()
|
||||
, f()
|
||||
{
|
||||
}
|
||||
TBox(const TBox& other)
|
||||
: i(other.f)
|
||||
, f(other.y)
|
||||
{
|
||||
}
|
||||
template <class T> struct TBox {
|
||||
TBox() : i(), f() {
|
||||
}
|
||||
TBox(const TBox& other) : i(other.f), f(other.y) {
|
||||
}
|
||||
|
||||
T i, f;
|
||||
T i, f;
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
@@ -314,44 +306,47 @@ struct TBox2 : TBox<TVec2<T> > {
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
template <typename T>
|
||||
struct TBox3 {
|
||||
// TBox3() {}
|
||||
// TBox2(const TBox2& other) { set(other); }
|
||||
// TBox3(const TVec3<T>& i, const TVec3<T> f) { set(i, f); }
|
||||
// // TBox2(const TVec2<T>& i, T x1, T y1) { set(i, x1, y1); }
|
||||
// // TBox2(T x0, T y0, const TVec2<T>& f) { set(x0, y0, f); }
|
||||
// TBox3(T x0, T y0, T z0, T x1, T y1, T z1) { set(x0, y0, z0, x1, y1, z1); }
|
||||
// TBox3(T x0, T y0, TVec3<T>& f) { set(x0, y0, z0, x0 + f.x, y0 + f.y, z0 + f.z); }
|
||||
// TBox3(T val)
|
||||
// {
|
||||
// f.x = f.y = f.z = val;
|
||||
// i.x = i.y = i.z = val;
|
||||
// }
|
||||
template <typename T> struct TBox3 {
|
||||
// TBox3() {}
|
||||
// TBox2(const TBox2& other) { set(other); }
|
||||
// TBox3(const TVec3<T>& i, const TVec3<T> f) { set(i, f); }
|
||||
// // TBox2(const TVec2<T>& i, T x1, T y1) { set(i, x1, y1); }
|
||||
// // TBox2(T x0, T y0, const TVec2<T>& f) { set(x0, y0, f); }
|
||||
// TBox3(T x0, T y0, T z0, T x1, T y1, T z1) { set(x0, y0, z0, x1, y1, z1); }
|
||||
// TBox3(T x0, T y0, TVec3<T>& f) { set(x0, y0, z0, x0 + f.x, y0 + f.y, z0 + f.z); }
|
||||
// TBox3(T val)
|
||||
// {
|
||||
// f.x = f.y = f.z = val;
|
||||
// i.x = i.y = i.z = val;
|
||||
// }
|
||||
|
||||
inline bool isValid() { return mMax.isAbove(mMin); }
|
||||
inline bool isValid() {
|
||||
return mMax.isAbove(mMin);
|
||||
}
|
||||
|
||||
void absolute()
|
||||
{
|
||||
if (!this->isValid()) {
|
||||
TBox3<T> box(*this);
|
||||
this->mMin.setMin(box.mMin);
|
||||
this->mMin.setMin(box.mMax);
|
||||
this->mMax.setMax(box.mMin);
|
||||
this->mMax.setMax(box.mMax);
|
||||
}
|
||||
}
|
||||
void absolute() {
|
||||
if (!this->isValid()) {
|
||||
TBox3<T> box(*this);
|
||||
this->mMin.setMin(box.mMin);
|
||||
this->mMin.setMin(box.mMax);
|
||||
this->mMax.setMax(box.mMin);
|
||||
this->mMax.setMax(box.mMax);
|
||||
}
|
||||
}
|
||||
|
||||
void set(const TBox3& other) { set(other.mMin, other.mMax); }
|
||||
void set(const TVec3<T>& i, const TVec3<T>& f) { this->mMin.set(i), this->mMax.set(f); }
|
||||
void set(T x0, T y0, T z0, T x1, T y1, T z1)
|
||||
{
|
||||
this->mMin.set(x0, y0);
|
||||
this->mMax.set(x1, y1);
|
||||
}
|
||||
void set(const TBox3& other) {
|
||||
set(other.mMin, other.mMax);
|
||||
}
|
||||
void set(const TVec3<T>& i, const TVec3<T>& f) {
|
||||
this->mMin.set(i), this->mMax.set(f);
|
||||
}
|
||||
void set(T x0, T y0, T z0, T x1, T y1, T z1) {
|
||||
this->mMin.set(x0, y0);
|
||||
this->mMax.set(x1, y1);
|
||||
}
|
||||
|
||||
TVec3<T> mMin; // _00
|
||||
TVec3<T> mMax; // _0C
|
||||
TVec3<T> mMin; // _00
|
||||
TVec3<T> mMax; // _0C
|
||||
};
|
||||
|
||||
typedef TVec2<f32> TVec2f;
|
||||
@@ -362,4 +357,4 @@ typedef TBox3<f32> TBox3f;
|
||||
} // namespace JGeometry
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+217
-218
@@ -25,291 +25,290 @@ class JKRAramHeap;
|
||||
class JKRDecompCommand;
|
||||
class JKRAMCommand;
|
||||
|
||||
class JKRAramBlock
|
||||
{
|
||||
public:
|
||||
JKRAramBlock(u32 address, u32 size, u32 freeSize, u8 groupID, bool tempMemory);
|
||||
class JKRAramBlock {
|
||||
public:
|
||||
JKRAramBlock(u32 address, u32 size, u32 freeSize, u8 groupID, bool tempMemory);
|
||||
|
||||
virtual ~JKRAramBlock();
|
||||
virtual ~JKRAramBlock();
|
||||
|
||||
JKRAramBlock* allocHead(u32 size, u8 groupID, JKRAramHeap* heap);
|
||||
JKRAramBlock* allocTail(u32 size, u8 groupID, JKRAramHeap* heap);
|
||||
JKRAramBlock* allocHead(u32 size, u8 groupID, JKRAramHeap* heap);
|
||||
JKRAramBlock* allocTail(u32 size, u8 groupID, JKRAramHeap* heap);
|
||||
|
||||
u32 getAddress() const { return this->mAddress; }
|
||||
u32 getSize() const { return this->mSize; }
|
||||
u32 getFreeSize() const { return this->mFreeSize; }
|
||||
bool isTempMemory() const { return this->mIsTempMemory; }
|
||||
void newGroupID(u8 groupID) { this->mGroupID = groupID; }
|
||||
u32 getAddress() const {
|
||||
return this->mAddress;
|
||||
}
|
||||
u32 getSize() const {
|
||||
return this->mSize;
|
||||
}
|
||||
u32 getFreeSize() const {
|
||||
return this->mFreeSize;
|
||||
}
|
||||
bool isTempMemory() const {
|
||||
return this->mIsTempMemory;
|
||||
}
|
||||
void newGroupID(u8 groupID) {
|
||||
this->mGroupID = groupID;
|
||||
}
|
||||
|
||||
JSULink<JKRAramBlock> mLink;
|
||||
u32 mAddress;
|
||||
u32 mSize;
|
||||
u32 mFreeSize;
|
||||
u8 mGroupID;
|
||||
bool mIsTempMemory;
|
||||
JSULink<JKRAramBlock> mLink;
|
||||
u32 mAddress;
|
||||
u32 mSize;
|
||||
u32 mFreeSize;
|
||||
u8 mGroupID;
|
||||
bool mIsTempMemory;
|
||||
|
||||
friend class JKRAramHeap;
|
||||
friend class JKRAramHeap;
|
||||
};
|
||||
|
||||
class JKRAramHeap : public JKRDisposer
|
||||
{
|
||||
public:
|
||||
enum EAllocMode
|
||||
{
|
||||
Head = 0,
|
||||
Tail = 1
|
||||
};
|
||||
class JKRAramHeap : public JKRDisposer {
|
||||
public:
|
||||
enum EAllocMode { Head = 0, Tail = 1 };
|
||||
|
||||
JKRAramHeap(u32 baseAddress, u32 size);
|
||||
JKRAramHeap(u32 baseAddress, u32 size);
|
||||
|
||||
virtual ~JKRAramHeap();
|
||||
virtual ~JKRAramHeap();
|
||||
|
||||
JKRAramBlock* alloc(u32 size, EAllocMode mode);
|
||||
void free(JKRAramBlock* block);
|
||||
JKRAramBlock* allocFromHead(u32 size);
|
||||
JKRAramBlock* allocFromTail(u32 size);
|
||||
u32 getFreeSize();
|
||||
u32 getTotalFreeSize();
|
||||
u32 getUsedSize(u8 groupID);
|
||||
void dump();
|
||||
JKRAramBlock* alloc(u32 size, EAllocMode mode);
|
||||
void free(JKRAramBlock* block);
|
||||
JKRAramBlock* allocFromHead(u32 size);
|
||||
JKRAramBlock* allocFromTail(u32 size);
|
||||
u32 getFreeSize();
|
||||
u32 getTotalFreeSize();
|
||||
u32 getUsedSize(u8 groupID);
|
||||
void dump();
|
||||
|
||||
u8 getCurrentGroupID() const { return this->mGroupID; }
|
||||
JKRHeap* getMgrHeap() const { return this->mHeap; }
|
||||
u8 getCurrentGroupID() const {
|
||||
return this->mGroupID;
|
||||
}
|
||||
JKRHeap* getMgrHeap() const {
|
||||
return this->mHeap;
|
||||
}
|
||||
|
||||
void lock() { OSLockMutex(&this->mMutex); }
|
||||
void unlock() { OSUnlockMutex(&this->mMutex); }
|
||||
void lock() {
|
||||
OSLockMutex(&this->mMutex);
|
||||
}
|
||||
void unlock() {
|
||||
OSUnlockMutex(&this->mMutex);
|
||||
}
|
||||
|
||||
static JSUList<JKRAramBlock> sAramList;
|
||||
static JSUList<JKRAramBlock> sAramList;
|
||||
|
||||
OSMutex mMutex;
|
||||
JKRHeap* mHeap;
|
||||
u32 mHeadAddress;
|
||||
u32 mTailAddress;
|
||||
u32 mSize;
|
||||
u8 mGroupID;
|
||||
OSMutex mMutex;
|
||||
JKRHeap* mHeap;
|
||||
u32 mHeadAddress;
|
||||
u32 mTailAddress;
|
||||
u32 mSize;
|
||||
u8 mGroupID;
|
||||
|
||||
friend class JKRAramBlock;
|
||||
friend class JKRAramBlock;
|
||||
};
|
||||
|
||||
class JKRAram : public JKRThread
|
||||
{
|
||||
public:
|
||||
JKRAram(u32, u32, long);
|
||||
class JKRAram : public JKRThread {
|
||||
public:
|
||||
JKRAram(u32, u32, long);
|
||||
|
||||
virtual ~JKRAram(); // _08
|
||||
virtual void* run(); // _0C
|
||||
virtual ~JKRAram(); // _08
|
||||
virtual void* run(); // _0C
|
||||
|
||||
static bool checkOkAddress(u8* addr, u32 size, JKRAramBlock* block, u32 param_4);
|
||||
static void changeGroupIdIfNeed(u8* data, int groupId);
|
||||
static bool checkOkAddress(u8* addr, u32 size, JKRAramBlock* block, u32 param_4);
|
||||
static void changeGroupIdIfNeed(u8* data, int groupId);
|
||||
|
||||
static JKRAram* create(u32, u32, long, long, long);
|
||||
static JKRAramBlock* mainRamToAram(u8*, u32, u32, JKRExpandSwitch, u32, JKRHeap*, int);
|
||||
static JKRAramBlock* mainRamToAram(u8*, JKRAramBlock* block, u32, JKRExpandSwitch, u32, JKRHeap*, int);
|
||||
static u8* aramToMainRam(u32, u8*, u32, JKRExpandSwitch, u32, JKRHeap*, int, u32*);
|
||||
static u8* aramToMainRam(JKRAramBlock*, u8*, u32, u32, JKRExpandSwitch, u32, JKRHeap*, int, u32*);
|
||||
static JKRAram* create(u32, u32, long, long, long);
|
||||
static JKRAramBlock* mainRamToAram(u8*, u32, u32, JKRExpandSwitch, u32, JKRHeap*, int);
|
||||
static JKRAramBlock* mainRamToAram(u8*, JKRAramBlock* block, u32, JKRExpandSwitch, u32, JKRHeap*, int);
|
||||
static u8* aramToMainRam(u32, u8*, u32, JKRExpandSwitch, u32, JKRHeap*, int, u32*);
|
||||
static u8* aramToMainRam(JKRAramBlock*, u8*, u32, u32, JKRExpandSwitch, u32, JKRHeap*, int, u32*);
|
||||
|
||||
void aramSync(JKRAMCommand*, int);
|
||||
void aramSync(JKRAMCommand*, int);
|
||||
|
||||
u32 getAudioMemory() const
|
||||
{
|
||||
return mAudioMemoryPtr;
|
||||
}
|
||||
u32 getAudioMemory() const {
|
||||
return mAudioMemoryPtr;
|
||||
}
|
||||
|
||||
u32 getAudioMemSize() const
|
||||
{
|
||||
return mAudioMemorySize;
|
||||
}
|
||||
u32 getAudioMemSize() const {
|
||||
return mAudioMemorySize;
|
||||
}
|
||||
|
||||
static u32 getSZSBufferSize()
|
||||
{
|
||||
return sSZSBufferSize;
|
||||
}
|
||||
static u32 getSZSBufferSize() {
|
||||
return sSZSBufferSize;
|
||||
}
|
||||
|
||||
static JKRAramHeap* getAramHeap()
|
||||
{
|
||||
return sAramObject->mAramHeap;
|
||||
}
|
||||
static JKRAramHeap* getAramHeap() {
|
||||
return sAramObject->mAramHeap;
|
||||
}
|
||||
|
||||
static JKRAram* getManager()
|
||||
{
|
||||
return sAramObject;
|
||||
}
|
||||
static JKRAram* getManager() {
|
||||
return sAramObject;
|
||||
}
|
||||
|
||||
static u8 decideAramGroupId(int id)
|
||||
{
|
||||
if (id < 0)
|
||||
return getAramHeap()->getCurrentGroupID();
|
||||
else
|
||||
return id;
|
||||
}
|
||||
static u8 decideAramGroupId(int id) {
|
||||
if (id < 0)
|
||||
return getAramHeap()->getCurrentGroupID();
|
||||
else
|
||||
return id;
|
||||
}
|
||||
|
||||
static u32 sSZSBufferSize;
|
||||
static u32 sSZSBufferSize;
|
||||
|
||||
static JKRAram* sAramObject;
|
||||
static OSMessage sMessageBuffer[4];
|
||||
static OSMessageQueue sMessageQueue;
|
||||
static JSUList<JKRAMCommand> sAramCommandList;
|
||||
static JKRAram* sAramObject;
|
||||
static OSMessage sMessageBuffer[4];
|
||||
static OSMessageQueue sMessageQueue;
|
||||
static JSUList<JKRAMCommand> sAramCommandList;
|
||||
|
||||
u32 mAudioMemoryPtr; // _7C
|
||||
u32 mAudioMemorySize; // _80
|
||||
u32 mGraphMemoryPtr; // _84
|
||||
u32 mGraphMemorySize; // _88
|
||||
u32 mUserMemoryPtr; // _8C
|
||||
u32 mUserMemorySize; // _90
|
||||
JKRAramHeap* mAramHeap; // _94
|
||||
u32 mStackArray[3]; // _98
|
||||
u32 mAudioMemoryPtr; // _7C
|
||||
u32 mAudioMemorySize; // _80
|
||||
u32 mGraphMemoryPtr; // _84
|
||||
u32 mGraphMemorySize; // _88
|
||||
u32 mUserMemoryPtr; // _8C
|
||||
u32 mUserMemorySize; // _90
|
||||
JKRAramHeap* mAramHeap; // _94
|
||||
u32 mStackArray[3]; // _98
|
||||
};
|
||||
|
||||
class JKRAMCommand : public ARQRequest
|
||||
{
|
||||
public:
|
||||
typedef void (*AMCommandCallback)(u32);
|
||||
class JKRAMCommand : public ARQRequest {
|
||||
public:
|
||||
typedef void (*AMCommandCallback)(u32);
|
||||
|
||||
JKRAMCommand();
|
||||
~JKRAMCommand();
|
||||
JKRAMCommand();
|
||||
~JKRAMCommand();
|
||||
|
||||
JSULink<JKRAMCommand> mAramPieceCommandLink;
|
||||
JSULink<JKRAMCommand> mLink30;
|
||||
s32 mDirection;
|
||||
u32 mLength;
|
||||
u32 mSource;
|
||||
u32 mDestination;
|
||||
JKRAramBlock* mAramBlock;
|
||||
u8 _54[4];
|
||||
AMCommandCallback mCallback;
|
||||
OSMessageQueue* mCompletedMesgQueue;
|
||||
s32 mCallbackType;
|
||||
JKRDecompCommand* mDecompCommand;
|
||||
OSMessageQueue mMesgQueue;
|
||||
OSMessage mMesgBuffer[1];
|
||||
void* _8C;
|
||||
void* _90;
|
||||
void* _94;
|
||||
JSULink<JKRAMCommand> mAramPieceCommandLink;
|
||||
JSULink<JKRAMCommand> mLink30;
|
||||
s32 mDirection;
|
||||
u32 mLength;
|
||||
u32 mSource;
|
||||
u32 mDestination;
|
||||
JKRAramBlock* mAramBlock;
|
||||
u8 _54[4];
|
||||
AMCommandCallback mCallback;
|
||||
OSMessageQueue* mCompletedMesgQueue;
|
||||
s32 mCallbackType;
|
||||
JKRDecompCommand* mDecompCommand;
|
||||
OSMessageQueue mMesgQueue;
|
||||
OSMessage mMesgBuffer[1];
|
||||
void* _8C;
|
||||
void* _90;
|
||||
void* _94;
|
||||
};
|
||||
|
||||
class JKRAramCommand
|
||||
{
|
||||
public:
|
||||
inline void setting(BOOL active, void* arg)
|
||||
{
|
||||
this->mActive = active;
|
||||
this->mArg = arg;
|
||||
}
|
||||
class JKRAramCommand {
|
||||
public:
|
||||
inline void setting(BOOL active, void* arg) {
|
||||
this->mActive = active;
|
||||
this->mArg = arg;
|
||||
}
|
||||
|
||||
BOOL mActive;
|
||||
void* mArg;
|
||||
BOOL mActive;
|
||||
void* mArg;
|
||||
};
|
||||
|
||||
class JKRAramPiece
|
||||
{
|
||||
public:
|
||||
static JKRAMCommand* prepareCommand(int direction, u32 source, u32 destination, u32 length, JKRAramBlock* aramBlock, JKRAMCommand::AMCommandCallback callback);
|
||||
static void sendCommand(JKRAMCommand* cmd);
|
||||
static JKRAMCommand* orderAsync(int direction, u32 source, u32 destination, u32 length, JKRAramBlock* aramBlock, JKRAMCommand::AMCommandCallback callback);
|
||||
static bool sync(JKRAMCommand* cmd, BOOL noBlock);
|
||||
static bool orderSync(int direction, u32 source, u32 destination, u32 length, JKRAramBlock* aramBlock);
|
||||
static void startDMA(JKRAMCommand* cmd);
|
||||
static void doneDMA(u32 arg);
|
||||
class JKRAramPiece {
|
||||
public:
|
||||
static JKRAMCommand* prepareCommand(int direction, u32 source, u32 destination, u32 length, JKRAramBlock* aramBlock,
|
||||
JKRAMCommand::AMCommandCallback callback);
|
||||
static void sendCommand(JKRAMCommand* cmd);
|
||||
static JKRAMCommand* orderAsync(int direction, u32 source, u32 destination, u32 length, JKRAramBlock* aramBlock,
|
||||
JKRAMCommand::AMCommandCallback callback);
|
||||
static bool sync(JKRAMCommand* cmd, BOOL noBlock);
|
||||
static bool orderSync(int direction, u32 source, u32 destination, u32 length, JKRAramBlock* aramBlock);
|
||||
static void startDMA(JKRAMCommand* cmd);
|
||||
static void doneDMA(u32 arg);
|
||||
|
||||
static OSMutex mMutex;
|
||||
static JSUList<JKRAMCommand> sAramPieceCommandList;
|
||||
static OSMutex mMutex;
|
||||
static JSUList<JKRAMCommand> sAramPieceCommandList;
|
||||
|
||||
private:
|
||||
static void lock() { OSLockMutex(&mMutex); }
|
||||
static void unlock() { OSUnlockMutex(&mMutex); }
|
||||
private:
|
||||
static void lock() {
|
||||
OSLockMutex(&mMutex);
|
||||
}
|
||||
static void unlock() {
|
||||
OSUnlockMutex(&mMutex);
|
||||
}
|
||||
};
|
||||
|
||||
class JKRAramStreamCommand
|
||||
{
|
||||
public:
|
||||
enum ECommandType
|
||||
{
|
||||
ECT_UNK = 0,
|
||||
ECT_READ = 1,
|
||||
ECT_WRITE = 2,
|
||||
};
|
||||
class JKRAramStreamCommand {
|
||||
public:
|
||||
enum ECommandType {
|
||||
ECT_UNK = 0,
|
||||
ECT_READ = 1,
|
||||
ECT_WRITE = 2,
|
||||
};
|
||||
|
||||
JKRAramStreamCommand();
|
||||
JKRAramStreamCommand();
|
||||
|
||||
ECommandType type; // _00
|
||||
u32 mAddress; // _04
|
||||
u32 mSize; // _08
|
||||
u32 _0C; // _0C
|
||||
JSUFileInputStream* mStream; // _10
|
||||
u32 mOffset; // _14
|
||||
u8* mTransferBuffer; // _18
|
||||
u32 mTransferBufferSize; // _1C
|
||||
JKRHeap* mHeap; // _20
|
||||
bool mAllocatedTransferBuffer; // _24
|
||||
u32 _28; // _28
|
||||
OSMessageQueue mMessageQueue; // _2C
|
||||
void* mMessage; // _4C
|
||||
u32 _50; // _50
|
||||
u32 _54; // _54
|
||||
ECommandType type; // _00
|
||||
u32 mAddress; // _04
|
||||
u32 mSize; // _08
|
||||
u32 _0C; // _0C
|
||||
JSUFileInputStream* mStream; // _10
|
||||
u32 mOffset; // _14
|
||||
u8* mTransferBuffer; // _18
|
||||
u32 mTransferBufferSize; // _1C
|
||||
JKRHeap* mHeap; // _20
|
||||
bool mAllocatedTransferBuffer; // _24
|
||||
u32 _28; // _28
|
||||
OSMessageQueue mMessageQueue; // _2C
|
||||
void* mMessage; // _4C
|
||||
u32 _50; // _50
|
||||
u32 _54; // _54
|
||||
};
|
||||
|
||||
class JKRAramStream : public JKRThread
|
||||
{
|
||||
public:
|
||||
JKRAramStream(long);
|
||||
class JKRAramStream : public JKRThread {
|
||||
public:
|
||||
JKRAramStream(long);
|
||||
|
||||
virtual ~JKRAramStream(); // _08
|
||||
virtual void* run(); // _0C
|
||||
virtual ~JKRAramStream(); // _08
|
||||
virtual void* run(); // _0C
|
||||
|
||||
static JKRAramStream* create(s32);
|
||||
static JKRAramStream* create(s32);
|
||||
|
||||
static u32 readFromAram();
|
||||
static s32 writeToAram(JKRAramStreamCommand*);
|
||||
static JKRAramStreamCommand* write_StreamToAram_Async(JSUFileInputStream*, JKRAramBlock*, u32, u32);
|
||||
static JKRAramStreamCommand* write_StreamToAram_Async(JSUFileInputStream*, u32, u32, u32);
|
||||
static JKRAramStreamCommand* sync(JKRAramStreamCommand*, BOOL);
|
||||
static void setTransBuffer(u8*, u32, JKRHeap*);
|
||||
static u32 readFromAram();
|
||||
static s32 writeToAram(JKRAramStreamCommand*);
|
||||
static JKRAramStreamCommand* write_StreamToAram_Async(JSUFileInputStream*, JKRAramBlock*, u32, u32);
|
||||
static JKRAramStreamCommand* write_StreamToAram_Async(JSUFileInputStream*, u32, u32, u32);
|
||||
static JKRAramStreamCommand* sync(JKRAramStreamCommand*, BOOL);
|
||||
static void setTransBuffer(u8*, u32, JKRHeap*);
|
||||
|
||||
static JKRAramStream* sAramStreamObject;
|
||||
static OSMessage sMessageBuffer[4];
|
||||
static OSMessageQueue sMessageQueue;
|
||||
static JKRAramStream* sAramStreamObject;
|
||||
static OSMessage sMessageBuffer[4];
|
||||
static OSMessageQueue sMessageQueue;
|
||||
|
||||
static u8* transBuffer;
|
||||
static JKRHeap* transHeap;
|
||||
static u32 transSize;
|
||||
static u8* transBuffer;
|
||||
static JKRHeap* transHeap;
|
||||
static u32 transSize;
|
||||
|
||||
// _00 = VTBL
|
||||
// _00-_7C = JKRThread
|
||||
// _00 = VTBL
|
||||
// _00-_7C = JKRThread
|
||||
};
|
||||
|
||||
inline JKRAramBlock* JKRAllocFromAram(u32 size, JKRAramHeap::EAllocMode allocMode)
|
||||
{
|
||||
return JKRAram::getAramHeap()->alloc(size, allocMode);
|
||||
inline JKRAramBlock* JKRAllocFromAram(u32 size, JKRAramHeap::EAllocMode allocMode) {
|
||||
return JKRAram::getAramHeap()->alloc(size, allocMode);
|
||||
}
|
||||
|
||||
inline void JKRFreeToAram(JKRAramBlock* block)
|
||||
{
|
||||
JKRAram::getAramHeap()->free(block);
|
||||
inline void JKRFreeToAram(JKRAramBlock* block) {
|
||||
JKRAram::getAramHeap()->free(block);
|
||||
}
|
||||
|
||||
inline u8* JKRAramToMainRam(u32 address, u8* buf, u32 bufSize, JKRExpandSwitch expandSwitch, u32 p5, JKRHeap* heap, int id, u32* pSize)
|
||||
{
|
||||
return JKRAram::aramToMainRam(address, buf, bufSize, expandSwitch, p5, heap, id, pSize);
|
||||
inline u8* JKRAramToMainRam(u32 address, u8* buf, u32 bufSize, JKRExpandSwitch expandSwitch, u32 p5, JKRHeap* heap,
|
||||
int id, u32* pSize) {
|
||||
return JKRAram::aramToMainRam(address, buf, bufSize, expandSwitch, p5, heap, id, pSize);
|
||||
}
|
||||
|
||||
inline JKRAramBlock* JKRMainRamToAram(u8* buf, u32 bufSize, u32 alignedSize, JKRExpandSwitch expandSwitch, u32 fileSize, JKRHeap* heap, int id, u32)
|
||||
{
|
||||
return JKRAram::mainRamToAram(buf, bufSize, alignedSize, expandSwitch, fileSize, heap, id);
|
||||
inline JKRAramBlock* JKRMainRamToAram(u8* buf, u32 bufSize, u32 alignedSize, JKRExpandSwitch expandSwitch, u32 fileSize,
|
||||
JKRHeap* heap, int id, u32) {
|
||||
return JKRAram::mainRamToAram(buf, bufSize, alignedSize, expandSwitch, fileSize, heap, id);
|
||||
}
|
||||
|
||||
inline JKRAramStream* JKRCreateAramStreamManager(s32 priority)
|
||||
{
|
||||
return JKRAramStream::create(priority);
|
||||
inline JKRAramStream* JKRCreateAramStreamManager(s32 priority) {
|
||||
return JKRAramStream::create(priority);
|
||||
}
|
||||
|
||||
inline bool JKRAramPcs(int direction, u32 source, u32 destination, u32 length, JKRAramBlock* block)
|
||||
{
|
||||
return JKRAramPiece::orderSync(direction, source, destination, length, block);
|
||||
inline bool JKRAramPcs(int direction, u32 source, u32 destination, u32 length, JKRAramBlock* block) {
|
||||
return JKRAramPiece::orderSync(direction, source, destination, length, block);
|
||||
}
|
||||
|
||||
inline void JKRAramPcs_SendCommand(JKRAMCommand* cmd)
|
||||
{
|
||||
JKRAramPiece::sendCommand(cmd);
|
||||
inline void JKRAramPcs_SendCommand(JKRAMCommand* cmd) {
|
||||
JKRAramPiece::sendCommand(cmd);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -12,17 +12,14 @@
|
||||
#define JKRARCHIVE_ATTR_COMPRESSION 0x04
|
||||
#define JKRARCHIVE_ATTR_YAY0 0x80
|
||||
|
||||
inline u32 read_big_endian_u32(void* ptr)
|
||||
{
|
||||
inline u32 read_big_endian_u32(void* ptr) {
|
||||
u8* uptr = (u8*)ptr;
|
||||
return ((u32)uptr[0] << 0x18) | ((u32)uptr[1] << 0x10) | ((u32)uptr[2] << 8) | (u32)uptr[3];
|
||||
}
|
||||
|
||||
class JKRArchive : public JKRFileLoader
|
||||
{
|
||||
public:
|
||||
enum EMountMode
|
||||
{
|
||||
class JKRArchive : public JKRFileLoader {
|
||||
public:
|
||||
enum EMountMode {
|
||||
UNKNOWN_MOUNT_MODE = 0,
|
||||
MOUNT_MEM = 1,
|
||||
MOUNT_ARAM = 2,
|
||||
@@ -30,26 +27,33 @@ public:
|
||||
MOUNT_COMP = 4,
|
||||
};
|
||||
|
||||
enum EMountDirection
|
||||
{
|
||||
enum EMountDirection {
|
||||
UNKNOWN_MOUNT_DIRECTION = 0,
|
||||
MOUNT_DIRECTION_HEAD = 1,
|
||||
MOUNT_DIRECTION_TAIL = 2,
|
||||
};
|
||||
|
||||
class CArcName
|
||||
{
|
||||
public:
|
||||
CArcName(const char** p1, char p2) { p1[0] = store(p1[0], p2); }
|
||||
class CArcName {
|
||||
public:
|
||||
CArcName(const char** p1, char p2) {
|
||||
p1[0] = store(p1[0], p2);
|
||||
}
|
||||
|
||||
const char* getString() const { return mString; }
|
||||
u16 getHash() const { return mHash; }
|
||||
const char* getString() const {
|
||||
return mString;
|
||||
}
|
||||
u16 getHash() const {
|
||||
return mHash;
|
||||
}
|
||||
void store(const char*);
|
||||
const char* store(const char*, char);
|
||||
|
||||
// Unused/inlined:
|
||||
CArcName() {}
|
||||
CArcName(const char* data) { store(data); }
|
||||
CArcName() {
|
||||
}
|
||||
CArcName(const char* data) {
|
||||
store(data);
|
||||
}
|
||||
|
||||
u16 mHash; // _00
|
||||
u16 _02; // _02
|
||||
@@ -57,23 +61,50 @@ public:
|
||||
u8 _104[4]; // _104, unknown, used to fix stack size
|
||||
};
|
||||
|
||||
struct SDIFileEntry
|
||||
{
|
||||
u16 getNameHash() const { return mHash; }
|
||||
u32 getNameOffset() const { return mFlag & 0xFFFFFF; }
|
||||
u32 getFlags() const { return mFlag >> 24; }
|
||||
u32 getAttr() const { return getFlags(); }
|
||||
u32 getSize() { return mSize; }
|
||||
u16 getFileID() const { return mFileID; }
|
||||
bool isDirectory() const { return (getFlags() & 0x02) != 0; }
|
||||
bool isCompressed() const { return (getFlags() & 0x04) != 0; }
|
||||
u8 getCompressFlag() const { return (getFlags() & 0x04); } // apparently both necessary?
|
||||
bool isYAZ0Compressed() const { return (getFlags() & 0x80) != 0; }
|
||||
struct SDIFileEntry {
|
||||
u16 getNameHash() const {
|
||||
return mHash;
|
||||
}
|
||||
u32 getNameOffset() const {
|
||||
return mFlag & 0xFFFFFF;
|
||||
}
|
||||
u32 getFlags() const {
|
||||
return mFlag >> 24;
|
||||
}
|
||||
u32 getAttr() const {
|
||||
return getFlags();
|
||||
}
|
||||
u32 getSize() {
|
||||
return mSize;
|
||||
}
|
||||
u16 getFileID() const {
|
||||
return mFileID;
|
||||
}
|
||||
bool isDirectory() const {
|
||||
return (getFlags() & 0x02) != 0;
|
||||
}
|
||||
bool isCompressed() const {
|
||||
return (getFlags() & 0x04) != 0;
|
||||
}
|
||||
u8 getCompressFlag() const {
|
||||
return (getFlags() & 0x04);
|
||||
} // apparently both necessary?
|
||||
bool isYAZ0Compressed() const {
|
||||
return (getFlags() & 0x80) != 0;
|
||||
}
|
||||
|
||||
bool getFlag01() const { return (getFlags() & 0x01) != 0; }
|
||||
bool getFlag04() { return mFlag >> 0x18 & 0x04; }
|
||||
bool getFlag10() { return mFlag >> 0x18 & 0x10; }
|
||||
bool getFlag80() { return mFlag >> 0x18 & 0x80; }
|
||||
bool getFlag01() const {
|
||||
return (getFlags() & 0x01) != 0;
|
||||
}
|
||||
bool getFlag04() {
|
||||
return mFlag >> 0x18 & 0x04;
|
||||
}
|
||||
bool getFlag10() {
|
||||
return mFlag >> 0x18 & 0x10;
|
||||
}
|
||||
bool getFlag80() {
|
||||
return mFlag >> 0x18 & 0x80;
|
||||
}
|
||||
|
||||
u16 mFileID; // _00
|
||||
u16 mHash; // _02
|
||||
@@ -83,16 +114,14 @@ public:
|
||||
void* mData; // _10
|
||||
};
|
||||
|
||||
struct SDirEntry
|
||||
{
|
||||
struct SDirEntry {
|
||||
u8 mFlags; // _00
|
||||
u8 _01; // _01
|
||||
u16 mID; // _02
|
||||
char* mName; // _04
|
||||
};
|
||||
|
||||
struct SDIDirEntry
|
||||
{
|
||||
struct SDIDirEntry {
|
||||
u32 mType; // _00
|
||||
u32 mOffset; // _04
|
||||
u16 _08; // _08
|
||||
@@ -101,8 +130,7 @@ public:
|
||||
};
|
||||
|
||||
// NB: Fabricated name
|
||||
struct SArcDataInfo
|
||||
{
|
||||
struct SArcDataInfo {
|
||||
u32 num_nodes; // _00
|
||||
u32 node_offset; // _04
|
||||
u32 num_file_entries; // _08
|
||||
@@ -115,8 +143,7 @@ public:
|
||||
};
|
||||
|
||||
// NB: Fabricated name - need to check size
|
||||
struct SArcHeader
|
||||
{
|
||||
struct SArcHeader {
|
||||
u32 signature; // _00
|
||||
u32 file_length; // _04
|
||||
u32 header_length; // _08
|
||||
@@ -127,22 +154,27 @@ public:
|
||||
u32 _1C; // _1C
|
||||
};
|
||||
|
||||
JKRArchive(s32, EMountMode);
|
||||
public:
|
||||
virtual bool becomeCurrent(const char*); // _10
|
||||
virtual void* getResource(const char* path); // _14
|
||||
virtual void* getResource(u32 type, const char* name); // _18
|
||||
virtual size_t readResource(void* resourceBuffer, u32 bufferSize, const char* path,
|
||||
JKRExpandSwitch expandSwitch); // _1C
|
||||
virtual size_t readResource(void* resourceBuffer, u32 bufferSize, u32 type, const char* name); // _20
|
||||
virtual void removeResourceAll(); // _24
|
||||
virtual bool removeResource(void*); // _28
|
||||
virtual bool detachResource(void*); // _2C
|
||||
virtual s32 getResSize(const void*) const; // _30
|
||||
virtual u32 countFile(const char*) const; // _34
|
||||
virtual JKRFileFinder* getFirstFile(const char*) const; // _38
|
||||
virtual void* fetchResource(SDIFileEntry* entry, u32* outSize) = 0; // _40
|
||||
virtual void* fetchResource(void* resourceBuffer, u32 bufferSize, SDIFileEntry* entry, u32* resSize,
|
||||
JKRExpandSwitch expandSwitch) = 0; // _44
|
||||
|
||||
virtual ~JKRArchive(); // _08
|
||||
virtual bool becomeCurrent(const char*); // _10
|
||||
virtual void* getResource(const char* path); // _14
|
||||
virtual void* getResource(u32 type, const char* name); // _18
|
||||
virtual size_t readResource(void* resourceBuffer, u32 bufferSize, const char* path, JKRExpandSwitch expandSwitch); // _1C
|
||||
virtual size_t readResource(void* resourceBuffer, u32 bufferSize, u32 type, const char* name); // _20
|
||||
virtual void removeResourceAll(); // _24
|
||||
virtual bool removeResource(void*); // _28
|
||||
virtual bool detachResource(void*); // _2C
|
||||
virtual s32 getResSize(const void*) const; // _30
|
||||
virtual u32 countFile(const char*) const; // _34
|
||||
virtual JKRFileFinder* getFirstFile(const char*) const; // _38
|
||||
virtual void* fetchResource(SDIFileEntry* entry, u32* outSize) = 0; // _40
|
||||
virtual void* fetchResource(void* resourceBuffer, u32 bufferSize, SDIFileEntry* entry, u32* resSize, JKRExpandSwitch expandSwitch) = 0; // _44
|
||||
JKRArchive(s32, EMountMode);
|
||||
JKRArchive();
|
||||
JKRArchive(const char* p1, EMountMode mountMode);
|
||||
~JKRArchive();
|
||||
|
||||
SDIDirEntry* findDirectory(const char*, u32) const;
|
||||
SDIFileEntry* findFsResource(const char*, u32) const;
|
||||
@@ -161,17 +193,13 @@ public:
|
||||
static JKRArchive* mount(void*, JKRHeap*, EMountDirection);
|
||||
static JKRArchive* mount(s32, EMountMode, JKRHeap*, EMountDirection);
|
||||
static void* getGlbResource(u32 type, const char* name, JKRArchive* archive);
|
||||
|
||||
// Unused/inlined:
|
||||
JKRArchive();
|
||||
JKRArchive(const char* p1, EMountMode mountMode);
|
||||
static JKRArchive* check_mount_already(s32);
|
||||
static JKRArchive* check_mount_already(s32, JKRHeap*);
|
||||
|
||||
SDIDirEntry* findResType(u32) const;
|
||||
SDIFileEntry* findTypeResource(u32, u32) const;
|
||||
|
||||
static int convertAttrToCompressionType(int attr)
|
||||
{
|
||||
static int convertAttrToCompressionType(int attr) {
|
||||
int compression;
|
||||
if (FLAG_ON(attr, JKRARCHIVE_ATTR_COMPRESSION))
|
||||
compression = JKRCOMPRESSION_NONE;
|
||||
@@ -183,15 +211,25 @@ public:
|
||||
return compression;
|
||||
}
|
||||
|
||||
u32 getMountMode() const { return mMountMode; }
|
||||
u32 countFile() const { return mArcInfoBlock->num_file_entries; }
|
||||
int countDirectory() const { return mArcInfoBlock->num_nodes; }
|
||||
static u32 getCurrentDirID() { return sCurrentDirID; }
|
||||
static void setCurrentDirID(u32 dirID) { sCurrentDirID = dirID; }
|
||||
u32 getMountMode() const {
|
||||
return mMountMode;
|
||||
}
|
||||
u32 countFile() const {
|
||||
return mArcInfoBlock->num_file_entries;
|
||||
}
|
||||
int countDirectory() const {
|
||||
return mArcInfoBlock->num_nodes;
|
||||
}
|
||||
static u32 getCurrentDirID() {
|
||||
return sCurrentDirID;
|
||||
}
|
||||
static void setCurrentDirID(u32 dirID) {
|
||||
sCurrentDirID = dirID;
|
||||
}
|
||||
|
||||
static u32 sCurrentDirID;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
// _00 = VTBL
|
||||
// _00-_38 = JKRFileLoader
|
||||
JKRHeap* mHeap; // _38
|
||||
@@ -206,20 +244,15 @@ protected:
|
||||
EMountDirection mMountDirection; // _5C
|
||||
};
|
||||
|
||||
enum JKRMemBreakFlag
|
||||
{
|
||||
MBF_0 = 0,
|
||||
MBF_1 = 1
|
||||
};
|
||||
enum JKRMemBreakFlag { MBF_0 = 0, MBF_1 = 1 };
|
||||
|
||||
class JKRAramArchive : public JKRArchive
|
||||
{
|
||||
public:
|
||||
class JKRAramArchive : public JKRArchive {
|
||||
public:
|
||||
JKRAramArchive();
|
||||
JKRAramArchive(s32, EMountDirection);
|
||||
|
||||
virtual ~JKRAramArchive(); // _08
|
||||
virtual void* fetchResource(SDIFileEntry*, u32*); // _40
|
||||
virtual ~JKRAramArchive(); // _08
|
||||
virtual void* fetchResource(SDIFileEntry*, u32*); // _40
|
||||
virtual void* fetchResource(void*, u32, SDIFileEntry*, u32*, JKRExpandSwitch expandSwitch); // _44
|
||||
|
||||
bool open(s32);
|
||||
@@ -239,15 +272,15 @@ public:
|
||||
JKRFile* mDvdFile; // _64
|
||||
};
|
||||
|
||||
struct JKRCompArchive : public JKRArchive
|
||||
{
|
||||
struct JKRCompArchive : public JKRArchive {
|
||||
JKRCompArchive(s32, EMountDirection);
|
||||
|
||||
virtual ~JKRCompArchive(); // _08
|
||||
virtual void removeResourceAll(); // _24
|
||||
virtual bool removeResource(void*); // _28
|
||||
virtual void* fetchResource(SDIFileEntry* entry, u32* outSize); // _40
|
||||
virtual void* fetchResource(void* resourceBuffer, u32 bufferSize, SDIFileEntry* entry, u32* resSize, JKRExpandSwitch expandSwitch); // _44
|
||||
virtual ~JKRCompArchive(); // _08
|
||||
virtual void removeResourceAll(); // _24
|
||||
virtual bool removeResource(void*); // _28
|
||||
virtual void* fetchResource(SDIFileEntry* entry, u32* outSize); // _40
|
||||
virtual void* fetchResource(void* resourceBuffer, u32 bufferSize, SDIFileEntry* entry, u32* resSize,
|
||||
JKRExpandSwitch expandSwitch); // _44
|
||||
|
||||
bool open(s32);
|
||||
|
||||
@@ -259,23 +292,23 @@ struct JKRCompArchive : public JKRArchive
|
||||
|
||||
// _00 = VTBL
|
||||
// _00-_5C = JKRArchive
|
||||
u32 _60; // _60
|
||||
JKRAramBlock* mAramPart; // _64
|
||||
u32 _68; // _68
|
||||
JKRFile* mDvdFile; // _6C
|
||||
u32 mSizeOfMemPart; // _70
|
||||
u32 mSizeOfAramPart; // _74
|
||||
u32 _78; // _78
|
||||
u32 _60; // _60
|
||||
JKRAramBlock* mAramPart; // _64
|
||||
u32 _68; // _68
|
||||
JKRFile* mDvdFile; // _6C
|
||||
u32 mSizeOfMemPart; // _70
|
||||
u32 mSizeOfAramPart; // _74
|
||||
u32 _78; // _78
|
||||
};
|
||||
|
||||
struct JKRDvdArchive : public JKRArchive
|
||||
{
|
||||
struct JKRDvdArchive : public JKRArchive {
|
||||
JKRDvdArchive();
|
||||
JKRDvdArchive(s32, JKRArchive::EMountDirection);
|
||||
|
||||
virtual ~JKRDvdArchive(); // _00
|
||||
virtual void* fetchResource(SDIFileEntry* entry, u32* outSize); // _38
|
||||
virtual void* fetchResource(void* resourceBuffer, u32 bufferSize, SDIFileEntry* entry, u32* resSize, JKRExpandSwitch expandSwitch); // _3C
|
||||
virtual ~JKRDvdArchive(); // _00
|
||||
virtual void* fetchResource(SDIFileEntry* entry, u32* outSize); // _38
|
||||
virtual void* fetchResource(void* resourceBuffer, u32 bufferSize, SDIFileEntry* entry, u32* resSize,
|
||||
JKRExpandSwitch expandSwitch); // _3C
|
||||
|
||||
bool open(s32);
|
||||
static u32 fetchResource_subroutine(s32, u32, u32, u8*, u32, int, int);
|
||||
@@ -289,22 +322,22 @@ struct JKRDvdArchive : public JKRArchive
|
||||
|
||||
// _00 = VTBL
|
||||
// _00-_5C = JKRArchive
|
||||
int _60; // _60
|
||||
JKRFile* mDvdFile; // _64
|
||||
int _60; // _60
|
||||
JKRFile* mDvdFile; // _64
|
||||
};
|
||||
|
||||
struct JKRMemArchive : public JKRArchive
|
||||
{
|
||||
struct JKRMemArchive : public JKRArchive {
|
||||
JKRMemArchive(); // unused/inlined
|
||||
JKRMemArchive(s32, EMountDirection);
|
||||
JKRMemArchive(void*, u32, JKRMemBreakFlag);
|
||||
JKRMemArchive(const char*, EMountDirection); // unused/inlined
|
||||
|
||||
virtual ~JKRMemArchive(); // _08
|
||||
virtual void removeResourceAll(); // _24
|
||||
virtual bool removeResource(void*); // _28
|
||||
virtual void* fetchResource(SDIFileEntry* entry, u32* outSize); // _40
|
||||
virtual void* fetchResource(void* resourceBuffer, u32 bufferSize, SDIFileEntry* entry, u32* resSize, JKRExpandSwitch expandSwitch); // _44
|
||||
virtual ~JKRMemArchive(); // _08
|
||||
virtual void removeResourceAll(); // _24
|
||||
virtual bool removeResource(void*); // _28
|
||||
virtual void* fetchResource(SDIFileEntry* entry, u32* outSize); // _40
|
||||
virtual void* fetchResource(void* resourceBuffer, u32 bufferSize, SDIFileEntry* entry, u32* resSize,
|
||||
JKRExpandSwitch expandSwitch); // _44
|
||||
|
||||
bool open(s32, EMountDirection);
|
||||
bool open(void*, u32, JKRMemBreakFlag);
|
||||
@@ -320,23 +353,21 @@ struct JKRMemArchive : public JKRArchive
|
||||
|
||||
// _00 = VTBL
|
||||
// _00-_60 = JKRArchive
|
||||
SArcHeader* mArcHeader; // _60
|
||||
u8* mArchiveData; // _64
|
||||
bool mIsOpen; // _68
|
||||
SArcHeader* mArcHeader; // _60
|
||||
u8* mArchiveData; // _64
|
||||
bool mIsOpen; // _68
|
||||
};
|
||||
|
||||
inline int JKRConvertAttrToCompressionType(int attr)
|
||||
{
|
||||
inline int JKRConvertAttrToCompressionType(int attr) {
|
||||
return JKRArchive::convertAttrToCompressionType(attr);
|
||||
}
|
||||
|
||||
inline JKRArchive* JKRMountArchive(const char* path, JKRArchive::EMountMode mountMode, JKRHeap* heap, JKRArchive::EMountDirection mountDirection)
|
||||
{
|
||||
inline JKRArchive* JKRMountArchive(const char* path, JKRArchive::EMountMode mountMode, JKRHeap* heap,
|
||||
JKRArchive::EMountDirection mountDirection) {
|
||||
return JKRArchive::mount(path, mountMode, heap, mountDirection);
|
||||
}
|
||||
|
||||
inline JKRArchive* JKRMountArchive(void* inBuf, JKRHeap* heap, JKRArchive::EMountDirection mountDirection)
|
||||
{
|
||||
inline JKRArchive* JKRMountArchive(void* inBuf, JKRHeap* heap, JKRArchive::EMountDirection mountDirection) {
|
||||
return JKRArchive::mount(inBuf, heap, mountDirection);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,96 +13,92 @@
|
||||
#define JKRDECOMP_STACK_SIZE 0x4000
|
||||
#define JKRDECOMP_THREAD_MSG_BUF_COUNT 16
|
||||
|
||||
#define JKRDECOMP_READU32BE(ptr, offset) (((u32)ptr[offset] << 24) | ((u32)ptr[offset + 1] << 16) | ((u32)ptr[offset + 2] << 8) | (u32)ptr[offset + 3])
|
||||
#define JKRDECOMP_READU32BE(ptr, offset) \
|
||||
(((u32)ptr[offset] << 24) | ((u32)ptr[offset + 1] << 16) | ((u32)ptr[offset + 2] << 8) | (u32)ptr[offset + 3])
|
||||
|
||||
#define SZ_MIN_BACKSIZE 3
|
||||
#define SZ_DEFAULT_BACKSIZE 15 + SZ_MIN_BACKSIZE
|
||||
|
||||
#define SZP_GETBACKOFS(buf) (((*((u8*)buf) & 0xF) << 8) | (*(((u8*)buf)+1)))
|
||||
#define SZP_GETBACKOFS(buf) (((*((u8*)buf) & 0xF) << 8) | (*(((u8*)buf) + 1)))
|
||||
#define SZP_GETCOUNT(buf) (*((u16*)buf) >> 12)
|
||||
|
||||
typedef void DecompCallback(u32);
|
||||
|
||||
class JKRDecompCommand {
|
||||
public:
|
||||
enum TransferType {
|
||||
MRAM = 0,
|
||||
ARAM = 1
|
||||
};
|
||||
public:
|
||||
enum TransferType { MRAM = 0, ARAM = 1 };
|
||||
|
||||
JKRDecompCommand();
|
||||
~JKRDecompCommand();
|
||||
JKRDecompCommand();
|
||||
~JKRDecompCommand();
|
||||
|
||||
u8 _00[4];
|
||||
u8* mSrcBuffer;
|
||||
u8* mDstBuffer;
|
||||
u32 mSrcLength;
|
||||
u32 mSkipCount;
|
||||
DecompCallback* mCallback;
|
||||
JKRDecompCommand* mCmd;
|
||||
OSMessageQueue* pMesgQueue1C;
|
||||
TransferType transferType;
|
||||
JKRAMCommand* mAMCommand;
|
||||
OSMessageQueue mMesgQueue;
|
||||
OSMessage mMesgBuffer[1];
|
||||
u8 _00[4];
|
||||
u8* mSrcBuffer;
|
||||
u8* mDstBuffer;
|
||||
u32 mSrcLength;
|
||||
u32 mSkipCount;
|
||||
DecompCallback* mCallback;
|
||||
JKRDecompCommand* mCmd;
|
||||
OSMessageQueue* pMesgQueue1C;
|
||||
TransferType transferType;
|
||||
JKRAMCommand* mAMCommand;
|
||||
OSMessageQueue mMesgQueue;
|
||||
OSMessage mMesgBuffer[1];
|
||||
};
|
||||
|
||||
class JKRDecomp : public JKRThread {
|
||||
public:
|
||||
enum CompressionMode {
|
||||
NONE = 0,
|
||||
SZP = 1,
|
||||
SZS = 2
|
||||
};
|
||||
public:
|
||||
enum CompressionMode { NONE = 0, SZP = 1, SZS = 2 };
|
||||
|
||||
JKRDecomp(s32 decompPriority);
|
||||
JKRDecomp(s32 decompPriority);
|
||||
|
||||
virtual ~JKRDecomp();
|
||||
virtual ~JKRDecomp();
|
||||
|
||||
virtual void* run();
|
||||
virtual void* run();
|
||||
|
||||
static JKRDecompCommand* prepareCommand(u8* srcBuffer, u8* dstBuffer, u32 srcLength, u32 skipCount, DecompCallback* callback);
|
||||
static CompressionMode checkCompressed(u8* buf);
|
||||
static JKRDecomp* create(s32 decompPriority);
|
||||
static void decode(u8* srcBuffer, u8* dstBuffer, u32 srcLength, u32 skipCount);
|
||||
static void decodeSZP(u8* srcBuffer, u8* dstBuffer, u32 srcLength, u32 skipCount);
|
||||
static void decodeSZS(u8* srcBuffer, u8* dstBuffer, u32 srcLength, u32 skipCount);
|
||||
static bool orderSync(u8* srcBuffer, u8* dstBuffer, u32 srcLength, u32 skipCount);
|
||||
static JKRDecompCommand* orderAsync(u8* srcBuffer, u8* dstBuffer, u32 srcLength, u32 skipCount, DecompCallback* callback);
|
||||
static bool sync(JKRDecompCommand* cmd, BOOL noBlock);
|
||||
static BOOL sendCommand(JKRDecompCommand* cmd);
|
||||
static JKRDecompCommand* prepareCommand(u8* srcBuffer, u8* dstBuffer, u32 srcLength, u32 skipCount,
|
||||
DecompCallback* callback);
|
||||
static CompressionMode checkCompressed(u8* buf);
|
||||
static JKRDecomp* create(s32 decompPriority);
|
||||
static void decode(u8* srcBuffer, u8* dstBuffer, u32 srcLength, u32 skipCount);
|
||||
static void decodeSZP(u8* srcBuffer, u8* dstBuffer, u32 srcLength, u32 skipCount);
|
||||
static void decodeSZS(u8* srcBuffer, u8* dstBuffer, u32 srcLength, u32 skipCount);
|
||||
static bool orderSync(u8* srcBuffer, u8* dstBuffer, u32 srcLength, u32 skipCount);
|
||||
static JKRDecompCommand* orderAsync(u8* srcBuffer, u8* dstBuffer, u32 srcLength, u32 skipCount,
|
||||
DecompCallback* callback);
|
||||
static bool sync(JKRDecompCommand* cmd, BOOL noBlock);
|
||||
static BOOL sendCommand(JKRDecompCommand* cmd);
|
||||
|
||||
static OSMessageQueue sMessageQueue;
|
||||
static OSMessage sMessageBuffer[JKRDECOMP_MSG_BUF_COUNT];
|
||||
static JKRDecomp* sDecompObject;
|
||||
static OSMessageQueue sMessageQueue;
|
||||
static OSMessage sMessageBuffer[JKRDECOMP_MSG_BUF_COUNT];
|
||||
static JKRDecomp* sDecompObject;
|
||||
};
|
||||
|
||||
inline JKRDecomp* JKRCreateDecompManager(s32 priority) {
|
||||
return JKRDecomp::create(priority);
|
||||
return JKRDecomp::create(priority);
|
||||
}
|
||||
|
||||
inline int JKRCheckCompressed_noASR(u8* pBuf)
|
||||
{
|
||||
int compression = JKRDecomp::checkCompressed(pBuf);
|
||||
if (compression == JKRCOMPRESSION_ASR)
|
||||
compression = JKRCOMPRESSION_NONE;
|
||||
return compression;
|
||||
inline int JKRCheckCompressed_noASR(u8* pBuf) {
|
||||
int compression = JKRDecomp::checkCompressed(pBuf);
|
||||
if (compression == JKRCOMPRESSION_ASR)
|
||||
compression = JKRCOMPRESSION_NONE;
|
||||
return compression;
|
||||
}
|
||||
|
||||
inline JKRDecomp::CompressionMode JKRCheckCompressed(u8* buf) {
|
||||
return JKRDecomp::checkCompressed(buf);
|
||||
return JKRDecomp::checkCompressed(buf);
|
||||
}
|
||||
|
||||
inline u32 JKRDecompExpandSize(u8* buf) {
|
||||
return (buf[4] << 24) | (buf[5] << 16) | (buf[6] << 8) | buf[7];
|
||||
return (buf[4] << 24) | (buf[5] << 16) | (buf[6] << 8) | buf[7];
|
||||
}
|
||||
|
||||
inline void JKRDecompress(u8* src, u8* dst, u32 srcLength, u32 skipCount) {
|
||||
JKRDecomp::orderSync(src, dst, srcLength, skipCount);
|
||||
JKRDecomp::orderSync(src, dst, srcLength, skipCount);
|
||||
}
|
||||
|
||||
int JKRDecompressFromDVD(JKRDvdFile* srcFile, void* buf, u32 size, u32 maxDest, u32 fileOffset, u32 srcOffset);
|
||||
int JKRDecompressFromDVDToAram(JKRDvdFile* srcFile, u32 address, u32 fileSize, u32 maxDest, u32 fileOffset, u32 srcOffset);
|
||||
int JKRDecompressFromDVDToAram(JKRDvdFile* srcFile, u32 address, u32 fileSize, u32 maxDest, u32 fileOffset,
|
||||
u32 srcOffset);
|
||||
int JKRDecompressFromAramToMainRam(u32 srcAddress, void* dst, u32 fileSize, u32 maxDest, u32 fileOffset);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,17 +9,15 @@ extern "C" {
|
||||
|
||||
class JKRHeap;
|
||||
|
||||
class JKRDisposer
|
||||
{
|
||||
public:
|
||||
class JKRDisposer {
|
||||
public:
|
||||
JKRDisposer();
|
||||
virtual ~JKRDisposer();
|
||||
|
||||
public:
|
||||
public:
|
||||
JKRHeap* mRootHeap; // _4
|
||||
JSULink<JKRDisposer> mPointerLinks; // _8
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -7,9 +7,8 @@
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
class JKRADCommand
|
||||
{
|
||||
public:
|
||||
class JKRADCommand {
|
||||
public:
|
||||
typedef void (*LoadCallback)(u32);
|
||||
JKRADCommand();
|
||||
~JKRADCommand();
|
||||
@@ -30,9 +29,8 @@ public:
|
||||
JKRAramStreamCommand* mStreamCommand; // _48
|
||||
};
|
||||
|
||||
class JKRDvdAramRipper
|
||||
{
|
||||
public:
|
||||
class JKRDvdAramRipper {
|
||||
public:
|
||||
static JKRAramBlock* loadToAram(char const*, u32, JKRExpandSwitch, u32, u32);
|
||||
static JKRAramBlock* loadToAram(s32, u32, JKRExpandSwitch, u32, u32);
|
||||
static JKRAramBlock* loadToAram(JKRDvdFile*, u32, JKRExpandSwitch, u32, u32);
|
||||
@@ -47,16 +45,19 @@ public:
|
||||
static void countLeftSync();
|
||||
static void afterAramAsync(JKRADCommand*);
|
||||
|
||||
static int getSZSBufferSize() { return sSZSBufferSize; }
|
||||
static bool isErrorRetry() { return errorRetry; }
|
||||
static int getSZSBufferSize() {
|
||||
return sSZSBufferSize;
|
||||
}
|
||||
static bool isErrorRetry() {
|
||||
return errorRetry;
|
||||
}
|
||||
|
||||
static bool errorRetry;
|
||||
static int sSZSBufferSize;
|
||||
static JSUList<JKRADCommand> sDvdAramAsyncList;
|
||||
};
|
||||
|
||||
inline JKRAramBlock* JKRDvdToAram(s32 entrynum, u32 p2, JKRExpandSwitch expSwitch, u32 p4, u32 p5)
|
||||
{
|
||||
inline JKRAramBlock* JKRDvdToAram(s32 entrynum, u32 p2, JKRExpandSwitch expSwitch, u32 p4, u32 p5) {
|
||||
return JKRDvdAramRipper::loadToAram(entrynum, p2, expSwitch, p4, p5);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,73 +9,76 @@
|
||||
class JKRDvdFile;
|
||||
|
||||
struct JKRDvdFileInfo : public DVDFileInfo {
|
||||
JKRDvdFile* mFile;
|
||||
JKRDvdFile* mFile;
|
||||
};
|
||||
|
||||
class JKRDvdFile : public JKRFile {
|
||||
public:
|
||||
JKRDvdFile();
|
||||
JKRDvdFile(const char* filename);
|
||||
JKRDvdFile(s32 entrynum);
|
||||
public:
|
||||
JKRDvdFile();
|
||||
JKRDvdFile(const char* filename);
|
||||
JKRDvdFile(s32 entrynum);
|
||||
|
||||
virtual ~JKRDvdFile();
|
||||
virtual ~JKRDvdFile();
|
||||
|
||||
virtual bool open(const char* filename);
|
||||
virtual bool close();
|
||||
virtual int readData(void* data, s32 length, s32 ofs);
|
||||
virtual int writeData(const void* data, s32 length, s32 ofs);
|
||||
virtual u32 getFileSize() const { return this->mDvdFileInfo.length; }
|
||||
virtual bool open(s32 entrynum);
|
||||
|
||||
inline DVDFileInfo* getFileInfo() {
|
||||
return &this->mDvdFileInfo;
|
||||
}
|
||||
|
||||
inline int readDataAsync(void* addr, s32 length, s32 offset) {
|
||||
OSLockMutex(&this->mDvdMutex);
|
||||
s32 retAddr;
|
||||
|
||||
if (this->mDvdThread != nullptr) {
|
||||
OSUnlockMutex(&this->mDvdMutex);
|
||||
retAddr = -1;
|
||||
virtual bool open(const char* filename);
|
||||
virtual bool close();
|
||||
virtual int readData(void* data, s32 length, s32 ofs);
|
||||
virtual int writeData(const void* data, s32 length, s32 ofs);
|
||||
virtual u32 getFileSize() const {
|
||||
return this->mDvdFileInfo.length;
|
||||
}
|
||||
else {
|
||||
this->mDvdThread = OSGetCurrentThread();
|
||||
retAddr = -1;
|
||||
if (DVDReadAsync(&this->mDvdFileInfo, addr, length, offset, JKRDvdFile::doneProcess)) {
|
||||
retAddr = this->sync();
|
||||
}
|
||||
virtual bool open(s32 entrynum);
|
||||
|
||||
this->mDvdThread = nullptr;
|
||||
OSUnlockMutex(&this->mDvdMutex);
|
||||
inline DVDFileInfo* getFileInfo() {
|
||||
return &this->mDvdFileInfo;
|
||||
}
|
||||
|
||||
return retAddr;
|
||||
}
|
||||
inline int readDataAsync(void* addr, s32 length, s32 offset) {
|
||||
OSLockMutex(&this->mDvdMutex);
|
||||
s32 retAddr;
|
||||
|
||||
inline int writeDataAsync(const void* data, s32 length, s32 offset) { return -1; }
|
||||
if (this->mDvdThread != nullptr) {
|
||||
OSUnlockMutex(&this->mDvdMutex);
|
||||
retAddr = -1;
|
||||
} else {
|
||||
this->mDvdThread = OSGetCurrentThread();
|
||||
retAddr = -1;
|
||||
if (DVDReadAsync(&this->mDvdFileInfo, addr, length, offset, JKRDvdFile::doneProcess)) {
|
||||
retAddr = this->sync();
|
||||
}
|
||||
|
||||
void initiate();
|
||||
s32 sync();
|
||||
this->mDvdThread = nullptr;
|
||||
OSUnlockMutex(&this->mDvdMutex);
|
||||
}
|
||||
|
||||
static void doneProcess(s32 result, DVDFileInfo* info);
|
||||
return retAddr;
|
||||
}
|
||||
|
||||
static JSUList<JKRDvdFile> sDvdList;
|
||||
inline int writeDataAsync(const void* data, s32 length, s32 offset) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public:
|
||||
OSMutex mDvdMutex;
|
||||
OSMutex mAramMutex;
|
||||
JKRAramBlock* mAramBlock;
|
||||
OSThread* mAramThread;
|
||||
JSUFileInputStream* mInputStream;
|
||||
u32 _58;
|
||||
JKRDvdFileInfo mDvdFileInfo;
|
||||
OSMessageQueue mAramMessageQueue;
|
||||
OSMessage mAramMessage;
|
||||
OSMessageQueue mDvdMessageQueue;
|
||||
OSMessage mDvdMessage;
|
||||
JSULink<JKRDvdFile> mLink;
|
||||
OSThread* mDvdThread;
|
||||
void initiate();
|
||||
s32 sync();
|
||||
|
||||
static void doneProcess(s32 result, DVDFileInfo* info);
|
||||
|
||||
static JSUList<JKRDvdFile> sDvdList;
|
||||
|
||||
public:
|
||||
OSMutex mDvdMutex;
|
||||
OSMutex mAramMutex;
|
||||
JKRAramBlock* mAramBlock;
|
||||
OSThread* mAramThread;
|
||||
JSUFileInputStream* mInputStream;
|
||||
u32 _58;
|
||||
JKRDvdFileInfo mDvdFileInfo;
|
||||
OSMessageQueue mAramMessageQueue;
|
||||
OSMessage mAramMessage;
|
||||
OSMessageQueue mDvdMessageQueue;
|
||||
OSMessage mDvdMessage;
|
||||
JSULink<JKRDvdFile> mLink;
|
||||
OSThread* mDvdThread;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -12,47 +12,50 @@
|
||||
#define DMA_BUFFERSIZE 0x100
|
||||
|
||||
struct SZPHeader {
|
||||
u32 magic;
|
||||
u32 decompSize;
|
||||
u32 magic;
|
||||
u32 decompSize;
|
||||
};
|
||||
|
||||
struct SYaz0Header {
|
||||
u32 signature;
|
||||
u32 length;
|
||||
u32 signature;
|
||||
u32 length;
|
||||
};
|
||||
|
||||
class JKRDMCommand {
|
||||
JKRDMCommand();
|
||||
~JKRDMCommand();
|
||||
JKRDMCommand();
|
||||
~JKRDMCommand();
|
||||
};
|
||||
|
||||
class JKRDvdRipper {
|
||||
public:
|
||||
enum EAllocDirection {
|
||||
ALLOC_DIR_DEFAULT = 0,
|
||||
ALLOC_DIR_TOP = 1,
|
||||
ALLOC_DIR_BOTTOM = 2
|
||||
};
|
||||
public:
|
||||
enum EAllocDirection { ALLOC_DIR_DEFAULT = 0, ALLOC_DIR_TOP = 1, ALLOC_DIR_BOTTOM = 2 };
|
||||
|
||||
static void* loadToMainRAM(const char* file, u8* buf, JKRExpandSwitch expandSwitch, u32 maxDest, JKRHeap* heap, EAllocDirection allocDir, u32 offset, int* compressMode);
|
||||
static void* loadToMainRAM(s32 entrynum, u8* buf, JKRExpandSwitch expandSwitch, u32 maxDest, JKRHeap* heap, EAllocDirection allocDir, u32 offset, int* compressMode);
|
||||
static void* loadToMainRAM(JKRDvdFile* file, u8* buf, JKRExpandSwitch expandSwitch, u32 maxDest, JKRHeap* heap, EAllocDirection allocDir, u32 offset, int* compressMode);
|
||||
static void* loadToMainRAM(const char* file, u8* buf, JKRExpandSwitch expandSwitch, u32 maxDest, JKRHeap* heap,
|
||||
EAllocDirection allocDir, u32 offset, int* compressMode);
|
||||
static void* loadToMainRAM(s32 entrynum, u8* buf, JKRExpandSwitch expandSwitch, u32 maxDest, JKRHeap* heap,
|
||||
EAllocDirection allocDir, u32 offset, int* compressMode);
|
||||
static void* loadToMainRAM(JKRDvdFile* file, u8* buf, JKRExpandSwitch expandSwitch, u32 maxDest, JKRHeap* heap,
|
||||
EAllocDirection allocDir, u32 offset, int* compressMode);
|
||||
|
||||
static inline bool isErrorRetry() { return JKRDvdRipper::errorRetry; }
|
||||
static inline bool isErrorRetry() {
|
||||
return JKRDvdRipper::errorRetry;
|
||||
}
|
||||
|
||||
static JSUList<JKRDMCommand> sDvdAsyncList;
|
||||
static JSUList<JKRDMCommand> sDvdAsyncList;
|
||||
|
||||
static bool errorRetry;
|
||||
static bool errorRetry;
|
||||
};
|
||||
|
||||
inline void* JKRDvdToMainRam(long entryNum, u8* dst, JKRExpandSwitch expandSwitch, u32 fileSize, JKRHeap* heap, JKRDvdRipper::EAllocDirection allocDirection, u32 startOffset, int* pCompression)
|
||||
{
|
||||
return JKRDvdRipper::loadToMainRAM(entryNum, dst, expandSwitch, fileSize, heap, allocDirection, startOffset, pCompression);
|
||||
inline void* JKRDvdToMainRam(long entryNum, u8* dst, JKRExpandSwitch expandSwitch, u32 fileSize, JKRHeap* heap,
|
||||
JKRDvdRipper::EAllocDirection allocDirection, u32 startOffset, int* pCompression) {
|
||||
return JKRDvdRipper::loadToMainRAM(entryNum, dst, expandSwitch, fileSize, heap, allocDirection, startOffset,
|
||||
pCompression);
|
||||
}
|
||||
|
||||
inline void* JKRDvdToMainRam(const char* path, u8* dst, JKRExpandSwitch expandSwitch, u32 fileSize, JKRHeap* heap, JKRDvdRipper::EAllocDirection allocDirection, u32 startOffset, int* pCompression)
|
||||
{
|
||||
return JKRDvdRipper::loadToMainRAM(path, dst, expandSwitch, fileSize, heap, allocDirection, startOffset, pCompression);
|
||||
inline void* JKRDvdToMainRam(const char* path, u8* dst, JKRExpandSwitch expandSwitch, u32 fileSize, JKRHeap* heap,
|
||||
JKRDvdRipper::EAllocDirection allocDirection, u32 startOffset, int* pCompression) {
|
||||
return JKRDvdRipper::loadToMainRAM(path, dst, expandSwitch, fileSize, heap, allocDirection, startOffset,
|
||||
pCompression);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -12,11 +12,10 @@ extern "C" {
|
||||
#define JKRCOMPRESSION_YAZ0 2
|
||||
#define JKRCOMPRESSION_ASR 3
|
||||
|
||||
typedef enum JKRExpandSwitch
|
||||
{
|
||||
EXPAND_SWITCH_DEFAULT, /* Do nothing? treated same as 2 */
|
||||
EXPAND_SWITCH_DECOMPRESS, /* Check for compression and decompress */
|
||||
EXPAND_SWITCH_NONE /* Do nothing */
|
||||
typedef enum JKRExpandSwitch {
|
||||
EXPAND_SWITCH_DEFAULT, /* Do nothing? treated same as 2 */
|
||||
EXPAND_SWITCH_DECOMPRESS, /* Check for compression and decompress */
|
||||
EXPAND_SWITCH_NONE /* Do nothing */
|
||||
} JKRExpandSwitch;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -5,28 +5,46 @@
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
class JKRExpHeap : public JKRHeap
|
||||
{
|
||||
public:
|
||||
class CMemBlock
|
||||
{
|
||||
public:
|
||||
class JKRExpHeap : public JKRHeap {
|
||||
public:
|
||||
class CMemBlock {
|
||||
public:
|
||||
CMemBlock* allocBack(u32, u8, u8, u8, u8);
|
||||
CMemBlock* allocFore(u32, u8, u8, u8, u8);
|
||||
void* free(JKRExpHeap*);
|
||||
static CMemBlock* getHeapBlock(void*);
|
||||
void initiate(CMemBlock*, CMemBlock*, u32, u8, u8);
|
||||
|
||||
void newGroupId(u8 groupId) { mGroupID = groupId; }
|
||||
bool isValid() const { return mUsageHeader == 'HM'; }
|
||||
bool _isTempMemBlock() const { return (mFlags & 0x80) ? true : false; }
|
||||
int getAlignment() const { return mFlags & 0x7f; }
|
||||
void* getContent() const { return (void*)(this + 1); }
|
||||
CMemBlock* getPrevBlock() const { return mPrev; }
|
||||
CMemBlock* getNextBlock() const { return mNext; }
|
||||
u32 getSize() const { return mAllocatedSpace; }
|
||||
u8 getGroupId() const { return mGroupID; }
|
||||
static CMemBlock* getBlock(void* data) { return (CMemBlock*)((u32)data + -0x10); }
|
||||
void newGroupId(u8 groupId) {
|
||||
mGroupID = groupId;
|
||||
}
|
||||
bool isValid() const {
|
||||
return mUsageHeader == 'HM';
|
||||
}
|
||||
bool _isTempMemBlock() const {
|
||||
return (mFlags & 0x80) ? true : false;
|
||||
}
|
||||
int getAlignment() const {
|
||||
return mFlags & 0x7f;
|
||||
}
|
||||
void* getContent() const {
|
||||
return (void*)(this + 1);
|
||||
}
|
||||
CMemBlock* getPrevBlock() const {
|
||||
return mPrev;
|
||||
}
|
||||
CMemBlock* getNextBlock() const {
|
||||
return mNext;
|
||||
}
|
||||
u32 getSize() const {
|
||||
return mAllocatedSpace;
|
||||
}
|
||||
u8 getGroupId() const {
|
||||
return mGroupID;
|
||||
}
|
||||
static CMemBlock* getBlock(void* data) {
|
||||
return (CMemBlock*)((u32)data + -0x10);
|
||||
}
|
||||
|
||||
u16 mUsageHeader; // _00
|
||||
u8 mFlags; // _02, a|bbbbbbb = a=temp, b=aln
|
||||
@@ -38,24 +56,28 @@ public:
|
||||
|
||||
JKRExpHeap(void*, u32, JKRHeap*, bool);
|
||||
|
||||
virtual ~JKRExpHeap(); // _08
|
||||
virtual void* do_alloc(u32, int); // _10
|
||||
virtual void do_free(void*); // _14
|
||||
virtual void do_freeTail(); // _18
|
||||
virtual void do_freeAll(); // _1C
|
||||
virtual s32 do_resize(void*, u32); // _20
|
||||
virtual s32 do_getSize(void*); // _24
|
||||
virtual s32 do_getFreeSize(); // _28
|
||||
virtual s32 do_getTotalFreeSize(); // _2C
|
||||
virtual bool check(); // _34
|
||||
virtual bool dump_sort(); // _38
|
||||
virtual bool dump(); // _3C
|
||||
virtual s32 do_changeGroupID(u8); // _40
|
||||
virtual void state_register(TState*, u32) const; // _48
|
||||
virtual bool state_compare(const TState&, const TState&) const; // _4C
|
||||
virtual ~JKRExpHeap(); // _08
|
||||
virtual void* do_alloc(u32, int); // _10
|
||||
virtual void do_free(void*); // _14
|
||||
virtual void do_freeTail(); // _18
|
||||
virtual void do_freeAll(); // _1C
|
||||
virtual s32 do_resize(void*, u32); // _20
|
||||
virtual s32 do_getSize(void*); // _24
|
||||
virtual s32 do_getFreeSize(); // _28
|
||||
virtual s32 do_getTotalFreeSize(); // _2C
|
||||
virtual bool check(); // _34
|
||||
virtual bool dump_sort(); // _38
|
||||
virtual bool dump(); // _3C
|
||||
virtual s32 do_changeGroupID(u8); // _40
|
||||
virtual void state_register(TState*, u32) const; // _48
|
||||
virtual bool state_compare(const TState&, const TState&) const; // _4C
|
||||
|
||||
virtual u8 do_getCurrentGroupId() { return mCurrentGroupID; } // _44 (weak)
|
||||
virtual u32 getHeapType() { return 'EXPH'; } // _30 (weak)
|
||||
virtual u8 do_getCurrentGroupId() {
|
||||
return mCurrentGroupID;
|
||||
} // _44 (weak)
|
||||
virtual u32 getHeapType() {
|
||||
return 'EXPH';
|
||||
} // _30 (weak)
|
||||
|
||||
void* allocFromHead(u32, int);
|
||||
void* allocFromHead(u32);
|
||||
@@ -76,17 +98,22 @@ public:
|
||||
bool isEmpty();
|
||||
s32 getUsedSize(u8 groupId) const;
|
||||
|
||||
CMemBlock* getHeadUsedList() const { return mHeadUsedList; }
|
||||
void setAllocationMode(EAllocMode mode) { mCurrentAllocMode = mode; }
|
||||
CMemBlock* getHeadUsedList() const {
|
||||
return mHeadUsedList;
|
||||
}
|
||||
void setAllocationMode(EAllocMode mode) {
|
||||
mCurrentAllocMode = mode;
|
||||
}
|
||||
|
||||
static s32 getUsedSize_(JKRExpHeap* expHeap)
|
||||
{
|
||||
static s32 getUsedSize_(JKRExpHeap* expHeap) {
|
||||
// s32 totalFreeSize = expHeap->getTotalFreeSize();
|
||||
return expHeap->mSize - expHeap->getTotalFreeSize();
|
||||
}
|
||||
static u32 getState_(TState* state) { return getState_buf_(state); } // might instead be a pointer to a next state?
|
||||
static u32 getState_(TState* state) {
|
||||
return getState_buf_(state);
|
||||
} // might instead be a pointer to a next state?
|
||||
|
||||
private:
|
||||
private:
|
||||
// _00 = VTBL
|
||||
// _00-_6C = JKRHeap
|
||||
u8 mCurrentAllocMode; // _6C
|
||||
@@ -100,8 +127,7 @@ private:
|
||||
CMemBlock* mTailUsedList; // _84
|
||||
};
|
||||
|
||||
inline JKRExpHeap* JKRCreateExpHeap(u32 size, JKRHeap* parent, bool errorFlag)
|
||||
{
|
||||
inline JKRExpHeap* JKRCreateExpHeap(u32 size, JKRHeap* parent, bool errorFlag) {
|
||||
return JKRExpHeap::create(size, parent, errorFlag);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -10,25 +10,25 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
class JKRFile : public JKRDisposer {
|
||||
public:
|
||||
inline JKRFile()
|
||||
: JKRDisposer()
|
||||
, mFileOpen(false)
|
||||
{
|
||||
}
|
||||
public:
|
||||
inline JKRFile() : JKRDisposer(), mFileOpen(false) {
|
||||
}
|
||||
|
||||
virtual ~JKRFile() { }
|
||||
virtual bool open(const char* path) = 0;
|
||||
virtual bool close() = 0;
|
||||
virtual int readData(void* data, s32 length, s32 ofs) = 0;
|
||||
virtual int writeData(const void* data, s32 length, s32 ofs) = 0;
|
||||
virtual u32 getFileSize() const = 0;
|
||||
virtual ~JKRFile() {
|
||||
}
|
||||
virtual bool open(const char* path) = 0;
|
||||
virtual bool close() = 0;
|
||||
virtual int readData(void* data, s32 length, s32 ofs) = 0;
|
||||
virtual int writeData(const void* data, s32 length, s32 ofs) = 0;
|
||||
virtual u32 getFileSize() const = 0;
|
||||
|
||||
void read(void* data, s32 length, s32 ofs);
|
||||
bool isAvailable() { return this->mFileOpen; }
|
||||
void read(void* data, s32 length, s32 ofs);
|
||||
bool isAvailable() {
|
||||
return this->mFileOpen;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool mFileOpen;
|
||||
protected:
|
||||
bool mFileOpen;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -8,44 +8,40 @@
|
||||
#ifdef __cplusplus
|
||||
class JKRArchive;
|
||||
|
||||
struct JKRFileFinderBase
|
||||
{
|
||||
struct JKRFileFinderBase {
|
||||
char* mFileName; // _00
|
||||
int mFileIndex; // _04
|
||||
u16 mFileID; // _08
|
||||
u16 mFileTypeFlags; // _0A
|
||||
};
|
||||
|
||||
class JKRFileFinder
|
||||
{
|
||||
public:
|
||||
JKRFileFinder()
|
||||
: mIsAvailable(false), mIsDir(false)
|
||||
{
|
||||
class JKRFileFinder {
|
||||
public:
|
||||
JKRFileFinder() : mIsAvailable(false), mIsDir(false) {
|
||||
}
|
||||
|
||||
JKRFileFinderBase mBase;
|
||||
|
||||
virtual ~JKRFileFinder() {} // _08 (weak)
|
||||
virtual ~JKRFileFinder() {
|
||||
} // _08 (weak)
|
||||
virtual bool findNextFile() = 0; // _0C
|
||||
|
||||
bool isAvailable() const
|
||||
{
|
||||
bool isAvailable() const {
|
||||
return mIsAvailable;
|
||||
}
|
||||
|
||||
// _00 = VTBL
|
||||
|
||||
bool mIsAvailable; // _10
|
||||
bool mIsDir; // _11
|
||||
bool mIsDir; // _11
|
||||
};
|
||||
|
||||
class JKRArcFinder : public JKRFileFinder
|
||||
{
|
||||
public:
|
||||
class JKRArcFinder : public JKRFileFinder {
|
||||
public:
|
||||
JKRArcFinder(JKRArchive*, long, long);
|
||||
|
||||
virtual ~JKRArcFinder() {} // _08 (weak)
|
||||
virtual ~JKRArcFinder() {
|
||||
} // _08 (weak)
|
||||
virtual bool findNextFile(); // _0C
|
||||
|
||||
// _00 = VTBL
|
||||
@@ -56,15 +52,13 @@ public:
|
||||
long mNextIndex; // _20
|
||||
};
|
||||
|
||||
class JKRDvdFinder : public JKRFileFinder
|
||||
{
|
||||
public:
|
||||
class JKRDvdFinder : public JKRFileFinder {
|
||||
public:
|
||||
JKRDvdFinder(const char*);
|
||||
|
||||
virtual ~JKRDvdFinder() // _08 (weak)
|
||||
{
|
||||
if (mIsDvdOpen)
|
||||
{
|
||||
if (mIsDvdOpen) {
|
||||
DVDCloseDir(&mDir);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,27 +7,31 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
class JKRFileFinder;
|
||||
class JKRFileLoader : public JKRDisposer
|
||||
{
|
||||
public:
|
||||
class JKRFileLoader : public JKRDisposer {
|
||||
public:
|
||||
JKRFileLoader();
|
||||
|
||||
virtual ~JKRFileLoader(); // _08
|
||||
virtual void unmount(); // _0C
|
||||
virtual bool becomeCurrent(const char*) = 0; // _10
|
||||
virtual void* getResource(const char* path) = 0; // _14
|
||||
virtual void* getResource(u32 type, const char* name) = 0; // _18
|
||||
virtual size_t readResource(void* resourceBuffer, u32 bufferSize, const char* path, JKRExpandSwitch expandSwitch) = 0; // _1C
|
||||
virtual size_t readResource(void* resourceBuffer, u32 bufferSize, u32 type, const char* name) = 0; // _20
|
||||
virtual void removeResourceAll() = 0; // _24
|
||||
virtual bool removeResource(void*) = 0; // _28
|
||||
virtual bool detachResource(void*) = 0; // _2C
|
||||
virtual long getResSize(const void*) const = 0; // _30
|
||||
virtual u32 countFile(const char*) const = 0; // _34
|
||||
virtual JKRFileFinder* getFirstFile(const char*) const = 0; // _38
|
||||
virtual ~JKRFileLoader(); // _08
|
||||
virtual void unmount(); // _0C
|
||||
virtual bool becomeCurrent(const char*) = 0; // _10
|
||||
virtual void* getResource(const char* path) = 0; // _14
|
||||
virtual void* getResource(u32 type, const char* name) = 0; // _18
|
||||
virtual size_t readResource(void* resourceBuffer, u32 bufferSize, const char* path,
|
||||
JKRExpandSwitch expandSwitch) = 0; // _1C
|
||||
virtual size_t readResource(void* resourceBuffer, u32 bufferSize, u32 type, const char* name) = 0; // _20
|
||||
virtual void removeResourceAll() = 0; // _24
|
||||
virtual bool removeResource(void*) = 0; // _28
|
||||
virtual bool detachResource(void*) = 0; // _2C
|
||||
virtual long getResSize(const void*) const = 0; // _30
|
||||
virtual u32 countFile(const char*) const = 0; // _34
|
||||
virtual JKRFileFinder* getFirstFile(const char*) const = 0; // _38
|
||||
|
||||
bool isMounted() const { return mIsMounted; }
|
||||
u32 getVolumeType() const { return mVolumeType; }
|
||||
bool isMounted() const {
|
||||
return mIsMounted;
|
||||
}
|
||||
u32 getVolumeType() const {
|
||||
return mVolumeType;
|
||||
}
|
||||
|
||||
static void changeDirectory(const char* dir);
|
||||
|
||||
@@ -42,21 +46,26 @@ public:
|
||||
static JKRFileFinder* findFirstFile(const char*);
|
||||
static const char* fetchVolumeName(char*, long, const char*);
|
||||
|
||||
static JKRFileLoader* getCurrentVolume() { return sCurrentVolume; }
|
||||
static void setCurrentVolume(JKRFileLoader* fileLoader) { sCurrentVolume = fileLoader; }
|
||||
static JSUList<JKRFileLoader>& getVolumeList() { return sVolumeList; }
|
||||
static JKRFileLoader* getCurrentVolume() {
|
||||
return sCurrentVolume;
|
||||
}
|
||||
static void setCurrentVolume(JKRFileLoader* fileLoader) {
|
||||
sCurrentVolume = fileLoader;
|
||||
}
|
||||
static JSUList<JKRFileLoader>& getVolumeList() {
|
||||
return sVolumeList;
|
||||
}
|
||||
|
||||
static JKRFileLoader* sCurrentVolume;
|
||||
static JSUList<JKRFileLoader> sVolumeList;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
/* 0x00 */ // vtable
|
||||
/* 0x04 */ // JKRDisposer
|
||||
JSULink<JKRFileLoader> mFileLoaderLink; // 0x18
|
||||
const char* mVolumeName; // 0x28
|
||||
u32 mVolumeType; // 0x2C
|
||||
bool mIsMounted; // 0x30
|
||||
u8 field_0x31[3]; // 0x31
|
||||
u32 mMountCount; // 0x34
|
||||
};
|
||||
|
||||
|
||||
@@ -9,31 +9,24 @@
|
||||
#ifdef __cplusplus
|
||||
typedef void JKRHeapErrorHandler(void*, u32, int);
|
||||
|
||||
class JKRHeap : public JKRDisposer
|
||||
{
|
||||
public:
|
||||
enum EAllocMode
|
||||
{
|
||||
class JKRHeap : public JKRDisposer {
|
||||
public:
|
||||
enum EAllocMode {
|
||||
HEAPALLOC_Unk1 = 1,
|
||||
};
|
||||
|
||||
struct TState
|
||||
{ // NB: this struct doesn't agree with TP's struct
|
||||
struct TLocation
|
||||
{
|
||||
TLocation() : _00(nullptr), _04(-1)
|
||||
{
|
||||
struct TState { // NB: this struct doesn't agree with TP's struct
|
||||
struct TLocation {
|
||||
TLocation() : _00(nullptr), _04(-1) {
|
||||
}
|
||||
|
||||
void* _00; // _00
|
||||
int _04; // _04
|
||||
};
|
||||
|
||||
struct TArgument
|
||||
{
|
||||
struct TArgument {
|
||||
TArgument(const JKRHeap* heap, u32 p2, bool p3)
|
||||
: mHeap((heap) ? heap : JKRHeap::sCurrentHeap), mId(p2), mIsCompareOnDestructed(p3)
|
||||
{
|
||||
: mHeap((heap) ? heap : JKRHeap::sCurrentHeap), mId(p2), mIsCompareOnDestructed(p3) {
|
||||
}
|
||||
|
||||
const JKRHeap* mHeap; // _00
|
||||
@@ -42,24 +35,35 @@ public:
|
||||
};
|
||||
|
||||
TState(const JKRHeap* heap, u32 id, bool isCompareOnDestructed)
|
||||
: mUsedSize(0), mCheckCode(0), mArgument(heap, id, isCompareOnDestructed)
|
||||
{
|
||||
: mUsedSize(0), mCheckCode(0), mArgument(heap, id, isCompareOnDestructed) {
|
||||
mArgument.mHeap->state_register(this, mArgument.mId);
|
||||
}
|
||||
|
||||
TState(JKRHeap* heap)
|
||||
: mUsedSize(0), mCheckCode(0), mArgument(heap, 0xFFFFFFFF, true)
|
||||
{
|
||||
TState(JKRHeap* heap) : mUsedSize(0), mCheckCode(0), mArgument(heap, 0xFFFFFFFF, true) {
|
||||
}
|
||||
|
||||
~TState();
|
||||
void dump() const { mArgument.mHeap->state_dump(*this); }
|
||||
bool isVerbose() { return bVerbose_; };
|
||||
bool isCompareOnDestructed() const { return mArgument.mIsCompareOnDestructed; };
|
||||
u32 getUsedSize() const { return mUsedSize; }
|
||||
u32 getCheckCode() const { return mCheckCode; }
|
||||
const JKRHeap* getHeap() const { return mArgument.mHeap; }
|
||||
u32 getId() const { return mArgument.mId; }
|
||||
void dump() const {
|
||||
mArgument.mHeap->state_dump(*this);
|
||||
}
|
||||
bool isVerbose() {
|
||||
return bVerbose_;
|
||||
};
|
||||
bool isCompareOnDestructed() const {
|
||||
return mArgument.mIsCompareOnDestructed;
|
||||
};
|
||||
u32 getUsedSize() const {
|
||||
return mUsedSize;
|
||||
}
|
||||
u32 getCheckCode() const {
|
||||
return mCheckCode;
|
||||
}
|
||||
const JKRHeap* getHeap() const {
|
||||
return mArgument.mHeap;
|
||||
}
|
||||
u32 getId() const {
|
||||
return mArgument.mId;
|
||||
}
|
||||
|
||||
// unused/inlined:
|
||||
TState(const JKRHeap::TState::TArgument& arg, const JKRHeap::TState::TLocation& location);
|
||||
@@ -76,7 +80,7 @@ public:
|
||||
TLocation mLocation; // _1C
|
||||
};
|
||||
|
||||
public:
|
||||
public:
|
||||
JKRHeap(void*, u32, JKRHeap*, bool);
|
||||
|
||||
bool setErrorFlag(bool errorFlag);
|
||||
@@ -94,10 +98,16 @@ public:
|
||||
virtual s32 do_getTotalFreeSize() = 0;
|
||||
virtual u32 getHeapType() = 0;
|
||||
virtual bool check() = 0;
|
||||
virtual bool dump_sort() { return true; }
|
||||
virtual bool dump_sort() {
|
||||
return true;
|
||||
}
|
||||
virtual bool dump() = 0;
|
||||
virtual s32 do_changeGroupID(u8 newGroupID) { return 0; }
|
||||
virtual u8 do_getCurrentGroupId() { return 0; }
|
||||
virtual s32 do_changeGroupID(u8 newGroupID) {
|
||||
return 0;
|
||||
}
|
||||
virtual u8 do_getCurrentGroupId() {
|
||||
return 0;
|
||||
}
|
||||
virtual void state_register(JKRHeap::TState*, u32) const;
|
||||
virtual bool state_compare(JKRHeap::TState const&, JKRHeap::TState const&) const;
|
||||
virtual void state_dump(JKRHeap::TState const&) const;
|
||||
@@ -125,56 +135,68 @@ public:
|
||||
JKRHeap* find(void*) const; // 0x80084640
|
||||
JKRHeap* findAllHeap(void*) const; // 0x8008492c
|
||||
void dispose_subroutine(u32 begin, u32 end);
|
||||
bool dispose(void*, u32); // 0x80084b9c
|
||||
bool dispose(void*, u32); // 0x80084b9c
|
||||
void dispose(void*, void*); // 0x80084c2c
|
||||
void dispose(); // 0x80084cb8
|
||||
void dispose(); // 0x80084cb8
|
||||
|
||||
void appendDisposer(JKRDisposer* disposer)
|
||||
{
|
||||
void appendDisposer(JKRDisposer* disposer) {
|
||||
mDisposerList.append(&disposer->mPointerLinks);
|
||||
}
|
||||
|
||||
void removeDisposer(JKRDisposer* disposer)
|
||||
{
|
||||
void removeDisposer(JKRDisposer* disposer) {
|
||||
mDisposerList.remove(&disposer->mPointerLinks);
|
||||
}
|
||||
|
||||
void setDebugFill(bool debugFill) { mDebugFill = debugFill; }
|
||||
bool getDebugFill() const { return mDebugFill; }
|
||||
void* getStartAddr() const { return (void*)mStart; }
|
||||
void* getEndAddr() const { return (void*)mEnd; }
|
||||
u32 getHeapSize() const { return mSize; }
|
||||
bool getErrorFlag() const { return mErrorFlag; }
|
||||
void callErrorHandler(JKRHeap* heap, u32 size, int alignment)
|
||||
{
|
||||
if (mErrorHandler)
|
||||
{
|
||||
void setDebugFill(bool debugFill) {
|
||||
mDebugFill = debugFill;
|
||||
}
|
||||
bool getDebugFill() const {
|
||||
return mDebugFill;
|
||||
}
|
||||
void* getStartAddr() const {
|
||||
return (void*)mStart;
|
||||
}
|
||||
void* getEndAddr() const {
|
||||
return (void*)mEnd;
|
||||
}
|
||||
u32 getHeapSize() const {
|
||||
return mSize;
|
||||
}
|
||||
bool getErrorFlag() const {
|
||||
return mErrorFlag;
|
||||
}
|
||||
void callErrorHandler(JKRHeap* heap, u32 size, int alignment) {
|
||||
if (mErrorHandler) {
|
||||
(*mErrorHandler)(heap, size, alignment);
|
||||
}
|
||||
}
|
||||
|
||||
// TState related
|
||||
static u32 getState_buf_(TState* state) { return state->mBuf; } // might instead be a pointer to a next state?
|
||||
static void setState_u32ID_(TState* state, u32 id)
|
||||
{
|
||||
static u32 getState_buf_(TState* state) {
|
||||
return state->mBuf;
|
||||
} // might instead be a pointer to a next state?
|
||||
static void setState_u32ID_(TState* state, u32 id) {
|
||||
state->mArgument.mId = id;
|
||||
}
|
||||
static void setState_uUsedSize_(TState* state, u32 usedSize)
|
||||
{
|
||||
static void setState_uUsedSize_(TState* state, u32 usedSize) {
|
||||
state->mUsedSize = usedSize;
|
||||
}
|
||||
static void setState_u32CheckCode_(TState* state, u32 checkCode) { state->mCheckCode = checkCode; }
|
||||
static void setState_u32CheckCode_(TState* state, u32 checkCode) {
|
||||
state->mCheckCode = checkCode;
|
||||
}
|
||||
|
||||
void lock() const { OSLockMutex(const_cast<OSMutex*>(&mMutex)); }
|
||||
void unlock() const { OSUnlockMutex(const_cast<OSMutex*>(&mMutex)); }
|
||||
void lock() const {
|
||||
OSLockMutex(const_cast<OSMutex*>(&mMutex));
|
||||
}
|
||||
void unlock() const {
|
||||
OSUnlockMutex(const_cast<OSMutex*>(&mMutex));
|
||||
}
|
||||
|
||||
JKRHeap* getParent()
|
||||
{
|
||||
JKRHeap* getParent() {
|
||||
return mChildTree.getParent()->getObject();
|
||||
}
|
||||
|
||||
const JSUTree<JKRHeap>& getHeapTree()
|
||||
{
|
||||
const JSUTree<JKRHeap>& getHeapTree() {
|
||||
return mChildTree;
|
||||
}
|
||||
|
||||
@@ -190,43 +212,35 @@ public:
|
||||
static JKRHeap* findFromRoot(void*);
|
||||
static JKRHeapErrorHandler* setErrorHandler(JKRHeapErrorHandler*);
|
||||
|
||||
static void* getCodeStart()
|
||||
{
|
||||
static void* getCodeStart() {
|
||||
return mCodeStart;
|
||||
}
|
||||
|
||||
static void* getCodeEnd()
|
||||
{
|
||||
static void* getCodeEnd() {
|
||||
return mCodeEnd;
|
||||
}
|
||||
|
||||
static void* getUserRamStart()
|
||||
{
|
||||
static void* getUserRamStart() {
|
||||
return mUserRamStart;
|
||||
}
|
||||
|
||||
static void* getUserRamEnd()
|
||||
{
|
||||
static void* getUserRamEnd() {
|
||||
return mUserRamEnd;
|
||||
}
|
||||
|
||||
static u32 getMemorySize()
|
||||
{
|
||||
static u32 getMemorySize() {
|
||||
return mMemorySize;
|
||||
}
|
||||
|
||||
static JKRHeap* getCurrentHeap()
|
||||
{
|
||||
static JKRHeap* getCurrentHeap() {
|
||||
return sCurrentHeap;
|
||||
}
|
||||
|
||||
static JKRHeap* getRootHeap()
|
||||
{
|
||||
static JKRHeap* getRootHeap() {
|
||||
return sRootHeap;
|
||||
}
|
||||
|
||||
static JKRHeap* getSystemHeap()
|
||||
{
|
||||
static JKRHeap* getSystemHeap() {
|
||||
return sSystemHeap;
|
||||
}
|
||||
|
||||
@@ -245,7 +259,7 @@ public:
|
||||
|
||||
static JKRHeapErrorHandler* mErrorHandler;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
/* 0x00 */ // vtable
|
||||
/* 0x04 */ // JKRDisposer
|
||||
/* 0x18 */ OSMutex mMutex;
|
||||
@@ -263,43 +277,35 @@ protected:
|
||||
/* 0x6A */ u8 padding_0x6a[2];
|
||||
};
|
||||
|
||||
inline JKRHeap* JKRGetCurrentHeap()
|
||||
{
|
||||
inline JKRHeap* JKRGetCurrentHeap() {
|
||||
return JKRHeap::getCurrentHeap();
|
||||
}
|
||||
|
||||
inline JKRHeap* JKRGetSystemHeap()
|
||||
{
|
||||
inline JKRHeap* JKRGetSystemHeap() {
|
||||
return JKRHeap::getSystemHeap();
|
||||
}
|
||||
|
||||
inline JKRHeap* JKRGetRootHeap()
|
||||
{
|
||||
inline JKRHeap* JKRGetRootHeap() {
|
||||
return JKRHeap::getRootHeap();
|
||||
}
|
||||
|
||||
inline void* JKRAllocFromSysHeap(u32 size, int alignment)
|
||||
{
|
||||
inline void* JKRAllocFromSysHeap(u32 size, int alignment) {
|
||||
return JKRHeap::getSystemHeap()->alloc(size, alignment);
|
||||
}
|
||||
|
||||
inline void* JKRAllocFromHeap(JKRHeap* heap, u32 size, int alignment)
|
||||
{
|
||||
inline void* JKRAllocFromHeap(JKRHeap* heap, u32 size, int alignment) {
|
||||
return JKRHeap::alloc(size, alignment, heap);
|
||||
}
|
||||
|
||||
inline void JKRFree(void* pBuf)
|
||||
{
|
||||
inline void JKRFree(void* pBuf) {
|
||||
JKRHeap::free(pBuf, nullptr);
|
||||
}
|
||||
|
||||
inline void JKRFreeToHeap(JKRHeap* heap, void* ptr)
|
||||
{
|
||||
inline void JKRFreeToHeap(JKRHeap* heap, void* ptr) {
|
||||
JKRHeap::free(ptr, heap);
|
||||
}
|
||||
|
||||
inline void JKRFreeToSysHeap(void* buf)
|
||||
{
|
||||
inline void JKRFreeToSysHeap(void* buf) {
|
||||
JKRHeap::getSystemHeap()->free(buf);
|
||||
}
|
||||
|
||||
@@ -308,7 +314,9 @@ void JKRDefaultMemoryErrorRoutine(void*, u32, int);
|
||||
void* operator new(size_t);
|
||||
void* operator new(size_t, s32);
|
||||
void* operator new(size_t, JKRHeap*, int);
|
||||
inline void* operator new(size_t, void* buf) { return buf; } // i believe this is actually part of MSL_C?
|
||||
inline void* operator new(size_t, void* buf) {
|
||||
return buf;
|
||||
} // i believe this is actually part of MSL_C?
|
||||
|
||||
void* operator new[](size_t);
|
||||
void* operator new[](size_t, s32);
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
#define JKRMACRO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define JKR_ISALIGNED(addr, alignment) ((((u32)addr) & (((u32)alignment)-1)) == 0)
|
||||
#define JKR_ISALIGNED(addr, alignment) ((((u32)addr) & (((u32)alignment) - 1)) == 0)
|
||||
#define JKR_ISALIGNED32(addr) (JKR_ISALIGNED(addr, 32))
|
||||
|
||||
#define JKR_ISNOTALIGNED(addr, alignment) ((((u32)addr) & (((u32)alignment)-1)) != 0)
|
||||
#define JKR_ISNOTALIGNED(addr, alignment) ((((u32)addr) & (((u32)alignment) - 1)) != 0)
|
||||
#define JKR_ISNOTALIGNED32(addr) (JKR_ISNOTALIGNED(addr, 32))
|
||||
|
||||
#define JKR_ALIGN(addr, alignment) (((u32)addr) & (~(((u32)alignment)-1)))
|
||||
#define JKR_ALIGN(addr, alignment) (((u32)addr) & (~(((u32)alignment) - 1)))
|
||||
#define JKR_ALIGN32(addr) (JKR_ALIGN(addr, 32))
|
||||
#endif
|
||||
|
||||
|
||||
+133
-124
@@ -12,169 +12,178 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
struct JKRThread;
|
||||
//class JUTConsole;
|
||||
// class JUTConsole;
|
||||
|
||||
struct JKRThreadName_
|
||||
{
|
||||
s32 id;
|
||||
char* name;
|
||||
struct JKRThreadName_ {
|
||||
s32 id;
|
||||
char* name;
|
||||
};
|
||||
|
||||
typedef void (*JKRThreadSwitch_PreCallback)(OSThread* current, OSThread* next);
|
||||
typedef void (*JKRThreadSwitch_PostCallback)(OSThread* current, OSThread* next);
|
||||
|
||||
class JKRThreadSwitch
|
||||
{
|
||||
public:
|
||||
JKRThreadSwitch(JKRHeap*);
|
||||
virtual void draw(JKRThreadName_* param_1, JUTConsole* param_2);
|
||||
virtual void draw(JKRThreadName_* param_1);
|
||||
virtual ~JKRThreadSwitch();
|
||||
class JKRThreadSwitch {
|
||||
public:
|
||||
JKRThreadSwitch(JKRHeap*);
|
||||
virtual void draw(JKRThreadName_* param_1, JUTConsole* param_2);
|
||||
virtual void draw(JKRThreadName_* param_1);
|
||||
virtual ~JKRThreadSwitch();
|
||||
|
||||
static JKRThreadSwitch* createManager(JKRHeap* heap);
|
||||
static JKRThreadSwitch* createManager(JKRHeap* heap);
|
||||
|
||||
JKRThread* enter(JKRThread* param_1, int param_2);
|
||||
static void callback(OSThread* param_1, OSThread* param_2);
|
||||
JKRThread* enter(JKRThread* param_1, int param_2);
|
||||
static void callback(OSThread* param_1, OSThread* param_2);
|
||||
|
||||
static u32 getTotalCount() { return sTotalCount; }
|
||||
static u32 getTotalCount() {
|
||||
return sTotalCount;
|
||||
}
|
||||
|
||||
private:
|
||||
static JKRThreadSwitch* sManager;
|
||||
static u32 sTotalCount;
|
||||
static u64 sTotalStart;
|
||||
static JKRThreadSwitch_PreCallback mUserPreCallback;
|
||||
static JKRThreadSwitch_PostCallback mUserPostCallback;
|
||||
private:
|
||||
static JKRThreadSwitch* sManager;
|
||||
static u32 sTotalCount;
|
||||
static u64 sTotalStart;
|
||||
static JKRThreadSwitch_PreCallback mUserPreCallback;
|
||||
static JKRThreadSwitch_PostCallback mUserPostCallback;
|
||||
|
||||
private:
|
||||
JKRHeap* mHeap; // _04
|
||||
bool mSetNextHeap; // _08
|
||||
u8 _09[3]; // _09, padding?
|
||||
u32 _0C; // _0C
|
||||
u32 _10; // _10
|
||||
u8 _14[4]; // _14 - unknown/padding
|
||||
s64 _18; // _18
|
||||
JUTConsole* mConsole; // _20
|
||||
JKRThreadName_* mThreadName; // _24
|
||||
private:
|
||||
JKRHeap* mHeap; // _04
|
||||
bool mSetNextHeap; // _08
|
||||
u8 _09[3]; // _09, padding?
|
||||
u32 _0C; // _0C
|
||||
u32 _10; // _10
|
||||
u8 _14[4]; // _14 - unknown/padding
|
||||
s64 _18; // _18
|
||||
JUTConsole* mConsole; // _20
|
||||
JKRThreadName_* mThreadName; // _24
|
||||
};
|
||||
|
||||
class JKRThread : public JKRDisposer {
|
||||
public:
|
||||
JKRThread(u32 stackSize, int msgCount, int threadPrio);
|
||||
JKRThread(OSThread* osThread, int msgCount);
|
||||
public:
|
||||
JKRThread(u32 stackSize, int msgCount, int threadPrio);
|
||||
JKRThread(OSThread* osThread, int msgCount);
|
||||
|
||||
virtual ~JKRThread();
|
||||
virtual void* run() { return nullptr; }
|
||||
|
||||
static void* start(void* param);
|
||||
static JSUList<JKRThread>* getList() { return &JKRThread::sThreadList; }
|
||||
|
||||
OSThread* getThreadRecord() const { return this->mThreadRecord; }
|
||||
void* getStack() const { return this->mStackMemory; }
|
||||
|
||||
void resume() { OSResumeThread(this->mThreadRecord); }
|
||||
void jamMessageBlock(OSMessage msg) { OSJamMessage(&this->mMesgQueue, msg, OS_MESSAGE_BLOCK); }
|
||||
void sendMessage(OSMessage msg) { OSSendMessage(&this->mMesgQueue, msg, OS_MESSAGE_NOBLOCK); }
|
||||
|
||||
OSMessage waitMessage(int* received) {
|
||||
OSMessage mesg;
|
||||
BOOL retrieved = OSReceiveMessage(&this->mMesgQueue, &mesg, OS_MESSAGE_NOBLOCK);
|
||||
if (received != nullptr) {
|
||||
*received = retrieved;
|
||||
virtual ~JKRThread();
|
||||
virtual void* run() {
|
||||
return nullptr;
|
||||
}
|
||||
return mesg;
|
||||
}
|
||||
|
||||
OSMessage waitMeessageBlock() {
|
||||
OSMessage mesg;
|
||||
OSReceiveMessage(&this->mMesgQueue, &mesg, OS_MESSAGE_BLOCK);
|
||||
return mesg;
|
||||
}
|
||||
static void* start(void* param);
|
||||
static JSUList<JKRThread>* getList() {
|
||||
return &JKRThread::sThreadList;
|
||||
}
|
||||
|
||||
static JSUList<JKRThread> sThreadList;
|
||||
OSThread* getThreadRecord() const {
|
||||
return this->mThreadRecord;
|
||||
}
|
||||
void* getStack() const {
|
||||
return this->mStackMemory;
|
||||
}
|
||||
|
||||
protected:
|
||||
JSULink<JKRThread> mLink;
|
||||
JKRHeap* mHeap;
|
||||
OSThread* mThreadRecord;
|
||||
OSMessageQueue mMesgQueue;
|
||||
OSMessage* mMesgBuffer;
|
||||
int mMesgCount;
|
||||
void* mStackMemory;
|
||||
u32 mStackSize;
|
||||
void resume() {
|
||||
OSResumeThread(this->mThreadRecord);
|
||||
}
|
||||
void jamMessageBlock(OSMessage msg) {
|
||||
OSJamMessage(&this->mMesgQueue, msg, OS_MESSAGE_BLOCK);
|
||||
}
|
||||
void sendMessage(OSMessage msg) {
|
||||
OSSendMessage(&this->mMesgQueue, msg, OS_MESSAGE_NOBLOCK);
|
||||
}
|
||||
|
||||
OSMessage waitMessage(int* received) {
|
||||
OSMessage mesg;
|
||||
BOOL retrieved = OSReceiveMessage(&this->mMesgQueue, &mesg, OS_MESSAGE_NOBLOCK);
|
||||
if (received != nullptr) {
|
||||
*received = retrieved;
|
||||
}
|
||||
return mesg;
|
||||
}
|
||||
|
||||
OSMessage waitMeessageBlock() {
|
||||
OSMessage mesg;
|
||||
OSReceiveMessage(&this->mMesgQueue, &mesg, OS_MESSAGE_BLOCK);
|
||||
return mesg;
|
||||
}
|
||||
|
||||
static JSUList<JKRThread> sThreadList;
|
||||
|
||||
protected:
|
||||
JSULink<JKRThread> mLink;
|
||||
JKRHeap* mHeap;
|
||||
OSThread* mThreadRecord;
|
||||
OSMessageQueue mMesgQueue;
|
||||
OSMessage* mMesgBuffer;
|
||||
int mMesgCount;
|
||||
void* mStackMemory;
|
||||
u32 mStackSize;
|
||||
};
|
||||
|
||||
// Unused class, function definitions from Sunshine and MKDD
|
||||
class JKRTask : public JKRThread
|
||||
{
|
||||
typedef void (*RequestCallback)(void*);
|
||||
class JKRTask : public JKRThread {
|
||||
typedef void (*RequestCallback)(void*);
|
||||
|
||||
/**
|
||||
* @fabricated
|
||||
* @size{0xC}
|
||||
*/
|
||||
struct Request
|
||||
{
|
||||
RequestCallback mCb;
|
||||
void* mArg;
|
||||
void* mMsg;
|
||||
};
|
||||
/**
|
||||
* @fabricated
|
||||
* @size{0xC}
|
||||
*/
|
||||
struct Request {
|
||||
RequestCallback mCb;
|
||||
void* mArg;
|
||||
void* mMsg;
|
||||
};
|
||||
|
||||
JKRTask(); // unused/inlined
|
||||
JKRTask(); // unused/inlined
|
||||
|
||||
virtual ~JKRTask(); // _08
|
||||
virtual void* run(); // _0C
|
||||
virtual ~JKRTask(); // _08
|
||||
virtual void* run(); // _0C
|
||||
|
||||
bool request(RequestCallback, void*, void*);
|
||||
bool request(RequestCallback, void*, void*);
|
||||
|
||||
static JKRTask* create();
|
||||
static JKRTask* create();
|
||||
|
||||
// unused/inlined:
|
||||
Request* searchBlank();
|
||||
void requestJam(RequestCallback, void*, void*);
|
||||
void cancelAll();
|
||||
void createTaskEndMessageQueue(int, JKRHeap*);
|
||||
void destroyTaskEndMessageQueue();
|
||||
void waitQueueMessageBlock(OSMessageQueue*, int*);
|
||||
void waitQueueMessage(OSMessageQueue*, int*);
|
||||
// unused/inlined:
|
||||
Request* searchBlank();
|
||||
void requestJam(RequestCallback, void*, void*);
|
||||
void cancelAll();
|
||||
void createTaskEndMessageQueue(int, JKRHeap*);
|
||||
void destroyTaskEndMessageQueue();
|
||||
void waitQueueMessageBlock(OSMessageQueue*, int*);
|
||||
void waitQueueMessage(OSMessageQueue*, int*);
|
||||
|
||||
OSMessage waitMessageBlock()
|
||||
{
|
||||
OSMessage msg;
|
||||
OSReceiveMessage(&mMesgQueue, &msg, OS_MESSAGE_BLOCK);
|
||||
return msg;
|
||||
}
|
||||
OSMessage waitMessageBlock() {
|
||||
OSMessage msg;
|
||||
OSReceiveMessage(&mMesgQueue, &msg, OS_MESSAGE_BLOCK);
|
||||
return msg;
|
||||
}
|
||||
|
||||
void destroy();
|
||||
void destroy();
|
||||
|
||||
// Unused
|
||||
static OSMessage* sEndMesgBuffer;
|
||||
static u32 sEndMesgBufSize;
|
||||
// Unused
|
||||
static OSMessage* sEndMesgBuffer;
|
||||
static u32 sEndMesgBufSize;
|
||||
|
||||
// u32 _78; // _78
|
||||
//JSULink<JKRTask> mTaskLink; // _7C, this didn't exist yet
|
||||
Request* mRequest; // _8C - ptr to request array
|
||||
u32 mRequestCnt; // _90 - amount of requests
|
||||
OSMessageQueue* mTaskMsgQueue; // _94
|
||||
// u32 _78; // _78
|
||||
// JSULink<JKRTask> mTaskLink; // _7C, this didn't exist yet
|
||||
Request* mRequest; // _8C - ptr to request array
|
||||
u32 mRequestCnt; // _90 - amount of requests
|
||||
OSMessageQueue* mTaskMsgQueue; // _94
|
||||
|
||||
static JSUList<JKRTask> sTaskList;
|
||||
static u8 sEndMesgQueue[32]; // Unused
|
||||
static JSUList<JKRTask> sTaskList;
|
||||
static u8 sEndMesgQueue[32]; // Unused
|
||||
};
|
||||
|
||||
/** @unused */
|
||||
struct JKRIdleThread : public JKRThread
|
||||
{
|
||||
virtual ~JKRIdleThread() {}; // _08
|
||||
virtual void* run() // _0C
|
||||
{
|
||||
while (true)
|
||||
struct JKRIdleThread : public JKRThread {
|
||||
virtual ~JKRIdleThread() {}; // _08
|
||||
virtual void* run() // _0C
|
||||
{
|
||||
}
|
||||
};
|
||||
virtual void destroy() {} // 0x10
|
||||
while (true) {}
|
||||
};
|
||||
virtual void destroy() {
|
||||
} // 0x10
|
||||
|
||||
static void create(JKRHeap*, int, u32);
|
||||
static void create(JKRHeap*, int, u32);
|
||||
|
||||
static JKRIdleThread* sThread;
|
||||
static JKRIdleThread* sThread;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#ifdef JSYSTEM_DEBUG
|
||||
#define JPANICLINE(line) ()
|
||||
#define JPANIC(line, msg) () /* TODO: JUTException */
|
||||
#define JPANIC(line, msg) () /* TODO: JUTException */
|
||||
#define JPANICF(line, msg, ...) () /* TODO: JUTException */
|
||||
#else
|
||||
#define JPANICLINE(line) (OSErrorLine(line, "Abort."))
|
||||
|
||||
@@ -3,7 +3,11 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
inline u8 JSULoByte(u16 in) { return in & 0xff; }
|
||||
inline u8 JSUHiByte(u16 in) { return in >> 8; }
|
||||
inline u8 JSULoByte(u16 in) {
|
||||
return in & 0xff;
|
||||
}
|
||||
inline u8 JSUHiByte(u16 in) {
|
||||
return in >> 8;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -7,22 +7,32 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
class JSUFileInputStream : public JSURandomInputStream {
|
||||
public:
|
||||
JSUFileInputStream(JKRFile* file);
|
||||
public:
|
||||
JSUFileInputStream(JKRFile* file);
|
||||
|
||||
virtual int readData(void* buf, s32 len);
|
||||
virtual int getLength() const { return ((JKRFile*)this->mObject)->getFileSize(); }
|
||||
virtual int getPosition() const { return this->mPosition; }
|
||||
virtual int seekPos(s32 offset, JSUStreamSeekFrom from);
|
||||
virtual int readData(void* buf, s32 len);
|
||||
virtual int getLength() const {
|
||||
return ((JKRFile*)this->mObject)->getFileSize();
|
||||
}
|
||||
virtual int getPosition() const {
|
||||
return this->mPosition;
|
||||
}
|
||||
virtual int seekPos(s32 offset, JSUStreamSeekFrom from);
|
||||
|
||||
/* These two functions are shown in the symbol map, but are unused. */
|
||||
// bool open(const char* path);
|
||||
// bool close();
|
||||
|
||||
protected:
|
||||
const void* mObject;
|
||||
s32 mPosition;
|
||||
/* These two functions are shown in the symbol map, but are unused. */
|
||||
// bool open(const char* path);
|
||||
// bool close();
|
||||
|
||||
protected:
|
||||
const void* mObject;
|
||||
s32 mPosition;
|
||||
};
|
||||
|
||||
class JSUFileOutputStream : public JSURandomOutputStream {
|
||||
public:
|
||||
JSUFileOutputStream(JKRFile*);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,107 +6,134 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
class JSUInputStream : public JSUIosBase {
|
||||
public:
|
||||
virtual ~JSUInputStream();
|
||||
virtual int getAvailable() const = 0;
|
||||
virtual int skip(s32 amount);
|
||||
virtual int readData(void* buf, s32 size) = 0;
|
||||
public:
|
||||
virtual ~JSUInputStream();
|
||||
virtual int getAvailable() const = 0;
|
||||
virtual int skip(s32 amount);
|
||||
virtual int readData(void* buf, s32 size) = 0;
|
||||
|
||||
int read(void* buf, s32 size);
|
||||
char* read(char* buf);
|
||||
char* readString();
|
||||
char* readString(char* buf, u16 len);
|
||||
int read(void* buf, s32 size);
|
||||
char* read(char* buf);
|
||||
char* readString();
|
||||
char* readString(char* buf, u16 len);
|
||||
|
||||
int read(s8& p) { return this->read(&p, sizeof(s8)); } /* @fabricated */
|
||||
int read(u8& p) { return this->read(&p, sizeof(u8)); }
|
||||
int read(bool& p) { return this->read(&p, sizeof(bool)); }
|
||||
int read(s16& p) { return this->read(&p, sizeof(s16)); } /* @fabricated */
|
||||
int read(u16& p) { return this->read(&p, sizeof(u16)); } /* @fabricated */
|
||||
int read(s32& p) { return this->read(&p, sizeof(s32)); } /* @fabricated */
|
||||
int read(u32& p) { return this->read(&p, sizeof(u32)); }
|
||||
int read(s64& p) { return this->read(&p, sizeof(s64)); } /* @fabricated */
|
||||
int read(u64& p) { return this->read(&p, sizeof(u64)); } /* @fabricated */
|
||||
int read(s8& p) {
|
||||
return this->read(&p, sizeof(s8));
|
||||
} /* @fabricated */
|
||||
int read(u8& p) {
|
||||
return this->read(&p, sizeof(u8));
|
||||
}
|
||||
int read(bool& p) {
|
||||
return this->read(&p, sizeof(bool));
|
||||
}
|
||||
int read(s16& p) {
|
||||
return this->read(&p, sizeof(s16));
|
||||
} /* @fabricated */
|
||||
int read(u16& p) {
|
||||
return this->read(&p, sizeof(u16));
|
||||
} /* @fabricated */
|
||||
int read(s32& p) {
|
||||
return this->read(&p, sizeof(s32));
|
||||
} /* @fabricated */
|
||||
int read(u32& p) {
|
||||
return this->read(&p, sizeof(u32));
|
||||
}
|
||||
int read(s64& p) {
|
||||
return this->read(&p, sizeof(s64));
|
||||
} /* @fabricated */
|
||||
int read(u64& p) {
|
||||
return this->read(&p, sizeof(u64));
|
||||
} /* @fabricated */
|
||||
|
||||
u8 read8b() {
|
||||
u8 b;
|
||||
this->read(&b, sizeof(u8));
|
||||
return b;
|
||||
}
|
||||
u8 read8b() {
|
||||
u8 b;
|
||||
this->read(&b, sizeof(u8));
|
||||
return b;
|
||||
}
|
||||
|
||||
u16 read16b() {
|
||||
u16 s;
|
||||
this->read(&s, sizeof(u16));
|
||||
return s;
|
||||
}
|
||||
u16 read16b() {
|
||||
u16 s;
|
||||
this->read(&s, sizeof(u16));
|
||||
return s;
|
||||
}
|
||||
|
||||
u32 read32b() {
|
||||
u32 i;
|
||||
this->read(&i, sizeof(u32));
|
||||
return i;
|
||||
}
|
||||
u32 read32b() {
|
||||
u32 i;
|
||||
this->read(&i, sizeof(u32));
|
||||
return i;
|
||||
}
|
||||
|
||||
/* @fabricated */
|
||||
s8 readS8() {
|
||||
s8 b;
|
||||
this->read(&b, sizeof(s8));
|
||||
return b;
|
||||
}
|
||||
/* @fabricated */
|
||||
s8 readS8() {
|
||||
s8 b;
|
||||
this->read(&b, sizeof(s8));
|
||||
return b;
|
||||
}
|
||||
|
||||
u8 readU8() {
|
||||
u8 b;
|
||||
this->read(&b, sizeof(u8));
|
||||
return b;
|
||||
}
|
||||
u8 readU8() {
|
||||
u8 b;
|
||||
this->read(&b, sizeof(u8));
|
||||
return b;
|
||||
}
|
||||
|
||||
s16 readS16() {
|
||||
s16 s;
|
||||
this->read(&s, sizeof(s16));
|
||||
return s;
|
||||
}
|
||||
s16 readS16() {
|
||||
s16 s;
|
||||
this->read(&s, sizeof(s16));
|
||||
return s;
|
||||
}
|
||||
|
||||
u16 readU16() {
|
||||
u16 s;
|
||||
this->read(&s, sizeof(u16));
|
||||
return s;
|
||||
}
|
||||
u16 readU16() {
|
||||
u16 s;
|
||||
this->read(&s, sizeof(u16));
|
||||
return s;
|
||||
}
|
||||
|
||||
s32 readS32() {
|
||||
s32 i;
|
||||
this->read(&i, sizeof(s32));
|
||||
return i;
|
||||
}
|
||||
s32 readS32() {
|
||||
s32 i;
|
||||
this->read(&i, sizeof(s32));
|
||||
return i;
|
||||
}
|
||||
|
||||
u32 readU32() {
|
||||
u32 i;
|
||||
this->read(&i, sizeof(u32));
|
||||
return i;
|
||||
}
|
||||
u32 readU32() {
|
||||
u32 i;
|
||||
this->read(&i, sizeof(u32));
|
||||
return i;
|
||||
}
|
||||
|
||||
JSUInputStream& operator>>(s8& p) {
|
||||
this->read(&p, sizeof(s8));
|
||||
return *this;
|
||||
}
|
||||
JSUInputStream& operator>>(s8& p) {
|
||||
this->read(&p, sizeof(s8));
|
||||
return *this;
|
||||
}
|
||||
|
||||
JSUInputStream& operator>>(u8& p) {
|
||||
this->read(&p, sizeof(u8));
|
||||
return *this;
|
||||
}
|
||||
JSUInputStream& operator>>(u8& p) {
|
||||
this->read(&p, sizeof(u8));
|
||||
return *this;
|
||||
}
|
||||
|
||||
JSUInputStream& operator>>(s16& p) {
|
||||
this->read(&p, sizeof(s16));
|
||||
return *this;
|
||||
}
|
||||
JSUInputStream& operator>>(s16& p) {
|
||||
this->read(&p, sizeof(s16));
|
||||
return *this;
|
||||
}
|
||||
|
||||
JSUInputStream& operator>>(u16& p) {
|
||||
this->read(&p, sizeof(u16));
|
||||
return *this;
|
||||
}
|
||||
JSUInputStream& operator>>(u16& p) {
|
||||
this->read(&p, sizeof(u16));
|
||||
return *this;
|
||||
}
|
||||
|
||||
JSUInputStream& operator>>(u32& p) {
|
||||
this->read(&p, sizeof(u32));
|
||||
return *this;
|
||||
}
|
||||
JSUInputStream& operator>>(u32& p) {
|
||||
this->read(&p, sizeof(u32));
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
class JSUOutputStream : protected JSUIosBase {
|
||||
public:
|
||||
virtual ~JSUOutputStream();
|
||||
virtual int getAvailable() const = 0;
|
||||
virtual int skip(s32 amount);
|
||||
virtual int readData(void* buf, s32 size) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,16 +6,24 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
class JSUIosBase {
|
||||
public:
|
||||
inline JSUIosBase() : mState(GOOD) { }
|
||||
public:
|
||||
inline JSUIosBase() : mState(GOOD) {
|
||||
}
|
||||
|
||||
virtual ~JSUIosBase() { }
|
||||
virtual ~JSUIosBase() {
|
||||
}
|
||||
|
||||
bool isGood() { return !this->mState; }
|
||||
void clrState(EIoState ioState) { this->mState &= ~ioState; }
|
||||
void setState(EIoState ioState) { this->mState |= ioState; }
|
||||
bool isGood() {
|
||||
return !this->mState;
|
||||
}
|
||||
void clrState(EIoState ioState) {
|
||||
this->mState &= ~ioState;
|
||||
}
|
||||
void setState(EIoState ioState) {
|
||||
this->mState |= ioState;
|
||||
}
|
||||
|
||||
u8 mState;
|
||||
u8 mState;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
+184
-125
@@ -5,11 +5,9 @@
|
||||
|
||||
class JSUPtrLink;
|
||||
|
||||
class JSUPtrList
|
||||
{
|
||||
public:
|
||||
JSUPtrList()
|
||||
{
|
||||
class JSUPtrList {
|
||||
public:
|
||||
JSUPtrList() {
|
||||
initiate();
|
||||
}
|
||||
|
||||
@@ -17,207 +15,268 @@ public:
|
||||
~JSUPtrList();
|
||||
|
||||
void initiate();
|
||||
void setFirst(JSUPtrLink *);
|
||||
bool append(JSUPtrLink *);
|
||||
bool prepend(JSUPtrLink *);
|
||||
bool insert(JSUPtrLink *, JSUPtrLink *);
|
||||
bool remove(JSUPtrLink *);
|
||||
JSUPtrLink *getNthLink(u32 idx) const;
|
||||
void setFirst(JSUPtrLink*);
|
||||
bool append(JSUPtrLink*);
|
||||
bool prepend(JSUPtrLink*);
|
||||
bool insert(JSUPtrLink*, JSUPtrLink*);
|
||||
bool remove(JSUPtrLink*);
|
||||
JSUPtrLink* getNthLink(u32 idx) const;
|
||||
|
||||
JSUPtrLink *getFirstLink() const { return mHead; }
|
||||
JSUPtrLink *getLastLink() const { return mTail; }
|
||||
u32 getNumLinks() const { return mLinkCount; }
|
||||
JSUPtrLink* getFirstLink() const {
|
||||
return mHead;
|
||||
}
|
||||
JSUPtrLink* getLastLink() const {
|
||||
return mTail;
|
||||
}
|
||||
u32 getNumLinks() const {
|
||||
return mLinkCount;
|
||||
}
|
||||
|
||||
JSUPtrLink *mHead; // _0
|
||||
JSUPtrLink *mTail; // _4
|
||||
JSUPtrLink* mHead; // _0
|
||||
JSUPtrLink* mTail; // _4
|
||||
u32 mLinkCount; // _8
|
||||
};
|
||||
|
||||
class JSUPtrLink
|
||||
{
|
||||
public:
|
||||
JSUPtrLink(void *);
|
||||
class JSUPtrLink {
|
||||
public:
|
||||
JSUPtrLink(void*);
|
||||
~JSUPtrLink();
|
||||
|
||||
void *getObjectPtr() const { return mData; }
|
||||
JSUPtrList *getList() const { return mPtrList; }
|
||||
JSUPtrLink *getNext() const { return mNext; }
|
||||
JSUPtrLink *getPrev() const { return mPrev; }
|
||||
void* getObjectPtr() const {
|
||||
return mData;
|
||||
}
|
||||
JSUPtrList* getList() const {
|
||||
return mPtrList;
|
||||
}
|
||||
JSUPtrLink* getNext() const {
|
||||
return mNext;
|
||||
}
|
||||
JSUPtrLink* getPrev() const {
|
||||
return mPrev;
|
||||
}
|
||||
|
||||
void *mData; // _0
|
||||
JSUPtrList *mPtrList; // _4
|
||||
JSUPtrLink *mPrev; // _8
|
||||
JSUPtrLink *mNext; // _C
|
||||
void* mData; // _0
|
||||
JSUPtrList* mPtrList; // _4
|
||||
JSUPtrLink* mPrev; // _8
|
||||
JSUPtrLink* mNext; // _C
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class JSULink; // friend class? i'm C++ noob
|
||||
template <class T> class JSULink; // friend class? i'm C++ noob
|
||||
|
||||
template <class T>
|
||||
class JSUList : public JSUPtrList
|
||||
{
|
||||
public:
|
||||
JSUList(bool thing) : JSUPtrList(thing)
|
||||
{
|
||||
template <class T> class JSUList : public JSUPtrList {
|
||||
public:
|
||||
JSUList(bool thing) : JSUPtrList(thing) {
|
||||
}
|
||||
JSUList() : JSUPtrList()
|
||||
{
|
||||
JSUList() : JSUPtrList() {
|
||||
}
|
||||
|
||||
bool append(JSULink<T> *link) { return JSUPtrList::append((JSUPtrLink *)link); }
|
||||
bool prepend(JSULink<T> *link) { return JSUPtrList::prepend((JSUPtrLink *)link); }
|
||||
bool insert(JSULink<T> *before, JSULink<T> *link) { return JSUPtrList::insert((JSUPtrLink *)before, (JSUPtrLink *)link); }
|
||||
bool remove(JSULink<T> *link) { return JSUPtrList::remove((JSUPtrLink *)link); }
|
||||
bool append(JSULink<T>* link) {
|
||||
return JSUPtrList::append((JSUPtrLink*)link);
|
||||
}
|
||||
bool prepend(JSULink<T>* link) {
|
||||
return JSUPtrList::prepend((JSUPtrLink*)link);
|
||||
}
|
||||
bool insert(JSULink<T>* before, JSULink<T>* link) {
|
||||
return JSUPtrList::insert((JSUPtrLink*)before, (JSUPtrLink*)link);
|
||||
}
|
||||
bool remove(JSULink<T>* link) {
|
||||
return JSUPtrList::remove((JSUPtrLink*)link);
|
||||
}
|
||||
|
||||
JSULink<T> *getFirst() const { return (JSULink<T> *)getFirstLink(); }
|
||||
JSULink<T> *getLast() const { return (JSULink<T> *)getLastLink(); }
|
||||
JSULink<T> *getEnd() const { return nullptr; }
|
||||
JSULink<T>* getFirst() const {
|
||||
return (JSULink<T>*)getFirstLink();
|
||||
}
|
||||
JSULink<T>* getLast() const {
|
||||
return (JSULink<T>*)getLastLink();
|
||||
}
|
||||
JSULink<T>* getEnd() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
u32 getNumLinks() const { return mLinkCount; }
|
||||
u32 getNumLinks() const {
|
||||
return mLinkCount;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class JSUListIterator
|
||||
{
|
||||
public:
|
||||
JSUListIterator()
|
||||
: mLink(nullptr)
|
||||
{
|
||||
template <typename T> class JSUListIterator {
|
||||
public:
|
||||
JSUListIterator() : mLink(nullptr) {
|
||||
}
|
||||
JSUListIterator(JSULink<T> *link)
|
||||
: mLink(link)
|
||||
{
|
||||
JSUListIterator(JSULink<T>* link) : mLink(link) {
|
||||
}
|
||||
JSUListIterator(JSUList<T> *list)
|
||||
: mLink(list->getFirst())
|
||||
{
|
||||
JSUListIterator(JSUList<T>* list) : mLink(list->getFirst()) {
|
||||
}
|
||||
|
||||
JSUListIterator<T> &operator=(JSULink<T> *link)
|
||||
{
|
||||
JSUListIterator<T>& operator=(JSULink<T>* link) {
|
||||
this->mLink = link;
|
||||
return *this;
|
||||
}
|
||||
|
||||
T *getObject() { return this->mLink->getObject(); }
|
||||
T* getObject() {
|
||||
return this->mLink->getObject();
|
||||
}
|
||||
|
||||
bool operator==(JSULink<T> const *other) const { return this->mLink == other; }
|
||||
bool operator!=(JSULink<T> const *other) const { return this->mLink != other; }
|
||||
bool operator==(JSUListIterator<T> const &other) const { return this->mLink == other.mLink; }
|
||||
bool operator!=(JSUListIterator<T> const &other) const { return this->mLink != other.mLink; }
|
||||
bool operator==(JSULink<T> const* other) const {
|
||||
return this->mLink == other;
|
||||
}
|
||||
bool operator!=(JSULink<T> const* other) const {
|
||||
return this->mLink != other;
|
||||
}
|
||||
bool operator==(JSUListIterator<T> const& other) const {
|
||||
return this->mLink == other.mLink;
|
||||
}
|
||||
bool operator!=(JSUListIterator<T> const& other) const {
|
||||
return this->mLink != other.mLink;
|
||||
}
|
||||
|
||||
JSUListIterator<T> operator++(int)
|
||||
{
|
||||
JSUListIterator<T> operator++(int) {
|
||||
JSUListIterator<T> prev = *this;
|
||||
this->mLink = this->mLink->getNext();
|
||||
return prev;
|
||||
}
|
||||
|
||||
JSUListIterator<T> &operator++()
|
||||
{
|
||||
JSUListIterator<T>& operator++() {
|
||||
this->mLink = this->mLink->getNext();
|
||||
return *this;
|
||||
}
|
||||
|
||||
JSUListIterator<T> operator--(int)
|
||||
{
|
||||
JSUListIterator<T> operator--(int) {
|
||||
JSUListIterator<T> prev = *this;
|
||||
this->mLink = this->mLink->getPrev();
|
||||
return prev;
|
||||
}
|
||||
|
||||
JSUListIterator<T> &operator--()
|
||||
{
|
||||
JSUListIterator<T>& operator--() {
|
||||
this->mLink = this->mLink->getPrev();
|
||||
return *this;
|
||||
}
|
||||
|
||||
T &operator*() { return *this->getObject(); }
|
||||
T& operator*() {
|
||||
return *this->getObject();
|
||||
}
|
||||
|
||||
T *operator->() { return this->getObject(); }
|
||||
T* operator->() {
|
||||
return this->getObject();
|
||||
}
|
||||
|
||||
// private:
|
||||
JSULink<T> *mLink;
|
||||
JSULink<T>* mLink;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class JSULink : public JSUPtrLink
|
||||
{
|
||||
public:
|
||||
JSULink(void *pData) : JSUPtrLink(pData)
|
||||
{
|
||||
template <class T> class JSULink : public JSUPtrLink {
|
||||
public:
|
||||
JSULink(void* pData) : JSUPtrLink(pData) {
|
||||
}
|
||||
|
||||
T *getObject() const { return (T *)mData; }
|
||||
JSUList<T> *getList() const { return (JSUList<T> *)JSUPtrLink::getList(); } // fabricated, offcial name: getSupervisor
|
||||
JSULink<T> *getNext() const { return (JSULink<T> *)JSUPtrLink::getNext(); }
|
||||
JSULink<T> *getPrev() const { return (JSULink<T> *)JSUPtrLink::getPrev(); }
|
||||
T* getObject() const {
|
||||
return (T*)mData;
|
||||
}
|
||||
JSUList<T>* getList() const {
|
||||
return (JSUList<T>*)JSUPtrLink::getList();
|
||||
} // fabricated, offcial name: getSupervisor
|
||||
JSULink<T>* getNext() const {
|
||||
return (JSULink<T>*)JSUPtrLink::getNext();
|
||||
}
|
||||
JSULink<T>* getPrev() const {
|
||||
return (JSULink<T>*)JSUPtrLink::getPrev();
|
||||
}
|
||||
|
||||
~JSULink()
|
||||
{
|
||||
~JSULink() {
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T> // TODO: most of these inlines are probably wrong: rework
|
||||
class JSUTree : public JSUList<T>, public JSULink<T>
|
||||
{
|
||||
public:
|
||||
JSUTree(T *owner) : JSUList<T>(), JSULink<T>(owner) {}
|
||||
~JSUTree() {}
|
||||
class JSUTree : public JSUList<T>, public JSULink<T> {
|
||||
public:
|
||||
JSUTree(T* owner) : JSUList<T>(), JSULink<T>(owner) {
|
||||
}
|
||||
~JSUTree() {
|
||||
}
|
||||
|
||||
bool appendChild(JSUTree<T> *child) { return this->append(child); }
|
||||
bool prependChild(JSUTree<T> *child) { return this->prepend(child); }
|
||||
bool removeChild(JSUTree<T> *child) { return this->remove(child); }
|
||||
bool insertChild(JSUTree<T> *before, JSUTree<T> *child) { return this->insert(before, child); }
|
||||
bool appendChild(JSUTree<T>* child) {
|
||||
return this->append(child);
|
||||
}
|
||||
bool prependChild(JSUTree<T>* child) {
|
||||
return this->prepend(child);
|
||||
}
|
||||
bool removeChild(JSUTree<T>* child) {
|
||||
return this->remove(child);
|
||||
}
|
||||
bool insertChild(JSUTree<T>* before, JSUTree<T>* child) {
|
||||
return this->insert(before, child);
|
||||
}
|
||||
|
||||
JSUTree<T> *getEndChild() const { return nullptr; }
|
||||
JSUTree<T> *getFirstChild() const { return (JSUTree<T> *)this->getFirstLink(); }
|
||||
JSUTree<T> *getLastChild() const { return (JSUTree<T> *)this->getLast(); }
|
||||
JSUTree<T> *getNextChild() const { return (JSUTree<T> *)this->mNext; }
|
||||
JSUTree<T> *getPrevChild() const { return (JSUTree<T> *)this->getPrev(); }
|
||||
u32 getNumChildren() const { return this->mLinkCount; }
|
||||
T *getObject() const { return (T *)this->mData; }
|
||||
JSUTree<T> *getParent() const { return (JSUTree<T> *)this->mPtrList; }
|
||||
JSUTree<T>* getEndChild() const {
|
||||
return nullptr;
|
||||
}
|
||||
JSUTree<T>* getFirstChild() const {
|
||||
return (JSUTree<T>*)this->getFirstLink();
|
||||
}
|
||||
JSUTree<T>* getLastChild() const {
|
||||
return (JSUTree<T>*)this->getLast();
|
||||
}
|
||||
JSUTree<T>* getNextChild() const {
|
||||
return (JSUTree<T>*)this->mNext;
|
||||
}
|
||||
JSUTree<T>* getPrevChild() const {
|
||||
return (JSUTree<T>*)this->getPrev();
|
||||
}
|
||||
u32 getNumChildren() const {
|
||||
return this->mLinkCount;
|
||||
}
|
||||
T* getObject() const {
|
||||
return (T*)this->mData;
|
||||
}
|
||||
JSUTree<T>* getParent() const {
|
||||
return (JSUTree<T>*)this->mPtrList;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class JSUTreeIterator
|
||||
{
|
||||
public:
|
||||
JSUTreeIterator() : mTree(nullptr) {}
|
||||
JSUTreeIterator(JSUTree<T> *tree) : mTree(tree) {}
|
||||
template <typename T> class JSUTreeIterator {
|
||||
public:
|
||||
JSUTreeIterator() : mTree(nullptr) {
|
||||
}
|
||||
JSUTreeIterator(JSUTree<T>* tree) : mTree(tree) {
|
||||
}
|
||||
|
||||
JSUTreeIterator<T> &operator=(JSUTree<T> *tree)
|
||||
{
|
||||
JSUTreeIterator<T>& operator=(JSUTree<T>* tree) {
|
||||
this->mTree = tree;
|
||||
return *this;
|
||||
}
|
||||
|
||||
T *getObject() const { return mTree->getObject(); }
|
||||
T* getObject() const {
|
||||
return mTree->getObject();
|
||||
}
|
||||
|
||||
bool operator==(JSUTree<T> *other) { return this->mTree == other; }
|
||||
bool operator==(JSUTree<T>* other) {
|
||||
return this->mTree == other;
|
||||
}
|
||||
|
||||
bool operator!=(const JSUTree<T> *other) const { return this->mTree != other; }
|
||||
bool operator!=(const JSUTree<T>* other) const {
|
||||
return this->mTree != other;
|
||||
}
|
||||
|
||||
JSUTreeIterator<T> operator++(int)
|
||||
{
|
||||
JSUTreeIterator<T> operator++(int) {
|
||||
JSUTreeIterator<T> prev = *this;
|
||||
this->mTree = this->mTree->getNextChild();
|
||||
return prev;
|
||||
}
|
||||
|
||||
JSUTreeIterator<T> &operator++()
|
||||
{
|
||||
JSUTreeIterator<T>& operator++() {
|
||||
this->mTree = this->mTree->getNextChild();
|
||||
return *this;
|
||||
}
|
||||
|
||||
T &operator*() { return *this->getObject(); }
|
||||
T& operator*() {
|
||||
return *this->getObject();
|
||||
}
|
||||
|
||||
T *operator->() const { return mTree->getObject(); }
|
||||
T* operator->() const {
|
||||
return mTree->getObject();
|
||||
}
|
||||
|
||||
private:
|
||||
JSUTree<T> *mTree;
|
||||
private:
|
||||
JSUTree<T>* mTree;
|
||||
};
|
||||
|
||||
#endif /* JSULIST_H */
|
||||
|
||||
@@ -7,20 +7,41 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
class JSURandomInputStream : public JSUInputStream {
|
||||
public:
|
||||
virtual ~JSURandomInputStream() { }
|
||||
public:
|
||||
virtual ~JSURandomInputStream() {
|
||||
}
|
||||
|
||||
virtual int getAvailable() const { return this->getLength() - this->getPosition(); }
|
||||
virtual int skip(s32 amount);
|
||||
virtual int readData(void* buf, s32 count) = 0;
|
||||
virtual int getLength() const = 0;
|
||||
virtual int getPosition() const = 0;
|
||||
virtual int seekPos(s32 offset, JSUStreamSeekFrom from) = 0;
|
||||
virtual int getAvailable() const {
|
||||
return this->getLength() - this->getPosition();
|
||||
}
|
||||
virtual int skip(s32 amount);
|
||||
virtual int readData(void* buf, s32 count) = 0;
|
||||
virtual int getLength() const = 0;
|
||||
virtual int getPosition() const = 0;
|
||||
virtual int seekPos(s32 offset, JSUStreamSeekFrom from) = 0;
|
||||
|
||||
int align(s32 alignment);
|
||||
int peek(void* buf, s32 len);
|
||||
int seek(s32 offset, JSUStreamSeekFrom from);
|
||||
int align(s32 alignment);
|
||||
int peek(void* buf, s32 len);
|
||||
int seek(s32 offset, JSUStreamSeekFrom from);
|
||||
};
|
||||
|
||||
class JSURandomOutputStream : public JSUOutputStream {
|
||||
public:
|
||||
virtual ~JSURandomOutputStream() {
|
||||
}
|
||||
|
||||
virtual int getAvailable() const;
|
||||
virtual int skip(s32 amount);
|
||||
virtual int readData(void* buf, s32 count) = 0;
|
||||
virtual int getLength() const = 0;
|
||||
virtual int getPosition() const = 0;
|
||||
virtual int seekPos(s32 offset, JSUStreamSeekFrom from) = 0;
|
||||
|
||||
int align(s32 alignment);
|
||||
int peek(void* buf, s32 len);
|
||||
int seek(s32 offset, JSUStreamSeekFrom from);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,15 +1,8 @@
|
||||
#ifndef JSUSTREAMENUM_H
|
||||
#define JSUSTREAMENUM_H
|
||||
|
||||
enum JSUStreamSeekFrom {
|
||||
SEEK_SET = 0,
|
||||
SEEK_CUR = 1,
|
||||
SEEK_END = 2
|
||||
};
|
||||
enum JSUStreamSeekFrom { SEEK_SET = 0, SEEK_CUR = 1, SEEK_END = 2 };
|
||||
|
||||
enum EIoState {
|
||||
GOOD = 0,
|
||||
EOF = 1
|
||||
};
|
||||
enum EIoState { GOOD = 0, EOF = 1 };
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
|
||||
#include "JSystem/JKernel/JKRAram.h"
|
||||
#include "JSystem/JMacro.h"
|
||||
//#include "JSystem/JUtility/JUTException.h"
|
||||
#include "JSystem/JUtility/JUTException.h"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,36 +5,33 @@
|
||||
#include "dolphin/os.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
|
||||
namespace JUTAssertion
|
||||
{
|
||||
void create();
|
||||
void flushMessage();
|
||||
void flushMessage_dbPrint();
|
||||
u32 getSDevice(void);
|
||||
namespace JUTAssertion {
|
||||
void create();
|
||||
void flushMessage();
|
||||
void flushMessage_dbPrint();
|
||||
u32 getSDevice(void);
|
||||
|
||||
void showAssert_f(u32 device, char const *file, int line, char const *errormsg, ...);
|
||||
inline void showAssert(u32 device, char const *file, int line, char const *errormsg) {
|
||||
void showAssert_f(u32 device, char const* file, int line, char const* errormsg, ...);
|
||||
inline void showAssert(u32 device, char const* file, int line, char const* errormsg) {
|
||||
showAssert_f(device, file, line, "%s", errormsg);
|
||||
}
|
||||
|
||||
void setConfirmMessage(u32 device, char *file, int line, bool condition, const char *msg);
|
||||
void setWarningMessage_f(u32 device, char *file, int line, char const *, ...);
|
||||
inline void setWarningMessage(u32 device, char *file, int line, char const *errormsg) {
|
||||
setWarningMessage_f(device, file, line, "%s", errormsg);
|
||||
}
|
||||
|
||||
void setLogMessage_f(u32 device, char *file, int line, char const *fmt, ...);
|
||||
extern "C"
|
||||
{
|
||||
void showAssert_f_va(u32 device, const char *file, int line, const char *fmt, va_list vl);
|
||||
void setWarningMessage_f_va(u32 device, char *file, int line, const char *fmt, va_list vl);
|
||||
void setLogMessage_f_va(u32 device, char *file, int line, const char *fmt, va_list vl);
|
||||
}
|
||||
}
|
||||
|
||||
void setConfirmMessage(u32 device, char* file, int line, bool condition, const char* msg);
|
||||
void setWarningMessage_f(u32 device, char* file, int line, char const*, ...);
|
||||
inline void setWarningMessage(u32 device, char* file, int line, char const* errormsg) {
|
||||
setWarningMessage_f(device, file, line, "%s", errormsg);
|
||||
}
|
||||
|
||||
void setLogMessage_f(u32 device, char* file, int line, char const* fmt, ...);
|
||||
extern "C" {
|
||||
void showAssert_f_va(u32 device, const char* file, int line, const char* fmt, va_list vl);
|
||||
void setWarningMessage_f_va(u32 device, char* file, int line, const char* fmt, va_list vl);
|
||||
void setLogMessage_f_va(u32 device, char* file, int line, const char* fmt, va_list vl);
|
||||
}
|
||||
} // namespace JUTAssertion
|
||||
|
||||
#define JUT_PANIC(...)
|
||||
#define JUT_PANIC_F(...)
|
||||
#define JUT_CONFIRM_MESSAGE(...)
|
||||
@@ -46,7 +43,6 @@ namespace JUTAssertion
|
||||
#define JUT_LOG_F(...)
|
||||
#define JUT_ASSERT(...)
|
||||
#define JUT_ASSERT_F(...)
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -7,24 +7,20 @@
|
||||
#include "JSystem/JUtility/JUTFont.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
inline s32 colorCheck(s32 diff, s32 t)
|
||||
{
|
||||
inline s32 colorCheck(s32 diff, s32 t) {
|
||||
s32 ret = diff - t;
|
||||
return ret + 1;
|
||||
}
|
||||
|
||||
class JUTConsole : public JKRDisposer
|
||||
{
|
||||
public:
|
||||
enum EConsoleType
|
||||
{
|
||||
class JUTConsole : JKRDisposer {
|
||||
public:
|
||||
enum EConsoleType {
|
||||
CONSOLE_TYPE_0 = 0,
|
||||
CONSOLE_TYPE_1 = 1,
|
||||
CONSOLE_TYPE_2 = 2,
|
||||
};
|
||||
|
||||
enum OutputFlag
|
||||
{
|
||||
enum OutputFlag {
|
||||
/* 0x0 */ OUTPUT_NONE,
|
||||
/* 0x1 */ OUTPUT_OSREPORT,
|
||||
/* 0x2 */ OUTPUT_CONSOLE,
|
||||
@@ -35,122 +31,143 @@ public:
|
||||
|
||||
// _00 VTBL
|
||||
|
||||
static JUTConsole *create(uint, uint, JKRHeap *);
|
||||
static JUTConsole *create(uint, void *, u32);
|
||||
static void destroy(JUTConsole *); // UNUSED
|
||||
static JUTConsole* create(uint, uint, JKRHeap*);
|
||||
static JUTConsole* create(uint, void*, u32);
|
||||
static void destroy(JUTConsole*); // UNUSED
|
||||
JUTConsole(uint, uint, bool);
|
||||
static size_t getObjectSizeFromBufferSize(uint, uint);
|
||||
static size_t getLineFromObjectSize(u32, uint);
|
||||
void clear();
|
||||
void doDraw(JUTConsole::EConsoleType) const;
|
||||
void print_f(char const *, ...);
|
||||
void print(char const *);
|
||||
void print_f(char const*, ...);
|
||||
void print(char const*);
|
||||
void dumpToTerminal(uint);
|
||||
void scroll(int);
|
||||
int getUsedLine() const;
|
||||
int getLineOffset() const;
|
||||
|
||||
void setOutput(uint output) { mOutput = output; }
|
||||
void setPosition(int x, int y)
|
||||
{
|
||||
void setOutput(uint output) {
|
||||
mOutput = output;
|
||||
}
|
||||
void setPosition(int x, int y) {
|
||||
mPositionX = x;
|
||||
mPositionY = y;
|
||||
}
|
||||
void setFontSize(f32 x, f32 y)
|
||||
{
|
||||
void setFontSize(f32 x, f32 y) {
|
||||
mFontSizeX = x;
|
||||
mFontSizeY = y;
|
||||
}
|
||||
void setHeight(u32 height)
|
||||
{
|
||||
void setHeight(u32 height) {
|
||||
mHeight = height;
|
||||
if (mHeight > mMaxLines)
|
||||
{
|
||||
if (mHeight > mMaxLines) {
|
||||
mHeight = mMaxLines;
|
||||
}
|
||||
}
|
||||
|
||||
void setFont(JUTFont *p_font)
|
||||
{
|
||||
void setFont(JUTFont* p_font) {
|
||||
mFont = p_font;
|
||||
setFontSize(p_font->getWidth(), p_font->getHeight());
|
||||
}
|
||||
|
||||
int nextIndex(int index) const
|
||||
{
|
||||
int nextIndex(int index) const {
|
||||
return ++index >= (int)mMaxLines ? 0 : index;
|
||||
}
|
||||
|
||||
u32 getOutput() const { return mOutput; }
|
||||
int getPositionY() const { return mPositionY; }
|
||||
int getPositionX() const { return mPositionX; }
|
||||
u32 getHeight() const { return mHeight; }
|
||||
u32 getOutput() const {
|
||||
return mOutput;
|
||||
}
|
||||
int getPositionY() const {
|
||||
return mPositionY;
|
||||
}
|
||||
int getPositionX() const {
|
||||
return mPositionX;
|
||||
}
|
||||
u32 getHeight() const {
|
||||
return mHeight;
|
||||
}
|
||||
|
||||
bool isVisible() const { return mIsVisible; }
|
||||
void setVisible(bool visible) { mIsVisible = visible; }
|
||||
bool isVisible() const {
|
||||
return mIsVisible;
|
||||
}
|
||||
void setVisible(bool visible) {
|
||||
mIsVisible = visible;
|
||||
}
|
||||
|
||||
void setLineAttr(int param_0, u8 param_1) { mBuf[(_20 + 2) * param_0] = param_1; }
|
||||
u8 *getLinePtr(int param_0) const { return &mBuf[(_20 + 2) * param_0] + 1; }
|
||||
int diffIndex(int param_0, int param_1) const
|
||||
{
|
||||
void setLineAttr(int param_0, u8 param_1) {
|
||||
mBuf[(_20 + 2) * param_0] = param_1;
|
||||
}
|
||||
u8* getLinePtr(int param_0) const {
|
||||
return &mBuf[(_20 + 2) * param_0] + 1;
|
||||
}
|
||||
int diffIndex(int param_0, int param_1) const {
|
||||
int diff = param_1 - param_0;
|
||||
if (diff >= 0)
|
||||
{
|
||||
if (diff >= 0) {
|
||||
return diff;
|
||||
}
|
||||
return diff += mMaxLines;
|
||||
}
|
||||
|
||||
void scrollToLastLine() { scroll(mMaxLines); }
|
||||
void scrollToFirstLine() { scroll(-mMaxLines); }
|
||||
u8 getLineAttr(int i) const {
|
||||
return mBuf[(_20 + 2) * i];
|
||||
}
|
||||
|
||||
int prevIndex(int n) const {
|
||||
return (--n < 0) ? mMaxLines - 1 : n;
|
||||
}
|
||||
|
||||
void scrollToLastLine() {
|
||||
scroll(mMaxLines);
|
||||
}
|
||||
void scrollToFirstLine() {
|
||||
scroll(-mMaxLines);
|
||||
}
|
||||
|
||||
// _00 = VTBL
|
||||
// _00-_18 = JKRDisposer
|
||||
JGadget::TLinkListNode mNode; // _18
|
||||
u32 _20; // _20
|
||||
u32 mMaxLines; // _24, might be int
|
||||
u8 *mBuf; // _28
|
||||
bool _2C; // _2C
|
||||
int _30; // _30
|
||||
int _34; // _34
|
||||
int _38; // _38
|
||||
int _3C; // _3C
|
||||
int mPositionX; // _40
|
||||
int mPositionY; // _44
|
||||
u32 mHeight; // _48
|
||||
JUTFont *mFont; // _4C
|
||||
f32 mFontSizeX; // _50
|
||||
f32 mFontSizeY; // _54
|
||||
u32 mOutput; // _58
|
||||
JUtility::TColor _5C; // _5C
|
||||
JUtility::TColor _60; // _60
|
||||
int _64; // _64
|
||||
bool mIsVisible; // _68
|
||||
bool _69; // _69
|
||||
bool _6A; // _6A
|
||||
bool _6B; // _6B
|
||||
u32 _20; // _20
|
||||
u32 mMaxLines; // _24, might be int
|
||||
u8* mBuf; // _28
|
||||
bool _2C; // _2C
|
||||
int _30; // _30
|
||||
int _34; // _34
|
||||
int _38; // _38
|
||||
int _3C; // _3C
|
||||
int mPositionX; // _40
|
||||
int mPositionY; // _44
|
||||
u32 mHeight; // _48
|
||||
JUTFont* mFont; // _4C
|
||||
f32 mFontSizeX; // _50
|
||||
f32 mFontSizeY; // _54
|
||||
u32 mOutput; // _58
|
||||
JUtility::TColor _5C; // _5C
|
||||
JUtility::TColor _60; // _60
|
||||
bool mIsVisible; // _64
|
||||
bool _65; // _65
|
||||
bool _66; // _66
|
||||
}; // Size: 0x6C
|
||||
|
||||
class JUTConsoleManager
|
||||
{
|
||||
public:
|
||||
class JUTConsoleManager {
|
||||
public:
|
||||
JUTConsoleManager();
|
||||
static JUTConsoleManager *createManager(JKRHeap *);
|
||||
void appendConsole(JUTConsole *console);
|
||||
void removeConsole(JUTConsole *console);
|
||||
static JUTConsoleManager* createManager(JKRHeap*);
|
||||
void appendConsole(JUTConsole* console);
|
||||
void removeConsole(JUTConsole* console);
|
||||
void draw() const;
|
||||
void drawDirect(bool) const;
|
||||
void setDirectConsole(JUTConsole *);
|
||||
void setDirectConsole(JUTConsole*);
|
||||
|
||||
static JUTConsoleManager *getManager() { return sManager; }
|
||||
static JUTConsoleManager* getManager() {
|
||||
return sManager;
|
||||
}
|
||||
|
||||
static JUTConsoleManager *sManager;
|
||||
static JUTConsoleManager* sManager;
|
||||
|
||||
private:
|
||||
private:
|
||||
JGadget::TLinkList<JUTConsole, -24> soLink_; // _00
|
||||
JUTConsole *mActiveConsole; // _0C
|
||||
JUTConsole *mDirectConsole; // _10
|
||||
}; // Size: 0x14
|
||||
JUTConsole* mActiveConsole; // _0C
|
||||
JUTConsole* mDirectConsole; // _10
|
||||
}; // Size: 0x14
|
||||
|
||||
extern "C" {
|
||||
void JUTConsole_print_f_va_(JUTConsole*, const char*, va_list);
|
||||
|
||||
@@ -2,13 +2,68 @@
|
||||
#define _JSYSTEM_JUT_JUTDBPRINT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "JSystem/JUtility/TColor.h"
|
||||
#include "JSystem/JUtility/JUTFont.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
|
||||
struct JUTDbPrintList {
|
||||
JUTDbPrintList* mNext; // _00
|
||||
s16 mX; // _04
|
||||
s16 mY; // _06
|
||||
s16 mDuration; // _08
|
||||
s16 mLen; // _0A
|
||||
u8 mStr; // _0C
|
||||
};
|
||||
|
||||
struct JUTDbPrint {
|
||||
JUTDbPrint(JUTFont*, JKRHeap*); // unused/inlined
|
||||
|
||||
~JUTDbPrint(); // unused/inlined
|
||||
|
||||
JUTFont* changeFont(JUTFont*);
|
||||
void flush();
|
||||
void flush(int, int, int, int);
|
||||
void drawString(int, int, int, const u8*);
|
||||
|
||||
// Unused/inlined:
|
||||
void enter(int, int, int, const char*, int);
|
||||
void print(int, int, const char*, ...);
|
||||
void print(int, int, int, const char*, ...);
|
||||
void reset();
|
||||
|
||||
void setVisible(bool visible) {
|
||||
mVisible = visible;
|
||||
}
|
||||
JUTFont* getFont() const {
|
||||
return mFont;
|
||||
}
|
||||
JUTDbPrintList* getList() const {
|
||||
return mList;
|
||||
}
|
||||
|
||||
static JUTDbPrint* start(JUTFont*, JKRHeap*);
|
||||
static JUTDbPrint* getManager() {
|
||||
return sDebugPrint;
|
||||
}
|
||||
|
||||
static JUTDbPrint* sDebugPrint;
|
||||
|
||||
JUTDbPrintList* mList; // _00
|
||||
JUTFont* mFont; // _04
|
||||
JUtility::TColor mColor; // _08
|
||||
bool mVisible; // _0C
|
||||
JKRHeap* mHeap; // _10
|
||||
};
|
||||
|
||||
void JUTReport(int x, int y, int show_count, const char* fmt, ...);
|
||||
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void* JC_JUTDbPrint_getManager(void);
|
||||
void JC_JUTDbPrint_setVisible(void*, int); // I know these are C++ but these were used to match a c function so I'll fix these when I need them or fix zurumode update.
|
||||
|
||||
void JUTReport(int x, int y, int show_count, const char* fmt, ...);
|
||||
void* JC_JUTDbPrint_getManager(void);
|
||||
void JC_JUTDbPrint_setVisible(void*, int); // I know these are C++ but these were used to match a c function so I'll fix
|
||||
// these when I need them or fix zurumode update.
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
#ifndef _JSYSTEM_JUT_JUTDIRECTFILE_H
|
||||
#define _JSYSTEM_JUT_JUTDIRECTFILE_H
|
||||
|
||||
#include <dolphin/dvd.h>
|
||||
#include "types.h"
|
||||
|
||||
#define JUTDF_BUFSIZE (0x800)
|
||||
|
||||
struct JUTDirectFile {
|
||||
JUTDirectFile();
|
||||
|
||||
~JUTDirectFile();
|
||||
|
||||
bool fopen(const char*);
|
||||
void fclose();
|
||||
int fgets(void*, int);
|
||||
|
||||
// unused/inlined
|
||||
int fetch32byte();
|
||||
void fread(void*, u32);
|
||||
void setPos(u32);
|
||||
void fgetc();
|
||||
|
||||
u8 mBuffer[0x820]; // _000, 0x20 header, 0x800 sector
|
||||
u8* mSectorStart; // _820, ptr to 0x800 buffer
|
||||
u32 mToRead; // _824, length (max 32 bytes) to read
|
||||
u32 mLength; // _828, length of file
|
||||
u32 mPos; // _82C, position in file
|
||||
bool mIsOpen; // _830, is file open
|
||||
DVDFileInfo mFileInfo; // _834
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -2,61 +2,55 @@
|
||||
#define JUTDIRECTPRINT_H
|
||||
|
||||
#include "types.h"
|
||||
// #include "va_args.h"
|
||||
#include "JSystem/JUtility/TColor.h"
|
||||
#include "libc/stdarg.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
class JUTDirectPrint
|
||||
{
|
||||
private:
|
||||
|
||||
class JUTDirectPrint {
|
||||
private:
|
||||
JUTDirectPrint();
|
||||
|
||||
public:
|
||||
static JUTDirectPrint *start();
|
||||
public:
|
||||
static JUTDirectPrint* start();
|
||||
void erase(int x, int y, int w, int h);
|
||||
void setCharColor(JUtility::TColor color);
|
||||
void setCharColor(u8 r, u8 g, u8 b);
|
||||
void drawChar(int, int, int);
|
||||
void drawString(u16 x, u16 y, char *text);
|
||||
void drawString_f(u16 x, u16 y, const char * text, ...);
|
||||
void changeFrameBuffer(void *framebuffer, u16 w, u16 h );
|
||||
void drawString(u16 x, u16 y, char* text);
|
||||
void drawString_f(u16 x, u16 y, const char* text, ...);
|
||||
void changeFrameBuffer(void* framebuffer, u16 w, u16 h);
|
||||
void printSub(u16, u16, const char*, va_list, bool); // TODO: Function signature
|
||||
void print(u16, u16, const char*, ...);
|
||||
|
||||
// Inline/Unused
|
||||
void printSub(u16, u16, const char *, va_list *, bool);
|
||||
void print(u16, u16, const char *, ...);
|
||||
bool isActive() const {
|
||||
return mFramebuffer != nullptr;
|
||||
}
|
||||
void* getFrameBuffer() {
|
||||
return mFramebuffer;
|
||||
}
|
||||
|
||||
bool isActive() const { return mFramebuffer != nullptr; }
|
||||
void *getFrameBuffer() { return mFramebuffer; }
|
||||
JUtility::TColor getCharColor() const { return mCharColor; }
|
||||
void changeFrameBuffer(void* fb) {
|
||||
changeFrameBuffer(fb, mFbWidth, mFbHeight);
|
||||
}
|
||||
|
||||
static JUTDirectPrint *getManager() { return sDirectPrint; }
|
||||
static JUTDirectPrint* getManager() {
|
||||
return sDirectPrint;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
static u8 sAsciiTable[128];
|
||||
static u32 sFontData[64];
|
||||
static u32 sFontData2[77];
|
||||
static JUTDirectPrint *sDirectPrint;
|
||||
static JUTDirectPrint* sDirectPrint;
|
||||
|
||||
void *mFramebuffer; // _00
|
||||
u16 mFbWidth; // _04
|
||||
u16 mFbHeight; // _06
|
||||
u16 mStride; // _08, aligned width?
|
||||
size_t mFbSize; // _0C
|
||||
u8 _10[0x4]; // _10 - unknown
|
||||
u16 *mFrameMemory; // _14
|
||||
JUtility::TColor mCharColor; // _18, Color in RGBA format
|
||||
u16 mCharColorY; // _1C, 1C-2C = color in YCbCr
|
||||
u16 mCharColorCb; // _1E
|
||||
u16 mCharColorCb2; // _20
|
||||
u16 mCharColorCb4; // _22
|
||||
u16 mCharColorCr; // _24
|
||||
u16 mCharColorCr2; // _26
|
||||
u16 mCharColorCr4; // _28
|
||||
u16 _2A; // _2A
|
||||
void* mFramebuffer; // _00
|
||||
u16 mFbWidth; // _04
|
||||
u16 mFbHeight; // _06
|
||||
u16 mStride; // _08
|
||||
size_t mFbSize; // _0C
|
||||
u8 _10[0x4]; // _10 - unknown
|
||||
u16* mFrameMemory; // _14
|
||||
};
|
||||
|
||||
inline void JUTChangeFrameBuffer(void *buffer, u16 height, u16 width)
|
||||
{
|
||||
inline void JUTChangeFrameBuffer(void* buffer, u16 height, u16 width) {
|
||||
JUTDirectPrint::getManager()->changeFrameBuffer(buffer, width, height);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -8,26 +8,26 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
enum EButtons {
|
||||
MAINSTICK_UP = 0x8000000,
|
||||
MAINSTICK_DOWN = 0x4000000,
|
||||
MAINSTICK_RIGHT = 0x2000000,
|
||||
MAINSTICK_LEFT = 0x1000000,
|
||||
CSTICK_UP = 0x80000,
|
||||
CSTICK_DOWN = 0x40000,
|
||||
CSTICK_RIGHT = 0x20000,
|
||||
CSTICK_LEFT = 0x10000,
|
||||
START = 0x1000,
|
||||
Y = 0x800,
|
||||
X = 0x400,
|
||||
B = 0x200,
|
||||
A = 0x100,
|
||||
L = 0x40,
|
||||
R = 0x20,
|
||||
Z = 0x10,
|
||||
DPAD_UP = 0x8,
|
||||
DPAD_DOWN = 0x4,
|
||||
DPAD_RIGHT = 0x2,
|
||||
DPAD_LEFT = 0x1
|
||||
MAINSTICK_UP = 0x8000000,
|
||||
MAINSTICK_DOWN = 0x4000000,
|
||||
MAINSTICK_RIGHT = 0x2000000,
|
||||
MAINSTICK_LEFT = 0x1000000,
|
||||
CSTICK_UP = 0x80000,
|
||||
CSTICK_DOWN = 0x40000,
|
||||
CSTICK_RIGHT = 0x20000,
|
||||
CSTICK_LEFT = 0x10000,
|
||||
START = 0x1000,
|
||||
Y = 0x800,
|
||||
X = 0x400,
|
||||
B = 0x200,
|
||||
A = 0x100,
|
||||
L = 0x40,
|
||||
R = 0x20,
|
||||
Z = 0x10,
|
||||
DPAD_UP = 0x8,
|
||||
DPAD_DOWN = 0x4,
|
||||
DPAD_RIGHT = 0x2,
|
||||
DPAD_LEFT = 0x1
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
#ifndef _JSYSTEM_JUT_JUTEXCEPTION_H
|
||||
#define _JSYSTEM_JUT_JUTEXCEPTION_H
|
||||
|
||||
#include <dolphin/os.h>
|
||||
#include "JSystem/JKernel/JKRThread.h"
|
||||
#include "JSystem/JSupport/JSUList.h"
|
||||
#include "JSystem/JUtility/JUTGamePad.h"
|
||||
#include "JSystem/JUtility/JUTXfb.h"
|
||||
#include "types.h"
|
||||
|
||||
struct JUTConsole;
|
||||
struct JUTDirectPrint;
|
||||
|
||||
typedef void (*JUTErrorHandler)(OSError error, OSContext* context, u32 dsisr, u32 dar);
|
||||
|
||||
enum ExPrintFlags {
|
||||
EXPRINTFLAG_GPR = 0x1,
|
||||
EXPRINTFLAG_GPRMap = 0x2,
|
||||
EXPRINTFLAG_Float = 0x4,
|
||||
EXPRINTFLAG_Stack = 0x8,
|
||||
EXPRINTFLAG_All = 0xFF,
|
||||
};
|
||||
|
||||
/**
|
||||
* @size{0xA4}
|
||||
*/
|
||||
struct JUTException : public JKRThread {
|
||||
enum EInfoPage {
|
||||
INFOPAGE_GPR = 1,
|
||||
INFOPAGE_Float = 2,
|
||||
INFOPAGE_Stack = 3,
|
||||
INFOPAGE_GPRMap = 4,
|
||||
|
||||
};
|
||||
|
||||
// size: 0x14
|
||||
struct JUTExMapFile {
|
||||
inline JUTExMapFile(const char* fileName) : mLink(this) {
|
||||
mFileName = (char*)fileName;
|
||||
}
|
||||
|
||||
char* mFileName; // _00
|
||||
JSULink<JUTExMapFile> mLink; // _04
|
||||
};
|
||||
|
||||
/** @fabricated */
|
||||
struct ExCallbackObject {
|
||||
JUTErrorHandler mErrorHandler; // _00
|
||||
s32 mError; // _04
|
||||
OSContext* mContext; // _08
|
||||
u32 _0C; // _0C
|
||||
u32 _10; // _10
|
||||
};
|
||||
|
||||
JUTException(JUTDirectPrint*); // unused/inlined
|
||||
|
||||
virtual ~JUTException() {}; // _08 (weak)
|
||||
virtual void* run(); // _0C
|
||||
|
||||
void showFloat(OSContext*);
|
||||
void showStack(OSContext*);
|
||||
void showMainInfo(u16, OSContext*, u32, u32);
|
||||
bool showMapInfo_subroutine(u32, bool);
|
||||
void showGPRMap(OSContext*);
|
||||
void printDebugInfo(JUTException::EInfoPage, u16, OSContext*, u32, u32);
|
||||
bool readPad(u32*, u32*);
|
||||
void printContext(u16, OSContext*, u32, u32);
|
||||
void createFB();
|
||||
|
||||
static void waitTime(long);
|
||||
static JUTErrorHandler setPreUserCallback(JUTErrorHandler);
|
||||
static void appendMapFile(const char*);
|
||||
static bool queryMapAddress(char*, u32, long, u32*, u32*, char*, u32, bool, bool);
|
||||
static bool queryMapAddress_single(char*, u32, long, u32*, u32*, char*, u32, bool, bool);
|
||||
|
||||
static JUTException* create(JUTDirectPrint*);
|
||||
static void createConsole(void* buffer, u32 bufferSize);
|
||||
static void panic_f(const char* file, int line, const char* msg, ...);
|
||||
static void errorHandler(u16, OSContext*, u32, u32);
|
||||
static void setFPException(u32);
|
||||
static bool searchPartialModule(u32, u32*, u32*, u32*, u32*);
|
||||
|
||||
// unused/inlined:
|
||||
static void panic_f_va(const char*, int, const char*, va_list);
|
||||
static JUTErrorHandler setPostUserCallback(JUTErrorHandler);
|
||||
|
||||
// Inline
|
||||
static void panic(const char* file, int line, const char* msg) {
|
||||
panic_f(file, line, "%s", msg);
|
||||
}
|
||||
|
||||
void showFloatSub(int, f32);
|
||||
void showGPR(OSContext*);
|
||||
void showSRR0Map(OSContext*);
|
||||
bool isEnablePad() const;
|
||||
static u32 getFpscr();
|
||||
void setFpscr(u32);
|
||||
void enableFpuException();
|
||||
void disableFpuException();
|
||||
|
||||
JUTExternalFB* getFrameMemory() const {
|
||||
return mFrameMemory;
|
||||
}
|
||||
|
||||
void setTraceSuppress(u32 supress) {
|
||||
mTraceSuppress = supress;
|
||||
}
|
||||
void setGamePad(JUTGamePad* gamePad) {
|
||||
mGamePad = gamePad;
|
||||
mPadPort = JUTGamePad::Port_Invalid;
|
||||
}
|
||||
|
||||
static JUTException* getManager() {
|
||||
return sErrorManager;
|
||||
}
|
||||
static JUTConsole* getConsole() {
|
||||
return sConsole;
|
||||
}
|
||||
|
||||
static JUTConsole* sConsole;
|
||||
static void* sConsoleBuffer;
|
||||
static size_t sConsoleBufferSize;
|
||||
static JUTException* sErrorManager;
|
||||
static OSMessageQueue sMessageQueue;
|
||||
static void* sMessageBuffer[1];
|
||||
static JUTErrorHandler sPreUserCallback;
|
||||
static JUTErrorHandler sPostUserCallback;
|
||||
static u32 msr;
|
||||
static u32 fpscr;
|
||||
static const char* sCpuExpName[16];
|
||||
static JSUList<JUTExMapFile> sMapFileList;
|
||||
|
||||
// _00 = VTBL
|
||||
// _00-_7C = JKRThread
|
||||
JUTExternalFB* mFrameMemory; // _7C
|
||||
JUTDirectPrint* mDirectPrint; // _80
|
||||
JUTGamePad* mGamePad; // _84
|
||||
JUTGamePad::EPadPort mPadPort; // _88
|
||||
int mPrintWaitTime0; // _8C
|
||||
int mPrintWaitTime1; // _90
|
||||
u32 mTraceSuppress; // _94
|
||||
u32 _98; // _98
|
||||
u32 mPrintFlags; // _9C, see ExPrintFlags enum
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,44 @@
|
||||
#ifndef _JUTFADER_H
|
||||
#define _JUTFADER_H
|
||||
|
||||
#include "JSystem/JGeometry.h"
|
||||
#include "JSystem/JUtility/TColor.h"
|
||||
#include "JSystem/JUtility/JUTVideo.h"
|
||||
#include "types.h"
|
||||
|
||||
struct JUTFader {
|
||||
enum EStatus { Status_Out = 0, Status_In = 1, Status_FadingIn = 2, Status_FadingOut = 3 };
|
||||
|
||||
JUTFader(int, int, int, int, JUtility::TColor);
|
||||
|
||||
virtual ~JUTFader() {
|
||||
} // _08 (weak)
|
||||
virtual bool startFadeIn(int duration); // _0C
|
||||
virtual bool startFadeOut(int duration); // _10
|
||||
virtual void draw(); // _14
|
||||
|
||||
void control();
|
||||
|
||||
// unused/inlined:
|
||||
void start(int);
|
||||
void setStatus(EStatus, int);
|
||||
|
||||
EStatus getStatus() const {
|
||||
return mStatus;
|
||||
}
|
||||
|
||||
void setColor(JUtility::TColor color) {
|
||||
mColor.set(color.r, color.g, color.b, mColor.a);
|
||||
}
|
||||
|
||||
// _00 VTBL
|
||||
EStatus mStatus; // _04 - current status
|
||||
u16 mTicksTarget; // _08 - ticks (calls to control()) to run a fade in/out for
|
||||
u16 mTicksRun; // _0A - ticks the current fade has run
|
||||
JUtility::TColor mColor; // _10 - color of fade
|
||||
JGeometry::TBox2f mViewBox; // _14 - ortho box to render within
|
||||
int mEStatus; // _24 - ???
|
||||
EStatus _28; // _28 - ???
|
||||
};
|
||||
|
||||
#endif
|
||||
+175
-144
@@ -13,17 +13,14 @@ struct JKRHeap;
|
||||
|
||||
struct ResFONT;
|
||||
|
||||
struct JUTFont
|
||||
{
|
||||
struct JUTFont {
|
||||
typedef bool (*IsLeadByte)(int);
|
||||
|
||||
struct TWidth
|
||||
{
|
||||
struct TWidth {
|
||||
u8 w0;
|
||||
u8 w1;
|
||||
|
||||
const TWidth &operator=(const TWidth &other)
|
||||
{
|
||||
const TWidth& operator=(const TWidth& other) {
|
||||
w0 = other.w0;
|
||||
w1 = other.w1;
|
||||
return *this;
|
||||
@@ -32,41 +29,47 @@ struct JUTFont
|
||||
|
||||
JUTFont();
|
||||
|
||||
virtual ~JUTFont() {} // _08
|
||||
virtual void setGX() = 0; // _0C
|
||||
virtual void setGX(JUtility::TColor, JUtility::TColor) { setGX(); }; // _10
|
||||
virtual f32 drawChar_scale(f32, f32, f32, f32, int, bool) = 0; // _14
|
||||
virtual int getLeading() const = 0; // _18
|
||||
virtual int getAscent() const = 0; // _1C
|
||||
virtual int getDescent() const = 0; // _20
|
||||
virtual int getHeight() const = 0; // _24
|
||||
virtual int getWidth() const = 0; // _28
|
||||
virtual void getWidthEntry(int, JUTFont::TWidth *) const = 0; // _2C
|
||||
virtual int getCellWidth() const { return getWidth(); }; // _30
|
||||
virtual int getCellHeight() const { return getHeight(); }; // _34
|
||||
virtual int getFontType() const = 0; // _38
|
||||
virtual const ResFONT *getResFont() const = 0; // _3C
|
||||
virtual bool isLeadByte(int) const = 0; // _40
|
||||
virtual ~JUTFont() {
|
||||
} // _08
|
||||
virtual void setGX() = 0; // _0C
|
||||
virtual void setGX(JUtility::TColor, JUtility::TColor) {
|
||||
setGX();
|
||||
}; // _10
|
||||
virtual f32 drawChar_scale(f32, f32, f32, f32, int, bool) = 0; // _14
|
||||
virtual int getLeading() const = 0; // _18
|
||||
virtual int getAscent() const = 0; // _1C
|
||||
virtual int getDescent() const = 0; // _20
|
||||
virtual int getHeight() const = 0; // _24
|
||||
virtual int getWidth() const = 0; // _28
|
||||
virtual void getWidthEntry(int, JUTFont::TWidth*) const = 0; // _2C
|
||||
virtual int getCellWidth() const {
|
||||
return getWidth();
|
||||
}; // _30
|
||||
virtual int getCellHeight() const {
|
||||
return getHeight();
|
||||
}; // _34
|
||||
virtual int getFontType() const = 0; // _38
|
||||
virtual const ResFONT* getResFont() const = 0; // _3C
|
||||
virtual bool isLeadByte(int) const = 0; // _40
|
||||
|
||||
void initialize_state();
|
||||
void setCharColor(JUtility::TColor);
|
||||
void setGradColor(JUtility::TColor, JUtility::TColor);
|
||||
f32 drawString_size_scale(f32, f32, f32, f32, const char *, u32, bool);
|
||||
f32 drawString_size_scale(f32, f32, f32, f32, const char*, u32, bool);
|
||||
|
||||
void drawString(int posX, int posY, const char *str, bool visible) { drawString_size(posX, posY, str, strlen(str), visible); }
|
||||
void drawString(int posX, int posY, const char* str, bool visible) {
|
||||
drawString_size(posX, posY, str, strlen(str), visible);
|
||||
}
|
||||
|
||||
void drawString_size(int posX, int posY, const char *str, u32 len, bool visible)
|
||||
{
|
||||
void drawString_size(int posX, int posY, const char* str, u32 len, bool visible) {
|
||||
drawString_size_scale(posX, posY, getWidth(), getHeight(), str, len, visible);
|
||||
}
|
||||
|
||||
void drawString_scale(f32 posX, f32 posY, f32 width, f32 height, const char *str, bool visible)
|
||||
{
|
||||
void drawString_scale(f32 posX, f32 posY, f32 width, f32 height, const char* str, bool visible) {
|
||||
drawString_size_scale(posX, posY, width, height, str, strlen(str), visible);
|
||||
}
|
||||
|
||||
int getWidth(int i_no) const
|
||||
{
|
||||
int getWidth(int i_no) const {
|
||||
TWidth width;
|
||||
getWidthEntry(i_no, &width);
|
||||
return width.w0;
|
||||
@@ -77,18 +80,23 @@ struct JUTFont
|
||||
mFixedWidth = width;
|
||||
}
|
||||
|
||||
bool isValid() const { return mValid; }
|
||||
bool isValid() const {
|
||||
return mValid;
|
||||
}
|
||||
|
||||
static bool isLeadByte_1Byte(int c) { return false; }
|
||||
static bool isLeadByte_2Byte(int c) { return true; }
|
||||
static bool isLeadByte_ShiftJIS(int c)
|
||||
{
|
||||
static bool isLeadByte_1Byte(int c) {
|
||||
return false;
|
||||
}
|
||||
static bool isLeadByte_2Byte(int c) {
|
||||
return true;
|
||||
}
|
||||
static bool isLeadByte_ShiftJIS(int c) {
|
||||
return ((c >= 0x81) && (c <= 0x9F)) || ((c >= 0xE0) && (c <= 0xFC));
|
||||
}
|
||||
|
||||
// _00 = VTBL
|
||||
bool mValid; // _04
|
||||
bool mFixed; // _05
|
||||
bool mValid; // _04
|
||||
bool mFixed; // _05
|
||||
int mFixedWidth; // _08
|
||||
JUtility::TColor mColor1; // _0C, bottom left
|
||||
JUtility::TColor mColor2; // _10, bottom right
|
||||
@@ -96,39 +104,55 @@ struct JUTFont
|
||||
JUtility::TColor mColor4; // _18, top right
|
||||
};
|
||||
|
||||
struct JUTRomFont : public JUTFont
|
||||
{
|
||||
struct JUTRomFont : public JUTFont {
|
||||
// @fabricatedName
|
||||
struct AboutEncoding
|
||||
{
|
||||
struct AboutEncoding {
|
||||
u32 mFontType; // _00
|
||||
u32 mDataSize; // _04
|
||||
IsLeadByte mIsLeadByteFunction; // _08
|
||||
};
|
||||
|
||||
JUTRomFont();
|
||||
JUTRomFont(JKRHeap *);
|
||||
JUTRomFont(JKRHeap*);
|
||||
|
||||
virtual ~JUTRomFont(); // _08
|
||||
virtual void setGX(); // _0C
|
||||
virtual f32 drawChar_scale(f32, f32, f32, f32, int, bool); // _14
|
||||
virtual int getWidth() const { return spFontHeader_->width; }; // _28
|
||||
virtual int getLeading() const { return spFontHeader_->leading; }; // _18
|
||||
virtual int getAscent() const { return spFontHeader_->ascent; }; // _1C
|
||||
virtual int getDescent() const { return spFontHeader_->descent; }; // _20
|
||||
virtual int getHeight() const { return getAscent() + getDescent(); }; // _24
|
||||
virtual void getWidthEntry(int, JUTFont::TWidth *) const; // _2C
|
||||
virtual int getCellWidth() const { return spFontHeader_->cellWidth; }; // _30
|
||||
virtual int getCellHeight() const { return spFontHeader_->cellHeight; }; // _34
|
||||
virtual ResFONT *getResFont() const { return nullptr; }; // _3C
|
||||
virtual int getFontType() const { return spAboutEncoding_->mFontType; }; // _38
|
||||
virtual bool isLeadByte(int) const; // _40
|
||||
virtual ~JUTRomFont(); // _08
|
||||
virtual void setGX(); // _0C
|
||||
virtual f32 drawChar_scale(f32, f32, f32, f32, int, bool); // _14
|
||||
virtual int getWidth() const {
|
||||
return spFontHeader_->width;
|
||||
}; // _28
|
||||
virtual int getLeading() const {
|
||||
return spFontHeader_->leading;
|
||||
}; // _18
|
||||
virtual int getAscent() const {
|
||||
return spFontHeader_->ascent;
|
||||
}; // _1C
|
||||
virtual int getDescent() const {
|
||||
return spFontHeader_->descent;
|
||||
}; // _20
|
||||
virtual int getHeight() const {
|
||||
return getAscent() + getDescent();
|
||||
}; // _24
|
||||
virtual void getWidthEntry(int, JUTFont::TWidth*) const; // _2C
|
||||
virtual int getCellWidth() const {
|
||||
return spFontHeader_->cellWidth;
|
||||
}; // _30
|
||||
virtual int getCellHeight() const {
|
||||
return spFontHeader_->cellHeight;
|
||||
}; // _34
|
||||
virtual ResFONT* getResFont() const {
|
||||
return nullptr;
|
||||
}; // _3C
|
||||
virtual int getFontType() const {
|
||||
return spAboutEncoding_->mFontType;
|
||||
}; // _38
|
||||
virtual bool isLeadByte(int) const; // _40
|
||||
|
||||
void initiate(JKRHeap *);
|
||||
void loadImage(JKRHeap *);
|
||||
void initiate(JKRHeap*);
|
||||
void loadImage(JKRHeap*);
|
||||
|
||||
static AboutEncoding *spAboutEncoding_;
|
||||
static OSFontHeader *spFontHeader_;
|
||||
static AboutEncoding* spAboutEncoding_;
|
||||
static OSFontHeader* spFontHeader_;
|
||||
static u32 suFontHeaderRefered_; // they misspelled referred
|
||||
static AboutEncoding saoAboutEncoding_[2];
|
||||
|
||||
@@ -136,23 +160,21 @@ struct JUTRomFont : public JUTFont
|
||||
// _00-_1C = JUTFont
|
||||
};
|
||||
|
||||
struct BlockHeader
|
||||
{
|
||||
const BlockHeader *getNext() const { return reinterpret_cast<const BlockHeader *>(reinterpret_cast<const u8 *>(this) + this->mSize); }
|
||||
inline static void advance(const BlockHeader **iterator)
|
||||
{
|
||||
*iterator = reinterpret_cast<const BlockHeader *>(reinterpret_cast<const u8 *>(*iterator) + (*iterator)->mSize);
|
||||
struct BlockHeader {
|
||||
const BlockHeader* getNext() const {
|
||||
return reinterpret_cast<const BlockHeader*>(reinterpret_cast<const u8*>(this) + this->mSize);
|
||||
}
|
||||
inline static void advance(const BlockHeader** iterator) {
|
||||
*iterator = reinterpret_cast<const BlockHeader*>(reinterpret_cast<const u8*>(*iterator) + (*iterator)->mSize);
|
||||
}
|
||||
|
||||
u32 mMagic; // _00
|
||||
u32 mSize; // _04
|
||||
};
|
||||
|
||||
struct ResFONT
|
||||
{
|
||||
struct ResFONT {
|
||||
// INF1, size: 0x14
|
||||
struct InfoBlock : public BlockHeader
|
||||
{
|
||||
struct InfoBlock : public BlockHeader {
|
||||
// _00 = BlockHeader
|
||||
u16 mFontType; // _08
|
||||
u16 mAscent; // _0A
|
||||
@@ -163,8 +185,7 @@ struct ResFONT
|
||||
};
|
||||
|
||||
// WID1, size: 0x10
|
||||
struct WidthBlock : public BlockHeader
|
||||
{
|
||||
struct WidthBlock : public BlockHeader {
|
||||
// _00 = BlockHeader
|
||||
u16 mStartCode; // _08
|
||||
u16 mEndCode; // _0A
|
||||
@@ -172,8 +193,7 @@ struct ResFONT
|
||||
};
|
||||
|
||||
// MAP1, size: 0x14
|
||||
struct MapBlock : public BlockHeader
|
||||
{
|
||||
struct MapBlock : public BlockHeader {
|
||||
// _00 = BlockHeader
|
||||
u16 mMappingMethod; // _08
|
||||
u16 mStartCode; // _0A
|
||||
@@ -183,8 +203,7 @@ struct ResFONT
|
||||
};
|
||||
|
||||
// GLY1, size: 0x20
|
||||
struct GlyphBlock : public BlockHeader
|
||||
{
|
||||
struct GlyphBlock : public BlockHeader {
|
||||
// _00 = BlockHeader
|
||||
u16 mStartCode; // _08
|
||||
u16 mEndCode; // _0A
|
||||
@@ -210,40 +229,52 @@ struct ResFONT
|
||||
/**
|
||||
* @size{0x70}
|
||||
*/
|
||||
struct JUTResFont : public JUTFont
|
||||
{
|
||||
struct JUTResFont : public JUTFont {
|
||||
JUTResFont();
|
||||
JUTResFont(const ResFONT *, JKRHeap *);
|
||||
JUTResFont(const ResFONT*, JKRHeap*);
|
||||
|
||||
virtual ~JUTResFont(); // _08
|
||||
virtual void setGX(); // _0C
|
||||
virtual void setGX(JUtility::TColor, JUtility::TColor); // _10
|
||||
virtual f32 drawChar_scale(f32, f32, f32, f32, int, bool); // _14
|
||||
virtual int getDescent() const { return mInfoBlock->mDescent; }; // _20
|
||||
virtual int getHeight() const { return getAscent() + getDescent(); }; // _24
|
||||
virtual int getAscent() const { return mInfoBlock->mAscent; }; // _1C
|
||||
virtual int getWidth() const { return mInfoBlock->mWidth; }; // _28
|
||||
virtual void getWidthEntry(int, JUTFont::TWidth *) const; // _2C
|
||||
virtual int getCellWidth() const; // _30
|
||||
virtual int getCellHeight() const; // _34
|
||||
virtual int getFontType() const { return mInfoBlock->mFontType; }; // _38
|
||||
virtual const ResFONT *getResFont() const { return mResource; }; // _3C
|
||||
virtual int getLeading() const { return mInfoBlock->mLeading; }; // _18
|
||||
virtual bool isLeadByte(int) const; // _40
|
||||
virtual void loadImage(int, GXTexMapID); // _44
|
||||
virtual void setBlock(); // _48
|
||||
virtual ~JUTResFont(); // _08
|
||||
virtual void setGX(); // _0C
|
||||
virtual void setGX(JUtility::TColor, JUtility::TColor); // _10
|
||||
virtual f32 drawChar_scale(f32, f32, f32, f32, int, bool); // _14
|
||||
virtual int getDescent() const {
|
||||
return mInfoBlock->mDescent;
|
||||
}; // _20
|
||||
virtual int getHeight() const {
|
||||
return getAscent() + getDescent();
|
||||
}; // _24
|
||||
virtual int getAscent() const {
|
||||
return mInfoBlock->mAscent;
|
||||
}; // _1C
|
||||
virtual int getWidth() const {
|
||||
return mInfoBlock->mWidth;
|
||||
}; // _28
|
||||
virtual void getWidthEntry(int, JUTFont::TWidth*) const; // _2C
|
||||
virtual int getCellWidth() const; // _30
|
||||
virtual int getCellHeight() const; // _34
|
||||
virtual int getFontType() const {
|
||||
return mInfoBlock->mFontType;
|
||||
}; // _38
|
||||
virtual const ResFONT* getResFont() const {
|
||||
return mResource;
|
||||
}; // _3C
|
||||
virtual int getLeading() const {
|
||||
return mInfoBlock->mLeading;
|
||||
}; // _18
|
||||
virtual bool isLeadByte(int) const; // _40
|
||||
virtual void loadImage(int, GXTexMapID); // _44
|
||||
virtual void setBlock(); // _48
|
||||
|
||||
int convertSjis(int, u16 *) const;
|
||||
int convertSjis(int, u16*) const;
|
||||
void countBlock();
|
||||
void deleteMemBlocks_ResFont();
|
||||
int getFontCode(int) const;
|
||||
void initialize_state();
|
||||
bool initiate(const ResFONT *, JKRHeap *);
|
||||
void loadFont(int, GXTexMapID, TWidth *);
|
||||
bool protected_initiate(const ResFONT *, JKRHeap *);
|
||||
bool initiate(const ResFONT*, JKRHeap*);
|
||||
void loadFont(int, GXTexMapID, TWidth*);
|
||||
bool protected_initiate(const ResFONT*, JKRHeap*);
|
||||
|
||||
inline void delete_and_initialize()
|
||||
{
|
||||
inline void delete_and_initialize() {
|
||||
deleteMemBlocks_ResFont();
|
||||
initialize_state();
|
||||
}
|
||||
@@ -256,33 +287,30 @@ struct JUTResFont : public JUTFont
|
||||
int mHeight; // _20
|
||||
GXTexObj _24; // _24
|
||||
int _44; // _44
|
||||
const ResFONT *mResource; // _48
|
||||
ResFONT::InfoBlock *mInfoBlock; // _4C, INF1
|
||||
void **mMemBlocks; // _50
|
||||
ResFONT::WidthBlock **mWidthBlocks; // _54, WID1
|
||||
ResFONT::GlyphBlock **mGlyphBlocks; // _58, GLY1
|
||||
ResFONT::MapBlock **mMapBlocks; // _5C, MAP1
|
||||
const ResFONT* mResource; // _48
|
||||
ResFONT::InfoBlock* mInfoBlock; // _4C, INF1
|
||||
void** mMemBlocks; // _50
|
||||
ResFONT::WidthBlock** mWidthBlocks; // _54, WID1
|
||||
ResFONT::GlyphBlock** mGlyphBlocks; // _58, GLY1
|
||||
ResFONT::MapBlock** mMapBlocks; // _5C, MAP1
|
||||
u16 mWidthBlockCount; // _60
|
||||
u16 mGlyphBlockCount; // _62
|
||||
u16 mMapBlockCount; // _64
|
||||
u16 _66; // _66
|
||||
u16 mMaxCode; // _68
|
||||
IsLeadByte *mIsLeadByte; // _6C
|
||||
IsLeadByte* mIsLeadByte; // _6C
|
||||
};
|
||||
|
||||
struct JUTCacheFont : public JUTResFont
|
||||
{
|
||||
enum EPagingType
|
||||
{
|
||||
struct JUTCacheFont : public JUTResFont {
|
||||
enum EPagingType {
|
||||
CFPAGETYPE_Unk0 = 0,
|
||||
CFPAGETYPE_Unk1 = 1,
|
||||
};
|
||||
|
||||
struct TGlyphCacheInfo
|
||||
{
|
||||
struct TGlyphCacheInfo {
|
||||
// TODO: the rest of the data members
|
||||
TGlyphCacheInfo *mPrev; // _00
|
||||
TGlyphCacheInfo *mNext; // _04
|
||||
TGlyphCacheInfo* mPrev; // _00
|
||||
TGlyphCacheInfo* mNext; // _04
|
||||
u8 _08[4]; // _08
|
||||
u16 _0C; // _0C
|
||||
u16 _0E; // _0E
|
||||
@@ -293,13 +321,12 @@ struct JUTCacheFont : public JUTResFont
|
||||
GXTexObj mGxTexObj; // _20
|
||||
};
|
||||
|
||||
struct TCachePage
|
||||
{
|
||||
struct TCachePage {
|
||||
u8 _00[0x8]; // _00, unknown
|
||||
s16 _08; // _08
|
||||
u16 _0A; // _0A
|
||||
u8 _0C[0x4]; // _0C, unknown
|
||||
u8 *_10; // _10
|
||||
u8* _10; // _10
|
||||
u16 _14; // _14
|
||||
u16 _18; // _18
|
||||
u16 _1C; // _1C
|
||||
@@ -309,58 +336,62 @@ struct JUTCacheFont : public JUTResFont
|
||||
};
|
||||
|
||||
JUTCacheFont();
|
||||
JUTCacheFont(const ResFONT *, void *, u32, JKRHeap *);
|
||||
JUTCacheFont(const ResFONT *, u32, JKRHeap *);
|
||||
JUTCacheFont(const ResFONT*, void*, u32, JKRHeap*);
|
||||
JUTCacheFont(const ResFONT*, u32, JKRHeap*);
|
||||
|
||||
virtual ~JUTCacheFont(); // _08
|
||||
virtual void loadImage(int, _GXTexMapID); // _44
|
||||
virtual void setBlock(); // _48
|
||||
|
||||
bool allocArea(void *, u32, JKRHeap *);
|
||||
bool allocArray(JKRHeap *);
|
||||
bool allocArea(void*, u32, JKRHeap*);
|
||||
bool allocArray(JKRHeap*);
|
||||
void deleteMemBlocks_CacheFont();
|
||||
bool getMemorySize(const ResFONT *, u16 *, u32 *, u16 *, u32 *, u16 *, u32 *, u32 *);
|
||||
bool getMemorySize(const ResFONT*, u16*, u32*, u16*, u32*, u16*, u32*, u32*);
|
||||
void initialize_state();
|
||||
bool initiate(const ResFONT *, void *, u32, JKRHeap *);
|
||||
bool internal_initiate(const ResFONT *, void *, u32, JKRHeap *);
|
||||
bool initiate(const ResFONT*, void*, u32, JKRHeap*);
|
||||
bool internal_initiate(const ResFONT*, void*, u32, JKRHeap*);
|
||||
void invalidiateAllCache();
|
||||
TGlyphCacheInfo *loadCache_char_subroutine(int *, bool);
|
||||
void loadCache_string(const char *, bool);
|
||||
void prepend(TGlyphCacheInfo *);
|
||||
void unlink(TGlyphCacheInfo *);
|
||||
TGlyphCacheInfo* loadCache_char_subroutine(int*, bool);
|
||||
void loadCache_string(const char*, bool);
|
||||
void prepend(TGlyphCacheInfo*);
|
||||
void unlink(TGlyphCacheInfo*);
|
||||
|
||||
// Unused/inlined:
|
||||
void determineBlankPage();
|
||||
void getGlyphFromAram(TGlyphCacheInfo *, TCachePage *, int *, int *);
|
||||
void getGlyphFromAram(TGlyphCacheInfo*, TCachePage*, int*, int*);
|
||||
void loadCache_char(int, bool);
|
||||
void loadCache_string_size(const char *, u32, bool);
|
||||
void loadCache_string_size(const char*, u32, bool);
|
||||
void unlockCache_all();
|
||||
void unlockCache_char(int);
|
||||
void unlockCache_string(const char *);
|
||||
void unlockCache_string_size(const char *, u32);
|
||||
void unlockCache_string(const char*);
|
||||
void unlockCache_string_size(const char*, u32);
|
||||
|
||||
void setPagingType(EPagingType type) { mPagingType = type; }
|
||||
void setPagingType(EPagingType type) {
|
||||
mPagingType = type;
|
||||
}
|
||||
|
||||
static u32 calcCacheSize(u32 param_0, int param_1) { return (ALIGN_NEXT(param_0, 0x20) + 0x40) * param_1; }
|
||||
static u32 calcCacheSize(u32 param_0, int param_1) {
|
||||
return (ALIGN_NEXT(param_0, 0x20) + 0x40) * param_1;
|
||||
}
|
||||
|
||||
// _00 = VTBL
|
||||
// _00-_70 = JUTResFont
|
||||
u32 mWidthBlocksSize; // _70
|
||||
u32 mGlyphBlocksSize; // _74
|
||||
u32 mMapBlocksSize; // _78
|
||||
void *_7C; // _7C
|
||||
void *_80; // _80
|
||||
void *_84; // _84
|
||||
void* _7C; // _7C
|
||||
void* _80; // _80
|
||||
void* _84; // _84
|
||||
u32 mMaxSheetSize; // _88
|
||||
EPagingType mPagingType; // _8C
|
||||
void *mCacheBuffer; // _90
|
||||
void* mCacheBuffer; // _90
|
||||
u32 _94; // _94
|
||||
u32 mCachePage; // _98
|
||||
TGlyphCacheInfo *_9C; // _9C
|
||||
TGlyphCacheInfo *_A0; // _A0
|
||||
void *_A4; // _A4
|
||||
TGlyphCacheInfo* _9C; // _9C
|
||||
TGlyphCacheInfo* _A0; // _A0
|
||||
void* _A4; // _A4
|
||||
u32 _A8; // _A8
|
||||
JKRAramBlock *mAramBlock; // _AC
|
||||
JKRAramBlock* mAramBlock; // _AC
|
||||
u8 _B0; // _B0
|
||||
int _B4; // _B4
|
||||
};
|
||||
|
||||
@@ -10,9 +10,8 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
class JUTGamePadRecordBase
|
||||
{
|
||||
public:
|
||||
class JUTGamePadRecordBase {
|
||||
public:
|
||||
JUTGamePadRecordBase();
|
||||
virtual ~JUTGamePadRecordBase();
|
||||
virtual void read(PADStatus* status) = 0;
|
||||
@@ -27,22 +26,11 @@ public:
|
||||
};
|
||||
|
||||
typedef void (*JUTResetBtnCb)(int, void*);
|
||||
class JUTGamePad : public JKRDisposer
|
||||
{
|
||||
public:
|
||||
enum EPadPort
|
||||
{
|
||||
Port_unknown = -999,
|
||||
Port_Invalid = -1,
|
||||
Port1 = 0,
|
||||
Port2,
|
||||
Port3,
|
||||
Port4,
|
||||
PortRecorder
|
||||
};
|
||||
class JUTGamePad : public JKRDisposer {
|
||||
public:
|
||||
enum EPadPort { Port_unknown = -999, Port_Invalid = -1, Port1 = 0, Port2, Port3, Port4, PortRecorder };
|
||||
|
||||
enum EButtons
|
||||
{
|
||||
enum EButtons {
|
||||
MAINSTICK_UP = 0x8000000,
|
||||
MAINSTICK_DOWN = 0x4000000,
|
||||
MAINSTICK_RIGHT = 0x2000000,
|
||||
@@ -65,24 +53,11 @@ public:
|
||||
DPAD_LEFT = 0x1
|
||||
};
|
||||
|
||||
enum EStickMode
|
||||
{
|
||||
NonClamped,
|
||||
Clamped
|
||||
};
|
||||
enum EStickMode { NonClamped, Clamped };
|
||||
|
||||
enum EClampMode
|
||||
{
|
||||
NoClamp,
|
||||
Clamp,
|
||||
ClampCircle
|
||||
};
|
||||
enum EClampMode { NoClamp, Clamp, ClampCircle };
|
||||
|
||||
enum EWhichStick
|
||||
{
|
||||
WhichStick_MainStick,
|
||||
WhichStick_SubStick
|
||||
};
|
||||
enum EWhichStick { WhichStick_MainStick, WhichStick_SubStick };
|
||||
|
||||
JUTGamePad();
|
||||
JUTGamePad(EPadPort port);
|
||||
@@ -93,7 +68,7 @@ public:
|
||||
void clearForReset();
|
||||
static void init();
|
||||
void initList();
|
||||
void read();
|
||||
static void read();
|
||||
static bool recalibrate(u32);
|
||||
void setButtonRepeat(u32, u32, u32);
|
||||
void update();
|
||||
@@ -235,38 +210,40 @@ public:
|
||||
|
||||
JUTGamePadRecordBase* getPadReplay() const {
|
||||
return this->mPadReplay;
|
||||
}
|
||||
}
|
||||
|
||||
class CButton
|
||||
{
|
||||
public:
|
||||
CButton() { this->clear(); };
|
||||
class CButton {
|
||||
public:
|
||||
CButton() {
|
||||
this->clear();
|
||||
};
|
||||
|
||||
void clear();
|
||||
void update(const PADStatus* padStatus, u32 buttons);
|
||||
void setRepeat(u32 mask, u32 delay, u32 frequency);
|
||||
|
||||
u32 mButton; // buttons held down
|
||||
u32 mTrigger; // buttons newly pressed this frame
|
||||
u32 mRelease; // buttons released this frame
|
||||
u8 mAnalogA; //
|
||||
u8 mAnalogB; //
|
||||
u8 mAnalogL; // left trigger percent
|
||||
u8 mAnalogR; // right trigger percent
|
||||
f32 mAnalogLf; // left trigger analog percent
|
||||
f32 mAnalogRf; // right trigger analog percent
|
||||
u32 mRepeat; // buttons currently marked as "repeated" triggers when held
|
||||
u32 mRepeatTimer; // frames since current button combo has been held
|
||||
u32 mRepeatLastButton; // last buttons pressed
|
||||
u32 mRepeatMask; // button mask to allow repeating trigger inputs
|
||||
u32 mRepeatDelay; // delay before beginning repeated input
|
||||
u32 mRepeatFrequency; // repeat input every X frames
|
||||
u32 mButton; // buttons held down
|
||||
u32 mTrigger; // buttons newly pressed this frame
|
||||
u32 mRelease; // buttons released this frame
|
||||
u8 mAnalogA; //
|
||||
u8 mAnalogB; //
|
||||
u8 mAnalogL; // left trigger percent
|
||||
u8 mAnalogR; // right trigger percent
|
||||
f32 mAnalogLf; // left trigger analog percent
|
||||
f32 mAnalogRf; // right trigger analog percent
|
||||
u32 mRepeat; // buttons currently marked as "repeated" triggers when held
|
||||
u32 mRepeatTimer; // frames since current button combo has been held
|
||||
u32 mRepeatLastButton; // last buttons pressed
|
||||
u32 mRepeatMask; // button mask to allow repeating trigger inputs
|
||||
u32 mRepeatDelay; // delay before beginning repeated input
|
||||
u32 mRepeatFrequency; // repeat input every X frames
|
||||
};
|
||||
|
||||
class CStick
|
||||
{
|
||||
public:
|
||||
CStick() { this->clear(); }
|
||||
class CStick {
|
||||
public:
|
||||
CStick() {
|
||||
this->clear();
|
||||
}
|
||||
|
||||
void clear();
|
||||
u32 update(s8 x, s8 y, JUTGamePad::EStickMode, JUTGamePad::EWhichStick);
|
||||
@@ -278,16 +255,13 @@ public:
|
||||
s16 mAngle;
|
||||
};
|
||||
|
||||
class CRumble
|
||||
{
|
||||
public:
|
||||
enum ERumble {
|
||||
Rumble0,
|
||||
Rumble1,
|
||||
Rumble2
|
||||
};
|
||||
class CRumble {
|
||||
public:
|
||||
enum ERumble { Rumble0, Rumble1, Rumble2 };
|
||||
|
||||
CRumble(JUTGamePad* gamePad) { this->clear(gamePad); }
|
||||
CRumble(JUTGamePad* gamePad) {
|
||||
this->clear(gamePad);
|
||||
}
|
||||
|
||||
static u8 mStatus[PAD_MAX_CONTROLLERS];
|
||||
static u32 mEnabled;
|
||||
@@ -299,7 +273,7 @@ public:
|
||||
static bool isEnabled(u32 channel) {
|
||||
return (JUTGamePad::CRumble::mEnabled & channel) != 0;
|
||||
}
|
||||
|
||||
|
||||
void clear();
|
||||
void clear(JUTGamePad* gamePad);
|
||||
void update(s16);
|
||||
@@ -312,8 +286,10 @@ public:
|
||||
};
|
||||
|
||||
class C3ButtonReset {
|
||||
public:
|
||||
C3ButtonReset() { mReset = false; }
|
||||
public:
|
||||
C3ButtonReset() {
|
||||
mReset = false;
|
||||
}
|
||||
|
||||
static u32 sResetPattern;
|
||||
static u32 sResetMaskPattern;
|
||||
@@ -328,7 +304,9 @@ public:
|
||||
bool mReset;
|
||||
};
|
||||
|
||||
static PADStatus *getPadStatus(int idx) { return &mPadStatus[idx]; }
|
||||
static PADStatus* getPadStatus(int idx) {
|
||||
return &mPadStatus[idx];
|
||||
}
|
||||
|
||||
static JSUList<JUTGamePad> mPadList;
|
||||
static CButton mPadButton[PAD_MAX_CONTROLLERS];
|
||||
@@ -340,21 +318,19 @@ public:
|
||||
static f32 sReleasePoint;
|
||||
static PADStatus mPadStatus[PAD_MAX_CONTROLLERS];
|
||||
|
||||
|
||||
CButton mButtons; // _18
|
||||
CStick mMainStick; // _48
|
||||
CStick mSubStick; // _58
|
||||
CRumble mRumble; // _68
|
||||
s16 mPortNum; // _78
|
||||
s8 mErrorStatus; // _7A
|
||||
JSULink<JUTGamePad> mLink; // _7C
|
||||
CButton mButtons; // _18
|
||||
CStick mMainStick; // _48
|
||||
CStick mSubStick; // _58
|
||||
CRumble mRumble; // _68
|
||||
s16 mPortNum; // _78
|
||||
s8 mErrorStatus; // _7A
|
||||
JSULink<JUTGamePad> mLink; // _7C
|
||||
JUTGamePadRecordBase* mPadRecord;
|
||||
JUTGamePadRecordBase* mPadReplay;
|
||||
u32 _94;
|
||||
C3ButtonReset mButtonReset; // _98
|
||||
OSTime mResetTime; // _A0
|
||||
C3ButtonReset mButtonReset; // _98
|
||||
OSTime mResetTime; // _A0
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
#ifndef _JSYSTEM_JUT_JUTGRAPHFIFO_H
|
||||
#define _JSYSTEM_JUT_JUTGRAPHFIFO_H
|
||||
|
||||
#include "types.h"
|
||||
#include <dolphin/gx.h>
|
||||
|
||||
struct JUTGraphFifo {
|
||||
JUTGraphFifo(u32);
|
||||
|
||||
virtual ~JUTGraphFifo(); // _08
|
||||
|
||||
void becomeCurrent();
|
||||
void setBreakPt();
|
||||
|
||||
void getGpStatus() {
|
||||
GXGetGPStatus((GXBool*)&mGpStatus[0], (GXBool*)&mGpStatus[1], (GXBool*)&mGpStatus[2], (GXBool*)&mGpStatus[3],
|
||||
(GXBool*)&mGpStatus[4]);
|
||||
}
|
||||
|
||||
bool isGPActive() {
|
||||
getGpStatus();
|
||||
return mGpStatus[2] == false;
|
||||
}
|
||||
|
||||
void save() {
|
||||
GXSaveCPUFifo(this->mFifo);
|
||||
}
|
||||
|
||||
static JUTGraphFifo* sCurrentFifo;
|
||||
static GXBool mGpStatus[5];
|
||||
static bool sInitiated;
|
||||
|
||||
// _00 = VTBL
|
||||
GXFifoObj* mFifo; // _04
|
||||
void* mBase; // _08
|
||||
u32 mSize; // _0C
|
||||
u8 _10[0xC]; // _10
|
||||
};
|
||||
|
||||
inline void JUTCreateFifo(u32 bufSize) {
|
||||
new JUTGraphFifo(bufSize);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -9,46 +9,43 @@
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
class JUTProcBar
|
||||
{
|
||||
public:
|
||||
struct CTime
|
||||
{
|
||||
CTime() { clear(); }
|
||||
class JUTProcBar {
|
||||
public:
|
||||
struct CTime {
|
||||
CTime() {
|
||||
clear();
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
void clear() {
|
||||
mCost = 0;
|
||||
_08 = 0;
|
||||
_0C = 0;
|
||||
}
|
||||
|
||||
void start(u8 red, u8 green, u8 blue)
|
||||
{
|
||||
void start(u8 red, u8 green, u8 blue) {
|
||||
mR = red;
|
||||
mG = green;
|
||||
mB = blue;
|
||||
mStartTick = OSGetTick();
|
||||
}
|
||||
|
||||
void end()
|
||||
{
|
||||
void end() {
|
||||
mCost = OSTicksToMicroseconds(OSDiffTick(OSGetTick(), mStartTick));
|
||||
if (mCost == 0)
|
||||
mCost = 1;
|
||||
}
|
||||
|
||||
void accumePeek()
|
||||
{
|
||||
//u32 prev = ++_0C;
|
||||
if (++_0C >= 0x10 || mCost >= _08)
|
||||
{
|
||||
void accumePeek() {
|
||||
// u32 prev = ++_0C;
|
||||
if (++_0C >= 0x10 || mCost >= _08) {
|
||||
_08 = mCost;
|
||||
_0C = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int calcBarSize(int p1, int p2) { return mCost * p1 / p2; }
|
||||
int calcBarSize(int p1, int p2) {
|
||||
return mCost * p1 / p2;
|
||||
}
|
||||
|
||||
u32 mStartTick; // _00
|
||||
u32 mCost; // _04
|
||||
@@ -59,12 +56,17 @@ public:
|
||||
u8 mB; // _12
|
||||
};
|
||||
|
||||
struct CParamSet {
|
||||
void setBarWidth(int w) { mBarWidth = w; };
|
||||
void setWidth(int w) { mWidth = w; }
|
||||
void setUserPosition(int pos) { mUserPosition = pos; }
|
||||
void setPosition(int x, int y)
|
||||
{
|
||||
struct CParamSet {
|
||||
void setBarWidth(int w) {
|
||||
mBarWidth = w;
|
||||
};
|
||||
void setWidth(int w) {
|
||||
mWidth = w;
|
||||
}
|
||||
void setUserPosition(int pos) {
|
||||
mUserPosition = pos;
|
||||
}
|
||||
void setPosition(int x, int y) {
|
||||
mPosX = x;
|
||||
mPosY = y;
|
||||
}
|
||||
@@ -76,7 +78,7 @@ public:
|
||||
/* 0x10 */ int mUserPosition;
|
||||
};
|
||||
|
||||
JUTProcBar(); // unused / inlined
|
||||
JUTProcBar(); // unused / inlined
|
||||
~JUTProcBar(); // unused / inlined
|
||||
|
||||
static JUTProcBar* create();
|
||||
@@ -89,7 +91,7 @@ public:
|
||||
|
||||
// Unused Functions / Inlines
|
||||
void bar_subroutine(int, int, int, int, int, int, int, JUtility::TColor, JUtility::TColor);
|
||||
void adjustMeterLength(u32, f32 *, f32, f32, int *);
|
||||
void adjustMeterLength(u32, f32*, f32, f32, int*);
|
||||
void getUnuseUserBar();
|
||||
|
||||
u32 getGpCost() const {
|
||||
@@ -108,21 +110,49 @@ public:
|
||||
return sManager;
|
||||
}
|
||||
|
||||
void idleStart() { mIdle.start(255, 129, 30); }
|
||||
void idleEnd() { mIdle.end(); }
|
||||
void gpStart() { mGp.start(255, 129, 30); }
|
||||
void gpEnd() { mGp.end(); }
|
||||
void cpuStart() { mCpu.start(255, 129, 30); }
|
||||
void cpuEnd() { mCpu.end(); }
|
||||
void gpWaitStart() { mGpWait.start(255, 129, 30); }
|
||||
void gpWaitEnd() { mGpWait.end(); }
|
||||
void wholeLoopStart() { mWholeLoop.start(255, 129, 30); }
|
||||
void wholeLoopEnd() { mWholeLoop.end(); }
|
||||
void idleStart() {
|
||||
mIdle.start(255, 129, 30);
|
||||
}
|
||||
void idleEnd() {
|
||||
mIdle.end();
|
||||
}
|
||||
void gpStart() {
|
||||
mGp.start(255, 129, 30);
|
||||
}
|
||||
void gpEnd() {
|
||||
mGp.end();
|
||||
}
|
||||
void cpuStart() {
|
||||
mCpu.start(255, 129, 30);
|
||||
}
|
||||
void cpuEnd() {
|
||||
mCpu.end();
|
||||
}
|
||||
void gpWaitStart() {
|
||||
mGpWait.start(255, 129, 30);
|
||||
}
|
||||
void gpWaitEnd() {
|
||||
mGpWait.end();
|
||||
}
|
||||
void wholeLoopStart() {
|
||||
mWholeLoop.start(255, 129, 30);
|
||||
}
|
||||
void wholeLoopEnd() {
|
||||
mWholeLoop.end();
|
||||
}
|
||||
|
||||
void setCostFrame(int frame) { mCostFrame = frame; }
|
||||
void setVisible(bool visible) { mVisible = visible; }
|
||||
bool isVisible() { return mVisible; }
|
||||
void setHeapBarVisible(bool visible) { mHeapBarVisible = visible; }
|
||||
void setCostFrame(int frame) {
|
||||
mCostFrame = frame;
|
||||
}
|
||||
void setVisible(bool visible) {
|
||||
mVisible = visible;
|
||||
}
|
||||
bool isVisible() {
|
||||
return mVisible;
|
||||
}
|
||||
void setHeapBarVisible(bool visible) {
|
||||
mHeapBarVisible = visible;
|
||||
}
|
||||
void userStart(int idx, u8 p2, u8 p3, u8 p4) {
|
||||
sManager->mUsers[idx].start(p2, p3, p4);
|
||||
sManager->_108 |= 1 << idx;
|
||||
@@ -136,22 +166,22 @@ public:
|
||||
return mParams.mBarWidth * 2;
|
||||
}
|
||||
|
||||
static JUTProcBar* sManager; // might be private too
|
||||
private:
|
||||
CTime mIdle; // _00
|
||||
CTime mGp; // _14
|
||||
CTime mCpu; // _28
|
||||
CTime mGpWait; // _3C
|
||||
CTime mWholeLoop; // _50
|
||||
CTime mUsers[8]; // _64
|
||||
int mCostFrame; // _104
|
||||
u32 _108; // _108, active users?
|
||||
bool mVisible; // _10C
|
||||
int _110; // _110
|
||||
CParamSet mParams; // _114
|
||||
int _128; // _128
|
||||
JKRHeap* mWatchHeap; // _12C
|
||||
bool mHeapBarVisible; // _130
|
||||
static JUTProcBar* sManager; // might be private too
|
||||
private:
|
||||
CTime mIdle; // _00
|
||||
CTime mGp; // _14
|
||||
CTime mCpu; // _28
|
||||
CTime mGpWait; // _3C
|
||||
CTime mWholeLoop; // _50
|
||||
CTime mUsers[8]; // _64
|
||||
int mCostFrame; // _104
|
||||
u32 _108; // _108, active users?
|
||||
bool mVisible; // _10C
|
||||
int _110; // _110
|
||||
CParamSet mParams; // _114
|
||||
int _128; // _128
|
||||
JKRHeap* mWatchHeap; // _12C
|
||||
bool mHeapBarVisible; // _130
|
||||
}; // 0x134 size
|
||||
#endif
|
||||
|
||||
|
||||
@@ -8,55 +8,73 @@
|
||||
#include "dolphin/vi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
/**
|
||||
* @size{0x58}
|
||||
*/
|
||||
|
||||
typedef u8 (*Pattern)[2];
|
||||
|
||||
struct JUTVideo
|
||||
{
|
||||
JUTVideo(const _GXRenderModeObj *);
|
||||
struct JUTVideo {
|
||||
JUTVideo(const GXRenderModeObj*);
|
||||
|
||||
virtual ~JUTVideo(); // _08
|
||||
|
||||
static JUTVideo *createManager(const _GXRenderModeObj *);
|
||||
static JUTVideo* createManager(const GXRenderModeObj*);
|
||||
static void destroyManager();
|
||||
static void preRetraceProc(unsigned long);
|
||||
static void postRetraceProc(unsigned long);
|
||||
static void drawDoneCallback();
|
||||
|
||||
u16 getEfbHeight() const { return mRenderModeObj->efbHeight; }
|
||||
u16 getFbWidth() const { return mRenderModeObj->fbWidth; }
|
||||
u32 getEfbHeight() const {
|
||||
return mRenderModeObj->efbHeight;
|
||||
}
|
||||
u32 getXfbHeight() const {
|
||||
return mRenderModeObj->xfbHeight & 0xffff;
|
||||
}
|
||||
u32 getFbWidth() const {
|
||||
return (u16)mRenderModeObj->fbWidth;
|
||||
}
|
||||
void getBounds(u16& width, u16& height) const {
|
||||
width = getFbWidth();
|
||||
height = getEfbHeight();
|
||||
}
|
||||
_GXRenderModeObj *getRenderMode() const { return mRenderModeObj; }
|
||||
u16 getXfbHeight() const { return mRenderModeObj->xfbHeight; }
|
||||
u32 isAntiAliasing() const { return mRenderModeObj->aa; }
|
||||
Pattern getSamplePattern() const { return mRenderModeObj->sample_pattern; }
|
||||
u8 *getVFilter() const { return mRenderModeObj->vfilter; }
|
||||
OSMessageQueue *getMessageQueue() { return &mMessageQueue; };
|
||||
GXRenderModeObj* getRenderMode() const {
|
||||
return mRenderModeObj;
|
||||
}
|
||||
u32 isAntiAliasing() const {
|
||||
return mRenderModeObj->aa;
|
||||
}
|
||||
Pattern getSamplePattern() const {
|
||||
return mRenderModeObj->sample_pattern;
|
||||
}
|
||||
u8* getVFilter() const {
|
||||
return mRenderModeObj->vfilter;
|
||||
}
|
||||
OSMessageQueue* getMessageQueue() {
|
||||
return &mMessageQueue;
|
||||
};
|
||||
static void drawDoneStart();
|
||||
static void dummyNoDrawWait();
|
||||
void setRenderMode(const _GXRenderModeObj *);
|
||||
void setRenderMode(const GXRenderModeObj*);
|
||||
void waitRetraceIfNeed(); // blr, global
|
||||
VIRetraceCallback setPostRetraceCallback(VIRetraceCallback);
|
||||
|
||||
// Unused/inlined:
|
||||
void getDrawWait();
|
||||
VIRetraceCallback setPreRetraceCallback(VIRetraceCallback);
|
||||
void getPixelAspect(const _GXRenderModeObj *);
|
||||
void getPixelAspect(const GXRenderModeObj*);
|
||||
void getPixelAspect() const;
|
||||
|
||||
// Static inline gets
|
||||
static JUTVideo *getManager() { return sManager; }
|
||||
static OSTick getVideoInterval() { return sVideoInterval; }
|
||||
static OSTick getVideoLastTick() { return sVideoLastTick; }
|
||||
static JUTVideo* getManager() {
|
||||
return sManager;
|
||||
}
|
||||
static OSTick getVideoInterval() {
|
||||
return sVideoInterval;
|
||||
}
|
||||
static OSTick getVideoLastTick() {
|
||||
return sVideoLastTick;
|
||||
}
|
||||
|
||||
// _00 VTBL
|
||||
GXRenderModeObj *mRenderModeObj; // _04
|
||||
GXRenderModeObj* mRenderModeObj; // _04
|
||||
u32 _08; // _08
|
||||
u32 mRetraceCount; // _0C
|
||||
int _10; // _10
|
||||
@@ -71,12 +89,12 @@ struct JUTVideo
|
||||
OSMessage mMessage; // _34
|
||||
OSMessageQueue mMessageQueue; // _38
|
||||
|
||||
static JUTVideo *sManager;
|
||||
static JUTVideo* sManager;
|
||||
static OSTick sVideoLastTick;
|
||||
static OSTick sVideoInterval;
|
||||
};
|
||||
|
||||
inline JUTVideo *JUTGetVideoManager() {
|
||||
inline JUTVideo* JUTGetVideoManager() {
|
||||
return JUTVideo::getManager();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
#ifndef _JSYSTEM_JUT_JUTXFB_H
|
||||
#define _JSYSTEM_JUT_JUTXFB_H
|
||||
|
||||
#include <dolphin/gx.h>
|
||||
#include <JSystem/JKernel/JKRHeap.h>
|
||||
#include "types.h"
|
||||
|
||||
struct JUTExternalFB {
|
||||
JUTExternalFB(GXRenderModeObj*, GXGamma, void*, u32);
|
||||
|
||||
GXRenderModeObj* mRenderModeObj; // _00
|
||||
u32 mSize; // _04
|
||||
u8 _08[4]; // _08
|
||||
u16 _0C; // _0C
|
||||
u16 mGamma; // _0E, treat as GXGamma
|
||||
bool _10; // _10
|
||||
};
|
||||
|
||||
class JUTXfb {
|
||||
public:
|
||||
enum EXfbNumber { Unset = 0, SingleBuffer = 1, DoubleBuffer = 2, TripleBuffer = 3 };
|
||||
|
||||
void clearIndex();
|
||||
void common_init(int);
|
||||
JUTXfb(const GXRenderModeObj*, JKRHeap*, JUTXfb::EXfbNumber);
|
||||
~JUTXfb();
|
||||
void delXfb(int);
|
||||
static JUTXfb* createManager(const GXRenderModeObj* rmode, JKRHeap*, JUTXfb::EXfbNumber);
|
||||
static void destroyManager();
|
||||
void initiate(u16, u16, JKRHeap*, JUTXfb::EXfbNumber);
|
||||
u32 accumeXfbSize();
|
||||
|
||||
int getBufferNum() const {
|
||||
return mBufferNum;
|
||||
}
|
||||
int getDrawnXfbIndex() const {
|
||||
return mDrawnXfbIndex;
|
||||
}
|
||||
s16 getDrawingXfbIndex() const {
|
||||
return mDrawingXfbIndex;
|
||||
}
|
||||
s16 getDisplayingXfbIndex() const {
|
||||
return mDisplayingXfbIndex;
|
||||
}
|
||||
int getSDrawingFlag() const {
|
||||
return mSDrawingFlag;
|
||||
}
|
||||
|
||||
void* getXfb(int index) const {
|
||||
return mBuffer[index];
|
||||
}
|
||||
|
||||
void* getDrawnXfb() const {
|
||||
return (mDrawnXfbIndex >= 0) ? mBuffer[mDrawnXfbIndex] : nullptr;
|
||||
}
|
||||
|
||||
void* getDrawingXfb() const {
|
||||
return (mDrawingXfbIndex >= 0) ? mBuffer[mDrawingXfbIndex] : nullptr;
|
||||
}
|
||||
|
||||
void* getDisplayingXfb() const {
|
||||
return (mDisplayingXfbIndex >= 0) ? mBuffer[mDisplayingXfbIndex] : nullptr;
|
||||
}
|
||||
|
||||
void setBufferNum(int num) {
|
||||
mBufferNum = num;
|
||||
}
|
||||
void setDisplayingXfbIndex(s16 index) {
|
||||
mDisplayingXfbIndex = index;
|
||||
}
|
||||
void setSDrawingFlag(s32 flag) {
|
||||
mSDrawingFlag = flag;
|
||||
}
|
||||
void setDrawnXfbIndex(s16 index) {
|
||||
mDrawnXfbIndex = index;
|
||||
}
|
||||
void setDrawingXfbIndex(s16 index) {
|
||||
mDrawingXfbIndex = index;
|
||||
}
|
||||
|
||||
static JUTXfb* getManager() {
|
||||
return sManager;
|
||||
}
|
||||
|
||||
private:
|
||||
static JUTXfb* sManager;
|
||||
|
||||
private:
|
||||
void* mBuffer[3]; // 00
|
||||
bool mXfbAllocated[3]; // 0c
|
||||
int mBufferNum; // 10
|
||||
s16 mDrawingXfbIndex; // 14
|
||||
s16 mDrawnXfbIndex; // 16
|
||||
s16 mDisplayingXfbIndex; // 18
|
||||
s32 mSDrawingFlag; // 1a
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -11,63 +11,82 @@ extern "C" {
|
||||
#define TCOLOR_BLACK JUtility::TColor(0, 0, 0, 0)
|
||||
|
||||
namespace JUtility {
|
||||
struct TColor : public GXColor {
|
||||
TColor() { set(0xFFFFFFFF); }
|
||||
struct TColor : public GXColor {
|
||||
TColor() {
|
||||
set(0xFFFFFFFF);
|
||||
}
|
||||
|
||||
TColor(u8 _r, u8 _g, u8 _b, u8 _a) { set(_r, _g, _b, _a); }
|
||||
TColor(u8 _r, u8 _g, u8 _b, u8 _a) {
|
||||
set(_r, _g, _b, _a);
|
||||
}
|
||||
|
||||
TColor(u32 u32Color) { set(u32Color); }
|
||||
TColor(u32 u32Color) {
|
||||
set(u32Color);
|
||||
}
|
||||
|
||||
TColor(GXColor color) { set(color); }
|
||||
TColor(GXColor color) {
|
||||
set(color);
|
||||
}
|
||||
|
||||
TColor &operator=(const TColor &other) {
|
||||
((GXColor *)this)->operator=(other);
|
||||
return *this;
|
||||
TColor& operator=(const TColor& other) {
|
||||
((GXColor*)this)->operator=(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** @fabricated */
|
||||
TColor &operator=(const GXColorS10 &other) {
|
||||
r = other.r;
|
||||
g = other.g;
|
||||
b = other.b;
|
||||
a = other.a;
|
||||
return *this;
|
||||
TColor& operator=(const GXColorS10& other) {
|
||||
r = other.r;
|
||||
g = other.g;
|
||||
b = other.b;
|
||||
a = other.a;
|
||||
return *this;
|
||||
}
|
||||
|
||||
operator u32() const { return toUInt32(); }
|
||||
u32 toUInt32() const { return *(u32 *)&r; }
|
||||
operator u32() const {
|
||||
return toUInt32();
|
||||
}
|
||||
u32 toUInt32() const {
|
||||
return *(u32*)&r;
|
||||
}
|
||||
|
||||
void set(u8 cR, u8 cG, u8 cB, u8 cA) {
|
||||
r = cR;
|
||||
g = cG;
|
||||
b = cB;
|
||||
a = cA;
|
||||
r = cR;
|
||||
g = cG;
|
||||
b = cB;
|
||||
a = cA;
|
||||
}
|
||||
|
||||
void set(u32 u32Color) { *(u32 *)&r = u32Color; }
|
||||
void set(u32 u32Color) {
|
||||
*(u32*)&r = u32Color;
|
||||
}
|
||||
|
||||
void set(GXColor gxColor) { *(GXColor *)&r = gxColor; }
|
||||
void set(TColor color) { *this = color; }
|
||||
void set(GXColor gxColor) {
|
||||
*(GXColor*)&r = gxColor;
|
||||
}
|
||||
void set(TColor color) {
|
||||
*this = color;
|
||||
}
|
||||
|
||||
void setRGB(u8 cR, u8 cG, u8 cB) {
|
||||
r = cR;
|
||||
g = cG;
|
||||
b = cB;
|
||||
r = cR;
|
||||
g = cG;
|
||||
b = cB;
|
||||
}
|
||||
|
||||
void setRGB(const TColor &other) { setRGB(other.r, other.g, other.b); }
|
||||
void setRGB(const TColor& other) {
|
||||
setRGB(other.r, other.g, other.b);
|
||||
}
|
||||
|
||||
void setRGBA(const TColor &other) {
|
||||
r = other.r;
|
||||
g = other.g;
|
||||
b = other.b;
|
||||
a = other.a;
|
||||
void setRGBA(const TColor& other) {
|
||||
r = other.r;
|
||||
g = other.g;
|
||||
b = other.b;
|
||||
a = other.a;
|
||||
}
|
||||
|
||||
// _00 = GXColor (_00 = r, _01 = g, _02 = b, _03 = a)
|
||||
};
|
||||
};
|
||||
} // namespace JUtility
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+37
-34
@@ -11,48 +11,51 @@ typedef u8 _JUTTransparency;
|
||||
#endif
|
||||
|
||||
enum {
|
||||
ResTIMG_FORMAT_C8 = 9
|
||||
// TODO: others
|
||||
ResTIMG_FORMAT_C8 = 9
|
||||
// TODO: others
|
||||
};
|
||||
|
||||
enum {
|
||||
ResTIMG_NO_PALETTE,
|
||||
ResTIMG_PALETTE
|
||||
};
|
||||
enum { ResTIMG_NO_PALETTE, ResTIMG_PALETTE };
|
||||
|
||||
struct ResTIMG {
|
||||
inline BOOL isMIPmapEnabled() const { return (mIsMIPmapEnabled > 0); }
|
||||
inline BOOL isMIPmapEnabled() const {
|
||||
return (mIsMIPmapEnabled > 0);
|
||||
}
|
||||
|
||||
inline u16 getWidth() const { return mSizeX; }
|
||||
inline u16 getHeight() const { return mSizeY; }
|
||||
inline u16 getWidth() const {
|
||||
return mSizeX;
|
||||
}
|
||||
inline u16 getHeight() const {
|
||||
return mSizeY;
|
||||
}
|
||||
|
||||
u8 mTextureFormat; // _00
|
||||
_JUTTransparency mTransparency; // _01
|
||||
u16 mSizeX; // _02
|
||||
u16 mSizeY; // _04
|
||||
u8 mWrapS; // _06
|
||||
u8 mWrapT; // _07
|
||||
u8 mPaletteFormat; // _08
|
||||
u8 mColorFormat; // _09
|
||||
u16 mPaletteEntryCount; // _0A
|
||||
u32 mPaletteOffset; // _0C
|
||||
GXBool mIsMIPmapEnabled; // _10
|
||||
GXBool mDoEdgeLOD; // _11
|
||||
GXBool mIsBiasClamp; // _12
|
||||
GXBool mIsMaxAnisotropy; // _13
|
||||
u8 mMinFilterType; // _14
|
||||
u8 mMagFilterType; // _15
|
||||
s8 mMinLOD; // _16
|
||||
s8 mMaxLOD; // _17
|
||||
u8 mTotalImageCount; // _18
|
||||
u8 _19; // _19, unknown
|
||||
s16 mLODBias; // _1A
|
||||
u32 mImageDataOffset; // _1C
|
||||
u8 mTextureFormat; // _00
|
||||
_JUTTransparency mTransparency; // _01
|
||||
u16 mSizeX; // _02
|
||||
u16 mSizeY; // _04
|
||||
u8 mWrapS; // _06
|
||||
u8 mWrapT; // _07
|
||||
u8 mPaletteFormat; // _08
|
||||
u8 mColorFormat; // _09
|
||||
u16 mPaletteEntryCount; // _0A
|
||||
u32 mPaletteOffset; // _0C
|
||||
GXBool mIsMIPmapEnabled; // _10
|
||||
GXBool mDoEdgeLOD; // _11
|
||||
GXBool mIsBiasClamp; // _12
|
||||
GXBool mIsMaxAnisotropy; // _13
|
||||
u8 mMinFilterType; // _14
|
||||
u8 mMagFilterType; // _15
|
||||
s8 mMinLOD; // _16
|
||||
s8 mMaxLOD; // _17
|
||||
u8 mTotalImageCount; // _18
|
||||
u8 _19; // _19, unknown
|
||||
s16 mLODBias; // _1A
|
||||
u32 mImageDataOffset; // _1C
|
||||
};
|
||||
|
||||
struct ResTIMGPair {
|
||||
ResTIMG _00;
|
||||
ResTIMG _20;
|
||||
ResTIMG _00;
|
||||
ResTIMG _20;
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
#ifndef _MSL_COMMON_FLOAT_H
|
||||
#define _MSL_COMMON_FLOAT_H
|
||||
|
||||
#include "MSL_C/MSL_Common_Embedded/Math/fdlibm.h"
|
||||
|
||||
#define FP_SNAN 0
|
||||
#define FP_QNAN 1
|
||||
#define FP_INFINITE 2
|
||||
#define FP_ZERO 3
|
||||
#define FP_NORMAL 4
|
||||
#define FP_SUBNORMAL 5
|
||||
|
||||
#define FP_NAN FP_QNAN
|
||||
|
||||
#define fpclassify(x) \
|
||||
((sizeof(x) == sizeof(float)) ? __fpclassifyf(x) : __fpclassifyd(x))
|
||||
#define signbit(x) \
|
||||
((sizeof(x) == sizeof(float)) ? __signbitf(x) : __signbitd(x))
|
||||
#define isfinite(x) ((fpclassify(x) > 2))
|
||||
#define isnan(x) ((fpclassify(x) == FP_NAN))
|
||||
#define isinf(x) ((fpclassify(x) == FP_INFINITE))
|
||||
|
||||
#define __signbitf(x) ((int)(__HI(x) & 0x80000000))
|
||||
|
||||
// TODO: OK?
|
||||
#define __signbitd(x) ((int)(__HI(x) & 0x80000000))
|
||||
|
||||
extern unsigned long __float_nan[];
|
||||
extern unsigned long __float_huge[];
|
||||
extern unsigned long __float_max[];
|
||||
extern unsigned long __float_epsilon[];
|
||||
|
||||
inline int __fpclassifyf(float __value)
|
||||
{
|
||||
unsigned long integer = *(unsigned long*)&__value;
|
||||
|
||||
switch (integer & 0x7f800000) {
|
||||
case 0x7f800000:
|
||||
if ((integer & 0x7fffff) != 0) {
|
||||
return FP_QNAN;
|
||||
}
|
||||
return FP_INFINITE;
|
||||
|
||||
case 0:
|
||||
if ((integer & 0x7fffff) != 0) {
|
||||
return FP_SUBNORMAL;
|
||||
}
|
||||
return FP_ZERO;
|
||||
}
|
||||
|
||||
return FP_NORMAL;
|
||||
}
|
||||
|
||||
inline int __fpclassifyd(double __value)
|
||||
{
|
||||
switch (__HI(__value) & 0x7ff00000) {
|
||||
case 0x7ff00000: {
|
||||
if ((__HI(__value) & 0x000fffff) || (__LO(__value) & 0xffffffff))
|
||||
return FP_QNAN;
|
||||
else
|
||||
return FP_INFINITE;
|
||||
break;
|
||||
}
|
||||
case 0: {
|
||||
if ((__HI(__value) & 0x000fffff) || (__LO(__value) & 0xffffffff))
|
||||
return FP_SUBNORMAL;
|
||||
else
|
||||
return FP_ZERO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return FP_NORMAL;
|
||||
}
|
||||
|
||||
#define FLT_MANT_DIG 24
|
||||
#define FLT_DIG 6
|
||||
#define FLT_MIN_EXP (-125)
|
||||
#define FLT_MIN_10_EXP (-37)
|
||||
#define FLT_MAX_EXP 128
|
||||
#define FLT_MAX_10_EXP 38
|
||||
|
||||
//#define FLT_MAX 3.40282346638528860e+38f
|
||||
#define FLT_EPSILON 1.1920928955078125e-07f
|
||||
|
||||
#define DBL_MANT_DIG 53
|
||||
#define DBL_DIG 15
|
||||
#define DBL_MIN_EXP (-1021)
|
||||
#define DBL_MIN_10_EXP (-308)
|
||||
#define DBL_MAX_EXP 1024
|
||||
#define DBL_MAX_10_EXP 308
|
||||
|
||||
#endif /* _MSL_COMMON_FLOAT_H */
|
||||
@@ -0,0 +1,234 @@
|
||||
#ifndef _FDLIBM_H
|
||||
#define _FDLIBM_H
|
||||
|
||||
/* @(#)fdlibm.h 1.5 04/04/22 */
|
||||
/**
|
||||
* ====================================================
|
||||
* Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // ifdef __cplusplus
|
||||
|
||||
/* Sometimes it's necessary to define __LITTLE_ENDIAN explicitly
|
||||
but these catch some common cases. */
|
||||
|
||||
#if defined(i386) || defined(i486) || defined(intel) || defined(x86) \
|
||||
|| defined(i86pc) || defined(__alpha) || defined(__osf__)
|
||||
#define __LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __LITTLE_ENDIAN
|
||||
#define __HI(x) *(1 + (int*)&x)
|
||||
#define __LO(x) *(int*)&x
|
||||
#define __HIp(x) *(1 + (int*)x)
|
||||
#define __LOp(x) *(int*)x
|
||||
#else
|
||||
#define __HI(x) *(int*)&x
|
||||
#define __LO(x) *(1 + (int*)&x)
|
||||
#define __HIp(x) *(int*)x
|
||||
#define __LOp(x) *(1 + (int*)x)
|
||||
#endif
|
||||
|
||||
// NOTE: should be enabled according to w_atan2.c
|
||||
#define _IEEE_LIBM
|
||||
|
||||
// TODO: should __STDC__ actually be defined?
|
||||
// #ifdef __STDC__
|
||||
#define __P(p) p
|
||||
// #else
|
||||
// #define __P(p) ()
|
||||
// #endif
|
||||
|
||||
/**
|
||||
* ANSI/POSIX
|
||||
*/
|
||||
|
||||
extern int signgam;
|
||||
|
||||
#define MAXFLOAT ((f32)3.40282346638528860e+38)
|
||||
|
||||
enum fdversion { fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix };
|
||||
|
||||
#define _LIB_VERSION_TYPE enum fdversion
|
||||
#define _LIB_VERSION _fdlib_version
|
||||
|
||||
/* if global variable _LIB_VERSION is not desirable, one may
|
||||
* change the following to be a constant by:
|
||||
* #define _LIB_VERSION_TYPE const enum version
|
||||
* In that case, after one initializes the value _LIB_VERSION (see
|
||||
* s_lib_version.c) during compile time, it cannot be modified
|
||||
* in the middle of a program
|
||||
*/
|
||||
extern _LIB_VERSION_TYPE _LIB_VERSION;
|
||||
|
||||
#define _IEEE_ fdlibm_ieee
|
||||
#define _SVID_ fdlibm_svid
|
||||
#define _XOPEN_ fdlibm_xopen
|
||||
#define _POSIX_ fdlibm_posix
|
||||
|
||||
struct exception {
|
||||
int type;
|
||||
char* name;
|
||||
double arg1;
|
||||
double arg2;
|
||||
double retval;
|
||||
};
|
||||
|
||||
#define HUGE MAXFLOAT
|
||||
|
||||
/**
|
||||
* set X_TLOSS = pi*2**52, which is possibly defined in <values.h>
|
||||
* (one may replace the following line by "#include <values.h>")
|
||||
*/
|
||||
|
||||
#define X_TLOSS 1.41484755040568800000e+16
|
||||
|
||||
#define DOMAIN 1
|
||||
#define SING 2
|
||||
#define OVERFLOW 3
|
||||
#define UNDERFLOW 4
|
||||
#define TLOSS 5
|
||||
#define PLOSS 6
|
||||
|
||||
/**
|
||||
* ANSI/POSIX
|
||||
*/
|
||||
extern double acos __P((double));
|
||||
extern double asin __P((double));
|
||||
extern double atan __P((double));
|
||||
extern double atan2 __P((double, double));
|
||||
extern double cos __P((double));
|
||||
extern double sin __P((double));
|
||||
extern double tan __P((double));
|
||||
|
||||
extern double cosh __P((double));
|
||||
extern double sinh __P((double));
|
||||
extern double tanh __P((double));
|
||||
|
||||
extern double exp __P((double));
|
||||
extern double frexp __P((double, int*));
|
||||
extern double ldexp __P((double, int));
|
||||
extern double scalbn __P((double, int));
|
||||
extern double log __P((double));
|
||||
extern double log10 __P((double));
|
||||
extern double modf __P((double, double*));
|
||||
|
||||
extern double pow __P((double, double));
|
||||
extern double sqrt __P((double));
|
||||
|
||||
extern double ceil __P((double));
|
||||
extern double fabs __P((double));
|
||||
// NOTE: I have no idea how they got it to mangle like this
|
||||
extern double fabs__Fd(double);
|
||||
extern double floor __P((double));
|
||||
extern double fmod __P((double, double));
|
||||
|
||||
extern double erf __P((double));
|
||||
extern double erfc __P((double));
|
||||
extern double gamma __P((double));
|
||||
extern double hypot __P((double, double));
|
||||
extern int isnan __P((double));
|
||||
extern int finite __P((double));
|
||||
extern double j0 __P((double));
|
||||
extern double j1 __P((double));
|
||||
extern double jn __P((int, double));
|
||||
extern double lgamma __P((double));
|
||||
extern double y0 __P((double));
|
||||
extern double y1 __P((double));
|
||||
extern double yn __P((int, double));
|
||||
|
||||
extern double acosh __P((double));
|
||||
extern double asinh __P((double));
|
||||
extern double atanh __P((double));
|
||||
extern double cbrt __P((double));
|
||||
extern double logb __P((double));
|
||||
extern double nextafter __P((double, double));
|
||||
extern double remainder __P((double, double));
|
||||
#ifdef _SCALB_INT
|
||||
extern double scalb __P((double, int));
|
||||
#else
|
||||
extern double scalb __P((double, double));
|
||||
#endif
|
||||
|
||||
extern int matherr __P((struct exception*));
|
||||
|
||||
/**
|
||||
* IEEE Test Vector
|
||||
*/
|
||||
extern double significand __P((double));
|
||||
|
||||
/**
|
||||
* Functions callable from C, intended to support IEEE arithmetic.
|
||||
*/
|
||||
extern double copysign __P((double, double));
|
||||
extern int ilogb __P((double));
|
||||
extern double rint __P((double));
|
||||
extern double scalbn __P((double, int));
|
||||
|
||||
/**
|
||||
* BSD math library entry points
|
||||
*/
|
||||
extern double expm1 __P((double));
|
||||
extern double log1p __P((double));
|
||||
|
||||
/**
|
||||
* Reentrant version of gamma & lgamma; passes signgam back by reference
|
||||
* as the second argument; user must allocate space for signgam.
|
||||
*/
|
||||
#ifdef _REENTRANT
|
||||
extern double gamma_r __P((double, int*));
|
||||
extern double lgamma_r __P((double, int*));
|
||||
#endif /* _REENTRANT */
|
||||
|
||||
/* ieee style elementary functions */
|
||||
extern double __ieee754_sqrt __P((double));
|
||||
extern double __ieee754_acos __P((double));
|
||||
extern double __ieee754_acosh __P((double));
|
||||
extern double __ieee754_log __P((double));
|
||||
extern double __ieee754_atanh __P((double));
|
||||
extern double __ieee754_asin __P((double));
|
||||
extern double __ieee754_atan2 __P((double, double));
|
||||
extern double __ieee754_exp __P((double));
|
||||
extern double __ieee754_cosh __P((double));
|
||||
extern double __ieee754_fmod __P((double, double));
|
||||
extern double __ieee754_pow __P((double, double));
|
||||
extern double __ieee754_lgamma_r __P((double, int*));
|
||||
extern double __ieee754_gamma_r __P((double, int*));
|
||||
extern double __ieee754_lgamma __P((double));
|
||||
extern double __ieee754_gamma __P((double));
|
||||
extern double __ieee754_log10 __P((double));
|
||||
extern double __ieee754_sinh __P((double));
|
||||
extern double __ieee754_hypot __P((double, double));
|
||||
extern double __ieee754_j0 __P((double));
|
||||
extern double __ieee754_j1 __P((double));
|
||||
extern double __ieee754_y0 __P((double));
|
||||
extern double __ieee754_y1 __P((double));
|
||||
extern double __ieee754_jn __P((int, double));
|
||||
extern double __ieee754_yn __P((int, double));
|
||||
extern double __ieee754_remainder __P((double, double));
|
||||
extern int __ieee754_rem_pio2 __P((double, double*));
|
||||
#ifdef _SCALB_INT
|
||||
extern double __ieee754_scalb __P((double, int));
|
||||
#else
|
||||
extern double __ieee754_scalb __P((double, double));
|
||||
#endif
|
||||
|
||||
/* fdlibm kernel function */
|
||||
extern double __kernel_standard __P((double, double, int));
|
||||
extern double __kernel_sin __P((double, double, int));
|
||||
extern double __kernel_cos __P((double, double));
|
||||
extern double __kernel_tan __P((double, double, int));
|
||||
extern int __kernel_rem_pio2 __P((double*, double*, int, int, int, const int*));
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif // ifdef __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -21,6 +21,8 @@ extern double sin(double deg);
|
||||
extern double cos(double deg);
|
||||
extern double tan(double deg);
|
||||
|
||||
extern double ceil(double);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -10,6 +10,8 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
extern int vprintf(const char*, va_list);
|
||||
extern int vsprintf(char*, const char*, va_list);
|
||||
extern int vsnprintf(char*, size_t, const char*, va_list);
|
||||
extern int printf(const char*, ...);
|
||||
int snprintf(char* s, size_t n, const char* format, ...);
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef W_MATH_H
|
||||
#define W_MATH_H
|
||||
|
||||
#include "MSL_C/MSL_Common/float.h"
|
||||
|
||||
#ifndef BUGFIXES
|
||||
#define SQRTF_LINKAGE extern
|
||||
#else
|
||||
@@ -47,11 +49,6 @@ inline float fabsf(float x) {
|
||||
return (float)fabs((double)x);
|
||||
}
|
||||
|
||||
int __float_huge[];
|
||||
int __float_nan[];
|
||||
int __double_huge[];
|
||||
int __extended_huge[];
|
||||
|
||||
#define INFINITY (*(float*)__float_huge)
|
||||
#define NAN (*(float*)__float_nan)
|
||||
#define HUGE_VALF (*(float*)__float_huge)
|
||||
@@ -76,8 +73,8 @@ extern inline double sqrt(double x) {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
double atan2(double, double);
|
||||
double acos(float);
|
||||
//double atan2(double, double);
|
||||
//double acos(float);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
// extern GXRenderModeObj GXNtsc240Int;
|
||||
// extern GXRenderModeObj GXNtsc240IntAa;
|
||||
extern GXRenderModeObj GXNtsc480IntDf;
|
||||
// extern GXRenderModeObj GXNtsc480Int;
|
||||
extern GXRenderModeObj GXNtsc480Int;
|
||||
// extern GXRenderModeObj GXNtsc480IntAa;
|
||||
// extern GXRenderModeObj GXNtsc480Prog;
|
||||
// extern GXRenderModeObj GXNtsc480ProgSoft;
|
||||
|
||||
@@ -3,9 +3,13 @@
|
||||
|
||||
#include "types.h"
|
||||
#include "dolphin/os/OSAlloc.h"
|
||||
#include "dolphin/os/OSArena.h"
|
||||
#include "dolphin/os/OSCache.h"
|
||||
#include "dolphin/os/OSContext.h"
|
||||
#include "dolphin/os/OSError.h"
|
||||
#include "dolphin/os/OSInterrupt.h"
|
||||
#include "dolphin/os/OSModule.h"
|
||||
#include "dolphin/os/OSMemory.h"
|
||||
#include "dolphin/os/OSMessage.h"
|
||||
#include "libforest/osreport.h" /* OSReport funcs */
|
||||
#include "dolphin/os/OSReset.h"
|
||||
|
||||
@@ -26,10 +26,13 @@ typedef void (*OSErrorHandler)(OSError error, OSContext *context, ...);
|
||||
#define OS_ERROR_SYSTEM_INTERRUPT 13
|
||||
#define OS_ERROR_THERMAL_INTERRUPT 14
|
||||
#define OS_ERROR_PROTECTION 15
|
||||
#define OS_ERROR_MAX (OS_ERROR_THERMAL_INTERRUPT + 1)
|
||||
#define OS_ERROR_MAX (OS_ERROR_PROTECTION + 1)
|
||||
|
||||
OSErrorHandler OSSetErrorHandler(OSError error, OSErrorHandler handler);
|
||||
|
||||
extern OSErrorHandler __OSErrorTable[OS_ERROR_MAX];
|
||||
extern u32 __OSFpscrEnableBits;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -11,6 +11,8 @@ static void Config24MB();
|
||||
static void Config48MB();
|
||||
u32 OSGetConsoleSimulatedMemSize(void);
|
||||
|
||||
void OSProtectRange(u32 chan, void* addr, u32 nBytes, u32 control);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -69,11 +69,21 @@ typedef void (*VIRetraceCallback)(u32 retraceCount);
|
||||
|
||||
#define VIPadFrameBufferWidth(width) ((u16)(((u16)(width) + 15) & ~15))
|
||||
|
||||
void VIConfigure(const struct _GXRenderModeObj *rm);
|
||||
|
||||
void VISetBlack(BOOL);
|
||||
void VIWaitForRetrace();
|
||||
void VIConfigurePan(u16 x_origin, u16 y_origin, u16 width, u16 height);
|
||||
u32 VIGetRetraceCount();
|
||||
u32 VIGetDTVStatus();
|
||||
|
||||
VIRetraceCallback VISetPreRetraceCallback(VIRetraceCallback callback);
|
||||
VIRetraceCallback VISetPostRetraceCallback(VIRetraceCallback callback);
|
||||
void* VIGetNextFrameBuffer();
|
||||
void* VIGetCurrentFrameBuffer();
|
||||
void VISetNextFrameBuffer(void* fb);
|
||||
|
||||
void VIInit();
|
||||
void VIFlush();
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
#ifndef _DOLPHIN_LIBC_CTYPE_H_
|
||||
#define _DOLPHIN_LIBC_CTYPE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int tolower(int c);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _DOLPHIN_LIBC_CTYPE_H_
|
||||
|
||||
@@ -13,6 +13,7 @@ void *memset(void *dest, int ch, size_t count);
|
||||
int memcmp(const void *ptr1, const void *ptr2, size_t num);
|
||||
|
||||
size_t strlen(const char *s);
|
||||
long strtol(const char *str, char **end, int base);
|
||||
char *strcpy(char *dest, const char *src);
|
||||
char *strncpy(char *dest, const char *src, size_t num);
|
||||
int strcmp(const char *s1, const char *s2);
|
||||
|
||||
Reference in New Issue
Block a user