Advertisement
Guest User

Untitled

a guest
Feb 13th, 2023
853
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.86 KB | None | 0 0
  1. from functools import reduce
  2. with open('./SaveData1_Trial.sav', 'rb')as f1:
  3.     x = f1.read()
  4. # y = open('./SaveDatay_Trial.sav', 'rb').read()
  5.  
  6. print(len(x))
  7. # print(len(y))
  8.  
  9. # for index,(xb,yb) in enumerate(zip(x,y)):
  10.  
  11. #     if xb!=yb:
  12. #         print(f'{index},{xb},{yb}')
  13. x=list(x)
  14. charSav=map(chr,x)
  15. ss="".join(charSav)
  16. C1="GamePlaySecond"
  17. C2="....."
  18. C3="IntProperty"
  19. C4=".........."
  20. findIndex=ss.find(C1)
  21. intIndex=findIndex+reduce(lambda x,y:x+y,map(len,[C1,C2,C3,C4]))
  22. print(findIndex)
  23. print(intIndex)
  24. gameTime=x[intIndex:intIndex+4]
  25. print (list(map(hex,gameTime)))
  26. gTime=gameTime[0]+gameTime[1]*255+gameTime[2]*(255**2)
  27. print(f'当前游戏时长{gTime/3600}小时')
  28. for index in range(intIndex,intIndex+4):
  29.     x[index]=0
  30. print(len(x))
  31. print('游戏时长已归零')
  32. with open('./SaveData1_Trial.sav','wb')as f2:
  33.     f2.write(bytes(x))
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement