From 64bca4348fc6797a133016bd9c8124ecf19700e8 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Tue, 9 Feb 2021 17:04:08 +1000 Subject: [PATCH] Decompile func0f1672a8 --- src/game/file.c | 31 +++++++++---------------------- src/include/game/file.h | 2 +- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/src/game/file.c b/src/game/file.c index d7ea21448..398f42398 100644 --- a/src/game/file.c +++ b/src/game/file.c @@ -379,28 +379,15 @@ u32 fileGetUnk04(s32 filenum) return g_FileInfo[filenum].unk04; } -GLOBAL_ASM( -glabel func0f1672a8 -/* f1672a8: 3c0f800a */ lui $t7,%hi(g_FileInfo) -/* f1672ac: 25ef6680 */ addiu $t7,$t7,%lo(g_FileInfo) -/* f1672b0: 000470c0 */ sll $t6,$a0,0x3 -/* f1672b4: 27bdffe8 */ addiu $sp,$sp,-24 -/* f1672b8: 01cf1021 */ addu $v0,$t6,$t7 -/* f1672bc: afbf0014 */ sw $ra,0x14($sp) -/* f1672c0: afa5001c */ sw $a1,0x1c($sp) -/* f1672c4: ac460000 */ sw $a2,0x0($v0) -/* f1672c8: 10e00005 */ beqz $a3,.L0f1672e0 -/* f1672cc: ac460004 */ sw $a2,0x4($v0) -/* f1672d0: 00a02025 */ or $a0,$a1,$zero -/* f1672d4: 00c02825 */ or $a1,$a2,$zero -/* f1672d8: 0c00490c */ jal memReallocate -/* f1672dc: 24060004 */ addiu $a2,$zero,0x4 -.L0f1672e0: -/* f1672e0: 8fbf0014 */ lw $ra,0x14($sp) -/* f1672e4: 27bd0018 */ addiu $sp,$sp,0x18 -/* f1672e8: 03e00008 */ jr $ra -/* f1672ec: 00000000 */ nop -); +void func0f1672a8(s32 filenum, void *ptr, u32 size, bool resizing) +{ + g_FileInfo[filenum].size = size; + g_FileInfo[filenum].unk04 = size; + + if (resizing) { + memReallocate((u32) ptr, g_FileInfo[filenum].size, MEMPOOL_STAGE); + } +} void func0f1672f0(u8 arg0) { diff --git a/src/include/game/file.h b/src/include/game/file.h index f09342795..ba273f22e 100644 --- a/src/include/game/file.h +++ b/src/include/game/file.h @@ -15,7 +15,7 @@ void *func0f1670fc(u32 filenum, u32 arg1); void *func0f167200(s32 file_id, s32 arg1, u8 *arg2, s32 arg3); u32 fileGetSize(s32 filenum); u32 fileGetUnk04(s32 filenum); -u32 func0f1672a8(void); +void func0f1672a8(s32 filenum, void *ptr, u32 size, bool resizing); void func0f1672f0(u8 arg0); void func0f167330(void);