diff --git a/include/common_structs.h b/include/common_structs.h index 9d14cb123e..39ba265464 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -25,7 +25,9 @@ typedef struct { /* 0x07A */ s8 musicEnabled; /* 0x07B */ char unk_7B; /* 0x07C */ s8 unk_7C; - /* 0x07D */ char unk_7D[4]; + /* 0x07D */ char unk_7D; + /* 0x07E */ s8 unk_7E; + /* 0x07F */ char unk_7F[2]; /* 0x081 */ s8 unk_81; /* 0x082 */ s8 unk_82; /* 0x083 */ s8 unk_83; diff --git a/include/functions.h b/include/functions.h index c533f9d6fd..64534faf37 100644 --- a/include/functions.h +++ b/include/functions.h @@ -19,6 +19,7 @@ s32 func_800554E8(s32, s32); s32 func_800555E4(s32); void func_80137D88(s32, f32); void func_80137E10(s32, u8, u8, u8); +s32 rand_int(s32); s32 play_sound_at_position(s32 soundID, s32 value2, f32 posX, f32 posY, f32 posZ); s32 set_music_track(s32 musicPlayer, s32 songID, s32 variation, s32 unk, s32 volume); diff --git a/papermario.ld b/papermario.ld index 7259eccc4e..841a2c73d8 100644 --- a/papermario.ld +++ b/papermario.ld @@ -843,7 +843,7 @@ SECTIONS } /* 0x00000000 04E5A0-0759B0 [27410] */ - .data0004E5A0 0x0004E5A0 : AT(0x04E5A0) { + .data0004E5A0 0x800731A0 : AT(0x04E5A0) { build/bin/papermario.04E5A0.bin_4e5a0_len_27410.o(.data); } @@ -893,10 +893,19 @@ SECTIONS } /* 0x00000000 090FE0-0A5DD0 [14DF0] */ - .data00090FE0 0x00090FE0 : AT(0x090FE0) { + .data00090FE0 0x800F7B30 : AT(0x090FE0) { build/bin/papermario.090FE0.bin_90fe0_len_14df0.o(.data); } + // uncomment once rodata for is_ability_active is needed. + /*.rodata8010BF60 0x8010BF60 : AT(0xA5410) { + build/src/code_80850_len_3060.o(.rodata) + } + + .data000A54F0 0x8010C040 : AT(0xA54F0) { + build/bin/papermario.0A54F0.bin_0a54f0_len_8e0.o(.data); + }*/ + /* 0x8010F6D0 0A5DD0-0B72B0 [114E0] */ .text8010F6D0 0x8010F6D0 : AT(0x0A5DD0) { build/src/code_a5dd0_len_114e0.o(.text); @@ -958,7 +967,7 @@ SECTIONS } /* 0x00000000 0E16B0-0E79B0 [6300] */ - .data000E16B0 0x000E16B0 : AT(0x0E16B0) { + .data000E16B0 0x8014AFB0 : AT(0x0E16B0) { build/bin/papermario.0E16B0.bin_e5dd0_len_6300.o(.data); } @@ -1003,7 +1012,7 @@ SECTIONS } /* 0x00000000 0FE650-0FEE30 [7E0] */ - .data000FE650 0x000FE650 : AT(0x0FE650) { + .data000FE650 0x802D9CA0 : AT(0x0FE650) { build/bin/papermario.0FE650.bin_fee30_len_7e0.o(.data); } @@ -1018,7 +1027,7 @@ SECTIONS } /* 0x00000000 102480-102610 [190] */ - .data00102480 0x00102480 : AT(0x102480) { + .data00102480 0x802DF390 : AT(0x102480) { build/bin/papermario.102480.bin_102610_len_190.o(.data); } diff --git a/src/code_42e0_len_1f60.c b/src/code_42e0_len_1f60.c index d7c0efcc80..e4a0eb83c8 100644 --- a/src/code_42e0_len_1f60.c +++ b/src/code_42e0_len_1f60.c @@ -42,7 +42,7 @@ INCLUDE_ASM(code_42e0_len_1f60, func_80029934); INCLUDE_ASM(code_42e0_len_1f60, func_80029994); -INCLUDE_ASM(code_42e0_len_1f60, rand_int); +s32 INCLUDE_ASM(code_42e0_len_1f60, rand_int, s32 arg0); INCLUDE_ASM(code_42e0_len_1f60, signF); diff --git a/src/code_80850_len_3060.c b/src/code_80850_len_3060.c index 5f0d001039..8ff2c1466c 100644 --- a/src/code_80850_len_3060.c +++ b/src/code_80850_len_3060.c @@ -1,6 +1,7 @@ #include "common.h" void sort_items(void); +s32 is_ability_active(s32 arg0); void clear_player_data(void) { player_data* playerData = &gPlayerData; @@ -719,6 +720,254 @@ void reset_status_menu(void) { // uses a jumptable, which we need .rodata support for. INCLUDE_ASM(code_80850_len_3060, is_ability_active); +// Somewhat close. Needs work. +/*s32 is_ability_active(s32 arg0) { + s32 iVar2; + u32 uVar3; + s32 iVar5; + s32 piVar6; + s32 i; + s32 local_20[6]; + s32 badge; + player_data* playerData = &gPlayerData; + s32 iVar7 = 0; + u32 uVar4; + + iVar5 = 0; + //iVar7 = 0; + + for(i = 5; i >= 0; i--) { + local_20[i] = 0; + } + + if (((*gGameStatusPtr)->unk_7E & 1) == 0) { + iVar2 = 0; + iVar7 = 0; + piVar6 = 0; + for (i = 0; i < ARRAY_COUNT(playerData->equippedBadges); i++) { + s32 index = i; + badge = playerData->equippedBadges[index]; + if (playerData->equippedBadges[index] != 0) { + uVar4 = gItemTable[badge].moveID; + } + switch (arg0) { + case 0: + uVar3 = 0x4c; + break; + default: + continue; + case 2: + uVar3 = 0x40; + break; + case 3: + uVar3 = 0x4d; + break; + case 4: + uVar3 = 0x52; + break; + case 5: + uVar3 = 0x35; + break; + case 6: + if (uVar4 == 0x53) { + iVar7++; + } + if (playerData->hasActionCommands != 0) { + iVar7++; + } + continue; + case 7: + uVar3 = 0x41; + break; + case 8: + uVar3 = 0x42; + break; + case 9: + uVar3 = 0x5a; + break; + case 10: + uVar3 = 0x3c; + break; + case 0xb: + uVar3 = 0x4e; + break; + case 0xc: + uVar3 = 0x5b; + break; + case 0xd: + uVar3 = 0x3d; + break; + case 0xe: + uVar3 = 0x43; + break; + case 0xf: + if (uVar4 == 0x54) { + local_20[piVar6] = 1; + piVar6++; + iVar5++; + iVar7 = -1; + } + if (uVar4 == 0x55) { + local_20[piVar6] = 2; + piVar6++; + iVar5++; + iVar7 = -1; + } + if (uVar4 == 0x56) { + local_20[piVar6] = 3; + piVar6++; + iVar5++; + iVar7 = -1; + } + if (uVar4 == 0x57) { + local_20[piVar6] = 4; + piVar6++; + iVar5++; + iVar7 = -1; + } + if (uVar4 == 0x58) { + local_20[piVar6] = 5; + piVar6++; + iVar5++; + iVar7 = -1; + } + if (uVar4 == 0x59) { + local_20[piVar6] = 6; + piVar6++; + iVar5++; + iVar7 = -1; + } + continue; + case 0x10: + uVar3 = 0x5c; + break; + case 0x11: + uVar3 = 0x5d; + break; + case 0x12: + uVar3 = 0x5e; + break; + case 0x13: + uVar3 = 0x44; + break; + case 0x14: + uVar3 = 0x5f; + break; + case 0x15: + uVar3 = 0x60; + break; + case 0x16: + uVar3 = 0x4f; + break; + case 0x17: + uVar3 = 0x61; + break; + case 0x18: + uVar3 = 0x62; + break; + case 0x19: + uVar3 = 99; + break; + case 0x1b: + uVar3 = 0x45; + break; + case 0x1c: + uVar3 = 0x3b; + break; + case 0x1d: + uVar3 = 0x6e; + break; + case 0x1e: + uVar3 = 100; + break; + case 0x1f: + uVar3 = 0x65; + break; + case 0x20: + uVar3 = 0x46; + break; + case 0x21: + uVar3 = 0x47; + break; + case 0x22: + uVar3 = 0x3e; + break; + case 0x23: + uVar3 = 0x48; + break; + case 0x24: + uVar3 = 0x66; + break; + case 0x25: + uVar3 = 0x49; + break; + case 0x26: + uVar3 = 0x67; + break; + case 0x27: + uVar3 = 0x6d; + break; + case 0x28: + uVar3 = 0x6a; + break; + case 0x29: + uVar3 = 0x6c; + break; + case 0x2a: + uVar3 = 0x50; + break; + case 0x1a: + uVar3 = 0x38; + break; + case 0x2b: + uVar3 = 0x68; + break; + case 0x2c: + uVar3 = 0x69; + break; + case 0x2d: + uVar3 = 0x6b; + break; + case 0x2e: + uVar3 = 0x6f; + break; + case 0x2f: + uVar3 = 0x70; + break; + case 0x30: + uVar3 = 0x71; + break; + case 0x31: + uVar3 = 0x72; + break; + case 0x32: + uVar3 = 0x73; + break; + case 0x33: + uVar3 = 0x33; + break; + case 0x34: + uVar3 = 0x74; + break; + case 0x35: + uVar3 = 0x75; + break; + case 0x36: + uVar3 = 0x76; + break; + case 0x37: + uVar3 = 0x4a; + } + if (uVar4 == uVar3) { + iVar7++; + } + } + if (iVar7 < 0) { + iVar7 = local_20[rand_int(iVar5 - 1)]; + } + return iVar7; + } +}*/ s32 is_partner_ability_active(void) { return 0;