mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 15:40:44 +00:00
(Frontend) Cleanups
This commit is contained in:
parent
b70c1c134f
commit
413230d77d
@ -303,10 +303,11 @@ static void frontend_darwin_get_os(char *s, size_t len, int *major, int *minor)
|
||||
static void frontend_darwin_get_environment_settings(int *argc, char *argv[],
|
||||
void *args, void *params_data)
|
||||
{
|
||||
char temp_dir[PATH_MAX_LENGTH];
|
||||
char bundle_path_buf[PATH_MAX_LENGTH], home_dir_buf[PATH_MAX_LENGTH];
|
||||
CFURLRef bundle_url;
|
||||
CFStringRef bundle_path;
|
||||
char temp_dir[PATH_MAX_LENGTH] = {0};
|
||||
char bundle_path_buf[PATH_MAX_LENGTH] = {0};
|
||||
char home_dir_buf[PATH_MAX_LENGTH] = {0};
|
||||
CFBundleRef bundle = CFBundleGetMainBundle();
|
||||
|
||||
(void)temp_dir;
|
||||
@ -380,7 +381,7 @@ static void frontend_darwin_load_content(void)
|
||||
|
||||
static int frontend_darwin_get_rating(void)
|
||||
{
|
||||
char model[PATH_MAX_LENGTH];
|
||||
char model[PATH_MAX_LENGTH] = {0};
|
||||
|
||||
frontend_darwin_get_name(model, sizeof(model));
|
||||
|
||||
|
@ -102,18 +102,18 @@ static void
|
||||
check_proc_acpi_battery(const char * node, bool * have_battery,
|
||||
bool * charging, int *seconds, int *percent)
|
||||
{
|
||||
const char *base = proc_acpi_battery_path;
|
||||
char info[1024];
|
||||
char state[1024];
|
||||
char *ptr = NULL;
|
||||
char *key = NULL;
|
||||
char *val = NULL;
|
||||
bool charge = false;
|
||||
bool choose = false;
|
||||
int maximum = -1;
|
||||
int remaining = -1;
|
||||
int secs = -1;
|
||||
int pct = -1;
|
||||
const char *base = proc_acpi_battery_path;
|
||||
char info[1024] = {0};
|
||||
char state[1024] = {0};
|
||||
char *ptr = NULL;
|
||||
char *key = NULL;
|
||||
char *val = NULL;
|
||||
bool charge = false;
|
||||
bool choose = false;
|
||||
int maximum = -1;
|
||||
int remaining = -1;
|
||||
int secs = -1;
|
||||
int pct = -1;
|
||||
|
||||
if (!load_acpi_file(base, node, "state", state, sizeof (state)))
|
||||
return;
|
||||
@ -121,6 +121,7 @@ check_proc_acpi_battery(const char * node, bool * have_battery,
|
||||
return;
|
||||
|
||||
ptr = &state[0];
|
||||
|
||||
while (make_proc_acpi_key_val(&ptr, &key, &val))
|
||||
{
|
||||
if (!strcmp(key, "present"))
|
||||
@ -138,8 +139,9 @@ check_proc_acpi_battery(const char * node, bool * have_battery,
|
||||
}
|
||||
else if (!strcmp(key, "remaining capacity"))
|
||||
{
|
||||
char *endptr = NULL;
|
||||
char *endptr = NULL;
|
||||
const int cvt = (int) strtol(val, &endptr, 10);
|
||||
|
||||
if (*endptr == ' ')
|
||||
remaining = cvt;
|
||||
}
|
||||
@ -150,8 +152,9 @@ check_proc_acpi_battery(const char * node, bool * have_battery,
|
||||
{
|
||||
if (!strcmp(key, "design capacity"))
|
||||
{
|
||||
char *endptr = NULL;
|
||||
char *endptr = NULL;
|
||||
const int cvt = (int) strtol(val, &endptr, 10);
|
||||
|
||||
if (*endptr == ' ')
|
||||
maximum = cvt;
|
||||
}
|
||||
@ -194,10 +197,10 @@ static void
|
||||
check_proc_acpi_ac_adapter(const char * node, bool *have_ac)
|
||||
{
|
||||
const char *base = proc_acpi_ac_adapter_path;
|
||||
char state[256];
|
||||
char *ptr = NULL;
|
||||
char *key = NULL;
|
||||
char *val = NULL;
|
||||
char state[256] = {0};
|
||||
char *ptr = NULL;
|
||||
char *key = NULL;
|
||||
char *val = NULL;
|
||||
|
||||
if (!load_acpi_file(base, node, "state", state, sizeof (state)))
|
||||
return;
|
||||
@ -246,16 +249,16 @@ static bool int_string(char *str, int *val)
|
||||
bool frontend_linux_powerstate_check_apm(enum frontend_powerstate *state,
|
||||
int *seconds, int *percent)
|
||||
{
|
||||
int ac_status = 0;
|
||||
int battery_status = 0;
|
||||
int battery_flag = 0;
|
||||
int battery_percent = 0;
|
||||
int battery_time = 0;
|
||||
const int fd = open(proc_apm_path, O_RDONLY);
|
||||
char buf[128];
|
||||
char *ptr = &buf[0];
|
||||
char *str = NULL;
|
||||
ssize_t br;
|
||||
int ac_status = 0;
|
||||
int battery_status = 0;
|
||||
int battery_flag = 0;
|
||||
int battery_percent = 0;
|
||||
int battery_time = 0;
|
||||
const int fd = open(proc_apm_path, O_RDONLY);
|
||||
char buf[128] = {0};
|
||||
char *ptr = &buf[0];
|
||||
char *str = NULL;
|
||||
|
||||
if (fd == -1)
|
||||
return false; /* can't use this interface. */
|
||||
@ -331,10 +334,10 @@ bool frontend_linux_powerstate_check_acpi(enum frontend_powerstate *state,
|
||||
int *seconds, int *percent)
|
||||
{
|
||||
struct dirent *dent = NULL;
|
||||
DIR *dirp = NULL;
|
||||
bool have_battery = false;
|
||||
bool have_ac = false;
|
||||
bool charging = false;
|
||||
DIR *dirp = NULL;
|
||||
bool have_battery = false;
|
||||
bool have_ac = false;
|
||||
bool charging = false;
|
||||
|
||||
*state = FRONTEND_POWERSTATE_NONE;
|
||||
|
||||
@ -357,6 +360,7 @@ bool frontend_linux_powerstate_check_acpi(enum frontend_powerstate *state,
|
||||
while ((dent = readdir(dirp)) != NULL)
|
||||
{
|
||||
const char *node = dent->d_name;
|
||||
|
||||
check_proc_acpi_ac_adapter(node, &have_ac);
|
||||
}
|
||||
closedir(dirp);
|
||||
|
@ -95,8 +95,8 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
|
||||
unsigned int get_type;
|
||||
unsigned int get_attributes;
|
||||
CellGameContentSize size;
|
||||
char dirName[CELL_GAME_DIRNAME_SIZE];
|
||||
char contentInfoPath[PATH_MAX_LENGTH];
|
||||
char dirName[CELL_GAME_DIRNAME_SIZE] = {0};
|
||||
char contentInfoPath[PATH_MAX_LENGTH] = {0};
|
||||
|
||||
#ifdef HAVE_MULTIMAN
|
||||
/* not launched from external launcher, set default path */
|
||||
@ -355,20 +355,24 @@ static void frontend_ps3_exitspawn(char *core_path, size_t core_path_size)
|
||||
|
||||
static void frontend_ps3_exec(const char *path, bool should_load_game)
|
||||
{
|
||||
char spawn_data[256] = {0};
|
||||
unsigned i;
|
||||
|
||||
(void)should_load_game;
|
||||
char spawn_data[256];
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
global_t *global = global_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
bool original_verbose = global->verbosity;
|
||||
char game_path[256] = {0};
|
||||
|
||||
global->verbosity = true;
|
||||
|
||||
char game_path[256];
|
||||
game_path[0] = '\0';
|
||||
#endif
|
||||
|
||||
RARCH_LOG("Attempt to load executable: [%s].\n", path);
|
||||
|
||||
for(unsigned int i = 0; i < sizeof(spawn_data); ++i)
|
||||
for(i = 0; i < sizeof(spawn_data); ++i)
|
||||
spawn_data[i] = i & 0xff;
|
||||
|
||||
SceNpDrmKey * k_licensee = NULL;
|
||||
|
@ -187,9 +187,8 @@ static void frontend_psp_init(void *data)
|
||||
static void frontend_psp_exec(const char *path, bool should_load_game)
|
||||
{
|
||||
#if defined(HAVE_KERNEL_PRX) || defined(IS_SALAMANDER)
|
||||
|
||||
char argp[512];
|
||||
SceSize args = 0;
|
||||
char argp[512] = {0};
|
||||
SceSize args = 0;
|
||||
|
||||
argp[0] = '\0';
|
||||
strlcpy(argp, eboot_path, sizeof(argp));
|
||||
|
@ -65,12 +65,12 @@ HRESULT xbox_io_mount(const char* szDrive, char* szDevice)
|
||||
static HRESULT xbox_io_mount(char *szDrive, char *szDevice)
|
||||
{
|
||||
#ifndef IS_SALAMANDER
|
||||
global_t *global = global_get_ptr();
|
||||
bool original_verbose = global->verbosity;
|
||||
global->verbosity = true;
|
||||
global_t *global = global_get_ptr();
|
||||
bool original_verbose = global->verbosity;
|
||||
global->verbosity = true;
|
||||
#endif
|
||||
char szSourceDevice[48];
|
||||
char szDestinationDrive[16];
|
||||
char szSourceDevice[48] = {0};
|
||||
char szDestinationDrive[16] = {0};
|
||||
|
||||
snprintf(szSourceDevice, sizeof(szSourceDevice),
|
||||
"\\Device\\%s", szDevice);
|
||||
@ -105,7 +105,8 @@ static HRESULT xbox_io_mount(char *szDrive, char *szDevice)
|
||||
|
||||
static HRESULT xbox_io_unmount(char *szDrive)
|
||||
{
|
||||
char szDestinationDrive[16];
|
||||
char szDestinationDrive[16] = {0};
|
||||
|
||||
snprintf(szDestinationDrive, sizeof(szDestinationDrive),
|
||||
"\\??\\%s", szDrive);
|
||||
|
||||
@ -129,8 +130,9 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
|
||||
(void)ret;
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
global_t *global = global_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
bool original_verbose = global->verbosity;
|
||||
|
||||
global->verbosity = true;
|
||||
#endif
|
||||
|
||||
@ -334,13 +336,15 @@ static void frontend_xdk_exec(const char *path, bool should_load_game)
|
||||
#if defined(_XBOX1)
|
||||
LAUNCH_DATA ptr;
|
||||
memset(&ptr, 0, sizeof(ptr));
|
||||
|
||||
if (should_load_game && global->fullpath[0] != '\0')
|
||||
snprintf((char*)ptr.Data, sizeof(ptr.Data), "%s", global->fullpath);
|
||||
|
||||
if (path[0] != '\0')
|
||||
XLaunchNewImage(path, ptr.Data[0] != '\0' ? &ptr : NULL);
|
||||
#elif defined(_XBOX360)
|
||||
char game_path[1024];
|
||||
char game_path[1024] = {0};
|
||||
|
||||
if (should_load_game && global->fullpath[0] != '\0')
|
||||
{
|
||||
strlcpy(game_path, global->fullpath, sizeof(game_path));
|
||||
|
Loading…
x
Reference in New Issue
Block a user