Skip to content

Commit

Permalink
[LINUX] Add option to disable the online updater.
Browse files Browse the repository at this point in the history
Add option to remove all configuration related to checking for updates
online. Although it is not implemented at the moment, these options
appeared on our menu `Options` > `General ...`.

- Fix need of patch on #140.
  • Loading branch information
denisfa authored and rkitover committed Jul 25, 2019
1 parent dbb5914 commit 060da96
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 2 deletions.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -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 |
Expand Down
26 changes: 26 additions & 0 deletions src/wx/guiinit.cpp
Expand Up @@ -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<wxWindow*> forDeletion;
for (wxWindowList::Node *node = children.GetFirst(); node; node = node->GetNext())
{
wxWindow *current = (wxWindow *)node->GetData();
if (dynamic_cast<wxStaticText*>(current))
{
if (((wxStaticText *)current)->GetName() == wxT("OnlineUpdates"))
forDeletion.push_back(current);
}
else if (dynamic_cast<wxRadioButton*>(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);
Expand Down
4 changes: 4 additions & 0 deletions src/wx/opts.cpp
Expand Up @@ -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),
Expand Down Expand Up @@ -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";
}
Expand Down
2 changes: 2 additions & 0 deletions src/wx/opts.h
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/wx/xrc/GeneralConfig.xrc
Expand Up @@ -22,7 +22,7 @@
<object class="sizeritem">
<object class="wxBoxSizer">
<object class="sizeritem">
<object class="wxStaticText">
<object class="wxStaticText" name="OnlineUpdates">
<label>Check for updates:</label>
</object>
<flag>wxALL|wxALIGN_CENTRE_VERTICAL</flag>
Expand Down

0 comments on commit 060da96

Please sign in to comment.