Final fantasy 7 texture format

Blitz3D Forums/Blitz3D Programming/Final fantasy 7 texture format

David819(Posted 2004) [#1]
Hi, i have been reading the final fantasy 7 file format and was wandering if someone could please tell me what i have done wrong in it please, the specs can be found on the page : http://www.mirex.mypage.sk/FILES/ff7_tex.txt
and my code is as follows:

Graphics 640,480,32,2
SetBuffer BackBuffer()

file=ReadFile("prac")
SeekFile(file,56)
Depth=ReadInt(File)
SizeX=ReadInt(File)
SizeY=ReadInt(File)
SeekFile(file,88)
Palette=ReadInt(File)

Text 0,0,"Depth: "+Depth
Text 0,20,"Size X: "+Sizex
Text 0,40,"Size Y: "+Sizey
Text 0,60,"Palette: "+Palette

img=CreateImage(SizeX,SizeY)
SetBuffer ImageBuffer( img )
LockBuffer()
For Y=0 To SizeY
For X=0 To SizeX
RGB=ReadInt( File ) And $FFFFFFFF
WritePixel X,Y,RGB
Next
Next
UnlockBuffer()
SetBuffer BackBuffer()
DrawImage img,0,0
WaitKey()

Edit:
The file loads fine, but when i try and draw it, it is all distored and i dont have a clue why that is.


Dreamora(Posted 2004) [#2]
you forget the large chunk + palette jump after the ReadInt at Offset 88

92 144 unknown

-- palette follows, size is (palette enteries count * 4 ) --



David819(Posted 2004) [#3]
ok, thanks, but what does that mean?


DarkEagle(Posted 2004) [#4]
Graphics 640,480,32,2 
SetBuffer BackBuffer() 

file=ReadFile("prac") 
SeekFile(file,56) 
Depth=ReadInt(File) 
SizeX=ReadInt(File) 
SizeY=ReadInt(File) 
SeekFile(file,88) 
Palette=ReadInt(File) 

Text 0,0,"Depth: "+Depth 
Text 0,20,"Size X: "+Sizex 
Text 0,40,"Size Y: "+Sizey 
Text 0,60,"Palette: "+Palette 

SeekFile(file,92+144)

img=CreateImage(SizeX,SizeY) 
SetBuffer ImageBuffer( img ) 
LockBuffer() 
For Y=0 To SizeY 
For X=0 To SizeX 
RGB=ReadInt( File ) And $FFFFFFFF 
WritePixel X,Y,RGB 
Next 
Next 
UnlockBuffer() 
SetBuffer BackBuffer() 
DrawImage img,0,0 
WaitKey() 



David819(Posted 2004) [#5]
ok thanks


Dreamora(Posted 2004) [#6]
wanting to hack a format but not capable of reading the format specs??

you should better focus on basic programming stuff for the moment


David819(Posted 2004) [#7]
Dreamora - i can read some specs just others are hard to understand.

ok, i tryed the code but it still does not display write i'm begining to think that the specs are not complete or something.