Turn dump_to_file_desprate into static function

This commit is contained in:
twinaphex 2016-09-20 04:08:55 +02:00
parent 0c86536bdc
commit 8b67551799
3 changed files with 35 additions and 36 deletions

View File

@ -347,40 +347,6 @@ static bool read_content_file(unsigned i, const char *path, void **buf,
return true;
}
/**
* dump_to_file_desperate:
* @data : pointer to data buffer.
* @size : size of @data.
* @type : type of file to be saved.
*
* Attempt to save valuable RAM data somewhere.
**/
bool dump_to_file_desperate(const void *data,
size_t size, unsigned type)
{
time_t time_;
char timebuf[256] = {0};
char application_data[PATH_MAX_LENGTH] = {0};
char path[PATH_MAX_LENGTH] = {0};
if (!fill_pathname_application_data(application_data,
sizeof(application_data)))
return false;
snprintf(path, sizeof(path), "%s/RetroArch-recovery-%u",
application_data, type);
time(&time_);
strftime(timebuf, sizeof(timebuf), "%Y-%m-%d-%H-%M-%S", localtime(&time_));
strlcat(path, timebuf, sizeof(path));
if (!filestream_write_file(path, data, size))
return false;
RARCH_WARN("Succeeded in saving RAM data to \"%s\".\n", path);
return true;
}
/* Load the content into memory. */
static bool load_content_into_memory(

View File

@ -789,6 +789,41 @@ bool content_load_ram_file(unsigned slot)
return true;
}
/**
* dump_to_file_desperate:
* @data : pointer to data buffer.
* @size : size of @data.
* @type : type of file to be saved.
*
* Attempt to save valuable RAM data somewhere.
**/
static bool dump_to_file_desperate(const void *data,
size_t size, unsigned type)
{
time_t time_;
char timebuf[256] = {0};
char application_data[PATH_MAX_LENGTH] = {0};
char path[PATH_MAX_LENGTH] = {0};
if (!fill_pathname_application_data(application_data,
sizeof(application_data)))
return false;
snprintf(path, sizeof(path), "%s/RetroArch-recovery-%u",
application_data, type);
time(&time_);
strftime(timebuf, sizeof(timebuf), "%Y-%m-%d-%H-%M-%S", localtime(&time_));
strlcat(path, timebuf, sizeof(path));
if (!filestream_write_file(path, data, size))
return false;
RARCH_WARN("Succeeded in saving RAM data to \"%s\".\n", path);
return true;
}
/**
* content_save_ram_file:
* @path : path of RAM state that shall be written to.

View File

@ -143,8 +143,6 @@ bool content_push_to_history_playlist(
/* TODO/FIXME - turn this into actual task */
bool take_screenshot(void);
bool dump_to_file_desperate(const void *data,
size_t size, unsigned type);
bool event_load_save_files(void);