From 36aa07e5cf91ae7e149effade3a09b1d20eb1c6d Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Wed, 11 Mar 2020 19:54:09 +1000 Subject: [PATCH] Attempt to decompile func0f028590 --- src/game/game_01e250.c | 47 ++++++++++++++++++++++++++++++++++ src/include/boot/boot.h | 2 ++ src/include/game/game_01e250.h | 2 +- 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/src/game/game_01e250.c b/src/game/game_01e250.c index 85075389f..1ee18055f 100644 --- a/src/game/game_01e250.c +++ b/src/game/game_01e250.c @@ -1,5 +1,6 @@ #include #include "constants.h" +#include "boot/boot.h" #include "game/cheats.h" #include "game/chr/chraction.h" #include "game/data/data_000000.h" @@ -11455,6 +11456,52 @@ glabel var7f1a8948 /* f028770: 27bd0070 */ addiu $sp,$sp,0x70 ); +// Mismatch due to not storing 0.75f in rodata +// and suspected ASM hack in piracy check. +//void func0f028590(f32 arg0) +//{ +// s32 i; +// f32 add = 0.75f; +// +// for (i = 0; i < g_NumChrsA; i++) { +// if (g_ChrsA[i].animdata) { +// struct prop *prop = g_ChrsA[i].prop; +// +// if (prop && prop->type == PROPTYPE_CHR && +// chrGetTargetProp(&g_ChrsA[i]) == g_Vars.currentplayer->prop) { +// +// f32 distance = chrGetDistanceToCurrentPlayer(&g_ChrsA[i]); +// +// if (distance == 0) { +// distance = 2; +// } else { +// distance = (arg0 * 100 * g_ChrsA[i].hearingscale * (1.0f + add)) / distance; +// } +// +// if (distance > 1.0f) { +// chrRecordLastHearTargetTime(&g_ChrsA[i]); +//#if PIRACYCHECKS +// { +// s32 *i = (s32 *)&func00002078; +// s32 *end = (s32 *)&func00002148; +// u32 checksum = 0; +// +// while (i < end) { +// checksum = *i + 2 * checksum; +// i++; +// } +// +// if (checksum != 0xe1ab0f90) { +// g_Bodies[BODY_SKEDARKING].bodyfileid = 0; +// } +// } +//#endif +// } +// } +// } +// } +//} + struct chrdata *chrFindByLiteralId(s32 chrnum) { s32 lower = 0; diff --git a/src/include/boot/boot.h b/src/include/boot/boot.h index 7203e0bf1..056c1355f 100644 --- a/src/include/boot/boot.h +++ b/src/include/boot/boot.h @@ -10,6 +10,8 @@ s32 func000018ac(void); void func00001b28(u32 arg0); s32 func00001e30(void); s32 func00001fa8(void); +s32 func00002078(void); +s32 func00002148(void); s32 func00002148(void); s32 func000022e0(void); s32 func00002ff0(void); diff --git a/src/include/game/game_01e250.h b/src/include/game/game_01e250.h index 057f498b4..184d2eb73 100644 --- a/src/include/game/game_01e250.h +++ b/src/include/game/game_01e250.h @@ -42,7 +42,7 @@ u32 func0f0278a4(void); u32 func0f027994(void); u32 func0f027e1c(void); u32 func0f028498(void); -u32 func0f028590(void); +void func0f028590(f32 arg0); u32 func0f028a50(void); u32 func0f028d50(void); u32 func0f028e18(void);