Important information: this site is currently scheduled to go offline indefinitely by end of the year.

Mafia II SDS files?

The Original Forum. Game archives, full of resources. How to open them? Get help here.
Post Reply
bird
ultra-n00b
Posts: 7
Joined: Sun Aug 08, 2010 10:01 am
Has thanked: 3 times
Been thanked: 1 time

Mafia II SDS files?

Post by bird »

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
User avatar
Gocha
veteran
Posts: 109
Joined: Fri Dec 12, 2008 8:16 pm
Location: Batumi, Georgia, GE
Has thanked: 57 times
Been thanked: 9 times
Contact:

Re: Mafia II SDS files?

Post by Gocha »

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
User avatar
Evin
ultra-veteran
ultra-veteran
Posts: 348
Joined: Sat Aug 05, 2006 2:04 pm
Location: Hungary
Has thanked: 2 times
Been thanked: 160 times
Contact:

Re: Mafia II SDS files?

Post by Evin »

Zlbi compressed. So not a big deal.
Ekey
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 1823
Joined: Wed Mar 31, 2010 6:54 am
Has thanked: 92 times
Been thanked: 1058 times

Re: Mafia II SDS files?

Post by Ekey »

The contents of this post was deleted because of possible forum rules violation.
bird
ultra-n00b
Posts: 7
Joined: Sun Aug 08, 2010 10:01 am
Has thanked: 3 times
Been thanked: 1 time

Re: Mafia II SDS files?

Post by bird »

Thanks, but how can I re-compress it again?
User avatar
Gocha
veteran
Posts: 109
Joined: Fri Dec 12, 2008 8:16 pm
Location: Batumi, Georgia, GE
Has thanked: 57 times
Been thanked: 9 times
Contact:

Re: Mafia II SDS files?

Post by Gocha »

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
Rheini
Moderator
Posts: 652
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 46 times
Contact:

Re: Mafia II SDS files?

Post by Rheini »

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.
bird
ultra-n00b
Posts: 7
Joined: Sun Aug 08, 2010 10:01 am
Has thanked: 3 times
Been thanked: 1 time

Re: Mafia II SDS files?

Post by bird »

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.
Rheini
Moderator
Posts: 652
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 46 times
Contact:

Re: Mafia II SDS files?

Post by Rheini »

Well strangely there's some 36(?) byte info between some file data but between others there seems to be no such data.
Ekey
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 1823
Joined: Wed Mar 31, 2010 6:54 am
Has thanked: 92 times
Been thanked: 1058 times

Re: Mafia II SDS files?

Post by Ekey »

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: Select all

/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: Select all

/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 :)
You do not have the required permissions to view the files attached to this post.
WRS
ultra-veteran
ultra-veteran
Posts: 603
Joined: Fri Nov 06, 2009 12:13 am
Has thanked: 74 times
Been thanked: 137 times

Re: Mafia II SDS files?

Post by WRS »

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: Select all

# -- 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:
stgn
ultra-n00b
Posts: 7
Joined: Thu Aug 12, 2010 5:14 pm
Been thanked: 3 times

Re: Mafia II SDS files?

Post by stgn »

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).
WRS
ultra-veteran
ultra-veteran
Posts: 603
Joined: Fri Nov 06, 2009 12:13 am
Has thanked: 74 times
Been thanked: 137 times

Re: Mafia II SDS files?

Post by WRS »

well i'm almost done.

i've attached DEMO_end4.dds from demo_end4.sds (had to scale down so i could upload it).
You do not have the required permissions to view the files attached to this post.
Useful tool links:
stgn
ultra-n00b
Posts: 7
Joined: Thu Aug 12, 2010 5:14 pm
Been thanked: 3 times

Re: Mafia II SDS files?

Post by stgn »

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.
sng
ultra-n00b
Posts: 8
Joined: Thu Aug 12, 2010 5:39 pm
Has thanked: 1 time
Been thanked: 2 times

Re: Mafia II SDS files?

Post by sng »

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: Select all

"#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: Select all

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

Code: Select all

1B 4C 75 61 51 00 01 04 04 04 [08] 00
Post Reply