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]; autosave_t *autosave[2];
// Netplay. // Netplay.
#ifdef HAVE_NETPLAY
netplay_t *netplay; netplay_t *netplay;
char netplay_server[MAXPATHLEN]; char netplay_server[MAXPATHLEN];
bool netplay_enable; bool netplay_enable;
bool netplay_is_client; bool netplay_is_client;
unsigned netplay_sync_frames; unsigned netplay_sync_frames;
uint16_t netplay_port; uint16_t netplay_port;
#endif
// FFmpeg record. // FFmpeg record.
#ifdef HAVE_FFMPEG #ifdef HAVE_FFMPEG

36
ssnes.c
View File

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