Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from functools import reduce
- with open('./SaveData1_Trial.sav', 'rb')as f1:
- x = f1.read()
- # y = open('./SaveDatay_Trial.sav', 'rb').read()
- print(len(x))
- # print(len(y))
- # for index,(xb,yb) in enumerate(zip(x,y)):
- # if xb!=yb:
- # print(f'{index},{xb},{yb}')
- x=list(x)
- charSav=map(chr,x)
- ss="".join(charSav)
- C1="GamePlaySecond"
- C2="....."
- C3="IntProperty"
- C4=".........."
- findIndex=ss.find(C1)
- intIndex=findIndex+reduce(lambda x,y:x+y,map(len,[C1,C2,C3,C4]))
- print(findIndex)
- print(intIndex)
- gameTime=x[intIndex:intIndex+4]
- print (list(map(hex,gameTime)))
- gTime=gameTime[0]+gameTime[1]*255+gameTime[2]*(255**2)
- print(f'当前游戏时长{gTime/3600}小时')
- for index in range(intIndex,intIndex+4):
- x[index]=0
- print(len(x))
- print('游戏时长已归零')
- with open('./SaveData1_Trial.sav','wb')as f2:
- f2.write(bytes(x))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement