mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-29 07:48:11 -04:00
Reorganize library code into libs/ (#3119)
* Reorganize files into libs/{dolphin,JSystem,PowerPC_EABI_Support,revolution,TRK_MINNOW_DOLPHIN}
* Update configure.py and project.py for new libs structure
* Refactor `#include <dolphin/x.h>` -> `<x.h>`
* Remove `__REVOLUTION_SDK__` forwards from dolphin
* Fix dolphin/ references in revolution
* Wrap `#include <dolphin.h>` in `!__REVOLUTION_SDK__`
* Always build TRK against dolphin headers
* Resolve revolution SDK header resolution issues
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
#ifndef JUTASSERT_H
|
||||
#define JUTASSERT_H
|
||||
|
||||
#include <os.h>
|
||||
|
||||
#if DEBUG
|
||||
#define JUT_SHOW_ASSERT(LINE, COND) JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, LINE, #COND)
|
||||
|
||||
#define JUT_ASSERT(LINE, COND) \
|
||||
(COND) ? (void)0 : (JUT_SHOW_ASSERT(LINE, COND), OSPanic(__FILE__, LINE, "Halt"));
|
||||
|
||||
#define JUT_ASSERT_MSG(LINE, COND, MSG) \
|
||||
(COND) ? (void)0 : (JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, LINE, MSG), OSPanic(__FILE__, LINE, "Halt"));
|
||||
|
||||
#define JUT_ASSERT_MSG_F(LINE, COND, MSG, ...) \
|
||||
(COND) ? (void)0 : (JUTAssertion::showAssert_f(JUTAssertion::getSDevice(), __FILE__, LINE, MSG, __VA_ARGS__), OSPanic(__FILE__, LINE, "Halt"));
|
||||
|
||||
#define J3D_PANIC(LINE, COND, MSG) ((COND) != 0 || (OSPanic(__FILE__, LINE, MSG), 0));
|
||||
|
||||
#define JUT_PANIC(LINE, TEXT) \
|
||||
JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, LINE, TEXT); \
|
||||
OSPanic(__FILE__, LINE, "Halt");
|
||||
|
||||
#define JUT_PANIC_F(LINE, MSG, ...) \
|
||||
JUTAssertion::showAssert_f(JUTAssertion::getSDevice(), __FILE__, LINE, MSG, __VA_ARGS__); \
|
||||
OSPanic(__FILE__, LINE, "Halt");
|
||||
|
||||
#define JUT_WARN_DEVICE(LINE, DEVICE, ...) \
|
||||
JUTAssertion::setWarningMessage_f(DEVICE, __FILE__, LINE, __VA_ARGS__); \
|
||||
|
||||
#define JUT_WARN(LINE, ...) \
|
||||
JUT_WARN_DEVICE(LINE, JUTAssertion::getSDevice(), __VA_ARGS__)
|
||||
|
||||
#define JUT_LOG(LINE, ...) \
|
||||
JUTAssertion::setLogMessage_f(JUTAssertion::getSDevice(), __FILE__, LINE, __VA_ARGS__)
|
||||
|
||||
#define JUT_SET_CONFIRM(LINE, COND) \
|
||||
JUTAssertion::setConfirmMessage(JUTAssertion::getSDevice(), __FILE__, LINE, COND, #COND)
|
||||
|
||||
#define JUT_CONFIRM(LINE, COND) \
|
||||
JUT_SET_CONFIRM(LINE, COND)
|
||||
|
||||
#else
|
||||
#define JUT_ASSERT(...) (void)0;
|
||||
#define JUT_ASSERT_MSG(...) (void)0;
|
||||
#define JUT_ASSERT_MSG_F(...) (void)0;
|
||||
#define J3D_PANIC(...) (void)0;
|
||||
#define JUT_PANIC(...)
|
||||
#define JUT_PANIC_F(...)
|
||||
#define JUT_WARN_DEVICE(...)
|
||||
#define JUT_WARN(...)
|
||||
#define JUT_LOG(...)
|
||||
#define JUT_CONFIRM(...)
|
||||
#endif
|
||||
|
||||
namespace JUTAssertion {
|
||||
void create();
|
||||
u32 flush_subroutine();
|
||||
void flushMessage();
|
||||
void flushMessage_dbPrint();
|
||||
void setVisible(bool);
|
||||
void setMessageCount(int);
|
||||
|
||||
u32 getSDevice();
|
||||
void showAssert_f(u32 device, const char* file, int line, const char* msg, ...);
|
||||
void showAssert_f_va(u32 device, const char* file, int line, const char* msg, va_list args);
|
||||
void setWarningMessage_f(u32 device, char * file, int line, const char * fmt, ...);
|
||||
void setWarningMessage_f_va(u32 device, const char* file, int line, const char* msg, va_list args);
|
||||
void setLogMessage_f(u32 device, char* file, int line, const char* fmt, ...);
|
||||
void setConfirmMessage(u32 param_1, char* file, int line, bool param_4, const char* msg);
|
||||
|
||||
inline void showAssert(u32 device, const char* file, int line, const char* msg) {
|
||||
showAssert_f(device, file, line, "%s", msg);
|
||||
}
|
||||
|
||||
inline void setWarningMessage(u32 device, char* file, int line, const char* msg) {
|
||||
setWarningMessage_f(device, file, line, "%s", msg);
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* JUTASSERT_H */
|
||||
@@ -0,0 +1,96 @@
|
||||
#ifndef JUTCACHEFONT_H
|
||||
#define JUTCACHEFONT_H
|
||||
|
||||
#include "JSystem/JUtility/JUTResFont.h"
|
||||
#include "global.h"
|
||||
|
||||
class JKRAramBlock;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
class JUTCacheFont : public JUTResFont {
|
||||
public:
|
||||
struct TGlyphCacheInfo {
|
||||
/* 0x00 */ TGlyphCacheInfo* mPrev;
|
||||
/* 0x04 */ TGlyphCacheInfo* mNext;
|
||||
/* 0x08 */ u16 field_0x8;
|
||||
/* 0x0A */ u16 field_0xa;
|
||||
/* 0x0C */ u16 field_0xc;
|
||||
/* 0x0E */ u16 field_0xe;
|
||||
/* 0x10 */ u32 field_0x10;
|
||||
/* 0x14 */ u16 mTexFormat;
|
||||
/* 0x16 */ u16 field_0x16;
|
||||
/* 0x18 */ u16 field_0x18;
|
||||
/* 0x1A */ u16 mWidth;
|
||||
/* 0x1C */ u16 mHeight;
|
||||
/* 0x1E */ u16 field_0x1e;
|
||||
};
|
||||
|
||||
struct TCachePage : TGlyphCacheInfo {
|
||||
/* 0x20 */ GXTexObj mTexObj;
|
||||
/* 0x40 */ u8 mImage[];
|
||||
}; // Size: 0x40
|
||||
|
||||
enum EPagingType {
|
||||
PAGE_TYPE_0,
|
||||
PAGE_TYPE_1,
|
||||
};
|
||||
|
||||
JUTCacheFont(ResFONT const*, u32, JKRHeap*);
|
||||
void deleteMemBlocks_CacheFont();
|
||||
void initialize_state();
|
||||
int getMemorySize(ResFONT const*, u16*, u32*, u16*, u32*, u16*, u32*, u32*);
|
||||
int initiate(ResFONT const*, void*, u32, JKRHeap*);
|
||||
bool internal_initiate(ResFONT const*, void*, u32, JKRHeap*);
|
||||
bool allocArea(void*, u32, JKRHeap*);
|
||||
bool allocArray(JKRHeap*);
|
||||
TGlyphCacheInfo* determineBlankPage();
|
||||
void getGlyphFromAram(JUTCacheFont::TGlyphCacheInfo*, JUTCacheFont::TCachePage*,
|
||||
int*, int*);
|
||||
TCachePage* loadCache_char_subroutine(int*, bool);
|
||||
void invalidiateAllCache();
|
||||
void unlink(JUTCacheFont::TGlyphCacheInfo*);
|
||||
void prepend(JUTCacheFont::TGlyphCacheInfo*);
|
||||
|
||||
virtual ~JUTCacheFont();
|
||||
virtual void loadImage(int, _GXTexMapID);
|
||||
virtual void setBlock();
|
||||
|
||||
void setPagingType(EPagingType type) { mPagingType = type; }
|
||||
|
||||
static u32 calcCacheSize(u32 param_0, int param_1) { return (ALIGN_NEXT(param_0, 0x20) + 0x40) * param_1; }
|
||||
GXTexObj* getTexObj(void* buffer) const { return &((TCachePage*)buffer)->mTexObj; }
|
||||
void delete_and_initialize() { deleteMemBlocks_CacheFont(); initialize_state(); }
|
||||
|
||||
u32 getCachePage() const {
|
||||
return mCachePage;
|
||||
}
|
||||
|
||||
int getMaxSheetSize() const {
|
||||
return mMaxSheetSize;
|
||||
}
|
||||
|
||||
private:
|
||||
/* 0x70 */ u32 mTotalWidSize;
|
||||
/* 0x74 */ u32 mTotalGlySize;
|
||||
/* 0x78 */ u32 mTotalMapSize;
|
||||
/* 0x7C */ void* field_0x7c;
|
||||
/* 0x80 */ void* field_0x80;
|
||||
/* 0x84 */ void* field_0x84;
|
||||
/* 0x88 */ u32 mMaxSheetSize;
|
||||
/* 0x8C */ EPagingType mPagingType;
|
||||
/* 0x90 */ void* mCacheBuffer;
|
||||
/* 0x94 */ int field_0x94;
|
||||
/* 0x98 */ u32 mCachePage;
|
||||
/* 0x9C */ TGlyphCacheInfo* field_0x9c;
|
||||
/* 0xA0 */ TGlyphCacheInfo* field_0xa0;
|
||||
/* 0xA4 */ TGlyphCacheInfo* field_0xa4;
|
||||
/* 0xA8 */ u32 field_0xa8;
|
||||
/* 0xAC */ JKRAramBlock* field_0xac;
|
||||
/* 0xB0 */ u8 field_0xb0;
|
||||
/* 0xB4 */ int field_0xb4;
|
||||
}; // Size: 0xB8
|
||||
|
||||
#endif /* JUTCACHEFONT_H */
|
||||
@@ -0,0 +1,170 @@
|
||||
#ifndef JUTCONSOLE_H
|
||||
#define JUTCONSOLE_H
|
||||
|
||||
#include "JSystem/JGadget/linklist.h"
|
||||
#include "JSystem/JKernel/JKRDisposer.h"
|
||||
#include "JSystem/JUtility/JUTFont.h"
|
||||
#include <cstdarg>
|
||||
|
||||
class JUTConsole;
|
||||
|
||||
extern "C" void JUTConsole_print_f_va_(JUTConsole*, const char*, va_list);
|
||||
extern "C" void JUTSetReportConsole(JUTConsole*);
|
||||
extern "C" JUTConsole* JUTGetReportConsole();
|
||||
extern "C" void JUTSetWarningConsole(JUTConsole*);
|
||||
extern "C" JUTConsole* JUTGetWarningConsole();
|
||||
extern "C" void JUTWarningConsole_f_va(const char*, va_list);
|
||||
extern "C" void JUTReportConsole_f_va(const char*, va_list);
|
||||
extern "C" void JUTReportConsole_f(const char*, ...);
|
||||
extern "C" void JUTWarningConsole(const char* message);
|
||||
extern "C" void JUTWarningConsole_f(const char* message, ...);
|
||||
extern "C" void JUTReportConsole(const char* message);
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
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,
|
||||
};
|
||||
|
||||
static JUTConsole* create(unsigned int, void*, u32);
|
||||
static JUTConsole* create(unsigned int, unsigned int, JKRHeap*);
|
||||
JUTConsole(unsigned int, unsigned int, bool);
|
||||
static size_t getObjectSizeFromBufferSize(unsigned int, unsigned int);
|
||||
static size_t getLineFromObjectSize(u32, unsigned int);
|
||||
void clear();
|
||||
void doDraw(JUTConsole::EConsoleType) const;
|
||||
void print_f(char const*, ...);
|
||||
void print(char const*);
|
||||
void dumpToTerminal(unsigned int);
|
||||
void scroll(int);
|
||||
int getUsedLine() const;
|
||||
int getLineOffset() const;
|
||||
|
||||
virtual ~JUTConsole();
|
||||
|
||||
void setOutput(unsigned int 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(unsigned int height) {
|
||||
mHeight = height;
|
||||
if (mHeight > mMaxLines) {
|
||||
mHeight = mMaxLines;
|
||||
}
|
||||
}
|
||||
|
||||
void setFont(JUTFont* p_font) {
|
||||
// Fakematch...? Fixes GCN but breaks Wii. TODO: Test after Wii flags are fixed.
|
||||
p_font = mFont = p_font;
|
||||
setFontSize(p_font->getWidth(), p_font->getHeight());
|
||||
}
|
||||
|
||||
u32 getOutput() const { return mOutput; }
|
||||
int getPositionY() const { return mPositionY; }
|
||||
int getPositionX() const { return mPositionX; }
|
||||
u32 getHeight() const { return mHeight; }
|
||||
|
||||
bool isVisible() const { return mVisible; }
|
||||
void setVisible(bool visible) { mVisible = visible; }
|
||||
|
||||
u8 getLineAttr(int param_0) const { return mBuf[(field_0x20 + 2) * param_0]; }
|
||||
void setLineAttr(int param_0, u8 param_1) { mBuf[(field_0x20 + 2) * param_0] = param_1; }
|
||||
u8* getLinePtr(int param_0) const { return &mBuf[(field_0x20 + 2) * param_0] + 1; }
|
||||
int diffIndex(int param_0, int param_1) const {
|
||||
int result;
|
||||
int diff = param_1 - param_0;
|
||||
if (diff >= 0) {
|
||||
result = diff;
|
||||
} else {
|
||||
result = diff + mMaxLines;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int prevIndex(int index) const {
|
||||
return --index < 0 ? index = mMaxLines - 1 : index;
|
||||
}
|
||||
|
||||
int nextIndex(int index) const { return (++index >= mMaxLines) ? index = 0 : index; }
|
||||
|
||||
void scrollToLastLine() { scroll(mMaxLines); }
|
||||
void scrollToFirstLine() { scroll(-mMaxLines); }
|
||||
void print_f_va(const char* fmt, va_list args) { JUTConsole_print_f_va_(this, fmt, args); }
|
||||
|
||||
/* 0x18 */ JGadget::TLinkListNode mListNode;
|
||||
/* 0x20 */ unsigned int field_0x20;
|
||||
/* 0x24 */ int mMaxLines;
|
||||
/* 0x28 */ u8* mBuf;
|
||||
/* 0x2C */ bool field_0x2c;
|
||||
/* 0x30 */ int field_0x30;
|
||||
/* 0x34 */ int field_0x34;
|
||||
/* 0x38 */ int field_0x38;
|
||||
/* 0x3C */ int field_0x3c;
|
||||
/* 0x40 */ int mPositionX;
|
||||
/* 0x44 */ int mPositionY;
|
||||
/* 0x48 */ u32 mHeight;
|
||||
/* 0x4C */ JUTFont* mFont;
|
||||
/* 0x50 */ f32 mFontSizeX;
|
||||
/* 0x54 */ f32 mFontSizeY;
|
||||
/* 0x58 */ int mOutput;
|
||||
/* 0x5C */ JUtility::TColor field_0x5c;
|
||||
/* 0x60 */ JUtility::TColor field_0x60;
|
||||
/* 0x64 */ int field_0x64;
|
||||
/* 0x68 */ bool mVisible;
|
||||
/* 0x69 */ bool field_0x69;
|
||||
/* 0x6A */ bool field_0x6a;
|
||||
/* 0x6B */ bool field_0x6b;
|
||||
}; // Size: 0x6C
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
class JUTConsoleManager {
|
||||
public:
|
||||
JUTConsoleManager();
|
||||
static JUTConsoleManager* createManager(JKRHeap*);
|
||||
void appendConsole(JUTConsole*);
|
||||
void removeConsole(JUTConsole*);
|
||||
void draw() const;
|
||||
void drawDirect(bool) const;
|
||||
void setDirectConsole(JUTConsole*);
|
||||
|
||||
JUTConsole* getDirectConsole() const { return mDirectConsole; }
|
||||
|
||||
static JUTConsoleManager* const getManager() { return sManager; }
|
||||
|
||||
static JUTConsoleManager* sManager;
|
||||
|
||||
#ifdef __MWERKS__
|
||||
typedef JGadget::TLinkList<JUTConsole, -offsetof(JUTConsole, mListNode)> ConsoleList;
|
||||
#else
|
||||
// clangd does not support offsetof in template arguments.
|
||||
typedef JGadget::TLinkList<JUTConsole, -sizeof(JKRDisposer)> ConsoleList;
|
||||
#endif
|
||||
|
||||
private:
|
||||
/* 0x00 */ ConsoleList soLink_;
|
||||
/* 0x0C */ JUTConsole* mActiveConsole;
|
||||
/* 0x10 */ JUTConsole* mDirectConsole;
|
||||
}; // Size: 0x14
|
||||
|
||||
#endif /* JUTCONSOLE_H */
|
||||
@@ -0,0 +1,53 @@
|
||||
#ifndef JUTDBPRINT_H
|
||||
#define JUTDBPRINT_H
|
||||
|
||||
#include "JSystem/JUtility/JUTFont.h"
|
||||
|
||||
class JKRHeap;
|
||||
|
||||
// TODO: fix struct
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
struct unk_print {
|
||||
/* 0x00 */ unk_print* mNext;
|
||||
/* 0x04 */ s16 unk_0x04;
|
||||
/* 0x06 */ s16 unk_0x06;
|
||||
/* 0x08 */ s16 unk_0x08;
|
||||
/* 0x0A */ s16 unk_0x0A;
|
||||
/* 0x0C */ char unk_0x0C[0];
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
class JUTDbPrint {
|
||||
public:
|
||||
JUTDbPrint(JUTFont*, JKRHeap*);
|
||||
static JUTDbPrint* start(JUTFont*, JKRHeap*);
|
||||
JUTFont* changeFont(JUTFont*);
|
||||
void enter(int, int, int, const char*, int);
|
||||
void flush(int, int, int, int);
|
||||
void flush();
|
||||
void drawString(int, int, int, const u8*);
|
||||
|
||||
static JUTDbPrint* getManager() { return sDebugPrint; }
|
||||
|
||||
void setVisible(bool visible) { mVisible = visible; }
|
||||
JUTFont* getFont() const { return mFont; }
|
||||
|
||||
void setCharColor(JUtility::TColor color) { mColor = color; };
|
||||
|
||||
static JUTDbPrint* sDebugPrint;
|
||||
|
||||
private:
|
||||
/* 0x00 */ unk_print* mFirst;
|
||||
/* 0x04 */ JUTFont* mFont;
|
||||
/* 0x08 */ JUtility::TColor mColor;
|
||||
/* 0x0C */ bool mVisible;
|
||||
/* 0x10 */ JKRHeap* mHeap;
|
||||
};
|
||||
|
||||
#endif /* JUTDBPRINT_H */
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef JUTDIRECTFILE_H
|
||||
#define JUTDIRECTFILE_H
|
||||
|
||||
#include <dvd.h>
|
||||
|
||||
#define JUTDF_BUFSIZE (0x800)
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
struct JUTDirectFile {
|
||||
int fetch32byte();
|
||||
JUTDirectFile();
|
||||
~JUTDirectFile();
|
||||
bool fopen(char const*);
|
||||
void fclose();
|
||||
int fgets(void*, int);
|
||||
|
||||
bool isOpened() const { return mIsOpen; }
|
||||
|
||||
/* 0x000 */ u8 mBuffer[0x820];
|
||||
/* 0x820 */ u8* mSectorStart;
|
||||
/* 0x824 */ u32 mToRead;
|
||||
/* 0x828 */ u32 mLength;
|
||||
/* 0x82C */ u32 mPos;
|
||||
/* 0x830 */ bool mIsOpen;
|
||||
/* 0x834 */ DVDFileInfo mFileInfo;
|
||||
};
|
||||
|
||||
#endif /* JUTDIRECTFILE_H */
|
||||
@@ -0,0 +1,63 @@
|
||||
#ifndef JUTDIRECTPRINT_H
|
||||
#define JUTDIRECTPRINT_H
|
||||
|
||||
#include "JSystem/JUtility/TColor.h"
|
||||
#include <cstdarg>
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
class JUTDirectPrint {
|
||||
private:
|
||||
JUTDirectPrint();
|
||||
|
||||
public:
|
||||
void erase(int, int, int, int);
|
||||
void drawChar(int, int, int);
|
||||
void changeFrameBuffer(void*, u16, u16);
|
||||
/* -------- */ void print(u16, u16, char const*, ...);
|
||||
void printSub(u16, u16, char const*, va_list, bool);
|
||||
void drawString(u16, u16, char*);
|
||||
void drawString_f(u16, u16, char const*, ...);
|
||||
void setCharColor(u8, u8, u8);
|
||||
void setCharColor(JUtility::TColor);
|
||||
|
||||
static JUTDirectPrint* start();
|
||||
|
||||
bool isActive() const { return field_0x00 != 0; }
|
||||
JUtility::TColor getCharColor() const { return mCharColor; }
|
||||
void changeFrameBuffer(void *param_0) { changeFrameBuffer(param_0, mFrameBufferWidth, mFrameBufferHeight); }
|
||||
void* getFrameBuffer() { return field_0x00; }
|
||||
|
||||
static JUTDirectPrint* getManager() { return sDirectPrint; }
|
||||
|
||||
private:
|
||||
static u8 sAsciiTable[128];
|
||||
static u32 sFontData[64];
|
||||
static u32 sFontData2[77];
|
||||
static JUTDirectPrint* sDirectPrint;
|
||||
static u8 sDirectPrint_padding[4 /* padding */];
|
||||
|
||||
private:
|
||||
/* 0x00 */ void* field_0x00;
|
||||
/* 0x04 */ u16 mFrameBufferWidth;
|
||||
/* 0x06 */ u16 mFrameBufferHeight;
|
||||
/* 0x08 */ u16 mStride;
|
||||
/* 0x0A */ u16 field_0x0A;
|
||||
/* 0x0C */ size_t mFrameBufferSize;
|
||||
/* 0x10 */ u8 field_0x10[4];
|
||||
/* 0x14 */ u16* mFrameBuffer;
|
||||
/* 0x18 */ JUtility::TColor mCharColor;
|
||||
/* 0x1C */ u16 mCharColor_Y;
|
||||
/* 0x1E */ u16 mCharColor_Cb;
|
||||
/* 0x20 */ u16 mCharColor_Cb2;
|
||||
/* 0x22 */ u16 mCharColor_Cb4;
|
||||
/* 0x24 */ u16 mCharColor_Cr;
|
||||
/* 0x26 */ u16 mCharColor_Cr2;
|
||||
/* 0x28 */ u16 mCharColor_Cr4;
|
||||
/* 0x2A */ u16 field_0x2A;
|
||||
/* 0x2C */
|
||||
};
|
||||
|
||||
#endif /* JUTDIRECTPRINT_H */
|
||||
@@ -0,0 +1,158 @@
|
||||
#ifndef JUTEXCEPTION_H
|
||||
#define JUTEXCEPTION_H
|
||||
|
||||
#include "JSystem/JKernel/JKRThread.h"
|
||||
#include "JSystem/JUtility/JUTGamePad.h"
|
||||
#include <cstdarg>
|
||||
#include <gx.h>
|
||||
#include <os.h>
|
||||
#include "global.h"
|
||||
|
||||
typedef struct _GXRenderModeObj GXRenderModeObj;
|
||||
typedef struct OSContext OSContext;
|
||||
class JUTDirectPrint;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
class JUTExternalFB {
|
||||
public:
|
||||
JUTExternalFB(_GXRenderModeObj*, GXGamma, void*, u32);
|
||||
|
||||
private:
|
||||
/* 0x00 */ _GXRenderModeObj* mRenderMode;
|
||||
/* 0x04 */ u32 mSize;
|
||||
/* 0x08 */ u32 field_0x08;
|
||||
/* 0x0C */ u16 field_0x0C;
|
||||
/* 0x0E */ u16 mGamma;
|
||||
/* 0x10 */ bool field_0x10;
|
||||
/* 0x11 */ u8 field_[3];
|
||||
};
|
||||
|
||||
STATIC_ASSERT(sizeof(JUTExternalFB) == 0x14);
|
||||
|
||||
#define JUT_PRINT_GPR 1
|
||||
#define JUT_PRINT_GPR_MAP 2
|
||||
#define JUT_PRINT_SRR0_MAP 4
|
||||
#define JUT_PRINT_FLOAT 8
|
||||
#define JUT_PRINT_STACK 16
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
|
||||
typedef void (*JUTExceptionUserCallback)(u16, OSContext*, u32, u32);
|
||||
|
||||
class JUTException : public JKRThread {
|
||||
public:
|
||||
enum EInfoPage {
|
||||
EINFO_PAGE_GPR = 1,
|
||||
EINFO_PAGE_FLOAT = 2,
|
||||
EINFO_PAGE_STACK = 3,
|
||||
EINFO_PAGE_GPR_MAP = 4,
|
||||
EINFO_PAGE_SSR0_MAP = 5,
|
||||
};
|
||||
|
||||
class JUTExMapFile {
|
||||
public:
|
||||
JUTExMapFile(const char* path) : mLink(this) { mPath = const_cast<char*>(path); }
|
||||
|
||||
public:
|
||||
/* 0x00 */ char* mPath;
|
||||
/* 0x04 */ JSULink<JUTExMapFile> mLink;
|
||||
/* 0x14 */
|
||||
};
|
||||
|
||||
JUTException(JUTDirectPrint*);
|
||||
virtual ~JUTException();
|
||||
|
||||
void showFloatSub(int, f32);
|
||||
void showFloat(OSContext*);
|
||||
void showStack(OSContext*);
|
||||
void showMainInfo(u16, OSContext*, u32, u32);
|
||||
void showGPR(OSContext*);
|
||||
bool showMapInfo_subroutine(u32, bool);
|
||||
void showGPRMap(OSContext*);
|
||||
void showSRR0Map(OSContext*);
|
||||
void printDebugInfo(JUTException::EInfoPage, OSError, OSContext*, u32, u32);
|
||||
bool isEnablePad() const;
|
||||
bool readPad(u32*, u32*);
|
||||
void printContext(u16, OSContext*, u32, u32);
|
||||
void createFB();
|
||||
|
||||
virtual void* run();
|
||||
|
||||
static JUTException* create(JUTDirectPrint*);
|
||||
static void errorHandler(OSError, OSContext*, u32, u32);
|
||||
static void panic_f_va(char const*, int, char const*, va_list);
|
||||
static void panic_f(char const*, int, char const*, ...);
|
||||
static void setFPException(u32);
|
||||
static bool searchPartialModule(u32, u32*, u32*, u32*, u32*);
|
||||
static JUTExceptionUserCallback setPreUserCallback(JUTExceptionUserCallback);
|
||||
static JUTExceptionUserCallback setPostUserCallback(JUTExceptionUserCallback);
|
||||
static void appendMapFile(char const*);
|
||||
static bool queryMapAddress(char*, u32, s32, u32*, u32*, char*, u32, bool, bool);
|
||||
static bool queryMapAddress_single(char*, u32, s32, u32*, u32*, char*, u32, bool,
|
||||
bool);
|
||||
static void createConsole(void*, u32);
|
||||
static void waitTime(s32);
|
||||
|
||||
static JUTException* getManager() { return sErrorManager; }
|
||||
static JUTConsole* getConsole() { return sConsole; }
|
||||
|
||||
JUTExternalFB* getFrameMemory() const { return mFrameMemory; }
|
||||
|
||||
void setTraceSuppress(u32 param_0) { mTraceSuppress = param_0; }
|
||||
void setGamePad(JUTGamePad* gamePad) {
|
||||
mGamePad = gamePad;
|
||||
mGamePadPort = JUTGamePad::EPortInvalid;
|
||||
}
|
||||
|
||||
static void setMapFile(const char* map) {
|
||||
appendMapFile(map);
|
||||
}
|
||||
static void panic(const char* file, int line, const char* msg) {
|
||||
panic_f(file, line, "%s", msg);
|
||||
}
|
||||
|
||||
private:
|
||||
static OSMessageQueue sMessageQueue;
|
||||
static const char* sCpuExpName[17];
|
||||
static JSUList<JUTException::JUTExMapFile> sMapFileList;
|
||||
static OSMessage sMessageBuffer[1];
|
||||
static JUTException* sErrorManager;
|
||||
static JUTExceptionUserCallback sPreUserCallback;
|
||||
static JUTExceptionUserCallback sPostUserCallback;
|
||||
static void* sConsoleBuffer;
|
||||
static u32 sConsoleBufferSize;
|
||||
static JUTConsole* sConsole;
|
||||
static u32 msr;
|
||||
static u32 fpscr;
|
||||
|
||||
private:
|
||||
/* 0x7C */ JUTExternalFB* mFrameMemory;
|
||||
/* 0x80 */ JUTDirectPrint* mDirectPrint;
|
||||
/* 0x84 */ JUTGamePad* mGamePad;
|
||||
/* 0x88 */ JUTGamePad::EPadPort mGamePadPort;
|
||||
/* 0x8C */ s32 mPrintWaitTime0;
|
||||
/* 0x90 */ s32 mPrintWaitTime1;
|
||||
/* 0x94 */ u32 mTraceSuppress;
|
||||
/* 0x98 */ u32 field_0x98;
|
||||
/* 0x9C */ u32 mPrintFlags;
|
||||
/* 0xA0 */ u32 mStackPointer;
|
||||
};
|
||||
|
||||
STATIC_ASSERT(sizeof(JUTException) == 0xA4);
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
struct JUTWarn {
|
||||
JUTWarn& operator<<(const char*) { return *this; }
|
||||
JUTWarn& operator<<(s32) { return *this; }
|
||||
};
|
||||
|
||||
#endif /* JUTEXCEPTION_H */
|
||||
@@ -0,0 +1,39 @@
|
||||
#ifndef JUTFADER_H
|
||||
#define JUTFADER_H
|
||||
|
||||
#include "JSystem/JGeometry.h"
|
||||
#include "JSystem/JUtility/TColor.h"
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
class JUTFader {
|
||||
public:
|
||||
enum EStatus {
|
||||
UNKSTATUS_M1 = -1,
|
||||
UNKSTATUS_0 = 0,
|
||||
};
|
||||
|
||||
JUTFader(int, int, int, int, JUtility::TColor);
|
||||
void control();
|
||||
void setStatus(JUTFader::EStatus, int);
|
||||
|
||||
virtual ~JUTFader();
|
||||
virtual bool startFadeIn(int);
|
||||
virtual bool startFadeOut(int);
|
||||
virtual void draw();
|
||||
|
||||
s32 getStatus() const { return mStatus; }
|
||||
void setColor(JUtility::TColor color) { mColor.set(color); }
|
||||
|
||||
/* 0x04 */ s32 mStatus;
|
||||
/* 0x08 */ u16 field_0x8;
|
||||
/* 0x0A */ u16 field_0xa;
|
||||
/* 0x0C */ JUtility::TColor mColor;
|
||||
/* 0x10 */ JGeometry::TBox2<f32> mBox;
|
||||
/* 0x20 */ int mEStatus;
|
||||
/* 0x24 */ u32 field_0x24;
|
||||
};
|
||||
|
||||
#endif /* JUTFADER_H */
|
||||
@@ -0,0 +1,154 @@
|
||||
#ifndef JUTFONT_H
|
||||
#define JUTFONT_H
|
||||
|
||||
#include "JSystem/JUtility/TColor.h"
|
||||
#include <cstring>
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
struct ResFONT {
|
||||
struct INF1 {
|
||||
/* 0x00 */ u32 magic;
|
||||
/* 0x04 */ u32 size;
|
||||
/* 0x08 */ u16 fontType;
|
||||
/* 0x0A */ u16 ascent;
|
||||
/* 0x0C */ u16 descent;
|
||||
/* 0x0E */ u16 width;
|
||||
/* 0x10 */ u16 leading;
|
||||
/* 0x12 */ u16 defaultCode;
|
||||
};
|
||||
|
||||
struct WID1 {
|
||||
/* 0x00 */ u32 magic;
|
||||
/* 0x04 */ u32 size;
|
||||
/* 0x08 */ u16 startCode;
|
||||
/* 0x0A */ u16 endCode;
|
||||
/* 0x0C */ u8 mChunkNum[4];
|
||||
};
|
||||
|
||||
struct MAP1 {
|
||||
/* 0x00 */ u32 magic;
|
||||
/* 0x04 */ u32 size;
|
||||
/* 0x08 */ u16 mappingMethod;
|
||||
/* 0x0A */ u16 startCode;
|
||||
/* 0x0C */ u16 endCode;
|
||||
/* 0x0E */ u16 numEntries;
|
||||
/* 0x10 */ u16 mLeading;
|
||||
};
|
||||
|
||||
struct GLY1 {
|
||||
/* 0x00 */ u32 magic;
|
||||
/* 0x04 */ u32 size;
|
||||
/* 0x08 */ u16 startCode;
|
||||
/* 0x0A */ u16 endCode;
|
||||
/* 0x0C */ u16 cellWidth;
|
||||
/* 0x0E */ u16 cellHeight;
|
||||
/* 0x10 */ u32 textureSize;
|
||||
/* 0x14 */ u16 textureFormat;
|
||||
/* 0x16 */ u16 numRows;
|
||||
/* 0x18 */ u16 numColumns;
|
||||
/* 0x1A */ u16 textureWidth;
|
||||
/* 0x1C */ u16 textureHeight;
|
||||
/* 0x1E */ u16 padding;
|
||||
/* 0x20 */ u8 data[];
|
||||
};
|
||||
|
||||
/* 0x00 */ u64 magic;
|
||||
/* 0x08 */ u32 filesize;
|
||||
/* 0x0C */ u32 numBlocks;
|
||||
/* 0x10 */ u8 padding[0x10];
|
||||
/* 0x20 */ u8 data[];
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
class JUTFont {
|
||||
public:
|
||||
JUTFont();
|
||||
virtual ~JUTFont() {}
|
||||
|
||||
struct TWidth {
|
||||
u8 field_0x0;
|
||||
u8 field_0x1;
|
||||
};
|
||||
|
||||
/* 0x0C */ virtual void setGX() = 0;
|
||||
/* 0x10 */ virtual void setGX(JUtility::TColor col1, JUtility::TColor col2) { setGX(); }
|
||||
/* 0x14 */ virtual f32 drawChar_scale(f32 a1, f32 a2, f32 a3, f32 a4, int a5, bool a6) = 0;
|
||||
/* 0x18 */ virtual int getLeading() const = 0;
|
||||
/* 0x1C */ virtual s32 getAscent() const = 0;
|
||||
/* 0x20 */ virtual s32 getDescent() const = 0;
|
||||
/* 0x24 */ virtual s32 getHeight() const = 0;
|
||||
/* 0x28 */ virtual s32 getWidth() const = 0;
|
||||
/* 0x2C */ virtual void getWidthEntry(int i_no, TWidth* width) const = 0;
|
||||
/* 0x30 */ virtual s32 getCellWidth() const { return getWidth(); }
|
||||
/* 0x34 */ virtual s32 getCellHeight() const { return getHeight(); }
|
||||
/* 0x38 */ virtual int getFontType() const = 0;
|
||||
/* 0x3C */ virtual ResFONT* getResFont() const = 0;
|
||||
/* 0x40 */ virtual bool isLeadByte(int a1) const = 0;
|
||||
|
||||
static bool isLeadByte_1Byte(int b) {
|
||||
return false;
|
||||
}
|
||||
static bool isLeadByte_2Byte(int b) {
|
||||
return true;
|
||||
}
|
||||
static bool isLeadByte_ShiftJIS(int b) {
|
||||
return (b >= 0x81 && b <= 0x9f) || (b >= 0xe0 && b <= 0xfc);
|
||||
}
|
||||
static bool isLeadByte_EUC(int b) {
|
||||
return (b >= 0xA1 && b <= 0xFE) || b == 0x8E;
|
||||
}
|
||||
|
||||
void initialize_state();
|
||||
void setCharColor(JUtility::TColor col1);
|
||||
void setGradColor(JUtility::TColor col1, JUtility::TColor col2);
|
||||
f32 drawString_size_scale(f32 posX, f32 posY, f32 width, f32 height, const char* str, u32 usz,
|
||||
bool visible);
|
||||
|
||||
void drawString(int posX, int posY, const char* str, bool visible) {
|
||||
drawString_size(posX, posY, str, strlen(str), visible);
|
||||
}
|
||||
|
||||
s32 drawString_size(int posX, int posY, const char* str, u32 len, bool visible) {
|
||||
return drawString_size_scale(posX, posY, getWidth(), getHeight(), str, len, visible);
|
||||
}
|
||||
|
||||
f32 drawString_scale(f32 posX, f32 posY, f32 width, f32 height, const char* str,
|
||||
bool visible) {
|
||||
return (int)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.field_0x1;
|
||||
}
|
||||
|
||||
bool isValid() const { return mValid; }
|
||||
bool isFixed() const { return mFixed; }
|
||||
int getFixedWidth() const { return mFixedWidth; }
|
||||
void setFixedWidth(bool fixed, int width) {
|
||||
mFixed = fixed;
|
||||
mFixedWidth = width;
|
||||
}
|
||||
int getOffset(int i_no) const {
|
||||
JUTFont::TWidth width;
|
||||
getWidthEntry(i_no, &width);
|
||||
return width.field_0x0;
|
||||
}
|
||||
|
||||
/* 0x04 */ bool mValid;
|
||||
/* 0x05 */ bool mFixed;
|
||||
/* 0x08 */ int mFixedWidth;
|
||||
/* 0x0C */ JUtility::TColor mColor1;
|
||||
/* 0x10 */ JUtility::TColor mColor2;
|
||||
/* 0x14 */ JUtility::TColor mColor3;
|
||||
/* 0x18 */ JUtility::TColor mColor4;
|
||||
};
|
||||
|
||||
#endif /* JUTFONT_H */
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef JUTFONTDATA_ASCFONT_FIX12_H
|
||||
#define JUTFONTDATA_ASCFONT_FIX12_H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
#endif /* JUTFONTDATA_ASCFONT_FIX12_H */
|
||||
@@ -0,0 +1,297 @@
|
||||
#ifndef JUTGAMEPAD_H
|
||||
#define JUTGAMEPAD_H
|
||||
|
||||
#include "JSystem/JKernel/JKRDisposer.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#ifdef __REVOLUTION_SDK__
|
||||
#include <revolution.h>
|
||||
#else
|
||||
#include <dolphin.h>
|
||||
#endif
|
||||
|
||||
typedef void (*callbackFn)(int, void*);
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
struct JUTGamePadRecordBase {
|
||||
virtual ~JUTGamePadRecordBase() {}
|
||||
virtual void getStatus(PADStatus* pad) = 0;
|
||||
virtual void write(PADStatus* pad) = 0;
|
||||
|
||||
bool isActive() const { return mActive; }
|
||||
|
||||
/* 0x4 */ bool mActive;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
struct JUTGamePad : public JKRDisposer {
|
||||
public:
|
||||
enum EStickMode {
|
||||
EStickMode1 = 1,
|
||||
};
|
||||
|
||||
enum EWhichStick {
|
||||
EMainStick,
|
||||
ESubStick,
|
||||
};
|
||||
|
||||
enum EPadPort {
|
||||
EPortInvalid = -1,
|
||||
EPort1,
|
||||
EPort2,
|
||||
EPort3,
|
||||
EPort4,
|
||||
};
|
||||
|
||||
enum EClampMode {
|
||||
EClampNone,
|
||||
EClampStick,
|
||||
EClampCircle,
|
||||
};
|
||||
|
||||
JUTGamePad(JUTGamePad::EPadPort port);
|
||||
virtual ~JUTGamePad();
|
||||
|
||||
void initList();
|
||||
static BOOL init();
|
||||
void clear();
|
||||
static u32 read();
|
||||
void assign();
|
||||
void checkResetCallback(OSTime holdTime);
|
||||
void update();
|
||||
void stopPatternedRumble() { mRumble.stopPatternedRumble(mPortNum); }
|
||||
void setButtonRepeat(u32, u32, u32);
|
||||
|
||||
static void checkResetSwitch();
|
||||
static void clearForReset();
|
||||
static JUTGamePad* getGamePad(int port);
|
||||
static bool recalibrate(u32 mask);
|
||||
|
||||
static void setAnalogMode(u32 mode) {
|
||||
sAnalogMode = mode;
|
||||
PADSetAnalogMode(mode);
|
||||
}
|
||||
|
||||
static int getClampMode() { return sClampMode; }
|
||||
|
||||
static void clearResetOccurred() { C3ButtonReset::sResetOccurred = false; }
|
||||
|
||||
static void setResetCallback(callbackFn callback, void* arg) {
|
||||
C3ButtonReset::sCallback = callback;
|
||||
C3ButtonReset::sCallbackArg = arg;
|
||||
}
|
||||
|
||||
u32 getButton() const { return mButton.mButton; }
|
||||
u32 getTrigger() const { return mButton.mTrigger; }
|
||||
u32 getRelease() const { return mButton.mRelease; }
|
||||
u32 getRepeat() const { return mButton.mRepeat; }
|
||||
f32 getMainStickX() const { return mMainStick.mPosX; }
|
||||
f32 getMainStickY() const { return mMainStick.mPosY; }
|
||||
f32 getMainStickValue() const { return mMainStick.mValue; }
|
||||
s16 getMainStickAngle() const { return mMainStick.mAngle; }
|
||||
f32 getSubStickX() const { return mSubStick.mPosX; }
|
||||
f32 getSubStickY() const { return mSubStick.mPosY; }
|
||||
f32 getSubStickValue() const { return mSubStick.mValue; }
|
||||
s16 getSubStickAngle() const { return mSubStick.mAngle; }
|
||||
u8 getAnalogA() const { return mButton.mAnalogA; }
|
||||
u8 getAnalogB() const { return mButton.mAnalogB; }
|
||||
u8 getAnalogL() const { return mButton.mAnalogL; }
|
||||
u8 getAnalogR() const { return mButton.mAnalogR; }
|
||||
s8 getErrorStatus() const { return mErrorStatus; }
|
||||
|
||||
s16 getPortNum() const { return mPortNum; }
|
||||
|
||||
JUTGamePadRecordBase* getPadReplay() const { return mPadReplay; }
|
||||
JUTGamePadRecordBase* getPadRecord() const { return mPadRecord; }
|
||||
|
||||
bool testButton(u32 button) const { return mButton.mButton & button; }
|
||||
bool testTrigger(u32 button) const { return mButton.mTrigger & button; }
|
||||
|
||||
bool isPushing3ButtonReset() const {
|
||||
return mPortNum != EPortInvalid && mButtonReset.mReset != false;
|
||||
}
|
||||
|
||||
void stopMotorWave() { mRumble.stopPatternedRumbleAtThePeriod(); }
|
||||
void stopMotor() { mRumble.stopMotor(mPortNum, false); }
|
||||
void stopMotorHard() { CRumble::stopMotorHard(mPortNum); }
|
||||
|
||||
static s8 getPortStatus(EPadPort port) {
|
||||
JUT_ASSERT(360, 0 <= port && port < 4);
|
||||
return mPadStatus[port].err;
|
||||
}
|
||||
|
||||
struct CButton {
|
||||
CButton() { clear(); }
|
||||
void clear();
|
||||
void update(const PADStatus* padStatus, u32 stickStatus);
|
||||
void setRepeat(u32 mask, u32 delay, u32 rate);
|
||||
|
||||
/* 0x00 */ u32 mButton;
|
||||
/* 0x04 */ u32 mTrigger; // Pressed Buttons
|
||||
/* 0x08 */ u32 mRelease; // Released Buttons
|
||||
/* 0x0C */ u8 mAnalogA;
|
||||
/* 0x0D */ u8 mAnalogB;
|
||||
/* 0x0E */ u8 mAnalogL;
|
||||
/* 0x0F */ u8 mAnalogR;
|
||||
/* 0x10 */ f32 mAnalogLf;
|
||||
/* 0x14 */ f32 mAnalogRf;
|
||||
/* 0x18 */ u32 mRepeat;
|
||||
/* 0x1C */ u32 mRepeatCount;
|
||||
/* 0x20 */ u32 mRepeatStart;
|
||||
/* 0x24 */ u32 mRepeatMask;
|
||||
/* 0x28 */ u32 mRepeatDelay;
|
||||
/* 0x2C */ u32 mRepeatRate;
|
||||
}; // Size: 0x30
|
||||
|
||||
struct C3ButtonReset {
|
||||
C3ButtonReset() { mReset = false; }
|
||||
|
||||
static u32 sResetPattern;
|
||||
static u32 sResetMaskPattern;
|
||||
static callbackFn sCallback;
|
||||
static void* sCallbackArg;
|
||||
static OSTime sThreshold;
|
||||
static s32 sResetOccurredPort;
|
||||
static bool sResetOccurred;
|
||||
static bool sResetSwitchPushing;
|
||||
|
||||
/* 0x0 */ bool mReset;
|
||||
}; // Size: 0x4
|
||||
|
||||
struct CStick {
|
||||
static f32 sPressPoint;
|
||||
static f32 sReleasePoint;
|
||||
|
||||
CStick() { clear(); }
|
||||
void clear();
|
||||
void clear(JUTGamePad* pad);
|
||||
u32 update(s8 x, s8 u, JUTGamePad::EStickMode mode, JUTGamePad::EWhichStick stick,
|
||||
u32 buttons);
|
||||
u32 getButton(u32 buttons);
|
||||
|
||||
/* 0x0 */ f32 mPosX;
|
||||
/* 0x4 */ f32 mPosY;
|
||||
/* 0x8 */ f32 mValue;
|
||||
/* 0xC */ s16 mAngle;
|
||||
/* 0xE */ s8 mRawX;
|
||||
/* 0xF */ s8 mRawY;
|
||||
}; // Size: 0x10
|
||||
|
||||
void stopMotorWaveHard() { mRumble.stopPatternedRumble(mPortNum); }
|
||||
|
||||
struct CRumble {
|
||||
CRumble(JUTGamePad* pad) { clear(pad); }
|
||||
|
||||
static u32 sChannelMask[4];
|
||||
static u8 mStatus[4];
|
||||
static u32 mEnabled;
|
||||
|
||||
enum ERumble {
|
||||
VAL_0 = 0,
|
||||
VAL_1 = 1,
|
||||
VAL_2 = 2,
|
||||
};
|
||||
|
||||
void clear();
|
||||
void clear(JUTGamePad* pad);
|
||||
static void startMotor(int port);
|
||||
static void stopMotor(int port, bool hard_stop);
|
||||
void update(s16 port);
|
||||
void triggerPatternedRumble(u32 length);
|
||||
void startPatternedRumble(void* data, ERumble rumble, u32 length);
|
||||
void stopPatternedRumble(s16 port);
|
||||
void stopPatternedRumbleAtThePeriod();
|
||||
static void setEnabled(u32 mask);
|
||||
|
||||
static void stopMotor(int port) { stopMotor(port, false); }
|
||||
static void stopMotorHard(int port) { stopMotor(port, true); }
|
||||
|
||||
static bool isEnabled(u32 mask) {
|
||||
bool result;
|
||||
if (mEnabled & mask) {
|
||||
result = true;
|
||||
} else {
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool isEnabledPort(int port) {
|
||||
JUT_ASSERT(250, 0 <= port && port < 4);
|
||||
return isEnabled(sChannelMask[port]);
|
||||
}
|
||||
|
||||
/* 0x00 */ u32 mFrame;
|
||||
/* 0x04 */ u32 mLength;
|
||||
/* 0x08 */ u8* mPattern;
|
||||
/* 0x0C */ u32 mFrameCount;
|
||||
/* 0x10 */ u8* field_0x10;
|
||||
}; // Size: 0x14
|
||||
|
||||
void startMotorWave(void* data, CRumble::ERumble rumble, u32 length) {
|
||||
mRumble.startPatternedRumble(data, rumble, length);
|
||||
}
|
||||
|
||||
static JSUList<JUTGamePad> mPadList;
|
||||
static bool mListInitialized;
|
||||
static PADStatus mPadStatus[4];
|
||||
static CButton mPadButton[4];
|
||||
static CStick mPadMStick[4];
|
||||
static CStick mPadSStick[4];
|
||||
static EStickMode sStickMode;
|
||||
static int sClampMode;
|
||||
static u8 mPadAssign[4];
|
||||
static u32 sSuppressPadReset;
|
||||
static s32 sAnalogMode;
|
||||
static u32 sRumbleSupported;
|
||||
|
||||
/* 0x18 */ CButton mButton;
|
||||
/* 0x48 */ CStick mMainStick;
|
||||
/* 0x58 */ CStick mSubStick;
|
||||
/* 0x68 */ CRumble mRumble;
|
||||
/* 0x7C */ s16 mPortNum;
|
||||
/* 0x7E */ s8 mErrorStatus;
|
||||
/* 0x80 */ JSULink<JUTGamePad> mLink;
|
||||
/* 0x90 */ JUTGamePadRecordBase* mPadRecord;
|
||||
/* 0x94 */ JUTGamePadRecordBase* mPadReplay;
|
||||
/* 0x98 */ C3ButtonReset mButtonReset;
|
||||
/* 0x9C */ u8 field_0x9c[4];
|
||||
/* 0xA0 */ OSTime mResetHoldStartTime;
|
||||
/* 0xA8 */ u8 field_0xa8;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
struct JUTGamePadLongPress {
|
||||
static JSUList<JUTGamePadLongPress> sPatternList;
|
||||
void checkCallback(int port, u32 hold_time);
|
||||
|
||||
u32 getMaskPattern() const { return mMaskPattern; }
|
||||
u32 getPattern() const { return mPattern; }
|
||||
bool isValid() const { return mValid; }
|
||||
|
||||
/* 0x00 */ u8 field_0x0[0x10];
|
||||
/* 0x10 */ bool mValid;
|
||||
/* 0x11 */ bool field_0x11;
|
||||
/* 0x14 */ u32 mPattern;
|
||||
/* 0x18 */ u32 mMaskPattern;
|
||||
/* 0x1C */ u32 mThreshold;
|
||||
/* 0x20 */ bool mLongPressStatus[4];
|
||||
/* 0x28 */ OSTime mStartHoldTime[4];
|
||||
/* 0x48 */ bool field_0x48[4];
|
||||
/* 0x4C */ void (*mCallback)(s32, JUTGamePadLongPress*, s32);
|
||||
/* 0x50 */ s32 field_0x50;
|
||||
};
|
||||
|
||||
inline u32 JUTReadGamePad() {
|
||||
return JUTGamePad::read();
|
||||
}
|
||||
|
||||
#endif /* JUTGAMEPAD_H */
|
||||
@@ -0,0 +1,45 @@
|
||||
#ifndef JUTGRAPHFIFO_H
|
||||
#define JUTGRAPHFIFO_H
|
||||
|
||||
#include <gx.h>
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
class JUTGraphFifo {
|
||||
public:
|
||||
JUTGraphFifo(u32);
|
||||
|
||||
virtual ~JUTGraphFifo();
|
||||
|
||||
static bool* getGpStatus() {
|
||||
GXGetGPStatus((GXBool*)&mGpStatus[0], (GXBool*)&mGpStatus[1], (GXBool*)&mGpStatus[2],
|
||||
(GXBool*)&mGpStatus[3], (GXBool*)&mGpStatus[4]);
|
||||
return mGpStatus;
|
||||
}
|
||||
|
||||
static bool isGPActive() {
|
||||
getGpStatus();
|
||||
return mGpStatus[2] == false;
|
||||
}
|
||||
|
||||
void save() {
|
||||
#if !PLATFORM_SHIELD
|
||||
GXSaveCPUFifo(this->mFifo);
|
||||
#endif
|
||||
}
|
||||
|
||||
static JUTGraphFifo* sCurrentFifo;
|
||||
static bool mGpStatus[5];
|
||||
|
||||
private:
|
||||
/* 0x04 */ GXFifoObj* mFifo;
|
||||
/* 0x08 */ void* mBase;
|
||||
/* 0x0C */ u32 mSize;
|
||||
/* 0x10 */ u8 field_0x10[0xC];
|
||||
};
|
||||
|
||||
inline JUTGraphFifo* JUTCreateFifo(u32 bufSize) { return new JUTGraphFifo(bufSize); }
|
||||
|
||||
#endif /* JUTGRAPHFIFO_H */
|
||||
@@ -0,0 +1,45 @@
|
||||
#ifndef JUTNAMETAB_H
|
||||
#define JUTNAMETAB_H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
struct ResNTAB {
|
||||
u16 mEntryNum;
|
||||
u16 mPad0;
|
||||
struct Entry {
|
||||
u16 mKeyCode;
|
||||
u16 mOffs;
|
||||
} mEntries[1];
|
||||
|
||||
inline const char* getName(u32 index) const {
|
||||
return ((const char*)mEntries) + mEntries[index].mOffs - 4;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
class JUTNameTab {
|
||||
public:
|
||||
JUTNameTab();
|
||||
JUTNameTab(const ResNTAB* pNameTable);
|
||||
virtual ~JUTNameTab() {};
|
||||
|
||||
void setResource(const ResNTAB* pNameTable);
|
||||
s32 getIndex(char const*) const;
|
||||
const char* getName(u16 index) const;
|
||||
u16 calcKeyCode(char const* pName) const;
|
||||
const ResNTAB* getResNameTable() const { return mNameTable; }
|
||||
|
||||
private:
|
||||
/* 0x4 */ const ResNTAB* mNameTable;
|
||||
/* 0x8 */ const char* mpStrData;
|
||||
/* 0xC */ u16 mNameNum;
|
||||
};
|
||||
|
||||
#endif /* JUTNAMETAB_H */
|
||||
@@ -0,0 +1,51 @@
|
||||
#ifndef JUTPALETTE_H
|
||||
#define JUTPALETTE_H
|
||||
|
||||
#include <gx.h>
|
||||
|
||||
enum JUTTransparency { UNK0, UNK1 };
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
struct ResTLUT {
|
||||
u8 format;
|
||||
u8 transparency;
|
||||
u16 numColors;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
class JUTPalette {
|
||||
public:
|
||||
JUTPalette(GXTlut p1, GXTlutFmt p2, JUTTransparency p3, u16 p4, void* p5) {
|
||||
this->storeTLUT(p1, p2, p3, p4, p5);
|
||||
}
|
||||
|
||||
JUTPalette(GXTlut tlutNo, ResTLUT* p_tlutRes) {
|
||||
storeTLUT(tlutNo, p_tlutRes);
|
||||
}
|
||||
|
||||
void storeTLUT(GXTlut, ResTLUT*);
|
||||
void storeTLUT(GXTlut, GXTlutFmt, JUTTransparency, u16, void*);
|
||||
bool load();
|
||||
|
||||
GXTlut getTlutName() const { return GXTlut(mTlutName); }
|
||||
GXTlutFmt getFormat() const { return GXTlutFmt(mFormat); }
|
||||
JUTTransparency getTransparency() const { return JUTTransparency(mTransparency); }
|
||||
u16 getNumColors() const { return mNumColors; }
|
||||
ResTLUT* getColorTable() const { return mColorTable; }
|
||||
|
||||
private:
|
||||
/* 0x00 */ GXTlutObj mTlutObj;
|
||||
/* 0x0C */ u8 mTlutName;
|
||||
/* 0x0D */ u8 mFormat;
|
||||
/* 0x10 */ ResTLUT* mColorTable;
|
||||
/* 0x14 */ u16 mNumColors;
|
||||
/* 0x16 */ u8 mTransparency;
|
||||
};
|
||||
|
||||
#endif /* JUTPALETTE_H */
|
||||
@@ -0,0 +1,124 @@
|
||||
#ifndef JUTPROCBAR_H
|
||||
#define JUTPROCBAR_H
|
||||
|
||||
#include "JSystem/JUtility/TColor.h"
|
||||
#include <os.h>
|
||||
|
||||
class JKRHeap;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
class JUTProcBar {
|
||||
public:
|
||||
class CTime {
|
||||
public:
|
||||
CTime() { clear(); }
|
||||
|
||||
void clear() {
|
||||
mCost = 0;
|
||||
field_0x8 = 0;
|
||||
field_0xc = 0;
|
||||
}
|
||||
|
||||
void start(u8 param_0, u8 param_1, u8 param_2) {
|
||||
mR = param_0;
|
||||
mG = param_1;
|
||||
mB = param_2;
|
||||
mTick = OSGetTick();
|
||||
}
|
||||
|
||||
void end() {
|
||||
OSTick diff = OSGetTick() - mTick;
|
||||
mCost = OSTicksToMicroseconds(diff);
|
||||
if (mCost == 0) {
|
||||
mCost = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void accumePeek() {
|
||||
if (++field_0xc >= 0x10 || mCost >= field_0x8) {
|
||||
field_0x8 = mCost;
|
||||
field_0xc = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int calcBarSize(int p1, int p2) { return mCost * p1 / p2; }
|
||||
|
||||
/* 0x00 */ u32 mTick;
|
||||
/* 0x04 */ u32 mCost;
|
||||
/* 0x08 */ u32 field_0x8;
|
||||
/* 0x0C */ u32 field_0xc;
|
||||
/* 0x10 */ u8 mR;
|
||||
/* 0x11 */ u8 mG;
|
||||
/* 0x12 */ u8 mB;
|
||||
};
|
||||
|
||||
class CParamSet {
|
||||
public:
|
||||
/* 0x00 */ int mBarWidth;
|
||||
/* 0x04 */ int mPosX;
|
||||
/* 0x08 */ int mPosY;
|
||||
/* 0x0C */ int mWidth;
|
||||
/* 0x10 */ int mUserPosition;
|
||||
|
||||
CParamSet() {}
|
||||
void setBarWidth(int width) { mBarWidth = width; }
|
||||
void setPosition(int x, int y) {
|
||||
mPosX = x;
|
||||
mPosY = y;
|
||||
}
|
||||
void setWidth(int width) { mWidth = width; }
|
||||
void setUserPosition(int userPos) { mUserPosition = userPos; }
|
||||
};
|
||||
|
||||
JUTProcBar();
|
||||
~JUTProcBar();
|
||||
static JUTProcBar* create();
|
||||
static void destroy();
|
||||
static void clear();
|
||||
void bar_subroutine(int, int, int, int, int, int, int, JUtility::TColor,
|
||||
JUtility::TColor);
|
||||
void adjustMeterLength(u32, f32*, f32, f32, int*);
|
||||
void draw();
|
||||
void drawProcessBar();
|
||||
void drawHeapBar();
|
||||
|
||||
void cpuStart() { mCpu.start(255, 129, 30); }
|
||||
void cpuEnd() { mCpu.end(); }
|
||||
void gpWaitStart() { mGpWait.start(255, 129, 30); }
|
||||
void gpWaitEnd() { mGpWait.end(); }
|
||||
void gpStart() { mGp.start(255, 129, 30); }
|
||||
void gpEnd() { mGp.end(); }
|
||||
void wholeLoopStart() { mWholeLoop.start(255, 129, 30); }
|
||||
void wholeLoopEnd() { mWholeLoop.end(); }
|
||||
void idleStart() { mIdle.start(255, 129, 30); }
|
||||
void idleEnd() { mIdle.end(); }
|
||||
void setCostFrame(int frame) { sManager->mCostFrame = frame; }
|
||||
void setVisible(bool visible) { mVisible = visible; }
|
||||
void setVisibleHeapBar(bool visible) { mHeapBarVisible = visible; }
|
||||
void setWatchHeap(JKRHeap* pHeap) { mWatchHeap = pHeap; }
|
||||
|
||||
static JUTProcBar* getManager() { return sManager; }
|
||||
|
||||
static JUTProcBar* sManager;
|
||||
|
||||
private:
|
||||
/* 0x000 */ CTime mIdle;
|
||||
/* 0x014 */ CTime mGp;
|
||||
/* 0x028 */ CTime mCpu;
|
||||
/* 0x03C */ CTime mGpWait;
|
||||
/* 0x050 */ CTime mWholeLoop;
|
||||
/* 0x064 */ CTime mUsers[8];
|
||||
/* 0x104 */ int mCostFrame;
|
||||
/* 0x108 */ int field_0x108;
|
||||
/* 0x10C */ bool mVisible;
|
||||
/* 0x110 */ int field_0x110;
|
||||
/* 0x114 */ CParamSet mParams;
|
||||
/* 0x128 */ int field_0x128;
|
||||
/* 0x12C */ JKRHeap* mWatchHeap;
|
||||
/* 0x130 */ bool mHeapBarVisible;
|
||||
};
|
||||
|
||||
#endif /* JUTPROCBAR_H */
|
||||
@@ -0,0 +1,7 @@
|
||||
#ifndef JSYSTEM_JUTILITY_JUTREPORT_H
|
||||
#define JSYSTEM_JUTILITY_JUTREPORT_H
|
||||
|
||||
void JUTReport(int x_pos, int y_pos, const char* str, ...);
|
||||
void JUTReport(int x_pos, int y_pos, int, const char* str, ...);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,85 @@
|
||||
#ifndef JUTRESFONT_H
|
||||
#define JUTRESFONT_H
|
||||
|
||||
#include "JSystem/JUtility/JUTFont.h"
|
||||
|
||||
class JKRHeap;
|
||||
|
||||
typedef bool (*IsLeadByte_func)(int);
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
struct BlockHeader {
|
||||
const BlockHeader* getNext() const { return reinterpret_cast<const BlockHeader*>(reinterpret_cast<const u8*>(this) + size); }
|
||||
u32 magic;
|
||||
u32 size;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
class JUTResFont : public JUTFont {
|
||||
public:
|
||||
virtual ~JUTResFont();
|
||||
virtual void setGX();
|
||||
virtual void setGX(JUtility::TColor, JUtility::TColor);
|
||||
virtual f32 drawChar_scale(f32, f32, f32, f32, int, bool);
|
||||
virtual int getLeading() const;
|
||||
virtual s32 getAscent() const;
|
||||
virtual s32 getDescent() const;
|
||||
virtual s32 getHeight() const;
|
||||
virtual s32 getWidth() const;
|
||||
virtual void getWidthEntry(int, JUTFont::TWidth*) const;
|
||||
virtual s32 getCellWidth() const;
|
||||
virtual s32 getCellHeight() const;
|
||||
virtual int getFontType() const;
|
||||
virtual ResFONT* getResFont() const;
|
||||
virtual bool isLeadByte(int) const;
|
||||
virtual void loadImage(int, _GXTexMapID);
|
||||
virtual void setBlock();
|
||||
|
||||
JUTResFont(ResFONT const*, JKRHeap*);
|
||||
JUTResFont();
|
||||
void deleteMemBlocks_ResFont();
|
||||
void initialize_state();
|
||||
bool initiate(ResFONT const*, JKRHeap*);
|
||||
bool protected_initiate(ResFONT const*, JKRHeap*);
|
||||
void countBlock();
|
||||
void loadFont(int, _GXTexMapID, JUTFont::TWidth*);
|
||||
int getFontCode(int) const;
|
||||
int convertSjis(int, u16*) const;
|
||||
|
||||
inline void delete_and_initialize() {
|
||||
deleteMemBlocks_ResFont();
|
||||
initialize_state();
|
||||
}
|
||||
|
||||
static const int suAboutEncoding_ = 3;
|
||||
static IsLeadByte_func const saoAboutEncoding_[suAboutEncoding_];
|
||||
|
||||
// some types uncertain, may need to be fixed
|
||||
/* 0x1C */ int mWidth;
|
||||
/* 0x20 */ int mHeight;
|
||||
/* 0x24 */ GXTexObj mTexObj;
|
||||
/* 0x44 */ int mTexPageIdx;
|
||||
/* 0x48 */ const ResFONT* mResFont;
|
||||
/* 0x4C */ ResFONT::INF1* mInf1Ptr;
|
||||
/* 0x50 */ void** mMemBlocks;
|
||||
/* 0x54 */ ResFONT::WID1** mpWidthBlocks;
|
||||
/* 0x58 */ ResFONT::GLY1** mpGlyphBlocks;
|
||||
/* 0x5C */ ResFONT::MAP1** mpMapBlocks;
|
||||
/* 0x60 */ u16 mWid1BlockNum;
|
||||
/* 0x62 */ u16 mGly1BlockNum;
|
||||
/* 0x64 */ u16 mMap1BlockNum;
|
||||
/* 0x66 */ u16 field_0x66;
|
||||
/* 0x68 */ u16 mMaxCode;
|
||||
/* 0x6C */ const IsLeadByte_func* mIsLeadByte;
|
||||
};
|
||||
|
||||
extern u8 const JUTResFONT_Ascfont_fix12[];
|
||||
extern u8 const JUTResFONT_Ascfont_fix16[];
|
||||
|
||||
#endif /* JUTRESFONT_H */
|
||||
@@ -0,0 +1,34 @@
|
||||
#ifndef JUTRESOURCE_H
|
||||
#define JUTRESOURCE_H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
class JKRArchive;
|
||||
class JSUInputStream;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
class JUTResReference {
|
||||
private:
|
||||
/* 0x001 */ u8 mType;
|
||||
/* 0x002 */ u8 mNameLength;
|
||||
/* 0x003 */ char mName[0x100];
|
||||
|
||||
public:
|
||||
enum ResType {
|
||||
RESTYPE_Null = 0,
|
||||
RESTYPE_Unk1 = 1,
|
||||
RESTYPE_Unk2 = 2,
|
||||
RESTYPE_Unk3 = 3,
|
||||
RESTYPE_Unk4 = 4,
|
||||
};
|
||||
JUTResReference() { mType = 0; }
|
||||
void* getResource(JSUInputStream*, u32, JKRArchive*);
|
||||
void* getResource(void const*, u32, JKRArchive*);
|
||||
void* getResource(u32, JKRArchive*);
|
||||
};
|
||||
// only rough size known due to getPointer__7J2DPaneFP20JSURandomInputStreamUlP10JKRArchive
|
||||
|
||||
#endif /* JUTRESOURCE_H */
|
||||
@@ -0,0 +1,114 @@
|
||||
#ifndef JUTTEXTURE_H
|
||||
#define JUTTEXTURE_H
|
||||
|
||||
#include <gx.h>
|
||||
#include <stdint.h>
|
||||
|
||||
class JUTPalette;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
* @brief Image data header.
|
||||
*
|
||||
* Acts as the header to image data. Usually texture data immediately follows it,
|
||||
* so any pointer arithmetic to go past the end of this structure is so that a
|
||||
* variable sized allocated buffer can be accessed.
|
||||
*
|
||||
*/
|
||||
struct ResTIMG {
|
||||
/* 0x00 */ u8 format;
|
||||
/* 0x01 */ u8 alphaEnabled;
|
||||
/* 0x02 */ u16 width;
|
||||
/* 0x04 */ u16 height;
|
||||
/* 0x06 */ u8 wrapS;
|
||||
/* 0x07 */ u8 wrapT;
|
||||
/* 0x08 */ u8 indexTexture;
|
||||
/* 0x09 */ u8 colorFormat;
|
||||
/* 0x0A */ u16 numColors;
|
||||
/* 0x0C */ uintptr_t paletteOffset;
|
||||
/* 0x10 */ u8 mipmapEnabled;
|
||||
/* 0x11 */ u8 doEdgeLOD;
|
||||
/* 0x12 */ u8 biasClamp;
|
||||
/* 0x13 */ u8 maxAnisotropy;
|
||||
/* 0x14 */ u8 minFilter;
|
||||
/* 0x15 */ u8 magFilter;
|
||||
/* 0x16 */ s8 minLOD;
|
||||
/* 0x17 */ s8 maxLOD;
|
||||
/* 0x18 */ u8 mipmapCount;
|
||||
/* 0x19 */ u8 unknown;
|
||||
/* 0x1A */ s16 LODBias;
|
||||
/* 0x1C */ uintptr_t imageOffset;
|
||||
}; // Size: 0x20
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
class JUTTexture {
|
||||
public:
|
||||
JUTTexture() {
|
||||
setCaptureFlag(false);
|
||||
mEmbPalette = NULL;
|
||||
mTexInfo = NULL;
|
||||
}
|
||||
|
||||
JUTTexture(const ResTIMG* p_timg, u8 param_1) {
|
||||
mEmbPalette = NULL;
|
||||
storeTIMG(p_timg, param_1);
|
||||
setCaptureFlag(false);
|
||||
}
|
||||
|
||||
~JUTTexture();
|
||||
void storeTIMG(ResTIMG const*, JUTPalette*, GXTlut);
|
||||
void storeTIMG(ResTIMG const*, u8);
|
||||
void storeTIMG(ResTIMG const*, JUTPalette*);
|
||||
void attachPalette(JUTPalette*);
|
||||
void init();
|
||||
void initTexObj(GXTlut);
|
||||
void initTexObj();
|
||||
void load(GXTexMapID);
|
||||
|
||||
const ResTIMG* getTexInfo() const { return mTexInfo; }
|
||||
s32 getFormat() const { return mTexInfo->format; }
|
||||
s32 getTransparency() const { return mTexInfo->alphaEnabled; }
|
||||
s32 getWidth() const { return mTexInfo->width; }
|
||||
s32 getHeight() const { return mTexInfo->height; }
|
||||
void setCaptureFlag(bool flag) { mFlags &= 2 | flag; }
|
||||
bool getCaptureFlag() const { return mFlags & 1; }
|
||||
bool getEmbPaletteDelFlag() const { return mFlags & 2; }
|
||||
void setEmbPaletteDelFlag(bool flag) { mFlags = (mFlags & 1) | (flag << 1);}
|
||||
int getTlutName() const { return mTlutName; }
|
||||
bool operator==(const JUTTexture& other) {
|
||||
return mTexInfo == other.mTexInfo
|
||||
&& field_0x2c == other.field_0x2c
|
||||
&& mWrapS == other.mWrapS
|
||||
&& mWrapT == other.mWrapT
|
||||
&& mMinFilter == other.mMinFilter
|
||||
&& mMagFilter == other.mMagFilter
|
||||
&& mMinLOD == other.mMinLOD
|
||||
&& mMinLOD == other.mMinLOD
|
||||
&& mLODBias == other.mLODBias;
|
||||
}
|
||||
bool operator!=(const JUTTexture& other) {
|
||||
return !operator==(other);
|
||||
}
|
||||
|
||||
private:
|
||||
/* 0x00 */ GXTexObj mTexObj;
|
||||
/* 0x20 */ const ResTIMG* mTexInfo;
|
||||
/* 0x24 */ void* mTexData;
|
||||
/* 0x28 */ JUTPalette* mEmbPalette;
|
||||
/* 0x2C */ JUTPalette* field_0x2c;
|
||||
/* 0x30 */ u8 mWrapS;
|
||||
/* 0x31 */ u8 mWrapT;
|
||||
/* 0x32 */ u8 mMinFilter;
|
||||
/* 0x33 */ u8 mMagFilter;
|
||||
/* 0x34 */ u16 mMinLOD;
|
||||
/* 0x36 */ u16 mMaxLOD;
|
||||
/* 0x38 */ s16 mLODBias;
|
||||
/* 0x3A */ u8 mTlutName;
|
||||
/* 0x3B */ u8 mFlags;
|
||||
/* 0x3C */ void* field_0x3c;
|
||||
};
|
||||
|
||||
#endif /* JUTTEXTURE_H */
|
||||
@@ -0,0 +1,81 @@
|
||||
#ifndef JUTVIDEO_H
|
||||
#define JUTVIDEO_H
|
||||
|
||||
#include <gx.h>
|
||||
#include <os.h>
|
||||
#include <os.h>
|
||||
|
||||
typedef u8 (*Pattern)[2];
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
class JUTVideo {
|
||||
public:
|
||||
typedef void (*Callback)(u32);
|
||||
|
||||
JUTVideo(GXRenderModeObj const*);
|
||||
virtual ~JUTVideo();
|
||||
|
||||
// TODO: return types not confirmed
|
||||
static JUTVideo* createManager(GXRenderModeObj const*);
|
||||
static void destroyManager();
|
||||
static void drawDoneStart();
|
||||
static void dummyNoDrawWait();
|
||||
void setRenderMode(GXRenderModeObj const*);
|
||||
void waitRetraceIfNeed();
|
||||
|
||||
static void preRetraceProc(u32);
|
||||
static void postRetraceProc(u32);
|
||||
static void drawDoneCallback();
|
||||
|
||||
u16 getFbWidth() const { return mRenderObj->fbWidth; }
|
||||
u16 getEfbHeight() const { return mRenderObj->efbHeight; }
|
||||
void getBounds(u16& width, u16& height) const {
|
||||
width = (u16)getFbWidth();
|
||||
height = (u16)getEfbHeight();
|
||||
}
|
||||
u16 getXfbHeight() const { return u16(mRenderObj->xfbHeight); }
|
||||
u8 isAntiAliasing() const { return u8(mRenderObj->aa); }
|
||||
Pattern getSamplePattern() const { return mRenderObj->sample_pattern; }
|
||||
u8* getVFilter() const { return mRenderObj->vfilter; }
|
||||
OSMessageQueue* getMessageQueue() { return &mMessageQueue; }
|
||||
|
||||
static JUTVideo* getManager() { return sManager; }
|
||||
static OSTick getVideoInterval() { return sVideoInterval; }
|
||||
static OSTick getVideoLastTick() { return sVideoLastTick; }
|
||||
|
||||
GXRenderModeObj* getRenderMode() const { return mRenderObj; }
|
||||
|
||||
private:
|
||||
static JUTVideo* sManager;
|
||||
static OSTick sVideoLastTick;
|
||||
static OSTick sVideoInterval;
|
||||
|
||||
private:
|
||||
/* 0x04 */ _GXRenderModeObj* mRenderObj;
|
||||
/* 0x08 */ u32 field_0x8;
|
||||
/* 0x0C */ u32 mRetraceCount;
|
||||
/* 0x10 */ u32 field_0x10;
|
||||
/* 0x14 */ u32 field_0x14;
|
||||
/* 0x18 */ u32 field_0x18;
|
||||
/* 0x1C */ VIRetraceCallback mPreRetraceCallback;
|
||||
/* 0x20 */ VIRetraceCallback mPostRetraceCallback;
|
||||
/* 0x24 */ Callback mPreCallback;
|
||||
/* 0x28 */ Callback mPostCallback;
|
||||
/* 0x2C */ bool mSetBlack;
|
||||
/* 0x30 */ s32 mSetBlackFrameCount;
|
||||
/* 0x34 */ OSMessage mMessage;
|
||||
/* 0x38 */ OSMessageQueue mMessageQueue;
|
||||
};
|
||||
|
||||
inline JUTVideo* JUTGetVideoManager() {
|
||||
return JUTVideo::getManager();
|
||||
}
|
||||
|
||||
inline void JUTDestroyVideoManager() {
|
||||
JUTVideo::destroyManager();
|
||||
}
|
||||
|
||||
#endif /* JUTVIDEO_H */
|
||||
@@ -0,0 +1,87 @@
|
||||
#ifndef JUTXFB_H
|
||||
#define JUTXFB_H
|
||||
|
||||
#include "JSystem/JUtility/JUTVideo.h"
|
||||
|
||||
typedef struct _GXRenderModeObj GXRenderModeObj;
|
||||
class JKRHeap;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
class JUTXfb {
|
||||
public:
|
||||
enum EXfbNumber { // TODO: placeholder
|
||||
UNK_0 = 0,
|
||||
UNK_1 = 1,
|
||||
UNK_2 = 2,
|
||||
UNK_3 = 3,
|
||||
};
|
||||
|
||||
void clearIndex();
|
||||
void common_init(int);
|
||||
JUTXfb(_GXRenderModeObj const*, JKRHeap*, JUTXfb::EXfbNumber);
|
||||
~JUTXfb();
|
||||
void delXfb(int);
|
||||
static JUTXfb* createManager(JKRHeap*, JUTXfb::EXfbNumber);
|
||||
static void destroyManager();
|
||||
void initiate(u16, u16, JKRHeap*, JUTXfb::EXfbNumber);
|
||||
|
||||
s32 getBufferNum() { return mBufferNum; }
|
||||
s16 getDrawnXfbIndex() const { return mDrawnXfbIndex; }
|
||||
s16 getDrawingXfbIndex() const { return mDrawingXfbIndex; }
|
||||
s16 getDisplayingXfbIndex() const { return mDisplayingXfbIndex; }
|
||||
s32 getSDrawingFlag() const { return mSDrawingFlag; }
|
||||
|
||||
void* getDrawnXfb() const {
|
||||
void* result;
|
||||
if (mDrawnXfbIndex >= 0) {
|
||||
result = mBuffer[mDrawnXfbIndex];
|
||||
} else {
|
||||
result = NULL;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void* getDrawingXfb() const {
|
||||
void* result;
|
||||
if (mDrawingXfbIndex >= 0) {
|
||||
result = mBuffer[mDrawingXfbIndex];
|
||||
} else {
|
||||
result = NULL;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void* getDisplayingXfb() const {
|
||||
void* xfb;
|
||||
if (mDisplayingXfbIndex >= 0) {
|
||||
xfb = mBuffer[mDisplayingXfbIndex];
|
||||
} else {
|
||||
xfb = NULL;
|
||||
}
|
||||
return xfb;
|
||||
}
|
||||
|
||||
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:
|
||||
/* 0x00 */ u8* mBuffer[3];
|
||||
/* 0x0C */ bool mXfbAllocated[3];
|
||||
/* 0x10 */ s32 mBufferNum;
|
||||
/* 0x14 */ s16 mDrawingXfbIndex;
|
||||
/* 0x16 */ s16 mDrawnXfbIndex;
|
||||
/* 0x18 */ s16 mDisplayingXfbIndex;
|
||||
/* 0x1C */ s32 mSDrawingFlag;
|
||||
};
|
||||
|
||||
#endif /* JUTXFB_H */
|
||||
@@ -0,0 +1,38 @@
|
||||
#ifndef TCOLOR_H
|
||||
#define TCOLOR_H
|
||||
|
||||
#include <gx.h>
|
||||
|
||||
namespace JUtility {
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jutility
|
||||
*
|
||||
*/
|
||||
struct TColor : public GXColor {
|
||||
TColor(u8 r, u8 g, u8 b, u8 a) { set(r, g, b, a); }
|
||||
TColor() { set(0xffffffff); }
|
||||
TColor(u32 u32Color) { set(u32Color); }
|
||||
TColor(GXColor color) { set(color); }
|
||||
|
||||
// TColor(const TColor& other) { set(other.toUInt32()); }
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void set(u32 u32Color) { *(u32*)&r = u32Color; }
|
||||
void set(GXColor gxColor) {
|
||||
GXColor* temp = this;
|
||||
*temp = gxColor;
|
||||
}
|
||||
};
|
||||
} // namespace JUtility
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user