mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 21:32:45 +00:00
Merge pull request #9552 from Rinnegatamante/mem
[VITA] Memory related improvements
This commit is contained in:
commit
bf95fa34da
@ -158,7 +158,7 @@ $(TARGET).elf: $(OBJ) libretro_vita.a
|
||||
vita-make-fself -c -s $< $@
|
||||
|
||||
%.vpk: %.self
|
||||
vita-mksfoex -s TITLE_ID=$(VITA_TITLE_ID) "$(VITA_TITLE_NAME)" param.sfo
|
||||
vita-mksfoex -s TITLE_ID=$(VITA_TITLE_ID) "$(VITA_TITLE_NAME)" -d ATTRIBUTE2=12 param.sfo
|
||||
vita-pack-vpk -s param.sfo -b $< $@
|
||||
|
||||
clean:
|
||||
|
@ -55,7 +55,7 @@ OBJS = frontend/frontend_salamander.o \
|
||||
all: $(TARGET).vpk
|
||||
|
||||
%.vpk: eboot.bin
|
||||
vita-mksfoex -s TITLE_ID=$(TITLE_ID) "$(TARGET)" param.sfo
|
||||
vita-mksfoex -s TITLE_ID=$(TITLE_ID) "$(TARGET)" -d ATTRIBUTE2=12 param.sfo
|
||||
vita-pack-vpk -s param.sfo -b eboot.bin $@
|
||||
|
||||
eboot.bin: $(TARGET).velf
|
||||
|
@ -4,9 +4,11 @@
|
||||
#include <psp2/kernel/sysmem.h>
|
||||
#include <psp2/kernel/threadmgr.h>
|
||||
|
||||
#define RAM_THRESHOLD 0xA00000 // Memory left to the system for threads and other internal stuffs
|
||||
|
||||
static int _newlib_heap_memblock;
|
||||
static unsigned _newlib_heap_size;
|
||||
static char *_newlib_heap_base, *_newlib_heap_end, *_newlib_heap_cur;
|
||||
char *_newlib_heap_base, *_newlib_heap_end, *_newlib_heap_cur;
|
||||
static char _newlib_sbrk_mutex[32] __attribute__ ((aligned (8)));
|
||||
|
||||
static int _newlib_vm_memblock;
|
||||
@ -50,11 +52,16 @@ void _init_vita_heap(void) {
|
||||
if (sceKernelCreateLwMutex((struct SceKernelLwMutexWork*)_newlib_sbrk_mutex, "sbrk mutex", 0, 0, 0) < 0) {
|
||||
goto failure;
|
||||
}
|
||||
|
||||
// Always allocating the max avaliable USER_RW mem on the system
|
||||
SceKernelFreeMemorySizeInfo info;
|
||||
info.size = sizeof(SceKernelFreeMemorySizeInfo);
|
||||
sceKernelGetFreeMemorySize(&info);
|
||||
|
||||
if (&_newlib_heap_size_user != NULL) {
|
||||
_newlib_heap_size = _newlib_heap_size_user;
|
||||
}else{
|
||||
_newlib_heap_size = 256 * 1024 * 1024;
|
||||
_newlib_heap_size = info.size_user - RAM_THRESHOLD;
|
||||
}
|
||||
|
||||
_newlib_heap_size -= _newlib_vm_size;
|
||||
|
@ -560,6 +560,16 @@ enum retro_language frontend_psp_get_user_language(void)
|
||||
sceAppUtilSystemParamGetInt(SCE_SYSTEM_PARAM_ID_LANG, &langid);
|
||||
return psp_get_retro_lang_from_langid(langid);
|
||||
}
|
||||
|
||||
static uint64_t frontend_psp_get_mem_total(void)
|
||||
{
|
||||
return _newlib_heap_end - _newlib_heap_base;
|
||||
}
|
||||
|
||||
static uint64_t frontend_psp_get_mem_used(void)
|
||||
{
|
||||
return _newlib_heap_end - _newlib_heap_cur;
|
||||
}
|
||||
#endif
|
||||
|
||||
frontend_ctx_driver_t frontend_ctx_psp = {
|
||||
@ -582,8 +592,13 @@ frontend_ctx_driver_t frontend_ctx_psp = {
|
||||
frontend_psp_get_architecture,
|
||||
frontend_psp_get_powerstate,
|
||||
frontend_psp_parse_drive_list,
|
||||
#ifdef VITA
|
||||
frontend_psp_get_mem_total,
|
||||
frontend_psp_get_mem_used,
|
||||
#else
|
||||
NULL, /* get_mem_total */
|
||||
NULL, /* get_mem_free */
|
||||
#endif
|
||||
NULL, /* install_signal_handler */
|
||||
NULL, /* get_sighandler_state */
|
||||
NULL, /* set_sighandler_state */
|
||||
|
Loading…
x
Reference in New Issue
Block a user