12 inline static Toshi::T2Map<const TCHAR*, PTRBSections::MemoryStream::Ptr<TCHAR>, Toshi::T2String8Comparator> s_aStringMap;
17 return s_aStringMap.Find( a_szString )->GetSecond();
22 a_ptrValue->m_eType = a_OrigValue.
GetType();
24 switch ( a_ptrValue->m_eType )
27 a_ptrValue->m_uValue.Bool = a_OrigValue.
GetBoolean();
30 a_ptrValue->m_uValue.Int = a_OrigValue.
GetInteger();
36 a_ptrValue->m_uValue.Float = a_OrigValue.
GetFloat();
43 auto properties = DumpProperties( *a_OrigValue.
GetProperties(), a_pStack, a_pParentProperties );
44 a_pStack->
WritePointer( &a_ptrValue->m_uValue.Properties, properties );
50 auto pArray = a_pStack->
Alloc( &a_ptrValue->m_uValue.Array );
51 auto pValues = a_pStack->
Alloc( &pArray->m_pValues, arraySize );
52 pArray->m_iSize = arraySize;
54 for (
size_t i = 0; i < arraySize; i++ )
56 DumpValue( pValues + i, *a_OrigValue.
GetArray()->
GetValue( i ), a_pStack, a_pParentProperties );
76 for (
auto it = s_aStringMap.Begin(); it != s_aStringMap.End(); it++ )
78 auto buffer = a_pStack->
AllocBytes( Toshi::TStringManager::String8Length( it->GetFirst() ) + 1 );
79 Toshi::TStringManager::String8Copy( buffer.get(), it->GetFirst() );
81 it->GetSecond() = buffer;
87 a_pStack->
WritePointer( &properties->m_pParent, *a_pParentProperties );
90 for (
size_t i = 0; i < properties->m_iCount; i++ )
92 auto& origProp = a_oProperties.
Begin()[ i ];
94 auto prop = props + i;
98 a_pStack->
WritePointer( &propName->m_szName, GetStringPtr( origProp.GetName().GetString() ) );
99 DumpValue( propValue, *origProp.GetValue(), a_pStack, &properties );
105 static void AddStringToMap(
const TCHAR* a_szString )
107 if ( s_aStringMap.Find( a_szString ) == s_aStringMap.End() )
109 s_aStringMap.Insert( a_szString, {} );
113 static void FillStringMap(
const PBProperties& a_oProperties )
115 for (
auto it = a_oProperties.
Begin(); it != a_oProperties.
End(); it++ )
117 auto propName = it->GetName().GetString();
118 auto propValue = it->GetValue();
119 auto propType = propValue->GetType();
121 AddStringToMap( propName );
126 FillStringMap( *propValue->GetProperties() );
129 AddStringToMap( propValue->GetString() );
132 for (
size_t i = 0; i < propValue->GetArray()->GetSize(); i++ )
134 auto arrayValue = propValue->GetArray()->GetValue( i );
138 AddStringToMap( arrayValue->GetString() );
155 auto stack = sect->CreateStream();
157 FillStringMap( a_oProperties );
159 symb->Add( stack,
"Main", DumpProperties( a_oProperties, stack ).get() );
160 trb.
WriteToFile( a_sFilePath.GetString(), a_bCompress );
162 s_aStringMap.Clear();