byaml/writer: Add ByamlWriterString

This commit is contained in:
MonsterDruide1 2021-10-07 22:27:54 +02:00
parent 5929b24ea3
commit 4cdfa8a833
3 changed files with 25 additions and 5 deletions

View File

@ -65133,10 +65133,10 @@ Address,Quality,Size,Name
0x0000007100a32798,U,000016,_ZNK2al16ByamlWriterArray5writeEPN4sead11WriteStreamE
0x0000007100a327a8,U,000084,_ZNK2al16ByamlWriterArray5printEi
0x0000007100a327fc,U,000016,_ZN2al19ByamlWriterHashPairC2EPKcPNS_15ByamlWriterDataE
0x0000007100a3280c,U,000060,_ZN2al17ByamlWriterStringC1EPKcPNS_22ByamlWriterStringTableE
0x0000007100a32848,U,000008,_ZNK2al17ByamlWriterString11getTypeCodeEv
0x0000007100a32850,U,000044,_ZNK2al17ByamlWriterString5writeEPN4sead11WriteStreamE
0x0000007100a3287c,U,000004,_ZNK2al17ByamlWriterString5printEi
0x0000007100a3280c,O,000060,_ZN2al17ByamlWriterStringC1EPKcPNS_22ByamlWriterStringTableE
0x0000007100a32848,O,000008,_ZNK2al17ByamlWriterString11getTypeCodeEv
0x0000007100a32850,O,000044,_ZNK2al17ByamlWriterString5writeEPN4sead11WriteStreamE
0x0000007100a3287c,O,000004,_ZNK2al17ByamlWriterString5printEi
0x0000007100a32880,O,000024,_ZN2al14ByamlWriterIntC2Ei
0x0000007100a32898,O,000008,_ZNK2al14ByamlWriterInt11getTypeCodeEv
0x0000007100a328a0,O,000016,_ZNK2al14ByamlWriterInt5writeEPN4sead11WriteStreamE
@ -65204,7 +65204,7 @@ Address,Quality,Size,Name
0x0000007100a32b70,O,000004,_ZN2al20ByamlWriterContainer7addNullEPKc
0x0000007100a32b74,O,000008,_ZNK2al20ByamlWriterContainer6isHashEv
0x0000007100a32b7c,U,000008,_ZNK2al16ByamlWriterArray7isArrayEv
0x0000007100a32b84,U,000004,_ZN2al17ByamlWriterStringD0Ev
0x0000007100a32b84,O,000004,_ZN2al17ByamlWriterStringD0Ev
0x0000007100a32b88,O,000004,_ZN2al14ByamlWriterIntD0Ev
0x0000007100a32b8c,O,000004,_ZN2al15ByamlWriterUIntD0Ev
0x0000007100a32b90,O,000004,_ZN2al16ByamlWriterFloatD0Ev

Can't render this file because it is too large.

View File

@ -68,6 +68,18 @@ public:
void print(int) const override;
};
class ByamlWriterStringTable;
class ByamlWriterString : public ByamlWriterData {
public:
ByamlWriterString(const char*, ByamlWriterStringTable*);
u8 getTypeCode() const override;
void write(sead::WriteStream*) const override;
void print(int) const override;
private:
const char* mString;
ByamlWriterStringTable* mStringTable;
};
class ByamlWriterBigDataList;

View File

@ -2,6 +2,7 @@
#include <stream/seadStream.h>
#include "al/byaml/writer/ByamlWriterBigDataList.h"
#include "al/byaml/writer/ByamlWriterStringTable.h"
namespace al {
@ -38,6 +39,13 @@ u8 ByamlWriterNull::getTypeCode() const {return 0xFF;}
void ByamlWriterNull::print(int) const {}
void ByamlWriterNull::write(sead::WriteStream* stream) const {stream->writeU32(0);}
ByamlWriterString::ByamlWriterString(const char* string, ByamlWriterStringTable* stringTable) : mString(nullptr), mStringTable(stringTable) {
mString = mStringTable->tryAdd(string);
}
u8 ByamlWriterString::getTypeCode() const {return 0xA0;}
void ByamlWriterString::print(int) const {}
void ByamlWriterString::write(sead::WriteStream* stream) const {stream->writeU32(mStringTable->calcIndex(mString));}
ByamlWriterBigData::ByamlWriterBigData(al::ByamlWriterBigDataList* list) : mList(list) {