Merge pull request #9512 from rsn8887/master

[SWITCH] Fix Switch build
This commit is contained in:
Twinaphex 2019-09-25 00:20:30 +02:00 committed by GitHub
commit fdf3a07b15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,6 +15,7 @@
#include "../../switch_performance_profiles.h" #include "../../switch_performance_profiles.h"
#include "../../configuration.h" #include "../../configuration.h"
#include <unistd.h> #include <unistd.h>
#include <malloc.h>
#else #else
#include <libtransistor/nx.h> #include <libtransistor/nx.h>
#include <libtransistor/ipc_helpers.h> #include <libtransistor/ipc_helpers.h>
@ -55,8 +56,6 @@
static enum frontend_fork switch_fork_mode = FRONTEND_FORK_NONE; static enum frontend_fork switch_fork_mode = FRONTEND_FORK_NONE;
static const char *elf_path_cst = "/switch/retroarch_switch.nro"; static const char *elf_path_cst = "/switch/retroarch_switch.nro";
static uint64_t frontend_switch_get_mem_used(void);
bool platform_switch_has_focus = true; bool platform_switch_has_focus = true;
#ifdef HAVE_LIBNX #ifdef HAVE_LIBNX
@ -818,21 +817,16 @@ static int frontend_switch_parse_drive_list(void *data, bool load_content)
static uint64_t frontend_switch_get_mem_free(void) static uint64_t frontend_switch_get_mem_free(void)
{ {
/* TODO/FIXME - should become 'free memory' */ struct mallinfo mem_info = mallinfo();
uint64_t memoryUsed = 0; return mem_info.fordblks;
svcGetInfo(&memoryUsed, 7, 0xffff8001, 0);
return memoryUsed;
} }
static uint64_t frontend_switch_get_mem_total(void) static uint64_t frontend_switch_get_mem_total(void)
{ {
uint64_t memoryTotal = 0; struct mallinfo mem_info = mallinfo();
svcGetInfo(&memoryTotal, 6, 0xffff8001, 0); return mem_info.usmblks;
return memoryTotal;
} }
static enum frontend_powerstate static enum frontend_powerstate
frontend_switch_get_powerstate(int *seconds, int *percent) frontend_switch_get_powerstate(int *seconds, int *percent)
{ {
@ -962,7 +956,7 @@ frontend_ctx_driver_t frontend_ctx_switch =
frontend_switch_get_powerstate, frontend_switch_get_powerstate,
frontend_switch_parse_drive_list, frontend_switch_parse_drive_list,
frontend_switch_get_mem_total, frontend_switch_get_mem_total,
frontend_switch_get_mem_used, frontend_switch_get_mem_free,
NULL, /* install_signal_handler */ NULL, /* install_signal_handler */
NULL, /* get_signal_handler_state */ NULL, /* get_signal_handler_state */
NULL, /* set_signal_handler_state */ NULL, /* set_signal_handler_state */