summaryrefslogtreecommitdiff
path: root/Database/internals/database-segment.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Database/internals/database-segment.cpp')
-rw-r--r--Database/internals/database-segment.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/Database/internals/database-segment.cpp b/Database/internals/database-segment.cpp
index 55689f8..8ee5b4b 100644
--- a/Database/internals/database-segment.cpp
+++ b/Database/internals/database-segment.cpp
@@ -1,6 +1,10 @@
+#include <assert.h>
+
+#include <allocator.h>
+#include <log.h>
#include "database-segment.h"
-Segment::Segment(Uint32 size, Uint32 id, Uint64 cpu_base, Uint32 extra_size, const Byte * data) : patches(0), plainmemory(0), size(size), extra_size(extra_size), id(id), cpu_base(cpu_base) {
+Segment::Segment(Uint32 size, Uint32 id, Uint64 cpu_base, Uint32 extra_size, const Byte * data) : plainmemory(0), patches(0), size(size), extra_size(extra_size), id(id), cpu_base(cpu_base) {
Uint64 fullsize = size + extra_size;
assert(size);
@@ -8,7 +12,7 @@ Segment::Segment(Uint32 size, Uint32 id, Uint64 cpu_base, Uint32 extra_size, con
if (data) {
plainmemory = (Byte *) data;
loaded = true;
- allocated = false
+ allocated = false;
} else {
plainmemory = Allocator<Byte>::alloc(size);
loaded = false;
@@ -23,7 +27,7 @@ Segment::~Segment() {
Allocator<Byte>::free(plainmemory);
if (patches)
Allocator<Byte>::free(patches);
- if (patchesmemory)
+ if (patchesmap)
Allocator<Byte>::free(patchesmap);
Allocator<memory_tags_t>::free(tags);
Allocator<SegmentRefData *>::free(refData);
@@ -82,10 +86,10 @@ void Segment::LoadMemory(Handle * src) {
return;
}
- src->Read(plainmemory, size);
+ src->read(plainmemory, size);
}
-void setTag(Uint32 ptr, memory_tags_t tag) {
+void Segment::setTag(Uint32 ptr, memory_tags_t tag) {
if (ptr >= (size + extra_size)) {
LOG(CONSOLE, ERROR, "Out of bound setTag attempt in segment %i at %08X\n", id, ptr);
return;
@@ -93,7 +97,7 @@ void setTag(Uint32 ptr, memory_tags_t tag) {
tags[ptr] = tag;
}
-memory_tags_t getTag(Uint32 ptr) {
+memory_tags_t Segment::getTag(Uint32 ptr) {
if (ptr >= (size + extra_size)) {
memory_tags_t z = { 0, 0 };
LOG(CONSOLE, ERROR, "Out of bound getTag attempt in segment %i at %08X\n", id, ptr);