XeNTaX Forum Index
Forum MultiEx Commander Tools Tools Home
It is currently Mon May 29, 2017 3:21 am

All times are UTC + 1 hour


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Virtual Console replacement (N64?) textures (*.T64)
PostPosted: Mon Jan 11, 2016 11:46 pm 
Offline
n00b

Joined: Wed Oct 12, 2011 3:05 am
Posts: 10
Has thanked: 0 time
Have thanks: 1 time

Does anyone know what format the .T64 files from the Virtual Console releases of The Legend of Zelda Ocarina of Time and The Legend of Zelda Majora's Mask are in? The files for NTSC, JAP, and PAL are all the same except for the rom identifier at the start of the file and I'm looking for a tool that can convert them to .png or their n64 native formats.

Link to the files:
https://www.mediafire.com/folder/1t463d ... elda_Files

Zoinkity also mentioned the format here, assuming it's the same for the Zelda VC titles:
http://assemblergames.com/l/threads/sin ... ion.47187/
"Did take a look at the T64 files. It's odd, since they write in columns instead of rows and the palettes are argb. Still, the images are easy enough to extract, and since I have a handy-dandy table of everything might just be able to figure out how they know what to replace where ;*)"

You can make the ads go away by registering



Top
 Profile  
 
 Post subject: Re: Virtual Console replacement (N64?) textures (*.T64)
PostPosted: Fri Mar 25, 2016 6:15 am 
Offline
n00b

Joined: Wed Oct 12, 2011 3:05 am
Posts: 10
Has thanked: 0 time
Have thanks: 1 time
Anyone? I just need to be able to export them to png.


Top
 Profile  
 
 Post subject: Re: Virtual Console replacement (N64?) textures (*.T64)
PostPosted: Wed Jan 18, 2017 2:07 am 
Offline
n00b

