Jump to content

Recommended Posts

Posted

hi guys, someone knows how to extract textures from a3t format? in playstation 2 is called amt, but in playstation 3 is a3t, try to extract their textures with a .py script that made a user called nexus the modder credits to him for his program, but only extracts the textures of the characters only that, with another type of a3t file that is not character does not extract it, here the .py and sample files

A3T Tools.rar

Posted
5 hours ago, ikskoks said:

Some of them are DXT3:

obraz.thumb.png.80cc7eaa6a205a087f22afbdc8fe99e8.png

yes I was just checking recently, in the #a3t script it only supports dtx3 and that is used in the file characters, the other #a3t files apparently use another type of dtx, dtx3 is not used in some #amt files.

5 hours ago, ikskoks said:

Some of them are DXT3:

obraz.thumb.png.80cc7eaa6a205a087f22afbdc8fe99e8.png

I wonder if the script can be improved, I tried but I couldn't do it.

  • Engineers
Posted (edited)
from inc_noesis import *
import noesis
import rapi
import os

def registerNoesisTypes():
   handle = noesis.register("Dragon Ball Budokai 3 HD Collection(PS3) Textures", ".a3t")
   noesis.setHandlerTypeCheck(handle, noepyCheckType)
   noesis.setHandlerLoadRGBA(handle, noepyLoadRGBA)
   noesis.logPopup()
   return 1
        
def noepyCheckType(data):
   bs = NoeBitStream(data)
   if len(data) < 20:
      return 0
   return 1
   
def noepyLoadRGBA(data, texList):
    bs = NoeBitStream(data,NOE_BIGENDIAN)
    BaseName = rapi.getExtensionlessName(rapi.getLocalFileName(rapi.getInputName()))
    Underline = "_"
    bs.readBytes(16)
    ImageCount = bs.readUInt()
    ImageTableOffset = bs.readUInt()
    bs.seek(ImageTableOffset, NOESEEK_ABS)
    
    for i in range(ImageCount):
        ImageInfoOffset = bs.readUInt()
        cPos = bs.tell()
        if ImageInfoOffset != 0:
            bs.seek(ImageInfoOffset, NOESEEK_ABS)
            ImageIndex = bs.readUInt()
            ImgIndex = str(ImageIndex)
            bs.read(16)
            ImageOffset = bs.readUInt()
            bs.seek(ImageOffset, NOESEEK_ABS)
            bs.read(4)
            ImageDataSize = bs.readUInt()
            bs.read(16)
            PixelFormat = bs.readUByte()
            print(PixelFormat)
            bs.read(7)
            ImageWidth = bs.readUShort()
            ImageHeight = bs.readUShort()
            bs.read(92)
            data = bs.readBytes(ImageDataSize)
            
            if PixelFormat == 135:
                texFmt = noesis.NOESISTEX_DXT3
            elif PixelFormat == 133:
                data = rapi.imageFromMortonOrder(data, ImageWidth, ImageHeight, 4)
                #data = rapi.imageDecodeRaw(data, ImageWidth, ImageHeight, "r8g8b8a8")
                texFmt = noesis.NOESISTEX_RGBA32                
            
            texList.append(NoeTexture(BaseName + Underline + ImgIndex, ImageWidth, ImageHeight, data, texFmt))
        bs.seek(cPos, NOESEEK_ABS)
    return 1

 

Edited by h3x3r
Posted
58 minutes ago, h3x3r said:
from inc_noesis import *
import noesis
import rapi
import os

def registerNoesisTypes():
   handle = noesis.register("Dragon Ball Budokai 3 HD Collection(PS3) Textures", ".a3t")
   noesis.setHandlerTypeCheck(handle, noepyCheckType)
   noesis.setHandlerLoadRGBA(handle, noepyLoadRGBA)
   noesis.logPopup()
   return 1
        
def noepyCheckType(data):
   bs = NoeBitStream(data)
   if len(data) < 20:
      return 0
   return 1
   
def noepyLoadRGBA(data, texList):
    bs = NoeBitStream(data,NOE_BIGENDIAN)
    BaseName = rapi.getExtensionlessName(rapi.getLocalFileName(rapi.getInputName()))
    Underline = "_"
    bs.readBytes(16)
    ImageCount = bs.readUInt()
    ImageTableOffset = bs.readUInt()
    bs.seek(ImageTableOffset, NOESEEK_ABS)
    
    for i in range(ImageCount):
        ImageInfoOffset = bs.readUInt()
        cPos = bs.tell()
        
        bs.seek(ImageInfoOffset, NOESEEK_ABS)
        ImageIndex = bs.readUInt()
        ImgIndex = str(ImageIndex)
        bs.read(3)
        PixelFormat = bs.readUByte()
        ImageWidth = bs.readUShort()
        ImageHeight = bs.readUShort()
        bs.read(8)
        ImageOffset = bs.readUInt()
        bs.seek(ImageOffset, NOESEEK_ABS)
        bs.read(128)
        ImageDataSize = ImageWidth * ImageHeight
        data = bs.readBytes(ImageDataSize)
        texFmt = noesis.NOESISTEX_DXT3
        texList.append(NoeTexture(BaseName + Underline + ImgIndex, ImageWidth, ImageHeight, data, texFmt))
        bs.seek(cPos, NOESEEK_ABS)
    return 1

 

it's a very good script! but I still don't understand why you can't open other types of a3t, for example noesis won't let me view this a3t

The good thing, is that I took the time to research the a3t file, I'll explain what's here:

RED: Nº Textures in the file
Yellow: Texture index offset
Black: texture 1(includes bpp, dimensions etc in this area)
Green: DDS Header

this file contains only one texture

 

 

Screenshot_2.thumb.png.a0819ea77b4900c5c73d15710f1dbcf1.png



 

mCSgny1.rar

  • Engineers
Posted (edited)

There is morton involved. Also width/height from table doesn't always match width/height from dds header. So script must be rewriten.

It's hard to make a struct just from one sample. Post more samples.

Edited by h3x3r
Posted

thanks mate! so far I have tried 5 files and it works too well, I'll keep you posted, maybe based on this script, I can make a reimporter and an improved extractor

Posted
On 4/8/2025 at 2:49 AM, h3x3r said:

Updated script. Now it should work.

i have tried to make a .py script to extract the textures without depending on noesis but i couldn't when you have some free time or you want to do it could you make a script?

  • Engineers
Posted

Sorry to tell you that but i am not good enough in that. You are on your own. Maybe someone else can help.

Anyway you must deal with morton algo.

  • Like 1

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...