From 22e957110f4c0a95d8dfc0c05ac9ebadf91e61ee Mon Sep 17 00:00:00 2001 From: Miguel Sosa <85181687+msosav@users.noreply.github.com.> Date: Sun, 23 Jun 2024 16:17:46 -0500 Subject: [PATCH] Add state loading --- main.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main.py b/main.py index 47729fa..f56c723 100644 --- a/main.py +++ b/main.py @@ -1,8 +1,17 @@ from pyboy import PyBoy +from pyboy.utils import WindowEvent + + +def load_state(path: str, pyboy: PyBoy) -> None: + with open(path, "rb") as state: + pyboy.load_state(state) + if __name__ == "__main__": pyboy = PyBoy("roms/ZeldaLinksAwakening.gb") + load_state("roms/ZeldaLinksAwakening.gb.state", pyboy) + while pyboy.tick(): pass