mirror of
https://github.com/zeldaret/botw
synced 2026-05-23 06:54:18 -04:00
18c60323a9
git subrepo clone https://github.com/open-ead/sead lib/sead subrepo: subdir: "lib/sead" merged: "1b66e825d" upstream: origin: "https://github.com/open-ead/sead" branch: "master" commit: "1b66e825d" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" git subrepo clone (merge) https://github.com/open-ead/nnheaders lib/NintendoSDK subrepo: subdir: "lib/NintendoSDK" merged: "9ee21399f" upstream: origin: "https://github.com/open-ead/nnheaders" branch: "master" commit: "9ee21399f" git-subrepo: version: "0.4.3" origin: "ssh://git@github.com/ingydotnet/git-subrepo" commit: "2f68596" git subrepo clone https://github.com/open-ead/agl lib/agl subrepo: subdir: "lib/agl" merged: "7c063271b" upstream: origin: "https://github.com/open-ead/agl" branch: "master" commit: "7c063271b" git-subrepo: version: "0.4.3" origin: "ssh://git@github.com/ingydotnet/git-subrepo" commit: "2f68596" git subrepo clone https://github.com/open-ead/EventFlow lib/EventFlow subrepo: subdir: "lib/EventFlow" merged: "c35d21b34" upstream: origin: "https://github.com/open-ead/EventFlow" branch: "master" commit: "c35d21b34" git-subrepo: version: "0.4.3" origin: "ssh://git@github.com/ingydotnet/git-subrepo" commit: "2f68596"
99 lines
2.0 KiB
C++
99 lines
2.0 KiB
C++
#pragma once
|
|
|
|
#include "basis/seadTypes.h"
|
|
#include "prim/seadEndian.h"
|
|
#include "prim/seadSafeString.h"
|
|
|
|
namespace sead
|
|
{
|
|
class StreamFormat;
|
|
class StreamSrc;
|
|
|
|
class Stream
|
|
{
|
|
public:
|
|
enum class Modes
|
|
{
|
|
Binary = 0,
|
|
Text = 1,
|
|
};
|
|
|
|
Stream();
|
|
Stream(StreamSrc* src, Modes mode);
|
|
Stream(StreamSrc* src, StreamFormat* format);
|
|
virtual ~Stream() = default;
|
|
|
|
void skip(u32);
|
|
void skip(u32, u32);
|
|
void rewind();
|
|
bool isEOF();
|
|
|
|
void setBinaryEndian(Endian::Types endian);
|
|
void setMode(Modes mode);
|
|
void setUserFormat(StreamFormat* format);
|
|
|
|
protected:
|
|
StreamFormat* mFormat;
|
|
StreamSrc* mSrc;
|
|
Endian::Types mEndian;
|
|
};
|
|
|
|
class ReadStream : public Stream
|
|
{
|
|
public:
|
|
u8 readU8();
|
|
void readU8(u8&);
|
|
u16 readU16();
|
|
void readU16(u16&);
|
|
u32 readU32();
|
|
void readU32(u32&);
|
|
u64 readU64();
|
|
void readU64(u64&);
|
|
s8 readS8();
|
|
void readS8(s8&);
|
|
s16 readS16();
|
|
void readS16(s16&);
|
|
s32 readS32();
|
|
void readS32(s32&);
|
|
s64 readS64();
|
|
void readS64(s64&);
|
|
f32 readF32();
|
|
void readF32(f32&);
|
|
void readBit(void*, u32);
|
|
void readString(BufferedSafeString*, u32);
|
|
u32 readMemBlock(void*, u32);
|
|
|
|
private:
|
|
f32 readF32BitImpl_(u32, u32);
|
|
f64 readF64BitImpl_(u32, u32);
|
|
};
|
|
|
|
class WriteStream : public ReadStream
|
|
{
|
|
public:
|
|
~WriteStream() override = default;
|
|
|
|
void writeU8(u8);
|
|
void writeU16(u16);
|
|
void writeU32(u32);
|
|
void writeU64(u64);
|
|
void writeS8(s8);
|
|
void writeS16(s16);
|
|
void writeS32(s32);
|
|
void writeS64(s64);
|
|
void writeF32(f32);
|
|
void writeBit(const void*, u32);
|
|
void writeString(const SafeString&, u32);
|
|
void writeMemBlock(const void*, u32);
|
|
void writeComment(const SafeString&);
|
|
void writeLineComment(const SafeString&);
|
|
void writeDecorationText(const SafeString&);
|
|
void writeNullChar();
|
|
void flush();
|
|
|
|
private:
|
|
void writeF32BitImpl_(f32, u32, u32);
|
|
void writeF64BitImpl_(f64, u32, u32);
|
|
};
|
|
} // namespace sead
|