diff --git a/Makefile.ps3.salamander b/Makefile.ps3.salamander index 54f0a090ba..06261f962b 100644 --- a/Makefile.ps3.salamander +++ b/Makefile.ps3.salamander @@ -19,7 +19,7 @@ endif STRIP = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-strip.exe PPU_CFLAGS += -I. -D__CELLOS_LV2__ -DIS_SALAMANDER -DRARCH_CONSOLE -DHAVE_SYSUTILS -DHAVE_SYSMODULES -DHAVE_RARCH_EXEC -PPU_SRCS = frontend/frontend_console.c file_path.c compat/compat.c conf/config_file.c +PPU_SRCS = frontend/frontend_salamander.c file_path.c compat/compat.c conf/config_file.c ifeq ($(HAVE_LOGGER), 1) PPU_CFLAGS += -DHAVE_LOGGER -Iconsole/logger diff --git a/Makefile.wii.salamander b/Makefile.wii.salamander index 73980827c7..1356a4ac3b 100644 --- a/Makefile.wii.salamander +++ b/Makefile.wii.salamander @@ -39,7 +39,7 @@ LIBS := -lfat -lwiiuse -logc -lbte APP_BOOTER_DIR = wii/app_booter -OBJ = frontend/frontend_console.o file_path.o compat/compat.o conf/config_file.o $(APP_BOOTER_DIR)/app_booter.binobj +OBJ = frontend/frontend_salamander.o file_path.o compat/compat.o conf/config_file.o $(APP_BOOTER_DIR)/app_booter.binobj ifeq ($(HAVE_LOGGER), 1) CFLAGS += -DHAVE_LOGGER diff --git a/frontend/frontend_console.c b/frontend/frontend_console.c index f661ac54e8..60c138a608 100644 --- a/frontend/frontend_console.c +++ b/frontend/frontend_console.c @@ -43,68 +43,6 @@ default_paths_t default_paths; -#ifdef IS_SALAMANDER - -//We need to set libretro to the first entry in the cores -//directory so that it will be saved to the config file -static void find_first_libretro_core(char *first_file, - size_t size_of_first_file, const char *dir, - const char * ext) -{ - bool ret = false; - - RARCH_LOG("Searching for valid libretro implementation in: \"%s\".\n", dir); - - struct string_list *list = dir_list_new(dir, ext, false); - if (!list) - { - RARCH_ERR("Couldn't read directory. Cannot infer default libretro core.\n"); - return; - } - - for (size_t i = 0; i < list->size && !ret; i++) - { - RARCH_LOG("Checking library: \"%s\".\n", list->elems[i].data); - const char * libretro_elem = list->elems[i].data; - - if (libretro_elem) - { - char fname[PATH_MAX]; - fill_pathname_base(fname, libretro_elem, sizeof(fname)); - - if (strncmp(fname, SALAMANDER_FILE, sizeof(fname)) == 0) - { - if ((i + 1) == list->size) - { - RARCH_WARN("Entry is RetroArch Salamander itself, but is last entry. No choice but to set it.\n"); - strlcpy(first_file, fname, size_of_first_file); - } - - continue; - } - - strlcpy(first_file, fname, size_of_first_file); - RARCH_LOG("First found libretro core is: \"%s\".\n", first_file); - ret = true; - } - } - - dir_list_free(list); -} - -int main(int argc, char *argv[]) -{ - system_init(); - get_environment_settings(argc, argv); - salamander_init_settings(); - system_deinit(); - system_exitspawn(); - - return 1; -} - -#else - static void verbose_log_init(void) { if (g_extern.verbose) @@ -290,5 +228,3 @@ begin_shutdown: return 1; } - -#endif diff --git a/frontend/frontend_salamander.c b/frontend/frontend_salamander.c new file mode 100644 index 0000000000..79410d58bf --- /dev/null +++ b/frontend/frontend_salamander.c @@ -0,0 +1,98 @@ +/* RetroArch - A frontend for libretro. + * 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 . + */ + +#include +#include "../boolean.h" +#include +#include + +#include "../config.def.h" +#include "frontend_salamander.h" + +#if defined(__CELLOS_LV2__) +#include "platform/platform_ps3_exec.c" +#include "platform/platform_ps3.c" +#elif defined(GEKKO) +#ifdef HW_RVL +#include "platform/platform_gx_exec.c" +#endif +#include "platform/platform_gx.c" +#elif defined(_XBOX) +#include "platform/platform_xdk_exec.c" +#include "platform/platform_xdk.c" +#elif defined(PSP) +#include "platform/platform_psp.c" +#endif + +default_paths_t default_paths; + +//We need to set libretro to the first entry in the cores +//directory so that it will be saved to the config file +static void find_first_libretro_core(char *first_file, + size_t size_of_first_file, const char *dir, + const char * ext) +{ + bool ret = false; + + RARCH_LOG("Searching for valid libretro implementation in: \"%s\".\n", dir); + + struct string_list *list = dir_list_new(dir, ext, false); + if (!list) + { + RARCH_ERR("Couldn't read directory. Cannot infer default libretro core.\n"); + return; + } + + for (size_t i = 0; i < list->size && !ret; i++) + { + RARCH_LOG("Checking library: \"%s\".\n", list->elems[i].data); + const char * libretro_elem = list->elems[i].data; + + if (libretro_elem) + { + char fname[PATH_MAX]; + fill_pathname_base(fname, libretro_elem, sizeof(fname)); + + if (strncmp(fname, SALAMANDER_FILE, sizeof(fname)) == 0) + { + if ((i + 1) == list->size) + { + RARCH_WARN("Entry is RetroArch Salamander itself, but is last entry. No choice but to set it.\n"); + strlcpy(first_file, fname, size_of_first_file); + } + + continue; + } + + strlcpy(first_file, fname, size_of_first_file); + RARCH_LOG("First found libretro core is: \"%s\".\n", first_file); + ret = true; + } + } + + dir_list_free(list); +} + +int main(int argc, char *argv[]) +{ + system_init(); + get_environment_settings(argc, argv); + salamander_init_settings(); + system_deinit(); + system_exitspawn(); + + return 1; +} diff --git a/frontend/frontend_salamander.h b/frontend/frontend_salamander.h new file mode 100644 index 0000000000..16e33b7dc3 --- /dev/null +++ b/frontend/frontend_salamander.h @@ -0,0 +1,28 @@ +/* RetroArch - A frontend for libretro. + * 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 . + */ + +#ifndef _FRONTEND_SALAMANDER_H +#define _FRONTEND_SALAMANDER_H + +//optional RetroArch forward declarations +static void verbose_log_init(void); + +//optional Salamander forward declarations +static void find_first_libretro_core(char *first_file, + size_t size_of_first_file, const char *dir, + const char * ext); + +#endif diff --git a/msvc/RetroArch-360-Salamander/RetroArch-Salamander.vcxproj b/msvc/RetroArch-360-Salamander/RetroArch-Salamander.vcxproj index 4d81f9b182..81806c2062 100644 --- a/msvc/RetroArch-360-Salamander/RetroArch-Salamander.vcxproj +++ b/msvc/RetroArch-360-Salamander/RetroArch-Salamander.vcxproj @@ -266,9 +266,9 @@ CompileAsCpp - + - \ No newline at end of file + diff --git a/msvc/RetroArch-Xbox1-Salamander/RetroArch-Salamander.vcproj b/msvc/RetroArch-Xbox1-Salamander/RetroArch-Salamander.vcproj index e273302d15..b3d6dc0dfd 100644 --- a/msvc/RetroArch-Xbox1-Salamander/RetroArch-Salamander.vcproj +++ b/msvc/RetroArch-Xbox1-Salamander/RetroArch-Salamander.vcproj @@ -372,7 +372,7 @@ + RelativePath="..\..\frontend\frontend_salamander.c">