diff --git a/Makefile.common b/Makefile.common index d76be0515e..c10890968a 100644 --- a/Makefile.common +++ b/Makefile.common @@ -269,6 +269,7 @@ ifeq ($(HAVE_PATCH), 1) endif OBJ += \ + save.o \ tasks/task_save.o \ tasks/task_movie.o \ tasks/task_file_transfer.o \ diff --git a/command.c b/command.c index f95084407c..aa17586b35 100644 --- a/command.c +++ b/command.c @@ -1258,9 +1258,7 @@ bool command_event_resize_windowed_scale(settings_t *settings, return true; } -bool command_event_save_auto_state( - bool savestate_auto_save, - const enum rarch_core_type current_core_type) +bool command_event_save_auto_state(void) { size_t _len; runloop_state_t *runloop_st = runloop_state_get_ptr(); @@ -1268,10 +1266,6 @@ bool command_event_save_auto_state( if (runloop_st->entry_state_slot) return false; - if (!savestate_auto_save) - return false; - if (current_core_type == CORE_TYPE_DUMMY) - return false; if (!core_info_current_supports_savestate()) return false; if (string_is_empty(path_basename(path_get(RARCH_PATH_BASENAME)))) diff --git a/command.h b/command.h index 59ed89395c..2d690a9929 100644 --- a/command.h +++ b/command.h @@ -349,9 +349,7 @@ void command_event_set_mixer_volume( bool command_event_resize_windowed_scale(settings_t *settings, unsigned window_scale); -bool command_event_save_auto_state( - bool savestate_auto_save, - const enum rarch_core_type current_core_type); +bool command_event_save_auto_state(void); /** * event_set_volume: diff --git a/content.h b/content.h index 70da680aa8..64b2557b97 100644 --- a/content.h +++ b/content.h @@ -39,12 +39,6 @@ typedef struct content_ctx_info int argc; /* Argument count. */ } content_ctx_info_t; -/* Load a RAM state from disk to memory. */ -bool content_load_ram_file(unsigned slot); - -/* Save a RAM state from memory to disk. */ -bool content_save_ram_file(unsigned slot, bool compress); - /* Load a state from memory. */ bool content_load_state_from_ram(void); diff --git a/griffin/griffin.c b/griffin/griffin.c index 8475b48788..044820c698 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -1274,6 +1274,7 @@ DATA RUNLOOP #endif #endif #endif +#include "../save.c" #include "../tasks/task_save.c" #include "../tasks/task_movie.c" #include "../tasks/task_image.c" diff --git a/retroarch.c b/retroarch.c index cd5b4fe7a2..440667f38a 100644 --- a/retroarch.c +++ b/retroarch.c @@ -3600,9 +3600,9 @@ bool command_event(enum event_command cmd, void *data) settings->bools.content_runtime_log_aggregate, settings->paths.directory_runtime_log, settings->paths.directory_playlist); - command_event_save_auto_state( - settings->bools.savestate_auto_save, - runloop_st->current_core_type); + if (settings->bools.savestate_auto_save && + runloop_st->current_core_type != CORE_TYPE_DUMMY) + command_event_save_auto_state(); if ( (runloop_st->flags & RUNLOOP_FLAG_REMAPS_CORE_ACTIVE) || (runloop_st->flags & RUNLOOP_FLAG_REMAPS_CONTENT_DIR_ACTIVE) @@ -8102,9 +8102,9 @@ bool retroarch_main_quit(void) command_event(CMD_EVENT_MENU_SAVE_CURRENT_CONFIG, NULL); #endif - command_event_save_auto_state( - settings->bools.savestate_auto_save, - runloop_st->current_core_type); + if (settings->bools.savestate_auto_save && + runloop_st->current_core_type != CORE_TYPE_DUMMY) + command_event_save_auto_state(); /* If any save states are in progress, wait * until all tasks are complete (otherwise diff --git a/save.c b/save.c new file mode 100644 index 0000000000..b6b72a2b92 --- /dev/null +++ b/save.c @@ -0,0 +1,588 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2019 - Brad Parker + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include