Archived
1
Fork 0
This repository has been archived on 2025-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
libxiv/include/exhparser.h
Joshua Goins c78a1ab245 Big refactoring commit pt. 2
Now instead of hammering your working directory, all operations happen
in-memory using two new classes, MemoryBuffer and MemorySpan. This has
already fixed numerous bugs especially around handling model files.

All operations on files inside dat's now happen on memory buffers, with
an option to write them to a file.

A lot of now useless debug messages are removed too, as that made
some operations needlessly bound by the speed of your console output.
2022-04-17 19:08:34 -04:00

67 lines
No EOL
1.3 KiB
C++

#pragma once
#include <string_view>
#include <vector>
#include "language.h"
#include "memorybuffer.h"
// taken from https://xiv.dev/game-data/file-formats/excel
struct ExhHeader {
char magic[0x4];
uint16_t version;
uint16_t dataOffset;
uint16_t columnCount;
uint16_t pageCount;
uint16_t languageCount;
uint16_t unknown1;
uint8_t u2;
uint8_t variant;
uint16_t u3;
uint32_t rowCount;
uint32_t u4[2];
};
enum ExcelColumnDataType : uint16_t {
String = 0x0,
Bool = 0x1,
Int8 = 0x2,
UInt8 = 0x3,
Int16 = 0x4,
UInt16 = 0x5,
Int32 = 0x6,
UInt32 = 0x7,
Float32 = 0x9,
Int64 = 0xA,
UInt64 = 0xB,
// 0 is read like data & 1, 1 is like data & 2, 2 = data & 4, etc...
PackedBool0 = 0x19,
PackedBool1 = 0x1A,
PackedBool2 = 0x1B,
PackedBool3 = 0x1C,
PackedBool4 = 0x1D,
PackedBool5 = 0x1E,
PackedBool6 = 0x1F,
PackedBool7 = 0x20,
};
struct ExcelColumnDefinition {
ExcelColumnDataType type;
uint16_t offset;
};
struct ExcelDataPagination {
uint32_t startId;
uint32_t rowCount;
};
struct EXH {
ExhHeader header;
std::vector<ExcelColumnDefinition> columnDefinitions;
std::vector<ExcelDataPagination> pages;
std::vector<Language> language;
};
EXH readEXH(MemorySpan data);