Decomp func_8013A854 from code_d0a70_len_4fe0 and add UnkStructFromfunc8013A854 (#78)

* inisital docs of asm logic and mips_to_c output

* add temp unknown struct for this func
* remove comments from asm, will keep them local only.

* moved UnkSructFromfunc8013A854 to common_sructs.h
* added it's pointer to undefined_syms
* fixed struct pointer and size
* this is a new struct, no others that are `0x7C` in size

* pulled upstream. testing more code.

* fix func_8013A854 to represent latest upstream

* remove unknown struct from common structs to this func

* this is a void func

* unknown struct should be an array with size based on mipstoc outpute a0 < 0x5A

* correct number of lines of asm output from diff, but all code does not match

* fix data types in UnkStructFromfunc8013A854

* temp_v0's logical shift needs to go after UnkStructFromfunc8013A854

* remove unneeded variables

* remove unneeded variables and adding inline sll multiple calc

* add UnkStructFromfunc8013A854 back to common structs

* add UnkStructFromfunc8013A854 back to common structs

* pull latest n64 splat

* analyzing func_8013AA9C to construct UnkStructFromfunc8013A854

* may need unions to represent sub structs in this unk

* roll back struct changes and focus on regalloc

* not an array of pointers looks like there's an array of 90 structs, each struct of size 0x7C

* got OK, now need to cleanup code

* Merge branch 'master' of https://github.com/ethteck/papermario into code_d0a70_len_4fe0-func_8013A854

# Conflicts:
#	tools/n64splat

* fix comment

* remove func_8013AA9C comment used during debug

* add placeholders unks in UnkStructFromfunc8013A854 based on func_8013AA9C

* add first 6 unks in D_80156954

* update todo, add some padding

* adding padding

* adjusting padding

* finished first implementation of padding for UnkStructFromfunc8013A854

* run ./coverage.py --delete-matched

* git checkout -f master && git pull for tools/star-rod

* several changes to UnkStruct8013A854:
* change name from UnkStructFromfunc8013A854 to UnkStruct8013A854
* only include known member data
* add list typedef since this is any arracy of structs

* fix UNKSTRUCT8013A854_SIZE const

* fix スプラトゥーン n64splat

* implement UnkStruct8013A854List to track which array we are pointing to in this unknown struct

* resolve PR feedback. todo resolve splat, review alex optimization:
* move unkstruct extern, struct, and size to code_d0a70_len_4fe0.c
* format void func_8013A854 variable spacing
* add unknown symbol D_80156954;0x80156954 to tools/symbol_addrs.txt

* try fix スプラトn64 with git checkout master && git pull

* fix lint

* move var declaration to inside if and format code

* remove todo comment

Co-authored-by: sonicspiral <>
Co-authored-by: sonicspiral <mru@plusultra.localdomain>
This commit is contained in:
sonicspiral 2020-10-18 21:15:04 -07:00 committed by GitHub
parent d353ab87a3
commit a82d662627
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 21 deletions

View File

@ -1,18 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_8013A854
/* D0F54 8013A854 2C82005A */ sltiu $v0, $a0, 0x5a
/* D0F58 8013A858 10400009 */ beqz $v0, .L8013A880
/* D0F5C 8013A85C 00041140 */ sll $v0, $a0, 5
/* D0F60 8013A860 00441023 */ subu $v0, $v0, $a0
/* D0F64 8013A864 3C038015 */ lui $v1, 0x8015
/* D0F68 8013A868 8C636954 */ lw $v1, 0x6954($v1)
/* D0F6C 8013A86C 00021080 */ sll $v0, $v0, 2
/* D0F70 8013A870 00431021 */ addu $v0, $v0, $v1
/* D0F74 8013A874 2403FFFF */ addiu $v1, $zero, -1
/* D0F78 8013A878 AC400014 */ sw $zero, 0x14($v0)
/* D0F7C 8013A87C A4430010 */ sh $v1, 0x10($v0)
.L8013A880:
/* D0F80 8013A880 03E00008 */ jr $ra
/* D0F84 8013A884 00000000 */ nop

View File

@ -1,5 +1,7 @@
#include "common.h"
#define UNKSTRUCT8013A854_SIZE 90
INCLUDE_ASM(s32, "code_d0a70_len_4fe0", func_8013A370);
INCLUDE_ASM(s32, "code_d0a70_len_4fe0", func_8013A37C);
@ -14,7 +16,25 @@ INCLUDE_ASM(s32, "code_d0a70_len_4fe0", func_8013A6E8);
INCLUDE_ASM(s32, "code_d0a70_len_4fe0", func_8013A704);
INCLUDE_ASM(s32, "code_d0a70_len_4fe0", func_8013A854);
typedef struct {
/* 0x00 */ char unk_0[0x10];
/* 0x10 */ s16 unk_10;
/* 0x14 */ s32 unk_14;
/* 0x18 */ char unk_18[0x64];
} UnkStruct8013A854 ; // size = 0x7C
typedef UnkStruct8013A854 UnkStruct8013A854List[UNKSTRUCT8013A854_SIZE];
extern UnkStruct8013A854List* D_80156954[UNKSTRUCT8013A854_SIZE];
void func_8013A854(u32 i) {
if (i < 90) {
UnkStruct8013A854* unkStruct80156954ListPtr = *D_80156954;
unkStruct80156954ListPtr[i].unk_14 = 0;
unkStruct80156954ListPtr[i].unk_10 = -1;
}
}
INCLUDE_ASM(s32, "code_d0a70_len_4fe0", func_8013A888);

View File

@ -1881,6 +1881,7 @@ gPauseMenuStrings;0x8026F778
gEffectTable;0x8007F214
gMoveScriptTable;0x80293E80
gStaticScriptCounter;0x802D9CA0
D_80156954;0x80156954
D_802D9CA4;0x802D9CA4
gGlobalTimeSpace;0x802D9CA8
gBattleState;0x800DC068

View File

@ -1,2 +1,2 @@
REM first set your default distro using: wsl --set-default <Distro>
wt --title "diff.py" -d "../" ; split-pane -d "../" -V ; new-tab --title "mips_to_c.py" -d "../" ; focus-tab -t 0
REM first set your default distro using: wsl --set-default <Distro>
wt --title "diff.py" -d "../" ; split-pane -d "../" -V ; new-tab --title "mips_to_c.py" -d "../" ; focus-tab -t 0

View File

@ -173,6 +173,7 @@ D_80151328 = 0x80151328;
gCurrentDoorSoundsSet = 0x80151340;
gTriggerCount = 0x80151334;
D_80156954 = 0x80156954;
gTriggerList1 = 0x80159190;
gTriggerList2 = 0x80159290;
gCurrentTriggerListPtr = 0x80159390;