XeNTaX Forum Index
Forum MultiEx Commander Tools Tools Home
It is currently Sun Jul 22, 2018 5:57 am

All times are UTC + 1 hour


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 159 posts ]  Go to page 1, 2, 3, 4, 5 ... 11  Next
Author Message
 Post subject: Mafia II SDS files?
PostPosted: Tue Aug 10, 2010 12:16 pm 
Offline
ultra-n00b

Joined: Sun Aug 08, 2010 10:01 am
Posts: 7
Has thanked: 3 times
Have thanks: 1 time














You can make the ads go away by registering

Hi!

Anyone succeeded extracting text or other localization related text or data from *.sds files?
I downloaded the demo and I think this sds file could hold some valuable text

Thanks for helping me.
-Bird


Top
 Profile  
 
 Post subject: Re: Mafia II SDS files?
PostPosted: Tue Aug 10, 2010 12:40 pm 
Offline
veteran
User avatar

Joined: Fri Dec 12, 2008 8:16 pm
Posts: 109
Location: Batumi, Georgia, GE
Has thanked: 57 times
Have thanks: 8 times
Yeah, i just came in to open thread about...

So i need to translate the game too, so I need the font file too - texture i guess.


My respects to anyone trying to help, i love you for that ;)

_________________
My great respect and appreciation for them, who research game files! Special thanks to: aluigi, bacter, DerPlaya, Rick, Turfster, twig, Zench. Sorry if someone is missing in my list, I'll update when I'll notice it again


Top
 Profile  
 
 Post subject: Re: Mafia II SDS files?
PostPosted: Tue Aug 10, 2010 12:43 pm 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Sat Aug 05, 2006 2:04 pm
Posts: 329
Location: Hungary
Has thanked: 1 time
Have thanks: 132 times
Zlbi compressed. So not a big deal.


Top
 Profile  
 
 Post subject: Re: Mafia II SDS files?
PostPosted: Tue Aug 10, 2010 2:10 pm 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran

Joined: Wed Mar 31, 2010 6:54 am
Posts: 1623
Has thanked: 61 times
Have thanks: 778 times
The contents of this post was deleted because of possible forum rules violation.


Top
 Profile  
 
 Post subject: Re: Mafia II SDS files?
PostPosted: Tue Aug 10, 2010 2:53 pm 
Offline
ultra-n00b

Joined: Sun Aug 08, 2010 10:01 am
Posts: 7
Has thanked: 3 times
Have thanks: 1 time
Thanks, but how can I re-compress it again?


Top
 Profile  
 
 Post subject: Re: Mafia II SDS files?
PostPosted: Wed Aug 11, 2010 7:03 am 
Offline
veteran
User avatar

Joined: Fri Dec 12, 2008 8:16 pm
Posts: 109
Location: Batumi, Georgia, GE
Has thanked: 57 times
Have thanks: 8 times
okey, compressed file got decompressed - we need a tool for decompressing all of sds files or algorithm or like one how to decompress other ones too.

Second, we need to make it editable, with only decompressed format we can't edit text or other file. :scaredy:

_________________
My great respect and appreciation for them, who research game files! Special thanks to: aluigi, bacter, DerPlaya, Rick, Turfster, twig, Zench. Sorry if someone is missing in my list, I'll update when I'll notice it again


Top
 Profile  
 
 Post subject: Re: Mafia II SDS files?
PostPosted: Wed Aug 11, 2010 4:20 pm 
Offline
Moderator

Joined: Wed Oct 18, 2006 9:48 pm
Posts: 650
Location: Germany
Has thanked: 19 times
Have thanks: 41 times
I think there's more to that. In one file I found a plain xml file at the end and other plain text in between.
So I guess the format supports compression on a per-file basis.

_________________
Image

Remember: If you don't want to program a tool yourself, hack another one :wink:
__________
http://www.gameformats.de.vu


