(frontend) Start using string_is_empty

This commit is contained in:
twinaphex 2015-12-26 07:45:19 +01:00
parent 66449802e4
commit c7eeb557fa
9 changed files with 49 additions and 35 deletions

View File

@ -28,6 +28,7 @@ PPU_SRCS = frontend/frontend_salamander.c \
libretro-common/file/retro_dirent.c \
libretro-common/file/retro_stat.c \
libretro-common/hash/rhash.c \
libretro-common/string/stdstring.c \
libretro-common/string/string_list.c \
libretro-common/compat/compat_strl.c \
libretro-common/file/retro_file.c \

View File

@ -36,6 +36,7 @@ OBJS = frontend/frontend_salamander.o \
frontend/drivers/platform_psp.o \
frontend/drivers/platform_null.o \
libretro-common/file/file_path.o \
libretro-common/string/stdstring.o \
libretro-common/string/string_list.o \
libretro-common/file/dir_list.o \
libretro-common/file/retro_dirent.o \

View File

@ -46,6 +46,7 @@ OBJ = frontend/frontend_salamander.o \
frontend/drivers/platform_null.o \
libretro-common/file/file_path.o \
libretro-common/hash/rhash.o \
libretro-common/string/stdstring.o \
libretro-common/string/string_list.o \
libretro-common/file/dir_list.o \
libretro-common/file/retro_file.o \

View File

@ -33,6 +33,7 @@
#ifndef IS_SALAMANDER
#include <file/file_list.h>
#endif
#include <string/stdstring.h>
#include "../frontend_driver.h"
#include "../../defaults.h"
@ -318,7 +319,7 @@ static void frontend_gx_exitspawn(char *s, size_t len)
{
bool should_load_game = false;
#if defined(IS_SALAMANDER)
if (gx_rom_path[0] != '\0')
if (!string_is_empty(gx_rom_path))
should_load_game = true;
#elif defined(HW_RVL)
should_load_game = exitspawn_start_game;

View File

@ -129,7 +129,7 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
else
#endif
#ifndef IS_SALAMANDER
if (*argc > 1 && argv[1] != NULL && argv[1][0] != '\0')
if (*argc > 1 && !string_is_empty(argv[1]))
{
static char path[PATH_MAX_LENGTH];
*path = '\0';
@ -373,7 +373,7 @@ static void frontend_ps3_exec(const char *path, bool should_load_game)
#ifndef IS_SALAMANDER
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
if (should_load_game && fullpath[0] != '\0')
if (should_load_game && !string_is_empty(fullpath))
{
char game_path[256];
strlcpy(game_path, fullpath, sizeof(game_path));

View File

@ -129,7 +129,7 @@ static void frontend_psp_get_environment_settings(int *argc, char *argv[],
#endif
#ifndef IS_SALAMANDER
if (argv[1] && (argv[1][0] != '\0'))
if (!string_is_empty(argv[1]))
{
static char path[PATH_MAX_LENGTH];
struct rarch_main_wrap *args = NULL;
@ -258,7 +258,7 @@ static void frontend_psp_exec(const char *path, bool should_load_game)
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
if (should_load_game && fullpath[0] != '\0')
if (should_load_game && !string_is_empty(fullpath))
{
argp[args] = '\0';
strlcat(argp + args, fullpath, sizeof(argp) - args);

View File

@ -26,6 +26,7 @@
#include <file/file_list.h>
#endif
#include <retro_miscellaneous.h>
#include <string/stdstring.h>
#include "platform_xdk.h"
#include "../frontend_driver.h"
@ -215,7 +216,8 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
extracted_path = (char*)&ptr.Data;
if (extracted_path && extracted_path[0] != '\0'
if (
!string_is_empty(extracted_path)
&& (strstr(extracted_path, "Pool") == NULL)
/* Hack. Unknown problem */)
{
@ -239,32 +241,31 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
}
else
sprintf_s(extracted_path, dwLaunchDataSize, "%s", pLaunchData);
if (extracted_path && extracted_path[0] != '\0')
{
/* Auto-start game */
/* Auto-start game */
if (!string_is_empty(extracted_path))
strlcpy(path, extracted_path, sizeof(path));
}
if (pLaunchData)
delete []pLaunchData;
}
#endif
if (path && path[0] != '\0')
if (!string_is_empty(path))
{
struct rarch_main_wrap *args = (struct rarch_main_wrap*)params_data;
struct rarch_main_wrap *args = (struct rarch_main_wrap*)params_data;
if (args)
{
/* Auto-start game. */
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;
}
if (args)
{
/* Auto-start game. */
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;
}
}
#endif
@ -318,7 +319,7 @@ static void frontend_xdk_exec(const char *path, bool should_load_game)
(void)should_load_game;
#ifdef IS_SALAMANDER
if (path[0] != '\0')
if (!string_is_empty(path))
XLaunchNewImage(path, NULL);
#else
#ifdef _XBOX
@ -331,21 +332,21 @@ static void frontend_xdk_exec(const char *path, bool should_load_game)
memset(&ptr, 0, sizeof(ptr));
if (should_load_game && fullpath[0] != '\0')
if (should_load_game && !string_is_empty(fullpath))
snprintf((char*)ptr.Data, sizeof(ptr.Data), "%s", fullpath);
if (path[0] != '\0')
XLaunchNewImage(path, ptr.Data[0] != '\0' ? &ptr : NULL);
if (!string_is_empty(path))
XLaunchNewImage(path, !string_is_empty(ptr.Data) ? &ptr : NULL);
#elif defined(_XBOX360)
char game_path[1024] = {0};
if (should_load_game && fullpath[0] != '\0')
if (should_load_game && !string_is_empty(fullpath))
{
strlcpy(game_path, fullpath, sizeof(game_path));
XSetLaunchData(game_path, MAX_LAUNCH_DATA_SIZE);
}
if (path[0] != '\0')
if (!string_is_empty(path))
XLaunchNewImage(path, NULL);
#endif
#endif

View File

@ -94,13 +94,14 @@ static void find_and_set_first_file(char *s, size_t len,
find_first_libretro_core(first_file, sizeof(first_file),
g_defaults.dir.core, ext);
if (first_file[0] != '\0')
if (string_is_empty(first_file))
{
fill_pathname_join(s, g_defaults.dir.core, first_file, len);
RARCH_LOG("libretro_path now set to: %s.\n", s);
}
else
RARCH_ERR("Failed last fallback - RetroArch Salamander will exit.\n");
return;
}
fill_pathname_join(s, g_defaults.dir.core, first_file, len);
RARCH_LOG("libretro_path now set to: %s.\n", s);
}
static void salamander_init(char *s, size_t len)

View File

@ -306,6 +306,14 @@
<ClCompile Include="..\..\..\frontend\frontend_driver.c" />
<ClCompile Include="..\..\..\frontend\drivers\platform_null.c" />
<ClCompile Include="..\..\..\frontend\drivers\platform_xdk.cpp" />
<ClCompile Include="..\..\..\libretro-common\string\stdstring.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='CodeAnalysis|Xbox 360'">CompileAsC</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Xbox 360'">CompileAsC</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Profile|Xbox 360'">CompileAsC</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Profile_FastCap|Xbox 360'">CompileAsC</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Xbox 360'">CompileAsC</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release_LTCG|Xbox 360'">CompileAsC</CompileAs>
</ClCompile>
<ClCompile Include="..\..\..\libretro-common\string\string_list.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='CodeAnalysis|Xbox 360'">CompileAsC</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Xbox 360'">CompileAsC</CompileAs>