kopia lustrzana https://github.com/hoglet67/RGBtoHDMI
Rework cpld name prefix handling
rodzic
e67488e8da
commit
1976d6fde5
|
@ -282,11 +282,11 @@ cpld_t cpld_atom = {
|
|||
.nameBBC = "Atom",
|
||||
.nameRGB = "Atom",
|
||||
.nameYUV = "Atom",
|
||||
.nameprefix = "Atom ",
|
||||
.nameBBCprefix = "Atom ",
|
||||
.nameRGBprefix = "Atom ",
|
||||
.nameYUVprefix = "Atom ",
|
||||
.default_profile = "Atom Acorn/Acorn_Atom",
|
||||
.nameprefix = "Atom",
|
||||
.nameBBCprefix = "Atom",
|
||||
.nameRGBprefix = "Atom",
|
||||
.nameYUVprefix = "Atom",
|
||||
.default_profile = "Acorn/Acorn_Atom",
|
||||
.init = cpld_init,
|
||||
.get_version = cpld_get_version,
|
||||
.calibrate = cpld_calibrate,
|
||||
|
|
|
@ -95,11 +95,11 @@ cpld_t cpld_null_atom = {
|
|||
.nameBBC = "Atom",
|
||||
.nameRGB = "Atom",
|
||||
.nameYUV = "Atom",
|
||||
.nameprefix = "Atom ",
|
||||
.nameBBCprefix = "Atom ",
|
||||
.nameRGBprefix = "Atom ",
|
||||
.nameYUVprefix = "Atom ",
|
||||
.default_profile = "Atom Acorn/Acorn_Atom",
|
||||
.nameprefix = "Atom",
|
||||
.nameBBCprefix = "Atom",
|
||||
.nameRGBprefix = "Atom",
|
||||
.nameYUVprefix = "Atom",
|
||||
.default_profile = "Acorn/Acorn_Atom",
|
||||
.init = cpld_init,
|
||||
.get_version = cpld_get_version,
|
||||
.calibrate = cpld_calibrate,
|
||||
|
@ -127,11 +127,11 @@ cpld_t cpld_null_3bit = {
|
|||
.nameBBC = "3-12_BIT_BBC",
|
||||
.nameRGB = "3-12_BIT_BBC",
|
||||
.nameYUV = "3-12_BIT_BBC",
|
||||
.nameprefix = "(BBC) ",
|
||||
.nameBBCprefix = "(BBC) ",
|
||||
.nameRGBprefix = "(BBC) ",
|
||||
.nameYUVprefix = "(BBC) ",
|
||||
.default_profile = "(BBC) Acorn/BBC_Micro",
|
||||
.nameprefix = "BBC",
|
||||
.nameBBCprefix = "BBC",
|
||||
.nameRGBprefix = "BBC",
|
||||
.nameYUVprefix = "BBC",
|
||||
.default_profile = "Acorn/BBC_Micro",
|
||||
.init = cpld_init,
|
||||
.get_version = cpld_get_version,
|
||||
.calibrate = cpld_calibrate,
|
||||
|
@ -159,11 +159,11 @@ cpld_t cpld_null_6bit = {
|
|||
.nameBBC = "3-12_BIT_BBC",
|
||||
.nameRGB = "6-12_BIT_RGB",
|
||||
.nameYUV = "6-12_BIT_YUV",
|
||||
.nameprefix = "(BBC) ",
|
||||
.nameBBCprefix = "(BBC) ",
|
||||
.nameRGBprefix = "(RGB) ",
|
||||
.nameYUVprefix = "(YUV) ",
|
||||
.default_profile = "(BBC) Acorn/BBC_Micro",
|
||||
.nameprefix = "BBC",
|
||||
.nameBBCprefix = "BBC",
|
||||
.nameRGBprefix = "RGB",
|
||||
.nameYUVprefix = "YUV",
|
||||
.default_profile = "Acorn/BBC_Micro",
|
||||
.init = cpld_init,
|
||||
.get_version = cpld_get_version,
|
||||
.calibrate = cpld_calibrate,
|
||||
|
@ -195,7 +195,7 @@ cpld_t cpld_null_simple = {
|
|||
.nameBBCprefix = "Simple",
|
||||
.nameRGBprefix = "Simple",
|
||||
.nameYUVprefix = "Simple",
|
||||
.default_profile = "SimpleCommodore/Amiga",
|
||||
.default_profile = "Commodore/Amiga",
|
||||
.init = cpld_init,
|
||||
.get_version = cpld_get_version,
|
||||
.calibrate = cpld_calibrate,
|
||||
|
@ -223,11 +223,11 @@ cpld_t cpld_null = {
|
|||
.nameBBC = "3-12_BIT_BBC",
|
||||
.nameRGB = "3-12_BIT_BBC",
|
||||
.nameYUV = "3-12_BIT_BBC",
|
||||
.nameprefix = "(BBC) ",
|
||||
.nameBBCprefix = "(BBC) ",
|
||||
.nameRGBprefix = "(BBC) ",
|
||||
.nameYUVprefix = "(BBC) ",
|
||||
.default_profile = "(BBC) Acorn/BBC_Micro",
|
||||
.nameprefix = "BBC",
|
||||
.nameBBCprefix = "BBC",
|
||||
.nameRGBprefix = "BBC",
|
||||
.nameYUVprefix = "BBC",
|
||||
.default_profile = "Acorn/BBC_Micro",
|
||||
.init = cpld_init,
|
||||
.get_version = cpld_get_version,
|
||||
.calibrate = cpld_calibrate,
|
||||
|
|
|
@ -2197,11 +2197,11 @@ cpld_t cpld_bbc = {
|
|||
.nameBBC = "3-12_BIT_BBC",
|
||||
.nameRGB = "3-12_BIT_BBC",
|
||||
.nameYUV = "3-12_BIT_BBC",
|
||||
.nameprefix = "(BBC) ",
|
||||
.nameBBCprefix = "(BBC) ",
|
||||
.nameRGBprefix = "(BBC) ",
|
||||
.nameYUVprefix = "(BBC) ",
|
||||
.default_profile = "(BBC) Acorn/BBC_Micro",
|
||||
.nameprefix = "BBC",
|
||||
.nameBBCprefix = "BBC",
|
||||
.nameRGBprefix = "BBC",
|
||||
.nameYUVprefix = "BBC",
|
||||
.default_profile = "Acorn/BBC_Micro",
|
||||
.init = cpld_init_bbc,
|
||||
.get_version = cpld_get_version,
|
||||
.calibrate = cpld_calibrate,
|
||||
|
@ -2229,11 +2229,11 @@ cpld_t cpld_bbcv10v20 = {
|
|||
.nameBBC = "Legacy_3_BIT",
|
||||
.nameRGB = "Legacy_3_BIT",
|
||||
.nameYUV = "Legacy_3_BIT",
|
||||
.nameprefix = "(BBC) ",
|
||||
.nameBBCprefix = "(BBC) ",
|
||||
.nameRGBprefix = "(BBC) ",
|
||||
.nameYUVprefix = "(BBC) ",
|
||||
.default_profile = "(BBC) Acorn/BBC_Micro_v10-v20",
|
||||
.nameprefix = "BBC",
|
||||
.nameBBCprefix = "BBC",
|
||||
.nameRGBprefix = "BBC",
|
||||
.nameYUVprefix = "BBC",
|
||||
.default_profile = "Acorn/BBC_Micro_v10-v20",
|
||||
.init = cpld_init_bbc,
|
||||
.get_version = cpld_get_version,
|
||||
.calibrate = cpld_calibrate,
|
||||
|
@ -2261,11 +2261,11 @@ cpld_t cpld_bbcv21v23 = {
|
|||
.nameBBC = "Legacy_3_BIT",
|
||||
.nameRGB = "Legacy_3_BIT",
|
||||
.nameYUV = "Legacy_3_BIT",
|
||||
.nameprefix = "(BBC) ",
|
||||
.nameBBCprefix = "(BBC) ",
|
||||
.nameRGBprefix = "(BBC) ",
|
||||
.nameYUVprefix = "(BBC) ",
|
||||
.default_profile = "(BBC) Acorn/BBC_Micro_v21-v23",
|
||||
.nameprefix = "BBC",
|
||||
.nameBBCprefix = "BBC",
|
||||
.nameRGBprefix = "BBC",
|
||||
.nameYUVprefix = "BBC",
|
||||
.default_profile = "Acorn/BBC_Micro_v21-v23",
|
||||
.init = cpld_init_bbc,
|
||||
.get_version = cpld_get_version,
|
||||
.calibrate = cpld_calibrate,
|
||||
|
@ -2293,11 +2293,11 @@ cpld_t cpld_bbcv24 = {
|
|||
.nameBBC = "Legacy_3_BIT",
|
||||
.nameRGB = "Legacy_3_BIT",
|
||||
.nameYUV = "Legacy_3_BIT",
|
||||
.nameprefix = "(BBC) ",
|
||||
.nameBBCprefix = "(BBC) ",
|
||||
.nameRGBprefix = "(BBC) ",
|
||||
.nameYUVprefix = "(BBC) ",
|
||||
.default_profile = "(BBC) Acorn/BBC_Micro_v24",
|
||||
.nameprefix = "BBC",
|
||||
.nameBBCprefix = "BBC",
|
||||
.nameRGBprefix = "BBC",
|
||||
.nameYUVprefix = "BBC",
|
||||
.default_profile = "Acorn/BBC_Micro_v24",
|
||||
.init = cpld_init_bbc,
|
||||
.get_version = cpld_get_version,
|
||||
.calibrate = cpld_calibrate,
|
||||
|
@ -2325,11 +2325,11 @@ cpld_t cpld_bbcv30v62 = {
|
|||
.nameBBC = "Legacy_3_BIT",
|
||||
.nameRGB = "Legacy_3_BIT",
|
||||
.nameYUV = "Legacy_3_BIT",
|
||||
.nameprefix = "(BBC) ",
|
||||
.nameBBCprefix = "(BBC) ",
|
||||
.nameRGBprefix = "(BBC) ",
|
||||
.nameYUVprefix = "(BBC) ",
|
||||
.default_profile = "(BBC) Acorn/BBC_Micro_v30-v62",
|
||||
.nameprefix = "BBC",
|
||||
.nameBBCprefix = "BBC",
|
||||
.nameRGBprefix = "BBC",
|
||||
.nameYUVprefix = "BBC",
|
||||
.default_profile = "Acorn/BBC_Micro_v30-v62",
|
||||
.init = cpld_init_bbc,
|
||||
.get_version = cpld_get_version,
|
||||
.calibrate = cpld_calibrate,
|
||||
|
@ -2371,11 +2371,11 @@ cpld_t cpld_rgb_ttl = {
|
|||
.nameBBC = "3-12_BIT_BBC",
|
||||
.nameRGB = "6-12_BIT_RGB",
|
||||
.nameYUV = "6-12_BIT_YUV",
|
||||
.nameprefix = "(RGB) ",
|
||||
.nameBBCprefix = "(BBC) ",
|
||||
.nameRGBprefix = "(RGB) ",
|
||||
.nameYUVprefix = "(YUV) ",
|
||||
.default_profile = "(RGB) Acorn/Electron",
|
||||
.nameprefix = "RGB",
|
||||
.nameBBCprefix = "BBC",
|
||||
.nameRGBprefix = "RGB",
|
||||
.nameYUVprefix = "YUV",
|
||||
.default_profile = "Acorn/Electron",
|
||||
.init = cpld_init_rgb_ttl,
|
||||
.get_version = cpld_get_version,
|
||||
.calibrate = cpld_calibrate,
|
||||
|
@ -2403,11 +2403,11 @@ cpld_t cpld_rgb_ttl_24mhz = {
|
|||
.nameBBC = "3-12_BIT_BBC",
|
||||
.nameRGB = "6-12_BIT_RGB",
|
||||
.nameYUV = "6-12_BIT_YUV",
|
||||
.nameprefix = "(BBC) ",
|
||||
.nameBBCprefix = "(BBC) ",
|
||||
.nameRGBprefix = "(RGB) ",
|
||||
.nameYUVprefix = "(YUV) ",
|
||||
.default_profile = "(BBC) Acorn/BBC_Micro",
|
||||
.nameprefix = "BBC",
|
||||
.nameBBCprefix = "BBC",
|
||||
.nameRGBprefix = "RGB",
|
||||
.nameYUVprefix = "YUV",
|
||||
.default_profile = "Acorn/BBC_Micro",
|
||||
.init = cpld_init_rgb_ttl,
|
||||
.get_version = cpld_get_version,
|
||||
.calibrate = cpld_calibrate,
|
||||
|
@ -2459,11 +2459,11 @@ cpld_t cpld_rgb_analog = {
|
|||
.nameBBC = "3-12_BIT_BBC_Analog",
|
||||
.nameRGB = "6-12_BIT_RGB_Analog",
|
||||
.nameYUV = "6-12_BIT_YUV_Analog",
|
||||
.nameprefix = "(RGB) ",
|
||||
.nameBBCprefix = "(BBC) ",
|
||||
.nameRGBprefix = "(RGB) ",
|
||||
.nameYUVprefix = "(YUV) ",
|
||||
.default_profile = "(RGB) Amstrad/Amstrad_CPC",
|
||||
.nameprefix = "RGB",
|
||||
.nameBBCprefix = "BBC",
|
||||
.nameRGBprefix = "RGB",
|
||||
.nameYUVprefix = "YUV",
|
||||
.default_profile = "Amstrad/Amstrad_CPC",
|
||||
.init = cpld_init_rgb_analog,
|
||||
.get_version = cpld_get_version,
|
||||
.calibrate = cpld_calibrate,
|
||||
|
@ -2492,11 +2492,11 @@ cpld_t cpld_rgb_analog_24mhz = {
|
|||
.nameBBC = "3-12_BIT_BBC_Analog",
|
||||
.nameRGB = "6-12_BIT_RGB_Analog",
|
||||
.nameYUV = "6-12_BIT_YUV_Analog",
|
||||
.nameprefix = "(BBC) ",
|
||||
.nameBBCprefix = "(BBC) ",
|
||||
.nameRGBprefix = "(RGB) ",
|
||||
.nameYUVprefix = "(YUV) ",
|
||||
.default_profile = "(BBC) Acorn/BBC_Micro",
|
||||
.nameprefix = "BBC",
|
||||
.nameBBCprefix = "BBC",
|
||||
.nameRGBprefix = "RGB",
|
||||
.nameYUVprefix = "YUV",
|
||||
.default_profile = "Acorn/BBC_Micro",
|
||||
.init = cpld_init_rgb_analog,
|
||||
.get_version = cpld_get_version,
|
||||
.calibrate = cpld_calibrate,
|
||||
|
|
|
@ -529,7 +529,7 @@ cpld_t cpld_simple = {
|
|||
.nameBBCprefix = "Simple",
|
||||
.nameRGBprefix = "Simple",
|
||||
.nameYUVprefix = "Simple",
|
||||
.default_profile = "SimpleCommodore/Amiga",
|
||||
.default_profile = "Commodore/Amiga",
|
||||
.init = cpld_init,
|
||||
.get_version = cpld_get_version,
|
||||
.calibrate = cpld_calibrate,
|
||||
|
|
|
@ -1430,6 +1430,10 @@ cpld_t cpld_yuv_analog = {
|
|||
.nameBBC = "3-12_BIT_BBC_Analog",
|
||||
.nameRGB = "6-12_BIT_RGB_Analog",
|
||||
.nameYUV = "6-12_BIT_YUV_Analog",
|
||||
.nameprefix = "YUV",
|
||||
.nameBBCprefix = "BBC",
|
||||
.nameRGBprefix = "RGB",
|
||||
.nameYUVprefix = "YUV",
|
||||
.default_profile = "Apple/Apple_II",
|
||||
.init = cpld_init_analog,
|
||||
.get_version = cpld_get_version,
|
||||
|
@ -1457,6 +1461,10 @@ cpld_t cpld_yuv_ttl = {
|
|||
.nameBBC = "3-12_BIT_BBC",
|
||||
.nameRGB = "6-12_BIT_RGB",
|
||||
.nameYUV = "6-12_BIT_YUV",
|
||||
.nameprefix = "YUV",
|
||||
.nameBBCprefix = "BBC",
|
||||
.nameRGBprefix = "RGB",
|
||||
.nameYUVprefix = "YUV",
|
||||
.default_profile = "Apple/Apple_IIc_TTL",
|
||||
.init = cpld_init_ttl,
|
||||
.get_version = cpld_get_version,
|
||||
|
|
|
@ -319,7 +319,7 @@ typedef struct {
|
|||
#define MAX_BUFFER_SIZE 2048
|
||||
#define MAX_CONFIG_BUFFER_SIZE 8192
|
||||
#define DEFAULT_STRING "Default"
|
||||
#define ROOT_DEFAULT_STRING " ../Default"
|
||||
#define ROOT_DEFAULT_STRING "../Default"
|
||||
#define DEFAULTTXT_STRING "Default.txt"
|
||||
#define FAVOURITES_PATH "/favourites.txt"
|
||||
#define FAVOURITES_MENU "Recently used"
|
||||
|
@ -337,8 +337,6 @@ typedef struct {
|
|||
#define FORCE_UPDATE_FILE_MESSAGE "Deleting this file will force a CPLD update check on the next reset\r\n"
|
||||
#define BLANK_FILE "/cpld_firmware/recovery/blank/BLANK.xsvf"
|
||||
|
||||
#define CPLD_HEADER_LENGTH 6
|
||||
|
||||
#define PAXHEADER "PaxHeader"
|
||||
|
||||
#define NTSC_SOFT 0x04
|
||||
|
|
|
@ -403,21 +403,17 @@ void capture_screenshot(capture_info_t *capinfo, char *profile) {
|
|||
log_warn("Failed to create dir1 %s (result = %d)",CAPTURE_BASE, result);
|
||||
}
|
||||
|
||||
strcpy(filepath, profile);
|
||||
char *index = strchr(filepath, '/');
|
||||
if (index) {
|
||||
*index = 0;
|
||||
char *position = strchr(profile, '/');
|
||||
if (position) {
|
||||
strcpy(filepath, position + 1);
|
||||
} else {
|
||||
strcpy(filepath, profile);
|
||||
}
|
||||
|
||||
sprintf(path, "%s/%s", CAPTURE_BASE, filepath);
|
||||
result = f_mkdir(path);
|
||||
if (result != FR_OK && result != FR_EXIST) {
|
||||
log_warn("Failed to create dir2 %s (result = %d)",path, result);
|
||||
}
|
||||
|
||||
sprintf(path, "%s/%s", CAPTURE_BASE, profile);
|
||||
result = f_mkdir(path);
|
||||
if (result != FR_OK && result != FR_EXIST) {
|
||||
log_warn("Failed to create dir3 %s (result = %d)", path, result);
|
||||
log_warn("Failed to create dir2 %s (result = %d)", path, result);
|
||||
}
|
||||
|
||||
initialize_capture_id(path);
|
||||
|
@ -521,24 +517,24 @@ unsigned int file_read_profile(char *profile_name, int saved_config_number, char
|
|||
|
||||
if (saved_config_number == 0) {
|
||||
if (sub_profile_name != NULL) {
|
||||
sprintf(path, "%s/%s/%s/%s.txt", SAVED_PROFILE_BASE, cpld->name, profile_name + CPLD_HEADER_LENGTH, sub_profile_name);
|
||||
sprintf(path, "%s/%s/%s/%s.txt", SAVED_PROFILE_BASE, cpld->name, profile_name, sub_profile_name);
|
||||
} else {
|
||||
sprintf(path, "%s/%s/%s.txt", SAVED_PROFILE_BASE, cpld->name, profile_name + CPLD_HEADER_LENGTH);
|
||||
sprintf(path, "%s/%s/%s.txt", SAVED_PROFILE_BASE, cpld->name, profile_name);
|
||||
}
|
||||
} else {
|
||||
if (sub_profile_name != NULL) {
|
||||
sprintf(path, "%s/%s/%s/%s_%d.txt", SAVED_PROFILE_BASE, cpld->name, profile_name + CPLD_HEADER_LENGTH, sub_profile_name, saved_config_number);
|
||||
sprintf(path, "%s/%s/%s/%s_%d.txt", SAVED_PROFILE_BASE, cpld->name, profile_name, sub_profile_name, saved_config_number);
|
||||
} else {
|
||||
sprintf(path, "%s/%s/%s_%d.txt", SAVED_PROFILE_BASE, cpld->name, profile_name + CPLD_HEADER_LENGTH, saved_config_number);
|
||||
sprintf(path, "%s/%s/%s_%d.txt", SAVED_PROFILE_BASE, cpld->name, profile_name, saved_config_number);
|
||||
}
|
||||
}
|
||||
|
||||
result = f_open(&file, path, FA_READ);
|
||||
if (result != FR_OK) {
|
||||
if (sub_profile_name != NULL) {
|
||||
sprintf(path, "%s/%s/%s/%s.txt", PROFILE_BASE, cpld->name, profile_name + CPLD_HEADER_LENGTH, sub_profile_name);
|
||||
sprintf(path, "%s/%s/%s/%s.txt", PROFILE_BASE, cpld->name, profile_name, sub_profile_name);
|
||||
} else {
|
||||
sprintf(path, "%s/%s/%s.txt", PROFILE_BASE, cpld->name, profile_name + CPLD_HEADER_LENGTH);
|
||||
sprintf(path, "%s/%s/%s.txt", PROFILE_BASE, cpld->name, profile_name);
|
||||
}
|
||||
result = f_open(&file, path, FA_READ);
|
||||
if (result != FR_OK) {
|
||||
|
@ -615,7 +611,6 @@ void scan_cpld_filenames(char cpld_filenames[MAX_CPLD_FILENAMES][MAX_FILENAME_WI
|
|||
|
||||
void scan_profiles(char *prefix, char manufacturer_names[MAX_PROFILES][MAX_PROFILE_WIDTH], char profile_names[MAX_PROFILES][MAX_PROFILE_WIDTH], int has_sub_profiles[MAX_PROFILES], char *path, size_t *mcount, size_t *count) {
|
||||
int initial_count = *count;
|
||||
int initial_mcount = *mcount;
|
||||
FRESULT res;
|
||||
DIR dir;
|
||||
FIL file;
|
||||
|
@ -647,7 +642,7 @@ void scan_profiles(char *prefix, char manufacturer_names[MAX_PROFILES][MAX_PROFI
|
|||
}
|
||||
}
|
||||
f_closedir(&dir);
|
||||
qsort(manufacturer_names[initial_mcount], *mcount - initial_mcount, sizeof *manufacturer_names, string_compare);
|
||||
qsort(manufacturer_names, *mcount, sizeof *manufacturer_names, string_compare);
|
||||
for (int i = 0; i < *mcount; i++) {
|
||||
sprintf(fpath, "%s/%s", path, manufacturer_names[i]);
|
||||
log_info("Scanning folder: %s", fpath);
|
||||
|
@ -682,7 +677,7 @@ void scan_profiles(char *prefix, char manufacturer_names[MAX_PROFILES][MAX_PROFI
|
|||
qsort(profile_names[initial_count], (*count) - initial_count, sizeof *profile_names, string_compare);
|
||||
}
|
||||
for (int i = initial_count; i < (*count); i++) {
|
||||
sprintf(fpath, "%s/%s.txt", path, profile_names[i] + CPLD_HEADER_LENGTH);
|
||||
sprintf(fpath, "%s/%s.txt", path, profile_names[i] + strlen(prefix));
|
||||
res = f_open(&file, fpath, FA_READ);
|
||||
if (res == FR_OK) {
|
||||
f_close(&file);
|
||||
|
@ -703,7 +698,7 @@ void scan_sub_profiles(char sub_profile_names[MAX_SUB_PROFILES][MAX_PROFILE_WIDT
|
|||
char path[100] = "/Profiles/";
|
||||
strncat(path, cpld->name, 80);
|
||||
strncat(path, "/", 80);
|
||||
strncat(path, sub_path + CPLD_HEADER_LENGTH, 80);
|
||||
strncat(path, sub_path, 80);
|
||||
init_filesystem();
|
||||
res = f_opendir(&dir, path);
|
||||
if (res == FR_OK) {
|
||||
|
@ -854,7 +849,7 @@ int file_save(char *dirpath, char *name, char *buffer, unsigned int buffer_size,
|
|||
}
|
||||
|
||||
if (dirpath != NULL) {
|
||||
strcpy(temp_buffer, dirpath + CPLD_HEADER_LENGTH);
|
||||
strcpy(temp_buffer, dirpath);
|
||||
char *index = strchr(temp_buffer, '/');
|
||||
if (index) {
|
||||
*index = 0;
|
||||
|
@ -864,19 +859,19 @@ int file_save(char *dirpath, char *name, char *buffer, unsigned int buffer_size,
|
|||
if (result != FR_OK && result != FR_EXIST) {
|
||||
log_warn("Failed to create dir2 %s (result = %d)",path, result);
|
||||
}
|
||||
sprintf(path, "%s/%s/%s", SAVED_PROFILE_BASE, cpld->name, dirpath + CPLD_HEADER_LENGTH);
|
||||
sprintf(path, "%s/%s/%s", SAVED_PROFILE_BASE, cpld->name, dirpath);
|
||||
result = f_mkdir(path);
|
||||
if (result != FR_OK && result != FR_EXIST) {
|
||||
log_warn("Failed to create dir3 %s (result = %d)", dirpath + CPLD_HEADER_LENGTH, result);
|
||||
log_warn("Failed to create dir3 %s (result = %d)", dirpath, result);
|
||||
}
|
||||
if (saved_config_number == 0) {
|
||||
sprintf(path, "%s/%s/%s/%s.txt", SAVED_PROFILE_BASE, cpld->name, dirpath + CPLD_HEADER_LENGTH, name);
|
||||
sprintf(path, "%s/%s/%s/%s.txt", SAVED_PROFILE_BASE, cpld->name, dirpath, name);
|
||||
} else {
|
||||
sprintf(path, "%s/%s/%s/%s_%d.txt", SAVED_PROFILE_BASE, cpld->name, dirpath + CPLD_HEADER_LENGTH, name, saved_config_number);
|
||||
sprintf(path, "%s/%s/%s/%s_%d.txt", SAVED_PROFILE_BASE, cpld->name, dirpath, name, saved_config_number);
|
||||
}
|
||||
sprintf(comparison_path, "%s/%s/%s/%s.txt", PROFILE_BASE, cpld->name, dirpath + CPLD_HEADER_LENGTH, name);
|
||||
sprintf(comparison_path, "%s/%s/%s/%s.txt", PROFILE_BASE, cpld->name, dirpath, name);
|
||||
} else {
|
||||
strcpy(temp_buffer, name + CPLD_HEADER_LENGTH);
|
||||
strcpy(temp_buffer, name);
|
||||
char *index = strchr(temp_buffer, '/');
|
||||
if (index) {
|
||||
*index = 0;
|
||||
|
@ -888,11 +883,11 @@ int file_save(char *dirpath, char *name, char *buffer, unsigned int buffer_size,
|
|||
}
|
||||
|
||||
if (saved_config_number == 0) {
|
||||
sprintf(path, "%s/%s/%s.txt", SAVED_PROFILE_BASE, cpld->name, name + CPLD_HEADER_LENGTH);
|
||||
sprintf(path, "%s/%s/%s.txt", SAVED_PROFILE_BASE, cpld->name, name);
|
||||
} else {
|
||||
sprintf(path, "%s/%s/%s_%d.txt", SAVED_PROFILE_BASE, cpld->name, name + CPLD_HEADER_LENGTH, saved_config_number);
|
||||
sprintf(path, "%s/%s/%s_%d.txt", SAVED_PROFILE_BASE, cpld->name, name, saved_config_number);
|
||||
}
|
||||
sprintf(comparison_path, "%s/%s/%s.txt", PROFILE_BASE, cpld->name, name + CPLD_HEADER_LENGTH);
|
||||
sprintf(comparison_path, "%s/%s/%s.txt", PROFILE_BASE, cpld->name, name);
|
||||
}
|
||||
|
||||
log_info("Loading comparison file %s", comparison_path);
|
||||
|
@ -1015,21 +1010,21 @@ int file_restore(char *dirpath, char *name, int saved_config_number) {
|
|||
}
|
||||
|
||||
if (dirpath != NULL) {
|
||||
sprintf(path, "%s/%s/%s", SAVED_PROFILE_BASE, cpld->name, dirpath + CPLD_HEADER_LENGTH);
|
||||
sprintf(path, "%s/%s/%s", SAVED_PROFILE_BASE, cpld->name, dirpath);
|
||||
result = f_mkdir(path);
|
||||
if (result != FR_OK && result != FR_EXIST) {
|
||||
log_warn("Failed to create dir %s (result = %d)", dirpath + CPLD_HEADER_LENGTH, result);
|
||||
log_warn("Failed to create dir %s (result = %d)", dirpath, result);
|
||||
}
|
||||
if (saved_config_number == 0) {
|
||||
sprintf(path, "%s/%s/%s/%s.txt", SAVED_PROFILE_BASE, cpld->name, dirpath + CPLD_HEADER_LENGTH, name);
|
||||
sprintf(path, "%s/%s/%s/%s.txt", SAVED_PROFILE_BASE, cpld->name, dirpath, name);
|
||||
} else {
|
||||
sprintf(path, "%s/%s/%s/%s_%d.txt", SAVED_PROFILE_BASE, cpld->name, dirpath + CPLD_HEADER_LENGTH, name, saved_config_number);
|
||||
sprintf(path, "%s/%s/%s/%s_%d.txt", SAVED_PROFILE_BASE, cpld->name, dirpath, name, saved_config_number);
|
||||
}
|
||||
} else {
|
||||
if (saved_config_number == 0) {
|
||||
sprintf(path, "%s/%s/%s.txt", SAVED_PROFILE_BASE, cpld->name, name + CPLD_HEADER_LENGTH);
|
||||
sprintf(path, "%s/%s/%s.txt", SAVED_PROFILE_BASE, cpld->name, name);
|
||||
} else {
|
||||
sprintf(path, "%s/%s/%s_%d.txt", SAVED_PROFILE_BASE, cpld->name, name + CPLD_HEADER_LENGTH, saved_config_number);
|
||||
sprintf(path, "%s/%s/%s_%d.txt", SAVED_PROFILE_BASE, cpld->name, name, saved_config_number);
|
||||
}
|
||||
}
|
||||
log_info("File restored by deleting %s", path);
|
||||
|
|
|
@ -4,14 +4,10 @@
|
|||
#include "defs.h"
|
||||
#include "osd.h"
|
||||
void init_filesystem();
|
||||
|
||||
void capture_screenshot(capture_info_t *capinfo, char *profile);
|
||||
|
||||
void close_filesystem();
|
||||
|
||||
void scan_cpld_filenames(char cpld_filenames[MAX_CPLD_FILENAMES][MAX_FILENAME_WIDTH], char *path, int *count);
|
||||
void scan_profiles(char prefix[MAX_PROFILE_WIDTH], char manufacturer_names[MAX_PROFILES][MAX_PROFILE_WIDTH], char profile_names[MAX_PROFILES][MAX_PROFILE_WIDTH], int has_sub_profiles[MAX_PROFILES], char *path, size_t *mcount, size_t *count);
|
||||
|
||||
void scan_profiles(char *prefix, char manufacturer_names[MAX_PROFILES][MAX_PROFILE_WIDTH], char profile_names[MAX_PROFILES][MAX_PROFILE_WIDTH], int has_sub_profiles[MAX_PROFILES], char *path, size_t *mcount, size_t *count);
|
||||
void scan_sub_profiles(char sub_profile_names[MAX_SUB_PROFILES][MAX_PROFILE_WIDTH], char *sub_path, size_t *count);
|
||||
void write_profile_choice(char *profile_name, int saved_config_number, char* cpld_name);
|
||||
unsigned int file_read_profile(char *profile_name, int saved_config_number, char *sub_profile_name, int updatecmd, char *command_string, unsigned int buffer_size);
|
||||
|
@ -20,7 +16,7 @@ int file_save_config(char *resolution_name, int refresh, int scaling, int filter
|
|||
int file_load(char *path, char *buffer, unsigned int buffer_size);
|
||||
int file_save(char *dirpath, char *name, char *buffer, unsigned int buffer_size, int saved_config_number);
|
||||
int file_restore(char *dirpath, char *name, int saved_config_number);
|
||||
int create_and_scan_palettes(char names[MAX_NAMES][MAX_NAMES_WIDTH], uint32_t palette_array[MAX_NAMES][MAX_PALETTE_ENTRIES]);
|
||||
int create_and_scan_palettes(char names[MAX_NAMES][MAX_NAMES_WIDTH], uint32_t palette_array[MAX_NAMES][MAX_PALETTE_ENTRIES]);
|
||||
int file_save_bin(char *path, char *buffer, unsigned int buffer_size);
|
||||
int check_file(char* file_path, char* string);
|
||||
int test_file(char* file_path);
|
||||
|
|
133
src/osd.c
133
src/osd.c
|
@ -1027,7 +1027,11 @@ static char profile_names[MAX_PROFILES][MAX_PROFILE_WIDTH];
|
|||
static char sub_profile_names[MAX_SUB_PROFILES][MAX_PROFILE_WIDTH];
|
||||
static char resolution_names[MAX_NAMES][MAX_NAMES_WIDTH];
|
||||
static char favourite_names[MAX_FAVOURITES][MAX_PROFILE_WIDTH];
|
||||
static char current_cpld_header[MAX_PROFILE_WIDTH];
|
||||
static char current_cpld_prefix[MAX_PROFILE_WIDTH];
|
||||
static char BBC_cpld_prefix[MAX_PROFILE_WIDTH];
|
||||
static char RGB_cpld_prefix[MAX_PROFILE_WIDTH];
|
||||
static char YUV_cpld_prefix[MAX_PROFILE_WIDTH];
|
||||
static int cpld_prefix_length = 0;
|
||||
|
||||
static uint32_t palette_data[256];
|
||||
static uint32_t osd_palette_data[256];
|
||||
|
@ -1464,10 +1468,17 @@ void osd_display_interface(int line) {
|
|||
osd_set(line, 0, osdline);
|
||||
sprintf(osdline, "Scaling: %s", scaling_names[get_parameter(F_SCALING)]);
|
||||
osd_set(line + 1, 0, osdline);
|
||||
if (has_sub_profiles[get_parameter(F_PROFILE)]) {
|
||||
sprintf(osdline, "Profile: %s (%s)", profile_names[get_parameter(F_PROFILE)], sub_profile_names[get_parameter(F_SUB_PROFILE)]);
|
||||
char profile_name[MAX_PROFILE_WIDTH];
|
||||
char *position = strchr(profile_names[get_parameter(F_PROFILE)], '/');
|
||||
if (position) {
|
||||
strcpy(profile_name, position + 1);
|
||||
} else {
|
||||
sprintf(osdline, "Profile: %s", profile_names[get_parameter(F_PROFILE)]);
|
||||
strcpy(profile_name, profile_names[get_parameter(F_PROFILE)] + cpld_prefix_length);
|
||||
}
|
||||
if (has_sub_profiles[get_parameter(F_PROFILE)]) {
|
||||
sprintf(osdline, "Profile: %s (%s)", profile_name, sub_profile_names[get_parameter(F_SUB_PROFILE)]);
|
||||
} else {
|
||||
sprintf(osdline, "Profile: %s", profile_name);
|
||||
}
|
||||
osd_set(line + 2, 0, osdline);
|
||||
#ifdef USE_ARM_CAPTURE
|
||||
|
@ -1783,7 +1794,7 @@ static void rebuild_profile_menu(menu_t *menu) {
|
|||
}
|
||||
} else {
|
||||
for (i = 0; i <= features[F_PROFILE].max; i++) {
|
||||
if (strncmp(selected_manufacturer, profile_names[i] + CPLD_HEADER_LENGTH, strlen(selected_manufacturer)) == 0) {
|
||||
if (strncmp(selected_manufacturer, profile_names[i] + cpld_prefix_length, strlen(selected_manufacturer)) == 0) {
|
||||
log_info("Found: %s", profile_names[i]);
|
||||
profile_params[j].key = i;
|
||||
profile_params[j].label = profile_names[i];
|
||||
|
@ -1792,7 +1803,7 @@ static void rebuild_profile_menu(menu_t *menu) {
|
|||
}
|
||||
if (full_profile_count > (features[F_PROFILE].max + 1)) {
|
||||
for (i = features[F_PROFILE].max + 1; i < full_profile_count; i++) {
|
||||
if (strncmp(selected_manufacturer, profile_names[i] + CPLD_HEADER_LENGTH, strlen(selected_manufacturer)) == 0) {
|
||||
if (strncmp(selected_manufacturer, profile_names[i] + cpld_prefix_length, strlen(selected_manufacturer)) == 0) {
|
||||
log_info("Found other CPLD: %s", profile_names[i]);
|
||||
profile_params[j].key = i;
|
||||
profile_params[j].label = profile_names[i];
|
||||
|
@ -1859,18 +1870,18 @@ static void redraw_menu() {
|
|||
|
||||
if (index) {
|
||||
int offset = 0;
|
||||
if (strncmp(name, current_cpld_header, CPLD_HEADER_LENGTH) != 0) {
|
||||
if (strncmp(name, (char*)cpld->nameBBCprefix, CPLD_HEADER_LENGTH) == 0) {
|
||||
strcpy(mp, (char*)cpld->nameBBCprefix);
|
||||
offset = CPLD_HEADER_LENGTH;
|
||||
if (strncmp(name, current_cpld_prefix, cpld_prefix_length) != 0) {
|
||||
if (strncmp(name, BBC_cpld_prefix, cpld_prefix_length) == 0) {
|
||||
strcpy(mp, BBC_cpld_prefix);
|
||||
offset = cpld_prefix_length;
|
||||
}
|
||||
if (strncmp(name, (char*)cpld->nameRGBprefix, CPLD_HEADER_LENGTH) == 0) {
|
||||
strcpy(mp, (char*)cpld->nameRGBprefix);
|
||||
offset = CPLD_HEADER_LENGTH;
|
||||
if (strncmp(name, RGB_cpld_prefix, cpld_prefix_length) == 0) {
|
||||
strcpy(mp, RGB_cpld_prefix);
|
||||
offset = cpld_prefix_length;
|
||||
}
|
||||
if (strncmp(name, (char*)cpld->nameYUVprefix, CPLD_HEADER_LENGTH) == 0) {
|
||||
strcpy(mp, (char*)cpld->nameYUVprefix);
|
||||
offset = CPLD_HEADER_LENGTH;
|
||||
if (strncmp(name, YUV_cpld_prefix, cpld_prefix_length) == 0) {
|
||||
strcpy(mp, YUV_cpld_prefix);
|
||||
offset = cpld_prefix_length;
|
||||
}
|
||||
}
|
||||
strcpy(mp + offset, index + 1);
|
||||
|
@ -4437,7 +4448,11 @@ int save_profile(char *path, char *name, char *buffer, char *default_buffer, cha
|
|||
i++;
|
||||
}
|
||||
*pointer = 0;
|
||||
return file_save(path, name, buffer, pointer - buffer, get_parameter(F_SAVED_CONFIG));
|
||||
if (path != NULL) {
|
||||
return file_save(path + cpld_prefix_length, name, buffer, pointer - buffer, get_parameter(F_SAVED_CONFIG));
|
||||
} else {
|
||||
return file_save(path, name + cpld_prefix_length, buffer, pointer - buffer, get_parameter(F_SAVED_CONFIG));
|
||||
}
|
||||
}
|
||||
|
||||
void process_single_profile(char *buffer) {
|
||||
|
@ -4687,18 +4702,18 @@ void load_profiles(int profile_number, int save_selected) {
|
|||
strcpy(sub_profile_names[0], NOT_FOUND_STRING);
|
||||
sub_profile_buffers[0][0] = 0;
|
||||
if (has_sub_profiles[profile_number]) {
|
||||
bytes = file_read_profile(profile_names[profile_number], get_parameter(F_SAVED_CONFIG), DEFAULT_STRING, save_selected, sub_default_buffer, MAX_BUFFER_SIZE - 4);
|
||||
bytes = file_read_profile(profile_names[profile_number] + cpld_prefix_length, get_parameter(F_SAVED_CONFIG), DEFAULT_STRING, save_selected, sub_default_buffer, MAX_BUFFER_SIZE - 4);
|
||||
if (!bytes) {
|
||||
//if auto switching default.txt missing put a default value in buffer
|
||||
strcpy(sub_default_buffer,"auto_switch=1\r\n\0");
|
||||
log_info("Sub-profile default.txt missing, substituting %s", sub_default_buffer);
|
||||
}
|
||||
size_t count = 0;
|
||||
scan_sub_profiles(sub_profile_names, profile_names[profile_number], &count);
|
||||
scan_sub_profiles(sub_profile_names, profile_names[profile_number] + cpld_prefix_length, &count);
|
||||
if (count) {
|
||||
features[F_SUB_PROFILE].max = count - 1;
|
||||
for (int i = 0; i < count; i++) {
|
||||
file_read_profile(profile_names[profile_number], get_parameter(F_SAVED_CONFIG), sub_profile_names[i], 0, sub_profile_buffers[i], MAX_BUFFER_SIZE - 4);
|
||||
file_read_profile(profile_names[profile_number] + cpld_prefix_length, get_parameter(F_SAVED_CONFIG), sub_profile_names[i], 0, sub_profile_buffers[i], MAX_BUFFER_SIZE - 4);
|
||||
get_autoswitch_geometry(sub_profile_buffers[i], i);
|
||||
}
|
||||
}
|
||||
|
@ -4707,7 +4722,7 @@ void load_profiles(int profile_number, int save_selected) {
|
|||
strcpy(sub_profile_names[0], NONE_STRING);
|
||||
sub_profile_buffers[0][0] = 0;
|
||||
if (strcmp(profile_names[profile_number], NOT_FOUND_STRING) != 0) {
|
||||
file_read_profile(profile_names[profile_number], get_parameter(F_SAVED_CONFIG), NULL, save_selected, main_buffer, MAX_BUFFER_SIZE - 4);
|
||||
file_read_profile(profile_names[profile_number] + cpld_prefix_length, get_parameter(F_SAVED_CONFIG), NULL, save_selected, main_buffer, MAX_BUFFER_SIZE - 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4890,7 +4905,7 @@ void save_configuration() {
|
|||
}
|
||||
}
|
||||
if (result == 0) {
|
||||
sprintf(msg, "Saved: %s", path);
|
||||
sprintf(msg, "Saved: %s", path + cpld_prefix_length);
|
||||
} else {
|
||||
if (result == -1) {
|
||||
if (asresult == 0) {
|
||||
|
@ -5005,7 +5020,7 @@ int osd_key(int key) {
|
|||
|
||||
case A1_CAPTURE_SUB:
|
||||
// Capture screen shot
|
||||
capture_screenshot(capinfo, profile_names[get_feature(F_PROFILE)]);
|
||||
capture_screenshot(capinfo, profile_names[get_feature(F_PROFILE)] + cpld_prefix_length);
|
||||
// Fire OSD_EXPIRED in 50 frames time
|
||||
ret = 4;
|
||||
// come back to IDLE
|
||||
|
@ -5283,7 +5298,7 @@ int osd_key(int key) {
|
|||
}
|
||||
strcpy(favourite_names[favourites_count], FAVOURITES_MENU_CLEAR);
|
||||
|
||||
if (strncmp(current_cpld_header, item_name(item), CPLD_HEADER_LENGTH) != 0) {
|
||||
if (strncmp(current_cpld_prefix, item_name(item), cpld_prefix_length) != 0) {
|
||||
char msg[256];
|
||||
if (first_time_press == 0) {
|
||||
int major = (cpld->get_version() >> VERSION_MAJOR_BIT) & 0xF;
|
||||
|
@ -5297,22 +5312,22 @@ int osd_key(int key) {
|
|||
first_time_press = 1;
|
||||
} else {
|
||||
first_time_press = 0;
|
||||
if (strncmp((char*)cpld->nameBBCprefix, item_name(item), CPLD_HEADER_LENGTH) == 0) {
|
||||
write_profile_choice((char*)item_name(item), 0, (char*)cpld->nameBBC);
|
||||
if (strncmp(BBC_cpld_prefix, item_name(item), cpld_prefix_length) == 0) {
|
||||
write_profile_choice((char*)item_name(item) + cpld_prefix_length, 0, (char*)cpld->nameBBC);
|
||||
}
|
||||
if (strncmp((char*)cpld->nameRGBprefix, item_name(item), CPLD_HEADER_LENGTH) == 0) {
|
||||
write_profile_choice((char*)item_name(item), 0, (char*)cpld->nameRGB);
|
||||
if (strncmp(RGB_cpld_prefix, item_name(item), cpld_prefix_length) == 0) {
|
||||
write_profile_choice((char*)item_name(item) + cpld_prefix_length, 0, (char*)cpld->nameRGB);
|
||||
}
|
||||
if (strncmp((char*)cpld->nameYUVprefix, item_name(item), CPLD_HEADER_LENGTH) == 0) {
|
||||
write_profile_choice((char*)item_name(item), 0, (char*)cpld->nameYUV);
|
||||
if (strncmp(YUV_cpld_prefix, item_name(item), cpld_prefix_length) == 0) {
|
||||
write_profile_choice((char*)item_name(item) + cpld_prefix_length, 0, (char*)cpld->nameYUV);
|
||||
}
|
||||
int count;
|
||||
char cpld_dir[MAX_STRING_SIZE];
|
||||
strncpy(cpld_dir, cpld_firmware_dir, MAX_STRING_LIMIT);
|
||||
scan_cpld_filenames(cpld_filenames, cpld_dir, &count);
|
||||
char cpld_type[MAX_STRING_SIZE];
|
||||
strncpy(cpld_type, item_name(item) + 1, CPLD_HEADER_LENGTH - 3);
|
||||
cpld_type[CPLD_HEADER_LENGTH - 3] = 0;
|
||||
strcpy(cpld_type, item_name(item) + 1);
|
||||
cpld_type[strlen(cpld->nameprefix)] = 0;
|
||||
for(int i = 0; i < count; i++) {
|
||||
if(strstr(cpld_filenames[i], cpld_type) != 0) {
|
||||
sprintf(filename, "%s/%s.xsvf", cpld_firmware_dir, cpld_filenames[i]);
|
||||
|
@ -5444,10 +5459,10 @@ int osd_key(int key) {
|
|||
} else {
|
||||
first_time_press = 0;
|
||||
if (has_sub_profiles[get_feature(F_PROFILE)]) {
|
||||
file_restore(profile_names[get_feature(F_PROFILE)], "Default", get_parameter(F_SAVED_CONFIG));
|
||||
file_restore(profile_names[get_feature(F_PROFILE)], sub_profile_names[get_feature(F_SUB_PROFILE)], get_parameter(F_SAVED_CONFIG));
|
||||
file_restore(profile_names[get_feature(F_PROFILE)] + cpld_prefix_length, "Default", get_parameter(F_SAVED_CONFIG));
|
||||
file_restore(profile_names[get_feature(F_PROFILE)] + cpld_prefix_length, sub_profile_names[get_feature(F_SUB_PROFILE)], get_parameter(F_SAVED_CONFIG));
|
||||
} else {
|
||||
file_restore(NULL, profile_names[get_feature(F_PROFILE)], get_parameter(F_SAVED_CONFIG));
|
||||
file_restore(NULL, profile_names[get_feature(F_PROFILE)] + cpld_prefix_length, get_parameter(F_SAVED_CONFIG));
|
||||
}
|
||||
set_feature(F_SAVED_CONFIG, get_parameter(F_SAVED_CONFIG));
|
||||
force_reinit();
|
||||
|
@ -6292,6 +6307,28 @@ void osd_init() {
|
|||
}
|
||||
set_frontend(all_frontends[(cpld->get_version() >> VERSION_DESIGN_BIT) & 0x0F], 0);
|
||||
|
||||
|
||||
char name[100];
|
||||
char cpld_path[100] = "/Profiles/";
|
||||
char bbcpath[100] = "/Profiles/";
|
||||
char rgbpath[100] = "/Profiles/";
|
||||
char yuvpath[100] = "/Profiles/";
|
||||
|
||||
strncat(cpld_path, cpld->name, 80);
|
||||
strncat(bbcpath, cpld->nameBBC, 80);
|
||||
strncat(rgbpath, cpld->nameRGB, 80);
|
||||
strncat(yuvpath, cpld->nameYUV, 80);
|
||||
|
||||
sprintf (current_cpld_prefix, "(%s)_", cpld->nameprefix);
|
||||
sprintf (BBC_cpld_prefix, "(%s)_", cpld->nameBBCprefix);
|
||||
sprintf (RGB_cpld_prefix, "(%s)_", cpld->nameRGBprefix);
|
||||
sprintf (YUV_cpld_prefix, "(%s)_", cpld->nameYUVprefix);
|
||||
|
||||
cpld_prefix_length = strlen(current_cpld_prefix);
|
||||
|
||||
log_info("%s %s %s %s", current_cpld_prefix, BBC_cpld_prefix, RGB_cpld_prefix, YUV_cpld_prefix);
|
||||
log_info("current cpld prefix = '%s', %d", current_cpld_prefix, cpld_prefix_length);
|
||||
|
||||
favourites_count = 0;
|
||||
char favname[MAX_STRING_SIZE];
|
||||
cbytes = file_load(FAVOURITES_PATH, config_buffer, MAX_CONFIG_BUFFER_SIZE);
|
||||
|
@ -6310,48 +6347,32 @@ void osd_init() {
|
|||
}
|
||||
strcpy(favourite_names[favourites_count], FAVOURITES_MENU_CLEAR);
|
||||
|
||||
|
||||
|
||||
// default profile entry of not found
|
||||
features[F_PROFILE].max = 0;
|
||||
strcpy(profile_names[0], NOT_FOUND_STRING);
|
||||
default_buffer[0] = 0;
|
||||
has_sub_profiles[0] = 0;
|
||||
|
||||
char cpld_path[100] = "/Profiles/";
|
||||
char bbcpath[100] = "/Profiles/";
|
||||
char rgbpath[100] = "/Profiles/";
|
||||
char yuvpath[100] = "/Profiles/";
|
||||
|
||||
strncat(cpld_path, cpld->name, 80);
|
||||
strncat(bbcpath, cpld->nameBBC, 80);
|
||||
strncat(rgbpath, cpld->nameRGB, 80);
|
||||
strncat(yuvpath, cpld->nameYUV, 80);
|
||||
|
||||
log_info("%s %s %s %s", cpld_path, bbcpath, rgbpath, yuvpath);
|
||||
|
||||
char name[100];
|
||||
sprintf(current_cpld_header, "%s", (char*)cpld->nameprefix);
|
||||
log_info("current cpld header = '%s'", current_cpld_header);
|
||||
// pre-read default profile
|
||||
unsigned int bytes = file_read_profile(ROOT_DEFAULT_STRING, 0, NULL, 0, default_buffer, MAX_BUFFER_SIZE - 4);
|
||||
if (bytes != 0) {
|
||||
size_t count = 0;
|
||||
size_t mcount = 0;
|
||||
scan_profiles(current_cpld_header, manufacturer_names, profile_names, has_sub_profiles, cpld_path, &mcount, &count);
|
||||
scan_profiles(current_cpld_prefix, manufacturer_names, profile_names, has_sub_profiles, cpld_path, &mcount, &count);
|
||||
features[F_PROFILE].max = count - 1;
|
||||
|
||||
if (strcmp(cpld_path, bbcpath) != 0) {
|
||||
log_info("Scanning BBC extra profiles");
|
||||
scan_profiles((char*)cpld->nameBBCprefix, manufacturer_names, profile_names, has_sub_profiles, bbcpath, &mcount, &count);
|
||||
scan_profiles(BBC_cpld_prefix, manufacturer_names, profile_names, has_sub_profiles, bbcpath, &mcount, &count);
|
||||
}
|
||||
if (strcmp(cpld_path, rgbpath) != 0) {
|
||||
log_info("Scanning RGB extra profiles");
|
||||
scan_profiles((char*)cpld->nameRGBprefix, manufacturer_names, profile_names, has_sub_profiles, rgbpath, &mcount, &count);
|
||||
scan_profiles(RGB_cpld_prefix, manufacturer_names, profile_names, has_sub_profiles, rgbpath, &mcount, &count);
|
||||
}
|
||||
if (strcmp(cpld_path, yuvpath) != 0) {
|
||||
log_info("Scanning YUV extra profiles");
|
||||
scan_profiles((char*)cpld->nameYUVprefix, manufacturer_names, profile_names, has_sub_profiles, yuvpath, &mcount, &count);
|
||||
scan_profiles(YUV_cpld_prefix, manufacturer_names, profile_names, has_sub_profiles, yuvpath, &mcount, &count);
|
||||
}
|
||||
|
||||
strcpy(manufacturer_names[mcount], FAVOURITES_MENU);
|
||||
|
@ -6394,7 +6415,7 @@ void osd_init() {
|
|||
int found_profile = 0;
|
||||
if (prop) {
|
||||
for (int i=0; i<= features[F_PROFILE].max; i++) {
|
||||
if (strcmp(profile_names[i], prop) == 0) {
|
||||
if (strcmp(profile_names[i] + cpld_prefix_length, prop) == 0) {
|
||||
set_parameter(F_PROFILE, i);
|
||||
load_profiles(i, 0);
|
||||
process_profile(i);
|
||||
|
|
Ładowanie…
Reference in New Issue