CREATE and FUCK your own AI GIRLFRIEND TRY FOR FREE
x

Tool Others TAD Extractor

Vvvvv01

New Member
Oct 5, 2023
2
0
Apparently the structure of TAD files is really basic.

Attached, a small tool (windows 64 version only) quickly coded to extract files from a TAD file.

Select one TAD file ("File..." button) to process it, or one folder ("All files..." button) to process all the TAD files present in this folder.

Extracted files are put into a sub-folder called [TAD_FileName].out: for instance, if the TAD file to process is called "Pictures.tad", the output files will be extracted into the sub-folder called "Pictures.tad.out".


Capture: View attachment 1748163


*** EDIT ***

Removed the 32 bits version, as it is WRONGLY considered as a virus by some "minor" antivirus at Virus Total, and so by the AV system of this web site.

.
How to repackage a file into TAD format?
 

pcnop

Well-Known Member
Jun 26, 2018
1,307
1,129
How to repackage a file into TAD format?
Sorry, I don't know which game engine uses this kind of file: probably an old one, I guess. And I don't know neither any tool which can do it.

But the TAD format is pretty simple (see first post of this topic): coding a simple tool shouldn't be a big deal (if you know any programming language, of course).
 

Vvvvv01

New Member
Oct 5, 2023
2
0
Sorry, I don't know which game engine uses this kind of file: probably an old one, I guess. And I don't know neither any tool which can do it.

But the TAD format is pretty simple (see first post of this topic): coding a simple tool shouldn't be a big deal (if you know any programming language, of course).
[/引用]
import os
import struct

def pack_folder(folder_path):
files = os.listdir(folder_path)
tad_struct = b''
for file in files:
with open(os.path.join(folder_path, file), 'rb') as f:
data = f.read()
tad_struct += struct.pack('!I I I', 0x31, len(data), 0x00)
tad_struct += data
with open(os.path.join(folder_path, 'packed.tad'), 'wb') as f:
f.write(tad_struct)

pack_folder(' ')
This is the code I wrote using AI, but it can’t run after being packed. Can you help me see what’s wrong?
 

pcnop

Well-Known Member
Jun 26, 2018
1,307
1,129
I'm not really good at Python.

Anyway, as far as I can see there are several issues in your code. Here is a basic working one, coming from a modified version of yours (please note that the indentation is mandatory):

Python:
import os
import struct
import array as arr

def pack_folder(folder_path):
   nbr_files = 0
   tad_filelen = arr.array('i', [])
   tad_filedata = b''
   files = os.listdir(folder_path)
   for file in files:
      with open(os.path.join(folder_path, file), 'rb') as f:
        data = f.read()
      tad_filelen.append(len(data))
      tad_filedata += data
      nbr_files += 1
   with open('packed.tad', 'wb') as f:
     f.write(str(nbr_files) + ' q')
     for i in range(nbr_files):
       f.write(str(tad_filelen[i]) + ' q')
     f.write(tad_filedata)

pack_folder('./test')

This code will construct a tad file called "packed.tad" in the same folder as the Python code file, containing the files present in a sub-folder called "test".

As a sample, attached the concerned Python code file (called "test.py"), with 2 text files in the "test" sub-folder.


*** EDIT ***

Caution: As there are no indices and no filenames in the tad files, the order in which the files are added to the tad file is highly sensible.
 
Last edited:

hungchip

Newbie
Feb 19, 2022
37
11
pcnop my lord, your tool is really amazing and simple to use. But how can I put my .png image file edited with Photoshop back to .tad? I have some basic knowledge of programming but everything is really difficult for me. It's not as simple as using your program to just 1 click Extract All File..
1699840490754.png
 

pcnop

Well-Known Member
Jun 26, 2018
1,307
1,129
pcnop my lord, your tool is really amazing and simple to use. But how can I put my .png image file edited with Photoshop back to .tad? I have some basic knowledge of programming but everything is really difficult for me. It's not as simple as using your program to just 1 click Extract All File..
Thank you.

Concerning the possibility to rebuild a .tad file, I've already think about it but there are some issues with this file format. And I'm not quite sure of how to solve them (I don't know the "rules" of the original program which makes them).

OK, I'm going to try to propose at least a basic option for that.
 
  • Red Heart
Reactions: hungchip

pcnop

Well-Known Member
Jun 26, 2018
1,307
1,129
pcnop my lord, your tool is really amazing and simple to use. But how can I put my .png image file edited with Photoshop back to .tad? I have some basic knowledge of programming but everything is really difficult for me. It's not as simple as using your program to just 1 click Extract All File..

OK, I've now added the possibility to (re)build a TAD file in my tool.

As the TAD file format is very basic (no file names inside, no indexes, ...), it's extremely important to respect the order of the stored files inside the TAD file (especially if you rebuild a new TAD file with files extracted from an "original" TAD file).

So, here are the rules applied by my tool to build a TAD file:

- you can only build one TAD file at a time. Indicate a folder and the files present in this folder will be stored in the new TAD file (casual sub-folders inside the designated folder are just ignored).

- currently only image files are processed when building a TAD file (i.e. files with the following extensions: .png, .jpg, .gif or .webp - I'm not even sure it's possible to find other files than PNG files inside an "original" TAD file). It could be modified in the future if I find some other kind of files inside a TAD file (audio files, script files, ...). As I still don't know which game engine is using this kind of file, I have no idea of what kind of files are really supposed to be present in a TAD file (if someone knows it, I'd be glad to have a link toward this game engine).

- only image files with a name corresponding to a number are processed: like 1.png, 23.png, 001.png, ... Samples of image file names that are incorrect and so not processed: 'firstfile.png', 'test.png', 'file1.png', '02a.png', ... The image files present in the designed folder are then stored in the exact order of their "numerical" names: i.e. 1.png will be stored first, then 2.png, then 3.png, ....
It's though possible to have "missing" numbers for the file names, but the main rule concerning the order of the stored files is still applied (i.e. the order of the "numerical" names). For instance, if the 3 following files are present '001.png', '11.png' and '0230.png', the order of the stored files will be: 001.png (i.e. numerical name = 1), 11.png (i.e. numerical name = 11) and 0230.png (i.e. numerical name = 230).

- the new TAD file obtained will be stored inside the folder you've indicated, with its name being the name of the sub-folder plus the '.tad' extension. For instance:
. if you first extract the files from a TAD file called 'test.tad', the files will be stored in
a sub-folder called 'test.tad.out' with the following files inside: 1.png, 2.png, 3.png, ....
. when (re)building the TAD file, you indicate the 'test.tad.out' folder to be processed. The new
TAD file obtained will be stored inside this 'test.tad.out' folder and the name of this new TAD
file will be: 'test.tad.out.tad'
So, if you want to re-use (in the original game) the new TAD file obtained in my previous sample, you'll have to first rename it from 'test.tad.out.tad' to 'test.tad' (and to replace it in the game folder, of course).


WARNING: JUST BE SURE to BACKUP FIRST the ORIGINAL TAD file(s): my tool has not been deeply proof tested.



I've updated my first post concerning my tool which now includes the possible download with the latest version of it (i.e. v1.02 currently), with this new TAD file building option.

See: https://f95zone.to/threads/tad-extractor.61638/post-7894081

.
 

pcnop

Well-Known Member
Jun 26, 2018
1,307
1,129
pcnop lord, the attachements under f95zone can't be download.
can you put your tadextractor in other site, like github or mega?
thanks !
Strange ...

Is it blocked by your browser ? Or by your antivirus, may be ?

Anyway, here is a workupload link to download it: