RetroArch/frontend/drivers/platform_psp.c

631 lines
20 KiB
C
Raw Normal View History

/* RetroArch - A frontend for libretro.
2014-01-01 00:50:59 +00:00
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
2017-01-22 12:40:32 +00:00
* Copyright (C) 2011-2017 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
2015-09-01 10:10:26 +00:00
#include <stdint.h>
#include <stddef.h>
#include <string.h>
2016-09-12 14:39:50 +00:00
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
#ifdef VITA
2019-10-01 17:46:49 +00:00
#include <psp2/system_param.h>
#include <psp2/power.h>
2016-07-31 07:59:53 +00:00
#include <psp2/sysmodule.h>
2016-09-07 23:25:14 +00:00
#include <psp2/appmgr.h>
2019-10-01 17:46:49 +00:00
#include <psp2/apputil.h>
#include "../../bootstrap/vita/sbrk.c"
2017-04-05 17:35:45 +00:00
#include "../../bootstrap/vita/threading.c"
#else
#include <pspkernel.h>
#include <pspdebug.h>
2014-02-17 13:26:03 +00:00
#include <pspfpu.h>
#include <psppower.h>
#include <pspsdk.h>
#endif
2017-12-26 08:45:45 +00:00
#include <pthread.h>
2017-01-17 17:12:23 +00:00
#include <string/stdstring.h>
2015-09-15 02:49:10 +00:00
#include <boolean.h>
2014-10-21 22:23:06 +00:00
#include <file/file_path.h>
2015-06-15 20:45:02 +00:00
#ifndef IS_SALAMANDER
#include <lists/file_list.h>
2015-06-15 20:45:02 +00:00
#endif
2017-01-17 17:55:59 +00:00
#ifdef HAVE_MENU
#include "../../menu/menu_driver.h"
#endif
#include "../frontend_driver.h"
#include "../../defaults.h"
2016-06-20 15:49:20 +00:00
#include "../../file_path_special.h"
#include "../../defines/psp_defines.h"
2017-01-17 17:55:59 +00:00
#include "../../retroarch.h"
#include "../../paths.h"
2015-11-23 11:03:38 +00:00
#include "../../verbosity.h"
#if defined(HAVE_KERNEL_PRX) || defined(IS_SALAMANDER)
#ifndef VITA
2015-09-20 13:33:54 +00:00
#include "../../bootstrap/psp1/kernel_functions.h"
#endif
#endif
2017-01-17 10:43:12 +00:00
#ifndef VITA
2015-08-12 10:33:27 +00:00
PSP_MODULE_INFO("RetroArch", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER|THREAD_ATTR_VFPU);
#ifdef BIG_STACK
PSP_MAIN_THREAD_STACK_SIZE_KB(4*1024);
#endif
PSP_HEAP_SIZE_MAX();
#endif
char eboot_path[512];
2016-09-04 06:55:22 +00:00
char user_path[512];
2016-02-05 17:43:23 +00:00
static enum frontend_fork psp_fork_mode = FRONTEND_FORK_NONE;
static void frontend_psp_get_environment_settings(int *argc, char *argv[],
void *args, void *params_data)
{
unsigned i;
struct rarch_main_wrap *params = NULL;
2014-02-11 15:10:40 +00:00
(void)args;
#ifdef VITA
2016-10-10 09:43:05 +00:00
strlcpy(eboot_path, "app0:/", sizeof(eboot_path));
strlcpy(g_defaults.dirs[DEFAULT_DIR_PORT], eboot_path, sizeof(g_defaults.dirs[DEFAULT_DIR_PORT]));
2016-10-10 09:43:05 +00:00
strlcpy(user_path, "ux0:/data/retroarch/", sizeof(user_path));
#else
strlcpy(eboot_path, argv[0], sizeof(eboot_path));
2016-09-04 17:18:27 +00:00
/* for PSP, use uppercase directories, and no trailing slashes
otherwise mkdir fails */
strlcpy(user_path, "ms0:/PSP/RETROARCH", sizeof(user_path));
fill_pathname_basedir(g_defaults.dirs[DEFAULT_DIR_PORT], argv[0], sizeof(g_defaults.dirs[DEFAULT_DIR_PORT]));
#endif
RARCH_LOG("port dir: [%s]\n", g_defaults.dirs[DEFAULT_DIR_PORT]);
2016-09-04 07:19:16 +00:00
2016-09-04 06:55:22 +00:00
#ifdef VITA
2016-09-04 07:19:16 +00:00
/* bundle data*/
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], g_defaults.dirs[DEFAULT_DIR_PORT],
"", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
2017-11-14 18:49:50 +00:00
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], g_defaults.dirs[DEFAULT_DIR_PORT],
"info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
2017-11-14 18:49:50 +00:00
/* user data*/
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS], user_path,
"assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_DATABASE], user_path,
"database/rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE]));
2017-11-14 18:49:50 +00:00
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CURSOR], user_path,
"database/cursors", sizeof(g_defaults.dirs[DEFAULT_DIR_CURSOR]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CHEATS], user_path,
"cheats", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG], user_path,
"config", sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS], user_path,
"downloads", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
2017-05-23 19:16:03 +00:00
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_PLAYLIST], user_path,
"playlists", sizeof(g_defaults.dirs[DEFAULT_DIR_PLAYLIST]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_REMAP], user_path,
"remaps", sizeof(g_defaults.dirs[DEFAULT_DIR_REMAP]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SRAM], user_path,
"savefiles", sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SAVESTATE], user_path,
"savestates", sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SYSTEM], user_path,
"system", sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CACHE], user_path,
"temp", sizeof(g_defaults.dirs[DEFAULT_DIR_CACHE]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], user_path,
"overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
2019-04-16 16:41:06 +00:00
#ifdef HAVE_VIDEO_LAYOUT
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT], user_path,
"layouts", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT]));
#endif
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS], user_path,
"thumbnails", sizeof(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_LOGS], user_path,
"logs", sizeof(g_defaults.dirs[DEFAULT_DIR_LOGS]));
strlcpy(g_defaults.dirs[DEFAULT_DIR_CONTENT_HISTORY],
user_path, sizeof(g_defaults.dirs[DEFAULT_DIR_CONTENT_HISTORY]));
2016-10-10 09:43:05 +00:00
fill_pathname_join(g_defaults.path.config, user_path,
2016-09-04 17:18:27 +00:00
file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config));
2016-09-04 04:58:37 +00:00
#else
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], g_defaults.dirs[DEFAULT_DIR_PORT],
"CORES", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], g_defaults.dirs[DEFAULT_DIR_PORT],
"INFO", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
2016-09-04 07:19:16 +00:00
/* user data */
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CHEATS], user_path,
"CHEATS", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG], user_path,
"CONFIG", sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS], user_path,
"DOWNLOADS", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
2017-05-23 19:16:03 +00:00
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_PLAYLIST], user_path,
"PLAYLISTS", sizeof(g_defaults.dirs[DEFAULT_DIR_PLAYLIST]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_REMAP], g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG],
"REMAPS", sizeof(g_defaults.dirs[DEFAULT_DIR_REMAP]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SRAM], user_path,
"SAVEFILES", sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SAVESTATE], user_path,
"SAVESTATES", sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT], user_path,
"SCREENSHOTS", sizeof(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SYSTEM], user_path,
"SYSTEM", sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_LOGS], user_path,
"LOGS", sizeof(g_defaults.dirs[DEFAULT_DIR_LOGS]));
/* cache dir */
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CACHE], user_path,
"TEMP", sizeof(g_defaults.dirs[DEFAULT_DIR_CACHE]));
/* history and main config */
strlcpy(g_defaults.dirs[DEFAULT_DIR_CONTENT_HISTORY],
user_path, sizeof(g_defaults.dirs[DEFAULT_DIR_CONTENT_HISTORY]));
2016-09-04 17:18:27 +00:00
fill_pathname_join(g_defaults.path.config, user_path,
file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config));
#endif
2016-09-07 23:25:14 +00:00
#ifndef IS_SALAMANDER
#ifdef VITA
2016-09-08 14:18:30 +00:00
params = (struct rarch_main_wrap*)params_data;
params->verbose = true;
#endif
2015-12-26 06:45:19 +00:00
if (!string_is_empty(argv[1]))
{
2016-09-08 14:18:30 +00:00
static char path[PATH_MAX_LENGTH] = {0};
2016-10-10 09:43:05 +00:00
struct rarch_main_wrap *args =
2016-09-08 14:18:30 +00:00
(struct rarch_main_wrap*)params_data;
if (args)
{
strlcpy(path, argv[1], sizeof(path));
args->touched = true;
args->no_content = false;
args->verbose = false;
args->config_path = NULL;
args->sram_path = NULL;
args->state_path = NULL;
args->content_path = path;
args->libretro_path = NULL;
RARCH_LOG("argv[0]: %s\n", argv[0]);
RARCH_LOG("argv[1]: %s\n", argv[1]);
RARCH_LOG("argv[2]: %s\n", argv[2]);
RARCH_LOG("Auto-start game %s.\n", argv[1]);
}
}
#endif
for (i = 0; i < DEFAULT_DIR_LAST; i++)
{
const char *dir_path = g_defaults.dirs[i];
if (!string_is_empty(dir_path))
2017-05-23 18:45:14 +00:00
path_mkdir(dir_path);
}
}
static void frontend_psp_deinit(void *data)
{
(void)data;
#ifndef IS_SALAMANDER
2016-05-31 02:42:04 +00:00
verbosity_disable();
pthread_terminate();
#endif
}
static void frontend_psp_shutdown(bool unused)
{
(void)unused;
#ifdef VITA
2016-09-07 23:25:14 +00:00
//sceKernelExitProcess(0);
return;
#else
sceKernelExitGame();
#endif
}
#ifndef VITA
static int exit_callback(int arg1, int arg2, void *common)
{
frontend_psp_deinit(NULL);
frontend_psp_shutdown(false);
return 0;
}
2015-04-09 03:53:58 +00:00
static int callback_thread(SceSize args, void *argp)
{
int cbid = sceKernelCreateCallback("Exit callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
static int setup_callback(void)
{
2014-09-02 15:42:44 +00:00
int thread_id = sceKernelCreateThread("update_thread",
callback_thread, 0x11, 0xFA0, 0, 0);
if (thread_id >= 0)
sceKernelStartThread(thread_id, 0, 0);
return thread_id;
}
#endif
static void frontend_psp_init(void *data)
{
#ifndef IS_SALAMANDER
2015-08-12 17:30:30 +00:00
#ifdef VITA
scePowerSetArmClockFrequency(444);
2018-08-02 17:19:16 +00:00
scePowerSetBusClockFrequency(222);
scePowerSetGpuClockFrequency(222);
scePowerSetGpuXbarClockFrequency(166);
sceSysmoduleLoadModule(SCE_SYSMODULE_NET);
2019-10-01 17:46:49 +00:00
SceAppUtilInitParam appUtilParam;
SceAppUtilBootParam appUtilBootParam;
memset(&appUtilParam, 0, sizeof(SceAppUtilInitParam));
memset(&appUtilBootParam, 0, sizeof(SceAppUtilBootParam));
sceAppUtilInit(&appUtilParam, &appUtilBootParam);
#else
(void)data;
2015-08-10 21:29:50 +00:00
/* initialize debug screen */
pspDebugScreenInit();
pspDebugScreenClear();
setup_callback();
2015-08-10 21:29:50 +00:00
pspFpuSetEnable(0); /* disable FPU exceptions */
scePowerSetClockFrequency(333,333,166);
#endif
2017-12-26 08:45:45 +00:00
pthread_init();
#endif
#if defined(HAVE_KERNEL_PRX) || defined(IS_SALAMANDER)
#ifndef VITA
pspSdkLoadStartModule("kernel_functions.prx", PSP_MEMORY_PARTITION_KERNEL);
2014-06-04 00:52:29 +00:00
#endif
#endif
}
static void frontend_psp_exec(const char *path, bool should_load_game)
{
2016-09-07 23:25:14 +00:00
#if defined(HAVE_KERNEL_PRX) || defined(IS_SALAMANDER) || defined(VITA)
2015-06-12 21:38:46 +00:00
char argp[512] = {0};
2020-06-08 19:28:39 +00:00
char boot_params[1024];
char core_name[256];
2015-06-12 21:38:46 +00:00
SceSize args = 0;
2016-10-07 06:24:27 +00:00
#if !defined(VITA)
strlcpy(argp, eboot_path, sizeof(argp));
args = strlen(argp) + 1;
2016-10-07 06:24:27 +00:00
#endif
#ifndef IS_SALAMANDER
2016-10-03 13:43:03 +00:00
if (should_load_game && !path_is_empty(RARCH_PATH_CONTENT))
{
argp[args] = '\0';
2016-10-03 13:43:03 +00:00
strlcat(argp + args, path_get(RARCH_PATH_CONTENT), sizeof(argp) - args);
args += strlen(argp + args) + 1;
}
#endif
RARCH_LOG("Attempt to load executable: [%s].\n", path);
2016-09-07 23:25:14 +00:00
#if defined(VITA)
2016-10-07 06:24:27 +00:00
RARCH_LOG("Attempt to load executable: %d [%s].\n", args, argp);
2020-06-08 19:28:39 +00:00
#ifdef IS_SALAMANDER
sceAppMgrGetAppParam(boot_params);
if (strstr(boot_params,"psgm:play")) {
char *param1 = strstr(boot_params, "&param=")+7;
char *param2 = strstr(boot_params, "&param2=");
memcpy(core_name, param1, param2 - param1);
core_name[param2-param1] = 0;
sprintf(argp, param2 + 8);
int ret = sceAppMgrLoadExec(core_name, (char * const*)((const char*[]){argp, 0}), NULL);
RARCH_LOG("Attempt to load executable: [%d].\n", ret);
}
else
#endif
{
int ret = sceAppMgrLoadExec(path, args == 0 ? NULL : (char * const*)((const char*[]){argp, 0}), NULL);
RARCH_LOG("Attempt to load executable: [%d].\n", ret);
}
2016-09-07 23:25:14 +00:00
#else
exitspawn_kernel(path, args, argp);
2016-09-07 23:25:14 +00:00
#endif
#endif
}
2016-02-05 17:43:23 +00:00
#ifndef IS_SALAMANDER
2016-02-04 16:46:50 +00:00
static bool frontend_psp_set_fork(enum frontend_fork fork_mode)
{
2016-02-04 16:46:50 +00:00
switch (fork_mode)
{
case FRONTEND_FORK_CORE:
2016-02-05 17:43:23 +00:00
RARCH_LOG("FRONTEND_FORK_CORE\n");
psp_fork_mode = fork_mode;
2016-02-04 16:46:50 +00:00
break;
case FRONTEND_FORK_CORE_WITH_ARGS:
2016-02-05 17:43:23 +00:00
RARCH_LOG("FRONTEND_FORK_CORE_WITH_ARGS\n");
psp_fork_mode = fork_mode;
2016-02-04 16:46:50 +00:00
break;
case FRONTEND_FORK_RESTART:
RARCH_LOG("FRONTEND_FORK_RESTART\n");
2016-02-05 17:43:23 +00:00
/* NOTE: We don't implement Salamander, so just turn
* this into FRONTEND_FORK_CORE. */
psp_fork_mode = FRONTEND_FORK_CORE;
break;
2016-02-04 16:46:50 +00:00
case FRONTEND_FORK_NONE:
default:
return false;
}
return true;
}
2016-02-05 17:43:23 +00:00
#endif
static void frontend_psp_exitspawn(char *s, size_t len, char *args)
{
bool should_load_content = false;
2014-06-05 04:36:30 +00:00
#ifndef IS_SALAMANDER
2016-02-05 17:43:23 +00:00
if (psp_fork_mode == FRONTEND_FORK_NONE)
return;
2016-02-05 17:43:23 +00:00
switch (psp_fork_mode)
{
case FRONTEND_FORK_CORE_WITH_ARGS:
should_load_content = true;
2016-02-05 17:43:23 +00:00
break;
case FRONTEND_FORK_NONE:
default:
break;
}
#endif
frontend_psp_exec(s, should_load_content);
}
static int frontend_psp_get_rating(void)
{
#ifdef VITA
return 6; /* Go with a conservative figure for now. */
#else
return 4;
#endif
}
2015-04-18 13:28:06 +00:00
static enum frontend_powerstate frontend_psp_get_powerstate(int *seconds, int *percent)
{
enum frontend_powerstate ret = FRONTEND_POWERSTATE_NONE;
#ifndef VITA
int battery = scePowerIsBatteryExist();
#endif
2015-04-18 13:28:06 +00:00
int plugged = scePowerIsPowerOnline();
int charging = scePowerIsBatteryCharging();
*percent = scePowerGetBatteryLifePercent();
*seconds = scePowerGetBatteryLifeTime() * 60;
#ifndef VITA
2015-04-18 13:28:06 +00:00
if (!battery)
{
ret = FRONTEND_POWERSTATE_NO_SOURCE;
*seconds = -1;
*percent = -1;
}
2015-08-12 10:33:27 +00:00
else
#endif
2015-08-12 10:33:27 +00:00
if (charging)
2015-04-18 13:28:06 +00:00
ret = FRONTEND_POWERSTATE_CHARGING;
else if (plugged)
ret = FRONTEND_POWERSTATE_CHARGED;
else
ret = FRONTEND_POWERSTATE_ON_POWER_SOURCE;
return ret;
}
enum frontend_architecture frontend_psp_get_architecture(void)
{
#ifdef VITA
2016-05-18 20:09:01 +00:00
return FRONTEND_ARCH_ARMV7;
#else
return FRONTEND_ARCH_MIPS;
#endif
}
static int frontend_psp_parse_drive_list(void *data, bool load_content)
2015-06-15 20:45:02 +00:00
{
#ifndef IS_SALAMANDER
file_list_t *list = (file_list_t*)data;
enum msg_hash_enums enum_idx = load_content ?
MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR :
MENU_ENUM_LABEL_FILE_BROWSER_DIRECTORY;
2015-06-15 20:45:02 +00:00
#ifdef VITA
2016-10-15 10:54:31 +00:00
menu_entries_append_enum(list,
2016-12-13 00:43:18 +00:00
"app0:/",
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
enum_idx,
FILE_TYPE_DIRECTORY, 0, 0);
2016-08-02 23:15:06 +00:00
menu_entries_append_enum(list,
2016-12-13 00:43:18 +00:00
"ur0:/",
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
enum_idx,
FILE_TYPE_DIRECTORY, 0, 0);
menu_entries_append_enum(list,
2016-12-13 00:43:18 +00:00
"ux0:/",
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
enum_idx,
FILE_TYPE_DIRECTORY, 0, 0);
menu_entries_append_enum(list,
"uma0:/",
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
enum_idx,
FILE_TYPE_DIRECTORY, 0, 0);
menu_entries_append_enum(list,
"imc0:/",
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
enum_idx,
FILE_TYPE_DIRECTORY, 0, 0);
#else
menu_entries_append_enum(list,
2016-12-13 00:43:18 +00:00
"ms0:/",
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
enum_idx,
FILE_TYPE_DIRECTORY, 0, 0);
menu_entries_append_enum(list,
2016-12-13 00:43:18 +00:00
"ef0:/",
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
enum_idx,
FILE_TYPE_DIRECTORY, 0, 0);
menu_entries_append_enum(list,
2016-12-13 00:43:18 +00:00
"host0:/",
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
enum_idx,
FILE_TYPE_DIRECTORY, 0, 0);
#endif
2015-06-15 20:45:02 +00:00
#endif
return 0;
}
2019-10-01 17:46:49 +00:00
#ifdef VITA
enum retro_language psp_get_retro_lang_from_langid(int langid)
{
switch (langid)
{
case SCE_SYSTEM_PARAM_LANG_JAPANESE:
return RETRO_LANGUAGE_JAPANESE;
case SCE_SYSTEM_PARAM_LANG_FRENCH:
return RETRO_LANGUAGE_FRENCH;
case SCE_SYSTEM_PARAM_LANG_SPANISH:
return RETRO_LANGUAGE_SPANISH;
case SCE_SYSTEM_PARAM_LANG_GERMAN:
return RETRO_LANGUAGE_GERMAN;
case SCE_SYSTEM_PARAM_LANG_ITALIAN:
return RETRO_LANGUAGE_ITALIAN;
case SCE_SYSTEM_PARAM_LANG_DUTCH:
return RETRO_LANGUAGE_DUTCH;
case SCE_SYSTEM_PARAM_LANG_PORTUGUESE_PT:
return RETRO_LANGUAGE_PORTUGUESE_PORTUGAL;
case SCE_SYSTEM_PARAM_LANG_RUSSIAN:
return RETRO_LANGUAGE_RUSSIAN;
case SCE_SYSTEM_PARAM_LANG_KOREAN:
return RETRO_LANGUAGE_KOREAN;
case SCE_SYSTEM_PARAM_LANG_CHINESE_T:
return RETRO_LANGUAGE_CHINESE_TRADITIONAL;
case SCE_SYSTEM_PARAM_LANG_CHINESE_S:
return RETRO_LANGUAGE_CHINESE_SIMPLIFIED;
case SCE_SYSTEM_PARAM_LANG_POLISH:
return RETRO_LANGUAGE_POLISH;
case SCE_SYSTEM_PARAM_LANG_PORTUGUESE_BR:
return RETRO_LANGUAGE_PORTUGUESE_BRAZIL;
case SCE_SYSTEM_PARAM_LANG_TURKISH:
return RETRO_LANGUAGE_TURKISH;
2020-05-24 04:47:04 +00:00
#if 0
/* TODO/FIXME - this doesn't seem to actually exist */
case SCE_SYSTEM_PARAM_LANG_SLOVAK:
return RETRO_LANGUAGE_SLOVAK;
2020-05-24 04:47:04 +00:00
#endif
2019-10-01 17:46:49 +00:00
case SCE_SYSTEM_PARAM_LANG_ENGLISH_US:
case SCE_SYSTEM_PARAM_LANG_ENGLISH_GB:
default:
return RETRO_LANGUAGE_ENGLISH;
}
}
enum retro_language frontend_psp_get_user_language(void)
{
2019-10-01 17:46:49 +00:00
int langid;
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;
}
2019-10-01 17:46:49 +00:00
#endif
frontend_ctx_driver_t frontend_ctx_psp = {
2015-04-18 13:28:06 +00:00
frontend_psp_get_environment_settings,
frontend_psp_init,
frontend_psp_deinit,
frontend_psp_exitspawn,
2014-06-03 17:21:49 +00:00
NULL, /* process_args */
2015-04-18 13:28:06 +00:00
frontend_psp_exec,
2016-02-05 17:43:23 +00:00
#ifdef IS_SALAMANDER
NULL,
#else
2015-04-18 13:28:06 +00:00
frontend_psp_set_fork,
2016-02-05 17:43:23 +00:00
#endif
2015-04-18 13:28:06 +00:00
frontend_psp_shutdown,
NULL, /* get_name */
NULL, /* get_os */
2015-04-18 13:28:06 +00:00
frontend_psp_get_rating,
NULL, /* load_content */
frontend_psp_get_architecture,
2015-04-18 13:28:06 +00:00
frontend_psp_get_powerstate,
2015-06-15 20:45:02 +00:00
frontend_psp_parse_drive_list,
#ifdef VITA
frontend_psp_get_mem_total,
frontend_psp_get_mem_used,
#else
2016-06-12 00:33:07 +00:00
NULL, /* get_mem_total */
2016-06-12 10:44:28 +00:00
NULL, /* get_mem_free */
#endif
2016-07-08 00:10:40 +00:00
NULL, /* install_signal_handler */
2016-07-08 00:20:42 +00:00
NULL, /* get_sighandler_state */
2016-07-08 10:48:01 +00:00
NULL, /* set_sighandler_state */
2016-07-08 00:24:56 +00:00
NULL, /* destroy_sighandler_state */
NULL, /* attach_console */
NULL, /* detach_console */
NULL, /* watch_path_for_changes */
NULL, /* check_for_path_changes */
NULL, /* set_sustained_performance_mode */
NULL, /* get_cpu_model_name */
#ifdef VITA
2019-10-01 17:46:49 +00:00
frontend_psp_get_user_language,
NULL, /* is_narrator_running */
NULL, /* accessibility_speak */
"vita",
#else
2019-10-01 17:46:49 +00:00
NULL, /* get_user_language */
NULL, /* is_narrator_running */
NULL, /* accessibility_speak */
"psp",
#endif
};