Jump to content

Recommended Posts

Posted (edited)
Quote

 

The initial discussion of this thread was done in zenhax

I linked the original topic from zenhax

This post completed the early preliminary research on this game, and at that time, the extraction of files was basically implemented.

In order to make the post more practical and give more topics to discuss, I will set the topic of this post as a Messiah engine file format research, which can discuss more Messiah-related games, not just for ace racer

During these times, the engine version has been upgraded many times, and the index table has been updated. Now the hash names of some games have been encrypted in the index table. The index table of each game is basically the same, but it is different. As far as I know, there should be more than three different versions of the index table.

1. Index Version 1

If they have not been updated, these indexes should be the earliest version, without any fiddling, and are also the easiest version to study. You can use netease_mpk_v2.bms to disassemble it

//Some new games still use these initial index versions, but have added new compression formats. If you are familiar with bms scripts or python scripts, you can add decompression by yourself, and others remain unchanged

2. Index version 2

The index of this structure is still very simple, but the file name seems to have been specially processed, and normal file names will not be generated in the index. Under the same version of the index, the number of bytes used by different games is also different.

Some games take up 20 bytes in one file, while some games take up 24 bytes in one file

3. Index version 3

I seem to have only seen this version of the index on Knives Out games. A large part of the index is overwritten by 0, the file name is not encrypted, the size and offset can also be read, but the index structure is very messy, I can only complete manual extraction, and have not written an automated script (from the index after hot update)

4/Index version 4?

Now some index files seem to be replaced directly by database file types, so I directly call them version 4, the entries of these index files are stored in the database file, and after parsing from the database, it may be necessary to make some fiddling to allow the script to extract correctly

More types are also added for compressed files, I'm trying to understand all compressions to support more games

1.ZZZ4 (lz4 compression)

2.ZZZZ (lzo1x compression)

3.ZZZX (seems to be encrypted lz4) has a script where_winds_meet_mpk.bms that can handle this compression, but the script is outdated, not sure if the key is outdated

4.LZMA (lzma compression)

5.ZSTD (zstd compression)

6.1084 (exclusive or lz4 compression)

7.1D84 (zstd compression)

8.E206 (corrupted zlib compression)

9.EZST (Unknown compression

This post will discuss the index structure, compression type, and other related files about the engine

Edited by wq223
Posted

I updated the netease_mpk.bms script
Added two new compression types, which should now handle more games

# NetEase messiah game mpkinfo/mpk (script 0.3)
# List of supported games:Diablo Immortal,Ace Racer,Badlanders,Lovebrush Chronicles,TankCompany
# Originally created by aluigi

get EXT extension
if EXT & "info"
    # mpkinfo and any other similar extension
else
    print "Error: you must open the info file"
    cleanexit
endif
string EXT - "info"

get RES_NAME basename

get VER long
get FILES long
for i = 0 < FILES
    get NAMESZ short
    getdstring NAME NAMESZ
    get OFFSET long
    get SIZE long
    get FILENUM long
    math IS_FOLDER = FILENUM
    math IS_FOLDER & 1
    math FILENUM >> 1

    putarray 0 i FILENUM
    putarray 1 i NAME
    putarray 2 i OFFSET
    putarray 3 i SIZE
    putarray 4 i IS_FOLDER
next i

sortarray 0 1

math LAST_FILENUM = -1
for i = 0 < FILES
    getarray FILENUM    0 i
    getarray NAME       1 i
    getarray OFFSET     2 i
    getarray SIZE       3 i
    getarray IS_FOLDER  4 i

    if IS_FOLDER == 0
        if FILENUM != LAST_FILENUM
            math LAST_FILENUM = FILENUM
            if FILENUM == 0
                string TMP p "%s.%s"   RES_NAME         EXT
            else
                string TMP p "%s%d.%s" RES_NAME FILENUM EXT
            endif
            open FDSE TMP 0 EXISTS
        endif
        if EXISTS != 0
            goto OFFSET
            getdstring ALGO 4
            if ALGO == "ZZZ4"
                comtype lz4
                get XSIZE long
                savepos OFFSET
                clog NAME OFFSET SIZE XSIZE
            elif ALGO == "LZMA"
                comtype lzma
                get XSIZE long
                savepos OFFSET
                clog NAME OFFSET SIZE XSIZE
            elif ALGO == "ZSTD"
                comtype zstd
                get XSIZE long
                savepos OFFSET
                clog NAME OFFSET SIZE XSIZE
            elif ALGO == "ZZZZ"
                comtype lzo1x
                get XSIZE long
                savepos OFFSET
                clog NAME OFFSET SIZE XSIZE
            else
                log NAME OFFSET SIZE
            endif
        endif
    endif
next i

 

netease_mpk_v3.zip

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...