mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-07-07 12:03:27 -04:00
clean up and format code
This commit is contained in:
@@ -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 : 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,67 +31,77 @@ 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;
|
||||
@@ -107,57 +113,61 @@ public:
|
||||
|
||||
int prevIndex(int n) const {
|
||||
return (--n < 0) ? mMaxLines - 1 : n;
|
||||
|
||||
}
|
||||
|
||||
void scrollToLastLine() { scroll(mMaxLines); }
|
||||
void scrollToFirstLine() { scroll(-mMaxLines); }
|
||||
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
|
||||
bool mIsVisible; // _64
|
||||
bool _65; // _65
|
||||
bool _66; // _66
|
||||
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
|
||||
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);
|
||||
|
||||
@@ -7,9 +7,8 @@
|
||||
#include "JSystem/JUtility/JUTFont.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
|
||||
struct JUTDbPrintList
|
||||
{
|
||||
JUTDbPrintList *mNext; // _00
|
||||
struct JUTDbPrintList {
|
||||
JUTDbPrintList* mNext; // _00
|
||||
s16 mX; // _04
|
||||
s16 mY; // _06
|
||||
s16 mDuration; // _08
|
||||
@@ -17,37 +16,44 @@ struct JUTDbPrintList
|
||||
u8 mStr; // _0C
|
||||
};
|
||||
|
||||
struct JUTDbPrint
|
||||
{
|
||||
JUTDbPrint(JUTFont *, JKRHeap *); // unused/inlined
|
||||
struct JUTDbPrint {
|
||||
JUTDbPrint(JUTFont*, JKRHeap*); // unused/inlined
|
||||
|
||||
~JUTDbPrint(); // unused/inlined
|
||||
|
||||
JUTFont *changeFont(JUTFont *);
|
||||
JUTFont* changeFont(JUTFont*);
|
||||
void flush();
|
||||
void flush(int, int, int, int);
|
||||
void drawString(int, int, int, const u8 *);
|
||||
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 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; }
|
||||
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* start(JUTFont*, JKRHeap*);
|
||||
static JUTDbPrint* getManager() {
|
||||
return sDebugPrint;
|
||||
}
|
||||
|
||||
static JUTDbPrint *sDebugPrint;
|
||||
static JUTDbPrint* sDebugPrint;
|
||||
|
||||
JUTDbPrintList *mList; // _00
|
||||
JUTFont *mFont; // _04
|
||||
JUTDbPrintList* mList; // _00
|
||||
JUTFont* mFont; // _04
|
||||
JUtility::TColor mColor; // _08
|
||||
bool mVisible; // _0C
|
||||
JKRHeap *mHeap; // _10
|
||||
bool mVisible; // _0C
|
||||
JKRHeap* mHeap; // _10
|
||||
};
|
||||
|
||||
void JUTReport(int x, int y, int show_count, const char* fmt, ...);
|
||||
@@ -55,9 +61,9 @@ 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* 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
|
||||
}
|
||||
|
||||
@@ -6,24 +6,23 @@
|
||||
|
||||
#define JUTDF_BUFSIZE (0x800)
|
||||
|
||||
struct JUTDirectFile
|
||||
{
|
||||
struct JUTDirectFile {
|
||||
JUTDirectFile();
|
||||
|
||||
~JUTDirectFile();
|
||||
|
||||
bool fopen(const char *);
|
||||
bool fopen(const char*);
|
||||
void fclose();
|
||||
int fgets(void *, int);
|
||||
int fgets(void*, int);
|
||||
|
||||
// unused/inlined
|
||||
int fetch32byte();
|
||||
void fread(void *, u32);
|
||||
void fread(void*, u32);
|
||||
void setPos(u32);
|
||||
void fgetc();
|
||||
|
||||
u8 mBuffer[0x820]; // _000, 0x20 header, 0x800 sector
|
||||
u8 *mSectorStart; // _820, ptr to 0x800 buffer
|
||||
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
|
||||
@@ -31,4 +30,4 @@ struct JUTDirectFile
|
||||
DVDFileInfo mFileInfo; // _834
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -6,45 +6,51 @@
|
||||
|
||||
#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 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 printSub(u16, u16, const char *, va_list, bool); // TODO: Function signature
|
||||
void print(u16, u16, const char *, ...);
|
||||
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*, ...);
|
||||
|
||||
bool isActive() const { return mFramebuffer != nullptr; }
|
||||
void *getFrameBuffer() { return mFramebuffer; }
|
||||
bool isActive() const {
|
||||
return mFramebuffer != nullptr;
|
||||
}
|
||||
void* getFrameBuffer() {
|
||||
return mFramebuffer;
|
||||
}
|
||||
|
||||
void changeFrameBuffer(void* fb) { changeFrameBuffer(fb, mFbWidth, mFbHeight); }
|
||||
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
|
||||
size_t mFbSize; // _0C
|
||||
u8 _10[0x4]; // _10 - unknown
|
||||
u16 *mFrameMemory; // _14
|
||||
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
|
||||
|
||||
@@ -11,10 +11,9 @@
|
||||
struct JUTConsole;
|
||||
struct JUTDirectPrint;
|
||||
|
||||
typedef void (*JUTErrorHandler)(OSError error, OSContext *context, u32 dsisr, u32 dar);
|
||||
typedef void (*JUTErrorHandler)(OSError error, OSContext* context, u32 dsisr, u32 dar);
|
||||
|
||||
enum ExPrintFlags
|
||||
{
|
||||
enum ExPrintFlags {
|
||||
EXPRINTFLAG_GPR = 0x1,
|
||||
EXPRINTFLAG_GPRMap = 0x2,
|
||||
EXPRINTFLAG_Float = 0x4,
|
||||
@@ -25,116 +24,117 @@ enum ExPrintFlags
|
||||
/**
|
||||
* @size{0xA4}
|
||||
*/
|
||||
struct JUTException : public JKRThread
|
||||
{
|
||||
enum EInfoPage
|
||||
{
|
||||
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;
|
||||
struct JUTExMapFile {
|
||||
inline JUTExMapFile(const char* fileName) : mLink(this) {
|
||||
mFileName = (char*)fileName;
|
||||
}
|
||||
|
||||
char *mFileName; // _00
|
||||
char* mFileName; // _00
|
||||
JSULink<JUTExMapFile> mLink; // _04
|
||||
};
|
||||
|
||||
/** @fabricated */
|
||||
struct ExCallbackObject
|
||||
{
|
||||
struct ExCallbackObject {
|
||||
JUTErrorHandler mErrorHandler; // _00
|
||||
s32 mError; // _04
|
||||
OSContext *mContext; // _08
|
||||
u32 _0C; // _0C
|
||||
u32 _10; // _10
|
||||
s32 mError; // _04
|
||||
OSContext* mContext; // _08
|
||||
u32 _0C; // _0C
|
||||
u32 _10; // _10
|
||||
};
|
||||
|
||||
JUTException(JUTDirectPrint *); // unused/inlined
|
||||
JUTException(JUTDirectPrint*); // unused/inlined
|
||||
|
||||
virtual ~JUTException(){}; // _08 (weak)
|
||||
virtual void *run(); // _0C
|
||||
virtual ~JUTException() {}; // _08 (weak)
|
||||
virtual void* run(); // _0C
|
||||
|
||||
void showFloat(OSContext *);
|
||||
void showStack(OSContext *);
|
||||
void showMainInfo(u16, OSContext *, u32, u32);
|
||||
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 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 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 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 *);
|
||||
static bool searchPartialModule(u32, u32*, u32*, u32*, u32*);
|
||||
|
||||
// unused/inlined:
|
||||
static void panic_f_va(const char *, int, const char *, va_list);
|
||||
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) {
|
||||
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 *);
|
||||
void showGPR(OSContext*);
|
||||
void showSRR0Map(OSContext*);
|
||||
bool isEnablePad() const;
|
||||
static u32 getFpscr();
|
||||
void setFpscr(u32);
|
||||
void enableFpuException();
|
||||
void disableFpuException();
|
||||
|
||||
JUTExternalFB *getFrameMemory() const { return mFrameMemory; }
|
||||
JUTExternalFB* getFrameMemory() const {
|
||||
return mFrameMemory;
|
||||
}
|
||||
|
||||
void setTraceSuppress(u32 supress) { mTraceSuppress = supress; }
|
||||
void setGamePad(JUTGamePad *gamePad)
|
||||
{
|
||||
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 JUTException* getManager() {
|
||||
return sErrorManager;
|
||||
}
|
||||
static JUTConsole* getConsole() {
|
||||
return sConsole;
|
||||
}
|
||||
|
||||
static JUTConsole *sConsole;
|
||||
static void *sConsoleBuffer;
|
||||
static JUTConsole* sConsole;
|
||||
static void* sConsoleBuffer;
|
||||
static size_t sConsoleBufferSize;
|
||||
static JUTException *sErrorManager;
|
||||
static JUTException* sErrorManager;
|
||||
static OSMessageQueue sMessageQueue;
|
||||
static void *sMessageBuffer[1];
|
||||
static void* sMessageBuffer[1];
|
||||
static JUTErrorHandler sPreUserCallback;
|
||||
static JUTErrorHandler sPostUserCallback;
|
||||
static u32 msr;
|
||||
static u32 fpscr;
|
||||
static const char *sCpuExpName[16];
|
||||
static const char* sCpuExpName[16];
|
||||
static JSUList<JUTExMapFile> sMapFileList;
|
||||
|
||||
// _00 = VTBL
|
||||
// _00-_7C = JKRThread
|
||||
JUTExternalFB *mFrameMemory; // _7C
|
||||
JUTDirectPrint *mDirectPrint; // _80
|
||||
JUTGamePad *mGamePad; // _84
|
||||
JUTExternalFB* mFrameMemory; // _7C
|
||||
JUTDirectPrint* mDirectPrint; // _80
|
||||
JUTGamePad* mGamePad; // _84
|
||||
JUTGamePad::EPadPort mPadPort; // _88
|
||||
int mPrintWaitTime0; // _8C
|
||||
int mPrintWaitTime1; // _90
|
||||
@@ -143,4 +143,4 @@ struct JUTException : public JKRThread
|
||||
u32 mPrintFlags; // _9C, see ExPrintFlags enum
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -6,19 +6,13 @@
|
||||
#include "JSystem/JUtility/JUTVideo.h"
|
||||
#include "types.h"
|
||||
|
||||
struct JUTFader
|
||||
{
|
||||
enum EStatus
|
||||
{
|
||||
Status_Out = 0,
|
||||
Status_In = 1,
|
||||
Status_FadingIn = 2,
|
||||
Status_FadingOut = 3
|
||||
};
|
||||
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 ~JUTFader() {
|
||||
} // _08 (weak)
|
||||
virtual bool startFadeIn(int duration); // _0C
|
||||
virtual bool startFadeOut(int duration); // _10
|
||||
virtual void draw(); // _14
|
||||
@@ -29,9 +23,13 @@ struct JUTFader
|
||||
void start(int);
|
||||
void setStatus(EStatus, int);
|
||||
|
||||
EStatus getStatus() const { return mStatus; }
|
||||
EStatus getStatus() const {
|
||||
return mStatus;
|
||||
}
|
||||
|
||||
void setColor(JUtility::TColor color) { mColor.set(color.r, color.g, color.b, mColor.a); }
|
||||
void setColor(JUtility::TColor color) {
|
||||
mColor.set(color.r, color.g, color.b, mColor.a);
|
||||
}
|
||||
|
||||
// _00 VTBL
|
||||
EStatus mStatus; // _04 - current status
|
||||
@@ -43,4 +41,4 @@ struct JUTFader
|
||||
EStatus _28; // _28 - ???
|
||||
};
|
||||
|
||||
#endif
|
||||
#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);
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
#include "types.h"
|
||||
#include <dolphin/gx.h>
|
||||
|
||||
struct JUTGraphFifo
|
||||
{
|
||||
struct JUTGraphFifo {
|
||||
JUTGraphFifo(u32);
|
||||
|
||||
virtual ~JUTGraphFifo(); // _08
|
||||
@@ -13,21 +12,21 @@ struct JUTGraphFifo
|
||||
void becomeCurrent();
|
||||
void setBreakPt();
|
||||
|
||||
void getGpStatus()
|
||||
{
|
||||
void getGpStatus() {
|
||||
GXGetGPStatus((GXBool*)&mGpStatus[0], (GXBool*)&mGpStatus[1], (GXBool*)&mGpStatus[2], (GXBool*)&mGpStatus[3],
|
||||
(GXBool*)&mGpStatus[4]);
|
||||
}
|
||||
|
||||
bool isGPActive()
|
||||
{
|
||||
bool isGPActive() {
|
||||
getGpStatus();
|
||||
return mGpStatus[2] == false;
|
||||
}
|
||||
|
||||
void save() { GXSaveCPUFifo(this->mFifo); }
|
||||
void save() {
|
||||
GXSaveCPUFifo(this->mFifo);
|
||||
}
|
||||
|
||||
static JUTGraphFifo *sCurrentFifo;
|
||||
static JUTGraphFifo* sCurrentFifo;
|
||||
static GXBool mGpStatus[5];
|
||||
static bool sInitiated;
|
||||
|
||||
@@ -38,6 +37,8 @@ struct JUTGraphFifo
|
||||
u8 _10[0xC]; // _10
|
||||
};
|
||||
|
||||
inline void JUTCreateFifo(u32 bufSize) { new JUTGraphFifo(bufSize); }
|
||||
inline void JUTCreateFifo(u32 bufSize) {
|
||||
new JUTGraphFifo(bufSize);
|
||||
}
|
||||
|
||||
#endif
|
||||
#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
|
||||
|
||||
|
||||
@@ -11,30 +11,45 @@
|
||||
|
||||
typedef u8 (*Pattern)[2];
|
||||
|
||||
struct JUTVideo
|
||||
{
|
||||
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();
|
||||
|
||||
u32 getEfbHeight() const { return mRenderModeObj->efbHeight; }
|
||||
u32 getXfbHeight() const { return mRenderModeObj->xfbHeight & 0xffff; }
|
||||
u32 getFbWidth() const { return (u16)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; }
|
||||
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*);
|
||||
@@ -48,12 +63,18 @@ struct JUTVideo
|
||||
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
|
||||
@@ -68,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();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,11 +5,10 @@
|
||||
#include <JSystem/JKernel/JKRHeap.h>
|
||||
#include "types.h"
|
||||
|
||||
struct JUTExternalFB
|
||||
{
|
||||
JUTExternalFB(GXRenderModeObj *, GXGamma, void *, u32);
|
||||
struct JUTExternalFB {
|
||||
JUTExternalFB(GXRenderModeObj*, GXGamma, void*, u32);
|
||||
|
||||
GXRenderModeObj *mRenderModeObj; // _00
|
||||
GXRenderModeObj* mRenderModeObj; // _00
|
||||
u32 mSize; // _04
|
||||
u8 _08[4]; // _08
|
||||
u16 _0C; // _0C
|
||||
@@ -17,62 +16,77 @@ struct JUTExternalFB
|
||||
bool _10; // _10
|
||||
};
|
||||
|
||||
class JUTXfb
|
||||
{
|
||||
public:
|
||||
enum EXfbNumber
|
||||
{
|
||||
Unset = 0,
|
||||
SingleBuffer = 1,
|
||||
DoubleBuffer = 2,
|
||||
TripleBuffer = 3
|
||||
};
|
||||
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 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; }
|
||||
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 {
|
||||
void* getXfb(int index) const {
|
||||
return mBuffer[index];
|
||||
}
|
||||
|
||||
void *getDrawnXfb() const {
|
||||
void* getDrawnXfb() const {
|
||||
return (mDrawnXfbIndex >= 0) ? mBuffer[mDrawnXfbIndex] : nullptr;
|
||||
}
|
||||
|
||||
void *getDrawingXfb() const {
|
||||
void* getDrawingXfb() const {
|
||||
return (mDrawingXfbIndex >= 0) ? mBuffer[mDrawingXfbIndex] : nullptr;
|
||||
}
|
||||
|
||||
void *getDisplayingXfb() const {
|
||||
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; }
|
||||
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; }
|
||||
static JUTXfb* getManager() {
|
||||
return sManager;
|
||||
}
|
||||
|
||||
private:
|
||||
static JUTXfb *sManager;
|
||||
private:
|
||||
static JUTXfb* sManager;
|
||||
|
||||
private:
|
||||
void *mBuffer[3]; // 00
|
||||
private:
|
||||
void* mBuffer[3]; // 00
|
||||
bool mXfbAllocated[3]; // 0c
|
||||
int mBufferNum; // 10
|
||||
s16 mDrawingXfbIndex; // 14
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user