summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/devices/bus/a7800/a78_slot.cpp17
-rw-r--r--src/devices/bus/a7800/a78_slot.h4
-rw-r--r--src/devices/bus/a800/a800_slot.cpp4
-rw-r--r--src/devices/bus/a800/a800_slot.h2
-rw-r--r--src/devices/bus/acorn/system/8k.cpp9
-rw-r--r--src/devices/bus/acorn/system/8k.h2
-rw-r--r--src/devices/bus/adam/exp.cpp4
-rw-r--r--src/devices/bus/adam/exp.h2
-rw-r--r--src/devices/bus/apf/slot.cpp9
-rw-r--r--src/devices/bus/apf/slot.h2
-rw-r--r--src/devices/bus/aquarius/slot.cpp9
-rw-r--r--src/devices/bus/aquarius/slot.h2
-rw-r--r--src/devices/bus/arcadia/slot.cpp4
-rw-r--r--src/devices/bus/arcadia/slot.h2
-rw-r--r--src/devices/bus/astrocde/slot.cpp4
-rw-r--r--src/devices/bus/astrocde/slot.h2
-rw-r--r--src/devices/bus/bbc/1mhzbus/datacentre.cpp5
-rw-r--r--src/devices/bus/bbc/rom/slot.cpp9
-rw-r--r--src/devices/bus/bbc/rom/slot.h2
-rw-r--r--src/devices/bus/c64/exp.cpp9
-rw-r--r--src/devices/bus/c64/exp.h2
-rw-r--r--src/devices/bus/cbm2/exp.cpp4
-rw-r--r--src/devices/bus/cbm2/exp.h2
-rw-r--r--src/devices/bus/cgenie/expansion/floppy.cpp7
-rw-r--r--src/devices/bus/chanf/slot.cpp4
-rw-r--r--src/devices/bus/chanf/slot.h2
-rw-r--r--src/devices/bus/coco/cococart.cpp6
-rw-r--r--src/devices/bus/coco/cococart.h2
-rw-r--r--src/devices/bus/coleco/cartridge/exp.cpp4
-rw-r--r--src/devices/bus/coleco/cartridge/exp.h2
-rw-r--r--src/devices/bus/cpc/cpc_rom.cpp4
-rw-r--r--src/devices/bus/cpc/cpc_rom.h2
-rw-r--r--src/devices/bus/crvision/slot.cpp9
-rw-r--r--src/devices/bus/crvision/slot.h2
-rw-r--r--src/devices/bus/ekara/slot.cpp4
-rw-r--r--src/devices/bus/ekara/slot.h2
-rw-r--r--src/devices/bus/electron/cart/ap5.cpp9
-rw-r--r--src/devices/bus/electron/cart/ap5.h2
-rw-r--r--src/devices/bus/electron/cart/romp144.cpp9
-rw-r--r--src/devices/bus/electron/cart/romp144.h2
-rw-r--r--src/devices/bus/electron/cart/slot.cpp14
-rw-r--r--src/devices/bus/electron/cart/slot.h2
-rw-r--r--src/devices/bus/electron/plus1.cpp9
-rw-r--r--src/devices/bus/electron/plus1.h2
-rw-r--r--src/devices/bus/electron/plus2.cpp9
-rw-r--r--src/devices/bus/electron/plus2.h2
-rw-r--r--src/devices/bus/electron/rombox.cpp9
-rw-r--r--src/devices/bus/electron/rombox.h2
-rw-r--r--src/devices/bus/electron/romboxp.cpp9
-rw-r--r--src/devices/bus/electron/romboxp.h2
-rw-r--r--src/devices/bus/electron/sidewndr.cpp9
-rw-r--r--src/devices/bus/electron/sidewndr.h2
-rw-r--r--src/devices/bus/gamate/slot.cpp9
-rw-r--r--src/devices/bus/gamate/slot.h2
-rw-r--r--src/devices/bus/gameboy/gbslot.cpp25
-rw-r--r--src/devices/bus/gameboy/gbslot.h2
-rw-r--r--src/devices/bus/gameboy/mdslot.cpp12
-rw-r--r--src/devices/bus/gameboy/mdslot.h2
-rw-r--r--src/devices/bus/gameboy/slot.cpp14
-rw-r--r--src/devices/bus/gameboy/slot.h4
-rw-r--r--src/devices/bus/gba/gba_slot.cpp9
-rw-r--r--src/devices/bus/gba/gba_slot.h2
-rw-r--r--src/devices/bus/generic/slot.cpp27
-rw-r--r--src/devices/bus/generic/slot.h6
-rw-r--r--src/devices/bus/intellec4/insdatastor.cpp14
-rw-r--r--src/devices/bus/intellec4/prommemory.cpp14
-rw-r--r--src/devices/bus/intellec4/tapereader.cpp6
-rw-r--r--src/devices/bus/intv/slot.cpp8
-rw-r--r--src/devices/bus/intv/slot.h2
-rw-r--r--src/devices/bus/iq151/iq151.cpp28
-rw-r--r--src/devices/bus/iq151/iq151.h2
-rw-r--r--src/devices/bus/isa/omti8621.cpp8
-rw-r--r--src/devices/bus/isa/sc499.cpp6
-rw-r--r--src/devices/bus/isa/sc499.h2
-rw-r--r--src/devices/bus/jakks_gamekey/slot.cpp4
-rw-r--r--src/devices/bus/jakks_gamekey/slot.h2
-rw-r--r--src/devices/bus/kc/kc.cpp6
-rw-r--r--src/devices/bus/kc/kc.h2
-rw-r--r--src/devices/bus/m5/slot.cpp10
-rw-r--r--src/devices/bus/m5/slot.h2
-rw-r--r--src/devices/bus/mc10/mc10_cart.cpp23
-rw-r--r--src/devices/bus/mc10/mc10_cart.h5
-rw-r--r--src/devices/bus/mc10/mcx128.cpp2
-rw-r--r--src/devices/bus/mc10/pak.cpp16
-rw-r--r--src/devices/bus/mc10/pak.h2
-rw-r--r--src/devices/bus/mc10/ram.cpp2
-rw-r--r--src/devices/bus/megadrive/md_slot.cpp6
-rw-r--r--src/devices/bus/megadrive/md_slot.h2
-rw-r--r--src/devices/bus/mononcol/slot.cpp19
-rw-r--r--src/devices/bus/mononcol/slot.h2
-rw-r--r--src/devices/bus/msx/cart/beepack.cpp28
-rw-r--r--src/devices/bus/msx/cart/beepack.h2
-rw-r--r--src/devices/bus/msx/cart/cartridge.cpp3
-rw-r--r--src/devices/bus/msx/cart/softcard.cpp24
-rw-r--r--src/devices/bus/msx/cart/softcard.h2
-rw-r--r--src/devices/bus/msx/slot/cartridge.cpp18
-rw-r--r--src/devices/bus/msx/slot/cartridge.h2
-rw-r--r--src/devices/bus/mtx/exp.cpp9
-rw-r--r--src/devices/bus/mtx/exp.h2
-rw-r--r--src/devices/bus/nabupc/adapter.cpp6
-rw-r--r--src/devices/bus/nabupc/adapter.h2
-rw-r--r--src/devices/bus/neogeo/slot.cpp4
-rw-r--r--src/devices/bus/neogeo/slot.h2
-rw-r--r--src/devices/bus/nes/aladdin.cpp16
-rw-r--r--src/devices/bus/nes/aladdin.h2
-rw-r--r--src/devices/bus/nes/datach.cpp14
-rw-r--r--src/devices/bus/nes/datach.h2
-rw-r--r--src/devices/bus/nes/karastudio.cpp10
-rw-r--r--src/devices/bus/nes/karastudio.h2
-rw-r--r--src/devices/bus/nes/nes_slot.cpp17
-rw-r--r--src/devices/bus/nes/nes_slot.h2
-rw-r--r--src/devices/bus/nes/sunsoft_dcs.cpp10
-rw-r--r--src/devices/bus/nes/sunsoft_dcs.h2
-rw-r--r--src/devices/bus/nubus/nubus_image.cpp11
-rw-r--r--src/devices/bus/odyssey2/slot.cpp6
-rw-r--r--src/devices/bus/odyssey2/slot.h2
-rw-r--r--src/devices/bus/pce/pce_slot.cpp4
-rw-r--r--src/devices/bus/pce/pce_slot.h2
-rw-r--r--src/devices/bus/plus4/exp.cpp10
-rw-r--r--src/devices/bus/plus4/exp.h2
-rw-r--r--src/devices/bus/pofo/ccm.cpp4
-rw-r--r--src/devices/bus/pofo/ccm.h2
-rw-r--r--src/devices/bus/psx/memcard.cpp26
-rw-r--r--src/devices/bus/psx/memcard.h4
-rw-r--r--src/devices/bus/qbus/pc11.cpp4
-rw-r--r--src/devices/bus/qbus/pc11.h2
-rw-r--r--src/devices/bus/ql/rom.cpp4
-rw-r--r--src/devices/bus/ql/rom.h2
-rw-r--r--src/devices/bus/saturn/sat_slot.cpp4
-rw-r--r--src/devices/bus/saturn/sat_slot.h2
-rw-r--r--src/devices/bus/scv/slot.cpp9
-rw-r--r--src/devices/bus/scv/slot.h2
-rw-r--r--src/devices/bus/sdk85/memexp.cpp6
-rw-r--r--src/devices/bus/sdk85/memexp.h2
-rw-r--r--src/devices/bus/sega8/sega8_slot.cpp9
-rw-r--r--src/devices/bus/sega8/sega8_slot.h2
-rw-r--r--src/devices/bus/snes/snes_slot.cpp4
-rw-r--r--src/devices/bus/snes/snes_slot.h2
-rw-r--r--src/devices/bus/spectrum/intf2.cpp7
-rw-r--r--src/devices/bus/ti99/gromport/cartridges.cpp6
-rw-r--r--src/devices/bus/ti99/gromport/cartridges.h2
-rw-r--r--src/devices/bus/ti99/peb/ti_rs232.cpp8
-rw-r--r--src/devices/bus/ti99/peb/ti_rs232.h4
-rw-r--r--src/devices/bus/ti99/peb/tipi.cpp4
-rw-r--r--src/devices/bus/ti99/peb/tipi.h2
-rw-r--r--src/devices/bus/ti99x/990_tap.cpp6
-rw-r--r--src/devices/bus/ti99x/990_tap.h2
-rw-r--r--src/devices/bus/vboy/slot.cpp21
-rw-r--r--src/devices/bus/vboy/slot.h2
-rw-r--r--src/devices/bus/vc4000/slot.cpp9
-rw-r--r--src/devices/bus/vc4000/slot.h2
-rw-r--r--src/devices/bus/vcs/vcs_slot.cpp7
-rw-r--r--src/devices/bus/vcs/vcs_slot.h2
-rw-r--r--src/devices/bus/vectrex/slot.cpp16
-rw-r--r--src/devices/bus/vectrex/slot.h2
-rw-r--r--src/devices/bus/vic10/exp.cpp4
-rw-r--r--src/devices/bus/vic10/exp.h2
-rw-r--r--src/devices/bus/vic20/exp.cpp6
-rw-r--r--src/devices/bus/vic20/exp.h2
-rw-r--r--src/devices/bus/vidbrain/exp.cpp4
-rw-r--r--src/devices/bus/vidbrain/exp.h2
-rw-r--r--src/devices/bus/vsmile/vsmile_slot.cpp11
-rw-r--r--src/devices/bus/vsmile/vsmile_slot.h2
-rw-r--r--src/devices/bus/wswan/slot.cpp4
-rw-r--r--src/devices/bus/wswan/slot.h2
-rw-r--r--src/devices/bus/z88/z88.cpp6
-rw-r--r--src/devices/bus/z88/z88.h2
-rw-r--r--src/devices/imagedev/avivideo.cpp6
-rw-r--r--src/devices/imagedev/avivideo.h2
-rw-r--r--src/devices/imagedev/bitbngr.cpp8
-rw-r--r--src/devices/imagedev/bitbngr.h4
-rw-r--r--src/devices/imagedev/cassette.cpp8
-rw-r--r--src/devices/imagedev/cassette.h4
-rw-r--r--src/devices/imagedev/chd_cd.cpp9
-rw-r--r--src/devices/imagedev/chd_cd.h2
-rw-r--r--src/devices/imagedev/diablo.cpp12
-rw-r--r--src/devices/imagedev/diablo.h4
-rw-r--r--src/devices/imagedev/flopdrv.cpp8
-rw-r--r--src/devices/imagedev/flopdrv.h4
-rw-r--r--src/devices/imagedev/floppy.cpp22
-rw-r--r--src/devices/imagedev/floppy.h4
-rw-r--r--src/devices/imagedev/harddriv.cpp12
-rw-r--r--src/devices/imagedev/harddriv.h4
-rw-r--r--src/devices/imagedev/mfmhd.cpp180
-rw-r--r--src/devices/imagedev/mfmhd.h2
-rw-r--r--src/devices/imagedev/microdrv.cpp6
-rw-r--r--src/devices/imagedev/microdrv.h2
-rw-r--r--src/devices/imagedev/midiin.cpp10
-rw-r--r--src/devices/imagedev/midiin.h2
-rw-r--r--src/devices/imagedev/midiout.cpp6
-rw-r--r--src/devices/imagedev/midiout.h2
-rw-r--r--src/devices/imagedev/picture.cpp14
-rw-r--r--src/devices/imagedev/picture.h2
-rw-r--r--src/devices/imagedev/printer.cpp6
-rw-r--r--src/devices/imagedev/printer.h4
-rw-r--r--src/devices/imagedev/snapquik.cpp26
-rw-r--r--src/devices/imagedev/snapquik.h8
-rw-r--r--src/devices/imagedev/wafadrive.cpp4
-rw-r--r--src/devices/imagedev/wafadrive.h2
-rw-r--r--src/devices/machine/ds6417.cpp12
-rw-r--r--src/devices/machine/ds6417.h4
-rw-r--r--src/devices/machine/hp_dc100_tape.cpp14
-rw-r--r--src/devices/machine/hp_dc100_tape.h6
-rw-r--r--src/devices/machine/i7220.cpp6
-rw-r--r--src/devices/machine/i7220.h2
-rw-r--r--src/devices/machine/pccard_sram.cpp32
-rw-r--r--src/devices/machine/pccard_sram.h8
-rw-r--r--src/devices/machine/smartmed.cpp4
-rw-r--r--src/devices/machine/smartmed.h2
-rw-r--r--src/emu/debug/debugcmd.cpp16
-rw-r--r--src/emu/diimage.cpp69
-rw-r--r--src/emu/diimage.h16
-rw-r--r--src/emu/image.cpp30
-rw-r--r--src/frontend/mame/luaengine.cpp40
-rw-r--r--src/frontend/mame/ui/filemngr.cpp50
-rw-r--r--src/frontend/mame/ui/floppycntrl.cpp14
-rw-r--r--src/frontend/mame/ui/imgcntrl.cpp22
-rw-r--r--src/mame/acorn/atom.cpp11
-rw-r--r--src/mame/acorn/atom.h2
-rw-r--r--src/mame/acorn/electron.h2
-rw-r--r--src/mame/acorn/electron_m.cpp9
-rw-r--r--src/mame/acorn/z88_impexp.cpp10
-rw-r--r--src/mame/acorn/z88_impexp.h4
-rw-r--r--src/mame/altos/altos5.cpp8
-rw-r--r--src/mame/amstrad/amstrad_m.cpp24
-rw-r--r--src/mame/amstrad/pda600.cpp6
-rw-r--r--src/mame/apollo/apollo.h4
-rw-r--r--src/mame/apollo/apollo_m.cpp12
-rw-r--r--src/mame/apple/apple1.cpp32
-rw-r--r--src/mame/appliedconcepts/ggm.cpp2
-rw-r--r--src/mame/atari/jaguar.cpp6
-rw-r--r--src/mame/atari/jaguar.h2
-rw-r--r--src/mame/atari/lynx.cpp16
-rw-r--r--src/mame/atari/lynx.h2
-rw-r--r--src/mame/atari/lynx_m.cpp25
-rw-r--r--src/mame/ausnz/aussiebyte.cpp8
-rw-r--r--src/mame/ausnz/binbug.cpp86
-rw-r--r--src/mame/ausnz/d6800.cpp8
-rw-r--r--src/mame/ausnz/eti660.cpp37
-rw-r--r--src/mame/ausnz/mbee.h2
-rw-r--r--src/mame/ausnz/mbee_m.cpp56
-rw-r--r--src/mame/ausnz/pegasus.cpp23
-rw-r--r--src/mame/ausnz/pipbug.cpp88
-rw-r--r--src/mame/ausnz/super80_m.cpp8
-rw-r--r--src/mame/bandai/design_master.cpp2
-rw-r--r--src/mame/bandai/rx78.cpp7
-rw-r--r--src/mame/bandai/sv8000.cpp7
-rw-r--r--src/mame/booth/apexc_m.cpp4
-rw-r--r--src/mame/booth/apexc_m.h2
-rw-r--r--src/mame/canon/x07.cpp7
-rw-r--r--src/mame/cantab/jupace.cpp18
-rw-r--r--src/mame/casio/casio_rompack.cpp2
-rw-r--r--src/mame/casio/casloopy.cpp2
-rw-r--r--src/mame/casio/pv1000.cpp7
-rw-r--r--src/mame/casio/pv2000.cpp7
-rw-r--r--src/mame/chess/ave_arb.cpp2
-rw-r--r--src/mame/commodore/cbm_snqk.cpp29
-rw-r--r--src/mame/commodore/cbm_snqk.h2
-rw-r--r--src/mame/comx/comx35.cpp10
-rw-r--r--src/mame/cybiko/cybiko_m.cpp4
-rw-r--r--src/mame/ddr/jtc.cpp114
-rw-r--r--src/mame/ddr/kc_m.cpp4
-rw-r--r--src/mame/ddr/sprachmg.cpp25
-rw-r--r--src/mame/dec/pdp1.cpp16
-rw-r--r--src/mame/dec/pdp1.h9
-rw-r--r--src/mame/entex/sag.cpp24
-rw-r--r--src/mame/epson/hx20.cpp9
-rw-r--r--src/mame/epson/qx10.cpp8
-rw-r--r--src/mame/exidy/sorcerer_m.cpp14
-rw-r--r--src/mame/force/force68k.cpp12
-rw-r--r--src/mame/fujitsu/fmt_icmem.cpp12
-rw-r--r--src/mame/fujitsu/fmt_icmem.h4
-rw-r--r--src/mame/funtech/supracan.cpp7
-rw-r--r--src/mame/handheld/chessking.cpp2
-rw-r--r--src/mame/handheld/gameking.cpp7
-rw-r--r--src/mame/handheld/hh_tms1k.cpp26
-rw-r--r--src/mame/handheld/lk3000.cpp2
-rw-r--r--src/mame/homebrew/phunsy.cpp48
-rw-r--r--src/mame/homebrew/ravens.cpp85
-rw-r--r--src/mame/homebrew/uzebox.cpp2
-rw-r--r--src/mame/homebrew/z80clock.cpp6
-rw-r--r--src/mame/homelab/homelab.cpp32
-rw-r--r--src/mame/hp/hp48_port.cpp20
-rw-r--r--src/mame/hp/hp48_port.h4
-rw-r--r--src/mame/hp/hp80_optrom.cpp24
-rw-r--r--src/mame/hp/hp80_optrom.h2
-rw-r--r--src/mame/hp/hp9825_optrom.cpp12
-rw-r--r--src/mame/hp/hp9825_optrom.h2
-rw-r--r--src/mame/hp/hp9845_optrom.cpp23
-rw-r--r--src/mame/hp/hp9845_optrom.h2
-rw-r--r--src/mame/hp/hp_ipc_optrom.cpp18
-rw-r--r--src/mame/hp/hp_ipc_optrom.h2
-rw-r--r--src/mame/igs/pgm2_memcard.cpp20
-rw-r--r--src/mame/igs/pgm2_memcard.h5
-rw-r--r--src/mame/intel/imm6_76.cpp24
-rw-r--r--src/mame/intel/imm6_76.h4
-rw-r--r--src/mame/intel/rex6000.cpp12
-rw-r--r--src/mame/interton/vc4000.cpp191
-rw-r--r--src/mame/kaypro/kaypro_m.cpp10
-rw-r--r--src/mame/leapfrog/iquest.cpp2
-rw-r--r--src/mame/leapfrog/leappad.cpp2
-rw-r--r--src/mame/leapfrog/leapster.cpp2
-rw-r--r--src/mame/leapfrog/leapster_explorer.cpp2
-rw-r--r--src/mame/luxor/abc80.cpp2
-rw-r--r--src/mame/luxor/abc80x.cpp2
-rw-r--r--src/mame/matsushita/jr100.cpp10
-rw-r--r--src/mame/mchester/ssem.cpp22
-rw-r--r--src/mame/memotech/mtx_m.cpp64
-rw-r--r--src/mame/microkey/primo_m.cpp16
-rw-r--r--src/mame/miltonbradley/microvsn.cpp7
-rw-r--r--src/mame/misc/mtu130.cpp8
-rw-r--r--src/mame/mit/tx0.cpp28
-rw-r--r--src/mame/mits/altair.cpp6
-rw-r--r--src/mame/motorola/m68705prg.cpp14
-rw-r--r--src/mame/motorola/mekd2.cpp7
-rw-r--r--src/mame/nascom/nascom1.cpp19
-rw-r--r--src/mame/neogeo/ng_memcard.cpp14
-rw-r--r--src/mame/neogeo/ng_memcard.h4
-rw-r--r--src/mame/netronics/elf.cpp4
-rw-r--r--src/mame/nichibutsu/myvision.cpp7
-rw-r--r--src/mame/nintendo/n64.cpp2
-rw-r--r--src/mame/nintendo/nes_vt09.cpp2
-rw-r--r--src/mame/nintendo/pokemini.cpp12
-rw-r--r--src/mame/pc/ibmpcjr.cpp12
-rw-r--r--src/mame/pce/tourvis.cpp2
-rw-r--r--src/mame/pitronics/beta.cpp8
-rw-r--r--src/mame/poly88/poly88_m.cpp2
-rw-r--r--src/mame/psion/psion_pack.cpp10
-rw-r--r--src/mame/psion/psion_pack.h4
-rw-r--r--src/mame/psion/psion_ssd.cpp9
-rw-r--r--src/mame/psion/psion_ssd.h2
-rw-r--r--src/mame/rca/studio2.cpp26
-rw-r--r--src/mame/rca/vip.cpp6
-rw-r--r--src/mame/robotron/z1013.cpp22
-rw-r--r--src/mame/rockwell/aim65.cpp20
-rw-r--r--src/mame/rockwell/aim65.h2
-rw-r--r--src/mame/roland/roland_cm32p.cpp7
-rw-r--r--src/mame/roland/roland_r8.cpp11
-rw-r--r--src/mame/roland/roland_tnsc1.cpp2
-rw-r--r--src/mame/sega/mdconsole.cpp11
-rw-r--r--src/mame/sega/megatech.cpp16
-rw-r--r--src/mame/sega/sega_beena.cpp2
-rw-r--r--src/mame/sega/stv.cpp11
-rw-r--r--src/mame/sega/stv.h2
-rw-r--r--src/mame/sega/svmu.cpp2
-rw-r--r--src/mame/sfrj/galaxy.cpp6
-rw-r--r--src/mame/sgi/iris3130.cpp4
-rw-r--r--src/mame/shared/z80bin.cpp29
-rw-r--r--src/mame/shared/z80bin.h2
-rw-r--r--src/mame/sharp/pce220_ser.cpp8
-rw-r--r--src/mame/sharp/pce220_ser.h4
-rw-r--r--src/mame/sharp/wizard.cpp2
-rw-r--r--src/mame/sharp/x68k_hdc.cpp6
-rw-r--r--src/mame/sharp/x68k_hdc.h2
-rw-r--r--src/mame/sinclair/spec_snqk.cpp80
-rw-r--r--src/mame/sinclair/timex.cpp17
-rw-r--r--src/mame/skeleton/c2color.cpp2
-rw-r--r--src/mame/skeleton/cd2650.cpp88
-rw-r--r--src/mame/skeleton/cosmicos.cpp10
-rw-r--r--src/mame/skeleton/cp1.cpp4
-rw-r--r--src/mame/skeleton/digiblast.cpp2
-rw-r--r--src/mame/skeleton/dmv.cpp8
-rw-r--r--src/mame/skeleton/easy_karaoke.cpp2
-rw-r--r--src/mame/skeleton/i7000.cpp2
-rw-r--r--src/mame/skeleton/pockchal.cpp2
-rw-r--r--src/mame/skeleton/squale.cpp9
-rw-r--r--src/mame/snk/ngp.cpp7
-rw-r--r--src/mame/sony/pockstat.cpp6
-rw-r--r--src/mame/sony/psx.cpp4
-rw-r--r--src/mame/sony/psxcd.cpp6
-rw-r--r--src/mame/sony/psxcd.h2
-rw-r--r--src/mame/sony/smc777.cpp8
-rw-r--r--src/mame/svi/svi318.cpp2
-rw-r--r--src/mame/svision/svision.cpp7
-rw-r--r--src/mame/ta/alphatro.cpp11
-rw-r--r--src/mame/tangerine/microtan_m.cpp10
-rw-r--r--src/mame/tatung/einstein.cpp6
-rw-r--r--src/mame/telercas/tmc1800.cpp4
-rw-r--r--src/mame/thomson/thomson_m.cpp24
-rw-r--r--src/mame/ti/avigo.cpp5
-rw-r--r--src/mame/ti/cc40.cpp11
-rw-r--r--src/mame/ti/snspell.cpp7
-rw-r--r--src/mame/ti/snspellc.cpp7
-rw-r--r--src/mame/ti/ti74.cpp7
-rw-r--r--src/mame/ti/ti85_m.cpp7
-rw-r--r--src/mame/ti/tm990189.cpp10
-rw-r--r--src/mame/tiger/gamecom.h2
-rw-r--r--src/mame/tiger/gamecom_m.cpp7
-rw-r--r--src/mame/tiger/k28m2.cpp7
-rw-r--r--src/mame/trainer/instruct.cpp119
-rw-r--r--src/mame/trainer/mk14.cpp34
-rw-r--r--src/mame/trs/coco_vhd.cpp4
-rw-r--r--src/mame/trs/coco_vhd.h2
-rw-r--r--src/mame/trs/trs80_m.cpp14
-rw-r--r--src/mame/trs/trs80m3_m.cpp14
-rw-r--r--src/mame/tvgames/elan_eu3a05.cpp7
-rw-r--r--src/mame/tvgames/generalplus_gpl16250_mobigo.cpp4
-rw-r--r--src/mame/tvgames/generalplus_gpl16250_nand.cpp2
-rw-r--r--src/mame/tvgames/generalplus_gpl16250_spi.cpp2
-rw-r--r--src/mame/tvgames/generalplus_gpl32612.cpp2
-rw-r--r--src/mame/tvgames/hyperscan_card.cpp6
-rw-r--r--src/mame/tvgames/hyperscan_card.h2
-rw-r--r--src/mame/tvgames/magiceyes_pollux_vr3520f.cpp2
-rw-r--r--src/mame/tvgames/pubint_storyreader.cpp2
-rw-r--r--src/mame/tvgames/spg110.cpp2
-rw-r--r--src/mame/tvgames/spg29x.cpp4
-rw-r--r--src/mame/tvgames/spg2xx_ican.cpp7
-rw-r--r--src/mame/tvgames/spg2xx_smarttv.cpp7
-rw-r--r--src/mame/tvgames/spg2xx_telestory.cpp8
-rw-r--r--src/mame/tvgames/spg2xx_tvgogo.cpp7
-rw-r--r--src/mame/tvgames/spg2xx_vii.cpp7
-rw-r--r--src/mame/usp/patinho_feio.cpp2
-rw-r--r--src/mame/ussr/lviv.h2
-rw-r--r--src/mame/ussr/lviv_m.cpp25
-rw-r--r--src/mame/videoton/tvc.cpp4
-rw-r--r--src/mame/virtual/vgmplay.cpp574
-rw-r--r--src/mame/vtech/clickstart.cpp2
-rw-r--r--src/mame/vtech/geniusiq.cpp2
-rw-r--r--src/mame/vtech/innotv_innotabmax.cpp2
-rw-r--r--src/mame/vtech/iqunlim.cpp2
-rw-r--r--src/mame/vtech/pc2000.cpp2
-rw-r--r--src/mame/vtech/storio.cpp2
-rw-r--r--src/mame/vtech/vtech1.cpp29
-rw-r--r--src/mame/vtech/vtech2_m.cpp5
-rw-r--r--src/mame/vtech/vtech_innotab.cpp2
-rw-r--r--src/mame/xerox/xerox820.cpp8
-rw-r--r--src/osd/modules/debugger/debugimgui.cpp6
-rw-r--r--src/osd/modules/debugger/qt/mainwindow.cpp4
428 files changed, 2230 insertions, 2808 deletions
diff --git a/src/devices/bus/a7800/a78_slot.cpp b/src/devices/bus/a7800/a78_slot.cpp
index 96e43fcd3b3..2163b7e80b1 100644
--- a/src/devices/bus/a7800/a78_slot.cpp
+++ b/src/devices/bus/a7800/a78_slot.cpp
@@ -332,7 +332,7 @@ static const char *a78_get_slot(int type)
return "a78_rom";
}
-std::error_condition a78_cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> a78_cart_slot_device::call_load()
{
if (m_cart)
{
@@ -368,8 +368,8 @@ std::error_condition a78_cart_slot_device::call_load()
char head[128];
fread(head, 128);
- std::error_condition err = verify_header(head);
- if (err)
+ auto err = verify_header(head);
+ if (err.first)
return err;
len = (head[49] << 24) | (head[50] << 16) | (head[51] << 8) | head[52];
@@ -464,7 +464,7 @@ std::error_condition a78_cart_slot_device::call_load()
//printf("Type: %s\n", a78_get_slot(m_type));
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
@@ -485,18 +485,15 @@ void a78_cart_slot_device::call_unload()
has an admissible header
-------------------------------------------------*/
-std::error_condition a78_cart_slot_device::verify_header(const char *header)
+std::pair<std::error_condition, std::string> a78_cart_slot_device::verify_header(const char *header)
{
const char *magic = "ATARI7800";
if (strncmp(magic, header + 1, 9))
- {
- osd_printf_error("%s: Not a valid A7800 image\n", basename());
- return image_error::INVALIDIMAGE;
- }
+ return std::make_pair(image_error::INVALIDIMAGE, "Not a valid A7800 image");
logerror("returning ID_OK\n");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/a7800/a78_slot.h b/src/devices/bus/a7800/a78_slot.h
index 74765a34056..fbb5a455666 100644
--- a/src/devices/bus/a7800/a78_slot.h
+++ b/src/devices/bus/a7800/a78_slot.h
@@ -101,7 +101,7 @@ public:
virtual ~a78_cart_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
@@ -129,7 +129,7 @@ private:
// device_t implementation
virtual void device_start() override;
- std::error_condition verify_header(const char *header);
+ std::pair<std::error_condition, std::string> verify_header(const char *header);
int validate_header(int head, bool log) const;
void internal_header_logging(uint8_t *header, uint32_t len);
diff --git a/src/devices/bus/a800/a800_slot.cpp b/src/devices/bus/a800/a800_slot.cpp
index db7315c970a..d333c417958 100644
--- a/src/devices/bus/a800/a800_slot.cpp
+++ b/src/devices/bus/a800/a800_slot.cpp
@@ -224,7 +224,7 @@ static const char *a800_get_slot(int type)
return "a800_8k";
}
-std::error_condition a800_cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> a800_cart_slot_device::call_load()
{
if (m_cart)
{
@@ -285,7 +285,7 @@ std::error_condition a800_cart_slot_device::call_load()
logerror("%s loaded cartridge '%s' size %dK\n", machine().system().name, filename(), len/1024);
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/a800/a800_slot.h b/src/devices/bus/a800/a800_slot.h
index 8cf79458d46..f5c9de95e19 100644
--- a/src/devices/bus/a800/a800_slot.h
+++ b/src/devices/bus/a800/a800_slot.h
@@ -103,7 +103,7 @@ public:
virtual ~a800_cart_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/acorn/system/8k.cpp b/src/devices/bus/acorn/system/8k.cpp
index 89ad463ebf3..b83544d3c8f 100644
--- a/src/devices/bus/acorn/system/8k.cpp
+++ b/src/devices/bus/acorn/system/8k.cpp
@@ -137,16 +137,13 @@ void acorn_8k_device::device_reset()
// IMPLEMENTATION
//**************************************************************************
-std::error_condition acorn_8k_device::load_rom(device_image_interface &image, generic_slot_device *slot)
+std::pair<std::error_condition, std::string> acorn_8k_device::load_rom(device_image_interface &image, generic_slot_device *slot)
{
uint32_t const size = slot->common_get_size("rom");
// socket accepts 2K and 4K ROM only
if (size != 0x0800 && size != 0x1000)
- {
- osd_printf_error("%s: Invalid size: Only 2K/4K is supported\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid size: Only 2K/4K is supported");
slot->rom_alloc(0x1000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
slot->common_load_rom(slot->get_rom_base(), size, "rom");
@@ -155,5 +152,5 @@ std::error_condition acorn_8k_device::load_rom(device_image_interface &image, ge
uint8_t *rom = slot->get_rom_base();
if (size <= 0x0800) memcpy(rom + 0x0800, rom, 0x0800);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/acorn/system/8k.h b/src/devices/bus/acorn/system/8k.h
index b22f2deec40..496a078ab1e 100644
--- a/src/devices/bus/acorn/system/8k.h
+++ b/src/devices/bus/acorn/system/8k.h
@@ -41,7 +41,7 @@ protected:
virtual ioport_constructor device_input_ports() const override;
private:
- std::error_condition load_rom(device_image_interface &image, generic_slot_device *slot);
+ std::pair<std::error_condition, std::string> load_rom(device_image_interface &image, generic_slot_device *slot);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom0_load) { return load_rom(image, m_rom[0]); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom1_load) { return load_rom(image, m_rom[1]); }
diff --git a/src/devices/bus/adam/exp.cpp b/src/devices/bus/adam/exp.cpp
index 855a1cd676f..3e519125f57 100644
--- a/src/devices/bus/adam/exp.cpp
+++ b/src/devices/bus/adam/exp.cpp
@@ -77,7 +77,7 @@ void adam_expansion_slot_device::device_start()
// call_load -
//-------------------------------------------------
-std::error_condition adam_expansion_slot_device::call_load()
+std::pair<std::error_condition, std::string> adam_expansion_slot_device::call_load()
{
if (m_card)
{
@@ -93,7 +93,7 @@ std::error_condition adam_expansion_slot_device::call_load()
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/adam/exp.h b/src/devices/bus/adam/exp.h
index 735637148cc..c3df4b7664b 100644
--- a/src/devices/bus/adam/exp.h
+++ b/src/devices/bus/adam/exp.h
@@ -54,7 +54,7 @@ protected:
virtual void device_start() override;
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
virtual const char *image_interface() const noexcept override { return "adam_rom"; }
diff --git a/src/devices/bus/apf/slot.cpp b/src/devices/bus/apf/slot.cpp
index 82b1ac142ef..2c5c3edb7f7 100644
--- a/src/devices/bus/apf/slot.cpp
+++ b/src/devices/bus/apf/slot.cpp
@@ -144,17 +144,14 @@ static const char *apf_get_slot(int type)
call load
-------------------------------------------------*/
-std::error_condition apf_cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> apf_cart_slot_device::call_load()
{
if (m_cart)
{
uint32_t const size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
if (size > 0x3800)
- {
- osd_printf_error("%s: Image extends beyond the expected size for an APF cart\n", basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Image exceeds the expected size for an APF cartridge (14K)");
m_cart->rom_alloc(size);
@@ -188,7 +185,7 @@ std::error_condition apf_cart_slot_device::call_load()
//printf("Type: %s\n", apf_get_slot(m_type));
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/apf/slot.h b/src/devices/bus/apf/slot.h
index 1587f471893..635cf3b8a71 100644
--- a/src/devices/bus/apf/slot.h
+++ b/src/devices/bus/apf/slot.h
@@ -73,7 +73,7 @@ public:
virtual ~apf_cart_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override {}
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/aquarius/slot.cpp b/src/devices/bus/aquarius/slot.cpp
index dd53829fe97..67ccbba65b0 100644
--- a/src/devices/bus/aquarius/slot.cpp
+++ b/src/devices/bus/aquarius/slot.cpp
@@ -83,17 +83,14 @@ void aquarius_cartridge_slot_device::device_start()
// call_load
//-------------------------------------------------
-std::error_condition aquarius_cartridge_slot_device::call_load()
+std::pair<std::error_condition, std::string> aquarius_cartridge_slot_device::call_load()
{
if (m_cart)
{
uint32_t const size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
if (size % 0x1000)
- {
- osd_printf_error("%s: Invalid ROM size\n", basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid ROM size (must be a multiple of 4K)");
m_cart->rom_alloc(size);
@@ -103,7 +100,7 @@ std::error_condition aquarius_cartridge_slot_device::call_load()
memcpy(m_cart->get_rom_base(), get_software_region("rom"), size);
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
//-------------------------------------------------
diff --git a/src/devices/bus/aquarius/slot.h b/src/devices/bus/aquarius/slot.h
index aae1d082bc9..8fd5910b42a 100644
--- a/src/devices/bus/aquarius/slot.h
+++ b/src/devices/bus/aquarius/slot.h
@@ -45,7 +45,7 @@ public:
auto nmi_handler() { return m_nmi_handler.bind(); }
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
virtual const char *image_interface() const noexcept override { return "aquarius_cart"; }
diff --git a/src/devices/bus/arcadia/slot.cpp b/src/devices/bus/arcadia/slot.cpp
index 33514f9feb6..5390ca91bf4 100644
--- a/src/devices/bus/arcadia/slot.cpp
+++ b/src/devices/bus/arcadia/slot.cpp
@@ -133,7 +133,7 @@ static const char *arcadia_get_slot(int type)
call load
-------------------------------------------------*/
-std::error_condition arcadia_cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> arcadia_cart_slot_device::call_load()
{
if (m_cart)
{
@@ -195,7 +195,7 @@ std::error_condition arcadia_cart_slot_device::call_load()
//printf("Type: %s\n", arcadia_get_slot(m_type));
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/arcadia/slot.h b/src/devices/bus/arcadia/slot.h
index 2741671a909..5aff49656fe 100644
--- a/src/devices/bus/arcadia/slot.h
+++ b/src/devices/bus/arcadia/slot.h
@@ -62,7 +62,7 @@ public:
virtual ~arcadia_cart_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override {}
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/astrocde/slot.cpp b/src/devices/bus/astrocde/slot.cpp
index 110f7ecd6ab..3cc5ba6e8f5 100644
--- a/src/devices/bus/astrocde/slot.cpp
+++ b/src/devices/bus/astrocde/slot.cpp
@@ -134,7 +134,7 @@ static const char *astrocade_get_slot(int type)
call load
-------------------------------------------------*/
-std::error_condition astrocade_cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> astrocade_cart_slot_device::call_load()
{
if (m_cart)
{
@@ -165,7 +165,7 @@ std::error_condition astrocade_cart_slot_device::call_load()
//printf("Type: %s\n", astrocade_get_slot(m_type));
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/astrocde/slot.h b/src/devices/bus/astrocde/slot.h
index b7670b63eda..1079133752b 100644
--- a/src/devices/bus/astrocde/slot.h
+++ b/src/devices/bus/astrocde/slot.h
@@ -67,7 +67,7 @@ public:
virtual ~astrocade_cart_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override {}
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/bbc/1mhzbus/datacentre.cpp b/src/devices/bus/bbc/1mhzbus/datacentre.cpp
index da1b7359750..7895e6b6341 100644
--- a/src/devices/bus/bbc/1mhzbus/datacentre.cpp
+++ b/src/devices/bus/bbc/1mhzbus/datacentre.cpp
@@ -328,9 +328,8 @@ QUICKLOAD_LOAD_MEMBER(bbc_datacentre_device::quickload_cb)
}
else
{
- osd_printf_error("%s: Invalid filetype, must be SSD, DSD, or IMG\n", image.basename());
- return image_error::INVALIDIMAGE;
+ return std::make_pair(image_error::INVALIDIMAGE, "Unsupported file type, must be SSD, DSD, or IMG");
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/bbc/rom/slot.cpp b/src/devices/bus/bbc/rom/slot.cpp
index 56aaca70fc1..6ef0dddf180 100644
--- a/src/devices/bus/bbc/rom/slot.cpp
+++ b/src/devices/bus/bbc/rom/slot.cpp
@@ -114,17 +114,14 @@ void bbc_romslot_device::device_start()
// call load
//-------------------------------------------------
-std::error_condition bbc_romslot_device::call_load()
+std::pair<std::error_condition, std::string> bbc_romslot_device::call_load()
{
if (m_cart)
{
uint32_t const size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
if (size % 0x2000)
- {
- osd_printf_error("%s: Invalid ROM size\n", basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid ROM size (must be a multiple of 8K)");
m_cart->rom_alloc(size, tag());
@@ -142,7 +139,7 @@ std::error_condition bbc_romslot_device::call_load()
m_cart->nvram_alloc(get_software_region_length("nvram"));
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
//-------------------------------------------------
diff --git a/src/devices/bus/bbc/rom/slot.h b/src/devices/bus/bbc/rom/slot.h
index b3f884db841..c88cabd3c1a 100644
--- a/src/devices/bus/bbc/rom/slot.h
+++ b/src/devices/bus/bbc/rom/slot.h
@@ -30,7 +30,7 @@ class bbc_romslot_device : public device_t,
{
public:
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_reset_on_load() const noexcept override { return false; }
diff --git a/src/devices/bus/c64/exp.cpp b/src/devices/bus/c64/exp.cpp
index f7265a18939..5525204d1ee 100644
--- a/src/devices/bus/c64/exp.cpp
+++ b/src/devices/bus/c64/exp.cpp
@@ -101,7 +101,7 @@ void c64_expansion_slot_device::device_reset()
// call_load -
//-------------------------------------------------
-std::error_condition c64_expansion_slot_device::call_load()
+std::pair<std::error_condition, std::string> c64_expansion_slot_device::call_load()
{
if (m_card)
{
@@ -190,13 +190,10 @@ std::error_condition c64_expansion_slot_device::call_load()
}
if ((m_card->m_roml_size & (m_card->m_roml_size - 1)) || (m_card->m_romh_size & (m_card->m_romh_size - 1)))
- {
- osd_printf_error("%s: ROM size must be power of 2\n", basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "ROM size must be power of 2");
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/c64/exp.h b/src/devices/bus/c64/exp.h
index 309c19dd94e..5473e1ab265 100644
--- a/src/devices/bus/c64/exp.h
+++ b/src/devices/bus/c64/exp.h
@@ -100,7 +100,7 @@ protected:
virtual void device_reset() override;
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
virtual const char *image_interface() const noexcept override { return "c64_cart,vic10_cart"; }
diff --git a/src/devices/bus/cbm2/exp.cpp b/src/devices/bus/cbm2/exp.cpp
index 276f26820f5..b7787b0c293 100644
--- a/src/devices/bus/cbm2/exp.cpp
+++ b/src/devices/bus/cbm2/exp.cpp
@@ -83,7 +83,7 @@ void cbm2_expansion_slot_device::device_start()
// call_load -
//-------------------------------------------------
-std::error_condition cbm2_expansion_slot_device::call_load()
+std::pair<std::error_condition, std::string> cbm2_expansion_slot_device::call_load()
{
if (m_card)
{
@@ -115,7 +115,7 @@ std::error_condition cbm2_expansion_slot_device::call_load()
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/cbm2/exp.h b/src/devices/bus/cbm2/exp.h
index d10a7771dcc..83eac3589bf 100644
--- a/src/devices/bus/cbm2/exp.h
+++ b/src/devices/bus/cbm2/exp.h
@@ -70,7 +70,7 @@ protected:
virtual void device_start() override;
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
virtual const char *image_interface() const noexcept override { return "cbm2_cart"; }
diff --git a/src/devices/bus/cgenie/expansion/floppy.cpp b/src/devices/bus/cgenie/expansion/floppy.cpp
index 40d05acad57..e0b9a565648 100644
--- a/src/devices/bus/cgenie/expansion/floppy.cpp
+++ b/src/devices/bus/cgenie/expansion/floppy.cpp
@@ -180,15 +180,12 @@ DEVICE_IMAGE_LOAD_MEMBER( cgenie_fdc_device::socket_load )
uint32_t const size = m_socket->common_get_size("rom");
if (size > 0x1000)
- {
- osd_printf_error("%s: Unsupported ROM size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported ROM size (must be no more than 4K)");
m_socket->rom_alloc(0x1000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
m_socket->common_load_rom(m_socket->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
WRITE_LINE_MEMBER( cgenie_fdc_device::intrq_w )
diff --git a/src/devices/bus/chanf/slot.cpp b/src/devices/bus/chanf/slot.cpp
index 76ec25d0bdc..6092103eb1d 100644
--- a/src/devices/bus/chanf/slot.cpp
+++ b/src/devices/bus/chanf/slot.cpp
@@ -146,7 +146,7 @@ static const char *chanf_get_slot(int type)
call load
-------------------------------------------------*/
-std::error_condition channelf_cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> channelf_cart_slot_device::call_load()
{
if (m_cart)
{
@@ -182,7 +182,7 @@ std::error_condition channelf_cart_slot_device::call_load()
//printf("Type: %s\n", chanf_get_slot(m_type));
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/chanf/slot.h b/src/devices/bus/chanf/slot.h
index fa8bb77520b..2b534cdbe78 100644
--- a/src/devices/bus/chanf/slot.h
+++ b/src/devices/bus/chanf/slot.h
@@ -78,7 +78,7 @@ public:
virtual ~channelf_cart_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override { }
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/coco/cococart.cpp b/src/devices/bus/coco/cococart.cpp
index 60fdadaeefd..2aae3647e83 100644
--- a/src/devices/bus/coco/cococart.cpp
+++ b/src/devices/bus/coco/cococart.cpp
@@ -574,7 +574,7 @@ static std::error_condition read_coco_rpk(std::unique_ptr<util::random_read> &&s
// call_load
//-------------------------------------------------
-std::error_condition cococart_slot_device::call_load()
+std::pair<std::error_condition, std::string> cococart_slot_device::call_load()
{
if (m_cart)
{
@@ -596,7 +596,7 @@ std::error_condition cococart_slot_device::call_load()
if (!err)
err = read_coco_rpk(std::move(proxy), base, cart_length, read_length);
if (err)
- return err;
+ return std::make_pair(err, std::string());
}
else
{
@@ -611,7 +611,7 @@ std::error_condition cococart_slot_device::call_load()
read_length += len;
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/coco/cococart.h b/src/devices/bus/coco/cococart.h
index b84461c78e3..3056bfeed62 100644
--- a/src/devices/bus/coco/cococart.h
+++ b/src/devices/bus/coco/cococart.h
@@ -71,7 +71,7 @@ public:
virtual void device_start() override;
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
virtual const char *image_interface() const noexcept override { return "coco_cart"; }
diff --git a/src/devices/bus/coleco/cartridge/exp.cpp b/src/devices/bus/coleco/cartridge/exp.cpp
index be69ee47293..49be28be699 100644
--- a/src/devices/bus/coleco/cartridge/exp.cpp
+++ b/src/devices/bus/coleco/cartridge/exp.cpp
@@ -76,7 +76,7 @@ void colecovision_cartridge_slot_device::device_start()
// call_load -
//-------------------------------------------------
-std::error_condition colecovision_cartridge_slot_device::call_load()
+std::pair<std::error_condition, std::string> colecovision_cartridge_slot_device::call_load()
{
if (m_card)
{
@@ -94,7 +94,7 @@ std::error_condition colecovision_cartridge_slot_device::call_load()
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/coleco/cartridge/exp.h b/src/devices/bus/coleco/cartridge/exp.h
index 2f3e8a0ed11..ee66204cf92 100644
--- a/src/devices/bus/coleco/cartridge/exp.h
+++ b/src/devices/bus/coleco/cartridge/exp.h
@@ -72,7 +72,7 @@ protected:
virtual void device_start() override;
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
virtual const char *image_interface() const noexcept override { return "coleco_cart"; }
diff --git a/src/devices/bus/cpc/cpc_rom.cpp b/src/devices/bus/cpc/cpc_rom.cpp
index 3ddd1e649a8..e8d17b61623 100644
--- a/src/devices/bus/cpc/cpc_rom.cpp
+++ b/src/devices/bus/cpc/cpc_rom.cpp
@@ -101,7 +101,7 @@ void cpc_rom_image_device::device_start()
/*-------------------------------------------------
DEVICE_IMAGE_LOAD( rom )
-------------------------------------------------*/
-std::error_condition cpc_rom_image_device::call_load()
+std::pair<std::error_condition, std::string> cpc_rom_image_device::call_load()
{
uint64_t const size = length();
@@ -116,7 +116,7 @@ std::error_condition cpc_rom_image_device::call_load()
fread(m_base, 16384);
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/cpc/cpc_rom.h b/src/devices/bus/cpc/cpc_rom.h
index 106d9909152..d0786f6ddbd 100644
--- a/src/devices/bus/cpc/cpc_rom.h
+++ b/src/devices/bus/cpc/cpc_rom.h
@@ -26,7 +26,7 @@ public:
virtual ~cpc_rom_image_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/crvision/slot.cpp b/src/devices/bus/crvision/slot.cpp
index 2027817c992..0b28124eb5b 100644
--- a/src/devices/bus/crvision/slot.cpp
+++ b/src/devices/bus/crvision/slot.cpp
@@ -137,17 +137,14 @@ static const char *crvision_get_slot(int type)
call load
-------------------------------------------------*/
-std::error_condition crvision_cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> crvision_cart_slot_device::call_load()
{
if (m_cart)
{
uint32_t const size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
if (size > 0x4800)
- {
- osd_printf_error("%s: Image extends beyond the expected size for an APF cart\n", basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Image exceeds the expected size for a CreatiVision cartridge (18K)");
m_cart->rom_alloc(size);
@@ -195,7 +192,7 @@ std::error_condition crvision_cart_slot_device::call_load()
logerror("Type: %s\n", crvision_get_slot(m_type));
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/crvision/slot.h b/src/devices/bus/crvision/slot.h
index 879aee8759a..dcb1f65edb7 100644
--- a/src/devices/bus/crvision/slot.h
+++ b/src/devices/bus/crvision/slot.h
@@ -71,7 +71,7 @@ public:
virtual ~crvision_cart_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override { }
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/ekara/slot.cpp b/src/devices/bus/ekara/slot.cpp
index f66b313576d..2f95580dd12 100644
--- a/src/devices/bus/ekara/slot.cpp
+++ b/src/devices/bus/ekara/slot.cpp
@@ -127,7 +127,7 @@ static const char *ekara_get_slot(int type)
call load
-------------------------------------------------*/
-std::error_condition ekara_cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> ekara_cart_slot_device::call_load()
{
if (m_cart)
{
@@ -156,7 +156,7 @@ std::error_condition ekara_cart_slot_device::call_load()
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/ekara/slot.h b/src/devices/bus/ekara/slot.h
index e0cccf808bd..69ccaa7ed03 100644
--- a/src/devices/bus/ekara/slot.h
+++ b/src/devices/bus/ekara/slot.h
@@ -81,7 +81,7 @@ public:
virtual ~ekara_cart_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override {}
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/electron/cart/ap5.cpp b/src/devices/bus/electron/cart/ap5.cpp
index 55ef329ce1d..82d83bfe611 100644
--- a/src/devices/bus/electron/cart/ap5.cpp
+++ b/src/devices/bus/electron/cart/ap5.cpp
@@ -154,16 +154,13 @@ void electron_ap5_device::write(offs_t offset, uint8_t data, int infc, int infd,
// IMPLEMENTATION
//**************************************************************************
-std::error_condition electron_ap5_device::load_rom(device_image_interface &image, generic_slot_device *slot)
+std::pair<std::error_condition, std::string> electron_ap5_device::load_rom(device_image_interface &image, generic_slot_device *slot)
{
uint32_t const size = slot->common_get_size("rom");
// socket accepts 8K and 16K ROM only
if (size != 0x2000 && size != 0x4000)
- {
- osd_printf_error("%s: Invalid size: Only 8K/16K is supported\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid size: Only 8K/16K is supported");
slot->rom_alloc(0x4000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
slot->common_load_rom(slot->get_rom_base(), size, "rom");
@@ -173,5 +170,5 @@ std::error_condition electron_ap5_device::load_rom(device_image_interface &image
if (size <= 0x2000)
memcpy(crt + 0x2000, crt, 0x2000);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/electron/cart/ap5.h b/src/devices/bus/electron/cart/ap5.h
index cebb1819c01..259a3e48812 100644
--- a/src/devices/bus/electron/cart/ap5.h
+++ b/src/devices/bus/electron/cart/ap5.h
@@ -42,7 +42,7 @@ protected:
virtual void write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
private:
- std::error_condition load_rom(device_image_interface &image, generic_slot_device *slot);
+ std::pair<std::error_condition, std::string> load_rom(device_image_interface &image, generic_slot_device *slot);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom1_load) { return load_rom(image, m_romslot[0]); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom2_load) { return load_rom(image, m_romslot[1]); }
diff --git a/src/devices/bus/electron/cart/romp144.cpp b/src/devices/bus/electron/cart/romp144.cpp
index 4034f0f0936..e570074a7f2 100644
--- a/src/devices/bus/electron/cart/romp144.cpp
+++ b/src/devices/bus/electron/cart/romp144.cpp
@@ -140,16 +140,13 @@ void electron_romp144_device::write(offs_t offset, uint8_t data, int infc, int i
// IMPLEMENTATION
//**************************************************************************
-std::error_condition electron_romp144_device::load_rom(device_image_interface &image, generic_slot_device *slot)
+std::pair<std::error_condition, std::string> electron_romp144_device::load_rom(device_image_interface &image, generic_slot_device *slot)
{
uint32_t const size = slot->common_get_size("rom");
// socket accepts 8K and 16K ROM only
if (size != 0x2000 && size != 0x4000)
- {
- osd_printf_error("%s: Invalid size: Only 8K/16K is supported\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid size: Only 8K/16K is supported");
slot->rom_alloc(0x4000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
slot->common_load_rom(slot->get_rom_base(), size, "rom");
@@ -159,5 +156,5 @@ std::error_condition electron_romp144_device::load_rom(device_image_interface &i
if (size <= 0x2000)
memcpy(crt + 0x2000, crt, 0x2000);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/electron/cart/romp144.h b/src/devices/bus/electron/cart/romp144.h
index 3d647c4f63d..1cd9cf90180 100644
--- a/src/devices/bus/electron/cart/romp144.h
+++ b/src/devices/bus/electron/cart/romp144.h
@@ -37,7 +37,7 @@ protected:
virtual void write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
private:
- std::error_condition load_rom(device_image_interface &image, generic_slot_device *slot);
+ std::pair<std::error_condition, std::string> load_rom(device_image_interface &image, generic_slot_device *slot);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom0) { return load_rom(image, m_romslot[0]); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom1) { return load_rom(image, m_romslot[1]); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom2) { return load_rom(image, m_romslot[2]); }
diff --git a/src/devices/bus/electron/cart/slot.cpp b/src/devices/bus/electron/cart/slot.cpp
index 45bc18b202e..fa0c87fcf9d 100644
--- a/src/devices/bus/electron/cart/slot.cpp
+++ b/src/devices/bus/electron/cart/slot.cpp
@@ -122,7 +122,7 @@ void electron_cartslot_device::device_start()
// call load
//-------------------------------------------------
-std::error_condition electron_cartslot_device::call_load()
+std::pair<std::error_condition, std::string> electron_cartslot_device::call_load()
{
if (m_cart)
{
@@ -131,10 +131,7 @@ std::error_condition electron_cartslot_device::call_load()
uint32_t const size = length();
if (size % 0x2000)
- {
- osd_printf_error("%s: Unsupported cartridge size\n", basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be a multiple of 8K)");
m_cart->rom_alloc(size, tag());
fread(m_cart->get_rom_base(), size);
@@ -151,10 +148,7 @@ std::error_condition electron_cartslot_device::call_load()
uint32_t nvramsize = get_software_region_length("nvram");
if ((upsize % 0x2000) || (losize % 0x2000) || (romsize % 0x2000))
- {
- osd_printf_error("%s: Unsupported cartridge size\n", basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported ROM size (must be a multiple of 8K)");
// load standard 2x16K ROM cartridges
if (losize != 0 || upsize != 0)
@@ -197,7 +191,7 @@ std::error_condition electron_cartslot_device::call_load()
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/electron/cart/slot.h b/src/devices/bus/electron/cart/slot.h
index 2a1f74c479c..170272fa9e7 100644
--- a/src/devices/bus/electron/cart/slot.h
+++ b/src/devices/bus/electron/cart/slot.h
@@ -137,7 +137,7 @@ public:
auto nmi_handler() { return m_nmi_handler.bind(); }
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_writeable() const noexcept override { return true; }
diff --git a/src/devices/bus/electron/plus1.cpp b/src/devices/bus/electron/plus1.cpp
index 1785cbbddf5..beab518a738 100644
--- a/src/devices/bus/electron/plus1.cpp
+++ b/src/devices/bus/electron/plus1.cpp
@@ -490,16 +490,13 @@ void electron_ap6_device::expbus_w(offs_t offset, uint8_t data)
// IMPLEMENTATION
//**************************************************************************
-std::error_condition electron_ap6_device::load_rom(device_image_interface &image, generic_slot_device *slot)
+std::pair<std::error_condition, std::string> electron_ap6_device::load_rom(device_image_interface &image, generic_slot_device *slot)
{
uint32_t const size = slot->common_get_size("rom");
// socket accepts 8K and 16K ROM only
if (size != 0x2000 && size != 0x4000)
- {
- osd_printf_error("%s: Invalid size: Only 8K/16K is supported\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid size: Only 8K/16K is supported");
slot->rom_alloc(0x4000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
slot->common_load_rom(slot->get_rom_base(), size, "rom");
@@ -509,5 +506,5 @@ std::error_condition electron_ap6_device::load_rom(device_image_interface &image
if (size <= 0x2000)
memcpy(crt + 0x2000, crt, 0x2000);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/electron/plus1.h b/src/devices/bus/electron/plus1.h
index e45fdbb01dc..d9113e1ba8e 100644
--- a/src/devices/bus/electron/plus1.h
+++ b/src/devices/bus/electron/plus1.h
@@ -88,7 +88,7 @@ protected:
virtual void expbus_w(offs_t offset, uint8_t data) override;
private:
- std::error_condition load_rom(device_image_interface &image, generic_slot_device *slot);
+ std::pair<std::error_condition, std::string> load_rom(device_image_interface &image, generic_slot_device *slot);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom1_load) { return load_rom(image, m_rom[0]); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom2_load) { return load_rom(image, m_rom[1]); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom3_load) { return load_rom(image, m_rom[2]); }
diff --git a/src/devices/bus/electron/plus2.cpp b/src/devices/bus/electron/plus2.cpp
index 524afbc4643..92a549cb30d 100644
--- a/src/devices/bus/electron/plus2.cpp
+++ b/src/devices/bus/electron/plus2.cpp
@@ -224,16 +224,13 @@ void electron_plus2_device::expbus_w(offs_t offset, uint8_t data)
// IMPLEMENTATION
//**************************************************************************
-std::error_condition electron_plus2_device::load_rom(device_image_interface &image, generic_slot_device *slot)
+std::pair<std::error_condition, std::string> electron_plus2_device::load_rom(device_image_interface &image, generic_slot_device *slot)
{
uint32_t const size = slot->common_get_size("rom");
// socket accepts 8K and 16K ROM only
if (size != 0x2000 && size != 0x4000)
- {
- osd_printf_error("%s: Invalid size: Only 8K/16K is supported\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid size: Only 8K/16K is supported");
slot->rom_alloc(0x4000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
slot->common_load_rom(slot->get_rom_base(), size, "rom");
@@ -243,5 +240,5 @@ std::error_condition electron_plus2_device::load_rom(device_image_interface &ima
if (size <= 0x2000)
memcpy(crt + 0x2000, crt, 0x2000);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/electron/plus2.h b/src/devices/bus/electron/plus2.h
index 5ec55338536..3257bd08d5b 100644
--- a/src/devices/bus/electron/plus2.h
+++ b/src/devices/bus/electron/plus2.h
@@ -41,7 +41,7 @@ protected:
virtual void expbus_w(offs_t offset, uint8_t data) override;
private:
- std::error_condition load_rom(device_image_interface &image, generic_slot_device *slot);
+ std::pair<std::error_condition, std::string> load_rom(device_image_interface &image, generic_slot_device *slot);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom1_load) { return load_rom(image, m_rom[0]); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom2_load) { return load_rom(image, m_rom[1]); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom3_load) { return load_rom(image, m_rom[2]); }
diff --git a/src/devices/bus/electron/rombox.cpp b/src/devices/bus/electron/rombox.cpp
index 7a9c3b6fe92..1e5de5eb143 100644
--- a/src/devices/bus/electron/rombox.cpp
+++ b/src/devices/bus/electron/rombox.cpp
@@ -178,16 +178,13 @@ void electron_rombox_device::expbus_w(offs_t offset, uint8_t data)
// IMPLEMENTATION
//**************************************************************************
-std::error_condition electron_rombox_device::load_rom(device_image_interface &image, generic_slot_device *slot)
+std::pair<std::error_condition, std::string> electron_rombox_device::load_rom(device_image_interface &image, generic_slot_device *slot)
{
uint32_t const size = slot->common_get_size("rom");
// socket accepts 8K and 16K ROM only
if (size != 0x2000 && size != 0x4000)
- {
- osd_printf_error("%s: Invalid size: Only 8K/16K is supported\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid size: Only 8K/16K is supported");
slot->rom_alloc(0x4000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
slot->common_load_rom(slot->get_rom_base(), size, "rom");
@@ -197,5 +194,5 @@ std::error_condition electron_rombox_device::load_rom(device_image_interface &im
if (size <= 0x2000)
memcpy(crt + 0x2000, crt, 0x2000);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/electron/rombox.h b/src/devices/bus/electron/rombox.h
index 6f9f3486c8f..244f551087e 100644
--- a/src/devices/bus/electron/rombox.h
+++ b/src/devices/bus/electron/rombox.h
@@ -39,7 +39,7 @@ protected:
virtual void expbus_w(offs_t offset, uint8_t data) override;
private:
- std::error_condition load_rom(device_image_interface &image, generic_slot_device *slot);
+ std::pair<std::error_condition, std::string> load_rom(device_image_interface &image, generic_slot_device *slot);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom1_load) { return load_rom(image, m_rom[0]); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom2_load) { return load_rom(image, m_rom[1]); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom3_load) { return load_rom(image, m_rom[2]); }
diff --git a/src/devices/bus/electron/romboxp.cpp b/src/devices/bus/electron/romboxp.cpp
index 5a5d334fd04..1ef3413acdd 100644
--- a/src/devices/bus/electron/romboxp.cpp
+++ b/src/devices/bus/electron/romboxp.cpp
@@ -321,16 +321,13 @@ void electron_romboxp_device::expbus_w(offs_t offset, uint8_t data)
// IMPLEMENTATION
//**************************************************************************
-std::error_condition electron_romboxp_device::load_rom(device_image_interface &image, generic_slot_device *slot)
+std::pair<std::error_condition, std::string> electron_romboxp_device::load_rom(device_image_interface &image, generic_slot_device *slot)
{
uint32_t const size = slot->common_get_size("rom");
// socket accepts 8K and 16K ROM only
if (size != 0x2000 && size != 0x4000)
- {
- osd_printf_error("%s: Invalid size: Only 8K/16K is supported\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid size: Only 8K/16K is supported");
slot->rom_alloc(0x4000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
slot->common_load_rom(slot->get_rom_base(), size, "rom");
@@ -340,5 +337,5 @@ std::error_condition electron_romboxp_device::load_rom(device_image_interface &i
if (size <= 0x2000)
memcpy(crt + 0x2000, crt, 0x2000);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/electron/romboxp.h b/src/devices/bus/electron/romboxp.h
index dad77e6ad33..b4022d13053 100644
--- a/src/devices/bus/electron/romboxp.h
+++ b/src/devices/bus/electron/romboxp.h
@@ -45,7 +45,7 @@ protected:
virtual void expbus_w(offs_t offset, uint8_t data) override;
private:
- std::error_condition load_rom(device_image_interface &image, generic_slot_device *slot);
+ std::pair<std::error_condition, std::string> load_rom(device_image_interface &image, generic_slot_device *slot);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom1_load) { return load_rom(image, m_rom[0]); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom2_load) { return load_rom(image, m_rom[1]); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom3_load) { return load_rom(image, m_rom[2]); }
diff --git a/src/devices/bus/electron/sidewndr.cpp b/src/devices/bus/electron/sidewndr.cpp
index 3bb05c97438..da32ac872bc 100644
--- a/src/devices/bus/electron/sidewndr.cpp
+++ b/src/devices/bus/electron/sidewndr.cpp
@@ -167,16 +167,13 @@ void electron_sidewndr_device::expbus_w(offs_t offset, uint8_t data)
// IMPLEMENTATION
//**************************************************************************
-std::error_condition electron_sidewndr_device::load_rom(device_image_interface &image, generic_slot_device *slot)
+std::pair<std::error_condition, std::string> electron_sidewndr_device::load_rom(device_image_interface &image, generic_slot_device *slot)
{
uint32_t const size = slot->common_get_size("rom");
// socket accepts 8K and 16K ROM only
if (size != 0x2000 && size != 0x4000)
- {
- osd_printf_error("%s: Invalid size: Only 8K/16K is supported\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid size: Only 8K/16K is supported");
slot->rom_alloc(0x4000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
slot->common_load_rom(slot->get_rom_base(), size, "rom");
@@ -186,5 +183,5 @@ std::error_condition electron_sidewndr_device::load_rom(device_image_interface &
if (size <= 0x2000)
memcpy(crt + 0x2000, crt, 0x2000);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/electron/sidewndr.h b/src/devices/bus/electron/sidewndr.h
index 29d3d4612bc..84e30d2e2a9 100644
--- a/src/devices/bus/electron/sidewndr.h
+++ b/src/devices/bus/electron/sidewndr.h
@@ -39,7 +39,7 @@ protected:
virtual void expbus_w(offs_t offset, uint8_t data) override;
private:
- std::error_condition load_rom(device_image_interface &image, generic_slot_device *slot);
+ std::pair<std::error_condition, std::string> load_rom(device_image_interface &image, generic_slot_device *slot);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom1_load) { return load_rom(image, m_rom[0]); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom2_load) { return load_rom(image, m_rom[1]); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom3_load) { return load_rom(image, m_rom[2]); }
diff --git a/src/devices/bus/gamate/slot.cpp b/src/devices/bus/gamate/slot.cpp
index 4dc782cbff6..ef613629651 100644
--- a/src/devices/bus/gamate/slot.cpp
+++ b/src/devices/bus/gamate/slot.cpp
@@ -125,17 +125,14 @@ static const char *gamate_get_slot(int type)
call load
-------------------------------------------------*/
-std::error_condition gamate_cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> gamate_cart_slot_device::call_load()
{
if (m_cart)
{
uint32_t const len = !loaded_through_softlist() ? length() : get_software_region_length("rom");
if (len > 0x8'0000)
- {
- osd_printf_error("%s: Unsupported cartridge size\n", basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be no more than 512K)");
m_cart->rom_alloc(len);
@@ -160,7 +157,7 @@ std::error_condition gamate_cart_slot_device::call_load()
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/gamate/slot.h b/src/devices/bus/gamate/slot.h
index 92090ee1380..54679ae0c23 100644
--- a/src/devices/bus/gamate/slot.h
+++ b/src/devices/bus/gamate/slot.h
@@ -65,7 +65,7 @@ public:
virtual ~gamate_cart_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override { }
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/gameboy/gbslot.cpp b/src/devices/bus/gameboy/gbslot.cpp
index 11885662c97..c61507dbd4f 100644
--- a/src/devices/bus/gameboy/gbslot.cpp
+++ b/src/devices/bus/gameboy/gbslot.cpp
@@ -1121,7 +1121,7 @@ void gb_cart_slot_device::device_reset_after_children()
}
-std::error_condition gb_cart_slot_device::load_image_file(util::random_read &file)
+std::pair<std::error_condition, std::string> gb_cart_slot_device::load_image_file(util::random_read &file)
{
using namespace bus::gameboy;
@@ -1138,19 +1138,10 @@ std::error_condition gb_cart_slot_device::load_image_file(util::random_read &fil
// try reading the GBX footer into temporary space before more checks
std::unique_ptr<u8 []> const footer(new (std::nothrow) u8 [gbxtrailer.size]);
if (!footer)
- {
- osd_printf_error("%s: Error allocating memory to read GBX file footer\n", basename());
- return std::errc::not_enough_memory;
- }
+ return std::make_pair(std::errc::not_enough_memory, "Error allocating memory to read GBX file footer");
std::error_condition const err = file.read_at(len - gbxtrailer.size, footer.get(), gbxtrailer.size, actual);
if (err || (gbxtrailer.size != actual))
- {
- osd_printf_error("%s: Error reading GBX file footer\n", basename());
- if (err)
- return err;
- else
- return std::errc::io_error;
- }
+ return std::make_pair(err ? err : std::errc::io_error, "Error reading GBX file footer");
if (1 != gbxtrailer.ver_maj)
{
// some unsupported GBX version - assume footer immediately follows ROM
@@ -1252,13 +1243,7 @@ std::error_condition gb_cart_slot_device::load_image_file(util::random_read &fil
memory_region *const romregion = machine().memory().region_alloc(subtag("rom"), len, 1, ENDIANNESS_LITTLE);
std::error_condition const err = file.read_at(offset, romregion->base(), len, actual);
if (err || (len != actual))
- {
- osd_printf_error("%s: Error reading ROM data from cartridge file\n", basename());
- if (err)
- return err;
- else
- return std::errc::io_error;
- }
+ return std::make_pair(err ? err : std::errc::io_error, "Error reading ROM data from cartridge file");
// allocate cartridge RAM based on header if necessary
if (proberam)
@@ -1272,7 +1257,7 @@ std::error_condition gb_cart_slot_device::load_image_file(util::random_read &fil
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/gameboy/gbslot.h b/src/devices/bus/gameboy/gbslot.h
index 9555fbdbfbd..f235da46428 100644
--- a/src/devices/bus/gameboy/gbslot.h
+++ b/src/devices/bus/gameboy/gbslot.h
@@ -76,7 +76,7 @@ protected:
virtual void device_reset_after_children() override ATTR_COLD;
// gb_cart_slot_device_base implementation
- virtual std::error_condition load_image_file(util::random_read &file) override ATTR_COLD;
+ virtual std::pair<std::error_condition, std::string> load_image_file(util::random_read &file) override ATTR_COLD;
void allocate_cart_ram(u8 const *basepage) ATTR_COLD;
};
diff --git a/src/devices/bus/gameboy/mdslot.cpp b/src/devices/bus/gameboy/mdslot.cpp
index 0e42321de0e..8ef534c9bef 100644
--- a/src/devices/bus/gameboy/mdslot.cpp
+++ b/src/devices/bus/gameboy/mdslot.cpp
@@ -116,7 +116,7 @@ std::string megaduck_cart_slot_device::get_default_card_software(get_default_car
}
-std::error_condition megaduck_cart_slot_device::load_image_file(util::random_read &file)
+std::pair<std::error_condition, std::string> megaduck_cart_slot_device::load_image_file(util::random_read &file)
{
auto const len = length();
size_t actual;
@@ -127,16 +127,10 @@ std::error_condition megaduck_cart_slot_device::load_image_file(util::random_rea
memory_region *const romregion = machine().memory().region_alloc(subtag("rom"), len, 1, ENDIANNESS_LITTLE);
std::error_condition const err = file.read_at(0, romregion->base(), len, actual);
if (err || (len != actual))
- {
- osd_printf_error("%s: Error reading cartridge file\n", basename());
- if (err)
- return err;
- else
- return std::errc::io_error;
- }
+ std::make_pair(err ? err : std::errc::io_error, "Error reading cartridge file");
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/gameboy/mdslot.h b/src/devices/bus/gameboy/mdslot.h
index de0c6d907ae..d78ac6f906c 100644
--- a/src/devices/bus/gameboy/mdslot.h
+++ b/src/devices/bus/gameboy/mdslot.h
@@ -61,7 +61,7 @@ public:
protected:
// gb_cart_slot_device_base implementation
- virtual std::error_condition load_image_file(util::random_read &file) override ATTR_COLD;
+ virtual std::pair<std::error_condition, std::string> load_image_file(util::random_read &file) override ATTR_COLD;
};
diff --git a/src/devices/bus/gameboy/slot.cpp b/src/devices/bus/gameboy/slot.cpp
index c0d1b240527..a38ebf4bd33 100644
--- a/src/devices/bus/gameboy/slot.cpp
+++ b/src/devices/bus/gameboy/slot.cpp
@@ -47,27 +47,27 @@ void gb_cart_slot_device_base::device_start()
}
-std::error_condition gb_cart_slot_device_base::call_load()
+std::pair<std::error_condition, std::string> gb_cart_slot_device_base::call_load()
{
if (!m_cart)
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
std::error_condition result;
+ std::string message;
if (!loaded_through_softlist())
{
- result = load_image_file(image_core_file());
+ std::tie(result, message) = load_image_file(image_core_file());
if (result)
- return result;
+ return std::make_pair(result, message);
}
- std::string message;
+
result = m_cart->load(message);
if (result)
{
if (result == image_error::BADSOFTWARE && !loaded_through_softlist())
result = image_error::INVALIDIMAGE;
- osd_printf_error("%s: %s\n", basename(), message);
}
- return result;
+ return std::make_pair(result, message);
}
diff --git a/src/devices/bus/gameboy/slot.h b/src/devices/bus/gameboy/slot.h
index 4cb037680a9..e3094f61f09 100644
--- a/src/devices/bus/gameboy/slot.h
+++ b/src/devices/bus/gameboy/slot.h
@@ -38,7 +38,7 @@ public:
template <typename... T> void set_space(T &&... args) { m_space.set_tag(std::forward<T>(args)...); }
// device_image_interface implementation
- virtual std::error_condition call_load() override ATTR_COLD;
+ virtual std::pair<std::error_condition, std::string> call_load() override ATTR_COLD;
virtual void call_unload() override ATTR_COLD;
virtual bool is_reset_on_load() const noexcept override { return true; }
@@ -48,7 +48,7 @@ protected:
// device_t implementation
virtual void device_start() override ATTR_COLD;
- virtual std::error_condition load_image_file(util::random_read &file) = 0;
+ virtual std::pair<std::error_condition, std::string> load_image_file(util::random_read &file) = 0;
address_space &cart_space() noexcept { return *m_space; }
diff --git a/src/devices/bus/gba/gba_slot.cpp b/src/devices/bus/gba/gba_slot.cpp
index b26656d1fc0..950f4087eb8 100644
--- a/src/devices/bus/gba/gba_slot.cpp
+++ b/src/devices/bus/gba/gba_slot.cpp
@@ -617,16 +617,13 @@ static const char *gba_get_slot(int type)
call load
-------------------------------------------------*/
-std::error_condition gba_cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> gba_cart_slot_device::call_load()
{
if (m_cart)
{
uint32_t const size = loaded_through_softlist() ? get_software_region_length("rom") : length();
if (size > 0x400'0000)
- {
- osd_printf_error("%s: Attempted loading a cart larger than 64MB\n", basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Cartridges larger than 64MB are not supported");
m_cart->rom_alloc(size, tag());
uint8_t *const ROM = (uint8_t *)m_cart->get_rom_base();
@@ -683,7 +680,7 @@ std::error_condition gba_cart_slot_device::call_load()
battery_load(m_cart->get_nvram_base(), m_cart->get_nvram_size(), 0x00);
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/gba/gba_slot.h b/src/devices/bus/gba/gba_slot.h
index 5977a5b7b39..0a7e66ca957 100644
--- a/src/devices/bus/gba/gba_slot.h
+++ b/src/devices/bus/gba/gba_slot.h
@@ -98,7 +98,7 @@ public:
virtual ~gba_cart_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/generic/slot.cpp b/src/devices/bus/generic/slot.cpp
index df00b06328b..dba9e12c385 100644
--- a/src/devices/bus/generic/slot.cpp
+++ b/src/devices/bus/generic/slot.cpp
@@ -160,24 +160,25 @@ void generic_slot_device::device_start()
call load
-------------------------------------------------*/
-std::error_condition generic_slot_device::call_load()
+std::pair<std::error_condition, std::string> generic_slot_device::call_load()
{
- if (m_cart)
+ if (!m_cart)
+ {
+ return std::make_pair(std::error_condition(), std::string());
+ }
+ else if (!m_device_image_load.isnull())
{
- if (!m_device_image_load.isnull())
- return m_device_image_load(*this);
- else
- {
- u32 len = common_get_size("rom");
+ return m_device_image_load(*this);
+ }
+ else
+ {
+ u32 const len = common_get_size("rom");
- rom_alloc(len, m_width, m_endianness);
- common_load_rom(get_rom_base(), len, "rom");
+ rom_alloc(len, m_width, m_endianness);
+ common_load_rom(get_rom_base(), len, "rom");
- return std::error_condition();
- }
+ return std::make_pair(std::error_condition(), std::string());
}
-
- return std::error_condition();
}
diff --git a/src/devices/bus/generic/slot.h b/src/devices/bus/generic/slot.h
index 85deeb74316..9fde07ddd83 100644
--- a/src/devices/bus/generic/slot.h
+++ b/src/devices/bus/generic/slot.h
@@ -14,7 +14,7 @@
// MACROS
//**************************************************************************
-#define DEVICE_IMAGE_LOAD_MEMBER(_name) std::error_condition _name(device_image_interface &image)
+#define DEVICE_IMAGE_LOAD_MEMBER(_name) std::pair<std::error_condition, std::string> _name(device_image_interface &image)
#define DECLARE_DEVICE_IMAGE_LOAD_MEMBER(_name) DEVICE_IMAGE_LOAD_MEMBER(_name)
#define DEVICE_IMAGE_UNLOAD_MEMBER(_name) void _name(device_image_interface &image)
@@ -149,7 +149,7 @@ class generic_slot_device : public device_t,
public device_single_card_slot_interface<device_generic_cart_interface>
{
public:
- typedef device_delegate<std::error_condition (device_image_interface &)> load_delegate;
+ typedef device_delegate<std::pair<std::error_condition, std::string> (device_image_interface &)> load_delegate;
typedef device_delegate<void (device_image_interface &)> unload_delegate;
virtual ~generic_slot_device();
@@ -164,7 +164,7 @@ public:
void set_endian(endianness_t end) { m_endianness = end; }
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
virtual char const *image_interface() const noexcept override { return m_interface; }
diff --git a/src/devices/bus/intellec4/insdatastor.cpp b/src/devices/bus/intellec4/insdatastor.cpp
index 444553232e7..9473ca4ffb6 100644
--- a/src/devices/bus/intellec4/insdatastor.cpp
+++ b/src/devices/bus/intellec4/insdatastor.cpp
@@ -168,7 +168,7 @@ class imm4_22_device
public:
imm4_22_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock);
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_readable() const noexcept override { return true; }
@@ -222,18 +222,22 @@ imm4_22_device::imm4_22_device(machine_config const &mconfig, char const *tag, d
}
-std::error_condition imm4_22_device::call_load()
+std::pair<std::error_condition, std::string> imm4_22_device::call_load()
{
if ((length() > 1024U) || (length() % 256U))
- return image_error::INVALIDLENGTH;
+ {
+ return std::make_pair(
+ image_error::INVALIDLENGTH,
+ "Invalid PROM image size (must be a multiple of 256 bytes no larger than 1K)");
+ }
allocate();
if (fread(m_prom.get(), length()) != length())
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, "Error reading file");
map_prom();
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void imm4_22_device::call_unload()
diff --git a/src/devices/bus/intellec4/prommemory.cpp b/src/devices/bus/intellec4/prommemory.cpp
index 59e353fe61c..87583d79cac 100644
--- a/src/devices/bus/intellec4/prommemory.cpp
+++ b/src/devices/bus/intellec4/prommemory.cpp
@@ -97,7 +97,7 @@ class imm6_26_device
public:
imm6_26_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock);
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_readable() const noexcept override { return true; }
@@ -128,20 +128,24 @@ imm6_26_device::imm6_26_device(machine_config const &mconfig, char const *tag, d
}
-std::error_condition imm6_26_device::call_load()
+std::pair<std::error_condition, std::string> imm6_26_device::call_load()
{
if ((length() > 4096U) || (length() % 256U))
- return image_error::INVALIDLENGTH;
+ {
+ return std::make_pair(
+ image_error::INVALIDLENGTH,
+ "Invalid PROM image size (must be a multiple of 256 bytes no larger than 4K)");
+ }
unmap();
allocate();
if (fread(m_data.get(), length()) != length())
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, "Error reading file");
// FIXME: gimme a cookie!
rom_space().install_rom(0x1000U, offs_t(0x1000U + length()), m_data.get());
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void imm6_26_device::call_unload()
diff --git a/src/devices/bus/intellec4/tapereader.cpp b/src/devices/bus/intellec4/tapereader.cpp
index 191294ead1f..3f77933b95f 100644
--- a/src/devices/bus/intellec4/tapereader.cpp
+++ b/src/devices/bus/intellec4/tapereader.cpp
@@ -28,7 +28,7 @@ class imm4_90_device
public:
imm4_90_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock);
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual char const *file_extensions() const noexcept override { return "bnpf,hex,lst,txt"; }
@@ -65,13 +65,13 @@ imm4_90_device::imm4_90_device(machine_config const &mconfig, char const *tag, d
}
-std::error_condition imm4_90_device::call_load()
+std::pair<std::error_condition, std::string> imm4_90_device::call_load()
{
m_step_timer->reset();
m_data = 0x00U;
m_ready = false;
m_stepping = false;
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void imm4_90_device::call_unload()
diff --git a/src/devices/bus/intv/slot.cpp b/src/devices/bus/intv/slot.cpp
index aa09742020c..fbef7a20457 100644
--- a/src/devices/bus/intv/slot.cpp
+++ b/src/devices/bus/intv/slot.cpp
@@ -376,12 +376,12 @@ std::error_condition intv_cart_slot_device::load_fullpath()
}
}
-std::error_condition intv_cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> intv_cart_slot_device::call_load()
{
if (m_cart)
{
if (!loaded_through_softlist())
- return load_fullpath();
+ return std::make_pair(load_fullpath(), std::string());
else
{
uint16_t offset[] = { 0x400, 0x2000, 0x4000, 0x4800, 0x5000, 0x6000, 0x7000, 0x8000, 0x8800, 0x9000, 0xa000, 0xb000, 0xc000, 0xd000, 0xe000, 0xf000};
@@ -424,11 +424,11 @@ std::error_condition intv_cart_slot_device::call_load()
m_cart->ram_alloc(get_software_region_length("ram"));
//printf("Type: %s\n", intv_get_slot(m_type));
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/intv/slot.h b/src/devices/bus/intv/slot.h
index bf8f34bc77a..fe497da4af4 100644
--- a/src/devices/bus/intv/slot.h
+++ b/src/devices/bus/intv/slot.h
@@ -112,7 +112,7 @@ public:
virtual ~intv_cart_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override {}
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/iq151/iq151.cpp b/src/devices/bus/iq151/iq151.cpp
index 26b54c33834..e1f6f1ebb4e 100644
--- a/src/devices/bus/iq151/iq151.cpp
+++ b/src/devices/bus/iq151/iq151.cpp
@@ -155,30 +155,28 @@ void iq151cart_slot_device::video_update(bitmap_ind16 &bitmap, const rectangle &
call load
-------------------------------------------------*/
-std::error_condition iq151cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> iq151cart_slot_device::call_load()
{
if (m_cart)
{
uint8_t *const cart_base = m_cart->get_cart_base();
- if (cart_base)
+ if (!cart_base)
+ return std::make_pair(image_error::INTERNAL, std::string());
+
+ offs_t read_length;
+ if (!loaded_through_softlist())
{
- offs_t read_length;
- if (!loaded_through_softlist())
- {
- read_length = length();
- fread(m_cart->get_cart_base(), read_length);
- }
- else
- {
- read_length = get_software_region_length("rom");
- memcpy(m_cart->get_cart_base(), get_software_region("rom"), read_length);
- }
+ read_length = length();
+ fread(m_cart->get_cart_base(), read_length);
}
else
- return image_error::INTERNAL;
+ {
+ read_length = get_software_region_length("rom");
+ memcpy(m_cart->get_cart_base(), get_software_region("rom"), read_length);
+ }
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
/*-------------------------------------------------
diff --git a/src/devices/bus/iq151/iq151.h b/src/devices/bus/iq151/iq151.h
index 96691e64407..827dc404f37 100644
--- a/src/devices/bus/iq151/iq151.h
+++ b/src/devices/bus/iq151/iq151.h
@@ -109,7 +109,7 @@ public:
auto out_drq_callback() { return m_out_drq_cb.bind(); }
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
virtual const char *image_interface() const noexcept override { return "iq151_cart"; }
diff --git a/src/devices/bus/isa/omti8621.cpp b/src/devices/bus/isa/omti8621.cpp
index 815204c861c..02c117d493a 100644
--- a/src/devices/bus/isa/omti8621.cpp
+++ b/src/devices/bus/isa/omti8621.cpp
@@ -59,7 +59,7 @@ public:
virtual const char *image_type_name() const noexcept override { return "winchester"; }
virtual const char *image_brief_type_name() const noexcept override { return "disk"; }
- virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
+ virtual std::pair<std::error_condition, std::string> call_create(int format_type, util::option_resolution *format_options) override;
protected:
// device_t implementation
@@ -1469,7 +1469,7 @@ void omti_disk_image_device::device_reset()
disk image create callback
-------------------------------------------------*/
-std::error_condition omti_disk_image_device::call_create(int format_type, util::option_resolution *format_options)
+std::pair<std::error_condition, std::string> omti_disk_image_device::call_create(int format_type, util::option_resolution *format_options)
{
logerror("device_create_omti_disk: creating OMTI Disk with %d blocks\n", m_sector_count);
@@ -1479,8 +1479,8 @@ std::error_condition omti_disk_image_device::call_create(int format_type, util::
for (int x = 0; x < m_sector_count; x++)
{
if (fwrite(sectordata, OMTI_DISK_SECTOR_SIZE) < OMTI_DISK_SECTOR_SIZE)
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/isa/sc499.cpp b/src/devices/bus/isa/sc499.cpp
index 4e46ee72613..f7775f83a75 100644
--- a/src/devices/bus/isa/sc499.cpp
+++ b/src/devices/bus/isa/sc499.cpp
@@ -1295,19 +1295,19 @@ void sc499_ctape_image_device::write_block(int block_num, uint8_t *ptr)
memcpy(&m_ctape_data[block_num * SC499_CTAPE_BLOCK_SIZE], ptr, SC499_CTAPE_BLOCK_SIZE);
}
-std::error_condition sc499_ctape_image_device::call_load()
+std::pair<std::error_condition, std::string> sc499_ctape_image_device::call_load()
{
try
{
auto const size = length();
m_ctape_data.resize(size);
if (!fseek(0, SEEK_SET) && (fread(m_ctape_data.data(), size) == size))
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
catch (...)
{
}
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
}
void sc499_ctape_image_device::call_unload()
diff --git a/src/devices/bus/isa/sc499.h b/src/devices/bus/isa/sc499.h
index 2172e18a132..8bb94221b41 100644
--- a/src/devices/bus/isa/sc499.h
+++ b/src/devices/bus/isa/sc499.h
@@ -31,7 +31,7 @@ public:
sc499_ctape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool support_command_line_image_creation() const noexcept override { return true; }
diff --git a/src/devices/bus/jakks_gamekey/slot.cpp b/src/devices/bus/jakks_gamekey/slot.cpp
index 62c7ccdee37..c1760874010 100644
--- a/src/devices/bus/jakks_gamekey/slot.cpp
+++ b/src/devices/bus/jakks_gamekey/slot.cpp
@@ -125,7 +125,7 @@ static const char *jakks_gamekey_get_slot(int type)
call load
-------------------------------------------------*/
-std::error_condition jakks_gamekey_slot_device::call_load()
+std::pair<std::error_condition, std::string> jakks_gamekey_slot_device::call_load()
{
if (m_cart)
{
@@ -154,7 +154,7 @@ std::error_condition jakks_gamekey_slot_device::call_load()
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/jakks_gamekey/slot.h b/src/devices/bus/jakks_gamekey/slot.h
index 305a099b70b..15ff833eaf0 100644
--- a/src/devices/bus/jakks_gamekey/slot.h
+++ b/src/devices/bus/jakks_gamekey/slot.h
@@ -69,7 +69,7 @@ public:
virtual ~jakks_gamekey_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override { }
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/kc/kc.cpp b/src/devices/bus/kc/kc.cpp
index 53d2ff70e94..8297ad7da7d 100644
--- a/src/devices/bus/kc/kc.cpp
+++ b/src/devices/bus/kc/kc.cpp
@@ -316,7 +316,7 @@ kccart_slot_device::~kccart_slot_device()
call load
-------------------------------------------------*/
-std::error_condition kccart_slot_device::call_load()
+std::pair<std::error_condition, std::string> kccart_slot_device::call_load()
{
if (m_cart)
{
@@ -336,10 +336,10 @@ std::error_condition kccart_slot_device::call_load()
}
}
else
- return image_error::INTERNAL;
+ return std::make_pair(image_error::INTERNAL, std::string());
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
/*-------------------------------------------------
diff --git a/src/devices/bus/kc/kc.h b/src/devices/bus/kc/kc.h
index d97aa1a1dd5..20eca1b2d79 100644
--- a/src/devices/bus/kc/kc.h
+++ b/src/devices/bus/kc/kc.h
@@ -111,7 +111,7 @@ public:
virtual ~kccart_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
virtual const char *image_interface() const noexcept override { return "kc_cart"; }
diff --git a/src/devices/bus/m5/slot.cpp b/src/devices/bus/m5/slot.cpp
index ac5edfaa055..1be35e6d997 100644
--- a/src/devices/bus/m5/slot.cpp
+++ b/src/devices/bus/m5/slot.cpp
@@ -145,7 +145,7 @@ static const char *m5_get_slot(int type)
call load
-------------------------------------------------*/
-std::error_condition m5_cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> m5_cart_slot_device::call_load()
{
if (m_cart)
{
@@ -165,10 +165,7 @@ std::error_condition m5_cart_slot_device::call_load()
uint32_t size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
if (size > 0x5000 && m_type == M5_STD)
- {
- osd_printf_error("%s: Image extends beyond the expected size for an M5 cart\n", basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Image file exceeds the expected size for an M5 cart (20K)");
m_cart->rom_alloc(size, tag());
@@ -182,11 +179,10 @@ std::error_condition m5_cart_slot_device::call_load()
if (get_software_region("ram"))
m_cart->ram_alloc(get_software_region_length("ram"));
-
//printf("Type: %s\n", m5_get_slot(m_type));
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/m5/slot.h b/src/devices/bus/m5/slot.h
index 36a9658ffc6..afd727eed60 100644
--- a/src/devices/bus/m5/slot.h
+++ b/src/devices/bus/m5/slot.h
@@ -80,7 +80,7 @@ public:
virtual ~m5_cart_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override { }
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/mc10/mc10_cart.cpp b/src/devices/bus/mc10/mc10_cart.cpp
index 9e9026c503b..dd9b08866a3 100644
--- a/src/devices/bus/mc10/mc10_cart.cpp
+++ b/src/devices/bus/mc10/mc10_cart.cpp
@@ -88,23 +88,21 @@ void mc10cart_slot_device::set_nmi_line(int state)
// call_load
//-------------------------------------------------
-std::error_condition mc10cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> mc10cart_slot_device::call_load()
{
if (!m_cart)
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
memory_region *romregion(loaded_through_softlist() ? memregion("rom") : nullptr);
if (loaded_through_softlist() && !romregion)
- {
- osd_printf_error("%s: Software list item has no 'rom' data area\n", basename());
- return image_error::BADSOFTWARE;
- }
+ return std::make_pair(image_error::BADSOFTWARE, "Software list item has no 'rom' data area");
u32 const len(loaded_through_softlist() ? romregion->bytes() : length());
if (len > m_cart->max_rom_length())
{
- osd_printf_error("%s: Unsupported cartridge size\n", basename());
- return image_error::INVALIDLENGTH;
+ return std::make_pair(
+ image_error::INVALIDLENGTH,
+ util::string_format("Unsupported cartridge size (must be no more than %u bytes)", m_cart->max_rom_length()));
}
if (!loaded_through_softlist())
@@ -113,10 +111,7 @@ std::error_condition mc10cart_slot_device::call_load()
romregion = machine().memory().region_alloc(subtag("rom"), len, 1, ENDIANNESS_BIG);
u32 const cnt(fread(romregion->base(), len));
if (cnt != len)
- {
- osd_printf_error("%s: Error reading cartridge file\n", basename());
- return image_error::UNSPECIFIED;
- }
+ return std::make_pair(image_error::UNSPECIFIED, "Error reading cartridge file");
}
return m_cart->load();
@@ -189,9 +184,9 @@ int device_mc10cart_interface::max_rom_length() const
load
-------------------------------------------------*/
-std::error_condition device_mc10cart_interface::load()
+std::pair<std::error_condition, std::string> device_mc10cart_interface::load()
{
- return image_error::UNSUPPORTED;
+ return std::make_pair(image_error::UNSUPPORTED, std::string());
}
//-------------------------------------------------
diff --git a/src/devices/bus/mc10/mc10_cart.h b/src/devices/bus/mc10/mc10_cart.h
index dd9e4b8235b..16e946e1e3e 100644
--- a/src/devices/bus/mc10/mc10_cart.h
+++ b/src/devices/bus/mc10/mc10_cart.h
@@ -28,7 +28,6 @@ class mc10cart_slot_device final : public device_t,
public device_cartrom_image_interface
{
public:
-
// construction/destruction
template <typename T>
mc10cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock, T &&opts, const char *dflt)
@@ -50,7 +49,7 @@ public:
address_space &memspace() const { return *m_memspace; }
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
virtual const char *image_interface() const noexcept override { return "mc10_cart"; }
@@ -84,7 +83,7 @@ public:
virtual ~device_mc10cart_interface();
virtual int max_rom_length() const;
- virtual std::error_condition load();
+ virtual std::pair<std::error_condition, std::string> load();
protected:
void raise_cart_nmi() { m_owning_slot->set_nmi_line(ASSERT_LINE); }
diff --git a/src/devices/bus/mc10/mcx128.cpp b/src/devices/bus/mc10/mcx128.cpp
index d507ad612c5..79d8afb1f99 100644
--- a/src/devices/bus/mc10/mcx128.cpp
+++ b/src/devices/bus/mc10/mcx128.cpp
@@ -72,7 +72,7 @@ protected:
// construction/destruction
mc10_pak_mcx128_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
- // device-level overrides
+ // device_t implementation
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_post_load() override;
diff --git a/src/devices/bus/mc10/pak.cpp b/src/devices/bus/mc10/pak.cpp
index 2d7be4aa07e..e6de96a7995 100644
--- a/src/devices/bus/mc10/pak.cpp
+++ b/src/devices/bus/mc10/pak.cpp
@@ -53,17 +53,17 @@ void mc10_pak_device::device_start()
}
//-------------------------------------------------
-// load - install rom region
+// load - install ROM region
//-------------------------------------------------
-std::error_condition mc10_pak_device::load()
+std::pair<std::error_condition, std::string> mc10_pak_device::load()
{
- // if the host has supplied a ROM space, install it
memory_region *const romregion(memregion("^rom"));
- if (romregion)
- owning_slot().memspace().install_rom(0x5000, 0x5000 + romregion->bytes(), romregion->base());
- else
- return image_error::INTERNAL;
+ if (!romregion)
+ return std::make_pair(image_error::BADSOFTWARE, "Software item lacks 'rom' data area");
+
+ // if the host has supplied a ROM space, install it
+ owning_slot().memspace().install_rom(0x5000, 0x5000 + romregion->bytes(), romregion->base());
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/mc10/pak.h b/src/devices/bus/mc10/pak.h
index 27d51615096..805eae0a2a0 100644
--- a/src/devices/bus/mc10/pak.h
+++ b/src/devices/bus/mc10/pak.h
@@ -22,7 +22,7 @@ public:
mc10_pak_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
virtual int max_rom_length() const override;
- virtual std::error_condition load() override;
+ virtual std::pair<std::error_condition, std::string> load() override;
protected:
mc10_pak_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
diff --git a/src/devices/bus/mc10/ram.cpp b/src/devices/bus/mc10/ram.cpp
index f6a6f488955..7f66e199d9a 100644
--- a/src/devices/bus/mc10/ram.cpp
+++ b/src/devices/bus/mc10/ram.cpp
@@ -34,7 +34,7 @@ namespace
mc10_pak_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
protected:
- // device-level overrides
+ // device_t implementation
virtual void device_start() override;
private:
memory_share_creator<u8> m_share;
diff --git a/src/devices/bus/megadrive/md_slot.cpp b/src/devices/bus/megadrive/md_slot.cpp
index 1052d07ba88..b21f6779398 100644
--- a/src/devices/bus/megadrive/md_slot.cpp
+++ b/src/devices/bus/megadrive/md_slot.cpp
@@ -309,7 +309,7 @@ static const char *md_get_slot(int type)
-------------------------------------------------*/
-std::error_condition base_md_cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> base_md_cart_slot_device::call_load()
{
if (m_cart)
{
@@ -344,10 +344,10 @@ std::error_condition base_md_cart_slot_device::call_load()
file_logging((uint8_t *)m_cart->get_rom_base(), m_cart->get_rom_size(), m_cart->get_nvram_size());
}
- return res;
+ return std::make_pair(res, std::string());
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/megadrive/md_slot.h b/src/devices/bus/megadrive/md_slot.h
index 86a031db9ed..020ebb0baed 100644
--- a/src/devices/bus/megadrive/md_slot.h
+++ b/src/devices/bus/megadrive/md_slot.h
@@ -157,7 +157,7 @@ public:
virtual ~base_md_cart_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/mononcol/slot.cpp b/src/devices/bus/mononcol/slot.cpp
index 171de417142..4a8015b54fd 100644
--- a/src/devices/bus/mononcol/slot.cpp
+++ b/src/devices/bus/mononcol/slot.cpp
@@ -62,23 +62,17 @@ void mononcol_cartslot_device::device_start()
call load
-------------------------------------------------*/
-std::error_condition mononcol_cartslot_device::call_load()
+std::pair<std::error_condition, std::string> mononcol_cartslot_device::call_load()
{
if (m_cart)
{
memory_region *romregion(loaded_through_softlist() ? memregion("rom") : nullptr);
if (loaded_through_softlist() && !romregion)
- {
- osd_printf_error("%s: Software list item has no 'rom' data area\n", basename());
- return image_error::BADSOFTWARE;
- }
+ return std::make_pair(image_error::BADSOFTWARE, "Software list item has no 'rom' data area");
const u32 len = loaded_through_softlist() ? get_software_region_length("rom") : length();
if (!len || ((len - 1) & len))
- {
- osd_printf_error("%s: Cartridge ROM size is not a power of 2\n", basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Cartridge ROM size is not a power of 2");
if (!loaded_through_softlist())
{
@@ -86,15 +80,12 @@ std::error_condition mononcol_cartslot_device::call_load()
romregion = machine().memory().region_alloc(subtag("rom"), len, 4, ENDIANNESS_LITTLE);
const u32 cnt = fread(romregion->base(), len);
if (cnt != len)
- {
- osd_printf_error("%s: Error reading cartridge file\n", basename());
- return image_error::UNSPECIFIED;
- }
+ return std::make_pair(image_error::UNSPECIFIED, "Error reading cartridge file");
}
m_cart->set_spi_region(romregion->base(), romregion->bytes());
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/mononcol/slot.h b/src/devices/bus/mononcol/slot.h
index bac80451532..f5a9922f25b 100644
--- a/src/devices/bus/mononcol/slot.h
+++ b/src/devices/bus/mononcol/slot.h
@@ -52,7 +52,7 @@ public:
virtual ~mononcol_cartslot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
virtual char const *image_interface() const noexcept override { return "monon_color_cart"; }
virtual char const *file_extensions() const noexcept override { return "bin"; }
diff --git a/src/devices/bus/msx/cart/beepack.cpp b/src/devices/bus/msx/cart/beepack.cpp
index 88314493c77..50623621e62 100644
--- a/src/devices/bus/msx/cart/beepack.cpp
+++ b/src/devices/bus/msx/cart/beepack.cpp
@@ -40,46 +40,34 @@ void msx_cart_beepack_device::device_add_mconfig(machine_config &config)
SOFTWARE_LIST(config, "bee_card_list").set_original("msx1_bee_card");
}
-std::error_condition msx_cart_beepack_device::call_load()
+std::pair<std::error_condition, std::string> msx_cart_beepack_device::call_load()
{
if (m_beecard)
{
if (loaded_through_softlist())
{
- u32 length = get_software_region_length("rom");
+ u32 const length = get_software_region_length("rom");
// Only 16KB or 32KB images are supported
if (length != 0x4000 && length != 0x8000)
- {
- osd_printf_error("%s: Invalid file size for a bee card\n", basename());
- return image_error::BADSOFTWARE;
- }
+ return std::make_pair(image_error::BADSOFTWARE, "Invalid file size for a bee card (must be 16K or 32K)");
}
else
{
- u32 length = this->length();
+ u32 const length = this->length();
// Only 16KB or 32KB images are supported
if (length != 0x4000 && length != 0x8000)
- {
- osd_printf_error("%s: Invalid file size for a bee card\n", basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::BADSOFTWARE, "Invalid file size for a bee card (must be 16K or 32K)");
memory_region *const romregion = machine().memory().region_alloc(subtag("rom"), length, 1, ENDIANNESS_LITTLE);
if (fread(romregion->base(), length) != length)
- {
- osd_printf_error("%s: Unable to fully read file\n", basename());
- return image_error::UNSPECIFIED;
- }
+ return std::make_pair(image_error::UNSPECIFIED, "Unable to fully read file");
}
std::string message;
std::error_condition result = m_beecard->initialize_cartridge(message);
- if (result)
- osd_printf_error("%s: %s\n", basename(), message);
-
- return result;
+ return std::make_pair(result, message);
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
std::string msx_cart_beepack_device::get_default_card_software(get_default_card_software_hook &hook) const
diff --git a/src/devices/bus/msx/cart/beepack.h b/src/devices/bus/msx/cart/beepack.h
index 3e5e963d1f2..e904c2c4458 100644
--- a/src/devices/bus/msx/cart/beepack.h
+++ b/src/devices/bus/msx/cart/beepack.h
@@ -23,7 +23,7 @@ public:
msx_cart_beepack_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
virtual const char *image_interface() const noexcept override { return "bee_card"; }
virtual const char *file_extensions() const noexcept override { return "bin,rom"; }
diff --git a/src/devices/bus/msx/cart/cartridge.cpp b/src/devices/bus/msx/cart/cartridge.cpp
index 3f7912c01d6..7731d8ba521 100644
--- a/src/devices/bus/msx/cart/cartridge.cpp
+++ b/src/devices/bus/msx/cart/cartridge.cpp
@@ -3,6 +3,7 @@
#include "emu.h"
#include "cartridge.h"
+
#include "arc.h"
#include "ascii.h"
#include "beepack.h"
@@ -30,8 +31,8 @@
#include "slotexpander.h"
#include "slotoptions.h"
#include "softcard.h"
-#include "superloderunner.h"
#include "super_swangi.h"
+#include "superloderunner.h"
#include "yamaha_ucn01.h"
#include "bus/msx/slot/cartridge.h"
diff --git a/src/devices/bus/msx/cart/softcard.cpp b/src/devices/bus/msx/cart/softcard.cpp
index 48db470909a..5a42f004ead 100644
--- a/src/devices/bus/msx/cart/softcard.cpp
+++ b/src/devices/bus/msx/cart/softcard.cpp
@@ -40,7 +40,7 @@ void msx_cart_softcard_device::device_add_mconfig(machine_config &config)
SOFTWARE_LIST(config, "softcard_list").set_original("msx_softcard");
}
-std::error_condition msx_cart_softcard_device::call_load()
+std::pair<std::error_condition, std::string> msx_cart_softcard_device::call_load()
{
if (m_softcard)
{
@@ -49,37 +49,25 @@ std::error_condition msx_cart_softcard_device::call_load()
u32 const length = get_software_region_length("rom");
// Only 32KB images are supported
if (length != 0x8000)
- {
- osd_printf_error("%s: Invalid file size for a softcard\n", basename());
- return image_error::BADSOFTWARE;
- }
+ return std::pair(image_error::BADSOFTWARE, "Invalid file size for a softcard (must be 32K)");
}
else
{
u32 const length = this->length();
// Only 32KB images are supported
if (length != 0x8000)
- {
- osd_printf_error("%s: Invalid file size for a softcard\n", basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::pair(image_error::BADSOFTWARE, "Invalid file size for a softcard (must be 32K)");
memory_region *const romregion = machine().memory().region_alloc(subtag("rom"), length, 1, ENDIANNESS_LITTLE);
if (fread(romregion->base(), length) != length)
- {
- osd_printf_error("%s: Unable to fully read file\n", basename());
- return image_error::UNSPECIFIED;
- }
+ return std::make_pair(image_error::UNSPECIFIED, "Unable to fully read file");
}
std::string message;
std::error_condition result = m_softcard->initialize_cartridge(message);
- if (result)
- osd_printf_error("%s: %s\n", basename(), message);
-
- return result;
+ return std::make_pair(result, message);
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
std::string msx_cart_softcard_device::get_default_card_software(get_default_card_software_hook &hook) const
diff --git a/src/devices/bus/msx/cart/softcard.h b/src/devices/bus/msx/cart/softcard.h
index 661f77bcaae..122d7cec7e1 100644
--- a/src/devices/bus/msx/cart/softcard.h
+++ b/src/devices/bus/msx/cart/softcard.h
@@ -23,7 +23,7 @@ public:
msx_cart_softcard_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
virtual const char *image_interface() const noexcept override { return "softcard"; }
virtual const char *file_extensions() const noexcept override { return "bin,rom"; }
diff --git a/src/devices/bus/msx/slot/cartridge.cpp b/src/devices/bus/msx/slot/cartridge.cpp
index 0703d3cc402..b2ef45dfc7f 100644
--- a/src/devices/bus/msx/slot/cartridge.cpp
+++ b/src/devices/bus/msx/slot/cartridge.cpp
@@ -32,13 +32,13 @@ void msx_slot_cartridge_base_device::device_start()
}
-std::error_condition msx_slot_cartridge_base_device::call_load()
+std::pair<std::error_condition, std::string> msx_slot_cartridge_base_device::call_load()
{
if (m_cartridge)
{
if (!loaded_through_softlist())
{
- u32 length = this->length();
+ u32 const length = this->length();
// determine how much space to allocate
u32 length_aligned = 0x10000;
@@ -59,26 +59,18 @@ std::error_condition msx_slot_cartridge_base_device::call_load()
memory_region *const romregion = machine().memory().region_alloc(subtag("rom"), length_aligned, 1, ENDIANNESS_LITTLE);
if (fread(romregion->base(), length) != length)
- {
- osd_printf_error("%s: Unable to fully read file\n", basename());
- return image_error::UNSPECIFIED;
- }
+ return std::make_pair(image_error::UNSPECIFIED, "Unable to fully read file");
}
std::string message;
std::error_condition result = m_cartridge->initialize_cartridge(message);
if (result)
- {
- osd_printf_error("%s: %s\n", basename(), message);
- return result;
- }
+ return std::make_pair(result, message);
if (m_cartridge->cart_sram_region())
- {
battery_load(m_cartridge->cart_sram_region()->base(), m_cartridge->cart_sram_region()->bytes(), 0x00);
- }
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/msx/slot/cartridge.h b/src/devices/bus/msx/slot/cartridge.h
index 85d8ddaa4a4..86846f9e374 100644
--- a/src/devices/bus/msx/slot/cartridge.h
+++ b/src/devices/bus/msx/slot/cartridge.h
@@ -51,7 +51,7 @@ class msx_slot_cartridge_base_device : public device_t
public:
auto irq_handler() { return m_irq_handler.bind(); }
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
virtual const char *image_interface() const noexcept override { return "msx_cart"; }
diff --git a/src/devices/bus/mtx/exp.cpp b/src/devices/bus/mtx/exp.cpp
index 8f5901b041e..9132ea385d7 100644
--- a/src/devices/bus/mtx/exp.cpp
+++ b/src/devices/bus/mtx/exp.cpp
@@ -89,17 +89,14 @@ void mtx_exp_slot_device::device_start()
// call_load
//-------------------------------------------------
-std::error_condition mtx_exp_slot_device::call_load()
+std::pair<std::error_condition, std::string> mtx_exp_slot_device::call_load()
{
if (m_card)
{
uint32_t const size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
if (size % 0x2000)
- {
- osd_printf_error("%s: Unsupported cartridge size\n", basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be a multiple of 8K)");
m_card->rom_alloc(size, tag());
@@ -109,7 +106,7 @@ std::error_condition mtx_exp_slot_device::call_load()
memcpy(m_card->get_rom_base(), get_software_region("rom"), size);
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/mtx/exp.h b/src/devices/bus/mtx/exp.h
index 62f0c33fbff..86a939f3205 100644
--- a/src/devices/bus/mtx/exp.h
+++ b/src/devices/bus/mtx/exp.h
@@ -60,7 +60,7 @@ protected:
virtual void device_start() override;
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
virtual const char *image_interface() const noexcept override { return "mtx_cart"; }
diff --git a/src/devices/bus/nabupc/adapter.cpp b/src/devices/bus/nabupc/adapter.cpp
index 5f2272be5c2..b1c499b4024 100644
--- a/src/devices/bus/nabupc/adapter.cpp
+++ b/src/devices/bus/nabupc/adapter.cpp
@@ -211,12 +211,12 @@ void network_adapter::postload()
}
}
-std::error_condition network_adapter::call_load()
+std::pair<std::error_condition, std::string> network_adapter::call_load()
{
if (is_filetype("pak")) {
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
- return image_error::INVALIDIMAGE;
+ return std::make_pair(image_error::INVALIDIMAGE, std::string());
}
//**************************************************************************
diff --git a/src/devices/bus/nabupc/adapter.h b/src/devices/bus/nabupc/adapter.h
index e311532b89d..6405fe6525d 100644
--- a/src/devices/bus/nabupc/adapter.h
+++ b/src/devices/bus/nabupc/adapter.h
@@ -43,7 +43,7 @@ public:
virtual const char *file_extensions() const noexcept override { return "pak"; }
virtual const char *image_type_name() const noexcept override { return "Segment Pak"; }
virtual const char *image_brief_type_name() const noexcept override { return "hcca"; }
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual DECLARE_WRITE_LINE_MEMBER(input_txd) override;
diff --git a/src/devices/bus/neogeo/slot.cpp b/src/devices/bus/neogeo/slot.cpp
index aff8ea99288..ce8fd3acf6e 100644
--- a/src/devices/bus/neogeo/slot.cpp
+++ b/src/devices/bus/neogeo/slot.cpp
@@ -224,7 +224,7 @@ void neogeo_cart_slot_device::set_cart_type(const char *slot)
call load
-------------------------------------------------*/
-std::error_condition neogeo_cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> neogeo_cart_slot_device::call_load()
{
if (m_cart)
{
@@ -306,7 +306,7 @@ std::error_condition neogeo_cart_slot_device::call_load()
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/neogeo/slot.h b/src/devices/bus/neogeo/slot.h
index c76e1d6f949..0b5fced8f80 100644
--- a/src/devices/bus/neogeo/slot.h
+++ b/src/devices/bus/neogeo/slot.h
@@ -204,7 +204,7 @@ public:
virtual ~neogeo_cart_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/nes/aladdin.cpp b/src/devices/bus/nes/aladdin.cpp
index 8bf8f0524d5..7965fb0bd54 100644
--- a/src/devices/bus/nes/aladdin.cpp
+++ b/src/devices/bus/nes/aladdin.cpp
@@ -93,19 +93,19 @@ uint8_t nes_aladdin_slot_device::read(offs_t offset)
}
// 128K for Dizzy The Adventurer, 256K for the others
-std::error_condition nes_aladdin_slot_device::call_load()
+std::pair<std::error_condition, std::string> nes_aladdin_slot_device::call_load()
{
if (m_cart)
{
uint8_t *const ROM = m_cart->get_cart_base();
if (!ROM)
- return image_error::INTERNAL;
+ return std::make_pair(image_error::INTERNAL, std::string());
uint32_t size;
if (!loaded_through_softlist())
{
if (length() != 0x20010 && length() != 0x40010)
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, std::string());
uint8_t temp[0x40010];
size = length() - 0x10;
@@ -116,13 +116,17 @@ std::error_condition nes_aladdin_slot_device::call_load()
uint8_t mapper = (temp[6] & 0xf0) >> 4;
mapper |= temp[7] & 0xf0;
if (mapper != 71 && mapper != 232)
- return image_error::INVALIDIMAGE;
+ {
+ return std::make_pair(
+ image_error::INVALIDIMAGE,
+ util::string_format("Unsupported iNES mapper %u (must be 71 or 232)", mapper));
+ }
}
else
{
size = get_software_region_length("rom");
if (size != 0x2'0000 && size != 0x4'0000)
- return image_error::BADSOFTWARE;
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be 128K or 256K)");
memcpy(ROM, get_software_region("rom"), size);
}
@@ -130,7 +134,7 @@ std::error_condition nes_aladdin_slot_device::call_load()
m_cart->set_cart_size(size);
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/nes/aladdin.h b/src/devices/bus/nes/aladdin.h
index 80001945fab..06203ea1a6d 100644
--- a/src/devices/bus/nes/aladdin.h
+++ b/src/devices/bus/nes/aladdin.h
@@ -64,7 +64,7 @@ public:
virtual ~nes_aladdin_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
virtual const char *image_interface() const noexcept override { return "ade_cart"; }
diff --git a/src/devices/bus/nes/datach.cpp b/src/devices/bus/nes/datach.cpp
index 25261ed2d38..5fe8ba5f2f9 100644
--- a/src/devices/bus/nes/datach.cpp
+++ b/src/devices/bus/nes/datach.cpp
@@ -92,19 +92,19 @@ uint8_t nes_datach_slot_device::read(offs_t offset)
return 0xff;
}
-std::error_condition nes_datach_slot_device::call_load()
+std::pair<std::error_condition, std::string> nes_datach_slot_device::call_load()
{
if (m_cart)
{
uint8_t *const ROM = m_cart->get_cart_base();
if (!ROM)
- return image_error::INTERNAL;
+ return std::make_pair(image_error::INTERNAL, std::string());
// Existing Datach carts are all 256K, so we only load files of this size
if (!loaded_through_softlist())
{
if (length() != 0x40000 && length() != 0x40010)
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, std::string());
int shift = length() - 0x40000;
uint8_t temp[0x40010];
@@ -119,20 +119,22 @@ std::error_condition nes_datach_slot_device::call_load()
mapper |= temp[7] & 0xf0;
if (mapper != 157 && mapper != 16)
{
- return image_error::INVALIDIMAGE;
+ return std::make_pair(
+ image_error::INVALIDIMAGE,
+ util::string_format("Unsupported iNES mapper %u (must be 16 or 157)", mapper));
}
}
}
else
{
if (get_software_region_length("rom") != 0x40000)
- return image_error::BADSOFTWARE;
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be 256K)");
memcpy(ROM, get_software_region("rom"), 0x40000);
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/nes/datach.h b/src/devices/bus/nes/datach.h
index 28f50206012..e9e42379948 100644
--- a/src/devices/bus/nes/datach.h
+++ b/src/devices/bus/nes/datach.h
@@ -65,7 +65,7 @@ public:
virtual ~nes_datach_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
virtual const char *image_interface() const noexcept override { return "datach_cart"; }
diff --git a/src/devices/bus/nes/karastudio.cpp b/src/devices/bus/nes/karastudio.cpp
index 4d323bd9251..402f803cf48 100644
--- a/src/devices/bus/nes/karastudio.cpp
+++ b/src/devices/bus/nes/karastudio.cpp
@@ -96,32 +96,32 @@ uint8_t nes_kstudio_slot_device::read(offs_t offset)
return 0xff;
}
-std::error_condition nes_kstudio_slot_device::call_load()
+std::pair<std::error_condition, std::string> nes_kstudio_slot_device::call_load()
{
if (m_cart)
{
uint8_t *const ROM = m_cart->get_cart_base();
if (!ROM)
- return image_error::INTERNAL;
+ return std::make_pair(image_error::INTERNAL, std::string());
// Existing expansion carts are all 128K, so we only load files of this size
if (!loaded_through_softlist())
{
if (length() != 0x20000)
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be 128K)");
fread(ROM, 0x20000);
}
else
{
if (get_software_region_length("rom") != 0x20000)
- return image_error::BADSOFTWARE;
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be 128K)");
memcpy(ROM, get_software_region("rom"), 0x20000);
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/nes/karastudio.h b/src/devices/bus/nes/karastudio.h
index 0375e09cb96..1a1b1cf2132 100644
--- a/src/devices/bus/nes/karastudio.h
+++ b/src/devices/bus/nes/karastudio.h
@@ -63,7 +63,7 @@ public:
virtual ~nes_kstudio_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
virtual const char *image_interface() const noexcept override { return "ks_cart"; }
diff --git a/src/devices/bus/nes/nes_slot.cpp b/src/devices/bus/nes/nes_slot.cpp
index 1c930ba23aa..0bd4784d653 100644
--- a/src/devices/bus/nes/nes_slot.cpp
+++ b/src/devices/bus/nes/nes_slot.cpp
@@ -725,7 +725,7 @@ void nes_cart_slot_device::pcb_reset()
#include "nes_ines.hxx"
-std::error_condition nes_cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> nes_cart_slot_device::call_load()
{
if (m_cart)
{
@@ -740,34 +740,27 @@ std::error_condition nes_cart_slot_device::call_load()
if ((magic[0] == 'N') && (magic[1] == 'E') && (magic[2] == 'S')) // If header starts with 'NES' it is iNES
{
if (length() <= 0x10)
- {
- osd_printf_error("%s only contains the iNES header and no data.\n", filename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "File contains iNES header with no data");
call_load_ines();
}
else if ((magic[0] == 'U') && (magic[1] == 'N') && (magic[2] == 'I') && (magic[3] == 'F')) // If header starts with 'UNIF' it is UNIF
{
if (length() <= 0x20)
- {
- osd_printf_error("%s only contains the UNIF header and no data.\n", filename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "File contains UNIF header with no data");
call_load_unif();
}
else
{
- osd_printf_error("%s is NOT a file in either iNES or UNIF format.\n", filename());
- return image_error::INVALIDIMAGE;
+ return std::make_pair(image_error::INVALIDIMAGE, "File is not an iNES or UNIF cartridge image");
}
}
else
call_load_pcb();
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/nes/nes_slot.h b/src/devices/bus/nes/nes_slot.h
index 3a49c942ab9..c9a54e685b1 100644
--- a/src/devices/bus/nes/nes_slot.h
+++ b/src/devices/bus/nes/nes_slot.h
@@ -399,7 +399,7 @@ public:
virtual ~nes_cart_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/nes/sunsoft_dcs.cpp b/src/devices/bus/nes/sunsoft_dcs.cpp
index 8c3f2e87dd4..89bbcdbb915 100644
--- a/src/devices/bus/nes/sunsoft_dcs.cpp
+++ b/src/devices/bus/nes/sunsoft_dcs.cpp
@@ -77,31 +77,31 @@ uint8_t nes_ntb_slot_device::read(offs_t offset)
}
-std::error_condition nes_ntb_slot_device::call_load()
+std::pair<std::error_condition, std::string> nes_ntb_slot_device::call_load()
{
if (m_cart)
{
uint8_t *const ROM = m_cart->get_cart_base();
if (!ROM)
- return image_error::INTERNAL;
+ return std::make_pair(image_error::INTERNAL, std::string());
if (!loaded_through_softlist())
{
if (length() != 0x4000)
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be 16K)");
fread(ROM, 0x4000);
}
else
{
if (get_software_region_length("rom") != 0x4000)
- return image_error::BADSOFTWARE;
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be 16K)");
memcpy(ROM, get_software_region("rom"), 0x4000);
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/nes/sunsoft_dcs.h b/src/devices/bus/nes/sunsoft_dcs.h
index 0ad551776a8..bb98c1f8081 100644
--- a/src/devices/bus/nes/sunsoft_dcs.h
+++ b/src/devices/bus/nes/sunsoft_dcs.h
@@ -60,7 +60,7 @@ public:
virtual ~nes_ntb_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
virtual const char *image_interface() const noexcept override { return "ntb_cart"; }
diff --git a/src/devices/bus/nubus/nubus_image.cpp b/src/devices/bus/nubus/nubus_image.cpp
index 2fd9a2ae87c..3d17b2500a1 100644
--- a/src/devices/bus/nubus/nubus_image.cpp
+++ b/src/devices/bus/nubus/nubus_image.cpp
@@ -49,7 +49,7 @@ public:
virtual const char *image_type_name() const noexcept override { return "disk"; }
virtual const char *image_brief_type_name() const noexcept override { return "disk"; }
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
protected:
@@ -89,25 +89,24 @@ void nubus_image_device::messimg_disk_image_device::device_start()
}
}
-std::error_condition nubus_image_device::messimg_disk_image_device::call_load()
+std::pair<std::error_condition, std::string> nubus_image_device::messimg_disk_image_device::call_load()
{
m_size = length();
if (m_size > (256*1024*1024))
{
- osd_printf_error("Mac image too large: must be 256MB or less!\n");
m_size = 0;
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, "Image file is too large (must be no more than 256MB)");
}
m_data.reset(new (std::nothrow) uint8_t [m_size]);
if (!m_data)
- return std::errc::not_enough_memory;
+ return std::make_pair(std::errc::not_enough_memory, "Error allocating memory for volume image");
fseek(0, SEEK_SET);
fread(m_data.get(), m_size);
m_ejected = false;
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void nubus_image_device::messimg_disk_image_device::call_unload()
diff --git a/src/devices/bus/odyssey2/slot.cpp b/src/devices/bus/odyssey2/slot.cpp
index d735bb1ec8e..af0d801a361 100644
--- a/src/devices/bus/odyssey2/slot.cpp
+++ b/src/devices/bus/odyssey2/slot.cpp
@@ -130,7 +130,7 @@ static const char *o2_get_slot(int type)
call load
-------------------------------------------------*/
-std::error_condition o2_cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> o2_cart_slot_device::call_load()
{
if (m_cart)
{
@@ -166,11 +166,11 @@ std::error_condition o2_cart_slot_device::call_load()
if (m_cart->get_rom_size() > 0)
{
m_cart->cart_init();
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
}
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
}
diff --git a/src/devices/bus/odyssey2/slot.h b/src/devices/bus/odyssey2/slot.h
index 48bece68d9e..c8ed18523d7 100644
--- a/src/devices/bus/odyssey2/slot.h
+++ b/src/devices/bus/odyssey2/slot.h
@@ -113,7 +113,7 @@ public:
virtual ~o2_cart_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override { }
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/pce/pce_slot.cpp b/src/devices/bus/pce/pce_slot.cpp
index fa50ac5bba7..5da567d4931 100644
--- a/src/devices/bus/pce/pce_slot.cpp
+++ b/src/devices/bus/pce/pce_slot.cpp
@@ -210,7 +210,7 @@ static const char *pce_get_slot(int type)
call load
-------------------------------------------------*/
-std::error_condition pce_cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> pce_cart_slot_device::call_load()
{
if (m_cart)
{
@@ -264,7 +264,7 @@ std::error_condition pce_cart_slot_device::call_load()
m_cart->ram_alloc(0x30000);
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/pce/pce_slot.h b/src/devices/bus/pce/pce_slot.h
index 648d138ac0d..c78c1f536ad 100644
--- a/src/devices/bus/pce/pce_slot.h
+++ b/src/devices/bus/pce/pce_slot.h
@@ -81,7 +81,7 @@ public:
virtual ~pce_cart_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/plus4/exp.cpp b/src/devices/bus/plus4/exp.cpp
index 55eb589032c..1bbd9867f97 100644
--- a/src/devices/bus/plus4/exp.cpp
+++ b/src/devices/bus/plus4/exp.cpp
@@ -97,13 +97,14 @@ void plus4_expansion_slot_device::device_start()
// call_load -
//-------------------------------------------------
-std::error_condition plus4_expansion_slot_device::call_load()
+std::pair<std::error_condition, std::string> plus4_expansion_slot_device::call_load()
{
if (m_card)
{
if (!loaded_through_softlist())
{
// TODO
+ return std::make_pair(image_error::UNSUPPORTED, "Plus/4 Expansion software must be loaded from the software list");
}
else
{
@@ -117,14 +118,11 @@ std::error_condition plus4_expansion_slot_device::call_load()
m_card->m_c2h_size = get_software_region_length("c2h");
if ((m_card->m_c1l_size & (m_card->m_c1l_size - 1)) || (m_card->m_c1h_size & (m_card->m_c1h_size - 1)) || (m_card->m_c2l_size & (m_card->m_c2l_size - 1)) || (m_card->m_c2h_size & (m_card->m_c2h_size - 1)))
- {
- osd_printf_error("%s: ROM size must be power of 2\n", basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "All ROM sizes must be powers of 2");
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/plus4/exp.h b/src/devices/bus/plus4/exp.h
index bc895af0a18..93202068651 100644
--- a/src/devices/bus/plus4/exp.h
+++ b/src/devices/bus/plus4/exp.h
@@ -88,7 +88,7 @@ protected:
virtual void device_start() override;
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
virtual const char *image_interface() const noexcept override { return "plus4_cart"; }
diff --git a/src/devices/bus/pofo/ccm.cpp b/src/devices/bus/pofo/ccm.cpp
index 50bbb0e9384..bd86c5eecfa 100644
--- a/src/devices/bus/pofo/ccm.cpp
+++ b/src/devices/bus/pofo/ccm.cpp
@@ -68,7 +68,7 @@ void portfolio_memory_card_slot_device::device_start()
// call_load -
//-------------------------------------------------
-std::error_condition portfolio_memory_card_slot_device::call_load()
+std::pair<std::error_condition, std::string> portfolio_memory_card_slot_device::call_load()
{
if (m_card)
{
@@ -78,7 +78,7 @@ std::error_condition portfolio_memory_card_slot_device::call_load()
load_software_region("rom", m_card->m_rom);
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/pofo/ccm.h b/src/devices/bus/pofo/ccm.h
index d82d46300d8..317884c8ce2 100644
--- a/src/devices/bus/pofo/ccm.h
+++ b/src/devices/bus/pofo/ccm.h
@@ -119,7 +119,7 @@ protected:
virtual void device_start() override;
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual const software_list_loader &get_software_list_loader() const override;
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/psx/memcard.cpp b/src/devices/bus/psx/memcard.cpp
index e6b8e693bb4..927f52688d4 100644
--- a/src/devices/bus/psx/memcard.cpp
+++ b/src/devices/bus/psx/memcard.cpp
@@ -295,26 +295,24 @@ unsigned char psxcard_device::checksum_data(const unsigned char *buf, const unsi
return chk;
}
-std::error_condition psxcard_device::call_load()
+std::pair<std::error_condition, std::string> psxcard_device::call_load()
{
if(m_disabled)
- {
- logerror("psxcard: port disabled\n");
- return image_error::UNSUPPORTED;
- }
+ return std::make_pair(image_error::UNSUPPORTED, "Memory card port is disabled");
if(length() != card_size)
- return image_error::INVALIDLENGTH;
- return std::error_condition();
+ {
+ return std::make_pair(
+ image_error::INVALIDLENGTH,
+ util::string_format("Unsupported memory card size (must be %u bytes)", card_size));
+ }
+ return std::make_pair(std::error_condition(), std::string());
}
-std::error_condition psxcard_device::call_create(int format_type, util::option_resolution *format_options)
+std::pair<std::error_condition, std::string> psxcard_device::call_create(int format_type, util::option_resolution *format_options)
{
if(m_disabled)
- {
- logerror("psxcard: port disabled\n");
- return image_error::UNSUPPORTED;
- }
+ return std::make_pair(image_error::UNSUPPORTED, "Memory card port is disabled");
uint8_t block[block_size];
memset(block, '\0', block_size);
@@ -322,9 +320,9 @@ std::error_condition psxcard_device::call_create(int format_type, util::option_r
{
auto const ret = fwrite(block, block_size);
if(ret != block_size)
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void psxcard_device::do_card()
diff --git a/src/devices/bus/psx/memcard.h b/src/devices/bus/psx/memcard.h
index a8a28081b88..557800cb4d8 100644
--- a/src/devices/bus/psx/memcard.h
+++ b/src/devices/bus/psx/memcard.h
@@ -20,8 +20,8 @@ public:
virtual bool is_reset_on_load() const noexcept override { return false; }
virtual const char *file_extensions() const noexcept override { return "mc"; }
- virtual std::error_condition call_load() override;
- virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_create(int format_type, util::option_resolution *format_options) override;
void disable(bool state) { m_disabled = state; if(state) unload(); }
diff --git a/src/devices/bus/qbus/pc11.cpp b/src/devices/bus/qbus/pc11.cpp
index b812a155c47..a12a5b564c3 100644
--- a/src/devices/bus/qbus/pc11.cpp
+++ b/src/devices/bus/qbus/pc11.cpp
@@ -136,7 +136,7 @@ void pc11_device::z80daisy_irq_reti()
}
-std::error_condition pc11_device::call_load()
+std::pair<std::error_condition, std::string> pc11_device::call_load()
{
/* reader unit */
m_fd = this;
@@ -144,7 +144,7 @@ std::error_condition pc11_device::call_load()
LOG("call_load filename %s is_open %d\n", m_fd->filename(), m_fd->is_open());
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void pc11_device::call_unload()
diff --git a/src/devices/bus/qbus/pc11.h b/src/devices/bus/qbus/pc11.h
index 917a49388bb..2247fb54f72 100644
--- a/src/devices/bus/qbus/pc11.h
+++ b/src/devices/bus/qbus/pc11.h
@@ -40,7 +40,7 @@ public:
virtual const char *image_interface() const noexcept override { return "pdp11_ptap"; }
virtual const char *file_extensions() const noexcept override { return "bin,bim,lda"; }
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
uint16_t read(offs_t offset);
diff --git a/src/devices/bus/ql/rom.cpp b/src/devices/bus/ql/rom.cpp
index 3d73fbb9698..82af5a35a4a 100644
--- a/src/devices/bus/ql/rom.cpp
+++ b/src/devices/bus/ql/rom.cpp
@@ -85,7 +85,7 @@ void ql_rom_cartridge_slot_device::device_start()
// call_load -
//-------------------------------------------------
-std::error_condition ql_rom_cartridge_slot_device::call_load()
+std::pair<std::error_condition, std::string> ql_rom_cartridge_slot_device::call_load()
{
if (m_card)
{
@@ -99,7 +99,7 @@ std::error_condition ql_rom_cartridge_slot_device::call_load()
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/ql/rom.h b/src/devices/bus/ql/rom.h
index ec56cbcaccc..bb70e2f3969 100644
--- a/src/devices/bus/ql/rom.h
+++ b/src/devices/bus/ql/rom.h
@@ -96,7 +96,7 @@ protected:
virtual void device_start() override;
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
virtual const char *image_interface() const noexcept override { return "ql_cart"; }
diff --git a/src/devices/bus/saturn/sat_slot.cpp b/src/devices/bus/saturn/sat_slot.cpp
index c5959bde1f7..34a329b47ef 100644
--- a/src/devices/bus/saturn/sat_slot.cpp
+++ b/src/devices/bus/saturn/sat_slot.cpp
@@ -135,7 +135,7 @@ void sat_cart_slot_device::device_start()
-------------------------------------------------*/
-std::error_condition sat_cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> sat_cart_slot_device::call_load()
{
if (m_cart)
{
@@ -170,7 +170,7 @@ std::error_condition sat_cart_slot_device::call_load()
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/saturn/sat_slot.h b/src/devices/bus/saturn/sat_slot.h
index fcf721c47e2..eff07096f79 100644
--- a/src/devices/bus/saturn/sat_slot.h
+++ b/src/devices/bus/saturn/sat_slot.h
@@ -80,7 +80,7 @@ public:
virtual ~sat_cart_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/scv/slot.cpp b/src/devices/bus/scv/slot.cpp
index c312e6bfb7a..897bb42065b 100644
--- a/src/devices/bus/scv/slot.cpp
+++ b/src/devices/bus/scv/slot.cpp
@@ -147,7 +147,7 @@ static const char *scv_get_slot(int type)
call load
-------------------------------------------------*/
-std::error_condition scv_cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> scv_cart_slot_device::call_load()
{
if (m_cart)
{
@@ -155,10 +155,7 @@ std::error_condition scv_cart_slot_device::call_load()
bool const has_ram = loaded_through_softlist() && get_software_region("ram");
if (len > 0x20000)
- {
- osd_printf_error("%s: Unsupported cartridge size\n", basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be no more than 128K)");
m_cart->rom_alloc(len);
if (has_ram)
@@ -190,7 +187,7 @@ std::error_condition scv_cart_slot_device::call_load()
//printf("Type: %s\n", scv_get_slot(m_type));
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/scv/slot.h b/src/devices/bus/scv/slot.h
index 94ad9c95e47..1836a517cdb 100644
--- a/src/devices/bus/scv/slot.h
+++ b/src/devices/bus/scv/slot.h
@@ -80,7 +80,7 @@ public:
virtual ~scv_cart_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override { }
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/sdk85/memexp.cpp b/src/devices/bus/sdk85/memexp.cpp
index 74908bcc00e..58a05e2fc88 100644
--- a/src/devices/bus/sdk85/memexp.cpp
+++ b/src/devices/bus/sdk85/memexp.cpp
@@ -22,14 +22,14 @@ sdk85_romexp_device::sdk85_romexp_device(const machine_config &mconfig, const ch
{
}
-std::error_condition sdk85_romexp_device::call_load()
+std::pair<std::error_condition, std::string> sdk85_romexp_device::call_load()
{
if (get_card_device())
{
u32 const size = loaded_through_softlist() ? get_software_region_length("rom") : length();
u8 *const base = get_card_device()->get_rom_base(size);
if (!base)
- return image_error::INTERNAL;
+ return std::make_pair(image_error::INTERNAL, std::string());
if (loaded_through_softlist())
memcpy(base, get_software_region("rom"), size);
@@ -37,7 +37,7 @@ std::error_condition sdk85_romexp_device::call_load()
fread(base, size);
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
std::string sdk85_romexp_device::get_default_card_software(get_default_card_software_hook &hook) const
diff --git a/src/devices/bus/sdk85/memexp.h b/src/devices/bus/sdk85/memexp.h
index 5fa9c6153ba..1c82d1dc807 100644
--- a/src/devices/bus/sdk85/memexp.h
+++ b/src/devices/bus/sdk85/memexp.h
@@ -56,7 +56,7 @@ protected:
virtual void device_start() override;
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override { }
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/sega8/sega8_slot.cpp b/src/devices/bus/sega8/sega8_slot.cpp
index 5e53142a8f3..0201b9051cb 100644
--- a/src/devices/bus/sega8/sega8_slot.cpp
+++ b/src/devices/bus/sega8/sega8_slot.cpp
@@ -390,17 +390,14 @@ void sega8_cart_slot_device::setup_ram()
}
}
-std::error_condition sega8_cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> sega8_cart_slot_device::call_load()
{
if (m_cart)
{
uint32_t len = !loaded_through_softlist() ? length() : get_software_region_length("rom");
if (m_is_card && len > 0x8000)
- {
- osd_printf_error("%s: Attempted loading a card larger than 32KB\n", basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Sega Card images must be no larger than 32K");
// check for header
uint32_t offset = 0;
@@ -456,7 +453,7 @@ std::error_condition sega8_cart_slot_device::call_load()
internal_header_logging(ROM + offset, len, m_cart->get_ram_size());
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/sega8/sega8_slot.h b/src/devices/bus/sega8/sega8_slot.h
index a1293ca2a2e..490b2ba31a6 100644
--- a/src/devices/bus/sega8/sega8_slot.h
+++ b/src/devices/bus/sega8/sega8_slot.h
@@ -117,7 +117,7 @@ public:
virtual ~sega8_cart_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/snes/snes_slot.cpp b/src/devices/bus/snes/snes_slot.cpp
index 9517edc61dd..050581aadcb 100644
--- a/src/devices/bus/snes/snes_slot.cpp
+++ b/src/devices/bus/snes/snes_slot.cpp
@@ -649,7 +649,7 @@ static int snes_find_addon_chip(const uint8_t *buffer, uint32_t start_offs, uint
-------------------------------------------------*/
-std::error_condition base_sns_cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> base_sns_cart_slot_device::call_load()
{
if (m_cart)
{
@@ -725,7 +725,7 @@ std::error_condition base_sns_cart_slot_device::call_load()
internal_header_logging(ROM, len);
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/snes/snes_slot.h b/src/devices/bus/snes/snes_slot.h
index 3bde7ffc8e7..477259343ef 100644
--- a/src/devices/bus/snes/snes_slot.h
+++ b/src/devices/bus/snes/snes_slot.h
@@ -178,7 +178,7 @@ public:
void set_address(offs_t address) { m_address = address; }
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/spectrum/intf2.cpp b/src/devices/bus/spectrum/intf2.cpp
index 01ac201433e..d17bbd49c8d 100644
--- a/src/devices/bus/spectrum/intf2.cpp
+++ b/src/devices/bus/spectrum/intf2.cpp
@@ -99,15 +99,12 @@ DEVICE_IMAGE_LOAD_MEMBER(spectrum_intf2_device::cart_load)
uint32_t const size = m_cart->common_get_size("rom");
if (size != 0x4000)
- {
- osd_printf_error("%s: Unsupported cartridge size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (only 16K supported)");
m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
READ_LINE_MEMBER(spectrum_intf2_device::romcs)
diff --git a/src/devices/bus/ti99/gromport/cartridges.cpp b/src/devices/bus/ti99/gromport/cartridges.cpp
index eac2577e21a..31afbda2e6c 100644
--- a/src/devices/bus/ti99/gromport/cartridges.cpp
+++ b/src/devices/bus/ti99/gromport/cartridges.cpp
@@ -271,7 +271,7 @@ int ti99_cartridge_device::get_index_from_tagname()
return atoi(mytag+i+1)-1;
}
-std::error_condition ti99_cartridge_device::call_load()
+std::pair<std::error_condition, std::string> ti99_cartridge_device::call_load()
{
// File name is in m_basename
LOGMASKED(LOG_CHANGE, "Loading %s in slot %s\n", basename());
@@ -303,7 +303,7 @@ std::error_condition ti99_cartridge_device::call_load()
{
LOGMASKED(LOG_WARN, "Failed to load cartridge '%s': %s\n", basename(), err.message().c_str());
m_rpk.reset();
- return err;
+ return std::make_pair(err, std::string());
}
m_pcbtype = m_rpk->get_type();
}
@@ -365,7 +365,7 @@ std::error_condition ti99_cartridge_device::call_load()
m_pcb->set_tag(tag());
m_slot = get_index_from_tagname();
m_connector->insert(m_slot, this);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void ti99_cartridge_device::call_unload()
diff --git a/src/devices/bus/ti99/gromport/cartridges.h b/src/devices/bus/ti99/gromport/cartridges.h
index 00aba4d3797..2c93b7281b7 100644
--- a/src/devices/bus/ti99/gromport/cartridges.h
+++ b/src/devices/bus/ti99/gromport/cartridges.h
@@ -51,7 +51,7 @@ protected:
virtual const tiny_rom_entry* device_rom_region() const override;
// Image handling: implementation of methods which are abstract in the parent
- std::error_condition call_load() override;
+ std::pair<std::error_condition, std::string> call_load() override;
void call_unload() override;
void prepare_cartridge();
diff --git a/src/devices/bus/ti99/peb/ti_rs232.cpp b/src/devices/bus/ti99/peb/ti_rs232.cpp
index aa74804b1a0..5f854c4fab2 100644
--- a/src/devices/bus/ti99/peb/ti_rs232.cpp
+++ b/src/devices/bus/ti99/peb/ti_rs232.cpp
@@ -186,14 +186,14 @@ ti_pio_attached_device::ti_pio_attached_device(const machine_config &mconfig, co
/*
Initialize rs232 unit and open image
*/
-std::error_condition ti_rs232_attached_device::call_load()
+std::pair<std::error_condition, std::string> ti_rs232_attached_device::call_load()
{
m_uart->set_clock(true);
// The following line may cause trouble in the init phase
// card->incoming_dtr(devnumber, (m_file!=nullptr)? ASSERT_LINE : CLEAR_LINE);
- return std::error_condition(); // OK
+ return std::make_pair(std::error_condition(), std::string()); // OK
}
void ti_rs232_attached_device::call_unload()
@@ -204,7 +204,7 @@ void ti_rs232_attached_device::call_unload()
/*
Initialize pio unit and open image
*/
-std::error_condition ti_pio_attached_device::call_load()
+std::pair<std::error_condition, std::string> ti_pio_attached_device::call_load()
{
ti_rs232_pio_device* card = static_cast<ti_rs232_pio_device*>(owner());
@@ -218,7 +218,7 @@ std::error_condition ti_pio_attached_device::call_load()
else
card->m_pio_handshakein = true;
- return std::error_condition(); // OK
+ return std::make_pair(std::error_condition(), std::string()); // OK
}
/*
diff --git a/src/devices/bus/ti99/peb/ti_rs232.h b/src/devices/bus/ti99/peb/ti_rs232.h
index 43d04013b64..8e304938fd0 100644
--- a/src/devices/bus/ti99/peb/ti_rs232.h
+++ b/src/devices/bus/ti99/peb/ti_rs232.h
@@ -146,7 +146,7 @@ public:
protected:
void device_start() override { }
- std::error_condition call_load() override;
+ std::pair<std::error_condition, std::string> call_load() override;
void call_unload() override;
private:
@@ -174,7 +174,7 @@ public:
protected:
void device_start() override { }
- std::error_condition call_load() override;
+ std::pair<std::error_condition, std::string> call_load() override;
void call_unload() override;
};
diff --git a/src/devices/bus/ti99/peb/tipi.cpp b/src/devices/bus/ti99/peb/tipi.cpp
index 61ad7b61e12..65b3b44ca7e 100644
--- a/src/devices/bus/ti99/peb/tipi.cpp
+++ b/src/devices/bus/ti99/peb/tipi.cpp
@@ -675,9 +675,9 @@ tipi_attached_device::tipi_attached_device(const machine_config &mconfig, const
/*
Initialize connection
*/
-std::error_condition tipi_attached_device::call_load()
+std::pair<std::error_condition, std::string> tipi_attached_device::call_load()
{
- return std::error_condition(); // OK
+ return std::make_pair(std::error_condition(), std::string()); // OK
}
void tipi_attached_device::call_unload()
diff --git a/src/devices/bus/ti99/peb/tipi.h b/src/devices/bus/ti99/peb/tipi.h
index 814a0f435ce..20c978638f4 100644
--- a/src/devices/bus/ti99/peb/tipi.h
+++ b/src/devices/bus/ti99/peb/tipi.h
@@ -116,7 +116,7 @@ public:
protected:
void device_start() override { }
void call_unload() override;
- std::error_condition call_load() override;
+ std::pair<std::error_condition, std::string> call_load() override;
};
diff --git a/src/devices/bus/ti99x/990_tap.cpp b/src/devices/bus/ti99x/990_tap.cpp
index be4cc7beb97..88029455f33 100644
--- a/src/devices/bus/ti99x/990_tap.cpp
+++ b/src/devices/bus/ti99x/990_tap.cpp
@@ -898,7 +898,7 @@ public:
// device_image_interface implementation
virtual const char *file_extensions() const noexcept override { return "tap"; }
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
protected:
@@ -935,12 +935,12 @@ int ti990_tape_image_device::tape_get_id()
/*
Open a tape image
*/
-std::error_condition ti990_tape_image_device::call_load()
+std::pair<std::error_condition, std::string> ti990_tape_image_device::call_load()
{
tap_990_device* tpc = downcast<tap_990_device*>(owner());
tpc->set_tape(tape_get_id(), this, true, false, is_readonly());
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
/*
diff --git a/src/devices/bus/ti99x/990_tap.h b/src/devices/bus/ti99x/990_tap.h
index 00168cd896b..26ee8edbef6 100644
--- a/src/devices/bus/ti99x/990_tap.h
+++ b/src/devices/bus/ti99x/990_tap.h
@@ -30,7 +30,7 @@ public:
auto int_cb() { return m_int_line.bind(); }
protected:
- // device-level overrides
+ // device_t implementation
virtual void device_start() override;
virtual void device_add_mconfig(machine_config &config) override;
diff --git a/src/devices/bus/vboy/slot.cpp b/src/devices/bus/vboy/slot.cpp
index 6b71c47f162..4cd783409c2 100644
--- a/src/devices/bus/vboy/slot.cpp
+++ b/src/devices/bus/vboy/slot.cpp
@@ -49,24 +49,18 @@ vboy_cart_slot_device::vboy_cart_slot_device(machine_config const &mconfig, char
}
-std::error_condition vboy_cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> vboy_cart_slot_device::call_load()
{
if (!m_cart)
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
memory_region *romregion(loaded_through_softlist() ? memregion("rom") : nullptr);
if (loaded_through_softlist() && !romregion)
- {
- osd_printf_error("%s: Software list item has no 'rom' data area\n", basename());
- return image_error::BADSOFTWARE;
- }
+ return std::make_pair(image_error::BADSOFTWARE, "Software list item has no 'rom' data area");
u32 const len(loaded_through_softlist() ? romregion->bytes() : length());
if ((0x0000'0003 & len) || (0x0100'0000 < len))
- {
- osd_printf_error("%s: Unsupported cartridge size (must be a multiple of 4 bytes no larger than 16 MiB)\n", basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be a multiple of 4 bytes no larger than 16 MiB)");
if (!loaded_through_softlist())
{
@@ -74,13 +68,10 @@ std::error_condition vboy_cart_slot_device::call_load()
romregion = machine().memory().region_alloc(subtag("rom"), len, 4, ENDIANNESS_LITTLE);
u32 const cnt(fread(romregion->base(), len));
if (cnt != len)
- {
- osd_printf_error("%s: Error reading cartridge file\n", basename());
- return image_error::UNSPECIFIED;
- }
+ return std::make_pair(image_error::UNSPECIFIED, "Error reading cartridge file");
}
- return m_cart->load();
+ return std::make_pair(m_cart->load(), std::string());
}
diff --git a/src/devices/bus/vboy/slot.h b/src/devices/bus/vboy/slot.h
index 267264ce113..3b3b7979878 100644
--- a/src/devices/bus/vboy/slot.h
+++ b/src/devices/bus/vboy/slot.h
@@ -105,7 +105,7 @@ public:
template <typename T> void set_rom(T &&tag, int no, offs_t base) { m_rom_space.set_tag(std::forward<T>(tag), no); m_rom_base = base; }
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
virtual char const *image_interface() const noexcept override { return "vboy_cart"; }
diff --git a/src/devices/bus/vc4000/slot.cpp b/src/devices/bus/vc4000/slot.cpp
index d7077325a8d..ac0d7ce2de7 100644
--- a/src/devices/bus/vc4000/slot.cpp
+++ b/src/devices/bus/vc4000/slot.cpp
@@ -168,17 +168,14 @@ static const char *vc4000_get_slot(int type)
call load
-------------------------------------------------*/
-std::error_condition vc4000_cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> vc4000_cart_slot_device::call_load()
{
if (m_cart)
{
uint32_t const size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
if (size > 0x1800)
- {
- osd_printf_error("%s: Image extends beyond the expected size for a VC4000 cart\n", basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Image exceeds the expected size for a VC4000 cartridge (6K)");
m_cart->rom_alloc(size);
@@ -212,7 +209,7 @@ std::error_condition vc4000_cart_slot_device::call_load()
//printf("Type: %s\n", vc4000_get_slot(m_type));
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/vc4000/slot.h b/src/devices/bus/vc4000/slot.h
index 3a9d2dc1cc4..457f266dade 100644
--- a/src/devices/bus/vc4000/slot.h
+++ b/src/devices/bus/vc4000/slot.h
@@ -70,7 +70,7 @@ public:
virtual ~vc4000_cart_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override { }
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/vcs/vcs_slot.cpp b/src/devices/bus/vcs/vcs_slot.cpp
index aa0812e22be..b0fe466722a 100644
--- a/src/devices/bus/vcs/vcs_slot.cpp
+++ b/src/devices/bus/vcs/vcs_slot.cpp
@@ -199,7 +199,7 @@ static const char *vcs_get_slot(int type)
return "a26_2k_4k";
}
-std::error_condition vcs_cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> vcs_cart_slot_device::call_load()
{
if (m_cart)
{
@@ -221,8 +221,7 @@ std::error_condition vcs_cart_slot_device::call_load()
break;
default:
- osd_printf_error("%s: Invalid ROM file size\n", basename());
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge ROM file size");
}
m_cart->rom_alloc(len, tag());
@@ -312,7 +311,7 @@ std::error_condition vcs_cart_slot_device::call_load()
m_cart->install_memory_handlers(m_address_space.target());
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/vcs/vcs_slot.h b/src/devices/bus/vcs/vcs_slot.h
index dab42192ff9..3b014f5c352 100644
--- a/src/devices/bus/vcs/vcs_slot.h
+++ b/src/devices/bus/vcs/vcs_slot.h
@@ -32,7 +32,7 @@ public:
template <typename T> void set_address_space(T &&tag, int no) { m_address_space.set_tag(std::forward<T>(tag), no); }
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/vectrex/slot.cpp b/src/devices/bus/vectrex/slot.cpp
index d3c3aa59bcd..013a985ab70 100644
--- a/src/devices/bus/vectrex/slot.cpp
+++ b/src/devices/bus/vectrex/slot.cpp
@@ -136,17 +136,14 @@ static const char *vectrex_get_slot(int type)
call load
-------------------------------------------------*/
-std::error_condition vectrex_cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> vectrex_cart_slot_device::call_load()
{
if (m_cart)
{
uint32_t const size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
if (size > 0x10000)
- {
- osd_printf_error("%s: Unsupported cartridge size\n", basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be no larger than 64K)");
m_cart->rom_alloc((size < 0x1000) ? 0x1000 : size);
uint8_t *const ROM = m_cart->get_rom_base();
@@ -158,10 +155,7 @@ std::error_condition vectrex_cart_slot_device::call_load()
// Verify the file is accepted by the Vectrex bios
if (memcmp(ROM, "g GCE", 5))
- {
- osd_printf_error("%s: Invalid image\n", basename());
- return image_error::INVALIDIMAGE;
- }
+ return std::make_pair(image_error::INVALIDIMAGE, "Invalid Vectrex ROM");
// determine type
m_type = VECTREX_STD;
@@ -181,11 +175,9 @@ std::error_condition vectrex_cart_slot_device::call_load()
if (!memcmp(ROM + 0x11, "3D MINE STORM", 13))
m_vec3d = VEC3D_MINEST;
-
- return std::error_condition();
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/vectrex/slot.h b/src/devices/bus/vectrex/slot.h
index e7216f3a0fe..3be89a8bbd1 100644
--- a/src/devices/bus/vectrex/slot.h
+++ b/src/devices/bus/vectrex/slot.h
@@ -68,7 +68,7 @@ public:
virtual ~vectrex_cart_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override { }
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/vic10/exp.cpp b/src/devices/bus/vic10/exp.cpp
index e8a02972cb2..1c0f44301db 100644
--- a/src/devices/bus/vic10/exp.cpp
+++ b/src/devices/bus/vic10/exp.cpp
@@ -86,7 +86,7 @@ void vic10_expansion_slot_device::device_start()
// call_load -
//-------------------------------------------------
-std::error_condition vic10_expansion_slot_device::call_load()
+std::pair<std::error_condition, std::string> vic10_expansion_slot_device::call_load()
{
if (m_card)
{
@@ -137,7 +137,7 @@ std::error_condition vic10_expansion_slot_device::call_load()
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/vic10/exp.h b/src/devices/bus/vic10/exp.h
index f48f888ff34..aa2aa14c1dd 100644
--- a/src/devices/bus/vic10/exp.h
+++ b/src/devices/bus/vic10/exp.h
@@ -87,7 +87,7 @@ protected:
virtual void device_start() override;
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
virtual const char *image_interface() const noexcept override { return "vic10_cart"; }
diff --git a/src/devices/bus/vic20/exp.cpp b/src/devices/bus/vic20/exp.cpp
index 901039ff58d..d9bbd22d16b 100644
--- a/src/devices/bus/vic20/exp.cpp
+++ b/src/devices/bus/vic20/exp.cpp
@@ -92,7 +92,7 @@ void vic20_expansion_slot_device::device_reset()
// call_load -
//-------------------------------------------------
-std::error_condition vic20_expansion_slot_device::call_load()
+std::pair<std::error_condition, std::string> vic20_expansion_slot_device::call_load()
{
if (m_card)
{
@@ -119,7 +119,7 @@ std::error_condition vic20_expansion_slot_device::call_load()
case 0x7000: fread(m_card->m_blk3, 0x2000, 0x1000); break;
case 0xa000: fread(m_card->m_blk5, 0x2000); break;
case 0xb000: fread(m_card->m_blk5, 0x2000, 0x1000); break;
- default: return image_error::INVALIDIMAGE;
+ default: return std::make_pair(image_error::INVALIDIMAGE, "Unsupported address in CRT file header");
}
}
}
@@ -132,7 +132,7 @@ std::error_condition vic20_expansion_slot_device::call_load()
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/vic20/exp.h b/src/devices/bus/vic20/exp.h
index c159c11cfb9..2a41869157a 100644
--- a/src/devices/bus/vic20/exp.h
+++ b/src/devices/bus/vic20/exp.h
@@ -85,7 +85,7 @@ protected:
virtual void device_reset() override;
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
virtual const char *image_interface() const noexcept override { return "vic1001_cart"; }
diff --git a/src/devices/bus/vidbrain/exp.cpp b/src/devices/bus/vidbrain/exp.cpp
index 00cf3c4e0ed..bf78cdfc9ea 100644
--- a/src/devices/bus/vidbrain/exp.cpp
+++ b/src/devices/bus/vidbrain/exp.cpp
@@ -105,7 +105,7 @@ void videobrain_expansion_slot_device::device_start()
// call_load -
//-------------------------------------------------
-std::error_condition videobrain_expansion_slot_device::call_load()
+std::pair<std::error_condition, std::string> videobrain_expansion_slot_device::call_load()
{
if (m_cart)
{
@@ -127,7 +127,7 @@ std::error_condition videobrain_expansion_slot_device::call_load()
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/vidbrain/exp.h b/src/devices/bus/vidbrain/exp.h
index 0e9f4418839..ec4744cf11d 100644
--- a/src/devices/bus/vidbrain/exp.h
+++ b/src/devices/bus/vidbrain/exp.h
@@ -120,7 +120,7 @@ protected:
virtual void device_start() override;
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
virtual const char *image_interface() const noexcept override { return "vidbrain_cart"; }
diff --git a/src/devices/bus/vsmile/vsmile_slot.cpp b/src/devices/bus/vsmile/vsmile_slot.cpp
index e5121267bff..1e743c5f393 100644
--- a/src/devices/bus/vsmile/vsmile_slot.cpp
+++ b/src/devices/bus/vsmile/vsmile_slot.cpp
@@ -132,16 +132,13 @@ static int vsmile_get_pcb_id(const char *slot)
call load
-------------------------------------------------*/
-std::error_condition vsmile_cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> vsmile_cart_slot_device::call_load()
{
if (m_cart)
{
uint32_t const size = loaded_through_softlist() ? get_software_region_length("rom") : length();
if (size > 0x100'0000)
- {
- osd_printf_error("%s: Attempted loading a cart larger than 16MB\n", basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Cartridges larger than 16MB are not supported");
m_cart->rom_alloc(size);
uint8_t *const rom = (uint8_t *)m_cart->get_rom_base();
@@ -160,7 +157,7 @@ std::error_condition vsmile_cart_slot_device::call_load()
if (pcb_name)
m_type = vsmile_get_pcb_id(pcb_name);
- osd_printf_info("V.Smile: Detected (XML) %s\n", pcb_name ? pcb_name : "NONE");
+ osd_printf_verbose("V.Smile: Detected (XML) %s\n", pcb_name ? pcb_name : "NONE");
}
if (m_type == VSMILE_NVRAM)
@@ -170,7 +167,7 @@ std::error_condition vsmile_cart_slot_device::call_load()
battery_load(m_cart->get_nvram_base(), m_cart->get_nvram_size(), 0x00);
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/vsmile/vsmile_slot.h b/src/devices/bus/vsmile/vsmile_slot.h
index 2174517a965..627fb8ac4ad 100644
--- a/src/devices/bus/vsmile/vsmile_slot.h
+++ b/src/devices/bus/vsmile/vsmile_slot.h
@@ -80,7 +80,7 @@ public:
virtual ~vsmile_cart_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/wswan/slot.cpp b/src/devices/bus/wswan/slot.cpp
index 376ff0ab51a..db10482e52a 100644
--- a/src/devices/bus/wswan/slot.cpp
+++ b/src/devices/bus/wswan/slot.cpp
@@ -150,7 +150,7 @@ static const char *ws_get_slot(int type)
call load
-------------------------------------------------*/
-std::error_condition ws_cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> ws_cart_slot_device::call_load()
{
if (m_cart)
{
@@ -202,7 +202,7 @@ std::error_condition ws_cart_slot_device::call_load()
internal_header_logging(ROM, ((size >> 16) - 1) << 16, size);
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
/*-------------------------------------------------
diff --git a/src/devices/bus/wswan/slot.h b/src/devices/bus/wswan/slot.h
index e5151303620..6c84f093450 100644
--- a/src/devices/bus/wswan/slot.h
+++ b/src/devices/bus/wswan/slot.h
@@ -146,7 +146,7 @@ public:
virtual ~ws_cart_slot_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/devices/bus/z88/z88.cpp b/src/devices/bus/z88/z88.cpp
index 0897f15ccba..f7c38114f83 100644
--- a/src/devices/bus/z88/z88.cpp
+++ b/src/devices/bus/z88/z88.cpp
@@ -95,13 +95,13 @@ TIMER_CALLBACK_MEMBER(z88cart_slot_device::close_flap)
call load
-------------------------------------------------*/
-std::error_condition z88cart_slot_device::call_load()
+std::pair<std::error_condition, std::string> z88cart_slot_device::call_load()
{
if (m_cart)
{
uint8_t *const cart_base = m_cart->get_cart_base();
if (!cart_base)
- return image_error::INTERNAL;
+ return std::make_pair(image_error::INTERNAL, std::string());
if (!loaded_through_softlist())
{
@@ -121,7 +121,7 @@ std::error_condition z88cart_slot_device::call_load()
// setup the timer to close the flap
m_flp_timer->adjust(CLOSE_FLAP_TIME);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/bus/z88/z88.h b/src/devices/bus/z88/z88.h
index 94355823145..3fe6b24ff0c 100644
--- a/src/devices/bus/z88/z88.h
+++ b/src/devices/bus/z88/z88.h
@@ -105,7 +105,7 @@ public:
auto out_flp_callback() { return m_out_flp_cb.bind(); }
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_reset_on_load() const noexcept override { return false; }
diff --git a/src/devices/imagedev/avivideo.cpp b/src/devices/imagedev/avivideo.cpp
index 52308f4a301..bfa095fd331 100644
--- a/src/devices/imagedev/avivideo.cpp
+++ b/src/devices/imagedev/avivideo.cpp
@@ -80,14 +80,14 @@ TIMER_CALLBACK_MEMBER(avivideo_image_device::frame_timer)
}
}
-std::error_condition avivideo_image_device::call_load()
+std::pair<std::error_condition, std::string> avivideo_image_device::call_load()
{
m_frame.reset(new bitmap_argb32);
avi_file::error avierr = avi_file::open(filename(), m_avi);
if (avierr != avi_file::error::NONE)
{
m_frame.reset();
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
}
const avi_file::movie_info &aviinfo = m_avi->get_movie_info();
@@ -96,7 +96,7 @@ std::error_condition avivideo_image_device::call_load()
m_frame_timer->adjust(frame_time, 0, frame_time);
m_frame_count = aviinfo.video_numsamples;
m_frame_num = 0;
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void avivideo_image_device::call_unload()
diff --git a/src/devices/imagedev/avivideo.h b/src/devices/imagedev/avivideo.h
index 1b61fda4068..1325779326d 100644
--- a/src/devices/imagedev/avivideo.h
+++ b/src/devices/imagedev/avivideo.h
@@ -36,7 +36,7 @@ public:
virtual ~avivideo_image_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_readable() const noexcept override { return true; }
diff --git a/src/devices/imagedev/bitbngr.cpp b/src/devices/imagedev/bitbngr.cpp
index 07b88f41386..ae207c81498 100644
--- a/src/devices/imagedev/bitbngr.cpp
+++ b/src/devices/imagedev/bitbngr.cpp
@@ -85,16 +85,16 @@ const software_list_loader &bitbanger_device::get_software_list_loader() const
call_load
-------------------------------------------------*/
-std::error_condition bitbanger_device::call_load()
+std::pair<std::error_condition, std::string> bitbanger_device::call_load()
{
// we don't need to do anything special
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
-std::error_condition bitbanger_device::call_create(int format_type, util::option_resolution *format_options)
+std::pair<std::error_condition, std::string> bitbanger_device::call_create(int format_type, util::option_resolution *format_options)
{
// we don't need to do anything special
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
/*-------------------------------------------------
diff --git a/src/devices/imagedev/bitbngr.h b/src/devices/imagedev/bitbngr.h
index 56501d7c7e1..d48b3548d25 100644
--- a/src/devices/imagedev/bitbngr.h
+++ b/src/devices/imagedev/bitbngr.h
@@ -20,8 +20,8 @@ public:
bitbanger_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device_image_interface implementation
- virtual std::error_condition call_load() override;
- virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_create(int format_type, util::option_resolution *format_options) override;
virtual void call_unload() override;
virtual bool is_readable() const noexcept override { return true; }
diff --git a/src/devices/imagedev/cassette.cpp b/src/devices/imagedev/cassette.cpp
index ff1d0a8ca84..2aeec195312 100644
--- a/src/devices/imagedev/cassette.cpp
+++ b/src/devices/imagedev/cassette.cpp
@@ -248,14 +248,14 @@ const software_list_loader &cassette_image_device::get_software_list_loader() co
return image_software_list_loader::instance();
}
-std::error_condition cassette_image_device::call_create(int format_type, util::option_resolution *format_options)
+std::pair<std::error_condition, std::string> cassette_image_device::call_create(int format_type, util::option_resolution *format_options)
{
- return internal_load(true);
+ return std::make_pair(internal_load(true), std::string());
}
-std::error_condition cassette_image_device::call_load()
+std::pair<std::error_condition, std::string> cassette_image_device::call_load()
{
- return internal_load(false);
+ return std::make_pair(internal_load(false), std::string());
}
std::error_condition cassette_image_device::internal_load(bool is_create)
diff --git a/src/devices/imagedev/cassette.h b/src/devices/imagedev/cassette.h
index de413b24c57..486e322b1a1 100644
--- a/src/devices/imagedev/cassette.h
+++ b/src/devices/imagedev/cassette.h
@@ -58,8 +58,8 @@ public:
void set_interface(const char *interface) { m_interface = interface; }
// device_image_interface implementation
- virtual std::error_condition call_load() override;
- virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_create(int format_type, util::option_resolution *format_options) override;
virtual void call_unload() override;
virtual std::string call_display() override;
diff --git a/src/devices/imagedev/chd_cd.cpp b/src/devices/imagedev/chd_cd.cpp
index 44cb21e7201..6fea63b77a4 100644
--- a/src/devices/imagedev/chd_cd.cpp
+++ b/src/devices/imagedev/chd_cd.cpp
@@ -76,7 +76,7 @@ void cdrom_image_device::device_stop()
m_self_chd.close();
}
-std::error_condition cdrom_image_device::call_load()
+std::pair<std::error_condition, std::string> cdrom_image_device::call_load()
{
std::error_condition err;
chd_file *chd = nullptr;
@@ -106,15 +106,12 @@ std::error_condition cdrom_image_device::call_load()
if (!m_cdrom_handle)
goto error;
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
error:
if (chd && chd == &m_self_chd)
m_self_chd.close();
- if (err)
- return err;
- else
- return image_error::UNSPECIFIED;
+ return std::make_pair(err ? err : image_error::UNSPECIFIED, std::string());
}
void cdrom_image_device::call_unload()
diff --git a/src/devices/imagedev/chd_cd.h b/src/devices/imagedev/chd_cd.h
index 6c5142c9b48..ba95dc8be61 100644
--- a/src/devices/imagedev/chd_cd.h
+++ b/src/devices/imagedev/chd_cd.h
@@ -40,7 +40,7 @@ public:
void set_interface(const char *interface) { m_interface = interface; }
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_readable() const noexcept override { return true; }
diff --git a/src/devices/imagedev/diablo.cpp b/src/devices/imagedev/diablo.cpp
index eabf9f204a4..46f60fe70d2 100644
--- a/src/devices/imagedev/diablo.cpp
+++ b/src/devices/imagedev/diablo.cpp
@@ -92,7 +92,7 @@ void diablo_image_device::device_stop()
m_hard_disk_handle.reset();
}
-std::error_condition diablo_image_device::call_load()
+std::pair<std::error_condition, std::string> diablo_image_device::call_load()
{
std::error_condition our_result;
@@ -103,11 +103,11 @@ std::error_condition diablo_image_device::call_load()
/* Let the override do some additional work/checks */
our_result = m_device_image_load(*this);
}
- return our_result;
+ return std::make_pair(our_result, std::string());
}
-std::error_condition diablo_image_device::call_create(int create_format, util::option_resolution *create_args)
+std::pair<std::error_condition, std::string> diablo_image_device::call_create(int create_format, util::option_resolution *create_args)
{
if (!create_args)
throw emu_fatalerror("diablo_image_device::call_create: Expected create_args to not be nullptr");
@@ -127,16 +127,16 @@ std::error_condition diablo_image_device::call_create(int create_format, util::o
if (!err)
m_origchd.create(std::move(proxy), uint64_t(totalsectors) * uint64_t(sectorsize), hunksize, sectorsize, compression);
if (err)
- return err;
+ return std::make_pair(err, std::string());
/* 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)
- return err;
+ return std::make_pair(err, std::string());
- return internal_load_dsk();
+ return std::make_pair(internal_load_dsk(), std::string());
}
void diablo_image_device::call_unload()
diff --git a/src/devices/imagedev/diablo.h b/src/devices/imagedev/diablo.h
index 2d7b0287192..76cd7a320e5 100644
--- a/src/devices/imagedev/diablo.h
+++ b/src/devices/imagedev/diablo.h
@@ -42,8 +42,8 @@ public:
void set_interface(const char *interface) { m_interface = interface; }
// device_image_interface implementation
- virtual std::error_condition call_load() override;
- virtual std::error_condition call_create(int create_format, util::option_resolution *create_args) override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_create(int create_format, util::option_resolution *create_args) override;
virtual void call_unload() override;
virtual bool image_is_chd_type() const noexcept override { return true; }
diff --git a/src/devices/imagedev/flopdrv.cpp b/src/devices/imagedev/flopdrv.cpp
index 27d17f15d32..f5f982dd9c9 100644
--- a/src/devices/imagedev/flopdrv.cpp
+++ b/src/devices/imagedev/flopdrv.cpp
@@ -728,12 +728,12 @@ const software_list_loader &legacy_floppy_image_device::get_software_list_loader
return image_software_list_loader::instance();
}
-std::error_condition legacy_floppy_image_device::call_create(int format_type, util::option_resolution *format_options)
+std::pair<std::error_condition, std::string> legacy_floppy_image_device::call_create(int format_type, util::option_resolution *format_options)
{
- return internal_floppy_device_load(true, format_type, format_options);
+ return std::make_pair(internal_floppy_device_load(true, format_type, format_options), std::string());
}
-std::error_condition legacy_floppy_image_device::call_load()
+std::pair<std::error_condition, std::string> legacy_floppy_image_device::call_load()
{
std::error_condition retVal = internal_floppy_device_load(false, -1, nullptr);
@@ -751,7 +751,7 @@ std::error_condition legacy_floppy_image_device::call_load()
m_wpt_timer->adjust(attotime::from_msec(250), next_wpt);
- return retVal;
+ return std::make_pair(retVal, std::string());
}
void legacy_floppy_image_device::call_unload()
diff --git a/src/devices/imagedev/flopdrv.h b/src/devices/imagedev/flopdrv.h
index 09b0976ac8c..67de1597118 100644
--- a/src/devices/imagedev/flopdrv.h
+++ b/src/devices/imagedev/flopdrv.h
@@ -102,8 +102,8 @@ public:
void set_floppy_config(const floppy_interface *config) { m_config = config; }
auto out_idx_cb() { return m_out_idx_func.bind(); }
- virtual std::error_condition call_load() override;
- virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_create(int format_type, util::option_resolution *format_options) override;
virtual void call_unload() override;
virtual bool is_readable() const noexcept override { return true; }
diff --git a/src/devices/imagedev/floppy.cpp b/src/devices/imagedev/floppy.cpp
index e28b59734c3..33dd1094436 100644
--- a/src/devices/imagedev/floppy.cpp
+++ b/src/devices/imagedev/floppy.cpp
@@ -576,13 +576,12 @@ void floppy_image_device::init_floppy_load(bool write_supported)
dskchg = 1;
}
-std::error_condition floppy_image_device::call_load()
+std::pair<std::error_condition, std::string> floppy_image_device::call_load()
{
check_for_file();
auto io = util::random_read_fill(image_core_file(), 0xff);
- if(!io) {
- return std::errc::not_enough_memory;
- }
+ if(!io)
+ return std::make_pair(std::errc::not_enough_memory, std::string());
int best = 0;
const floppy_image_format_t *best_format = nullptr;
@@ -596,16 +595,13 @@ std::error_condition floppy_image_device::call_load()
}
}
- if (!best_format) {
- osd_printf_error("%s: Unable to identify the image format\n", filename());
- return image_error::INVALIDIMAGE;
- }
+ if (!best_format)
+ return std::make_pair(image_error::INVALIDIMAGE, "Unable to identify image file format");
image = std::make_unique<floppy_image>(tracks, sides, form_factor);
if (!best_format->load(*io, form_factor, variants, image.get())) {
- osd_printf_error("%s: Incompatible image format or corrupted data\n", filename());
image.reset();
- return image_error::INVALIDIMAGE;
+ return std::make_pair(image_error::INVALIDIMAGE, "Incompatible image file format or corrupted data");
}
output_format = is_readonly() ? nullptr : best_format;
@@ -618,7 +614,7 @@ std::error_condition floppy_image_device::call_load()
flux_image_prepare();
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void floppy_image_device::flux_image_prepare()
@@ -787,7 +783,7 @@ void floppy_image_device::call_unload()
set_ready(true);
}
-std::error_condition floppy_image_device::call_create(int format_type, util::option_resolution *format_options)
+std::pair<std::error_condition, std::string> floppy_image_device::call_create(int format_type, util::option_resolution *format_options)
{
image = std::make_unique<floppy_image>(tracks, sides, form_factor);
output_format = nullptr;
@@ -814,7 +810,7 @@ std::error_condition floppy_image_device::call_create(int format_type, util::opt
flux_image_prepare();
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void floppy_image_device::init_fs(const fs_info *fs, const fs::meta_data &meta)
diff --git a/src/devices/imagedev/floppy.h b/src/devices/imagedev/floppy.h
index 9ca327ef2d1..fb460711a3c 100644
--- a/src/devices/imagedev/floppy.h
+++ b/src/devices/imagedev/floppy.h
@@ -88,9 +88,9 @@ public:
void init_fs(const fs_info *fs, const fs::meta_data &meta);
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
- virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
+ virtual std::pair<std::error_condition, std::string> call_create(int format_type, util::option_resolution *format_options) override;
virtual const char *image_interface() const noexcept override = 0;
virtual bool is_readable() const noexcept override { return true; }
diff --git a/src/devices/imagedev/harddriv.cpp b/src/devices/imagedev/harddriv.cpp
index af624d0791c..dac1c9a5c16 100644
--- a/src/devices/imagedev/harddriv.cpp
+++ b/src/devices/imagedev/harddriv.cpp
@@ -120,7 +120,7 @@ void harddisk_image_device::device_stop()
m_hard_disk_handle.reset();
}
-std::error_condition harddisk_image_device::call_load()
+std::pair<std::error_condition, std::string> harddisk_image_device::call_load()
{
std::error_condition our_result = internal_load_hd();
@@ -130,11 +130,11 @@ std::error_condition harddisk_image_device::call_load()
// Let the override do some additional work/checks
our_result = m_device_image_load(*this);
}
- return our_result;
+ return std::make_pair(our_result, std::string());
}
-std::error_condition harddisk_image_device::call_create(int create_format, util::option_resolution *create_args)
+std::pair<std::error_condition, std::string> harddisk_image_device::call_create(int create_format, util::option_resolution *create_args)
{
if (!create_args)
throw emu_fatalerror("harddisk_image_device::call_create: Expected create_args to not be nullptr");
@@ -154,16 +154,16 @@ std::error_condition harddisk_image_device::call_create(int create_format, util:
if (!err)
err = m_origchd.create(std::move(proxy), uint64_t(totalsectors) * uint64_t(sectorsize), hunksize, sectorsize, compression);
if (err)
- return err;
+ return std::make_pair(err, std::string());
// 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)
- return err;
+ return std::make_pair(err, std::string());
- return internal_load_hd();
+ return std::make_pair(internal_load_hd(), std::string());
}
void harddisk_image_device::call_unload()
diff --git a/src/devices/imagedev/harddriv.h b/src/devices/imagedev/harddriv.h
index e0803ae3692..f9406e3eb51 100644
--- a/src/devices/imagedev/harddriv.h
+++ b/src/devices/imagedev/harddriv.h
@@ -65,8 +65,8 @@ public:
void set_interface(const char *interface) { m_interface = interface; }
// device_image_interface implementation
- virtual std::error_condition call_load() override;
- virtual std::error_condition call_create(int create_format, util::option_resolution *create_args) override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_create(int create_format, util::option_resolution *create_args) override;
virtual void call_unload() override;
virtual bool image_is_chd_type() const noexcept override { return true; }
diff --git a/src/devices/imagedev/mfmhd.cpp b/src/devices/imagedev/mfmhd.cpp
index d5c05d65f35..70f34e09d9f 100644
--- a/src/devices/imagedev/mfmhd.cpp
+++ b/src/devices/imagedev/mfmhd.cpp
@@ -413,7 +413,7 @@ void mfm_harddisk_device::device_stop()
because we need the number of cylinders, and for generic drives we get
them from the CHD.
*/
-std::error_condition mfm_harddisk_device::call_load()
+std::pair<std::error_condition, std::string> mfm_harddisk_device::call_load()
{
std::error_condition err;
@@ -426,7 +426,7 @@ std::error_condition mfm_harddisk_device::call_load()
{
auto io = util::random_read_write_fill(image_core_file(), 0xff);
if (!io)
- return std::errc::not_enough_memory;
+ return std::make_pair(std::errc::not_enough_memory, std::string());
m_chd = new chd_file; // FIXME: this is never deleted
err = m_chd->open(std::move(io), true);
@@ -437,119 +437,111 @@ std::error_condition mfm_harddisk_device::call_load()
m_format->set_tag(devtag);
- if (!err)
+ if (err)
{
- std::string metadata;
+ LOGMASKED(LOG_WARN, "Could not load CHD\n");
+ return std::make_pair(err, std::string());
+ }
- if (!m_chd)
- {
- LOG("m_chd is null\n");
- return image_error::UNSPECIFIED;
- }
+ if (!m_chd)
+ {
+ LOG("m_chd is null\n");
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
+ }
- // Read the hard disk metadata
- std::error_condition state = m_chd->read_metadata(HARD_DISK_METADATA_TAG, 0, metadata);
- if (state)
- {
- LOG("Failed to read CHD metadata\n");
- return state;
- }
+ // Read the hard disk metadata
+ std::string metadata;
+ std::error_condition state = m_chd->read_metadata(HARD_DISK_METADATA_TAG, 0, metadata);
+ if (state)
+ return std::make_pair(state, "Failed to read CHD metadata");
- LOGMASKED(LOG_CONFIG, "CHD metadata: %s\n", metadata.c_str());
+ LOGMASKED(LOG_CONFIG, "CHD metadata: %s\n", metadata.c_str());
- // Parse the metadata
- mfmhd_layout_params param;
- param.encoding = m_encoding;
- LOGMASKED(LOG_CONFIG, "Set encoding to %d\n", m_encoding);
+ // Parse the metadata
+ mfmhd_layout_params param;
+ param.encoding = m_encoding;
+ LOGMASKED(LOG_CONFIG, "Set encoding to %d\n", m_encoding);
- if (sscanf(metadata.c_str(), HARD_DISK_METADATA_FORMAT, &param.cylinders, &param.heads, &param.sectors_per_track, &param.sector_size) != 4)
- {
- LOG("Invalid CHD metadata\n");
- return image_error::INVALIDIMAGE;
- }
+ if (sscanf(metadata.c_str(), HARD_DISK_METADATA_FORMAT, &param.cylinders, &param.heads, &param.sectors_per_track, &param.sector_size) != 4)
+ return std::make_pair(image_error::INVALIDIMAGE, "Invalid CHD metadata");
- LOGMASKED(LOG_CONFIG, "CHD image has geometry cyl=%d, head=%d, sect=%d, size=%d\n", param.cylinders, param.heads, param.sectors_per_track, param.sector_size);
+ LOGMASKED(LOG_CONFIG, "CHD image has geometry cyl=%d, head=%d, sect=%d, size=%d\n", param.cylinders, param.heads, param.sectors_per_track, param.sector_size);
- if (m_max_cylinders != 0 && (param.cylinders != m_max_cylinders || param.heads != m_max_heads))
- {
- // TODO: does this really need to be a fatal error?
- throw emu_fatalerror("Image geometry does not fit this kind of hard drive: drive=(%d,%d), image=(%d,%d)", m_max_cylinders, m_max_heads, param.cylinders, param.heads);
- }
+ if (m_max_cylinders != 0 && (param.cylinders != m_max_cylinders || param.heads != m_max_heads))
+ {
+ // TODO: does this really need to be a fatal error?
+ throw emu_fatalerror("Image geometry does not fit this kind of hard drive: drive=(%d,%d), image=(%d,%d)", m_max_cylinders, m_max_heads, param.cylinders, param.heads);
+ }
- // MDM format specs
- param.interleave = 0;
- param.cylskew = 0;
- param.headskew = 0;
- param.write_precomp_cylinder = -1;
- param.reduced_wcurr_cylinder = -1;
+ // MDM format specs
+ param.interleave = 0;
+ param.cylskew = 0;
+ param.headskew = 0;
+ param.write_precomp_cylinder = -1;
+ param.reduced_wcurr_cylinder = -1;
- state = m_chd->read_metadata(MFM_HARD_DISK_METADATA_TAG, 0, metadata);
- if (state)
- LOGMASKED(LOG_WARN, "Failed to read CHD sector arrangement/recording specs, applying defaults\n");
- else
- sscanf(metadata.c_str(), MFMHD_REC_METADATA_FORMAT, &param.interleave, &param.cylskew, &param.headskew, &param.write_precomp_cylinder, &param.reduced_wcurr_cylinder);
+ state = m_chd->read_metadata(MFM_HARD_DISK_METADATA_TAG, 0, metadata);
+ if (state)
+ LOGMASKED(LOG_WARN, "Failed to read CHD sector arrangement/recording specs, applying defaults\n");
+ else
+ sscanf(metadata.c_str(), MFMHD_REC_METADATA_FORMAT, &param.interleave, &param.cylskew, &param.headskew, &param.write_precomp_cylinder, &param.reduced_wcurr_cylinder);
- if (!param.sane_rec())
- {
- LOGMASKED(LOG_CONFIG, "Sector arrangement/recording specs have invalid values, applying defaults\n");
- param.reset_rec();
- }
- else
- {
- LOGMASKED(LOG_CONFIG,
- "MFM HD rec specs: interleave=%d, cylskew=%d, headskew=%d, wpcom=%d, rwc=%d\n",
- param.interleave, param.cylskew, param.headskew, param.write_precomp_cylinder, param.reduced_wcurr_cylinder);
- }
+ if (!param.sane_rec())
+ {
+ LOGMASKED(LOG_CONFIG, "Sector arrangement/recording specs have invalid values, applying defaults\n");
+ param.reset_rec();
+ }
+ else
+ {
+ LOGMASKED(LOG_CONFIG,
+ "MFM HD rec specs: interleave=%d, cylskew=%d, headskew=%d, wpcom=%d, rwc=%d\n",
+ param.interleave, param.cylskew, param.headskew, param.write_precomp_cylinder, param.reduced_wcurr_cylinder);
+ }
- state = m_chd->read_metadata(MFM_HARD_DISK_METADATA_TAG, 1, metadata);
- if (state)
- LOGMASKED(LOG_WARN, "Failed to read CHD track gap specs, applying defaults\n");
- else
- sscanf(metadata.c_str(), MFMHD_GAP_METADATA_FORMAT, &param.gap1, &param.gap2, &param.gap3, &param.sync, &param.headerlen, &param.ecctype);
+ state = m_chd->read_metadata(MFM_HARD_DISK_METADATA_TAG, 1, metadata);
+ if (state)
+ LOGMASKED(LOG_WARN, "Failed to read CHD track gap specs, applying defaults\n");
+ else
+ sscanf(metadata.c_str(), MFMHD_GAP_METADATA_FORMAT, &param.gap1, &param.gap2, &param.gap3, &param.sync, &param.headerlen, &param.ecctype);
- if (!param.sane_gap())
- {
- LOGMASKED(LOG_CONFIG, "MFM HD gap specs have invalid values, applying defaults\n");
- param.reset_gap();
- }
- else
- {
- LOGMASKED(LOG_CONFIG,
- "MFM HD gap specs: gap1=%d, gap2=%d, gap3=%d, sync=%d, headerlen=%d, ecctype=%d\n",
- param.gap1, param.gap2, param.gap3, param.sync, param.headerlen, param.ecctype);
- }
+ if (!param.sane_gap())
+ {
+ LOGMASKED(LOG_CONFIG, "MFM HD gap specs have invalid values, applying defaults\n");
+ param.reset_gap();
+ }
+ else
+ {
+ LOGMASKED(LOG_CONFIG,
+ "MFM HD gap specs: gap1=%d, gap2=%d, gap3=%d, sync=%d, headerlen=%d, ecctype=%d\n",
+ param.gap1, param.gap2, param.gap3, param.sync, param.headerlen, param.ecctype);
+ }
- m_format->set_layout_params(param);
+ m_format->set_layout_params(param);
- m_cache->init(this, m_trackimage_size, m_cachelines);
+ m_cache->init(this, m_trackimage_size, m_cachelines);
- // Head timing
- // We assume that the real times are 80% of the max times
- // The single-step time includes the settle time, so does the max time
- // From that we calculate the actual cylinder-by-cylinder time and the settle time
+ // Head timing
+ // We assume that the real times are 80% of the max times
+ // The single-step time includes the settle time, so does the max time
+ // From that we calculate the actual cylinder-by-cylinder time and the settle time
- m_actual_cylinders = param.cylinders;
+ m_actual_cylinders = param.cylinders;
- if (m_phys_cylinders == 0) m_phys_cylinders = m_actual_cylinders+1;
- if (m_landing_zone == 0) m_landing_zone = m_phys_cylinders-1;
+ if (m_phys_cylinders == 0) m_phys_cylinders = m_actual_cylinders+1;
+ if (m_landing_zone == 0) m_landing_zone = m_phys_cylinders-1;
- float realnext = (m_seeknext_time==0)? 10 : (m_seeknext_time * 0.8);
- float realmax = (m_maxseek_time==0)? (m_actual_cylinders * 0.2) : (m_maxseek_time * 0.8);
- float settle_us = ((m_actual_cylinders-1.0) * realnext - realmax) / (m_actual_cylinders-2.0) * 1000;
- float step_us = realnext * 1000 - settle_us;
- LOGMASKED(LOG_CONFIG, "Calculated settle time: %0.2f ms, step: %d us\n", settle_us/1000, (int)step_us);
+ float realnext = (m_seeknext_time==0)? 10 : (m_seeknext_time * 0.8);
+ float realmax = (m_maxseek_time==0)? (m_actual_cylinders * 0.2) : (m_maxseek_time * 0.8);
+ float settle_us = ((m_actual_cylinders-1.0) * realnext - realmax) / (m_actual_cylinders-2.0) * 1000;
+ float step_us = realnext * 1000 - settle_us;
+ LOGMASKED(LOG_CONFIG, "Calculated settle time: %0.2f ms, step: %d us\n", settle_us/1000, (int)step_us);
- m_settle_time = attotime::from_usec((int)settle_us);
- m_step_time = attotime::from_usec((int)step_us);
+ m_settle_time = attotime::from_usec((int)settle_us);
+ m_step_time = attotime::from_usec((int)step_us);
- m_current_cylinder = m_landing_zone;
- }
- else
- {
- LOGMASKED(LOG_WARN, "Could not load CHD\n");
- return err;
- }
- return std::error_condition();
+ m_current_cylinder = m_landing_zone;
+
+ return std::make_pair(std::error_condition(), std::string());
}
const char *MFMHD_REC_METADATA_FORMAT = "IL:%d,CSKEW:%d,HSKEW:%d,WPCOM:%d,RWC:%d";
diff --git a/src/devices/imagedev/mfmhd.h b/src/devices/imagedev/mfmhd.h
index 9d543f2e8d5..f27b96caa68 100644
--- a/src/devices/imagedev/mfmhd.h
+++ b/src/devices/imagedev/mfmhd.h
@@ -101,7 +101,7 @@ public:
// Head select
void headsel_w(int head) { m_current_head = head & 0x0f; }
- std::error_condition call_load() override;
+ std::pair<std::error_condition, std::string> call_load() override;
void call_unload() override;
// Tells us the time when the track ends (next index pulse). Needed by the controller.
diff --git a/src/devices/imagedev/microdrv.cpp b/src/devices/imagedev/microdrv.cpp
index 51bbae324fa..a40c79c9721 100644
--- a/src/devices/imagedev/microdrv.cpp
+++ b/src/devices/imagedev/microdrv.cpp
@@ -79,10 +79,10 @@ void microdrive_image_device::device_start()
m_comms_out = 0;
}
-std::error_condition microdrive_image_device::call_load()
+std::pair<std::error_condition, std::string> microdrive_image_device::call_load()
{
if (length() != MDV_IMAGE_LENGTH)
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, std::string());
// huh
for (int i = 0; i < MDV_IMAGE_LENGTH / 2; i++)
@@ -94,7 +94,7 @@ std::error_condition microdrive_image_device::call_load()
m_bit_offset = 0;
m_byte_offset = 0;
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void microdrive_image_device::call_unload()
diff --git a/src/devices/imagedev/microdrv.h b/src/devices/imagedev/microdrv.h
index 62c7b717ce6..465d091d10a 100644
--- a/src/devices/imagedev/microdrv.h
+++ b/src/devices/imagedev/microdrv.h
@@ -40,7 +40,7 @@ public:
auto comms_out_wr_callback() { return m_write_comms_out.bind(); }
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_creatable() const noexcept override { return false; }
diff --git a/src/devices/imagedev/midiin.cpp b/src/devices/imagedev/midiin.cpp
index 611dd4ad59b..643a5de57eb 100644
--- a/src/devices/imagedev/midiin.cpp
+++ b/src/devices/imagedev/midiin.cpp
@@ -165,7 +165,7 @@ TIMER_CALLBACK_MEMBER(midiin_device::midi_update)
call_load
-------------------------------------------------*/
-std::error_condition midiin_device::call_load()
+std::pair<std::error_condition, std::string> midiin_device::call_load()
{
// attempt to load if it's a real file
std::error_condition err = load_image_by_path(OPEN_FLAG_READ, filename());
@@ -178,9 +178,9 @@ std::error_condition midiin_device::call_load()
{
m_sequence_start = std::max(machine().time(), attotime(10, 0));
m_timer->adjust(attotime::zero);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
}
else
{
@@ -189,11 +189,11 @@ std::error_condition midiin_device::call_load()
if (!m_midi->open_input(filename()))
{
m_midi.reset();
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
}
m_timer->adjust(attotime::from_hz(1500), 0, attotime::from_hz(1500));
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
}
diff --git a/src/devices/imagedev/midiin.h b/src/devices/imagedev/midiin.h
index 67b9f749c3e..0c65e527724 100644
--- a/src/devices/imagedev/midiin.h
+++ b/src/devices/imagedev/midiin.h
@@ -37,7 +37,7 @@ public:
auto input_callback() { return m_input_cb.bind(); }
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
// image device
diff --git a/src/devices/imagedev/midiout.cpp b/src/devices/imagedev/midiout.cpp
index 29463a8ccec..89ac4872332 100644
--- a/src/devices/imagedev/midiout.cpp
+++ b/src/devices/imagedev/midiout.cpp
@@ -55,17 +55,17 @@ void midiout_device::device_reset()
call_load
-------------------------------------------------*/
-std::error_condition midiout_device::call_load()
+std::pair<std::error_condition, std::string> midiout_device::call_load()
{
m_midi = machine().osd().create_midi_device();
if (!m_midi->open_output(filename()))
{
m_midi.reset();
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
/*-------------------------------------------------
diff --git a/src/devices/imagedev/midiout.h b/src/devices/imagedev/midiout.h
index b0d246d5302..67a572fd5e2 100644
--- a/src/devices/imagedev/midiout.h
+++ b/src/devices/imagedev/midiout.h
@@ -35,7 +35,7 @@ public:
~midiout_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
// image device
diff --git a/src/devices/imagedev/picture.cpp b/src/devices/imagedev/picture.cpp
index af50691d85b..77e25c2e903 100644
--- a/src/devices/imagedev/picture.cpp
+++ b/src/devices/imagedev/picture.cpp
@@ -42,30 +42,34 @@ void picture_image_device::device_start()
{
}
-std::error_condition picture_image_device::call_load()
+std::pair<std::error_condition, std::string> picture_image_device::call_load()
{
switch (render_detect_image(image_core_file()))
{
case RENDUTIL_IMGFORMAT_PNG:
render_load_png(m_picture, image_core_file());
+ if (!m_picture.valid())
+ return std::make_pair(image_error::INVALIDIMAGE, "Invalid or unsupported PNG file");
break;
case RENDUTIL_IMGFORMAT_JPEG:
render_load_jpeg(m_picture, image_core_file());
+ if (!m_picture.valid())
+ return std::make_pair(image_error::INVALIDIMAGE, "Invalid or unsupported JPEG file");
break;
case RENDUTIL_IMGFORMAT_MSDIB:
render_load_msdib(m_picture, image_core_file());
+ if (!m_picture.valid())
+ return std::make_pair(image_error::INVALIDIMAGE, "Invalid or unsupported Microsoft DIB (BMP) file");
break;
default:
m_picture.reset();
+ return std::make_pair(image_error::INVALIDIMAGE, "Unsupported image file format");
}
- if (m_picture.valid())
- return std::error_condition();
- else
- return image_error::UNSPECIFIED;
+ return std::make_pair(std::error_condition(), std::string());
}
void picture_image_device::call_unload()
diff --git a/src/devices/imagedev/picture.h b/src/devices/imagedev/picture.h
index ac7d439dec8..1ab10eee35c 100644
--- a/src/devices/imagedev/picture.h
+++ b/src/devices/imagedev/picture.h
@@ -30,7 +30,7 @@ public:
virtual ~picture_image_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_readable() const noexcept override { return true; }
diff --git a/src/devices/imagedev/printer.cpp b/src/devices/imagedev/printer.cpp
index 7d96ea0c83e..cd73690d371 100644
--- a/src/devices/imagedev/printer.cpp
+++ b/src/devices/imagedev/printer.cpp
@@ -68,7 +68,7 @@ void printer_image_device::output(uint8_t data)
DEVICE_IMAGE_CREATE( printer )
-------------------------------------------------*/
-std::error_condition printer_image_device::call_create(int format_type, util::option_resolution *format_options)
+std::pair<std::error_condition, std::string> printer_image_device::call_create(int format_type, util::option_resolution *format_options)
{
return call_load();
}
@@ -76,14 +76,14 @@ std::error_condition printer_image_device::call_create(int format_type, util::op
/*-------------------------------------------------
DEVICE_IMAGE_LOAD( printer )
-------------------------------------------------*/
-std::error_condition printer_image_device::call_load()
+std::pair<std::error_condition, std::string> printer_image_device::call_load()
{
// send notify that the printer is now online
if (!m_online_cb.isnull())
m_online_cb(true);
// we don't need to do anything special
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/imagedev/printer.h b/src/devices/imagedev/printer.h
index b1b55b00e96..2d816ea053a 100644
--- a/src/devices/imagedev/printer.h
+++ b/src/devices/imagedev/printer.h
@@ -30,8 +30,8 @@ public:
auto online_callback() { return m_online_cb.bind(); }
// device_image_interface implementation
- virtual std::error_condition call_load() override;
- virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_create(int format_type, util::option_resolution *format_options) override;
virtual void call_unload() override;
virtual bool is_readable() const noexcept override { return false; }
diff --git a/src/devices/imagedev/snapquik.cpp b/src/devices/imagedev/snapquik.cpp
index d865cb716cb..5c908dbcfef 100644
--- a/src/devices/imagedev/snapquik.cpp
+++ b/src/devices/imagedev/snapquik.cpp
@@ -52,8 +52,26 @@ TIMER_CALLBACK_MEMBER(snapshot_image_device::process_snapshot_or_quickload)
{
check_for_file();
- // invoke the load (FIXME: don't swallow errors)
- m_load(*this);
+ // invoke the load (FIXME: better way to report errors?)
+ auto [err, message] = m_load(*this);
+ if (err)
+ {
+ osd_printf_error(
+ !message.empty()
+ ? "%1$s: Error loading '%2$s': %3$s (%4$s:%5$d %6$s)\n"
+ : "%1$s: Error loading '%2$s': %6$s (%4$s:%5$d)\n",
+ tag(),
+ basename(),
+ message,
+ err.category().name(),
+ err.value(),
+ err.message());
+ popmessage(
+ !message.empty() ? "Error loading '%1$s': %3$s" : "Error loading '%1$s': %4$s",
+ basename(),
+ message,
+ err.message());
+ }
}
//-------------------------------------------------
@@ -71,11 +89,11 @@ void snapshot_image_device::device_start()
/*-------------------------------------------------
call_load
-------------------------------------------------*/
-std::error_condition snapshot_image_device::call_load()
+std::pair<std::error_condition, std::string> snapshot_image_device::call_load()
{
// adjust the timer
m_timer->adjust(m_delay, 0);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
const software_list_loader &snapshot_image_device::get_software_list_loader() const
diff --git a/src/devices/imagedev/snapquik.h b/src/devices/imagedev/snapquik.h
index 1355eb6579b..61ddbd6bb24 100644
--- a/src/devices/imagedev/snapquik.h
+++ b/src/devices/imagedev/snapquik.h
@@ -23,7 +23,7 @@ class snapshot_image_device : public device_t,
public device_image_interface
{
public:
- typedef device_delegate<std::error_condition (snapshot_image_device &)> load_delegate;
+ typedef device_delegate<std::pair<std::error_condition, std::string> (snapshot_image_device &)> load_delegate;
// construction/destruction
snapshot_image_device(const machine_config &mconfig, const char *tag, device_t *owner, const char* extensions, attotime delay = attotime::zero)
@@ -38,7 +38,7 @@ public:
void set_interface(const char *interface) { m_interface = interface; }
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual bool is_readable() const noexcept override { return true; }
virtual bool is_writeable() const noexcept override { return false; }
@@ -106,10 +106,10 @@ DECLARE_DEVICE_TYPE(QUICKLOAD, quickload_image_device)
/***************************************************************************
DEVICE CONFIGURATION MACROS
***************************************************************************/
-#define SNAPSHOT_LOAD_MEMBER(_name) std::error_condition _name(snapshot_image_device &image)
+#define SNAPSHOT_LOAD_MEMBER(_name) std::pair<std::error_condition, std::string> _name(snapshot_image_device &image)
#define DECLARE_SNAPSHOT_LOAD_MEMBER(_name) SNAPSHOT_LOAD_MEMBER(_name)
-#define QUICKLOAD_LOAD_MEMBER(_name) std::error_condition _name(snapshot_image_device &image)
+#define QUICKLOAD_LOAD_MEMBER(_name) std::pair<std::error_condition, std::string> _name(snapshot_image_device &image)
#define DECLARE_QUICKLOAD_LOAD_MEMBER(_name) QUICKLOAD_LOAD_MEMBER(_name)
#endif // MAME_DEVICES_IMAGEDEV_SNAPQUIK_H
diff --git a/src/devices/imagedev/wafadrive.cpp b/src/devices/imagedev/wafadrive.cpp
index 9e9e353da32..3bbdfa994ec 100644
--- a/src/devices/imagedev/wafadrive.cpp
+++ b/src/devices/imagedev/wafadrive.cpp
@@ -41,9 +41,9 @@ void wafadrive_image_device::device_start()
{
}
-std::error_condition wafadrive_image_device::call_load()
+std::pair<std::error_condition, std::string> wafadrive_image_device::call_load()
{
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void wafadrive_image_device::call_unload()
diff --git a/src/devices/imagedev/wafadrive.h b/src/devices/imagedev/wafadrive.h
index bc8ae6d9767..6236e6e0322 100644
--- a/src/devices/imagedev/wafadrive.h
+++ b/src/devices/imagedev/wafadrive.h
@@ -30,7 +30,7 @@ public:
virtual ~wafadrive_image_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_creatable() const noexcept override { return false; } // should be (although would need a way to specify size)
diff --git a/src/devices/machine/ds6417.cpp b/src/devices/machine/ds6417.cpp
index 75905ef80a9..f04e857473c 100644
--- a/src/devices/machine/ds6417.cpp
+++ b/src/devices/machine/ds6417.cpp
@@ -37,19 +37,19 @@ void ds6417_device::device_reset()
m_command = 0;
}
-std::error_condition ds6417_device::call_load()
+std::pair<std::error_condition, std::string> ds6417_device::call_load()
{
if(length() != 32768)
- return image_error::INVALIDLENGTH;
- return std::error_condition();
+ return std::make_pair(image_error::INVALIDLENGTH, "Incorrect image file size (must be 32K)");
+ return std::make_pair(std::error_condition(), std::string());
}
-std::error_condition ds6417_device::call_create(int format_type, util::option_resolution *format_options)
+std::pair<std::error_condition, std::string> ds6417_device::call_create(int format_type, util::option_resolution *format_options)
{
u8 buffer[32768] = {0};
if(fwrite(buffer, 32768) != 32768)
- return std::errc::io_error;
- return std::error_condition();
+ return std::make_pair(std::errc::io_error, std::string());
+ return std::make_pair(std::error_condition(), std::string());
}
uint8_t ds6417_device::calccrc(uint8_t bit, uint8_t crc) const
diff --git a/src/devices/machine/ds6417.h b/src/devices/machine/ds6417.h
index 007f2072784..457639bfcbf 100644
--- a/src/devices/machine/ds6417.h
+++ b/src/devices/machine/ds6417.h
@@ -21,8 +21,8 @@ public:
virtual bool is_reset_on_load() const noexcept override { return false; }
virtual const char *file_extensions() const noexcept override { return "bin"; }
- virtual std::error_condition call_load() override;
- virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_create(int format_type, util::option_resolution *format_options) override;
DECLARE_WRITE_LINE_MEMBER(data_w) { if(!m_read) m_data = state; }
DECLARE_WRITE_LINE_MEMBER(clock_w);
diff --git a/src/devices/machine/hp_dc100_tape.cpp b/src/devices/machine/hp_dc100_tape.cpp
index 8e735834e6c..ead54b4842c 100644
--- a/src/devices/machine/hp_dc100_tape.cpp
+++ b/src/devices/machine/hp_dc100_tape.cpp
@@ -85,12 +85,12 @@ hp_dc100_tape_device::hp_dc100_tape_device(const machine_config &mconfig, const
{
}
-std::error_condition hp_dc100_tape_device::call_load()
+std::pair<std::error_condition, std::string> hp_dc100_tape_device::call_load()
{
return internal_load(false);
}
-std::error_condition hp_dc100_tape_device::call_create(int format_type, util::option_resolution *format_options)
+std::pair<std::error_condition, std::string> hp_dc100_tape_device::call_create(int format_type, util::option_resolution *format_options)
{
return internal_load(true);
}
@@ -596,7 +596,7 @@ void hp_dc100_tape_device::clear_state()
set_tape_present(is_loaded());
}
-std::error_condition hp_dc100_tape_device::internal_load(bool is_create)
+std::pair<std::error_condition, std::string> hp_dc100_tape_device::internal_load(bool is_create)
{
LOG("load %d\n", is_create);
@@ -608,7 +608,7 @@ std::error_condition hp_dc100_tape_device::internal_load(bool is_create)
if (!io) {
LOG("out of memory\n");
set_tape_present(false);
- return std::errc::not_enough_memory;
+ return std::make_pair(std::errc::not_enough_memory, std::string());
}
m_image.clear_tape();
m_image.save_tape(*io);
@@ -617,13 +617,13 @@ std::error_condition hp_dc100_tape_device::internal_load(bool is_create)
if (!io) {
LOG("out of memory\n");
set_tape_present(false);
- return std::errc::not_enough_memory;
+ return std::make_pair(std::errc::not_enough_memory, std::string());
}
if (!m_image.load_tape(*io)) {
LOG("load failed\n");
//seterror(image_error::INVALIDIMAGE, "Wrong format");
set_tape_present(false);
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::INVALIDIMAGE, std::string());
}
}
LOG("load OK\n");
@@ -631,7 +631,7 @@ std::error_condition hp_dc100_tape_device::internal_load(bool is_create)
m_image_dirty = false;
set_tape_present(true);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void hp_dc100_tape_device::set_tape_present(bool present)
diff --git a/src/devices/machine/hp_dc100_tape.h b/src/devices/machine/hp_dc100_tape.h
index d3c1998b214..3792be1acb8 100644
--- a/src/devices/machine/hp_dc100_tape.h
+++ b/src/devices/machine/hp_dc100_tape.h
@@ -24,8 +24,8 @@ public:
hp_dc100_tape_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// device_image_interface implementation
- virtual std::error_condition call_load() override;
- virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_create(int format_type, util::option_resolution *format_options) override;
virtual void call_unload() override;
virtual std::string call_display() override;
virtual const char *file_extensions() const noexcept override;
@@ -157,7 +157,7 @@ private:
bool m_image_dirty;
void clear_state();
- std::error_condition internal_load(bool is_create);
+ std::pair<std::error_condition, std::string> internal_load(bool is_create);
void set_tape_present(bool present);
double compute_set_point(tape_speed_t speed , bool fwd) const;
void start_tape();
diff --git a/src/devices/machine/i7220.cpp b/src/devices/machine/i7220.cpp
index dcb8697f936..b625172eba1 100644
--- a/src/devices/machine/i7220.cpp
+++ b/src/devices/machine/i7220.cpp
@@ -108,13 +108,13 @@ void i7220_device::device_reset()
memset(&m_regs, 0, sizeof(m_regs));
}
-std::error_condition i7220_device::call_load()
+std::pair<std::error_condition, std::string> i7220_device::call_load()
{
if (length() != (m_data_size * I7110_MBM_SIZE))
{
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, std::string());
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/devices/machine/i7220.h b/src/devices/machine/i7220.h
index ce47c9991e1..a7c6a585e0e 100644
--- a/src/devices/machine/i7220.h
+++ b/src/devices/machine/i7220.h
@@ -50,7 +50,7 @@ public:
void set_data_size(int data_size) { m_data_size = data_size; }
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual bool is_readable() const noexcept override { return true; }
virtual bool is_writeable() const noexcept override { return true; }
diff --git a/src/devices/machine/pccard_sram.cpp b/src/devices/machine/pccard_sram.cpp
index 50c3ca0b226..f5cc6044335 100644
--- a/src/devices/machine/pccard_sram.cpp
+++ b/src/devices/machine/pccard_sram.cpp
@@ -173,22 +173,22 @@ pccard_mitsubishi_sram_device::pccard_mitsubishi_sram_device(const machine_confi
{
}
-std::error_condition pccard_mitsubishi_sram_device::call_load()
+std::pair<std::error_condition, std::string> pccard_mitsubishi_sram_device::call_load()
{
card_inserted(false);
if (length() != m_sram.bytes())
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, std::string());
if (fread(&m_sram[0], m_sram.bytes()) != m_sram.bytes())
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
card_inserted(true);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
-std::error_condition pccard_mitsubishi_sram_device::call_create(int format_type, util::option_resolution *format_options)
+std::pair<std::error_condition, std::string> pccard_mitsubishi_sram_device::call_create(int format_type, util::option_resolution *format_options)
{
card_inserted(false);
@@ -196,11 +196,11 @@ std::error_condition pccard_mitsubishi_sram_device::call_create(int format_type,
std::fill_n(&m_sram[0], m_sram.length(), 0);
if (fwrite(&m_sram[0], m_sram.bytes()) != m_sram.bytes())
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
card_inserted(true);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void pccard_mitsubishi_sram_device::call_unload()
@@ -255,25 +255,25 @@ pccard_centennial_sram_device::pccard_centennial_sram_device(const machine_confi
{
}
-std::error_condition pccard_centennial_sram_device::call_load()
+std::pair<std::error_condition, std::string> pccard_centennial_sram_device::call_load()
{
card_inserted(false);
if (length() != m_sram.bytes() + m_eeprom.bytes())
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, std::string());
if (fread(&m_sram[0], m_sram.bytes()) != m_sram.bytes())
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
if (fread(&m_eeprom[0], m_eeprom.bytes()) != m_eeprom.bytes())
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
card_inserted(true);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
-std::error_condition pccard_centennial_sram_device::call_create(int format_type, util::option_resolution *format_options)
+std::pair<std::error_condition, std::string> pccard_centennial_sram_device::call_create(int format_type, util::option_resolution *format_options)
{
card_inserted(false);
@@ -284,14 +284,14 @@ std::error_condition pccard_centennial_sram_device::call_create(int format_type,
std::copy_n(m_eeprom_default->base(), m_eeprom.length(), &m_eeprom[0]);
if (fwrite(&m_sram[0], m_sram.bytes()) != m_sram.bytes())
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
if (fwrite(&m_eeprom[0], m_eeprom.bytes()) != m_eeprom.bytes())
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
card_inserted(true);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void pccard_centennial_sram_device::call_unload()
diff --git a/src/devices/machine/pccard_sram.h b/src/devices/machine/pccard_sram.h
index dc17aded95a..f51e21798cb 100644
--- a/src/devices/machine/pccard_sram.h
+++ b/src/devices/machine/pccard_sram.h
@@ -77,8 +77,8 @@ protected:
protected:
// device_image_interface overrides
- virtual std::error_condition call_load() override;
- virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_create(int format_type, util::option_resolution *format_options) override;
virtual void call_unload() override;
private:
@@ -102,8 +102,8 @@ protected:
protected:
// device_image_interface overrides
- virtual std::error_condition call_load() override;
- virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_create(int format_type, util::option_resolution *format_options) override;
virtual void call_unload() override;
private:
diff --git a/src/devices/machine/smartmed.cpp b/src/devices/machine/smartmed.cpp
index 60b2f775b4f..18c86f7cc70 100644
--- a/src/devices/machine/smartmed.cpp
+++ b/src/devices/machine/smartmed.cpp
@@ -216,7 +216,7 @@ std::error_condition smartmedia_image_device::smartmedia_format_2()
return std::error_condition();
}
-std::error_condition smartmedia_image_device::call_load()
+std::pair<std::error_condition, std::string> smartmedia_image_device::call_load()
{
std::error_condition result;
// try format 1
@@ -228,7 +228,7 @@ std::error_condition smartmedia_image_device::call_load()
fseek(position, SEEK_SET);
result = smartmedia_format_2();
}
- return result;
+ return std::make_pair(result, std::string());
}
/*
diff --git a/src/devices/machine/smartmed.h b/src/devices/machine/smartmed.h
index b9c7e662764..0799f8c1063 100644
--- a/src/devices/machine/smartmed.h
+++ b/src/devices/machine/smartmed.h
@@ -32,7 +32,7 @@ public:
virtual const char *image_interface() const noexcept override { return "sm_memc"; }
virtual const char *file_extensions() const noexcept override { return "smc"; }
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
// Because nand_device is a NVRAM device now, stub these to make it not do anything (read only)
diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp
index 37fd470a455..813baee1841 100644
--- a/src/emu/debug/debugcmd.cpp
+++ b/src/emu/debug/debugcmd.cpp
@@ -3991,11 +3991,19 @@ void debugger_commands::execute_mount(const std::vector<std::string_view> &param
{
if ((img.instance_name() == params[0]) || (img.brief_instance_name() == params[0]))
{
- std::error_condition err = img.load(params[1]);
- if (err)
- m_console.printf("Unable to mount file %s on %s: %s\n", params[1], params[0], err.message());
- else
+ auto [err, msg] = img.load(params[1]);
+ if (!err)
+ {
m_console.printf("File %s mounted on %s\n", params[1], params[0]);
+ }
+ else
+ {
+ m_console.printf(
+ "Unable to mount file %s on %s: %s\n",
+ params[1],
+ params[0],
+ !msg.empty() ? msg : err.message());
+ }
return;
}
}
diff --git a/src/emu/diimage.cpp b/src/emu/diimage.cpp
index 00002b3ceac..b03b0cf564c 100644
--- a/src/emu/diimage.cpp
+++ b/src/emu/diimage.cpp
@@ -656,9 +656,9 @@ std::error_condition device_image_interface::load_software(software_list_device
// load_internal - core image loading
//-------------------------------------------------
-std::error_condition device_image_interface::load_internal(std::string_view path, bool is_create, int create_format, util::option_resolution *create_args)
+std::pair<std::error_condition, std::string> device_image_interface::load_internal(std::string_view path, bool is_create, int create_format, util::option_resolution *create_args)
{
- std::error_condition err;
+ std::pair<std::error_condition, std::string> err;
// first unload the image
unload();
@@ -678,15 +678,15 @@ std::error_condition device_image_interface::load_internal(std::string_view path
for (auto iter = open_plan.cbegin(); !m_file && iter != open_plan.cend(); iter++)
{
// open the file
- err = load_image_by_path(*iter, path);
- if (err && (err != std::errc::no_such_file_or_directory) && (err != std::errc::permission_denied))
+ err.first = load_image_by_path(*iter, path);
+ if (err.first && (err.first != std::errc::no_such_file_or_directory) && (err.first != std::errc::permission_denied))
goto done;
}
// did we fail to find the file?
if (!m_file)
{
- err = std::errc::no_such_file_or_directory;
+ err.first = std::errc::no_such_file_or_directory;
goto done;
}
}
@@ -699,15 +699,17 @@ std::error_condition device_image_interface::load_internal(std::string_view path
err = finish_load();
done:
- if (err)
+ if (err.first)
{
- if (!init_phase())
- {
- if (device().machine().phase() == machine_phase::RUNNING)
- device().popmessage("Error: Unable to %s image '%s': %s", is_create ? "create" : "load", path, err.message());
- else
- osd_printf_error("Error: Unable to %s image '%s': %s\n", is_create ? "create" : "load", path, err.message());
- }
+ osd_printf_error(
+ !err.second.empty()
+ ? (is_create ? "Unable to create image '%1$s': %2$s (%3$s:%4$d %5$s)\n" : "Unable to load image '%1$s': %2$s (%3$s:%4$d %5$s)\n")
+ : (is_create ? "Unable to create image '%1$s': %5$s (%3$s:%4$d)\n" : "Unable to load image '%1$s': %5$s (%3$s:%4$d)\n"),
+ path,
+ err.second,
+ err.first.category().name(),
+ err.first.value(),
+ err.first.message());
clear();
}
return err;
@@ -718,13 +720,13 @@ done:
// load - load an image into MAME
//-------------------------------------------------
-std::error_condition device_image_interface::load(std::string_view path)
+std::pair<std::error_condition, std::string> device_image_interface::load(std::string_view path)
{
// is this a reset on load item?
if (is_reset_on_load() && !init_phase())
{
reset_and_load(path);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
return load_internal(path, false, 0, nullptr);
@@ -735,13 +737,13 @@ std::error_condition device_image_interface::load(std::string_view path)
// load_software - loads a softlist item by name
//-------------------------------------------------
-std::error_condition device_image_interface::load_software(std::string_view software_identifier)
+std::pair<std::error_condition, std::string> device_image_interface::load_software(std::string_view software_identifier)
{
// Is this a software part that forces a reset and we're at runtime? If so, get this loaded through reset_and_load
if (is_reset_on_load() && !init_phase())
{
reset_and_load(software_identifier);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
// Prepare to load
@@ -753,7 +755,7 @@ std::error_condition device_image_interface::load_software(std::string_view soft
if (err)
{
m_is_loading = false;
- return err;
+ return std::make_pair(err, std::string());
}
// set up softlist stuff
@@ -763,9 +765,10 @@ std::error_condition device_image_interface::load_software(std::string_view soft
m_image_name = m_full_software_name;
m_basename = m_full_software_name;
m_basename_noext = m_full_software_name;
- m_filetype = use_software_list_file_extension_for_filetype() && m_mame_file != nullptr
- ? std::string(core_filename_extract_extension(m_mame_file->filename(), true))
- : "";
+ if (use_software_list_file_extension_for_filetype() && m_mame_file)
+ m_filetype = core_filename_extract_extension(m_mame_file->filename(), true);
+ else
+ m_filetype.clear();
// Copy some image information when we have been loaded through a software list
software_info &swinfo = m_software_part_ptr->info();
@@ -784,7 +787,7 @@ std::error_condition device_image_interface::load_software(std::string_view soft
if (!init_phase())
return finish_load();
else
- return std::error_condition();
+ return make_pair(std::error_condition(), std::string());
}
@@ -793,25 +796,20 @@ std::error_condition device_image_interface::load_software(std::string_view soft
// from core
//-------------------------------------------------
-std::error_condition device_image_interface::finish_load()
+std::pair<std::error_condition, std::string> device_image_interface::finish_load()
{
- std::error_condition err;
+ std::pair<std::error_condition, std::string> err;
if (m_is_loading)
{
- err = image_checkhash();
+ err.first = image_checkhash();
- if (!err)
+ if (!err.first)
{
if (m_created)
- {
err = call_create(m_create_format, m_create_args);
- }
else
- {
- // using device load
- err = call_load();
- }
+ err = call_load(); // using device load
}
}
m_is_loading = false;
@@ -825,7 +823,7 @@ std::error_condition device_image_interface::finish_load()
// create - create a image
//-------------------------------------------------
-std::error_condition device_image_interface::create(std::string_view path)
+std::pair<std::error_condition, std::string> device_image_interface::create(std::string_view path)
{
return create(path, nullptr, nullptr);
}
@@ -835,13 +833,14 @@ std::error_condition device_image_interface::create(std::string_view path)
// create - create a image
//-------------------------------------------------
-std::error_condition device_image_interface::create(std::string_view path, const image_device_format *create_format, util::option_resolution *create_args)
+std::pair<std::error_condition, std::string> device_image_interface::create(std::string_view path, const image_device_format *create_format, util::option_resolution *create_args)
{
int format_index = 0;
int cnt = 0;
for (auto &format : m_formatlist)
{
- if (create_format == format.get()) {
+ if (create_format == format.get())
+ {
format_index = cnt;
break;
}
diff --git a/src/emu/diimage.h b/src/emu/diimage.h
index 643c3d30dd8..53a4e8394b7 100644
--- a/src/emu/diimage.h
+++ b/src/emu/diimage.h
@@ -76,8 +76,8 @@ public:
device_image_interface(const machine_config &mconfig, device_t &device);
virtual ~device_image_interface();
- virtual std::error_condition call_load() { return std::error_condition(); }
- virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) { return std::error_condition(); }
+ virtual std::pair<std::error_condition, std::string> call_load() { return std::make_pair(std::error_condition(), std::string()); }
+ virtual std::pair<std::error_condition, std::string> call_create(int format_type, util::option_resolution *format_options) { return std::make_pair(std::error_condition(), std::string()); }
virtual void call_unload() { }
virtual std::string call_display() { return std::string(); }
virtual u32 unhashed_header_length() const noexcept { return 0; }
@@ -188,15 +188,15 @@ public:
const formatlist_type &formatlist() const { return m_formatlist; }
// loads an image file
- std::error_condition load(std::string_view path);
+ std::pair<std::error_condition, std::string> load(std::string_view path);
// loads a softlist item by name
- std::error_condition load_software(std::string_view software_identifier);
+ std::pair<std::error_condition, std::string> load_software(std::string_view software_identifier);
- std::error_condition finish_load();
+ std::pair<std::error_condition, std::string> finish_load();
void unload();
- std::error_condition create(std::string_view path, const image_device_format *create_format, util::option_resolution *create_args);
- std::error_condition create(std::string_view path);
+ std::pair<std::error_condition, std::string> create(std::string_view path, const image_device_format *create_format, util::option_resolution *create_args);
+ std::pair<std::error_condition, std::string> create(std::string_view path);
std::error_condition load_software(software_list_device &swlist, std::string_view swname, const rom_entry *entry);
std::error_condition reopen_for_write(std::string_view path);
@@ -215,7 +215,7 @@ protected:
virtual const software_list_loader &get_software_list_loader() const;
virtual bool use_software_list_file_extension_for_filetype() const noexcept { return false; }
- std::error_condition load_internal(std::string_view path, bool is_create, int create_format, util::option_resolution *create_args);
+ std::pair<std::error_condition, std::string> load_internal(std::string_view path, bool is_create, int create_format, util::option_resolution *create_args);
std::error_condition load_image_by_path(u32 open_flags, std::string_view path);
void clear() noexcept;
bool is_loaded() const noexcept { return m_file != nullptr; }
diff --git a/src/emu/image.cpp b/src/emu/image.cpp
index 241b117f12f..b808c599250 100644
--- a/src/emu/image.cpp
+++ b/src/emu/image.cpp
@@ -51,27 +51,23 @@ image_manager::image_manager(running_machine &machine)
if (!startup_image.empty())
{
// we do have a startup image specified - load it
- std::error_condition result = image_error::UNSPECIFIED;
+ std::pair<std::error_condition, std::string> result(image_error::UNSPECIFIED, std::string());
// try as a softlist
if (software_name_parse(startup_image))
result = image.load_software(startup_image);
// failing that, try as an image
- if (result)
+ if (result.first)
result = image.load(startup_image);
// failing that, try creating it (if appropriate)
- if (result && image.support_command_line_image_creation())
+ if (result.first && image.support_command_line_image_creation())
result = image.create(startup_image);
// did the image load fail?
- if (result)
+ if (result.first)
{
- // retrieve image error message
- std::string image_err = std::string(result.message());
- std::string startup_image_name = startup_image;
-
// unload the bad image
image.unload();
@@ -80,11 +76,18 @@ image_manager::image_manager(running_machine &machine)
if (machine.options().write_config())
write_config(machine.options(), nullptr, &machine.system());
- throw emu_fatalerror(EMU_ERR_DEVICE, "Device %s load (-%s %s) failed: %s",
+ // retrieve image error message
+ throw emu_fatalerror(EMU_ERR_DEVICE,
+ !result.second.empty()
+ ? "Device %1$s load (-%2$s %3$s) failed: %4$s (%5$s:%6$d %7$s)"
+ : "Device %1$s load (-%2$s %3$s) failed: %7$s (%5$s:%6$d)",
image.device().name(),
image.instance_name(),
- startup_image_name,
- image_err);
+ startup_image,
+ result.second,
+ result.first.category().name(),
+ result.first.value(),
+ result.first.message());
}
}
}
@@ -243,13 +246,14 @@ void image_manager::postdevice_init()
/* make sure that any required devices have been allocated */
for (device_image_interface &image : image_interface_enumerator(machine().root_device()))
{
- std::error_condition result = image.finish_load();
+ auto [result, image_err] = image.finish_load();
/* did the image load fail? */
if (result)
{
/* retrieve image error message */
- std::string image_err = std::string(result.message());
+ if (image_err.empty())
+ image_err = result.message();
/* unload all images */
unload_all();
diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp
index 890ac5b5953..de7a651045e 100644
--- a/src/frontend/mame/luaengine.cpp
+++ b/src/frontend/mame/luaengine.cpp
@@ -1831,11 +1831,41 @@ void lua_engine::initialize()
auto image_type = sol().registry().new_usertype<device_image_interface>("image", sol::no_constructor);
- image_type["load"] = &device_image_interface::load;
- image_type["load_software"] = static_cast<std::error_condition (device_image_interface::*)(std::string_view)>(&device_image_interface::load_software);
- image_type["unload"] = &device_image_interface::unload;
- image_type["create"] = static_cast<std::error_condition (device_image_interface::*)(std::string_view)>(&device_image_interface::create);
- image_type["display"] = &device_image_interface::call_display;
+ image_type.set_function("load",
+ [] (device_image_interface &di, sol::this_state s, std::string_view path) -> sol::object
+ {
+ auto [err, message] = di.load(path);
+ if (!err)
+ return sol::lua_nil;
+ else if (!message.empty())
+ return sol::make_object(s, message);
+ else
+ return sol::make_object(s, err.message());
+ });
+ image_type.set_function("load_software",
+ [] (device_image_interface &di, sol::this_state s, std::string_view identifier) -> sol::object
+ {
+ auto [err, message] = di.load_software(identifier);
+ if (!err)
+ return sol::lua_nil;
+ else if (!message.empty())
+ return sol::make_object(s, message);
+ else
+ return sol::make_object(s, err.message());
+ });
+ image_type.set_function("unload", &device_image_interface::unload);
+ image_type.set_function("create",
+ [] (device_image_interface &di, sol::this_state s, std::string_view path) -> sol::object
+ {
+ auto [err, message] = di.create(path);
+ if (!err)
+ return sol::lua_nil;
+ else if (!message.empty())
+ return sol::make_object(s, message);
+ else
+ return sol::make_object(s, err.message());
+ });
+ image_type.set_function("display", &device_image_interface::call_display);
image_type["is_readable"] = sol::property(&device_image_interface::is_readable);
image_type["is_writeable"] = sol::property(&device_image_interface::is_writeable);
image_type["is_creatable"] = sol::property(&device_image_interface::is_creatable);
diff --git a/src/frontend/mame/ui/filemngr.cpp b/src/frontend/mame/ui/filemngr.cpp
index 47cfd7be4fa..8487d619ecf 100644
--- a/src/frontend/mame/ui/filemngr.cpp
+++ b/src/frontend/mame/ui/filemngr.cpp
@@ -173,30 +173,44 @@ void menu_file_manager::populate()
bool menu_file_manager::handle(event const *ev)
{
- if (!ev || !ev->itemref || (ev->iptkey != IPT_UI_SELECT))
- return false;
+ bool result = false;
- if ((uintptr_t)ev->itemref == 1)
+ if (ev)
{
- machine().schedule_hard_reset();
- }
- else
- {
- selected_device = (device_image_interface *) ev->itemref;
- if (selected_device)
+ if ((uintptr_t)ev->itemref == 1)
{
- floppy_image_device *floppy_device = dynamic_cast<floppy_image_device *>(selected_device);
- if (floppy_device)
- menu::stack_push<menu_control_floppy_image>(ui(), container(), *floppy_device);
- else
- menu::stack_push<menu_control_device_image>(ui(), container(), *selected_device);
-
- // reset the existing menu
- reset(reset_options::REMEMBER_POSITION);
+ if (selected_device)
+ {
+ selected_device = nullptr;
+ result = true;
+ }
+
+ if (IPT_UI_SELECT == ev->iptkey)
+ machine().schedule_hard_reset();
+ }
+ else
+ {
+ if (ev->itemref != selected_device)
+ {
+ selected_device = (device_image_interface *)ev->itemref;
+ result = true;
+ }
+
+ if (selected_device && (IPT_UI_SELECT == ev->iptkey))
+ {
+ floppy_image_device *floppy_device = dynamic_cast<floppy_image_device *>(selected_device);
+ if (floppy_device)
+ menu::stack_push<menu_control_floppy_image>(ui(), container(), *floppy_device);
+ else
+ menu::stack_push<menu_control_device_image>(ui(), container(), *selected_device);
+
+ // reset the existing menu
+ reset(reset_options::REMEMBER_POSITION);
+ }
}
}
- return false;
+ return result;
}
// force file manager menu
diff --git a/src/frontend/mame/ui/floppycntrl.cpp b/src/frontend/mame/ui/floppycntrl.cpp
index 1eef3772498..523d539b2a4 100644
--- a/src/frontend/mame/ui/floppycntrl.cpp
+++ b/src/frontend/mame/ui/floppycntrl.cpp
@@ -41,25 +41,27 @@ menu_control_floppy_image::~menu_control_floppy_image()
void menu_control_floppy_image::do_load_create()
{
if(input_filename.empty()) {
- std::error_condition err = fd.create(output_filename, nullptr, nullptr);
+ auto [err, message] = fd.create(output_filename, nullptr, nullptr);
if (err) {
- machine().popmessage("Error: %s", err.message());
+ machine().popmessage(_("Error creating floppy image: %1$s"), !message.empty() ? message : err.message());
return;
}
if (create_fs) {
// HACK: ensure the floppy_image structure is created since device_image_interface may not otherwise do so during "init phase"
- err = fd.finish_load();
+ err = fd.finish_load().first;
if (!err) {
fs::meta_data meta;
fd.init_fs(create_fs, meta);
}
}
} else {
- std::error_condition err = fd.load(input_filename);
- if (!err && !output_filename.empty())
+ auto [err, message] = fd.load(input_filename);
+ if (!err && !output_filename.empty()) {
+ message.clear();
err = fd.reopen_for_write(output_filename);
+ }
if (err) {
- machine().popmessage("Error: %s", err.message());
+ machine().popmessage(_("Error opening floppy image: %1$s"), !message.empty() ? message : err.message());
return;
}
}
diff --git a/src/frontend/mame/ui/imgcntrl.cpp b/src/frontend/mame/ui/imgcntrl.cpp
index 04542167200..3b1253d755c 100644
--- a/src/frontend/mame/ui/imgcntrl.cpp
+++ b/src/frontend/mame/ui/imgcntrl.cpp
@@ -159,7 +159,9 @@ void menu_control_device_image::load_software_part()
// if everything looks good, load software
if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED)
{
- m_image.load_software(temp_name);
+ auto [err, msg] = m_image.load_software(temp_name);
+ if (err)
+ machine().popmessage(_("Error loading software item: %1$s"), !msg.empty() ? msg : err.message());
stack_pop();
}
else
@@ -177,7 +179,9 @@ void menu_control_device_image::load_software_part()
void menu_control_device_image::hook_load(const std::string &name)
{
- m_image.load(name);
+ auto [err, msg] = m_image.load(name);
+ if (err)
+ machine().popmessage(_("Error loading media image: %1$s"), !msg.empty() ? msg : err.message());
stack_pop();
}
@@ -212,7 +216,15 @@ void menu_control_device_image::menu_activated()
{
case START_FILE:
m_submenu_result.filesel = menu_file_selector::result::INVALID;
- menu::stack_push<menu_file_selector>(ui(), container(), &m_image, m_current_directory, m_current_file, true, m_image.image_interface()!=nullptr, m_image.is_creatable(), m_submenu_result.filesel);
+ menu::stack_push<menu_file_selector>(
+ ui(), container(),
+ &m_image,
+ m_current_directory,
+ m_current_file,
+ true,
+ m_image.image_interface() != nullptr,
+ m_image.is_creatable(),
+ m_submenu_result.filesel);
m_state = SELECT_FILE;
break;
@@ -370,9 +382,9 @@ void menu_control_device_image::menu_activated()
case DO_CREATE:
{
auto path = util::zippath_combine(m_current_directory, m_current_file);
- std::error_condition err = m_image.create(path, nullptr, nullptr);
+ auto [err, msg] = m_image.create(path, nullptr, nullptr);
if (err)
- machine().popmessage("Error: %s", err.message());
+ machine().popmessage(_("Error creating media image: %1$s"), !msg.empty() ? msg : err.message());
stack_pop();
}
break;
diff --git a/src/mame/acorn/atom.cpp b/src/mame/acorn/atom.cpp
index 9b58b8ab571..019cfc67b4a 100644
--- a/src/mame/acorn/atom.cpp
+++ b/src/mame/acorn/atom.cpp
@@ -187,7 +187,7 @@ QUICKLOAD_LOAD_MEMBER(atom_state::quickload_cb)
else
m_maincpu->set_state_int(M6502_PC, run_address); // if not basic, autostart program (set_pc doesn't work)
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
/***************************************************************************
@@ -679,20 +679,17 @@ void atomeb_state::machine_reset()
MACHINE DRIVERS
***************************************************************************/
-std::error_condition atom_state::load_cart(device_image_interface &image, generic_slot_device &slot)
+std::pair<std::error_condition, std::string> atom_state::load_cart(device_image_interface &image, generic_slot_device &slot)
{
uint32_t size = slot.common_get_size("rom");
if (size > 0x1000)
- {
- osd_printf_error("%s: Unsupported ROM size\n", image.basename());
- return image_error::INVALIDIMAGE;
- }
+ return std::make_pair(image_error::INVALIDIMAGE, "Unsupported ROM size (must be no larger than 4K)");
slot.rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
slot.common_load_rom(slot.get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
static void atom_floppies(device_slot_interface &device)
diff --git a/src/mame/acorn/atom.h b/src/mame/acorn/atom.h
index 16c5b246385..9d8f5b7c1ed 100644
--- a/src/mame/acorn/atom.h
+++ b/src/mame/acorn/atom.h
@@ -100,7 +100,7 @@ protected:
static void floppy_formats(format_registration &fr);
DECLARE_WRITE_LINE_MEMBER(cassette_output_tick);
- std::error_condition load_cart(device_image_interface &image, generic_slot_device &slot);
+ std::pair<std::error_condition, std::string> load_cart(device_image_interface &image, generic_slot_device &slot);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(cart_load) { return load_cart(image, *m_cart); }
DECLARE_QUICKLOAD_LOAD_MEMBER(quickload_cb);
void atom_mem(address_map &map);
diff --git a/src/mame/acorn/electron.h b/src/mame/acorn/electron.h
index 004bb6f28dd..68b28a38f24 100644
--- a/src/mame/acorn/electron.h
+++ b/src/mame/acorn/electron.h
@@ -181,7 +181,7 @@ private:
uint8_t m_sp64_bank = 0;
std::unique_ptr<uint8_t[]> m_sp64_ram;
- std::error_condition load_rom(device_image_interface &image, generic_slot_device *slot);
+ std::pair<std::error_condition, std::string> load_rom(device_image_interface &image, generic_slot_device *slot);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom1_load) { return load_rom(image, m_romi[0]); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom2_load) { return load_rom(image, m_romi[1]); }
};
diff --git a/src/mame/acorn/electron_m.cpp b/src/mame/acorn/electron_m.cpp
index fc4c468b76c..c0b3a83ed37 100644
--- a/src/mame/acorn/electron_m.cpp
+++ b/src/mame/acorn/electron_m.cpp
@@ -627,16 +627,13 @@ void electronsp_state::machine_start()
}
-std::error_condition electronsp_state::load_rom(device_image_interface &image, generic_slot_device *slot)
+std::pair<std::error_condition, std::string> electronsp_state::load_rom(device_image_interface &image, generic_slot_device *slot)
{
uint32_t size = slot->common_get_size("rom");
// socket accepts 8K and 16K ROM only
if (size != 0x2000 && size != 0x4000)
- {
- osd_printf_error("%s: Invalid size: Only 8K/16K is supported\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid size: Only 8K/16K is supported");
slot->rom_alloc(0x4000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
slot->common_load_rom(slot->get_rom_base(), size, "rom");
@@ -645,5 +642,5 @@ std::error_condition electronsp_state::load_rom(device_image_interface &image, g
uint8_t *crt = slot->get_rom_base();
if (size <= 0x2000) memcpy(crt + 0x2000, crt, 0x2000);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/acorn/z88_impexp.cpp b/src/mame/acorn/z88_impexp.cpp
index 5669deb85ca..99f564d9b40 100644
--- a/src/mame/acorn/z88_impexp.cpp
+++ b/src/mame/acorn/z88_impexp.cpp
@@ -136,7 +136,7 @@ void z88_impexp_device::check_filename(std::string &filename)
}
-std::error_condition z88_impexp_device::call_load()
+std::pair<std::error_condition, std::string> z88_impexp_device::call_load()
{
m_mode = MODE_SEND;
m_queue = std::queue<uint8_t>();
@@ -180,7 +180,7 @@ std::error_condition z88_impexp_device::call_load()
{
uint8_t b;
if (fread(&b, 1) != 1)
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
// Escape non printable characters
if ((b < 0x20 || b >= 0x7f) && b != 0x0a && b != 0x0d && b != 0x09)
@@ -205,15 +205,15 @@ std::error_condition z88_impexp_device::call_load()
m_queue.push('E');
queue();
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
-std::error_condition z88_impexp_device::call_create(int format_type, util::option_resolution *format_options)
+std::pair<std::error_condition, std::string> z88_impexp_device::call_create(int format_type, util::option_resolution *format_options)
{
m_queue = std::queue<uint8_t>();
m_mode = MODE_RECV;
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/acorn/z88_impexp.h b/src/mame/acorn/z88_impexp.h
index 5810298c5c3..85a0c3c3751 100644
--- a/src/mame/acorn/z88_impexp.h
+++ b/src/mame/acorn/z88_impexp.h
@@ -34,9 +34,9 @@ protected:
virtual void rcv_complete() override;
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
- virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
+ virtual std::pair<std::error_condition, std::string> call_create(int format_type, util::option_resolution *format_options) override;
virtual bool is_readable() const noexcept override { return true; }
virtual bool is_writeable() const noexcept override { return true; }
diff --git a/src/mame/altos/altos5.cpp b/src/mame/altos/altos5.cpp
index 998488fd4a7..b436cb7d592 100644
--- a/src/mame/altos/altos5.cpp
+++ b/src/mame/altos/altos5.cpp
@@ -307,7 +307,7 @@ QUICKLOAD_LOAD_MEMBER(altos5_state::quickload_cb)
address_space& prog_space = m_maincpu->space(AS_PROGRAM);
if (image.length() >= 0xfd00)
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, std::string());
setup_banks(2);
@@ -315,7 +315,7 @@ QUICKLOAD_LOAD_MEMBER(altos5_state::quickload_cb)
if ((prog_space.read_byte(0) != 0xc3) || (prog_space.read_byte(5) != 0xc3))
{
machine_reset();
- return image_error::UNSUPPORTED;
+ return std::make_pair(image_error::UNSUPPORTED, std::string());
}
/* Load image to the TPA (Transient Program Area) */
@@ -325,7 +325,7 @@ QUICKLOAD_LOAD_MEMBER(altos5_state::quickload_cb)
uint8_t data;
if (image.fread( &data, 1) != 1)
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
prog_space.write_byte(i+0x100, data);
}
@@ -336,7 +336,7 @@ QUICKLOAD_LOAD_MEMBER(altos5_state::quickload_cb)
m_maincpu->set_state_int(Z80_SP, 256 * prog_space.read_byte(7) - 300);
m_maincpu->set_pc(0x100); // start program
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/amstrad/amstrad_m.cpp b/src/mame/amstrad/amstrad_m.cpp
index 10c7703edf1..2914544398b 100644
--- a/src/mame/amstrad/amstrad_m.cpp
+++ b/src/mame/amstrad/amstrad_m.cpp
@@ -3251,7 +3251,7 @@ SNAPSHOT_LOAD_MEMBER(amstrad_state::snapshot_cb)
{
/* get file size */
if (image.length() < 8)
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, std::string());
std::vector<uint8_t> snapshot(image.length());
@@ -3259,12 +3259,10 @@ SNAPSHOT_LOAD_MEMBER(amstrad_state::snapshot_cb)
image.fread(&snapshot[0], image.length());
if (memcmp(&snapshot[0], "MV - SNA", 8))
- {
- return image_error::INVALIDIMAGE;
- }
+ return std::make_pair(image_error::INVALIDIMAGE, std::string());
amstrad_handle_snapshot(&snapshot[0]);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
@@ -3305,12 +3303,9 @@ DEVICE_IMAGE_LOAD_MEMBER(amstrad_state::amstrad_plus_cartridge)
// not an RIFF format file, assume raw binary (*.bin)
logerror("IMG: raw CPC+ cartridge file\n");
if (size % 0x4000)
- {
- osd_printf_error("%s: Attempt to load a raw binary with some block smaller than 16kB in size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
- else
- image.fread(m_cart->get_rom_base(), size);
+ return std::make_pair(image_error::INVALIDLENGTH, "Attempt to load a raw binary with some block smaller than 16kB in size");
+
+ image.fread(m_cart->get_rom_base(), size);
}
else
{
@@ -3336,10 +3331,7 @@ DEVICE_IMAGE_LOAD_MEMBER(amstrad_state::amstrad_plus_cartridge)
// Is RIFF format (*.cpr)
if (strncmp((const char*)(header + 8), "AMS!", 4) != 0)
- {
- osd_printf_error("%s: Not an Amstrad CPC cartridge image (despite RIFF header)\n", image.basename());
- return image_error::INVALIDIMAGE;
- }
+ return std::make_pair(image_error::INVALIDIMAGE, "Not an Amstrad CPC cartridge image (despite RIFF header)");
bytes_to_read = header[4] + (header[5] << 8) + (header[6] << 16)+ (header[7] << 24);
bytes_to_read -= 4; // account for AMS! header
@@ -3390,5 +3382,5 @@ DEVICE_IMAGE_LOAD_MEMBER(amstrad_state::amstrad_plus_cartridge)
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/amstrad/pda600.cpp b/src/mame/amstrad/pda600.cpp
index 69dd3d324d8..deb73b749cb 100644
--- a/src/mame/amstrad/pda600.cpp
+++ b/src/mame/amstrad/pda600.cpp
@@ -486,7 +486,7 @@ DEVICE_IMAGE_LOAD_MEMBER(pda600_state::card_load)
m_card->ram_alloc(size);
if (size != image.fread(m_card->get_ram_base(), size))
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
m_card_size = size;
}
@@ -495,14 +495,14 @@ DEVICE_IMAGE_LOAD_MEMBER(pda600_state::card_load)
m_card_size = image.get_software_region_length("rom");
if (m_card_size == 0)
- return image_error::BADSOFTWARE;
+ return std::make_pair(image_error::BADSOFTWARE, "rom data area is missing or empty");
m_card->ram_alloc(m_card_size);
memcpy(m_card->get_ram_base(), image.get_software_region("rom"), m_card_size);
}
m_card->battery_load(m_card->get_ram_base(), m_card_size, nullptr);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/apollo/apollo.h b/src/mame/apollo/apollo.h
index 69644d87ed6..25f80124fc1 100644
--- a/src/mame/apollo/apollo.h
+++ b/src/mame/apollo/apollo.h
@@ -387,8 +387,8 @@ public:
virtual bool support_command_line_image_creation() const noexcept override { return true; }
virtual const char *file_extensions() const noexcept override { return "ani,bin"; }
- virtual std::error_condition call_load() override;
- virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_create(int format_type, util::option_resolution *format_options) override;
virtual void call_unload() override;
virtual const char *image_type_name() const noexcept override { return "node_id"; }
virtual const char *image_brief_type_name() const noexcept override { return "ni"; }
diff --git a/src/mame/apollo/apollo_m.cpp b/src/mame/apollo/apollo_m.cpp
index 7912544ccbd..3f6fcb50dce 100644
--- a/src/mame/apollo/apollo_m.cpp
+++ b/src/mame/apollo/apollo_m.cpp
@@ -929,7 +929,7 @@ uint16_t apollo_ni::read(offs_t offset, uint16_t mem_mask)
/*-------------------------------------------------
DEVICE_IMAGE_LOAD( rom )
-------------------------------------------------*/
-std::error_condition apollo_ni::call_load()
+std::pair<std::error_condition, std::string> apollo_ni::call_load()
{
CLOG1(("apollo_ni::call_load: %s", filename()));
@@ -952,17 +952,17 @@ std::error_condition apollo_ni::call_load()
{
m_node_id = (((data[2] << 8) | data[4]) << 8) | (data[6]);
CLOG1(("apollo_ni::call_load: node ID is %x", m_node_id));
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
}
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
}
/*-------------------------------------------------
DEVICE_IMAGE_CREATE( rom )
-------------------------------------------------*/
-std::error_condition apollo_ni::call_create(int format_type, util::option_resolution *format_options)
+std::pair<std::error_condition, std::string> apollo_ni::call_create(int format_type, util::option_resolution *format_options)
{
CLOG1(("apollo_ni::call_create:"));
@@ -989,10 +989,10 @@ std::error_condition apollo_ni::call_create(int format_type, util::option_resolu
fwrite(data, sizeof(data));
CLOG(("apollo_ni::call_create: created %s with node ID %x", filename(), node_id));
set_node_id(node_id);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
}
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
}
/*-------------------------------------------------
diff --git a/src/mame/apple/apple1.cpp b/src/mame/apple/apple1.cpp
index 20e56734544..b810b0a5862 100644
--- a/src/mame/apple/apple1.cpp
+++ b/src/mame/apple/apple1.cpp
@@ -184,29 +184,17 @@ SNAPSHOT_LOAD_MEMBER(apple1_state::snapshot_cb)
uint64_t snapsize = image.length();
if (snapsize < 12)
- {
- logerror("Snapshot is too short\n");
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Snapshot is too short");
if ((snapsize - 12) > 65535)
- {
- logerror("Snapshot is too long\n");
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Snapshot is too long");
auto data = std::make_unique<uint8_t []>(snapsize);
if (image.fread(data.get(), snapsize) != snapsize)
- {
- logerror("Internal error loading snapshot\n");
- return image_error::UNSPECIFIED;
- }
+ return std::make_pair(image_error::UNSPECIFIED, "Internal error loading snapshot");
if ((memcmp(hd1, &data[0], 5)) || (memcmp(hd2, &data[7], 5)))
- {
- logerror("Snapshot is invalid\n");
- return image_error::INVALIDIMAGE;
- }
+ return std::make_pair(image_error::INVALIDIMAGE, "Snapshot is invalid\n");
uint16_t start = (data[5]<<8) | data[6];
uint16_t end = (snapsize - 12) + start;
@@ -214,10 +202,7 @@ SNAPSHOT_LOAD_MEMBER(apple1_state::snapshot_cb)
// check if this fits in RAM; load below 0xe000 must fit in RAMSIZE,
// load at 0xe000 must fit in 4K
if (((start < 0xe000) && (end > (m_ram_size - 1))) || (end > 0xefff))
- {
- logerror("Snapshot can't fit in RAM\n");
- return image_error::UNSUPPORTED;
- }
+ return std::make_pair(image_error::UNSUPPORTED, "Snapshot can't fit in RAM");
if (start < 0xe000)
{
@@ -229,11 +214,12 @@ SNAPSHOT_LOAD_MEMBER(apple1_state::snapshot_cb)
}
else
{
- logerror("Snapshot has invalid load address %04x\n", start);
- return image_error::INVALIDIMAGE;
+ return std::make_pair(
+ image_error::INVALIDIMAGE,
+ util::string_format("Snapshot has invalid load address %04x\n", start));
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void apple1_state::poll_keyboard()
diff --git a/src/mame/appliedconcepts/ggm.cpp b/src/mame/appliedconcepts/ggm.cpp
index 197c53ca046..c1ebc56c023 100644
--- a/src/mame/appliedconcepts/ggm.cpp
+++ b/src/mame/appliedconcepts/ggm.cpp
@@ -238,7 +238,7 @@ DEVICE_IMAGE_LOAD_MEMBER(ggm_state::load_cart)
memset(m_extram, 0, m_extram.bytes());
m_extram_enabled = image.get_feature("ram") != nullptr;
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
DEVICE_IMAGE_UNLOAD_MEMBER(ggm_state::unload_cart)
diff --git a/src/mame/atari/jaguar.cpp b/src/mame/atari/jaguar.cpp
index c40cfe3b639..1ac48ee3f32 100644
--- a/src/mame/atari/jaguar.cpp
+++ b/src/mame/atari/jaguar.cpp
@@ -1927,7 +1927,7 @@ void jaguarcd_state::init_jaguarcd()
save_item(NAME(m_joystick_data));
}
-std::error_condition jaguar_state::quickload_cb(snapshot_image_device &image)
+std::pair<std::error_condition, std::string> jaguar_state::quickload_cb(snapshot_image_device &image)
{
offs_t quickload_begin = 0x4000, start = quickload_begin, skip = 0;
@@ -1992,7 +1992,7 @@ std::error_condition jaguar_state::quickload_cb(snapshot_image_device &image)
/* Transfer control to image */
m_maincpu->set_pc(quickload_begin);
m_shared_ram[1]=quickload_begin;
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
DEVICE_IMAGE_LOAD_MEMBER( jaguar_state::cart_load )
@@ -2029,7 +2029,7 @@ DEVICE_IMAGE_LOAD_MEMBER( jaguar_state::cart_load )
/* Transfer control to the bios */
m_maincpu->reset();
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
/*************************************
diff --git a/src/mame/atari/jaguar.h b/src/mame/atari/jaguar.h
index 3faebd8c3b2..1c8ea25ca9a 100644
--- a/src/mame/atari/jaguar.h
+++ b/src/mame/atari/jaguar.h
@@ -272,7 +272,7 @@ private:
DECLARE_WRITE_LINE_MEMBER( dsp_cpu_int );
DECLARE_WRITE_LINE_MEMBER( external_int );
- std::error_condition quickload_cb(snapshot_image_device &image);
+ std::pair<std::error_condition, std::string> quickload_cb(snapshot_image_device &image);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( cart_load );
void cpu_space_map(address_map &map);
void dsp_map(address_map &map);
diff --git a/src/mame/atari/lynx.cpp b/src/mame/atari/lynx.cpp
index d465d67913f..473e96dbfbf 100644
--- a/src/mame/atari/lynx.cpp
+++ b/src/mame/atari/lynx.cpp
@@ -153,15 +153,12 @@ QUICKLOAD_LOAD_MEMBER(lynx_state::quickload_cb)
{
u8 header[10]; // 80 08 dw Start dw Len B S 9 3
if (image.fread( header, sizeof(header)) != sizeof(header))
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
/* Check the image */
- std::error_condition err = verify_cart((const char*)header, LYNX_QUICKLOAD);
- if (err)
- {
- osd_printf_error("%s: Not a valid Lynx file\n", image.basename());
+ auto err = verify_cart((const char*)header, LYNX_QUICKLOAD);
+ if (err.first)
return err;
- }
uint16_t const start = header[3] | (header[2]<<8); //! big endian format in file format for little endian cpu
uint16_t const length = (header[5] | (header[4]<<8)) - 10;
@@ -169,10 +166,7 @@ QUICKLOAD_LOAD_MEMBER(lynx_state::quickload_cb)
std::vector<u8> data;
data.resize(length);
if (image.fread(&data[0], length) != length)
- {
- osd_printf_error("%s: Invalid length in file header\n", image.basename());
- return image_error::INVALIDIMAGE;
- }
+ return std::make_pair(image_error::INVALIDIMAGE, "Invalid length in file header");
address_space &space = m_maincpu->space(AS_PROGRAM);
for (int i = 0; i < length; i++)
@@ -186,7 +180,7 @@ QUICKLOAD_LOAD_MEMBER(lynx_state::quickload_cb)
m_maincpu->set_pc(start);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
/***************************************************************************
diff --git a/src/mame/atari/lynx.h b/src/mame/atari/lynx.h
index 3b7d8409bf3..f18addbcf75 100644
--- a/src/mame/atari/lynx.h
+++ b/src/mame/atari/lynx.h
@@ -302,7 +302,7 @@ private:
void uart_reset();
void interrupt_set(u8 line);
void interrupt_update();
- std::error_condition verify_cart(const char *header, int kind);
+ std::pair<std::error_condition, std::string> verify_cart(const char *header, int kind);
DECLARE_QUICKLOAD_LOAD_MEMBER(quickload_cb);
};
diff --git a/src/mame/atari/lynx_m.cpp b/src/mame/atari/lynx_m.cpp
index 9fdc0c5c0e1..296f47daae1 100644
--- a/src/mame/atari/lynx_m.cpp
+++ b/src/mame/atari/lynx_m.cpp
@@ -2001,15 +2001,12 @@ void lynx_state::machine_start()
****************************************/
-std::error_condition lynx_state::verify_cart(const char *header, int kind)
+std::pair<std::error_condition, std::string> lynx_state::verify_cart(const char *header, int kind)
{
if (kind)
{
if (strncmp("BS93", &header[6], 4))
- {
- logerror("This is not a valid Lynx image\n");
- return image_error::INVALIDIMAGE;
- }
+ return std::make_pair(image_error::INVALIDIMAGE, "This is not a valid Lynx image");
}
else
{
@@ -2017,16 +2014,18 @@ std::error_condition lynx_state::verify_cart(const char *header, int kind)
{
if (!strncmp("BS93", &header[6], 4))
{
- logerror("This image is probably a Quickload image with .lnx extension\n");
- logerror("Try to load it with -quickload\n");
+ // FIXME: multi-line message may not be displayed correctly
+ return std::make_pair(
+ image_error::INVALIDIMAGE,
+ "This image is probably a Quickload image with .lnx extension\n"
+ "Try to load it with -quickload");
}
else
- logerror("This is not a valid Lynx image\n");
- return image_error::INVALIDIMAGE;
+ return std::make_pair(image_error::INVALIDIMAGE, "This is not a valid Lynx image");
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
DEVICE_IMAGE_LOAD_MEMBER(lynx_state::cart_load)
@@ -2052,8 +2051,8 @@ DEVICE_IMAGE_LOAD_MEMBER(lynx_state::cart_load)
image.fread(header, 0x40);
// Check the image
- std::error_condition err = verify_cart((const char*)header, LYNX_CART);
- if (err)
+ auto err = verify_cart((const char*)header, LYNX_CART);
+ if (err.first)
return err;
/* 2008-10 FP: According to Handy source these should be page_size_bank0. Are we using
@@ -2119,5 +2118,5 @@ DEVICE_IMAGE_LOAD_MEMBER(lynx_state::cart_load)
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/ausnz/aussiebyte.cpp b/src/mame/ausnz/aussiebyte.cpp
index 353a219a2c1..31611606dad 100644
--- a/src/mame/ausnz/aussiebyte.cpp
+++ b/src/mame/ausnz/aussiebyte.cpp
@@ -408,7 +408,7 @@ QUICKLOAD_LOAD_MEMBER(aussiebyte_state::quickload_cb)
address_space& prog_space = m_maincpu->space(AS_PROGRAM);
if (image.length() >= 0xfd00)
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, std::string());
/* RAM must be banked in */
m_port15 = true; // disable boot rom
@@ -420,7 +420,7 @@ QUICKLOAD_LOAD_MEMBER(aussiebyte_state::quickload_cb)
if ((prog_space.read_byte(0) != 0xc3) || (prog_space.read_byte(5) != 0xc3))
{
machine_reset();
- return image_error::UNSUPPORTED;
+ return std::make_pair(image_error::UNSUPPORTED, std::string());
}
/* Load image to the TPA (Transient Program Area) */
@@ -429,7 +429,7 @@ QUICKLOAD_LOAD_MEMBER(aussiebyte_state::quickload_cb)
{
u8 data;
if (image.fread( &data, 1) != 1)
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
prog_space.write_byte(i+0x100, data);
}
@@ -440,7 +440,7 @@ QUICKLOAD_LOAD_MEMBER(aussiebyte_state::quickload_cb)
m_maincpu->set_state_int(Z80_SP, 256 * prog_space.read_byte(7) - 0x400);
m_maincpu->set_pc(0x100); // start program
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
/***********************************************************
diff --git a/src/mame/ausnz/binbug.cpp b/src/mame/ausnz/binbug.cpp
index e1d35e1389e..b5633ccfb4d 100644
--- a/src/mame/ausnz/binbug.cpp
+++ b/src/mame/ausnz/binbug.cpp
@@ -179,70 +179,48 @@ INPUT_PORTS_END
QUICKLOAD_LOAD_MEMBER(binbug_state::quickload_cb)
{
- address_space &space = m_maincpu->space(AS_PROGRAM);
- int i;
- int quick_addr = 0x440;
- int exec_addr;
- std::vector<u8> quick_data;
- int read_;
- std::error_condition result = image_error::UNSPECIFIED;
-
int const quick_length = image.length();
if (quick_length < 0x0444)
{
- result = image_error::INVALIDLENGTH;
- osd_printf_error("%s: File too short\n", image.basename());
- image.message(" File too short");
+ return std::make_pair(image_error::INVALIDLENGTH, "File too short");
}
else if (quick_length > 0x8000)
{
- result = image_error::INVALIDLENGTH;
- osd_printf_error("%s: File too long\n", image.basename());
- image.message(" File too long");
+ return std::make_pair(image_error::INVALIDLENGTH, "File too long");
+ }
+
+ std::vector<u8> quick_data;
+ quick_data.resize(quick_length);
+ int const read_ = image.fread( &quick_data[0], quick_length);
+ if (read_ != quick_length)
+ {
+ return std::make_pair(image_error::UNSPECIFIED, "Cannot read the file");
}
- else
+ else if (quick_data[0] != 0xc4)
{
- quick_data.resize(quick_length);
- read_ = image.fread( &quick_data[0], quick_length);
- if (read_ != quick_length)
- {
- result = image_error::UNSPECIFIED;
- osd_printf_error("%s: Cannot read the file\n", image.basename());
- image.message(" Cannot read the file");
- }
- else if (quick_data[0] != 0xc4)
- {
- result = image_error::INVALIDIMAGE;
- osd_printf_error("%s: Invalid header\n", image.basename());
- image.message(" Invalid header");
- }
- else
- {
- exec_addr = quick_data[1] * 256 + quick_data[2];
-
- if (exec_addr >= quick_length)
- {
- result = image_error::INVALIDIMAGE;
- osd_printf_error("%s: Exec adress beyond end of file\n", image.basename());
- image.message(" Exec address beyond end of file");
- }
- else
- {
- for (i = quick_addr; i < read_; i++)
- space.write_byte(i, quick_data[i]);
-
- /* display a message about the loaded quickload */
- image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr);
-
- // Start the quickload
- m_maincpu->set_state_int(S2650_PC, exec_addr);
-
- result = std::error_condition();
- }
- }
+ return std::make_pair(image_error::INVALIDIMAGE, "Invalid header");
}
- return result;
+ int const exec_addr = quick_data[1] * 256 + quick_data[2];
+ if (exec_addr >= quick_length)
+ {
+ return std::make_pair(
+ image_error::INVALIDIMAGE,
+ util::string_format("Exec address %04X beyond end of file %04X", exec_addr, quick_length));
+ }
+
+ address_space &space = m_maincpu->space(AS_PROGRAM);
+ constexpr int QUICK_ADDR = 0x440;
+ for (int i = QUICK_ADDR; i < read_; i++)
+ space.write_byte(i, quick_data[i]);
+
+ // display a message about the loaded quickload
+ image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr);
+
+ // Start the quickload
+ m_maincpu->set_state_int(S2650_PC, exec_addr);
+
+ return std::make_pair(std::error_condition(), std::string());
}
static DEVICE_INPUT_DEFAULTS_START( keyboard )
diff --git a/src/mame/ausnz/d6800.cpp b/src/mame/ausnz/d6800.cpp
index 9b137c55127..7522efc820e 100644
--- a/src/mame/ausnz/d6800.cpp
+++ b/src/mame/ausnz/d6800.cpp
@@ -346,11 +346,7 @@ QUICKLOAD_LOAD_MEMBER(d6800_state::quickload_cb)
u32 const quick_length = image.length();
if (quick_length > 0xe00)
- {
- osd_printf_error("%s: File exceeds 3854 bytes\n", image.basename());
- image.message(" File exceeds 3584 bytes");
- return image_error::INVALIDIMAGE;
- }
+ return std::make_pair(image_error::INVALIDIMAGE, "File exceeds 3584 bytes");
address_space &space = m_maincpu->space(AS_PROGRAM);
for (u32 i = 0; i < quick_length; i++)
@@ -370,7 +366,7 @@ QUICKLOAD_LOAD_MEMBER(d6800_state::quickload_cb)
// Start the quickload
m_maincpu->set_pc(exec_addr);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void d6800_state::d6800(machine_config &config)
diff --git a/src/mame/ausnz/eti660.cpp b/src/mame/ausnz/eti660.cpp
index 6f301d42ab0..474a7535a64 100644
--- a/src/mame/ausnz/eti660.cpp
+++ b/src/mame/ausnz/eti660.cpp
@@ -316,37 +316,28 @@ void eti660_state::machine_start()
QUICKLOAD_LOAD_MEMBER(eti660_state::quickload_cb)
{
- address_space &space = m_maincpu->space(AS_PROGRAM);
- int i;
- int quick_addr = 0x600;
- int quick_length;
+ int const quick_length = image.length();
std::vector<u8> quick_data;
- std::error_condition result = image_error::UNSPECIFIED;
-
- quick_length = image.length();
quick_data.resize(quick_length);
int const read_ = image.fread( &quick_data[0], quick_length);
if (read_ != quick_length)
+ return std::make_pair(image_error::INVALIDIMAGE, "Cannot read the file");
+
+ constexpr int QUICK_ADDR = 0x600;
+ address_space &space = m_maincpu->space(AS_PROGRAM);
+ for (int i = 0; i < quick_length; i++)
{
- result = image_error::INVALIDIMAGE;
- image.message(" Cannot read the file");
+ if ((QUICK_ADDR + i) < 0x1000)
+ space.write_byte(i + QUICK_ADDR, quick_data[i]);
}
- else
- {
- for (i = 0; i < quick_length; i++)
- if ((quick_addr + i) < 0x1000)
- space.write_byte(i + quick_addr, quick_data[i]);
-
- /* display a message about the loaded quickload */
- if (image.is_filetype("bin"))
- image.message(" Quickload: size=%04X : start=%04X : end=%04X : Press 6 to start",quick_length,quick_addr,quick_addr+quick_length);
- else
- image.message(" Quickload: size=%04X : start=%04X : end=%04X : Press 8 to start",quick_length,quick_addr,quick_addr+quick_length);
- result = std::error_condition();
- }
+ // display a message about the loaded quickload
+ if (image.is_filetype("bin"))
+ image.message(" Quickload: size=%04X : start=%04X : end=%04X : Press 6 to start", quick_length, QUICK_ADDR, QUICK_ADDR+quick_length);
+ else
+ image.message(" Quickload: size=%04X : start=%04X : end=%04X : Press 8 to start", quick_length, QUICK_ADDR, QUICK_ADDR+quick_length);
- return result;
+ return std::make_pair(std::error_condition(), std::string());
}
/* Machine Drivers */
diff --git a/src/mame/ausnz/mbee.h b/src/mame/ausnz/mbee.h
index 4322fa61450..942b8903dfa 100644
--- a/src/mame/ausnz/mbee.h
+++ b/src/mame/ausnz/mbee.h
@@ -125,7 +125,7 @@ private:
void premium_palette(palette_device &palette) const;
uint32_t screen_update_mbee(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(newkb_timer);
- std::error_condition load_cart(device_image_interface &image, generic_slot_device *slot, u8);
+ std::pair<std::error_condition, std::string> load_cart(device_image_interface &image, generic_slot_device *slot, u8);
void unload_cart(u8);
DECLARE_QUICKLOAD_LOAD_MEMBER(quickload_cb);
template <u8 T> DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pak_load) { return load_cart(image, m_pak[T], T); }
diff --git a/src/mame/ausnz/mbee_m.cpp b/src/mame/ausnz/mbee_m.cpp
index 14d618d7648..c6dca14dd3d 100644
--- a/src/mame/ausnz/mbee_m.cpp
+++ b/src/mame/ausnz/mbee_m.cpp
@@ -608,8 +608,8 @@ QUICKLOAD_LOAD_MEMBER(mbee_state::quickload_cb)
uint16_t execute_address, start_addr, end_addr;
/* load the binary into memory */
- std::error_condition err = z80bin_load_file(image, space, execute_address, start_addr, end_addr);
- if (err)
+ auto err = z80bin_load_file(image, space, execute_address, start_addr, end_addr);
+ if (err.first)
return err;
/* is this file executable? */
@@ -628,7 +628,7 @@ QUICKLOAD_LOAD_MEMBER(mbee_state::quickload_cb)
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
size_t quickload_size = image.length();
@@ -641,18 +641,12 @@ QUICKLOAD_LOAD_MEMBER(mbee_state::quickload_cb)
u8 data;
if (image.fread(&data, 1) != 1)
- {
- image.message("Unexpected EOF");
- return image_error::UNSPECIFIED;
- }
+ return std::make_pair(image_error::UNSPECIFIED, "Unexpected EOF");
if ((j < m_size) || (j > 0xefff))
space.write_byte(j, data);
else
- {
- image.message("Not enough memory in this microbee");
- return image_error::UNSUPPORTED;
- }
+ return std::make_pair(image_error::UNSUPPORTED, "Not enough memory in this microbee");
}
if (autorun)
@@ -672,18 +666,12 @@ QUICKLOAD_LOAD_MEMBER(mbee_state::quickload_cb)
u8 data;
if (image.fread(&data, 1) != 1)
- {
- image.message("Unexpected EOF");
- return image_error::UNSPECIFIED;
- }
+ return std::make_pair(image_error::UNSPECIFIED, "Unexpected EOF");
if ((j < m_size) || (j > 0xefff))
space.write_byte(j, data);
else
- {
- image.message("Not enough memory in this microbee");
- return image_error::UNSUPPORTED;
- }
+ return std::make_pair(image_error::UNSUPPORTED, "Not enough memory in this microbee");
}
if (autorun)
@@ -698,29 +686,23 @@ QUICKLOAD_LOAD_MEMBER(mbee_state::quickload_cb)
u8 data;
if (image.fread(&data, 1) != 1)
- {
- image.message("Unexpected EOF");
- return image_error::UNSPECIFIED;
- }
+ return std::make_pair(image_error::UNSPECIFIED, "Unexpected EOF");
if ((j < m_size) || (j > 0xefff))
space.write_byte(j, data);
else
- {
- image.message("Not enough memory in this microbee");
- return image_error::UNSUPPORTED;
- }
+ return std::make_pair(image_error::UNSUPPORTED, "Not enough memory in this microbee");
}
if (autorun)
m_maincpu->set_pc(0x900);
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
// Index usage: 0 = not used; 1 = net rom; 2-7 = pak roms
-std::error_condition mbee_state::load_cart(device_image_interface &image, generic_slot_device *slot, u8 pak_index)
+std::pair<std::error_condition, std::string> mbee_state::load_cart(device_image_interface &image, generic_slot_device *slot, u8 pak_index)
{
u32 size = slot->common_get_size("rom");
@@ -728,10 +710,7 @@ std::error_condition mbee_state::load_cart(device_image_interface &image, generi
{
// "mbp" ROMs
if ((size == 0) || (size > 0x4000))
- {
- osd_printf_error("%s: Unsupported ROM size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported ROM size (must be no larger than 16K)");
m_pak_extended[pak_index] = (size > 0x2000) ? true : false;
@@ -742,9 +721,8 @@ std::error_condition mbee_state::load_cart(device_image_interface &image, generi
logerror("ROM header = %02X %02X %02X\n", slot->read_rom(0), slot->read_rom(1), slot->read_rom(2));
if ((slot->read_rom(0) != 0xc3) || ((slot->read_rom(2) & 0xe0) != 0xc0))
{
- osd_printf_error("%s: Not a PAK rom\n", image.basename());
slot->call_unload();
- return image_error::INVALIDIMAGE;
+ return std::make_pair(image_error::INVALIDIMAGE, "Not a PAK ROM");
}
}
else
@@ -752,8 +730,7 @@ std::error_condition mbee_state::load_cart(device_image_interface &image, generi
// "mbn" roms
if ((size == 0) || (size > 0x2000))
{
- osd_printf_error("%s: Unsupported ROM size\n", image.basename());
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported ROM size (must be no larger than 8K)");
}
m_pak_extended[pak_index] = (size > 0x1000) ? true : false;
@@ -766,14 +743,13 @@ std::error_condition mbee_state::load_cart(device_image_interface &image, generi
{
if ((slot->read_rom(0) != 0xc3) || ((slot->read_rom(2) & 0xf0) != 0xe0))
{
- osd_printf_error("%s: Not a NET rom\n", image.basename());
slot->call_unload();
- return image_error::INVALIDIMAGE;
+ return std::make_pair(image_error::INVALIDIMAGE, "Not a NET ROM");
}
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void mbee_state::unload_cart(u8 pak_index)
diff --git a/src/mame/ausnz/pegasus.cpp b/src/mame/ausnz/pegasus.cpp
index 7182dabd8a3..ee56f50c548 100644
--- a/src/mame/ausnz/pegasus.cpp
+++ b/src/mame/ausnz/pegasus.cpp
@@ -94,7 +94,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(pegasus_firq_clr);
u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(pegasus_firq);
- std::error_condition load_cart(device_image_interface &image, generic_slot_device *slot, const char *reg_tag);
+ std::pair<std::error_condition, std::string> load_cart(device_image_interface &image, generic_slot_device *slot, const char *reg_tag);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(exp00_load) { return load_cart(image, m_exp_00, "0000"); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(exp01_load) { return load_cart(image, m_exp_01, "1000"); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(exp02_load) { return load_cart(image, m_exp_02, "2000"); }
@@ -416,16 +416,13 @@ void pegasus_state::pegasus_decrypt_rom(u8 *ROM)
}
}
-std::error_condition pegasus_state::load_cart(device_image_interface &image, generic_slot_device *slot, const char *reg_tag)
+std::pair<std::error_condition, std::string> pegasus_state::load_cart(device_image_interface &image, generic_slot_device *slot, const char *reg_tag)
{
u32 size = slot->common_get_size(reg_tag);
bool any_socket = false;
if (size > 0x1000)
- {
- osd_printf_error("%s: Unsupported cartridge size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be no larger than 4K)");
if (image.loaded_through_softlist() && size == 0)
{
@@ -436,21 +433,21 @@ std::error_condition pegasus_state::load_cart(device_image_interface &image, gen
if (size == 0)
{
- osd_printf_error(
- "%s: Attempted to load a file that does not work in this socket.\n"
- "Please check \"Usage\" field in the software list for the correct socket(s) to use.\n",
- image.basename());
- return image_error::INVALIDIMAGE;
+ // FIXME: multi-line message may not be displayed properly
+ return std::make_pair(
+ image_error::INVALIDIMAGE,
+ "Attempted to load a file that does not work in this socket.\n"
+ "Please check \"Usage\" field in the software list for the correct socket(s) to use.");
}
}
- slot->rom_alloc(0x1000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); // we alloc 0x1000 also for smaller roms!
+ slot->rom_alloc(0x1000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); // we alloc 0x1000 also for smaller ROMs!
slot->common_load_rom(slot->get_rom_base(), size, any_socket ? "rom" : reg_tag);
// raw images have to be decrypted (in particular the ones from softlist)
pegasus_decrypt_rom(slot->get_rom_base());
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void pegasus_state::machine_start()
diff --git a/src/mame/ausnz/pipbug.cpp b/src/mame/ausnz/pipbug.cpp
index 3e0c9387a82..e96fbfcf9d8 100644
--- a/src/mame/ausnz/pipbug.cpp
+++ b/src/mame/ausnz/pipbug.cpp
@@ -150,70 +150,50 @@ DEVICE_INPUT_DEFAULTS_END
QUICKLOAD_LOAD_MEMBER(pipbug_state::quickload_cb)
{
- address_space &space = m_maincpu->space(AS_PROGRAM);
- int i;
- int quick_addr = 0x440;
- int exec_addr;
- std::vector<u8> quick_data;
- int read_;
- std::error_condition result = image_error::UNSPECIFIED;
-
int const quick_length = image.length();
if (quick_length < 0x0444)
{
- result = image_error::INVALIDLENGTH;
- osd_printf_error("%s: File too short\n", image.basename());
- image.message(" File too short");
+ return std::make_pair(image_error::INVALIDLENGTH, "File too short");
}
else if (quick_length > 0x8000)
{
- result = image_error::INVALIDLENGTH;
- osd_printf_error("%s: File too long\n", image.basename());
- image.message(" File too long");
+ return std::make_pair(image_error::INVALIDLENGTH, "File too long");
+ }
+
+ std::vector<u8> quick_data;
+ quick_data.resize(quick_length);
+ int const read_ = image.fread(&quick_data[0], quick_length);
+ if (read_ != quick_length)
+ {
+ return std::make_pair(image_error::UNSPECIFIED, "Cannot read the file");
+ }
+ else if (quick_data[0] != 0xc4)
+ {
+ return std::make_pair(image_error::INVALIDIMAGE, "Invalid header");
}
- else
+
+ int const exec_addr = quick_data[1] * 256 + quick_data[2];
+
+ if (exec_addr >= quick_length)
{
- quick_data.resize(quick_length);
- read_ = image.fread( &quick_data[0], quick_length);
- if (read_ != quick_length)
- {
- result = image_error::UNSPECIFIED;
- osd_printf_error("%s: Cannot read the file\n");
- image.message(" Cannot read the file");
- }
- else if (quick_data[0] != 0xc4)
- {
- result = image_error::INVALIDIMAGE;
- osd_printf_error("%s: Invalid header\n");
- image.message(" Invalid header");
- }
- else
- {
- exec_addr = quick_data[1] * 256 + quick_data[2];
-
- if (exec_addr >= quick_length)
- {
- result = image_error::INVALIDIMAGE;
- osd_printf_error("%s: Exec address beyond end of file\n", image.basename());
- image.message(" Exec address beyond end of file");
- }
- else
- {
- for (i = quick_addr; i < read_; i++)
- space.write_byte(i, quick_data[i]);
-
- /* display a message about the loaded quickload */
- image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr);
-
- // Start the quickload
- m_maincpu->set_state_int(S2650_PC, exec_addr);
-
- result = std::error_condition();
- }
- }
+ return std::make_pair(
+ image_error::INVALIDIMAGE,
+ util::string_format("Exec address %04X beyond end of file %04X", exec_addr, quick_length));
}
- return result;
+ constexpr int QUICK_ADDR = 0x440;
+
+ address_space &space = m_maincpu->space(AS_PROGRAM);
+ for (int i = QUICK_ADDR; i < read_; i++)
+ space.write_byte(i, quick_data[i]);
+
+ // display a message about the loaded quickload
+ image.message(" Quickload: size=%04X : exec=%04X", quick_length, exec_addr);
+
+ // Start the quickload
+ m_maincpu->set_state_int(S2650_PC, exec_addr);
+
+ return std::make_pair(std::error_condition(), std::string());
}
void pipbug_state::pipbug(machine_config &config)
diff --git a/src/mame/ausnz/super80_m.cpp b/src/mame/ausnz/super80_m.cpp
index 3172100c61a..f8dd0abc306 100644
--- a/src/mame/ausnz/super80_m.cpp
+++ b/src/mame/ausnz/super80_m.cpp
@@ -271,15 +271,17 @@ QUICKLOAD_LOAD_MEMBER(super80_state::quickload_cb)
uint16_t exec_addr, start_addr, end_addr;
// load the binary into memory
- std::error_condition err = z80bin_load_file(image, m_maincpu->space(AS_PROGRAM), exec_addr, start_addr, end_addr);
- if (err)
+ auto err = z80bin_load_file(image, m_maincpu->space(AS_PROGRAM), exec_addr, start_addr, end_addr);
+ if (err.first)
return err;
// is this file executable?
if (exec_addr != 0xffff)
+ {
// check to see if autorun is on
if (BIT(m_io_config->read(), 0))
m_maincpu->set_pc(exec_addr);
+ }
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/bandai/design_master.cpp b/src/mame/bandai/design_master.cpp
index 0468b85e8ca..529e2f1ba3a 100644
--- a/src/mame/bandai/design_master.cpp
+++ b/src/mame/bandai/design_master.cpp
@@ -101,7 +101,7 @@ DEVICE_IMAGE_LOAD_MEMBER(bdsm_state::cart_load_bdesignm)
m_cartslot->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_BIG);
m_cartslot->common_load_rom(m_cartslot->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void bdsm_state::mem_map(address_map &map)
diff --git a/src/mame/bandai/rx78.cpp b/src/mame/bandai/rx78.cpp
index 5e6397d7f4c..7f0cb8c2ba9 100644
--- a/src/mame/bandai/rx78.cpp
+++ b/src/mame/bandai/rx78.cpp
@@ -491,15 +491,12 @@ DEVICE_IMAGE_LOAD_MEMBER( rx78_state::cart_load )
u32 size = m_cart->common_get_size("rom");
if (size != 0x2000 && size != 0x4000 && size != 0x8000)
- {
- osd_printf_error("%s: Unsupported cartridge size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be 8K, 16K or 32K)");
m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
/* F4 Character Displayer */
diff --git a/src/mame/bandai/sv8000.cpp b/src/mame/bandai/sv8000.cpp
index 77479189ed4..1b8c76035b4 100644
--- a/src/mame/bandai/sv8000.cpp
+++ b/src/mame/bandai/sv8000.cpp
@@ -209,15 +209,12 @@ DEVICE_IMAGE_LOAD_MEMBER( sv8000_state::cart_load )
uint32_t size = m_cart->common_get_size("rom");
if (size != 0x1000)
- {
- osd_printf_error("%s: Incorrect or not supported cartridge size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Incorrect or unsupported cartridge size (must be 4K)");
m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/booth/apexc_m.cpp b/src/mame/booth/apexc_m.cpp
index 7a338404058..a5679309dcf 100644
--- a/src/mame/booth/apexc_m.cpp
+++ b/src/mame/booth/apexc_m.cpp
@@ -24,7 +24,7 @@ apexc_cylinder_image_device::apexc_cylinder_image_device(const machine_config &m
/*
Open cylinder image and read RAM
*/
-std::error_condition apexc_cylinder_image_device::call_load()
+std::pair<std::error_condition, std::string> apexc_cylinder_image_device::call_load()
{
/* load RAM contents */
m_writable = !is_readonly();
@@ -38,7 +38,7 @@ std::error_condition apexc_cylinder_image_device::call_load()
RAM[i] = big_endianize_int32(RAM[i]);
#endif
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
/*
diff --git a/src/mame/booth/apexc_m.h b/src/mame/booth/apexc_m.h
index 380634ad25d..0b7850b0c15 100644
--- a/src/mame/booth/apexc_m.h
+++ b/src/mame/booth/apexc_m.h
@@ -43,7 +43,7 @@ public:
virtual const char *image_type_name() const noexcept override { return "cylinder"; }
virtual const char *image_brief_type_name() const noexcept override { return "cyln"; }
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual const char *image_interface() const noexcept override { return "apexc_cyl"; }
virtual const software_list_loader &get_software_list_loader() const override { return image_software_list_loader::instance(); }
diff --git a/src/mame/canon/x07.cpp b/src/mame/canon/x07.cpp
index 082f3709fb6..9c2ab5994f2 100644
--- a/src/mame/canon/x07.cpp
+++ b/src/mame/canon/x07.cpp
@@ -1062,10 +1062,7 @@ DEVICE_IMAGE_LOAD_MEMBER( x07_state::card_load )
const char *card_type = image.get_feature("card_type");
if (strcmp(card_type, "xp140"))
- {
- osd_printf_error("%s: Unsupported card type\n", image.basename());
- return image_error::BADSOFTWARE;
- }
+ return std::make_pair(image_error::BADSOFTWARE, "Unsupported card type");
}
m_card->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_BIG);
@@ -1073,7 +1070,7 @@ DEVICE_IMAGE_LOAD_MEMBER( x07_state::card_load )
m_card->ram_alloc(0x1000);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void x07_state::x07_palette(palette_device &palette) const
diff --git a/src/mame/cantab/jupace.cpp b/src/mame/cantab/jupace.cpp
index a7bec83268f..6b5ada91b2c 100644
--- a/src/mame/cantab/jupace.cpp
+++ b/src/mame/cantab/jupace.cpp
@@ -172,16 +172,12 @@ private:
SNAPSHOT_LOAD_MEMBER(ace_state::snapshot_cb)
{
+ if (m_ram->size() < 16*1024)
+ return std::make_pair(image_error::UNSUPPORTED, "At least 16KB RAM expansion required");
+
u16 ace_index=0x2000;
bool done = false;
- if (m_ram->size() < 16*1024)
- {
- osd_printf_error("%s: At least 16KB RAM expansion required\n", image.basename());
- image.message("At least 16KB RAM expansion required");
- return image_error::UNSUPPORTED;
- }
-
logerror("Loading file %s.\r\n", image.filename());
std::vector<uint8_t> RAM(0x10000);
while (!done && (ace_index < 0x8001))
@@ -215,11 +211,7 @@ SNAPSHOT_LOAD_MEMBER(ace_state::snapshot_cb)
logerror("Decoded %X bytes.\r\n", ace_index-0x2000);
if (!done)
- {
- osd_printf_error("%s: EOF marker not found\n", image.basename());
- image.message("EOF marker not found");
- return image_error::INVALIDIMAGE;
- }
+ return std::make_pair(image_error::INVALIDIMAGE, "Invalid snapshot file: EOF marker not found");
// patch CPU registers
// Some games do not follow the standard, and have rubbish in the CPU area. So,
@@ -258,7 +250,7 @@ SNAPSHOT_LOAD_MEMBER(ace_state::snapshot_cb)
for (ace_index = 0x2000; ace_index < 0x8000; ace_index++)
space.write_byte(ace_index, RAM[ace_index]);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
//**************************************************************************
diff --git a/src/mame/casio/casio_rompack.cpp b/src/mame/casio/casio_rompack.cpp
index acf862fb5c5..8b5c479a8c3 100644
--- a/src/mame/casio/casio_rompack.cpp
+++ b/src/mame/casio/casio_rompack.cpp
@@ -43,7 +43,7 @@ DEVICE_IMAGE_LOAD_MEMBER(casiorom_state::cart_load)
uint32_t size = m_cart->common_get_size("rom");
m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void casiorom_state::casiorom(machine_config &config)
diff --git a/src/mame/casio/casloopy.cpp b/src/mame/casio/casloopy.cpp
index 3cd3325d3a8..15dfd48a50d 100644
--- a/src/mame/casio/casloopy.cpp
+++ b/src/mame/casio/casloopy.cpp
@@ -506,7 +506,7 @@ DEVICE_IMAGE_LOAD_MEMBER( casloopy_state::cart_load )
DST[i + 3] = tempb;
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void casloopy_state::casloopy(machine_config &config)
diff --git a/src/mame/casio/pv1000.cpp b/src/mame/casio/pv1000.cpp
index 71f52c5ee44..7e8c1b049b4 100644
--- a/src/mame/casio/pv1000.cpp
+++ b/src/mame/casio/pv1000.cpp
@@ -306,15 +306,12 @@ DEVICE_IMAGE_LOAD_MEMBER( pv1000_state::cart_load )
uint32_t size = m_cart->common_get_size("rom");
if (size != 0x2000 && size != 0x4000)
- {
- osd_printf_error("%s: Unsupported cartridge size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be 8K or 16K)");
m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/casio/pv2000.cpp b/src/mame/casio/pv2000.cpp
index 1a85f5b7388..ae251006741 100644
--- a/src/mame/casio/pv2000.cpp
+++ b/src/mame/casio/pv2000.cpp
@@ -371,15 +371,12 @@ DEVICE_IMAGE_LOAD_MEMBER( pv2000_state::cart_load )
uint32_t size = m_cart->common_get_size("rom");
if (size != 0x2000 && size != 0x4000)
- {
- osd_printf_error("%s: Unsupported cartridge size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be 8K or 16K)");
m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
/* Machine Drivers */
diff --git a/src/mame/chess/ave_arb.cpp b/src/mame/chess/ave_arb.cpp
index c5ecf4700e0..2f232326df5 100644
--- a/src/mame/chess/ave_arb.cpp
+++ b/src/mame/chess/ave_arb.cpp
@@ -174,7 +174,7 @@ DEVICE_IMAGE_LOAD_MEMBER(arb_state::cart_load)
m_altboard = bool(image.get_feature("altboard"));
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/commodore/cbm_snqk.cpp b/src/mame/commodore/cbm_snqk.cpp
index b178008ab61..70af529349a 100644
--- a/src/mame/commodore/cbm_snqk.cpp
+++ b/src/mame/commodore/cbm_snqk.cpp
@@ -24,8 +24,11 @@
* 0x001c data */
-std::error_condition general_cbm_loadsnap( device_image_interface &image, address_space &space, offs_t offset,
- void (*cbm_sethiaddress)(address_space &space, uint16_t hiaddress) )
+std::pair<std::error_condition, std::string> general_cbm_loadsnap(
+ device_image_interface &image,
+ address_space &space,
+ offs_t offset,
+ void (*cbm_sethiaddress)(address_space &space, uint16_t hiaddress))
{
char buffer[7];
std::vector<uint8_t> data;
@@ -41,29 +44,29 @@ std::error_condition general_cbm_loadsnap( device_image_interface &image, addres
else if (image.is_filetype("p00"))
{
/* p00 files */
- if (image.fread( buffer, sizeof(buffer)) != sizeof(buffer))
- return image_error::UNSPECIFIED;
+ if (image.fread(buffer, sizeof(buffer)) != sizeof(buffer))
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
if (memcmp(buffer, "C64File", sizeof(buffer)))
- return image_error::INVALIDIMAGE;
+ return std::make_pair(image_error::INVALIDIMAGE, std::string());
image.fseek(26, SEEK_SET);
snapshot_size -= 26;
}
else if (image.is_filetype("t64"))
{
/* t64 files - for GB64 Single T64s loading to x0801 - header is always the same size */
- if (image.fread( buffer, sizeof(buffer)) != sizeof(buffer))
- return image_error::UNSPECIFIED;
+ if (image.fread(buffer, sizeof(buffer)) != sizeof(buffer))
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
if (memcmp(buffer, "C64 tape image file", sizeof(buffer)))
- return image_error::INVALIDIMAGE;
+ return std::make_pair(image_error::INVALIDIMAGE, std::string());
image.fseek(94, SEEK_SET);
snapshot_size -= 94;
}
else
{
- return image_error::UNSUPPORTED;
+ return std::make_pair(image_error::UNSUPPORTED, std::string());
}
- image.fread( &address, 2);
+ image.fread(&address, 2);
address = little_endianize_int16(address);
if (image.is_filetype("t64"))
address = 2049;
@@ -71,15 +74,15 @@ std::error_condition general_cbm_loadsnap( device_image_interface &image, addres
data.resize(snapshot_size);
- bytesread = image.fread( &data[0], snapshot_size);
+ bytesread = image.fread(&data[0], snapshot_size);
if (bytesread != snapshot_size)
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
for (int i = 0; i < snapshot_size; i++)
space.write_byte(address + i + offset, data[i]);
cbm_sethiaddress(space, address + snapshot_size);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void cbm_quick_sethiaddress(address_space &space, uint16_t hiaddress)
diff --git a/src/mame/commodore/cbm_snqk.h b/src/mame/commodore/cbm_snqk.h
index d2573f35391..a5be5e4a8c1 100644
--- a/src/mame/commodore/cbm_snqk.h
+++ b/src/mame/commodore/cbm_snqk.h
@@ -19,7 +19,7 @@
#define CBM_QUICKLOAD_DELAY (attotime::from_seconds(3))
-std::error_condition general_cbm_loadsnap(
+std::pair<std::error_condition, std::string> general_cbm_loadsnap(
device_image_interface &image,
address_space &space,
offs_t offset,
diff --git a/src/mame/comx/comx35.cpp b/src/mame/comx/comx35.cpp
index 67efaa095f0..dc6de01deee 100644
--- a/src/mame/comx/comx35.cpp
+++ b/src/mame/comx/comx35.cpp
@@ -65,16 +65,12 @@ QUICKLOAD_LOAD_MEMBER(comx35_state::quickload_cb)
int size = image.length();
if (size > m_ram->size())
- {
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Image is larger than RAM");
image.fread( header, 5);
if (header[1] != 'C' || header[2] != 'O' || header[3] != 'M' || header[4] != 'X' )
- {
- return image_error::INVALIDIMAGE;
- }
+ return std::make_pair(image_error::INVALIDIMAGE, std::string());
switch (header[0])
{
@@ -200,7 +196,7 @@ QUICKLOAD_LOAD_MEMBER(comx35_state::quickload_cb)
break;
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
//**************************************************************************
diff --git a/src/mame/cybiko/cybiko_m.cpp b/src/mame/cybiko/cybiko_m.cpp
index 650667550b6..48201b4125c 100644
--- a/src/mame/cybiko/cybiko_m.cpp
+++ b/src/mame/cybiko/cybiko_m.cpp
@@ -41,7 +41,7 @@ QUICKLOAD_LOAD_MEMBER(cybiko_state::quickload_cybiko)
{
image.fread(m_flash1->get_ptr(), std::min(image.length(), uint64_t(0x84000)));
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
QUICKLOAD_LOAD_MEMBER(cybiko_state::quickload_cybikoxt)
@@ -54,7 +54,7 @@ QUICKLOAD_LOAD_MEMBER(cybiko_state::quickload_cybikoxt)
for (int byte = 0; byte < size; byte++)
dest.write_byte(0x400000 + byte, buffer[byte]);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
///////////////////
diff --git a/src/mame/ddr/jtc.cpp b/src/mame/ddr/jtc.cpp
index f079e96ffe7..34f3e906fe9 100644
--- a/src/mame/ddr/jtc.cpp
+++ b/src/mame/ddr/jtc.cpp
@@ -592,94 +592,58 @@ INPUT_PORTS_END
QUICKLOAD_LOAD_MEMBER(jtc_state::quickload_cb)
{
address_space &space = m_maincpu->space(AS_PROGRAM);
- u16 i, quick_addr, quick_length;
+ u16 quick_addr;
std::vector<u8> quick_data;
- std::error_condition result = image_error::UNSUPPORTED;
- quick_length = image.length();
+ int quick_length = image.length();
if (image.is_filetype("jtc"))
{
if (quick_length < 0x0088)
- {
- result = image_error::INVALIDLENGTH;
- osd_printf_error("%s: File too short\n", image.basename());
- image.message(" File too short");
- }
- else
- if (quick_length > 0x8000)
- {
- result = image_error::INVALIDLENGTH;
- osd_printf_error("%s: File too long\n", image.basename());
- image.message(" File too long");
- }
- else
- {
- quick_data.resize(quick_length+1);
- u16 read_ = image.fread(&quick_data[0], quick_length);
- if (read_ != quick_length)
- {
- result = image_error::UNSPECIFIED;
- osd_printf_error("%s: Cannot read the file\n", image.basename());
- image.message(" Cannot read the file");
- }
- else
- {
- quick_addr = quick_data[0x12] * 256 + quick_data[0x11];
- quick_length = quick_data[0x14] * 256 + quick_data[0x13] - quick_addr + 0x81;
- if (image.length() != quick_length)
- {
- result = image_error::INVALIDIMAGE;
- osd_printf_error("%s: Invalid file header\n", image.basename());
- image.message(" Invalid file header");
- }
- else
- {
- for (i = 0x80; i < image.length(); i++)
- space.write_byte(quick_addr+i-0x80, quick_data[i]);
-
- /* display a message about the loaded quickload */
- image.message(" Quickload: size=%04X : loaded at %04X",quick_length,quick_addr);
-
- result = std::error_condition();
- }
- }
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "File too short");
+ else if (quick_length > 0x8000)
+ return std::make_pair(image_error::INVALIDLENGTH, "File too long");
+
+ quick_data.resize(quick_length+1);
+ int const read_ = image.fread(&quick_data[0], quick_length);
+ if (read_ != quick_length)
+ return std::make_pair(image_error::UNSPECIFIED, "Cannot read the file");
+
+ quick_addr = quick_data[0x12] * 256 + quick_data[0x11];
+ quick_length = quick_data[0x14] * 256 + quick_data[0x13] - quick_addr + 0x81;
+ if (image.length() != quick_length)
+ return std::make_pair(image_error::INVALIDIMAGE, "Invalid file header");
+
+ for (int i = 0x80; i < image.length(); i++)
+ space.write_byte(quick_addr+i-0x80, quick_data[i]);
+
+ // display a message about the loaded quickload
+ image.message(" Quickload: size=%04X : loaded at %04X",quick_length,quick_addr);
+
+ return std::make_pair(std::error_condition(), std::string());
}
- else
- if (image.is_filetype("bin"))
+ else if (image.is_filetype("bin"))
{
quick_addr = 0xe000;
if (quick_length > 0x8000)
- {
- result = image_error::INVALIDLENGTH;
- osd_printf_error("%s: File too long\n", image.basename());
- image.message(" File too long");
- }
- else
- {
- quick_data.resize(quick_length+1);
- u16 read_ = image.fread( &quick_data[0], quick_length);
- if (read_ != quick_length)
- {
- result = image_error::UNSPECIFIED;
- osd_printf_error("%s: Cannot read the file\n", image.basename());
- image.message(" Cannot read the file");
- }
- else
- {
- for (i = 0; i < image.length(); i++)
- space.write_byte(quick_addr+i, quick_data[i]);
+ return std::make_pair(image_error::INVALIDLENGTH, "File too long");
- /* display a message about the loaded quickload */
- image.message(" Quickload: size=%04X : loaded at %04X",quick_length,quick_addr);
+ quick_data.resize(quick_length+1);
+ u16 read_ = image.fread( &quick_data[0], quick_length);
+ if (read_ != quick_length)
+ return std::make_pair(image_error::UNSPECIFIED, "Cannot read the file");
- result = std::error_condition();
- m_maincpu->set_pc(quick_addr);
- }
- }
+ for (int i = 0; i < image.length(); i++)
+ space.write_byte(quick_addr+i, quick_data[i]);
+
+ // display a message about the loaded quickload
+ image.message(" Quickload: size=%04X : loaded at %04X",quick_length,quick_addr);
+
+ m_maincpu->set_pc(quick_addr);
+
+ return std::make_pair(std::error_condition(), std::string());
}
- return result;
+ return std::make_pair(image_error::UNSUPPORTED, std::string());
}
diff --git a/src/mame/ddr/kc_m.cpp b/src/mame/ddr/kc_m.cpp
index 01a5cd7a067..c543999579b 100644
--- a/src/mame/ddr/kc_m.cpp
+++ b/src/mame/ddr/kc_m.cpp
@@ -39,7 +39,7 @@ QUICKLOAD_LOAD_MEMBER(kc_state::quickload_cb)
uint64_t size = image.length();
if (size == 0)
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, std::string());
std::vector<uint8_t> data(size);
image.fread(&data[0], size);
@@ -68,7 +68,7 @@ QUICKLOAD_LOAD_MEMBER(kc_state::quickload_cb)
logerror("Snapshot loaded at: 0x%04x-0x%04x, execution address: 0x%04x\n", addr, addr + datasize - 1, execution_address);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/ddr/sprachmg.cpp b/src/mame/ddr/sprachmg.cpp
index b367a56a07f..b1f5d8022f1 100644
--- a/src/mame/ddr/sprachmg.cpp
+++ b/src/mame/ddr/sprachmg.cpp
@@ -36,6 +36,7 @@
***************************************************************************/
#include "emu.h"
+
#include "bus/generic/carts.h"
#include "bus/generic/slot.h"
#include "bus/rs232/rs232.h"
@@ -46,6 +47,7 @@
#include "machine/z80pio.h"
#include "machine/z80sio.h"
#include "sound/dac.h"
+
#include "softlist_dev.h"
#include "speaker.h"
@@ -269,32 +271,21 @@ void sprachmg_state::display_column_w(uint8_t data)
DEVICE_IMAGE_LOAD_MEMBER( sprachmg_state::module_load )
{
if (!image.loaded_through_softlist())
- {
- osd_printf_error("Speech modules can only be loaded using a software list\n");
- return image_error::UNSUPPORTED;
- }
-
- uint32_t pcb1_size = image.get_software_region_length("pcb1");
+ return std::make_pair(image_error::UNSUPPORTED, "Speech modules can only be loaded using a software list");
+ uint32_t const pcb1_size = image.get_software_region_length("pcb1");
if (pcb1_size != 0xc000)
- {
- osd_printf_error("%s: Invalid pcb1 region length\n", image.basename());
- return image_error::BADSOFTWARE;
- }
+ return std::make_pair(image_error::BADSOFTWARE, "Invalid 'pcb1' data area length (must be 48K)");
m_speech_module_pcb1 = image.get_software_region("pcb1");
- uint32_t pcb2_size = image.get_software_region_length("pcb2");
-
+ uint32_t const pcb2_size = image.get_software_region_length("pcb2");
if (pcb2_size > 0 && pcb2_size != 0xc000)
- {
- osd_printf_error("%s: Invalid pcb2 region length\n", image.basename());
- return image_error::BADSOFTWARE;
- }
+ return std::make_pair(image_error::BADSOFTWARE, "Invalid 'pcb2' data area length (must be 48K)");
m_speech_module_pcb2 = image.get_software_region("pcb2");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
uint8_t sprachmg_state::speech_r(offs_t offset)
diff --git a/src/mame/dec/pdp1.cpp b/src/mame/dec/pdp1.cpp
index 996411fd846..cbff6aa6702 100644
--- a/src/mame/dec/pdp1.cpp
+++ b/src/mame/dec/pdp1.cpp
@@ -696,7 +696,7 @@ void pdp1_cylinder_image_device::device_start()
/*
Open a perforated tape image
*/
-std::error_condition pdp1_readtape_image_device::call_load()
+std::pair<std::error_condition, std::string> pdp1_readtape_image_device::call_load()
{
// start motor
m_motor_on = 1;
@@ -718,7 +718,7 @@ std::error_condition pdp1_readtape_image_device::call_load()
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void pdp1_readtape_image_device::call_unload()
@@ -908,9 +908,9 @@ void pdp1_readtape_image_device::iot_rrb(int op2, int nac, int mb, int &io, int
}
-std::error_condition pdp1_punchtape_image_device::call_load()
+std::pair<std::error_condition, std::string> pdp1_punchtape_image_device::call_load()
{
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void pdp1_punchtape_image_device::call_unload()
@@ -1008,11 +1008,11 @@ void pdp1_punchtape_image_device::iot_ppb(int op2, int nac, int mb, int &io, int
/*
Open a file for typewriter output
*/
-std::error_condition pdp1_typewriter_device::call_load()
+std::pair<std::error_condition, std::string> pdp1_typewriter_device::call_load()
{
m_st_tyo(1);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void pdp1_typewriter_device::call_unload()
@@ -1326,9 +1326,9 @@ void pdp1_cylinder_image_device::parallel_drum_init()
/*
Open a file for drum
*/
-std::error_condition pdp1_cylinder_image_device::call_load()
+std::pair<std::error_condition, std::string> pdp1_cylinder_image_device::call_load()
{
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void pdp1_cylinder_image_device::call_unload()
diff --git a/src/mame/dec/pdp1.h b/src/mame/dec/pdp1.h
index 6959351a7a7..1683f0972ee 100644
--- a/src/mame/dec/pdp1.h
+++ b/src/mame/dec/pdp1.h
@@ -195,7 +195,7 @@ protected:
// device_image_interface implementation
virtual const char *file_extensions() const noexcept override { return "tap,rim"; }
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
public:
@@ -245,7 +245,7 @@ protected:
virtual bool is_reset_on_load() const noexcept override { return false; }
virtual const char *file_extensions() const noexcept override { return "tap,rim"; }
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
public:
@@ -291,7 +291,7 @@ protected:
virtual const char *image_type_name() const noexcept override { return "printout"; }
virtual const char *image_brief_type_name() const noexcept override { return "prin"; }
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
public:
@@ -347,8 +347,7 @@ protected:
virtual const char *image_type_name() const noexcept override { return "cylinder"; }
virtual const char *image_brief_type_name() const noexcept override { return "cyln"; }
-
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
public:
diff --git a/src/mame/entex/sag.cpp b/src/mame/entex/sag.cpp
index 82b26914032..6b5d9f2e584 100644
--- a/src/mame/entex/sag.cpp
+++ b/src/mame/entex/sag.cpp
@@ -100,10 +100,7 @@ DEVICE_IMAGE_LOAD_MEMBER(sag_state::cart_load)
u32 size = m_cart->common_get_size("rom");
if (size != 0x1000 && size != 0x1100 && size != 0x2000)
- {
- osd_printf_error("%s: Invalid ROM file size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid ROM file size (must be 4096, 4352 or 8192 bytes)");
m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
@@ -113,10 +110,7 @@ DEVICE_IMAGE_LOAD_MEMBER(sag_state::cart_load)
{
// TMS1670 MCU
if (!image.loaded_through_softlist())
- {
- osd_printf_error("Can only load TMS1670 type through softwarelist\n");
- return image_error::UNSUPPORTED;
- }
+ return std::make_pair(image_error::UNSUPPORTED, "Can only load TMS1670 type through software list");
memcpy(memregion("tms1k_cpu")->base(), m_cart->get_rom_base(), size);
m_tms1k_cpu->set_clock(375000); // approximation - RC osc. R=47K, C=47pF
@@ -124,18 +118,14 @@ DEVICE_IMAGE_LOAD_MEMBER(sag_state::cart_load)
// init PLAs
size = image.get_software_region_length("rom:mpla");
if (size != 867)
- {
- osd_printf_error("%s: Invalid MPLA file size\n", image.basename());
- return image_error::BADSOFTWARE;
- }
+ return std::make_pair(image_error::BADSOFTWARE, "Invalid MPLA data area size (must be 867 bytes)");
+
memcpy(memregion("tms1k_cpu:mpla")->base(), image.get_software_region("rom:mpla"), size);
size = image.get_software_region_length("rom:opla");
if (size != 557)
- {
- osd_printf_error("%s: Invalid OPLA file size\n", image.basename());
- return image_error::BADSOFTWARE;
- }
+ return std::make_pair(image_error::BADSOFTWARE, "Invalid OPLA data area size (must be 557 bytes)");
+
memcpy(memregion("tms1k_cpu:opla")->base(), image.get_software_region("rom:opla"), size);
subdevice<pla_device>("tms1k_cpu:mpla")->reinit();
@@ -154,7 +144,7 @@ DEVICE_IMAGE_LOAD_MEMBER(sag_state::cart_load)
m_hmcs40_cpu->set_clock(450000); // from main PCB
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/epson/hx20.cpp b/src/mame/epson/hx20.cpp
index c7337cf1be0..35566d46ae7 100644
--- a/src/mame/epson/hx20.cpp
+++ b/src/mame/epson/hx20.cpp
@@ -40,9 +40,11 @@
#include "emu.h"
#include "hx20.h"
+
#include "screen.h"
#include "softlist_dev.h"
#include "speaker.h"
+
#include "utf8.h"
@@ -835,15 +837,12 @@ DEVICE_IMAGE_LOAD_MEMBER(hx20_state::optrom_load)
uint32_t size = m_optrom->common_get_size("rom");
if (size != 0x2000)
- {
- osd_printf_error("%s: Unsupported ROM size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported ROM size (must be 8K)");
m_optrom->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
m_optrom->common_load_rom(m_optrom->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
uint8_t hx20_state::optrom_r(offs_t offset)
diff --git a/src/mame/epson/qx10.cpp b/src/mame/epson/qx10.cpp
index 46338ae131a..fe7d5007c59 100644
--- a/src/mame/epson/qx10.cpp
+++ b/src/mame/epson/qx10.cpp
@@ -431,7 +431,7 @@ QUICKLOAD_LOAD_MEMBER(qx10_state::quickload_cb)
address_space& prog_space = m_maincpu->space(AS_PROGRAM);
if (image.length() >= 0xfd00)
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, std::string());
/* The right RAM bank must be active */
m_membank = 0;
@@ -441,7 +441,7 @@ QUICKLOAD_LOAD_MEMBER(qx10_state::quickload_cb)
if ((prog_space.read_byte(0) != 0xc3) || (prog_space.read_byte(5) != 0xc3))
{
machine_reset();
- return image_error::UNSUPPORTED;
+ return std::make_pair(image_error::UNSUPPORTED, std::string());
}
/* Load image to the TPA (Transient Program Area) */
@@ -450,7 +450,7 @@ QUICKLOAD_LOAD_MEMBER(qx10_state::quickload_cb)
{
uint8_t data;
if (image.fread( &data, 1) != 1)
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
prog_space.write_byte(i+0x100, data);
}
@@ -461,7 +461,7 @@ QUICKLOAD_LOAD_MEMBER(qx10_state::quickload_cb)
m_maincpu->set_state_int(Z80_SP, 256 * prog_space.read_byte(7) - 300);
m_maincpu->set_pc(0x100); // start program
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
/*
diff --git a/src/mame/exidy/sorcerer_m.cpp b/src/mame/exidy/sorcerer_m.cpp
index 2359f4867f2..3af3727be85 100644
--- a/src/mame/exidy/sorcerer_m.cpp
+++ b/src/mame/exidy/sorcerer_m.cpp
@@ -533,15 +533,15 @@ QUICKLOAD_LOAD_MEMBER(sorcerer_state::quickload_cb)
u16 execute_address, start_address, end_address;
// load the binary into memory
- std::error_condition err = z80bin_load_file(image, space, execute_address, start_address, end_address);
- if (err)
+ auto err = z80bin_load_file(image, space, execute_address, start_address, end_address);
+ if (err.first)
return err;
// is this file executable?
if (execute_address != 0xffff)
{
if ((execute_address >= 0xc000) && (execute_address <= 0xdfff) && (space.read_byte(0xdffa) != 0xc3))
- return image_error::UNSUPPORTED; // can't run a program if the cartridge isn't in
+ return std::make_pair(image_error::UNSUPPORTED, std::string()); // can't run a program if the cartridge isn't in
/* Since Exidy Basic is by Microsoft, it needs some preprocessing before it can be run.
1. A start address of 01D5 indicates a basic program which needs its pointers fixed up.
@@ -587,11 +587,7 @@ QUICKLOAD_LOAD_MEMBER(sorcerer_state::quickload_cb)
// SNP extension
// check size
if (image.length() != 0x1001c)
- {
- osd_printf_error("%s: Snapshot must be 65564 bytes\n", image.basename());
- image.message("Snapshot must be 65564 bytes");
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Snapshot must be 65564 bytes");
/* get the header */
u8 header[28];
@@ -651,6 +647,6 @@ QUICKLOAD_LOAD_MEMBER(sorcerer_state::quickload_cb)
m_maincpu->set_pc(0xe000); // SNP destroys workspace, so do cold start.
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/force/force68k.cpp b/src/mame/force/force68k.cpp
index a1d7b3a48ad..3467c08b833 100644
--- a/src/mame/force/force68k.cpp
+++ b/src/mame/force/force68k.cpp
@@ -196,7 +196,7 @@ private:
DECLARE_WRITE_LINE_MEMBER (centronics_select_w);
// User EPROM/SRAM slot(s)
- std::error_condition force68k_load_cart(device_image_interface &image, generic_slot_device *slot);
+ std::pair<std::error_condition, std::string> force68k_load_cart(device_image_interface &image, generic_slot_device *slot);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER (exp1_load) { return force68k_load_cart(image, m_cart); }
uint16_t read16_rom(offs_t offset);
@@ -510,21 +510,21 @@ void force68k_state::fccpu1_eprom_sockets(machine_config &config)
/***************************
Rom loading functions
****************************/
-std::error_condition force68k_state::force68k_load_cart(device_image_interface &image, generic_slot_device *slot)
+std::pair<std::error_condition, std::string> force68k_state::force68k_load_cart(device_image_interface &image, generic_slot_device *slot)
{
uint32_t size = slot->common_get_size("rom");
if (size > 0x2'0000) // Max 128Kb
{
- LOG("Cartridge size exceeding max size (128Kb): %d\n", size);
- osd_printf_error("%s: Cartridge size exceeding max size (128Kb)\n", image.basename());
- return image_error::INVALIDLENGTH;
+ return std::make_pair(
+ image_error::INVALIDLENGTH,
+ util::string_format("Cartridge size %d exceeds max size (128K)", size));
}
slot->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_BIG);
slot->common_load_rom(slot->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/fujitsu/fmt_icmem.cpp b/src/mame/fujitsu/fmt_icmem.cpp
index be155c2d621..313046aeca6 100644
--- a/src/mame/fujitsu/fmt_icmem.cpp
+++ b/src/mame/fujitsu/fmt_icmem.cpp
@@ -60,18 +60,18 @@ ioport_constructor fmt_icmem_device::device_input_ports() const
return INPUT_PORTS_NAME(fmt_icmem);
}
-std::error_condition fmt_icmem_device::call_load()
+std::pair<std::error_condition, std::string> fmt_icmem_device::call_load()
{
memset(m_memcard_ram.get(), 0xff, 0x1000000);
fseek(0, SEEK_SET);
size_t ret = fread(m_memcard_ram.get(), 0x1000000);
if(ret != length())
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
m_change = true;
m_detect = true;
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void fmt_icmem_device::call_unload()
@@ -83,17 +83,17 @@ void fmt_icmem_device::call_unload()
m_detect = false;
}
-std::error_condition fmt_icmem_device::call_create(int format_type, util::option_resolution *format_options)
+std::pair<std::error_condition, std::string> fmt_icmem_device::call_create(int format_type, util::option_resolution *format_options)
{
memset(m_memcard_ram.get(), 0xff, 0x1000000);
size_t ret = fwrite(m_memcard_ram.get(), 0x1000000);
if(ret != 0x1000000)
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
m_change = true;
m_detect = true;
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/fujitsu/fmt_icmem.h b/src/mame/fujitsu/fmt_icmem.h
index a42abe77a02..fd8309143ca 100644
--- a/src/mame/fujitsu/fmt_icmem.h
+++ b/src/mame/fujitsu/fmt_icmem.h
@@ -29,9 +29,9 @@ public:
virtual bool is_reset_on_load() const noexcept override { return false; }
virtual const char *file_extensions() const noexcept override { return "icm"; }
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
- virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
+ virtual std::pair<std::error_condition, std::string> call_create(int format_type, util::option_resolution *format_options) override;
uint8_t static_mem_read(offs_t offset);
void static_mem_write(offs_t offset, uint8_t data);
diff --git a/src/mame/funtech/supracan.cpp b/src/mame/funtech/supracan.cpp
index 2638be2986e..6cf840e79aa 100644
--- a/src/mame/funtech/supracan.cpp
+++ b/src/mame/funtech/supracan.cpp
@@ -1921,15 +1921,12 @@ DEVICE_IMAGE_LOAD_MEMBER(supracan_state::cart_load)
uint32_t size = m_cart->common_get_size("rom");
if (size > 0x40'0000)
- {
- osd_printf_error("%s: Unsupported cartridge size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be no larger than 4M)");
m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_BIG);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/handheld/chessking.cpp b/src/mame/handheld/chessking.cpp
index 2c955ff002e..44ba30dbd3c 100644
--- a/src/mame/handheld/chessking.cpp
+++ b/src/mame/handheld/chessking.cpp
@@ -185,7 +185,7 @@ DEVICE_IMAGE_LOAD_MEMBER(chessking_state::cart_load)
m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
uint8_t chessking_state::cartridge_r(offs_t offset)
diff --git a/src/mame/handheld/gameking.cpp b/src/mame/handheld/gameking.cpp
index 16e02c72a4e..55b668fa4d6 100644
--- a/src/mame/handheld/gameking.cpp
+++ b/src/mame/handheld/gameking.cpp
@@ -257,15 +257,12 @@ DEVICE_IMAGE_LOAD_MEMBER(gameking_state::cart_load)
uint32_t size = m_cart->common_get_size("rom");
if (size > 0x10'0000)
- {
- osd_printf_error("%s: Unsupported cartridge size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be no larger than 1M)");
m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void gameking_state::machine_start()
diff --git a/src/mame/handheld/hh_tms1k.cpp b/src/mame/handheld/hh_tms1k.cpp
index b586beeb314..42fe79974b7 100644
--- a/src/mame/handheld/hh_tms1k.cpp
+++ b/src/mame/handheld/hh_tms1k.cpp
@@ -2938,10 +2938,7 @@ void quizwizc_state::machine_start()
DEVICE_IMAGE_LOAD_MEMBER(quizwizc_state::cart_load)
{
if (!image.loaded_through_softlist())
- {
- osd_printf_error("Can only load through softwarelist\n");
- return image_error::UNSUPPORTED;
- }
+ return std::make_pair(image_error::UNSUPPORTED, "Can only load through software list");
// get cartridge pinout K1 to R connections
const char *pinout = image.get_feature("pinout");
@@ -2949,12 +2946,9 @@ DEVICE_IMAGE_LOAD_MEMBER(quizwizc_state::cart_load)
m_pinout = bitswap<8>(m_pinout,4,3,7,5,2,1,6,0) << 4;
if (m_pinout == 0)
- {
- osd_printf_error("%s: Invalid cartridge pinout\n", image.basename());
- return image_error::BADSOFTWARE;
- }
+ return std::make_pair(image_error::BADSOFTWARE, "Invalid cartridge pinout\n");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void quizwizc_state::update_display()
@@ -3135,16 +3129,13 @@ void tc4_state::machine_start()
DEVICE_IMAGE_LOAD_MEMBER(tc4_state::cart_load)
{
if (!image.loaded_through_softlist())
- {
- osd_printf_error("Can only load through softwarelist\n");
- return image_error::UNSUPPORTED;
- }
+ return std::make_pair(image_error::UNSUPPORTED, "Can only load through software list\n");
// get cartridge pinout R9 to K connections
const char *pinout = image.get_feature("pinout");
m_pinout = pinout ? strtoul(pinout, nullptr, 0) & 0xf : 0xf;
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void tc4_state::update_display()
@@ -14560,16 +14551,13 @@ void playmaker_state::machine_start()
DEVICE_IMAGE_LOAD_MEMBER(playmaker_state::cart_load)
{
if (!image.loaded_through_softlist())
- {
- osd_printf_error("Can only load through softwarelist\n");
- return image_error::UNSUPPORTED;
- }
+ return std::make_pair(image_error::UNSUPPORTED, "Can only load through software list\n");
// get cartridge notch
const char *notch = image.get_feature("notch");
m_notch = notch ? strtoul(notch, nullptr, 0) & 3 : 0;
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void playmaker_state::update_display()
diff --git a/src/mame/handheld/lk3000.cpp b/src/mame/handheld/lk3000.cpp
index 5c14ff40de4..65f1bddfc39 100644
--- a/src/mame/handheld/lk3000.cpp
+++ b/src/mame/handheld/lk3000.cpp
@@ -124,7 +124,7 @@ DEVICE_IMAGE_LOAD_MEMBER(lk3000_state::cart_load)
// extra ram (optional)
m_has_ram = image.get_feature("ram") != nullptr;
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
template <int N>
diff --git a/src/mame/homebrew/phunsy.cpp b/src/mame/homebrew/phunsy.cpp
index 6c84ad89c12..1807fd30344 100644
--- a/src/mame/homebrew/phunsy.cpp
+++ b/src/mame/homebrew/phunsy.cpp
@@ -285,42 +285,34 @@ GFXDECODE_END
// quickloads can start from various addresses, and the files have no header.
QUICKLOAD_LOAD_MEMBER(phunsy_state::quickload_cb)
{
- address_space &space = m_maincpu->space(AS_PROGRAM);
- uint16_t i;
- uint16_t quick_addr = 0x1800;
- std::vector<uint8_t> quick_data;
- std::error_condition result = image_error::UNSPECIFIED;
int const quick_length = image.length();
if (quick_length > 0x4000)
- {
- result = image_error::INVALIDLENGTH;
- osd_printf_error("%s: File too long\n", image.basename());
- image.message(" File too long");
- }
- else
- {
- quick_data.resize(quick_length);
- membank("bankru")->set_entry(0); // point at ram
+ return std::make_pair(image_error::INVALIDLENGTH, "File too long (must be no larger than 16K)");
- uint16_t exec_addr = quick_addr + 2;
+ std::vector<uint8_t> quick_data;
+ quick_data.resize(quick_length);
+ if (image.fread(&quick_data[0], quick_length) != quick_length)
+ return std::make_pair(image_error::UNSPECIFIED, "Cannot read the file");
- for (i = 0; i < quick_length; i++)
- space.write_byte(i+quick_addr, quick_data[i]);
+ constexpr uint16_t QUICK_ADDR = 0x1800;
+ constexpr uint16_t EXEC_ADDR = QUICK_ADDR + 2;
- /* display a message about the loaded quickload */
- image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr);
+ membank("bankru")->set_entry(0); // point at RAM
+ address_space &space = m_maincpu->space(AS_PROGRAM);
+ for (uint16_t i = 0; i < quick_length; i++)
+ space.write_byte(i + QUICK_ADDR, quick_data[i]);
- // Start the quickload
- m_maincpu->set_state_int(S2650_R0, exec_addr>>8);
- m_maincpu->set_state_int(S2650_R1, 0x08);
- m_maincpu->set_state_int(S2650_R2, 0xe0);
- m_maincpu->set_state_int(S2650_R3, 0x83);
- m_maincpu->set_state_int(S2650_PC, exec_addr);
+ // display a message about the loaded quickload
+ image.message(" Quickload: size=%04X : exec=%04X", quick_length, EXEC_ADDR);
- result = std::error_condition();
- }
+ // Start the quickload
+ m_maincpu->set_state_int(S2650_R0, EXEC_ADDR >> 8);
+ m_maincpu->set_state_int(S2650_R1, 0x08);
+ m_maincpu->set_state_int(S2650_R2, 0xe0);
+ m_maincpu->set_state_int(S2650_R3, 0x83);
+ m_maincpu->set_state_int(S2650_PC, EXEC_ADDR);
- return result;
+ return std::make_pair(std::error_condition(), std::string());
}
void phunsy_state::init_phunsy()
diff --git a/src/mame/homebrew/ravens.cpp b/src/mame/homebrew/ravens.cpp
index d76073cd953..f539d267122 100644
--- a/src/mame/homebrew/ravens.cpp
+++ b/src/mame/homebrew/ravens.cpp
@@ -312,69 +312,40 @@ void ravens2_state::kbd_put(u8 data)
QUICKLOAD_LOAD_MEMBER(ravens_base::quickload_cb)
{
- address_space &space = m_maincpu->space(AS_PROGRAM);
- int i;
- int quick_addr = 0x900;
- int exec_addr;
- std::vector<u8> quick_data;
- int read_;
- std::error_condition result = image_error::UNSPECIFIED;
-
int const quick_length = image.length();
if (quick_length < 0x0900)
- {
- result = image_error::INVALIDLENGTH;
- osd_printf_error("%s: File too short\n", image.basename());
- image.message(" File too short");
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "File too short");
else if (quick_length > 0x8000)
+ return std::make_pair(image_error::INVALIDLENGTH, "File too long (must be no more than 32K)");
+
+ std::vector<u8> quick_data;
+ quick_data.resize(quick_length);
+ int const read_ = image.fread( &quick_data[0], quick_length);
+ if (read_ != quick_length)
+ return std::make_pair(image_error::UNSPECIFIED, "Cannot read the file");
+ else if (quick_data[0] != 0xc6)
+ return std::make_pair(image_error::INVALIDIMAGE, "Invalid header");
+
+ int const exec_addr = quick_data[2] * 256 + quick_data[3];
+ if (exec_addr >= quick_length)
{
- result = image_error::INVALIDLENGTH;
- osd_printf_error("%s: File too long\n", image.basename());
- image.message(" File too long");
- }
- else
- {
- quick_data.resize(quick_length);
- read_ = image.fread( &quick_data[0], quick_length);
- if (read_ != quick_length)
- {
- osd_printf_error("%s: Cannot read the file\n", image.basename());
- image.message(" Cannot read the file");
- }
- else if (quick_data[0] != 0xc6)
- {
- result = image_error::INVALIDIMAGE;
- osd_printf_error("%s: Invalid header\n", image.basename());
- image.message(" Invalid header");
- }
- else
- {
- exec_addr = quick_data[2] * 256 + quick_data[3];
-
- if (exec_addr >= quick_length)
- {
- result = image_error::INVALIDIMAGE;
- osd_printf_error("%s: Exec address beyond end of file\n", image.basename());
- image.message(" Exec address beyond end of file");
- }
- else
- {
- for (i = quick_addr; i < read_; i++)
- space.write_byte(i, quick_data[i]);
-
- /* display a message about the loaded quickload */
- image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr);
-
- // Start the quickload
- m_maincpu->set_state_int(S2650_PC, exec_addr);
-
- result = std::error_condition();
- }
- }
+ return std::make_pair(
+ image_error::INVALIDIMAGE,
+ util::string_format("Exec address %04X beyond end of file %04X", exec_addr, quick_length));
}
- return result;
+ constexpr int QUICK_ADDR = 0x900;
+ address_space &space = m_maincpu->space(AS_PROGRAM);
+ for (int i = QUICK_ADDR; i < read_; i++)
+ space.write_byte(i, quick_data[i]);
+
+ // display a message about the loaded quickload
+ image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr);
+
+ // Start the quickload
+ m_maincpu->set_state_int(S2650_PC, exec_addr);
+
+ return std::pair(std::error_condition(), std::string());
}
void ravens_state::ravens(machine_config &config)
diff --git a/src/mame/homebrew/uzebox.cpp b/src/mame/homebrew/uzebox.cpp
index ffb96a01d18..f77e9381d5b 100644
--- a/src/mame/homebrew/uzebox.cpp
+++ b/src/mame/homebrew/uzebox.cpp
@@ -270,7 +270,7 @@ DEVICE_IMAGE_LOAD_MEMBER(uzebox_state::cart_load)
else
memcpy(m_cart->get_rom_base(), image.get_software_region("rom"), size);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/homebrew/z80clock.cpp b/src/mame/homebrew/z80clock.cpp
index d2157904541..9fcb6f37a6c 100644
--- a/src/mame/homebrew/z80clock.cpp
+++ b/src/mame/homebrew/z80clock.cpp
@@ -321,13 +321,13 @@ private:
{
auto length = image.length();
if (length > m_u13.bytes())
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, std::string());
if (image.fread(m_u13, length) != length)
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
m_maincpu->set_pc(0x6000);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
};
diff --git a/src/mame/homelab/homelab.cpp b/src/mame/homelab/homelab.cpp
index 89a081abffd..895dcfff412 100644
--- a/src/mame/homelab/homelab.cpp
+++ b/src/mame/homelab/homelab.cpp
@@ -687,20 +687,12 @@ QUICKLOAD_LOAD_MEMBER(homelab_state::quickload_cb)
u8 ch = 0;
u32 bytes = image.fread(&ch, 1);
if (bytes != 1 || ch != 0xA5)
- {
- osd_printf_error("%s: Invalid header\n", image.basename());
- image.message(" Invalid header");
- return image_error::INVALIDIMAGE;
- }
+ return std::make_pair(image_error::INVALIDIMAGE, "Invalid header");
while ((bytes = image.fread(&ch, 1)) != 0 && ch != 0)
{
if (i >= (std::size(pgmname) - 1))
- {
- osd_printf_error("File name too long\n");
- image.message(" File name too long");
- return image_error::INVALIDIMAGE;
- }
+ return std::make_pair(image_error::INVALIDIMAGE, "File name too long");
// image.message treats characters with bit 7 as nulls, so replace with question mark
pgmname[i] = BIT(ch, 7) ? 0x3f : ch; // build program description
@@ -710,22 +702,14 @@ QUICKLOAD_LOAD_MEMBER(homelab_state::quickload_cb)
pgmname[i] = '\0'; /* terminate string with a null */
if (image.fread(args, sizeof(args)) != sizeof(args))
- {
- osd_printf_error("%s: Unexpected EOF while getting file size\n", image.basename());
- image.message(" Unexpected EOF while getting file size");
- return image_error::UNSPECIFIED;
- }
+ return std::make_pair(image_error::UNSPECIFIED, "Unexpected EOF while getting file size");
u16 quick_addr = little_endianize_int16(args[0]);
u16 quick_length = little_endianize_int16(args[1]);
u16 quick_end = quick_addr+quick_length-1;
if (quick_end > 0x7fff)
- {
- osd_printf_error("%s: File too large\n", image.basename());
- image.message(" File too large");
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "File too large");
/* display a message about the loaded quickload */
image.message(" %s\nsize=%04X : start=%04X : end=%04X",pgmname,quick_length,quick_addr,quick_end);
@@ -735,14 +719,14 @@ QUICKLOAD_LOAD_MEMBER(homelab_state::quickload_cb)
unsigned j = (quick_addr + i);
if (image.fread(&ch, 1) != 1)
{
- osd_printf_error("%s: Unexpected EOF while writing byte to %04X\n", image.basename(), j);
- image.message("%s: Unexpected EOF while writing byte to %04X", pgmname, (unsigned) j);
- return image_error::UNSPECIFIED;
+ return std::make_pair(
+ image_error::UNSPECIFIED,
+ util::string_format("%s: Unexpected EOF while writing byte to %04X", pgmname, j));
}
space.write_byte(j, ch);
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
/* Machine driver */
diff --git a/src/mame/hp/hp48_port.cpp b/src/mame/hp/hp48_port.cpp
index e63e711851b..e434705c222 100644
--- a/src/mame/hp/hp48_port.cpp
+++ b/src/mame/hp/hp48_port.cpp
@@ -45,7 +45,7 @@ void hp48_port_image_device::unfill_port()
}
-std::error_condition hp48_port_image_device::call_load()
+std::pair<std::error_condition, std::string> hp48_port_image_device::call_load()
{
int size = length();
if (size == 0) size = m_max_size; /* default size */
@@ -54,8 +54,9 @@ std::error_condition hp48_port_image_device::call_load()
/* check size */
if ((size < 32*1024) || (size > m_max_size) || (size & (size-1)))
{
- logerror("hp48: image size for %s should be a power of two between %i and %i\n", tag(), 32*1024, m_max_size);
- return image_error::INVALIDLENGTH;
+ return std::make_pair(
+ image_error::INVALIDLENGTH,
+ util::string_format("Image size must be a power of two between %i and %i\n", 32*1024, m_max_size));
}
m_port_size = size;
@@ -63,10 +64,10 @@ std::error_condition hp48_port_image_device::call_load()
fill_port();
fread(m_port_data.get(), m_port_size);
m_hp48->decode_nibble(m_port_data.get(), m_port_data.get(), m_port_size);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
-std::error_condition hp48_port_image_device::call_create(int format_type, util::option_resolution *format_options)
+std::pair<std::error_condition, std::string> hp48_port_image_device::call_create(int format_type, util::option_resolution *format_options)
{
int size = m_max_size;
LOG("hp48_port_image create: size=%i\n", size);
@@ -74,16 +75,17 @@ std::error_condition hp48_port_image_device::call_create(int format_type, util::
/* check size */
/* size must be a power of 2 between 32K and max_size */
- if ( (size < 32*1024) || (size > m_max_size) || (size & (size-1)) )
+ if ((size < 32*1024) || (size > m_max_size) || (size & (size-1)))
{
- logerror( "hp48: image size for %s should be a power of two between %i and %i\n", tag(), 32*1024, m_max_size );
- return image_error::INVALIDLENGTH;
+ return std::make_pair(
+ image_error::INVALIDLENGTH,
+ util::string_format("Image size must be a power of two between %i and %i\n", 32*1024, m_max_size));
}
m_port_size = size;
m_port_write = true;
fill_port();
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void hp48_port_image_device::call_unload()
diff --git a/src/mame/hp/hp48_port.h b/src/mame/hp/hp48_port.h
index 44df0bd4a6d..e5182451177 100644
--- a/src/mame/hp/hp48_port.h
+++ b/src/mame/hp/hp48_port.h
@@ -43,9 +43,9 @@ public:
virtual const char *image_type_name() const noexcept override { return "port"; }
virtual const char *image_brief_type_name() const noexcept override { return "p"; }
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
- virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
+ virtual std::pair<std::error_condition, std::string> call_create(int format_type, util::option_resolution *format_options) override;
uint32_t port_size() const { return m_port_size; }
bool port_write() const { return m_port_write; }
diff --git a/src/mame/hp/hp80_optrom.cpp b/src/mame/hp/hp80_optrom.cpp
index dadb40ed742..b5a2a7d7d96 100644
--- a/src/mame/hp/hp80_optrom.cpp
+++ b/src/mame/hp/hp80_optrom.cpp
@@ -44,42 +44,42 @@ void hp80_optrom_device::device_start()
{
}
-std::error_condition hp80_optrom_device::call_load()
+std::pair<std::error_condition, std::string> hp80_optrom_device::call_load()
{
LOG("hp80_optrom: call_load\n");
if (!loaded_through_softlist()) {
- LOG("hp80_optrom: must be loaded from sw list\n");
- return image_error::UNSUPPORTED;
+ return std::make_pair(image_error::UNSUPPORTED, "Images must be loaded from software list");
}
const char *sc_feature = get_feature("sc");
if (sc_feature == nullptr) {
- LOG("hp80_optrom: no 'sc' feature\n");
- return image_error::BADSOFTWARE;
+ return std::make_pair(image_error::BADSOFTWARE, "Software item is missing 'sc' feature");
}
unsigned sc;
if (sc_feature[ 0 ] != '0' || sc_feature[ 1 ] != 'x' || sscanf(&sc_feature[ 2 ] , "%x" , &sc) != 1) {
- LOG("hp80_optrom: can't parse 'sc' feature\n");
- return image_error::BADSOFTWARE;
+ return std::make_pair(image_error::BADSOFTWARE, "Can't parse software item 'sc' feature");
}
// Valid SC values: 0x01..0xff
if (sc < 1 || sc > 0xff) {
- LOG("hp80_optrom: illegal select code (%x)\n" , sc);
- return image_error::BADSOFTWARE;
+ return std::make_pair(
+ image_error::BADSOFTWARE,
+ util::string_format("Illegal select code (%x)\n" , sc));
}
auto length = get_software_region_length("rom");
if (length != HP80_OPTROM_SIZE) {
- LOG("hp80_optrom: illegal region length (%x)\n" , length);
- return image_error::BADSOFTWARE;
+ return std::make_pair(
+ image_error::INVALIDLENGTH,
+ util::string_format("Incorrect 'rom' data area size (%u, should be %u)", length, HP80_OPTROM_SIZE));
}
LOG("hp80_optrom: loaded SC=0x%02x\n" , sc);
m_select_code = sc;
- return std::error_condition();
+
+ return std::make_pair(std::error_condition(), std::string());
}
void hp80_optrom_device::call_unload()
diff --git a/src/mame/hp/hp80_optrom.h b/src/mame/hp/hp80_optrom.h
index 65336115598..c23203aaaaf 100644
--- a/src/mame/hp/hp80_optrom.h
+++ b/src/mame/hp/hp80_optrom.h
@@ -38,7 +38,7 @@ protected:
virtual void device_start() override;
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/mame/hp/hp9825_optrom.cpp b/src/mame/hp/hp9825_optrom.cpp
index 67df198a2c5..36cbfb97280 100644
--- a/src/mame/hp/hp9825_optrom.cpp
+++ b/src/mame/hp/hp9825_optrom.cpp
@@ -105,23 +105,23 @@ void hp9825_optrom_device::device_start()
{
}
-std::error_condition hp9825_optrom_device::call_load()
+std::pair<std::error_condition, std::string> hp9825_optrom_device::call_load()
{
LOG("hp9825_optrom: call_load\n");
if (!loaded_through_softlist()) {
- LOG("hp9825_optrom: must be loaded from sw list\n");
- return image_error::UNSUPPORTED;
+ return std::make_pair(image_error::UNSUPPORTED, "Option ROMs must be loaded from software list");
}
for (const struct optrom_region& reg : region_tab) {
auto len = get_software_region_length(reg.m_tag) / 2;
if (len != 0 && len != reg.m_size) {
- LOG("Region %s: wrong size (%u should be %u)\n" , reg.m_tag , len , reg.m_size);
- return image_error::BADSOFTWARE;
+ return std::make_pair(
+ image_error::BADSOFTWARE,
+ util::string_format("Incorrect '%s' data size (%u, should be %u)", reg.m_tag, len, reg.m_size));
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void hp9825_optrom_device::call_unload()
diff --git a/src/mame/hp/hp9825_optrom.h b/src/mame/hp/hp9825_optrom.h
index fe1f365c3f4..769033f550b 100644
--- a/src/mame/hp/hp9825_optrom.h
+++ b/src/mame/hp/hp9825_optrom.h
@@ -34,7 +34,7 @@ protected:
virtual void device_start() override;
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/mame/hp/hp9845_optrom.cpp b/src/mame/hp/hp9845_optrom.cpp
index 637437332d1..74dc12ebf51 100644
--- a/src/mame/hp/hp9845_optrom.cpp
+++ b/src/mame/hp/hp9845_optrom.cpp
@@ -34,24 +34,21 @@ void hp9845_optrom_device::device_start()
{
}
-std::error_condition hp9845_optrom_device::call_load()
+std::pair<std::error_condition, std::string> hp9845_optrom_device::call_load()
{
logerror("hp9845_optrom: call_load\n");
if (!loaded_through_softlist()) {
- logerror("hp9845_optrom: must be loaded from sw list\n");
- return image_error::UNSUPPORTED;
+ return std::make_pair(image_error::UNSUPPORTED, "Option ROMs must be loaded from software list");
}
const char *base_feature = get_feature("base");
if (base_feature == nullptr) {
- logerror("hp9845_optrom: no 'base' feature\n");
- return image_error::BADSOFTWARE;
+ return std::make_pair(image_error::BADSOFTWARE, "Software item is missing 'base' feature");
}
offs_t base_addr;
if (base_feature[ 0 ] != '0' || base_feature[ 1 ] != 'x' || sscanf(&base_feature[ 2 ] , "%x" , &base_addr) != 1) {
- logerror("hp9845_optrom: can't parse 'base' feature\n");
- return image_error::BADSOFTWARE;
+ return std::make_pair(image_error::BADSOFTWARE, "Can't parse software item 'base' feature");
}
// Valid BSC values for ROMs on LPU drawer: 0x07 0x0b .... 0x3b
@@ -60,15 +57,17 @@ std::error_condition hp9845_optrom_device::call_load()
// Bit 15 of base address must be 0
// Base address must be multiple of 0x1000
if ((base_addr & ~0x3f7000UL) != 0 || ((base_addr & 0x30000) != 0x10000 && (base_addr & 0x30000) != 0x30000) || base_addr < 0x70000) {
- logerror("hp9845_optrom: illegal base address (%x)\n" , base_addr);
- return image_error::BADSOFTWARE;
+ return std::make_pair(
+ image_error::BADSOFTWARE,
+ util::string_format("Illegal base address (%x)", base_addr));
}
auto length = get_software_region_length("rom") / 2;
if (length < 0x1000 || length > 0x8000 || (length & 0xfff) != 0 || ((base_addr & 0x7000) + length) > 0x8000) {
- logerror("hp9845_optrom: illegal region length (%x)\n" , length);
- return image_error::BADSOFTWARE;
+ return std::make_pair(
+ image_error::INVALIDLENGTH,
+ util::string_format("Illegal 'rom' data area size (%u)", length));
}
offs_t end_addr = base_addr + length - 1;
@@ -83,7 +82,7 @@ std::error_condition hp9845_optrom_device::call_load()
m_base_addr = base_addr;
m_end_addr = end_addr;
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void hp9845_optrom_device::call_unload()
diff --git a/src/mame/hp/hp9845_optrom.h b/src/mame/hp/hp9845_optrom.h
index 652261e5c08..1239a2b87b7 100644
--- a/src/mame/hp/hp9845_optrom.h
+++ b/src/mame/hp/hp9845_optrom.h
@@ -28,7 +28,7 @@ protected:
virtual void device_start() override;
// device_rom_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/mame/hp/hp_ipc_optrom.cpp b/src/mame/hp/hp_ipc_optrom.cpp
index 76eec5f30e5..5e06c8f5f7f 100644
--- a/src/mame/hp/hp_ipc_optrom.cpp
+++ b/src/mame/hp/hp_ipc_optrom.cpp
@@ -49,33 +49,31 @@ void hp_ipc_optrom_device::device_start()
{
}
-std::error_condition hp_ipc_optrom_device::call_load()
+std::pair<std::error_condition, std::string> hp_ipc_optrom_device::call_load()
{
LOG("hp_ipc_optrom: call_load\n");
if (!loaded_through_softlist()) {
- LOG("hp_ipc_optrom: must be loaded from sw list\n");
- return image_error::UNSUPPORTED;
+ return std::make_pair(image_error::UNSUPPORTED, "Option ROMs must be loaded from software list");
}
const char *base_feature = get_feature("base");
if (base_feature == nullptr) {
- LOG("hp_ipc_optrom: no 'base' feature\n");
- return image_error::BADSOFTWARE;
+ return std::make_pair(image_error::BADSOFTWARE, "Software item is missing 'base' feature");
}
if (base_feature[ 0 ] != '0' || base_feature[ 1 ] != 'x' || sscanf(&base_feature[ 2 ] , "%x" , &m_base) != 1) {
- LOG("hp_ipc_optrom: can't parse 'base' feature\n");
- return image_error::BADSOFTWARE;
+ return std::make_pair(image_error::BADSOFTWARE, "Can't parse software item 'base' feature");
}
// Valid base values: multiple of 1M, [0x100000..0x4fffff]
if ((m_base & 0xfffffU) != 0 || m_base < 0x100000U || m_base > 0x400000U) {
- LOG("hp_ipc_optrom: illegal base (%x)\n" , m_base);
- return image_error::BADSOFTWARE;
+ return std::make_pair(
+ image_error::BADSOFTWARE,
+ util::string_format("Illegal base address (%x)", m_base));
}
LOG("hp_ipc_optrom: loaded base=0x%06x\n" , m_base);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void hp_ipc_optrom_device::call_unload()
diff --git a/src/mame/hp/hp_ipc_optrom.h b/src/mame/hp/hp_ipc_optrom.h
index ca8c1bcdae4..4e8f583c77b 100644
--- a/src/mame/hp/hp_ipc_optrom.h
+++ b/src/mame/hp/hp_ipc_optrom.h
@@ -35,7 +35,7 @@ protected:
virtual void device_start() override;
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
diff --git a/src/mame/igs/pgm2_memcard.cpp b/src/mame/igs/pgm2_memcard.cpp
index a269d823d9e..d80a1a196ce 100644
--- a/src/mame/igs/pgm2_memcard.cpp
+++ b/src/mame/igs/pgm2_memcard.cpp
@@ -43,24 +43,24 @@ void pgm2_memcard_device::device_start()
with the given index
-------------------------------------------------*/
-std::error_condition pgm2_memcard_device::call_load()
+std::pair<std::error_condition, std::string> pgm2_memcard_device::call_load()
{
m_authenticated = false;
if(length() != 0x108)
- return image_error::INVALIDLENGTH;
+ return std::pair(image_error::INVALIDLENGTH, "Incorrect memory card file size (must be 264 bytes)");
fseek(0, SEEK_SET);
size_t ret = fread(m_memcard_data, 0x100);
if(ret != 0x100)
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
ret = fread(m_protection_data, 4);
if (ret != 4)
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
ret = fread(m_security_data, 4);
if (ret != 4)
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void pgm2_memcard_device::call_unload()
@@ -72,14 +72,14 @@ void pgm2_memcard_device::call_unload()
fwrite(m_security_data, 4);
}
-std::error_condition pgm2_memcard_device::call_create(int format_type, util::option_resolution *format_options)
+std::pair<std::error_condition, std::string> pgm2_memcard_device::call_create(int format_type, util::option_resolution *format_options)
{
m_authenticated = false;
// cards must contain valid defaults for each game / region or they don't work?
memory_region *rgn = memregion("^default_card");
if (!rgn)
- return image_error::INTERNAL;
+ return std::make_pair(image_error::INTERNAL, std::string());
memcpy(m_memcard_data, rgn->base(), 0x100);
memcpy(m_protection_data, rgn->base() + 0x100, 4);
@@ -87,9 +87,9 @@ std::error_condition pgm2_memcard_device::call_create(int format_type, util::opt
size_t ret = fwrite(rgn->base(), 0x108);
if(ret != 0x108)
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void pgm2_memcard_device::auth(u8 p1, u8 p2, u8 p3)
diff --git a/src/mame/igs/pgm2_memcard.h b/src/mame/igs/pgm2_memcard.h
index 781d7acf6b3..1b9525b82aa 100644
--- a/src/mame/igs/pgm2_memcard.h
+++ b/src/mame/igs/pgm2_memcard.h
@@ -32,10 +32,9 @@ public:
virtual bool is_reset_on_load() const noexcept override { return false; }
virtual const char *file_extensions() const noexcept override { return "pg2,bin,mem"; }
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
- virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
-
+ virtual std::pair<std::error_condition, std::string> call_create(int format_type, util::option_resolution *format_options) override;
u8 read(offs_t offset);
void write(offs_t offset, u8 data);
diff --git a/src/mame/intel/imm6_76.cpp b/src/mame/intel/imm6_76.cpp
index 1ecb6c09c97..81155411ea9 100644
--- a/src/mame/intel/imm6_76.cpp
+++ b/src/mame/intel/imm6_76.cpp
@@ -48,23 +48,33 @@ void intel_imm6_76_device::device_start()
}
-std::error_condition intel_imm6_76_device::call_load()
+std::pair<std::error_condition, std::string> intel_imm6_76_device::call_load()
{
if (length() != std::size(m_data))
- return image_error::INVALIDLENGTH;
+ {
+ return std::make_pair(
+ image_error::INVALIDLENGTH,
+ util::string_format("Incorrect PROM image length (must be %u bytes)", std::size(m_data)));
+ }
else if (fread(m_data, std::size(m_data)) != std::size(m_data))
- return image_error::UNSPECIFIED;
+ {
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
+ }
else
- return std::error_condition();
+ {
+ return std::make_pair(std::error_condition(), std::string());
+ }
}
-std::error_condition intel_imm6_76_device::call_create(int format_type, util::option_resolution *format_options)
+std::pair<std::error_condition, std::string> intel_imm6_76_device::call_create(
+ int format_type,
+ util::option_resolution *format_options)
{
std::fill(std::begin(m_data), std::end(m_data), 0U);
if (fwrite(m_data, std::size(m_data)) != std::size(m_data))
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
else
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void intel_imm6_76_device::call_unload()
diff --git a/src/mame/intel/imm6_76.h b/src/mame/intel/imm6_76.h
index f2b10bc6750..d590cd1b97f 100644
--- a/src/mame/intel/imm6_76.h
+++ b/src/mame/intel/imm6_76.h
@@ -152,8 +152,8 @@ public:
intel_imm6_76_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock);
// device_image_interface implementation
- virtual std::error_condition call_load() override;
- virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_create(int format_type, util::option_resolution *format_options) override;
virtual void call_unload() override;
// device_image_interface static info
diff --git a/src/mame/intel/rex6000.cpp b/src/mame/intel/rex6000.cpp
index fed5d44828d..67d2dcc72bf 100644
--- a/src/mame/intel/rex6000.cpp
+++ b/src/mame/intel/rex6000.cpp
@@ -27,6 +27,7 @@
#include "emu.h"
+
#include "bus/rs232/rs232.h"
#include "cpu/z80/z80.h"
#include "machine/ins8250.h"
@@ -37,6 +38,7 @@
#include "machine/timer.h"
#include "imagedev/snapquik.h"
#include "sound/beep.h"
+
#include "emupal.h"
#include "screen.h"
#include "speaker.h"
@@ -740,7 +742,7 @@ QUICKLOAD_LOAD_MEMBER(rex6000_state::quickload_rex6000)
image.fread(&data[0], image.length());
if(strncmp((const char*)&data[0], magic, 21))
- return image_error::INVALIDIMAGE;
+ return std::make_pair(image_error::INVALIDIMAGE, std::string());
img_start = strlen((const char*)&data[0]) + 5;
img_start += 0xa0; //skip the icon (40x32 pixel)
@@ -748,7 +750,7 @@ QUICKLOAD_LOAD_MEMBER(rex6000_state::quickload_rex6000)
for (uint32_t i=0; i<image.length() - img_start ;i++)
m_flash0b->write_raw(i, data[img_start + i]);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
int oz750_state::oz_wzd_extract_tag(const std::vector<uint8_t> &data, const char *tag, char *dest_buf)
@@ -796,7 +798,7 @@ QUICKLOAD_LOAD_MEMBER(oz750_state::quickload_oz750)
oz_wzd_extract_tag(data, "<DATA TYPE>", data_type);
if (strcmp(data_type, "MY PROGRAMS"))
- return image_error::INVALIDIMAGE;
+ return std::make_pair(image_error::INVALIDIMAGE, std::string());
oz_wzd_extract_tag(data, "<TITLE>", app_name);
oz_wzd_extract_tag(data, "<DATA>", file_name);
@@ -806,7 +808,7 @@ QUICKLOAD_LOAD_MEMBER(oz750_state::quickload_oz750)
uint32_t img_start = oz_wzd_extract_tag(data, "<BIN>", nullptr);
if (img_start == 0)
- return image_error::INVALIDIMAGE;
+ return std::make_pair(image_error::INVALIDIMAGE, std::string());
uint16_t icon_size = data[img_start++];
@@ -846,7 +848,7 @@ QUICKLOAD_LOAD_MEMBER(oz750_state::quickload_oz750)
for (int i=img_start; i<image.length(); i++)
flash->write_byte(pos++, data[i]); // data
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/interton/vc4000.cpp b/src/mame/interton/vc4000.cpp
index f29f7da806e..af69e474b2b 100644
--- a/src/mame/interton/vc4000.cpp
+++ b/src/mame/interton/vc4000.cpp
@@ -397,132 +397,89 @@ void vc4000_state::machine_start()
QUICKLOAD_LOAD_MEMBER(vc4000_state::quickload_cb)
{
- address_space &space = m_maincpu->space(AS_PROGRAM);
- int i;
- int exec_addr;
- int quick_length;
+ int const quick_length = image.length();
std::vector<uint8_t> quick_data;
- int read_;
- std::error_condition result = image_error::UNSUPPORTED;
-
- quick_length = image.length();
quick_data.resize(quick_length);
- read_ = image.fread( &quick_data[0], quick_length);
+ int read_ = image.fread( &quick_data[0], quick_length);
if (read_ != quick_length)
+ return std::make_pair(image_error::UNSPECIFIED, "Cannot read the file");
+
+ address_space &space = m_maincpu->space(AS_PROGRAM);
+
+ if (image.is_filetype("tvc"))
{
- result = image_error::UNSPECIFIED;
- osd_printf_error("%s: Cannot read the file\n", image.basename());
- image.message(" Cannot read the file");
+ if (quick_length < 0x5)
+ return std::make_pair(image_error::INVALIDLENGTH, "File too short");
+ else if (quick_data[0] != 2)
+ return std::make_pair(image_error::INVALIDIMAGE, "Invalid header");
+
+ int const quick_addr = quick_data[1] * 256 + quick_data[2];
+ if ((quick_length + quick_addr - 5) > 0x1600)
+ return std::make_pair(image_error::INVALIDLENGTH, "File too long");
+
+ int const exec_addr = quick_data[3] * 256 + quick_data[4];
+
+ space.write_byte(0x08be, quick_data[3]);
+ space.write_byte(0x08bf, quick_data[4]);
+
+ for (int i = 5; i < quick_length; i++)
+ space.write_byte(i - 5 + quick_addr, quick_data[i]);
+
+ // display a message about the loaded quickload
+ image.message(" Quickload: size=%04X : start=%04X : end=%04X : exec=%04X",quick_length-5,quick_addr,quick_addr+quick_length-5,exec_addr);
+
+ // Start the quickload
+ m_maincpu->set_state_int(S2650_PC, exec_addr);
+
+ return std::make_pair(std::error_condition(), std::string());
}
- else
+ else if (image.is_filetype("pgm"))
{
- if (image.is_filetype("tvc"))
+ if (quick_length < 0x904)
+ return std::make_pair(image_error::INVALIDLENGTH, "File too short");
+ else if (quick_length > 0x2000)
+ return std::make_pair(image_error::INVALIDLENGTH, "File too long (must be no larger than 8K)");
+ else if (quick_data[0] != 0)
+ return std::make_pair(image_error::INVALIDIMAGE, "Invalid header");
+
+ int const exec_addr = quick_data[1] * 256 + quick_data[2];
+ if (exec_addr >= quick_length)
+ {
+ return std::make_pair(
+ image_error::INVALIDIMAGE,
+ util::string_format("Exec address %04X beyond end of file %04X", exec_addr, quick_length));
+ }
+
+ space.write_byte(0x08be, quick_data[1]);
+ space.write_byte(0x08bf, quick_data[2]);
+
+ // load to 08C0-15FF (standard ram + extra)
+ read_ = 0x1600;
+ if (quick_length < 0x1600)
+ read_ = quick_length;
+ for (int i = 0x8c0; i < read_; i++)
+ space.write_byte(i, quick_data[i]);
+
+ // load to 1F50-1FAF (PVI regs)
+ read_ = 0x1fb0;
+ if (quick_length < 0x1fb0)
+ read_ = quick_length;
+ if (quick_length > 0x1fc0)
{
- if (quick_data[0] != 2)
- {
- result = image_error::INVALIDIMAGE;
- osd_printf_error("%s: Invalid header\n", image.basename());
- image.message(" Invalid header");
- }
- else
- {
- int quick_addr = quick_data[1] * 256 + quick_data[2];
- exec_addr = quick_data[3] * 256 + quick_data[4];
-
- if (quick_length < 0x5)
- {
- result = image_error::INVALIDLENGTH;
- osd_printf_error("%s: File too short\n", image.basename());
- image.message(" File too short");
- }
- else
- if ((quick_length + quick_addr - 5) > 0x1600)
- {
- result = image_error::INVALIDLENGTH;
- osd_printf_error("%s: File too long\n", image.basename());
- image.message(" File too long");
- }
- else
- {
- space.write_byte(0x08be, quick_data[3]);
- space.write_byte(0x08bf, quick_data[4]);
-
- for (i = 5; i < quick_length; i++)
- space.write_byte(i - 5 + quick_addr, quick_data[i]);
-
- /* display a message about the loaded quickload */
- image.message(" Quickload: size=%04X : start=%04X : end=%04X : exec=%04X",quick_length-5,quick_addr,quick_addr+quick_length-5,exec_addr);
-
- // Start the quickload
- m_maincpu->set_state_int(S2650_PC, exec_addr);
- result = std::error_condition();
- }
- }
+ for (int i = 0x1f50; i < read_; i++)
+ vc4000_video_w(i-0x1f00, quick_data[i]);
}
- else
- if (image.is_filetype("pgm"))
- {
- if (quick_data[0] != 0)
- {
- result = image_error::INVALIDIMAGE;
- osd_printf_error("%s: Invalid header\n", image.basename());
- image.message(" Invalid header");
- }
- else
- {
- exec_addr = quick_data[1] * 256 + quick_data[2];
-
- if (exec_addr >= quick_length)
- {
- result = image_error::INVALIDIMAGE;
- osd_printf_error("%s: Exec address beyond end of file\n", image.basename());
- image.message(" Exec address beyond end of file");
- }
- else
- if (quick_length < 0x904)
- {
- result = image_error::INVALIDLENGTH;
- osd_printf_error("%s: File too short\n", image.basename());
- image.message(" File too short");
- }
- else
- if (quick_length > 0x2000)
- {
- result = image_error::INVALIDLENGTH;
- osd_printf_error("%s: File too long\n", image.basename());
- image.message(" File too long");
- }
- else
- {
- space.write_byte(0x08be, quick_data[1]);
- space.write_byte(0x08bf, quick_data[2]);
-
- // load to 08C0-15FF (standard ram + extra)
- int read_ = 0x1600;
- if (quick_length < 0x1600)
- read_ = quick_length;
- for (i = 0x8c0; i < read_; i++)
- space.write_byte(i, quick_data[i]);
-
- // load to 1F50-1FAF (PVI regs)
- read_ = 0x1FB0;
- if (quick_length < 0x1FB0)
- read_ = quick_length;
- if (quick_length > 0x1FC0)
- for (i = 0x1F50; i < read_; i++)
- vc4000_video_w(i-0x1f00, quick_data[i]);
-
- /* display a message about the loaded quickload */
- image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr);
-
- // Start the quickload
- m_maincpu->set_state_int(S2650_PC, exec_addr);
- result = std::error_condition();
- }
- }
- }
+
+ // display a message about the loaded quickload */
+ image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr);
+
+ // Start the quickload
+ m_maincpu->set_state_int(S2650_PC, exec_addr);
+
+ return std::make_pair(std::error_condition(), std::string());
}
- return result;
+
+ return std::make_pair(image_error::UNSUPPORTED, std::string());
}
static void vc4000_cart(device_slot_interface &device)
diff --git a/src/mame/kaypro/kaypro_m.cpp b/src/mame/kaypro/kaypro_m.cpp
index 743874d2ecc..7b308c5bbd6 100644
--- a/src/mame/kaypro/kaypro_m.cpp
+++ b/src/mame/kaypro/kaypro_m.cpp
@@ -273,18 +273,18 @@ QUICKLOAD_LOAD_MEMBER(kaypro_state::quickload_cb)
/* Avoid loading a program if CP/M-80 is not in memory */
if ((prog_space.read_byte(0) != 0xc3) || (prog_space.read_byte(5) != 0xc3))
- return image_error::UNSUPPORTED;
+ return std::make_pair(image_error::UNSUPPORTED, std::string());
if (image.length() >= 0xfd00)
- return image_error::INVALIDIMAGE;
+ return std::make_pair(image_error::INVALIDLENGTH, std::string());
/* Load image to the TPA (Transient Program Area) */
u16 quickload_size = image.length();
for (u16 i = 0; i < quickload_size; i++)
{
u8 data;
- if (image.fread( &data, 1) != 1)
- return image_error::UNSPECIFIED;
+ if (image.fread(&data, 1) != 1)
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
prog_space.write_byte(i+0x100, data);
}
@@ -293,5 +293,5 @@ QUICKLOAD_LOAD_MEMBER(kaypro_state::quickload_cb)
m_maincpu->set_pc(0x100); // start program
m_maincpu->set_state_int(Z80_SP, 256 * prog_space.read_byte(7) - 300); // put the stack a bit before BDOS
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/leapfrog/iquest.cpp b/src/mame/leapfrog/iquest.cpp
index 22ff5248d55..b61b102d008 100644
--- a/src/mame/leapfrog/iquest.cpp
+++ b/src/mame/leapfrog/iquest.cpp
@@ -509,7 +509,7 @@ DEVICE_IMAGE_LOAD_MEMBER(leapfrog_iquest_state::cart_load)
m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
static INPUT_PORTS_START( leapfrog_iquest )
diff --git a/src/mame/leapfrog/leappad.cpp b/src/mame/leapfrog/leappad.cpp
index 15ab6dd43c4..65785a721c5 100644
--- a/src/mame/leapfrog/leappad.cpp
+++ b/src/mame/leapfrog/leappad.cpp
@@ -141,7 +141,7 @@ DEVICE_IMAGE_LOAD_MEMBER(leapfrog_leappad_state::cart_load)
m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
static INPUT_PORTS_START( leapfrog_leappad )
diff --git a/src/mame/leapfrog/leapster.cpp b/src/mame/leapfrog/leapster.cpp
index 0c34e2a6849..c6894be6d9f 100644
--- a/src/mame/leapfrog/leapster.cpp
+++ b/src/mame/leapfrog/leapster.cpp
@@ -428,7 +428,7 @@ DEVICE_IMAGE_LOAD_MEMBER( leapster_state::cart_load )
m_cart->rom_alloc(size, GENERIC_ROM32_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void leapster_state::machine_start()
diff --git a/src/mame/leapfrog/leapster_explorer.cpp b/src/mame/leapfrog/leapster_explorer.cpp
index 160e4da5e44..d6cedf6c723 100644
--- a/src/mame/leapfrog/leapster_explorer.cpp
+++ b/src/mame/leapfrog/leapster_explorer.cpp
@@ -75,7 +75,7 @@ DEVICE_IMAGE_LOAD_MEMBER(leapfrog_leapster_explorer_state::cart_load)
m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
static INPUT_PORTS_START( leapfrog_leapster_explorer )
diff --git a/src/mame/luxor/abc80.cpp b/src/mame/luxor/abc80.cpp
index f2e4f4b4e4b..1afd34834bc 100644
--- a/src/mame/luxor/abc80.cpp
+++ b/src/mame/luxor/abc80.cpp
@@ -683,7 +683,7 @@ QUICKLOAD_LOAD_MEMBER(abc80_state::quickload_cb)
space.write_byte(HEAD + 1, head >> 8);
if (LOG) logerror("HEAD %04x\n",address);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/luxor/abc80x.cpp b/src/mame/luxor/abc80x.cpp
index d219bab822a..8c2cf1a88ac 100644
--- a/src/mame/luxor/abc80x.cpp
+++ b/src/mame/luxor/abc80x.cpp
@@ -2016,7 +2016,7 @@ QUICKLOAD_LOAD_MEMBER(abc800_state::quickload_cb)
space.write_byte(0xff32, comcs & 0xff);
space.write_byte(0xff33, comcs >> 8);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/matsushita/jr100.cpp b/src/mame/matsushita/jr100.cpp
index 6665c04199a..9c75f9a3965 100644
--- a/src/mame/matsushita/jr100.cpp
+++ b/src/mame/matsushita/jr100.cpp
@@ -341,19 +341,19 @@ QUICKLOAD_LOAD_MEMBER(jr100_state::quickload_cb)
int read_;
quick_length = image.length();
if (quick_length >= 0xffff)
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, std::string());
read_ = image.fread(buf, quick_length);
if (read_ != quick_length)
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
if (buf[0]!=0x50 || buf[1]!=0x52 || buf[2]!=0x4F || buf[3]!=0x47)
// this is not PRG
- return image_error::INVALIDIMAGE;
+ return std::make_pair(image_error::INVALIDIMAGE, std::string());
int pos = 4;
if (readByLittleEndian(buf,pos)!=1)
// not version 1 of PRG file
- return image_error::INVALIDIMAGE;
+ return std::make_pair(image_error::INVALIDIMAGE, std::string());
pos += 4;
uint32_t len =readByLittleEndian(buf,pos); pos+= 4;
@@ -380,7 +380,7 @@ QUICKLOAD_LOAD_MEMBER(jr100_state::quickload_cb)
m_ram[13] = ((end_address + 3) & 0xFF);
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void jr100_state::jr100(machine_config &config)
diff --git a/src/mame/mchester/ssem.cpp b/src/mame/mchester/ssem.cpp
index 02d2e55b561..8bd173912b4 100644
--- a/src/mame/mchester/ssem.cpp
+++ b/src/mame/mchester/ssem.cpp
@@ -554,18 +554,12 @@ QUICKLOAD_LOAD_MEMBER(ssem_state::quickload_cb)
std::string image_line = read_line(image);
if (image_line.empty())
- {
- image.message("No data in line 1");
- return image_error::INVALIDIMAGE;
- }
+ return std::make_pair(image_error::INVALIDIMAGE, "Invalid image file: no data in line 1");
sscanf(image_line.c_str(), "%d", &num_lines); //num_lines = std::stoul(image_line);
if (num_lines < 1)
- {
- image.message("No data to process");
- return image_error::INVALIDIMAGE;
- }
+ return std::make_pair(image_error::INVALIDIMAGE, "Invalid image file: no data to process");
for (u32 i = 0; i < num_lines; i++)
{
@@ -575,8 +569,9 @@ QUICKLOAD_LOAD_MEMBER(ssem_state::quickload_cb)
if (length < 8)
{
- image.message("Bad data (%s) in line %d",image_line.c_str(),i+2);
- return image_error::INVALIDIMAGE;
+ return std::make_pair(
+ image_error::INVALIDIMAGE,
+ util::string_format("Bad data (%s) in line %d", image_line, i + 2));
}
// Isolate and convert 4-digit decimal address
@@ -587,8 +582,9 @@ QUICKLOAD_LOAD_MEMBER(ssem_state::quickload_cb)
{
if (length < 37)
{
- image.message("Bad data (%s) in line %d",image_line.c_str(),i+2);
- return image_error::INVALIDIMAGE;
+ return std::make_pair(
+ image_error::INVALIDIMAGE,
+ util::string_format("Bad data (%s) in line %d", image_line, i + 2));
}
// Parse a line such as: 0000:00000110101001000100000100000100
@@ -639,7 +635,7 @@ QUICKLOAD_LOAD_MEMBER(ssem_state::quickload_cb)
space.write_byte((line << 2) + 3, BIT(word, 0, 8));
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
/****************************************************\
diff --git a/src/mame/memotech/mtx_m.cpp b/src/mame/memotech/mtx_m.cpp
index b2b4ad02ce9..fe813129bba 100644
--- a/src/mame/memotech/mtx_m.cpp
+++ b/src/mame/memotech/mtx_m.cpp
@@ -402,15 +402,12 @@ DEVICE_IMAGE_LOAD_MEMBER( mtx_state::extrom_load )
uint32_t size = m_extrom->common_get_size("rom");
if (size > 0x80000)
- {
- osd_printf_error("%s: Unsupported rom size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported ROM size (only 512K supported)");
m_extrom->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
m_extrom->common_load_rom(m_extrom->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
/***************************************************************************
@@ -424,27 +421,18 @@ SNAPSHOT_LOAD_MEMBER(mtx_state::snapshot_cb)
uint64_t length = image.length();
if (length < 18)
- {
- osd_printf_error("%s: File too short\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "File too short (must be at least 18 bytes)");
if (length >= 0x10000 - 0x4000 + 18)
- {
- osd_printf_error("%s: File too long\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "File too long (must be at no more than 48K data)");
auto data = std::make_unique<uint8_t []>(length);
if (image.fread(data.get(), length) != length)
- {
- osd_printf_error("%s: Error reading file\n", image.basename());
- return image_error::UNSPECIFIED;
- }
+ return std::make_pair(image_error::UNSPECIFIED, "Error reading file");
// verify first byte
if (data[0] != 0xff)
- return image_error::INVALIDIMAGE;
+ return std::make_pair(image_error::INVALIDIMAGE, std::string());
// get tape name
char tape_name[16];
@@ -477,7 +465,7 @@ SNAPSHOT_LOAD_MEMBER(mtx_state::snapshot_cb)
logerror("snapshot name = '%s', system_size = 0x%04x, data_size = 0x%04x\n", tape_name, system_variables_size, data_size);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
/***************************************************************************
@@ -489,37 +477,31 @@ QUICKLOAD_LOAD_MEMBER(mtx_state::quickload_cb)
uint64_t const length = image.length();
if (length < 4)
- {
- osd_printf_error("%s: File too short\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
-
- if (length >= 0x10000 - 0x4000 + 4)
- {
- osd_printf_error("%s: File too long\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "File too short (must be at least 4 bytes)");
+ else if (length >= 0x10000 - 0x4000 + 4)
+ return std::make_pair(image_error::INVALIDLENGTH, "File too long (must be at no more than 48K data)");
auto data = std::make_unique<uint8_t []>(length);
if (image.fread(data.get(), length) != length)
- {
- osd_printf_error("%s: Error reading file\n", image.basename());
- return image_error::UNSPECIFIED;
- }
+ return std::make_pair(image_error::UNSPECIFIED, "Error reading file");
uint16_t const code_base = pick_integer_le(data.get(), 0, 2);
uint16_t const code_length = pick_integer_le(data.get(), 2, 2);
- if (length < code_length)
+ if (length < (code_length + 4))
+ return std::make_pair(image_error::INVALIDIMAGE, "File too short for code length in header");
+
+ if (code_base < 0x4000)
{
- osd_printf_error("%s: File too short\n", image.basename());
- return image_error::INVALIDIMAGE;
+ return std::make_pair(
+ image_error::INVALIDIMAGE,
+ util::string_format("Invalid code base 0x%04X (must be no less than 0x4000)", code_base));
}
-
- if (code_base < 0x4000 || (code_base + code_length) >= 0x10000)
+ else if ((code_base + code_length) > 0x10000)
{
- osd_printf_error("%s: Invalid code base and length\n", image.basename());
- return image_error::INVALIDIMAGE;
+ return std::make_pair(
+ image_error::INVALIDIMAGE,
+ util::string_format("Loading 0x%04X bytes of code at base 0x%04X would overflow RAM", code_length, code_base));
}
// reset memory map
@@ -532,7 +514,7 @@ QUICKLOAD_LOAD_MEMBER(mtx_state::quickload_cb)
m_maincpu->set_pc(code_base);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
/***************************************************************************
diff --git a/src/mame/microkey/primo_m.cpp b/src/mame/microkey/primo_m.cpp
index daaf76a7390..a9eb67b25bd 100644
--- a/src/mame/microkey/primo_m.cpp
+++ b/src/mame/microkey/primo_m.cpp
@@ -286,18 +286,14 @@ SNAPSHOT_LOAD_MEMBER(primo_state::snapshot_cb)
std::vector<uint8_t> snapshot_data(image.length());
if (image.fread(&snapshot_data[0], image.length()) != image.length())
- {
- return image_error::UNSPECIFIED;
- }
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
if (strncmp((char *)&snapshot_data[0], "PS01", 4))
- {
- return image_error::INVALIDIMAGE;
- }
+ return std::make_pair(image_error::INVALIDIMAGE, std::string());
setup_pss(&snapshot_data[0], image.length());
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
/*******************************************************************************
@@ -326,13 +322,11 @@ QUICKLOAD_LOAD_MEMBER(primo_state::quickload_cb)
std::vector<uint8_t> quickload_data(quickload_size);
if (image.fread(&quickload_data[0], quickload_size) != quickload_size)
- {
- return image_error::UNSPECIFIED;
- }
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
setup_pp(&quickload_data[0], quickload_size);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
u32 primo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
diff --git a/src/mame/miltonbradley/microvsn.cpp b/src/mame/miltonbradley/microvsn.cpp
index 42bcc8bd2c1..c20ae643624 100644
--- a/src/mame/miltonbradley/microvsn.cpp
+++ b/src/mame/miltonbradley/microvsn.cpp
@@ -190,10 +190,7 @@ DEVICE_IMAGE_LOAD_MEMBER(microvision_state::cart_load)
u32 size = m_cart->common_get_size("rom");
if (size != 0x400 && size != 0x800)
- {
- osd_printf_error("%s: Invalid ROM file size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid ROM file size (must be 1K or 2K)");
m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
@@ -236,7 +233,7 @@ DEVICE_IMAGE_LOAD_MEMBER(microvision_state::cart_load)
m_tms1100->set_clock(clock);
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void microvision_state::apply_settings()
diff --git a/src/mame/misc/mtu130.cpp b/src/mame/misc/mtu130.cpp
index b24b260b866..4a92e900fbd 100644
--- a/src/mame/misc/mtu130.cpp
+++ b/src/mame/misc/mtu130.cpp
@@ -54,7 +54,7 @@ public:
protected:
virtual void device_start() override;
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
private:
@@ -237,11 +237,11 @@ void mtu130_rom_device::device_start()
memset(m_romdata + m_load_offset, 0xff, 4096);
}
-std::error_condition mtu130_rom_device::call_load()
+std::pair<std::error_condition, std::string> mtu130_rom_device::call_load()
{
u32 len = !loaded_through_softlist() ? length() : get_software_region_length("rom");
if(!len || len > 4096 || (4096 % len))
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, std::string());
if (!loaded_through_softlist())
fread(m_romdata + m_load_offset, len);
@@ -256,7 +256,7 @@ std::error_condition mtu130_rom_device::call_load()
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void mtu130_rom_device::call_unload()
diff --git a/src/mame/mit/tx0.cpp b/src/mame/mit/tx0.cpp
index 1f47a14a4af..b337a32943a 100644
--- a/src/mame/mit/tx0.cpp
+++ b/src/mame/mit/tx0.cpp
@@ -369,7 +369,7 @@ public:
// device_image_interface implementation
virtual const char *file_extensions() const noexcept override { return "tap,rim"; }
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual const char *image_interface() const noexcept override { return "tx0_ptp"; }
@@ -398,8 +398,8 @@ public:
// device_image_interface implementation
virtual const char *file_extensions() const noexcept override { return "tap,rim"; }
- virtual std::error_condition call_load() override;
- virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_create(int format_type, util::option_resolution *format_options) override;
virtual void call_unload() override;
protected:
@@ -436,7 +436,7 @@ public:
virtual const char *image_type_name() const noexcept override { return "printout"; }
virtual const char *image_brief_type_name() const noexcept override { return "prin"; }
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
protected:
@@ -465,7 +465,7 @@ public:
// device_image_interface implementation
virtual const char *file_extensions() const noexcept override { return "tap"; }
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
protected:
@@ -489,7 +489,7 @@ tx0_magtape_image_device::tx0_magtape_image_device(const machine_config &mconfig
unit 0 is reader (read-only), unit 1 is puncher (write-only)
*/
-std::error_condition tx0_readtape_image_device::call_load()
+std::pair<std::error_condition, std::string> tx0_readtape_image_device::call_load()
{
if (m_tx0)
{
@@ -518,7 +518,7 @@ std::error_condition tx0_readtape_image_device::call_load()
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void tx0_readtape_image_device::call_unload()
@@ -630,16 +630,16 @@ TIMER_CALLBACK_MEMBER(tx0_state::reader_callback)
/*
timer callback to generate punch completion pulse
*/
-std::error_condition tx0_punchtape_image_device::call_load()
+std::pair<std::error_condition, std::string> tx0_punchtape_image_device::call_load()
{
/* punch unit */
if (m_tx0)
m_tx0->m_tape_puncher.fd = this;
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
-std::error_condition tx0_punchtape_image_device::call_create(int format_type, util::option_resolution *format_options)
+std::pair<std::error_condition, std::string> tx0_punchtape_image_device::call_create(int format_type, util::option_resolution *format_options)
{
return call_load();
}
@@ -713,13 +713,13 @@ WRITE_LINE_MEMBER( tx0_state::tx0_io_p7h )
/*
Open a file for typewriter output
*/
-std::error_condition tx0_printer_image_device::call_load()
+std::pair<std::error_condition, std::string> tx0_printer_image_device::call_load()
{
/* open file */
if (m_tx0)
m_tx0->m_typewriter.fd = this;
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void tx0_printer_image_device::call_unload()
@@ -852,7 +852,7 @@ void tx0_magtape_image_device::device_start()
/*
Open a magnetic tape image
*/
-std::error_condition tx0_magtape_image_device::call_load()
+std::pair<std::error_condition, std::string> tx0_magtape_image_device::call_load()
{
if (m_tx0)
{
@@ -871,7 +871,7 @@ std::error_condition tx0_magtape_image_device::call_load()
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void tx0_magtape_image_device::call_unload()
diff --git a/src/mame/mits/altair.cpp b/src/mame/mits/altair.cpp
index 3761f88d65d..930700af90d 100644
--- a/src/mame/mits/altair.cpp
+++ b/src/mame/mits/altair.cpp
@@ -98,12 +98,12 @@ QUICKLOAD_LOAD_MEMBER(altair_state::quickload_cb)
{
int const quick_length = image.length();
if (quick_length >= 0xfd00)
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, std::string());
int const read_ = image.fread(m_ram, quick_length);
if (read_ != quick_length)
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void altair_state::machine_reset()
diff --git a/src/mame/motorola/m68705prg.cpp b/src/mame/motorola/m68705prg.cpp
index 2c28364638d..49e471a01da 100644
--- a/src/mame/motorola/m68705prg.cpp
+++ b/src/mame/motorola/m68705prg.cpp
@@ -62,14 +62,15 @@ protected:
auto const actual(m_eprom_image->common_get_size("rom"));
if (desired > actual)
{
- osd_printf_error("%s: Unsupported EPROM size\n", image.basename());
- return image_error::INVALIDLENGTH;
+ return std::make_pair(
+ image_error::INVALIDLENGTH,
+ util::string_format("Unsupported EPROM size (must be at least %u bytes)", desired));
}
else
{
m_eprom_image->rom_alloc(desired, GENERIC_ROM8_WIDTH, ENDIANNESS_BIG);
m_eprom_image->common_load_rom(m_eprom_image->get_rom_base(), desired, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
}
@@ -79,13 +80,14 @@ protected:
auto const actual(m_mcu_image->common_get_size("rom"));
if (desired != actual)
{
- osd_printf_error("%s: Incorrect internal MCU EPROM size\n", image.basename());
- return image_error::INVALIDLENGTH;
+ return std::make_pair(
+ image_error::INVALIDLENGTH,
+ util::string_format("Incorrect MCU EPROM size (must be %u bytes)", desired));
}
else
{
m_mcu_image->common_load_rom(&m_mcu_region[0], actual, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
}
diff --git a/src/mame/motorola/mekd2.cpp b/src/mame/motorola/mekd2.cpp
index e3074cd9b14..d4044569849 100644
--- a/src/mame/motorola/mekd2.cpp
+++ b/src/mame/motorola/mekd2.cpp
@@ -304,8 +304,9 @@ QUICKLOAD_LOAD_MEMBER(mekd2_state::quickload_cb)
image.fread(buff, sizeof(buff));
if (memcmp(buff, magic, sizeof(buff)))
{
- logerror("mekd2 rom load: magic '%s' not found\n", magic);
- return image_error::INVALIDIMAGE;
+ return std::make_pair(
+ image_error::INVALIDIMAGE,
+ util::string_format("Magic '%s' not found", magic));
}
image.fread(&addr, 2);
addr = little_endianize_int16(addr);
@@ -316,7 +317,7 @@ QUICKLOAD_LOAD_MEMBER(mekd2_state::quickload_cb)
while (size-- > 0)
image.fread(&RAM[addr++], 1);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
TIMER_DEVICE_CALLBACK_MEMBER(mekd2_state::kansas_w)
diff --git a/src/mame/nascom/nascom1.cpp b/src/mame/nascom/nascom1.cpp
index 46582e92b45..cee10805acf 100644
--- a/src/mame/nascom/nascom1.cpp
+++ b/src/mame/nascom/nascom1.cpp
@@ -152,7 +152,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(ram_disable_cpm_w);
uint32_t screen_update_nascom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- std::error_condition load_cart(device_image_interface &image, generic_slot_device *slot, int slot_id);
+ std::pair<std::error_condition, std::string> load_cart(device_image_interface &image, generic_slot_device *slot, int slot_id);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(socket1_load) { return load_cart(image, m_socket1, 1); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(socket2_load) { return load_cart(image, m_socket2, 2); }
@@ -343,8 +343,7 @@ SNAPSHOT_LOAD_MEMBER(nascom_state::snapshot_cb)
}
else
{
- osd_printf_error("%s: Unsupported file format\n", image.basename());
- return image_error::INVALIDIMAGE;
+ return std::make_pair(image_error::INVALIDIMAGE, "Unsupported file format");
}
dummy = 0x00;
while (!image.image_feof() && dummy != 0x0a && dummy != 0x1f)
@@ -353,7 +352,7 @@ SNAPSHOT_LOAD_MEMBER(nascom_state::snapshot_cb)
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
@@ -361,16 +360,16 @@ SNAPSHOT_LOAD_MEMBER(nascom_state::snapshot_cb)
// SOCKETS
//**************************************************************************
-std::error_condition nascom2_state::load_cart(device_image_interface &image, generic_slot_device *slot, int slot_id)
+std::pair<std::error_condition, std::string> nascom2_state::load_cart(
+ device_image_interface &image,
+ generic_slot_device *slot,
+ int slot_id)
{
if (!image.loaded_through_softlist())
{
// loading directly from file
if (slot->length() > 0x1000)
- {
- osd_printf_error("%s: Unsupported file size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported image file size (must be no more than 4K)");
slot->rom_alloc(slot->length(), GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
slot->fread(slot->get_rom_base(), slot->length());
@@ -412,7 +411,7 @@ std::error_condition nascom2_state::load_cart(device_image_interface &image, gen
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/neogeo/ng_memcard.cpp b/src/mame/neogeo/ng_memcard.cpp
index 86ba5ff775d..6cdead31fb5 100644
--- a/src/mame/neogeo/ng_memcard.cpp
+++ b/src/mame/neogeo/ng_memcard.cpp
@@ -61,17 +61,17 @@ void ng_memcard_device::device_start()
with the given index
-------------------------------------------------*/
-std::error_condition ng_memcard_device::call_load()
+std::pair<std::error_condition, std::string> ng_memcard_device::call_load()
{
if (length() != 0x800)
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported memory card size (only 2K cards are supported)");
fseek(0, SEEK_SET);
size_t ret = fread(m_memcard_data, 0x800);
if (ret != 0x800)
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, "Error reading file");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void ng_memcard_device::call_unload()
@@ -80,15 +80,15 @@ void ng_memcard_device::call_unload()
fwrite(m_memcard_data, 0x800);
}
-std::error_condition ng_memcard_device::call_create(int format_type, util::option_resolution *format_options)
+std::pair<std::error_condition, std::string> ng_memcard_device::call_create(int format_type, util::option_resolution *format_options)
{
memset(m_memcard_data, 0, 0x800);
size_t const ret = fwrite(m_memcard_data, 0x800);
if (ret != 0x800)
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, "Error writing file");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/neogeo/ng_memcard.h b/src/mame/neogeo/ng_memcard.h
index 21eecadea1e..dbbb902dd08 100644
--- a/src/mame/neogeo/ng_memcard.h
+++ b/src/mame/neogeo/ng_memcard.h
@@ -23,9 +23,9 @@ public:
virtual bool is_reset_on_load() const noexcept override { return false; }
virtual const char *file_extensions() const noexcept override { return "neo"; }
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
- virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
+ virtual std::pair<std::error_condition, std::string> call_create(int format_type, util::option_resolution *format_options) override;
// bus interface
uint16_t read(offs_t offset);
diff --git a/src/mame/netronics/elf.cpp b/src/mame/netronics/elf.cpp
index 0f61fb29b66..f6ca137c719 100644
--- a/src/mame/netronics/elf.cpp
+++ b/src/mame/netronics/elf.cpp
@@ -227,12 +227,12 @@ QUICKLOAD_LOAD_MEMBER(elf2_state::quickload_cb)
if (size > m_ram->size())
{
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, std::string());
}
image.fread(m_ram->pointer(), size);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void elf2_state::elf2(machine_config &config)
diff --git a/src/mame/nichibutsu/myvision.cpp b/src/mame/nichibutsu/myvision.cpp
index cdf979d01f3..06ff7967428 100644
--- a/src/mame/nichibutsu/myvision.cpp
+++ b/src/mame/nichibutsu/myvision.cpp
@@ -159,15 +159,12 @@ DEVICE_IMAGE_LOAD_MEMBER( myvision_state::cart_load )
uint32_t const size = m_cart->common_get_size("rom");
if (size != 0x4000 && size != 0x6000)
- {
- osd_printf_error("%s: Unsupported cartridge size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be 16K or 24K)");
m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/nintendo/n64.cpp b/src/mame/nintendo/n64.cpp
index 353e2d4b0c7..e10a5fabc6a 100644
--- a/src/mame/nintendo/n64.cpp
+++ b/src/mame/nintendo/n64.cpp
@@ -378,7 +378,7 @@ DEVICE_IMAGE_LOAD_MEMBER(n64_mess_state::cart_load)
mempak_format(m_rcp_periphs->m_save_data.mempak[1]);
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
MACHINE_START_MEMBER(n64_mess_state,n64dd)
diff --git a/src/mame/nintendo/nes_vt09.cpp b/src/mame/nintendo/nes_vt09.cpp
index 796c033f804..6b836952619 100644
--- a/src/mame/nintendo/nes_vt09.cpp
+++ b/src/mame/nintendo/nes_vt09.cpp
@@ -161,7 +161,7 @@ DEVICE_IMAGE_LOAD_MEMBER(nes_vt09_cart_state::cart_load)
m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/nintendo/pokemini.cpp b/src/mame/nintendo/pokemini.cpp
index 240f843cdb5..2581451d814 100644
--- a/src/mame/nintendo/pokemini.cpp
+++ b/src/mame/nintendo/pokemini.cpp
@@ -1501,22 +1501,16 @@ DEVICE_IMAGE_LOAD_MEMBER( pokemini_state::cart_load )
/* Verify that the image is big enough */
if (size <= 0x2100)
- {
- osd_printf_error("%s: Invalid ROM image: ROM image is too small\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "ROM image is too small");
/* Verify that the image is not too big */
if (size > 0x1fffff)
- {
- osd_printf_error("%s: Invalid ROM image: ROM image is too big\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "ROM image is too big");
m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/pc/ibmpcjr.cpp b/src/mame/pc/ibmpcjr.cpp
index 0fe13eca861..44d5bce7da8 100644
--- a/src/mame/pc/ibmpcjr.cpp
+++ b/src/mame/pc/ibmpcjr.cpp
@@ -89,7 +89,7 @@ private:
void pcjx_port_1ff_w(uint8_t data);
void pcjx_set_bank(int unk1, int unk2, int unk3);
- std::error_condition load_cart(device_image_interface &image, generic_slot_device *slot);
+ std::pair<std::error_condition, std::string> load_cart(device_image_interface &image, generic_slot_device *slot);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(cart1_load) { return load_cart(image, m_cart1); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(cart2_load) { return load_cart(image, m_cart2); }
void pc_speaker_set_spkrdata(uint8_t data);
@@ -446,7 +446,9 @@ uint8_t pcjr_state::pcjx_port_1ff_r()
return 0x60; // expansion?
}
-std::error_condition pcjr_state::load_cart(device_image_interface &image, generic_slot_device *slot)
+std::pair<std::error_condition, std::string> pcjr_state::load_cart(
+ device_image_interface &image,
+ generic_slot_device *slot)
{
uint32_t size = slot->common_get_size("rom");
bool imagic_hack = false;
@@ -465,8 +467,7 @@ std::error_condition pcjr_state::load_cart(device_image_interface &image, generi
header_size = 0x200;
break;
default:
- osd_printf_error("%s: Invalid header size\n", image.basename());
- return image_error::INVALIDIMAGE;
+ return std::make_pair(image_error::INVALIDIMAGE, "Invalid header length (must be 128 bytes or 512 bytes)");
}
if ((size - header_size) == 0xa000)
{
@@ -497,7 +498,8 @@ std::error_condition pcjr_state::load_cart(device_image_interface &image, generi
memcpy(ROM + 0x4000, ROM, 0x2000);
memcpy(ROM + 0x2000, ROM, 0x2000);
}
- return std::error_condition();
+
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/pce/tourvis.cpp b/src/mame/pce/tourvis.cpp
index a8c587e777c..72921e25913 100644
--- a/src/mame/pce/tourvis.cpp
+++ b/src/mame/pce/tourvis.cpp
@@ -264,7 +264,7 @@ DEVICE_IMAGE_LOAD_MEMBER(tourvision_state::cart_load)
}
#endif
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
// Note from system11: This system actually supports 2 players
diff --git a/src/mame/pitronics/beta.cpp b/src/mame/pitronics/beta.cpp
index 470b3ad8a4a..20f838f8047 100644
--- a/src/mame/pitronics/beta.cpp
+++ b/src/mame/pitronics/beta.cpp
@@ -31,6 +31,7 @@
*/
#include "emu.h"
+
#include "cpu/m6502/m6502.h"
#include "imagedev/floppy.h"
#include "machine/mos6530n.h"
@@ -299,15 +300,12 @@ DEVICE_IMAGE_LOAD_MEMBER(beta_state::load_beta_eprom)
uint32_t const size = m_eprom->common_get_size("rom");
if (size != 0x800)
- {
- osd_printf_error("%s: Unsupported cartridge size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (only 2K cartridges are supported)");
m_eprom->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
m_eprom->common_load_rom(m_eprom->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
DEVICE_IMAGE_UNLOAD_MEMBER(beta_state::unload_beta_eprom)
diff --git a/src/mame/poly88/poly88_m.cpp b/src/mame/poly88/poly88_m.cpp
index 77060425046..b09d739b10a 100644
--- a/src/mame/poly88/poly88_m.cpp
+++ b/src/mame/poly88/poly88_m.cpp
@@ -310,5 +310,5 @@ SNAPSHOT_LOAD_MEMBER(poly88_state::snapshot_cb)
pos+=recordLen;
}
m_usart->reset();
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/psion/psion_pack.cpp b/src/mame/psion/psion_pack.cpp
index bf046f1f32c..cafb221303a 100644
--- a/src/mame/psion/psion_pack.cpp
+++ b/src/mame/psion/psion_pack.cpp
@@ -267,7 +267,7 @@ void datapack_device::control_w(uint8_t data)
DEVICE_IMAGE_LOAD( datapack )
-------------------------------------------------*/
-std::error_condition datapack_device::call_load()
+std::pair<std::error_condition, std::string> datapack_device::call_load()
{
uint8_t data[0x10];
@@ -275,13 +275,13 @@ std::error_condition datapack_device::call_load()
// check the OPK head
if(strncmp((const char*)data, "OPK", 3))
- return image_error::INVALIDIMAGE;
+ return std::make_pair(image_error::INVALIDIMAGE, std::string());
// get datapack ID and size
m_id = data[OPK_HEAD_SIZE + 0];
m_size = data[OPK_HEAD_SIZE + 1];
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
@@ -289,7 +289,7 @@ std::error_condition datapack_device::call_load()
DEVICE_IMAGE_CREATE( datapack )
-------------------------------------------------*/
-std::error_condition datapack_device::call_create(int format_type, util::option_resolution *create_args)
+std::pair<std::error_condition, std::string> datapack_device::call_create(int format_type, util::option_resolution *create_args)
{
static const uint8_t opk_head[6] = {'O', 'P', 'K', 0x00, 0x00, 0x00};
@@ -314,7 +314,7 @@ std::error_condition datapack_device::call_create(int format_type, util::option_
fwrite(&m_id, 1);
fwrite(&m_size, 1);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/psion/psion_pack.h b/src/mame/psion/psion_pack.h
index 37d29f8df12..49ff7e0fd3d 100644
--- a/src/mame/psion/psion_pack.h
+++ b/src/mame/psion/psion_pack.h
@@ -27,9 +27,9 @@ public:
virtual ~datapack_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
- virtual std::error_condition call_create(int format_type, util::option_resolution *create_args) override;
+ virtual std::pair<std::error_condition, std::string> call_create(int format_type, util::option_resolution *create_args) override;
virtual bool is_reset_on_load() const noexcept override { return false; }
virtual const char *image_interface() const noexcept override { return "psion_pack"; }
diff --git a/src/mame/psion/psion_ssd.cpp b/src/mame/psion/psion_ssd.cpp
index bf1857828af..ce7a265488b 100644
--- a/src/mame/psion/psion_ssd.cpp
+++ b/src/mame/psion/psion_ssd.cpp
@@ -169,7 +169,7 @@ TIMER_CALLBACK_MEMBER(psion_ssd_device::close_door)
}
-std::error_condition psion_ssd_device::call_load()
+std::pair<std::error_condition, std::string> psion_ssd_device::call_load()
{
device_image_interface *image = nullptr;
interface(image);
@@ -177,10 +177,7 @@ std::error_condition psion_ssd_device::call_load()
uint32_t size = image->length();
if (size < 0x10000 || size > 0x800000 || (size & (size - 1)) != 0)
- {
- osd_printf_error("%s: Invalid size, must be 64K, 128K, 256K, 512K, 1M, 2M, 4M, 8M\n", image->basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid size, must be 64K, 128K, 256K, 512K, 1M, 2M, 4M, 8M");
image->fread(m_ssd_data.get(), size);
@@ -196,7 +193,7 @@ std::error_condition psion_ssd_device::call_load()
// setup the timer to close the door
m_door_timer->adjust(attotime::from_msec(200));
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/psion/psion_ssd.h b/src/mame/psion/psion_ssd.h
index dc23f248458..0bd724e70e6 100644
--- a/src/mame/psion/psion_ssd.h
+++ b/src/mame/psion/psion_ssd.h
@@ -41,7 +41,7 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_reset_on_load() const noexcept override { return false; }
diff --git a/src/mame/rca/studio2.cpp b/src/mame/rca/studio2.cpp
index 935dcf879d2..da8eb0b9638 100644
--- a/src/mame/rca/studio2.cpp
+++ b/src/mame/rca/studio2.cpp
@@ -605,26 +605,17 @@ DEVICE_IMAGE_LOAD_MEMBER( studio2_state::cart_load )
uint8_t blocks;
if (image.length() < 0x200)
- {
- osd_printf_error("%s: Invalid ROM file\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid .ST2 ROM file (must be at least 512 bytes)");
image.fread(&header, 0x100);
// validate
if (strncmp((const char *)header, "RCA2", 4))
- {
- osd_printf_error("%s: Not an .ST2 file\n", image.basename());
- return image_error::INVALIDIMAGE;
- }
+ return std::make_pair(image_error::INVALIDIMAGE, "Not an .ST2 ROM file (missing header signature)");
blocks = header[4];
if ((blocks < 2) || (blocks > 11))
- {
- osd_printf_error("%s: Invalid .ST2 file\n", image.basename());
- return image_error::INVALIDIMAGE;
- }
+ return std::make_pair(image_error::INVALIDIMAGE, "Invalid .ST2 ROM file (must be 2 to 11 blocks)");
if (image.length() != (blocks << 8))
logerror("Wrong sized image: Expected 0x%04X; Found 0x%04X\n",blocks<<8,image.length());
@@ -655,12 +646,9 @@ DEVICE_IMAGE_LOAD_MEMBER( studio2_state::cart_load )
{
size = image.length();
if (size > 0x400)
- {
- osd_printf_error("%s: Unsupported cartridge size\n", image.basename());
- return image_error::INVALIDIMAGE;
- }
- else
- image.fread(m_cart->get_rom_base(), size);
+ return std::make_pair(image_error::INVALIDIMAGE, "Unsupported cartridge size (must be not more than 1K)");
+
+ image.fread(m_cart->get_rom_base(), size);
}
}
else
@@ -675,7 +663,7 @@ DEVICE_IMAGE_LOAD_MEMBER( studio2_state::cart_load )
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/rca/vip.cpp b/src/mame/rca/vip.cpp
index a05463073ff..e1569b82289 100644
--- a/src/mame/rca/vip.cpp
+++ b/src/mame/rca/vip.cpp
@@ -688,7 +688,9 @@ QUICKLOAD_LOAD_MEMBER(vip_state::quickload_cb)
if ((size + chip8_size) > m_ram->size())
{
- return image_error::INVALIDIMAGE;
+ return std::make_pair(
+ image_error::INVALIDIMAGE,
+ util::string_format("%u-byte interpreter and %u-byte program are too large for %u-byte RAM", chip8_size, size, m_ram->size()));
}
if (chip8_size > 0)
@@ -700,7 +702,7 @@ QUICKLOAD_LOAD_MEMBER(vip_state::quickload_cb)
/* load image to RAM */
image.fread(ram + chip8_size, size);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/robotron/z1013.cpp b/src/mame/robotron/z1013.cpp
index 7d26d2b78e3..8546bd17769 100644
--- a/src/mame/robotron/z1013.cpp
+++ b/src/mame/robotron/z1013.cpp
@@ -404,18 +404,28 @@ SNAPSHOT_LOAD_MEMBER(z1013_state::snapshot_cb)
0020 up - Program to load
*/
+ if (image.length() < 0x20)
+ return std::make_pair(image_error::INVALIDIMAGE, "File too short to contain Z1013 image header");
+
std::vector<uint8_t> data(image.length());
image.fread(&data[0], image.length());
+ if ((data[13] != data[14]) || (data[14] != data[15]))
+ return std::make_pair(image_error::INVALIDIMAGE, "Not a Z1013 image");
uint16_t const startaddr = data[0] + data[1]*256;
uint16_t const endaddr = data[2] + data[3]*256;
uint16_t const runaddr = data[4] + data[5]*256;
-
- if ((data[13] != data[14]) || (data[14] != data[15]))
+ if (endaddr < startaddr)
+ {
+ return std::make_pair(
+ image_error::INVALIDIMAGE,
+ util::string_format("End address 0x%04X is less than start address 0x%04X", endaddr, startaddr));
+ }
+ else if ((endaddr - startaddr + 1) > (data.size() - 0x20))
{
- osd_printf_error("%s: Not a Z1013 image\n", image.basename());
- image.message(" Not a Z1013 image");
- return image_error::INVALIDIMAGE;
+ return std::make_pair(
+ image_error::INVALIDIMAGE,
+ util::string_format("File too short to contain %u-byte program", endaddr - startaddr + 1));
}
memcpy(m_maincpu->space(AS_PROGRAM).get_read_ptr(startaddr), &data[0x20], endaddr - startaddr + 1);
@@ -428,7 +438,7 @@ SNAPSHOT_LOAD_MEMBER(z1013_state::snapshot_cb)
image.message(" Loaded but cannot run due to zero entry point");
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
/* F4 Character Displayer */
diff --git a/src/mame/rockwell/aim65.cpp b/src/mame/rockwell/aim65.cpp
index bbaff225e1a..b4fc72b8b15 100644
--- a/src/mame/rockwell/aim65.cpp
+++ b/src/mame/rockwell/aim65.cpp
@@ -178,28 +178,28 @@ void aim65_state::aim65_palette(palette_device &palette) const
MACHINE DRIVERS
***************************************************************************/
-std::error_condition aim65_state::load_cart(device_image_interface &image, generic_slot_device *slot, const char *slot_tag)
+std::pair<std::error_condition, std::string> aim65_state::load_cart(
+ device_image_interface &image,
+ generic_slot_device *slot,
+ const char *slot_tag)
{
uint32_t size = slot->common_get_size(slot_tag);
if (size > 0x1000)
- {
- osd_printf_error("%s: Unsupported ROM size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported ROM size (must be no more than 4K)");
if (image.loaded_through_softlist() && image.get_software_region(slot_tag) == nullptr)
{
- osd_printf_error(
- "Attempted to load file with wrong extension\nSocket '%s' only accepts files with '.%s' extension\n",
- slot_tag, slot_tag);
- return image_error::UNSUPPORTED;
+ // FIXME: error message seems to be outdated - actual error seems to be incorrect region name in software item
+ return std::make_pair(
+ image_error::UNSUPPORTED,
+ util::string_format("Unsupported file name extension (socket '%1$s' only accepts files with '.%1$s' extension", slot_tag));
}
slot->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
slot->common_load_rom(slot->get_rom_base(), size, slot_tag);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
// TTY terminal settings. To use, turn KB/TTY switch to TTY, reset, press DEL. All input to be in UPPERCASE.
diff --git a/src/mame/rockwell/aim65.h b/src/mame/rockwell/aim65.h
index ea207c4e536..b9ed9a91779 100644
--- a/src/mame/rockwell/aim65.h
+++ b/src/mame/rockwell/aim65.h
@@ -92,7 +92,7 @@ private:
TIMER_CALLBACK_MEMBER(printer_timer);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- std::error_condition load_cart(device_image_interface &image, generic_slot_device *slot, const char *slot_tag);
+ std::pair<std::error_condition, std::string> load_cart(device_image_interface &image, generic_slot_device *slot, const char *slot_tag);
void mem_map(address_map &map);
diff --git a/src/mame/roland/roland_cm32p.cpp b/src/mame/roland/roland_cm32p.cpp
index 8886397ad80..943171392d1 100644
--- a/src/mame/roland/roland_cm32p.cpp
+++ b/src/mame/roland/roland_cm32p.cpp
@@ -428,10 +428,7 @@ DEVICE_IMAGE_LOAD_MEMBER(cm32p_state::card_load)
{
uint32_t const size = pcmcard->common_get_size("rom");
if (size > 0x080000)
- {
- osd_printf_error("%s: Invalid size: Only up to 512K is supported\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid size (maximum supported is 512K)");
pcmcard->rom_alloc(0x080000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); // cards are up to 512K
pcmcard->common_load_rom(pcmcard->get_rom_base(), size, "rom");
@@ -452,7 +449,7 @@ DEVICE_IMAGE_LOAD_MEMBER(cm32p_state::card_load)
descramble_rom_external(&dst[0x080000], &src[0x080000]);
pcmard_loaded = true;
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
DEVICE_IMAGE_UNLOAD_MEMBER(cm32p_state::card_unload)
diff --git a/src/mame/roland/roland_r8.cpp b/src/mame/roland/roland_r8.cpp
index a8bff5e555d..4280953c9d9 100644
--- a/src/mame/roland/roland_r8.cpp
+++ b/src/mame/roland/roland_r8.cpp
@@ -118,7 +118,7 @@ protected:
void mk1_map(address_map &map);
void mk2_map(address_map &map);
- std::error_condition pcmrom_load(generic_slot_device* pcmcard, int card_id, device_image_interface &image);
+ std::pair<std::error_condition, std::string> pcmrom_load(generic_slot_device* pcmcard, int card_id, device_image_interface &image);
void pcmrom_unload(int card_id);
void descramble_rom_external(u8* dst, const u8* src);
@@ -186,14 +186,11 @@ private:
};
-std::error_condition roland_r8_base_state::pcmrom_load(generic_slot_device *pcmcard, int card_id, device_image_interface &image)
+std::pair<std::error_condition, std::string> roland_r8_base_state::pcmrom_load(generic_slot_device *pcmcard, int card_id, device_image_interface &image)
{
uint32_t const size = pcmcard->common_get_size("rom");
if (size > PCMCARD_SIZE)
- {
- osd_printf_error("%s: Invalid size: Only up to 512K is supported\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid size (maximum supported is 512K)");
pcmcard->rom_alloc(PCMCARD_SIZE, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
pcmcard->common_load_rom(pcmcard->get_rom_base(), size, "rom");
@@ -215,7 +212,7 @@ std::error_condition roland_r8_base_state::pcmrom_load(generic_slot_device *pcmc
descramble_rom_external(&dst[pcm_addr], &src[pcm_addr]);
//pcmard_loaded[card_id] = true;
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void roland_r8_base_state::pcmrom_unload(int card_id)
diff --git a/src/mame/roland/roland_tnsc1.cpp b/src/mame/roland/roland_tnsc1.cpp
index 18d45b87f89..7ffd37db3a7 100644
--- a/src/mame/roland/roland_tnsc1.cpp
+++ b/src/mame/roland/roland_tnsc1.cpp
@@ -52,7 +52,7 @@ DEVICE_IMAGE_LOAD_MEMBER(rlndtnsc1_state::cart_load)
uint32_t size = m_cart->common_get_size("rom");
m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void rlndtnsc1_state::rlndtnsc1(machine_config &config)
diff --git a/src/mame/sega/mdconsole.cpp b/src/mame/sega/mdconsole.cpp
index 349409ae186..6222d4e0791 100644
--- a/src/mame/sega/mdconsole.cpp
+++ b/src/mame/sega/mdconsole.cpp
@@ -394,7 +394,6 @@ DEVICE_IMAGE_LOAD_MEMBER( md_cons_state::_32x_cart )
std::vector<uint8_t> temp_copy;
uint16_t *ROM16;
uint32_t *ROM32;
- int i;
if (!image.loaded_through_softlist())
{
@@ -409,21 +408,21 @@ DEVICE_IMAGE_LOAD_MEMBER( md_cons_state::_32x_cart )
memcpy(&temp_copy[0], image.get_software_region("rom"), length);
}
- /* Copy the cart image in the locations the driver expects */
+ // Copy the cart image in the locations the driver expects
// Notice that, by using pick_integer, we are sure the code works on both LE and BE machines
ROM16 = (uint16_t *) memregion("gamecart")->base();
- for (i = 0; i < length; i += 2)
+ for (int i = 0; i < length; i += 2)
ROM16[i / 2] = pick_integer_be(&temp_copy[0], i, 2);
ROM32 = (uint32_t *) memregion("gamecart_sh2")->base();
- for (i = 0; i < length; i += 4)
+ for (int i = 0; i < length; i += 4)
ROM32[i / 4] = pick_integer_be(&temp_copy[0], i, 4);
ROM16 = (uint16_t *) memregion("maincpu")->base();
- for (i = 0x00; i < length; i += 2)
+ for (int i = 0x00; i < length; i += 2)
ROM16[i / 2] = pick_integer_be(&temp_copy[0], i, 2);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/sega/megatech.cpp b/src/mame/sega/megatech.cpp
index 631309fbefb..9239607e214 100644
--- a/src/mame/sega/megatech.cpp
+++ b/src/mame/sega/megatech.cpp
@@ -146,7 +146,7 @@ private:
uint8_t sms_ioport_dd_r();
void mt_sms_standard_rom_bank_w(address_space &space, offs_t offset, uint8_t data);
- std::error_condition load_cart(device_image_interface &image, generic_slot_device *slot, int gameno);
+ std::pair<std::error_condition, std::string> load_cart(device_image_interface &image, generic_slot_device *slot, int gameno);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( mt_cart1 ) { return load_cart(image, m_cart1, 0); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( mt_cart2 ) { return load_cart(image, m_cart2, 1); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( mt_cart3 ) { return load_cart(image, m_cart3, 2); }
@@ -749,21 +749,21 @@ void mtech_state::megatech(machine_config &config)
}
-std::error_condition mtech_state::load_cart(device_image_interface &image, generic_slot_device *slot, int gameno)
+std::pair<std::error_condition, std::string> mtech_state::load_cart(device_image_interface &image, generic_slot_device *slot, int gameno)
{
uint8_t *ROM;
const char *pcb_name;
uint32_t size = slot->common_get_size("rom");
if (!image.loaded_through_softlist())
- return image_error::UNSUPPORTED;
+ return std::make_pair(image_error::UNSUPPORTED, "Cartridges must be loaded from the software list");
slot->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
ROM = slot->get_rom_base();
memcpy(ROM, image.get_software_region("rom"), size);
if ((pcb_name = image.get_feature("pcb_type")) == nullptr)
- return image_error::BADSOFTWARE;
+ return std::make_pair(image_error::BADSOFTWARE, "Software item is missing 'pcb_type' feature");
else
{
if (!strcmp("genesis", pcb_name))
@@ -777,10 +777,14 @@ std::error_condition mtech_state::load_cart(device_image_interface &image, gener
m_cart_is_genesis[gameno] = 0;
}
else
- osd_printf_debug("cart%d is invalid\n", gameno + 1);
+ {
+ return std::make_pair(
+ image_error::BADSOFTWARE,
+ util::string_format("Software item has invalid 'pcb_type' feature '%s' (must be 'genesis' or 'sms')", pcb_name));
+ }
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
#define MEGATECH_CARTSLOT(_tag, _load) \
diff --git a/src/mame/sega/sega_beena.cpp b/src/mame/sega/sega_beena.cpp
index f026c24bcec..fff84e65f26 100644
--- a/src/mame/sega/sega_beena.cpp
+++ b/src/mame/sega/sega_beena.cpp
@@ -154,7 +154,7 @@ DEVICE_IMAGE_LOAD_MEMBER(sega_beena_state::cart_load)
m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
static INPUT_PORTS_START( sega_beena )
diff --git a/src/mame/sega/stv.cpp b/src/mame/sega/stv.cpp
index c0b5ce79fcf..62fa4b1148a 100644
--- a/src/mame/sega/stv.cpp
+++ b/src/mame/sega/stv.cpp
@@ -1330,16 +1330,15 @@ void stv_state::machine_reset()
m_vdp2.old_tvmd = -1;
}
-std::error_condition stv_state::load_cart(device_image_interface &image, generic_slot_device *slot)
+std::pair<std::error_condition, std::string> stv_state::load_cart(device_image_interface &image, generic_slot_device *slot)
{
- uint8_t *ROM;
- uint32_t size = slot->common_get_size("rom");
+ uint32_t const size = slot->common_get_size("rom");
if (!image.loaded_through_softlist())
- return image_error::UNSUPPORTED;
+ return std::make_pair(image_error::UNSUPPORTED, "Cartridges must be loaded from the software list");
slot->rom_alloc(size, GENERIC_ROM32_WIDTH, ENDIANNESS_BIG);
- ROM = slot->get_rom_base();
+ uint8_t *const ROM = slot->get_rom_base();
memcpy(ROM, image.get_software_region("rom"), size);
/* fix endianess */
@@ -1359,7 +1358,7 @@ std::error_condition stv_state::load_cart(device_image_interface &image, generic
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/sega/stv.h b/src/mame/sega/stv.h
index d0ee79ec1f1..e0f7f5edf3e 100644
--- a/src/mame/sega/stv.h
+++ b/src/mame/sega/stv.h
@@ -114,7 +114,7 @@ private:
uint32_t magzun_rx_hack_r();
void hop_ioga_w(offs_t offset, uint8_t data);
- std::error_condition load_cart(device_image_interface &image, generic_slot_device *slot);
+ std::pair<std::error_condition, std::string> load_cart(device_image_interface &image, generic_slot_device *slot);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( stv_cart1 ) { return load_cart(image, m_cart1); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( stv_cart2 ) { return load_cart(image, m_cart2); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( stv_cart3 ) { return load_cart(image, m_cart3); }
diff --git a/src/mame/sega/svmu.cpp b/src/mame/sega/svmu.cpp
index f7862325224..4b75f8671ce 100644
--- a/src/mame/sega/svmu.cpp
+++ b/src/mame/sega/svmu.cpp
@@ -327,7 +327,7 @@ QUICKLOAD_LOAD_MEMBER(svmu_state::quickload_cb)
vmufat_write_word(flash, 253, 0x1a, 0x0001); // offset of header (in blocks) from file start
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/sfrj/galaxy.cpp b/src/mame/sfrj/galaxy.cpp
index ebba787844b..d53c745e568 100644
--- a/src/mame/sfrj/galaxy.cpp
+++ b/src/mame/sfrj/galaxy.cpp
@@ -203,7 +203,9 @@ SNAPSHOT_LOAD_MEMBER(galaxy_state::snapshot_cb)
case GALAXY_SNAPSHOT_V2_SIZE:
break;
default:
- return image_error::INVALIDLENGTH;
+ return std::make_pair(
+ image_error::INVALIDLENGTH,
+ util::string_format("Unsupported image size (must be %u or %u bytes)", GALAXY_SNAPSHOT_V1_SIZE, GALAXY_SNAPSHOT_V2_SIZE));
}
std::vector<uint8_t> snapshot_data(snapshot_size);
@@ -211,7 +213,7 @@ SNAPSHOT_LOAD_MEMBER(galaxy_state::snapshot_cb)
setup_snapshot(&snapshot_data[0], snapshot_size);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
/***************************************************************************
diff --git a/src/mame/sgi/iris3130.cpp b/src/mame/sgi/iris3130.cpp
index 6e71e9c369e..3a3d7e7c3d0 100644
--- a/src/mame/sgi/iris3130.cpp
+++ b/src/mame/sgi/iris3130.cpp
@@ -224,9 +224,9 @@ QUICKLOAD_LOAD_MEMBER(iris3000_state::load_romboard)
if (image.length() == 0 || image.fread(&m_file_data[0], image.length()) != image.length())
{
m_file_data.clear();
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
/***************************************************************************
diff --git a/src/mame/shared/z80bin.cpp b/src/mame/shared/z80bin.cpp
index e3d7d8c25cf..e887815e5a5 100644
--- a/src/mame/shared/z80bin.cpp
+++ b/src/mame/shared/z80bin.cpp
@@ -5,12 +5,13 @@
#include "imagedev/snapquik.h"
+
/*-------------------------------------------------
z80bin_load_file - load a z80bin file into
memory
-------------------------------------------------*/
-std::error_condition z80bin_load_file(snapshot_image_device &image, address_space &space, uint16_t &exec_addr, uint16_t &start_addr, uint16_t &end_addr)
+std::pair<std::error_condition, std::string> z80bin_load_file(snapshot_image_device &image, address_space &space, uint16_t &exec_addr, uint16_t &start_addr, uint16_t &end_addr)
{
uint16_t args[3]{};
uint16_t i, size = 0U;
@@ -27,11 +28,7 @@ std::error_condition z80bin_load_file(snapshot_image_device &image, address_spac
if (ch != '\0')
{
if (i >= (std::size(pgmname) - 1))
- {
- osd_printf_error("File name too long\n");
- image.message(" File name too long");
- return image_error::INVALIDIMAGE;
- }
+ return std::make_pair(image_error::INVALIDIMAGE, "Program file name too long");
pgmname[i] = ch; // build program name
i++;
@@ -39,20 +36,12 @@ std::error_condition z80bin_load_file(snapshot_image_device &image, address_spac
}
if (bytes == 0)
- {
- osd_printf_error("%s: Unexpected EOF while getting file name\n", image.basename());
- image.message(" Unexpected EOF while getting file name");
- return image_error::UNSPECIFIED;
- }
+ return std::make_pair(image_error::UNSPECIFIED, "Unexpected EOF while reading program file name");
pgmname[i] = '\0'; // terminate string with a NUL
if (image.fread(args, sizeof(args)) != sizeof(args))
- {
- osd_printf_error("%s: Unexpected EOF while getting file size\n", image.basename());
- image.message(" Unexpected EOF while getting file size");
- return image_error::UNSPECIFIED;
- }
+ return std::make_pair(image_error::UNSPECIFIED, "Unexpected EOF while reading program file size");
exec_addr = little_endianize_int16(args[0]);
start_addr = little_endianize_int16(args[1]);
@@ -68,12 +57,12 @@ std::error_condition z80bin_load_file(snapshot_image_device &image, address_spac
uint16_t const j = (start_addr + i) & 0xffff;
if (image.fread(&data, 1) != 1)
{
- osd_printf_error("%s: Unexpected EOF while writing byte to %04X\n", image.basename(), j);
- image.message("%s: Unexpected EOF while writing byte to %04X", pgmname, (unsigned) j);
- return image_error::UNSPECIFIED;
+ return std::make_pair(
+ image_error::UNSPECIFIED,
+ util::string_format("Unexpected EOF while reading program byte %04X", j));
}
space.write_byte(j, data);
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/shared/z80bin.h b/src/mame/shared/z80bin.h
index 9e317e7ade3..da437498f07 100644
--- a/src/mame/shared/z80bin.h
+++ b/src/mame/shared/z80bin.h
@@ -21,6 +21,6 @@
class snapshot_image_device;
-std::error_condition z80bin_load_file(snapshot_image_device &image, address_space &space, uint16_t &exec_addr, uint16_t &start_addr, uint16_t &end_addr);
+std::pair<std::error_condition, std::string> z80bin_load_file(snapshot_image_device &image, address_space &space, uint16_t &exec_addr, uint16_t &start_addr, uint16_t &end_addr);
#endif // MAME_SHARED_Z80BIN_H
diff --git a/src/mame/sharp/pce220_ser.cpp b/src/mame/sharp/pce220_ser.cpp
index 2047f855094..068372c4e0f 100644
--- a/src/mame/sharp/pce220_ser.cpp
+++ b/src/mame/sharp/pce220_ser.cpp
@@ -229,7 +229,7 @@ TIMER_CALLBACK_MEMBER(pce220_serial_device::receive_tick)
DEVICE_IMAGE_LOAD( pce220_serial )
-------------------------------------------------*/
-std::error_condition pce220_serial_device::call_load()
+std::pair<std::error_condition, std::string> pce220_serial_device::call_load()
{
m_state = SIO_WAIT;
m_bytes_count = 0;
@@ -238,21 +238,21 @@ std::error_condition pce220_serial_device::call_load()
//read the first byte
fread(&m_current_byte, 1);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
/*-------------------------------------------------
DEVICE_IMAGE_CREATE( pce220_serial )
-------------------------------------------------*/
-std::error_condition pce220_serial_device::call_create(int format_type, util::option_resolution *format_options)
+std::pair<std::error_condition, std::string> pce220_serial_device::call_create(int format_type, util::option_resolution *format_options)
{
m_state = SIO_WAIT;
m_bytes_count = 0;
m_current_byte = 0;
m_receive_timer->adjust(attotime::from_hz(SIO_BAUD_RATE), 0, attotime::from_hz(SIO_BAUD_RATE));
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/sharp/pce220_ser.h b/src/mame/sharp/pce220_ser.h
index c37ce465c75..677145eab15 100644
--- a/src/mame/sharp/pce220_ser.h
+++ b/src/mame/sharp/pce220_ser.h
@@ -29,9 +29,9 @@ public:
virtual ~pce220_serial_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
- virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
+ virtual std::pair<std::error_condition, std::string> call_create(int format_type, util::option_resolution *format_options) override;
virtual bool is_readable() const noexcept override { return true; }
virtual bool is_writeable() const noexcept override { return true; }
diff --git a/src/mame/sharp/wizard.cpp b/src/mame/sharp/wizard.cpp
index b9ee42a22c3..e75005ab50f 100644
--- a/src/mame/sharp/wizard.cpp
+++ b/src/mame/sharp/wizard.cpp
@@ -121,7 +121,7 @@ DEVICE_IMAGE_LOAD_MEMBER(wizard_state::cart_load)
m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
static INPUT_PORTS_START( iq7000 )
diff --git a/src/mame/sharp/x68k_hdc.cpp b/src/mame/sharp/x68k_hdc.cpp
index 063a29cd2ba..ac3feddb3c6 100644
--- a/src/mame/sharp/x68k_hdc.cpp
+++ b/src/mame/sharp/x68k_hdc.cpp
@@ -55,7 +55,7 @@ void x68k_hdc_image_device::device_start()
save_item(NAME(m_transfer_byte_total));
}
-std::error_condition x68k_hdc_image_device::call_create(int format_type, util::option_resolution *format_options)
+std::pair<std::error_condition, std::string> x68k_hdc_image_device::call_create(int format_type, util::option_resolution *format_options)
{
// create 20MB HD
int x;
@@ -67,10 +67,10 @@ std::error_condition x68k_hdc_image_device::call_create(int format_type, util::o
{
ret = fwrite(sectordata,256);
if(ret < 256)
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void x68k_hdc_image_device::hdc_w(offs_t offset, u16 data)
diff --git a/src/mame/sharp/x68k_hdc.h b/src/mame/sharp/x68k_hdc.h
index ce90fef7e97..1d08808486f 100644
--- a/src/mame/sharp/x68k_hdc.h
+++ b/src/mame/sharp/x68k_hdc.h
@@ -101,7 +101,7 @@ public:
virtual const char *file_extensions() const noexcept override { return "hdf"; }
virtual const char *image_type_name() const noexcept override { return "sasihd"; }
virtual const char *image_brief_type_name() const noexcept override { return "sasi"; }
- virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
+ virtual std::pair<std::error_condition, std::string> call_create(int format_type, util::option_resolution *format_options) override;
void hdc_w(offs_t offset, u16 data);
u16 hdc_r(offs_t offset);
diff --git a/src/mame/sinclair/spec_snqk.cpp b/src/mame/sinclair/spec_snqk.cpp
index 0afa480e850..a00ba95a99c 100644
--- a/src/mame/sinclair/spec_snqk.cpp
+++ b/src/mame/sinclair/spec_snqk.cpp
@@ -124,10 +124,8 @@ SNAPSHOT_LOAD_MEMBER(spectrum_state::snapshot_cb)
if (image.is_filetype("sna"))
{
if ((snapshot_size != SNA48_SIZE) && (snapshot_size != SNA128_SIZE_1) && (snapshot_size != SNA128_SIZE_2))
- {
- logerror("Invalid .SNA file size.\n");
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid .SNA file size");
+
setup_sna(&snapshot_data[0], snapshot_size);
}
else if (image.is_filetype("sp"))
@@ -135,38 +133,29 @@ SNAPSHOT_LOAD_MEMBER(spectrum_state::snapshot_cb)
if ((snapshot_data[0] != 'S' && snapshot_data[1] != 'P') && (snapshot_size != SP_NEW_SIZE_16K && snapshot_size != SP_NEW_SIZE_48K))
{
if (snapshot_size != SP_OLD_SIZE)
- {
- logerror("Invalid .SP file size.\n");
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid .SP file size");
}
setup_sp(&snapshot_data[0], snapshot_size);
}
else if (image.is_filetype("ach"))
{
if (snapshot_size != ACH_SIZE)
- {
- logerror("Invalid .ACH file size.\n");
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid .ACH file size");
+
setup_ach(&snapshot_data[0], snapshot_size);
}
else if (image.is_filetype("prg"))
{
if (snapshot_size != PRG_SIZE)
- {
- logerror("Invalid .PRG file size.\n");
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid .PRG file size");
+
setup_prg(&snapshot_data[0], snapshot_size);
}
else if (image.is_filetype("plusd"))
{
if ((snapshot_size != PLUSD48_SIZE) && (snapshot_size != PLUSD128_SIZE))
- {
- logerror("Invalid .PLUSD file size.\n");
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid .PLUSD file size");
+
setup_plusd(&snapshot_data[0], snapshot_size);
}
else if (image.is_filetype("sem"))
@@ -176,57 +165,44 @@ SNAPSHOT_LOAD_MEMBER(spectrum_state::snapshot_cb)
snapshot_data[4] != 'C' && snapshot_data[5] != '1')
{
if (snapshot_size != SEM_SIZE)
- {
- logerror("Invalid .SEM file size.\n");
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid .SEM file size");
}
setup_sem(&snapshot_data[0], snapshot_size);
}
else if (image.is_filetype("sit"))
{
if (snapshot_size != SIT_SIZE)
- {
- logerror("Invalid .SIT file size.\n");
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid .SIT file size");
+
setup_sit(&snapshot_data[0], snapshot_size);
}
else if (image.is_filetype("zx"))
{
if (snapshot_size != ZX_SIZE)
- {
- logerror("Invalid .ZX file size.\n");
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid .ZX file size");
+
setup_zx(&snapshot_data[0], snapshot_size);
}
else if (image.is_filetype("snp"))
{
if (snapshot_size != SNP_SIZE)
- {
- logerror("Invalid .SNP file size.\n");
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid .SNP file size");
+
setup_snp(&snapshot_data[0], snapshot_size);
}
else if (image.is_filetype("snx"))
{
if (snapshot_data[0] != 'X' && snapshot_data[1] != 'S' && \
snapshot_data[2] != 'N' && snapshot_data[3] != 'A')
- {
- logerror("Invalid .SNX file header.\n");
- return image_error::INVALIDIMAGE;
- }
+ return std::make_pair(image_error::INVALIDIMAGE, "Invalid .SNX file header");
+
setup_snx(&snapshot_data[0], snapshot_size);
}
else if (image.is_filetype("frz"))
{
if (snapshot_size != FRZ_SIZE)
- {
- logerror("Invalid .FRZ file size.\n");
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid .FRZ file size");
+
setup_frz(&snapshot_data[0], snapshot_size);
}
else
@@ -234,7 +210,7 @@ SNAPSHOT_LOAD_MEMBER(spectrum_state::snapshot_cb)
setup_z80(&snapshot_data[0], snapshot_size);
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
/*******************************************************************
@@ -2431,23 +2407,19 @@ QUICKLOAD_LOAD_MEMBER(spectrum_state::quickload_cb)
if (image.is_filetype("scr"))
{
if ((quickload_size != SCR_SIZE) && (quickload_size != SCR_BITMAP))
- {
- logerror("Invalid .SCR file size.\n");
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid .SCR file size.");
+
setup_scr(&quickload_data[0], quickload_size);
}
else if (image.is_filetype("raw"))
{
if (quickload_size != RAW_SIZE)
- {
- logerror("Invalid .RAW file size.\n");
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid .RAW file size.");
+
setup_raw(&quickload_data[0], quickload_size);
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
/*******************************************************************
diff --git a/src/mame/sinclair/timex.cpp b/src/mame/sinclair/timex.cpp
index 9311736c347..8b133709b72 100644
--- a/src/mame/sinclair/timex.cpp
+++ b/src/mame/sinclair/timex.cpp
@@ -604,10 +604,7 @@ DEVICE_IMAGE_LOAD_MEMBER( ts2068_state::cart_load )
header.resize(9);
if (size % 0x2000 != 9)
- {
- osd_printf_error("%s: File corrupted\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge data size (must be a multiple of 8K)");
m_dock->rom_alloc(0x10000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
u8* DOCK = m_dock->get_rom_base();
@@ -621,8 +618,9 @@ DEVICE_IMAGE_LOAD_MEMBER( ts2068_state::cart_load )
if (chunks_in_file * 0x2000 + 0x09 != size)
{
- osd_printf_error("%s: File corrupted\n", image.basename());
- return image_error::INVALIDIMAGE;
+ return std::make_pair(
+ image_error::INVALIDIMAGE,
+ util::string_format("Chunks in header (%d) do not match data size (%d)", chunks_in_file, (size - 0x09) / 0x2000));
}
switch (header[0])
@@ -645,8 +643,9 @@ DEVICE_IMAGE_LOAD_MEMBER( ts2068_state::cart_load )
break;
default:
- osd_printf_error("%s: Cart type not supported\n", image.basename());
- return image_error::INVALIDIMAGE;
+ return std::make_pair(
+ image_error::INVALIDIMAGE,
+ util::string_format("Cartridge type 0x%02X not supported", header[0]));
}
logerror ("Cart loaded [Chunks %02x]\n", m_ram_chunks);
@@ -657,7 +656,7 @@ DEVICE_IMAGE_LOAD_MEMBER( ts2068_state::cart_load )
memcpy(m_dock->get_rom_base(), image.get_software_region("rom"), size);
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/skeleton/c2color.cpp b/src/mame/skeleton/c2color.cpp
index 75a5033b466..d5ed8a7aa43 100644
--- a/src/mame/skeleton/c2color.cpp
+++ b/src/mame/skeleton/c2color.cpp
@@ -105,7 +105,7 @@ DEVICE_IMAGE_LOAD_MEMBER(c2_color_state::cart_load)
m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
u8 c2_color_state::cart_r(offs_t offset)
diff --git a/src/mame/skeleton/cd2650.cpp b/src/mame/skeleton/cd2650.cpp
index 20dd03d30e5..6a2c590ea7b 100644
--- a/src/mame/skeleton/cd2650.cpp
+++ b/src/mame/skeleton/cd2650.cpp
@@ -256,76 +256,44 @@ void cd2650_state::kbd_put(u8 data)
QUICKLOAD_LOAD_MEMBER(cd2650_state::quickload_cb)
{
- int i;
- std::error_condition result = image_error::UNSPECIFIED;
-
int const quick_length = image.length();
if (quick_length < 0x1500)
+ return std::make_pair(image_error::INVALIDLENGTH, "Image file too short (must be at least 5376 bytes)");
+ else if (quick_length > 0x8000)
+ return std::make_pair(image_error::INVALIDLENGTH, "Image file too long (must be no more than 32K)");
+
+ std::vector<u8> quick_data(quick_length);
+ int read_ = image.fread( &quick_data[0], quick_length);
+ if (read_ != quick_length)
+ return std::make_pair(image_error::UNSPECIFIED, "Cannot read the file");
+ else if (quick_data[0] != 0x40)
+ return std::make_pair(image_error::INVALIDIMAGE, "Invalid file header");
+
+ int const exec_addr = quick_data[1] * 256 + quick_data[2];
+ if (exec_addr >= quick_length)
{
- result = image_error::INVALIDLENGTH;
- osd_printf_error("%s: File too short\n", image.basename());
- image.message(" File too short");
+ return std::make_pair(
+ image_error::INVALIDIMAGE,
+ util::string_format("Exec address %04X beyond end of file %04X", exec_addr, quick_length));
}
- else
- if (quick_length > 0x8000)
- {
- result = image_error::INVALIDLENGTH;
- osd_printf_error("%s: File too long\n", image.basename());
- image.message(" File too long");
- }
- else
- {
- std::vector<u8> quick_data(quick_length);
- int read_ = image.fread( &quick_data[0], quick_length);
- if (read_ != quick_length)
- {
- result = image_error::UNSPECIFIED;
- osd_printf_error("%s: Cannot read the file\n", image.basename());
- image.message(" Cannot read the file");
- }
- else
- if (quick_data[0] != 0x40)
- {
- result = image_error::INVALIDIMAGE;
- osd_printf_error("%s: Invalid header\n", image.basename());
- image.message(" Invalid header");
- }
- else
- {
- int exec_addr = quick_data[1] * 256 + quick_data[2];
- if (exec_addr >= quick_length)
- {
- result = image_error::INVALIDIMAGE;
- osd_printf_error("%s: Exec address beyond end of file\n", image.basename());
- image.message(" Exec address beyond end of file");
- }
- else
- {
- // do not overwite system area (17E0-17FF) otherwise chess3 has problems
- read_ = 0x17e0;
- if (quick_length < 0x17e0)
- read_ = quick_length;
+ // do not overwite system area (17E0-17FF) otherwise chess3 has problems
+ read_ = std::min<int>(0x17e0, quick_length);
- for (i = 0x1500; i < read_; i++)
- m_p_videoram[i-0x1000] = quick_data[i];
+ for (int i = 0x1500; i < read_; i++)
+ m_p_videoram[i-0x1000] = quick_data[i];
- if (quick_length > 0x17ff)
- for (i = 0x1800; i < quick_length; i++)
- m_p_videoram[i-0x1000] = quick_data[i];
+ if (quick_length > 0x17ff)
+ for (int i = 0x1800; i < quick_length; i++)
+ m_p_videoram[i-0x1000] = quick_data[i];
- /* display a message about the loaded quickload */
- image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr);
+ // display a message about the loaded quickload
+ image.message(" Quickload: size=%04X : exec=%04X", quick_length, exec_addr);
- // Start the quickload
- m_maincpu->set_state_int(S2650_PC, exec_addr);
-
- result = std::error_condition();
- }
- }
- }
+ // Start the quickload
+ m_maincpu->set_state_int(S2650_PC, exec_addr);
- return result;
+ return std::make_pair(std::error_condition(), std::string());
}
void cd2650_state::cd2650(machine_config &config)
diff --git a/src/mame/skeleton/cosmicos.cpp b/src/mame/skeleton/cosmicos.cpp
index 1b9a6fcf686..3dc29715fb3 100644
--- a/src/mame/skeleton/cosmicos.cpp
+++ b/src/mame/skeleton/cosmicos.cpp
@@ -497,13 +497,21 @@ void cosmicos_state::machine_reset()
QUICKLOAD_LOAD_MEMBER(cosmicos_state::quickload_cb)
{
+ // FIXME: comment says "RAM" but data is loaded to ROM region - which should it be?
int const size = image.length();
+ if (size > m_rom->bytes())
+ {
+ return std::make_pair(
+ image_error::INVALIDLENGTH,
+ util::string_format("%u-byte image file is too large for %u-byte ROM", size, m_rom->bytes()));
+ }
+
uint8_t *const ptr = m_rom->base();
// load image to RAM
image.fread(ptr, size);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
/* Machine Driver */
diff --git a/src/mame/skeleton/cp1.cpp b/src/mame/skeleton/cp1.cpp
index 142a01dbf97..8494efcea59 100644
--- a/src/mame/skeleton/cp1.cpp
+++ b/src/mame/skeleton/cp1.cpp
@@ -262,11 +262,11 @@ QUICKLOAD_LOAD_MEMBER(cp1_state::quickload_cb)
}
else
{
- return image_error::INVALIDIMAGE;
+ return std::make_pair(image_error::INVALIDIMAGE, std::string());
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void cp1_state::cp1(machine_config &config)
diff --git a/src/mame/skeleton/digiblast.cpp b/src/mame/skeleton/digiblast.cpp
index a609286addf..baac494ecf2 100644
--- a/src/mame/skeleton/digiblast.cpp
+++ b/src/mame/skeleton/digiblast.cpp
@@ -74,7 +74,7 @@ DEVICE_IMAGE_LOAD_MEMBER(digiblast_state::cart_load)
m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/skeleton/dmv.cpp b/src/mame/skeleton/dmv.cpp
index a59ed257059..ec285d14ec8 100644
--- a/src/mame/skeleton/dmv.cpp
+++ b/src/mame/skeleton/dmv.cpp
@@ -404,10 +404,10 @@ QUICKLOAD_LOAD_MEMBER(dmv_state::quickload_cb)
{
/* Avoid loading a program if CP/M-80 is not in memory */
if ((m_ram->base()[0] != 0xc3) || (m_ram->base()[5] != 0xc3))
- return image_error::UNSUPPORTED;
+ return std::make_pair(image_error::UNSUPPORTED, std::string());
if (image.length() >= 0xfd00)
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, std::string());
/* Load image to the TPA (Transient Program Area) */
uint16_t quickload_size = image.length();
@@ -415,7 +415,7 @@ QUICKLOAD_LOAD_MEMBER(dmv_state::quickload_cb)
{
uint8_t data;
if (image.fread( &data, 1) != 1)
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
m_ram->base()[i+0x100] = data;
}
@@ -424,7 +424,7 @@ QUICKLOAD_LOAD_MEMBER(dmv_state::quickload_cb)
m_maincpu->set_pc(0x100); // start program
m_maincpu->set_state_int(Z80_SP, 256 * m_ram->base()[7] - 300); // put the stack a bit before BDOS
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
static void dmv_floppies(device_slot_interface &device)
diff --git a/src/mame/skeleton/easy_karaoke.cpp b/src/mame/skeleton/easy_karaoke.cpp
index b2bc9632275..4de9ec7e977 100644
--- a/src/mame/skeleton/easy_karaoke.cpp
+++ b/src/mame/skeleton/easy_karaoke.cpp
@@ -128,7 +128,7 @@ DEVICE_IMAGE_LOAD_MEMBER(easy_karaoke_state::cart_load)
m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
static INPUT_PORTS_START( easy_karaoke )
diff --git a/src/mame/skeleton/i7000.cpp b/src/mame/skeleton/i7000.cpp
index 761833628ed..eb65cb3c8e8 100644
--- a/src/mame/skeleton/i7000.cpp
+++ b/src/mame/skeleton/i7000.cpp
@@ -288,7 +288,7 @@ DEVICE_IMAGE_LOAD_MEMBER(i7000_state::card_load)
m_card->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_BIG);
m_card->common_load_rom(m_card->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
static const gfx_layout i7000_charlayout =
diff --git a/src/mame/skeleton/pockchal.cpp b/src/mame/skeleton/pockchal.cpp
index d926abe4cc5..8a910ae86e7 100644
--- a/src/mame/skeleton/pockchal.cpp
+++ b/src/mame/skeleton/pockchal.cpp
@@ -67,7 +67,7 @@ DEVICE_IMAGE_LOAD_MEMBER( pockchalv1_state::cart_load )
m_cart->rom_alloc(m_rom_size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), m_rom_size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void pockchalv1_state::video_start()
diff --git a/src/mame/skeleton/squale.cpp b/src/mame/skeleton/squale.cpp
index 41427436fc0..d862c175449 100644
--- a/src/mame/skeleton/squale.cpp
+++ b/src/mame/skeleton/squale.cpp
@@ -631,16 +631,13 @@ DEVICE_IMAGE_LOAD_MEMBER( squale_state::cart_load )
{
uint32_t const size = m_cart->common_get_size("rom");
- if ( ! size || size > 0x10000)
- {
- osd_printf_error("%s: Unsupported cartridge size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ if (!size || size > 0x1'0000)
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be more than 64K)");
m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
TIMER_DEVICE_CALLBACK_MEMBER( squale_state::squale_scanline )
diff --git a/src/mame/snk/ngp.cpp b/src/mame/snk/ngp.cpp
index 641e3ec66c8..495e360cc78 100644
--- a/src/mame/snk/ngp.cpp
+++ b/src/mame/snk/ngp.cpp
@@ -756,10 +756,7 @@ DEVICE_IMAGE_LOAD_MEMBER(ngp_state::load_ngp_cart)
uint32_t size = m_cart->common_get_size("rom");
if (size != 0x8000 && size != 0x8'0000 && size != 0x10'0000 && size != 0x20'0000 && size != 0x40'0000)
- {
- osd_printf_error("Unsupported cartridge size\n");
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be 32K, 512K, 1M, 2M or 4M)");
// alloc 0x400000 ROM to simplify mapping in the address map
m_cart->rom_alloc(0x400000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
@@ -794,7 +791,7 @@ DEVICE_IMAGE_LOAD_MEMBER(ngp_state::load_ngp_cart)
m_flash_chip[1].state = F_READ;
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/sony/pockstat.cpp b/src/mame/sony/pockstat.cpp
index d64118381a0..6d7b4191347 100644
--- a/src/mame/sony/pockstat.cpp
+++ b/src/mame/sony/pockstat.cpp
@@ -968,20 +968,20 @@ DEVICE_IMAGE_LOAD_MEMBER(pockstat_state::flash_load)
uint32_t const size = image.length();
if (size != 0x20f40)
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, std::string());
image.fread(cart_id, 0xf40);
for (int i = 0; i < strlen(gme_id); i++)
{
if (cart_id[i] != gme_id[i])
- return image_error::INVALIDIMAGE;
+ return std::make_pair(image_error::INVALIDIMAGE, std::string());
}
m_cart->rom_alloc(0x20000, GENERIC_ROM32_WIDTH, ENDIANNESS_LITTLE);
image.fread(m_cart->get_rom_base(), 0x20000);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void pockstat_state::pockstat(machine_config &config)
diff --git a/src/mame/sony/psx.cpp b/src/mame/sony/psx.cpp
index 91a7282e51b..aea6ae13c16 100644
--- a/src/mame/sony/psx.cpp
+++ b/src/mame/sony/psx.cpp
@@ -466,10 +466,10 @@ QUICKLOAD_LOAD_MEMBER(psx1_state::quickload_exe)
if (image.fread(reinterpret_cast<void *>(&m_exe_buffer[0]), image.length()) != image.length())
{
m_exe_buffer.resize(0);
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void psx1_state::cd_dma_read( uint32_t *p_n_psxram, uint32_t n_address, int32_t n_size )
diff --git a/src/mame/sony/psxcd.cpp b/src/mame/sony/psxcd.cpp
index ff6de46b026..b6b5bc600a3 100644
--- a/src/mame/sony/psxcd.cpp
+++ b/src/mame/sony/psxcd.cpp
@@ -186,11 +186,11 @@ void psxcd_device::device_reset()
curpos.w = 0;
}
-std::error_condition psxcd_device::call_load()
+std::pair<std::error_condition, std::string> psxcd_device::call_load()
{
- std::error_condition ret = cdrom_image_device::call_load();
+ auto ret = cdrom_image_device::call_load();
open = true;
- if (!ret)
+ if (!ret.first)
add_system_event(EVENT_CHANGE_DISK, m_sysclock, nullptr); // 1 sec to spin up the disk
return ret;
}
diff --git a/src/mame/sony/psxcd.h b/src/mame/sony/psxcd.h
index 74348e088f8..55819fff940 100644
--- a/src/mame/sony/psxcd.h
+++ b/src/mame/sony/psxcd.h
@@ -26,7 +26,7 @@ public:
auto irq_handler() { return m_irq_handler.bind(); }
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
void write(offs_t offset, uint8_t data);
diff --git a/src/mame/sony/smc777.cpp b/src/mame/sony/smc777.cpp
index 26800ec42dd..d90ed523f5f 100644
--- a/src/mame/sony/smc777.cpp
+++ b/src/mame/sony/smc777.cpp
@@ -413,7 +413,7 @@ QUICKLOAD_LOAD_MEMBER(smc777_state::quickload_cb)
address_space& prog_space = m_maincpu->space(AS_PROGRAM);
if (image.length() >= 0xfd00)
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, std::string());
/* The right RAM bank must be active */
@@ -421,7 +421,7 @@ QUICKLOAD_LOAD_MEMBER(smc777_state::quickload_cb)
if ((prog_space.read_byte(0) != 0xc3) || (prog_space.read_byte(5) != 0xc3))
{
machine_reset();
- return image_error::UNSUPPORTED;
+ return std::make_pair(image_error::UNSUPPORTED, std::string());
}
/* Load image to the TPA (Transient Program Area) */
@@ -430,7 +430,7 @@ QUICKLOAD_LOAD_MEMBER(smc777_state::quickload_cb)
{
uint8_t data;
if (image.fread( &data, 1) != 1)
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
prog_space.write_byte(i+0x100, data);
}
@@ -441,7 +441,7 @@ QUICKLOAD_LOAD_MEMBER(smc777_state::quickload_cb)
m_maincpu->set_state_int(Z80_SP, 256 * prog_space.read_byte(7) - 300);
m_maincpu->set_pc(0x100); // start program
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
uint8_t smc777_state::fdc_r(offs_t offset)
diff --git a/src/mame/svi/svi318.cpp b/src/mame/svi/svi318.cpp
index 5aa6c4000f0..5806b79fd8b 100644
--- a/src/mame/svi/svi318.cpp
+++ b/src/mame/svi/svi318.cpp
@@ -508,7 +508,7 @@ DEVICE_IMAGE_LOAD_MEMBER( svi3x8_state::cart_load )
m_cart_rom->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
m_cart_rom->common_load_rom(m_cart_rom->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/svision/svision.cpp b/src/mame/svision/svision.cpp
index 526c91e8a9c..c9a537ae164 100644
--- a/src/mame/svision/svision.cpp
+++ b/src/mame/svision/svision.cpp
@@ -619,15 +619,12 @@ DEVICE_IMAGE_LOAD_MEMBER(svision_state::cart_load)
uint32_t size = m_cart->common_get_size("rom");
if (size > 0x80000)
- {
- osd_printf_error("%s: Unsupported cartridge size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be no larger than 512K)");
m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void svision_state::machine_start()
diff --git a/src/mame/ta/alphatro.cpp b/src/mame/ta/alphatro.cpp
index f4eaeab0379..851466a2b05 100644
--- a/src/mame/ta/alphatro.cpp
+++ b/src/mame/ta/alphatro.cpp
@@ -104,7 +104,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(kansas_w);
MC6845_UPDATE_ROW(crtc_update_row);
- std::error_condition load_cart(device_image_interface &image, generic_slot_device *slot);
+ std::pair<std::error_condition, std::string> load_cart(device_image_interface &image, generic_slot_device *slot);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(cart_load) { return load_cart(image, m_cart); }
void alphatro_io(address_map &map);
@@ -696,15 +696,12 @@ void alphatro_state::machine_reset()
m_bicom_en = 0;
}
-std::error_condition alphatro_state::load_cart(device_image_interface &image, generic_slot_device *slot)
+std::pair<std::error_condition, std::string> alphatro_state::load_cart(device_image_interface &image, generic_slot_device *slot)
{
uint32_t const size = slot->common_get_size("rom");
if ((size != 0x4000) && (size != 0x2000))
- {
- osd_printf_error("%s: Invalid size, must be 8 or 16 K\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid cartridge size (must be 8K or 16K)");
slot->rom_alloc(0x4000, GENERIC_ROM8_WIDTH, ENDIANNESS_BIG);
@@ -717,7 +714,7 @@ std::error_condition alphatro_state::load_cart(device_image_interface &image, ge
slot->common_load_rom(slot->get_rom_base()+0x2000, size, "rom");
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void alphatro_state::alphatro_palette(palette_device &palette) const
diff --git a/src/mame/tangerine/microtan_m.cpp b/src/mame/tangerine/microtan_m.cpp
index f117d3c9818..e2ae9c57b0f 100644
--- a/src/mame/tangerine/microtan_m.cpp
+++ b/src/mame/tangerine/microtan_m.cpp
@@ -456,18 +456,18 @@ SNAPSHOT_LOAD_MEMBER(microtan_state::snapshot_cb)
{
uint64_t snapshot_len = image.length();
if (snapshot_len < 4 || snapshot_len >= 66000)
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, std::string());
auto snapshot_buff = std::make_unique<uint8_t []>(snapshot_len);
if (image.fread(snapshot_buff.get(), snapshot_len) != snapshot_len)
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
std::error_condition err = verify_snapshot(snapshot_buff.get(), snapshot_len);
if (err)
- return err;
+ return std::make_pair(err, std::string());
snapshot_copy(snapshot_buff.get(), snapshot_len);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
QUICKLOAD_LOAD_MEMBER(microtan_state::quickload_cb)
@@ -487,5 +487,5 @@ QUICKLOAD_LOAD_MEMBER(microtan_state::quickload_cb)
rc = parse_zillion_hex(&snapshot_buff[0], &buff[0]);
if (!rc)
snapshot_copy(&snapshot_buff[0], snapshot_size);
- return rc;
+ return std::make_pair(rc, std::string());
}
diff --git a/src/mame/tatung/einstein.cpp b/src/mame/tatung/einstein.cpp
index f3b21393801..186c57e2ccd 100644
--- a/src/mame/tatung/einstein.cpp
+++ b/src/mame/tatung/einstein.cpp
@@ -843,7 +843,7 @@ QUICKLOAD_LOAD_MEMBER(einstein_state::quickload_cb)
address_space& prog_space = m_maincpu->space(AS_PROGRAM);
if (image.length() >= 0xfd00)
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, std::string());
// disable ROM
m_rom_enabled = 0;
@@ -856,14 +856,14 @@ QUICKLOAD_LOAD_MEMBER(einstein_state::quickload_cb)
uint8_t data;
if (image.fread(&data, 1) != 1)
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
prog_space.write_byte(i + 0x100, data);
}
// start program
m_maincpu->set_pc(0x100);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/telercas/tmc1800.cpp b/src/mame/telercas/tmc1800.cpp
index 390e809a4fa..b07aae7c45a 100644
--- a/src/mame/telercas/tmc1800.cpp
+++ b/src/mame/telercas/tmc1800.cpp
@@ -770,13 +770,13 @@ QUICKLOAD_LOAD_MEMBER(tmc1800_base_state::quickload_cb)
if (size > m_ram->size()) // FIXME: comparing size to RAM size, but loading to ROM - seems incorrect
{
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, std::string());
}
uint8_t *const ptr = m_rom->base();
image.fread(ptr, size);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void tmc1800_state::tmc1800(machine_config &config)
diff --git a/src/mame/thomson/thomson_m.cpp b/src/mame/thomson/thomson_m.cpp
index d6bddf0f8a2..cb46c076a4a 100644
--- a/src/mame/thomson/thomson_m.cpp
+++ b/src/mame/thomson/thomson_m.cpp
@@ -259,18 +259,16 @@ DEVICE_IMAGE_LOAD_MEMBER( thomson_state::to7_cartridge )
m_thom_cart_nb_banks = 4;
else
{
- osd_printf_error("%s: Invalid cartridge size %u\n", image.basename(), size);
- return image_error::INVALIDLENGTH;
+ return std::make_pair(
+ image_error::INVALIDLENGTH,
+ util::string_format("Invalid cartridge size %u", size));
}
uint8_t *const pos = &m_cart_rom[0];
if (!image.loaded_through_softlist())
{
if (image.fread(pos, size) != size)
- {
- osd_printf_error("%s: Read error\n", image.basename());
- return image_error::UNSPECIFIED;
- }
+ return std::make_pair(image_error::UNSPECIFIED, "Error reading file");
}
else
{
@@ -294,7 +292,7 @@ DEVICE_IMAGE_LOAD_MEMBER( thomson_state::to7_cartridge )
PRINT (( "to7_cartridge_load: cartridge \"%s\" banks=%i, size=%i\n", name, m_thom_cart_nb_banks, size ));
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
@@ -1085,18 +1083,16 @@ DEVICE_IMAGE_LOAD_MEMBER( thomson_state::mo5_cartridge )
m_thom_cart_nb_banks = 4;
else
{
- osd_printf_error("Invalid cartridge size %d\n", size);
- return image_error::INVALIDLENGTH;
+ return std::make_pair(
+ image_error::INVALIDLENGTH,
+ util::string_format("Invalid cartridge size %u", size));
}
uint8_t *const pos = &m_cart_rom[0];
if (!image.loaded_through_softlist())
{
if (image.fread(pos, size) != size)
- {
- osd_printf_error("Read error\n");
- return image_error::UNSPECIFIED;
- }
+ return std::make_pair(image_error::UNSPECIFIED, "Error reading file");
}
else
{
@@ -1119,7 +1115,7 @@ DEVICE_IMAGE_LOAD_MEMBER( thomson_state::mo5_cartridge )
PRINT (( "mo5_cartridge_load: cartridge \"%s\" banks=%i, size=%u\n", name, m_thom_cart_nb_banks, (unsigned) size ));
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/ti/avigo.cpp b/src/mame/ti/avigo.cpp
index d4eca8713d2..c09c11e611f 100644
--- a/src/mame/ti/avigo.cpp
+++ b/src/mame/ti/avigo.cpp
@@ -732,11 +732,10 @@ QUICKLOAD_LOAD_MEMBER(avigo_state::quickload_cb)
// reset the CPU for allow at the Avigo OS to recognize the installed app
m_warm_start = 1;
m_maincpu->reset();
-
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, std::string());
}
void avigo_state::nvram_init(nvram_device &nvram, void *base, size_t size)
diff --git a/src/mame/ti/cc40.cpp b/src/mame/ti/cc40.cpp
index 906d5d6f3aa..03f0ee1a83b 100644
--- a/src/mame/ti/cc40.cpp
+++ b/src/mame/ti/cc40.cpp
@@ -194,16 +194,13 @@ DEVICE_IMAGE_LOAD_MEMBER(cc40_state::cart_load)
u32 const size = m_cart->common_get_size("rom");
// max size is 4*32KB
- if (size > 0x20000)
- {
- osd_printf_error("%s: Invalid file size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ if (size > 0x2'0000)
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid file size (must be no more than 128K)");
- m_cart->rom_alloc(0x20000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); // allocate a larger ROM region to have 4x32K banks
+ m_cart->rom_alloc(0x2'0000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); // allocate a larger ROM region to have 4x32K banks
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/ti/snspell.cpp b/src/mame/ti/snspell.cpp
index 94dd63a21ec..6b536ff49eb 100644
--- a/src/mame/ti/snspell.cpp
+++ b/src/mame/ti/snspell.cpp
@@ -368,12 +368,13 @@ DEVICE_IMAGE_LOAD_MEMBER(snspell_state::cart_load)
if (size > m_cart_max_size)
{
- osd_printf_error("%s: Invalid file size\n", image.basename());
- return image_error::INVALIDLENGTH;
+ return std::make_pair(
+ image_error::INVALIDLENGTH,
+ util::string_format("Invalid file size (must be no more than %u bytes)", m_cart_max_size));
}
m_cart->common_load_rom(m_cart_base, size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void snspell_state::init_snspell()
diff --git a/src/mame/ti/snspellc.cpp b/src/mame/ti/snspellc.cpp
index 6d6a85d1bfe..38c2bc74359 100644
--- a/src/mame/ti/snspellc.cpp
+++ b/src/mame/ti/snspellc.cpp
@@ -312,13 +312,10 @@ DEVICE_IMAGE_LOAD_MEMBER(snspellc_state::cart_load)
u32 const size = m_cart->common_get_size("rom");
if (size > 0x4000)
- {
- osd_printf_error("%s: Invalid file size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid file size (must be no more than 16K)");
m_cart->common_load_rom(m_cart_base, size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void snspellc_state::init_snspellc()
diff --git a/src/mame/ti/ti74.cpp b/src/mame/ti/ti74.cpp
index 1295c4d8a17..24320b6e2ec 100644
--- a/src/mame/ti/ti74.cpp
+++ b/src/mame/ti/ti74.cpp
@@ -148,15 +148,12 @@ DEVICE_IMAGE_LOAD_MEMBER(ti74_state::cart_load)
// max size is 32KB
if (size > 0x8000)
- {
- osd_printf_error("%s: Invalid file size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid file size (must be no more than 32K)");
m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/ti/ti85_m.cpp b/src/mame/ti/ti85_m.cpp
index eee9988984b..7a611ca522a 100644
--- a/src/mame/ti/ti85_m.cpp
+++ b/src/mame/ti/ti85_m.cpp
@@ -1194,8 +1194,9 @@ SNAPSHOT_LOAD_MEMBER(ti85_state::snapshot_cb)
if (image.length() != expected_snapshot_size)
{
- logerror("Incomplete snapshot file\n");
- return image_error::INVALIDLENGTH;
+ return std::make_pair(
+ image_error::INVALIDLENGTH,
+ util::string_format("Incorrect snapshot file length (expected %u bytes)", expected_snapshot_size));
}
std::vector<uint8_t> ti8x_snapshot_data(image.length());
@@ -1206,5 +1207,5 @@ SNAPSHOT_LOAD_MEMBER(ti85_state::snapshot_cb)
else if (!strncmp(machine().system().name, "ti86", 4))
ti86_setup_snapshot(&ti8x_snapshot_data[0]);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/ti/tm990189.cpp b/src/mame/ti/tm990189.cpp
index 8112e217671..84ee8ce2c7a 100644
--- a/src/mame/ti/tm990189.cpp
+++ b/src/mame/ti/tm990189.cpp
@@ -412,7 +412,7 @@ public:
tm990_189_rs232_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- // image-level overrides
+ // device_image_interface implementation
virtual bool is_readable() const noexcept override { return true; }
virtual bool is_writeable() const noexcept override { return true; }
virtual bool is_creatable() const noexcept override { return true; }
@@ -422,11 +422,11 @@ public:
virtual const char *image_type_name() const noexcept override { return "serial"; }
virtual const char *image_brief_type_name() const noexcept override { return "serl"; }
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
protected:
- // device-level overrides
+ // device_t implementation
virtual void device_start() override;
TIMER_CALLBACK_MEMBER(rs232_input_tick);
@@ -459,11 +459,11 @@ TIMER_CALLBACK_MEMBER(tm990_189_rs232_image_device::rs232_input_tick)
}
}
-std::error_condition tm990_189_rs232_image_device::call_load()
+std::pair<std::error_condition, std::string> tm990_189_rs232_image_device::call_load()
{
m_tms9902->rcv_dsr(ASSERT_LINE);
m_rs232_input_timer->adjust(attotime::zero, 0, attotime::from_msec(10));
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/tiger/gamecom.h b/src/mame/tiger/gamecom.h
index d9d2c85571a..c1c382224c9 100644
--- a/src/mame/tiger/gamecom.h
+++ b/src/mame/tiger/gamecom.h
@@ -263,6 +263,7 @@ private:
void handle_stylus_press(int column);
void recompute_lcd_params();
void handle_input_press(uint16_t mux_data);
+ std::pair<std::error_condition, std::string> common_load(device_image_interface &image, generic_slot_device *slot);
uint8_t *m_p_ram = nullptr;
uint8_t *m_cart_ptr = nullptr;
@@ -284,7 +285,6 @@ private:
gamecom_sound_t m_sound;
bitmap_ind16 m_bitmap;
- std::error_condition common_load(device_image_interface &image, generic_slot_device *slot);
required_shared_ptr<uint8_t> m_p_videoram;
required_shared_ptr<uint8_t> m_p_nvram;
required_device<sm8500_cpu_device> m_maincpu;
diff --git a/src/mame/tiger/gamecom_m.cpp b/src/mame/tiger/gamecom_m.cpp
index 08e05c420a0..7030d5beea5 100644
--- a/src/mame/tiger/gamecom_m.cpp
+++ b/src/mame/tiger/gamecom_m.cpp
@@ -621,7 +621,7 @@ void gamecom_state::init_gamecom()
m_p_ram = m_share_maincpu; // required here because pio_w gets called before machine_reset
}
-std::error_condition gamecom_state::common_load(device_image_interface &image, generic_slot_device *slot)
+std::pair<std::error_condition, std::string> gamecom_state::common_load(device_image_interface &image, generic_slot_device *slot)
{
uint32_t const size = slot->common_get_size("rom");
uint32_t load_offset = 0;
@@ -629,8 +629,7 @@ std::error_condition gamecom_state::common_load(device_image_interface &image, g
if (size != 0x00'8000 && size != 0x04'0000 && size != 0x08'0000
&& size != 0x10'0000 && size != 0x1c'0000 && size != 0x20'0000)
{
- osd_printf_error("%s: Unsupported cartridge size\n", image.basename());
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size");
}
if (size == 0x1c0000)
@@ -649,7 +648,7 @@ std::error_condition gamecom_state::common_load(device_image_interface &image, g
if (size < 0x100000) { memcpy(crt + 0x080000, crt, 0x080000); } /* ->1MB */
if (size < 0x1c0000) { memcpy(crt + 0x100000, crt, 0x100000); } /* -> >=1.8MB */
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
DEVICE_IMAGE_LOAD_MEMBER( gamecom_state::cart1_load )
diff --git a/src/mame/tiger/k28m2.cpp b/src/mame/tiger/k28m2.cpp
index 92ce46dd703..9d60b8b05b6 100644
--- a/src/mame/tiger/k28m2.cpp
+++ b/src/mame/tiger/k28m2.cpp
@@ -123,15 +123,12 @@ DEVICE_IMAGE_LOAD_MEMBER(k28m2_state::cart_load)
u32 const size = m_cart->common_get_size("rom");
if (size > 0x4000)
- {
- osd_printf_error("%s: Invalid file size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Invalid image file size (must be no more than 16K)");
u8 *const base = memregion("tms6100")->base() + 0x8000;
m_cart->common_load_rom(base, size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/trainer/instruct.cpp b/src/mame/trainer/instruct.cpp
index d939ac90311..e47968cab2c 100644
--- a/src/mame/trainer/instruct.cpp
+++ b/src/mame/trainer/instruct.cpp
@@ -352,88 +352,59 @@ void instruct_state::machine_start()
QUICKLOAD_LOAD_MEMBER(instruct_state::quickload_cb)
{
- uint16_t i, exec_addr, quick_length, read_;
- std::error_condition result = image_error::UNSPECIFIED;
-
- quick_length = image.length();
+ int const quick_length = image.length();
if (quick_length < 0x0100)
+ return std::make_pair(image_error::INVALIDLENGTH, "File too short (must be at least 256 bytes)");
+ else if (quick_length > 0x8000)
+ return std::make_pair(image_error::INVALIDLENGTH, "File too long (must be no more than 32K)");
+
+ std::vector<uint8_t> quick_data(quick_length);
+ uint16_t read_ = image.fread(&quick_data[0], quick_length);
+ if (read_ != quick_length)
+ return std::make_pair(image_error::UNSPECIFIED, "Cannot read file");
+ else if (quick_data[0] != 0xc5)
+ return std::make_pair(image_error::INVALIDIMAGE, "Invalid header");
+
+ uint16_t const exec_addr = quick_data[1] * 256 + quick_data[2];
+ if (exec_addr >= quick_length)
{
- result = image_error::INVALIDLENGTH;
- osd_printf_error("%s: File too short\n", image.basename());
- image.message(" File too short");
+ return std::make_pair(
+ image_error::INVALIDIMAGE,
+ util::string_format("Exec address %04X beyond end of file %04X", exec_addr, quick_length));
}
- else
- if (quick_length > 0x8000)
+
+ // load to 0000-0FFE (standard ram + extra)
+ read_ = std::min<uint16_t>(quick_length, 0xfff);
+ m_p_ram[0] = 0x1f; // add jump for RST key
+ for (uint16_t i = 1; i < read_; i++)
+ m_p_ram[i] = quick_data[i];
+
+ // load to 1780-17BF (spare ram inside 2656)
+ if (quick_length > 0x1780)
{
- result = image_error::INVALIDLENGTH;
- osd_printf_error("%s: File too long\n", image.basename());
- image.message(" File too long");
+ read_ = std::min<uint16_t>(quick_length, 0x17c0);
+ for (uint16_t i = 0x1780; i < read_; i++)
+ m_p_smiram[i-0x1780] = quick_data[i];
}
- else
+
+ // put start address into PC so it can be debugged
+ m_p_smiram[0x68] = m_p_ram[1];
+ m_p_smiram[0x69] = m_p_ram[2];
+
+ // load to 2000-7FFF (optional extra RAM)
+ if (quick_length > 0x2000)
{
- std::vector<uint8_t> quick_data(quick_length);
- read_ = image.fread( &quick_data[0], quick_length);
- if (read_ != quick_length)
- {
- result = image_error::UNSPECIFIED;
- osd_printf_error("%s: Cannot read the file\n", image.basename());
- image.message(" Cannot read the file");
- }
- else if (quick_data[0] != 0xc5)
- {
- result = image_error::INVALIDIMAGE;
- osd_printf_error("%s: Invalid header\n", image.basename());
- image.message(" Invalid header");
- }
- else
- {
- exec_addr = quick_data[1] * 256 + quick_data[2];
-
- if (exec_addr >= quick_length)
- {
- result = image_error::INVALIDIMAGE;
- osd_printf_error("%s: Exec address beyond end of file\n", image.basename());
- image.message(" Exec address beyond end of file");
- }
- else
- {
- // load to 0000-0FFE (standard ram + extra)
- read_ = 0xfff;
- if (quick_length < 0xfff)
- read_ = quick_length;
- m_p_ram[0] = 0x1f; // add jump for RST key
- for (i = 1; i < read_; i++)
- m_p_ram[i] = quick_data[i];
-
- // load to 1780-17BF (spare ram inside 2656)
- read_ = 0x17c0;
- if (quick_length < 0x17c0)
- read_ = quick_length;
- if (quick_length > 0x1780)
- for (i = 0x1780; i < read_; i++)
- m_p_smiram[i-0x1780] = quick_data[i];
-
- // put start address into PC so it can be debugged
- m_p_smiram[0x68] = m_p_ram[1];
- m_p_smiram[0x69] = m_p_ram[2];
-
- // load to 2000-7FFF (optional extra ram)
- if (quick_length > 0x2000)
- for (i = 0x2000; i < quick_length; i++)
- m_p_extram[i-0x2000] = quick_data[i];
-
- /* display a message about the loaded quickload */
- image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr);
-
- // Start the quickload - JP exec_addr
- m_maincpu->set_state_int(S2650_PC, 0);
-
- result = std::error_condition();
- }
- }
+ for (uint16_t i = 0x2000; i < quick_length; i++)
+ m_p_extram[i-0x2000] = quick_data[i];
}
- return result;
+ // display a message about the loaded quickload
+ image.message(" Quickload: size=%04X : exec=%04X", quick_length, exec_addr);
+
+ // Start the quickload - JP exec_addr
+ m_maincpu->set_state_int(S2650_PC, 0);
+
+ return std::make_pair(std::error_condition(), std::string());
}
void instruct_state::instruct(machine_config &config)
diff --git a/src/mame/trainer/mk14.cpp b/src/mame/trainer/mk14.cpp
index 31d3688a9f7..4a2908c1762 100644
--- a/src/mame/trainer/mk14.cpp
+++ b/src/mame/trainer/mk14.cpp
@@ -370,29 +370,25 @@ void mk14vdu_state::draw_page_graphics(int page, uint16_t addr, int invert, bitm
QUICKLOAD_LOAD_MEMBER(mk14_state::quickload_cb)
{
if (image.software_entry() == nullptr)
- {
- osd_printf_error("%s: Unsupported quickload format", image.basename());
- return image_error::UNSUPPORTED;
- }
- else
- {
- uint16_t size = image.length();
- int load_addr, exec_addr;
- sscanf(image.get_feature("load"), "%x", &load_addr);
- sscanf(image.get_feature("exec"), "%x", &exec_addr);
+ return std::make_pair(image_error::UNSUPPORTED, "Unsupported quickload format");
- for (uint16_t i = 0; i < size; i++)
- {
- uint8_t data;
+ uint16_t const size = image.length();
+ int load_addr, exec_addr;
+ sscanf(image.get_feature("load"), "%x", &load_addr);
+ sscanf(image.get_feature("exec"), "%x", &exec_addr);
- if (image.fread(&data, 1) != 1)
- return image_error::UNSPECIFIED;
- m_maincpu->space(AS_PROGRAM).write_byte(load_addr + i, data);
- }
+ for (uint16_t i = 0; i < size; i++)
+ {
+ uint8_t data;
- m_maincpu->set_pc(exec_addr);
+ if (image.fread(&data, 1) != 1)
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
+ m_maincpu->space(AS_PROGRAM).write_byte(load_addr + i, data);
}
- return std::error_condition();
+
+ m_maincpu->set_pc(exec_addr);
+
+ return std::make_pair(std::error_condition(), std::string());
}
void mk14_state::mk14(machine_config &config)
diff --git a/src/mame/trs/coco_vhd.cpp b/src/mame/trs/coco_vhd.cpp
index b63d106f227..5007c29bdba 100644
--- a/src/mame/trs/coco_vhd.cpp
+++ b/src/mame/trs/coco_vhd.cpp
@@ -104,12 +104,12 @@ void coco_vhd_image_device::device_start()
// call_load
//-------------------------------------------------
-std::error_condition coco_vhd_image_device::call_load()
+std::pair<std::error_condition, std::string> coco_vhd_image_device::call_load()
{
m_status = VHDSTATUS_POWER_ON_STATE;
m_logical_record_number = 0;
m_buffer_address = 0;
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/trs/coco_vhd.h b/src/mame/trs/coco_vhd.h
index 405477ae222..5657bc7ca21 100644
--- a/src/mame/trs/coco_vhd.h
+++ b/src/mame/trs/coco_vhd.h
@@ -34,7 +34,7 @@ public:
virtual ~coco_vhd_image_device();
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual bool is_readable() const noexcept override { return true; }
virtual bool is_writeable() const noexcept override { return true; }
diff --git a/src/mame/trs/trs80_m.cpp b/src/mame/trs/trs80_m.cpp
index fbc52ca0524..d3d05ac9cf9 100644
--- a/src/mame/trs/trs80_m.cpp
+++ b/src/mame/trs/trs80_m.cpp
@@ -401,8 +401,9 @@ QUICKLOAD_LOAD_MEMBER(trs80_state::quickload_cb)
ptr = program.get_write_ptr(address);
if (!ptr)
{
- image.message("Attempting to write outside of RAM");
- return image_error::INVALIDIMAGE;
+ return std::make_pair(
+ image_error::INVALIDIMAGE,
+ util::string_format("Object code block at address %04x is outside RAM", address));
}
image.fread( ptr, block_length);
}
@@ -415,7 +416,7 @@ QUICKLOAD_LOAD_MEMBER(trs80_state::quickload_cb)
if (LOG) logerror("/CMD transfer address %04x\n", address);
m_maincpu->set_state_int(Z80_PC, address);
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
case CMD_TYPE_LOAD_MODULE_HEADER: // 05 - name
image.fread(&data, length);
@@ -430,10 +431,11 @@ QUICKLOAD_LOAD_MEMBER(trs80_state::quickload_cb)
default:
image.fread(&data, length);
logerror("/CMD unsupported block type %u!\n", type);
- image.message("Unsupported or invalid block type");
- return image_error::INVALIDIMAGE;
+ return std::make_pair(
+ image_error::INVALIDIMAGE,
+ util::string_format("Unsupported or invalid block type %u", type));
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/trs/trs80m3_m.cpp b/src/mame/trs/trs80m3_m.cpp
index 831bdecfc57..724170a1819 100644
--- a/src/mame/trs/trs80m3_m.cpp
+++ b/src/mame/trs/trs80m3_m.cpp
@@ -690,8 +690,9 @@ QUICKLOAD_LOAD_MEMBER(trs80m3_state::quickload_cb)
ptr = program.get_write_ptr(address);
if (!ptr)
{
- image.message("Attempting to write outside of RAM");
- return image_error::INVALIDIMAGE;
+ return std::make_pair(
+ image_error::INVALIDIMAGE,
+ util::string_format("Object code block at address %04x is outside RAM", address));
}
image.fread(ptr, block_length);
}
@@ -704,7 +705,7 @@ QUICKLOAD_LOAD_MEMBER(trs80m3_state::quickload_cb)
if (LOG) logerror("/CMD transfer address %04x\n", address);
m_maincpu->set_state_int(Z80_PC, address);
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
case CMD_TYPE_LOAD_MODULE_HEADER: // 05 - name
image.fread( &data, length);
@@ -719,10 +720,11 @@ QUICKLOAD_LOAD_MEMBER(trs80m3_state::quickload_cb)
default:
image.fread(&data, length);
logerror("/CMD unsupported block type %u!\n", type);
- image.message("Unsupported or invalid block type");
- return image_error::INVALIDIMAGE;
+ return std::make_pair(
+ image_error::INVALIDIMAGE,
+ util::string_format("Unsupported or invalid block type %u", type));
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/tvgames/elan_eu3a05.cpp b/src/mame/tvgames/elan_eu3a05.cpp
index 4528714757b..857e07b6336 100644
--- a/src/mame/tvgames/elan_eu3a05.cpp
+++ b/src/mame/tvgames/elan_eu3a05.cpp
@@ -365,15 +365,12 @@ DEVICE_IMAGE_LOAD_MEMBER(elan_eu3a05_buzztime_state::cart_load)
uint32_t const size = m_cart->common_get_size("rom");
if (size != 0x20'0000)
- {
- osd_printf_error("%s: Unsupported cartridge size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (only 2M supported)");
m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_NATIVE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void elan_eu3a05_buzztime_state::elan_buzztime(machine_config &config)
diff --git a/src/mame/tvgames/generalplus_gpl16250_mobigo.cpp b/src/mame/tvgames/generalplus_gpl16250_mobigo.cpp
index a76d7853e42..cfd89438a0a 100644
--- a/src/mame/tvgames/generalplus_gpl16250_mobigo.cpp
+++ b/src/mame/tvgames/generalplus_gpl16250_mobigo.cpp
@@ -75,7 +75,7 @@ DEVICE_IMAGE_LOAD_MEMBER(mobigo2_state::cart_load)
uint32_t const size = m_cart->common_get_size("rom");
m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
DEVICE_IMAGE_LOAD_MEMBER(mobigo_state::cart_load)
@@ -83,7 +83,7 @@ DEVICE_IMAGE_LOAD_MEMBER(mobigo_state::cart_load)
uint32_t const size = m_cart->common_get_size("rom");
m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/tvgames/generalplus_gpl16250_nand.cpp b/src/mame/tvgames/generalplus_gpl16250_nand.cpp
index c71acef6097..e3c2dccae1d 100644
--- a/src/mame/tvgames/generalplus_gpl16250_nand.cpp
+++ b/src/mame/tvgames/generalplus_gpl16250_nand.cpp
@@ -108,7 +108,7 @@ DEVICE_IMAGE_LOAD_MEMBER(generalplus_gpac800_vbaby_game_state::cart_load)
m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void generalplus_gpac800_vbaby_game_state::generalplus_gpac800_vbaby(machine_config &config)
diff --git a/src/mame/tvgames/generalplus_gpl16250_spi.cpp b/src/mame/tvgames/generalplus_gpl16250_spi.cpp
index fd72259749b..9897fc3a14a 100644
--- a/src/mame/tvgames/generalplus_gpl16250_spi.cpp
+++ b/src/mame/tvgames/generalplus_gpl16250_spi.cpp
@@ -113,7 +113,7 @@ DEVICE_IMAGE_LOAD_MEMBER(generalplus_gpspispi_bkrankp_game_state::cart_load)
m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void generalplus_gpspispi_bkrankp_game_state::generalplus_gpspispi_bkrankp(machine_config &config)
diff --git a/src/mame/tvgames/generalplus_gpl32612.cpp b/src/mame/tvgames/generalplus_gpl32612.cpp
index 06685121413..b84b9b332f5 100644
--- a/src/mame/tvgames/generalplus_gpl32612.cpp
+++ b/src/mame/tvgames/generalplus_gpl32612.cpp
@@ -206,7 +206,7 @@ DEVICE_IMAGE_LOAD_MEMBER(generalplus_zippity_game_state::cart_load)
m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/tvgames/hyperscan_card.cpp b/src/mame/tvgames/hyperscan_card.cpp
index 61e33bc9b70..e527821ae4e 100644
--- a/src/mame/tvgames/hyperscan_card.cpp
+++ b/src/mame/tvgames/hyperscan_card.cpp
@@ -65,14 +65,14 @@ void hyperscan_card_device::device_reset()
call_load()
-------------------------------------------------*/
-std::error_condition hyperscan_card_device::call_load()
+std::pair<std::error_condition, std::string> hyperscan_card_device::call_load()
{
if (fread(m_memory, sizeof(m_memory)) != sizeof(m_memory))
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
battery_load(m_memory, sizeof(m_memory), nullptr);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/tvgames/hyperscan_card.h b/src/mame/tvgames/hyperscan_card.h
index 32dd095efc3..820f4bfcf43 100644
--- a/src/mame/tvgames/hyperscan_card.h
+++ b/src/mame/tvgames/hyperscan_card.h
@@ -23,7 +23,7 @@ protected:
virtual void device_reset() override;
// device_image_interface implementation
- virtual std::error_condition call_load() override;
+ virtual std::pair<std::error_condition, std::string> call_load() override;
virtual void call_unload() override;
virtual bool is_creatable() const noexcept override { return false; }
virtual bool is_reset_on_load() const noexcept override { return false; }
diff --git a/src/mame/tvgames/magiceyes_pollux_vr3520f.cpp b/src/mame/tvgames/magiceyes_pollux_vr3520f.cpp
index 2bfbd28708f..6b6df2f1a4f 100644
--- a/src/mame/tvgames/magiceyes_pollux_vr3520f.cpp
+++ b/src/mame/tvgames/magiceyes_pollux_vr3520f.cpp
@@ -76,7 +76,7 @@ DEVICE_IMAGE_LOAD_MEMBER(magiceyes_vr3520f_game_state::cart_load)
m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
static INPUT_PORTS_START( leapfrog_didj )
diff --git a/src/mame/tvgames/pubint_storyreader.cpp b/src/mame/tvgames/pubint_storyreader.cpp
index 41fea27e073..7b42e3acea7 100644
--- a/src/mame/tvgames/pubint_storyreader.cpp
+++ b/src/mame/tvgames/pubint_storyreader.cpp
@@ -123,7 +123,7 @@ DEVICE_IMAGE_LOAD_MEMBER(pi_storyreader_state::cart_load)
m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
static INPUT_PORTS_START( pi_storyreader )
diff --git a/src/mame/tvgames/spg110.cpp b/src/mame/tvgames/spg110.cpp
index 9ca15e90d3f..49738e0c4bc 100644
--- a/src/mame/tvgames/spg110.cpp
+++ b/src/mame/tvgames/spg110.cpp
@@ -568,7 +568,7 @@ DEVICE_IMAGE_LOAD_MEMBER(spg110_sstarkar_game_state::cart_load)
m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/tvgames/spg29x.cpp b/src/mame/tvgames/spg29x.cpp
index 42e9003d1cc..2987ad7c3e8 100644
--- a/src/mame/tvgames/spg29x.cpp
+++ b/src/mame/tvgames/spg29x.cpp
@@ -436,7 +436,7 @@ QUICKLOAD_LOAD_MEMBER(spg29x_game_state::quickload_hyper_exe)
std::unique_ptr<u8 []> ptr;
if (image.fread(ptr, length) != length)
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
auto &space = m_maincpu->space(AS_PROGRAM);
for (uint32_t i = 0; i < length; i++)
@@ -444,7 +444,7 @@ QUICKLOAD_LOAD_MEMBER(spg29x_game_state::quickload_hyper_exe)
m_maincpu->set_state_int(SCORE_PC, 0xa0091000); // Game entry point
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void spg29x_game_state::spg29x(machine_config &config)
diff --git a/src/mame/tvgames/spg2xx_ican.cpp b/src/mame/tvgames/spg2xx_ican.cpp
index 2fbcfe13061..0e211e90d5c 100644
--- a/src/mame/tvgames/spg2xx_ican.cpp
+++ b/src/mame/tvgames/spg2xx_ican.cpp
@@ -432,15 +432,12 @@ DEVICE_IMAGE_LOAD_MEMBER(icanguit_state::cart_load_icanguit)
uint32_t const size = m_cart->common_get_size("rom");
if (size < 0x80'0000)
- {
- osd_printf_error("%s: Unsupported cartridge size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be at least 8M)");
m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/tvgames/spg2xx_smarttv.cpp b/src/mame/tvgames/spg2xx_smarttv.cpp
index 02771d5354b..2f9142d6711 100644
--- a/src/mame/tvgames/spg2xx_smarttv.cpp
+++ b/src/mame/tvgames/spg2xx_smarttv.cpp
@@ -195,15 +195,12 @@ DEVICE_IMAGE_LOAD_MEMBER(smarttv_state::cart_load_smarttv)
uint32_t const size = m_cart->common_get_size("rom");
if (size > 0x80'0000)
- {
- osd_printf_error("%s: Unsupported cartridge size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be no more than 8M)");
m_cart->rom_alloc(0x800000, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void smarttv_state::smarttv(machine_config &config)
diff --git a/src/mame/tvgames/spg2xx_telestory.cpp b/src/mame/tvgames/spg2xx_telestory.cpp
index 341916ebaed..ebcd6c1206c 100644
--- a/src/mame/tvgames/spg2xx_telestory.cpp
+++ b/src/mame/tvgames/spg2xx_telestory.cpp
@@ -255,19 +255,17 @@ void telestory_state::machine_reset()
}
DEVICE_IMAGE_LOAD_MEMBER(telestory_state::cart_load_telestory)
+
{
uint32_t const size = m_cart->common_get_size("rom");
if (size > 0x80'0000)
- {
- osd_printf_error("%s: Unsupported cartridge size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be no more than 8M)");
m_cart->rom_alloc(0x800000, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void telestory_state::telestory(machine_config &config)
diff --git a/src/mame/tvgames/spg2xx_tvgogo.cpp b/src/mame/tvgames/spg2xx_tvgogo.cpp
index 0e187bd3159..8290c0d365c 100644
--- a/src/mame/tvgames/spg2xx_tvgogo.cpp
+++ b/src/mame/tvgames/spg2xx_tvgogo.cpp
@@ -212,15 +212,12 @@ DEVICE_IMAGE_LOAD_MEMBER(tvgogo_state::cart_load_tvgogo)
uint32_t const size = m_cart->common_get_size("rom");
if (size > 0x80'0000)
- {
- osd_printf_error("%s: Unsupported cartridge size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be no more than 8M)");
m_cart->rom_alloc(0x800000, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/tvgames/spg2xx_vii.cpp b/src/mame/tvgames/spg2xx_vii.cpp
index 015caeda01d..d9bfeac7134 100644
--- a/src/mame/tvgames/spg2xx_vii.cpp
+++ b/src/mame/tvgames/spg2xx_vii.cpp
@@ -139,15 +139,12 @@ DEVICE_IMAGE_LOAD_MEMBER(vii_state::cart_load_vii)
uint32_t const size = m_cart->common_get_size("rom");
if (size < 0x80'0000)
- {
- osd_printf_error("%s: Unsupported cartridge size\n", image.basename());
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be at least 8M)");
m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void vii_state::vii(machine_config &config)
diff --git a/src/mame/usp/patinho_feio.cpp b/src/mame/usp/patinho_feio.cpp
index dcf269890c1..8fe1d6c173c 100644
--- a/src/mame/usp/patinho_feio.cpp
+++ b/src/mame/usp/patinho_feio.cpp
@@ -182,7 +182,7 @@ DEVICE_IMAGE_LOAD_MEMBER( patinho_feio_state::tape_load )
paper_tape_address = 0;
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void patinho_feio_state::machine_start(){
diff --git a/src/mame/ussr/lviv.h b/src/mame/ussr/lviv.h
index 742b621c2a6..5683aee099a 100644
--- a/src/mame/ussr/lviv.h
+++ b/src/mame/ussr/lviv.h
@@ -71,7 +71,7 @@ private:
void update_memory();
void setup_snapshot(uint8_t *data);
void dump_registers();
- std::error_condition verify_snapshot(const uint8_t * data, uint32_t size);
+ std::pair<std::error_condition, std::string> verify_snapshot(const uint8_t * data, uint32_t size);
void io_map(address_map &map);
void mem_map(address_map &map);
diff --git a/src/mame/ussr/lviv_m.cpp b/src/mame/ussr/lviv_m.cpp
index 9bd16428f94..a006ea9b344 100644
--- a/src/mame/ussr/lviv_m.cpp
+++ b/src/mame/ussr/lviv_m.cpp
@@ -271,24 +271,17 @@ void lviv_state::dump_registers()
logerror("HL = %04x\n", (unsigned) m_maincpu->state_int(i8080_cpu_device::I8085_HL));
}
-std::error_condition lviv_state::verify_snapshot(const uint8_t * data, uint32_t size)
+std::pair<std::error_condition, std::string> lviv_state::verify_snapshot(const uint8_t * data, uint32_t size)
{
- const char* tag = "LVOV/DUMP/2.0/";
+ if (size != LVIV_SNAPSHOT_SIZE)
+ return std::make_pair(image_error::INVALIDLENGTH, "Incorrect snapshot file length");
+ char const *const tag = "LVOV/DUMP/2.0/";
if (strncmp(tag, (const char*)data, strlen(tag)))
- {
- logerror("Not a Lviv snapshot\n");
- return image_error::INVALIDIMAGE;
- }
-
- if (size != LVIV_SNAPSHOT_SIZE)
- {
- logerror ("Incomplete snapshot file\n");
- return image_error::INVALIDLENGTH;
- }
+ return std::make_pair(image_error::INVALIDIMAGE, "Not a Lviv snapshot");
logerror("returning ID_OK\n");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
SNAPSHOT_LOAD_MEMBER(lviv_state::snapshot_cb)
@@ -297,8 +290,8 @@ SNAPSHOT_LOAD_MEMBER(lviv_state::snapshot_cb)
image.fread(&snapshot_data[0], LVIV_SNAPSHOT_SIZE);
- std::error_condition err = verify_snapshot(&snapshot_data[0], image.length());
- if (err)
+ auto err = verify_snapshot(&snapshot_data[0], image.length());
+ if (err.first)
return err;
setup_snapshot(&snapshot_data[0]);
@@ -306,5 +299,5 @@ SNAPSHOT_LOAD_MEMBER(lviv_state::snapshot_cb)
dump_registers();
logerror("Snapshot file loaded\n");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/videoton/tvc.cpp b/src/mame/videoton/tvc.cpp
index 03af49152d7..b9546f7ea7a 100644
--- a/src/mame/videoton/tvc.cpp
+++ b/src/mame/videoton/tvc.cpp
@@ -746,11 +746,11 @@ QUICKLOAD_LOAD_MEMBER(tvc_state::quickload_cb)
{
image.fseek(0x90, SEEK_SET);
image.fread(m_ram->pointer() + 0x19ef, image.length() - 0x90);
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
else
{
- return image_error::INVALIDIMAGE;
+ return std::make_pair(image_error::INVALIDIMAGE, std::string());
}
}
diff --git a/src/mame/virtual/vgmplay.cpp b/src/mame/virtual/vgmplay.cpp
index 7d887307111..00285bc2c9a 100644
--- a/src/mame/virtual/vgmplay.cpp
+++ b/src/mame/virtual/vgmplay.cpp
@@ -2767,317 +2767,315 @@ QUICKLOAD_LOAD_MEMBER(vgmplay_state::load_file)
m_file_data.resize(image.length());
- if (image.length() == 0 ||
- image.fread(&m_file_data[0], image.length()) != image.length())
+ if (image.length() == 0)
+ {
+ return std::make_pair(image_error::INVALIDLENGTH, "Empty file");
+ }
+ else if(image.fread(&m_file_data[0], image.length()) != image.length())
{
m_file_data.clear();
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, "Error reading file");
}
- else
+
+ // Decompress gzip-compressed files (aka vgz)
+ if(m_file_data[0] == 0x1f && m_file_data[1] == 0x8b)
{
- // Decompress gzip-compressed files (aka vgz)
- if(m_file_data[0] == 0x1f && m_file_data[1] == 0x8b)
+ std::vector<uint8_t> decomp;
+ int bs = m_file_data.size();
+ decomp.resize(2*bs);
+ z_stream str;
+ str.zalloc = nullptr;
+ str.zfree = nullptr;
+ str.opaque = nullptr;
+ str.data_type = 0;
+ str.next_in = &m_file_data[0];
+ str.avail_in = m_file_data.size();
+ str.total_in = 0;
+ str.total_out = 0;
+ int err = inflateInit2(&str, 31);
+ if(err != Z_OK)
{
- std::vector<uint8_t> decomp;
- int bs = m_file_data.size();
- decomp.resize(2*bs);
- z_stream str;
- str.zalloc = nullptr;
- str.zfree = nullptr;
- str.opaque = nullptr;
- str.data_type = 0;
- str.next_in = &m_file_data[0];
- str.avail_in = m_file_data.size();
- str.total_in = 0;
- str.total_out = 0;
- int err = inflateInit2(&str, 31);
- if(err != Z_OK)
- {
- logerror("gzip header but not a gzip file\n");
- m_file_data.clear();
- return image_error::INVALIDIMAGE;
- }
- do
- {
- if(str.total_out >= decomp.size())
- decomp.resize(decomp.size() + bs);
- str.next_out = &decomp[str.total_out];
- str.avail_out = decomp.size() - str.total_out;
- err = inflate(&str, Z_SYNC_FLUSH);
- } while(err == Z_OK);
-
- if(err != Z_STREAM_END)
- {
- logerror("broken gzip file\n");
- m_file_data.clear();
- return image_error::INVALIDIMAGE;
- }
- m_file_data.resize(str.total_out);
- memcpy(&m_file_data[0], &decomp[0], str.total_out);
+ m_file_data.clear();
+ return std::make_pair(image_error::INVALIDIMAGE, "File has gzip header but is not a gzip file");
}
-
- if(m_file_data.size() < 0x40 || r32(0) != 0x206d6756)
+ do
+ {
+ if(str.total_out >= decomp.size())
+ decomp.resize(decomp.size() + bs);
+ str.next_out = &decomp[str.total_out];
+ str.avail_out = decomp.size() - str.total_out;
+ err = inflate(&str, Z_SYNC_FLUSH);
+ } while(err == Z_OK);
+
+ if(err != Z_STREAM_END)
{
- logerror("Not a vgm/vgz file\n");
m_file_data.clear();
- return image_error::INVALIDIMAGE;
+ return std::make_pair(image_error::INVALIDIMAGE, "Error decompressing gzip file");
}
+ m_file_data.resize(str.total_out);
+ memcpy(&m_file_data[0], &decomp[0], str.total_out);
+ }
+
+ if(m_file_data.size() < 0x40 || r32(0) != 0x206d6756)
+ {
+ m_file_data.clear();
+ return std::make_pair(image_error::INVALIDIMAGE, "Invalid VGM file header");
+ }
- uint32_t const version = r32(8);
- logerror("File version %x.%02x\n", version >> 8, version & 0xff);
+ uint32_t const version = r32(8);
+ logerror("File version %x.%02x\n", version >> 8, version & 0xff);
- uint32_t data_start = version >= 0x150 ? r32(0x34) + 0x34 : 0x40;
- int volbyte = version >= 0x160 && data_start >= 0x7d ? r8(0x7c) : 0;
- logerror("Volume %02x\n", volbyte);
+ uint32_t data_start = version >= 0x150 ? r32(0x34) + 0x34 : 0x40;
+ int volbyte = version >= 0x160 && data_start >= 0x7d ? r8(0x7c) : 0;
+ logerror("Volume %02x\n", volbyte);
- if (volbyte == 0xc1) // 0x00~0xc0 0~192, 0xc1 -64, 0xc2~0xff -62~-1
- volbyte = -0x40;
- else if (volbyte > 0xc1)
- volbyte -= 0x100;
+ if (volbyte == 0xc1) // 0x00~0xc0 0~192, 0xc1 -64, 0xc2~0xff -62~-1
+ volbyte = -0x40;
+ else if (volbyte > 0xc1)
+ volbyte -= 0x100;
- float const volume = version >= 0x160 && data_start >= 0x7d ? powf(2.0f, float(volbyte) / float(0x20)) : 1.0f;
+ float const volume = version >= 0x160 && data_start >= 0x7d ? powf(2.0f, float(volbyte) / float(0x20)) : 1.0f;
- uint32_t const extra_header_start = version >= 0x170 && data_start >= 0xc0 && r32(0xbc) ? r32(0xbc) + 0xbc : 0;
- uint32_t const header_size = extra_header_start ? extra_header_start : data_start;
+ uint32_t const extra_header_start = version >= 0x170 && data_start >= 0xc0 && r32(0xbc) ? r32(0xbc) + 0xbc : 0;
+ uint32_t const header_size = extra_header_start ? extra_header_start : data_start;
- uint32_t const extra_header_size = extra_header_start ? r32(extra_header_start) : 0;
- uint32_t const chip_clock_start = extra_header_size >= 4 && r32(extra_header_start + 4) ? r32(extra_header_start + 4) + extra_header_start + 4: 0;
- uint32_t const chip_volume_start = extra_header_size >= 8 && r32(extra_header_start + 8) ? r32(extra_header_start + 8) + extra_header_start + 8 : 0;
+ uint32_t const extra_header_size = extra_header_start ? r32(extra_header_start) : 0;
+ uint32_t const chip_clock_start = extra_header_size >= 4 && r32(extra_header_start + 4) ? r32(extra_header_start + 4) + extra_header_start + 4: 0;
+ uint32_t const chip_volume_start = extra_header_size >= 8 && r32(extra_header_start + 8) ? r32(extra_header_start + 8) + extra_header_start + 8 : 0;
- if (chip_volume_start != 0)
- osd_printf_warning("Warning: file has unsupported chip volumes\n");
+ if (chip_volume_start != 0)
+ osd_printf_warning("Warning: file has unsupported chip volumes\n");
- const auto setup_device(
- [this, version, volume, header_size, chip_clock_start] (
- device_t &device,
- int chip_num,
- vgm_chip chip_type,
- uint32_t offset,
- uint32_t min_version = 0)
- {
- uint32_t c = 0;
- float chip_volume = volume;
- bool has_2chip = false;
+ const auto setup_device(
+ [this, version, volume, header_size, chip_clock_start] (
+ device_t &device,
+ int chip_num,
+ vgm_chip chip_type,
+ uint32_t offset,
+ uint32_t min_version = 0)
+ {
+ uint32_t c = 0;
+ float chip_volume = volume;
+ bool has_2chip = false;
- if (min_version <= version && offset + 4 <= header_size && (chip_num == 0 || (r32(offset) & 0x40000000) != 0))
- {
- c = r32(offset);
- has_2chip = (c & 0x40000000) != 0;
+ if (min_version <= version && offset + 4 <= header_size && (chip_num == 0 || (r32(offset) & 0x40000000) != 0))
+ {
+ c = r32(offset);
+ has_2chip = (c & 0x40000000) != 0;
- if (chip_clock_start && chip_num != 0)
- for (auto i(0); i < r8(chip_clock_start); i++)
+ if (chip_clock_start && chip_num != 0)
+ for (auto i(0); i < r8(chip_clock_start); i++)
+ {
+ if (r8(chip_clock_start + 1 + (i * 5)) == chip_type)
{
- if (r8(chip_clock_start + 1 + (i * 5)) == chip_type)
- {
- c = r32(chip_clock_start + 2 + (i * 5));
- break;
- }
+ c = r32(chip_clock_start + 2 + (i * 5));
+ break;
}
- }
+ }
+ }
- if (has_2chip)
- {
- chip_volume /= 2.0f;
- }
- device.set_unscaled_clock(c & ~0xc0000000);
- if (device.unscaled_clock() != 0)
- dynamic_cast<device_sound_interface *>(&device)->set_output_gain(ALL_OUTPUTS, chip_volume);
- else
- dynamic_cast<device_sound_interface *>(&device)->set_output_gain(ALL_OUTPUTS, 0);
-
- return (c & 0x80000000) != 0;
- });
-
- // Parse clocks
- if (setup_device(*m_sn76489[0], 0, CT_SN76489, 0x0c) ||
- setup_device(*m_sn76489[1], 1, CT_SN76489, 0x0c))
- osd_printf_warning("Warning: file requests an unsupported T6W28\n");
-
- if (setup_device(*m_ym2413[0], 0, CT_YM2413, 0x10) ||
- setup_device(*m_ym2413[1], 1, CT_YM2413, 0x10))
- osd_printf_warning("Warning: file requests an unsupported VRC7\n");
-
- if (setup_device(*m_ym2612[0], 0, CT_YM2612, version < 110 ? 0x10 : 0x2c) ||
- setup_device(*m_ym2612[1], 1, CT_YM2612, version < 110 ? 0x10 : 0x2c))
- osd_printf_warning("Warning: file requests an unsupported YM3438\n");
-
- setup_device(*m_ym2151[0], 0, CT_YM2151, version < 110 ? 0x10 : 0x30);
- setup_device(*m_ym2151[1], 1, CT_YM2151, version < 110 ? 0x10 : 0x30);
-
- setup_device(*m_segapcm[0], 0, CT_SEGAPCM, 0x38, 0x151);
- setup_device(*m_segapcm[1], 1, CT_SEGAPCM, 0x38, 0x151);
- m_segapcm[0]->set_bank(version >= 0x151 && header_size >= 0x40 ? r32(0x3c) : 0);
- m_segapcm[1]->set_bank(version >= 0x151 && header_size >= 0x40 ? r32(0x3c) : 0);
-
- setup_device(*m_rf5c68, 0, CT_RF5C68, 0x40, 0x151);
- setup_device(*m_ym2203[0], 0, CT_YM2203, 0x44, 0x151);
- setup_device(*m_ym2203[1], 1, CT_YM2203, 0x44, 0x151);
- setup_device(*m_ym2608[0], 0, CT_YM2608, 0x48, 0x151);
- setup_device(*m_ym2608[1], 1, CT_YM2608, 0x48, 0x151);
-
- if (setup_device(*m_ym2610[0], 0, CT_YM2610, 0x4c, 0x151) ||
- setup_device(*m_ym2610[1], 1, CT_YM2610, 0x4c, 0x151))
- osd_printf_warning("Warning: file requests an unsupported YM2610B\n");
-
- if (setup_device(*m_ym3812[0], 0, CT_YM3812, 0x50, 0x151) ||
- setup_device(*m_ym3812[1], 1, CT_YM3812, 0x50, 0x151))
- osd_printf_warning("Warning: file requests an unsupported SoundBlaster Pro\n");
-
- setup_device(*m_ym3526[0], 0, CT_YM3526, 0x54, 0x151);
- setup_device(*m_ym3526[1], 1, CT_YM3526, 0x54, 0x151);
- setup_device(*m_y8950[0], 0, CT_Y8950, 0x58, 0x151);
- setup_device(*m_y8950[1], 1, CT_Y8950, 0x58, 0x151);
- setup_device(*m_ymf262[0], 0, CT_YMF262, 0x5c, 0x151);
- setup_device(*m_ymf262[1], 1, CT_YMF262, 0x5c, 0x151);
- setup_device(*m_ymf278b[0], 0, CT_YMF278B, 0x60, 0x151);
- setup_device(*m_ymf278b[1], 1, CT_YMF278B, 0x60, 0x151);
- setup_device(*m_ymf271[0], 0, CT_YMF271, 0x64, 0x151);
- setup_device(*m_ymf271[1], 1, CT_YMF271, 0x64, 0x151);
- setup_device(*m_ymz280b[0], 0, CT_YMZ280B, 0x68, 0x151);
- setup_device(*m_ymz280b[1], 1, CT_YMZ280B, 0x68, 0x151);
-
- if (setup_device(*m_rf5c164, 0, CT_RF5C164, 0x6c, 0x151))
- osd_printf_warning("Warning: file requests an unsupported Cosmic Fantasy Stories HACK\n");
-
- setup_device(*m_sega32x, 0, CT_SEGA32X, 0x70, 0x151);
-
- setup_device(*m_ay8910[0], 0, CT_AY8910, 0x74, 0x151);
- setup_device(*m_ay8910[1], 1, CT_AY8910, 0x74, 0x151);
- m_ay8910[0]->set_psg_type(vgm_ay8910_type(version >= 0x151 && header_size >= 0x7c ? r8(0x78) : 0));
- m_ay8910[1]->set_psg_type(vgm_ay8910_type(version >= 0x151 && header_size >= 0x7c ? r8(0x78) : 0));
- m_ay8910[0]->set_flags(vgm_ay8910_flags(version >= 0x151 && header_size >= 0x7a ? r8(0x79) : 0));
- m_ay8910[1]->set_flags(vgm_ay8910_flags(version >= 0x151 && header_size >= 0x7a ? r8(0x79) : 0));
-
- setup_device(*m_dmg[0], 0, CT_GAMEBOY, 0x80, 0x161);
- setup_device(*m_dmg[1], 1, CT_GAMEBOY, 0x80, 0x161);
-
- if (setup_device(*m_nescpu[0], 0, CT_NESAPU, 0x84, 0x161) ||
- setup_device(*m_nescpu[1], 1, CT_NESAPU, 0x84, 0x161))
- osd_printf_warning("Warning: file requests an unsupported FDS sound addon\n");
-
- setup_device(*m_multipcm[0], 0, CT_MULTIPCM, 0x88, 0x161);
- setup_device(*m_multipcm[1], 1, CT_MULTIPCM, 0x88, 0x161);
-
- setup_device(*m_upd7759[0], 0, CT_UPD7759, 0x8c, 0x161);
- setup_device(*m_upd7759[1], 1, CT_UPD7759, 0x8c, 0x161);
- m_upd7759_md[0] = r32(0x8c) & 0x80000000 ? 0 : 1;
- m_upd7759_md[1] = r32(0x8c) & 0x80000000 ? 0 : 1;
-
- setup_device(*m_okim6258[0], 0, CT_OKIM6258, 0x90, 0x161);
- setup_device(*m_okim6258[1], 1, CT_OKIM6258, 0x90, 0x161);
-
- uint8_t okim6258_flags = version >= 0x161 && header_size >= 0x95 ? r8(0x94) : 0;
- m_okim6258_divider[0] = okim6258_flags & 3;
- m_okim6258[0]->set_divider(m_okim6258_divider[0]);
- m_okim6258[0]->set_outbits(BIT(okim6258_flags, 3) ? 12 : 10);
- m_okim6258[0]->set_type(BIT(okim6258_flags, 2));
- m_okim6258_divider[1] = okim6258_flags & 3;
- m_okim6258[1]->set_divider(m_okim6258_divider[1]);
- m_okim6258[1]->set_outbits(BIT(okim6258_flags, 3) ? 12 : 10);
- m_okim6258[1]->set_type(BIT(okim6258_flags, 2));
-
- m_k054539[0]->init_flags(version >= 0x161 && header_size >= 0x96 ? r8(0x95) : 0);
- m_k054539[1]->init_flags(version >= 0x161 && header_size >= 0x96 ? r8(0x95) : 0);
-
- C140_TYPE c140_type = c140_bank_type(version >= 0x161 && header_size >= 0x96 ? r8(0x96) : 0);
- m_vgmplay->set_c140_bank_type(0, c140_type);
- m_vgmplay->set_c140_bank_type(1, c140_type);
-
- m_okim6295_pin7[0] = setup_device(*m_okim6295[0], 0, CT_OKIM6295, 0x98, 0x161);
- m_okim6295_pin7[1] = setup_device(*m_okim6295[1], 1, CT_OKIM6295, 0x98, 0x161);
- m_okim6295[0]->set_pin7(m_okim6295_pin7[0] ? okim6295_device::PIN7_HIGH : okim6295_device::PIN7_LOW);
- m_okim6295[1]->set_pin7(m_okim6295_pin7[1] ? okim6295_device::PIN7_HIGH : okim6295_device::PIN7_LOW);
-
- setup_device(*m_k051649[0], 0, CT_K051649, 0x9c, 0x161);
- setup_device(*m_k051649[1], 1, CT_K051649, 0x9c, 0x161);
-
- // HACK: Some VGMs contain the halved clock speed of the sound core inside the SCC
- m_k051649[0]->set_clock_scale(m_k051649[0]->unscaled_clock() < 2097152 ? 2.0 : 1.0);
- m_k051649[1]->set_clock_scale(m_k051649[1]->unscaled_clock() < 2097152 ? 2.0 : 1.0);
-
- setup_device(*m_k054539[0], 0, CT_K054539, 0xa0, 0x161);
- setup_device(*m_k054539[1], 1, CT_K054539, 0xa0, 0x161);
-
- // HACK: Some VGMs contain 48,000 instead of 18,432,000
- m_k054539[0]->set_clock_scale(m_k054539[0]->unscaled_clock() == 48000 ? 384.0 : 1.0);
- m_k054539[1]->set_clock_scale(m_k054539[1]->unscaled_clock() == 48000 ? 384.0 : 1.0);
- if (m_k054539[0]->unscaled_clock() == 48000 || m_k054539[1]->unscaled_clock() == 48000)
- osd_printf_error("bad rip detected, correcting k054539 clock\n");
-
- // HACK: VGM contain the halved clock speed of the sound core inside the HUC6280
- m_huc6280[0]->set_clock_scale(2);
- m_huc6280[1]->set_clock_scale(2);
-
- setup_device(*m_huc6280[0], 0, CT_C6280, 0xa4, 0x161);
- setup_device(*m_huc6280[1], 1, CT_C6280, 0xa4, 0x161);
- if (c140_type == C140_ASIC219)
- {
- setup_device(*m_c219[0], 0, CT_C140, 0xa8, 0x161);
- setup_device(*m_c219[1], 1, CT_C140, 0xa8, 0x161);
- }
- else
- {
- setup_device(*m_c140[0], 0, CT_C140, 0xa8, 0x161);
- setup_device(*m_c140[1], 1, CT_C140, 0xa8, 0x161);
- }
- setup_device(*m_k053260[0], 0, CT_K053260, 0xac, 0x161);
- setup_device(*m_k053260[1], 1, CT_K053260, 0xac, 0x161);
- setup_device(*m_pokey[0], 0, CT_POKEY, 0xb0, 0x161);
- setup_device(*m_pokey[1], 1, CT_POKEY, 0xb0, 0x161);
-
- setup_device(*m_qsound, 0, CT_QSOUND, 0xb4, 0x161);
-
- // HACK: VGMs contain 4,000,000 instead of 60,000,000
- m_qsound->set_clock_scale(m_qsound->unscaled_clock() == 4000000 ? 15.0 : 1.0);
- if (m_qsound->unscaled_clock() == 4000000)
- osd_printf_error("bad rip detected, correcting qsound clock\n");
-
- setup_device(*m_scsp[0], 0, CT_SCSP, 0xb8, 0x171);
- setup_device(*m_scsp[1], 1, CT_SCSP, 0xb8, 0x171);
- setup_device(*m_wswan[0], 0, CT_WSWAN, 0xc0, 0x171);
- setup_device(*m_wswan[1], 1, CT_WSWAN, 0xc0, 0x171);
- setup_device(*m_vsu_vue[0], 0, CT_VSU_VUE, 0xc4, 0x171);
- setup_device(*m_vsu_vue[1], 1, CT_VSU_VUE, 0xc4, 0x171);
- setup_device(*m_saa1099[0], 0, CT_SAA1099, 0xc8, 0x171);
- setup_device(*m_saa1099[1], 1, CT_SAA1099, 0xc8, 0x171);
- setup_device(*m_es5503[0], 0, CT_ES5503, 0xcc, 0x171);
- setup_device(*m_es5503[1], 1, CT_ES5503, 0xcc, 0x171);
-
- if (setup_device(*m_es5505[0], 0, CT_ES5505, 0xd0, 0x171) ||
- setup_device(*m_es5505[1], 1, CT_ES5503, 0xd0, 0x171))
- osd_printf_warning("Warning: file requests an unsupported ES5506\n");
-
- // TODO: dynamically remap es5503/es5505 channels?
- //m_es5503[0]->set_channels(version >= 0x171 && header_size >= 0xd5 ? r8(0xd4) : 0);
- //m_es5503[1]->set_channels(version >= 0x171 && header_size >= 0xd5 ? r8(0xd4) : 0);
- //m_es5505[0]->set_channels(version >= 0x171 && header_size >= 0xd6 ? r8(0xd5) : 0);
- //m_es5505[1]->set_channels(version >= 0x171 && header_size >= 0xd6 ? r8(0xd5) : 0);
-
- m_c352[0]->set_divider(version >= 0x171 && header_size >= 0xd7 && r8(0xd6) ? r8(0xd6) * 4 : 1);
- m_c352[1]->set_divider(version >= 0x171 && header_size >= 0xd7 && r8(0xd6) ? r8(0xd6) * 4 : 1);
-
- setup_device(*m_x1_010[0], 0, CT_X1_010, 0xd8, 0x171);
- setup_device(*m_x1_010[1], 1, CT_X1_010, 0xd8, 0x171);
-
- if (setup_device(*m_c352[0], 0, CT_C352, 0xdc, 0x171) ||
- setup_device(*m_c352[1], 1, CT_C352, 0xdc, 0x171))
- osd_printf_warning("Warning: file requests an unsupported disable rear speakers\n");
-
- setup_device(*m_ga20[0], 0, CT_GA20, 0xe0, 0x171);
- setup_device(*m_ga20[1], 1, CT_GA20, 0xe0, 0x171);
-
- for (device_t &child : subdevices())
- if (child.clock() != 0)
- logerror("%s %d\n", child.tag(), child.clock());
-
- //for (auto &stream : machine().sound().streams())
- // if (stream->sample_rate() != 0)
- // logerror("%s %d\n", stream->device().tag(), stream->sample_rate());
-
- machine().schedule_soft_reset();
-
- return std::error_condition();
+ if (has_2chip)
+ {
+ chip_volume /= 2.0f;
+ }
+ device.set_unscaled_clock(c & ~0xc0000000);
+ if (device.unscaled_clock() != 0)
+ dynamic_cast<device_sound_interface *>(&device)->set_output_gain(ALL_OUTPUTS, chip_volume);
+ else
+ dynamic_cast<device_sound_interface *>(&device)->set_output_gain(ALL_OUTPUTS, 0);
+
+ return (c & 0x80000000) != 0;
+ });
+
+ // Parse clocks
+ if (setup_device(*m_sn76489[0], 0, CT_SN76489, 0x0c) ||
+ setup_device(*m_sn76489[1], 1, CT_SN76489, 0x0c))
+ osd_printf_warning("Warning: file requests an unsupported T6W28\n");
+
+ if (setup_device(*m_ym2413[0], 0, CT_YM2413, 0x10) ||
+ setup_device(*m_ym2413[1], 1, CT_YM2413, 0x10))
+ osd_printf_warning("Warning: file requests an unsupported VRC7\n");
+
+ if (setup_device(*m_ym2612[0], 0, CT_YM2612, version < 110 ? 0x10 : 0x2c) ||
+ setup_device(*m_ym2612[1], 1, CT_YM2612, version < 110 ? 0x10 : 0x2c))
+ osd_printf_warning("Warning: file requests an unsupported YM3438\n");
+
+ setup_device(*m_ym2151[0], 0, CT_YM2151, version < 110 ? 0x10 : 0x30);
+ setup_device(*m_ym2151[1], 1, CT_YM2151, version < 110 ? 0x10 : 0x30);
+
+ setup_device(*m_segapcm[0], 0, CT_SEGAPCM, 0x38, 0x151);
+ setup_device(*m_segapcm[1], 1, CT_SEGAPCM, 0x38, 0x151);
+ m_segapcm[0]->set_bank(version >= 0x151 && header_size >= 0x40 ? r32(0x3c) : 0);
+ m_segapcm[1]->set_bank(version >= 0x151 && header_size >= 0x40 ? r32(0x3c) : 0);
+
+ setup_device(*m_rf5c68, 0, CT_RF5C68, 0x40, 0x151);
+ setup_device(*m_ym2203[0], 0, CT_YM2203, 0x44, 0x151);
+ setup_device(*m_ym2203[1], 1, CT_YM2203, 0x44, 0x151);
+ setup_device(*m_ym2608[0], 0, CT_YM2608, 0x48, 0x151);
+ setup_device(*m_ym2608[1], 1, CT_YM2608, 0x48, 0x151);
+
+ if (setup_device(*m_ym2610[0], 0, CT_YM2610, 0x4c, 0x151) ||
+ setup_device(*m_ym2610[1], 1, CT_YM2610, 0x4c, 0x151))
+ osd_printf_warning("Warning: file requests an unsupported YM2610B\n");
+
+ if (setup_device(*m_ym3812[0], 0, CT_YM3812, 0x50, 0x151) ||
+ setup_device(*m_ym3812[1], 1, CT_YM3812, 0x50, 0x151))
+ osd_printf_warning("Warning: file requests an unsupported SoundBlaster Pro\n");
+
+ setup_device(*m_ym3526[0], 0, CT_YM3526, 0x54, 0x151);
+ setup_device(*m_ym3526[1], 1, CT_YM3526, 0x54, 0x151);
+ setup_device(*m_y8950[0], 0, CT_Y8950, 0x58, 0x151);
+ setup_device(*m_y8950[1], 1, CT_Y8950, 0x58, 0x151);
+ setup_device(*m_ymf262[0], 0, CT_YMF262, 0x5c, 0x151);
+ setup_device(*m_ymf262[1], 1, CT_YMF262, 0x5c, 0x151);
+ setup_device(*m_ymf278b[0], 0, CT_YMF278B, 0x60, 0x151);
+ setup_device(*m_ymf278b[1], 1, CT_YMF278B, 0x60, 0x151);
+ setup_device(*m_ymf271[0], 0, CT_YMF271, 0x64, 0x151);
+ setup_device(*m_ymf271[1], 1, CT_YMF271, 0x64, 0x151);
+ setup_device(*m_ymz280b[0], 0, CT_YMZ280B, 0x68, 0x151);
+ setup_device(*m_ymz280b[1], 1, CT_YMZ280B, 0x68, 0x151);
+
+ if (setup_device(*m_rf5c164, 0, CT_RF5C164, 0x6c, 0x151))
+ osd_printf_warning("Warning: file requests an unsupported Cosmic Fantasy Stories HACK\n");
+
+ setup_device(*m_sega32x, 0, CT_SEGA32X, 0x70, 0x151);
+
+ setup_device(*m_ay8910[0], 0, CT_AY8910, 0x74, 0x151);
+ setup_device(*m_ay8910[1], 1, CT_AY8910, 0x74, 0x151);
+ m_ay8910[0]->set_psg_type(vgm_ay8910_type(version >= 0x151 && header_size >= 0x7c ? r8(0x78) : 0));
+ m_ay8910[1]->set_psg_type(vgm_ay8910_type(version >= 0x151 && header_size >= 0x7c ? r8(0x78) : 0));
+ m_ay8910[0]->set_flags(vgm_ay8910_flags(version >= 0x151 && header_size >= 0x7a ? r8(0x79) : 0));
+ m_ay8910[1]->set_flags(vgm_ay8910_flags(version >= 0x151 && header_size >= 0x7a ? r8(0x79) : 0));
+
+ setup_device(*m_dmg[0], 0, CT_GAMEBOY, 0x80, 0x161);
+ setup_device(*m_dmg[1], 1, CT_GAMEBOY, 0x80, 0x161);
+
+ if (setup_device(*m_nescpu[0], 0, CT_NESAPU, 0x84, 0x161) ||
+ setup_device(*m_nescpu[1], 1, CT_NESAPU, 0x84, 0x161))
+ osd_printf_warning("Warning: file requests an unsupported FDS sound addon\n");
+
+ setup_device(*m_multipcm[0], 0, CT_MULTIPCM, 0x88, 0x161);
+ setup_device(*m_multipcm[1], 1, CT_MULTIPCM, 0x88, 0x161);
+
+ setup_device(*m_upd7759[0], 0, CT_UPD7759, 0x8c, 0x161);
+ setup_device(*m_upd7759[1], 1, CT_UPD7759, 0x8c, 0x161);
+ m_upd7759_md[0] = r32(0x8c) & 0x80000000 ? 0 : 1;
+ m_upd7759_md[1] = r32(0x8c) & 0x80000000 ? 0 : 1;
+
+ setup_device(*m_okim6258[0], 0, CT_OKIM6258, 0x90, 0x161);
+ setup_device(*m_okim6258[1], 1, CT_OKIM6258, 0x90, 0x161);
+
+ uint8_t okim6258_flags = version >= 0x161 && header_size >= 0x95 ? r8(0x94) : 0;
+ m_okim6258_divider[0] = okim6258_flags & 3;
+ m_okim6258[0]->set_divider(m_okim6258_divider[0]);
+ m_okim6258[0]->set_outbits(BIT(okim6258_flags, 3) ? 12 : 10);
+ m_okim6258[0]->set_type(BIT(okim6258_flags, 2));
+ m_okim6258_divider[1] = okim6258_flags & 3;
+ m_okim6258[1]->set_divider(m_okim6258_divider[1]);
+ m_okim6258[1]->set_outbits(BIT(okim6258_flags, 3) ? 12 : 10);
+ m_okim6258[1]->set_type(BIT(okim6258_flags, 2));
+
+ m_k054539[0]->init_flags(version >= 0x161 && header_size >= 0x96 ? r8(0x95) : 0);
+ m_k054539[1]->init_flags(version >= 0x161 && header_size >= 0x96 ? r8(0x95) : 0);
+
+ C140_TYPE c140_type = c140_bank_type(version >= 0x161 && header_size >= 0x96 ? r8(0x96) : 0);
+ m_vgmplay->set_c140_bank_type(0, c140_type);
+ m_vgmplay->set_c140_bank_type(1, c140_type);
+
+ m_okim6295_pin7[0] = setup_device(*m_okim6295[0], 0, CT_OKIM6295, 0x98, 0x161);
+ m_okim6295_pin7[1] = setup_device(*m_okim6295[1], 1, CT_OKIM6295, 0x98, 0x161);
+ m_okim6295[0]->set_pin7(m_okim6295_pin7[0] ? okim6295_device::PIN7_HIGH : okim6295_device::PIN7_LOW);
+ m_okim6295[1]->set_pin7(m_okim6295_pin7[1] ? okim6295_device::PIN7_HIGH : okim6295_device::PIN7_LOW);
+
+ setup_device(*m_k051649[0], 0, CT_K051649, 0x9c, 0x161);
+ setup_device(*m_k051649[1], 1, CT_K051649, 0x9c, 0x161);
+
+ // HACK: Some VGMs contain the halved clock speed of the sound core inside the SCC
+ m_k051649[0]->set_clock_scale(m_k051649[0]->unscaled_clock() < 2097152 ? 2.0 : 1.0);
+ m_k051649[1]->set_clock_scale(m_k051649[1]->unscaled_clock() < 2097152 ? 2.0 : 1.0);
+
+ setup_device(*m_k054539[0], 0, CT_K054539, 0xa0, 0x161);
+ setup_device(*m_k054539[1], 1, CT_K054539, 0xa0, 0x161);
+
+ // HACK: Some VGMs contain 48,000 instead of 18,432,000
+ m_k054539[0]->set_clock_scale(m_k054539[0]->unscaled_clock() == 48000 ? 384.0 : 1.0);
+ m_k054539[1]->set_clock_scale(m_k054539[1]->unscaled_clock() == 48000 ? 384.0 : 1.0);
+ if (m_k054539[0]->unscaled_clock() == 48000 || m_k054539[1]->unscaled_clock() == 48000)
+ osd_printf_error("bad rip detected, correcting k054539 clock\n");
+
+ // HACK: VGM contain the halved clock speed of the sound core inside the HUC6280
+ m_huc6280[0]->set_clock_scale(2);
+ m_huc6280[1]->set_clock_scale(2);
+
+ setup_device(*m_huc6280[0], 0, CT_C6280, 0xa4, 0x161);
+ setup_device(*m_huc6280[1], 1, CT_C6280, 0xa4, 0x161);
+ if (c140_type == C140_ASIC219)
+ {
+ setup_device(*m_c219[0], 0, CT_C140, 0xa8, 0x161);
+ setup_device(*m_c219[1], 1, CT_C140, 0xa8, 0x161);
+ }
+ else
+ {
+ setup_device(*m_c140[0], 0, CT_C140, 0xa8, 0x161);
+ setup_device(*m_c140[1], 1, CT_C140, 0xa8, 0x161);
}
+ setup_device(*m_k053260[0], 0, CT_K053260, 0xac, 0x161);
+ setup_device(*m_k053260[1], 1, CT_K053260, 0xac, 0x161);
+ setup_device(*m_pokey[0], 0, CT_POKEY, 0xb0, 0x161);
+ setup_device(*m_pokey[1], 1, CT_POKEY, 0xb0, 0x161);
+
+ setup_device(*m_qsound, 0, CT_QSOUND, 0xb4, 0x161);
+
+ // HACK: VGMs contain 4,000,000 instead of 60,000,000
+ m_qsound->set_clock_scale(m_qsound->unscaled_clock() == 4000000 ? 15.0 : 1.0);
+ if (m_qsound->unscaled_clock() == 4000000)
+ osd_printf_error("bad rip detected, correcting qsound clock\n");
+
+ setup_device(*m_scsp[0], 0, CT_SCSP, 0xb8, 0x171);
+ setup_device(*m_scsp[1], 1, CT_SCSP, 0xb8, 0x171);
+ setup_device(*m_wswan[0], 0, CT_WSWAN, 0xc0, 0x171);
+ setup_device(*m_wswan[1], 1, CT_WSWAN, 0xc0, 0x171);
+ setup_device(*m_vsu_vue[0], 0, CT_VSU_VUE, 0xc4, 0x171);
+ setup_device(*m_vsu_vue[1], 1, CT_VSU_VUE, 0xc4, 0x171);
+ setup_device(*m_saa1099[0], 0, CT_SAA1099, 0xc8, 0x171);
+ setup_device(*m_saa1099[1], 1, CT_SAA1099, 0xc8, 0x171);
+ setup_device(*m_es5503[0], 0, CT_ES5503, 0xcc, 0x171);
+ setup_device(*m_es5503[1], 1, CT_ES5503, 0xcc, 0x171);
+
+ if (setup_device(*m_es5505[0], 0, CT_ES5505, 0xd0, 0x171) ||
+ setup_device(*m_es5505[1], 1, CT_ES5503, 0xd0, 0x171))
+ osd_printf_warning("Warning: file requests an unsupported ES5506\n");
+
+ // TODO: dynamically remap es5503/es5505 channels?
+ //m_es5503[0]->set_channels(version >= 0x171 && header_size >= 0xd5 ? r8(0xd4) : 0);
+ //m_es5503[1]->set_channels(version >= 0x171 && header_size >= 0xd5 ? r8(0xd4) : 0);
+ //m_es5505[0]->set_channels(version >= 0x171 && header_size >= 0xd6 ? r8(0xd5) : 0);
+ //m_es5505[1]->set_channels(version >= 0x171 && header_size >= 0xd6 ? r8(0xd5) : 0);
+
+ m_c352[0]->set_divider(version >= 0x171 && header_size >= 0xd7 && r8(0xd6) ? r8(0xd6) * 4 : 1);
+ m_c352[1]->set_divider(version >= 0x171 && header_size >= 0xd7 && r8(0xd6) ? r8(0xd6) * 4 : 1);
+
+ setup_device(*m_x1_010[0], 0, CT_X1_010, 0xd8, 0x171);
+ setup_device(*m_x1_010[1], 1, CT_X1_010, 0xd8, 0x171);
+
+ if (setup_device(*m_c352[0], 0, CT_C352, 0xdc, 0x171) ||
+ setup_device(*m_c352[1], 1, CT_C352, 0xdc, 0x171))
+ osd_printf_warning("Warning: file requests an unsupported disable rear speakers\n");
+
+ setup_device(*m_ga20[0], 0, CT_GA20, 0xe0, 0x171);
+ setup_device(*m_ga20[1], 1, CT_GA20, 0xe0, 0x171);
+
+ for (device_t &child : subdevices())
+ if (child.clock() != 0)
+ logerror("%s %d\n", child.tag(), child.clock());
+
+ //for (auto &stream : machine().sound().streams())
+ // if (stream->sample_rate() != 0)
+ // logerror("%s %d\n", stream->device().tag(), stream->sample_rate());
+
+ machine().schedule_soft_reset();
+
+ return std::make_pair(std::error_condition(), std::string());
}
uint8_t vgmplay_state::file_r(offs_t offset)
diff --git a/src/mame/vtech/clickstart.cpp b/src/mame/vtech/clickstart.cpp
index 1c543362c6c..9d16aaf9da5 100644
--- a/src/mame/vtech/clickstart.cpp
+++ b/src/mame/vtech/clickstart.cpp
@@ -201,7 +201,7 @@ DEVICE_IMAGE_LOAD_MEMBER(clickstart_state::cart_load)
m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
TIMER_CALLBACK_MEMBER(clickstart_state::handle_uart_tx)
diff --git a/src/mame/vtech/geniusiq.cpp b/src/mame/vtech/geniusiq.cpp
index c8a3f0bf200..39a0b14fc03 100644
--- a/src/mame/vtech/geniusiq.cpp
+++ b/src/mame/vtech/geniusiq.cpp
@@ -692,7 +692,7 @@ DEVICE_IMAGE_LOAD_MEMBER(geniusiq_state::cart_load)
}
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
DEVICE_IMAGE_UNLOAD_MEMBER(geniusiq_state::cart_unload)
diff --git a/src/mame/vtech/innotv_innotabmax.cpp b/src/mame/vtech/innotv_innotabmax.cpp
index e3db3ad49af..72e3925f40c 100644
--- a/src/mame/vtech/innotv_innotabmax.cpp
+++ b/src/mame/vtech/innotv_innotabmax.cpp
@@ -124,7 +124,7 @@ DEVICE_IMAGE_LOAD_MEMBER(vtech_innotv_innotabmax_state::cart_load)
m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
static INPUT_PORTS_START( vtech_innotv_innotabmax )
diff --git a/src/mame/vtech/iqunlim.cpp b/src/mame/vtech/iqunlim.cpp
index 71c0c25f977..b56f813c92b 100644
--- a/src/mame/vtech/iqunlim.cpp
+++ b/src/mame/vtech/iqunlim.cpp
@@ -174,7 +174,7 @@ DEVICE_IMAGE_LOAD_MEMBER(iqunlim_state::cart_load)
m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_BIG);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/vtech/pc2000.cpp b/src/mame/vtech/pc2000.cpp
index fdb70250b55..b307926e2b5 100644
--- a/src/mame/vtech/pc2000.cpp
+++ b/src/mame/vtech/pc2000.cpp
@@ -908,7 +908,7 @@ DEVICE_IMAGE_LOAD_MEMBER( pc2000_state::cart_load )
m_cart->rom_alloc(0x40000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void pc2000_state::pc2000gen(machine_config &config)
diff --git a/src/mame/vtech/storio.cpp b/src/mame/vtech/storio.cpp
index 53e852722a2..d4d85fe0b1e 100644
--- a/src/mame/vtech/storio.cpp
+++ b/src/mame/vtech/storio.cpp
@@ -92,7 +92,7 @@ DEVICE_IMAGE_LOAD_MEMBER(vtech_storio_state::cart_load)
m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
static INPUT_PORTS_START( vtech_storio )
diff --git a/src/mame/vtech/vtech1.cpp b/src/mame/vtech/vtech1.cpp
index 12dec6b9d65..c075be7e2e0 100644
--- a/src/mame/vtech/vtech1.cpp
+++ b/src/mame/vtech/vtech1.cpp
@@ -163,7 +163,7 @@ SNAPSHOT_LOAD_MEMBER(vtech1_base_state::snapshot_cb)
uint8_t header[24];
if (image.fread(&header, sizeof(header)) != sizeof(header))
{
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
}
// get image name
@@ -181,10 +181,21 @@ SNAPSHOT_LOAD_MEMBER(vtech1_base_state::snapshot_cb)
auto buf = std::make_unique<uint8_t []>(size);
if (image.fread(buf.get(), size) != size)
{
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
}
uint8_t *ptr = &buf[0];
+ // check for supported format before overwriting memory
+ switch (header[21])
+ {
+ case VZ_BASIC:
+ case VZ_MCODE:
+ break;
+
+ default:
+ return std::make_pair(image_error::UNSUPPORTED, "Snapshot format not supported");
+ }
+
address_space &space = m_maincpu->space(AS_PROGRAM);
for (uint16_t addr = start; addr < end; addr++, ptr++)
{
@@ -194,10 +205,9 @@ SNAPSHOT_LOAD_MEMBER(vtech1_base_state::snapshot_cb)
// verify
if (space.read_byte(addr) != to_write)
{
- osd_printf_error("%s: Insufficient RAM to load snapshot\n", image.basename());
- image.message("Insufficient RAM to load snapshot (%d bytes needed) [%s]", size, pgmname);
-
- return image_error::INVALIDIMAGE;
+ return std::make_pair(
+ image_error::INVALIDIMAGE,
+ util::string_format("Insufficient RAM to load snapshot program '%s' (%d bytes needed)", pgmname, size));
}
}
@@ -222,14 +232,9 @@ SNAPSHOT_LOAD_MEMBER(vtech1_base_state::snapshot_cb)
image.message(" %s (M)\nsize=%04X : start=%04X : end=%04X", pgmname, size, start, end);
m_maincpu->set_pc(start); /* start program */
break;
-
- default:
- osd_printf_error("%s: Snapshot format not supported.\n", image.basename());
- image.message("Snapshot format not supported.");
- return image_error::UNSUPPORTED;
}
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/mame/vtech/vtech2_m.cpp b/src/mame/vtech/vtech2_m.cpp
index 6c9eb98ff2a..9b66cbbea7a 100644
--- a/src/mame/vtech/vtech2_m.cpp
+++ b/src/mame/vtech/vtech2_m.cpp
@@ -53,15 +53,14 @@ DEVICE_IMAGE_LOAD_MEMBER( vtech2_state::cart_load )
if (m_cart_size > 0x10000)
{
- osd_printf_error("%s: Cartridge bigger than 64k\n", image.basename());
m_cart_size = 0;
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, "Cartridge bigger than 64k");
}
m_cart->rom_alloc(m_cart_size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), m_cart_size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
void vtech2_state::machine_reset()
diff --git a/src/mame/vtech/vtech_innotab.cpp b/src/mame/vtech/vtech_innotab.cpp
index 364dc9ed01f..79ed5bf2264 100644
--- a/src/mame/vtech/vtech_innotab.cpp
+++ b/src/mame/vtech/vtech_innotab.cpp
@@ -75,7 +75,7 @@ DEVICE_IMAGE_LOAD_MEMBER(vtech_innotab_state::cart_load)
m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
static INPUT_PORTS_START( vtech_innotab )
diff --git a/src/mame/xerox/xerox820.cpp b/src/mame/xerox/xerox820.cpp
index ce9c643f483..b56a102205c 100644
--- a/src/mame/xerox/xerox820.cpp
+++ b/src/mame/xerox/xerox820.cpp
@@ -379,7 +379,7 @@ static const z80_daisy_config xerox820_daisy_chain[] =
QUICKLOAD_LOAD_MEMBER(xerox820_state::quickload_cb)
{
if (image.length() >= 0xfd00)
- return image_error::INVALIDLENGTH;
+ return std::make_pair(image_error::INVALIDLENGTH, std::string());
address_space &prog_space = m_maincpu->space(AS_PROGRAM);
@@ -389,7 +389,7 @@ QUICKLOAD_LOAD_MEMBER(xerox820_state::quickload_cb)
if ((prog_space.read_byte(0) != 0xc3) || (prog_space.read_byte(5) != 0xc3))
{
machine_reset();
- return image_error::UNSUPPORTED;
+ return std::make_pair(image_error::UNSUPPORTED, std::string());
}
/* Load image to the TPA (Transient Program Area) */
@@ -398,7 +398,7 @@ QUICKLOAD_LOAD_MEMBER(xerox820_state::quickload_cb)
{
uint8_t data;
if (image.fread( &data, 1) != 1)
- return image_error::UNSPECIFIED;
+ return std::make_pair(image_error::UNSPECIFIED, std::string());
prog_space.write_byte(i+0x100, data);
}
@@ -409,7 +409,7 @@ QUICKLOAD_LOAD_MEMBER(xerox820_state::quickload_cb)
m_maincpu->set_state_int(Z80_SP, 256 * prog_space.read_byte(7) - 300);
m_maincpu->set_pc(0x100); // start program
- return std::error_condition();
+ return std::make_pair(std::error_condition(), std::string());
}
diff --git a/src/osd/modules/debugger/debugimgui.cpp b/src/osd/modules/debugger/debugimgui.cpp
index a6f4554f75a..c216a106f1a 100644
--- a/src/osd/modules/debugger/debugimgui.cpp
+++ b/src/osd/modules/debugger/debugimgui.cpp
@@ -995,18 +995,18 @@ void debug_imgui::mount_image()
void debug_imgui::create_image()
{
- std::error_condition res;
+ std::pair<std::error_condition, std::string> res;
auto *fd = dynamic_cast<floppy_image_device *>(m_dialog_image);
if(fd != nullptr)
{
res = fd->create(m_path,nullptr,nullptr);
- if(!res)
+ if(!res.first)
fd->setup_write(m_typelist.at(m_format_sel).format);
}
else
res = m_dialog_image->create(m_path,nullptr,nullptr);
- if(!res)
+ if(!res.first)
ImGui::CloseCurrentPopup();
// TODO: add a messagebox to display on an error
}
diff --git a/src/osd/modules/debugger/qt/mainwindow.cpp b/src/osd/modules/debugger/qt/mainwindow.cpp
index f707804537d..5e97376aa7d 100644
--- a/src/osd/modules/debugger/qt/mainwindow.cpp
+++ b/src/osd/modules/debugger/qt/mainwindow.cpp
@@ -375,10 +375,10 @@ void MainWindow::mountImage(bool changedTo)
QDir::currentPath(),
tr("All files (*.*)"));
- std::error_condition err = img->load(filename.toUtf8().data());
+ auto [err, message] = img->load(filename.toUtf8().data());
if (err)
{
- m_machine.debugger().console().printf("Image could not be mounted: %s\n", err.message());
+ m_machine.debugger().console().printf("Image could not be mounted: %s\n", !message.empty() ? message : err.message());
return;
}