Final fantasy 7 texture format

Blitz3D Forums/Blitz3D Programming/Final fantasy 7 texture format

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

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.