mirror of
https://github.com/zeldaret/mm.git
synced 2026-05-31 09:21:28 -04:00
01a6dea813
* git subrepo pull tools/ZAPD --force subrepo: subdir: "tools/ZAPD" merged: "e02e151c" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "e02e151c" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/decomp-permuter --force subrepo: subdir: "tools/decomp-permuter" merged: "86b1975e" upstream: origin: "https://github.com/simonlindholm/decomp-permuter.git" branch: "main" commit: "86b1975e" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/graphovl --force subrepo: subdir: "tools/graphovl" merged: "eb25be94" upstream: origin: "https://github.com/AngheloAlf/graphovl.git" branch: "master" commit: "eb25be94" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull (merge) tools/z64compress --force subrepo: subdir: "tools/z64compress" merged: "98ef0ac2" upstream: origin: "https://github.com/z64me/z64compress.git" branch: "main" commit: "98ef0ac2" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/ZAPD --force subrepo: subdir: "tools/ZAPD" merged: "45cb0d6b" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "45cb0d6b" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/asm-differ --force subrepo: subdir: "tools/asm-differ" merged: "48e675ff" upstream: origin: "https://github.com/simonlindholm/asm-differ.git" branch: "main" commit: "48e675ff" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/ZAPD --force subrepo: subdir: "tools/ZAPD" merged: "3c00dcb3" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "3c00dcb3" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/asm-differ --force subrepo: subdir: "tools/asm-differ" merged: "47c94c99" upstream: origin: "https://github.com/simonlindholm/asm-differ.git" branch: "main" commit: "47c94c99" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * Declare required textures * Name texture, add decomp.me permuter settings * git subrepo pull tools/ZAPD --force subrepo: subdir: "tools/ZAPD" merged: "913810fc" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "913810fc" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/asm-differ --force subrepo: subdir: "tools/asm-differ" merged: "97197f2a" upstream: origin: "https://github.com/simonlindholm/asm-differ.git" branch: "main" commit: "97197f2a" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/ZAPD --force subrepo: subdir: "tools/ZAPD" merged: "623d779f" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "623d779f" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/asm-differ --force subrepo: subdir: "tools/asm-differ" merged: "55bba23a" upstream: origin: "https://github.com/simonlindholm/asm-differ.git" branch: "main" commit: "55bba23a" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/decomp-permuter --force subrepo: subdir: "tools/decomp-permuter" merged: "a20bac94" upstream: origin: "https://github.com/simonlindholm/decomp-permuter.git" branch: "main" commit: "a20bac94" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596"
96 lines
1.8 KiB
C++
96 lines
1.8 KiB
C++
#include "MemoryStream.h"
|
|
#include <string.h>
|
|
|
|
#ifndef _MSC_VER
|
|
#define memcpy_s(dest, destSize, source, sourceSize) memcpy(dest, source, destSize)
|
|
#endif
|
|
|
|
MemoryStream::MemoryStream()
|
|
{
|
|
buffer = std::vector<char>();
|
|
bufferSize = 0;
|
|
baseAddress = 0;
|
|
}
|
|
|
|
MemoryStream::MemoryStream(char* nBuffer, size_t nBufferSize) : MemoryStream()
|
|
{
|
|
buffer = std::vector<char>(nBuffer, nBuffer + nBufferSize);
|
|
bufferSize = nBufferSize;
|
|
baseAddress = 0;
|
|
}
|
|
|
|
MemoryStream::~MemoryStream()
|
|
{
|
|
}
|
|
|
|
uint64_t MemoryStream::GetLength()
|
|
{
|
|
return buffer.size();
|
|
}
|
|
|
|
void MemoryStream::Seek(int32_t offset, SeekOffsetType seekType)
|
|
{
|
|
if (seekType == SeekOffsetType::Start)
|
|
baseAddress = offset;
|
|
else if (seekType == SeekOffsetType::Current)
|
|
baseAddress += offset;
|
|
else if (seekType == SeekOffsetType::End)
|
|
baseAddress = bufferSize - 1 - offset;
|
|
}
|
|
|
|
std::unique_ptr<char[]> MemoryStream::Read(size_t length)
|
|
{
|
|
std::unique_ptr<char[]> result = std::make_unique<char[]>(length);
|
|
|
|
memcpy_s(result.get(), length, &buffer[baseAddress], length);
|
|
baseAddress += length;
|
|
|
|
return result;
|
|
}
|
|
|
|
void MemoryStream::Read(const char* dest, size_t length)
|
|
{
|
|
memcpy_s((void*)dest, length, &buffer[baseAddress], length);
|
|
baseAddress += length;
|
|
}
|
|
|
|
int8_t MemoryStream::ReadByte()
|
|
{
|
|
return buffer[baseAddress++];
|
|
}
|
|
|
|
void MemoryStream::Write(char* srcBuffer, size_t length)
|
|
{
|
|
if (baseAddress + length >= buffer.size())
|
|
{
|
|
buffer.resize(baseAddress + length);
|
|
bufferSize += length;
|
|
}
|
|
|
|
memcpy_s(&buffer[baseAddress], length, srcBuffer, length);
|
|
baseAddress += length;
|
|
}
|
|
|
|
void MemoryStream::WriteByte(int8_t value)
|
|
{
|
|
if (baseAddress >= buffer.size())
|
|
{
|
|
buffer.resize(baseAddress + 1);
|
|
bufferSize = baseAddress;
|
|
}
|
|
|
|
buffer[baseAddress++] = value;
|
|
}
|
|
|
|
std::vector<char> MemoryStream::ToVector()
|
|
{
|
|
return buffer;
|
|
}
|
|
|
|
void MemoryStream::Flush()
|
|
{
|
|
}
|
|
|
|
void MemoryStream::Close()
|
|
{
|
|
} |