Top
 Profile  
 
 Post subject: Re: Mafia II SDS files?
PostPosted: Wed Aug 11, 2010 8:13 pm 
Offline
ultra-n00b

Joined: Sun Aug 08, 2010 10:01 am
Posts: 7
Has thanked: 3 times
Have thanks: 1 time
Thanks for putting effort into the matter, with Evin's help I found out that there are 117 pieces of compressed zlib files in text_default.sds Since I'm not a programmer I can't figure out the whole mechanism how the file structure handles those separately compressed files.


Top
 Profile  
 
 Post subject: Re: Mafia II SDS files?
PostPosted: Wed Aug 11, 2010 9:17 pm 
Offline
Moderator

Joined: Wed Oct 18, 2006 9:48 pm
Posts: 650
Location: Germany
Has thanked: 19 times
Have thanks: 41 times
Well strangely there's some 36(?) byte info between some file data but between others there seems to be no such data.

_________________
Image

Remember: If you don't want to program a tool yourself, hack another one :wink:
__________
http://www.gameformats.de.vu


Top
 Profile  
 
 Post subject: Re: Mafia II SDS files?
PostPosted: Wed Aug 11, 2010 11:27 pm 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran

Joined: Wed Mar 31, 2010 6:54 am
Posts: 1623
Has thanked: 61 times
Have thanks: 778 times
Rheini wrote:
I think there's more to that. In one file I found a plain xml file at the end and other plain text in between.
So I guess the format supports compression on a per-file basis.

Indeed. Everyone SDS contains some files which compressed with zlib

Examples :
m05main.sds contained LuaQ files (compiled lua scripts - 5.x ?)

Code:
/scripts/missions/M05Main/M05ListOfParts.lua
/scripts/missions/M05Main/M05MainScript.lua
/scripts/missions/M05Main/M05Saves.lua
/missions/M05Main/scriptname.txt


1 file offset start - 000031D6
2 file offset start - 00008C49
3 file offset start - 0000EEF9

m05waytoelgreco.sds

Code:
/scripts/missions/M05WayToElGreco/SpawnPoliceCars.lua
/scripts/missions/M05WayToElGreco/SpawnPoliceCars2.lua
/scripts/missions/M05WayToElGreco/SpawnPoliceCars3.lua
/scripts/missions/M05WayToElGreco/WayToElGrecoPolice.lua
/scripts/missions/M05WayToElGreco/Script/M05PoliceChase.lua
/scripts/missions/M05WayToElGreco/Script/WayTimer.lua


1 file offset start - 00007E8E
2 file offset start - 0000BDC4
3 file offset start - 0000BE4A
4 file offset start - 0000F3B4
5 file offset start - 0000FCBC
6 file offset start - 00010014

See attached file, mb who can can extract from there files :)


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: Mafia II SDS files?
PostPosted: Thu Aug 12, 2010 6:04 pm 
Offline
ultra-veteran
ultra-veteran

Joined: Fri Nov 06, 2009 12:13 am
Posts: 595
Has thanked: 72 times
Have thanks: 132 times
spent a little bit of time reversing some of the headers. the plaintext xml is for the engine to allocate memory (see the first header).

zlib data looks chunked. haven't yet bothered splitting up the files.

edit: haven't read the latest post - will download these new attachments now!

Code:
# -- WRS
#    xentax.com
#    .sds BMS script (wip)

print "WARNING: THIS SCRIPT WILL NOT DUMP ANYTHING YET (WIP)"

idstring "SDS\x00"

goto 16

### Part of the header

get P_RES long
get P_DATA long
get P_XML long
get TOT_RAM long # sum of all ram usage (see xml)
get TOT_VRAM long # sum of all vram usage (see xml)

###

get xmlsize asize
math xmlsize -= P_XML

log "sds_desc.xml" P_XML xmlsize


goto 64

### Res info

get RES_COUNT long
get UNKNOWN long
get RES_TYPES long

