diff --git a/CMakeLists.txt b/CMakeLists.txt index add8d5ba..adb0d59c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,6 +110,8 @@ endif() option(ENABLE_FFMPEG "Enable ffmpeg A/V recording" ${FFMPEG_DEFAULT}) +option(ENABLE_ONLINEUPDATES "Enable online update checks" ON) + set(LTO_DEFAULT ON) # lto produces buggy binaries for 64 bit win32 @@ -293,6 +295,10 @@ if(ENABLE_FFMPEG) endif() endif() +if(NOT ENABLE_ONLINEUPDATES) + add_definitions(-DNO_ONLINEUPDATES) +endif() + if(NOT ENABLE_FFMPEG) add_definitions(-DNO_FFMPEG) endif() @@ -444,7 +450,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL Clang) if(X86_32 OR AMD64) set(MY_C_OPT_FLAGS ${MY_C_OPT_FLAGS} -mtune=generic) endif() - + # common debug flags if(CMAKE_COMPILER_IS_GNUCXX) set(MY_C_DBG_FLAGS -ggdb3 -Og -fno-omit-frame-pointer) diff --git a/README.md b/README.md index fc138bbe..8576f95d 100644 --- a/README.md +++ b/README.md @@ -166,6 +166,7 @@ Here is the complete list: | ENABLE_LINK | Enable GBA linking functionality (requires SFML) | ON | | ENABLE_LIRC | Enable LIRC support | OFF | | ENABLE_FFMPEG | Enable ffmpeg A/V recording | OFF | +| ENABLE_ONLINEUPDATES | Enable online update checks | ON | | ENABLE_LTO | Compile with Link Time Optimization (gcc and clang only) | ON for release build | | ENABLE_GBA_LOGGING | Enable extended GBA logging | ON | | ENABLE_DIRECT3D | Direct3D rendering for wxWidgets (Windows, **NOT IMPLEMENTED!!!**) | ON | diff --git a/src/wx/guiinit.cpp b/src/wx/guiinit.cpp index c9392db7..4030f718 100644 --- a/src/wx/guiinit.cpp +++ b/src/wx/guiinit.cpp @@ -3330,10 +3330,36 @@ bool MainFrame::BindControls() sc->SetValidator(wxUIntValidator(&o)); \ } while (0) { +#ifndef NO_ONLINEUPDATES // Online Auto Update check frequency getrbi("UpdateNever", gopts.onlineupdates, 0); getrbi("UpdateDaily", gopts.onlineupdates, 1); getrbi("UpdateWeekly", gopts.onlineupdates, 7); +#else + wxWindowList &children = d->GetChildren(); + std::vector forDeletion; + for (wxWindowList::Node *node = children.GetFirst(); node; node = node->GetNext()) + { + wxWindow *current = (wxWindow *)node->GetData(); + if (dynamic_cast(current)) + { + if (((wxStaticText *)current)->GetName() == wxT("OnlineUpdates")) + forDeletion.push_back(current); + } + else if (dynamic_cast(current)) + { + wxString tmp = ((wxRadioButton *)current)->GetName(); + if (tmp == wxT("UpdateNever") || + tmp == wxT("UpdateDaily") || + tmp == wxT("UpdateWeekly")) + forDeletion.push_back(current); + } + } + for (unsigned i = 0; i < forDeletion.size(); ++i) + { + delete forDeletion[i]; + } +#endif // NO_ONLINEUPDATES getrbi("PNG", captureFormat, 0); getrbi("BMP", captureFormat, 1); getsc("RewindInterval", gopts.rewind_interval); diff --git a/src/wx/opts.cpp b/src/wx/opts.cpp index 400fa62c..abbe48da 100644 --- a/src/wx/opts.cpp +++ b/src/wx/opts.cpp @@ -225,7 +225,9 @@ opt_desc opts[] = { BOOLOPT("General/AutoLoadLastState", "", wxTRANSLATE("Automatically load last saved state"), gopts.autoload_state), STROPT("General/BatteryDir", "", wxTRANSLATE("Directory to store game save files (relative paths are relative to ROM; blank is config dir)"), gopts.battery_dir), BOOLOPT("General/FreezeRecent", "", wxTRANSLATE("Freeze recent load list"), gopts.recent_freeze), +#ifndef NO_ONLINEUPDATES ENUMOPT("General/OnlineUpdates", "", wxTRANSLATE("Automatically check for online updates"), gopts.onlineupdates, wxTRANSLATE("never|daily|weekly")), +#endif // NO_ONLINEUPDATES STROPT("General/RecordingDir", "", wxTRANSLATE("Directory to store A/V and game recordings (relative paths are relative to ROM)"), gopts.recording_dir), INTOPT("General/RewindInterval", "", wxTRANSLATE("Number of seconds between rewind snapshots (0 to disable)"), gopts.rewind_interval, 0, 600), STROPT("General/ScreenshotDir", "", wxTRANSLATE("Directory to store screenshots (relative paths are relative to ROM)"), gopts.scrshot_dir), @@ -350,7 +352,9 @@ opts_t::opts_t() autofire_rate = 1; print_auto_page = true; autoPatch = true; +#ifndef NO_ONLINEUPDATES onlineupdates = 1; +#endif // NO_ONLINEUPDATES // quick fix for issues #48 and #445 link_host = "127.0.0.1"; } diff --git a/src/wx/opts.h b/src/wx/opts.h index a8b0b3f6..e24c525f 100644 --- a/src/wx/opts.h +++ b/src/wx/opts.h @@ -42,7 +42,9 @@ extern struct opts_t { /// General bool autoload_state, autoload_cheats; wxString battery_dir; +#ifndef NO_ONLINEUPDATES int onlineupdates; +#endif // NO_ONLINEUPDATES long last_update; wxString last_updated_filename; bool recent_freeze; diff --git a/src/wx/xrc/GeneralConfig.xrc b/src/wx/xrc/GeneralConfig.xrc index fc8a6cd6..bcd0433e 100644 --- a/src/wx/xrc/GeneralConfig.xrc +++ b/src/wx/xrc/GeneralConfig.xrc @@ -22,7 +22,7 @@ - + wxALL|wxALIGN_CENTRE_VERTICAL