/** * save_ram_file: * @path : path of RAM state that shall be written to. * @type : type of memory * * Save a RAM state from memory to disk. * */ static bool save_ram_file(ram_type_t *ram) { retro_ctx_memory_info_t mem_info; mem_info.id = ram->type; core_ctl(CORE_CTL_RETRO_GET_MEMORY, &mem_info); if (!mem_info.data || mem_info.size == 0) return false; if (!retro_write_file(ram->path, mem_info.data, mem_info.size)) { RARCH_ERR("%s.\n", msg_hash_to_str(MSG_FAILED_TO_SAVE_SRAM)); RARCH_WARN("Attempting to recover ...\n"); /* In case the file could not be written to, * the fallback function 'dump_to_file_desperate' * will be called. */ if (!dump_to_file_desperate(mem_info.data, mem_info.size, ram->type)) { RARCH_WARN("Failed ... Cannot recover save file.\n"); } return false; } RARCH_LOG("%s \"%s\".\n", msg_hash_to_str(MSG_SAVED_SUCCESSFULLY_TO), ram->path); return true; }
void save_ram_file(const char *path, int type) { size_t size = pretro_get_memory_size(type); void *data = pretro_get_memory_data(type); if (data && size > 0) { if (!dump_to_file(path, data, size)) { RARCH_ERR("Failed to save SRAM.\n"); RARCH_WARN("Attempting to recover ...\n"); dump_to_file_desperate(data, size, type); } } }
void save_ram_file(const char *path, int type) { size_t size = pretro_get_memory_size(type); void *data = pretro_get_memory_data(type); if (data && size > 0) { if (!write_file(path, data, size)) { RARCH_ERR("Failed to save SRAM.\n"); RARCH_WARN("Attempting to recover ...\n"); dump_to_file_desperate(data, size, type); } else RARCH_LOG("Saved successfully to \"%s\".\n", path); } }
/** * save_ram_file: * @path : path of RAM state that shall be written to. * @type : type of memory * * Save a RAM state from memory to disk. * * In case the file could not be written to, a fallback function * 'dump_to_file_desperate' will be called. */ void save_ram_file(const char *path, int type) { size_t size = core.retro_get_memory_size(type); void *data = core.retro_get_memory_data(type); if (!data) return; if (size == 0) return; if (!retro_write_file(path, data, size)) { RARCH_ERR("%s.\n", msg_hash_to_str(MSG_FAILED_TO_SAVE_SRAM)); RARCH_WARN("Attempting to recover ...\n"); dump_to_file_desperate(data, size, type); return; } RARCH_LOG("%s \"%s\".\n", msg_hash_to_str(MSG_SAVED_SUCCESSFULLY_TO), path); }