Refactor rarch_init_autosave/rarch_deinit_autosave
This commit is contained in:
parent
33d18b3722
commit
15f3f79732
|
@ -101,6 +101,7 @@ enum basic_event
|
||||||
RARCH_CMD_QUIT,
|
RARCH_CMD_QUIT,
|
||||||
RARCH_CMD_REINIT,
|
RARCH_CMD_REINIT,
|
||||||
RARCH_CMD_REWIND,
|
RARCH_CMD_REWIND,
|
||||||
|
RARCH_CMD_AUTOSAVE,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum menu_enums
|
enum menu_enums
|
||||||
|
@ -786,8 +787,6 @@ void rarch_disk_control_set_eject(bool state, bool log);
|
||||||
void rarch_disk_control_set_index(unsigned index);
|
void rarch_disk_control_set_index(unsigned index);
|
||||||
void rarch_disk_control_append_image(const char *path);
|
void rarch_disk_control_append_image(const char *path);
|
||||||
bool rarch_set_rumble_state(unsigned port, enum retro_rumble_effect effect, bool enable);
|
bool rarch_set_rumble_state(unsigned port, enum retro_rumble_effect effect, bool enable);
|
||||||
void rarch_init_autosave(void);
|
|
||||||
void rarch_deinit_autosave(void);
|
|
||||||
|
|
||||||
#ifdef HAVE_RECORD
|
#ifdef HAVE_RECORD
|
||||||
void rarch_init_recording(void);
|
void rarch_init_recording(void);
|
||||||
|
|
19
retroarch.c
19
retroarch.c
|
@ -1699,7 +1699,7 @@ static void init_libretro_cbs(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_THREADS)
|
#if defined(HAVE_THREADS)
|
||||||
void rarch_init_autosave(void)
|
static void init_autosave(void)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
|
@ -1729,7 +1729,7 @@ void rarch_init_autosave(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rarch_deinit_autosave(void)
|
static void deinit_autosave(void)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
for (i = 0; i < g_extern.num_autosave; i++)
|
for (i = 0; i < g_extern.num_autosave; i++)
|
||||||
|
@ -2483,7 +2483,7 @@ void rarch_disk_control_append_image(const char *path)
|
||||||
msg_queue_push(g_extern.msg_queue, msg, 0, 180);
|
msg_queue_push(g_extern.msg_queue, msg, 0, 180);
|
||||||
|
|
||||||
#if defined(HAVE_THREADS)
|
#if defined(HAVE_THREADS)
|
||||||
rarch_deinit_autosave();
|
deinit_autosave();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// TODO: Need to figure out what to do with subsystems case.
|
// TODO: Need to figure out what to do with subsystems case.
|
||||||
|
@ -2498,7 +2498,7 @@ void rarch_disk_control_append_image(const char *path)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_THREADS)
|
#if defined(HAVE_THREADS)
|
||||||
rarch_init_autosave();
|
init_autosave();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rarch_disk_control_set_eject(false, false);
|
rarch_disk_control_set_eject(false, false);
|
||||||
|
@ -2922,7 +2922,7 @@ static void init_sram(void)
|
||||||
|
|
||||||
#if defined(HAVE_THREADS)
|
#if defined(HAVE_THREADS)
|
||||||
if (g_extern.use_sram)
|
if (g_extern.use_sram)
|
||||||
rarch_init_autosave();
|
init_autosave();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3151,6 +3151,13 @@ void rarch_main_command(unsigned action)
|
||||||
else
|
else
|
||||||
deinit_rewind();
|
deinit_rewind();
|
||||||
break;
|
break;
|
||||||
|
case RARCH_CMD_AUTOSAVE:
|
||||||
|
#ifdef HAVE_THREADS
|
||||||
|
deinit_autosave();
|
||||||
|
if (g_settings.autosave_interval)
|
||||||
|
init_autosave();
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3284,7 +3291,7 @@ void rarch_main_deinit(void)
|
||||||
|
|
||||||
#if defined(HAVE_THREADS)
|
#if defined(HAVE_THREADS)
|
||||||
if (g_extern.use_sram)
|
if (g_extern.use_sram)
|
||||||
rarch_deinit_autosave();
|
deinit_autosave();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_RECORD
|
#ifdef HAVE_RECORD
|
||||||
|
|
|
@ -977,8 +977,9 @@ static void general_read_handler(const void *data)
|
||||||
|
|
||||||
static void general_write_handler(const void *data)
|
static void general_write_handler(const void *data)
|
||||||
{
|
{
|
||||||
bool has_set_reinit = false;
|
bool has_set_reinit = false;
|
||||||
bool has_set_rewind = false;
|
bool has_set_rewind = false;
|
||||||
|
bool has_set_autosave = false;
|
||||||
const rarch_setting_t *setting = (const rarch_setting_t*)data;
|
const rarch_setting_t *setting = (const rarch_setting_t*)data;
|
||||||
|
|
||||||
if (!setting)
|
if (!setting)
|
||||||
|
@ -1127,14 +1128,8 @@ static void general_write_handler(const void *data)
|
||||||
g_settings.fastforward_ratio = *setting->value.fraction;
|
g_settings.fastforward_ratio = *setting->value.fraction;
|
||||||
else if (!strcmp(setting->name, "autosave_interval"))
|
else if (!strcmp(setting->name, "autosave_interval"))
|
||||||
{
|
{
|
||||||
#ifdef HAVE_THREADS
|
|
||||||
rarch_deinit_autosave();
|
|
||||||
#endif
|
|
||||||
g_settings.autosave_interval = *setting->value.unsigned_integer;
|
g_settings.autosave_interval = *setting->value.unsigned_integer;
|
||||||
#ifdef HAVE_THREADS
|
has_set_autosave = true;
|
||||||
if (g_settings.autosave_interval)
|
|
||||||
rarch_init_autosave();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else if (!strcmp(setting->name, "video_font_enable"))
|
else if (!strcmp(setting->name, "video_font_enable"))
|
||||||
g_settings.video.font_enable = *setting->value.boolean;
|
g_settings.video.font_enable = *setting->value.boolean;
|
||||||
|
@ -1339,9 +1334,10 @@ static void general_write_handler(const void *data)
|
||||||
|
|
||||||
if (has_set_reinit)
|
if (has_set_reinit)
|
||||||
rarch_main_command(RARCH_CMD_REINIT);
|
rarch_main_command(RARCH_CMD_REINIT);
|
||||||
|
|
||||||
if (has_set_rewind)
|
if (has_set_rewind)
|
||||||
rarch_main_command(RARCH_CMD_REWIND);
|
rarch_main_command(RARCH_CMD_REWIND);
|
||||||
|
if (has_set_autosave)
|
||||||
|
rarch_main_command(RARCH_CMD_AUTOSAVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define NEXT (list[index++])
|
#define NEXT (list[index++])
|
||||||
|
|
Loading…
Reference in New Issue