Files
tp/include/JSystem/JMessage/resource.h
T

155 lines
4.5 KiB
C++
Raw Normal View History

#ifndef JMESSAGE_RESOURCE_H
#define JMESSAGE_RESOURCE_H
2021-03-28 22:49:05 +02:00
#include "JSystem/JGadget/linklist.h"
2023-02-19 09:40:57 -08:00
#include "JSystem/JMessage/data.h"
#include "JSystem/JMessage/locale.h"
2021-03-28 22:49:05 +02:00
2022-03-15 02:25:25 -07:00
namespace JMessage {
2024-04-12 00:10:30 -06:00
/**
* @ingroup jsystem-jmessage
*
*/
2023-10-01 00:24:19 +03:00
struct TResource {
2023-02-19 09:40:57 -08:00
TResource()
: field_0x8(NULL), field_0xc(NULL), field_0x10(NULL), field_0x14(NULL), mMessageID(NULL) {}
2023-02-19 09:40:57 -08:00
2023-10-01 00:24:19 +03:00
/* 802A8CDC */ u16 toMessageIndex_messageID(u32, u32, bool*) const;
2023-02-19 09:40:57 -08:00
bool isContained_messageIndex(u16 messageIndex) const {
return messageIndex < getMessageEntryNumber();
}
u16 getMessageEntrySize() const { return field_0xc.get_messageEntrySize(); }
u16 getMessageEntryNumber() const { return field_0xc.get_messageEntryNumber(); }
u16 getGroupID() const { return field_0xc.get_groupID(); }
void* getMessageEntry_messageIndex(u16 messageIndex) const {
if (!isContained_messageIndex(messageIndex)) {
return NULL;
}
return field_0xc.getContent() + (messageIndex * getMessageEntrySize());
}
char* getMessageText_messageEntry(const void* pEntry) const {
return field_0x10 + *(int*)pEntry;
}
const char* getMessageText_messageIndex(u16 messageIndex) const {
void* pEntry = getMessageEntry_messageIndex(messageIndex);
if (pEntry == NULL) {
return NULL;
}
return getMessageText_messageEntry(pEntry);
}
void setData_header(const void* pData) {
field_0x8.setRaw(pData);
}
void setData_block_info(const void* pData) {
field_0xc.setRaw(pData);
}
void setData_block_messageText(const void* pData) {
field_0x10 = data::TParse_TBlock_messageText(pData).getContent();
}
void setData_block_stringAttribute(const void* pData) {
field_0x14 = data::TParse_TBlock_stringAttribute(pData).getContent();
}
void setData_block_messageID(const void* pData) {
mMessageID.setRaw(pData);
}
2023-10-01 00:24:19 +03:00
JGadget::TLinkListNode ocObject_;
2023-02-19 09:40:57 -08:00
/* 0x08 */ data::TParse_THeader field_0x8;
/* 0x0C */ data::TParse_TBlock_info field_0xc;
/* 0x10 */ char* field_0x10;
/* 0x14 */ char* field_0x14;
2024-11-29 08:24:26 -08:00
/* 0x18 */ data::TParse_TBlock_messageID mMessageID;
2022-03-15 02:25:25 -07:00
};
2024-04-12 00:10:30 -06:00
/**
* @ingroup jsystem-jmessage
*
*/
2023-02-19 09:40:57 -08:00
struct TResource_color {
TResource_color() : field_0x0(NULL), field_0x4(NULL) {}
2024-01-03 05:37:15 +02:00
void reset() {
field_0x0.setRaw(NULL);
field_0x4.setRaw(NULL);
}
2023-02-19 09:40:57 -08:00
/* 0x0 */ data::TParse_THeader field_0x0;
/* 0x4 */ data::TParse_TBlock_color field_0x4;
}; // Size: 0x8
2024-04-12 00:10:30 -06:00
/**
* @ingroup jsystem-jmessage
*
*/
2022-03-15 02:35:30 -07:00
struct TResourceContainer {
2023-02-19 09:40:57 -08:00
struct TCResource : public JGadget::TLinkList_factory<TResource, 0> {
2022-03-15 02:35:30 -07:00
/* 802A8EC0 */ TCResource();
2023-02-19 09:40:57 -08:00
/* 802A8F6C */ TResource* Get_groupID(u16);
/* 802A8EF8 */ virtual ~TCResource();
/* 802A8FFC */ virtual JMessage::TResource* Do_create();
/* 802A9048 */ virtual void Do_destroy(JMessage::TResource*);
// u8 field_0x0[0x10];
2022-03-15 02:35:30 -07:00
};
/* 802A906C */ TResourceContainer();
/* 802A90B8 */ void setEncoding(u8);
/* 802A90F0 */ void setEncoding_(u8);
2023-02-19 09:40:57 -08:00
int parseCharacter(const char** string) const { return pfnParseCharacter_(string); }
TResource* getResource_groupID(u16 groupID) { return resContainer_.Get_groupID(groupID); }
TResource* getResource_groupID(u16 groupID) const { return getResource_groupID(groupID); }
2023-10-01 00:24:19 +03:00
bool isEncodingSettable(u8 e) const { return mEncodingType == e || mEncodingType == 0; }
const TCResource* getResourceContainer() const { return &resContainer_; }
2024-01-03 05:37:15 +02:00
void destroyResource() {
resContainer_.Clear_destroy();
}
void destroyResource_color() {
resColor_.reset();
}
void destroyResource_all() {
destroyResource();
destroyResource_color();
}
2023-02-19 09:40:57 -08:00
static JMessage::locale::parseCharacter_function sapfnParseCharacter_[5];
/* 0x00 */ u8 mEncodingType;
2025-04-09 16:45:30 -04:00
/* 0x04 */ JMessage::locale::parseCharacter_function pfnParseCharacter_;
2023-02-19 09:40:57 -08:00
/* 0x08 */ TCResource resContainer_;
/* 0x18 */ TResource_color resColor_;
2022-03-15 02:35:30 -07:00
};
2024-04-12 00:10:30 -06:00
/**
* @ingroup jsystem-jmessage
*
*/
2023-02-19 09:40:57 -08:00
struct TParse : public JGadget::binary::TParse_header_block {
2022-03-15 02:35:30 -07:00
/* 802A9130 */ TParse(JMessage::TResourceContainer*);
2023-02-19 09:40:57 -08:00
/* 802A9158 */ virtual ~TParse();
/* 802A91B8 */ virtual bool parseHeader_next(void const**, u32*, u32);
/* 802A92F4 */ virtual bool parseBlock_next(void const**, u32*, u32);
/* 0x4 */ TResourceContainer* pContainer_;
/* 0x8 */ TResource* pResource_;
2022-03-15 02:35:30 -07:00
};
}; // namespace JMessage
#endif /* JMESSAGE_RESOURCE_H */