mirror of
https://gitlab.com/dk64_decomp/dk64.git
synced 2024-11-22 22:51:02 +00:00
Add a few scratches
This commit is contained in:
parent
4af2c25bb4
commit
ebba178ef5
@ -134,6 +134,7 @@ standardSearchColumns = {
|
||||
print(
|
||||
"file",
|
||||
"function",
|
||||
"scratch",
|
||||
"bytes",
|
||||
"worth",
|
||||
end=" "
|
||||
@ -163,11 +164,14 @@ for root, dirs, files in os.walk(searchPath):
|
||||
if sum(excludePath in fullFile for excludePath in excludePaths) == 0 and file.endswith('.c'):
|
||||
with open(fullFile, "r") as fh_c:
|
||||
comments = {}
|
||||
scratch = ''
|
||||
for comment in commentSearch:
|
||||
comments[comment] = False
|
||||
|
||||
for line in fh_c:
|
||||
if line.startswith("//"):
|
||||
if line.startswith('// https://decomp.me/scratch/'):
|
||||
scratch = line.replace('// ', '').replace('\n', '')
|
||||
lowerCaseComment = line.lower()
|
||||
for comment in commentSearch:
|
||||
check = sum(searchTerm in lowerCaseComment for searchTerm in commentSearch[comment])
|
||||
@ -181,8 +185,13 @@ for root, dirs, files in os.walk(searchPath):
|
||||
with open(ASMFile, "r") as fh_asm:
|
||||
# Reset function stats
|
||||
size = 0
|
||||
countingSize = False
|
||||
jals = 0
|
||||
labels = 0
|
||||
|
||||
ASMFilePath = ASMFile.split("/")
|
||||
functionName = ASMFilePath[-1].replace(".s", "")
|
||||
|
||||
columns = {}
|
||||
for column in standardSearchColumns:
|
||||
columns[column] = 0
|
||||
@ -190,18 +199,19 @@ for root, dirs, files in os.walk(searchPath):
|
||||
for line in fh_asm:
|
||||
for column in standardSearchColumns:
|
||||
columns[column] += sum(searchTerm in line for searchTerm in standardSearchColumns[column])
|
||||
if line.startswith(f"glabel {functionName}"):
|
||||
countingSize = True
|
||||
if "jal" in line:
|
||||
jals += 1
|
||||
if line.startswith("/* "):
|
||||
if countingSize and line.startswith("/* "):
|
||||
size += 4
|
||||
if line.startswith(".L"):
|
||||
labels += 1
|
||||
|
||||
ASMFilePath = ASMFile.split("/")
|
||||
|
||||
print(
|
||||
ASMFile.replace(ASMFilePath[-1], ""),
|
||||
ASMFilePath[-1].replace(".s", ""),
|
||||
functionName,
|
||||
scratch,
|
||||
size,
|
||||
f"{str(round(size / totalCodeBytes * 100, precision)).ljust(precision + 2, '0')}%",
|
||||
end=" ")
|
||||
@ -225,5 +235,6 @@ for root, dirs, files in os.walk(searchPath):
|
||||
print()
|
||||
continue
|
||||
|
||||
scratch = ''
|
||||
for comment in commentSearch:
|
||||
comments[comment] = False
|
||||
|
@ -329,7 +329,7 @@ typedef struct actor_animation_state {
|
||||
s16 unk12;
|
||||
void *bone_array_1; // at 0x14, camera, update bone positions // TODO: Proper type
|
||||
void *bone_array_2; // at 0x18, camera, update bone positions // TODO: Proper type
|
||||
AnimationStateUnk1C *unk1C; // TODO: Used in func_global_asm_80724CA4 and func_global_asm_8068FF40, pretty easy match, array of 0x8 structs? // malloc(0x100) in func_global_asm_80683158
|
||||
AnimationStateUnk1C *unk1C; // malloc(0x100) in func_global_asm_80683158
|
||||
AnimationStateUnk20 *unk20; // See boss func_dk64_boot_8002FB7C
|
||||
AnimationStateUnk24 *unk24;
|
||||
s32 unk28;
|
||||
@ -1205,8 +1205,14 @@ typedef struct {
|
||||
s32 unk14;
|
||||
} FloorTriangle;
|
||||
|
||||
typedef struct {
|
||||
// Small header on top of DisplayList Pointer
|
||||
u8 unk0[0x20 - 0x0];
|
||||
Mtx *unk20;
|
||||
} Actor_unk0;
|
||||
|
||||
struct actor {
|
||||
u32 *unk0; // Small header on top of DisplayList Pointer // TODO: Proper type
|
||||
Actor_unk0 *unk0;
|
||||
ActorAnimationState *animation_state;
|
||||
u32 *unk8; // Current bone array Pointer // TODO: Proper type
|
||||
s16 unkC;
|
||||
|
@ -316,6 +316,7 @@ void func_critter_80027DC0(void) {
|
||||
}
|
||||
|
||||
// Jumptable, doable, float, regalloc, close
|
||||
// https://decomp.me/scratch/YxzWl
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/critter/code_3340/func_critter_80028120.s")
|
||||
|
||||
s32 func_global_asm_8072881C(s32, f64 *);
|
||||
|
@ -563,6 +563,72 @@ Gfx *func_global_asm_80705F5C(Gfx *dl, s16 arg1, s16 arg2, u8 arg3) {
|
||||
// Jumptable, doable
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_103AB0/func_global_asm_807065F8.s")
|
||||
|
||||
typedef struct {
|
||||
s16 unk0;
|
||||
s16 unk2;
|
||||
s16 unk4;
|
||||
} Struct80754F58;
|
||||
|
||||
extern Struct80754F58 D_global_asm_80754F58[];
|
||||
|
||||
/*
|
||||
void func_global_asm_807065F8(s16 arg0, u8 *arg1, u8 *arg2, u8 *arg3) {
|
||||
f32 temp_f0;
|
||||
f32 var_f16;
|
||||
f32 var_f6;
|
||||
f32 var_f8;
|
||||
s16 temp_a1;
|
||||
u8 i;
|
||||
u8 temp_a3;
|
||||
u8 temp_t0;
|
||||
u8 temp_t1;
|
||||
Struct80754F58 *temp_a2;
|
||||
Struct80754F58 *temp_v1;
|
||||
|
||||
switch (current_map) {
|
||||
case MAP_AZTEC_BEETLE_RACE:
|
||||
for (i = 0; arg0 < D_global_asm_80754F58[i].unk0;) {
|
||||
i++;
|
||||
}
|
||||
temp_a2 = &D_global_asm_80754F58[i];
|
||||
temp_v1 = &D_global_asm_80754F58[i];
|
||||
temp_a1 = temp_v1[1].unk0;
|
||||
temp_a3 = temp_v1[1].unk2;
|
||||
temp_f0 = (arg0 - temp_a1) / (temp_a2->unk0 - temp_a1);
|
||||
var_f6 = temp_a3;
|
||||
*arg1 = ((temp_a2->unk2 - temp_a3) * temp_f0) + var_f6;
|
||||
temp_t0 = temp_v1[1].unk2;
|
||||
var_f16 = temp_t0;
|
||||
*arg2 = ((temp_a2->unk2 - temp_t0) * temp_f0) + var_f16;
|
||||
temp_t1 = temp_v1[2].unk0;
|
||||
var_f8 = temp_t1;
|
||||
*arg3 = ((temp_a2->unk4 - temp_t1) * temp_f0) + var_f8;
|
||||
break;
|
||||
case MAP_STEALTHY_SNOOP_NORMAL:
|
||||
case MAP_MAD_MAZE_MAUL_HARD:
|
||||
case MAP_STASH_SNATCH_NORMAL:
|
||||
case MAP_MAD_MAZE_MAUL_EASY:
|
||||
case MAP_MAD_MAZE_MAUL_NORMAL:
|
||||
case MAP_STASH_SNATCH_EASY:
|
||||
case MAP_STASH_SNATCH_HARD:
|
||||
case MAP_MAD_MAZE_MAUL_INSANE:
|
||||
case MAP_STASH_SNATCH_INSANE:
|
||||
case MAP_STEALTHY_SNOOP_VERY_EASY:
|
||||
case MAP_STEALTHY_SNOOP_EASY:
|
||||
case MAP_STEALTHY_SNOOP_HARD:
|
||||
*arg1 = 0x3F;
|
||||
*arg2 = 0x3F;
|
||||
*arg3 = 0x3F;
|
||||
break;
|
||||
default:
|
||||
*arg1 = 0xFF;
|
||||
*arg2 = 0xFF;
|
||||
*arg3 = 0xFF;
|
||||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Displaylist stuff
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_103AB0/func_global_asm_807069A4.s")
|
||||
|
||||
|
@ -161,6 +161,7 @@ s32 func_global_asm_8069E724(s32 arg0) {
|
||||
}
|
||||
|
||||
// Doable, close
|
||||
// https://decomp.me/scratch/yDXeC
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_A2F10/func_global_asm_8069E774.s")
|
||||
|
||||
// TODO: Add to aaD union
|
||||
|
@ -31,6 +31,80 @@ void func_global_asm_806A3700(s32 arg0, s32 arg1) {
|
||||
// Displaylist stuff (matrix), doable
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_A8400/func_global_asm_806A370C.s")
|
||||
|
||||
/*
|
||||
void func_global_asm_806A370C(Gfx **arg0, AAD_global_asm_806A4DDC *arg1, Struct806A57C0_2 *arg2, Struct806A57C0_3 *arg3) {
|
||||
u16 spE8; // compiler-managed
|
||||
f32 sp60;
|
||||
f32 sp5C;
|
||||
f32 sp4C;
|
||||
f32 sp38;
|
||||
Gfx *temp_s3;
|
||||
f32 temp_f0;
|
||||
f32 temp_f0_2;
|
||||
f32 temp_f12;
|
||||
f32 temp_f14;
|
||||
f32 var_f2;
|
||||
void *temp_s1;
|
||||
void *temp_t0;
|
||||
void *temp_v1;
|
||||
|
||||
temp_s3 = *arg0;
|
||||
spE8 = D_global_asm_8075A740;
|
||||
guMtxIdentF(&spA8[0]);
|
||||
temp_s1 = arg3 + 0x10;
|
||||
if ((temp_s1->unk0 != 0) && (arg3->unk2 != 0)) {
|
||||
temp_f12 = arg3->unk0 * 0.5f * 4.0f;
|
||||
sp60 = temp_f12;
|
||||
temp_f14 = arg2->unk18 * 0.5f * 4.0f;
|
||||
sp5C = temp_f14;
|
||||
guTranslateF(&sp68[0], -temp_f12, -temp_f14, 0.0f);
|
||||
guMtxCatF(&spA8[0], &sp68[0], &spA8[0]);
|
||||
temp_s1->unk88 = temp_s1->unk88 + 0.41887903213500977;
|
||||
if (temp_s1->unk0 & 8) {
|
||||
temp_f0 = temp_s1->unk88 * 0.5;
|
||||
if (temp_f0 <= 6.2831855f) {
|
||||
guRotateF(&sp68[0], temp_f0 * 57.295776f, 0.0f, 0.0f, 1.0f);
|
||||
guMtxCatF(&spA8[0], &sp68[0], &spA8[0]);
|
||||
}
|
||||
}
|
||||
if (temp_s1->unk0 & 4) {
|
||||
temp_f0_2 = temp_s1->unk88;
|
||||
if (temp_f0_2 <= 6.2831855f) {
|
||||
var_f2 = (0.25f * (func_global_asm_80612D1C(temp_f0_2 - 1.5707964f) + 1.0f)) + 1.0f;
|
||||
} else {
|
||||
var_f2 = 1.0f;
|
||||
}
|
||||
guScaleF(&sp68[0], var_f2, var_f2, 1.0f);
|
||||
guMtxCatF(&spA8[0], &sp68[0], &spA8[0]);
|
||||
}
|
||||
if (temp_s1->unk0 & 2) {
|
||||
sp38 = func_global_asm_80612D1C(temp_s1->unk88);
|
||||
sp4C = ((20.0f - ((rand() >> 0xF) % 40)) / 20.0f) * (4.0f * sp38);
|
||||
sp38 = func_global_asm_80612D1C(temp_s1->unk88);
|
||||
guTranslateF(&sp68[0], sp4C, ((20.0f - ((rand() >> 0xF) % 40)) / 20.0f) * (4.0f * sp38), 0.0f);
|
||||
guMtxCatF(&spA8[0], &sp68[0], &spA8[0]);
|
||||
}
|
||||
guTranslateF(&sp68[0], sp60, sp5C, 0.0f);
|
||||
guMtxCatF(&spA8[0], &sp68[0], &spA8[0]);
|
||||
}
|
||||
guScaleF(&sp68[0], 1.0f, 1.0f, 1.0f);
|
||||
guMtxCatF(&spA8[0], &sp68[0], &spA8[0]);
|
||||
guTranslateF(&sp68[0], (arg1->unk44 + arg3->unk4) * 4.0, (arg1->unk48 + arg3->unk8) * 4.0, 0.0f);
|
||||
guMtxCatF(&spA8[0], &sp68[0], &spA8[0]);
|
||||
guMtxF2L(&spA8[0], temp_s1 + (D_global_asm_807444FC << 6) + 8);
|
||||
temp_s3->words.w0 = 0xDA380003;
|
||||
temp_v1 = temp_s3 + 8;
|
||||
temp_s3->words.w1 = temp_s1 + (D_global_asm_807444FC << 6) + 8;
|
||||
temp_v1->unk4 = 0;
|
||||
temp_v1->unk0 = 0xE7000000;
|
||||
temp_t0 = temp_v1 + 8;
|
||||
temp_t0->unk0 = 0xFA000000;
|
||||
temp_t0->unk4 = arg3->unk3 | 0x2828FF00;
|
||||
spE8 = temp_s1->unk2;
|
||||
*arg0 = printStyledText(temp_t0 + 8, 6, 0, 0, &spE8, 0);
|
||||
}
|
||||
*/
|
||||
|
||||
void func_global_asm_806A3B78(s32 *arg0, AAD_global_asm_806A4DDC *arg1, Struct806A57C0_2 *arg2, u8 arg3, u8 *arg4) {
|
||||
s32 sp44;
|
||||
s32 i;
|
||||
|
@ -36,6 +36,7 @@ void func_global_asm_806B1348(void) {
|
||||
}
|
||||
|
||||
// Jumptable, close, doable
|
||||
// https://decomp.me/scratch/ryD0r
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/code_B5EC0/func_global_asm_806B13B4.s")
|
||||
|
||||
void func_global_asm_8072C918(s16, s16, s16);
|
||||
|
@ -8,10 +8,20 @@ typedef struct menu_struct_1 {
|
||||
u16 unk8;
|
||||
u8 unkA;
|
||||
s8 unkB;
|
||||
u8 unkC;
|
||||
u8 unkD;
|
||||
u8 unkE;
|
||||
u8 unkF;
|
||||
union {
|
||||
struct {
|
||||
u8 unkC;
|
||||
u8 unkD;
|
||||
};
|
||||
s16 unkC_s16;
|
||||
};
|
||||
union {
|
||||
struct {
|
||||
u8 unkE;
|
||||
u8 unkF;
|
||||
};
|
||||
s16 unkE_s16;
|
||||
};
|
||||
u8 unk10;
|
||||
u8 unk11;
|
||||
u8 unk12;
|
||||
@ -179,7 +189,7 @@ void func_menu_80025E04(MenuStruct1 *arg0, CharacterProgress *arg1) {
|
||||
// It checks whether levels have been entered and does stuff with actor behaviour index
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/menu/code_1AF0/func_menu_80025FB4.s")
|
||||
|
||||
extern u8 D_global_asm_807FCC4C;
|
||||
extern u8 D_807FCC4C;
|
||||
|
||||
/*
|
||||
void func_menu_80025FB4(MenuStruct1 *arg0, CharacterProgress *arg1, ? arg2) {
|
||||
@ -257,7 +267,7 @@ block_18:
|
||||
arg0->unkB = -2;
|
||||
}
|
||||
}
|
||||
arg0->unk10 = D_global_asm_807FCC4C;
|
||||
arg0->unk10 = D_807FCC4C;
|
||||
}
|
||||
*/
|
||||
|
||||
@ -302,26 +312,23 @@ extern MenuStruct1 D_menu_80033514;
|
||||
extern u16 D_menu_80033528;
|
||||
extern u16 D_global_asm_80750AC8;
|
||||
|
||||
extern u8 D_global_asm_807FCC4C;
|
||||
extern u8 D_menu_800334DD[];
|
||||
|
||||
void func_menu_800262A8(MenuStruct1*, CharacterProgress*, s32);
|
||||
|
||||
/*
|
||||
void func_menu_800262A8(MenuStruct1 *arg0, u8 *arg1, s32 arg2) {
|
||||
void func_menu_800262A8(MenuStruct1 *arg0, CharacterProgress *arg1, s32 arg2) {
|
||||
MenuStruct1 *sp44;
|
||||
u16 sp42;
|
||||
s32 sp3C;
|
||||
u16 sp3A;
|
||||
u16 sp38;
|
||||
u16 sp36;
|
||||
u16 sp34;
|
||||
u16 var_v1;
|
||||
u16 var_a2;
|
||||
u16 var_t0;
|
||||
u16 var_t1;
|
||||
u16 sp2C;
|
||||
s32 sp28;
|
||||
s16 var_a0;
|
||||
s32 temp_v0_2;
|
||||
u16 var_a2;
|
||||
u16 var_t0;
|
||||
u16 var_t1;
|
||||
u16 var_v1;
|
||||
|
||||
if (func_global_asm_80629148()) {
|
||||
sp44 = NULL;
|
||||
@ -336,19 +343,11 @@ void func_menu_800262A8(MenuStruct1 *arg0, u8 *arg1, s32 arg2) {
|
||||
var_t0 = 0xC;
|
||||
var_t1 = 0xE;
|
||||
if (arg0->unkB >= 0) {
|
||||
sp3A = 3;
|
||||
sp38 = 7;
|
||||
sp36 = 0xC;
|
||||
sp34 = 0xE;
|
||||
var_v1 = 3;
|
||||
var_a2 = 7;
|
||||
var_t0 = 0xC;
|
||||
var_t1 = 0xE;
|
||||
temp_v0_2 = func_menu_80025AF0(arg0, 1, 7, arg0);
|
||||
if (arg1[arg0->unkB] & 1) {
|
||||
temp_v0_2 = func_menu_80025AF0(arg0, 1);
|
||||
if (((u8*)arg1)[arg0->unkB] & 1) {
|
||||
var_a2 = 9;
|
||||
var_v1 = 5;
|
||||
if (D_global_asm_807FCC4C < D_menu_800334DD[arg1[arg0->unkB]]) {
|
||||
if (D_807FCC4C < D_menu_800334DD[((u8*)arg1)[arg0->unkB]]) {
|
||||
var_v1 = 6;
|
||||
var_t0 = 0xD;
|
||||
var_t1 = 0xF;
|
||||
@ -362,8 +361,8 @@ void func_menu_800262A8(MenuStruct1 *arg0, u8 *arg1, s32 arg2) {
|
||||
}
|
||||
D_menu_80033500.unk4 = var_v1;
|
||||
D_menu_80033500.unk6 = var_a2;
|
||||
D_menu_80033500.unkC = var_t0;
|
||||
D_menu_80033500.unkE = var_t1;
|
||||
D_menu_80033500.unkC_s16 = var_t0;
|
||||
D_menu_80033500.unkE_s16 = var_t1;
|
||||
sp44 = &D_menu_80033500;
|
||||
sp42 = 9;
|
||||
break;
|
||||
@ -391,7 +390,7 @@ void func_menu_800262A8(MenuStruct1 *arg0, u8 *arg1, s32 arg2) {
|
||||
var_v1 = 0x21;
|
||||
}
|
||||
} else {
|
||||
sp28 = countSetFlags(0x225, 0x28, 0);
|
||||
sp28 = countSetFlags(0x225, 0x28, FLAG_TYPE_PERMANENT);
|
||||
if (sp28 >= 0xF) {
|
||||
func_menu_80026290(arg0, &sp3C);
|
||||
if (isFlagSet(0x17B, FLAG_TYPE_PERMANENT)) {
|
||||
@ -413,7 +412,7 @@ void func_menu_800262A8(MenuStruct1 *arg0, u8 *arg1, s32 arg2) {
|
||||
sp44 = &D_menu_80033528;
|
||||
} else {
|
||||
var_a0 = 4;
|
||||
if ((arg0->unkB >= 0) && (arg1[arg0->unkB] & 1)) {
|
||||
if ((arg0->unkB >= 0) && (((u8*)arg1)[arg0->unkB] & 1)) {
|
||||
var_v1 = 5;
|
||||
var_a0 = 6;
|
||||
}
|
||||
@ -436,8 +435,6 @@ void func_menu_800262A8(MenuStruct1 *arg0, u8 *arg1, s32 arg2) {
|
||||
}
|
||||
*/
|
||||
|
||||
void func_menu_800262A8(MenuStruct1*, CharacterProgress*, s32);
|
||||
|
||||
void func_menu_80026684(MenuStruct1 *arg0, CharacterProgress *arg1, s32 arg2) {
|
||||
switch (arg0->unkE) {
|
||||
case 0:
|
||||
|
Loading…
Reference in New Issue
Block a user