N_A_editor.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:Nier-Automata-editor 作者: CensoredUsername 项目源码 文件源码
def save(self):
        new = bytearray(self.original)

        new[0x4:0x10] = self.gamedata_header

        struct.pack_into("<L", new, 0x00024, self.time_played)
        struct.pack_into("<L", new, 0x0002C, self.last_saved_chapter)

        namebuf = self.name.encode("utf-16-le")
        # limit length
        if len(namebuf) > 68:
            namebuf = namebuf[:68]
        # pad with zeroes
        namebuf = namebuf + b"\0" * (70 - len(namebuf))
        new[0x34:0x7A] = namebuf

        struct.pack_into("<L", new, 0x3056C, self.money)
        struct.pack_into("<L", new, 0x3871C, self.experience)

        # back up the file
        shutil.move(self.path, self.path + ".bak")

        # write the new one
        with open(self.path, "wb") as f:
            f.write(new)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号