Skip to content

Commit 58a6e55

Browse files
committed
rg_tool: Print partition table when generating a .img
1 parent 73e7993 commit 58a6e55

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

components/retro-go/rg_gui.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,10 @@ intptr_t rg_gui_dialog(const char *title, const rg_gui_option_t *options_const,
834834

835835
// We create a copy of options because the callbacks might modify it (ie option->value)
836836
rg_gui_option_t options[options_count + 1];
837-
char *text_buffer = calloc(options_count, 32);
837+
// The text_buffer is used for mutable option->values. Because values tend to be small, we can make
838+
// some assumptions. This is a terrible system that is prone to corruption. But we're stuck with it.
839+
size_t text_buffer_size = RG_MAX(options_count * 32, 1024);
840+
char *text_buffer = malloc(text_buffer_size);
838841
char *text_buffer_ptr = text_buffer;
839842

840843
memcpy(options, options_const, sizeof(options));
@@ -844,11 +847,11 @@ intptr_t rg_gui_dialog(const char *title, const rg_gui_option_t *options_const,
844847
rg_gui_option_t *option = &options[i];
845848
if (!option->label)
846849
option->label = "";
847-
if (option->value && text_buffer)
850+
if (option->value && text_buffer_ptr)
848851
option->value = strcpy(text_buffer_ptr, option->value);
849852
if (option->update_cb)
850853
option->update_cb(option, RG_DIALOG_INIT);
851-
if (option->value && text_buffer)
854+
if (option->value && text_buffer_ptr)
852855
text_buffer_ptr += RG_MAX(strlen(option->value), 31) + 1;
853856
}
854857

@@ -1896,7 +1899,7 @@ static rg_gui_event_t app_options_cb(rg_gui_option_t *option, rg_gui_event_t eve
18961899

18971900
void rg_gui_options_menu(void)
18981901
{
1899-
rg_gui_option_t options[16] = {
1902+
rg_gui_option_t options[20] = {
19001903
#if RG_SCREEN_BACKLIGHT
19011904
{0, _("Brightness"), "-", RG_DIALOG_FLAG_NORMAL, &brightness_update_cb},
19021905
#endif

rg_tool.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
}
2626
# PROJECT_APPS = {}
2727
# for t in glob.glob("*/CMakeLists.txt"):
28-
# PROJECT_APPS[os.path.basename(os.path.dirname(t))] = [0, 0, 0]
28+
# name = os.path.basename(os.path.dirname(t))
29+
# if name not in PROJECT_APPS:
30+
# PROJECT_APPS[name] = [0, 0, 0]
2931
try:
3032
PROJECT_VER = os.getenv("PROJECT_VER") or subprocess.check_output(
3133
"git describe --tags --abbrev=5 --dirty --always", shell=True
@@ -125,6 +127,8 @@ def build_image(output_file, apps, img_format="esp32", fatsize=0):
125127
with open(output_file, "wb") as f:
126128
f.write(image_data)
127129

130+
print("\nPartition table:")
131+
print("\n".join(table_csv))
128132
print("\nSaved image '%s' (%d bytes)\n" % (output_file, len(image_data)))
129133

130134

@@ -227,10 +231,8 @@ def monitor_app(app, port, baudrate=115200):
227231
os.putenv("IDF_TARGET", IDF_TARGET)
228232

229233
command = args.command
230-
if "all" in args.apps:
231-
apps = DEFAULT_APPS.split() or list(PROJECT_APPS.keys())
232-
else:
233-
apps = [app for app in PROJECT_APPS.keys() if app in args.apps]
234+
apps = DEFAULT_APPS.split() if "all" in args.apps else args.apps
235+
apps = [app for app in PROJECT_APPS.keys() if app in apps] # Ensure ordering and uniqueness
234236

235237
try:
236238
if command in ["build-fw", "build-img", "release", "install"] and "launcher" not in apps:

0 commit comments

Comments
 (0)