From 09d2ec7d3a0fea27a2e746276ef743ad59e5ca2e Mon Sep 17 00:00:00 2001 From: Themaister Date: Wed, 30 Nov 2011 16:41:00 +0100 Subject: [PATCH 1/2] Do not build in anything netplay related if not included. --- general.h | 2 ++ ssnes.c | 26 ++++++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/general.h b/general.h index 2cea58f116..cc6eab9af4 100644 --- a/general.h +++ b/general.h @@ -294,12 +294,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 diff --git a/ssnes.c b/ssnes.c index 0eeac619d0..407e4f25dd 100644 --- a/ssnes.c +++ b/ssnes.c @@ -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" @@ -791,6 +790,7 @@ static void parse_input(int argc, char *argv[]) } break; +#ifdef HAVE_NETPLAY case 'H': g_extern.netplay_enable = true; break; @@ -805,6 +805,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 +825,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 +1862,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 +1901,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 +1964,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 +1989,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 +2002,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 +2069,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 From 5969655c3c09185e585952f28c842e48ccf8fa0f Mon Sep 17 00:00:00 2001 From: Themaister Date: Wed, 30 Nov 2011 16:43:09 +0100 Subject: [PATCH 2/2] Do not allow netplay args if not compiled in. --- ssnes.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ssnes.c b/ssnes.c index 407e4f25dd..73be59b6c1 100644 --- a/ssnes.c +++ b/ssnes.c @@ -618,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' }, @@ -648,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;