diff --git a/config/GM8E01_00/symbols.txt b/config/GM8E01_00/symbols.txt index 1965a351..d671ed07 100644 --- a/config/GM8E01_00/symbols.txt +++ b/config/GM8E01_00/symbols.txt @@ -13332,12 +13332,12 @@ FromHex__11CTextParserFw = .text:0x803043BC; // type:function size:0x5C scope:gl ParseInt__11CTextParserFPCwib = .text:0x80304418; // type:function size:0x110 scope:global Equals__11CTextParserFPCwiPCw = .text:0x80304528; // type:function size:0x54 scope:global BeginsWith__11CTextParserFPCwiPCw = .text:0x8030457C; // type:function size:0x54 scope:global -ParseTag__11CTextParserFR18CTextExecuteBufferPCwi = .text:0x803045D0; // type:function size:0x6D4 scope:global +ParseTag__11CTextParserFR18CTextExecuteBufferPCwiRQ24rstl52vector,Q24rstl17rmemory_allocator> = .text:0x803045D0; // type:function size:0x6D4 scope:global HandleUserTag__11CTextParserFR18CTextExecuteBufferPCwi = .text:0x80304CA4; // type:function size:0x8 scope:global -GetImage__11CTextParserFPCwi = .text:0x80304CAC; // type:function size:0x87C scope:global +GetImage__11CTextParserFPCwiRQ24rstl52vector,Q24rstl17rmemory_allocator> = .text:0x80304CAC; // type:function size:0x87C scope:global GetFont__11CTextParserFPCwi = .text:0x80305528; // type:function size:0xC4 scope:global GetAssetIdFromString__11CTextParserFRCQ24rstl66basic_string,Q24rstl17rmemory_allocator> = .text:0x803055EC; // type:function size:0x160 scope:global -ParseText__11CTextParserFR18CTextExecuteBufferPCwi = .text:0x8030574C; // type:function size:0x154 scope:global +ParseText__11CTextParserFR18CTextExecuteBufferPCwiRQ24rstl52vector,Q24rstl17rmemory_allocator> = .text:0x8030574C; // type:function size:0x154 scope:global __ct__11CTextParserFR12IObjectStore = .text:0x803058A0; // type:function size:0x8 scope:global reserve__Q24rstl54vector<17TToken<8CTexture>,Q24rstl17rmemory_allocator>Fi = .text:0x803058A8; // type:function size:0xF8 scope:global GetEndRank__16CWordBreakTablesFw = .text:0x803059A0; // type:function size:0x94 scope:global @@ -13998,7 +13998,7 @@ fn_80329BE4 = .text:0x80329BE4; // type:function size:0x58 fn_80329C3C = .text:0x80329C3C; // type:function size:0xC8 LoadGPSMTokens__20CParticleDataFactoryFP15CGenDescription = .text:0x80329D04; // type:function size:0x10C scope:global CreateGeneratorDescription__20CParticleDataFactoryFR12CInputStreamRQ24rstl37vectorUiP11CSimplePool = .text:0x80329E10; // type:function size:0x140 scope:global -GetGeneratorDesc__20CParticleDataFactoryFR12CInputStreamP11CSimplePool = .text:0x80329F50; // type:function size:0xBC scope:global +GetGeneratorDesc__20CParticleDataFactoryFR12CInputStreamP11CSimplePoolUi = .text:0x80329F50; // type:function size:0xBC scope:global FParticleFactory__FRC10SObjectTagR12CInputStreamRC15CVParamTransfer = .text:0x8032A00C; // type:function size:0xE0 scope:global GetIObjObjectFor__25TToken<15CGenDescription>FRCQ24rstl27auto_ptr<15CGenDescription> = .text:0x8032A0EC; // type:function size:0x2C scope:global GetNewDerivedObject__43TObjOwnerDerivedFromIObj<15CGenDescription>FRCQ24rstl27auto_ptr<15CGenDescription> = .text:0x8032A118; // type:function size:0x9C scope:global diff --git a/config/GM8E01_01/symbols.txt b/config/GM8E01_01/symbols.txt index d14b7eaf..526d5b9e 100644 --- a/config/GM8E01_01/symbols.txt +++ b/config/GM8E01_01/symbols.txt @@ -13332,10 +13332,10 @@ FromHex__11CTextParserFw = .text:0x8030449C; // type:function size:0x5C scope:gl ParseInt__11CTextParserFPCwib = .text:0x803044F8; // type:function size:0x110 scope:global Equals__11CTextParserFPCwiPCw = .text:0x80304608; // type:function size:0x54 scope:global BeginsWith__11CTextParserFPCwiPCw = .text:0x8030465C; // type:function size:0x54 scope:global -ParseTag__11CTextParserFR18CTextExecuteBufferPCwi = .text:0x803046B0; // type:function size:0x6D4 scope:global +ParseTag__11CTextParserFR18CTextExecuteBufferPCwiRQ24rstl52vector,Q24rstl17rmemory_allocator> = .text:0x803046B0; // type:function size:0x6D4 scope:global HandleUserTag__11CTextParserFR18CTextExecuteBufferPCwi = .text:0x80304D84; // type:function size:0x8 scope:global -GetImage__11CTextParserFPCwi = .text:0x80304D8C; // type:function size:0x87C scope:global -GetFont__11CTextParserFPCwi = .text:0x80305608; // type:function size:0xC4 scope:global +GetImage__11CTextParserFPCwiRQ24rstl52vector,Q24rstl17rmemory_allocator> = .text:0x80304D8C; // type:function size:0x87C scope:global +GetFont__11CTextParserFPCwiRQ24rstl52vector,Q24rstl17rmemory_allocator> = .text:0x80305608; // type:function size:0xC4 scope:global GetAssetIdFromString__11CTextParserFRCQ24rstl66basic_string,Q24rstl17rmemory_allocator> = .text:0x803056CC; // type:function size:0x160 scope:global ParseText__11CTextParserFR18CTextExecuteBufferPCwi = .text:0x8030582C; // type:function size:0x154 scope:global __ct__11CTextParserFR12IObjectStore = .text:0x80305980; // type:function size:0x8 scope:global @@ -13998,7 +13998,7 @@ fn_80329BE4 = .text:0x80329CC4; // type:function size:0x58 scope:global fn_80329C3C = .text:0x80329D1C; // type:function size:0xC8 scope:global LoadGPSMTokens__20CParticleDataFactoryFP15CGenDescription = .text:0x80329DE4; // type:function size:0x10C scope:global CreateGeneratorDescription__20CParticleDataFactoryFR12CInputStreamRQ24rstl37vectorUiP11CSimplePool = .text:0x80329EF0; // type:function size:0x140 scope:global -GetGeneratorDesc__20CParticleDataFactoryFR12CInputStreamP11CSimplePool = .text:0x8032A030; // type:function size:0xBC scope:global +GetGeneratorDesc__20CParticleDataFactoryFR12CInputStreamP11CSimplePoolUi = .text:0x8032A030; // type:function size:0xBC scope:global FParticleFactory__FRC10SObjectTagR12CInputStreamRC15CVParamTransfer = .text:0x8032A0EC; // type:function size:0xE0 scope:global GetIObjObjectFor__25TToken<15CGenDescription>FRCQ24rstl27auto_ptr<15CGenDescription> = .text:0x8032A1CC; // type:function size:0x2C scope:global GetNewDerivedObject__43TObjOwnerDerivedFromIObj<15CGenDescription>FRCQ24rstl27auto_ptr<15CGenDescription> = .text:0x8032A1F8; // type:function size:0x9C scope:global diff --git a/config/GM8E01_48/symbols.txt b/config/GM8E01_48/symbols.txt index 443d3831..3ace7e6f 100644 --- a/config/GM8E01_48/symbols.txt +++ b/config/GM8E01_48/symbols.txt @@ -13332,12 +13332,12 @@ FromHex__11CTextParserFw = .text:0x8030452C; // type:function size:0x5C ParseInt__11CTextParserFPCwib = .text:0x80304588; // type:function size:0x110 Equals__11CTextParserFPCwiPCw = .text:0x80304698; // type:function size:0x54 BeginsWith__11CTextParserFPCwiPCw = .text:0x803046EC; // type:function size:0x54 -ParseTag__11CTextParserFR18CTextExecuteBufferPCwi = .text:0x80304740; // type:function size:0x6D4 +ParseTag__11CTextParserFR18CTextExecuteBufferPCwiRQ24rstl52vector,Q24rstl17rmemory_allocator> = .text:0x80304740; // type:function size:0x6D4 HandleUserTag__11CTextParserFR18CTextExecuteBufferPCwi = .text:0x80304E14; // type:function size:0x8 -GetImage__11CTextParserFPCwi = .text:0x80304E1C; // type:function size:0x87C +GetImage__11CTextParserFPCwiRQ24rstl52vector,Q24rstl17rmemory_allocator> = .text:0x80304E1C; // type:function size:0x87C GetFont__11CTextParserFPCwi = .text:0x80305698; // type:function size:0xC4 GetAssetIdFromString__11CTextParserFRCQ24rstl66basic_string,Q24rstl17rmemory_allocator> = .text:0x8030575C; // type:function size:0x160 -ParseText__11CTextParserFR18CTextExecuteBufferPCwi = .text:0x803058BC; // type:function size:0x154 +ParseText__11CTextParserFR18CTextExecuteBufferPCwiRQ24rstl52vector,Q24rstl17rmemory_allocator> = .text:0x803058BC; // type:function size:0x154 __ct__11CTextParserFR12IObjectStore = .text:0x80305A10; // type:function size:0x8 reserve__Q24rstl54vector<17TToken<8CTexture>,Q24rstl17rmemory_allocator>Fi = .text:0x80305A18; // type:function size:0xF8 GetEndRank__16CWordBreakTablesFw = .text:0x80305B10; // type:function size:0x94 @@ -13998,7 +13998,7 @@ fn_80329D54 = .text:0x80329D54; // type:function size:0x58 fn_80329DAC = .text:0x80329DAC; // type:function size:0xC8 LoadGPSMTokens__20CParticleDataFactoryFP15CGenDescription = .text:0x80329E74; // type:function size:0x10C CreateGeneratorDescription__20CParticleDataFactoryFR12CInputStreamRQ24rstl37vectorUiP11CSimplePool = .text:0x80329F80; // type:function size:0x140 -GetGeneratorDesc__20CParticleDataFactoryFR12CInputStreamP11CSimplePool = .text:0x8032A0C0; // type:function size:0xBC +GetGeneratorDesc__20CParticleDataFactoryFR12CInputStreamP11CSimplePoolUi = .text:0x8032A0C0; // type:function size:0xBC FParticleFactory__FRC10SObjectTagR12CInputStreamRC15CVParamTransfer = .text:0x8032A17C; // type:function size:0xE0 GetIObjObjectFor__25TToken<15CGenDescription>FRCQ24rstl27auto_ptr<15CGenDescription> = .text:0x8032A25C; // type:function size:0x2C GetNewDerivedObject__43TObjOwnerDerivedFromIObj<15CGenDescription>FRCQ24rstl27auto_ptr<15CGenDescription> = .text:0x8032A288; // type:function size:0x9C diff --git a/include/Kyoto/CVParamTransfer.hpp b/include/Kyoto/CVParamTransfer.hpp index 9f3945db..81d08223 100644 --- a/include/Kyoto/CVParamTransfer.hpp +++ b/include/Kyoto/CVParamTransfer.hpp @@ -25,8 +25,6 @@ public: static CVParamTransfer Null(); const IVParamObj& operator*() const { return *x0_obj; } - -private: rstl::rc_ptr< IVParamObj > x0_obj; }; diff --git a/include/Kyoto/Particles/CParticleDataFactory.hpp b/include/Kyoto/Particles/CParticleDataFactory.hpp index 23a42f90..a3208308 100644 --- a/include/Kyoto/Particles/CParticleDataFactory.hpp +++ b/include/Kyoto/Particles/CParticleDataFactory.hpp @@ -1,12 +1,17 @@ #ifndef _CPARTICLEDATAFACTORY #define _CPARTICLEDATAFACTORY +#include "Kyoto/Particles/CGenDescription.hpp" #include "Kyoto/Particles/IElement.hpp" #include "Kyoto/SObjectTag.hpp" class CInputStream; class CParticleDataFactory { +public: + static CGenDescription* GetGeneratorDesc(CInputStream& in, CSimplePool* pool, uint offset); + static CGenDescription* CreateGeneratorDescription(CInputStream&, rstl::vector< uint >& assets, uint offset, + CSimplePool* pool); static CUVElement* GetTextureElement(CInputStream& in, CSimplePool* resPool); static CColorElement* GetColorElement(CInputStream& in); static CModVectorElement* GetModVectorElement(CInputStream& in); diff --git a/include/Kyoto/Text/CFontImageDef.hpp b/include/Kyoto/Text/CFontImageDef.hpp index 40a89c93..7ca7913a 100644 --- a/include/Kyoto/Text/CFontImageDef.hpp +++ b/include/Kyoto/Text/CFontImageDef.hpp @@ -13,6 +13,8 @@ public: CFontImageDef(const TToken< CTexture >& texture, const CVector2f& cropFactor); CFontImageDef(const rstl::vector< TToken< CTexture > >& texture, float fps, const CVector2f& cropFactor); + CFontImageDef(const CFontImageDef&); + ~CFontImageDef(); bool IsLoaded() const; // inline short GetWidth() { } diff --git a/include/Kyoto/Text/CTextExecuteBuffer.hpp b/include/Kyoto/Text/CTextExecuteBuffer.hpp index 3292a320..01fb2e76 100644 --- a/include/Kyoto/Text/CTextExecuteBuffer.hpp +++ b/include/Kyoto/Text/CTextExecuteBuffer.hpp @@ -10,6 +10,7 @@ class CInstruction; class CBlockInstruction; class CLineInstruction; +class CFontImageDef; class CTextExecuteBuffer { typedef rstl::list< rstl::ncrc_ptr< CInstruction > > InstList; @@ -24,6 +25,10 @@ public: void AddVerticalJustification(EVerticalJustification just); void AddPushState(); void AddPopState(); + void AddImage(const CFontImageDef& image); + void AddColor(EColorType type, const CTextColor& color); + void AddRemoveColorOverride(int idx); + void AddColorOverride(int idx, const CTextColor& color); private: InstList x0_instructions; diff --git a/include/Kyoto/Text/CTextParser.hpp b/include/Kyoto/Text/CTextParser.hpp index 004a63ca..166223ce 100644 --- a/include/Kyoto/Text/CTextParser.hpp +++ b/include/Kyoto/Text/CTextParser.hpp @@ -6,6 +6,7 @@ #include #include +#include "Kyoto/Text/CFontImageDef.hpp" class IObjectStore; class CRasterFont; @@ -14,17 +15,17 @@ class CTextExecuteBuffer; class CTextParser { public: CTextParser(IObjectStore& store); - void ParseText(CTextExecuteBuffer&, const wchar_t* str, int len); + void ParseText(CTextExecuteBuffer&, const wchar_t* str, int len, rstl::vector >& vec); uint GetAssetIdFromString(const rstl::string& str); TToken< CRasterFont > GetFont(const wchar_t* str, int len); - uint GetImage(const wchar_t* str, int len); + CFontImageDef GetImage(const wchar_t* str, int len, rstl::vector >& vec); uint HandleUserTag(CTextExecuteBuffer& buffer, const wchar_t* str, int len); - void ParseTag(CTextExecuteBuffer&, const wchar_t* str, int len); + void ParseTag(CTextExecuteBuffer&, const wchar_t* str, int len, rstl::vector >& vec); static bool BeginsWith(const wchar_t* str1, int len, const wchar_t* str2); static bool Equals(const wchar_t* str1, int len, const wchar_t* str2); - static uint ParseInt(const wchar_t* str, int len, bool); - static uint FromHex(wchar_t c); - static uint GetColorValue(const wchar_t* str); + static int ParseInt(const wchar_t* str, int len, bool); + static int FromHex(wchar_t c); + static int GetColorValue(const wchar_t* str); CTextColor ParseColor(const wchar_t* str, int len); private: diff --git a/include/Kyoto/Text/TextCommon.hpp b/include/Kyoto/Text/TextCommon.hpp index 8c81e47b..f40e87cf 100644 --- a/include/Kyoto/Text/TextCommon.hpp +++ b/include/Kyoto/Text/TextCommon.hpp @@ -2,7 +2,10 @@ #define _TEXTCOMMON enum EColorType { - + kCT_Main, + kCT_Outline, + kCT_Geometry, + kCT_Foreground, }; enum ETextDirection { diff --git a/src/Kyoto/Particles/CParticleDataFactory.cpp b/src/Kyoto/Particles/CParticleDataFactory.cpp index 18d8f79a..98538b0d 100644 --- a/src/Kyoto/Particles/CParticleDataFactory.cpp +++ b/src/Kyoto/Particles/CParticleDataFactory.cpp @@ -1,5 +1,9 @@ #include "Kyoto/Particles/CParticleDataFactory.hpp" +#include "Kyoto/CFactoryFnReturn.hpp" +#include "Kyoto/CSimplePool.hpp" +#include "Kyoto/CVParamTransfer.hpp" +#include "Kyoto/Particles/CGenDescription.hpp" #include "Kyoto/Particles/CIntElement.hpp" #include "Kyoto/Particles/CModVectorElement.hpp" #include "Kyoto/Particles/CRealElement.hpp" @@ -8,6 +12,26 @@ #define SBIG(v) v +CFactoryFnReturn FParticleFactory(const SObjectTag& tag, CInputStream& in, + const CVParamTransfer& xfer) { + rstl::rc_ptr< IVParamObj > obj = xfer.x0_obj; + CSimplePool* pool = static_cast< TObjOwnerParam< CSimplePool* >* >(obj.GetPtr())->GetData(); + return CParticleDataFactory::GetGeneratorDesc(in, pool, in.GetBlockOffset()); +} + +CGenDescription* CParticleDataFactory::GetGeneratorDesc(CInputStream& in, CSimplePool* pool, + uint offset) { + rstl::vector< uint > assets; + assets.reserve(8); + return CParticleDataFactory::CreateGeneratorDescription(in, assets, offset, pool); +} + +CGenDescription* CParticleDataFactory::CreateGeneratorDescription(CInputStream& in, + rstl::vector< uint >& assets, + uint, CSimplePool* pool) { + return nullptr; +} + FourCC CParticleDataFactory::GetClassID(CInputStream& in) { return in.ReadLong(); } bool CParticleDataFactory::GetBool(CInputStream& in) { diff --git a/src/Kyoto/Text/CTextParser.cpp b/src/Kyoto/Text/CTextParser.cpp index e29cb49e..43cd8020 100644 --- a/src/Kyoto/Text/CTextParser.cpp +++ b/src/Kyoto/Text/CTextParser.cpp @@ -1,13 +1,12 @@ -#include "Kyoto/SObjectTag.hpp" +#include "Kyoto/Text/CTextParser.hpp" +#include "Kyoto/Math/CVector2f.hpp" +#include "Kyoto/Text/CRasterFont.hpp" +#include "Kyoto/Text/CTextExecuteBuffer.hpp" #include "Kyoto/Text/TextCommon.hpp" -#include - -#include -#include CTextParser::CTextParser(IObjectStore& store) : mObjectStore(store) {} -void CTextParser::ParseText(CTextExecuteBuffer& buffer, const wchar_t* str, int len) {} +void CTextParser::ParseText(CTextExecuteBuffer& buffer, const wchar_t* str, int len, rstl::vector >& vec) {} uint CTextParser::GetAssetIdFromString(const rstl::string& str) {} @@ -18,27 +17,47 @@ TToken< CRasterFont > CTextParser::GetFont(const wchar_t* str, int len) { return mObjectStore.GetObj(SObjectTag('FONT', id)); } -uint CTextParser::GetImage(const wchar_t* str, int len) { return -1; } +CFontImageDef CTextParser::GetImage(const wchar_t* str, int len, rstl::vector >& vec) { + return CFontImageDef(TToken< CTexture >(), CVector2f(0.f, 0.f)); +} uint CTextParser::HandleUserTag(CTextExecuteBuffer& buffer, const wchar_t* string, int len) { return 0; } -void CTextParser::ParseTag(CTextExecuteBuffer& buffer, const wchar_t* string, int len) { +void CTextParser::ParseTag(CTextExecuteBuffer& buffer, const wchar_t* string, int len, rstl::vector >& vec) { if (BeginsWith(string, len, L"font=")) { - buffer.AddFont(GetFont(string + 5, len - 5)); + TToken< CRasterFont > font = GetFont(string + 5, len - 5); + buffer.AddFont(font); } else if (BeginsWith(string, len, L"image=")) { - + CFontImageDef texture = GetImage(string + 6, len - 6, vec); + buffer.AddImage(texture); } else if (BeginsWith(string, len, L"fg-color=")) { - + buffer.AddColor(kCT_Foreground, ParseColor(string + 9, len - 9)); } else if (BeginsWith(string, len, L"main-color=")) { - + buffer.AddColor(kCT_Main, ParseColor(string + 11, len - 11)); } else if (BeginsWith(string, len, L"geometry-color=")) { - + buffer.AddColor(kCT_Geometry, ParseColor(string + 11, len - 11)); } else if (BeginsWith(string, len, L"outline-color=")) { - + buffer.AddColor(kCT_Outline, ParseColor(string + 14, len - 14)); } else if (BeginsWith(string, len, L"color")) { - + int idx = string[6] - L'0'; + if (idx < 0 || idx > 9) { + return; + } + const wchar_t* str_remain = string + 7; + len -= 7; + if (*str_remain >= L'0' && *str_remain <= L'9') { + wchar_t tmp = *str_remain; + ++str_remain; + len--; + idx = (idx * 10) + (tmp - L'0'); + } + if (Equals(str_remain + 10, len - 10, L"no")) { + buffer.AddRemoveColorOverride(idx); + } else { + buffer.AddColorOverride(idx, ParseColor(str_remain + 10, len - 10)); + } } else if (BeginsWith(string, len, L"line-spacing=")) { const float v = (float)ParseInt(string + 13, len - 13, true); buffer.AddLineSpacing(v / 100.f); @@ -76,9 +95,9 @@ void CTextParser::ParseTag(CTextExecuteBuffer& buffer, const wchar_t* string, in } else if (Equals(string + 6, len - 6, L"nbottom")) { buffer.AddVerticalJustification(kVerticalJustification_NBottom); } - } else if (BeginsWith(string, len, L"push")) { + } else if (Equals(string, len, L"push")) { buffer.AddPushState(); - } else if (BeginsWith(string, len, L"pop")) { + } else if (Equals(string, len, L"pop")) { buffer.AddPopState(); } else { HandleUserTag(buffer, string, len); @@ -107,7 +126,7 @@ bool CTextParser::Equals(const wchar_t* str1, int len, const wchar_t* str2) { return str2[i] == L'\x0'; } -uint CTextParser::ParseInt(const wchar_t* str, int len, bool signVal) { +int CTextParser::ParseInt(const wchar_t* str, int len, bool signVal) { bool neg = false; int procCur = 0; if (signVal && len > 0 && *str == L'-') { @@ -126,7 +145,7 @@ uint CTextParser::ParseInt(const wchar_t* str, int len, bool signVal) { return neg ? -val : val; } -uint CTextParser::FromHex(wchar_t ch) { +int CTextParser::FromHex(wchar_t ch) { if (ch >= L'0' && ch <= L'9') return ch - L'0'; @@ -139,7 +158,7 @@ uint CTextParser::FromHex(wchar_t ch) { return 0; } -uint CTextParser::GetColorValue(const wchar_t* str) { +int CTextParser::GetColorValue(const wchar_t* str) { return FromHex(str[1]) + (FromHex(str[0]) << 4); }