TomCasavant / MastodonPlaysGameboy

Lets users play gameboy roms via mastodon polls

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RTC Isn't functioning correctly

TomCasavant opened this issue · comments

RE: https://mastodon.social/@phi1997/112435056419435322 from @phi1997

I think Pokemon Gold should have a Day/Night cycle which we haven't seen show up yet which means the RTC probably isn't working.

It's possible that RTC is just tied to the number of ticks passed in-game(?) which would mean only seconds/minutes have passed in which case I think we'd want to manually set the time to the current real-world time (so every hour that passes in the poll an hour passes in-game)

Actually, just looked at the pyboy code for RTC https://github.com/Baekalfen/PyBoy/blob/master/pyboy/core/cartridge/rtc.py it looks like it grabs the time from the system and assigns it that way so it must not be enabled or something?

Perhaps we need to call self.gameboy.stop() in order to save the ram/rtc correctly instead of just creating a save state

self.gameboy.save()

Er, self.pyboy.stop() inside that save function instead of just creating a save state

def save(self):

Asked someone in the PyBoy discord

There isn't a supported way of doing it. But you can see how the RTC is saved, and modify it yourself.
But it might not work with save/load state. Depending on the game, it might try to catch up with the new time, and trigger a bunch of events

So this might be a bit more in-depth. That or I could just have the emulator running non-stop but I'd prefer not to

Asked someone in the PyBoy discord

There isn't a supported way of doing it. But you can see how the RTC is saved, and modify it yourself.
But it might not work with save/load state. Depending on the game, it might try to catch up with the new time, and trigger a bunch of events

So this might be a bit more in-depth. That or I could just have the emulator running non-stop but I'd prefer not to

Baekalfen/PyBoy#328 this will probably fix our issue

You're welcome to tag me, or join the PyBoy Discord if you need help with any of these issues. I wasn't aware there was a problem with RTC until I fixed it today.

You're welcome to tag me, or join the PyBoy Discord if you need help with any of these issues. I wasn't aware there was a problem with RTC until I fixed it today.

Thanks! You actually tagged me in the discord with that github issue earlier

Based on my reading of it I'll still have to edit the memory directly, but i think that explains why I wasn't seeing rtc updates

Thanks! You actually tagged me in the discord with that github issue earlier

Ah, I see now. You even quoted me here earlier.

Based on my reading of it I'll still have to edit the memory directly, but i think that explains why I wasn't seeing rtc updates

What would you have to edit?

Based on my reading of it I'll still have to edit the memory directly, but i think that explains why I wasn't seeing rtc updates

What would you have to edit?

I wasn't certain based on this Baekalfen/PyBoy#328 (comment), in our case in particular we already set the in-game time a few months ago so I was thinking we might have to set the time manually when we boot up the save state. But I just realized the game is probably already set to that time and it's just not progressing in any way, and since we don't really care about it being any specific time (just that time progresses) it might just work with the latest updates.

Except I'm not sure if the RTC is automatically reconfigured every boot, we are loading in a save state every hour so I'm worried it won't set the clock because it's not loading in a save file in the way you would with an actual gameboy

I wasn't certain based on this Baekalfen/PyBoy#328 (comment), in our case in particular we already set the in-game time a few months ago so I was thinking we might have to set the time manually when we boot up the save state. But I just realized the game is probably already set to that time and it's just not progressing in any way, and since we don't really care about it being any specific time (just that time progresses) it might just work with the latest updates.

Except I'm not sure if the RTC is automatically reconfigured every boot, we are loading in a save state every hour so I'm worried it won't set the clock because it's not loading in a save file in the way you would with an actual gameboy

I can't say for sure. But you should back up the saves you have now before you try anything. If you delete the RTC and let the emulator recreate it, you might be lucky, that the game lets you reconfigure it, and it just works from there.