RetroArch
Classes | Macros | Typedefs | Functions | Variables
task_save.c File Reference
#include <stdint.h>
#include <stdlib.h>
#include <sys/types.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <errno.h>
#include <compat/strl.h>
#include <retro_assert.h>
#include <lists/string_list.h>
#include <streams/interface_stream.h>
#include <streams/file_stream.h>
#include <rthreads/rthreads.h>
#include <file/file_path.h>
#include <retro_miscellaneous.h>
#include <string/stdstring.h>
#include "../core.h"
#include "../file_path_special.h"
#include "../configuration.h"
#include "../gfx/video_driver.h"
#include "../msg_hash.h"
#include "../retroarch.h"
#include "../verbosity.h"
#include "tasks_internal.h"
#include "../managers/cheat_manager.h"
Include dependency graph for task_save.c:

Classes

struct  ram_type
 
struct  save_state_buf
 
struct  sram_block
 
struct  save_task_state_t
 

Macros

#define SAVE_STATE_CHUNK   4096
 

Typedefs

typedef save_task_state_t load_task_data_t
 

Functions

void autosave_lock (void)
 
void autosave_unlock (void)
 
bool content_undo_load_state (void)
 
static void undo_save_state_cb (void *task_data, void *user_data, const char *error)
 
static void task_save_handler_finished (retro_task_t *task, save_task_state_t *state)
 
voidget_serialized_data (const char *path, size_t serial_size)
 
static void task_save_handler (retro_task_t *task)
 
static bool task_push_undo_save_state (const char *path, void *data, size_t size)
 
bool content_undo_save_state (void)
 
static void task_load_handler_finished (retro_task_t *task, save_task_state_t *state)
 
static void task_load_handler (retro_task_t *task)
 
static void content_load_state_cb (void *task_data, void *user_data, const char *error)
 
static void save_state_cb (void *task_data, void *user_data, const char *error)
 
static void task_push_save_state (const char *path, void *data, size_t size, bool autosave)
 
static void content_load_and_save_state_cb (void *task_data, void *user_data, const char *error)
 
static void task_push_load_and_save_state (const char *path, void *data, size_t size, bool load_to_backup_buffer, bool autosave)
 
bool content_save_state (const char *path, bool save_to_disk, bool autosave)
 
bool content_load_state (const char *path, bool load_to_backup_buffer, bool autoload)
 
bool content_rename_state (const char *origin, const char *dest)
 
bool content_reset_savestate_backups (void)
 
bool content_undo_load_buf_is_empty (void)
 
bool content_undo_save_buf_is_empty (void)
 
static bool content_get_memory (retro_ctx_memory_info_t *mem_info, struct ram_type *ram, unsigned slot)
 
bool content_load_ram_file (unsigned slot)
 
static bool dump_to_file_desperate (const void *data, size_t size, unsigned type)
 
bool content_save_ram_file (unsigned slot)
 
bool event_save_files (void)
 
bool event_load_save_files (void)
 
void path_init_savefile_rtc (const char *savefile_path)
 
void path_deinit_savefile (void)
 
void path_init_savefile_new (void)
 
voidsavefile_ptr_get (void)
 
void set_save_state_in_background (bool state)
 

Variables

static bool save_state_in_background = false
 
static struct string_listtask_save_files = NULL
 
static struct save_state_buf undo_save_buf
 
static struct save_state_buf undo_load_buf
 

Macro Definition Documentation

◆ SAVE_STATE_CHUNK

#define SAVE_STATE_CHUNK   4096

Typedef Documentation

◆ load_task_data_t

Function Documentation

◆ autosave_lock()

void autosave_lock ( void  )

autosave_lock:

Lock autosave.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ autosave_unlock()

void autosave_unlock ( void  )

autosave_unlock:

Unlocks autosave.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_get_memory()

