[Windows] Enable winsparkle update checker.

Remove traces of previous update checker.

We use version 0.6.0 available here:

https://github.com/vslavik/winsparkle/releases

We only support on Windows at the moment using `winspakrle`. So remove
this item for other platforms or when disabled in compilation.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Edênis Freindorfer Azevedo 2019-10-02 21:34:55 -03:00 committed by Rafael Kitover
parent 3f39bcd04f
commit 76803caf5f
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
8 changed files with 91 additions and 79 deletions

33
data/appcast.xml Normal file
View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
<channel>
<item>
<link>https://github.com/visualboyadvance-m/visualboyadvance-m/releases/download/v2.1.4/visualboyadvance-m-Win-64bit.zip</link>
<enclosure
sparkle:os="windows-x64"
sparkle:version="2.1.4"
length="0"
type="application/octet-stream"
/>
</item>
<item>
<link>https://github.com/visualboyadvance-m/visualboyadvance-m/releases/download/v2.1.4/visualboyadvance-m-Win-32bit.zip</link>
<enclosure
sparkle:os="windows-x86"
sparkle:version="2.1.4"
length="0"
type="application/octet-stream"
/>
</item>
<item>
<link>https://github.com/visualboyadvance-m/visualboyadvance-m/releases/download/v2.1.4/visualboyadvance-m-Mac-64bit.zip</link>
<enclosure
sparkle:os="macos"
sparkle:version="2.1.4"
length="0"
type="application/octet-stream"
/>
</item>
</channel>
</rss>

View File

@ -2693,6 +2693,21 @@ EVT_HANDLER(Customize, "Customize UI...")
update_opts();
}
#ifndef NO_ONLINEUPDATES
#ifdef __WXMSW__
#include "winsparkle-wrapper.h"
#endif
#endif
EVT_HANDLER(UpdateEmu, "Check for updates...")
{
#ifndef NO_ONLINEUPDATES
#ifdef __WXMSW__
win_sparkle_check_update_with_ui();
#endif
#endif
}
EVT_HANDLER(FactoryReset, "Factory Reset...")
{
wxMessageDialog dlg(NULL, wxString(wxT(

View File

@ -2850,6 +2850,16 @@ bool MainFrame::BindControls()
continue;
}
#endif
#if defined(NO_ONLINEUPDATES) || !defined(__WXMSW__)
if (cmdtab[i].cmd_id == XRCID("UpdateEmu"))
{
if (mi)
mi->GetMenu()->Remove(mi);
cmdtab[i].cmd_id = XRCID("NOOP");
cmdtab[i].mi = NULL;
continue;
}
#endif
if (mi) {
// wxgtk provides no way to retrieve stock label/accel
@ -3400,37 +3410,6 @@ 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, 2);
#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];
}
std::vector<wxWindow*>().swap(forDeletion);
#endif // NO_ONLINEUPDATES
getrbi("PNG", captureFormat, 0);
getrbi("BMP", captureFormat, 1);
getsc("RewindInterval", gopts.rewind_interval);

View File

@ -234,9 +234,6 @@ 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),
@ -361,9 +358,6 @@ 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";
}

View File

@ -43,9 +43,6 @@ 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;

View File

@ -185,6 +185,25 @@ wxString wxvbamApp::GetAbsolutePath(wxString path)
return path;
}
#ifndef NO_ONLINEUPDATES
#include "../common/version_cpp.h"
#ifdef __WXMSW__
#include "winsparkle-wrapper.h"
#endif // __WXMSW__
static void init_check_for_updates()
{
#ifdef __WXMSW__
wxString version(vbam_version);
//win_sparkle_set_appcast_url("https://github.com/visualboyadvance-m/visualboyadvance-m/data/appcast.xml");
win_sparkle_set_appcast_url("https://raw.githubusercontent.com/visualboyadvance-m/visualboyadvance-m/update-checker/data/appcast.xml");
win_sparkle_set_app_details(L"visualboyadvance-m", L"VisualBoyAdvance-M", version.c_str());
win_sparkle_init();
#endif // __WXMSW__
}
#endif // NO_ONLINEUPDATES
bool wxvbamApp::OnInit()
{
// set up logging
@ -432,6 +451,14 @@ bool wxvbamApp::OnInit()
frame->ShowFullScreen(isFullscreen);
frame->Show(true);
#if defined(__WXMSW__) && !defined(NO_ONLINEUPDATES)
winsparkle = new WinSparkleDllWrapper();
#endif
#ifndef NO_ONLINEUPDATES
init_check_for_updates();
#endif
return true;
}
@ -680,6 +707,11 @@ wxvbamApp::~wxvbamApp() {
home = NULL;
}
delete overrides;
#if defined(__WXMSW__) && !defined(NO_ONLINEUPDATES)
win_sparkle_cleanup();
delete winsparkle;
#endif
}
MainFrame::MainFrame()

View File

@ -19,44 +19,6 @@
<border>5</border>
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<object class="wxBoxSizer">
<object class="sizeritem">
<object class="wxStaticText" name="OnlineUpdates">
<label>Check for updates:</label>
</object>
<flag>wxALL|wxALIGN_CENTRE_VERTICAL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxRadioButton" name="UpdateNever">
<label>_Never</label>
<style>wxRB_GROUP</style>
</object>
<option>1</option>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxRadioButton" name="UpdateDaily">
<label>_Daily</label>
</object>
<option>1</option>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxRadioButton" name="UpdateWeekly">
<label>_Weekly</label>
</object>
<option>1</option>
<flag>wxALL</flag>
<border>5</border>
</object>
<orient>wxHORIZONTAL</orient>
</object>
<flag>wxEXPAND</flag>
</object>
<object class="sizeritem">
<object class="wxBoxSizer">
<object class="sizeritem">

View File

@ -704,10 +704,10 @@
<object class="wxMenuItem" name="UpdateRDB">
<label>Update ROM database</label>
</object>
-->
<object class="wxMenuItem" name="UpdateEmu">
<label>Check for updates</label>
</object>
-->
<object class="wxMenuItem" name="FactoryReset">
<label>_Factory Reset...</label>
</object>