mirror of
https://github.com/holub/mame
synced 2025-05-31 18:11:50 +03:00
Merge pull request #5136 from shattered/_e86aff7456
imgtool: MT 6693 wip, solves mess_hd issue (nw)
This commit is contained in:
commit
8359611d34
@ -788,6 +788,7 @@ chd_error chd_file::open(util::core_file &file, bool writeable, chd_file *parent
|
|||||||
m_file = &file;
|
m_file = &file;
|
||||||
m_owns_file = false;
|
m_owns_file = false;
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
|
m_cachehunk = ~0;
|
||||||
return open_common(writeable);
|
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_error rc;
|
||||||
chd_codec_type compression[4] = { CHD_CODEC_NONE };
|
chd_codec_type compression[4] = { CHD_CODEC_NONE };
|
||||||
|
|
||||||
/* sanity check args */
|
/* sanity check args -- see parse_hunk_size() in src/lib/util/chd.cpp */
|
||||||
if (hunksize >= 2048)
|
if (hunksize > (1024 * 1024))
|
||||||
{
|
{
|
||||||
err = IMGTOOLERR_PARAMCORRUPT;
|
err = IMGTOOLERR_PARAMCORRUPT;
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
if (hunksize <= 0)
|
if (hunksize <= 0)
|
||||||
hunksize = 1024; /* default value */
|
hunksize = 4096; /* default value */
|
||||||
|
|
||||||
/* bail if we are read only */
|
/* bail if we are read only */
|
||||||
if (stream.is_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;
|
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 */
|
/* write the metadata */
|
||||||
const std::string metadata = string_format(HARD_DISK_METADATA_FORMAT, cylinders, heads, sectors, seclen);
|
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);
|
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_INT(mess_hd_createopts_seclen, "seclen", "Sector Bytes" )
|
||||||
OPTION_GUIDE_END
|
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)
|
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);
|
sectors = createoptions->lookup_int(mess_hd_createopts_sectors);
|
||||||
seclen = createoptions->lookup_int(mess_hd_createopts_seclen);
|
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_INT('S', "sectors", "Sectors" )
|
||||||
OPTION_GUIDE_END
|
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 fat8_string[8] = { 'F', 'A', 'T', ' ', ' ', ' ', ' ', ' ' };
|
||||||
static const char fat12_string[8] = { 'F', 'A', 'T', '1', '2', ' ', ' ', ' ' };
|
static const char fat12_string[8] = { 'F', 'A', 'T', '1', '2', ' ', ' ', ' ' };
|
||||||
|
Loading…
Reference in New Issue
Block a user