diff options
author | Michael <60937741+majesticCoding@users.noreply.github.com> | 2021-01-09 16:36:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-09 16:36:44 +0100 |
commit | 5a5f06ef2a40ba52cca60071cb95687fc8a0b1c3 (patch) | |
tree | 672024c0e3bf8cc3e0b96a89d6bed0680ab5284c /src/leeds/base | |
parent | Allocator fix (diff) | |
parent | Merge remote-tracking branch 'upstream/lcs' into lcs (diff) | |
download | re3-5a5f06ef2a40ba52cca60071cb95687fc8a0b1c3.tar re3-5a5f06ef2a40ba52cca60071cb95687fc8a0b1c3.tar.gz re3-5a5f06ef2a40ba52cca60071cb95687fc8a0b1c3.tar.bz2 re3-5a5f06ef2a40ba52cca60071cb95687fc8a0b1c3.tar.lz re3-5a5f06ef2a40ba52cca60071cb95687fc8a0b1c3.tar.xz re3-5a5f06ef2a40ba52cca60071cb95687fc8a0b1c3.tar.zst re3-5a5f06ef2a40ba52cca60071cb95687fc8a0b1c3.zip |
Diffstat (limited to 'src/leeds/base')
-rw-r--r-- | src/leeds/base/memoryManager.cpp | 4 | ||||
-rw-r--r-- | src/leeds/base/memoryManager.h | 4 | ||||
-rw-r--r-- | src/leeds/base/relocatableChunk.cpp | 36 | ||||
-rw-r--r-- | src/leeds/base/relocatableChunk.h | 51 |
4 files changed, 91 insertions, 4 deletions
diff --git a/src/leeds/base/memoryManager.cpp b/src/leeds/base/memoryManager.cpp index 20604299..57e7d954 100644 --- a/src/leeds/base/memoryManager.cpp +++ b/src/leeds/base/memoryManager.cpp @@ -64,12 +64,12 @@ void* operator new[](size_t size) return base::cMainMemoryManager::Instance()->Allocate(size); } -void operator delete(void* buf) +void operator delete(void* buf) noexcept { base::cMainMemoryManager::Instance()->Free(buf); } -void operator delete[](void* buf) +void operator delete[](void* buf) noexcept { base::cMainMemoryManager::Instance()->Free(buf); }
\ No newline at end of file diff --git a/src/leeds/base/memoryManager.h b/src/leeds/base/memoryManager.h index a4b1beac..91124cd1 100644 --- a/src/leeds/base/memoryManager.h +++ b/src/leeds/base/memoryManager.h @@ -35,5 +35,5 @@ namespace base void* operator new(size_t size); void* operator new[](size_t size); -void operator delete(void* buf); -void operator delete[](void* buf);
\ No newline at end of file +void operator delete(void* buf) noexcept; +void operator delete[](void* buf) noexcept;
\ No newline at end of file diff --git a/src/leeds/base/relocatableChunk.cpp b/src/leeds/base/relocatableChunk.cpp new file mode 100644 index 00000000..5cb5a426 --- /dev/null +++ b/src/leeds/base/relocatableChunk.cpp @@ -0,0 +1,36 @@ +#include "common.h" +#include "relocatableChunk.h" + +namespace base +{ + // TODO(LCS): add actual code (all of these are stubs) + + void* cRelocatableChunk::Load(void* data, bool bShrink) { return nil; } + void* cRelocatableChunk::Load(const char* name, bool bShrink) { return nil; } + void cRelocatableChunk::Fixup(const sChunkHeader& header, void* data) {} + void cRelocatableChunk::Fixup(void* data) {} + void* cRelocatableChunk::Shrink(const sChunkHeader& header, void* data) { return nil; } + void* cRelocatableChunk::Shrink(void* data) { return nil; } + + cRelocatableChunkClassInfo::cRelocatableChunkClassInfo(const char* class_name, const void* pVmt, int size) {} + + cRelocatableChunkWriter::cRelocatableChunkWriter() {} + cRelocatableChunkWriter::~cRelocatableChunkWriter() {} + + void cRelocatableChunkWriter::AddPatch(void* addr) {} + void cRelocatableChunkWriter::AddPatchWithInfo(const char* str, int unk, void* addr) {} + void cRelocatableChunkWriter::AllocateRaw(void* addr, uint32 size, uint32 align, bool a5, bool a6) {} + + void cRelocatableChunkWriter::Clear() {} + void cRelocatableChunkWriter::Class(void* ptr, const cRelocatableChunkClassInfo& classInfo) {} + void cRelocatableChunkWriter::DebugFileLine(void*) {} + + void cRelocatableChunkWriter::PatchFunc(void* ptr) {} + + bool cRelocatableChunkWriter::IsAllocated(void* addr) { return false; } + + void cRelocatableChunkWriter::Reserve(int, int) {} + + void cRelocatableChunkWriter::Save(const char* filename, uint32 a3, uint32 a4, bool a5) {} + void cRelocatableChunkWriter::Save(void* file, uint32 a3, uint32 a4, bool a5, sChunkHeader* pHeader) {} +};
\ No newline at end of file diff --git a/src/leeds/base/relocatableChunk.h b/src/leeds/base/relocatableChunk.h new file mode 100644 index 00000000..ea910240 --- /dev/null +++ b/src/leeds/base/relocatableChunk.h @@ -0,0 +1,51 @@ +#pragma once + +namespace base +{ + // TODO(LCS): add actual struct fields + + struct sChunkHeader; + struct sDataBlock; + struct sFileLine; + + class cRelocatableChunk + { + public: + void* Load(void* data, bool bShrink); + void* Load(const char* name, bool bShrink); + void Fixup(const sChunkHeader& header, void* data); + void Fixup(void* data); + void* Shrink(const sChunkHeader& header, void* data); + void* Shrink(void* data); + }; + + class cRelocatableChunkClassInfo + { + public: + cRelocatableChunkClassInfo(const char* class_name, const void* pVmt, int size); + }; + + class cRelocatableChunkWriter + { + public: + cRelocatableChunkWriter(); + ~cRelocatableChunkWriter(); + + void AddPatch(void* addr); + void AddPatchWithInfo(const char* str, int unk, void* addr); + void AllocateRaw(void* addr, uint32 size, uint32 align, bool a5 = false, bool a6 = false); + + void Clear(); + void Class(void* ptr, const cRelocatableChunkClassInfo& classInfo); + void DebugFileLine(void*); + + void PatchFunc(void* ptr); + + bool IsAllocated(void* addr); + + void Reserve(int, int); + + void Save(const char* filename, uint32 a3, uint32 a4, bool a5); + void Save(void* file, uint32 a3, uint32 a4, bool a5, sChunkHeader* pHeader); + }; +};
\ No newline at end of file |