for i = 1 to RES_TYPES

  get RES_INDEX long
  get RES_NAME_sIZE long

  math RES_NAME_sIZE += 4 # padded byte
  getdstring RES_NAME RES_NAME_SIZE

  print "%RES_NAME%"

next i

### zlib data

goto P_DATA # will already be here


getdstring UNKNOWN 30 # some sort of header

set chunkcnt long 0

for

  get CHUNK_SIZE long

  if CHUNK_SIZE == 0

    print "Chunks found: %chunkcnt%"
    cleanexit

  endif

  get FLAG byte

  if FLAG == 0

    getdstring UNKNOWN 11

    ## zlib data is here

    savepos DATASTART

    ## todo: clog to memory_file, append result to result
    math DATASTART += CHUNK_SIZE

    goto DATASTART

  else

    get UNKNOWN long
    get SKIP long

    savepos SKIPVAL

    math SKIPVAL += SKIP
    math SKIPVAL -= 8

    goto SKIPVAL

    savepos DATASTART

    ## todo: clog to memor_file, append result to result
    math CHUNK_SIZE -= SKIP
    math DATASTART += CHUNK_SIZE

    goto DATASTART

  endif

  math chunkcnt += 1

next

_________________
Useful tool links:


Top
 Profile  
 
 Post subject: Re: Mafia II SDS files?
PostPosted: Thu Aug 12, 2010 6:53 pm 
Offline
ultra-n00b

Joined: Thu Aug 12, 2010 5:14 pm
Posts: 7
Has thanked: 0 time
Have thanks: 3 times
the lua files are, more specifically, compiled lua 5.1 scripts. their magic is actually "[0x1b]Lua", not "LuaQ". the "Q" is actually the version (0x51 -> 5.1).


Top
 Profile  
 
 Post subject: Re: Mafia II SDS files?
PostPosted: Thu Aug 12, 2010 7:56 pm 
Offline
ultra-veteran
ultra-veteran

Joined: Fri Nov 06, 2009 12:13 am
Posts: 595
Has thanked: 72 times
Have thanks: 132 times
well i'm almost done.

i've attached DEMO_end4.dds from demo_end4.sds (had to scale down so i could upload it).


Attachments:


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


_________________
Useful tool links:


Top
 Profile  
 
 Post subject: Re: Mafia II SDS files?
PostPosted: Thu Aug 12, 2010 8:16 pm 
Offline
ultra-n00b

Joined: Thu Aug 12, 2010 5:14 pm
Posts: 7
Has thanked: 0 time
Have thanks: 3 times
mafia ii appears to use a modified lua vm. first obvious sign i could find is that it uses single-precision floats for numbers instead of double according to compiled lua headers. i compiled a custom version of luadec to handle this but i'm still getting errors like "unexpected end in precompiled chunk" or "memory allocation error: block too big", which suggest that there might be more going on.


Top
 Profile  
 
 Post subject: Re: Mafia II SDS files?
PostPosted: Thu Aug 12, 2010 8:18 pm 
Offline
ultra-n00b

Joined: Thu Aug 12, 2010 5:39 pm
Posts: 8
Has thanked: 1 time
Have thanks: 2 times
I'm trying to decompile the file M05ListOfParts.luac taken from the file "pc\sds\missionscript\m05main.sds".

I use LuaDec51, but get an error "bad header in precompiled chunk".
Having sorted out, I realized that the error here: (luaconf.h)
Code:
"#define LUA_NUMBER double"

I changed it to 8, but a new error "bad constant in precompiled chunk".
I understand, they use a modified Lua script. Am I right?

Mafia Lua Header:
Code:
1B 4C 75 61 51 00 01 04 04 04 [04] 00


Lua Header v5.1:
Code:
1B 4C 75 61 51 00 01 04 04 04 [08] 00


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 159 posts ]  Go to page 1, 2, 3, 4, 5 ... 11  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group