m_Do_printf / JUTConsole

This commit is contained in:
TakaRikka
2021-09-27 15:27:58 -07:00
parent a7ccd88167
commit a08acfa69b
52 changed files with 474 additions and 1347 deletions
+55 -1
View File
@@ -5,12 +5,34 @@
namespace JGadget {
struct TLinkListNode {
TLinkListNode() {
mNext = NULL;
mPrev = NULL;
}
TLinkListNode* mNext;
TLinkListNode* mPrev;
};
struct TNodeLinkList {
struct iterator {};
struct iterator {
iterator(TLinkListNode* pNode) { node = pNode; }
iterator(const iterator& iter) { *this = iter; }
TLinkListNode* node;
};
TNodeLinkList() : mListNode() { Initialize_(); }
void Initialize_() {
ptr = NULL;
mListNode.mNext = &mListNode;
mListNode.mPrev = &mListNode;
}
iterator end() {
iterator iter(&mListNode);
return iter;
}
/* 802DCA1C */ ~TNodeLinkList();
/* 802DCAA0 */ void erase(JGadget::TNodeLinkList::iterator, JGadget::TNodeLinkList::iterator);
@@ -20,6 +42,38 @@ struct TNodeLinkList {
/* 802DCBA8 */ void Insert(JGadget::TNodeLinkList::iterator, JGadget::TLinkListNode*);
/* 802DCBD4 */ void Erase(JGadget::TLinkListNode*);
/* 802DCBF8 */ void Remove(JGadget::TLinkListNode*);
/* 0x00 */ TNodeLinkList* ptr;
/* 0x04 */ TLinkListNode mListNode;
}; // Size: 0xC
template <typename T, int I>
struct TLinkList : public TNodeLinkList {
TLinkList() : TNodeLinkList() {}
struct iterator : TNodeLinkList::iterator {
iterator(TNodeLinkList::iterator iter) : TNodeLinkList::iterator(iter) {}
};
TLinkListNode* Element_toNode(T* element) const {
return &element->mListNode;
}
void Insert(TLinkList::iterator iter, T* element) {
TLinkListNode* node = Element_toNode(element);
TNodeLinkList::Insert(iter, node);
}
TLinkList::iterator end() {
TNodeLinkList::iterator node_iter = TNodeLinkList::end();
TLinkList::iterator iter(node_iter);
return iter;
}
void Push_back(T* element) {
TLinkList::iterator iter(TLinkList::end());
this->Insert(iter, element);
}
};
}; // namespace JGadget
+53 -6
View File
@@ -5,24 +5,27 @@
#include "JSystem/JKernel/JKRDisposer.h"
#include "JSystem/JUtility/JUTFont.h"
#include "JSystem/JUtility/TColor.h"
#include "Runtime.PPCEABI.H/__va_arg.h"
#include "dolphin/types.h"
class JUTConsole : public JKRDisposer {
public:
enum EConsoleType {};
enum EConsoleType {
UNK_TYPE2 = 2,
};
/* 802E73E4 */ void create(unsigned int, void*, u32);
/* 802E7354 */ void create(unsigned int, unsigned int, JKRHeap*);
/* 802E746C */ JUTConsole(unsigned int, unsigned int, bool);
/* 802E75CC */ void getObjectSizeFromBufferSize(unsigned int, unsigned int);
/* 802E75DC */ void getLineFromObjectSize(u32, unsigned int);
/* 802E75CC */ static size_t getObjectSizeFromBufferSize(unsigned int, unsigned int);
/* 802E75DC */ static size_t getLineFromObjectSize(u32, unsigned int);
/* 802E75EC */ void clear();
/* 802E7648 */ void doDraw(JUTConsole::EConsoleType) const;
/* 802E7BB8 */ void print_f(char const*, ...);
/* 802E7C38 */ void print(char const*);
/* 802E7F7C */ void dumpToTerminal(unsigned int);
/* 802E80A8 */ void scroll(int);
/* 802E8184 */ void getUsedLine() const;
/* 802E8184 */ int getUsedLine() const;
/* 802E81A8 */ int getLineOffset() const;
/* 802E755C */ virtual ~JUTConsole();
@@ -44,11 +47,27 @@ public:
void setVisible(bool visible) { mVisible = visible; }
private:
void setLineAttr(int param_0, u8 param_1) {
*((u8*)mBuf + (field_0x20 + 2) * param_0) = param_1;
}
u8* getLinePtr(int param_0) const {
return ((u8*)mBuf + (field_0x20 + 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 += field_0x24;
}
/* 0x18 */ JGadget::TLinkListNode mListNode;
private:
/* 0x20 */ u32 field_0x20;
/* 0x24 */ u32 field_0x24;
/* 0x28 */ u32 field_0x28;
/* 0x28 */ void* mBuf;
/* 0x2C */ bool field_0x2c;
/* 0x30 */ int field_0x30;
/* 0x34 */ int field_0x34;
@@ -70,4 +89,32 @@ private:
/* 0x6B */ bool field_0x6b;
}; // Size: 0x6C
class JUTConsoleManager {
public:
/* 802E81CC */ JUTConsoleManager();
/* 802E81F4 */ static JUTConsoleManager* createManager(JKRHeap*);
/* 802E8240 */ void appendConsole(JUTConsole*);
/* 802E82B0 */ void removeConsole(JUTConsole*);
/* 802E8384 */ void draw() const;
/* 802E8450 */ void drawDirect(bool) const;
/* 802E84C4 */ void setDirectConsole(JUTConsole*);
static JUTConsoleManager* getManager() { return sManager; }
static JUTConsoleManager* sManager;
private:
/* 0x00 */ JGadget::TLinkList<JUTConsole, 4> mLinkList;
/* 0x0C */ JUTConsole* mActiveConsole;
/* 0x10 */ JUTConsole* mDirectConsole;
}; // Size: 0x14
void JUTConsole_print_f_va_(JUTConsole*, const char*, va_list);
void JUTSetReportConsole(JUTConsole*);
JUTConsole* JUTGetReportConsole();
void JUTSetWarningConsole(JUTConsole*);
JUTConsole* JUTGetWarningConsole();
void JUTReportConsole_f_va(const char*, va_list);
void JUTReportConsole_f(const char*, ...);
#endif /* JUTCONSOLE_H */
@@ -3,4 +3,12 @@
#include "dolphin/types.h"
struct __va_list_struct;
extern "C" size_t sprintf(const char*, const char*, ...);
extern "C" size_t snprintf(const char*, size_t, const char*, ...);
extern "C" size_t vsnprintf(char*, size_t, const char*, __va_list_struct*);
extern "C" size_t vprintf(const char*, __va_list_struct*);
extern "C" size_t printf(const char*, ...);
#endif /* MSL_COMMON_SRC_PRINTF_H */
+1 -1
View File
@@ -122,7 +122,7 @@ struct OSThread {
void* data[2];
};
struct __va_list_struct {};
struct __va_list_struct;
extern "C" {
s32 OSEnableScheduler(void);
+1
View File
@@ -3,6 +3,7 @@
#include "dolphin/types.h"
void print_f(char const*, ...);
void print(char const*);
void dispHeapInfo();
void dispGameInfo();
+6
View File
@@ -49,4 +49,10 @@ struct mDoMain {
extern s8 data_80450580;
extern bool sOSReportDisabled;
extern bool data_80450B99;
extern bool data_80450B9A;
extern bool data_80450B9B;
extern bool sOSReportForceEnable;
#endif /* M_DO_M_DO_MAIN_H */
+6
View File
@@ -3,8 +3,14 @@
#include "MSL_C.PPCEABI.bare.H/MSL_Common/Src/char_io.h"
#include "MSL_C.PPCEABI.bare.H/MSL_Common/Src/printf.h"
#include "Runtime.PPCEABI.H/__va_arg.h"
#include "m_Do/m_Do_main.h"
#include "dolphin/types.h"
void my_PutString(const char*);
void mDoPrintf_vprintf_Interrupt(char const*, __va_list_struct*);
void mDoPrintf_vprintf_Thread(char const*, __va_list_struct*);
void mDoPrintf_vprintf(const char*, __va_list_struct*);
void mDoPrintf_VReport(const char*, __va_list_struct*);
#endif /* M_DO_M_DO_PRINTF_H */