Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
memory.h
Go to the documentation of this file.
1 #ifndef _MEMORY_H_
2 #define _MEMORY_H_
3 
4 
5 #define MEMORY_POOL_LEFT 0
6 #define MEMORY_POOL_RIGHT 1
7 
8 
10 {
15 };
16 
17 struct MemoryPool;
18 
19 #ifndef INCLUDED_FROM_MEMORY_C
20 // Declaring this variable extern puts it in the wrong place in the bss order
21 // when this file is included from memory.c (first instead of last). Hence,
22 // ifdef hack. It was very likely subject to bss reordering originally.
23 extern struct MemoryPool *D_8033A124;
24 #endif
25 
26 u32 set_segment_base_addr(s32 segment, void *addr);
27 void *get_segment_base_addr(s32 segment);
28 void *segmented_to_virtual(void *addr);
29 void *virtual_to_segmented(s32 segment, void *addr);
31 
32 void main_pool_init(void *start, void *end);
33 void *main_pool_alloc(u32 size, u32 side);
34 u32 main_pool_free(void *addr);
35 void *main_pool_realloc(void *addr, u32 size);
39 
40 void *load_segment(s32 segment, u8 *srcStart, u8 *srcEnd, u32 side);
41 void *load_to_fixed_pool_addr(u8 *destAddr, u8 *srcStart, u8 *srcEnd);
42 void *load_segment_decompress(s32 segment, u8 *srcStart, u8 *srcEnd);
43 void *func_80278304(u32 segment, u8 *srcStart, u8 *srcEnd);
44 void load_engine_code_segment(void);
45 
46 struct AllocOnlyPool *alloc_only_pool_init(u32 size, u32 side);
47 void *alloc_only_pool_alloc(struct AllocOnlyPool *pool, s32 size);
48 struct AllocOnlyPool *alloc_only_pool_resize(struct AllocOnlyPool *pool, u32 size);
49 
50 struct MemoryPool *mem_pool_init(u32 size, u32 side);
51 void *mem_pool_alloc(struct MemoryPool *pool, u32 size);
52 void mem_pool_free(struct MemoryPool *pool, void *addr);
53 
54 void *alloc_display_list(u32 size);
55 void func_80278A78(struct MarioAnimation *a, void *b, void *c);
57 
58 #endif
void * alloc_only_pool_alloc(struct AllocOnlyPool *pool, s32 size)
Allocate from an allocation-only pool.
Definition: memory.c:369
void * virtual_to_segmented(s32 segment, void *addr)
Definition: memory.c:73
u8 * freePtr
Definition: memory.h:14
void move_segment_table_to_dmem(void)
Definition: memory.c:79
u32 main_pool_available(void)
Return the size of the largest block that can currently be allocated from the pool.
Definition: memory.c:181
u32 main_pool_free(void *addr)
Free a block of memory that was allocated from the pool.
Definition: memory.c:140
s32 func_80278AD4(struct MarioAnimation *a, u32 b)
Definition: memory.c:520
void * func_80278304(u32 segment, u8 *srcStart, u8 *srcEnd)
Definition: memory.c:316
void * get_segment_base_addr(s32 segment)
Definition: memory.c:62
void main_pool_init(void *start, void *end)
Initialize the main memory pool.
Definition: memory.c:91
void * load_to_fixed_pool_addr(u8 *destAddr, u8 *srcStart, u8 *srcEnd)
Definition: memory.c:269
struct AllocOnlyPool * alloc_only_pool_resize(struct AllocOnlyPool *pool, u32 size)
Resize an allocation-only pool.
Definition: memory.c:387
s32 usedSpace
Definition: memory.h:12
void * alloc_display_list(u32 size)
Definition: memory.c:491
struct MemoryPool * mem_pool_init(u32 size, u32 side)
Allocate a memory pool from the main pool.
Definition: memory.c:402
void * main_pool_alloc(u32 size, u32 side)
Allocate a block of memory from the pool of given size, and from the specified side of the pool (MEMO...
Definition: memory.c:109
void * mem_pool_alloc(struct MemoryPool *pool, u32 size)
Allocate from a memory pool.
Definition: memory.c:426
at end of structure union member declaration In standard C each member declaration must be terminated by a
Definition: err.english.cc:690
struct AllocOnlyPool * alloc_only_pool_init(u32 size, u32 side)
Allocate an allocation-only pool from the main pool.
Definition: memory.c:349
void func_80278A78(struct MarioAnimation *a, void *b, void *c)
Definition: memory.c:513
struct MemoryPool * D_8033A124
Definition: memory.c:53
Definition: memory.c:34
void * segmented_to_virtual(void *addr)
Definition: memory.c:66
void mem_pool_free(struct MemoryPool *pool, void *addr)
Free a block that was allocated using mem_pool_alloc.
Definition: memory.c:453
Definition: types.h:230
u32 main_pool_push_state(void)
Push pool state, to be restored later.
Definition: memory.c:189
u32 main_pool_pop_state(void)
Restore pool state from a previous call to main_pool_push_state.
Definition: memory.c:207
addr
Definition: first-diff.py:150
u8 * startPtr
Definition: memory.h:13
void * load_segment(s32 segment, u8 *srcStart, u8 *srcEnd, u32 side)
Load data from ROM into a newly allocated block, and set the segment base address to this block...
Definition: memory.c:254
u32 set_segment_base_addr(s32 segment, void *addr)
Definition: memory.c:57
void load_engine_code_segment(void)
Definition: memory.c:332
void * load_segment_decompress(s32 segment, u8 *srcStart, u8 *srcEnd)
Decompress the block of ROM data from srcStart to srcEnd and return a pointer to an allocated buffer ...
Definition: memory.c:293
unsigned char u8
Definition: ultratypes.h:12
s32 totalSpace
Definition: memory.h:11
signed int s32
Definition: ultratypes.h:15
Definition: memory.h:9
void * main_pool_realloc(void *addr, u32 size)
Resize a block of memory that was allocated from the left side of the pool.
Definition: memory.c:166
unsigned int u32
Definition: ultratypes.h:16