2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 23:07:42 +00:00

Merge branch 'master' of ssh://git.axiodl.com:6431/AxioDL/hecl

This commit is contained in:
Jack Andersen
2019-09-30 21:30:17 -10:00
37 changed files with 806 additions and 470 deletions

View File

@@ -1,5 +1,13 @@
#include "hecl/Blender/SDNARead.hpp"
#include "athena/FileReader.hpp"
#include <cstring>
#include <string>
#include "hecl/hecl.hpp"
#include <athena/FileReader.hpp>
#include <athena/MemoryReader.hpp>
#include <zlib.h>
namespace hecl::blender {
@@ -69,7 +77,7 @@ SDNARead::SDNARead(SystemStringView path) {
atUint64 length = r.length();
char magicBuf[7];
r.readUBytesToBuf(magicBuf, 7);
r.seek(0, athena::Begin);
r.seek(0, athena::SeekOrigin::Begin);
if (strncmp(magicBuf, "BLENDER", 7)) {
/* Try gzip decompression */
std::unique_ptr<uint8_t[]> compBuf(new uint8_t[4096]);
@@ -161,15 +169,15 @@ BlendType GetBlendType(SystemStringView path) {
r.enumerate(
[idPropIdx, typeOffset, nameOffset, valOffset, &ret](const FileBlock& block, athena::io::MemoryReader& r) {
if (block.type == FOURCC('DATA') && block.sdnaIdx == idPropIdx) {
r.seek(typeOffset, athena::Begin);
r.seek(typeOffset, athena::SeekOrigin::Begin);
if (r.readUByte() != 1)
return true;
r.seek(nameOffset, athena::Begin);
r.seek(nameOffset, athena::SeekOrigin::Begin);
if (r.readString() != "hecl_type")
return true;
r.seek(valOffset, athena::Begin);
r.seek(valOffset, athena::SeekOrigin::Begin);
ret = BlendType(r.readUint32Little());
return false;
}