mirror of
https://github.com/libretro/RetroArch
synced 2025-02-13 12:40:47 +00:00
(GX) Salamander code baked into platform_gx.c - debloats things
This commit is contained in:
parent
5832f849f0
commit
0cd26b3623
@ -39,7 +39,7 @@ LIBS := -lfat -lwiiuse -logc -lbte
|
|||||||
|
|
||||||
APP_BOOTER_DIR = wii/app_booter
|
APP_BOOTER_DIR = wii/app_booter
|
||||||
|
|
||||||
OBJ = frontend/salamander/salamander_gx.o console/rarch_console_exec.o console/rarch_console_libretro_mgmt.o file_path.o compat/compat.o conf/config_file.o $(APP_BOOTER_DIR)/app_booter.binobj
|
OBJ = frontend/frontend_console.o console/rarch_console_exec.o console/rarch_console_libretro_mgmt.o file_path.o compat/compat.o conf/config_file.o $(APP_BOOTER_DIR)/app_booter.binobj
|
||||||
|
|
||||||
ifeq ($(HAVE_LOGGER), 1)
|
ifeq ($(HAVE_LOGGER), 1)
|
||||||
CFLAGS += -DHAVE_LOGGER
|
CFLAGS += -DHAVE_LOGGER
|
||||||
|
@ -91,6 +91,8 @@ typedef struct
|
|||||||
#endif
|
#endif
|
||||||
char cgp_dir[MAXIMUM_PATH];
|
char cgp_dir[MAXIMUM_PATH];
|
||||||
char core_dir[MAXIMUM_PATH];
|
char core_dir[MAXIMUM_PATH];
|
||||||
|
char config_path[MAXIMUM_PATH];
|
||||||
|
char libretro_path[MAXIMUM_PATH];
|
||||||
char executable_extension[MAXIMUM_PATH];
|
char executable_extension[MAXIMUM_PATH];
|
||||||
char filebrowser_startup_dir[MAXIMUM_PATH];
|
char filebrowser_startup_dir[MAXIMUM_PATH];
|
||||||
char filesystem_root_dir[MAXIMUM_PATH];
|
char filesystem_root_dir[MAXIMUM_PATH];
|
||||||
|
@ -31,6 +31,21 @@
|
|||||||
|
|
||||||
#undef main
|
#undef main
|
||||||
|
|
||||||
|
#ifdef IS_SALAMANDER
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
system_init();
|
||||||
|
get_environment_settings(argc, argv);
|
||||||
|
salamander_init_settings();
|
||||||
|
system_deinit();
|
||||||
|
system_exitspawn();
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
// Only called once on init and deinit.
|
// Only called once on init and deinit.
|
||||||
// Video and input drivers need to be active (owned)
|
// Video and input drivers need to be active (owned)
|
||||||
// before retroarch core starts.
|
// before retroarch core starts.
|
||||||
@ -174,3 +189,5 @@ begin_shutdown:
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -23,13 +23,19 @@
|
|||||||
#include "platform_inl.h"
|
#include "platform_inl.h"
|
||||||
|
|
||||||
#include "../../console/rgui/rgui.h"
|
#include "../../console/rgui/rgui.h"
|
||||||
#include "../../gfx/fonts/bitmap.h"
|
|
||||||
|
|
||||||
|
#ifndef IS_SALAMANDER
|
||||||
|
#include "../../gfx/fonts/bitmap.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "../../console/rarch_console.h"
|
||||||
#include "../../console/rarch_console_exec.h"
|
#include "../../console/rarch_console_exec.h"
|
||||||
|
#include "../../console/rarch_console_libretro_mgmt.h"
|
||||||
#include "../../console/rarch_console_input.h"
|
#include "../../console/rarch_console_input.h"
|
||||||
#include "../../console/rarch_console_settings.h"
|
#include "../../console/rarch_console_settings.h"
|
||||||
|
#include "../../file.h"
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#if defined(HW_RVL) && !defined(IS_SALAMANDER)
|
||||||
#include "../../wii/mem2_manager.h"
|
#include "../../wii/mem2_manager.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -53,6 +59,105 @@
|
|||||||
#include <sdcard/gcsd.h>
|
#include <sdcard/gcsd.h>
|
||||||
#include <fat.h>
|
#include <fat.h>
|
||||||
|
|
||||||
|
#define MAKE_FILE(x) {\
|
||||||
|
if (!path_file_exists((x)))\
|
||||||
|
{\
|
||||||
|
RARCH_WARN("File \"%s\" does not exists, creating\n", (x));\
|
||||||
|
FILE *f = fopen((x), "wb");\
|
||||||
|
if (!f)\
|
||||||
|
{\
|
||||||
|
RARCH_ERR("Could not create file \"%s\"\n", (x));\
|
||||||
|
}\
|
||||||
|
fclose(f);\
|
||||||
|
}\
|
||||||
|
}
|
||||||
|
|
||||||
|
#define MAKE_DIR(x) {\
|
||||||
|
if (!path_is_directory((x)))\
|
||||||
|
{\
|
||||||
|
RARCH_WARN("Directory \"%s\" does not exists, creating\n", (x));\
|
||||||
|
if (mkdir((x), 0777) != 0)\
|
||||||
|
{\
|
||||||
|
RARCH_ERR("Could not create directory \"%s\"\n", (x));\
|
||||||
|
}\
|
||||||
|
}\
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef IS_SALAMANDER
|
||||||
|
|
||||||
|
default_paths_t default_paths;
|
||||||
|
|
||||||
|
static void find_and_set_first_file(void)
|
||||||
|
{
|
||||||
|
//Last fallback - we'll need to start the first executable file
|
||||||
|
// we can find in the RetroArch cores directory
|
||||||
|
|
||||||
|
char first_file[512] = {0};
|
||||||
|
rarch_manage_libretro_set_first_file(first_file, sizeof(first_file),
|
||||||
|
default_paths.core_dir, "dol");
|
||||||
|
|
||||||
|
if(first_file[0])
|
||||||
|
strlcpy(default_paths.libretro_path, first_file, sizeof(default_paths.libretro_path));
|
||||||
|
else
|
||||||
|
RARCH_ERR("Failed last fallback - RetroArch Salamander will exit.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void salamander_init_settings(void)
|
||||||
|
{
|
||||||
|
char tmp_str[512] = {0};
|
||||||
|
bool config_file_exists;
|
||||||
|
|
||||||
|
if(!path_file_exists(default_paths.config_path))
|
||||||
|
{
|
||||||
|
FILE * f;
|
||||||
|
config_file_exists = false;
|
||||||
|
RARCH_ERR("Config file \"%s\" doesn't exist. Creating...\n", default_paths.config_path);
|
||||||
|
MAKE_DIR(default_paths.port_dir);
|
||||||
|
f = fopen(default_paths.config_path, "w");
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
config_file_exists = true;
|
||||||
|
|
||||||
|
//try to find CORE executable
|
||||||
|
char core_executable[1024];
|
||||||
|
snprintf(core_executable, sizeof(core_executable), "%s/CORE.dol", default_paths.core_dir);
|
||||||
|
|
||||||
|
if(path_file_exists(core_executable))
|
||||||
|
{
|
||||||
|
//Start CORE executable
|
||||||
|
snprintf(default_paths.libretro_path, sizeof(default_paths.libretro_path), core_executable);
|
||||||
|
RARCH_LOG("Start [%s].\n", default_paths.libretro_path);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(config_file_exists)
|
||||||
|
{
|
||||||
|
config_file_t * conf = config_file_new(default_paths.config_path);
|
||||||
|
config_get_array(conf, "libretro_path", tmp_str, sizeof(tmp_str));
|
||||||
|
config_file_free(conf);
|
||||||
|
snprintf(default_paths.libretro_path, sizeof(default_paths.libretro_path), tmp_str);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!config_file_exists || !strcmp(default_paths.libretro_path, ""))
|
||||||
|
find_and_set_first_file();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RARCH_LOG("Start [%s] found in retroarch.cfg.\n", default_paths.libretro_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!config_file_exists)
|
||||||
|
{
|
||||||
|
config_file_t *new_conf = config_file_new(NULL);
|
||||||
|
config_set_string(new_conf, "libretro_path", default_paths.libretro_path);
|
||||||
|
config_file_write(new_conf, default_paths.config_path);
|
||||||
|
config_file_free(new_conf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
GX_DEVICE_SD = 0,
|
GX_DEVICE_SD = 0,
|
||||||
@ -391,29 +496,8 @@ static void menu_free(void)
|
|||||||
rgui_free(rgui);
|
rgui_free(rgui);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAKE_FILE(x) {\
|
#endif
|
||||||
if (!path_file_exists((x)))\
|
|
||||||
{\
|
|
||||||
RARCH_WARN("File \"%s\" does not exists, creating\n", (x));\
|
|
||||||
FILE *f = fopen((x), "wb");\
|
|
||||||
if (!f)\
|
|
||||||
{\
|
|
||||||
RARCH_ERR("Could not create file \"%s\"\n", (x));\
|
|
||||||
}\
|
|
||||||
fclose(f);\
|
|
||||||
}\
|
|
||||||
}
|
|
||||||
|
|
||||||
#define MAKE_DIR(x) {\
|
|
||||||
if (!path_is_directory((x)))\
|
|
||||||
{\
|
|
||||||
RARCH_WARN("Directory \"%s\" does not exists, creating\n", (x));\
|
|
||||||
if (mkdir((x), 0777) != 0)\
|
|
||||||
{\
|
|
||||||
RARCH_ERR("Could not create directory \"%s\"\n", (x));\
|
|
||||||
}\
|
|
||||||
}\
|
|
||||||
}
|
|
||||||
|
|
||||||
static void get_environment_settings(int argc, char *argv[])
|
static void get_environment_settings(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -432,7 +516,11 @@ static void get_environment_settings(int argc, char *argv[])
|
|||||||
snprintf(default_paths.port_dir, sizeof(default_paths.port_dir), "%.*s/retroarch", device_end - default_paths.core_dir, default_paths.core_dir);
|
snprintf(default_paths.port_dir, sizeof(default_paths.port_dir), "%.*s/retroarch", device_end - default_paths.core_dir, default_paths.core_dir);
|
||||||
else
|
else
|
||||||
strlcpy(default_paths.port_dir, "/retroarch", sizeof(default_paths.port_dir));
|
strlcpy(default_paths.port_dir, "/retroarch", sizeof(default_paths.port_dir));
|
||||||
|
#ifdef IS_SALAMANDER
|
||||||
|
snprintf(default_paths.config_path, sizeof(default_paths.config_path), "%s/retroarch.cfg", default_paths.port_dir);
|
||||||
|
#else
|
||||||
snprintf(g_extern.config_path, sizeof(g_extern.config_path), "%s/retroarch.cfg", default_paths.port_dir);
|
snprintf(g_extern.config_path, sizeof(g_extern.config_path), "%s/retroarch.cfg", default_paths.port_dir);
|
||||||
|
#endif
|
||||||
snprintf(default_paths.system_dir, sizeof(default_paths.system_dir), "%s/system", default_paths.port_dir);
|
snprintf(default_paths.system_dir, sizeof(default_paths.system_dir), "%s/system", default_paths.port_dir);
|
||||||
snprintf(default_paths.savestate_dir, sizeof(default_paths.savestate_dir), "%s/savestates", default_paths.port_dir);
|
snprintf(default_paths.savestate_dir, sizeof(default_paths.savestate_dir), "%s/savestates", default_paths.port_dir);
|
||||||
strlcpy(default_paths.filesystem_root_dir, "/", sizeof(default_paths.filesystem_root_dir));
|
strlcpy(default_paths.filesystem_root_dir, "/", sizeof(default_paths.filesystem_root_dir));
|
||||||
@ -442,6 +530,7 @@ static void get_environment_settings(int argc, char *argv[])
|
|||||||
strlcpy(default_paths.executable_extension, ".dol", sizeof(default_paths.executable_extension));
|
strlcpy(default_paths.executable_extension, ".dol", sizeof(default_paths.executable_extension));
|
||||||
strlcpy(default_paths.salamander_file, "boot.dol", sizeof(default_paths.salamander_file));
|
strlcpy(default_paths.salamander_file, "boot.dol", sizeof(default_paths.salamander_file));
|
||||||
|
|
||||||
|
#ifndef IS_SALAMANDER
|
||||||
MAKE_DIR(default_paths.port_dir);
|
MAKE_DIR(default_paths.port_dir);
|
||||||
MAKE_DIR(default_paths.system_dir);
|
MAKE_DIR(default_paths.system_dir);
|
||||||
MAKE_DIR(default_paths.savestate_dir);
|
MAKE_DIR(default_paths.savestate_dir);
|
||||||
@ -449,9 +538,9 @@ static void get_environment_settings(int argc, char *argv[])
|
|||||||
MAKE_DIR(default_paths.input_presets_dir);
|
MAKE_DIR(default_paths.input_presets_dir);
|
||||||
|
|
||||||
MAKE_FILE(g_extern.config_path);
|
MAKE_FILE(g_extern.config_path);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern void __exception_setreload(int t);
|
extern void __exception_setreload(int t);
|
||||||
|
|
||||||
static void system_init(void)
|
static void system_init(void)
|
||||||
@ -459,8 +548,10 @@ static void system_init(void)
|
|||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
IOS_ReloadIOS(IOS_GetVersion());
|
IOS_ReloadIOS(IOS_GetVersion());
|
||||||
L2Enhance();
|
L2Enhance();
|
||||||
|
#ifndef IS_SALAMANDER
|
||||||
gx_init_mem2();
|
gx_init_mem2();
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
__exception_setreload(8);
|
__exception_setreload(8);
|
||||||
@ -475,12 +566,14 @@ static void system_init(void)
|
|||||||
dotab_stdout.write_r = gx_logger_net;
|
dotab_stdout.write_r = gx_logger_net;
|
||||||
#elif defined(HAVE_FILE_LOGGER)
|
#elif defined(HAVE_FILE_LOGGER)
|
||||||
inl_logger_init();
|
inl_logger_init();
|
||||||
|
#ifndef IS_SALAMANDER
|
||||||
devoptab_list[STD_OUT] = &dotab_stdout;
|
devoptab_list[STD_OUT] = &dotab_stdout;
|
||||||
devoptab_list[STD_ERR] = &dotab_stdout;
|
devoptab_list[STD_ERR] = &dotab_stdout;
|
||||||
dotab_stdout.write_r = gx_logger_file;
|
dotab_stdout.write_r = gx_logger_file;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#if defined(HW_RVL) && !defined(IS_SALAMANDER)
|
||||||
lwp_t gx_device_thread;
|
lwp_t gx_device_thread;
|
||||||
gx_devices[GX_DEVICE_SD].interface = &__io_wiisd;
|
gx_devices[GX_DEVICE_SD].interface = &__io_wiisd;
|
||||||
gx_devices[GX_DEVICE_SD].name = "sd";
|
gx_devices[GX_DEVICE_SD].name = "sd";
|
||||||
@ -493,6 +586,25 @@ static void system_init(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void system_exitspawn(void)
|
||||||
|
{
|
||||||
|
#ifdef IS_SALAMANDER
|
||||||
|
rarch_console_exec(default_paths.libretro_path);
|
||||||
|
#else
|
||||||
|
if(g_extern.console.external_launch.enable)
|
||||||
|
rarch_console_exec(g_settings.libretro);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void system_deinit(void)
|
||||||
|
{
|
||||||
|
#if defined(HAVE_LOGGER) || defined(HAVE_FILE_LOGGER)
|
||||||
|
inl_logger_deinit()
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef IS_SALAMANDER
|
||||||
|
|
||||||
static void system_post_init(void)
|
static void system_post_init(void)
|
||||||
{
|
{
|
||||||
gx_video_t *gx = (gx_video_t*)driver.video_data;
|
gx_video_t *gx = (gx_video_t*)driver.video_data;
|
||||||
@ -505,6 +617,11 @@ static void system_post_init(void)
|
|||||||
gx->menu_data = (uint32_t *) menu_framebuf;
|
gx->menu_data = (uint32_t *) menu_framebuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void system_deinit_save(void)
|
||||||
|
{
|
||||||
|
config_save_keybinds(input_path);
|
||||||
|
}
|
||||||
|
|
||||||
static void system_process_args(int argc, char *argv[])
|
static void system_process_args(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if (argc > 2 && argv[1] != NULL && argv[2] != NULL)
|
if (argc > 2 && argv[1] != NULL && argv[2] != NULL)
|
||||||
@ -526,20 +643,4 @@ static void system_process_args(int argc, char *argv[])
|
|||||||
g_extern.console.external_launch.support = EXTERN_LAUNCHER_SALAMANDER;
|
g_extern.console.external_launch.support = EXTERN_LAUNCHER_SALAMANDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void system_deinit_save(void)
|
|
||||||
{
|
|
||||||
config_save_keybinds(input_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void system_deinit(void)
|
|
||||||
{
|
|
||||||
#if defined(HAVE_LOGGER) || defined(HAVE_FILE_LOGGER)
|
|
||||||
inl_logger_deinit()
|
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
static void system_exitspawn(void)
|
|
||||||
{
|
|
||||||
if(g_extern.console.external_launch.enable)
|
|
||||||
rarch_console_exec(g_settings.libretro);
|
|
||||||
}
|
|
||||||
|
@ -1,177 +0,0 @@
|
|||||||
/* RetroArch - A frontend for libretro.
|
|
||||||
* RetroArch Salamander - A frontend for managing some pre-launch tasks.
|
|
||||||
* Copyright (C) 2010-2013 - Hans-Kristian Arntzen
|
|
||||||
* Copyright (C) 2011-2013 - 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include "../../boolean.h"
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
|
|
||||||
#include <sdcard/wiisd_io.h>
|
|
||||||
#include <sdcard/gcsd.h>
|
|
||||||
#include <fat.h>
|
|
||||||
|
|
||||||
#include "../../console/rarch_console.h"
|
|
||||||
#include "../../console/rarch_console_exec.h"
|
|
||||||
#include "../../console/rarch_console_libretro_mgmt.h"
|
|
||||||
#include "../../console/rarch_console_input.h"
|
|
||||||
#include "../../console/rarch_console_config.h"
|
|
||||||
#include "../../console/rarch_console_settings.h"
|
|
||||||
#include "../../conf/config_file.h"
|
|
||||||
#include "../../conf/config_file_macros.h"
|
|
||||||
#include "../../general.h"
|
|
||||||
#include "../../file.h"
|
|
||||||
|
|
||||||
char libretro_path[512];
|
|
||||||
char config_path[PATH_MAX];
|
|
||||||
|
|
||||||
default_paths_t default_paths;
|
|
||||||
|
|
||||||
static void find_and_set_first_file(void)
|
|
||||||
{
|
|
||||||
//Last fallback - we'll need to start the first executable file
|
|
||||||
// we can find in the RetroArch cores directory
|
|
||||||
|
|
||||||
char first_file[512] = {0};
|
|
||||||
rarch_manage_libretro_set_first_file(first_file, sizeof(first_file),
|
|
||||||
default_paths.core_dir, "dol");
|
|
||||||
|
|
||||||
if(first_file[0])
|
|
||||||
strlcpy(libretro_path, first_file, sizeof(libretro_path));
|
|
||||||
else
|
|
||||||
RARCH_ERR("Failed last fallback - RetroArch Salamander will exit.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
#define MAKE_DIR(x) {\
|
|
||||||
if (!path_is_directory((x)))\
|
|
||||||
{\
|
|
||||||
RARCH_WARN("Directory \"%s\" does not exists, creating\n", (x));\
|
|
||||||
if (mkdir((x), 0777) != 0)\
|
|
||||||
{\
|
|
||||||
RARCH_ERR("Could not create directory \"%s\"\n", (x));\
|
|
||||||
}\
|
|
||||||
}\
|
|
||||||
}
|
|
||||||
|
|
||||||
static void init_settings(void)
|
|
||||||
{
|
|
||||||
char tmp_str[512] = {0};
|
|
||||||
bool config_file_exists;
|
|
||||||
|
|
||||||
if(!path_file_exists(config_path))
|
|
||||||
{
|
|
||||||
FILE * f;
|
|
||||||
config_file_exists = false;
|
|
||||||
RARCH_ERR("Config file \"%s\" doesn't exist. Creating...\n", config_path);
|
|
||||||
MAKE_DIR(default_paths.port_dir);
|
|
||||||
f = fopen(config_path, "w");
|
|
||||||
fclose(f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
config_file_exists = true;
|
|
||||||
|
|
||||||
//try to find CORE executable
|
|
||||||
char core_executable[1024];
|
|
||||||
snprintf(core_executable, sizeof(core_executable), "%s/CORE.dol", default_paths.core_dir);
|
|
||||||
|
|
||||||
if(path_file_exists(core_executable))
|
|
||||||
{
|
|
||||||
//Start CORE executable
|
|
||||||
snprintf(libretro_path, sizeof(libretro_path), core_executable);
|
|
||||||
RARCH_LOG("Start [%s].\n", libretro_path);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(config_file_exists)
|
|
||||||
{
|
|
||||||
config_file_t * conf = config_file_new(config_path);
|
|
||||||
config_get_array(conf, "libretro_path", tmp_str, sizeof(tmp_str));
|
|
||||||
config_file_free(conf);
|
|
||||||
snprintf(libretro_path, sizeof(libretro_path), tmp_str);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!config_file_exists || !strcmp(libretro_path, ""))
|
|
||||||
find_and_set_first_file();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RARCH_LOG("Start [%s] found in retroarch.cfg.\n", libretro_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!config_file_exists)
|
|
||||||
{
|
|
||||||
config_file_t *new_conf = config_file_new(NULL);
|
|
||||||
config_set_string(new_conf, "libretro_path", libretro_path);
|
|
||||||
config_file_write(new_conf, config_path);
|
|
||||||
config_file_free(new_conf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void get_environment_settings(void)
|
|
||||||
{
|
|
||||||
#ifdef HW_DOL
|
|
||||||
chdir("carda:/retroarch");
|
|
||||||
#endif
|
|
||||||
getcwd(default_paths.core_dir, MAXPATHLEN);
|
|
||||||
char *last_slash = strrchr(default_paths.core_dir, '/');
|
|
||||||
if (last_slash)
|
|
||||||
*last_slash = 0;
|
|
||||||
char *device_end = strchr(default_paths.core_dir, '/');
|
|
||||||
if (device_end)
|
|
||||||
snprintf(default_paths.port_dir, sizeof(default_paths.port_dir), "%.*s/retroarch", device_end - default_paths.core_dir, default_paths.core_dir);
|
|
||||||
else
|
|
||||||
snprintf(default_paths.port_dir, sizeof(default_paths.port_dir), "/retroarch");
|
|
||||||
snprintf(config_path, sizeof(config_path), "%s/retroarch.cfg", default_paths.port_dir);
|
|
||||||
snprintf(default_paths.system_dir, sizeof(default_paths.system_dir), "%s/system", default_paths.port_dir);
|
|
||||||
snprintf(default_paths.savestate_dir, sizeof(default_paths.savestate_dir), "%s/savestates", default_paths.port_dir);
|
|
||||||
snprintf(default_paths.filesystem_root_dir, sizeof(default_paths.filesystem_root_dir), "/");
|
|
||||||
snprintf(default_paths.filebrowser_startup_dir, sizeof(default_paths.filebrowser_startup_dir), default_paths.filesystem_root_dir);
|
|
||||||
snprintf(default_paths.sram_dir, sizeof(default_paths.sram_dir), "%s/sram", default_paths.port_dir);
|
|
||||||
snprintf(default_paths.input_presets_dir, sizeof(default_paths.input_presets_dir), "%s/input", default_paths.port_dir);
|
|
||||||
strlcpy(default_paths.executable_extension, ".dol", sizeof(default_paths.executable_extension));
|
|
||||||
snprintf(default_paths.salamander_file, sizeof(default_paths.salamander_file), "boot.dol");
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
#ifdef HW_RVL
|
|
||||||
IOS_ReloadIOS(IOS_GetVersion());
|
|
||||||
L2Enhance();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_LOGGER
|
|
||||||
logger_init();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fatInitDefault();
|
|
||||||
|
|
||||||
get_environment_settings();
|
|
||||||
|
|
||||||
//TODO: Add control options later - for 'set_first_file'
|
|
||||||
{
|
|
||||||
//normal executable loading path
|
|
||||||
init_settings();
|
|
||||||
}
|
|
||||||
|
|
||||||
rarch_console_exec(libretro_path);
|
|
||||||
|
|
||||||
#ifdef HAVE_LOGGER
|
|
||||||
logger_shutdown();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user