From 8ca10b48a7f90952d1cfd5789720236237ec3938 Mon Sep 17 00:00:00 2001 From: sorgelig Date: Thu, 15 Jul 2021 18:30:12 +0800 Subject: [PATCH] INI option log_file_entry. --- MiSTer.ini | 5 +++++ cfg.cpp | 1 + cfg.h | 1 + menu.cpp | 20 +++++++++++--------- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/MiSTer.ini b/MiSTer.ini index 38c8535..b69d020 100644 --- a/MiSTer.ini +++ b/MiSTer.ini @@ -157,3 +157,8 @@ shared_folder= ; Set to 0 for name mapping (jn) (e.g. A button in SNES core = A button on controller regardless of position on pad) ; Set to 1 for positional mapping (jp) (e.g. A button in SNES core = East button on controller regardless of button name) gamepad_defaults=0 + +; Write out file name under the cursor in browser for external integration +; External application or script may parse the info and do some additional actions and/or send info to 3rd party server. +; Warning: it may slowdown the system or add lag while browsing the files in OSD depending on external app/script. +log_file_entry=0 diff --git a/cfg.cpp b/cfg.cpp index 62393d5..3d09484 100644 --- a/cfg.cpp +++ b/cfg.cpp @@ -82,6 +82,7 @@ static const ini_var_t ini_vars[] = { "SPINNER_THROTTLE", (void*)(&(cfg.spinner_throttle)), INT32, -10000, 10000 }, { "AFILTER_DEFAULT", (void*)(&(cfg.afilter_default)), STRING, 0, sizeof(cfg.afilter_default) - 1 }, { "VFILTER_DEFAULT", (void*)(&(cfg.vfilter_default)), STRING, 0, sizeof(cfg.vfilter_default) - 1 }, + { "LOG_FILE_ENTRY", (void*)(&(cfg.log_file_entry)), UINT8, 0, 1 }, }; static const int nvars = (int)(sizeof(ini_vars) / sizeof(ini_var_t)); diff --git a/cfg.h b/cfg.h index bbd56e9..1652c7b 100644 --- a/cfg.h +++ b/cfg.h @@ -51,6 +51,7 @@ typedef struct { uint8_t sniper_mode; uint8_t browse_expand; uint8_t logo; + uint8_t log_file_entry; char bootcore[256]; char video_conf[1024]; char video_conf_pal[1024]; diff --git a/menu.cpp b/menu.cpp index e3736c2..edc7732 100644 --- a/menu.cpp +++ b/menu.cpp @@ -4415,15 +4415,17 @@ void HandleUI(void) if (flist_nDirEntries()) { ScrollLongName(); // scrolls file name if longer than display line - - //Write out paths infos for external integration - FILE* filePtr = fopen("/tmp/CURRENTPATH","w"); - FILE* pathPtr = fopen("/tmp/FULLPATH","w"); - fprintf(filePtr, "%s", flist_SelectedItem()->altname); - fprintf(pathPtr, "%s", selPath); - fclose(filePtr); - fclose(pathPtr); - + + if (cfg.log_file_entry) + { + //Write out paths infos for external integration + FILE* filePtr = fopen("/tmp/CURRENTPATH", "w"); + FILE* pathPtr = fopen("/tmp/FULLPATH", "w"); + fprintf(filePtr, "%s", flist_SelectedItem()->altname); + fprintf(pathPtr, "%s", selPath); + fclose(filePtr); + fclose(pathPtr); + } if (c == KEY_HOME) {