Make this compile
This commit is contained in:
parent
70b1f385e8
commit
c47b58228f
|
@ -47,11 +47,11 @@ bool content_save_ram_file(unsigned slot);
|
||||||
|
|
||||||
/* Load a state from disk to memory. */
|
/* Load a state from disk to memory. */
|
||||||
bool content_load_state(const char* path);
|
bool content_load_state(const char* path);
|
||||||
bool content_load_state_with_backup(const char* path, bool save_to_backup_buffer)
|
bool content_load_state_with_backup(const char* path, bool save_to_backup_buffer);
|
||||||
|
|
||||||
/* Save a state from memory to disk. */
|
/* Save a state from memory to disk. */
|
||||||
bool content_save_state(const char *path);
|
bool content_save_state(const char *path);
|
||||||
bool content_save_state_with_backup(const char *path, bool save_to_disk)
|
bool content_save_state_with_backup(const char *path, bool save_to_disk);
|
||||||
|
|
||||||
/* Copy a save state. */
|
/* Copy a save state. */
|
||||||
bool content_rename_state(const char *origin, const char *dest);
|
bool content_rename_state(const char *origin, const char *dest);
|
||||||
|
|
|
@ -236,7 +236,7 @@ bool content_save_state_with_backup(const char *path, bool save_to_disk)
|
||||||
if (ret) {
|
if (ret) {
|
||||||
if (save_to_disk) {
|
if (save_to_disk) {
|
||||||
if (path_file_exists(path)) {
|
if (path_file_exists(path)) {
|
||||||
content_load_state(path, true);
|
content_load_state_with_backup(path, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = filestream_write_file(path, data, info.size);
|
ret = filestream_write_file(path, data, info.size);
|
||||||
|
@ -245,7 +245,7 @@ bool content_save_state_with_backup(const char *path, bool save_to_disk)
|
||||||
in old_state_buf to allow content_undo_load_state() to restore it */
|
in old_state_buf to allow content_undo_load_state() to restore it */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
old_state_buf.path = NULL;
|
old_state_buf.path[0] = '\0';
|
||||||
|
|
||||||
/* If we were holding onto an old state already, clean it up first */
|
/* If we were holding onto an old state already, clean it up first */
|
||||||
if (old_state_buf.data) {
|
if (old_state_buf.data) {
|
||||||
|
@ -254,7 +254,8 @@ bool content_save_state_with_backup(const char *path, bool save_to_disk)
|
||||||
}
|
}
|
||||||
|
|
||||||
old_state_buf.data = malloc(info.size);
|
old_state_buf.data = malloc(info.size);
|
||||||
memcpy(old_state_buf.data, data);
|
memcpy(old_state_buf.data, data, info.size);
|
||||||
|
old_state_buf.size = info.size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -314,7 +315,9 @@ bool content_load_state_with_backup(const char *path, bool save_to_backup_buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
old_save_file.data = malloc(size);
|
old_save_file.data = malloc(size);
|
||||||
memcpy(old_save_file.data, buf);
|
memcpy(old_save_file.data, buf, size);
|
||||||
|
|
||||||
|
old_save_file.size = size;
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
return true;
|
return true;
|
||||||
|
@ -373,7 +376,7 @@ bool content_load_state_with_backup(const char *path, bool save_to_backup_buffer
|
||||||
serial_info.size = size;
|
serial_info.size = size;
|
||||||
|
|
||||||
/* Backup the current state so we can undo this load */
|
/* Backup the current state so we can undo this load */
|
||||||
content_save_state(NULL, true);
|
content_save_state_with_backup(NULL, true);
|
||||||
ret = core_unserialize(&serial_info);
|
ret = core_unserialize(&serial_info);
|
||||||
|
|
||||||
/* Flush back. */
|
/* Flush back. */
|
||||||
|
|
Loading…
Reference in New Issue