diff options
| author | notyourav <65437533+notyourav@users.noreply.github.com> | 2020-11-16 15:49:02 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-16 15:49:02 -0800 |
| commit | d4f80d7cf97641742dd56cabc0b1d503cfdf7b0d (patch) | |
| tree | 05b09142b74869f74779a00deff410019b8dcaac /src/KingSystem/Utils/Byaml/ByamlArrayIter.cpp | |
| parent | 8205744abcae5784138629038976f2449269a81f (diff) | |
| parent | b0498a15bf6f1782f1429ffbd0b03c187f61d7c9 (diff) | |
Merge branch 'master' into placement
Diffstat (limited to 'src/KingSystem/Utils/Byaml/ByamlArrayIter.cpp')
| -rw-r--r-- | src/KingSystem/Utils/Byaml/ByamlArrayIter.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/KingSystem/Utils/Byaml/ByamlArrayIter.cpp b/src/KingSystem/Utils/Byaml/ByamlArrayIter.cpp new file mode 100644 index 00000000..fe5db205 --- /dev/null +++ b/src/KingSystem/Utils/Byaml/ByamlArrayIter.cpp @@ -0,0 +1,29 @@ +#include "KingSystem/Utils/Byaml/ByamlArrayIter.h" +#include "KingSystem/Utils/Byaml/Byaml.h" +#include "KingSystem/Utils/Byaml/ByamlData.h" +#include "KingSystem/Utils/Byaml/ByamlLocal.h" + +namespace al { +ByamlArrayIter::ByamlArrayIter(const u8* data) { + mData = data; +} + +const u32* ByamlArrayIter::getDataTable() const { + return reinterpret_cast<const u32*>(&mData[TypeTableOffset + getDataOffset()]); +} + +bool ByamlArrayIter::getDataByIndex(ByamlData* data, s32 index) { + if (index < 0) { + return false; + } + + if (index >= ByamlLocalUtil::getContainerSize(mData)) { + return false; + } + + data->setType(ByamlType(mData[TypeTableOffset + index])); + data->setValue(getDataTable()[index]); + + return true; +} +} // namespace al
\ No newline at end of file |
