d_mesg work

This commit is contained in:
LagoLunatic
2025-06-26 18:40:45 -04:00
parent 9d0608a6a4
commit 3bb95dd90c
19 changed files with 757 additions and 645 deletions
+2 -2
View File
@@ -90,7 +90,7 @@ public:
bool isVisible() { return mVisible; }
void getBounds() {}
void getGlbBounds() {}
const JGeometry::TBox2<f32>& getGlbBounds() { return mGlobalBounds; }
f32 getRotate() const { return mRotation; }
void place(const JGeometry::TBox2<f32>&) {}
void rotate(f32 angle) {
@@ -110,7 +110,7 @@ public:
/* 0x04 */ u32 mMagic;
/* 0x08 */ int mTag;
/* 0x0C */ JGeometry::TBox2<f32> mBounds;
/* 0x1C */ JGeometry::TBox2<f32> mScreenBounds;
/* 0x1C */ JGeometry::TBox2<f32> mGlobalBounds;
/* 0x2C */ JGeometry::TBox2<f32> mDrawBounds;
/* 0x3C */ Mtx mMtx;
/* 0x6C */ Mtx mDrawMtx;
+27 -2
View File
@@ -33,14 +33,39 @@ private:
int mLine;
};
#define JGADGET_ASSERTWARN(cond) ((cond) || (false))
#ifdef DEBUG
// these macros are probably wrong, needs work
#define JGADGET_ASSERTWARN(line, COND) \
if (!(COND)) { \
JGadget_outMessage out(JGadget_outMessage::warning, __FILE__, line); \
out << #COND; \
}
#define JGADGET_WARNMSG(line, msg) \
JGadget_outMessage out(JGadget_outMessage::warning, __FILE__, line); \
out << msg;
#define JGADGET_WARNMSG1(line, msg, arg) \
JGadget_outMessage out(JGadget_outMessage::warning, __FILE__, line); \
out << msg << (arg);
#define JGADGET_WARNMSG4(line, msg, arg1, arg2, arg3, arg4) \
JGadget_outMessage out(JGadget_outMessage::warning, __FILE__, line); \
out << msg << (arg1) << (arg2) << (arg3) << (arg4);
#define JGADGET_EXITWARN(cond) \
if (!(cond)) { \
false; \
return false; \
}
}
#else
#define JGADGET_ASSERTWARN(line, COND) (void)0
#define JGADGET_WARNMSG(line, msg) (void)0
#define JGADGET_WARNMSG1(line, msg, arg) (void)0
#define JGADGET_WARNMSG4(line, msg, arg1, arg2, arg3, arg4) (void)0
#endif
} // extern "C"
#endif
#endif
+97 -36
View File
@@ -1,7 +1,9 @@
#ifndef LINKLIST_H
#define LINKLIST_H
#include "dolphin/types.h"
#include "JSystem/JUtility/JUTAssert.h"
#include "JSystem/JGadget/define.h"
#include <iterator.h>
namespace JGadget {
struct TLinkListNode {
@@ -20,7 +22,9 @@ public:
struct TNodeLinkList {
struct iterator {
iterator() { node = NULL; }
explicit iterator(TLinkListNode* pNode) { node = pNode; }
iterator& operator=(const iterator& other) { node = other.node; return *this; }
iterator& operator++() { node = node->getNext(); return *this; }
iterator& operator--() { node = node->getPrev(); return *this; }
@@ -70,18 +74,22 @@ struct TNodeLinkList {
const_iterator begin() const { return const_iterator(ocObject_.getNext()); }
iterator end() { return iterator(&ocObject_); }
const_iterator end() const { return const_iterator((TLinkListNode*)(&ocObject_)); }
u32 size() { return count; }
u32 size() const { return count; }
bool empty() const { return size() == 0; }
iterator pop_front() { return erase(begin()); }
iterator erase(JGadget::TNodeLinkList::iterator, JGadget::TNodeLinkList::iterator);
iterator erase(JGadget::TNodeLinkList::iterator);
void splice(JGadget::TNodeLinkList::iterator, JGadget::TNodeLinkList&, JGadget::TNodeLinkList::iterator);
void splice(JGadget::TNodeLinkList::iterator, JGadget::TNodeLinkList&,
JGadget::TNodeLinkList::iterator);
iterator Find(const JGadget::TLinkListNode*);
iterator Insert(JGadget::TNodeLinkList::iterator, JGadget::TLinkListNode*);
iterator Erase(JGadget::TLinkListNode*);
void Remove(JGadget::TLinkListNode*);
bool Iterator_isEnd_(const_iterator it) const { return it.node == &ocObject_; }
template <typename Predicate> void Remove_if(Predicate predicate, TNodeLinkList& tList) {
template <typename Predicate>
void Remove_if(Predicate predicate, TNodeLinkList& tList) {
iterator it = begin();
while (!Iterator_isEnd_(const_iterator(it))) {
@@ -95,7 +103,8 @@ struct TNodeLinkList {
}
}
template <typename Predicate> void remove_if(Predicate predicate) {
template <typename Predicate>
void remove_if(Predicate predicate) {
TNodeLinkList list;
Remove_if(predicate, list);
}
@@ -110,18 +119,39 @@ struct TLinkList : public TNodeLinkList {
TLinkList() : TNodeLinkList() {}
struct iterator {
iterator() {}
explicit iterator(TNodeLinkList::iterator iter) : base(iter) {}
iterator& operator++() { ++base; return *this; }
iterator& operator--() { --base; return *this; }
iterator operator++(int) { const iterator old(*this); ++*this; return old; }
iterator operator--(int) { const iterator old(*this); --*this; return old; }
iterator& operator++() {
++base;
return *this;
}
iterator& operator--() {
--base;
return *this;
}
iterator operator++(int) {
const iterator old(*this);
++*this;
return old;
}
iterator operator--(int) {
const iterator old(*this);
--*this;
return old;
}
friend bool operator==(iterator a, iterator b) { return a.base == b.base; }
friend bool operator!=(iterator a, iterator b) { return !(a == b); }
T* operator->() const { return Element_toValue(base.operator->()); }
T& operator*() const { return *operator->(); }
typedef s32 difference_type;
typedef T value_type;
typedef T* pointer;
typedef T& reference;
typedef std::bidirectional_iterator_tag iterator_category;
public:
/* 0x00 */ TNodeLinkList::iterator base;
};
@@ -130,10 +160,24 @@ struct TLinkList : public TNodeLinkList {
explicit const_iterator(TNodeLinkList::const_iterator iter) : base(iter) {}
explicit const_iterator(iterator iter) : base(iter.base) {}
const_iterator& operator++() { ++base; return *this; }
const_iterator& operator--() { --base; return *this; }
const_iterator operator++(int) { const const_iterator old(*this); ++*this; return old; }
const_iterator operator--(int) { const const_iterator old(*this); --*this; return old; }
const_iterator& operator++() {
++base;
return *this;
}
const_iterator& operator--() {
--base;
return *this;
}
const_iterator operator++(int) {
const const_iterator old(*this);
++*this;
return old;
}
const_iterator operator--(int) {
const const_iterator old(*this);
--*this;
return old;
}
friend bool operator==(const_iterator a, const_iterator b) { return a.base == b.base; }
friend bool operator!=(const_iterator a, const_iterator b) { return !(a == b); }
@@ -144,24 +188,26 @@ struct TLinkList : public TNodeLinkList {
/* 0x00 */ TNodeLinkList::const_iterator base;
};
static const TLinkListNode* Element_toNode(const T* element) {
(void)element; // Debug-only assert
return reinterpret_cast<const TLinkListNode*>(reinterpret_cast<const char*>(element) - I);
static TLinkListNode* Element_toNode(T* p) {
JUT_ASSERT_DEBUG(0x2F1, p!=0);
return reinterpret_cast<TLinkListNode*>(reinterpret_cast<char*>(p) - I);
}
static TLinkListNode* Element_toNode(T* element) {
(void)element; // Debug-only assert
return reinterpret_cast<TLinkListNode*>(reinterpret_cast<char*>(element) - I);
static const TLinkListNode* Element_toNode(const T* p) {
JUT_ASSERT_DEBUG(0x2F6, p!=0);
return reinterpret_cast<const TLinkListNode*>(reinterpret_cast<const char*>(p) - I);
}
static const T* Element_toValue(const TLinkListNode* node) {
(void)node; // Debug-only assert
return reinterpret_cast<const T*>(reinterpret_cast<const char*>(node) + I);
static T* Element_toValue(TLinkListNode* p) {
JUT_ASSERT_DEBUG(0x2FB, p!=0);
return reinterpret_cast<T*>(reinterpret_cast<char*>(p) + I);
}
static T* Element_toValue(TLinkListNode* node) {
(void)node; // Debug-only assert
return reinterpret_cast<T*>(reinterpret_cast<char*>(node) + I);
static const T* Element_toValue(const TLinkListNode* p) {
JUT_ASSERT_DEBUG(0x300, p!=0);
return reinterpret_cast<const T*>(reinterpret_cast<const char*>(p) + I);
}
iterator Insert(iterator iter, T* element) { return iterator(TNodeLinkList::Insert(iter.base, Element_toNode(element))); }
iterator Insert(iterator iter, T* element) {
return iterator(TNodeLinkList::Insert(iter.base, Element_toNode(element)));
}
iterator Erase(T* element) { return iterator(TNodeLinkList::Erase(Element_toNode(element))); }
iterator begin() { return iterator(TNodeLinkList::begin()); }
@@ -170,25 +216,41 @@ struct TLinkList : public TNodeLinkList {
const_iterator end() const { return const_iterator(const_cast<TLinkList*>(this)->end()); }
T& front() { return *begin(); }
T& back() { return *--end(); }
void pop_front() { erase(TNodeLinkList::begin()); }
void Push_front(T* element) { Insert(begin(), element); }
void Push_back(T* element) { Insert(end(), element); }
iterator Find(const T* element) { return iterator(TNodeLinkList::Find(Element_toNode(element))); }
iterator Find(const T* element) {
return iterator(TNodeLinkList::Find(Element_toNode(element)));
}
void Remove(T* element) { TNodeLinkList::Remove(Element_toNode(element)); }
u32 size() { return count; }
bool empty() { return size() == 0; }
};
template <typename T, int I>
struct TLinkList_factory : public TLinkList<T, I> {
virtual ~TLinkList_factory() {}
inline virtual ~TLinkList_factory() = 0;
virtual T* Do_create() = 0;
virtual void Do_destroy(T*) = 0;
void Erase_destroy(T* elem) {
this->Erase(elem);
Do_destroy(elem);
void Clear_destroy() {
while (!this->empty()) {
T* item = &this->front();
this->pop_front();
Do_destroy(item);
}
}
typename TLinkList<T, I>::iterator Erase_destroy(T* param_0) {
typename TLinkList<T, I>::iterator spC(Erase(param_0));
Do_destroy(param_0);
return spC;
}
};
template <typename T, int I>
TLinkList_factory<T, I>::~TLinkList_factory() {
JGADGET_ASSERTWARN(934, empty());
}
template <typename T>
struct TEnumerator {
inline TEnumerator(T _current, T _end)
@@ -235,6 +297,7 @@ struct TContainerEnumerator : public TEnumerator2<typename TLinkList<T, I>::iter
: TEnumerator2<typename TLinkList<T, I>::iterator, T>(param_0->begin(), param_0->end()) {}
};
template <typename T, int I>
struct TContainerEnumerator_const : public TEnumerator2<typename TLinkList<T, I>::const_iterator, const T> {
inline TContainerEnumerator_const(const TLinkList<T, I>* param_0)
@@ -248,9 +311,7 @@ class TPRIsEqual_pointer_ {
public:
TPRIsEqual_pointer_<T>(const T* p) { this->p_ = p; }
bool operator()(const T& rSrc) const {
return &rSrc == this->p_;
}
bool operator()(const T& rSrc) const { return &rSrc == this->p_; }
private:
const T* p_;
+14 -6
View File
@@ -52,15 +52,23 @@ struct TControl {
const char* getMessageData(u16, u16) const;
void reset_();
void getMessageCode() const {}
u32 getMessageCode() const { return (getMessageGroupID() << 16) | getMessageIndex(); }
void getMessageData(u32) const {}
void getMessageEntry(u32) const {}
void getMessageEntry(u16, u16) const {}
void getMessageGroupID() const {}
void getMessageIndex() const {}
void* getMessageEntry(u32 messageCode) const {
return getMessageEntry(messageCode >> 16, messageCode & 0xFFFF);
}
void* getMessageEntry(u16 messageGroupID, u16 messageIndex) const {
TResource* resource = getResource_groupID(messageGroupID);
if (resource == NULL) {
return NULL;
}
return resource->getMessageEntry(messageIndex);
}
u16 getMessageGroupID() const { return mGroupID; }
u16 getMessageIndex() const { return mMessageIndex; }
void setMessageIndex(u16) {}
void on_isLeadByte(int) {}
void on_word(u32) {}
void setMessageIndex(u16) {}
void setResourceContainer(const JMessage::TResourceContainer*) {}
/* 0x04 */ TResourceContainer* mResourceContainer;
+8 -3
View File
@@ -11,6 +11,7 @@ extern const int ga4cSignature;
struct TParse_THeader : public JGadget::binary::TParseData_aligned<4> {
TParse_THeader(const void* data) : TParseData_aligned(data) {}
// TODO: create a struct for this content (BMG header)
char* get() const { return (char*)getRaw(); }
const void* getContent() const { return (char*)getRaw() + 0x20; }
@@ -24,6 +25,7 @@ struct TParse_TBlock : public JGadget::binary::TParseData_aligned<4> {
TParse_TBlock(const void* data) : TParseData_aligned(data) {}
};
// INF1
struct JUTMesgInfo {
public:
/* 0x00 */ JUTDataBlockHeader header;
@@ -32,19 +34,21 @@ public:
/* 0x0C */ u16 groupID;
/* 0x0E */ u8 defaultColor;
/* 0x0F */ u8 reserved;
/* 0x10 */ char messageEntryTable[];
};
struct TParse_TBlock_info : public TParse_TBlock {
TParse_TBlock_info(const void* data) : TParse_TBlock(data) {}
JUTMesgInfo* get() const { return (JUTMesgInfo*)getRaw(); }
char* getContent() const { return (char*)&get()[1]; }
char* getContent() const { return get()->messageEntryTable; }
u16 get_messageEntryNumber() const { return get()->messageEntryNumber; }
u16 get_messageEntrySize() const { return get()->messageEntrySize; }
u32 get_messageEntryNumber() const { return get()->messageEntryNumber; }
u32 get_messageEntrySize() const { return get()->messageEntrySize; }
u16 get_groupID() const { return get()->groupID; }
};
// MID1
struct JUTMesgIDData {
public:
/* 0x00 */ JUTDataBlockHeader mHeader;
@@ -52,6 +56,7 @@ public:
/* 0x0A */ u8 format;
/* 0x0B */ u8 info;
/* 0x0C */ u8 reserved[4];
/* 0x10 */ u32 messageIDTable[];
};
inline u16 getTagCode(u32 tag) { return tag & 0xFFFF; }
+21 -9
View File
@@ -25,17 +25,28 @@ namespace JMessage {
void setData_block_stringAttribute(const void* p) { mStringAttribute = (const char*)p; }
void setData_block_messageID(const void* p) { mMessageID = (data::JUTMesgIDData*)p; }
u16 getMessageEntryNumber() const { return mInfo.get_messageEntryNumber(); }
u16 getMessageEntrySize() const { return mInfo.get_messageEntrySize(); }
u32 getMessageEntryNumber() const { return mInfo.get_messageEntryNumber(); }
u32 getMessageEntrySize() const { return mInfo.get_messageEntrySize(); }
u16 getGroupID() const { return mInfo.get_groupID(); }
bool isContained_messageIndex(u16 messageIndex) const {
return messageIndex < getMessageEntryNumber();
}
void* getMessageData_messageIndex(u16 messageIndex) const {
if (messageIndex >= getMessageEntryNumber())
void* getMessageEntry(u16 messageIndex) const {
// Fakematch?
// Debug maps suggest the isMessageIndexContained inline was used for this check, but
// using it here causes various issues with matching from instruction order to regalloc
// and even completely wrong codegen on demo. Writing the check directly fixes this.
if (messageIndex >= getMessageEntryNumber()) {
return NULL;
}
return getMessageEntry_(messageIndex);
}
void* getMessageEntry_(u16 messageIndex) const {
return mInfo.getContent() + (messageIndex * getMessageEntrySize());
}
bool isMessageIndexContained(u16 messageIndex) const {
// wrong somehow?
return messageIndex < getMessageEntryNumber();
}
void getMessageData_messageEntry(const void*) const {} // TODO
public:
/* 0x00 */ JGadget::TLinkListNode mLinkNode;
@@ -47,11 +58,12 @@ namespace JMessage {
};
#ifdef __MWERKS__
class TResourceContainer : public JGadget::TLinkList_factory<TResource, -offsetof(TResource, mLinkNode)> {
class TResourceContainer : public JGadget::TLinkList_factory<TResource, -offsetof(TResource, mLinkNode)>
#else
// clangd does not support offsetof in template arguments.
class TResourceContainer : public JGadget::TLinkList_factory<TResource, -0x00> {
class TResourceContainer : public JGadget::TLinkList_factory<TResource, -0x00>
#endif
{
public:
TResourceContainer();
virtual TResource* Do_create();
+2
View File
@@ -20,8 +20,10 @@
#ifdef DEBUG
#define J3D_ASSERT(LINE, COND, MSG) JUT_ASSERT_MSG(LINE, (COND) != 0, MSG)
#define JUT_ASSERT_DEBUG(LINE, COND) (COND) ? (void)0 : (JUT_SHOW_ASSERT(LINE, COND), OSPanic(__FILE__, LINE, "Halt"));
#else
#define J3D_ASSERT(LINE, COND, MSG) (void)0
#define JUT_ASSERT_DEBUG(LINE, COND) (void)0
#endif
#define JUT_WARN(LINE, ...) \
+5
View File
@@ -659,6 +659,7 @@ public:
void setBaseAnimeID(u8 id) { mMesgAnime = id; }
void clearBaseAnimeID() { mMesgAnime = 0xFF; }
u8 getNowAnimeID() { return mMesgAnimeTagInfo; }
void setNowAnimeID(u8 id) { mMesgAnimeTagInfo = id; }
void clearNowAnimeID() { mMesgAnimeTagInfo = 0xFF; }
u8 getMesgStatus() { return mMesgStatus; }
void setMesgStatus(u8 status) { mMesgStatus = status; }
@@ -2932,6 +2933,10 @@ inline u8 dComIfGp_getMesgAnimeTagInfo() {
return g_dComIfG_gameInfo.play.getNowAnimeID();
}
inline void dComIfGp_setMesgAnimeTagInfo(u8 id) {
g_dComIfG_gameInfo.play.setNowAnimeID(id);
}
inline void dComIfGp_clearMesgAnimeTagInfo() {
g_dComIfG_gameInfo.play.clearNowAnimeID();
}
-1
View File
@@ -10,7 +10,6 @@
struct fopMsgM_pane_class;
class JKRArchive;
class JUTFont;
struct mesg_entry;
class dMenu_Option_c : public dDlst_base_c {
public:
+81 -57
View File
@@ -1,6 +1,7 @@
#ifndef D_MESG_H
#define D_MESG_H
#include "JSystem/J2DGraph/J2DScreen.h"
#include "dolphin/types.h"
#include "JSystem/JMessage/control.h"
#include "d/d_drawlist.h"
@@ -16,19 +17,19 @@ class dMesg_outFont_c;
class dMesg_screenData_c;
class sub_mesg_class : public msg_class {
public:
/* 0x0FC */ JKRExpHeap* heap;
/* 0x100 */ JKRExpHeap* field_0x100;
/* 0x104 */ dMesg_outFont_c* outfont[18];
/* 0x14C */ dMesg_screenData_c* screen;
/* 0x150 */ u8 field_0x150[0x154 - 0x150];
/* 0x154 */ char* text[4];
/* 0x164 */ u8 field_0x164;
};
public:
/* 0x0FC */ JKRExpHeap* heap;
/* 0x100 */ JKRExpHeap* field_0x100;
/* 0x104 */ dMesg_outFont_c* outfont[18];
/* 0x14C */ dMesg_screenData_c* screen;
/* 0x150 */ u8 field_0x150[0x154 - 0x150];
/* 0x154 */ char* text[4];
/* 0x164 */ u8 field_0x164;
};
class dMesg_outFont_c {
public:
void getTimer() {}
s16 getTimer() { return mTimer; }
virtual ~dMesg_outFont_c();
void _create();
@@ -38,69 +39,87 @@ public:
void _draw();
void _setAlpha(u8);
protected:
/* 0x04 */ J2DPicture* icon;
/* 0x08 */ J2DPicture* kage;
/* 0x0C */ int field_0xc;
/* 0x10 */ s16 field_0x10;
/* 0x12 */ s16 field_0x12;
/* 0x14 */ s16 field_0x14;
/* 0x16 */ s16 field_0x16;
/* 0x16 */ s16 mTimer;
/* 0x18 */ u8 mAlpha;
/* 0x19 */ u8 field_0x19;
};
class dMesg_tControl : public JMessage::TControl {
public:
void getCharCode() {}
void getCharSpace() {}
void getInitFontSize() {}
void getLineCount() {}
void getLineLength(int) {}
void getLineStart() {}
void getMainFont() {}
void getNowFontSize() {}
void getRubyFont() {}
void getTextBoxWidth() {}
void isHeader() {}
void setCharCode(int) {}
void setCode16FgOff() {}
void setHeaderOff() {}
void setHeaderOn() {}
void setLineCount(int) {}
void setLineLength(int, f32) {}
void setLineStart(int) {}
JUTFont* getMainFont() { return mMainFont; }
void setMainFont(JUTFont* font) { mMainFont = font; }
void setNowFontSize(int) {}
JUTFont* getRubyFont() { return mRubyFont; }
void setRubyFont(JUTFont* font) { mRubyFont = font; }
f32 getLineLength(int i) { return mLineLength[i]; }
void setLineLength(int i, f32 length) { mLineLength[i] = length; }
int getLineCount() { return mLineCount; }
void setLineCount(int count) { mLineCount = count; }
int getLineStart() { return mLineStart; }
void setLineStart(int start) { mLineStart = start; }
int getInitFontSize() { return mInitFontSize; }
int getNowFontSize() { return mNowFontSize; }
void setNowFontSize(int size) { mNowFontSize = size; }
int getCharSpace() { return mCharSpace; }
int getCharCode() { return mCharCode; }
void setCharCode(int code) { mCharCode = code; }
int getTextBoxWidth() { return mTextBoxWidth; }
bool isHeader() { return mbHeader; }
void setHeaderOn() { mbHeader = 1; }
void setHeaderOff() { mbHeader = 0; }
void setCode16FgOff() { mCode16Fg = 0; }
dMesg_tControl();
const char* do_word(u32);
public:
protected:
/* 0x3C */ JUTFont* mMainFont;
/* 0x40 */ JUTFont* mRubyFont;
/* 0x44 */ f32 field_0x44[4];
/* 0x54 */ int field_0x54;
/* 0x58 */ int field_0x58;
/* 0x5C */ int field_0x5c;
/* 0x60 */ int field_0x60;
/* 0x64 */ int field_0x64;
/* 0x68 */ int field_0x68;
/* 0x6C */ int field_0x6c;
/* 0x70 */ u8 field_0x70;
/* 0x71 */ u8 field_0x71;
/* 0x44 */ f32 mLineLength[4];
/* 0x54 */ int mLineCount;
/* 0x58 */ int mLineStart;
/* 0x5C */ int mInitFontSize;
/* 0x60 */ int mNowFontSize;
/* 0x64 */ int mCharSpace;
/* 0x68 */ int mCharCode;
/* 0x6C */ int mTextBoxWidth;
/* 0x70 */ u8 mbHeader;
/* 0x71 */ u8 mCode16Fg;
};
class dMesg_tSequenceProcessor : public JMessage::TSequenceProcessor {
public:
void decWaitRest() {}
void getNowColor() {}
void getStopFlag() {}
void resetWaitRest() {}
void resetWaitRest() { mWaitRest = 0; }
void setWaitRest() {} // TODO
int decWaitRest() {
if (mWaitRest > 0) {
return mWaitRest--;
} else {
return 0;
}
}
u32 getNowColor() { return mNowColor; }
void setNowColor(u32 col) { mNowColor = col; }
u8 getStopFlag() { return mStopFlag; }
void setMesg(sub_mesg_class* mesg) { mMesg = mesg; }
void setNowColor(u32) {}
void setShortCutFlag() {}
void setWaitRest() {}
void setShortCutFlag() { mShortCutFlag = 1; }
dMesg_tSequenceProcessor(JMessage::TControl*);
virtual ~dMesg_tSequenceProcessor() {}
@@ -119,6 +138,7 @@ public:
char* ruby_character(char*, int);
virtual bool do_systemTagCode(u16, const void*, u32);
protected:
/* 0x038 */ sub_mesg_class* mMesg;
/* 0x03C */ const void* field_0x3c;
/* 0x040 */ const char* field_0x40;
@@ -132,21 +152,21 @@ public:
/* 0x060 */ int field_0x60;
/* 0x064 */ int field_0x64;
/* 0x068 */ int field_0x68;
/* 0x06C */ u32 field_0x6c;
/* 0x06C */ u32 mNowColor;
/* 0x070 */ int field_0x70;
/* 0x074 */ int field_0x74;
/* 0x078 */ int field_0x78;
/* 0x07C */ int field_0x7c[4];
/* 0x08C */ int field_0x8c;
/* 0x090 */ int field_0x90;
/* 0x090 */ int mWaitRest;
/* 0x094 */ char field_0x94;
/* 0x095 */ u8 field_0x95;
/* 0x096 */ u8 field_0x96;
/* 0x097 */ char field_0x97[100];
/* 0x0FB */ char field_0xfb[100];
/* 0x15F */ u8 field_0x15f;
/* 0x15F */ u8 mStopFlag;
/* 0x160 */ u8 field_0x160;
/* 0x161 */ u8 field_0x161;
/* 0x161 */ u8 mShortCutFlag;
/* 0x162 */ u8 field_0x162;
/* 0x163 */ u8 field_0x163;
};
@@ -160,6 +180,7 @@ public:
virtual bool do_tag(u32, const void*, u32);
virtual bool do_systemTagCode(u16, const void*, u32);
protected:
/* 0x38 */ f32 field_0x38[4];
/* 0x48 */ f32 field_0x48;
/* 0x4C */ int field_0x4c;
@@ -180,10 +201,10 @@ public:
class dMesg_screenData_c : public dDlst_base_c {
public:
void deleteScreen() {}
void getTextPosX(int) {}
void getTextPosY(int) {}
void resetTimer() {}
void deleteScreen() { delete scrn; }
f32 getTextPosX(int i) { return field_0x88[i].mPosTopLeftOrig.x; }
f32 getTextPosY(int i) { return field_0x88[i].mPosTopLeftOrig.y; }
void resetTimer() { mTimer = 0; }
void setFont(JUTFont* font1, JUTFont* font2) {
field_0x10 = font1;
field_0x14 = font2;
@@ -208,6 +229,7 @@ public:
void dotAnimeInit();
void dotAnime();
protected:
/* 0x004 */ JKRExpHeap* mHeap;
/* 0x008 */ sub_mesg_class* mMesg;
/* 0x00C */ J2DScreen* scrn;
@@ -219,7 +241,7 @@ public:
/* 0x168 */ fopMsgM_pane_class field_0x168;
/* 0x1A0 */ u8 field_0x1a0[0x1A4 - 0x1A0];
/* 0x1A4 */ int field_0x1a4;
/* 0x1A8 */ s16 field_0x1a8;
/* 0x1A8 */ s16 mTimer;
/* 0x1AA */ u8 field_0x1aa[0x1AC - 0x1AA];
/* 0x1AC */ JUtility::TColor field_0x1ac;
/* 0x1B0 */ JUtility::TColor field_0x1b0;
@@ -235,6 +257,7 @@ public:
virtual void setTextPosition(u8);
virtual void draw();
protected:
/* 0x1B4*/ f32 field_0x1b4;
};
@@ -252,6 +275,7 @@ public:
void lightMove();
void cornerMove();
protected:
/* 0x1B4 */ fopMsgM_pane_class field_0x1b4;
/* 0x1EC */ fopMsgM_pane_class field_0x1ec;
/* 0x224 */ fopMsgM_pane_class field_0x224[8];
+10 -7
View File
@@ -18,19 +18,20 @@ struct mesg_header;
struct mesg_data;
struct mesg_info;
// BMG INF1 messageEntry
struct mesg_entry {
// mesg_entry() {} // fixes fopMsgM_selectMessageGet, but messes up getMesgEntry
/* 0x00 */ u32 mDataOffs;
/* 0x04 */ u16 mMesgID;
/* 0x04 */ u16 mMsgNo;
/* 0x06 */ s16 mItemPrice;
/* 0x08 */ u16 mNextMessageID;
/* 0x08 */ u16 mNextMsgNo;
/* 0x0A */ u16 field_0x0a;
/* 0x0C */ u8 mTextboxType;
/* 0x0D */ u8 mDrawType;
/* 0x0E */ u8 mTextboxPosition;
/* 0x0F */ u8 mItemImage;
/* 0x10 */ u8 field_0x10;
/* 0x10 */ u8 mTextAlignment;
/* 0x11 */ u8 mInitialSound;
/* 0x12 */ u8 mInitialCamera;
/* 0x13 */ u8 mInitialAnimation;
@@ -101,8 +102,8 @@ public:
public:
/* 0x04 */ u32 mMsgIdx;
/* 0x08 */ u16 mGroupID;
/* 0x0A */ u16 mMsgID;
/* 0x0C */ u16 mResMsgIdx;
/* 0x0A */ u16 mMsgNo;
/* 0x0C */ u16 mResMsgNo;
};
class fopMsgM_itemMsgGet_c {
@@ -116,8 +117,8 @@ public:
public:
/* 0x04 */ u32 mMsgIdx;
/* 0x08 */ u16 mMsgID;
/* 0x0A */ u16 mResMsgIdx;
/* 0x08 */ u16 mMsgNo;
/* 0x0A */ u16 mResMsgNo;
};
class MyPicture : public J2DPicture {
@@ -381,4 +382,6 @@ void fopMsgM_outFontSet(J2DPicture*, s16*, u32, u8);
void fopMsgM_outFontDraw(J2DPicture*, J2DPicture*, int, int, int, s16*, u8, u8);
void fopMsgM_outFontDraw2(J2DPicture*, J2DPicture*, int, int, int, int, s16*, u8, u8);
extern u16 zfont[][2];
#endif /* F_OP_MSG_MNG_H */
+9 -9
View File
@@ -158,17 +158,17 @@ void J2DPane::draw(f32 x, f32 y, const J2DGrafContext* pCtx, bool clip) {
pParentPane = pParent->getObject();
if (mVisible && mBounds.isValid()) {
mScreenBounds = mBounds;
mGlobalBounds = mBounds;
mDrawBounds = mBounds;
if (pParentPane != NULL) {
JGeometry::TBox2<f32> screenBounds = pParentPane->mScreenBounds;
mScreenBounds.addPos(screenBounds.i.x, screenBounds.i.y);
JGeometry::TBox2<f32> globalBounds = pParentPane->mGlobalBounds;
mGlobalBounds.addPos(globalBounds.i.x, globalBounds.i.y);
MTXConcat(pParentPane->mDrawMtx, mMtx, mDrawMtx);
if (clip) {
JGeometry::TBox2<f32> screenBounds = pParentPane->mScreenBounds;
mDrawBounds.addPos(screenBounds.i.x, screenBounds.i.y);
JGeometry::TBox2<f32> globalBounds = pParentPane->mGlobalBounds;
mDrawBounds.addPos(globalBounds.i.x, globalBounds.i.y);
mDrawBounds.intersect(pParentPane->mDrawBounds);
}
@@ -176,10 +176,10 @@ void J2DPane::draw(f32 x, f32 y, const J2DGrafContext* pCtx, bool clip) {
if (mInheritAlpha)
mDrawAlpha = (mAlpha * pParentPane->mDrawAlpha) / 0xFF;
} else {
mScreenBounds.addPos(x, y);
mGlobalBounds.addPos(x, y);
makeMatrix(mBounds.i.x + x, mBounds.i.y + y);
MTXCopy(mMtx, mDrawMtx);
mDrawBounds.set(mScreenBounds);
mDrawBounds.set(mGlobalBounds);
mDrawAlpha = mAlpha;
}
@@ -188,7 +188,7 @@ void J2DPane::draw(f32 x, f32 y, const J2DGrafContext* pCtx, bool clip) {
((J2DOrthoGraph*)pCtx)->scissorBounds(&clipBounds, &mDrawBounds);
if (mDrawBounds.isValid() || !clip) {
ctx.place(mScreenBounds);
ctx.place(mGlobalBounds);
if (clip) {
ctx.scissor(clipBounds);
ctx.setScissor();
@@ -219,7 +219,7 @@ void J2DPane::add(f32 px, f32 py) {
/* 802D0604-802D0680 .text clip__7J2DPaneFRCQ29JGeometry8TBox2<f> */
void J2DPane::clip(const JGeometry::TBox2<f32>& bounds) {
JGeometry::TBox2<f32> boxA(bounds);
JGeometry::TBox2<f32> boxB(mScreenBounds);
JGeometry::TBox2<f32> boxB(mGlobalBounds);
boxA.addPos(boxB.i);
mDrawBounds.intersect(boxA);
}
+1 -1
View File
@@ -232,7 +232,7 @@ void J2DPicture::drawSelf(f32 x, f32 y, Mtx* mtx) {
if (!mpTexture[0]) {
return;
}
drawFullSet(mScreenBounds.i.x + x, mScreenBounds.i.y + y, mBounds.getWidth(), mBounds.getHeight(), J2DBinding(mBinding), getMirror(), isTumble(), mtx);
drawFullSet(mGlobalBounds.i.x + x, mGlobalBounds.i.y + y, mBounds.getWidth(), mBounds.getHeight(), J2DBinding(mBinding), getMirror(), isTumble(), mtx);
}
/* 802D3D54-802D4074 .text drawFullSet__10J2DPictureFffff10J2DBinding9J2DMirrorbPA3_A4_f */
+4 -4
View File
@@ -205,14 +205,14 @@ void J2DWindow::drawSelf(f32 x, f32 y) {
/* 802D2190-802D2288 .text drawSelf__9J2DWindowFffPA3_A4_f */
void J2DWindow::drawSelf(f32 x, f32 y, Mtx *pMtx) {
JGeometry::TBox2<f32> screenBounds = mScreenBounds;
screenBounds.addPos(JGeometry::TVec2<f32>(x, y));
JGeometry::TBox2<f32> globalBounds = mGlobalBounds;
globalBounds.addPos(JGeometry::TVec2<f32>(x, y));
if (screenBounds.getWidth() >= mTextureWidth && screenBounds.getHeight() >= mTextureHeight) {
if (globalBounds.getWidth() >= mTextureWidth && globalBounds.getHeight() >= mTextureHeight) {
Mtx m;
MTXConcat(*pMtx, mDrawMtx, m);
GXLoadPosMtxImm(m, GX_PNMTX0);
draw_private(screenBounds, mWindowBox);
draw_private(globalBounds, mWindowBox);
}
clip(mWindowBox);
+2 -7
View File
@@ -38,9 +38,7 @@ JMessage::TResource* JMessage::TControl::getResource_groupID(u16 groupID) const
/* 8029EA34-8029EAC8 .text getMessageData__Q28JMessage8TControlCFUsUs */
const char* JMessage::TControl::getMessageData(u16 groupID, u16 messageIndex) const {
TResource* resource = getResource_groupID(groupID);
// this seems like an inline
void *messageEntry = resource == NULL ? NULL : resource->getMessageData_messageIndex(messageIndex);
void* messageEntry = getMessageEntry(groupID, messageIndex);
if (messageEntry == NULL)
return NULL;
u32 offs = *(u32*)messageEntry;
@@ -100,10 +98,7 @@ const char* JMessage::TControl::do_word(u32) {
/* 8029ECD4-8029ED88 .text setMessageCode_flush___Q28JMessage8TControlFv */
bool JMessage::TControl::setMessageCode_flush_() {
reset_();
u16 messageIndex = mMessageIndex;
TResource* resource = getResource_groupID(mGroupID);
void *messageEntry = resource == NULL ? NULL : resource->getMessageData_messageIndex(messageIndex);
mMessageEntry = messageEntry;
mMessageEntry = getMessageEntry(mGroupID, mMessageIndex);
if (mMessageEntry == NULL)
return false;
+2 -2
View File
@@ -22,10 +22,10 @@
static void dummy(u32 texNum) {
JUT_WARN(0, "%s", "This is WRONG Version File\n");
JUT_WARN(0, "%s", "This is NO JPA File\n");
JPAEmitterData* pEmtrRes;
JPAEmitterData* pEmtrRes = NULL;
JUT_ASSERT(0, pEmtrRes);
JUT_ASSERT(0, pEmtrRes->pLinkInfoArray);
JPADataBlockLinkInfo* pLinkInfo;
JPADataBlockLinkInfo* pLinkInfo = NULL;
JUT_ASSERT(0, pLinkInfo);
JUT_ASSERT(0, pLinkInfo->keyBlocks || pLinkInfo->keyNum == 0);
JUT_ASSERT(0, pLinkInfo->fldBlocks || pLinkInfo->fldNum == 0);
+1 -1
View File
@@ -2000,7 +2000,7 @@ s32 daNpcRoten_c::executeTurnInit() {
ret = 2;
setAnmTbl(l_npc_anm_walk);
field_0x9A6 = l_npc_dat[mNpcNo].field_0x50 + cM_rndF(l_npc_dat[mNpcNo].field_0x52 - l_npc_dat[mNpcNo].field_0x50);\
field_0x9A6 = l_npc_dat[mNpcNo].field_0x50 + cM_rndF(l_npc_dat[mNpcNo].field_0x52 - l_npc_dat[mNpcNo].field_0x50);
}
return ret;
+431 -466
View File
File diff suppressed because it is too large Load Diff
+40 -32
View File
@@ -41,11 +41,11 @@ struct mesg_info : JUTDataBlockHeader {
/* 0x0A */ u16 mEntrySize;
/* 0x0C */ u16 mGroupID;
/* 0x10 */ u8 mColor;
/* 0x14 */ mesg_entry mEntries[1]; // variable-length array
/* 0x14 */ mesg_entry mEntries[];
};
struct mesg_data : JUTDataBlockHeader {
char mData[1]; // variable-length array
char mData[];
};
static bool pushButton;
@@ -140,7 +140,7 @@ void MyPicture::drawSelf(f32 x, f32 y) {
/* 8002AC1C-8002AC90 .text drawSelf__9MyPictureFffPA3_A4_f */
void MyPicture::drawSelf(f32 x, f32 y, Mtx* mtx) {
if(mpTexture[0]) {
drawFullSet2(mScreenBounds.i.x + x, mScreenBounds.i.y + y, mBounds.getWidth(), mBounds.getHeight(), J2DBinding(mBinding), getMirror(), isTumble(), mtx);
drawFullSet2(mGlobalBounds.i.x + x, mGlobalBounds.i.y + y, mBounds.getWidth(), mBounds.getHeight(), J2DBinding(mBinding), getMirror(), isTumble(), mtx);
}
}
@@ -352,8 +352,8 @@ fpc_ProcID fopMsgM_messageTypeSelect(fopAc_ac_c* param_1, cXyz* param_2, u32* pa
fopMsgM_msgGet_c msgGet;
msgGet.mMsgIdx = 0;
msgGet.mGroupID = 0;
msgGet.mMsgID = 0;
msgGet.mResMsgIdx = 0;
msgGet.mMsgNo = 0;
msgGet.mResMsgNo = 0;
fpc_ProcID pcId;
if(*param_3 >> 0x10 == 0x63) {
@@ -404,8 +404,8 @@ u32 fopMsgM_searchMessageNumber(u32 msgNo) {
fopMsgM_msgGet_c msgGet;
msgGet.mMsgIdx = 0;
msgGet.mGroupID = 0;
msgGet.mMsgID = 0;
msgGet.mResMsgIdx = 0;
msgGet.mMsgNo = 0;
msgGet.mResMsgNo = 0;
for(u32 i = msgNo & 0xFFFF; i < 0xFFFF; i++) {
mesg_header* header = msgGet.getMesgHeader(i);
@@ -578,8 +578,8 @@ char* fopMsgM_messageGet(char* dst, u32 msgNo) {
/* Nonmatching */
fopMsgM_itemMsgGet_c msgGet;
msgGet.mMsgIdx = 0;
msgGet.mMsgID = 0;
msgGet.mResMsgIdx = 0;
msgGet.mMsgNo = 0;
msgGet.mResMsgNo = 0;
mesg_header* head_p = msgGet.getMesgHeader(msgNo);
JUT_ASSERT(0x6BD, head_p);
@@ -644,8 +644,8 @@ void fopMsgM_passwordGet(char* dst, u32 msgNo) {
/* Nonmatching */
fopMsgM_itemMsgGet_c msgGet;
msgGet.mMsgIdx = 0;
msgGet.mMsgID = 0;
msgGet.mResMsgIdx = 0;
msgGet.mMsgNo = 0;
msgGet.mResMsgNo = 0;
mesg_header* head_p = msgGet.getMesgHeader(msgNo);
JUT_ASSERT(0x735, head_p);
@@ -703,8 +703,8 @@ void fopMsgM_selectMessageGet(J2DPane* param_1, J2DPane* param_2, char* param_3,
fopMsgM_msgDataProc_c temp;
fopMsgM_itemMsgGet_c msgGet;
msgGet.mMsgIdx = 0;
msgGet.mMsgID = 0;
msgGet.mResMsgIdx = 0;
msgGet.mMsgNo = 0;
msgGet.mResMsgNo = 0;
strcpy(param_3, "\x1B""CC[000000FF]\x1B""GM[0]");
strcpy(param_4, "");
@@ -1390,7 +1390,7 @@ fpc_ProcID fopMsgM_Create(s16 param_1, fopMsgCreateFunc param_2, void* param_3)
/* 8002E254-8002E2D8 .text getMesgHeader__16fopMsgM_msgGet_cFUl */
mesg_header* fopMsgM_msgGet_c::getMesgHeader(u32 msg) {
mGroupID = (msg >> 16);
mMsgID = msg;
mMsgNo = msg;
#if VERSION <= VERSION_JPN
char path[12];
@@ -1440,9 +1440,9 @@ const char* fopMsgM_msgGet_c::getMessage(mesg_header* msg) {
continue;
mMsgIdx = i;
if (mMsgID == info->mEntries[i].mMesgID) {
if (mMsgNo == info->mEntries[i].mMsgNo) {
mesg_entry* entry = &info->mEntries[mMsgIdx];
mResMsgIdx = entry->mMesgID;
mResMsgNo = entry->mMsgNo;
ret = &data[entry->mDataOffs];
break;
}
@@ -1456,7 +1456,7 @@ mesg_header* fopMsgM_itemMsgGet_c::getMesgHeader(u32 msg) {
#if VERSION <= VERSION_JPN
u16 groupID = msg >> 16;
#endif
mMsgID = msg;
mMsgNo = msg;
#if VERSION <= VERSION_JPN
char path[12];
@@ -1504,9 +1504,9 @@ const char* fopMsgM_itemMsgGet_c::getMessage(mesg_header* msg) {
continue;
mMsgIdx = i;
if (mMsgID == info->mEntries[i].mMesgID) {
if (mMsgNo == info->mEntries[i].mMsgNo) {
mesg_entry* entry = &info->mEntries[i];
mResMsgIdx = entry->mMesgID;
mResMsgNo = entry->mMsgNo;
return &data[entry->mDataOffs];
}
}
@@ -1963,8 +1963,8 @@ void fopMsgM_msgDataProc_c::stringSet() {
}
if(fopMsgM_nextMsgFlagCheck()) {
if(field_0x0C->mNextMessageID != 0) {
fopMsgM_messageSet(field_0x0C->mNextMessageID);
if(field_0x0C->mNextMsgNo != 0) {
fopMsgM_messageSet(field_0x0C->mNextMsgNo);
field_0x27C = 0xF;
}
else {
@@ -2020,8 +2020,8 @@ void fopMsgM_msgDataProc_c::stringSet() {
}
if(fopMsgM_nextMsgFlagCheck()) {
if(field_0x0C->mNextMessageID != 0) {
fopMsgM_messageSet(field_0x0C->mNextMessageID);
if(field_0x0C->mNextMsgNo != 0) {
fopMsgM_messageSet(field_0x0C->mNextMsgNo);
field_0x27C = 0xF;
}
else {
@@ -2057,7 +2057,7 @@ void fopMsgM_msgDataProc_c::stringSet() {
const char* temp = &field_0x3C[origOffset];
if(*temp != 0x1A) break;
if(temp[2] == 0xFF && temp[3] == 0 && temp[4] == 0) {
if(field_0x0C->mMesgID == 0x42 || field_0x0C->mMesgID == 0x43 || field_0x0C->mMesgID == 0x44 || field_0x0C->mMesgID == 0x45 || field_0x0C->mMesgID == 0x46 || field_0x0C->mMesgID == 0x47 || field_0x0C->mMesgID == 0x48 || field_0x0C->mMesgID == 0x49 || field_0x0C->mMesgID == 0x4A || field_0x0C->mMesgID == 0x4B) {
if(field_0x0C->mMsgNo == 0x42 || field_0x0C->mMsgNo == 0x43 || field_0x0C->mMsgNo == 0x44 || field_0x0C->mMsgNo == 0x45 || field_0x0C->mMsgNo == 0x46 || field_0x0C->mMsgNo == 0x47 || field_0x0C->mMsgNo == 0x48 || field_0x0C->mMsgNo == 0x49 || field_0x0C->mMsgNo == 0x4A || field_0x0C->mMsgNo == 0x4B) {
static const u32 colorTable[9] = {
0x000000FF,
0xB40000FF,
@@ -2178,11 +2178,19 @@ void fopMsgM_msgDataProc_c::stringSet() {
else if(temp[2] == 0 && temp[3] == 0 && temp[4] == 0) {
char buf[12];
strcpy(buf, dComIfGs_getPlayerName());
#if VERSION <= VERSION_JPN
if(field_0x0C->mMesgID == 0x33B || field_0x0C->mMesgID == 0xC8B || field_0x0C->mMesgID == 0x1D21 || field_0x0C->mMesgID == 0x31D7 || field_0x0C->mMesgID == 0x37DD || field_0x0C->mMesgID == 0x37DE) {
#else
if(dComIfGs_getPalLanguage() == 1 && (field_0x0C->mMesgID == 0x33B || field_0x0C->mMesgID == 0xC8B || field_0x0C->mMesgID == 0x1D21 || field_0x0C->mMesgID == 0x31D7 || field_0x0C->mMesgID == 0x37DD || field_0x0C->mMesgID == 0x37DE)) {
if (
#if VERSION > VERSION_JPN
dComIfGs_getPalLanguage() == 1 &&
#endif
(
field_0x0C->mMsgNo == 0x33B ||
field_0x0C->mMsgNo == 0xC8B ||
field_0x0C->mMsgNo == 0x1D21 ||
field_0x0C->mMsgNo == 0x31D7 ||
field_0x0C->mMsgNo == 0x37DD ||
field_0x0C->mMsgNo == 0x37DE
)
) {
s32 bufLen = strlen(buf);
char current = (buf)[bufLen - 1];
if(current == 's' || current == 'S' || current == 'z' || current == 'Z' || current == 'x' || current == 'X') {
@@ -2377,8 +2385,8 @@ void fopMsgM_msgDataProc_c::getString(char* dst, u32 msgNo) {
fopMsgM_msgGet_c msgGet;
msgGet.mMsgIdx = 0;
msgGet.mGroupID = 0;
msgGet.mMsgID = 0;
msgGet.mResMsgIdx = 0;
msgGet.mMsgNo = 0;
msgGet.mResMsgNo = 0;
static const char* name = "no name";
s32 curOffset = 0;
@@ -2441,8 +2449,8 @@ void fopMsgM_msgDataProc_c::getString(char* dst, char*, char*, char*, u32 msgNo,
fopMsgM_msgGet_c msgGet;
msgGet.mMsgIdx = 0;
msgGet.mGroupID = 0;
msgGet.mMsgID = 0;
msgGet.mResMsgIdx = 0;
msgGet.mMsgNo = 0;
msgGet.mResMsgNo = 0;
static const char* name = "no name";
s32 curOffset = 0;