• 大小: 3KB
    文件类型: .py
    金币: 1
    下载: 0 次
    发布日期: 2021-05-11
  • 语言: Python
  • 标签: RGSS3A  Python  

资源简介

Python编写的RGSS3A解包工具 因为是写着玩的所以代码略乱 Python3+Ubuntu12.04下测试可用,但依然不能保证完全正常工作 仅供研究学习(还有吐槽)使用,请勿用于不适当的用途

资源截图

代码片段和文件信息

#!/usr/bin/python3

import sys
import struct
import os

def usage():
print(‘RGSS3A decrypter\nUsage: rgss3adec  ‘)

# 主密钥变形
def get_mainkey(mainkey):
tmpkey=struct.unpack(‘ tmpkey=tmpkey[0]*9+3
return tmpkey

# 解密子文件信息
def get_metadata(edatamainkey):
tmpedata=struct.unpack(‘ tmpdata=[]
for i in range(len(tmpedata)):
tmpdata.append(tmpedata[i]^mainkey)
return tmpdata

# 解密文件名|文件内容
def get_data(edatakeyisfile):
length=len(edata)
count=length//4
extra=length%4
# if not isfile:
# tmpdata=‘‘
# else:
tmpdata=bytearray()

for i in range(0count):
nameblk=0
for j in range(04):
nameblk+=edata[4*i+j]*pow(256j)
nameblk=struct.pack(‘ tmpdata+=nameblk
# if not isfile:
# tmpdata+=nameblk.decode()
# else:
# tmpdata+=nameblk
if isfile:
key=(key*7+3)%4294967296
nameblk=0
if extra!=0:
for j in range(0extra):
nameblk+=edata[4*(i+1)+j]*pow(256j)
nameblk=struct.pack(‘# if not isfile:
# tmpdata+=(nameblk.decode())[0:extra]
# else:
tmpdata+=nameblk[0:extra]
if not isfile:
return tmpdata.decode()
else:
return tmpdata

# 在输出文件夹中建立子文件夹
def mksubdir(pathdirname):
newdir = os.path.join(path dirname)
if not os.path.isdir(newdir):
os.mkdir(newdir)

# 建立输出文件夹
def mkoutdir(path):
try:
if not os.path.isdir(path):
os.mkdir(path)
mksubdir(path‘Data‘)
mksubdir(path‘Graphics‘)
except:
print(‘Unable to create output directory.‘)
sys.exit(2)

# 测试文件路径格式是否为linux格式(不确定win下是否可用)
def islinux(path):
if (os.path.abspath(path))[0]==‘/‘:
return True
else:

评论

共有 条评论