Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 08074624
- push {r4-r7,lr}
- mov r7, r10
- mov r6, r9
- mov r5, r8
- push {r5-r7}
- add sp, -0x8
- lsl r0, r0, 0x18
- ; r0 = 0 means checksum the save?
- cmp r0, 0x0
- bne _0x08074654
- ; pointer to SRAM
- ldr r2, =0x08754bc8
- ldr r0, =0x03000c1e
- ; aligning 0x02038000 to save data (this is 0x02038000 + saveID*0x1220 + 0x80)
- mov r1, 0x0
- ldrh r1, [r0, r1]
- lsl r0, r1, 0x3
- add r0, r0, r1
- lsl r0, r0, 0x4
- add r0, r0, r1
- lsl r0, r0, 0x5
- add r0, 0x80
- b _0x0807466a
- ; r4 has save pointer
- ldr r1, [r2, 0x0]
- add r4, r1, r0
- mov r1, r4
- mov r2, 0x0
- ldr r6, [r4, 0x10]
- mov r12, r6
- ldr r7, =0x08411410
- ldrb r0, [r4, 0x0]
- mov r9, r0
- ldr r6, =0x08411420
- mov r8, r6
- mov r6, r4
- add r6, 0x4f
- ldr r0, =0x08411430
- mov r10, r0
- ; ?
- mov r0, 0x94
- lsl r0, r0, 0x2
- add r0, r4, r0
- str r0, [sp, 0x4]
- ; r3 = loop counter
- ; r1 is pointed at the start of save data
- ; r2 is initialized at 0
- mov r3, 0x90
- _0x08074692:
- ; add the 0x91 words
- ldmia r1!, {r0}
- add r2, r2, r0
- ldmia r1!, {r0}
- add r2, r2, r0
- ldmia r1!, {r0}
- add r2, r2, r0
- ldmia r1!, {r0}
- add r2, r2, r0
- ldmia r1!, {r0}
- add r2, r2, r0
- ldmia r1!, {r0}
- add r2, r2, r0
- ldmia r1!, {r0}
- add r2, r2, r0
- ldmia r1!, {r0}
- add r2, r2, r0
- sub r3, 0x1
- cmp r3, 0x0
- bge _0x08074692
- mov r5, 0x0
- ; check if the sum = the value in r12 (0x10 relative to save pointer)
- cmp r12, r2
- bne _0x080746c6
- ; second checksum
- ldr r0, [r4, 0x14]
- mvn r0, r0
- cmp r2, r0
- beq _0x08046c8
- _0x080746c6:
- mov r5, 0x1
- _0x080746c8:
- mov r2, 0x0
- mov r3, 0x0
- ldrb r0, [r7, 0x0]
- cmp r0, r9
- beq _0x080746f0
- mov r2, 0x1
- b _0x08074706
- _0x080746f0:
- add r3, 0x1
- cmp r3, 0xf
- bgt _0x08074706
- ; check if two strings match
- add r0, r3, r7
- add r1, r4, r3
- ldrb r0, [r0, 0x0]
- ldrb r1, [r1, 0x0]
- cmp r0, r1
- beq _0x080746f0
- mov r0, 0x1
- orr r2, r0
- _0x08074706:
- mov r3, 0x0
- mov r1, r8
- ldrb r0, [r1, 0x0]
- ldrb r1, [r6, 0x0]
- b _0x08074720
- _0x0874710:
- add r3, 0x1
- cmp r3, 0xf
- bgt _0x08074728
- ; check if two strings match
- mov r1, r8
- add r0, r3, r1
- add r1, r6, r3
- ldrb r0, [r0, 0x0]
- ldrb r1, [r1, 0x0]
- _0x08074720:
- cmp r0, r1
- beq _0x08074710
- mov r0, 0x2
- orr r2, r0
- _0x08074728:
- mov r3, 0x0
- mov r6, r10
- ldrb r0, [r6, 0x0]
- ldr r1, [sp, 0x4]
- b _0x08074746
- _0x08074732:
- add r3, 0x1
- cmp r3, 0xf
- bgt _0x08074750
- ; check if two strings match
- mov r6, r10
- add r0, r3, r6
- mov r6, 0x94
- lsl r6, r6, 0x2
- add r1, r4, r6
- add r1, r1, r3
- ldrb r0, [r0, 0x0]
- _0x08074746:
- ldrb r1, [r1, 0x0]
- cmp r0, r1
- beq _0x08074732
- mov r0, 0x4
- orr r2, r0
- _0x08074750:
- ; checks if the 3 strings are intact
- cmp r2, 0x0
- beq _0x08074760
- cmp r2, 0x7
- bne _0x0807475c
- ; if all strings are damaged
- mov r0, 0x2
- b _0x0807475e
- _0x0807475c:
- mov r0, 0x1
- _0x0807475e:
- orr r5, r0
- _0x08074760:
- cmp r5, 0x1
- ble _0x08074776
- ; code is not executed if all strings are damaged
- ; otherwise it is executed
- ldr r1, =0xffff
- mov r3, 0x91
- lsl r3, r3, 0x5
- mov r0, 0x10
- str r0, [sp, 0x0]
- mov r0, 0x3
- mov r2, r4
- bl 0x080032b4
- _0x08074776:
- ; r5 = 1 (corrupted data)
- ; if the original checksum is messed up
- ; if the words at 0x10 and 0x14 are not negs of each other
- ; r5 = 2 if all the strings are messed up
- ; r5 = 1 + 2 if both occur
- ; 2 and 3 cause data to not be loaded
- mov r0, r5
- add sp, 0x8
- pop {r3-r5}
- mov r8, r3
- mov r9, r4
- mov r10, r5
- pop {r4-r7}
- pop {r1}
- bx r1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement