#pragma once12// Simple RIFF file format reader.3// Unrelated to the ChunkFile.h used in Dolphin and PPSSPP.45// TO REMEMBER WHEN USING:67// EITHER a chunk contains ONLY data8// OR it contains ONLY other chunks9// otherwise the scheme breaks.1011#include <cstdint>1213class RIFFReader {14public:15RIFFReader(const uint8_t *data, int dataSize);16~RIFFReader();1718bool Descend(uint32_t id);19void Ascend();2021int ReadInt();22void ReadData(void *data, int count);2324int GetCurrentChunkSize();2526private:27struct ChunkInfo {28int startLocation;29int parentStartLocation;30int parentEOF;31uint32_t ID;32int length;33};34ChunkInfo stack[32];35uint8_t *data_;36int pos_ = 0;37int eof_ = 0; // really end of current block38int depth_ = 0;39int fileSize_ = 0;40};414243