Merge branch 'master' of github.com:Themaister/SSNES into ssnes-consoles

This commit is contained in:
TwinAphex51224 2011-11-30 16:38:53 +01:00
commit 6da64013fa
2 changed files with 33 additions and 5 deletions

View File

@ -296,12 +296,14 @@ struct global
autosave_t *autosave[2];
// Netplay.
#ifdef HAVE_NETPLAY
netplay_t *netplay;
char netplay_server[MAXPATHLEN];
bool netplay_enable;
bool netplay_is_client;
unsigned netplay_sync_frames;
uint16_t netplay_port;
#endif
// FFmpeg record.
#ifdef HAVE_FFMPEG

36
ssnes.c
View File

@ -29,7 +29,6 @@
#include "record/ffemu.h"
#include "rewind.h"
#include "movie.h"
#include "netplay.h"
#include "strl.h"
#include "screenshot.h"
#include "cheats.h"
@ -619,10 +618,12 @@ static void parse_input(int argc, char *argv[])
{ "bsvplay", 1, NULL, 'P' },
{ "bsvrecord", 1, NULL, 'R' },
{ "sram-mode", 1, NULL, 'M' },
#ifdef HAVE_NETPLAY
{ "host", 0, NULL, 'H' },
{ "connect", 1, NULL, 'C' },
{ "frames", 1, NULL, 'F' },
{ "port", 1, &val, 'p' },
#endif
{ "ups", 1, NULL, 'U' },
{ "bps", 1, &val, 'B' },
{ "xml", 1, NULL, 'X' },
@ -649,7 +650,13 @@ static void parse_input(int argc, char *argv[])
#define DYNAMIC_ARG
#endif
char optstring[] = "hs:fvS:m:p4jJg:b:B:Y:Z:P:R:M:HC:F:U:DN:X:" DYNAMIC_ARG FFMPEG_RECORD_ARG CONFIG_FILE_ARG;
#ifdef HAVE_NETPLAY
#define NETPLAY_ARG "HC:F:"
#else
#define NETPLAY_ARG
#endif
char optstring[] = "hs:fvS:m:p4jJg:b:B:Y:Z:P:R:M:U:DN:X:" NETPLAY_ARG DYNAMIC_ARG FFMPEG_RECORD_ARG CONFIG_FILE_ARG;
for (;;)
{
val = 0;
@ -791,6 +798,7 @@ static void parse_input(int argc, char *argv[])
}
break;
#ifdef HAVE_NETPLAY
case 'H':
g_extern.netplay_enable = true;
break;
@ -805,6 +813,7 @@ static void parse_input(int argc, char *argv[])
if (g_extern.netplay_sync_frames > 16)
g_extern.netplay_sync_frames = 16;
break;
#endif
case 'U':
strlcpy(g_extern.ups_name, optarg, sizeof(g_extern.ups_name));
@ -824,9 +833,11 @@ static void parse_input(int argc, char *argv[])
case 0:
switch (val)
{
#ifdef HAVE_NETPLAY
case 'p':
g_extern.netplay_port = strtoul(optarg, NULL, 0);
break;
#endif
case 'B':
strlcpy(g_extern.bps_name, optarg, sizeof(g_extern.bps_name));
@ -1859,8 +1870,10 @@ static void do_state_checks(void)
check_screenshot();
check_mute();
#ifdef HAVE_NETPLAY
if (!g_extern.netplay)
{
#endif
check_pause();
check_oneshot();
@ -1896,9 +1909,11 @@ static void do_state_checks(void)
check_dsp_config();
#endif
check_reset();
#ifdef HAVE_NETPLAY
}
else
check_fullscreen();
#endif
#ifdef HAVE_DYLIB
// DSP plugin doesn't use variable input rate.
@ -1957,7 +1972,9 @@ int main(int argc, char *argv[])
#endif
init_drivers();
#ifdef HAVE_NETPLAY
if (!g_extern.netplay)
#endif
init_rewind();
#ifdef HAVE_NETPLAY
@ -1980,8 +1997,11 @@ int main(int argc, char *argv[])
init_recording();
#endif
bool use_sram = !g_extern.netplay_is_client &&
!g_extern.sram_save_disable;
#ifdef HAVE_NETPLAY
bool use_sram = !g_extern.sram_save_disable && !g_extern.netplay_is_client;
#else
bool use_sram = !g_extern.sram_save_disable;
#endif
if (!use_sram)
SSNES_LOG("SRAM will not be saved!\n");
@ -1990,7 +2010,11 @@ int main(int argc, char *argv[])
init_autosave();
#ifdef HAVE_XML
if (!g_extern.netplay && !g_extern.bsv.movie)
#ifdef HAVE_NETPLAY
if (!g_extern.bsv.movie && !g_extern.netplay)
#else
if (!g_extern.bsv.movie)
#endif
init_cheats();
#endif
@ -2053,7 +2077,9 @@ int main(int argc, char *argv[])
if (use_sram)
save_files();
#ifdef HAVE_NETPLAY
if (!g_extern.netplay)
#endif
deinit_rewind();
#ifdef HAVE_XML