diff --git a/asm/code_80521D0.s b/asm/code_80521D0.s index 0860a727..c7b0327d 100644 --- a/asm/code_80521D0.s +++ b/asm/code_80521D0.s @@ -5,108 +5,6 @@ .text - thumb_func_start sub_80522F4 -sub_80522F4: - push {r4-r7,lr} - adds r6, r0, 0 - adds r4, r1, 0 - adds r7, r2, 0 - bl sub_8045888 - lsls r0, 24 - lsrs r0, 24 - negs r1, r0 - orrs r1, r0 - lsrs r5, r1, 31 - adds r0, r4, 0 - bl sub_8052DC0 - lsls r0, 24 - cmp r0, 0 - beq _08052318 - movs r5, 0x1 -_08052318: - cmp r5, 0 - beq _08052326 - adds r0, r6, 0 - adds r1, r7, 0 - movs r2, 0x1 - bl sub_80523A8 -_08052326: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80522F4 - - thumb_func_start sub_805232C -sub_805232C: - push {r4-r7,lr} - adds r6, r0, 0 - adds r4, r1, 0 - adds r7, r2, 0 - bl sub_8045888 - lsls r0, 24 - lsrs r0, 24 - negs r1, r0 - orrs r1, r0 - lsrs r5, r1, 31 - adds r0, r4, 0 - bl sub_8052DC0 - lsls r0, 24 - cmp r0, 0 - beq _08052350 - movs r5, 0x1 -_08052350: - cmp r5, 0 - beq _0805235E - adds r0, r6, 0 - adds r1, r7, 0 - movs r2, 0 - bl sub_80523A8 -_0805235E: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_805232C - - thumb_func_start sub_8052364 -sub_8052364: - push {r4-r7,lr} - adds r6, r0, 0 - adds r4, r1, 0 - adds r7, r2, 0 - bl sub_8045888 - lsls r0, 24 - lsrs r0, 24 - negs r1, r0 - orrs r1, r0 - lsrs r5, r1, 31 - adds r0, r4, 0 - bl sub_803F428 - lsls r0, 24 - cmp r0, 0 - beq _08052388 - movs r5, 0x1 -_08052388: - cmp r5, 0 - beq _08052396 - adds r0, r6, 0 - adds r1, r7, 0 - movs r2, 0x1 - bl sub_80523A8 -_08052396: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8052364 - - thumb_func_start sub_805239C -sub_805239C: - push {lr} - movs r2, 0x1 - bl sub_80523A8 - pop {r0} - bx r0 - thumb_func_end sub_805239C - thumb_func_start sub_80523A8 sub_80523A8: push {r4-r7,lr} diff --git a/src/code_80521D0.c b/src/code_80521D0.c index 5a723c54..914b02de 100644 --- a/src/code_80521D0.c +++ b/src/code_80521D0.c @@ -1,24 +1,26 @@ #include "global.h" extern void sub_80526D0(u8 r0); -extern u8 sub_8045888(u32 r0, u32 r1, u32 r2, u32 r3); +extern u8 sub_8045888(u32 r0); extern void sub_80523A8(u32 r0, u32 r1, u8 r2); +extern u8 sub_8052DC0(u32); +extern u8 sub_803F428(u32); void sub_805229C(void) { return sub_80526D0(0x50); } -void sub_80522A8(u32 r0, u32 r1, u32 r2, u32 r3) +void sub_80522A8(u32 r0, u32 r1) { - if ((sub_8045888(r0, r1, r2, r3) << 24) != 0){ + if (sub_8045888(r0) != 0){ sub_80523A8(r0, r1, 1); } } -void sub_80522C8(u32 r0, u32 r1, u32 r2, u32 r3) +void sub_80522C8(u32 r0, u32 r1) { - if ((sub_8045888(r0, r1, r2, r3) << 24) != 0){ + if (sub_8045888(r0) != 0){ sub_80523A8(r0, r1, 0); } } @@ -27,3 +29,62 @@ void sub_80522E8(u32 r0, u32 r1) { sub_80523A8(r0, r1, 0); } + +void sub_80522F4(u32 r0, u32 r1, u32 r2) +{ + u8 temp; + u32 temp_reg; + u32 temp2; + temp = sub_8045888(r0); + temp_reg = (-temp | temp); + temp2 = temp_reg >> 31; + if(sub_8052DC0(r1) != 0) + { + temp2 = 1; + } + if(temp2 != 0) + { + sub_80523A8(r0, r2, 1); + } +} + +void sub_805232C(u32 r0, u32 r1, u32 r2) +{ + u8 temp; + u32 temp_reg; + u32 temp2; + temp = sub_8045888(r0); + temp_reg = (-temp | temp); + temp2 = temp_reg >> 31; + if(sub_8052DC0(r1) != 0) + { + temp2 = 1; + } + if(temp2 != 0) + { + sub_80523A8(r0, r2, 0); + } +} + +void sub_8052364(u32 r0, u32 r1, u32 r2) +{ + u8 temp; + u32 temp_reg; + u32 temp2; + temp = sub_8045888(r0); + temp_reg = (-temp | temp); + temp2 = temp_reg >> 31; + if(sub_803F428(r1) != 0) + { + temp2 = 1; + } + if(temp2 != 0) + { + sub_80523A8(r0, r2, 1); + } +} + +void sub_805239C(u32 r0, u32 r1) +{ + sub_80523A8(r0, r1, 1); +}