mgba-emu / mgba

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

[3ds port]Rtc doesn't work properly in fire red rom hacks. #971

Closed Kirit29 closed 6 years ago

Kirit29 commented 6 years ago

I've tried to get rtc to work in gba rom hacks of fire red for years now. But the in-game time doesn't sync up with the system time. I've tried overrides, hex editing the rom. No dice. I know fire red doesnt have rtc natively but there must be a way to emulate it properly with rom hacks, because gpsp on 3ds does it. I would love to use mgba over gpsp. Mainly because gpsp has a majorly annoying bug with dynarec that causes crashing randomly. Your emu is so much more stable.

Kirit29 commented 6 years ago

If you want i can link you a patch of a rom hack that implements this feature. If thats alright.

endrift commented 6 years ago

Use a dev build.

Some ROM hacks won't work because FireRed doesn't have an RTC and they're trying to use hardware that 99% of cartridges don't have. It's basically impossible to detect which ROM hacks will use the RTC ahead of time to enable it.

Kirit29 commented 6 years ago

Ok I will try that. Sucks that it's nigh impossible. Just out of curiosity do you know how gpsp does it?

endrift commented 6 years ago

Since gpSP doesn't care about accuracy it might just have the hardware "attached" at all times. I can probably add an option to do that, but I don't want it on by default since it could conceivably break other games.

The dev builds have a hack that tries to tell if it's a ROM hack of FireRed. It's reasonably good but not perfect.

Kirit29 commented 6 years ago

Cool. If your willing to implement that it would be awesome. Not just for me but for alot of people i know. But only if your willing of course!

Kirit29 commented 6 years ago

Hmm.The dev build seems to crash every time i load a rom. Any ideas?

endrift commented 6 years ago

No clue. Which 3DS (old vs new) and 3DSX vs CIA? Also, do you have any special characters (e.g. accent marks, Japanese characters, etc) in your filenames or paths?

Kirit29 commented 6 years ago

I'm using new3ds cia build
with no special characters used. They are all firered rom hacks. They all booted before i updated to the dev build tho. Would you like the arm11 crash dump?

endrift commented 6 years ago

Do regular ROMs work? And sure, if you can tell me which specific build it is.

Kirit29 commented 6 years ago

Yes regular roms do work. Im using build Revision 5009-ed21eeb which i think is the latest commit.

crash_dump_00000055.zip

endrift commented 6 years ago

OK crash fixed, it'll be posted on the site in ~20 minutes (I hope).

endrift commented 6 years ago

Any updates on this with new builds?

Kirit29 commented 6 years ago

Srry life got in the way. Anyway. The commits you made four days ago fixed the crashing. But the rtc still wasn't emulated properly in my rom hacks. Haven't tried the recent builds yet due to job responsibilities tho.

Kirit29 commented 6 years ago

Ok newest builds dont fix rom hacks rtc. Are you willing to try that "hardware is always attached thing" that gpsp might be doing?

endrift commented 6 years ago

First tell me the names of the ROM hacks you're trying out to see if there's anything less drastic I can do

Kirit29 commented 6 years ago

ok here they are pokemon adventures red's chapter beta 13 part 1 - https://www.pokecommunity.com/showthread.php?t=392522 Pokemon Normal version - https://www.pokecommunity.com/showthread.php?t=285739 Pokemon Cloud white 1,2,&3 http://pokemoncloudwhite.com/ those are the one i play now I'm very grateful for your help!

Kirit29 commented 6 years ago

Any update on this?

endrift commented 6 years ago

Forgot to look at it, sorry. Won't have a chance until tonight.

endrift commented 6 years ago

Ok, so I made some accuracy improvements to the RTC code--turns out it was buggy. But it's still not working because the RTC code in the FireRed ROM hacks is busted too--it doesn't adjust the GPIO pin direction properly meaning it wouldn't work on a real cartridge. The ROM hacks need to be updated.

endrift commented 6 years ago

Try this patch on Red's Chapter and the latest build of mGBA (https://s3.amazonaws.com/mgba/build/mGBA-build-2018-02-04-3ds-5026-1a6b47a29fd13716f71385abc87d00a052b46ea1.7z or newer).

Kirit29 commented 6 years ago

That did the trick!! It is is working perfectly!

Kirit29 commented 6 years ago

will it work on other rom hacks or is it a per game patch thing.

endrift commented 6 years ago

The offsets may be different for other ROM hacks so it'd need a custom patch per.

endrift commented 6 years ago

Closing because it's as fixed as it can get on the mGBA side.