Page 1 of 1
Order of Magic Online
Posted: Mon Mar 14, 2011 10:27 pm
by Ekey
Hey guys

Need help with PAK file's.. Example file attached.
Thanks advance

Re: Order of Magic Online
Posted: Tue Mar 15, 2011 12:23 pm
by aluigi
the initial part is simple, the rest instead looks like a sequence of compressed chunks of an unknown algorithm or encrypted+zlib
Re: Order of Magic Online
Posted: Tue Jul 03, 2012 6:38 pm
by Ekey
Oh T_T necroposting
here algo
Code: Select all
typedef unsigned char _BYTE;
void Decrypt(int a1, int a2, int a3)
{
int v4;
unsigned __int8 i;
int v6;
char v7;
v4 = 0;
for ( i = 115; v4 < a2; *(_BYTE *)v6 = i ^ v7 )
{
v6 = v4 + a3;
i = (i >> 7) + 2 * i;
v7 = *(_BYTE *)(v4 + a3 + a1 - a3) ^ (v4 + v4 / 0xFFu);
++v4;
}
}
a1 - buffer
a2 - size
a3 - destbuffer
attached source for testing

Re: Order of Magic Online
Posted: Tue Jul 03, 2012 7:15 pm
by aluigi
*full script available in the next posts*
Re: Order of Magic Online
Posted: Tue Jul 03, 2012 7:26 pm
by Ekey
Yep cuted chunks for test from pak file.
db.pak
Code: Select all
- select the output folder where extracting the files
- open input file D:\Order of Magic\Data\db.pak
- open script D:\OM.bms
- set output folder D:\EXTTEST\
offset filesize filename
------------------------------
Error: incomplete input file number 0, can't read 423487 bytes.
anyway don't worry, it's possible that the BMS script has been written
to exit in this way if it's reached the end of the archive so check it
or contact its author or verify that all the files have been extracted
Press RETURN to quit
for all other paks
Code: Select all
- select the BMS script or plugin to use
- select the input archives/files to extract, type "" for whole folder and subfo
lders
- select the output folder where extracting the files
- open input file D:\Order of Magic\Data\shaders.pak
- open script D:\OM.bms
- set output folder D:\EXTTEST\
offset filesize filename
------------------------------
- the script has requested to load a function from the dll
MEMORY_FILE3
do you want to continue (y/N)? y
- library MEMORY_FILE3 loaded at address 042D0000
- function found at offset 042D0000
crashed and VS tiggered JIT Debugger.
Re: Order of Magic Online
Posted: Wed Jul 04, 2012 12:30 pm
by aluigi
I have rechecked db.pak but the index table doesn't leave doubts: OFFSET followed by SIZE.
so my only hypothesis at the moment is that the content of the archive is a divided in compressed chunks (so just the archive and not the single files as I thought).
I'm trying to make some tests.
oh I forgot "putvarchr MEMORY_FILE2 SIZE 0" in my script
Re: Order of Magic Online
Posted: Wed Jul 04, 2012 1:02 pm
by aluigi
Re: Order of Magic Online
Posted: Wed Jul 04, 2012 3:47 pm
by Ekey
Hehe good job
for db work fine. for all other ->
Code: Select all
- the script has requested to load a function from the dll
MEMORY_FILE3
do you want to continue (y/N)? y
- library MEMORY_FILE3 loaded at address 0B6E0000
- function found at offset 0B6E0000
Error: the compressed LZO input is wrong or incomplete (-6)
Error: there is an error with the decompression
the returned output size is negative (-1)
Re: Order of Magic Online
Posted: Wed Jul 04, 2012 4:21 pm
by aluigi
can you send me one of these files?
I guess I swapped the ZIP field with another or maybe there is something else to do
Re: Order of Magic Online
Posted: Wed Jul 04, 2012 7:20 pm
by aluigi
fixed, was exactly that thing: ZIP field and DUMMY
oh well, I had 50/50 of success :)
Re: Order of Magic Online
Posted: Wed Jul 04, 2012 7:35 pm
by Ekey
So new script for all pak's work fine. Thanks

Re: Order of Magic Online
Posted: Wed Jul 04, 2012 9:44 pm
by chrrox
Re: Order of Magic Online
Posted: Wed Jul 04, 2012 11:16 pm
by Ekey
Yep
Re: Order of Magic Online
Posted: Thu Jul 05, 2012 12:24 am
by chrrox
can you make this file not use a memory file luigi?
it wants over 1gb of free memory to work with on one file.
Re: Order of Magic Online
Posted: Thu Jul 05, 2012 8:17 am
by aluigi
I have fixed the original script so that now it's a lot faster and uses less resources (I forgot the classical "putvarchr MEMORY_FILE4 TMP 0").
if you want the temporary file solution:
http://aluigi.org/papers/bms/order_magi ... _noram.bms