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.

QuickBMS - Reimporting files in the archives

Featured Replies

  • Author
  • Localization

aluigi, posted Fri Jan 13, 2017 4:57 pm (20124)


That script (49games.bms) is not valid for reimporting because the re-compression algorithm is not available.
  • Replies 58
  • Views 11
  • Created
  • Last Reply

Top Posters In This Topic

  • Author
  • Localization

skiracing, posted Fri Jan 13, 2017 5:20 pm (20127)


aluigi wrote:
That script (49games.bms) is not valid for reimporting because the re-compression algorithm is not available.


Thank you for answer.
Is there available any scrip that has this algorithm? If not, is there any chance for this algorithm to be added there?
Btw, despite this fact, I even succeeded in re-importing some files.
Please help, I play this game every ski season for more 10 years now (because there is never new ski game... :cry: :cry: :cry: ) so if I could make at least slight editing to feel it more enjoyable. Thank you so much for your help. :)
  • Author
  • Localization

aluigi, posted Fri Jan 13, 2017 5:33 pm (20128)


No, the only solution would be to check if the game works with the extracted files and without the original archive (probably doesn't work or requires specific folders).
Writing a rebuilder (with compression disabled) may be an option but you have to do it by yourself or finding someone who wants to do it.
You can also try some hacks on the archive with a hex editor like disabling the compression for that file, appending the content of the new file to the archive and editing the offset, size and crc field (and the method as already said).
Unfortunately with edited files the options are ever quite limited and I offer no support on this stuff, sorry.
  • Author
  • Localization

skiracing, posted Fri Jan 13, 2017 5:49 pm (20129)


Ohh..thank you for explanation.

I'm totally dumb on hacking and stuff like that and even do not understand anything about those methods that you are telling. Oh well, it is only hope maybe sometimes in future it will be possible to re-import edited files in the game. For now, at least I know there is no sense to trying more. Thanks anyway.
  • Author
  • Localization

Kryys, posted Sun Feb 05, 2017 8:04 pm (20637)


aluigi wrote:
It's a problem of physical space, so there is no ready solution except writing a rebuilder from scratch (the format is not complex) or just appending the new content to the file and then modifying the OFFSET and SIZE field in the archive (something that requires manual work but may be easy with the help of quickbms -l -V).

Hello, could you please provide (or link) an example on how to modify the offset and size field in an archive ? I'm currently making a voice mod, and i literally need to slaughter the soundtracks quality in order for them to "fit" in the original archive, which is not good at all :/
( If needed, i attached here the quickbms scipt i'm using, an archive and an ogg file i would like to inject in this archive)

test.rar

  • Author
  • Localization

aluigi, posted Sun Feb 05, 2017 8:58 pm (20638)


Ok, I will explain what's the normal method because you cannot use it in your situation since you have an encrypted TOC (the information about the archived files).
Sorry.

You need to run quickbms with the -l (list because you have already extracted the files) and -V option, example:
Code:
quickbms -l -V script.bms archive.dat > info.txt

When you open info.txt you can notice the following fields:
  • a dot
  • hexadecimal offset where is located the data read from the file
  • bms instruction used
  • name of the variable
  • value that has been read
  • size or type of value, usually just the size of the field (1 for byte, 4 for long and so on, N for strings)

The following is an example of these information:
Code:
. 00000012 get     comp_size  0x000032b4 4
. 00000016 get     uncomp_size 0x0000981a 4
. 0000001a get     name_len   0x0000000d 2
. 0000001c get     extra_len  0x00000000 2
. 0000001e getdstr name       "changelog.txt" 13
    63 68 61 6e 67 65 6c 6f 67 2e 74 78 74            changelog.txt
. 0000002b getdstr extra      "" 0
  0000002b 38938      changelog.txt

Now if you want to edit the offset and size of an archived file:
  • open the archive with a hex editor
  • go to the offset of the variable you want to change (the hexadecimal value after the dot)
  • put your new value overwriting the old one

So let's say you want to change the compressed and decompressed size of the previous example I provided, you have to go to offset 0x12 replacing 0x32b4 with the new one, and then do the same at offset 0x16 for 0x981a.

Yeah it's very simple if they are just few files.
  • Author
  • Localization

Kryys, posted Thu Feb 09, 2017 2:03 am (20718)


Ah, that's sad :/ But as i can see (i think ...), the quickbms script i'm using contains decryption keys for my archive. So my question is, can impliment this method directly into a quickbms script, so that he list the files and change the offset variables i want ? Or Quickbms can't directly modify an archive ?
  • Author
  • Localization

aluigi, posted Thu Feb 09, 2017 9:10 am (20723)


Quickbms can modify archives, there are instructions like Put that do this job and the log/clog commands can be used to write data into the input archive too (with "append 1").
If you have time, perfect skills with quickbms and you have the re-encryption function probably you can (but don't expect any time and help from me, sorry)
  • Author
  • Localization

Kryys, posted Thu Feb 09, 2017 10:53 am (20729)


It's ok, thank you very much for the information, it will help me in the future :D
  • Author
  • Localization

Kratos9999, posted Mon Apr 17, 2017 2:17 pm (22296)


Hi aluigi, how I can do for reimport a folder with a file inside for a archive? I've read the section 3 of manual, but I didn't understood the steps for reimport folders with files inside.
  • Author
  • Localization

aluigi, posted Mon Apr 17, 2017 2:32 pm (22297)


The process is completely automatic and, remember, you can reimport only what has been extracted (what already existed in the archive and you have modified), so if you are thinking about adding new files/folders then you can't.
  • Author
  • Localization

aluigi, posted Mon Apr 17, 2017 3:43 pm (22306)


Recent asura archives are entirely compressed so the script decompresses the input archive in a temporary file which is then used as source for the extraction.
In that scenario you can't use the reimport feature of quickbms because the data doesn't come directly from the input archive.
Luckily that's not your case but I want to warn people if they encounter that case.

Regarding your case there is nothing special except various files that have the same name and so they can't be reimported correctly.
What I mean is that if you can't reimport the files you are using the reimport feature in the wrong way.
Solution: READ section 3 for real and do the SAME steps you did during extraction.
  • Author
  • Localization

Kratos9999, posted Mon Apr 17, 2017 3:59 pm (22307)


I've searched in net and it seems there is a unpacker/repacker tool for the asura format, but all the links that I have tried are broken! I would like aluigi if you have this tool for send to me, I've read the SECTION 3 and the reimport didn't work, the quickbms close automatically. I need it so much of this tool, It looks like it was made by Terry Buttler, but the download link in official site is not working. In asura script there is a citation about this author, please, if you have this tool send for me, I will be very grateful, very
much.
  • Author
  • Localization

AlexCooks, posted Sun Jul 02, 2017 5:50 am (24368)


This has been addressed before, but since I can't find an answer, I'd like your help with it.
Following is the cmd log (I used the reimport batch file)

Code:
QuickBMS generic files extractor and reimporter 0.8.0
by Luigi Auriemma
e-mail: [email protected]
web:    aluigi.org
        (Mar 12 2017 - 15:03:46)

                   quickbms.aluigi.org  Homepage
                            zenhax.com  ZenHAX Forum
                               @zenhax  Twitter & Scripts

- GUI mode activated, remember that the tool works also from command-line
  where are available various options like folder scanning, filters and so on

- select the BMS script to use
- select the input archives/files to extract, type * or "" for whole folder and
subfolders
- select the output folder where extracting the files
- REIMPORT mode enabled!
  - remember to select the SAME script, file and folder you selected during
    the previous extraction
  - it's highly suggested to leave only the edited files in the folder, it's
    faster and less prone to errors with compressed files
- open input file C:\XYZ\!Games\Onigiri\MOD\ORG\avatar_body-000d.kxr
- open script C:\XYZ\!Games\Onigiri\MOD\SCRIPTS\onigiri_online.bms
- set output folder C:\XYZ\!Games\Onigiri\MOD\OP TRIAL

  offset   filesize   filename
--------------------------------------

- the script needs to load a pre-compiled function from the dll or code
  MEMORY_FILE3
  do you want to continue with this and any other requested dll/code (y/N)?
  y
- library MEMORY_FILE3 loaded at address 0F7C0000
- function found at offset 0F7C0000
-
- 0 files reimported in 3 seconds
  coverage file 0     1%   1350274    84488400   . offset 00000010
  coverage file -1  100%   21177      21177      . offset 000052b9
  coverage file -2    0%   0          363        . offset 00000000
  coverage file -3    0%   0          69         . offset 00000000

Press ENTER or close the window to quit


The game is Onigiri Online, so the script is correct.
Next about the files and folders,
-I extracted 'avatar_body-000d.kxr' from folder ORG to folder 'OP TRIAL'
-I edited .dds file '81.dds' (original file size 171 KB), and compressed it (modded file size 129 KB)
-I deleted everything else in the output folder
-I run reimport.bat
-I choose the same script, input folder as 'ORG' and .kxr file, and output folder as 'OP TRIAL'
-I continue as shown above

It says, as can be seen, 0 files reimported. I am tempted to try it out anyway, but common sense says it probably didn't work.

Any and all help would be appreciated.
  • Author
  • Localization

aluigi, posted Thu Jul 20, 2017 3:54 pm (24836)


The onigiri script has one type of file (type 0) that can't be reimported since it's dumped from the memory instead of the file (it requires custom decryption), while the other types are ok.
It "seems" you selected the same files and folders of the extraction so it should be ok, that's why I don't get why there are 0 files found.
The simplest test you can do is just the following, if reimporting works here then there is no problem:
Code:
quickbms       onigiri_online.bms PATH\avatar_body-000d.kxr PATH\output
quickbms -r -w onigiri_online.bms PATH\avatar_body-000d.kxr PATH\output
I don't have an Onigiri sample so if the problem persists would be useful if you can provide avatar_body-000d.kxr
  • Author
  • Localization

Gsx31, posted Mon Oct 23, 2017 1:26 am (27612)


Hello,

Before beginning, I am anxious to thank you for your tutorials.

I wanted to extract the audio files wav which are in the audio files bank in Assetto Corsa, to edit the sound when the engine arrives at the contact breaker.

I managed to extract files wav from the file bank. I puts you the video.

https://www.youtube.com/watch?v=kcpCAZcFEnk

On the other hand, I did not manage to compile the file wav in the file bank.
I made a video in 2 stages which correspond to the stages to extract files, but that never works.

Here I just resume the file of entrance, I made a test, it does not work, the sound did not change

https://www.youtube.com/watch?v=AmaFyRxp4f8

Here I just resume the file of entrance the file 00000000.fsb I made a test, it does not work, the sound did not change

https://www.youtube.com/edit?o=U&video_id=FqoU6W8dLBI

I make an error somewhere, either it is impossible to recompile files BANK Assetto Corsa

Thank you in advance for your help.
  • Author
  • Localization

aluigi, posted Mon Oct 23, 2017 9:31 am (27619)


Everything was correct on the quickbms side, one file correctly reimported.

Have you edited 00000000.fsb?
I mean have you reimported the edited wav file in the fsb archive?
  • Author
  • Localization

Gsx31, posted Mon Oct 23, 2017 6:39 pm (27644)


Hello,

I do not if I modified 00000000.fsb.

I do not speak English, but I am going to try to tell you what I'm doing, so that you can tell me or I make an error.

I already posted a video to let you see how I was doing to extract the WAV files from the file imsa_jaguar_xjr12.bank
https://www.youtube.com/watch?v=kcpCAZcFEnk

(I put you a link towards the file, so that can look if it is possible to reinject files)
imsa_jaguar_xjr12.bank https://app.box.com/s/qvn7xzedw05ktstzyjajtkzmbzouaqiz

I also link to the WAV file limit_ext.wav that I edited
https://app.box.com/s/guawklouxkq6nc2t7cpkj8r5tvgeafi1

I'm not going to tell you how to re-inject the files, because I do not know what to do exactly.

When I run "reimport.bat" I have to choose the file imsa_jaguar_xjr12.bank, or the file 00000000.fsb ?

If I chose the file imsa_jaguar_xjr12.bank I notice the modification date of the file 00000000.fsb changed. I therefore conclude that something has been changed, but I'm not sure ...

I run reimport.bat and I will look for the script

Image

Then I will look for the file 00000000.fsb

Image

I have the record

Image

A CMD window opens and I see that 1 file has been reinjected successfully.

Image

I guess that means that the WAV file I edited replaced the original WAV file, but I'm not sure ...

Now, I do not know how to go from this file 00000000.fsb to a file imsa_jaguar_xjr12.bank
  • Author
  • Localization

aluigi, posted Mon Oct 23, 2017 8:13 pm (27646)


Gsx31 wrote:
I also link to the WAV file limit_ext.wav that I edited
...
I'm not going to tell you how to re-inject the files, because I do not know what to do exactly.

That's the problem.
If you don't update the fsb archive then what you reimport is exactly the same original file.

There is no reason for you to use fsb_aud_ext, that tool is necessary only for fsb5 archives that contain ogg data.
Use fsbext to do the job and you will be even able to reinject the edited file in the archive since, luckily for you, the files are just pcm16 wav.
http://aluigi.altervista.org/papers.htm#fsbext

I suggest you to use the official FMOD soundbank tool for rebuilding the fsb archive, otherwise you can rely on fsbext but I'm not sure if it works properly.

Long story short, you are OT here because it's not related to quickbms reimporting, post in the Audio section regarding FSB editing/reimporting in case you still have problems.
  • Author
  • Localization

lostprophet, posted Thu Nov 02, 2017 1:06 am (29640)


Is it possible to reimport into files larger than 4gb?
I'm trying to reimport a 90kb file, but with quickbms it just hangs, (I know, it's not supported for over 4gb), with quickbms_4gb it just shows 0 files reimported, and no error messages.

The game is Blade & Bones, and UE4 game.
  • Author
  • Localization

aluigi, posted Thu Nov 02, 2017 10:40 am (29648)


If you get the "0 files reimported" it means you did something wrong.
Read section 3 of quickbms.txt and viewtopic.php?p=23032#p23032

Please note that the edited archive may not work (due to compressions, chunks and so on)
  • Author
  • Localization

GIRLgaming, posted Thu Oct 18, 2018 3:34 am (39674)


aluigi wrote:
An interesting feature of quickbms is the possibility to reimport/reinject the extracted files back in the archives.
It does NOT work with 100% of the scripts and there are some limitations but it's a great alternative to spending hours writing a repacker.

Details in section 3 of quickbms.txt:
http://aluigi.org/papers/quickbms.txt

Sometimes you don't need to reimport or rebuild an archive because probably the game already has the ability to load the files outside the archive.
Other times it's necessary to specify a command-line option to allow that operation.

If all the solutions fail, it's time to use the reimporting mode.

Things to know and limitations:
  • you can reinject the files only if they have a size equal or smaller than the original ones
  • only the most used compression algorithms are used, like zlib/deflate, lzma, lzo, lzss and many others
  • the scripts that dump the file from the memory file (for example for chunked files) are not supported

To use this feature you must:
  • make a backup copy of the archive
  • extract the files using the necessary script
  • edit the files you want to modify
  • delete all the files that have not been modified
  • double click on reimport.bat
  • do the SAME steps you did for extracting the archive.
    Seriously, do the same just like if you are extracting the files to the same folder.
    QuickBMS will do the job automatically
  • quickbms will show the names of the files that have been reimported
  • try the game with the new archive

Yes, it's really extremely simple.


Sir I did the same thing but i always get doesn't match error, i followed the steps i search the script needed but still the error. my file is npk so i used the nxpk script. please help me how to do it right
  • Author
  • Localization

aluigi, posted Thu Oct 18, 2018 5:35 pm (39695)


@GIRLgaming
Nothing to do.
If you used it correctly and quickbms gives you errors (about compression, memory_files and so on), then there is no solution.
  • Author
  • Localization

underwater, posted Fri Nov 02, 2018 7:41 pm (40059)


I'm having trouble repacking bank files.
The process works fine if I do it with a modified bank file that's about 2MB, but when I try the same thing with one that's about 200MB, then quickbms tells me it's larger than the original, even though it's significantly smaller: https://imgur.com/ZU9ZjnX
The bank contains the same number of files as originally, and all of the replaced ones are smaller than the original ones.
(I'm using quickbms_4gb_files for unpacking & packing.)

Here are the files, in case you need them: The original PAK file (6GB), the original bank file (208MB), and the modified bank file (203MB).
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.