diff --git a/po/wxvbam/wxvbam.pot b/po/wxvbam/wxvbam.pot index 17547af5..d1ef1f94 100644 --- a/po/wxvbam/wxvbam.pot +++ b/po/wxvbam/wxvbam.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-06-05 23:39+1000\n" +"POT-Creation-Date: 2015-06-08 16:23+1000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -397,52 +397,26 @@ msgstr "" msgid "Confirm Update" msgstr "" -#: ../src/wx/cmdevents.cpp:2505 -msgid "" -"Online updates are available on Windows only. Please browse this site for " -"updates.\n" -"\n" -"https://sourceforge.net/projects/vbam/files/latest/download" -msgstr "" - #: ../src/wx/cmdevents.cpp:2506 -msgid "Online Update" +msgid "There are no new updates at this time." msgstr "" -#: ../src/wx/cmdevents.cpp:2513 -msgid "" -"A new update is available. To update, VisualBoyAdvance-M must be Run as " -"administrator. Would you like to download and update VisualBoyAdvance-M?\n" -"\n" -"https://sourceforge.net/projects/vbam/files/latest/download" +#: ../src/wx/cmdevents.cpp:2507 ../src/wx/xrc/MainMenu.xrc:628 +msgid "Check for updates" msgstr "" -#: ../src/wx/cmdevents.cpp:2514 -msgid "New Update Available" -msgstr "" - -#: ../src/wx/cmdevents.cpp:2520 -msgid "" -"The update has been downloaded and installed. Please restart " -"VisualBoyAdvance-M." -msgstr "" - -#: ../src/wx/cmdevents.cpp:2521 -msgid "Update Downloaded" -msgstr "" - -#: ../src/wx/cmdevents.cpp:2544 +#: ../src/wx/cmdevents.cpp:2529 msgid "Nintendo GameBoy (+Color+Advance) emulator." msgstr "" -#: ../src/wx/cmdevents.cpp:2545 +#: ../src/wx/cmdevents.cpp:2530 msgid "" "Copyright (C) 1999-2003 Forgotten\n" "Copyright (C) 2004-2006 VBA development team\n" "Copyright (C) 2007-2015 VBA-M development team" msgstr "" -#: ../src/wx/cmdevents.cpp:2546 +#: ../src/wx/cmdevents.cpp:2531 msgid "" "This program is free software: you can redistribute it and/or modify\n" "it under the terms of the GNU General Public License as published by\n" @@ -458,11 +432,11 @@ msgid "" "along with this program. If not, see http://www.gnu.org/licenses ." msgstr "" -#: ../src/wx/cmdevents.cpp:2782 +#: ../src/wx/cmdevents.cpp:2767 msgid "LAN link is already active. Disable link mode to disconnect." msgstr "" -#: ../src/wx/cmdevents.cpp:2789 +#: ../src/wx/cmdevents.cpp:2774 msgid "Network is not supported in local mode." msgstr "" @@ -727,15 +701,15 @@ msgstr "" msgid "New Value" msgstr "" -#: ../src/wx/guiinit.cpp:3686 +#: ../src/wx/guiinit.cpp:3690 msgid "Menu commands" msgstr "" -#: ../src/wx/guiinit.cpp:3713 +#: ../src/wx/guiinit.cpp:3717 msgid "Other commands" msgstr "" -#: ../src/wx/guiinit.cpp:3825 +#: ../src/wx/guiinit.cpp:3829 msgid "JoyBus host invalid; disabling" msgstr "" @@ -745,23 +719,23 @@ msgid "" "runtime from http://openal.org" msgstr "" -#: ../src/wx/opts.cpp:500 ../src/wx/opts.cpp:835 +#: ../src/wx/opts.cpp:509 ../src/wx/opts.cpp:844 #, c-format msgid "Invalid value %s for option %s; valid values are %s%s%s" msgstr "" -#: ../src/wx/opts.cpp:533 ../src/wx/opts.cpp:857 +#: ../src/wx/opts.cpp:542 ../src/wx/opts.cpp:866 #, c-format msgid "Invalid value %d for option %s; valid values are %d - %d" msgstr "" -#: ../src/wx/opts.cpp:601 ../src/wx/opts.cpp:626 ../src/wx/opts.cpp:936 -#: ../src/wx/opts.cpp:965 +#: ../src/wx/opts.cpp:610 ../src/wx/opts.cpp:635 ../src/wx/opts.cpp:945 +#: ../src/wx/opts.cpp:974 #, c-format msgid "Invalid key binding %s for %s" msgstr "" -#: ../src/wx/opts.cpp:809 +#: ../src/wx/opts.cpp:818 #, c-format msgid "Invalid flag option %s - %s ignored" msgstr "" @@ -843,54 +817,54 @@ msgstr "" msgid "Not a valid GBA cartridge" msgstr "" -#: ../src/wx/panel.cpp:1109 +#: ../src/wx/panel.cpp:1122 msgid "No memory for rewinding" msgstr "" -#: ../src/wx/panel.cpp:1119 +#: ../src/wx/panel.cpp:1132 msgid "Error writing rewind state" msgstr "" -#: ../src/wx/panel.cpp:2330 +#: ../src/wx/panel.cpp:2343 msgid "Cannot create conversion buffer" msgstr "" -#: ../src/wx/panel.cpp:2405 +#: ../src/wx/panel.cpp:2418 msgid "memory allocation error" msgstr "" -#: ../src/wx/panel.cpp:2408 +#: ../src/wx/panel.cpp:2421 msgid "error initializing codec" msgstr "" -#: ../src/wx/panel.cpp:2411 +#: ../src/wx/panel.cpp:2424 msgid "error writing to output file" msgstr "" -#: ../src/wx/panel.cpp:2414 +#: ../src/wx/panel.cpp:2427 msgid "can't guess output format from file name" msgstr "" -#: ../src/wx/panel.cpp:2419 +#: ../src/wx/panel.cpp:2432 msgid "programming error; aborting!" msgstr "" -#: ../src/wx/panel.cpp:2432 ../src/wx/panel.cpp:2464 +#: ../src/wx/panel.cpp:2445 ../src/wx/panel.cpp:2477 #, c-format msgid "Unable to begin recording to %s (%s)" msgstr "" -#: ../src/wx/panel.cpp:2494 +#: ../src/wx/panel.cpp:2507 #, c-format msgid "Error in audio/video recording (%s); aborting" msgstr "" -#: ../src/wx/panel.cpp:2501 +#: ../src/wx/panel.cpp:2514 #, c-format msgid "Error in audio recording (%s); aborting" msgstr "" -#: ../src/wx/panel.cpp:2512 +#: ../src/wx/panel.cpp:2525 #, c-format msgid "Error in video recording (%s); aborting" msgstr "" @@ -1062,47 +1036,47 @@ msgstr "" msgid "vbam" msgstr "" -#: ../src/wx/wxvbam.cpp:322 +#: ../src/wx/wxvbam.cpp:324 msgid "Could not create main window" msgstr "" -#: ../src/wx/wxvbam.cpp:354 +#: ../src/wx/wxvbam.cpp:356 msgid "Save built-in XRC file and exit" msgstr "" -#: ../src/wx/wxvbam.cpp:358 +#: ../src/wx/wxvbam.cpp:360 msgid "Save built-in vba-over.ini and exit" msgstr "" -#: ../src/wx/wxvbam.cpp:362 +#: ../src/wx/wxvbam.cpp:364 msgid "Print configuration path and exit" msgstr "" -#: ../src/wx/wxvbam.cpp:366 +#: ../src/wx/wxvbam.cpp:368 msgid "Start in full-screen mode" msgstr "" -#: ../src/wx/wxvbam.cpp:371 +#: ../src/wx/wxvbam.cpp:373 msgid "Delete shared link state first, if it exists" msgstr "" -#: ../src/wx/wxvbam.cpp:379 +#: ../src/wx/wxvbam.cpp:381 msgid "List all settable options and exit" msgstr "" -#: ../src/wx/wxvbam.cpp:383 +#: ../src/wx/wxvbam.cpp:385 msgid "ROM file" msgstr "" -#: ../src/wx/wxvbam.cpp:387 +#: ../src/wx/wxvbam.cpp:389 msgid "=" msgstr "" -#: ../src/wx/wxvbam.cpp:421 +#: ../src/wx/wxvbam.cpp:423 msgid "Configuration/build error: can't find built-in xrc" msgstr "" -#: ../src/wx/wxvbam.cpp:429 +#: ../src/wx/wxvbam.cpp:431 #, c-format msgid "" "Wrote built-in configuration to %s.\n" @@ -1111,11 +1085,11 @@ msgid "" "built-in:" msgstr "" -#: ../src/wx/wxvbam.cpp:444 +#: ../src/wx/wxvbam.cpp:446 msgid "Configuration is read from, in order:" msgstr "" -#: ../src/wx/wxvbam.cpp:458 +#: ../src/wx/wxvbam.cpp:460 #, c-format msgid "" "Wrote built-in override file to %s\n" @@ -1123,13 +1097,13 @@ msgid "" "from search path:" msgstr "" -#: ../src/wx/wxvbam.cpp:463 +#: ../src/wx/wxvbam.cpp:465 msgid "" "\n" "\tbuilt-in" msgstr "" -#: ../src/wx/wxvbam.cpp:475 +#: ../src/wx/wxvbam.cpp:477 msgid "" "Options set from the command line are saved if any configuration changes are " "made in the user interface.\n" @@ -1138,16 +1112,50 @@ msgid "" "\n" msgstr "" -#: ../src/wx/wxvbam.cpp:502 +#: ../src/wx/wxvbam.cpp:504 msgid "" "The commands available for the Keyboard/* option are:\n" "\n" msgstr "" -#: ../src/wx/wxvbam.cpp:552 +#: ../src/wx/wxvbam.cpp:554 msgid "Bad configuration option or multiple ROM files given:\n" msgstr "" +#: ../src/wx/wxvbam.cpp:775 +msgid "" +"Online updates are available on Windows only. Please browse this site for " +"updates.\n" +"\n" +"https://sourceforge.net/projects/vbam/files/latest/download" +msgstr "" + +#: ../src/wx/wxvbam.cpp:776 +msgid "Online Update" +msgstr "" + +#: ../src/wx/wxvbam.cpp:790 +msgid "" +"A new update is available. To update, VisualBoyAdvance-M must be Run as " +"administrator. Would you like to download and update VisualBoyAdvance-M?\n" +"\n" +"https://sourceforge.net/projects/vbam/files/latest/download" +msgstr "" + +#: ../src/wx/wxvbam.cpp:791 +msgid "New Update Available" +msgstr "" + +#: ../src/wx/wxvbam.cpp:797 +msgid "" +"The update has been downloaded and installed. Please restart " +"VisualBoyAdvance-M." +msgstr "" + +#: ../src/wx/wxvbam.cpp:798 +msgid "Update Downloaded" +msgstr "" + #: ../src/wx/xaudio2.cpp:32 msgid "XAudio2: Enumerating devices failed!" msgstr "" @@ -2393,63 +2401,79 @@ msgid "General" msgstr "" #: ../src/wx/xrc/GeneralConfig.xrc:26 -msgid "Screenshot Format:" +msgid "Check for updates:" msgstr "" #: ../src/wx/xrc/GeneralConfig.xrc:33 -msgid "&PNG" +msgid "&Never" msgstr "" #: ../src/wx/xrc/GeneralConfig.xrc:42 +msgid "&Daily" +msgstr "" + +#: ../src/wx/xrc/GeneralConfig.xrc:50 +msgid "&Weekly" +msgstr "" + +#: ../src/wx/xrc/GeneralConfig.xrc:64 +msgid "Screenshot Format:" +msgstr "" + +#: ../src/wx/xrc/GeneralConfig.xrc:71 +msgid "&PNG" +msgstr "" + +#: ../src/wx/xrc/GeneralConfig.xrc:80 msgid "&BMP" msgstr "" -#: ../src/wx/xrc/GeneralConfig.xrc:57 +#: ../src/wx/xrc/GeneralConfig.xrc:95 msgid "&Rewind interval :" msgstr "" -#: ../src/wx/xrc/GeneralConfig.xrc:58 +#: ../src/wx/xrc/GeneralConfig.xrc:96 msgid "If not empty or 0, enable rewind (seconds)" msgstr "" -#: ../src/wx/xrc/GeneralConfig.xrc:67 +#: ../src/wx/xrc/GeneralConfig.xrc:105 msgid "seconds (0-600); 0 = disable" msgstr "" -#: ../src/wx/xrc/GeneralConfig.xrc:78 +#: ../src/wx/xrc/GeneralConfig.xrc:116 msgid "&Throttle" msgstr "" -#: ../src/wx/xrc/GeneralConfig.xrc:96 +#: ../src/wx/xrc/GeneralConfig.xrc:134 #, c-format msgid "% of normal:" msgstr "" -#: ../src/wx/xrc/GeneralConfig.xrc:106 +#: ../src/wx/xrc/GeneralConfig.xrc:144 msgid "0 = no throttle" msgstr "" -#: ../src/wx/xrc/GeneralConfig.xrc:115 +#: ../src/wx/xrc/GeneralConfig.xrc:153 msgid "No throttle" msgstr "" -#: ../src/wx/xrc/GeneralConfig.xrc:116 +#: ../src/wx/xrc/GeneralConfig.xrc:154 msgid "25%" msgstr "" -#: ../src/wx/xrc/GeneralConfig.xrc:117 +#: ../src/wx/xrc/GeneralConfig.xrc:155 msgid "50%" msgstr "" -#: ../src/wx/xrc/GeneralConfig.xrc:118 ../src/wx/xrc/SoundConfig.xrc:45 +#: ../src/wx/xrc/GeneralConfig.xrc:156 ../src/wx/xrc/SoundConfig.xrc:45 msgid "100%" msgstr "" -#: ../src/wx/xrc/GeneralConfig.xrc:119 +#: ../src/wx/xrc/GeneralConfig.xrc:157 msgid "150%" msgstr "" -#: ../src/wx/xrc/GeneralConfig.xrc:120 +#: ../src/wx/xrc/GeneralConfig.xrc:158 msgid "200%" msgstr "" @@ -3273,10 +3297,6 @@ msgstr "" msgid "Update ROM database" msgstr "" -#: ../src/wx/xrc/MainMenu.xrc:628 -msgid "Check for updates" -msgstr "" - #: ../src/wx/xrc/MapViewer.xrc:4 msgid "Map Viewer" msgstr "" diff --git a/src/wx/cmdevents.cpp b/src/wx/cmdevents.cpp index 3adb4607..d8b767a8 100644 --- a/src/wx/cmdevents.cpp +++ b/src/wx/cmdevents.cpp @@ -2501,25 +2501,10 @@ EVT_HANDLER(UpdateRDB, "Update ROM database") EVT_HANDLER(UpdateEmu, "Check for updates") { -#ifndef __WXMSW__ - int ret = wxMessageBox(_("Online updates are available on Windows only. Please browse this site for updates.\n\nhttps://sourceforge.net/projects/vbam/files/latest/download"), - _("Online Update"), wxOK | wxICON_INFORMATION); - return; -#endif - wxString update_url = CheckForUpdates(_T("sourceforge.net"), _T("/projects/vbam/files/latest/download")); - - if (!update_url.IsEmpty()) + if (!CheckForUpdates()) { - int ret = wxMessageBox(_("A new update is available. To update, VisualBoyAdvance-M must be Run as administrator. Would you like to download and update VisualBoyAdvance-M?\n\nhttps://sourceforge.net/projects/vbam/files/latest/download"), - _("New Update Available"), wxYES_NO | wxICON_QUESTION); - - if (ret == wxYES) - { - wxURL url(update_url); - UpdateFile(url.GetServer(), url.GetPath()); - ret = wxMessageBox(_("The update has been downloaded and installed. Please restart VisualBoyAdvance-M."), - _("Update Downloaded"), wxOK | wxICON_INFORMATION); - } + wxMessageBox(_("There are no new updates at this time."), + _("Check for updates"), wxOK | wxICON_INFORMATION); } } diff --git a/src/wx/guiinit.cpp b/src/wx/guiinit.cpp index 77a654f7..f65886f9 100644 --- a/src/wx/guiinit.cpp +++ b/src/wx/guiinit.cpp @@ -3335,6 +3335,10 @@ bool MainFrame::BindControls() sc->SetValidator(wxGenericValidator(&o)); \ } while(0) { + // Online Auto Update check frequency + getrbi("UpdateNever", gopts.onlineupdates, 0); + getrbi("UpdateDaily", gopts.onlineupdates, 1); + getrbi("UpdateWeekly", gopts.onlineupdates, 7); 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 27e5fdcb..9a2e3e5a 100644 --- a/src/wx/opts.cpp +++ b/src/wx/opts.cpp @@ -178,6 +178,7 @@ 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), + ENUMOPT("General/OnlineUpdates", "", wxTRANSLATE("Automatically check for online updates"), gopts.onlineupdates, wxTRANSLATE("never|daily|weekly")), 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), @@ -299,6 +300,7 @@ opts_t::opts_t() autofire_rate = 1; print_auto_page = true; autoPatch = true; + onlineupdates = 1; } // for binary_search() and friends @@ -343,6 +345,11 @@ void load_opts() item_del.push_back(s); } + // Date of last online update check; + gopts.last_update = cfg->Read(wxT("General/LastUpdated"), (long)0); + cfg->Read(wxT("General/LastUpdatedFileName"), &gopts.last_updated_filename); + std::sort(&opts[0], &opts[num_opts], opt_lt); + for (cont = cfg->GetFirstGroup(s, grp_idx); cont; cont = cfg->GetNextGroup(s, grp_idx)) { @@ -358,7 +365,6 @@ void load_opts() int poff = s.size(); long entry_idx; wxString e; - std::sort(&opts[0], &opts[num_opts], opt_lt); for (cont = cfg->GetFirstGroup(e, entry_idx); cont; cont = cfg->GetNextGroup(e, entry_idx)) @@ -436,8 +442,11 @@ void load_opts() s.append(wxT('/')); s.append(e); const opt_desc dummy = { s.c_str() }; + wxString opt_name(dummy.opt); - if (!std::binary_search(&opts[0], &opts[num_opts], dummy, opt_lt)) + if (!std::binary_search(&opts[0], &opts[num_opts], dummy, opt_lt) && + opt_name != wxT("General/LastUpdated") && + opt_name != wxT("General/LastUpdatedFileName")) { //wxLogWarning(_("Invalid option %s present; removing if possible"), s.c_str()); item_del.push_back(s); diff --git a/src/wx/opts.h b/src/wx/opts.h index 1810d876..90d50315 100644 --- a/src/wx/opts.h +++ b/src/wx/opts.h @@ -42,6 +42,9 @@ extern struct opts_t /// General bool autoload_state, autoload_cheats; wxString battery_dir; + int onlineupdates; + long last_update; + wxString last_updated_filename; bool recent_freeze; wxString recording_dir; int rewind_interval; diff --git a/src/wx/panel.cpp b/src/wx/panel.cpp index 6bc375c2..06f3d598 100644 --- a/src/wx/panel.cpp +++ b/src/wx/panel.cpp @@ -1014,6 +1014,19 @@ void GameArea::OnIdle(wxIdleEvent &event) } } +#ifdef __WXMSW__ + + // Check for online updates + if (gopts.onlineupdates > 0 && !emusys) + { + if ((wxDateTime::Now().GetTicks() - gopts.last_update) > gopts.onlineupdates * 24 * 60 * 60) + { + wxGetApp().frame->CheckForUpdates(); + } + } + +#endif + if (!emusys) return; diff --git a/src/wx/wxvbam.cpp b/src/wx/wxvbam.cpp index 329c05af..afefc55a 100644 --- a/src/wx/wxvbam.cpp +++ b/src/wx/wxvbam.cpp @@ -42,13 +42,13 @@ static void get_config_path(wxPathList &path, bool exists = true) path.Add(s); \ } while(0) // NOTE: this does not support XDG (freedesktop.org) paths - add_path(GetPluginsDir()); add_path(GetUserLocalDataDir()); add_path(GetUserDataDir()); add_path(GetLocalizedResourcesDir(wxGetApp().locale.GetCanonicalName())); add_path(GetResourcesDir()); add_path(GetDataDir()); add_path(GetLocalDataDir()); + add_path(GetPluginsDir()); } static void tack_full_path(wxString &s, const wxString &app = wxEmptyString) @@ -67,7 +67,7 @@ wxString wxvbamApp::GetConfigurationPath() { get_config_path(config_path); - for (int i = 0; i < config_path.size(); i++) + for (int i = config_path.size() - 1; i >= 0 ; i--) { wxFileName fn(config_path[i], wxT("vbam.ini")); @@ -214,38 +214,8 @@ bool wxvbamApp::OnInit() } pending_optset.clear(); - // load vba-over.ini - // rather than dealing with wxConfig's broken search path, just use - // the same one that the xrc overrides use - // this also allows us to override a group at a time, add commments, and - // add the file from which the group came - wxMemoryInputStream mis(builtin_over, sizeof(builtin_over)); - overrides = new wxFileConfig(mis); - wxRegEx cmtre; - // not the most efficient thing to do: read entire file into a string - // just to parse the comments out - wxString bovs((const char*)builtin_over, wxConvUTF8, sizeof(builtin_over)); - bool cont; - wxString s; - long grp_idx; - for (cont = overrides->GetFirstGroup(s, grp_idx); cont; - cont = overrides->GetNextGroup(s, grp_idx)) - { - // apparently even MacOSX sometimes uses the old \r by itself -#define CMT_RE_START wxT("(^|[\n\r])# ?([^\n\r]*)(\r?\n|\r)\\[") - wxString cmt(CMT_RE_START); - cmt += s + wxT("\\]"); - - if (cmtre.Compile(cmt) && cmtre.Matches(bovs)) - cmt = cmtre.GetMatch(bovs, 2); - else - cmt = wxEmptyString; - - overrides->Write(s + wxT("/comment"), cmt); - } - - wxFileName fn(GetConfigurationPath(), wxT("vba-over.ini")); + wxFileName vba_over(GetConfigurationPath(), wxT("vba-over.ini")); wxFileName rdb(GetConfigurationPath(), wxT("Nintendo - Game Boy Advance*.dat")); wxFileName scene_rdb(GetConfigurationPath(), wxT("Nintendo - Game Boy Advance (Scene)*.dat")); wxFileName nointro_rdb(GetConfigurationPath(), wxT("Official No-Intro Nintendo Gameboy Advance Number (Date).xml")); @@ -274,10 +244,42 @@ bool wxvbamApp::OnInit() } } - if (fn.FileExists()) + // load vba-over.ini + // rather than dealing with wxConfig's broken search path, just use + // the same one that the xrc overrides use + // this also allows us to override a group at a time, add commments, and + // add the file from which the group came + wxMemoryInputStream mis(builtin_over, sizeof(builtin_over)); + overrides = new wxFileConfig(mis); + wxRegEx cmtre; + // not the most efficient thing to do: read entire file into a string + // just to parse the comments out + wxString bovs((const char*)builtin_over, wxConvUTF8, sizeof(builtin_over)); + bool cont; + wxString s; + long grp_idx; + +#define CMT_RE_START wxT("(^|[\n\r])# ?([^\n\r]*)(\r?\n|\r)\\[") + + for (cont = overrides->GetFirstGroup(s, grp_idx); cont; + cont = overrides->GetNextGroup(s, grp_idx)) + { + // apparently even MacOSX sometimes uses the old \r by itself + wxString cmt(CMT_RE_START); + cmt += s + wxT("\\]"); + + if (cmtre.Compile(cmt) && cmtre.Matches(bovs)) + cmt = cmtre.GetMatch(bovs, 2); + else + cmt = wxEmptyString; + + overrides->Write(s + wxT("/comment"), cmt); + } + + if (vba_over.FileExists()) { wxStringOutputStream sos; - wxFileInputStream fis(fn.GetFullPath()); + wxFileInputStream fis(vba_over.GetFullPath()); // not the most efficient thing to do: read entire file into a string // just to parse the comments out fis.Read(sos); @@ -767,6 +769,46 @@ wxString MainFrame::CheckForUpdates(wxString host, wxString url) return update_url; } +bool MainFrame::CheckForUpdates() +{ +#ifndef __WXMSW__ + int ret = wxMessageBox(_("Online updates are available on Windows only. Please browse this site for updates.\n\nhttps://sourceforge.net/projects/vbam/files/latest/download"), + _("Online Update"), wxOK | wxICON_INFORMATION); + return true; +#endif + bool new_update_available = false; + wxString update_url = CheckForUpdates(_T("sourceforge.net"), _T("/projects/vbam/files/latest/download")); + + if (!update_url.IsEmpty()) + { + wxFileConfig* cfg = wxGetApp().cfg; + wxString update_filename = update_url.AfterLast('/'); + + if (gopts.last_updated_filename != update_filename) + { + new_update_available = true; + int ret = wxMessageBox(_("A new update is available. To update, VisualBoyAdvance-M must be Run as administrator. Would you like to download and update VisualBoyAdvance-M?\n\nhttps://sourceforge.net/projects/vbam/files/latest/download"), + _("New Update Available"), wxYES_NO | wxICON_QUESTION); + + if (ret == wxYES) + { + wxURL url(update_url); + UpdateFile(url.GetServer(), url.GetPath()); + ret = wxMessageBox(_("The update has been downloaded and installed. Please restart VisualBoyAdvance-M."), + _("Update Downloaded"), wxOK | wxICON_INFORMATION); + gopts.last_updated_filename = update_filename; + cfg->Write(wxT("General/LastUpdatedFileName"), gopts.last_updated_filename); + } + } + + gopts.last_update = wxDateTime::Now().GetTicks(); + cfg->Write(wxT("General/LastUpdated"), gopts.last_update); + cfg->Flush(); + } + + return new_update_available; +} + wxString MainFrame::GetGamePath(wxString path) { wxString game_path = path; diff --git a/src/wx/wxvbam.h b/src/wx/wxvbam.h index c3306a9a..28e8b0ae 100644 --- a/src/wx/wxvbam.h +++ b/src/wx/wxvbam.h @@ -268,22 +268,24 @@ public: // call this to update the viewers once a frame: void UpdateViewers(); + // Check for online updates to the emulator + bool CheckForUpdates(); + // required for building from xrc DECLARE_DYNAMIC_CLASS(); // required for event handling DECLARE_EVENT_TABLE(); + + bool IsPaused(bool incendental = false) + { + return (paused && !pause_next && !incendental) || menus_opened || dialog_opened; + } private: GameArea* panel; // the various reasons the game might be paused bool paused; int menus_opened, dialog_opened; -public: - bool IsPaused(bool incendental = false) - { - return (paused && !pause_next && !incendental) || menus_opened || dialog_opened; - } -private: bool autoLoadMostRecent; // copy of top-level menu bar as a context menu diff --git a/src/wx/xrc/GeneralConfig.xrc b/src/wx/xrc/GeneralConfig.xrc index 5b76074b..3c9f1942 100644 --- a/src/wx/xrc/GeneralConfig.xrc +++ b/src/wx/xrc/GeneralConfig.xrc @@ -19,6 +19,44 @@ 5 wxVERTICAL + + + + + + + wxALL|wxALIGN_CENTRE_VERTICAL + 5 + + + + + + + + wxALL + 5 + + + + + + + wxALL + 5 + + + + + + + wxALL + 5 + + wxHORIZONTAL + + wxEXPAND +