Export settings fixes and improvements

* fix compatibility with Windows
* add RAW export option
This commit is contained in:
marqs 2022-01-08 15:26:08 +02:00
parent cbe2611471
commit 101a23bdb5
5 changed files with 7487 additions and 7433 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2019 Markus Hiienkari <mhiienka@niksula.hut.fi>
// Copyright (C) 2015-2022 Markus Hiienkari <mhiienka@niksula.hut.fi>
//
// This file is part of Open Source Scan Converter project.
//
@ -993,7 +993,7 @@ int main()
printf("### DIY VIDEO DIGITIZER / SCANCONVERTER INIT OK ###\n\n");
sniprintf(row1, LCD_ROW_LEN+1, "OSSC fw. %u.%.2u" FW_SUFFIX1 FW_SUFFIX2, FW_VER_MAJOR, FW_VER_MINOR);
#ifndef DEBUG
strncpy(row2, "2014-2020 marqs", LCD_ROW_LEN+1);
strncpy(row2, "2014-2022 marqs", LCD_ROW_LEN+1);
#else
strncpy(row2, "** DEBUG BUILD *", LCD_ROW_LEN+1);
#endif

View File

@ -24,17 +24,12 @@
/*
* The beginning of the boot sector, along with the BPB.
* Volume offsets 0x003 to 0x01a, inclusive.
* The BPB spans volume offsets 0x00b to 0x01c, inclusive.
*
* The jump instruction at volume offsets 0x000 to 0x002, inclusive,
* is left zeroed out to save a tiny bit of space.
*/
static const alt_u8 bootsec_beg_bpb_16[24] = {
/* Three zeros */ 0x4d, 0x53, 0x57, 0x49, 0x4e, /* 0x003...0x007 */
0x34, 0x2e, 0x31, 0x00, 0x02, 0x04, 0x80, 0x00, /* 0x008...0x00f */
0x02, 0x00, 0x08, 0x00, 0x80, 0xf8, 0x20, 0x00, /* 0x010...0x017 */
0x3f, 0x00, 0xff, /* Zeros until 0x024 */ /* 0x018...0x01a */
static const alt_u8 bootsec_beg_bpb_16[27] = {
0xeb, 0x00, 0x90, /* 0x000: Code (x86 short jump + NOP) */
0x4d, 0x53, 0x57, 0x49, 0x4e, 0x34, 0x2e, 0x31, /* 0x003: OS Name */
0x00, 0x02, 0x04, 0x80, 0x00, 0x02, 0x00, 0x08, /* 0x00B: Bios Parameter Block */
0x00, 0x80, 0xf8, 0x20, 0x00, 0x3f, 0x00, 0xff,
};
/*
@ -60,7 +55,7 @@ static const alt_u8 bootsec_after_bpb_16[26] = {
*/
void generate_boot_sector_16(alt_u8 *const buf) {
/* Initial FAT16 boot sector contents + the BPB. */
memcpy(buf + 3, bootsec_beg_bpb_16, 24);
memcpy(buf, bootsec_beg_bpb_16, sizeof(bootsec_beg_bpb_16));
/*
* Then the rest of the boot sector.
@ -70,7 +65,7 @@ void generate_boot_sector_16(alt_u8 *const buf) {
* be a deviation from the FAT16 spec, but should be harmless
* for our purposes.
*/
memcpy(buf + 36, bootsec_after_bpb_16, 26);
memcpy(buf + 36, bootsec_after_bpb_16, sizeof(bootsec_after_bpb_16));
/* RISC-V is little-endian, so do a 16-bit write instead. */
*((alt_u16*)(buf + 510)) = 0xaa55U;

View File

@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2019 Markus Hiienkari <mhiienka@niksula.hut.fi>
// Copyright (C) 2015-2022 Markus Hiienkari <mhiienka@niksula.hut.fi>
//
// This file is part of Open Source Scan Converter project.
//
@ -24,7 +24,7 @@
#include "sysconfig.h"
#define FW_VER_MAJOR 0
#define FW_VER_MINOR 89
#define FW_VER_MINOR 90
#define PROFILE_VER_MAJOR 0
#define PROFILE_VER_MINOR 88

View File

@ -383,7 +383,7 @@ int export_userdata()
"1=ジッコウスル 2=ヤメル" "\0" // [31..46]
"ドチラカエランデクダサイ" // [47..60]
);
alt_u32 btn_vec;
alt_u32 btn_vec, sd_block_offset;
_Static_assert(SD_BLK_SIZE == FAT16_SECTOR_SIZE, "Sector size mismatch");
@ -419,9 +419,23 @@ eval_button:
prompt_state = 3;
}
usleep(100000U);
strncpy(menu_row1,"SD Format", LCD_ROW_LEN+1);
strncpy(menu_row2,"1=FAT16, 2=RAW", LCD_ROW_LEN+1);
ui_disp_menu(2);
if ((!poll_yesno(5000000U, &btn_vec)) || ((btn_vec != rc_keymap[RC_BTN1]) && (btn_vec != rc_keymap[RC_BTN2]))) {
retval = UDATA_EXPT_CANCELLED;
goto out;
}
sd_block_offset = (btn_vec == rc_keymap[RC_BTN1]) ? (PROF_16_DATA_OFS/SD_BLK_SIZE) : 1;
strncpy(menu_row2, LNG("Exporting...", "オマチクダサイ"), LCD_ROW_LEN+1);
ui_disp_menu(2);
// RAW copy
if (btn_vec == rc_keymap[RC_BTN2])
goto copy_start;
/* Zero out the boot sector, FATs and root directory. */
memset(databuf, 0, SD_BLK_SIZE);
for (alt_u32 sector = 0;
@ -465,9 +479,10 @@ eval_button:
if (retval)
goto out;
copy_start:
/* This may wear the SD card a bit more than necessary... */
retval = copy_flash_to_sd(USERDATA_OFFSET/PAGESIZE,
PROF_16_DATA_OFS/SD_BLK_SIZE,
sd_block_offset,
(MAX_USERDATA_ENTRY + 1) * SECTORSIZE,
databuf);