mirror of
https://github.com/holub/mame
synced 2025-04-24 01:11:11 +03:00
imgtool: MT 6693 wip, solves mess_hd issue (nw)
This commit is contained in:
parent
6deb0d35e3
commit
63c0ee96ec
@ -788,6 +788,7 @@ chd_error chd_file::open(util::core_file &file, bool writeable, chd_file *parent
|
||||
m_file = &file;
|
||||
m_owns_file = false;
|
||||
m_parent = parent;
|
||||
m_cachehunk = ~0;
|
||||
return open_common(writeable);
|
||||
}
|
||||
|
||||
|
@ -53,14 +53,14 @@ imgtoolerr_t imghd_create(imgtool::stream &stream, uint32_t hunksize, uint32_t c
|
||||
chd_error rc;
|
||||
chd_codec_type compression[4] = { CHD_CODEC_NONE };
|
||||
|
||||
/* sanity check args */
|
||||
if (hunksize >= 2048)
|
||||
/* sanity check args -- see parse_hunk_size() in src/lib/util/chd.cpp */
|
||||
if (hunksize > (1024 * 1024))
|
||||
{
|
||||
err = IMGTOOLERR_PARAMCORRUPT;
|
||||
return err;
|
||||
}
|
||||
if (hunksize <= 0)
|
||||
hunksize = 1024; /* default value */
|
||||
hunksize = 4096; /* default value */
|
||||
|
||||
/* bail if we are read only */
|
||||
if (stream.is_read_only())
|
||||
@ -80,15 +80,6 @@ imgtoolerr_t imghd_create(imgtool::stream &stream, uint32_t hunksize, uint32_t c
|
||||
return err;
|
||||
}
|
||||
|
||||
/* open the new hard drive */
|
||||
rc = chd.open(*stream.core_file());
|
||||
|
||||
if (rc != CHDERR_NONE)
|
||||
{
|
||||
err = map_chd_error(rc);
|
||||
return err;
|
||||
}
|
||||
|
||||
/* write the metadata */
|
||||
const std::string metadata = string_format(HARD_DISK_METADATA_FORMAT, cylinders, heads, sectors, seclen);
|
||||
err = (imgtoolerr_t)chd.write_metadata(HARD_DISK_METADATA_TAG, 0, metadata);
|
||||
@ -236,7 +227,7 @@ OPTION_GUIDE_START( mess_hd_create_optionguide )
|
||||
OPTION_INT(mess_hd_createopts_seclen, "seclen", "Sector Bytes" )
|
||||
OPTION_GUIDE_END
|
||||
|
||||
#define mess_hd_create_optionspecs "B[1]-2048;C1-[32]-65536;D1-[8]-64;E1-[128]-4096;F128/256/[512]/1024/2048/4096/8192/16384/32768/65536"
|
||||
#define mess_hd_create_optionspecs "B1-[4]-2048;C1-[32]-65536;D1-[8]-64;E1-[128]-4096;F128/256/[512]/1024/2048/4096/8192/16384/32768/65536"
|
||||
|
||||
|
||||
void hd_get_info(const imgtool_class *imgclass, uint32_t state, union imgtoolinfo *info)
|
||||
@ -267,5 +258,5 @@ static imgtoolerr_t mess_hd_image_create(imgtool::image &image, imgtool::stream:
|
||||
sectors = createoptions->lookup_int(mess_hd_createopts_sectors);
|
||||
seclen = createoptions->lookup_int(mess_hd_createopts_seclen);
|
||||
|
||||
return imghd_create(*stream.get(), blocksize, cylinders, heads, sectors, seclen);
|
||||
return imghd_create(*stream.get(), blocksize * seclen, cylinders, heads, sectors, seclen);
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ OPTION_GUIDE_START( pc_chd_create_optionguide )
|
||||
OPTION_INT('S', "sectors", "Sectors" )
|
||||
OPTION_GUIDE_END
|
||||
|
||||
static const char pc_chd_create_optionspec[] = "H1-[16]S1-[32]-63T10/20/30/40/50/60/70/80/90/[100]/110/120/130/140/150/160/170/180/190/200";
|
||||
static const char pc_chd_create_optionspec[] = "H1-[16];S1-[32]-63;T10/20/30/40/50/60/70/80/90/[100]/110/120/130/140/150/160/170/180/190/200";
|
||||
|
||||
static const char fat8_string[8] = { 'F', 'A', 'T', ' ', ' ', ' ', ' ', ' ' };
|
||||
static const char fat12_string[8] = { 'F', 'A', 'T', '1', '2', ' ', ' ', ' ' };
|
||||
|
Loading…
Reference in New Issue
Block a user