/** * Copyright (c) 2026 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #pragma once #include "error/error.h" typedef struct { /** True from autoSaveQueue() until the queued write starts. */ bool_t pending; /** True while the queued write is actually in flight. */ bool_t saving; /** * True while the forced no-save-device prompt is up after a queued * write failed - see autoSaveUpdate(). World simulation must pause * while this is true (see rpgUpdate()). */ bool_t blocking; } autosave_t; extern autosave_t AUTO_SAVE; /** * Queues an autosave to run on a future engine tick. Safe to call as * often as needed (e.g. after every map transition or story event) - * repeated calls before the queued save starts just collapse into one. */ void autoSaveQueue(void); /** * Pumps the queued autosave: starts the write once nothing else is * using the save system, and if that write fails (e.g. a GameCube with * no memory card inserted), forces the same no-save-device prompt the * initial boot scene uses and pauses world simulation until the player * resolves it. Must be called every engine frame, after saveUpdate(). */ void autoSaveUpdate(void); /** * True while a queued autosave's write is actually in progress. Intended * for UI to show a "Saving" indicator. * * @return true if an autosave write is currently in flight. */ bool_t autoSaveIsSaving(void); /** * True while a failed autosave is forcing the no-save-device prompt and * waiting on the player's decision. Intended for the world simulation to * pause while this is true. * * @return true if an autosave is currently blocking on player input. */ bool_t autoSaveIsBlocking(void);