Some memory pool size defines

This commit is contained in:
Arceveti
2021-11-02 12:50:09 -07:00
parent dcb3b311ad
commit 4e907d5469
6 changed files with 16 additions and 17 deletions

View File

@@ -107,7 +107,7 @@ void alloc_pool(void) {
void *end = (void *) (SEG_POOL_START + POOL_SIZE);
main_pool_init(start, end);
gEffectsMemoryPool = mem_pool_init(0x4000, MEMORY_POOL_LEFT);
gEffectsMemoryPool = mem_pool_init(EFFECTS_MEMORY_POOL, MEMORY_POOL_LEFT);
#ifdef PUPPYLIGHTS
gLightsPool = mem_pool_init(PUPPYLIGHTS_POOL, MEMORY_POOL_LEFT);
#endif

View File

@@ -2,8 +2,6 @@
#include "sm64.h"
#define INCLUDED_FROM_MEMORY_C
#include "buffers/buffers.h"
#include "slidec.h"
#include "game/game_init.h"

View File

@@ -38,12 +38,9 @@ struct DmaHandlerList {
void *bufTarget;
};
#ifndef INCLUDED_FROM_MEMORY_C
// Declaring this variable extern puts it in the wrong place in the bss order
// when this file is included from memory.c (first instead of last). Hence,
// ifdef hack. It was very likely subject to bss reordering originally.
#define EFFECTS_MEMORY_POOL 0x4000
extern struct MemoryPool *gEffectsMemoryPool;
#endif
uintptr_t set_segment_base_addr(s32 segment, void *addr);
void *get_segment_base_addr(s32 segment);

View File

@@ -468,9 +468,9 @@ void spawn_objects_from_info(struct SpawnInfo *spawnInfo) {
void clear_objects(void) {
s32 i;
gTHIWaterDrained = 0;
gTimeStopState = 0;
gMarioObject = NULL;
gTHIWaterDrained = 0;
gTimeStopState = 0;
gMarioObject = NULL;
gMarioCurrentRoom = 0;
for (i = 0; i < 60; i++) {
@@ -488,8 +488,8 @@ void clear_objects(void) {
geo_reset_object_node(&gObjectPool[i].header.gfx);
}
gObjectMemoryPool = mem_pool_init(0x800, MEMORY_POOL_LEFT);
gObjectLists = gObjectListArray;
gObjectMemoryPool = mem_pool_init(OBJECT_MEMORY_POOL, MEMORY_POOL_LEFT);
gObjectLists = gObjectListArray;
clear_dynamic_surfaces();
}

View File

@@ -95,6 +95,8 @@ extern s32 gSurfacesAllocated;
extern s32 gNumStaticSurfaceNodes;
extern s32 gNumStaticSurfaces;
#define OBJECT_MEMORY_POOL 0x800
extern struct MemoryPool *gObjectMemoryPool;
enum CollisionFlags {

View File

@@ -145,9 +145,11 @@ void puppyprint_calculate_ram_usage(void) {
}
// These are a bit hacky, but what can ye do eh?
// gEffectsMemoryPool is 0x4000, gObjectsMemoryPool is 0x800. Epic C limitations mean I can't just sizeof their values :)
ramsizeSegment[5] = (0x4000 + 0x800 + 0x4000 + 0x800);
ramsizeSegment[6] = ((SURFACE_NODE_POOL_SIZE * sizeof(struct SurfaceNode)) + (SURFACE_POOL_SIZE * sizeof(struct Surface)));
// gEffectsMemoryPool is 0x4000, gObjectMemoryPool is 0x800. Epic C limitations mean I can't just sizeof their values :)
ramsizeSegment[5] = (EFFECTS_MEMORY_POOL + OBJECT_MEMORY_POOL
+ EFFECTS_MEMORY_POOL + OBJECT_MEMORY_POOL);
ramsizeSegment[6] = ((SURFACE_NODE_POOL_SIZE * sizeof(struct SurfaceNode))
+ ( SURFACE_POOL_SIZE * sizeof(struct Surface )));
ramsizeSegment[7] = gAudioHeapSize;
}
@@ -225,7 +227,7 @@ void print_ram_bar(void) {
continue;
}
perfPercentage = ((f32)ramsizeSegment[i] / ramsize);
graphPos = prevGraph + CLAMP((BAR_LENGTH * perfPercentage), 1, (SCREEN_CENTER_X + (BAR_LENGTH / 2)));
graphPos = (prevGraph + CLAMP((BAR_LENGTH * perfPercentage), 1, (SCREEN_CENTER_X + (BAR_LENGTH / 2))));
render_blank_box(prevGraph, (SCREEN_HEIGHT - 30), graphPos, (SCREEN_HEIGHT - 22),
colourChart[i][0],
colourChart[i][1],