diff --git a/command.c b/command.c
index 286dfbb60a..002b60a2bb 100644
--- a/command.c
+++ b/command.c
@@ -1493,9 +1493,10 @@ bool command_event_save_core_config(
for (i = 0; i < 16; i++)
{
if (i)
- snprintf(tmp, sizeof(tmp), "%s-%u.cfg", config_path, i);
+ snprintf(tmp, sizeof(tmp), "%s-%u", config_path, i);
else
- snprintf(tmp, sizeof(tmp), "%s.cfg", config_path);
+ strlcpy(tmp, config_path, sizeof(tmp));
+ strlcat(tmp, ".cfg", sizeof(tmp));
if (!path_is_valid(tmp))
{
diff --git a/input/input_driver.c b/input/input_driver.c
index 836cbeb9e8..cf96cdbe77 100644
--- a/input/input_driver.c
+++ b/input/input_driver.c
@@ -4664,18 +4664,27 @@ static bool runloop_check_movie_init(input_driver_state_t *input_st,
char msg[16384], path[8192];
bsv_movie_t *state = NULL;
int state_slot = settings->ints.state_slot;
-
- msg[0] = path[0] = '\0';
+ msg[0] = '\0';
configuration_set_uint(settings, settings->uints.rewind_granularity, 1);
if (state_slot > 0)
+ {
+ path[0] = '\0';
snprintf(path, sizeof(path), "%s%d.bsv",
input_st->bsv_movie_state.movie_path,
state_slot);
+ }
else
- snprintf(path, sizeof(path), "%s.bsv",
- input_st->bsv_movie_state.movie_path);
+ {
+ size_t _len = strlcpy(path,
+ input_st->bsv_movie_state.movie_path, sizeof(path));
+ path[_len ] = '.';
+ path[_len+1] = 'b';
+ path[_len+2] = 's';
+ path[_len+3] = 'v';
+ path[_len+4] = '\0';
+ }
snprintf(msg, sizeof(msg), "%s \"%s\".",
msg_hash_to_str(MSG_STARTING_MOVIE_RECORD_TO),
diff --git a/tasks/task_steam.c b/tasks/task_steam.c
index 3c9c813e4a..8d4111975e 100644
--- a/tasks/task_steam.c
+++ b/tasks/task_steam.c
@@ -1,3 +1,17 @@
+/* RetroArch - A frontend for libretro.
+ *
+ * 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 "tasks_internal.h"
@@ -5,7 +19,8 @@
#include "../runloop.h"
#include "../steam/steam.h"
-typedef struct steam_core_dlc_install_state {
+typedef struct steam_core_dlc_install_state
+{
AppId app_id;
char *name;
bool has_downloaded;
@@ -13,50 +28,54 @@ typedef struct steam_core_dlc_install_state {
static void task_steam_core_dlc_install_handler(retro_task_t *task)
{
- char msg[PATH_MAX_LENGTH] = { 0 };
- steam_core_dlc_install_state_t *state = NULL;
- MistResult result = MistResult_Success;
- bool downloading = false;
- uint64_t bytes_downloaded = 0;
- uint64_t bytes_total = 0;
int8_t progress;
+ steam_core_dlc_install_state_t *state = NULL;
+ MistResult result = MistResult_Success;
+ bool downloading = false;
+ uint64_t bytes_downloaded = 0;
+ uint64_t bytes_total = 0;
if (!task)
goto task_finished;
- state = (steam_core_dlc_install_state_t*)task->state;
-
- if (!state)
+ if (!(state = (steam_core_dlc_install_state_t*)task->state))
goto task_finished;
if (task_get_cancelled(task))
goto task_finished;
result = mist_steam_apps_get_dlc_download_progress(state->app_id, &downloading, &bytes_downloaded, &bytes_total);
- if(MIST_IS_ERROR(result)) goto task_finished;
- if(!downloading)
+ if (MIST_IS_ERROR(result))
+ goto task_finished;
+ if (!downloading)
{
- if(state->has_downloaded) goto task_finished;
+ if (state->has_downloaded)
+ goto task_finished;
}
else
state->has_downloaded = true;
- // Min bytes total to avoid division by zero at start
- if(bytes_total < 1) bytes_total = 1;
+ /* Min bytes total to avoid division by zero at start */
+ if (bytes_total < 1)
+ bytes_total = 1;
progress = (int8_t)((bytes_downloaded * 100) / bytes_total);
- if(progress < 0) progress = 0;
- if(progress > 100) progress = 100;
+ if (progress < 0)
+ progress = 0;
+ else if (progress > 100)
+ progress = 100;
task_set_progress(task, progress);
return;
task_finished:
- if (task) task_set_finished(task, true);
+ if (task)
+ task_set_finished(task, true);
/* If finished successfully */
- if(MIST_IS_SUCCESS(result))
+ if (MIST_IS_SUCCESS(result))
{
+ char msg[PATH_MAX_LENGTH];
strlcpy(msg, msg_hash_to_str(MSG_CORE_INSTALLED),
sizeof(msg));
strlcat(msg, state->name,
@@ -80,18 +99,17 @@ void task_push_steam_core_dlc_install(
{
char task_title[PATH_MAX_LENGTH];
- retro_task_t *task = task_init();
+ retro_task_t *task = task_init();
steam_core_dlc_install_state_t* state = (steam_core_dlc_install_state_t*)calloc(1,
sizeof(steam_core_dlc_install_state_t));
- state->app_id = app_id;
- state->name = strdup(name);
+ state->app_id = app_id;
+ state->name = strdup(name);
state->has_downloaded = false;
strlcpy(task_title, msg_hash_to_str(MSG_CORE_STEAM_INSTALLING),
sizeof(task_title));
- strlcat(task_title, name,
- sizeof(task_title));
+ strlcat(task_title, name, sizeof(task_title));
task->handler = task_steam_core_dlc_install_handler;
task->state = state;