求助.dmxpkg文件解包

哪位大佬遇到这种.dmxpkg文件解压出来的DATA.dat和DATA.dic文件,DATA.dat文件包含了spine三件套,DATA.dic里面应该是标注了三个文件在DATA.dat文件里的位置,我想把DATA.dat文件里面的spine三件套拆出来

通过网盘分享的文件:.dmxpkg文件
链接: https://pan.baidu.com/s/1n1pjMjSpeLStGd8zZv4qcQ?pwd=kdyp 提取码: kdyp
–来自百度网盘超级会员v3的分享

这是解密脚本,另外请标注游戏名称,文件来源 :slightly_smiling_face:

from pathlib import Path
from io import BufferedReader

def parse(r: BufferedReader, r2: BufferedReader, outPath: Path):
count = int.from_bytes(r.read(4), ‘little’)
for _ in range(count):
nameLen = r.read(1)[0]
name = bytes(i ^ nameLen for i in r.read(nameLen))
start = int.from_bytes(r.read(4), ‘little’) - name[-6] - nameLen
size = int.from_bytes(r.read(4), ‘little’) - name[-7] - nameLen
new = outPath.joinpath(name.decode())
new.parent.mkdir(parents=True, exist_ok=True)
r2.seek(start)
with open(new, ‘wb’) as w:
w.write(r2.read(size))

def batch(datPath: str = ‘’, outPath: str = ‘’, subfolder: bool = False):
path = Path(datPath) if datPath else Path.cwd()
move = (Path(outPath) if outPath else path).joinpath(‘Extract’)
need = [i for i in (path.rglob(‘.dic’) if subfolder else path.glob('.dic’))]
for i in need:
dat = i.parent.joinpath(f’{i.stem}.dat’)
if not dat.is_file():
print(f’缺少dat文件 — {dat.as_posix()}')
continue
with open(i, ‘rb’) as f, open(dat, ‘rb’) as f2:
parse(f, f2, move)

if name == ‘main’:
path = r’’ # 游戏文件所在的路径
outPath = r’’ # 导出文件的路径
subfolder = False # 是否查找字文件夹内的.dic文件
batch(path, outPath, subfolder)

1 个赞

亲测可用,感谢大佬 :kissing_closed_eyes:游戏名称全民投资人页游,文件为角色立绘spine

这不是之前@d-miracle 大佬帮忙解《圣城大亨》的脚本嘛?这是换皮游戏?

给个链接看看,是不是换皮游戏

对,应该就是@d-miracle大佬给我解决那个吧,这几个游戏看着都差不多

https://dhtm-cdn.shhdouyue.com/rsgame/SYJ_H5/h5/static/game/scripts/game_static.js
https://dhtm-cdn.shhdouyue.com/rsgame/SYJ_H5/resources/resource_20250227/hash.Dat
https://dhtm-cdn.shhdouyue.com/rsgame/SYJ_H5/resources/resource_20250227/main.dmxpkg

下载倒是很简单
从game_static获取url

1 个赞
from io import BytesIO
from pathlib import Path
from zipfile import ZipFile
from io import BufferedReader

def parse(r: BufferedReader, r2: BufferedReader, outPath: Path):
    count = int.from_bytes(r.read(4), 'little')
    for _ in range(count):
        nameLen = r.read(1)[0]
        name = bytes(i ^ nameLen for i in r.read(nameLen))
        start = int.from_bytes(r.read(4), 'little') - name[-6] - nameLen
        size = int.from_bytes(r.read(4), 'little') - name[-7] - nameLen
        new = outPath.joinpath(name.decode())
        new.parent.mkdir(parents=True, exist_ok=True)
        r2.seek(start)
        if new.is_file():
            print(f'存在重名文件 --- {new.as_posix()}')
        with open(new, 'wb') as w: w.write(r2.read(size))

def batch(datPath: str = '', outPath: str = '', subfolder: bool = False):
    path = Path(datPath) if datPath else Path.cwd()
    move = (Path(outPath) if outPath else path).joinpath('Extract')
    need = [i for i in (path.rglob('*.dmxpkg') if subfolder else path.glob('*.dmxpkg'))]
    for i in need:
        with ZipFile(i) as z:
            names = {j.lower():j for j in z.namelist() if j.lower().endswith(('.dat', '.dic'))}
            files: dict[str, str] = {}
            for i in names:
                if i.endswith('.dat'): continue
                v = f'{i[:-3]}dat'
                if v not in names:
                    print(f'缺少dat文件 --- {i}')
                    continue
                files[i] = v
            if not files:
                print(f'没有dat和dic文件 --- {i}')
            for k, v in files.items():
                with z.open(names[k]) as z1, z.open(names[v]) as z2:
                    f = BytesIO(z1.read())
                    f2 = BytesIO(z2.read())
                parse(f, f2, move)

if __name__ == '__main__':
    path = r'' # 游戏文件所在的路径
    outPath = r'' # 导出文件的路径
    subfolder = False # 是否查找字文件夹内的.dmxpkg文件
    batch(path, outPath, subfolder)

批量解压dmxpkg

2 个赞

感谢,之前只是根据命名规则下载了部分资源,现在可以全部dmxpkg文件都能下载下来了 :kissing_closed_eyes: