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

*request* attn: c coders

The general place to discuss MOD''ing Freelancer!

Post Thu Mar 13, 2003 4:19 am

*request* attn: c coders

I may have found (not 100%) what format the scripts (thn files) have. Looks like Lua Scripting Language in precompiled form. This Lua thing is open source, btw. I tried reading thn files with interpreter but get the error "file too old". (the game was too long in development. LOL ) Can anybody take a look and confirm? Possibly find a way to decompile thn back to ascii script format.

Lua and all stuff can be found here: http://www.lua.org

Post Thu Mar 13, 2003 7:16 am

You are right, they are Lua script files, we need to find a way into these files. Hope someone can figure it out.

HCl

Post Thu Mar 13, 2003 2:29 pm

I can confirm that, thn files are Lua bytecode (appear to be version 4.0 iirc... made some preliminary research on thn some time back). It should be possible to convert the bytecode back to Lua source code with some work... Fortunately the source of the Lua interpreter is available, which would help in this effort. If anyone decides to work on these in detail, let us know of your progress

Post Thu Mar 13, 2003 7:44 pm

Hehe, HCl, looks like you've been a busy bee... (figuring out every file and such)
The interpreter I have installed now says "file too old. found version 3.2, at least version 4.0 is expected" ). So, I went searching web for older version 3.2 but it is nowhere to find. (damn). Some one needs to get lua source and remake it so it reads old files too.


Edited by - XLancer on 13-03-2003 19:43:56

HCl

Post Fri Mar 14, 2003 12:00 am

Hehe well before doing any detailed research, i like to look around a bit on several areas, to see what could be more interesting to work on first

After reviewing my notes, you're right: Lua bytecodes are of version 3.2, not 4.0 . My memory was playing tricks on me because i got the exact same error as you on my tests! (the "too old" error) However, i was able to track down a 3.2 interpreter, and ran into another error:


$ bin/lua ../m01a_01.thn
lua error: unexpected type in arithmetic operation
Active Stack:
main of string `'


Afterwards, i decided to work on documenting the INI compression instead, and haven't picked it up ever since. The 3.2 interpreter seems like a sensible place to start research tho. If you can't track down a copy of the 3.2 interpreter on the net (can't remember where i downloaded it from), i'll be glad to upload it to a temp directory somewhere. This seems to be very interesting research

Edited by - HCl on 14-03-2003 00:01:10

Post Fri Mar 14, 2003 3:49 am

Hi,

The 3.2 release can be found on lua.org in the download section. Click on the mirrors. All mirrors carry any previous versions that was released. To compile the source I used cygwin's make utility. Upon trying to interpret the code with lua.exe I got the same error message as Hcl. Using the compiler with the -u argument I got a dump of the bytecode. Looks very cryptic. I tried compiling a simple lua source file and looking at the bytecode in a hex editor it seems like the variable names are retained in the bytecode file but does not display during the dump. The prospect of recontructing sensible code looks very promising. I'll dig into the source when I have more time. Btw, it looks like the thn files contain camera angle descriptions. New in-game movies any one? I'll keep you guys posted on my progress.

BoarK

Post Fri Mar 14, 2003 2:40 pm

All of scripts in I've checked in the SCRIPTS dir so far describe animations of characters and the cutscenes (light attributes, camera attributes, etc).

Just do a "luac -u" to a .thn file and check it out.

The really interesting stuff appears to be in content.dll - I suppose if one studies that in relation to it's dependancies and the functions, etc it adheres to one could try and make a "compatible" loadable .dll (see the SDK thread for such an ongoing effort).

Edited by - taquinvol on 14-03-2003 14:42:22

Return to Freelancer General Editing Forum