XeNTaX Forum Index
Forum MultiEx Commander Tools Tools Home
It is currently Sun Oct 21, 2018 3:16 pm

All times are UTC + 1 hour


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 15 posts ] 
Author Message
 Post subject: Lords Of The Fallen (*.PKG)
PostPosted: Thu Oct 30, 2014 7:51 pm 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran

Joined: Wed Mar 31, 2010 6:54 am
Posts: 1627
Has thanked: 61 times
Have thanks: 784 times














You can make the ads go away by registering

Unpacker

About hashes - I have pirated game version but is not working. Unfortunately I do not know which algorithm is used. In game library i found 2 hash function djb2 and sdbm but no good results. Who knows? :(


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.



Top
 Profile  
 
 Post subject: Re: Lords Of The Fallen (*.PKG)
PostPosted: Fri Jan 09, 2015 12:38 am 
Offline
advanced

Joined: Tue Oct 28, 2014 7:51 am
Posts: 53
Has thanked: 3 times
Have thanks: 4 times
That's cool, i was curious about LOTF since a while.
I also found Quick BMS script which does about the same as your tool but extracts .dat files from the PKG.

I hope someone will try and chew through file formats, because at the bottom game seems to use pretty straightforward formats, plus anything in patch folder will override packages, so modding is a real possibility here.


Top
 Profile  
 
 Post subject: Re: Lords Of The Fallen (*.PKG)
PostPosted: Fri Jan 09, 2015 1:09 am 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran

Joined: Wed Mar 31, 2010 6:54 am
Posts: 1627
Has thanked: 61 times
Have thanks: 784 times
SkacikPL wrote:
That's cool, i was curious about LOTF since a while.
I also found Quick BMS script which does about the same as your tool but extracts .dat files from the PKG.

I hope someone will try and chew through file formats, because at the bottom game seems to use pretty straightforward formats, plus anything in patch folder will override packages, so modding is a real possibility here.

My tool unpack the same files that QuickBMS, just without extensions ;)


Top
 Profile  
 
 Post subject: Re: Lords Of The Fallen (*.PKG)
PostPosted: Fri Jan 09, 2015 2:37 am 
Offline
advanced

Joined: Tue Oct 28, 2014 7:51 am
Posts: 53
Has thanked: 3 times
Have thanks: 4 times
Ekey wrote:
SkacikPL wrote:
That's cool, i was curious about LOTF since a while.
I also found Quick BMS script which does about the same as your tool but extracts .dat files from the PKG.

I hope someone will try and chew through file formats, because at the bottom game seems to use pretty straightforward formats, plus anything in patch folder will override packages, so modding is a real possibility here.

My tool unpack the same files that QuickBMS, just without extensions ;)

Though, different question is whether there is a way to get what's inside unpacked files.


Top
 Profile  
 
 Post subject: Re: Lords Of The Fallen (*.PKG)
PostPosted: Mon Oct 08, 2018 8:35 am 
Offline
n00b

Joined: Thu May 19, 2016 11:23 pm
Posts: 12
Location: Italy
Has thanked: 1 time
Have thanks: 0 time
Nothing new?
I'd still like to fix some Italian texts in this game. There's no need of repacker: you can just put files in "patch\" but they won't work if you alter just a single byte!
The problem is understanding that number block in blue:
Image
From a comparision between the French.bin and Italian.bin (see msg here with attachments) the first block is the same: FC89C5A3, next 4 bytes change between languages… If we understand that we should be able to edit the text and use it in the game simply putting the modified .bin under "...\Lords Of The Fallen\bundles\patch", skipping the unnecessary repack process.


Top
 Profile  
 
 Post subject: Re: Lords Of The Fallen (*.PKG)
PostPosted: Mon Oct 08, 2018 6:01 pm 
Offline
ultra-veteran
ultra-veteran

Joined: Mon Oct 27, 2008 12:11 am
Posts: 405
Location: Slovakia
Has thanked: 35 times
Have thanks: 112 times
Can you upload/send me your modified .bin file? I don't have the game, so I can't test my script for recalculating the hash.


