Changes

2,360 bytes added ,  16:42, 7 July 2017
Slightly better formatting.
Line 16: Line 16:  
|-
 
|-
 
| 0x14
 
| 0x14
| KD_GetUTCTime
+
| NWC24iGetUniversalTime
| 12 bytes
+
| none
 
| 12 bytes
 
| 12 bytes
 
| Writes the current UTC time to inbuf kd_timebuf->time.
 
| Writes the current UTC time to inbuf kd_timebuf->time.
 
|-
 
|-
 
| 0x15
 
| 0x15
| KD_SetUTCTime
+
| NWC24iSetUniversalTime
 
| 12 bytes  
 
| 12 bytes  
| 12 bytes
+
| 4 bytes
 
| Sets the current UTC time to inbuf kd_timebuf->time.
 
| Sets the current UTC time to inbuf kd_timebuf->time.
 +
|-
 +
| 0x16
 +
| Undefined
 +
| none
 +
| none
 +
| always returns -9
 
|-
 
|-
 
| 0x17
 
| 0x17
 
| NWC24iSetRtcCounter
 
| NWC24iSetRtcCounter
| 12 bytes
+
| 8 bytes
| 12 bytes
+
| 4 bytes
 
| Corrects the internal KD RTC by adding the input u64.
 
| Corrects the internal KD RTC by adding the input u64.
 
|-
 
|-
Line 39: Line 45:  
|  
 
|  
 
|}
 
|}
 +
 +
== Detailed Description ==
 +
/dev/net/kd/time is used to get and set utc and rtc offsets. this is used by things like nwc24's scheduler and the module handles reading and editing of /shared2/wc24/misc.bin
 +
 +
=== KD_GetUTCTime ===
 +
no inbuffer
 +
 +
outbuffer must be >= 0xC bytes and must be 0x4 aligned
 +
 +
if outbuffer is not >= 0xC bytes or outbuffer == NULL the IOS_Ioctl will return -4, else it returns 0
 +
 +
checks if a word is set in the module's memory that indicates the Universal time is ready and returns -30 in outbuffer->retval if not
 +
 +
outbuffer->time is set to the stored utc otherwise
 +
 +
=== KD_SetUTCTime ===
 +
inbuffer must be >= 0xC bytes and must be 0x4 aligned
 +
 +
outbuffer must be >= 0x4 bytes and must be 0x4 aligned
 +
 +
if outbuffer or inbuffer is NULL or are not aligned the IOS_Ioctl will return -4, else it returns 0
 +
 +
struct inbuffer { u64 utc, u32 other_value };
 +
 +
checks that 0x30df3b00 <= utc <= 0xdfaef080 else it sets outbuffer->retval to -3
 +
 +
if utc is ok, it sets the module's struct containing the utc and the other_value
 +
 +
=== Undefined ===
 +
no buffers checked
 +
 +
always returns -9 from IOS_Ioctl
 +
 +
=== NWC24iSetRtcCounter ===
 +
inbuffer must be >= 0x8 bytes and must be 0x4 aligned
 +
 +
outbuffer must be >= 0x4 bytes and must be 0x4 aligned
 +
 +
if outbuffer or inbuffer is NULL or not aligned the IOS_Ioctl will return -4, else it returns 0
 +
 +
struct inbuffer { u32 rtc_value, u32 other_value };
 +
 +
other_value is checked for the lowest bit to be either 0 or 1 which sets a word in memory
 +
 +
this function messes with the /shared2/wc24/misc.bin file and by reading and writing utc data to/from it
 +
 +
it also sets utc when it needs to be synchronized due to offset
 +
 +
outbuffer->retval will always hold 0 if the IOS_Ioctl doesn't return -4
 +
 +
=== NWC24iGetTimeDifference ===
 +
inbuffer is not checked
 +
 +
outbuffer must be >= 0xC bytes and must be 0x4 aligned
 +
 +
if outbuffer is NULL or not aligned the IOS_Ioctl will return -4
 +
 +
if the module's memory indicates no time difference the IOS_Ioctl will return -30
 +
 +
else it returns 0
 +
 +
outbuffer->retval could hold the outbuffer address & 3 if:
 +
 +
a) it wasn't doing a 32bit write to an unaligned address
 +
 +
b) it didn't jump to return -4 from the Ioctl when it was unaligned
 +
 +
so it'll always hold 0
 +
 +
outbuffer->time will hold the timedifference
 +
 +
[[Category:Wii Filesystem]]
219

edits