Page 1 of 1

Multiple LuaQ files help

Posted: Fri Mar 13, 2020 5:24 am
by brownyfifa
Hi all,

Looking to get some help to extract the linked file below , could it be done in quickbms?

The file header is LuaQ , which is a compiled version of a lua file.

However there are multiple LuaQ file headers throughout the file, so I believe this is why I cannot decompile these using LuaDec or unluac .

Would anyone be able to write a bms file that would extract this bin archive in to the multiple LuaQ files ? I am a novice to unpacking scripts so it would be much appreciated. Hoping it's a straight forward file as it has file names in clear text.

That should allow me to decompile the individual luac files

https://filebin.net/2ufaby8a5r7rcpnq

Re: Multiple LuaQ files help

Posted: Sat Mar 14, 2020 12:03 am
by brownyfifa
So I have gotten further with this.

It appears like the file starts with a 12 byte header
then 3 null bytes in a row
then a name size


however with my limited bms knowledge now I need to know the filesize and offset. From doing some research, it seems that these are stored in a seperate file (attached)

How the hell do I find the filesize and offsets for these files in that file ? It looks completely random. Also is it possible to reference them in quickbms or would I just manually input all the filesize and offsets per file (tedious but ill do whatever required)

Would appreciate any help available

My current script goes like this (first time)

get FILES Long
for i=0 < FILES
get HEADER1 long
get HEADER2 long
get null short
get null byte
get NSIZE byte
getdstring NAME NSIZE

##find filesize and offset from other .bin file##

Re: Multiple LuaQ files help

Posted: Sat Mar 14, 2020 9:39 am
by shakotay2
print out your files count (print "number of files %FILES%")
surprise! :D

Anyways I have a deja vue of a (general) bms filesplitter, but can't find it.

So I made one in 'C', which splits before "LuaQ", here's the first 4 resulting files.
You may check them. In case it works I could send you the tool.
.
LuaQ.zip
btw: used simple file numbering ("1","2","3") because of the weird pathnames.
r:\resources\luascripts\common\\achievementtable.lua for example.
(It's so annoying. Else I use one or two slashes but not mixed, never. (: )

You could, of course, read the path 'till the first double slash, create that directory, read the rest of the path (lua filename) and log that file then.
Don't have the time for such...

Re: Multiple LuaQ files help

Posted: Sun Mar 15, 2020 12:36 am
by brownyfifa
Hey mate,

That is legendary thanks. Really appreciate the help.

Are you able to run that program on the whole archive (im not stressed about the file names) so I can test it properly?

Re: Multiple LuaQ files help

Posted: Sun Mar 15, 2020 12:51 am
by brownyfifa
Hey Shatokay2,

I might not need to reinvent the wheel here. I found a program on the net that uses C# to perform this process, however it does it from the .fchunk archive.

Ran into a problem with it though, it supports big endian archive decompiling (using --big) however it doesn't support big endian recompiling.

I've attached the software and an example of an fchunk.

Just based on your knowledge, how long would it take me to learn C# enough to understand this program and add big endian recompiling support? I work in IT but have little programming knowledge outside what I did at college. I had a look at it in VB2019 and it does look relatively complicated. I'm wondering if I just go through and try to understand only the commands in this program, or actually try to learn C# ground up.

Re: Multiple LuaQ files help

Posted: Sun Mar 15, 2020 12:54 am
by brownyfifa

Re: Multiple LuaQ files help

Posted: Sun Mar 15, 2020 9:31 am
by shakotay2
brownyfifa wrote: Sun Mar 15, 2020 12:36 amAre you able to run that program on the whole archive (im not stressed about the file names) so I can test it properly?
Hey brownyfifa,
having 496 .lua files in one folder? (You will hate it! :D ) (I could replace the drive letter "r:" in the path at the beginning of the files by "c:" in case it helps)
.
LuaQ-split.zip

brownyfifa wrote: Sun Mar 15, 2020 12:51 amI'm wondering if I just go through and try to understand only the commands in this program
Interesting thought. :D (Could work in case you know 'C' for example.)
Just based on your knowledge, how long would it take me to learn C# enough to understand this program and add big endian recompiling support? I work in IT but have little programming knowledge outside what I did at college. I had a look at it in VB2019 and it does look relatively complicated.
Depends on what you learned at college so far. Did you ever compile a (Visual)Basic, a C#, a 'C' or 'C++' program?
If 'no', then you have a long road to go. Not a matter of 3 weeks, I guess.

Anyways, you might have a look here: https://stackify.com/learn-c-sharp-tutorials/

Or here (no ads!):
C# Tutorial - Full Course for Beginners
https://www.youtube.com/watch?v=GhQdlIFylQ8

This is some very valuable comment, imho:
Richard James Andersen
"After browsing other videos for beginners, I should note that a few important things were left out that should have been included:
[...]
7) Where do go after this video? I would highly recommend C# Tutorial for beginners by ProgrammingKnowledge (the video is 5h 37min long)."

Guess, he means this one (with ads):
https://www.youtube.com/watch?v=KVr8NTZ ... dex=6&t=0s

Re: Multiple LuaQ files help

Posted: Mon Mar 16, 2020 10:03 pm
by shakotay2
brownyfifa wrote: Sun Mar 15, 2020 12:54 am Files are below
Where is the DSCript project?

Couldn't find it in the web, only DScript (https://github.com/bizzehdee/DScript), which doesn't seem to be the required one.

Re: Multiple LuaQ files help

Posted: Tue Mar 17, 2020 3:04 am
by brownyfifa
Hi Shakotay,

Thanks very much for your help. Looks like I won't need to learn C, I was able to modify the values I needed to by hex editing the f chunk file itself, without even needing to decompile.

Much appreciated.

Re: Multiple LuaQ files help

Posted: Tue Mar 17, 2020 8:34 am
by shakotay2
Hi brownyfifa,

great! :)

But where do I get the DSCript project?
It's not a package only - the LuaSF solution requires a DSCript.csproj.
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DSCript", "..\DSCript\DSCript.csproj", "{09C8AA4A-AFB8-4BDB-866B-B8C88D48D9EB}"

(It's not in the zip you've uploaded - there's only libDSC.dll.)

edit: got it compiled by adding libDSC.dll as a reference. But the exe crashes when dropping ps3split.fchunk onto it.
Where did you get the LuaSF from? (author is CarLuver69 as it seems)

Re: Multiple LuaQ files help

Posted: Wed Mar 18, 2020 2:10 pm
by brownyfifa
https://filebin.net/cs9k030b8iu9jh03

above is the DCScript project

will need to use the --big argument on the fchunk otherwise it won't work.

Re: Multiple LuaQ files help

Posted: Wed Mar 18, 2020 7:58 pm
by shakotay2
Thanks! finally I got the LuaSF project compiled and working with ps3split.fchunk - but I had to use libDSC.dll from 2016 ).

Re: Multiple LuaQ files help

Posted: Wed Mar 18, 2020 11:15 pm
by brownyfifa
haha awesome! Unfortunately it doesn't support big endian compiling :( Would make modding a lot more flexible.

Re: Multiple LuaQ files help

Posted: Thu Mar 19, 2020 8:51 am
by shakotay2
The problem with little endian/bigendian files is as this (from my experience):
you need a FULL format analysis, because you can't just "swap bytes".

Say, you've a little endian file (14 bytes) like 3412 99EFCDAB 0600 58454E544158. (last 6 bytes in ASCII: "XENTAX")
Could be word, DWORD, strlen word, string (6 bytes).

In big endian it's 1234 ABCDEF99 0006 58454E544158.

But what if the little endian file is meant to be DWORD, word, strlen word, string (6 bytes)?
And you need to know where the string(s) to start.
So the analysis part of code which can handle the little endian file has to be rewritten on the base of the analysis to handle big endian.