mirror of
https://github.com/libretro/RetroArch
synced 2025-02-01 20:54:10 +00:00
Turn dump_to_file_desprate into static function
This commit is contained in:
parent
0c86536bdc
commit
8b67551799
@ -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(
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user