# 求大佬分享 失落四境解包方法

**URL:** <https://live2dhub.com/t/topic/3437>\
**Category:** 讨论\
**Created:** [2024 年8 月 9 日 09:42 UTC](https://live2dhub.com/t/topic/3437 "2024-08-09T09:42:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

作者： ![alife](https://live2dhub.com/user_avatar/live2dhub.com/alife/32/3879_2.png) [@alife](https://live2dhub.com/u/alife)\
发布日期： [2024 年8 月 9 日 09:42 UTC](https://live2dhub.com/t/topic/3437/1 "2024-08-09T09:42:48Z")

</div>

喜欢这游戏的风格，但是cocos开发的 as解不了

---

<div class="post-metadata">

作者： ![yjzyl9008](https://live2dhub.com/user_avatar/live2dhub.com/yjzyl9008/32/1006_2.png) [@yjzyl9008](https://live2dhub.com/u/yjzyl9008)\
发布日期： [2024 年8 月 9 日 10:01 UTC](https://live2dhub.com/t/topic/3437/2 "2024-08-09T10:01:14Z")

</div>

看标头，是astc压了下，没加密，直接解就好了，名称还原论坛有帖子自己参考，常见的游戏纹理/压缩格式标头可以自己网上多搜搜

编辑：后面看了下发现7月份就有人找过我看这游戏hh

 ![image](https://live2dhub.com/uploads/default/original/2X/c/c13f6754533b549515da7e1e0b6f1dae34c1ccca.png)

---

<div class="post-metadata">

作者： ![yjzyl9008](https://live2dhub.com/user_avatar/live2dhub.com/yjzyl9008/32/1006_2.png) [@yjzyl9008](https://live2dhub.com/u/yjzyl9008)\
发布日期： [2024 年8 月 9 日 10:02 UTC](https://live2dhub.com/t/topic/3437/3 "2024-08-09T10:02:57Z")

</div>

以前自用的py脚本

```auto
import os
from PIL import Image
import texture2ddecoder

def decrypt_astc(file_path):
    with open(file_path, 'rb') as f:
        jy = f.read()
        
    if jy[:4] == b'\x13\xAB\xA1\x5C':
        aa = int.from_bytes(jy[4:5], byteorder='little', signed=False)
        ab = int.from_bytes(jy[5:6], byteorder='little', signed=False)
        ac = int.from_bytes(jy[7:9], byteorder='little', signed=False)
        ad = int.from_bytes(jy[10:12], byteorder='little', signed=False)
        jy = texture2ddecoder.decode_astc(jy[16:], ac, ad, aa, ab)
        return jy, ac, ad, aa, ab
    return None, None, None, None, None

def process_astc_files(directory, output_format='png'):
    if not os.path.exists(directory):
        print(f"目录 {directory} 不存在。")
        return
    
    for root, _, files in os.walk(directory):
        relative_path = os.path.relpath(root, directory)
        output_directory = os.path.join(directory, 'decrypted_images', relative_path)
        os.makedirs(output_directory, exist_ok=True)
        
        for file_name in files:
            if file_name.endswith('.astc'):
                file_path = os.path.join(root, file_name)
                try:
                    jy, ac, ad, aa, ab = decrypt_astc(file_path)
                    if jy is not None:
                        output_file_name = os.path.splitext(file_name)[0] + f'.{output_format}'
                        output_file_path = os.path.join(output_directory, output_file_name)
                        if output_format.lower() == 'jpg':
                            tp = Image.frombytes("RGBA", (ac, ad), jy, 'raw', ("BGRA")).convert("RGB")
                            tp.save(output_file_path, format="JPEG", quality=90)
                        else:
                            tp = Image.frombytes("RGBA", (ac, ad), jy, 'raw', ("BGRA"))
                            tp.save(output_file_path, format='PNG')
                        print(f"保存解密后的图片到 {output_file_path}")
                    else:
                        print(f"解密失败: {file_path}")
                except Exception as e:
                    print(f"处理文件 {file_path} 时出错: {e}")

input_directory = '/home/rikka/Downloads/UnpackGames/assets'
process_astc_files(input_directory, output_format='png')

```

---

<div class="post-metadata">

作者： ![alife](https://live2dhub.com/user_avatar/live2dhub.com/alife/32/3879_2.png) [@alife](https://live2dhub.com/u/alife)\
发布日期： [2024 年8 月 9 日 10:04 UTC](https://live2dhub.com/t/topic/3437/4 "2024-08-09T10:04:11Z")

</div>

您简直是神

---

<div class="post-metadata">

作者： ![hsxx](https://live2dhub.com/letter_avatar_proxy/v4/letter/h/e480ec/32.png) [@hsxx](https://live2dhub.com/u/hsxx)\
发布日期： [2025 年2 月 6 日 16:00 UTC](https://live2dhub.com/t/topic/3437/5 "2025-02-06T16:00:49Z")

</div>

游戏2月10日关服，现已停止注册，请问有大佬保留着游戏数据包吗
