P
PyBoy5mo ago
Sas2k

Can Pyboy load save files?

Hello (yes again), If I were to say make a save file in Pokémon crystal. Would I be able to access that save file on a new instance of emulator?
28 Replies
Sas2k
Sas2kOP5mo ago
(I've tried but pyboy doesn't seem to remember it)
thatguy
thatguy5mo ago
Yes. If you notice, when you save, a .ram file is written to your directory. That SRAM dump will be loaded by pyboy. At least it has with my experience
Sas2k
Sas2kOP5mo ago
yeah, I saw it the SRAM doesn't seem to load in
thatguy
thatguy5mo ago
Make sure the ram file is in the same directory you run pyboy in
Sas2k
Sas2kOP5mo ago
nope still doesn't work
thatguy
thatguy5mo ago
Hrm. I can experiment later when I'm done with work for the day. You can always use a save state instead
Sas2k
Sas2kOP5mo ago
yeah, that's what I'm living on currently
thatguy
thatguy5mo ago
I heavily use save states as it is
Sas2k
Sas2kOP5mo ago
but the down side is it doesn't support --sound
thatguy
thatguy5mo ago
Why do you need sound?
Sas2k
Sas2kOP5mo ago
It's more or so I've been playing around with it than run programs with it I've been meaning to run some stuff with it but one side of me said let's complete a game with it first so I kinda ran with it anyways, that's my current predicament (p.s. I've wanted to write an emulator of a console for a while as well) anyhow, do you have any idea on why it won't load in the SRAM?
thatguy
thatguy5mo ago
Usually it's an issue involving the sram file being in the wrong directory If you run it from commandline instead of in a script, what happens? Is there anything in the pyboy help that could be of use?
Sas2k
Sas2kOP5mo ago
well, I can using the pyboy binary to run currently the SRAM, ROM and Save State file are all in the same directory
thatguy
thatguy5mo ago
so with the pyboy binary it works?
Sas2k
Sas2kOP5mo ago
and I'm running the pyboy in that same directory nope it does not the binary is the thing I've been using from the start
thatguy
thatguy5mo ago
what if you use --loadstate?
Sas2k
Sas2kOP5mo ago
well, I get the loadstate but with no sound
thatguy
thatguy5mo ago
if you do --loadstate and --sound what happens?
Sas2k
Sas2kOP5mo ago
that's what usuall happens, it loads into the state and I get an OS erro. Therefore no sound #Save states not functioning properly when sound flag is used
thatguy
thatguy5mo ago
What happens if you pass the .ram file to --loadstate ?
thatguy
thatguy5mo ago
the goal would be to get to the load_ram function I presume
GitHub
PyBoy/pyboy/core/cartridge/base_mbc.py at acdf27c45f646dbffdbe3d38f...
Game Boy emulator written in Python. Contribute to Baekalfen/PyBoy development by creating an account on GitHub.
Sas2k
Sas2kOP5mo ago
hmm never tried that before
thatguy
thatguy5mo ago
You should be able to directly get to it after you start the game with something like pyboy.mb.cartridge.load_ram(file-like-object)
Sas2k
Sas2kOP5mo ago
hmm
thatguy
thatguy5mo ago
I'm kind of guessing at this point. I haven't read that part of the codebase in awhile
Sas2k
Sas2kOP5mo ago
ok I'm going through the docs and code as well on this side
Bækalfen
Bækalfen5mo ago
The save file is always created when you close the emulator properly. If you run it from a script, remember to call pyboy.stop() The save file will be located next to the ROM file you provided, and automatically loaded
Sas2k
Sas2kOP5mo ago
ah ok well, I've managed to fix it well, the thing that happens is that whenever a save state loads in while the sound flag is enabled it gets the error in #Save states not functioning properly when sound flag is used then when I try to exit the window closses but the terminal process does not exit therefore I need to force exit it, which isn't a proper shut that's what was happening so, the root cause was #Save states not functioning properly when sound flag is used

Did you find this page helpful?