ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Wed Sep 19, 2018 5:22 am

All times are UTC




Post new topic  Reply to topic  [ 12 posts ] 
Author Message
PostPosted: Sun May 20, 2018 4:22 pm 

Joined: Sun Feb 25, 2018 4:27 pm
Posts: 17
"Do you want to use the experimental reimporting of chunked MEMORY_FILE?"

I get this option when trying to reimport modified wav files (with the same size or smaller) into a (Star Wars TFU) pcd file...

Why doesn't QuickBMS simply reimport?


Top
   
PostPosted: Sun May 20, 2018 4:49 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 8779
Because reimporting is not guaranteed if memory_files are used.
The code is correct but users reported problems when reimporting files with scripts that use memory_files so I decided to warn the user about the experimental nature of the feature.


Top
   
PostPosted: Mon May 21, 2018 9:41 am 

Joined: Sun Feb 25, 2018 4:27 pm
Posts: 17
What are memory_files? I am reimporting audio files.


Top
   
PostPosted: Mon May 21, 2018 10:53 am 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 8779
MEMORY_FILEs are buffers, some fake files that exist only in memory and are used as temporary places where storing information and files for editing them or as "headers" for giving a format to raw files.
In the past I used them a lot for building files that were stored in chunked mode (basically a file divided in small pieces that must be reassembled in memory and then dumped to disk) inside the archive but now I try to avoid this technique when I can.


Top
   
PostPosted: Mon May 21, 2018 11:02 am 

Joined: Sun Feb 25, 2018 4:27 pm
Posts: 17
I see. Would it be possible to extract the chunks as they are (and then modify them as they are and reimport them as they are), instead of interpreting and reconstructing the final memory file?


Top
   
PostPosted: Mon May 21, 2018 11:19 am 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 8779
It's possible to update the script, maybe.
Remember that chunked files in reimport mode are ever a doubt even if dumped directly to disk for various technical reasons.
What's the exact script you are using?


Top
   
PostPosted: Mon May 21, 2018 11:25 am 

Joined: Sun Feb 25, 2018 4:27 pm
Posts: 17
http://forum.xentax.com/viewtopic.php?p=110901#p110901 (*edit by aluigi*)


Top
   
PostPosted: Mon May 21, 2018 12:46 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 8779
please use ever the official links when possible (I replaced the code with the link for you).

Let's try the following modified script:
Code:
open FDDE pcd 0
open FDDE pcp 1

get UNK long 0
get UNK long 0
get FILES long 0
get XML long 0
xmath NAMEOFF "(0x1c * FILES) + 0x10 + XML"
for i = 1 <= FILES
   get CRC long 0
   get OFFSET long 0
   get OFFSET2 long 0
   get SIZE long 0
   get FFFF long 0
   get UNK long 0
   get ZERO long 0
   savepos MYOFF 0
   goto NAMEOFF 0
   get NAMEL long 0
   getDstring NAME NAMEL 0
   string NAME += ".wav"
   savepos NAMEOFF 0
   xmath SIZE "SIZE - (OFFSET2 - OFFSET)"
   goto OFFSET 1
   get CODEC short 1
   if CODEC == 2
      callfunction msadpcm 1
   elif CODEC == 1
      callfunction pcm 1
   else
      print "error: unknown codec"
   endif
   goto MYOFF 0
next i

startfunction msadpcm
   putVarChr MEMORY_FILE 78 0
   log MEMORY_FILE 0 0
   set MEMORY_FILE binary "\x52\x49\x46\x46\x00\x00\x00\x00\x57\x41\x56\x45\x66\x6d\x74\x20\x32\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x61\x74\x61\x00\x00\x00\x00"
   get RIFFSIZE asize MEMORY_FILE
   math RIFFSIZE + SIZE
   math RIFFSIZE -= 8
   get CHANNELS short 1
   get FREQUENCY long 1
   get BPS long 1
   get ALIGN short 1
   get UNKNOWN1 long 1
   get UNKNOWN2 long 1
   get UNKNOWN3 long 1
   get UNKNOWN4 long 1
   get UNKNOWN5 long 1
   get UNKNOWN6 long 1
   get UNKNOWN7 long 1
   get UNKNOWN8 long 1
   get UNKNOWN9 long 1
   putVarChr MEMORY_FILE 4 RIFFSIZE long
   putVarChr MEMORY_FILE 22 CHANNELS short
   putVarChr MEMORY_FILE 24 FREQUENCY long
   putVarChr MEMORY_FILE 28 BPS long
   putVarChr MEMORY_FILE 32 ALIGN short
   putVarChr MEMORY_FILE 34 UNKNOWN1 long
   putVarChr MEMORY_FILE 38 UNKNOWN2 long
   putVarChr MEMORY_FILE 42 UNKNOWN3 long
   putVarChr MEMORY_FILE 46 UNKNOWN4 long
   putVarChr MEMORY_FILE 50 UNKNOWN5 long
   putVarChr MEMORY_FILE 54 UNKNOWN6 long
   putVarChr MEMORY_FILE 58 UNKNOWN7 long
   putVarChr MEMORY_FILE 62 UNKNOWN8 long
   putVarChr MEMORY_FILE 66 UNKNOWN9 long
   putVarChr MEMORY_FILE 74 SIZE long
   get FULLSIZE asize MEMORY_FILE
   log NAME 0 FULLSIZE MEMORY_FILE
      append
      log NAME OFFSET2 SIZE 1
   append
endfunction

startfunction pcm
   putVarChr MEMORY_FILE 44 0
   log MEMORY_FILE 0 0
   set MEMORY_FILE binary "\x52\x49\x46\x46\x00\x00\x00\x00\x57\x41\x56\x45\x66\x6d\x74\x20\x10\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x61\x74\x61\x00\x00\x00\x00"
   get RIFFSIZE asize MEMORY_FILE
   math RIFFSIZE + SIZE
   math RIFFSIZE -= 8
   get CHANNELS short 1
   get FREQUENCY long 1
   get BPS long 1
   get ALIGN short 1
   get BITS short 1
   putVarChr MEMORY_FILE 4 RIFFSIZE long
   putVarChr MEMORY_FILE 22 CHANNELS short
   putVarChr MEMORY_FILE 24 FREQUENCY long
   putVarChr MEMORY_FILE 28 BPS long
   putVarChr MEMORY_FILE 32 ALIGN short
   putVarChr MEMORY_FILE 34 BITS short
   putVarChr MEMORY_FILE 40 SIZE long
   get FULLSIZE asize MEMORY_FILE
   log NAME 0 FULLSIZE MEMORY_FILE
      append
      log NAME OFFSET2 SIZE 1
   append
endfunction


Top
   
PostPosted: Mon May 21, 2018 1:24 pm 

Joined: Sun Feb 25, 2018 4:27 pm
Posts: 17
Reimport gives an error...


Attachments:
untitled.PNG [22.92 KiB]
Not downloaded yet
Top
   
PostPosted: Mon May 21, 2018 1:33 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 8779
try with the following line at the beginning of the script as suggested (the script is a header builder indeed):
Code:
quickbmsver "-."


Top
   
PostPosted: Mon May 21, 2018 1:52 pm 

Joined: Sun Feb 25, 2018 4:27 pm
Posts: 17
Now there's no error message, but the injected audio file is ignored by the game and the original audio is playing.
When extracted, the modified audio file is indeed present in the pcd container file, but it turns out to be a blank (no sound) wav file, so somehow the injecting process erases the audio data from the file...


Top
   
PostPosted: Mon May 21, 2018 4:49 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 8779
I will check the method again for quickbms 0.8.5 but I'm quite sure it worked perfectly when I implemented it


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 12 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited