(Menu) VERY WIP - Netplay options. Still lacks way to input a

name/IP address/port with a keyboard callback - also state
bringing up/teardown will need to be handled
This commit is contained in:
twinaphex 2014-03-02 04:46:26 +01:00
parent 3835db276f
commit 23489132b3
6 changed files with 106 additions and 0 deletions

View File

@ -300,6 +300,8 @@ static void rgui_render(void *data)
strlcpy(title, "INPUT OPTIONS", sizeof(title));
else if (menu_type == RGUI_SETTINGS_OVERLAY_OPTIONS)
strlcpy(title, "OVERLAY OPTIONS", sizeof(title));
else if (menu_type == RGUI_SETTINGS_NETPLAY_OPTIONS)
strlcpy(title, "NETPLAY OPTIONS", sizeof(title));
else if (menu_type == RGUI_SETTINGS_PATH_OPTIONS)
strlcpy(title, "PATH OPTIONS", sizeof(title));
else if (menu_type == RGUI_SETTINGS_OPTIONS)

View File

@ -166,6 +166,8 @@ static void rmenu_render(void *data)
strlcpy(title, "AUDIO OPTIONS", sizeof(title));
else if (menu_type == RGUI_SETTINGS_OVERLAY_OPTIONS)
strlcpy(title, "OVERLAY OPTIONS", sizeof(title));
else if (menu_type == RGUI_SETTINGS_NETPLAY_OPTIONS)
strlcpy(title, "NETPLAY OPTIONS", sizeof(title));
else if (menu_type == RGUI_SETTINGS_GENERAL_OPTIONS)
strlcpy(title, "GENERAL OPTIONS", sizeof(title));
else if (menu_type == RGUI_SETTINGS_PATH_OPTIONS)

View File

@ -370,6 +370,8 @@ static void rmenu_xui_render(void *data)
strlcpy(title, "INPUT OPTIONS", sizeof(title));
else if (menu_type == RGUI_SETTINGS_OVERLAY_OPTIONS)
strlcpy(title, "OVERLAY OPTIONS", sizeof(title));
else if (menu_type == RGUI_SETTINGS_NETPLAY_OPTIONS)
strlcpy(title, "NETPLAY OPTIONS", sizeof(title));
else if (menu_type == RGUI_SETTINGS_PATH_OPTIONS)
strlcpy(title, "PATH OPTIONS", sizeof(title));
else if (menu_type == RGUI_SETTINGS_OPTIONS)

View File

@ -945,6 +945,7 @@ static int menu_settings_iterate(void *data, unsigned action)
menu_type == RGUI_SETTINGS_INPUT_OPTIONS
|| menu_type == RGUI_SETTINGS_PATH_OPTIONS
|| menu_type == RGUI_SETTINGS_OVERLAY_OPTIONS
|| menu_type == RGUI_SETTINGS_NETPLAY_OPTIONS
|| menu_type == RGUI_SETTINGS_OPTIONS
|| menu_type == RGUI_SETTINGS_DRIVERS
|| menu_type == RGUI_SETTINGS_CORE_OPTIONS
@ -1942,6 +1943,9 @@ void menu_populate_entries(void *data, unsigned menu_type)
file_list_push(rgui->selection_buf, "Input Options", RGUI_SETTINGS_INPUT_OPTIONS, 0);
#ifdef HAVE_OVERLAY
file_list_push(rgui->selection_buf, "Overlay Options", RGUI_SETTINGS_OVERLAY_OPTIONS, 0);
#endif
#ifdef HAVE_NETPLAY
file_list_push(rgui->selection_buf, "Netplay Options (WIP)", RGUI_SETTINGS_NETPLAY_OPTIONS, 0);
#endif
file_list_push(rgui->selection_buf, "Path Options", RGUI_SETTINGS_PATH_OPTIONS, 0);
if (g_extern.main_is_init && !g_extern.libretro_dummy)
@ -1961,6 +1965,18 @@ void menu_populate_entries(void *data, unsigned menu_type)
file_list_push(rgui->selection_buf, "Overlay Opacity", RGUI_SETTINGS_OVERLAY_OPACITY, 0);
file_list_push(rgui->selection_buf, "Overlay Scale", RGUI_SETTINGS_OVERLAY_SCALE, 0);
break;
#ifdef HAVE_NETPLAY
case RGUI_SETTINGS_NETPLAY_OPTIONS:
file_list_clear(rgui->selection_buf);
file_list_push(rgui->selection_buf, "Netplay Enable", RGUI_SETTINGS_NETPLAY_ENABLE, 0);
file_list_push(rgui->selection_buf, "Netplay Mode", RGUI_SETTINGS_NETPLAY_MODE, 0);
file_list_push(rgui->selection_buf, "Spectator Mode Enable", RGUI_SETTINGS_NETPLAY_SPECTATOR_MODE_ENABLE, 0);
file_list_push(rgui->selection_buf, "Host IP Address", RGUI_SETTINGS_NETPLAY_HOST_IP_ADDRESS, 0);
file_list_push(rgui->selection_buf, "TCP/UDP Port", RGUI_SETTINGS_NETPLAY_TCP_UDP_PORT, 0);
file_list_push(rgui->selection_buf, "Delay Frames", RGUI_SETTINGS_NETPLAY_DELAY_FRAMES, 0);
file_list_push(rgui->selection_buf, "Nickname", RGUI_SETTINGS_NETPLAY_NICKNAME, 0);
break;
#endif
case RGUI_SETTINGS_PATH_OPTIONS:
file_list_clear(rgui->selection_buf);
file_list_push(rgui->selection_buf, "Content Directory", RGUI_BROWSER_DIR_PATH, 0);

View File

@ -111,6 +111,7 @@ typedef enum
RGUI_SETTINGS_INPUT_OPTIONS,
RGUI_SETTINGS_PATH_OPTIONS,
RGUI_SETTINGS_OVERLAY_OPTIONS,
RGUI_SETTINGS_NETPLAY_OPTIONS,
RGUI_SETTINGS_OPTIONS,
RGUI_SETTINGS_DRIVERS,
RGUI_SETTINGS_REWIND_ENABLE,
@ -160,6 +161,14 @@ typedef enum
RGUI_SETTINGS_RESUME_GAME,
RGUI_SETTINGS_QUIT_RARCH,
RGUI_SETTINGS_NETPLAY_ENABLE,
RGUI_SETTINGS_NETPLAY_MODE,
RGUI_SETTINGS_NETPLAY_SPECTATOR_MODE_ENABLE,
RGUI_SETTINGS_NETPLAY_HOST_IP_ADDRESS,
RGUI_SETTINGS_NETPLAY_TCP_UDP_PORT,
RGUI_SETTINGS_NETPLAY_DELAY_FRAMES,
RGUI_SETTINGS_NETPLAY_NICKNAME,
RGUI_SETTINGS_OVERLAY_PRESET,
RGUI_SETTINGS_OVERLAY_OPACITY,
RGUI_SETTINGS_OVERLAY_SCALE,
@ -233,6 +242,7 @@ typedef enum
RGUI_SETTINGS_CUSTOM_BIND_DEFAULT_ALL,
RGUI_SETTINGS_BIND_LAST = RGUI_SETTINGS_BIND_ANALOG_RIGHT_Y_MINUS,
RGUI_SETTINGS_CORE_OPTION_NONE = 0xffff,
RGUI_SETTINGS_CORE_OPTION_START = 0x10000
} rgui_file_type_t;

View File

@ -97,6 +97,7 @@ unsigned menu_type_is(unsigned type)
type == RGUI_SETTINGS_DISK_OPTIONS ||
type == RGUI_SETTINGS_PATH_OPTIONS ||
type == RGUI_SETTINGS_OVERLAY_OPTIONS ||
type == RGUI_SETTINGS_NETPLAY_OPTIONS ||
type == RGUI_SETTINGS_OPTIONS ||
type == RGUI_SETTINGS_DRIVERS ||
(type == RGUI_SETTINGS_INPUT_OPTIONS);
@ -1724,6 +1725,52 @@ int menu_set_settings(void *data, unsigned setting, unsigned action)
rarch_set_fullscreen(g_settings.video.fullscreen);
}
break;
#ifdef HAVE_NETPLAY
case RGUI_SETTINGS_NETPLAY_ENABLE:
if (action == RGUI_ACTION_OK || action == RGUI_ACTION_LEFT || action == RGUI_ACTION_RIGHT)
{
g_extern.netplay_enable = !g_extern.netplay_enable;
/* TODO/FIXME - toggle netplay on/off */
}
else if (action == RGUI_ACTION_START)
{
g_extern.netplay_enable = false;
/* TODO/FIXME - toggle netplay on/off */
}
break;
case RGUI_SETTINGS_NETPLAY_HOST_IP_ADDRESS:
//strlcpy(type_str, g_extern.netplay_server, type_str_size);
break;
case RGUI_SETTINGS_NETPLAY_DELAY_FRAMES:
if (action == RGUI_ACTION_LEFT)
{
if (g_extern.state_slot >= 0)
g_extern.netplay_sync_frames--;
}
else if (action == RGUI_ACTION_RIGHT)
g_extern.netplay_sync_frames++;
else if (action == RGUI_ACTION_START)
g_extern.netplay_sync_frames = 0;
break;
case RGUI_SETTINGS_NETPLAY_TCP_UDP_PORT:
//snprintf(type_str, type_str_size, "%d", g_extern.netplay_port ? g_extern.netplay_port : RARCH_DEFAULT_PORT);
break;
case RGUI_SETTINGS_NETPLAY_NICKNAME:
//snprintf(type_str, type_str_size, "%s", g_extern.netplay_nick);
break;
case RGUI_SETTINGS_NETPLAY_MODE:
if (action == RGUI_ACTION_OK || action == RGUI_ACTION_LEFT || action == RGUI_ACTION_RIGHT)
g_extern.netplay_is_client = !g_extern.netplay_is_client;
else if (action == RGUI_ACTION_START)
g_extern.netplay_is_client = false;
break;
case RGUI_SETTINGS_NETPLAY_SPECTATOR_MODE_ENABLE:
if (action == RGUI_ACTION_OK || action == RGUI_ACTION_LEFT || action == RGUI_ACTION_RIGHT)
g_extern.netplay_is_spectate = !g_extern.netplay_is_spectate;
else if (action == RGUI_ACTION_START)
g_extern.netplay_is_spectate = false;
break;
#endif
default:
break;
}
@ -1731,6 +1778,9 @@ int menu_set_settings(void *data, unsigned setting, unsigned action)
return 0;
}
#ifndef RARCH_DEFAULT_PORT
#define RARCH_DEFAULT_PORT 55435
#endif
void menu_set_settings_label(char *type_str, size_t type_str_size, unsigned *w, unsigned type)
{
@ -1972,6 +2022,7 @@ void menu_set_settings_label(char *type_str, size_t type_str_size, unsigned *w,
case RGUI_SETTINGS_INPUT_OPTIONS:
case RGUI_SETTINGS_PATH_OPTIONS:
case RGUI_SETTINGS_OVERLAY_OPTIONS:
case RGUI_SETTINGS_NETPLAY_OPTIONS:
case RGUI_SETTINGS_OPTIONS:
case RGUI_SETTINGS_DRIVERS:
case RGUI_SETTINGS_CUSTOM_BIND_ALL:
@ -2128,6 +2179,29 @@ void menu_set_settings_label(char *type_str, size_t type_str_size, unsigned *w,
case RGUI_SETTINGS_WINDOW_COMPOSITING_ENABLE:
strlcpy(type_str, g_settings.video.disable_composition ? "OFF" : "ON", type_str_size);
break;
#ifdef HAVE_NETPLAY
case RGUI_SETTINGS_NETPLAY_ENABLE:
strlcpy(type_str, g_extern.netplay_enable ? "ON" : "OFF", type_str_size);
break;
case RGUI_SETTINGS_NETPLAY_HOST_IP_ADDRESS:
strlcpy(type_str, g_extern.netplay_server, type_str_size);
break;
case RGUI_SETTINGS_NETPLAY_DELAY_FRAMES:
snprintf(type_str, type_str_size, "%d", g_extern.netplay_sync_frames);
break;
case RGUI_SETTINGS_NETPLAY_TCP_UDP_PORT:
snprintf(type_str, type_str_size, "%d", g_extern.netplay_port ? g_extern.netplay_port : RARCH_DEFAULT_PORT);
break;
case RGUI_SETTINGS_NETPLAY_NICKNAME:
snprintf(type_str, type_str_size, "%s", g_extern.netplay_nick);
break;
case RGUI_SETTINGS_NETPLAY_MODE:
snprintf(type_str, type_str_size, g_extern.netplay_is_client ? "Client" : "Server");
break;
case RGUI_SETTINGS_NETPLAY_SPECTATOR_MODE_ENABLE:
snprintf(type_str, type_str_size, g_extern.netplay_is_spectate ? "ON" : "OFF");
break;
#endif
default:
*type_str = '\0';
*w = 0;