Important Message

You are browsing the archived Lancers Reactor forums. You cannot register or login.
The content may be outdated and links may not be functional.


To get the latest in Freelancer news, mods, modding and downloads, go to
The-Starport

I need VB Code for a server op

Advertise for Modelers, Programmers, Webmasters, INI Editors, Script Experts, Adventurers, Servers, or anything that has to do with a project

Post Wed Nov 17, 2004 1:23 pm

I need VB Code for a server op

I really need help what i am looking for is a bit of code i can use in VB, i need to know how to declare the function from the Flik Codec DLL and also how to make changes in it from within a program my aim is to finish where Joe Left off so we can still get high quality server ops going around, basically what i am asking for is a tutorial

Post Sun Nov 28, 2004 9:51 am

If by "Flik Codec" you mean the flcodec.dll, then here's how I do it in a class I've put together for portable use. THis SHOULD work as copy-paste code in a VB6 app; you may want to remove the "Public Enum FlCodecErrors" and turn the stuff inside into constants if you're handling all of it inside your own application.

<pre><font size=1 face=Courier>

Option Explicit

Private Declare Function flcodec Lib "flcodec" _
(ByVal codecFlag As Long, ByVal sourcePath As String, _
ByVal targetPath As String) As Long

' flcodec flags
Private Const FLCODEC_DECODE = &H1
Private Const FLCODEC_ENCODE = &H2

' flcodec return errors; made into a public enum for easier use from
' non-latebound COM clients.
Public Enum FlCodecErrors
FLCODECERR_OK = 0
FLCODECERR_FILEOPENFAILED = &H100
FLCODECERR_MEMORYALLOCFAILED = &H101
FLCODECERR_FILEREADFAILED = &H102

' integer 259; happens if the target file cannot be created.
' One cause is a bogus filename.
FLCODECERR_FILECREATEFAILED = &H103
FLCODECERR_FILEWRITEFAILED = &H104
FLCODECERR_INVALIDARGUMENT = &H105

' integer 262; the source file name is bad.
FLCODECERR_INVALIDFILENAME = &H106

'263 integer; this isn't an encoded savegame file.
FLCODECERR_NOTFLS1FILE = &H107
End Enum

Public Property Get LastCodecError() As Long
LastCodecError = MyLastCodecError
End Property


Public Function DecodeSaveGame(ByVal sourcePath As String, _
ByVal targetPath As String) As Boolean
MyLastCodecError = flcodec(FLCODEC_DECODE, sourcePath, targetPath)
If MyLastCodecError = 0 Then
DecodeSaveGame = True
Else
DecodeSaveGame = False
End If
End Function


Public Function EncodeSaveGame(ByVal sourcePath As String, _
ByVal targetPath As String) As Boolean
MyLastCodecError = flcodec(FLCODEC_ENCODE, sourcePath, targetPath)
If MyLastCodecError = 0 Then
EncodeSaveGame = True
Else
EncodeSaveGame = False
End If
End Function

</font></pre>

For this to work, flcodec just needs to be accessible to your application; the best method IMO is to stick it in the same folder as your app. There are possible side effects to trying to place it in the system32 folder.

Return to Help Wanted/Available Section