mgba-emu / mgba

mGBA Game Boy Advance Emulator
https://mgba.io/
Mozilla Public License 2.0
5.63k stars 770 forks source link

(RetroArch) Real Time Clock appears broken in 0.7-WIP #1134

Open FoetusSheldon opened 6 years ago

FoetusSheldon commented 6 years ago

(Crosspost as I wasn't sure wether to post this here or at https://github.com/libretro/mgba/.)

The Real Time Clock displays an incorrect time in Pokemon Liquid Crystal (romhack).

The RTC functions correctly in VBA Next, provided the cart ID is changed to that of Pokemon Ruby using a hex editor (as the hack is based on FireRed, which did not use RTC).

The time displayed should be that of the system clock - instead it is always Thursday, 22:105, and 0:00 if the game ID is not changed to that of Pokemon Ruby.

To reproduce the bug:

JMC47 commented 6 years ago

Does the issue happen in the latest builds of mGBA proper?

Try the development downloads. Does changing the GameID fix it here as well?

https://mgba.io/downloads.html

fennectech commented 5 years ago

I can confirm this on vanilla retroarch (for switch)

TurdPooCharger commented 5 years ago

I did testing of liquid-crystal-b3.3.00512.gba (CRC32 hash: 6A761D9F) on the major releases of mGBA (Windows build).

mGBA v0.6.1 was the last known version with working RTC for the game. Hope this helps in tracking down where the bug might have occurred.

richteer commented 5 years ago

Did some digging myself after running into this exact problem. 0.6.1 had the correct time, 0.6.2 was incorrect, thinking it was Sunday 00:00, and master had the same behavior as described in the OP (Thursday, 22:105).

After some bisecting between 0.6.1 and 0.6.2, I found the issue first appears in commit e112271 " GBA Hardware: More RTC fixes". Reverting this patch on master with git revert e112271 seems to fix it for me.

I have literally no idea what the implications are of reverting that patch, but hopefully that's helpful information.

fennectech commented 5 years ago

Changing the games TITLE ID to that of ruby fixes it.

TurdPooCharger commented 5 years ago

@fennectech, that BPREAXVE trick in hex editor didn't work for the 0.7 beta 1 release when checked in the Windows and 3DS builds (and subsequent nighties before and after til this point). I came here after finding out that Liquid Crystal can be played with RTC as a GBA VC injection from this thread here.

This lead back to the question whether this game's RTC functions because of hacky rom patch work, or that it's supposed work on real hardware if we go by 3DS ≃ DSi ≃ NDS ≃ GBA.

@endrift, thanks for fixing this. Gonna giddity share the news back at GBAtemp. :smile:

fennectech commented 5 years ago

Also changed fire to ruby.

fennectech commented 5 years ago

This works I image

TurdPooCharger commented 5 years ago

@fennectech, I tried the RUBYAXVE hex edit you suggested on 0.7 beta 1, and that also didn't work. I think that trick was for a previous older mGBA version. Any case, more PKMN-LC for everyone. :)

fennectech commented 5 years ago

Well. With this it works properly in RA

rzumer commented 5 years ago

I think this should be reopened, as the latest Windows build (based on https://github.com/mgba-emu/mgba/commit/06e7d3f) still has issues on my PC. In my experience it is a 2 hour delay.

endrift commented 5 years ago

@rzumer is your computer time zone set to UTC+2?

rzumer commented 5 years ago

@endrift UTC-4 currently (EST).

IngwiePhoenix commented 3 years ago

Hello! It's 2020 and Pokémon games of the 2nd generation that use an RTC keep asking me to re-enter the time all the time. Is that normal for GB/C?

endrift commented 3 years ago

@IngwiePhoenix That bug was separate and fixed as #1959. However, it has not yet been merged into the codebase that the RA cores are built from.

IngwiePhoenix commented 3 years ago

Thanks @endrift ! Do you have an aproximate ETA of when this merge could happen?