Skip to content

Instantly share code, notes, and snippets.

@shuax
Created January 18, 2021 05:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shuax/57fd11426f9b05814550ed96afbe92b5 to your computer and use it in GitHub Desktop.
Save shuax/57fd11426f9b05814550ed96afbe92b5 to your computer and use it in GitHub Desktop.
解压QQ拼音皮肤文件
import zlib
import struct
def export_skn(path, data):
head = data[:20]
reserve = data[20:20+256] # 未知数据,全为0,大小是256,可能是给文件头扩容保留的
body = data[20+256:]
sign, version, size = struct.unpack('<04sQQ', head)
if sign!=b'FSPQ':
print('文件头不正确')
return
if version!=1:
print('文件版本不支持')
return
if len(body)!=size:
print('文件数据解压不正确')
return
# 不想写解压了,pythoncom.StgOpenStorage比较麻烦,自己用7zip解压吧
with open(path+'.zip', 'wb') as f:
f.write(body)
def export_qpys(path):
with open(path, 'rb') as f:
head = f.read(12)
body = f.read()
sign, crc32, size = struct.unpack('<04sII', head)
if sign!=b'SYPQ':
print('文件头不正确')
return
if zlib.crc32(body)!=crc32:
print('文件数据校验不正确')
return
body = zlib.decompress(body)
if len(body)!=size:
print('文件数据解压不正确')
return
# skn工程文件
export_skn(path, body)
export_qpys('黑白.qpys')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment