libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
Loading...
Searching...
No Matches
BinaryReader.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <memory>
5#include <vector>
6#include "endianness.h"
7#include "Stream.h"
8
9class BinaryReader;
10
11namespace Ship {
12
30class BinaryReader {
31 public:
40 BinaryReader(char* nBuffer, size_t nBufferSize);
41
46 BinaryReader(Stream* nStream);
47
52 BinaryReader(std::shared_ptr<Stream> nStream);
53
57 void Close();
58
63 void SetEndianness(Endianness endianness);
64
68 Endianness GetEndianness() const;
69
75 void Seek(int32_t offset, SeekOffsetType seekType);
76
80 uint32_t GetBaseAddress();
81
89 void Read(int32_t length);
90
96 void Read(char* buffer, int32_t length);
97
102 char ReadChar();
103
105 int8_t ReadInt8();
106
108 int16_t ReadInt16();
109
111 int32_t ReadInt32();
112
114 int64_t ReadInt64();
115
117 uint8_t ReadUByte();
118
120 uint16_t ReadUInt16();
121
123 uint32_t ReadUInt32();
124
126 uint64_t ReadUInt64();
127
129 float ReadFloat();
130
132 double ReadDouble();
133
140 std::string ReadString();
141
148 std::string ReadCString();
149
153 std::vector<char> ToVector();
154
155 protected:
156 std::shared_ptr<Stream> mStream;
157 Endianness mEndianness = Endianness::Native;
158};
159} // namespace Ship
@ Native
Platform is little-endian; Native resolves to Little.
Core namespace for the libultraship engine framework.
Definition gfx_direct3d_common.h:14
SeekOffsetType
Identifies the reference point for a seek operation.
Definition Stream.h:10