allocate gba_screen_pixels on the heap.

use linearMemAlign for the 3DS target.
This commit is contained in:
aliaspider 2015-04-13 02:43:42 +01:00
parent 5b6683bb93
commit 69b5bfc05e
3 changed files with 18 additions and 3 deletions

View File

@ -8,13 +8,17 @@
#include "libretro.h"
#include "memmap.h"
#if defined(_3DS) && defined(HAVE_DYNAREC)
#if defined(_3DS)
void* linearMemAlign(size_t size, size_t alignment);
void linearFree(void* mem);
#if defined(HAVE_DYNAREC)
int32_t hbInit(void);
void hbExit(void);
int32_t HB_FlushInvalidateCache(void);
int32_t HB_ReprotectMemory(void* addr, uint32_t pages, uint32_t mode, uint32_t* reprotectedPages);
int hb_service_available;
#endif
#endif
#ifndef MAX_PATH
#define MAX_PATH (512)
@ -126,6 +130,12 @@ void retro_init(void)
}
#endif
#ifdef _3DS
gba_screen_pixels = (uint16_t*)linearMemAlign(GBA_SCREEN_PITCH * GBA_SCREEN_HEIGHT * sizeof(uint16_t), 128);
#else
gba_screen_pixels = (uint16_t*)malloc(GBA_SCREEN_PITCH * GBA_SCREEN_HEIGHT * sizeof(uint16_t));
#endif
}
void retro_deinit(void)
@ -141,6 +151,11 @@ void retro_deinit(void)
#if defined(_3DS) && defined(HAVE_DYNAREC)
hbExit();
#endif
#ifdef _3DS
linearFree(gba_screen_pixels);
#else
free(gba_screen_pixels);
#endif
}
static retro_time_t retro_perf_dummy_get_time_usec() { return 0; }

View File

@ -19,7 +19,7 @@
#include "common.h"
u16 gba_screen_pixels[GBA_SCREEN_PITCH * GBA_SCREEN_HEIGHT];
u16* gba_screen_pixels;
#define get_screen_pixels() gba_screen_pixels
#define get_screen_pitch() GBA_SCREEN_PITCH

View File

@ -54,6 +54,6 @@ typedef enum
filter_bilinear
} video_filter_type;
extern u16 gba_screen_pixels[GBA_SCREEN_PITCH * GBA_SCREEN_HEIGHT];
extern u16* gba_screen_pixels;
#endif