Jump to content

How to hex edit files in batch


King Sexus
Go to solution Solved by ikskoks,

Recommended Posts

Pls bear with me. I'm looking for a way to have a single operation to be done on multiple (.dat) files (the running to over 1000 files). The operation is to simply remove the sixteen bytes (or the headers) from each (.dat) file because going in and editing each file is tedious and time consuming. Is there any script or Hex editor I could use to make this process smooth. I repeat, the operation is to remove the first 16 bytes from offset 0 in each file. Thank you.

Link to comment
Share on other sites

  • Solution

Just use this quickbms script:
 

get FILE_SIZE asize
get FILE_NAME basename
get EXTENSION extension
string OUTPUT_FILE_NAME p "%s_NEW.%s" FILE_NAME EXTENSION
xmath NEW_SIZE "FILE_SIZE - 16"
log OUTPUT_FILE_NAME 16 NEW_SIZE

with quickbms https://aluigi.altervista.org/quickbms.htm

 

You can select multiple files in quickbms window to do it in batch.

Link to comment
Share on other sites

10 hours ago, ikskoks said:

Just use this quickbms script:
 

get FILE_SIZE asize
get FILE_NAME basename
get EXTENSION extension
string OUTPUT_FILE_NAME p "%s_NEW.%s" FILE_NAME EXTENSION
xmath NEW_SIZE "FILE_SIZE - 16"
log OUTPUT_FILE_NAME 16 NEW_SIZE

with quickbms https://aluigi.altervista.org/quickbms.htm

 

You can select multiple files in quickbms window to do it in batch.

Thanks man

Link to comment
Share on other sites

18 hours ago, ikskoks said:

Just use this quickbms script:
 

get FILE_SIZE asize
get FILE_NAME basename
get EXTENSION extension
string OUTPUT_FILE_NAME p "%s_NEW.%s" FILE_NAME EXTENSION
xmath NEW_SIZE "FILE_SIZE - 16"
log OUTPUT_FILE_NAME 16 NEW_SIZE

with quickbms https://aluigi.altervista.org/quickbms.htm

 

You can select multiple files in quickbms window to do it in batch.

There is another one you can help me with, if you can.

Link to comment
Share on other sites

 have a Python script that does the function of unpacking and packing .bundle files from Burnout Paradise, Hot Pursuit Remastered, MW 2012, and one other game. Below I'll give you the details

When it opens, it asks me these questions:

A. Insert the input data.

The options they give me are as follows;

-h, --help

-v, --version

-u, --unpack

-p, --pack

 

B. Source game

The options here are;

I) bp

II) hp

III) hpr

IV) me

C. file or folder to unpack

D. output directory

Here are my answers:

A. -u

B. bp

C. I will drag the folder or file in question on the cmd window

D. If it is a folder, each .bundle file within the folder  gets an output folder named after itself without the extension e.g 69.bundle, 20.bundle, and 54.bundle outputs 69, 20, and 54 respectively

If it's a single . bundle file, it gets an output folder named after itself without the extension e.g 69.bundle outputs 69.

What I need to happen is that a script that when I open it automatically answers A&B with the ones stated and just starts the process at C. In other words I want the script to assume I want to unpack a .bundle file from Burnout Paradise.

 

I will provide the original script and a sample bundle file once I charge my laptop. 

Much appreciation.

 

0A254823.BUNDLE.zip 0B1C2748.BUNDLE.zip bundle_packer_unpacker.py

Edited by King Sexus
I answered part of my question and I needed to add some files
Link to comment
Share on other sites

Try this script:

 


:: Copyright © 2024  Bartłomiej Duda

:: Changelog:
:: Ver    Date        Name
:: v1.0   27.09.2024  Bartlomiej Duda

@ECHO OFF
echo Starting program...
echo.
echo.

setlocal enabledelayedexpansion
SET input_directory="aaa"
SET output_directory=bbb


echo Starting loop...
for /f "tokens=* delims=" %%a in ('dir %input_directory%\*.bundle /s /b') do (
set out_path=.\!output_directory!\%%~nxa
python ".\bundle_packer_unpacker.py" -u bp %%a !out_path!
echo.
)

pause



Save it like this:
obraz.png.b75e0e0c0ae65586fd81e7475daab3f9.png

Along with two directories. In my case "aaa" is input directory and "bbb" is an output directory.
It should look like this inside:
obraz.png.1cb4603e081199f1e84344ef2be7e7b4.png

obraz.png.1d7551d126c6ed2282ed027e68cdfcc8.png


Adjust directory names in the script if you want, then run the script and it should work. 😉

Link to comment
Share on other sites

2 hours ago, ikskoks said:

Try this script:

 


:: Copyright © 2024  Bartłomiej Duda

:: Changelog:
:: Ver    Date        Name
:: v1.0   27.09.2024  Bartlomiej Duda

@ECHO OFF
echo Starting program...
echo.
echo.

setlocal enabledelayedexpansion
SET input_directory="aaa"
SET output_directory=bbb


echo Starting loop...
for /f "tokens=* delims=" %%a in ('dir %input_directory%\*.bundle /s /b') do (
set out_path=.\!output_directory!\%%~nxa
python ".\bundle_packer_unpacker.py" -u bp %%a !out_path!
echo.
)

pause



Save it like this:
obraz.png.b75e0e0c0ae65586fd81e7475daab3f9.png

Along with two directories. In my case "aaa" is input directory and "bbb" is an output directory.
It should look like this inside:
obraz.png.1cb4603e081199f1e84344ef2be7e7b4.png

obraz.png.1d7551d126c6ed2282ed027e68cdfcc8.png


Adjust directory names in the script if you want, then run the script and it should work. 😉

Thank you but I gotta a question, do the .bat and have to be in the same place?

Link to comment
Share on other sites

Hopefully these are the last two. This is just a script to extract .wav (though as a bonus I would like the option between .wav and mp3) files from the two different.dat file types I'll provide for you below. One is named AEMS Bank and the Ginsu. The original decoder[NFS_gin_decoder] (used to extract from the .dat files from both 7z archives) is in one of the 7zips. I have included a 3rd archive that contains sample .dat files (despite them being the same name, they are different files) and my own .bat file that is used to extract mp3s from within that archive. I hope it will show you how I want the two other archives to be extracted. Thanks again

AEMS Bank.7z Ginsu.7z Ealayer.7z

Edited by King Sexus
Link to comment
Share on other sites

14 hours ago, ikskoks said:

Try this script:

 


:: Copyright © 2024  Bartłomiej Duda

:: Changelog:
:: Ver    Date        Name
:: v1.0   27.09.2024  Bartlomiej Duda

@ECHO OFF
echo Starting program...
echo.
echo.

setlocal enabledelayedexpansion
SET input_directory="aaa"
SET output_directory=bbb


echo Starting loop...
for /f "tokens=* delims=" %%a in ('dir %input_directory%\*.bundle /s /b') do (
set out_path=.\!output_directory!\%%~nxa
python ".\bundle_packer_unpacker.py" -u bp %%a !out_path!
echo.
)

pause



Save it like this:
obraz.png.b75e0e0c0ae65586fd81e7475daab3f9.png

Along with two directories. In my case "aaa" is input directory and "bbb" is an output directory.
It should look like this inside:
obraz.png.1cb4603e081199f1e84344ef2be7e7b4.png

obraz.png.1d7551d126c6ed2282ed027e68cdfcc8.png


Adjust directory names in the script if you want, then run the script and it should work. 😉

While you're working on the one above, I tried this script, and here is what it gives me.

Screenshot (12).png

Bundle Unpacker test 1.bat.zip

Link to comment
Share on other sites

For AEMS BANK you don't need any scripts. Those are EA ABK audio files. If you'l change extension from DAT to ABK, you will be able to process them in foobar2000 with vgmstream plugin.

 

For Ginsu files you can use this:
 

@ECHO OFF
echo Starting program...
echo.
echo.

for /f "tokens=* delims=" %%f in ('dir .\*.dat /s /b') do (
NFS_gin_decode.exe %%f
)

pause

 

And for the script from the previous post you have inserted absolute paths, while I told you the paths should be relative. Fix this in lines 13 and 14 (as shown in my example).

Link to comment
Share on other sites

Posted (edited)

Sorry for my late reply.

1. What do you mean by relative paths?

2. The answer above, is it supposed to be a batch or .BMS file?

3. Also, is there any way to extract sounds from splicers (precisely Burnout Paradise splicers)

Edited by King Sexus
I needed to add extra information
Link to comment
Share on other sites

On 10/8/2024 at 11:23 PM, King Sexus said:

1. What do you mean by relative paths?

Please read some articles about paths https://www.google.com/search?client=firefox-b-d&q=relative+path+and+absolute+path+difference

On 10/8/2024 at 11:23 PM, King Sexus said:

2. The answer above, is it supposed to be a batch or .BMS file?

Batch.

On 10/8/2024 at 11:23 PM, King Sexus said:

3. Also, is there any way to extract sounds from splicers (precisely Burnout Paradise splicers)

I don't know.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...