Helping Face Editor 1.00 Making

Supriya_India

Club Cricketer
Joined
Feb 19, 2006
Location
Kailashahar North Tr
Online Cricket Games Owned
Hi
Every one I m making Face Editor for C2k5 .PlZ Help me I m not avle to open *.fsh file using VB6 . is there any dll ,oxc file for fsh file opening
 
Supriya_India said:
What happend ?

What happend ?

Your thread was moved to the Cricket 2005 forum by a mod, (Duffarama in this case), because they thought it was appropriate.
 
I thought he ment why nobody is replying to his queston.. suprya i am sorry but i cant help you with this.. because i have never used VB 6.. :( but i am sure some great members are for sure going to help you on this!
 
check with colin (barmyarmy) because the latest player editor opens .fsh files i think
 
duded64 said:
check with colin (barmyarmy) because the latest player editor opens .fsh files i think

He made that using VB.Net and not VB6,so I doubt if he knows.

&Supriya:If anyone knew Im sure they would help.
 
There isn't any direct method of opening fsh files in vb so we have to convert the fsh file to dds file format. And then use freeimage (http://freeimage.sourceforge.net/) to the dds file (click here to learn more about dds file format) convert it to png, so that it can be displayed in vb.net.

Here's the stripped version of our function in VB.net which we used to convert fsh to dds, its pretty much self explainable. We just used a binary array to read from fsh and write as dds, because fsh and dds have different headers we have to manually fill the dds header as per the standard(line #22 & 23).
PHP:
Public Function FSHtoDDS(ByVal strFSHFile As String) As String 
	Dim BR As IO.BinaryReader = New IO.BinaryReader(IO.File.Open(strFSHFile, IO.FileMode.Open))
	Dim BW As IO.BinaryWriter = New IO.BinaryWriter(IO.File.Open(strDDS, IO.FileMode.CreateNew))
	Dim intWidth, intHeight As Integer, ByteArray() As Byte
	Dim strDDS As String
	strDDS = strAppPath + "temp.dds" 'strAppPath contains application path
	BR.BaseStream.Seek(36, IO.SeekOrigin.Begin)
	intWidth = BR.ReadInt16 'read width of that fsh image
	intHeight = BR.ReadInt16 'read height of that fsh image
	ReDim ByteArray(intWidth * intHeight - 1) 'Redim the array so that it can hold the entire bytes
	BR.BaseStream.Seek(48, IO.SeekOrigin.Begin)
	ByteArray = BR.ReadBytes(intWidth * intHeight)
	BR.Close()
	Dim DXT5_1 As Byte() = {Asc("D"), Asc("D"), Asc("S"), 32, 124, 0, 0, 0, 7, 16, 8, 0}
	Dim DXT5_2(107) As Byte 'We need to fill up the bytes which are not 0
	DXT5_2(1) = 2 : DXT5_2(56) = 2 : DXT5_2(60) = 4 : DXT5_2(89) = 16
	DXT5_2(64) = Asc("D") : DXT5_2(65) = Asc("X") : DXT5_2(66) = Asc("T") : DXT5_2(67) = Asc("5")
	BW.Write(DXT5_1) : BW.Write(intHeight) : BW.Write(intWidth) : BW.Write(DXT5_2)
	BW.Write(ByteArray)
	BW.Close()
	FSHtoDDS = strDDS
End Function
I think you won't be having any trouble converting to vb ;)
 

Users who are viewing this thread

Top