Files
Shipwright/soh/src/buffers/heaps.c
T
louist103 acfc04d0ac Add an error for implicit functions (#3017)
* Add the flag and fix errors

* switch assert and skin matrix

* new LUS

* Use normal assert

* hopefully fix WiiU

Signed-off-by: Louis <louist103@pop-os.localdomain>

---------

Signed-off-by: Louis <louist103@pop-os.localdomain>
Co-authored-by: Louis <louist103@pop-os.localdomain>
Co-authored-by: Christopher Leggett <chris@leggett.dev>
2023-06-27 19:53:35 -04:00

44 lines
970 B
C

#include "z64.h"
#include <assert.h>
#ifndef __APPLE__
#include <malloc.h>
#endif
#include <stdlib.h>
#ifndef _MSC_VER
#include <unistd.h>
#endif
u8* gAudioHeap;
u8* gSystemHeap;
void Heaps_Alloc(void)
{
#ifdef _MSC_VER
gAudioHeap = (u8*)_aligned_malloc(AUDIO_HEAP_SIZE, 0x10);
gSystemHeap = (u8*)_aligned_malloc(SYSTEM_HEAP_SIZE, 0x10);
#elif defined(_POSIX_VERSION) && (_POSIX_VERSION >= 200112L)
if (posix_memalign((void**)&gAudioHeap, 0x10, AUDIO_HEAP_SIZE) != 0)
gAudioHeap = NULL;
if (posix_memalign((void**)&gSystemHeap, 0x10, SYSTEM_HEAP_SIZE) != 0)
gSystemHeap = NULL;
#else
gAudioHeap = (u8*)memalign(0x10, AUDIO_HEAP_SIZE);
gSystemHeap = (u8*)memalign(0x10, SYSTEM_HEAP_SIZE);
#endif
assert(gAudioHeap != NULL);
assert(gSystemHeap != NULL);
}
void Heaps_Free(void)
{
#ifdef _MSC_VER
_aligned_free(gAudioHeap);
_aligned_free(gSystemHeap);
#else
free(gAudioHeap);
free(gSystemHeap);
#endif
}