mirror of
https://github.com/marqs85/ossc.git
synced 2025-02-11 07:30:39 +00:00
more fixes to settings import/export
This commit is contained in:
parent
101a23bdb5
commit
e1fbd4ad36
File diff suppressed because it is too large
Load Diff
@ -72,7 +72,7 @@ alt_u8 stable_frames;
|
||||
alt_u8 update_cur_vm;
|
||||
|
||||
alt_u8 profile_sel, profile_sel_menu, input_profiles[AV_LAST], lt_sel, def_input, profile_link, lcd_bl_timeout;
|
||||
alt_u8 osd_enable, osd_enable_pre=1, osd_status_timeout, osd_status_timeout_pre=1;
|
||||
alt_u8 osd_enable=1, osd_status_timeout=1;
|
||||
alt_u8 auto_input, auto_av1_ypbpr, auto_av2_ypbpr = 1, auto_av3_ypbpr;
|
||||
|
||||
char row1[LCD_ROW_LEN+1], row2[LCD_ROW_LEN+1], menu_row1[LCD_ROW_LEN+1], menu_row2[LCD_ROW_LEN+1];
|
||||
@ -875,8 +875,6 @@ int init_hw()
|
||||
read_userdata(profile_sel, 0);
|
||||
|
||||
// Setup OSD
|
||||
osd_enable = osd_enable_pre;
|
||||
osd_status_timeout = osd_status_timeout_pre;
|
||||
osd->osd_config.x_size = 0;
|
||||
osd->osd_config.y_size = 0;
|
||||
osd->osd_config.x_offset = 3;
|
||||
@ -1191,9 +1189,7 @@ int main()
|
||||
printf("Changing AV3 RGB source\n");
|
||||
cm.cc.av3_alt_rgb = tc.av3_alt_rgb;
|
||||
}
|
||||
if ((osd_enable != osd_enable_pre) || (osd_status_timeout != osd_status_timeout_pre)) {
|
||||
osd_enable = osd_enable_pre;
|
||||
osd_status_timeout = osd_status_timeout_pre;
|
||||
if ((!!osd_enable != osd->osd_config.enable) || (osd_status_timeout != osd->osd_config.status_timeout)) {
|
||||
osd->osd_config.enable = !!osd_enable;
|
||||
osd->osd_config.status_timeout = osd_status_timeout;
|
||||
if (menu_active) {
|
||||
|
@ -129,5 +129,5 @@ alt_u16 generate_fat16(void *const buf, const alt_u16 written) {
|
||||
const alt_u8 prof_dirent_16[PROF_DIRENT_16_SIZE] = {
|
||||
0x4f, 0x53, 0x53, 0x43, 0x50, 0x52, 0x4f, 0x46, 0x42, 0x49, 0x4e, 0x20,
|
||||
0x00, 0x8e, 0x04, 0xb5, 0x6f, 0x51, 0x6f, 0x51, 0x00, 0x00, 0x17, 0x89,
|
||||
0x6f, 0x51, 0x02, 0x00, 0x00, 0x00, 0x10, 0x00,
|
||||
0x6f, 0x51, 0x02, 0x00, 0x00, 0x02, 0x10, 0x00,
|
||||
};
|
||||
|
@ -59,11 +59,11 @@
|
||||
extern const alt_u8 prof_dirent_16[PROF_DIRENT_16_SIZE];
|
||||
|
||||
#define PROF_16_DATA_OFS 0x028000UL
|
||||
#define PROF_16_DATA_SIZE 0x100000UL
|
||||
#define PROF_16_CLUSTER_COUNT (PROF_16_DATA_SIZE/FAT16_CLUSTER_SIZE)
|
||||
#define PROF_16_DATA_SIZE 0x100200UL
|
||||
#define PROF_16_CLUSTER_COUNT ((PROF_16_DATA_SIZE/FAT16_CLUSTER_SIZE)+!!(PROF_16_DATA_SIZE%FAT16_CLUSTER_SIZE))
|
||||
/* Profile file data starts at offset 0x00028000 */
|
||||
/* Profile file data ends at offset 0x00128000 */
|
||||
/* Profile file data is exactly 1 MiB long. */
|
||||
/* Profile file data ends at offset 0x00128200 */
|
||||
/* Profile file data is 1049088 bytes long. */
|
||||
|
||||
|
||||
/* Generate a FAT16 boot sector.
|
||||
|
@ -38,7 +38,7 @@ extern alt_u16 rc_keymap[REMOTE_MAX_KEYS];
|
||||
extern alt_u8 vm_sel, profile_sel_menu, lt_sel, def_input, profile_link, lcd_bl_timeout;
|
||||
extern alt_u8 auto_input, auto_av1_ypbpr, auto_av2_ypbpr, auto_av3_ypbpr;
|
||||
extern alt_u8 update_cur_vm;
|
||||
extern alt_u8 osd_enable, osd_enable_pre, osd_status_timeout_pre;
|
||||
extern alt_u8 osd_enable, osd_status_timeout;
|
||||
extern char target_profile_name[PROFILE_NAME_LEN+1];
|
||||
extern volatile osd_regs *osd;
|
||||
|
||||
@ -229,8 +229,8 @@ MENU(menu_settings, P99_PROTECT({ \
|
||||
{ "Auto AV2 Y/Gs", OPT_AVCONFIG_SELECTION, { .sel = { &auto_av2_ypbpr, OPT_WRAP, SETTING_ITEM(rgsb_ypbpr_desc) } } },
|
||||
{ "Auto AV3 Y/Gs", OPT_AVCONFIG_SELECTION, { .sel = { &auto_av3_ypbpr, OPT_WRAP, SETTING_ITEM(rgsb_ypbpr_desc) } } },
|
||||
{ "LCD BL timeout", OPT_AVCONFIG_SELECTION, { .sel = { &lcd_bl_timeout, OPT_WRAP, SETTING_ITEM(lcd_bl_timeout_desc) } } },
|
||||
{ "OSD", OPT_AVCONFIG_SELECTION, { .sel = { &osd_enable_pre, OPT_WRAP, SETTING_ITEM(osd_enable_desc) } } },
|
||||
{ "OSD status disp.", OPT_AVCONFIG_SELECTION, { .sel = { &osd_status_timeout_pre, OPT_WRAP, SETTING_ITEM(osd_status_desc) } } },
|
||||
{ "OSD", OPT_AVCONFIG_SELECTION, { .sel = { &osd_enable, OPT_WRAP, SETTING_ITEM(osd_enable_desc) } } },
|
||||
{ "OSD status disp.", OPT_AVCONFIG_SELECTION, { .sel = { &osd_status_timeout, OPT_WRAP, SETTING_ITEM(osd_status_desc) } } },
|
||||
#ifndef DEBUG
|
||||
{ LNG("<Import sett. >","<セッテイヨミコミ >"), OPT_FUNC_CALL, { .fun = { import_userdata, NULL } } },
|
||||
{ LNG("<Export sett. >","<セッテイカキコミ >"), OPT_FUNC_CALL, { .fun = { export_userdata, NULL } } },
|
||||
|
@ -43,7 +43,7 @@ extern alt_u8 profile_sel;
|
||||
extern alt_u8 def_input, profile_link;
|
||||
extern alt_u8 lcd_bl_timeout;
|
||||
extern alt_u8 auto_input, auto_av1_ypbpr, auto_av2_ypbpr, auto_av3_ypbpr;
|
||||
extern alt_u8 osd_enable_pre, osd_status_timeout_pre;
|
||||
extern alt_u8 osd_enable, osd_status_timeout;
|
||||
extern SD_DEV sdcard_dev;
|
||||
extern alt_flash_dev *epcq_dev;
|
||||
extern char menu_row1[LCD_ROW_LEN+1], menu_row2[LCD_ROW_LEN+1];
|
||||
@ -81,8 +81,8 @@ int write_userdata(alt_u8 entry)
|
||||
((ude_initcfg*)databuf)->auto_av1_ypbpr = auto_av1_ypbpr;
|
||||
((ude_initcfg*)databuf)->auto_av2_ypbpr = auto_av2_ypbpr;
|
||||
((ude_initcfg*)databuf)->auto_av3_ypbpr = auto_av3_ypbpr;
|
||||
((ude_initcfg*)databuf)->osd_enable = osd_enable_pre;
|
||||
((ude_initcfg*)databuf)->osd_status_timeout = osd_status_timeout_pre;
|
||||
((ude_initcfg*)databuf)->osd_enable = osd_enable;
|
||||
((ude_initcfg*)databuf)->osd_status_timeout = osd_status_timeout;
|
||||
memcpy(((ude_initcfg*)databuf)->keys, rc_keymap, sizeof(rc_keymap));
|
||||
for (i=0; i<sizeof(ude_initcfg); i++)
|
||||
databuf[i] = bitswap8(databuf[i]);
|
||||
@ -192,8 +192,8 @@ int read_userdata(alt_u8 entry, int dry_run)
|
||||
auto_av1_ypbpr = ((ude_initcfg*)databuf)->auto_av1_ypbpr;
|
||||
auto_av2_ypbpr = ((ude_initcfg*)databuf)->auto_av2_ypbpr;
|
||||
auto_av3_ypbpr = ((ude_initcfg*)databuf)->auto_av3_ypbpr;
|
||||
osd_enable_pre = ((ude_initcfg*)databuf)->osd_enable;
|
||||
osd_status_timeout_pre = ((ude_initcfg*)databuf)->osd_status_timeout;
|
||||
osd_enable = ((ude_initcfg*)databuf)->osd_enable;
|
||||
osd_status_timeout = ((ude_initcfg*)databuf)->osd_status_timeout;
|
||||
profile_link = ((ude_initcfg*)databuf)->profile_link;
|
||||
profile_sel = input_profiles[AV_TESTPAT]; // Global profile
|
||||
lcd_bl_timeout = ((ude_initcfg*)databuf)->lcd_bl_timeout;
|
||||
@ -302,12 +302,13 @@ int import_userdata()
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((header.version_major != PROFILE_VER_MAJOR) || (header.version_minor != PROFILE_VER_MINOR)) {
|
||||
printf("Data version %u.%u does not match fw\n", header.version_major, header.version_minor);
|
||||
if ((header.type == UDE_PROFILE) && ((header.version_major != PROFILE_VER_MAJOR) || (header.version_minor != PROFILE_VER_MINOR))) {
|
||||
printf("Profile version %u.%u does not match current one\n", header.version_major, header.version_minor);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (header.type > UDE_PROFILE) {
|
||||
} else if ((header.type == UDE_INITCFG) && ((header.version_major != INITCFG_VER_MAJOR) || (header.version_minor != INITCFG_VER_MINOR))) {
|
||||
printf("Initconfig version %u.%u does not match current one\n", header.version_major, header.version_minor);
|
||||
continue;
|
||||
} else if (header.type > UDE_PROFILE) {
|
||||
printf("Unknown userdata entry type %u\n", header.type);
|
||||
continue;
|
||||
}
|
||||
@ -323,6 +324,9 @@ int import_userdata()
|
||||
entries_imported++;
|
||||
}
|
||||
|
||||
// flash read immediately after write might fail, add some delay
|
||||
usleep(1000);
|
||||
|
||||
read_userdata(INIT_CONFIG_SLOT, 0);
|
||||
profile_sel = input_profiles[target_input];
|
||||
read_userdata(profile_sel, 0);
|
||||
@ -427,7 +431,7 @@ eval_button:
|
||||
retval = UDATA_EXPT_CANCELLED;
|
||||
goto out;
|
||||
}
|
||||
sd_block_offset = (btn_vec == rc_keymap[RC_BTN1]) ? (PROF_16_DATA_OFS/SD_BLK_SIZE) : 1;
|
||||
sd_block_offset = (btn_vec == rc_keymap[RC_BTN1]) ? (PROF_16_DATA_OFS/SD_BLK_SIZE) : 0;
|
||||
|
||||
strncpy(menu_row2, LNG("Exporting...", "オマチクダサイ"), LCD_ROW_LEN+1);
|
||||
ui_disp_menu(2);
|
||||
@ -480,6 +484,12 @@ eval_button:
|
||||
goto out;
|
||||
|
||||
copy_start:
|
||||
// Zero out first 512 bytes (1 SD block) of the file
|
||||
memset(databuf, 0, SD_BLK_SIZE);
|
||||
retval = SD_Write(&sdcard_dev, databuf, sd_block_offset++);
|
||||
if (retval)
|
||||
goto out;
|
||||
|
||||
/* This may wear the SD card a bit more than necessary... */
|
||||
retval = copy_flash_to_sd(USERDATA_OFFSET/PAGESIZE,
|
||||
sd_block_offset,
|
||||
|
Loading…
x
Reference in New Issue
Block a user