mirror of
https://github.com/libretro/RetroArch
synced 2025-04-07 13:23:32 +00:00
Create rarch_main_command - command.c could maybe later be made
more generic so we can just do this through command.c functions locally
This commit is contained in:
parent
2629eb5a8c
commit
4b0f3584e0
@ -19,14 +19,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
enum basic_event_t {
|
|
||||||
RESET = 1,
|
|
||||||
LOAD_STATE = 2,
|
|
||||||
SAVE_STATE = 3,
|
|
||||||
QUIT = 4
|
|
||||||
};
|
|
||||||
extern void apple_event_basic_command(enum basic_event_t action);
|
extern void apple_event_basic_command(enum basic_event_t action);
|
||||||
|
|
||||||
extern void apple_refresh_config(void);
|
extern void apple_refresh_config(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -3796,7 +3796,7 @@ static int menu_common_setting_set(unsigned setting, unsigned action)
|
|||||||
if (action == MENU_ACTION_OK)
|
if (action == MENU_ACTION_OK)
|
||||||
{
|
{
|
||||||
if (setting == MENU_SETTINGS_SAVESTATE_SAVE)
|
if (setting == MENU_SETTINGS_SAVESTATE_SAVE)
|
||||||
rarch_save_state();
|
rarch_main_command(RARCH_CMD_SAVE_STATE);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Disallow savestate load when we absolutely cannot change game state.
|
// Disallow savestate load when we absolutely cannot change game state.
|
||||||
@ -3808,7 +3808,7 @@ static int menu_common_setting_set(unsigned setting, unsigned action)
|
|||||||
if (g_extern.netplay)
|
if (g_extern.netplay)
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
rarch_load_state();
|
rarch_main_command(RARCH_CMD_LOAD_STATE);
|
||||||
}
|
}
|
||||||
g_extern.lifecycle_state |= (1ULL << MODE_GAME);
|
g_extern.lifecycle_state |= (1ULL << MODE_GAME);
|
||||||
return -1;
|
return -1;
|
||||||
@ -3833,7 +3833,7 @@ static int menu_common_setting_set(unsigned setting, unsigned action)
|
|||||||
case MENU_SETTINGS_RESTART_GAME:
|
case MENU_SETTINGS_RESTART_GAME:
|
||||||
if (action == MENU_ACTION_OK)
|
if (action == MENU_ACTION_OK)
|
||||||
{
|
{
|
||||||
rarch_game_reset();
|
rarch_main_command(RARCH_CMD_RESET);
|
||||||
g_extern.lifecycle_state |= (1ULL << MODE_GAME);
|
g_extern.lifecycle_state |= (1ULL << MODE_GAME);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -357,13 +357,13 @@ static int menu_lakka_iterate(unsigned action)
|
|||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
global_alpha = 0.0;
|
global_alpha = 0.0;
|
||||||
rarch_save_state();
|
rarch_main_command(RARCH_CMD_SAVE_STATE);
|
||||||
g_extern.lifecycle_state |= (1ULL << MODE_GAME);
|
g_extern.lifecycle_state |= (1ULL << MODE_GAME);
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
global_alpha = 0.0;
|
global_alpha = 0.0;
|
||||||
rarch_load_state();
|
rarch_main_command(RARCH_CMD_LOAD_STATE);
|
||||||
g_extern.lifecycle_state |= (1ULL << MODE_GAME);
|
g_extern.lifecycle_state |= (1ULL << MODE_GAME);
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
@ -372,7 +372,7 @@ static int menu_lakka_iterate(unsigned action)
|
|||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
global_alpha = 0.0;
|
global_alpha = 0.0;
|
||||||
rarch_game_reset();
|
rarch_main_command(RARCH_CMD_RESET);
|
||||||
g_extern.lifecycle_state |= (1ULL << MODE_GAME);
|
g_extern.lifecycle_state |= (1ULL << MODE_GAME);
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
|
@ -87,6 +87,14 @@ extern "C" {
|
|||||||
|
|
||||||
#define MAX_PLAYERS 8
|
#define MAX_PLAYERS 8
|
||||||
|
|
||||||
|
enum basic_event
|
||||||
|
{
|
||||||
|
RARCH_CMD_RESET = 1,
|
||||||
|
RARCH_CMD_LOAD_STATE,
|
||||||
|
RARCH_CMD_SAVE_STATE,
|
||||||
|
RARCH_CMD_QUIT
|
||||||
|
};
|
||||||
|
|
||||||
enum menu_enums
|
enum menu_enums
|
||||||
{
|
{
|
||||||
MODE_GAME = 0,
|
MODE_GAME = 0,
|
||||||
@ -756,6 +764,7 @@ void rarch_main_init_wrap(const struct rarch_main_wrap *args, int *argc, char **
|
|||||||
|
|
||||||
int rarch_main_init(int argc, char *argv[]);
|
int rarch_main_init(int argc, char *argv[]);
|
||||||
bool rarch_main_idle_iterate(void);
|
bool rarch_main_idle_iterate(void);
|
||||||
|
void rarch_main_command(unsigned action);
|
||||||
bool rarch_main_iterate(void);
|
bool rarch_main_iterate(void);
|
||||||
void rarch_main_deinit(void);
|
void rarch_main_deinit(void);
|
||||||
void rarch_main_deinit_core(void);
|
void rarch_main_deinit_core(void);
|
||||||
|
22
retroarch.c
22
retroarch.c
@ -3078,6 +3078,28 @@ static inline void limit_frame_time(void)
|
|||||||
g_extern.frame_limit.last_frame_time = rarch_get_time_usec();
|
g_extern.frame_limit.last_frame_time = rarch_get_time_usec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO - can we refactor command.c to do this? Should be local and not
|
||||||
|
//stdin or network-based
|
||||||
|
|
||||||
|
void rarch_main_command(unsigned action)
|
||||||
|
{
|
||||||
|
switch (action)
|
||||||
|
{
|
||||||
|
case RARCH_CMD_RESET:
|
||||||
|
rarch_game_reset();
|
||||||
|
break;
|
||||||
|
case RARCH_CMD_LOAD_STATE:
|
||||||
|
rarch_load_state();
|
||||||
|
break;
|
||||||
|
case RARCH_CMD_SAVE_STATE:
|
||||||
|
rarch_save_state();
|
||||||
|
break;
|
||||||
|
case RARCH_CMD_QUIT:
|
||||||
|
g_extern.system.shutdown = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool rarch_main_iterate(void)
|
bool rarch_main_iterate(void)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user