这个游戏lIve2d里面的文件是二进制的 不清楚怎么提取 文件为bin类型 文头标识是live2d webp文件是l2d的贴图 至于uuid以及FiledID不是十六进制的转换 也不是base64转换 base64文件结尾多为== uuid的是cocos2d作为文件唯一标识的一种方法 uuid的转换的算法我找了很多网站才找到 我分享下 python代码
def uuid2uuid(base64):
BASE64_KEYS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
BASE64_VALUES = [0 for i in range (123)]
for i in range (123):
BASE64_VALUES[i] = 64
for i in range (64):
BASE64_VALUES[ord(BASE64_KEYS[i])] = i
BASE64Values = BASE64_VALUES
HexChars = "0123456789abcdef"
_t = ["","","",""]
_tt = ["-"]
UuidTemplate = _t +_t +_tt +_t +_tt +_t +_tt +_t +_tt +_t +_t +_t
Indices = []
_index = 0
for v in UuidTemplate:
if v == "":
Indices.append(_index)
_index += 1
if len(base64) != 22:
return base64
UuidTemplate[0] = base64[0]
UuidTemplate[1] = base64[1]
i = 2
j = 2
while i < 22 :
lhs = BASE64Values[ord(base64[i])]
rhs = BASE64Values[ord(base64[i + 1])]
UuidTemplate[Indices[j]] = HexChars[lhs >> 2]
j += 1
UuidTemplate[Indices[j]] = HexChars[((lhs & 3) << 2 )| rhs >> 4 ]
j += 1
UuidTemplate[Indices[j]] = HexChars[rhs & 0xF ]
j += 1
i += 2
print("".join(UuidTemplate))
return "".join(UuidTemplate)
if __name__ == '__main__':
base64 = "a2dtc80E1EpJt286jHHckG"
uuid2uuid(base64)
def compressUuid(fullUuid):
BASE64_KEYS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
HexChars = "0123456789abcdef"
if len(fullUuid) != 36:
return fullUuid
strs = fullUuid.split('@')
uuid = strs[0]
zipUuid = []
zipUuid.append(uuid[0])
zipUuid.append(uuid[1])
cleanUuid = uuid.replace("-","")
HexMap = {}
for i in range(len(HexChars)):
char = HexChars[i]
HexMap[char] = i
zip_uuid = []
for i in range(2, 32, 3):
left = HexMap[chr(ord(cleanUuid[i]))]
mid = HexMap[chr(ord(cleanUuid[i + 1]))]
right = HexMap[chr(ord(cleanUuid[i + 2]))]
zipUuid.append(BASE64_KEYS[(left << 2) + (mid >> 2)])
zipUuid.append(BASE64_KEYS[((mid & 3) << 4) + right])
print("".join(zipUuid))
return fullUuid.replace(uuid, ''.join(zip_uuid))
if __name__ == '__main__':
fullUuid = "e0a3869f-1819-475a-b226-1a3286036488"
compressUuid(fullUuid)
方法uuid2uuid是将22位不带-符号的uuid转换为36位带-符号的uuid
方法compressUuid则是进行相反操作 uuid名称转换可逆
通过这个转换按照json里面的uuid进行还原 不同版本coco2d的json配置不一定相同 这个游戏的spine文件的atlas以及骨骼都在json配置里面 关键字搜索"sp.SkeletonData" 需要按照uuid转换的uuid查找相应的贴图 不过文件很混乱有的是pkm格式的有的是png格式的还有的是压缩包 所以我写的脚本也有些问题就不分享了