mirror of
https://github.com/libretro/RetroArch
synced 2025-01-27 21:35:25 +00:00
(WIIU) add frontend driver, allocate mem2
This commit is contained in:
parent
a4d745a471
commit
185849d5ff
@ -113,7 +113,7 @@ ASFLAGS := $(CFLAGS) -mregnames
|
|||||||
CFLAGS += -ffast-math -Werror=implicit-function-declaration
|
CFLAGS += -ffast-math -Werror=implicit-function-declaration
|
||||||
#CFLAGS += -fomit-frame-pointer -mword-relocations
|
#CFLAGS += -fomit-frame-pointer -mword-relocations
|
||||||
#CFLAGS += -Wall
|
#CFLAGS += -Wall
|
||||||
CFLAGS += -DWIIU
|
CFLAGS += -DWIIU -DMSB_FIRST
|
||||||
CFLAGS += -DHAVE_MAIN
|
CFLAGS += -DHAVE_MAIN
|
||||||
CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE -DSINC_LOWEST_QUALITY
|
CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE -DSINC_LOWEST_QUALITY
|
||||||
CFLAGS += -DHAVE_FILTERS_BUILTIN $(DEFINES)
|
CFLAGS += -DHAVE_FILTERS_BUILTIN $(DEFINES)
|
||||||
|
@ -37,6 +37,9 @@ static frontend_ctx_driver_t *frontend_ctx_drivers[] = {
|
|||||||
#if defined(GEKKO)
|
#if defined(GEKKO)
|
||||||
&frontend_ctx_gx,
|
&frontend_ctx_gx,
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(WIIU)
|
||||||
|
&frontend_ctx_wiiu,
|
||||||
|
#endif
|
||||||
#if defined(__QNX__)
|
#if defined(__QNX__)
|
||||||
&frontend_ctx_qnx,
|
&frontend_ctx_qnx,
|
||||||
#endif
|
#endif
|
||||||
|
@ -92,6 +92,7 @@ typedef struct frontend_ctx_driver
|
|||||||
} frontend_ctx_driver_t;
|
} frontend_ctx_driver_t;
|
||||||
|
|
||||||
extern frontend_ctx_driver_t frontend_ctx_gx;
|
extern frontend_ctx_driver_t frontend_ctx_gx;
|
||||||
|
extern frontend_ctx_driver_t frontend_ctx_wiiu;
|
||||||
extern frontend_ctx_driver_t frontend_ctx_ps3;
|
extern frontend_ctx_driver_t frontend_ctx_ps3;
|
||||||
extern frontend_ctx_driver_t frontend_ctx_xdk;
|
extern frontend_ctx_driver_t frontend_ctx_xdk;
|
||||||
extern frontend_ctx_driver_t frontend_ctx_qnx;
|
extern frontend_ctx_driver_t frontend_ctx_qnx;
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
|
||||||
#include "dynamic_libs/vpad_functions.h"
|
#include "dynamic_libs/vpad_functions.h"
|
||||||
|
#include "wiiu_dbg.h"
|
||||||
|
|
||||||
#ifndef MAX_PADS
|
#ifndef MAX_PADS
|
||||||
#define MAX_PADS 1
|
#define MAX_PADS 1
|
||||||
|
@ -48,15 +48,22 @@ extern void *(* MEMDestroyExpHeap)(int heap);
|
|||||||
extern void (* MEMFreeToExpHeap)(int heap, void* ptr);
|
extern void (* MEMFreeToExpHeap)(int heap, void* ptr);
|
||||||
|
|
||||||
static int mem1_heap = -1;
|
static int mem1_heap = -1;
|
||||||
|
static int mem2_heap = -1;
|
||||||
static int bucket_heap = -1;
|
static int bucket_heap = -1;
|
||||||
|
|
||||||
void memoryInitialize(void)
|
void memoryInitialize(void)
|
||||||
{
|
{
|
||||||
int mem1_heap_handle = MEMGetBaseHeapHandle(MEMORY_ARENA_1);
|
int mem1_heap_handle = MEMGetBaseHeapHandle(MEMORY_ARENA_1);
|
||||||
unsigned int mem1_allocatable_size = MEMGetAllocatableSizeForFrmHeapEx(mem1_heap_handle, 4);
|
unsigned int mem1_allocatable_size = MEMGetAllocatableSizeForFrmHeapEx(mem1_heap_handle, 4);
|
||||||
void *mem1_memory = MEMAllocFromFrmHeapEx(mem1_heap_handle, mem1_allocatable_size, 4);
|
void *mem1_memory = MEMAllocFromFrmHeapEx(mem1_heap_handle, mem1_allocatable_size, 4);
|
||||||
if(mem1_memory)
|
if(mem1_memory)
|
||||||
mem1_heap = MEMCreateExpHeapEx(mem1_memory, mem1_allocatable_size, 0);
|
mem1_heap = MEMCreateExpHeapEx(mem1_memory, mem1_allocatable_size, 0);
|
||||||
|
|
||||||
|
int mem2_heap_handle = MEMGetBaseHeapHandle(MEMORY_ARENA_2);
|
||||||
|
unsigned int mem2_allocatable_size = MEMGetAllocatableSizeForFrmHeapEx(mem2_heap_handle, 4);
|
||||||
|
void *mem2_memory = MEMAllocFromFrmHeapEx(mem2_heap_handle, mem2_allocatable_size, 4);
|
||||||
|
if(mem2_memory)
|
||||||
|
mem1_heap = MEMCreateExpHeapEx(mem2_memory, mem2_allocatable_size, 0);
|
||||||
|
|
||||||
int bucket_heap_handle = MEMGetBaseHeapHandle(MEMORY_ARENA_FG_BUCKET);
|
int bucket_heap_handle = MEMGetBaseHeapHandle(MEMORY_ARENA_FG_BUCKET);
|
||||||
unsigned int bucket_allocatable_size = MEMGetAllocatableSizeForFrmHeapEx(bucket_heap_handle, 4);
|
unsigned int bucket_allocatable_size = MEMGetAllocatableSizeForFrmHeapEx(bucket_heap_handle, 4);
|
||||||
@ -67,9 +74,13 @@ void memoryInitialize(void)
|
|||||||
|
|
||||||
void memoryRelease(void)
|
void memoryRelease(void)
|
||||||
{
|
{
|
||||||
MEMDestroyExpHeap(mem1_heap);
|
MEMDestroyExpHeap(mem1_heap);
|
||||||
MEMFreeToFrmHeap(MEMGetBaseHeapHandle(MEMORY_ARENA_1), 3);
|
MEMFreeToFrmHeap(MEMGetBaseHeapHandle(MEMORY_ARENA_1), 3);
|
||||||
mem1_heap = -1;
|
mem1_heap = -1;
|
||||||
|
|
||||||
|
MEMDestroyExpHeap(mem2_heap);
|
||||||
|
MEMFreeToFrmHeap(MEMGetBaseHeapHandle(MEMORY_ARENA_2), 3);
|
||||||
|
mem1_heap = -1;
|
||||||
|
|
||||||
MEMDestroyExpHeap(bucket_heap);
|
MEMDestroyExpHeap(bucket_heap);
|
||||||
MEMFreeToFrmHeap(MEMGetBaseHeapHandle(MEMORY_ARENA_FG_BUCKET), 3);
|
MEMFreeToFrmHeap(MEMGetBaseHeapHandle(MEMORY_ARENA_FG_BUCKET), 3);
|
||||||
@ -82,6 +93,8 @@ void memoryRelease(void)
|
|||||||
void *__wrap_malloc(size_t size)
|
void *__wrap_malloc(size_t size)
|
||||||
{
|
{
|
||||||
// pointer to a function resolve
|
// pointer to a function resolve
|
||||||
|
if(!size)
|
||||||
|
return NULL;
|
||||||
return ((void * (*)(size_t))(*pMEMAllocFromDefaultHeap))(size);
|
return ((void * (*)(size_t))(*pMEMAllocFromDefaultHeap))(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,6 +103,8 @@ void *__wrap_memalign(size_t align, size_t size)
|
|||||||
if (align < 4)
|
if (align < 4)
|
||||||
align = 4;
|
align = 4;
|
||||||
|
|
||||||
|
if(!size)
|
||||||
|
return NULL;
|
||||||
// pointer to a function resolve
|
// pointer to a function resolve
|
||||||
return ((void * (*)(size_t, size_t))(*pMEMAllocFromDefaultHeapEx))(size, align);
|
return ((void * (*)(size_t, size_t))(*pMEMAllocFromDefaultHeapEx))(size, align);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user