melonDS
melonDS copied to clipboard
[Regression] RTC does not handle 24h mode anymore
Seems like melonDS atm does not have the 24h mode for rtc, only the 12h one. Maybe it should be good to leave the choice to the user with an setting option(?).
This is the issue i'm facing: gen5 pokemon games don't generate correct initial seeds if the time is set after 12:00 pm. The initial seed is rtc dependant.
The recent rtc commits seem to have caused it. It was working fine before that commit.
This isn't a regression per se, it was only ever ""correct"" on BizHawk once due to its changes, since it took all the changes from upstream (since they make the BizHawk changes obsolete) it "regressed" for BizHawk specifically.
To be clear, what the actual issue here is strange. By default, melonDS is in 12 hour mode. Pokemon games seem to expect 24 hour mode (note that previously, with ""correct"" code, 24 hour mode was always assumed). Reportedly, even booting into firmware and changing the time in firmware did not result in the "correct" seeds, indicating that either the firmware and/or Pokemon does not bother switching to 24 hour mode, or they do but that switch isn't happening correctly for some reason, or the AM/PM flag is simply not being reported correctly in 24 hour mode even when it should be.
The last doesn't seem likely looking at the code, so I could guess it's either the first or second possibilities.
we've been talking about this and apparently the DS just uses 24-hour mode always from what it seems, so we might as well just make that the default
Has there been any progress on the issue or has it been fixed on Git already?
I just tried a small bit of Gen 5 RNG (grabbing the initial seed via both needles and the memory viewer) and it seems like the RNG is working as it should be.
I set the emulated time to 01/01/2000 15:00:00 then I do the usual process of determining the seed I am landing on and it looks the RNG is generating the correct seeds again as PokeFinder was able to find the seed I landed on.
I tested on melonDS's built in firmware, a DS firmware dumped from a DSi and a DS Lite firmware and all three are generating the correct initial seeds, all done via DS (not DSi) mode on standalone melonDS.
From this it looks like the PM flag is being properly set for times after 12PM.
The PM flag is not the issue in the first place. The problem is whether 12 hour mode or 24 hour mode is being used. The default in melonDS upstream is still using 12 hour mode, not 24 hour mode, so the issue is still present. If 24 hour mode was saved at some point somehow for you, you'd also not experience issues.
So how would I know that 24 hour mode was already saved on melonDS/the game I am playing on? Because I do not remember accidentally changing some setting that allowed 24h mode to work properly on melonDS.
Check the rtc.bin file in a hex editor, if byte 0 has bit 1 set, then it's 24 hour mode, if it's not set, it's 12 hour mode.
Byte 0 of rtc.bin has a value of 0x2 which means bit 1 is set (24h mode). Don't know how this happened but now I know my melonDS is not under default settings.
I deleted the rtc.bin file, performed each following action below then viewed it after:
- Booting the NDS lite firmware (resulted in byte 0 =
0x2) - Opening Pokemon Platinum without external firmware (resulted in byte 0 =
0x2) - Opening Pokemon Black without external firmware (resulted in byte 0 =
0x2) - Booting Pokemon Platinum directly with DS firmware (resulted in byte 0 =
0x2) - Booting Pokemon Black directly with DS firmware (resulted in byte 0 =
0x2) - Opening Pokemon Platinum through the firmware (resulted in byte 0 =
0x2) - Opening Pokemon Black through the firmware (resulted in byte 0 =
0x2) - Opening melonDS then closing it without doing anything (resulted in byte 0 =
0x80, but then changed to0x2when followed up with opening either game)
From what I can see, it looks like 24h mode is being properly set and saved in rtc.bin when game or firmware is being booted.
The only reason for 24 hour mode to be set is the game or firmware itself setting it, not melonDS. IIRC, Black would at least be doing this, but only after RNG seeding, so the initial attempt at seeding would not work correctly.