Wii ID NAND Modifier [Vega]
#6
So it appears the CRC subroutine was right above what i just posted.... However, this looks nothing like the CRC32 function that mkwii uses. I doubt this is it... but here it is....

While the instructions might not seem optimized, I'm sure they are. Code warrior (mkw's official compiler) rarely makes optimization mistakes.



r3 = doesnt matter
r4 = file path
r5 = 0
r6 = copy of r4


Wii's CRC32

#Very start

li r0, 0x1F
mr r4, r6
li r5, 0
mtctr r0

start_loop:
lwz r3, 0 (r4)

lwz r0, 0x4 (r4)
add r5, r5, r3

lwz r3, 0x8 (r4)
add r5, r5, r0

lwz r0, 0xC (r4)
add r5, r5, r3

lwz r3, 0x10 (r4)
add r5, r5, r0

lwz r0. 0x14 (r4)
add r5, r5, r3

lwz r3, 0x18 (r4)
add r5, r5, r0

lwz r0, 0x1C (r4)
add r5, r5, r3

addi r4, r4, 0x20
add r5, r5, r0

bdnz+ start_loop #Loop has to be split cuz we can't load final word of file cuz thats the checksum to check compared to calculated one

lwz r3, 0 (r4)

lwz r0, 0x4 (r4)
add r5, r5, r3

lwz r3, 0x8 (r4)
add r5, r5, r0

lwz r0, 0xC (r4)
add r5, r5, r3

lwz r3, 0x10 (r4)
add r5, r5, r0

lwz r0, 0x14 (r4)
add r5, r5, r3

lwz r3, 0x18 (r4) #This will load the final word right before the checksum that is on file
add r5, r5, r0

# Load Checksum that is Stored in file #

lwz r0, 0x3FC (r6)

#

add r5, r5, r3 #One more final instruction to calculate checksum, not sure why they didn't have this instruction before loading the current file's checksum

cmplw r0, r5 #No need for logical compare since its a beq for the next instruction, I guess codewarrior likes logical comparsion for all non negative shit...
Reply


Messages In This Thread
Wii ID NAND Modifier [Vega] - by Vega - 07-24-2019, 10:03 PM
RE: Wii ID NAND Modifier - by JoshuaMK - 07-25-2019, 05:45 AM
RE: Wii ID NAND Modifier - by Vega - 07-25-2019, 04:04 PM
RE: Wii ID NAND Modifier - by Dorian - 07-25-2019, 04:06 PM
RE: Wii ID NAND Modifier - by Vega - 07-25-2019, 07:01 PM
RE: Wii ID NAND Modifier - by Vega - 07-25-2019, 08:22 PM
RE: Wii ID NAND Modifier - by JoshuaMK - 07-25-2019, 08:52 PM
RE: Wii ID NAND Modifier - by Vega - 07-25-2019, 09:21 PM
RE: Wii ID NAND Modifier - by Vega - 07-25-2019, 09:27 PM
RE: Wii ID NAND Modifier - by JoshuaMK - 07-25-2019, 10:22 PM
RE: Wii ID NAND Modifier - by Vega - 07-25-2019, 10:30 PM
RE: Wii ID NAND Modifier - by Vega - 07-27-2019, 02:09 PM
RE: Wii ID NAND Modifier - by JoshuaMK - 07-27-2019, 06:54 PM

Forum Jump:


Users browsing this thread: 4 Guest(s)