Skip to content

Commit ef593b0

Browse files
libretroadminLibretroAdmin
authored andcommitted
menu_displaylist: add a validation dump for the build_list path
When the RETROARCH_DISPLAYLIST_DUMP environment variable names a file, every displaylist type builds once through menu_displaylist_build_list into a scratch list and each entry's path, label, type and index are written out - a byte-comparable fingerprint of the switch and the gate for converting its cases to data, the discipline the settings dump gives setting_append_list. The information lists sample live memory and the core-content family reaches for the network, so those are skipped by name; the type header flushes before the build so a wedged type names itself. Two runs compare byte-identical across all 212 types on this configuration.
1 parent 6670d8c commit ef593b0

3 files changed

Lines changed: 71 additions & 0 deletions

File tree

menu/menu_displaylist.c

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7143,6 +7143,72 @@ static unsigned menu_displaylist_netplay_refresh_rooms(file_list_t *list)
71437143
}
71447144
#endif
71457145

7146+
/* Validation dump for the displaylist build path.
7147+
*
7148+
* When the RETROARCH_DISPLAYLIST_DUMP environment variable names a
7149+
* file, every displaylist type is built once through
7150+
* menu_displaylist_build_list into a scratch list and each entry's
7151+
* path, label, type and index are written out. The output is a
7152+
* byte-comparable fingerprint of the build_list switch, the gate for
7153+
* converting its cases to data - the same discipline the settings
7154+
* dump provides for setting_append_list. Types the function does not
7155+
* handle fall through its default and print an empty section, which
7156+
* keeps the fingerprint aligned across refactors. */
7157+
void menu_displaylist_validation_dump(void)
7158+
{
7159+
const char *path = getenv("RETROARCH_DISPLAYLIST_DUMP");
7160+
settings_t *settings = config_get_ptr();
7161+
RFILE *f;
7162+
unsigned t;
7163+
if (!path)
7164+
return;
7165+
f = filestream_open(path,
7166+
RETRO_VFS_FILE_ACCESS_WRITE,
7167+
RETRO_VFS_FILE_ACCESS_HINT_NONE);
7168+
if (!f)
7169+
return;
7170+
filestream_printf(f, "# CORE_CONTENT=%u SYSTEM_FILES=%u NETPLAY=%u URL=%u PENDING=%u\n",
7171+
(unsigned)DISPLAYLIST_CORE_CONTENT,
7172+
(unsigned)DISPLAYLIST_CORE_SYSTEM_FILES,
7173+
(unsigned)DISPLAYLIST_NETPLAY_ROOM_LIST,
7174+
(unsigned)DISPLAYLIST_CORES_UPDATER,
7175+
(unsigned)DISPLAYLIST_PENDING_CLEAR);
7176+
for (t = 0; t <= (unsigned)DISPLAYLIST_PENDING_CLEAR; t++)
7177+
{
7178+
file_list_t list;
7179+
unsigned count;
7180+
size_t i;
7181+
/* Live values would make the fingerprint flap: the information
7182+
* list samples current memory use. Skipped, not built. */
7183+
if (t == (unsigned)DISPLAYLIST_INFORMATION_LIST
7184+
|| t == (unsigned)DISPLAYLIST_SYSTEM_INFO
7185+
|| t == (unsigned)DISPLAYLIST_HELP_SCREEN_LIST
7186+
/* The core-content family reaches for the network and
7187+
* blocks headless; nothing deterministic lives there. */
7188+
|| (t >= (unsigned)DISPLAYLIST_CORE_CONTENT
7189+
&& t <= (unsigned)DISPLAYLIST_CORE_SYSTEM_FILES))
7190+
{
7191+
filestream_printf(f, "== %u skipped\n", t);
7192+
filestream_flush(f);
7193+
continue;
7194+
}
7195+
memset(&list, 0, sizeof(list));
7196+
filestream_printf(f, "== %u ", t);
7197+
filestream_flush(f);
7198+
count = menu_displaylist_build_list(&list, settings,
7199+
(enum menu_displaylist_ctl_state)t, false);
7200+
filestream_printf(f, "count=%u size=%u\n", count, (unsigned)list.size);
7201+
filestream_flush(f);
7202+
for (i = 0; i < list.size; i++)
7203+
filestream_printf(f, "%u|%s|%s|%u|%u\n", (unsigned)i,
7204+
list.list[i].path ? list.list[i].path : "",
7205+
list.list[i].label ? list.list[i].label : "",
7206+
list.list[i].type, (unsigned)list.list[i].entry_idx);
7207+
file_list_deinitialize(&list);
7208+
}
7209+
filestream_close(f);
7210+
}
7211+
71467212
unsigned menu_displaylist_build_list(
71477213
file_list_t *list,
71487214
settings_t *settings,

menu/menu_displaylist.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,8 @@ bool menu_displaylist_process(menu_displaylist_info_t *info);
367367

368368
void menu_displaylist_info_free(menu_displaylist_info_t *info);
369369

370+
void menu_displaylist_validation_dump(void);
371+
370372
unsigned menu_displaylist_build_list(
371373
file_list_t *list,
372374
settings_t *settings,

menu/menu_setting.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#endif
4040

4141
#include "menu_setting.h"
42+
#include "menu_displaylist.h"
4243
#include "menu_cbs.h"
4344
#include "menu_driver.h"
4445
#include "menu_input.h"
@@ -19125,6 +19126,8 @@ rarch_setting_t *menu_setting_new(void)
1912519126

1912619127
menu_setting_validation_dump(list);
1912719128

19129+
menu_displaylist_validation_dump();
19130+
1912819131
if (list_info)
1912919132
free(list_info);
1913019133

0 commit comments

Comments
 (0)