Skip to content

Commit a94c983

Browse files
committed
Defined a standard RG_UPDATER_DOWNLOAD_LOCATION
1 parent df04619 commit a94c983

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

components/retro-go/config.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,12 @@
8484
#define RG_UPDATER_ENABLE 1
8585
#endif
8686

87-
// If either of the following isn't defined then the updater will only perform version *checks*, not self-update
87+
// If RG_UPDATER_APPLICATION is not defined then the updater only performs version *checks*, not self-update
8888
// #define RG_UPDATER_APPLICATION RG_APP_FACTORY
89-
// #define RG_UPDATER_DOWNLOAD_LOCATION RG_STORAGE_ROOT "/odroid/firmware"
89+
90+
#ifndef RG_UPDATER_DOWNLOAD_LOCATION
91+
#define RG_UPDATER_DOWNLOAD_LOCATION RG_STORAGE_ROOT "/retro-go/updates"
92+
#endif
9093

9194
#ifndef RG_UPDATER_GITHUB_RELEASES
9295
#define RG_UPDATER_GITHUB_RELEASES "https://api.github.com/repos/ducalex/retro-go/releases?per_page=10"

components/retro-go/rg_storage.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
#define RG_BASE_PATH_SAVES RG_BASE_PATH "/saves"
1616
#define RG_BASE_PATH_THEMES RG_BASE_PATH "/themes"
1717
#define RG_BASE_PATH_BORDERS RG_BASE_PATH "/borders"
18+
#ifdef RG_UPDATER_DOWNLOAD_LOCATION
19+
#define RG_BASE_PATH_UPDATES RG_UPDATER_DOWNLOAD_LOCATION
20+
#else
21+
#define RG_BASE_PATH_UPDATES RG_BASE_PATH "/updates"
22+
#endif
1823

1924
typedef struct
2025
{

launcher/main/updater.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ static rg_gui_event_t view_release_cb(rg_gui_option_t *option, rg_gui_event_t ev
130130

131131
if (event == RG_DIALOG_ENTER)
132132
{
133-
#if defined(RG_UPDATER_APPLICATION) && defined(RG_UPDATER_DOWNLOAD_LOCATION)
133+
#if defined(RG_UPDATER_APPLICATION)
134134
rg_gui_option_t options[release->assets_count + 4];
135135
rg_gui_option_t *opt = options;
136136

@@ -145,7 +145,7 @@ static rg_gui_event_t view_release_cb(rg_gui_option_t *option, rg_gui_event_t ev
145145
if (sel != RG_DIALOG_CANCELLED)
146146
{
147147
char dest_path[RG_PATH_MAX];
148-
snprintf(dest_path, RG_PATH_MAX, "%s/%s", RG_UPDATER_DOWNLOAD_LOCATION, release->assets[sel].name);
148+
snprintf(dest_path, RG_PATH_MAX, "%s/%s", RG_BASE_PATH_UPDATES, release->assets[sel].name);
149149
if (download_file(release->assets[sel].url, dest_path))
150150
{
151151
if (rg_gui_confirm(_("Download complete!"), _("Reboot to flash?"), true))

updater/main/main.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@
1111
#include <esp_spi_flash.h>
1212
#include <esp_ota_ops.h>
1313

14-
#ifdef RG_UPDATER_DOWNLOAD_LOCATION
15-
#define DOWNLOAD_LOCATION RG_UPDATER_DOWNLOAD_LOCATION
16-
#else
17-
#define DOWNLOAD_LOCATION RG_BASE_PATH
18-
#endif
19-
2014
#if CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED
2115
#define CAN_UPDATE_PARTITION_TABLE 1
2216
#else
@@ -206,7 +200,7 @@ void app_main(void)
206200
// const char *filename = app->romPath;
207201
while (true)
208202
{
209-
char *filename = rg_gui_file_picker("Select update", DOWNLOAD_LOCATION, NULL, true, true);
203+
char *filename = rg_gui_file_picker("Select update", RG_BASE_PATH_UPDATES, NULL, true, true);
210204
if (!filename || !*filename)
211205
break;
212206
if (do_update(filename))

0 commit comments

Comments
 (0)