mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 16:39:43 +00:00
Move rarch_manage_libretro_set_first_file to frontend_console.c
This commit is contained in:
parent
238699d5a4
commit
1e57bcab5f
@ -21,8 +21,6 @@
|
||||
|
||||
#include "rarch_console_libretro_mgmt.h"
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
|
||||
void rarch_console_name_from_id(char *name, size_t size)
|
||||
{
|
||||
if (size == 0)
|
||||
@ -112,47 +110,3 @@ bool rarch_manage_libretro_extension_supported(const char *filename)
|
||||
|
||||
return ext_supported;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void rarch_manage_libretro_set_first_file(char *first_file, size_t size_of_first_file, const char *libretro_path, const char * exe_ext)
|
||||
{
|
||||
struct string_list *dir_list = dir_list_new(libretro_path, exe_ext, false);
|
||||
|
||||
const char * first_exe;
|
||||
|
||||
if (!dir_list)
|
||||
{
|
||||
RARCH_ERR("Couldn't read directory.\n");
|
||||
RARCH_ERR("Failed to set first entry to libretro path.\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
first_exe = dir_list->elems[0].data;
|
||||
|
||||
if(first_exe)
|
||||
{
|
||||
char fname_tmp[PATH_MAX];
|
||||
fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp));
|
||||
|
||||
if(strncmp(fname_tmp, default_paths.salamander_file, sizeof(fname_tmp)) == 0)
|
||||
{
|
||||
RARCH_WARN("First entry is RetroArch Salamander itself, increment entry by one and check if it exists.\n");
|
||||
first_exe = dir_list->elems[1].data;
|
||||
fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp));
|
||||
|
||||
if(!first_exe)
|
||||
{
|
||||
RARCH_ERR("Unlikely error happened - no second entry - no choice but to set it to RetroArch Salamander\n");
|
||||
first_exe = dir_list->elems[0].data;
|
||||
fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp));
|
||||
}
|
||||
}
|
||||
|
||||
strlcpy(first_file, fname_tmp, size_of_first_file);
|
||||
RARCH_LOG("Set first entry in libretro core dir to libretro path: [%s].\n", first_file);
|
||||
}
|
||||
|
||||
end:
|
||||
dir_list_free(dir_list);
|
||||
}
|
||||
|
@ -32,21 +32,11 @@ enum
|
||||
|
||||
void rarch_console_name_from_id(char *name, size_t size);
|
||||
|
||||
//We need to set libretro to the first entry in the cores
|
||||
//directory so that it will be saved to the config file
|
||||
void rarch_manage_libretro_set_first_file(char *first_file,
|
||||
size_t size_of_first_file, const char *libretro_path,
|
||||
const char * exe_ext);
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
|
||||
//install/upgrade (and rename) libretro core if 'CORE' executable exists
|
||||
bool rarch_libretro_core_install(const char *full_path, const char *tmp_path,
|
||||
const char *libretro_path, const char *config_path, const char *extension);
|
||||
|
||||
// Transforms a library id to a name suitable as a pathname.
|
||||
bool rarch_manage_libretro_extension_supported(const char *filename);
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -19,8 +19,11 @@
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
//forward declarations
|
||||
//optional forward declarations
|
||||
static void rarch_console_exec(const char *path);
|
||||
static void rarch_manage_libretro_set_first_file(char *first_file,
|
||||
size_t size_of_first_file, const char *libretro_path,
|
||||
const char * exe_ext);
|
||||
|
||||
#if defined(__CELLOS_LV2__)
|
||||
#include "platform/platform_ps3.c"
|
||||
@ -39,6 +42,52 @@ static void rarch_console_exec(const char *path);
|
||||
|
||||
#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 rarch_manage_libretro_set_first_file(char *first_file,
|
||||
size_t size_of_first_file, const char *libretro_path,
|
||||
const char * exe_ext)
|
||||
{
|
||||
struct string_list *dir_list = dir_list_new(libretro_path, exe_ext, false);
|
||||
|
||||
const char * first_exe;
|
||||
|
||||
if (!dir_list)
|
||||
{
|
||||
RARCH_ERR("Couldn't read directory.\n");
|
||||
RARCH_ERR("Failed to set first entry to libretro path.\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
first_exe = dir_list->elems[0].data;
|
||||
|
||||
if(first_exe)
|
||||
{
|
||||
char fname_tmp[PATH_MAX];
|
||||
fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp));
|
||||
|
||||
if(strncmp(fname_tmp, default_paths.salamander_file, sizeof(fname_tmp)) == 0)
|
||||
{
|
||||
RARCH_WARN("First entry is RetroArch Salamander itself, increment entry by one and check if it exists.\n");
|
||||
first_exe = dir_list->elems[1].data;
|
||||
fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp));
|
||||
|
||||
if(!first_exe)
|
||||
{
|
||||
RARCH_ERR("Unlikely error happened - no second entry - no choice but to set it to RetroArch Salamander\n");
|
||||
first_exe = dir_list->elems[0].data;
|
||||
fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp));
|
||||
}
|
||||
}
|
||||
|
||||
strlcpy(first_file, fname_tmp, size_of_first_file);
|
||||
RARCH_LOG("Set first entry in libretro core dir to libretro path: [%s].\n", first_file);
|
||||
}
|
||||
|
||||
end:
|
||||
dir_list_free(dir_list);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
system_init();
|
||||
|
@ -256,14 +256,6 @@
|
||||
</Deploy>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\console\rarch_console_libretro_mgmt.c">
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='CodeAnalysis|Xbox 360'">CompileAsCpp</CompileAs>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Xbox 360'">CompileAsCpp</CompileAs>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Profile|Xbox 360'">CompileAsCpp</CompileAs>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Profile_FastCap|Xbox 360'">CompileAsCpp</CompileAs>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Xbox 360'">CompileAsCpp</CompileAs>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release_LTCG|Xbox 360'">CompileAsCpp</CompileAs>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\compat\compat.c" />
|
||||
<ClCompile Include="..\..\conf\config_file.c">
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='CodeAnalysis|Xbox 360'">CompileAsCpp</CompileAs>
|
||||
|
@ -15,9 +15,6 @@
|
||||
<Filter Include="Source Files\conf">
|
||||
<UniqueIdentifier>{7ffc19c2-b69a-4272-b986-4fafee630f77}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\console">
|
||||
<UniqueIdentifier>{26ff8241-2b47-497e-8464-6867f4c5bb8e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\conf\config_file.c">
|
||||
@ -29,9 +26,6 @@
|
||||
<ClCompile Include="..\..\file_path.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\console\rarch_console_libretro_mgmt.c">
|
||||
<Filter>Source Files\console</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\frontend\frontend_console.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -404,39 +404,6 @@
|
||||
CompileAs="2"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\console\rarch_console_libretro_mgmt.c">
|
||||
<FileConfiguration
|
||||
Name="Debug|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
CompileAs="2"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Profile|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
CompileAs="2"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Profile_FastCap|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
CompileAs="2"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
CompileAs="2"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release_LTCG|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
CompileAs="2"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
|
Loading…
Reference in New Issue
Block a user