From 6312cf3ac75b203a477d6d1a22ffbb124e5a874b Mon Sep 17 00:00:00 2001 From: pixel Date: Tue, 23 Sep 2003 15:06:59 +0000 Subject: Some backported changes --- PE/extract-rooms.cpp | 26 +++++++++++++++++++++----- PE/reinsert.cpp | 13 +++++++++---- 2 files changed, 30 insertions(+), 9 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); diff --git a/PE/reinsert.cpp b/PE/reinsert.cpp index b4b60cf..1c6530b 100644 --- a/PE/reinsert.cpp +++ b/PE/reinsert.cpp @@ -24,6 +24,8 @@ virtual int startup() throw (GeneralException) { delete cd; delete iw; delete ir; + + return 0; ir = new Input("PE2.bin"); iw = new Output("PE2.bin", 0, 0); @@ -34,8 +36,6 @@ virtual int startup() throw (GeneralException) { delete cd; delete iw; delete ir; - - return 0; } int patch_img(cdutils * cd) { @@ -94,7 +94,7 @@ int patch_img(cdutils * cd) { printm(M_INFO, "Groupe %i...\n", i); for (c = 0; c < counts[i]; c++) { int sector, s1, s2, s3, r, size, size2, ptr, tptr, sig, jptr, sizes[2]; - r = groupes[c][i]; + r = groupes[c][i] - 1; unsigned char * room; sector = *((int *) (slus + offset + r * 8)); @@ -109,6 +109,8 @@ int patch_img(cdutils * cd) { room = (unsigned char *) malloc(size); cd->read_datas(room, GUESS, d_pe1.Sector + sector + s1 + s2, size); + +#if 0 ptr = size - 4; while (1) { tptr = *((int *) (room + ptr)); @@ -123,8 +125,11 @@ int patch_img(cdutils * cd) { } jptr = *((int *) (room + ptr - 8)); +#else + jptr = *((int *) (room + ((*((int *) (room + size2 + 32))) & 0xfffff) + 4)); +#endif - printm(M_INFO, " Room %i\n", r); + printm(M_INFO, " Room %i\n", r + 1); if (size2 < (jptr + f->GetSize())) { printm(M_ERROR, "size2 = %i, jptr = %i, f = %i, + = %i - script trop gros.\n", size2, jptr, f->GetSize(), jptr + f->GetSize()); -- cgit v1.2.3