Jump to content

Recommended Posts

Posted

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:

  1. the clock in Littleroot is displaying the correct time
  2. Events are occurring on the TV
  3. 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?

Posted
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. 

 

Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...