diff options
author | 2019-09-20 00:28:19 +1000 | |
---|---|---|
committer | 2019-09-20 00:28:19 +1000 | |
commit | dac7094f3431b8f933497b0c7693e6baeb1bb75c (patch) | |
tree | 1c3dc049110c54d23dc31a1e6c1e8b11fd24e299 /src/devices/imagedev/diablo.cpp | |
parent | cc25024f791747fa17c1f06bd81c482a86aac91b (diff) |
(nw) misc cleanup:
* get rid of most assert_always
* get rid of a few MCFG_*_OVERRIDE
Diffstat (limited to 'src/devices/imagedev/diablo.cpp')
-rw-r--r-- | src/devices/imagedev/diablo.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/devices/imagedev/diablo.cpp b/src/devices/imagedev/diablo.cpp index 5e8162ce842..f7da6fa26cb 100644 --- a/src/devices/imagedev/diablo.cpp +++ b/src/devices/imagedev/diablo.cpp @@ -110,35 +110,32 @@ image_init_result diablo_image_device::call_load() image_init_result diablo_image_device::call_create(int create_format, util::option_resolution *create_args) { int err; - uint32_t sectorsize, hunksize; - uint32_t cylinders, heads, sectors, totalsectors; - assert_always(create_args != nullptr, "Expected create_args to not be nullptr"); - cylinders = create_args->lookup_int('C'); - heads = create_args->lookup_int('H'); - sectors = create_args->lookup_int('S'); - sectorsize = create_args->lookup_int('L') * sizeof(uint16_t); - hunksize = create_args->lookup_int('K'); + if (!create_args) + throw emu_fatalerror("diablo_image_device::call_create: Expected create_args to not be nullptr"); - totalsectors = cylinders * heads * sectors; + const uint32_t cylinders = create_args->lookup_int('C'); + const uint32_t heads = create_args->lookup_int('H'); + const uint32_t sectors = create_args->lookup_int('S'); + const uint32_t sectorsize = create_args->lookup_int('L') * sizeof(uint16_t); + const uint32_t hunksize = create_args->lookup_int('K'); + + const uint32_t totalsectors = cylinders * heads * sectors; /* create the CHD file */ chd_codec_type compression[4] = { CHD_CODEC_NONE }; err = m_origchd.create(image_core_file(), (uint64_t)totalsectors * (uint64_t)sectorsize, hunksize, sectorsize, compression); if (err != CHDERR_NONE) - goto error; + return image_init_result::FAIL; /* if we created the image and hence, have metadata to set, set the metadata */ err = m_origchd.write_metadata(HARD_DISK_METADATA_TAG, 0, string_format(HARD_DISK_METADATA_FORMAT, cylinders, heads, sectors, sectorsize)); m_origchd.close(); if (err != CHDERR_NONE) - goto error; + return image_init_result::FAIL; return internal_load_dsk(); - -error: - return image_init_result::FAIL; } void diablo_image_device::call_unload() |