Page 1 of 1

PrpPack does not work for MOUL files

PostPosted: Sat Jul 04, 2009 2:11 am
by diafero
I just tried to use PrpPack to extract a MOUL prp file ("Ercana_District_Canyon.prp") and it did not work: After running for about a minute, the application canceled with the following error:

terminate called after throwing an instance of 'hsFileWriteException'
what(): Error writing to file
Aborted
(that message should really say which file it tried to open)

The only file which got created in Ercana_Canyon_PRP is called "[0001].po" and has a size of about 330MiB, MUCH bigger than the prp file (which is about 4,5MiB). Extracting a TPOTS file works great. The same MOUL file can without problems be opened in PageEditor.

Re: PrpPack does not work for MOUL files

PostPosted: Sat Jul 04, 2009 2:26 am
by diafero
Ok, I got it working :)
Here is the patch:

Code: Select all
From a2848d921c8476230e7b8319911ca5f0bfa8d2ce Mon Sep 17 00:00:00 2001
From: diafero <diafero@arcor.de>
Date: Sat, 4 Jul 2009 11:25:23 +0200
Subject: [PATCH] fix reading MOUL files in PrpPack

---
 Tools/src/PrpPack.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Tools/src/PrpPack.cpp b/Tools/src/PrpPack.cpp
index b48fd20..be0187a 100644
--- a/Tools/src/PrpPack.cpp
+++ b/Tools/src/PrpPack.cpp
@@ -157,7 +157,7 @@ int main(int argc, char** argv) {
       #endif
         for (i=0; i<tCount; i++) {
             short type = S->readShort();
-            if (S->getVer() == pvEoa || S->getVer() == pvHex) {
+            if (S->getVer() >= pvLive) {
                 S->readInt();
                 unsigned char b = S->readByte();
                 if (b != 0)
--
1.6.0.4


That really makes me wonder why you duplicate some code between here and the resource manager...

Re: PrpPack does not work for MOUL files

PostPosted: Sun Jul 05, 2009 1:38 am
by Zrax
Thanks, I must have forgotten this one when I added MOUL support and changed the way Plasma versions are defined (I recognize that change between those two tests and >= pvLive :P)... In any case, I applied your patch, and it's on SVN and the Windows build now. Thanks!

Regarding the ResManager thing: The way that PrpPack works, it can't use the ResManager directly. It's the only tool that directly manipulates PRP objects WITHOUT trying to parse them, and using the ResManager would cause those objects to be parsed. Granted, PrpPack was also written before hsKeyedObjectStub was introduced, so it might be possible to rewrite it better now. However, since it works fine already (plus your patch), and since prpmod is probably better for individual object manipulation, I don't know that I'll ever end up rewriting it unless I get really bored someday ;).

Re: PrpPack does not work for MOUL files

PostPosted: Sun Jul 05, 2009 2:26 am
by diafero
Thanks for applying.

Yeah, being too lazy for a re-write which does not bring anything but reducing the amount of code... I know that :lol: