diff --git a/asm/data/code_102c80.rodata.s b/asm/data/code_102c80.rodata.s index 34905aa695..d939295bae 100644 --- a/asm/data/code_102c80.rodata.s +++ b/asm/data/code_102c80.rodata.s @@ -115,9 +115,3 @@ glabel D_802EB150 glabel D_802EB158 .double 6.283180236816406 - -glabel jtbl_802EB160_10C9E0 -.word L802E2F78_1047F8, L802E2FA4_104824, L802E2FA4_104824, L802E2FA4_104824, L802E2FA4_104824, L802E2FA4_104824, L802E2FA4_104824, L802E2FA4_104824, L802E2F30_1047B0, L802E2F48_1047C8, L802E2F60_1047E0, L802E2F30_1047B0, L802E2F48_1047C8, L802E2F60_1047E0 - -glabel jtbl_802EB198_10CA18 -.word L802E305C_1048DC, L802E3064_1048E4, L802E3064_1048E4, L802E3064_1048E4, L802E3064_1048E4, L802E3064_1048E4, L802E3064_1048E4, L802E3064_1048E4, L802E3014_104894, L802E302C_1048AC, L802E3044_1048C4, L802E3020_1048A0, L802E3038_1048B8, L802E3050_1048D0 diff --git a/include/common.h b/include/common.h index 58307f008e..8e785491ea 100644 --- a/include/common.h +++ b/include/common.h @@ -11,6 +11,5 @@ #include "si.h" #include "messages.h" #include "ld_addrs.h" -#include "stdarg.h" #endif diff --git a/include/common_structs.h b/include/common_structs.h index 03cbec5c97..6b91843409 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -326,13 +326,15 @@ typedef UNK_TYPE* DynamicEntityList[MAX_DYNAMIC_ENTITIES]; typedef struct StaticEntityData { /* 0x00 */ s16 flags; /* 0x02 */ s16 argSize; - /* 0x04 */ char unk_04[8]; + /* 0x04 */ UNK_PTR unk_04; + /* 0x08 */ char unk_08[4]; /* 0x0C */ UNK_FUN_PTR(unk_data_func); /* 0x10 */ UNK_PTR unk_data_ptr1; /* 0x14 */ UNK_PTR unk_data_ptr2; /* 0x18 */ s32 dmaStart; /* 0x1C */ s32 dmaEnd; - /* 0x20 */ char unk_20[4]; + /* 0x20 */ s8 entityType; + /* 0x21 */ char unk_21[3]; } StaticEntityData; // size = 0x24 typedef struct MusicPlayer { diff --git a/include/stdarg.h b/include/stdlib/stdarg.h similarity index 90% rename from include/stdarg.h rename to include/stdlib/stdarg.h index 3bafc522d8..24f3383198 100644 --- a/include/stdarg.h +++ b/include/stdlib/stdarg.h @@ -65,9 +65,9 @@ #ifndef __GNUC_VA_LIST #define __GNUC_VA_LIST #if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || defined(__NetBSD__) -typedef char* __gnuc_va_list; +typedef char *__gnuc_va_list; #else -typedef void* __gnuc_va_list; +typedef void *__gnuc_va_list; #endif #endif @@ -86,28 +86,28 @@ typedef void* __gnuc_va_list; (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) #endif -#define va_start(AP, LASTARG) \ +#define va_start(AP, LASTARG) \ (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG))) #undef va_end -void va_end(__gnuc_va_list); /* Defined in libgcc.a */ -#define va_end(AP) ((void)0) +void va_end (__gnuc_va_list); /* Defined in libgcc.a */ +#define va_end(AP) ((void)0) /* We cast to void * and then to TYPE * because this avoids a warning about increasing the alignment requirement. */ #if (defined (__arm__) && ! defined (__ARMEB__)) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__) /* This is for little-endian machines; small args are padded upward. */ -#define va_arg(AP, TYPE) \ - (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \ +#define va_arg(AP, TYPE) \ + (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \ *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE)))) #else /* big-endian */ /* This is for big-endian machines; small args are padded downward. */ -#define va_arg(AP, TYPE) \ - (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \ - *((TYPE *) (void *) ((char *) (AP) \ - - ((sizeof (TYPE) < __va_rounded_size (char) \ - ? sizeof (TYPE) : __va_rounded_size (TYPE)))))) +#define va_arg(AP, TYPE) \ + (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \ + *((TYPE *) (void *) ((char *) (AP) \ + - ((sizeof (TYPE) < __va_rounded_size (char) \ + ? sizeof (TYPE) : __va_rounded_size (TYPE)))))) #endif /* big-endian */ /* Copy __gnuc_va_list into another variable of this type. */ @@ -136,7 +136,7 @@ void va_end(__gnuc_va_list); /* Defined in libgcc.a */ /* Define va_list, if desired, from __gnuc_va_list. */ /* We deliberately do not define va_list when called from stdio.h, because ANSI C says that stdio.h is not supposed to define - va_list. stdio.h needs to have access to that data type, + va_list. stdio.h needs to have access to that data type, but must not use that name. It should use the name __gnuc_va_list, which is safe because it is reserved for the implementation. */ diff --git a/include/va-mips.h b/include/stdlib/va-mips.h similarity index 52% rename from include/va-mips.h rename to include/stdlib/va-mips.h index 2960eacb29..a622199388 100644 --- a/include/va-mips.h +++ b/include/stdlib/va-mips.h @@ -16,17 +16,17 @@ #if defined (__mips_eabi) && ! defined (__mips_soft_float) && ! defined (__mips_single_float) typedef struct { - /* Pointer to FP regs. */ - char* __fp_regs; - /* Number of FP regs remaining. */ - int __fp_left; - /* Pointer to GP regs followed by stack parameters. */ - char* __gp_regs; + /* Pointer to FP regs. */ + char *__fp_regs; + /* Number of FP regs remaining. */ + int __fp_left; + /* Pointer to GP regs followed by stack parameters. */ + char *__gp_regs; } __gnuc_va_list; #else /* ! (defined (__mips_eabi) && ! defined (__mips_soft_float) && ! defined (__mips_single_float)) */ -typedef char* __gnuc_va_list; +typedef char * __gnuc_va_list; #endif /* ! (defined (__mips_eabi) && ! defined (__mips_soft_float) && ! defined (__mips_single_float)) */ #endif /* not __GNUC_VA_LIST */ @@ -38,26 +38,26 @@ typedef char* __gnuc_va_list; #ifndef _VA_MIPS_H_ENUM #define _VA_MIPS_H_ENUM enum { - __no_type_class = -1, - __void_type_class, - __integer_type_class, - __char_type_class, - __enumeral_type_class, - __boolean_type_class, - __pointer_type_class, - __reference_type_class, - __offset_type_class, - __real_type_class, - __complex_type_class, - __function_type_class, - __method_type_class, - __record_type_class, - __union_type_class, - __array_type_class, - __string_type_class, - __set_type_class, - __file_type_class, - __lang_type_class + __no_type_class = -1, + __void_type_class, + __integer_type_class, + __char_type_class, + __enumeral_type_class, + __boolean_type_class, + __pointer_type_class, + __reference_type_class, + __offset_type_class, + __real_type_class, + __complex_type_class, + __function_type_class, + __method_type_class, + __record_type_class, + __union_type_class, + __array_type_class, + __string_type_class, + __set_type_class, + __file_type_class, + __lang_type_class }; #endif @@ -93,28 +93,28 @@ enum { #if defined (__mips_eabi) #if ! defined (__mips_soft_float) && ! defined (__mips_single_float) #ifdef __mips64 -#define va_start(__AP, __LASTARG) \ - (__AP.__gp_regs = ((char *) __builtin_next_arg (__LASTARG) \ - - (__builtin_args_info (2) < 8 \ - ? (8 - __builtin_args_info (2)) * __va_reg_size \ - : 0)), \ - __AP.__fp_left = 8 - __builtin_args_info (3), \ +#define va_start(__AP, __LASTARG) \ + (__AP.__gp_regs = ((char *) __builtin_next_arg (__LASTARG) \ + - (__builtin_args_info (2) < 8 \ + ? (8 - __builtin_args_info (2)) * __va_reg_size \ + : 0)), \ + __AP.__fp_left = 8 - __builtin_args_info (3), \ __AP.__fp_regs = __AP.__gp_regs - __AP.__fp_left * __va_reg_size) #else /* ! defined (__mips64) */ -#define va_start(__AP, __LASTARG) \ - (__AP.__gp_regs = ((char *) __builtin_next_arg (__LASTARG) \ - - (__builtin_args_info (2) < 8 \ - ? (8 - __builtin_args_info (2)) * __va_reg_size \ - : 0)), \ - __AP.__fp_left = (8 - __builtin_args_info (3)) / 2, \ - __AP.__fp_regs = __AP.__gp_regs - __AP.__fp_left * 8, \ +#define va_start(__AP, __LASTARG) \ + (__AP.__gp_regs = ((char *) __builtin_next_arg (__LASTARG) \ + - (__builtin_args_info (2) < 8 \ + ? (8 - __builtin_args_info (2)) * __va_reg_size \ + : 0)), \ + __AP.__fp_left = (8 - __builtin_args_info (3)) / 2, \ + __AP.__fp_regs = __AP.__gp_regs - __AP.__fp_left * 8, \ __AP.__fp_regs = (char *) ((int) __AP.__fp_regs & -8)) #endif /* ! defined (__mips64) */ #else /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float) ) */ -#define va_start(__AP, __LASTARG) \ - (__AP = ((__gnuc_va_list) __builtin_next_arg (__LASTARG) \ - - (__builtin_args_info (2) >= 8 ? 0 \ - : (8 - __builtin_args_info (2)) * __va_reg_size))) +#define va_start(__AP, __LASTARG) \ + (__AP = ((__gnuc_va_list) __builtin_next_arg (__LASTARG) \ + - (__builtin_args_info (2) >= 8 ? 0 \ + : (8 - __builtin_args_info (2)) * __va_reg_size))) #endif /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float) ) */ #else /* ! defined (__mips_eabi) */ #define va_start(__AP, __LASTARG) \ @@ -131,33 +131,33 @@ enum { #if defined (__mips_eabi) #if ! defined (__mips_soft_float) && ! defined (__mips_single_float) #ifdef __mips64 -#define va_start(__AP) \ - (__AP.__gp_regs = ((char *) __builtin_next_arg () \ - - (__builtin_args_info (2) < 8 \ - ? (8 - __builtin_args_info (2)) * __va_reg_size \ - : __va_reg_size)), \ - __AP.__fp_left = 8 - __builtin_args_info (3), \ +#define va_start(__AP) \ + (__AP.__gp_regs = ((char *) __builtin_next_arg () \ + - (__builtin_args_info (2) < 8 \ + ? (8 - __builtin_args_info (2)) * __va_reg_size \ + : __va_reg_size)), \ + __AP.__fp_left = 8 - __builtin_args_info (3), \ __AP.__fp_regs = __AP.__gp_regs - __AP.__fp_left * __va_reg_size) #else /* ! defined (__mips64) */ -#define va_start(__AP) \ - (__AP.__gp_regs = ((char *) __builtin_next_arg () \ - - (__builtin_args_info (2) < 8 \ - ? (8 - __builtin_args_info (2)) * __va_reg_size \ - : __va_reg_size)), \ - __AP.__fp_left = (8 - __builtin_args_info (3)) / 2, \ - __AP.__fp_regs = __AP.__gp_regs - __AP.__fp_left * 8, \ +#define va_start(__AP) \ + (__AP.__gp_regs = ((char *) __builtin_next_arg () \ + - (__builtin_args_info (2) < 8 \ + ? (8 - __builtin_args_info (2)) * __va_reg_size \ + : __va_reg_size)), \ + __AP.__fp_left = (8 - __builtin_args_info (3)) / 2, \ + __AP.__fp_regs = __AP.__gp_regs - __AP.__fp_left * 8, \ __AP.__fp_regs = (char *) ((int) __AP.__fp_regs & -8)) #endif /* ! defined (__mips64) */ #else /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float)) */ -#define va_start(__AP) \ - (__AP = ((__gnuc_va_list) __builtin_next_arg () \ - - (__builtin_args_info (2) >= 8 ? __va_reg_size \ - : (8 - __builtin_args_info (2)) * __va_reg_size))) +#define va_start(__AP) \ + (__AP = ((__gnuc_va_list) __builtin_next_arg () \ + - (__builtin_args_info (2) >= 8 ? __va_reg_size \ + : (8 - __builtin_args_info (2)) * __va_reg_size))) #endif /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float)) */ /* Need alternate code for _MIPS_SIM_ABI64. */ #elif defined(_MIPS_SIM) && (_MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32) -#define va_start(__AP) \ - (__AP = (__gnuc_va_list) __builtin_next_arg () \ +#define va_start(__AP) \ + (__AP = (__gnuc_va_list) __builtin_next_arg () \ + (__builtin_args_info (2) >= 8 ? -8 : 0)) #else #define va_start(__AP) __AP = (char *) &__builtin_va_alist @@ -165,67 +165,67 @@ enum { #endif /* ! _STDARG_H */ #ifndef va_end -void va_end(__gnuc_va_list); /* Defined in libgcc.a */ +void va_end (__gnuc_va_list); /* Defined in libgcc.a */ #endif -#define va_end(__AP) ((void)0) +#define va_end(__AP) ((void)0) #if defined (__mips_eabi) #if ! defined (__mips_soft_float) && ! defined (__mips_single_float) #ifdef __mips64 -#define __va_next_addr(__AP, __type) \ - ((__builtin_classify_type (*(__type *) 0) == __real_type_class \ - && __AP.__fp_left > 0) \ - ? (--__AP.__fp_left, (__AP.__fp_regs += 8) - 8) \ +#define __va_next_addr(__AP, __type) \ + ((__builtin_classify_type (*(__type *) 0) == __real_type_class \ + && __AP.__fp_left > 0) \ + ? (--__AP.__fp_left, (__AP.__fp_regs += 8) - 8) \ : (__AP.__gp_regs += __va_reg_size) - __va_reg_size) #else -#define __va_next_addr(__AP, __type) \ - ((__builtin_classify_type (*(__type *) 0) == __real_type_class \ - && __AP.__fp_left > 0) \ - ? (--__AP.__fp_left, (__AP.__fp_regs += 8) - 8) \ - : (((__builtin_classify_type (* (__type *) 0) < __record_type_class \ - && __alignof__ (__type) > 4) \ +#define __va_next_addr(__AP, __type) \ + ((__builtin_classify_type (*(__type *) 0) == __real_type_class \ + && __AP.__fp_left > 0) \ + ? (--__AP.__fp_left, (__AP.__fp_regs += 8) - 8) \ + : (((__builtin_classify_type (* (__type *) 0) < __record_type_class \ + && __alignof__ (__type) > 4) \ ? __AP.__gp_regs = (char *) (((int) __AP.__gp_regs + 8 - 1) & -8) \ - : (char *) 0), \ - (__builtin_classify_type (* (__type *) 0) >= __record_type_class \ - ? (__AP.__gp_regs += __va_reg_size) - __va_reg_size \ - : ((__AP.__gp_regs += __va_rounded_size (__type)) \ - - __va_rounded_size (__type))))) + : (char *) 0), \ + (__builtin_classify_type (* (__type *) 0) >= __record_type_class \ + ? (__AP.__gp_regs += __va_reg_size) - __va_reg_size \ + : ((__AP.__gp_regs += __va_rounded_size (__type)) \ + - __va_rounded_size (__type))))) #endif #else /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float)) */ #ifdef __mips64 -#define __va_next_addr(__AP, __type) \ +#define __va_next_addr(__AP, __type) \ ((__AP += __va_reg_size) - __va_reg_size) #else -#define __va_next_addr(__AP, __type) \ - (((__builtin_classify_type (* (__type *) 0) < __record_type_class \ - && __alignof__ (__type) > 4) \ - ? __AP = (char *) (((int) __AP + 8 - 1) & -8) \ - : (char *) 0), \ - (__builtin_classify_type (* (__type *) 0) >= __record_type_class \ - ? (__AP += __va_reg_size) - __va_reg_size \ - : ((__AP += __va_rounded_size (__type)) \ +#define __va_next_addr(__AP, __type) \ + (((__builtin_classify_type (* (__type *) 0) < __record_type_class \ + && __alignof__ (__type) > 4) \ + ? __AP = (char *) (((int) __AP + 8 - 1) & -8) \ + : (char *) 0), \ + (__builtin_classify_type (* (__type *) 0) >= __record_type_class \ + ? (__AP += __va_reg_size) - __va_reg_size \ + : ((__AP += __va_rounded_size (__type)) \ - __va_rounded_size (__type)))) #endif #endif /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float)) */ #ifdef __MIPSEB__ -#define va_arg(__AP, __type) \ - ((__va_rounded_size (__type) <= __va_reg_size) \ - ? *(__type *) (void *) (__va_next_addr (__AP, __type) \ - + __va_reg_size \ - - sizeof (__type)) \ - : (__builtin_classify_type (*(__type *) 0) >= __record_type_class \ - ? **(__type **) (void *) (__va_next_addr (__AP, __type) \ - + __va_reg_size \ - - sizeof (char *)) \ +#define va_arg(__AP, __type) \ + ((__va_rounded_size (__type) <= __va_reg_size) \ + ? *(__type *) (void *) (__va_next_addr (__AP, __type) \ + + __va_reg_size \ + - sizeof (__type)) \ + : (__builtin_classify_type (*(__type *) 0) >= __record_type_class \ + ? **(__type **) (void *) (__va_next_addr (__AP, __type) \ + + __va_reg_size \ + - sizeof (char *)) \ : *(__type *) (void *) __va_next_addr (__AP, __type))) #else -#define va_arg(__AP, __type) \ - ((__va_rounded_size (__type) <= __va_reg_size) \ - ? *(__type *) (void *) __va_next_addr (__AP, __type) \ - : (__builtin_classify_type (* (__type *) 0) >= __record_type_class \ - ? **(__type **) (void *) __va_next_addr (__AP, __type) \ +#define va_arg(__AP, __type) \ + ((__va_rounded_size (__type) <= __va_reg_size) \ + ? *(__type *) (void *) __va_next_addr (__AP, __type) \ + : (__builtin_classify_type (* (__type *) 0) >= __record_type_class \ + ? **(__type **) (void *) __va_next_addr (__AP, __type) \ : *(__type *) (void *) __va_next_addr (__AP, __type))) #endif @@ -241,11 +241,11 @@ void va_end(__gnuc_va_list); /* Defined in libgcc.a */ #ifdef __MIPSEB__ #define va_arg(__AP, __type) \ ((__type *) (void *) (__AP = (char *) ((((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8) \ - + __va_rounded_size (__type))))[-1] + + __va_rounded_size (__type))))[-1] #else #define va_arg(__AP, __type) \ - ((__AP = (char *) ((((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8) \ - + __va_rounded_size (__type))), \ + ((__AP = (char *) ((((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8) \ + + __va_rounded_size (__type))), \ *(__type *) (void *) (__AP - __va_rounded_size (__type))) #endif @@ -253,19 +253,19 @@ void va_end(__gnuc_va_list); /* Defined in libgcc.a */ #ifdef __MIPSEB__ /* For big-endian machines. */ -#define va_arg(__AP, __type) \ - ((__AP = (char *) ((__alignof__ (__type) > 4 \ - ? ((int)__AP + 8 - 1) & -8 \ - : ((int)__AP + 4 - 1) & -4) \ - + __va_rounded_size (__type))), \ +#define va_arg(__AP, __type) \ + ((__AP = (char *) ((__alignof__ (__type) > 4 \ + ? ((int)__AP + 8 - 1) & -8 \ + : ((int)__AP + 4 - 1) & -4) \ + + __va_rounded_size (__type))), \ *(__type *) (void *) (__AP - __va_rounded_size (__type))) #else /* For little-endian machines. */ -#define va_arg(__AP, __type) \ - ((__type *) (void *) (__AP = (char *) ((__alignof__(__type) > 4 \ - ? ((int)__AP + 8 - 1) & -8 \ - : ((int)__AP + 4 - 1) & -4) \ - + __va_rounded_size(__type))))[-1] +#define va_arg(__AP, __type) \ + ((__type *) (void *) (__AP = (char *) ((__alignof__(__type) > 4 \ + ? ((int)__AP + 8 - 1) & -8 \ + : ((int)__AP + 4 - 1) & -4) \ + + __va_rounded_size(__type))))[-1] #endif #endif #endif /* ! defined (__mips_eabi) */ diff --git a/include/varargs.h b/include/stdlib/varargs.h similarity index 93% rename from include/varargs.h rename to include/stdlib/varargs.h index 03f4d3a7bf..410d06aac6 100644 --- a/include/varargs.h +++ b/include/stdlib/varargs.h @@ -65,7 +65,7 @@ #ifdef _ANSI_STDARG_H_ #define _VA_LIST_ #endif -#define _ANSI_STDARG_H_ +#define _ANSI_STDARG_H_ #undef va_alist #undef va_dcl @@ -97,15 +97,15 @@ #ifndef __GNUC_VA_LIST #define __GNUC_VA_LIST #if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) -typedef char* __gnuc_va_list; +typedef char *__gnuc_va_list; #else -typedef void* __gnuc_va_list; +typedef void *__gnuc_va_list; #endif #endif #define va_start(AP) AP=(char *) &__builtin_va_alist -#define va_end(AP) ((void)0) +#define va_end(AP) ((void)0) #if defined(sysV68) #define __va_rounded_size(TYPE) \ @@ -117,16 +117,16 @@ typedef void* __gnuc_va_list; #if (defined (__arm__) && ! defined (__ARMEB__)) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__) /* This is for little-endian machines; small args are padded upward. */ -#define va_arg(AP, TYPE) \ - (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \ +#define va_arg(AP, TYPE) \ + (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \ *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE)))) #else /* big-endian */ /* This is for big-endian machines; small args are padded downward. */ -#define va_arg(AP, TYPE) \ - (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \ - *((TYPE *) (void *) ((char *) (AP) \ - - ((sizeof (TYPE) < __va_rounded_size (char) \ - ? sizeof (TYPE) : __va_rounded_size (TYPE)))))) +#define va_arg(AP, TYPE) \ + (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \ + *((TYPE *) (void *) ((char *) (AP) \ + - ((sizeof (TYPE) < __va_rounded_size (char) \ + ? sizeof (TYPE) : __va_rounded_size (TYPE)))))) #endif /* big-endian */ /* Copy __gnuc_va_list into another variable of this type. */ diff --git a/src/code_102c80.c b/src/code_102c80.c index 6c6be1c033..e0f9092269 100644 --- a/src/code_102c80.c +++ b/src/code_102c80.c @@ -574,109 +574,3 @@ void func_802E2BA4(s32 entityIndex) { #else INCLUDE_ASM(s32, "code_102c80", func_802E2BA4); #endif - -// file split -#ifdef NON_MATCHING -// Needs rodata support -void func_802E2EB0(Entity* entity) { - u32 type; - void* a2 = NULL; - void* a1 = NULL; - - ((struct802E1400*)entity->dataBuf)->unk_38 = entity->position.y; - type = get_entity_type((u8)entity->listIndex); - - if ((type - 24) < 3) { - entity->scale.x = 0.5f; - entity->scale.y = 0.5f; - entity->scale.z = 0.5f; - } - - switch (type) { - case 21: - case 24: - a1 = &D_0A0031E0; - a2 = &D_0A001508; - break; - case 22: - case 25: - a1 = &D_0A0031B0; - a2 = &D_0A0014D8; - break; - case 23: - case 26: - a1 = &D_0A002F78; - a2 = &D_0A001218; - break; - case 13: - play_sound_at_position(0x158, 0, entity->position.x, entity->position.y, entity->position.z); - a1 = &D_0A003F70; - a2 = &D_0A002318; - break; - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - break; - } - - if (a2 == NULL) { - return; - } - - func_802E246C(entity, a1, a2); -} -#else -INCLUDE_ASM(void, "code_102c80", func_802E2EB0, Entity* entity); -#endif - -#ifdef NON_MATCHING -//Needs rodata support -void func_802E2FD0(Entity* entity) { - u32 type; - void* addr = NULL; - - type = get_entity_type(entity->listIndex); - - switch (type) { - case 21: - addr = &D_802E9C8C; - break; - case 24: - addr = &D_802E9CF8; - break; - case 22: - addr = &D_802E9CB0; - break; - case 25: - addr = &D_802E9D1C; - break; - case 23: - addr = &D_802E9CD4; - break; - case 26: - addr = &D_802E9D40; - break; - case 13: - addr = &D_802E9D64; - break; - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - break; - } - - if (addr == NULL) { - return; - } - - create_entity(addr, entity->position.x, entity->position.y, entity->position.z, 0, 0x80000000); -} -#else -INCLUDE_ASM(s32, "code_102c80", func_802E2FD0); -#endif diff --git a/src/code_104730.c b/src/code_104730.c index 585e174008..2a4d76d6b3 100644 --- a/src/code_104730.c +++ b/src/code_104730.c @@ -1,5 +1,139 @@ #include "common.h" -INCLUDE_ASM(s32, "code_104730", func_802E2EB0); +extern UNK_TYPE D_0A0031E0; +extern UNK_TYPE D_0A001508; +extern UNK_TYPE D_0A0031B0; +extern UNK_TYPE D_0A0014D8; +extern UNK_TYPE D_0A002F78; +extern UNK_TYPE D_0A001218; +extern UNK_TYPE D_0A003F70; +extern UNK_TYPE D_0A002318; -INCLUDE_ASM(s32, "code_104730", func_802E2FD0); +void func_802E2EB0(Entity* entity) { + u32 type; + void* a2 = NULL; + void* a1 = NULL; + + ((struct802E1400*)entity->dataBuf)->unk_38 = entity->position.y; + type = get_entity_type((u8)entity->listIndex); + + if ((type - 24) < 3) { + entity->scale.x = 0.5f; + entity->scale.y = 0.5f; + entity->scale.z = 0.5f; + } + + switch (type) { + case 21: + case 24: + a1 = &D_0A0031E0; + a2 = &D_0A001508; + break; + case 22: + case 25: + a1 = &D_0A0031B0; + a2 = &D_0A0014D8; + break; + case 23: + case 26: + a1 = &D_0A002F78; + a2 = &D_0A001218; + break; + case 13: + play_sound_at_position(0x158, 0, entity->position.x, entity->position.y, entity->position.z); + a1 = &D_0A003F70; + a2 = &D_0A002318; + break; + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + break; + } + + if (a2 == NULL) { + return; + } + + func_802E246C(entity, a1, a2); +} + +typedef struct struct802E9C40 { + /* 0x00 */ char unk_00[0x10]; + /* 0x10 */ UNK_PTR unk_10; + /* 0x14 */ char unk_14[0x1C]; +} struct802E9C40; // size = 0x20 + +typedef struct struct802E9C70 { + /* 0x00 */ char unk_00[0x10]; + /* 0x10 */ UNK_PTR unk_10; + /* 0x14 */ char unk_14[8]; +} struct802E9C70; + +extern UNK_TYPE D_802E9828; +void func_802E263C(Entity* entity); + +struct802E9C40 D_802E9C40 = {{0, 0, 0, 7, 0, 0, 0, 0x20, 0, 0, 0, 3, 0, 0, 0, 0}, func_802E263C, {0, 0, 0, 7, 0, 0, 0, 1, 0, 0, 0, 7, 0x20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; +struct802E9C70 D_802E9C70 = {{0, 0, 0, 4, 0, 0, 0, 0x11, 0, 0, 0, 1, 0, 0, 0, 0x3C}, &D_802E9828, {0, 0, 0, 2, 0, 0, 0, 0}}; + +//ROM addrs; todo +extern UNK_TYPE D_00E32420; +extern UNK_TYPE D_00E35670; +extern UNK_TYPE D_00E38890; +extern UNK_TYPE D_00E3B870; +extern UNK_TYPE D_00E3E260; +extern UNK_TYPE D_00E42240; + +StaticEntityData D_802E9C8C = {0, 0x250, &D_802E9C70, {0, 0, 0, 0}, func_802E2EB0, &D_802E9C40, NULL, &D_00E32420, &D_00E35670, 21, {0x10, 0x10, 0x10}}; +StaticEntityData D_802E9CB0 = {0, 0x250, &D_802E9C70, {0, 0, 0, 0}, func_802E2EB0, &D_802E9C40, NULL, &D_00E35670, &D_00E38890, 22, {0x10, 0x10, 0x10}}; +StaticEntityData D_802E9CD4 = {0, 0x250, &D_802E9C70, {0, 0, 0, 0}, func_802E2EB0, &D_802E9C40, NULL, &D_00E38890, &D_00E3B870, 23, {0x10, 0x10, 0x10}}; +StaticEntityData D_802E9CF8 = {0, 0x250, &D_802E9C70, {0, 0, 0, 0}, func_802E2EB0, &D_802E9C40, NULL, &D_00E32420, &D_00E35670, 24, {0x08, 0x08, 0x08}}; +StaticEntityData D_802E9D1C = {0, 0x250, &D_802E9C70, {0, 0, 0, 0}, func_802E2EB0, &D_802E9C40, NULL, &D_00E35670, &D_00E38890, 25, {0x08, 0x08, 0x08}}; +StaticEntityData D_802E9D40 = {0, 0x250, &D_802E9C70, {0, 0, 0, 0}, func_802E2EB0, &D_802E9C40, NULL, &D_00E38890, &D_00E3B870, 26, {0x08, 0x08, 0x08}}; +StaticEntityData D_802E9D64 = {0, 0x250, &D_802E9C70, {0, 0, 0, 0}, func_802E2EB0, &D_802E9C40, NULL, &D_00E3E260, &D_00E42240, 13, {0x08, 0x08, 0x08}}; + +void func_802E2FD0(Entity* entity) { + u32 type; + StaticEntityData* addr = NULL; + + type = get_entity_type(entity->listIndex); + + switch (type) { + case 21: + addr = &D_802E9C8C; + break; + case 24: + addr = &D_802E9CF8; + break; + case 22: + addr = &D_802E9CB0; + break; + case 25: + addr = &D_802E9D1C; + break; + case 23: + addr = &D_802E9CD4; + break; + case 26: + addr = &D_802E9D40; + break; + case 13: + addr = &D_802E9D64; + break; + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + break; + } + + if (addr == NULL) { + return; + } + + create_entity(addr, entity->position.x, entity->position.y, entity->position.z, 0, 0x80000000); +} \ No newline at end of file diff --git a/src/code_1060_len_310.c b/src/code_1060_len_310.c index 7e373371f2..3d05508e2d 100644 --- a/src/code_1060_len_310.c +++ b/src/code_1060_len_310.c @@ -1,4 +1,5 @@ #include "common.h" +#include "stdlib/stdarg.h" u32 func_80025D74(void* arg0, const unsigned char* str, s32 count); diff --git a/tools/splat.yaml b/tools/splat.yaml index 29bfa68e41..f81967e5ff 100644 --- a/tools/splat.yaml +++ b/tools/splat.yaml @@ -308,7 +308,7 @@ segments: files: - [0x102610, c, code_102610_len_2330] - [0x102C80, c] - - [0x104730, c] + - [0x104730, c, code_104730] - [0x104940, c, code_104940_len_dc0] - [0x105700, c, code_105700_len_2130] - [0x105F90, c] @@ -324,7 +324,10 @@ segments: #- [0x10AB70, i4, shadow/10AB70, 32, 32] #- [0x10AD70, i4, shadow/10AD70, 32, 32] - [0x10AF70, bin] # TODO + - [0x10B4C0, .data, code_104730] + - [0x10B608, bin] - [0x10C880, rodata, code_102c80] + - [0x10C9E0, .rodata, code_104730] - [0x10CA50, rodata, code_104940_len_dc0] - [0x10CAF0, bin] - [0x1164B8, ci8, peach_letter, 150, 105] diff --git a/undefined_syms.txt b/undefined_syms.txt index c4486c6114..0f1675b2c5 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -82,3 +82,21 @@ D_0A004350 = 0x0A004350; D_0A0026F0 = 0x0A0026F0; D_00074210 = 0x00074210; D_00074230 = 0x00074230; +D_0A0031E0 = 0x0A0031E0; +D_0A001508 = 0x0A001508; +D_0A0031B0 = 0x0A0031B0; +D_0A0014D8 = 0x0A0014D8; +D_0A002F78 = 0x0A002F78; +D_0A001218 = 0x0A001218; +D_0A003F70 = 0x0A003F70; +D_0A002318 = 0x0A002318; + +D_802E9828 = 0x802E9828; +D_802E9C40 = 0x802E9C40; +D_802E9C70 = 0x802E9C70; +D_00E32420 = 0x00E32420; +D_00E35670 = 0x00E35670; +D_00E38890 = 0x00E38890; +D_00E3B870 = 0x00E3B870; +D_00E3E260 = 0x00E3E260; +D_00E42240 = 0x00E42240; \ No newline at end of file