mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-27 10:10:57 +00:00
PS2 usability fixes (#15861)
- Make sure logs are written before frontend deinit - Add memory stats - Add process_args to frontend to fix some cases when salamander cfg was not filled - Add a missing include in case someone wants to compile for PS2 with HAVE_THREADS
This commit is contained in:
parent
b43e1f3caf
commit
701d22d935
@ -416,6 +416,46 @@ enum frontend_architecture frontend_ps2_get_arch(void)
|
||||
return FRONTEND_ARCH_MIPS;
|
||||
}
|
||||
|
||||
static uint64_t frontend_ps2_get_total_mem(void) { return 32*1024*1024; }
|
||||
|
||||
/* Crude try-and-fail approach, in lack of a better solution. */
|
||||
static uint64_t frontend_ps2_get_free_mem(void)
|
||||
{
|
||||
uint64_t free_mem;
|
||||
size_t s0 = 32*1024*1024;
|
||||
void* p1;
|
||||
void* p2;
|
||||
void* p3;
|
||||
|
||||
while (s0 && (p1 = malloc(s0)) == NULL)
|
||||
s0 >>= 1;
|
||||
|
||||
free_mem = s0;
|
||||
|
||||
s0 = 32*1024*1024;
|
||||
|
||||
while (s0 && (p2 = malloc(s0)) == NULL)
|
||||
s0 >>= 1;
|
||||
|
||||
free_mem += s0;
|
||||
|
||||
s0 = 32*1024*1024;
|
||||
|
||||
while (s0 && (p3 = malloc(s0)) == NULL)
|
||||
s0 >>= 1;
|
||||
|
||||
free_mem += s0;
|
||||
|
||||
if (p1)
|
||||
free(p1);
|
||||
if (p2)
|
||||
free(p2);
|
||||
if (p3)
|
||||
free(p3);
|
||||
|
||||
return free_mem;
|
||||
}
|
||||
|
||||
static int frontend_ps2_parse_drive_list(void *data, bool load_content)
|
||||
{
|
||||
#ifndef IS_SALAMANDER
|
||||
@ -474,12 +514,23 @@ static int frontend_ps2_parse_drive_list(void *data, bool load_content)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void frontend_ps2_process_args(int *argc, char *argv[])
|
||||
{
|
||||
#ifndef IS_SALAMANDER
|
||||
/* Make sure active core path is set here. */
|
||||
char path[PATH_MAX_LENGTH] = {0};
|
||||
strlcpy(path, argv[0], sizeof(path));
|
||||
if (path_is_valid(path))
|
||||
path_set(RARCH_PATH_CORE, path);
|
||||
#endif
|
||||
}
|
||||
|
||||
frontend_ctx_driver_t frontend_ctx_ps2 = {
|
||||
frontend_ps2_get_env, /* get_env */
|
||||
frontend_ps2_init, /* init */
|
||||
frontend_ps2_deinit, /* deinit */
|
||||
frontend_ps2_exitspawn, /* exitspawn */
|
||||
NULL, /* process_args */
|
||||
frontend_ps2_process_args, /* process_args */
|
||||
frontend_ps2_exec, /* exec */
|
||||
#ifdef IS_SALAMANDER
|
||||
NULL, /* set_fork */
|
||||
@ -494,8 +545,8 @@ frontend_ctx_driver_t frontend_ctx_ps2 = {
|
||||
frontend_ps2_get_arch, /* get_architecture */
|
||||
NULL, /* get_powerstate */
|
||||
frontend_ps2_parse_drive_list,/* parse_drive_list */
|
||||
NULL, /* get_total_mem */
|
||||
NULL, /* get_free_mem */
|
||||
frontend_ps2_get_total_mem, /* get_total_mem */
|
||||
frontend_ps2_get_free_mem, /* get_free_mem */
|
||||
NULL, /* install_signal_handler */
|
||||
NULL, /* get_sighandler_state */
|
||||
NULL, /* set_sighandler_state */
|
||||
|
@ -60,6 +60,10 @@
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#if defined(PS2)
|
||||
#include <ps2sdkapi.h>
|
||||
#endif
|
||||
|
||||
#ifdef __MACH__
|
||||
#include <mach/clock.h>
|
||||
#include <mach/mach.h>
|
||||
|
@ -4811,7 +4811,11 @@ void main_exit(void *args)
|
||||
#if defined(HAVE_LOGGER) && !defined(ANDROID)
|
||||
logger_shutdown();
|
||||
#endif
|
||||
|
||||
#ifdef PS2
|
||||
/* PS2 frontend driver deinit also detaches filesystem,
|
||||
* so make sure logs are written in advance. */
|
||||
retro_main_log_file_deinit();
|
||||
#endif
|
||||
frontend_driver_deinit(args);
|
||||
frontend_driver_exitspawn(
|
||||
path_get_ptr(RARCH_PATH_CORE),
|
||||
|
Loading…
Reference in New Issue
Block a user