Make ssnes_state_slot_increase/decrease public.

This commit is contained in:
Themaister 2012-02-15 18:49:23 +01:00
parent 3cc042e2a6
commit b87e1c4f48
2 changed files with 38 additions and 18 deletions

View File

@ -215,7 +215,6 @@ enum ssnes_game_type
SSNES_CART_SUFAMI
};
// All run-time- / command line flag-related globals go here.
struct global
{
@ -415,6 +414,8 @@ void ssnes_render_cached_frame(void);
void ssnes_load_state(void);
void ssnes_save_state(void);
void ssnes_state_slot_increase(void);
void ssnes_state_slot_decrease(void);
/////////
// Public data structures

53
ssnes.c
View File

@ -1578,34 +1578,53 @@ static bool check_fullscreen(void)
return toggle;
}
void ssnes_state_slot_increase(void)
{
g_extern.state_slot++;
if (g_extern.msg_queue)
msg_queue_clear(g_extern.msg_queue);
char msg[256];
snprintf(msg, sizeof(msg), "Save state/movie slot: %u", g_extern.state_slot);
if (g_extern.msg_queue)
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
SSNES_LOG("%s\n", msg);
}
void ssnes_state_slot_decrease(void)
{
if (g_extern.state_slot > 0)
g_extern.state_slot--;
if (g_extern.msg_queue)
msg_queue_clear(g_extern.msg_queue);
char msg[256];
snprintf(msg, sizeof(msg), "Save state/movie slot: %u", g_extern.state_slot);
if (g_extern.msg_queue)
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
SSNES_LOG("%s\n", msg);
}
static void check_stateslots(void)
{
// Save state slots
static bool old_should_slot_increase = false;
bool should_slot_increase = driver.input->key_pressed(driver.input_data, SSNES_STATE_SLOT_PLUS);
if (should_slot_increase && !old_should_slot_increase)
{
g_extern.state_slot++;
msg_queue_clear(g_extern.msg_queue);
char msg[256];
snprintf(msg, sizeof(msg), "Save state/movie slot: %u", g_extern.state_slot);
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
SSNES_LOG("%s\n", msg);
}
ssnes_state_slot_increase();
old_should_slot_increase = should_slot_increase;
static bool old_should_slot_decrease = false;
bool should_slot_decrease = driver.input->key_pressed(driver.input_data, SSNES_STATE_SLOT_MINUS);
if (should_slot_decrease && !old_should_slot_decrease)
{
if (g_extern.state_slot > 0)
g_extern.state_slot--;
msg_queue_clear(g_extern.msg_queue);
char msg[256];
snprintf(msg, sizeof(msg), "Save state/movie slot: %u", g_extern.state_slot);
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
SSNES_LOG("%s\n", msg);
}
ssnes_state_slot_decrease();
old_should_slot_decrease = should_slot_decrease;
}