static bool content_get_memory ( retro_ctx_memory_info_t mem_info,
struct ram_type ram,
unsigned  slot 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_load_and_save_state_cb()

static void content_load_and_save_state_cb ( void task_data,
void user_data,
const char *  error 
)
static

content_load_and_save_state_cb: : path that state will be loaded from. Load then save a state.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_load_ram_file()

bool content_load_ram_file ( unsigned  slot)

content_load_ram_file: : path of RAM state that will be loaded from. : type of memory

Load a RAM state from disk to memory.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_load_state()

bool content_load_state ( const char *  path,
bool  load_to_backup_buffer,
bool  autoload 
)

content_load_state: : path that state will be loaded from. : If true, the state will be loaded into undo_save_buf. Load a state from disk to memory.

Returns: true if successful, false otherwise.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_load_state_cb()

static void content_load_state_cb ( void task_data,
void user_data,
const char *  error 
)
static

content_load_state_cb: : path that state will be loaded from. Load a state from disk to memory.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_rename_state()

bool content_rename_state ( const char *  origin,
const char *  dest 
)
Here is the call graph for this function:

◆ content_reset_savestate_backups()

bool content_reset_savestate_backups ( void  )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_save_ram_file()

bool content_save_ram_file ( unsigned  slot)

content_save_ram_file: : path of RAM state that shall be written to. : type of memory

Save a RAM state from memory to disk.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_save_state()

bool content_save_state ( const char *  path,
bool  save_to_disk,
bool  autosave 
)

content_save_state: : path of saved state that shall be written to. : If false, saves the state onto undo_load_buf. Save a state from memory to disk.

Returns: true if successful, false otherwise.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_undo_load_buf_is_empty()

bool content_undo_load_buf_is_empty ( void  )
Here is the caller graph for this function:

◆ content_undo_load_state()

bool content_undo_load_state ( void  )

undo_load_state: Revert to the state before a state was loaded.

Returns: true if successful, false otherwise.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_undo_save_buf_is_empty()

bool content_undo_save_buf_is_empty ( void  )
Here is the caller graph for this function:

◆ content_undo_save_state()

bool content_undo_save_state ( void  )

undo_save_state: Reverts the last save operation

Returns: true if successful, false otherwise.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dump_to_file_desperate()

static bool dump_to_file_desperate ( const void data,
size_t  size,
unsigned  type 
)
static

dump_to_file_desperate: : pointer to data buffer. : size of . : type of file to be saved.

Attempt to save valuable RAM data somewhere.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ event_load_save_files()

bool event_load_save_files ( void  )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ event_save_files()

bool event_save_files ( void  )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_serialized_data()

void* get_serialized_data ( const char *  path,
size_t  serial_size 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ path_deinit_savefile()

void path_deinit_savefile ( void  )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ path_init_savefile_new()

void path_init_savefile_new ( void  )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ path_init_savefile_rtc()

void path_init_savefile_rtc ( const char *  savefile_path)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_state_cb()

static void save_state_cb ( void task_data,
void user_data,
const char *  error 
)
static

save_state_cb:

Called after the save state is done. Takes a screenshot if needed.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ savefile_ptr_get()

void* savefile_ptr_get ( void  )
Here is the caller graph for this function:

◆ set_save_state_in_background()

void set_save_state_in_background ( bool  state)
Here is the caller graph for this function:

◆ task_load_handler()

static void task_load_handler ( retro_task_t task)
static

task_load_handler: : the task being worked on

Load a chunk of data from the save state file.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ task_load_handler_finished()

static void task_load_handler_finished ( retro_task_t task,
save_task_state_t state 
)
static

task_load_handler_finished: : the task to finish : the state associated with this task

Close the loaded state file and finish the task.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ task_push_load_and_save_state()

static void task_push_load_and_save_state ( const char *  path,
void data,
size_t  size,
bool  load_to_backup_buffer,
bool  autosave 
)
static

task_push_load_and_save_state: : file path of the save state : the save state data to write : the total size of the save state : If true, the state will be loaded into undo_save_buf.

Create a new task to load current state first into a backup buffer (for undo) and then save the content state.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ task_push_save_state()

static void task_push_save_state ( const char *  path,
void data,
size_t  size,
bool  autosave 
)
static

task_push_save_state: : file path of the save state : the save state data to write : the total size of the save state

Create a new task to save the content state.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ task_push_undo_save_state()

static bool task_push_undo_save_state ( const char *  path,
void data,
size_t  size 
)
static

task_push_undo_save_state: : file path of the save state : the save state data to write : the total size of the save state

Create a new task to undo the last save of the content state.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ task_save_handler()

static void task_save_handler ( retro_task_t task)
static

task_save_handler: : the task being worked on

Write a chunk of data to the save state file.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ task_save_handler_finished()

static void task_save_handler_finished ( retro_task_t task,
save_task_state_t state 
)
static

task_save_handler_finished: : the task to finish : the state associated with this task

Close the save state file and finish the task.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ undo_save_state_cb()

static void undo_save_state_cb ( void task_data,
void user_data,
const char *  error 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ save_state_in_background

bool save_state_in_background = false
static

◆ task_save_files

struct string_list* task_save_files = NULL
static

◆ undo_load_buf

struct save_state_buf undo_load_buf
static

◆ undo_save_buf

struct save_state_buf undo_save_buf
static