Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Time in Forecast Channel #5759

Merged
merged 1 commit into from Aug 2, 2017
Merged

Conversation

AwesomeMarioFan
Copy link
Contributor

@AwesomeMarioFan AwesomeMarioFan commented Jul 7, 2017

This change fixes the Forecast Channel in Dolphin. Without it, the channel will display an error upon loading with a valid VFF file on the NAND and WC24 standby mode enabled.

hafe01-5

The error in this case is the channel checking the timestamp in the file and seeing it as invalid. With this change however, the channel will load properly.

hafe01-8

This does not affect the News Channel (which works, however always displays "Updated 00:00 ago" which indicates that this change does not fix the time for that channel). Unlike the Forecast Channel however, the News Channel does not display an error for timestamps out of the update window (so the channel will still load even though the time is incorrect). Setting a custom RTC seems to have no effect on the Forecast Channel, but does on the News Channel.

hage01-1

I'm unsure if this will mess up the time with anything else in Dolphin however since I am not sure why WII_EPOCH is being used. If this will have an adverse effect on other channels, this can instead be changed to a WIP pull request for a better implementation of NWC24/NWC24 time.

@leoetlino
Copy link
Member

Sounds sane to me, but I have no idea if this is a correct fix. It'd be best to have this reviewed by someone who is familiar with KD.

@leoetlino
Copy link
Member

Have you tried /dev/net/kd/time ioctl 0x14 on console? Does the returned time use UTC?

@AwesomeMarioFan
Copy link
Contributor Author

I tried calling 0x14 on /dev/net/kd/time (using IOS58) and I get the following:
Buffer: ff ff ff e2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
The -32 u32 seems to indicate (according to Wiibrew) "Universal time is not ready.".

The description of NWC24iGetUniversalTime on Wiibrew through states that the time is in UTC.

@leoetlino
Copy link
Member

leoetlino commented Jul 10, 2017

IOCTL_NW24_SET_RTC_COUNTER seems to be implemented wrong and to be a noop in Dolphin... This might mess up things.

@sepalani
Copy link
Contributor

@AwesomeMarioFan You probably want to mess with IOCTL_NW24_SET_RTC_COUNTER and IOCTL_NW24_GET_TIME_DIFF in your hardware tests as well. libwc24 labelled the error -32 as "KD_EHTTP - HTTP error or time server error?".

I added INFO_LOGs in Dolphin kd/time so you might want to rebase your PR if you want to read them. The channel uses IOCTL_NW24_SET_RTC_COUNTER then performs IOCTL_NW24_GET_TIME_DIFF. After that I get the error FORE000005, probably because I don't have a vff file. It seems the parameters for IOCTL_NW24_SET_RTC_COUNTER are the current time (Current unix time - Wii epoch) and zero.

@larsenv
Copy link

larsenv commented Jul 12, 2017

@sepalani Wiimmfi's error code lookup simply says -32 is an HTTP error. https://wiimmfi.de/error?e=107232 You should use this error code lookup instead, @AwesomeMarioFan.

FORE000005 happens when there's no VFF. Same with News Channel, as it gives NEWS000005.

Also, the News Channel somewhat has fixed time with this fix enabled, but it doesn't work right. Here's what it looks like when I load a file that's a few hours old (the file was generated at 4 AM, but it was loaded on the News Channel at 10:01 AM):

hage01-8

@leoetlino
Copy link
Member

leoetlino commented Aug 2, 2017

Merging, considering that:

  • it's been a while since the PR was opened;
  • this change makes sense, actually fixes an issue, and is easy to revert if it turns out to be wrong;
  • still no one seems to know where WII_EPOCH comes from. It looks like it's used for the RTC, and IOS doesn't use the RTC.

@leoetlino leoetlino merged commit a8e4a3c into dolphin-emu:master Aug 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants