Bump to 8 players max. Futureproofing a bit.

This commit is contained in:
Themaister 2012-02-02 21:02:36 +01:00
parent 18c259e19a
commit 0cb2436a59
4 changed files with 19 additions and 9 deletions

View File

@ -67,7 +67,7 @@
#include "360/msvc_compat.h"
#endif
#define MAX_PLAYERS 7
#define MAX_PLAYERS 8
enum ssnes_shader_type
{

View File

@ -190,6 +190,7 @@ static bool video_ext_frame(void *data, const void *frame, unsigned width, unsig
static void *setup_input(ext_t *ext, const ssnes_input_driver_t *driver)
{
// TODO: Change external API to allow more players. Do be done in next major ABI break.
int joypad_index[5];
for (unsigned i = 0; i < 5; i++)
joypad_index[i] = g_settings.input.joypad_map[i] < 0 ? -1 : g_settings.input.joypad_map[i];

View File

@ -212,11 +212,11 @@ void config_set_defaults(void)
ssnes_assert(sizeof(g_settings.input.binds[0]) >= sizeof(snes_keybinds_1));
ssnes_assert(sizeof(g_settings.input.binds[1]) >= sizeof(snes_keybinds_rest));
memcpy(g_settings.input.binds[0], snes_keybinds_1, sizeof(snes_keybinds_1));
for (unsigned i = 1; i < 5; i++)
for (unsigned i = 1; i < MAX_PLAYERS; i++)
memcpy(g_settings.input.binds[i], snes_keybinds_rest, sizeof(snes_keybinds_rest));
// Verify that binds are in proper order.
for (unsigned i = 0; i < 5; i++)
for (unsigned i = 0; i < MAX_PLAYERS; i++)
for (unsigned j = 0; j < SSNES_BIND_LIST_END; j++)
if (g_settings.input.binds[i][j].valid)
ssnes_assert(j == g_settings.input.binds[i][j].id);
@ -418,11 +418,13 @@ bool config_load_file(const char *path)
CONFIG_GET_FLOAT(input.axis_threshold, "input_axis_threshold");
CONFIG_GET_BOOL(input.netplay_client_swap_input, "netplay_client_swap_input");
CONFIG_GET_INT(input.joypad_map[0], "input_player1_joypad_index");
CONFIG_GET_INT(input.joypad_map[1], "input_player2_joypad_index");
CONFIG_GET_INT(input.joypad_map[2], "input_player3_joypad_index");
CONFIG_GET_INT(input.joypad_map[3], "input_player4_joypad_index");
CONFIG_GET_INT(input.joypad_map[4], "input_player5_joypad_index");
for (unsigned i = 0; i < MAX_PLAYERS; i++)
{
char buf[64];
snprintf(buf, sizeof(buf), "input_player%u_joypad_index", i);
CONFIG_GET_INT(input.joypad_map[i], buf);
}
// Audio settings.
CONFIG_GET_BOOL(audio.enable, "audio_enable");
@ -563,6 +565,9 @@ static const struct bind_map bind_maps[MAX_PLAYERS][SSNES_BIND_LIST_END] = {
DECL_PLAYER(3),
DECL_PLAYER(4),
DECL_PLAYER(5),
DECL_PLAYER(6),
DECL_PLAYER(7),
DECL_PLAYER(8),
};
struct key_map

View File

@ -168,6 +168,10 @@
# input_player3_joypad_index = 2
# input_player4_joypad_index = 3
# input_player5_joypad_index = 4
# Player 6-8 is not directly expected by libsnes API, but we'll futureproof it.
# input_player6_joypad_index = 5
# input_player7_joypad_index = 6
# input_player8_joypad_index = 7
# Joypad buttons.
# Figure these out by using SSNES-Phoenix or ssnes-joyconfig.
@ -194,7 +198,7 @@
# input_player1_up_axis =
# input_player1_down_axis =
# This goes all the way to player 5 (*_player2_*, *_player3_*, etc), but omitted for clarity.
# This goes all the way to player 8 (*_player2_*, *_player3_*, etc), but omitted for clarity.
# Toggles fullscreen.
# input_toggle_fullscreen = f