Skip to content

Commit 6c439f6

Browse files
committed
Merge branch 'dev'
2 parents 8df7d4d + d974d53 commit 6c439f6

23 files changed

+577
-146
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# Retro-Go 1.37 (2022-12-30)
2+
- SNES: Fixed controls menu labels
3+
- GEN: Small performance improvement
4+
- Launcher: Added tool to download updates
5+
6+
17
# Retro-Go 1.36.3 (2022-12-14)
28
- SNES: Fixed freeze in controls menu (hopefully for real this time...)
39

README.md

+13-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ The roms must be packed with [LCD-Game-Shrinker](https://github.com/bzhxx/LCD-Ga
8080

8181
## Wifi
8282

83-
To use wifi you will need to add your config to `/retro-go/config/wifi.json` file.
84-
It should look like this:
83+
To use wifi you will need to create a `/retro-go/config/wifi.json` config file. Its content should look like this:
8584

8685
````json
8786
{
@@ -90,6 +89,18 @@ It should look like this:
9089
}
9190
````
9291

92+
Multiple networks can be defined using the following format (then selectable in the Options menu):
93+
````json
94+
{
95+
"ssid0": "my-network",
96+
"password0": "my-password",
97+
"ssid1": "my-network",
98+
"password1": "my-password",
99+
"ssid2": "my-network",
100+
"password2": "my-password"
101+
}
102+
````
103+
93104
### Time synchronization
94105
Time synchronization happens in the launcher immediately after a successful connection to the network.
95106
This is done via NTP by contacting `pool.ntp.org` and cannot be disabled at this time.

base.sdkconfig

+6
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,9 @@ CONFIG_HTTPD_PURGE_BUF_LEN=32
156156
# CONFIG_HTTPD_LOG_PURGE_DATA is not set
157157
# CONFIG_HTTPD_WS_SUPPORT is not set
158158
# end of HTTP Server
159+
160+
161+
# TLS
162+
# Not ideal but I don't want to deal with CAs right now :(
163+
CONFIG_ESP_TLS_INSECURE=y
164+
CONFIG_ESP_TLS_SKIP_SERVER_CERT_VERIFY=y

components/retro-go/CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
set(COMPONENT_SRCDIRS ". fonts libs/netplay libs/lodepng")
22
set(COMPONENT_ADD_INCLUDEDIRS ". libs/netplay libs/lodepng")
3-
if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_GREATER_EQUAL "5.0")
4-
set(COMPONENT_REQUIRES "spi_flash fatfs nvs_flash app_update driver esp_timer esp_adc json")
3+
if($ENV{RG_ENABLE_NETWORKING})
4+
set(COMPONENT_REQUIRES "spi_flash fatfs nvs_flash esp_http_client app_update esp_adc_cal esp32 json")
55
else()
6-
set(COMPONENT_REQUIRES "spi_flash fatfs nvs_flash app_update esp_adc_cal esp32 json")
6+
set(COMPONENT_REQUIRES "spi_flash fatfs app_update esp_adc_cal esp32 json")
77
endif()
88
register_component()
99

components/retro-go/rg_audio.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
#endif
3232

3333
static const rg_audio_sink_t sinks[] = {
34+
#if !RG_AUDIO_USE_INT_DAC && !RG_AUDIO_USE_EXT_DAC
3435
{RG_AUDIO_SINK_DUMMY, 0, "Dummy" },
36+
#endif
3537
#if RG_AUDIO_USE_INT_DAC
3638
{RG_AUDIO_SINK_I2S_DAC, 0, "Speaker"},
3739
#endif
@@ -77,7 +79,7 @@ void rg_audio_init(int sampleRate)
7779

7880
ACQUIRE_DEVICE(1000);
7981

80-
int sinkType = (int)rg_settings_get_number(NS_GLOBAL, SETTING_OUTPUT, sinks[RG_COUNT(sinks) > 1 ? 1 : 0].type);
82+
int sinkType = (int)rg_settings_get_number(NS_GLOBAL, SETTING_OUTPUT, sinks[0].type);
8183
for (size_t i = 0; i < RG_COUNT(sinks); ++i)
8284
{
8385
if (!audio.sink || sinks[i].type == sinkType)

components/retro-go/rg_gui.c

+114-64
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ static struct
3131
bool initialized;
3232
} gui;
3333

34-
static const char *SETTING_FONTTYPE = "FontType";
35-
static const char *SETTING_THEME = "Theme";
34+
static const char *SETTING_FONTTYPE = "FontType";
35+
static const char *SETTING_THEME = "Theme";
3636

3737

3838
void rg_gui_init(void)
@@ -131,7 +131,7 @@ void rg_gui_copy_buffer(int left, int top, int width, int height, int stride, co
131131
for (int y = 0; y < height; ++y)
132132
{
133133
uint16_t *dst = gui.screen_buffer + (top + y) * gui.screen_width + left;
134-
const uint16_t *src = (void*)buffer + y * stride;
134+
const uint16_t *src = (void *)buffer + y * stride;
135135
for (int x = 0; x < width; ++x)
136136
if (src[x] != C_TRANSPARENT)
137137
dst[x] = src[x];
@@ -707,11 +707,13 @@ int rg_gui_dialog(const char *title, const rg_gui_option_t *options_const, int s
707707
for (size_t i = 0; i < options_count; i++)
708708
{
709709
rg_gui_option_t *option = &options[i];
710-
if (option->value && text_buffer) {
710+
if (option->value && text_buffer)
711+
{
711712
option->value = strcpy(text_buffer_ptr, option->value);
712713
text_buffer_ptr += strlen(text_buffer_ptr) + 24;
713714
}
714-
if (option->label && text_buffer) {
715+
if (option->label && text_buffer)
716+
{
715717
option->label = strcpy(text_buffer_ptr, option->label);
716718
text_buffer_ptr += strlen(text_buffer_ptr) + 24;
717719
}
@@ -822,9 +824,9 @@ bool rg_gui_confirm(const char *title, const char *message, bool default_yes)
822824
{
823825
const rg_gui_option_t options[] = {
824826
{0, (char *)message, NULL, -1, NULL},
825-
{0, "", NULL, -1, NULL},
826-
{1, "Yes", NULL, 1, NULL},
827-
{0, "No ", NULL, 1, NULL},
827+
{0, "", NULL, -1, NULL},
828+
{1, "Yes", NULL, 1, NULL},
829+
{0, "No ", NULL, 1, NULL},
828830
RG_DIALOG_CHOICE_LAST
829831
};
830832
return rg_gui_dialog(title, message ? options : options + 1, default_yes ? -2 : -1) == 1;
@@ -834,8 +836,8 @@ void rg_gui_alert(const char *title, const char *message)
834836
{
835837
const rg_gui_option_t options[] = {
836838
{0, (char *)message, NULL, -1, NULL},
837-
{0, "", NULL, -1, NULL},
838-
{1, "OK", NULL, 1, NULL},
839+
{0, "", NULL, -1, NULL},
840+
{1, "OK", NULL, 1, NULL},
839841
RG_DIALOG_CHOICE_LAST
840842
};
841843
rg_gui_dialog(title, message ? options : options + 1, -1);
@@ -1016,7 +1018,8 @@ static rg_gui_event_t speedup_update_cb(rg_gui_option_t *option, rg_gui_event_t
10161018

10171019
static rg_gui_event_t disk_activity_cb(rg_gui_option_t *option, rg_gui_event_t event)
10181020
{
1019-
if (event == RG_DIALOG_PREV || event == RG_DIALOG_NEXT) {
1021+
if (event == RG_DIALOG_PREV || event == RG_DIALOG_NEXT)
1022+
{
10201023
rg_storage_set_activity_led(!rg_storage_get_activity_led());
10211024
}
10221025
strcpy(option->value, rg_storage_get_activity_led() ? "On " : "Off");
@@ -1027,10 +1030,12 @@ static rg_gui_event_t font_type_cb(rg_gui_option_t *option, rg_gui_event_t event
10271030
{
10281031
if (event == RG_DIALOG_PREV || event == RG_DIALOG_NEXT)
10291032
{
1030-
if (event == RG_DIALOG_PREV && !rg_gui_set_font_type(gui.style.font_type - 1)) {
1033+
if (event == RG_DIALOG_PREV && !rg_gui_set_font_type(gui.style.font_type - 1))
1034+
{
10311035
rg_gui_set_font_type(0);
10321036
}
1033-
if (event == RG_DIALOG_NEXT && !rg_gui_set_font_type(gui.style.font_type + 1)) {
1037+
if (event == RG_DIALOG_NEXT && !rg_gui_set_font_type(gui.style.font_type + 1))
1038+
{
10341039
rg_gui_set_font_type(0);
10351040
}
10361041
}
@@ -1093,26 +1098,71 @@ void rg_gui_options_menu(void)
10931098
rg_audio_set_mute(false);
10941099
}
10951100

1096-
void rg_gui_about_menu(const rg_gui_option_t *extra_options)
1101+
void rg_gui_sysinfo_menu(void)
10971102
{
1098-
char build_ver[32], build_date[32], build_user[32], network_str[64];
1103+
char screen_str[32], network_str[64], memory_str[32];
1104+
char storage_str[32], localtime_str[32], uptime[32];
10991105

11001106
const rg_gui_option_t options[] = {
1101-
{0, "Version", build_ver, 1, NULL},
1102-
{0, "Date", build_date, 1, NULL},
1103-
{0, "By", build_user, 1, NULL},
1104-
#ifdef RG_ENABLE_NETWORKING
1107+
{0, "Console", RG_TARGET_NAME, 1, NULL},
1108+
{0, "Screen", screen_str, 1, NULL},
1109+
{0, "Memory", memory_str, 1, NULL},
11051110
{0, "Network", network_str, 1, NULL},
1106-
#endif
1111+
// {0, "Storage", storage_str, 1, NULL},
1112+
{0, "RTC", localtime_str, 1, NULL},
1113+
{0, "Uptime", uptime, 1, NULL},
11071114
RG_DIALOG_SEPARATOR,
1108-
{1000, "Reboot to firmware", NULL, 1, NULL},
1109-
{2000, "Reset settings", NULL, 1, NULL},
1110-
{3000, "Clear cache", NULL, 1, NULL},
1111-
{4000, "Debug", NULL, 1, NULL},
1112-
{0000, "Close", NULL, 1, NULL},
1115+
{0, "Close", NULL, 1, NULL},
11131116
RG_DIALOG_CHOICE_LAST
11141117
};
11151118

1119+
const rg_display_t *display = rg_display_get_info();
1120+
rg_stats_t stats = rg_system_get_counters();
1121+
time_t now = time(NULL);
1122+
1123+
snprintf(screen_str, 32, "%dx%d (%d)", display->screen.width, display->screen.height, display->screen.format);
1124+
snprintf(memory_str, 32, "%dKB + %dKB", stats.totalMemoryInt / 1024, stats.totalMemoryExt / 1024);
1125+
snprintf(uptime, 32, "%ds", (int)(rg_system_timer() / 1000000));
1126+
snprintf(storage_str, 32, "%s", "N/A");
1127+
strftime(localtime_str, 32, "%F %T", localtime(&now));
1128+
1129+
#ifdef RG_ENABLE_NETWORKING
1130+
rg_network_t net = rg_network_get_info();
1131+
if (net.state == RG_NETWORK_CONNECTED)
1132+
snprintf(network_str, 64, "%s\n%s", net.name, net.ip_addr);
1133+
else if (net.state == RG_NETWORK_CONNECTING)
1134+
snprintf(network_str, 64, "%s\n%s", net.name, "connecting...");
1135+
else if (net.name[0])
1136+
snprintf(network_str, 64, "%s\n%s", net.name, "disconnected");
1137+
else
1138+
snprintf(network_str, 64, "%s", "disconnected");
1139+
#else
1140+
strcpy(network_str, "No adapter");
1141+
#endif
1142+
1143+
rg_gui_dialog("System Information", options, -1);
1144+
}
1145+
1146+
void rg_gui_about_menu(const rg_gui_option_t *extra_options)
1147+
{
1148+
char build_ver[32], build_date[32], build_user[32];
1149+
1150+
size_t extra_options_count = get_dialog_items_count(extra_options);
1151+
1152+
rg_gui_option_t options[16 + extra_options_count];
1153+
rg_gui_option_t *opt = &options[0];
1154+
1155+
*opt++ = (rg_gui_option_t){0, "Version", build_ver, 1, NULL};
1156+
*opt++ = (rg_gui_option_t){0, "Date", build_date, 1, NULL};
1157+
*opt++ = (rg_gui_option_t){0, "By", build_user, 1, NULL};
1158+
*opt++ = (rg_gui_option_t)RG_DIALOG_SEPARATOR;
1159+
*opt++ = (rg_gui_option_t){1000, "System information", NULL, 1, NULL};
1160+
for (size_t i = 0; i < extra_options_count; i++)
1161+
*opt++ = extra_options[i];
1162+
*opt++ = (rg_gui_option_t){2000, "Reset settings", NULL, 1, NULL};
1163+
*opt++ = (rg_gui_option_t){3000, "Debug", NULL, 1, NULL};
1164+
*opt++ = (rg_gui_option_t)RG_DIALOG_CHOICE_LAST;
1165+
11161166
const rg_app_t *app = rg_system_get_app();
11171167

11181168
snprintf(build_ver, 30, "%s", app->version);
@@ -1129,39 +1179,28 @@ void rg_gui_about_menu(const rg_gui_option_t *extra_options)
11291179
strcat(build_ver, ")");
11301180
}
11311181

1132-
rg_network_t net = rg_network_get_info();
1133-
if (net.state == RG_NETWORK_CONNECTED)
1134-
snprintf(network_str, 64, "%s\n%s", net.name, net.ip_addr);
1135-
else if (net.state == RG_NETWORK_CONNECTING)
1136-
snprintf(network_str, 64, "%s\n%s", net.name, "connecting...");
1137-
else if (net.name[0])
1138-
snprintf(network_str, 64, "%s\n%s", net.name, "disconnected");
1139-
else
1140-
snprintf(network_str, 64, "%s", "disconnected");
1141-
1142-
int sel = rg_gui_dialog("Retro-Go", options, -1);
1143-
1144-
rg_settings_commit();
1145-
rg_system_save_time();
1146-
1147-
switch (sel)
1182+
while (true)
11481183
{
1149-
case 1000:
1150-
rg_system_switch_app(RG_APP_FACTORY, RG_APP_FACTORY, 0, 0);
1151-
break;
1152-
case 2000:
1153-
if (rg_gui_confirm("Reset all settings?", NULL, false)) {
1154-
rg_settings_reset();
1155-
rg_system_restart();
1156-
}
1157-
break;
1158-
case 3000:
1159-
rg_storage_delete(RG_BASE_PATH_CACHE);
1160-
rg_system_restart();
1161-
break;
1162-
case 4000:
1163-
rg_gui_debug_menu(NULL);
1164-
break;
1184+
switch (rg_gui_dialog("Retro-Go", options, 4))
1185+
{
1186+
case 1000:
1187+
rg_gui_sysinfo_menu();
1188+
break;
1189+
case 2000:
1190+
if (rg_gui_confirm("Reset all settings?", NULL, false)) {
1191+
rg_storage_delete(RG_BASE_PATH_CACHE);
1192+
rg_settings_reset();
1193+
rg_system_restart();
1194+
return;
1195+
}
1196+
break;
1197+
case 3000:
1198+
rg_gui_debug_menu(NULL);
1199+
break;
1200+
default:
1201+
return;
1202+
}
1203+
rg_system_event(RG_EVENT_REDRAW, NULL);
11651204
}
11661205
}
11671206

@@ -1182,10 +1221,12 @@ void rg_gui_debug_menu(const rg_gui_option_t *extra_options)
11821221
{0, "Timezone ", timezone, 1, NULL},
11831222
{0, "Uptime ", uptime, 1, NULL},
11841223
RG_DIALOG_SEPARATOR,
1185-
{1000, "Save screenshot", NULL, 1, NULL},
1186-
{2000, "Save trace", NULL, 1, NULL},
1187-
{3000, "Cheats", NULL, 1, NULL},
1188-
{4000, "Crash", NULL, 1, NULL},
1224+
{1, "Reboot to firmware", NULL, 1, NULL},
1225+
{2, "Clear cache", NULL, 1, NULL},
1226+
{3, "Save screenshot", NULL, 1, NULL},
1227+
{4, "Save trace", NULL, 1, NULL},
1228+
{5, "Cheats", NULL, 1, NULL},
1229+
{6, "Crash", NULL, 1, NULL},
11891230
RG_DIALOG_CHOICE_LAST
11901231
};
11911232

@@ -1205,13 +1246,22 @@ void rg_gui_debug_menu(const rg_gui_option_t *extra_options)
12051246

12061247
switch (rg_gui_dialog("Debugging", options, 0))
12071248
{
1208-
case 1000:
1249+
case 1:
1250+
rg_system_switch_app(RG_APP_FACTORY, RG_APP_FACTORY, 0, 0);
1251+
break;
1252+
case 2:
1253+
rg_storage_delete(RG_BASE_PATH_CACHE);
1254+
rg_system_restart();
1255+
break;
1256+
case 3:
12091257
rg_emu_screenshot(RG_STORAGE_ROOT "/screenshot.png", 0, 0);
12101258
break;
1211-
case 2000:
1259+
case 4:
12121260
rg_system_save_trace(RG_STORAGE_ROOT "/trace.txt", 0);
12131261
break;
1214-
case 4000:
1262+
case 5:
1263+
break;
1264+
case 6:
12151265
RG_PANIC("Crash test!");
12161266
break;
12171267
}

components/retro-go/rg_gui.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,13 @@ struct rg_gui_option_s
6464
rg_gui_callback_t update_cb;
6565
};
6666

67-
#define RG_DIALOG_FLAG_DISABLED 0 // (1 << 0)
68-
#define RG_DIALOG_FLAG_NORMAL 1 // (1 << 1)
69-
#define RG_DIALOG_FLAG_SKIP -1 // (1 << 2)
67+
#define RG_DIALOG_FLAG_DISABLED (0) // (1 << 0)
68+
#define RG_DIALOG_FLAG_NORMAL (1) // (1 << 1)
69+
#define RG_DIALOG_FLAG_SKIP (-1) // (1 << 2)
7070

7171
#define RG_DIALOG_CHOICE_LAST {0, NULL, NULL, 0, NULL}
7272
#define RG_DIALOG_SEPARATOR {0, "----------", NULL, RG_DIALOG_FLAG_SKIP, NULL}
73+
#define RG_DIALOG_END RG_DIALOG_CHOICE_LAST
7374

7475
#define RG_DIALOG_CANCELLED -0x7654321
7576

0 commit comments

Comments
 (0)