From 14d90c9e1171655b864316c9c4aa34033fdd3a45 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Mon, 21 Sep 2009 03:37:45 +0200 Subject: Very first bit towards a Mips/PSX disassembler --- Database/internals/database-internal.cpp | 8 +++++--- Database/internals/database-internal.h | 4 ++-- Database/internals/database-segment.h | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'Database/internals') diff --git a/Database/internals/database-internal.cpp b/Database/internals/database-internal.cpp index e564c01..ce54f44 100644 --- a/Database/internals/database-internal.cpp +++ b/Database/internals/database-internal.cpp @@ -1,14 +1,16 @@ #include "database-internal.h" #include "database.h" -DatabaseCell::DatabaseCell(Cpu * cpu, Uint64 cpu_base, absolute_ptr origin, Uint32 size, Uint32 extra_size, DatabaseCell * prev, Database * parent) : cpu(cpu), next(0), prev(prev), parent(parent) { - prev->next = this; +DatabaseCell::DatabaseCell(Database * parent, Cpu * cpu, Uint64 cpu_base, absolute_ptr origin, Uint32 size, Uint32 extra_size, const Byte * data) : cpu(cpu), next(0), parent(parent) { + prev = parent->getEnd(); + if (prev) + prev->next = this; parent->setEnd(this); if (origin.raw_ptr) { Segment * origin_seg = parent->getSegment(SEGID(origin)); segment = new Segment(size, cpu_base, parent->GetNextSegId(), extra_size, origin_seg->getPristineMemory() + SEGOFFSET(origin)); } else { - segment = new Segment(size, cpu_base, parent->GetNextSegId(), extra_size); + segment = new Segment(size, cpu_base, parent->GetNextSegId(), extra_size, data); } } diff --git a/Database/internals/database-internal.h b/Database/internals/database-internal.h index 173eb62..4616d8c 100644 --- a/Database/internals/database-internal.h +++ b/Database/internals/database-internal.h @@ -17,9 +17,9 @@ class DatabaseCell : public Base { public: /** The constructor of a DatabaseCell. Note that if you specify the origin parameter, * it'll create a sub-segment based on the first one. Note also that this doesn't support - * the patching system, yet. + * the patching system, yet. data and origin are mutually exclusive. */ - DatabaseCell(Cpu * cpu, Uint64 cpu_base, absolute_ptr origin, Uint32 size, Uint32 extra_size, DatabaseCell * prev, Database * parent); + DatabaseCell(Database * parent, Cpu * cpu, Uint64 cpu_base, absolute_ptr origin, Uint32 size, Uint32 extra_size = 0, const Byte * data = 0); ~DatabaseCell(); Uint32 getId() { return segment->getId(); } void LoadMemory(Handle * src) { segment->LoadMemory(src); } diff --git a/Database/internals/database-segment.h b/Database/internals/database-segment.h index f01ac38..dc4d157 100644 --- a/Database/internals/database-segment.h +++ b/Database/internals/database-segment.h @@ -44,6 +44,7 @@ class Segment : public Base { * @return the memory block of the segment. */ const Byte * getPristineMemory() { return plainmemory; } + const memory_tags_t * getMemoryTags() { return tags; } void Patch(Uint32 ptr, Byte val); void Restore(Uint32 ptr); bool IsPatched(Uint32 ptr); -- cgit v1.2.3