You're welcome. But I just realized I goofed up on something really silly.
I load then store the time entry data (parts of it) on 3 separate occasions. I can simply just load all the data with one lmw instruction into r17 thru r31. Lol.
Here's the latest updated source with that fix. this should now be as optimized as possible.
I load then store the time entry data (parts of it) on 3 separate occasions. I can simply just load all the data with one lmw instruction into r17 thru r31. Lol.
Here's the latest updated source with that fix. this should now be as optimized as possible.
Code:
#Code creator: WhatIsLoaf
#Time Entry Packet Symbol Map
#0x1 (halfword) Milliseconds
#0x4 (word) Minutes, Seconds, then Milliseconds
#0x8 thru 0x53 Entire Mii Data including its CRC16 checksum; 0x4C in size
#0x57 (byte) Controller; 0 - Wheel, 1 - Wiichuck, 2 - Classic, 3 - GCN; useful if you wanna display wheel icon
#0x60 (byte) Country Code, use 0xFF to disable flag or use a country code that normally doesn't have a flag
#0x61 (byte) State Code (location within country), editing this is useless for this code
#0x62 (halfword) Location Code (location within state, this was never implemented/finalized in mkwii); useless to edit
#Address Ports
#NTSC-U = 806414CC
#PAL = 8060BFAC
#NTSC-J = 8060B720
#NTSC-K = 805FA3CC
#Backup Global Variable Registers (r18 thru r31), 0x3C amount of space for all the data of each time entry
stmw r17, -0x3C (sp) #No function calls in code, safe to do
#FYI: LR is already backed up in r0
#Set r4 as 0 (friend rankings) to skip WFC connect
li r4, 0 #Default instruction not needed as r4's value is now set
#Change Byte in memory back to 1 (Regionals); Friend Rankings won't show for some reason
li r12, 1
stw r12, 0x58 (r3) # change to continental rankings (rankings don't show for some reason when it's a friend ranking)
#Set Amount of Entries (1 thru 10)
li r12, 1 #1 used just for compilation, !!!adjust this for how many time entries will be used in the code!!!
stw r12, 0x60 (r3) # set amount of times to show
mtctr r12
#Set r11 to point where the first data needs to be written to (start of Time Entry packet)
addi r11, r3, 0x0068
#Make Mii Data Table
bl read_data
#Note: Garbage values used so source can compile, fill in all values accordingly
.short 0xAAAA #Millisecond
.byte 0xBB #Minute
.byte 0xCC #Second
.llong 0xDDDDDDDDDDDDDDDD #Start of Mii Data
.llong 0xDDDDDDDDDDDDDDDD
.llong 0xDDDDDDDDDDDDDDDD
.llong 0xDDDDDDDDDDDDDDDD
.llong 0xDDDDDDDDDDDDDDDD
.llong 0xDDDDDDDDDDDDDDDD
.llong 0xDDDDDDDDDDDDEEFF #End of Mii Data (does NOT include Creator Name or CRC), then Flag/Country Byte, then Wheel Byte
#!!!FYI: For adding more time entries, simply follow the data template above, and append it accordingly!!!
read_data:
mflr r12
#Loop, based on amount of entries
loop:
#Load all data from current time entry to r17 thru r31
lmw r17, 0 (r12)
#Store Time to proper spots in the Time Entry Packet
sth r17, 0x1 (r11)
stw r17, 0x4 (r11)
#Copy-paste Mii Data to its spot in the Time Entry Packet
stmw r18, 0x8 (r11) #This will cause the halfword of flag and wheel bytes to put into part of the mii data where the creator name goes, but it doesn't matter as long as you use the Bypass Mii Data CRC16 Check code.
#Store Wheel byte, store Flag byte
stb r31, 0x57 (r11) #Wheel; 0 = Yes, 1 = No
sth r31, 0x60 (r11) #Flag; use 0xFF to disable flag, State ID is overwritten but it doesn't matter as that data isn't shown for time rankings
#Increment r12 & r11 for next Time Entry (if applicable)
addi r12, r12, 0x3C
addi r11, r11, 0x68
#Decrement Loop
bdnz+ loop
#Restore LR, already backed up in r0 before code was executed
mtlr r0
#Restore Global Variable Registers (r17 thru r31)
lmw r17, -0x3C (sp)