Rename memory.c to memp.c and lib_126b0.c to mema.c and add documentation
This commit is contained in:
parent
90af295aca
commit
1d307a9191
|
|
@ -40,8 +40,8 @@
|
|||
build/ROMID/lib/main.o (section); \
|
||||
build/ROMID/lib/snd.o (section); \
|
||||
build/ROMID/lib/music.o (section); \
|
||||
build/ROMID/lib/memory.o (section); \
|
||||
build/ROMID/lib/lib_126b0.o (section); \
|
||||
build/ROMID/lib/memp.o (section); \
|
||||
build/ROMID/lib/mema.o (section); \
|
||||
build/ROMID/lib/rng.o (section); \
|
||||
build/ROMID/lib/args.o (section); \
|
||||
build/ROMID/lib/str.o (section); \
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@
|
|||
build/ROMID/lib/main.o (section); \
|
||||
build/ROMID/lib/snd.o (section); \
|
||||
build/ROMID/lib/music.o (section); \
|
||||
build/ROMID/lib/memory.o (section); \
|
||||
build/ROMID/lib/lib_126b0.o (section); \
|
||||
build/ROMID/lib/memp.o (section); \
|
||||
build/ROMID/lib/mema.o (section); \
|
||||
build/ROMID/lib/rng.o (section); \
|
||||
build/ROMID/lib/args.o (section); \
|
||||
build/ROMID/lib/str.o (section); \
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@
|
|||
build/ROMID/lib/main.o (section); \
|
||||
build/ROMID/lib/snd.o (section); \
|
||||
build/ROMID/lib/music.o (section); \
|
||||
build/ROMID/lib/memory.o (section); \
|
||||
build/ROMID/lib/lib_126b0.o (section); \
|
||||
build/ROMID/lib/memp.o (section); \
|
||||
build/ROMID/lib/mema.o (section); \
|
||||
build/ROMID/lib/rng.o (section); \
|
||||
build/ROMID/lib/args.o (section); \
|
||||
build/ROMID/lib/str.o (section); \
|
||||
|
|
|
|||
102
src/game/bg.c
102
src/game/bg.c
|
|
@ -32,8 +32,8 @@
|
|||
#include "lib/vi.h"
|
||||
#include "lib/dma.h"
|
||||
#include "lib/main.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/lib_126b0.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/mema.h"
|
||||
#include "lib/rng.h"
|
||||
#include "lib/mtx.h"
|
||||
#include "lib/lib_2f490.h"
|
||||
|
|
@ -4663,7 +4663,7 @@ void bgInit(s32 stagenum)
|
|||
|
||||
// Allocate space for the primary bg data
|
||||
// An extra 0x8000 or so is given as temporary scratch space
|
||||
g_BgPrimaryData = malloc(ALIGN16(inflatedsize + 0x8010), MEMPOOL_STAGE);
|
||||
g_BgPrimaryData = mempAlloc(ALIGN16(inflatedsize + 0x8010), MEMPOOL_STAGE);
|
||||
|
||||
// Set up pointer to scratch space
|
||||
scratch = ((u32)g_BgPrimaryData + inflatedsize) - primcompsize;
|
||||
|
|
@ -4679,7 +4679,7 @@ void bgInit(s32 stagenum)
|
|||
bgInflate((u8 *)scratch, g_BgPrimaryData, primcompsize);
|
||||
|
||||
// Shrink the allocation (ie. free the scratch space)
|
||||
memReallocate(g_BgPrimaryData, inflatedsize, MEMPOOL_STAGE);
|
||||
mempRealloc(g_BgPrimaryData, inflatedsize, MEMPOOL_STAGE);
|
||||
|
||||
// Load the section 2 header
|
||||
section2start = section1compsize + 0xc;
|
||||
|
|
@ -4693,7 +4693,7 @@ void bgInit(s32 stagenum)
|
|||
// Allocate space for the section 2 data (texture ID list), as well as an
|
||||
// extra 0x8000 for scratch space, and copy the compressed data to scratch.
|
||||
#if VERSION >= VERSION_NTSC_FINAL
|
||||
section2 = malloc(inflatedsize + 0x8000, MEMPOOL_STAGE);
|
||||
section2 = mempAlloc(inflatedsize + 0x8000, MEMPOOL_STAGE);
|
||||
scratch = (u32)section2 + 0x8000;
|
||||
#else
|
||||
// ntsc-1.0 and earlier gives less space for the compressed buffer.
|
||||
|
|
@ -4701,7 +4701,7 @@ void bgInit(s32 stagenum)
|
|||
// textures before this has a chance of overflowing and most stages only use
|
||||
// a few dozen. This was likely increased to 0x8000 out of caution while
|
||||
// trying to fix the Challenge 7 bug, but this is not the source of the bug.
|
||||
section2 = malloc(inflatedsize + 0x0800, MEMPOOL_STAGE);
|
||||
section2 = mempAlloc(inflatedsize + 0x0800, MEMPOOL_STAGE);
|
||||
scratch = (u32)section2 + 0x0800;
|
||||
#endif
|
||||
|
||||
|
|
@ -4720,7 +4720,7 @@ void bgInit(s32 stagenum)
|
|||
if (i);
|
||||
|
||||
// Free section 2
|
||||
memReallocate(section2, 0, MEMPOOL_STAGE);
|
||||
mempRealloc(section2, 0, MEMPOOL_STAGE);
|
||||
|
||||
g_BgSection3 = section2start + section2compsize + 4;
|
||||
|
||||
|
|
@ -4837,7 +4837,7 @@ glabel bgInit
|
|||
/* f155dec: 256dfff4 */ addiu $t5,$t3,-12
|
||||
/* f155df0: 3498000f */ ori $t8,$a0,0xf
|
||||
/* f155df4: ac4d0000 */ sw $t5,0x0($v0)
|
||||
/* f155df8: 0c004a0e */ jal malloc
|
||||
/* f155df8: 0c004a0e */ jal mempAlloc
|
||||
/* f155dfc: 3b04000f */ xori $a0,$t8,0xf
|
||||
/* f155e00: 00525021 */ addu $t2,$v0,$s2
|
||||
/* f155e04: 01518023 */ subu $s0,$t2,$s1
|
||||
|
|
@ -4865,7 +4865,7 @@ glabel bgInit
|
|||
/* f155e5c: 3c04800b */ lui $a0,0x800b
|
||||
/* f155e60: 8c84909c */ lw $a0,-0x6f64($a0)
|
||||
/* f155e64: 02402825 */ or $a1,$s2,$zero
|
||||
/* f155e68: 0c004a53 */ jal memReallocate
|
||||
/* f155e68: 0c004a53 */ jal mempRealloc
|
||||
/* f155e6c: 24060004 */ addiu $a2,$zero,0x4
|
||||
/* f155e70: 8fa50040 */ lw $a1,0x40($sp)
|
||||
/* f155e74: 8fa40038 */ lw $a0,0x38($sp)
|
||||
|
|
@ -4881,7 +4881,7 @@ glabel bgInit
|
|||
/* f155e9c: 2712ffff */ addiu $s2,$t8,-1
|
||||
/* f155ea0: 3649000f */ ori $t1,$s2,0xf
|
||||
/* f155ea4: 25240801 */ addiu $a0,$t1,0x801
|
||||
/* f155ea8: 0c004a0e */ jal malloc
|
||||
/* f155ea8: 0c004a0e */ jal mempAlloc
|
||||
/* f155eac: afb90048 */ sw $t9,0x48($sp)
|
||||
/* f155eb0: 8fa60048 */ lw $a2,0x48($sp)
|
||||
/* f155eb4: 8fa50034 */ lw $a1,0x34($sp)
|
||||
|
|
@ -4915,7 +4915,7 @@ glabel bgInit
|
|||
/* f155f20: 8fa4005c */ lw $a0,0x5c($sp)
|
||||
.NB0f155f24:
|
||||
/* f155f24: 00002825 */ or $a1,$zero,$zero
|
||||
/* f155f28: 0c004a53 */ jal memReallocate
|
||||
/* f155f28: 0c004a53 */ jal mempRealloc
|
||||
/* f155f2c: 24060004 */ addiu $a2,$zero,0x4
|
||||
/* f155f30: 8fae0034 */ lw $t6,0x34($sp)
|
||||
/* f155f34: 8faf0048 */ lw $t7,0x48($sp)
|
||||
|
|
@ -5036,7 +5036,7 @@ glabel var7f1b75d0
|
|||
/* f15b958: afb1001c */ sw $s1,0x1c($sp)
|
||||
/* f15b95c: afb00018 */ sw $s0,0x18($sp)
|
||||
/* f15b960: 39e4000f */ xori $a0,$t7,0xf
|
||||
/* f15b964: 0c0048f2 */ jal malloc
|
||||
/* f15b964: 0c0048f2 */ jal mempAlloc
|
||||
/* f15b968: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f15b96c: 8e6402bc */ lw $a0,0x2bc($s3)
|
||||
/* f15b970: 3c15800a */ lui $s5,%hi(g_Rooms)
|
||||
|
|
@ -5046,7 +5046,7 @@ glabel var7f1b75d0
|
|||
/* f15b980: 348e000f */ ori $t6,$a0,0xf
|
||||
/* f15b984: aea20000 */ sw $v0,0x0($s5)
|
||||
/* f15b988: 39c4000f */ xori $a0,$t6,0xf
|
||||
/* f15b98c: 0c0048f2 */ jal malloc
|
||||
/* f15b98c: 0c0048f2 */ jal mempAlloc
|
||||
/* f15b990: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f15b994: 8e7102bc */ lw $s1,0x2bc($s3)
|
||||
/* f15b998: 3c03800a */ lui $v1,%hi(var800a4ce8)
|
||||
|
|
@ -5076,7 +5076,7 @@ glabel var7f1b75d0
|
|||
/* f15b9f0: 2624000f */ addiu $a0,$s1,0xf
|
||||
/* f15b9f4: 3499000f */ ori $t9,$a0,0xf
|
||||
/* f15b9f8: 3b24000f */ xori $a0,$t9,0xf
|
||||
/* f15b9fc: 0c0048f2 */ jal malloc
|
||||
/* f15b9fc: 0c0048f2 */ jal mempAlloc
|
||||
/* f15ba00: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f15ba04: 8e7102bc */ lw $s1,0x2bc($s3)
|
||||
/* f15ba08: 3c03800a */ lui $v1,%hi(g_MpRoomVisibility)
|
||||
|
|
@ -5191,7 +5191,7 @@ glabel var7f1b75d0
|
|||
/* f15bba0: 2442fc40 */ addiu $v0,$v0,%lo(g_NumPortalThings)
|
||||
/* f15bba4: 348e000f */ ori $t6,$a0,0xf
|
||||
/* f15bba8: ac5e0000 */ sw $s8,0x0($v0)
|
||||
/* f15bbac: 0c0048f2 */ jal malloc
|
||||
/* f15bbac: 0c0048f2 */ jal mempAlloc
|
||||
/* f15bbb0: 39c4000f */ xori $a0,$t6,0xf
|
||||
/* f15bbb4: 3c01800a */ lui $at,%hi(g_PortalThings)
|
||||
/* f15bbb8: ac224cec */ sw $v0,%lo(g_PortalThings)($at)
|
||||
|
|
@ -5239,7 +5239,7 @@ glabel var7f1b75d0
|
|||
/* f15bc44: 2484000f */ addiu $a0,$a0,0xf
|
||||
/* f15bc48: 348e000f */ ori $t6,$a0,0xf
|
||||
/* f15bc4c: 39c4000f */ xori $a0,$t6,0xf
|
||||
/* f15bc50: 0c0048f2 */ jal malloc
|
||||
/* f15bc50: 0c0048f2 */ jal mempAlloc
|
||||
/* f15bc54: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f15bc58: 3c05800a */ lui $a1,%hi(g_Vars)
|
||||
/* f15bc5c: 24a59fc0 */ addiu $a1,$a1,%lo(g_Vars)
|
||||
|
|
@ -5417,7 +5417,7 @@ glabel var7f1b75d0
|
|||
.L0f15bebc:
|
||||
/* f15bebc: 2444000f */ addiu $a0,$v0,0xf
|
||||
/* f15bec0: 3498000f */ ori $t8,$a0,0xf
|
||||
/* f15bec4: 0c0048f2 */ jal malloc
|
||||
/* f15bec4: 0c0048f2 */ jal mempAlloc
|
||||
/* f15bec8: 3b04000f */ xori $a0,$t8,0xf
|
||||
/* f15becc: 3c10800a */ lui $s0,%hi(var800a4cd0)
|
||||
/* f15bed0: 26104cd0 */ addiu $s0,$s0,%lo(var800a4cd0)
|
||||
|
|
@ -5439,7 +5439,7 @@ glabel var7f1b75d0
|
|||
/* f15bf08: 2484000f */ addiu $a0,$a0,0xf
|
||||
/* f15bf0c: 3498000f */ ori $t8,$a0,0xf
|
||||
/* f15bf10: 3b04000f */ xori $a0,$t8,0xf
|
||||
/* f15bf14: 0c0048f2 */ jal malloc
|
||||
/* f15bf14: 0c0048f2 */ jal mempAlloc
|
||||
/* f15bf18: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f15bf1c: 3c01800a */ lui $at,%hi(var800a4ccc)
|
||||
/* f15bf20: 1bc00095 */ blez $s8,.L0f15c178
|
||||
|
|
@ -5712,7 +5712,7 @@ glabel var7f1b75d0
|
|||
/* f15c310: 3459000f */ ori $t9,$v0,0xf
|
||||
/* f15c314: 27220001 */ addiu $v0,$t9,0x1
|
||||
/* f15c318: 00412021 */ addu $a0,$v0,$at
|
||||
/* f15c31c: 0c0048f2 */ jal malloc
|
||||
/* f15c31c: 0c0048f2 */ jal mempAlloc
|
||||
/* f15c320: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f15c324: 8e450000 */ lw $a1,0x0($s2)
|
||||
/* f15c328: 34018000 */ dli $at,0x8000
|
||||
|
|
@ -5916,7 +5916,7 @@ glabel var7f1b75d0
|
|||
.L0f15c628:
|
||||
/* f15c628: 8fa4008c */ lw $a0,0x8c($sp)
|
||||
/* f15c62c: 00002825 */ or $a1,$zero,$zero
|
||||
/* f15c630: 0c00490c */ jal memReallocate
|
||||
/* f15c630: 0c00490c */ jal mempRealloc
|
||||
/* f15c634: 24060004 */ addiu $a2,$zero,0x4
|
||||
/* f15c638: 8fd102bc */ lw $s1,0x2bc($s8)
|
||||
/* f15c63c: 24140001 */ addiu $s4,$zero,0x1
|
||||
|
|
@ -5955,7 +5955,7 @@ glabel var7f1b75d0
|
|||
/* f15c6b0: 2484000f */ addiu $a0,$a0,0xf
|
||||
/* f15c6b4: 348f000f */ ori $t7,$a0,0xf
|
||||
/* f15c6b8: 39e4000f */ xori $a0,$t7,0xf
|
||||
/* f15c6bc: 0c0048f2 */ jal malloc
|
||||
/* f15c6bc: 0c0048f2 */ jal mempAlloc
|
||||
/* f15c6c0: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f15c6c4: 3c03800a */ lui $v1,%hi(var800a41a0)
|
||||
/* f15c6c8: 246341a0 */ addiu $v1,$v1,%lo(var800a41a0)
|
||||
|
|
@ -6100,7 +6100,7 @@ glabel var7f1b75d0
|
|||
/* f15b71c: afb1001c */ sw $s1,0x1c($sp)
|
||||
/* f15b720: afb00018 */ sw $s0,0x18($sp)
|
||||
/* f15b724: 39e4000f */ xori $a0,$t7,0xf
|
||||
/* f15b728: 0c0048f2 */ jal malloc
|
||||
/* f15b728: 0c0048f2 */ jal mempAlloc
|
||||
/* f15b72c: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f15b730: 8e6402bc */ lw $a0,0x2bc($s3)
|
||||
/* f15b734: 3c15800a */ lui $s5,%hi(g_Rooms)
|
||||
|
|
@ -6110,7 +6110,7 @@ glabel var7f1b75d0
|
|||
/* f15b744: 348e000f */ ori $t6,$a0,0xf
|
||||
/* f15b748: aea20000 */ sw $v0,0x0($s5)
|
||||
/* f15b74c: 39c4000f */ xori $a0,$t6,0xf
|
||||
/* f15b750: 0c0048f2 */ jal malloc
|
||||
/* f15b750: 0c0048f2 */ jal mempAlloc
|
||||
/* f15b754: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f15b758: 8e7102bc */ lw $s1,0x2bc($s3)
|
||||
/* f15b75c: 3c03800a */ lui $v1,%hi(var800a4ce8)
|
||||
|
|
@ -6140,7 +6140,7 @@ glabel var7f1b75d0
|
|||
/* f15b7b4: 2624000f */ addiu $a0,$s1,0xf
|
||||
/* f15b7b8: 3499000f */ ori $t9,$a0,0xf
|
||||
/* f15b7bc: 3b24000f */ xori $a0,$t9,0xf
|
||||
/* f15b7c0: 0c0048f2 */ jal malloc
|
||||
/* f15b7c0: 0c0048f2 */ jal mempAlloc
|
||||
/* f15b7c4: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f15b7c8: 8e7102bc */ lw $s1,0x2bc($s3)
|
||||
/* f15b7cc: 3c03800a */ lui $v1,%hi(g_MpRoomVisibility)
|
||||
|
|
@ -6255,7 +6255,7 @@ glabel var7f1b75d0
|
|||
/* f15b964: 2442fc40 */ addiu $v0,$v0,%lo(g_NumPortalThings)
|
||||
/* f15b968: 348e000f */ ori $t6,$a0,0xf
|
||||
/* f15b96c: ac5e0000 */ sw $s8,0x0($v0)
|
||||
/* f15b970: 0c0048f2 */ jal malloc
|
||||
/* f15b970: 0c0048f2 */ jal mempAlloc
|
||||
/* f15b974: 39c4000f */ xori $a0,$t6,0xf
|
||||
/* f15b978: 3c01800a */ lui $at,%hi(g_PortalThings)
|
||||
/* f15b97c: ac224cec */ sw $v0,%lo(g_PortalThings)($at)
|
||||
|
|
@ -6303,7 +6303,7 @@ glabel var7f1b75d0
|
|||
/* f15ba08: 2484000f */ addiu $a0,$a0,0xf
|
||||
/* f15ba0c: 348e000f */ ori $t6,$a0,0xf
|
||||
/* f15ba10: 39c4000f */ xori $a0,$t6,0xf
|
||||
/* f15ba14: 0c0048f2 */ jal malloc
|
||||
/* f15ba14: 0c0048f2 */ jal mempAlloc
|
||||
/* f15ba18: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f15ba1c: 3c05800a */ lui $a1,%hi(g_Vars)
|
||||
/* f15ba20: 24a59fc0 */ addiu $a1,$a1,%lo(g_Vars)
|
||||
|
|
@ -6481,7 +6481,7 @@ glabel var7f1b75d0
|
|||
.L0f15bc80:
|
||||
/* f15bc80: 2444000f */ addiu $a0,$v0,0xf
|
||||
/* f15bc84: 3498000f */ ori $t8,$a0,0xf
|
||||
/* f15bc88: 0c0048f2 */ jal malloc
|
||||
/* f15bc88: 0c0048f2 */ jal mempAlloc
|
||||
/* f15bc8c: 3b04000f */ xori $a0,$t8,0xf
|
||||
/* f15bc90: 3c10800a */ lui $s0,%hi(var800a4cd0)
|
||||
/* f15bc94: 26104cd0 */ addiu $s0,$s0,%lo(var800a4cd0)
|
||||
|
|
@ -6503,7 +6503,7 @@ glabel var7f1b75d0
|
|||
/* f15bccc: 2484000f */ addiu $a0,$a0,0xf
|
||||
/* f15bcd0: 3498000f */ ori $t8,$a0,0xf
|
||||
/* f15bcd4: 3b04000f */ xori $a0,$t8,0xf
|
||||
/* f15bcd8: 0c0048f2 */ jal malloc
|
||||
/* f15bcd8: 0c0048f2 */ jal mempAlloc
|
||||
/* f15bcdc: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f15bce0: 3c01800a */ lui $at,%hi(var800a4ccc)
|
||||
/* f15bce4: 1bc00095 */ blez $s8,.L0f15bf3c
|
||||
|
|
@ -6775,7 +6775,7 @@ glabel var7f1b75d0
|
|||
/* f15c0d0: 25e2ffff */ addiu $v0,$t7,-1
|
||||
/* f15c0d4: 3459000f */ ori $t9,$v0,0xf
|
||||
/* f15c0d8: 03201025 */ or $v0,$t9,$zero
|
||||
/* f15c0dc: 0c0048f2 */ jal malloc
|
||||
/* f15c0dc: 0c0048f2 */ jal mempAlloc
|
||||
/* f15c0e0: 24441001 */ addiu $a0,$v0,0x1001
|
||||
/* f15c0e4: 8e450000 */ lw $a1,0x0($s2)
|
||||
/* f15c0e8: 2626ffff */ addiu $a2,$s1,-1
|
||||
|
|
@ -6978,7 +6978,7 @@ glabel var7f1b75d0
|
|||
.L0f15c3e4:
|
||||
/* f15c3e4: 8fa4008c */ lw $a0,0x8c($sp)
|
||||
/* f15c3e8: 00002825 */ or $a1,$zero,$zero
|
||||
/* f15c3ec: 0c00490c */ jal memReallocate
|
||||
/* f15c3ec: 0c00490c */ jal mempRealloc
|
||||
/* f15c3f0: 24060004 */ addiu $a2,$zero,0x4
|
||||
/* f15c3f4: 8fd102bc */ lw $s1,0x2bc($s8)
|
||||
/* f15c3f8: 24140001 */ addiu $s4,$zero,0x1
|
||||
|
|
@ -7017,7 +7017,7 @@ glabel var7f1b75d0
|
|||
/* f15c46c: 2484000f */ addiu $a0,$a0,0xf
|
||||
/* f15c470: 348f000f */ ori $t7,$a0,0xf
|
||||
/* f15c474: 39e4000f */ xori $a0,$t7,0xf
|
||||
/* f15c478: 0c0048f2 */ jal malloc
|
||||
/* f15c478: 0c0048f2 */ jal mempAlloc
|
||||
/* f15c47c: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f15c480: 3c03800a */ lui $v1,%hi(var800a41a0)
|
||||
/* f15c484: 246341a0 */ addiu $v1,$v1,%lo(var800a41a0)
|
||||
|
|
@ -7162,7 +7162,7 @@ glabel var7f1b75d0
|
|||
/* f1560b0: afb1001c */ sw $s1,0x1c($sp)
|
||||
/* f1560b4: afb00018 */ sw $s0,0x18($sp)
|
||||
/* f1560b8: 39e4000f */ xori $a0,$t7,0xf
|
||||
/* f1560bc: 0c004a0e */ jal malloc
|
||||
/* f1560bc: 0c004a0e */ jal mempAlloc
|
||||
/* f1560c0: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f1560c4: 8e6402bc */ lw $a0,0x2bc($s3)
|
||||
/* f1560c8: 3c15800b */ lui $s5,0x800b
|
||||
|
|
@ -7172,7 +7172,7 @@ glabel var7f1b75d0
|
|||
/* f1560d8: 348e000f */ ori $t6,$a0,0xf
|
||||
/* f1560dc: aea20000 */ sw $v0,0x0($s5)
|
||||
/* f1560e0: 39c4000f */ xori $a0,$t6,0xf
|
||||
/* f1560e4: 0c004a0e */ jal malloc
|
||||
/* f1560e4: 0c004a0e */ jal mempAlloc
|
||||
/* f1560e8: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f1560ec: 8e7102bc */ lw $s1,0x2bc($s3)
|
||||
/* f1560f0: 3c03800b */ lui $v1,0x800b
|
||||
|
|
@ -7202,7 +7202,7 @@ glabel var7f1b75d0
|
|||
/* f156148: 2624000f */ addiu $a0,$s1,0xf
|
||||
/* f15614c: 3499000f */ ori $t9,$a0,0xf
|
||||
/* f156150: 3b24000f */ xori $a0,$t9,0xf
|
||||
/* f156154: 0c004a0e */ jal malloc
|
||||
/* f156154: 0c004a0e */ jal mempAlloc
|
||||
/* f156158: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f15615c: 8e7102bc */ lw $s1,0x2bc($s3)
|
||||
/* f156160: 3c03800b */ lui $v1,0x800b
|
||||
|
|
@ -7317,7 +7317,7 @@ glabel var7f1b75d0
|
|||
/* f1562f8: 244224a4 */ addiu $v0,$v0,0x24a4
|
||||
/* f1562fc: 348e000f */ ori $t6,$a0,0xf
|
||||
/* f156300: ac5e0000 */ sw $s8,0x0($v0)
|
||||
/* f156304: 0c004a0e */ jal malloc
|
||||
/* f156304: 0c004a0e */ jal mempAlloc
|
||||
/* f156308: 39c4000f */ xori $a0,$t6,0xf
|
||||
/* f15630c: 3c01800b */ lui $at,0x800b
|
||||
/* f156310: ac22946c */ sw $v0,-0x6b94($at)
|
||||
|
|
@ -7365,7 +7365,7 @@ glabel var7f1b75d0
|
|||
/* f15639c: 2484000f */ addiu $a0,$a0,0xf
|
||||
/* f1563a0: 348e000f */ ori $t6,$a0,0xf
|
||||
/* f1563a4: 39c4000f */ xori $a0,$t6,0xf
|
||||
/* f1563a8: 0c004a0e */ jal malloc
|
||||
/* f1563a8: 0c004a0e */ jal mempAlloc
|
||||
/* f1563ac: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f1563b0: 3c05800a */ lui $a1,0x800a
|
||||
/* f1563b4: 24a5e6c0 */ addiu $a1,$a1,-6464
|
||||
|
|
@ -7543,7 +7543,7 @@ glabel var7f1b75d0
|
|||
.NB0f156614:
|
||||
/* f156614: 2444000f */ addiu $a0,$v0,0xf
|
||||
/* f156618: 3498000f */ ori $t8,$a0,0xf
|
||||
/* f15661c: 0c004a0e */ jal malloc
|
||||
/* f15661c: 0c004a0e */ jal mempAlloc
|
||||
/* f156620: 3b04000f */ xori $a0,$t8,0xf
|
||||
/* f156624: 3c10800b */ lui $s0,0x800b
|
||||
/* f156628: 26109450 */ addiu $s0,$s0,-27568
|
||||
|
|
@ -7565,7 +7565,7 @@ glabel var7f1b75d0
|
|||
/* f156660: 2484000f */ addiu $a0,$a0,0xf
|
||||
/* f156664: 3498000f */ ori $t8,$a0,0xf
|
||||
/* f156668: 3b04000f */ xori $a0,$t8,0xf
|
||||
/* f15666c: 0c004a0e */ jal malloc
|
||||
/* f15666c: 0c004a0e */ jal mempAlloc
|
||||
/* f156670: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f156674: 3c01800b */ lui $at,0x800b
|
||||
/* f156678: 1bc00095 */ blez $s8,.NB0f1568d0
|
||||
|
|
@ -7837,7 +7837,7 @@ glabel var7f1b75d0
|
|||
/* f156a64: 25e2ffff */ addiu $v0,$t7,-1
|
||||
/* f156a68: 3459000f */ ori $t9,$v0,0xf
|
||||
/* f156a6c: 03201025 */ or $v0,$t9,$zero
|
||||
/* f156a70: 0c004a0e */ jal malloc
|
||||
/* f156a70: 0c004a0e */ jal mempAlloc
|
||||
/* f156a74: 24441001 */ addiu $a0,$v0,0x1001
|
||||
/* f156a78: 8e450000 */ lw $a1,0x0($s2)
|
||||
/* f156a7c: 2626ffff */ addiu $a2,$s1,-1
|
||||
|
|
@ -8040,7 +8040,7 @@ glabel var7f1b75d0
|
|||
.NB0f156d78:
|
||||
/* f156d78: 8fa4008c */ lw $a0,0x8c($sp)
|
||||
/* f156d7c: 00002825 */ or $a1,$zero,$zero
|
||||
/* f156d80: 0c004a53 */ jal memReallocate
|
||||
/* f156d80: 0c004a53 */ jal mempRealloc
|
||||
/* f156d84: 24060004 */ addiu $a2,$zero,0x4
|
||||
/* f156d88: 8fd102bc */ lw $s1,0x2bc($s8)
|
||||
/* f156d8c: 24140001 */ addiu $s4,$zero,0x1
|
||||
|
|
@ -8079,7 +8079,7 @@ glabel var7f1b75d0
|
|||
/* f156e00: 2484000f */ addiu $a0,$a0,0xf
|
||||
/* f156e04: 348f000f */ ori $t7,$a0,0xf
|
||||
/* f156e08: 39e4000f */ xori $a0,$t7,0xf
|
||||
/* f156e0c: 0c004a0e */ jal malloc
|
||||
/* f156e0c: 0c004a0e */ jal mempAlloc
|
||||
/* f156e10: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f156e14: 3c03800b */ lui $v1,0x800b
|
||||
/* f156e18: 24638760 */ addiu $v1,$v1,-30880
|
||||
|
|
@ -8221,8 +8221,8 @@ glabel var7f1b75d0
|
|||
// u32 scratch;
|
||||
// struct portalvertices *pvertices;
|
||||
//
|
||||
// g_Rooms = malloc(ALIGN16(g_Vars.roomcount * sizeof(struct room)), MEMPOOL_STAGE);
|
||||
// var800a4ce8 = malloc(ALIGN16(g_Vars.roomcount * sizeof(struct var800a4ce8)), MEMPOOL_STAGE);
|
||||
// g_Rooms = mempAlloc(ALIGN16(g_Vars.roomcount * sizeof(struct room)), MEMPOOL_STAGE);
|
||||
// var800a4ce8 = mempAlloc(ALIGN16(g_Vars.roomcount * sizeof(struct var800a4ce8)), MEMPOOL_STAGE);
|
||||
//
|
||||
// // 9b8
|
||||
// for (s4 = 0; s4 < g_Vars.roomcount; s4++) {
|
||||
|
|
@ -8232,7 +8232,7 @@ glabel var7f1b75d0
|
|||
//
|
||||
// // 9ec
|
||||
// if (g_Vars.mplayerisrunning) {
|
||||
// g_MpRoomVisibility = malloc(ALIGN16(g_Vars.roomcount), MEMPOOL_STAGE);
|
||||
// g_MpRoomVisibility = mempAlloc(ALIGN16(g_Vars.roomcount), MEMPOOL_STAGE);
|
||||
//
|
||||
// for (s4 = 0; s4 < g_Vars.roomcount; s4++) {
|
||||
// g_MpRoomVisibility[s4] = 0;
|
||||
|
|
@ -8274,7 +8274,7 @@ glabel var7f1b75d0
|
|||
// }
|
||||
//
|
||||
// g_NumPortalThings = numportals;
|
||||
// g_PortalThings = malloc(ALIGN16(g_NumPortalThings * sizeof(struct portalthing)), MEMPOOL_STAGE);
|
||||
// g_PortalThings = mempAlloc(ALIGN16(g_NumPortalThings * sizeof(struct portalthing)), MEMPOOL_STAGE);
|
||||
//
|
||||
// // Iterate the portals and update their unk00 value. In storage, the
|
||||
// // g_BgPortals array is followed by vertice data, and each portal's
|
||||
|
|
@ -8311,7 +8311,7 @@ glabel var7f1b75d0
|
|||
// // number ascending. Each room struct contains an index into this array
|
||||
// // where its portal numbers start.
|
||||
// index = 0;
|
||||
// g_RoomPortals = malloc(ALIGN16((numportals == 0 ? 1 : numportals) * sizeof(s16 *)), MEMPOOL_STAGE);
|
||||
// g_RoomPortals = mempAlloc(ALIGN16((numportals == 0 ? 1 : numportals) * sizeof(s16 *)), MEMPOOL_STAGE);
|
||||
//
|
||||
// g_Vars.roomportalrecursionlimit = 0;
|
||||
//
|
||||
|
|
@ -8396,14 +8396,14 @@ glabel var7f1b75d0
|
|||
// }
|
||||
//
|
||||
// // ea8
|
||||
// var800a4cd0 = malloc(ALIGN16(numportals == 0 ? 1 : numportals), MEMPOOL_STAGE);
|
||||
// var800a4cd0 = mempAlloc(ALIGN16(numportals == 0 ? 1 : numportals), MEMPOOL_STAGE);
|
||||
//
|
||||
// // edc
|
||||
// for (s4 = 0; s4 < numportals; s4++) {
|
||||
// var800a4cd0[s4] = func0f15b4c0(s4);
|
||||
// }
|
||||
//
|
||||
// var800a4ccc = malloc(ALIGN16(numportals * sizeof(struct var800a4ccc)), MEMPOOL_STAGE);
|
||||
// var800a4ccc = mempAlloc(ALIGN16(numportals * sizeof(struct var800a4ccc)), MEMPOOL_STAGE);
|
||||
//
|
||||
// // f38
|
||||
// for (s4 = 0; s4 < numportals; s4++) {
|
||||
|
|
@ -8501,7 +8501,7 @@ glabel var7f1b75d0
|
|||
// inflatedsize = (*(u16 *)&header[0] & 0x7fff) - 1;
|
||||
// section3compsize = *(u16 *)&header[2];
|
||||
// inflatedsize = (inflatedsize | 0xf) + 1;
|
||||
// section3 = malloc(inflatedsize + 0x8000, MEMPOOL_STAGE);
|
||||
// section3 = mempAlloc(inflatedsize + 0x8000, MEMPOOL_STAGE);
|
||||
// scratch = (u32)section3 + 0x8000;
|
||||
// bgLoadFile((u8 *)scratch, g_BgSection3 + 4, (section3compsize - 1 | 0xf) + 1);
|
||||
// bgInflate((u8 *)scratch, section3, section3compsize);
|
||||
|
|
@ -8554,7 +8554,7 @@ glabel var7f1b75d0
|
|||
// section3ptr++;
|
||||
// }
|
||||
//
|
||||
// memReallocate(section3, 0, MEMPOOL_STAGE);
|
||||
// mempRealloc(section3, 0, MEMPOOL_STAGE);
|
||||
//
|
||||
// // 64c
|
||||
// for (s4 = 1; s4 < g_Vars.roomcount; s4++) {
|
||||
|
|
@ -8570,7 +8570,7 @@ glabel var7f1b75d0
|
|||
//
|
||||
// // 6a0
|
||||
// if (numlights) {
|
||||
// var800a41a0 = malloc(ALIGN16(numlights * 3), MEMPOOL_STAGE);
|
||||
// var800a41a0 = mempAlloc(ALIGN16(numlights * 3), MEMPOOL_STAGE);
|
||||
//
|
||||
// for (s4 = 0; s4 < numlights; s4++) {
|
||||
// var800a41a0[s4 * 3 + 0] = 0;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
#include "bss.h"
|
||||
#include "lib/fault.h"
|
||||
#include "lib/snd.h"
|
||||
#include "lib/lib_126b0.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@
|
|||
#include "game/utils.h"
|
||||
#include "bss.h"
|
||||
#include "lib/main.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/model.h"
|
||||
#include "lib/lib_126b0.h"
|
||||
#include "lib/mema.h"
|
||||
#include "lib/rng.h"
|
||||
#include "lib/mtx.h"
|
||||
#include "lib/libc/ll.h"
|
||||
|
|
@ -502,8 +502,8 @@ void phAllocate(void)
|
|||
u32 size1 = align16(sizeof(struct var8007f8dc) * 4);
|
||||
u32 size2 = align16(sizeof(struct var800a45a0));
|
||||
|
||||
var8007f8dc = malloc(size1, MEMPOOL_PERMANENT);
|
||||
var800a45a0 = malloc(size2, MEMPOOL_PERMANENT);
|
||||
var8007f8dc = mempAlloc(size1, MEMPOOL_PERMANENT);
|
||||
var800a45a0 = mempAlloc(size2, MEMPOOL_PERMANENT);
|
||||
|
||||
func0f14a240();
|
||||
|
||||
|
|
@ -1093,7 +1093,7 @@ glabel func0f14aee0
|
|||
/* f14af58: 0fc5db69 */ jal align16
|
||||
/* f14af5c: 00942021 */ addu $a0,$a0,$s4
|
||||
/* f14af60: 02022021 */ addu $a0,$s0,$v0
|
||||
/* f14af64: 0c0048f2 */ jal malloc
|
||||
/* f14af64: 0c0048f2 */ jal mempAlloc
|
||||
/* f14af68: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f14af6c: 8eaf0000 */ lw $t7,0x0($s5)
|
||||
/* f14af70: 2451018c */ addiu $s1,$v0,0x18c
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
#include "bss.h"
|
||||
#include "lib/vi.h"
|
||||
#include "lib/main.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/rng.h"
|
||||
#include "lib/mtx.h"
|
||||
#include "data.h"
|
||||
|
|
@ -6094,7 +6094,7 @@ void creditsInit(void)
|
|||
var800a416c = 0;
|
||||
var8007f130 = 0;
|
||||
|
||||
g_CreditsData = malloc(sizeof(struct creditsdata), MEMPOOL_STAGE);
|
||||
g_CreditsData = mempAlloc(sizeof(struct creditsdata), MEMPOOL_STAGE);
|
||||
|
||||
g_CreditsData->unk2eec = 0;
|
||||
g_CreditsData->unk41b0[0] = 0;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
#include "game/wallhit.h"
|
||||
#include "bss.h"
|
||||
#include "lib/snd.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/rng.h"
|
||||
#include "lib/mtx.h"
|
||||
#include "lib/lib_2f490.h"
|
||||
|
|
@ -1237,7 +1237,7 @@ glabel func0f001c0c
|
|||
/* f001d08: 000470c0 */ sll $t6,$a0,0x3
|
||||
/* f001d0c: 0fc5db69 */ jal align16
|
||||
/* f001d10: 01c02025 */ or $a0,$t6,$zero
|
||||
/* f001d14: 0c0048b8 */ jal memGetPool4Available
|
||||
/* f001d14: 0c0048b8 */ jal mempGetStageFree
|
||||
/* f001d18: afa20068 */ sw $v0,0x68($sp)
|
||||
/* f001d1c: 0fc5d820 */ jal func0f176080
|
||||
/* f001d20: 00000000 */ nop
|
||||
|
|
@ -1253,7 +1253,7 @@ glabel func0f001c0c
|
|||
/* f001d48: afa70048 */ sw $a3,0x48($sp)
|
||||
/* f001d4c: 00f2a821 */ addu $s5,$a3,$s2
|
||||
/* f001d50: 8fa40068 */ lw $a0,0x68($sp)
|
||||
/* f001d54: 0c0048f2 */ jal malloc
|
||||
/* f001d54: 0c0048f2 */ jal mempAlloc
|
||||
/* f001d58: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f001d5c: 8e0f0000 */ lw $t7,0x0($s0)
|
||||
/* f001d60: 3c148006 */ lui $s4,%hi(var80061420)
|
||||
|
|
@ -1338,7 +1338,7 @@ glabel func0f001c0c
|
|||
/* f001e78: 0fc5db69 */ jal align16
|
||||
/* f001e7c: 03c02025 */ or $a0,$s8,$zero
|
||||
/* f001e80: 00402025 */ or $a0,$v0,$zero
|
||||
/* f001e84: 0c0048f2 */ jal malloc
|
||||
/* f001e84: 0c0048f2 */ jal mempAlloc
|
||||
/* f001e88: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f001e8c: 03c02025 */ or $a0,$s8,$zero
|
||||
/* f001e90: 0040b825 */ or $s7,$v0,$zero
|
||||
|
|
@ -1426,7 +1426,7 @@ glabel func0f001c0c
|
|||
/* f001fc0: 0fc5db69 */ jal align16
|
||||
/* f001fc4: 03c02025 */ or $a0,$s8,$zero
|
||||
/* f001fc8: 00402025 */ or $a0,$v0,$zero
|
||||
/* f001fcc: 0c0048f2 */ jal malloc
|
||||
/* f001fcc: 0c0048f2 */ jal mempAlloc
|
||||
/* f001fd0: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f001fd4: 0040b825 */ or $s7,$v0,$zero
|
||||
/* f001fd8: 0fc5db69 */ jal align16
|
||||
|
|
@ -5212,7 +5212,7 @@ glabel func0f004c6c
|
|||
/* f004d34: 0fc5db69 */ jal align16
|
||||
/* f004d38: 00402025 */ or $a0,$v0,$zero
|
||||
/* f004d3c: 00402025 */ or $a0,$v0,$zero
|
||||
/* f004d40: 0c0048f2 */ jal malloc
|
||||
/* f004d40: 0c0048f2 */ jal mempAlloc
|
||||
/* f004d44: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f004d48: 8ea50000 */ lw $a1,0x0($s5)
|
||||
/* f004d4c: 8fa30038 */ lw $v1,0x38($sp)
|
||||
|
|
@ -5257,7 +5257,7 @@ glabel func0f004c6c
|
|||
/* f004dd8: 028c2021 */ addu $a0,$s4,$t4
|
||||
/* f004ddc: 0fc5db69 */ jal align16
|
||||
/* f004de0: 00000000 */ nop
|
||||
/* f004de4: 0c0048c9 */ jal memGetNextPool4Allocation
|
||||
/* f004de4: 0c0048c9 */ jal mempGetNextStageAllocation
|
||||
/* f004de8: 00000000 */ nop
|
||||
/* f004dec: 8fad0044 */ lw $t5,0x44($sp)
|
||||
/* f004df0: 3c01800a */ lui $at,%hi(var8009cad0)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include <ultra64.h>
|
||||
#include "constants.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ void explosionsInit(void)
|
|||
if (g_MaxExplosions == 0) {
|
||||
g_Explosions = NULL;
|
||||
} else {
|
||||
g_Explosions = malloc((g_MaxExplosions * sizeof(struct explosion) + 0xf) & ~0xf, MEMPOOL_STAGE);
|
||||
g_Explosions = mempAlloc((g_MaxExplosions * sizeof(struct explosion) + 0xf) & ~0xf, MEMPOOL_STAGE);
|
||||
|
||||
for (i = 0; i < g_MaxExplosions; i++) {
|
||||
g_Explosions[i].prop = NULL;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include "bss.h"
|
||||
#include "lib/rzip.h"
|
||||
#include "lib/dma.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/rng.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
|
@ -4505,7 +4505,7 @@ glabel func0f1670fc
|
|||
.L0f167174:
|
||||
/* f167174: 8e040000 */ lw $a0,0x0($s0)
|
||||
.L0f167178:
|
||||
/* f167178: 0c0048f2 */ jal malloc
|
||||
/* f167178: 0c0048f2 */ jal mempAlloc
|
||||
/* f16717c: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f167180: afa20024 */ sw $v0,0x24($sp)
|
||||
/* f167184: 8e050000 */ lw $a1,0x0($s0)
|
||||
|
|
@ -4523,7 +4523,7 @@ glabel func0f1670fc
|
|||
/* f1671b4: 8fa40024 */ lw $a0,0x24($sp)
|
||||
/* f1671b8: 11010007 */ beq $t0,$at,.L0f1671d8
|
||||
/* f1671bc: 24060004 */ addiu $a2,$zero,0x4
|
||||
/* f1671c0: 0c00490c */ jal memReallocate
|
||||
/* f1671c0: 0c00490c */ jal mempRealloc
|
||||
/* f1671c4: 8e050000 */ lw $a1,0x0($s0)
|
||||
/* f1671c8: 10000004 */ b .L0f1671dc
|
||||
/* f1671cc: 8fbf001c */ lw $ra,0x1c($sp)
|
||||
|
|
@ -4565,12 +4565,12 @@ glabel func0f1670fc
|
|||
// }
|
||||
//
|
||||
// // 174
|
||||
// ptr = malloc(info->unk00, MEMPOOL_STAGE);
|
||||
// ptr = mempAlloc(info->unk00, MEMPOOL_STAGE);
|
||||
// info->unk04 = info->unk00;
|
||||
// func0f166eb4(ptr, info->unk00, &filetable[filenum], info);
|
||||
//
|
||||
// if (arg1 != 0x11) {
|
||||
// memReallocate(ptr, info->unk00, MEMPOOL_STAGE);
|
||||
// mempRealloc(ptr, info->unk00, MEMPOOL_STAGE);
|
||||
// }
|
||||
// } else {
|
||||
// while (true) {
|
||||
|
|
@ -4650,7 +4650,7 @@ void func0f1672a8(s32 filenum, void *ptr, u32 size, bool resizing)
|
|||
g_FileInfo[filenum].unk04 = size;
|
||||
|
||||
if (resizing) {
|
||||
memReallocate(ptr, g_FileInfo[filenum].size, MEMPOOL_STAGE);
|
||||
mempRealloc(ptr, g_FileInfo[filenum].size, MEMPOOL_STAGE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
#include "bss.h"
|
||||
#include "lib/fault.h"
|
||||
#include "lib/snd.h"
|
||||
#include "lib/lib_126b0.h"
|
||||
#include "lib/mema.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
#include "game/utils.h"
|
||||
#include "bss.h"
|
||||
#include "lib/vi.h"
|
||||
#include "lib/lib_126b0.h"
|
||||
#include "lib/mema.h"
|
||||
#include "lib/str.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include <ultra64.h>
|
||||
#include "constants.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
|
|
@ -10,8 +10,8 @@ void func0f000000(void)
|
|||
s32 i;
|
||||
|
||||
if (g_Jpn) {
|
||||
var800aabb4 = malloc(0x2e80, MEMPOOL_PERMANENT);
|
||||
var800aabb8 = malloc(0x100, MEMPOOL_PERMANENT);
|
||||
var800aabb4 = mempAlloc(0x2e80, MEMPOOL_PERMANENT);
|
||||
var800aabb8 = mempAlloc(0x100, MEMPOOL_PERMANENT);
|
||||
|
||||
for (i = 0; i < 0x7c; i++) {
|
||||
var800aabb8[i].unk00_00 = 0;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "constants.h"
|
||||
#include "bss.h"
|
||||
#include "lib/dma.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
|
|
@ -13,7 +13,7 @@ void loadTextureList(void)
|
|||
|
||||
u32 len = ((&_textureslistSegmentRomEnd - &_textureslistSegmentRomStart) + 15) & -16;
|
||||
|
||||
g_Textures = malloc(len, MEMPOOL_PERMANENT);
|
||||
g_Textures = mempAlloc(len, MEMPOOL_PERMANENT);
|
||||
|
||||
dmaExec(g_Textures, (u32) &_textureslistSegmentRomStart, len);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "game/file.h"
|
||||
#include "game/lang.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ glabel stageLoadCommonLang
|
|||
.PF0f00b3c0:
|
||||
/* f00b3c0: 348f000f */ ori $t7,$a0,0xf
|
||||
/* f00b3c4: 39e4000f */ xori $a0,$t7,0xf
|
||||
/* f00b3c8: 0c004856 */ jal malloc
|
||||
/* f00b3c8: 0c004856 */ jal mempAlloc
|
||||
/* f00b3cc: afa30018 */ sw $v1,0x18($sp)
|
||||
/* f00b3d0: 3c018008 */ lui $at,0x8008
|
||||
/* f00b3d4: 8fa30018 */ lw $v1,0x18($sp)
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@
|
|||
#include "game/file.h"
|
||||
#include "game/lang.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
void func0f00b420(void)
|
||||
{
|
||||
var80062410 = 0;
|
||||
var8009cc80 = malloc(2 * sizeof(Mtx), MEMPOOL_STAGE);
|
||||
var8009cc84 = malloc(2 * sizeof(Mtx), MEMPOOL_STAGE);
|
||||
var8009cc88 = malloc(2 * sizeof(Mtx), MEMPOOL_STAGE);
|
||||
var8009cc80 = mempAlloc(2 * sizeof(Mtx), MEMPOOL_STAGE);
|
||||
var8009cc84 = mempAlloc(2 * sizeof(Mtx), MEMPOOL_STAGE);
|
||||
var8009cc88 = mempAlloc(2 * sizeof(Mtx), MEMPOOL_STAGE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include "game/game_00b820.h"
|
||||
#include "game/title.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ void func0f00b480(void)
|
|||
g_TitleNextMode = TITLEMODE_SKIP;
|
||||
}
|
||||
|
||||
var8009cca0 = malloc(0x47800, MEMPOOL_STAGE);
|
||||
var8009cca0 = mempAlloc(0x47800, MEMPOOL_STAGE);
|
||||
|
||||
func0f00b420();
|
||||
}
|
||||
|
|
@ -41,7 +41,7 @@ void func0f00b510(void)
|
|||
g_ChrSlots = NULL;
|
||||
g_NumChrSlots = 0;
|
||||
|
||||
var80062a8c = malloc(sizeof(struct var80062a8c) * 20, MEMPOOL_STAGE);
|
||||
var80062a8c = mempAlloc(sizeof(struct var80062a8c) * 20, MEMPOOL_STAGE);
|
||||
|
||||
for (i = 0; i < 20; i++) {
|
||||
var80062a8c[i].prop = NULL;
|
||||
|
|
@ -51,12 +51,12 @@ void func0f00b510(void)
|
|||
g_NumChrs = 0;
|
||||
g_Chrnums = NULL;
|
||||
g_ChrIndexes = NULL;
|
||||
var80062960 = malloc(0x1470, MEMPOOL_STAGE);
|
||||
var80062960 = mempAlloc(0x1470, MEMPOOL_STAGE);
|
||||
|
||||
for (i = 0; i < 20; i++) {
|
||||
// @bug? Should the ALIGN64 should surely be applied before malloc...?
|
||||
// @bug? Should the ALIGN64 should surely be applied before mempAlloc...?
|
||||
// Not a bug if only 0x200 bytes are being used
|
||||
var8009ccc0[i] = (void *)ALIGN64(malloc(0x240, MEMPOOL_STAGE));
|
||||
var8009ccc0[i] = (void *)ALIGN64(mempAlloc(0x240, MEMPOOL_STAGE));
|
||||
}
|
||||
|
||||
resetSomeStageThings();
|
||||
|
|
@ -67,7 +67,7 @@ void func0f00b62c(s32 numchrs)
|
|||
s32 i;
|
||||
|
||||
g_NumChrSlots = PLAYERCOUNT() + numchrs + 10;
|
||||
g_ChrSlots = malloc(ALIGN16(g_NumChrSlots * sizeof(struct chrdata)), MEMPOOL_STAGE);
|
||||
g_ChrSlots = mempAlloc(ALIGN16(g_NumChrSlots * sizeof(struct chrdata)), MEMPOOL_STAGE);
|
||||
|
||||
for (i = 0; i < g_NumChrSlots; i++) {
|
||||
g_ChrSlots[i].chrnum = -1;
|
||||
|
|
@ -76,8 +76,8 @@ void func0f00b62c(s32 numchrs)
|
|||
}
|
||||
|
||||
g_NumChrs = 0;
|
||||
g_Chrnums = malloc(ALIGN16(g_NumChrSlots * 2), MEMPOOL_STAGE);
|
||||
g_ChrIndexes = malloc(ALIGN16(g_NumChrSlots * 2), MEMPOOL_STAGE);
|
||||
g_Chrnums = mempAlloc(ALIGN16(g_NumChrSlots * 2), MEMPOOL_STAGE);
|
||||
g_ChrIndexes = mempAlloc(ALIGN16(g_NumChrSlots * 2), MEMPOOL_STAGE);
|
||||
|
||||
for (i = 0; i < g_NumChrSlots; i++) {
|
||||
g_Chrnums[i] = -1;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#include "game/game_02cde0.h"
|
||||
#include "game/game_091e10.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/rng.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
|
@ -410,8 +410,8 @@ void stageAllocateBgChrs(void)
|
|||
struct chrdata blankchr = {0};
|
||||
|
||||
// Allocate BG chrs
|
||||
g_BgChrs = malloc(ALIGN16(g_NumBgChrs * sizeof(struct chrdata)), MEMPOOL_STAGE);
|
||||
g_BgChrnums = malloc(ALIGN16(g_NumBgChrs * sizeof(s16)), MEMPOOL_STAGE);
|
||||
g_BgChrs = mempAlloc(ALIGN16(g_NumBgChrs * sizeof(struct chrdata)), MEMPOOL_STAGE);
|
||||
g_BgChrnums = mempAlloc(ALIGN16(g_NumBgChrs * sizeof(s16)), MEMPOOL_STAGE);
|
||||
|
||||
// Initialise BG chrs
|
||||
i = 0;
|
||||
|
|
@ -468,8 +468,8 @@ void stageAllocateBgChrs(void)
|
|||
}
|
||||
}
|
||||
|
||||
g_TeamList = malloc(0x210, MEMPOOL_STAGE);
|
||||
g_SquadronList = malloc(0x220, MEMPOOL_STAGE);
|
||||
g_TeamList = mempAlloc(0x210, MEMPOOL_STAGE);
|
||||
g_SquadronList = mempAlloc(0x220, MEMPOOL_STAGE);
|
||||
}
|
||||
|
||||
GLOBAL_ASM(
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "game/game_00c240.h"
|
||||
#include "game/prop.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
|
|
@ -11,8 +11,8 @@ void gvarsInitProps(void)
|
|||
{
|
||||
s32 i;
|
||||
|
||||
g_Vars.props = malloc(ALIGN64(g_Vars.maxprops * sizeof(struct prop)), MEMPOOL_STAGE);
|
||||
g_Vars.onscreenprops = malloc(ALIGN64(200 * sizeof(void *)), MEMPOOL_STAGE);
|
||||
g_Vars.props = mempAlloc(ALIGN64(g_Vars.maxprops * sizeof(struct prop)), MEMPOOL_STAGE);
|
||||
g_Vars.onscreenprops = mempAlloc(ALIGN64(200 * sizeof(void *)), MEMPOOL_STAGE);
|
||||
|
||||
var80069880 = 1;
|
||||
|
||||
|
|
@ -58,8 +58,8 @@ void gvarsInitRoomProps(void)
|
|||
s32 i;
|
||||
s32 j;
|
||||
|
||||
g_RoomPropListChunkIndexes = malloc(ALIGN16(g_Vars.roomcount * sizeof(s16)), MEMPOOL_STAGE);
|
||||
g_RoomPropListChunks = malloc(256 * sizeof(struct roomproplistchunk), MEMPOOL_STAGE);
|
||||
g_RoomPropListChunkIndexes = mempAlloc(ALIGN16(g_Vars.roomcount * sizeof(s16)), MEMPOOL_STAGE);
|
||||
g_RoomPropListChunks = mempAlloc(256 * sizeof(struct roomproplistchunk), MEMPOOL_STAGE);
|
||||
|
||||
for (i = 0; i < g_Vars.roomcount; i++) {
|
||||
g_RoomPropListChunkIndexes[i] = -1;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include "game/pad.h"
|
||||
#include "game/propobj.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/model.h"
|
||||
#include "lib/rng.h"
|
||||
#include "lib/mtx.h"
|
||||
|
|
@ -225,7 +225,7 @@ void setupInit(void)
|
|||
if (var8009ce40 == 0) {
|
||||
var8009ce58 = NULL;
|
||||
} else {
|
||||
var8009ce58 = malloc(ALIGN16(var8009ce40 * sizeof(struct weaponobj)), MEMPOOL_STAGE);
|
||||
var8009ce58 = mempAlloc(ALIGN16(var8009ce40 * sizeof(struct weaponobj)), MEMPOOL_STAGE);
|
||||
|
||||
for (i = 0; i < var8009ce40; i++) {
|
||||
var8009ce58[i].base.prop = NULL;
|
||||
|
|
@ -237,7 +237,7 @@ void setupInit(void)
|
|||
if (var8009ce44 == 0) {
|
||||
var8009ce5c = NULL;
|
||||
} else {
|
||||
var8009ce5c = malloc(ALIGN16(var8009ce44 * sizeof(struct defaultobj)), MEMPOOL_STAGE);
|
||||
var8009ce5c = mempAlloc(ALIGN16(var8009ce44 * sizeof(struct defaultobj)), MEMPOOL_STAGE);
|
||||
|
||||
for (i = 0; i < var8009ce44; i++) {
|
||||
var8009ce5c[i].prop = NULL;
|
||||
|
|
@ -249,7 +249,7 @@ void setupInit(void)
|
|||
if (var8009ce48 == 0) {
|
||||
var8009ce60 = 0;
|
||||
} else {
|
||||
var8009ce60 = malloc(ALIGN16(var8009ce48 * sizeof(struct var8009ce60)), MEMPOOL_STAGE);
|
||||
var8009ce60 = mempAlloc(ALIGN16(var8009ce48 * sizeof(struct var8009ce60)), MEMPOOL_STAGE);
|
||||
|
||||
for (i = 0; i < var8009ce48; i++) {
|
||||
var8009ce60[i].base.prop = NULL;
|
||||
|
|
@ -259,7 +259,7 @@ void setupInit(void)
|
|||
if (var8009ce4c == 0) {
|
||||
var8009ce64 = 0;
|
||||
} else {
|
||||
var8009ce64 = malloc(ALIGN16(var8009ce4c * sizeof(struct defaultobj)), MEMPOOL_STAGE);
|
||||
var8009ce64 = mempAlloc(ALIGN16(var8009ce4c * sizeof(struct defaultobj)), MEMPOOL_STAGE);
|
||||
|
||||
for (i = 0; i < var8009ce4c; i++) {
|
||||
var8009ce64[i].prop = NULL;
|
||||
|
|
@ -269,7 +269,7 @@ void setupInit(void)
|
|||
if (g_NumProjectiles == 0) {
|
||||
g_Projectiles = 0;
|
||||
} else {
|
||||
g_Projectiles = malloc(ALIGN16(g_NumProjectiles * sizeof(struct projectile)), MEMPOOL_STAGE);
|
||||
g_Projectiles = mempAlloc(ALIGN16(g_NumProjectiles * sizeof(struct projectile)), MEMPOOL_STAGE);
|
||||
|
||||
for (i = 0; i < g_NumProjectiles; i++) {
|
||||
g_Projectiles[i].flags = PROJECTILEFLAG_FREE;
|
||||
|
|
@ -279,7 +279,7 @@ void setupInit(void)
|
|||
if (g_NumMonitorThings == 0) {
|
||||
g_MonitorThings = 0;
|
||||
} else {
|
||||
g_MonitorThings = malloc(ALIGN16(g_NumMonitorThings * sizeof(struct monitorthing)), MEMPOOL_STAGE);
|
||||
g_MonitorThings = mempAlloc(ALIGN16(g_NumMonitorThings * sizeof(struct monitorthing)), MEMPOOL_STAGE);
|
||||
|
||||
for (i = 0; i < g_NumMonitorThings; i++) {
|
||||
g_MonitorThings[i].flags = 0x00000001;
|
||||
|
|
@ -303,8 +303,8 @@ void setupInit(void)
|
|||
|
||||
g_MaxThrownLaptops = g_Vars.normmplayerisrunning ? 12 : PLAYERCOUNT();
|
||||
|
||||
g_ThrownLaptops = malloc(ALIGN16(g_MaxThrownLaptops * sizeof(struct autogunobj)), MEMPOOL_STAGE);
|
||||
g_ThrownLaptopBeams = malloc(ALIGN16(g_MaxThrownLaptops * sizeof(struct beam)), MEMPOOL_STAGE);
|
||||
g_ThrownLaptops = mempAlloc(ALIGN16(g_MaxThrownLaptops * sizeof(struct autogunobj)), MEMPOOL_STAGE);
|
||||
g_ThrownLaptopBeams = mempAlloc(ALIGN16(g_MaxThrownLaptops * sizeof(struct beam)), MEMPOOL_STAGE);
|
||||
|
||||
for (i = 0; i < g_MaxThrownLaptops; i++) {
|
||||
g_ThrownLaptops[i].base.prop = NULL;
|
||||
|
|
@ -1219,7 +1219,7 @@ glabel var7f1a9258pf
|
|||
/* f00dca4: 460c5402 */ mul.s $f16,$f10,$f12
|
||||
/* f00dca8: 46028483 */ div.s $f18,$f16,$f2
|
||||
/* f00dcac: e6060064 */ swc1 $f6,0x64($s0)
|
||||
/* f00dcb0: 0c004856 */ jal malloc
|
||||
/* f00dcb0: 0c004856 */ jal mempAlloc
|
||||
/* f00dcb4: e6120068 */ swc1 $f18,0x68($s0)
|
||||
/* f00dcb8: 2403ffff */ li $v1,-1
|
||||
/* f00dcbc: ae02009c */ sw $v0,0x9c($s0)
|
||||
|
|
@ -1296,7 +1296,7 @@ void setupAutogun(struct autogunobj *autogun, s32 cmdindex)
|
|||
autogun->aimdist = *(s32 *)&autogun->aimdist * 100.0f / 65536.0f;
|
||||
autogun->ymaxleft = *(s32 *)&autogun->ymaxleft * M_BADTAU / 65536.0f;
|
||||
autogun->ymaxright = *(s32 *)&autogun->ymaxright * M_BADTAU / 65536.0f;
|
||||
autogun->beam = malloc(ALIGN16(sizeof(struct beam)), MEMPOOL_STAGE);
|
||||
autogun->beam = mempAlloc(ALIGN16(sizeof(struct beam)), MEMPOOL_STAGE);
|
||||
autogun->beam->age = -1;
|
||||
autogun->firing = false;
|
||||
autogun->ammoquantity = 255;
|
||||
|
|
@ -3312,8 +3312,8 @@ void setupParseObjects(s32 stagenum)
|
|||
chopper->patroltimer60 = 0;
|
||||
chopper->cw = 0;
|
||||
chopper->weaponsarmed = true;
|
||||
chopper->fireslotthing = malloc(sizeof(struct fireslotthing), MEMPOOL_STAGE);
|
||||
chopper->fireslotthing->beam = malloc(ALIGN16(sizeof(struct beam)), MEMPOOL_STAGE);
|
||||
chopper->fireslotthing = mempAlloc(sizeof(struct fireslotthing), MEMPOOL_STAGE);
|
||||
chopper->fireslotthing->beam = mempAlloc(ALIGN16(sizeof(struct beam)), MEMPOOL_STAGE);
|
||||
chopper->fireslotthing->beam->age = -1;
|
||||
chopper->fireslotthing->unk08 = -1;
|
||||
chopper->fireslotthing->unk00 = 0;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include <ultra64.h>
|
||||
#include "constants.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
|
|
@ -9,7 +9,7 @@ void func0f0108d0(void)
|
|||
{
|
||||
s32 i;
|
||||
|
||||
g_AudioChannels = malloc(ALIGN16((IS4MB() ? 30 : 40) * sizeof(struct audiochannel)), MEMPOOL_STAGE);
|
||||
g_AudioChannels = mempAlloc(ALIGN16((IS4MB() ? 30 : 40) * sizeof(struct audiochannel)), MEMPOOL_STAGE);
|
||||
|
||||
for (i = 0; i < (IS4MB() ? 30 : 40); i++) {
|
||||
g_AudioChannels[i].flags = AUDIOCHANNELFLAG_IDLE;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include "game/bondgun.h"
|
||||
#include "game/game_1655c0.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
|
|
@ -147,7 +147,7 @@ void func0f010bb0(void)
|
|||
i = ALIGN16(bgun0f09ddfc());
|
||||
}
|
||||
|
||||
g_Vars.currentplayer->gunctrl.unk158c = malloc(i, MEMPOOL_STAGE);
|
||||
g_Vars.currentplayer->gunctrl.unk158c = mempAlloc(i, MEMPOOL_STAGE);
|
||||
g_Vars.currentplayer->gunctrl.handfilenum = 0;
|
||||
g_Vars.currentplayer->gunctrl.unk15a0 = 0;
|
||||
g_Vars.currentplayer->gunctrl.unk15a4 = 0;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
#include "game/mplayer/mplayer.h"
|
||||
#include "game/pad.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/mtx.h"
|
||||
#include "lib/anim.h"
|
||||
#include "data.h"
|
||||
|
|
@ -138,7 +138,7 @@ glabel func0f011130
|
|||
/* f011288: ace00008 */ sw $zero,0x8($a3)
|
||||
/* f01128c: 3b24000f */ xori $a0,$t9,0xf
|
||||
/* f011290: afa8001c */ sw $t0,0x1c($sp)
|
||||
/* f011294: 0c0048f2 */ jal malloc
|
||||
/* f011294: 0c0048f2 */ jal mempAlloc
|
||||
/* f011298: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f01129c: 3c0a8009 */ lui $t2,%hi(g_Is4Mb)
|
||||
/* f0112a0: 254a0af0 */ addiu $t2,$t2,%lo(g_Is4Mb)
|
||||
|
|
@ -404,7 +404,7 @@ void currentPlayerInitEyespy(void)
|
|||
prop = propAllocateEyespy(&pad, pad.room);
|
||||
|
||||
if (prop) {
|
||||
g_Vars.currentplayer->eyespy = malloc(sizeof(struct eyespy), MEMPOOL_STAGE);
|
||||
g_Vars.currentplayer->eyespy = mempAlloc(sizeof(struct eyespy), MEMPOOL_STAGE);
|
||||
|
||||
if (g_Vars.currentplayer->eyespy) {
|
||||
g_Vars.currentplayer->eyespy->prop = prop;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "constants.h"
|
||||
#include "game/pad.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ void waypointsLoad(void)
|
|||
waypoints = g_StageSetup.waypoints;
|
||||
|
||||
// Allocate memory for the waypoint numbers array
|
||||
g_Vars.waypointnums = malloc(ALIGN16(numwaypoints * sizeof(s16)), MEMPOOL_STAGE);
|
||||
g_Vars.waypointnums = mempAlloc(ALIGN16(numwaypoints * sizeof(s16)), MEMPOOL_STAGE);
|
||||
|
||||
numinserted = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include <ultra64.h>
|
||||
#include "constants.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ void func0f013550(void)
|
|||
numberssize += 0xf;
|
||||
numberssize &= ~0xf;
|
||||
|
||||
ptr = malloc(structssize + numberssize, MEMPOOL_STAGE);
|
||||
ptr = mempAlloc(structssize + numberssize, MEMPOOL_STAGE);
|
||||
|
||||
var8009cc40 = ptr;
|
||||
var800a41b0 = (struct var800a41b0 *)((u32)ptr + numberssize);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include <ultra64.h>
|
||||
#include "constants.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ void func0f013ba0(void)
|
|||
}
|
||||
|
||||
if (num > 0) {
|
||||
var8007e3d0[i].unk24 = malloc(num * sizeof(struct var8007e3d0_data), MEMPOOL_STAGE);
|
||||
var8007e3d0[i].unk24 = mempAlloc(num * sizeof(struct var8007e3d0_data), MEMPOOL_STAGE);
|
||||
}
|
||||
|
||||
for (j = 0; j < num; j++) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include "game/bg.h"
|
||||
#include "game/pad.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/anim.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
|
@ -15,11 +15,11 @@ void func0f013ee0(void)
|
|||
|
||||
var80082050 = PLAYERCOUNT() >= 2 ? 200 : 120;
|
||||
|
||||
var800a6660 = malloc(ALIGN16(var80082050), MEMPOOL_STAGE);
|
||||
var800a6664 = malloc(ALIGN16(var80082050 * sizeof(s16)), MEMPOOL_STAGE);
|
||||
var800a6668 = malloc(ALIGN16(var80082050 * sizeof(s16)), MEMPOOL_STAGE);
|
||||
var800a666c = malloc(ALIGN16(var80082050 * sizeof(f32)), MEMPOOL_STAGE);
|
||||
var800a6670 = malloc(ALIGN16(var80082050 * sizeof(Mtxf)), MEMPOOL_STAGE);
|
||||
var800a6660 = mempAlloc(ALIGN16(var80082050), MEMPOOL_STAGE);
|
||||
var800a6664 = mempAlloc(ALIGN16(var80082050 * sizeof(s16)), MEMPOOL_STAGE);
|
||||
var800a6668 = mempAlloc(ALIGN16(var80082050 * sizeof(s16)), MEMPOOL_STAGE);
|
||||
var800a666c = mempAlloc(ALIGN16(var80082050 * sizeof(f32)), MEMPOOL_STAGE);
|
||||
var800a6670 = mempAlloc(ALIGN16(var80082050 * sizeof(Mtxf)), MEMPOOL_STAGE);
|
||||
|
||||
for (i = 0; i < PLAYERCOUNT(); i++) {
|
||||
g_Vars.players[i]->lastroomforoffset = -1;
|
||||
|
|
@ -41,7 +41,7 @@ void coverAllocateSpecial(u16 *specialcovernums)
|
|||
{
|
||||
s32 i;
|
||||
|
||||
g_SpecialCoverNums = malloc(ALIGN16(g_NumSpecialCovers * sizeof(u16)), MEMPOOL_STAGE);
|
||||
g_SpecialCoverNums = mempAlloc(ALIGN16(g_NumSpecialCovers * sizeof(u16)), MEMPOOL_STAGE);
|
||||
|
||||
if (g_SpecialCoverNums != NULL) {
|
||||
for (i = 0; i < g_NumSpecialCovers; i++) {
|
||||
|
|
@ -62,9 +62,9 @@ void coverPrepare(void)
|
|||
s16 rooms1[21];
|
||||
s16 rooms2[21];
|
||||
|
||||
g_CoverFlags = malloc(ALIGN16(numcovers * sizeof(u16)), MEMPOOL_STAGE);
|
||||
g_CoverRooms = malloc(ALIGN16(numcovers * sizeof(s32)), MEMPOOL_STAGE);
|
||||
g_CoverCandidates = malloc(ALIGN16(numcovers * 0x10), MEMPOOL_STAGE);
|
||||
g_CoverFlags = mempAlloc(ALIGN16(numcovers * sizeof(u16)), MEMPOOL_STAGE);
|
||||
g_CoverRooms = mempAlloc(ALIGN16(numcovers * sizeof(s32)), MEMPOOL_STAGE);
|
||||
g_CoverCandidates = mempAlloc(ALIGN16(numcovers * 0x10), MEMPOOL_STAGE);
|
||||
|
||||
g_NumSpecialCovers = 0;
|
||||
g_SpecialCoverNums = NULL;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#include "game/game_197600.h"
|
||||
#include "game/mplayer/mplayer.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/model.h"
|
||||
#include "lib/rng.h"
|
||||
#include "lib/ailist.h"
|
||||
|
|
@ -97,7 +97,7 @@ void aibotAllocate(s32 chrnum, s32 aibotnum)
|
|||
g_MpSimulantChrs[g_NumMpSimulantChrs] = chr;
|
||||
g_NumMpSimulantChrs++;
|
||||
|
||||
aibot = malloc(sizeof(struct aibot), MEMPOOL_STAGE);
|
||||
aibot = mempAlloc(sizeof(struct aibot), MEMPOOL_STAGE);
|
||||
chr->aibot = aibot;
|
||||
|
||||
if (aibot != NULL) {
|
||||
|
|
@ -120,7 +120,7 @@ void aibotAllocate(s32 chrnum, s32 aibotnum)
|
|||
var800ac500[g_MpNumPlayers] = &g_MpSimulants[aibotnum].base;
|
||||
g_MpNumPlayers++;
|
||||
|
||||
aibot->ammoheld = malloc(36 * sizeof(s32), MEMPOOL_STAGE);
|
||||
aibot->ammoheld = mempAlloc(36 * sizeof(s32), MEMPOOL_STAGE);
|
||||
|
||||
for (i = 0; i < 33; i++) {
|
||||
aibot->ammoheld[i] = 0;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#include "game/game_197600.h"
|
||||
#include "game/mplayer/mplayer.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/model.h"
|
||||
#include "lib/rng.h"
|
||||
#include "lib/mtx.h"
|
||||
|
|
@ -22,7 +22,7 @@ void aibotAllocateInventory(struct chrdata *chr, s32 maxitems)
|
|||
}
|
||||
|
||||
chr->aibot->maxitems = maxitems;
|
||||
chr->aibot->items = malloc(ALIGN16(maxitems * sizeof(struct invitem)), MEMPOOL_STAGE);
|
||||
chr->aibot->items = mempAlloc(ALIGN16(maxitems * sizeof(struct invitem)), MEMPOOL_STAGE);
|
||||
|
||||
aibotClearInventory(chr);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@
|
|||
#include "game/pad.h"
|
||||
#include "game/propobj.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/model.h"
|
||||
#include "lib/lib_126b0.h"
|
||||
#include "lib/mema.h"
|
||||
#include "lib/rng.h"
|
||||
#include "lib/mtx.h"
|
||||
#include "lib/ailist.h"
|
||||
|
|
@ -776,10 +776,10 @@ void chrUnpack(s32 stagenum, struct packedchr *packed, s32 cmdindex)
|
|||
chr->chrheight = 185;
|
||||
chr->chrwidth = 30;
|
||||
} else if (bodynum == BODY_CHICROB) {
|
||||
chr->unk348[0] = malloc(sizeof(struct fireslotthing), MEMPOOL_STAGE);
|
||||
chr->unk348[1] = malloc(sizeof(struct fireslotthing), MEMPOOL_STAGE);
|
||||
chr->unk348[0]->beam = malloc(ALIGN16(sizeof(struct beam)), MEMPOOL_STAGE);
|
||||
chr->unk348[1]->beam = malloc(ALIGN16(sizeof(struct beam)), MEMPOOL_STAGE);
|
||||
chr->unk348[0] = mempAlloc(sizeof(struct fireslotthing), MEMPOOL_STAGE);
|
||||
chr->unk348[1] = mempAlloc(sizeof(struct fireslotthing), MEMPOOL_STAGE);
|
||||
chr->unk348[0]->beam = mempAlloc(ALIGN16(sizeof(struct beam)), MEMPOOL_STAGE);
|
||||
chr->unk348[1]->beam = mempAlloc(ALIGN16(sizeof(struct beam)), MEMPOOL_STAGE);
|
||||
chr->unk348[0]->beam->age = -1;
|
||||
chr->unk348[1]->beam->age = -1;
|
||||
chr->chrheight = 200;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "constants.h"
|
||||
#include "game/game_0b28d0.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
|
|
@ -307,7 +307,7 @@ glabel func0f0b2b64
|
|||
/* f0b2c80: 8fac003c */ lw $t4,0x3c($sp)
|
||||
/* f0b2c84: 15800004 */ bnez $t4,.L0f0b2c98
|
||||
/* f0b2c88: 00000000 */ nop
|
||||
/* f0b2c8c: 0c0048f2 */ jal malloc
|
||||
/* f0b2c8c: 0c0048f2 */ jal mempAlloc
|
||||
/* f0b2c90: 24040030 */ addiu $a0,$zero,0x30
|
||||
/* f0b2c94: afa2003c */ sw $v0,0x3c($sp)
|
||||
.L0f0b2c98:
|
||||
|
|
@ -326,7 +326,7 @@ glabel func0f0b2b64
|
|||
/* f0b2cc8: 00047880 */ sll $t7,$a0,0x2
|
||||
/* f0b2ccc: 25e4000f */ addiu $a0,$t7,0xf
|
||||
/* f0b2cd0: 3498000f */ ori $t8,$a0,0xf
|
||||
/* f0b2cd4: 0c0048f2 */ jal malloc
|
||||
/* f0b2cd4: 0c0048f2 */ jal mempAlloc
|
||||
/* f0b2cd8: 3b04000f */ xori $a0,$t8,0xf
|
||||
/* f0b2cdc: 100000ce */ b .L0f0b3018
|
||||
/* f0b2ce0: afa20038 */ sw $v0,0x38($sp)
|
||||
|
|
@ -490,7 +490,7 @@ glabel func0f0b2b64
|
|||
/* f0b2f0c: 57200017 */ bnezl $t9,.L0f0b2f6c
|
||||
/* f0b2f10: 24c60001 */ addiu $a2,$a2,0x1
|
||||
/* f0b2f14: 24040400 */ addiu $a0,$zero,0x400
|
||||
/* f0b2f18: 0c0048f2 */ jal malloc
|
||||
/* f0b2f18: 0c0048f2 */ jal mempAlloc
|
||||
/* f0b2f1c: afa70018 */ sw $a3,0x18($sp)
|
||||
/* f0b2f20: 3c04800a */ lui $a0,%hi(var8009dd10)
|
||||
/* f0b2f24: 2484dd10 */ addiu $a0,$a0,%lo(var8009dd10)
|
||||
|
|
@ -560,7 +560,7 @@ glabel func0f0b2b64
|
|||
/* f0b3000: 0004c880 */ sll $t9,$a0,0x2
|
||||
/* f0b3004: 2724000f */ addiu $a0,$t9,0xf
|
||||
/* f0b3008: 348b000f */ ori $t3,$a0,0xf
|
||||
/* f0b300c: 0c0048f2 */ jal malloc
|
||||
/* f0b300c: 0c0048f2 */ jal mempAlloc
|
||||
/* f0b3010: 3964000f */ xori $a0,$t3,0xf
|
||||
/* f0b3014: afa20038 */ sw $v0,0x38($sp)
|
||||
.L0f0b3018:
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
#include "lib/vi.h"
|
||||
#include "lib/main.h"
|
||||
#include "lib/snd.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/rng.h"
|
||||
#include "lib/mtx.h"
|
||||
#include "lib/anim.h"
|
||||
|
|
@ -116,7 +116,7 @@ void func0f0b65a8(s32 arg0)
|
|||
{
|
||||
if (arg0 > 0) {
|
||||
var8009ddcc = arg0;
|
||||
var8009ddc8 = malloc(ALIGN16(arg0 * 2), MEMPOOL_STAGE);
|
||||
var8009ddc8 = mempAlloc(ALIGN16(arg0 * 2), MEMPOOL_STAGE);
|
||||
} else {
|
||||
var8009ddc8 = NULL;
|
||||
}
|
||||
|
|
@ -184,7 +184,7 @@ glabel var7f1ad418
|
|||
/* f0b6788: f7b60018 */ sdc1 $f22,0x18($sp)
|
||||
/* f0b678c: f7b40010 */ sdc1 $f20,0x10($sp)
|
||||
/* f0b6790: 39e4000f */ xori $a0,$t7,0xf
|
||||
/* f0b6794: 0c0048f2 */ jal malloc
|
||||
/* f0b6794: 0c0048f2 */ jal mempAlloc
|
||||
/* f0b6798: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f0b679c: 3c0b800a */ lui $t3,%hi(g_Vars)
|
||||
/* f0b67a0: 256b9fc0 */ addiu $t3,$t3,%lo(g_Vars)
|
||||
|
|
@ -358,7 +358,7 @@ glabel var7f1ad418
|
|||
//
|
||||
// osSyncPrintf("Acoustic Reset -> Allocating %d bytes for %d roomacousticdata structures\n", size, g_Vars.roomcount);
|
||||
//
|
||||
// g_RoomAcousticData = malloc(size, MEMPOOL_STAGE);
|
||||
// g_RoomAcousticData = mempAlloc(size, MEMPOOL_STAGE);
|
||||
//
|
||||
// for (i = 0; i < g_Vars.roomcount; i++) {
|
||||
// bool allgood = true;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@
|
|||
#include "lib/vi.h"
|
||||
#include "lib/main.h"
|
||||
#include "lib/snd.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/model.h"
|
||||
#include "lib/rng.h"
|
||||
#include "lib/mtx.h"
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
#include "lib/vi.h"
|
||||
#include "lib/main.h"
|
||||
#include "lib/snd.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/rng.h"
|
||||
#include "lib/mtx.h"
|
||||
#include "lib/lib_317f0.h"
|
||||
|
|
@ -18687,7 +18687,7 @@ glabel func0f0f8bb4
|
|||
/* f0f8bc8: ac850008 */ sw $a1,0x8($a0)
|
||||
/* f0f8bcc: 8fa4001c */ lw $a0,0x1c($sp)
|
||||
/* f0f8bd0: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f0f8bd4: 0c0048f2 */ jal malloc
|
||||
/* f0f8bd4: 0c0048f2 */ jal mempAlloc
|
||||
/* f0f8bd8: afa70018 */ sw $a3,0x18($sp)
|
||||
/* f0f8bdc: 8fa70018 */ lw $a3,0x18($sp)
|
||||
/* f0f8be0: 10000002 */ b .L0f0f8bec
|
||||
|
|
@ -18768,7 +18768,7 @@ glabel var7f1b2a0c
|
|||
/* f0f8cc0: 24010001 */ addiu $at,$zero,0x1
|
||||
/* f0f8cc4: 11c10005 */ beq $t6,$at,.L0f0f8cdc
|
||||
/* f0f8cc8: 24044b00 */ addiu $a0,$zero,0x4b00
|
||||
/* f0f8ccc: 0c0048f2 */ jal malloc
|
||||
/* f0f8ccc: 0c0048f2 */ jal mempAlloc
|
||||
/* f0f8cd0: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f0f8cd4: 3c01800a */ lui $at,%hi(g_BlurBuffer)
|
||||
/* f0f8cd8: ac22dfbc */ sw $v0,%lo(g_BlurBuffer)($at)
|
||||
|
|
@ -19030,7 +19030,7 @@ glabel var7f1b2a0c
|
|||
/* f0f5514: 24010001 */ addiu $at,$zero,0x1
|
||||
/* f0f5518: 11c10005 */ beq $t6,$at,.NB0f0f5530
|
||||
/* f0f551c: 24044b00 */ addiu $a0,$zero,0x4b00
|
||||
/* f0f5520: 0c004a0e */ jal malloc
|
||||
/* f0f5520: 0c004a0e */ jal mempAlloc
|
||||
/* f0f5524: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f0f5528: 3c01800a */ lui $at,0x800a
|
||||
/* f0f552c: ac22277c */ sw $v0,0x277c($at)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include "game/game_127910.h"
|
||||
#include "game/propobj.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/rng.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
|
@ -215,7 +215,7 @@ void playerAllocate(s32 index)
|
|||
|
||||
s32 i;
|
||||
|
||||
g_Vars.players[index] = malloc(sizeof(struct player), MEMPOOL_STAGE);
|
||||
g_Vars.players[index] = mempAlloc(sizeof(struct player), MEMPOOL_STAGE);
|
||||
|
||||
g_Vars.players[index]->cameramode = CAMERAMODE_DEFAULT;
|
||||
g_Vars.players[index]->memcampos.x = 0;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include "game/game_129210.h"
|
||||
#include "game/propobj.h"
|
||||
#include "bss.h"
|
||||
#include "lib/lib_126b0.h"
|
||||
#include "lib/mema.h"
|
||||
#include "lib/rng.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include "game/game_13b670.h"
|
||||
#include "bss.h"
|
||||
#include "lib/main.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/mtx.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
|
@ -1056,7 +1056,7 @@ glabel func0f13c3f4
|
|||
/* f13c460: 3498003f */ ori $t8,$a0,0x3f
|
||||
/* f13c464: 3b04003f */ xori $a0,$t8,0x3f
|
||||
/* f13c468: afa4001c */ sw $a0,0x1c($sp)
|
||||
/* f13c46c: 0c0048f2 */ jal malloc
|
||||
/* f13c46c: 0c0048f2 */ jal mempAlloc
|
||||
/* f13c470: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f13c474: 3c04800a */ lui $a0,%hi(var800a4180)
|
||||
/* f13c478: 8c844180 */ lw $a0,%lo(var800a4180)($a0)
|
||||
|
|
@ -1068,7 +1068,7 @@ glabel func0f13c3f4
|
|||
/* f13c490: 2504003f */ addiu $a0,$t0,0x3f
|
||||
/* f13c494: 3489003f */ ori $t1,$a0,0x3f
|
||||
/* f13c498: 3924003f */ xori $a0,$t1,0x3f
|
||||
/* f13c49c: 0c0048f2 */ jal malloc
|
||||
/* f13c49c: 0c0048f2 */ jal mempAlloc
|
||||
/* f13c4a0: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f13c4a4: 3c04800a */ lui $a0,%hi(var800a4188)
|
||||
/* f13c4a8: 8c844188 */ lw $a0,%lo(var800a4188)($a0)
|
||||
|
|
@ -1080,7 +1080,7 @@ glabel func0f13c3f4
|
|||
/* f13c4c0: 2564003f */ addiu $a0,$t3,0x3f
|
||||
/* f13c4c4: 348c003f */ ori $t4,$a0,0x3f
|
||||
/* f13c4c8: 3984003f */ xori $a0,$t4,0x3f
|
||||
/* f13c4cc: 0c0048f2 */ jal malloc
|
||||
/* f13c4cc: 0c0048f2 */ jal mempAlloc
|
||||
/* f13c4d0: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f13c4d4: 8fbf0014 */ lw $ra,0x14($sp)
|
||||
/* f13c4d8: 3c01800a */ lui $at,%hi(var800a4194)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
#include "lib/vi.h"
|
||||
#include "lib/dma.h"
|
||||
#include "lib/main.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
|
|
@ -176,7 +176,7 @@ void fontLoad(u8 *romstart, u8 *romend, struct font **fontptr, struct fontchar *
|
|||
#endif
|
||||
|
||||
len = (u32)romend - (u32)romstart;
|
||||
font = malloc(len, MEMPOOL_STAGE);
|
||||
font = mempAlloc(len, MEMPOOL_STAGE);
|
||||
chars = font->chars;
|
||||
|
||||
dmaExec(font, (u32) romstart, len);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
#include "lib/vi.h"
|
||||
#include "lib/dma.h"
|
||||
#include "lib/main.h"
|
||||
#include "lib/memory.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include "lib/rzip.h"
|
||||
#include "lib/dma.h"
|
||||
#include "lib/main.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ glabel texturesLoadConfigs
|
|||
/* f1735e0: afb20020 */ sw $s2,0x20($sp)
|
||||
/* f1735e4: afb00018 */ sw $s0,0x18($sp)
|
||||
/* f1735e8: 02202025 */ or $a0,$s1,$zero
|
||||
/* f1735ec: 0c0048f2 */ jal malloc
|
||||
/* f1735ec: 0c0048f2 */ jal mempAlloc
|
||||
/* f1735f0: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f1735f4: 3c03800b */ lui $v1,%hi(g_TextureConfigSegment)
|
||||
/* f1735f8: 2463b554 */ addiu $v1,$v1,%lo(g_TextureConfigSegment)
|
||||
|
|
@ -179,7 +179,7 @@ glabel texturesLoadConfigs
|
|||
/* f1737f0: 00045080 */ sll $t2,$a0,0x2
|
||||
/* f1737f4: 2544000f */ addiu $a0,$t2,0xf
|
||||
/* f1737f8: 348b000f */ ori $t3,$a0,0xf
|
||||
/* f1737fc: 0c0048f2 */ jal malloc
|
||||
/* f1737fc: 0c0048f2 */ jal mempAlloc
|
||||
/* f173800: 3964000f */ xori $a0,$t3,0xf
|
||||
/* f173804: 8e0d0000 */ lw $t5,0x0($s0)
|
||||
/* f173808: 3c03800b */ lui $v1,%hi(var800ab55c)
|
||||
|
|
@ -329,7 +329,7 @@ glabel texturesLoadConfigs
|
|||
// u32 len = &_textureconfigSegmentEnd - &_textureconfigSegmentStart;
|
||||
// s32 i;
|
||||
//
|
||||
// g_TextureConfigSegment = malloc(len, MEMPOOL_STAGE);
|
||||
// g_TextureConfigSegment = mempAlloc(len, MEMPOOL_STAGE);
|
||||
// dmaExec(g_TextureConfigSegment, &_textureconfigSegmentRomStart, len);
|
||||
//
|
||||
// var800ab550 = (u32)((u32)g_TextureConfigSegment - (u32)&_textureconfigSegmentStart);
|
||||
|
|
@ -355,7 +355,7 @@ glabel texturesLoadConfigs
|
|||
// var800ab5ac = (struct textureconfig *)((u32)g_TextureConfigSegment - (u32)&_textureconfigSegmentStart + 0xb44);
|
||||
//
|
||||
// var800ab558 = (len - ((u32)&_textureconfigSegmentStart + 0x1c0)) + (u32)&_textureconfigSegmentStart;
|
||||
// var800ab55c = malloc(align16(var800ab558), MEMPOOL_STAGE);
|
||||
// var800ab55c = mempAlloc(align16(var800ab558), MEMPOOL_STAGE);
|
||||
//
|
||||
// for (i = 0; i < var800ab558; i++) {
|
||||
// var800ab55c[i].texturenum = 0;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "game/file.h"
|
||||
#include "game/game_175f90.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
|
|
@ -15,13 +15,13 @@ void func0f175f90(void)
|
|||
void func0f175f98(void)
|
||||
{
|
||||
func0f167330();
|
||||
memResetPool(MEMPOOL_5);
|
||||
mempResetPool(MEMPOOL_5);
|
||||
func0f1672f0(5);
|
||||
}
|
||||
|
||||
void func0f175fc8(void)
|
||||
{
|
||||
memDisablePool(MEMPOOL_5);
|
||||
mempDisablePool(MEMPOOL_5);
|
||||
func0f1672f0(5);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#include "game/options.h"
|
||||
#include "bss.h"
|
||||
#include "lib/vi.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ void func0f1760c4(void)
|
|||
}
|
||||
}
|
||||
|
||||
var800844f0 = malloc(var800ab7c0 * var800ab7c4 * 2 + 0x40, MEMPOOL_STAGE);
|
||||
var800844f0 = mempAlloc(var800ab7c0 * var800ab7c4 * 2 + 0x40, MEMPOOL_STAGE);
|
||||
var800844f0 = (void *)((u32)var800844f0 + 0x3f & ~0x3f);
|
||||
var800844f4 = var800844f0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
#include "bss.h"
|
||||
#include "lib/fault.h"
|
||||
#include "lib/snd.h"
|
||||
#include "lib/lib_126b0.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include "bss.h"
|
||||
#include "lib/rzip.h"
|
||||
#include "lib/dma.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/rng.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
|
@ -100,12 +100,12 @@ void gfxInitMemory(void)
|
|||
}
|
||||
|
||||
// %d Players : Allocating %d bytes for master dl's\n
|
||||
g_GfxBuffers[0] = malloc(g_GfxSizesByPlayerCount[PLAYERCOUNT() - 1] * 2, MEMPOOL_STAGE);
|
||||
g_GfxBuffers[0] = mempAlloc(g_GfxSizesByPlayerCount[PLAYERCOUNT() - 1] * 2, MEMPOOL_STAGE);
|
||||
g_GfxBuffers[1] = g_GfxBuffers[0] + g_GfxSizesByPlayerCount[PLAYERCOUNT() - 1];
|
||||
g_GfxBuffers[2] = g_GfxBuffers[1] + g_GfxSizesByPlayerCount[PLAYERCOUNT() - 1];
|
||||
|
||||
// Allocating %d bytes for mtxvtx space\n
|
||||
g_VtxBuffers[0] = malloc(g_VtxSizesByPlayerCount[PLAYERCOUNT() - 1] * 2, MEMPOOL_STAGE);
|
||||
g_VtxBuffers[0] = mempAlloc(g_VtxSizesByPlayerCount[PLAYERCOUNT() - 1] * 2, MEMPOOL_STAGE);
|
||||
g_VtxBuffers[1] = g_VtxBuffers[0] + g_VtxSizesByPlayerCount[PLAYERCOUNT() - 1];
|
||||
g_VtxBuffers[2] = g_VtxBuffers[1] + g_VtxSizesByPlayerCount[PLAYERCOUNT() - 1];
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#include "bss.h"
|
||||
#include "lib/vi.h"
|
||||
#include "lib/snd.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/mtx.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
|
@ -1327,7 +1327,7 @@ void hudmsgsInit(void)
|
|||
s32 i;
|
||||
|
||||
g_NumHudMessages = g_Vars.mplayerisrunning ? 20 : 8;
|
||||
g_HudMessages = malloc((sizeof(struct hudmessage) * g_NumHudMessages + 0x3f | 0x3f) ^ 0x3f, MEMPOOL_STAGE);
|
||||
g_HudMessages = mempAlloc((sizeof(struct hudmessage) * g_NumHudMessages + 0x3f | 0x3f) ^ 0x3f, MEMPOOL_STAGE);
|
||||
|
||||
for (i = 0; i < g_NumHudMessages; i++) {
|
||||
g_HudMessages[i].state = HUDMSGSTATE_FREE;
|
||||
|
|
@ -1363,7 +1363,7 @@ glabel hudmsgsInit
|
|||
/* f0db400: 0019c880 */ sll $t9,$t9,0x2
|
||||
/* f0db404: 2724003f */ addiu $a0,$t9,0x3f
|
||||
/* f0db408: 3488003f */ ori $t0,$a0,0x3f
|
||||
/* f0db40c: 0c004a0e */ jal malloc
|
||||
/* f0db40c: 0c004a0e */ jal mempAlloc
|
||||
/* f0db410: 3904003f */ xori $a0,$t0,0x3f
|
||||
/* f0db414: 3c068007 */ lui $a2,0x8007
|
||||
/* f0db418: 24c636a8 */ addiu $a2,$a2,0x36a8
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include "game/inventory/init.h"
|
||||
#include "game/inventory/inventory.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
|
|
@ -27,6 +27,6 @@ void invInitGunsHeld(void)
|
|||
void invInit(s32 numdoubles)
|
||||
{
|
||||
g_Vars.currentplayer->equipmaxitems = numdoubles + 30;
|
||||
g_Vars.currentplayer->equipment = malloc(ALIGN16(g_Vars.currentplayer->equipmaxitems * sizeof(struct invitem)), MEMPOOL_STAGE);
|
||||
g_Vars.currentplayer->equipment = mempAlloc(ALIGN16(g_Vars.currentplayer->equipmaxitems * sizeof(struct invitem)), MEMPOOL_STAGE);
|
||||
invClear();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include "bss.h"
|
||||
#include "lib/vi.h"
|
||||
#include "lib/snd.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/rng.h"
|
||||
#include "lib/mtx.h"
|
||||
#include "lib/anim.h"
|
||||
|
|
@ -10124,7 +10124,7 @@ glabel func0f186508
|
|||
/* f18655c: 24040060 */ addiu $a0,$zero,0x60
|
||||
/* f186560: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f186564: adc10000 */ sw $at,0x0($t6)
|
||||
/* f186568: 0c0048f2 */ jal malloc
|
||||
/* f186568: 0c0048f2 */ jal mempAlloc
|
||||
/* f18656c: adc80004 */ sw $t0,0x4($t6)
|
||||
/* f186570: 27a9001c */ addiu $t1,$sp,0x1c
|
||||
/* f186574: afa20018 */ sw $v0,0x18($sp)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#include "game/propobj.h"
|
||||
#include "bss.h"
|
||||
#include "lib/dma.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/rng.h"
|
||||
#include "lib/mtx.h"
|
||||
#include "data.h"
|
||||
|
|
@ -90,7 +90,7 @@ void tagsAllocatePtrs(void)
|
|||
|
||||
if (g_NumTags) {
|
||||
u32 size = index * 4;
|
||||
g_TagPtrs = malloc(ALIGN16(size), MEMPOOL_STAGE);
|
||||
g_TagPtrs = mempAlloc(ALIGN16(size), MEMPOOL_STAGE);
|
||||
|
||||
for (index = 0; index < g_NumTags; index++) {
|
||||
g_TagPtrs[index] = NULL;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
#include "lib/joy.h"
|
||||
#include "lib/lib_06440.h"
|
||||
#include "lib/main.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/rng.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
|
@ -3682,7 +3682,7 @@ void pak0f11a32c(s8 device, u8 arg1, u32 line, char *file)
|
|||
|
||||
if ((g_Paks[device].unk014 & 1) && g_Paks[device].headercache == NULL) {
|
||||
g_Paks[device].headercachecount = 0;
|
||||
g_Paks[device].headercache = malloc(align32(sizeof(struct pakheadercache) * MAX_HEADERCACHE_ENTRIES), MEMPOOL_PERMANENT);
|
||||
g_Paks[device].headercache = mempAlloc(align32(sizeof(struct pakheadercache) * MAX_HEADERCACHE_ENTRIES), MEMPOOL_PERMANENT);
|
||||
|
||||
// This would have been used in an osSyncPrintf call.
|
||||
// Perhaps using the strings at var7f1b4318 through var7f1b43ac?
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@
|
|||
#include "lib/dma.h"
|
||||
#include "lib/main.h"
|
||||
#include "lib/snd.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/model.h"
|
||||
#include "lib/rng.h"
|
||||
#include "lib/mtx.h"
|
||||
|
|
@ -5189,7 +5189,7 @@ struct prop *objInitialise(struct defaultobj *obj, struct modelfiledata *filedat
|
|||
}
|
||||
|
||||
if (obj->numtiles > 0) {
|
||||
obj->unkgeo = malloc(ALIGN16(geosize), MEMPOOL_STAGE);
|
||||
obj->unkgeo = mempAlloc(ALIGN16(geosize), MEMPOOL_STAGE);
|
||||
} else {
|
||||
obj->unkgeo = NULL;
|
||||
}
|
||||
|
|
@ -71122,7 +71122,7 @@ glabel var7f1aaf78
|
|||
/* f08d6ac: 0019c880 */ sll $t9,$t9,0x2
|
||||
/* f08d6b0: 2724000f */ addiu $a0,$t9,0xf
|
||||
/* f08d6b4: 3488000f */ ori $t0,$a0,0xf
|
||||
/* f08d6b8: 0c0048f2 */ jal malloc
|
||||
/* f08d6b8: 0c0048f2 */ jal mempAlloc
|
||||
/* f08d6bc: 3904000f */ xori $a0,$t0,0xf
|
||||
/* f08d6c0: 8fa60094 */ lw $a2,0x94($sp)
|
||||
/* f08d6c4: 10000006 */ b .L0f08d6e0
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include <ultra64.h>
|
||||
#include "constants.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ void shardsInit(void)
|
|||
if (g_MaxShards == 0) {
|
||||
g_Shards = NULL;
|
||||
} else {
|
||||
g_Shards = malloc(g_MaxShards * sizeof(struct shard) + 0xf & ~0xf, MEMPOOL_STAGE);
|
||||
g_Shards = mempAlloc(g_MaxShards * sizeof(struct shard) + 0xf & ~0xf, MEMPOOL_STAGE);
|
||||
|
||||
for (i = 0; i < g_MaxShards; i++) {
|
||||
g_Shards[i].age60 = 0;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include "game/game_1531a0.h"
|
||||
#include "bss.h"
|
||||
#include "lib/vi.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/rng.h"
|
||||
#include "lib/mtx.h"
|
||||
#include "data.h"
|
||||
|
|
@ -313,7 +313,7 @@ glabel skyInit
|
|||
/* f136280: 030a2021 */ addu $a0,$t8,$t2
|
||||
/* f136284: 24840043 */ addiu $a0,$a0,0x43
|
||||
/* f136288: 348b003f */ ori $t3,$a0,0x3f
|
||||
/* f13628c: 0c0048f2 */ jal malloc
|
||||
/* f13628c: 0c0048f2 */ jal mempAlloc
|
||||
/* f136290: 3964003f */ xori $a0,$t3,0x3f
|
||||
/* f136294: 24060006 */ addiu $a2,$zero,0x6
|
||||
/* f136298: 1040016d */ beqz $v0,.L0f136850
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include <ultra64.h>
|
||||
#include "constants.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
|
|
@ -19,7 +19,7 @@ void smokeInit(void)
|
|||
if (g_MaxSmokes == 0) {
|
||||
g_Smokes = NULL;
|
||||
} else {
|
||||
g_Smokes = malloc(g_MaxSmokes * sizeof(struct smoke), MEMPOOL_STAGE);
|
||||
g_Smokes = mempAlloc(g_MaxSmokes * sizeof(struct smoke), MEMPOOL_STAGE);
|
||||
|
||||
for (i = 0; i < g_MaxSmokes; i++) {
|
||||
g_Smokes[i].prop = NULL;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include "lib/rzip.h"
|
||||
#include "lib/dma.h"
|
||||
#include "lib/main.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
|
|
@ -6013,11 +6013,11 @@ glabel func0f173010
|
|||
/* f17316c: 24040004 */ addiu $a0,$zero,0x4
|
||||
/* f173170: afa614ac */ sw $a2,0x14ac($sp)
|
||||
/* f173174: afa714a0 */ sw $a3,0x14a0($sp)
|
||||
/* f173178: 0c004935 */ jal memGetFree
|
||||
/* f173178: 0c004935 */ jal mempGetPoolFree
|
||||
/* f17317c: afa914a4 */ sw $t1,0x14a4($sp)
|
||||
/* f173180: afa20030 */ sw $v0,0x30($sp)
|
||||
/* f173184: 24040004 */ addiu $a0,$zero,0x4
|
||||
/* f173188: 0c004935 */ jal memGetFree
|
||||
/* f173188: 0c004935 */ jal mempGetPoolFree
|
||||
/* f17318c: 24050001 */ addiu $a1,$zero,0x1
|
||||
/* f173190: 8fab0030 */ lw $t3,0x30($sp)
|
||||
/* f173194: 8fa714a0 */ lw $a3,0x14a0($sp)
|
||||
|
|
@ -6133,7 +6133,7 @@ glabel func0f173010
|
|||
/* f173320: 2484002f */ addiu $a0,$a0,0x2f
|
||||
/* f173324: 348c000f */ ori $t4,$a0,0xf
|
||||
/* f173328: 3984000f */ xori $a0,$t4,0xf
|
||||
/* f17332c: 0c004991 */ jal mallocFromRight
|
||||
/* f17332c: 0c004991 */ jal mempAllocFromRight
|
||||
/* f173330: afa31490 */ sw $v1,0x1490($sp)
|
||||
/* f173334: ae02000c */ sw $v0,0xc($s0)
|
||||
/* f173338: afa20034 */ sw $v0,0x34($sp)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#include "lib/dma.h"
|
||||
#include "lib/main.h"
|
||||
#include "lib/snd.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/rng.h"
|
||||
#include "lib/mtx.h"
|
||||
#include "data.h"
|
||||
|
|
@ -459,7 +459,7 @@ void frUnloadData(void)
|
|||
|
||||
void *frLoadRomData(u32 len)
|
||||
{
|
||||
g_FrRomData = malloc(ALIGN16(len), MEMPOOL_STAGE);
|
||||
g_FrRomData = mempAlloc(ALIGN16(len), MEMPOOL_STAGE);
|
||||
|
||||
if (g_FrRomData) {
|
||||
return dmaExecWithAutoAlign(g_FrRomData, (u32)&_firingrangeSegmentRomStart, len);
|
||||
|
|
@ -2403,7 +2403,7 @@ glabel frLoadData
|
|||
/* f19e84c: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* f19e850: afa60028 */ sw $a2,0x28($sp)
|
||||
/* f19e854: afa70020 */ sw $a3,0x20($sp)
|
||||
/* f19e858: 0c0048f2 */ jal malloc
|
||||
/* f19e858: 0c0048f2 */ jal mempAlloc
|
||||
/* f19e85c: afa9002c */ sw $t1,0x2c($sp)
|
||||
/* f19e860: 3c048009 */ lui $a0,%hi(g_FrScriptOffsets)
|
||||
/* f19e864: 24848800 */ addiu $a0,$a0,%lo(g_FrScriptOffsets)
|
||||
|
|
@ -2476,7 +2476,7 @@ glabel frLoadData
|
|||
// }
|
||||
//
|
||||
// // 83c
|
||||
// g_FrScriptOffsets = malloc(ALIGN16(count * 2), MEMPOOL_STAGE);
|
||||
// g_FrScriptOffsets = mempAlloc(ALIGN16(count * 2), MEMPOOL_STAGE);
|
||||
//
|
||||
// // 860
|
||||
// if (g_FrScriptOffsets) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "constants.h"
|
||||
#include "game/utils.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ glabel func0f176ddc
|
|||
/* f176ddc: 27bdffd8 */ addiu $sp,$sp,-40
|
||||
/* f176de0: afbf0014 */ sw $ra,0x14($sp)
|
||||
/* f176de4: 24042710 */ addiu $a0,$zero,0x2710
|
||||
/* f176de8: 0c0048f2 */ jal malloc
|
||||
/* f176de8: 0c0048f2 */ jal mempAlloc
|
||||
/* f176dec: 24050008 */ addiu $a1,$zero,0x8
|
||||
/* f176df0: 3c01800b */ lui $at,%hi(var800ac0d0)
|
||||
/* f176df4: ac22c0d0 */ sw $v0,%lo(var800ac0d0)($at)
|
||||
|
|
@ -97,7 +97,7 @@ glabel func0f176ddc
|
|||
/* f176dfc: 24043900 */ addiu $a0,$zero,0x3900
|
||||
/* f176e00: afa20018 */ sw $v0,0x18($sp)
|
||||
/* f176e04: 00402025 */ or $a0,$v0,$zero
|
||||
/* f176e08: 0c0048f2 */ jal malloc
|
||||
/* f176e08: 0c0048f2 */ jal mempAlloc
|
||||
/* f176e0c: 24050008 */ addiu $a1,$zero,0x8
|
||||
/* f176e10: 3c05800b */ lui $a1,%hi(var800ac0e8)
|
||||
/* f176e14: 24a5c0e8 */ addiu $a1,$a1,%lo(var800ac0e8)
|
||||
|
|
@ -158,10 +158,10 @@ glabel func0f176ddc
|
|||
// static void *var80084618 = NULL;
|
||||
// static void *var800ac0e8[4];
|
||||
//
|
||||
// var800ac0d0 = malloc(10000, MEMPOOL_8);
|
||||
// var800ac0d0 = mempAlloc(10000, MEMPOOL_8);
|
||||
//
|
||||
// size = align16(0x3900);
|
||||
// var800ac0e8[0] = malloc(size, MEMPOOL_8);
|
||||
// var800ac0e8[0] = mempAlloc(size, MEMPOOL_8);
|
||||
//
|
||||
// if (var800ac0e8[0] != NULL) {
|
||||
// for (i = 0; i < 4; i++) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "constants.h"
|
||||
#include "game/weather/weather.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ void weatherInit(void)
|
|||
|| g_StageIndex == STAGEINDEX_G5BUILDING
|
||||
|| g_StageIndex == STAGEINDEX_CRASHSITE)
|
||||
&& PLAYERCOUNT() < 2) {
|
||||
g_WeatherData = malloc(sizeof(struct weatherdata), MEMPOOL_STAGE);
|
||||
g_WeatherData = mempAlloc(sizeof(struct weatherdata), MEMPOOL_STAGE);
|
||||
g_WeatherData->particledata = weatherAllocateParticles();
|
||||
g_WeatherData->type = -1;
|
||||
g_WeatherData->windanglerad = 0;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
#include "bss.h"
|
||||
#include "lib/main.h"
|
||||
#include "lib/snd.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/rng.h"
|
||||
#include "lib/mtx.h"
|
||||
#include "lib/lib_317f0.h"
|
||||
|
|
@ -102,7 +102,7 @@ void weatherSetBoundaries(struct weatherparticledata *data, s32 index, f32 min,
|
|||
|
||||
struct weatherparticledata *weatherAllocateParticles(void)
|
||||
{
|
||||
struct weatherparticledata *data = malloc(sizeof(struct weatherparticledata), MEMPOOL_STAGE);
|
||||
struct weatherparticledata *data = mempAlloc(sizeof(struct weatherparticledata), MEMPOOL_STAGE);
|
||||
u32 i;
|
||||
|
||||
data->unk3e80 = 0;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _IN_LIB_LIB_126B0_H
|
||||
#define _IN_LIB_LIB_126B0_H
|
||||
#ifndef _IN_LIB_MEMA_H
|
||||
#define _IN_LIB_MEMA_H
|
||||
#include <ultra64.h>
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
#ifndef _IN_LIB_MEMORY_H
|
||||
#define _IN_LIB_MEMORY_H
|
||||
#include <ultra64.h>
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
void func000121e0(void);
|
||||
void memInit(u8 *heapstart, u32 heaplen);
|
||||
u32 memGetPool4Available(void);
|
||||
void *memGetNextPool4Allocation(void);
|
||||
void *memAllocFromBank(struct memorypool *pool, u32 size, u8 poolnum);
|
||||
void *malloc(u32 len, u8 pool);
|
||||
s32 memReallocate(void *allocation, s32 newsize, u8 poolnum);
|
||||
u32 memGetFree(u8 poolnum, u32 bank);
|
||||
u32 memGetSize(u8 poolnum, u32 bank);
|
||||
void memResetPool(u8 pool);
|
||||
void memDisablePool(u8 pool);
|
||||
void *memAllocFromBankRight(struct memorypool *pool, u32 size, u8 poolnum);
|
||||
void *mallocFromRight(u32 len, u8 pool);
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef _IN_LIB_MEMP_H
|
||||
#define _IN_LIB_MEMP_H
|
||||
#include <ultra64.h>
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
void memp000121e0(void);
|
||||
void mempInit(u8 *heapstart, u32 heaplen);
|
||||
u32 mempGetStageFree(void);
|
||||
void *mempGetNextStageAllocation(void);
|
||||
void *mempAlloc(u32 len, u8 pool);
|
||||
s32 mempRealloc(void *allocation, s32 newsize, u8 poolnum);
|
||||
u32 mempGetPoolFree(u8 poolnum, u32 bank);
|
||||
u32 mempGetPoolSize(u8 poolnum, u32 bank);
|
||||
void mempResetPool(u8 pool);
|
||||
void mempDisablePool(u8 pool);
|
||||
void *mempAllocFromRight(u32 len, u8 pool);
|
||||
|
||||
#endif
|
||||
|
|
@ -5109,14 +5109,6 @@ struct gecreditsdata {
|
|||
/*0x0a*/ u16 alignoffset2;
|
||||
};
|
||||
|
||||
struct memorypool {
|
||||
/*0x00*/ u8 *start;
|
||||
/*0x04*/ u8 *leftpos;
|
||||
/*0x08*/ u8 *rightpos;
|
||||
/*0x0c*/ u8 *end;
|
||||
/*0x10*/ u8 *prevallocation;
|
||||
};
|
||||
|
||||
struct invitem_weap {
|
||||
s16 weapon1;
|
||||
s16 pickuppad;
|
||||
|
|
|
|||
|
|
@ -582,7 +582,7 @@ u32 inflate(void)
|
|||
{
|
||||
s32 e; /* last block flag */
|
||||
s32 r; /* result code */
|
||||
u32 h; /* maximum struct huft's malloc'ed */
|
||||
u32 h; /* maximum struct huft's mempAlloc'ed */
|
||||
|
||||
/* initialize window, bit buffer */
|
||||
wp = 0;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include "game/bg.h"
|
||||
#include "bss.h"
|
||||
#include "lib/dma.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/mtx.h"
|
||||
#include "lib/anim.h"
|
||||
#include "lib/lib_2f490.h"
|
||||
|
|
@ -59,7 +59,7 @@ glabel anim000233c0
|
|||
/* 233e4: afbf001c */ sw $ra,0x1c($sp)
|
||||
/* 233e8: 3b04003f */ xori $a0,$t8,0x3f
|
||||
/* 233ec: 00808025 */ or $s0,$a0,$zero
|
||||
/* 233f0: 0c0048f2 */ jal malloc
|
||||
/* 233f0: 0c0048f2 */ jal mempAlloc
|
||||
/* 233f4: 24050006 */ addiu $a1,$zero,0x6
|
||||
/* 233f8: 3c05007d */ lui $a1,%hi(_animationsTableRomStart)
|
||||
/* 233fc: 24a5d1a0 */ addiu $a1,$a1,%lo(_animationsTableRomStart)
|
||||
|
|
@ -130,7 +130,7 @@ glabel anim000233c0
|
|||
/* 234f0: ae0a0000 */ sw $t2,0x0($s0)
|
||||
/* 234f4: acee0000 */ sw $t6,0x0($a3)
|
||||
/* 234f8: 39e4003f */ xori $a0,$t7,0x3f
|
||||
/* 234fc: 0c0048f2 */ jal malloc
|
||||
/* 234fc: 0c0048f2 */ jal mempAlloc
|
||||
/* 23500: 24050006 */ addiu $a1,$zero,0x6
|
||||
/* 23504: 3c098006 */ lui $t1,%hi(g_NumAnimations)
|
||||
/* 23508: 3c018006 */ lui $at,%hi(var8005f010)
|
||||
|
|
@ -141,7 +141,7 @@ glabel anim000233c0
|
|||
/* 2351c: 0004c840 */ sll $t9,$a0,0x1
|
||||
/* 23520: 2724003f */ addiu $a0,$t9,0x3f
|
||||
/* 23524: 348a003f */ ori $t2,$a0,0x3f
|
||||
/* 23528: 0c0048f2 */ jal malloc
|
||||
/* 23528: 0c0048f2 */ jal mempAlloc
|
||||
/* 2352c: 3944003f */ xori $a0,$t2,0x3f
|
||||
/* 23530: 3c078006 */ lui $a3,%hi(var8005f018)
|
||||
/* 23534: 3c018006 */ lui $at,%hi(var8005f014)
|
||||
|
|
@ -152,27 +152,27 @@ glabel anim000233c0
|
|||
/* 23548: 00046140 */ sll $t4,$a0,0x5
|
||||
/* 2354c: 2584003f */ addiu $a0,$t4,0x3f
|
||||
/* 23550: 348d003f */ ori $t5,$a0,0x3f
|
||||
/* 23554: 0c0048f2 */ jal malloc
|
||||
/* 23554: 0c0048f2 */ jal mempAlloc
|
||||
/* 23558: 39a4003f */ xori $a0,$t5,0x3f
|
||||
/* 2355c: 3c01800a */ lui $at,%hi(var8009a870)
|
||||
/* 23560: ac22a870 */ sw $v0,%lo(var8009a870)($at)
|
||||
/* 23564: 24040080 */ addiu $a0,$zero,0x80
|
||||
/* 23568: 0c0048f2 */ jal malloc
|
||||
/* 23568: 0c0048f2 */ jal mempAlloc
|
||||
/* 2356c: 24050006 */ addiu $a1,$zero,0x6
|
||||
/* 23570: 3c01800a */ lui $at,%hi(var8009a874)
|
||||
/* 23574: ac22a874 */ sw $v0,%lo(var8009a874)($at)
|
||||
/* 23578: 24040040 */ addiu $a0,$zero,0x40
|
||||
/* 2357c: 0c0048f2 */ jal malloc
|
||||
/* 2357c: 0c0048f2 */ jal mempAlloc
|
||||
/* 23580: 24050006 */ addiu $a1,$zero,0x6
|
||||
/* 23584: 3c01800a */ lui $at,%hi(var8009a878)
|
||||
/* 23588: ac22a878 */ sw $v0,%lo(var8009a878)($at)
|
||||
/* 2358c: 24040040 */ addiu $a0,$zero,0x40
|
||||
/* 23590: 0c0048f2 */ jal malloc
|
||||
/* 23590: 0c0048f2 */ jal mempAlloc
|
||||
/* 23594: 24050006 */ addiu $a1,$zero,0x6
|
||||
/* 23598: 3c01800a */ lui $at,%hi(var8009a87c)
|
||||
/* 2359c: ac22a87c */ sw $v0,%lo(var8009a87c)($at)
|
||||
/* 235a0: 24040040 */ addiu $a0,$zero,0x40
|
||||
/* 235a4: 0c0048f2 */ jal malloc
|
||||
/* 235a4: 0c0048f2 */ jal mempAlloc
|
||||
/* 235a8: 24050006 */ addiu $a1,$zero,0x6
|
||||
/* 235ac: 3c01800a */ lui $at,%hi(var8009a880)
|
||||
/* 235b0: ac22a880 */ sw $v0,%lo(var8009a880)($at)
|
||||
|
|
@ -183,22 +183,22 @@ glabel anim000233c0
|
|||
/* 235c4: 000f78c0 */ sll $t7,$t7,0x3
|
||||
/* 235c8: 25e4003f */ addiu $a0,$t7,0x3f
|
||||
/* 235cc: 3498003f */ ori $t8,$a0,0x3f
|
||||
/* 235d0: 0c0048f2 */ jal malloc
|
||||
/* 235d0: 0c0048f2 */ jal mempAlloc
|
||||
/* 235d4: 3b04003f */ xori $a0,$t8,0x3f
|
||||
/* 235d8: 3c01800a */ lui $at,%hi(var8009a884)
|
||||
/* 235dc: ac22a884 */ sw $v0,%lo(var8009a884)($at)
|
||||
/* 235e0: 240400c0 */ addiu $a0,$zero,0xc0
|
||||
/* 235e4: 0c0048f2 */ jal malloc
|
||||
/* 235e4: 0c0048f2 */ jal mempAlloc
|
||||
/* 235e8: 24050006 */ addiu $a1,$zero,0x6
|
||||
/* 235ec: 3c01800a */ lui $at,%hi(var8009a888)
|
||||
/* 235f0: ac22a888 */ sw $v0,%lo(var8009a888)($at)
|
||||
/* 235f4: 24040080 */ addiu $a0,$zero,0x80
|
||||
/* 235f8: 0c0048f2 */ jal malloc
|
||||
/* 235f8: 0c0048f2 */ jal mempAlloc
|
||||
/* 235fc: 24050006 */ addiu $a1,$zero,0x6
|
||||
/* 23600: 3c01800a */ lui $at,%hi(var8009a88c)
|
||||
/* 23604: ac22a88c */ sw $v0,%lo(var8009a88c)($at)
|
||||
/* 23608: 240400c0 */ addiu $a0,$zero,0xc0
|
||||
/* 2360c: 0c0048f2 */ jal malloc
|
||||
/* 2360c: 0c0048f2 */ jal mempAlloc
|
||||
/* 23610: 24050006 */ addiu $a1,$zero,0x6
|
||||
/* 23614: 3c01800a */ lui $at,%hi(var8009a890)
|
||||
/* 23618: 0c008d90 */ jal anim00023640
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include "game/game_1577f0.h"
|
||||
#include "bss.h"
|
||||
#include "lib/dma.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/mtx.h"
|
||||
#include "lib/lib_17ce0.h"
|
||||
#include "lib/anim.h"
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@
|
|||
#include "lib/dma.h"
|
||||
#include "lib/main.h"
|
||||
#include "lib/snd.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/lib_126b0.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/mema.h"
|
||||
#include "lib/lib_13750.h"
|
||||
#include "lib/debughud.h"
|
||||
#include "lib/anim.h"
|
||||
|
|
@ -63,7 +63,7 @@
|
|||
|
||||
s32 var8005d9b0 = 0;
|
||||
s32 g_StageNum = STAGE_TITLE;
|
||||
u32 var8005d9b8 = 0x0004b000;
|
||||
u32 g_MainMemaHeapSize = 1024 * 300;
|
||||
s32 var8005d9bc = 0;
|
||||
s32 var8005d9c0 = 0;
|
||||
s32 var8005d9c4 = 0;
|
||||
|
|
@ -305,7 +305,7 @@ glabel mainInit
|
|||
/* d27c: 00000000 */ nop
|
||||
/* d280: 0c00557c */ jal gvarsInit
|
||||
/* d284: 00000000 */ nop
|
||||
/* d288: 0c0047dc */ jal func000121e0
|
||||
/* d288: 0c0047dc */ jal memp000121e0
|
||||
/* d28c: 00000000 */ nop
|
||||
/* d290: 0c0049e7 */ jal memaInit
|
||||
/* d294: 00000000 */ nop
|
||||
|
|
@ -604,11 +604,11 @@ glabel mainInit
|
|||
/* d6d0: 8c631050 */ lw $v1,0x1050($v1)
|
||||
/* d6d4: 3c018000 */ lui $at,0x8000
|
||||
/* d6d8: 00412025 */ or $a0,$v0,$at
|
||||
/* d6dc: 0c0047de */ jal memInit
|
||||
/* d6dc: 0c0047de */ jal mempInit
|
||||
/* d6e0: 00642823 */ subu $a1,$v1,$a0
|
||||
/* d6e4: 0c0048ae */ jal memResetPool
|
||||
/* d6e4: 0c0048ae */ jal mempResetPool
|
||||
/* d6e8: 24040008 */ li $a0,0x8
|
||||
/* d6ec: 0c0048ae */ jal memResetPool
|
||||
/* d6ec: 0c0048ae */ jal mempResetPool
|
||||
/* d6f0: 24040006 */ li $a0,0x6
|
||||
/* d6f4: 0c00330e */ jal crashReset
|
||||
/* d6f8: 00000000 */ nop
|
||||
|
|
@ -708,7 +708,7 @@ glabel mainInit
|
|||
/* d53c: 00000000 */ nop
|
||||
/* d540: 0c005618 */ jal gvarsInit
|
||||
/* d544: 00000000 */ nop
|
||||
/* d548: 0c004878 */ jal func000121e0
|
||||
/* d548: 0c004878 */ jal memp000121e0
|
||||
/* d54c: 00000000 */ nop
|
||||
/* d550: 0c004a83 */ jal memaInit
|
||||
/* d554: 00000000 */ nop
|
||||
|
|
@ -1007,11 +1007,11 @@ glabel mainInit
|
|||
/* d994: 8c630b00 */ lw $v1,%lo(var80090b00)($v1)
|
||||
/* d998: 3c018000 */ lui $at,0x8000
|
||||
/* d99c: 00412025 */ or $a0,$v0,$at
|
||||
/* d9a0: 0c00487a */ jal memInit
|
||||
/* d9a0: 0c00487a */ jal mempInit
|
||||
/* d9a4: 00642823 */ subu $a1,$v1,$a0
|
||||
/* d9a8: 0c00494a */ jal memResetPool
|
||||
/* d9a8: 0c00494a */ jal mempResetPool
|
||||
/* d9ac: 24040008 */ addiu $a0,$zero,0x8
|
||||
/* d9b0: 0c00494a */ jal memResetPool
|
||||
/* d9b0: 0c00494a */ jal mempResetPool
|
||||
/* d9b4: 24040006 */ addiu $a0,$zero,0x6
|
||||
/* d9b8: 0c0033be */ jal crashReset
|
||||
/* d9bc: 00000000 */ nop
|
||||
|
|
@ -1105,7 +1105,7 @@ glabel mainInit
|
|||
/* daa4: 00000000 */ sll $zero,$zero,0x0
|
||||
/* daa8: 0c0059d4 */ jal gvarsInit
|
||||
/* daac: 00000000 */ sll $zero,$zero,0x0
|
||||
/* dab0: 0c004994 */ jal func000121e0
|
||||
/* dab0: 0c004994 */ jal memp000121e0
|
||||
/* dab4: 00000000 */ sll $zero,$zero,0x0
|
||||
/* dab8: 0c004beb */ jal memaInit
|
||||
/* dabc: 00000000 */ sll $zero,$zero,0x0
|
||||
|
|
@ -1380,11 +1380,11 @@ glabel mainInit
|
|||
/* dea4: 8c6330f0 */ lw $v1,0x30f0($v1)
|
||||
/* dea8: 3c018000 */ lui $at,0x8000
|
||||
/* deac: 00412025 */ or $a0,$v0,$at
|
||||
/* deb0: 0c004996 */ jal memInit
|
||||
/* deb0: 0c004996 */ jal mempInit
|
||||
/* deb4: 00642823 */ subu $a1,$v1,$a0
|
||||
/* deb8: 0c004ab1 */ jal memResetPool
|
||||
/* deb8: 0c004ab1 */ jal mempResetPool
|
||||
/* debc: 24040008 */ addiu $a0,$zero,0x8
|
||||
/* dec0: 0c004ab1 */ jal memResetPool
|
||||
/* dec0: 0c004ab1 */ jal mempResetPool
|
||||
/* dec4: 24040006 */ addiu $a0,$zero,0x6
|
||||
/* dec8: 0c003535 */ jal crashReset
|
||||
/* decc: 00000000 */ sll $zero,$zero,0x0
|
||||
|
|
@ -1498,7 +1498,7 @@ const char var70053aa0[] = " -ml0 -me0 -mgfx100 -mvtx50 -mt700 -ma400";
|
|||
// dmaInit();
|
||||
// amgrAllocateStack();
|
||||
// gvarsInit();
|
||||
// func000121e0();
|
||||
// memp000121e0();
|
||||
// memaInit();
|
||||
// func00013758();
|
||||
// viConfigureForLogos();
|
||||
|
|
@ -1636,10 +1636,10 @@ const char var70053aa0[] = " -ml0 -me0 -mgfx100 -mvtx50 -mt700 -ma400";
|
|||
//
|
||||
// uVar2 = osVirtualToPhysical(&_bssSegmentEnd) | 0x80000000;
|
||||
// tmp = var80090b00;
|
||||
// memInit(uVar2, tmp - uVar2);
|
||||
// mempInit(uVar2, tmp - uVar2);
|
||||
//
|
||||
// memResetPool(MEMPOOL_8);
|
||||
// memResetPool(MEMPOOL_PERMANENT);
|
||||
// mempResetPool(MEMPOOL_8);
|
||||
// mempResetPool(MEMPOOL_PERMANENT);
|
||||
// crashReset();
|
||||
// mpInitPresetFeatures();
|
||||
// func0f176ddc();
|
||||
|
|
@ -1866,15 +1866,15 @@ void mainLoop(void)
|
|||
|
||||
var8005d9c4 = 0;
|
||||
|
||||
memResetPool(MEMPOOL_7);
|
||||
memResetPool(MEMPOOL_STAGE);
|
||||
mempResetPool(MEMPOOL_7);
|
||||
mempResetPool(MEMPOOL_STAGE);
|
||||
func0f1672f0(4);
|
||||
|
||||
if (argFindByPrefix(1, "-ma")) {
|
||||
var8005d9b8 = strtol(argFindByPrefix(1, "-ma"), NULL, 0) * 1024;
|
||||
g_MainMemaHeapSize = strtol(argFindByPrefix(1, "-ma"), NULL, 0) * 1024;
|
||||
}
|
||||
|
||||
memaHeapInit(malloc(var8005d9b8, MEMPOOL_STAGE), var8005d9b8);
|
||||
memaHeapInit(mempAlloc(g_MainMemaHeapSize, MEMPOOL_STAGE), g_MainMemaHeapSize);
|
||||
stageLoadCommonLang(g_StageNum);
|
||||
playersUnrefAll();
|
||||
|
||||
|
|
@ -1979,8 +1979,8 @@ void mainLoop(void)
|
|||
}
|
||||
|
||||
lvReset();
|
||||
memDisablePool(MEMPOOL_STAGE);
|
||||
memDisablePool(MEMPOOL_7);
|
||||
mempDisablePool(MEMPOOL_STAGE);
|
||||
mempDisablePool(MEMPOOL_7);
|
||||
func0f1672f0(4);
|
||||
viBlack(true);
|
||||
pak0f116994();
|
||||
|
|
@ -2295,9 +2295,9 @@ glabel mainLoop
|
|||
.NB0000e480:
|
||||
/* e480: 3c018006 */ lui $at,0x8006
|
||||
/* e484: ac20f2e4 */ sw $zero,-0xd1c($at)
|
||||
/* e488: 0c004ab1 */ jal memResetPool
|
||||
/* e488: 0c004ab1 */ jal mempResetPool
|
||||
/* e48c: 24040007 */ addiu $a0,$zero,0x7
|
||||
/* e490: 0c004ab1 */ jal memResetPool
|
||||
/* e490: 0c004ab1 */ jal mempResetPool
|
||||
/* e494: 24040004 */ addiu $a0,$zero,0x4
|
||||
/* e498: 0fc58709 */ jal func0f1672f0
|
||||
/* e49c: 24040004 */ addiu $a0,$zero,0x4
|
||||
|
|
@ -2320,7 +2320,7 @@ glabel mainLoop
|
|||
.NB0000e4e0:
|
||||
/* e4e0: 3c048006 */ lui $a0,0x8006
|
||||
/* e4e4: 8c84f2d8 */ lw $a0,-0xd28($a0)
|
||||
/* e4e8: 0c004a0e */ jal malloc
|
||||
/* e4e8: 0c004a0e */ jal mempAlloc
|
||||
/* e4ec: 24050004 */ addiu $a1,$zero,0x4
|
||||
/* e4f0: 3c058006 */ lui $a1,0x8006
|
||||
/* e4f4: 8ca5f2d8 */ lw $a1,-0xd28($a1)
|
||||
|
|
@ -2575,9 +2575,9 @@ glabel mainLoop
|
|||
.NB0000e874:
|
||||
/* e874: 0fc59e56 */ jal lvReset
|
||||
/* e878: 00000000 */ sll $zero,$zero,0x0
|
||||
/* e87c: 0c004acc */ jal memDisablePool
|
||||
/* e87c: 0c004acc */ jal mempDisablePool
|
||||
/* e880: 24040004 */ addiu $a0,$zero,0x4
|
||||
/* e884: 0c004acc */ jal memDisablePool
|
||||
/* e884: 0c004acc */ jal mempDisablePool
|
||||
/* e888: 24040007 */ addiu $a0,$zero,0x7
|
||||
/* e88c: 0fc58709 */ jal func0f1672f0
|
||||
/* e890: 24040004 */ addiu $a0,$zero,0x4
|
||||
|
|
|
|||
|
|
@ -1,20 +1,57 @@
|
|||
#include <ultra64.h>
|
||||
#include "constants.h"
|
||||
#include "bss.h"
|
||||
#include "lib/lib_126b0.h"
|
||||
#include "lib/debughud.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/mema.h"
|
||||
#include "lib/memp.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
/**
|
||||
* mema - memory (ad hoc) allocation system.
|
||||
*
|
||||
* Mema's heap is 300KB and is itself allocated out of memp's stage pool.
|
||||
* Memp resets its stage pool each time a new stage is loaded, which means mema
|
||||
* is also reset each time a stage is loaded.
|
||||
*
|
||||
* Unlike memp, mema supports freeing of individual allocations. This makes it
|
||||
* a good system to use when the allocation is somewhat temporary and should be
|
||||
* freed without having to load a new stage. It's used by the (inaccessible)
|
||||
* Perfect Head editor, file listings and room code.
|
||||
*
|
||||
* Mema tracks what has been allocated by storing references to free spaces in
|
||||
* its spaces array. The allocations themselves are not referenced. When
|
||||
* initialising the spaces array, the first element is set to the entire heap
|
||||
* and the remaining elements are set to 0.
|
||||
*
|
||||
* This creates a bit of a terminology problem. Just remember that a memaspace
|
||||
* is not an allocation; it's a free space that is available for allocation.
|
||||
*
|
||||
* Due to the ability to free individual allocations, both the heap and the
|
||||
* spaces array can become fragmented. Mema supports defragmenting the spaces
|
||||
* array: entries are ordered by address, and back to back entries are merged.
|
||||
* The data in the heap itself is never moved, as that would require updating
|
||||
* pointers throughout the game code which mema cannot do.
|
||||
*/
|
||||
|
||||
#define MAX_SPACES 124
|
||||
|
||||
struct memaspace {
|
||||
s32 addr;
|
||||
u32 size;
|
||||
};
|
||||
|
||||
/**
|
||||
* This structure contains dummy entries before and after the spaces array.
|
||||
* These are used as start and end markers, but could have been avoided by
|
||||
* using loop counters (eg. a typical i < numspaces loop).
|
||||
*/
|
||||
struct memaheap {
|
||||
u32 unk000;
|
||||
struct memaspace spaces[127];
|
||||
struct memaspace start;
|
||||
struct memaspace spaces[MAX_SPACES];
|
||||
struct memaspace end1;
|
||||
struct memaspace end2;
|
||||
};
|
||||
|
||||
s32 g_MemaHeapStart;
|
||||
|
|
@ -41,9 +78,9 @@ void memaMerge(struct memaspace *a, struct memaspace *b)
|
|||
bool memaDefragPass(struct memaheap *heap)
|
||||
{
|
||||
bool merged = false;
|
||||
struct memaspace *prev = &heap->spaces[0];
|
||||
struct memaspace *curr = &heap->spaces[1];
|
||||
struct memaspace *last = &heap->spaces[124];
|
||||
struct memaspace *prev = &heap->start;
|
||||
struct memaspace *curr = &heap->spaces[0];
|
||||
struct memaspace *last = &heap->spaces[MAX_SPACES - 1];
|
||||
u32 addr = 0;
|
||||
|
||||
while (curr <= last) {
|
||||
|
|
@ -81,7 +118,7 @@ void memaDefrag(void)
|
|||
*/
|
||||
struct memaspace *memaMakeSlot(struct memaheap *heap)
|
||||
{
|
||||
struct memaspace *curr = &heap->spaces[1];
|
||||
struct memaspace *curr = &heap->spaces[0];
|
||||
struct memaspace *best;
|
||||
u32 min;
|
||||
s32 i;
|
||||
|
|
@ -90,8 +127,8 @@ struct memaspace *memaMakeSlot(struct memaheap *heap)
|
|||
// end. Though in most cases it's roughly in order anyway, and the excessive
|
||||
// looping is just wasting CPU cycles. In reality this situation probably
|
||||
// never occurs.
|
||||
for (i = 0; i < 124; i++) {
|
||||
while (curr <= &heap->spaces[124]) {
|
||||
for (i = 0; i < MAX_SPACES; i++) {
|
||||
while (curr <= &heap->spaces[MAX_SPACES - 1]) {
|
||||
if (curr->size == 0) {
|
||||
return curr;
|
||||
}
|
||||
|
|
@ -112,7 +149,7 @@ struct memaspace *memaMakeSlot(struct memaheap *heap)
|
|||
curr++;
|
||||
}
|
||||
|
||||
curr = &heap->spaces[1];
|
||||
curr = &heap->spaces[0];
|
||||
}
|
||||
|
||||
// If this code is reached then the spaces list is so badly and unrepairably
|
||||
|
|
@ -123,7 +160,7 @@ struct memaspace *memaMakeSlot(struct memaheap *heap)
|
|||
min = 0xffffffff;
|
||||
best = curr;
|
||||
|
||||
while (curr <= &heap->spaces[124]) {
|
||||
while (curr <= &heap->spaces[MAX_SPACES - 1]) {
|
||||
if (curr->size < min) {
|
||||
best = curr;
|
||||
min = curr->size;
|
||||
|
|
@ -142,8 +179,8 @@ void _memaFree(s32 addr, s32 size)
|
|||
// estimate and doesn't need to be any particular index, but the defrag
|
||||
// function tries to order the spaces by address so the closer we get to it
|
||||
// the less work the defrag function will have to do should it be called.
|
||||
s32 index = (addr - g_MemaHeapStart) * 124 / g_MemaHeapSize;
|
||||
struct memaspace *curr = &g_MemaHeap.spaces[index + 1];
|
||||
s32 index = (addr - g_MemaHeapStart) * MAX_SPACES / g_MemaHeapSize;
|
||||
struct memaspace *curr = &g_MemaHeap.spaces[index];
|
||||
|
||||
// If the entry is taken, keep moving forward until a zero is found.
|
||||
while (curr->size != 0) {
|
||||
|
|
@ -152,7 +189,7 @@ void _memaFree(s32 addr, s32 size)
|
|||
|
||||
// If we reached the end of the spaces list, go backwards instead
|
||||
if (curr->addr == -1) {
|
||||
curr = &g_MemaHeap.spaces[index + 1];
|
||||
curr = &g_MemaHeap.spaces[index];
|
||||
|
||||
while (curr->size != 0) {
|
||||
curr--;
|
||||
|
|
@ -178,26 +215,31 @@ void memaHeapInit(void *heapaddr, u32 heapsize)
|
|||
struct memaspace *space;
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
heapsize += 0x8e0; // ?!
|
||||
// Adding an amount to the heap size here means that mema can allocate past
|
||||
// the end of its heap. This would overflow into the gun names language
|
||||
// file. Maybe this code was intended to be temporary while a developer
|
||||
// figured out how much memory was needed, but they forgot to remove it?
|
||||
// @dangerous
|
||||
heapsize += 0x8e0;
|
||||
#endif
|
||||
|
||||
g_MemaHeap.unk000 = 0;
|
||||
|
||||
g_MemaHeap.spaces[0].addr = 0;
|
||||
g_MemaHeap.spaces[0].size = 0;
|
||||
g_MemaHeap.start.addr = 0;
|
||||
g_MemaHeap.start.size = 0;
|
||||
|
||||
g_MemaHeap.spaces[125].addr = 0xffffffff;
|
||||
g_MemaHeap.spaces[125].size = 0;
|
||||
g_MemaHeap.spaces[126].addr = 0xffffffff;
|
||||
g_MemaHeap.spaces[126].size = 0xffffffff;
|
||||
g_MemaHeap.end1.addr = 0xffffffff;
|
||||
g_MemaHeap.end1.size = 0;
|
||||
g_MemaHeap.end2.addr = 0xffffffff;
|
||||
g_MemaHeap.end2.size = 0xffffffff;
|
||||
|
||||
for (space = &g_MemaHeap.spaces[1]; space <= &g_MemaHeap.spaces[124]; space++) {
|
||||
for (space = &g_MemaHeap.spaces[0]; space <= &g_MemaHeap.spaces[MAX_SPACES - 1]; space++) {
|
||||
space->addr = 0;
|
||||
space->size = 0;
|
||||
}
|
||||
|
||||
g_MemaHeap.spaces[1].addr = g_MemaHeapStart = (u32)heapaddr;
|
||||
g_MemaHeap.spaces[1].size = g_MemaHeapSize = heapsize;
|
||||
g_MemaHeap.spaces[0].addr = g_MemaHeapStart = (u32)heapaddr;
|
||||
g_MemaHeap.spaces[0].size = g_MemaHeapSize = heapsize;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -251,23 +293,23 @@ void memaPrint(void)
|
|||
dhudPrintString("memp: MP_LF_LEV");
|
||||
line++;
|
||||
|
||||
onboard = memGetFree(MEMPOOL_STAGE, MEMBANK_ONBOARD);
|
||||
expansion = memGetFree(MEMPOOL_STAGE, MEMBANK_EXPANSION);
|
||||
onboard = mempGetPoolFree(MEMPOOL_STAGE, MEMBANK_ONBOARD);
|
||||
expansion = mempGetPoolFree(MEMPOOL_STAGE, MEMBANK_EXPANSION);
|
||||
sprintf(buffer, "F: %d %d", onboard, expansion);
|
||||
dhudSetPos(31, line);
|
||||
dhudPrintString(buffer);
|
||||
line++;
|
||||
|
||||
onboard = memGetSize(MEMPOOL_STAGE, MEMBANK_ONBOARD);
|
||||
expansion = memGetSize(MEMPOOL_STAGE, MEMBANK_EXPANSION);
|
||||
onboard = mempGetPoolSize(MEMPOOL_STAGE, MEMBANK_ONBOARD);
|
||||
expansion = mempGetPoolSize(MEMPOOL_STAGE, MEMBANK_EXPANSION);
|
||||
sprintf(buffer, "S: %d %d", onboard, expansion);
|
||||
dhudSetPos(31, line);
|
||||
dhudPrintString(buffer);
|
||||
line++;
|
||||
|
||||
over = memGetSize(MEMPOOL_STAGE, MEMBANK_EXPANSION)
|
||||
- memGetFree(MEMPOOL_STAGE, MEMBANK_EXPANSION)
|
||||
- memGetFree(MEMPOOL_STAGE, MEMBANK_ONBOARD);
|
||||
over = mempGetPoolSize(MEMPOOL_STAGE, MEMBANK_EXPANSION)
|
||||
- mempGetPoolFree(MEMPOOL_STAGE, MEMBANK_EXPANSION)
|
||||
- mempGetPoolFree(MEMPOOL_STAGE, MEMBANK_ONBOARD);
|
||||
|
||||
if (over >= 0) {
|
||||
sprintf(buffer, "Over: %d", over);
|
||||
|
|
@ -283,15 +325,15 @@ void memaPrint(void)
|
|||
dhudPrintString("memp: MP_LF_ETER");
|
||||
line++;
|
||||
|
||||
onboard = memGetFree(MEMPOOL_PERMANENT, MEMBANK_ONBOARD);
|
||||
expansion = memGetFree(MEMPOOL_PERMANENT, MEMBANK_EXPANSION);
|
||||
onboard = mempGetPoolFree(MEMPOOL_PERMANENT, MEMBANK_ONBOARD);
|
||||
expansion = mempGetPoolFree(MEMPOOL_PERMANENT, MEMBANK_EXPANSION);
|
||||
sprintf(buffer, "F: %d %d", onboard, expansion);
|
||||
dhudSetPos(31, line);
|
||||
dhudPrintString(buffer);
|
||||
line++;
|
||||
|
||||
onboard = memGetSize(MEMPOOL_PERMANENT, MEMBANK_ONBOARD);
|
||||
expansion = memGetSize(MEMPOOL_PERMANENT, MEMBANK_EXPANSION);
|
||||
onboard = mempGetPoolSize(MEMPOOL_PERMANENT, MEMBANK_ONBOARD);
|
||||
expansion = mempGetPoolSize(MEMPOOL_PERMANENT, MEMBANK_EXPANSION);
|
||||
sprintf(buffer, "S: %d %d", onboard, expansion);
|
||||
dhudSetPos(31, line);
|
||||
dhudPrintString(buffer);
|
||||
|
|
@ -625,7 +667,7 @@ glabel memaAlloc
|
|||
*/
|
||||
s32 memaGrow(s32 addr, u32 amount)
|
||||
{
|
||||
struct memaspace *curr = &g_MemaHeap.spaces[1];
|
||||
struct memaspace *curr = &g_MemaHeap.spaces[0];
|
||||
|
||||
while (curr->addr != -1) {
|
||||
if (curr->addr == addr && curr->size >= amount) {
|
||||
|
|
@ -669,7 +711,7 @@ s32 memaGetLongestFree(void)
|
|||
|
||||
memaDefrag();
|
||||
|
||||
curr = &g_MemaHeap.spaces[1];
|
||||
curr = &g_MemaHeap.spaces[0];
|
||||
|
||||
while (curr->addr != -1) {
|
||||
if (curr->size > biggest) {
|
||||
340
src/lib/memory.c
340
src/lib/memory.c
|
|
@ -1,340 +0,0 @@
|
|||
#include <ultra64.h>
|
||||
#include "constants.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
struct memorypool g_OnboardMemoryPools[9];
|
||||
u32 var800993b4;
|
||||
struct memorypool g_ExpansionMemoryPools[9];
|
||||
u32 var8009946c;
|
||||
|
||||
void func000121e0(void)
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the memory allocation system by initialising the banks and pools.
|
||||
*
|
||||
* The system has two banks - onboard and expansion - which refer to the onboard
|
||||
* memory and expansion pak memory if present. The arguments passed are the
|
||||
* onboard start and length that can be used by the memory system. If the
|
||||
* expansion pak is present, the entire pak is used for the second bank.
|
||||
*
|
||||
* Each bank consists of 8 pools, which start off overlapping. Care must be
|
||||
* taken to not allocate from the wrong pool at the wrong time. In practice it
|
||||
* appears only two pools are used which makes this easy:
|
||||
*
|
||||
* MEMPOOL_PERMANENT (index 6) is for permanent data and is never cleared
|
||||
* MEMPOOL_STAGE (index 4) is for general data and is cleared on stage load
|
||||
*
|
||||
* After the permanent pool has finished its allocations, it is closed off and
|
||||
* the stage pool is then placed immediately after it. All allocations from
|
||||
* there on are made from the stage pool.
|
||||
*
|
||||
* Each pool has a start and end address. Allocations are typically served from
|
||||
* the left side of the pool but can also be allocated from the right side.
|
||||
* In practice right side allocations are only used once (by texture related
|
||||
* code).
|
||||
*
|
||||
* Resizing an allocation is also supported, but only from the left side and
|
||||
* only if it's the most recent allocation.
|
||||
*/
|
||||
void memInit(u8 *heapstart, u32 heaplen)
|
||||
{
|
||||
s32 i;
|
||||
u8 *extraend;
|
||||
|
||||
for (i = 0; i < 9; i++) {
|
||||
g_OnboardMemoryPools[i].start = 0;
|
||||
g_OnboardMemoryPools[i].leftpos = 0;
|
||||
g_OnboardMemoryPools[i].rightpos = 0;
|
||||
g_OnboardMemoryPools[i].prevallocation = 0;
|
||||
|
||||
g_ExpansionMemoryPools[i].start = 0;
|
||||
g_ExpansionMemoryPools[i].leftpos = 0;
|
||||
g_ExpansionMemoryPools[i].rightpos = 0;
|
||||
g_ExpansionMemoryPools[i].prevallocation = 0;
|
||||
}
|
||||
|
||||
g_OnboardMemoryPools[MEMPOOL_0].start = heapstart;
|
||||
g_OnboardMemoryPools[MEMPOOL_0].rightpos = heapstart + heaplen;
|
||||
g_OnboardMemoryPools[MEMPOOL_PERMANENT].start = heapstart;
|
||||
g_OnboardMemoryPools[MEMPOOL_PERMANENT].rightpos = heapstart + heaplen;
|
||||
g_OnboardMemoryPools[MEMPOOL_STAGE].start = heapstart;
|
||||
g_OnboardMemoryPools[MEMPOOL_STAGE].rightpos = heapstart + heaplen;
|
||||
|
||||
// If 8MB, reserve the entire expansion pak for additional mempool 4
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
extraend = (u8 *)(0x80000000 + bootGetMemSize());
|
||||
#else
|
||||
extraend = (u8 *)(0x80000000 + osGetMemSize());
|
||||
#endif
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
if (bootGetMemSize() > 4 * 1024 * 1024)
|
||||
#else
|
||||
if (osGetMemSize() > 4 * 1024 * 1024)
|
||||
#endif
|
||||
{
|
||||
g_ExpansionMemoryPools[MEMPOOL_STAGE].start = (u8 *)0x80400000;
|
||||
g_ExpansionMemoryPools[MEMPOOL_STAGE].rightpos = extraend;
|
||||
}
|
||||
|
||||
for (i = 0; i < 9; i++) {
|
||||
g_OnboardMemoryPools[i].end = g_OnboardMemoryPools[i].rightpos;
|
||||
g_ExpansionMemoryPools[i].end = g_ExpansionMemoryPools[i].rightpos;
|
||||
}
|
||||
}
|
||||
|
||||
u32 memGetPool4Available(void)
|
||||
{
|
||||
u32 free;
|
||||
|
||||
if (IS4MB()) {
|
||||
free = g_OnboardMemoryPools[MEMPOOL_STAGE].rightpos - g_OnboardMemoryPools[MEMPOOL_STAGE].leftpos;
|
||||
} else {
|
||||
free = g_ExpansionMemoryPools[MEMPOOL_STAGE].rightpos - g_ExpansionMemoryPools[MEMPOOL_STAGE].leftpos;
|
||||
}
|
||||
|
||||
return free;
|
||||
}
|
||||
|
||||
void *memGetNextPool4Allocation(void)
|
||||
{
|
||||
void *next;
|
||||
|
||||
if (IS4MB()) {
|
||||
next = g_OnboardMemoryPools[MEMPOOL_STAGE].leftpos;
|
||||
} else {
|
||||
next = g_ExpansionMemoryPools[MEMPOOL_STAGE].leftpos;
|
||||
}
|
||||
|
||||
return next;
|
||||
}
|
||||
|
||||
void *memAllocFromBank(struct memorypool *pool, u32 size, u8 poolnum)
|
||||
{
|
||||
u8 *allocation;
|
||||
|
||||
pool += poolnum;
|
||||
|
||||
allocation = pool->leftpos;
|
||||
|
||||
if (pool->leftpos == 0) {
|
||||
return allocation;
|
||||
}
|
||||
|
||||
if (pool->leftpos > pool->rightpos) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pool->leftpos + size > pool->rightpos) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
pool->leftpos += size;
|
||||
pool->prevallocation = allocation;
|
||||
|
||||
if (1);
|
||||
|
||||
return (void *)allocation;
|
||||
}
|
||||
|
||||
void *malloc(u32 len, u8 pool)
|
||||
{
|
||||
void *allocation = memAllocFromBank(g_OnboardMemoryPools, len, pool);
|
||||
|
||||
if (allocation) {
|
||||
return allocation;
|
||||
}
|
||||
|
||||
allocation = memAllocFromBank(g_ExpansionMemoryPools, len, pool);
|
||||
|
||||
if (allocation) {
|
||||
return allocation;
|
||||
}
|
||||
|
||||
#if VERSION < VERSION_NTSC_1_0
|
||||
if (pool != MEMPOOL_8 && pool != MEMPOOL_7 && len) {
|
||||
char buffer[80];
|
||||
u32 stack;
|
||||
u32 size;
|
||||
u32 free;
|
||||
|
||||
if (pool == MEMPOOL_STAGE) {
|
||||
free = memGetFree(MEMPOOL_STAGE, MEMBANK_ONBOARD);
|
||||
size = memGetSize(MEMPOOL_STAGE, MEMBANK_ONBOARD);
|
||||
sprintf(buffer, "Out of mem - LEV: %d f %d s %d", len, free, size);
|
||||
} else {
|
||||
free = memGetFree(MEMPOOL_PERMANENT, MEMBANK_ONBOARD);
|
||||
size = memGetSize(MEMPOOL_PERMANENT, MEMBANK_ONBOARD);
|
||||
sprintf(buffer, "Out of mem - ETR: %d f %d s %d", len, free, size);
|
||||
}
|
||||
|
||||
func0000c1d0nb(buffer);
|
||||
CRASH();
|
||||
}
|
||||
#endif
|
||||
|
||||
return allocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reallocate the given allocation in the given pool.
|
||||
* The pointer will remain unchanged.
|
||||
*
|
||||
* The allocation must be the most recent allocation.
|
||||
*
|
||||
* @dangerous: This function does not check the limits of the memory pool.
|
||||
* If it allocates past the rightpos of the pool it could lead to memory corruption.
|
||||
*/
|
||||
s32 memReallocate(void *allocation, s32 newsize, u8 poolnum)
|
||||
{
|
||||
struct memorypool *pool = &g_OnboardMemoryPools[poolnum];
|
||||
s32 origsize;
|
||||
s32 growsize;
|
||||
|
||||
if (pool->prevallocation != allocation) {
|
||||
pool = &g_ExpansionMemoryPools[poolnum];
|
||||
|
||||
if (pool->prevallocation != allocation) {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
origsize = pool->leftpos - pool->prevallocation;
|
||||
growsize = newsize - origsize;
|
||||
|
||||
if (growsize <= 0) {
|
||||
pool->leftpos += growsize;
|
||||
pool->leftpos = (u8 *)ALIGN16((u32)pool->leftpos);
|
||||
return 1;
|
||||
}
|
||||
|
||||
pool->leftpos += growsize;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void func000124cc(void)
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
u32 memGetFree(u8 poolnum, u32 bank)
|
||||
{
|
||||
struct memorypool *pool;
|
||||
|
||||
if (bank == MEMBANK_ONBOARD) {
|
||||
pool = &g_OnboardMemoryPools[poolnum];
|
||||
} else {
|
||||
pool = &g_ExpansionMemoryPools[poolnum];
|
||||
}
|
||||
|
||||
return pool->rightpos - pool->leftpos;
|
||||
}
|
||||
|
||||
#if VERSION < VERSION_NTSC_1_0
|
||||
u32 memGetSize(u8 poolnum, u32 bank)
|
||||
{
|
||||
struct memorypool *pool;
|
||||
|
||||
if (bank == MEMBANK_ONBOARD) {
|
||||
pool = &g_OnboardMemoryPools[poolnum];
|
||||
} else {
|
||||
pool = &g_ExpansionMemoryPools[poolnum];
|
||||
}
|
||||
|
||||
return pool->rightpos - pool->start;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if VERSION < VERSION_NTSC_1_0
|
||||
void *memAllocFromPackedWord(u32 word)
|
||||
{
|
||||
return malloc(word >> 4, word & 0x0f);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Reset the pool's left side to its start address, effectively freeing the left
|
||||
* side of the pool.
|
||||
*
|
||||
* If resetting the stage pool, close off the permanent pool and place the stage
|
||||
* pool immediately after it.
|
||||
*
|
||||
* Note the right side is not reset here.
|
||||
*/
|
||||
void memResetPool(u8 pool)
|
||||
{
|
||||
if (pool == MEMPOOL_STAGE) {
|
||||
g_OnboardMemoryPools[MEMPOOL_STAGE].start = g_OnboardMemoryPools[MEMPOOL_PERMANENT].leftpos;
|
||||
g_OnboardMemoryPools[MEMPOOL_PERMANENT].rightpos = g_OnboardMemoryPools[MEMPOOL_PERMANENT].leftpos;
|
||||
g_OnboardMemoryPools[MEMPOOL_PERMANENT].end = g_OnboardMemoryPools[MEMPOOL_PERMANENT].leftpos;
|
||||
}
|
||||
|
||||
g_OnboardMemoryPools[pool].leftpos = g_OnboardMemoryPools[pool].start;
|
||||
g_ExpansionMemoryPools[pool].leftpos = g_ExpansionMemoryPools[pool].start;
|
||||
g_OnboardMemoryPools[pool].prevallocation = 0;
|
||||
g_ExpansionMemoryPools[pool].prevallocation = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting leftpos to 0 means that this pool will refuse allocations from the
|
||||
* left.
|
||||
*
|
||||
* Setting rightpos to the end means it's resetting the right side and making
|
||||
* that available for allocations. It would have made more sense to do this in
|
||||
* memResetPool instead.
|
||||
*/
|
||||
void memDisablePool(u8 pool)
|
||||
{
|
||||
g_OnboardMemoryPools[pool].leftpos = 0;
|
||||
g_ExpansionMemoryPools[pool].leftpos = 0;
|
||||
g_OnboardMemoryPools[pool].rightpos = g_OnboardMemoryPools[pool].end;
|
||||
g_ExpansionMemoryPools[pool].rightpos = g_ExpansionMemoryPools[pool].end;
|
||||
}
|
||||
|
||||
void *memAllocFromBankRight(struct memorypool *pool, u32 size, u8 poolnum)
|
||||
{
|
||||
u8 *allocation;
|
||||
|
||||
pool += poolnum;
|
||||
|
||||
allocation = pool->rightpos;
|
||||
|
||||
if (allocation == 0) {
|
||||
return allocation;
|
||||
}
|
||||
|
||||
if (pool->rightpos < pool->leftpos) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pool->rightpos - size < pool->leftpos) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
pool->rightpos -= size;
|
||||
|
||||
return (void *)pool->rightpos;
|
||||
}
|
||||
|
||||
void *mallocFromRight(u32 len, u8 pool)
|
||||
{
|
||||
void *allocation = memAllocFromBankRight(g_OnboardMemoryPools, len, pool);
|
||||
|
||||
if (allocation) {
|
||||
return allocation;
|
||||
}
|
||||
|
||||
allocation = memAllocFromBankRight(g_ExpansionMemoryPools, len, pool);
|
||||
|
||||
if (allocation) {
|
||||
return allocation;
|
||||
}
|
||||
|
||||
return allocation;
|
||||
}
|
||||
|
|
@ -0,0 +1,370 @@
|
|||
#include <ultra64.h>
|
||||
#include "constants.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memp.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
/**
|
||||
* memp - memory pool allocation system.
|
||||
*
|
||||
* Memp is the main memory allocation system in the game. Memp's heap size is
|
||||
* around 1MB without the expansion pak, and around 5MB with the expansion pak.
|
||||
*
|
||||
* There are other memory systems in the game, particularly mema, graphics
|
||||
* memory and the audio heap, which are all allocated out of memp.
|
||||
*
|
||||
* The memp system has two banks - onboard and expansion - which refer to the
|
||||
* onboard memory and expansion pak memory if present. If the expansion pak is
|
||||
* present, it's used entirely for memp.
|
||||
*
|
||||
* Each bank consists of 8 pools, which start off overlapping. Care must be
|
||||
* taken to not allocate from the wrong pool at the wrong time. In practice it
|
||||
* appears only two pools are used which makes this easy:
|
||||
*
|
||||
* MEMPOOL_PERMANENT (index 6) is for permanent data and is never cleared.
|
||||
* MEMPOOL_STAGE (index 4) is for general data and is cleared on stage load.
|
||||
*
|
||||
* After the permanent pool has finished its allocations, it is closed off and
|
||||
* the stage pool is then placed immediately after it. All allocations from
|
||||
* there on are made from the stage pool.
|
||||
*
|
||||
* Each pool has a start and end address. Allocations are typically served from
|
||||
* the left side of the pool but can also be allocated from the right side.
|
||||
* In practice right side allocations are only used once (by texture related
|
||||
* code).
|
||||
*
|
||||
* Resizing an allocation is also supported, but only from the left side and
|
||||
* only if it's the most recent allocation.
|
||||
*
|
||||
* Freeing individual allocations is not supported by memp. The only way to free
|
||||
* memp memory is to load a new stage which wipes the stage pool.
|
||||
*/
|
||||
|
||||
struct memorypool {
|
||||
/*0x00*/ u8 *start;
|
||||
/*0x04*/ u8 *leftpos;
|
||||
/*0x08*/ u8 *rightpos;
|
||||
/*0x0c*/ u8 *end;
|
||||
/*0x10*/ u8 *prevallocation;
|
||||
};
|
||||
|
||||
struct memorypool g_MempOnboardPools[9];
|
||||
struct memorypool g_MempExpansionPools[9];
|
||||
|
||||
void memp000121e0(void)
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise memp by initialising the banks and pools.
|
||||
*
|
||||
* The arguments passed are the onboard start and length that can be used.
|
||||
* If the expansion pak is present, the entire pak is used for the second bank.
|
||||
*/
|
||||
void mempInit(u8 *heapstart, u32 heaplen)
|
||||
{
|
||||
s32 i;
|
||||
u8 *extraend;
|
||||
|
||||
for (i = 0; i < 9; i++) {
|
||||
g_MempOnboardPools[i].start = 0;
|
||||
g_MempOnboardPools[i].leftpos = 0;
|
||||
g_MempOnboardPools[i].rightpos = 0;
|
||||
g_MempOnboardPools[i].prevallocation = 0;
|
||||
|
||||
g_MempExpansionPools[i].start = 0;
|
||||
g_MempExpansionPools[i].leftpos = 0;
|
||||
g_MempExpansionPools[i].rightpos = 0;
|
||||
g_MempExpansionPools[i].prevallocation = 0;
|
||||
}
|
||||
|
||||
g_MempOnboardPools[MEMPOOL_0].start = heapstart;
|
||||
g_MempOnboardPools[MEMPOOL_0].rightpos = heapstart + heaplen;
|
||||
g_MempOnboardPools[MEMPOOL_PERMANENT].start = heapstart;
|
||||
g_MempOnboardPools[MEMPOOL_PERMANENT].rightpos = heapstart + heaplen;
|
||||
g_MempOnboardPools[MEMPOOL_STAGE].start = heapstart;
|
||||
g_MempOnboardPools[MEMPOOL_STAGE].rightpos = heapstart + heaplen;
|
||||
|
||||
// If 8MB, reserve the entire expansion pak for the stage pool
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
extraend = (u8 *)(0x80000000 + bootGetMemSize());
|
||||
#else
|
||||
extraend = (u8 *)(0x80000000 + osGetMemSize());
|
||||
#endif
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
if (bootGetMemSize() > 4 * 1024 * 1024)
|
||||
#else
|
||||
if (osGetMemSize() > 4 * 1024 * 1024)
|
||||
#endif
|
||||
{
|
||||
g_MempExpansionPools[MEMPOOL_STAGE].start = (u8 *)0x80400000;
|
||||
g_MempExpansionPools[MEMPOOL_STAGE].rightpos = extraend;
|
||||
}
|
||||
|
||||
for (i = 0; i < 9; i++) {
|
||||
g_MempOnboardPools[i].end = g_MempOnboardPools[i].rightpos;
|
||||
g_MempExpansionPools[i].end = g_MempExpansionPools[i].rightpos;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the amount of free space in the stage pool.
|
||||
*
|
||||
* If using the expansion pak, it's assumed that the onboard pool is full
|
||||
* so only the expansion pool is checked.
|
||||
*/
|
||||
u32 mempGetStageFree(void)
|
||||
{
|
||||
u32 free;
|
||||
|
||||
if (IS4MB()) {
|
||||
free = g_MempOnboardPools[MEMPOOL_STAGE].rightpos - g_MempOnboardPools[MEMPOOL_STAGE].leftpos;
|
||||
} else {
|
||||
free = g_MempExpansionPools[MEMPOOL_STAGE].rightpos - g_MempExpansionPools[MEMPOOL_STAGE].leftpos;
|
||||
}
|
||||
|
||||
return free;
|
||||
}
|
||||
|
||||
void *mempGetNextStageAllocation(void)
|
||||
{
|
||||
void *next;
|
||||
|
||||
if (IS4MB()) {
|
||||
next = g_MempOnboardPools[MEMPOOL_STAGE].leftpos;
|
||||
} else {
|
||||
next = g_MempExpansionPools[MEMPOOL_STAGE].leftpos;
|
||||
}
|
||||
|
||||
return next;
|
||||
}
|
||||
|
||||
void *mempAllocFromBank(struct memorypool *pool, u32 size, u8 poolnum)
|
||||
{
|
||||
u8 *allocation;
|
||||
|
||||
pool += poolnum;
|
||||
|
||||
allocation = pool->leftpos;
|
||||
|
||||
if (pool->leftpos == 0) {
|
||||
return allocation;
|
||||
}
|
||||
|
||||
if (pool->leftpos > pool->rightpos) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pool->leftpos + size > pool->rightpos) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
pool->leftpos += size;
|
||||
pool->prevallocation = allocation;
|
||||
|
||||
if (1);
|
||||
|
||||
return (void *)allocation;
|
||||
}
|
||||
|
||||
void *mempAlloc(u32 len, u8 pool)
|
||||
{
|
||||
void *allocation = mempAllocFromBank(g_MempOnboardPools, len, pool);
|
||||
|
||||
if (allocation) {
|
||||
return allocation;
|
||||
}
|
||||
|
||||
allocation = mempAllocFromBank(g_MempExpansionPools, len, pool);
|
||||
|
||||
if (allocation) {
|
||||
return allocation;
|
||||
}
|
||||
|
||||
#if VERSION < VERSION_NTSC_1_0
|
||||
if (pool != MEMPOOL_8 && pool != MEMPOOL_7 && len) {
|
||||
char buffer[80];
|
||||
u32 stack;
|
||||
u32 size;
|
||||
u32 free;
|
||||
|
||||
if (pool == MEMPOOL_STAGE) {
|
||||
free = mempGetPoolFree(MEMPOOL_STAGE, MEMBANK_ONBOARD);
|
||||
size = mempGetPoolSize(MEMPOOL_STAGE, MEMBANK_ONBOARD);
|
||||
sprintf(buffer, "Out of mem - LEV: %d f %d s %d", len, free, size);
|
||||
} else {
|
||||
free = mempGetPoolFree(MEMPOOL_PERMANENT, MEMBANK_ONBOARD);
|
||||
size = mempGetPoolSize(MEMPOOL_PERMANENT, MEMBANK_ONBOARD);
|
||||
sprintf(buffer, "Out of mem - ETR: %d f %d s %d", len, free, size);
|
||||
}
|
||||
|
||||
func0000c1d0nb(buffer);
|
||||
CRASH();
|
||||
}
|
||||
#endif
|
||||
|
||||
return allocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reallocate the given allocation in the given pool.
|
||||
* The pointer will remain unchanged.
|
||||
*
|
||||
* The allocation must be the most recent allocation.
|
||||
*
|
||||
* @dangerous: This function does not check the limits of the memory pool.
|
||||
* If it allocates past the rightpos of the pool it could lead to memory corruption.
|
||||
*/
|
||||
s32 mempRealloc(void *allocation, s32 newsize, u8 poolnum)
|
||||
{
|
||||
struct memorypool *pool = &g_MempOnboardPools[poolnum];
|
||||
s32 origsize;
|
||||
s32 growsize;
|
||||
|
||||
if (pool->prevallocation != allocation) {
|
||||
pool = &g_MempExpansionPools[poolnum];
|
||||
|
||||
if (pool->prevallocation != allocation) {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
origsize = pool->leftpos - pool->prevallocation;
|
||||
growsize = newsize - origsize;
|
||||
|
||||
if (growsize <= 0) {
|
||||
pool->leftpos += growsize;
|
||||
pool->leftpos = (u8 *)ALIGN16((u32)pool->leftpos);
|
||||
return 1;
|
||||
}
|
||||
|
||||
pool->leftpos += growsize;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void memp000124cc(void)
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the amount of free space in the given pool and bank.
|
||||
*/
|
||||
u32 mempGetPoolFree(u8 poolnum, u32 bank)
|
||||
{
|
||||
struct memorypool *pool;
|
||||
|
||||
if (bank == MEMBANK_ONBOARD) {
|
||||
pool = &g_MempOnboardPools[poolnum];
|
||||
} else {
|
||||
pool = &g_MempExpansionPools[poolnum];
|
||||
}
|
||||
|
||||
return pool->rightpos - pool->leftpos;
|
||||
}
|
||||
|
||||
#if VERSION < VERSION_NTSC_1_0
|
||||
u32 mempGetPoolSize(u8 poolnum, u32 bank)
|
||||
{
|
||||
struct memorypool *pool;
|
||||
|
||||
if (bank == MEMBANK_ONBOARD) {
|
||||
pool = &g_MempOnboardPools[poolnum];
|
||||
} else {
|
||||
pool = &g_MempExpansionPools[poolnum];
|
||||
}
|
||||
|
||||
return pool->rightpos - pool->start;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if VERSION < VERSION_NTSC_1_0
|
||||
void *mempAllocFromPackedWord(u32 word)
|
||||
{
|
||||
return mempAlloc(word >> 4, word & 0x0f);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Reset the pool's left side to its start address, effectively freeing the left
|
||||
* side of the pool.
|
||||
*
|
||||
* If resetting the stage pool, close off the permanent pool and place the stage
|
||||
* pool immediately after it.
|
||||
*
|
||||
* Note the right side is not reset here.
|
||||
*/
|
||||
void mempResetPool(u8 pool)
|
||||
{
|
||||
if (pool == MEMPOOL_STAGE) {
|
||||
g_MempOnboardPools[MEMPOOL_STAGE].start = g_MempOnboardPools[MEMPOOL_PERMANENT].leftpos;
|
||||
g_MempOnboardPools[MEMPOOL_PERMANENT].rightpos = g_MempOnboardPools[MEMPOOL_PERMANENT].leftpos;
|
||||
g_MempOnboardPools[MEMPOOL_PERMANENT].end = g_MempOnboardPools[MEMPOOL_PERMANENT].leftpos;
|
||||
}
|
||||
|
||||
g_MempOnboardPools[pool].leftpos = g_MempOnboardPools[pool].start;
|
||||
g_MempExpansionPools[pool].leftpos = g_MempExpansionPools[pool].start;
|
||||
g_MempOnboardPools[pool].prevallocation = 0;
|
||||
g_MempExpansionPools[pool].prevallocation = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting leftpos to 0 means that this pool will refuse allocations from the
|
||||
* left.
|
||||
*
|
||||
* Setting rightpos to the end means it's resetting the right side and making
|
||||
* that available for allocations. It would have made more sense to do this in
|
||||
* mempResetPool instead.
|
||||
*/
|
||||
void mempDisablePool(u8 pool)
|
||||
{
|
||||
g_MempOnboardPools[pool].leftpos = 0;
|
||||
g_MempExpansionPools[pool].leftpos = 0;
|
||||
g_MempOnboardPools[pool].rightpos = g_MempOnboardPools[pool].end;
|
||||
g_MempExpansionPools[pool].rightpos = g_MempExpansionPools[pool].end;
|
||||
}
|
||||
|
||||
void *mempAllocFromBankRight(struct memorypool *pool, u32 size, u8 poolnum)
|
||||
{
|
||||
u8 *allocation;
|
||||
|
||||
pool += poolnum;
|
||||
|
||||
allocation = pool->rightpos;
|
||||
|
||||
if (allocation == 0) {
|
||||
return allocation;
|
||||
}
|
||||
|
||||
if (pool->rightpos < pool->leftpos) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pool->rightpos - size < pool->leftpos) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
pool->rightpos -= size;
|
||||
|
||||
return (void *)pool->rightpos;
|
||||
}
|
||||
|
||||
void *mempAllocFromRight(u32 len, u8 pool)
|
||||
{
|
||||
void *allocation = mempAllocFromBankRight(g_MempOnboardPools, len, pool);
|
||||
|
||||
if (allocation) {
|
||||
return allocation;
|
||||
}
|
||||
|
||||
allocation = mempAllocFromBankRight(g_MempExpansionPools, len, pool);
|
||||
|
||||
if (allocation) {
|
||||
return allocation;
|
||||
}
|
||||
|
||||
return allocation;
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
#include "types.h"
|
||||
#include "data.h"
|
||||
#include "bss.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
|
||||
u8 g_RdpDramStack[SP_DRAM_STACK_SIZE8];
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ void rdpInit(void)
|
|||
size = 0x8000;
|
||||
}
|
||||
|
||||
g_RdpOutBufferStart = malloc(size, MEMPOOL_PERMANENT);
|
||||
g_RdpOutBufferStart = mempAlloc(size, MEMPOOL_PERMANENT);
|
||||
g_RdpOutBufferEnd = (u16 *)((u32)g_RdpOutBufferStart + size);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* There are two inflate implementations in this codebase:
|
||||
*
|
||||
* 1. src/inflate/inflate.c:
|
||||
* - Is pretty much regular zlib but with some malloc functions changed to use
|
||||
* - Is pretty much regular zlib but with some mempAlloc functions changed to use
|
||||
* stack or data.
|
||||
* - Being C, is more readable than this file.
|
||||
* - Is stored uncompressed in the ROM and is used to decompress the lib and
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
#include "lib/args.h"
|
||||
#include "lib/dma.h"
|
||||
#include "lib/snd.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/rng.h"
|
||||
#include "lib/lib_2fc60.h"
|
||||
#include "lib/lib_317f0.h"
|
||||
|
|
@ -2303,7 +2303,7 @@ void sndInit(void)
|
|||
#if VERSION >= VERSION_PAL_FINAL
|
||||
u32 settings[3];
|
||||
#endif
|
||||
u8 *ptr = malloc(heaplen, MEMPOOL_PERMANENT);
|
||||
u8 *ptr = mempAlloc(heaplen, MEMPOOL_PERMANENT);
|
||||
u32 len = &_seqctlSegmentRomEnd - &_seqctlSegmentRomStart;
|
||||
s32 i;
|
||||
u32 seqromaddr = (u32) &_sequencesSegmentRomStart;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
#include "game/options.h"
|
||||
#include "bss.h"
|
||||
#include "lib/vi.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/memp.h"
|
||||
#include "lib/mtx.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
|
@ -221,7 +221,7 @@ void viAllocateFbs(s32 stagenum)
|
|||
}
|
||||
}
|
||||
|
||||
ptr = malloc(fbsize * 2 + 0x40, MEMPOOL_STAGE);
|
||||
ptr = mempAlloc(fbsize * 2 + 0x40, MEMPOOL_STAGE);
|
||||
|
||||
ptr = (u8 *)(((u32)ptr + 0x3f) & 0xffffffc0);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue