From 4a6d595e5171ed4dc3742c3ff43e771b731a9716 Mon Sep 17 00:00:00 2001 From: scnorton Date: Mon, 5 Jun 2017 16:34:47 -0400 Subject: Assign types to structures passed to secret base exchange packet receipt subroutine staged for decompilation; decompile sub_8041324 --- src/daycare.c | 84 +++++++++++++++++------------------------------------------ 1 file changed, 24 insertions(+), 60 deletions(-) (limited to 'src/daycare.c') diff --git a/src/daycare.c b/src/daycare.c index 92be45cfa..5bcbff6af 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -1,5 +1,7 @@ #include "global.h" #include "pokemon.h" +#include "species.h" +#include "items.h" #include "string_util.h" #include "asm.h" @@ -34,67 +36,29 @@ u8 Daycare_CountPokemon(struct BoxPokemon *daycare_data) } #ifndef ASDF -__attribute__((naked)) -void sub_8041324(struct BoxPokemon * box_pokemon, void * void_pointer) +void sub_8041324(struct BoxPokemon * box_pokemon, struct RecordMixing_UnknownStruct * void_pointer) { - asm(".syntax unified\n\ - push {r4-r7,lr}\n\ - mov r7, r10\n\ - mov r6, r9\n\ - mov r5, r8\n\ - push {r5-r7}\n\ - mov r9, r0\n\ - mov r10, r1\n\ - movs r7, 0\n\ - movs r5, 0\n\ - mov r6, r10\n\ - adds r6, 0x74\n\ - movs r0, 0x1\n\ - mov r8, r0\n\ -_0804133E:\n\ - lsls r0, r5, 2\n\ - adds r0, r5\n\ - lsls r0, 4\n\ - mov r1, r9\n\ - adds r4, r1, r0\n\ - adds r0, r4, 0\n\ - movs r1, 0xB\n\ - bl GetBoxMonData\n\ - cmp r0, 0\n\ - beq _0804136E\n\ - adds r0, r7, 0x1\n\ - lsls r0, 24\n\ - lsrs r7, r0, 24\n\ - adds r0, r4, 0\n\ - movs r1, 0xC\n\ - bl GetBoxMonData\n\ - adds r1, r0, 0\n\ - cmp r1, 0\n\ - bne _0804136E\n\ - lsls r0, r5, 1\n\ - adds r0, r6, r0\n\ - b _08041374\n\ -_0804136E:\n\ - lsls r0, r5, 1\n\ - adds r0, r6, r0\n\ - mov r1, r8\n\ -_08041374:\n\ - strh r1, [r0]\n\ - adds r0, r5, 0x1\n\ - lsls r0, 24\n\ - lsrs r5, r0, 24\n\ - cmp r5, 0x1\n\ - bls _0804133E\n\ - mov r0, r10\n\ - str r7, [r0, 0x70]\n\ - pop {r3-r5}\n\ - mov r8, r3\n\ - mov r9, r4\n\ - mov r10, r5\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ - .syntax divided\n"); + u8 i; + u8 specCount; + specCount = 0; + for (i=0; i<2; i++) + { + if (GetBoxMonData(&box_pokemon[i], MON_DATA_SPECIES) != SPECIES_NONE) + { + specCount ++; + if (GetBoxMonData(&box_pokemon[i], MON_DATA_HELD_ITEM) == ITEM_NONE) + { + void_pointer->unk74[i] = 0; + } else + { + void_pointer->unk74[i] = 1; + } + } else + { + void_pointer->unk74[i] = 1; + } + } + void_pointer->unk70 = specCount; } #endif -- cgit v1.2.3 From d8f4d3da44d52ac56d93a41edb24cf0a803f5c67 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 14 Jun 2017 23:02:07 -0400 Subject: Remove unnecessary macros --- src/daycare.c | 2 -- 1 file changed, 2 deletions(-) mode change 100644 => 100755 src/daycare.c (limited to 'src/daycare.c') diff --git a/src/daycare.c b/src/daycare.c old mode 100644 new mode 100755 index 5bcbff6af..381450a0b --- a/src/daycare.c +++ b/src/daycare.c @@ -35,7 +35,6 @@ u8 Daycare_CountPokemon(struct BoxPokemon *daycare_data) return count; } -#ifndef ASDF void sub_8041324(struct BoxPokemon * box_pokemon, struct RecordMixing_UnknownStruct * void_pointer) { u8 i; @@ -60,7 +59,6 @@ void sub_8041324(struct BoxPokemon * box_pokemon, struct RecordMixing_UnknownStr } void_pointer->unk70 = specCount; } -#endif s8 Daycare_FindEmptySpot(struct BoxPokemon * daycare_data) { -- cgit v1.2.3