Top
 Profile  
 
 Post subject: Re: Lords Of The Fallen (*.PKG)
PostPosted: Mon Oct 08, 2018 7:05 pm 
Offline
n00b

Joined: Thu May 19, 2016 11:23 pm
Posts: 12
Location: Italy
Has thanked: 1 time
Have thanks: 0 time
merlinsvk wrote:
Can you upload/send me your modified .bin file? I don't have the game, so I can't test my script for recalculating the hash.

You have PM


Top
 Profile  
 
 Post subject: Re: Lords Of The Fallen (*.PKG)
PostPosted: Mon Oct 08, 2018 7:25 pm 
Offline
n00b

Joined: Thu May 19, 2016 11:23 pm
Posts: 12
Location: Italy
Has thanked: 1 time
Have thanks: 0 time
Attached some .bin files (original, unmodified). If you need more language files tell me...
https://nofile.io/f/aS3AAYoZTva/languages_bin.7z


Top
 Profile  
 
 Post subject: Re: Lords Of The Fallen (*.PKG)
PostPosted: Tue Oct 09, 2018 4:19 pm 
Offline
ultra-veteran
ultra-veteran

Joined: Mon Oct 27, 2008 12:11 am
Posts: 405
Location: Slovakia
Has thanked: 35 times
Have thanks: 112 times
Code:
#------------------------------------------------
# Lords Of The Fallen language *.bin CRC fixer
# Script version: 0.2
#------------------------------------------------
idstring "\xFC\x89\xC5\xA3"      # just a test if the input file is a supported .bin file

encryption crc 0x01800063 "32 0 0 19 1 1"
get SIZE asize
xmath TXTSIZE "SIZE - 0x18"      # 0x18 = size of header
log MEMORY_FILE 0x18 TXTSIZE   # 0x18 = start of the data block
encryption "" ""

get NAME basename
get EXT extension
string NAME p= "%s.%s_FIXED" NAME EXT
get SIZE asize
log MEMORY_FILE2 0 SIZE                     # create copy of file into RAM
putVarChr MEMORY_FILE2 0x04 QUICKBMS_CRC long   # write new CRC value on position 0x04
putVarChr MEMORY_FILE2 0x14 TXTSIZE long      # write text block size
log NAME 0 SIZE MEMORY_FILE2               # write new file on disk


EDIT: Updated script. Now it also recalculates the size of "text block".


Last edited by merlinsvk on Wed Oct 10, 2018 4:47 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Lords Of The Fallen (*.PKG)
PostPosted: Tue Oct 09, 2018 6:09 pm 
Offline
n00b

Joined: Thu May 19, 2016 11:23 pm
Posts: 12
Location: Italy
Has thanked: 1 time
Have thanks: 0 time
merlinsvk wrote:
Code:
#------------------------------------------------
# Lords Of The Fallen language *.bin CRC fixer
#------------------------------------------------
idstring "\xFC\x89\xC5\xA3"      # just a test if the input file is a supported .bin file

encryption crc 0x01800063 "32 0 0 19 1 1"
get SIZE asize
math SIZE - 0x18              # 0x18 = size of header
log MEMORY_FILE 0x18 SIZE      # 0x18 = start of the data block
encryption "" ""

get NAME basename
get EXT extension
string NAME p= "%s.%s_FIXED" NAME EXT
get SIZE asize
log MEMORY_FILE2 0 SIZE                     # create copy of file into RAM
putVarChr MEMORY_FILE2 0x04 QUICKBMS_CRC long   # write new CRC value on position 0x04
log NAME 0 SIZE MEMORY_FILE2               # write new file on disk


Use this script on language .bin file. It will create new file with "_FIXED" extension.
Rename it and put the fixed file into \patch folder.


:o

It does work!
It seems I can finally be able to fix broken Italian text! :dance:
Thank you very much!

Can I ask one more thing? As you can see in the picture above with hex-editor starting from byte 18->end is reported (red square in the pic) the size of the whole text block in reverse order. Could you automate also that part and improve the script?


Top
 Profile  
 
 Post subject: Re: Lords Of The Fallen (*.PKG)
PostPosted: Tue Oct 09, 2018 6:16 pm 
Offline
ultra-veteran
ultra-veteran

Joined: Mon Oct 27, 2008 12:11 am
Posts: 405
Location: Slovakia
Has thanked: 35 times
Have thanks: 112 times
And how do you want to edit this text? By hand in hex editor?

EDIT: There has to be something else (a mean some length check or another hash) because, when I make single string bigger, recalculate the length of that string, recalculate text block size and CRC, some strings in the game are missing.

Image


Top
 Profile  
 
 Post subject: Re: Lords Of The Fallen (*.PKG)
PostPosted: Tue Oct 09, 2018 8:07 pm 
Offline
n00b

Joined: Thu May 19, 2016 11:23 pm
Posts: 12
Location: Italy
Has thanked: 1 time
Have thanks: 0 time
Indeed there are more string checks:
Image
The red square byte (0x98) defines the length of the string…
BUT, there is still a problem: if I make it shorter (e.g. 95), and I turn 98->95 it still won't work, unless I replace extra bytes (since I shortened the string) with 0x00 keeping file structure (and length) intact :(
Maybe we have to respect some bytes alignment when we extend/shorten strings.


Top
 Profile  
 
 Post subject: Re: Lords Of The Fallen (*.PKG)
PostPosted: Tue Oct 09, 2018 9:19 pm 
Offline
ultra-veteran
ultra-veteran

Joined: Mon Oct 27, 2008 12:11 am
Posts: 405
Location: Slovakia
Has thanked: 35 times
Have thanks: 112 times
Quote:
Maybe we have to respect some bytes alignment when we extend/shorten strings.


Yes, exactly. That's padding. When I added one NULL byte after my test string, all missing text was back.
But that means, you will need proper tool to recalculate all paddings and lengths. Or it will be nightmare to do it all manually.


Top
 Profile  
 
 Post subject: Re: Lords Of The Fallen (*.PKG)
PostPosted: Tue Oct 09, 2018 9:37 pm 
Offline
n00b

Joined: Thu May 19, 2016 11:23 pm
Posts: 12
Location: Italy
Has thanked: 1 time
Have thanks: 0 time
merlinsvk wrote:
Quote:
Maybe we have to respect some bytes alignment when we extend/shorten strings.


Yes, exactly. That's padding. When I added one NULL byte after my test string, all missing text was back.
But that means, you will need proper tool to recalculate all paddings and lengths. Or it will be nightmare to do it all manually.


Indeed it works as I supposed.
When I manually "pad" them (thanks for the term, didn't know how to call it ;)) I can safely change strings length, as explained in the picture below.
E.g.:
Image
I can extend/shrink the text in the cyan rectangle (even colliding the red rectangle) but then I must always add this padding at the end: 0x00000000 80000000 respecting 4bytes+4bytes and, in case, adjusting with null bytes the string length.

Yep, would be great if your script would automagically do:
- recalculate final block length (written in reverse order into the bin)
- add padding correction
- recalculate strings length (the byte before the string itself)

EDIT: there is also the padding variant 0x00000001 80000000 used after dialogue strings...


Last edited by hexaae on Wed Oct 10, 2018 8:17 am, edited 6 times in total.

Top
 Profile  
 
 Post subject: Re: Lords Of The Fallen (*.PKG)
PostPosted: Tue Oct 09, 2018 9:42 pm 
Offline
ultra-veteran
ultra-veteran

Joined: Mon Oct 27, 2008 12:11 am
Posts: 405
Location: Slovakia
Has thanked: 35 times
Have thanks: 112 times
I think that repacker/converter from .bin to .txt and back would be better. My script is only for the final stage - CRC fixing.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group