Skip to content

Commit 2ba3aa1

Browse files
committed
updater: Added skeleton app
1 parent c00db02 commit 2ba3aa1

File tree

5 files changed

+54
-0
lines changed

5 files changed

+54
-0
lines changed

retro-go.code-workspace

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
{
2828
"path": "tools"
2929
},
30+
{
31+
"path": "updater"
32+
},
3033
{
3134
"path": ".",
3235
"name": "root"

rg_tool.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
PROJECT_ICON = os.getenv("PROJECT_ICON", "assets/icon.raw")
1717
PROJECT_APPS = {
1818
# Project name Type, SubType, Size
19+
'updater': [0, 0, 524288],
1920
'launcher': [0, 0, 983040],
2021
'retro-core': [0, 0, 983040],
2122
'prboom-go': [0, 0, 851968],

updater/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
cmake_minimum_required(VERSION 3.5)
2+
set(COMPONENTS "main retro-go")
3+
set(RG_ENABLE_NETWORKING 0)
4+
include(../base.cmake)
5+
project(updater)

updater/main/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
set(COMPONENT_SRCDIRS ".")
2+
set(COMPONENT_ADD_INCLUDEDIRS ".")
3+
register_component()
4+
rg_setup_compile_options(-Os)

updater/main/main.c

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#include <rg_system.h>
2+
#include <sys/time.h>
3+
#include <stdarg.h>
4+
#include <stdio.h>
5+
#include <stdlib.h>
6+
#include <string.h>
7+
8+
#include <esp_spi_flash.h>
9+
#include <esp_partition.h>
10+
11+
#ifdef RG_UPDATER_DOWNLOAD_LOCATION
12+
#define DOWNLOAD_LOCATION RG_UPDATER_DOWNLOAD_LOCATION
13+
#else
14+
#define DOWNLOAD_LOCATION RG_BASE_PATH
15+
#endif
16+
17+
void app_main(void)
18+
{
19+
rg_app_t *app = rg_system_init(32000, NULL, NULL);
20+
21+
if (!rg_storage_ready())
22+
{
23+
rg_display_clear(C_SKY_BLUE);
24+
rg_gui_alert(_("SD Card Error"), _("Storage mount failed.\nMake sure the card is FAT32."));
25+
// What do at this point? Reboot? Switch back to launcher?
26+
goto launcher;
27+
}
28+
29+
// Hopefully we'll receive the filename from the launcher which has a nicer file browser
30+
const char *filename = app->romPath;
31+
32+
if (!filename || !rg_storage_exists(filename))
33+
filename = rg_gui_file_picker(_("Select update"), DOWNLOAD_LOCATION, NULL, true);
34+
if (!filename)
35+
goto launcher;
36+
37+
RG_LOGI("Filename: %s", filename);
38+
39+
launcher:
40+
rg_system_switch_app(RG_APP_LAUNCHER, 0, 0, 0, 0);
41+
}

0 commit comments

Comments
 (0)