Match func_8001B2F0 (#303)

* Minor tweaks

* Match func_80072718

* Update score

* Do some minor cleanup

* More cleanup and renaming

* Remove comment

* Minor clenaup again

* Remove semicolons

* Match init_controller_paks with a couple of minor fakematch stuff

* Udpate score

* Match func_8001B2F0 and do some documenting

* Update score

Co-authored-by: Ryan Myers <foldor@gmail.com>
This commit is contained in:
Ryan Myers
2022-11-21 12:33:47 -05:00
committed by GitHub
co-authored by Ryan Myers
parent 099ef90838
commit 50a71a3704
8 changed files with 57 additions and 80 deletions
+7 -7
View File
@@ -120,20 +120,20 @@ s32 is_drumstick_unlocked(void) {
```
<!-- README_SCORE_BEGIN -->
As of November 20, 2022, this is our current score:
As of November 21, 2022, this is our current score:
```
=====================================================================
ADVENTURE ONE (ASM -> C Decompilation)
-------------------------- 38.35% Complete --------------------------
# Decompiled functions: 1357
# GLOBAL_ASM remaining: 479
# NON_MATCHING functions: 11
# NON_EQUIVALENT WIP functions: 87
-------------------------- 38.49% Complete --------------------------
# Decompiled functions: 1360
# GLOBAL_ASM remaining: 476
# NON_MATCHING functions: 10
# NON_EQUIVALENT WIP functions: 86
---------------------------- Game Status ----------------------------
Balloons: 19/47, Keys: 2/4, Trophies: 1/5
T.T. Amulets: 2/4, Wizpig Amulets: 1/4
---------------------------------------------------------------------
We are collecting silver coins in Snowball Valley. (2/8 silver coins)
We are collecting silver coins in Snowball Valley. (3/8 silver coins)
=====================================================================
ADVENTURE TWO (Cleanup & Documentation)
-------------------------- 9.70% Complete --------------------------
+2 -2
View File
@@ -1106,8 +1106,8 @@ glabel L8000D98C
/* 00E7E0 8000DBE0 0C006D3F */ jal func_8001B4FC
/* 00E7E4 8000DBE4 00402025 */ move $a0, $v0
/* 00E7E8 8000DBE8 10400029 */ beqz $v0, .L8000DC90
/* 00E7EC 8000DBEC 3C188012 */ lui $t8, %hi(D_8011AE84) # $t8, 0x8012
/* 00E7F0 8000DBF0 8718AE84 */ lh $t8, %lo(D_8011AE84)($t8)
/* 00E7EC 8000DBEC 3C188012 */ lui $t8, %hi(gMapDefaultVehicle) # $t8, 0x8012
/* 00E7F0 8000DBF0 8718AE84 */ lh $t8, %lo(gMapDefaultVehicle)($t8)
/* 00E7F4 8000DBF4 3C02800E */ lui $v0, %hi(D_800DC7B8) # $v0, 0x800e
/* 00E7F8 8000DBF8 00187080 */ sll $t6, $t8, 2
/* 00E7FC 8000DBFC 01D87021 */ addu $t6, $t6, $t8
+2 -2
View File
@@ -236,7 +236,7 @@ glabel func_8001AE64
/* 01BDD4 8001B1D4 8F390300 */ lw $t9, %lo(osTvType)($t9)
/* 01BDD8 8001B1D8 00107080 */ sll $t6, $s0, 2
/* 01BDDC 8001B1DC 17200010 */ bnez $t9, .L8001B220
/* 01BDE0 8001B1E0 3C188012 */ lui $t8, %hi(D_8011AE80) # $t8, 0x8012
/* 01BDE0 8001B1E0 3C188012 */ lui $t8, %hi(gTTGhostTimeToBeat) # $t8, 0x8012
/* 01BDE4 8001B1E4 01D07023 */ subu $t6, $t6, $s0
/* 01BDE8 8001B1E8 000E7040 */ sll $t6, $t6, 1
/* 01BDEC 8001B1EC 01CB001A */ div $zero, $t6, $t3
@@ -255,7 +255,7 @@ glabel func_8001AE64
/* 01BE18 8001B218 00000000 */ nop
/* 01BE1C 8001B21C 00000000 */ nop
.L8001B220:
/* 01BE20 8001B220 8718AE80 */ lh $t8, %lo(D_8011AE80)($t8)
/* 01BE20 8001B220 8718AE80 */ lh $t8, %lo(gTTGhostTimeToBeat)($t8)
/* 01BE24 8001B224 8FA40034 */ lw $a0, 0x34($sp)
/* 01BE28 8001B228 0218082A */ slt $at, $s0, $t8
/* 01BE2C 8001B22C 10200010 */ beqz $at, .L8001B270
-53
View File
@@ -1,53 +0,0 @@
glabel func_8001B2F0
/* 01BEF0 8001B2F0 27BDFFD8 */ addiu $sp, $sp, -0x28
/* 01BEF4 8001B2F4 AFBF0014 */ sw $ra, 0x14($sp)
/* 01BEF8 8001B2F8 0C01AC2B */ jal get_map_default_vehicle
/* 01BEFC 8001B2FC AFA40028 */ sw $a0, 0x28($sp)
/* 01BF00 8001B300 3C058012 */ lui $a1, %hi(D_8011AE84) # $a1, 0x8012
/* 01BF04 8001B304 24A5AE84 */ addiu $a1, %lo(D_8011AE84) # addiu $a1, $a1, -0x517c
/* 01BF08 8001B308 A4A20000 */ sh $v0, ($a1)
/* 01BF0C 8001B30C 0C01DB16 */ jal load_asset_section_from_rom
/* 01BF10 8001B310 24040030 */ li $a0, 48
/* 01BF14 8001B314 3C058012 */ lui $a1, %hi(D_8011AE84) # $a1, 0x8012
/* 01BF18 8001B318 8FA60028 */ lw $a2, 0x28($sp)
/* 01BF1C 8001B31C 24A5AE84 */ addiu $a1, %lo(D_8011AE84) # addiu $a1, $a1, -0x517c
/* 01BF20 8001B320 AFA20024 */ sw $v0, 0x24($sp)
/* 01BF24 8001B324 00401825 */ move $v1, $v0
/* 01BF28 8001B328 240700FF */ li $a3, 255
.L8001B32C:
/* 01BF2C 8001B32C 906E0000 */ lbu $t6, ($v1)
/* 01BF30 8001B330 00602025 */ move $a0, $v1
/* 01BF34 8001B334 14CE0009 */ bne $a2, $t6, .L8001B35C
/* 01BF38 8001B338 00000000 */ nop
/* 01BF3C 8001B33C 84AF0000 */ lh $t7, ($a1)
/* 01BF40 8001B340 90780001 */ lbu $t8, 1($v1)
/* 01BF44 8001B344 00000000 */ nop
/* 01BF48 8001B348 15F80004 */ bne $t7, $t8, .L8001B35C
/* 01BF4C 8001B34C 00000000 */ nop
/* 01BF50 8001B350 90820000 */ lbu $v0, ($a0)
/* 01BF54 8001B354 10000005 */ b .L8001B36C
/* 01BF58 8001B358 00000000 */ nop
.L8001B35C:
/* 01BF5C 8001B35C 90820000 */ lbu $v0, ($a0)
/* 01BF60 8001B360 24630008 */ addiu $v1, $v1, 8
/* 01BF64 8001B364 14E2FFF1 */ bne $a3, $v0, .L8001B32C
/* 01BF68 8001B368 00000000 */ nop
.L8001B36C:
/* 01BF6C 8001B36C 10E20008 */ beq $a3, $v0, .L8001B390
/* 01BF70 8001B370 24050001 */ li $a1, 1
/* 01BF74 8001B374 8C640004 */ lw $a0, 4($v1)
/* 01BF78 8001B378 8C79000C */ lw $t9, 0xc($v1)
/* 01BF7C 8001B37C 3C068012 */ lui $a2, %hi(D_8011AE80) # $a2, 0x8012
/* 01BF80 8001B380 24C6AE80 */ addiu $a2, %lo(D_8011AE80) # addiu $a2, $a2, -0x5180
/* 01BF84 8001B384 0C01669A */ jal load_tt_ghost
/* 01BF88 8001B388 03242823 */ subu $a1, $t9, $a0
/* 01BF8C 8001B38C 00402825 */ move $a1, $v0
.L8001B390:
/* 01BF90 8001B390 8FA40024 */ lw $a0, 0x24($sp)
/* 01BF94 8001B394 0C01C450 */ jal free_from_memory_pool
/* 01BF98 8001B398 AFA5001C */ sw $a1, 0x1c($sp)
/* 01BF9C 8001B39C 8FBF0014 */ lw $ra, 0x14($sp)
/* 01BFA0 8001B3A0 8FA2001C */ lw $v0, 0x1c($sp)
/* 01BFA4 8001B3A4 03E00008 */ jr $ra
/* 01BFA8 8001B3A8 27BD0028 */ addiu $sp, $sp, 0x28
+4 -4
View File
@@ -140,7 +140,7 @@ OSMesg sSIMesgBuf;
OSMesg gSIMesg;
OSContStatus status;
UNUSED s32 D_80121108[2]; //Padding?
ControllerData sControllerData[8];
OSContPad sControllerData[8];
u16 gControllerButtonsPressed[4];
u16 gControllerButtonsReleased[4];
u8 sPlayerID[16];
@@ -1428,7 +1428,7 @@ void swap_player_1_and_2_ids(void) {
* Returns the buttons that are currently pressed down on the controller.
*/
u16 get_buttons_held_from_player(s32 player) {
return sControllerData[sPlayerID[player]].buttonData;
return sControllerData[sPlayerID[player]].button;
}
/**
@@ -1450,14 +1450,14 @@ UNUSED u16 get_buttons_released_from_player(s32 player) {
* Clamps the X joystick axis of the selected player to 70 and returns it.
*/
s8 clamp_joystick_x_axis(s32 player) {
return clamp_joystick(sControllerData[sPlayerID[player]].rawStickX);
return clamp_joystick(sControllerData[sPlayerID[player]].stick_x);
}
/**
* Clamps the Y joystick axis of the selected player to 70 and returns it.
*/
s8 clamp_joystick_y_axis(s32 player) {
return clamp_joystick(sControllerData[sPlayerID[player]].rawStickY);
return clamp_joystick(sControllerData[sPlayerID[player]].stick_y);
}
/**
-9
View File
@@ -72,15 +72,6 @@ typedef struct ScreenViewport {
/* 0x30 */ s32 flags;
} ScreenViewport;
/* Size: 6 bytes */
typedef struct ControllerData {
u16 buttonData; // Buttons
s8 rawStickX;
s8 rawStickY;
s8 unk4;
s8 unk6;
} ControllerData;
typedef struct unk80068BF4 {
s16 unk0;
s16 unk2;
+35 -3
View File
@@ -202,9 +202,9 @@ s16 D_8011AE78;
s16 D_8011AE7A;
s16 D_8011AE7C;
s8 D_8011AE7E;
s16 D_8011AE80; // TT Ghost outTime at least
s16 gTTGhostTimeToBeat;
s16 D_8011AE82;
s32 D_8011AE84;
s16 gMapDefaultVehicle; // Vehicle enum
s32 D_8011AE88;
Gfx *gObjectCurrDisplayList;
Matrix *gObjectCurrMatrix;
@@ -1619,7 +1619,39 @@ Object *func_8001B2E0() {
return D_8011AD34;
}
GLOBAL_ASM("asm/non_matchings/objects/func_8001B2F0.s")
/**
Pretty sure this determines whether or not you're eligible to race TT ghost in track select
when TT is on. It looks like it checks some ghost data makes sure you've got a ghost for that level
with the default vehicle,
Returns 0 if TT ghost was loaded successfully.
*/
s32 func_8001B2F0(MapId mapId) {
TTGhostTable *ghostTable;
TTGhostTable *prevGhostTable;
s32 ret;
TTGhostTable *nextGhostTable;
gMapDefaultVehicle = get_map_default_vehicle(mapId);
ghostTable = (TTGhostTable *) load_asset_section_from_rom(ASSET_TTGHOSTS_TABLE);
nextGhostTable = ghostTable;
do {
prevGhostTable = nextGhostTable;
if ((prevGhostTable->mapId == mapId) && (prevGhostTable->defaultVehicleId == gMapDefaultVehicle)) {
break;
}
nextGhostTable++;
} while (prevGhostTable->mapId != 0xFF);
ret = 1;
if (prevGhostTable->mapId != 0xFF) {
ret = load_tt_ghost(nextGhostTable->ghostOffset, nextGhostTable[1].ghostOffset - nextGhostTable->ghostOffset, &gTTGhostTimeToBeat);
}
free_from_memory_pool(ghostTable);
return ret;
}
s32 func_8001B3AC(s32 arg0) {
return arg0 == D_800DC718;
+7
View File
@@ -266,6 +266,12 @@ typedef struct struct_8000FC6C_3 {
void *unk58;
} struct_8000FC6C_3;
typedef struct TTGhostTable {
u8 mapId;
u8 defaultVehicleId;
s32 ghostOffset;
} TTGhostTable;
typedef struct ObjectTransformExt {
ObjectTransform trans;
s16 unk18;
@@ -454,6 +460,7 @@ void render_racer_shield(Gfx **dList, Matrix **mtx, VertexList **vtxList, Object
void render_racer_magnet(Gfx **dList, Matrix **mtx, VertexList **vtxList, Object *obj);
void set_and_normalize_D_8011AFE8(f32 arg0, f32 arg1, f32 arg2);
s32 func_8000FC6C(struct_8000FC6C_3 *arg0, struct_8000FC6C *arg1);
s32 func_8001B2F0(MapId mapId);
void render_3d_billboard(Object *obj);
void func_80011960(Object *obj, Vertex *verts, u32 numVertices, Triangle *triangles, u32 numTriangles, TextureHeader *tex, u32 arg6, u32 arg7, f32 arg8);
void func_8000B290(void);