pac解包方法
安装python,新建extractpac.py,输入以下内容保存,然后把pac直接拖到py上import struct, glob, os, sys
def read_null_terminated_string (f, start_offset):
current_loc = f.tell()
f.seek(start_offset)
null_term_string = f.read(1)
while null_term_string[-1] != 0:
null_term_string += f.read(1)
f.seek(current_loc)
return(null_term_string[:-1].decode())
def process_pac (pac_file):
print("Processing {}...".format(pac_file))
with open(pac_file, 'rb') as f:
magic = f.read(4)
if magic == b'FPAC':
count, header_size, unk = struct.unpack("<3I", f.read(12))
files = []
for i in range(count):
entry_dat = struct.unpack("<4Q", f.read(32))
files.append({'name': read_null_terminated_string (f, entry_dat),
'location': entry_dat,
'size': entry_dat,
'hash': entry_dat})
for i in range(count):
f.seek(files['location'])
f_data = f.read(files['size'])
filedir = os.path.dirname(files['name'])
if not filedir == '' and not os.path.exists(filedir):
os.makedirs(filedir)
with open(files['name'], 'wb') as f2:
f2.write(f_data)
return
if __name__ == "__main__":
# Set current directory
if getattr(sys, 'frozen', False):
os.chdir(os.path.dirname(sys.executable))
else:
os.chdir(os.path.abspath(os.path.dirname(__file__)))
# If argument given, attempt to extract from file in argument
if len(sys.argv) > 1:
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('pac_filename', help="Name of pac file to extract from (required).")
args = parser.parse_args()
if os.path.exists(args.pac_filename) and args.pac_filename[-4:].lower() == '.pac':
process_pac(args.pac_filename)
else:
pac_files = glob.glob('*.pac')
for i in range(len(pac_files)):
process_pac(pac_files)
感谢,礼貌问下,解包出来的tbl文件如何处理 谢谢大佬分享,还有怎么打包回去。 不用打包,能读零散文件,把原pac删了就行
Geminize 发表于 2025-8-24 13:15
不用打包,能读零散文件,把原pac删了就行
好的谢谢大大。
谢谢大佬每次的轨迹修改指导 存档呢··· qq95604014 发表于 2025-8-24 19:06
存档呢···
你这眼神我也是服了
https://bbs.3dmgame.com/thread-6614789-1-1.html
Geminize 发表于 2025-8-24 13:15
不用打包,能读零散文件,把原pac删了就行
大佬,把tbl和pac放一个文件夹;tbl放在文件夹再把这个文件夹和pac放一起?我两种都试了,游戏打不开QAQ。
本帖最后由 1170759450 于 2025-8-29 10:04 编辑
Mr.冷水先森 发表于 2025-8-28 00:07
大佬,把tbl和pac放一个文件夹;tbl放在文件夹再把这个文件夹和pac放一起?我两种都试了,游戏打不开QAQ ...
把解包后的文件夹放到exe文件同级的目录里不是pac文件夹里,还要把解包前的文件删除了。 1170759450 发表于 2025-8-29 10:03
把解包后的文件夹放到exe文件同级的目录里不是pac文件夹里,还要把解包前的文件删除了。 ...
谢谢大佬!!!爱您!!感恩!{:3_104:}
感谢教程,看来只能自己动手了 可以把bgm的资源解出来嘛?想要新版默认的音频资源 谢谢!真是太棒了! 大佬问一下 怎么我的PAC不能放到解包软件上啊
页:
[1]