(Salamander) Split up Salamander into its own separate file

This commit is contained in:
twinaphex 2013-03-22 21:27:34 +01:00
parent 1f54ac4bd9
commit f7e75d69fa
7 changed files with 131 additions and 69 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include "../boolean.h"
#include <stddef.h>
#include <string.h>
#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;
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#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

View File

@ -266,9 +266,9 @@
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release_LTCG|Xbox 360'">CompileAsCpp</CompileAs>
</ClCompile>
<ClCompile Include="..\..\file_path.c" />
<ClCompile Include="..\..\frontend\frontend_console.c" />
<ClCompile Include="..\..\frontend\frontend_salamander.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -372,7 +372,7 @@
</FileConfiguration>
</File>
<File
RelativePath="..\..\frontend\frontend_console.c">
RelativePath="..\..\frontend\frontend_salamander.c">
<FileConfiguration
Name="Debug|Xbox">
<Tool