diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/devices/bus/nes/disksys.cpp | 2 | ||||
-rw-r--r-- | src/devices/bus/nes/disksys.h | 2 | ||||
-rw-r--r-- | src/devices/bus/ti99_peb/ti_rs232.cpp | 2 | ||||
-rw-r--r-- | src/devices/imagedev/cassette.cpp | 9 | ||||
-rw-r--r-- | src/devices/imagedev/cassette.h | 3 | ||||
-rw-r--r-- | src/devices/imagedev/flopdrv.cpp | 19 | ||||
-rw-r--r-- | src/devices/imagedev/flopdrv.h | 6 | ||||
-rw-r--r-- | src/devices/machine/hp_taco.cpp | 16 | ||||
-rw-r--r-- | src/devices/machine/hp_taco.h | 1 | ||||
-rw-r--r-- | src/devices/machine/keyboard.ipp | 4 | ||||
-rw-r--r-- | src/emu/diimage.cpp | 2 | ||||
-rw-r--r-- | src/emu/diimage.h | 1 | ||||
-rw-r--r-- | src/mame/machine/atarifdc.cpp | 8 | ||||
-rw-r--r-- | src/mame/machine/atarifdc.h | 2 |
14 files changed, 46 insertions, 31 deletions
diff --git a/src/devices/bus/nes/disksys.cpp b/src/devices/bus/nes/disksys.cpp index 38b24438408..bdc4862da56 100644 --- a/src/devices/bus/nes/disksys.cpp +++ b/src/devices/bus/nes/disksys.cpp @@ -81,7 +81,7 @@ const rom_entry *nes_disksys_device::device_rom_region() const } -void nes_disksys_device::load_proc(device_image_interface &image) +void nes_disksys_device::load_proc(device_image_interface &image, bool is_created) { nes_disksys_device *disk_sys = static_cast<nes_disksys_device *>(image.device().owner()); disk_sys->load_disk(image); diff --git a/src/devices/bus/nes/disksys.h b/src/devices/bus/nes/disksys.h index 7dbefa37ee4..8fabb0a80db 100644 --- a/src/devices/bus/nes/disksys.h +++ b/src/devices/bus/nes/disksys.h @@ -33,7 +33,7 @@ public: virtual void hblank_irq(int scanline, int vblank, int blanked) override; virtual void pcb_reset() override; - static void load_proc(device_image_interface &image); + static void load_proc(device_image_interface &image, bool is_created); static void unload_proc(device_image_interface &image); private: diff --git a/src/devices/bus/ti99_peb/ti_rs232.cpp b/src/devices/bus/ti99_peb/ti_rs232.cpp index ce83d3425bd..2996c2dbf70 100644 --- a/src/devices/bus/ti99_peb/ti_rs232.cpp +++ b/src/devices/bus/ti99_peb/ti_rs232.cpp @@ -231,7 +231,7 @@ bool ti_pio_attached_device::call_load() ti_rs232_pio_device* card = static_cast<ti_rs232_pio_device*>(owner()); // tell whether the image is readable - card->m_pio_readable = !has_been_created(); + card->m_pio_readable = true; // tell whether the image is writable card->m_pio_writable = !is_readonly(); diff --git a/src/devices/imagedev/cassette.cpp b/src/devices/imagedev/cassette.cpp index 62f2d9306c3..622a6994fec 100644 --- a/src/devices/imagedev/cassette.cpp +++ b/src/devices/imagedev/cassette.cpp @@ -252,11 +252,16 @@ void cassette_image_device::device_start() bool cassette_image_device::call_create(int format_type, util::option_resolution *format_options) { - return call_load(); + return internal_load(true); } bool cassette_image_device::call_load() { + return internal_load(false); +} + +bool cassette_image_device::internal_load(bool is_create) +{ casserr_t err; int cassette_flags; const char *extension; @@ -264,7 +269,7 @@ bool cassette_image_device::call_load() device_image_interface *image = nullptr; interface(image); - if ((has_been_created()) || (length() == 0)) + if (is_create || (length() == 0)) { /* creating an image */ err = cassette_create((void *)image, &image_ioprocs, &wavfile_format, m_create_opts, CASSETTE_FLAG_READWRITE|CASSETTE_FLAG_SAVEONEXIT, &m_cassette); diff --git a/src/devices/imagedev/cassette.h b/src/devices/imagedev/cassette.h index bf0440f9b6a..84d1b9ac507 100644 --- a/src/devices/imagedev/cassette.h +++ b/src/devices/imagedev/cassette.h @@ -95,6 +95,7 @@ protected: // device-level overrides virtual void device_config_complete() override; virtual void device_start() override; + private: cassette_image *m_cassette; cassette_state m_state; @@ -109,6 +110,8 @@ private: const struct CassetteOptions *m_create_opts; cassette_state m_default_state; const char * m_interface; + + bool internal_load(bool is_create); }; // device type definition diff --git a/src/devices/imagedev/flopdrv.cpp b/src/devices/imagedev/flopdrv.cpp index 75da2d10f5d..e19340c40c9 100644 --- a/src/devices/imagedev/flopdrv.cpp +++ b/src/devices/imagedev/flopdrv.cpp @@ -375,7 +375,7 @@ void legacy_floppy_image_device::floppy_drive_write_sector_data(int side, int in } } -void legacy_floppy_image_device::floppy_install_load_proc(void (*proc)(device_image_interface &image)) +void legacy_floppy_image_device::floppy_install_load_proc(void (*proc)(device_image_interface &image, bool is_created)) { m_load_proc = proc; } @@ -417,7 +417,7 @@ void legacy_floppy_image_device::floppy_drive_set_controller(device_t *controlle m_controller = controller; } -int legacy_floppy_image_device::internal_floppy_device_load(int create_format, util::option_resolution *create_args) +int legacy_floppy_image_device::internal_floppy_device_load(bool is_create, int create_format, util::option_resolution *create_args) { floperr_t err; const struct FloppyFormat *floppy_options; @@ -428,7 +428,7 @@ int legacy_floppy_image_device::internal_floppy_device_load(int create_format, u interface(image); /* figure out the floppy options */ floppy_options = m_config->formats; - if (has_been_created()) + if (is_create) { /* creating an image */ assert(create_format >= 0); @@ -452,6 +452,10 @@ int legacy_floppy_image_device::internal_floppy_device_load(int create_format, u /* disk changed */ m_dskchg = CLEAR_LINE; + // If we have one of our hacky load procs, call it + if (m_load_proc) + m_load_proc(*this, is_create); + return IMAGE_INIT_PASS; error: @@ -832,17 +836,12 @@ void legacy_floppy_image_device::device_config_complete() bool legacy_floppy_image_device::call_create(int format_type, util::option_resolution *format_options) { - return internal_floppy_device_load(format_type, format_options); + return internal_floppy_device_load(true, format_type, format_options); } bool legacy_floppy_image_device::call_load() { - int retVal = internal_floppy_device_load(-1, nullptr); - if (retVal==IMAGE_INIT_PASS) { - /* if we have one of our hacky unload procs, call it */ - if (m_load_proc) - m_load_proc(*this); - } + int retVal = internal_floppy_device_load(false, -1, nullptr); /* push disk halfway into drive */ m_wpt = CLEAR_LINE; diff --git a/src/devices/imagedev/flopdrv.h b/src/devices/imagedev/flopdrv.h index 080093e1b17..800a0b878c2 100644 --- a/src/devices/imagedev/flopdrv.h +++ b/src/devices/imagedev/flopdrv.h @@ -127,7 +127,7 @@ public: void floppy_drive_format_sector(int side, int sector_index,int c,int h, int r, int n, int filler); void floppy_drive_read_sector_data(int side, int index1, void *ptr, int length); void floppy_drive_write_sector_data(int side, int index1, const void *ptr,int length, int ddam); - void floppy_install_load_proc(void (*proc)(device_image_interface &image)); + void floppy_install_load_proc(void (*proc)(device_image_interface &image, bool is_created)); void floppy_install_unload_proc(void (*proc)(device_image_interface &image)); void floppy_drive_set_index_pulse_callback(void (*callback)(device_t *controller,device_t *image, int state)); int floppy_drive_get_current_track(); @@ -162,7 +162,7 @@ private: TIMER_CALLBACK_MEMBER(floppy_drive_index_callback); void floppy_drive_init(); void floppy_drive_index_func(); - int internal_floppy_device_load(int create_format, util::option_resolution *create_args); + int internal_floppy_device_load(bool is_create, int create_format, util::option_resolution *create_args); TIMER_CALLBACK_MEMBER( set_wpt ); protected: @@ -215,7 +215,7 @@ protected: floppy_image_legacy *m_floppy; int m_track; - void (*m_load_proc)(device_image_interface &image); + void (*m_load_proc)(device_image_interface &image, bool is_created); void (*m_unload_proc)(device_image_interface &image); int m_floppy_drive_type; diff --git a/src/devices/machine/hp_taco.cpp b/src/devices/machine/hp_taco.cpp index adb369c59f2..87adeb15488 100644 --- a/src/devices/machine/hp_taco.cpp +++ b/src/devices/machine/hp_taco.cpp @@ -1678,13 +1678,11 @@ void hp_taco_device::start_cmd_exec(UINT16 new_cmd_reg) } } -bool hp_taco_device::call_load() +bool hp_taco_device::internal_load(bool is_create) { - LOG(("call_load %d\n" , has_been_created())); - device_reset(); - if (has_been_created()) { + if (is_create) { clear_tape(); save_tape(); } else if (!load_tape()) { @@ -1699,10 +1697,16 @@ bool hp_taco_device::call_load() return IMAGE_INIT_PASS; } +bool hp_taco_device::call_load() +{ + LOG(("call_load\n")); + return internal_load(false); +} + bool hp_taco_device::call_create(int format_type, util::option_resolution *format_options) { - LOG(("call_create %d\n" , has_been_created())); - return call_load(); + LOG(("call_create\n")); + return internal_load(true); } void hp_taco_device::call_unload() diff --git a/src/devices/machine/hp_taco.h b/src/devices/machine/hp_taco.h index 4a34ec420ed..ffd8c928ed7 100644 --- a/src/devices/machine/hp_taco.h +++ b/src/devices/machine/hp_taco.h @@ -182,6 +182,7 @@ private: void set_data_timeout(bool long_timeout); void cmd_fsm(void); void start_cmd_exec(UINT16 new_cmd_reg); + bool internal_load(bool is_create); }; // device type definition diff --git a/src/devices/machine/keyboard.ipp b/src/devices/machine/keyboard.ipp index 91c6992962e..e045fb5f602 100644 --- a/src/devices/machine/keyboard.ipp +++ b/src/devices/machine/keyboard.ipp @@ -5,6 +5,10 @@ #pragma once +#ifdef _MSC_VER // NPW - Stupid warning ignore to appease MSVC +#pragma warning ( disable : 4505 ) +#endif + #include "keyboard.h" #include <numeric> diff --git a/src/emu/diimage.cpp b/src/emu/diimage.cpp index b4db591086a..56be4f9a6de 100644 --- a/src/emu/diimage.cpp +++ b/src/emu/diimage.cpp @@ -1079,7 +1079,7 @@ bool device_image_interface::finish_load() { image_checkhash(); - if (has_been_created()) + if (m_created) { err = call_create(m_create_format, m_create_args); if (err) diff --git a/src/emu/diimage.h b/src/emu/diimage.h index e89f003ebda..009cd9bc534 100644 --- a/src/emu/diimage.h +++ b/src/emu/diimage.h @@ -182,7 +182,6 @@ public: util::core_file &image_core_file() const { return *m_file; } UINT64 length() { check_for_file(); return m_file->size(); } bool is_readonly() const { return m_readonly; } - bool has_been_created() const { return m_created; } void make_readonly() { m_readonly = true; } UINT32 fread(void *buffer, UINT32 length) { check_for_file(); return m_file->read(buffer, length); } UINT32 fread(optional_shared_ptr<UINT8> &ptr, UINT32 length) { ptr.allocate(length); return fread(ptr.target(), length); } diff --git a/src/mame/machine/atarifdc.cpp b/src/mame/machine/atarifdc.cpp index 29554a77f99..6c390d9839e 100644 --- a/src/mame/machine/atarifdc.cpp +++ b/src/mame/machine/atarifdc.cpp @@ -102,13 +102,13 @@ static const xfd_format xfd_formats[] = *****************************************************************************/ #define MAXSIZE 5760 * 256 + 80 -static void _atari_load_proc(device_image_interface &image) +static void _atari_load_proc(device_image_interface &image, bool is_created) { atari_fdc_device *atarifdc = static_cast<atari_fdc_device *>(image.device().owner()); - atarifdc->atari_load_proc(image); + atarifdc->atari_load_proc(image, is_created); } -void atari_fdc_device::atari_load_proc(device_image_interface &image) +void atari_fdc_device::atari_load_proc(device_image_interface &image, bool is_created) { int id = floppy_get_drive(image); int size, i; @@ -121,7 +121,7 @@ void atari_fdc_device::atari_load_proc(device_image_interface &image) /* tell whether the image is writable */ m_drv[id].mode = !image.is_readonly(); /* set up image if it has been created */ - if (image.has_been_created()) + if (is_created) { int sector; char buff[256]; diff --git a/src/mame/machine/atarifdc.h b/src/mame/machine/atarifdc.h index 4c41c7b745a..355dea59aad 100644 --- a/src/mame/machine/atarifdc.h +++ b/src/mame/machine/atarifdc.h @@ -18,7 +18,7 @@ public: DECLARE_READ8_MEMBER( serin_r ); DECLARE_WRITE8_MEMBER( serout_w ); DECLARE_WRITE_LINE_MEMBER( pia_cb2_w ); - void atari_load_proc(device_image_interface &image); + void atari_load_proc(device_image_interface &image, bool is_created); protected: // device-level overrides |