Joined: Wed Oct 12, 2011 3:05 am
Posts: 10
Has thanked: 0 time
Have thanks: 1 time
Quote:
I've only looked at a small subset of t64 files, and they were all ci4 or ci8 images. They're saved in block format (probably interlaced as well), which is pretty typical on the backend of PCs and PC programs (like GIMP). I think (it has been a few years) the palettes are argb and not rgba. That said, the format is roughly this (pretty sure I'm forgetting a checksums in here though):
image file format:
0x0 4 VC64
0x4 4 4-byte cart ID string
0x8 4
0xC 4 width
0x10 4 height
0x14 4 [1:i4]
0x18 4 [1:i4]
0x1C 4 [00002000: 10x20, i4]
0x20 4 [0:i4, 8:ci4]
0x24 4 [offset of some kind, probably rdram]
0x28 2 tile width [computed as (width-1)*4]
0x2A 2 [0000]
0x2C 4 tile height [computed as (height-1)*4]
0x2E 2 [0000]
0x30 4 [08000054: 10x20, i4]
0x34 4 [00010000: 10x20, i4]
0x38 4 #palette entries
0x20 16 color palette
var 4 binary size
var var image binary

Reads the images in columns, reading a word per row.
So, 4bit samples write 8 pixels in a row, 8bit samples 4 pixels, 16bit samples 2 pixels, 32bit samples 1 pixel.
Annoying, since you basically have to straighten images before exporting.

I wasn't interested in import at all. Pretty sure to export them you'd use something like this to straighten out a ci4 image, but since I no longer have files to test against can't guarantee anything.

def straighten(data, height):
h = height << 2
c, d = 0, bytearray()
if isinstance(data, str): data = bytes.fromhex(data)
for i in range(height):
for j in range(c, len(data), h):
d.extend(data[j:j+4])
c+=4
return d


Can this get anyone in the right direction to decode these?


Top
 Profile  
 
 Post subject: Re: Virtual Console replacement (N64?) textures (*.T64)
PostPosted: Wed Jan 18, 2017 4:42 am 
Offline
VIP member
VIP member
User avatar

Joined: Wed Nov 05, 2008 12:16 pm
Posts: 772
Has thanked: 1692 times
Have thanks: 382 times
looks like you've been waiting a year for a response, :eek:
i would've just dumped the textures with an emulator by now :)

_________________
Noesis
Hex2obj
QuickBMS
TextureFinder
Unity Assets Bundle Extractor


Top
 Profile  
 
 Post subject: Re: Virtual Console replacement (N64?) textures (*.T64)
PostPosted: Thu Jan 19, 2017 8:51 pm 
Offline
n00b

Joined: Wed Oct 12, 2011 3:05 am
Posts: 10
Has thanked: 0 time
Have thanks: 1 time
I would, except the Virtual Console version of Majora's Mask I'm trying to dump the textures from doesn't run in Dolphin (crashes at the N64 logo; or after pressing A for the Japanese release). I also don't know exactly which textures these replace, since I can't look at them.


Top
 Profile  
 
 Post subject: Re: Virtual Console replacement (N64?) textures (*.T64)
PostPosted: Sat Mar 18, 2017 5:53 pm 
Offline
n00b

Joined: Wed Oct 12, 2011 3:05 am
Posts: 10
Has thanked: 0 time
Have thanks: 1 time
Well it looks like now I have code samples (C/C++? I'm not sure), but it'd be great if someone could either convert these files or write a program to do it.

Quote:
I don't have the time to convert and verify the output of all of these, but it isn't terribly difficult to do--especially if you have a dump of the originals.

Using a couple samples in one of those files here's a sort of guide on how to interpret the data.
http://imgur.com/a/AvrMA

16bit color is stored argb, not the typical rgba. The row sorting algos are in the album, illustrating how they reorganize the data. Not sure if any images are interlaced or not--none of these were--but if they are that step would likely come before sorting and not after.


Quote:
Image
This is a raw extract, reading the image as it is naturally stored. Color is stored argb16, not the typical rgba16 used in (most) N64.

Image
This is iterating the image so each sequential 32bit word is on the next line. That would be equivalent to:
Code:
def straighten(data, height):
    h = height << 2
    c, d = 0, bytearray()
    if isinstance(data, str): data = bytes.fromhex(data)
    for i in range(height):
        for j in range(c, len(data), h):
           d.extend(data[j:j+4])
        c+=4
    return d


Image
This reorganizes those blocks into "natural" image order. Equivalent to:
Code:
def blkdivide(data, width, height=8):
    h = height << 2
    width >>= 3
    width *= h
    c, d = 0, bytearray()
    if isinstance(data, str): data = bytes.fromhex(data)
    while c < len(data):
        for i in range(height):
            for j in range(c, c+width, h):
                d.extend(data[j:j+4])
            c += 4
        c+= (width - h)
    return d

Image
What I'm assuming is an i4 image is read no differently than a ci4 image. Internally, the number of palette entries is 0 with no placeholder between that and the size of the image binary.
Image
Likewise, ci8 images are not read any differently. In "block" order these would be composed of 4x8 blocks, since only four pixels will fit in a single 32bit word.
Example T64 images, converted raw, organized into blocks, and fully straightened.


Top
 Profile  
 
 Post subject: Re: Virtual Console replacement (N64?) textures (*.T64)
PostPosted: Wed Mar 22, 2017 5:39 am 
Offline
n00b

Joined: Wed Oct 12, 2011 3:05 am
Posts: 10
Has thanked: 0 time
Have thanks: 1 time
Would it be possible for someone to take all this information and write a program to convert them or is there still information needed?


Top
 Profile  
 
 Post subject: Re: Virtual Console replacement (N64?) textures (*.T64)
PostPosted: Wed Mar 22, 2017 4:34 pm 
Offline
VIP member
VIP member
User avatar

Joined: Wed Nov 05, 2008 12:16 pm
Posts: 772
Has thanked: 1692 times
Have thanks: 382 times
Aroenai wrote:
Well it looks like now I have code samples (C/C++? I'm not sure), but it'd be great if someone could either convert these files or write a program to do it.

its python and looks like someone already has a working conversion script according to what you've posted so far,
maybe you could ask this guy to give you the rest of the script so you can use it. :)

_________________
Noesis
Hex2obj
QuickBMS
TextureFinder
Unity Assets Bundle Extractor


Top
 Profile  
 
 Post subject: Re: Virtual Console replacement (N64?) textures (*.T64)
PostPosted: Thu Mar 23, 2017 1:25 am 
Offline
n00b

Joined: Wed Oct 12, 2011 3:05 am
Posts: 10
Has thanked: 0 time
Have thanks: 1 time
If I could get more than a few unlabeled code samples from the guy, I wouldn't be asking here...



Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group