From c21539d26901fe35f618f8f8f3d734a459336a9a Mon Sep 17 00:00:00 2001 From: Brandon Wright Date: Sat, 1 Dec 2018 19:58:13 -0600 Subject: [PATCH] GTK+: Mandate Netplay, Joystick, JMA. --- gtk/Makefile.am | 8 ---- gtk/configure.ac | 73 +++++++---------------------------- gtk/src/gtk_config.cpp | 30 ++++----------- gtk/src/gtk_config.h | 7 ---- gtk/src/gtk_control.cpp | 15 +------- gtk/src/gtk_control.h | 5 --- gtk/src/gtk_display.cpp | 5 +-- gtk/src/gtk_preferences.cpp | 51 +------------------------ gtk/src/gtk_preferences.h | 3 -- gtk/src/gtk_s9x.cpp | 76 +++++++++++++------------------------ gtk/src/gtk_s9xcore.h | 5 +-- gtk/src/gtk_s9xwindow.cpp | 25 +----------- gtk/src/gtk_sound.cpp | 7 +--- 13 files changed, 55 insertions(+), 255 deletions(-) diff --git a/gtk/Makefile.am b/gtk/Makefile.am index 627ed9aa..548f924c 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -88,11 +88,9 @@ snes9x_gtk_SOURCES += \ src/gtk_sound_driver_oss.cpp endif -if SDL snes9x_gtk_SOURCES += \ src/gtk_sound_driver_sdl.h \ src/gtk_sound_driver_sdl.cpp -endif if ALSA snes9x_gtk_SOURCES += \ @@ -183,11 +181,9 @@ snes9x_gtk_SOURCES += \ snes9x_gtk_SOURCES += ../sdd1emu.cpp -if NETPLAY snes9x_gtk_SOURCES += \ ../netplay.cpp \ ../server.cpp -endif # Zip support is nonconfigurable. @@ -201,7 +197,6 @@ snes9x_gtk_SOURCES += \ endif UNZIPDEFINES=-DUNZIP_SUPPORT -if JMA snes9x_gtk_LDADD += libjma.a noinst_LIBRARIES += libjma.a libjma_a_SOURCES = \ @@ -215,7 +210,6 @@ libjma_a_SOURCES = \ ../jma/lzmadec.cpp \ ../jma/winout.cpp libjma_a_CPPFLAGS = -fexceptions -endif if OPENGL snes9x_gtk_SOURCES += \ @@ -234,13 +228,11 @@ snes9x_gtk_SOURCES += \ src/gtk_display_driver_xv.h endif -if NETPLAY snes9x_gtk_SOURCES += \ src/gtk_netplay_dialog.cpp \ src/gtk_netplay_dialog.h \ src/gtk_netplay.cpp \ src/gtk_netplay.h -endif src/sourcify: src/sourcify.c $(CC) src/sourcify.c -o src/sourcify diff --git a/gtk/configure.ac b/gtk/configure.ac index f43bb592..38e937ef 100644 --- a/gtk/configure.ac +++ b/gtk/configure.ac @@ -51,12 +51,6 @@ AC_ARG_WITH(opengl, [], [with_opengl=yes]) -AC_ARG_WITH(joystick, - [AS_HELP_STRING([--with(out)-joystick], - [Enable joystick support if available (default: with)])], - [], - [with_joystick=yes]) - AC_ARG_WITH(xv, [AS_HELP_STRING([--with(out)-xv], [Enable XVideo output on GTK (default: with)])], @@ -105,18 +99,6 @@ AC_ARG_WITH(xbrz, [], [with_xbrz=yes]) -AC_ARG_WITH(netplay, - [AS_HELP_STRING([--with(out)-netplay], - [Enable netplay support (default: without)])], - [], - [with_netplay=yes]) - -AC_ARG_WITH(jma-decomp, - [AS_HELP_STRING([--with(out)-jma-decomp], - [Enable JMA archive decompression (default: with)])], - [], - [with_jma_decomp=yes]) - AC_ARG_WITH(zlib, [AS_HELP_STRING([--with(out)-zlib], [Support gzip decompression])], @@ -166,9 +148,6 @@ else fi LIBS="$LIBS -lX11 -ldl -lXext" - -JMA=yes -NETPLAY=yes OPENGL=no if test yes = "$with_opengl" ; then @@ -220,22 +199,20 @@ fi GTKJOY=no SDL_CFLAGS="" SDL_LIBS="" -if test yes = "$with_joystick"; then - PKG_CHECK_MODULES([SDL],[sdl2],[ - GTKJOY=yes - CFLAGS="$CFLAGS -DUSE_JOYSTICK" - ],[ - AC_CHECK_PROG(SDLCONFIGFOUND,[sdl2-config],yes,no) +PKG_CHECK_MODULES([SDL],[sdl2],[ + GTKJOY=yes +],[ + AC_CHECK_PROG(SDLCONFIGFOUND,[sdl2-config],yes,no) - if test yes = "$SDLCONFIGFOUND" ; then - SDL_CFLAGS="-DUSE_JOYSTICK `sdl2-config --cflags`" - SDL_LIBS="`sdl2-config --libs`" - GTKJOY=yes - else - echo "Cannot find SDL2. Disabling joystick support." - fi - ]) -fi + if test yes = "$SDLCONFIGFOUND" ; then + SDL_CFLAGS="`sdl2-config --cflags`" + SDL_LIBS="`sdl2-config --libs`" + GTKJOY=yes + else + echo "Cannot find SDL2." + exit + fi +]) XV=no XV_CFLAGS="" @@ -355,17 +332,7 @@ if test yes = "$with_debugger"; then CFLAGS="$CFLAGS -DDEBUGGER" fi -dnl Enable Netplay support if requested -if test yes = "$with_netplay"; then - CFLAGS="$CFLAGS -DNETPLAY_SUPPORT" - NETPLAY=yes -fi - -dnl Enable jma decompression (nachs own format) -if test yes = "$with_jma_decomp"; then - CFLAGS="$CFLAGS -DJMA_SUPPORT" - JMA=yes -fi +CFLAGS="$CFLAGS -DNETPLAY_SUPPORT -DJMA_SUPPORT" if test yes = "$with_zlib"; then AC_CHECK_HEADERS(zlib.h) @@ -456,14 +423,11 @@ CFLAGS="$CFLAGS -DUNZIP_SUPPORT -DSNES9X_GTK -I. -I.. $ZIP_CFLAGS" CXXFLAGS="$CFLAGS" -AM_CONDITIONAL(NETPLAY, [test yes = "$NETPLAY"]) -AM_CONDITIONAL(JMA, [test yes = "$JMA"]) AM_CONDITIONAL(OPENGL, [test yes = "$OPENGL"]) AM_CONDITIONAL(XV, [test yes = "$XV"]) AM_CONDITIONAL(PORTAUDIO, [test yes = "$PORTAUDIO"]) AM_CONDITIONAL(OSS, [test yes = "$OSS"]) AM_CONDITIONAL(DEBUG, [test yes = "$with_debug" ]) -AM_CONDITIONAL(SDL, [test yes = "$GTKJOY"]) AM_CONDITIONAL(ALSA, [test yes = "$ALSA"]) AM_CONDITIONAL(PULSEAUDIO, [test yes = "$PULSEAUDIO"]) AM_CONDITIONAL(HQ2X, [test yes = "$HQ2X"]) @@ -530,15 +494,6 @@ else fi fi -if test yes = "$NETPLAY" ; then - echo " NetPlay" -else - if test yes = "$with_netplay" ; then - echo "!!! NOT able to build NetPlay support" - - fi -fi - echo "" if ! test yes = "$PORTAUDIO" ; then diff --git a/gtk/src/gtk_config.cpp b/gtk/src/gtk_config.cpp index 1ccd4f21..f4e8f771 100644 --- a/gtk/src/gtk_config.cpp +++ b/gtk/src/gtk_config.cpp @@ -70,13 +70,8 @@ void S9xParsePortConfig (ConfigFile &conf, int pass) Snes9xConfig::Snes9xConfig () { -#ifdef USE_JOYSTICK joystick = NULL; joystick_threshold = 40; -#endif -#ifdef USE_OPENGL - opengl_activated = FALSE; -#endif } int Snes9xConfig::load_defaults () @@ -183,6 +178,9 @@ int Snes9xConfig::load_defaults () Settings.InterpolationMethod = DSP_INTERPOLATION_GAUSSIAN; Settings.HDMATimingHack = 100; Settings.SuperFXClockMultiplier = 100; + Settings.NetPlay = FALSE; + NetPlay.Paused = FALSE; + NetPlay.MaxFrameSkip = 10; #ifdef ALLOW_CPU_OVERCLOCK Settings.MaxSpriteTilesPerLine = 34; Settings.OneClockCycle = 6; @@ -190,20 +188,12 @@ int Snes9xConfig::load_defaults () Settings.TwoClockCycles = 12; #endif -#ifdef NETPLAY_SUPPORT - Settings.NetPlay = FALSE; - NetPlay.Paused = FALSE; - NetPlay.MaxFrameSkip = 10; -#endif - memset (pad, 0, sizeof (JoypadBinding) * NUM_JOYPADS); memset (shortcut, 0, sizeof (Binding) * NUM_EMU_LINKS); return 0; } -#ifdef USE_JOYSTICK - void Snes9xConfig::joystick_register_centers () { for (int i = 0; joystick[i] != NULL; i++) @@ -225,8 +215,6 @@ void Snes9xConfig::set_joystick_mode (int mode) joystick[i]->mode = mode; } -#endif - static inline void outbool (ConfigFile &cf, const char *key, bool value, const char *comment = "") { cf.SetBool (key, value, "true", "false", comment); @@ -394,9 +382,8 @@ int Snes9xConfig::save_config_file () cf.SetString (buffer, output_string); } -#ifdef USE_JOYSTICK cf.SetInt (z"JoystickThreshold", joystick_threshold); -#endif + #undef z for (int i = 0; i < NUM_JOYPADS; i++) @@ -584,7 +571,7 @@ int Snes9xConfig::load_config_file () inint (z"SuperFXClockMultiplier", Settings.SuperFXClockMultiplier); inint (z"SoundInterpolationMethod", Settings.InterpolationMethod); - bool RemoveSpriteLimit; + bool RemoveSpriteLimit = false; inbool (z"RemoveSpriteLimit", RemoveSpriteLimit); bool OverclockCPU = false; inbool (z"OverclockCPU", OverclockCPU); @@ -607,9 +594,8 @@ int Snes9xConfig::load_config_file () S9xSetController (i, CTL_MOUSE, i, 0, 0, 0); } -#ifdef USE_JOYSTICK inint (z"JoystickThreshold", joystick_threshold); -#endif + #undef z for (int i = 0; i < NUM_JOYPADS; i++) @@ -683,8 +669,8 @@ int Snes9xConfig::load_config_file () hires_effect = CLAMP (hires_effect, 0, 2); Settings.DynamicRateLimit = CLAMP (Settings.DynamicRateLimit, 1, 1000); Settings.SuperFXClockMultiplier = CLAMP (Settings.SuperFXClockMultiplier, 50, 400); - ntsc_scanline_intensity = CLAMP (ntsc_scanline_intensity, 0, 4); - scanline_filter_intensity = CLAMP (scanline_filter_intensity, 0, 3); + ntsc_scanline_intensity = MIN (ntsc_scanline_intensity, 4); + scanline_filter_intensity = MIN (scanline_filter_intensity, 3); return 0; } diff --git a/gtk/src/gtk_config.h b/gtk/src/gtk_config.h index 2168cf8f..607c3cdc 100644 --- a/gtk/src/gtk_config.h +++ b/gtk/src/gtk_config.h @@ -48,12 +48,9 @@ class Snes9xConfig int load_defaults (); void reconfigure (); void rebind_keys (); - -#ifdef USE_JOYSTICK void flush_joysticks (); void set_joystick_mode (int mode); void joystick_register_centers (); -#endif /* Screen options */ unsigned char full_screen_on_open; @@ -148,7 +145,6 @@ class Snes9xConfig #ifdef USE_OPENGL unsigned char sync_to_vblank; - unsigned char opengl_activated; unsigned char use_pbos; int pbo_format; unsigned char npot_textures; @@ -158,11 +154,8 @@ class Snes9xConfig unsigned char sync_every_frame; #endif -#ifdef USE_JOYSTICK JoyDevice **joystick; int joystick_threshold; -#endif - }; std::string get_config_dir (); diff --git a/gtk/src/gtk_control.cpp b/gtk/src/gtk_control.cpp index f622c615..e6febffb 100644 --- a/gtk/src/gtk_control.cpp +++ b/gtk/src/gtk_control.cpp @@ -5,9 +5,7 @@ \*****************************************************************************/ #include -#ifdef USE_JOYSTICK -# include "SDL.h" -#endif +#include "SDL.h" #include "gtk_s9xcore.h" #include "gtk_s9x.h" @@ -468,7 +466,6 @@ s9xcommand_t S9xGetPortCommandT (const char *name) void S9xProcessEvents (bool8 block) { -#ifdef USE_JOYSTICK JoyEvent event; Binding binding; @@ -486,10 +483,8 @@ void S9xProcessEvents (bool8 block) S9xReleaseJoysticks (); } -#endif } -#ifdef USE_JOYSTICK static void poll_joystick_events () { SDL_Event event; @@ -513,11 +508,9 @@ static void poll_joystick_events () } } } -#endif void S9xInitInputDevices () { -#ifdef USE_JOYSTICK SDL_Init (SDL_INIT_JOYSTICK); for (int i = 0; ; i++) @@ -539,7 +532,6 @@ void S9xInitInputDevices () gui_config->joystick[i]->joynum = i; } } -#endif //First plug in both, they'll change later as needed S9xSetController (0, CTL_JOYPAD, 0, 0, 0, 0); @@ -548,7 +540,6 @@ void S9xInitInputDevices () void S9xDeinitInputDevices () { -#ifdef USE_JOYSTICK for (int i = 0; gui_config->joystick[i] != NULL; i++) { delete gui_config->joystick[i]; @@ -557,11 +548,8 @@ void S9xDeinitInputDevices () free (gui_config->joystick); SDL_Quit (); -#endif } -#ifdef USE_JOYSTICK - JoyDevice::JoyDevice (unsigned int device_num) { enabled = false; @@ -830,4 +818,3 @@ void JoyDevice::flush () while (!queue.empty ()) queue.pop (); } -#endif diff --git a/gtk/src/gtk_control.h b/gtk/src/gtk_control.h index aaac3feb..26bae8da 100644 --- a/gtk/src/gtk_control.h +++ b/gtk/src/gtk_control.h @@ -10,9 +10,7 @@ #include #include "gtk_binding.h" -#ifdef USE_JOYSTICK #include "SDL.h" -#endif const int NUM_JOYPADS = 10; @@ -75,8 +73,6 @@ typedef struct JoypadBinding Binding data[NUM_JOYPAD_LINKS]; /* Avoid packing issues */ } JoypadBinding; -#ifdef USE_JOYSTICK - bool S9xGrabJoysticks (); void S9xReleaseJoysticks (); @@ -121,7 +117,6 @@ class JoyDevice void add_event (unsigned int parameter, unsigned int state); }; -#endif void S9xDeinitInputDevices (); Binding S9xGetBindingByName (const char *name); diff --git a/gtk/src/gtk_display.cpp b/gtk/src/gtk_display.cpp index aa64a1ae..d702ef35 100644 --- a/gtk/src/gtk_display.cpp +++ b/gtk/src/gtk_display.cpp @@ -1618,10 +1618,7 @@ S9xDeinitUpdate (int width, int height) } } - if (!Settings.Paused -#ifdef NETPLAY_SUPPORT - && !NetPlay.Paused -#endif + if (!Settings.Paused && !NetPlay.Paused ) { diff --git a/gtk/src/gtk_preferences.cpp b/gtk/src/gtk_preferences.cpp index 419b231b..3baefe0e 100644 --- a/gtk/src/gtk_preferences.cpp +++ b/gtk/src/gtk_preferences.cpp @@ -30,16 +30,12 @@ snes9x_preferences_open (GtkWidget *widget, gtk_window_set_transient_for (preferences.get_window (), window->get_window ()); -#ifdef USE_JOYSTICK config->set_joystick_mode (JOY_MODE_GLOBAL); -#endif preferences.show (); window->unpause_from_focus_change (); -#ifdef USE_JOYSTICK config->set_joystick_mode (JOY_MODE_INDIVIDUAL); -#endif config->reconfigure (); window->update_accels (); @@ -53,13 +49,11 @@ event_sram_folder_browse (GtkButton *widget, gpointer data) ((Snes9xPreferences *) data)->browse_folder_dialog (); } -#ifdef USE_JOYSTICK static void event_calibrate (GtkButton *widget, gpointer data) { ((Snes9xPreferences *) data)->calibration_dialog (); } -#endif static void event_control_toggle (GtkToggleButton *widget, gpointer data) @@ -384,8 +378,6 @@ event_control_combo_changed (GtkComboBox *widget, gpointer user_data) window->bindings_to_dialog (gtk_combo_box_get_active (widget)); } -#ifdef USE_JOYSTICK - static gboolean poll_joystick (gpointer data) { @@ -438,8 +430,6 @@ Snes9xPreferences::calibration_dialog () gtk_widget_destroy (dialog); } -#endif - static void event_input_rate_changed (GtkRange *range, gpointer data) { @@ -480,26 +470,6 @@ event_about_clicked (GtkButton *widget, gpointer data) (version_string += SNES9X_GTK_AUTHORS) += "\n"; (version_string += _("English localization by Brandon Wright")) += "\n"; -#if defined(USE_OPENGL) || defined(USE_XV) || defined(USE_XRANDR) \ - || defined(USE_JOYSTICK) || defined(NETPLAY_SUPPORT) - version_string += _("\nFeatures enabled:"); -#else - version_string += _(" Only barebones features enabled"); -#endif -#ifdef USE_OPENGL - version_string += _(" OpenGL"); -#endif -#ifdef USE_XV - version_string += _(" XVideo"); -#endif -#ifdef USE_JOYSTICK - version_string += _(" Joystick"); -#endif -#ifdef NETPLAY_SUPPORT - version_string += _(" NetPlay"); -#endif - version_string += ""; - GtkLabel *version_string_label = GTK_LABEL (about_dialog->get_widget ("version_string_label")); gtk_label_set_label (version_string_label, version_string.c_str ()); gtk_label_set_justify (version_string_label, GTK_JUSTIFY_LEFT); @@ -563,9 +533,7 @@ Snes9xPreferences::Snes9xPreferences (Snes9xConfig *config) : { "about_clicked", G_CALLBACK (event_about_clicked) }, { "auto_input_rate_toggled", G_CALLBACK (event_auto_input_rate_toggled) }, { "frameskip_combo_changed", G_CALLBACK (event_frameskip_combo_changed) }, -#ifdef USE_JOYSTICK { "calibrate", G_CALLBACK (event_calibrate) }, -#endif { NULL, NULL } }; @@ -697,9 +665,7 @@ Snes9xPreferences::move_settings_to_dialog () #ifdef USE_OSS num_sound_drivers++; #endif -#ifdef USE_JOYSTICK - num_sound_drivers++; -#endif + num_sound_drivers++; // SDL is automatically there. #ifdef USE_ALSA num_sound_drivers++; #endif @@ -747,12 +713,7 @@ Snes9xPreferences::move_settings_to_dialog () set_check ("use_shaders", config->use_shaders); set_entry_text ("fragment_shader", config->fragment_shader); #endif - -#ifdef USE_JOYSTICK set_spin ("joystick_threshold", config->joystick_threshold); -#else - gtk_widget_set_sensitive (get_widget ("joystick_box"), FALSE); -#endif /* Control bindings */ memcpy (pad, config->pad, (sizeof (JoypadBinding)) * NUM_JOYPADS); @@ -882,9 +843,7 @@ Snes9xPreferences::get_settings_from_dialog () } #endif -#ifdef USE_JOYSTICK config->joystick_threshold = get_spin ("joystick_threshold"); -#endif #ifdef USE_OPENGL int pbo_format = get_combo ("pixel_format") == 1 ? 32 : 16; @@ -1055,9 +1014,7 @@ Snes9xPreferences::show () gint result; GtkWidget *combo; int close_dialog; -#ifdef USE_JOYSTICK guint source_id = -1; -#endif #ifdef GDK_WINDOWING_X11 if (config->allow_xrandr) @@ -1132,10 +1089,8 @@ Snes9xPreferences::show () combo_box_append (GTK_COMBO_BOX (combo), _("Open Sound System")); #endif -#ifdef USE_JOYSTICK combo_box_append (GTK_COMBO_BOX (combo), _("SDL")); -#endif #ifdef USE_ALSA combo_box_append (GTK_COMBO_BOX (combo), _("ALSA")); @@ -1147,10 +1102,8 @@ Snes9xPreferences::show () move_settings_to_dialog (); -#ifdef USE_JOYSTICK S9xGrabJoysticks (); source_id = g_timeout_add (100, poll_joystick, (gpointer) this); -#endif if (config->preferences_width > 0 && config->preferences_height > 0) resize (config->preferences_width, config->preferences_height); @@ -1189,10 +1142,8 @@ Snes9xPreferences::show () } } -#ifdef USE_JOYSTICK g_source_remove (source_id); S9xReleaseJoysticks (); -#endif gtk_widget_destroy (window); } diff --git a/gtk/src/gtk_preferences.h b/gtk/src/gtk_preferences.h index 72645316..33f496a5 100644 --- a/gtk/src/gtk_preferences.h +++ b/gtk/src/gtk_preferences.h @@ -31,10 +31,7 @@ class Snes9xPreferences : public GtkBuilderWindow void reset_current_joypad (); void load_ntsc_settings (); void store_ntsc_settings (); - -#ifdef USE_JOYSTICK void calibration_dialog (); -#endif Snes9xConfig *config; GtkToggleButton *last_toggled; diff --git a/gtk/src/gtk_s9x.cpp b/gtk/src/gtk_s9x.cpp index 9b7951f1..d63f4b47 100644 --- a/gtk/src/gtk_s9x.cpp +++ b/gtk/src/gtk_s9x.cpp @@ -11,12 +11,9 @@ #include "gtk_control.h" #include "gtk_sound.h" #include "gtk_display.h" - +#include "gtk_netplay.h" #include "statemanager.h" -#ifdef NETPLAY_SUPPORT -#include "gtk_netplay.h" -#endif void S9xPostRomInit (); static void S9xThrottle (); @@ -135,9 +132,7 @@ int main (int argc, char *argv[]) top_level->enter_fullscreen_mode (); } -#ifdef USE_JOYSTICK gui_config->flush_joysticks (); -#endif gtk_window_present (top_level->get_window ()); @@ -158,9 +153,7 @@ int S9xOpenROM (const char *rom_filename) S9xAutoSaveSRAM (); } -#ifdef NETPLAY_SUPPORT S9xNetplayDisconnect (); -#endif flags = CPU.Flags; @@ -264,29 +257,23 @@ static gboolean S9xPauseFunc (gpointer data) if (!gui_config->rom_loaded) return TRUE; -#ifdef NETPLAY_SUPPORT if (!S9xNetplayPush ()) { S9xNetplayPop (); } -#endif if (!Settings.Paused) /* Coming out of pause */ { -#ifdef USE_JOYSTICK /* Clear joystick queues */ gui_config->flush_joysticks (); -#endif S9xSetSoundMute (FALSE); S9xSoundStart (); -#ifdef NETPLAY_SUPPORT if (Settings.NetPlay && NetPlay.Connected) { S9xNPSendPause (FALSE); } -#endif /* Resume high-performance callback */ idle_func_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, @@ -307,16 +294,12 @@ gboolean S9xIdleFunc (gpointer data) S9xSetSoundMute (gui_config->mute_sound); S9xSoundStop (); -#ifdef USE_JOYSTICK gui_config->flush_joysticks (); -#endif -#ifdef NETPLAY_SUPPORT if (Settings.NetPlay && NetPlay.Connected) { S9xNPSendPause (TRUE); } -#endif /* Move to a timer-based function to use less CPU */ g_timeout_add (100, S9xPauseFunc, NULL); @@ -328,47 +311,42 @@ gboolean S9xIdleFunc (gpointer data) S9xThrottle (); S9xProcessEvents (TRUE); -#ifdef NETPLAY_SUPPORT if (!S9xNetplayPush ()) { -#endif + if(Settings.Rewinding) + { + uint16 joypads[8]; + for (int i = 0; i < 8; i++) + joypads[i] = MovieGetJoypad(i); - if(Settings.Rewinding) - { - uint16 joypads[8]; - for (int i = 0; i < 8; i++) - joypads[i] = MovieGetJoypad(i); + Settings.Rewinding = state_manager.pop(); - Settings.Rewinding = state_manager.pop(); + for (int i = 0; i < 8; i++) + MovieSetJoypad (i, joypads[i]); + } + else if(IPPU.TotalEmulatedFrames % gui_config->rewind_granularity == 0) + state_manager.push(); - for (int i = 0; i < 8; i++) - MovieSetJoypad (i, joypads[i]); - } - else if(IPPU.TotalEmulatedFrames % gui_config->rewind_granularity == 0) - state_manager.push(); + static int muted_from_turbo = FALSE; + static int mute_saved_state = FALSE; - static int muted_from_turbo = FALSE; - static int mute_saved_state = FALSE; + if (Settings.TurboMode && !muted_from_turbo && gui_config->mute_sound_turbo) + { + muted_from_turbo = TRUE; + mute_saved_state = Settings.Mute; + S9xSetSoundMute (TRUE); + } - if (Settings.TurboMode && !muted_from_turbo && gui_config->mute_sound_turbo) - { - muted_from_turbo = TRUE; - mute_saved_state = Settings.Mute; - S9xSetSoundMute (TRUE); - } + if (!Settings.TurboMode && muted_from_turbo) + { + muted_from_turbo = FALSE; + Settings.Mute = mute_saved_state; + } - if (!Settings.TurboMode && muted_from_turbo) - { - muted_from_turbo = FALSE; - Settings.Mute = mute_saved_state; - } + S9xMainLoop (); - S9xMainLoop (); - -#ifdef NETPLAY_SUPPORT S9xNetplayPop (); } -#endif return TRUE; } @@ -464,10 +442,8 @@ static void S9xThrottle () { gint64 now; -#ifdef NETPLAY_SUPPORT if (S9xNetplaySyncSpeed ()) return; -#endif now = g_get_monotonic_time (); diff --git a/gtk/src/gtk_s9xcore.h b/gtk/src/gtk_s9xcore.h index 764549a1..2f36ad31 100644 --- a/gtk/src/gtk_s9xcore.h +++ b/gtk/src/gtk_s9xcore.h @@ -22,13 +22,10 @@ #include "cheats.h" #include "movie.h" #include "conffile.h" +#include "netplay.h" #include #include #include -#ifdef NETPLAY_SUPPORT -#include "netplay.h" -#endif - #endif /* __GTK_S9XCORE_H */ diff --git a/gtk/src/gtk_s9xwindow.cpp b/gtk/src/gtk_s9xwindow.cpp index 30a90bbd..f06a6911 100644 --- a/gtk/src/gtk_s9xwindow.cpp +++ b/gtk/src/gtk_s9xwindow.cpp @@ -29,9 +29,7 @@ #include "gtk_sound.h" #include "gtk_control.h" #include "gtk_cheat.h" -#ifdef NETPLAY_SUPPORT #include "gtk_netplay.h" -#endif static gboolean event_main_window_delete (GtkWidget *widget, @@ -116,9 +114,7 @@ event_show_statusbar (GtkWidget *widget, gpointer data) static gboolean event_sync_clients (GtkWidget *widget, gpointer data) { -#ifdef NETPLAY_SUPPORT S9xNetplaySyncClients (); -#endif return TRUE; } @@ -136,9 +132,8 @@ event_pause_item_activate (GtkWidget *widget, gpointer data) static gboolean event_open_netplay (GtkWidget *widget, gpointer data) { -#ifdef NETPLAY_SUPPORT S9xNetplayDialogOpen (); -#endif + return TRUE; } @@ -649,14 +644,6 @@ Snes9xWindow::Snes9xWindow (Snes9xConfig *config) : GTK_CHECK_MENU_ITEM (get_widget ("show_statusbar_item")), config->statusbar_visible ? 1 : 0); -#ifdef NETPLAY_SUPPORT -#else - gtk_widget_hide (get_widget ("open_netplay_item")); - gtk_widget_hide (get_widget ("netplay_separator")); - gtk_widget_hide (get_widget ("sync_clients_item")); - gtk_widget_hide (get_widget ("sync_clients_separator")); -#endif - #ifndef USE_OPENGL gtk_widget_hide (get_widget ("shader_parameters_separator")); gtk_widget_hide (get_widget ("shader_parameters_item")); @@ -736,11 +723,7 @@ Snes9xWindow::expose () config->window_height = get_height (); } - if (is_paused () -#ifdef NETPLAY_SUPPORT - || NetPlay.Paused -#endif - ) + if (is_paused () || NetPlay.Paused) { S9xDeinitUpdate (last_width, last_height); } @@ -1305,7 +1288,6 @@ Snes9xWindow::update_statusbar () } else { -#ifdef NETPLAY_SUPPORT if (config->netplay_activated) { if (config->netplay_server_up) @@ -1330,7 +1312,6 @@ Snes9xWindow::update_statusbar () } else -#endif { snprintf (status_string, 256, @@ -1424,12 +1405,10 @@ Snes9xWindow::configure_widgets () enable_widget ("cheats_item", config->rom_loaded); enable_widget ("rom_info_item", config->rom_loaded); -#ifdef NETPLAY_SUPPORT enable_widget ("sync_clients_item", config->rom_loaded && Settings.NetPlay && Settings.NetPlayServer); -#endif if (config->default_esc_behavior != ESC_TOGGLE_MENUBAR) { diff --git a/gtk/src/gtk_sound.cpp b/gtk/src/gtk_sound.cpp index bbff22db..a2bc695f 100644 --- a/gtk/src/gtk_sound.cpp +++ b/gtk/src/gtk_sound.cpp @@ -17,9 +17,7 @@ #ifdef USE_OSS #include "gtk_sound_driver_oss.h" #endif -#ifdef USE_JOYSTICK #include "gtk_sound_driver_sdl.h" -#endif #ifdef USE_ALSA #include "gtk_sound_driver_alsa.h" #endif @@ -85,12 +83,11 @@ S9xPortSoundInit () max_driver++; #endif -#ifdef USE_JOYSTICK + /* SDL */ alsa_driver++; pulse_driver++; max_driver++; -#endif #ifdef USE_ALSA max_driver++; @@ -114,10 +111,8 @@ S9xPortSoundInit () driver = new S9xOSSSoundDriver (); #endif -#ifdef USE_JOYSTICK if (gui_config->sound_driver == sdl_driver) driver = new S9xSDLSoundDriver (); -#endif #ifdef USE_ALSA if (gui_config->sound_driver == alsa_driver)