mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-08 00:44:42 +00:00
Update ZAPD (#1001)
* remove fake match * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "3e9ed72e2" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "3e9ed72e2" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * new extraction script and a hack to make clear tag work * fix clear tag again * remove static from clear tag DLists * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "e7a8a48cf" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "e7a8a48cf" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "e243634e5" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "e243634e5" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "d0cd6b397" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "d0cd6b397" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * Update ovl_En_Clear_Tag.xml
This commit is contained in:
parent
ed487b4bb8
commit
750c0cab35
272 changed files with 7790 additions and 58414 deletions
148
tools/ZAPD/ZAPDUtils/Utils/BinaryReader.cpp
Normal file
148
tools/ZAPD/ZAPDUtils/Utils/BinaryReader.cpp
Normal file
|
@ -0,0 +1,148 @@
|
|||
#include "BinaryReader.h"
|
||||
#include <math.h>
|
||||
#include <stdexcept>
|
||||
#include "Stream.h"
|
||||
|
||||
BinaryReader::BinaryReader(Stream* nStream)
|
||||
{
|
||||
stream.reset(nStream);
|
||||
}
|
||||
|
||||
void BinaryReader::Close()
|
||||
{
|
||||
stream->Close();
|
||||
}
|
||||
|
||||
void BinaryReader::Seek(uint32_t offset, SeekOffsetType seekType)
|
||||
{
|
||||
stream->Seek(offset, seekType);
|
||||
}
|
||||
|
||||
uint32_t BinaryReader::GetBaseAddress()
|
||||
{
|
||||
return stream->GetBaseAddress();
|
||||
}
|
||||
|
||||
void BinaryReader::Read([[maybe_unused]] char* buffer, int32_t length)
|
||||
{
|
||||
stream->Read(length);
|
||||
}
|
||||
|
||||
char BinaryReader::ReadChar()
|
||||
{
|
||||
return (char)stream->ReadByte();
|
||||
}
|
||||
|
||||
int8_t BinaryReader::ReadByte()
|
||||
{
|
||||
return stream->ReadByte();
|
||||
}
|
||||
|
||||
uint8_t BinaryReader::ReadUByte()
|
||||
{
|
||||
return (uint8_t)stream->ReadByte();
|
||||
}
|
||||
|
||||
int16_t BinaryReader::ReadInt16()
|
||||
{
|
||||
int16_t result = 0;
|
||||
|
||||
stream->Read((char*)&result, sizeof(int16_t));
|
||||
return result;
|
||||
}
|
||||
|
||||
int32_t BinaryReader::ReadInt32()
|
||||
{
|
||||
int32_t result = 0;
|
||||
|
||||
stream->Read((char*)&result, sizeof(int32_t));
|
||||
return result;
|
||||
}
|
||||
|
||||
uint16_t BinaryReader::ReadUInt16()
|
||||
{
|
||||
uint16_t result = 0;
|
||||
|
||||
stream->Read((char*)&result, sizeof(uint16_t));
|
||||
return result;
|
||||
}
|
||||
|
||||
uint32_t BinaryReader::ReadUInt32()
|
||||
{
|
||||
uint32_t result = 0;
|
||||
|
||||
stream->Read((char*)&result, sizeof(uint32_t));
|
||||
return result;
|
||||
}
|
||||
|
||||
uint64_t BinaryReader::ReadUInt64()
|
||||
{
|
||||
uint64_t result = 0;
|
||||
|
||||
stream->Read((char*)&result, sizeof(uint64_t));
|
||||
return result;
|
||||
}
|
||||
|
||||
float BinaryReader::ReadSingle()
|
||||
{
|
||||
float result = NAN;
|
||||
|
||||
stream->Read((char*)&result, sizeof(float));
|
||||
|
||||
if (isnan(result))
|
||||
throw std::runtime_error("BinaryReader::ReadSingle(): Error reading stream");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
double BinaryReader::ReadDouble()
|
||||
{
|
||||
double result = NAN;
|
||||
|
||||
stream->Read((char*)&result, sizeof(double));
|
||||
if (isnan(result))
|
||||
throw std::runtime_error("BinaryReader::ReadDouble(): Error reading stream");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Vec3f BinaryReader::ReadVec3f()
|
||||
{
|
||||
return Vec3f();
|
||||
}
|
||||
|
||||
Vec3s BinaryReader::ReadVec3s()
|
||||
{
|
||||
return Vec3s(0, 0, 0);
|
||||
}
|
||||
|
||||
Vec3s BinaryReader::ReadVec3b()
|
||||
{
|
||||
return Vec3s(0, 0, 0);
|
||||
}
|
||||
|
||||
Vec2f BinaryReader::ReadVec2f()
|
||||
{
|
||||
return Vec2f();
|
||||
}
|
||||
|
||||
Color3b BinaryReader::ReadColor3b()
|
||||
{
|
||||
return Color3b();
|
||||
}
|
||||
|
||||
std::string BinaryReader::ReadString()
|
||||
{
|
||||
std::string res;
|
||||
char c;
|
||||
|
||||
do
|
||||
{
|
||||
c = ReadChar();
|
||||
|
||||
if (c != 0)
|
||||
res += c;
|
||||
} while (c != 0);
|
||||
|
||||
return res;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue