diff --git a/config/GM8E01_00/symbols.txt b/config/GM8E01_00/symbols.txt index 8a50a5d7..650a8faf 100644 --- a/config/GM8E01_00/symbols.txt +++ b/config/GM8E01_00/symbols.txt @@ -631,7 +631,7 @@ OnMessage__13CSplashScreenFRC20CArchitectureMessageR18CArchitectureQueue = .text __ct__13CSplashScreenFQ213CSplashScreen13ESplashScreen = .text:0x800291FC; // type:function size:0xE0 scope:global fn_800292DC = .text:0x800292DC; // type:function size:0x9C fn_80029378 = .text:0x80029378; // type:function size:0x94 -fn_8002940C = .text:0x8002940C; // type:function size:0x70 +ReleaseData__Q24rstl22rc_ptr<12CInstruction>Fv = .text:0x8002940C; // type:function size:0x70 PageInvoke__12CInstructionCFR16CFontRenderStateP17CTextRenderBuffer = .text:0x8002947C; // type:function size:0x4 scope:global GetAssets__12CInstructionCFRQ24rstl42vector<6CToken,Q24rstl17rmemory_allocator> = .text:0x80029480; // type:function size:0x4 scope:global GetAssetCount__12CInstructionCFv = .text:0x80029484; // type:function size:0x8 scope:global @@ -13216,7 +13216,7 @@ PopState__16CFontRenderStateFv = .text:0x802FECF4; // type:function size:0x48 sc __as__14CSaveableStateFRC14CSaveableState = .text:0x802FED3C; // type:function size:0x190 scope:global __as__Q24rstl47vector<10CTextColor,Q24rstl17rmemory_allocator>FRCQ24rstl47vector<10CTextColor,Q24rstl17rmemory_allocator> = .text:0x802FEECC; // type:function size:0x10C PushState__16CFontRenderStateFv = .text:0x802FEFD8; // type:function size:0x28 scope:global -push_front__Q24rstl49list<14CSaveableState,Q24rstl17rmemory_allocator>FRC14CSaveableState = .text:0x802FF000; // type:function size:0x28 +push__Q24rstl82stack<14CSaveableState,Q24rstl49list<14CSaveableState,Q24rstl17rmemory_allocator>>FRC14CSaveableState = .text:0x802FF000; // type:function size:0x28 do_insert_before__Q24rstl49list<14CSaveableState,Q24rstl17rmemory_allocator>FPQ34rstl49list<14CSaveableState,Q24rstl17rmemory_allocator>4nodeRC14CSaveableState = .text:0x802FF028; // type:function size:0x70 create_node__Q24rstl49list<14CSaveableState,Q24rstl17rmemory_allocator>FPQ34rstl49list<14CSaveableState,Q24rstl17rmemory_allocator>4nodePQ34rstl49list<14CSaveableState,Q24rstl17rmemory_allocator>4nodeRC14CSaveableState = .text:0x802FF098; // type:function size:0x84 __ct__14CSaveableStateFRC14CSaveableState = .text:0x802FF11C; // type:function size:0x208 @@ -13295,7 +13295,7 @@ GetAssets__18CTextExecuteBufferFv = .text:0x803022B4; // type:function size:0x1B AddString__18CTextExecuteBufferFPCwi = .text:0x80302470; // type:function size:0x170 scope:global AddStringFragment__18CTextExecuteBufferFPCwi = .text:0x803025E0; // type:function size:0x80 scope:global WrapOneLTR__18CTextExecuteBufferFPCwi = .text:0x80302660; // type:function size:0x2C8 scope:global -fn_80302928 = .text:0x80302928; // type:function size:0xC4 +push_front__Q24rstl66list,Q24rstl17rmemory_allocator>FRCQ24rstl24ncrc_ptr<12CInstruction> = .text:0x80302928; // type:function size:0xC4 MoveWordLTR__18CTextExecuteBufferFv = .text:0x803029EC; // type:function size:0x1E0 scope:global fn_80302BCC = .text:0x80302BCC; // type:function size:0xAC StartNewLine__18CTextExecuteBufferFv = .text:0x80302C78; // type:function size:0x144 scope:global @@ -13321,7 +13321,7 @@ __ct__18CTextExecuteBufferFv = .text:0x80303D78; // type:function size:0x8C scop fn_80303E04 = .text:0x80303E04; // type:function size:0x44 fn_80303E48 = .text:0x80303E48; // type:function size:0x2C fn_80303E74 = .text:0x80303E74; // type:function size:0x154 -fn_80303FC8 = .text:0x80303FC8; // type:function size:0x9C +do_erase__Q24rstl66list,Q24rstl17rmemory_allocator>FPQ34rstl66list,Q24rstl17rmemory_allocator>4node = .text:0x80303FC8; // type:function size:0x9C __dt__16CTextInstructionFv = .text:0x80304064; // type:function size:0x5C scope:weak __ct__16CTextInstructionFPCwi = .text:0x803040C0; // type:function size:0xD4 scope:global Invoke__16CTextInstructionCFR16CFontRenderStateP17CTextRenderBuffer = .text:0x80304194; // type:function size:0x100 scope:global diff --git a/config/GM8E01_01/symbols.txt b/config/GM8E01_01/symbols.txt index 7c2b1cdc..e1ce2f1a 100644 --- a/config/GM8E01_01/symbols.txt +++ b/config/GM8E01_01/symbols.txt @@ -631,7 +631,7 @@ OnMessage__13CSplashScreenFRC20CArchitectureMessageR18CArchitectureQueue = .text __ct__13CSplashScreenFQ213CSplashScreen13ESplashScreen = .text:0x80029278; // type:function size:0xE0 scope:global fn_800292DC = .text:0x80029358; // type:function size:0x9C scope:global fn_80029378 = .text:0x800293F4; // type:function size:0x94 scope:global -fn_8002940C = .text:0x80029488; // type:function size:0x70 scope:global +ReleaseData__Q24rstl22rc_ptr<12CInstruction>Fv = .text:0x80029488; // type:function size:0x70 scope:global PageInvoke__12CInstructionCFR16CFontRenderStateP17CTextRenderBuffer = .text:0x800294F8; // type:function size:0x4 scope:global GetAssets__12CInstructionCFRQ24rstl42vector<6CToken,Q24rstl17rmemory_allocator> = .text:0x800294FC; // type:function size:0x4 scope:global GetAssetCount__12CInstructionCFv = .text:0x80029500; // type:function size:0x8 scope:global @@ -13295,7 +13295,7 @@ GetAssets__18CTextExecuteBufferFv = .text:0x80302394; // type:function size:0x1B AddString__18CTextExecuteBufferFPCwi = .text:0x80302550; // type:function size:0x170 scope:global AddStringFragment__18CTextExecuteBufferFPCwi = .text:0x803026C0; // type:function size:0x80 scope:global WrapOneLTR__18CTextExecuteBufferFPCwi = .text:0x80302740; // type:function size:0x2C8 scope:global -fn_80302928 = .text:0x80302A08; // type:function size:0xC4 scope:global +push_front__Q24rstl66list,Q24rstl17rmemory_allocator>FRCQ24rstl24ncrc_ptr<12CInstruction> = .text:0x80302A08; // type:function size:0xC4 scope:global MoveWordLTR__18CTextExecuteBufferFv = .text:0x80302ACC; // type:function size:0x1E0 scope:global fn_80302BCC = .text:0x80302CAC; // type:function size:0xAC scope:global StartNewLine__18CTextExecuteBufferFv = .text:0x80302D58; // type:function size:0x144 scope:global @@ -13321,7 +13321,7 @@ __ct__18CTextExecuteBufferFv = .text:0x80303E58; // type:function size:0x8C scop fn_80303E04 = .text:0x80303EE4; // type:function size:0x44 scope:global fn_80303E48 = .text:0x80303F28; // type:function size:0x2C scope:global fn_80303E74 = .text:0x80303F54; // type:function size:0x154 scope:global -fn_80303FC8 = .text:0x803040A8; // type:function size:0x9C scope:global +do_erase__Q24rstl66list,Q24rstl17rmemory_allocator>FPQ34rstl66list,Q24rstl17rmemory_allocator>4node = .text:0x803040A8; // type:function size:0x9C scope:global __dt__16CTextInstructionFv = .text:0x80304144; // type:function size:0x5C scope:weak __ct__16CTextInstructionFPCwi = .text:0x803041A0; // type:function size:0xD4 scope:global Invoke__16CTextInstructionCFR16CFontRenderStateP17CTextRenderBuffer = .text:0x80304274; // type:function size:0x100 scope:global diff --git a/include/Kyoto/Text/CLineInstruction.hpp b/include/Kyoto/Text/CLineInstruction.hpp index 20ccede6..6f3bfeb0 100644 --- a/include/Kyoto/Text/CLineInstruction.hpp +++ b/include/Kyoto/Text/CLineInstruction.hpp @@ -22,6 +22,13 @@ class CLineInstruction : public CInstruction { int GetX() const { return mCurX; } int GetY() const { return mCurY; } + EJustification GetJustification() const { return mJustification; } + void SetJustification(const EJustification justification) { mJustification = justification; } + EVerticalJustification GetVerticalJustification() const { return mVerticalJustification; } + void SetVerticalJustification(const EVerticalJustification justification) { + mVerticalJustification = justification; + } + private: int mWordCount; int mCurX; diff --git a/include/Kyoto/Text/CSaveableState.hpp b/include/Kyoto/Text/CSaveableState.hpp index 41aabf9f..5d778db3 100644 --- a/include/Kyoto/Text/CSaveableState.hpp +++ b/include/Kyoto/Text/CSaveableState.hpp @@ -23,6 +23,9 @@ class CSaveableState { int GetLineExtraSpacing() const { return x78_extraLineSpacing; } void SetLineExtraSpace(int spacing) { x78_extraLineSpacing = spacing; } + EJustification GetJustification() const { return x80_just; } + EVerticalJustification GetVerticalJustification() const { return x84_vjust; } + // private: CDrawStringOptions x0_drawStringOptions; rstl::optional_object< TToken< CRasterFont > > x48_font; diff --git a/include/Kyoto/Text/CTextExecuteBuffer.hpp b/include/Kyoto/Text/CTextExecuteBuffer.hpp index add2586c..dd890ede 100644 --- a/include/Kyoto/Text/CTextExecuteBuffer.hpp +++ b/include/Kyoto/Text/CTextExecuteBuffer.hpp @@ -12,6 +12,23 @@ class CBlockInstruction; class CLineInstruction; class CFontImageDef; +namespace rstl { +template < typename T, typename _Container = list< T > > +class stack { +public: + typename _Container::iterator top() { return container.begin(); } + typename _Container::const_iterator top() const { return container.begin(); } + + void pop() { return container.pop_front(); } + + void push(const T& item) { container.push_front(item); } + + void clear() { container.clear(); } + +private: + _Container container; +}; +} // namespace rstl class CTextExecuteBuffer { typedef rstl::list< rstl::ncrc_ptr< CInstruction > > InstList; @@ -31,6 +48,8 @@ class CTextExecuteBuffer { void AddColorOverride(int idx, const CTextColor& color); void AddString(const wchar_t* str, const int len); + void Clear(); + private: InstList x0_instructions; CSaveableState x18_; @@ -42,8 +61,8 @@ class CTextExecuteBuffer { int xb4_curWordX; int xb8_curWordY; int xbc_spaceDistance; - bool xc0_imageBaseline; - rstl::list< CSaveableState > xc4_stateStack; + char xc0_imageBaseline; + rstl::stack< CSaveableState > xc4_stateStack; }; #endif // _CTEXTEXECUTEBUFFER diff --git a/include/rstl/list.hpp b/include/rstl/list.hpp index 624f631a..3c8ca4dc 100644 --- a/include/rstl/list.hpp +++ b/include/rstl/list.hpp @@ -74,7 +74,7 @@ class list { node* n; x0_allocator.allocate(n, 1); new (n) node(prev, next); - new(n->get_value()) T(val); + new (n->get_value()) T(val); return n; } diff --git a/src/Kyoto/Text/CTextExecuteBuffer.cpp b/src/Kyoto/Text/CTextExecuteBuffer.cpp new file mode 100644 index 00000000..838c944d --- /dev/null +++ b/src/Kyoto/Text/CTextExecuteBuffer.cpp @@ -0,0 +1,45 @@ +#include "Kyoto/Text/CTextExecuteBuffer.hpp" + +#include "Kyoto/Text/CLineInstruction.hpp" +#include "Kyoto/Text/CPopStateInstruction.hpp" +#include "Kyoto/Text/CPushStateInstruction.hpp" + +CTextExecuteBuffer::CTextExecuteBuffer() +: xa0_curBlock(nullptr) +, xa4_curLine(nullptr) +, xa8_curWordIt(x0_instructions.end()) +// , xac_curY(0) +// , xb0_curX(0) +, xb4_curWordX(0) +, xb8_curWordY(0) +, xbc_spaceDistance(0) +, xc0_imageBaseline(0) {} + +void CTextExecuteBuffer::Clear() { + x0_instructions.clear(); + x18_ = CSaveableState(); + xa0_curBlock = nullptr; + xa4_curLine = nullptr; + xa8_curWordIt = x0_instructions.end(); + xb4_curWordX = 0; + xb8_curWordY = 0; + xbc_spaceDistance = 0; +} + +void CTextExecuteBuffer::AddPushState() { + const rstl::ncrc_ptr< CInstruction > newInst = rs_new CPushStateInstruction(); + x0_instructions.push_front(newInst); + xc4_stateStack.push(x18_); +} + +void CTextExecuteBuffer::AddPopState() { + const rstl::ncrc_ptr< CInstruction > newInst = rs_new CPopStateInstruction(); + x0_instructions.push_front(newInst); + x18_ = *xc4_stateStack.top(); + xc4_stateStack.pop(); + + if (xa4_curLine->GetX() == 0) { + xa4_curLine->SetJustification(x18_.GetJustification()); + xa4_curLine->SetVerticalJustification(x18_.GetVerticalJustification()); + } +} \ No newline at end of file