mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-07-07 12:03:27 -04:00
Add JUTConsole and JUTConsoleManager classes
This commit is contained in:
@@ -2,27 +2,162 @@
|
||||
#define _JSYSTEM_JUT_JUTCONSOLE_H
|
||||
|
||||
#include "va_args.h"
|
||||
#include "JSystem/JGadget/linklist.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JUtility/JUTFont.h"
|
||||
#include "JSystem/JUtility/JUTConsoleExtern.h"
|
||||
|
||||
class JUTConsole; // TODO
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
inline s32 colorCheck(s32 diff, s32 t)
|
||||
{
|
||||
#endif
|
||||
void JUTConsole_print_f_va_(JUTConsole*, const char*, va_list);
|
||||
s32 ret = diff - t;
|
||||
return ret + 1;
|
||||
}
|
||||
|
||||
class JUTConsole : public JKRDisposer
|
||||
{
|
||||
public:
|
||||
enum EConsoleType
|
||||
{
|
||||
CONSOLE_TYPE_0 = 0,
|
||||
CONSOLE_TYPE_1 = 1,
|
||||
CONSOLE_TYPE_2 = 2,
|
||||
};
|
||||
|
||||
enum OutputFlag
|
||||
{
|
||||
/* 0x0 */ OUTPUT_NONE,
|
||||
/* 0x1 */ OUTPUT_OSREPORT,
|
||||
/* 0x2 */ OUTPUT_CONSOLE,
|
||||
/* 0x3 */ OUTPUT_OSR_AND_CONSOLE,
|
||||
};
|
||||
|
||||
virtual ~JUTConsole(); // _08
|
||||
|
||||
// _00 VTBL
|
||||
|
||||
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 dumpToTerminal(uint);
|
||||
void scroll(int);
|
||||
int getUsedLine() const;
|
||||
int getLineOffset() const;
|
||||
|
||||
void setOutput(uint output) { mOutput = output; }
|
||||
void setPosition(int x, int y)
|
||||
{
|
||||
mPositionX = x;
|
||||
mPositionY = y;
|
||||
}
|
||||
void setFontSize(f32 x, f32 y)
|
||||
{
|
||||
mFontSizeX = x;
|
||||
mFontSizeY = y;
|
||||
}
|
||||
void setHeight(u32 height)
|
||||
{
|
||||
mHeight = height;
|
||||
if (mHeight > mMaxLines)
|
||||
{
|
||||
mHeight = mMaxLines;
|
||||
}
|
||||
}
|
||||
|
||||
void setFont(JUTFont *p_font)
|
||||
{
|
||||
mFont = p_font;
|
||||
setFontSize(p_font->getWidth(), p_font->getHeight());
|
||||
}
|
||||
|
||||
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; }
|
||||
|
||||
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
|
||||
{
|
||||
int diff = param_1 - param_0;
|
||||
if (diff >= 0)
|
||||
{
|
||||
return diff;
|
||||
}
|
||||
return diff += 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
|
||||
int _64; // _64
|
||||
bool mIsVisible; // _68
|
||||
bool _69; // _69
|
||||
bool _6A; // _6A
|
||||
bool _6B; // _6B
|
||||
}; // Size: 0x6C
|
||||
|
||||
class JUTConsoleManager
|
||||
{
|
||||
public:
|
||||
JUTConsoleManager();
|
||||
static JUTConsoleManager *createManager(JKRHeap *);
|
||||
void appendConsole(JUTConsole *console);
|
||||
void removeConsole(JUTConsole *console);
|
||||
void draw() const;
|
||||
void drawDirect(bool) const;
|
||||
void setDirectConsole(JUTConsole *);
|
||||
|
||||
static JUTConsoleManager *getManager() { return sManager; }
|
||||
|
||||
static JUTConsoleManager *sManager;
|
||||
|
||||
private:
|
||||
JGadget::TLinkList<JUTConsole, -24> soLink_; // _00
|
||||
JUTConsole *mActiveConsole; // _0C
|
||||
JUTConsole *mDirectConsole; // _10
|
||||
}; // Size: 0x14
|
||||
|
||||
extern "C" {
|
||||
void JUTConsole_print_f_va_(JUTConsole*, const char*, va_list);
|
||||
JUTConsole* JUTGetReportConsole();
|
||||
void JUTSetReportConsole(JUTConsole*);
|
||||
JUTConsole* JUTGetWarningConsole();
|
||||
void JUTSetWarningConsole(JUTConsole*);
|
||||
void JUTReportConsole(const char*);
|
||||
void JUTReportConsole_f(const char*, ...);
|
||||
void JUTReportConsole_f_va(const char*, va_list);
|
||||
void JUTWarningConsole(const char*);
|
||||
void JUTWarningConsole_f(const char*, ...);
|
||||
void JUTWarningConsole_f_va(const char*, va_list);
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif // ifdef __cplusplus
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef JUTCONSOLEEXTERN_H
|
||||
#define JUTCONSOLEEXTERN_H
|
||||
|
||||
#include "types.h"
|
||||
#include "va_args.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
void JUTReportConsole(const char*);
|
||||
void JUTReportConsole_f(const char*, ...);
|
||||
void JUTReportConsole_f_va(const char*, va_list);
|
||||
void JUTWarningConsole(const char*);
|
||||
void JUTWarningConsole_f(const char*, ...);
|
||||
void JUTWarningConsole_f_va(const char*, va_list);
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif // ifdef __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,62 @@
|
||||
#ifndef JUTDIRECTPRINT_H
|
||||
#define JUTDIRECTPRINT_H
|
||||
|
||||
#include "types.h"
|
||||
#include "va_args.h"
|
||||
#include "JSystem/JUtility/TColor.h"
|
||||
|
||||
class JUTDirectPrint
|
||||
{
|
||||
private:
|
||||
JUTDirectPrint();
|
||||
|
||||
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 );
|
||||
|
||||
// Inline/Unused
|
||||
void printSub(u16, u16, const char *, __va_list_struct *, bool);
|
||||
void print(u16, u16, const char *, ...);
|
||||
|
||||
bool isActive() const { return mFramebuffer != nullptr; }
|
||||
void *getFrameBuffer() { return mFramebuffer; }
|
||||
JUtility::TColor getCharColor() const { return mCharColor; }
|
||||
|
||||
static JUTDirectPrint *getManager() { return sDirectPrint; }
|
||||
|
||||
private:
|
||||
static u8 sAsciiTable[128];
|
||||
static u32 sFontData[64];
|
||||
static u32 sFontData2[77];
|
||||
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
|
||||
};
|
||||
|
||||
inline void JUTChangeFrameBuffer(void *buffer, u16 height, u16 width)
|
||||
{
|
||||
JUTDirectPrint::getManager()->changeFrameBuffer(buffer, width, height);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,369 @@
|
||||
#ifndef JUTFONT_H
|
||||
#define JUTFONT_H
|
||||
|
||||
#include "types.h"
|
||||
#include "dolphin/string.h"
|
||||
#include "dolphin/gx.h"
|
||||
#include "dolphin/os.h"
|
||||
#include "JSystem/JUtility/TColor.h"
|
||||
|
||||
struct JKRAramBlock;
|
||||
struct JKRHeap;
|
||||
|
||||
struct ResFONT;
|
||||
|
||||
struct JUTFont
|
||||
{
|
||||
typedef bool (*IsLeadByte)(int);
|
||||
|
||||
struct TWidth
|
||||
{
|
||||
u8 w0;
|
||||
u8 w1;
|
||||
|
||||
const TWidth &operator=(const TWidth &other)
|
||||
{
|
||||
w0 = other.w0;
|
||||
w1 = other.w1;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
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
|
||||
|
||||
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);
|
||||
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
drawString_size_scale(posX, posY, width, height, str, strlen(str), visible);
|
||||
}
|
||||
|
||||
int getWidth(int i_no) const
|
||||
{
|
||||
TWidth width;
|
||||
getWidthEntry(i_no, &width);
|
||||
return width.w0;
|
||||
}
|
||||
|
||||
void setFixedWidth(bool fixed, int width) {
|
||||
mFixed = fixed;
|
||||
mFixedWidth = width;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return ((c >= 0x81) && (c <= 0x9F)) || ((c >= 0xE0) && (c <= 0xFC));
|
||||
}
|
||||
|
||||
// _00 = VTBL
|
||||
bool mValid; // _04
|
||||
bool mFixed; // _05
|
||||
int mFixedWidth; // _08
|
||||
JUtility::TColor mColor1; // _0C, bottom left
|
||||
JUtility::TColor mColor2; // _10, bottom right
|
||||
JUtility::TColor mColor3; // _14, top left
|
||||
JUtility::TColor mColor4; // _18, top right
|
||||
};
|
||||
|
||||
struct JUTRomFont : public JUTFont
|
||||
{
|
||||
// @fabricatedName
|
||||
struct AboutEncoding
|
||||
{
|
||||
u32 mFontType; // _00
|
||||
u32 mDataSize; // _04
|
||||
IsLeadByte mIsLeadByteFunction; // _08
|
||||
};
|
||||
|
||||
JUTRomFont();
|
||||
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
|
||||
|
||||
void initiate(JKRHeap *);
|
||||
void loadImage(JKRHeap *);
|
||||
|
||||
static AboutEncoding *spAboutEncoding_;
|
||||
static OSFontHeader *spFontHeader_;
|
||||
static u32 suFontHeaderRefered_; // they misspelled referred
|
||||
static AboutEncoding saoAboutEncoding_[2];
|
||||
|
||||
// _00 = VTBL
|
||||
// _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);
|
||||
}
|
||||
|
||||
u32 mMagic; // _00
|
||||
u32 mSize; // _04
|
||||
};
|
||||
|
||||
struct ResFONT
|
||||
{
|
||||
// INF1, size: 0x14
|
||||
struct InfoBlock : public BlockHeader
|
||||
{
|
||||
// _00 = BlockHeader
|
||||
u16 mFontType; // _08
|
||||
u16 mAscent; // _0A
|
||||
u16 mDescent; // _0C
|
||||
u16 mWidth; // _0E
|
||||
u16 mLeading; // _10
|
||||
u16 mDefaultCode; // _12
|
||||
};
|
||||
|
||||
// WID1, size: 0x10
|
||||
struct WidthBlock : public BlockHeader
|
||||
{
|
||||
// _00 = BlockHeader
|
||||
u16 mStartCode; // _08
|
||||
u16 mEndCode; // _0A
|
||||
JUTFont::TWidth mChunkNum[2]; // _0C
|
||||
};
|
||||
|
||||
// MAP1, size: 0x14
|
||||
struct MapBlock : public BlockHeader
|
||||
{
|
||||
// _00 = BlockHeader
|
||||
u16 mMappingMethod; // _08
|
||||
u16 mStartCode; // _0A
|
||||
u16 mEndCode; // _0C
|
||||
u16 mNumEntries; // _0E
|
||||
u16 mLeading; // _10
|
||||
};
|
||||
|
||||
// GLY1, size: 0x20
|
||||
struct GlyphBlock : public BlockHeader
|
||||
{
|
||||
// _00 = BlockHeader
|
||||
u16 mStartCode; // _08
|
||||
u16 mEndCode; // _0A
|
||||
u16 mCellWidth; // _0C
|
||||
u16 mCellHeight; // _0E
|
||||
u32 mTextureSize; // _10
|
||||
u16 mTextureFormat; // _14
|
||||
u16 mNumRows; // _16
|
||||
u16 mNumColumns; // _18
|
||||
u16 mTextureWidth; // _1A
|
||||
u16 mTextureHeight; // _1C
|
||||
u16 mPadding; // _1E
|
||||
u8 mData[]; // _20
|
||||
};
|
||||
|
||||
u64 mMagic; // _00
|
||||
u32 mFileSize; // _08
|
||||
u32 mNumBlocks; // _0C
|
||||
u8 mPadding[0x10]; // _10
|
||||
u8 mData[]; // _20
|
||||
};
|
||||
|
||||
/**
|
||||
* @size{0x70}
|
||||
*/
|
||||
struct JUTResFont : public JUTFont
|
||||
{
|
||||
JUTResFont();
|
||||
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
|
||||
|
||||
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 *);
|
||||
|
||||
inline void delete_and_initialize()
|
||||
{
|
||||
deleteMemBlocks_ResFont();
|
||||
initialize_state();
|
||||
}
|
||||
|
||||
static IsLeadByte const saoAboutEncoding_[3];
|
||||
|
||||
// _00 = VTBL
|
||||
// _00-_1C = JUTFont
|
||||
int mWidth; // _1C
|
||||
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
|
||||
u16 mWidthBlockCount; // _60
|
||||
u16 mGlyphBlockCount; // _62
|
||||
u16 mMapBlockCount; // _64
|
||||
u16 _66; // _66
|
||||
u16 mMaxCode; // _68
|
||||
IsLeadByte *mIsLeadByte; // _6C
|
||||
};
|
||||
|
||||
struct JUTCacheFont : public JUTResFont
|
||||
{
|
||||
enum EPagingType
|
||||
{
|
||||
CFPAGETYPE_Unk0 = 0,
|
||||
CFPAGETYPE_Unk1 = 1,
|
||||
};
|
||||
|
||||
struct TGlyphCacheInfo
|
||||
{
|
||||
// TODO: the rest of the data members
|
||||
TGlyphCacheInfo *mPrev; // _00
|
||||
TGlyphCacheInfo *mNext; // _04
|
||||
u8 _08[4]; // _08
|
||||
u16 _0C; // _0C
|
||||
u16 _0E; // _0E
|
||||
u8 _10[4]; // _10
|
||||
u16 _14; // _14
|
||||
u16 _16; // _16
|
||||
u8 _18[8]; // _18
|
||||
GXTexObj mGxTexObj; // _20
|
||||
};
|
||||
|
||||
struct TCachePage
|
||||
{
|
||||
u8 _00[0x8]; // _00, unknown
|
||||
s16 _08; // _08
|
||||
u16 _0A; // _0A
|
||||
u8 _0C[0x4]; // _0C, unknown
|
||||
u8 *_10; // _10
|
||||
u16 _14; // _14
|
||||
u16 _18; // _18
|
||||
u16 _1C; // _1C
|
||||
u16 _20; // _20
|
||||
u16 _24; // _24
|
||||
u16 _28; // _28
|
||||
};
|
||||
|
||||
JUTCacheFont();
|
||||
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 *);
|
||||
void deleteMemBlocks_CacheFont();
|
||||
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 *);
|
||||
void invalidiateAllCache();
|
||||
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 loadCache_char(int, 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 setPagingType(EPagingType type) { mPagingType = type; }
|
||||
|
||||
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
|
||||
u32 mMaxSheetSize; // _88
|
||||
EPagingType mPagingType; // _8C
|
||||
void *mCacheBuffer; // _90
|
||||
u32 _94; // _94
|
||||
u32 mCachePage; // _98
|
||||
TGlyphCacheInfo *_9C; // _9C
|
||||
TGlyphCacheInfo *_A0; // _A0
|
||||
void *_A4; // _A4
|
||||
u32 _A8; // _A8
|
||||
JKRAramBlock *mAramBlock; // _AC
|
||||
u8 _B0; // _B0
|
||||
int _B4; // _B4
|
||||
};
|
||||
|
||||
extern const ResFONT JUTResFONT_Ascfont_fix12;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,84 @@
|
||||
#ifndef JUTVIDEO_H
|
||||
#define JUTVIDEO_H
|
||||
|
||||
#include "types.h"
|
||||
#include "dolphin/os/OSTime.h"
|
||||
#include "dolphin/os.h"
|
||||
#include "dolphin/gx.h"
|
||||
#include "dolphin/vi.h"
|
||||
|
||||
/**
|
||||
* @size{0x58}
|
||||
*/
|
||||
|
||||
typedef u8 (*Pattern)[2];
|
||||
|
||||
struct JUTVideo
|
||||
{
|
||||
JUTVideo(const _GXRenderModeObj *);
|
||||
|
||||
virtual ~JUTVideo(); // _08
|
||||
|
||||
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; }
|
||||
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; };
|
||||
static void drawDoneStart();
|
||||
static void dummyNoDrawWait();
|
||||
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;
|
||||
|
||||
// Static inline gets
|
||||
static JUTVideo *getManager() { return sManager; }
|
||||
static OSTick getVideoInterval() { return sVideoInterval; }
|
||||
static OSTick getVideoLastTick() { return sVideoLastTick; }
|
||||
|
||||
// _00 VTBL
|
||||
GXRenderModeObj *mRenderModeObj; // _04
|
||||
u32 _08; // _08
|
||||
u32 mRetraceCount; // _0C
|
||||
int _10; // _10
|
||||
u8 _14[4]; // _14
|
||||
u32 _18; // _18
|
||||
VIRetraceCallback mPreviousPreRetraceCallback; // _1C
|
||||
VIRetraceCallback mPreviousPostRetraceCallback; // _20
|
||||
VIRetraceCallback mPreRetraceCallback; // _24
|
||||
VIRetraceCallback mPostRetraceCallback; // _28
|
||||
bool mIsSetBlack; // _2C
|
||||
s32 mSetBlackFrameCount; // _30
|
||||
OSMessage mMessage; // _34
|
||||
OSMessageQueue mMessageQueue; // _38
|
||||
|
||||
static JUTVideo *sManager;
|
||||
static OSTick sVideoLastTick;
|
||||
static OSTick sVideoInterval;
|
||||
};
|
||||
|
||||
inline JUTVideo *JUTGetVideoManager() {
|
||||
return JUTVideo::getManager();
|
||||
}
|
||||
|
||||
extern bool sDrawWaiting;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user