Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

REIMPORT MEMORY_FILE WORK-AROUND ???

Featured Replies

  • Author
  • Localization

cornel, posted Sun May 20, 2018 4:22 pm (35093)


"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?
  • Author
  • Localization

aluigi, posted Sun May 20, 2018 4:49 pm (35096)


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.
  • Author
  • Localization

cornel, posted Mon May 21, 2018 9:41 am (35130)


What are memory_files? I am reimporting audio files.
  • Author
  • Localization

aluigi, posted Mon May 21, 2018 10:53 am (35135)


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.
  • Author
  • Localization

cornel, posted Mon May 21, 2018 11:02 am (35138)


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?
  • Author
  • Localization

aluigi, posted Mon May 21, 2018 11:19 am (35139)


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?
  • Author
  • Localization

aluigi, posted Mon May 21, 2018 12:46 pm (35143)


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
  • Author
  • Localization

cornel, posted Mon May 21, 2018 1:24 pm (35146)


Reimport gives an error...
  • Author
  • Localization

aluigi, posted Mon May 21, 2018 1:33 pm (35148)


try with the following line at the beginning of the script as suggested (the script is a header builder indeed):
Code:
quickbmsver "-."
  • Author
  • Localization

cornel, posted Mon May 21, 2018 1:52 pm (35149)


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...
  • Author
  • Localization

aluigi, posted Mon May 21, 2018 4:49 pm (35157)


I will check the method again for quickbms 0.8.5 but I'm quite sure it worked perfectly when I implemented it
Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.