Auto hookup gamepad ports on startup

This commit is contained in:
twinaphex 2014-06-18 22:20:38 +02:00
parent 5ee9c30c32
commit 310b9b5aa2

View File

@ -28,10 +28,6 @@ static MDFN_Surface *surf;
static bool failed_init;
static void hookup_ports(bool force);
static bool initial_ports_hookup = false;
std::string retro_base_directory;
std::string retro_base_name;
std::string retro_save_directory;
@ -249,20 +245,6 @@ static void check_variables(void)
#define MAX_BUTTONS 13
static uint8_t input_buf[MAX_PLAYERS][2] = {0};
static void hookup_ports(bool force)
{
MDFNGI *currgame = game;
if (initial_ports_hookup && !force)
return;
// Possible endian bug ...
for (unsigned i = 0; i < MAX_PLAYERS; i++)
currgame->SetInput(i, "gamepad", &input_buf[i][0]);
initial_ports_hookup = true;
}
bool retro_load_game(const struct retro_game_info *info)
{
if (failed_init)
@ -294,6 +276,10 @@ bool retro_load_game(const struct retro_game_info *info)
check_variables();
// Possible endian bug ...
for (unsigned i = 0; i < MAX_PLAYERS; i++)
game->SetInput(i, "gamepad", &input_buf[i][0]);
return game;
}