![]() |
Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
|
#include <ultra64.h>
#include "sm64.h"
#include "decompress.h"
#include "game.h"
#include "main.h"
#include "segments.h"
#include "memory.h"
Data Structures | |
struct | MainPoolState |
struct | MainPoolBlock |
struct | MemoryPool |
struct | MemoryBlock |
Macros | |
#define | INCLUDED_FROM_MEMORY_C |
#define | ALIGN4(val) (((val) + 0x3) & ~0x3) |
#define | ALIGN8(val) (((val) + 0x7) & ~0x7) |
#define | ALIGN16(val) (((val) + 0xF) & ~0xF) |
Functions | |
u32 | set_segment_base_addr (s32 segment, void *addr) |
void * | get_segment_base_addr (s32 segment) |
void * | segmented_to_virtual (void *addr) |
void * | virtual_to_segmented (s32 segment, void *addr) |
void | move_segment_table_to_dmem (void) |
void | main_pool_init (void *start, void *end) |
Initialize the main memory pool. More... | |
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 (MEMORY_POOL_LEFT or MEMORY_POOL_RIGHT). More... | |
u32 | main_pool_free (void *addr) |
Free a block of memory that was allocated from the pool. More... | |
void * | main_pool_realloc (void *addr, u32 size) |
Resize a block of memory that was allocated from the left side of the pool. More... | |
u32 | main_pool_available (void) |
Return the size of the largest block that can currently be allocated from the pool. More... | |
u32 | main_pool_push_state (void) |
Push pool state, to be restored later. More... | |
u32 | main_pool_pop_state (void) |
Restore pool state from a previous call to main_pool_push_state. More... | |
static void | dma_read (u8 *dest, u8 *srcStart, u8 *srcEnd) |
Perform a DMA read from ROM. More... | |
static void * | dynamic_dma_read (u8 *srcStart, u8 *srcEnd, u32 side) |
Perform a DMA read from ROM, allocating space in the memory pool to write to. More... | |
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. More... | |
void * | load_to_fixed_pool_addr (u8 *destAddr, u8 *srcStart, u8 *srcEnd) |
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 holding the decompressed data. More... | |
void * | func_80278304 (u32 segment, u8 *srcStart, u8 *srcEnd) |
void | load_engine_code_segment (void) |
struct AllocOnlyPool * | alloc_only_pool_init (u32 size, u32 side) |
Allocate an allocation-only pool from the main pool. More... | |
void * | alloc_only_pool_alloc (struct AllocOnlyPool *pool, s32 size) |
Allocate from an allocation-only pool. More... | |
struct AllocOnlyPool * | alloc_only_pool_resize (struct AllocOnlyPool *pool, u32 size) |
Resize an allocation-only pool. More... | |
struct MemoryPool * | mem_pool_init (u32 size, u32 side) |
Allocate a memory pool from the main pool. More... | |
void * | mem_pool_alloc (struct MemoryPool *pool, u32 size) |
Allocate from a memory pool. More... | |
void | mem_pool_free (struct MemoryPool *pool, void *addr) |
Free a block that was allocated using mem_pool_alloc. More... | |
void * | alloc_display_list (u32 size) |
static struct MarioAnimDmaRelatedThing * | func_802789F0 (u8 *srcAddr) |
void | func_80278A78 (struct MarioAnimation *a, void *b, void *c) |
s32 | func_80278AD4 (struct MarioAnimation *a, u32 b) |
#define ALIGN16 | ( | val | ) | (((val) + 0xF) & ~0xF) |
#define ALIGN4 | ( | val | ) | (((val) + 0x3) & ~0x3) |
#define ALIGN8 | ( | val | ) | (((val) + 0x7) & ~0x7) |
#define INCLUDED_FROM_MEMORY_C |
void* alloc_only_pool_alloc | ( | struct AllocOnlyPool * | pool, |
s32 | size | ||
) |
Allocate from an allocation-only pool.
Return NULL if there is not enough space.
struct AllocOnlyPool* alloc_only_pool_init | ( | u32 | size, |
u32 | side | ||
) |
Allocate an allocation-only pool from the main pool.
This pool doesn't support freeing allocated memory. Return NULL if there is not enough space in the main pool.
struct AllocOnlyPool* alloc_only_pool_resize | ( | struct AllocOnlyPool * | pool, |
u32 | size | ||
) |
Resize an allocation-only pool.
If the pool is increasing in size, the pool must be the last thing allocated from the left end of the main pool. The pool does not move.
Perform a DMA read from ROM.
The transfer is split into 4KB blocks, and this function blocks until completion.
Perform a DMA read from ROM, allocating space in the memory pool to write to.
Return the destination address.
|
static |
void func_80278A78 | ( | struct MarioAnimation * | a, |
void * | b, | ||
void * | c | ||
) |
s32 func_80278AD4 | ( | struct MarioAnimation * | a, |
u32 | b | ||
) |
Load data from ROM into a newly allocated block, and set the segment base address to this block.
Decompress the block of ROM data from srcStart to srcEnd and return a pointer to an allocated buffer holding the decompressed data.
Set the base address of segment to this address.
Allocate a block of memory from the pool of given size, and from the specified side of the pool (MEMORY_POOL_LEFT or MEMORY_POOL_RIGHT).
If there is not enough space, return NULL.
Return the size of the largest block that can currently be allocated from the pool.
Free a block of memory that was allocated from the pool.
The block must be the most recently allocated block from its end of the pool. Return the amount of free space left in the pool.
Initialize the main memory pool.
This pool is conceptually a pair of stacks that grow inward from the left and right. It therefore only supports freeing the object that was most recently allocated from a side.
Restore pool state from a previous call to main_pool_push_state.
Return the amount of free space left in the pool.
Push pool state, to be restored later.
Return the amount of free space left in the pool.
Resize a block of memory that was allocated from the left side of the pool.
If the block is increasing in size, it must be the most recently allocated block from the left side. The block does not move.
void* mem_pool_alloc | ( | struct MemoryPool * | pool, |
u32 | size | ||
) |
Allocate from a memory pool.
Return NULL if there is not enough space.
void mem_pool_free | ( | struct MemoryPool * | pool, |
void * | addr | ||
) |
Free a block that was allocated using mem_pool_alloc.
struct MemoryPool* mem_pool_init | ( | u32 | size, |
u32 | side | ||
) |
Allocate a memory pool from the main pool.
This pool supports arbitrary order for allocation/freeing. Return NULL if there is not enough space in the main pool.
u8 _engineSegmentRomEnd[] |
u8 _engineSegmentRomStart[] |
struct MemoryPool* D_8033A124 |
u8 gDecompressionHeap[] |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |