summaryrefslogtreecommitdiff
path: root/PE/extract-rooms.cpp
diff options
context:
space:
mode:
authorpixel <pixel>2003-09-23 15:06:59 +0000
committerpixel <pixel>2003-09-23 15:06:59 +0000
commit6312cf3ac75b203a477d6d1a22ffbb124e5a874b (patch)
tree34deaf8b422149954314d6286ddd60be93cf23ee /PE/extract-rooms.cpp
parent346915db5aab133b6805cf58680b1378a45f0a40 (diff)
Some backported changes
Diffstat (limited to 'PE/extract-rooms.cpp')
-rw-r--r--PE/extract-rooms.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/PE/extract-rooms.cpp b/PE/extract-rooms.cpp
index e00a516..bb28e7f 100644
--- a/PE/extract-rooms.cpp
+++ b/PE/extract-rooms.cpp
@@ -39,7 +39,7 @@ virtual int startup() throw (GeneralException) {
f->read(&te, sizeof(struct tentry));
tab[i].sector = te.sector;
tab[i].sizes[0] = te.u[0];
- tab[i].sizes[1] = te.u[1] | (te.u[2] & 0xf);
+ tab[i].sizes[1] = te.u[1] | ((te.u[2] & 0xf) << 8);
tab[i].sizes[2] = (te.u[2] >> 4) | (te.u[3] << 4);
printm(M_INFO, "entry %3i - offset: %9i, sizes = %4i %4i %4i\n", i, tab[i].sector * 2048,
tab[i].sizes[0], tab[i].sizes[1], tab[i].sizes[2]);
@@ -50,14 +50,14 @@ virtual int startup() throw (GeneralException) {
f = new Input("pe.img");
for (i = 0; i < N; i++) {
- printm(M_INFO, "Dumping room %i\n", i);
+ printm(M_INFO, "Dumping room %i\n", i + 1);
if (!tab[i].sizes[0])
continue;
f->seek(tab[i].sector * 2048);
for (j = 0; j < 3; j++) {
- fn.set("rooms/room-%04i-%02i.out", i, j);
+ fn.set("rooms/room-%04i-%02i.out", i + 1, j);
t = new Output(fn);
@@ -70,7 +70,7 @@ virtual int startup() throw (GeneralException) {
}
for (i = 0; i < N; i++) {
- printm(M_INFO, "Dumping script %i\n", i);
+ printm(M_INFO, "Dumping script %i\n", i + 1);
found = empty = 0;
@@ -82,7 +82,8 @@ virtual int startup() throw (GeneralException) {
fn.set("scripts/room-%04i.txt", i);
t = new Output(fn);
-
+
+#if 0
f->read(&truesize, 4);
f->seek(truesize - 4, SEEK_CUR);
@@ -110,6 +111,21 @@ virtual int startup() throw (GeneralException) {
if (empty)
continue;
+#else
+ truesize = f->readU32();
+ ptr = f->readU32();
+ f->seek(orig + ptr + 32, SEEK_SET);
+ ptr = f->readU32();
+
+ if (!(ptr & 0xfff00000))
+ continue;
+
+ f->seek(orig + (ptr & 0xfffff) + 8);
+ size = f->readU32();
+ ptr = f->readU32();
+ pos = orig + (ptr & 0xfffff);
+ f->seek(pos);
+#endif
printm(M_INFO, "Found %i bytes of text at %i\n", size, pos);