3rd Gen Expert Posted November 13 Posted November 13 I have an emerald with a dead battery that I've replaced and I can't seem to properly reset the RTC. I usually use the rtcread homebrew tool via flashcart to set the date and time, and this usually works (reasonably) well. So the following I have tested to be working: the clock in Littleroot is displaying the correct time Events are occurring on the TV Berries are growing normally However, Pacifidlog man quotes a massive number of days before he will give a TM again. In playing with rtcread, I have moved the clock to the last possible date...12/31/2099 23:59:30 (some time to open the game) and the man then states 8 days. Great. So after waiting 30 seconds and the day elapsing it did switch back to 1/1/2000 0:0:0...however the man now says he will get a new TM in 65,227 days...that equates to over 178 years. And considering the RTC cycle for this game only covers 100 years, that number appears theoretically impossible to hit. I have advanced the clock 24 years into the present and the man accurately states that he will get a new TM in about 56,144 days. It almost seems like the timestamp that the last TM was received was corrupted...obtained at an impossible time. Also tried resetting the RTC inside PKHeX but that yielded no new results. Have also tried my save inside an emulator and gotten the same results...what else can I try?
BlackShark Posted November 13 Posted November 13 In PKHeX you can set constant 194 in the event flags research to the current number of elapsed days, or any lower number. That should fix it. 1
3rd Gen Expert Posted November 14 Author Posted November 14 5 hours ago, BlackShark said: In PKHeX you can set constant 194 in the event flags research to the current number of elapsed days, or any lower number. That should fix it. Much appreciated; Counter has reset to 7 days. Will see if it drops to 6 tomorrow.
3rd Gen Expert Posted November 14 Author Posted November 14 It is working again. THANKS! So this value is what is used by the old man...how is it calculated? Why was it not being calculated/updated correctly?
BlackShark Posted November 15 Posted November 15 These are the relevant function: https://github.com/pret/pokeemerald/blob/master/src/field_specials.c#L1555 u16 GetDaysUntilPacifidlogTMAvailable(void) { u16 tmReceivedDay = VarGet(VAR_PACIFIDLOG_TM_RECEIVED_DAY); if (gLocalTime.days - tmReceivedDay >= 7) return 0; else if (gLocalTime.days < 0) return 8; return 7 - (gLocalTime.days - tmReceivedDay); } u16 SetPacifidlogTMReceivedDay(void) { VarSet(VAR_PACIFIDLOG_TM_RECEIVED_DAY, gLocalTime.days); return gLocalTime.days; } gLocalTime.days returns the current days from the RTC. In the Get function the last line "gLocalTime.days - tmReceivedDay" can result in a negative value if tmReceivedDay is greater gLocalTime.days, which can then result in high numbers. But it shouldn't be as high as 65,227.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now